AssertSext, AssertZext,
// Various leaf nodes.
- Constant, ConstantFP, GlobalAddress, FrameIndex, ConstantPool,
+ Constant, ConstantFP, STRING,
+ GlobalAddress, FrameIndex, ConstantPool,
BasicBlock, ExternalSymbol, VALUETYPE, CONDCODE, Register,
+ // ConstantVec works like Constant or ConstantFP, except that it is not a
+ // leaf node. All operands are either Constant or ConstantFP nodes.
+ ConstantVec,
+
// TargetConstant - Like Constant, but the DAG does not do any folding or
// simplification of the constant. This is used by the DAG->DAG selector.
TargetConstant,
// SelectionDAG. The register is available from the RegSDNode object.
CopyFromReg,
- // ImplicitDef - This node indicates that the specified register is
- // implicitly defined by some operation (e.g. its a live-in argument). The
- // two operands to this are the token chain coming in and the register.
- // The only result is the token chain going out.
- ImplicitDef,
-
// UNDEF - An undefined node
UNDEF,
// two values of the same integer value type, this produces a value twice as
// big. Like EXTRACT_ELEMENT, this can only be used before legalization.
BUILD_PAIR,
+
+ // MERGE_VALUES - This node takes multiple discrete operands and returns
+ // them all as its individual results. This nodes has exactly the same
+ // number of inputs and outputs, and is only valid before legalization.
+ // This node is useful for some pieces of the code generator that want to
+ // think about a single node with multiple results, not multiple nodes.
+ MERGE_VALUES,
// Simple integer binary arithmetic operators.
ADD, SUB, MUL, SDIV, UDIV, SREM, UREM,
// Simple abstract vector operators. Unlike the integer and floating point
// binary operators, these nodes also take two additional operands:
// a constant element count, and a value type node indicating the type of
- // the elements. The order is count, type, op0, op1.
+ // the elements. The order is op0, op1, count, type. All vector opcodes,
+ // including VLOAD, must currently have count and type as their 3rd and 4th
+ // arguments.
VADD, VSUB, VMUL,
// MULHU/MULHS - Multiply high - Multiply two integers of type iN, producing
// FP_EXTEND - Extend a smaller FP type into a larger FP type.
FP_EXTEND,
+ // BIT_CONVERT - Theis operator converts between integer and FP values, as
+ // if one was stored to memory as integer and the other was loaded from the
+ // same address (or equivalently for vector format conversions, etc). The
+ // source and result are required to have the same bit size (e.g.
+ // f32 <-> i32). This can also be used for int-to-int or fp-to-fp
+ // conversions, but that is a noop, deleted by getNode().
+ BIT_CONVERT,
+
// FNEG, FABS, FSQRT, FSIN, FCOS - Perform unary floating point negation,
// absolute value, square root, sine and cosine operations.
FNEG, FABS, FSQRT, FSIN, FCOS,
// HANDLENODE node - Used as a handle for various purposes.
HANDLENODE,
+ // LOCATION - This node is used to represent a source location for debug
+ // info. It takes token chain as input, then a line number, then a column
+ // number, then a filename, then a working dir. It produces a token chain
+ // as output.
+ LOCATION,
+
+ // DEBUG_LOC - This node is used to represent source line information
+ // embedded in the code. It takes a token chain as input, then a line
+ // number, then a column then a file id (provided by MachineDebugInfo.) It
+ // produces a token chain as output.
+ DEBUG_LOC,
+
+ // DEBUG_LABEL - This node is used to mark a location in the code where a
+ // label should be generated for use by the debug information. It takes a
+ // token chain as input and then a unique id (provided by MachineDebugInfo.)
+ // It produces a token chain as output.
+ DEBUG_LABEL,
+
// BUILTIN_OP_END - This must be the last enum value in this list.
BUILTIN_OP_END,
};
Op2.Val->Uses.push_back(this); Op3.Val->Uses.push_back(this);
Op4.Val->Uses.push_back(this);
}
+ void setOperands(SDOperand Op0, SDOperand Op1, SDOperand Op2, SDOperand Op3,
+ SDOperand Op4, SDOperand Op5) {
+ assert(NumOperands == 0 && "Should not have operands yet!");
+ OperandList = new SDOperand[6];
+ OperandList[0] = Op0;
+ OperandList[1] = Op1;
+ OperandList[2] = Op2;
+ OperandList[3] = Op3;
+ OperandList[4] = Op4;
+ OperandList[5] = Op5;
+ NumOperands = 6;
+ 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); Op5.Val->Uses.push_back(this);
+ }
void addUser(SDNode *User) {
Uses.push_back(User);
}
SDOperand getValue() const { return getOperand(0); }
};
+class StringSDNode : public SDNode {
+ std::string Value;
+protected:
+ friend class SelectionDAG;
+ StringSDNode(const std::string &val)
+ : SDNode(ISD::STRING, MVT::Other), Value(val) {
+ }
+public:
+ const std::string &getValue() const { return Value; }
+ static bool classof(const StringSDNode *) { return true; }
+ static bool classof(const SDNode *N) {
+ return N->getOpcode() == ISD::STRING;
+ }
+};
class ConstantSDNode : public SDNode {
uint64_t Value;
class GlobalAddressSDNode : public SDNode {
GlobalValue *TheGlobal;
+ int offset;
protected:
friend class SelectionDAG;
- GlobalAddressSDNode(bool isTarget, const GlobalValue *GA, MVT::ValueType VT)
+ GlobalAddressSDNode(bool isTarget, const GlobalValue *GA, MVT::ValueType VT,
+ int o=0)
: SDNode(isTarget ? ISD::TargetGlobalAddress : ISD::GlobalAddress, VT) {
TheGlobal = const_cast<GlobalValue*>(GA);
+ offset = o;
}
public:
GlobalValue *getGlobal() const { return TheGlobal; }
+ int getOffset() const { return offset; }
static bool classof(const GlobalAddressSDNode *) { return true; }
static bool classof(const SDNode *N) {