[llvm] [BOLT] Use direct storage for Label annotations. NFCI. (PR #70147)
Job Noorman via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 25 01:51:07 PDT 2023
================
@@ -269,15 +269,17 @@ bool MCPlusBuilder::clearOffset(MCInst &Inst) {
}
std::optional<MCSymbol *> MCPlusBuilder::getLabel(const MCInst &Inst) const {
- if (auto Label = tryGetAnnotationAs<MCSymbol *>(Inst, MCAnnotation::kLabel))
- return *Label;
- return std::nullopt;
+ std::optional<int64_t> Label =
+ getAnnotationOpValue(Inst, MCAnnotation::kLabel);
+ if (!Label)
+ return std::nullopt;
+
+ return reinterpret_cast<MCSymbol *>(*Label);
}
-bool MCPlusBuilder::setLabel(MCInst &Inst, MCSymbol *Label,
- AllocatorIdTy AllocatorId) {
- getOrCreateAnnotationAs<MCSymbol *>(Inst, MCAnnotation::kLabel, AllocatorId) =
- Label;
+bool MCPlusBuilder::setLabel(MCInst &Inst, MCSymbol *Label) {
----------------
mtvec wrote:
Interesting, so I suppose that refactoring will make #68709 obsolete? In general, this will make my life a lot easier since I need to create labels quite often on RISC-V :)
https://github.com/llvm/llvm-project/pull/70147
More information about the llvm-commits
mailing list