34 #include "llvm/IR/IntrinsicsXCore.h" 43 #define DEBUG_TYPE "xcore-lower" 206 case ISD::LOAD:
return LowerLOAD(Op, DAG);
287 int64_t FoldedOffset =
std::max(Offset & ~3, (int64_t)0);
289 GA = getGlobalAddressWrapper(GA, GV, DAG);
291 if (Offset != FoldedOffset) {
315 const BlockAddress *BA = cast<BlockAddressSDNode>(
Op)->getBlockAddress();
356 unsigned NumEntries = MJTI->
getJumpTables()[JTI].MBBs.size();
357 if (NumEntries <= 32) {
360 assert((NumEntries >> 31) == 0);
367 SDValue XCoreTargetLowering::lowerLoadWordFromAlignedBasePlusOffset(
371 if ((
Offset & 0x3) == 0) {
376 int32_t LowOffset = HighOffset - 4;
379 dyn_cast<GlobalAddressSDNode>(Base.
getNode())) {
400 SDValue Ops[] = { Result, Chain };
415 "Unexpected extension type");
432 Offset = cast<ConstantSDNode>(BasePtr->
getOperand(1))->getSExtValue();
433 return lowerLoadWordFromAlignedBasePlusOffset(DL, Chain, NewBasePtr,
440 return lowerLoadWordFromAlignedBasePlusOffset(DL, Chain, NewBasePtr,
461 SDValue Ops[] = { Result, Chain };
468 TargetLowering::ArgListEntry
Entry;
471 Entry.Node = BasePtr;
472 Args.push_back(Entry);
481 std::pair<SDValue, SDValue> CallResult =
LowerCallTo(CLI);
482 SDValue Ops[] = { CallResult.first, CallResult.second };
519 TargetLowering::ArgListEntry
Entry;
522 Entry.Node = BasePtr;
523 Args.push_back(Entry);
526 Args.push_back(Entry);
535 std::pair<SDValue, SDValue> CallResult =
LowerCallTo(CLI);
536 return CallResult.second;
543 "Unexpected operand to lower!");
560 "Unexpected operand to lower!");
580 SDValue &Addend1,
bool requireIntermediatesHaveOneUse)
597 if (requireIntermediatesHaveOneUse && !AddOp.
hasOneUse())
601 if (requireIntermediatesHaveOneUse && !OtherOp.
hasOneUse())
647 SDValue LL, RL, AddendL, AddendH;
668 if (LHSSB > 32 && RHSSB > 32) {
697 "Unknown operand to lower!");
700 if (
SDValue Result = TryExpandADDWithMul(N, DAG))
729 SDValue Ignored(Hi.getNode(), 1);
744 const Value *SV = cast<SrcValueSDNode>(Node->
getOperand(2))->getValue();
779 if (cast<ConstantSDNode>(Op.
getOperand(0))->getZExtValue() > 0)
795 if (cast<ConstantSDNode>(Op.
getOperand(0))->getZExtValue() > 0)
840 unsigned HandlerReg = XCore::R3;
867 const Value *TrmpAddr = cast<SrcValueSDNode>(Op.
getOperand(4))->getValue();
917 unsigned IntNo = cast<ConstantSDNode>(Op.
getOperand(0))->getZExtValue();
919 case Intrinsic::xcore_crc8:
943 "setInsertFencesForAtomic(true) expects unordered / monotonic");
974 "setInsertFencesForAtomic(true) expects unordered / monotonic");
999 XCoreTargetLowering::getMMOFlags(
const Instruction &
I)
const {
1004 if (
auto *
SI = dyn_cast<StoreInst>(&I))
1007 if (
auto *LI = dyn_cast<LoadInst>(&I))
1010 if (
auto *AI = dyn_cast<AtomicRMWInst>(&I))
1013 if (
auto *AI = dyn_cast<AtomicCmpXchgInst>(&I))
1023 #include "XCoreGenCallingConv.inc" 1054 return LowerCCCCallTo(Chain, Callee, CallConv, isVarArg, isTailCall,
1055 Outs, OutVals, Ins, dl, DAG, InVals);
1067 for (
unsigned i = 0,
e = RVLocs.
size(); i !=
e; ++i) {
1071 InFlag).getValue(1);
1085 for (
unsigned i = 0,
e = ResultMemLocs.
size(); i !=
e; ++i) {
1086 int offset = ResultMemLocs[i].first;
1087 unsigned index = ResultMemLocs[i].second;
1091 InVals[index] = load;
1097 if (!MemOpChains.
empty())
1107 SDValue XCoreTargetLowering::LowerCCCCallTo(
1123 CCInfo.AnalyzeCallOperands(Outs, CC_XCore);
1130 RetCCInfo.AnalyzeCallResult(Ins, RetCC_XCore);
1133 unsigned NumBytes = RetCCInfo.getNextStackOffset();
1142 for (
unsigned i = 0,
e = ArgLocs.
size(); i !=
e; ++i) {
1179 if (!MemOpChains.
empty())
1187 for (
unsigned i = 0,
e = RegsToPass.
size(); i !=
e; ++i) {
1189 RegsToPass[i].
second, InFlag);
1212 for (
unsigned i = 0,
e = RegsToPass.
size(); i !=
e; ++i)
1214 RegsToPass[i].second.getValueType()));
1241 SDValue XCoreTargetLowering::LowerFormalArguments(
1251 return LowerCCCArguments(Chain, CallConv, isVarArg,
1252 Ins, dl, DAG, InVals);
1260 SDValue XCoreTargetLowering::LowerCCCArguments(
1278 unsigned LRSaveSize = StackSlotSize;
1295 for (
unsigned i = 0,
e = ArgLocs.size(); i !=
e; ++i) {
1307 errs() <<
"LowerFormalArguments Unhandled argument type: " 1323 if (ObjSize > StackSlotSize) {
1324 errs() <<
"LowerFormalArguments Unhandled argument type: " 1339 const ArgDataPair ADP = { ArgIn, Ins[i].Flags };
1347 XCore::R0, XCore::R1,
XCore::R2, XCore::R3
1350 unsigned FirstVAReg = CCInfo.getFirstUnallocated(ArgRegs);
1355 for (
int i =
array_lengthof(ArgRegs) - 1; i >= (int)FirstVAReg; --i) {
1358 if (i == (
int)FirstVAReg) {
1361 offset -= StackSlotSize;
1382 if (!CFRegNode.
empty())
1390 ArgDE = ArgData.
end();
1391 ArgDI != ArgDE; ++ArgDI) {
1392 if (ArgDI->Flags.isByVal() && ArgDI->Flags.getByValSize()) {
1393 unsigned Size = ArgDI->Flags.getByValSize();
1394 unsigned Align =
std::max(StackSlotSize, ArgDI->Flags.getByValAlign());
1401 Align,
false,
false,
false,
1410 if (!MemOps.
empty()) {
1422 bool XCoreTargetLowering::
1428 CCState CCInfo(CallConv, isVarArg, MF, RVLocs, Context);
1459 CCInfo.AnalyzeReturn(Outs, RetCC_XCore);
1469 for (
unsigned i = 0,
e = RVLocs.
size(); i !=
e; ++i) {
1481 int FI = MFI.CreateFixedObject(ObjSize, Offset,
false);
1487 Chain, dl, OutVals[i], FIN,
1493 if (!MemOpChains.
empty())
1497 for (
unsigned i = 0,
e = RVLocs.
size(); i !=
e; ++i) {
1529 "Unexpected instr type to insert");
1597 switch (cast<ConstantSDNode>(N->
getOperand(1))->getZExtValue()) {
1598 case Intrinsic::xcore_outt:
1599 case Intrinsic::xcore_outct:
1600 case Intrinsic::xcore_chkct: {
1610 if (TLI.ShrinkDemandedConstant(OutVal, DemandedMask, TLO) ||
1611 TLI.SimplifyDemandedBits(OutVal, DemandedMask, Known, TLO))
1616 case Intrinsic::xcore_setpt: {
1626 if (TLI.ShrinkDemandedConstant(Time, DemandedMask, TLO) ||
1627 TLI.SimplifyDemandedBits(Time, DemandedMask, Known, TLO))
1647 if (N0C && N0C->
isNullValue() && N1C && N1C->isNullValue()) {
1651 SDValue Ops[] = { Result, Carry };
1659 VT.getSizeInBits() - 1);
1661 if ((Known.Zero & Mask) == Mask) {
1664 SDValue Ops[] = { Result, Carry };
1679 if (N0C && N0C->
isNullValue() && N1C && N1C->isNullValue()) {
1681 VT.getSizeInBits() - 1);
1683 if ((Known.Zero & Mask) == Mask) {
1687 SDValue Ops[] = { Result, Borrow };
1696 VT.getSizeInBits() - 1);
1698 if ((Known.Zero & Mask) == Mask) {
1701 SDValue Ops[] = { Result, Borrow };
1717 if ((N0C && !N1C) ||
1718 (N0C && N1C && N0C->
getZExtValue() < N1C->getZExtValue()))
1723 if (N1C && N1C->isNullValue()) {
1734 SDValue Ops[] = { Carry, Result };
1744 SDValue Mul0, Mul1, Addend0, Addend1;
1749 Mul1, Addend0, Addend1);
1774 Addend0L, Addend1L);
1793 assert((StoreBits % 8) == 0 &&
1794 "Store size in bits must be a multiple of 8");
1798 if (
LD->hasNUsesOfValue(1, 0) && ST->
getMemoryVT() ==
LD->getMemoryVT() &&
1799 LD->getAlignment() == Alignment &&
1800 !
LD->isVolatile() && !
LD->isIndexed() &&
1807 LD->getPointerInfo());
1816 void XCoreTargetLowering::computeKnownBitsForTargetNode(
const SDValue Op,
1818 const APInt &DemandedElts,
1820 unsigned Depth)
const {
1834 unsigned IntNo = cast<ConstantSDNode>(Op.
getOperand(1))->getZExtValue();
1836 case Intrinsic::xcore_getts:
1841 case Intrinsic::xcore_int:
1842 case Intrinsic::xcore_inct:
1847 case Intrinsic::xcore_testct:
1852 case Intrinsic::xcore_testwct:
1869 return (val >= 0 && val <= 11);
1874 return (val%2 == 0 &&
isImmUs(val/2));
1879 return (val%4 == 0 &&
isImmUs(val/4));
1900 if (AM.
Scale == 0) {
1908 if (AM.
Scale == 0) {
1915 if (AM.
Scale == 0) {
1927 std::pair<unsigned, const TargetRegisterClass *>
1931 if (Constraint.
size() == 1) {
1932 switch (Constraint[0]) {
1935 return std::make_pair(0U, &XCore::GRRegsRegClass);
SDValue getStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, MachinePointerInfo PtrInfo, unsigned Alignment=0, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
Helper function to build ISD::STORE nodes.
bool isMachineConstantPoolEntry() const
ADJUST_TRAMPOLINE - This corresponds to the adjust_trampoline intrinsic.
int createLRSpillSlot(MachineFunction &MF)
static SDValue LowerCallResult(SDValue Chain, SDValue InFlag, const SmallVectorImpl< CCValAssign > &RVLocs, const SDLoc &dl, SelectionDAG &DAG, SmallVectorImpl< SDValue > &InVals)
LowerCallResult - Lower the result values of a call into the appropriate copies out of appropriate ph...
A parsed version of the target data layout string in and methods for querying it. ...
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
EVT getValueType() const
Return the ValueType of the referenced return value.
This represents an addressing mode of: BaseGV + BaseOffs + BaseReg + Scale*ScaleReg If BaseGV is null...
void setLoadExtAction(unsigned ExtType, MVT ValVT, MVT MemVT, LegalizeAction Action)
Indicate that the specified load with extension does not work with the specified type and indicate wh...
static bool isImmUs2(int64_t val)
const std::vector< MachineJumpTableEntry > & getJumpTables() const
raw_ostream & errs()
This returns a reference to a raw_ostream for standard error.
bool hasLocalLinkage() const
const GlobalValue * getGlobal() const
EXTRACT_ELEMENT - This is used to get the lower or upper (determined by a Constant, which is required to be operand #1) half of the integer or float value specified as operand #0.
unsigned getOpcode() const
Return the SelectionDAG opcode value for this node.
typename SuperClass::const_iterator const_iterator
bool isIndexed() const
Return true if this is a pre/post inc/dec load/store.
SDValue getCALLSEQ_END(SDValue Chain, SDValue Op1, SDValue Op2, SDValue InGlue, const SDLoc &DL)
Return a new CALLSEQ_END node, which always must have a glue result (to ensure it's not CSE'd)...
void setVarArgsFrameIndex(int off)
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
BR_CC - Conditional branch.
This class represents lattice values for constants.
Register getLocReg() const
static Constant * getGetElementPtr(Type *Ty, Constant *C, ArrayRef< Constant *> IdxList, bool InBounds=false, Optional< unsigned > InRangeIndex=None, Type *OnlyIfReducedTy=nullptr)
Getelementptr form.
bool isSized(SmallPtrSetImpl< Type *> *Visited=nullptr) const
Return true if it makes sense to take the size of this type.
XCoreTargetLowering(const TargetMachine &TM, const XCoreSubtarget &Subtarget)
const SDValue & getVal() const
Register createVirtualRegister(const TargetRegisterClass *RegClass, StringRef Name="")
createVirtualRegister - Create and return a new virtual register in the function with the specified r...
bool isLegalAddressingMode(const DataLayout &DL, const AddrMode &AM, Type *Ty, unsigned AS, Instruction *I=nullptr) const override
isLegalAddressingMode - Return true if the addressing mode represented by AM is legal for this target...
void addLiveIn(unsigned Reg, unsigned vreg=0)
addLiveIn - Add the specified register as a live-in.
const SDValue & getBasePtr() const
LLVM_NODISCARD bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
EVT getValueType(unsigned ResNo) const
Return the type of a specified result.
void push_back(const T &Elt)
const DebugLoc & getDebugLoc() const
Returns the debug location id of this MachineInstr.
void AnalyzeFormalArguments(const SmallVectorImpl< ISD::InputArg > &Ins, CCAssignFn Fn)
AnalyzeFormalArguments - Analyze an array of argument values, incorporating info about the formals in...
TypeSize getSizeInBits() const
Returns the size of the specified MVT in bits.
unsigned getReturnStackOffset() const
const SDValue & getValue() const
void transferSuccessorsAndUpdatePHIs(MachineBasicBlock *FromMBB)
Transfers all the successors, as in transferSuccessors, and update PHI operands in the successor bloc...
STACKRESTORE has two operands, an input chain and a pointer to restore to it returns an output chain...
SDValue getTargetExternalSymbol(const char *Sym, EVT VT, unsigned TargetFlags=0)
SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override
LowerOperation - Provide custom lowering hooks for some operations.
EK_Inline - Jump table entries are emitted inline at their point of use.
static APInt getLowBitsSet(unsigned numBits, unsigned loBitsSet)
Get a value with low bits set.
MVT getSimpleVT() const
Return the SimpleValueType held in the specified simple EVT.
AAMDNodes getAAInfo() const
Returns the AA info that describes the dereference.
const SDValue & getBasePtr() const
const SDValue & getChain() const
Function Alias Analysis Results
bool isZExtFree(SDValue Val, EVT VT2) const override
Return true if zero-extending the specific node Val to type VT2 is free (either because it's implicit...
unsigned getAlignment() const
virtual std::pair< unsigned, const TargetRegisterClass * > getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI, StringRef Constraint, MVT VT) const
Given a physical register constraint (e.g.
void setBooleanVectorContents(BooleanContent Ty)
Specify how the target extends the result of a vector boolean value from a vector of i1 to a wider ty...
C - The default llvm calling convention, compatible with C.
unsigned const TargetRegisterInfo * TRI
bool isInteger() const
Return true if this is an integer or a vector integer type.
CallLoweringInfo & setDebugLoc(const SDLoc &dl)
SDNode * getNode() const
get the SDNode which holds the desired result
SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, ArrayRef< SDUse > Ops)
Gets or creates the specified node.
SDValue getConstantPool(const Constant *C, EVT VT, unsigned Align=0, int Offs=0, bool isT=false, unsigned TargetFlags=0)
MachineMemOperand * getMemOperand() const
Return a MachineMemOperand object describing the memory reference performed by operation.
unsigned getBitWidth() const
Get the bit width of this value.
OUTCHAIN = ATOMIC_FENCE(INCHAIN, ordering, scope) This corresponds to the fence instruction.
Select with condition operator - This selects between a true value and a false value (ops #2 and #3) ...
bool hasOneUse() const
Return true if there is exactly one node using value ResNo of Node.
SDValue getExternalSymbol(const char *Sym, EVT VT)
RESULT,OUTCHAIN = INTRINSIC_W_CHAIN(INCHAIN, INTRINSICID, arg1, ...) This node represents a target in...
bool isTruncatingStore() const
Return true if the op does a truncation before store.
unsigned countMinTrailingZeros() const
Returns the minimum number of trailing zero bits.
static bool isImmUs(int64_t val)
A convenience struct that encapsulates a DAG, and two SDValues for returning information from TargetL...
static int stackSlotSize()
Stack slot size (4 bytes)
SHL_PARTS/SRA_PARTS/SRL_PARTS - These operators are used for expanded integer shift operations...
SDValue getIntPtrConstant(uint64_t Val, const SDLoc &DL, bool isTarget=false)
The address of a basic block.
bool isBeforeLegalize() const
virtual bool isGAPlusOffset(SDNode *N, const GlobalValue *&GA, int64_t &Offset) const
Returns true (and the GlobalValue and the offset) if the node is a GlobalAddress + offset...
static bool IsSmallObject(const GlobalValue *GV, const XCoreTargetLowering &XTL)
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
const HexagonInstrInfo * TII
TypeID getTypeID() const
Return the type id for the type.
Shift and rotation operations.
CallLoweringInfo & setChain(SDValue InChain)
BUILD_PAIR - This is the opposite of EXTRACT_ELEMENT in some ways.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void eraseFromParent()
Unlink 'this' from the containing basic block and delete it.
ISD::LoadExtType getExtensionType() const
Return whether this is a plain node, or one of the varieties of value-extending loads.
SDValue getTargetJumpTable(int JTI, EVT VT, unsigned TargetFlags=0)
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted...
static const unsigned CodeModelLargeSize
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
SDValue getEntryNode() const
Return the token chain corresponding to the entry of the function.
void setOperationAction(unsigned Op, MVT VT, LegalizeAction Action)
Indicate that the specified operation does not work with the specified type and indicate what to do a...
TypeSize getValueSizeInBits() const
Returns the size of the value in bits.
const DataLayout & getDataLayout() const
SDVTList getVTList(EVT VT)
Return an SDVTList that represents the list of values specified.
FRAMEADDR, RETURNADDR - These nodes represent llvm.frameaddress and llvm.returnaddress on the DAG...
This is an SDNode representing atomic operations.
LocInfo getLocInfo() const
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
AtomicOrdering getOrdering() const
Return the atomic ordering requirements for this memory operation.
This represents a list of ValueType's that has been intern'd by a SelectionDAG.
SDValue getExtLoad(ISD::LoadExtType ExtType, const SDLoc &dl, EVT VT, SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo, EVT MemVT, unsigned Alignment=0, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
SmallVector< ISD::InputArg, 32 > Ins
STACKSAVE - STACKSAVE has one operand, an input chain.
FRAME_TO_ARGS_OFFSET - This node represents offset from frame pointer to first (possible) on-stack ar...
SDValue getMergeValues(ArrayRef< SDValue > Ops, const SDLoc &dl)
Create a MERGE_VALUES node from the given operands.
void ReplaceNodeResults(SDNode *N, SmallVectorImpl< SDValue > &Results, SelectionDAG &DAG) const override
ReplaceNodeResults - Replace the results of node with an illegal result type with new values built ou...
unsigned getNextStackOffset() const
getNextStackOffset - Return the next stack offset such that all stack slots satisfy their alignment r...
void setReturnStackOffset(unsigned value)
MachineFunction & getMachineFunction() const
void computeRegisterProperties(const TargetRegisterInfo *TRI)
Once all of the register classes are added, this allows us to compute derived properties we expose...
void setMinFunctionAlignment(Align Alignment)
Set the target's minimum function alignment.
Simple integer binary arithmetic operators.
SmallVector< ISD::OutputArg, 32 > Outs
LLVM_NODISCARD size_t size() const
size - Get the string size.
unsigned getAlignment() const
MachineBasicBlock * EmitInstrWithCustomInserter(MachineInstr &MI, MachineBasicBlock *MBB) const override
This method should be implemented by targets that mark instructions with the 'usesCustomInserter' fla...
RESULT = INTRINSIC_WO_CHAIN(INTRINSICID, arg1, arg2, ...) This node represents a target intrinsic fun...
MachineBasicBlock * CreateMachineBasicBlock(const BasicBlock *bb=nullptr)
CreateMachineBasicBlock - Allocate a new MachineBasicBlock.
This class is used to represent ISD::STORE nodes.
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
void setPrefFunctionAlignment(Align Alignment)
Set the target's preferred function alignment.
Flag
These should be considered private to the implementation of the MCInstrDesc class.
TargetInstrInfo - Interface to description of machine instruction set.
static APInt getHighBitsSet(unsigned numBits, unsigned hiBitsSet)
Get a value with high bits set.
unsigned ComputeNumSignBits(SDValue Op, unsigned Depth=0) const
Return the number of times the sign bit of the register is replicated into the other bits...
static Constant * getBitCast(Constant *C, Type *Ty, bool OnlyIfReduced=false)
The memory access is volatile.
constexpr uint64_t MinAlign(uint64_t A, uint64_t B)
A and B are either alignments or offsets.
unsigned getNumValues() const
Return the number of values defined/returned by this operator.
IntegerType * getIntPtrType(LLVMContext &C, unsigned AddressSpace=0) const
Returns an integer type with size at least as big as that of a pointer in the given address space...
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
const SDValue & getBasePtr() const
int64_t getOffset() const
OUTCHAIN = INTRINSIC_VOID(INCHAIN, INTRINSICID, arg1, arg2, ...) This node represents a target intrin...
LLVM Basic Block Representation.
The instances of the Type class are immutable: once they are created, they are never changed...
This is an important class for using LLVM in a threaded context.
void addRegisterClass(MVT VT, const TargetRegisterClass *RC)
Add the specified register class as an available regclass for the specified value type...
void setTargetDAGCombine(ISD::NodeType NT)
Targets should invoke this method for each target independent node that they want to provide a custom...
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This is an important base class in LLVM.
void resetAll()
Resets the known state of all bits.
VAEND, VASTART - VAEND and VASTART have three operands: an input chain, pointer, and a SRCVALUE...
const SDValue & getOperand(unsigned Num) const
This file contains the declarations for the subclasses of Constant, which represent the different fla...
TypeSize getTypeAllocSize(Type *Ty) const
Returns the offset in bytes between successive objects of the specified type, including alignment pad...
SDValue getCALLSEQ_START(SDValue Chain, uint64_t InSize, uint64_t OutSize, const SDLoc &DL)
Return a new CALLSEQ_START node, that starts new call frame, in which InSize bytes are set up inside ...
void setBooleanContents(BooleanContent Ty)
Specify how the target extends the result of integer and floating point boolean values from i1 to a w...
static Type * getVoidTy(LLVMContext &C)
INIT_TRAMPOLINE - This corresponds to the init_trampoline intrinsic.
bool isBaseWithConstantOffset(SDValue Op) const
Return true if the specified operand is an ISD::ADD with a ConstantSDNode on the right-hand side...
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
TRAP - Trapping instruction.
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
std::string getEVTString() const
This function returns value type as a string, e.g. "i32".
self_iterator getIterator()
bool hasNUsesOfValue(unsigned NUses, unsigned Value) const
Return true if there are exactly NUSES uses of the indicated value.
VAARG - VAARG has four operands: an input chain, a pointer, a SRCVALUE, and the alignment.
unsigned MaxStoresPerMemmove
Specify maximum number of store instructions per memmove call.
XCoreFunctionInfo - This class is derived from MachineFunction private XCore target-specific informat...
virtual MVT getPointerTy(const DataLayout &DL, uint32_t AS=0) const
Return the pointer type for the given address space, defaults to the pointer type from the data layou...
std::vector< ArgListEntry > ArgListTy
unsigned getAlignment() const
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
TypeSize getSizeInBits() const
Return the size of the specified value type in bits.
This structure contains all information that is necessary for lowering calls.
bool isBeforeLegalizeOps() const
static PointerType * getInt8PtrTy(LLVMContext &C, unsigned AS=0)
const TargetMachine & getTargetMachine() const
StringRef getSection() const
This class contains a discriminated union of information about pointers in memory operands...
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This struct is a compact representation of a valid (non-zero power of two) alignment.
SDValue getLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo, unsigned Alignment=0, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr)
Loads are not normal binary operators: their result type is not determined by their operands...
SDValue getTargetBlockAddress(const BlockAddress *BA, EVT VT, int64_t Offset=0, unsigned TargetFlags=0)
bool allowsMemoryAccessForAlignment(LLVMContext &Context, const DataLayout &DL, EVT VT, unsigned AddrSpace=0, unsigned Alignment=1, MachineMemOperand::Flags Flags=MachineMemOperand::MONone, bool *Fast=nullptr) const
This function returns true if the memory access is aligned or if the target allows this specific unal...
TokenFactor - This node takes multiple tokens as input and produces a single token result...
const TargetLowering & getTargetLoweringInfo() const
SDValue getTargetConstantPool(const Constant *C, EVT VT, unsigned Align=0, int Offset=0, unsigned TargetFlags=0)
Iterator for intrusive lists based on ilist_node.
CCState - This class holds information needed while lowering arguments and return values...
SDValue getTargetGlobalAddress(const GlobalValue *GV, const SDLoc &DL, EVT VT, int64_t offset=0, unsigned TargetFlags=0)
void addSuccessor(MachineBasicBlock *Succ, BranchProbability Prob=BranchProbability::getUnknown())
Add Succ as a successor of this MachineBasicBlock.
Align max(MaybeAlign Lhs, Align Rhs)
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
CallLoweringInfo & setCallee(CallingConv::ID CC, Type *ResultType, SDValue Target, ArgListTy &&ArgsList)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
virtual Register getFrameRegister(const MachineFunction &MF) const =0
Debug information queries.
CCValAssign - Represent assignment of one arg/retval to a location.
SDValue getMemcpy(SDValue Chain, const SDLoc &dl, SDValue Dst, SDValue Src, SDValue Size, unsigned Align, bool isVol, bool AlwaysInline, bool isTailCall, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo)
constexpr size_t array_lengthof(T(&)[N])
Find the length of an array.
int CreateFixedObject(uint64_t Size, int64_t SPOffset, bool IsImmutable, bool isAliased=false)
Create a new object at a fixed location on the stack.
const Constant * getConstVal() const
SDValue getMemmove(SDValue Chain, const SDLoc &dl, SDValue Dst, SDValue Src, SDValue Size, unsigned Align, bool isVol, bool isTailCall, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo)
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
static Constant * get(Type *Ty, uint64_t V, bool isSigned=false)
If Ty is a vector type, return a Constant with a splat of the given value.
Represents one node in the SelectionDAG.
SDValue getCopyToReg(SDValue Chain, const SDLoc &dl, unsigned Reg, SDValue N)
static mvt_range integer_valuetypes()
MachinePointerInfo getWithOffset(int64_t O) const
EVT getMemoryVT() const
Return the type of the in-memory value.
Class for arbitrary precision integers.
CodeModel::Model getCodeModel() const
Returns the code model.
static bool isImmUs4(int64_t val)
amdgpu Simplify well known AMD library false FunctionCallee Callee
ZERO_EXTEND - Used for integer types, zeroing the new bits.
ANY_EXTEND - Used for integer types. The high bits are undefined.
SDValue getGlobalAddress(const GlobalValue *GV, const SDLoc &DL, EVT VT, int64_t offset=0, bool isTargetGA=false, unsigned TargetFlags=0)
Flags
Flags values. These may be or'd together.
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
std::pair< SDValue, SDValue > LowerCallTo(CallLoweringInfo &CLI) const
This function lowers an abstract call to a function into an actual call.
static MachinePointerInfo getFixedStack(MachineFunction &MF, int FI, int64_t Offset=0)
Return a MachinePointerInfo record that refers to the specified FrameIndex.
BR_JT - Jumptable branch.
Representation of each machine instruction.
VACOPY - VACOPY has 5 operands: an input chain, a destination pointer, a source pointer, a SRCVALUE for the destination, and a SRCVALUE for the source.
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
SmallVector< SDValue, 32 > OutVals
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
bool CheckReturn(const SmallVectorImpl< ISD::OutputArg > &Outs, CCAssignFn Fn)
CheckReturn - Analyze the return values of a function, returning true if the return can be performed ...
unsigned AllocateStack(unsigned Size, unsigned Alignment)
AllocateStack - Allocate a chunk of stack space with the specified size and alignment.
bool isFunctionTy() const
True if this is an instance of FunctionType.
Bitwise operators - logical and, logical or, logical xor.
const TargetRegisterInfo * getRegisterInfo() const override
void splice(iterator Where, MachineBasicBlock *Other, iterator From)
Take an instruction from MBB 'Other' at the position From, and insert it into this MBB right before '...
SDValue getCopyFromReg(SDValue Chain, const SDLoc &dl, unsigned Reg, EVT VT)
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
static IntegerType * getInt32Ty(LLVMContext &C)
unsigned getLocMemOffset() const
SMUL_LOHI/UMUL_LOHI - Multiply two integers of type iN, producing a signed/unsigned value of type i[2...
LLVM_NODISCARD bool empty() const
const MCInstrDesc & get(unsigned Opcode) const
Return the machine instruction descriptor that corresponds to the specified instruction opcode...
LOAD and STORE have token chains as their first operand, then the same operands as an LLVM load/store...
Flags getFlags() const
Return the raw flags of the source value,.
unsigned getJumpTableEncoding() const override
Return the entry encoding for a jump table in the current function.
unsigned MaxStoresPerMemmoveOptSize
Likewise for functions with the OptSize attribute.
unsigned MaxStoresPerMemcpyOptSize
Likewise for functions with the OptSize attribute.
void setStackPointerRegisterToSaveRestore(unsigned R)
If set to a physical register, this specifies the register that llvm.savestack/llvm.restorestack should save and restore.
const BasicBlock * getBasicBlock() const
Return the LLVM basic block that this instance corresponded to originally.
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
Type * getValueType() const
const char * getTargetNodeName(unsigned Opcode) const override
getTargetNodeName - This method returns the name of a target specific
static bool isADDADDMUL(SDValue Op, SDValue &Mul0, SDValue &Mul1, SDValue &Addend0, SDValue &Addend1, bool requireIntermediatesHaveOneUse)
isADDADDMUL - Return whether Op is in a form that is equivalent to add(add(mul(x,y),a),b).
unsigned getOpcode() const
SDValue getValue(unsigned R) const
unsigned MaxStoresPerMemcpy
Specify maximum number of store instructions per memcpy call.
bool reachesChainWithoutSideEffects(SDValue Dest, unsigned Depth=2) const
Return true if this operand (which must be a chain) reaches the specified operand without crossing an...
SDValue getConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isTarget=false, bool isOpaque=false)
Create a ConstantSDNode wrapping a constant value.
OUTCHAIN = EH_RETURN(INCHAIN, OFFSET, HANDLER) - This node represents 'eh_return' gcc dwarf builtin...
const MachinePointerInfo & getPointerInfo() const
bool isInTailCallPosition(SelectionDAG &DAG, SDNode *Node, SDValue &Chain) const
Check whether a given call node is in tail position within its function.
bool MaskedValueIsZero(SDValue Op, const APInt &Mask, unsigned Depth=0) const
Return true if 'Op & Mask' is known to be zero.
MachineConstantPoolValue * getMachineCPVal() const
int getVarArgsFrameIndex() const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
SDValue getTruncStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, MachinePointerInfo PtrInfo, EVT SVT, unsigned Alignment=0, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
void insert(iterator MBBI, MachineBasicBlock *MBB)
SDValue getFrameIndex(int FI, EVT VT, bool isTarget=false)
int CreateStackObject(uint64_t Size, Align Alignment, bool isSpillSlot, const AllocaInst *Alloca=nullptr, uint8_t ID=0)
Create a new statically sized stack object, returning a nonnegative identifier to represent it...
void setSchedulingPreference(Sched::Preference Pref)
Specify the target scheduling preference.
Module * getParent()
Get the module that this global value is contained inside of...
LLVM Value Representation.
SDValue getRegister(unsigned Reg, EVT VT)
unsigned getResNo() const
get the index which selects a specific result in the SDNode
Fast - This calling convention attempts to make calls as fast as possible (e.g.
const MDNode * getRanges() const
Returns the Ranges that describes the dereference.
std::underlying_type< E >::type Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
Primary interface to the complete machine description for the target machine.
StringRef - Represent a constant reference to a string, i.e.
unsigned MaxStoresPerMemset
Specify maximum number of store instructions per memset call.
unsigned MaxStoresPerMemsetOptSize
Likewise for functions with the OptSize attribute.
KnownBits computeKnownBits(SDValue Op, unsigned Depth=0) const
Determine which bits of Op are known to be either zero or one and return them in Known.
static bool isWordAligned(SDValue Value, SelectionDAG &DAG)
Register getReg() const
getReg - Returns the register number.
const SDValue & getOperand(unsigned i) const
OUTCHAIN = ATOMIC_STORE(INCHAIN, ptr, val) This corresponds to "store atomic" instruction.
uint64_t getZExtValue() const
bool isSimple() const
Test if the given EVT is simple (as opposed to being extended).
TypeSize getStoreSizeInBits() const
Return the number of bits overwritten by a store of the specified value type.
const MachineJumpTableInfo * getJumpTableInfo() const
getJumpTableInfo - Return the jump table info object for the current function.
const MachineOperand & getOperand(unsigned i) const
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation...
const MachineInstrBuilder & addReg(Register RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
static IntegerType * getInt8Ty(LLVMContext &C)
Val, OUTCHAIN = ATOMIC_LOAD(INCHAIN, ptr) This corresponds to "load atomic" instruction.
LLVMContext * getContext() const
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
CallLoweringInfo & setLibCallee(CallingConv::ID CC, Type *ResultType, SDValue Target, ArgListTy &&ArgsList)
Wrapper class representing virtual and physical registers.
void CommitTargetLoweringOpt(const TargetLoweringOpt &TLO)
MULHU/MULHS - Multiply high - Multiply two integers of type iN, producing an unsigned/signed value of...
This class is used to represent ISD::LOAD nodes.
DYNAMIC_STACKALLOC - Allocate some number of bytes on the stack aligned to a specified boundary...