mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-21 08:17:40 +00:00
Push LLVMContext through GlobalVariables and IRBuilder.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74985 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -490,12 +490,13 @@ static GlobalVariable *SRAGlobal(GlobalVariable *GV, const TargetData &TD,
|
||||
Context->getConstantInt(Type::Int32Ty, i),
|
||||
Context);
|
||||
assert(In && "Couldn't get element of initializer?");
|
||||
GlobalVariable *NGV = new GlobalVariable(STy->getElementType(i), false,
|
||||
GlobalVariable *NGV = new GlobalVariable(*Context, STy->getElementType(i),
|
||||
false,
|
||||
GlobalVariable::InternalLinkage,
|
||||
In, GV->getName()+"."+utostr(i),
|
||||
(Module *)NULL,
|
||||
GV->isThreadLocal(),
|
||||
GV->getType()->getAddressSpace());
|
||||
GV->getType()->getAddressSpace());
|
||||
Globals.insert(GV, NGV);
|
||||
NewGlobals.push_back(NGV);
|
||||
|
||||
@@ -526,7 +527,8 @@ static GlobalVariable *SRAGlobal(GlobalVariable *GV, const TargetData &TD,
|
||||
Context);
|
||||
assert(In && "Couldn't get element of initializer?");
|
||||
|
||||
GlobalVariable *NGV = new GlobalVariable(STy->getElementType(), false,
|
||||
GlobalVariable *NGV = new GlobalVariable(*Context, STy->getElementType(),
|
||||
false,
|
||||
GlobalVariable::InternalLinkage,
|
||||
In, GV->getName()+"."+utostr(i),
|
||||
(Module *)NULL,
|
||||
@@ -841,7 +843,8 @@ static GlobalVariable *OptimizeGlobalAddressOfMalloc(GlobalVariable *GV,
|
||||
// Create the new global variable. The contents of the malloc'd memory is
|
||||
// undefined, so initialize with an undef value.
|
||||
Constant *Init = Context->getUndef(MI->getAllocatedType());
|
||||
GlobalVariable *NewGV = new GlobalVariable(MI->getAllocatedType(), false,
|
||||
GlobalVariable *NewGV = new GlobalVariable(*Context, MI->getAllocatedType(),
|
||||
false,
|
||||
GlobalValue::InternalLinkage, Init,
|
||||
GV->getName()+".body",
|
||||
(Module *)NULL,
|
||||
@@ -862,7 +865,8 @@ static GlobalVariable *OptimizeGlobalAddressOfMalloc(GlobalVariable *GV,
|
||||
// If there is a comparison against null, we will insert a global bool to
|
||||
// keep track of whether the global was initialized yet or not.
|
||||
GlobalVariable *InitBool =
|
||||
new GlobalVariable(Type::Int1Ty, false, GlobalValue::InternalLinkage,
|
||||
new GlobalVariable(*Context, Type::Int1Ty, false,
|
||||
GlobalValue::InternalLinkage,
|
||||
Context->getConstantIntFalse(), GV->getName()+".init",
|
||||
(Module *)NULL, GV->isThreadLocal());
|
||||
bool InitBoolUsed = false;
|
||||
@@ -1282,7 +1286,8 @@ static GlobalVariable *PerformHeapAllocSRoA(GlobalVariable *GV, MallocInst *MI,
|
||||
const Type *PFieldTy = Context->getPointerTypeUnqual(FieldTy);
|
||||
|
||||
GlobalVariable *NGV =
|
||||
new GlobalVariable(PFieldTy, false, GlobalValue::InternalLinkage,
|
||||
new GlobalVariable(*Context, PFieldTy, false,
|
||||
GlobalValue::InternalLinkage,
|
||||
Context->getNullValue(PFieldTy),
|
||||
GV->getName() + ".f" + utostr(FieldNo), GV,
|
||||
GV->isThreadLocal());
|
||||
@@ -1579,7 +1584,7 @@ static bool TryToShrinkGlobalToBoolean(GlobalVariable *GV, Constant *OtherVal,
|
||||
DOUT << " *** SHRINKING TO BOOL: " << *GV;
|
||||
|
||||
// Create the new global, initializing it to false.
|
||||
GlobalVariable *NewGV = new GlobalVariable(Type::Int1Ty, false,
|
||||
GlobalVariable *NewGV = new GlobalVariable(*Context, Type::Int1Ty, false,
|
||||
GlobalValue::InternalLinkage, Context->getConstantIntFalse(),
|
||||
GV->getName()+".b",
|
||||
(Module *)NULL,
|
||||
@@ -1974,7 +1979,8 @@ static GlobalVariable *InstallGlobalCtors(GlobalVariable *GCL,
|
||||
}
|
||||
|
||||
// Create the new global and insert it next to the existing list.
|
||||
GlobalVariable *NGV = new GlobalVariable(CA->getType(), GCL->isConstant(),
|
||||
GlobalVariable *NGV = new GlobalVariable(*Context, CA->getType(),
|
||||
GCL->isConstant(),
|
||||
GCL->getLinkage(), CA, "",
|
||||
(Module *)NULL,
|
||||
GCL->isThreadLocal());
|
||||
@@ -2222,7 +2228,7 @@ static bool EvaluateFunction(Function *F, Constant *&RetVal,
|
||||
} else if (AllocaInst *AI = dyn_cast<AllocaInst>(CurInst)) {
|
||||
if (AI->isArrayAllocation()) return false; // Cannot handle array allocs.
|
||||
const Type *Ty = AI->getType()->getElementType();
|
||||
AllocaTmps.push_back(new GlobalVariable(Ty, false,
|
||||
AllocaTmps.push_back(new GlobalVariable(*Context, Ty, false,
|
||||
GlobalValue::InternalLinkage,
|
||||
Context->getUndef(Ty),
|
||||
AI->getName()));
|
||||
|
||||
Reference in New Issue
Block a user