mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-26 20:26:07 +00:00
Move the complex address expression out of DIVariable and into an extra
argument of the llvm.dbg.declare/llvm.dbg.value intrinsics. Previously, DIVariable was a variable-length field that has an optional reference to a Metadata array consisting of a variable number of complex address expressions. In the case of OpPiece expressions this is wasting a lot of storage in IR, because when an aggregate type is, e.g., SROA'd into all of its n individual members, the IR will contain n copies of the DIVariable, all alike, only differing in the complex address reference at the end. By making the complex address into an extra argument of the dbg.value/dbg.declare intrinsics, all of the pieces can reference the same variable and the complex address expressions can be uniqued across the CU, too. Down the road, this will allow us to move other flags, such as "indirection" out of the DIVariable, too. The new intrinsics look like this: declare void @llvm.dbg.declare(metadata %storage, metadata %var, metadata %expr) declare void @llvm.dbg.value(metadata %storage, i64 %offset, metadata %var, metadata %expr) This patch adds a new LLVM-local tag to DIExpressions, so we can detect and pretty-print DIExpression metadata nodes. What this patch doesn't do: This patch does not touch the "Indirect" field in DIVariable; but moving that into the expression would be a natural next step. http://reviews.llvm.org/D4919 rdar://problem/17994491 Thanks to dblaikie and dexonsmith for reviewing this patch! Note: I accidentally committed a bogus older version of this patch previously. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218787 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -32,8 +32,8 @@ define i32 @main(i32 %argc, i8** nocapture readonly %argv) #0 {
|
||||
; CHECK: Printing analysis 'Branch Probability Analysis' for function 'main':
|
||||
|
||||
entry:
|
||||
tail call void @llvm.dbg.value(metadata !{i32 %argc}, i64 0, metadata !13), !dbg !27
|
||||
tail call void @llvm.dbg.value(metadata !{i8** %argv}, i64 0, metadata !14), !dbg !27
|
||||
tail call void @llvm.dbg.value(metadata !{i32 %argc}, i64 0, metadata !13, metadata !{}), !dbg !27
|
||||
tail call void @llvm.dbg.value(metadata !{i8** %argv}, i64 0, metadata !14, metadata !{}), !dbg !27
|
||||
%cmp = icmp slt i32 %argc, 2, !dbg !28
|
||||
br i1 %cmp, label %return, label %if.end, !dbg !28
|
||||
; CHECK: edge entry -> return probability is 1 / 2 = 50%
|
||||
@@ -43,7 +43,7 @@ if.end: ; preds = %entry
|
||||
%arrayidx = getelementptr inbounds i8** %argv, i64 1, !dbg !30
|
||||
%0 = load i8** %arrayidx, align 8, !dbg !30, !tbaa !31
|
||||
%call = tail call i32 @atoi(i8* %0) #4, !dbg !30
|
||||
tail call void @llvm.dbg.value(metadata !{i32 %call}, i64 0, metadata !17), !dbg !30
|
||||
tail call void @llvm.dbg.value(metadata !{i32 %call}, i64 0, metadata !17, metadata !{}), !dbg !30
|
||||
%cmp1 = icmp sgt i32 %call, 100, !dbg !35
|
||||
br i1 %cmp1, label %for.body, label %if.end6, !dbg !35
|
||||
; CHECK: edge if.end -> for.body probability is 1 / 2 = 50%
|
||||
@@ -55,14 +55,14 @@ for.body: ; preds = %if.end, %for.body
|
||||
%add = fadd double %s.015, 3.049000e+00, !dbg !36
|
||||
%conv = sitofp i32 %u.016 to double, !dbg !36
|
||||
%add4 = fadd double %add, %conv, !dbg !36
|
||||
tail call void @llvm.dbg.value(metadata !{double %add4}, i64 0, metadata !18), !dbg !36
|
||||
tail call void @llvm.dbg.value(metadata !{double %add4}, i64 0, metadata !18, metadata !{}), !dbg !36
|
||||
%div = fdiv double 3.940000e+00, %s.015, !dbg !37
|
||||
%mul = fmul double %div, 3.200000e-01, !dbg !37
|
||||
%add5 = fadd double %add4, %mul, !dbg !37
|
||||
%sub = fsub double %add4, %add5, !dbg !37
|
||||
tail call void @llvm.dbg.value(metadata !{double %sub}, i64 0, metadata !18), !dbg !37
|
||||
tail call void @llvm.dbg.value(metadata !{double %sub}, i64 0, metadata !18, metadata !{}), !dbg !37
|
||||
%inc = add nsw i32 %u.016, 1, !dbg !38
|
||||
tail call void @llvm.dbg.value(metadata !{i32 %inc}, i64 0, metadata !21), !dbg !38
|
||||
tail call void @llvm.dbg.value(metadata !{i32 %inc}, i64 0, metadata !21, metadata !{}), !dbg !38
|
||||
%exitcond = icmp eq i32 %inc, %call, !dbg !38
|
||||
br i1 %exitcond, label %if.end6, label %for.body, !dbg !38
|
||||
; CHECK: edge for.body -> if.end6 probability is 1 / 10227 = 0.00977804
|
||||
@@ -86,7 +86,7 @@ declare i32 @atoi(i8* nocapture) #1
|
||||
declare i32 @printf(i8* nocapture readonly, ...) #2
|
||||
|
||||
; Function Attrs: nounwind readnone
|
||||
declare void @llvm.dbg.value(metadata, i64, metadata) #3
|
||||
declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #3
|
||||
|
||||
attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
||||
attributes #1 = { nounwind readonly "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
||||
|
Reference in New Issue
Block a user