19 auto *HandleTy = cast<TargetExtType>(Handle->
getValueType());
20 assert(HandleTy->getName().ends_with(
".CBuffer") &&
"Not a cbuffer type");
21 assert(HandleTy->getNumTypeParameters() == 1 &&
"Expected layout type");
23 auto *LayoutTy = cast<TargetExtType>(HandleTy->getTypeParameter(0));
24 assert(LayoutTy->getName().ends_with(
".Layout") &&
"Not a layout type");
27 size_t ParamIndex = Index + 1;
28 assert(LayoutTy->getNumIntParameters() > ParamIndex &&
29 "Not enough parameters");
31 return LayoutTy->getIntParameter(ParamIndex);
35 NamedMDNode *CBufMD = M.getNamedMetadata(
"hlsl.cbs");
39 std::optional<CBufferMetadata> Result({CBufMD});
44 auto *Handle = cast<GlobalVariable>(
45 cast<ValueAsMetadata>(MD->
getOperand(0))->getValue());
53 auto *V = cast<GlobalVariable>(cast<ValueAsMetadata>(OpMD)->getValue());
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static size_t getMemberOffset(GlobalVariable *Handle, size_t Index)
Module.h This file contains the declarations for the Module class.
Class for arbitrary precision integers.
Class to represent array types.
Type * getElementType() const
A parsed version of the target data layout string in and methods for querying it.
Type * getValueType() const
A Module instance is used to store all the information related to an LLVM module.
LLVM_ABI void eraseFromParent()
Drop all references and remove the node from parent module.
LLVM_ABI MDNode * getOperand(unsigned i) const
LLVM_ABI unsigned getNumOperands() const
iterator_range< op_iterator > operands()
const unsigned CBufferRowSizeInBytes
APInt translateCBufArrayOffset(const DataLayout &DL, APInt Offset, ArrayType *Ty)
This is an optimization pass for GlobalISel generic memory operations.
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
This struct is a compact representation of a valid (non-zero power of two) alignment.
SmallVector< CBufferMember > Members