Changes in directory llvm/lib/CodeGen:
AsmPrinter.cpp updated: 1.156 -> 1.157 --- Log message: Implement aliases. This fixes PR1017: http://llvm.org/PR1017 and it's dependent bugs. CFE part will follow. --- Diffs of the changes: (+25 -1) AsmPrinter.cpp | 26 +++++++++++++++++++++++++- 1 files changed, 25 insertions(+), 1 deletion(-) Index: llvm/lib/CodeGen/AsmPrinter.cpp diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.156 llvm/lib/CodeGen/AsmPrinter.cpp:1.157 --- llvm/lib/CodeGen/AsmPrinter.cpp:1.156 Mon Apr 23 18:33:31 2007 +++ llvm/lib/CodeGen/AsmPrinter.cpp Wed Apr 25 09:27:10 2007 @@ -111,7 +111,7 @@ bool AsmPrinter::doFinalization(Module &M) { if (TAI->getWeakRefDirective()) { - if (ExtWeakSymbols.begin() != ExtWeakSymbols.end()) + if (!ExtWeakSymbols.empty()) SwitchToDataSection(""); for (std::set<const GlobalValue*>::iterator i = ExtWeakSymbols.begin(), @@ -122,6 +122,30 @@ } } + if (TAI->getSetDirective()) { + if (M.alias_size()) + SwitchToTextSection(TAI->getTextSection()); + + O << "\n"; + for (Module::const_alias_iterator I = M.alias_begin(), E = M.alias_end(); + I!=E; ++I) { + const GlobalValue *Aliasee = I->getAliasee(); + assert(Aliasee && "Aliasee cannot be null!"); + std::string Target = Mang->getValueName(Aliasee); + std::string Name = Mang->getValueName(I); + + // Aliases with external weak linkage was emitted already + if (I->hasExternalLinkage()) + O << "\t.globl\t" << Name << "\n"; + else if (I->hasWeakLinkage()) + O << TAI->getWeakRefDirective() << Name << "\n"; + else if (!I->hasInternalLinkage()) + assert(0 && "Invalid alias linkage"); + + O << TAI->getSetDirective() << Name << ", " << Target << "\n"; + } + } + delete Mang; Mang = 0; return false; } _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits