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 = Inst->getValOperand()->getType();
69 NewPointeeTy = Inst->getNewValOperand()->getType();
71 NewPointeeTy =
GEP->getSourceElementType();
78 PointeeTy = classifyPointerType(
User, Map);
82 PointeeTy = NewPointeeTy;
83 else if (PointeeTy != NewPointeeTy)
105 auto It =
Map.find(&
F);
110 Type *RetTy =
F.getReturnType();
114 for (
const auto &
B :
F) {
119 Type *NewRetTy = classifyPointerType(RetInst->getReturnValue(), Map);
122 else if (RetTy != NewRetTy)
131 for (
auto &
A :
F.args()) {
132 Type *ArgTy =
A.getType();
134 ArgTy = classifyPointerType(&
A, Map);
139 Map[&
F] = TypedPtrTy;
152 C->getType()->getPointerAddressSpace());
158 auto It = Map.find(
C);
163 return classifyFunctionType(*
F, Map);
165 Type *Ty =
C->getType();
166 Type *TargetTy =
nullptr;
169 for (
unsigned int I = 0;
I < CS->getNumOperands(); ++
I) {
170 const Constant *Elt =
C->getAggregateElement(
I);
177 Type *TargetEltTy =
nullptr;
178 for (
auto &Elt : CA->operands()) {
180 assert(TargetEltTy == EltTy || TargetEltTy ==
nullptr);
193 assert(TargetTy &&
"PointerTypeAnalyisis failed to identify target type");
209 "global_ctors should be a ConstantArray or ConstantAggregateZero");
222 for (
auto &
G : M.globals()) {
223 if (
G.getType()->isPointerTy())
224 classifyPointerType(&
G, Map);
225 if (
G.getName() ==
"llvm.global_ctors")
230 classifyFunctionType(
F, Map);
232 for (
const auto &
B :
F) {
233 for (
const auto &
I :
B) {
234 if (
I.getType()->isPointerTy())
235 classifyPointerType(&
I, Map);
236 for (
const auto &O :
I.operands())
237 if (O.get()->getType()->isPointerTy())
238 classifyPointerType(O.get(), Map);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
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.
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.