[llvm] [RISCV][GlobalISel] Select G_GLOBAL_VALUE (PR #70091)

via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 24 12:09:51 PDT 2023


================
@@ -483,6 +489,66 @@ bool RISCVInstructionSelector::selectConstant(MachineInstr &MI,
   return true;
 }
 
+bool RISCVInstructionSelector::selectGlobalValue(
+    MachineInstr &MI, MachineIRBuilder &MIB, MachineRegisterInfo &MRI) const {
+  assert(MI.getOpcode() == TargetOpcode::G_GLOBAL_VALUE &&
+         "Expected G_GLOBAL_VALUE");
+  auto GV = MI.getOperand(1).getGlobal();
+  if (GV->isThreadLocal()) {
+    // TODO: implement this case.
+    return false;
+  }
+
+  switch (TM.getCodeModel()) {
+  default:
+    report_fatal_error("Unsupported code model for lowering");
----------------
tschuett wrote:

```
reportGISelFailure(const_cast<MachineFunction &>(MF), *TPC, *MORE,
                       "riskv-selector", "unknown code model",
                       MI);
```
turns the error into a remark.

https://github.com/llvm/llvm-project/pull/70091


More information about the llvm-commits mailing list