[llvm] [BOLT] Use direct storage for Label annotations. NFCI. (PR #70147)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 26 21:40:44 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) {
----------------
maksfb wrote:
Yes, I guess so. #70412 has more details. I also plan to use annotations more often, hence I wanted to reduce the associated overhead.
https://github.com/llvm/llvm-project/pull/70147
More information about the llvm-commits
mailing list