IR: Canonicalize metadata formatting, NFC

Canonicalize formatting of metadata to make it easier to upgrade via
scripts -- in particular, one line per metadata definition makes it more
`sed`-able.

This is preparation for changing the assembly syntax for metadata [1].

[1]: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20141208/248449.html

llvm-svn: 224002
This commit is contained in:
Duncan P. N. Exon Smith 2014-12-11 06:32:29 +00:00
parent 643f94bc62
commit 6ec9edf8ee
6 changed files with 26 additions and 50 deletions

View File

@ -34,20 +34,13 @@ define void @kernel_func_minctasm(float* %a) {
!nvvm.annotations = !{!1, !2, !3, !4, !5, !6, !7, !8}
!1 = metadata !{void (float*)* @kernel_func_maxntid, metadata !"kernel", i32 1}
!2 = metadata !{void (float*)* @kernel_func_maxntid,
metadata !"maxntidx", i32 10,
metadata !"maxntidy", i32 20,
metadata !"maxntidz", i32 30}
!2 = metadata !{void (float*)* @kernel_func_maxntid, metadata !"maxntidx", i32 10, metadata !"maxntidy", i32 20, metadata !"maxntidz", i32 30}
!3 = metadata !{void (float*)* @kernel_func_reqntid, metadata !"kernel", i32 1}
!4 = metadata !{void (float*)* @kernel_func_reqntid,
metadata !"reqntidx", i32 11,
metadata !"reqntidy", i32 22,
metadata !"reqntidz", i32 33}
!4 = metadata !{void (float*)* @kernel_func_reqntid, metadata !"reqntidx", i32 11, metadata !"reqntidy", i32 22, metadata !"reqntidz", i32 33}
!5 = metadata !{void (float*)* @kernel_func_minctasm, metadata !"kernel", i32 1}
!6 = metadata !{void (float*)* @kernel_func_minctasm,
metadata !"minctasm", i32 42}
!6 = metadata !{void (float*)* @kernel_func_minctasm, metadata !"minctasm", i32 42}
!7 = metadata !{i64 addrspace(1)* @texture, metadata !"texture", i32 1}
!8 = metadata !{i64 addrspace(1)* @surface, metadata !"surface", i32 1}

View File

@ -1,8 +1,6 @@
; This file is used with module-flags-3-a.ll
; RUN: true
!0 = metadata !{ i32 3, metadata !"foo",
metadata !{ metadata !"bar", i32 42 }
}
!0 = metadata !{i32 3, metadata !"foo", metadata !{metadata !"bar", i32 42}}
!llvm.module.flags = !{ !0 }

View File

@ -1,8 +1,6 @@
; This file is used with module-flags-4-a.ll
; RUN: true
!0 = metadata !{ i32 3, metadata !"foo",
metadata !{ metadata !"bar", i32 42 }
}
!0 = metadata !{i32 3, metadata !"foo", metadata !{metadata !"bar", i32 42}}
!llvm.module.flags = !{ !0 }

View File

@ -1,12 +1,6 @@
; RUN: llc -O0 -mtriple=i386-pc-win32 -filetype=asm -o - %s | FileCheck %s
!0 = metadata !{ i32 6, metadata !"Linker Options",
metadata !{
metadata !{ metadata !"/DEFAULTLIB:msvcrt.lib" },
metadata !{ metadata !"/DEFAULTLIB:msvcrt.lib",
metadata !"/DEFAULTLIB:secur32.lib" },
metadata !{ metadata !"/DEFAULTLIB:C:\5Cpath to\5Casan_rt.lib" },
metadata !{ metadata !"/with spaces" } } }
!0 = metadata !{i32 6, metadata !"Linker Options", metadata !{metadata !{metadata !"/DEFAULTLIB:msvcrt.lib"}, metadata !{metadata !"/DEFAULTLIB:msvcrt.lib", metadata !"/DEFAULTLIB:secur32.lib"}, metadata !{metadata !"/DEFAULTLIB:C:\5Cpath to\5Casan_rt.lib"}, metadata !{metadata !"/with spaces"}}}
!llvm.module.flags = !{ !0 }

View File

@ -34,10 +34,6 @@
; CHECK-OBJ: ),
; CHECK-OBJ: ])
!0 = metadata !{ i32 6, metadata !"Linker Options",
metadata !{
metadata !{ metadata !"-lz" },
metadata !{ metadata !"-framework", metadata !"Cocoa" },
metadata !{ metadata !"-lmath" } } }
!0 = metadata !{i32 6, metadata !"Linker Options", metadata !{metadata !{metadata !"-lz"}, metadata !{metadata !"-framework", metadata !"Cocoa"}, metadata !{metadata !"-lmath"}}}
!llvm.module.flags = !{ !0 }

View File

