[llvm] r293080 - [XRay][AArch64] More staging for tail call support in XRay on AArch64 - in LLVM

Serge Rogatch via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 25 12:21:50 PST 2017


Author: rserge
Date: Wed Jan 25 14:21:49 2017
New Revision: 293080

URL: http://llvm.org/viewvc/llvm-project?rev=293080&view=rev
Log:
[XRay][AArch64] More staging for tail call support in XRay on AArch64 - in LLVM

Summary:
This patch prepares more for tail call support in XRay. Until the logging part supports tail calls, this is just staging, so it seems LLVM part is mostly ready with this patch.
Related: https://reviews.llvm.org/D28948 (compiler-rt)

Reviewers: dberris, rengolin

Reviewed By: dberris

Subscribers: llvm-commits, iid_iunknown, aemerson

Differential Revision: https://reviews.llvm.org/D28947

Added:
    llvm/trunk/test/CodeGen/AArch64/xray-tail-call-sled.ll
Modified:
    llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.cpp
    llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.h

Modified: llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.cpp?rev=293080&r1=293079&r2=293080&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.cpp Wed Jan 25 14:21:49 2017
@@ -1627,6 +1627,17 @@ bool AArch64InstrInfo::isUnscaledLdSt(Ma
   return isUnscaledLdSt(MI.getOpcode());
 }
 
+bool AArch64InstrInfo::isTailCall(const MachineInstr &Inst) const
+{
+  switch (Inst.getOpcode()) {
+  case AArch64::TCRETURNdi:
+  case AArch64::TCRETURNri:
+    return true;
+  default:
+    return false;
+  }
+}
+
 // Is this a candidate for ld/st merging or pairing?  For example, we don't
 // touch volatiles or load/stores that have a hint to avoid pair formation.
 bool AArch64InstrInfo::isCandidateToMergeOrPair(MachineInstr &MI) const {

Modified: llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.h?rev=293080&r1=293079&r2=293080&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.h (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.h Wed Jan 25 14:21:49 2017
@@ -87,6 +87,8 @@ public:
   /// Return true if this is an unscaled load/store.
   bool isUnscaledLdSt(MachineInstr &MI) const;
 
+  bool isTailCall(const MachineInstr &Inst) const override;
+
   static bool isPairableLdStInst(const MachineInstr &MI) {
     switch (MI.getOpcode()) {
     default:

Added: llvm/trunk/test/CodeGen/AArch64/xray-tail-call-sled.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/xray-tail-call-sled.ll?rev=293080&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/AArch64/xray-tail-call-sled.ll (added)
+++ llvm/trunk/test/CodeGen/AArch64/xray-tail-call-sled.ll Wed Jan 25 14:21:49 2017
@@ -0,0 +1,69 @@
+; RUN: llc -filetype=asm -o - -mtriple=aarch64-linux-gnu < %s | FileCheck %s
+
+define i32 @callee() nounwind noinline uwtable "function-instrument"="xray-always" {
+; CHECK:       .p2align	2
+; CHECK-LABEL: .Lxray_sled_0:
+; CHECK-NEXT:  b	#32
+; CHECK-NEXT:  nop
+; CHECK-NEXT:  nop
+; CHECK-NEXT:  nop
+; CHECK-NEXT:  nop
+; CHECK-NEXT:  nop
+; CHECK-NEXT:  nop
+; CHECK-NEXT:  nop
+; CHECK-LABEL: .Ltmp0:
+  ret i32 0
+; CHECK-NEXT:  mov	w0, wzr
+; CHECK-NEXT:  .p2align	2
+; CHECK-LABEL: .Lxray_sled_1:
+; CHECK-NEXT:  b	#32
+; CHECK-NEXT:  nop
+; CHECK-NEXT:  nop
+; CHECK-NEXT:  nop
+; CHECK-NEXT:  nop
+; CHECK-NEXT:  nop
+; CHECK-NEXT:  nop
+; CHECK-NEXT:  nop
+; CHECK-LABEL: .Ltmp1:
+; CHECK-NEXT:  ret
+}
+; CHECK:       .p2align 4
+; CHECK-NEXT:  .xword .Lxray_synthetic_0
+; CHECK-NEXT:  .section xray_instr_map,{{.*}}
+; CHECK-LABEL: Lxray_synthetic_0:
+; CHECK:       .xword .Lxray_sled_0
+; CHECK:       .xword .Lxray_sled_1
+
+define i32 @caller() nounwind noinline uwtable "function-instrument"="xray-always" {
+; CHECK:       .p2align	2
+; CHECK-LABEL: .Lxray_sled_2:
+; CHECK-NEXT:  b	#32
+; CHECK-NEXT:  nop
+; CHECK-NEXT:  nop
+; CHECK-NEXT:  nop
+; CHECK-NEXT:  nop
+; CHECK-NEXT:  nop
+; CHECK-NEXT:  nop
+; CHECK-NEXT:  nop
+; CHECK-LABEL: .Ltmp2:
+; CHECK:       .p2align	2
+; CHECK-LABEL: .Lxray_sled_3:
+; CHECK-NEXT:  b	#32
+; CHECK-NEXT:  nop
+; CHECK-NEXT:  nop
+; CHECK-NEXT:  nop
+; CHECK-NEXT:  nop
+; CHECK-NEXT:  nop
+; CHECK-NEXT:  nop
+; CHECK-NEXT:  nop
+; CHECK-LABEL: .Ltmp3:
+  %retval = tail call i32 @callee()
+; CHECK:       b	callee
+  ret i32 %retval
+}
+; CHECK:       .p2align 4
+; CHECK-NEXT:  .xword .Lxray_synthetic_1
+; CHECK-NEXT:  .section xray_instr_map,{{.*}}
+; CHECK-LABEL: Lxray_synthetic_1:
+; CHECK:       .xword .Lxray_sled_2
+; CHECK:       .xword .Lxray_sled_3




More information about the llvm-commits mailing list