662 :
TM(tm),
TD(
TM.getDataLayout()), TLOF(*tlof) {
670 UseUnderscoreSetJmp =
false;
671 UseUnderscoreLongJmp =
false;
672 SelectIsExpensive =
false;
673 IntDivIsCheap =
false;
674 Pow2DivIsCheap =
false;
675 JumpIsExpensive =
false;
677 StackPointerRegisterToSaveRestore = 0;
678 ExceptionPointerRegister = 0;
679 ExceptionSelectorRegister = 0;
684 JumpBufAlignment = 0;
685 MinFunctionAlignment = 0;
686 PrefFunctionAlignment = 0;
687 PrefLoopAlignment = 0;
688 MinStackArgumentAlignment = 1;
689 InsertFencesForAtomic =
false;
690 SupportJumpTables =
true;
691 MinimumJumpTableEntries = 4;
704 memset(OpActions, 0,
sizeof(OpActions));
705 memset(LoadExtActions, 0,
sizeof(LoadExtActions));
706 memset(TruncStoreActions, 0,
sizeof(TruncStoreActions));
707 memset(IndexedModeActions, 0,
sizeof(IndexedModeActions));
708 memset(CondCodeActions, 0,
sizeof(CondCodeActions));
815 assert(LHSTy.
isInteger() &&
"Shift amount is not an integer type!");
840 unsigned &NumIntermediates,
847 unsigned NumVectorRegs = 1;
852 NumVectorRegs = NumElts;
863 NumIntermediates = NumVectorRegs;
868 IntermediateVT = NewVT;
878 if (
EVT(DestVT).bitsLT(NewVT))
883 return NumVectorRegs;
899 std::pair<const TargetRegisterClass*, uint8_t>
904 return std::make_pair(RC, 0);
913 for (
int i = SuperRegRC.find_first(); i >= 0; i = SuperRegRC.find_next(i)) {
922 return std::make_pair(BestRC, 1);
929 "Too many value types for ValueTypeActions to hold!");
933 NumRegistersForVT[i] = 1;
941 for (; RegClassForVT[LargestIntReg] == 0; --LargestIntReg)
942 assert(LargestIntReg !=
MVT::i1 &&
"No integer registers defined!");
946 for (
unsigned ExpandedReg = LargestIntReg + 1;
948 NumRegistersForVT[ExpandedReg] = 2*NumRegistersForVT[ExpandedReg-1];
957 unsigned LegalIntReg = LargestIntReg;
958 for (
unsigned IntReg = LargestIntReg - 1;
962 LegalIntReg = IntReg;
964 RegisterTypeForVT[IntReg] = TransformToType[IntReg] =
1023 bool IsLegalWiderType =
false;
1033 TransformToType[i] = SVT;
1034 RegisterTypeForVT[i] = SVT;
1035 NumRegistersForVT[i] = 1;
1037 IsLegalWiderType =
true;
1042 if (IsLegalWiderType)
continue;
1050 TransformToType[i] = SVT;
1051 RegisterTypeForVT[i] = SVT;
1052 NumRegistersForVT[i] = 1;
1054 IsLegalWiderType =
true;
1058 if (IsLegalWiderType)
continue;
1063 unsigned NumIntermediates;
1064 NumRegistersForVT[i] =
1067 RegisterTypeForVT[i] = RegisterVT;
1077 TransformToType[i] = NVT;
1091 RepRegClassForVT[i] =
RRC;
1092 RepRegClassCostForVT[i] = Cost;
1097 assert(!VT.
isVector() &&
"No default SetCC type for vectors!");
1115 EVT &IntermediateVT,
1116 unsigned &NumIntermediates,
1117 MVT &RegisterVT)
const {
1129 IntermediateVT = RegisterEVT;
1131 NumIntermediates = 1;
1139 unsigned NumVectorRegs = 1;
1144 NumVectorRegs = NumElts;
1153 NumVectorRegs <<= 1;
1156 NumIntermediates = NumVectorRegs;
1161 IntermediateVT = NewVT;
1164 RegisterVT = DestVT;
1171 if (
EVT(DestVT).bitsLT(NewVT))
1176 return NumVectorRegs;
1188 unsigned NumValues = ValueVTs.
size();
1189 if (NumValues == 0)
return;
1191 for (
unsigned j = 0, f = NumValues; j != f; ++j) {
1192 EVT VT = ValueVTs[j];
1224 for (
unsigned i = 0; i < NumParts; ++i)
1241 enum InstructionOpcodes {
1242 #define HANDLE_INST(NUM, OPCODE, CLASS) OPCODE = NUM,
1243 #define LAST_OTHER_INST(NUM) InstructionOpcodesCount = NUM
1244 #include "llvm/IR/Instruction.def"
1246 switch (static_cast<InstructionOpcodes>(Opcode)) {
1249 case Switch:
return 0;
1250 case IndirectBr:
return 0;
1251 case Invoke:
return 0;
1252 case Resume:
return 0;
1253 case Unreachable:
return 0;
1272 case Alloca:
return 0;
1275 case GetElementPtr:
return 0;
1276 case Fence:
return 0;
1277 case AtomicCmpXchg:
return 0;
1278 case AtomicRMW:
return 0;
1295 case Call:
return 0;
1297 case UserOp1:
return 0;
1298 case UserOp2:
return 0;
1299 case VAArg:
return 0;
1305 case LandingPad:
return 0;
1311 std::pair<unsigned, MVT>
static MVT getIntegerVT(unsigned BitWidth)
void push_back(const T &Elt)
vt_iterator vt_end() const
void ComputeValueVTs(const TargetLowering &TLI, Type *Ty, SmallVectorImpl< EVT > &ValueVTs, SmallVectorImpl< uint64_t > *Offsets=0, uint64_t StartingOffset=0)
static void InitLibcallCallingConvs(CallingConv::ID *CCs)
LegalizeTypeAction getTypeAction(LLVMContext &Context, EVT VT) const
Sign extended before/after call.
unsigned getNumRegisters(LLVMContext &Context, EVT VT) const
static MVT getVectorVT(MVT VT, unsigned NumElements)
Force argument to be passed in register.
virtual ~TargetLoweringBase()
const TargetMachine & getTargetMachine() const
Y = RRC X, rotate right via carry.
unsigned getPointerSize(unsigned AS=0) const
virtual std::pair< const TargetRegisterClass *, uint8_t > findRepresentativeClass(MVT VT) const
unsigned getSizeInBits() const
unsigned getPointerTypeSizeInBits(Type *Ty) const
unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
std::pair< LegalizeTypeAction, EVT > LegalizeKind
bool hasAttribute(unsigned Index, Attribute::AttrKind Kind) const
Return true if the attribute exists at the given index.
virtual MVT getScalarShiftAmountTy(EVT LHSTy) const
Libcall getFPROUND(EVT OpVT, EVT RetVT)
bool bitsLT(EVT VT) const
bitsLT - Return true if this has less bits than VT.
EVT getValueType(Type *Ty, bool AllowUnknown=false) const
Libcall getUINTTOFP(EVT OpVT, EVT RetVT)
unsigned getPointerSizeInBits(uint32_t AS=0) const
bool isVector() const
isVector - Return true if this is a vector value type.
EVT getShiftAmountTy(EVT LHSTy) const
virtual bool canOpTrap(unsigned Op, EVT VT) const
unsigned getNumRegClasses() const
#define llvm_unreachable(msg)
const TargetRegisterClass * getRegClass(unsigned i) const
virtual EVT getSetCCResultType(LLVMContext &Context, EVT VT) const
MVT getScalarType() const
void setOperationAction(unsigned Op, MVT VT, LegalizeAction Action)
virtual MVT getPointerTy(uint32_t=0) const
static ConstantInt * ExtractElement(Constant *V, Constant *Idx)
ID
LLVM Calling Convention Representation.
bool isInteger() const
isInteger - Return true if this is an integer, or a vector integer type.
int InstructionOpcodeToISD(unsigned Opcode) const
Get the ISD node that corresponds to the Instruction class opcode.
EVT getVectorElementType() const
LLVMContext & getContext() const
getContext - Return the LLVMContext in which this type was uniqued.
size_t array_lengthof(T(&)[N])
Find the length of an array.
Simple integer binary arithmetic operators.
bool isLittleEndian() const
Layout endianness...
bool isLegalRC(const TargetRegisterClass *RC) const
void GetReturnInfo(Type *ReturnType, AttributeSet attr, SmallVectorImpl< ISD::OutputArg > &Outs, const TargetLowering &TLI)
bool isTypeLegal(EVT VT) const
static void InitCmpLibcallCCs(ISD::CondCode *CCs)
bool isInteger() const
isInteger - Return true if this is an integer, or a vector integer type.
unsigned getVectorNumElements() const
Simple binary floating point operators.
APInt Or(const APInt &LHS, const APInt &RHS)
Bitwise OR function for APInt.
APInt Xor(const APInt &LHS, const APInt &RHS)
Bitwise XOR function for APInt.
Libcall getFPTOSINT(EVT OpVT, EVT RetVT)
TRAP - Trapping instruction.
Zero extended before/after call.
MVT getRegisterType(MVT VT) const
Return the type of registers that this ValueType will eventually require.
DEBUGTRAP - Trap intended to get the attention of a debugger.
virtual unsigned getByValTypeAlignment(Type *Ty) const
static void InitLibcallNames(const char **Names, const TargetMachine &TM)
unsigned getVectorTypeBreakdown(LLVMContext &Context, EVT VT, EVT &IntermediateVT, unsigned &NumIntermediates, MVT &RegisterVT) const
unsigned MaxStoresPerMemmove
Specify maximum bytes of store instructions per memmove call.
X = FP_EXTEND(Y) - Extend a smaller FP type into a larger FP type.
uint64_t NextPowerOf2(uint64_t A)
static unsigned getVectorTypeBreakdownMVT(MVT VT, MVT &IntermediateVT, unsigned &NumIntermediates, MVT &RegisterVT, TargetLoweringBase *TLI)
static EVT getVectorVT(LLVMContext &Context, EVT VT, unsigned NumElements)
Libcall getFPEXT(EVT OpVT, EVT RetVT)
void initActions()
Initialize all of the actions to default values.
bool isValid() const
Returns true if this iterator is still pointing at a valid entry.
virtual bool shouldSplitVectorElementType(EVT) const
void setIndexedLoadAction(unsigned IdxMode, MVT VT, LegalizeAction Action)
void computeRegisterProperties()
ZERO_EXTEND - Used for integer types, zeroing the new bits.
ANY_EXTEND - Used for integer types. The high bits are undefined.
const StringRef getTargetTriple() const
APInt And(const APInt &LHS, const APInt &RHS)
Bitwise AND function for APInt.
virtual MVT::SimpleValueType getCmpLibcallReturnType() const
unsigned getCallFrameTypeAlignment(Type *Ty) const
Libcall getFPTOUINT(EVT OpVT, EVT RetVT)
Bitwise operators - logical and, logical or, logical xor.
void setTypeAction(MVT VT, LegalizeTypeAction Action)
unsigned getSizeInBits() const
getSizeInBits - Return the size of the specified value type in bits.
unsigned getPointerSizeInBits(unsigned AS=0) const
unsigned MaxStoresPerMemmoveOptSize
unsigned MaxStoresPerMemcpyOptSize
virtual const TargetRegisterInfo * getRegisterInfo() const
unsigned MaxStoresPerMemcpy
Specify maximum bytes of store instructions per memcpy call.
LegalizeKind getTypeConversion(LLVMContext &Context, EVT VT) const
Libcall getSINTTOFP(EVT OpVT, EVT RetVT)
EVT getTypeToTransformTo(LLVMContext &Context, EVT VT) const
MVT getPow2VectorType() const
virtual bool isLegalAddressingMode(const AddrMode &AM, Type *Ty) const
bool isPowerOf2_32(uint32_t Value)
vt_iterator vt_begin() const
unsigned MaxStoresPerMemset
Specify maximum number of store instructions per memset call.
unsigned MaxStoresPerMemsetOptSize
MVT getVectorElementType() const
TRUNCATE - Completely drop the high bits.
tier< T1, T2 > tie(T1 &f, T2 &s)
void setBitsInMask(const uint32_t *Mask, unsigned MaskWords=~0u)
INITIALIZE_PASS(GlobalMerge,"global-merge","Global Merge", false, false) bool GlobalMerge const DataLayout * TD
bool PredictableSelectIsExpensive
std::pair< unsigned, MVT > getTypeLegalizationCost(Type *Ty) const
Estimate the cost of type-legalization and the legalized type.
void setIndexedStoreAction(unsigned IdxMode, MVT VT, LegalizeAction Action)
unsigned getVectorNumElements() const