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."),
40 const Align ABITypeAlign = std::min(
Align(128),
DL.getABITypeAlign(ArgTy));
45 const bool MayOptimizeAlign =
46 F &&
F->hasLocalLinkage() &&
47 !
F->hasAddressTaken(
nullptr,
52 "Expect kernels to have non-local linkage");
54 return std::max(OptimizedAlign, ABITypeAlign);
70 const bool ShouldForceMinAlign =
74 return std::max({InitialAlign, OptimizedAlign, AlignFloor});
81 return StackAlign.
value();
84 if (
F && AttrIdx >= AttributeList::FirstArgIndex) {
85 unsigned ArgNo = AttrIdx - AttributeList::FirstArgIndex;
86 if (
F->getAttributes().hasParamAttr(ArgNo, Attribute::ByVal))
87 return std::max(TypeAlign,
F->getParamAlign(ArgNo).valueOrOne());
96 if (!DirectCallee && CB) {
98 return StackAlign.value();
109 if (!ST.hasNoReturn())
113 "Expect either a call instruction or a function");
116 return CallI->doesNotReturn() &&
117 CallI->getFunctionType()->getReturnType()->isVoidTy();
120 return F->doesNotReturn() &&
121 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...
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...
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)
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
Align getPTXPromotedParamTypeAlign(const Function *F, Type *ArgTy, const DataLayout &DL)
Since function arguments are passed via .param space, we may want to increase their alignment in a wa...
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...
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))
MaybeAlign getStackAlign(const CallBase &I, unsigned Index)
Align getPTXParamAlign(const Function *F, Type *Ty, unsigned AttrIdx, const DataLayout &DL)
Get the alignment for a function parameter or return value.
Align getDeviceByValParamAlign(const Function *F, Type *ArgTy, Align InitialAlign, const DataLayout &DL)
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)
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.