diff options
author | rdivacky <rdivacky@FreeBSD.org> | 2010-04-02 08:54:30 +0000 |
---|---|---|
committer | rdivacky <rdivacky@FreeBSD.org> | 2010-04-02 08:54:30 +0000 |
commit | 20e856b2a58d12231aa42d5d13888b15ac03e5a4 (patch) | |
tree | cf5763d092b81cecc168fa28032247ee495d06e2 /include/llvm/Target | |
parent | 2f2afc1aae898651e26987a5c71f3febb19bca98 (diff) | |
download | FreeBSD-src-20e856b2a58d12231aa42d5d13888b15ac03e5a4.zip FreeBSD-src-20e856b2a58d12231aa42d5d13888b15ac03e5a4.tar.gz |
Update LLVM to r100181.
Diffstat (limited to 'include/llvm/Target')
-rw-r--r-- | include/llvm/Target/TargetAsmBackend.h | 25 | ||||
-rw-r--r-- | include/llvm/Target/TargetInstrDesc.h | 19 | ||||
-rw-r--r-- | include/llvm/Target/TargetLowering.h | 64 | ||||
-rw-r--r-- | include/llvm/Target/TargetMachine.h | 6 | ||||
-rw-r--r-- | include/llvm/Target/TargetSelectionDAG.td | 16 |
5 files changed, 68 insertions, 62 deletions
diff --git a/include/llvm/Target/TargetAsmBackend.h b/include/llvm/Target/TargetAsmBackend.h index bb501cc..f350ecc 100644 --- a/include/llvm/Target/TargetAsmBackend.h +++ b/include/llvm/Target/TargetAsmBackend.h @@ -15,8 +15,12 @@ namespace llvm { class MCAsmFixup; class MCDataFragment; +class MCInst; +class MCInstFragment; class MCObjectWriter; class MCSection; +template<typename T> +class SmallVectorImpl; class Target; class raw_ostream; @@ -95,6 +99,27 @@ public: /// fixup kind as appropriate. virtual void ApplyFixup(const MCAsmFixup &Fixup, MCDataFragment &Fragment, uint64_t Value) const = 0; + + /// MayNeedRelaxation - Check whether the given instruction may need + /// relaxation. + /// + /// \arg Inst - The instruction to test. + /// \arg Fixups - The actual fixups this instruction encoded to, for potential + /// use by the target backend. + virtual bool MayNeedRelaxation(const MCInst &Inst, + const SmallVectorImpl<MCAsmFixup> &Fixups) const = 0; + + /// RelaxInstruction - Relax the instruction in the given fragment to the next + /// wider instruction. + virtual void RelaxInstruction(const MCInstFragment *IF, + MCInst &Res) const = 0; + + /// WriteNopData - Write an (optimal) nop sequence of Count bytes to the given + /// output. If the target cannot generate such a sequence, it should return an + /// error. + /// + /// \return - True on success. + virtual bool WriteNopData(uint64_t Count, MCObjectWriter *OW) const = 0; }; } // End llvm namespace diff --git a/include/llvm/Target/TargetInstrDesc.h b/include/llvm/Target/TargetInstrDesc.h index 9efb683..adc37e1 100644 --- a/include/llvm/Target/TargetInstrDesc.h +++ b/include/llvm/Target/TargetInstrDesc.h @@ -204,6 +204,16 @@ public: return ImplicitUses; } + /// getNumImplicitUses - Return the number of implicit uses this instruction + /// has. + unsigned getNumImplicitUses() const { + if (ImplicitUses == 0) return 0; + unsigned i = 0; + for (; ImplicitUses[i]; ++i) /*empty*/; + return i; + } + + /// getImplicitDefs - Return a list of registers that are potentially /// written by any instance of this machine instruction. For example, on X86, /// many instructions implicitly set the flags register. In this case, they @@ -218,6 +228,15 @@ public: return ImplicitDefs; } + /// getNumImplicitDefs - Return the number of implicit defs this instruction + /// has. + unsigned getNumImplicitDefs() const { + if (ImplicitDefs == 0) return 0; + unsigned i = 0; + for (; ImplicitDefs[i]; ++i) /*empty*/; + return i; + } + /// hasImplicitUseOfPhysReg - Return true if this instruction implicitly /// uses the specified physical register. bool hasImplicitUseOfPhysReg(unsigned Reg) const { diff --git a/include/llvm/Target/TargetLowering.h b/include/llvm/Target/TargetLowering.h index da0f686..b0534dd 100644 --- a/include/llvm/Target/TargetLowering.h +++ b/include/llvm/Target/TargetLowering.h @@ -469,29 +469,6 @@ public: getIndexedStoreAction(IdxMode, VT) == Custom); } - /// getConvertAction - Return how the conversion should be 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 - getConvertAction(EVT FromVT, EVT ToVT) const { - assert((unsigned)FromVT.getSimpleVT().SimpleTy < - array_lengthof(ConvertActions) && - (unsigned)ToVT.getSimpleVT().SimpleTy < - sizeof(ConvertActions[0])*4 && - "Table isn't big enough!"); - return (LegalizeAction)((ConvertActions[FromVT.getSimpleVT().SimpleTy] >> - (2*ToVT.getSimpleVT().SimpleTy)) & 3); - } - - /// isConvertLegal - Return true if the specified conversion is legal - /// on this target. - bool isConvertLegal(EVT FromVT, EVT ToVT) const { - return isTypeLegal(FromVT) && isTypeLegal(ToVT) && - (getConvertAction(FromVT, ToVT) == Legal || - getConvertAction(FromVT, ToVT) == Custom); - } - /// getCondCodeAction - Return how the condition code should be treated: /// either it is legal, needs to be expanded to some other code sequence, /// or the target has a custom expander for it. @@ -545,7 +522,7 @@ public: /// counterpart (e.g. structs), otherwise it will assert. EVT getValueType(const Type *Ty, bool AllowUnknown = false) const { EVT VT = EVT::getEVT(Ty, AllowUnknown); - return VT == MVT:: iPTR ? PointerTy : VT; + return VT == MVT::iPTR ? PointerTy : VT; } /// getByValTypeAlignment - Return the desired alignment for ByVal aggregate @@ -657,11 +634,14 @@ public: /// getOptimalMemOpType - Returns the target specific optimal type for load /// and store operations as a result of memset, memcpy, and memmove lowering. - /// It returns EVT::Other if SelectionDAG should be responsible for - /// determining it. - virtual EVT getOptimalMemOpType(uint64_t Size, unsigned Align, - bool isSrcConst, bool isSrcStr, - SelectionDAG &DAG) const { + /// If DstAlign is zero that means it's safe to destination alignment can + /// satisfy any constraint. Similarly if SrcAlign is zero it means there isn't + /// a need to check it against alignment requirement, probably because the + /// source does not need to be loaded. It returns EVT::Other if SelectionDAG + /// should be responsible for determining it. + virtual EVT getOptimalMemOpType(uint64_t Size, + unsigned DstAlign, unsigned SrcAlign, + bool SafeToUseFP, SelectionDAG &DAG) const { return MVT::Other; } @@ -990,7 +970,7 @@ protected: } /// setLoadExtAction - Indicate that the specified load with extension does - /// not work with the with specified type and indicate what to do about it. + /// not work with the specified type and indicate what to do about it. void setLoadExtAction(unsigned ExtType, MVT VT, LegalizeAction Action) { assert((unsigned)VT.SimpleTy*2 < 63 && @@ -1001,7 +981,7 @@ protected: } /// setTruncStoreAction - Indicate that the specified truncating store does - /// not work with the with specified type and indicate what to do about it. + /// not work with the specified type and indicate what to do about it. void setTruncStoreAction(MVT ValVT, MVT MemVT, LegalizeAction Action) { assert((unsigned)ValVT.SimpleTy < array_lengthof(TruncStoreActions) && @@ -1012,7 +992,7 @@ protected: } /// setIndexedLoadAction - Indicate that the specified indexed load does or - /// does not work with the with specified type and indicate what to do abort + /// does not work with the 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 VT, @@ -1024,7 +1004,7 @@ protected: } /// setIndexedStoreAction - Indicate that the specified indexed store does or - /// does not work with the with specified type and indicate what to do about + /// does not work with the 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 VT, @@ -1035,17 +1015,6 @@ protected: IndexedModeActions[(unsigned)VT.SimpleTy][1][IdxMode] = (uint8_t)Action; } - /// 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 FromVT, MVT ToVT, - LegalizeAction Action) { - assert((unsigned)FromVT.SimpleTy < array_lengthof(ConvertActions) && - (unsigned)ToVT.SimpleTy < MVT::LAST_VALUETYPE && - "Table isn't big enough!"); - ConvertActions[FromVT.SimpleTy] &= ~(uint64_t(3UL) << ToVT.SimpleTy*2); - ConvertActions[FromVT.SimpleTy] |= (uint64_t)Action << ToVT.SimpleTy*2; - } - /// setCondCodeAction - Indicate that the specified condition code is or isn't /// supported on the target and indicate what to do about it. void setCondCodeAction(ISD::CondCode CC, MVT VT, @@ -1674,13 +1643,6 @@ private: /// represents the various modes for load store. uint8_t IndexedModeActions[MVT::LAST_VALUETYPE][2][ISD::LAST_INDEXED_MODE]; - /// ConvertActions - For each conversion from source type to destination type, - /// keep a LegalizeAction that indicates how instruction selection should - /// deal with the conversion. - /// Currently, this is used only for floating->floating conversions - /// (FP_EXTEND and FP_ROUND). - uint64_t ConvertActions[MVT::LAST_VALUETYPE]; - /// CondCodeActions - For each condition code (ISD::CondCode) keep a /// LegalizeAction that indicates how instruction selection should /// deal with the condition code. diff --git a/include/llvm/Target/TargetMachine.h b/include/llvm/Target/TargetMachine.h index b239a30..d1d665f 100644 --- a/include/llvm/Target/TargetMachine.h +++ b/include/llvm/Target/TargetMachine.h @@ -192,7 +192,7 @@ public: formatted_raw_ostream &, CodeGenFileType, CodeGenOpt::Level, - bool DisableVerify = true) { + bool = true) { return true; } @@ -205,7 +205,7 @@ public: virtual bool addPassesToEmitMachineCode(PassManagerBase &, JITCodeEmitter &, CodeGenOpt::Level, - bool DisableVerify = true) { + bool = true) { return true; } @@ -216,7 +216,7 @@ public: virtual bool addPassesToEmitWholeFile(PassManager &, formatted_raw_ostream &, CodeGenFileType, CodeGenOpt::Level, - bool DisableVerify = true) { + bool = true) { return true; } }; diff --git a/include/llvm/Target/TargetSelectionDAG.td b/include/llvm/Target/TargetSelectionDAG.td index e56d886..58ccfba 100644 --- a/include/llvm/Target/TargetSelectionDAG.td +++ b/include/llvm/Target/TargetSelectionDAG.td @@ -92,6 +92,10 @@ def SDTIntBinOp : SDTypeProfile<1, 2, [ // add, and, or, xor, udiv, etc. def SDTIntShiftOp : SDTypeProfile<1, 2, [ // shl, sra, srl SDTCisSameAs<0, 1>, SDTCisInt<0>, SDTCisInt<2> ]>; +def SDTIntBinHiLoOp : SDTypeProfile<2, 2, [ // mulhi, mullo, sdivrem, udivrem + SDTCisSameAs<0, 1>, SDTCisSameAs<0, 2>, SDTCisSameAs<0, 3>,SDTCisInt<0> +]>; + def SDTFPBinOp : SDTypeProfile<1, 2, [ // fadd, fmul, etc. SDTCisSameAs<0, 1>, SDTCisSameAs<0, 2>, SDTCisFP<0> ]>; @@ -235,7 +239,6 @@ class SDNode<string opcode, SDTypeProfile typeprof, // Special TableGen-recognized dag nodes def set; def implicit; -def parallel; def node; def srcvalue; @@ -282,10 +285,14 @@ def mul : SDNode<"ISD::MUL" , SDTIntBinOp, [SDNPCommutative, SDNPAssociative]>; def mulhs : SDNode<"ISD::MULHS" , SDTIntBinOp, [SDNPCommutative]>; def mulhu : SDNode<"ISD::MULHU" , SDTIntBinOp, [SDNPCommutative]>; +def smullohi : SDNode<"ISD::SMUL_LOHI" , SDTIntBinHiLoOp, [SDNPCommutative]>; +def umullohi : SDNode<"ISD::UMUL_LOHI" , SDTIntBinHiLoOp, [SDNPCommutative]>; def sdiv : SDNode<"ISD::SDIV" , SDTIntBinOp>; def udiv : SDNode<"ISD::UDIV" , SDTIntBinOp>; def srem : SDNode<"ISD::SREM" , SDTIntBinOp>; def urem : SDNode<"ISD::UREM" , SDTIntBinOp>; +def sdivrem : SDNode<"ISD::SDIVREM" , SDTIntBinHiLoOp>; +def udivrem : SDNode<"ISD::UDIVREM" , SDTIntBinHiLoOp>; def srl : SDNode<"ISD::SRL" , SDTIntShiftOp>; def sra : SDNode<"ISD::SRA" , SDTIntShiftOp>; def shl : SDNode<"ISD::SHL" , SDTIntShiftOp>; @@ -485,22 +492,15 @@ def vtFP : PatLeaf<(vt), [{ return N->getVT().isFloatingPoint(); }]>; def immAllOnesV: PatLeaf<(build_vector), [{ return ISD::isBuildVectorAllOnes(N); }]>; -def immAllOnesV_bc: PatLeaf<(bitconvert), [{ - return ISD::isBuildVectorAllOnes(N); -}]>; def immAllZerosV: PatLeaf<(build_vector), [{ return ISD::isBuildVectorAllZeros(N); }]>; -def immAllZerosV_bc: PatLeaf<(bitconvert), [{ - return ISD::isBuildVectorAllZeros(N); -}]>; // Other helper fragments. def not : PatFrag<(ops node:$in), (xor node:$in, -1)>; def vnot : PatFrag<(ops node:$in), (xor node:$in, immAllOnesV)>; -def vnot_conv : PatFrag<(ops node:$in), (xor node:$in, immAllOnesV_bc)>; def ineg : PatFrag<(ops node:$in), (sub 0, node:$in)>; // load fragments. |