mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Extend the IL for selecting TLS models (PR9788)
This allows the user/front-end to specify a model that is better than what LLVM would choose by default. For example, a variable might be declared as @x = thread_local(initialexec) global i32 42 if it will not be used in a shared library that is dlopen'ed. If the specified model isn't supported by the target, or if LLVM can make a better choice, a different model may be used. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159077 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -517,7 +517,7 @@ static GlobalVariable *SRAGlobal(GlobalVariable *GV, const TargetData &TD) {
|
||||
GlobalVariable *NGV = new GlobalVariable(STy->getElementType(i), false,
|
||||
GlobalVariable::InternalLinkage,
|
||||
In, GV->getName()+"."+Twine(i),
|
||||
GV->isThreadLocal(),
|
||||
GV->getThreadLocalMode(),
|
||||
GV->getType()->getAddressSpace());
|
||||
Globals.insert(GV, NGV);
|
||||
NewGlobals.push_back(NGV);
|
||||
@@ -550,7 +550,7 @@ static GlobalVariable *SRAGlobal(GlobalVariable *GV, const TargetData &TD) {
|
||||
GlobalVariable *NGV = new GlobalVariable(STy->getElementType(), false,
|
||||
GlobalVariable::InternalLinkage,
|
||||
In, GV->getName()+"."+Twine(i),
|
||||
GV->isThreadLocal(),
|
||||
GV->getThreadLocalMode(),
|
||||
GV->getType()->getAddressSpace());
|
||||
Globals.insert(GV, NGV);
|
||||
NewGlobals.push_back(NGV);
|
||||
@@ -866,7 +866,7 @@ static GlobalVariable *OptimizeGlobalAddressOfMalloc(GlobalVariable *GV,
|
||||
UndefValue::get(GlobalType),
|
||||
GV->getName()+".body",
|
||||
GV,
|
||||
GV->isThreadLocal());
|
||||
GV->getThreadLocalMode());
|
||||
|
||||
// If there are bitcast users of the malloc (which is typical, usually we have
|
||||
// a malloc + bitcast) then replace them with uses of the new global. Update
|
||||
@@ -899,7 +899,7 @@ static GlobalVariable *OptimizeGlobalAddressOfMalloc(GlobalVariable *GV,
|
||||
new GlobalVariable(Type::getInt1Ty(GV->getContext()), false,
|
||||
GlobalValue::InternalLinkage,
|
||||
ConstantInt::getFalse(GV->getContext()),
|
||||
GV->getName()+".init", GV->isThreadLocal());
|
||||
GV->getName()+".init", GV->getThreadLocalMode());
|
||||
bool InitBoolUsed = false;
|
||||
|
||||
// Loop over all uses of GV, processing them in turn.
|
||||
@@ -1321,7 +1321,7 @@ static GlobalVariable *PerformHeapAllocSRoA(GlobalVariable *GV, CallInst *CI,
|
||||
PFieldTy, false, GlobalValue::InternalLinkage,
|
||||
Constant::getNullValue(PFieldTy),
|
||||
GV->getName() + ".f" + Twine(FieldNo), GV,
|
||||
GV->isThreadLocal());
|
||||
GV->getThreadLocalMode());
|
||||
FieldGlobals.push_back(NGV);
|
||||
|
||||
unsigned TypeSize = TD->getTypeAllocSize(FieldTy);
|
||||
@@ -1647,7 +1647,7 @@ static bool TryToShrinkGlobalToBoolean(GlobalVariable *GV, Constant *OtherVal) {
|
||||
GlobalValue::InternalLinkage,
|
||||
ConstantInt::getFalse(GV->getContext()),
|
||||
GV->getName()+".b",
|
||||
GV->isThreadLocal());
|
||||
GV->getThreadLocalMode());
|
||||
GV->getParent()->getGlobalList().insert(GV, NewGV);
|
||||
|
||||
Constant *InitVal = GV->getInitializer();
|
||||
@@ -2054,7 +2054,7 @@ 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(),
|
||||
GCL->getLinkage(), CA, "",
|
||||
GCL->isThreadLocal());
|
||||
GCL->getThreadLocalMode());
|
||||
GCL->getParent()->getGlobalList().insert(GCL, NGV);
|
||||
NGV->takeName(GCL);
|
||||
|
||||
|
@@ -511,7 +511,7 @@ bool AddressSanitizer::insertGlobalRedzones(Module &M) {
|
||||
// Create a new global variable with enough space for a redzone.
|
||||
GlobalVariable *NewGlobal = new GlobalVariable(
|
||||
M, NewTy, G->isConstant(), G->getLinkage(),
|
||||
NewInitializer, "", G, G->isThreadLocal());
|
||||
NewInitializer, "", G, G->getThreadLocalMode());
|
||||
NewGlobal->copyAttributesFrom(G);
|
||||
NewGlobal->setAlignment(RedzoneSize);
|
||||
|
||||
|
@@ -448,7 +448,7 @@ bool GCOVProfiler::emitProfileArcs() {
|
||||
new GlobalVariable(*M, CounterTy, false,
|
||||
GlobalValue::InternalLinkage,
|
||||
Constant::getNullValue(CounterTy),
|
||||
"__llvm_gcov_ctr", 0, false, 0);
|
||||
"__llvm_gcov_ctr");
|
||||
CountersBySP.push_back(std::make_pair(Counters, (MDNode*)SP));
|
||||
|
||||
UniqueVector<BasicBlock *> ComplexEdgePreds;
|
||||
|
@@ -53,7 +53,7 @@ Module *llvm::CloneModule(const Module *M, ValueToValueMapTy &VMap) {
|
||||
I->isConstant(), I->getLinkage(),
|
||||
(Constant*) 0, I->getName(),
|
||||
(GlobalVariable*) 0,
|
||||
I->isThreadLocal(),
|
||||
I->getThreadLocalMode(),
|
||||
I->getType()->getAddressSpace());
|
||||
GV->copyAttributesFrom(I);
|
||||
VMap[I] = GV;
|
||||
|
Reference in New Issue
Block a user