[PATCH] D23101: Align XRay return sleds to 2 byte boundaries
Dean Michael Berris via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 2 19:55:14 PDT 2016
dberris created this revision.
dberris added reviewers: rSerge, echristo, majnemer.
dberris added a subscriber: llvm-commits.
Herald added a subscriber: mehdi_amini.
This should ensure that we can atomically write two bytes (on top of the
retq and the one past it) and have those two bytes not straddle cache
lines.
https://reviews.llvm.org/D23101
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
@@ -8,6 +8,7 @@
; CHECK-LABEL: Ltmp0:
ret i32 0
; CHECK-LABEL: Lxray_sled_1:
+; CHECK-NEXT: .p2align 2, 0x90
; CHECK-NEXT: retq
; CHECK-NEXT: nopw %cs:512(%rax,%rax)
}
Index: lib/Target/X86/X86MCInstLower.cpp
===================================================================
--- lib/Target/X86/X86MCInstLower.cpp
+++ lib/Target/X86/X86MCInstLower.cpp
@@ -1075,12 +1075,14 @@
// We should emit the RET followed by sleds.
//
// .Lxray_sled_N:
+ // .palign 2, ...
// ret # or equivalent instruction
// # 10 bytes worth of noops
//
// This just makes sure that the alignment for the next instruction is 2.
auto CurSled = OutContext.createTempSymbol("xray_sled_", true);
OutStreamer->EmitLabel(CurSled);
+ OutStreamer->EmitCodeAlignment(4);
unsigned OpCode = MI.getOperand(0).getImm();
MCInst Ret;
Ret.setOpcode(OpCode);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23101.66610.patch
Type: text/x-patch
Size: 1110 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160803/de60d393/attachment.bin>
More information about the llvm-commits
mailing list