diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/CodeGen/CallingConvLower.h | 24 | ||||
-rw-r--r-- | include/llvm/CodeGen/SelectionDAG.h | 197 | ||||
-rw-r--r-- | include/llvm/CodeGen/SelectionDAGISel.h | 2 | ||||
-rw-r--r-- | include/llvm/CodeGen/SelectionDAGNodes.h | 79 | ||||
-rw-r--r-- | include/llvm/CodeGen/ValueTypes.h | 731 | ||||
-rw-r--r-- | include/llvm/Target/TargetLowering.h | 308 | ||||
-rw-r--r-- | include/llvm/Target/TargetRegisterInfo.h | 8 |
7 files changed, 682 insertions, 667 deletions
diff --git a/include/llvm/CodeGen/CallingConvLower.h b/include/llvm/CodeGen/CallingConvLower.h index 584cb19..2fda9e5 100644 --- a/include/llvm/CodeGen/CallingConvLower.h +++ b/include/llvm/CodeGen/CallingConvLower.h @@ -49,14 +49,14 @@ private: LocInfo HTP : 7; /// ValVT - The type of the value being assigned. - MVT::ValueType ValVT; + MVT ValVT; /// LocVT - The type of the location being assigned to. - MVT::ValueType LocVT; + MVT LocVT; public: - static CCValAssign getReg(unsigned ValNo, MVT::ValueType ValVT, - unsigned RegNo, MVT::ValueType LocVT, + static CCValAssign getReg(unsigned ValNo, MVT ValVT, + unsigned RegNo, MVT LocVT, LocInfo HTP) { CCValAssign Ret; Ret.ValNo = ValNo; @@ -67,8 +67,8 @@ public: Ret.LocVT = LocVT; return Ret; } - static CCValAssign getMem(unsigned ValNo, MVT::ValueType ValVT, - unsigned Offset, MVT::ValueType LocVT, + static CCValAssign getMem(unsigned ValNo, MVT ValVT, + unsigned Offset, MVT LocVT, LocInfo HTP) { CCValAssign Ret; Ret.ValNo = ValNo; @@ -81,14 +81,14 @@ public: } unsigned getValNo() const { return ValNo; } - MVT::ValueType getValVT() const { return ValVT; } + MVT getValVT() const { return ValVT; } bool isRegLoc() const { return !isMem; } bool isMemLoc() const { return isMem; } unsigned getLocReg() const { assert(isRegLoc()); return Loc; } unsigned getLocMemOffset() const { assert(isMemLoc()); return Loc; } - MVT::ValueType getLocVT() const { return LocVT; } + MVT getLocVT() const { return LocVT; } LocInfo getLocInfo() const { return HTP; } }; @@ -96,8 +96,8 @@ public: /// CCAssignFn - This function assigns a location for Val, updating State to /// reflect the change. -typedef bool CCAssignFn(unsigned ValNo, MVT::ValueType ValVT, - MVT::ValueType LocVT, CCValAssign::LocInfo LocInfo, +typedef bool CCAssignFn(unsigned ValNo, MVT ValVT, + MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, CCState &State); @@ -217,8 +217,8 @@ public: // HandleByVal - Allocate a stack slot large enough to pass an argument by // value. The size and alignment information of the argument is encoded in its // parameter attribute. - void HandleByVal(unsigned ValNo, MVT::ValueType ValVT, - MVT::ValueType LocVT, CCValAssign::LocInfo LocInfo, + void HandleByVal(unsigned ValNo, MVT ValVT, + MVT LocVT, CCValAssign::LocInfo LocInfo, int MinSize, int MinAlign, ISD::ArgFlagsTy ArgFlags); private: diff --git a/include/llvm/CodeGen/SelectionDAG.h b/include/llvm/CodeGen/SelectionDAG.h index 77405e4..e11bd42 100644 --- a/include/llvm/CodeGen/SelectionDAG.h +++ b/include/llvm/CodeGen/SelectionDAG.h @@ -144,24 +144,22 @@ public: /// getVTList - Return an SDVTList that represents the list of values /// specified. - SDVTList getVTList(MVT::ValueType VT); - SDVTList getVTList(MVT::ValueType VT1, MVT::ValueType VT2); - SDVTList getVTList(MVT::ValueType VT1, MVT::ValueType VT2,MVT::ValueType VT3); - SDVTList getVTList(const MVT::ValueType *VTs, unsigned NumVTs); + SDVTList getVTList(MVT VT); + SDVTList getVTList(MVT VT1, MVT VT2); + SDVTList getVTList(MVT VT1, MVT VT2, MVT VT3); + SDVTList getVTList(const MVT *VTs, unsigned NumVTs); /// getNodeValueTypes - These are obsolete, use getVTList instead. - const MVT::ValueType *getNodeValueTypes(MVT::ValueType VT) { + const MVT *getNodeValueTypes(MVT VT) { return getVTList(VT).VTs; } - const MVT::ValueType *getNodeValueTypes(MVT::ValueType VT1, - MVT::ValueType VT2) { + const MVT *getNodeValueTypes(MVT VT1, MVT VT2) { return getVTList(VT1, VT2).VTs; } - const MVT::ValueType *getNodeValueTypes(MVT::ValueType VT1,MVT::ValueType VT2, - MVT::ValueType VT3) { + const MVT *getNodeValueTypes(MVT VT1, MVT VT2, MVT VT3) { return getVTList(VT1, VT2, VT3).VTs; } - const MVT::ValueType *getNodeValueTypes(std::vector<MVT::ValueType> &vtList) { + const MVT *getNodeValueTypes(std::vector<MVT> &vtList) { return getVTList(&vtList[0], (unsigned)vtList.size()).VTs; } @@ -170,57 +168,56 @@ public: // Node creation methods. // SDOperand getString(const std::string &Val); - SDOperand getConstant(uint64_t Val, MVT::ValueType VT, bool isTarget = false); - SDOperand getConstant(const APInt &Val, MVT::ValueType VT, bool isTarget = false); + SDOperand getConstant(uint64_t Val, MVT VT, bool isTarget = false); + SDOperand getConstant(const APInt &Val, MVT VT, bool isTarget = false); SDOperand getIntPtrConstant(uint64_t Val, bool isTarget = false); - SDOperand getTargetConstant(uint64_t Val, MVT::ValueType VT) { + SDOperand getTargetConstant(uint64_t Val, MVT VT) { return getConstant(Val, VT, true); } - SDOperand getTargetConstant(const APInt &Val, MVT::ValueType VT) { + SDOperand getTargetConstant(const APInt &Val, MVT VT) { return getConstant(Val, VT, true); } - SDOperand getConstantFP(double Val, MVT::ValueType VT, bool isTarget = false); - SDOperand getConstantFP(const APFloat& Val, MVT::ValueType VT, - bool isTarget = false); - SDOperand getTargetConstantFP(double Val, MVT::ValueType VT) { + SDOperand getConstantFP(double Val, MVT VT, bool isTarget = false); + SDOperand getConstantFP(const APFloat& Val, MVT VT, bool isTarget = false); + SDOperand getTargetConstantFP(double Val, MVT VT) { return getConstantFP(Val, VT, true); } - SDOperand getTargetConstantFP(const APFloat& Val, MVT::ValueType VT) { + SDOperand getTargetConstantFP(const APFloat& Val, MVT VT) { return getConstantFP(Val, VT, true); } - SDOperand getGlobalAddress(const GlobalValue *GV, MVT::ValueType VT, + SDOperand getGlobalAddress(const GlobalValue *GV, MVT VT, int offset = 0, bool isTargetGA = false); - SDOperand getTargetGlobalAddress(const GlobalValue *GV, MVT::ValueType VT, + SDOperand getTargetGlobalAddress(const GlobalValue *GV, MVT VT, int offset = 0) { return getGlobalAddress(GV, VT, offset, true); } - SDOperand getFrameIndex(int FI, MVT::ValueType VT, bool isTarget = false); - SDOperand getTargetFrameIndex(int FI, MVT::ValueType VT) { + SDOperand getFrameIndex(int FI, MVT VT, bool isTarget = false); + SDOperand getTargetFrameIndex(int FI, MVT VT) { return getFrameIndex(FI, VT, true); } - SDOperand getJumpTable(int JTI, MVT::ValueType VT, bool isTarget = false); - SDOperand getTargetJumpTable(int JTI, MVT::ValueType VT) { + SDOperand getJumpTable(int JTI, MVT VT, bool isTarget = false); + SDOperand getTargetJumpTable(int JTI, MVT VT) { return getJumpTable(JTI, VT, true); } - SDOperand getConstantPool(Constant *C, MVT::ValueType VT, + SDOperand getConstantPool(Constant *C, MVT VT, unsigned Align = 0, int Offs = 0, bool isT=false); - SDOperand getTargetConstantPool(Constant *C, MVT::ValueType VT, + SDOperand getTargetConstantPool(Constant *C, MVT VT, unsigned Align = 0, int Offset = 0) { return getConstantPool(C, VT, Align, Offset, true); } - SDOperand getConstantPool(MachineConstantPoolValue *C, MVT::ValueType VT, + SDOperand getConstantPool(MachineConstantPoolValue *C, MVT VT, unsigned Align = 0, int Offs = 0, bool isT=false); SDOperand getTargetConstantPool(MachineConstantPoolValue *C, - MVT::ValueType VT, unsigned Align = 0, + MVT VT, unsigned Align = 0, int Offset = 0) { return getConstantPool(C, VT, Align, Offset, true); } SDOperand getBasicBlock(MachineBasicBlock *MBB); - SDOperand getExternalSymbol(const char *Sym, MVT::ValueType VT); - SDOperand getTargetExternalSymbol(const char *Sym, MVT::ValueType VT); + SDOperand getExternalSymbol(const char *Sym, MVT VT); + SDOperand getTargetExternalSymbol(const char *Sym, MVT VT); SDOperand getArgFlags(ISD::ArgFlagsTy Flags); - SDOperand getValueType(MVT::ValueType); - SDOperand getRegister(unsigned Reg, MVT::ValueType VT); + SDOperand getValueType(MVT); + SDOperand getRegister(unsigned Reg, MVT VT); SDOperand getCopyToReg(SDOperand Chain, unsigned Reg, SDOperand N) { return getNode(ISD::CopyToReg, MVT::Other, Chain, @@ -232,7 +229,7 @@ public: // null) and that there should be a flag result. SDOperand getCopyToReg(SDOperand Chain, unsigned Reg, SDOperand N, SDOperand Flag) { - const MVT::ValueType *VTs = getNodeValueTypes(MVT::Other, MVT::Flag); + const MVT *VTs = getNodeValueTypes(MVT::Other, MVT::Flag); SDOperand Ops[] = { Chain, getRegister(Reg, N.getValueType()), N, Flag }; return getNode(ISD::CopyToReg, VTs, 2, Ops, Flag.Val ? 4 : 3); } @@ -240,13 +237,13 @@ public: // Similar to last getCopyToReg() except parameter Reg is a SDOperand SDOperand getCopyToReg(SDOperand Chain, SDOperand Reg, SDOperand N, SDOperand Flag) { - const MVT::ValueType *VTs = getNodeValueTypes(MVT::Other, MVT::Flag); + const MVT *VTs = getNodeValueTypes(MVT::Other, MVT::Flag); SDOperand Ops[] = { Chain, Reg, N, Flag }; return getNode(ISD::CopyToReg, VTs, 2, Ops, Flag.Val ? 4 : 3); } - SDOperand getCopyFromReg(SDOperand Chain, unsigned Reg, MVT::ValueType VT) { - const MVT::ValueType *VTs = getNodeValueTypes(VT, MVT::Other); + SDOperand getCopyFromReg(SDOperand Chain, unsigned Reg, MVT VT) { + const MVT *VTs = getNodeValueTypes(VT, MVT::Other); SDOperand Ops[] = { Chain, getRegister(Reg, VT) }; return getNode(ISD::CopyFromReg, VTs, 2, Ops, 2); } @@ -254,9 +251,9 @@ public: // This version of the getCopyFromReg method takes an extra operand, which // indicates that there is potentially an incoming flag value (if Flag is not // null) and that there should be a flag result. - SDOperand getCopyFromReg(SDOperand Chain, unsigned Reg, MVT::ValueType VT, + SDOperand getCopyFromReg(SDOperand Chain, unsigned Reg, MVT VT, SDOperand Flag) { - const MVT::ValueType *VTs = getNodeValueTypes(VT, MVT::Other, MVT::Flag); + const MVT *VTs = getNodeValueTypes(VT, MVT::Other, MVT::Flag); SDOperand Ops[] = { Chain, getRegister(Reg, VT), Flag }; return getNode(ISD::CopyFromReg, VTs, 3, Ops, Flag.Val ? 3 : 2); } @@ -265,12 +262,12 @@ public: /// getZeroExtendInReg - Return the expression required to zero extend the Op /// value assuming it was the smaller SrcTy value. - SDOperand getZeroExtendInReg(SDOperand Op, MVT::ValueType SrcTy); + SDOperand getZeroExtendInReg(SDOperand Op, MVT SrcTy); /// getCALLSEQ_START - Return a new CALLSEQ_START node, which always must have /// a flag result (to ensure it's not CSE'd). SDOperand getCALLSEQ_START(SDOperand Chain, SDOperand Op) { - const MVT::ValueType *VTs = getNodeValueTypes(MVT::Other, MVT::Flag); + const MVT *VTs = getNodeValueTypes(MVT::Other, MVT::Flag); SDOperand Ops[] = { Chain, Op }; return getNode(ISD::CALLSEQ_START, VTs, 2, Ops, 2); } @@ -291,27 +288,24 @@ public: /// getNode - Gets or creates the specified node. /// - SDOperand getNode(unsigned Opcode, MVT::ValueType VT); - SDOperand getNode(unsigned Opcode, MVT::ValueType VT, SDOperand N); - SDOperand getNode(unsigned Opcode, MVT::ValueType VT, - SDOperand N1, SDOperand N2); - SDOperand getNode(unsigned Opcode, MVT::ValueType VT, + SDOperand getNode(unsigned Opcode, MVT VT); + SDOperand getNode(unsigned Opcode, MVT VT, SDOperand N); + SDOperand getNode(unsigned Opcode, MVT VT, SDOperand N1, SDOperand N2); + SDOperand getNode(unsigned Opcode, MVT VT, SDOperand N1, SDOperand N2, SDOperand N3); - SDOperand getNode(unsigned Opcode, MVT::ValueType VT, + SDOperand getNode(unsigned Opcode, MVT VT, SDOperand N1, SDOperand N2, SDOperand N3, SDOperand N4); - SDOperand getNode(unsigned Opcode, MVT::ValueType VT, + SDOperand getNode(unsigned Opcode, MVT VT, SDOperand N1, SDOperand N2, SDOperand N3, SDOperand N4, SDOperand N5); - SDOperand getNode(unsigned Opcode, MVT::ValueType VT, + SDOperand getNode(unsigned Opcode, MVT VT, SDOperandPtr Ops, unsigned NumOps); + SDOperand getNode(unsigned Opcode, std::vector<MVT> &ResultTys, SDOperandPtr Ops, unsigned NumOps); - SDOperand getNode(unsigned Opcode, std::vector<MVT::ValueType> &ResultTys, - SDOperandPtr Ops, unsigned NumOps); - SDOperand getNode(unsigned Opcode, const MVT::ValueType *VTs, unsigned NumVTs, + SDOperand getNode(unsigned Opcode, const MVT *VTs, unsigned NumVTs, SDOperandPtr Ops, unsigned NumOps); SDOperand getNode(unsigned Opcode, SDVTList VTs); SDOperand getNode(unsigned Opcode, SDVTList VTs, SDOperand N); - SDOperand getNode(unsigned Opcode, SDVTList VTs, - SDOperand N1, SDOperand N2); + SDOperand getNode(unsigned Opcode, SDVTList VTs, SDOperand N1, SDOperand N2); SDOperand getNode(unsigned Opcode, SDVTList VTs, SDOperand N1, SDOperand N2, SDOperand N3); SDOperand getNode(unsigned Opcode, SDVTList VTs, @@ -340,7 +334,7 @@ public: /// getSetCC - Helper function to make it easier to build SetCC's if you just /// have an ISD::CondCode instead of an SDOperand. /// - SDOperand getSetCC(MVT::ValueType VT, SDOperand LHS, SDOperand RHS, + SDOperand getSetCC(MVT VT, SDOperand LHS, SDOperand RHS, ISD::CondCode Cond) { return getNode(ISD::SETCC, VT, LHS, RHS, getCondCode(Cond)); } @@ -348,7 +342,7 @@ public: /// getVSetCC - Helper function to make it easier to build VSetCC's nodes /// if you just have an ISD::CondCode instead of an SDOperand. /// - SDOperand getVSetCC(MVT::ValueType VT, SDOperand LHS, SDOperand RHS, + SDOperand getVSetCC(MVT VT, SDOperand LHS, SDOperand RHS, ISD::CondCode Cond) { return getNode(ISD::VSETCC, VT, LHS, RHS, getCondCode(Cond)); } @@ -364,35 +358,35 @@ public: /// getVAArg - VAArg produces a result and token chain, and takes a pointer /// and a source value as input. - SDOperand getVAArg(MVT::ValueType VT, SDOperand Chain, SDOperand Ptr, + SDOperand getVAArg(MVT VT, SDOperand Chain, SDOperand Ptr, SDOperand SV); /// getAtomic - Gets a node for an atomic op, produces result and chain, takes // 3 operands SDOperand getAtomic(unsigned Opcode, SDOperand Chain, SDOperand Ptr, - SDOperand Cmp, SDOperand Swp, MVT::ValueType VT); + SDOperand Cmp, SDOperand Swp, MVT VT); /// getAtomic - Gets a node for an atomic op, produces result and chain, takes // 2 operands SDOperand getAtomic(unsigned Opcode, SDOperand Chain, SDOperand Ptr, - SDOperand Val, MVT::ValueType VT); + SDOperand Val, MVT VT); /// getLoad - Loads are not normal binary operators: their result type is not /// determined by their operands, and they produce a value AND a token chain. /// - SDOperand getLoad(MVT::ValueType VT, SDOperand Chain, SDOperand Ptr, + SDOperand getLoad(MVT VT, SDOperand Chain, SDOperand Ptr, const Value *SV, int SVOffset, bool isVolatile=false, unsigned Alignment=0); - SDOperand getExtLoad(ISD::LoadExtType ExtType, MVT::ValueType VT, + SDOperand getExtLoad(ISD::LoadExtType ExtType, MVT VT, SDOperand Chain, SDOperand Ptr, const Value *SV, - int SVOffset, MVT::ValueType EVT, bool isVolatile=false, + int SVOffset, MVT EVT, bool isVolatile=false, unsigned Alignment=0); SDOperand getIndexedLoad(SDOperand OrigLoad, SDOperand Base, SDOperand Offset, ISD::MemIndexedMode AM); SDOperand getLoad(ISD::MemIndexedMode AM, ISD::LoadExtType ExtType, - MVT::ValueType VT, SDOperand Chain, + MVT VT, SDOperand Chain, SDOperand Ptr, SDOperand Offset, - const Value *SV, int SVOffset, MVT::ValueType EVT, + const Value *SV, int SVOffset, MVT EVT, bool isVolatile=false, unsigned Alignment=0); /// getStore - Helper function to build ISD::STORE nodes. @@ -401,7 +395,7 @@ public: const Value *SV, int SVOffset, bool isVolatile=false, unsigned Alignment=0); SDOperand getTruncStore(SDOperand Chain, SDOperand Val, SDOperand Ptr, - const Value *SV, int SVOffset, MVT::ValueType TVT, + const Value *SV, int SVOffset, MVT TVT, bool isVolatile=false, unsigned Alignment=0); SDOperand getIndexedStore(SDOperand OrigStoe, SDOperand Base, SDOperand Offset, ISD::MemIndexedMode AM); @@ -434,20 +428,18 @@ public: /// operands. Note that target opcodes are stored as /// ISD::BUILTIN_OP_END+TargetOpcode in the node opcode field. The 0th value /// of the resultant node is returned. - SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT); - SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT, - SDOperand Op1); - SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT, + SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT); + SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT, SDOperand Op1); + SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT, SDOperand Op1, SDOperand Op2); - SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT, + SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT, SDOperand Op1, SDOperand Op2, SDOperand Op3); - SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT, + SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT, SDOperandPtr Ops, unsigned NumOps); - SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT1, - MVT::ValueType VT2, SDOperand Op1, SDOperand Op2); - SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT1, - MVT::ValueType VT2, SDOperand Op1, SDOperand Op2, - SDOperand Op3); + SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT1, + MVT VT2, SDOperand Op1, SDOperand Op2); + SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT1, + MVT VT2, SDOperand Op1, SDOperand Op2, SDOperand Op3); /// getTargetNode - These are used for target selectors to create a new node @@ -456,41 +448,30 @@ public: /// Note that getTargetNode returns the resultant node. If there is already a /// node of the specified opcode and operands, it returns that node instead of /// the current one. - SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT); - SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT, - SDOperand Op1); - SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT, - SDOperand Op1, SDOperand Op2); - SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT, + SDNode *getTargetNode(unsigned Opcode, MVT VT); + SDNode *getTargetNode(unsigned Opcode, MVT VT, SDOperand Op1); + SDNode *getTargetNode(unsigned Opcode, MVT VT, SDOperand Op1, SDOperand Op2); + SDNode *getTargetNode(unsigned Opcode, MVT VT, SDOperand Op1, SDOperand Op2, SDOperand Op3); - SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT, + SDNode *getTargetNode(unsigned Opcode, MVT VT, SDOperandPtr Ops, unsigned NumOps); - SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT1, - MVT::ValueType VT2); - SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT1, - MVT::ValueType VT2, SDOperand Op1); - SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT1, - MVT::ValueType VT2, SDOperand Op1, SDOperand Op2); - SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT1, - MVT::ValueType VT2, SDOperand Op1, SDOperand Op2, - SDOperand Op3); - SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT1, - MVT::ValueType VT2, + SDNode *getTargetNode(unsigned Opcode, MVT VT1, MVT VT2); + SDNode *getTargetNode(unsigned Opcode, MVT VT1, MVT VT2, SDOperand Op1); + SDNode *getTargetNode(unsigned Opcode, MVT VT1, + MVT VT2, SDOperand Op1, SDOperand Op2); + SDNode *getTargetNode(unsigned Opcode, MVT VT1, + MVT VT2, SDOperand Op1, SDOperand Op2, SDOperand Op3); + SDNode *getTargetNode(unsigned Opcode, MVT VT1, MVT VT2, SDOperandPtr Ops, unsigned NumOps); - SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT1, - MVT::ValueType VT2, MVT::ValueType VT3, + SDNode *getTargetNode(unsigned Opcode, MVT VT1, MVT VT2, MVT VT3, SDOperand Op1, SDOperand Op2); - SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT1, - MVT::ValueType VT2, MVT::ValueType VT3, + SDNode *getTargetNode(unsigned Opcode, MVT VT1, MVT VT2, MVT VT3, SDOperand Op1, SDOperand Op2, SDOperand Op3); - SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT1, - MVT::ValueType VT2, MVT::ValueType VT3, + SDNode *getTargetNode(unsigned Opcode, MVT VT1, MVT VT2, MVT VT3, SDOperandPtr Ops, unsigned NumOps); - SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT1, - MVT::ValueType VT2, MVT::ValueType VT3, - MVT::ValueType VT4, + SDNode *getTargetNode(unsigned Opcode, MVT VT1, MVT VT2, MVT VT3, MVT VT4, SDOperandPtr Ops, unsigned NumOps); - SDNode *getTargetNode(unsigned Opcode, std::vector<MVT::ValueType> &ResultTys, + SDNode *getTargetNode(unsigned Opcode, std::vector<MVT> &ResultTys, SDOperandPtr Ops, unsigned NumOps); /// getNodeIfExists - Get the specified node if it's already available, or @@ -570,10 +551,10 @@ public: /// CreateStackTemporary - Create a stack temporary, suitable for holding the /// specified value type. - SDOperand CreateStackTemporary(MVT::ValueType VT); + SDOperand CreateStackTemporary(MVT VT); /// FoldSetCC - Constant fold a setcc to true or false. - SDOperand FoldSetCC(MVT::ValueType VT, SDOperand N1, + SDOperand FoldSetCC(MVT VT, SDOperand N1, SDOperand N2, ISD::CondCode Cond); /// SignBitIsZero - Return true if the sign bit of Op is known to be zero. We @@ -623,13 +604,13 @@ private: void DeleteNodeNotInCSEMaps(SDNode *N); // List of non-single value types. - std::list<std::vector<MVT::ValueType> > VTList; + std::list<std::vector<MVT> > VTList; // Maps to auto-CSE operations. std::vector<CondCodeSDNode*> CondCodeNodes; std::vector<SDNode*> ValueTypeNodes; - std::map<MVT::ValueType, SDNode*> ExtendedValueTypeNodes; + std::map<MVT, SDNode*> ExtendedValueTypeNodes; std::map<std::string, SDNode*> ExternalSymbols; std::map<std::string, SDNode*> TargetExternalSymbols; std::map<std::string, StringSDNode*> StringNodes; diff --git a/include/llvm/CodeGen/SelectionDAGISel.h b/include/llvm/CodeGen/SelectionDAGISel.h index f981687..fc6b9fb 100644 --- a/include/llvm/CodeGen/SelectionDAGISel.h +++ b/include/llvm/CodeGen/SelectionDAGISel.h @@ -55,7 +55,7 @@ public: virtual bool runOnFunction(Function &Fn); - unsigned MakeReg(MVT::ValueType VT); + unsigned MakeReg(MVT VT); virtual void EmitFunctionEntryCode(Function &Fn, MachineFunction &MF) {} virtual void InstructionSelectBasicBlock(SelectionDAG &SD) = 0; diff --git a/include/llvm/CodeGen/SelectionDAGNodes.h b/include/llvm/CodeGen/SelectionDAGNodes.h index 081b0e1..c2e4f1f 100644 --- a/include/llvm/CodeGen/SelectionDAGNodes.h +++ b/include/llvm/CodeGen/SelectionDAGNodes.h @@ -48,7 +48,7 @@ template<typename NodeTy> class ilist_iterator; /// SelectionDAG::getVTList(...). /// struct SDVTList { - const MVT::ValueType *VTs; + const MVT *VTs; unsigned short NumVTs; }; @@ -834,12 +834,12 @@ public: /// getValueType - Return the ValueType of the referenced return value. /// - inline MVT::ValueType getValueType() const; + inline MVT getValueType() const; - /// getValueSizeInBits - Returns MVT::getSizeInBits(getValueType()). + /// getValueSizeInBits - Returns the size of the value in bits. /// unsigned getValueSizeInBits() const { - return MVT::getSizeInBits(getValueType()); + return getValueType().getSizeInBits(); } // Forwarding methods - These forward to the corresponding methods in SDNode. @@ -1045,7 +1045,7 @@ private: /// ValueList - The types of the values this node defines. SDNode's may /// define multiple values simultaneously. - const MVT::ValueType *ValueList; + const MVT *ValueList; /// NumOperands/NumValues - The number of entries in the Operand/Value list. unsigned short NumOperands, NumValues; @@ -1216,7 +1216,7 @@ public: /// getValueType - Return the type of a specified result. /// - MVT::ValueType getValueType(unsigned ResNo) const { + MVT getValueType(unsigned ResNo) const { assert(ResNo < NumValues && "Illegal result number!"); return ValueList[ResNo]; } @@ -1224,10 +1224,10 @@ public: /// getValueSizeInBits - Returns MVT::getSizeInBits(getValueType(ResNo)). /// unsigned getValueSizeInBits(unsigned ResNo) const { - return MVT::getSizeInBits(getValueType(ResNo)); + return getValueType(ResNo).getSizeInBits(); } - typedef const MVT::ValueType* value_iterator; + typedef const MVT* value_iterator; value_iterator value_begin() const { return ValueList; } value_iterator value_end() const { return ValueList+NumValues; } @@ -1249,8 +1249,8 @@ protected: /// getValueTypeList - Return a pointer to the specified value type. /// - static const MVT::ValueType *getValueTypeList(MVT::ValueType VT); - static SDVTList getSDVTList(MVT::ValueType VT) { + static const MVT *getValueTypeList(MVT VT); + static SDVTList getSDVTList(MVT VT) { SDVTList Ret = { getValueTypeList(VT), 1 }; return Ret; } @@ -1344,7 +1344,7 @@ protected: inline unsigned SDOperand::getOpcode() const { return Val->getOpcode(); } -inline MVT::ValueType SDOperand::getValueType() const { +inline MVT SDOperand::getValueType() const { return Val->getValueType(ResNo); } inline unsigned SDOperand::getNumOperands() const { @@ -1439,10 +1439,10 @@ public: class AtomicSDNode : public SDNode { virtual void ANCHOR(); // Out-of-line virtual method to give class a home. SDUse Ops[4]; - MVT::ValueType OrigVT; + MVT OrigVT; public: AtomicSDNode(unsigned Opc, SDVTList VTL, SDOperand Chain, SDOperand Ptr, - SDOperand Cmp, SDOperand Swp, MVT::ValueType VT) + SDOperand Cmp, SDOperand Swp, MVT VT) : SDNode(Opc, VTL) { Ops[0] = Chain; Ops[1] = Ptr; @@ -1452,7 +1452,7 @@ public: OrigVT=VT; } AtomicSDNode(unsigned Opc, SDVTList VTL, SDOperand Chain, SDOperand Ptr, - SDOperand Val, MVT::ValueType VT) + SDOperand Val, MVT VT) : SDNode(Opc, VTL) { Ops[0] = Chain; Ops[1] = Ptr; @@ -1460,7 +1460,7 @@ public: InitOperands(Ops, 3); OrigVT=VT; } - MVT::ValueType getVT() const { return OrigVT; } + MVT getVT() const { return OrigVT; } bool isCompareAndSwap() const { return getOpcode() == ISD::ATOMIC_LCS; } }; @@ -1485,7 +1485,7 @@ class ConstantSDNode : public SDNode { virtual void ANCHOR(); // Out-of-line virtual method to give class a home. protected: friend class SelectionDAG; - ConstantSDNode(bool isTarget, const APInt &val, MVT::ValueType VT) + ConstantSDNode(bool isTarget, const APInt &val, MVT VT) : SDNode(isTarget ? ISD::TargetConstant : ISD::Constant, getSDVTList(VT)), Value(val) { } @@ -1495,13 +1495,13 @@ public: uint64_t getValue() const { return Value.getZExtValue(); } int64_t getSignExtended() const { - unsigned Bits = MVT::getSizeInBits(getValueType(0)); + unsigned Bits = getValueType(0).getSizeInBits(); return ((int64_t)Value.getZExtValue() << (64-Bits)) >> (64-Bits); } bool isNullValue() const { return Value == 0; } bool isAllOnesValue() const { - return Value == MVT::getIntVTBitMask(getValueType(0)); + return Value == getValueType(0).getIntegerVTBitMask(); } static bool classof(const ConstantSDNode *) { return true; } @@ -1516,7 +1516,7 @@ class ConstantFPSDNode : public SDNode { virtual void ANCHOR(); // Out-of-line virtual method to give class a home. protected: friend class SelectionDAG; - ConstantFPSDNode(bool isTarget, const APFloat& val, MVT::ValueType VT) + ConstantFPSDNode(bool isTarget, const APFloat& val, MVT VT) : SDNode(isTarget ? ISD::TargetConstantFP : ISD::ConstantFP, getSDVTList(VT)), Value(val) { } @@ -1542,7 +1542,7 @@ public: } bool isExactlyValue(const APFloat& V) const; - bool isValueValidForType(MVT::ValueType VT, const APFloat& Val); + bool isValueValidForType(MVT VT, const APFloat& Val); static bool classof(const ConstantFPSDNode *) { return true; } static bool classof(const SDNode *N) { @@ -1557,8 +1557,7 @@ class GlobalAddressSDNode : public SDNode { virtual void ANCHOR(); // Out-of-line virtual method to give class a home. protected: friend class SelectionDAG; - GlobalAddressSDNode(bool isTarget, const GlobalValue *GA, MVT::ValueType VT, - int o = 0); + GlobalAddressSDNode(bool isTarget, const GlobalValue *GA, MVT VT, int o = 0); public: GlobalValue *getGlobal() const { return TheGlobal; } @@ -1578,7 +1577,7 @@ class FrameIndexSDNode : public SDNode { virtual void ANCHOR(); // Out-of-line virtual method to give class a home. protected: friend class SelectionDAG; - FrameIndexSDNode(int fi, MVT::ValueType VT, bool isTarg) + FrameIndexSDNode(int fi, MVT VT, bool isTarg) : SDNode(isTarg ? ISD::TargetFrameIndex : ISD::FrameIndex, getSDVTList(VT)), FI(fi) { } @@ -1598,7 +1597,7 @@ class JumpTableSDNode : public SDNode { virtual void ANCHOR(); // Out-of-line virtual method to give class a home. protected: friend class SelectionDAG; - JumpTableSDNode(int jti, MVT::ValueType VT, bool isTarg) + JumpTableSDNode(int jti, MVT VT, bool isTarg) : SDNode(isTarg ? ISD::TargetJumpTable : ISD::JumpTable, getSDVTList(VT)), JTI(jti) { } @@ -1623,22 +1622,20 @@ class ConstantPoolSDNode : public SDNode { virtual void ANCHOR(); // Out-of-line virtual method to give class a home. protected: friend class SelectionDAG; - ConstantPoolSDNode(bool isTarget, Constant *c, MVT::ValueType VT, - int o=0) + ConstantPoolSDNode(bool isTarget, Constant *c, MVT VT, int o=0) : SDNode(isTarget ? ISD::TargetConstantPool : ISD::ConstantPool, getSDVTList(VT)), Offset(o), Alignment(0) { assert((int)Offset >= 0 && "Offset is too large"); Val.ConstVal = c; } - ConstantPoolSDNode(bool isTarget, Constant *c, MVT::ValueType VT, int o, - unsigned Align) + ConstantPoolSDNode(bool isTarget, Constant *c, MVT VT, int o, unsigned Align) : SDNode(isTarget ? ISD::TargetConstantPool : ISD::ConstantPool, getSDVTList(VT)), Offset(o), Alignment(Align) { assert((int)Offset >= 0 && "Offset is too large"); Val.ConstVal = c; } ConstantPoolSDNode(bool isTarget, MachineConstantPoolValue *v, - MVT::ValueType VT, int o=0) + MVT VT, int o=0) : SDNode(isTarget ? ISD::TargetConstantPool : ISD::ConstantPool, getSDVTList(VT)), Offset(o), Alignment(0) { assert((int)Offset >= 0 && "Offset is too large"); @@ -1646,7 +1643,7 @@ protected: Offset |= 1 << (sizeof(unsigned)*8-1); } ConstantPoolSDNode(bool isTarget, MachineConstantPoolValue *v, - MVT::ValueType VT, int o, unsigned Align) + MVT VT, int o, unsigned Align) : SDNode(isTarget ? ISD::TargetConstantPool : ISD::ConstantPool, getSDVTList(VT)), Offset(o), Alignment(Align) { assert((int)Offset >= 0 && "Offset is too large"); @@ -1760,7 +1757,7 @@ class RegisterSDNode : public SDNode { virtual void ANCHOR(); // Out-of-line virtual method to give class a home. protected: friend class SelectionDAG; - RegisterSDNode(unsigned reg, MVT::ValueType VT) + RegisterSDNode(unsigned reg, MVT VT) : SDNode(ISD::Register, getSDVTList(VT)), Reg(reg) { } public: @@ -1778,7 +1775,7 @@ class ExternalSymbolSDNode : public SDNode { virtual void ANCHOR(); // Out-of-line virtual method to give class a home. protected: friend class SelectionDAG; - ExternalSymbolSDNode(bool isTarget, const char *Sym, MVT::ValueType VT) + ExternalSymbolSDNode(bool isTarget, const char *Sym, MVT VT) : SDNode(isTarget ? ISD::TargetExternalSymbol : ISD::ExternalSymbol, getSDVTList(VT)), Symbol(Sym) { } @@ -1914,19 +1911,19 @@ public: } }; -/// VTSDNode - This class is used to represent MVT::ValueType's, which are used +/// VTSDNode - This class is used to represent MVT's, which are used /// to parameterize some operations. class VTSDNode : public SDNode { - MVT::ValueType ValueType; + MVT ValueType; virtual void ANCHOR(); // Out-of-line virtual method to give class a home. protected: friend class SelectionDAG; - explicit VTSDNode(MVT::ValueType VT) + explicit VTSDNode(MVT VT) : SDNode(ISD::VALUETYPE, getSDVTList(MVT::Other)), ValueType(VT) { } public: - MVT::ValueType getVT() const { return ValueType; } + MVT getVT() const { return ValueType; } static bool classof(const VTSDNode *) { return true; } static bool classof(const SDNode *N) { @@ -1942,7 +1939,7 @@ private: ISD::MemIndexedMode AddrMode; // MemoryVT - VT of in-memory value. - MVT::ValueType MemoryVT; + MVT MemoryVT; //! SrcValue - Memory location for alias analysis. const Value *SrcValue; @@ -1965,7 +1962,7 @@ protected: SDUse Ops[4]; public: LSBaseSDNode(ISD::NodeType NodeTy, SDOperand *Operands, unsigned numOperands, - SDVTList VTs, ISD::MemIndexedMode AM, MVT::ValueType VT, + SDVTList VTs, ISD::MemIndexedMode AM, MVT VT, const Value *SV, int SVO, unsigned Align, bool Vol) : SDNode(NodeTy, VTs), AddrMode(AM), MemoryVT(VT), @@ -1989,7 +1986,7 @@ public: const Value *getSrcValue() const { return SrcValue; } int getSrcValueOffset() const { return SVOffset; } unsigned getAlignment() const { return Alignment; } - MVT::ValueType getMemoryVT() const { return MemoryVT; } + MVT getMemoryVT() const { return MemoryVT; } bool isVolatile() const { return IsVolatile; } ISD::MemIndexedMode getAddressingMode() const { return AddrMode; } @@ -2022,7 +2019,7 @@ class LoadSDNode : public LSBaseSDNode { protected: friend class SelectionDAG; LoadSDNode(SDOperand *ChainPtrOff, SDVTList VTs, - ISD::MemIndexedMode AM, ISD::LoadExtType ETy, MVT::ValueType LVT, + ISD::MemIndexedMode AM, ISD::LoadExtType ETy, MVT LVT, const Value *SV, int O=0, unsigned Align=0, bool Vol=false) : LSBaseSDNode(ISD::LOAD, ChainPtrOff, 3, VTs, AM, LVT, SV, O, Align, Vol), @@ -2049,7 +2046,7 @@ class StoreSDNode : public LSBaseSDNode { protected: friend class SelectionDAG; StoreSDNode(SDOperand *ChainValuePtrOff, SDVTList VTs, - ISD::MemIndexedMode AM, bool isTrunc, MVT::ValueType SVT, + ISD::MemIndexedMode AM, bool isTrunc, MVT SVT, const Value *SV, int O=0, unsigned Align=0, bool Vol=false) : LSBaseSDNode(ISD::STORE, ChainValuePtrOff, 4, VTs, AM, SVT, SV, O, Align, Vol), diff --git a/include/llvm/CodeGen/ValueTypes.h b/include/llvm/CodeGen/ValueTypes.h index 6b20b7d..1469f81 100644 --- a/include/llvm/CodeGen/ValueTypes.h +++ b/include/llvm/CodeGen/ValueTypes.h @@ -24,368 +24,389 @@ namespace llvm { class Type; -/// MVT namespace - This namespace defines the SimpleValueType enum, which -/// contains the various low-level value types, and the ValueType typedef. -/// -namespace MVT { // MVT = Machine Value Types - enum SimpleValueType { - // If you change this numbering, you must change the values in ValueTypes.td - // well! - Other = 0, // This is a non-standard value - i1 = 1, // This is a 1 bit integer value - i8 = 2, // This is an 8 bit integer value - i16 = 3, // This is a 16 bit integer value - i32 = 4, // This is a 32 bit integer value - i64 = 5, // This is a 64 bit integer value - i128 = 6, // This is a 128 bit integer value - - FIRST_INTEGER_VALUETYPE = i1, - LAST_INTEGER_VALUETYPE = i128, - - f32 = 7, // This is a 32 bit floating point value - f64 = 8, // This is a 64 bit floating point value - f80 = 9, // This is a 80 bit floating point value - f128 = 10, // This is a 128 bit floating point value - ppcf128 = 11, // This is a PPC 128-bit floating point value - Flag = 12, // This is a condition code or machine flag. - - isVoid = 13, // This has no value - - v8i8 = 14, // 8 x i8 - v4i16 = 15, // 4 x i16 - v2i32 = 16, // 2 x i32 - v1i64 = 17, // 1 x i64 - v16i8 = 18, // 16 x i8 - v8i16 = 19, // 8 x i16 - v3i32 = 20, // 3 x i32 - v4i32 = 21, // 4 x i32 - v2i64 = 22, // 2 x i64 - - v2f32 = 23, // 2 x f32 - v3f32 = 24, // 3 x f32 - v4f32 = 25, // 4 x f32 - v2f64 = 26, // 2 x f64 - - FIRST_VECTOR_VALUETYPE = v8i8, - LAST_VECTOR_VALUETYPE = v2f64, - - LAST_VALUETYPE = 27, // This always remains at the end of the list. - - // fAny - Any floating-point or vector floating-point value. This is used - // for intrinsics that have overloadings based on floating-point types. - // This is only for tblgen's consumption! - fAny = 253, - - // iAny - An integer or vector integer value of any bit width. This is - // used for intrinsics that have overloadings based on integer bit widths. - // This is only for tblgen's consumption! - iAny = 254, - - // iPTR - An int value the size of the pointer of the current - // target. This should only be used internal to tblgen! - iPTR = 255 - }; + struct MVT { // MVT = Machine Value Type + + enum SimpleValueType { + // If you change this numbering, you must change the values in + // ValueTypes.td well! + Other = 0, // This is a non-standard value + i1 = 1, // This is a 1 bit integer value + i8 = 2, // This is an 8 bit integer value + i16 = 3, // This is a 16 bit integer value + i32 = 4, // This is a 32 bit integer value + i64 = 5, // This is a 64 bit integer value + i128 = 6, // This is a 128 bit integer value + + FIRST_INTEGER_VALUETYPE = i1, + LAST_INTEGER_VALUETYPE = i128, + + f32 = 7, // This is a 32 bit floating point value + f64 = 8, // This is a 64 bit floating point value + f80 = 9, // This is a 80 bit floating point value + f128 = 10, // This is a 128 bit floating point value + ppcf128 = 11, // This is a PPC 128-bit floating point value + Flag = 12, // This is a condition code or machine flag. + + isVoid = 13, // This has no value + + v8i8 = 14, // 8 x i8 + v4i16 = 15, // 4 x i16 + v2i32 = 16, // 2 x i32 + v1i64 = 17, // 1 x i64 + v16i8 = 18, // 16 x i8 + v8i16 = 19, // 8 x i16 + v3i32 = 20, // 3 x i32 + v4i32 = 21, // 4 x i32 + v2i64 = 22, // 2 x i64 + + v2f32 = 23, // 2 x f32 + v3f32 = 24, // 3 x f32 + v4f32 = 25, // 4 x f32 + v2f64 = 26, // 2 x f64 + + FIRST_VECTOR_VALUETYPE = v8i8, + LAST_VECTOR_VALUETYPE = v2f64, + + LAST_VALUETYPE = 27, // This always remains at the end of the list. + + // fAny - Any floating-point or vector floating-point value. This is used + // for intrinsics that have overloadings based on floating-point types. + // This is only for tblgen's consumption! + fAny = 253, + + // iAny - An integer or vector integer value of any bit width. This is + // used for intrinsics that have overloadings based on integer bit widths. + // This is only for tblgen's consumption! + iAny = 254, + + // iPTR - An int value the size of the pointer of the current + // target. This should only be used internal to tblgen! + iPTR = 255 + }; + + /// MVT - This type holds low-level value types. Valid values include any of + /// the values in the SimpleValueType enum, or any value returned from one + /// of the MVT methods. Any value type equal to one of the SimpleValueType + /// enum values is a "simple" value type. All others are "extended". + /// + /// Note that simple doesn't necessary mean legal for the target machine. + /// All legal value types must be simple, but often there are some simple + /// value types that are not legal. + /// + /// @internal + /// Extended types are either vector types or arbitrary precision integers. + /// Arbitrary precision integers have iAny in the first SimpleTypeBits bits, + /// and the bit-width in the next PrecisionBits bits, offset by minus one. + /// Vector types are encoded by having the first SimpleTypeBits+PrecisionBits + /// bits encode the vector element type (which must be a scalar type, possibly + /// an arbitrary precision integer) and the remaining VectorBits upper bits + /// encode the vector length, offset by one. + /// + /// 31--------------16-----------8-------------0 + /// | Vector length | Precision | Simple type | + /// | | Vector element | + /// + + static const int SimpleTypeBits = 8; + static const int PrecisionBits = 8; + static const int VectorBits = 32 - SimpleTypeBits - PrecisionBits; + + static const uint32_t SimpleTypeMask = + (~uint32_t(0) << (32 - SimpleTypeBits)) >> (32 - SimpleTypeBits); + + static const uint32_t PrecisionMask = + ((~uint32_t(0) << VectorBits) >> (32 - PrecisionBits)) << SimpleTypeBits; + + static const uint32_t VectorMask = + (~uint32_t(0) >> (32 - VectorBits)) << (32 - VectorBits); + + static const uint32_t ElementMask = + (~uint32_t(0) << VectorBits) >> VectorBits; + + uint32_t V; + + MVT() {} + MVT(SimpleValueType S) { V = S; } + inline bool operator== (const MVT VT) const { return V == VT.V; } + inline bool operator!= (const MVT VT) const { return V != VT.V; } + + /// FIXME: The following comparison methods are bogus - they are only here + /// to ease the transition to a struct type. + inline bool operator< (const MVT VT) const { return V < VT.V; } + inline bool operator<= (const MVT VT) const { return V <= VT.V; } + inline bool operator> (const MVT VT) const { return V > VT.V; } + inline bool operator>= (const MVT VT) const { return V >= VT.V; } + + /// getIntegerVT - Returns the MVT that represents an integer with the given + /// number of bits. + static inline MVT getIntegerVT(unsigned BitWidth) { + switch (BitWidth) { + default: + break; + case 1: + return i1; + case 8: + return i8; + case 16: + return i16; + case 32: + return i32; + case 64: + return i64; + case 128: + return i128; + } + MVT VT; + VT.V = iAny | (((BitWidth - 1) << SimpleTypeBits) & PrecisionMask); + assert(VT.getSizeInBits() == BitWidth && "Bad bit width!"); + return VT; + } + + /// getVectorVT - Returns the MVT that represents a vector NumElements in + /// length, where each element is of type VT. + static inline MVT getVectorVT(MVT VT, unsigned NumElements) { + switch (VT.V) { + default: + break; + case i8: + if (NumElements == 8) return v8i8; + if (NumElements == 16) return v16i8; + break; + case i16: + if (NumElements == 4) return v4i16; + if (NumElements == 8) return v8i16; + break; + case i32: + if (NumElements == 2) return v2i32; + if (NumElements == 3) return v3i32; + if (NumElements == 4) return v4i32; + break; + case i64: + if (NumElements == 1) return v1i64; + if (NumElements == 2) return v2i64; + break; + case f32: + if (NumElements == 2) return v2f32; + if (NumElements == 3) return v3f32; + if (NumElements == 4) return v4f32; + break; + case f64: + if (NumElements == 2) return v2f64; + break; + } + // Set the length with the top bit forced to zero (needed by the verifier). + MVT Result; + Result.V = VT.V | (((NumElements + 1) << (33 - VectorBits)) >> 1); + assert(Result.getVectorElementType() == VT && + "Bad vector element type!"); + assert(Result.getVectorNumElements() == NumElements && + "Bad vector length!"); + return Result; + } + + /// getIntVectorWithNumElements - Return any integer vector type that has + /// the specified number of elements. + static inline MVT getIntVectorWithNumElements(unsigned NumElts) { + switch (NumElts) { + default: return getVectorVT(i8, NumElts); + case 1: return v1i64; + case 2: return v2i32; + case 3: return v3i32; + case 4: return v4i16; + case 8: return v8i8; + case 16: return v16i8; + } + } + + + /// isSimple - Test if the given MVT is simple (as opposed to being + /// extended). + inline bool isSimple() const { + return V <= SimpleTypeMask; + } - /// MVT::ValueType - This type holds low-level value types. Valid values - /// include any of the values in the SimpleValueType enum, or any value - /// returned from a function in the MVT namespace that has a ValueType - /// return type. Any value type equal to one of the SimpleValueType enum - /// values is a "simple" value type. All other value types are "extended". - /// - /// Note that simple doesn't necessary mean legal for the target machine. - /// All legal value types must be simple, but often there are some simple - /// value types that are not legal. - /// - /// @internal - /// Extended types are either vector types or arbitrary precision integers. - /// Arbitrary precision integers have iAny in the first SimpleTypeBits bits, - /// and the bit-width in the next PrecisionBits bits, offset by minus one. - /// Vector types are encoded by having the first SimpleTypeBits+PrecisionBits - /// bits encode the vector element type (which must be a scalar type, possibly - /// an arbitrary precision integer) and the remaining VectorBits upper bits - /// encode the vector length, offset by one. - /// - /// 31--------------16-----------8-------------0 - /// | Vector length | Precision | Simple type | - /// | | Vector element | - /// - /// Note that the verifier currently requires the top bit to be zero. - - typedef uint32_t ValueType; - - static const int SimpleTypeBits = 8; - static const int PrecisionBits = 8; - static const int VectorBits = 32 - SimpleTypeBits - PrecisionBits; - - static const uint32_t SimpleTypeMask = - (~uint32_t(0) << (32 - SimpleTypeBits)) >> (32 - SimpleTypeBits); - - static const uint32_t PrecisionMask = - ((~uint32_t(0) << VectorBits) >> (32 - PrecisionBits)) << SimpleTypeBits; - - static const uint32_t VectorMask = - (~uint32_t(0) >> (32 - VectorBits)) << (32 - VectorBits); - - static const uint32_t ElementMask = - (~uint32_t(0) << VectorBits) >> VectorBits; - - /// MVT::isExtendedVT - Test if the given ValueType is extended - /// (as opposed to being simple). - static inline bool isExtendedVT(ValueType VT) { - return VT > SimpleTypeMask; - } - - /// MVT::isInteger - Return true if this is an integer, or a vector integer - /// type. - static inline bool isInteger(ValueType VT) { - ValueType SVT = VT & SimpleTypeMask; - return (SVT >= FIRST_INTEGER_VALUETYPE && SVT <= LAST_INTEGER_VALUETYPE) || - (SVT >= v8i8 && SVT <= v2i64) || (SVT == iAny && (VT & PrecisionMask)); - } - - /// MVT::isFloatingPoint - Return true if this is an FP, or a vector FP type. - static inline bool isFloatingPoint(ValueType VT) { - ValueType SVT = VT & SimpleTypeMask; - return (SVT >= f32 && SVT <= ppcf128) || (SVT >= v2f32 && SVT <= v2f64); - } - - /// MVT::isVector - Return true if this is a vector value type. - static inline bool isVector(ValueType VT) { - return (VT >= FIRST_VECTOR_VALUETYPE && VT <= LAST_VECTOR_VALUETYPE) || - (VT & VectorMask); - } - - /// MVT::getVectorElementType - Given a vector type, return the type of - /// each element. - static inline ValueType getVectorElementType(ValueType VT) { - assert(isVector(VT) && "Invalid vector type!"); - switch (VT) { - default: - assert(isExtendedVT(VT) && "Unknown simple vector type!"); - return VT & ElementMask; - case v8i8 : - case v16i8: return i8; - case v4i16: - case v8i16: return i16; - case v2i32: - case v3i32: - case v4i32: return i32; - case v1i64: - case v2i64: return i64; - case v2f32: - case v3f32: - case v4f32: return f32; - case v2f64: return f64; + /// isExtended - Test if the given MVT is extended (as opposed to + /// being simple). + inline bool isExtended() const { + return !isSimple(); } - } - - /// MVT::getVectorNumElements - Given a vector type, return the - /// number of elements it contains. - static inline unsigned getVectorNumElements(ValueType VT) { - assert(isVector(VT) && "Invalid vector type!"); - switch (VT) { - default: - assert(isExtendedVT(VT) && "Unknown simple vector type!"); - return ((VT & VectorMask) >> (32 - VectorBits)) - 1; - case v16i8: return 16; - case v8i8 : - case v8i16: return 8; - case v4i16: - case v4i32: - case v4f32: return 4; - case v3i32: - case v3f32: return 3; - case v2i32: - case v2i64: - case v2f32: - case v2f64: return 2; - case v1i64: return 1; + + /// isFloatingPoint - Return true if this is a FP, or a vector FP type. + inline bool isFloatingPoint() const { + uint32_t SVT = V & SimpleTypeMask; + return (SVT >= f32 && SVT <= ppcf128) || (SVT >= v2f32 && SVT <= v2f64); } - } - - /// MVT::getSizeInBits - Return the size of the specified value type - /// in bits. - /// - static inline unsigned getSizeInBits(ValueType VT) { - switch (VT) { - default: - assert(isExtendedVT(VT) && "ValueType has no known size!"); - if (isVector(VT)) - return getSizeInBits(getVectorElementType(VT)) * - getVectorNumElements(VT); - if (isInteger(VT)) - return ((VT & PrecisionMask) >> SimpleTypeBits) + 1; - assert(0 && "Unknown value type!"); - case MVT::i1 : return 1; - case MVT::i8 : return 8; - case MVT::i16 : return 16; - case MVT::f32 : - case MVT::i32 : return 32; - case MVT::f64 : - case MVT::i64 : - case MVT::v8i8: - case MVT::v4i16: - case MVT::v2i32: - case MVT::v1i64: - case MVT::v2f32: return 64; - case MVT::f80 : return 80; - case MVT::v3i32: - case MVT::v3f32: return 96; - case MVT::f128: - case MVT::ppcf128: - case MVT::i128: - case MVT::v16i8: - case MVT::v8i16: - case MVT::v4i32: - case MVT::v2i64: - case MVT::v4f32: - case MVT::v2f64: return 128; + + /// isInteger - Return true if this is an integer, or a vector integer type. + inline bool isInteger() const { + uint32_t SVT = V & SimpleTypeMask; + return (SVT >= FIRST_INTEGER_VALUETYPE && SVT <= LAST_INTEGER_VALUETYPE) || + (SVT >= v8i8 && SVT <= v2i64) || (SVT == iAny && (V & PrecisionMask)); } - } - - /// MVT::getStoreSizeInBits - Return the number of bits overwritten by a - /// store of the specified value type. - /// - static inline unsigned getStoreSizeInBits(ValueType VT) { - return (getSizeInBits(VT) + 7)/8*8; - } - - /// MVT::is64BitVector - Return true if this is a 64-bit vector type. - static inline bool is64BitVector(ValueType VT) { - return (VT==v8i8 || VT==v4i16 || VT==v2i32 || VT==v1i64 || VT==v2f32 || - (isExtendedVT(VT) && isVector(VT) && getSizeInBits(VT)==64)); - } - - /// MVT::is128BitVector - Return true if this is a 128-bit vector type. - static inline bool is128BitVector(ValueType VT) { - return (VT==v16i8 || VT==v8i16 || VT==v4i32 || VT==v2i64 || - VT==v4f32 || VT==v2f64 || - (isExtendedVT(VT) && isVector(VT) && getSizeInBits(VT)==128)); - } - - /// MVT::getIntegerType - Returns the ValueType that represents an integer - /// with the given number of bits. - /// - static inline ValueType getIntegerType(unsigned BitWidth) { - switch (BitWidth) { - default: - break; - case 1: - return MVT::i1; - case 8: - return MVT::i8; - case 16: - return MVT::i16; - case 32: - return MVT::i32; - case 64: - return MVT::i64; - case 128: - return MVT::i128; + + /// isVector - Return true if this is a vector value type. + inline bool isVector() const { + return (V >= FIRST_VECTOR_VALUETYPE && V <= LAST_VECTOR_VALUETYPE) || + (V & VectorMask); } - ValueType Result = iAny | - (((BitWidth - 1) << SimpleTypeBits) & PrecisionMask); - assert(getSizeInBits(Result) == BitWidth && "Bad bit width!"); - return Result; - } - - /// MVT::RoundIntegerType - Rounds the bit-width of the given integer - /// ValueType up to the nearest power of two (and at least to eight), - /// and returns the integer ValueType with that number of bits. - /// - static inline ValueType RoundIntegerType(ValueType VT) { - assert(isInteger(VT) && !isVector(VT) && "Invalid integer type!"); - unsigned BitWidth = getSizeInBits(VT); - if (BitWidth <= 8) - return MVT::i8; - else - return getIntegerType(1 << Log2_32_Ceil(BitWidth)); - } - - /// MVT::getVectorType - Returns the ValueType that represents a vector - /// NumElements in length, where each element is of type VT. - /// - static inline ValueType getVectorType(ValueType VT, unsigned NumElements) { - switch (VT) { - default: - break; - case MVT::i8: - if (NumElements == 8) return MVT::v8i8; - if (NumElements == 16) return MVT::v16i8; - break; - case MVT::i16: - if (NumElements == 4) return MVT::v4i16; - if (NumElements == 8) return MVT::v8i16; - break; - case MVT::i32: - if (NumElements == 2) return MVT::v2i32; - if (NumElements == 3) return MVT::v3i32; - if (NumElements == 4) return MVT::v4i32; - break; - case MVT::i64: - if (NumElements == 1) return MVT::v1i64; - if (NumElements == 2) return MVT::v2i64; - break; - case MVT::f32: - if (NumElements == 2) return MVT::v2f32; - if (NumElements == 3) return MVT::v3f32; - if (NumElements == 4) return MVT::v4f32; - break; - case MVT::f64: - if (NumElements == 2) return MVT::v2f64; - break; + + /// is64BitVector - Return true if this is a 64-bit vector type. + inline bool is64BitVector() const { + return (V==v8i8 || V==v4i16 || V==v2i32 || V==v1i64 || V==v2f32 || + (isExtended() && isVector() && getSizeInBits()==64)); } - // Set the length with the top bit forced to zero (needed by the verifier). - ValueType Result = VT | (((NumElements + 1) << (33 - VectorBits)) >> 1); - assert(getVectorElementType(Result) == VT && - "Bad vector element type!"); - assert(getVectorNumElements(Result) == NumElements && - "Bad vector length!"); - return Result; - } - - /// MVT::getIntVectorWithNumElements - Return any integer vector type that has - /// the specified number of elements. - static inline ValueType getIntVectorWithNumElements(unsigned NumElts) { - switch (NumElts) { - default: return getVectorType(i8, NumElts); - case 1: return v1i64; - case 2: return v2i32; - case 3: return v3i32; - case 4: return v4i16; - case 8: return v8i8; - case 16: return v16i8; + + /// is128BitVector - Return true if this is a 128-bit vector type. + inline bool is128BitVector() const { + return (V==v16i8 || V==v8i16 || V==v4i32 || V==v2i64 || + V==v4f32 || V==v2f64 || + (isExtended() && isVector() && getSizeInBits()==128)); } - } - - - /// MVT::getIntVTBitMask - Return an integer with 1's every place there are - /// bits in the specified integer value type. - static inline uint64_t getIntVTBitMask(ValueType VT) { - assert(isInteger(VT) && !isVector(VT) && "Only applies to int scalars!"); - return ~uint64_t(0UL) >> (64-getSizeInBits(VT)); - } - /// MVT::getIntVTSignBit - Return an integer with a 1 in the position of the - /// sign bit for the specified integer value type. - static inline uint64_t getIntVTSignBit(ValueType VT) { - assert(isInteger(VT) && !isVector(VT) && "Only applies to int scalars!"); - return uint64_t(1UL) << (getSizeInBits(VT)-1); - } - - /// MVT::getValueTypeString - This function returns value type as a string, - /// e.g. "i32". - std::string getValueTypeString(ValueType VT); - - /// MVT::getTypeForValueType - This method returns an LLVM type corresponding - /// to the specified ValueType. For integer types, this returns an unsigned - /// type. Note that this will abort for types that cannot be represented. - const Type *getTypeForValueType(ValueType VT); - - /// MVT::getValueType - Return the value type corresponding to the specified - /// type. This returns all pointers as MVT::iPTR. If HandleUnknown is true, - /// unknown types are returned as Other, otherwise they are invalid. - ValueType getValueType(const Type *Ty, bool HandleUnknown = false); -} + + + /// getSimpleVT - Return the SimpleValueType held in the specified + /// simple MVT. + inline SimpleValueType getSimpleVT() const { + assert(isSimple() && "Expected a SimpleValueType!"); + return (SimpleValueType)V; + } + + /// getVectorElementType - Given a vector type, return the type of + /// each element. + inline MVT getVectorElementType() const { + assert(isVector() && "Invalid vector type!"); + switch (V) { + default: { + assert(isExtended() && "Unknown simple vector type!"); + MVT VT; + VT.V = V & ElementMask; + return VT; + } + case v8i8 : + case v16i8: return i8; + case v4i16: + case v8i16: return i16; + case v2i32: + case v3i32: + case v4i32: return i32; + case v1i64: + case v2i64: return i64; + case v2f32: + case v3f32: + case v4f32: return f32; + case v2f64: return f64; + } + } + + /// getVectorNumElements - Given a vector type, return the number of + /// elements it contains. + inline unsigned getVectorNumElements() const { + assert(isVector() && "Invalid vector type!"); + switch (V) { + default: + assert(isExtended() && "Unknown simple vector type!"); + return ((V & VectorMask) >> (32 - VectorBits)) - 1; + case v16i8: return 16; + case v8i8 : + case v8i16: return 8; + case v4i16: + case v4i32: + case v4f32: return 4; + case v3i32: + case v3f32: return 3; + case v2i32: + case v2i64: + case v2f32: + case v2f64: return 2; + case v1i64: return 1; + } + } + + /// getSizeInBits - Return the size of the specified value type in bits. + inline unsigned getSizeInBits() const { + switch (V) { + default: + assert(isExtended() && "MVT has no known size!"); + if (isVector()) + return getVectorElementType().getSizeInBits()*getVectorNumElements(); + if (isInteger()) + return ((V & PrecisionMask) >> SimpleTypeBits) + 1; + assert(false && "Unknown value type!"); + return 0; + case i1 : return 1; + case i8 : return 8; + case i16 : return 16; + case f32 : + case i32 : return 32; + case f64 : + case i64 : + case v8i8: + case v4i16: + case v2i32: + case v1i64: + case v2f32: return 64; + case f80 : return 80; + case v3i32: + case v3f32: return 96; + case f128: + case ppcf128: + case i128: + case v16i8: + case v8i16: + case v4i32: + case v2i64: + case v4f32: + case v2f64: return 128; + } + } + + /// getStoreSizeInBits - Return the number of bits overwritten by a store + /// of the specified value type. + inline unsigned getStoreSizeInBits() const { + return (getSizeInBits() + 7)/8*8; + } + + /// getRoundIntegerType - Rounds the bit-width of the given integer MVT up + /// to the nearest power of two (and at least to eight), and returns the + /// integer MVT with that number of bits. + inline MVT getRoundIntegerType() const { + assert(isInteger() && !isVector() && "Invalid integer type!"); + unsigned BitWidth = getSizeInBits(); + if (BitWidth <= 8) + return i8; + else + return getIntegerVT(1 << Log2_32_Ceil(BitWidth)); + } + + /// getIntegerVTBitMask - Return an integer with 1's every place there are + /// bits in the specified integer value type. FIXME: Should return an apint. + inline uint64_t getIntegerVTBitMask() const { + assert(isInteger() && !isVector() && "Only applies to int scalars!"); + return ~uint64_t(0UL) >> (64-getSizeInBits()); + } + + /// getIntegerVTSignBit - Return an integer with a 1 in the position of the + /// sign bit for the specified integer value type. FIXME: Should return an + /// apint. + inline uint64_t getIntegerVTSignBit() const { + assert(isInteger() && !isVector() && "Only applies to int scalars!"); + return uint64_t(1UL) << (getSizeInBits()-1); + } + + /// getMVTString - This function returns value type as a string, + /// e.g. "i32". + std::string getMVTString() const; + + /// getTypeForMVT - This method returns an LLVM type corresponding to the + /// specified MVT. For integer types, this returns an unsigned type. Note + /// that this will abort for types that cannot be represented. + const Type *getTypeForMVT() const; + + /// getMVT - Return the value type corresponding to the specified type. + /// This returns all pointers as iPTR. If HandleUnknown is true, unknown + /// types are returned as Other, otherwise they are invalid. + static MVT getMVT(const Type *Ty, bool HandleUnknown = false); + }; } // End llvm namespace diff --git a/include/llvm/Target/TargetLowering.h b/include/llvm/Target/TargetLowering.h index 5ba1018..eb436d6 100644 --- a/include/llvm/Target/TargetLowering.h +++ b/include/llvm/Target/TargetLowering.h @@ -90,8 +90,8 @@ public: bool isBigEndian() const { return !IsLittleEndian; } bool isLittleEndian() const { return IsLittleEndian; } - MVT::ValueType getPointerTy() const { return PointerTy; } - MVT::ValueType getShiftAmountTy() const { return ShiftAmountTy; } + MVT getPointerTy() const { return PointerTy; } + MVT getShiftAmountTy() const { return ShiftAmountTy; } OutOfRangeShiftAmount getShiftAmountFlavor() const {return ShiftAmtHandling; } /// usesGlobalOffsetTable - Return true if this target uses a GOT for PIC @@ -112,7 +112,7 @@ public: /// getSetCCResultType - Return the ValueType of the result of setcc /// operations. - virtual MVT::ValueType getSetCCResultType(const SDOperand &) const; + virtual MVT getSetCCResultType(const SDOperand &) const; /// getSetCCResultContents - For targets without boolean registers, this flag /// returns information about the contents of the high-bits in the setcc @@ -126,9 +126,9 @@ public: /// getRegClassFor - Return the register class that should be used for the /// specified value type. This may only be called on legal types. - TargetRegisterClass *getRegClassFor(MVT::ValueType VT) const { - assert(VT < array_lengthof(RegClassForVT)); - TargetRegisterClass *RC = RegClassForVT[VT]; + TargetRegisterClass *getRegClassFor(MVT VT) const { + assert((unsigned)VT.getSimpleVT() < array_lengthof(RegClassForVT)); + TargetRegisterClass *RC = RegClassForVT[VT.getSimpleVT()]; assert(RC && "This value type is not natively supported!"); return RC; } @@ -136,9 +136,10 @@ public: /// isTypeLegal - Return true if the target has native support for the /// specified value type. This means that it has a register that directly /// holds it without promotions or expansions. - bool isTypeLegal(MVT::ValueType VT) const { - assert(MVT::isExtendedVT(VT) || VT < array_lengthof(RegClassForVT)); - return !MVT::isExtendedVT(VT) && RegClassForVT[VT] != 0; + bool isTypeLegal(MVT VT) const { + assert(!VT.isSimple() || + (unsigned)VT.getSimpleVT() < array_lengthof(RegClassForVT)); + return VT.isSimple() && RegClassForVT[VT.getSimpleVT()] != 0; } class ValueTypeActionImpl { @@ -155,20 +156,23 @@ public: ValueTypeActions[1] = RHS.ValueTypeActions[1]; } - LegalizeAction getTypeAction(MVT::ValueType VT) const { - if (MVT::isExtendedVT(VT)) { - if (MVT::isVector(VT)) return Expand; - if (MVT::isInteger(VT)) + LegalizeAction getTypeAction(MVT VT) const { + if (VT.isExtended()) { + if (VT.isVector()) return Expand; + if (VT.isInteger()) // First promote to a power-of-two size, then expand if necessary. - return VT == MVT::RoundIntegerType(VT) ? Expand : Promote; + return VT == VT.getRoundIntegerType() ? Expand : Promote; assert(0 && "Unsupported extended type!"); + return Legal; } - assert(VT<4*array_lengthof(ValueTypeActions)*sizeof(ValueTypeActions[0])); - return (LegalizeAction)((ValueTypeActions[VT>>4] >> ((2*VT) & 31)) & 3); + unsigned I = VT.getSimpleVT(); + assert(I<4*array_lengthof(ValueTypeActions)*sizeof(ValueTypeActions[0])); + return (LegalizeAction)((ValueTypeActions[I>>4] >> ((2*I) & 31)) & 3); } - void setTypeAction(MVT::ValueType VT, LegalizeAction Action) { - assert(VT<4*array_lengthof(ValueTypeActions)*sizeof(ValueTypeActions[0])); - ValueTypeActions[VT>>4] |= Action << ((VT*2) & 31); + void setTypeAction(MVT VT, LegalizeAction Action) { + unsigned I = VT.getSimpleVT(); + assert(I<4*array_lengthof(ValueTypeActions)*sizeof(ValueTypeActions[0])); + ValueTypeActions[I>>4] |= Action << ((I*2) & 31); } }; @@ -180,7 +184,7 @@ public: /// it is already legal (return 'Legal') or we need to promote it to a larger /// type (return 'Promote'), or we need to expand it into multiple registers /// of smaller integer type (return 'Expand'). 'Custom' is not an option. - LegalizeAction getTypeAction(MVT::ValueType VT) const { + LegalizeAction getTypeAction(MVT VT) const { return ValueTypeActions.getTypeAction(VT); } @@ -190,37 +194,37 @@ public: /// than the largest integer register, this contains one step in the expansion /// to get to the smaller register. For illegal floating point types, this /// returns the integer type to transform to. - MVT::ValueType getTypeToTransformTo(MVT::ValueType VT) const { - if (!MVT::isExtendedVT(VT)) { - assert(VT < array_lengthof(TransformToType)); - MVT::ValueType NVT = TransformToType[VT]; + MVT getTypeToTransformTo(MVT VT) const { + if (VT.isSimple()) { + assert((unsigned)VT.getSimpleVT() < array_lengthof(TransformToType)); + MVT NVT = TransformToType[VT.getSimpleVT()]; assert(getTypeAction(NVT) != Promote && "Promote may not follow Expand or Promote"); return NVT; } - if (MVT::isVector(VT)) - return MVT::getVectorType(MVT::getVectorElementType(VT), - MVT::getVectorNumElements(VT) / 2); - if (MVT::isInteger(VT)) { - MVT::ValueType NVT = MVT::RoundIntegerType(VT); + if (VT.isVector()) + return MVT::getVectorVT(VT.getVectorElementType(), + VT.getVectorNumElements() / 2); + if (VT.isInteger()) { + MVT NVT = VT.getRoundIntegerType(); if (NVT == VT) // Size is a power of two - expand to half the size. - return MVT::getIntegerType(MVT::getSizeInBits(VT) / 2); + return MVT::getIntegerVT(VT.getSizeInBits() / 2); else // Promote to a power of two size, avoiding multi-step promotion. return getTypeAction(NVT) == Promote ? getTypeToTransformTo(NVT) : NVT; } assert(0 && "Unsupported extended type!"); - return MVT::ValueType(); // Not reached + return MVT(); // Not reached } /// getTypeToExpandTo - For types supported by the target, this is an /// identity function. For types that must be expanded (i.e. integer types /// that are larger than the largest integer register or illegal floating /// point types), this returns the largest legal type it will be expanded to. - MVT::ValueType getTypeToExpandTo(MVT::ValueType VT) const { - assert(!MVT::isVector(VT)); + MVT getTypeToExpandTo(MVT VT) const { + assert(!VT.isVector()); while (true) { switch (getTypeAction(VT)) { case Legal: @@ -245,10 +249,10 @@ public: /// register. It also returns the VT and quantity of the intermediate values /// before they are promoted/expanded. /// - unsigned getVectorTypeBreakdown(MVT::ValueType VT, - MVT::ValueType &IntermediateVT, + unsigned getVectorTypeBreakdown(MVT VT, + MVT &IntermediateVT, unsigned &NumIntermediates, - MVT::ValueType &RegisterVT) const; + MVT &RegisterVT) const; typedef std::vector<APFloat>::const_iterator legal_fpimm_iterator; legal_fpimm_iterator legal_fpimm_begin() const { @@ -262,7 +266,7 @@ public: /// support *some* VECTOR_SHUFFLE operations, those with specific masks. /// By default, if a target supports the VECTOR_SHUFFLE node, all mask values /// are assumed to be legal. - virtual bool isShuffleMaskLegal(SDOperand Mask, MVT::ValueType VT) const { + virtual bool isShuffleMaskLegal(SDOperand Mask, MVT VT) const { return true; } @@ -271,7 +275,7 @@ public: /// VECTOR_SHUFFLE that can be used to replace a VAND with a constant /// pool entry. virtual bool isVectorClearMaskLegal(const std::vector<SDOperand> &BVOps, - MVT::ValueType EVT, + MVT EVT, SelectionDAG &DAG) const { return false; } @@ -280,16 +284,17 @@ public: /// it is legal, needs to be promoted to a larger size, needs to be /// expanded to some other code sequence, or the target has a custom expander /// for it. - LegalizeAction getOperationAction(unsigned Op, MVT::ValueType VT) const { - if (MVT::isExtendedVT(VT)) return Expand; + LegalizeAction getOperationAction(unsigned Op, MVT VT) const { + if (VT.isExtended()) return Expand; assert(Op < array_lengthof(OpActions) && - VT < sizeof(OpActions[0])*4 && "Table isn't big enough!"); - return (LegalizeAction)((OpActions[Op] >> (2*VT)) & 3); + (unsigned)VT.getSimpleVT() < sizeof(OpActions[0])*4 && + "Table isn't big enough!"); + return (LegalizeAction)((OpActions[Op] >> (2*VT.getSimpleVT())) & 3); } /// isOperationLegal - Return true if the specified operation is legal on this /// target. - bool isOperationLegal(unsigned Op, MVT::ValueType VT) const { + bool isOperationLegal(unsigned Op, MVT VT) const { return getOperationAction(Op, VT) == Legal || getOperationAction(Op, VT) == Custom; } @@ -298,16 +303,17 @@ public: /// either it is legal, needs to be promoted to a larger size, needs to be /// expanded to some other code sequence, or the target has a custom expander /// for it. - LegalizeAction getLoadXAction(unsigned LType, MVT::ValueType VT) const { + LegalizeAction getLoadXAction(unsigned LType, MVT VT) const { assert(LType < array_lengthof(LoadXActions) && - VT < sizeof(LoadXActions[0])*4 && "Table isn't big enough!"); - return (LegalizeAction)((LoadXActions[LType] >> (2*VT)) & 3); + (unsigned)VT.getSimpleVT() < sizeof(LoadXActions[0])*4 && + "Table isn't big enough!"); + return (LegalizeAction)((LoadXActions[LType] >> (2*VT.getSimpleVT())) & 3); } /// isLoadXLegal - Return true if the specified load with extension is legal /// on this target. - bool isLoadXLegal(unsigned LType, MVT::ValueType VT) const { - return !MVT::isExtendedVT(VT) && + bool isLoadXLegal(unsigned LType, MVT VT) const { + return VT.isSimple() && (getLoadXAction(LType, VT) == Legal || getLoadXAction(LType, VT) == Custom); } @@ -316,17 +322,19 @@ public: /// treated: either it is legal, needs to be promoted to a larger size, needs /// to be expanded to some other code sequence, or the target has a custom /// expander for it. - LegalizeAction getTruncStoreAction(MVT::ValueType ValVT, - MVT::ValueType MemVT) const { - assert(ValVT < array_lengthof(TruncStoreActions) && - MemVT < sizeof(TruncStoreActions[0])*4 && "Table isn't big enough!"); - return (LegalizeAction)((TruncStoreActions[ValVT] >> (2*MemVT)) & 3); + LegalizeAction getTruncStoreAction(MVT ValVT, + MVT MemVT) const { + assert((unsigned)ValVT.getSimpleVT() < array_lengthof(TruncStoreActions) && + (unsigned)MemVT.getSimpleVT() < sizeof(TruncStoreActions[0])*4 && + "Table isn't big enough!"); + return (LegalizeAction)((TruncStoreActions[ValVT.getSimpleVT()] >> + (2*MemVT.getSimpleVT())) & 3); } /// isTruncStoreLegal - Return true if the specified store with truncation is /// legal on this target. - bool isTruncStoreLegal(MVT::ValueType ValVT, MVT::ValueType MemVT) const { - return !MVT::isExtendedVT(MemVT) && + bool isTruncStoreLegal(MVT ValVT, MVT MemVT) const { + return MemVT.isSimple() && (getTruncStoreAction(ValVT, MemVT) == Legal || getTruncStoreAction(ValVT, MemVT) == Custom); } @@ -336,16 +344,17 @@ public: /// expanded to some other code sequence, or the target has a custom expander /// for it. LegalizeAction - getIndexedLoadAction(unsigned IdxMode, MVT::ValueType VT) const { + getIndexedLoadAction(unsigned IdxMode, MVT VT) const { assert(IdxMode < array_lengthof(IndexedModeActions[0]) && - VT < sizeof(IndexedModeActions[0][0])*4 && + (unsigned)VT.getSimpleVT() < sizeof(IndexedModeActions[0][0])*4 && "Table isn't big enough!"); - return (LegalizeAction)((IndexedModeActions[0][IdxMode] >> (2*VT)) & 3); + return (LegalizeAction)((IndexedModeActions[0][IdxMode] >> + (2*VT.getSimpleVT())) & 3); } /// isIndexedLoadLegal - Return true if the specified indexed load is legal /// on this target. - bool isIndexedLoadLegal(unsigned IdxMode, MVT::ValueType VT) const { + bool isIndexedLoadLegal(unsigned IdxMode, MVT VT) const { return getIndexedLoadAction(IdxMode, VT) == Legal || getIndexedLoadAction(IdxMode, VT) == Custom; } @@ -355,16 +364,17 @@ public: /// expanded to some other code sequence, or the target has a custom expander /// for it. LegalizeAction - getIndexedStoreAction(unsigned IdxMode, MVT::ValueType VT) const { + getIndexedStoreAction(unsigned IdxMode, MVT VT) const { assert(IdxMode < array_lengthof(IndexedModeActions[1]) && - VT < sizeof(IndexedModeActions[1][0])*4 && + (unsigned)VT.getSimpleVT() < sizeof(IndexedModeActions[1][0])*4 && "Table isn't big enough!"); - return (LegalizeAction)((IndexedModeActions[1][IdxMode] >> (2*VT)) & 3); + return (LegalizeAction)((IndexedModeActions[1][IdxMode] >> + (2*VT.getSimpleVT())) & 3); } /// isIndexedStoreLegal - Return true if the specified indexed load is legal /// on this target. - bool isIndexedStoreLegal(unsigned IdxMode, MVT::ValueType VT) const { + bool isIndexedStoreLegal(unsigned IdxMode, MVT VT) const { return getIndexedStoreAction(IdxMode, VT) == Legal || getIndexedStoreAction(IdxMode, VT) == Custom; } @@ -374,50 +384,52 @@ public: /// expanded to some other code sequence, or the target has a custom expander /// for it. LegalizeAction - getConvertAction(MVT::ValueType FromVT, MVT::ValueType ToVT) const { - assert(FromVT < array_lengthof(ConvertActions) && - ToVT < sizeof(ConvertActions[0])*4 && "Table isn't big enough!"); - return (LegalizeAction)((ConvertActions[FromVT] >> (2*ToVT)) & 3); + getConvertAction(MVT FromVT, MVT ToVT) const { + assert((unsigned)FromVT.getSimpleVT() < array_lengthof(ConvertActions) && + (unsigned)ToVT.getSimpleVT() < sizeof(ConvertActions[0])*4 && + "Table isn't big enough!"); + return (LegalizeAction)((ConvertActions[FromVT.getSimpleVT()] >> + (2*ToVT.getSimpleVT())) & 3); } /// isConvertLegal - Return true if the specified conversion is legal /// on this target. - bool isConvertLegal(MVT::ValueType FromVT, MVT::ValueType ToVT) const { + bool isConvertLegal(MVT FromVT, MVT ToVT) const { return getConvertAction(FromVT, ToVT) == Legal || getConvertAction(FromVT, ToVT) == Custom; } /// getTypeToPromoteTo - If the action for this operation is to promote, this /// method returns the ValueType to promote to. - MVT::ValueType getTypeToPromoteTo(unsigned Op, MVT::ValueType VT) const { + MVT getTypeToPromoteTo(unsigned Op, MVT VT) const { assert(getOperationAction(Op, VT) == Promote && "This operation isn't promoted!"); // See if this has an explicit type specified. - std::map<std::pair<unsigned, MVT::ValueType>, - MVT::ValueType>::const_iterator PTTI = + std::map<std::pair<unsigned, MVT>, + MVT>::const_iterator PTTI = PromoteToType.find(std::make_pair(Op, VT)); if (PTTI != PromoteToType.end()) return PTTI->second; - - assert((MVT::isInteger(VT) || MVT::isFloatingPoint(VT)) && + + assert((VT.isInteger() || VT.isFloatingPoint()) && "Cannot autopromote this type, add it with AddPromotedToType."); - MVT::ValueType NVT = VT; + MVT NVT = VT; do { - NVT = (MVT::ValueType)(NVT+1); - assert(MVT::isInteger(NVT) == MVT::isInteger(VT) && NVT != MVT::isVoid && + NVT = (MVT::SimpleValueType)(NVT.getSimpleVT()+1); + assert(NVT.isInteger() == VT.isInteger() && NVT != MVT::isVoid && "Didn't find type to promote to!"); } while (!isTypeLegal(NVT) || getOperationAction(Op, NVT) == Promote); return NVT; } - /// getValueType - Return the MVT::ValueType corresponding to this LLVM type. + /// getValueType - Return the MVT corresponding to this LLVM type. /// This is fixed by the LLVM operations except for the pointer size. If /// AllowUnknown is true, this will return MVT::Other for types with no MVT /// counterpart (e.g. structs), otherwise it will assert. - MVT::ValueType getValueType(const Type *Ty, bool AllowUnknown = false) const { - MVT::ValueType VT = MVT::getValueType(Ty, AllowUnknown); + MVT getValueType(const Type *Ty, bool AllowUnknown = false) const { + MVT VT = MVT::getMVT(Ty, AllowUnknown); return VT == MVT::iPTR ? PointerTy : VT; } @@ -428,22 +440,22 @@ public: /// getRegisterType - Return the type of registers that this ValueType will /// eventually require. - MVT::ValueType getRegisterType(MVT::ValueType VT) const { - if (!MVT::isExtendedVT(VT)) { - assert(VT < array_lengthof(RegisterTypeForVT)); - return RegisterTypeForVT[VT]; + MVT getRegisterType(MVT VT) const { + if (VT.isSimple()) { + assert((unsigned)VT.getSimpleVT() < array_lengthof(RegisterTypeForVT)); + return RegisterTypeForVT[VT.getSimpleVT()]; } - if (MVT::isVector(VT)) { - MVT::ValueType VT1, RegisterVT; + if (VT.isVector()) { + MVT VT1, RegisterVT; unsigned NumIntermediates; (void)getVectorTypeBreakdown(VT, VT1, NumIntermediates, RegisterVT); return RegisterVT; } - if (MVT::isInteger(VT)) { + if (VT.isInteger()) { return getRegisterType(getTypeToTransformTo(VT)); } assert(0 && "Unsupported extended type!"); - return MVT::ValueType(); // Not reached + return MVT(); // Not reached } /// getNumRegisters - Return the number of registers that this ValueType will @@ -452,19 +464,19 @@ public: /// into pieces. For types like i140, which are first promoted then expanded, /// it is the number of registers needed to hold all the bits of the original /// type. For an i140 on a 32 bit machine this means 5 registers. - unsigned getNumRegisters(MVT::ValueType VT) const { - if (!MVT::isExtendedVT(VT)) { - assert(VT < array_lengthof(NumRegistersForVT)); - return NumRegistersForVT[VT]; + unsigned getNumRegisters(MVT VT) const { + if (VT.isSimple()) { + assert((unsigned)VT.getSimpleVT() < array_lengthof(NumRegistersForVT)); + return NumRegistersForVT[VT.getSimpleVT()]; } - if (MVT::isVector(VT)) { - MVT::ValueType VT1, VT2; + if (VT.isVector()) { + MVT VT1, VT2; unsigned NumIntermediates; return getVectorTypeBreakdown(VT, VT1, NumIntermediates, VT2); } - if (MVT::isInteger(VT)) { - unsigned BitWidth = MVT::getSizeInBits(VT); - unsigned RegWidth = MVT::getSizeInBits(getRegisterType(VT)); + if (VT.isInteger()) { + unsigned BitWidth = VT.getSizeInBits(); + unsigned RegWidth = getRegisterType(VT).getSizeInBits(); return (BitWidth + RegWidth - 1) / RegWidth; } assert(0 && "Unsupported extended type!"); @@ -474,7 +486,7 @@ public: /// ShouldShrinkFPConstant - If true, then instruction selection should /// seek to shrink the FP constant of the specified type to a smaller type /// in order to save space and / or reduce runtime. - virtual bool ShouldShrinkFPConstant(MVT::ValueType VT) const { return true; } + virtual bool ShouldShrinkFPConstant(MVT VT) const { return true; } /// hasTargetDAGCombine - If true, the target has custom DAG combine /// transformations that it can perform for the specified node. @@ -515,8 +527,8 @@ public: /// and store operations as a result of memset, memcpy, and memmove lowering. /// It returns MVT::iAny if SelectionDAG should be responsible for /// determining it. - virtual MVT::ValueType getOptimalMemOpType(uint64_t Size, unsigned Align, - bool isSrcConst, bool isSrcStr) const { + virtual MVT getOptimalMemOpType(uint64_t Size, unsigned Align, + bool isSrcConst, bool isSrcStr) const { return MVT::iAny; } @@ -687,7 +699,7 @@ public: /// SimplifySetCC - Try to simplify a setcc built with the specified operands /// and cc. If it is unable to simplify it, return a null SDOperand. - SDOperand SimplifySetCC(MVT::ValueType VT, SDOperand N0, SDOperand N1, + SDOperand SimplifySetCC(MVT VT, SDOperand N0, SDOperand N1, ISD::CondCode Cond, bool foldBooleans, DAGCombinerInfo &DCI) const; @@ -729,7 +741,7 @@ protected: /// setShiftAmountType - Describe the type that should be used for shift /// amounts. This type defaults to the pointer type. - void setShiftAmountType(MVT::ValueType VT) { ShiftAmountTy = VT; } + void setShiftAmountType(MVT VT) { ShiftAmountTy = VT; } /// setSetCCResultContents - Specify how the target extends the result of a /// setcc operation in a register. @@ -798,10 +810,10 @@ protected: /// addRegisterClass - Add the specified register class as an available /// regclass for the specified value type. This indicates the selector can /// handle values of that class natively. - void addRegisterClass(MVT::ValueType VT, TargetRegisterClass *RC) { - assert(VT < array_lengthof(RegClassForVT)); + void addRegisterClass(MVT VT, TargetRegisterClass *RC) { + assert((unsigned)VT.getSimpleVT() < array_lengthof(RegClassForVT)); AvailableRegClasses.push_back(std::make_pair(VT, RC)); - RegClassForVT[VT] = RC; + RegClassForVT[VT.getSimpleVT()] = RC; } /// computeRegisterProperties - Once all of the register classes are added, @@ -810,77 +822,82 @@ protected: /// setOperationAction - Indicate that the specified operation does not work /// with the specified type and indicate what to do about it. - void setOperationAction(unsigned Op, MVT::ValueType VT, + void setOperationAction(unsigned Op, MVT VT, LegalizeAction Action) { - assert(VT < sizeof(OpActions[0])*4 && Op < array_lengthof(OpActions) && - "Table isn't big enough!"); - OpActions[Op] &= ~(uint64_t(3UL) << VT*2); - OpActions[Op] |= (uint64_t)Action << VT*2; + assert((unsigned)VT.getSimpleVT() < sizeof(OpActions[0])*4 && + Op < array_lengthof(OpActions) && "Table isn't big enough!"); + OpActions[Op] &= ~(uint64_t(3UL) << VT.getSimpleVT()*2); + OpActions[Op] |= (uint64_t)Action << VT.getSimpleVT()*2; } /// setLoadXAction - Indicate that the specified load with extension does not /// work with the with specified type and indicate what to do about it. - void setLoadXAction(unsigned ExtType, MVT::ValueType VT, + void setLoadXAction(unsigned ExtType, MVT VT, LegalizeAction Action) { - assert(VT < sizeof(LoadXActions[0])*4 && + assert((unsigned)VT.getSimpleVT() < sizeof(LoadXActions[0])*4 && ExtType < array_lengthof(LoadXActions) && "Table isn't big enough!"); - LoadXActions[ExtType] &= ~(uint64_t(3UL) << VT*2); - LoadXActions[ExtType] |= (uint64_t)Action << VT*2; + LoadXActions[ExtType] &= ~(uint64_t(3UL) << VT.getSimpleVT()*2); + LoadXActions[ExtType] |= (uint64_t)Action << VT.getSimpleVT()*2; } /// setTruncStoreAction - Indicate that the specified truncating store does /// not work with the with specified type and indicate what to do about it. - void setTruncStoreAction(MVT::ValueType ValVT, MVT::ValueType MemVT, + void setTruncStoreAction(MVT ValVT, MVT MemVT, LegalizeAction Action) { - assert(ValVT < array_lengthof(TruncStoreActions) && - MemVT < sizeof(TruncStoreActions[0])*4 && "Table isn't big enough!"); - TruncStoreActions[ValVT] &= ~(uint64_t(3UL) << MemVT*2); - TruncStoreActions[ValVT] |= (uint64_t)Action << MemVT*2; + assert((unsigned)ValVT.getSimpleVT() < array_lengthof(TruncStoreActions) && + (unsigned)MemVT.getSimpleVT() < sizeof(TruncStoreActions[0])*4 && + "Table isn't big enough!"); + TruncStoreActions[ValVT.getSimpleVT()] &= ~(uint64_t(3UL) << + MemVT.getSimpleVT()*2); + TruncStoreActions[ValVT.getSimpleVT()] |= (uint64_t)Action << + MemVT.getSimpleVT()*2; } /// setIndexedLoadAction - Indicate that the specified indexed load does or /// does not work with the with specified type and indicate what to do abort /// it. NOTE: All indexed mode loads are initialized to Expand in /// TargetLowering.cpp - void setIndexedLoadAction(unsigned IdxMode, MVT::ValueType VT, + void setIndexedLoadAction(unsigned IdxMode, MVT VT, LegalizeAction Action) { - assert(VT < sizeof(IndexedModeActions[0])*4 && IdxMode < - array_lengthof(IndexedModeActions[0]) && + assert((unsigned)VT.getSimpleVT() < sizeof(IndexedModeActions[0])*4 && + IdxMode < array_lengthof(IndexedModeActions[0]) && "Table isn't big enough!"); - IndexedModeActions[0][IdxMode] &= ~(uint64_t(3UL) << VT*2); - IndexedModeActions[0][IdxMode] |= (uint64_t)Action << VT*2; + IndexedModeActions[0][IdxMode] &= ~(uint64_t(3UL) << VT.getSimpleVT()*2); + IndexedModeActions[0][IdxMode] |= (uint64_t)Action << VT.getSimpleVT()*2; } /// setIndexedStoreAction - Indicate that the specified indexed store does or /// does not work with the with specified type and indicate what to do about /// it. NOTE: All indexed mode stores are initialized to Expand in /// TargetLowering.cpp - void setIndexedStoreAction(unsigned IdxMode, MVT::ValueType VT, + void setIndexedStoreAction(unsigned IdxMode, MVT VT, LegalizeAction Action) { - assert(VT < sizeof(IndexedModeActions[1][0])*4 && + assert((unsigned)VT.getSimpleVT() < sizeof(IndexedModeActions[1][0])*4 && IdxMode < array_lengthof(IndexedModeActions[1]) && "Table isn't big enough!"); - IndexedModeActions[1][IdxMode] &= ~(uint64_t(3UL) << VT*2); - IndexedModeActions[1][IdxMode] |= (uint64_t)Action << VT*2; + IndexedModeActions[1][IdxMode] &= ~(uint64_t(3UL) << VT.getSimpleVT()*2); + IndexedModeActions[1][IdxMode] |= (uint64_t)Action << VT.getSimpleVT()*2; } /// setConvertAction - Indicate that the specified conversion does or does /// not work with the with specified type and indicate what to do about it. - void setConvertAction(MVT::ValueType FromVT, MVT::ValueType ToVT, + void setConvertAction(MVT FromVT, MVT ToVT, LegalizeAction Action) { - assert(FromVT < array_lengthof(ConvertActions) && - ToVT < sizeof(ConvertActions[0])*4 && "Table isn't big enough!"); - ConvertActions[FromVT] &= ~(uint64_t(3UL) << ToVT*2); - ConvertActions[FromVT] |= (uint64_t)Action << ToVT*2; + assert((unsigned)FromVT.getSimpleVT() < array_lengthof(ConvertActions) && + (unsigned)ToVT.getSimpleVT() < sizeof(ConvertActions[0])*4 && + "Table isn't big enough!"); + ConvertActions[FromVT.getSimpleVT()] &= ~(uint64_t(3UL) << + ToVT.getSimpleVT()*2); + ConvertActions[FromVT.getSimpleVT()] |= (uint64_t)Action << + ToVT.getSimpleVT()*2; } /// AddPromotedToType - If Opc/OrigVT is specified as being promoted, the /// promotion code defaults to trying a larger integer/fp until it can find /// one that works. If that default is insufficient, this method can be used /// by the target to override the default. - void AddPromotedToType(unsigned Opc, MVT::ValueType OrigVT, - MVT::ValueType DestVT) { + void AddPromotedToType(unsigned Opc, MVT OrigVT, MVT DestVT) { PromoteToType[std::make_pair(Opc, OrigVT)] = DestVT; } @@ -1121,7 +1138,7 @@ public: Value *CallOperandVal; /// ConstraintVT - The ValueType for the operand value. - MVT::ValueType ConstraintVT; + MVT ConstraintVT; AsmOperandInfo(const InlineAsm::ConstraintInfo &info) : InlineAsm::ConstraintInfo(info), @@ -1148,7 +1165,7 @@ public: /// This should only be used for C_RegisterClass constraints. virtual std::vector<unsigned> getRegClassForInlineAsmConstraint(const std::string &Constraint, - MVT::ValueType VT) const; + MVT VT) const; /// getRegForInlineAsmConstraint - Given a physical register constraint (e.g. /// {edx}), return the register number and the register class for the @@ -1162,13 +1179,13 @@ public: /// this returns a register number of 0 and a null register class pointer.. virtual std::pair<unsigned, const TargetRegisterClass*> getRegForInlineAsmConstraint(const std::string &Constraint, - MVT::ValueType VT) const; + MVT VT) const; /// LowerXConstraint - try to replace an X constraint, which matches anything, /// with another that has more specific requirements based on the type of the /// corresponding operand. This returns null if there is no replacement to /// make. - virtual const char *LowerXConstraint(MVT::ValueType ConstraintVT) const; + virtual const char *LowerXConstraint(MVT ConstraintVT) const; /// LowerAsmOperandForConstraint - Lower the specified operand into the Ops /// vector. If it is invalid, don't add anything to Ops. @@ -1220,7 +1237,7 @@ public: return false; } - virtual bool isTruncateFree(MVT::ValueType VT1, MVT::ValueType VT2) const { + virtual bool isTruncateFree(MVT VT1, MVT VT2) const { return false; } @@ -1271,7 +1288,7 @@ private: /// PointerTy - The type to use for pointers, usually i32 or i64. /// - MVT::ValueType PointerTy; + MVT PointerTy; /// UsesGlobalOffsetTable - True if this target uses a GOT for PIC codegen. /// @@ -1279,7 +1296,7 @@ private: /// ShiftAmountTy - The type to use for shift amounts, usually i8 or whatever /// PointerTy is. - MVT::ValueType ShiftAmountTy; + MVT ShiftAmountTy; OutOfRangeShiftAmount ShiftAmtHandling; @@ -1352,14 +1369,14 @@ private: /// each ValueType the target supports natively. TargetRegisterClass *RegClassForVT[MVT::LAST_VALUETYPE]; unsigned char NumRegistersForVT[MVT::LAST_VALUETYPE]; - MVT::ValueType RegisterTypeForVT[MVT::LAST_VALUETYPE]; + MVT RegisterTypeForVT[MVT::LAST_VALUETYPE]; /// TransformToType - For any value types we are promoting or expanding, this /// contains the value type that we are changing to. For Expanded types, this /// contains one step of the expand (e.g. i64 -> i32), even if there are /// multiple steps required (e.g. i64 -> i16). For types natively supported /// by the system, this holds the same type (e.g. i32 -> i32). - MVT::ValueType TransformToType[MVT::LAST_VALUETYPE]; + MVT TransformToType[MVT::LAST_VALUETYPE]; // Defines the capacity of the TargetLowering::OpActions table static const int OpActionsCapacity = 176; @@ -1396,8 +1413,7 @@ private: std::vector<APFloat> LegalFPImmediates; - std::vector<std::pair<MVT::ValueType, - TargetRegisterClass*> > AvailableRegClasses; + std::vector<std::pair<MVT, TargetRegisterClass*> > AvailableRegClasses; /// TargetDAGCombineArray - Targets can specify ISD nodes that they would /// like PerformDAGCombine callbacks for by calling setTargetDAGCombine(), @@ -1411,7 +1427,7 @@ private: /// /// Targets add entries to this map with AddPromotedToType(..), clients access /// this with getTypeToPromoteTo(..). - std::map<std::pair<unsigned, MVT::ValueType>, MVT::ValueType> PromoteToType; + std::map<std::pair<unsigned, MVT>, MVT> PromoteToType; /// LibcallRoutineNames - Stores the name each libcall. /// diff --git a/include/llvm/Target/TargetRegisterInfo.h b/include/llvm/Target/TargetRegisterInfo.h index f606c88..08b9bfc 100644 --- a/include/llvm/Target/TargetRegisterInfo.h +++ b/include/llvm/Target/TargetRegisterInfo.h @@ -61,7 +61,7 @@ public: typedef const unsigned* iterator; typedef const unsigned* const_iterator; - typedef const MVT::ValueType* vt_iterator; + typedef const MVT* vt_iterator; typedef const TargetRegisterClass* const * sc_iterator; private: unsigned ID; @@ -76,7 +76,7 @@ private: const iterator RegsBegin, RegsEnd; public: TargetRegisterClass(unsigned id, - const MVT::ValueType *vts, + const MVT *vts, const TargetRegisterClass * const *subcs, const TargetRegisterClass * const *supcs, const TargetRegisterClass * const *subregcs, @@ -118,7 +118,7 @@ public: /// hasType - return true if this TargetRegisterClass has the ValueType vt. /// - bool hasType(MVT::ValueType vt) const { + bool hasType(MVT vt) const { for(int i = 0; VTs[i] != MVT::Other; ++i) if (VTs[i] == vt) return true; @@ -324,7 +324,7 @@ public: /// register of the given type. If type is MVT::Other, then just return any /// register class the register belongs to. const TargetRegisterClass *getPhysicalRegisterRegClass(unsigned Reg, - MVT::ValueType VT = MVT::Other) const; + MVT VT = MVT::Other) const; /// getAllocatableSet - Returns a bitset indexed by register number /// indicating if a register is allocatable or not. If a register class is |