@ -4,56 +4,53 @@
;
; CHECK: incorrect number of operands in module flag
; CHECK: metadata !0
!0 = metadata !{ i32 1 }
!0 = metadata !{i32 1}
; CHECK: invalid behavior operand in module flag (expected constant integer)
; CHECK: metadata !"foo"
!1 = metadata !{ metadata !"foo", metadata !"foo", i32 42 }
!1 = metadata !{metadata !"foo", metadata !"foo", i32 42}
; CHECK: invalid behavior operand in module flag (unexpected constant)
; CHECK: i32 999
!2 = metadata !{ i32 999, metadata !"foo", i32 43 }
!2 = metadata !{i32 999, metadata !"foo", i32 43}
; CHECK: invalid ID operand in module flag (expected metadata string)
; CHECK: i32 1
!3 = metadata !{ i32 1, i32 1, i32 44 }
!3 = metadata !{i32 1, i32 1, i32 44}
; CHECK: invalid value for 'require' module flag (expected metadata pair)
; CHECK: i32 45
!4 = metadata !{ i32 3, metadata !"bla", i32 45 }
!4 = metadata !{i32 3, metadata !"bla", i32 45}
; CHECK: invalid value for 'require' module flag (expected metadata pair)
; CHECK: metadata !
!5 = metadata !{ i32 3, metadata !"bla", metadata !{ i32 46 } }
!5 = metadata !{i32 3, metadata !"bla", metadata !{i32 46}}
; CHECK: invalid value for 'require' module flag (first value operand should be a string)
; CHECK: i32 47
!6 = metadata !{ i32 3, metadata !"bla", metadata !{ i32 47, i32 48 } }
!6 = metadata !{i32 3, metadata !"bla", metadata !{i32 47, i32 48}}
; Check that module flags only have unique IDs.
;
; CHECK: module flag identifiers must be unique (or of 'require' type)
!7 = metadata !{ i32 1, metadata !"foo", i32 49 }
!8 = metadata !{ i32 2, metadata !"foo", i32 50 }
!7 = metadata !{i32 1, metadata !"foo", i32 49}
!8 = metadata !{i32 2, metadata !"foo", i32 50}
; CHECK-NOT: module flag identifiers must be unique
!9 = metadata !{ i32 2, metadata !"bar", i32 51 }
!10 = metadata !{ i32 3, metadata !"bar", metadata !{ metadata !"bar", i32 51 } }
!9 = metadata !{i32 2, metadata !"bar", i32 51}
!10 = metadata !{i32 3, metadata !"bar", metadata !{metadata !"bar", i32 51}}
; Check that any 'append'-type module flags are valid.
; CHECK: invalid value for 'append'-type module flag (expected a metadata node)
!16 = metadata !{ i32 5, metadata !"flag-2", i32 56 }
!16 = metadata !{i32 5, metadata !"flag-2", i32 56}
; CHECK: invalid value for 'append'-type module flag (expected a metadata node)
!17 = metadata !{ i32 5, metadata !"flag-3", i32 57 }
!17 = metadata !{i32 5, metadata !"flag-3", i32 57}
; CHECK-NOT: invalid value for 'append'-type module flag (expected a metadata node)
!18 = metadata !{ i32 5, metadata !"flag-4", metadata !{ i32 57 } }
!18 = metadata !{i32 5, metadata !"flag-4", metadata !{i32 57}}
; Check that any 'require' module flags are valid.
; CHECK: invalid requirement on flag, flag is not present in module
!11 = metadata !{ i32 3, metadata !"bar",
metadata !{ metadata !"no-such-flag", i32 52 } }
!11 = metadata !{i32 3, metadata !"bar", metadata !{metadata !"no-such-flag", i32 52}}
; CHECK: invalid requirement on flag, flag does not have the required value
!12 = metadata !{ i32 1, metadata !"flag-0", i32 53 }
!13 = metadata !{ i32 3, metadata !"bar",
metadata !{ metadata !"flag-0", i32 54 } }
!12 = metadata !{i32 1, metadata !"flag-0", i32 53}
!13 = metadata !{i32 3, metadata !"bar", metadata !{metadata !"flag-0", i32 54}}
; CHECK-NOT: invalid requirement on flag, flag is not present in module
; CHECK-NOT: invalid requirement on flag, flag does not have the required value
!14 = metadata !{ i32 1, metadata !"flag-1", i32 55 }
!15 = metadata !{ i32 3, metadata !"bar",
metadata !{ metadata !"flag-1", i32 55 } }
!14 = metadata !{i32 1, metadata !"flag-1", i32 55}
!15 = metadata !{i32 3, metadata !"bar", metadata !{metadata !"flag-1", i32 55}}
!llvm.module.flags = !{
!0, !1, !2, !3, !4, !5, !6, !7, !8, !9, !10, !11, !12, !13, !14, !15,