diff options
Diffstat (limited to 'llvm/lib/Target/PowerPC/InstPrinter/PPCInstPrinter.cpp')
| -rw-r--r-- | llvm/lib/Target/PowerPC/InstPrinter/PPCInstPrinter.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/llvm/lib/Target/PowerPC/InstPrinter/PPCInstPrinter.cpp b/llvm/lib/Target/PowerPC/InstPrinter/PPCInstPrinter.cpp index 77206494990..251385e95f3 100644 --- a/llvm/lib/Target/PowerPC/InstPrinter/PPCInstPrinter.cpp +++ b/llvm/lib/Target/PowerPC/InstPrinter/PPCInstPrinter.cpp @@ -444,13 +444,22 @@ void PPCInstPrinter::printTLSCall(const MCInst *MI, unsigned OpNo, // 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(); + const MCSymbolRefExpr *RefExp = nullptr; + const MCConstantExpr *ConstExp = nullptr; + if (const MCBinaryExpr *BinExpr = dyn_cast<MCBinaryExpr>(Op.getExpr())) { + RefExp = cast<MCSymbolRefExpr>(BinExpr->getLHS()); + ConstExp = cast<MCConstantExpr>(BinExpr->getRHS()); + } else + 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()); + if (RefExp->getKind() != MCSymbolRefExpr::VK_None) + O << '@' << MCSymbolRefExpr::getVariantKindName(RefExp->getKind()); + if (ConstExp != nullptr) + O << '+' << ConstExp->getValue(); } /// showRegistersWithPercentPrefix - Check if this register name should be |

