[llvm-commits] [vector_llvm] CVS: llvm/include/llvm/CodeGen/AsmPrinter.h LiveInterval.h LiveIntervalAnalysis.h MachineFrameInfo.h Passes.h SelectionDAG.h SelectionDAGNodes.h
Robert Bocchino
bocchino at cs.uiuc.edu
Wed Nov 16 10:32:02 PST 2005
Changes in directory llvm/include/llvm/CodeGen:
AsmPrinter.h updated: 1.13 -> 1.13.4.1
LiveInterval.h updated: 1.14 -> 1.14.4.1
LiveIntervalAnalysis.h updated: 1.47 -> 1.47.2.1
MachineFrameInfo.h updated: 1.12 -> 1.12.4.1
Passes.h updated: 1.20 -> 1.20.4.1
SelectionDAG.h updated: 1.63 -> 1.63.2.1
SelectionDAGNodes.h updated: 1.69 -> 1.69.2.1
---
Log message:
Merged mainline into Vector LLVM branch
---
Diffs of the changes: (+232 -103)
AsmPrinter.h | 13 ++
LiveInterval.h | 5 +
LiveIntervalAnalysis.h | 4
MachineFrameInfo.h | 21 ++++
Passes.h | 5 -
SelectionDAG.h | 42 +++++---
SelectionDAGNodes.h | 245 ++++++++++++++++++++++++++++++++-----------------
7 files changed, 232 insertions(+), 103 deletions(-)
Index: llvm/include/llvm/CodeGen/AsmPrinter.h
diff -u llvm/include/llvm/CodeGen/AsmPrinter.h:1.13 llvm/include/llvm/CodeGen/AsmPrinter.h:1.13.4.1
--- llvm/include/llvm/CodeGen/AsmPrinter.h:1.13 Thu Apr 21 15:38:00 2005
+++ llvm/include/llvm/CodeGen/AsmPrinter.h Wed Nov 16 12:31:50 2005
@@ -77,7 +77,12 @@
/// AsciiDirective - This directive allows emission of an ascii string with
/// the standard C escape characters embedded into it.
- const char *AsciiDirective;
+ const char *AsciiDirective; // Defaults to "\t.ascii\t"
+
+ /// AscizDirective - If not null, this allows for special handling of
+ /// zero terminated strings on this target. This is commonly supported as
+ /// ".asciz". If a target doesn't support this, it can be set to null.
+ const char *AscizDirective; // Defaults to "\t.asciz\t"
/// DataDirectives - These directives are used to output some unit of
/// integer data to the current section. If a data directive is set to
@@ -108,6 +113,7 @@
FunctionAddrSuffix(""),
ZeroDirective("\t.zero\t"),
AsciiDirective("\t.ascii\t"),
+ AscizDirective("\t.asciz\t"),
Data8bitsDirective("\t.byte\t"),
Data16bitsDirective("\t.short\t"),
Data32bitsDirective("\t.long\t"),
@@ -131,8 +137,9 @@
/// emitAlignment - Emit an alignment directive to the specified power of
/// two boundary. For example, if you pass in 3 here, you will get an 8
- /// byte alignment.
- void emitAlignment(unsigned NumBits) const;
+ /// byte alignment. If a global value is specified, and if that global has
+ /// an explicit alignment requested, it will override the alignment request.
+ void emitAlignment(unsigned NumBits, const GlobalValue *GV = 0) const;
/// emitZeros - Emit a block of zeros.
///
Index: llvm/include/llvm/CodeGen/LiveInterval.h
diff -u llvm/include/llvm/CodeGen/LiveInterval.h:1.14 llvm/include/llvm/CodeGen/LiveInterval.h:1.14.4.1
--- llvm/include/llvm/CodeGen/LiveInterval.h:1.14 Sat May 14 00:34:15 2005
+++ llvm/include/llvm/CodeGen/LiveInterval.h Wed Nov 16 12:31:50 2005
@@ -143,6 +143,11 @@
/// only overlaps with one value in the source interval.
bool joinable(const LiveInterval& other, unsigned CopyIdx) const;
+ /// getOverlapingRanges - Given another live interval which is defined as a
+ /// copy from this one, return a list of all of the live ranges where the
+ /// two overlap and have different value numbers.
+ void getOverlapingRanges(const LiveInterval &Other, unsigned CopyIdx,
+ std::vector<LiveRange*> &Ranges);
/// overlaps - Return true if the intersection of the two live intervals is
/// not empty.
Index: llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h
diff -u llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h:1.47 llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h:1.47.2.1
--- llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h:1.47 Tue Sep 20 23:18:25 2005
+++ llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h Wed Nov 16 12:31:50 2005
@@ -171,6 +171,10 @@
/// register classes. The registers may be either phys or virt regs.
bool differingRegisterClasses(unsigned RegA, unsigned RegB) const;
+ bool AdjustIfAllOverlappingRangesAreCopiesFrom(LiveInterval &IntA,
+ LiveInterval &IntB,
+ unsigned CopyIdx);
+
bool overlapsAliases(const LiveInterval *lhs,
const LiveInterval *rhs) const;
Index: llvm/include/llvm/CodeGen/MachineFrameInfo.h
diff -u llvm/include/llvm/CodeGen/MachineFrameInfo.h:1.12 llvm/include/llvm/CodeGen/MachineFrameInfo.h:1.12.4.1
--- llvm/include/llvm/CodeGen/MachineFrameInfo.h:1.12 Thu Apr 21 15:38:00 2005
+++ llvm/include/llvm/CodeGen/MachineFrameInfo.h Wed Nov 16 12:31:50 2005
@@ -85,6 +85,15 @@
/// to be allocated on entry to the function.
///
unsigned StackSize;
+
+ /// MaxAlignment - The prolog/epilog code inserter may process objects
+ /// that require greater alignment than the default alignment the target
+ /// provides. To handle this, MaxAlignment is set to the maximum alignment
+ /// needed by the objects on the current frame. If this is greater than the
+ /// native alignment maintained by the compiler, dynamic alignment code will
+ /// be needed.
+ ///
+ unsigned MaxAlignment;
/// HasCalls - Set to true if this function has any function calls. This is
/// only valid during and after prolog/epilog code insertion.
@@ -99,7 +108,7 @@
unsigned MaxCallFrameSize;
public:
MachineFrameInfo() {
- NumFixedObjects = StackSize = 0;
+ NumFixedObjects = StackSize = MaxAlignment = 0;
HasVarSizedObjects = false;
HasCalls = false;
MaxCallFrameSize = 0;
@@ -163,6 +172,16 @@
///
void setStackSize(unsigned Size) { StackSize = Size; }
+ /// getMaxAlignment - Return the alignment in bytes that this function must be
+ /// aligned to, which is greater than the default stack alignment provided by
+ /// the target.
+ ///
+ unsigned getMaxAlignment() const { return MaxAlignment; }
+
+ /// setMaxAlignment - Set the preferred alignment.
+ ///
+ void setMaxAlignment(unsigned Align) { MaxAlignment = Align; }
+
/// hasCalls - Return true if the current function has no function calls.
/// This is only valid during or after prolog/epilog code emission.
///
Index: llvm/include/llvm/CodeGen/Passes.h
diff -u llvm/include/llvm/CodeGen/Passes.h:1.20 llvm/include/llvm/CodeGen/Passes.h:1.20.4.1
--- llvm/include/llvm/CodeGen/Passes.h:1.20 Sun May 1 11:14:34 2005
+++ llvm/include/llvm/CodeGen/Passes.h Wed Nov 16 12:31:50 2005
@@ -70,11 +70,6 @@
///
FunctionPass *createLinearScanRegisterAllocator();
- /// IterativeScanRegisterAllocation Pass - This pass implements the iterative
- /// scan register allocation algorithm, a global register allocator.
- ///
- FunctionPass *createIterativeScanRegisterAllocator();
-
/// PrologEpilogCodeInserter Pass - This pass inserts prolog and epilog code,
/// and eliminates abstract frame references.
///
Index: llvm/include/llvm/CodeGen/SelectionDAG.h
diff -u llvm/include/llvm/CodeGen/SelectionDAG.h:1.63 llvm/include/llvm/CodeGen/SelectionDAG.h:1.63.2.1
--- llvm/include/llvm/CodeGen/SelectionDAG.h:1.63 Wed Oct 12 22:10:46 2005
+++ llvm/include/llvm/CodeGen/SelectionDAG.h Wed Nov 16 12:31:50 2005
@@ -16,7 +16,10 @@
#define LLVM_CODEGEN_SELECTIONDAG_H
#include "llvm/CodeGen/SelectionDAGNodes.h"
+#include "llvm/ADT/ilist"
+
#include <map>
+#include <list>
#include <string> // FIXME remove eventually, turning map into const char* map.
namespace llvm {
@@ -42,8 +45,8 @@
// Root - The root of the entire DAG. EntryNode - The starting token.
SDOperand Root, EntryNode;
- // AllNodes - All of the nodes in the DAG
- std::vector<SDNode*> AllNodes;
+ // AllNodes - A linked list of nodes in the current DAG.
+ ilist<SDNode> AllNodes;
// ValueNodes - track SrcValue nodes
std::map<std::pair<const Value*, int>, SDNode*> ValueNodes;
@@ -63,11 +66,13 @@
void viewGraph();
- typedef std::vector<SDNode*>::const_iterator allnodes_iterator;
- allnodes_iterator allnodes_begin() const { return AllNodes.begin(); }
- allnodes_iterator allnodes_end() const { return AllNodes.end(); }
- unsigned allnodes_size() const { return AllNodes.size(); }
-
+ typedef ilist<SDNode>::const_iterator allnodes_const_iterator;
+ allnodes_const_iterator allnodes_begin() const { return AllNodes.begin(); }
+ allnodes_const_iterator allnodes_end() const { return AllNodes.end(); }
+ typedef ilist<SDNode>::iterator allnodes_iterator;
+ allnodes_iterator allnodes_begin() { return AllNodes.begin(); }
+ allnodes_iterator allnodes_end() { return AllNodes.end(); }
+
/// getRoot - Return the root tag of the SelectionDAG.
///
const SDOperand &getRoot() const { return Root; }
@@ -111,6 +116,7 @@
SDOperand getTargetConstantPool(Constant *C, MVT::ValueType VT);
SDOperand getBasicBlock(MachineBasicBlock *MBB);
SDOperand getExternalSymbol(const char *Sym, MVT::ValueType VT);
+ SDOperand getTargetExternalSymbol(const char *Sym, MVT::ValueType VT);
SDOperand getValueType(MVT::ValueType);
SDOperand getRegister(unsigned Reg, MVT::ValueType VT);
@@ -171,7 +177,7 @@
SDOperand Callee, bool isTailCall = false) {
SDNode *NN = new SDNode(isTailCall ? ISD::TAILCALL : ISD::CALL, Chain,
Callee);
- NN->setValueTypes(RetVals);
+ setNodeValueTypes(NN, RetVals);
AllNodes.push_back(NN);
return NN;
}
@@ -185,7 +191,7 @@
ArgsInRegs.insert(ArgsInRegs.begin(), Callee);
ArgsInRegs.insert(ArgsInRegs.begin(), Chain);
SDNode *NN = new SDNode(isTailCall ? ISD::TAILCALL : ISD::CALL, ArgsInRegs);
- NN->setValueTypes(RetVals);
+ setNodeValueTypes(NN, RetVals);
AllNodes.push_back(NN);
return NN;
}
@@ -279,7 +285,10 @@
void SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT1,
MVT::ValueType VT2, SDOperand Op1, SDOperand Op2,
SDOperand Op3);
-
+
+ SDOperand getTargetNode(unsigned Opcode, MVT::ValueType VT) {
+ return getNode(ISD::BUILTIN_OP_END+Opcode, VT);
+ }
SDOperand getTargetNode(unsigned Opcode, MVT::ValueType VT,
SDOperand Op1) {
return getNode(ISD::BUILTIN_OP_END+Opcode, VT, Op1);
@@ -350,14 +359,20 @@
private:
void RemoveNodeFromCSEMaps(SDNode *N);
SDNode *AddNonLeafNodeToCSEMaps(SDNode *N);
- void DeleteNodeIfDead(SDNode *N, void *NodeSet);
+ void DestroyDeadNode(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
/// and cc. If unable to simplify it, return a null SDOperand.
SDOperand SimplifySetCC(MVT::ValueType VT, SDOperand N1,
SDOperand N2, ISD::CondCode Cond);
-
+
+ // List of non-single value types.
+ std::list<std::vector<MVT::ValueType> > VTList;
+
// Maps to auto-CSE operations.
std::map<std::pair<unsigned, MVT::ValueType>, SDNode *> NullaryOps;
std::map<std::pair<unsigned, std::pair<SDOperand, MVT::ValueType> >,
@@ -382,6 +397,7 @@
std::map<MachineBasicBlock *, SDNode*> BBNodes;
std::vector<SDNode*> ValueTypeNodes;
std::map<std::string, SDNode*> ExternalSymbols;
+ std::map<std::string, SDNode*> TargetExternalSymbols;
std::map<std::pair<unsigned,
std::pair<MVT::ValueType, std::vector<SDOperand> > >,
SDNode*> OneResultNodes;
@@ -401,6 +417,6 @@
}
};
-}
+} // end namespace llvm
#endif
Index: llvm/include/llvm/CodeGen/SelectionDAGNodes.h
diff -u llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.69 llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.69.2.1
--- llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.69 Wed Oct 5 01:34:34 2005
+++ llvm/include/llvm/CodeGen/SelectionDAGNodes.h Wed Nov 16 12:31:50 2005
@@ -22,7 +22,6 @@
#include "llvm/CodeGen/ValueTypes.h"
#include "llvm/Value.h"
#include "llvm/ADT/GraphTraits.h"
-#include "llvm/ADT/GraphTraits.h"
#include "llvm/ADT/iterator"
#include "llvm/Support/DataTypes.h"
#include <cassert>
@@ -35,6 +34,9 @@
class MachineBasicBlock;
class SDNode;
template <typename T> struct simplify_type;
+template <typename T> struct ilist_traits;
+template<typename NodeTy, typename Traits> class iplist;
+template<typename NodeTy> class ilist_iterator;
/// ISD namespace - This namespace contains an enum which represents all of the
/// SelectionDAG node types and value types.
@@ -74,6 +76,7 @@
TargetGlobalAddress,
TargetFrameIndex,
TargetConstantPool,
+ TargetExternalSymbol,
// CopyToReg - This node has three operands: a chain, a register number to
// set to this value, and a value.
@@ -304,6 +307,12 @@
// PCMARKER - This corresponds to the pcmarker intrinsic.
PCMARKER,
+ // READCYCLECOUNTER - This corresponds to the readcyclecounter intrinsic.
+ // The only operand is a chain and a value and a chain are produced. The
+ // value is the contents of the architecture specific cycle counter like
+ // register (or other high accuracy low latency clock source)
+ READCYCLECOUNTER,
+
// READPORT, WRITEPORT, READIO, WRITEIO - These correspond to the LLVM
// intrinsics of the same name. The first operand is a token chain, the
// other operands match the intrinsic. These produce a token chain in
@@ -490,19 +499,30 @@
/// depth of 2, etc.
unsigned short NodeDepth;
- /// Operands - The values that are used by this operation.
+ /// OperandList - The values that are used by this operation.
///
- std::vector<SDOperand> Operands;
+ SDOperand *OperandList;
+
+ /// ValueList - The types of the values this node defines. SDNode's may
+ /// define multiple values simultaneously.
+ MVT::ValueType *ValueList;
- /// Values - The types of the values this node defines. SDNode's may define
- /// multiple values simultaneously.
- std::vector<MVT::ValueType> Values;
+ /// NumOperands/NumValues - The number of entries in the Operand/Value list.
+ unsigned short NumOperands, NumValues;
+
+ /// Prev/Next pointers - These pointers form the linked list of of the
+ /// AllNodes list in the current DAG.
+ SDNode *Prev, *Next;
+ friend struct ilist_traits<SDNode>;
/// Uses - These are all of the SDNode's that use a value produced by this
/// node.
std::vector<SDNode*> Uses;
public:
-
+ virtual ~SDNode() {
+ assert(NumOperands == 0 && "Operand list not cleared before deletion");
+ }
+
//===--------------------------------------------------------------------===//
// Accessors
//
@@ -532,37 +552,32 @@
/// getNumOperands - Return the number of values used by this operation.
///
- unsigned getNumOperands() const { return Operands.size(); }
-
- const SDOperand &getOperand(unsigned Num) {
- assert(Num < Operands.size() && "Invalid child # of SDNode!");
- return Operands[Num];
- }
+ unsigned getNumOperands() const { return NumOperands; }
const SDOperand &getOperand(unsigned Num) const {
- assert(Num < Operands.size() && "Invalid child # of SDNode!");
- return Operands[Num];
+ assert(Num < NumOperands && "Invalid child # of SDNode!");
+ return OperandList[Num];
}
- typedef std::vector<SDOperand>::const_iterator op_iterator;
- op_iterator op_begin() const { return Operands.begin(); }
- op_iterator op_end() const { return Operands.end(); }
+ typedef const SDOperand* op_iterator;
+ op_iterator op_begin() const { return OperandList; }
+ op_iterator op_end() const { return OperandList+NumOperands; }
/// getNumValues - Return the number of values defined/returned by this
/// operator.
///
- unsigned getNumValues() const { return Values.size(); }
+ unsigned getNumValues() const { return NumValues; }
/// getValueType - Return the type of a specified result.
///
MVT::ValueType getValueType(unsigned ResNo) const {
- assert(ResNo < Values.size() && "Illegal result number!");
- return Values[ResNo];
+ assert(ResNo < NumValues && "Illegal result number!");
+ return ValueList[ResNo];
}
- typedef std::vector<MVT::ValueType>::const_iterator value_iterator;
- value_iterator value_begin() const { return Values.begin(); }
- value_iterator value_end() const { return Values.end(); }
+ typedef const MVT::ValueType* value_iterator;
+ value_iterator value_begin() const { return ValueList; }
+ value_iterator value_end() const { return ValueList+NumValues; }
/// getOperationName - Return the opcode of this operation for printing.
///
@@ -578,15 +593,26 @@
protected:
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) {
- Values.reserve(1);
- Values.push_back(VT);
+ OperandList = 0; NumOperands = 0;
+ ValueList = getValueTypeList(VT);
+ NumValues = 1;
+ Prev = 0; Next = 0;
}
SDNode(unsigned NT, SDOperand Op)
: NodeType(NT), NodeDepth(Op.Val->getNodeDepth()+1) {
- Operands.reserve(1); Operands.push_back(Op);
+ OperandList = new SDOperand[1];
+ OperandList[0] = Op;
+ NumOperands = 1;
Op.Val->Uses.push_back(this);
+ ValueList = 0;
+ NumValues = 0;
+ Prev = 0; Next = 0;
}
SDNode(unsigned NT, SDOperand N1, SDOperand N2)
: NodeType(NT) {
@@ -594,8 +620,14 @@
NodeDepth = N1.Val->getNodeDepth()+1;
else
NodeDepth = N2.Val->getNodeDepth()+1;
- Operands.reserve(2); Operands.push_back(N1); Operands.push_back(N2);
+ OperandList = new SDOperand[2];
+ OperandList[0] = N1;
+ OperandList[1] = N2;
+ NumOperands = 2;
N1.Val->Uses.push_back(this); N2.Val->Uses.push_back(this);
+ ValueList = 0;
+ NumValues = 0;
+ Prev = 0; Next = 0;
}
SDNode(unsigned NT, SDOperand N1, SDOperand N2, SDOperand N3)
: NodeType(NT) {
@@ -606,10 +638,17 @@
ND = N3.Val->getNodeDepth();
NodeDepth = ND+1;
- Operands.reserve(3); Operands.push_back(N1); Operands.push_back(N2);
- Operands.push_back(N3);
+ OperandList = new SDOperand[3];
+ OperandList[0] = N1;
+ OperandList[1] = N2;
+ OperandList[2] = N3;
+ NumOperands = 3;
+
N1.Val->Uses.push_back(this); N2.Val->Uses.push_back(this);
N3.Val->Uses.push_back(this);
+ ValueList = 0;
+ NumValues = 0;
+ Prev = 0; Next = 0;
}
SDNode(unsigned NT, SDOperand N1, SDOperand N2, SDOperand N3, SDOperand N4)
: NodeType(NT) {
@@ -622,90 +661,110 @@
ND = N4.Val->getNodeDepth();
NodeDepth = ND+1;
- Operands.reserve(4); Operands.push_back(N1); Operands.push_back(N2);
- Operands.push_back(N3); Operands.push_back(N4);
+ OperandList = new SDOperand[4];
+ OperandList[0] = N1;
+ OperandList[1] = N2;
+ OperandList[2] = N3;
+ OperandList[3] = N4;
+ NumOperands = 4;
+
N1.Val->Uses.push_back(this); N2.Val->Uses.push_back(this);
N3.Val->Uses.push_back(this); N4.Val->Uses.push_back(this);
- }
- SDNode(unsigned NT, std::vector<SDOperand> &Nodes) : NodeType(NT) {
- Operands.swap(Nodes);
+ ValueList = 0;
+ NumValues = 0;
+ Prev = 0; Next = 0;
+ }
+ SDNode(unsigned Opc, const std::vector<SDOperand> &Nodes) : NodeType(Opc) {
+ NumOperands = Nodes.size();
+ OperandList = new SDOperand[NumOperands];
+
unsigned ND = 0;
- for (unsigned i = 0, e = Operands.size(); i != e; ++i) {
- Operands[i].Val->Uses.push_back(this);
- if (ND < Operands[i].Val->getNodeDepth())
- ND = Operands[i].Val->getNodeDepth();
+ for (unsigned i = 0, e = Nodes.size(); i != e; ++i) {
+ OperandList[i] = Nodes[i];
+ SDNode *N = OperandList[i].Val;
+ N->Uses.push_back(this);
+ if (ND < N->getNodeDepth()) ND = N->getNodeDepth();
}
NodeDepth = ND+1;
+ ValueList = 0;
+ NumValues = 0;
+ Prev = 0; Next = 0;
}
- virtual ~SDNode() {}
-
/// MorphNodeTo - This clears the return value and operands list, and sets the
/// opcode of the node to the specified value. This should only be used by
/// the SelectionDAG class.
void MorphNodeTo(unsigned Opc) {
NodeType = Opc;
- Values.clear();
+ ValueList = 0;
+ NumValues = 0;
// Clear the operands list, updating used nodes to remove this from their
// use list.
- while (!Operands.empty()) {
- SDNode *O = Operands.back().Val;
- Operands.pop_back();
- O->removeUser(this);
- }
+ for (op_iterator I = op_begin(), E = op_end(); I != E; ++I)
+ I->Val->removeUser(this);
+ delete [] OperandList;
+ OperandList = 0;
+ NumOperands = 0;
}
void setValueTypes(MVT::ValueType VT) {
- Values.reserve(1);
- Values.push_back(VT);
- }
- void setValueTypes(MVT::ValueType VT1, MVT::ValueType VT2) {
- Values.reserve(2);
- Values.push_back(VT1);
- Values.push_back(VT2);
- }
- /// Note: this method destroys the vector passed in.
- void setValueTypes(std::vector<MVT::ValueType> &VTs) {
- std::swap(Values, VTs);
+ assert(NumValues == 0 && "Should not have values yet!");
+ ValueList = getValueTypeList(VT);
+ NumValues = 1;
+ }
+ void setValueTypes(MVT::ValueType *List, unsigned NumVal) {
+ assert(NumValues == 0 && "Should not have values yet!");
+ ValueList = List;
+ NumValues = NumVal;
}
void setOperands(SDOperand Op0) {
- Operands.reserve(1);
- Operands.push_back(Op0);
+ assert(NumOperands == 0 && "Should not have operands yet!");
+ OperandList = new SDOperand[1];
+ OperandList[0] = Op0;
+ NumOperands = 1;
Op0.Val->Uses.push_back(this);
}
void setOperands(SDOperand Op0, SDOperand Op1) {
- Operands.reserve(2);
- Operands.push_back(Op0);
- Operands.push_back(Op1);
+ assert(NumOperands == 0 && "Should not have operands yet!");
+ OperandList = new SDOperand[2];
+ OperandList[0] = Op0;
+ OperandList[1] = Op1;
+ NumOperands = 2;
Op0.Val->Uses.push_back(this); Op1.Val->Uses.push_back(this);
}
void setOperands(SDOperand Op0, SDOperand Op1, SDOperand Op2) {
- Operands.reserve(3);
- Operands.push_back(Op0);
- Operands.push_back(Op1);
- Operands.push_back(Op2);
+ assert(NumOperands == 0 && "Should not have operands yet!");
+ OperandList = new SDOperand[3];
+ OperandList[0] = Op0;
+ OperandList[1] = Op1;
+ OperandList[2] = Op2;
+ NumOperands = 3;
Op0.Val->Uses.push_back(this); Op1.Val->Uses.push_back(this);
Op2.Val->Uses.push_back(this);
}
void setOperands(SDOperand Op0, SDOperand Op1, SDOperand Op2, SDOperand Op3) {
- Operands.reserve(4);
- Operands.push_back(Op0);
- Operands.push_back(Op1);
- Operands.push_back(Op2);
- Operands.push_back(Op3);
+ assert(NumOperands == 0 && "Should not have operands yet!");
+ OperandList = new SDOperand[4];
+ OperandList[0] = Op0;
+ OperandList[1] = Op1;
+ OperandList[2] = Op2;
+ OperandList[3] = Op3;
+ NumOperands = 4;
Op0.Val->Uses.push_back(this); Op1.Val->Uses.push_back(this);
Op2.Val->Uses.push_back(this); Op3.Val->Uses.push_back(this);
}
void setOperands(SDOperand Op0, SDOperand Op1, SDOperand Op2, SDOperand Op3,
SDOperand Op4) {
- Operands.reserve(5);
- Operands.push_back(Op0);
- Operands.push_back(Op1);
- Operands.push_back(Op2);
- Operands.push_back(Op3);
- Operands.push_back(Op4);
+ assert(NumOperands == 0 && "Should not have operands yet!");
+ OperandList = new SDOperand[5];
+ OperandList[0] = Op0;
+ OperandList[1] = Op1;
+ OperandList[2] = Op2;
+ OperandList[3] = Op3;
+ OperandList[4] = Op4;
+ NumOperands = 5;
Op0.Val->Uses.push_back(this); Op1.Val->Uses.push_back(this);
Op2.Val->Uses.push_back(this); Op3.Val->Uses.push_back(this);
Op4.Val->Uses.push_back(this);
@@ -932,8 +991,9 @@
const char *Symbol;
protected:
friend class SelectionDAG;
- ExternalSymbolSDNode(const char *Sym, MVT::ValueType VT)
- : SDNode(ISD::ExternalSymbol, VT), Symbol(Sym) {
+ ExternalSymbolSDNode(bool isTarget, const char *Sym, MVT::ValueType VT)
+ : SDNode(isTarget ? ISD::TargetExternalSymbol : ISD::ExternalSymbol, VT),
+ Symbol(Sym) {
}
public:
@@ -941,7 +1001,8 @@
static bool classof(const ExternalSymbolSDNode *) { return true; }
static bool classof(const SDNode *N) {
- return N->getOpcode() == ISD::ExternalSymbol;
+ return N->getOpcode() == ISD::ExternalSymbol ||
+ N->getOpcode() == ISD::TargetExternalSymbol;
}
};
@@ -1032,6 +1093,28 @@
}
};
+template<>
+struct ilist_traits<SDNode> {
+ static SDNode *getPrev(const SDNode *N) { return N->Prev; }
+ static SDNode *getNext(const SDNode *N) { return N->Next; }
+
+ static void setPrev(SDNode *N, SDNode *Prev) { N->Prev = Prev; }
+ static void setNext(SDNode *N, SDNode *Next) { N->Next = Next; }
+
+ static SDNode *createSentinel() {
+ return new SDNode(ISD::EntryToken, MVT::Other);
+ }
+ static void destroySentinel(SDNode *N) { delete N; }
+ //static SDNode *createNode(const SDNode &V) { return new SDNode(V); }
+
+
+ void addNodeToList(SDNode *NTy) {}
+ void removeNodeFromList(SDNode *NTy) {}
+ void transferNodesFromList(iplist<SDNode, ilist_traits> &L2,
+ const ilist_iterator<SDNode> &X,
+ const ilist_iterator<SDNode> &Y) {}
+};
+
} // end llvm namespace
#endif
More information about the llvm-commits
mailing list