26 "nvptx-force-min-byval-param-align",
cl::Hidden,
27 cl::desc(
"NVPTX Specific: force 4-byte minimal alignment for byval"
28 " params of device functions."),
38 auto ElementBitWidth = TotalWidth / NumElts;
40 ElementBitWidth <= 128 && TotalWidth <= 256 &&
41 "Invalid width for load");
42 return ElementBitWidth;
48 return std::min(
Align(128),
DL.getABITypeAlign(ArgTy));
61 const bool ShouldForceMinAlign =
63 return ShouldForceMinAlign ?
Align(4) :
Align(1);
78 if (CB && AttrIdx >= AttributeList::FirstArgIndex)
79 ParamAlign = std::max(
91 return StackAlign.
value();
94 if (
F && AttrIdx >= AttributeList::FirstArgIndex) {
95 unsigned ArgNo = AttrIdx - AttributeList::FirstArgIndex;
96 if (
F->getAttributes().hasParamAttr(ArgNo, Attribute::ByVal))
97 return std::max(TypeAlign,
F->getParamAlign(ArgNo).valueOrOne());
106 return StackAlign.
value();
110 if (!DirectCallee && CB)
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
A parsed version of the target data layout string in and methods for querying it.
This is an abstract virtual class for memory operations.
EVT getMemoryVT() const
Return the type of the in-memory value.
unsigned getNumValues() const
Return the number of values defined/returned by this operator.
The instances of the Type class are immutable: once they are created, they are never changed.
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.
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.
constexpr bool isPowerOf2_32(uint32_t Value)
Return true if the argument is a power of two > 0.
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)
Function * getMaybeBitcastedCallee(const CallBase *CB)
MaybeAlign getStackAlign(const Function &F, unsigned Index)
unsigned getFromTypeWidthForLoad(const MemSDNode *Mem)
The bit-width of a single element loaded by Mem, i.e.
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.
TypeSize getSizeInBits() const
Return the size of the specified value type in bits.
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.