mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-09-30 19:55:11 +00:00
Revert r7561{9,8,7,6}, which depend on r75610.
--- Reverse-merging r75619 into '.': U lib/Target/DarwinTargetAsmInfo.cpp U lib/CodeGen/AsmPrinter/AsmPrinter.cpp --- Reverse-merging r75618 into '.': U lib/CodeGen/ELFWriter.cpp U lib/CodeGen/MachOCodeEmitter.cpp U lib/CodeGen/MachOWriter.cpp --- Reverse-merging r75617 into '.': U lib/Target/CBackend/CBackend.cpp --- Reverse-merging r75616 into '.': U tools/bugpoint/Miscompilation.cpp U tools/lto/LTOCodeGenerator.cpp U tools/lto/LTOModule.cpp git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75638 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
192957d376
commit
1f316e321a
@ -210,13 +210,13 @@ bool AsmPrinter::doFinalization(Module &M) {
|
|||||||
for (Module::const_global_iterator I = M.global_begin(), E = M.global_end();
|
for (Module::const_global_iterator I = M.global_begin(), E = M.global_end();
|
||||||
I != E; ++I) {
|
I != E; ++I) {
|
||||||
if (I->hasExternalWeakLinkage())
|
if (I->hasExternalWeakLinkage())
|
||||||
O << TAI->getWeakRefDirective() << Mang->getMangledName(I) << '\n';
|
O << TAI->getWeakRefDirective() << Mang->getValueName(I) << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Module::const_iterator I = M.begin(), E = M.end();
|
for (Module::const_iterator I = M.begin(), E = M.end();
|
||||||
I != E; ++I) {
|
I != E; ++I) {
|
||||||
if (I->hasExternalWeakLinkage())
|
if (I->hasExternalWeakLinkage())
|
||||||
O << TAI->getWeakRefDirective() << Mang->getMangledName(I) << '\n';
|
O << TAI->getWeakRefDirective() << Mang->getValueName(I) << '\n';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,10 +227,11 @@ bool AsmPrinter::doFinalization(Module &M) {
|
|||||||
O << '\n';
|
O << '\n';
|
||||||
for (Module::const_alias_iterator I = M.alias_begin(), E = M.alias_end();
|
for (Module::const_alias_iterator I = M.alias_begin(), E = M.alias_end();
|
||||||
I != E; ++I) {
|
I != E; ++I) {
|
||||||
std::string Name = Mang->getMangledName(I);
|
std::string Name = Mang->getValueName(I);
|
||||||
|
std::string Target;
|
||||||
|
|
||||||
const GlobalValue *GV = cast<GlobalValue>(I->getAliasedGlobal());
|
const GlobalValue *GV = cast<GlobalValue>(I->getAliasedGlobal());
|
||||||
std::string Target = Mang->getMangledName(GV);
|
Target = Mang->getValueName(GV);
|
||||||
|
|
||||||
if (I->hasExternalLinkage() || !TAI->getWeakRefDirective())
|
if (I->hasExternalLinkage() || !TAI->getWeakRefDirective())
|
||||||
O << "\t.globl\t" << Name << '\n';
|
O << "\t.globl\t" << Name << '\n';
|
||||||
@ -269,16 +270,15 @@ AsmPrinter::getCurrentFunctionEHName(const MachineFunction *MF,
|
|||||||
assert(MF && "No machine function?");
|
assert(MF && "No machine function?");
|
||||||
Name = MF->getFunction()->getName();
|
Name = MF->getFunction()->getName();
|
||||||
if (Name.empty())
|
if (Name.empty())
|
||||||
Name = Mang->getMangledName(MF->getFunction());
|
Name = Mang->getValueName(MF->getFunction());
|
||||||
|
|
||||||
// FIXME: THIS SEEMS REALLY WRONG, it will get two prefixes.
|
|
||||||
Name = Mang->makeNameProper(TAI->getEHGlobalPrefix() + Name + ".eh");
|
Name = Mang->makeNameProper(TAI->getEHGlobalPrefix() + Name + ".eh");
|
||||||
return Name;
|
return Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AsmPrinter::SetupMachineFunction(MachineFunction &MF) {
|
void AsmPrinter::SetupMachineFunction(MachineFunction &MF) {
|
||||||
// What's my mangled name?
|
// What's my mangled name?
|
||||||
CurrentFnName = Mang->getMangledName(MF.getFunction());
|
CurrentFnName = Mang->getValueName(MF.getFunction());
|
||||||
IncrementFunctionNumber();
|
IncrementFunctionNumber();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -576,11 +576,11 @@ const std::string &AsmPrinter::getGlobalLinkName(const GlobalVariable *GV,
|
|||||||
std::string &LinkName) const {
|
std::string &LinkName) const {
|
||||||
if (isa<Function>(GV)) {
|
if (isa<Function>(GV)) {
|
||||||
LinkName += TAI->getFunctionAddrPrefix();
|
LinkName += TAI->getFunctionAddrPrefix();
|
||||||
LinkName += Mang->getMangledName(GV);
|
LinkName += Mang->getValueName(GV);
|
||||||
LinkName += TAI->getFunctionAddrSuffix();
|
LinkName += TAI->getFunctionAddrSuffix();
|
||||||
} else {
|
} else {
|
||||||
LinkName += TAI->getGlobalVarAddrPrefix();
|
LinkName += TAI->getGlobalVarAddrPrefix();
|
||||||
LinkName += Mang->getMangledName(GV);
|
LinkName += Mang->getValueName(GV);
|
||||||
LinkName += TAI->getGlobalVarAddrSuffix();
|
LinkName += TAI->getGlobalVarAddrSuffix();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -858,11 +858,11 @@ void AsmPrinter::EmitConstantValueOnly(const Constant *CV) {
|
|||||||
// FunctionAddrPrefix/Suffix (these all default to "" )
|
// FunctionAddrPrefix/Suffix (these all default to "" )
|
||||||
if (isa<Function>(GV)) {
|
if (isa<Function>(GV)) {
|
||||||
O << TAI->getFunctionAddrPrefix()
|
O << TAI->getFunctionAddrPrefix()
|
||||||
<< Mang->getMangledName(GV)
|
<< Mang->getValueName(GV)
|
||||||
<< TAI->getFunctionAddrSuffix();
|
<< TAI->getFunctionAddrSuffix();
|
||||||
} else {
|
} else {
|
||||||
O << TAI->getGlobalVarAddrPrefix()
|
O << TAI->getGlobalVarAddrPrefix()
|
||||||
<< Mang->getMangledName(GV)
|
<< Mang->getValueName(GV)
|
||||||
<< TAI->getGlobalVarAddrSuffix();
|
<< TAI->getGlobalVarAddrSuffix();
|
||||||
}
|
}
|
||||||
} else if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(CV)) {
|
} else if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(CV)) {
|
||||||
|
@ -601,7 +601,7 @@ void ELFWriter::EmitStringTable() {
|
|||||||
|
|
||||||
// Use the name mangler to uniquify the LLVM symbol.
|
// Use the name mangler to uniquify the LLVM symbol.
|
||||||
std::string Name;
|
std::string Name;
|
||||||
if (I->GV) Name.append(Mang->getMangledName(I->GV));
|
if (I->GV) Name.append(Mang->getValueName(I->GV));
|
||||||
|
|
||||||
if (Name.empty()) {
|
if (Name.empty()) {
|
||||||
I->NameIdx = 0;
|
I->NameIdx = 0;
|
||||||
|
@ -60,7 +60,7 @@ void MachOCodeEmitter::startFunction(MachineFunction &MF) {
|
|||||||
|
|
||||||
// Create symbol for function entry
|
// Create symbol for function entry
|
||||||
const GlobalValue *FuncV = MF.getFunction();
|
const GlobalValue *FuncV = MF.getFunction();
|
||||||
MachOSym FnSym(FuncV, MOW.Mang->getMangledName(FuncV), MOS->Index, TAI);
|
MachOSym FnSym(FuncV, MOW.Mang->getValueName(FuncV), MOS->Index, TAI);
|
||||||
FnSym.n_value = getCurrentPCOffset();
|
FnSym.n_value = getCurrentPCOffset();
|
||||||
|
|
||||||
// add it to the symtab.
|
// add it to the symtab.
|
||||||
|
@ -221,7 +221,7 @@ void MachOWriter::AddSymbolToSection(MachOSection *Sec, GlobalVariable *GV) {
|
|||||||
}
|
}
|
||||||
// Globals without external linkage apparently do not go in the symbol table.
|
// Globals without external linkage apparently do not go in the symbol table.
|
||||||
if (!GV->hasLocalLinkage()) {
|
if (!GV->hasLocalLinkage()) {
|
||||||
MachOSym Sym(GV, Mang->getMangledName(GV), Sec->Index, TAI);
|
MachOSym Sym(GV, Mang->getValueName(GV), Sec->Index, TAI);
|
||||||
Sym.n_value = Sec->size();
|
Sym.n_value = Sec->size();
|
||||||
SymbolTable.push_back(Sym);
|
SymbolTable.push_back(Sym);
|
||||||
}
|
}
|
||||||
@ -255,7 +255,7 @@ void MachOWriter::EmitGlobal(GlobalVariable *GV) {
|
|||||||
// merged with other symbols.
|
// merged with other symbols.
|
||||||
if (NoInit || GV->hasLinkOnceLinkage() || GV->hasWeakLinkage() ||
|
if (NoInit || GV->hasLinkOnceLinkage() || GV->hasWeakLinkage() ||
|
||||||
GV->hasCommonLinkage()) {
|
GV->hasCommonLinkage()) {
|
||||||
MachOSym ExtOrCommonSym(GV, Mang->getMangledName(GV),
|
MachOSym ExtOrCommonSym(GV, Mang->getValueName(GV),
|
||||||
MachOSym::NO_SECT, TAI);
|
MachOSym::NO_SECT, TAI);
|
||||||
// For undefined (N_UNDF) external (N_EXT) types, n_value is the size in
|
// For undefined (N_UNDF) external (N_EXT) types, n_value is the size in
|
||||||
// bytes of the symbol.
|
// bytes of the symbol.
|
||||||
@ -454,7 +454,7 @@ void MachOWriter::BufferSymbolAndStringTable() {
|
|||||||
for (std::vector<GlobalValue*>::iterator I = PendingGlobals.begin(),
|
for (std::vector<GlobalValue*>::iterator I = PendingGlobals.begin(),
|
||||||
E = PendingGlobals.end(); I != E; ++I) {
|
E = PendingGlobals.end(); I != E; ++I) {
|
||||||
if (GVOffset[*I] == 0 && GVSection[*I] == 0) {
|
if (GVOffset[*I] == 0 && GVSection[*I] == 0) {
|
||||||
MachOSym UndfSym(*I, Mang->getMangledName(*I), MachOSym::NO_SECT, TAI);
|
MachOSym UndfSym(*I, Mang->getValueName(*I), MachOSym::NO_SECT, TAI);
|
||||||
SymbolTable.push_back(UndfSym);
|
SymbolTable.push_back(UndfSym);
|
||||||
GVOffset[*I] = -1;
|
GVOffset[*I] = -1;
|
||||||
}
|
}
|
||||||
|
@ -1432,7 +1432,7 @@ void CWriter::printConstantWithCast(Constant* CPV, unsigned Opcode) {
|
|||||||
std::string CWriter::GetValueName(const Value *Operand) {
|
std::string CWriter::GetValueName(const Value *Operand) {
|
||||||
// Mangle globals with the standard mangler interface for LLC compatibility.
|
// Mangle globals with the standard mangler interface for LLC compatibility.
|
||||||
if (const GlobalValue *GV = dyn_cast<GlobalValue>(Operand))
|
if (const GlobalValue *GV = dyn_cast<GlobalValue>(Operand))
|
||||||
return Mang->getMangledName(GV);
|
return Mang->getValueName(GV);
|
||||||
|
|
||||||
std::string Name = Operand->getName();
|
std::string Name = Operand->getName();
|
||||||
|
|
||||||
|
@ -103,21 +103,18 @@ DarwinTargetAsmInfo::DarwinTargetAsmInfo(const TargetMachine &TM)
|
|||||||
/// emitUsedDirectiveFor - On Darwin, internally linked data beginning with
|
/// emitUsedDirectiveFor - On Darwin, internally linked data beginning with
|
||||||
/// the PrivateGlobalPrefix or the LessPrivateGlobalPrefix does not have the
|
/// the PrivateGlobalPrefix or the LessPrivateGlobalPrefix does not have the
|
||||||
/// directive emitted (this occurs in ObjC metadata).
|
/// directive emitted (this occurs in ObjC metadata).
|
||||||
|
|
||||||
bool
|
bool
|
||||||
DarwinTargetAsmInfo::emitUsedDirectiveFor(const GlobalValue* GV,
|
DarwinTargetAsmInfo::emitUsedDirectiveFor(const GlobalValue* GV,
|
||||||
Mangler *Mang) const {
|
Mangler *Mang) const {
|
||||||
if (GV==0)
|
if (GV==0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/// FIXME: WHAT IS THIS?
|
|
||||||
|
|
||||||
if (GV->hasLocalLinkage() && !isa<Function>(GV) &&
|
if (GV->hasLocalLinkage() && !isa<Function>(GV) &&
|
||||||
((strlen(getPrivateGlobalPrefix()) != 0 &&
|
((strlen(getPrivateGlobalPrefix()) != 0 &&
|
||||||
Mang->getMangledName(GV).substr(0,strlen(getPrivateGlobalPrefix())) ==
|
Mang->getValueName(GV).substr(0,strlen(getPrivateGlobalPrefix())) ==
|
||||||
getPrivateGlobalPrefix()) ||
|
getPrivateGlobalPrefix()) ||
|
||||||
(strlen(getLessPrivateGlobalPrefix()) != 0 &&
|
(strlen(getLessPrivateGlobalPrefix()) != 0 &&
|
||||||
Mang->getMangledName(GV).substr(0,
|
Mang->getValueName(GV).substr(0,strlen(getLessPrivateGlobalPrefix())) ==
|
||||||
strlen(getLessPrivateGlobalPrefix())) ==
|
|
||||||
getLessPrivateGlobalPrefix())))
|
getLessPrivateGlobalPrefix())))
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
|
@ -244,9 +244,9 @@ static void DisambiguateGlobalSymbols(Module *M) {
|
|||||||
Mang.setPreserveAsmNames(true);
|
Mang.setPreserveAsmNames(true);
|
||||||
for (Module::global_iterator I = M->global_begin(), E = M->global_end();
|
for (Module::global_iterator I = M->global_begin(), E = M->global_end();
|
||||||
I != E; ++I)
|
I != E; ++I)
|
||||||
I->setName(Mang.getMangledName(I));
|
I->setName(Mang.getValueName(I));
|
||||||
for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I)
|
for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I)
|
||||||
I->setName(Mang.getMangledName(I));
|
I->setName(Mang.getValueName(I));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ExtractLoops - Given a reduced list of functions that still exposed the bug,
|
/// ExtractLoops - Given a reduced list of functions that still exposed the bug,
|
||||||
|
@ -371,13 +371,13 @@ void LTOCodeGenerator::applyScopeRestrictions()
|
|||||||
for (Module::iterator f = mergedModule->begin(),
|
for (Module::iterator f = mergedModule->begin(),
|
||||||
e = mergedModule->end(); f != e; ++f) {
|
e = mergedModule->end(); f != e; ++f) {
|
||||||
if ( !f->isDeclaration()
|
if ( !f->isDeclaration()
|
||||||
&& _mustPreserveSymbols.count(mangler.getMangledName(f)) )
|
&& _mustPreserveSymbols.count(mangler.getValueName(f)) )
|
||||||
mustPreserveList.push_back(::strdup(f->getName().c_str()));
|
mustPreserveList.push_back(::strdup(f->getName().c_str()));
|
||||||
}
|
}
|
||||||
for (Module::global_iterator v = mergedModule->global_begin(),
|
for (Module::global_iterator v = mergedModule->global_begin(),
|
||||||
e = mergedModule->global_end(); v != e; ++v) {
|
e = mergedModule->global_end(); v != e; ++v) {
|
||||||
if ( !v->isDeclaration()
|
if ( !v->isDeclaration()
|
||||||
&& _mustPreserveSymbols.count(mangler.getMangledName(v)) )
|
&& _mustPreserveSymbols.count(mangler.getValueName(v)) )
|
||||||
mustPreserveList.push_back(::strdup(v->getName().c_str()));
|
mustPreserveList.push_back(::strdup(v->getName().c_str()));
|
||||||
}
|
}
|
||||||
passes.add(createInternalizePass(mustPreserveList));
|
passes.add(createInternalizePass(mustPreserveList));
|
||||||
|
@ -332,7 +332,7 @@ void LTOModule::addDefinedSymbol(GlobalValue* def, Mangler &mangler,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// string is owned by _defines
|
// string is owned by _defines
|
||||||
const char* symbolName = ::strdup(mangler.getMangledName(def).c_str());
|
const char* symbolName = ::strdup(mangler.getValueName(def).c_str());
|
||||||
|
|
||||||
// set alignment part log2() can have rounding errors
|
// set alignment part log2() can have rounding errors
|
||||||
uint32_t align = def->getAlignment();
|
uint32_t align = def->getAlignment();
|
||||||
@ -405,7 +405,7 @@ void LTOModule::addPotentialUndefinedSymbol(GlobalValue* decl, Mangler &mangler)
|
|||||||
if (isa<GlobalAlias>(decl))
|
if (isa<GlobalAlias>(decl))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const char* name = mangler.getMangledName(decl).c_str();
|
const char* name = mangler.getValueName(decl).c_str();
|
||||||
|
|
||||||
// we already have the symbol
|
// we already have the symbol
|
||||||
if (_undefines.find(name) != _undefines.end())
|
if (_undefines.find(name) != _undefines.end())
|
||||||
|
Loading…
Reference in New Issue
Block a user