[llvm] [bolt][aarch64] simplify rodata/literal load for X86 & AArch64 (PR #165723)
Alexey Moksyakov via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 5 09:13:03 PST 2025
================
@@ -2770,6 +2770,52 @@ 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 of 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:
+ return InstructionListType{};
+ }
+
+ if (ConstantData.size() - Offset < I.DataSize)
+ return Insts;
+
+ const uint64_t ImmVal =
+ DataExtractor(ConstantData, true, 8).getUnsigned(&Offset, I.DataSize);
----------------
yavtuk wrote:
Ок, no problem
https://github.com/llvm/llvm-project/pull/165723
More information about the llvm-commits
mailing list