[PATCH] D55325: [RISCV] Add assembler support for LA pseudo-instruction

Roger Ferrer Ibanez via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 5 07:50:29 PST 2018


rogfer01 added inline comments.


================
Comment at: lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp:1483
+  RISCVMCExpr::VariantKind VKHi;
+  if (getContext().getObjectFileInfo()->isPositionIndependent()) {
+    SecondOpcode = isRV64() ? RISCV::LD : RISCV::LW;
----------------
My understanding is that `.option pic` and `.option nopic` change this behaviour.

A quick look at `MCObjectFileInfo` class files shows that the attribute is only set during the construction of the object and can't be changed.

In my downstream I implemented `.option pic` and `.option nopic` which set a field of `RISCVAsmParser` that I called `IsPicEnabled` and is only used for `la`. That field is initialised in the constructor using `getContext().getObjectFileInfo()->isPositionIndependent()`. Perhaps adding a setter to `MCObjectFileInfo` might be a better approach.

That said, either we implement `.option pic` / `.option nopic` first or we add a `FIXME` here and implement it later.

Hope this makes sense.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55325/new/

https://reviews.llvm.org/D55325





More information about the llvm-commits mailing list