mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-28 19:31:58 +00:00
1ef70ff39b
Now that `Metadata` is typeless, reflect that in the assembly. These are the matching assembly changes for the metadata/value split in r223802. - Only use the `metadata` type when referencing metadata from a call intrinsic -- i.e., only when it's used as a `Value`. - Stop pretending that `ValueAsMetadata` is wrapped in an `MDNode` when referencing it from call intrinsics. So, assembly like this: define @foo(i32 %v) { call void @llvm.foo(metadata !{i32 %v}, metadata !0) call void @llvm.foo(metadata !{i32 7}, metadata !0) call void @llvm.foo(metadata !1, metadata !0) call void @llvm.foo(metadata !3, metadata !0) call void @llvm.foo(metadata !{metadata !3}, metadata !0) ret void, !bar !2 } !0 = metadata !{metadata !2} !1 = metadata !{i32* @global} !2 = metadata !{metadata !3} !3 = metadata !{} turns into this: define @foo(i32 %v) { call void @llvm.foo(metadata i32 %v, metadata !0) call void @llvm.foo(metadata i32 7, metadata !0) call void @llvm.foo(metadata i32* @global, metadata !0) call void @llvm.foo(metadata !3, metadata !0) call void @llvm.foo(metadata !{!3}, metadata !0) ret void, !bar !2 } !0 = !{!2} !1 = !{i32* @global} !2 = !{!3} !3 = !{} I wrote an upgrade script that handled almost all of the tests in llvm and many of the tests in cfe (even handling many `CHECK` lines). I've attached it (or will attach it in a moment if you're speedy) to PR21532 to help everyone update their out-of-tree testcases. This is part of PR21532. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224257 91177308-0d34-0410-b5e6-96231b3b80d8
77 lines
3.9 KiB
LLVM
77 lines
3.9 KiB
LLVM
; RUN: llc < %s
|
|
|
|
target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:64:64-v128:128:128-a0:0:32-n32"
|
|
target triple = "thumbv7-apple-darwin3.0.0-iphoneos"
|
|
|
|
@length = common global i32 0, align 4 ; <i32*> [#uses=1]
|
|
|
|
define void @x0(i8* nocapture %buf, i32 %nbytes) nounwind optsize {
|
|
entry:
|
|
tail call void @llvm.dbg.value(metadata i8* %buf, i64 0, metadata !0, metadata !{!"0x102"}), !dbg !15
|
|
tail call void @llvm.dbg.value(metadata i32 %nbytes, i64 0, metadata !8, metadata !{!"0x102"}), !dbg !16
|
|
%tmp = load i32* @length, !dbg !17 ; <i32> [#uses=3]
|
|
%cmp = icmp eq i32 %tmp, -1, !dbg !17 ; <i1> [#uses=1]
|
|
%cmp.not = xor i1 %cmp, true ; <i1> [#uses=1]
|
|
%cmp3 = icmp ult i32 %tmp, %nbytes, !dbg !17 ; <i1> [#uses=1]
|
|
%or.cond = and i1 %cmp.not, %cmp3 ; <i1> [#uses=1]
|
|
tail call void @llvm.dbg.value(metadata i32 %tmp, i64 0, metadata !8, metadata !{!"0x102"}), !dbg !17
|
|
%nbytes.addr.0 = select i1 %or.cond, i32 %tmp, i32 %nbytes ; <i32> [#uses=1]
|
|
tail call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !10, metadata !{!"0x102"}), !dbg !19
|
|
br label %while.cond, !dbg !20
|
|
|
|
while.cond: ; preds = %while.body, %entry
|
|
%0 = phi i32 [ 0, %entry ], [ %inc, %while.body ] ; <i32> [#uses=3]
|
|
%buf.addr.0 = getelementptr i8* %buf, i32 %0 ; <i8*> [#uses=1]
|
|
%cmp7 = icmp ult i32 %0, %nbytes.addr.0, !dbg !20 ; <i1> [#uses=1]
|
|
br i1 %cmp7, label %land.rhs, label %while.end, !dbg !20
|
|
|
|
land.rhs: ; preds = %while.cond
|
|
%call = tail call i32 @x1() nounwind optsize, !dbg !20 ; <i32> [#uses=2]
|
|
%cmp9 = icmp eq i32 %call, -1, !dbg !20 ; <i1> [#uses=1]
|
|
br i1 %cmp9, label %while.end, label %while.body, !dbg !20
|
|
|
|
while.body: ; preds = %land.rhs
|
|
%conv = trunc i32 %call to i8, !dbg !21 ; <i8> [#uses=1]
|
|
store i8 %conv, i8* %buf.addr.0, !dbg !21
|
|
%inc = add i32 %0, 1, !dbg !23 ; <i32> [#uses=1]
|
|
br label %while.cond, !dbg !24
|
|
|
|
while.end: ; preds = %land.rhs, %while.cond
|
|
ret void, !dbg !25
|
|
}
|
|
|
|
declare i32 @x1() optsize
|
|
|
|
declare void @llvm.dbg.value(metadata, i64, metadata, metadata) nounwind readnone
|
|
|
|
!llvm.dbg.lv.fn = !{!0, !8, !10, !12}
|
|
!llvm.dbg.gv = !{!14}
|
|
|
|
!0 = !{!"0x101\00buf\004\000", !1, !2, !6} ; [ DW_TAG_arg_variable ]
|
|
!1 = !{!"0x2e\00x0\00x0\00x0\005\000\001\000\006\000\000\000", !26, null, !4, null, null, null, null, null} ; [ DW_TAG_subprogram ]
|
|
!2 = !{!"0x29", !26} ; [ DW_TAG_file_type ]
|
|
!3 = !{!"0x11\0012\00clang 2.0\001\00\00\00\00", !26, null, null, null, null, null} ; [ DW_TAG_compile_unit ]
|
|
!4 = !{!"0x15\00\000\000\000\000\000\000", !26, !2, null, !5, null} ; [ DW_TAG_subroutine_type ]
|
|
!5 = !{null}
|
|
!6 = !{!"0xf\00\000\0032\0032\000\000", !26, !2, !7} ; [ DW_TAG_pointer_type ]
|
|
!7 = !{!"0x24\00unsigned char\000\008\008\000\000\008", !26, !2} ; [ DW_TAG_base_type ]
|
|
!8 = !{!"0x101\00nbytes\004\000", !1, !2, !9} ; [ DW_TAG_arg_variable ]
|
|
!9 = !{!"0x24\00unsigned long\000\0032\0032\000\000\007", !26, !2} ; [ DW_TAG_base_type ]
|
|
!10 = !{!"0x100\00nread\006\000", !11, !2, !9} ; [ DW_TAG_auto_variable ]
|
|
!11 = !{!"0xb\005\001\000", !26, !1} ; [ DW_TAG_lexical_block ]
|
|
!12 = !{!"0x100\00c\007\000", !11, !2, !13} ; [ DW_TAG_auto_variable ]
|
|
!13 = !{!"0x24\00int\000\0032\0032\000\000\005", !26, !2} ; [ DW_TAG_base_type ]
|
|
!14 = !{!"0x34\00length\00length\00length\001\000\001", !2, !2, !13, i32* @length} ; [ DW_TAG_variable ]
|
|
!15 = !{i32 4, i32 24, !1, null}
|
|
!16 = !{i32 4, i32 43, !1, null}
|
|
!17 = !{i32 9, i32 2, !11, null}
|
|
!18 = !{i32 0}
|
|
!19 = !{i32 10, i32 2, !11, null}
|
|
!20 = !{i32 11, i32 2, !11, null}
|
|
!21 = !{i32 12, i32 3, !22, null}
|
|
!22 = !{!"0xb\0011\0045\000", !26, !11} ; [ DW_TAG_lexical_block ]
|
|
!23 = !{i32 13, i32 3, !22, null}
|
|
!24 = !{i32 14, i32 2, !22, null}
|
|
!25 = !{i32 15, i32 1, !11, null}
|
|
!26 = !{!"t.c", !"/private/tmp"}
|