diff options
| author | Daniel Sanders <daniel.sanders@imgtec.com> | 2016-08-08 09:20:52 +0000 |
|---|---|---|
| committer | Daniel Sanders <daniel.sanders@imgtec.com> | 2016-08-08 09:20:52 +0000 |
| commit | 2ab623b5a31db5fecb08f822cc59433cfb7ccb58 (patch) | |
| tree | 57ddef4d365f3169c35d5b8c3805b4d51120b8b5 /llvm/tools/llvm-mc | |
| parent | 4dd6c249ac9988d80e32111a6e21f54fe5c34395 (diff) | |
| download | bcm5719-llvm-2ab623b5a31db5fecb08f822cc59433cfb7ccb58.tar.gz bcm5719-llvm-2ab623b5a31db5fecb08f822cc59433cfb7ccb58.zip | |
[mips][ias] Fix all the hacks related to MIPS-specific unary operators (%hi/%lo/%gp_rel/etc.).
Summary:
They are now lexed as a single token on targets where
MCAsmInfo::HasMipsExpressions is true and then parsed in a similar way to
the '~' operator as part of MCExpr::parseExpression.
As a result:
* expressions and immediates no longer have different parsing rules. The
difference is now solely down to whether evaluateAsAbsolute() succeeds.
* %hi(%neg(%gp_rel(x))) are no longer parsed as a single operator and
decomposed into the three MipsMCExpr nodes. They are parsed directly as
three MipsMCExpr nodes.
* parseMemOperand no longer needs to eat all the surrounding parenthesis
to get at the outermost operator to make this work
* %hi(%neg(%gp_rel(x))) and %lo(%neg(%gp_rel(x))) are no longer the only
3-in-1 relocs that parse for N64. They're still the only combinations that
are permitted in relocatable expressions though. Fixing that should be a
later patch.
* We no longer need to list all the tokens that can occur as the first token of
an expression or immediate.
test/MC/Mips/expr1.s:
This change also prevents the incorrect lowering of %lo(2*4)+foo to
%lo(8+foo) which is not an equivalent expression (the difference is
whether foo is truncated to 16-bit or not) and the test has been
updated to account for the macro expansion the correct expression requires.
Reviewers: sdardis
Subscribers: dsanders, sdardis, llvm-commits
Differential Revision: https://reviews.llvm.org/D23110
llvm-svn: 277988
Diffstat (limited to 'llvm/tools/llvm-mc')
| -rw-r--r-- | llvm/tools/llvm-mc/llvm-mc.cpp | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/llvm/tools/llvm-mc/llvm-mc.cpp b/llvm/tools/llvm-mc/llvm-mc.cpp index 01853a5c84e..81ee3d83d55 100644 --- a/llvm/tools/llvm-mc/llvm-mc.cpp +++ b/llvm/tools/llvm-mc/llvm-mc.cpp @@ -314,6 +314,78 @@ static int AsLexInput(SourceMgr &SrcMgr, MCAsmInfo &MAI, case AsmToken::Slash: OS << "Slash"; break; case AsmToken::Star: OS << "Star"; break; case AsmToken::Tilde: OS << "Tilde"; break; + case AsmToken::PercentCall16: + OS << "PercentCall16"; + break; + case AsmToken::PercentCall_Hi: + OS << "PercentCall_Hi"; + break; + case AsmToken::PercentCall_Lo: + OS << "PercentCall_Lo"; + break; + case AsmToken::PercentDtprel_Hi: + OS << "PercentDtprel_Hi"; + break; + case AsmToken::PercentDtprel_Lo: + OS << "PercentDtprel_Lo"; + break; + case AsmToken::PercentGot: + OS << "PercentGot"; + break; + case AsmToken::PercentGot_Disp: + OS << "PercentGot_Disp"; + break; + case AsmToken::PercentGot_Hi: + OS << "PercentGot_Hi"; + break; + case AsmToken::PercentGot_Lo: + OS << "PercentGot_Lo"; + break; + case AsmToken::PercentGot_Ofst: + OS << "PercentGot_Ofst"; + break; + case AsmToken::PercentGot_Page: + OS << "PercentGot_Page"; + break; + case AsmToken::PercentGottprel: + OS << "PercentGottprel"; + break; + case AsmToken::PercentGp_Rel: + OS << "PercentGp_Rel"; + break; + case AsmToken::PercentHi: + OS << "PercentHi"; + break; + case AsmToken::PercentHigher: + OS << "PercentHigher"; + break; + case AsmToken::PercentHighest: + OS << "PercentHighest"; + break; + case AsmToken::PercentLo: + OS << "PercentLo"; + break; + case AsmToken::PercentNeg: + OS << "PercentNeg"; + break; + case AsmToken::PercentPcrel_Hi: + OS << "PercentPcrel_Hi"; + break; + case AsmToken::PercentPcrel_Lo: + OS << "PercentPcrel_Lo"; + break; + case AsmToken::PercentTlsgd: + OS << "PercentTlsgd"; + break; + case AsmToken::PercentTlsldm: + OS << "PercentTlsldm"; + break; + case AsmToken::PercentTprel_Hi: + OS << "PercentTprel_Hi"; + break; + case AsmToken::PercentTprel_Lo: + OS << "PercentTprel_Lo"; + break; } // Print the token string. |

