27 "nvptx-force-min-byval-param-align",
cl::Hidden,
28 cl::desc(
"NVPTX Specific: force 4-byte minimal alignment for byval"
29 " params of device functions."),
39 return std::min(
Align(128),
DL.getABITypeAlign(ArgTy));
52 const bool ShouldForceMinAlign =
54 return ShouldForceMinAlign ?
Align(4) :
Align(1);
69 if (CB && AttrIdx >= AttributeList::FirstArgIndex)
70 ParamAlign = std::max(
82 return StackAlign.
value();
85 if (
F && AttrIdx >= AttributeList::FirstArgIndex) {
86 unsigned ArgNo = AttrIdx - AttributeList::FirstArgIndex;
87 if (
F->getAttributes().hasParamAttr(ArgNo, Attribute::ByVal))
88 return std::max(TypeAlign,
F->getParamAlign(ArgNo).valueOrOne());
97 return StackAlign.
value();
101 if (!DirectCallee && CB)
110 if (!ST.hasNoReturn())
114 "Expect either a call instruction or a function");
117 return CallI->doesNotReturn() &&
118 CallI->getFunctionType()->getReturnType()->isVoidTy();
121 return F->doesNotReturn() &&
122 F->getFunctionType()->getReturnType()->isVoidTy() &&
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
This file contains the simple types necessary to represent the attributes associated with functions a...
static Align getByValParamAlignFloor(const Function *F)
static cl::opt< bool > ForceMinByValParamAlign("nvptx-force-min-byval-param-align", cl::Hidden, cl::desc("NVPTX Specific: force 4-byte minimal alignment for byval" " params of device functions."), cl::init(false))
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
Function * getCalledFunction() const
Returns the function called, or null if this is an indirect function invocation or the function signa...
MaybeAlign getParamAlign(unsigned ArgNo) const
Extract the alignment for a call or parameter (0=unknown).
Value * getCalledOperand() const
This class represents a function call, abstracting a target machine's calling convention.
A parsed version of the target data layout string in and methods for querying it.
Primary interface to the complete machine description for the target machine.
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM Value Representation.
LLVM_ABI const Value * stripPointerCasts() const
Strip off pointer casts, all-zero GEPs and address space casts.
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
bool shouldEmitPTXNoReturn(const Value *V, const TargetMachine &TM)
Align getDeviceByValParamAlign(const Function *F, Type *ArgTy, unsigned AttrIdx, const DataLayout &DL)
The .param-space alignment for a byval parameter or call argument: the (possibly promoted) parameter ...
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
Align getPTXParamTypeAlign(Type *ArgTy, const DataLayout &DL)
ABI alignment of ArgTy in .param space, capped at the PTX maximum of 128.
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
Align getPTXParamAlign(const Function *F, Type *Ty, unsigned AttrIdx, const DataLayout &DL)
Alignment for a function parameter or return value at AttributeList index AttrIdx (FirstArgIndex + ar...
bool isKernelFunction(const Function &F)
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
Function * getMaybeBitcastedCallee(const CallBase *CB)
MaybeAlign getStackAlign(const Function &F, unsigned Index)
This struct is a compact representation of a valid (non-zero power of two) alignment.
constexpr uint64_t value() const
This is a hole in the type system and should not be abused.
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.
Align valueOrOne() const
For convenience, returns a valid alignment or 1 if undefined.