[PATCH] D23398: [XRay] Synthesize a reference to the xray_instr_map
Dean Michael Berris via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 16 18:57:33 PDT 2016
dberris updated this revision to Diff 68297.
dberris added a comment.
Rebase
https://reviews.llvm.org/D23398
Files:
lib/Target/X86/X86MCInstLower.cpp
test/CodeGen/X86/xray-attribute-instrumentation.ll
Index: test/CodeGen/X86/xray-attribute-instrumentation.ll
===================================================================
--- test/CodeGen/X86/xray-attribute-instrumentation.ll
+++ test/CodeGen/X86/xray-attribute-instrumentation.ll
@@ -12,3 +12,9 @@
; CHECK-NEXT: retq
; CHECK-NEXT: nopw %cs:512(%rax,%rax)
}
+; CHECK: .p2align 4, 0x90
+; CHECK-NEXT: .quad .Lxray_synthetic_0
+; CHECK-NEXT: .section xray_instr_map,{{.*}}
+; CHECK-LABEL: Lxray_synthetic_0:
+; CHECK: .quad .Lxray_sled_0
+; CHECK: .quad .Lxray_sled_1
Index: lib/Target/X86/X86MCInstLower.cpp
===================================================================
--- lib/Target/X86/X86MCInstLower.cpp
+++ lib/Target/X86/X86MCInstLower.cpp
@@ -1109,7 +1109,19 @@
Section = OutContext.getELFSection("xray_instr_map", ELF::SHT_PROGBITS,
ELF::SHF_ALLOC);
}
+
+ // Before we switch over, we force a reference to a label inside the
+ // xray_instr_map section. Since EmitXRayTable() is always called just
+ // before the function's end, we assume that this is happening after the
+ // last return instruction.
+ //
+ // We then align the reference to 16 byte boundaries, which we determined
+ // experimentally to be beneficial to avoid causing decoder stalls.
+ MCSymbol *Tmp = OutContext.createTempSymbol("xray_synthetic_", true);
+ OutStreamer->EmitCodeAlignment(16);
+ OutStreamer->EmitSymbolValue(Tmp, 8, false);
OutStreamer->SwitchSection(Section);
+ OutStreamer->EmitLabel(Tmp);
for (const auto &Sled : Sleds) {
OutStreamer->EmitSymbolValue(Sled.Sled, 8);
OutStreamer->EmitSymbolValue(CurrentFnSym, 8);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23398.68297.patch
Type: text/x-patch
Size: 1707 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160817/94afecd6/attachment.bin>
More information about the llvm-commits
mailing list