Start moving leaf nodes over to the CSEMap.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29625 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2006-08-11 21:00:46 +00:00
parent ae2e622e74
commit cbea3045ce
2 changed files with 20 additions and 14 deletions

View File

@ -52,9 +52,6 @@ class SelectionDAG {
// AllNodes - A linked list of nodes in the current DAG. // AllNodes - A linked list of nodes in the current DAG.
ilist<SDNode> AllNodes; ilist<SDNode> AllNodes;
// ValueNodes - track SrcValue nodes
std::map<std::pair<const Value*, int>, SDNode*> ValueNodes;
public: public:
SelectionDAG(TargetLowering &tli, MachineFunction &mf, MachineDebugInfo *di) SelectionDAG(TargetLowering &tli, MachineFunction &mf, MachineDebugInfo *di)
: TLI(tli), MF(mf), DI(di) { : TLI(tli), MF(mf), DI(di) {
@ -110,14 +107,18 @@ public:
void RemoveDeadNodes(); void RemoveDeadNodes();
SDOperand getString(const std::string &Val); SDOperand getString(const std::string &Val);
SDOperand getConstant(uint64_t Val, MVT::ValueType VT); SDOperand getConstant(uint64_t Val, MVT::ValueType VT, bool isTarget = false);
SDOperand getTargetConstant(uint64_t Val, MVT::ValueType VT); SDOperand getTargetConstant(uint64_t Val, MVT::ValueType VT) {
return getConstant(Val, VT, true);
}
SDOperand getConstantFP(double Val, MVT::ValueType VT); SDOperand getConstantFP(double Val, MVT::ValueType VT);
SDOperand getTargetConstantFP(double Val, MVT::ValueType VT); SDOperand getTargetConstantFP(double Val, MVT::ValueType VT);
SDOperand getGlobalAddress(const GlobalValue *GV, MVT::ValueType VT, SDOperand getGlobalAddress(const GlobalValue *GV, MVT::ValueType VT,
int offset = 0); int offset = 0, bool isTargetGA = false);
SDOperand getTargetGlobalAddress(const GlobalValue *GV, MVT::ValueType VT, SDOperand getTargetGlobalAddress(const GlobalValue *GV, MVT::ValueType VT,
int offset = 0); int offset = 0) {
return getGlobalAddress(GV, VT, offset, true);
}
SDOperand getFrameIndex(int FI, MVT::ValueType VT); SDOperand getFrameIndex(int FI, MVT::ValueType VT);
SDOperand getTargetFrameIndex(int FI, MVT::ValueType VT); SDOperand getTargetFrameIndex(int FI, MVT::ValueType VT);
SDOperand getJumpTable(int JTI, MVT::ValueType VT); SDOperand getJumpTable(int JTI, MVT::ValueType VT);
@ -449,13 +450,8 @@ private:
std::list<std::vector<MVT::ValueType> > VTList; std::list<std::vector<MVT::ValueType> > VTList;
// Maps to auto-CSE operations. // Maps to auto-CSE operations.
std::map<std::pair<unsigned, MVT::ValueType>, RegisterSDNode*> RegNodes;
std::vector<CondCodeSDNode*> CondCodeNodes; std::vector<CondCodeSDNode*> CondCodeNodes;
std::map<std::pair<const GlobalValue*, int>, SDNode*> GlobalValues;
std::map<std::pair<const GlobalValue*, int>, SDNode*> TargetGlobalValues;
std::map<std::pair<uint64_t, MVT::ValueType>, SDNode*> Constants;
std::map<std::pair<uint64_t, MVT::ValueType>, SDNode*> TargetConstants;
std::map<std::pair<uint64_t, MVT::ValueType>, SDNode*> ConstantFPs; std::map<std::pair<uint64_t, MVT::ValueType>, SDNode*> ConstantFPs;
std::map<std::pair<uint64_t, MVT::ValueType>, SDNode*> TargetConstantFPs; std::map<std::pair<uint64_t, MVT::ValueType>, SDNode*> TargetConstantFPs;
std::map<int, SDNode*> FrameIndices, TargetFrameIndices, JumpTableIndices, std::map<int, SDNode*> FrameIndices, TargetFrameIndices, JumpTableIndices,
@ -464,7 +460,6 @@ private:
std::pair<int, unsigned> >, SDNode*> ConstantPoolIndices; std::pair<int, unsigned> >, SDNode*> ConstantPoolIndices;
std::map<std::pair<Constant *, std::map<std::pair<Constant *,
std::pair<int, unsigned> >, SDNode*> TargetConstantPoolIndices; std::pair<int, unsigned> >, SDNode*> TargetConstantPoolIndices;
std::map<MachineBasicBlock *, SDNode*> BBNodes;
std::vector<SDNode*> ValueTypeNodes; std::vector<SDNode*> ValueTypeNodes;
std::map<std::string, SDNode*> ExternalSymbols; std::map<std::string, SDNode*> ExternalSymbols;
std::map<std::string, SDNode*> TargetExternalSymbols; std::map<std::string, SDNode*> TargetExternalSymbols;

View File

@ -98,12 +98,23 @@ namespace llvm {
void SetOperands(const SDOperand *Ops, unsigned NumOps); void SetOperands(const SDOperand *Ops, unsigned NumOps);
void AddOperand(SDOperand Op); void AddOperand(SDOperand Op);
void AddPointer(const void *Ptr); void AddPointer(const void *Ptr);
void AddInteger(int I) { void AddInteger(signed I) {
Bits.push_back((I >> 0) & 0xFF); Bits.push_back((I >> 0) & 0xFF);
Bits.push_back((I >> 8) & 0xFF); Bits.push_back((I >> 8) & 0xFF);
Bits.push_back((I >> 16) & 0xFF); Bits.push_back((I >> 16) & 0xFF);
Bits.push_back((I >> 24) & 0xFF); Bits.push_back((I >> 24) & 0xFF);
} }
void AddInteger(unsigned I) {
AddInteger((signed)I);
}
void AddInteger(uint64_t I) {
union {
uint64_t x;
unsigned char A[8];
};
x = I;
Bits.append(A, A+8);
}
unsigned ComputeHash() const; unsigned ComputeHash() const;