mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
74e4e285b0
Debug entry values functionality provides debug information about call sites and function parameters values at the call entry spot. Condition for generating this type of information is compiling with -g option and optimization level higher than zero(-O0). In ISEL phase, while lowering call instructions, collect info about registers that forward arguments into following function frame. We store such info into MachineFunction of the caller function. This is used very late, when dumping DWARF info about call site parameters. The call site info is visible at MIR level, as callSites attribute of MachineFunction. Also, when using unmodified parameter value inside callee it could be described as DW_OP_entry_value expression. To deal with callSites attribute, we should pass -emit-call-site-info option to llc. This patch enables functionality in clang frontend and adds call site info generation support for MIPS targets (mips, mipsel, mips64, mips64el). Patch by Nikola Tesic Differential Revision: https://reviews.llvm.org/D78105
66 lines
2.6 KiB
LLVM
66 lines
2.6 KiB
LLVM
;; Test mips32:
|
|
; RUN: llc -mtriple=mips-linux-gnu -emit-call-site-info %s -stop-before=finalize-isel -o -| \
|
|
; RUN: llc -mtriple=mips-linux-gnu -emit-call-site-info -x='mir' -run-pass=finalize-isel -o -| FileCheck %s
|
|
;; Test mips64:
|
|
; RUN: llc -mtriple=mips64-linux-gnu -emit-call-site-info %s -stop-before=finalize-isel -o -| \
|
|
; RUN: llc -mtriple=mips64-linux-gnu -emit-call-site-info -x='mir' -run-pass=finalize-isel -o -| FileCheck %s --check-prefix=CHECK64
|
|
;; Test mipsel:
|
|
; RUN: llc -mtriple=mipsel-linux-gnu -emit-call-site-info %s -stop-before=finalize-isel -o -| \
|
|
; RUN: llc -mtriple=mipsel-linux-gnu -emit-call-site-info -x='mir' -run-pass=finalize-isel -o -| FileCheck %s
|
|
;; Test mips64el:
|
|
; RUN: llc -mtriple=mips64el-linux-gnu -emit-call-site-info %s -stop-before=finalize-isel -o -| \
|
|
; RUN: llc -mtriple=mips64el-linux-gnu -emit-call-site-info -x='mir' -run-pass=finalize-isel -o -| FileCheck %s --check-prefix=CHECK64
|
|
|
|
;; Test call site info MIR parser and printer. Parser assertions and machine
|
|
;; verifier will check the rest.
|
|
;; There is no need to verify call instruction location since it will be
|
|
;; checked by the MIR parser.
|
|
;; Verify that we are able to parse output mir and that we are getting valid call site info.
|
|
|
|
;; Source:
|
|
;; extern int fn1(int,int,int);
|
|
;; int fn2(int a, int b, int c) {
|
|
;; int local = fn1(a+b, c, 10);
|
|
;; if (local > 10)
|
|
;; return local + 10;
|
|
;; return local;
|
|
;; }
|
|
|
|
;; Test mips32 and mips32el:
|
|
; CHECK: name: fn2
|
|
; CHECK: callSites:
|
|
; CHECK-NEXT: bb: {{.*}}, offset: {{.*}}, fwdArgRegs:
|
|
; CHECK-NEXT: arg: 0, reg: '$a0'
|
|
; CHECK-NEXT: arg: 1, reg: '$a1'
|
|
; CHECK-NEXT: arg: 2, reg: '$a2'
|
|
|
|
;; Test mips64 and mips64el:
|
|
; CHECK64: name: fn2
|
|
; CHECK64: callSites:
|
|
; CHECK64-NEXT: bb: {{.*}}, offset: {{.*}}, fwdArgRegs:
|
|
; CHECK64-NEXT: arg: 0, reg: '$a0_64'
|
|
; CHECK64-NEXT: arg: 1, reg: '$a1_64'
|
|
; CHECK64-NEXT: arg: 2, reg: '$a2_64'
|
|
|
|
; ModuleID = 'test/CodeGen/Mips/call-site-info-output.c'
|
|
source_filename = "test/CodeGen/Mips/call-site-info-output.c"
|
|
target datalayout = "E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64"
|
|
target triple = "mips-unknown-linux-gnu"
|
|
; Function Attrs: nounwind
|
|
define dso_local i32 @fn2(i32 signext %a, i32 signext %b, i32 signext %c) local_unnamed_addr {
|
|
entry:
|
|
%add = add nsw i32 %b, %a
|
|
%call = tail call i32 @fn1(i32 signext %add, i32 signext %c, i32 signext 10)
|
|
%cmp = icmp sgt i32 %call, 10
|
|
%add1 = add nsw i32 %call, 10
|
|
%retval.0 = select i1 %cmp, i32 %add1, i32 %call
|
|
ret i32 %retval.0
|
|
}
|
|
declare dso_local i32 @fn1(i32 signext, i32 signext, i32 signext) local_unnamed_addr
|
|
|
|
!llvm.module.flags = !{!0}
|
|
!llvm.ident = !{!1}
|
|
|
|
!0 = !{i32 1, !"wchar_size", i32 4}
|
|
!1 = !{!"clang version 11.0.0"}
|