[llvm] [GlobalISel][ARM] Legalization of G_CONSTANT using constant pool (PR #98308)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 24 12:26:23 PDT 2024


================
@@ -1103,6 +1104,30 @@ bool ARMInstructionSelector::select(MachineInstr &I) {
     assert((ValSize != 64 || STI.hasVFP2Base()) &&
            "Don't know how to load/store 64-bit value without VFP");
 
+    if (auto *LoadMI = dyn_cast<GLoad>(&I)) {
+      Register PtrReg = LoadMI->getPointerReg();
+      MachineInstr *Ptr = MRI.getVRegDef(PtrReg);
+      if (Ptr->getOpcode() == TargetOpcode::G_CONSTANT_POOL) {
+        const MachineOperand &Index = Ptr->getOperand(1);
+        unsigned Opcode;
+        if (Subtarget->isThumb())
+          Opcode = ARM::tLDRpci;
+        else
+          Opcode = ARM::LDRcp;
----------------
arsenm wrote:

Initialize with ternary operator 

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


More information about the llvm-commits mailing list