[compiler-rt] r331711 - [XRay][compiler-rt] Add llvm-mca assembler annotations for XRay (NFC)
Dean Michael Berris via llvm-commits
llvm-commits at lists.llvm.org
Mon May 7 18:57:51 PDT 2018
Author: dberris
Date: Mon May 7 18:57:51 2018
New Revision: 331711
URL: http://llvm.org/viewvc/llvm-project?rev=331711&view=rev
Log:
[XRay][compiler-rt] Add llvm-mca assembler annotations for XRay (NFC)
This change adds some assembler comments to facilitate analysis with
llvm-mca. In particular, we're interested in identifying and later
optimising (reducing) the cost of the key functions in the XRay
implementation using both static analysis (with llvm-mca, etc.) and
dynamic analysis (perf profiling, etc.) of microbenchmarks.
Modified:
compiler-rt/trunk/lib/xray/xray_fdr_logging_impl.h
compiler-rt/trunk/lib/xray/xray_trampoline_x86_64.S
Modified: compiler-rt/trunk/lib/xray/xray_fdr_logging_impl.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/xray/xray_fdr_logging_impl.h?rev=331711&r1=331710&r2=331711&view=diff
==============================================================================
--- compiler-rt/trunk/lib/xray/xray_fdr_logging_impl.h (original)
+++ compiler-rt/trunk/lib/xray/xray_fdr_logging_impl.h Mon May 7 18:57:51 2018
@@ -606,6 +606,7 @@ inline void processFunctionHook(int32_t
int (*wall_clock_reader)(clockid_t,
struct timespec *),
BufferQueue *BQ) XRAY_NEVER_INSTRUMENT {
+ __asm volatile("# LLVM-MCA-BEGIN processFunctionHook");
// Prevent signal handler recursion, so in case we're already in a log writing
// mode and the signal handler comes in (and is also instrumented) then we
// don't want to be clobbering potentially partial writes already happening in
@@ -718,6 +719,7 @@ inline void processFunctionHook(int32_t
// If we've exhausted the buffer by this time, we then release the buffer to
// make sure that other threads may start using this buffer.
endBufferIfFull();
+ __asm volatile("# LLVM-MCA-END");
}
} // namespace __xray_fdr_internal
Modified: compiler-rt/trunk/lib/xray/xray_trampoline_x86_64.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/xray/xray_trampoline_x86_64.S?rev=331711&r1=331710&r2=331711&view=diff
==============================================================================
--- compiler-rt/trunk/lib/xray/xray_trampoline_x86_64.S (original)
+++ compiler-rt/trunk/lib/xray/xray_trampoline_x86_64.S Mon May 7 18:57:51 2018
@@ -99,6 +99,7 @@
.globl ASM_SYMBOL(__xray_FunctionEntry)
.align 16, 0x90
ASM_TYPE_FUNCTION(__xray_FunctionEntry)
+# LLVM-MCA-BEGIN __xray_FunctionEntry
ASM_SYMBOL(__xray_FunctionEntry):
CFI_STARTPROC
SAVE_REGISTERS
@@ -117,6 +118,7 @@ ASM_SYMBOL(__xray_FunctionEntry):
.Ltmp0:
RESTORE_REGISTERS
retq
+# LLVM-MCA-END
ASM_SIZE(__xray_FunctionEntry)
CFI_ENDPROC
@@ -125,6 +127,7 @@ ASM_SYMBOL(__xray_FunctionEntry):
.globl ASM_SYMBOL(__xray_FunctionExit)
.align 16, 0x90
ASM_TYPE_FUNCTION(__xray_FunctionExit)
+# LLVM-MCA-BEGIN __xray_FunctionExit
ASM_SYMBOL(__xray_FunctionExit):
CFI_STARTPROC
// Save the important registers first. Since we're assuming that this
@@ -155,6 +158,7 @@ ASM_SYMBOL(__xray_FunctionExit):
addq $56, %rsp
CFI_DEF_CFA_OFFSET(8)
retq
+# LLVM-MCA-END
ASM_SIZE(__xray_FunctionExit)
CFI_ENDPROC
@@ -163,6 +167,7 @@ ASM_SYMBOL(__xray_FunctionExit):
.globl ASM_SYMBOL(__xray_FunctionTailExit)
.align 16, 0x90
ASM_TYPE_FUNCTION(__xray_FunctionTailExit)
+# LLVM-MCA-BEGIN __xray_FunctionTailExit
ASM_SYMBOL(__xray_FunctionTailExit):
CFI_STARTPROC
SAVE_REGISTERS
@@ -179,6 +184,7 @@ ASM_SYMBOL(__xray_FunctionTailExit):
.Ltmp4:
RESTORE_REGISTERS
retq
+# LLVM-MCA-END
ASM_SIZE(__xray_FunctionTailExit)
CFI_ENDPROC
@@ -187,6 +193,7 @@ ASM_SYMBOL(__xray_FunctionTailExit):
.globl ASM_SYMBOL(__xray_ArgLoggerEntry)
.align 16, 0x90
ASM_TYPE_FUNCTION(__xray_ArgLoggerEntry)
+# LLVM-MCA-BEGIN __xray_ArgLoggerEntry
ASM_SYMBOL(__xray_ArgLoggerEntry):
CFI_STARTPROC
SAVE_REGISTERS
@@ -216,6 +223,7 @@ ASM_SYMBOL(__xray_ArgLoggerEntry):
.Larg1entryFail:
RESTORE_REGISTERS
retq
+# LLVM-MCA-END
ASM_SIZE(__xray_ArgLoggerEntry)
CFI_ENDPROC
@@ -224,6 +232,7 @@ ASM_SYMBOL(__xray_ArgLoggerEntry):
.global ASM_SYMBOL(__xray_CustomEvent)
.align 16, 0x90
ASM_TYPE_FUNCTION(__xray_CustomEvent)
+# LLVM-MCA-BEGIN __xray_CustomEvent
ASM_SYMBOL(__xray_CustomEvent):
CFI_STARTPROC
SAVE_REGISTERS
@@ -239,6 +248,7 @@ ASM_SYMBOL(__xray_CustomEvent):
.LcustomEventCleanup:
RESTORE_REGISTERS
retq
+# LLVM-MCA-END
ASM_SIZE(__xray_CustomEvent)
CFI_ENDPROC
@@ -247,6 +257,7 @@ ASM_SYMBOL(__xray_CustomEvent):
.global ASM_SYMBOL(__xray_TypedEvent)
.align 16, 0x90
ASM_TYPE_FUNCTION(__xray_TypedEvent)
+# LLVM-MCA-BEGIN __xray_TypedEvent
ASM_SYMBOL(__xray_TypedEvent):
CFI_STARTPROC
SAVE_REGISTERS
@@ -262,6 +273,7 @@ ASM_SYMBOL(__xray_TypedEvent):
.LtypedEventCleanup:
RESTORE_REGISTERS
retq
+# LLVM-MCA-END
ASM_SIZE(__xray_TypedEvent)
CFI_ENDPROC
More information about the llvm-commits
mailing list