Go to the documentation of this file.
22 #define DEBUG_TYPE "ctor_utils"
32 if (!CtorsToRemove.
test(
I))
67 return std::vector<Function *>();
69 std::vector<Function *> Result;
73 Result.push_back(dyn_cast<Function>(CS->
getOperand(1)));
95 if (isa<ConstantAggregateZero>(V))
98 if (isa<ConstantPointerNull>(CS->
getOperand(1)))
126 bool MadeChange =
false;
129 unsigned NumCtors = Ctors.size();
131 for (
unsigned i = 0;
i != Ctors.size() && NumCtors > 0; ++
i) {
145 if (ShouldRemove(
F)) {
147 CtorsToRemove.
set(
i);
void eraseFromParent()
eraseFromParent - This method unlinks 'this' from the containing module and deletes it.
bool hasUniqueInitializer() const
hasUniqueInitializer - Whether the global variable has an initializer, and any changes made to the in...
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
bool optimizeGlobalCtorsList(Module &M, function_ref< bool(Function *)> ShouldRemove)
Call "ShouldRemove" for every entry in M's global_ctor list and remove the entries for which it retur...
LinkageTypes getLinkage() const
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
static Constant * getBitCast(Constant *C, Type *Ty, bool OnlyIfReduced=false)
Class to represent array types.
const GlobalListType & getGlobalList() const
Get the Module's list of global variables (constant).
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
This is the shared class of boolean and integer constants.
static void removeGlobalCtors(GlobalVariable *GCL, const BitVector &CtorsToRemove)
Given a specified llvm.global_ctors list, remove the listed elements.
bool isNullValue() const
Return true if this is the value that would be returned by getNullValue.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
ThreadLocalMode getThreadLocalMode() const
ConstantArray - Constant Array Declarations.
An efficient, type-erasing, non-owning reference to a callable.
static std::vector< Function * > parseGlobalCtors(GlobalVariable *GV)
Given a llvm.global_ctors list that we can understand, return a list of the functions and null termin...
ArrayType * getType() const
Specialize the getType() method to always return an ArrayType, which reduces the amount of casting ne...
const Constant * getInitializer() const
getInitializer - Return the initializer for this global variable.
This is an important base class in LLVM.
Module * getParent()
Get the module that this global value is contained inside of...
static ArrayType * get(Type *ElementType, uint64_t NumElements)
This static method is the primary way to construct an ArrayType.
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.
void replaceAllUsesWith(Value *V)
Change all uses of this to point to a new Value.
self_iterator getIterator()
uint64_t getZExtValue() const
Return the constant as a 64-bit unsigned integer value after it has been zero extended as appropriate...
bool test(unsigned Idx) const
static GlobalVariable * findGlobalCtors(Module &M)
Find the llvm.global_ctors list, verifying that all initializers have an init priority of 65535.
static Constant * get(ArrayType *T, ArrayRef< Constant * > V)
unsigned getNumOperands() const
bool isConstant() const
If the value is a global constant, its value is immutable throughout the runtime execution of the pro...
PointerType * getType() const
Global values are always pointers.
void takeName(Value *V)
Transfer the name from V to this value.
Value * getOperand(unsigned i) const
Type * getElementType() const
void setInitializer(Constant *InitVal)
setInitializer - Sets the initializer for this global variable, removing any existing initializer if ...