[PATCH] D151901: [BOLT] Instrumentation: Add support for MacOS counters
Elvina Yakubova via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 30 07:40:12 PDT 2023
Elvina updated this revision to Diff 536240.
Elvina added a comment.
Updated diff based on comments
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D151901/new/
https://reviews.llvm.org/D151901
Files:
bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp
Index: bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp
===================================================================
--- bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp
+++ bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp
@@ -1346,6 +1346,34 @@
return createInstrumentedIndCallHandlerExitBB();
}
+ InstructionListType createGetter(MCContext *Ctx, const char *name) const {
+ InstructionListType Insts(4);
+ MCSymbol *Locs = Ctx->getOrCreateSymbol(name);
+ InstructionListType Addr = materializeAddress(Locs, Ctx, AArch64::X0);
+ std::copy(Addr.begin(), Addr.end(), Insts.begin());
+ assert(Addr.size() == 2 && "Invalid Addr size");
+ loadReg(Insts[2], AArch64::X0, AArch64::X0);
+ createReturn(Insts[3]);
+ return Insts;
+ }
+
+ InstructionListType createNumCountersGetter(MCContext *Ctx) const override {
+ return createGetter(Ctx, "__bolt_num_counters");
+ }
+
+ InstructionListType
+ createInstrLocationsGetter(MCContext *Ctx) const override {
+ return createGetter(Ctx, "__bolt_instr_locations");
+ }
+
+ InstructionListType createInstrTablesGetter(MCContext *Ctx) const override {
+ return createGetter(Ctx, "__bolt_instr_tables");
+ }
+
+ InstructionListType createInstrNumFuncsGetter(MCContext *Ctx) const override {
+ return createGetter(Ctx, "__bolt_instr_num_funcs");
+ }
+
void convertIndirectCallToLoad(MCInst &Inst, MCPhysReg Reg) override {
bool IsTailCall = isTailCall(Inst);
if (IsTailCall)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151901.536240.patch
Type: text/x-patch
Size: 1485 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230630/8adeea5e/attachment.bin>
More information about the llvm-commits
mailing list