summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/PowerPC/InstPrinter
diff options
context:
space:
mode:
authorHal Finkel <hfinkel@anl.gov>2014-07-25 17:47:22 +0000
committerHal Finkel <hfinkel@anl.gov>2014-07-25 17:47:22 +0000
commit7c8ae53506452c13153bb50d988cc468048c4988 (patch)
treeaeb6eddc3817c228d944986a49a57d53f7606474 /llvm/lib/Target/PowerPC/InstPrinter
parent5d6c43e2942894b1183041ba5cb00d413ae484d4 (diff)
downloadbcm5719-llvm-7c8ae53506452c13153bb50d988cc468048c4988.tar.gz
bcm5719-llvm-7c8ae53506452c13153bb50d988cc468048c4988.zip
[PowerPC] Support TLS on PPC32/ELF
Patch by Justin Hibbits! llvm-svn: 213960
Diffstat (limited to 'llvm/lib/Target/PowerPC/InstPrinter')
-rw-r--r--llvm/lib/Target/PowerPC/InstPrinter/PPCInstPrinter.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/llvm/lib/Target/PowerPC/InstPrinter/PPCInstPrinter.cpp b/llvm/lib/Target/PowerPC/InstPrinter/PPCInstPrinter.cpp
index 7279b091b34..771b6f5ec48 100644
--- a/llvm/lib/Target/PowerPC/InstPrinter/PPCInstPrinter.cpp
+++ b/llvm/lib/Target/PowerPC/InstPrinter/PPCInstPrinter.cpp
@@ -17,6 +17,7 @@
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCInst.h"
#include "llvm/MC/MCInstrInfo.h"
+#include "llvm/MC/MCSymbol.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetOpcodes.h"
@@ -308,10 +309,16 @@ void PPCInstPrinter::printMemRegReg(const MCInst *MI, unsigned OpNo,
void PPCInstPrinter::printTLSCall(const MCInst *MI, unsigned OpNo,
raw_ostream &O) {
- printBranchOperand(MI, OpNo, O);
+ // On PPC64, VariantKind is VK_None, but on PPC32, it's VK_PLT, and it must
+ // come at the _end_ of the expression.
+ const MCOperand &Op = MI->getOperand(OpNo);
+ const MCSymbolRefExpr &refExp = cast<MCSymbolRefExpr>(*Op.getExpr());
+ O << refExp.getSymbol().getName();
O << '(';
printOperand(MI, OpNo+1, O);
O << ')';
+ if (refExp.getKind() != MCSymbolRefExpr::VK_None)
+ O << '@' << MCSymbolRefExpr::getVariantKindName(refExp.getKind());
}
OpenPOWER on IntegriCloud