[PATCH] D45859: [RISCV] Support "call" pseudoinstruction in the MC layer

Shiva Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 24 01:51:46 PDT 2018


shiva0217 added inline comments.


================
Comment at: lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.cpp:35-36
 void RISCVMCExpr::printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const {
-  bool HasVariant = getKind() != VK_RISCV_None;
+  bool HasVariant = ((getKind() != VK_RISCV_None) &&
+                     (getKind() != VK_RISCV_CALL));
   if (HasVariant)
----------------
asb wrote:
> Is there any way we can test this has the desired effect? I had a quick play around, and it seems quite difficult to trigger this code path, but perhaps I'm missing something obvious.
Hi Alex. The code path can be trigger by `llvm-mc -show-encoding` and I have added the testing in function-call.s.


================
Comment at: test/MC/RISCV/function-call.s:8
+
+call foo
+# RELOC: R_RISCV_CALL foo 0x0
----------------
asb wrote:
> This needs more tests, e.g. `call 1234` will trigger an assertion in the current patch.
> 
> I think we want test coverage for at least call 1234, calll %pcrel_lo(1234), call %pcrel_lo(foo), call %lo(1234), call %pcrel_lo(foo).
Hi Alex. I have added the new predicate call_target and relative parsing functions to verify call operand. Thanks for your comments to cover this.


Repository:
  rL LLVM

https://reviews.llvm.org/D45859





More information about the llvm-commits mailing list