16 #ifndef LLVM_CODEGEN_REGALLOCPBQP_H
17 #define LLVM_CODEGEN_REGALLOCPBQP_H
29 class MachineBlockFrequencyInfo;
30 class MachineFunction;
31 class TargetRegisterInfo;
32 template<
class T>
class OwningPtr;
54 template <
typename AllowedRegsItr>
56 AllowedRegsItr arBegin, AllowedRegsItr arEnd) {
57 assert(node2VReg.find(nodeId) == node2VReg.end() &&
"Re-mapping node.");
58 assert(vreg2Node.
find(vreg) == vreg2Node.
end() &&
"Re-mapping vreg.");
59 assert(allowedSets[vreg].empty() &&
"vreg already has pregs.");
61 node2VReg[nodeId] = vreg;
62 vreg2Node[vreg] = nodeId;
63 std::copy(arBegin, arEnd, std::back_inserter(allowedSets[vreg]));
95 typedef std::map<PBQP::Graph::NodeId, unsigned> Node2VReg;
103 AllowedSetMap allowedSets;
151 void addPhysRegCoalesce(
PBQP::Vector &costVec,
unsigned pregOption,
161 char *customPassID=0);
SmallVector< unsigned, 16 > AllowedSet
unsigned getPRegForOption(unsigned vreg, unsigned option) const
Get PReg for option.
void recordVReg(unsigned vreg, PBQP::Graph::NodeId nodeId, AllowedRegsItr arBegin, AllowedRegsItr arEnd)
virtual PBQPRAProblem * build(MachineFunction *mf, const LiveIntervals *lis, const MachineBlockFrequencyInfo *mbfi, const RegSet &vregs)
Extended builder which adds coalescing constraints to a problem.
std::set< unsigned > RegSet
FunctionPass * createPBQPRegisterAllocator(OwningPtr< PBQPBuilder > &builder, char *customPassID=0)
const AllowedSet & getAllowedSet(unsigned vreg) const
Returns the allowed set for the given virtual register.
bool isPRegOption(unsigned vreg, unsigned option) const
PBQPBuilder()
Default constructor.
virtual PBQPRAProblem * build(MachineFunction *mf, const LiveIntervals *lis, const MachineBlockFrequencyInfo *mbfi, const RegSet &vregs)
virtual ~PBQPBuilder()
Clean up a PBQPBuilder.
unsigned getVRegForNode(PBQP::Graph::NodeId nodeId) const
Get the virtual register corresponding to the given PBQP node.
bool isSpillOption(unsigned vreg, unsigned option) const
PBQP::Graph::NodeId getNodeForVReg(unsigned vreg) const
Get the PBQP node corresponding to the given virtual register.
#define LLVM_DELETED_FUNCTION
const PBQP::Graph & getGraph() const
iterator find(const KeyT &Val)