[llvm] [BOLT][NFC] Add allocator id to MCPlusBuilder::setLabel (PR #68707)
Job Noorman via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 10 06:51:02 PDT 2023
https://github.com/mtvec created https://github.com/llvm/llvm-project/pull/68707
This will be needed for some RISC-V instrumentation functions and is also consistent with other annotation setters.
>From 64391907bd4f59d271b4ce4f912807cc23f6f736 Mon Sep 17 00:00:00 2001
From: Job Noorman <jnoorman at igalia.com>
Date: Fri, 6 Oct 2023 11:20:41 +0200
Subject: [PATCH] [BOLT][NFC] Add allocator id to MCPlusBuilder::setLabel
This will be needed for some RISC-V instrumentation functions and is
also consistent with other annotation setters.
---
bolt/include/bolt/Core/MCPlusBuilder.h | 2 +-
bolt/lib/Core/MCPlusBuilder.cpp | 6 ++++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/bolt/include/bolt/Core/MCPlusBuilder.h b/bolt/include/bolt/Core/MCPlusBuilder.h
index c9e0e5d599b1fa4..b6817c1d7f45ed3 100644
--- a/bolt/include/bolt/Core/MCPlusBuilder.h
+++ b/bolt/include/bolt/Core/MCPlusBuilder.h
@@ -1185,7 +1185,7 @@ class MCPlusBuilder {
/// Set the label of \p Inst. This label will be emitted right before \p Inst
/// is emitted to MCStreamer.
- bool setLabel(MCInst &Inst, MCSymbol *Label);
+ bool setLabel(MCInst &Inst, MCSymbol *Label, AllocatorIdTy AllocatorId = 0);
/// Return MCSymbol that represents a target of this instruction at a given
/// operand number \p OpNum. If there's no symbol associated with
diff --git a/bolt/lib/Core/MCPlusBuilder.cpp b/bolt/lib/Core/MCPlusBuilder.cpp
index 0a5eb44e4876fe4..036fcf8b3e27fd9 100644
--- a/bolt/lib/Core/MCPlusBuilder.cpp
+++ b/bolt/lib/Core/MCPlusBuilder.cpp
@@ -274,8 +274,10 @@ std::optional<MCSymbol *> MCPlusBuilder::getLabel(const MCInst &Inst) const {
return std::nullopt;
}
-bool MCPlusBuilder::setLabel(MCInst &Inst, MCSymbol *Label) {
- getOrCreateAnnotationAs<MCSymbol *>(Inst, MCAnnotation::kLabel) = Label;
+bool MCPlusBuilder::setLabel(MCInst &Inst, MCSymbol *Label,
+ AllocatorIdTy AllocatorId) {
+ getOrCreateAnnotationAs<MCSymbol *>(Inst, MCAnnotation::kLabel, AllocatorId) =
+ Label;
return true;
}
More information about the llvm-commits
mailing list