Go to the documentation of this file.
25 "classifyPointerType called with non-opaque pointer");
26 Type *PointeeTy =
nullptr;
27 if (
auto *Inst = dyn_cast<GetElementPtrInst>(V)) {
28 if (!Inst->getResultElementType()->isOpaquePointerTy())
29 PointeeTy = Inst->getResultElementType();
30 }
else if (
auto *Inst = dyn_cast<AllocaInst>(V)) {
31 PointeeTy = Inst->getAllocatedType();
34 Type *NewPointeeTy =
nullptr;
35 if (
const auto *Inst = dyn_cast<LoadInst>(
User)) {
36 NewPointeeTy = Inst->getType();
37 }
else if (
const auto *Inst = dyn_cast<StoreInst>(
User)) {
38 NewPointeeTy = Inst->getValueOperand()->getType();
39 }
else if (
const auto *Inst = dyn_cast<GetElementPtrInst>(
User)) {
40 NewPointeeTy = Inst->getSourceElementType();
50 PointeeTy = NewPointeeTy;
51 else if (PointeeTy != NewPointeeTy)
67 bool HasOpaqueTy =
false;
68 Type *RetTy =
F.getReturnType();
71 for (
const auto &
B :
F) {
72 for (
const auto &
I :
B) {
73 if (
const auto *RetInst = dyn_cast_or_null<ReturnInst>(&
I)) {
74 Type *NewRetTy = classifyPointerType(RetInst->getReturnValue());
77 else if (RetTy != NewRetTy)
80 F.getReturnType()->getPointerAddressSpace());
85 for (
auto &A :
F.args()) {
86 Type *ArgTy =
A.getType();
93 NewArgs.push_back(ArgTy);
103 for (
auto &
G :
M.globals()) {
104 if (
G.getType()->isOpaquePointerTy())
105 Map[&
G] = classifyPointerType(&
G);
108 classifyFunctionType(
F, Map);
110 for (
const auto &
B :
F) {
111 for (
const auto &
I :
B) {
112 if (
I.getType()->isOpaquePointerTy())
113 Map[&
I] = classifyPointerType(&
I);
This is an optimization pass for GlobalISel generic memory operations.
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
static FunctionType * get(Type *Result, ArrayRef< Type * > Params, bool isVarArg)
This static method is the primary way of constructing a FunctionType.
The instances of the Type class are immutable: once they are created, they are never changed.
static IntegerType * getInt8Ty(LLVMContext &C)
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
PointerTypeMap run(const Module &M)
Compute the PointerTypeMap for the module M.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
A Module instance is used to store all the information related to an LLVM module.
Type * getType() const
All values are typed, get the type of this value.
LLVMContext & getContext() const
All values hold a context through their type.
bool isOpaquePointerTy() const
True if this is an instance of an opaque PointerType.
LLVM Value Representation.
iterator_range< user_iterator > users()
static TypedPointerType * get(Type *ElementType, unsigned AddressSpace)
This constructs a pointer to an object of the specified type in a numbered address space.