mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-26 22:34:39 +00:00
Change the ValueList array for each node to be shared instead of individually
allocated. Further, in the common case where a node has a single value, just reference an element from a small array. This is a small compile-time wi. llvm-svn: 24250
This commit is contained in:
parent
cffd7d5bdc
commit
e1cf681dee
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
#include "llvm/CodeGen/SelectionDAGNodes.h"
|
#include "llvm/CodeGen/SelectionDAGNodes.h"
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <list>
|
||||||
#include <string> // FIXME remove eventually, turning map into const char* map.
|
#include <string> // FIXME remove eventually, turning map into const char* map.
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
@ -172,7 +173,7 @@ public:
|
|||||||
SDOperand Callee, bool isTailCall = false) {
|
SDOperand Callee, bool isTailCall = false) {
|
||||||
SDNode *NN = new SDNode(isTailCall ? ISD::TAILCALL : ISD::CALL, Chain,
|
SDNode *NN = new SDNode(isTailCall ? ISD::TAILCALL : ISD::CALL, Chain,
|
||||||
Callee);
|
Callee);
|
||||||
NN->setValueTypes(RetVals);
|
setNodeValueTypes(NN, RetVals);
|
||||||
AllNodes.push_back(NN);
|
AllNodes.push_back(NN);
|
||||||
return NN;
|
return NN;
|
||||||
}
|
}
|
||||||
@ -186,7 +187,7 @@ public:
|
|||||||
ArgsInRegs.insert(ArgsInRegs.begin(), Callee);
|
ArgsInRegs.insert(ArgsInRegs.begin(), Callee);
|
||||||
ArgsInRegs.insert(ArgsInRegs.begin(), Chain);
|
ArgsInRegs.insert(ArgsInRegs.begin(), Chain);
|
||||||
SDNode *NN = new SDNode(isTailCall ? ISD::TAILCALL : ISD::CALL, ArgsInRegs);
|
SDNode *NN = new SDNode(isTailCall ? ISD::TAILCALL : ISD::CALL, ArgsInRegs);
|
||||||
NN->setValueTypes(RetVals);
|
setNodeValueTypes(NN, RetVals);
|
||||||
AllNodes.push_back(NN);
|
AllNodes.push_back(NN);
|
||||||
return NN;
|
return NN;
|
||||||
}
|
}
|
||||||
@ -356,12 +357,18 @@ private:
|
|||||||
SDNode *AddNonLeafNodeToCSEMaps(SDNode *N);
|
SDNode *AddNonLeafNodeToCSEMaps(SDNode *N);
|
||||||
void DestroyDeadNode(SDNode *N);
|
void DestroyDeadNode(SDNode *N);
|
||||||
void DeleteNodeNotInCSEMaps(SDNode *N);
|
void DeleteNodeNotInCSEMaps(SDNode *N);
|
||||||
|
void setNodeValueTypes(SDNode *N, std::vector<MVT::ValueType> &RetVals);
|
||||||
|
void setNodeValueTypes(SDNode *N, MVT::ValueType VT1, MVT::ValueType VT2);
|
||||||
|
|
||||||
|
|
||||||
/// SimplifySetCC - Try to simplify a setcc built with the specified operands
|
/// SimplifySetCC - Try to simplify a setcc built with the specified operands
|
||||||
/// and cc. If unable to simplify it, return a null SDOperand.
|
/// and cc. If unable to simplify it, return a null SDOperand.
|
||||||
SDOperand SimplifySetCC(MVT::ValueType VT, SDOperand N1,
|
SDOperand SimplifySetCC(MVT::ValueType VT, SDOperand N1,
|
||||||
SDOperand N2, ISD::CondCode Cond);
|
SDOperand N2, ISD::CondCode Cond);
|
||||||
|
|
||||||
|
// List of non-single value types.
|
||||||
|
std::list<std::vector<MVT::ValueType> > VTList;
|
||||||
|
|
||||||
// Maps to auto-CSE operations.
|
// Maps to auto-CSE operations.
|
||||||
std::map<std::pair<unsigned, MVT::ValueType>, SDNode *> NullaryOps;
|
std::map<std::pair<unsigned, MVT::ValueType>, SDNode *> NullaryOps;
|
||||||
std::map<std::pair<unsigned, std::pair<SDOperand, MVT::ValueType> >,
|
std::map<std::pair<unsigned, std::pair<SDOperand, MVT::ValueType> >,
|
||||||
|
@ -577,11 +577,14 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
friend class SelectionDAG;
|
friend class SelectionDAG;
|
||||||
|
|
||||||
|
/// getValueTypeList - Return a pointer to the specified value type.
|
||||||
|
///
|
||||||
|
static MVT::ValueType *getValueTypeList(MVT::ValueType VT);
|
||||||
|
|
||||||
SDNode(unsigned NT, MVT::ValueType VT) : NodeType(NT), NodeDepth(1) {
|
SDNode(unsigned NT, MVT::ValueType VT) : NodeType(NT), NodeDepth(1) {
|
||||||
OperandList = 0; NumOperands = 0;
|
OperandList = 0; NumOperands = 0;
|
||||||
ValueList = new MVT::ValueType[1];
|
ValueList = getValueTypeList(VT);
|
||||||
ValueList[0] = VT;
|
|
||||||
NumValues = 1;
|
NumValues = 1;
|
||||||
}
|
}
|
||||||
SDNode(unsigned NT, SDOperand Op)
|
SDNode(unsigned NT, SDOperand Op)
|
||||||
@ -668,7 +671,6 @@ protected:
|
|||||||
|
|
||||||
virtual ~SDNode() {
|
virtual ~SDNode() {
|
||||||
assert(NumOperands == 0 && "Operand list not cleared before deletion");
|
assert(NumOperands == 0 && "Operand list not cleared before deletion");
|
||||||
delete [] ValueList;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// MorphNodeTo - This clears the return value and operands list, and sets the
|
/// MorphNodeTo - This clears the return value and operands list, and sets the
|
||||||
@ -676,7 +678,6 @@ protected:
|
|||||||
/// the SelectionDAG class.
|
/// the SelectionDAG class.
|
||||||
void MorphNodeTo(unsigned Opc) {
|
void MorphNodeTo(unsigned Opc) {
|
||||||
NodeType = Opc;
|
NodeType = Opc;
|
||||||
delete [] ValueList;
|
|
||||||
ValueList = 0;
|
ValueList = 0;
|
||||||
NumValues = 0;
|
NumValues = 0;
|
||||||
|
|
||||||
@ -691,24 +692,13 @@ protected:
|
|||||||
|
|
||||||
void setValueTypes(MVT::ValueType VT) {
|
void setValueTypes(MVT::ValueType VT) {
|
||||||
assert(NumValues == 0 && "Should not have values yet!");
|
assert(NumValues == 0 && "Should not have values yet!");
|
||||||
ValueList = new MVT::ValueType[1];
|
ValueList = getValueTypeList(VT);
|
||||||
ValueList[0] = VT;
|
|
||||||
NumValues = 1;
|
NumValues = 1;
|
||||||
}
|
}
|
||||||
void setValueTypes(MVT::ValueType VT1, MVT::ValueType VT2) {
|
void setValueTypes(MVT::ValueType *List, unsigned NumVal) {
|
||||||
assert(NumValues == 0 && "Should not have values yet!");
|
assert(NumValues == 0 && "Should not have values yet!");
|
||||||
ValueList = new MVT::ValueType[2];
|
ValueList = List;
|
||||||
ValueList[0] = VT1;
|
NumValues = NumVal;
|
||||||
ValueList[1] = VT2;
|
|
||||||
NumValues = 2;
|
|
||||||
}
|
|
||||||
void setValueTypes(const std::vector<MVT::ValueType> &VTs) {
|
|
||||||
assert(NumValues == 0 && "Should not have values yet!");
|
|
||||||
if (VTs.size() == 0) return; // don't alloc memory.
|
|
||||||
ValueList = new MVT::ValueType[VTs.size()];
|
|
||||||
for (unsigned i = 0, e = VTs.size(); i != e; ++i)
|
|
||||||
ValueList[i] = VTs[i];
|
|
||||||
NumValues = VTs.size();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void setOperands(SDOperand Op0) {
|
void setOperands(SDOperand Op0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user