diff options
| author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-01-03 19:21:54 +0000 |
|---|---|---|
| committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-01-03 19:21:54 +0000 |
| commit | 58873566b3718a6b2730e7d726491398766a39a4 (patch) | |
| tree | 95885e037ec4064b92202d0a8d15fb4d803b4c8a /llvm/lib/Target/PowerPC/PPCMCInstLower.cpp | |
| parent | e891c5f2648c85a31c57c2cc63f76a5b95da86d3 (diff) | |
| download | bcm5719-llvm-58873566b3718a6b2730e7d726491398766a39a4.tar.gz bcm5719-llvm-58873566b3718a6b2730e7d726491398766a39a4.zip | |
Make the llvm mangler depend only on DataLayout.
Before this patch any program that wanted to know the final symbol name of a
GlobalValue had to link with Target.
This patch implements a compromise solution where the mangler uses DataLayout.
This way, any tool that already links with Target (llc, clang) gets the exact
behavior as before and new IR files can be mangled without linking with Target.
With this patch the mangler is constructed with just a DataLayout and DataLayout
is extended to include the information the Mangler needs.
llvm-svn: 198438
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPCMCInstLower.cpp')
| -rw-r--r-- | llvm/lib/Target/PowerPC/PPCMCInstLower.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp b/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp index 56fa773433a..20e97185638 100644 --- a/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp +++ b/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp @@ -19,11 +19,13 @@ #include "llvm/CodeGen/AsmPrinter.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineModuleInfoImpls.h" +#include "llvm/IR/DataLayout.h" #include "llvm/IR/GlobalValue.h" #include "llvm/MC/MCAsmInfo.h" #include "llvm/MC/MCExpr.h" #include "llvm/MC/MCInst.h" #include "llvm/Target/Mangler.h" +#include "llvm/Target/TargetMachine.h" using namespace llvm; static MachineModuleInfoMachO &getMachOMMI(AsmPrinter &AP) { @@ -32,6 +34,7 @@ static MachineModuleInfoMachO &getMachOMMI(AsmPrinter &AP) { static MCSymbol *GetSymbolFromOperand(const MachineOperand &MO, AsmPrinter &AP){ + const DataLayout *DL = AP.TM.getDataLayout(); MCContext &Ctx = AP.OutContext; SmallString<128> Name; @@ -42,7 +45,7 @@ static MCSymbol *GetSymbolFromOperand(const MachineOperand &MO, AsmPrinter &AP){ Suffix = "$non_lazy_ptr"; if (!Suffix.empty()) - Name += AP.MAI->getPrivateGlobalPrefix(); + Name += DL->getPrivateGlobalPrefix(); unsigned PrefixLen = Name.size(); |

