[llvm] [bolt][aarch64] simplify rodata/literal load for X86 & AArch64 (PR #165723)
Alexey Moksyakov via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 27 12:03:49 PST 2025
================
@@ -2797,6 +2797,56 @@ class AArch64MCPlusBuilder : public MCPlusBuilder {
return Insts;
}
+ InstructionListType materializeConstant(const MCInst &Inst,
+ StringRef ConstantData,
+ uint64_t Offset) const override {
+ struct InstInfo {
+ // Size in bytes that Inst loads from memory.
+ uint8_t DataSize;
+ // number instructions needed to materialize the constant.
+ uint8_t numInstrs;
+ // Opcode to use for materializing the constant.
+ unsigned Opcode;
+ };
+
+ InstInfo I;
+ InstructionListType Insts(0);
+ switch (Inst.getOpcode()) {
+ case AArch64::LDRWl:
+ I = {4, 2, AArch64::MOVKWi};
+ break;
+ case AArch64::LDRXl:
+ I = {8, 4, AArch64::MOVKXi};
+ break;
+ default:
+ llvm_unreachable("unexpected ldr instruction");
----------------
yavtuk wrote:
we will be able to add extra logic as necessary
https://github.com/llvm/llvm-project/pull/165723
More information about the llvm-commits
mailing list