Skip to content

Commit

Permalink
[BOLT][NFC] Add allocator id to MCPlusBuilder::setLabel (#68707)
Browse files Browse the repository at this point in the history
This will be needed for some RISC-V instrumentation functions and is
also consistent with other annotation setters.
  • Loading branch information
mtvec committed Oct 11, 2023
1 parent 59fec73 commit da37139
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bolt/include/bolt/Core/MCPlusBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions bolt/lib/Core/MCPlusBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit da37139

Please sign in to comment.