diff options
author | Petar Jovanovic <petar.jovanovic@imgtec.com> | 2014-02-04 18:41:57 +0000 |
---|---|---|
committer | Petar Jovanovic <petar.jovanovic@imgtec.com> | 2014-02-04 18:41:57 +0000 |
commit | a5da588b2fa22762e815f945623aead365804fb3 (patch) | |
tree | f5c7a37a4dc03ef53a4507d905962d35ffca8c3c /llvm/lib/Target/Mips/InstPrinter/MipsInstPrinter.cpp | |
parent | 7cbbd28c6784dd78a6c5bb9390b11e74135277ed (diff) | |
download | bcm5719-llvm-a5da588b2fa22762e815f945623aead365804fb3.tar.gz bcm5719-llvm-a5da588b2fa22762e815f945623aead365804fb3.zip |
[mips] Implement %hi(sym1 - sym2) and %lo(sym1 - sym2) expressions
Patch implements %hi(sym1 - sym2) and %lo(sym1 - sym2) expressions for MIPS
by creating target expression class MipsMCExpr.
Patch by Sasa Stankovic.
Differential Revision: http://llvm-reviews.chandlerc.com/D2592
llvm-svn: 200783
Diffstat (limited to 'llvm/lib/Target/Mips/InstPrinter/MipsInstPrinter.cpp')
-rw-r--r-- | llvm/lib/Target/Mips/InstPrinter/MipsInstPrinter.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/Target/Mips/InstPrinter/MipsInstPrinter.cpp b/llvm/lib/Target/Mips/InstPrinter/MipsInstPrinter.cpp index 82deec1a1e5..de724d33cff 100644 --- a/llvm/lib/Target/Mips/InstPrinter/MipsInstPrinter.cpp +++ b/llvm/lib/Target/Mips/InstPrinter/MipsInstPrinter.cpp @@ -14,6 +14,7 @@ #define DEBUG_TYPE "asm-printer" #include "MipsInstPrinter.h" #include "MipsInstrInfo.h" +#include "MCTargetDesc/MipsMCExpr.h" #include "llvm/ADT/StringExtras.h" #include "llvm/MC/MCExpr.h" #include "llvm/MC/MCInst.h" @@ -129,8 +130,10 @@ static void printExpr(const MCExpr *Expr, raw_ostream &OS) { const MCConstantExpr *CE = dyn_cast<MCConstantExpr>(BE->getRHS()); assert(SRE && CE && "Binary expression must be sym+const."); Offset = CE->getValue(); - } - else if (!(SRE = dyn_cast<MCSymbolRefExpr>(Expr))) + } else if (const MipsMCExpr *ME = dyn_cast<MipsMCExpr>(Expr)) { + ME->print(OS); + return; + } else if (!(SRE = dyn_cast<MCSymbolRefExpr>(Expr))) assert(false && "Unexpected MCExpr type."); MCSymbolRefExpr::VariantKind Kind = SRE->getKind(); |