[PATCH] D55305: [RISCV] Add lowering of global TLS addresses

Roger Ferrer Ibanez via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 21 00:40:17 PDT 2019


rogfer01 added inline comments.


================
Comment at: lib/Target/RISCV/RISCVISelLowering.cpp:445
+    SDValue Addr = DAG.getTargetGlobalAddress(GV, DL, Ty, 0, 0);
+    SDValue Load = SDValue(DAG.getMachineNode(RISCV::PseudoLA_TLS_IE, DL, Ty, Addr), 0);
+
----------------
Because we run `BranchRelaxation` in `addPreEmitPass` but the expansion of these pseudos happens in `addPreEmitPass2` I think we need to update `RISCVInstrInfo::getInstSizeInBytes` to state that `PseudoLA_TLS_IE` and `PseudoLA_TLS_GD` will take 8 bytes (otherwise we run into "fixup errors" because the relaxation has been done using an underestimation).

(Alternatively we could use the `Size` attribute in tablegen but currently only `PseudoLI` does this and we don't use that one in codegen, so that is probably OK)

Also I wonder if the attribute `isAsmParserOnly = 1` should be updated to `0` so we are more honest with the current usage of these pseudos. That said from a cursory check in tablegen, that attribute does not seem very important at the moment.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D55305





More information about the llvm-commits mailing list