[PATCH] D27799: [XRay][compiler-rt][NFC] Deduplicate code in x86-64 trampolines.

Dean Michael Berris via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 15 00:54:07 PST 2016


dberris requested changes to this revision.
dberris added inline comments.
This revision now requires changes to proceed.


================
Comment at: lib/xray/xray_trampoline_x86_64.S:16
 
-	.text
-	.file "xray_trampoline_x86.S"
-	.globl __xray_FunctionEntry
-	.align 16, 0x90
-	.type __xray_FunctionEntry, at function
-
-__xray_FunctionEntry:
-  .cfi_startproc
-  // Save caller provided registers before doing any actual work.
-	pushq %rbp
-	.cfi_def_cfa_offset 16
+.macro REGISTERS_SAVE
 	subq $200, %rsp
----------------
Consider naming this `SAVE_REGISTERS` to make it a bit more natural to read.


================
Comment at: lib/xray/xray_trampoline_x86_64.S:35
 
-	// de-mangled, that's __xray::XRayPatchedFunction, and we're doing an acquire
-	// load (on x86 is a normal mov instruction).
-	movq	_ZN6__xray19XRayPatchedFunctionE(%rip), %rax
-	testq	%rax, %rax
-	je	.Ltmp0
-
-	// assume that %r10d has the function id.
-	movl	%r10d, %edi
-	xor	%esi,%esi
-	callq	*%rax
-.Ltmp0:
-  // restore the registers
+.macro REGISTERS_RESTORE
 	movupd	184(%rsp), %xmm0
----------------
Same idea here, as `RESTORE_REGISTERS`.


https://reviews.llvm.org/D27799





More information about the llvm-commits mailing list