30 assert(V->getType()->isPointerTy() &&
31 "classifyPointerType called with non-pointer");
36 return classifyFunctionType(*
F, Map);
41 GV->removeDeadConstantUsers();
43 auto It =
Map.find(V);
47 Type *PointeeTy =
nullptr;
49 if (!
GEP->getResultElementType()->isPointerTy())
50 PointeeTy =
GEP->getResultElementType();
52 PointeeTy = Inst->getAllocatedType();
54 PointeeTy = GV->getValueType();
58 Type *NewPointeeTy =
nullptr;
60 NewPointeeTy = Inst->getType();
62 NewPointeeTy = Inst->getValueOperand()->getType();
67 NewPointeeTy =
GEP->getSourceElementType();
74 PointeeTy = classifyPointerType(
User, Map);
78 PointeeTy = NewPointeeTy;
79 else if (PointeeTy != NewPointeeTy)
97 auto It =
Map.find(&
F);
102 Type *RetTy =
F.getReturnType();
106 for (
const auto &
B :
F) {
111 Type *NewRetTy = classifyPointerType(RetInst->getReturnValue(), Map);
114 else if (RetTy != NewRetTy)
123 for (
auto &
A :
F.args()) {
124 Type *ArgTy =
A.getType();
126 ArgTy = classifyPointerType(&
A, Map);
131 Map[&
F] = TypedPtrTy;
143 C->getType()->getPointerAddressSpace());
149 auto It = Map.find(
C);
154 return classifyFunctionType(*
F, Map);
156 Type *Ty =
C->getType();
157 Type *TargetTy =
nullptr;
160 for (
unsigned int I = 0;
I < CS->getNumOperands(); ++
I) {
161 const Constant *Elt =
C->getAggregateElement(
I);
168 Type *TargetEltTy =
nullptr;
169 for (
auto &Elt : CA->operands()) {
171 assert(TargetEltTy == EltTy || TargetEltTy ==
nullptr);
184 assert(TargetTy &&
"PointerTypeAnalyisis failed to identify target type");
207 for (
auto &
G : M.globals()) {
208 if (
G.getType()->isPointerTy())
209 classifyPointerType(&
G, Map);
210 if (
G.getName() ==
"llvm.global_ctors")
215 classifyFunctionType(
F, Map);
217 for (
const auto &
B :
F) {
218 for (
const auto &
I :
B) {
219 if (
I.getType()->isPointerTy())
220 classifyPointerType(&
I, Map);
221 for (
const auto &O :
I.operands())
222 if (O.get()->getType()->isPointerTy())
223 classifyPointerType(O.get(), Map);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
This file contains the declarations for the subclasses of Constant, which represent the different fla...
Module.h This file contains the declarations for the Module class.
static Type * classifyConstantWithOpaquePtr(const Constant *C, PointerTypeMap &Map)
static void classifyGlobalCtorPointerType(const GlobalVariable &GV, PointerTypeMap &Map)
static LLVM_ABI ArrayType * get(Type *ElementType, uint64_t NumElements)
This static method is the primary way to construct an ArrayType.
This is an important base class in LLVM.
static LLVM_ABI FunctionType * get(Type *Result, ArrayRef< Type * > Params, bool isVarArg)
This static method is the primary way of constructing a FunctionType.
PointerType * getType() const
Global values are always pointers.
const Constant * getInitializer() const
getInitializer - Return the initializer for this global variable.
This is an important class for using LLVM in a threaded context.
A Module instance is used to store all the information related to an LLVM module.
reference emplace_back(ArgTypes &&... Args)
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
static LLVM_ABI StructType * get(LLVMContext &Context, ArrayRef< Type * > Elements, bool isPacked=false)
This static method is the primary way to create a literal StructType.
The instances of the Type class are immutable: once they are created, they are never changed.
bool isPointerTy() const
True if this is an instance of PointerType.
LLVM_ABI unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
static LLVM_ABI IntegerType * getInt8Ty(LLVMContext &C)
static LLVM_ABI TypedPointerType * get(Type *ElementType, unsigned AddressSpace)
This constructs a pointer to an object of the specified type in a numbered address space.
LLVM Value Representation.
iterator_range< user_iterator > users()
static LLVM_ABI VectorType * get(Type *ElementType, ElementCount EC)
This static method is the primary way to construct an VectorType.
@ C
The default llvm calling convention, compatible with C.
PointerTypeMap run(const Module &M)
Compute the PointerTypeMap for the module M.
DenseMap< const Value *, Type * > PointerTypeMap
This is an optimization pass for GlobalISel generic memory operations.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
auto dyn_cast_or_null(const Y &Val)
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...
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.