diff options
author | Daniel Sanders <daniel.sanders@imgtec.com> | 2016-06-03 09:53:06 +0000 |
---|---|---|
committer | Daniel Sanders <daniel.sanders@imgtec.com> | 2016-06-03 09:53:06 +0000 |
commit | 6ba3dd6b719ec740dd54b324bbab40ff25a21642 (patch) | |
tree | 37a0953a3558db176da2f05605b9efdcb3a7469f /llvm/lib/Target/Mips/InstPrinter/MipsInstPrinter.cpp | |
parent | 5bc39ab5925f7b6e312f22481c679d93238824b8 (diff) | |
download | bcm5719-llvm-6ba3dd6b719ec740dd54b324bbab40ff25a21642.tar.gz bcm5719-llvm-6ba3dd6b719ec740dd54b324bbab40ff25a21642.zip |
[mips] Implement 'la' macro in PIC mode for O32.
Summary:
N32 support will follow in a later patch since the symbol version of 'la'
incorrectly believes N32 to have 64-bit pointers and rejects it early.
This fixes the three incorrectly expanded 'la' macros found in bionic.
Reviewers: sdardis
Subscribers: dsanders, llvm-commits, sdardis
Differential Revision: http://reviews.llvm.org/D20820
llvm-svn: 271644
Diffstat (limited to 'llvm/lib/Target/Mips/InstPrinter/MipsInstPrinter.cpp')
-rw-r--r-- | llvm/lib/Target/Mips/InstPrinter/MipsInstPrinter.cpp | 29 |
1 files changed, 1 insertions, 28 deletions
diff --git a/llvm/lib/Target/Mips/InstPrinter/MipsInstPrinter.cpp b/llvm/lib/Target/Mips/InstPrinter/MipsInstPrinter.cpp index eae5ebee2ef..08a12010489 100644 --- a/llvm/lib/Target/Mips/InstPrinter/MipsInstPrinter.cpp +++ b/llvm/lib/Target/Mips/InstPrinter/MipsInstPrinter.cpp @@ -122,33 +122,6 @@ void MipsInstPrinter::printInst(const MCInst *MI, raw_ostream &O, } } -static void printExpr(const MCExpr *Expr, const MCAsmInfo *MAI, - raw_ostream &OS) { - int Offset = 0; - const MCSymbolRefExpr *SRE; - - if (const MCBinaryExpr *BE = dyn_cast<MCBinaryExpr>(Expr)) { - SRE = dyn_cast<MCSymbolRefExpr>(BE->getLHS()); - const MCConstantExpr *CE = dyn_cast<MCConstantExpr>(BE->getRHS()); - assert(SRE && CE && "Binary expression must be sym+const."); - Offset = CE->getValue(); - } else if (const MipsMCExpr *ME = dyn_cast<MipsMCExpr>(Expr)) { - ME->print(OS, MAI); - return; - } else - SRE = cast<MCSymbolRefExpr>(Expr); - - assert(SRE->getKind() == MCSymbolRefExpr::VK_None && "Invalid kind!"); - - SRE->getSymbol().print(OS, MAI); - - if (Offset) { - if (Offset > 0) - OS << '+'; - OS << Offset; - } -} - void MipsInstPrinter::printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) { const MCOperand &Op = MI->getOperand(OpNo); @@ -163,7 +136,7 @@ void MipsInstPrinter::printOperand(const MCInst *MI, unsigned OpNo, } assert(Op.isExpr() && "unknown operand kind in printOperand"); - printExpr(Op.getExpr(), &MAI, O); + Op.getExpr()->print(O, &MAI, true); } template <unsigned Bits, unsigned Offset> |