[llvm] [X86][GlobalISel] Support globals in pic mode (PR #170038)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 30 05:49:45 PDT 2026
================
@@ -997,6 +1001,33 @@ bool X86LegalizerInfo::legalizeSETROUNDING(MachineInstr &MI,
return true;
}
+bool X86LegalizerInfo::legalizeGLOBAL_VALUE(MachineInstr &MI,
+ MachineRegisterInfo &MRI,
+ LegalizerHelper &Helper) const {
+ auto GV = MI.getOperand(1).getGlobal();
+ Register Dst = MI.getOperand(0).getReg();
+ LLT DstTy = MRI.getType(Dst);
+ auto GVOpFlags = Subtarget.classifyGlobalReference(GV);
+
+ // For stub references (GOT/PLT), we need G_WRAPPER_RIP + load
+ if (isGlobalStubReference(GVOpFlags)) {
+ MachineIRBuilder &MIRBuilder = Helper.MIRBuilder;
+ MachineFunction &MF = MIRBuilder.getMF();
+
+ auto StubAddr = MRI.createGenericVirtualRegister(DstTy);
----------------
arsenm wrote:
No auto
https://github.com/llvm/llvm-project/pull/170038
More information about the llvm-commits
mailing list