[llvm-branch-commits] [llvm-branch] r117425 [9/9] - in /llvm/branches/wendling/eh: ./ autoconf/ autoconf/m4/ bindings/ada/ bindings/ocaml/llvm/ bindings/ocaml/transforms/scalar/ cmake/ cmake/modules/ docs/ docs/CommandGuide/ docs/tutorial/ examples/ examples/BrainF/ examples/ExceptionDemo/ examples/Fibonacci/ examples/Kaleidoscope/Chapter7/ examples/ModuleMaker/ include/llvm-c/ include/llvm-c/Transforms/ include/llvm/ include/llvm/ADT/ include/llvm/Analysis/ include/llvm/Assembly/ include/llvm/Bitcode/ include/llvm/CodeGen/ i...

Bill Wendling isanbard at gmail.com
Tue Oct 26 17:48:11 PDT 2010


Removed: llvm/branches/wendling/eh/test/Integer/a17.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Integer/a17.ll?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/test/Integer/a17.ll (original)
+++ llvm/branches/wendling/eh/test/Integer/a17.ll (removed)
@@ -1,25 +0,0 @@
-; RUN: llvm-as %s -o - | llvm-dis > %t.ll
-; RUN: diff %t.ll %s.out
-
-; test 17 bits
-;
- at b = constant i17 add(i17 131071, i17 1)
- at c = constant i17 add(i17 131071, i17 131071)
- at d = constant i17 add(i17 131064, i17 8)
- at e = constant i17 sub(i17 0 , i17 1)
- at f = constant i17 sub(i17 0 , i17 131071)
- at g = constant i17 sub(i17 2 , i17 131071)
-
- at h = constant i17 shl(i17 1 , i17 17)
- at i = constant i17 shl(i17 1 , i17 16)
- at j = constant i17 lshr(i17 131071 , i17 16)
- at l = constant i17 ashr(i17 131071 , i17 16)
-
- at n = constant i17 mul(i17 131071, i17 2) 
- at q = constant i17 sdiv(i17 -1,    i17 65535)
- at r = constant i17 udiv(i17 -1,    i17 65535)
- at s = constant i17 srem(i17  1,    i17 131070)
- at t = constant i17 urem(i17 131071,i17 -1)
- at o = constant i17 trunc( i18 131072  to i17 )
- at p = constant i17 trunc( i18 131071  to i17 )
- at v = constant i17 srem(i17  -1,    i17 15)

Removed: llvm/branches/wendling/eh/test/Integer/a17.ll.out
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Integer/a17.ll.out?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/test/Integer/a17.ll.out (original)
+++ llvm/branches/wendling/eh/test/Integer/a17.ll.out (removed)
@@ -1,20 +0,0 @@
-; ModuleID = '<stdin>'
-
- at b = constant i17 0                               ; <i17*> [#uses=0]
- at c = constant i17 -2                              ; <i17*> [#uses=0]
- at d = constant i17 0                               ; <i17*> [#uses=0]
- at e = constant i17 -1                              ; <i17*> [#uses=0]
- at f = constant i17 1                               ; <i17*> [#uses=0]
- at g = constant i17 3                               ; <i17*> [#uses=0]
- at h = constant i17 undef                           ; <i17*> [#uses=0]
- at i = constant i17 -65536                          ; <i17*> [#uses=0]
- at j = constant i17 1                               ; <i17*> [#uses=0]
- at l = constant i17 -1                              ; <i17*> [#uses=0]
- at n = constant i17 -2                              ; <i17*> [#uses=0]
- at q = constant i17 0                               ; <i17*> [#uses=0]
- at r = constant i17 2                               ; <i17*> [#uses=0]
- at s = constant i17 1                               ; <i17*> [#uses=0]
- at t = constant i17 0                               ; <i17*> [#uses=0]
- at o = constant i17 0                               ; <i17*> [#uses=0]
- at p = constant i17 -1                              ; <i17*> [#uses=0]
- at v = constant i17 -1                              ; <i17*> [#uses=0]

Removed: llvm/branches/wendling/eh/test/Integer/a31.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Integer/a31.ll?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/test/Integer/a31.ll (original)
+++ llvm/branches/wendling/eh/test/Integer/a31.ll (removed)
@@ -1,25 +0,0 @@
-; RUN: llvm-as %s -o - | llvm-dis > %t.ll
-; RUN: diff %t.ll %s.out
-
-; test 31 bits
-;
- at b = constant i31 add(i31 2147483647, i31 1)
- at c = constant i31 add(i31 2147483647, i31 2147483647)
- at d = constant i31 add(i31 2147483640, i31 8)
- at e = constant i31 sub(i31 0 , i31 1)
- at f = constant i31 sub(i31 0 , i31 2147483647)
- at g = constant i31 sub(i31 2 , i31 2147483647)
-
- at h = constant i31 shl(i31 1 , i31 31)
- at i = constant i31 shl(i31 1 , i31 30)
- at j = constant i31 lshr(i31 2147483647 , i31 30)
- at l = constant i31 ashr(i31 2147483647 , i31 30)
-
- at n = constant i31 mul(i31 2147483647, i31 2)
- at q = constant i31 sdiv(i31 -1,        i31 1073741823)
- at r = constant i31 udiv(i31 -1,        i31 1073741823)
- at s = constant i31 srem(i31  1,        i31 2147483646)
- at t = constant i31 urem(i31 2147483647,i31 -1)
- at o = constant i31 trunc( i32 2147483648  to i31 )
- at p = constant i31 trunc( i32 2147483647  to i31 ) 
- at u = constant i31 srem(i31 -3,        i31 17)

Removed: llvm/branches/wendling/eh/test/Integer/a31.ll.out
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Integer/a31.ll.out?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/test/Integer/a31.ll.out (original)
+++ llvm/branches/wendling/eh/test/Integer/a31.ll.out (removed)
@@ -1,20 +0,0 @@
-; ModuleID = '<stdin>'
-
- at b = constant i31 0                               ; <i31*> [#uses=0]
- at c = constant i31 -2                              ; <i31*> [#uses=0]
- at d = constant i31 0                               ; <i31*> [#uses=0]
- at e = constant i31 -1                              ; <i31*> [#uses=0]
- at f = constant i31 1                               ; <i31*> [#uses=0]
- at g = constant i31 3                               ; <i31*> [#uses=0]
- at h = constant i31 undef                           ; <i31*> [#uses=0]
- at i = constant i31 -1073741824                     ; <i31*> [#uses=0]
- at j = constant i31 1                               ; <i31*> [#uses=0]
- at l = constant i31 -1                              ; <i31*> [#uses=0]
- at n = constant i31 -2                              ; <i31*> [#uses=0]
- at q = constant i31 0                               ; <i31*> [#uses=0]
- at r = constant i31 2                               ; <i31*> [#uses=0]
- at s = constant i31 1                               ; <i31*> [#uses=0]
- at t = constant i31 0                               ; <i31*> [#uses=0]
- at o = constant i31 0                               ; <i31*> [#uses=0]
- at p = constant i31 -1                              ; <i31*> [#uses=0]
- at u = constant i31 -3                              ; <i31*> [#uses=0]

Removed: llvm/branches/wendling/eh/test/Integer/a33.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Integer/a33.ll?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/test/Integer/a33.ll (original)
+++ llvm/branches/wendling/eh/test/Integer/a33.ll (removed)
@@ -1,26 +0,0 @@
-; RUN: llvm-as %s -o - | llvm-dis > %t.ll
-; RUN: diff %t.ll %s.out
-
-; test 33 bits
-;
- at b = constant i33 add(i33 8589934591, i33 1)
- at c = constant i33 add(i33 8589934591, i33 8589934591)
- at d = constant i33 add(i33 8589934584, i33 8)
- at e = constant i33 sub(i33 0 , i33 1)
- at f = constant i33 sub(i33 0 , i33 8589934591)
- at g = constant i33 sub(i33 2 , i33 8589934591)
-
- at h = constant i33 shl(i33 1 , i33 33)
- at i = constant i33 shl(i33 1 , i33 32)
- at j = constant i33 lshr(i33 8589934591 , i33 32)
- at l = constant i33 ashr(i33 8589934591 , i33 32)
-
- at n = constant i33 mul(i33 8589934591, i33 2)
- at q = constant i33 sdiv(i33 -1,        i33 4294967295)
- at r = constant i33 udiv(i33 -1,        i33 4294967295)
- at s = constant i33 srem(i33  1,        i33 8589934590)
- at t = constant i33 urem(i33 8589934591,i33 -1)
- at o = constant i33 trunc( i34 8589934592 to i33 )
- at p = constant i33 trunc( i34 8589934591  to i33 )
- at u = constant i33 srem(i33  -1,       i33 17)
- 

Removed: llvm/branches/wendling/eh/test/Integer/a33.ll.out
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Integer/a33.ll.out?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/test/Integer/a33.ll.out (original)
+++ llvm/branches/wendling/eh/test/Integer/a33.ll.out (removed)
@@ -1,20 +0,0 @@
-; ModuleID = '<stdin>'
-
- at b = constant i33 0                               ; <i33*> [#uses=0]
- at c = constant i33 -2                              ; <i33*> [#uses=0]
- at d = constant i33 0                               ; <i33*> [#uses=0]
- at e = constant i33 -1                              ; <i33*> [#uses=0]
- at f = constant i33 1                               ; <i33*> [#uses=0]
- at g = constant i33 3                               ; <i33*> [#uses=0]
- at h = constant i33 undef                           ; <i33*> [#uses=0]
- at i = constant i33 -4294967296                     ; <i33*> [#uses=0]
- at j = constant i33 1                               ; <i33*> [#uses=0]
- at l = constant i33 -1                              ; <i33*> [#uses=0]
- at n = constant i33 -2                              ; <i33*> [#uses=0]
- at q = constant i33 0                               ; <i33*> [#uses=0]
- at r = constant i33 2                               ; <i33*> [#uses=0]
- at s = constant i33 1                               ; <i33*> [#uses=0]
- at t = constant i33 0                               ; <i33*> [#uses=0]
- at o = constant i33 0                               ; <i33*> [#uses=0]
- at p = constant i33 -1                              ; <i33*> [#uses=0]
- at u = constant i33 -1                              ; <i33*> [#uses=0]

Removed: llvm/branches/wendling/eh/test/Integer/a63.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Integer/a63.ll?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/test/Integer/a63.ll (original)
+++ llvm/branches/wendling/eh/test/Integer/a63.ll (removed)
@@ -1,25 +0,0 @@
-; RUN: llvm-as %s -o - | llvm-dis > %t.ll
-; RUN: diff %t.ll %s.out
-
-; test 63 bits
-;
- at b = constant i63 add(i63 9223372036854775807, i63 1)
- at c = constant i63 add(i63 9223372036854775807, i63 9223372036854775807)
- at d = constant i63 add(i63 9223372036854775800, i63 8)
- at e = constant i63 sub(i63 0 , i63 1)
- at f = constant i63 sub(i63 0 , i63 9223372036854775807)
- at g = constant i63 sub(i63 2 , i63 9223372036854775807)
-
- at h = constant i63 shl(i63 1 , i63 63)
- at i = constant i63 shl(i63 1 , i63 62)
- at j = constant i63 lshr(i63 9223372036854775807 , i63 62)
- at l = constant i63 ashr(i63 9223372036854775807 , i63 62)
-
- at n = constant i63 mul(i63 9223372036854775807, i63 2) 
- at q = constant i63 sdiv(i63 -1,                 i63 4611686018427387903)
- at u = constant i63 sdiv(i63 -1,                 i63 1)
- at r = constant i63 udiv(i63 -1,                 i63 4611686018427387903)
- at s = constant i63 srem(i63  3,                 i63 9223372036854775806)
- at t = constant i63 urem(i63 9223372036854775807,i63 -1)
- at o = constant i63 trunc( i64 9223372036854775808 to i63 )
- at p = constant i63 trunc( i64 9223372036854775807  to i63 )

Removed: llvm/branches/wendling/eh/test/Integer/a63.ll.out
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Integer/a63.ll.out?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/test/Integer/a63.ll.out (original)
+++ llvm/branches/wendling/eh/test/Integer/a63.ll.out (removed)
@@ -1,20 +0,0 @@
-; ModuleID = '<stdin>'
-
- at b = constant i63 0                               ; <i63*> [#uses=0]
- at c = constant i63 -2                              ; <i63*> [#uses=0]
- at d = constant i63 0                               ; <i63*> [#uses=0]
- at e = constant i63 -1                              ; <i63*> [#uses=0]
- at f = constant i63 1                               ; <i63*> [#uses=0]
- at g = constant i63 3                               ; <i63*> [#uses=0]
- at h = constant i63 undef                           ; <i63*> [#uses=0]
- at i = constant i63 -4611686018427387904            ; <i63*> [#uses=0]
- at j = constant i63 1                               ; <i63*> [#uses=0]
- at l = constant i63 -1                              ; <i63*> [#uses=0]
- at n = constant i63 -2                              ; <i63*> [#uses=0]
- at q = constant i63 0                               ; <i63*> [#uses=0]
- at u = constant i63 -1                              ; <i63*> [#uses=0]
- at r = constant i63 2                               ; <i63*> [#uses=0]
- at s = constant i63 1                               ; <i63*> [#uses=0]
- at t = constant i63 0                               ; <i63*> [#uses=0]
- at o = constant i63 0                               ; <i63*> [#uses=0]
- at p = constant i63 -1                              ; <i63*> [#uses=0]

Removed: llvm/branches/wendling/eh/test/Integer/a7.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Integer/a7.ll?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/test/Integer/a7.ll (original)
+++ llvm/branches/wendling/eh/test/Integer/a7.ll (removed)
@@ -1,31 +0,0 @@
-; RUN: llvm-as %s -o - | llvm-dis > %t.ll
-; RUN: diff %t.ll %s.out
-
-; test 7 bits
-;
- at b = constant i7 add(i7 127, i7 1)
- at q = constant i7 add(i7 -64, i7 -1)
- at c = constant i7 add(i7 127, i7 127)
- at d = constant i7 add(i7 120, i7 8)
- at e = constant i7 sub(i7 0 , i7 1)
- at f = constant i7 sub(i7 0 , i7 127)
- at g = constant i7 sub(i7 2 , i7 127)
- at r = constant i7 sub(i7 -3, i7 120)
- at s = constant i7 sub(i7 -3, i7 -8)
-
- at h = constant i7 shl(i7 1 , i7 7)
- at i = constant i7 shl(i7 1 , i7 6)
- at j = constant i7 lshr(i7 127 , i7 6)
- at l = constant i7 ashr(i7 127 , i7 6)
- at m2= constant i7 ashr(i7 -1  , i7 3)
-
- at n = constant i7 mul(i7 127, i7 2)
- at t = constant i7 mul(i7 -63, i7 -2)
- at u = constant i7 mul(i7 -32, i7 2)
- at v = constant i7 sdiv(i7 -1, i7 63)
- at w = constant i7 udiv(i7 -1, i7 63)
- at x = constant i7 srem(i7 1 , i7 126)
- at y = constant i7 urem(i7 127, i7 -1)
- at o = constant i7 trunc( i8 128  to i7 )
- at p = constant i7 trunc( i8 255  to i7 )
- 

Removed: llvm/branches/wendling/eh/test/Integer/a7.ll.out
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Integer/a7.ll.out?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/test/Integer/a7.ll.out (original)
+++ llvm/branches/wendling/eh/test/Integer/a7.ll.out (removed)
@@ -1,25 +0,0 @@
-; ModuleID = '<stdin>'
-
- at b = constant i7 0                                ; <i7*> [#uses=0]
- at q = constant i7 63                               ; <i7*> [#uses=0]
- at c = constant i7 -2                               ; <i7*> [#uses=0]
- at d = constant i7 0                                ; <i7*> [#uses=0]
- at e = constant i7 -1                               ; <i7*> [#uses=0]
- at f = constant i7 1                                ; <i7*> [#uses=0]
- at g = constant i7 3                                ; <i7*> [#uses=0]
- at r = constant i7 5                                ; <i7*> [#uses=0]
- at s = constant i7 5                                ; <i7*> [#uses=0]
- at h = constant i7 undef                            ; <i7*> [#uses=0]
- at i = constant i7 -64                              ; <i7*> [#uses=0]
- at j = constant i7 1                                ; <i7*> [#uses=0]
- at l = constant i7 -1                               ; <i7*> [#uses=0]
- at m2 = constant i7 -1                              ; <i7*> [#uses=0]
- at n = constant i7 -2                               ; <i7*> [#uses=0]
- at t = constant i7 -2                               ; <i7*> [#uses=0]
- at u = constant i7 -64                              ; <i7*> [#uses=0]
- at v = constant i7 0                                ; <i7*> [#uses=0]
- at w = constant i7 2                                ; <i7*> [#uses=0]
- at x = constant i7 1                                ; <i7*> [#uses=0]
- at y = constant i7 0                                ; <i7*> [#uses=0]
- at o = constant i7 0                                ; <i7*> [#uses=0]
- at p = constant i7 -1                               ; <i7*> [#uses=0]

Removed: llvm/branches/wendling/eh/test/Integer/a9.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Integer/a9.ll?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/test/Integer/a9.ll (original)
+++ llvm/branches/wendling/eh/test/Integer/a9.ll (removed)
@@ -1,25 +0,0 @@
-; RUN: llvm-as %s -o - | llvm-dis > %t.ll
-; RUN: diff %t.ll %s.out
-
-; test 9 bits
-;
- at b = constant i9 add(i9 511, i9 1)
- at c = constant i9 add(i9 511, i9 511)
- at d = constant i9 add(i9 504, i9 8)
- at e = constant i9 sub(i9 0 , i9 1)
- at f = constant i9 sub(i9 0 , i9 511)
- at g = constant i9 sub(i9 2 , i9 511)
-
- at h = constant i9 shl(i9 1 , i9 9)
- at i = constant i9 shl(i9 1 , i9 8)
- at j = constant i9 lshr(i9 511 , i9 8)
- at l = constant i9 ashr(i9 511 , i9 8)
-
- at n = constant i9 mul(i9 511, i9 2)
- at q = constant i9 sdiv(i9 511, i9 2)
- at r = constant i9 udiv(i9 511, i9 2)
- at s = constant i9 urem(i9 511, i9 -1)
- at t = constant i9 srem(i9 1, i9 510)
- at o = constant i9 trunc( i10 512  to i9 )
- at p = constant i9 trunc( i10 511  to i9 )
-

Removed: llvm/branches/wendling/eh/test/Integer/a9.ll.out
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Integer/a9.ll.out?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/test/Integer/a9.ll.out (original)
+++ llvm/branches/wendling/eh/test/Integer/a9.ll.out (removed)
@@ -1,19 +0,0 @@
-; ModuleID = '<stdin>'
-
- at b = constant i9 0                                ; <i9*> [#uses=0]
- at c = constant i9 -2                               ; <i9*> [#uses=0]
- at d = constant i9 0                                ; <i9*> [#uses=0]
- at e = constant i9 -1                               ; <i9*> [#uses=0]
- at f = constant i9 1                                ; <i9*> [#uses=0]
- at g = constant i9 3                                ; <i9*> [#uses=0]
- at h = constant i9 undef                            ; <i9*> [#uses=0]
- at i = constant i9 -256                             ; <i9*> [#uses=0]
- at j = constant i9 1                                ; <i9*> [#uses=0]
- at l = constant i9 -1                               ; <i9*> [#uses=0]
- at n = constant i9 -2                               ; <i9*> [#uses=0]
- at q = constant i9 0                                ; <i9*> [#uses=0]
- at r = constant i9 255                              ; <i9*> [#uses=0]
- at s = constant i9 0                                ; <i9*> [#uses=0]
- at t = constant i9 1                                ; <i9*> [#uses=0]
- at o = constant i9 0                                ; <i9*> [#uses=0]
- at p = constant i9 -1                               ; <i9*> [#uses=0]

Modified: llvm/branches/wendling/eh/test/LLVMC/AppendCmdHook.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/LLVMC/AppendCmdHook.td?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/LLVMC/AppendCmdHook.td (original)
+++ llvm/branches/wendling/eh/test/LLVMC/AppendCmdHook.td Tue Oct 26 19:48:03 2010
@@ -1,7 +1,7 @@
 // Check that hooks can be invoked from 'append_cmd'.
 // RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
 // RUN: FileCheck -input-file %t %s
-// RUN: %compile_cxx -fexceptions -x c++ %t
+// RUN: %compile_cxx %t
 // XFAIL: vg_leak
 
 include "llvm/CompilerDriver/Common.td"
@@ -26,4 +26,4 @@
          (switch_on "dummy2"), (append_cmd "-arg3 $CALL(MyHook)")))
 ]>;
 
-def DummyGraph : CompilationGraph<[SimpleEdge<"root", "dummy_tool">]>;
+def DummyGraph : CompilationGraph<[(edge "root", "dummy_tool")]>;

Modified: llvm/branches/wendling/eh/test/LLVMC/C++/dg.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/LLVMC/C%2B%2B/dg.exp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/LLVMC/C++/dg.exp (original)
+++ llvm/branches/wendling/eh/test/LLVMC/C++/dg.exp Tue Oct 26 19:48:03 2010
@@ -1,5 +1,5 @@
 load_lib llvm.exp
 
 if [ llvm_gcc_supports c++ ] then {
-  RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
+  RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{unk,ll,c,cpp}]]
 }

Modified: llvm/branches/wendling/eh/test/LLVMC/C/emit-llvm.c
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/LLVMC/C/emit-llvm.c?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/LLVMC/C/emit-llvm.c (original)
+++ llvm/branches/wendling/eh/test/LLVMC/C/emit-llvm.c Tue Oct 26 19:48:03 2010
@@ -1,4 +1,7 @@
+// Check that -emit-llvm [-S] works correctly.
+
 // RUN: llvmc -c -emit-llvm -o - %s | llvm-dis | grep "@f0()" | count 1
+// RUN: llvmc -c -emit-llvm -S -o - %s | grep "@f0()" | count 1
 // XFAIL: vg_leak
 
 int f0(void) {

Modified: llvm/branches/wendling/eh/test/LLVMC/EmptyCompilationGraph.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/LLVMC/EmptyCompilationGraph.td?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/LLVMC/EmptyCompilationGraph.td (original)
+++ llvm/branches/wendling/eh/test/LLVMC/EmptyCompilationGraph.td Tue Oct 26 19:48:03 2010
@@ -1,6 +1,6 @@
 // Check that the compilation graph can be empty.
 // RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
-// RUN: %compile_cxx -fexceptions -x c++ %t
+// RUN: %compile_cxx %t
 // XFAIL: vg_leak
 
 include "llvm/CompilerDriver/Common.td"

Modified: llvm/branches/wendling/eh/test/LLVMC/EnvParentheses.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/LLVMC/EnvParentheses.td?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/LLVMC/EnvParentheses.td (original)
+++ llvm/branches/wendling/eh/test/LLVMC/EnvParentheses.td Tue Oct 26 19:48:03 2010
@@ -2,7 +2,7 @@
 // http://llvm.org/bugs/show_bug.cgi?id=4157
 // RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
 // RUN: not grep {FOO")));} %t
-// RUN: %compile_cxx -fexceptions -x c++ %t
+// RUN: %compile_cxx %t
 // XFAIL: vg_leak
 
 include "llvm/CompilerDriver/Common.td"
@@ -13,6 +13,6 @@
 (out_language "dummy")
 ]>;
 
-def DummyGraph : CompilationGraph<[SimpleEdge<"root", "dummy_tool">]>;
+def DummyGraph : CompilationGraph<[(edge "root", "dummy_tool")]>;
 
 def Graph : CompilationGraph<[]>;

Removed: llvm/branches/wendling/eh/test/LLVMC/ExternOptions.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/LLVMC/ExternOptions.td?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/test/LLVMC/ExternOptions.td (original)
+++ llvm/branches/wendling/eh/test/LLVMC/ExternOptions.td (removed)
@@ -1,26 +0,0 @@
-// Check that extern options work.
-// The dummy tool and graph are required to silence warnings.
-// RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
-// RUN: FileCheck -input-file %t %s
-// RUN: %compile_cxx -fexceptions -x c++ %t
-// XFAIL: vg_leak
-
-include "llvm/CompilerDriver/Common.td"
-
-// CHECK: extern cl::opt<bool> AutoGeneratedSwitch_Wall
-
-def OptList : OptionList<[(switch_option "Wall", (extern)),
-                          (parameter_option "std", (extern)),
-                          (prefix_list_option "L", (extern))]>;
-
-def dummy_tool : Tool<[
-(command "dummy_cmd"),
-(in_language "dummy"),
-(out_language "dummy"),
-(actions (case
-         (switch_on "Wall"), (stop_compilation),
-         (not_empty "std"), (stop_compilation),
-         (not_empty "L"), (stop_compilation)))
-]>;
-
-def DummyGraph : CompilationGraph<[SimpleEdge<"root", "dummy_tool">]>;

Modified: llvm/branches/wendling/eh/test/LLVMC/ForwardAs.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/LLVMC/ForwardAs.td?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/LLVMC/ForwardAs.td (original)
+++ llvm/branches/wendling/eh/test/LLVMC/ForwardAs.td Tue Oct 26 19:48:03 2010
@@ -2,12 +2,12 @@
 // http://llvm.org/bugs/show_bug.cgi?id=4159
 // RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
 // RUN: FileCheck -input-file %t %s
-// RUN: %compile_cxx -fexceptions -x c++ %t
+// RUN: %compile_cxx %t
 // XFAIL: vg_leak
 
 include "llvm/CompilerDriver/Common.td"
 
-def OptList : OptionList<[(parameter_option "dummy", (extern))]>;
+def OptList : OptionList<[(parameter_option "dummy", (help "dummmy"))]>;
 
 def dummy_tool : Tool<[
 (command "dummy_cmd"),
@@ -18,4 +18,4 @@
          (not_empty "dummy"), (forward_as "dummy", "unique_name")))
 ]>;
 
-def DummyGraph : CompilationGraph<[SimpleEdge<"root", "dummy_tool">]>;
+def DummyGraph : CompilationGraph<[(edge "root", "dummy_tool")]>;

Modified: llvm/branches/wendling/eh/test/LLVMC/ForwardTransformedValue.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/LLVMC/ForwardTransformedValue.td?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/LLVMC/ForwardTransformedValue.td (original)
+++ llvm/branches/wendling/eh/test/LLVMC/ForwardTransformedValue.td Tue Oct 26 19:48:03 2010
@@ -2,13 +2,13 @@
 // The dummy tool and graph are required to silence warnings.
 // RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
 // RUN: FileCheck -input-file %t %s
-// RUN: %compile_cxx -fexceptions -x c++ %t
+// RUN: %compile_cxx %t
 // XFAIL: vg_leak
 
 include "llvm/CompilerDriver/Common.td"
 
-def OptList : OptionList<[(parameter_option "a", (extern)),
-                          (prefix_list_option "b", (extern))]>;
+def OptList : OptionList<[(parameter_option "a", (help "dummy")),
+                          (prefix_list_option "b", (help "dummy"))]>;
 
 // CHECK: std::string HookA
 // CHECK: std::string HookB
@@ -18,10 +18,10 @@
 (in_language "dummy"),
 (out_language "dummy"),
 (actions (case
-         // CHECK: HookA(AutoGeneratedParameter_a
+         // CHECK: HookA(autogenerated::Parameter_a
          (not_empty "a"), (forward_transformed_value "a", "HookA"),
-         // CHECK: HookB(AutoGeneratedList_b
+         // CHECK: HookB(autogenerated::List_b
          (not_empty "b"), (forward_transformed_value "b", "HookB")))
 ]>;
 
-def DummyGraph : CompilationGraph<[SimpleEdge<"root", "dummy_tool">]>;
+def DummyGraph : CompilationGraph<[(edge "root", "dummy_tool")]>;

Modified: llvm/branches/wendling/eh/test/LLVMC/ForwardValue.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/LLVMC/ForwardValue.td?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/LLVMC/ForwardValue.td (original)
+++ llvm/branches/wendling/eh/test/LLVMC/ForwardValue.td Tue Oct 26 19:48:03 2010
@@ -2,23 +2,23 @@
 // The dummy tool and graph are required to silence warnings.
 // RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
 // RUN: FileCheck -input-file %t %s
-// RUN: %compile_cxx -fexceptions -x c++ %t
+// RUN: %compile_cxx %t
 // XFAIL: vg_leak
 
 include "llvm/CompilerDriver/Common.td"
 
-def OptList : OptionList<[(parameter_option "a", (extern)),
-                          (prefix_list_option "b", (extern))]>;
+def OptList : OptionList<[(parameter_option "a", (help "dummy")),
+                          (prefix_list_option "b", (help "dummy"))]>;
 
 def dummy_tool : Tool<[
 (command "dummy_cmd"),
 (in_language "dummy"),
 (out_language "dummy"),
 (actions (case
-         // CHECK: , AutoGeneratedParameter_a));
+         // CHECK: , autogenerated::Parameter_a));
          (not_empty "a"), (forward_value "a"),
-         // CHECK: B = AutoGeneratedList_b.begin()
+         // CHECK: B = autogenerated::List_b.begin()
          (not_empty "b"), (forward_value "b")))
 ]>;
 
-def DummyGraph : CompilationGraph<[SimpleEdge<"root", "dummy_tool">]>;
+def DummyGraph : CompilationGraph<[(edge "root", "dummy_tool")]>;

Modified: llvm/branches/wendling/eh/test/LLVMC/HookWithArguments.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/LLVMC/HookWithArguments.td?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/LLVMC/HookWithArguments.td (original)
+++ llvm/branches/wendling/eh/test/LLVMC/HookWithArguments.td Tue Oct 26 19:48:03 2010
@@ -1,7 +1,7 @@
 // Check that hooks with arguments work.
 // RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
 // RUN: FileCheck -input-file %t %s
-// RUN: %compile_cxx -fexceptions -x c++ %t
+// RUN: %compile_cxx %t
 // XFAIL: vg_leak
 
 include "llvm/CompilerDriver/Common.td"
@@ -17,4 +17,4 @@
 (out_language "dummy")
 ]>;
 
-def DummyGraph : CompilationGraph<[SimpleEdge<"root", "dummy_tool">]>;
+def DummyGraph : CompilationGraph<[(edge "root", "dummy_tool")]>;

Modified: llvm/branches/wendling/eh/test/LLVMC/HookWithInFile.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/LLVMC/HookWithInFile.td?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/LLVMC/HookWithInFile.td (original)
+++ llvm/branches/wendling/eh/test/LLVMC/HookWithInFile.td Tue Oct 26 19:48:03 2010
@@ -1,7 +1,7 @@
 // Check that a hook can be given $INFILE as an argument.
 // RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
 // RUN: FileCheck -input-file %t %s
-// RUN: %compile_cxx -fexceptions -x c++ %t
+// RUN: %compile_cxx %t
 // XFAIL: vg_leak
 
 include "llvm/CompilerDriver/Common.td"
@@ -13,4 +13,4 @@
 (out_language "dummy")
 ]>;
 
-def DummyGraph : CompilationGraph<[SimpleEdge<"root", "dummy_tool">]>;
+def DummyGraph : CompilationGraph<[(edge "root", "dummy_tool")]>;

Modified: llvm/branches/wendling/eh/test/LLVMC/Init.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/LLVMC/Init.td?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/LLVMC/Init.td (original)
+++ llvm/branches/wendling/eh/test/LLVMC/Init.td Tue Oct 26 19:48:03 2010
@@ -1,7 +1,7 @@
 // Check that (init true/false) and (init "str") work.
 // RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
 // RUN: FileCheck -input-file %t %s
-// RUN: %compile_cxx -fexceptions -x c++ %t
+// RUN: %compile_cxx %t
 // XFAIL: vg_leak
 
 include "llvm/CompilerDriver/Common.td"
@@ -22,4 +22,4 @@
          (not_empty "dummy2"), (forward "dummy2")))
 ]>;
 
-def DummyGraph : CompilationGraph<[SimpleEdge<"root", "dummy_tool">]>;
+def DummyGraph : CompilationGraph<[(edge "root", "dummy_tool")]>;

Modified: llvm/branches/wendling/eh/test/LLVMC/MultiValuedOption.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/LLVMC/MultiValuedOption.td?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/LLVMC/MultiValuedOption.td (original)
+++ llvm/branches/wendling/eh/test/LLVMC/MultiValuedOption.td Tue Oct 26 19:48:03 2010
@@ -2,7 +2,7 @@
 // The dummy tool and graph are required to silence warnings.
 // RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
 // RUN: FileCheck -input-file %t %s
-// RUN: %compile_cxx -fexceptions -x c++ %t
+// RUN: %compile_cxx %t
 // XFAIL: vg_leak
 
 include "llvm/CompilerDriver/Common.td"
@@ -10,7 +10,7 @@
 def OptList : OptionList<[
     // CHECK: cl::multi_val(2)
     (prefix_list_option "foo", (multi_val 2)),
-    (parameter_list_option "baz", (multi_val 2), (extern))]>;
+    (parameter_list_option "baz", (multi_val 2))]>;
 
 def dummy_tool : Tool<[
 (command "dummy_cmd"),
@@ -21,4 +21,4 @@
          (not_empty "baz"), (forward "baz")))
 ]>;
 
-def DummyGraph : CompilationGraph<[SimpleEdge<"root", "dummy_tool">]>;
+def DummyGraph : CompilationGraph<[(edge "root", "dummy_tool")]>;

Modified: llvm/branches/wendling/eh/test/LLVMC/MultipleCompilationGraphs.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/LLVMC/MultipleCompilationGraphs.td?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/LLVMC/MultipleCompilationGraphs.td (original)
+++ llvm/branches/wendling/eh/test/LLVMC/MultipleCompilationGraphs.td Tue Oct 26 19:48:03 2010
@@ -1,6 +1,6 @@
 // Check that multiple compilation graphs are allowed.
 // RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
-// RUN: %compile_cxx -fexceptions -x c++ %t
+// RUN: %compile_cxx %t
 // XFAIL: vg_leak
 
 include "llvm/CompilerDriver/Common.td"

Removed: llvm/branches/wendling/eh/test/LLVMC/MultiplePluginPriorities.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/LLVMC/MultiplePluginPriorities.td?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/test/LLVMC/MultiplePluginPriorities.td (original)
+++ llvm/branches/wendling/eh/test/LLVMC/MultiplePluginPriorities.td (removed)
@@ -1,17 +0,0 @@
-// Check that multiple plugin priorities are not allowed.
-// RUN: ignore tblgen -I %p/../../include --gen-llvmc %s |& grep "More than one 'PluginPriority' instance found"
-
-// Disable for Darwin PPC: <rdar://problem/7598390>
-// XFAIL: powerpc-apple-darwin
-
-// Generally XFAIL'ed for now, this is (sometimes?) failing on x86_64-apple-darwin10.
-// RUN: false
-// XFAIL: *
-
-include "llvm/CompilerDriver/Common.td"
-
-def Graph : CompilationGraph<[]>;
-
-def Priority1 : PluginPriority<1>;
-
-def Priority2 : PluginPriority<2>;

Modified: llvm/branches/wendling/eh/test/LLVMC/NoActions.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/LLVMC/NoActions.td?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/LLVMC/NoActions.td (original)
+++ llvm/branches/wendling/eh/test/LLVMC/NoActions.td Tue Oct 26 19:48:03 2010
@@ -1,7 +1,7 @@
 // Check that tools without associated actions are accepted.
 // RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
 // RUN: FileCheck -input-file %t %s
-// RUN: %compile_cxx -fexceptions -x c++ %t
+// RUN: %compile_cxx %t
 // XFAIL: vg_leak
 
 include "llvm/CompilerDriver/Common.td"
@@ -13,4 +13,4 @@
 (out_language "dummy")
 ]>;
 
-def DummyGraph : CompilationGraph<[SimpleEdge<"root", "dummy_tool">]>;
+def DummyGraph : CompilationGraph<[(edge "root", "dummy_tool")]>;

Modified: llvm/branches/wendling/eh/test/LLVMC/NoCompilationGraph.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/LLVMC/NoCompilationGraph.td?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/LLVMC/NoCompilationGraph.td (original)
+++ llvm/branches/wendling/eh/test/LLVMC/NoCompilationGraph.td Tue Oct 26 19:48:03 2010
@@ -1,6 +1,6 @@
 // Check that the compilation graph is not required.
 // RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
-// RUN: %compile_cxx -fexceptions -x c++ %t
+// RUN: %compile_cxx %t
 // XFAIL: vg_leak
 
 include "llvm/CompilerDriver/Common.td"

Modified: llvm/branches/wendling/eh/test/LLVMC/OneOrMore.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/LLVMC/OneOrMore.td?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/LLVMC/OneOrMore.td (original)
+++ llvm/branches/wendling/eh/test/LLVMC/OneOrMore.td Tue Oct 26 19:48:03 2010
@@ -2,7 +2,7 @@
 // The dummy tool and graph are required to silence warnings.
 // RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
 // RUN: FileCheck -input-file %t %s
-// RUN: %compile_cxx -fexceptions -x c++ %t
+// RUN: %compile_cxx %t
 // XFAIL: vg_leak
 
 include "llvm/CompilerDriver/Common.td"
@@ -22,4 +22,4 @@
          (not_empty "baz"), (forward "baz")))
 ]>;
 
-def DummyGraph : CompilationGraph<[SimpleEdge<"root", "dummy_tool">]>;
+def DummyGraph : CompilationGraph<[(edge "root", "dummy_tool")]>;

Modified: llvm/branches/wendling/eh/test/LLVMC/OptionPreprocessor.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/LLVMC/OptionPreprocessor.td?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/LLVMC/OptionPreprocessor.td (original)
+++ llvm/branches/wendling/eh/test/LLVMC/OptionPreprocessor.td Tue Oct 26 19:48:03 2010
@@ -1,7 +1,7 @@
 // Test for the OptionPreprocessor and related functionality.
 // RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
 // RUN: FileCheck -input-file %t %s
-// RUN: %compile_cxx -fexceptions -x c++ %t
+// RUN: %compile_cxx %t
 // XFAIL: vg_leak
 
 include "llvm/CompilerDriver/Common.td"
@@ -22,7 +22,7 @@
       // CHECK: foo = false;
       // CHECK: foo_p = "";
       // CHECK: foo_l.clear();
-      (and (switch_on "foo"), (any_switch_on ["bar", "baz"])),
+      (and (switch_on "foo"), (any_switch_on "bar", "baz")),
            [(warning "W1"), (unset_option "foo"),
                             (unset_option "foo_p"), (unset_option "foo_l")],
       // CHECK: W2
@@ -34,7 +34,7 @@
       // CHECK: foo_l.push_back("qwert");
       // CHECK: foo_l.push_back("yuiop");
       // CHECK: foo_l.push_back("asdf");
-      (and (switch_on ["foo", "bar"]), (any_empty ["foo_p", "bar_p"])),
+      (and (switch_on "foo", "bar"), (any_empty "foo_p", "bar_p")),
            [(warning "W2"), (set_option "foo"),
                             (set_option "bar", true),
                             (set_option "baz", false),
@@ -44,8 +44,8 @@
       // CHECK: foo = true;
       // CHECK: bar = true;
       // CHECK: baz = true;
-      (and (empty ["foo_p", "bar_p"]), (any_not_empty ["baz_p"])),
-           [(warning "W3"), (set_option ["foo", "bar", "baz"])])
+      (and (empty "foo_p", "bar_p"), (any_not_empty "baz_p")),
+           [(warning "W3"), (set_option "foo", "bar", "baz")])
 >;
 
 // Shut up warnings...
@@ -63,5 +63,5 @@
                 (not_empty "foo_l"), (error)))
 ]>;
 
-def Graph : CompilationGraph<[Edge<"root", "dummy">]>;
+def Graph : CompilationGraph<[(edge "root", "dummy")]>;
 

Modified: llvm/branches/wendling/eh/test/LLVMC/OutputSuffixHook.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/LLVMC/OutputSuffixHook.td?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/LLVMC/OutputSuffixHook.td (original)
+++ llvm/branches/wendling/eh/test/LLVMC/OutputSuffixHook.td Tue Oct 26 19:48:03 2010
@@ -1,8 +1,8 @@
 // Check that hooks can be invoked from 'output_suffix'.
 // RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
 // RUN: FileCheck -input-file %t %s
-// RUN: %compile_cxx -fexceptions -x c++ %t
-// XFAIL: *
+// RUN: %compile_cxx %t
+// XFAIL: vg_leak
 
 include "llvm/CompilerDriver/Common.td"
 
@@ -13,7 +13,7 @@
 ]>;
 
 def dummy_tool : Tool<[
-(cmd_line "dummy_cmd $INFILE"),
+(command "dummy_cmd"),
 (in_language "dummy_lang"),
 (out_language "dummy_lang"),
 (actions (case
@@ -21,4 +21,4 @@
          (switch_on "dummy1"), (output_suffix "$CALL(MyHook)")))
 ]>;
 
-def DummyGraph : CompilationGraph<[SimpleEdge<"root", "dummy_tool">]>;
+def DummyGraph : CompilationGraph<[(edge "root", "dummy_tool")]>;

Modified: llvm/branches/wendling/eh/test/LLVMC/TestWarnings.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/LLVMC/TestWarnings.td?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/LLVMC/TestWarnings.td (original)
+++ llvm/branches/wendling/eh/test/LLVMC/TestWarnings.td Tue Oct 26 19:48:03 2010
@@ -5,4 +5,4 @@
 
 include "llvm/CompilerDriver/Common.td"
 
-def OptList : OptionList<[(switch_option "Wall", (extern))]>;
+def OptList : OptionList<[(switch_option "Wall", (help "dummy"))]>;

Propchange: llvm/branches/wendling/eh/test/MC/ARM/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Oct 26 19:48:03 2010
@@ -0,0 +1 @@
+Output

Modified: llvm/branches/wendling/eh/test/MC/AsmParser/dg.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/MC/AsmParser/dg.exp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/MC/AsmParser/dg.exp (original)
+++ llvm/branches/wendling/eh/test/MC/AsmParser/dg.exp Tue Oct 26 19:48:03 2010
@@ -1,4 +1,5 @@
 load_lib llvm.exp
 
-RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{s}]]
-
+if { [llvm_supports_target X86] } {
+  RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{s}]]
+}

Modified: llvm/branches/wendling/eh/test/MC/AsmParser/directive_abort.s
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/MC/AsmParser/directive_abort.s?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/MC/AsmParser/directive_abort.s (original)
+++ llvm/branches/wendling/eh/test/MC/AsmParser/directive_abort.s Tue Oct 26 19:48:03 2010
@@ -1,4 +1,4 @@
-# RUN: llvm-mc -triple i386-unknown-unknown %s 2> %t
+# RUN: not llvm-mc -triple i386-unknown-unknown %s 2> %t
 # RUN: FileCheck -input-file %t %s
 
 # CHECK: error: .abort 'please stop assembing'

Modified: llvm/branches/wendling/eh/test/MC/AsmParser/directive_values.s
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/MC/AsmParser/directive_values.s?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/MC/AsmParser/directive_values.s (original)
+++ llvm/branches/wendling/eh/test/MC/AsmParser/directive_values.s Tue Oct 26 19:48:03 2010
@@ -19,3 +19,20 @@
 # CHECK: .quad 9
 TEST3:  
         .quad 9
+
+
+# rdar://7997827
+TEST4:
+        .quad 0b0100
+        .quad 4294967295
+        .quad 4294967295+1
+        .quad 4294967295LL+1
+        .quad 0b10LL + 07ULL + 0x42AULL
+# CHECK: TEST4
+# CHECK: 	.quad	4
+# CHECK: .quad	4294967295
+# CHECK: 	.quad	4294967296
+# CHECK: 	.quad	4294967296
+# CHECK: 	.quad	1075
+
+

Modified: llvm/branches/wendling/eh/test/MC/AsmParser/exprs.s
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/MC/AsmParser/exprs.s?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/MC/AsmParser/exprs.s (original)
+++ llvm/branches/wendling/eh/test/MC/AsmParser/exprs.s Tue Oct 26 19:48:03 2010
@@ -1,47 +1,52 @@
-// FIXME: For now this test just checks that llvm-mc -triple i386-unknown-unknown works. Once we have .macro,
-// .if, and .abort we can write a better test (without resorting to miles of
-// greps).
-        
 // RUN: llvm-mc -triple i386-unknown-unknown %s > %t
 
+.macro check_expr
+  .if ($0) != ($1)
+        .abort Unexpected $0 != $1.
+  .endif
+.endmacro
+        
         .text
 g:
 h:
 j:
 k:      
         .data
-        .byte !1 + 2
-        .byte !0
-        .byte ~0
-        .byte -1
-        .byte +1
-        .byte 1 + 2
-        .byte 1 & 3
-        .byte 4 / 2
-        .byte 4 / -2
-        .byte 1 == 1
-        .byte 1 == 0
-        .byte 1 > 0
-        .byte 1 >= 1
-        .byte 1 < 2
-        .byte 1 <= 1
-        .byte 4 % 3
-        .byte 2 * 2
-        .byte 2 != 2
-        .byte 2 <> 2
-        .byte 1 | 2
-        .byte 1 << 1
-        .byte 2 >> 1
-        .byte ~0 >> 1
-        .byte 3 - 2
-        .byte 1 ^ 3
-        .byte 1 && 2
-        .byte 3 && 0
-        .byte 1 || 2
-        .byte 0 || 0
-
+        check_expr !1 + 2, 2
+        check_expr !0, 1
+        check_expr ~0, -1
+        check_expr -1, ~0
+        check_expr +1, 1
+        check_expr 1 + 2, 3
+        check_expr 1 & 3, 1
+        check_expr 4 / 2, 2
+        check_expr 4 / -2, -2
+        check_expr 1 == 1, 1
+        check_expr 1 == 0, 0
+        check_expr 1 > 0, 1
+        check_expr 1 >= 1, 1
+        check_expr 1 < 2, 1
+        check_expr 1 <= 1, 1
+        check_expr 4 % 3, 1
+        check_expr 2 * 2, 4
+        check_expr 2 != 2, 0
+        check_expr 2 <> 2, 0
+        check_expr 1 | 2, 3
+        check_expr 1 << 1, 2
+        check_expr 2 >> 1, 1
+        check_expr (~0 >> 1), -1
+        check_expr 3 - 2, 1
+        check_expr 1 ^ 3, 2
+        check_expr 1 && 2, 1
+        check_expr 3 && 0, 0
+        check_expr 0 && 1, 0
+        check_expr 1 || 2, 1
+        check_expr 0 || 1, 1
+        check_expr 0 || 0, 0
+        check_expr 1 + 2 < 3 + 4, 1
+        
         .set c, 10
-        .byte c + 1
+        check_expr c + 1, 11
 
         d = e + 10
         .long d

Modified: llvm/branches/wendling/eh/test/MC/AsmParser/macros.s
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/MC/AsmParser/macros.s?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/MC/AsmParser/macros.s (original)
+++ llvm/branches/wendling/eh/test/MC/AsmParser/macros.s Tue Oct 26 19:48:03 2010
@@ -30,3 +30,10 @@
 
 // CHECK: .globl	"1 23  $3 2"
 test3 1,2 3
+
+.macro test4
+.globl "$0 -- $1"
+.endmacro
+
+// CHECK: .globl	"ab)(,) -- (cd)"
+test4 a b)(,),(cd)

Propchange: llvm/branches/wendling/eh/test/MC/COFF/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Oct 26 19:48:03 2010
@@ -0,0 +1 @@
+Output

Removed: llvm/branches/wendling/eh/test/MC/COFF/basic-coff.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/MC/COFF/basic-coff.ll?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/test/MC/COFF/basic-coff.ll (original)
+++ llvm/branches/wendling/eh/test/MC/COFF/basic-coff.ll (removed)
@@ -1,136 +0,0 @@
-; RUN: llc -filetype=obj %s -o %t
-; RUN: coff-dump.py %abs_tmp | FileCheck %s
-
-; ModuleID = '-'
-target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f80:128:128-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32"
-target triple = "i686-pc-win32"
-
- at .str = private constant [12 x i8] c"Hello World\00" ; <[12 x i8]*> [#uses=1]
-
-define i32 @main() nounwind {
-entry:
-  %call = tail call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([12 x i8]* @.str, i32 0, i32 0)) nounwind ; <i32> [#uses=0]
-  ret i32 0
-}
-
-declare i32 @printf(i8* nocapture, ...) nounwind
-
-; CHECK: {
-; CHECK:   MachineType              = IMAGE_FILE_MACHINE_I386 (0x14C)
-; CHECK:   NumberOfSections         = 2
-; CHECK:   TimeDateStamp            = {{[0-9]+}}
-; CHECK:   PointerToSymbolTable     = 0x99
-; CHECK:   NumberOfSymbols          = 7
-; CHECK:   SizeOfOptionalHeader     = 0
-; CHECK:   Characteristics          = 0x0
-; CHECK:   Sections                 = [
-; CHECK:     0 = {
-; CHECK:       Name                     = .text
-; CHECK:       VirtualSize              = 0
-; CHECK:       VirtualAddress           = 0
-; CHECK:       SizeOfRawData            = 21
-; CHECK:       PointerToRawData         = 0x64
-; CHECK:       PointerToRelocations     = 0x79
-; CHECK:       PointerToLineNumbers     = 0x0
-; CHECK:       NumberOfRelocations      = 2
-; CHECK:       NumberOfLineNumbers      = 0
-; CHECK:       Charateristics           = 0x60500020
-; CHECK:         IMAGE_SCN_CNT_CODE
-; CHECK:         IMAGE_SCN_ALIGN_16BYTES
-; CHECK:         IMAGE_SCN_MEM_EXECUTE
-; CHECK:         IMAGE_SCN_MEM_READ
-; CHECK:       SectionData              =
-; CHECK:         83 EC 04 C7 04 24 00 00 - 00 00 E8 00 00 00 00 31 |.....$.........1|
-; CHECK:         C0 83 C4 04 C3                                    |.....|
-; CHECK:       Relocations              = [
-; CHECK:         0 = {
-; CHECK:           VirtualAddress           = 0x6
-; CHECK:           SymbolTableIndex         = 5
-; CHECK:           Type                     = IMAGE_REL_I386_DIR32 (6)
-; CHECK:           SymbolName               = _main
-; CHECK:         }
-; CHECK:         1 = {
-; CHECK:           VirtualAddress           = 0xB
-; CHECK:           SymbolTableIndex         = 6
-; CHECK:           Type                     = IMAGE_REL_I386_REL32 (20)
-; CHECK:           SymbolName               = L_.str
-; CHECK:         }
-; CHECK:       ]
-; CHECK:     }
-; CHECK:     1 = {
-; CHECK:       Name                     = .data
-; CHECK:       VirtualSize              = 0
-; CHECK:       VirtualAddress           = 0
-; CHECK:       SizeOfRawData            = 12
-; CHECK:       PointerToRawData         = 0x8D
-; CHECK:       PointerToRelocations     = 0x0
-; CHECK:       PointerToLineNumbers     = 0x0
-; CHECK:       NumberOfRelocations      = 0
-; CHECK:       NumberOfLineNumbers      = 0
-; CHECK:       Charateristics           = 0xC0100040
-; CHECK:         IMAGE_SCN_CNT_INITIALIZED_DATA
-; CHECK:         IMAGE_SCN_ALIGN_1BYTES
-; CHECK:         IMAGE_SCN_MEM_READ
-; CHECK:         IMAGE_SCN_MEM_WRITE
-; CHECK:       SectionData              =
-; CHECK:         48 65 6C 6C 6F 20 57 6F - 72 6C 64 00             |Hello World.|
-; CHECK:       Relocations              = None
-; CHECK:     }
-; CHECK:   ]
-; CHECK:   Symbols                  = [
-; CHECK:     0 = {
-; CHECK:       Name                     = .text
-; CHECK:       Value                    = 0
-; CHECK:       SectionNumber            = 1
-; CHECK:       SimpleType               = IMAGE_SYM_TYPE_NULL (0)
-; CHECK:       ComplexType              = IMAGE_SYM_DTYPE_NULL (0)
-; CHECK:       StorageClass             = IMAGE_SYM_CLASS_STATIC (3)
-; CHECK:       NumberOfAuxSymbols       = 1
-; CHECK:       AuxillaryData            =
-; CHECK:         15 00 00 00 02 00 00 00 - 00 00 00 00 01 00 00 00 |................|
-; CHECK:         00 00                                             |..|
-; CHECK:     }
-; CHECK:     1 = {
-; CHECK:       Name                     = .data
-; CHECK:       Value                    = 0
-; CHECK:       SectionNumber            = 2
-; CHECK:       SimpleType               = IMAGE_SYM_TYPE_NULL (0)
-; CHECK:       ComplexType              = IMAGE_SYM_DTYPE_NULL (0)
-; CHECK:       StorageClass             = IMAGE_SYM_CLASS_STATIC (3)
-; CHECK:       NumberOfAuxSymbols       = 1
-; CHECK:       AuxillaryData            =
-; CHECK:         0C 00 00 00 00 00 00 00 - 00 00 00 00 02 00 00 00 |................|
-; CHECK:         00 00                                             |..|
-; CHECK:     }
-; CHECK:     2 = {
-; CHECK:       Name                     = _main
-; CHECK:       Value                    = 0
-; CHECK:       SectionNumber            = 1
-; CHECK:       SimpleType               = unknown (32)
-; CHECK:       ComplexType              = IMAGE_SYM_DTYPE_NULL (0)
-; CHECK:       StorageClass             = IMAGE_SYM_CLASS_EXTERNAL (2)
-; CHECK:       NumberOfAuxSymbols       = 0
-; CHECK:       AuxillaryData            =
-; CHECK:     }
-; CHECK:     3 = {
-; CHECK:       Name                     = L_.str
-; CHECK:       Value                    = 0
-; CHECK:       SectionNumber            = 2
-; CHECK:       SimpleType               = IMAGE_SYM_TYPE_NULL (0)
-; CHECK:       ComplexType              = IMAGE_SYM_DTYPE_NULL (0)
-; CHECK:       StorageClass             = IMAGE_SYM_CLASS_STATIC (3)
-; CHECK:       NumberOfAuxSymbols       = 0
-; CHECK:       AuxillaryData            =
-; CHECK:     }
-; CHECK:     4 = {
-; CHECK:       Name                     = _printf
-; CHECK:       Value                    = 0
-; CHECK:       SectionNumber            = 0
-; CHECK:       SimpleType               = IMAGE_SYM_TYPE_NULL (0)
-; CHECK:       ComplexType              = IMAGE_SYM_DTYPE_NULL (0)
-; CHECK:       StorageClass             = IMAGE_SYM_CLASS_EXTERNAL (2)
-; CHECK:       NumberOfAuxSymbols       = 0
-; CHECK:       AuxillaryData            =
-; CHECK:     }
-; CHECK:   ]
-; CHECK: }

Modified: llvm/branches/wendling/eh/test/MC/COFF/dg.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/MC/COFF/dg.exp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/MC/COFF/dg.exp (original)
+++ llvm/branches/wendling/eh/test/MC/COFF/dg.exp Tue Oct 26 19:48:03 2010
@@ -1,5 +1,5 @@
 load_lib llvm.exp
 
 if { [llvm_supports_target X86] } {
-  RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll}]]
+  RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,s}]]
 }

Modified: llvm/branches/wendling/eh/test/MC/Disassembler/arm-tests.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/MC/Disassembler/arm-tests.txt?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/MC/Disassembler/arm-tests.txt (original)
+++ llvm/branches/wendling/eh/test/MC/Disassembler/arm-tests.txt Tue Oct 26 19:48:03 2010
@@ -12,9 +12,21 @@
 # CHECK:	cmn	r0, #1
 0x01 0x00 0x70 0xe3
 
+# CHECK:	dmb
+0x5f 0xf0 0x7f 0xf5
+
 # CHECK:	dmb	nshst
 0x56 0xf0 0x7f 0xf5
 
+# CHECK:	dsb
+0x4f 0xf0 0x7f 0xf5
+
+# CHECK:	dsb	st
+0x4e 0xf0 0x7f 0xf5
+
+# CHECK:	isb
+0x6f 0xf0 0x7f 0xf5
+
 # CHECK:	ldclvc	p5, cr15, [r8], #-0
 0x00 0xf5 0x78 0x7c
 
@@ -39,12 +51,20 @@
 # CHECK:	movt	r8, #65535
 0xff 0x8f 0x4f 0xe3
 
-# CHECK:	mvnpls	r7, #245, 2
+# CHECK:	mvnspl	r7, #245, 2
 0xf5 0x71 0xf0 0x53
 
+# CHECK-NOT:	orr	r7, r8, r7, rrx #0
+# CHECK:	orr	r7, r8, r7, rrx
+0x67 0x70 0x88 0xe1
+
 # CHECK:	pkhbt	r8, r9, r10, lsl #4
 0x1a 0x82 0x89 0xe6
 
+# CHECK-NOT:	pkhbtls	pc, r11, r11, lsl #0
+# CHECK:	pkhbtls	pc, r11, r11
+0x1b 0xf0 0x8b 0x96
+
 # CHECK:	pop	{r0, r2, r4, r6, r8, r10}
 0x55 0x05 0xbd 0xe8
 
@@ -57,6 +77,14 @@
 # CHECK:	rfedb	r0!
 0x00 0x0a 0x30 0xf9
 
+# CHECK-NOT:	rsbeq	r0, r2, r0, lsl #0
+# CHECK:	rsbeq	r0, r2, r0
+0x00 0x00 0x62 0x00
+
+# CHECK-NOT:	rscseq	r0, r0, r1, lsl #0
+# CHECK:	rscseq	r0, r0, r1
+0x01 0x00 0xf0 0x00
+
 # CHECK:	sbcs	r0, pc, #1
 0x01 0x00 0xdf 0xe2
 
@@ -66,6 +94,10 @@
 # CHECK:	ssat	r8, #1, r10, lsl #8
 0x1a 0x84 0xa0 0xe6
 
+# CHECK-NOT:	ssatmi	r0, #17, r12, lsl #0
+# CHECK:	ssatmi	r0, #17, r12
+0x1c 0x00 0xb0 0x46
+
 # CHECK:	stmdb	r10!, {r4, r5, r6, r7, lr}
 0xf0 0x40 0x2a 0xe9
 
@@ -75,3 +107,11 @@
 # CHECK:	ubfx	r0, r0, #16, #1
 0x50 0x08 0xe0 0xe7
 
+# CHECK:	usat	r8, #0, r10, asr #32
+0x5a 0x80 0xe0 0xe6
+
+# CHECK:        setend be
+0x00 0x02 0x01 0xf1
+
+# CHECK:        setend le
+0x00 0x00 0x01 0xf1

Modified: llvm/branches/wendling/eh/test/MC/Disassembler/neon-tests.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/MC/Disassembler/neon-tests.txt?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/MC/Disassembler/neon-tests.txt (original)
+++ llvm/branches/wendling/eh/test/MC/Disassembler/neon-tests.txt Tue Oct 26 19:48:03 2010
@@ -9,10 +9,12 @@
 # CHECK:	vdup.32	q3, d1[0]
 0x41 0x6c 0xb4 0xf3
 
-# VLD1q8_UPD (with ${dst:dregpair} operand)
 # CHECK:	vld1.8	{d17, d18}, [r6], r5
 0x05 0x1a 0x66 0xf4
 
+# CHECK:        vld1.8  {d17, d18, d19}, [r6], r5
+0x05 0x16 0x66 0xf4
+
 # CHECK:	vld4.8	{d0, d1, d2, d3}, [r2], r7
 0x07 0x00 0x22 0xf4
 
@@ -49,3 +51,11 @@
 # CHECK:	vtbx.8	d18, {d4, d5, d6}, d7
 0x47 0x2a 0xf4 0xf3
 
+# CHECK: vmov.f32 s0, #5.000000e-01
+0x00 0x0a 0xb6 0xee
+
+# CHECK: vmov.f32 s0, #1.328125e-01
+0x01 0x0a 0xb4 0xee
+
+# CHECK: vmov.f64 d0, #5.000000e-01
+0x00 0x0b 0xb6 0xee

Modified: llvm/branches/wendling/eh/test/MC/Disassembler/simple-tests.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/MC/Disassembler/simple-tests.txt?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/MC/Disassembler/simple-tests.txt (original)
+++ llvm/branches/wendling/eh/test/MC/Disassembler/simple-tests.txt Tue Oct 26 19:48:03 2010
@@ -59,4 +59,10 @@
 0x0f 0x20 0xc1
 
 # CHECK: leal	4(%rsp), %ecx
-0x8d 0x4c 0x24 0x04 
\ No newline at end of file
+0x8d 0x4c 0x24 0x04 
+
+# CHECK: enter	$1, $2
+0xc8 0x01 0x00 0x02
+
+# CHECK: movw	$47416, -66(%rbp)
+0x66 0xc7 0x45 0xbe 0x38 0xb9

Modified: llvm/branches/wendling/eh/test/MC/Disassembler/thumb-tests.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/MC/Disassembler/thumb-tests.txt?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/MC/Disassembler/thumb-tests.txt (original)
+++ llvm/branches/wendling/eh/test/MC/Disassembler/thumb-tests.txt Tue Oct 26 19:48:03 2010
@@ -42,6 +42,10 @@
 # CHECK:	pkhtb	r2, r4, r6, asr #16
 0xc4 0xea 0x26 0x42
 
+# CHECK-NOT:	pkhbt	r2, r4, r6, lsl #0
+# CHECK:	pkhbt	r2, r4, r6
+0xc4 0xea 0x06 0x02
+
 # CHECK:	pop	{r2, r4, r6, r8, r10, r12}
 0xbd 0xe8 0x54 0x15
 
@@ -51,6 +55,14 @@
 # CHECK:	rsbs	r0, r0, #0
 0x40 0x42
 
+# CHECK-NOT:	rsb	r0, r2, r0, lsl #0
+# CHECK:	rsb	r0, r2, r0
+0xc2 0xeb 0x00 0x00
+
+# CHECK-NOT:	ssat	r0, #17, r12, lsl #0
+# CHECK:	ssat	r0, #17, r12
+0x0c 0xf3 0x10 0x00
+
 # CHECK:	strd	r0, [r7, #64]
 0xc7 0xe9 0x10 0x01
 

Modified: llvm/branches/wendling/eh/test/MC/MachO/absolutize.s
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/MC/MachO/absolutize.s?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/MC/MachO/absolutize.s (original)
+++ llvm/branches/wendling/eh/test/MC/MachO/absolutize.s Tue Oct 26 19:48:03 2010
@@ -103,7 +103,7 @@
 // CHECK:     (('word-0', 0xa1000000),
 // CHECK:      ('word-1', 0x2)),
 // CHECK:   ])
-// CHECK:   ('_section_data', '1\xc01\xc01\xc01\xc0\xb8\xfe\xff\xff\xff\xb8\xfe\xff\xff\xff\xb8\x02\x00\x00\x00\xb8\x02\x00\x00\x00\xb8\x02\x00\x00\x00\xb8\x02\x00\x00\x00\xb8\xfe\xff\xff\xff')
+// CHECK:   ('_section_data', '31c031c0 31c031c0 b8feffff ffb8feff ffffb802 000000b8 02000000 b8020000 00b80200 0000b8fe ffffff')
 // CHECK:     # Section 1
 // CHECK:    (('section_name', '__data\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
 // CHECK:     ('segment_name', '__DATA\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
@@ -140,7 +140,7 @@
 // CHECK:     (('word-0', 0xa1000000),
 // CHECK:      ('word-1', 0x2f)),
 // CHECK:   ])
-// CHECK:   ('_section_data', "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xfc\xff\xff\xff\xfc\xff\xff\xff\x04\x00\x00\x00\x04\x00\x00\x00\x04\x00\x00\x00\x04\x00\x00\x00'\x00\x00\x00")
+// CHECK:   ('_section_data', '00000000 00000000 00000000 00000000 fcffffff fcffffff 04000000 04000000 04000000 04000000 27000000')
 // CHECK:   ])
 // CHECK:  ),
 // CHECK:   # Load Command 1

Modified: llvm/branches/wendling/eh/test/MC/MachO/darwin-x86_64-reloc-offsets.s
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/MC/MachO/darwin-x86_64-reloc-offsets.s?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/MC/MachO/darwin-x86_64-reloc-offsets.s (original)
+++ llvm/branches/wendling/eh/test/MC/MachO/darwin-x86_64-reloc-offsets.s Tue Oct 26 19:48:03 2010
@@ -277,7 +277,7 @@
 // CHECK:     (('word-0', 0x2),
 // CHECK:      ('word-1', 0x6d000000)),
 // CHECK:   ])
-// CHECK:   ('_section_data', '\xc6\x05\xff\xff\xff\xff\x12\xc6\x05\x00\x00\x00\x00\x12\xc7\x05\xfc\xff\xff\xffxV4\x12\xc7\x05\xfd\xff\xff\xffxV4\x12\xc7\x05\xfe\xff\xff\xffxV4\x12\xc7\x05\xff\xff\xff\xffxV4\x12\xc7\x05\x00\x00\x00\x00xV4\x12\x88\x05\x00\x00\x00\x00\x88\x05\x01\x00\x00\x00\x89\x05\x00\x00\x00\x00\x89\x05\x01\x00\x00\x00\x89\x05\x02\x00\x00\x00\x89\x05\x03\x00\x00\x00\x89\x05\x04\x00\x00\x00\xc6\x05\xdd\x00\x00\x00\x12\xc6\x05\xd7\x00\x00\x00\x12\xc7\x05\xcc\x00\x00\x00xV4\x12\xc7\x05\xc3\x00\x00\x00xV4\x12\xc7\x05\xba\x00\x00\x00xV4\x12\xc7\x05\xb1\x00\x00\x00xV4\x12\xc7\x05\xa8\x00\x00\x00xV4\x12\x88\x05\x9e\x00\x00\x00\x88\x05\x99\x00\x00\x00\x89\x05\x92\x00\x00\x00\x89\x05\x8d\x00\x00\x00\x89\x05\x88\x00\x00\x00\x89\x05\x83\x00\x00\x00\x89\x05~\x00\x00\x00\xc6\x05\x03\x00\x00\x00\x12\xc6\x05\x04\x00\x00\x00\x12\xc7\x05\x00\x00\x00\x00xV4\x12\xc7\x05\x01\x00\x00\x00xV4\x12\xc7\x05\x02\x00\x00\x00xV4\x12\xc7\x05\x03\x00\x00\x00xV4\x12\xc7\x05\x04\x00\x00\x0
 0xV4\x12\x88\x05\x04\x00\x00\x00\x88\x05\x05\x00\x00\x00\x89\x05\x04\x00\x00\x00\x89\x05\x05\x00\x00\x00\x89\x05\x06\x00\x00\x00\x89\x05\x07\x00\x00\x00\x89\x05\x08\x00\x00\x00')
+// CHECK:   ('_section_data', 'c605ffff ffff12c6 05000000 0012c705 fcffffff 78563412 c705fdff ffff7856 3412c705 feffffff 78563412 c705ffff ffff7856 3412c705 00000000 78563412 88050000 00008805 01000000 89050000 00008905 01000000 89050200 00008905 03000000 89050400 0000c605 dd000000 12c605d7 00000012 c705cc00 00007856 3412c705 c3000000 78563412 c705ba00 00007856 3412c705 b1000000 78563412 c705a800 00007856 34128805 9e000000 88059900 00008905 92000000 89058d00 00008905 88000000 89058300 00008905 7e000000 c6050300 000012c6 05040000 0012c705 00000000 78563412 c7050100 00007856 3412c705 02000000 78563412 c7050300 00007856 3412c705 04000000 78563412 88050400 00008805 05000000 89050400 00008905 05000000 89050600 00008905 07000000 89050800 0000')
 // CHECK:     # Section 1
 // CHECK:    (('section_name', '__data\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
 // CHECK:     ('segment_name', '__DATA\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
@@ -294,7 +294,7 @@
 // CHECK:    ),
 // CHECK:   ('_relocations', [
 // CHECK:   ])
-// CHECK:   ('_section_data', '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
+// CHECK:   ('_section_data', '00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000')
 // CHECK:   ])
 // CHECK:  ),
 // CHECK:   # Load Command 1

Modified: llvm/branches/wendling/eh/test/MC/MachO/darwin-x86_64-reloc.s
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/MC/MachO/darwin-x86_64-reloc.s?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/MC/MachO/darwin-x86_64-reloc.s (original)
+++ llvm/branches/wendling/eh/test/MC/MachO/darwin-x86_64-reloc.s Tue Oct 26 19:48:03 2010
@@ -139,7 +139,7 @@
 // CHECK:     (('word-0', 0x4),
 // CHECK:      ('word-1', 0x4d000008)),
 // CHECK:   ])
-// CHECK:   ('_section_data', '\x00\x00\x00\x00\x04\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x1f\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00/\x01\x00\x00\x00\x00\x00\x00')
+// CHECK:   ('_section_data', '00000000 04000000 04000000 00000000 1f010000 00000000 00000000 00000000 2f010000 00000000')
 // CHECK:     # Section 1
 // CHECK:    (('section_name', '__text\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
 // CHECK:     ('segment_name', '__TEXT\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
@@ -252,7 +252,7 @@
 // CHECK:     (('word-0', 0x2),
 // CHECK:      ('word-1', 0x2d000000)),
 // CHECK:   ])
-// CHECK:   ('_section_data', '\xc3\xe8\x00\x00\x00\x00\xe8\x04\x00\x00\x00H\x8b\x05\x00\x00\x00\x00\xff5\x00\x00\x00\x00\x8b\x05\x00\x00\x00\x00\x8b\x05\x04\x00\x00\x00\xc6\x05\xff\xff\xff\xff\x12\xc7\x05\xfc\xff\xff\xffxV4\x12\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00H\x8d\x05,\x00\x00\x00H\x8d\x05\x14\x00\x00\x00\x83\x05\x13\x00\x00\x00\x06f\x81\x05\x12\x00\x00\x00\xf4\x01\x81\x05\x10\x00\x00\x00\xf4\x01\x00\x00\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90,\x00\x00\x00\x00\x00\x00\x00\x14\x00\x00\x00\x00\x00\x00\x00\xe4\xff\xff\xff\xff\xff\xff\xff\xd4\xff\xff\xff\xff\xff\xff\xff,\x00\x00\x00\x00\x00\x00\x00\x83\xc0\x00\x03\x04%\x03\x00\x00\x00\x8b\x05\x1f\xff\xff\xff\x8b\x05,\x00\x00\x00\x8b\x05\x00\x00\x00\x00\x8b\x050\x00\x00\x00H\x83=\xff\xff\xff\xff\x00')
+// CHECK:   ('_section_data', 'c3e80000 0000e804 00000048 8b050000 0000ff35 00000000 8b050000 00008b05 04000000 c605ffff ffff12c7 05fcffff ff785634 12000000 00000000 00040000 00000000 00000000 00000000 00040000 00000000 00000000 00488d05 2c000000 488d0514 00000083 05130000 00066681 05120000 00f40181 05100000 00f40100 00909090 90909090 90909090 902c0000 00000000 00140000 00000000 00e4ffff ffffffff ffd4ffff ffffffff ff2c0000 00000000 0083c000 03042503 0000008b 051fffff ff8b052c 0000008b 05000000 008b0530 00000048 833dffff ffff00')
 // CHECK:     # Section 2
 // CHECK:    (('section_name', '__debug_frame\x00\x00\x00')
 // CHECK:     ('segment_name', '__DWARF\x00\x00\x00\x00\x00\x00\x00\x00\x00')
@@ -275,7 +275,7 @@
 // CHECK:     (('word-0', 0x0),
 // CHECK:      ('word-1', 0x6000002)),
 // CHECK:   ])
-// CHECK:   ('_section_data', '\xd5\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
+// CHECK:   ('_section_data', 'd5000000 00000000 00000000 00000000')
 // CHECK:     # Section 3
 // CHECK:    (('section_name', '__literal8\x00\x00\x00\x00\x00\x00')
 // CHECK:     ('segment_name', '__TEXT\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
@@ -292,7 +292,7 @@
 // CHECK:    ),
 // CHECK:   ('_relocations', [
 // CHECK:   ])
-// CHECK:   ('_section_data', '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
+// CHECK:   ('_section_data', '00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000')
 // CHECK:   ])
 // CHECK:  ),
 // CHECK:   # Load Command 1

Modified: llvm/branches/wendling/eh/test/MC/MachO/direction_labels.s
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/MC/MachO/direction_labels.s?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/MC/MachO/direction_labels.s (original)
+++ llvm/branches/wendling/eh/test/MC/MachO/direction_labels.s Tue Oct 26 19:48:03 2010
@@ -46,7 +46,7 @@
 // CHECK:    ),
 // CHECK:   ('_relocations', [
 // CHECK:   ])
-// CHECK:   ('_section_data', '\x90\xeb\xfd\x90u\x00\x90u\xfd\xeb\x00\x90\xc3')
+// CHECK:   ('_section_data', '90ebfd90 75009075 fdeb0090 c3')
 // CHECK:   ])
 // CHECK:  ),
 // CHECK:   # Load Command 1

Modified: llvm/branches/wendling/eh/test/MC/MachO/indirect-symbols.s
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/MC/MachO/indirect-symbols.s?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/MC/MachO/indirect-symbols.s (original)
+++ llvm/branches/wendling/eh/test/MC/MachO/indirect-symbols.s Tue Oct 26 19:48:03 2010
@@ -71,7 +71,7 @@
 // CHECK:    ),
 // CHECK:   ('_relocations', [
 // CHECK:   ])
-// CHECK:   ('_section_data', '\xf4\xf4\xf4\xf4\xf4\xf4\xf4\xf4\xf4\xf4\xf4\xf4\xf4\xf4\xf4')
+// CHECK:   ('_section_data', 'f4f4f4f4 f4f4f4f4 f4f4f4f4 f4f4f4')
 // CHECK:     # Section 2
 // CHECK:    (('section_name', '__pointers\x00\x00\x00\x00\x00\x00')
 // CHECK:     ('segment_name', '__IMPORT\x00\x00\x00\x00\x00\x00\x00\x00')
@@ -87,7 +87,7 @@
 // CHECK:    ),
 // CHECK:   ('_relocations', [
 // CHECK:   ])
-// CHECK:   ('_section_data', '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
+// CHECK:   ('_section_data', '00000000 00000000 00000000')
 // CHECK:   ])
 // CHECK:  ),
 // CHECK:   # Load Command 1

Modified: llvm/branches/wendling/eh/test/MC/MachO/jcc.s
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/MC/MachO/jcc.s?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/MC/MachO/jcc.s (original)
+++ llvm/branches/wendling/eh/test/MC/MachO/jcc.s Tue Oct 26 19:48:03 2010
@@ -10,7 +10,7 @@
 1: nop
    jc 1f
 1: nop
-   jcxz 1f
+   jecxz 1f
 1: nop
    jecxz 1f
 1: nop
@@ -100,7 +100,7 @@
 // CHECK:    ),
 // CHECK:   ('_relocations', [
 // CHECK:   ])
-// CHECK:   ('_section_data', 'w\x00\x90s\x00\x90r\x00\x90v\x00\x90r\x00\x90\xe3\x00\x90\xe3\x00\x90t\x00\x90\x7f\x00\x90}\x00\x90|\x00\x90~\x00\x90v\x00\x90r\x00\x90s\x00\x90w\x00\x90s\x00\x90u\x00\x90~\x00\x90|\x00\x90}\x00\x90\x7f\x00\x90q\x00\x90{\x00\x90y\x00\x90u\x00\x90p\x00\x90z\x00\x90z\x00\x90{\x00\x90x\x00\x90t\x00\x90')
+// CHECK:   ('_section_data', '77009073 00907200 90760090 720090e3 0090e300 90740090 7f00907d 00907c00 907e0090 76009072 00907300 90770090 73009075 00907e00 907c0090 7d00907f 00907100 907b0090 79009075 00907000 907a0090 7a00907b 00907800 90740090')
 // CHECK:   ])
 // CHECK:  ),
 // CHECK: ])

Modified: llvm/branches/wendling/eh/test/MC/MachO/relax-jumps.s
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/MC/MachO/relax-jumps.s?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/MC/MachO/relax-jumps.s (original)
+++ llvm/branches/wendling/eh/test/MC/MachO/relax-jumps.s Tue Oct 26 19:48:03 2010
@@ -10,9 +10,9 @@
 //    diff $f.{as,mc}.dump)
 // to examine the results in a more sensible fashion.
 
-// CHECK: ('_section_data', '\x90
-// CHECK: \x0f\x842\xff\xff\xff\x0f\x82\xe6\x00\x00\x00\x0f\x87&\xff\xff\xff\x0f\x8f\xda\x00\x00\x00\x0f\x88\x1a\xff\xff\xff\x0f\x83\xce\x00\x00\x00\x0f\x89\x0e\xff\xff\xff\x90
-// CHECK: \x901\xc0')
+// CHECK: ('_section_data', '90
+// CHECK: 0f8432ff ffff0f82 e6000000 0f8726ff ffff0f8f da000000 0f881aff ffff0f83 ce000000 0f890eff ffff90
+// CHECK: 9031c0')
 
 L1:
         .space 200, 0x90

Modified: llvm/branches/wendling/eh/test/MC/MachO/reloc-pcrel-offset.s
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/MC/MachO/reloc-pcrel-offset.s?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/MC/MachO/reloc-pcrel-offset.s (original)
+++ llvm/branches/wendling/eh/test/MC/MachO/reloc-pcrel-offset.s Tue Oct 26 19:48:03 2010
@@ -4,7 +4,7 @@
 // CHECK: (('word-0', 0x1),
 // CHECK: ('word-1', 0x5000002)),
 // CHECK-NEXT: ])
-// CHECK: ('_section_data', '\xe8\xfb\xff\xff\xff')
+// CHECK: ('_section_data', 'e8fbffff ff')
 
         .data
         .long 0

Modified: llvm/branches/wendling/eh/test/MC/MachO/reloc.s
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/MC/MachO/reloc.s?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/MC/MachO/reloc.s (original)
+++ llvm/branches/wendling/eh/test/MC/MachO/reloc.s Tue Oct 26 19:48:03 2010
@@ -37,6 +37,7 @@
         .text
 _f0:
 L1:
+        jmp	0xbabecafe
         jmp L0
         jmp L1
         ret
@@ -64,9 +65,9 @@
 // CHECK:   ('size', 260)
 // CHECK:   ('segment_name', '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
 // CHECK:   ('vm_addr', 0)
-// CHECK:   ('vm_size', 71)
+// CHECK:   ('vm_size', 76)
 // CHECK:   ('file_offset', 392)
-// CHECK:   ('file_size', 71)
+// CHECK:   ('file_size', 76)
 // CHECK:   ('maxprot', 7)
 // CHECK:   ('initprot', 7)
 // CHECK:   ('num_sections', 3)
@@ -76,29 +77,32 @@
 // CHECK:    (('section_name', '__text\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
 // CHECK:     ('segment_name', '__TEXT\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
 // CHECK:     ('address', 0)
-// CHECK:     ('size', 8)
+// CHECK:     ('size', 13)
 // CHECK:     ('offset', 392)
 // CHECK:     ('alignment', 0)
-// CHECK:     ('reloc_offset', 464)
-// CHECK:     ('num_reloc', 1)
+// CHECK:     ('reloc_offset', 468)
+// CHECK:     ('num_reloc', 2)
 // CHECK:     ('flags', 0x80000400)
 // CHECK:     ('reserved1', 0)
 // CHECK:     ('reserved2', 0)
 // CHECK:    ),
 // CHECK:   ('_relocations', [
 // CHECK:     # Relocation 0
-// CHECK:     (('word-0', 0x1),
+// CHECK:     (('word-0', 0x6),
 // CHECK:      ('word-1', 0x5000003)),
+// CHECK:     # Relocation 1
+// CHECK:     (('word-0', 0x1),
+// CHECK:      ('word-1', 0x5000000)),
 // CHECK:   ])
-// CHECK:   ('_section_data', '\xe9:\x00\x00\x00\xeb\xf9\xc3')
+// CHECK:   ('_section_data', 'e9f9cabe bae93a00 0000ebf4 c3')
 // CHECK:     # Section 1
 // CHECK:    (('section_name', '__data\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
 // CHECK:     ('segment_name', '__DATA\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
-// CHECK:     ('address', 8)
+// CHECK:     ('address', 13)
 // CHECK:     ('size', 51)
-// CHECK:     ('offset', 400)
+// CHECK:     ('offset', 405)
 // CHECK:     ('alignment', 0)
-// CHECK:     ('reloc_offset', 472)
+// CHECK:     ('reloc_offset', 484)
 // CHECK:     ('num_reloc', 11)
 // CHECK:     ('flags', 0x0)
 // CHECK:     ('reserved1', 0)
@@ -113,22 +117,22 @@
 // CHECK:      ('word-1', 0xc000007)),
 // CHECK:     # Relocation 2
 // CHECK:     (('word-0', 0x8000002a),
-// CHECK:      ('word-1', 0x18)),
+// CHECK:      ('word-1', 0x1d)),
 // CHECK:     # Relocation 3
 // CHECK:     (('word-0', 0x90000028),
-// CHECK:      ('word-1', 0x18)),
+// CHECK:      ('word-1', 0x1d)),
 // CHECK:     # Relocation 4
 // CHECK:     (('word-0', 0xa0000024),
-// CHECK:      ('word-1', 0x18)),
+// CHECK:      ('word-1', 0x1d)),
 // CHECK:     # Relocation 5
 // CHECK:     (('word-0', 0xa0000020),
-// CHECK:      ('word-1', 0x18)),
+// CHECK:      ('word-1', 0x1d)),
 // CHECK:     # Relocation 6
 // CHECK:     (('word-0', 0xa4000014),
-// CHECK:      ('word-1', 0x1c)),
+// CHECK:      ('word-1', 0x21)),
 // CHECK:     # Relocation 7
 // CHECK:     (('word-0', 0xa1000000),
-// CHECK:      ('word-1', 0x24)),
+// CHECK:      ('word-1', 0x29)),
 // CHECK:     # Relocation 8
 // CHECK:     (('word-0', 0x8),
 // CHECK:      ('word-1', 0x4000002)),
@@ -139,15 +143,15 @@
 // CHECK:     (('word-0', 0x0),
 // CHECK:      ('word-1', 0xc000009)),
 // CHECK:   ])
-// CHECK:   ('_section_data', '\x00\x00\x00\x00\x04\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xed\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x19\x00\x00\x00"\x00\x00\x00,\x00q\x00\x00\x00\x00\x04\x00\x00\x00')
+// CHECK:   ('_section_data', '00000000 04000000 15000000 00000000 00000000 ed000000 00000000 00000000 1e000000 27000000 31007600 00000004 000000')
 // CHECK:     # Section 2
 // CHECK:    (('section_name', '__const\x00\x00\x00\x00\x00\x00\x00\x00\x00')
 // CHECK:     ('segment_name', '__TEXT\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
-// CHECK:     ('address', 59)
+// CHECK:     ('address', 64)
 // CHECK:     ('size', 12)
-// CHECK:     ('offset', 451)
+// CHECK:     ('offset', 456)
 // CHECK:     ('alignment', 0)
-// CHECK:     ('reloc_offset', 560)
+// CHECK:     ('reloc_offset', 572)
 // CHECK:     ('num_reloc', 4)
 // CHECK:     ('flags', 0x0)
 // CHECK:     ('reserved1', 0)
@@ -162,20 +166,20 @@
 // CHECK:      ('word-1', 0x4000003)),
 // CHECK:     # Relocation 2
 // CHECK:     (('word-0', 0xa4000000),
-// CHECK:      ('word-1', 0x18)),
+// CHECK:      ('word-1', 0x1d)),
 // CHECK:     # Relocation 3
 // CHECK:     (('word-0', 0xa1000000),
-// CHECK:      ('word-1', 0x3b)),
+// CHECK:      ('word-1', 0x40)),
 // CHECK:   ])
-// CHECK:   ('_section_data', '\xfe\xff\xff\xff?\x00\x00\x00\x00\x00\x00\x00')
+// CHECK:   ('_section_data', 'feffffff 44000000 00000000')
 // CHECK:   ])
 // CHECK:  ),
 // CHECK:   # Load Command 1
 // CHECK:  (('command', 2)
 // CHECK:   ('size', 24)
-// CHECK:   ('symoff', 592)
+// CHECK:   ('symoff', 604)
 // CHECK:   ('nsyms', 10)
-// CHECK:   ('stroff', 712)
+// CHECK:   ('stroff', 724)
 // CHECK:   ('strsize', 88)
 // CHECK:   ('_string_data', '\x00undef\x00local_a_ext\x00.objc_class_name_A\x00_f1\x00local_a\x00local_a_elt\x00local_b\x00local_c\x00bar\x00_f0\x00\x00\x00')
 // CHECK:   ('_symbols', [
@@ -184,7 +188,7 @@
 // CHECK:     ('n_type', 0xe)
 // CHECK:     ('n_sect', 2)
 // CHECK:     ('n_desc', 0)
-// CHECK:     ('n_value', 20)
+// CHECK:     ('n_value', 25)
 // CHECK:     ('_string', 'local_a')
 // CHECK:    ),
 // CHECK:     # Symbol 1
@@ -192,7 +196,7 @@
 // CHECK:     ('n_type', 0xe)
 // CHECK:     ('n_sect', 2)
 // CHECK:     ('n_desc', 0)
-// CHECK:     ('n_value', 24)
+// CHECK:     ('n_value', 29)
 // CHECK:     ('_string', 'local_a_elt')
 // CHECK:    ),
 // CHECK:     # Symbol 2
@@ -200,7 +204,7 @@
 // CHECK:     ('n_type', 0xe)
 // CHECK:     ('n_sect', 2)
 // CHECK:     ('n_desc', 0)
-// CHECK:     ('n_value', 28)
+// CHECK:     ('n_value', 33)
 // CHECK:     ('_string', 'local_b')
 // CHECK:    ),
 // CHECK:     # Symbol 3
@@ -208,7 +212,7 @@
 // CHECK:     ('n_type', 0xe)
 // CHECK:     ('n_sect', 2)
 // CHECK:     ('n_desc', 0)
-// CHECK:     ('n_value', 36)
+// CHECK:     ('n_value', 41)
 // CHECK:     ('_string', 'local_c')
 // CHECK:    ),
 // CHECK:     # Symbol 4
@@ -216,7 +220,7 @@
 // CHECK:     ('n_type', 0xe)
 // CHECK:     ('n_sect', 3)
 // CHECK:     ('n_desc', 0)
-// CHECK:     ('n_value', 59)
+// CHECK:     ('n_value', 64)
 // CHECK:     ('_string', 'bar')
 // CHECK:    ),
 // CHECK:     # Symbol 5
@@ -240,7 +244,7 @@
 // CHECK:     ('n_type', 0xf)
 // CHECK:     ('n_sect', 1)
 // CHECK:     ('n_desc', 128)
-// CHECK:     ('n_value', 8)
+// CHECK:     ('n_value', 13)
 // CHECK:     ('_string', '_f1')
 // CHECK:    ),
 // CHECK:     # Symbol 8
@@ -248,7 +252,7 @@
 // CHECK:     ('n_type', 0xf)
 // CHECK:     ('n_sect', 2)
 // CHECK:     ('n_desc', 0)
-// CHECK:     ('n_value', 16)
+// CHECK:     ('n_value', 21)
 // CHECK:     ('_string', 'local_a_ext')
 // CHECK:    ),
 // CHECK:     # Symbol 9

Modified: llvm/branches/wendling/eh/test/MC/MachO/string-table.s
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/MC/MachO/string-table.s?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/MC/MachO/string-table.s (original)
+++ llvm/branches/wendling/eh/test/MC/MachO/string-table.s Tue Oct 26 19:48:03 2010
@@ -43,7 +43,7 @@
 // CHECK:     (('word-0', 0x2),
 // CHECK:      ('word-1', 0xc000001)),
 // CHECK:   ])
-// CHECK:   ('_section_data', '\xc7\x05\x00\x00\x00\x00\x00\x00\x00\x00')
+// CHECK:   ('_section_data', 'c7050000 00000000 0000')
 // CHECK:   ])
 // CHECK:  ),
 // CHECK:   # Load Command 1

Modified: llvm/branches/wendling/eh/test/MC/MachO/tbss.s
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/MC/MachO/tbss.s?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/MC/MachO/tbss.s (original)
+++ llvm/branches/wendling/eh/test/MC/MachO/tbss.s Tue Oct 26 19:48:03 2010
@@ -57,7 +57,7 @@
 // CHECK:    ),
 // CHECK:   ('_relocations', [
 // CHECK:   ])
-// CHECK:   ('_section_data', '\xcf\xfa\xed\xfe\x07\x00\x00\x01\x03\x00\x00\x00')
+// CHECK:   ('_section_data', 'cffaedfe 07000001 03000000')
 // CHECK:   ])
 // CHECK:  ),
 // CHECK:   # Load Command 1

Modified: llvm/branches/wendling/eh/test/MC/MachO/tdata.s
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/MC/MachO/tdata.s?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/MC/MachO/tdata.s (original)
+++ llvm/branches/wendling/eh/test/MC/MachO/tdata.s Tue Oct 26 19:48:03 2010
@@ -57,7 +57,7 @@
 // CHECK:    ),
 // CHECK:   ('_relocations', [
 // CHECK:   ])
-// CHECK:   ('_section_data', '\x04\x00\x00\x00')
+// CHECK:   ('_section_data', '04000000')
 // CHECK:   ])
 // CHECK:  ),
 // CHECK:   # Load Command 1

Modified: llvm/branches/wendling/eh/test/MC/MachO/thread_init_func.s
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/MC/MachO/thread_init_func.s?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/MC/MachO/thread_init_func.s (original)
+++ llvm/branches/wendling/eh/test/MC/MachO/thread_init_func.s Tue Oct 26 19:48:03 2010
@@ -57,7 +57,7 @@
 // CHECK:    ),
 // CHECK:   ('_relocations', [
 // CHECK:   ])
-// CHECK:   ('_section_data', '\x00\x00\x00\x00\x00\x00\x00\x00')
+// CHECK:   ('_section_data', '00000000 00000000')
 // CHECK:   ])
 // CHECK:  ),
 // CHECK: ])

Modified: llvm/branches/wendling/eh/test/MC/MachO/tls.s
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/MC/MachO/tls.s?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/MC/MachO/tls.s (original)
+++ llvm/branches/wendling/eh/test/MC/MachO/tls.s Tue Oct 26 19:48:03 2010
@@ -99,7 +99,7 @@
 // CHECK:    ),
 // CHECK:   ('_relocations', [
 // CHECK:   ])
-// CHECK:   ('_section_data', '\x04\x00\x00\x00\x05\x00\x00\x00')
+// CHECK:   ('_section_data', '04000000 05000000')
 // CHECK:     # Section 2
 // CHECK:    (('section_name', '__thread_vars\x00\x00\x00')
 // CHECK:     ('segment_name', '__DATA\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
@@ -140,7 +140,7 @@
 // CHECK:     (('word-0', 0x0),
 // CHECK:      ('word-1', 0xe000008)),
 // CHECK:   ])
-// CHECK:   ('_section_data', '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
+// CHECK:   ('_section_data', '00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000')
 // CHECK:     # Section 3
 // CHECK:    (('section_name', '__thread_bss\x00\x00\x00\x00')
 // CHECK:     ('segment_name', '__DATA\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
@@ -157,7 +157,7 @@
 // CHECK:    ),
 // CHECK:   ('_relocations', [
 // CHECK:   ])
-// CHECK:   ('_section_data', '\xcf\xfa\xed\xfe\x07\x00\x00\x01')
+// CHECK:   ('_section_data', 'cffaedfe 07000001')
 // CHECK:   ])
 // CHECK:  ),
 // CHECK:   # Load Command 1

Modified: llvm/branches/wendling/eh/test/MC/MachO/tlv-reloc.s
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/MC/MachO/tlv-reloc.s?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/MC/MachO/tlv-reloc.s (original)
+++ llvm/branches/wendling/eh/test/MC/MachO/tlv-reloc.s Tue Oct 26 19:48:03 2010
@@ -61,7 +61,7 @@
 // CHECK:     (('word-0', 0x3),
 // CHECK:      ('word-1', 0x9d000001)),
 // CHECK:   ])
-// CHECK:   ('_section_data', 'H\x8b=\x00\x00\x00\x00\xff\x17\xc3')
+// CHECK:   ('_section_data', '488b3d00 000000ff 17c3')
 // CHECK:     # Section 1
 // CHECK:    (('section_name', '__thread_data\x00\x00\x00')
 // CHECK:     ('segment_name', '__DATA\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
@@ -78,7 +78,7 @@
 // CHECK:    ),
 // CHECK:   ('_relocations', [
 // CHECK:   ])
-// CHECK:   ('_section_data', '\x04\x00\x00\x00')
+// CHECK:   ('_section_data', '04000000')
 // CHECK:     # Section 2
 // CHECK:    (('section_name', '__thread_vars\x00\x00\x00')
 // CHECK:     ('segment_name', '__DATA\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
@@ -101,7 +101,7 @@
 // CHECK:     (('word-0', 0x0),
 // CHECK:      ('word-1', 0xe000003)),
 // CHECK:   ])
-// CHECK:   ('_section_data', '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
+// CHECK:   ('_section_data', '00000000 00000000 00000000 00000000 00000000 00000000')
 // CHECK:   ])
 // CHECK:  ),
 // CHECK:   # Load Command 1

Modified: llvm/branches/wendling/eh/test/MC/MachO/tlv.s
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/MC/MachO/tlv.s?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/MC/MachO/tlv.s (original)
+++ llvm/branches/wendling/eh/test/MC/MachO/tlv.s Tue Oct 26 19:48:03 2010
@@ -61,7 +61,7 @@
 // CHECK:    ),
 // CHECK:   ('_relocations', [
 // CHECK:   ])
-// CHECK:   ('_section_data', '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
+// CHECK:   ('_section_data', '00000000 00000000 00000000 00000000 00000000 00000000')
 // CHECK:   ])
 // CHECK:  ),
 // CHECK:   # Load Command 1

Modified: llvm/branches/wendling/eh/test/MC/MachO/x86_32-optimal_nop.s
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/MC/MachO/x86_32-optimal_nop.s?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/MC/MachO/x86_32-optimal_nop.s (original)
+++ llvm/branches/wendling/eh/test/MC/MachO/x86_32-optimal_nop.s Tue Oct 26 19:48:03 2010
@@ -192,7 +192,7 @@
 // CHECK:    ),
 // CHECK:   ('_relocations', [
 // CHECK:   ])
-// CHECK:   ('_section_data', '\xc3\x90\xc3\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc3\xc3f\x90\xc3\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc3\x0f\x1f\x00\xc3\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc3\xc3\xc3\xc3\x0f\x1f@\x00\xc3\x00\x00\x00\x00\x00\x00\x00\xc3\xc3\xc3\x0f\x1fD\x00\x00\xc3\x00\x00\x00\x00\x00\x00\x00\xc3\xc3f\x0f\x1fD\x00\x00\xc3\x00\x00\x00\x00\x00\x00\x00\xc3\x0f\x1f\x80\x00\x00\x00\x00\xc3\x00\x00\x00\x00\x00\x00\x00\xc3\xc3\xc3\xc3\xc3\xc3\xc3\xc3\xc3\x00\x00\x00\x00\x00\x00\x00\xc3\xc3\xc3\xc3\xc3\xc3\xc3f\x0f\x1f\x84\x00\x00\x00\x00\x00\xc3\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc3\xc3\xc3\xc3\xc3\xc3\xc3f\x0f\x1f\x84\x00\x00\x00\x00\x00\xc3\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc3\xc3\xc3\xc3\xc3\x0f\x1fD\x00\x00f\x0f\x1fD\x00\x00\xc3\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc3\xc3\xc3\xc3f\x0f\x1fD\x00\x00f\x0f\x1fD\x00\x00\xc3\x00\x00\x00\x00\x00\x00\x00\x00\x00
 \x00\x00\x00\x00\x00\x00\xc3\xc3\xc3f\x0f\x1fD\x00\x00\x0f\x1f\x80\x00\x00\x00\x00\xc3\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc3\xc3\x0f\x1f\x80\x00\x00\x00\x00\x0f\x1f\x80\x00\x00\x00\x00\xc3\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc3\x0f\x1f\x80\x00\x00\x00\x00\x0f\x1f\x84\x00\x00\x00\x00\x00\xc3')
+// CHECK:   ('_section_data', 'c390c300 00000000 00000000 00000000 c3c36690 c3000000 00000000 00000000 c30f1f00 c3000000 00000000 00000000 c3c3c3c3 0f1f4000 c3000000 00000000 c3c3c30f 1f440000 c3000000 00000000 c3c3660f 1f440000 c3000000 00000000 c30f1f80 00000000 c3000000 00000000 c3c3c3c3 c3c3c3c3 c3000000 00000000 c3c3c3c3 c3c3c366 0f1f8400 00000000 c3000000 00000000 00000000 00000000 c3c3c3c3 c3c3c366 0f1f8400 00000000 c3000000 00000000 00000000 00000000 c3c3c3c3 c30f1f44 0000660f 1f440000 c3000000 00000000 00000000 00000000 c3c3c3c3 660f1f44 0000660f 1f440000 c3000000 00000000 00000000 00000000 c3c3c366 0f1f4400 000f1f80 00000000 c3000000 00000000 00000000 00000000 c3c30f1f 80000000 000f1f80 00000000 c3000000 00000000 00000000 00000000 c30f1f80 00000000 0f1f8400 00000000 c3')
 // CHECK:     # Section 1
 // CHECK:    (('section_name', '__const\x00\x00\x00\x00\x00\x00\x00\x00\x00')
 // CHECK:     ('segment_name', '__TEXT\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
@@ -208,7 +208,7 @@
 // CHECK:    ),
 // CHECK:   ('_relocations', [
 // CHECK:   ])
-// CHECK:   ('_section_data', '\x00\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x00\x00\x00\x00')
+// CHECK:   ('_section_data', '00909090 90909090 90909090 90909090 00000000')
 // CHECK:   ])
 // CHECK:  ),
 // CHECK:   # Load Command 1

Modified: llvm/branches/wendling/eh/test/MC/MachO/zerofill-5.s
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/MC/MachO/zerofill-5.s?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/MC/MachO/zerofill-5.s (original)
+++ llvm/branches/wendling/eh/test/MC/MachO/zerofill-5.s Tue Oct 26 19:48:03 2010
@@ -43,7 +43,7 @@
 // CHECK:    ),
 // CHECK:   ('_relocations', [
 // CHECK:   ])
-// CHECK:   ('_section_data', '\x02\x00\x00\x00')
+// CHECK:   ('_section_data', '02000000')
 // CHECK:     # Section 1
 // CHECK:    (('section_name', '__bss\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
 // CHECK:     ('segment_name', '__DATA\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
@@ -60,7 +60,7 @@
 // CHECK:    ),
 // CHECK:   ('_relocations', [
 // CHECK:   ])
-// CHECK:   ('_section_data', '\xcf\xfa\xed\xfe\x07\x00\x00\x01')
+// CHECK:   ('_section_data', 'cffaedfe 07000001')
 // CHECK:   ])
 // CHECK:  ),
 // CHECK:   # Load Command 1

Propchange: llvm/branches/wendling/eh/test/MC/X86/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Oct 26 19:48:03 2010
@@ -0,0 +1 @@
+Output

Modified: llvm/branches/wendling/eh/test/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Makefile?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Makefile (original)
+++ llvm/branches/wendling/eh/test/Makefile Tue Oct 26 19:48:03 2010
@@ -10,11 +10,11 @@
 LEVEL = ..
 DIRS  =
 
-#
-# Make Dejagnu the default for testing
-#
 all:: check-local
 
+# 'lit' is the default test runner.
+check-local:: check-local-lit
+
 # Include other test rules
 include Makefile.tests
 
@@ -33,6 +33,11 @@
 LIT_ARGS := -s -v
 endif
 
+# -jN causes crash on Cygwin's python.
+ifneq (,$(filter $(HOST_OS),Cygwin))
+  LIT_ARGS += -j1
+endif
+
 ifdef TESTSUITE
 LIT_TESTSUITE := $(TESTSUITE)
 CLEANED_TESTSUITE := $(patsubst %/,%,$(TESTSUITE))
@@ -84,18 +89,18 @@
 ifeq ($(HOST_OS),AuroraUX)
 ULIMIT=ulimit -t 600 ; ulimit -d 512000 ; ulimit -v 512000 ;
 else # !AuroraUX
-# Fedora 13 x86-64 python fails with -v 51200
-ULIMIT=ulimit -t 600 ; ulimit -d 512000 ; ulimit -m 512000 ; ulimit -v 768000 ;
+# Fedora 13 x86-64 python fails with -v 76800
+ULIMIT=ulimit -t 600 ; ulimit -d 512000 ; ulimit -m 512000 ; ulimit -v 1024000 ;
 endif # AuroraUX
 endif # SunOS
 
 ifneq ($(RUNTEST),)
-check-local:: site.exp
+check-local-dg:: site.exp
 	( $(ULIMIT) \
 	  PATH="$(LLVMToolDir):$(LLVM_SRC_ROOT)/test/Scripts:$(LLVMGCCDIR)/bin:$(PATH)" \
 	  $(RUNTEST) $(RUNTESTFLAGS) )
 else
-check-local:: site.exp
+check-local-dg:: site.exp
 	@echo "*** dejagnu not found.  Make sure 'runtest' is in your PATH, then reconfigure LLVM."
 endif
 
@@ -107,26 +112,6 @@
 	( $(ULIMIT) \
 	  $(LLVM_SRC_ROOT)/utils/lit/lit.py $(LIT_ARGS) $(LIT_ALL_TESTSUITES) )
 
-ifdef TESTONE
-CLEANED_TESTONE := $(patsubst %/,%,$(TESTONE))
-CLEANED_TESTONE := $(patsubst test/%,%,$(CLEANED_TESTONE))
-SUBDIR := $(shell dirname $(CLEANED_TESTONE))
-TESTPATH := $(LLVM_SRC_ROOT)/test/$(CLEANED_TESTONE)
-check-one: site.exp $(TCLSH)
-	$(Verb)( echo "source $(LLVM_OBJ_ROOT)/test/site.exp" ; \
-	  echo "set subdir $(SUBDIR)" ; \
-	  echo "proc pass  { msg } { puts \"PASS: \$$msg\" } "; \
-	  echo "proc fail  { msg } { puts \"FAIL: \$$msg\" }" ; \
-	  echo "proc xfail { msg } { puts \"XFAIL: \$$msg\" }" ; \
-	  echo "proc xpass { msg } { puts \"XPASS: \$$msg\" }" ; \
-	  echo "proc verbose args { }" ; \
-	  echo "source $(LLVM_SRC_ROOT)/test/lib/llvm.exp" ; \
-	  echo "RunLLVMTests $(TESTPATH)" ) | \
-	( $(ULIMIT) \
-	  PATH="$(LLVMToolDir):$(LLVM_SRC_ROOT)/test/Scripts:$(PATH)" \
-	  $(TCLSH) )
-endif
-
 clean::
 	$(RM) -rf `find $(LLVM_OBJ_ROOT)/test -name Output -type d -print`
 
@@ -166,7 +151,7 @@
 	@echo 'set gccpath "$(CC)"' >>site.tmp
 	@echo 'set gxxpath "$(CXX)"' >>site.tmp
 	@echo 'set compile_c "' $(CC) $(CPP.Flags) $(TargetCommonOpts) $(CompileCommonOpts) -c '"' >>site.tmp
-	@echo 'set compile_cxx "' $(CXX) $(CPP.Flags) $(CXX.Flags) $(TargetCommonOpts) $(CompileCommonOpts) -c '"' >> site.tmp
+	@echo 'set compile_cxx "' $(CXX) $(CPP.Flags) $(CXX.Flags) $(TargetCommonOpts) $(CompileCommonOpts) -c -x c++ '"' >> site.tmp
 	@echo 'set link "' $(CXX) $(CPP.Flags) $(CXX.Flags) $(TargetCommonOpts) $(CompileCommonOpts) $(LD.Flags) '"' >>site.tmp
 	@echo 'set llvmgcc "$(LLVMGCC) $(TargetCommonOpts) $(EXTRA_OPTIONS)"' >> site.tmp
 	@echo 'set llvmgxx "$(LLVMGCC) $(TargetCommonOpts) $(EXTRA_OPTIONS)"' >> site.tmp

Removed: llvm/branches/wendling/eh/test/Other/2008-08-14-PassManager.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Other/2008-08-14-PassManager.ll?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/test/Other/2008-08-14-PassManager.ll (original)
+++ llvm/branches/wendling/eh/test/Other/2008-08-14-PassManager.ll (removed)
@@ -1,5 +0,0 @@
-; RUN: opt < %s -loop-deletion -loop-index-split -disable-output
-; PR2640
-define i32 @test1() {
-       ret i32 0
-}

Modified: llvm/branches/wendling/eh/test/Other/constant-fold-gep.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Other/constant-fold-gep.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Other/constant-fold-gep.ll (original)
+++ llvm/branches/wendling/eh/test/Other/constant-fold-gep.ll Tue Oct 26 19:48:03 2010
@@ -71,8 +71,6 @@
 ; PLAIN: @g = constant i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64)
 ; PLAIN: @h = constant i64 ptrtoint (i1** getelementptr (i1** null, i32 1) to i64)
 ; PLAIN: @i = constant i64 ptrtoint (i1** getelementptr (%2* null, i64 0, i32 1) to i64)
-; PLAIN: @j = constant i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64)
-; PLAIN: @k = constant i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64)
 ; OPT: @a = constant i64 mul (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 2310)
 ; OPT: @b = constant i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64)
 ; OPT: @c = constant i64 mul (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 2)
@@ -82,8 +80,6 @@
 ; OPT: @g = constant i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64)
 ; OPT: @h = constant i64 ptrtoint (i1** getelementptr (i1** null, i32 1) to i64)
 ; OPT: @i = constant i64 ptrtoint (i1** getelementptr (%2* null, i64 0, i32 1) to i64)
-; OPT: @j = constant i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64)
-; OPT: @k = constant i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64)
 ; TO: @a = constant i64 18480
 ; TO: @b = constant i64 8
 ; TO: @c = constant i64 16
@@ -93,8 +89,6 @@
 ; TO: @g = constant i64 8
 ; TO: @h = constant i64 8
 ; TO: @i = constant i64 8
-; TO: @j = constant i64 8
-; TO: @k = constant i64 8
 
 @a = constant i64 mul (i64 3, i64 mul (i64 ptrtoint ({[7 x double], [7 x double]}* getelementptr ({[7 x double], [7 x double]}* null, i64 11) to i64), i64 5))
 @b = constant i64 ptrtoint ([13 x double]* getelementptr ({i1, [13 x double]}* null, i64 0, i32 1) to i64)
@@ -105,8 +99,6 @@
 @g = constant i64 ptrtoint ({double, double}* getelementptr ({i1, {double, double}}* null, i64 0, i32 1) to i64)
 @h = constant i64 ptrtoint (double** getelementptr (double** null, i64 1) to i64)
 @i = constant i64 ptrtoint (double** getelementptr ({i1, double*}* null, i64 0, i32 1) to i64)
- at j = constant i64 ptrtoint (union {double, double}* getelementptr ({i1, union {double, double}}* null, i64 0, i32 1) to i64)
- at k = constant i64 ptrtoint (union {double, double}* getelementptr (union {double, double}* null, i64 1) to i64)
 
 ; The target-dependent folder should cast GEP indices to integer-sized pointers.
 
@@ -275,14 +267,6 @@
 ; PLAIN:   %t = bitcast i64 ptrtoint (i1** getelementptr (%2* null, i64 0, i32 1) to i64) to i64
 ; PLAIN:   ret i64 %t
 ; PLAIN: }
-; PLAIN: define i64 @fj() nounwind {
-; PLAIN:   %t = bitcast i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64) to i64
-; PLAIN:   ret i64 %t
-; PLAIN: }
-; PLAIN: define i64 @fk() nounwind {
-; PLAIN:   %t = bitcast i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64) to i64
-; PLAIN:   ret i64 %t
-; PLAIN: }
 ; OPT: define i64 @fa() nounwind {
 ; OPT:   ret i64 mul (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 2310)
 ; OPT: }
@@ -310,12 +294,6 @@
 ; OPT: define i64 @fi() nounwind {
 ; OPT:   ret i64 ptrtoint (i1** getelementptr (%2* null, i64 0, i32 1) to i64)
 ; OPT: }
-; OPT: define i64 @fj() nounwind {
-; OPT:   ret i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64)
-; OPT: }
-; OPT: define i64 @fk() nounwind {
-; OPT:   ret i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64)
-; OPT: }
 ; TO: define i64 @fa() nounwind {
 ; TO:   ret i64 18480
 ; TO: }
@@ -343,12 +321,6 @@
 ; TO: define i64 @fi() nounwind {
 ; TO:   ret i64 8
 ; TO: }
-; TO: define i64 @fj() nounwind {
-; TO:   ret i64 8
-; TO: }
-; TO: define i64 @fk() nounwind {
-; TO:   ret i64 8
-; TO: }
 ; SCEV: Classifying expressions for: @fa
 ; SCEV:   %t = bitcast i64 mul (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 2310) to i64 
 ; SCEV:   -->  (2310 * sizeof(double))
@@ -376,12 +348,6 @@
 ; SCEV: Classifying expressions for: @fi
 ; SCEV:   %t = bitcast i64 ptrtoint (i1** getelementptr (%2* null, i64 0, i32 1) to i64) to i64
 ; SCEV:   -->  alignof(i1*)
-; SCEV: Classifying expressions for: @fj
-; SCEV:   %t = bitcast i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64) to i64
-; SCEV:   -->  alignof(double)
-; SCEV: Classifying expressions for: @fk
-; SCEV:   %t = bitcast i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64) to i64
-; SCEV:   -->  sizeof(double)
 
 define i64 @fa() nounwind {
   %t = bitcast i64 mul (i64 3, i64 mul (i64 ptrtoint ({[7 x double], [7 x double]}* getelementptr ({[7 x double], [7 x double]}* null, i64 11) to i64), i64 5)) to i64
@@ -419,14 +385,6 @@
   %t = bitcast i64 ptrtoint (double** getelementptr ({i1, double*}* null, i64 0, i32 1) to i64) to i64
   ret i64 %t
 }
-define i64 @fj() nounwind {
-  %t = bitcast i64 ptrtoint (union {double, double}* getelementptr ({i1, union {double, double}}* null, i64 0, i32 1) to i64) to i64
-  ret i64 %t
-}
-define i64 @fk() nounwind {
-  %t = bitcast i64 ptrtoint (union {double, double}* getelementptr (union {double, double}* null, i64 1) to i64) to i64
-  ret i64 %t
-}
 
 ; PLAIN: define i64* @fM() nounwind {
 ; PLAIN:   %t = bitcast i64* getelementptr (i64* null, i32 1) to i64*

Modified: llvm/branches/wendling/eh/test/Other/lint.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Other/lint.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Other/lint.ll (original)
+++ llvm/branches/wendling/eh/test/Other/lint.ll Tue Oct 26 19:48:03 2010
@@ -1,4 +1,4 @@
-; RUN: opt -lint -disable-output < %s |& FileCheck %s
+; RUN: opt -basicaa -lint -disable-output < %s |& FileCheck %s
 target datalayout = "e-p:64:64:64"
 
 declare fastcc void @bar()
@@ -161,5 +161,7 @@
 define void @struct_caller() nounwind {
 entry:
   call %struct bitcast (i32 ()* @foo to %struct ()*)()
-  ret void
+
+  ; CHECK: Undefined behavior: indirectbr with no destinations
+  indirectbr i8* null, []
 }

Modified: llvm/branches/wendling/eh/test/Scripts/coff-dump.py
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Scripts/coff-dump.py?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Scripts/coff-dump.py (original)
+++ llvm/branches/wendling/eh/test/Scripts/coff-dump.py Tue Oct 26 19:48:03 2010
@@ -13,197 +13,217 @@
 #
 
 def string_table_entry (offset):
-	return ('ptr', '+ + PointerToSymbolTable * NumberOfSymbols 18 %s' % offset, ('scalar', 'cstr', '%s'))
+  return ('ptr', '+ + PointerToSymbolTable * NumberOfSymbols 18 %s' % offset, ('scalar', 'cstr', '%s'))
 
 def secname(value):
-	if value[0] == '/':
-		return string_table_entry (value [1:].rstrip('\0'))
-	else:
-		return '%s'
+  if value[0] == '/':
+    return string_table_entry(value[1:].rstrip('\0'))
+  else:
+    return '%s'
 
 def symname(value):
-	parts = struct.unpack("<2L", value)
-	if parts [0] == 0:
-		return string_table_entry (parts [1])
-	else:
-		return '%s'
+  parts = struct.unpack("<2L", value)
+  if parts[0] == 0:
+    return string_table_entry(parts[1])
+  else:
+    return '%s'
 
 file = ('struct', [
-	('MachineType', ('enum', '<H', '0x%X', {
-		0x0:    'IMAGE_FILE_MACHINE_UNKNOWN',
-		0x1d3:  'IMAGE_FILE_MACHINE_AM33',
-		0x866:  'IMAGE_FILE_MACHINE_AMD64',
-		0x1c0:  'IMAGE_FILE_MACHINE_ARM',
-		0xebc:  'IMAGE_FILE_MACHINE_EBC',
-		0x14c:  'IMAGE_FILE_MACHINE_I386',
-		0x200:  'IMAGE_FILE_MACHINE_IA64',
-		0x904:  'IMAGE_FILE_MACHINE_M32R',
-		0x266:  'IMAGE_FILE_MACHINE_MIPS16',
-		0x366:  'IMAGE_FILE_MACHINE_MIPSFPU',
-		0x466:  'IMAGE_FILE_MACHINE_MIPSFPU16',
-		0x1f0:  'IMAGE_FILE_MACHINE_POWERPC',
-		0x1f1:  'IMAGE_FILE_MACHINE_POWERPCFP',
-		0x166:  'IMAGE_FILE_MACHINE_R4000',
-		0x1a2:  'IMAGE_FILE_MACHINE_SH3',
-		0x1a3:  'IMAGE_FILE_MACHINE_SH3DSP',
-		0x1a6:  'IMAGE_FILE_MACHINE_SH4',
-		0x1a8:  'IMAGE_FILE_MACHINE_SH5',
-		0x1c2:  'IMAGE_FILE_MACHINE_THUMB',
-		0x169:  'IMAGE_FILE_MACHINE_WCEMIPSV2',
-	})),
-	('NumberOfSections',     ('scalar',  '<H', '%d')),
-	('TimeDateStamp',        ('scalar',  '<L', '%d')),
-	('PointerToSymbolTable', ('scalar',  '<L', '0x%0X')),
-	('NumberOfSymbols',      ('scalar',  '<L', '%d')),
-	('SizeOfOptionalHeader', ('scalar',  '<H', '%d')),
-	('Characteristics',      ('flags',   '<H', '0x%x', [
-		(0x0001,      'IMAGE_FILE_RELOCS_STRIPPED',         ),
-		(0x0002,      'IMAGE_FILE_EXECUTABLE_IMAGE',        ),
-		(0x0004,      'IMAGE_FILE_LINE_NUMS_STRIPPED',      ),
-		(0x0008,      'IMAGE_FILE_LOCAL_SYMS_STRIPPED',     ),
-		(0x0010,      'IMAGE_FILE_AGGRESSIVE_WS_TRIM',      ),
-		(0x0020,      'IMAGE_FILE_LARGE_ADDRESS_AWARE',     ),
-		(0x0080,      'IMAGE_FILE_BYTES_REVERSED_LO',       ),
-		(0x0100,      'IMAGE_FILE_32BIT_MACHINE',           ),
-		(0x0200,      'IMAGE_FILE_DEBUG_STRIPPED',          ),
-		(0x0400,      'IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP', ),
-		(0x0800,      'IMAGE_FILE_NET_RUN_FROM_SWAP',       ),
-		(0x1000,      'IMAGE_FILE_SYSTEM',                  ),
-		(0x2000,      'IMAGE_FILE_DLL',                     ),
-		(0x4000,      'IMAGE_FILE_UP_SYSTEM_ONLY',          ),
-		(0x8000,      'IMAGE_FILE_BYTES_REVERSED_HI',       ),
-	])),
-	('Sections', ('array', 'NumberOfSections', ('struct', [
-		('Name',                 ('scalar',  '<8s', secname)),
-		('VirtualSize',          ('scalar',  '<L',  '%d'   )),
-		('VirtualAddress',       ('scalar',  '<L',  '%d'   )),
-		('SizeOfRawData',        ('scalar',  '<L',  '%d'   )),
-		('PointerToRawData',     ('scalar',  '<L',  '0x%X' )),
-		('PointerToRelocations', ('scalar',  '<L',  '0x%X' )),
-		('PointerToLineNumbers', ('scalar',  '<L',  '0x%X' )),
-		('NumberOfRelocations',  ('scalar',  '<H',  '%d'   )),
-		('NumberOfLineNumbers',  ('scalar',  '<H',  '%d'   )),
-		('Charateristics',       ('flags',   '<L',  '0x%X', [
-			(0x00000008, 'IMAGE_SCN_TYPE_NO_PAD'),
-			(0x00000020, 'IMAGE_SCN_CNT_CODE'),
-			(0x00000040, 'IMAGE_SCN_CNT_INITIALIZED_DATA'),
-			(0x00000080, 'IMAGE_SCN_CNT_UNINITIALIZED_DATA'),
-			(0x00000100, 'IMAGE_SCN_LNK_OTHER'),
-			(0x00000200, 'IMAGE_SCN_LNK_INFO'),
-			(0x00000800, 'IMAGE_SCN_LNK_REMOVE'),
-			(0x00001000, 'IMAGE_SCN_LNK_COMDAT'),
-			(0x00008000, 'IMAGE_SCN_GPREL'),
-			(0x00020000, 'IMAGE_SCN_MEM_PURGEABLE'),
-			(0x00020000, 'IMAGE_SCN_MEM_16BIT'),
-			(0x00040000, 'IMAGE_SCN_MEM_LOCKED'),
-			(0x00080000, 'IMAGE_SCN_MEM_PRELOAD'),
-			(0x00F00000, 'IMAGE_SCN_ALIGN', {
-				0x00100000: 'IMAGE_SCN_ALIGN_1BYTES',
-				0x00200000: 'IMAGE_SCN_ALIGN_2BYTES',
-				0x00300000: 'IMAGE_SCN_ALIGN_4BYTES',
-				0x00400000: 'IMAGE_SCN_ALIGN_8BYTES',
-				0x00500000: 'IMAGE_SCN_ALIGN_16BYTES',
-				0x00600000: 'IMAGE_SCN_ALIGN_32BYTES',
-				0x00700000: 'IMAGE_SCN_ALIGN_64BYTES',
-				0x00800000: 'IMAGE_SCN_ALIGN_128BYTES',
-				0x00900000: 'IMAGE_SCN_ALIGN_256BYTES',
-				0x00A00000: 'IMAGE_SCN_ALIGN_512BYTES',
-				0x00B00000: 'IMAGE_SCN_ALIGN_1024BYTES',
-				0x00C00000: 'IMAGE_SCN_ALIGN_2048BYTES',
-				0x00D00000: 'IMAGE_SCN_ALIGN_4096BYTES',
-				0x00E00000: 'IMAGE_SCN_ALIGN_8192BYTES',
-			}),
-			(0x01000000, 'IMAGE_SCN_LNK_NRELOC_OVFL'),
-			(0x02000000, 'IMAGE_SCN_MEM_DISCARDABLE'),
-			(0x04000000, 'IMAGE_SCN_MEM_NOT_CACHED'),
-			(0x08000000, 'IMAGE_SCN_MEM_NOT_PAGED'),
-			(0x10000000, 'IMAGE_SCN_MEM_SHARED'),
-			(0x20000000, 'IMAGE_SCN_MEM_EXECUTE'),
-			(0x40000000, 'IMAGE_SCN_MEM_READ'),
-			(0x80000000, 'IMAGE_SCN_MEM_WRITE'),
-		])),
-		('SectionData', ('ptr', 'PointerToRawData', ('blob', 'SizeOfRawData'))),
-		('Relocations', ('ptr', 'PointerToRelocations', ('array', 'NumberOfRelocations', ('struct', [
-			('VirtualAddress',   ('scalar', '<L', '0x%X')),
-			('SymbolTableIndex', ('scalar', '<L', '%d'  )),
-			('Type',             ('enum', '<H', '%d', ('MachineType', {
-				0x14c: {
-					0x0000: 'IMAGE_REL_I386_ABSOLUTE',
-					0x0001: 'IMAGE_REL_I386_DIR16',
-					0x0002: 'IMAGE_REL_I386_REL16',
-					0x0006: 'IMAGE_REL_I386_DIR32',
-					0x0007: 'IMAGE_REL_I386_DIR32NB',
-					0x0009: 'IMAGE_REL_I386_SEG12',
-					0x000A: 'IMAGE_REL_I386_SECTION',
-					0x000B: 'IMAGE_REL_I386_SECREL',
-					0x000C: 'IMAGE_REL_I386_TOKEN',
-					0x000D: 'IMAGE_REL_I386_SECREL7',
-					0x0014: 'IMAGE_REL_I386_REL32',
-				},
-			}))),
-			('SymbolName',       ('ptr', '+ PointerToSymbolTable * - SymbolTableIndex 1 18', ('scalar',  '<8s', symname)))
-		])))),
-	]))),
-	('Symbols', ('ptr', 'PointerToSymbolTable', ('byte-array', '* NumberOfSymbols 18',  ('struct', [
-		('Name',                ('scalar',  '<8s', symname)),
-		('Value',               ('scalar',  '<L',  '%d'   )),
-		('SectionNumber',       ('scalar',  '<H',  '%d'   )),
-		('SimpleType',          ('enum',    '<B',  '%d', {
-			0: 'IMAGE_SYM_TYPE_NULL',
-			1: 'IMAGE_SYM_TYPE_VOID',
-			2: 'IMAGE_SYM_TYPE_CHAR',
-			3: 'IMAGE_SYM_TYPE_SHORT',
-			4: 'IMAGE_SYM_TYPE_INT',
-			5: 'IMAGE_SYM_TYPE_LONG',
-			6: 'IMAGE_SYM_TYPE_FLOAT',
-			7: 'IMAGE_SYM_TYPE_DOUBLE',
-			8: 'IMAGE_SYM_TYPE_STRUCT',
-			9: 'IMAGE_SYM_TYPE_UNION',
-			10: 'IMAGE_SYM_TYPE_ENUM',
-			11: 'IMAGE_SYM_TYPE_MOE',
-			12: 'IMAGE_SYM_TYPE_BYTE',
-			13: 'IMAGE_SYM_TYPE_WORD',
-			14: 'IMAGE_SYM_TYPE_UINT',
-			15: 'IMAGE_SYM_TYPE_DWORD',
-		})),
-		('ComplexType',         ('enum',    '<B',  '%d', {
-			0: 'IMAGE_SYM_DTYPE_NULL',
-			1: 'IMAGE_SYM_DTYPE_POINTER',
-			2: 'IMAGE_SYM_DTYPE_FUNCTION',
-			3: 'IMAGE_SYM_DTYPE_ARRAY',
-		})),
-		('StorageClass',        ('enum',    '<B',  '%d', {
-			-1:	'IMAGE_SYM_CLASS_END_OF_FUNCTION',
-			0: 'IMAGE_SYM_CLASS_NULL',
-			1: 'IMAGE_SYM_CLASS_AUTOMATIC',
-			2: 'IMAGE_SYM_CLASS_EXTERNAL',
-			3: 'IMAGE_SYM_CLASS_STATIC',
-			4: 'IMAGE_SYM_CLASS_REGISTER',
-			5: 'IMAGE_SYM_CLASS_EXTERNAL_DEF',
-			6: 'IMAGE_SYM_CLASS_LABEL',
-			7: 'IMAGE_SYM_CLASS_UNDEFINED_LABEL',
-			8: 'IMAGE_SYM_CLASS_MEMBER_OF_STRUCT',
-			9: 'IMAGE_SYM_CLASS_ARGUMENT',
-			10: 'IMAGE_SYM_CLASS_STRUCT_TAG',
-			11: 'IMAGE_SYM_CLASS_MEMBER_OF_UNION',
-			12: 'IMAGE_SYM_CLASS_UNION_TAG',
-			13: 'IMAGE_SYM_CLASS_TYPE_DEFINITION',
-			14: 'IMAGE_SYM_CLASS_UNDEFINED_STATIC',
-			15: 'IMAGE_SYM_CLASS_ENUM_TAG',
-			16: 'IMAGE_SYM_CLASS_MEMBER_OF_ENUM',
-			17: 'IMAGE_SYM_CLASS_REGISTER_PARAM',
-			18: 'IMAGE_SYM_CLASS_BIT_FIELD',
-			100: 'IMAGE_SYM_CLASS_BLOCK',
-			101: 'IMAGE_SYM_CLASS_FUNCTION',
-			102: 'IMAGE_SYM_CLASS_END_OF_STRUCT',
-			103: 'IMAGE_SYM_CLASS_FILE',
-			104: 'IMAGE_SYM_CLASS_SECTION',
-			105: 'IMAGE_SYM_CLASS_WEAK_EXTERNAL',
-			107: 'IMAGE_SYM_CLASS_CLR_TOKEN',
-		})),
-		('NumberOfAuxSymbols',  ('scalar',  '<B',  '%d'  )),
-		('AuxillaryData', ('blob', '* NumberOfAuxSymbols 18')),
-	])))),
+  ('MachineType', ('enum', '<H', '0x%X', {
+    0x0:    'IMAGE_FILE_MACHINE_UNKNOWN',
+    0x1d3:  'IMAGE_FILE_MACHINE_AM33',
+    0x8664: 'IMAGE_FILE_MACHINE_AMD64',
+    0x1c0:  'IMAGE_FILE_MACHINE_ARM',
+    0xebc:  'IMAGE_FILE_MACHINE_EBC',
+    0x14c:  'IMAGE_FILE_MACHINE_I386',
+    0x200:  'IMAGE_FILE_MACHINE_IA64',
+    0x904:  'IMAGE_FILE_MACHINE_M32R',
+    0x266:  'IMAGE_FILE_MACHINE_MIPS16',
+    0x366:  'IMAGE_FILE_MACHINE_MIPSFPU',
+    0x466:  'IMAGE_FILE_MACHINE_MIPSFPU16',
+    0x1f0:  'IMAGE_FILE_MACHINE_POWERPC',
+    0x1f1:  'IMAGE_FILE_MACHINE_POWERPCFP',
+    0x166:  'IMAGE_FILE_MACHINE_R4000',
+    0x1a2:  'IMAGE_FILE_MACHINE_SH3',
+    0x1a3:  'IMAGE_FILE_MACHINE_SH3DSP',
+    0x1a6:  'IMAGE_FILE_MACHINE_SH4',
+    0x1a8:  'IMAGE_FILE_MACHINE_SH5',
+    0x1c2:  'IMAGE_FILE_MACHINE_THUMB',
+    0x169:  'IMAGE_FILE_MACHINE_WCEMIPSV2',
+  })),
+  ('NumberOfSections',     ('scalar',  '<H', '%d')),
+  ('TimeDateStamp',        ('scalar',  '<L', '%d')),
+  ('PointerToSymbolTable', ('scalar',  '<L', '0x%0X')),
+  ('NumberOfSymbols',      ('scalar',  '<L', '%d')),
+  ('SizeOfOptionalHeader', ('scalar',  '<H', '%d')),
+  ('Characteristics',      ('flags',   '<H', '0x%x', [
+    (0x0001,      'IMAGE_FILE_RELOCS_STRIPPED',         ),
+    (0x0002,      'IMAGE_FILE_EXECUTABLE_IMAGE',        ),
+    (0x0004,      'IMAGE_FILE_LINE_NUMS_STRIPPED',      ),
+    (0x0008,      'IMAGE_FILE_LOCAL_SYMS_STRIPPED',     ),
+    (0x0010,      'IMAGE_FILE_AGGRESSIVE_WS_TRIM',      ),
+    (0x0020,      'IMAGE_FILE_LARGE_ADDRESS_AWARE',     ),
+    (0x0080,      'IMAGE_FILE_BYTES_REVERSED_LO',       ),
+    (0x0100,      'IMAGE_FILE_32BIT_MACHINE',           ),
+    (0x0200,      'IMAGE_FILE_DEBUG_STRIPPED',          ),
+    (0x0400,      'IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP', ),
+    (0x0800,      'IMAGE_FILE_NET_RUN_FROM_SWAP',       ),
+    (0x1000,      'IMAGE_FILE_SYSTEM',                  ),
+    (0x2000,      'IMAGE_FILE_DLL',                     ),
+    (0x4000,      'IMAGE_FILE_UP_SYSTEM_ONLY',          ),
+    (0x8000,      'IMAGE_FILE_BYTES_REVERSED_HI',       ),
+  ])),
+  ('Sections', ('array', '1', 'NumberOfSections', ('struct', [
+    ('Name',                 ('scalar',  '<8s', secname)),
+    ('VirtualSize',          ('scalar',  '<L',  '%d'   )),
+    ('VirtualAddress',       ('scalar',  '<L',  '%d'   )),
+    ('SizeOfRawData',        ('scalar',  '<L',  '%d'   )),
+    ('PointerToRawData',     ('scalar',  '<L',  '0x%X' )),
+    ('PointerToRelocations', ('scalar',  '<L',  '0x%X' )),
+    ('PointerToLineNumbers', ('scalar',  '<L',  '0x%X' )),
+    ('NumberOfRelocations',  ('scalar',  '<H',  '%d'   )),
+    ('NumberOfLineNumbers',  ('scalar',  '<H',  '%d'   )),
+    ('Charateristics',       ('flags',   '<L',  '0x%X', [
+      (0x00000008, 'IMAGE_SCN_TYPE_NO_PAD'),
+      (0x00000020, 'IMAGE_SCN_CNT_CODE'),
+      (0x00000040, 'IMAGE_SCN_CNT_INITIALIZED_DATA'),
+      (0x00000080, 'IMAGE_SCN_CNT_UNINITIALIZED_DATA'),
+      (0x00000100, 'IMAGE_SCN_LNK_OTHER'),
+      (0x00000200, 'IMAGE_SCN_LNK_INFO'),
+      (0x00000800, 'IMAGE_SCN_LNK_REMOVE'),
+      (0x00001000, 'IMAGE_SCN_LNK_COMDAT'),
+      (0x00008000, 'IMAGE_SCN_GPREL'),
+      (0x00020000, 'IMAGE_SCN_MEM_PURGEABLE'),
+      (0x00020000, 'IMAGE_SCN_MEM_16BIT'),
+      (0x00040000, 'IMAGE_SCN_MEM_LOCKED'),
+      (0x00080000, 'IMAGE_SCN_MEM_PRELOAD'),
+      (0x00F00000, 'IMAGE_SCN_ALIGN', {
+        0x00100000: 'IMAGE_SCN_ALIGN_1BYTES',
+        0x00200000: 'IMAGE_SCN_ALIGN_2BYTES',
+        0x00300000: 'IMAGE_SCN_ALIGN_4BYTES',
+        0x00400000: 'IMAGE_SCN_ALIGN_8BYTES',
+        0x00500000: 'IMAGE_SCN_ALIGN_16BYTES',
+        0x00600000: 'IMAGE_SCN_ALIGN_32BYTES',
+        0x00700000: 'IMAGE_SCN_ALIGN_64BYTES',
+        0x00800000: 'IMAGE_SCN_ALIGN_128BYTES',
+        0x00900000: 'IMAGE_SCN_ALIGN_256BYTES',
+        0x00A00000: 'IMAGE_SCN_ALIGN_512BYTES',
+        0x00B00000: 'IMAGE_SCN_ALIGN_1024BYTES',
+        0x00C00000: 'IMAGE_SCN_ALIGN_2048BYTES',
+        0x00D00000: 'IMAGE_SCN_ALIGN_4096BYTES',
+        0x00E00000: 'IMAGE_SCN_ALIGN_8192BYTES',
+      }),
+      (0x01000000, 'IMAGE_SCN_LNK_NRELOC_OVFL'),
+      (0x02000000, 'IMAGE_SCN_MEM_DISCARDABLE'),
+      (0x04000000, 'IMAGE_SCN_MEM_NOT_CACHED'),
+      (0x08000000, 'IMAGE_SCN_MEM_NOT_PAGED'),
+      (0x10000000, 'IMAGE_SCN_MEM_SHARED'),
+      (0x20000000, 'IMAGE_SCN_MEM_EXECUTE'),
+      (0x40000000, 'IMAGE_SCN_MEM_READ'),
+      (0x80000000, 'IMAGE_SCN_MEM_WRITE'),
+    ])),
+    ('SectionData', ('ptr', 'PointerToRawData', ('blob', 'SizeOfRawData'))),
+    ('Relocations', ('ptr', 'PointerToRelocations', ('array', '0', 'NumberOfRelocations', ('struct', [
+      ('VirtualAddress',   ('scalar', '<L', '0x%X')),
+      ('SymbolTableIndex', ('scalar', '<L', '%d'  )),
+      ('Type',             ('enum', '<H', '%d', ('MachineType', {
+        0x14c: {
+          0x0000: 'IMAGE_REL_I386_ABSOLUTE',
+          0x0001: 'IMAGE_REL_I386_DIR16',
+          0x0002: 'IMAGE_REL_I386_REL16',
+          0x0006: 'IMAGE_REL_I386_DIR32',
+          0x0007: 'IMAGE_REL_I386_DIR32NB',
+          0x0009: 'IMAGE_REL_I386_SEG12',
+          0x000A: 'IMAGE_REL_I386_SECTION',
+          0x000B: 'IMAGE_REL_I386_SECREL',
+          0x000C: 'IMAGE_REL_I386_TOKEN',
+          0x000D: 'IMAGE_REL_I386_SECREL7',
+          0x0014: 'IMAGE_REL_I386_REL32',
+        },
+        0x8664: {
+          0x0000: 'IMAGE_REL_AMD64_ABSOLUTE',
+          0x0001: 'IMAGE_REL_AMD64_ADDR64',
+          0x0002: 'IMAGE_REL_AMD64_ADDR32',
+          0x0003: 'IMAGE_REL_AMD64_ADDR32NB',
+          0x0004: 'IMAGE_REL_AMD64_REL32',
+          0x0005: 'IMAGE_REL_AMD64_REL32_1',
+          0x0006: 'IMAGE_REL_AMD64_REL32_2',
+          0x0007: 'IMAGE_REL_AMD64_REL32_3',
+          0x0008: 'IMAGE_REL_AMD64_REL32_4',
+          0x0009: 'IMAGE_REL_AMD64_REL32_5',
+          0x000A: 'IMAGE_REL_AMD64_SECTION',
+          0x000B: 'IMAGE_REL_AMD64_SECREL',
+          0x000C: 'IMAGE_REL_AMD64_SECREL7',
+          0x000D: 'IMAGE_REL_AMD64_TOKEN',
+          0x000E: 'IMAGE_REL_AMD64_SREL32',
+          0x000F: 'IMAGE_REL_AMD64_PAIR',
+          0x0010: 'IMAGE_REL_AMD64_SSPAN32',
+        },
+      }))),
+      ('SymbolName',       ('ptr', '+ PointerToSymbolTable * SymbolTableIndex 18', ('scalar',  '<8s', symname)))
+    ])))),
+  ]))),
+  ('Symbols', ('ptr', 'PointerToSymbolTable', ('byte-array', '18', '* NumberOfSymbols 18',  ('struct', [
+    ('Name',                ('scalar',  '<8s', symname)),
+    ('Value',               ('scalar',  '<L',  '%d'   )),
+    ('SectionNumber',       ('scalar',  '<H',  '%d'   )),
+    ('_Type',               ('scalar',  '<H',  None   )),
+    ('SimpleType',          ('enum',    '& _Type 15',  '%d', {
+      0: 'IMAGE_SYM_TYPE_NULL',
+      1: 'IMAGE_SYM_TYPE_VOID',
+      2: 'IMAGE_SYM_TYPE_CHAR',
+      3: 'IMAGE_SYM_TYPE_SHORT',
+      4: 'IMAGE_SYM_TYPE_INT',
+      5: 'IMAGE_SYM_TYPE_LONG',
+      6: 'IMAGE_SYM_TYPE_FLOAT',
+      7: 'IMAGE_SYM_TYPE_DOUBLE',
+      8: 'IMAGE_SYM_TYPE_STRUCT',
+      9: 'IMAGE_SYM_TYPE_UNION',
+      10: 'IMAGE_SYM_TYPE_ENUM',
+      11: 'IMAGE_SYM_TYPE_MOE',
+      12: 'IMAGE_SYM_TYPE_BYTE',
+      13: 'IMAGE_SYM_TYPE_WORD',
+      14: 'IMAGE_SYM_TYPE_UINT',
+      15: 'IMAGE_SYM_TYPE_DWORD',
+    })),                                # (Type & 0xF0) >> 4
+    ('ComplexType',         ('enum',    '>> & _Type 240 4',  '%d', {
+      0: 'IMAGE_SYM_DTYPE_NULL',
+      1: 'IMAGE_SYM_DTYPE_POINTER',
+      2: 'IMAGE_SYM_DTYPE_FUNCTION',
+      3: 'IMAGE_SYM_DTYPE_ARRAY',
+    })),
+    ('StorageClass',        ('enum',    '<B',  '%d', {
+      -1:  'IMAGE_SYM_CLASS_END_OF_FUNCTION',
+      0: 'IMAGE_SYM_CLASS_NULL',
+      1: 'IMAGE_SYM_CLASS_AUTOMATIC',
+      2: 'IMAGE_SYM_CLASS_EXTERNAL',
+      3: 'IMAGE_SYM_CLASS_STATIC',
+      4: 'IMAGE_SYM_CLASS_REGISTER',
+      5: 'IMAGE_SYM_CLASS_EXTERNAL_DEF',
+      6: 'IMAGE_SYM_CLASS_LABEL',
+      7: 'IMAGE_SYM_CLASS_UNDEFINED_LABEL',
+      8: 'IMAGE_SYM_CLASS_MEMBER_OF_STRUCT',
+      9: 'IMAGE_SYM_CLASS_ARGUMENT',
+      10: 'IMAGE_SYM_CLASS_STRUCT_TAG',
+      11: 'IMAGE_SYM_CLASS_MEMBER_OF_UNION',
+      12: 'IMAGE_SYM_CLASS_UNION_TAG',
+      13: 'IMAGE_SYM_CLASS_TYPE_DEFINITION',
+      14: 'IMAGE_SYM_CLASS_UNDEFINED_STATIC',
+      15: 'IMAGE_SYM_CLASS_ENUM_TAG',
+      16: 'IMAGE_SYM_CLASS_MEMBER_OF_ENUM',
+      17: 'IMAGE_SYM_CLASS_REGISTER_PARAM',
+      18: 'IMAGE_SYM_CLASS_BIT_FIELD',
+      100: 'IMAGE_SYM_CLASS_BLOCK',
+      101: 'IMAGE_SYM_CLASS_FUNCTION',
+      102: 'IMAGE_SYM_CLASS_END_OF_STRUCT',
+      103: 'IMAGE_SYM_CLASS_FILE',
+      104: 'IMAGE_SYM_CLASS_SECTION',
+      105: 'IMAGE_SYM_CLASS_WEAK_EXTERNAL',
+      107: 'IMAGE_SYM_CLASS_CLR_TOKEN',
+    })),
+    ('NumberOfAuxSymbols',  ('scalar',  '<B',  '%d'  )),
+    ('AuxillaryData', ('blob', '* NumberOfAuxSymbols 18')),
+  ])))),
 ])
 
 #
@@ -220,325 +240,351 @@
 NewLine = True
 
 def indent():
-	global Indent
-	Indent += 1
+  global Indent
+  Indent += 1
 
 def dedent():
-	global Indent
-	Indent -= 1
+  global Indent
+  Indent -= 1
 
 def write(input):
-	global NewLine
-	output = ""
-	
-	for char in input:
-		
-		if NewLine:
-			output += Indent * '  '
-			NewLine = False
-			
-		output += char
-		
-		if char == '\n':
-			NewLine = True
-	
-	sys.stdout.write (output)
+  global NewLine
+  output = ""
+
+  for char in input:
+
+    if NewLine:
+      output += Indent * '  '
+      NewLine = False
+
+    output += char
+
+    if char == '\n':
+      NewLine = True
+
+  sys.stdout.write(output)
 
 def read(format):
-	return struct.unpack (format, Input.read(struct.calcsize(format)))
+  return struct.unpack(format, Input.read(struct.calcsize(format)))
 
-def read_cstr ():
-	output = ""
-	while True:
-		char = Input.read (1)
-		if len (char) == 0:
-			raise RuntimeError ("EOF while reading cstr")
-		if char == '\0':
-			break
-		output += char
-	return output
+def read_cstr():
+  output = ""
+  while True:
+    char = Input.read(1)
+    if len(char) == 0:
+      raise RuntimeError ("EOF while reading cstr")
+    if char == '\0':
+      break
+    output += char
+  return output
 
 def push_pos(seek_to = None):
-	Stack [0:0] = [Input.tell ()]
-	if seek_to:
-		Input.seek (seek_to)
+  Stack [0:0] = [Input.tell()]
+  if seek_to:
+    Input.seek(seek_to)
 
 def pop_pos():
-	assert(len (Stack) > 0)
-	Input.seek (Stack [0])
-	del Stack [0]
+  assert(len(Stack) > 0)
+  Input.seek(Stack[0])
+  del Stack[0]
 
 def print_binary_data(size):
-	value = ""
-	while size > 0:
-		if size >= 16:
-			data = Input.read(16)
-			size -= 16
-		else:
-			data = Input.read(size)
-			size = 0
-		value += data
-		bytes = ""
-		text = ""
-		for index in xrange (16):
-			if index < len (data):
-				if index == 8:
-					bytes += "- "
-				ch = ord (data [index])
-				bytes += "%02X " % ch
-				if ch >= 0x20 and ch <= 0x7F:
-					text += data [index]
-				else:
-					text += "."
-			else:
-				if index == 8:
-					bytes += "  "
-				bytes += "   "
-		
-		write ("%s|%s|\n" % (bytes, text))
-	return value
+  value = ""
+  while size > 0:
+    if size >= 16:
+      data = Input.read(16)
+      size -= 16
+    else:
+      data = Input.read(size)
+      size = 0
+    value += data
+    bytes = ""
+    text = ""
+    for index in xrange(16):
+      if index < len(data):
+        if index == 8:
+          bytes += "- "
+        ch = ord(data[index])
+        bytes += "%02X " % ch
+        if ch >= 0x20 and ch <= 0x7F:
+          text += data[index]
+        else:
+          text += "."
+      else:
+        if index == 8:
+          bytes += "  "
+        bytes += "   "
+
+    write("%s|%s|\n" % (bytes, text))
+  return value
 
-idlit = re.compile ("[a-zA-Z][a-zA-Z0-9_-]*")
-numlit = re.compile ("[0-9]+")
+idlit = re.compile("[a-zA-Z_][a-zA-Z0-9_-]*")
+numlit = re.compile("[0-9]+")
 
 def read_value(expr):
 
-	input = iter (expr.split ())
-	
-	def eval():
-		
-		token = input.next ()
-		
-		if expr == 'cstr':
-			return read_cstr ()
-		if expr == 'true':
-			return True
-		if expr == 'false':
-			return False
-		
-		if len (token) > 1 and token [0] in ('=', '@', '<', '!', '>'):
-			val = read(expr)
-			assert (len (val) == 1)
-			return val [0]
-		
-		if token == '+':
-			return eval () + eval ()
-		if token == '-':
-			return eval () - eval ()
-		if token == '*':
-			return eval () * eval ()
-		if token == '/':
-			return eval () / eval ()
-		
-		if idlit.match (token):
-			return Fields [token]
-		if numlit.match (token):
-			return int (token)
-		
-		raise RuntimeError ("unexpected token %s" % repr(token))
-	
-	value = eval ()
-	
-	try:
-		input.next ()
-	except StopIteration:
-		return value
-	raise RuntimeError("unexpected input at end of expression")
+  input = iter(expr.split())
+
+  def eval():
+
+    token = input.next()
+
+    if expr == 'cstr':
+      return read_cstr()
+    if expr == 'true':
+      return True
+    if expr == 'false':
+      return False
+
+    if token == '+':
+      return eval() + eval()
+    if token == '-':
+      return eval() - eval()
+    if token == '*':
+      return eval() * eval()
+    if token == '/':
+      return eval() / eval()
+    if token == '&':
+      return eval() & eval()
+    if token == '|':
+      return eval() | eval()
+    if token == '>>':
+      return eval() >> eval()
+    if token == '<<':
+      return eval() << eval()
+
+    if len(token) > 1 and token[0] in ('=', '@', '<', '!', '>'):
+      val = read(expr)
+      assert(len(val) == 1)
+      return val[0]
+
+    if idlit.match(token):
+      return Fields[token]
+    if numlit.match(token):
+      return int(token)
+
+    raise RuntimeError("unexpected token %s" % repr(token))
+
+  value = eval()
+
+  try:
+    input.next()
+  except StopIteration:
+    return value
+  raise RuntimeError("unexpected input at end of expression")
 
 def write_value(format,value):
-	format_type = type (format)
-	if format_type is types.StringType:
-		write (format%value)
-	elif format_type is types.FunctionType:
-		write_value (format (value), value)
-	elif format_type is types.TupleType:
-		Fields ['this'] = value
-		handle_element (format)
-	else:
-		raise RuntimeError("unexpected type: %s" % repr(format_type))
+  format_type = type(format)
+  if format_type is types.StringType:
+    write(format % value)
+  elif format_type is types.FunctionType:
+    write_value(format(value), value)
+  elif format_type is types.TupleType:
+    Fields['this'] = value
+    handle_element(format)
+  elif format_type is types.NoneType:
+    pass
+  else:
+    raise RuntimeError("unexpected type: %s" % repr(format_type))
 
 def handle_scalar(entry):
-	iformat = entry [1]
-	oformat = entry [2]
-	
-	value = read_value (iformat)
-	
-	write_value (oformat, value)
-	
-	return value
+  iformat = entry[1]
+  oformat = entry[2]
+
+  value = read_value(iformat)
+
+  write_value(oformat, value)
+
+  return value
 
 def handle_enum(entry):
-	iformat = entry [1]
-	oformat = entry [2]
-	definitions = entry [3]
-	
-	value = read_value (iformat)
-	
-	if type (definitions) is types.TupleType:
-		selector = read_value (definitions [0])
-		definitions = definitions [1] [selector]
-	
-	description = definitions[value] if value in definitions else "unknown"
-	
-	write ("%s (" % description)
-	write_value (oformat, value)
-	write (")")
-	
-	return value
+  iformat = entry[1]
+  oformat = entry[2]
+  definitions = entry[3]
+
+  value = read_value(iformat)
+
+  if type(definitions) is types.TupleType:
+    selector = read_value(definitions[0])
+    definitions = definitions[1][selector]
+
+  if value in definitions:
+    description = definitions[value]
+  else:
+    description = "unknown"
+
+  write("%s (" % description)
+  write_value(oformat, value)
+  write(")")
+
+  return value
 
 def handle_flags(entry):
-	iformat = entry [1]
-	oformat = entry [2]
-	definitions = entry [3]
-	
-	value = read_value (iformat)
-	
-	write_value (oformat, value)
-	
-	indent ()
-	for entry in definitions:
-		mask = entry [0]
-		name = entry [1]
-		if len (entry) == 3:
-			map = entry [2]
-			selection = value & mask
-			if selection in map:
-				write("\n%s" % map[selection])
-			else:
-				write("\n%s <%d>" % (name, selection))
-		elif len (entry) == 2:
-			if value & mask != 0:
-				write("\n%s" % name)
-	dedent ()
-	
-	return value
+  iformat = entry[1]
+  oformat = entry[2]
+  definitions = entry[3]
+
+  value = read_value(iformat)
+
+  write_value(oformat, value)
+
+  indent()
+  for entry in definitions:
+    mask = entry[0]
+    name = entry[1]
+    if len (entry) == 3:
+      map = entry[2]
+      selection = value & mask
+      if selection in map:
+        write("\n%s" % map[selection])
+      else:
+        write("\n%s <%d>" % (name, selection))
+    elif len(entry) == 2:
+      if value & mask != 0:
+        write("\n%s" % name)
+  dedent()
+
+  return value
 
 def handle_struct(entry):
-	global Fields
-	members = entry [1]
-	
-	newFields = {}
-	
-	write ("{\n");
-	indent ()
-	
-	for member in members:
-		name = member [0]
-		type = member [1]
-		
-		write("%s = "%name.ljust(24))
-		
-		value = handle_element(type)
-		
-		write("\n")
-		
-		Fields [name] = value
-		newFields [name] = value
-	
-	dedent ()
-	write ("}")
-	
-	return newFields
+  global Fields
+  members = entry[1]
+
+  newFields = {}
+
+  write("{\n");
+  indent()
+
+  for member in members:
+    name = member[0]
+    type = member[1]
+
+    if name[0] != "_":
+      write("%s = " % name.ljust(24))
+
+    value = handle_element(type)
+
+    if name[0] != "_":
+      write("\n")
+
+    Fields[name] = value
+    newFields[name] = value
+
+  dedent()
+  write("}")
+
+  return newFields
 
 def handle_array(entry):
-	length = entry [1]
-	element = entry [2]
-	
-	newItems = []
-	
-	write ("[\n")
-	indent ()
-	
-	value = read_value (length)
-	
-	for index in xrange (value):
-		write ("%d = "%index)
-		value = handle_element(element)
-		write ("\n")
-		newItems.append (value)
-	
-	dedent ()
-	write ("]")
-	
-	return newItems
+  start_index = entry[1]
+  length = entry[2]
+  element = entry[3]
+
+  newItems = []
+
+  write("[\n")
+  indent()
+
+  start_index = read_value(start_index)
+  value = read_value(length)
+
+  for index in xrange(value):
+    write("%d = " % (index + start_index))
+    value = handle_element(element)
+    write("\n")
+    newItems.append(value)
+
+  dedent()
+  write("]")
+
+  return newItems
 
 def handle_byte_array(entry):
-	length = entry [1]
-	element = entry [2]
-	
-	newItems = []
-	
-	write ("[\n")
-	indent ()
-	
-	value = read_value (length)
-	end_of_array = Input.tell () + value
-
-	index = 0
-	while Input.tell () < end_of_array:
-		write ("%d = "%index)
-		value = handle_element(element)
-		write ("\n")
-		newItems.append (value)
-		index += 1
-	
-	dedent ()
-	write ("]")
-	
-	return newItems
+  ent_size = entry[1]
+  length = entry[2]
+  element = entry[3]
+
+  newItems = []
+
+  write("[\n")
+  indent()
+
+  item_size = read_value(ent_size)
+  value = read_value(length)
+  end_of_array = Input.tell() + value
+
+  prev_loc = Input.tell()
+  index = 0
+  while Input.tell() < end_of_array:
+    write("%d = " % index)
+    value = handle_element(element)
+    write("\n")
+    newItems.append(value)
+    index += (Input.tell() - prev_loc) / item_size
+    prev_loc = Input.tell()
+
+  dedent()
+  write("]")
+
+  return newItems
 
 def handle_ptr(entry):
-	offset = entry[1]
-	element = entry [2]
-	
-	value = None
-	offset = read_value (offset)
-	
-	if offset != 0:
-		
-		push_pos (offset)
-		
-		value = handle_element (element)
-		
-		pop_pos ()
-	
-	else:
-		write ("None")
-	
-	return value
+  offset = entry[1]
+  element = entry[2]
+
+  value = None
+  offset = read_value(offset)
+
+  if offset != 0:
+
+    push_pos(offset)
+
+    value = handle_element(element)
+
+    pop_pos()
+
+  else:
+    write("None")
+
+  return value
 
 def handle_blob(entry):
-	length = entry [1]
-	
-	write ("\n")
-	indent ()
-	
-	value = print_binary_data (read_value (length))
-	
-	dedent ()
-	
-	return value
+  length = entry[1]
+
+  write("\n")
+  indent()
+
+  value = print_binary_data(read_value(length))
+
+  dedent()
+
+  return value
 
 def handle_element(entry):
-	handlers = {
-		'struct':      handle_struct,
-		'scalar':      handle_scalar,
-		'enum':        handle_enum,
-		'flags':       handle_flags,
-		'ptr':         handle_ptr,
-		'blob':        handle_blob,
-		'array':       handle_array,
-		'byte-array':  handle_byte_array,
-	}
-	
-	if not entry [0] in handlers:
-		raise RuntimeError ("unexpected type '%s'" % str (entry[0]))
-	
-	return handlers [entry [0]] (entry)
+  handlers = {
+    'struct':      handle_struct,
+    'scalar':      handle_scalar,
+    'enum':        handle_enum,
+    'flags':       handle_flags,
+    'ptr':         handle_ptr,
+    'blob':        handle_blob,
+    'array':       handle_array,
+    'byte-array':  handle_byte_array,
+  }
+
+  if not entry[0] in handlers:
+    raise RuntimeError ("unexpected type '%s'" % str (entry[0]))
+
+  return handlers[entry[0]](entry)
+
+if len(sys.argv) <= 1 or sys.argv[1] == '-':
+  import StringIO
+  Input = StringIO.StringIO(sys.stdin.read())
+else:
+  Input = open (sys.argv[1], "rb")
 
-Input = open (sys.argv [1], "rb")
 try:
-	handle_element (file)
+  handle_element(file)
 finally:
-	Input.close ()
-	Input = None
+  Input.close()
+  Input = None

Modified: llvm/branches/wendling/eh/test/Scripts/coff-dump.py.bat
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Scripts/coff-dump.py.bat?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Scripts/coff-dump.py.bat (original)
+++ llvm/branches/wendling/eh/test/Scripts/coff-dump.py.bat Tue Oct 26 19:48:03 2010
@@ -1,4 +1,7 @@
 @echo off
 
-%PYTHON_EXECUTABLE% %LLVM_SRC_ROOT%\test\Scripts\coff-dump.py %1 %2 %3 %4 %5 %6 %7 %8 %9
+ at rem We need to set -u to treat stdin as binary. Python 3 has support for doing
+ at rem this in code, but I haven't found a way to do this in 2.6 yet.
+
+%PYTHON_EXECUTABLE% -u %LLVM_SRC_ROOT%\test\Scripts\coff-dump.py %1 %2 %3 %4 %5 %6 %7 %8 %9
 

Modified: llvm/branches/wendling/eh/test/Scripts/macho-dump
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Scripts/macho-dump?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Scripts/macho-dump (original)
+++ llvm/branches/wendling/eh/test/Scripts/macho-dump Tue Oct 26 19:48:03 2010
@@ -4,6 +4,8 @@
 import sys
 import StringIO
 
+import common_dump
+
 class Reader:
    def __init__(self, path):
       if path == '-':
@@ -267,7 +269,7 @@
 
    if opts.dumpSectionData:
       f.seek(offset)
-      print "  ('_section_data', %r)" % f.read(size)
+      print "  ('_section_data', '%s')" % common_dump.dataToHex(f.read(size))
       
    f.seek(prev_pos)
    

Removed: llvm/branches/wendling/eh/test/TableGen/DagDefSubst.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/TableGen/DagDefSubst.td?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/test/TableGen/DagDefSubst.td (original)
+++ llvm/branches/wendling/eh/test/TableGen/DagDefSubst.td (removed)
@@ -1,16 +0,0 @@
-// RUN: tblgen %s | grep {dag d = (X Y)}
-// RUN: tblgen %s | grep {dag e = (Y X)}
-// XFAIL: vg_leak
-def X;
-
-class yclass;
-def Y : yclass;
-
-class C<yclass N> {
-  dag d = (X N);
-  dag e = (N X);
-}
-
-def VAL : C<Y>;
-
-

Removed: llvm/branches/wendling/eh/test/TableGen/DagIntSubst.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/TableGen/DagIntSubst.td?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/test/TableGen/DagIntSubst.td (original)
+++ llvm/branches/wendling/eh/test/TableGen/DagIntSubst.td (removed)
@@ -1,11 +0,0 @@
-// RUN: tblgen %s | grep {dag d = (X 13)}
-// XFAIL: vg_leak
-def X;
-
-class C<int N> {
-  dag d = (X N);
-}
-
-def VAL : C<13>;
-
-

Modified: llvm/branches/wendling/eh/test/TableGen/defmclass.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/TableGen/defmclass.td?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/TableGen/defmclass.td (original)
+++ llvm/branches/wendling/eh/test/TableGen/defmclass.td Tue Oct 26 19:48:03 2010
@@ -36,3 +36,15 @@
 
 // CHECK: int check = 0;
 defm Instr : Y, VEX;
+
+
+// Anonymous defm.
+
+multiclass SomeAnonymous<int x> {
+  def rm;
+  def mr;
+}
+
+// These multiclasses shouldn't conflict.
+defm : SomeAnonymous<1>;
+defm : SomeAnonymous<2>;
\ No newline at end of file

Removed: llvm/branches/wendling/eh/test/TableGen/nameconcat.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/TableGen/nameconcat.td?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/test/TableGen/nameconcat.td (original)
+++ llvm/branches/wendling/eh/test/TableGen/nameconcat.td (removed)
@@ -1,91 +0,0 @@
-// RUN: tblgen %s | grep {add_ps} | count 3
-// XFAIL: vg_leak
-
-class ValueType<int size, int value> {
-  int Size = size;
-  int Value = value;
-}
-
-def v2i64  : ValueType<128, 22>;   //  2 x i64 vector value
-def v2f64  : ValueType<128, 28>;   //  2 x f64 vector value
-
-class Intrinsic<string name> {
-  string Name = name;
-}
-
-class Inst<bits<8> opcode, dag oopnds, dag iopnds, string asmstr, 
-           list<dag> pattern> {
-  bits<8> Opcode = opcode;
-  dag OutOperands = oopnds;
-  dag InOperands = iopnds;
-  string AssemblyString = asmstr;
-  list<dag> Pattern = pattern;
-}
-
-def ops;
-def outs;
-def ins;
-
-def set;
-
-// Define registers
-class Register<string n> {
-  string Name = n;
-}
-
-class RegisterClass<list<ValueType> regTypes, list<Register> regList> {
-  list<ValueType> RegTypes = regTypes;
-  list<Register> MemberList = regList;
-}
-
-def XMM0: Register<"xmm0">;
-def XMM1: Register<"xmm1">;
-def XMM2: Register<"xmm2">;
-def XMM3: Register<"xmm3">;
-def XMM4: Register<"xmm4">;
-def XMM5: Register<"xmm5">;
-def XMM6: Register<"xmm6">;
-def XMM7: Register<"xmm7">;
-def XMM8:  Register<"xmm8">;
-def XMM9:  Register<"xmm9">;
-def XMM10: Register<"xmm10">;
-def XMM11: Register<"xmm11">;
-def XMM12: Register<"xmm12">;
-def XMM13: Register<"xmm13">;
-def XMM14: Register<"xmm14">;
-def XMM15: Register<"xmm15">;
-
-def VR128 : RegisterClass<[v2i64, v2f64],
-                          [XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7,
-                           XMM8, XMM9, XMM10, XMM11,
-                           XMM12, XMM13, XMM14, XMM15]>;
-
-// Define intrinsics
-def int_x86_sse2_add_ps : Intrinsic<"addps">;
-def int_x86_sse2_add_pd : Intrinsic<"addpd">;
-
-multiclass arith<bits<8> opcode, string asmstr, string Intr> {
-  def PS : Inst<opcode, (outs VR128:$dst), (ins VR128:$src1, VR128:$src2),
-                 !strconcat(asmstr, "\t$dst, $src1, $src2"),
-                 [(set VR128:$dst, (!nameconcat<Intrinsic>(Intr, "_ps") VR128:$src1, VR128:$src2))]>;
-
-  def PD : Inst<opcode, (outs VR128:$dst), (ins VR128:$src1, VR128:$src2),
-                 !strconcat(asmstr, "\t$dst, $src1, $src2"),
-                 [(set VR128:$dst, (!nameconcat<Intrinsic>(Intr, "_pd") VR128:$src1, VR128:$src2))]>;
-}
-
-defm ADD : arith<0x58, "add", "int_x86_sse2_add">;
-
-class IntInst<bits<8> opcode, string asmstr, Intrinsic Intr> :
-  Inst<opcode,(outs VR128:$dst), (ins VR128:$src1, VR128:$src2),
-       !strconcat(asmstr, "\t$dst, $src1, $src2"),
-       [(set VR128:$dst, (Intr VR128:$src1, VR128:$src2))]>;
-
-
-multiclass arith_int<bits<8> opcode, string asmstr, string Intr> {
-  def PS_Int : IntInst<opcode, asmstr, !nameconcat<Intrinsic>(Intr, "_ps")>;
-
-  def PD_Int : IntInst<opcode, asmstr, !nameconcat<Intrinsic>(Intr, "_pd")>;
-}
-
-defm ADD : arith_int<0x58, "add", "int_x86_sse2_add">;

Modified: llvm/branches/wendling/eh/test/TestRunner.sh
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/TestRunner.sh?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/TestRunner.sh (original)
+++ llvm/branches/wendling/eh/test/TestRunner.sh Tue Oct 26 19:48:03 2010
@@ -1,36 +1,5 @@
 #!/bin/sh
-#
-#  TestRunner.sh - This script is used to run the deja-gnu tests exactly like
-#  deja-gnu does, by executing the Tcl script specified in the test case's 
-#  RUN: lines. This is made possible by a simple make target supported by the
-#  test/Makefile. All this script does is invoke that make target. 
-#
-#  Usage:
-#     TestRunner.sh {script_names}
-#
-#     This script is typically used by cd'ing to a test directory and then
-#     running TestRunner.sh with a list of test file names you want to run.
-#
-TESTPATH=`pwd`
-SUBDIR=""
-if test `dirname $1` = "." ; then
-  while test `basename $TESTPATH` != "test" -a ! -z "$TESTPATH" ; do
-    tmp=`basename $TESTPATH`
-    SUBDIR="$tmp/$SUBDIR"
-    TESTPATH=`dirname $TESTPATH`
-  done
-fi
+# Deprecated, use 'llvm-lit'.
 
-for TESTFILE in "$@" ; do 
-  if test `dirname $TESTFILE` = . ; then
-    if test -d "$TESTPATH" ; then
-      cd $TESTPATH
-      make check-one TESTONE="$SUBDIR$TESTFILE"
-      cd $PWD
-    else
-      echo "Can't find llvm/test directory in " `pwd`
-    fi
-  else
-    make check-one TESTONE=$TESTFILE
-  fi
-done
+echo "warning: '$0' is deprecated, use 'llvm-lit' instead."
+exec llvm-lit "$@"

Modified: llvm/branches/wendling/eh/test/Transforms/ArgumentPromotion/basictest.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/ArgumentPromotion/basictest.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/ArgumentPromotion/basictest.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/ArgumentPromotion/basictest.ll Tue Oct 26 19:48:03 2010
@@ -1,4 +1,4 @@
-; RUN: opt < %s -argpromotion -mem2reg -S | not grep alloca
+; RUN: opt < %s -basicaa -argpromotion -mem2reg -S | not grep alloca
 target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
 define internal i32 @test(i32* %X, i32* %Y) {
         %A = load i32* %X               ; <i32> [#uses=1]

Modified: llvm/branches/wendling/eh/test/Transforms/ConstProp/constant-expr.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/ConstProp/constant-expr.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/ConstProp/constant-expr.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/ConstProp/constant-expr.ll Tue Oct 26 19:48:03 2010
@@ -16,9 +16,9 @@
 @E = global i1 udiv (i1 icmp ult (i8* @X, i8* @Y), i1 icmp ult (i8* @X, i8* @Z))
 ; CHECK: @E = global i1 icmp ult (i8* @X, i8* @Y)
 @F = global i1 srem (i1 icmp ult (i8* @X, i8* @Y), i1 icmp ult (i8* @X, i8* @Z))
-; CHECK: @F = global i1 false ; <i1*> [#uses=0]
+; CHECK: @F = global i1 false 
 @G = global i1 urem (i1 icmp ult (i8* @X, i8* @Y), i1 icmp ult (i8* @X, i8* @Z))
-; CHECK: @G = global i1 false ; <i1*> [#uses=0]
+; CHECK: @G = global i1 false 
 
 @H = global i1 icmp ule (i32* bitcast (i8* @X to i32*), i32* bitcast (i8* @Y to i32*))
 ; CHECK: @H = global i1 icmp ule (i8* @X, i8* @Y)

Modified: llvm/branches/wendling/eh/test/Transforms/ConstProp/overflow-ops.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/ConstProp/overflow-ops.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/ConstProp/overflow-ops.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/ConstProp/overflow-ops.ll Tue Oct 26 19:48:03 2010
@@ -170,3 +170,14 @@
 
 declare {i8, i1} @llvm.sadd.with.overflow.i8(i8, i8)
 declare {i8, i1} @llvm.ssub.with.overflow.i8(i8, i8)
+declare {i8, i1} @llvm.smul.with.overflow.i8(i8, i8)
+
+; rdar://8501501
+define {i8, i1} @smul_1() nounwind {
+entry:
+  %t = call {i8, i1} @llvm.smul.with.overflow.i8(i8 -20, i8 -10)
+  ret {i8, i1} %t
+
+; CHECK: @smul_1
+; CHECK: ret %i8i1 { i8 -56, i1 true }
+}

Modified: llvm/branches/wendling/eh/test/Transforms/ConstantMerge/dont-merge.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/ConstantMerge/dont-merge.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/ConstantMerge/dont-merge.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/ConstantMerge/dont-merge.ll Tue Oct 26 19:48:03 2010
@@ -28,3 +28,17 @@
         store i32 addrspace(30)*  @T2b, i32 addrspace(30)** %P2
         ret void
 }
+
+; PR8144 - Don't merge globals marked attribute(used)
+; CHECK: @T3A = 
+; CHECK: @T3B = 
+
+ at T3A = internal constant i32 0
+ at T3B = internal constant i32 0
+ at llvm.used = appending global [2 x i32*] [i32* @T3A, i32* @T3B], section
+"llvm.metadata"
+
+define void @test3() {
+  call void asm sideeffect "T3A, T3B",""() ; invisible use of T3A and T3B
+  ret void
+}

Modified: llvm/branches/wendling/eh/test/Transforms/DeadStoreElimination/2008-07-28-load-store.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/DeadStoreElimination/2008-07-28-load-store.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/DeadStoreElimination/2008-07-28-load-store.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/DeadStoreElimination/2008-07-28-load-store.ll Tue Oct 26 19:48:03 2010
@@ -1,4 +1,4 @@
-; RUN: opt < %s -dse -S | not grep tmp5
+; RUN: opt < %s -basicaa -dse -S | not grep tmp5
 ; PR2599
 target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
 

Modified: llvm/branches/wendling/eh/test/Transforms/DeadStoreElimination/PartialStore.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/DeadStoreElimination/PartialStore.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/DeadStoreElimination/PartialStore.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/DeadStoreElimination/PartialStore.ll Tue Oct 26 19:48:03 2010
@@ -1,4 +1,4 @@
-; RUN: opt < %s -dse -S | \
+; RUN: opt < %s -basicaa -dse -S | \
 ; RUN:    not grep {store i8}
 ; Ensure that the dead store is deleted in this case.  It is wholely
 ; overwritten by the second store.

Modified: llvm/branches/wendling/eh/test/Transforms/DeadStoreElimination/const-pointers.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/DeadStoreElimination/const-pointers.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/DeadStoreElimination/const-pointers.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/DeadStoreElimination/const-pointers.ll Tue Oct 26 19:48:03 2010
@@ -1,4 +1,4 @@
-; RUN: opt %s -dse -S | FileCheck %s
+; RUN: opt %s -basicaa -dse -S | FileCheck %s
 
 %t = type { i32 }
 

Modified: llvm/branches/wendling/eh/test/Transforms/DeadStoreElimination/context-sensitive.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/DeadStoreElimination/context-sensitive.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/DeadStoreElimination/context-sensitive.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/DeadStoreElimination/context-sensitive.ll Tue Oct 26 19:48:03 2010
@@ -1,4 +1,4 @@
-; RUN: opt < %s -dse -S | not grep DEAD
+; RUN: opt < %s -basicaa -dse -S | not grep DEAD
 target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
 
 declare void @ext()

Modified: llvm/branches/wendling/eh/test/Transforms/DeadStoreElimination/free.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/DeadStoreElimination/free.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/DeadStoreElimination/free.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/DeadStoreElimination/free.ll Tue Oct 26 19:48:03 2010
@@ -1,4 +1,4 @@
-; RUN: opt < %s -dse -S | not grep DEAD
+; RUN: opt < %s -basicaa -dse -S | not grep DEAD
 
 define void @test(i32* %Q, i32* %P) {
         %DEAD = load i32* %Q            ; <i32> [#uses=1]

Modified: llvm/branches/wendling/eh/test/Transforms/DeadStoreElimination/lifetime.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/DeadStoreElimination/lifetime.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/DeadStoreElimination/lifetime.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/DeadStoreElimination/lifetime.ll Tue Oct 26 19:48:03 2010
@@ -1,4 +1,4 @@
-; RUN: opt -S -dse < %s | FileCheck %s
+; RUN: opt -S -basicaa -dse < %s | FileCheck %s
 
 target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
 

Modified: llvm/branches/wendling/eh/test/Transforms/DeadStoreElimination/no-targetdata.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/DeadStoreElimination/no-targetdata.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/DeadStoreElimination/no-targetdata.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/DeadStoreElimination/no-targetdata.ll Tue Oct 26 19:48:03 2010
@@ -1,4 +1,4 @@
-; RUN: opt %s -dse -S | FileCheck %s
+; RUN: opt %s -basicaa -dse -S | FileCheck %s
 
 declare void @test1f()
 

Modified: llvm/branches/wendling/eh/test/Transforms/DeadStoreElimination/simple.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/DeadStoreElimination/simple.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/DeadStoreElimination/simple.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/DeadStoreElimination/simple.ll Tue Oct 26 19:48:03 2010
@@ -1,4 +1,4 @@
-; RUN: opt < %s -dse -S | not grep DEAD
+; RUN: opt < %s -basicaa -dse -S | not grep DEAD
 target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
 
 define void @test(i32* %Q, i32* %P) {

Modified: llvm/branches/wendling/eh/test/Transforms/GVN/2007-07-25-InfiniteLoop.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/GVN/2007-07-25-InfiniteLoop.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/GVN/2007-07-25-InfiniteLoop.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/GVN/2007-07-25-InfiniteLoop.ll Tue Oct 26 19:48:03 2010
@@ -1,4 +1,4 @@
-; RUN: opt < %s -gvn -S | not grep {tmp10 =}
+; RUN: opt < %s -basicaa -gvn -S | not grep {tmp10 =}
 
 	%struct.INT2 = type { i32, i32 }
 @blkshifts = external global %struct.INT2*		; <%struct.INT2**> [#uses=2]

Modified: llvm/branches/wendling/eh/test/Transforms/GVN/2007-07-26-InterlockingLoops.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/GVN/2007-07-26-InterlockingLoops.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/GVN/2007-07-26-InterlockingLoops.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/GVN/2007-07-26-InterlockingLoops.ll Tue Oct 26 19:48:03 2010
@@ -1,5 +1,5 @@
-; RUN: opt < %s -gvn -S | grep {tmp17625.* = phi i32. }
-; RUN: opt < %s -gvn -S | grep {tmp17631.* = phi i32. }
+; RUN: opt < %s -basicaa -gvn -S | grep {tmp17625.* = phi i32. }
+; RUN: opt < %s -basicaa -gvn -S | grep {tmp17631.* = phi i32. }
 
 @last = external global [65 x i32*]		; <[65 x i32*]*> [#uses=1]
 

Modified: llvm/branches/wendling/eh/test/Transforms/GVN/2007-07-31-NoDomInherit.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/GVN/2007-07-31-NoDomInherit.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/GVN/2007-07-31-NoDomInherit.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/GVN/2007-07-31-NoDomInherit.ll Tue Oct 26 19:48:03 2010
@@ -1,4 +1,4 @@
-; RUN: opt < %s -gvn -S | grep {tmp47 = phi i32 }
+; RUN: opt < %s -basicaa -gvn -S | grep {tmp47 = phi i32 }
 
 	%struct.anon = type { i32 (i32, i32, i32)*, i32, i32, [3 x i32], i8*, i8*, i8* }
 @debug = external constant i32		; <i32*> [#uses=0]

Modified: llvm/branches/wendling/eh/test/Transforms/GVN/2007-07-31-RedundantPhi.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/GVN/2007-07-31-RedundantPhi.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/GVN/2007-07-31-RedundantPhi.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/GVN/2007-07-31-RedundantPhi.ll Tue Oct 26 19:48:03 2010
@@ -1,4 +1,4 @@
-; RUN: opt < %s -gvn -S | not grep {tmp701 =}
+; RUN: opt < %s -basicaa -gvn -S | not grep {tmp701 =}
 
 @img_width = external global i16		; <i16*> [#uses=2]
 

Modified: llvm/branches/wendling/eh/test/Transforms/GVN/2008-07-02-Unreachable.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/GVN/2008-07-02-Unreachable.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/GVN/2008-07-02-Unreachable.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/GVN/2008-07-02-Unreachable.ll Tue Oct 26 19:48:03 2010
@@ -1,4 +1,4 @@
-; RUN: opt < %s -gvn -S | grep {ret i8 \[%\]tmp3}
+; RUN: opt < %s -basicaa -gvn -S | grep {ret i8 \[%\]tmp3}
 ; PR2503
 
 @g_3 = external global i8		; <i8*> [#uses=2]

Modified: llvm/branches/wendling/eh/test/Transforms/GVN/2009-07-13-MemDepSortFail.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/GVN/2009-07-13-MemDepSortFail.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/GVN/2009-07-13-MemDepSortFail.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/GVN/2009-07-13-MemDepSortFail.ll Tue Oct 26 19:48:03 2010
@@ -1,7 +1,7 @@
 ; RUN: opt < %s -gvn | llvm-dis
 ; PR4256
 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
-target triple = "i386-linux-gnu"
+target triple = "i386-pc-linux-gnu"
 	%llvm.dbg.anchor.type = type { i32, i32 }
 	%struct.cset = type { i8*, i8, i8, i32, i8* }
 	%struct.lmat = type { %struct.re_guts*, i32, %llvm.dbg.anchor.type*, i8*, i8*, i8*, i8*, i8**, i32, i8*, i8*, i8*, i8*, i8* }

Modified: llvm/branches/wendling/eh/test/Transforms/GVN/2010-03-31-RedundantPHIs.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/GVN/2010-03-31-RedundantPHIs.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/GVN/2010-03-31-RedundantPHIs.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/GVN/2010-03-31-RedundantPHIs.ll Tue Oct 26 19:48:03 2010
@@ -1,4 +1,4 @@
-; RUN: opt < %s -gvn -enable-full-load-pre -S | FileCheck %s
+; RUN: opt < %s -basicaa -gvn -S | FileCheck %s
 
 define i8* @cat(i8* %s1, ...) nounwind {
 entry:

Modified: llvm/branches/wendling/eh/test/Transforms/GVN/calls-nonlocal.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/GVN/calls-nonlocal.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/GVN/calls-nonlocal.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/GVN/calls-nonlocal.ll Tue Oct 26 19:48:03 2010
@@ -1,4 +1,4 @@
-; RUN: opt < %s -gvn -S | grep strlen | count 2
+; RUN: opt < %s -basicaa -gvn -S | grep strlen | count 2
 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
 target triple = "i386-apple-darwin9"
 

Modified: llvm/branches/wendling/eh/test/Transforms/GVN/condprop.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/GVN/condprop.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/GVN/condprop.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/GVN/condprop.ll Tue Oct 26 19:48:03 2010
@@ -1,4 +1,4 @@
-; RUN: opt < %s -gvn -S | grep {br i1 false}
+; RUN: opt < %s -basicaa -gvn -S | grep {br i1 false}
 
 @a = external global i32		; <i32*> [#uses=7]
 

Modified: llvm/branches/wendling/eh/test/Transforms/GVN/invariant-simple.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/GVN/invariant-simple.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/GVN/invariant-simple.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/GVN/invariant-simple.ll Tue Oct 26 19:48:03 2010
@@ -1,4 +1,4 @@
-; RUN: opt < %s -gvn -S | FileCheck %s
+; RUN: opt < %s -basicaa -gvn -S | FileCheck %s
 
 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
 target triple = "i386-apple-darwin7"

Modified: llvm/branches/wendling/eh/test/Transforms/GVN/lifetime-simple.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/GVN/lifetime-simple.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/GVN/lifetime-simple.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/GVN/lifetime-simple.ll Tue Oct 26 19:48:03 2010
@@ -1,4 +1,4 @@
-; RUN: opt < %s -gvn -S | FileCheck %s
+; RUN: opt < %s -basicaa -gvn -S | FileCheck %s
 
 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
 target triple = "i386-apple-darwin7"

Modified: llvm/branches/wendling/eh/test/Transforms/GVN/load-constant-mem.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/GVN/load-constant-mem.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/GVN/load-constant-mem.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/GVN/load-constant-mem.ll Tue Oct 26 19:48:03 2010
@@ -1,4 +1,4 @@
-; RUN: opt < %s -gvn -instcombine -S | grep {ret i32 0}
+; RUN: opt < %s -basicaa -gvn -instcombine -S | grep {ret i32 0}
 ; PR4189
 @G = external constant [4 x i32]
 

Modified: llvm/branches/wendling/eh/test/Transforms/GVN/lpre-call-wrap-2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/GVN/lpre-call-wrap-2.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/GVN/lpre-call-wrap-2.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/GVN/lpre-call-wrap-2.ll Tue Oct 26 19:48:03 2010
@@ -1,4 +1,4 @@
-; RUN: opt -S -gvn -enable-load-pre %s | FileCheck %s
+; RUN: opt -S -basicaa -gvn -enable-load-pre %s | FileCheck %s
 ;
 ; The partially redundant load in bb1 should be hoisted to "bb".  This comes
 ; from this C code (GCC PR 23455):

Modified: llvm/branches/wendling/eh/test/Transforms/GVN/mixed.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/GVN/mixed.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/GVN/mixed.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/GVN/mixed.ll Tue Oct 26 19:48:03 2010
@@ -1,5 +1,5 @@
-; RUN: opt < %s -gvn -S | not grep DEADLOAD
-; RUN: opt < %s -gvn -S | not grep DEADGEP
+; RUN: opt < %s -basicaa -gvn -S | not grep DEADLOAD
+; RUN: opt < %s -basicaa -gvn -S | not grep DEADGEP
 
 define i32 @main(i32** %p) {
 block1:

Modified: llvm/branches/wendling/eh/test/Transforms/GVN/nonescaping-malloc.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/GVN/nonescaping-malloc.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/GVN/nonescaping-malloc.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/GVN/nonescaping-malloc.ll Tue Oct 26 19:48:03 2010
@@ -1,4 +1,4 @@
-; RUN: opt < %s -gvn -stats -disable-output |& grep {Number of loads deleted}
+; RUN: opt < %s -basicaa -gvn -stats -disable-output |& grep {Number of loads deleted}
 ; rdar://7363102
 
 ; GVN should be able to eliminate load %tmp22.i, because it is redundant with

Modified: llvm/branches/wendling/eh/test/Transforms/GVN/null-aliases-nothing.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/GVN/null-aliases-nothing.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/GVN/null-aliases-nothing.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/GVN/null-aliases-nothing.ll Tue Oct 26 19:48:03 2010
@@ -1,4 +1,4 @@
-; RUN: opt %s -gvn -S | FileCheck %s
+; RUN: opt %s -basicaa -gvn -S | FileCheck %s
 
 %t = type { i32 }
 declare void @test1f(i8*)

Modified: llvm/branches/wendling/eh/test/Transforms/GVN/pre-load.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/GVN/pre-load.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/GVN/pre-load.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/GVN/pre-load.ll Tue Oct 26 19:48:03 2010
@@ -1,4 +1,4 @@
-; RUN: opt < %s -gvn -enable-load-pre -S | FileCheck %s
+; RUN: opt < %s -basicaa -gvn -enable-load-pre -S | FileCheck %s
 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
 
 define i32 @test1(i32* %p, i1 %C) {

Modified: llvm/branches/wendling/eh/test/Transforms/GVN/pre-single-pred.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/GVN/pre-single-pred.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/GVN/pre-single-pred.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/GVN/pre-single-pred.ll Tue Oct 26 19:48:03 2010
@@ -1,4 +1,13 @@
-; RUN: opt < %s -gvn -enable-load-pre -S | not grep {tmp3 = load}
+; RUN: opt < %s -gvn -enable-load-pre -S | FileCheck %s
+; This testcase assumed we'll PRE the load into %for.cond, but we don't actually
+; verify that doing so is safe.  If there didn't _happen_ to be a load in
+; %for.end, we would actually be lengthening the execution on some paths, and
+; we were never actually checking that case.  Now we actually do perform some
+; conservative checking to make sure we don't make paths longer, but we don't
+; currently get this case, which we got lucky on previously.
+;
+; Now that that faulty assumption is corrected, test that we DON'T incorrectly
+; hoist the load.  Doing the right thing for the wrong reasons is still a bug.
 
 @p = external global i32
 define i32 @f(i32 %n) nounwind {
@@ -13,6 +22,8 @@
 for.cond.for.end_crit_edge:		; preds = %for.cond
 	br label %for.end
 
+; CHECK: for.body:
+; CHECK-NEXT: %tmp3 = load i32* @p
 for.body:		; preds = %for.cond
 	%tmp3 = load i32* @p		; <i32> [#uses=1]
 	%dec = add i32 %tmp3, -1		; <i32> [#uses=2]
@@ -20,6 +31,7 @@
 	%cmp6 = icmp slt i32 %dec, 0		; <i1> [#uses=1]
 	br i1 %cmp6, label %for.body.for.end_crit_edge, label %for.inc
 
+; CHECK: for.body.for.end_crit_edge:
 for.body.for.end_crit_edge:		; preds = %for.body
 	br label %for.end
 

Modified: llvm/branches/wendling/eh/test/Transforms/GVN/rle-must-alias.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/GVN/rle-must-alias.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/GVN/rle-must-alias.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/GVN/rle-must-alias.ll Tue Oct 26 19:48:03 2010
@@ -1,4 +1,4 @@
-; RUN: opt < %s -gvn -S | grep {DEAD = phi i32 }
+; RUN: opt < %s -basicaa -gvn -S | grep {DEAD = phi i32 }
 
 ; GVN should eliminate the fully redundant %9 GEP which 
 ; allows DEAD to be removed.  This is PR3198.

Modified: llvm/branches/wendling/eh/test/Transforms/GVN/rle-nonlocal.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/GVN/rle-nonlocal.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/GVN/rle-nonlocal.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/GVN/rle-nonlocal.ll Tue Oct 26 19:48:03 2010
@@ -1,4 +1,4 @@
-; RUN: opt < %s -gvn -S | FileCheck %s
+; RUN: opt < %s -basicaa -gvn -S | FileCheck %s
 
 define i32 @main(i32** %p) {
 block1:

Modified: llvm/branches/wendling/eh/test/Transforms/GVN/rle-semidominated.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/GVN/rle-semidominated.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/GVN/rle-semidominated.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/GVN/rle-semidominated.ll Tue Oct 26 19:48:03 2010
@@ -1,4 +1,4 @@
-; RUN: opt < %s -gvn -S | grep {DEAD = phi i32 }
+; RUN: opt < %s -basicaa -gvn -S | grep {DEAD = phi i32 }
 
 define i32 @main(i32* %p) {
 block1:

Modified: llvm/branches/wendling/eh/test/Transforms/GVN/rle.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/GVN/rle.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/GVN/rle.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/GVN/rle.ll Tue Oct 26 19:48:03 2010
@@ -1,4 +1,4 @@
-; RUN: opt < %s -gvn -S | FileCheck %s
+; RUN: opt < %s -basicaa -gvn -S | FileCheck %s
 
 ; 32-bit little endian target.
 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"

Modified: llvm/branches/wendling/eh/test/Transforms/GlobalOpt/2008-07-17-addrspace.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/GlobalOpt/2008-07-17-addrspace.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/GlobalOpt/2008-07-17-addrspace.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/GlobalOpt/2008-07-17-addrspace.ll Tue Oct 26 19:48:03 2010
@@ -4,7 +4,7 @@
 
 ; RUN: opt < %s -globalopt -S > %t
 ; Check that the new global values still have their address space
-; RUN: cat %t | grep global.*addrspace
+; RUN: cat %t | grep addrspace.*global
 
 @struct = internal addrspace(1) global { i32, i32 } zeroinitializer
 @array = internal addrspace(1) global [ 2 x i32 ] zeroinitializer 

Modified: llvm/branches/wendling/eh/test/Transforms/GlobalOpt/crash.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/GlobalOpt/crash.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/GlobalOpt/crash.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/GlobalOpt/crash.ll Tue Oct 26 19:48:03 2010
@@ -40,3 +40,18 @@
 }
 
 declare noalias i8* @malloc(i64) nounwind
+
+
+; PR8063
+ at permute_bitrev.bitrev = internal global i32* null, align 8
+define void @permute_bitrev() nounwind {
+entry:
+  %tmp = load i32** @permute_bitrev.bitrev, align 8
+  %conv = sext i32 0 to i64
+  %mul = mul i64 %conv, 4
+  %call = call i8* @malloc(i64 %mul)
+  %0 = bitcast i8* %call to i32*
+  store i32* %0, i32** @permute_bitrev.bitrev, align 8
+  ret void
+}
+

Modified: llvm/branches/wendling/eh/test/Transforms/GlobalOpt/ctor-list-opt.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/GlobalOpt/ctor-list-opt.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/GlobalOpt/ctor-list-opt.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/GlobalOpt/ctor-list-opt.ll Tue Oct 26 19:48:03 2010
@@ -74,7 +74,7 @@
 declare double @cos(double)
 
 define internal void @CTOR8() {
-	%X = call double @cos( double 1.000000e+00 )		; <double> [#uses=1]
+	%X = call double @cos( double 0.000000e+00 )		; <double> [#uses=1]
 	store double %X, double* @D
 	ret void
 }

Modified: llvm/branches/wendling/eh/test/Transforms/IPConstantProp/2009-09-24-byval-ptr.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/IPConstantProp/2009-09-24-byval-ptr.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/IPConstantProp/2009-09-24-byval-ptr.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/IPConstantProp/2009-09-24-byval-ptr.ll Tue Oct 26 19:48:03 2010
@@ -21,10 +21,10 @@
 entry:
   %0 = getelementptr %struct.MYstr* %u, i32 0, i32 1 ; <i32*> [#uses=1]
   %1 = load i32* %0
-; CHECK: load i32* getelementptr inbounds (%struct.MYstr* @mystr, i32 0, i32 1) ; <i32> [#uses=1]
+; CHECK: load i32* getelementptr inbounds (%struct.MYstr* @mystr, i32 0, i32 1)
   %2 = getelementptr %struct.MYstr* %u, i32 0, i32 0 ; <i8*> [#uses=1]
   %3 = load i8* %2
-; CHECK: load i8* getelementptr inbounds (%struct.MYstr* @mystr, i32 0, i32 0) ; <i8> [#uses=1]
+; CHECK: load i8* getelementptr inbounds (%struct.MYstr* @mystr, i32 0, i32 0)
   %4 = zext i8 %3 to i32
   %5 = add i32 %4, %1
   ret i32 %5

Removed: llvm/branches/wendling/eh/test/Transforms/IndVarSimplify/2003-12-10-IndVarDeadCode.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/IndVarSimplify/2003-12-10-IndVarDeadCode.ll?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/IndVarSimplify/2003-12-10-IndVarDeadCode.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/IndVarSimplify/2003-12-10-IndVarDeadCode.ll (removed)
@@ -1,25 +0,0 @@
-; The induction variable canonicalization pass shouldn't leave dead
-; instructions laying around!
-;
-; RUN: opt < %s -indvars -S | \
-; RUN:   not grep {#uses=0}
-
-define i32 @mul(i32 %x, i32 %y) {
-entry:
-        br label %tailrecurse
-
-tailrecurse:            ; preds = %endif, %entry
-        %accumulator.tr = phi i32 [ %x, %entry ], [ %tmp.9, %endif ]            ; <i32> [#uses=2]
-        %y.tr = phi i32 [ %y, %entry ], [ %tmp.8, %endif ]              ; <i32> [#uses=2]
-        %tmp.1 = icmp eq i32 %y.tr, 0           ; <i1> [#uses=1]
-        br i1 %tmp.1, label %return, label %endif
-
-endif:          ; preds = %tailrecurse
-        %tmp.8 = add i32 %y.tr, -1              ; <i32> [#uses=1]
-        %tmp.9 = add i32 %accumulator.tr, %x            ; <i32> [#uses=1]
-        br label %tailrecurse
-
-return:         ; preds = %tailrecurse
-        ret i32 %accumulator.tr
-}
-

Modified: llvm/branches/wendling/eh/test/Transforms/IndVarSimplify/2009-05-24-useafterfree.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/IndVarSimplify/2009-05-24-useafterfree.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/IndVarSimplify/2009-05-24-useafterfree.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/IndVarSimplify/2009-05-24-useafterfree.ll Tue Oct 26 19:48:03 2010
@@ -1,7 +1,7 @@
 ; RUN: opt < %s -indvars
 ; PR4258
 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
-target triple = "i386-linux-gnu"
+target triple = "i386-pc-linux-gnu"
 
 define void @0(i32*, i32*, i32, i32) nounwind {
 	br i1 false, label %bb.nph1.preheader, label %.outer._crit_edge

Removed: llvm/branches/wendling/eh/test/Transforms/IndVarSimplify/loop-invariant-step.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/IndVarSimplify/loop-invariant-step.ll?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/IndVarSimplify/loop-invariant-step.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/IndVarSimplify/loop-invariant-step.ll (removed)
@@ -1,33 +0,0 @@
-; RUN: opt < %s -loop-index-split -instcombine -indvars -disable-output
-; PR4455
-
-target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
-
-declare i8* @fast_memcpy(i8*, i8*, i64)
-
-define void @dvdsub_decode() nounwind {
-entry:		; preds = %bb1
-	br label %LoopA
-
-LoopA:		; preds = %LoopA, %entry
-	%x1.0.i17 = phi i32 [ %t0, %LoopA ], [ 0, %entry ]		; <i32> [#uses=2]
-	%t0 = add i32 %x1.0.i17, 1		; <i32> [#uses=1]
-	br i1 undef, label %LoopA, label %middle
-
-middle:		; preds = %LoopA
-	%t1 = sub i32 0, %x1.0.i17		; <i32> [#uses=1]
-	%t2 = add i32 %t1, 1		; <i32> [#uses=1]
-	br label %LoopB
-
-LoopB:		; preds = %LoopB, %bb.nph.i27
-	%y.029.i = phi i32 [ 0, %middle ], [ %t7, %LoopB ]		; <i32> [#uses=2]
-	%t3 = mul i32 %y.029.i, %t2		; <i32> [#uses=1]
-	%t4 = sext i32 %t3 to i64		; <i64> [#uses=1]
-	%t5 = getelementptr i8* null, i64 %t4		; <i8*> [#uses=1]
-	%t6 = call i8* @fast_memcpy(i8* %t5, i8* undef, i64 undef) nounwind		; <i8*> [#uses=0]
-	%t7 = add i32 %y.029.i, 1		; <i32> [#uses=1]
-	br i1 undef, label %LoopB, label %exit
-
-exit:
-	ret void
-}

Modified: llvm/branches/wendling/eh/test/Transforms/IndVarSimplify/loop_evaluate10.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/IndVarSimplify/loop_evaluate10.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/IndVarSimplify/loop_evaluate10.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/IndVarSimplify/loop_evaluate10.ll Tue Oct 26 19:48:03 2010
@@ -5,7 +5,7 @@
 ; exit is taken. Indvars should correctly compute the exit values.
 
 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
-target triple = "x86_64-linux-gnu"
+target triple = "x86_64-pc-linux-gnu"
 	%struct..0anon = type <{ i8, [3 x i8] }>
 
 define i32 @main() nounwind {

Modified: llvm/branches/wendling/eh/test/Transforms/Inline/devirtualize-3.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/Inline/devirtualize-3.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/Inline/devirtualize-3.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/Inline/devirtualize-3.ll Tue Oct 26 19:48:03 2010
@@ -1,4 +1,4 @@
-; RUN: opt -inline -S -scalarrepl -gvn -instcombine %s | FileCheck %s
+; RUN: opt -basicaa -inline -S -scalarrepl -gvn -instcombine %s | FileCheck %s
 ; PR5009
 
 ; CHECK: define i32 @main() 

Modified: llvm/branches/wendling/eh/test/Transforms/Inline/devirtualize.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/Inline/devirtualize.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/Inline/devirtualize.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/Inline/devirtualize.ll Tue Oct 26 19:48:03 2010
@@ -1,4 +1,4 @@
-; RUN: opt -S -inline -scalarrepl -instcombine -simplifycfg -instcombine -gvn -globaldce %s | FileCheck %s
+; RUN: opt -S -basicaa -inline -scalarrepl -instcombine -simplifycfg -instcombine -gvn -globaldce %s | FileCheck %s
 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
 target triple = "x86_64-apple-darwin10.0.0"
 

Modified: llvm/branches/wendling/eh/test/Transforms/Inline/gvn-inline-iteration.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/Inline/gvn-inline-iteration.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/Inline/gvn-inline-iteration.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/Inline/gvn-inline-iteration.ll Tue Oct 26 19:48:03 2010
@@ -1,4 +1,4 @@
-; RUN: opt -inline -gvn %s -S -max-cg-scc-iterations=1 | FileCheck %s
+; RUN: opt -basicaa -inline -gvn %s -S -max-cg-scc-iterations=1 | FileCheck %s
 ; rdar://6295824 and PR6724
 
 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"

Removed: llvm/branches/wendling/eh/test/Transforms/InstCombine/2010-07-19-sqrt.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/InstCombine/2010-07-19-sqrt.ll?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/InstCombine/2010-07-19-sqrt.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/InstCombine/2010-07-19-sqrt.ll (removed)
@@ -1,16 +0,0 @@
-; RUN: opt -S -instcombine %s | FileCheck %s
-
-define float @foo(float %x) nounwind readnone ssp {
-entry:
-; CHECK-NOT: fpext
-; CHECK-NOT: sqrt(
-; CHECK: sqrtf(
-; CHECK-NOT: fptrunc
-  %conv = fpext float %x to double                ; <double> [#uses=1]
-  %call = tail call double @sqrt(double %conv) nounwind ; <double> [#uses=1]
-  %conv1 = fptrunc double %call to float          ; <float> [#uses=1]
-; CHECK: ret float
-  ret float %conv1
-}
-
-declare double @sqrt(double) readnone

Modified: llvm/branches/wendling/eh/test/Transforms/InstCombine/align-addr.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/InstCombine/align-addr.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/InstCombine/align-addr.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/InstCombine/align-addr.ll Tue Oct 26 19:48:03 2010
@@ -1,10 +1,13 @@
-; RUN: opt < %s -instcombine -S | grep {align 16} | count 1
+; RUN: opt < %s -instcombine -S | FileCheck %s
 target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
 
 ; Instcombine should be able to prove vector alignment in the
 ; presence of a few mild address computation tricks.
 
-define void @foo(i8* %b, i64 %n, i64 %u, i64 %y) nounwind  {
+; CHECK: @test0(
+; CHECK: align 16
+
+define void @test0(i8* %b, i64 %n, i64 %u, i64 %y) nounwind  {
 entry:
   %c = ptrtoint i8* %b to i64
   %d = and i64 %c, -16
@@ -29,3 +32,29 @@
   ret void
 }
 
+; When we see a unaligned load from an insufficiently aligned global or
+; alloca, increase the alignment of the load, turning it into an aligned load.
+
+; CHECK: @test1(
+; CHECK: tmp = load
+; CHECK: GLOBAL{{.*}}align 16
+
+ at GLOBAL = internal global [4 x i32] zeroinitializer
+
+define <16 x i8> @test1(<2 x i64> %x) {
+entry:
+	%tmp = load <16 x i8>* bitcast ([4 x i32]* @GLOBAL to <16 x i8>*), align 1
+	ret <16 x i8> %tmp
+}
+
+; When a load or store lacks an explicit alignment, add one.
+
+; CHECK: @test2(
+; CHECK: load double* %p, align 8
+; CHECK: store double %n, double* %p, align 8
+
+define double @test2(double* %p, double %n) nounwind {
+  %t = load double* %p
+  store double %n, double* %p
+  ret double %t
+}

Removed: llvm/branches/wendling/eh/test/Transforms/InstCombine/align-inc.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/InstCombine/align-inc.ll?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/InstCombine/align-inc.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/InstCombine/align-inc.ll (removed)
@@ -1,12 +0,0 @@
-; RUN: opt < %s -instcombine -S | grep {GLOBAL.*align 16}
-; RUN: opt < %s -instcombine -S | grep {tmp = load}
-target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
-
- at GLOBAL = internal global [4 x i32] zeroinitializer
-
-define <16 x i8> @foo(<2 x i64> %x) {
-entry:
-	%tmp = load <16 x i8>* bitcast ([4 x i32]* @GLOBAL to <16 x i8>*), align 1
-	ret <16 x i8> %tmp
-}
-

Modified: llvm/branches/wendling/eh/test/Transforms/InstCombine/and2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/InstCombine/and2.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/InstCombine/and2.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/InstCombine/and2.ll Tue Oct 26 19:48:03 2010
@@ -8,3 +8,21 @@
         ret i1 %bothcond
 ; CHECK:  fcmp ord double %Y, %X
 }
+
+define i1 @test2(i1 %X, i1 %Y) {
+  %a = and i1 %X, %Y
+  %b = and i1 %a, %X
+  ret i1 %b
+; CHECK: @test2
+; CHECK-NEXT: and i1 %X, %Y
+; CHECK-NEXT: ret
+}
+
+define i32 @test3(i32 %X, i32 %Y) {
+  %a = and i32 %X, %Y
+  %b = and i32 %Y, %a
+  ret i32 %b
+; CHECK: @test3
+; CHECK-NEXT: and i32 %X, %Y
+; CHECK-NEXT: ret
+}

Removed: llvm/branches/wendling/eh/test/Transforms/InstCombine/bitcast-scalar-to-vector.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/InstCombine/bitcast-scalar-to-vector.ll?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/InstCombine/bitcast-scalar-to-vector.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/InstCombine/bitcast-scalar-to-vector.ll (removed)
@@ -1,14 +0,0 @@
-; RUN: opt < %s -instcombine -S | grep {ret i32 0}
-; PR4487
-
-; Bitcasts between vectors and scalars are valid, despite being ill-advised.
-
-define i32 @test(i64 %a) {
-bb20:
-        %t1 = bitcast i64 %a to <2 x i32>
-        %t2 = bitcast i64 %a to <2 x i32>
-        %t3 = xor <2 x i32> %t1, %t2
-        %t4 = extractelement <2 x i32> %t3, i32 0
-        ret i32 %t4
-}
-

Modified: llvm/branches/wendling/eh/test/Transforms/InstCombine/cast.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/InstCombine/cast.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/InstCombine/cast.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/InstCombine/cast.ll Tue Oct 26 19:48:03 2010
@@ -437,8 +437,8 @@
  ret i64 %E
 ; CHECK: @test47
 ; CHECK-NEXT:   %B = sext i8 %A to i64
-; CHECK-NEXT: %C = or i64 %B, 42
-; CHECK-NEXT:  %E = and i64 %C, 4294967295
+; CHECK-NEXT: %C = and i64 %B, 4294967253
+; CHECK-NEXT:  %E = or i64 %C, 42
 ; CHECK-NEXT:  ret i64 %E
 }
 
@@ -508,8 +508,8 @@
   ret i32 %E
 ; CHECK: @test52
 ; CHECK-NEXT: %B = trunc i64 %A to i32
-; CHECK-NEXT: %C = or i32 %B, 32962
-; CHECK-NEXT: %D = and i32 %C, 40186
+; CHECK-NEXT: %C = and i32 %B, 7224
+; CHECK-NEXT: %D = or i32 %C, 32962
 ; CHECK-NEXT: ret i32 %D
 }
 
@@ -521,8 +521,8 @@
   ret i64 %E
 ; CHECK: @test53
 ; CHECK-NEXT: %B = zext i32 %A to i64
-; CHECK-NEXT: %C = or i64 %B, 32962
-; CHECK-NEXT: %D = and i64 %C, 40186
+; CHECK-NEXT: %C = and i64 %B, 7224
+; CHECK-NEXT: %D = or i64 %C, 32962
 ; CHECK-NEXT: ret i64 %D
 }
 
@@ -534,8 +534,8 @@
   ret i32 %E
 ; CHECK: @test54
 ; CHECK-NEXT: %B = trunc i64 %A to i32
-; CHECK-NEXT: %C = or i32 %B, -32574
-; CHECK-NEXT: %D = and i32 %C, -25350
+; CHECK-NEXT: %C = and i32 %B, 7224
+; CHECK-NEXT: %D = or i32 %C, -32574
 ; CHECK-NEXT: ret i32 %D
 }
 
@@ -547,8 +547,8 @@
   ret i64 %E
 ; CHECK: @test55
 ; CHECK-NEXT: %B = zext i32 %A to i64
-; CHECK-NEXT: %C = or i64 %B, -32574
-; CHECK-NEXT: %D = and i64 %C, -25350
+; CHECK-NEXT: %C = and i64 %B, 7224
+; CHECK-NEXT: %D = or i64 %C, -32574
 ; CHECK-NEXT: ret i64 %D
 }
 
@@ -584,8 +584,8 @@
  
 ; CHECK: @test58
 ; CHECK-NEXT:   %C = lshr i64 %A, 8
-; CHECK-NEXT:   %D = or i64 %C, 128
-; CHECK-NEXT:   %E = and i64 %D, 16777215
+; CHECK-NEXT:   %D = and i64 %C, 16777087
+; CHECK-NEXT:   %E = or i64 %D, 128
 ; CHECK-NEXT:   ret i64 %E
 }
 

Modified: llvm/branches/wendling/eh/test/Transforms/InstCombine/crash.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/InstCombine/crash.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/InstCombine/crash.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/InstCombine/crash.ll Tue Oct 26 19:48:03 2010
@@ -252,3 +252,36 @@
   %conv6 = zext i1 %cmp5 to i32                   ; <i32> [#uses=0]
   ret void
 }
+
+%s1 = type { %s2, %s2, [6 x %s2], i32, i32, i32, [1 x i32], [0 x i8] }
+%s2 = type { i64 }
+define void @test13() nounwind ssp {
+entry:
+  %0 = getelementptr inbounds %s1* null, i64 0, i32 2, i64 0, i32 0
+  %1 = bitcast i64* %0 to i32*
+  %2 = getelementptr inbounds %s1* null, i64 0, i32 2, i64 1, i32 0
+  %.pre = load i32* %1, align 8
+  %3 = lshr i32 %.pre, 19
+  %brmerge = or i1 undef, undef
+  %4 = and i32 %3, 3
+  %5 = add nsw i32 %4, 1
+  %6 = shl i32 %5, 19
+  %7 = add i32 %6, 1572864
+  %8 = and i32 %7, 1572864
+  %9 = load i64* %2, align 8
+  %trunc156 = trunc i64 %9 to i32
+  %10 = and i32 %trunc156, -1537
+  %11 = and i32 %10, -6145
+  %12 = or i32 %11, 2048
+  %13 = and i32 %12, -24577
+  %14 = or i32 %13, 16384
+  %15 = or i32 %14, 98304
+  store i32 %15, i32* undef, align 8
+  %16 = and i32 %15, -1572865
+  %17 = or i32 %16, %8
+  store i32 %17, i32* undef, align 8
+  %18 = and i32 %17, -449
+  %19 = or i32 %18, 64
+  store i32 %19, i32* undef, align 8
+  unreachable
+}

Modified: llvm/branches/wendling/eh/test/Transforms/InstCombine/intrinsics.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/InstCombine/intrinsics.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/InstCombine/intrinsics.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/InstCombine/intrinsics.ll Tue Oct 26 19:48:03 2010
@@ -10,16 +10,16 @@
 declare i32 @llvm.ctpop.i32(i32) nounwind readnone
 declare i8 @llvm.ctlz.i8(i8) nounwind readnone
 
-define i8 @test1(i8 %A, i8 %B) {
+define i8 @uaddtest1(i8 %A, i8 %B) {
   %x = call %overflow.result @llvm.uadd.with.overflow.i8(i8 %A, i8 %B)
   %y = extractvalue %overflow.result %x, 0
   ret i8 %y
-; CHECK: @test1
+; CHECK: @uaddtest1
 ; CHECK-NEXT: %y = add i8 %A, %B
 ; CHECK-NEXT: ret i8 %y
 }
 
-define i8 @test2(i8 %A, i8 %B, i1* %overflowPtr) {
+define i8 @uaddtest2(i8 %A, i8 %B, i1* %overflowPtr) {
   %and.A = and i8 %A, 127
   %and.B = and i8 %B, 127
   %x = call %overflow.result @llvm.uadd.with.overflow.i8(i8 %and.A, i8 %and.B)
@@ -27,7 +27,7 @@
   %z = extractvalue %overflow.result %x, 1
   store i1 %z, i1* %overflowPtr
   ret i8 %y
-; CHECK: @test2
+; CHECK: @uaddtest2
 ; CHECK-NEXT: %and.A = and i8 %A, 127
 ; CHECK-NEXT: %and.B = and i8 %B, 127
 ; CHECK-NEXT: %1 = add nuw i8 %and.A, %and.B
@@ -35,7 +35,7 @@
 ; CHECK-NEXT: ret i8 %1
 }
 
-define i8 @test3(i8 %A, i8 %B, i1* %overflowPtr) {
+define i8 @uaddtest3(i8 %A, i8 %B, i1* %overflowPtr) {
   %or.A = or i8 %A, -128
   %or.B = or i8 %B, -128
   %x = call %overflow.result @llvm.uadd.with.overflow.i8(i8 %or.A, i8 %or.B)
@@ -43,7 +43,7 @@
   %z = extractvalue %overflow.result %x, 1
   store i1 %z, i1* %overflowPtr
   ret i8 %y
-; CHECK: @test3
+; CHECK: @uaddtest3
 ; CHECK-NEXT: %or.A = or i8 %A, -128
 ; CHECK-NEXT: %or.B = or i8 %B, -128
 ; CHECK-NEXT: %1 = add i8 %or.A, %or.B
@@ -51,34 +51,44 @@
 ; CHECK-NEXT: ret i8 %1
 }
 
-define i8 @test4(i8 %A, i1* %overflowPtr) {
+define i8 @uaddtest4(i8 %A, i1* %overflowPtr) {
   %x = call %overflow.result @llvm.uadd.with.overflow.i8(i8 undef, i8 %A)
   %y = extractvalue %overflow.result %x, 0
   %z = extractvalue %overflow.result %x, 1
   store i1 %z, i1* %overflowPtr
   ret i8 %y
-; CHECK: @test4
+; CHECK: @uaddtest4
 ; CHECK-NEXT: ret i8 undef
 }
 
-define i8 @test5(i8 %A, i1* %overflowPtr) {
+define i8 @uaddtest5(i8 %A, i1* %overflowPtr) {
+  %x = call %overflow.result @llvm.uadd.with.overflow.i8(i8 0, i8 %A)
+  %y = extractvalue %overflow.result %x, 0
+  %z = extractvalue %overflow.result %x, 1
+  store i1 %z, i1* %overflowPtr
+  ret i8 %y
+; CHECK: @uaddtest5
+; CHECK: ret i8 %A
+}
+
+define i8 @umultest1(i8 %A, i1* %overflowPtr) {
   %x = call %overflow.result @llvm.umul.with.overflow.i8(i8 0, i8 %A)
   %y = extractvalue %overflow.result %x, 0
   %z = extractvalue %overflow.result %x, 1
   store i1 %z, i1* %overflowPtr
   ret i8 %y
-; CHECK: @test5
+; CHECK: @umultest1
 ; CHECK-NEXT: store i1 false, i1* %overflowPtr
 ; CHECK-NEXT: ret i8 0
 }
 
-define i8 @test6(i8 %A, i1* %overflowPtr) {
+define i8 @umultest2(i8 %A, i1* %overflowPtr) {
   %x = call %overflow.result @llvm.umul.with.overflow.i8(i8 1, i8 %A)
   %y = extractvalue %overflow.result %x, 0
   %z = extractvalue %overflow.result %x, 1
   store i1 %z, i1* %overflowPtr
   ret i8 %y
-; CHECK: @test6
+; CHECK: @umultest2
 ; CHECK-NEXT: store i1 false, i1* %overflowPtr
 ; CHECK-NEXT: ret i8 %A
 }

Modified: llvm/branches/wendling/eh/test/Transforms/InstCombine/memcpy.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/InstCombine/memcpy.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/InstCombine/memcpy.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/InstCombine/memcpy.ll Tue Oct 26 19:48:03 2010
@@ -1,10 +1,19 @@
 ; RUN: opt < %s -instcombine -S | FileCheck %s
 
-declare void @llvm.memcpy.i32(i8*, i8*, i32, i32)
+declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind
 
-define void @test4(i8* %a) {
-        tail call void @llvm.memcpy.i32( i8* %a, i8* %a, i32 100, i32 1 )
+define void @test1(i8* %a) {
+        tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* %a, i8* %a, i32 100, i32 1, i1 false)
         ret void
-}
-; CHECK: define void @test4
+; CHECK: define void @test1
 ; CHECK-NEXT: ret void
+}
+
+
+; PR8267
+define void @test2(i8* %a) {
+        tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* %a, i8* %a, i32 100, i32 1, i1 true)
+        ret void
+; CHECK: define void @test2
+; CHECK-NEXT: call void @llvm.memcpy
+}

Modified: llvm/branches/wendling/eh/test/Transforms/InstCombine/or.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/InstCombine/or.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/InstCombine/or.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/InstCombine/or.ll Tue Oct 26 19:48:03 2010
@@ -316,8 +316,8 @@
   %E = or i32 %D, %C
   ret i32 %E
 ; CHECK: @test30
-; CHECK: %B = or i32 %A, 32962
-; CHECK: %E = and i32 %B, -25350
+; CHECK: %D = and i32 %A, -58312
+; CHECK: %E = or i32 %D, 32962
 ; CHECK: ret i32 %E
 }
 
@@ -332,8 +332,8 @@
   %F = or i64 %D, %E
   ret i64 %F
 ; CHECK: @test31
-; CHECK-NEXT: %bitfield = or i64 %A, 32962
-; CHECK-NEXT: %F = and i64 %bitfield, 4294941946
+; CHECK-NEXT: %E1 = and i64 %A, 4294908984
+; CHECK-NEXT: %F = or i64 %E1, 32962
 ; CHECK-NEXT: ret i64 %F
 }
 
@@ -350,3 +350,29 @@
 ; CHECK: or <4 x i32> %and.i, %and.i129
 }
 
+define i1 @test33(i1 %X, i1 %Y) {
+  %a = or i1 %X, %Y
+  %b = or i1 %a, %X
+  ret i1 %b
+; CHECK: @test33
+; CHECK-NEXT: or i1 %X, %Y
+; CHECK-NEXT: ret
+}
+
+define i32 @test34(i32 %X, i32 %Y) {
+  %a = or i32 %X, %Y
+  %b = or i32 %Y, %a
+  ret i32 %b
+; CHECK: @test34
+; CHECK-NEXT: or i32 %X, %Y
+; CHECK-NEXT: ret
+}
+
+define i32 @test35(i32 %a, i32 %b) {
+  %1 = or i32 %a, 1135
+  %2 = or i32 %1, %b
+  ret i32 %2
+  ; CHECK: @test35
+  ; CHECK-NEXT: or i32 %a, %b
+  ; CHECK-NEXT: or i32 %1, 1135
+}

Modified: llvm/branches/wendling/eh/test/Transforms/InstCombine/phi.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/InstCombine/phi.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/InstCombine/phi.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/InstCombine/phi.ll Tue Oct 26 19:48:03 2010
@@ -402,3 +402,24 @@
   store i32 %tmp5, i32* %res
   br label %if.end
 }
+
+; PR4413
+declare i32 @ext()
+; CHECK: @test17
+define i32 @test17(i1 %a) {
+entry:
+    br i1 %a, label %bb1, label %bb2
+
+bb1:        ; preds = %entry
+    %0 = tail call i32 @ext()        ; <i32> [#uses=1]
+    br label %bb2
+
+bb2:        ; preds = %bb1, %entry
+    %cond = phi i1 [ true, %bb1 ], [ false, %entry ]        ; <i1> [#uses=1]
+; CHECK-NOT: %val = phi i32 [ %0, %bb1 ], [ 0, %entry ]
+    %val = phi i32 [ %0, %bb1 ], [ 0, %entry ]        ; <i32> [#uses=1]
+    %res = select i1 %cond, i32 %val, i32 0        ; <i32> [#uses=1]
+; CHECK: ret i32 %cond
+    ret i32 %res
+}
+

Removed: llvm/branches/wendling/eh/test/Transforms/InstCombine/shift-simplify.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/InstCombine/shift-simplify.ll?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/InstCombine/shift-simplify.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/InstCombine/shift-simplify.ll (removed)
@@ -1,42 +0,0 @@
-; RUN: opt < %s -instcombine -S | \
-; RUN:    egrep {shl|lshr|ashr} | count 3
-
-define i32 @test0(i32 %A, i32 %B, i32 %C) {
-	%X = shl i32 %A, %C
-	%Y = shl i32 %B, %C
-	%Z = and i32 %X, %Y
-	ret i32 %Z
-}
-
-define i32 @test1(i32 %A, i32 %B, i32 %C) {
-	%X = lshr i32 %A, %C
-	%Y = lshr i32 %B, %C
-	%Z = or i32 %X, %Y
-	ret i32 %Z
-}
-
-define i32 @test2(i32 %A, i32 %B, i32 %C) {
-	%X = ashr i32 %A, %C
-	%Y = ashr i32 %B, %C
-	%Z = xor i32 %X, %Y
-	ret i32 %Z
-}
-
-define i1 @test3(i32 %X) {
-        %tmp1 = shl i32 %X, 7
-        %tmp2 = icmp slt i32 %tmp1, 0
-        ret i1 %tmp2
-}
-
-define i1 @test4(i32 %X) {
-        %tmp1 = lshr i32 %X, 7
-        %tmp2 = icmp slt i32 %tmp1, 0
-        ret i1 %tmp2
-}
-
-define i1 @test5(i32 %X) {
-        %tmp1 = ashr i32 %X, 7
-        %tmp2 = icmp slt i32 %tmp1, 0
-        ret i1 %tmp2
-}
-

Removed: llvm/branches/wendling/eh/test/Transforms/InstCombine/shift-trunc-shift.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/InstCombine/shift-trunc-shift.ll?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/InstCombine/shift-trunc-shift.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/InstCombine/shift-trunc-shift.ll (removed)
@@ -1,10 +0,0 @@
-; RUN: opt < %s -instcombine -S | grep lshr.*63
-
-define i32 @t1(i64 %d18) {
-entry:
-	%tmp916 = lshr i64 %d18, 32		; <i64> [#uses=1]
-	%tmp917 = trunc i64 %tmp916 to i32		; <i32> [#uses=1]
-	%tmp10 = lshr i32 %tmp917, 31		; <i32> [#uses=1]
-	ret i32 %tmp10
-}
-

Modified: llvm/branches/wendling/eh/test/Transforms/InstCombine/shift.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/InstCombine/shift.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/InstCombine/shift.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/InstCombine/shift.ll Tue Oct 26 19:48:03 2010
@@ -130,8 +130,8 @@
 ;; D = ((B | 1234) << 4) === ((B << 4)|(1234 << 4)
 define i32 @test14(i32 %A) {
 ; CHECK: @test14
-; CHECK-NEXT: or i32 %A, 19744
-; CHECK-NEXT: and i32
+; CHECK-NEXT: %B = and i32 %A, -19760
+; CHECK-NEXT: or i32 %B, 19744
 ; CHECK-NEXT: ret i32
         %B = lshr i32 %A, 4             ; <i32> [#uses=1]
         %C = or i32 %B, 1234            ; <i32> [#uses=1]
@@ -343,3 +343,101 @@
 }
 
 
+define i32 @test29(i64 %d18) {
+entry:
+	%tmp916 = lshr i64 %d18, 32
+	%tmp917 = trunc i64 %tmp916 to i32
+	%tmp10 = lshr i32 %tmp917, 31
+	ret i32 %tmp10
+; CHECK: @test29
+; CHECK:  %tmp916 = lshr i64 %d18, 63
+; CHECK:  %tmp10 = trunc i64 %tmp916 to i32
+}
+
+
+define i32 @test30(i32 %A, i32 %B, i32 %C) {
+	%X = shl i32 %A, %C
+	%Y = shl i32 %B, %C
+	%Z = and i32 %X, %Y
+	ret i32 %Z
+; CHECK: @test30
+; CHECK: %X1 = and i32 %A, %B
+; CHECK: %Z = shl i32 %X1, %C
+}
+
+define i32 @test31(i32 %A, i32 %B, i32 %C) {
+	%X = lshr i32 %A, %C
+	%Y = lshr i32 %B, %C
+	%Z = or i32 %X, %Y
+	ret i32 %Z
+; CHECK: @test31
+; CHECK: %X1 = or i32 %A, %B
+; CHECK: %Z = lshr i32 %X1, %C
+}
+
+define i32 @test32(i32 %A, i32 %B, i32 %C) {
+	%X = ashr i32 %A, %C
+	%Y = ashr i32 %B, %C
+	%Z = xor i32 %X, %Y
+	ret i32 %Z
+; CHECK: @test32
+; CHECK: %X1 = xor i32 %A, %B
+; CHECK: %Z = ashr i32 %X1, %C
+; CHECK: ret i32 %Z
+}
+
+define i1 @test33(i32 %X) {
+        %tmp1 = shl i32 %X, 7
+        %tmp2 = icmp slt i32 %tmp1, 0
+        ret i1 %tmp2
+; CHECK: @test33
+; CHECK: %tmp1.mask = and i32 %X, 16777216
+; CHECK: %tmp2 = icmp ne i32 %tmp1.mask, 0
+}
+
+define i1 @test34(i32 %X) {
+        %tmp1 = lshr i32 %X, 7
+        %tmp2 = icmp slt i32 %tmp1, 0
+        ret i1 %tmp2
+; CHECK: @test34
+; CHECK: ret i1 false
+}
+
+define i1 @test35(i32 %X) {
+        %tmp1 = ashr i32 %X, 7
+        %tmp2 = icmp slt i32 %tmp1, 0
+        ret i1 %tmp2
+; CHECK: @test35
+; CHECK: %tmp2 = icmp slt i32 %X, 0
+; CHECK: ret i1 %tmp2
+}
+
+define i128 @test36(i128 %A, i128 %B) {
+entry:
+  %tmp27 = shl i128 %A, 64
+  %tmp23 = shl i128 %B, 64
+  %ins = or i128 %tmp23, %tmp27
+  %tmp45 = lshr i128 %ins, 64
+  ret i128 %tmp45
+  
+; CHECK: @test36
+; CHECK:  %tmp231 = or i128 %B, %A
+; CHECK:  %ins = and i128 %tmp231, 18446744073709551615
+; CHECK:  ret i128 %ins
+}
+
+define i64 @test37(i128 %A, i32 %B) {
+entry:
+  %tmp27 = shl i128 %A, 64
+  %tmp22 = zext i32 %B to i128
+  %tmp23 = shl i128 %tmp22, 96
+  %ins = or i128 %tmp23, %tmp27
+  %tmp45 = lshr i128 %ins, 64
+  %tmp46 = trunc i128 %tmp45 to i64
+  ret i64 %tmp46
+  
+; CHECK: @test37
+; CHECK:  %tmp23 = shl i128 %tmp22, 32
+; CHECK:  %ins = or i128 %tmp23, %A
+; CHECK:  %tmp46 = trunc i128 %ins to i64
+}

Removed: llvm/branches/wendling/eh/test/Transforms/InstCombine/trunc-mask-ext.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/InstCombine/trunc-mask-ext.ll?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/InstCombine/trunc-mask-ext.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/InstCombine/trunc-mask-ext.ll (removed)
@@ -1,38 +0,0 @@
-; RUN: opt < %s -instcombine -S > %t
-; RUN: not grep zext %t
-; RUN: not grep sext %t
-
-; Instcombine should be able to eliminate all of these ext casts.
-
-declare void @use(i32)
-
-define i64 @foo(i64 %a) {
-  %b = trunc i64 %a to i32
-  %c = and i32 %b, 15
-  %d = zext i32 %c to i64
-  call void @use(i32 %b)
-  ret i64 %d
-}
-define i64 @bar(i64 %a) {
-  %b = trunc i64 %a to i32
-  %c = shl i32 %b, 4
-  %q = ashr i32 %c, 4
-  %d = sext i32 %q to i64
-  call void @use(i32 %b)
-  ret i64 %d
-}
-define i64 @goo(i64 %a) {
-  %b = trunc i64 %a to i32
-  %c = and i32 %b, 8
-  %d = zext i32 %c to i64
-  call void @use(i32 %b)
-  ret i64 %d
-}
-define i64 @hoo(i64 %a) {
-  %b = trunc i64 %a to i32
-  %c = and i32 %b, 8
-  %x = xor i32 %c, 8
-  %d = zext i32 %x to i64
-  call void @use(i32 %b)
-  ret i64 %d
-}

Modified: llvm/branches/wendling/eh/test/Transforms/InstCombine/urem-simplify-bug.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/InstCombine/urem-simplify-bug.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/InstCombine/urem-simplify-bug.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/InstCombine/urem-simplify-bug.ll Tue Oct 26 19:48:03 2010
@@ -1,4 +1,4 @@
-; RUN: opt < %s -instcombine -S | grep {= or i32 %x, -5 }
+; RUN: opt < %s -instcombine -S | grep {= or i32 %x, -5}
 
 @.str = internal constant [5 x i8] c"foo\0A\00"		; <[5 x i8]*> [#uses=1]
 @.str1 = internal constant [5 x i8] c"bar\0A\00"		; <[5 x i8]*> [#uses=1]

Modified: llvm/branches/wendling/eh/test/Transforms/InstCombine/xor2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/InstCombine/xor2.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/InstCombine/xor2.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/InstCombine/xor2.ll Tue Oct 26 19:48:03 2010
@@ -34,7 +34,7 @@
 define i32 @test3(i32 %tmp1) {
 ; CHECK:      @test3
 ; CHECK-NEXT:   and i32 %tmp1, 32
-; CHECK-NEXT:   or i32 %tmp, 8
+; CHECK-NEXT:   or i32 %ovm, 8
 ; CHECK-NEXT:   ret i32
   %ovm = or i32 %tmp1, 145 
   %ov31 = and i32 %ovm, 177

Modified: llvm/branches/wendling/eh/test/Transforms/JumpThreading/basic.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/JumpThreading/basic.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/JumpThreading/basic.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/JumpThreading/basic.ll Tue Oct 26 19:48:03 2010
@@ -1,4 +1,4 @@
-; RUN: opt %s -jump-threading -S -enable-jump-threading-lvi | FileCheck %s
+; RUN: opt %s -jump-threading -S | FileCheck %s
 
 declare i32 @f1()
 declare i32 @f2()
@@ -147,11 +147,17 @@
 ; CHECK: @test6
 	%tmp455 = icmp eq i32 %A, 42
 	br i1 %tmp455, label %BB1, label %BB2
-        
-BB2:
+
+; CHECK: call i32 @f2()
+; CHECK-NEXT: ret i32 3
+
 ; CHECK: call i32 @f1()
-; CHECK-NEXT: call void @f3()
-; CHECK-NEXT: ret i32 4
+; CHECK-NOT: br
+; CHECK: call void @f3()
+; CHECK-NOT: br
+; CHECK: ret i32 4
+    
+BB2:
 	call i32 @f1()
 	br label %BB1
         
@@ -415,4 +421,58 @@
 ; CHECK-NEXT:   br i1 %N, label %T2, label %F2
 }
 
+; CHECK: @test14
+define i32 @test14(i32 %in) {
+entry:
+	%A = icmp eq i32 %in, 0
+; CHECK: br i1 %A, label %right_ret, label %merge
+  br i1 %A, label %left, label %right
+
+; CHECK-NOT: left:
+left:
+	br label %merge
+
+; CHECK-NOT: right:
+right:
+  %B = call i32 @f1()
+	br label %merge
+
+merge:
+; CHECK-NOT: %C = phi i32 [%in, %left], [%B, %right]
+	%C = phi i32 [%in, %left], [%B, %right]
+	%D = add i32 %C, 1
+	%E = icmp eq i32 %D, 2
+	br i1 %E, label %left_ret, label %right_ret
+
+; CHECK: left_ret:
+left_ret:
+	ret i32 0
+
+right_ret:
+	ret i32 1
+}
+
+; PR5652
+; CHECK: @test15
+define i32 @test15(i32 %len) {
+entry:
+; CHECK: icmp ult i32 %len, 13
+  %tmp = icmp ult i32 %len, 13
+  br i1 %tmp, label %check, label %exit0
+
+exit0:
+  ret i32 0
+
+check:
+  %tmp9 = icmp ult i32 %len, 21
+  br i1 %tmp9, label %exit1, label %exit2
+
+exit2:
+; CHECK-NOT: ret i32 2
+  ret i32 2
+
+exit1:
+  ret i32 1
+; CHECK: }
+}
 

Modified: llvm/branches/wendling/eh/test/Transforms/JumpThreading/crash.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/JumpThreading/crash.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/JumpThreading/crash.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/JumpThreading/crash.ll Tue Oct 26 19:48:03 2010
@@ -436,4 +436,78 @@
   ret void
 }
 
+; PR7755
+define void @test16(i1 %c, i1 %c2, i1 %c3, i1 %c4) nounwind ssp {
+entry:
+  %cmp = icmp sgt i32 undef, 1                    ; <i1> [#uses=1]
+  br i1 %c, label %land.end, label %land.rhs
 
+land.rhs:                                         ; preds = %entry
+  br i1 %c2, label %lor.lhs.false.i, label %land.end
+
+lor.lhs.false.i:                                  ; preds = %land.rhs
+  br i1 %c3, label %land.end, label %land.end
+
+land.end:                            
+  %0 = phi i1 [ true, %entry ], [ false, %land.rhs ], [false, %lor.lhs.false.i], [false, %lor.lhs.false.i] ; <i1> [#uses=1]
+  %cmp12 = and i1 %cmp, %0 
+  %xor1 = xor i1 %cmp12, %c4
+  br i1 %xor1, label %if.then, label %if.end
+
+if.then:                      
+  ret void
+
+if.end:                       
+  ret void
+}
+
+define void @test17() {
+entry:
+  br i1 undef, label %bb269.us.us, label %bb269.us.us.us
+
+bb269.us.us.us:
+  %indvar = phi i64 [ %indvar.next, %bb287.us.us.us ], [ 0, %entry ]
+  %0 = icmp eq i16 undef, 0
+  br i1 %0, label %bb287.us.us.us, label %bb286.us.us.us
+
+bb287.us.us.us:
+  %indvar.next = add i64 %indvar, 1
+  %exitcond = icmp eq i64 %indvar.next, 4
+  br i1 %exitcond, label %bb288.bb289.loopexit_crit_edge, label %bb269.us.us.us
+
+bb286.us.us.us:
+  unreachable
+
+bb269.us.us:
+	unreachable
+
+bb288.bb289.loopexit_crit_edge:
+  unreachable
+}
+
+; PR 8247
+%struct.S1 = type { i8, i8 }
+ at func_89.l_245 = internal constant %struct.S1 { i8 33, i8 6 }, align 1
+define void @func_89(i16 zeroext %p_90, %struct.S1* nocapture %p_91, i32* nocapture %p_92) nounwind ssp {
+entry:
+  store i32 0, i32* %p_92, align 4
+  br i1 false, label %lbl_260, label %if.else
+
+if.else:                                          ; preds = %entry
+  br label %for.cond
+
+for.cond:                                         ; preds = %lbl_260, %if.else
+  %l_245.0 = phi i16 [ %l_245.1, %lbl_260 ], [ 33, %if.else ]
+  %l_261.0 = phi i32 [ %and, %lbl_260 ], [ 255, %if.else ]
+  %tobool21 = icmp ult i16 %l_245.0, 256
+  br i1 %tobool21, label %if.end, label %lbl_260
+
+lbl_260:                                          ; preds = %for.cond, %entry
+  %l_245.1 = phi i16 [ 1569, %entry ], [ %l_245.0, %for.cond ]
+  %l_261.1 = phi i32 [ 255, %entry ], [ %l_261.0, %for.cond ]
+  %and = and i32 %l_261.1, 1
+  br label %for.cond
+
+if.end:                                           ; preds = %for.cond
+  ret void
+}

Modified: llvm/branches/wendling/eh/test/Transforms/LICM/2008-07-22-LoadGlobalConstant.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/LICM/2008-07-22-LoadGlobalConstant.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/LICM/2008-07-22-LoadGlobalConstant.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/LICM/2008-07-22-LoadGlobalConstant.ll Tue Oct 26 19:48:03 2010
@@ -1,4 +1,4 @@
-; RUN: opt < %s -licm -S | FileCheck %s
+; RUN: opt < %s -basicaa -licm -S | FileCheck %s
 
 @a = external constant float*
 

Removed: llvm/branches/wendling/eh/test/Transforms/LICM/2009-03-25-AliasSetTracker.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/LICM/2009-03-25-AliasSetTracker.ll?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/LICM/2009-03-25-AliasSetTracker.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/LICM/2009-03-25-AliasSetTracker.ll (removed)
@@ -1,39 +0,0 @@
-
-; RUN: opt < %s -licm -loop-index-split -instcombine -disable-output
-
-	%struct.FILE = type { i32, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, %struct._IO_marker*, %struct.FILE*, i32, i32, i32, i16, i8, [1 x i8], i8*, i64, i8*, i8*, i8*, i8*, i32, i32, [40 x i8] }
-	%struct._IO_marker = type { %struct._IO_marker*, %struct.FILE*, i32 }
-@"\01LC81" = external constant [4 x i8]		; <[4 x i8]*> [#uses=1]
-
-define fastcc void @hex_dump_internal(i8* %avcl, %struct.FILE* %f, i32 %level, i8* nocapture %buf, i32 %size) nounwind {
-entry:
-	br i1 false, label %bb4, label %return
-
-bb4:		; preds = %bb30, %entry
-	br label %bb6
-
-bb6:		; preds = %bb15, %bb4
-	%j.0.reg2mem.0 = phi i32 [ %2, %bb15 ], [ 0, %bb4 ]		; <i32> [#uses=2]
-	%0 = icmp slt i32 %j.0.reg2mem.0, 0		; <i1> [#uses=1]
-	br i1 %0, label %bb7, label %bb13
-
-bb7:		; preds = %bb6
-	br label %bb15
-
-bb13:		; preds = %bb6
-	%1 = tail call i32 @fwrite(i8* getelementptr ([4 x i8]* @"\01LC81", i32 0, i32 0), i32 1, i32 3, i8* null) nounwind		; <i32> [#uses=0]
-	br label %bb15
-
-bb15:		; preds = %bb13, %bb7
-	%2 = add i32 %j.0.reg2mem.0, 1		; <i32> [#uses=2]
-	%3 = icmp sgt i32 %2, 15		; <i1> [#uses=1]
-	br i1 %3, label %bb30, label %bb6
-
-bb30:		; preds = %bb15
-	br i1 false, label %bb4, label %return
-
-return:		; preds = %bb30, %entry
-	ret void
-}
-
-declare i32 @fwrite(i8* nocapture, i32, i32, i8* nocapture) nounwind

Modified: llvm/branches/wendling/eh/test/Transforms/LICM/hoisting.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/LICM/hoisting.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/LICM/hoisting.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/LICM/hoisting.ll Tue Oct 26 19:48:03 2010
@@ -48,3 +48,19 @@
 	%C = sub i32 %A, %B		; <i32> [#uses=1]
 	ret i32 %C
 }
+
+
+; This loop invariant instruction should be constant folded, not hoisted.
+define i32 @test3(i1 %c) {
+; CHECK: define i32 @test3
+; CHECK: call void @foo2(i32 6)
+	%A = load i32* @X		; <i32> [#uses=2]
+	br label %Loop
+Loop:
+	%B = add i32 4, 2		; <i32> [#uses=2]
+	call void @foo2( i32 %B )
+	br i1 %c, label %Loop, label %Out
+Out:		; preds = %Loop
+	%C = sub i32 %A, %B		; <i32> [#uses=1]
+	ret i32 %C
+}

Modified: llvm/branches/wendling/eh/test/Transforms/LICM/scalar_promote.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/LICM/scalar_promote.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/LICM/scalar_promote.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/LICM/scalar_promote.ll Tue Oct 26 19:48:03 2010
@@ -1,4 +1,6 @@
-; RUN: opt < %s  -licm -S | FileCheck %s
+; RUN: opt < %s -basicaa -licm -S | FileCheck %s
+target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
+
 @X = global i32 7		; <i32*> [#uses=4]
 
 define void @test1(i32 %i) {
@@ -32,23 +34,21 @@
 	br label %Loop
 ; CHECK: @test2
 ; CHECK: Entry:
-; CHECK-NEXT:  %X1 = getelementptr i32* @X, i64 0 
-; CHECK-NEXT:    %X2 = getelementptr i32* @X, i64 0
-; CHECK-NEXT:    %X1.promoted = load i32* %X1 
+; CHECK-NEXT:    %.promoted = load i32* getelementptr inbounds (i32* @X, i64 1)
 ; CHECK-NEXT:    br label %Loop
 
 Loop:		; preds = %Loop, %0
-	%X1 = getelementptr i32* @X, i64 0		; <i32*> [#uses=1]
+	%X1 = getelementptr i32* @X, i64 1		; <i32*> [#uses=1]
 	%A = load i32* %X1		; <i32> [#uses=1]
 	%V = add i32 %A, 1		; <i32> [#uses=1]
-	%X2 = getelementptr i32* @X, i64 0		; <i32*> [#uses=1]
+	%X2 = getelementptr i32* @X, i64 1		; <i32*> [#uses=1]
 	store i32 %V, i32* %X2
 	br i1 false, label %Loop, label %Exit
 
 Exit:		; preds = %Loop
 	ret void
 ; CHECK: Exit:
-; CHECK-NEXT:   store i32 %V, i32* %X1
+; CHECK-NEXT:   store i32 %V, i32* getelementptr inbounds (i32* @X, i64 1)
 ; CHECK-NEXT:   ret void
 }
 
@@ -71,3 +71,50 @@
 	ret void
 }
 
+; PR8041
+define void @test4(i8* %x, i8 %n) {
+; CHECK: @test4
+  %handle1 = alloca i8*
+  %handle2 = alloca i8*
+  store i8* %x, i8** %handle1
+  br label %loop
+
+loop:
+  %tmp = getelementptr i8* %x, i64 8
+  store i8* %tmp, i8** %handle2
+  br label %subloop
+
+subloop:
+  %count = phi i8 [ 0, %loop ], [ %nextcount, %subloop ]
+  %offsetx2 = load i8** %handle2
+  store i8 %n, i8* %offsetx2
+  %newoffsetx2 = getelementptr i8* %offsetx2, i64 -1
+  store i8* %newoffsetx2, i8** %handle2
+  %nextcount = add i8 %count, 1
+  %innerexitcond = icmp sge i8 %nextcount, 8
+  br i1 %innerexitcond, label %innerexit, label %subloop
+
+; Should have promoted 'handle2' accesses.
+; CHECK: subloop:
+; CHECK-NEXT: phi i8* [
+; CHECK-NEXT: %count = phi i8 [
+; CHECK-NEXT: store i8 %n
+; CHECK-NOT: store
+; CHECK: br i1
+
+innerexit:
+  %offsetx1 = load i8** %handle1
+  %val = load i8* %offsetx1
+  %cond = icmp eq i8 %val, %n
+  br i1 %cond, label %exit, label %loop
+
+; Should not have promoted offsetx1 loads.
+; CHECK: innerexit:
+; CHECK: %val = load i8* %offsetx1
+; CHECK: %cond = icmp eq i8 %val, %n
+; CHECK: br i1 %cond, label %exit, label %loop
+
+exit:
+  ret void
+}
+

Modified: llvm/branches/wendling/eh/test/Transforms/LICM/sinking.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/LICM/sinking.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/LICM/sinking.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/LICM/sinking.ll Tue Oct 26 19:48:03 2010
@@ -233,3 +233,17 @@
 ; CHECK-NEXT:  ret i32 %tmp.6
 }
 
+; Should delete, not sink, dead instructions.
+define void @test11() {
+	br label %Loop
+Loop:
+	%dead = getelementptr %Ty* @X2, i64 0, i32 0
+	br i1 false, label %Loop, label %Out
+Out:
+	ret void
+; CHECK: @test11
+; CHECK:     Out:
+; CHECK-NEXT:  ret void
+}
+
+

Modified: llvm/branches/wendling/eh/test/Transforms/LoopRotate/phi-duplicate.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/LoopRotate/phi-duplicate.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/LoopRotate/phi-duplicate.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/LoopRotate/phi-duplicate.ll Tue Oct 26 19:48:03 2010
@@ -27,9 +27,21 @@
 for.end:                                          ; preds = %for.cond
   ret void
 }
-; Should only end up with one phi.
-; CHECK: for.body:
-; CHECK-NEXT: %j.02 = phi i64
-; CHECK-NOT: phi
-; CHECK: ret void
 
+; Should only end up with one phi. Also, the original for.cond block should
+; be moved to the end of the loop so that the new loop header pleasantly
+; ends up at the top.
+
+; CHECK:      define void @test
+; CHECK-NEXT: entry:
+; CHECK-NEXT:   icmp slt i64
+; CHECK-NEXT:   br i1
+; CHECK-NOT:  :
+; CHECK:      bb.nph:
+; CHECK-NEXT:   br label %for.body
+; CHECK-NOT:  :
+; CHECK:      for.body:
+; CHECK-NEXT:   %j.02 = phi i64
+; CHECK-NOT:    phi
+; CHECK:        ret void
+; CHECK-NEXT: }

Removed: llvm/branches/wendling/eh/test/Transforms/LoopStrengthReduce/2008-08-06-CmpStride.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/LoopStrengthReduce/2008-08-06-CmpStride.ll?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/LoopStrengthReduce/2008-08-06-CmpStride.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/LoopStrengthReduce/2008-08-06-CmpStride.ll (removed)
@@ -1,23 +0,0 @@
-; RUN: llc -march=x86-64 < %s -o - | grep {cmpl	\\$\[1\], %}
-
- at .str = internal constant [4 x i8] c"%d\0A\00"
-
-declare i32 @printf(i8* noalias , ...) nounwind
-
-define i32 @main() nounwind {
-entry:
-        br label %forbody
-
-forbody:
-        %i.0 = phi i32 [ 0, %entry ], [ %inc, %forbody ]                ; <i32>[#uses=3]
-        %sub14 = sub i32 1027, %i.0             ; <i32> [#uses=1]
-        %mul15 = mul i32 %sub14, 10             ; <i32> [#uses=1]
-        %add166 = or i32 %mul15, 1              ; <i32> [#uses=1] *
-        call i32 (i8*, ...)* @printf( i8* noalias  getelementptr ([4 x i8]* @.str, i32 0, i32 0), i32 %add166 ) nounwind
-        %inc = add i32 %i.0, 1          ; <i32> [#uses=3]
-        %cmp = icmp ne i32 %inc, 1027          ; <i1> [#uses=1]
-        br i1 %cmp, label %forbody, label %afterfor
-
-afterfor:               ; preds = %forcond
-        ret i32 0
-}

Removed: llvm/branches/wendling/eh/test/Transforms/LoopStrengthReduce/2009-02-09-ivs-different-sizes.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/LoopStrengthReduce/2009-02-09-ivs-different-sizes.ll?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/LoopStrengthReduce/2009-02-09-ivs-different-sizes.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/LoopStrengthReduce/2009-02-09-ivs-different-sizes.ll (removed)
@@ -1,33 +0,0 @@
-; RUN: llc < %s
-; This used to crash.
-; ModuleID = 'bugpoint-reduced-simplified.bc'
-target datalayout ="e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
-target triple = "x86_64-unknown-linux-gnu"
-
-define void @parse_number(i8* nocapture %p) nounwind {
-entry:
-        %shift.0 = select i1 false, i32 4, i32 2                ; <i32> [#uses=1]
-        br label %bb47
-
-bb47:           ; preds = %bb47, %entry
-        br i1 false, label %bb54, label %bb47
-
-bb54:           ; preds = %bb47
-        br i1 false, label %bb56, label %bb66
-
-bb56:           ; preds = %bb62, %bb54
-        %p_addr.0.pn.rec = phi i64 [ %p_addr.6.rec, %bb62 ], [ 0, %bb54 ]             ; <i64> [#uses=2]
-        %ch.6.in.in = phi i8* [ %p_addr.6, %bb62 ], [ null, %bb54 ]           ; <i8*> [#uses=0]
-        %indvar202 = trunc i64 %p_addr.0.pn.rec to i32          ; <i32>[#uses=1]
-        %frac_bits.0 = mul i32 %indvar202, %shift.0             ; <i32>[#uses=1]
-        %p_addr.6.rec = add i64 %p_addr.0.pn.rec, 1             ; <i64>[#uses=2]
-        %p_addr.6 = getelementptr i8* null, i64 %p_addr.6.rec           ; <i8*>[#uses=1]
-        br i1 false, label %bb66, label %bb62
-
-bb62:           ; preds = %bb56
-        br label %bb56
-
-bb66:           ; preds = %bb56, %bb54
-        %frac_bits.1 = phi i32 [ 0, %bb54 ], [ %frac_bits.0, %bb56 ]           ; <i32> [#uses=0]
-        unreachable
-}

Removed: llvm/branches/wendling/eh/test/Transforms/LoopStrengthReduce/change-compare-stride-trickiness-0.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/LoopStrengthReduce/change-compare-stride-trickiness-0.ll?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/LoopStrengthReduce/change-compare-stride-trickiness-0.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/LoopStrengthReduce/change-compare-stride-trickiness-0.ll (removed)
@@ -1,29 +0,0 @@
-; RUN: llc < %s -o - | FileCheck %s
-target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
-target triple = "x86_64-apple-darwin9"
-
-; The comparison happens before the relevant use, but it can still be rewritten
-; to compare with zero.
-
-; CHECK: foo:
-; CHECK: align
-; CHECK: incl  %eax
-; CHECK-NEXT: decl  %ecx
-; CHECK-NEXT: jne
-
-define void @foo() nounwind {
-entry:
-	br label %loop
-
-loop:
-	%indvar = phi i32 [ 0, %entry ], [ %i.2.0.us1534, %loop ]		; <i32> [#uses=1]
-	%i.2.0.us1534 = add i32 %indvar, 1		; <i32> [#uses=3]
-	%tmp611.us1535 = icmp eq i32 %i.2.0.us1534, 4		; <i1> [#uses=2]
-	%tmp623.us1538 = select i1 %tmp611.us1535, i32 6, i32 0		; <i32> [#uses=0]
-	%tmp628.us1540 = shl i32 %i.2.0.us1534, 1		; <i32> [#uses=1]
-	%tmp645646647.us1547 = sext i32 %tmp628.us1540 to i64		; <i64> [#uses=0]
-	br i1 %tmp611.us1535, label %exit, label %loop
-
-exit:
-	ret void
-}

Removed: llvm/branches/wendling/eh/test/Transforms/LoopStrengthReduce/change-compare-stride-trickiness-1.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/LoopStrengthReduce/change-compare-stride-trickiness-1.ll?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/LoopStrengthReduce/change-compare-stride-trickiness-1.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/LoopStrengthReduce/change-compare-stride-trickiness-1.ll (removed)
@@ -1,28 +0,0 @@
-; RUN: llc %s -o - --x86-asm-syntax=att | grep {cmp.	\$10}
-target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
-target triple = "x86_64-apple-darwin9"
-
-; The comparison happens after the relevant use, so the stride can easily
-; be changed. The comparison can be done in a narrower mode than the
-; induction variable.
-; TODO: By making the first store post-increment as well, the loop setup
-; could be made simpler.
-
-define void @foo() nounwind {
-entry:
-	br label %loop
-
-loop:
-	%indvar = phi i32 [ 0, %entry ], [ %i.2.0.us1534, %loop ]		; <i32> [#uses=1]
-	%i.2.0.us1534 = add i32 %indvar, 1		; <i32> [#uses=3]
-	%tmp628.us1540 = shl i32 %i.2.0.us1534, 1		; <i32> [#uses=1]
-	%tmp645646647.us1547 = sext i32 %tmp628.us1540 to i64		; <i64> [#uses=1]
-	store i64 %tmp645646647.us1547, i64* null
-	%tmp611.us1535 = icmp eq i32 %i.2.0.us1534, 4		; <i1> [#uses=2]
-	%tmp623.us1538 = select i1 %tmp611.us1535, i32 6, i32 0		; <i32> [#uses=1]
-	store i32 %tmp623.us1538, i32* null
-	br i1 %tmp611.us1535, label %exit, label %loop
-
-exit:
-	ret void
-}

Removed: llvm/branches/wendling/eh/test/Transforms/LoopStrengthReduce/change-compare-stride-trickiness-2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/LoopStrengthReduce/change-compare-stride-trickiness-2.ll?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/LoopStrengthReduce/change-compare-stride-trickiness-2.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/LoopStrengthReduce/change-compare-stride-trickiness-2.ll (removed)
@@ -1,58 +0,0 @@
-; RUN: llc < %s
-; PR4222
-
-target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
-target triple = "x86_64-pc-linux-gnu"
-module asm ".ident\09\22$FreeBSD: head/sys/amd64/amd64/minidump_machdep.c 184499 2008-10-31 10:11:35Z kib $\22"
-	%struct.dumperinfo = type <{ i32 (i8*, i8*, i64, i64, i64)*, i8*, i32, i32, i64, i64 }>
-
-define void @minidumpsys(%struct.dumperinfo* %di) nounwind {
-entry:
-	br label %if.end
-
-if.end:		; preds = %if.end52, %entry
-	br label %for.cond.i.preheader
-
-for.cond.i.preheader:		; preds = %if.end52, %if.end
-	%indvar688 = phi i64 [ 0, %if.end ], [ %indvar.next689, %if.end52 ]		; <i64> [#uses=3]
-	%tmp690 = shl i64 %indvar688, 12		; <i64> [#uses=1]
-	%pa.0642 = add i64 %tmp690, 0		; <i64> [#uses=1]
-	%indvar688703 = trunc i64 %indvar688 to i32		; <i32> [#uses=1]
-	%tmp692693 = add i32 %indvar688703, 1		; <i32> [#uses=1]
-	%phitmp = sext i32 %tmp692693 to i64		; <i64> [#uses=1]
-	br i1 false, label %if.end52, label %land.lhs.true.i
-
-land.lhs.true.i:		; preds = %for.cond.i.preheader
-	%shr2.i = lshr i64 %pa.0642, 18		; <i64> [#uses=0]
-	unreachable
-
-if.end52:		; preds = %for.cond.i.preheader
-	%phitmp654 = icmp ult i64 %phitmp, 512		; <i1> [#uses=1]
-	%indvar.next689 = add i64 %indvar688, 1		; <i64> [#uses=1]
-	br i1 %phitmp654, label %for.cond.i.preheader, label %if.end
-}
-
-define void @promote(%struct.dumperinfo* %di) nounwind {
-entry:
-	br label %if.end
-
-if.end:		; preds = %if.end52, %entry
-	br label %for.cond.i.preheader
-
-for.cond.i.preheader:		; preds = %if.end52, %if.end
-	%indvar688 = phi i32 [ 0, %if.end ], [ %indvar.next689, %if.end52 ]		; <i64> [#uses=3]
-	%tmp690 = shl i32 %indvar688, 12		; <i64> [#uses=1]
-	%pa.0642 = add i32 %tmp690, 0		; <i64> [#uses=1]
-	%tmp692693 = add i32 %indvar688, 1		; <i32> [#uses=1]
-	%phitmp = sext i32 %tmp692693 to i64		; <i64> [#uses=1]
-	br i1 false, label %if.end52, label %land.lhs.true.i
-
-land.lhs.true.i:		; preds = %for.cond.i.preheader
-	%shr2.i = lshr i32 %pa.0642, 18		; <i64> [#uses=0]
-	unreachable
-
-if.end52:		; preds = %for.cond.i.preheader
-	%phitmp654 = icmp ult i64 %phitmp, 512		; <i1> [#uses=1]
-	%indvar.next689 = add i32 %indvar688, 1		; <i64> [#uses=1]
-	br i1 %phitmp654, label %for.cond.i.preheader, label %if.end
-}

Removed: llvm/branches/wendling/eh/test/Transforms/LoopStrengthReduce/insert-positions.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/LoopStrengthReduce/insert-positions.ll?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/LoopStrengthReduce/insert-positions.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/LoopStrengthReduce/insert-positions.ll (removed)
@@ -1,69 +0,0 @@
-; RUN: llc < %s -march=x86-64 >/dev/null
-
-target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
-
-define void @test0() nounwind {
-if.end90.i.i:
-  br label %while.body.i.i221.i
-
-while.body.i.i221.i:                              ; preds = %while.cond.backedge.i.i.i, %if.end90.i.i
-  br i1 undef, label %if.then.i.i224.i, label %while.cond.backedge.i.i.i
-
-while.cond.backedge.i.i.i:                        ; preds = %for.end.i.i.i, %while.body.i.i221.i
-  br label %while.body.i.i221.i
-
-if.then.i.i224.i:                                 ; preds = %while.body.i.i221.i
-  switch i32 undef, label %for.cond.i.i226.i [
-    i32 92, label %sw.bb.i.i225.i
-    i32 34, label %sw.bb.i.i225.i
-    i32 110, label %sw.bb21.i.i.i
-  ]
-
-sw.bb.i.i225.i:                                   ; preds = %if.then.i.i224.i, %if.then.i.i224.i
-  unreachable
-
-sw.bb21.i.i.i:                                    ; preds = %if.then.i.i224.i
-  unreachable
-
-for.cond.i.i226.i:                                ; preds = %for.body.i.i.i, %if.then.i.i224.i
-  %0 = phi i64 [ %tmp154.i.i.i, %for.body.i.i.i ], [ 0, %if.then.i.i224.i ] ; <i64> [#uses=2]
-  %tmp154.i.i.i = add i64 %0, 1                   ; <i64> [#uses=2]
-  %i.0.i.i.i = trunc i64 %0 to i32                ; <i32> [#uses=1]
-  br i1 undef, label %land.rhs.i.i.i, label %for.end.i.i.i
-
-land.rhs.i.i.i:                                   ; preds = %for.cond.i.i226.i
-  br i1 undef, label %for.body.i.i.i, label %for.end.i.i.i
-
-for.body.i.i.i:                                   ; preds = %land.rhs.i.i.i
-  br label %for.cond.i.i226.i
-
-for.end.i.i.i:                                    ; preds = %land.rhs.i.i.i, %for.cond.i.i226.i
-  %idx.ext.i.i.i = sext i32 %i.0.i.i.i to i64     ; <i64> [#uses=1]
-  %sub.ptr72.sum.i.i.i = xor i64 %idx.ext.i.i.i, -1 ; <i64> [#uses=1]
-  %pos.addr.1.sum155.i.i.i = add i64 %tmp154.i.i.i, %sub.ptr72.sum.i.i.i ; <i64> [#uses=1]
-  %arrayidx76.i.i.i = getelementptr inbounds i8* undef, i64 %pos.addr.1.sum155.i.i.i ; <i8*> [#uses=0]
-  br label %while.cond.backedge.i.i.i
-}
-
-define void @test1() nounwind {
-entry:
-  %t = shl i32 undef, undef                     ; <i32> [#uses=1]
-  %t9 = sub nsw i32 0, %t                     ; <i32> [#uses=1]
-  br label %outer
-
-outer:                                             ; preds = %bb18, %bb
-  %i12 = phi i32 [ %t21, %bb18 ], [ 0, %entry ]  ; <i32> [#uses=2]
-  %i13 = phi i32 [ %t20, %bb18 ], [ 0, %entry ]  ; <i32> [#uses=2]
-  br label %inner
-
-inner:                                             ; preds = %bb16, %bb11
-  %t17 = phi i32 [ %i13, %outer ], [ undef, %inner ] ; <i32> [#uses=1]
-  store i32 %t17, i32* undef
-  br i1 undef, label %bb18, label %inner
-
-bb18:                                             ; preds = %bb16
-  %t19 = add i32 %i13, %t9                 ; <i32> [#uses=1]
-  %t20 = add i32 %t19, %i12                 ; <i32> [#uses=1]
-  %t21 = add i32 %i12, 1                      ; <i32> [#uses=1]
-  br label %outer
-}

Modified: llvm/branches/wendling/eh/test/Transforms/LoopStrengthReduce/pr3571.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/LoopStrengthReduce/pr3571.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/LoopStrengthReduce/pr3571.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/LoopStrengthReduce/pr3571.ll Tue Oct 26 19:48:03 2010
@@ -1,7 +1,7 @@
 ; RUN: opt < %s -loop-reduce | llvm-dis
 ; PR3571
 
-target triple = "i386-mingw32"
+target triple = "i386-pc-mingw32"
 define void @_ZNK18qdesigner_internal10TreeWidget12drawBranchesEP8QPainterRK5QRectRK11QModelIndex() nounwind {
 entry:
 	br label %_ZNK11QModelIndex7isValidEv.exit.i

Modified: llvm/branches/wendling/eh/test/Transforms/LoopStrengthReduce/uglygep.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/LoopStrengthReduce/uglygep.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/LoopStrengthReduce/uglygep.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/LoopStrengthReduce/uglygep.ll Tue Oct 26 19:48:03 2010
@@ -4,7 +4,6 @@
 ; should be able to form pretty GEPs.
 
 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
-target triple = "x86_64-unknown-linux-gnu"
 
 define void @Z4() nounwind {
 bb:

Propchange: llvm/branches/wendling/eh/test/Transforms/LowerAtomic/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Oct 26 19:48:03 2010
@@ -0,0 +1 @@
+Output

Modified: llvm/branches/wendling/eh/test/Transforms/MemCpyOpt/2008-02-24-MultipleUseofSRet.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/MemCpyOpt/2008-02-24-MultipleUseofSRet.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/MemCpyOpt/2008-02-24-MultipleUseofSRet.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/MemCpyOpt/2008-02-24-MultipleUseofSRet.ll Tue Oct 26 19:48:03 2010
@@ -1,4 +1,4 @@
-; RUN: opt < %s -memcpyopt -dse -S | grep {call.*initialize} | not grep memtmp
+; RUN: opt < %s -basicaa -memcpyopt -dse -S | grep {call.*initialize} | not grep memtmp
 ; PR2077
 
 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"

Modified: llvm/branches/wendling/eh/test/Transforms/MemCpyOpt/2008-03-13-ReturnSlotBitcast.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/MemCpyOpt/2008-03-13-ReturnSlotBitcast.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/MemCpyOpt/2008-03-13-ReturnSlotBitcast.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/MemCpyOpt/2008-03-13-ReturnSlotBitcast.ll Tue Oct 26 19:48:03 2010
@@ -1,4 +1,4 @@
-; RUN: opt < %s -memcpyopt -S | not grep {call.*memcpy.}
+; RUN: opt < %s -basicaa -memcpyopt -S | not grep {call.*memcpy.}
 target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64"
 	%a = type { i32 }
 	%b = type { float }

Modified: llvm/branches/wendling/eh/test/Transforms/MemCpyOpt/memcpy.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/MemCpyOpt/memcpy.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/MemCpyOpt/memcpy.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/MemCpyOpt/memcpy.ll Tue Oct 26 19:48:03 2010
@@ -1,4 +1,4 @@
-; RUN: opt < %s -memcpyopt -dse -S | grep {call.*memcpy} | count 1
+; RUN: opt < %s -basicaa -memcpyopt -dse -S | grep {call.*memcpy} | count 1
 
 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
 target triple = "i686-apple-darwin9"

Modified: llvm/branches/wendling/eh/test/Transforms/MemCpyOpt/memmove.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/MemCpyOpt/memmove.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/MemCpyOpt/memmove.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/MemCpyOpt/memmove.ll Tue Oct 26 19:48:03 2010
@@ -1,4 +1,4 @@
-; RUN: opt < %s -memcpyopt -S | FileCheck %s
+; RUN: opt < %s -basicaa -memcpyopt -S | FileCheck %s
 ; These memmoves should get optimized to memcpys.
 
 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"

Modified: llvm/branches/wendling/eh/test/Transforms/MemCpyOpt/sret.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/MemCpyOpt/sret.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/MemCpyOpt/sret.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/MemCpyOpt/sret.ll Tue Oct 26 19:48:03 2010
@@ -1,4 +1,4 @@
-; RUN: opt < %s -memcpyopt -S | not grep {call.*memcpy}
+; RUN: opt < %s -basicaa -memcpyopt -S | not grep {call.*memcpy}
 
 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
 target triple = "i686-apple-darwin9"

Modified: llvm/branches/wendling/eh/test/Transforms/PartialSpecialize/two-specializations.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/PartialSpecialize/two-specializations.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/PartialSpecialize/two-specializations.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/PartialSpecialize/two-specializations.ll Tue Oct 26 19:48:03 2010
@@ -1,8 +1,8 @@
 ; If there are two specializations of a function, make sure each callsite
 ; calls the right one.
 ;
-; RN: opt -S -partialspecialization %s | FileCheck %s
-; RUN: true
+; RUN: opt -S -partialspecialization -disable-inlining %s | opt -S -inline | FileCheck %s -check-prefix=CORRECT
+; RUN: opt -S -partialspecialization -disable-inlining %s | FileCheck %s 
 declare void @callback1()
 declare void @callback2()
 
@@ -14,14 +14,18 @@
 define void @foo(void()* %pNonConstCallback)
 {
 Entry:
+; CORRECT: Entry
+; CORRECT-NEXT: call void @callback1()
+; CORRECT-NEXT: call void @callback1()
+; CORRECT-NEXT: call void @callback2()
+; CORRECT-NEXT: call void %pNonConstCallback()
+; CORRECT-NEXT: call void @callback1()
+; CORRECT-NEXT: call void @callback2()
+; CORRECT-NEXT: call void @callback2()
 ; CHECK: Entry
-; CHECK-NEXT: call void @callback1()
-; CHECK-NEXT: call void @callback1()
-; CHECK-NEXT: call void @callback2()
-; CHECK-NEXT: call void %pNonConstCallback()
-; CHECK-NEXT: call void @callback1()
-; CHECK-NEXT: call void @callback2()
-; CHECK-NEXT: call void @callback2()
+; CHECK-NOT: call void @UseCallback(void ()* @callback1)
+; CHECK-NOT: call void @UseCallback(void ()* @callback2)
+; CHECK: ret void
   call void @UseCallback(void()* @callback1)
   call void @UseCallback(void()* @callback1)
   call void @UseCallback(void()* @callback2)

Modified: llvm/branches/wendling/eh/test/Transforms/ScalarRepl/vector_promote.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/ScalarRepl/vector_promote.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/ScalarRepl/vector_promote.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/ScalarRepl/vector_promote.ll Tue Oct 26 19:48:03 2010
@@ -1,8 +1,8 @@
-; RUN: opt < %s -scalarrepl -S | not grep alloca
-; RUN: opt < %s -scalarrepl -S | grep {load <4 x float>}
+; RUN: opt < %s -scalarrepl -S | FileCheck %s
 target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64"
+target triple = "x86_64-apple-darwin10.0.0"
 
-define void @test(<4 x float>* %F, float %f) {
+define void @test1(<4 x float>* %F, float %f) {
 entry:
 	%G = alloca <4 x float>, align 16		; <<4 x float>*> [#uses=3]
 	%tmp = load <4 x float>* %F		; <<4 x float>> [#uses=2]
@@ -14,6 +14,11 @@
 	%tmp6 = fadd <4 x float> %tmp4, %tmp4		; <<4 x float>> [#uses=1]
 	store <4 x float> %tmp6, <4 x float>* %F
 	ret void
+; CHECK: @test1
+; CHECK-NOT: alloca
+; CHECK: %tmp = load <4 x float>* %F
+; CHECK: fadd <4 x float> %tmp, %tmp
+; CHECK-NEXT: insertelement <4 x float> %tmp3, float %f, i32 0
 }
 
 define void @test2(<4 x float>* %F, float %f) {
@@ -28,6 +33,11 @@
 	%tmp6 = fadd <4 x float> %tmp4, %tmp4		; <<4 x float>> [#uses=1]
 	store <4 x float> %tmp6, <4 x float>* %F
 	ret void
+; CHECK: @test2
+; CHECK-NOT: alloca
+; CHECK: %tmp = load <4 x float>* %F
+; CHECK: fadd <4 x float> %tmp, %tmp
+; CHECK-NEXT: insertelement <4 x float> %tmp3, float %f, i32 2
 }
 
 define void @test3(<4 x float>* %F, float* %f) {
@@ -40,6 +50,11 @@
 	%tmp.upgrd.4 = load float* %tmp.upgrd.3		; <float> [#uses=1]
 	store float %tmp.upgrd.4, float* %f
 	ret void
+; CHECK: @test3
+; CHECK-NOT: alloca
+; CHECK: %tmp = load <4 x float>* %F
+; CHECK: fadd <4 x float> %tmp, %tmp
+; CHECK-NEXT: extractelement <4 x float> %tmp3, i32 2
 }
 
 define void @test4(<4 x float>* %F, float* %f) {
@@ -52,6 +67,11 @@
 	%tmp.upgrd.6 = load float* %G.upgrd.5		; <float> [#uses=1]
 	store float %tmp.upgrd.6, float* %f
 	ret void
+; CHECK: @test4
+; CHECK-NOT: alloca
+; CHECK: %tmp = load <4 x float>* %F
+; CHECK: fadd <4 x float> %tmp, %tmp
+; CHECK-NEXT: extractelement <4 x float> %tmp3, i32 0
 }
 
 define i32 @test5(float %X) {  ;; should turn into bitcast.
@@ -61,5 +81,22 @@
 	%a = bitcast float* %X1 to i32*
 	%tmp = load i32* %a
 	ret i32 %tmp
+; CHECK: @test5
+; CHECK-NEXT: bitcast float %X to i32
+; CHECK-NEXT: ret i32
+}
+
+
+;; should not turn into <1 x i64> - It is a banned MMX datatype.
+;; rdar://8380055
+define i64 @test6(<2 x float> %X) {
+	%X_addr = alloca <2 x float>
+        store <2 x float> %X, <2 x float>* %X_addr
+	%P = bitcast <2 x float>* %X_addr to i64*
+	%tmp = load i64* %P
+	ret i64 %tmp
+; CHECK: @test6
+; CHECK-NEXT: bitcast <2 x float> %X to i64
+; CHECK-NEXT: ret i64
 }
 

Modified: llvm/branches/wendling/eh/test/Transforms/SimplifyCFG/2008-04-27-MultipleReturnCrash.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/SimplifyCFG/2008-04-27-MultipleReturnCrash.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/SimplifyCFG/2008-04-27-MultipleReturnCrash.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/SimplifyCFG/2008-04-27-MultipleReturnCrash.ll Tue Oct 26 19:48:03 2010
@@ -1,7 +1,7 @@
 ; RUN: opt < %s -simplifycfg -disable-output
 ; PR2256
 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
-target triple = "x86_64-mingw32"
+target triple = "x86_64-pc-mingw32"
 
 define { x86_fp80, x86_fp80 } @catanl({ x86_fp80, x86_fp80 }* byval  %Z, i1 %cond) nounwind  {
 bb:		; preds = %entry

Modified: llvm/branches/wendling/eh/test/Transforms/SimplifyCFG/basictest.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/SimplifyCFG/basictest.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/SimplifyCFG/basictest.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/SimplifyCFG/basictest.ll Tue Oct 26 19:48:03 2010
@@ -54,6 +54,5 @@
 return:                                           ; preds = %entry
   ret void
 ; CHECK: @test5
-; CHECK-NEXT: bb:
 ; CHECK-NEXT: ret void
 }

Modified: llvm/branches/wendling/eh/test/Transforms/SimplifyLibCalls/StrChr.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/SimplifyLibCalls/StrChr.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/SimplifyLibCalls/StrChr.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/SimplifyLibCalls/StrChr.ll Tue Oct 26 19:48:03 2010
@@ -1,26 +1,26 @@
 ; Test that the StrChrOptimizer works correctly
-; RUN: opt < %s -simplify-libcalls -S | \
-; RUN:   not grep {call.*@strchr}
+; RUN: opt < %s -simplify-libcalls -S | FileCheck %s
 
 ; This transformation requires the pointer size, as it assumes that size_t is
 ; the size of a pointer.
 target datalayout = "-p:64:64:64"
 
- at hello = constant [14 x i8] c"hello world\5Cn\00"		; <[14 x i8]*> [#uses=1]
- at null = constant [1 x i8] zeroinitializer		; <[1 x i8]*> [#uses=1]
+ at hello = constant [14 x i8] c"hello world\5Cn\00"
+ at null = constant [1 x i8] zeroinitializer
 
 declare i8* @strchr(i8*, i32)
 
-declare i32 @puts(i8*)
-
-define i32 @main() {
-	%hello_p = getelementptr [14 x i8]* @hello, i32 0, i32 0		; <i8*> [#uses=2]
-	%null_p = getelementptr [1 x i8]* @null, i32 0, i32 0		; <i8*> [#uses=1]
-	%world = call i8* @strchr( i8* %hello_p, i32 119 )		; <i8*> [#uses=1]
-	%ignore = call i8* @strchr( i8* %null_p, i32 119 )		; <i8*> [#uses=0]
-	%len = call i32 @puts( i8* %world )		; <i32> [#uses=1]
-	%index = add i32 %len, 112		; <i32> [#uses=2]
-	%result = call i8* @strchr( i8* %hello_p, i32 %index )		; <i8*> [#uses=0]
+define i32 @foo(i32 %index) {
+	%hello_p = getelementptr [14 x i8]* @hello, i32 0, i32 0
+	%null_p = getelementptr [1 x i8]* @null, i32 0, i32 0
+	%world = call i8* @strchr(i8* %hello_p, i32 119)
+; CHECK: getelementptr i8* %hello_p, i64 6
+	%ignore = call i8* @strchr(i8* %null_p, i32 119)
+; CHECK-NOT: call i8* strchr
+	%null = call i8* @strchr(i8* %hello_p, i32 0)
+; CHECK: getelementptr i8* %hello_p, i64 13
+	%result = call i8* @strchr(i8* %hello_p, i32 %index)
+; CHECK: call i8* @memchr(i8* %hello_p, i32 %index, i64 14)
 	ret i32 %index
 }
 

Modified: llvm/branches/wendling/eh/test/Transforms/Sink/basic.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/Sink/basic.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/Sink/basic.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/Sink/basic.ll Tue Oct 26 19:48:03 2010
@@ -1,4 +1,4 @@
-; RUN: opt < %s -sink -S | FileCheck %s
+; RUN: opt < %s -basicaa -sink -S | FileCheck %s
 
 @A = external global i32
 @B = external global i32

Modified: llvm/branches/wendling/eh/test/Transforms/TailCallElim/accum_recursion.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/TailCallElim/accum_recursion.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/TailCallElim/accum_recursion.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/TailCallElim/accum_recursion.ll Tue Oct 26 19:48:03 2010
@@ -1,15 +1,74 @@
-; RUN: opt < %s -tailcallelim -S | not grep call
+; RUN: opt < %s -tailcallelim -S | FileCheck %s
 
-define i32 @factorial(i32 %x) {
+define i32 @test1_factorial(i32 %x) {
 entry:
 	%tmp.1 = icmp sgt i32 %x, 0		; <i1> [#uses=1]
 	br i1 %tmp.1, label %then, label %else
 then:		; preds = %entry
 	%tmp.6 = add i32 %x, -1		; <i32> [#uses=1]
-	%tmp.4 = call i32 @factorial( i32 %tmp.6 )		; <i32> [#uses=1]
+	%tmp.4 = call i32 @test1_factorial( i32 %tmp.6 )		; <i32> [#uses=1]
 	%tmp.7 = mul i32 %tmp.4, %x		; <i32> [#uses=1]
 	ret i32 %tmp.7
 else:		; preds = %entry
 	ret i32 1
 }
 
+; CHECK: define i32 @test1_factorial
+; CHECK: phi i32
+; CHECK-NOT: call i32
+; CHECK: else:
+
+; This is a more aggressive form of accumulator recursion insertion, which 
+; requires noticing that X doesn't change as we perform the tailcall.
+
+define i32 @test2_mul(i32 %x, i32 %y) {
+entry:
+	%tmp.1 = icmp eq i32 %y, 0		; <i1> [#uses=1]
+	br i1 %tmp.1, label %return, label %endif
+endif:		; preds = %entry
+	%tmp.8 = add i32 %y, -1		; <i32> [#uses=1]
+	%tmp.5 = call i32 @test2_mul( i32 %x, i32 %tmp.8 )		; <i32> [#uses=1]
+	%tmp.9 = add i32 %tmp.5, %x		; <i32> [#uses=1]
+	ret i32 %tmp.9
+return:		; preds = %entry
+	ret i32 %x
+}
+
+; CHECK: define i32 @test2_mul
+; CHECK: phi i32
+; CHECK-NOT: call i32
+; CHECK: return:
+
+
+define i64 @test3_fib(i64 %n) nounwind readnone {
+; CHECK: @test3_fib
+entry:
+; CHECK: tailrecurse:
+; CHECK: %accumulator.tr = phi i64 [ %n, %entry ], [ %3, %bb1 ]
+; CHECK: %n.tr = phi i64 [ %n, %entry ], [ %2, %bb1 ]
+  switch i64 %n, label %bb1 [
+; CHECK: switch i64 %n.tr, label %bb1 [
+    i64 0, label %bb2
+    i64 1, label %bb2
+  ]
+
+bb1:
+; CHECK: bb1:
+  %0 = add i64 %n, -1
+; CHECK: %0 = add i64 %n.tr, -1
+  %1 = tail call i64 @test3_fib(i64 %0) nounwind
+; CHECK: %1 = tail call i64 @test3_fib(i64 %0)
+  %2 = add i64 %n, -2
+; CHECK: %2 = add i64 %n.tr, -2
+  %3 = tail call i64 @test3_fib(i64 %2) nounwind
+; CHECK-NOT: tail call i64 @test3_fib
+  %4 = add nsw i64 %3, %1
+; CHECK: add nsw i64 %accumulator.tr, %1
+  ret i64 %4
+; CHECK: br label %tailrecurse
+
+bb2:
+; CHECK: bb2:
+  ret i64 %n
+; CHECK: ret i64 %accumulator.tr
+}

Removed: llvm/branches/wendling/eh/test/Transforms/TailCallElim/accum_recursion_constant_arg.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/TailCallElim/accum_recursion_constant_arg.ll?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/TailCallElim/accum_recursion_constant_arg.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/TailCallElim/accum_recursion_constant_arg.ll (removed)
@@ -1,20 +0,0 @@
-; This is a more aggressive form of accumulator recursion insertion, which 
-; requires noticing that X doesn't change as we perform the tailcall.  Thanks
-; go out to the anonymous users of the demo script for "suggesting" 
-; optimizations that should be done.  :)
-
-; RUN: opt < %s -tailcallelim -S | not grep call
-
-define i32 @mul(i32 %x, i32 %y) {
-entry:
-	%tmp.1 = icmp eq i32 %y, 0		; <i1> [#uses=1]
-	br i1 %tmp.1, label %return, label %endif
-endif:		; preds = %entry
-	%tmp.8 = add i32 %y, -1		; <i32> [#uses=1]
-	%tmp.5 = call i32 @mul( i32 %x, i32 %tmp.8 )		; <i32> [#uses=1]
-	%tmp.9 = add i32 %tmp.5, %x		; <i32> [#uses=1]
-	ret i32 %tmp.9
-return:		; preds = %entry
-	ret i32 %x
-}
-

Removed: llvm/branches/wendling/eh/test/Transforms/TailCallElim/switch.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/TailCallElim/switch.ll?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/TailCallElim/switch.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/TailCallElim/switch.ll (removed)
@@ -1,34 +0,0 @@
-; RUN: opt %s -tailcallelim -S | FileCheck %s
-
-define i64 @fib(i64 %n) nounwind readnone {
-; CHECK: @fib
-entry:
-; CHECK: tailrecurse:
-; CHECK: %accumulator.tr = phi i64 [ %n, %entry ], [ %3, %bb1 ]
-; CHECK: %n.tr = phi i64 [ %n, %entry ], [ %2, %bb1 ]
-  switch i64 %n, label %bb1 [
-; CHECK: switch i64 %n.tr, label %bb1 [
-    i64 0, label %bb2
-    i64 1, label %bb2
-  ]
-
-bb1:
-; CHECK: bb1:
-  %0 = add i64 %n, -1
-; CHECK: %0 = add i64 %n.tr, -1
-  %1 = tail call i64 @fib(i64 %0) nounwind
-; CHECK: %1 = tail call i64 @fib(i64 %0)
-  %2 = add i64 %n, -2
-; CHECK: %2 = add i64 %n.tr, -2
-  %3 = tail call i64 @fib(i64 %2) nounwind
-; CHECK-NOT: tail call i64 @fib
-  %4 = add nsw i64 %3, %1
-; CHECK: add nsw i64 %accumulator.tr, %1
-  ret i64 %4
-; CHECK: br label %tailrecurse
-
-bb2:
-; CHECK: bb2:
-  ret i64 %n
-; CHECK: ret i64 %accumulator.tr
-}

Modified: llvm/branches/wendling/eh/test/Transforms/TailDup/2008-06-11-AvoidDupLoopHeader.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/Transforms/TailDup/2008-06-11-AvoidDupLoopHeader.ll?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/Transforms/TailDup/2008-06-11-AvoidDupLoopHeader.ll (original)
+++ llvm/branches/wendling/eh/test/Transforms/TailDup/2008-06-11-AvoidDupLoopHeader.ll Tue Oct 26 19:48:03 2010
@@ -1,4 +1,4 @@
-; RUN: opt < %s -tailduplicate -taildup-threshold=3 -stats -disable-output | not grep tailduplicate
+; RUN: opt < %s -tailduplicate -taildup-threshold=3 -stats -disable-output |& not grep tailduplicate
 ; XFAIL: *
 
 define i32 @foo(i32 %l) nounwind  {

Modified: llvm/branches/wendling/eh/test/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/test/lit.cfg?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/test/lit.cfg (original)
+++ llvm/branches/wendling/eh/test/lit.cfg Tue Oct 26 19:48:03 2010
@@ -45,13 +45,22 @@
                                      config.environment['PATH']))
         config.environment['PATH'] = path
 
-# Propogate 'HOME' through the environment.
-config.environment['HOME'] = os.environ['HOME']
+# Propagate 'HOME' through the environment.
+if 'HOME' in os.environ:
+    config.environment['HOME'] = os.environ['HOME']
+
+# Propagate 'INCLUDE' through the environment.
+if 'INCLUDE' in os.environ:
+    config.environment['INCLUDE'] = os.environ['INCLUDE']
+
+# Propagate 'LIB' through the environment.
+if 'LIB' in os.environ:
+    config.environment['LIB'] = os.environ['LIB']
 
-# Propogate LLVM_SRC_ROOT into the environment.
+# Propagate LLVM_SRC_ROOT into the environment.
 config.environment['LLVM_SRC_ROOT'] = getattr(config, 'llvm_src_root', '')
 
-# Propogate PYTHON_EXEUTABLE into the environment
+# Propagate PYTHON_EXECUTABLE into the environment
 config.environment['PYTHON_EXECUTABLE'] = getattr(config, 'python_executable',
                                                   '')
 
@@ -110,7 +119,7 @@
 site_exp = {}
 # FIXME: Implement lit.site.cfg.
 for line in open(os.path.join(config.llvm_obj_root, 'test', 'site.exp')):
-    m = re.match('set ([^ ]+) "([^"]*)"', line)
+    m = re.match('set ([^ ]+) "(.*)"', line)
     if m:
         site_exp[m.group(1)] = m.group(2)
 
@@ -147,13 +156,13 @@
 def llvm_supports_darwin_and_target(name):
     return 'darwin' in config.target_triple and llvm_supports_target(name)
 
-langs = set(site_exp['llvmgcc_langs'].split(','))
+langs = set([s.strip() for s in site_exp['llvmgcc_langs'].split(',')])
 def llvm_gcc_supports(name):
-    return name in langs
+    return name.strip() in langs
 
-bindings = set(site_exp['llvm_bindings'].split(','))
+bindings = set([s.strip() for s in site_exp['llvm_bindings'].split(',')])
 def llvm_supports_binding(name):
-    return name in bindings
+    return name.strip() in bindings
 
 # Provide on_clone hook for reading 'dg.exp'.
 import os

Modified: llvm/branches/wendling/eh/tools/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/CMakeLists.txt?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/tools/CMakeLists.txt (original)
+++ llvm/branches/wendling/eh/tools/CMakeLists.txt Tue Oct 26 19:48:03 2010
@@ -27,8 +27,10 @@
 add_subdirectory(lli)
 
 add_subdirectory(llvm-extract)
+add_subdirectory(llvm-diff)
 
 add_subdirectory(bugpoint)
+add_subdirectory(bugpoint-passes)
 add_subdirectory(llvm-bcanalyzer)
 add_subdirectory(llvm-stub)
 add_subdirectory(edis)

Modified: llvm/branches/wendling/eh/tools/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/Makefile?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/tools/Makefile (original)
+++ llvm/branches/wendling/eh/tools/Makefile Tue Oct 26 19:48:03 2010
@@ -21,7 +21,7 @@
                  llvm-ld llvm-prof llvm-link \
                  lli llvm-extract llvm-mc \
                  bugpoint llvm-bcanalyzer llvm-stub \
-                 llvmc
+                 llvmc llvm-diff
 
 # Let users override the set of tools to build from the command line.
 ifdef ONLY_TOOLS
@@ -45,6 +45,8 @@
       PARALLEL_DIRS += lto
     endif
 
+    PARALLEL_DIRS += bugpoint-passes
+
     # The edis library is only supported if ARM and/or X86 are enabled, and if
     # LLVM is being built PIC on platforms that support dylibs.
     ifneq ($(DISABLE_EDIS),1)

Propchange: llvm/branches/wendling/eh/tools/bugpoint-passes/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Oct 26 19:48:03 2010
@@ -0,0 +1,9 @@
+Debug
+Debug+Checks
+Debug+Coverage
+Debug+Coverage-Asserts
+Release
+Release-Asserts
+Release+Coverage
+Debug+Asserts
+Release+Asserts

Modified: llvm/branches/wendling/eh/tools/bugpoint/BugDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/bugpoint/BugDriver.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/tools/bugpoint/BugDriver.cpp (original)
+++ llvm/branches/wendling/eh/tools/bugpoint/BugDriver.cpp Tue Oct 26 19:48:03 2010
@@ -56,22 +56,22 @@
 /// getPassesString - Turn a list of passes into a string which indicates the
 /// command line options that must be passed to add the passes.
 ///
-std::string llvm::getPassesString(const std::vector<const PassInfo*> &Passes) {
+std::string llvm::getPassesString(const std::vector<std::string> &Passes) {
   std::string Result;
   for (unsigned i = 0, e = Passes.size(); i != e; ++i) {
     if (i) Result += " ";
     Result += "-";
-    Result += Passes[i]->getPassArgument();
+    Result += Passes[i];
   }
   return Result;
 }
 
-BugDriver::BugDriver(const char *toolname, bool as_child, bool find_bugs,
+BugDriver::BugDriver(const char *toolname, bool find_bugs,
                      unsigned timeout, unsigned memlimit, bool use_valgrind,
                      LLVMContext& ctxt)
   : Context(ctxt), ToolName(toolname), ReferenceOutputFile(OutputFile),
     Program(0), Interpreter(0), SafeInterpreter(0), gcc(0),
-    run_as_child(as_child), run_find_bugs(find_bugs), Timeout(timeout), 
+    run_find_bugs(find_bugs), Timeout(timeout), 
     MemoryLimit(memlimit), UseValgrind(use_valgrind) {}
 
 BugDriver::~BugDriver() {
@@ -119,15 +119,13 @@
   Program = ParseInputFile(Filenames[0], Context);
   if (Program == 0) return true;
     
-  if (!run_as_child)
-    outs() << "Read input file      : '" << Filenames[0] << "'\n";
+  outs() << "Read input file      : '" << Filenames[0] << "'\n";
 
   for (unsigned i = 1, e = Filenames.size(); i != e; ++i) {
     std::auto_ptr<Module> M(ParseInputFile(Filenames[i], Context));
     if (M.get() == 0) return true;
 
-    if (!run_as_child)
-      outs() << "Linking in input file: '" << Filenames[i] << "'\n";
+    outs() << "Linking in input file: '" << Filenames[i] << "'\n";
     std::string ErrorMessage;
     if (Linker::LinkModules(Program, M.get(), &ErrorMessage)) {
       errs() << ToolName << ": error linking in '" << Filenames[i] << "': "
@@ -136,8 +134,7 @@
     }
   }
 
-  if (!run_as_child)
-    outs() << "*** All input ok\n";
+  outs() << "*** All input ok\n";
 
   // All input files read successfully!
   return false;
@@ -149,14 +146,6 @@
 /// variables are set up from command line arguments.
 ///
 bool BugDriver::run(std::string &ErrMsg) {
-  // The first thing to do is determine if we're running as a child. If we are,
-  // then what to do is very narrow. This form of invocation is only called
-  // from the runPasses method to actually run those passes in a child process.
-  if (run_as_child) {
-    // Execute the passes
-    return runPassesAsChild(PassesToRun);
-  }
-  
   if (run_find_bugs) {
     // Rearrange the passes and apply them to the program. Repeat this process
     // until the user kills the program or we find a bug.
@@ -172,7 +161,7 @@
   // miscompilation.
   if (!PassesToRun.empty()) {
     outs() << "Running selected passes on program to test for crash: ";
-    if (runPasses(PassesToRun))
+    if (runPasses(Program, PassesToRun))
       return debugOptimizerCrash();
   }
 

Modified: llvm/branches/wendling/eh/tools/bugpoint/BugDriver.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/bugpoint/BugDriver.h?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/tools/bugpoint/BugDriver.h (original)
+++ llvm/branches/wendling/eh/tools/bugpoint/BugDriver.h Tue Oct 26 19:48:03 2010
@@ -17,6 +17,7 @@
 #define BUGDRIVER_H
 
 #include "llvm/ADT/ValueMap.h"
+#include "llvm/Transforms/Utils/ValueMapper.h"
 #include <vector>
 #include <string>
 
@@ -47,11 +48,10 @@
   const char *ToolName;            // argv[0] of bugpoint
   std::string ReferenceOutputFile; // Name of `good' output file
   Module *Program;             // The raw program, linked together
-  std::vector<const PassInfo*> PassesToRun;
+  std::vector<std::string> PassesToRun;
   AbstractInterpreter *Interpreter;   // How to run the program
   AbstractInterpreter *SafeInterpreter;  // To generate reference output, etc.
   GCC *gcc;
-  bool run_as_child;
   bool run_find_bugs;
   unsigned Timeout;
   unsigned MemoryLimit;
@@ -62,25 +62,24 @@
   friend class ReduceMisCodegenFunctions;
 
 public:
-  BugDriver(const char *toolname, bool as_child, bool find_bugs,
+  BugDriver(const char *toolname, bool find_bugs,
             unsigned timeout, unsigned memlimit, bool use_valgrind,
             LLVMContext& ctxt);
   ~BugDriver();
 
   const char *getToolName() const { return ToolName; }
 
-  LLVMContext& getContext() { return Context; }
+  LLVMContext& getContext() const { return Context; }
 
   // Set up methods... these methods are used to copy information about the
   // command line arguments into instance variables of BugDriver.
   //
   bool addSources(const std::vector<std::string> &FileNames);
-  template<class It>
-  void addPasses(It I, It E) { PassesToRun.insert(PassesToRun.end(), I, E); }
-  void setPassesToRun(const std::vector<const PassInfo*> &PTR) {
+  void addPass(std::string p) { PassesToRun.push_back(p); }
+  void setPassesToRun(const std::vector<std::string> &PTR) {
     PassesToRun = PTR;
   }
-  const std::vector<const PassInfo*> &getPassesToRun() const {
+  const std::vector<std::string> &getPassesToRun() const {
     return PassesToRun;
   }
 
@@ -132,12 +131,8 @@
 
   /// runPasses - Run all of the passes in the "PassesToRun" list, discard the
   /// output, and return true if any of the passes crashed.
-  bool runPasses(Module *M = 0) {
-    if (M == 0) M = Program;
-    std::swap(M, Program);
-    bool Result = runPasses(PassesToRun);
-    std::swap(M, Program);
-    return Result;
+  bool runPasses(Module *M) const {
+    return runPasses(M, PassesToRun);
   }
 
   Module *getProgram() const { return Program; }
@@ -169,7 +164,7 @@
   /// setting Error if an error occurs.  This is used for code generation
   /// crash testing.
   ///
-  void compileProgram(Module *M, std::string *Error);
+  void compileProgram(Module *M, std::string *Error) const;
 
   /// executeProgram - This method runs "Program", capturing the output of the
   /// program to a file.  A recommended filename may be optionally specified.
@@ -213,15 +208,14 @@
   /// "bugpoint-ID.bc".
   ///
   void EmitProgressBitcode(const Module *M, const std::string &ID,
-                           bool NoFlyer = false);
+                           bool NoFlyer = false) const;
 
   /// deleteInstructionFromProgram - This method clones the current Program and
   /// deletes the specified instruction from the cloned module.  It then runs a
   /// series of cleanup passes (ADCE and SimplifyCFG) to eliminate any code
   /// which depends on the value.  The modified module is then returned.
   ///
-  Module *deleteInstructionFromProgram(const Instruction *I, unsigned Simp)
-    const;
+  Module *deleteInstructionFromProgram(const Instruction *I, unsigned Simp);
 
   /// performFinalCleanups - This method clones the current Program and performs
   /// a series of cleanups intended to get rid of extra cruft on the module.  If
@@ -248,7 +242,7 @@
   /// failure.  If AutoDebugCrashes is set to true, then bugpoint will
   /// automatically attempt to track down a crashing pass if one exists, and
   /// this method will never return null.
-  Module *runPassesOn(Module *M, const std::vector<const PassInfo*> &Passes,
+  Module *runPassesOn(Module *M, const std::vector<std::string> &Passes,
                       bool AutoDebugCrashes = false, unsigned NumExtraArgs = 0,
                       const char * const *ExtraArgs = NULL);
 
@@ -261,7 +255,8 @@
   /// or failed, unless Quiet is set.  ExtraArgs specifies additional arguments
   /// to pass to the child bugpoint instance.
   ///
-  bool runPasses(const std::vector<const PassInfo*> &PassesToRun,
+  bool runPasses(Module *Program,
+                 const std::vector<std::string> &PassesToRun,
                  std::string &OutputFilename, bool DeleteOutput = false,
                  bool Quiet = false, unsigned NumExtraArgs = 0,
                  const char * const *ExtraArgs = NULL) const;
@@ -273,7 +268,7 @@
   /// If the passes did not compile correctly, output the command required to 
   /// recreate the failure. This returns true if a compiler error is found.
   ///
-  bool runManyPasses(const std::vector<const PassInfo*> &AllPasses,
+  bool runManyPasses(const std::vector<std::string> &AllPasses,
                      std::string &ErrMsg);
 
   /// writeProgramToFile - This writes the current "Program" to the named
@@ -286,15 +281,13 @@
   /// false indicating whether or not the optimizer crashed on the specified
   /// input (true = crashed).
   ///
-  bool runPasses(const std::vector<const PassInfo*> &PassesToRun,
+  bool runPasses(Module *M,
+                 const std::vector<std::string> &PassesToRun,
                  bool DeleteOutput = true) const {
     std::string Filename;
-    return runPasses(PassesToRun, Filename, DeleteOutput);
+    return runPasses(M, PassesToRun, Filename, DeleteOutput);
   }
 
-  /// runAsChild - The actual "runPasses" guts that runs in a child process.
-  int runPassesAsChild(const std::vector<const PassInfo*> &PassesToRun);
-
   /// initializeExecutionEnvironment - This method is used to set up the
   /// environment for executing LLVM programs.
   ///
@@ -311,7 +304,7 @@
 /// getPassesString - Turn a list of passes into a string which indicates the
 /// command line options that must be passed to add the passes.
 ///
-std::string getPassesString(const std::vector<const PassInfo*> &Passes);
+std::string getPassesString(const std::vector<std::string> &Passes);
 
 /// PrintFunctionList - prints out list of problematic functions
 ///
@@ -330,7 +323,7 @@
 /// module, split the functions OUT of the specified module, and place them in
 /// the new module.
 Module *SplitFunctionsOutOfModule(Module *M, const std::vector<Function*> &F,
-                                  ValueMap<const Value*, Value*> &VMap);
+                                  ValueToValueMapTy &VMap);
 
 } // End llvm namespace
 

Modified: llvm/branches/wendling/eh/tools/bugpoint/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/bugpoint/CMakeLists.txt?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/tools/bugpoint/CMakeLists.txt (original)
+++ llvm/branches/wendling/eh/tools/bugpoint/CMakeLists.txt Tue Oct 26 19:48:03 2010
@@ -9,7 +9,6 @@
   FindBugs.cpp
   Miscompilation.cpp
   OptimizerDriver.cpp
-  TestPasses.cpp
   ToolRunner.cpp
   bugpoint.cpp
   )

Modified: llvm/branches/wendling/eh/tools/bugpoint/CrashDebugger.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/bugpoint/CrashDebugger.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/tools/bugpoint/CrashDebugger.cpp (original)
+++ llvm/branches/wendling/eh/tools/bugpoint/CrashDebugger.cpp Tue Oct 26 19:48:03 2010
@@ -43,7 +43,7 @@
 }
 
 namespace llvm {
-  class ReducePassList : public ListReducer<const PassInfo*> {
+  class ReducePassList : public ListReducer<std::string> {
     BugDriver &BD;
   public:
     ReducePassList(BugDriver &bd) : BD(bd) {}
@@ -52,15 +52,15 @@
     // running the "Kept" passes fail when run on the output of the "removed"
     // passes.  If we return true, we update the current module of bugpoint.
     //
-    virtual TestResult doTest(std::vector<const PassInfo*> &Removed,
-                              std::vector<const PassInfo*> &Kept,
+    virtual TestResult doTest(std::vector<std::string> &Removed,
+                              std::vector<std::string> &Kept,
                               std::string &Error);
   };
 }
 
 ReducePassList::TestResult
-ReducePassList::doTest(std::vector<const PassInfo*> &Prefix,
-                       std::vector<const PassInfo*> &Suffix,
+ReducePassList::doTest(std::vector<std::string> &Prefix,
+                       std::vector<std::string> &Suffix,
                        std::string &Error) {
   sys::Path PrefixOutput;
   Module *OrigProgram = 0;
@@ -68,7 +68,7 @@
     outs() << "Checking to see if these passes crash: "
            << getPassesString(Prefix) << ": ";
     std::string PfxOutput;
-    if (BD.runPasses(Prefix, PfxOutput))
+    if (BD.runPasses(BD.getProgram(), Prefix, PfxOutput))
       return KeepPrefix;
 
     PrefixOutput.set(PfxOutput);
@@ -86,7 +86,7 @@
   outs() << "Checking to see if these passes crash: "
          << getPassesString(Suffix) << ": ";
 
-  if (BD.runPasses(Suffix)) {
+  if (BD.runPasses(BD.getProgram(), Suffix)) {
     delete OrigProgram;            // The suffix crashes alone...
     return KeepSuffix;
   }
@@ -106,10 +106,10 @@
   ///
   class ReduceCrashingGlobalVariables : public ListReducer<GlobalVariable*> {
     BugDriver &BD;
-    bool (*TestFn)(BugDriver &, Module *);
+    bool (*TestFn)(const BugDriver &, Module *);
   public:
     ReduceCrashingGlobalVariables(BugDriver &bd,
-                                  bool (*testFn)(BugDriver &, Module *))
+                                  bool (*testFn)(const BugDriver &, Module *))
       : BD(bd), TestFn(testFn) {}
 
     virtual TestResult doTest(std::vector<GlobalVariable*> &Prefix,
@@ -130,7 +130,7 @@
 ReduceCrashingGlobalVariables::TestGlobalVariables(
                               std::vector<GlobalVariable*> &GVs) {
   // Clone the program to try hacking it apart...
-  ValueMap<const Value*, Value*> VMap;
+  ValueToValueMapTy VMap;
   Module *M = CloneModule(BD.getProgram(), VMap);
 
   // Convert list to set for fast lookup...
@@ -176,10 +176,10 @@
   ///
   class ReduceCrashingFunctions : public ListReducer<Function*> {
     BugDriver &BD;
-    bool (*TestFn)(BugDriver &, Module *);
+    bool (*TestFn)(const BugDriver &, Module *);
   public:
     ReduceCrashingFunctions(BugDriver &bd,
-                            bool (*testFn)(BugDriver &, Module *))
+                            bool (*testFn)(const BugDriver &, Module *))
       : BD(bd), TestFn(testFn) {}
 
     virtual TestResult doTest(std::vector<Function*> &Prefix,
@@ -204,7 +204,7 @@
     return false;
 
   // Clone the program to try hacking it apart...
-  ValueMap<const Value*, Value*> VMap;
+  ValueToValueMapTy VMap;
   Module *M = CloneModule(BD.getProgram(), VMap);
 
   // Convert list to set for fast lookup...
@@ -249,9 +249,10 @@
   ///
   class ReduceCrashingBlocks : public ListReducer<const BasicBlock*> {
     BugDriver &BD;
-    bool (*TestFn)(BugDriver &, Module *);
+    bool (*TestFn)(const BugDriver &, Module *);
   public:
-    ReduceCrashingBlocks(BugDriver &bd, bool (*testFn)(BugDriver &, Module *))
+    ReduceCrashingBlocks(BugDriver &bd,
+                         bool (*testFn)(const BugDriver &, Module *))
       : BD(bd), TestFn(testFn) {}
 
     virtual TestResult doTest(std::vector<const BasicBlock*> &Prefix,
@@ -270,7 +271,7 @@
 
 bool ReduceCrashingBlocks::TestBlocks(std::vector<const BasicBlock*> &BBs) {
   // Clone the program to try hacking it apart...
-  ValueMap<const Value*, Value*> VMap;
+  ValueToValueMapTy VMap;
   Module *M = CloneModule(BD.getProgram(), VMap);
 
   // Convert list to set for fast lookup...
@@ -311,17 +312,24 @@
   // a "persistent mapping" by turning basic blocks into <function, name> pairs.
   // This won't work well if blocks are unnamed, but that is just the risk we
   // have to take.
-  std::vector<std::pair<Function*, std::string> > BlockInfo;
+  std::vector<std::pair<std::string, std::string> > BlockInfo;
 
   for (SmallPtrSet<BasicBlock*, 8>::iterator I = Blocks.begin(),
          E = Blocks.end(); I != E; ++I)
-    BlockInfo.push_back(std::make_pair((*I)->getParent(), (*I)->getName()));
+    BlockInfo.push_back(std::make_pair((*I)->getParent()->getName(),
+                                       (*I)->getName()));
 
   // Now run the CFG simplify pass on the function...
-  PassManager Passes;
-  Passes.add(createCFGSimplificationPass());
-  Passes.add(createVerifierPass());
-  Passes.run(*M);
+  std::vector<std::string> Passes;
+  Passes.push_back("simplifycfg");
+  Passes.push_back("verify");
+  Module *New = BD.runPassesOn(M, Passes);
+  delete M;
+  if (!New) {
+    errs() << "simplifycfg failed!\n";
+    exit(1);
+  }
+  M = New;
 
   // Try running on the hacked up program...
   if (TestFn(BD, M)) {
@@ -330,8 +338,10 @@
     // Make sure to use basic block pointers that point into the now-current
     // module, and that they don't include any deleted blocks.
     BBs.clear();
+    const ValueSymbolTable &GST = M->getValueSymbolTable();
     for (unsigned i = 0, e = BlockInfo.size(); i != e; ++i) {
-      ValueSymbolTable &ST = BlockInfo[i].first->getValueSymbolTable();
+      Function *F = cast<Function>(GST.lookup(BlockInfo[i].first));
+      ValueSymbolTable &ST = F->getValueSymbolTable();
       Value* V = ST.lookup(BlockInfo[i].second);
       if (V && V->getType() == Type::getLabelTy(V->getContext()))
         BBs.push_back(cast<BasicBlock>(V));
@@ -348,10 +358,10 @@
   ///
   class ReduceCrashingInstructions : public ListReducer<const Instruction*> {
     BugDriver &BD;
-    bool (*TestFn)(BugDriver &, Module *);
+    bool (*TestFn)(const BugDriver &, Module *);
   public:
-    ReduceCrashingInstructions(BugDriver &bd, bool (*testFn)(BugDriver &,
-                                                             Module *))
+    ReduceCrashingInstructions(BugDriver &bd,
+                               bool (*testFn)(const BugDriver &, Module *))
       : BD(bd), TestFn(testFn) {}
 
     virtual TestResult doTest(std::vector<const Instruction*> &Prefix,
@@ -371,7 +381,7 @@
 bool ReduceCrashingInstructions::TestInsts(std::vector<const Instruction*>
                                            &Insts) {
   // Clone the program to try hacking it apart...
-  ValueMap<const Value*, Value*> VMap;
+  ValueToValueMapTy VMap;
   Module *M = CloneModule(BD.getProgram(), VMap);
 
   // Convert list to set for fast lookup...
@@ -422,7 +432,8 @@
 /// DebugACrash - Given a predicate that determines whether a component crashes
 /// on a program, try to destructively reduce the program while still keeping
 /// the predicate true.
-static bool DebugACrash(BugDriver &BD, bool (*TestFn)(BugDriver &, Module *),
+static bool DebugACrash(BugDriver &BD,
+                        bool (*TestFn)(const BugDriver &, Module *),
                         std::string &Error) {
   // See if we can get away with nuking some of the global variable initializers
   // in the program...
@@ -607,7 +618,7 @@
   return false;
 }
 
-static bool TestForOptimizerCrash(BugDriver &BD, Module *M) {
+static bool TestForOptimizerCrash(const BugDriver &BD, Module *M) {
   return BD.runPasses(M);
 }
 
@@ -635,7 +646,7 @@
   return Success;
 }
 
-static bool TestForCodeGenCrash(BugDriver &BD, Module *M) {
+static bool TestForCodeGenCrash(const BugDriver &BD, Module *M) {
   std::string Error;
   BD.compileProgram(M, &Error);
   if (!Error.empty()) {

Modified: llvm/branches/wendling/eh/tools/bugpoint/ExecutionDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/bugpoint/ExecutionDriver.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/tools/bugpoint/ExecutionDriver.cpp (original)
+++ llvm/branches/wendling/eh/tools/bugpoint/ExecutionDriver.cpp Tue Oct 26 19:48:03 2010
@@ -293,7 +293,7 @@
 /// setting Error if an error occurs.  This is used for code generation
 /// crash testing.
 ///
-void BugDriver::compileProgram(Module *M, std::string *Error) {
+void BugDriver::compileProgram(Module *M, std::string *Error) const {
   // Emit the program to a bitcode file...
   sys::Path BitcodeFile (OutputPrefix + "-test-program.bc");
   std::string ErrMsg;

Modified: llvm/branches/wendling/eh/tools/bugpoint/ExtractFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/bugpoint/ExtractFunction.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/tools/bugpoint/ExtractFunction.cpp (original)
+++ llvm/branches/wendling/eh/tools/bugpoint/ExtractFunction.cpp Tue Oct 26 19:48:03 2010
@@ -29,7 +29,7 @@
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/FileUtilities.h"
-#include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/ToolOutputFile.h"
 #include "llvm/System/Path.h"
 #include "llvm/System/Signals.h"
 #include <set>
@@ -55,13 +55,14 @@
 /// depends on the value.  The modified module is then returned.
 ///
 Module *BugDriver::deleteInstructionFromProgram(const Instruction *I,
-                                                unsigned Simplification) const {
-  Module *Result = CloneModule(Program);
+                                                unsigned Simplification) {
+  // FIXME, use vmap?
+  Module *Clone = CloneModule(Program);
 
   const BasicBlock *PBB = I->getParent();
   const Function *PF = PBB->getParent();
 
-  Module::iterator RFI = Result->begin(); // Get iterator to corresponding fn
+  Module::iterator RFI = Clone->begin(); // Get iterator to corresponding fn
   std::advance(RFI, std::distance(PF->getParent()->begin(),
                                   Module::const_iterator(PF)));
 
@@ -79,30 +80,23 @@
   // Remove the instruction from the program.
   TheInst->getParent()->getInstList().erase(TheInst);
 
-  
-  //writeProgramToFile("current.bc", Result);
-    
   // Spiff up the output a little bit.
-  PassManager Passes;
-  // Make sure that the appropriate target data is always used...
-  Passes.add(new TargetData(Result));
+  std::vector<std::string> Passes;
 
-  /// FIXME: If this used runPasses() like the methods below, we could get rid
-  /// of the -disable-* options!
+  /// Can we get rid of the -disable-* options?
   if (Simplification > 1 && !NoDCE)
-    Passes.add(createDeadCodeEliminationPass());
+    Passes.push_back("dce");
   if (Simplification && !DisableSimplifyCFG)
-    Passes.add(createCFGSimplificationPass());      // Delete dead control flow
-
-  Passes.add(createVerifierPass());
-  Passes.run(*Result);
-  return Result;
-}
+    Passes.push_back("simplifycfg");      // Delete dead control flow
 
-static const PassInfo *getPI(Pass *P) {
-  const PassInfo *PI = P->getPassInfo();
-  delete P;
-  return PI;
+  Passes.push_back("verify");
+  Module *New = runPassesOn(Clone, Passes);
+  delete Clone;
+  if (!New) {
+    errs() << "Instruction removal failed.  Sorry. :(  Please report a bug!\n";
+    exit(1);
+  }
+  return New;
 }
 
 /// performFinalCleanups - This method clones the current Program and performs
@@ -114,15 +108,15 @@
   for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I)
     I->setLinkage(GlobalValue::ExternalLinkage);
 
-  std::vector<const PassInfo*> CleanupPasses;
-  CleanupPasses.push_back(getPI(createGlobalDCEPass()));
+  std::vector<std::string> CleanupPasses;
+  CleanupPasses.push_back("globaldce");
 
   if (MayModifySemantics)
-    CleanupPasses.push_back(getPI(createDeadArgHackingPass()));
+    CleanupPasses.push_back("deadarghaX0r");
   else
-    CleanupPasses.push_back(getPI(createDeadArgEliminationPass()));
+    CleanupPasses.push_back("deadargelim");
 
-  CleanupPasses.push_back(getPI(createDeadTypeEliminationPass()));
+  CleanupPasses.push_back("deadtypeelim");
 
   Module *New = runPassesOn(M, CleanupPasses);
   if (New == 0) {
@@ -138,8 +132,8 @@
 /// function.  This returns null if there are no extractable loops in the
 /// program or if the loop extractor crashes.
 Module *BugDriver::ExtractLoop(Module *M) {
-  std::vector<const PassInfo*> LoopExtractPasses;
-  LoopExtractPasses.push_back(getPI(createSingleLoopExtractorPass()));
+  std::vector<std::string> LoopExtractPasses;
+  LoopExtractPasses.push_back("loop-extract-single");
 
   Module *NewM = runPassesOn(M, LoopExtractPasses);
   if (NewM == 0) {
@@ -199,7 +193,7 @@
 /// static ctors/dtors, we need to add an llvm.global_[cd]tors global to M2, and
 /// prune appropriate entries out of M1s list.
 static void SplitStaticCtorDtor(const char *GlobalName, Module *M1, Module *M2,
-                                ValueMap<const Value*, Value*> &VMap) {
+                                ValueToValueMapTy &VMap) {
   GlobalVariable *GV = M1->getNamedGlobal(GlobalName);
   if (!GV || GV->isDeclaration() || GV->hasLocalLinkage() ||
       !GV->use_empty()) return;
@@ -262,7 +256,7 @@
 Module *
 llvm::SplitFunctionsOutOfModule(Module *M,
                                 const std::vector<Function*> &F,
-                                ValueMap<const Value*, Value*> &VMap) {
+                                ValueToValueMapTy &VMap) {
   // Make sure functions & globals are all external so that linkage
   // between the two modules will work.
   for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I)
@@ -274,7 +268,7 @@
     I->setLinkage(GlobalValue::ExternalLinkage);
   }
 
-  ValueMap<const Value*, Value*> NewVMap;
+  ValueToValueMapTy NewVMap;
   Module *New = CloneModule(M, NewVMap);
 
   // Make sure global initializers exist only in the safe module (CBE->.so)
@@ -331,7 +325,7 @@
   sys::RemoveFileOnSignal(uniqueFilename);
 
   std::string ErrorInfo;
-  raw_fd_ostream BlocksToNotExtractFile(uniqueFilename.c_str(), ErrorInfo);
+  tool_output_file BlocksToNotExtractFile(uniqueFilename.c_str(), ErrorInfo);
   if (!ErrorInfo.empty()) {
     outs() << "*** Basic Block extraction failed!\n";
     errs() << "Error writing list of blocks to not extract: " << ErrorInfo
@@ -345,16 +339,24 @@
     // If the BB doesn't have a name, give it one so we have something to key
     // off of.
     if (!BB->hasName()) BB->setName("tmpbb");
-    BlocksToNotExtractFile << BB->getParent()->getNameStr() << " "
-                           << BB->getName() << "\n";
+    BlocksToNotExtractFile.os() << BB->getParent()->getNameStr() << " "
+                                << BB->getName() << "\n";
+  }
+  BlocksToNotExtractFile.os().close();
+  if (BlocksToNotExtractFile.os().has_error()) {
+    errs() << "Error writing list of blocks to not extract: " << ErrorInfo
+           << "\n";
+    EmitProgressBitcode(M, "basicblockextractfail", true);
+    BlocksToNotExtractFile.os().clear_error();
+    return 0;
   }
-  BlocksToNotExtractFile.close();
+  BlocksToNotExtractFile.keep();
 
   std::string uniqueFN = "--extract-blocks-file=" + uniqueFilename.str();
   const char *ExtraArg = uniqueFN.c_str();
 
-  std::vector<const PassInfo*> PI;
-  PI.push_back(getPI(createBlockExtractorPass()));
+  std::vector<std::string> PI;
+  PI.push_back("extract-blocks");
   Module *Ret = runPassesOn(M, PI, false, 1, &ExtraArg);
 
   uniqueFilename.eraseFromDisk(); // Free disk space

Modified: llvm/branches/wendling/eh/tools/bugpoint/FindBugs.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/bugpoint/FindBugs.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/tools/bugpoint/FindBugs.cpp (original)
+++ llvm/branches/wendling/eh/tools/bugpoint/FindBugs.cpp Tue Oct 26 19:48:03 2010
@@ -29,7 +29,7 @@
 /// If the passes did not compile correctly, output the command required to 
 /// recreate the failure. This returns true if a compiler error is found.
 ///
-bool BugDriver::runManyPasses(const std::vector<const PassInfo*> &AllPasses,
+bool BugDriver::runManyPasses(const std::vector<std::string> &AllPasses,
                               std::string &ErrMsg) {
   setPassesToRun(AllPasses);
   outs() << "Starting bug finding procedure...\n\n";
@@ -58,11 +58,11 @@
     //
     outs() << "Running selected passes on program to test for crash: ";
     for(int i = 0, e = PassesToRun.size(); i != e; i++) {
-      outs() << "-" << PassesToRun[i]->getPassArgument() << " ";
+      outs() << "-" << PassesToRun[i] << " ";
     }
     
     std::string Filename;
-    if(runPasses(PassesToRun, Filename, false)) {
+    if(runPasses(Program, PassesToRun, Filename, false)) {
       outs() << "\n";
       outs() << "Optimizer passes caused failure!\n\n";
       debugOptimizerCrash();

Modified: llvm/branches/wendling/eh/tools/bugpoint/Miscompilation.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/bugpoint/Miscompilation.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/tools/bugpoint/Miscompilation.cpp (original)
+++ llvm/branches/wendling/eh/tools/bugpoint/Miscompilation.cpp Tue Oct 26 19:48:03 2010
@@ -43,13 +43,13 @@
         cl::desc("Don't extract blocks when searching for miscompilations"),
         cl::init(false));
 
-  class ReduceMiscompilingPasses : public ListReducer<const PassInfo*> {
+  class ReduceMiscompilingPasses : public ListReducer<std::string> {
     BugDriver &BD;
   public:
     ReduceMiscompilingPasses(BugDriver &bd) : BD(bd) {}
 
-    virtual TestResult doTest(std::vector<const PassInfo*> &Prefix,
-                              std::vector<const PassInfo*> &Suffix,
+    virtual TestResult doTest(std::vector<std::string> &Prefix,
+                              std::vector<std::string> &Suffix,
                               std::string &Error);
   };
 }
@@ -58,8 +58,8 @@
 /// group, see if they still break the program.
 ///
 ReduceMiscompilingPasses::TestResult
-ReduceMiscompilingPasses::doTest(std::vector<const PassInfo*> &Prefix,
-                                 std::vector<const PassInfo*> &Suffix,
+ReduceMiscompilingPasses::doTest(std::vector<std::string> &Prefix,
+                                 std::vector<std::string> &Suffix,
                                  std::string &Error) {
   // First, run the program with just the Suffix passes.  If it is still broken
   // with JUST the kept passes, discard the prefix passes.
@@ -67,7 +67,8 @@
          << "' compiles correctly: ";
 
   std::string BitcodeResult;
-  if (BD.runPasses(Suffix, BitcodeResult, false/*delete*/, true/*quiet*/)) {
+  if (BD.runPasses(BD.getProgram(), Suffix, BitcodeResult, false/*delete*/,
+                   true/*quiet*/)) {
     errs() << " Error running this sequence of passes"
            << " on the input program!\n";
     BD.setPassesToRun(Suffix);
@@ -104,7 +105,8 @@
   // kept passes, we can update our bitcode file to include the result of the
   // prefix passes, then discard the prefix passes.
   //
-  if (BD.runPasses(Prefix, BitcodeResult, false/*delete*/, true/*quiet*/)) {
+  if (BD.runPasses(BD.getProgram(), Prefix, BitcodeResult, false/*delete*/,
+                   true/*quiet*/)) {
     errs() << " Error running this sequence of passes"
            << " on the input program!\n";
     BD.setPassesToRun(Prefix);
@@ -144,7 +146,8 @@
             << getPassesString(Prefix) << "' passes: ";
 
   OwningPtr<Module> OriginalInput(BD.swapProgramIn(PrefixOutput.take()));
-  if (BD.runPasses(Suffix, BitcodeResult, false/*delete*/, true/*quiet*/)) {
+  if (BD.runPasses(BD.getProgram(), Suffix, BitcodeResult, false/*delete*/,
+                   true/*quiet*/)) {
     errs() << " Error running this sequence of passes"
            << " on the input program!\n";
     BD.setPassesToRun(Suffix);
@@ -258,7 +261,7 @@
   //   a function, we want to continue with the original function. Otherwise
   //   we can conclude that a function triggers the bug when in fact one
   //   needs a larger set of original functions to do so.
-  ValueMap<const Value*, Value*> VMap;
+  ValueToValueMapTy VMap;
   Module *Clone = CloneModule(BD.getProgram(), VMap);
   Module *Orig = BD.swapProgramIn(Clone);
 
@@ -307,7 +310,7 @@
   while (1) {
     if (BugpointIsInterrupted) return MadeChange;
     
-    ValueMap<const Value*, Value*> VMap;
+    ValueToValueMapTy VMap;
     Module *ToNotOptimize = CloneModule(BD.getProgram(), VMap);
     Module *ToOptimize = SplitFunctionsOutOfModule(ToNotOptimize,
                                                    MiscompiledFunctions,
@@ -473,7 +476,7 @@
   outs() << '\n';
 
   // Split the module into the two halves of the program we want.
-  ValueMap<const Value*, Value*> VMap;
+  ValueToValueMapTy VMap;
   Module *Clone = CloneModule(BD.getProgram(), VMap);
   Module *Orig = BD.swapProgramIn(Clone);
   std::vector<Function*> FuncsOnClone;
@@ -548,7 +551,7 @@
       return false;
   }
 
-  ValueMap<const Value*, Value*> VMap;
+  ValueToValueMapTy VMap;
   Module *ProgClone = CloneModule(BD.getProgram(), VMap);
   Module *ToExtract = SplitFunctionsOutOfModule(ProgClone,
                                                 MiscompiledFunctions,
@@ -735,7 +738,7 @@
 
   // Output a bunch of bitcode files for the user...
   outs() << "Outputting reduced bitcode files which expose the problem:\n";
-  ValueMap<const Value*, Value*> VMap;
+  ValueToValueMapTy VMap;
   Module *ToNotOptimize = CloneModule(getProgram(), VMap);
   Module *ToOptimize = SplitFunctionsOutOfModule(ToNotOptimize,
                                                  MiscompiledFunctions,
@@ -1008,7 +1011,7 @@
     return true;
 
   // Split the module into the two halves of the program we want.
-  ValueMap<const Value*, Value*> VMap;
+  ValueToValueMapTy VMap;
   Module *ToNotCodeGen = CloneModule(getProgram(), VMap);
   Module *ToCodeGen = SplitFunctionsOutOfModule(ToNotCodeGen, Funcs, VMap);
 

Modified: llvm/branches/wendling/eh/tools/bugpoint/OptimizerDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/bugpoint/OptimizerDriver.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/tools/bugpoint/OptimizerDriver.cpp (original)
+++ llvm/branches/wendling/eh/tools/bugpoint/OptimizerDriver.cpp Tue Oct 26 19:48:03 2010
@@ -27,7 +27,9 @@
 #include "llvm/Target/TargetData.h"
 #include "llvm/Support/FileUtilities.h"
 #include "llvm/Support/CommandLine.h"
-#include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/SystemUtils.h"
+#include "llvm/Support/Debug.h"
+#include "llvm/Support/ToolOutputFile.h"
 #include "llvm/System/Path.h"
 #include "llvm/System/Program.h"
 
@@ -53,12 +55,18 @@
 bool BugDriver::writeProgramToFile(const std::string &Filename,
                                    const Module *M) const {
   std::string ErrInfo;
-  raw_fd_ostream Out(Filename.c_str(), ErrInfo,
-                     raw_fd_ostream::F_Binary);
-  if (!ErrInfo.empty()) return true;
-  
-  WriteBitcodeToFile(M, Out);
-  return false;
+  tool_output_file Out(Filename.c_str(), ErrInfo,
+                       raw_fd_ostream::F_Binary);
+  if (ErrInfo.empty()) {
+    WriteBitcodeToFile(M, Out.os());
+    Out.os().close();
+    if (!Out.os().has_error()) {
+      Out.keep();
+      return false;
+    }
+  }
+  Out.os().clear_error();
+  return true;
 }
 
 
@@ -66,7 +74,8 @@
 /// to a file named "bugpoint-ID.bc".
 ///
 void BugDriver::EmitProgressBitcode(const Module *M,
-                                    const std::string &ID, bool NoFlyer) {
+                                    const std::string &ID,
+                                    bool NoFlyer)  const {
   // Output the input to the current pass to a bitcode file, emit a message
   // telling the user how to reproduce it: opt -foo blah.bc
   //
@@ -84,39 +93,12 @@
   outs() << getPassesString(PassesToRun) << "\n";
 }
 
-int BugDriver::runPassesAsChild(const std::vector<const PassInfo*> &Passes) {
-  std::string ErrInfo;
-  raw_fd_ostream OutFile(ChildOutput.c_str(), ErrInfo,
-                         raw_fd_ostream::F_Binary);
-  if (!ErrInfo.empty()) {
-    errs() << "Error opening bitcode file: " << ChildOutput << "\n";
-    return 1;
-  }
-
-  PassManager PM;
-  // Make sure that the appropriate target data is always used...
-  PM.add(new TargetData(Program));
-
-  for (unsigned i = 0, e = Passes.size(); i != e; ++i) {
-    if (Passes[i]->getNormalCtor())
-      PM.add(Passes[i]->getNormalCtor()());
-    else
-      errs() << "Cannot create pass yet: " << Passes[i]->getPassName() << "\n";
-  }
-  // Check that the module is well formed on completion of optimization
-  PM.add(createVerifierPass());
-
-  // Write bitcode out to disk as the last step...
-  PM.add(createBitcodeWriterPass(OutFile));
-
-  // Run all queued passes.
-  PM.run(*Program);
-
-  return 0;
-}
-
 cl::opt<bool> SilencePasses("silence-passes", cl::desc("Suppress output of running passes (both stdout and stderr)"));
 
+static cl::list<std::string> OptArgs("opt-args", cl::Positional,
+                                     cl::desc("<opt arguments>..."),
+                                     cl::ZeroOrMore, cl::PositionalEatsArgs);
+
 /// runPasses - Run the specified passes on Program, outputting a bitcode file
 /// and writing the filename into OutputFile if successful.  If the
 /// optimizations fail for some reason (optimizer crashes), return true,
@@ -125,7 +107,8 @@
 /// outs() a single line message indicating whether compilation was successful
 /// or failed.
 ///
-bool BugDriver::runPasses(const std::vector<const PassInfo*> &Passes,
+bool BugDriver::runPasses(Module *Program,
+                          const std::vector<std::string> &Passes,
                           std::string &OutputFilename, bool DeleteOutput,
                           bool Quiet, unsigned NumExtraArgs,
                           const char * const *ExtraArgs) const {
@@ -149,39 +132,47 @@
   }
   
   std::string ErrInfo;
-  raw_fd_ostream InFile(inputFilename.c_str(), ErrInfo,
-                        raw_fd_ostream::F_Binary);
+  tool_output_file InFile(inputFilename.c_str(), ErrInfo,
+                          raw_fd_ostream::F_Binary);
   
   
   if (!ErrInfo.empty()) {
     errs() << "Error opening bitcode file: " << inputFilename.str() << "\n";
     return 1;
   }
-  WriteBitcodeToFile(Program, InFile);
-  InFile.close();
+  WriteBitcodeToFile(Program, InFile.os());
+  InFile.os().close();
+  if (InFile.os().has_error()) {
+    errs() << "Error writing bitcode file: " << inputFilename.str() << "\n";
+    InFile.os().clear_error();
+    return 1;
+  }
+  InFile.keep();
 
   // setup the child process' arguments
   SmallVector<const char*, 8> Args;
-  sys::Path tool = sys::Program::FindProgramByName(ToolName);
+  sys::Path tool = FindExecutable("opt", getToolName(), (void*)"opt");
+  std::string Opt = tool.str();
   if (UseValgrind) {
     Args.push_back("valgrind");
     Args.push_back("--error-exitcode=1");
     Args.push_back("-q");
     Args.push_back(tool.c_str());
   } else
-    Args.push_back(ToolName);
+    Args.push_back(Opt.c_str());
 
-  Args.push_back("-as-child");
-  Args.push_back("-child-output");
+  Args.push_back("-o");
   Args.push_back(OutputFilename.c_str());
+  for (unsigned i = 0, e = OptArgs.size(); i != e; ++i)
+    Args.push_back(OptArgs[i].c_str());
   std::vector<std::string> pass_args;
   for (unsigned i = 0, e = PluginLoader::getNumPlugins(); i != e; ++i) {
     pass_args.push_back( std::string("-load"));
     pass_args.push_back( PluginLoader::getPlugin(i));
   }
-  for (std::vector<const PassInfo*>::const_iterator I = Passes.begin(),
+  for (std::vector<std::string>::const_iterator I = Passes.begin(),
        E = Passes.end(); I != E; ++I )
-    pass_args.push_back( std::string("-") + (*I)->getPassArgument() );
+    pass_args.push_back( std::string("-") + (*I) );
   for (std::vector<std::string>::const_iterator I = pass_args.begin(),
        E = pass_args.end(); I != E; ++I )
     Args.push_back(I->c_str());
@@ -190,6 +181,12 @@
     Args.push_back(*ExtraArgs);
   Args.push_back(0);
 
+  DEBUG(errs() << "\nAbout to run:\t";
+        for (unsigned i = 0, e = Args.size()-1; i != e; ++i)
+          errs() << " " << Args[i];
+        errs() << "\n";
+        );
+
   sys::Path prog;
   if (UseValgrind)
     prog = sys::Program::FindProgramByName("valgrind");
@@ -236,27 +233,22 @@
 /// module, returning the transformed module on success, or a null pointer on
 /// failure.
 Module *BugDriver::runPassesOn(Module *M,
-                               const std::vector<const PassInfo*> &Passes,
+                               const std::vector<std::string> &Passes,
                                bool AutoDebugCrashes, unsigned NumExtraArgs,
                                const char * const *ExtraArgs) {
-  Module *OldProgram = swapProgramIn(M);
   std::string BitcodeResult;
-  if (runPasses(Passes, BitcodeResult, false/*delete*/, true/*quiet*/,
+  if (runPasses(M, Passes, BitcodeResult, false/*delete*/, true/*quiet*/,
                 NumExtraArgs, ExtraArgs)) {
     if (AutoDebugCrashes) {
       errs() << " Error running this sequence of passes"
              << " on the input program!\n";
-      delete OldProgram;
-      EmitProgressBitcode(Program, "pass-error",  false);
+      delete swapProgramIn(M);
+      EmitProgressBitcode(M, "pass-error",  false);
       exit(debugOptimizerCrash());
     }
-    swapProgramIn(OldProgram);
     return 0;
   }
 
-  // Restore the current program.
-  swapProgramIn(OldProgram);
-
   Module *Ret = ParseInputFile(BitcodeResult, Context);
   if (Ret == 0) {
     errs() << getToolName() << ": Error reading bitcode file '"

Removed: llvm/branches/wendling/eh/tools/bugpoint/TestPasses.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/bugpoint/TestPasses.cpp?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/tools/bugpoint/TestPasses.cpp (original)
+++ llvm/branches/wendling/eh/tools/bugpoint/TestPasses.cpp (removed)
@@ -1,75 +0,0 @@
-//===- TestPasses.cpp - "buggy" passes used to test bugpoint --------------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file contains "buggy" passes that are used to test bugpoint, to check
-// that it is narrowing down testcases correctly.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/BasicBlock.h"
-#include "llvm/Constant.h"
-#include "llvm/Instructions.h"
-#include "llvm/Pass.h"
-#include "llvm/Type.h"
-#include "llvm/Support/InstVisitor.h"
-
-using namespace llvm;
-
-namespace {
-  /// CrashOnCalls - This pass is used to test bugpoint.  It intentionally
-  /// crashes on any call instructions.
-  class CrashOnCalls : public BasicBlockPass {
-  public:
-    static char ID; // Pass ID, replacement for typeid
-    CrashOnCalls() : BasicBlockPass(&ID) {}
-  private:
-    virtual void getAnalysisUsage(AnalysisUsage &AU) const {
-      AU.setPreservesAll();
-    }
-
-    bool runOnBasicBlock(BasicBlock &BB) {
-      for (BasicBlock::iterator I = BB.begin(), E = BB.end(); I != E; ++I)
-        if (isa<CallInst>(*I))
-          abort();
-
-      return false;
-    }
-  };
-
-  char CrashOnCalls::ID = 0;
-  RegisterPass<CrashOnCalls>
-  X("bugpoint-crashcalls",
-    "BugPoint Test Pass - Intentionally crash on CallInsts");
-}
-
-namespace {
-  /// DeleteCalls - This pass is used to test bugpoint.  It intentionally
-  /// deletes some call instructions, "misoptimizing" the program.
-  class DeleteCalls : public BasicBlockPass {
-  public:
-    static char ID; // Pass ID, replacement for typeid
-    DeleteCalls() : BasicBlockPass(&ID) {}
-  private:
-    bool runOnBasicBlock(BasicBlock &BB) {
-      for (BasicBlock::iterator I = BB.begin(), E = BB.end(); I != E; ++I)
-        if (CallInst *CI = dyn_cast<CallInst>(I)) {
-          if (!CI->use_empty())
-            CI->replaceAllUsesWith(Constant::getNullValue(CI->getType()));
-          CI->getParent()->getInstList().erase(CI);
-          break;
-        }
-      return false;
-    }
-  };
- 
-  char DeleteCalls::ID = 0;
-  RegisterPass<DeleteCalls>
-  Y("bugpoint-deletecalls",
-    "BugPoint Test Pass - Intentionally 'misoptimize' CallInsts");
-}

Modified: llvm/branches/wendling/eh/tools/bugpoint/bugpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/bugpoint/bugpoint.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/tools/bugpoint/bugpoint.cpp (original)
+++ llvm/branches/wendling/eh/tools/bugpoint/bugpoint.cpp Tue Oct 26 19:48:03 2010
@@ -29,13 +29,6 @@
 #include "llvm/LinkAllVMCore.h"
 using namespace llvm;
 
-// AsChild - Specifies that this invocation of bugpoint is being generated
-// from a parent process. It is not intended to be used by users so the 
-// option is hidden.
-static cl::opt<bool> 
-AsChild("as-child", cl::desc("Run bugpoint as child process"), 
-        cl::ReallyHidden);
-          
 static cl::opt<bool> 
 FindBugs("find-bugs", cl::desc("Run many different optimization sequences "
                                "on program to find bugs"), cl::init(false));
@@ -90,8 +83,9 @@
     AddToDriver(BugDriver &_D) : D(_D) {}
     
     virtual void add(Pass *P) {
-      const PassInfo *PI = P->getPassInfo();
-      D.addPasses(&PI, &PI + 1);
+      const void *ID = P->getPassID();
+      const PassInfo *PI = PassRegistry::getPassRegistry()->getPassInfo(ID);
+      D.addPass(PI->getPassArgument());
     }
   };
 }
@@ -100,6 +94,19 @@
   llvm::sys::PrintStackTraceOnErrorSignal();
   llvm::PrettyStackTraceProgram X(argc, argv);
   llvm_shutdown_obj Y;  // Call llvm_shutdown() on exit.
+  
+  // Initialize passes
+  PassRegistry &Registry = *PassRegistry::getPassRegistry();
+  initializeCore(Registry);
+  initializeScalarOpts(Registry);
+  initializeIPO(Registry);
+  initializeAnalysis(Registry);
+  initializeIPA(Registry);
+  initializeTransformUtils(Registry);
+  initializeInstCombine(Registry);
+  initializeInstrumentation(Registry);
+  initializeTarget(Registry);
+  
   cl::ParseCommandLineOptions(argc, argv,
                               "LLVM automatic testcase reducer. See\nhttp://"
                               "llvm.org/cmds/bugpoint.html"
@@ -110,8 +117,8 @@
   // If we have an override, set it and then track the triple we want Modules
   // to use.
   if (!OverrideTriple.empty()) {
-    TargetTriple.setTriple(OverrideTriple);
-    outs() << "Override triple set to '" << OverrideTriple << "'\n";
+    TargetTriple.setTriple(Triple::normalize(OverrideTriple));
+    outs() << "Override triple set to '" << TargetTriple.getTriple() << "'\n";
   }
 
   if (MemoryLimit < 0) {
@@ -123,7 +130,7 @@
       MemoryLimit = 100;
   }
 
-  BugDriver D(argv[0], AsChild, FindBugs, TimeoutValue, MemoryLimit,
+  BugDriver D(argv[0], FindBugs, TimeoutValue, MemoryLimit,
               UseValgrind, Context);
   if (D.addSources(InputFilenames)) return 1;
   
@@ -143,7 +150,13 @@
                             /*RunInliner=*/true,
                             /*VerifyEach=*/false);
 
-  D.addPasses(PassList.begin(), PassList.end());
+
+  for (std::vector<const PassInfo*>::iterator I = PassList.begin(),
+         E = PassList.end();
+       I != E; ++I) {
+    const PassInfo* PI = *I;
+    D.addPass(PI->getPassArgument());
+  }
 
   // Bugpoint has the ability of generating a plethora of core files, so to
   // avoid filling up the disk, we prevent it

Modified: llvm/branches/wendling/eh/tools/gold/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/gold/Makefile?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/tools/gold/Makefile (original)
+++ llvm/branches/wendling/eh/tools/gold/Makefile Tue Oct 26 19:48:03 2010
@@ -19,7 +19,6 @@
 
 LINK_LIBS_IN_SHARED=1
 SHARED_LIBRARY = 1
-BUILD_ARCHIVE = 0
 LOADABLE_MODULE = 1
 
 LINK_COMPONENTS := support system

Modified: llvm/branches/wendling/eh/tools/gold/README.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/gold/README.txt?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/tools/gold/README.txt (original)
+++ llvm/branches/wendling/eh/tools/gold/README.txt Tue Oct 26 19:48:03 2010
@@ -14,8 +14,8 @@
 
 To build the LLVMgold plugin, configure LLVM with the option
 --with-binutils-include=/path/to/binutils/src/include/ --enable-pic. To use the
-plugin, run "ld-new --plugin /path/to/libLLVMgold.so".
-Without PIC libLTO and libLLVMgold are not being built (because they would fail
+plugin, run "ld-new --plugin /path/to/LLVMgold.so".
+Without PIC libLTO and LLVMgold are not being built (because they would fail
 link on x86-64 with a relocation error: PIC and non-PIC can't be combined).
 As an alternative to passing --enable-pic, you can use 'make ENABLE_PIC=1' in
 your entire LLVM build.

Modified: llvm/branches/wendling/eh/tools/gold/gold-plugin.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/gold/gold-plugin.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/tools/gold/gold-plugin.cpp (original)
+++ llvm/branches/wendling/eh/tools/gold/gold-plugin.cpp Tue Oct 26 19:48:03 2010
@@ -17,7 +17,7 @@
 
 #include "llvm-c/lto.h"
 
-#include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/ToolOutputFile.h"
 #include "llvm/System/Errno.h"
 #include "llvm/System/Path.h"
 #include "llvm/System/Program.h"
@@ -66,8 +66,11 @@
   static generate_bc generate_bc_file = BC_NO;
   static std::string bc_path;
   static std::string as_path;
+  static std::vector<std::string> as_args;
   static std::vector<std::string> pass_through;
   static std::string extra_library_path;
+  static std::string triple;
+  static std::string mcpu;
   // Additional options to pass into the code generator.
   // Note: This array will contain all plugin options which are not claimed
   // as plugin exclusive to pass to the code generator.
@@ -83,6 +86,8 @@
 
     if (opt == "generate-api-file") {
       generate_api_file = true;
+    } else if (opt.startswith("mcpu=")) {
+      mcpu = opt.substr(strlen("mcpu="));
     } else if (opt.startswith("as=")) {
       if (!as_path.empty()) {
         (*message)(LDPL_WARNING, "Path to as specified twice. "
@@ -90,11 +95,16 @@
       } else {
         as_path = opt.substr(strlen("as="));
       }
+    } else if (opt.startswith("as-arg=")) {
+      llvm::StringRef item = opt.substr(strlen("as-arg="));
+      as_args.push_back(item.str());
     } else if (opt.startswith("extra-library-path=")) {
       extra_library_path = opt.substr(strlen("extra_library_path="));
     } else if (opt.startswith("pass-through=")) {
       llvm::StringRef item = opt.substr(strlen("pass-through="));
       pass_through.push_back(item.str());
+    } else if (opt.startswith("mtriple=")) {
+      triple = opt.substr(strlen("mtriple="));
     } else if (opt == "emit-llvm") {
       generate_bc_file = BC_ONLY;
     } else if (opt == "also-emit-llvm") {
@@ -270,6 +280,10 @@
                lto_get_error_message());
     return LDPS_ERR;
   }
+
+  if (!options::triple.empty())
+    lto_module_set_target_triple(cf.M, options::triple.c_str());
+
   cf.handle = file->handle;
   unsigned sym_count = lto_module_get_num_symbols(cf.M);
   cf.syms.reserve(sym_count);
@@ -394,6 +408,17 @@
     sys::Path p = sys::Program::FindProgramByName(options::as_path);
     lto_codegen_set_assembler_path(cg, p.c_str());
   }
+  if (!options::as_args.empty()) {
+    std::vector<const char *> as_args_p;
+    for (std::vector<std::string>::iterator I = options::as_args.begin(),
+           E = options::as_args.end(); I != E; ++I) {
+      as_args_p.push_back(I->c_str());
+    }
+    lto_codegen_set_assembler_args(cg, &as_args_p[0], as_args_p.size());
+  }
+  if (!options::mcpu.empty())
+    lto_codegen_set_cpu(cg, options::mcpu.c_str());
+
   // Pass through extra options to the code generator.
   if (!options::extra.empty()) {
     for (std::vector<std::string>::iterator it = options::extra.begin();
@@ -428,15 +453,22 @@
     (*message)(LDPL_ERROR, "%s", ErrMsg.c_str());
     return LDPS_ERR;
   }
-  raw_fd_ostream objFile(uniqueObjPath.c_str(), ErrMsg,
-                         raw_fd_ostream::F_Binary);
+  tool_output_file objFile(uniqueObjPath.c_str(), ErrMsg,
+                           raw_fd_ostream::F_Binary);
   if (!ErrMsg.empty()) {
     (*message)(LDPL_ERROR, "%s", ErrMsg.c_str());
     return LDPS_ERR;
   }
 
-  objFile.write(buffer, bufsize);
-  objFile.close();
+  objFile.os().write(buffer, bufsize);
+  objFile.os().close();
+  if (objFile.os().has_error()) {
+    (*message)(LDPL_ERROR, "Error writing output file '%s'",
+               uniqueObjPath.c_str());
+    objFile.os().clear_error();
+    return LDPS_ERR;
+  }
+  objFile.keep();
 
   lto_codegen_dispose(cg);
 

Modified: llvm/branches/wendling/eh/tools/llc/llc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llc/llc.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/tools/llc/llc.cpp (original)
+++ llvm/branches/wendling/eh/tools/llc/llc.cpp Tue Oct 26 19:48:03 2010
@@ -18,7 +18,6 @@
 #include "llvm/PassManager.h"
 #include "llvm/Pass.h"
 #include "llvm/ADT/Triple.h"
-#include "llvm/Analysis/Verifier.h"
 #include "llvm/Support/IRReader.h"
 #include "llvm/CodeGen/LinkAllAsmWriterComponents.h"
 #include "llvm/CodeGen/LinkAllCodegenComponents.h"
@@ -29,6 +28,7 @@
 #include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/PluginLoader.h"
 #include "llvm/Support/PrettyStackTrace.h"
+#include "llvm/Support/ToolOutputFile.h"
 #include "llvm/System/Host.h"
 #include "llvm/System/Signals.h"
 #include "llvm/Target/SubtargetFeature.h"
@@ -77,7 +77,9 @@
   cl::value_desc("a1,+a2,-a3,..."));
 
 static cl::opt<bool>
-RelaxAll("mc-relax-all", cl::desc("Relax all fixups"));
+RelaxAll("mc-relax-all",
+  cl::desc("When used with filetype=obj, "
+           "relax all fixups in the emitted object file"));
 
 cl::opt<TargetMachine::CodeGenFileType>
 FileType("filetype", cl::init(TargetMachine::CGFT_AssemblyFile),
@@ -122,87 +124,67 @@
   return outputFilename;
 }
 
-static formatted_raw_ostream *GetOutputStream(const char *TargetName,
-                                              Triple::OSType OS,
-                                              const char *ProgName) {
-  if (OutputFilename != "") {
-    if (OutputFilename == "-")
-      return new formatted_raw_ostream(outs(),
-                                       formatted_raw_ostream::PRESERVE_STREAM);
-
-    // Make sure that the Out file gets unlinked from the disk if we get a
-    // SIGINT
-    sys::RemoveFileOnSignal(sys::Path(OutputFilename));
-
-    std::string error;
-    raw_fd_ostream *FDOut =
-      new raw_fd_ostream(OutputFilename.c_str(), error,
-                         raw_fd_ostream::F_Binary);
-    if (!error.empty()) {
-      errs() << error << '\n';
-      delete FDOut;
-      return 0;
+static tool_output_file *GetOutputStream(const char *TargetName,
+                                         Triple::OSType OS,
+                                         const char *ProgName) {
+  // If we don't yet have an output filename, make one.
+  if (OutputFilename.empty()) {
+    if (InputFilename == "-")
+      OutputFilename = "-";
+    else {
+      OutputFilename = GetFileNameRoot(InputFilename);
+
+      switch (FileType) {
+      default: assert(0 && "Unknown file type");
+      case TargetMachine::CGFT_AssemblyFile:
+        if (TargetName[0] == 'c') {
+          if (TargetName[1] == 0)
+            OutputFilename += ".cbe.c";
+          else if (TargetName[1] == 'p' && TargetName[2] == 'p')
+            OutputFilename += ".cpp";
+          else
+            OutputFilename += ".s";
+        } else
+          OutputFilename += ".s";
+        break;
+      case TargetMachine::CGFT_ObjectFile:
+        if (OS == Triple::Win32)
+          OutputFilename += ".obj";
+        else
+          OutputFilename += ".o";
+        break;
+      case TargetMachine::CGFT_Null:
+        OutputFilename += ".null";
+        break;
+      }
     }
-    formatted_raw_ostream *Out =
-      new formatted_raw_ostream(*FDOut, formatted_raw_ostream::DELETE_STREAM);
-
-    return Out;
   }
 
-  if (InputFilename == "-") {
-    OutputFilename = "-";
-    return new formatted_raw_ostream(outs(),
-                                     formatted_raw_ostream::PRESERVE_STREAM);
-  }
-
-  OutputFilename = GetFileNameRoot(InputFilename);
-
+  // Decide if we need "binary" output.
   bool Binary = false;
   switch (FileType) {
   default: assert(0 && "Unknown file type");
   case TargetMachine::CGFT_AssemblyFile:
-    if (TargetName[0] == 'c') {
-      if (TargetName[1] == 0)
-        OutputFilename += ".cbe.c";
-      else if (TargetName[1] == 'p' && TargetName[2] == 'p')
-        OutputFilename += ".cpp";
-      else
-        OutputFilename += ".s";
-    } else
-      OutputFilename += ".s";
     break;
   case TargetMachine::CGFT_ObjectFile:
-    if (OS == Triple::Win32)
-      OutputFilename += ".obj";
-    else
-      OutputFilename += ".o";
-    Binary = true;
-    break;
   case TargetMachine::CGFT_Null:
-    OutputFilename += ".null";
     Binary = true;
     break;
   }
 
-  // Make sure that the Out file gets unlinked from the disk if we get a
-  // SIGINT
-  sys::RemoveFileOnSignal(sys::Path(OutputFilename));
-
+  // Open the file.
   std::string error;
   unsigned OpenFlags = 0;
   if (Binary) OpenFlags |= raw_fd_ostream::F_Binary;
-  raw_fd_ostream *FDOut = new raw_fd_ostream(OutputFilename.c_str(), error,
-                                             OpenFlags);
+  tool_output_file *FDOut = new tool_output_file(OutputFilename.c_str(), error,
+                                                 OpenFlags);
   if (!error.empty()) {
     errs() << error << '\n';
     delete FDOut;
     return 0;
   }
 
-  formatted_raw_ostream *Out =
-    new formatted_raw_ostream(*FDOut, formatted_raw_ostream::DELETE_STREAM);
-
-  return Out;
+  return FDOut;
 }
 
 // main - Entry point for the llc compiler.
@@ -237,7 +219,7 @@
 
   // If we are supposed to override the target triple, do so now.
   if (!TargetTriple.empty())
-    mod.setTargetTriple(TargetTriple);
+    mod.setTargetTriple(Triple::normalize(TargetTriple));
 
   Triple TheTriple(mod.getTargetTriple());
   if (TheTriple.getTriple().empty())
@@ -293,9 +275,9 @@
   TargetMachine &Target = *target.get();
 
   // Figure out where we are going to send the output...
-  formatted_raw_ostream *Out = GetOutputStream(TheTarget->getName(),
-                                               TheTriple.getOS(), argv[0]);
-  if (Out == 0) return 1;
+  OwningPtr<tool_output_file> Out
+    (GetOutputStream(TheTarget->getName(), TheTriple.getOS(), argv[0]));
+  if (!Out) return 1;
 
   CodeGenOpt::Level OLvl = CodeGenOpt::Default;
   switch (OptLevel) {
@@ -309,14 +291,6 @@
   case '3': OLvl = CodeGenOpt::Aggressive; break;
   }
 
-  // Request that addPassesToEmitFile run the Verifier after running
-  // passes which modify the IR.
-#ifndef NDEBUG
-  bool DisableVerify = false;
-#else
-  bool DisableVerify = true;
-#endif
-
   // Build up all of the passes that we want to do to the module.
   PassManager PM;
 
@@ -326,9 +300,6 @@
   else
     PM.add(new TargetData(&mod));
 
-  if (!NoVerify)
-    PM.add(createVerifierPass());
-
   // Override default to generate verbose assembly.
   Target.setAsmVerbosityDefault(true);
 
@@ -340,21 +311,21 @@
       Target.setMCRelaxAll(true);
   }
 
-  // Ask the target to add backend passes as necessary.
-  if (Target.addPassesToEmitFile(PM, *Out, FileType, OLvl,
-                                 DisableVerify)) {
-    errs() << argv[0] << ": target does not support generation of this"
-           << " file type!\n";
-    delete Out;
-    // And the Out file is empty and useless, so remove it now.
-    sys::Path(OutputFilename).eraseFromDisk();
-    return 1;
-  }
+  {
+    formatted_raw_ostream FOS(Out->os());
 
-  PM.run(mod);
+    // Ask the target to add backend passes as necessary.
+    if (Target.addPassesToEmitFile(PM, FOS, FileType, OLvl, NoVerify)) {
+      errs() << argv[0] << ": target does not support generation of this"
+             << " file type!\n";
+      return 1;
+    }
+
+    PM.run(mod);
+  }
 
-  // Delete the ostream.
-  delete Out;
+  // Declare success.
+  Out->keep();
 
   return 0;
 }

Modified: llvm/branches/wendling/eh/tools/lli/lli.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/lli/lli.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/tools/lli/lli.cpp (original)
+++ llvm/branches/wendling/eh/tools/lli/lli.cpp Tue Oct 26 19:48:03 2010
@@ -16,6 +16,7 @@
 #include "llvm/LLVMContext.h"
 #include "llvm/Module.h"
 #include "llvm/Type.h"
+#include "llvm/ADT/Triple.h"
 #include "llvm/Bitcode/ReaderWriter.h"
 #include "llvm/CodeGen/LinkAllCodegenComponents.h"
 #include "llvm/ExecutionEngine/GenericValue.h"
@@ -32,6 +33,14 @@
 #include "llvm/System/Signals.h"
 #include "llvm/Target/TargetSelect.h"
 #include <cerrno>
+
+#ifdef __CYGWIN__
+#include <cygwin/version.h>
+#if defined(CYGWIN_VERSION_DLL_MAJOR) && CYGWIN_VERSION_DLL_MAJOR<1007
+#define DO_NOTHING_ATEXIT 1
+#endif
+#endif
+
 using namespace llvm;
 
 namespace {
@@ -98,8 +107,11 @@
 static ExecutionEngine *EE = 0;
 
 static void do_shutdown() {
+  // Cygwin-1.5 invokes DLL's dtors before atexit handler.
+#ifndef DO_NOTHING_ATEXIT
   delete EE;
   llvm_shutdown();
+#endif
 }
 
 //===----------------------------------------------------------------------===//
@@ -157,7 +169,7 @@
 
   // If we are supposed to override the target triple, do so now.
   if (!TargetTriple.empty())
-    Mod->setTargetTriple(TargetTriple);
+    Mod->setTargetTriple(Triple::normalize(TargetTriple));
 
   CodeGenOpt::Level OLvl = CodeGenOpt::Default;
   switch (OptLevel) {

Modified: llvm/branches/wendling/eh/tools/llvm-as/llvm-as.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llvm-as/llvm-as.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/tools/llvm-as/llvm-as.cpp (original)
+++ llvm/branches/wendling/eh/tools/llvm-as/llvm-as.cpp Tue Oct 26 19:48:03 2010
@@ -25,7 +25,7 @@
 #include "llvm/Support/PrettyStackTrace.h"
 #include "llvm/Support/SourceMgr.h"
 #include "llvm/Support/SystemUtils.h"
-#include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/ToolOutputFile.h"
 #include "llvm/System/Signals.h"
 #include <memory>
 using namespace llvm;
@@ -68,22 +68,20 @@
     }
   }
 
-  // Make sure that the Out file gets unlinked from the disk if we get a
-  // SIGINT.
-  if (OutputFilename != "-")
-    sys::RemoveFileOnSignal(sys::Path(OutputFilename));
-
   std::string ErrorInfo;
-  std::auto_ptr<raw_ostream> Out
-  (new raw_fd_ostream(OutputFilename.c_str(), ErrorInfo,
-                      raw_fd_ostream::F_Binary));
+  OwningPtr<tool_output_file> Out
+  (new tool_output_file(OutputFilename.c_str(), ErrorInfo,
+                        raw_fd_ostream::F_Binary));
   if (!ErrorInfo.empty()) {
     errs() << ErrorInfo << '\n';
     exit(1);
   }
 
-  if (Force || !CheckBitcodeOutputToConsole(*Out, true))
-    WriteBitcodeToFile(M, *Out);
+  if (Force || !CheckBitcodeOutputToConsole(Out->os(), true))
+    WriteBitcodeToFile(M, Out->os());
+
+  // Declare success.
+  Out->keep();
 }
 
 int main(int argc, char **argv) {

Modified: llvm/branches/wendling/eh/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp (original)
+++ llvm/branches/wendling/eh/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp Tue Oct 26 19:48:03 2010
@@ -46,9 +46,6 @@
 static cl::opt<std::string>
   InputFilename(cl::Positional, cl::desc("<input bitcode>"), cl::init("-"));
 
-static cl::opt<std::string>
-  OutputFilename("-o", cl::init("-"), cl::desc("<output file>"));
-
 static cl::opt<bool> Dump("dump", cl::desc("Dump low level bitcode trace"));
 
 //===----------------------------------------------------------------------===//
@@ -239,6 +236,8 @@
     case bitc::FUNC_CODE_INST_VSELECT:      return "INST_VSELECT";
     case bitc::FUNC_CODE_DEBUG_LOC:         return "DEBUG_LOC";
     case bitc::FUNC_CODE_DEBUG_LOC_AGAIN:   return "DEBUG_LOC_AGAIN";
+    case bitc::FUNC_CODE_INST_CALL2:        return "INST_CALL2";
+    case bitc::FUNC_CODE_DEBUG_LOC2:        return "DEBUG_LOC2";
     }
   case bitc::TYPE_SYMTAB_BLOCK_ID:
     switch (CodeID) {
@@ -266,6 +265,10 @@
     case bitc::METADATA_NAMED_NODE:  return "METADATA_NAMED_NODE";
     case bitc::METADATA_KIND:        return "METADATA_KIND";
     case bitc::METADATA_ATTACHMENT:  return "METADATA_ATTACHMENT";
+    case bitc::METADATA_NODE2:       return "METADATA_NODE2";
+    case bitc::METADATA_FN_NODE2:    return "METADATA_FN_NODE2";
+    case bitc::METADATA_NAMED_NODE2: return "METADATA_NAMED_NODE2";
+    case bitc::METADATA_ATTACHMENT2: return "METADATA_ATTACHMENT2";
     }
   }
 }

Modified: llvm/branches/wendling/eh/tools/llvm-config/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llvm-config/CMakeLists.txt?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/tools/llvm-config/CMakeLists.txt (original)
+++ llvm/branches/wendling/eh/tools/llvm-config/CMakeLists.txt Tue Oct 26 19:48:03 2010
@@ -78,10 +78,13 @@
 add_custom_command(OUTPUT ${LIBDEPS}
   COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LIBDEPS_TMP} ${LIBDEPS}
   DEPENDS ${LIBDEPS_TMP}
-  COMMENT "Updated ${LIBDEPS} because dependencies changed")
+  COMMENT "Updating ${LIBDEPS} if necessary...")
 
+# This must stop the build if find-cycles.pl returns error:
 add_custom_command(OUTPUT ${FINAL_LIBDEPS}
-  COMMAND ${PERL_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/find-cycles.pl < ${LIBDEPS} > ${FINAL_LIBDEPS} || ${CMAKE_COMMAND} -E remove -f ${FINAL_LIBDEPS}
+  COMMAND ${CMAKE_COMMAND} -E remove -f ${FINAL_LIBDEPS} ${FINAL_LIBDEPS}.tmp
+  COMMAND ${PERL_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/find-cycles.pl < ${LIBDEPS} > ${FINAL_LIBDEPS}.tmp
+  COMMAND ${CMAKE_COMMAND} -E copy ${FINAL_LIBDEPS}.tmp ${FINAL_LIBDEPS}
   DEPENDS ${LIBDEPS}
   COMMENT "Checking for cyclic dependencies between LLVM libraries.")
 

Modified: llvm/branches/wendling/eh/tools/llvm-config/llvm-config.in.in
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llvm-config/llvm-config.in.in?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/tools/llvm-config/llvm-config.in.in (original)
+++ llvm/branches/wendling/eh/tools/llvm-config/llvm-config.in.in Tue Oct 26 19:48:03 2010
@@ -197,7 +197,7 @@
 Typical components:
   all                All LLVM libraries (default).
   backend            Either a native backend or the C backend.
-  engine             Either a native JIT or a bytecode interpreter.
+  engine             Either a native JIT or a bitcode interpreter.
 __EOD__
     exit(1);
 }

Modified: llvm/branches/wendling/eh/tools/llvm-diff/DifferenceEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llvm-diff/DifferenceEngine.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/tools/llvm-diff/DifferenceEngine.cpp (original)
+++ llvm/branches/wendling/eh/tools/llvm-diff/DifferenceEngine.cpp Tue Oct 26 19:48:03 2010
@@ -590,6 +590,39 @@
     unify(&*LI, &*RI);
     ++LI, ++RI;
   }
+
+  // If the terminators have different kinds, but one is an invoke and the
+  // other is an unconditional branch immediately following a call, unify
+  // the results and the destinations.
+  TerminatorInst *LTerm = LStart->getParent()->getTerminator();
+  TerminatorInst *RTerm = RStart->getParent()->getTerminator();
+  if (isa<BranchInst>(LTerm) && isa<InvokeInst>(RTerm)) {
+    if (cast<BranchInst>(LTerm)->isConditional()) return;
+    BasicBlock::iterator I = LTerm;
+    if (I == LStart->getParent()->begin()) return;
+    --I;
+    if (!isa<CallInst>(*I)) return;
+    CallInst *LCall = cast<CallInst>(&*I);
+    InvokeInst *RInvoke = cast<InvokeInst>(RTerm);
+    if (!equivalentAsOperands(LCall->getCalledValue(), RInvoke->getCalledValue()))
+      return;
+    if (!LCall->use_empty())
+      Values[LCall] = RInvoke;
+    tryUnify(LTerm->getSuccessor(0), RInvoke->getNormalDest());
+  } else if (isa<InvokeInst>(LTerm) && isa<BranchInst>(RTerm)) {
+    if (cast<BranchInst>(RTerm)->isConditional()) return;
+    BasicBlock::iterator I = RTerm;
+    if (I == RStart->getParent()->begin()) return;
+    --I;
+    if (!isa<CallInst>(*I)) return;
+    CallInst *RCall = cast<CallInst>(I);
+    InvokeInst *LInvoke = cast<InvokeInst>(LTerm);
+    if (!equivalentAsOperands(LInvoke->getCalledValue(), RCall->getCalledValue()))
+      return;
+    if (!LInvoke->use_empty())
+      Values[LInvoke] = RCall;
+    tryUnify(LInvoke->getNormalDest(), RTerm->getSuccessor(0));
+  }
 }
 
 }

Modified: llvm/branches/wendling/eh/tools/llvm-diff/DifferenceEngine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llvm-diff/DifferenceEngine.h?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/tools/llvm-diff/DifferenceEngine.h (original)
+++ llvm/branches/wendling/eh/tools/llvm-diff/DifferenceEngine.h Tue Oct 26 19:48:03 2010
@@ -79,8 +79,14 @@
       void addMatch(Instruction *L, Instruction *R) {
         Diff.push_back(DiffRecord(L, R));
       }
-      void addLeft(Instruction *L) { Diff.push_back(DiffRecord(L, 0)); }
-      void addRight(Instruction *R) { Diff.push_back(DiffRecord(0, R)); }
+      void addLeft(Instruction *L) {
+        // HACK: VS 2010 has a bug in the stdlib that requires this.
+        Diff.push_back(DiffRecord(L, DiffRecord::second_type(0)));
+      }
+      void addRight(Instruction *R) {
+        // HACK: VS 2010 has a bug in the stdlib that requires this.
+        Diff.push_back(DiffRecord(DiffRecord::first_type(0), R));
+      }
 
       unsigned getNumLines() const { return Diff.size(); }
       DiffChange getLineKind(unsigned I) const {
@@ -112,7 +118,7 @@
       virtual void logd(const DiffLogBuilder &Log) = 0;
 
     protected:
-      ~Consumer() {}
+      virtual ~Consumer() {}
     };
 
     /// A RAII object for recording the current context.
@@ -135,7 +141,7 @@
       virtual bool operator()(Value *L, Value *R) = 0;
 
     protected:
-      ~Oracle() {}
+      virtual ~Oracle() {}
     };
 
     DifferenceEngine(LLVMContext &context, Consumer &consumer)

Modified: llvm/branches/wendling/eh/tools/llvm-diff/llvm-diff.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llvm-diff/llvm-diff.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/tools/llvm-diff/llvm-diff.cpp (original)
+++ llvm/branches/wendling/eh/tools/llvm-diff/llvm-diff.cpp Tue Oct 26 19:48:03 2010
@@ -17,13 +17,12 @@
 #include "llvm/LLVMContext.h"
 #include "llvm/Module.h"
 #include "llvm/Type.h"
-#include "llvm/Assembly/Parser.h"
-#include "llvm/Bitcode/ReaderWriter.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/IRReader.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Support/SourceMgr.h"
@@ -34,48 +33,30 @@
 
 using namespace llvm;
 
-/// Reads a module from a file.  If the filename ends in .ll, it is
-/// interpreted as an assembly file;  otherwise, it is interpreted as
-/// bitcode.  On error, messages are written to stderr and null is
-/// returned.
+/// Reads a module from a file.  On error, messages are written to stderr
+/// and null is returned.
 static Module *ReadModule(LLVMContext &Context, StringRef Name) {
-  // LLVM assembly path.
-  if (Name.endswith(".ll")) {
-    SMDiagnostic Diag;
-    Module *M = ParseAssemblyFile(Name, Diag, Context);
-    if (M) return M;
-
+  SMDiagnostic Diag;
+  Module *M = ParseIRFile(Name, Diag, Context);
+  if (!M)
     Diag.Print("llvmdiff", errs());
-    return 0;
-  }
-
-  // Bitcode path.
-  MemoryBuffer *Buffer = MemoryBuffer::getFile(Name);
-
-  // ParseBitcodeFile takes ownership of the buffer if it succeeds.
-  std::string Error;
-  Module *M = ParseBitcodeFile(Buffer, Context, &Error);
-  if (M) return M;
-
-  errs() << "error parsing " << Name << ": " << Error;
-  delete Buffer;
-  return 0;
+  return M;
 }
 
 namespace {
-struct DiffContext {
-  DiffContext(Value *L, Value *R)
-    : L(L), R(R), Differences(false), IsFunction(isa<Function>(L)) {}
-  Value *L;
-  Value *R;
-  bool Differences;
-  bool IsFunction;
-  DenseMap<Value*,unsigned> LNumbering;
-  DenseMap<Value*,unsigned> RNumbering;
-};
+  struct DiffContext {
+    DiffContext(Value *L, Value *R)
+      : L(L), R(R), Differences(false), IsFunction(isa<Function>(L)) {}
+    Value *L;
+    Value *R;
+    bool Differences;
+    bool IsFunction;
+    DenseMap<Value*,unsigned> LNumbering;
+    DenseMap<Value*,unsigned> RNumbering;
+  };
+}
 
-void ComputeNumbering(Function *F, DenseMap<Value*,unsigned> &Numbering) {
-  unsigned BBN = 0;
+static void ComputeNumbering(Function *F, DenseMap<Value*,unsigned> &Numbering){
   unsigned IN = 0;
 
   // Arguments get the first numbers.
@@ -86,9 +67,8 @@
 
   // Walk the basic blocks in order.
   for (Function::iterator FI = F->begin(), FE = F->end(); FI != FE; ++FI) {
-    // Basic blocks have their own 'namespace'.
     if (!FI->hasName())
-      Numbering[&*FI] = BBN++;
+      Numbering[&*FI] = IN++;
 
     // Walk the instructions in order.
     for (BasicBlock::iterator BI = FI->begin(), BE = FI->end(); BI != BE; ++BI)
@@ -100,6 +80,7 @@
   assert(!Numbering.empty() && "asked for numbering but numbering was no-op");
 }
 
+namespace {
 class DiffConsumer : public DifferenceEngine::Consumer {
 private:
   raw_ostream &out;
@@ -275,7 +256,7 @@
   }
   
 };
-}
+} // end anonymous namespace
 
 static void diffGlobal(DifferenceEngine &Engine, Module *L, Module *R,
                        StringRef Name) {
@@ -294,14 +275,14 @@
     errs() << "No function named @" << Name << " in right module\n";
 }
 
-cl::opt<std::string> LeftFilename(cl::Positional,
-                                  cl::desc("<first file>"),
-                                  cl::Required);
-cl::opt<std::string> RightFilename(cl::Positional,
-                                   cl::desc("<second file>"),
-                                   cl::Required);
-cl::list<std::string> GlobalsToCompare(cl::Positional,
-                                       cl::desc("<globals to compare>"));
+static cl::opt<std::string> LeftFilename(cl::Positional,
+                                         cl::desc("<first file>"),
+                                         cl::Required);
+static cl::opt<std::string> RightFilename(cl::Positional,
+                                          cl::desc("<second file>"),
+                                          cl::Required);
+static cl::list<std::string> GlobalsToCompare(cl::Positional,
+                                              cl::desc("<globals to compare>"));
 
 int main(int argc, char **argv) {
   cl::ParseCommandLineOptions(argc, argv);

Modified: llvm/branches/wendling/eh/tools/llvm-dis/llvm-dis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llvm-dis/llvm-dis.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/tools/llvm-dis/llvm-dis.cpp (original)
+++ llvm/branches/wendling/eh/tools/llvm-dis/llvm-dis.cpp Tue Oct 26 19:48:03 2010
@@ -18,14 +18,16 @@
 
 #include "llvm/LLVMContext.h"
 #include "llvm/Module.h"
+#include "llvm/Type.h"
 #include "llvm/Bitcode/ReaderWriter.h"
+#include "llvm/Assembly/AssemblyAnnotationWriter.h"
 #include "llvm/Support/CommandLine.h"
+#include "llvm/Support/FormattedStream.h"
 #include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/PrettyStackTrace.h"
-#include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/ToolOutputFile.h"
 #include "llvm/System/Signals.h"
-#include <memory>
 using namespace llvm;
 
 static cl::opt<std::string>
@@ -41,6 +43,29 @@
 static cl::opt<bool>
 DontPrint("disable-output", cl::desc("Don't output the .ll file"), cl::Hidden);
 
+static cl::opt<bool>
+ShowAnnotations("show-annotations",
+                cl::desc("Add informational comments to the .ll file"));
+
+namespace {
+  
+class CommentWriter : public AssemblyAnnotationWriter {
+public:
+  void emitFunctionAnnot(const Function *F,
+                         formatted_raw_ostream &OS) {
+    OS << "; [#uses=" << F->getNumUses() << ']';  // Output # uses
+    OS << '\n';
+  }
+  void printInfoComment(const Value &V, formatted_raw_ostream &OS) {
+    if (V.getType()->isVoidTy()) return;
+      
+    OS.PadToColumn(50);
+    OS << "; [#uses=" << V.getNumUses() << ']';  // Output # uses
+  }
+};
+  
+} // end anon namespace
+
 int main(int argc, char **argv) {
   // Print a stack trace if we signal out.
   sys::PrintStackTraceOnErrorSignal();
@@ -88,23 +113,25 @@
     }
   }
 
-  // Make sure that the Out file gets unlinked from the disk if we get a
-  // SIGINT.
-  if (OutputFilename != "-")
-    sys::RemoveFileOnSignal(sys::Path(OutputFilename));
-
   std::string ErrorInfo;
-  std::auto_ptr<raw_fd_ostream> 
-  Out(new raw_fd_ostream(OutputFilename.c_str(), ErrorInfo,
-                         raw_fd_ostream::F_Binary));
+  OwningPtr<tool_output_file> 
+  Out(new tool_output_file(OutputFilename.c_str(), ErrorInfo,
+                           raw_fd_ostream::F_Binary));
   if (!ErrorInfo.empty()) {
     errs() << ErrorInfo << '\n';
     return 1;
   }
 
+  OwningPtr<AssemblyAnnotationWriter> Annotator;
+  if (ShowAnnotations)
+    Annotator.reset(new CommentWriter());
+  
   // All that llvm-dis does is write the assembly to a file.
   if (!DontPrint)
-    *Out << *M;
+    M->print(Out->os(), Annotator.get());
+
+  // Declare success.
+  Out->keep();
 
   return 0;
 }

Modified: llvm/branches/wendling/eh/tools/llvm-extract/llvm-extract.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llvm-extract/llvm-extract.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/tools/llvm-extract/llvm-extract.cpp (original)
+++ llvm/branches/wendling/eh/tools/llvm-extract/llvm-extract.cpp Tue Oct 26 19:48:03 2010
@@ -23,9 +23,10 @@
 #include "llvm/Support/IRReader.h"
 #include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/PrettyStackTrace.h"
-#include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/ToolOutputFile.h"
 #include "llvm/Support/SystemUtils.h"
 #include "llvm/System/Signals.h"
+#include "llvm/ADT/SmallPtrSet.h"
 #include <memory>
 using namespace llvm;
 
@@ -44,10 +45,6 @@
 static cl::opt<bool>
 DeleteFn("delete", cl::desc("Delete specified Globals from Module"));
 
-static cl::opt<bool>
-Relink("relink",
-       cl::desc("Turn external linkage for callees of function to delete"));
-
 // ExtractFuncs - The functions to extract from the module... 
 static cl::list<std::string>
 ExtractFuncs("func", cl::desc("Specify function to extract"),
@@ -71,9 +68,10 @@
   llvm_shutdown_obj Y;  // Call llvm_shutdown() on exit.
   cl::ParseCommandLineOptions(argc, argv, "llvm extractor\n");
 
+  // Use lazy loading, since we only care about selected global values.
   SMDiagnostic Err;
   std::auto_ptr<Module> M;
-  M.reset(ParseIRFile(InputFilename, Err, Context));
+  M.reset(getLazyIRFileModule(InputFilename, Err, Context));
 
   if (M.get() == 0) {
     Err.Print(argv[0], errs());
@@ -104,36 +102,73 @@
     GVs.push_back(GV);
   }
 
+  // Materialize requisite global values.
+  if (!DeleteFn)
+    for (size_t i = 0, e = GVs.size(); i != e; ++i) {
+      GlobalValue *GV = GVs[i];
+      if (GV->isMaterializable()) {
+        std::string ErrInfo;
+        if (GV->Materialize(&ErrInfo)) {
+          errs() << argv[0] << ": error reading input: " << ErrInfo << "\n";
+          return 1;
+        }
+      }
+    }
+  else {
+    // Deleting. Materialize every GV that's *not* in GVs.
+    SmallPtrSet<GlobalValue *, 8> GVSet(GVs.begin(), GVs.end());
+    for (Module::global_iterator I = M->global_begin(), E = M->global_end();
+         I != E; ++I) {
+      GlobalVariable *G = I;
+      if (!GVSet.count(G) && G->isMaterializable()) {
+        std::string ErrInfo;
+        if (G->Materialize(&ErrInfo)) {
+          errs() << argv[0] << ": error reading input: " << ErrInfo << "\n";
+          return 1;
+        }
+      }
+    }
+    for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I) {
+      Function *F = I;
+      if (!GVSet.count(F) && F->isMaterializable()) {
+        std::string ErrInfo;
+        if (F->Materialize(&ErrInfo)) {
+          errs() << argv[0] << ": error reading input: " << ErrInfo << "\n";
+          return 1;
+        }
+      }
+    }
+  }
+
   // In addition to deleting all other functions, we also want to spiff it
   // up a little bit.  Do this now.
   PassManager Passes;
   Passes.add(new TargetData(M.get())); // Use correct TargetData
 
-  Passes.add(createGVExtractionPass(GVs, DeleteFn, Relink));
+  Passes.add(createGVExtractionPass(GVs, DeleteFn));
   if (!DeleteFn)
     Passes.add(createGlobalDCEPass());           // Delete unreachable globals
   Passes.add(createStripDeadDebugInfoPass());    // Remove dead debug info
   Passes.add(createDeadTypeEliminationPass());   // Remove dead types...
   Passes.add(createStripDeadPrototypesPass());   // Remove dead func decls
 
-  // Make sure that the Output file gets unlinked from the disk if we get a
-  // SIGINT
-  sys::RemoveFileOnSignal(sys::Path(OutputFilename));
-
   std::string ErrorInfo;
-  raw_fd_ostream Out(OutputFilename.c_str(), ErrorInfo,
-                     raw_fd_ostream::F_Binary);
+  tool_output_file Out(OutputFilename.c_str(), ErrorInfo,
+                       raw_fd_ostream::F_Binary);
   if (!ErrorInfo.empty()) {
     errs() << ErrorInfo << '\n';
     return 1;
   }
 
   if (OutputAssembly)
-    Passes.add(createPrintModulePass(&Out));
-  else if (Force || !CheckBitcodeOutputToConsole(Out, true))
-    Passes.add(createBitcodeWriterPass(Out));
+    Passes.add(createPrintModulePass(&Out.os()));
+  else if (Force || !CheckBitcodeOutputToConsole(Out.os(), true))
+    Passes.add(createBitcodeWriterPass(Out.os()));
 
   Passes.run(*M.get());
 
+  // Declare success.
+  Out.keep();
+
   return 0;
 }

Modified: llvm/branches/wendling/eh/tools/llvm-ld/llvm-ld.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llvm-ld/llvm-ld.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/tools/llvm-ld/llvm-ld.cpp (original)
+++ llvm/branches/wendling/eh/tools/llvm-ld/llvm-ld.cpp Tue Oct 26 19:48:03 2010
@@ -35,7 +35,7 @@
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/PrettyStackTrace.h"
 #include "llvm/Support/SystemUtils.h"
-#include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/ToolOutputFile.h"
 #include "llvm/System/Signals.h"
 #include "llvm/Config/config.h"
 #include <memory>
@@ -145,8 +145,8 @@
   std::vector<const char*>::const_iterator I = args.begin(), E = args.end(); 
   for (; I != E; ++I)
     if (*I)
-      outs() << "'" << *I << "'" << " ";
-  outs() << "\n"; outs().flush();
+      errs() << "'" << *I << "'" << " ";
+  errs() << "\n";
 }
 
 /// CopyEnv - This function takes an array of environment variables and makes a
@@ -232,17 +232,20 @@
 void GenerateBitcode(Module* M, const std::string& FileName) {
 
   if (Verbose)
-    outs() << "Generating Bitcode To " << FileName << '\n';
+    errs() << "Generating Bitcode To " << FileName << '\n';
 
   // Create the output file.
   std::string ErrorInfo;
-  raw_fd_ostream Out(FileName.c_str(), ErrorInfo,
-                     raw_fd_ostream::F_Binary);
-  if (!ErrorInfo.empty())
+  tool_output_file Out(FileName.c_str(), ErrorInfo,
+                       raw_fd_ostream::F_Binary);
+  if (!ErrorInfo.empty()) {
     PrintAndExit(ErrorInfo, M);
+    return;
+  }
 
   // Write it out
-  WriteBitcodeToFile(M, Out);
+  WriteBitcodeToFile(M, Out.os());
+  Out.keep();
 }
 
 /// GenerateAssembly - generates a native assembly language source file from the
@@ -272,7 +275,7 @@
   args.push_back(0);
 
   if (Verbose) {
-    outs() << "Generating Assembly With: \n";
+    errs() << "Generating Assembly With: \n";
     PrintCommand(args);
   }
 
@@ -294,7 +297,7 @@
   args.push_back(0);
 
   if (Verbose) {
-    outs() << "Generating C Source With: \n";
+    errs() << "Generating C Source With: \n";
     PrintCommand(args);
   }
 
@@ -391,7 +394,7 @@
   Args.push_back(0);
 
   if (Verbose) {
-    outs() << "Generating Native Executable With:\n";
+    errs() << "Generating Native Executable With:\n";
     PrintCommand(Args);
   }
 
@@ -406,7 +409,7 @@
 /// bitcode file for the program.
 static void EmitShellScript(char **argv, Module *M) {
   if (Verbose)
-    outs() << "Emitting Shell Script\n";
+    errs() << "Emitting Shell Script\n";
 #if defined(_WIN32) || defined(__CYGWIN__)
   // Windows doesn't support #!/bin/sh style shell scripts in .exe files.  To
   // support windows systems, we copy the llvm-stub.exe executable from the
@@ -425,14 +428,14 @@
 
   // Output the script to start the program...
   std::string ErrorInfo;
-  raw_fd_ostream Out2(OutputFilename.c_str(), ErrorInfo);
+  tool_output_file Out2(OutputFilename.c_str(), ErrorInfo);
   if (!ErrorInfo.empty())
     PrintAndExit(ErrorInfo, M);
 
-  Out2 << "#!/bin/sh\n";
+  Out2.os() << "#!/bin/sh\n";
   // Allow user to setenv LLVMINTERP if lli is not in their PATH.
-  Out2 << "lli=${LLVMINTERP-lli}\n";
-  Out2 << "exec $lli \\\n";
+  Out2.os() << "lli=${LLVMINTERP-lli}\n";
+  Out2.os() << "exec $lli \\\n";
   // gcc accepts -l<lib> and implicitly searches /lib and /usr/lib.
   LibPaths.push_back("/lib");
   LibPaths.push_back("/usr/lib");
@@ -463,9 +466,10 @@
     if (FullLibraryPath.isEmpty())
       FullLibraryPath = sys::Path::FindLibrary(*i);
     if (!FullLibraryPath.isEmpty())
-      Out2 << "    -load=" << FullLibraryPath.str() << " \\\n";
+      Out2.os() << "    -load=" << FullLibraryPath.str() << " \\\n";
   }
-  Out2 << "    "  << BitcodeOutputFilename << " ${1+\"$@\"}\n";
+  Out2.os() << "    "  << BitcodeOutputFilename << " ${1+\"$@\"}\n";
+  Out2.keep();
 }
 
 // BuildLinkItems -- This function generates a LinkItemList for the LinkItems
@@ -510,6 +514,17 @@
   LLVMContext &Context = getGlobalContext();
   llvm_shutdown_obj Y;  // Call llvm_shutdown() on exit.
   
+  // Initialize passes
+  PassRegistry &Registry = *PassRegistry::getPassRegistry();
+  initializeCore(Registry);
+  initializeScalarOpts(Registry);
+  initializeIPO(Registry);
+  initializeAnalysis(Registry);
+  initializeIPA(Registry);
+  initializeTransformUtils(Registry);
+  initializeInstCombine(Registry);
+  initializeTarget(Registry);
+  
   // Initial global variable above for convenience printing of program name.
   progname = sys::Path(argv[0]).getBasename();
 

Modified: llvm/branches/wendling/eh/tools/llvm-link/llvm-link.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llvm-link/llvm-link.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/tools/llvm-link/llvm-link.cpp (original)
+++ llvm/branches/wendling/eh/tools/llvm-link/llvm-link.cpp Tue Oct 26 19:48:03 2010
@@ -20,7 +20,7 @@
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/PrettyStackTrace.h"
-#include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/ToolOutputFile.h"
 #include "llvm/Support/SystemUtils.h"
 #include "llvm/Support/IRReader.h"
 #include "llvm/System/Signals.h"
@@ -116,19 +116,13 @@
   if (DumpAsm) errs() << "Here's the assembly:\n" << *Composite;
 
   std::string ErrorInfo;
-  std::auto_ptr<raw_ostream> 
-  Out(new raw_fd_ostream(OutputFilename.c_str(), ErrorInfo,
-                         raw_fd_ostream::F_Binary));
+  tool_output_file Out(OutputFilename.c_str(), ErrorInfo,
+                       raw_fd_ostream::F_Binary);
   if (!ErrorInfo.empty()) {
     errs() << ErrorInfo << '\n';
     return 1;
   }
 
-    // Make sure that the Out file gets unlinked from the disk if we get a
-    // SIGINT
-  if (OutputFilename != "-")
-    sys::RemoveFileOnSignal(sys::Path(OutputFilename));
-
   if (verifyModule(*Composite)) {
     errs() << argv[0] << ": linked module is broken!\n";
     return 1;
@@ -136,9 +130,12 @@
 
   if (Verbose) errs() << "Writing bitcode...\n";
   if (OutputAssembly) {
-    *Out << *Composite;
-  } else if (Force || !CheckBitcodeOutputToConsole(*Out, true))
-    WriteBitcodeToFile(Composite.get(), *Out);
+    Out.os() << *Composite;
+  } else if (Force || !CheckBitcodeOutputToConsole(Out.os(), true))
+    WriteBitcodeToFile(Composite.get(), Out.os());
+
+  // Declare success.
+  Out.keep();
 
   return 0;
 }

Modified: llvm/branches/wendling/eh/tools/llvm-mc/Disassembler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llvm-mc/Disassembler.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/tools/llvm-mc/Disassembler.cpp (original)
+++ llvm/branches/wendling/eh/tools/llvm-mc/Disassembler.cpp Tue Oct 26 19:48:03 2010
@@ -24,6 +24,7 @@
 #include "llvm/Target/TargetRegistry.h"
 #include "llvm/ADT/OwningPtr.h"
 #include "llvm/ADT/Triple.h"
+#include "llvm/ADT/Twine.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/MemoryObject.h"
 #include "llvm/Support/raw_ostream.h"
@@ -53,7 +54,7 @@
 
 static bool PrintInsts(const MCDisassembler &DisAsm,
                        MCInstPrinter &Printer, const ByteArrayTy &Bytes,
-                       SourceMgr &SM) {
+                       SourceMgr &SM, raw_ostream &Out) {
   // Wrap the vector in a MemoryObject.
   VectorMemoryObject memoryObject(Bytes);
   
@@ -66,8 +67,8 @@
     
     if (DisAsm.getInstruction(Inst, Size, memoryObject, Index, 
                                /*REMOVE*/ nulls())) {
-      Printer.printInst(&Inst, outs());
-      outs() << "\n";
+      Printer.printInst(&Inst, Out);
+      Out << "\n";
     } else {
       SM.PrintMessage(SMLoc::getFromPointer(Bytes[Index].second),
                       "invalid instruction encoding", "warning");
@@ -127,7 +128,8 @@
 }
 
 int Disassembler::disassemble(const Target &T, const std::string &Triple,
-                              MemoryBuffer &Buffer) {
+                              MemoryBuffer &Buffer,
+                              raw_ostream &Out) {
   // Set up disassembler.
   OwningPtr<const MCAsmInfo> AsmInfo(T.createAsmInfo(Triple));
   
@@ -162,7 +164,7 @@
   ErrorOccurred |= ByteArrayFromString(ByteArray, Str, SM);
   
   if (!ByteArray.empty())
-    ErrorOccurred |= PrintInsts(*DisAsm, *IP, ByteArray, SM);
+    ErrorOccurred |= PrintInsts(*DisAsm, *IP, ByteArray, SM, Out);
     
   return ErrorOccurred;
 }
@@ -179,22 +181,24 @@
 }
 
 static int verboseEvaluator(uint64_t *V, unsigned R, void *Arg) {
-  EDDisassembler &disassembler = *((EDDisassembler *)Arg);
+  EDDisassembler &disassembler = *(EDDisassembler *)((void **)Arg)[0];
+  raw_ostream &Out = *(raw_ostream *)((void **)Arg)[1];
   
   if (const char *regName = disassembler.nameWithRegisterID(R))
-    outs() << "[" << regName << "/" << R << "]";
+    Out << "[" << regName << "/" << R << "]";
   
   if (disassembler.registerIsStackPointer(R))
-    outs() << "(sp)";
+    Out << "(sp)";
   if (disassembler.registerIsProgramCounter(R))
-    outs() << "(pc)";
+    Out << "(pc)";
   
   *V = 0;
   return 0;
 }
 
 int Disassembler::disassembleEnhanced(const std::string &TS, 
-                                      MemoryBuffer &Buffer) {
+                                      MemoryBuffer &Buffer,
+                                      raw_ostream &Out) {
   ByteArrayTy ByteArray;
   StringRef Str = Buffer.getBuffer();
   SourceMgr SM;
@@ -259,52 +263,52 @@
       return -1;
     }
     
-    outs() << '[';
+    Out << '[';
     int operandIndex = token->operandID();
     
     if (operandIndex >= 0)
-      outs() << operandIndex << "-";
+      Out << operandIndex << "-";
     
     switch (token->type()) {
-    default: outs() << "?"; break;
-    case EDToken::kTokenWhitespace: outs() << "w"; break;
-    case EDToken::kTokenPunctuation: outs() << "p"; break;
-    case EDToken::kTokenOpcode: outs() << "o"; break;
-    case EDToken::kTokenLiteral: outs() << "l"; break;
-    case EDToken::kTokenRegister: outs() << "r"; break;
+    default: Out << "?"; break;
+    case EDToken::kTokenWhitespace: Out << "w"; break;
+    case EDToken::kTokenPunctuation: Out << "p"; break;
+    case EDToken::kTokenOpcode: Out << "o"; break;
+    case EDToken::kTokenLiteral: Out << "l"; break;
+    case EDToken::kTokenRegister: Out << "r"; break;
     }
     
-    outs() << ":" << buf;
+    Out << ":" << buf;
   
     if (token->type() == EDToken::kTokenLiteral) {
-      outs() << "=";
+      Out << "=";
       if (token->literalSign())
-        outs() << "-";
+        Out << "-";
       uint64_t absoluteValue;
       if (token->literalAbsoluteValue(absoluteValue)) {
         errs() << "error: Couldn't get the value of a literal token\n";
         return -1;
       }
-      outs() << absoluteValue;
+      Out << absoluteValue;
     } else if (token->type() == EDToken::kTokenRegister) {
-      outs() << "=";
+      Out << "=";
       unsigned regID;
       if (token->registerID(regID)) {
         errs() << "error: Couldn't get the ID of a register token\n";
         return -1;
       }
-      outs() << "r" << regID;
+      Out << "r" << regID;
     }
     
-    outs() << "]";
+    Out << "]";
   }
   
-  outs() << " ";
+  Out << " ";
     
   if (inst->isBranch())
-    outs() << "<br> ";
+    Out << "<br> ";
   if (inst->isMove())
-    outs() << "<mov> ";
+    Out << "<mov> ";
   
   unsigned numOperands = inst->numOperands();
   
@@ -314,7 +318,7 @@
   }
   
   for (unsigned operandIndex = 0; operandIndex != numOperands; ++operandIndex) {
-    outs() << operandIndex << ":";
+    Out << operandIndex << ":";
     
     EDOperand *operand;
     if (inst->getOperand(operand, operandIndex)) {
@@ -323,12 +327,12 @@
     }
     
     uint64_t evaluatedResult;
-    evaluatedResult = operand->evaluate(evaluatedResult, verboseEvaluator,
-                                        disassembler);
-    outs() << "=" << evaluatedResult << " ";
+    void *Arg[] = { disassembler, &Out };
+    evaluatedResult = operand->evaluate(evaluatedResult, verboseEvaluator, Arg);
+    Out << "=" << evaluatedResult << " ";
   }
   
-  outs() << '\n';
+  Out << '\n';
   
   return 0;
 }

Modified: llvm/branches/wendling/eh/tools/llvm-mc/Disassembler.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llvm-mc/Disassembler.h?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/tools/llvm-mc/Disassembler.h (original)
+++ llvm/branches/wendling/eh/tools/llvm-mc/Disassembler.h Tue Oct 26 19:48:03 2010
@@ -21,15 +21,18 @@
 
 class Target;
 class MemoryBuffer;
+class raw_ostream;
 
 class Disassembler {
 public:
   static int disassemble(const Target &target, 
                          const std::string &tripleString,
-                         MemoryBuffer &buffer);
+                         MemoryBuffer &buffer,
+                         raw_ostream &Out);
   
   static int disassembleEnhanced(const std::string &tripleString,
-                                 MemoryBuffer &buffer);
+                                 MemoryBuffer &buffer,
+                                 raw_ostream &Out);
 };
   
 } // namespace llvm

Modified: llvm/branches/wendling/eh/tools/llvm-mc/llvm-mc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llvm-mc/llvm-mc.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/tools/llvm-mc/llvm-mc.cpp (original)
+++ llvm/branches/wendling/eh/tools/llvm-mc/llvm-mc.cpp Tue Oct 26 19:48:03 2010
@@ -27,12 +27,13 @@
 #include "llvm/Target/TargetSelect.h"
 #include "llvm/ADT/OwningPtr.h"
 #include "llvm/Support/CommandLine.h"
+#include "llvm/Support/FileUtilities.h"
 #include "llvm/Support/FormattedStream.h"
 #include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/PrettyStackTrace.h"
 #include "llvm/Support/SourceMgr.h"
-#include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/ToolOutputFile.h"
 #include "llvm/System/Host.h"
 #include "llvm/System/Signals.h"
 #include "Disassembler.h"
@@ -51,6 +52,10 @@
 static cl::opt<bool>
 ShowInst("show-inst", cl::desc("Show internal instruction representation"));
 
+static cl::opt<bool>
+ShowInstOperands("show-inst-operands",
+                 cl::desc("Show instructions operands as parsed"));
+
 static cl::opt<unsigned>
 OutputAsmVariant("output-asm-variant",
                  cl::desc("Syntax variant to use for output printing"));
@@ -135,6 +140,22 @@
   return 0;
 }
 
+static tool_output_file *GetOutputStream() {
+  if (OutputFilename == "")
+    OutputFilename = "-";
+
+  std::string Err;
+  tool_output_file *Out = new tool_output_file(OutputFilename.c_str(), Err,
+                                               raw_fd_ostream::F_Binary);
+  if (!Err.empty()) {
+    errs() << Err << '\n';
+    delete Out;
+    return 0;
+  }
+
+  return Out;
+}
+
 static int AsLexInput(const char *ProgName) {
   std::string ErrorMessage;
   MemoryBuffer *Buffer = MemoryBuffer::getFileOrSTDIN(InputFilename,
@@ -167,9 +188,15 @@
   AsmLexer Lexer(*MAI);
   Lexer.setBuffer(SrcMgr.getMemoryBuffer(0));
 
+  OwningPtr<tool_output_file> Out(GetOutputStream());
+  if (!Out)
+    return 1;
+
   bool Error = false;
   while (Lexer.Lex().isNot(AsmToken::Eof)) {
-    switch (Lexer.getKind()) {
+    AsmToken Tok = Lexer.getTok();
+
+    switch (Tok.getKind()) {
     default:
       SrcMgr.PrintMessage(Lexer.getLoc(), "unknown token", "warning");
       Error = true;
@@ -178,69 +205,69 @@
       Error = true; // error already printed.
       break;
     case AsmToken::Identifier:
-      outs() << "identifier: " << Lexer.getTok().getString() << '\n';
-      break;
-    case AsmToken::String:
-      outs() << "string: " << Lexer.getTok().getString() << '\n';
+      Out->os() << "identifier: " << Lexer.getTok().getString();
       break;
     case AsmToken::Integer:
-      outs() << "int: " << Lexer.getTok().getString() << '\n';
+      Out->os() << "int: " << Lexer.getTok().getString();
+      break;
+    case AsmToken::Real:
+      Out->os() << "real: " << Lexer.getTok().getString();
+      break;
+    case AsmToken::Register:
+      Out->os() << "register: " << Lexer.getTok().getRegVal();
+      break;
+    case AsmToken::String:
+      Out->os() << "string: " << Lexer.getTok().getString();
       break;
 
-    case AsmToken::Amp:            outs() << "Amp\n"; break;
-    case AsmToken::AmpAmp:         outs() << "AmpAmp\n"; break;
-    case AsmToken::Caret:          outs() << "Caret\n"; break;
-    case AsmToken::Colon:          outs() << "Colon\n"; break;
-    case AsmToken::Comma:          outs() << "Comma\n"; break;
-    case AsmToken::Dollar:         outs() << "Dollar\n"; break;
-    case AsmToken::EndOfStatement: outs() << "EndOfStatement\n"; break;
-    case AsmToken::Eof:            outs() << "Eof\n"; break;
-    case AsmToken::Equal:          outs() << "Equal\n"; break;
-    case AsmToken::EqualEqual:     outs() << "EqualEqual\n"; break;
-    case AsmToken::Exclaim:        outs() << "Exclaim\n"; break;
-    case AsmToken::ExclaimEqual:   outs() << "ExclaimEqual\n"; break;
-    case AsmToken::Greater:        outs() << "Greater\n"; break;
-    case AsmToken::GreaterEqual:   outs() << "GreaterEqual\n"; break;
-    case AsmToken::GreaterGreater: outs() << "GreaterGreater\n"; break;
-    case AsmToken::LParen:         outs() << "LParen\n"; break;
-    case AsmToken::Less:           outs() << "Less\n"; break;
-    case AsmToken::LessEqual:      outs() << "LessEqual\n"; break;
-    case AsmToken::LessGreater:    outs() << "LessGreater\n"; break;
-    case AsmToken::LessLess:       outs() << "LessLess\n"; break;
-    case AsmToken::Minus:          outs() << "Minus\n"; break;
-    case AsmToken::Percent:        outs() << "Percent\n"; break;
-    case AsmToken::Pipe:           outs() << "Pipe\n"; break;
-    case AsmToken::PipePipe:       outs() << "PipePipe\n"; break;
-    case AsmToken::Plus:           outs() << "Plus\n"; break;
-    case AsmToken::RParen:         outs() << "RParen\n"; break;
-    case AsmToken::Slash:          outs() << "Slash\n"; break;
-    case AsmToken::Star:           outs() << "Star\n"; break;
-    case AsmToken::Tilde:          outs() << "Tilde\n"; break;
+    case AsmToken::Amp:            Out->os() << "Amp"; break;
+    case AsmToken::AmpAmp:         Out->os() << "AmpAmp"; break;
+    case AsmToken::At:             Out->os() << "At"; break;
+    case AsmToken::Caret:          Out->os() << "Caret"; break;
+    case AsmToken::Colon:          Out->os() << "Colon"; break;
+    case AsmToken::Comma:          Out->os() << "Comma"; break;
+    case AsmToken::Dollar:         Out->os() << "Dollar"; break;
+    case AsmToken::Dot:            Out->os() << "Dot"; break;
+    case AsmToken::EndOfStatement: Out->os() << "EndOfStatement"; break;
+    case AsmToken::Eof:            Out->os() << "Eof"; break;
+    case AsmToken::Equal:          Out->os() << "Equal"; break;
+    case AsmToken::EqualEqual:     Out->os() << "EqualEqual"; break;
+    case AsmToken::Exclaim:        Out->os() << "Exclaim"; break;
+    case AsmToken::ExclaimEqual:   Out->os() << "ExclaimEqual"; break;
+    case AsmToken::Greater:        Out->os() << "Greater"; break;
+    case AsmToken::GreaterEqual:   Out->os() << "GreaterEqual"; break;
+    case AsmToken::GreaterGreater: Out->os() << "GreaterGreater"; break;
+    case AsmToken::Hash:           Out->os() << "Hash"; break;
+    case AsmToken::LBrac:          Out->os() << "LBrac"; break;
+    case AsmToken::LCurly:         Out->os() << "LCurly"; break;
+    case AsmToken::LParen:         Out->os() << "LParen"; break;
+    case AsmToken::Less:           Out->os() << "Less"; break;
+    case AsmToken::LessEqual:      Out->os() << "LessEqual"; break;
+    case AsmToken::LessGreater:    Out->os() << "LessGreater"; break;
+    case AsmToken::LessLess:       Out->os() << "LessLess"; break;
+    case AsmToken::Minus:          Out->os() << "Minus"; break;
+    case AsmToken::Percent:        Out->os() << "Percent"; break;
+    case AsmToken::Pipe:           Out->os() << "Pipe"; break;
+    case AsmToken::PipePipe:       Out->os() << "PipePipe"; break;
+    case AsmToken::Plus:           Out->os() << "Plus"; break;
+    case AsmToken::RBrac:          Out->os() << "RBrac"; break;
+    case AsmToken::RCurly:         Out->os() << "RCurly"; break;
+    case AsmToken::RParen:         Out->os() << "RParen"; break;
+    case AsmToken::Slash:          Out->os() << "Slash"; break;
+    case AsmToken::Star:           Out->os() << "Star"; break;
+    case AsmToken::Tilde:          Out->os() << "Tilde"; break;
     }
-  }
-  
-  return Error;
-}
 
-static formatted_raw_ostream *GetOutputStream() {
-  if (OutputFilename == "")
-    OutputFilename = "-";
-
-  // Make sure that the Out file gets unlinked from the disk if we get a
-  // SIGINT.
-  if (OutputFilename != "-")
-    sys::RemoveFileOnSignal(sys::Path(OutputFilename));
-
-  std::string Err;
-  raw_fd_ostream *Out = new raw_fd_ostream(OutputFilename.c_str(), Err,
-                                           raw_fd_ostream::F_Binary);
-  if (!Err.empty()) {
-    errs() << Err << '\n';
-    delete Out;
-    return 0;
+    // Print the token string.
+    Out->os() << " (\"";
+    Out->os().write_escaped(Tok.getString());
+    Out->os() << "\")\n";
   }
-  
-  return new formatted_raw_ostream(*Out, formatted_raw_ostream::DELETE_STREAM);
+
+  // Keep output if no errors.
+  if (Error == 0) Out->keep();
+ 
+  return Error;
 }
 
 static int AssembleInput(const char *ProgName) {
@@ -273,10 +300,6 @@
   assert(MAI && "Unable to create target asm info!");
   
   MCContext Ctx(*MAI);
-  formatted_raw_ostream *Out = GetOutputStream();
-  if (!Out)
-    return 1;
-
 
   // FIXME: We shouldn't need to do this (and link in codegen).
   OwningPtr<TargetMachine> TM(TheTarget->createTargetMachine(TripleName, ""));
@@ -287,6 +310,11 @@
     return 1;
   }
 
+  OwningPtr<tool_output_file> Out(GetOutputStream());
+  if (!Out)
+    return 1;
+
+  formatted_raw_ostream FOS(Out->os());
   OwningPtr<MCStreamer> Str;
 
   if (FileType == OFT_AssemblyFile) {
@@ -295,7 +323,8 @@
     MCCodeEmitter *CE = 0;
     if (ShowEncoding)
       CE = TheTarget->createCodeEmitter(*TM, Ctx);
-    Str.reset(createAsmStreamer(Ctx, *Out,TM->getTargetData()->isLittleEndian(),
+    Str.reset(createAsmStreamer(Ctx, FOS,
+                                TM->getTargetData()->isLittleEndian(),
                                 /*asmverbose*/true, IP, CE, ShowInst));
   } else if (FileType == OFT_Null) {
     Str.reset(createNullStreamer(Ctx));
@@ -304,7 +333,7 @@
     MCCodeEmitter *CE = TheTarget->createCodeEmitter(*TM, Ctx);
     TargetAsmBackend *TAB = TheTarget->createAsmBackend(TripleName);
     Str.reset(TheTarget->createObjectStreamer(TripleName, Ctx, *TAB,
-                                              *Out, CE, RelaxAll));
+                                              FOS, CE, RelaxAll));
   }
 
   if (EnableLogging) {
@@ -320,14 +349,13 @@
     return 1;
   }
 
+  Parser->setShowParsedOperands(ShowInstOperands);
   Parser->setTargetParser(*TAP.get());
 
   int Res = Parser->Run(NoInitialTextSection);
-  delete Out;
 
-  // Delete output on errors.
-  if (Res && OutputFilename != "-")
-    sys::Path(OutputFilename).eraseFromDisk();
+  // Keep output if no errors.
+  if (Res == 0) Out->keep();
 
   return Res;
 }
@@ -351,10 +379,20 @@
     return 1;
   }
   
+  OwningPtr<tool_output_file> Out(GetOutputStream());
+  if (!Out)
+    return 1;
+
+  int Res;
   if (Enhanced)
-    return Disassembler::disassembleEnhanced(TripleName, *Buffer);
+    Res = Disassembler::disassembleEnhanced(TripleName, *Buffer, Out->os());
   else
-    return Disassembler::disassemble(*TheTarget, TripleName, *Buffer);
+    Res = Disassembler::disassemble(*TheTarget, TripleName, *Buffer, Out->os());
+
+  // Keep output if no errors.
+  if (Res == 0) Out->keep();
+
+  return Res;
 }
 
 
@@ -373,6 +411,7 @@
   llvm::InitializeAllDisassemblers();
   
   cl::ParseCommandLineOptions(argc, argv, "llvm machine code playground\n");
+  TripleName = Triple::normalize(TripleName);
 
   switch (Action) {
   default:

Modified: llvm/branches/wendling/eh/tools/llvm-nm/llvm-nm.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llvm-nm/llvm-nm.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/tools/llvm-nm/llvm-nm.cpp (original)
+++ llvm/branches/wendling/eh/tools/llvm-nm/llvm-nm.cpp Tue Oct 26 19:48:03 2010
@@ -88,10 +88,13 @@
 
 static void DumpSymbolNameForGlobalValue(GlobalValue &GV) {
   // Private linkage and available_externally linkage don't exist in symtab.
-  if (GV.hasPrivateLinkage() || GV.hasLinkerPrivateLinkage() ||
-      GV.hasLinkerPrivateWeakLinkage() || GV.hasAvailableExternallyLinkage())
+  if (GV.hasPrivateLinkage() ||
+      GV.hasLinkerPrivateLinkage() ||
+      GV.hasLinkerPrivateWeakLinkage() ||
+      GV.hasLinkerPrivateWeakDefAutoLinkage() ||
+      GV.hasAvailableExternallyLinkage())
     return;
-  
+
   const std::string SymbolAddrStr = "        "; // Not used yet...
   char TypeChar = TypeCharForSymbol(GV);
   if ((TypeChar != 'U') && UndefinedOnly)
@@ -145,13 +148,13 @@
     Module *Result = 0;
     if (Buffer.get())
       Result = ParseBitcodeFile(Buffer.get(), Context, &ErrorMessage);
-    
+
     if (Result) {
       DumpSymbolNamesFromModule(Result);
       delete Result;
     } else
       errs() << ToolName << ": " << Filename << ": " << ErrorMessage << "\n";
-    
+
   } else if (aPath.isArchive()) {
     std::string ErrMsg;
     Archive* archive = Archive::OpenAndLoad(sys::Path(Filename), Context,
@@ -176,7 +179,7 @@
   // Print a stack trace if we signal out.
   sys::PrintStackTraceOnErrorSignal();
   PrettyStackTraceProgram X(argc, argv);
-  
+
   llvm_shutdown_obj Y;  // Call llvm_shutdown() on exit.
   cl::ParseCommandLineOptions(argc, argv, "llvm symbol table dumper\n");
 

Modified: llvm/branches/wendling/eh/tools/llvm-prof/llvm-prof.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llvm-prof/llvm-prof.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/tools/llvm-prof/llvm-prof.cpp (original)
+++ llvm/branches/wendling/eh/tools/llvm-prof/llvm-prof.cpp Tue Oct 26 19:48:03 2010
@@ -17,12 +17,13 @@
 #include "llvm/LLVMContext.h"
 #include "llvm/Module.h"
 #include "llvm/PassManager.h"
-#include "llvm/Assembly/AsmAnnotationWriter.h"
+#include "llvm/Assembly/AssemblyAnnotationWriter.h"
 #include "llvm/Analysis/ProfileInfo.h"
 #include "llvm/Analysis/ProfileInfoLoader.h"
 #include "llvm/Analysis/Passes.h"
 #include "llvm/Bitcode/ReaderWriter.h"
 #include "llvm/Support/CommandLine.h"
+#include "llvm/Support/FormattedStream.h"
 #include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/PrettyStackTrace.h"
@@ -75,9 +76,10 @@
   class ProfileAnnotator : public AssemblyAnnotationWriter {
     ProfileInfo &PI;
   public:
-    ProfileAnnotator(ProfileInfo& pi) : PI(pi) {}
+    ProfileAnnotator(ProfileInfo &pi) : PI(pi) {}
 
-    virtual void emitFunctionAnnot(const Function *F, raw_ostream &OS) {
+    virtual void emitFunctionAnnot(const Function *F,
+                                   formatted_raw_ostream &OS) {
       double w = PI.getExecutionCount(F);
       if (w != ProfileInfo::MissingValue) {
         OS << ";;; %" << F->getName() << " called "<<(unsigned)w
@@ -85,7 +87,7 @@
       }
     }
     virtual void emitBasicBlockStartAnnot(const BasicBlock *BB,
-                                          raw_ostream &OS) {
+                                          formatted_raw_ostream &OS) {
       double w = PI.getExecutionCount(BB);
       if (w != ProfileInfo::MissingValue) {
         if (w != 0) {
@@ -96,7 +98,8 @@
       }
     }
 
-    virtual void emitBasicBlockEndAnnot(const BasicBlock *BB, raw_ostream &OS) {
+    virtual void emitBasicBlockEndAnnot(const BasicBlock *BB,
+                                        formatted_raw_ostream &OS) {
       // Figure out how many times each successor executed.
       std::vector<std::pair<ProfileInfo::Edge, double> > SuccCounts;
 
@@ -128,7 +131,7 @@
   public:
     static char ID; // Class identification, replacement for typeinfo.
     explicit ProfileInfoPrinterPass(ProfileInfoLoader &_PIL) 
-      : ModulePass(&ID), PIL(_PIL) {}
+      : ModulePass(ID), PIL(_PIL) {}
 
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
       AU.setPreservesAll();

Modified: llvm/branches/wendling/eh/tools/llvm-shlib/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llvm-shlib/Makefile?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/tools/llvm-shlib/Makefile (original)
+++ llvm/branches/wendling/eh/tools/llvm-shlib/Makefile Tue Oct 26 19:48:03 2010
@@ -15,6 +15,17 @@
 LINK_LIBS_IN_SHARED = 1
 SHARED_LIBRARY = 1
 
+include $(LEVEL)/Makefile.config
+
+ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
+    EXPORTED_SYMBOL_FILE = $(ObjDir)/$(LIBRARYNAME).exports
+
+    # It is needed to force static-stdc++.a linked.
+    # FIXME: It should be omitted when configure detects system's stdc++.dll.
+    SHLIB_FRAG_NAMES += stdc++.a.o
+
+endif
+
 include $(LEVEL)/Makefile.common
 
 # Include all archives in libLLVM.(so|dylib) except the ones that have
@@ -57,3 +68,44 @@
     # Don't allow unresolved symbols.
     LLVMLibsOptions += -Wl,--no-undefined
 endif
+
+ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
+
+SHLIB_STUBS := $(addprefix $(ObjDir)/, $(SHLIB_FRAG_NAMES))
+SHLIB_FRAGS := $(patsubst %.a.o, $(ObjDir)/%.syms.txt, $(LIBRARYNAME).a.o $(SHLIB_FRAG_NAMES))
+LLVMLibsOptions := $(SHLIB_STUBS) $(LLVMLibsOptions)
+
+$(LibName.SO): $(SHLIB_STUBS)
+
+%.syms.txt: %.a.o
+	$(Echo) Collecting global symbols of $(notdir $*)
+	$(Verb) $(NM_PATH) -g $< > $@
+
+$(ObjDir)/$(LIBRARYNAME).exports: $(SHLIB_FRAGS) $(ObjDir)/.dir
+	$(Echo) Generating exports for $(LIBRARYNAME)
+	$(Verb) ($(SED) -n \
+			-e "s/^.* T _\([^.][^.]*\)$$/\1/p" \
+			-e "s/^.* [BDR] _\([^.][^.]*\)$$/\1 DATA/p" \
+			$(SHLIB_FRAGS) \
+		 | sort -u) > $@
+
+$(ObjDir)/$(LIBRARYNAME).a.o: $(LLVMLibsPaths) $(ObjDir)/.dir
+	$(Echo) Linking all LLVMLibs together for $(LIBRARYNAME)
+	$(Verb) $(Link) -nostartfiles -Wl,-r -nodefaultlibs -o $@ \
+			-Wl,--whole-archive $(LLVMLibsPaths) \
+			-Wl,--no-whole-archive
+
+$(ObjDir)/stdc++.a.o: $(ObjDir)/.dir
+	$(Echo) Linking all libs together for static libstdc++.a
+	$(Verb) $(Link) -nostartfiles -Wl,-r -nodefaultlibs -o $@ \
+			-Wl,--whole-archive -lstdc++ \
+			-Wl,--no-whole-archive
+# FIXME: workaround to invalidate -lstdc++
+	$(Echo) Making dummy -lstdc++ to lib
+	$(Verb) $(AR) rc $(ToolDir)/libstdc++.dll.a
+# FIXME: Is install-local needed?
+
+clean-local::
+	$(Verb) $(RM) -f $(ToolDir)/libstdc++.dll.a
+
+endif

Modified: llvm/branches/wendling/eh/tools/llvm-stub/llvm-stub.c
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llvm-stub/llvm-stub.c?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/tools/llvm-stub/llvm-stub.c (original)
+++ llvm/branches/wendling/eh/tools/llvm-stub/llvm-stub.c Tue Oct 26 19:48:03 2010
@@ -1,10 +1,10 @@
 /*===- llvm-stub.c - Stub executable to run llvm bitcode files ------------===//
-// 
+//
 //                     The LLVM Compiler Infrastructure
 //
 // This file is distributed under the University of Illinois Open Source
 // License. See LICENSE.TXT for details.
-// 
+//
 //===----------------------------------------------------------------------===//
 //
 // This tool is used by the gccld program to enable transparent execution of
@@ -64,7 +64,11 @@
   memcpy((char **)Args+2, argv+1, sizeof(char*)*argc);
 
   /* Run the JIT. */
-  execvp(Interp, (char **)Args);
+#ifndef _WIN32
+  execvp(Interp, (char **)Args); /* POSIX execvp takes a char *const[]. */
+#else
+  execvp(Interp, Args); /* windows execvp takes a const char *const *. */
+#endif
   /* if _execv returns, the JIT could not be started. */
   fprintf(stderr, "Could not execute the LLVM JIT.  Either add 'lli' to your"
           " path, or set the\ninterpreter you want to use in the LLVMINTERP "

Modified: llvm/branches/wendling/eh/tools/llvmc/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llvmc/CMakeLists.txt?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/tools/llvmc/CMakeLists.txt (original)
+++ llvm/branches/wendling/eh/tools/llvmc/CMakeLists.txt Tue Oct 26 19:48:03 2010
@@ -1,4 +1,4 @@
-# add_subdirectory(driver)
+# add_subdirectory(src)
 
 # TODO: support plugins and user-configured builds.
 # See ./doc/LLVMC-Reference.rst "Customizing LLVMC: the compilation graph"

Modified: llvm/branches/wendling/eh/tools/llvmc/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llvmc/Makefile?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/tools/llvmc/Makefile (original)
+++ llvm/branches/wendling/eh/tools/llvmc/Makefile Tue Oct 26 19:48:03 2010
@@ -9,9 +9,10 @@
 
 LEVEL = ../..
 
-export LLVMC_BASED_DRIVER_NAME = llvmc
-export LLVMC_BUILTIN_PLUGINS = Base Clang
+DIRS = src
 
-DIRS = plugins driver
+ifeq ($(BUILD_EXAMPLES),1)
+  OPTIONAL_DIRS += examples
+endif
 
 include $(LEVEL)/Makefile.common

Modified: llvm/branches/wendling/eh/tools/llvmc/doc/LLVMC-Reference.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llvmc/doc/LLVMC-Reference.rst?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/tools/llvmc/doc/LLVMC-Reference.rst (original)
+++ llvm/branches/wendling/eh/tools/llvmc/doc/LLVMC-Reference.rst Tue Oct 26 19:48:03 2010
@@ -456,22 +456,22 @@
 * Possible tests are:
 
   - ``switch_on`` - Returns true if a given command-line switch is provided by
-    the user. Can be given a list as argument, in that case ``(switch_on ["foo",
-    "bar", "baz"])`` is equivalent to ``(and (switch_on "foo"), (switch_on
+    the user. Can be given multiple arguments, in that case ``(switch_on "foo",
+    "bar", "baz")`` is equivalent to ``(and (switch_on "foo"), (switch_on
     "bar"), (switch_on "baz"))``.
     Example: ``(switch_on "opt")``.
 
-  - ``any_switch_on`` - Given a list of switch options, returns true if any of
+  - ``any_switch_on`` - Given a number of switch options, returns true if any of
     the switches is turned on.
-    Example: ``(any_switch_on ["foo", "bar", "baz"])`` is equivalent to ``(or
+    Example: ``(any_switch_on "foo", "bar", "baz")`` is equivalent to ``(or
     (switch_on "foo"), (switch_on "bar"), (switch_on "baz"))``.
 
-  - ``parameter_equals`` - Returns true if a command-line parameter equals
-    a given value.
+  - ``parameter_equals`` - Returns true if a command-line parameter (first
+    argument) equals a given value (second argument).
     Example: ``(parameter_equals "W", "all")``.
 
-  - ``element_in_list`` - Returns true if a command-line parameter
-    list contains a given value.
+  - ``element_in_list`` - Returns true if a command-line parameter list (first
+    argument) contains a given value (second argument).
     Example: ``(element_in_list "l", "pthread")``.
 
   - ``input_languages_contain`` - Returns true if a given language
@@ -479,27 +479,27 @@
     Example: ``(input_languages_contain "c++")``.
 
   - ``in_language`` - Evaluates to true if the input file language is equal to
-    the argument. At the moment works only with ``cmd_line`` and ``actions`` (on
+    the argument. At the moment works only with ``command`` and ``actions`` (on
     non-join nodes).
     Example: ``(in_language "c++")``.
 
   - ``not_empty`` - Returns true if a given option (which should be either a
     parameter or a parameter list) is set by the user. Like ``switch_on``, can
-    be also given a list as argument.
-    Example: ``(not_empty "o")``.
+    be also given multiple arguments.
+    Examples: ``(not_empty "o")``, ``(not_empty "o", "l")``.
 
   - ``any_not_empty`` - Returns true if ``not_empty`` returns true for any of
-    the options in the list.
-    Example: ``(any_not_empty ["foo", "bar", "baz"])`` is equivalent to ``(or
+    the provided options.
+    Example: ``(any_not_empty "foo", "bar", "baz")`` is equivalent to ``(or
     (not_empty "foo"), (not_empty "bar"), (not_empty "baz"))``.
 
   - ``empty`` - The opposite of ``not_empty``. Equivalent to ``(not (not_empty
-    X))``. Provided for convenience. Can be given a list as argument.
+    X))``. Can be given multiple arguments.
 
   - ``any_not_empty`` - Returns true if ``not_empty`` returns true for any of
-    the options in the list.
-    Example: ``(any_empty ["foo", "bar", "baz"])`` is equivalent to ``(not (and
-    (not_empty "foo"), (not_empty "bar"), (not_empty "baz")))``.
+    the provided options.
+    Example: ``(any_empty "foo", "bar", "baz")`` is equivalent to ``(or
+    (not_empty "foo"), (not_empty "bar"), (not_empty "baz"))``.
 
   - ``single_input_file`` - Returns true if there was only one input file
     provided on the command-line. Used without arguments:
@@ -511,16 +511,18 @@
   - ``default`` - Always evaluates to true. Should always be the last
     test in the ``case`` expression.
 
-  - ``and`` - A standard binary logical combinator that returns true iff all of
+  - ``and`` - A standard logical combinator that returns true iff all of
     its arguments return true. Used like this: ``(and (test1), (test2),
     ... (testN))``. Nesting of ``and`` and ``or`` is allowed, but not
     encouraged.
 
-  - ``or`` - A binary logical combinator that returns true iff any of its
-    arguments returns true. Example: ``(or (test1), (test2), ... (testN))``.
+  - ``or`` - A logical combinator that returns true iff any of its arguments
+    return true.
+    Example: ``(or (test1), (test2), ... (testN))``.
 
   - ``not`` - Standard unary logical combinator that negates its
-    argument. Example: ``(not (or (test1), (test2), ... (testN)))``.
+    argument.
+    Example: ``(not (or (test1), (test2), ... (testN)))``.
 
 
 
@@ -549,10 +551,10 @@
 
 * Possible tool properties:
 
-  - ``in_language`` - input language name. Can be either a string or a
-    list, in case the tool supports multiple input languages.
+  - ``in_language`` - input language name. Can be given multiple arguments, in
+    case the tool supports multiple input languages.
 
-  - ``out_language`` - output language name. Multiple output languages are not
+  - ``out_language`` - output language name. Multiple output languages are
     allowed.
 
   - ``output_suffix`` - output file suffix. Can also be changed
@@ -687,12 +689,12 @@
 
 
     def Preprocess : OptionPreprocessor<
-    (case (not (any_switch_on ["O0", "O1", "O2", "O3"])),
+    (case (not (any_switch_on "O0", "O1", "O2", "O3")),
                (set_option "O2"),
-          (and (switch_on "O3"), (any_switch_on ["O0", "O1", "O2"])),
-               (unset_option ["O0", "O1", "O2"]),
-          (and (switch_on "O2"), (any_switch_on ["O0", "O1"])),
-               (unset_option ["O0", "O1"]),
+          (and (switch_on "O3"), (any_switch_on "O0", "O1", "O2")),
+               (unset_option "O0", "O1", "O2"),
+          (and (switch_on "O2"), (any_switch_on "O0", "O1")),
+               (unset_option "O0", "O1"),
           (and (switch_on "O1"), (switch_on "O0")),
                (unset_option "O0"))
     >;
@@ -709,10 +711,10 @@
 two-argument form: ``(set_option "parameter", VALUE)``. Here, ``VALUE`` can be
 either a string, a string list, or a boolean constant.
 
-For convenience, ``set_option`` and ``unset_option`` also work on lists. That
-is, instead of ``[(unset_option "A"), (unset_option "B")]`` you can use
-``(unset_option ["A", "B"])``. Obviously, ``(set_option ["A", "B"])`` is valid
-only if both ``A`` and ``B`` are switches.
+For convenience, ``set_option`` and ``unset_option`` also work with multiple
+arguments. That is, instead of ``[(unset_option "A"), (unset_option "B")]`` you
+can use ``(unset_option "A", "B")``. Obviously, ``(set_option "A", "B")`` is
+only valid if both ``A`` and ``B`` are switches.
 
 
 More advanced topics

Removed: llvm/branches/wendling/eh/tools/llvmc/driver/Main.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llvmc/driver/Main.cpp?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/tools/llvmc/driver/Main.cpp (original)
+++ llvm/branches/wendling/eh/tools/llvmc/driver/Main.cpp (removed)
@@ -1,14 +0,0 @@
-//===--- Main.cpp - The LLVM Compiler Driver -------------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open
-// Source License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-//  Just include CompilerDriver/Main.inc.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/CompilerDriver/Main.inc"

Removed: llvm/branches/wendling/eh/tools/llvmc/driver/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llvmc/driver/Makefile?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/tools/llvmc/driver/Makefile (original)
+++ llvm/branches/wendling/eh/tools/llvmc/driver/Makefile (removed)
@@ -1,13 +0,0 @@
-##===- tools/llvmc/driver/Makefile -------------------------*- Makefile -*-===##
-#
-#                     The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open
-# Source License. See LICENSE.TXT for details.
-#
-##===----------------------------------------------------------------------===##
-
-LEVEL = ../../..
-LLVMC_BASED_DRIVER = $(LLVMC_BASED_DRIVER_NAME)
-
-include $(LEVEL)/Makefile.common

Removed: llvm/branches/wendling/eh/tools/llvmc/example/Hello/Hello.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llvmc/example/Hello/Hello.cpp?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/tools/llvmc/example/Hello/Hello.cpp (original)
+++ llvm/branches/wendling/eh/tools/llvmc/example/Hello/Hello.cpp (removed)
@@ -1,33 +0,0 @@
-//===- Hello.cpp - Example code from "Writing an LLVMC Plugin" ------------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// Test plugin for LLVMC. Shows how to write plugins without using TableGen.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/CompilerDriver/CompilationGraph.h"
-#include "llvm/CompilerDriver/Plugin.h"
-#include "llvm/Support/raw_ostream.h"
-
-namespace {
-struct MyPlugin : public llvmc::BasePlugin {
-
-  void PreprocessOptions() const
-  {}
-
-  void PopulateLanguageMap(llvmc::LanguageMap&) const
-  { outs() << "Hello!\n"; }
-
-  void PopulateCompilationGraph(llvmc::CompilationGraph&) const
-  {}
-};
-
-static llvmc::RegisterPlugin<MyPlugin> RP("Hello", "Hello World plugin");
-
-}

Removed: llvm/branches/wendling/eh/tools/llvmc/example/Hello/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llvmc/example/Hello/Makefile?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/tools/llvmc/example/Hello/Makefile (original)
+++ llvm/branches/wendling/eh/tools/llvmc/example/Hello/Makefile (removed)
@@ -1,14 +0,0 @@
-##===- tools/llvmc/plugins/Hello/Makefile ------------------*- Makefile -*-===##
-#
-#                     The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License. See LICENSE.TXT for details.
-#
-##===----------------------------------------------------------------------===##
-
-LEVEL = ../../../..
-
-LLVMC_PLUGIN = Hello
-
-include $(LEVEL)/Makefile.common

Removed: llvm/branches/wendling/eh/tools/llvmc/example/Simple/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llvmc/example/Simple/Makefile?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/tools/llvmc/example/Simple/Makefile (original)
+++ llvm/branches/wendling/eh/tools/llvmc/example/Simple/Makefile (removed)
@@ -1,15 +0,0 @@
-##===- tools/llvmc/plugins/Simple/Makefile -----------------*- Makefile -*-===##
-#
-#                     The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License. See LICENSE.TXT for details.
-#
-##===----------------------------------------------------------------------===##
-
-LEVEL = ../../../..
-
-LLVMC_PLUGIN = Simple
-BUILT_SOURCES = AutoGenerated.inc
-
-include $(LEVEL)/Makefile.common

Removed: llvm/branches/wendling/eh/tools/llvmc/example/Simple/PluginMain.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llvmc/example/Simple/PluginMain.cpp?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/tools/llvmc/example/Simple/PluginMain.cpp (original)
+++ llvm/branches/wendling/eh/tools/llvmc/example/Simple/PluginMain.cpp (removed)
@@ -1 +0,0 @@
-#include "AutoGenerated.inc"

Removed: llvm/branches/wendling/eh/tools/llvmc/example/Simple/Simple.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llvmc/example/Simple/Simple.td?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/tools/llvmc/example/Simple/Simple.td (original)
+++ llvm/branches/wendling/eh/tools/llvmc/example/Simple/Simple.td (removed)
@@ -1,37 +0,0 @@
-//===- Simple.td - A simple plugin for LLVMC ------------------------------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// A simple LLVMC-based gcc wrapper that shows how to write LLVMC plugins.
-//
-// To compile, use this command:
-//
-//      $ cd $LLVMC_DIR/example/Simple
-//      $ make
-//
-// Run as:
-//
-//      $ llvmc -load $LLVM_DIR/Release/lib/plugin_llvmc_Simple.so
-//
-// For instructions on how to build your own LLVMC-based driver, see
-// the 'example/Skeleton' directory.
-//===----------------------------------------------------------------------===//
-
-include "llvm/CompilerDriver/Common.td"
-
-def gcc : Tool<
-[(in_language "c"),
- (out_language "executable"),
- (output_suffix "out"),
- (cmd_line "gcc $INFILE -o $OUTFILE"),
- (sink)
-]>;
-
-def LanguageMap : LanguageMap<[LangToSuffixes<"c", ["c"]>]>;
-
-def CompilationGraph : CompilationGraph<[Edge<"root", "gcc">]>;

Removed: llvm/branches/wendling/eh/tools/llvmc/example/Skeleton/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llvmc/example/Skeleton/Makefile?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/tools/llvmc/example/Skeleton/Makefile (original)
+++ llvm/branches/wendling/eh/tools/llvmc/example/Skeleton/Makefile (removed)
@@ -1,24 +0,0 @@
-##===- llvmc/example/Skeleton/Makefile ---------------------*- Makefile -*-===##
-#
-#                     The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open
-# Source License. See LICENSE.TXT for details.
-#
-##===----------------------------------------------------------------------===##
-
-# Change this so that $(BASE_LEVEL)/Makefile.common refers to
-# $LLVM_DIR/Makefile.common or $YOUR_LLVM_BASED_PROJECT/Makefile.common.
-export LLVMC_BASE_LEVEL = ../../../..
-
-# Change this to the name of your LLVMC-based driver.
-export LLVMC_BASED_DRIVER_NAME = llvmc-skeleton
-
-# List your plugin names here
-export LLVMC_BUILTIN_PLUGINS = # Plugin
-
-LEVEL = $(LLVMC_BASE_LEVEL)
-
-DIRS = plugins driver
-
-include $(LEVEL)/Makefile.common

Removed: llvm/branches/wendling/eh/tools/llvmc/example/Skeleton/README
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llvmc/example/Skeleton/README?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/tools/llvmc/example/Skeleton/README (original)
+++ llvm/branches/wendling/eh/tools/llvmc/example/Skeleton/README (removed)
@@ -1,6 +0,0 @@
-
-This is a template that can be used to create your own LLVMC-based drivers. Just
-copy the `Skeleton` directory to the location of your preference and edit
-`Skeleton/Makefile` and `Skeleton/plugins/Plugin`.
-
-The build system assumes that your project is based on LLVM.

Removed: llvm/branches/wendling/eh/tools/llvmc/example/Skeleton/driver/Main.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llvmc/example/Skeleton/driver/Main.cpp?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/tools/llvmc/example/Skeleton/driver/Main.cpp (original)
+++ llvm/branches/wendling/eh/tools/llvmc/example/Skeleton/driver/Main.cpp (removed)
@@ -1,14 +0,0 @@
-//===--- Main.cpp - The LLVM Compiler Driver -------------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open
-// Source License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-//  Just include CompilerDriver/Main.inc.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/CompilerDriver/Main.inc"

Removed: llvm/branches/wendling/eh/tools/llvmc/example/Skeleton/driver/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llvmc/example/Skeleton/driver/Makefile?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/tools/llvmc/example/Skeleton/driver/Makefile (original)
+++ llvm/branches/wendling/eh/tools/llvmc/example/Skeleton/driver/Makefile (removed)
@@ -1,13 +0,0 @@
-##===- llvmc/example/Skeleton/driver/Makefile --------------*- Makefile -*-===##
-#
-#                     The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open
-# Source License. See LICENSE.TXT for details.
-#
-##===----------------------------------------------------------------------===##
-
-LEVEL = $(LLVMC_BASE_LEVEL)/..
-LLVMC_BASED_DRIVER = $(LLVMC_BASED_DRIVER_NAME)
-
-include $(LEVEL)/Makefile.common

Removed: llvm/branches/wendling/eh/tools/llvmc/example/Skeleton/plugins/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llvmc/example/Skeleton/plugins/Makefile?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/tools/llvmc/example/Skeleton/plugins/Makefile (original)
+++ llvm/branches/wendling/eh/tools/llvmc/example/Skeleton/plugins/Makefile (removed)
@@ -1,18 +0,0 @@
-##===- llvmc/example/Skeleton/plugins/Makefile -------------*- Makefile -*-===##
-#
-#                     The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open
-# Source License. See LICENSE.TXT for details.
-#
-##===----------------------------------------------------------------------===##
-
-LEVEL = $(LLVMC_BASE_LEVEL)/..
-
-ifneq ($(LLVMC_BUILTIN_PLUGINS),)
-DIRS = $(LLVMC_BUILTIN_PLUGINS)
-endif
-
-export LLVMC_BUILTIN_PLUGIN=1
-
-include $(LEVEL)/Makefile.common

Removed: llvm/branches/wendling/eh/tools/llvmc/example/Skeleton/plugins/Plugin/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llvmc/example/Skeleton/plugins/Plugin/Makefile?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/tools/llvmc/example/Skeleton/plugins/Plugin/Makefile (original)
+++ llvm/branches/wendling/eh/tools/llvmc/example/Skeleton/plugins/Plugin/Makefile (removed)
@@ -1,17 +0,0 @@
-##===- llvmc/example/Skeleton/plugins/Plugin/Makefile ------*- Makefile -*-===##
-#
-#                     The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License. See LICENSE.TXT for details.
-#
-##===----------------------------------------------------------------------===##
-
-LEVEL = $(LLVMC_BASE_LEVEL)/../..
-
-# Change this to the name of your plugin.
-LLVMC_PLUGIN = Plugin
-
-BUILT_SOURCES = AutoGenerated.inc
-
-include $(LEVEL)/Makefile.common

Removed: llvm/branches/wendling/eh/tools/llvmc/example/Skeleton/plugins/Plugin/Plugin.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llvmc/example/Skeleton/plugins/Plugin/Plugin.td?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/tools/llvmc/example/Skeleton/plugins/Plugin/Plugin.td (original)
+++ llvm/branches/wendling/eh/tools/llvmc/example/Skeleton/plugins/Plugin/Plugin.td (removed)
@@ -1,7 +0,0 @@
-//===- Plugin.td - A skeleton plugin for LLVMC -------------*- tablegen -*-===//
-//
-// Write the code for your plugin here.
-//
-//===----------------------------------------------------------------------===//
-
-include "llvm/CompilerDriver/Common.td"

Removed: llvm/branches/wendling/eh/tools/llvmc/example/Skeleton/plugins/Plugin/PluginMain.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llvmc/example/Skeleton/plugins/Plugin/PluginMain.cpp?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/tools/llvmc/example/Skeleton/plugins/Plugin/PluginMain.cpp (original)
+++ llvm/branches/wendling/eh/tools/llvmc/example/Skeleton/plugins/Plugin/PluginMain.cpp (removed)
@@ -1 +0,0 @@
-#include "AutoGenerated.inc"

Removed: llvm/branches/wendling/eh/tools/llvmc/example/mcc16/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llvmc/example/mcc16/Makefile?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/tools/llvmc/example/mcc16/Makefile (original)
+++ llvm/branches/wendling/eh/tools/llvmc/example/mcc16/Makefile (removed)
@@ -1,18 +0,0 @@
-##===- llvmc/example/mcc16/Makefile ------------------------*- Makefile -*-===##
-#
-#                     The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open
-# Source License. See LICENSE.TXT for details.
-#
-##===----------------------------------------------------------------------===##
-
-export LLVMC_BASE_LEVEL = ../../../..
-export LLVMC_BASED_DRIVER_NAME = mcc16
-export LLVMC_BUILTIN_PLUGINS = PIC16Base
-
-LEVEL = $(LLVMC_BASE_LEVEL)
-
-DIRS = plugins driver
-
-include $(LEVEL)/Makefile.common

Removed: llvm/branches/wendling/eh/tools/llvmc/example/mcc16/README
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llvmc/example/mcc16/README?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/tools/llvmc/example/mcc16/README (original)
+++ llvm/branches/wendling/eh/tools/llvmc/example/mcc16/README (removed)
@@ -1,75 +0,0 @@
-This is a basic compiler driver for the PIC16 toolchain that shows how to create
-your own llvmc-based drivers. It is based on the example/Skeleton template.
-
-The PIC16 toolchain looks like this:
-
-clang-cc (FE) -> llvm-ld (optimizer) -> llc (codegen) -> native-as -> native-ld
-
-Following features were requested by Sanjiv:
-
-From: Sanjiv Gupta <sanjiv.gupta <at> microchip.com>
-Subject: Re: llvmc for PIC16
-Newsgroups: gmane.comp.compilers.llvm.devel
-Date: 2009-06-05 06:51:14 GMT
-
-The salient features that we want to have in the driver are:
-1. llvm-ld will be used as "The Optimizer".
-2. If the user has specified to generate the final executable, then
-llvm-ld should run on all the .bc files generated by clang and create a
-single optimized .bc file for further tools.
-3. -Wo <options> - pass optimizations to the llvm-ld
-4. mcc16 -Wl <options> - pass options to native linker.
-5. mcc16 -Wa <options> - pass options to native assembler.
-
-Here are some example command lines and sample command invocations as to
-what should be done.
-
-$ mcc16 -S foo.c
-// [clang-cc foo.c] -> foo.bc
-// [llvm-ld foo.bc] -> foo.opt.bc
-// [llc foo.opt.bc] -> foo.s
-
-$ mcc16 -S foo.c bar.c
-// [clang-cc foo.c] -> foo.bc
-// [llvm-ld foo.bc] -> foo.opt.bc
-// [llc foo.opt.bc] -> foo.s
-// [clang-cc bar.c] -> bar.bc
-// [llvm-ld bar.bc] -> bar.opt.bc
-// [llc bar.opt.bc] -> bar.s
-
-** Use of -g causes llvm-ld to run with -disable-opt
-$ mcc16 -S -g foo.c
-// [clang-cc foo.c] -> foo.bc
-// [llvm-ld -disable-opt foo.bc] -> foo.opt.bc
-// [llc foo.opt.bc] -> foo.s
-
-** -I is passed to clang-cc, -pre-RA-sched=list-burr to llc.
-$ mcc16 -S -g -I ../include -pre-RA-sched=list-burr foo.c
-// [clang-cc -I ../include foo.c] -> foo.bc
-// [llvm-ld -disable-opt foo.bc] -> foo.opt.bc
-// [llc -pre-RA-sched=list-burr foo.opt.bc] -> foo.s
-
-** -Wo passes options to llvm-ld
-$ mcc16 -Wo=opt1,opt2 -S -I ../include -pre-RA-sched=list-burr foo.c
-// [clang-cc -I ../include foo.c] -> foo.bc
-// [llvm-ld -opt1 -opt2 foo.bc] -> foo.opt.bc
-// [llc -pre-RA-sched=list-burr foo.opt.bc] -> foo.s
-
-** -Wa passes options to native as.
-$ mcc16 -c foo.c -Wa=opt1
-// [clang-cc foo.c] -> foo.bc
-// [llvm-ld foo.bc] -> foo.opt.bc
-// [llc foo.opt.bc] -> foo.s
-// [native-as -opt1 foo.s] -> foo.o
-
-$ mcc16 -Wo=opt1 -Wl=opt2 -Wa=opt3 foo.c bar.c
-// [clang-cc foo.c] -> foo.bc
-// [clang-cc bar.c] -> bar.bc
-// [llvm-ld -opt1 foo.bc bar.bc] -> a.out.bc
-// [llc a.out.bc] -> a.out.s
-// [native-as -opt3 a.out.s] -> a.out.o
-// [native-ld -opt2 a.out.o] -> a.out
-
-Is this achievable by a tablegen based driver ?
-
-- Sanjiv

Removed: llvm/branches/wendling/eh/tools/llvmc/example/mcc16/driver/Main.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llvmc/example/mcc16/driver/Main.cpp?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/tools/llvmc/example/mcc16/driver/Main.cpp (original)
+++ llvm/branches/wendling/eh/tools/llvmc/example/mcc16/driver/Main.cpp (removed)
@@ -1,54 +0,0 @@
-//===--- Main.cpp - The LLVM Compiler Driver -------------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open
-// Source License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-//  Usually this file just includes CompilerDriver/Main.inc, but here we apply
-//  some trickery to make the built-in '-save-temps' option hidden and enable
-//  '--temp-dir' by default.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/Config/config.h"
-#include "llvm/CompilerDriver/BuiltinOptions.h"
-#include "llvm/CompilerDriver/ForceLinkage.h"
-#include "llvm/System/Path.h"
-#include <iostream>
-
-namespace llvmc {
-  int Main(int argc, char** argv);
-}
-
-// Modify the PACKAGE_VERSION to use build number in top level configure file.
-void PIC16VersionPrinter(void) {
-  std::cout << "MPLAB C16 1.0 " << PACKAGE_VERSION << "\n";
-}
-
-int main(int argc, char** argv) {
-
-  // HACK
-  SaveTemps.setHiddenFlag(llvm::cl::Hidden);
-  TempDirname.setHiddenFlag(llvm::cl::Hidden);
-  Languages.setHiddenFlag(llvm::cl::Hidden);
-  DryRun.setHiddenFlag(llvm::cl::Hidden);
-
-  llvm::cl::SetVersionPrinter(PIC16VersionPrinter); 
-
-  // Ask for a standard temp dir, but just cache its basename., and delete it.
-  llvm::sys::Path tempDir;
-  tempDir = llvm::sys::Path::GetTemporaryDirectory();
-  TempDirname = tempDir.getBasename();
-  tempDir.eraseFromDisk(true);
-
-  // We are creating a temp dir in current dir, with the cached name.
-  //  But before that remove if one already exists with that name..
-  tempDir = TempDirname;
-  tempDir.eraseFromDisk(true);
-
-  llvmc::ForceLinkage();
-  return llvmc::Main(argc, argv);
-}

Removed: llvm/branches/wendling/eh/tools/llvmc/example/mcc16/driver/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llvmc/example/mcc16/driver/Makefile?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/tools/llvmc/example/mcc16/driver/Makefile (original)
+++ llvm/branches/wendling/eh/tools/llvmc/example/mcc16/driver/Makefile (removed)
@@ -1,13 +0,0 @@
-##===- llvmc/example/mcc16/driver/Makefile -----------------*- Makefile -*-===##
-#
-#                     The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open
-# Source License. See LICENSE.TXT for details.
-#
-##===----------------------------------------------------------------------===##
-
-LEVEL = $(LLVMC_BASE_LEVEL)/..
-LLVMC_BASED_DRIVER = $(LLVMC_BASED_DRIVER_NAME)
-
-include $(LEVEL)/Makefile.common

Removed: llvm/branches/wendling/eh/tools/llvmc/example/mcc16/plugins/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llvmc/example/mcc16/plugins/Makefile?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/tools/llvmc/example/mcc16/plugins/Makefile (original)
+++ llvm/branches/wendling/eh/tools/llvmc/example/mcc16/plugins/Makefile (removed)
@@ -1,18 +0,0 @@
-##===- llvmc/example/Skeleton/plugins/Makefile -------------*- Makefile -*-===##
-#
-#                     The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open
-# Source License. See LICENSE.TXT for details.
-#
-##===----------------------------------------------------------------------===##
-
-LEVEL = $(LLVMC_BASE_LEVEL)/..
-
-ifneq ($(LLVMC_BUILTIN_PLUGINS),)
-DIRS = $(LLVMC_BUILTIN_PLUGINS)
-endif
-
-export LLVMC_BUILTIN_PLUGIN=1
-
-include $(LEVEL)/Makefile.common

Removed: llvm/branches/wendling/eh/tools/llvmc/example/mcc16/plugins/PIC16Base/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llvmc/example/mcc16/plugins/PIC16Base/Makefile?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/tools/llvmc/example/mcc16/plugins/PIC16Base/Makefile (original)
+++ llvm/branches/wendling/eh/tools/llvmc/example/mcc16/plugins/PIC16Base/Makefile (removed)
@@ -1,17 +0,0 @@
-##===- llvmc/example/Skeleton/plugins/Plugin/Makefile ------*- Makefile -*-===##
-#
-#                     The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License. See LICENSE.TXT for details.
-#
-##===----------------------------------------------------------------------===##
-
-LEVEL = $(LLVMC_BASE_LEVEL)/../..
-
-# Change this to the name of your plugin.
-LLVMC_PLUGIN = PIC16Base
-
-BUILT_SOURCES = AutoGenerated.inc
-
-include $(LEVEL)/Makefile.common

Removed: llvm/branches/wendling/eh/tools/llvmc/example/mcc16/plugins/PIC16Base/PIC16Base.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llvmc/example/mcc16/plugins/PIC16Base/PIC16Base.td?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/tools/llvmc/example/mcc16/plugins/PIC16Base/PIC16Base.td (original)
+++ llvm/branches/wendling/eh/tools/llvmc/example/mcc16/plugins/PIC16Base/PIC16Base.td (removed)
@@ -1,234 +0,0 @@
-//===- PIC16Base.td - PIC16 toolchain driver ---------------*- tablegen -*-===//
-//
-// A basic driver for the PIC16 toolchain.
-//
-//===----------------------------------------------------------------------===//
-
-include "llvm/CompilerDriver/Common.td"
-
-// Options
-
-def OptionList : OptionList<[
- (switch_option "g",
-    (help "Enable Debugging")),
- (switch_option "E",
-    (help "Stop after preprocessing, do not compile")),
- (switch_option "S",
-    (help "Stop after compilation, do not assemble")),
- (switch_option "bc",
-    (help "Stop after b-code generation, do not compile")),
- (switch_option "c",
-    (help "Stop after assemble, do not link")),
- (prefix_option "p",
-    (help "Specify part name")),
- (prefix_list_option "I",
-    (help "Add a directory to include path")),
- (prefix_list_option "L",
-    (help "Add a directory to library path")),
- (prefix_list_option "K",
-    (help "Add a directory to linker script search path")),
- (parameter_option "l",
-    (help "Specify a library to link")),
- (parameter_option "k",
-    (help "Specify a linker script")),
- (parameter_option "m",
-    (help "Generate linker map file with the given name")),
- (prefix_list_option "D",
-    (help "Define a macro")),
- (switch_option "X",
-    (help "Do not invoke mp2hex to create an output hex file.")),
- (switch_option "O0",
-    (help "Do not optimize")),
- (switch_option "O1",
-    (help "Optimization Level 1.")),
- (switch_option "O2",
-    (help "Optimization Level 2.")),
- (switch_option "O3",
-    (help "Optimization Level 3.")),
- (switch_option "Od",
-    (help "Perform Debug-safe Optimizations only.")),
- (switch_option "w",
-    (help "Disable all warnings.")),
-// (switch_option "O1",
-//    (help "Optimization level 1")),
-// (switch_option "O2",
-//    (help "Optimization level 2. (Default)")),
-// (parameter_option "pre-RA-sched",
-//    (help "Example of an option that is passed to llc")),
- (parameter_option "regalloc",
-    (help "Register allocator to use (possible values: simple, linearscan, pbqp, local; default=linearscan)")),
- (prefix_list_option "Wa,", (comma_separated),
-    (help "Pass options to assembler (Run 'gpasm -help' for assembler options)")),
- (prefix_list_option "Wl,", (comma_separated),
-    (help "Pass options to linker (Run 'mplink -help' for linker options)"))
-// (prefix_list_option "Wllc,",
-//    (help "Pass options to llc")),
-// (prefix_list_option "Wo,",
-//    (help "Pass options to llvm-ld"))
-]>;
-
-// Tools
-class clang_based<string language, string cmd, string ext_E> : Tool<
-[(in_language language),
- (out_language "llvm-bitcode"),
- (output_suffix "bc"),
- (command cmd),
- (actions (case
-                (and (multiple_input_files),
-                     (or (switch_on "S"), (switch_on "c"))),
-                  (error "cannot specify -o with -c or -S with multiple files"),
-                (switch_on "E"), [(forward "E"),
-                                  (stop_compilation), (output_suffix ext_E)],
-                (and (switch_on "E"), (empty "o")), (no_out_file),
-                (switch_on "bc"),[(stop_compilation), (output_suffix "bc")],
-                (switch_on "g"), (append_cmd "-g"),
-                (switch_on "w"), (append_cmd "-w"),
-                (switch_on "O1"), (append_cmd ""),
-                (switch_on "O2"), (append_cmd ""),
-                (switch_on "O3"), (append_cmd ""),
-                (switch_on "Od"), (append_cmd ""),
-                (not_empty "D"), (forward "D"),
-                (not_empty "I"), (forward "I"),
-                (switch_on "O0"), (append_cmd "-O0"),
-                (default), (append_cmd "-O1")))
-// (sink)
-]>;
-
-def clang_cc : clang_based<"c", "$CALL(GetBinDir)clang -cc1                                                        -I $CALL(GetStdHeadersDir)                                                      -D $CALL(GetLowerCasePartDefine)                                                -D $CALL(GetUpperCasePartDefine) -triple=pic16-                                 -emit-llvm-bc ", "i">;
-
-//def clang_cc : Tool<[
-// (in_language "c"),
-// (out_language "llvm-bitcode"),
-// (output_suffix "bc"),
-// (cmd_line "$CALL(GetBinDir)clang-cc -I $CALL(GetStdHeadersDir) -triple=pic16- -emit-llvm-bc "),
-// (cmd_line kkkkk
-// (actions (case
-//          (switch_on "g"), (append_cmd "g"),
-//          (not_empty "I"), (forward "I"))),
-// (sink)
-//]>;
-
-
-// pre-link-and-lto step.
-def llvm_ld : Tool<[
- (in_language "llvm-bitcode"),
- (out_language "llvm-bitcode"),
- (output_suffix "bc"),
- (command "$CALL(GetBinDir)llvm-ld -L $CALL(GetStdLibsDir) -disable-licm-promotion -l std"),
- (out_file_option "-b"),
- (actions (case
-          (switch_on "O0"), (append_cmd "-disable-opt"),
-          (switch_on "O1"), (append_cmd "-disable-opt"),
-// Whenever O3 is not specified on the command line, default i.e. disable-inlining will always be added.
-          (switch_on "O2"), (append_cmd ""),
-          (switch_on "O3"), (append_cmd ""),
-          (default), (append_cmd "-disable-inlining"))),
- (join)
-]>;
-
-// optimize single file
-def llvm_ld_optimizer : Tool<[
- (in_language "llvm-bitcode"),
- (out_language "llvm-bitcode"),
- (output_suffix "bc"),
-// FIXME: we are still not disabling licm-promotion.
-// -disable-licm-promotion and building stdn library causes c16-71 to fail.
- (command "$CALL(GetBinDir)llvm-ld "),
- (out_file_option "-b"),
- (actions (case
-          (switch_on "O0"), (append_cmd "-disable-opt"),
-          (switch_on "O1"), (append_cmd "-disable-opt"),
-// Whenever O3 is not specified on the command line, default i.e. disable-inlining will always be added.
-          (switch_on "O2"), (append_cmd ""),
-          (switch_on "O3"), (append_cmd ""),
-          (default), (append_cmd "-disable-inlining")))
-]>;
-
-// optimizer step.
-def pic16passes : Tool<[
- (in_language "llvm-bitcode"),
- (out_language "llvm-bitcode"),
- (output_suffix "obc"),
- (command "$CALL(GetBinDir)opt -pic16cloner -pic16overlay -f"),
- (actions (case
-          (switch_on "O0"), (append_cmd "-disable-opt")))
-]>;
-
-def llc : Tool<[
- (in_language "llvm-bitcode"),
- (out_language "assembler"),
- (output_suffix "s"),
- (command "$CALL(GetBinDir)llc -march=pic16 -disable-jump-tables -pre-RA-sched=list-burr -f"),
- (actions (case
-          (switch_on "S"), (stop_compilation),
-//          (not_empty "Wllc,"), (unpack_values "Wllc,"),
-//         (not_empty "pre-RA-sched"), (forward "pre-RA-sched")))
-         (not_empty "regalloc"), (forward "regalloc"),
-         (empty "regalloc"), (append_cmd "-regalloc=linearscan")))
-]>;
-
-def gpasm : Tool<[
- (in_language "assembler"),
- (out_language "object-code"),
- (output_suffix "o"),
- (command "$CALL(GetBinDir)gpasm -z -r decimal -I $CALL(GetStdAsmHeadersDir) -C -c -w 2"),
- (actions (case
-          (switch_on "c"), (stop_compilation),
-          (switch_on "g"), (append_cmd "-g"),
-          (not_empty "p"), (forward "p"),
-          (empty "p"), (append_cmd "-p 16f1xxx"),
-          (not_empty "Wa,"), (forward_value "Wa,")))
-]>;
-
-def mplink : Tool<[
- (in_language "object-code"),
- (out_language "executable"),
- (output_suffix "cof"),
- (command "$CALL(GetBinDir)mplink -e -k $CALL(GetStdLinkerScriptsDir) -l $CALL(GetStdLibsDir) intrinsics.lib stdn.lib"),
- (actions (case
-          (not_empty "Wl,"), (forward_value "Wl,"),
-          (switch_on "X"), (append_cmd "-x"),
-          (not_empty "L"), (forward_as "L", "-l"),
-          (not_empty "K"), (forward_as "K", "-k"),
-          (not_empty "m"), (forward "m"),
-          (not_empty "p"), [(forward "p"), (append_cmd "-c")],
-          (empty "p"), (append_cmd "-p 16f1xxx -c"),
-//          (not_empty "l"), [(unpack_values "l"),(append_cmd ".lib")])),
-          (not_empty "k"), (forward "k"),
-          (not_empty "l"), (forward "l"))),
- (join)
-]>;
-
-// Language map
-
-def LanguageMap : LanguageMap<[
-    LangToSuffixes<"c", ["c"]>,
-    LangToSuffixes<"c-cpp-output", ["i"]>,
-    LangToSuffixes<"assembler", ["s"]>,
-    LangToSuffixes<"assembler-with-cpp", ["S"]>,
-    LangToSuffixes<"llvm-assembler", ["ll"]>,
-    LangToSuffixes<"llvm-bitcode", ["bc"]>,
-    LangToSuffixes<"object-code", ["o"]>,
-    LangToSuffixes<"executable", ["cof"]>
-]>;
-
-// Compilation graph
-
-def CompilationGraph : CompilationGraph<[
-    Edge<"root", "clang_cc">,
-    Edge<"root", "llvm_ld">,
-    OptionalEdge<"root", "llvm_ld_optimizer", (case
-                                         (switch_on "S"), (inc_weight),
-                                         (switch_on "c"), (inc_weight))>,
-    Edge<"root", "gpasm">,
-    Edge<"root", "mplink">,
-    Edge<"clang_cc", "llvm_ld">,
-    OptionalEdge<"clang_cc", "llvm_ld_optimizer", (case
-                                         (switch_on "S"), (inc_weight),
-                                         (switch_on "c"), (inc_weight))>,
-    Edge<"llvm_ld", "pic16passes">,
-    Edge<"llvm_ld_optimizer", "pic16passes">,
-    Edge<"pic16passes", "llc">,
-    Edge<"llc", "gpasm">,
-    Edge<"gpasm", "mplink">
-]>;

Removed: llvm/branches/wendling/eh/tools/llvmc/example/mcc16/plugins/PIC16Base/PluginMain.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llvmc/example/mcc16/plugins/PIC16Base/PluginMain.cpp?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/tools/llvmc/example/mcc16/plugins/PIC16Base/PluginMain.cpp (original)
+++ llvm/branches/wendling/eh/tools/llvmc/example/mcc16/plugins/PIC16Base/PluginMain.cpp (removed)
@@ -1,106 +0,0 @@
-#include "AutoGenerated.inc"
-
-#include "llvm/System/Path.h"
-#include "llvm/Support/raw_ostream.h"
-
-using namespace llvm;
-
-namespace llvmc {
-  extern char *ProgramName;
-}
-
-  
-
-// Returns the platform specific directory separator via #ifdefs.
-// FIXME: This currently work on linux and windows only. It does not 
-// work on other unices. 
-static std::string GetDirSeparator() {
-#if __linux__ || __APPLE__
-  return "/";
-#else
-  return "\\";
-#endif
-}
-
-namespace hooks {
-// Get preprocessor define for the part.
-// It is __partname format in lower case.
-std::string
-GetLowerCasePartDefine(void) {
-  std::string Partname;
-  if (AutoGeneratedParameter_p.empty()) {
-    Partname = "16f1xxx";
-  } else {
-    Partname = AutoGeneratedParameter_p;
-  }
-
-  std::string LowerCase;
-  for (unsigned i = 0; i < Partname.size(); i++) {
-    LowerCase.push_back(std::tolower(Partname[i]));
-  }
-
-  return "__" + LowerCase;
-}
-
-std::string
-GetUpperCasePartDefine(void) {
-  std::string Partname;
-  if (AutoGeneratedParameter_p.empty()) {
-    Partname = "16f1xxx";
-  } else {
-    Partname = AutoGeneratedParameter_p;
-  }
-
-  std::string UpperCase;
-  for (unsigned i = 0; i < Partname.size(); i++) {
-    UpperCase.push_back(std::toupper(Partname[i]));
-  }
-
-  return "__" +  UpperCase;
-}
-
-
-// Get the dir where c16 executables reside.
-std::string GetBinDir() {
-  // Construct a Path object from the program name.  
-  void *P = (void*) (intptr_t) GetBinDir;
-  sys::Path ProgramFullPath 
-    = sys::Path::GetMainExecutable(llvmc::ProgramName, P);
-
-  // Get the dir name for the program. It's last component should be 'bin'.
-  std::string BinDir = ProgramFullPath.getDirname();
-
-  // llvm::errs() << "BinDir: " << BinDir << '\n';
-  return BinDir + GetDirSeparator();
-}
-
-// Get the Top-level Installation dir for c16.
-std::string GetInstallDir() {
-  sys::Path BinDirPath = sys::Path(GetBinDir());
-
-  // Go one more level up to get the install dir.
-  std::string InstallDir  = BinDirPath.getDirname();
-  
-  return InstallDir + GetDirSeparator();
-}
-
-// Get the dir where the c16 header files reside.
-std::string GetStdHeadersDir() {
-  return GetInstallDir() + "include";
-}
-
-// Get the dir where the assembler header files reside.
-std::string GetStdAsmHeadersDir() {
-  return GetInstallDir() + "inc";
-}
-
-// Get the dir where the linker scripts reside.
-std::string GetStdLinkerScriptsDir() {
-  return GetInstallDir() + "lkr";
-}
-
-// Get the dir where startup code, intrinsics and lib reside.
-std::string GetStdLibsDir() {
-  return GetInstallDir() + "lib";
-}
-}

Removed: llvm/branches/wendling/eh/tools/llvmc/plugins/Base/Base.td.in
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llvmc/plugins/Base/Base.td.in?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/tools/llvmc/plugins/Base/Base.td.in (original)
+++ llvm/branches/wendling/eh/tools/llvmc/plugins/Base/Base.td.in (removed)
@@ -1,377 +0,0 @@
-//===- Base.td - LLVMC toolchain descriptions --------------*- tablegen -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file contains compilation graph description used by llvmc.
-//
-//===----------------------------------------------------------------------===//
-
-include "llvm/CompilerDriver/Common.td"
-
-// Options
-
-def OptList : OptionList<[
- (switch_option "emit-llvm",
-    (help "Emit LLVM .ll files instead of native object files")),
- (switch_option "E",
-    (help "Stop after the preprocessing stage, do not run the compiler")),
- (switch_option "fsyntax-only",
-    (help "Stop after checking the input for syntax errors")),
- (switch_option "opt",
-    (help "Enable opt")),
- (switch_option "O0",
-    (help "Turn off optimization"), (zero_or_more)),
- (switch_option "O1",
-    (help "Optimization level 1"), (zero_or_more)),
- (switch_option "O2",
-    (help "Optimization level 2"), (zero_or_more)),
- (switch_option "O3",
-    (help "Optimization level 3"), (zero_or_more)),
- (switch_option "S",
-    (help "Stop after compilation, do not assemble")),
- (switch_option "c",
-    (help "Compile and assemble, but do not link")),
- (switch_option "pthread",
-    (help "Enable threads")),
- (switch_option "m32",
-    (help "Generate code for a 32-bit environment"), (hidden)),
- (switch_option "m64",
-    (help "Generate code for a 64-bit environment"), (hidden)),
- (switch_option "fPIC",
-    (help "Relocation model: PIC"), (hidden)),
- (switch_option "mdynamic-no-pic",
-    (help "Relocation model: dynamic-no-pic"), (hidden)),
- (switch_option "shared",
-     (help "Create a DLL instead of the regular executable")),
- (parameter_option "linker",
-    (help "Choose linker (possible values: gcc, g++)")),
- (parameter_option "mtune",
-    (help "Target a specific CPU type"), (hidden), (forward_not_split)),
-
- // TODO: Add a conditional compilation mechanism to make Darwin-only options
- // like '-arch' really Darwin-only.
-
- (parameter_option "arch",
-    (help "Compile for the specified target architecture"), (hidden)),
- (parameter_option "march",
-    (help "A synonym for -mtune"), (hidden), (forward_not_split)),
- (parameter_option "mcpu",
-    (help "A deprecated synonym for -mtune"), (hidden), (forward_not_split)),
- (switch_option "mfix-and-continue",
-    (help "Needed by gdb to load .o files dynamically"), (hidden)),
- (parameter_option "MF",
-    (help "Specify a file to write dependencies to"), (hidden)),
- (parameter_list_option "MT",
-    (help "Change the name of the rule emitted by dependency generation"),
-    (hidden)),
- (parameter_list_option "include",
-    (help "Include the named file prior to preprocessing")),
- (parameter_list_option "iquote",
-    (help "Search dir only for files requested with #inlcude \"file\""),
-    (hidden)),
- (parameter_list_option "framework",
-    (help "Specifies a framework to link against")),
- (parameter_list_option "weak_framework",
-    (help "Specifies a framework to weakly link against"), (hidden)),
- (parameter_option "filelist", (hidden),
-    (help "Link the files listed in file")),
- (prefix_list_option "F",
-    (help "Add a directory to framework search path")),
- (prefix_list_option "I",
-    (help "Add a directory to include path")),
- (prefix_list_option "D",
-    (help "Define a macro")),
- (parameter_list_option "Xpreprocessor", (hidden),
-    (help "Pass options to preprocessor")),
- (prefix_list_option "Wa,", (comma_separated),
-    (help "Pass options to assembler")),
- (parameter_list_option "Xassembler", (hidden),
-    (help "Pass options to assembler")),
- (prefix_list_option "Wllc,", (comma_separated),
-    (help "Pass options to llc")),
- (prefix_list_option "L",
-    (help "Add a directory to link path")),
- (prefix_list_option "l",
-    (help "Search a library when linking")),
- (prefix_list_option "Wl,",
-    (help "Pass options to linker")),
- (parameter_list_option "Xlinker", (hidden),
-    (help "Pass options to linker")),
- (prefix_list_option "Wo,", (comma_separated),
-    (help "Pass options to opt")),
- (prefix_list_option "m",
-     (help "Enable or disable various extensions (-mmmx, -msse, etc.)"),
-     (hidden)),
- (switch_option "dynamiclib", (hidden),
-     (help "Produce a dynamic library")),
- (switch_option "prebind", (hidden),
-     (help "Prebind all undefined symbols")),
- (switch_option "dead_strip", (hidden),
-     (help "Remove unreachable blocks of code")),
- (switch_option "single_module", (hidden),
-     (help "Build the library so it contains only one module")),
- (parameter_option "install_name", (hidden),
-     (help "File name the library will be installed in")),
- (parameter_option "compatibility_version", (hidden),
-     (help "Compatibility version number")),
- (parameter_option "current_version", (hidden),
-     (help "Current version number"))
-]>;
-
-// Option preprocessor.
-
-def Preprocess : OptionPreprocessor<
-(case (not (any_switch_on ["O0", "O1", "O2", "O3"])),
-           (set_option "O2"),
-      (and (switch_on "O3"), (any_switch_on ["O0", "O1", "O2"])),
-           (unset_option ["O0", "O1", "O2"]),
-      (and (switch_on "O2"), (any_switch_on ["O0", "O1"])),
-           (unset_option ["O0", "O1"]),
-      (switch_on ["O1", "O0"]),
-           (unset_option "O0"))
->;
-
-// Tools
-
-class llvm_gcc_based <string cmd_prefix, string in_lang,
-                      string E_ext, string out_lang> : Tool<
-[(in_language in_lang),
- (out_language "llvm-bitcode"),
- (output_suffix out_lang),
- (command cmd_prefix),
- (actions
-     (case
-         (and (not_empty "o"),
-              (multiple_input_files), (or (switch_on "S"), (switch_on "c"))),
-              (error "cannot specify -o with -c or -S with multiple files"),
-         (switch_on "E"),
-              [(forward "E"), (stop_compilation), (output_suffix E_ext)],
-         (and (switch_on "E"), (empty "o")), (no_out_file),
-         (switch_on ["emit-llvm", "S"]),
-              [(output_suffix "ll"), (stop_compilation)],
-         (switch_on ["emit-llvm", "c"]), (stop_compilation),
-         (switch_on "fsyntax-only"), [(forward "fsyntax-only"),
-                                      (no_out_file), (stop_compilation)],
-         (switch_on ["S", "emit-llvm"]), [(forward "S"), (forward "emit-llvm")],
-         (not (or (switch_on ["S", "emit-llvm"]), (switch_on "fsyntax-only"))),
-             [(append_cmd "-c"), (append_cmd "-emit-llvm")],
-
-         // Forwards
-         (not_empty "Xpreprocessor"), (forward "Xpreprocessor"),
-         (not_empty "include"), (forward "include"),
-         (not_empty "iquote"), (forward "iquote"),
-         (not_empty "save-temps"), (append_cmd "-save-temps"),
-         (not_empty "I"), (forward "I"),
-         (not_empty "F"), (forward "F"),
-         (not_empty "D"), (forward "D"),
-         (not_empty "arch"), (forward "arch"),
-         (not_empty "march"), (forward "march"),
-         (not_empty "mtune"), (forward "mtune"),
-         (not_empty "mcpu"), (forward "mcpu"),
-         (not_empty "m"), (forward "m"),
-         (switch_on "mfix-and-continue"), (forward "mfix-and-continue"),
-         (switch_on "m32"), (forward "m32"),
-         (switch_on "m64"), (forward "m64"),
-         (switch_on "O0"), (forward "O0"),
-         (switch_on "O1"), (forward "O1"),
-         (switch_on "O2"), (forward "O2"),
-         (switch_on "O3"), (forward "O3"),
-         (switch_on "fPIC"), (forward "fPIC"),
-         (switch_on "mdynamic-no-pic"), (forward "mdynamic-no-pic"),
-         (not_empty "MF"), (forward "MF"),
-         (not_empty "MT"), (forward "MT"))),
- (sink)
-]>;
-
-def llvm_gcc_c : llvm_gcc_based<"@LLVMGCCCOMMAND@ -x c", "c", "i", "bc">;
-def llvm_gcc_cpp : llvm_gcc_based<"@LLVMGXXCOMMAND@ -x c++", "c++", "i", "bc">;
-def llvm_gcc_m : llvm_gcc_based<"@LLVMGCCCOMMAND@ -x objective-c",
-                                                  "objective-c", "mi", "bc">;
-def llvm_gcc_mxx : llvm_gcc_based<"@LLVMGCCCOMMAND@ -x objective-c++",
-                                  "objective-c++", "mi", "bc">;
-
-def llvm_gcc_c_pch : llvm_gcc_based<"@LLVMGCCCOMMAND@ -x c-header",
-                                                      "c-header", "i", "gch">;
-def llvm_gcc_cpp_pch : llvm_gcc_based<"@LLVMGXXCOMMAND@ -x c++-header",
-                                                        "c++-header",
-                                                        "i", "gch">;
-def llvm_gcc_m_pch : llvm_gcc_based<"@LLVMGCCCOMMAND@ -x objective-c-header",
-                                                      "objective-c-header",
-                                                      "mi", "gch">;
-def llvm_gcc_mxx_pch
-    : llvm_gcc_based<"@LLVMGCCCOMMAND@ -x objective-c++-header",
-                                       "objective-c++-header", "mi", "gch">;
-
-def opt : Tool<
-[(in_language "llvm-bitcode"),
- (out_language "llvm-bitcode"),
- (output_suffix "bc"),
- (actions (case (not_empty "Wo,"), (forward_value "Wo,"),
-                (switch_on "O1"), (forward "O1"),
-                (switch_on "O2"), (forward "O2"),
-                (switch_on "O3"), (forward "O3"))),
- (command "opt -f")
-]>;
-
-def llvm_as : Tool<
-[(in_language "llvm-assembler"),
- (out_language "llvm-bitcode"),
- (output_suffix "bc"),
- (command "llvm-as"),
- (actions (case (switch_on "emit-llvm"), (stop_compilation)))
-]>;
-
-def llvm_gcc_assembler : Tool<
-[(in_language "assembler"),
- (out_language "object-code"),
- (output_suffix "o"),
- (command "@LLVMGCCCOMMAND@ -c -x assembler"),
- (actions (case
-          (switch_on "c"), (stop_compilation),
-          (not_empty "arch"), (forward "arch"),
-          (not_empty "Xassembler"), (forward "Xassembler"),
-          (switch_on "m32"), (forward "m32"),
-          (switch_on "m64"), (forward "m64"),
-          (not_empty "Wa,"), (forward "Wa,")))
-]>;
-
-def llc : Tool<
-[(in_language ["llvm-bitcode", "llvm-assembler"]),
- (out_language "assembler"),
- (output_suffix "s"),
- (command "llc"),
- (actions (case
-          (switch_on "S"), (stop_compilation),
-          (switch_on "O0"), (forward "O0"),
-          (switch_on "O1"), (forward "O1"),
-          (switch_on "O2"), (forward "O2"),
-          (switch_on "O3"), (forward "O3"),
-          (switch_on "fPIC"), (append_cmd "-relocation-model=pic"),
-          (switch_on "mdynamic-no-pic"),
-                     (append_cmd "-relocation-model=dynamic-no-pic"),
-          (not_empty "march"), (forward_as "mtune", "-mcpu"),
-          (not_empty "mtune"), (forward_as "mtune", "-mcpu"),
-          (not_empty "mcpu"), (forward "mcpu"),
-          (not_empty "m"), (forward_transformed_value "m", "ConvertToMAttr"),
-          (not_empty "Wllc,"), (forward_value "Wllc,")))
-]>;
-
-// Base class for linkers
-class llvm_gcc_based_linker <string cmd_prefix, dag on_empty> : Tool<
-[(in_language ["object-code", "static-library"]),
- (out_language "executable"),
- (output_suffix "out"),
- (command cmd_prefix),
- (works_on_empty (case (and (not_empty "filelist"), on_empty), true,
-                       (default), false)),
- (join),
- (actions (case
-          (switch_on "pthread"), (append_cmd "-lpthread"),
-          (not_empty "L"), (forward "L"),
-          (not_empty "F"), (forward "F"),
-          (not_empty "arch"), (forward "arch"),
-          (not_empty "framework"), (forward "framework"),
-          (not_empty "weak_framework"), (forward "weak_framework"),
-          (not_empty "filelist"), (forward "filelist"),
-          (switch_on "m32"), (forward "m32"),
-          (switch_on "m64"), (forward "m64"),
-          (not_empty "l"), (forward "l"),
-          (not_empty "Xlinker"), (forward "Xlinker"),
-          (not_empty "Wl,"), (forward "Wl,"),
-          (switch_on "shared"), (forward "shared"),
-          (switch_on "dynamiclib"), (forward "dynamiclib"),
-          (switch_on "prebind"), (forward "prebind"),
-          (switch_on "dead_strip"), (forward "dead_strip"),
-          (switch_on "single_module"), (forward "single_module"),
-          (not_empty "compatibility_version"),
-                     (forward "compatibility_version"),
-          (not_empty "current_version"), (forward "current_version"),
-          (not_empty "install_name"), (forward "install_name")))
-]>;
-
-// Default linker
-def llvm_gcc_linker : llvm_gcc_based_linker<"@LLVMGCCCOMMAND@",
-    (not (or (parameter_equals "linker", "g++"),
-         (parameter_equals "linker", "c++")))>;
-// Alternative linker for C++
-def llvm_gcc_cpp_linker : llvm_gcc_based_linker<"@LLVMGXXCOMMAND@",
-    (or (parameter_equals "linker", "g++"),
-        (parameter_equals "linker", "c++"))>;
-
-// Language map
-
-def LanguageMap : LanguageMap<
-    [LangToSuffixes<"c++", ["cc", "cp", "cxx", "cpp", "CPP", "c++", "C"]>,
-     LangToSuffixes<"c++-header", ["hpp"]>,
-     LangToSuffixes<"c", ["c"]>,
-     LangToSuffixes<"c-header", ["h"]>,
-     LangToSuffixes<"c-cpp-output", ["i"]>,
-     LangToSuffixes<"objective-c-cpp-output", ["mi"]>,
-     LangToSuffixes<"objective-c++", ["mm"]>,
-     LangToSuffixes<"objective-c++-header", ["hmm"]>,
-     LangToSuffixes<"objective-c", ["m"]>,
-     LangToSuffixes<"objective-c-header", ["hm"]>,
-     LangToSuffixes<"assembler", ["s"]>,
-     LangToSuffixes<"assembler-with-cpp", ["S"]>,
-     LangToSuffixes<"llvm-assembler", ["ll"]>,
-     LangToSuffixes<"llvm-bitcode", ["bc"]>,
-     LangToSuffixes<"object-code", ["o", "*empty*"]>,
-     LangToSuffixes<"static-library", ["a", "lib"]>,
-     LangToSuffixes<"executable", ["out"]>
-     ]>;
-
-// Compilation graph
-
-def CompilationGraph : CompilationGraph<[
-    Edge<"root", "llvm_gcc_c">,
-    Edge<"root", "llvm_gcc_assembler">,
-    Edge<"root", "llvm_gcc_cpp">,
-    Edge<"root", "llvm_gcc_m">,
-    Edge<"root", "llvm_gcc_mxx">,
-    Edge<"root", "llc">,
-
-    Edge<"root", "llvm_gcc_c_pch">,
-    Edge<"root", "llvm_gcc_cpp_pch">,
-    Edge<"root", "llvm_gcc_m_pch">,
-    Edge<"root", "llvm_gcc_mxx_pch">,
-
-    Edge<"llvm_gcc_c", "llc">,
-    Edge<"llvm_gcc_cpp", "llc">,
-    Edge<"llvm_gcc_m", "llc">,
-    Edge<"llvm_gcc_mxx", "llc">,
-    Edge<"llvm_as", "llc">,
-
-    OptionalEdge<"root", "llvm_as",
-                         (case (switch_on "emit-llvm"), (inc_weight))>,
-    OptionalEdge<"llvm_gcc_c", "opt", (case (switch_on "opt"), (inc_weight))>,
-    OptionalEdge<"llvm_gcc_cpp", "opt", (case (switch_on "opt"), (inc_weight))>,
-    OptionalEdge<"llvm_gcc_m", "opt", (case (switch_on "opt"), (inc_weight))>,
-    OptionalEdge<"llvm_gcc_mxx", "opt", (case (switch_on "opt"), (inc_weight))>,
-    OptionalEdge<"llvm_as", "opt", (case (switch_on "opt"), (inc_weight))>,
-    Edge<"opt", "llc">,
-
-    Edge<"llc", "llvm_gcc_assembler">,
-    Edge<"llvm_gcc_assembler", "llvm_gcc_linker">,
-    OptionalEdge<"llvm_gcc_assembler", "llvm_gcc_cpp_linker",
-                 (case
-                     (or (input_languages_contain "c++"),
-                         (input_languages_contain "objective-c++")),
-                     (inc_weight),
-                     (or (parameter_equals "linker", "g++"),
-                         (parameter_equals "linker", "c++")), (inc_weight))>,
-
-
-    Edge<"root", "llvm_gcc_linker">,
-    OptionalEdge<"root", "llvm_gcc_cpp_linker",
-                 (case
-                     (or (input_languages_contain "c++"),
-                         (input_languages_contain "objective-c++")),
-                     (inc_weight),
-                     (or (parameter_equals "linker", "g++"),
-                         (parameter_equals "linker", "c++")), (inc_weight))>
-    ]>;

Removed: llvm/branches/wendling/eh/tools/llvmc/plugins/Base/Hooks.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llvmc/plugins/Base/Hooks.cpp?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/tools/llvmc/plugins/Base/Hooks.cpp (original)
+++ llvm/branches/wendling/eh/tools/llvmc/plugins/Base/Hooks.cpp (removed)
@@ -1,33 +0,0 @@
-#include <string>
-#include <vector>
-
-namespace hooks {
-typedef std::vector<std::string> StrVec;
-
-/// ConvertToMAttr - Convert -m* and -mno-* to -mattr=+*,-*
-std::string ConvertToMAttr(const StrVec& Opts) {
-  std::string out("-mattr=");
-
-  bool firstIter = true;
-  for (StrVec::const_iterator B = Opts.begin(), E = Opts.end(); B!=E; ++B) {
-    const std::string& Arg = *B;
-
-    if (firstIter)
-      firstIter = false;
-    else
-      out += ",";
-
-    if (Arg.find("no-") == 0 && Arg[3] != 0) {
-      out += '-';
-      out += Arg.c_str() + 3;
-    }
-    else {
-      out += '+';
-      out += Arg;
-    }
-  }
-
-  return out;
-}
-
-}

Removed: llvm/branches/wendling/eh/tools/llvmc/plugins/Base/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llvmc/plugins/Base/Makefile?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/tools/llvmc/plugins/Base/Makefile (original)
+++ llvm/branches/wendling/eh/tools/llvmc/plugins/Base/Makefile (removed)
@@ -1,15 +0,0 @@
-##===- tools/llvmc/plugins/Base/Makefile -------------------*- Makefile -*-===##
-#
-#                     The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License. See LICENSE.TXT for details.
-#
-##===----------------------------------------------------------------------===##
-
-LEVEL = ../../../..
-
-LLVMC_PLUGIN = Base
-BUILT_SOURCES = AutoGenerated.inc
-
-include $(LEVEL)/Makefile.common

Removed: llvm/branches/wendling/eh/tools/llvmc/plugins/Base/PluginMain.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llvmc/plugins/Base/PluginMain.cpp?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/tools/llvmc/plugins/Base/PluginMain.cpp (original)
+++ llvm/branches/wendling/eh/tools/llvmc/plugins/Base/PluginMain.cpp (removed)
@@ -1 +0,0 @@
-#include "AutoGenerated.inc"

Removed: llvm/branches/wendling/eh/tools/llvmc/plugins/Clang/Clang.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llvmc/plugins/Clang/Clang.td?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/tools/llvmc/plugins/Clang/Clang.td (original)
+++ llvm/branches/wendling/eh/tools/llvmc/plugins/Clang/Clang.td (removed)
@@ -1,101 +0,0 @@
-include "llvm/CompilerDriver/Common.td"
-
-def Priority : PluginPriority<1>;
-
-def Options : OptionList<[
-// Extern options
-(switch_option "E", (extern)),
-(switch_option "S", (extern)),
-(switch_option "c", (extern)),
-(switch_option "fsyntax-only", (extern)),
-(switch_option "emit-llvm", (extern)),
-(switch_option "pthread", (extern)),
-(parameter_list_option "I", (extern)),
-(parameter_list_option "include", (extern)),
-(parameter_list_option "L", (extern)),
-(parameter_list_option "l", (extern)),
-(prefix_list_option "Wa,", (extern)),
-(prefix_list_option "Wl,", (extern)),
-
-(switch_option "clang", (help "Use Clang instead of llvm-gcc"))
-]>;
-
-class clang_based<string language, string cmd, string ext_E> : Tool<
-[(in_language language),
- (out_language "llvm-bitcode"),
- (output_suffix "bc"),
- (command cmd),
- (actions (case (switch_on "E"),
-                    [(forward "E"), (stop_compilation), (output_suffix ext_E)],
-                (and (switch_on "E"), (empty "o")), (no_out_file),
-                (switch_on "fsyntax-only"), (stop_compilation),
-                (switch_on ["S", "emit-llvm"]),
-                           [(append_cmd "-emit-llvm"),
-                            (stop_compilation), (output_suffix "ll")],
-                (not (switch_on ["S", "emit-llvm"])),
-                     (append_cmd "-emit-llvm-bc"),
-                (switch_on ["c", "emit-llvm"]),
-                           (stop_compilation),
-                (not_empty "include"), (forward "include"),
-                (not_empty "I"), (forward "I"))),
- (sink)
-]>;
-
-def clang_c : clang_based<"c", "clang -x c", "i">;
-def clang_cpp : clang_based<"c++", "clang -x c++", "i">;
-def clang_objective_c : clang_based<"objective-c",
-    "clang -x objective-c", "mi">;
-def clang_objective_cpp : clang_based<"objective-c++",
-    "clang -x objective-c++", "mi">;
-
-def as : Tool<
-[(in_language "assembler"),
- (out_language "object-code"),
- (output_suffix "o"),
- (command "as"),
- (actions (case (not_empty "Wa,"), (forward_value "Wa,"),
-                (switch_on "c"), (stop_compilation)))
-]>;
-
-// Default linker
-def llvm_ld : Tool<
-[(in_language "object-code"),
- (out_language "executable"),
- (output_suffix "out"),
- (command "llvm-ld -native -disable-internalize"),
- (actions (case
-          (switch_on "pthread"), (append_cmd "-lpthread"),
-          (not_empty "L"), (forward "L"),
-          (not_empty "l"), (forward "l"),
-          (not_empty "Wl,"), (forward_value "Wl,"))),
- (join)
-]>;
-
-// Language map
-
-def LanguageMap : LanguageMap<[
-    LangToSuffixes<"c++", ["cc", "cp", "cxx", "cpp", "CPP", "c++", "C"]>,
-    LangToSuffixes<"c", ["c"]>,
-    LangToSuffixes<"objective-c", ["m"]>,
-    LangToSuffixes<"c-cpp-output", ["i"]>,
-    LangToSuffixes<"objective-c-cpp-output", ["mi"]>
-]>;
-
-// Compilation graph
-
-def CompilationGraph : CompilationGraph<[
-    OptionalEdge<"root", "clang_c",
-                         (case (switch_on "clang"), (inc_weight))>,
-    OptionalEdge<"root", "clang_cpp",
-                         (case (switch_on "clang"), (inc_weight))>,
-    OptionalEdge<"root", "clang_objective_c",
-                         (case (switch_on "clang"), (inc_weight))>,
-    OptionalEdge<"root", "clang_objective_cpp",
-                         (case (switch_on "clang"), (inc_weight))>,
-    Edge<"clang_c", "llc">,
-    Edge<"clang_cpp", "llc">,
-    Edge<"clang_objective_c", "llc">,
-    Edge<"clang_objective_cpp", "llc">,
-    OptionalEdge<"llc", "as", (case (switch_on "clang"), (inc_weight))>,
-    Edge<"as", "llvm_ld">
-]>;

Removed: llvm/branches/wendling/eh/tools/llvmc/plugins/Clang/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llvmc/plugins/Clang/Makefile?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/tools/llvmc/plugins/Clang/Makefile (original)
+++ llvm/branches/wendling/eh/tools/llvmc/plugins/Clang/Makefile (removed)
@@ -1,15 +0,0 @@
-##===- tools/llvmc/plugins/Clang/Makefile ------------------*- Makefile -*-===##
-#
-#                     The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License. See LICENSE.TXT for details.
-#
-##===----------------------------------------------------------------------===##
-
-LEVEL = ../../../..
-
-LLVMC_PLUGIN = Clang
-BUILT_SOURCES = AutoGenerated.inc
-
-include $(LEVEL)/Makefile.common

Removed: llvm/branches/wendling/eh/tools/llvmc/plugins/Clang/PluginMain.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llvmc/plugins/Clang/PluginMain.cpp?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/tools/llvmc/plugins/Clang/PluginMain.cpp (original)
+++ llvm/branches/wendling/eh/tools/llvmc/plugins/Clang/PluginMain.cpp (removed)
@@ -1 +0,0 @@
-#include "AutoGenerated.inc"

Removed: llvm/branches/wendling/eh/tools/llvmc/plugins/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/llvmc/plugins/Makefile?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/tools/llvmc/plugins/Makefile (original)
+++ llvm/branches/wendling/eh/tools/llvmc/plugins/Makefile (removed)
@@ -1,18 +0,0 @@
-##===- tools/llvmc/plugins/Makefile ------------------------*- Makefile -*-===##
-#
-#                     The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open
-# Source License. See LICENSE.TXT for details.
-#
-##===----------------------------------------------------------------------===##
-
-LEVEL = ../../..
-
-ifneq ($(LLVMC_BUILTIN_PLUGINS),)
-DIRS = $(LLVMC_BUILTIN_PLUGINS)
-endif
-
-export LLVMC_BUILTIN_PLUGIN=1
-
-include $(LEVEL)/Makefile.common

Propchange: llvm/branches/wendling/eh/tools/llvmc/src/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Oct 26 19:48:03 2010
@@ -0,0 +1,11 @@
+Debug
+Debug+Checks
+Debug+Coverage
+Debug+Coverage-Asserts
+Release
+Release-Asserts
+Release+Coverage
+Debug+Asserts
+Release+Asserts
+AutoGenerated.inc
+Base.td

Modified: llvm/branches/wendling/eh/tools/lto/LTOCodeGenerator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/lto/LTOCodeGenerator.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/tools/lto/LTOCodeGenerator.cpp (original)
+++ llvm/branches/wendling/eh/tools/lto/LTOCodeGenerator.cpp Tue Oct 26 19:48:03 2010
@@ -39,6 +39,7 @@
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/StandardPasses.h"
 #include "llvm/Support/SystemUtils.h"
+#include "llvm/Support/ToolOutputFile.h"
 #include "llvm/System/Host.h"
 #include "llvm/System/Program.h"
 #include "llvm/System/Signals.h"
@@ -119,6 +120,11 @@
     return true;
 }
 
+void LTOCodeGenerator::setCpu(const char* mCpu)
+{
+  _mCpu = mCpu;
+}
+
 void LTOCodeGenerator::setAssemblerPath(const char* path)
 {
     if ( _assemblerPath )
@@ -126,6 +132,14 @@
     _assemblerPath = new sys::Path(path);
 }
 
+void LTOCodeGenerator::setAssemblerArgs(const char** args, int nargs)
+{
+  for (int i = 0; i < nargs; ++i) {
+    const char *arg = args[i];
+    _assemblerArgs.push_back(arg);
+  }
+}
+
 void LTOCodeGenerator::addMustPreserveSymbol(const char* sym)
 {
     _mustPreserveSymbols[sym] = 1;
@@ -142,8 +156,8 @@
 
   // create output file
   std::string ErrInfo;
-  raw_fd_ostream Out(path, ErrInfo,
-                     raw_fd_ostream::F_Binary);
+  tool_output_file Out(path, ErrInfo,
+                       raw_fd_ostream::F_Binary);
   if (!ErrInfo.empty()) {
     errMsg = "could not open bitcode file for writing: ";
     errMsg += path;
@@ -151,16 +165,17 @@
   }
     
   // write bitcode to it
-  WriteBitcodeToFile(_linker.getModule(), Out);
-  Out.close();
+  WriteBitcodeToFile(_linker.getModule(), Out.os());
+  Out.os().close();
 
-  if (Out.has_error()) {
+  if (Out.os().has_error()) {
     errMsg = "could not write bitcode file: ";
     errMsg += path;
-    Out.clear_error();
+    Out.os().clear_error();
     return true;
   }
   
+  Out.keep();
   return false;
 }
 
@@ -176,11 +191,16 @@
     // generate assembly code
     bool genResult = false;
     {
-      raw_fd_ostream asmFD(uniqueAsmPath.c_str(), errMsg);
-      formatted_raw_ostream asmFile(asmFD);
+      tool_output_file asmFile(uniqueAsmPath.c_str(), errMsg);
       if (!errMsg.empty())
         return NULL;
-      genResult = this->generateAssemblyCode(asmFile, errMsg);
+      genResult = this->generateAssemblyCode(asmFile.os(), errMsg);
+      asmFile.os().close();
+      if (asmFile.os().has_error()) {
+        asmFile.os().clear_error();
+        return NULL;
+      }
+      asmFile.keep();
     }
     if ( genResult ) {
         uniqueAsmPath.eraseFromDisk();
@@ -257,6 +277,11 @@
         args.push_back("-c");
         args.push_back("-x");
         args.push_back("assembler");
+    } else {
+        for (std::vector<std::string>::iterator I = _assemblerArgs.begin(),
+               E = _assemblerArgs.end(); I != E; ++I) {
+            args.push_back(I->c_str());
+        }
     }
     args.push_back("-o");
     args.push_back(objPath.c_str());
@@ -301,7 +326,7 @@
 
         // construct LTModule, hand over ownership of module and target
         SubtargetFeatures Features;
-        Features.getDefaultSubtargetFeatures("" /* cpu */, llvm::Triple(Triple));
+        Features.getDefaultSubtargetFeatures(_mCpu, llvm::Triple(Triple));
         std::string FeatureStr = Features.getString();
         _target = march->createTargetMachine(Triple, FeatureStr);
     }
@@ -343,7 +368,7 @@
 }
 
 /// Optimize merged modules using various IPO passes
-bool LTOCodeGenerator::generateAssemblyCode(formatted_raw_ostream& out,
+bool LTOCodeGenerator::generateAssemblyCode(raw_ostream& out,
                                             std::string& errMsg)
 {
     if ( this->determineTarget(errMsg) ) 
@@ -378,7 +403,9 @@
 
     codeGenPasses->add(new TargetData(*_target->getTargetData()));
 
-    if (_target->addPassesToEmitFile(*codeGenPasses, out,
+    formatted_raw_ostream Out(out);
+
+    if (_target->addPassesToEmitFile(*codeGenPasses, Out,
                                      TargetMachine::CGFT_AssemblyFile,
                                      CodeGenOpt::Aggressive)) {
       errMsg = "target file type not supported";

Modified: llvm/branches/wendling/eh/tools/lto/LTOCodeGenerator.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/lto/LTOCodeGenerator.h?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/tools/lto/LTOCodeGenerator.h (original)
+++ llvm/branches/wendling/eh/tools/lto/LTOCodeGenerator.h Tue Oct 26 19:48:03 2010
@@ -36,14 +36,16 @@
     bool                addModule(struct LTOModule*, std::string& errMsg);
     bool                setDebugInfo(lto_debug_model, std::string& errMsg);
     bool                setCodePICModel(lto_codegen_model, std::string& errMsg);
+    void                setCpu(const char *cpu);
     void                setAssemblerPath(const char* path);
+    void                setAssemblerArgs(const char** args, int nargs);
     void                addMustPreserveSymbol(const char* sym);
     bool                writeMergedModules(const char* path, 
                                                            std::string& errMsg);
     const void*         compile(size_t* length, std::string& errMsg);
     void                setCodeGenDebugOptions(const char *opts); 
 private:
-    bool                generateAssemblyCode(llvm::formatted_raw_ostream& out, 
+    bool                generateAssemblyCode(llvm::raw_ostream& out, 
                                              std::string& errMsg);
     bool                assemble(const std::string& asmPath, 
                             const std::string& objPath, std::string& errMsg);
@@ -62,6 +64,8 @@
     llvm::MemoryBuffer*         _nativeObjectFile;
     std::vector<const char*>    _codegenOptions;
     llvm::sys::Path*            _assemblerPath;
+    std::string                 _mCpu;
+    std::vector<std::string>    _assemblerArgs;
 };
 
 #endif // LTO_CODE_GENERATOR_H

Modified: llvm/branches/wendling/eh/tools/lto/LTOModule.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/lto/LTOModule.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/tools/lto/LTOModule.cpp (original)
+++ llvm/branches/wendling/eh/tools/lto/LTOModule.cpp Tue Oct 26 19:48:03 2010
@@ -4,10 +4,10 @@
 //
 // This file is distributed under the University of Illinois Open Source
 // License. See LICENSE.TXT for details.
-// 
+//
 //===----------------------------------------------------------------------===//
 //
-// This file implements the Link Time Optimization library. This library is 
+// This file implements the Link Time Optimization library. This library is
 // intended to be used by linker to optimize code at link time.
 //
 //===----------------------------------------------------------------------===//
@@ -36,490 +36,479 @@
 
 using namespace llvm;
 
-bool LTOModule::isBitcodeFile(const void* mem, size_t length)
-{
-    return llvm::sys::IdentifyFileType((char*)mem, length) 
-        == llvm::sys::Bitcode_FileType;
+bool LTOModule::isBitcodeFile(const void *mem, size_t length) {
+  return llvm::sys::IdentifyFileType((char*)mem, length)
+    == llvm::sys::Bitcode_FileType;
 }
 
-bool LTOModule::isBitcodeFile(const char* path)
-{
-    return llvm::sys::Path(path).isBitcodeFile();
+bool LTOModule::isBitcodeFile(const char *path) {
+  return llvm::sys::Path(path).isBitcodeFile();
 }
 
-bool LTOModule::isBitcodeFileForTarget(const void* mem, size_t length,
-                                       const char* triplePrefix) 
-{
-    MemoryBuffer* buffer = makeBuffer(mem, length);
-    if (!buffer)
-        return false;
-    return isTargetMatch(buffer, triplePrefix);
+bool LTOModule::isBitcodeFileForTarget(const void *mem, size_t length,
+                                       const char *triplePrefix) {
+  MemoryBuffer *buffer = makeBuffer(mem, length);
+  if (!buffer)
+    return false;
+  return isTargetMatch(buffer, triplePrefix);
 }
 
 
-bool LTOModule::isBitcodeFileForTarget(const char* path,
-                                       const char* triplePrefix) 
-{
-    MemoryBuffer *buffer = MemoryBuffer::getFile(path);
-    if (buffer == NULL)
-        return false;
-    return isTargetMatch(buffer, triplePrefix);
+bool LTOModule::isBitcodeFileForTarget(const char *path,
+                                       const char *triplePrefix) {
+  MemoryBuffer *buffer = MemoryBuffer::getFile(path);
+  if (buffer == NULL)
+    return false;
+  return isTargetMatch(buffer, triplePrefix);
 }
 
-// takes ownership of buffer
-bool LTOModule::isTargetMatch(MemoryBuffer* buffer, const char* triplePrefix)
-{
-    OwningPtr<Module> m(getLazyBitcodeModule(buffer, getGlobalContext()));
-    // on success, m owns buffer and both are deleted at end of this method
-    if (!m) {
-        delete buffer;
-        return false;
-    }
-    std::string actualTarget = m->getTargetTriple();
-    return (strncmp(actualTarget.c_str(), triplePrefix, 
-                    strlen(triplePrefix)) == 0);
+// Takes ownership of buffer.
+bool LTOModule::isTargetMatch(MemoryBuffer *buffer, const char *triplePrefix) {
+  std::string Triple = getBitcodeTargetTriple(buffer, getGlobalContext());
+  delete buffer;
+  return (strncmp(Triple.c_str(), triplePrefix, 
+ 		  strlen(triplePrefix)) == 0);
 }
 
 
-LTOModule::LTOModule(Module* m, TargetMachine* t) 
- : _module(m), _target(t), _symbolsParsed(false)
+LTOModule::LTOModule(Module *m, TargetMachine *t)
+  : _module(m), _target(t), _symbolsParsed(false)
 {
 }
 
-LTOModule* LTOModule::makeLTOModule(const char* path,
-                                    std::string& errMsg)
-{
-    OwningPtr<MemoryBuffer> buffer(MemoryBuffer::getFile(path, &errMsg));
-    if (!buffer)
-        return NULL;
-    return makeLTOModule(buffer.get(), errMsg);
+LTOModule *LTOModule::makeLTOModule(const char *path,
+                                    std::string &errMsg) {
+  OwningPtr<MemoryBuffer> buffer(MemoryBuffer::getFile(path, &errMsg));
+  if (!buffer)
+    return NULL;
+  return makeLTOModule(buffer.get(), errMsg);
 }
 
-/// makeBuffer - create a MemoryBuffer from a memory range.
-/// MemoryBuffer requires the byte past end of the buffer to be a zero.
-/// We might get lucky and already be that way, otherwise make a copy.
-/// Also if next byte is on a different page, don't assume it is readable.
-MemoryBuffer* LTOModule::makeBuffer(const void* mem, size_t length)
-{
-    const char *startPtr = (char*)mem;
-    const char *endPtr = startPtr+length;
-    if (((uintptr_t)endPtr & (sys::Process::GetPageSize()-1)) == 0 ||
-        *endPtr != 0) 
-        return MemoryBuffer::getMemBufferCopy(StringRef(startPtr, length));
-  
-    return MemoryBuffer::getMemBuffer(StringRef(startPtr, length));
+/// makeBuffer - Create a MemoryBuffer from a memory range.  MemoryBuffer
+/// requires the byte past end of the buffer to be a zero.  We might get lucky
+/// and already be that way, otherwise make a copy.  Also if next byte is on a
+/// different page, don't assume it is readable.
+MemoryBuffer *LTOModule::makeBuffer(const void *mem, size_t length) {
+  const char *startPtr = (char*)mem;
+  const char *endPtr = startPtr+length;
+  if (((uintptr_t)endPtr & (sys::Process::GetPageSize()-1)) == 0 ||
+      *endPtr != 0)
+    return MemoryBuffer::getMemBufferCopy(StringRef(startPtr, length));
+
+  return MemoryBuffer::getMemBuffer(StringRef(startPtr, length));
 }
 
 
-LTOModule* LTOModule::makeLTOModule(const void* mem, size_t length, 
-                                    std::string& errMsg)
-{
-    OwningPtr<MemoryBuffer> buffer(makeBuffer(mem, length));
-    if (!buffer)
-        return NULL;
-    return makeLTOModule(buffer.get(), errMsg);
+LTOModule *LTOModule::makeLTOModule(const void *mem, size_t length,
+                                    std::string &errMsg) {
+  OwningPtr<MemoryBuffer> buffer(makeBuffer(mem, length));
+  if (!buffer)
+    return NULL;
+  return makeLTOModule(buffer.get(), errMsg);
 }
 
-LTOModule* LTOModule::makeLTOModule(MemoryBuffer* buffer,
-                                    std::string& errMsg)
-{
-    InitializeAllTargets();
+LTOModule *LTOModule::makeLTOModule(MemoryBuffer *buffer,
+                                    std::string &errMsg) {
+  InitializeAllTargets();
 
-    // parse bitcode buffer
-    OwningPtr<Module> m(ParseBitcodeFile(buffer, getGlobalContext(), &errMsg));
-    if (!m)
-        return NULL;
+  // parse bitcode buffer
+  OwningPtr<Module> m(ParseBitcodeFile(buffer, getGlobalContext(), &errMsg));
+  if (!m)
+    return NULL;
 
-    std::string Triple = m->getTargetTriple();
-    if (Triple.empty())
-      Triple = sys::getHostTriple();
+  std::string Triple = m->getTargetTriple();
+  if (Triple.empty())
+    Triple = sys::getHostTriple();
 
-    // find machine architecture for this module
-    const Target* march = TargetRegistry::lookupTarget(Triple, errMsg);
-    if (!march) 
-        return NULL;
+  // find machine architecture for this module
+  const Target *march = TargetRegistry::lookupTarget(Triple, errMsg);
+  if (!march)
+    return NULL;
 
-    // construct LTModule, hand over ownership of module and target
-    SubtargetFeatures Features;
-    Features.getDefaultSubtargetFeatures("" /* cpu */, llvm::Triple(Triple));
-    std::string FeatureStr = Features.getString();
-    TargetMachine* target = march->createTargetMachine(Triple, FeatureStr);
-    return new LTOModule(m.take(), target);
+  // construct LTModule, hand over ownership of module and target
+  SubtargetFeatures Features;
+  Features.getDefaultSubtargetFeatures("" /* cpu */, llvm::Triple(Triple));
+  std::string FeatureStr = Features.getString();
+  TargetMachine *target = march->createTargetMachine(Triple, FeatureStr);
+  return new LTOModule(m.take(), target);
 }
 
 
-const char* LTOModule::getTargetTriple()
-{
-    return _module->getTargetTriple().c_str();
+const char *LTOModule::getTargetTriple() {
+  return _module->getTargetTriple().c_str();
 }
 
-void LTOModule::addDefinedFunctionSymbol(Function* f, Mangler &mangler)
-{
-    // add to list of defined symbols
-    addDefinedSymbol(f, mangler, true); 
-
-    // add external symbols referenced by this function.
-    for (Function::iterator b = f->begin(); b != f->end(); ++b) {
-        for (BasicBlock::iterator i = b->begin(); i != b->end(); ++i) {
-            for (unsigned count = 0, total = i->getNumOperands(); 
-                                        count != total; ++count) {
-                findExternalRefs(i->getOperand(count), mangler);
-            }
-        }
-    }
+void LTOModule::setTargetTriple(const char *triple) {
+  _module->setTargetTriple(triple);
 }
 
-// get string that data pointer points to 
-bool LTOModule::objcClassNameFromExpression(Constant* c, std::string& name)
-{
-    if (ConstantExpr* ce = dyn_cast<ConstantExpr>(c)) {
-        Constant* op = ce->getOperand(0);
-        if (GlobalVariable* gvn = dyn_cast<GlobalVariable>(op)) {
-            Constant* cn = gvn->getInitializer(); 
-            if (ConstantArray* ca = dyn_cast<ConstantArray>(cn)) {
-                if (ca->isCString()) {
-                    name = ".objc_class_name_" + ca->getAsString();
-                    return true;
-                }
-            }
-        }
+void LTOModule::addDefinedFunctionSymbol(Function *f, Mangler &mangler) {
+  // add to list of defined symbols
+  addDefinedSymbol(f, mangler, true);
+
+  // add external symbols referenced by this function.
+  for (Function::iterator b = f->begin(); b != f->end(); ++b) {
+    for (BasicBlock::iterator i = b->begin(); i != b->end(); ++i) {
+      for (unsigned count = 0, total = i->getNumOperands();
+           count != total; ++count) {
+        findExternalRefs(i->getOperand(count), mangler);
+      }
     }
-    return false;
+  }
 }
 
-// parse i386/ppc ObjC class data structure 
-void LTOModule::addObjCClass(GlobalVariable* clgv)
-{
-    if (ConstantStruct* c = dyn_cast<ConstantStruct>(clgv->getInitializer())) {
-        // second slot in __OBJC,__class is pointer to superclass name
-        std::string superclassName;
-        if (objcClassNameFromExpression(c->getOperand(1), superclassName)) {
-            NameAndAttributes info;
-            if (_undefines.find(superclassName.c_str()) == _undefines.end()) {
-                const char* symbolName = ::strdup(superclassName.c_str());
-                info.name = ::strdup(symbolName);
-                info.attributes = LTO_SYMBOL_DEFINITION_UNDEFINED;
-                // string is owned by _undefines
-                _undefines[info.name] = info;
-            }
+// Get string that data pointer points to.
+bool LTOModule::objcClassNameFromExpression(Constant *c, std::string &name) {
+  if (ConstantExpr *ce = dyn_cast<ConstantExpr>(c)) {
+    Constant *op = ce->getOperand(0);
+    if (GlobalVariable *gvn = dyn_cast<GlobalVariable>(op)) {
+      Constant *cn = gvn->getInitializer();
+      if (ConstantArray *ca = dyn_cast<ConstantArray>(cn)) {
+        if (ca->isCString()) {
+          name = ".objc_class_name_" + ca->getAsString();
+          return true;
         }
-        // third slot in __OBJC,__class is pointer to class name
-        std::string className;
-         if (objcClassNameFromExpression(c->getOperand(2), className)) {
-            const char* symbolName = ::strdup(className.c_str());
-            NameAndAttributes info;
-            info.name = symbolName;
-            info.attributes = (lto_symbol_attributes)
-                (LTO_SYMBOL_PERMISSIONS_DATA |
-                 LTO_SYMBOL_DEFINITION_REGULAR | 
-                 LTO_SYMBOL_SCOPE_DEFAULT);
-            _symbols.push_back(info);
-            _defines[info.name] = 1;
-         }
+      }
     }
+  }
+  return false;
 }
 
-
-// parse i386/ppc ObjC category data structure 
-void LTOModule::addObjCCategory(GlobalVariable* clgv)
-{
-    if (ConstantStruct* c = dyn_cast<ConstantStruct>(clgv->getInitializer())) {
-        // second slot in __OBJC,__category is pointer to target class name
-        std::string targetclassName;
-        if (objcClassNameFromExpression(c->getOperand(1), targetclassName)) {
-            NameAndAttributes info;
-            if (_undefines.find(targetclassName.c_str()) == _undefines.end()) {
-                const char* symbolName = ::strdup(targetclassName.c_str());
-                info.name = ::strdup(symbolName);
-                info.attributes = LTO_SYMBOL_DEFINITION_UNDEFINED;
-                // string is owned by _undefines
-               _undefines[info.name] = info;
-            }
-        }
-    }
+// Parse i386/ppc ObjC class data structure.
+void LTOModule::addObjCClass(GlobalVariable *clgv) {
+  if (ConstantStruct *c = dyn_cast<ConstantStruct>(clgv->getInitializer())) {
+    // second slot in __OBJC,__class is pointer to superclass name
+    std::string superclassName;
+    if (objcClassNameFromExpression(c->getOperand(1), superclassName)) {
+      NameAndAttributes info;
+      if (_undefines.find(superclassName.c_str()) == _undefines.end()) {
+        const char *symbolName = ::strdup(superclassName.c_str());
+        info.name = symbolName;
+        info.attributes = LTO_SYMBOL_DEFINITION_UNDEFINED;
+        // string is owned by _undefines
+        _undefines[info.name] = info;
+      }
+    }
+    // third slot in __OBJC,__class is pointer to class name
+    std::string className;
+    if (objcClassNameFromExpression(c->getOperand(2), className)) {
+      const char *symbolName = ::strdup(className.c_str());
+      NameAndAttributes info;
+      info.name = symbolName;
+      info.attributes = (lto_symbol_attributes)
+        (LTO_SYMBOL_PERMISSIONS_DATA |
+         LTO_SYMBOL_DEFINITION_REGULAR |
+         LTO_SYMBOL_SCOPE_DEFAULT);
+      _symbols.push_back(info);
+      _defines[info.name] = 1;
+    }
+  }
 }
 
 
-// parse i386/ppc ObjC class list data structure 
-void LTOModule::addObjCClassRef(GlobalVariable* clgv)
-{
+// Parse i386/ppc ObjC category data structure.
+void LTOModule::addObjCCategory(GlobalVariable *clgv) {
+  if (ConstantStruct *c = dyn_cast<ConstantStruct>(clgv->getInitializer())) {
+    // second slot in __OBJC,__category is pointer to target class name
     std::string targetclassName;
-    if (objcClassNameFromExpression(clgv->getInitializer(), targetclassName)) {
-        NameAndAttributes info;
-        if (_undefines.find(targetclassName.c_str()) == _undefines.end()) {
-            const char* symbolName = ::strdup(targetclassName.c_str());
-            info.name = ::strdup(symbolName);
-            info.attributes = LTO_SYMBOL_DEFINITION_UNDEFINED;
-            // string is owned by _undefines
-            _undefines[info.name] = info;
-        }
-    }
+    if (objcClassNameFromExpression(c->getOperand(1), targetclassName)) {
+      NameAndAttributes info;
+      if (_undefines.find(targetclassName.c_str()) == _undefines.end()) {
+        const char *symbolName = ::strdup(targetclassName.c_str());
+        info.name = symbolName;
+        info.attributes = LTO_SYMBOL_DEFINITION_UNDEFINED;
+        // string is owned by _undefines
+        _undefines[info.name] = info;
+      }
+    }
+  }
 }
 
 
-void LTOModule::addDefinedDataSymbol(GlobalValue* v, Mangler& mangler)
-{    
-    // add to list of defined symbols
-    addDefinedSymbol(v, mangler, false); 
-
-    // Special case i386/ppc ObjC data structures in magic sections:
-    // The issue is that the old ObjC object format did some strange 
-    // contortions to avoid real linker symbols.  For instance, the 
-    // ObjC class data structure is allocated statically in the executable 
-    // that defines that class.  That data structures contains a pointer to
-    // its superclass.  But instead of just initializing that part of the 
-    // struct to the address of its superclass, and letting the static and 
-    // dynamic linkers do the rest, the runtime works by having that field
-    // instead point to a C-string that is the name of the superclass. 
-    // At runtime the objc initialization updates that pointer and sets 
-    // it to point to the actual super class.  As far as the linker
-    // knows it is just a pointer to a string.  But then someone wanted the 
-    // linker to issue errors at build time if the superclass was not found.  
-    // So they figured out a way in mach-o object format to use an absolute 
-    // symbols (.objc_class_name_Foo = 0) and a floating reference 
-    // (.reference .objc_class_name_Bar) to cause the linker into erroring when
-    // a class was missing.   
-    // The following synthesizes the implicit .objc_* symbols for the linker
-    // from the ObjC data structures generated by the front end.
-    if (v->hasSection() /* && isTargetDarwin */) {
-        // special case if this data blob is an ObjC class definition
-        if (v->getSection().compare(0, 15, "__OBJC,__class,") == 0) {
-            if (GlobalVariable* gv = dyn_cast<GlobalVariable>(v)) {
-                addObjCClass(gv);
-            }
-        }                        
-    
-        // special case if this data blob is an ObjC category definition
-        else if (v->getSection().compare(0, 18, "__OBJC,__category,") == 0) {
-            if (GlobalVariable* gv = dyn_cast<GlobalVariable>(v)) {
-                addObjCCategory(gv);
-            }
-        }                        
-        
-        // special case if this data blob is the list of referenced classes
-        else if (v->getSection().compare(0, 18, "__OBJC,__cls_refs,") == 0) {
-            if (GlobalVariable* gv = dyn_cast<GlobalVariable>(v)) {
-                addObjCClassRef(gv);
-            }
-        }                        
-    }
-
-    // add external symbols referenced by this data.
-    for (unsigned count = 0, total = v->getNumOperands();
-                                                count != total; ++count) {
-        findExternalRefs(v->getOperand(count), mangler);
+// Parse i386/ppc ObjC class list data structure.
+void LTOModule::addObjCClassRef(GlobalVariable *clgv) {
+  std::string targetclassName;
+  if (objcClassNameFromExpression(clgv->getInitializer(), targetclassName)) {
+    NameAndAttributes info;
+    if (_undefines.find(targetclassName.c_str()) == _undefines.end()) {
+      const char *symbolName = ::strdup(targetclassName.c_str());
+      info.name = symbolName;
+      info.attributes = LTO_SYMBOL_DEFINITION_UNDEFINED;
+      // string is owned by _undefines
+      _undefines[info.name] = info;
     }
+  }
 }
 
 
-void LTOModule::addDefinedSymbol(GlobalValue* def, Mangler &mangler, 
-                                 bool isFunction)
-{    
-    // ignore all llvm.* symbols
-    if (def->getName().startswith("llvm."))
-        return;
-
-    // string is owned by _defines
-    const char* symbolName = ::strdup(mangler.getNameWithPrefix(def).c_str());
-
-    // set alignment part log2() can have rounding errors
-    uint32_t align = def->getAlignment();
-    uint32_t attr = align ? CountTrailingZeros_32(def->getAlignment()) : 0;
-    
-    // set permissions part
-    if (isFunction)
-        attr |= LTO_SYMBOL_PERMISSIONS_CODE;
-    else {
-        GlobalVariable* gv = dyn_cast<GlobalVariable>(def);
-        if (gv && gv->isConstant())
-            attr |= LTO_SYMBOL_PERMISSIONS_RODATA;
-        else
-            attr |= LTO_SYMBOL_PERMISSIONS_DATA;
-    }
-    
-    // set definition part 
-    if (def->hasWeakLinkage() || def->hasLinkOnceLinkage()) {
-        attr |= LTO_SYMBOL_DEFINITION_WEAK;
-    }
-    else if (def->hasCommonLinkage()) {
-        attr |= LTO_SYMBOL_DEFINITION_TENTATIVE;
-    }
-    else { 
-        attr |= LTO_SYMBOL_DEFINITION_REGULAR;
-    }
-    
-    // set scope part
-    if (def->hasHiddenVisibility())
-        attr |= LTO_SYMBOL_SCOPE_HIDDEN;
-    else if (def->hasProtectedVisibility())
-        attr |= LTO_SYMBOL_SCOPE_PROTECTED;
-    else if (def->hasExternalLinkage() || def->hasWeakLinkage()
-             || def->hasLinkOnceLinkage() || def->hasCommonLinkage())
-        attr |= LTO_SYMBOL_SCOPE_DEFAULT;
+void LTOModule::addDefinedDataSymbol(GlobalValue *v, Mangler &mangler) {
+  // Add to list of defined symbols.
+  addDefinedSymbol(v, mangler, false);
+
+  // Special case i386/ppc ObjC data structures in magic sections:
+  // The issue is that the old ObjC object format did some strange
+  // contortions to avoid real linker symbols.  For instance, the
+  // ObjC class data structure is allocated statically in the executable
+  // that defines that class.  That data structures contains a pointer to
+  // its superclass.  But instead of just initializing that part of the
+  // struct to the address of its superclass, and letting the static and
+  // dynamic linkers do the rest, the runtime works by having that field
+  // instead point to a C-string that is the name of the superclass.
+  // At runtime the objc initialization updates that pointer and sets
+  // it to point to the actual super class.  As far as the linker
+  // knows it is just a pointer to a string.  But then someone wanted the
+  // linker to issue errors at build time if the superclass was not found.
+  // So they figured out a way in mach-o object format to use an absolute
+  // symbols (.objc_class_name_Foo = 0) and a floating reference
+  // (.reference .objc_class_name_Bar) to cause the linker into erroring when
+  // a class was missing.
+  // The following synthesizes the implicit .objc_* symbols for the linker
+  // from the ObjC data structures generated by the front end.
+  if (v->hasSection() /* && isTargetDarwin */) {
+    // special case if this data blob is an ObjC class definition
+    if (v->getSection().compare(0, 15, "__OBJC,__class,") == 0) {
+      if (GlobalVariable *gv = dyn_cast<GlobalVariable>(v)) {
+        addObjCClass(gv);
+      }
+    }
+
+    // special case if this data blob is an ObjC category definition
+    else if (v->getSection().compare(0, 18, "__OBJC,__category,") == 0) {
+      if (GlobalVariable *gv = dyn_cast<GlobalVariable>(v)) {
+        addObjCCategory(gv);
+      }
+    }
+
+    // special case if this data blob is the list of referenced classes
+    else if (v->getSection().compare(0, 18, "__OBJC,__cls_refs,") == 0) {
+      if (GlobalVariable *gv = dyn_cast<GlobalVariable>(v)) {
+        addObjCClassRef(gv);
+      }
+    }
+  }
+
+  // add external symbols referenced by this data.
+  for (unsigned count = 0, total = v->getNumOperands();
+       count != total; ++count) {
+    findExternalRefs(v->getOperand(count), mangler);
+  }
+}
+
+
+void LTOModule::addDefinedSymbol(GlobalValue *def, Mangler &mangler,
+                                 bool isFunction) {
+  // ignore all llvm.* symbols
+  if (def->getName().startswith("llvm."))
+    return;
+
+  // string is owned by _defines
+  const char *symbolName = ::strdup(mangler.getNameWithPrefix(def).c_str());
+
+  // set alignment part log2() can have rounding errors
+  uint32_t align = def->getAlignment();
+  uint32_t attr = align ? CountTrailingZeros_32(def->getAlignment()) : 0;
+
+  // set permissions part
+  if (isFunction)
+    attr |= LTO_SYMBOL_PERMISSIONS_CODE;
+  else {
+    GlobalVariable *gv = dyn_cast<GlobalVariable>(def);
+    if (gv && gv->isConstant())
+      attr |= LTO_SYMBOL_PERMISSIONS_RODATA;
     else
-        attr |= LTO_SYMBOL_SCOPE_INTERNAL;
+      attr |= LTO_SYMBOL_PERMISSIONS_DATA;
+  }
 
-    // add to table of symbols
-    NameAndAttributes info;
-    info.name = symbolName;
-    info.attributes = (lto_symbol_attributes)attr;
-    _symbols.push_back(info);
-    _defines[info.name] = 1;
+  // set definition part
+  if (def->hasWeakLinkage() || def->hasLinkOnceLinkage() ||
+      def->hasLinkerPrivateWeakLinkage() ||
+      def->hasLinkerPrivateWeakDefAutoLinkage())
+    attr |= LTO_SYMBOL_DEFINITION_WEAK;
+  else if (def->hasCommonLinkage())
+    attr |= LTO_SYMBOL_DEFINITION_TENTATIVE;
+  else
+    attr |= LTO_SYMBOL_DEFINITION_REGULAR;
+
+  // set scope part
+  if (def->hasHiddenVisibility())
+    attr |= LTO_SYMBOL_SCOPE_HIDDEN;
+  else if (def->hasProtectedVisibility())
+    attr |= LTO_SYMBOL_SCOPE_PROTECTED;
+  else if (def->hasExternalLinkage() || def->hasWeakLinkage() ||
+           def->hasLinkOnceLinkage() || def->hasCommonLinkage() ||
+           def->hasLinkerPrivateWeakLinkage())
+    attr |= LTO_SYMBOL_SCOPE_DEFAULT;
+  else if (def->hasLinkerPrivateWeakDefAutoLinkage())
+    attr |= LTO_SYMBOL_SCOPE_DEFAULT_CAN_BE_HIDDEN;
+  else
+    attr |= LTO_SYMBOL_SCOPE_INTERNAL;
+
+  // add to table of symbols
+  NameAndAttributes info;
+  info.name = symbolName;
+  info.attributes = (lto_symbol_attributes)attr;
+  _symbols.push_back(info);
+  _defines[info.name] = 1;
 }
 
 void LTOModule::addAsmGlobalSymbol(const char *name) {
-    // only add new define if not already defined
-    if (_defines.count(name) == 0) 
-        return;
-        
-    // string is owned by _defines
-    const char *symbolName = ::strdup(name);
-    uint32_t attr = LTO_SYMBOL_DEFINITION_REGULAR;
-    attr |= LTO_SYMBOL_SCOPE_DEFAULT;
-    NameAndAttributes info;
-    info.name = symbolName;
-    info.attributes = (lto_symbol_attributes)attr;
-    _symbols.push_back(info);
-    _defines[info.name] = 1;
-}
-
-void LTOModule::addPotentialUndefinedSymbol(GlobalValue* decl, Mangler &mangler)
-{   
-    // ignore all llvm.* symbols
-    if (decl->getName().startswith("llvm."))
-        return;
-
-    // ignore all aliases
-    if (isa<GlobalAlias>(decl))
-        return;
-
-    std::string name = mangler.getNameWithPrefix(decl);
-
-    // we already have the symbol
-    if (_undefines.find(name) != _undefines.end())
-      return;
-
-    NameAndAttributes info;
-    // string is owned by _undefines
-    info.name = ::strdup(name.c_str());
-    if (decl->hasExternalWeakLinkage())
-      info.attributes = LTO_SYMBOL_DEFINITION_WEAKUNDEF;
-    else
-      info.attributes = LTO_SYMBOL_DEFINITION_UNDEFINED;
-    _undefines[name] = info;
+  // only add new define if not already defined
+  if (_defines.count(name))
+    return;
+
+  // string is owned by _defines
+  const char *symbolName = ::strdup(name);
+  uint32_t attr = LTO_SYMBOL_DEFINITION_REGULAR;
+  attr |= LTO_SYMBOL_SCOPE_DEFAULT;
+  NameAndAttributes info;
+  info.name = symbolName;
+  info.attributes = (lto_symbol_attributes)attr;
+  _symbols.push_back(info);
+  _defines[info.name] = 1;
+}
+
+void LTOModule::addPotentialUndefinedSymbol(GlobalValue *decl,
+                                            Mangler &mangler) {
+  // ignore all llvm.* symbols
+  if (decl->getName().startswith("llvm."))
+    return;
+
+  // ignore all aliases
+  if (isa<GlobalAlias>(decl))
+    return;
+
+  std::string name = mangler.getNameWithPrefix(decl);
+
+  // we already have the symbol
+  if (_undefines.find(name) != _undefines.end())
+    return;
+
+  NameAndAttributes info;
+  // string is owned by _undefines
+  info.name = ::strdup(name.c_str());
+  if (decl->hasExternalWeakLinkage())
+    info.attributes = LTO_SYMBOL_DEFINITION_WEAKUNDEF;
+  else
+    info.attributes = LTO_SYMBOL_DEFINITION_UNDEFINED;
+  _undefines[name] = info;
 }
 
 
 
 // Find external symbols referenced by VALUE. This is a recursive function.
-void LTOModule::findExternalRefs(Value* value, Mangler &mangler) {
-
-    if (GlobalValue* gv = dyn_cast<GlobalValue>(value)) {
-        if (!gv->hasExternalLinkage())
-            addPotentialUndefinedSymbol(gv, mangler);
-        // If this is a variable definition, do not recursively process
-        // initializer.  It might contain a reference to this variable
-        // and cause an infinite loop.  The initializer will be
-        // processed in addDefinedDataSymbol(). 
-        return;
-    }
-
-    // GlobalValue, even with InternalLinkage type, may have operands with 
-    // ExternalLinkage type. Do not ignore these operands.
-    if (Constant* c = dyn_cast<Constant>(value)) {
-        // Handle ConstantExpr, ConstantStruct, ConstantArry etc.
-        for (unsigned i = 0, e = c->getNumOperands(); i != e; ++i)
-            findExternalRefs(c->getOperand(i), mangler);
-    }
-}
-
-void LTOModule::lazyParseSymbols()
-{
-    if (!_symbolsParsed) {
-        _symbolsParsed = true;
-        
-        // Use mangler to add GlobalPrefix to names to match linker names.
-        MCContext Context(*_target->getMCAsmInfo());
-        Mangler mangler(Context, *_target->getTargetData());
-
-        // add functions
-        for (Module::iterator f = _module->begin(); f != _module->end(); ++f) {
-            if (f->isDeclaration())
-                addPotentialUndefinedSymbol(f, mangler);
-            else 
-                addDefinedFunctionSymbol(f, mangler);
-        }
-        
-        // add data 
-        for (Module::global_iterator v = _module->global_begin(), 
-                                    e = _module->global_end(); v !=  e; ++v) {
-            if (v->isDeclaration())
-                addPotentialUndefinedSymbol(v, mangler);
-            else 
-                addDefinedDataSymbol(v, mangler);
-        }
-
-        // add asm globals
-        const std::string &inlineAsm = _module->getModuleInlineAsm();
-        const std::string glbl = ".globl";
-        std::string asmSymbolName;
-        std::string::size_type pos = inlineAsm.find(glbl, 0);
-        while (pos != std::string::npos) {
-          // eat .globl
-          pos = pos + 6;
-
-          // skip white space between .globl and symbol name
-          std::string::size_type pbegin = inlineAsm.find_first_not_of(' ', pos);
-          if (pbegin == std::string::npos)
-            break;
-
-          // find end-of-line
-          std::string::size_type pend = inlineAsm.find_first_of('\n', pbegin);
-          if (pend == std::string::npos)
-            break;
+void LTOModule::findExternalRefs(Value *value, Mangler &mangler) {
+  if (GlobalValue *gv = dyn_cast<GlobalValue>(value)) {
+    if (!gv->hasExternalLinkage())
+      addPotentialUndefinedSymbol(gv, mangler);
+    // If this is a variable definition, do not recursively process
+    // initializer.  It might contain a reference to this variable
+    // and cause an infinite loop.  The initializer will be
+    // processed in addDefinedDataSymbol().
+    return;
+  }
+
+  // GlobalValue, even with InternalLinkage type, may have operands with
+  // ExternalLinkage type. Do not ignore these operands.
+  if (Constant *c = dyn_cast<Constant>(value)) {
+    // Handle ConstantExpr, ConstantStruct, ConstantArry etc.
+    for (unsigned i = 0, e = c->getNumOperands(); i != e; ++i)
+      findExternalRefs(c->getOperand(i), mangler);
+  }
+}
+
+void LTOModule::lazyParseSymbols() {
+  if (_symbolsParsed)
+    return;
+
+  _symbolsParsed = true;
+
+  // Use mangler to add GlobalPrefix to names to match linker names.
+  MCContext Context(*_target->getMCAsmInfo());
+  Mangler mangler(Context, *_target->getTargetData());
+
+  // add functions
+  for (Module::iterator f = _module->begin(); f != _module->end(); ++f) {
+    if (f->isDeclaration())
+      addPotentialUndefinedSymbol(f, mangler);
+    else
+      addDefinedFunctionSymbol(f, mangler);
+  }
 
-          asmSymbolName.assign(inlineAsm, pbegin, pend - pbegin);
-          addAsmGlobalSymbol(asmSymbolName.c_str());
+  // add data
+  for (Module::global_iterator v = _module->global_begin(),
+         e = _module->global_end(); v !=  e; ++v) {
+    if (v->isDeclaration())
+      addPotentialUndefinedSymbol(v, mangler);
+    else
+      addDefinedDataSymbol(v, mangler);
+  }
 
-          // search next .globl
-          pos = inlineAsm.find(glbl, pend);
-        }
+  // add asm globals
+  const std::string &inlineAsm = _module->getModuleInlineAsm();
+  const std::string glbl = ".globl";
+  std::string asmSymbolName;
+  std::string::size_type pos = inlineAsm.find(glbl, 0);
+  while (pos != std::string::npos) {
+    // eat .globl
+    pos = pos + 6;
+
+    // skip white space between .globl and symbol name
+    std::string::size_type pbegin = inlineAsm.find_first_not_of(' ', pos);
+    if (pbegin == std::string::npos)
+      break;
+
+    // find end-of-line
+    std::string::size_type pend = inlineAsm.find_first_of('\n', pbegin);
+    if (pend == std::string::npos)
+      break;
+
+    asmSymbolName.assign(inlineAsm, pbegin, pend - pbegin);
+    addAsmGlobalSymbol(asmSymbolName.c_str());
+
+    // search next .globl
+    pos = inlineAsm.find(glbl, pend);
+  }
+
+  // add aliases
+  for (Module::alias_iterator i = _module->alias_begin(),
+         e = _module->alias_end(); i != e; ++i) {
+    if (i->isDeclaration())
+      addPotentialUndefinedSymbol(i, mangler);
+    else
+      addDefinedDataSymbol(i, mangler);
+  }
 
-        // make symbols for all undefines
-        for (StringMap<NameAndAttributes>::iterator it=_undefines.begin(); 
-                                                it != _undefines.end(); ++it) {
-            // if this symbol also has a definition, then don't make an undefine
-            // because it is a tentative definition
-            if (_defines.count(it->getKey()) == 0) {
-              NameAndAttributes info = it->getValue();
-              _symbols.push_back(info);
-            }
-        }
-    }    
+  // make symbols for all undefines
+  for (StringMap<NameAndAttributes>::iterator it=_undefines.begin();
+       it != _undefines.end(); ++it) {
+    // if this symbol also has a definition, then don't make an undefine
+    // because it is a tentative definition
+    if (_defines.count(it->getKey()) == 0) {
+      NameAndAttributes info = it->getValue();
+      _symbols.push_back(info);
+    }
+  }
 }
 
 
-uint32_t LTOModule::getSymbolCount()
-{
-    lazyParseSymbols();
-    return _symbols.size();
+uint32_t LTOModule::getSymbolCount() {
+  lazyParseSymbols();
+  return _symbols.size();
 }
 
 
-lto_symbol_attributes LTOModule::getSymbolAttributes(uint32_t index)
-{
-    lazyParseSymbols();
-    if (index < _symbols.size())
-        return _symbols[index].attributes;
-    else
-        return lto_symbol_attributes(0);
+lto_symbol_attributes LTOModule::getSymbolAttributes(uint32_t index) {
+  lazyParseSymbols();
+  if (index < _symbols.size())
+    return _symbols[index].attributes;
+  else
+    return lto_symbol_attributes(0);
 }
 
-const char* LTOModule::getSymbolName(uint32_t index)
-{
-    lazyParseSymbols();
-    if (index < _symbols.size())
-        return _symbols[index].name;
-    else
-        return NULL;
+const char *LTOModule::getSymbolName(uint32_t index) {
+  lazyParseSymbols();
+  if (index < _symbols.size())
+    return _symbols[index].name;
+  else
+    return NULL;
 }

Modified: llvm/branches/wendling/eh/tools/lto/LTOModule.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/lto/LTOModule.h?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/tools/lto/LTOModule.h (original)
+++ llvm/branches/wendling/eh/tools/lto/LTOModule.h Tue Oct 26 19:48:03 2010
@@ -55,6 +55,7 @@
                                            std::string& errMsg);
 
     const char*              getTargetTriple();
+    void                     setTargetTriple(const char*);
     uint32_t                 getSymbolCount();
     lto_symbol_attributes    getSymbolAttributes(uint32_t index);
     const char*              getSymbolName(uint32_t index);

Modified: llvm/branches/wendling/eh/tools/lto/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/lto/Makefile?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/tools/lto/Makefile (original)
+++ llvm/branches/wendling/eh/tools/lto/Makefile Tue Oct 26 19:48:03 2010
@@ -24,6 +24,10 @@
 
 include $(LEVEL)/Makefile.common
 
+ifdef LLVM_VERSION_INFO
+CXX.Flags += -DLLVM_VERSION_INFO='"$(LLVM_VERSION_INFO)"'
+endif
+
 ifeq ($(HOST_OS),Darwin)
     # Special hack to allow libLTO to have an offset version number.
     ifdef LLVM_LTO_VERSION_OFFSET

Modified: llvm/branches/wendling/eh/tools/lto/lto.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/lto/lto.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/tools/lto/lto.cpp (original)
+++ llvm/branches/wendling/eh/tools/lto/lto.cpp Tue Oct 26 19:48:03 2010
@@ -120,6 +120,14 @@
     return mod->getTargetTriple();
 }
 
+//
+// sets triple string with which the object will be codegened.
+//
+void lto_module_set_target_triple(lto_module_t mod, const char *triple)
+{
+    return mod->setTargetTriple(triple);
+}
+
 
 //
 // returns the number of symbols in the object module
@@ -142,7 +150,7 @@
 // returns the attributes of the ith symbol in the object module
 //
 lto_symbol_attributes lto_module_get_symbol_attribute(lto_module_t mod, 
-                                                            uint32_t index)
+                                                      uint32_t index)
 {
     return mod->getSymbolAttributes(index);
 }
@@ -203,6 +211,14 @@
 }
 
 //
+// sets the cpu to generate code for
+//
+void lto_codegen_set_cpu(lto_code_gen_t cg, const char* cpu)
+{
+  return cg->setCpu(cpu);
+}
+
+//
 // sets the path to the assembler tool
 //
 void lto_codegen_set_assembler_path(lto_code_gen_t cg, const char* path)
@@ -210,6 +226,16 @@
     cg->setAssemblerPath(path);
 }
 
+
+//
+// sets extra arguments that libLTO should pass to the assembler
+//
+void lto_codegen_set_assembler_args(lto_code_gen_t cg, const char** args,
+                                    int nargs)
+{
+  cg->setAssemblerArgs(args, nargs);
+}
+
 //
 // adds to a list of all global symbols that must exist in the final
 // generated code.  If a function is not listed there, it might be

Modified: llvm/branches/wendling/eh/tools/lto/lto.exports
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/lto/lto.exports?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/tools/lto/lto.exports (original)
+++ llvm/branches/wendling/eh/tools/lto/lto.exports Tue Oct 26 19:48:03 2010
@@ -6,6 +6,7 @@
 lto_module_get_symbol_attribute
 lto_module_get_symbol_name
 lto_module_get_target_triple
+lto_module_set_target_triple
 lto_module_is_object_file
 lto_module_is_object_file_for_target
 lto_module_is_object_file_in_memory
@@ -20,4 +21,6 @@
 lto_codegen_set_pic_model
 lto_codegen_write_merged_modules
 lto_codegen_debug_options
+lto_codegen_set_assembler_args
 lto_codegen_set_assembler_path
+lto_codegen_set_cpu

Modified: llvm/branches/wendling/eh/tools/opt/AnalysisWrappers.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/opt/AnalysisWrappers.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/tools/opt/AnalysisWrappers.cpp (original)
+++ llvm/branches/wendling/eh/tools/opt/AnalysisWrappers.cpp Tue Oct 26 19:48:03 2010
@@ -31,7 +31,7 @@
   /// or handle in alias analyses.
   struct ExternalFunctionsPassedConstants : public ModulePass {
     static char ID; // Pass ID, replacement for typeid
-    ExternalFunctionsPassedConstants() : ModulePass(&ID) {}
+    ExternalFunctionsPassedConstants() : ModulePass(ID) {}
     virtual bool runOnModule(Module &M) {
       for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) {
         if (!I->isDeclaration()) continue;
@@ -66,15 +66,17 @@
       AU.setPreservesAll();
     }
   };
+}
 
-  char ExternalFunctionsPassedConstants::ID = 0;
-  RegisterPass<ExternalFunctionsPassedConstants>
+char ExternalFunctionsPassedConstants::ID = 0;
+static RegisterPass<ExternalFunctionsPassedConstants>
   P1("print-externalfnconstants",
      "Print external fn callsites passed constants");
 
+namespace {
   struct CallGraphPrinter : public ModulePass {
     static char ID; // Pass ID, replacement for typeid
-    CallGraphPrinter() : ModulePass(&ID) {}
+    CallGraphPrinter() : ModulePass(ID) {}
 
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
       AU.setPreservesAll();
@@ -85,8 +87,8 @@
       return false;
     }
   };
-
-  char CallGraphPrinter::ID = 0;
-  RegisterPass<CallGraphPrinter>
-    P2("print-callgraph", "Print a call graph");
 }
+
+char CallGraphPrinter::ID = 0;
+static RegisterPass<CallGraphPrinter>
+  P2("print-callgraph", "Print a call graph");

Modified: llvm/branches/wendling/eh/tools/opt/GraphPrinters.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/opt/GraphPrinters.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/tools/opt/GraphPrinters.cpp (original)
+++ llvm/branches/wendling/eh/tools/opt/GraphPrinters.cpp Tue Oct 26 19:48:03 2010
@@ -19,7 +19,7 @@
 #include "llvm/Value.h"
 #include "llvm/Analysis/CallGraph.h"
 #include "llvm/Analysis/Dominators.h"
-#include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/ToolOutputFile.h"
 using namespace llvm;
 
 template<typename GraphType>
@@ -28,13 +28,19 @@
   std::string Filename = GraphName + ".dot";
   O << "Writing '" << Filename << "'...";
   std::string ErrInfo;
-  raw_fd_ostream F(Filename.c_str(), ErrInfo);
+  tool_output_file F(Filename.c_str(), ErrInfo);
 
-  if (ErrInfo.empty())
-    WriteGraph(F, GT);
-  else
-    O << "  error opening file for writing!";
-  O << "\n";
+  if (ErrInfo.empty()) {
+    WriteGraph(F.os(), GT);
+    F.os().close();
+    if (!F.os().has_error()) {
+      O << "\n";
+      F.keep();
+      return;
+    }
+  }
+  O << "  error opening file for writing!\n";
+  F.os().clear_error();
 }
 
 
@@ -65,7 +71,7 @@
 namespace {
   struct CallGraphPrinter : public ModulePass {
     static char ID; // Pass ID, replacement for typeid
-    CallGraphPrinter() : ModulePass(&ID) {}
+    CallGraphPrinter() : ModulePass(ID) {}
 
     virtual bool runOnModule(Module &M) {
       WriteGraphToFile(llvm::errs(), "callgraph", &getAnalysis<CallGraph>());
@@ -79,12 +85,12 @@
       AU.setPreservesAll();
     }
   };
-
-  char CallGraphPrinter::ID = 0;
-  RegisterPass<CallGraphPrinter> P2("dot-callgraph",
-                                    "Print Call Graph to 'dot' file");
 }
 
+char CallGraphPrinter::ID = 0;
+static RegisterPass<CallGraphPrinter> P2("dot-callgraph",
+                                         "Print Call Graph to 'dot' file");
+
 //===----------------------------------------------------------------------===//
 //                            DomInfoPrinter Pass
 //===----------------------------------------------------------------------===//
@@ -93,7 +99,7 @@
   class DomInfoPrinter : public FunctionPass {
   public:
     static char ID; // Pass identification, replacement for typeid
-    DomInfoPrinter() : FunctionPass(&ID) {}
+    DomInfoPrinter() : FunctionPass(ID) {}
 
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
       AU.setPreservesAll();
@@ -110,8 +116,8 @@
       return false;
     }
   };
-
-  char DomInfoPrinter::ID = 0;
-  static RegisterPass<DomInfoPrinter>
-  DIP("print-dom-info", "Dominator Info Printer", true, true);
 }
+
+char DomInfoPrinter::ID = 0;
+static RegisterPass<DomInfoPrinter>
+DIP("print-dom-info", "Dominator Info Printer", true, true);

Modified: llvm/branches/wendling/eh/tools/opt/PrintSCC.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/opt/PrintSCC.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/tools/opt/PrintSCC.cpp (original)
+++ llvm/branches/wendling/eh/tools/opt/PrintSCC.cpp Tue Oct 26 19:48:03 2010
@@ -36,7 +36,7 @@
 namespace {
   struct CFGSCC : public FunctionPass {
     static char ID;  // Pass identification, replacement for typeid
-    CFGSCC() : FunctionPass(&ID) {}
+    CFGSCC() : FunctionPass(ID) {}
     bool runOnFunction(Function& func);
 
     void print(raw_ostream &O, const Module* = 0) const { }
@@ -48,7 +48,7 @@
 
   struct CallGraphSCC : public ModulePass {
     static char ID;  // Pass identification, replacement for typeid
-    CallGraphSCC() : ModulePass(&ID) {}
+    CallGraphSCC() : ModulePass(ID) {}
 
     // run - Print out SCCs in the call graph for the specified module.
     bool runOnModule(Module &M);
@@ -61,30 +61,30 @@
       AU.addRequired<CallGraph>();
     }
   };
-
-  char CFGSCC::ID = 0;
-  RegisterPass<CFGSCC>
-  Y("print-cfg-sccs", "Print SCCs of each function CFG");
-
-  char CallGraphSCC::ID = 0;
-  RegisterPass<CallGraphSCC>
-  Z("print-callgraph-sccs", "Print SCCs of the Call Graph");
 }
 
+char CFGSCC::ID = 0;
+static RegisterPass<CFGSCC>
+Y("print-cfg-sccs", "Print SCCs of each function CFG");
+
+char CallGraphSCC::ID = 0;
+static RegisterPass<CallGraphSCC>
+Z("print-callgraph-sccs", "Print SCCs of the Call Graph");
+
 bool CFGSCC::runOnFunction(Function &F) {
   unsigned sccNum = 0;
-  outs() << "SCCs for Function " << F.getName() << " in PostOrder:";
+  errs() << "SCCs for Function " << F.getName() << " in PostOrder:";
   for (scc_iterator<Function*> SCCI = scc_begin(&F),
          E = scc_end(&F); SCCI != E; ++SCCI) {
     std::vector<BasicBlock*> &nextSCC = *SCCI;
-    outs() << "\nSCC #" << ++sccNum << " : ";
+    errs() << "\nSCC #" << ++sccNum << " : ";
     for (std::vector<BasicBlock*>::const_iterator I = nextSCC.begin(),
            E = nextSCC.end(); I != E; ++I)
-      outs() << (*I)->getName() << ", ";
+      errs() << (*I)->getName() << ", ";
     if (nextSCC.size() == 1 && SCCI.hasLoop())
-      outs() << " (Has self-loop).";
+      errs() << " (Has self-loop).";
   }
-  outs() << "\n";
+  errs() << "\n";
 
   return true;
 }
@@ -94,19 +94,19 @@
 bool CallGraphSCC::runOnModule(Module &M) {
   CallGraphNode* rootNode = getAnalysis<CallGraph>().getRoot();
   unsigned sccNum = 0;
-  outs() << "SCCs for the program in PostOrder:";
+  errs() << "SCCs for the program in PostOrder:";
   for (scc_iterator<CallGraphNode*> SCCI = scc_begin(rootNode),
          E = scc_end(rootNode); SCCI != E; ++SCCI) {
     const std::vector<CallGraphNode*> &nextSCC = *SCCI;
-    outs() << "\nSCC #" << ++sccNum << " : ";
+    errs() << "\nSCC #" << ++sccNum << " : ";
     for (std::vector<CallGraphNode*>::const_iterator I = nextSCC.begin(),
            E = nextSCC.end(); I != E; ++I)
-      outs() << ((*I)->getFunction() ? (*I)->getFunction()->getNameStr()
+      errs() << ((*I)->getFunction() ? (*I)->getFunction()->getNameStr()
                  : std::string("external node")) << ", ";
     if (nextSCC.size() == 1 && SCCI.hasLoop())
-      outs() << " (Has self-loop).";
+      errs() << " (Has self-loop).";
   }
-  outs() << "\n";
+  errs() << "\n";
 
   return true;
 }

Modified: llvm/branches/wendling/eh/tools/opt/opt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/tools/opt/opt.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/tools/opt/opt.cpp (original)
+++ llvm/branches/wendling/eh/tools/opt/opt.cpp Tue Oct 26 19:48:03 2010
@@ -20,6 +20,7 @@
 #include "llvm/Assembly/PrintModulePass.h"
 #include "llvm/Analysis/Verifier.h"
 #include "llvm/Analysis/LoopPass.h"
+#include "llvm/Analysis/RegionPass.h"
 #include "llvm/Analysis/CallGraph.h"
 #include "llvm/Target/TargetData.h"
 #include "llvm/Target/TargetMachine.h"
@@ -32,7 +33,7 @@
 #include "llvm/Support/PrettyStackTrace.h"
 #include "llvm/Support/StandardPasses.h"
 #include "llvm/Support/SystemUtils.h"
-#include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/ToolOutputFile.h"
 #include "llvm/LinkAllPasses.h"
 #include "llvm/LinkAllVMCore.h"
 #include <memory>
@@ -53,7 +54,7 @@
 
 static cl::opt<std::string>
 OutputFilename("o", cl::desc("Override output filename"),
-               cl::value_desc("filename"), cl::init("-"));
+               cl::value_desc("filename"));
 
 static cl::opt<bool>
 Force("f", cl::desc("Enable binary output on terminals"));
@@ -138,27 +139,33 @@
 struct CallGraphSCCPassPrinter : public CallGraphSCCPass {
   static char ID;
   const PassInfo *PassToPrint;
-  CallGraphSCCPassPrinter(const PassInfo *PI) :
-    CallGraphSCCPass(&ID), PassToPrint(PI) {}
+  raw_ostream &Out;
+  std::string PassName;
+
+  CallGraphSCCPassPrinter(const PassInfo *PI, raw_ostream &out) :
+    CallGraphSCCPass(ID), PassToPrint(PI), Out(out) {
+      std::string PassToPrintName =  PassToPrint->getPassName();
+      PassName = "CallGraphSCCPass Printer: " + PassToPrintName;
+    }
 
   virtual bool runOnSCC(CallGraphSCC &SCC) {
-    if (!Quiet) {
-      outs() << "Printing analysis '" << PassToPrint->getPassName() << "':\n";
+    if (!Quiet)
+      Out << "Printing analysis '" << PassToPrint->getPassName() << "':\n";
 
-      for (CallGraphSCC::iterator I = SCC.begin(), E = SCC.end(); I != E; ++I) {
-        Function *F = (*I)->getFunction();
-        if (F)
-          getAnalysisID<Pass>(PassToPrint).print(outs(), F->getParent());
-      }
-    }
     // Get and print pass...
+    for (CallGraphSCC::iterator I = SCC.begin(), E = SCC.end(); I != E; ++I) {
+      Function *F = (*I)->getFunction();
+      if (F)
+        getAnalysisID<Pass>(PassToPrint->getTypeInfo()).print(Out,
+                                                              F->getParent());
+    }
     return false;
   }
 
-  virtual const char *getPassName() const { return "'Pass' Printer"; }
+  virtual const char *getPassName() const { return PassName.c_str(); }
 
   virtual void getAnalysisUsage(AnalysisUsage &AU) const {
-    AU.addRequiredID(PassToPrint);
+    AU.addRequiredID(PassToPrint->getTypeInfo());
     AU.setPreservesAll();
   }
 };
@@ -168,23 +175,28 @@
 struct ModulePassPrinter : public ModulePass {
   static char ID;
   const PassInfo *PassToPrint;
-  ModulePassPrinter(const PassInfo *PI) : ModulePass(&ID),
-                                          PassToPrint(PI) {}
+  raw_ostream &Out;
+  std::string PassName;
 
-  virtual bool runOnModule(Module &M) {
-    if (!Quiet) {
-      outs() << "Printing analysis '" << PassToPrint->getPassName() << "':\n";
-      getAnalysisID<Pass>(PassToPrint).print(outs(), &M);
+  ModulePassPrinter(const PassInfo *PI, raw_ostream &out)
+    : ModulePass(ID), PassToPrint(PI), Out(out) {
+      std::string PassToPrintName =  PassToPrint->getPassName();
+      PassName = "ModulePass Printer: " + PassToPrintName;
     }
 
+  virtual bool runOnModule(Module &M) {
+    if (!Quiet)
+      Out << "Printing analysis '" << PassToPrint->getPassName() << "':\n";
+
     // Get and print pass...
+    getAnalysisID<Pass>(PassToPrint->getTypeInfo()).print(Out, &M);
     return false;
   }
 
-  virtual const char *getPassName() const { return "'Pass' Printer"; }
+  virtual const char *getPassName() const { return PassName.c_str(); }
 
   virtual void getAnalysisUsage(AnalysisUsage &AU) const {
-    AU.addRequiredID(PassToPrint);
+    AU.addRequiredID(PassToPrint->getTypeInfo());
     AU.setPreservesAll();
   }
 };
@@ -192,24 +204,31 @@
 char ModulePassPrinter::ID = 0;
 struct FunctionPassPrinter : public FunctionPass {
   const PassInfo *PassToPrint;
+  raw_ostream &Out;
   static char ID;
-  FunctionPassPrinter(const PassInfo *PI) : FunctionPass(&ID),
-                                            PassToPrint(PI) {}
+  std::string PassName;
 
-  virtual bool runOnFunction(Function &F) {
-    if (!Quiet) {
-      outs() << "Printing analysis '" << PassToPrint->getPassName()
-              << "' for function '" << F.getName() << "':\n";
+  FunctionPassPrinter(const PassInfo *PI, raw_ostream &out)
+    : FunctionPass(ID), PassToPrint(PI), Out(out) {
+      std::string PassToPrintName =  PassToPrint->getPassName();
+      PassName = "FunctionPass Printer: " + PassToPrintName;
     }
+
+  virtual bool runOnFunction(Function &F) {
+    if (!Quiet)
+      Out << "Printing analysis '" << PassToPrint->getPassName()
+          << "' for function '" << F.getName() << "':\n";
+
     // Get and print pass...
-    getAnalysisID<Pass>(PassToPrint).print(outs(), F.getParent());
+    getAnalysisID<Pass>(PassToPrint->getTypeInfo()).print(Out,
+            F.getParent());
     return false;
   }
 
-  virtual const char *getPassName() const { return "FunctionPass Printer"; }
+  virtual const char *getPassName() const { return PassName.c_str(); }
 
   virtual void getAnalysisUsage(AnalysisUsage &AU) const {
-    AU.addRequiredID(PassToPrint);
+    AU.addRequiredID(PassToPrint->getTypeInfo());
     AU.setPreservesAll();
   }
 };
@@ -219,50 +238,97 @@
 struct LoopPassPrinter : public LoopPass {
   static char ID;
   const PassInfo *PassToPrint;
-  LoopPassPrinter(const PassInfo *PI) :
-    LoopPass(&ID), PassToPrint(PI) {}
+  raw_ostream &Out;
+  std::string PassName;
+
+  LoopPassPrinter(const PassInfo *PI, raw_ostream &out) :
+    LoopPass(ID), PassToPrint(PI), Out(out) {
+      std::string PassToPrintName =  PassToPrint->getPassName();
+      PassName = "LoopPass Printer: " + PassToPrintName;
+    }
+
 
   virtual bool runOnLoop(Loop *L, LPPassManager &LPM) {
+    if (!Quiet)
+      Out << "Printing analysis '" << PassToPrint->getPassName() << "':\n";
+
+    // Get and print pass...
+    getAnalysisID<Pass>(PassToPrint->getTypeInfo()).print(Out,
+                        L->getHeader()->getParent()->getParent());
+    return false;
+  }
+
+  virtual const char *getPassName() const { return PassName.c_str(); }
+
+  virtual void getAnalysisUsage(AnalysisUsage &AU) const {
+    AU.addRequiredID(PassToPrint->getTypeInfo());
+    AU.setPreservesAll();
+  }
+};
+
+char LoopPassPrinter::ID = 0;
+
+struct RegionPassPrinter : public RegionPass {
+  static char ID;
+  const PassInfo *PassToPrint;
+  raw_ostream &Out;
+  std::string PassName;
+
+  RegionPassPrinter(const PassInfo *PI, raw_ostream &out) : RegionPass(ID),
+    PassToPrint(PI), Out(out) {
+    std::string PassToPrintName =  PassToPrint->getPassName();
+    PassName = "LoopPass Printer: " + PassToPrintName;
+  }
+
+  virtual bool runOnRegion(Region *R, RGPassManager &RGM) {
     if (!Quiet) {
-      outs() << "Printing analysis '" << PassToPrint->getPassName() << "':\n";
-      getAnalysisID<Pass>(PassToPrint).print(outs(),
-                                  L->getHeader()->getParent()->getParent());
+      Out << "Printing analysis '" << PassToPrint->getPassName() << "' for "
+        << "region: '" << R->getNameStr() << "' in function '"
+        << R->getEntry()->getParent()->getNameStr() << "':\n";
     }
     // Get and print pass...
+   getAnalysisID<Pass>(PassToPrint->getTypeInfo()).print(Out,
+                       R->getEntry()->getParent()->getParent());
     return false;
   }
 
   virtual const char *getPassName() const { return "'Pass' Printer"; }
 
   virtual void getAnalysisUsage(AnalysisUsage &AU) const {
-    AU.addRequiredID(PassToPrint);
+    AU.addRequiredID(PassToPrint->getTypeInfo());
     AU.setPreservesAll();
   }
 };
 
-char LoopPassPrinter::ID = 0;
+char RegionPassPrinter::ID = 0;
 
 struct BasicBlockPassPrinter : public BasicBlockPass {
   const PassInfo *PassToPrint;
+  raw_ostream &Out;
   static char ID;
-  BasicBlockPassPrinter(const PassInfo *PI)
-    : BasicBlockPass(&ID), PassToPrint(PI) {}
+  std::string PassName;
 
-  virtual bool runOnBasicBlock(BasicBlock &BB) {
-    if (!Quiet) {
-      outs() << "Printing Analysis info for BasicBlock '" << BB.getName()
-             << "': Pass " << PassToPrint->getPassName() << ":\n";
+  BasicBlockPassPrinter(const PassInfo *PI, raw_ostream &out)
+    : BasicBlockPass(ID), PassToPrint(PI), Out(out) {
+      std::string PassToPrintName =  PassToPrint->getPassName();
+      PassName = "BasicBlockPass Printer: " + PassToPrintName;
     }
 
+  virtual bool runOnBasicBlock(BasicBlock &BB) {
+    if (!Quiet)
+      Out << "Printing Analysis info for BasicBlock '" << BB.getName()
+          << "': Pass " << PassToPrint->getPassName() << ":\n";
+
     // Get and print pass...
-    getAnalysisID<Pass>(PassToPrint).print(outs(), BB.getParent()->getParent());
+    getAnalysisID<Pass>(PassToPrint->getTypeInfo()).print(Out, 
+            BB.getParent()->getParent());
     return false;
   }
 
-  virtual const char *getPassName() const { return "BasicBlockPass Printer"; }
+  virtual const char *getPassName() const { return PassName.c_str(); }
 
   virtual void getAnalysisUsage(AnalysisUsage &AU) const {
-    AU.addRequiredID(PassToPrint);
+    AU.addRequiredID(PassToPrint->getTypeInfo());
     AU.setPreservesAll();
   }
 };
@@ -351,6 +417,11 @@
 int main(int argc, char **argv) {
   sys::PrintStackTraceOnErrorSignal();
   llvm::PrettyStackTraceProgram X(argc, argv);
+
+  if (AnalyzeOnly && NoOutput) {
+    errs() << argv[0] << ": analyze mode conflicts with no-output mode.\n";
+    return 1;
+  }
   
   // Enable debug stream buffering.
   EnableDebugBuffering = true;
@@ -358,6 +429,18 @@
   llvm_shutdown_obj Y;  // Call llvm_shutdown() on exit.
   LLVMContext &Context = getGlobalContext();
   
+  // Initialize passes
+  PassRegistry &Registry = *PassRegistry::getPassRegistry();
+  initializeCore(Registry);
+  initializeScalarOpts(Registry);
+  initializeIPO(Registry);
+  initializeAnalysis(Registry);
+  initializeIPA(Registry);
+  initializeTransformUtils(Registry);
+  initializeInstCombine(Registry);
+  initializeInstrumentation(Registry);
+  initializeTarget(Registry);
+  
   cl::ParseCommandLineOptions(argc, argv,
     "llvm .bc -> .bc modular optimizer and analysis printer\n");
 
@@ -377,35 +460,22 @@
   }
 
   // Figure out what stream we are supposed to write to...
-  raw_ostream *Out = 0;
-  bool DeleteStream = false;
-  if (!NoOutput && !AnalyzeOnly) {
-    if (OutputFilename == "-") {
-      // Print to stdout.
-      Out = &outs();
-      // If we're printing a bitcode file, switch stdout to binary mode.
-      // FIXME: This switches outs() globally, not just for the bitcode output.
-      if (!OutputAssembly)
-        sys::Program::ChangeStdoutToBinary(); 
-    } else {
-      if (NoOutput || AnalyzeOnly) {
-        errs() << "WARNING: The -o (output filename) option is ignored when\n"
-                  "the --disable-output or --analyze options are used.\n";
-      } else {
-        // Make sure that the Output file gets unlinked from the disk if we get
-        // a SIGINT.
-        sys::RemoveFileOnSignal(sys::Path(OutputFilename));
-
-        std::string ErrorInfo;
-        Out = new raw_fd_ostream(OutputFilename.c_str(), ErrorInfo,
-                                 raw_fd_ostream::F_Binary);
-        if (!ErrorInfo.empty()) {
-          errs() << ErrorInfo << '\n';
-          delete Out;
-          return 1;
-        }
-        DeleteStream = true;
-      }
+  OwningPtr<tool_output_file> Out;
+  if (NoOutput) {
+    if (!OutputFilename.empty())
+      errs() << "WARNING: The -o (output filename) option is ignored when\n"
+                "the --disable-output option is used.\n";
+  } else {
+    // Default to standard output.
+    if (OutputFilename.empty())
+      OutputFilename = "-";
+
+    std::string ErrorInfo;
+    Out.reset(new tool_output_file(OutputFilename.c_str(), ErrorInfo,
+                                   raw_fd_ostream::F_Binary));
+    if (!ErrorInfo.empty()) {
+      errs() << ErrorInfo << '\n';
+      return 1;
     }
   }
 
@@ -413,7 +483,7 @@
   // console, print out a warning message and refuse to do it.  We don't
   // impress anyone by spewing tons of binary goo to a terminal.
   if (!Force && !NoOutput && !AnalyzeOnly && !OutputAssembly)
-    if (CheckBitcodeOutputToConsole(*Out, !Quiet))
+    if (CheckBitcodeOutputToConsole(Out->os(), !Quiet))
       NoOutput = true;
 
   // Create a PassManager to hold and optimize the collection of passes we are
@@ -489,19 +559,22 @@
       if (AnalyzeOnly) {
         switch (Kind) {
         case PT_BasicBlock:
-          Passes.add(new BasicBlockPassPrinter(PassInf));
+          Passes.add(new BasicBlockPassPrinter(PassInf, Out->os()));
+          break;
+        case PT_Region:
+          Passes.add(new RegionPassPrinter(PassInf, Out->os()));
           break;
         case PT_Loop:
-          Passes.add(new LoopPassPrinter(PassInf));
+          Passes.add(new LoopPassPrinter(PassInf, Out->os()));
           break;
         case PT_Function:
-          Passes.add(new FunctionPassPrinter(PassInf));
+          Passes.add(new FunctionPassPrinter(PassInf, Out->os()));
           break;
         case PT_CallGraphSCC:
-          Passes.add(new CallGraphSCCPassPrinter(PassInf));
+          Passes.add(new CallGraphSCCPassPrinter(PassInf, Out->os()));
           break;
         default:
-          Passes.add(new ModulePassPrinter(PassInf));
+          Passes.add(new ModulePassPrinter(PassInf, Out->os()));
           break;
         }
       }
@@ -538,19 +611,20 @@
   if (!NoVerify && !VerifyEach)
     Passes.add(createVerifierPass());
 
-  // Write bitcode or assembly out to disk or outs() as the last step...
+  // Write bitcode or assembly to the output as the last step...
   if (!NoOutput && !AnalyzeOnly) {
     if (OutputAssembly)
-      Passes.add(createPrintModulePass(Out));
+      Passes.add(createPrintModulePass(&Out->os()));
     else
-      Passes.add(createBitcodeWriterPass(*Out));
+      Passes.add(createBitcodeWriterPass(Out->os()));
   }
 
   // Now that we have all of the passes ready, run them.
   Passes.run(*M.get());
 
-  // Delete the raw_fd_ostream.
-  if (DeleteStream)
-    delete Out;
+  // Declare success.
+  if (!NoOutput)
+    Out->keep();
+
   return 0;
 }

Modified: llvm/branches/wendling/eh/unittests/ADT/APIntTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/unittests/ADT/APIntTest.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/unittests/ADT/APIntTest.cpp (original)
+++ llvm/branches/wendling/eh/unittests/ADT/APIntTest.cpp Tue Oct 26 19:48:03 2010
@@ -39,6 +39,9 @@
   EXPECT_EQ(-1, Minus1.getSExtValue());
 }
 
+// XFAIL this test on FreeBSD where the system gcc-4.2.1 seems to miscompile it.
+#if defined(__llvm__) || !defined(__FreeBSD__)
+
 TEST(APIntTest, i33_Count) {
   APInt i33minus2(33, static_cast<uint64_t>(-2), true);
   EXPECT_EQ(0u, i33minus2.countLeadingZeros());
@@ -50,6 +53,8 @@
   EXPECT_EQ(((uint64_t)-2)&((1ull<<33) -1), i33minus2.getZExtValue());
 }
 
+#endif
+
 TEST(APIntTest, i65_Count) {
   APInt i65minus(65, 0, true);
   i65minus.set(64);

Modified: llvm/branches/wendling/eh/unittests/ADT/BitVectorTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/unittests/ADT/BitVectorTest.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/unittests/ADT/BitVectorTest.cpp (original)
+++ llvm/branches/wendling/eh/unittests/ADT/BitVectorTest.cpp Tue Oct 26 19:48:03 2010
@@ -22,6 +22,7 @@
   EXPECT_EQ(0U, Vec.count());
   EXPECT_EQ(0U, Vec.size());
   EXPECT_FALSE(Vec.any());
+  EXPECT_TRUE(Vec.all());
   EXPECT_TRUE(Vec.none());
   EXPECT_TRUE(Vec.empty());
 
@@ -29,6 +30,7 @@
   EXPECT_EQ(5U, Vec.count());
   EXPECT_EQ(5U, Vec.size());
   EXPECT_TRUE(Vec.any());
+  EXPECT_TRUE(Vec.all());
   EXPECT_FALSE(Vec.none());
   EXPECT_FALSE(Vec.empty());
 
@@ -36,6 +38,7 @@
   EXPECT_EQ(5U, Vec.count());
   EXPECT_EQ(11U, Vec.size());
   EXPECT_TRUE(Vec.any());
+  EXPECT_FALSE(Vec.all());
   EXPECT_FALSE(Vec.none());
   EXPECT_FALSE(Vec.empty());
 
@@ -43,6 +46,7 @@
   EXPECT_EQ(6U, Inv.count());
   EXPECT_EQ(11U, Inv.size());
   EXPECT_TRUE(Inv.any());
+  EXPECT_FALSE(Inv.all());
   EXPECT_FALSE(Inv.none());
   EXPECT_FALSE(Inv.empty());
 
@@ -123,6 +127,7 @@
   EXPECT_EQ(0U, Vec.count());
   EXPECT_EQ(130U, Vec.size());
   EXPECT_FALSE(Vec.any());
+  EXPECT_FALSE(Vec.all());
   EXPECT_TRUE(Vec.none());
   EXPECT_FALSE(Vec.empty());
 
@@ -130,6 +135,7 @@
   EXPECT_EQ(0U, Inv.count());
   EXPECT_EQ(0U, Inv.size());
   EXPECT_FALSE(Inv.any());
+  EXPECT_TRUE(Inv.all());
   EXPECT_TRUE(Inv.none());
   EXPECT_TRUE(Inv.empty());
 
@@ -137,6 +143,7 @@
   EXPECT_EQ(0U, Vec.count());
   EXPECT_EQ(0U, Vec.size());
   EXPECT_FALSE(Vec.any());
+  EXPECT_TRUE(Vec.all());
   EXPECT_TRUE(Vec.none());
   EXPECT_TRUE(Vec.empty());
 }

Modified: llvm/branches/wendling/eh/unittests/ADT/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/unittests/ADT/Makefile?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/unittests/ADT/Makefile (original)
+++ llvm/branches/wendling/eh/unittests/ADT/Makefile Tue Oct 26 19:48:03 2010
@@ -9,7 +9,7 @@
 
 LEVEL = ../..
 TESTNAME = ADT
-LINK_COMPONENTS := core support
+LINK_COMPONENTS := support
 
 include $(LEVEL)/Makefile.config
 

Modified: llvm/branches/wendling/eh/unittests/ADT/SmallBitVectorTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/unittests/ADT/SmallBitVectorTest.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/unittests/ADT/SmallBitVectorTest.cpp (original)
+++ llvm/branches/wendling/eh/unittests/ADT/SmallBitVectorTest.cpp Tue Oct 26 19:48:03 2010
@@ -19,6 +19,7 @@
   EXPECT_EQ(0U, Vec.count());
   EXPECT_EQ(0U, Vec.size());
   EXPECT_FALSE(Vec.any());
+  EXPECT_TRUE(Vec.all());
   EXPECT_TRUE(Vec.none());
   EXPECT_TRUE(Vec.empty());
 
@@ -26,6 +27,7 @@
   EXPECT_EQ(5U, Vec.count());
   EXPECT_EQ(5U, Vec.size());
   EXPECT_TRUE(Vec.any());
+  EXPECT_TRUE(Vec.all());
   EXPECT_FALSE(Vec.none());
   EXPECT_FALSE(Vec.empty());
 
@@ -33,6 +35,7 @@
   EXPECT_EQ(5U, Vec.count());
   EXPECT_EQ(11U, Vec.size());
   EXPECT_TRUE(Vec.any());
+  EXPECT_FALSE(Vec.all());
   EXPECT_FALSE(Vec.none());
   EXPECT_FALSE(Vec.empty());
 
@@ -40,6 +43,7 @@
   EXPECT_EQ(6U, Inv.count());
   EXPECT_EQ(11U, Inv.size());
   EXPECT_TRUE(Inv.any());
+  EXPECT_FALSE(Inv.all());
   EXPECT_FALSE(Inv.none());
   EXPECT_FALSE(Inv.empty());
 
@@ -120,6 +124,7 @@
   EXPECT_EQ(0U, Vec.count());
   EXPECT_EQ(130U, Vec.size());
   EXPECT_FALSE(Vec.any());
+  EXPECT_FALSE(Vec.all());
   EXPECT_TRUE(Vec.none());
   EXPECT_FALSE(Vec.empty());
 
@@ -127,6 +132,7 @@
   EXPECT_EQ(0U, Inv.count());
   EXPECT_EQ(0U, Inv.size());
   EXPECT_FALSE(Inv.any());
+  EXPECT_TRUE(Inv.all());
   EXPECT_TRUE(Inv.none());
   EXPECT_TRUE(Inv.empty());
 
@@ -134,6 +140,7 @@
   EXPECT_EQ(0U, Vec.count());
   EXPECT_EQ(0U, Vec.size());
   EXPECT_FALSE(Vec.any());
+  EXPECT_TRUE(Vec.all());
   EXPECT_TRUE(Vec.none());
   EXPECT_TRUE(Vec.empty());
 }

Modified: llvm/branches/wendling/eh/unittests/ADT/SmallVectorTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/unittests/ADT/SmallVectorTest.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/unittests/ADT/SmallVectorTest.cpp (original)
+++ llvm/branches/wendling/eh/unittests/ADT/SmallVectorTest.cpp Tue Oct 26 19:48:03 2010
@@ -13,6 +13,7 @@
 
 #include "gtest/gtest.h"
 #include "llvm/ADT/SmallVector.h"
+#include "llvm/Support/Compiler.h"
 #include <stdarg.h>
 #include <list>
 
@@ -76,7 +77,8 @@
     return c0.getValue() == c1.getValue();
   }
 
-  friend bool operator!=(const Constructable & c0, const Constructable & c1) {
+  friend bool LLVM_ATTRIBUTE_UNUSED
+  operator!=(const Constructable & c0, const Constructable & c1) {
     return c0.getValue() != c1.getValue();
   }
 };

Modified: llvm/branches/wendling/eh/unittests/ADT/StringRefTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/unittests/ADT/StringRefTest.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/unittests/ADT/StringRefTest.cpp (original)
+++ llvm/branches/wendling/eh/unittests/ADT/StringRefTest.cpp Tue Oct 26 19:48:03 2010
@@ -53,6 +53,14 @@
   EXPECT_EQ( 1, StringRef("aab").compare("aaa"));
   EXPECT_EQ(-1, StringRef("aab").compare("aabb"));
   EXPECT_EQ( 1, StringRef("aab").compare("aa"));
+  EXPECT_EQ( 1, StringRef("\xFF").compare("\1"));
+
+  EXPECT_EQ(-1, StringRef("AaB").compare_lower("aAd"));
+  EXPECT_EQ( 0, StringRef("AaB").compare_lower("aab"));
+  EXPECT_EQ( 1, StringRef("AaB").compare_lower("AAA"));
+  EXPECT_EQ(-1, StringRef("AaB").compare_lower("aaBb"));
+  EXPECT_EQ( 1, StringRef("AaB").compare_lower("aA"));
+  EXPECT_EQ( 1, StringRef("\xFF").compare_lower("\1"));
 
   EXPECT_EQ(-1, StringRef("aab").compare_numeric("aad"));
   EXPECT_EQ( 0, StringRef("aab").compare_numeric("aab"));
@@ -64,6 +72,7 @@
   EXPECT_EQ( 0, StringRef("10a").compare_numeric("10a"));
   EXPECT_EQ( 1, StringRef("2").compare_numeric("1"));
   EXPECT_EQ( 0, StringRef("llvm_v1i64_ty").compare_numeric("llvm_v1i64_ty"));
+  EXPECT_EQ( 1, StringRef("\xFF").compare_numeric("\1"));
 }
 
 TEST(StringRefTest, Operators) {

Modified: llvm/branches/wendling/eh/unittests/ADT/TripleTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/unittests/ADT/TripleTest.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/unittests/ADT/TripleTest.cpp (original)
+++ llvm/branches/wendling/eh/unittests/ADT/TripleTest.cpp Tue Oct 26 19:48:03 2010
@@ -79,31 +79,137 @@
   EXPECT_EQ(Triple::x86, T.getArch());
   EXPECT_EQ(Triple::Apple, T.getVendor());
   EXPECT_EQ(Triple::Darwin, T.getOS());
+  EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
 
   T = Triple("x86_64-pc-linux-gnu");
   EXPECT_EQ(Triple::x86_64, T.getArch());
   EXPECT_EQ(Triple::PC, T.getVendor());
   EXPECT_EQ(Triple::Linux, T.getOS());
+  // When environments are defined, change this test to verify the "gnu"
+  // environment.
+  EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
 
   T = Triple("powerpc-dunno-notsure");
   EXPECT_EQ(Triple::ppc, T.getArch());
   EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
   EXPECT_EQ(Triple::UnknownOS, T.getOS());
+  EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
 
   T = Triple("huh");
   EXPECT_EQ(Triple::UnknownArch, T.getArch());
+}
 
-  // Two exceptional cases.
+static std::string Join(StringRef A, StringRef B, StringRef C) {
+  std::string Str = A; Str += '-'; Str += B; Str += '-'; Str += C;
+  return Str;
+}
 
-  T = Triple("i386-mingw32");
-  EXPECT_EQ(Triple::x86, T.getArch());
-  EXPECT_EQ(Triple::PC, T.getVendor());
-  EXPECT_EQ(Triple::MinGW32, T.getOS());
+static std::string Join(StringRef A, StringRef B, StringRef C, StringRef D) {
+  std::string Str = A; Str += '-'; Str += B; Str += '-'; Str += C; Str += '-';
+  Str += D; return Str;
+}
 
-  T = Triple("arm-elf");
-  EXPECT_EQ(Triple::arm, T.getArch());
-  EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
-  EXPECT_EQ(Triple::UnknownOS, T.getOS());
+TEST(TripleTest, Normalization) {
+  EXPECT_EQ("", Triple::normalize(""));
+  EXPECT_EQ("-", Triple::normalize("-"));
+  EXPECT_EQ("--", Triple::normalize("--"));
+  EXPECT_EQ("---", Triple::normalize("---"));
+  EXPECT_EQ("----", Triple::normalize("----"));
+
+  EXPECT_EQ("a", Triple::normalize("a"));
+  EXPECT_EQ("a-b", Triple::normalize("a-b"));
+  EXPECT_EQ("a-b-c", Triple::normalize("a-b-c"));
+  EXPECT_EQ("a-b-c-d", Triple::normalize("a-b-c-d"));
+
+  EXPECT_EQ("i386-b-c", Triple::normalize("i386-b-c"));
+  EXPECT_EQ("i386-a-c", Triple::normalize("a-i386-c"));
+  EXPECT_EQ("i386-a-b", Triple::normalize("a-b-i386"));
+  EXPECT_EQ("i386-a-b-c", Triple::normalize("a-b-c-i386"));
+
+  EXPECT_EQ("a-pc-c", Triple::normalize("a-pc-c"));
+  EXPECT_EQ("-pc-b-c", Triple::normalize("pc-b-c"));
+  EXPECT_EQ("a-pc-b", Triple::normalize("a-b-pc"));
+  EXPECT_EQ("a-pc-b-c", Triple::normalize("a-b-c-pc"));
+
+  EXPECT_EQ("a-b-linux", Triple::normalize("a-b-linux"));
+  EXPECT_EQ("--linux-b-c", Triple::normalize("linux-b-c"));
+  EXPECT_EQ("a--linux-c", Triple::normalize("a-linux-c"));
+
+  EXPECT_EQ("i386-pc-a", Triple::normalize("a-pc-i386"));
+  EXPECT_EQ("i386-pc-", Triple::normalize("-pc-i386"));
+  EXPECT_EQ("-pc-linux-c", Triple::normalize("linux-pc-c"));
+  EXPECT_EQ("-pc-linux", Triple::normalize("linux-pc-"));
+
+  EXPECT_EQ("i386", Triple::normalize("i386"));
+  EXPECT_EQ("-pc", Triple::normalize("pc"));
+  EXPECT_EQ("--linux", Triple::normalize("linux"));
+
+  // Check that normalizing a permutated set of valid components returns a
+  // triple with the unpermuted components.
+  StringRef C[4];
+  C[3] = "environment";
+  for (int Arch = 1+Triple::UnknownArch; Arch < Triple::InvalidArch; ++Arch) {
+    C[0] = Triple::getArchTypeName(Triple::ArchType(Arch));
+    for (int Vendor = 1+Triple::UnknownVendor; Vendor <= Triple::PC;
+         ++Vendor) {
+      C[1] = Triple::getVendorTypeName(Triple::VendorType(Vendor));
+      for (int OS = 1+Triple::UnknownOS; OS <= Triple::Minix; ++OS) {
+        C[2] = Triple::getOSTypeName(Triple::OSType(OS));
+
+        std::string E = Join(C[0], C[1], C[2]);
+        std::string F = Join(C[0], C[1], C[2], C[3]);
+        EXPECT_EQ(E, Triple::normalize(Join(C[0], C[1], C[2])));
+        EXPECT_EQ(F, Triple::normalize(Join(C[0], C[1], C[2], C[3])));
+
+        // If a value has multiple interpretations, then the permutation
+        // test will inevitably fail.  Currently this is only the case for
+        // "psp" which parses as both an architecture and an O/S.
+        if (OS == Triple::Psp)
+          continue;
+
+        EXPECT_EQ(E, Triple::normalize(Join(C[0], C[2], C[1])));
+        EXPECT_EQ(E, Triple::normalize(Join(C[1], C[2], C[0])));
+        EXPECT_EQ(E, Triple::normalize(Join(C[1], C[0], C[2])));
+        EXPECT_EQ(E, Triple::normalize(Join(C[2], C[0], C[1])));
+        EXPECT_EQ(E, Triple::normalize(Join(C[2], C[1], C[0])));
+
+        EXPECT_EQ(F, Triple::normalize(Join(C[0], C[1], C[3], C[2])));
+        EXPECT_EQ(F, Triple::normalize(Join(C[0], C[2], C[3], C[1])));
+        EXPECT_EQ(F, Triple::normalize(Join(C[0], C[2], C[1], C[3])));
+        EXPECT_EQ(F, Triple::normalize(Join(C[0], C[3], C[1], C[2])));
+        EXPECT_EQ(F, Triple::normalize(Join(C[0], C[3], C[2], C[1])));
+        EXPECT_EQ(F, Triple::normalize(Join(C[1], C[2], C[3], C[0])));
+        EXPECT_EQ(F, Triple::normalize(Join(C[1], C[2], C[0], C[3])));
+        EXPECT_EQ(F, Triple::normalize(Join(C[1], C[3], C[0], C[2])));
+        EXPECT_EQ(F, Triple::normalize(Join(C[1], C[3], C[2], C[0])));
+        EXPECT_EQ(F, Triple::normalize(Join(C[1], C[0], C[2], C[3])));
+        EXPECT_EQ(F, Triple::normalize(Join(C[1], C[0], C[3], C[2])));
+        EXPECT_EQ(F, Triple::normalize(Join(C[2], C[3], C[0], C[1])));
+        EXPECT_EQ(F, Triple::normalize(Join(C[2], C[3], C[1], C[0])));
+        EXPECT_EQ(F, Triple::normalize(Join(C[2], C[0], C[1], C[3])));
+        EXPECT_EQ(F, Triple::normalize(Join(C[2], C[0], C[3], C[1])));
+        EXPECT_EQ(F, Triple::normalize(Join(C[2], C[1], C[3], C[0])));
+        EXPECT_EQ(F, Triple::normalize(Join(C[2], C[1], C[0], C[3])));
+        EXPECT_EQ(F, Triple::normalize(Join(C[3], C[0], C[1], C[2])));
+        EXPECT_EQ(F, Triple::normalize(Join(C[3], C[0], C[2], C[1])));
+        EXPECT_EQ(F, Triple::normalize(Join(C[3], C[1], C[2], C[0])));
+        EXPECT_EQ(F, Triple::normalize(Join(C[3], C[1], C[0], C[2])));
+        EXPECT_EQ(F, Triple::normalize(Join(C[3], C[2], C[0], C[1])));
+        EXPECT_EQ(F, Triple::normalize(Join(C[3], C[2], C[1], C[0])));
+      }
+    }
+  }
+
+  EXPECT_EQ("a-b-psp", Triple::normalize("a-b-psp"));
+  EXPECT_EQ("psp-b-c", Triple::normalize("psp-b-c"));
+
+  // Various real-world funky triples.  The value returned by GCC's config.sub
+  // is given in the comment.
+  EXPECT_EQ("i386--mingw32", Triple::normalize("i386-mingw32")); // i386-pc-mingw32
+  EXPECT_EQ("x86_64--linux-gnu", Triple::normalize("x86_64-linux-gnu")); // x86_64-pc-linux-gnu
+  EXPECT_EQ("i486--linux-gnu", Triple::normalize("i486-linux-gnu")); // i486-pc-linux-gnu
+  EXPECT_EQ("i386-redhat-linux", Triple::normalize("i386-redhat-linux")); // i386-redhat-linux-gnu
+  EXPECT_EQ("i686--linux", Triple::normalize("i686-linux")); // i686-pc-linux-gnu
 }
 
 TEST(TripleTest, MutateName) {
@@ -111,6 +217,7 @@
   EXPECT_EQ(Triple::UnknownArch, T.getArch());
   EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
   EXPECT_EQ(Triple::UnknownOS, T.getOS());
+  EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
 
   T.setArchName("i386");
   EXPECT_EQ(Triple::x86, T.getArch());

Removed: llvm/branches/wendling/eh/unittests/ADT/ValueMapTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/unittests/ADT/ValueMapTest.cpp?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/unittests/ADT/ValueMapTest.cpp (original)
+++ llvm/branches/wendling/eh/unittests/ADT/ValueMapTest.cpp (removed)
@@ -1,303 +0,0 @@
-//===- llvm/unittest/ADT/ValueMapTest.cpp - ValueMap unit tests -*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/ADT/ValueMap.h"
-#include "llvm/Instructions.h"
-#include "llvm/LLVMContext.h"
-#include "llvm/ADT/OwningPtr.h"
-#include "llvm/Config/config.h"
-
-#include "gtest/gtest.h"
-
-using namespace llvm;
-
-namespace {
-
-// Test fixture
-template<typename T>
-class ValueMapTest : public testing::Test {
-protected:
-  Constant *ConstantV;
-  OwningPtr<BitCastInst> BitcastV;
-  OwningPtr<BinaryOperator> AddV;
-
-  ValueMapTest() :
-    ConstantV(ConstantInt::get(Type::getInt32Ty(getGlobalContext()), 0)),
-    BitcastV(new BitCastInst(ConstantV, Type::getInt32Ty(getGlobalContext()))),
-    AddV(BinaryOperator::CreateAdd(ConstantV, ConstantV)) {
-  }
-};
-
-// Run everything on Value*, a subtype to make sure that casting works as
-// expected, and a const subtype to make sure we cast const correctly.
-typedef ::testing::Types<Value, Instruction, const Instruction> KeyTypes;
-TYPED_TEST_CASE(ValueMapTest, KeyTypes);
-
-TYPED_TEST(ValueMapTest, CopyConstructor) {
-  ValueMap<TypeParam*, int> VM1;
-  VM1[this->AddV.get()] = 7;
-  ValueMap<TypeParam*, int> VM2(VM1);
-  this->AddV.reset();
-  EXPECT_TRUE(VM1.empty());
-  EXPECT_TRUE(VM2.empty());
-}
-
-TYPED_TEST(ValueMapTest, Null) {
-  ValueMap<TypeParam*, int> VM1;
-  VM1[NULL] = 7;
-  EXPECT_EQ(7, VM1.lookup(NULL));
-}
-
-TYPED_TEST(ValueMapTest, FollowsValue) {
-  ValueMap<TypeParam*, int> VM;
-  VM[this->BitcastV.get()] = 7;
-  EXPECT_EQ(7, VM.lookup(this->BitcastV.get()));
-  EXPECT_EQ(0, VM.count(this->AddV.get()));
-  this->BitcastV->replaceAllUsesWith(this->AddV.get());
-  EXPECT_EQ(7, VM.lookup(this->AddV.get()));
-  EXPECT_EQ(0, VM.count(this->BitcastV.get()));
-  this->AddV.reset();
-  EXPECT_EQ(0, VM.count(this->AddV.get()));
-  EXPECT_EQ(0, VM.count(this->BitcastV.get()));
-  EXPECT_EQ(0U, VM.size());
-}
-
-TYPED_TEST(ValueMapTest, OperationsWork) {
-  ValueMap<TypeParam*, int> VM;
-  ValueMap<TypeParam*, int> VM2(16);  (void)VM2;
-  typename ValueMapConfig<TypeParam*>::ExtraData Data;
-  ValueMap<TypeParam*, int> VM3(Data, 16);  (void)VM3;
-  EXPECT_TRUE(VM.empty());
-
-  VM[this->BitcastV.get()] = 7;
-
-  // Find:
-  typename ValueMap<TypeParam*, int>::iterator I =
-    VM.find(this->BitcastV.get());
-  ASSERT_TRUE(I != VM.end());
-  EXPECT_EQ(this->BitcastV.get(), I->first);
-  EXPECT_EQ(7, I->second);
-  EXPECT_TRUE(VM.find(this->AddV.get()) == VM.end());
-
-  // Const find:
-  const ValueMap<TypeParam*, int> &CVM = VM;
-  typename ValueMap<TypeParam*, int>::const_iterator CI =
-    CVM.find(this->BitcastV.get());
-  ASSERT_TRUE(CI != CVM.end());
-  EXPECT_EQ(this->BitcastV.get(), CI->first);
-  EXPECT_EQ(7, CI->second);
-  EXPECT_TRUE(CVM.find(this->AddV.get()) == CVM.end());
-
-  // Insert:
-  std::pair<typename ValueMap<TypeParam*, int>::iterator, bool> InsertResult1 =
-    VM.insert(std::make_pair(this->AddV.get(), 3));
-  EXPECT_EQ(this->AddV.get(), InsertResult1.first->first);
-  EXPECT_EQ(3, InsertResult1.first->second);
-  EXPECT_TRUE(InsertResult1.second);
-  EXPECT_EQ(true, VM.count(this->AddV.get()));
-  std::pair<typename ValueMap<TypeParam*, int>::iterator, bool> InsertResult2 =
-    VM.insert(std::make_pair(this->AddV.get(), 5));
-  EXPECT_EQ(this->AddV.get(), InsertResult2.first->first);
-  EXPECT_EQ(3, InsertResult2.first->second);
-  EXPECT_FALSE(InsertResult2.second);
-
-  // Erase:
-  VM.erase(InsertResult2.first);
-  EXPECT_EQ(0U, VM.count(this->AddV.get()));
-  EXPECT_EQ(1U, VM.count(this->BitcastV.get()));
-  VM.erase(this->BitcastV.get());
-  EXPECT_EQ(0U, VM.count(this->BitcastV.get()));
-  EXPECT_EQ(0U, VM.size());
-
-  // Range insert:
-  SmallVector<std::pair<Instruction*, int>, 2> Elems;
-  Elems.push_back(std::make_pair(this->AddV.get(), 1));
-  Elems.push_back(std::make_pair(this->BitcastV.get(), 2));
-  VM.insert(Elems.begin(), Elems.end());
-  EXPECT_EQ(1, VM.lookup(this->AddV.get()));
-  EXPECT_EQ(2, VM.lookup(this->BitcastV.get()));
-}
-
-template<typename ExpectedType, typename VarType>
-void CompileAssertHasType(VarType) {
-  typedef char assert[is_same<ExpectedType, VarType>::value ? 1 : -1];
-}
-
-TYPED_TEST(ValueMapTest, Iteration) {
-  ValueMap<TypeParam*, int> VM;
-  VM[this->BitcastV.get()] = 2;
-  VM[this->AddV.get()] = 3;
-  size_t size = 0;
-  for (typename ValueMap<TypeParam*, int>::iterator I = VM.begin(), E = VM.end();
-       I != E; ++I) {
-    ++size;
-    std::pair<TypeParam*, int> value = *I; (void)value;
-    CompileAssertHasType<TypeParam*>(I->first);
-    if (I->second == 2) {
-      EXPECT_EQ(this->BitcastV.get(), I->first);
-      I->second = 5;
-    } else if (I->second == 3) {
-      EXPECT_EQ(this->AddV.get(), I->first);
-      I->second = 6;
-    } else {
-      ADD_FAILURE() << "Iterated through an extra value.";
-    }
-  }
-  EXPECT_EQ(2U, size);
-  EXPECT_EQ(5, VM[this->BitcastV.get()]);
-  EXPECT_EQ(6, VM[this->AddV.get()]);
-
-  size = 0;
-  // Cast to const ValueMap to avoid a bug in DenseMap's iterators.
-  const ValueMap<TypeParam*, int>& CVM = VM;
-  for (typename ValueMap<TypeParam*, int>::const_iterator I = CVM.begin(),
-         E = CVM.end(); I != E; ++I) {
-    ++size;
-    std::pair<TypeParam*, int> value = *I;  (void)value;
-    CompileAssertHasType<TypeParam*>(I->first);
-    if (I->second == 5) {
-      EXPECT_EQ(this->BitcastV.get(), I->first);
-    } else if (I->second == 6) {
-      EXPECT_EQ(this->AddV.get(), I->first);
-    } else {
-      ADD_FAILURE() << "Iterated through an extra value.";
-    }
-  }
-  EXPECT_EQ(2U, size);
-}
-
-TYPED_TEST(ValueMapTest, DefaultCollisionBehavior) {
-  // By default, we overwrite the old value with the replaced value.
-  ValueMap<TypeParam*, int> VM;
-  VM[this->BitcastV.get()] = 7;
-  VM[this->AddV.get()] = 9;
-  this->BitcastV->replaceAllUsesWith(this->AddV.get());
-  EXPECT_EQ(0, VM.count(this->BitcastV.get()));
-  EXPECT_EQ(9, VM.lookup(this->AddV.get()));
-}
-
-TYPED_TEST(ValueMapTest, ConfiguredCollisionBehavior) {
-  // TODO: Implement this when someone needs it.
-}
-
-template<typename KeyT>
-struct LockMutex : ValueMapConfig<KeyT> {
-  struct ExtraData {
-    sys::Mutex *M;
-    bool *CalledRAUW;
-    bool *CalledDeleted;
-  };
-  static void onRAUW(const ExtraData &Data, KeyT Old, KeyT New) {
-    *Data.CalledRAUW = true;
-    EXPECT_FALSE(Data.M->tryacquire()) << "Mutex should already be locked.";
-  }
-  static void onDelete(const ExtraData &Data, KeyT Old) {
-    *Data.CalledDeleted = true;
-    EXPECT_FALSE(Data.M->tryacquire()) << "Mutex should already be locked.";
-  }
-  static sys::Mutex *getMutex(const ExtraData &Data) { return Data.M; }
-};
-#if ENABLE_THREADS
-TYPED_TEST(ValueMapTest, LocksMutex) {
-  sys::Mutex M(false);  // Not recursive.
-  bool CalledRAUW = false, CalledDeleted = false;
-  typename LockMutex<TypeParam*>::ExtraData Data =
-    {&M, &CalledRAUW, &CalledDeleted};
-  ValueMap<TypeParam*, int, LockMutex<TypeParam*> > VM(Data);
-  VM[this->BitcastV.get()] = 7;
-  this->BitcastV->replaceAllUsesWith(this->AddV.get());
-  this->AddV.reset();
-  EXPECT_TRUE(CalledRAUW);
-  EXPECT_TRUE(CalledDeleted);
-}
-#endif
-
-template<typename KeyT>
-struct NoFollow : ValueMapConfig<KeyT> {
-  enum { FollowRAUW = false };
-};
-
-TYPED_TEST(ValueMapTest, NoFollowRAUW) {
-  ValueMap<TypeParam*, int, NoFollow<TypeParam*> > VM;
-  VM[this->BitcastV.get()] = 7;
-  EXPECT_EQ(7, VM.lookup(this->BitcastV.get()));
-  EXPECT_EQ(0, VM.count(this->AddV.get()));
-  this->BitcastV->replaceAllUsesWith(this->AddV.get());
-  EXPECT_EQ(7, VM.lookup(this->BitcastV.get()));
-  EXPECT_EQ(0, VM.lookup(this->AddV.get()));
-  this->AddV.reset();
-  EXPECT_EQ(7, VM.lookup(this->BitcastV.get()));
-  EXPECT_EQ(0, VM.lookup(this->AddV.get()));
-  this->BitcastV.reset();
-  EXPECT_EQ(0, VM.lookup(this->BitcastV.get()));
-  EXPECT_EQ(0, VM.lookup(this->AddV.get()));
-  EXPECT_EQ(0U, VM.size());
-}
-
-template<typename KeyT>
-struct CountOps : ValueMapConfig<KeyT> {
-  struct ExtraData {
-    int *Deletions;
-    int *RAUWs;
-  };
-
-  static void onRAUW(const ExtraData &Data, KeyT Old, KeyT New) {
-    ++*Data.RAUWs;
-  }
-  static void onDelete(const ExtraData &Data, KeyT Old) {
-    ++*Data.Deletions;
-  }
-};
-
-TYPED_TEST(ValueMapTest, CallsConfig) {
-  int Deletions = 0, RAUWs = 0;
-  typename CountOps<TypeParam*>::ExtraData Data = {&Deletions, &RAUWs};
-  ValueMap<TypeParam*, int, CountOps<TypeParam*> > VM(Data);
-  VM[this->BitcastV.get()] = 7;
-  this->BitcastV->replaceAllUsesWith(this->AddV.get());
-  EXPECT_EQ(0, Deletions);
-  EXPECT_EQ(1, RAUWs);
-  this->AddV.reset();
-  EXPECT_EQ(1, Deletions);
-  EXPECT_EQ(1, RAUWs);
-  this->BitcastV.reset();
-  EXPECT_EQ(1, Deletions);
-  EXPECT_EQ(1, RAUWs);
-}
-
-template<typename KeyT>
-struct ModifyingConfig : ValueMapConfig<KeyT> {
-  // We'll put a pointer here back to the ValueMap this key is in, so
-  // that we can modify it (and clobber *this) before the ValueMap
-  // tries to do the same modification.  In previous versions of
-  // ValueMap, that exploded.
-  typedef ValueMap<KeyT, int, ModifyingConfig<KeyT> > **ExtraData;
-
-  static void onRAUW(ExtraData Map, KeyT Old, KeyT New) {
-    (*Map)->erase(Old);
-  }
-  static void onDelete(ExtraData Map, KeyT Old) {
-    (*Map)->erase(Old);
-  }
-};
-TYPED_TEST(ValueMapTest, SurvivesModificationByConfig) {
-  ValueMap<TypeParam*, int, ModifyingConfig<TypeParam*> > *MapAddress;
-  ValueMap<TypeParam*, int, ModifyingConfig<TypeParam*> > VM(&MapAddress);
-  MapAddress = &VM;
-  // Now the ModifyingConfig can modify the Map inside a callback.
-  VM[this->BitcastV.get()] = 7;
-  this->BitcastV->replaceAllUsesWith(this->AddV.get());
-  EXPECT_FALSE(VM.count(this->BitcastV.get()));
-  EXPECT_FALSE(VM.count(this->AddV.get()));
-  VM[this->AddV.get()] = 7;
-  this->AddV.reset();
-  EXPECT_FALSE(VM.count(this->AddV.get()));
-}
-
-}

Propchange: llvm/branches/wendling/eh/unittests/Analysis/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Oct 26 19:48:03 2010
@@ -0,0 +1,9 @@
+Debug
+Release
+Release-Asserts
+Debug+Coverage-Asserts
+Debug+Coverage
+Release+Coverage
+Debug+Checks
+Debug+Asserts
+Release+Asserts

Modified: llvm/branches/wendling/eh/unittests/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/unittests/Makefile?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/unittests/Makefile (original)
+++ llvm/branches/wendling/eh/unittests/Makefile Tue Oct 26 19:48:03 2010
@@ -9,7 +9,7 @@
 
 LEVEL = ..
 
-PARALLEL_DIRS = ADT ExecutionEngine Support Transforms VMCore
+PARALLEL_DIRS = ADT ExecutionEngine Support Transforms VMCore Analysis
 
 include $(LEVEL)/Makefile.common
 

Modified: llvm/branches/wendling/eh/unittests/Makefile.unittest
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/unittests/Makefile.unittest?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/unittests/Makefile.unittest (original)
+++ llvm/branches/wendling/eh/unittests/Makefile.unittest Tue Oct 26 19:48:03 2010
@@ -37,10 +37,10 @@
 ifeq ($(ENABLE_SHARED), 1)
   # Add the absolute path to the dynamic library.  This is ok because
   # we'll never install unittests.
-  LD.Flags += $(RPATH) -Wl,$(LibDir)
+  LD.Flags += $(RPATH) -Wl,$(SharedLibDir)
   # Also set {DYLD,LD}_LIBRARY_PATH because OSX ignores the rpath most
   # of the time.
-  Run.Shared := $(SHLIBPATH_VAR)="$(LibDir)$${$(SHLIBPATH_VAR):+:}$$$(SHLIBPATH_VAR)"
+  Run.Shared := $(SHLIBPATH_VAR)="$(SharedLibDir)$${$(SHLIBPATH_VAR):+:}$$$(SHLIBPATH_VAR)"
 endif
 
 $(LLVMUnitTestExe): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)

Modified: llvm/branches/wendling/eh/unittests/Support/ConstantRangeTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/unittests/Support/ConstantRangeTest.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/unittests/Support/ConstantRangeTest.cpp (original)
+++ llvm/branches/wendling/eh/unittests/Support/ConstantRangeTest.cpp Tue Oct 26 19:48:03 2010
@@ -8,6 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/ConstantRange.h"
+#include "llvm/Instructions.h"
 
 #include "gtest/gtest.h"
 
@@ -33,6 +34,7 @@
 TEST_F(ConstantRangeTest, Basics) {
   EXPECT_TRUE(Full.isFullSet());
   EXPECT_FALSE(Full.isEmptySet());
+  EXPECT_TRUE(Full.inverse().isEmptySet());
   EXPECT_FALSE(Full.isWrappedSet());
   EXPECT_TRUE(Full.contains(APInt(16, 0x0)));
   EXPECT_TRUE(Full.contains(APInt(16, 0x9)));
@@ -42,6 +44,7 @@
 
   EXPECT_FALSE(Empty.isFullSet());
   EXPECT_TRUE(Empty.isEmptySet());
+  EXPECT_TRUE(Empty.inverse().isFullSet());
   EXPECT_FALSE(Empty.isWrappedSet());
   EXPECT_FALSE(Empty.contains(APInt(16, 0x0)));
   EXPECT_FALSE(Empty.contains(APInt(16, 0x9)));
@@ -57,6 +60,7 @@
   EXPECT_TRUE(One.contains(APInt(16, 0xa)));
   EXPECT_FALSE(One.contains(APInt(16, 0xaa9)));
   EXPECT_FALSE(One.contains(APInt(16, 0xaaa)));
+  EXPECT_FALSE(One.inverse().contains(APInt(16, 0xa)));
 
   EXPECT_FALSE(Some.isFullSet());
   EXPECT_FALSE(Some.isEmptySet());
@@ -143,6 +147,22 @@
             APInt(4, 7));
 }
 
+TEST_F(ConstantRangeTest, SignWrapped) {
+  EXPECT_TRUE(Full.isSignWrappedSet());
+  EXPECT_FALSE(Empty.isSignWrappedSet());
+  EXPECT_FALSE(One.isSignWrappedSet());
+  EXPECT_FALSE(Some.isSignWrappedSet());
+  EXPECT_TRUE(Wrap.isSignWrappedSet());
+
+  EXPECT_FALSE(ConstantRange(APInt(8, 127), APInt(8, 128)).isSignWrappedSet());
+  EXPECT_TRUE(ConstantRange(APInt(8, 127), APInt(8, 129)).isSignWrappedSet());
+  EXPECT_FALSE(ConstantRange(APInt(8, 128), APInt(8, 129)).isSignWrappedSet());
+  EXPECT_TRUE(ConstantRange(APInt(8, 10), APInt(8, 9)).isSignWrappedSet());
+  EXPECT_TRUE(ConstantRange(APInt(8, 10), APInt(8, 250)).isSignWrappedSet());
+  EXPECT_FALSE(ConstantRange(APInt(8, 250), APInt(8, 10)).isSignWrappedSet());
+  EXPECT_FALSE(ConstantRange(APInt(8, 250), APInt(8, 251)).isSignWrappedSet());
+}
+
 TEST_F(ConstantRangeTest, Trunc) {
   ConstantRange TFull = Full.truncate(10);
   ConstantRange TEmpty = Empty.truncate(10);
@@ -168,8 +188,7 @@
                                 APInt(One.getUpper()).zext(20)));
   EXPECT_EQ(ZSome, ConstantRange(APInt(Some.getLower()).zext(20),
                                  APInt(Some.getUpper()).zext(20)));
-  EXPECT_EQ(ZWrap, ConstantRange(APInt(Wrap.getLower()).zext(20),
-                                 APInt(Wrap.getUpper()).zext(20)));
+  EXPECT_EQ(ZWrap, ConstantRange(APInt(20, 0), APInt(20, 0x10000)));
 }
 
 TEST_F(ConstantRangeTest, SExt) {
@@ -185,8 +204,11 @@
                                 APInt(One.getUpper()).sext(20)));
   EXPECT_EQ(SSome, ConstantRange(APInt(Some.getLower()).sext(20),
                                  APInt(Some.getUpper()).sext(20)));
-  EXPECT_EQ(SWrap, ConstantRange(APInt(Wrap.getLower()).sext(20),
-                                 APInt(Wrap.getUpper()).sext(20)));
+  EXPECT_EQ(SWrap, ConstantRange(APInt(20, (uint64_t)INT16_MIN, true),
+                                 APInt(20, INT16_MAX + 1, true)));
+
+  EXPECT_EQ(ConstantRange(APInt(8, 120), APInt(8, 140)).signExtend(16),
+            ConstantRange(APInt(16, -128), APInt(16, 128)));
 }
 
 TEST_F(ConstantRangeTest, IntersectWith) {
@@ -256,11 +278,31 @@
   EXPECT_EQ(Empty.add(Wrap), Empty);
   EXPECT_EQ(Empty.add(APInt(16, 4)), Empty);
   EXPECT_EQ(Some.add(APInt(16, 4)),
-              ConstantRange(APInt(16, 0xe), APInt(16, 0xaae)));
+            ConstantRange(APInt(16, 0xe), APInt(16, 0xaae)));
   EXPECT_EQ(Wrap.add(APInt(16, 4)),
-              ConstantRange(APInt(16, 0xaae), APInt(16, 0xe)));
+            ConstantRange(APInt(16, 0xaae), APInt(16, 0xe)));
   EXPECT_EQ(One.add(APInt(16, 4)),
-              ConstantRange(APInt(16, 0xe)));
+            ConstantRange(APInt(16, 0xe)));
+}
+
+TEST_F(ConstantRangeTest, Sub) {
+  EXPECT_EQ(Full.sub(APInt(16, 4)), Full);
+  EXPECT_EQ(Full.sub(Full), Full);
+  EXPECT_EQ(Full.sub(Empty), Empty);
+  EXPECT_EQ(Full.sub(One), Full);
+  EXPECT_EQ(Full.sub(Some), Full);
+  EXPECT_EQ(Full.sub(Wrap), Full);
+  EXPECT_EQ(Empty.sub(Empty), Empty);
+  EXPECT_EQ(Empty.sub(One), Empty);
+  EXPECT_EQ(Empty.sub(Some), Empty);
+  EXPECT_EQ(Empty.sub(Wrap), Empty);
+  EXPECT_EQ(Empty.sub(APInt(16, 4)), Empty);
+  EXPECT_EQ(Some.sub(APInt(16, 4)),
+            ConstantRange(APInt(16, 0x6), APInt(16, 0xaa6)));
+  EXPECT_EQ(Wrap.sub(APInt(16, 4)),
+            ConstantRange(APInt(16, 0xaa6), APInt(16, 0x6)));
+  EXPECT_EQ(One.sub(APInt(16, 4)),
+            ConstantRange(APInt(16, 0x6)));
 }
 
 TEST_F(ConstantRangeTest, Multiply) {
@@ -348,4 +390,51 @@
   EXPECT_EQ(Wrap.udiv(Wrap), Full);
 }
 
+TEST_F(ConstantRangeTest, Shl) {
+  EXPECT_EQ(Full.shl(Full), Full);
+  EXPECT_EQ(Full.shl(Empty), Empty);
+  EXPECT_EQ(Full.shl(One), Full);    // TODO: [0, (-1 << 0xa) + 1)
+  EXPECT_EQ(Full.shl(Some), Full);   // TODO: [0, (-1 << 0xa) + 1)
+  EXPECT_EQ(Full.shl(Wrap), Full);
+  EXPECT_EQ(Empty.shl(Empty), Empty);
+  EXPECT_EQ(Empty.shl(One), Empty);
+  EXPECT_EQ(Empty.shl(Some), Empty);
+  EXPECT_EQ(Empty.shl(Wrap), Empty);
+  EXPECT_EQ(One.shl(One), ConstantRange(APInt(16, 0xa << 0xa),
+                                        APInt(16, (0xa << 0xa) + 1)));
+  EXPECT_EQ(One.shl(Some), Full);    // TODO: [0xa << 0xa, 0)
+  EXPECT_EQ(One.shl(Wrap), Full);    // TODO: [0xa, 0xa << 14 + 1)
+  EXPECT_EQ(Some.shl(Some), Full);   // TODO: [0xa << 0xa, 0xfc01)
+  EXPECT_EQ(Some.shl(Wrap), Full);   // TODO: [0xa, 0x7ff << 0x5 + 1)
+  EXPECT_EQ(Wrap.shl(Wrap), Full);
+}
+
+TEST_F(ConstantRangeTest, Lshr) {
+  EXPECT_EQ(Full.lshr(Full), Full);
+  EXPECT_EQ(Full.lshr(Empty), Empty);
+  EXPECT_EQ(Full.lshr(One), ConstantRange(APInt(16, 0),
+                                          APInt(16, (0xffff >> 0xa) + 1)));
+  EXPECT_EQ(Full.lshr(Some), ConstantRange(APInt(16, 0),
+                                           APInt(16, (0xffff >> 0xa) + 1)));
+  EXPECT_EQ(Full.lshr(Wrap), Full);
+  EXPECT_EQ(Empty.lshr(Empty), Empty);
+  EXPECT_EQ(Empty.lshr(One), Empty);
+  EXPECT_EQ(Empty.lshr(Some), Empty);
+  EXPECT_EQ(Empty.lshr(Wrap), Empty);
+  EXPECT_EQ(One.lshr(One), ConstantRange(APInt(16, 0)));
+  EXPECT_EQ(One.lshr(Some), ConstantRange(APInt(16, 0)));
+  EXPECT_EQ(One.lshr(Wrap), ConstantRange(APInt(16, 0), APInt(16, 0xb)));
+  EXPECT_EQ(Some.lshr(Some), ConstantRange(APInt(16, 0),
+                                           APInt(16, (0xaaa >> 0xa) + 1)));
+  EXPECT_EQ(Some.lshr(Wrap), ConstantRange(APInt(16, 0), APInt(16, 0xaaa)));
+  EXPECT_EQ(Wrap.lshr(Wrap), Full);
+}
+
+TEST(ConstantRange, MakeICmpRegion) {
+  // PR8250
+  ConstantRange SMax = ConstantRange(APInt::getSignedMaxValue(32));
+  EXPECT_TRUE(ConstantRange::makeICmpRegion(ICmpInst::ICMP_SGT,
+                                            SMax).isEmptySet());
+}
+
 }  // anonymous namespace

Modified: llvm/branches/wendling/eh/unittests/Support/System.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/unittests/Support/System.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/unittests/Support/System.cpp (original)
+++ llvm/branches/wendling/eh/unittests/Support/System.cpp Tue Oct 26 19:48:03 2010
@@ -11,6 +11,6 @@
 TEST_F(SystemTest, TimeValue) {
   sys::TimeValue now = sys::TimeValue::now();
   time_t now_t = time(NULL);
-  EXPECT_TRUE(abs(now_t - now.toEpochTime()) < 2);
+  EXPECT_TRUE(abs(static_cast<long>(now_t - now.toEpochTime())) < 2);
 }
 }

Modified: llvm/branches/wendling/eh/unittests/Support/ValueHandleTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/unittests/Support/ValueHandleTest.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/unittests/Support/ValueHandleTest.cpp (original)
+++ llvm/branches/wendling/eh/unittests/Support/ValueHandleTest.cpp Tue Oct 26 19:48:03 2010
@@ -35,7 +35,6 @@
 
 class ConcreteCallbackVH : public CallbackVH {
 public:
-  ConcreteCallbackVH() : CallbackVH() {}
   ConcreteCallbackVH(Value *V) : CallbackVH(V) {}
 };
 

Modified: llvm/branches/wendling/eh/unittests/VMCore/InstructionsTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/unittests/VMCore/InstructionsTest.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/unittests/VMCore/InstructionsTest.cpp (original)
+++ llvm/branches/wendling/eh/unittests/VMCore/InstructionsTest.cpp Tue Oct 26 19:48:03 2010
@@ -59,9 +59,9 @@
   EXPECT_EQ(b0->getNumOperands(), 1U);
 
   EXPECT_NE(b0->op_begin(), b0->op_end());
-  EXPECT_EQ(next(b0->op_begin()), b0->op_end());
+  EXPECT_EQ(llvm::next(b0->op_begin()), b0->op_end());
 
-  EXPECT_EQ(next(b0->op_begin()), b0->op_end());
+  EXPECT_EQ(llvm::next(b0->op_begin()), b0->op_end());
 
   const IntegerType* Int1 = IntegerType::get(C, 1);
   Constant* One = ConstantInt::get(Int1, 1, true);

Modified: llvm/branches/wendling/eh/unittests/VMCore/PassManagerTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/unittests/VMCore/PassManagerTest.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/unittests/VMCore/PassManagerTest.cpp (original)
+++ llvm/branches/wendling/eh/unittests/VMCore/PassManagerTest.cpp Tue Oct 26 19:48:03 2010
@@ -32,7 +32,15 @@
 #include "llvm/Assembly/PrintModulePass.h"
 #include "gtest/gtest.h"
 
+using namespace llvm;
+
 namespace llvm {
+  void initializeModuleNDMPass(PassRegistry&);
+  void initializeFPassPass(PassRegistry&);
+  void initializeCGPassPass(PassRegistry&);
+  void initializeLPassPass(PassRegistry&);
+  void initializeBPassPass(PassRegistry&);
+  
   namespace {
     // ND = no deps
     // NM = no modifications
@@ -40,7 +48,7 @@
     public:
       static char run;
       static char ID;
-      ModuleNDNM() : ModulePass(&ID) {}
+      ModuleNDNM() : ModulePass(ID) { }
       virtual bool runOnModule(Module &M) {
         run++;
         return false;
@@ -56,7 +64,7 @@
     public:
       static char run;
       static char ID;
-      ModuleNDM() : ModulePass(&ID) {}
+      ModuleNDM() : ModulePass(ID) {}
       virtual bool runOnModule(Module &M) {
         run++;
         return true;
@@ -64,13 +72,12 @@
     };
     char ModuleNDM::ID=0;
     char ModuleNDM::run=0;
-    RegisterPass<ModuleNDM> X("mndm","mndm",false,false);
 
     struct ModuleNDM2 : public ModulePass {
     public:
       static char run;
       static char ID;
-      ModuleNDM2() : ModulePass(&ID) {}
+      ModuleNDM2() : ModulePass(ID) {}
       virtual bool runOnModule(Module &M) {
         run++;
         return true;
@@ -83,7 +90,9 @@
     public:
       static char run;
       static char ID;
-      ModuleDNM() : ModulePass(&ID) {}
+      ModuleDNM() : ModulePass(ID) {
+        initializeModuleNDMPass(*PassRegistry::getPassRegistry());
+      }
       virtual bool runOnModule(Module &M) {
         EXPECT_TRUE(getAnalysisIfAvailable<TargetData>());
         run++;
@@ -119,7 +128,7 @@
         EXPECT_TRUE(finalized);
         EXPECT_EQ(run, runc);
       }
-      PassTestBase() : P(&ID), allocated(0) {
+      PassTestBase() : P(ID), allocated(0) {
         initialized = false;
         finalized = false;
         runc = 0;
@@ -154,13 +163,15 @@
 
     struct CGPass : public PassTest<CallGraph, CallGraphSCCPass> {
     public:
+      CGPass() {
+        initializeCGPassPass(*PassRegistry::getPassRegistry());
+      }
       virtual bool runOnSCC(CallGraphSCC &SCMM) {
         EXPECT_TRUE(getAnalysisIfAvailable<TargetData>());
         run();
         return false;
       }
     };
-    RegisterPass<CGPass> X1("cgp","cgp");
 
     struct FPass : public PassTest<Module, FunctionPass> {
     public:
@@ -171,7 +182,6 @@
         return false;
       }
     };
-    RegisterPass<FPass> X2("fp","fp");
 
     struct LPass : public PassTestBase<LoopPass> {
     private:
@@ -179,6 +189,7 @@
       static int fincount;
     public:
       LPass() {
+        initializeLPassPass(*PassRegistry::getPassRegistry());
         initcount = 0; fincount=0;
         EXPECT_FALSE(initialized);
       }
@@ -205,7 +216,6 @@
     };
     int LPass::initcount=0;
     int LPass::fincount=0;
-    RegisterPass<LPass> X3("lp","lp");
 
     struct BPass : public PassTestBase<BasicBlockPass> {
     private:
@@ -248,12 +258,13 @@
     };
     int BPass::inited=0;
     int BPass::fin=0;
-    RegisterPass<BPass> X4("bp","bp");
 
     struct OnTheFlyTest: public ModulePass {
     public:
       static char ID;
-      OnTheFlyTest() : ModulePass(&ID) {}
+      OnTheFlyTest() : ModulePass(ID) {
+        initializeFPassPass(*PassRegistry::getPassRegistry());
+      }
       virtual bool runOnModule(Module &M) {
         EXPECT_TRUE(getAnalysisIfAvailable<TargetData>());
         for (Module::iterator I=M.begin(),E=M.end(); I != E; ++I) {
@@ -525,3 +536,13 @@
 
   }
 }
+
+INITIALIZE_PASS(ModuleNDM, "mndm", "mndm", false, false)
+INITIALIZE_PASS_BEGIN(CGPass, "cgp","cgp", false, false)
+INITIALIZE_AG_DEPENDENCY(CallGraph)
+INITIALIZE_PASS_END(CGPass, "cgp","cgp", false, false)
+INITIALIZE_PASS(FPass, "fp","fp", false, false)
+INITIALIZE_PASS_BEGIN(LPass, "lp","lp", false, false)
+INITIALIZE_PASS_DEPENDENCY(LoopInfo)
+INITIALIZE_PASS_END(LPass, "lp","lp", false, false)
+INITIALIZE_PASS(BPass, "bp","bp", false, false)

Modified: llvm/branches/wendling/eh/utils/FileCheck/FileCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/FileCheck/FileCheck.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/FileCheck/FileCheck.cpp (original)
+++ llvm/branches/wendling/eh/utils/FileCheck/FileCheck.cpp Tue Oct 26 19:48:03 2010
@@ -49,32 +49,36 @@
 
 class Pattern {
   SMLoc PatternLoc;
-  
+
+  /// MatchEOF - When set, this pattern only matches the end of file. This is
+  /// used for trailing CHECK-NOTs.
+  bool MatchEOF;
+
   /// FixedStr - If non-empty, this pattern is a fixed string match with the
   /// specified fixed string.
   StringRef FixedStr;
-  
+
   /// RegEx - If non-empty, this is a regex pattern.
   std::string RegExStr;
-  
+
   /// VariableUses - Entries in this vector map to uses of a variable in the
   /// pattern, e.g. "foo[[bar]]baz".  In this case, the RegExStr will contain
   /// "foobaz" and we'll get an entry in this vector that tells us to insert the
   /// value of bar at offset 3.
   std::vector<std::pair<StringRef, unsigned> > VariableUses;
-  
+
   /// VariableDefs - Entries in this vector map to definitions of a variable in
   /// the pattern, e.g. "foo[[bar:.*]]baz".  In this case, the RegExStr will
   /// contain "foo(.*)baz" and VariableDefs will contain the pair "bar",1.  The
   /// index indicates what parenthesized value captures the variable value.
   std::vector<std::pair<StringRef, unsigned> > VariableDefs;
-  
+
 public:
-  
-  Pattern() { }
-  
+
+  Pattern(bool matchEOF = false) : MatchEOF(matchEOF) { }
+
   bool ParsePattern(StringRef PatternStr, SourceMgr &SM);
-  
+
   /// Match - Match the pattern string against the input buffer Buffer.  This
   /// returns the position that is matched or npos if there is no match.  If
   /// there is a match, the size of the matched string is returned in MatchLen.
@@ -103,19 +107,19 @@
 
 bool Pattern::ParsePattern(StringRef PatternStr, SourceMgr &SM) {
   PatternLoc = SMLoc::getFromPointer(PatternStr.data());
-  
+
   // Ignore trailing whitespace.
   while (!PatternStr.empty() &&
          (PatternStr.back() == ' ' || PatternStr.back() == '\t'))
     PatternStr = PatternStr.substr(0, PatternStr.size()-1);
-  
+
   // Check that there is something on the line.
   if (PatternStr.empty()) {
     SM.PrintMessage(PatternLoc, "found empty check string with prefix '" +
                     CheckPrefix+":'", "error");
     return true;
   }
-  
+
   // Check to see if this is a fixed string, or if it has regex pieces.
   if (PatternStr.size() < 2 ||
       (PatternStr.find("{{") == StringRef::npos &&
@@ -123,18 +127,18 @@
     FixedStr = PatternStr;
     return false;
   }
-  
+
   // Paren value #0 is for the fully matched string.  Any new parenthesized
   // values add from their.
   unsigned CurParen = 1;
-  
+
   // Otherwise, there is at least one regex piece.  Build up the regex pattern
   // by escaping scary characters in fixed strings, building up one big regex.
   while (!PatternStr.empty()) {
     // RegEx matches.
     if (PatternStr.size() >= 2 &&
         PatternStr[0] == '{' && PatternStr[1] == '{') {
-     
+
       // Otherwise, this is the start of a regex match.  Scan for the }}.
       size_t End = PatternStr.find("}}");
       if (End == StringRef::npos) {
@@ -142,13 +146,13 @@
                         "found start of regex string with no end '}}'", "error");
         return true;
       }
-      
+
       if (AddRegExToRegEx(PatternStr.substr(2, End-2), CurParen, SM))
         return true;
       PatternStr = PatternStr.substr(End+2);
       continue;
     }
-    
+
     // Named RegEx matches.  These are of two forms: [[foo:.*]] which matches .*
     // (or some other regex) and assigns it to the FileCheck variable 'foo'. The
     // second form is [[foo]] which is a reference to foo.  The variable name
@@ -163,14 +167,14 @@
                         "invalid named regex reference, no ]] found", "error");
         return true;
       }
-      
+
       StringRef MatchStr = PatternStr.substr(2, End-2);
       PatternStr = PatternStr.substr(End+2);
-      
+
       // Get the regex name (e.g. "foo").
       size_t NameEnd = MatchStr.find(':');
       StringRef Name = MatchStr.substr(0, NameEnd);
-      
+
       if (Name.empty()) {
         SM.PrintMessage(SMLoc::getFromPointer(Name.data()),
                         "invalid name in named regex: empty name", "error");
@@ -187,31 +191,31 @@
                           "invalid name in named regex", "error");
           return true;
         }
-      
+
       // Name can't start with a digit.
       if (isdigit(Name[0])) {
         SM.PrintMessage(SMLoc::getFromPointer(Name.data()),
                         "invalid name in named regex", "error");
         return true;
       }
-      
+
       // Handle [[foo]].
       if (NameEnd == StringRef::npos) {
         VariableUses.push_back(std::make_pair(Name, RegExStr.size()));
         continue;
       }
-      
+
       // Handle [[foo:.*]].
       VariableDefs.push_back(std::make_pair(Name, CurParen));
       RegExStr += '(';
       ++CurParen;
-      
+
       if (AddRegExToRegEx(MatchStr.substr(NameEnd+1), CurParen, SM))
         return true;
 
       RegExStr += ')';
     }
-    
+
     // Handle fixed string matches.
     // Find the end, which is the start of the next regex.
     size_t FixedMatchEnd = PatternStr.find("{{");
@@ -260,7 +264,7 @@
                     "invalid regex: " + Error, "error");
     return true;
   }
-  
+
   RegExStr += RegexStr.str();
   CurParen += R.getNumMatches();
   return false;
@@ -271,6 +275,12 @@
 /// there is a match, the size of the matched string is returned in MatchLen.
 size_t Pattern::Match(StringRef Buffer, size_t &MatchLen,
                       StringMap<StringRef> &VariableTable) const {
+  // If this is the EOF pattern, match it immediately.
+  if (MatchEOF) {
+    MatchLen = 0;
+    return Buffer.size();
+  }
+
   // If this is a fixed string pattern, just match it now.
   if (!FixedStr.empty()) {
     MatchLen = FixedStr.size();
@@ -278,14 +288,14 @@
   }
 
   // Regex match.
-  
+
   // If there are variable uses, we need to create a temporary string with the
   // actual value.
   StringRef RegExToMatch = RegExStr;
   std::string TmpStr;
   if (!VariableUses.empty()) {
     TmpStr = RegExStr;
-    
+
     unsigned InsertOffset = 0;
     for (unsigned i = 0, e = VariableUses.size(); i != e; ++i) {
       StringMap<StringRef>::iterator it =
@@ -297,33 +307,33 @@
       // Look up the value and escape it so that we can plop it into the regex.
       std::string Value;
       AddFixedStringToRegEx(it->second, Value);
-      
+
       // Plop it into the regex at the adjusted offset.
       TmpStr.insert(TmpStr.begin()+VariableUses[i].second+InsertOffset,
                     Value.begin(), Value.end());
       InsertOffset += Value.size();
     }
-    
+
     // Match the newly constructed regex.
     RegExToMatch = TmpStr;
   }
-  
-  
+
+
   SmallVector<StringRef, 4> MatchInfo;
   if (!Regex(RegExToMatch, Regex::Newline).match(Buffer, &MatchInfo))
     return StringRef::npos;
-  
+
   // Successful regex match.
   assert(!MatchInfo.empty() && "Didn't get any match");
   StringRef FullMatch = MatchInfo[0];
-  
+
   // If this defines any variables, remember their values.
   for (unsigned i = 0, e = VariableDefs.size(); i != e; ++i) {
     assert(VariableDefs[i].second < MatchInfo.size() &&
            "Internal paren error");
     VariableTable[VariableDefs[i].first] = MatchInfo[VariableDefs[i].second];
   }
-  
+
   MatchLen = FullMatch.size();
   return FullMatch.data()-Buffer.data();
 }
@@ -421,19 +431,19 @@
 struct CheckString {
   /// Pat - The pattern to match.
   Pattern Pat;
-  
+
   /// Loc - The location in the match file that the check string was specified.
   SMLoc Loc;
-  
+
   /// IsCheckNext - This is true if this is a CHECK-NEXT: directive (as opposed
   /// to a CHECK: directive.
   bool IsCheckNext;
-  
+
   /// NotStrings - These are all of the strings that are disallowed from
   /// occurring between this match string and the previous one (or start of
   /// file).
   std::vector<std::pair<SMLoc, Pattern> > NotStrings;
-  
+
   CheckString(const Pattern &P, SMLoc L, bool isCheckNext)
     : Pat(P), Loc(L), IsCheckNext(isCheckNext) {}
 };
@@ -443,7 +453,7 @@
 static MemoryBuffer *CanonicalizeInputFile(MemoryBuffer *MB) {
   SmallString<128> NewFile;
   NewFile.reserve(MB->getBufferSize());
-  
+
   for (const char *Ptr = MB->getBufferStart(), *End = MB->getBufferEnd();
        Ptr != End; ++Ptr) {
     // If C is not a horizontal whitespace, skip it.
@@ -451,18 +461,18 @@
       NewFile.push_back(*Ptr);
       continue;
     }
-    
+
     // Otherwise, add one space and advance over neighboring space.
     NewFile.push_back(' ');
     while (Ptr+1 != End &&
            (Ptr[1] == ' ' || Ptr[1] == '\t'))
       ++Ptr;
   }
-  
+
   // Free the old buffer and return a new one.
   MemoryBuffer *MB2 =
     MemoryBuffer::getMemBufferCopy(NewFile.str(), MB->getBufferIdentifier());
-  
+
   delete MB;
   return MB2;
 }
@@ -477,37 +487,37 @@
   MemoryBuffer *F =
     MemoryBuffer::getFileOrSTDIN(CheckFilename.c_str(), &ErrorStr);
   if (F == 0) {
-    errs() << "Could not open check file '" << CheckFilename << "': " 
+    errs() << "Could not open check file '" << CheckFilename << "': "
            << ErrorStr << '\n';
     return true;
   }
-  
+
   // If we want to canonicalize whitespace, strip excess whitespace from the
   // buffer containing the CHECK lines.
   if (!NoCanonicalizeWhiteSpace)
     F = CanonicalizeInputFile(F);
-  
+
   SM.AddNewSourceBuffer(F, SMLoc());
 
   // Find all instances of CheckPrefix followed by : in the file.
   StringRef Buffer = F->getBuffer();
 
   std::vector<std::pair<SMLoc, Pattern> > NotMatches;
-  
+
   while (1) {
     // See if Prefix occurs in the memory buffer.
     Buffer = Buffer.substr(Buffer.find(CheckPrefix));
-    
+
     // If we didn't find a match, we're done.
     if (Buffer.empty())
       break;
-    
+
     const char *CheckPrefixStart = Buffer.data();
-    
+
     // When we find a check prefix, keep track of whether we find CHECK: or
     // CHECK-NEXT:
     bool IsCheckNext = false, IsCheckNot = false;
-    
+
     // Verify that the : is present after the prefix.
     if (Buffer[CheckPrefix.size()] == ':') {
       Buffer = Buffer.substr(CheckPrefix.size()+1);
@@ -523,11 +533,11 @@
       Buffer = Buffer.substr(1);
       continue;
     }
-    
+
     // Okay, we found the prefix, yay.  Remember the rest of the line, but
     // ignore leading and trailing whitespace.
     Buffer = Buffer.substr(Buffer.find_first_not_of(" \t"));
-    
+
     // Scan ahead to the end of line.
     size_t EOL = Buffer.find_first_of("\n\r");
 
@@ -538,10 +548,10 @@
     Pattern P;
     if (P.ParsePattern(Buffer.substr(0, EOL), SM))
       return true;
-    
+
     Buffer = Buffer.substr(EOL);
 
-    
+
     // Verify that CHECK-NEXT lines have at least one CHECK line before them.
     if (IsCheckNext && CheckStrings.empty()) {
       SM.PrintMessage(SMLoc::getFromPointer(CheckPrefixStart),
@@ -549,34 +559,36 @@
                       CheckPrefix+ ": line", "error");
       return true;
     }
-    
+
     // Handle CHECK-NOT.
     if (IsCheckNot) {
       NotMatches.push_back(std::make_pair(SMLoc::getFromPointer(Buffer.data()),
                                           P));
       continue;
     }
-    
-    
+
+
     // Okay, add the string we captured to the output vector and move on.
     CheckStrings.push_back(CheckString(P,
                                        PatternLoc,
                                        IsCheckNext));
     std::swap(NotMatches, CheckStrings.back().NotStrings);
   }
-  
+
+  // Add an EOF pattern for any trailing CHECK-NOTs.
+  if (!NotMatches.empty()) {
+    CheckStrings.push_back(CheckString(Pattern(true),
+                                       SMLoc::getFromPointer(Buffer.data()),
+                                       false));
+    std::swap(NotMatches, CheckStrings.back().NotStrings);
+  }
+
   if (CheckStrings.empty()) {
     errs() << "error: no check strings found with prefix '" << CheckPrefix
            << ":'\n";
     return true;
   }
-  
-  if (!NotMatches.empty()) {
-    errs() << "error: '" << CheckPrefix
-           << "-NOT:' not supported after last check line.\n";
-    return true;
-  }
-  
+
   return false;
 }
 
@@ -586,11 +598,11 @@
   // Otherwise, we have an error, emit an error message.
   SM.PrintMessage(CheckStr.Loc, "expected string not found in input",
                   "error");
-  
+
   // Print the "scanning from here" line.  If the current position is at the
   // end of a line, advance to the start of the next line.
   Buffer = Buffer.substr(Buffer.find_first_not_of(" \t\n\r"));
-  
+
   SM.PrintMessage(SMLoc::getFromPointer(Buffer.data()), "scanning from here",
                   "note");
 
@@ -606,9 +618,9 @@
     // Scan for newline.
     Range = Range.substr(Range.find_first_of("\n\r"));
     if (Range.empty()) return NumNewLines;
-    
+
     ++NumNewLines;
-    
+
     // Handle \n\r and \r\n as a single newline.
     if (Range.size() > 1 &&
         (Range[1] == '\n' || Range[1] == '\r') &&
@@ -624,7 +636,7 @@
   cl::ParseCommandLineOptions(argc, argv);
 
   SourceMgr SM;
-  
+
   // Read the expected strings from the check file.
   std::vector<CheckString> CheckStrings;
   if (ReadCheckFile(SM, CheckStrings))
@@ -635,37 +647,38 @@
   MemoryBuffer *F =
     MemoryBuffer::getFileOrSTDIN(InputFilename.c_str(), &ErrorStr);
   if (F == 0) {
-    errs() << "Could not open input file '" << InputFilename << "': " 
+    errs() << "Could not open input file '" << InputFilename << "': "
            << ErrorStr << '\n';
     return true;
   }
-  
+
   // Remove duplicate spaces in the input file if requested.
   if (!NoCanonicalizeWhiteSpace)
     F = CanonicalizeInputFile(F);
-  
+
   SM.AddNewSourceBuffer(F, SMLoc());
-  
+
   /// VariableTable - This holds all the current filecheck variables.
   StringMap<StringRef> VariableTable;
-  
+
   // Check that we have all of the expected strings, in order, in the input
   // file.
   StringRef Buffer = F->getBuffer();
-  
+
   const char *LastMatch = Buffer.data();
-  
+
   for (unsigned StrNo = 0, e = CheckStrings.size(); StrNo != e; ++StrNo) {
     const CheckString &CheckStr = CheckStrings[StrNo];
-    
+
     StringRef SearchFrom = Buffer;
-    
+
     // Find StrNo in the file.
     size_t MatchLen = 0;
-    Buffer = Buffer.substr(CheckStr.Pat.Match(Buffer, MatchLen, VariableTable));
-    
+    size_t MatchPos = CheckStr.Pat.Match(Buffer, MatchLen, VariableTable);
+    Buffer = Buffer.substr(MatchPos);
+
     // If we didn't find a match, reject the input.
-    if (Buffer.empty()) {
+    if (MatchPos == StringRef::npos) {
       PrintCheckFailed(SM, CheckStr, SearchFrom, VariableTable);
       return 1;
     }
@@ -690,7 +703,7 @@
                         "previous match was here", "note");
         return 1;
       }
-      
+
       if (NumNewLines != 1) {
         SM.PrintMessage(CheckStr.Loc,
                         CheckPrefix+
@@ -703,7 +716,7 @@
         return 1;
       }
     }
-    
+
     // If this match had "not strings", verify that they don't exist in the
     // skipped region.
     for (unsigned ChunkNo = 0, e = CheckStr.NotStrings.size();
@@ -713,20 +726,20 @@
                                                              MatchLen,
                                                              VariableTable);
       if (Pos == StringRef::npos) continue;
-     
+
       SM.PrintMessage(SMLoc::getFromPointer(LastMatch+Pos),
                       CheckPrefix+"-NOT: string occurred!", "error");
       SM.PrintMessage(CheckStr.NotStrings[ChunkNo].first,
                       CheckPrefix+"-NOT: pattern specified here", "note");
       return 1;
     }
-    
+
 
     // Otherwise, everything is good.  Step over the matched text and remember
     // the position after the match as the end of the last match.
     Buffer = Buffer.substr(MatchLen);
     LastMatch = Buffer.data();
   }
-  
+
   return 0;
 }

Modified: llvm/branches/wendling/eh/utils/FileUpdate/FileUpdate.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/FileUpdate/FileUpdate.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/FileUpdate/FileUpdate.cpp (original)
+++ llvm/branches/wendling/eh/utils/FileUpdate/FileUpdate.cpp Tue Oct 26 19:48:03 2010
@@ -16,7 +16,7 @@
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/PrettyStackTrace.h"
-#include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/ToolOutputFile.h"
 #include "llvm/System/Signals.h"
 using namespace llvm;
 
@@ -36,6 +36,11 @@
   PrettyStackTraceProgram X(argc, argv);
   cl::ParseCommandLineOptions(argc, argv);
 
+  if (OutputFilename == "-") {
+    errs() << argv[0] << ": error: Can't update standard output\n";
+    return 1;
+  }
+
   // Get the input data.
   std::string ErrorStr;
   MemoryBuffer *In =
@@ -54,7 +59,7 @@
       memcmp(In->getBufferStart(), Out->getBufferStart(),
              Out->getBufferSize()) == 0) {
     if (!Quiet)
-      outs() << argv[0] << ": Not updating '" << OutputFilename
+      errs() << argv[0] << ": Not updating '" << OutputFilename
              << "', contents match input.\n";
     return 0;
   }
@@ -63,25 +68,20 @@
 
   // Otherwise, overwrite the output.
   if (!Quiet)
-    outs() << argv[0] << ": Updating '" << OutputFilename
+    errs() << argv[0] << ": Updating '" << OutputFilename
            << "', contents changed.\n";
-  raw_fd_ostream OutStream(OutputFilename.c_str(), ErrorStr,
-                           raw_fd_ostream::F_Binary);
+  tool_output_file OutStream(OutputFilename.c_str(), ErrorStr,
+                             raw_fd_ostream::F_Binary);
   if (!ErrorStr.empty()) {
     errs() << argv[0] << ": Unable to write output '"
            << OutputFilename << "': " << ErrorStr << '\n';
     return 1;
   }
 
-  OutStream.write(In->getBufferStart(), In->getBufferSize());
-  OutStream.close();
+  OutStream.os().write(In->getBufferStart(), In->getBufferSize());
 
-  if (OutStream.has_error()) {
-    errs() << argv[0] << ": Could not open output file '"
-           << OutputFilename << "': " << ErrorStr << '\n';
-    OutStream.clear_error();
-    return 1;
-  }
+  // Declare success.
+  OutStream.keep();
 
   return 0;
 }

Modified: llvm/branches/wendling/eh/utils/GenLibDeps.pl
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/GenLibDeps.pl?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/GenLibDeps.pl (original)
+++ llvm/branches/wendling/eh/utils/GenLibDeps.pl Tue Oct 26 19:48:03 2010
@@ -107,7 +107,6 @@
     $libpath =~ s/^TransformUtils/Transforms\/Utils/;
     $libpath =~ s/^ipa/Analysis\/IPA/;
     $libpath =~ s/^ipo/Transforms\/IPO/;
-    $libpath =~ s/^pic16passes/Target\/PIC16\/PIC16Passes/;
     $libpath = "lib/".$libpath."/";
     open DEFS, "$nmPath -sg $Directory/$lib|";
     while (<DEFS>) {
@@ -150,7 +149,6 @@
     $libpath =~ s/^TransformUtils/Transforms\/Utils/;
     $libpath =~ s/^ipa/Analysis\/IPA/;
     $libpath =~ s/^ipo/Transforms\/IPO/;
-    $libpath =~ s/^pic16passes/Target\/PIC16\/PIC16Passes/;
     $libpath = "lib/".$libpath."/";
     open UDEFS, "$nmPath -Aup $Directory/$lib|";
     while (<UDEFS>) {

Modified: llvm/branches/wendling/eh/utils/GetSourceVersion
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/GetSourceVersion?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/GetSourceVersion (original)
+++ llvm/branches/wendling/eh/utils/GetSourceVersion Tue Oct 26 19:48:03 2010
@@ -1,12 +1,12 @@
 #!/bin/sh
 
 usage() {
-   echo "usage: $0 <source root>"
-   echo "  Prints the source control revision of the given source directory,"
-   echo "  the exact format of the revision string depends on the source "
-   echo "  control system. If the source control system isn't known, the output"
-   echo "  is empty and the exit code is 1."
-   exit 1
+  echo "usage: $0 <source root>"
+  echo "  Prints the source control revision of the given source directory,"
+  echo "  the exact format of the revision string depends on the source "
+  echo "  control system. If the source control system isn't known, the output"
+  echo "  is empty and the exit code is 1."
+  exit 1
 }
 
 if [ $# != 1 ] || [ ! -d $1 ]; then
@@ -15,13 +15,13 @@
 
 cd $1
 if [ -d .svn ]; then
-   svnversion
+  svnversion | sed -e "s#\([0-9]*\)[A-Z]*#\1#"
 elif [ -d .git/svn ]; then
-   git svn info | grep 'Revision:' | cut -d: -f2-
+  git svn info | grep 'Revision:' | cut -d: -f2-
 elif [ -d .git ]; then
-   git log -1 --pretty=format:%H
+  git log -1 --pretty=format:%H
 else
-   exit 1;
+  exit 1;
 fi
 
 exit 0

Modified: llvm/branches/wendling/eh/utils/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/Makefile?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/Makefile (original)
+++ llvm/branches/wendling/eh/utils/Makefile Tue Oct 26 19:48:03 2010
@@ -8,14 +8,15 @@
 ##===----------------------------------------------------------------------===##
 
 LEVEL = ..
-PARALLEL_DIRS := TableGen fpcmp PerfectShuffle FileCheck FileUpdate count not unittest
+PARALLEL_DIRS := FileCheck FileUpdate TableGen PerfectShuffle \
+	      count fpcmp llvm-lit not unittest
 
-EXTRA_DIST := cgiplotNLT.pl check-each-file codegen-diff countloc.sh cvsupdate \
+EXTRA_DIST := cgiplotNLT.pl check-each-file codegen-diff countloc.sh \
               DSAclean.py DSAextract.py emacs findsym.pl GenLibDeps.pl \
 	      getsrcs.sh importNLT.pl llvmdo llvmgrep llvm-native-gcc \
 	      llvm-native-gxx makellvm NightlyTest.gnuplot NightlyTest.pl \
-	      NightlyTestTemplate.html NLT.schema OldenDataRecover.pl \
-	      parseNLT.pl plotNLT.pl profile.pl RegressionFinder.pl userloc.pl \
+	      NightlyTestTemplate.html NLT.schema \
+	      parseNLT.pl plotNLT.pl profile.pl \
 	      webNLT.pl vim
 
 include $(LEVEL)/Makefile.common

Removed: llvm/branches/wendling/eh/utils/OldenDataRecover.pl
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/OldenDataRecover.pl?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/utils/OldenDataRecover.pl (original)
+++ llvm/branches/wendling/eh/utils/OldenDataRecover.pl (removed)
@@ -1,37 +0,0 @@
-#this script is intended to help recover the running graphs when
-#the nightly tester decides to eat them.
-
-#zgrep -E "(=========)|(TEST-RESULT-llc-time)" *-Olden-tests.txt* |perl this > file
-#zgrep -E "(=========)|(TEST-RESULT-compile.*bc)" *-Olden-tests.tx* |perl this >file
-
-while (<>) {
-  if (/(\d*-\d*-\d*)-.*=========.*\/(.*)\' Program/) {
-#    print "$1 $2\n";
-    $curP = $2;
-    $curD = $1;
-    $dates{$1} = 1;
-  } elsif (/(\d*-\d*-\d*)-.*TEST-RESULT-.*: program (\d*\.\d*)/) {
-#    print "$1 $2\n";
-    if ($curD eq $1) {
-      $$data{$curD}{$curP} = $2;
-    }
-  } elsif (/(\d*-\d*-\d*)-.*TEST-RESULT-.*: (\d*)/) {
-#    print "$1 $2\n";
-    if ($curD eq $1) {
-      $$data{$curD}{$curP} = $2;
-    }
-  }
-}
- at progs = ("bh", "em3d", "mst", "power", "tsp", "bisort", "health", "perimeter", "treeadd", "voronoi");
-
-foreach $date (sort keys %dates) {
-  print "$date: ";
-  foreach $prog (@progs) {
-    if ($$data{$date}{$prog}) {
-      print " $$data{$date}{$prog}";
-    } else {
-      print " 0";
-    }
-  }
-  print "\n";
-}

Modified: llvm/branches/wendling/eh/utils/PerfectShuffle/PerfectShuffle.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/PerfectShuffle/PerfectShuffle.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/PerfectShuffle/PerfectShuffle.cpp (original)
+++ llvm/branches/wendling/eh/utils/PerfectShuffle/PerfectShuffle.cpp Tue Oct 26 19:48:03 2010
@@ -15,6 +15,7 @@
 //===----------------------------------------------------------------------===//
 
 #include <iostream>
+#include <iomanip>
 #include <vector>
 #include <cassert>
 #include <cstdlib>
@@ -400,7 +401,7 @@
     // LHS, and 13 bits of RHS = 32 bits.
     unsigned Val = (CostSat << 30) | (OpNum << 26) | (LHS << 13) | RHS;
 
-    std::cout << "  " << Val << "U,\t// ";
+    std::cout << "  " << std::setw(10) << Val << "U, // ";
     PrintMask(i, std::cout);
     std::cout << ": Cost " << ShufTab[i].Cost;
     std::cout << " " << (ShufTab[i].Op ? ShufTab[i].Op->getName() : "copy");

Removed: llvm/branches/wendling/eh/utils/RegressionFinder.pl
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/RegressionFinder.pl?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/utils/RegressionFinder.pl (original)
+++ llvm/branches/wendling/eh/utils/RegressionFinder.pl (removed)
@@ -1,186 +0,0 @@
-#! /usr/bin/perl
-# Script to find regressions by binary-searching a time interval in the
-# CVS tree.  Written by Brian Gaeke on 2-Mar-2004.
-#
-
-require 5.6.0;  # NOTE: This script not tested with earlier versions.
-use Getopt::Std;
-use POSIX;
-use Time::Local;
-use IO::Handle;
-
-sub usage {
-    print STDERR <<END;
-findRegression [-I] -w WTIME -d DTIME -t TOOLS -c SCRIPT
-
-The -w, -d, -t, and -c options are required.
-Run findRegression in the top level of an LLVM tree.
-WTIME is a time when you are sure the regression does NOT exist ("Works").
-DTIME is a time when you are sure the regression DOES exist ("Doesntwork").
-WTIME and DTIME are both in the format: "YYYY/MM/DD HH:MM".
--I means run builds at WTIME and DTIME first to make sure.
-TOOLS is a comma separated list of tools to rebuild before running SCRIPT.
-SCRIPT exits 1 if the regression is present in TOOLS; 0 otherwise.
-END
-    exit 1;
-}
-
-sub timeAsSeconds {
-    my ($timestr) = @_;
-
-    if ( $timestr =~ /(\d\d\d\d)\/(\d\d)\/(\d\d) (\d\d):(\d\d)/ ) {
-        my ( $year, $mon, $mday, $hour, $min ) = ( $1, $2, $3, $4, $5 );
-        return timegm( 0, $min, $hour, $mday, $mon - 1, $year );
-    }
-    else {
-        die "** Can't parse date + time: $timestr\n";
-    }
-}
-
-sub timeAsString {
-    my ($secs) = @_;
-    return strftime( "%Y/%m/%d %H:%M", gmtime($secs) );
-}
-
-sub run {
-    my ($cmdline) = @_;
-    print LOG "** Running: $cmdline\n";
-	return system($cmdline);
-}
-
-sub buildLibrariesAndTools {
-    run("sh /home/vadve/gaeke/scripts/run-configure");
-    run("$MAKE -C lib/Support");
-    run("$MAKE -C utils");
-    run("$MAKE -C lib");
-    foreach my $tool (@TOOLS) { run("$MAKE -C tools/$tool"); }
-}
-
-sub contains {
-    my ( $file, $regex ) = @_;
-    local (*FILE);
-    open( FILE, "<$file" ) or die "** can't read $file: $!\n";
-    while (<FILE>) {
-        if (/$regex/) {
-            close FILE;
-            return 1;
-        }
-    }
-    close FILE;
-    return 0;
-}
-
-sub updateSources {
-    my ($time) = @_;
-    my $inst = "include/llvm/Instruction.h";
-    unlink($inst);
-    run( "cvs update -D'" . timeAsString($time) . "'" );
-    if ( !contains( $inst, 'class Instruction.*Annotable' ) ) {
-        run("patch -F100 -p0 < makeInstructionAnnotable.patch");
-    }
-}
-
-sub regressionPresentAt {
-    my ($time) = @_;
-
-    updateSources($time);
-    buildLibrariesAndTools();
-    my $rc = run($SCRIPT);
-    if ($rc) {
-        print LOG "** Found that regression was PRESENT at "
-          . timeAsString($time) . "\n";
-        return 1;
-    }
-    else {
-        print LOG "** Found that regression was ABSENT at "
-          . timeAsString($time) . "\n";
-        return 0;
-    }
-}
-
-sub regressionAbsentAt {
-    my ($time) = @_;
-    return !regressionPresentAt($time);
-}
-
-sub closeTo {
-    my ( $time1, $time2 ) = @_;
-    return abs( $time1 - $time2 ) < 600;    # 10 minutes seems reasonable.
-}
-
-sub halfWayPoint {
-    my ( $time1, $time2 ) = @_;
-    my $halfSpan = int( abs( $time1 - $time2 ) / 2 );
-    if ( $time1 < $time2 ) {
-        return $time1 + $halfSpan;
-    }
-    else {
-        return $time2 + $halfSpan;
-    }
-}
-
-sub checkBoundaryConditions {
-    print LOG "** Checking for presence of regression at ", timeAsString($DTIME),
-      "\n";
-    if ( !regressionPresentAt($DTIME) ) {
-        die ( "** Can't help you; $SCRIPT says regression absent at dtime: "
-              . timeAsString($DTIME)
-              . "\n" );
-    }
-    print LOG "** Checking for absence of regression at ", timeAsString($WTIME),
-      "\n";
-    if ( !regressionAbsentAt($WTIME) ) {
-        die ( "** Can't help you; $SCRIPT says regression present at wtime: "
-              . timeAsString($WTIME)
-              . "\n" );
-    }
-}
-
-##############################################################################
-
-# Set up log files
-open (STDERR, ">&STDOUT") || die "** Can't redirect std.err: $!\n";
-autoflush STDOUT 1;
-autoflush STDERR 1;
-open (LOG, ">RegFinder.log") || die "** can't write RegFinder.log: $!\n";
-autoflush LOG 1;
-# Check command line arguments and environment variables
-getopts('Iw:d:t:c:');
-if ( !( $opt_w && $opt_d && $opt_t && $opt_c ) ) {
-    usage;
-}
-$MAKE  = $ENV{'MAKE'};
-$MAKE  = 'gmake' unless $MAKE;
-$WTIME = timeAsSeconds($opt_w);
-print LOG "** Assuming worked at ", timeAsString($WTIME), "\n";
-$DTIME = timeAsSeconds($opt_d);
-print LOG "** Assuming didn't work at ", timeAsString($DTIME), "\n";
-$opt_t =~ s/\s*//g;
-$SCRIPT = $opt_c;
-die "** $SCRIPT is not executable or not found\n" unless -x $SCRIPT;
-print LOG "** Checking for the regression using $SCRIPT\n";
- at TOOLS = split ( /,/, $opt_t );
-print LOG (
-    "** Going to rebuild: ",
-    ( join ", ", @TOOLS ),
-    " before each $SCRIPT run\n"
-);
-if ($opt_I) { checkBoundaryConditions(); }
-# do the dirty work:
-while ( !closeTo( $DTIME, $WTIME ) ) {
-    my $halfPt = halfWayPoint( $DTIME, $WTIME );
-    print LOG "** Checking whether regression is present at ",
-      timeAsString($halfPt), "\n";
-    if ( regressionPresentAt($halfPt) ) {
-        $DTIME = $halfPt;
-    }
-    else {
-        $WTIME = $halfPt;
-    }
-}
-# Tell them what we found
-print LOG "** Narrowed it down to:\n";
-print LOG "** Worked at: ",       timeAsString($WTIME), "\n";
-print LOG "** Did not work at: ", timeAsString($DTIME), "\n";
-close LOG;
-exit 0;

Modified: llvm/branches/wendling/eh/utils/TableGen/ARMDecoderEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/TableGen/ARMDecoderEmitter.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/TableGen/ARMDecoderEmitter.cpp (original)
+++ llvm/branches/wendling/eh/utils/TableGen/ARMDecoderEmitter.cpp Tue Oct 26 19:48:03 2010
@@ -49,36 +49,35 @@
   ENTRY(ARM_FORMAT_LDSTMULFRM,    10) \
   ENTRY(ARM_FORMAT_LDSTEXFRM,     11) \
   ENTRY(ARM_FORMAT_ARITHMISCFRM,  12) \
-  ENTRY(ARM_FORMAT_EXTFRM,        13) \
-  ENTRY(ARM_FORMAT_VFPUNARYFRM,   14) \
-  ENTRY(ARM_FORMAT_VFPBINARYFRM,  15) \
-  ENTRY(ARM_FORMAT_VFPCONV1FRM,   16) \
-  ENTRY(ARM_FORMAT_VFPCONV2FRM,   17) \
-  ENTRY(ARM_FORMAT_VFPCONV3FRM,   18) \
-  ENTRY(ARM_FORMAT_VFPCONV4FRM,   19) \
-  ENTRY(ARM_FORMAT_VFPCONV5FRM,   20) \
-  ENTRY(ARM_FORMAT_VFPLDSTFRM,    21) \
-  ENTRY(ARM_FORMAT_VFPLDSTMULFRM, 22) \
-  ENTRY(ARM_FORMAT_VFPMISCFRM,    23) \
-  ENTRY(ARM_FORMAT_THUMBFRM,      24) \
-  ENTRY(ARM_FORMAT_NEONFRM,       25) \
-  ENTRY(ARM_FORMAT_NEONGETLNFRM,  26) \
-  ENTRY(ARM_FORMAT_NEONSETLNFRM,  27) \
-  ENTRY(ARM_FORMAT_NEONDUPFRM,    28) \
-  ENTRY(ARM_FORMAT_MISCFRM,       29) \
-  ENTRY(ARM_FORMAT_THUMBMISCFRM,  30) \
-  ENTRY(ARM_FORMAT_NLdSt,         31) \
-  ENTRY(ARM_FORMAT_N1RegModImm,   32) \
-  ENTRY(ARM_FORMAT_N2Reg,         33) \
-  ENTRY(ARM_FORMAT_NVCVT,         34) \
-  ENTRY(ARM_FORMAT_NVecDupLn,     35) \
-  ENTRY(ARM_FORMAT_N2RegVecShL,   36) \
-  ENTRY(ARM_FORMAT_N2RegVecShR,   37) \
-  ENTRY(ARM_FORMAT_N3Reg,         38) \
-  ENTRY(ARM_FORMAT_N3RegVecSh,    39) \
-  ENTRY(ARM_FORMAT_NVecExtract,   40) \
-  ENTRY(ARM_FORMAT_NVecMulScalar, 41) \
-  ENTRY(ARM_FORMAT_NVTBL,         42)
+  ENTRY(ARM_FORMAT_SATFRM,        13) \
+  ENTRY(ARM_FORMAT_EXTFRM,        14) \
+  ENTRY(ARM_FORMAT_VFPUNARYFRM,   15) \
+  ENTRY(ARM_FORMAT_VFPBINARYFRM,  16) \
+  ENTRY(ARM_FORMAT_VFPCONV1FRM,   17) \
+  ENTRY(ARM_FORMAT_VFPCONV2FRM,   18) \
+  ENTRY(ARM_FORMAT_VFPCONV3FRM,   19) \
+  ENTRY(ARM_FORMAT_VFPCONV4FRM,   20) \
+  ENTRY(ARM_FORMAT_VFPCONV5FRM,   21) \
+  ENTRY(ARM_FORMAT_VFPLDSTFRM,    22) \
+  ENTRY(ARM_FORMAT_VFPLDSTMULFRM, 23) \
+  ENTRY(ARM_FORMAT_VFPMISCFRM,    24) \
+  ENTRY(ARM_FORMAT_THUMBFRM,      25) \
+  ENTRY(ARM_FORMAT_MISCFRM,       26) \
+  ENTRY(ARM_FORMAT_NEONGETLNFRM,  27) \
+  ENTRY(ARM_FORMAT_NEONSETLNFRM,  28) \
+  ENTRY(ARM_FORMAT_NEONDUPFRM,    29) \
+  ENTRY(ARM_FORMAT_NLdSt,         30) \
+  ENTRY(ARM_FORMAT_N1RegModImm,   31) \
+  ENTRY(ARM_FORMAT_N2Reg,         32) \
+  ENTRY(ARM_FORMAT_NVCVT,         33) \
+  ENTRY(ARM_FORMAT_NVecDupLn,     34) \
+  ENTRY(ARM_FORMAT_N2RegVecShL,   35) \
+  ENTRY(ARM_FORMAT_N2RegVecShR,   36) \
+  ENTRY(ARM_FORMAT_N3Reg,         37) \
+  ENTRY(ARM_FORMAT_N3RegVecSh,    38) \
+  ENTRY(ARM_FORMAT_NVecExtract,   39) \
+  ENTRY(ARM_FORMAT_NVecMulScalar, 40) \
+  ENTRY(ARM_FORMAT_NVTBL,         41)
 
 // ARM instruction format specifies the encoding used by the instruction.
 #define ENTRY(n, v) n = v,
@@ -241,7 +240,7 @@
 /// the Filter/FilterChooser combo does not know how to distinguish among the
 /// Opcodes assigned.
 ///
-/// An example of a conflcit is 
+/// An example of a conflict is 
 ///
 /// Conflict:
 ///                     111101000.00........00010000....
@@ -802,7 +801,7 @@
 
   o << '\n';
 
-  o.indent(Indentation) << "static uint16_t decodeInstruction(field_t insn) {\n";
+  o.indent(Indentation) <<"static uint16_t decodeInstruction(field_t insn) {\n";
 
   ++Indentation; ++Indentation;
   // Emits code to decode the instructions.
@@ -1584,7 +1583,7 @@
         Name == "MOVr_TC")
       return false;
 
-    // VLDMQ/VSTMQ can be hanlded with the more generic VLDMD/VSTMD.
+    // VLDMQ/VSTMQ can be handled with the more generic VLDMD/VSTMD.
     if (Name == "VLDMQ" || Name == "VLDMQ_UPD" ||
         Name == "VSTMQ" || Name == "VSTMQ_UPD")
       return false;
@@ -1611,13 +1610,13 @@
     // better off using the generic RSCri and RSCrs instructions.
     if (Name == "RSCSri" || Name == "RSCSrs") return false;
 
-    // MOVCCr, MOVCCs, MOVCCi, FCYPScc, FCYPDcc, FNEGScc, and FNEGDcc are used
-    // in the compiler to implement conditional moves.  We can ignore them in
-    // favor of their more generic versions of instructions.
-    // See also SDNode *ARMDAGToDAGISel::Select(SDValue Op).
-    if (Name == "MOVCCr" || Name == "MOVCCs" || Name == "MOVCCi" ||
-        Name == "FCPYScc" || Name == "FCPYDcc" ||
-        Name == "FNEGScc" || Name == "FNEGDcc")
+    // MOVCCr, MOVCCs, MOVCCi, MOVCCi16, FCYPScc, FCYPDcc, FNEGScc, and
+    // FNEGDcc are used in the compiler to implement conditional moves.
+    // We can ignore them in favor of their more generic versions of
+    // instructions. See also SDNode *ARMDAGToDAGISel::Select(SDValue Op).
+    if (Name == "MOVCCr"   || Name == "MOVCCs"  || Name == "MOVCCi" ||
+        Name == "MOVCCi16" || Name == "FCPYScc" || Name == "FCPYDcc" ||
+        Name == "FNEGScc"  || Name == "FNEGDcc")
       return false;
 
     // Ditto for VMOVDcc, VMOVScc, VNEGDcc, and VNEGScc.
@@ -1672,18 +1671,17 @@
     // VREV64qf is equivalent to VREV64q32.
     if (Name == "VREV64df" || Name == "VREV64qf") return false;
 
-    // VDUPLNfd is equivalent to VDUPLN32d; VDUPfdf is specialized VDUPLN32d.
-    // VDUPLNfq is equivalent to VDUPLN32q; VDUPfqf is specialized VDUPLN32q.
+    // VDUPLNfd is equivalent to VDUPLN32d.
+    // VDUPLNfq is equivalent to VDUPLN32q.
     // VLD1df is equivalent to VLD1d32.
     // VLD1qf is equivalent to VLD1q32.
     // VLD2d64 is equivalent to VLD1q64.
     // VST1df is equivalent to VST1d32.
     // VST1qf is equivalent to VST1q32.
     // VST2d64 is equivalent to VST1q64.
-    if (Name == "VDUPLNfd" || Name == "VDUPfdf" ||
-        Name == "VDUPLNfq" || Name == "VDUPfqf" ||
-        Name == "VLD1df" || Name == "VLD1qf" || Name == "VLD2d64" ||
-        Name == "VST1df" || Name == "VST1qf" || Name == "VST2d64")
+    if (Name == "VDUPLNfd" || Name == "VDUPLNfq" ||
+        Name == "VLD1df"   || Name == "VLD1qf"   || Name == "VLD2d64" ||
+        Name == "VST1df"   || Name == "VST1qf"   || Name == "VST2d64")
       return false;
   } else if (TN == TARGET_THUMB) {
     if (!thumbInstruction(Form))
@@ -1736,6 +1734,7 @@
     //   tLDRcp conflicts with tLDRspi
     //   tRestore conflicts with tLDRspi
     //   t2LEApcrelJT conflicts with t2LEApcrel
+    //   t2MOVCCi16 conflicts with tMOVi16
     if (Name == "tBfar" ||
         /* Name == "tCMNz" || */ Name == "tCMPzi8" || Name == "tCMPzr" ||
         Name == "tCMPzhir" || /* Name == "t2CMNzrr" || Name == "t2CMNzrs" ||
@@ -1743,7 +1742,7 @@
         Name == "t2CMPzri" || Name == "tPOP_RET" || Name == "t2LDM_RET" ||
         Name == "tMOVCCi" || Name == "tMOVCCr" || Name == "tBR_JTr" ||
         Name == "tSpill" || Name == "tLDRcp" || Name == "tRestore" ||
-        Name == "t2LEApcrelJT")
+        Name == "t2LEApcrelJT" || Name == "t2MOVCCi16")
       return false;
   }
 

Modified: llvm/branches/wendling/eh/utils/TableGen/AsmMatcherEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/TableGen/AsmMatcherEmitter.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/TableGen/AsmMatcherEmitter.cpp (original)
+++ llvm/branches/wendling/eh/utils/TableGen/AsmMatcherEmitter.cpp Tue Oct 26 19:48:03 2010
@@ -76,6 +76,7 @@
 #include "AsmMatcherEmitter.h"
 #include "CodeGenTarget.h"
 #include "Record.h"
+#include "StringMatcher.h"
 #include "llvm/ADT/OwningPtr.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/STLExtras.h"
@@ -199,6 +200,14 @@
       break;
     }
 
+    case '.':
+      if (InTok) {
+        Tokens.push_back(AsmString.slice(Prev, i));
+      }
+      Prev = i;
+      InTok = true;
+      break;
+
     default:
       InTok = true;
     }
@@ -260,9 +269,12 @@
     }
 
     if (Tokens[i][0] == '$' && !OperandNames.insert(Tokens[i]).second) {
-      std::string Err = "'" + Name.str() + "': " +
-        "invalid assembler instruction; tied operand '" + Tokens[i].str() + "'";
-      throw TGError(CGI.TheDef->getLoc(), Err);
+      DEBUG({
+          errs() << "warning: '" << Name << "': "
+                 << "ignoring instruction with tied operand '"
+                 << Tokens[i].str() << "'\n";
+        });
+      return false;
     }
   }
 
@@ -456,6 +468,10 @@
 
   /// operator< - Compare two instructions.
   bool operator<(const InstructionInfo &RHS) const {
+    // The primary comparator is the instruction mnemonic.
+    if (Tokens[0] != RHS.Tokens[0])
+      return Tokens[0] < RHS.Tokens[0];
+    
     if (Operands.size() != RHS.Operands.size())
       return Operands.size() < RHS.Operands.size();
 
@@ -979,8 +995,16 @@
   for (std::vector<InstructionInfo*>::iterator it = Instructions.begin(),
          ie = Instructions.end(); it != ie; ++it) {
     InstructionInfo *II = *it;
-
-    for (unsigned i = 0, e = II->Tokens.size(); i != e; ++i) {
+    
+    // The first token of the instruction is the mnemonic, which must be a
+    // simple string.
+    assert(!II->Tokens.empty() && "Instruction has no tokens?");
+    StringRef Mnemonic = II->Tokens[0];
+    assert(Mnemonic[0] != '$' &&
+           (RegisterPrefix.empty() || !Mnemonic.startswith(RegisterPrefix)));
+    
+    // Parse the tokens after the mnemonic.
+    for (unsigned i = 1, e = II->Tokens.size(); i != e; ++i) {
       StringRef Token = II->Tokens[i];
 
       // Check for singleton registers.
@@ -1209,7 +1233,7 @@
 
       CvtOS << "    ((" << TargetOperandClass << "*)Operands["
          << MIOperandList[i].second 
-         << "])->" << Op.Class->RenderMethod 
+         << "+1])->" << Op.Class->RenderMethod 
          << "(Inst, " << Op.OperandInfo->MINumOperands << ");\n";
       CurIndex += Op.OperandInfo->MINumOperands;
     }
@@ -1386,133 +1410,6 @@
   OS << "}\n\n";
 }
 
-typedef std::pair<std::string, std::string> StringPair;
-
-/// FindFirstNonCommonLetter - Find the first character in the keys of the
-/// string pairs that is not shared across the whole set of strings.  All
-/// strings are assumed to have the same length.
-static unsigned 
-FindFirstNonCommonLetter(const std::vector<const StringPair*> &Matches) {
-  assert(!Matches.empty());
-  for (unsigned i = 0, e = Matches[0]->first.size(); i != e; ++i) {
-    // Check to see if letter i is the same across the set.
-    char Letter = Matches[0]->first[i];
-    
-    for (unsigned str = 0, e = Matches.size(); str != e; ++str)
-      if (Matches[str]->first[i] != Letter)
-        return i;
-  }
-  
-  return Matches[0]->first.size();
-}
-
-/// EmitStringMatcherForChar - Given a set of strings that are known to be the
-/// same length and whose characters leading up to CharNo are the same, emit
-/// code to verify that CharNo and later are the same.
-///
-/// \return - True if control can leave the emitted code fragment.
-static bool EmitStringMatcherForChar(const std::string &StrVariableName,
-                                  const std::vector<const StringPair*> &Matches,
-                                     unsigned CharNo, unsigned IndentCount,
-                                     raw_ostream &OS) {
-  assert(!Matches.empty() && "Must have at least one string to match!");
-  std::string Indent(IndentCount*2+4, ' ');
-
-  // If we have verified that the entire string matches, we're done: output the
-  // matching code.
-  if (CharNo == Matches[0]->first.size()) {
-    assert(Matches.size() == 1 && "Had duplicate keys to match on");
-    
-    // FIXME: If Matches[0].first has embeded \n, this will be bad.
-    OS << Indent << Matches[0]->second << "\t // \"" << Matches[0]->first
-       << "\"\n";
-    return false;
-  }
-  
-  // Bucket the matches by the character we are comparing.
-  std::map<char, std::vector<const StringPair*> > MatchesByLetter;
-  
-  for (unsigned i = 0, e = Matches.size(); i != e; ++i)
-    MatchesByLetter[Matches[i]->first[CharNo]].push_back(Matches[i]);
-  
-
-  // If we have exactly one bucket to match, see how many characters are common
-  // across the whole set and match all of them at once.
-  if (MatchesByLetter.size() == 1) {
-    unsigned FirstNonCommonLetter = FindFirstNonCommonLetter(Matches);
-    unsigned NumChars = FirstNonCommonLetter-CharNo;
-    
-    // Emit code to break out if the prefix doesn't match.
-    if (NumChars == 1) {
-      // Do the comparison with if (Str[1] != 'f')
-      // FIXME: Need to escape general characters.
-      OS << Indent << "if (" << StrVariableName << "[" << CharNo << "] != '"
-         << Matches[0]->first[CharNo] << "')\n";
-      OS << Indent << "  break;\n";
-    } else {
-      // Do the comparison with if (Str.substr(1,3) != "foo").    
-      // FIXME: Need to escape general strings.
-      OS << Indent << "if (" << StrVariableName << ".substr(" << CharNo << ","
-         << NumChars << ") != \"";
-      OS << Matches[0]->first.substr(CharNo, NumChars) << "\")\n";
-      OS << Indent << "  break;\n";
-    }
-    
-    return EmitStringMatcherForChar(StrVariableName, Matches, 
-                                    FirstNonCommonLetter, IndentCount, OS);
-  }
-  
-  // Otherwise, we have multiple possible things, emit a switch on the
-  // character.
-  OS << Indent << "switch (" << StrVariableName << "[" << CharNo << "]) {\n";
-  OS << Indent << "default: break;\n";
-  
-  for (std::map<char, std::vector<const StringPair*> >::iterator LI = 
-       MatchesByLetter.begin(), E = MatchesByLetter.end(); LI != E; ++LI) {
-    // TODO: escape hard stuff (like \n) if we ever care about it.
-    OS << Indent << "case '" << LI->first << "':\t // "
-       << LI->second.size() << " strings to match.\n";
-    if (EmitStringMatcherForChar(StrVariableName, LI->second, CharNo+1,
-                                 IndentCount+1, OS))
-      OS << Indent << "  break;\n";
-  }
-  
-  OS << Indent << "}\n";
-  return true;
-}
-
-
-/// EmitStringMatcher - Given a list of strings and code to execute when they
-/// match, output a simple switch tree to classify the input string.
-/// 
-/// If a match is found, the code in Vals[i].second is executed; control must
-/// not exit this code fragment.  If nothing matches, execution falls through.
-///
-/// \param StrVariableName - The name of the variable to test.
-static void EmitStringMatcher(const std::string &StrVariableName,
-                              const std::vector<StringPair> &Matches,
-                              raw_ostream &OS) {
-  // First level categorization: group strings by length.
-  std::map<unsigned, std::vector<const StringPair*> > MatchesByLength;
-  
-  for (unsigned i = 0, e = Matches.size(); i != e; ++i)
-    MatchesByLength[Matches[i].first.size()].push_back(&Matches[i]);
-  
-  // Output a switch statement on length and categorize the elements within each
-  // bin.
-  OS << "  switch (" << StrVariableName << ".size()) {\n";
-  OS << "  default: break;\n";
-  
-  for (std::map<unsigned, std::vector<const StringPair*> >::iterator LI =
-       MatchesByLength.begin(), E = MatchesByLength.end(); LI != E; ++LI) {
-    OS << "  case " << LI->first << ":\t // " << LI->second.size()
-       << " strings to match.\n";
-    if (EmitStringMatcherForChar(StrVariableName, LI->second, 0, 0, OS))
-      OS << "    break;\n";
-  }
-  
-  OS << "  }\n";
-}
 
 
 /// EmitMatchTokenString - Emit the function to match a token string to the
@@ -1521,18 +1418,19 @@
                                  std::vector<ClassInfo*> &Infos,
                                  raw_ostream &OS) {
   // Construct the match list.
-  std::vector<StringPair> Matches;
+  std::vector<StringMatcher::StringPair> Matches;
   for (std::vector<ClassInfo*>::iterator it = Infos.begin(), 
          ie = Infos.end(); it != ie; ++it) {
     ClassInfo &CI = **it;
 
     if (CI.Kind == ClassInfo::Token)
-      Matches.push_back(StringPair(CI.ValueName, "return " + CI.Name + ";"));
+      Matches.push_back(StringMatcher::StringPair(CI.ValueName,
+                                                  "return " + CI.Name + ";"));
   }
 
   OS << "static MatchClassKind MatchTokenString(StringRef Name) {\n";
 
-  EmitStringMatcher("Name", Matches, OS);
+  StringMatcher("Name", Matches, OS).Emit();
 
   OS << "  return InvalidMatchClass;\n";
   OS << "}\n\n";
@@ -1543,19 +1441,20 @@
 static void EmitMatchRegisterName(CodeGenTarget &Target, Record *AsmParser,
                                   raw_ostream &OS) {
   // Construct the match list.
-  std::vector<StringPair> Matches;
+  std::vector<StringMatcher::StringPair> Matches;
   for (unsigned i = 0, e = Target.getRegisters().size(); i != e; ++i) {
     const CodeGenRegister &Reg = Target.getRegisters()[i];
     if (Reg.TheDef->getValueAsString("AsmName").empty())
       continue;
 
-    Matches.push_back(StringPair(Reg.TheDef->getValueAsString("AsmName"),
-                                 "return " + utostr(i + 1) + ";"));
+    Matches.push_back(StringMatcher::StringPair(
+                                        Reg.TheDef->getValueAsString("AsmName"),
+                                        "return " + utostr(i + 1) + ";"));
   }
   
   OS << "static unsigned MatchRegisterName(StringRef Name) {\n";
 
-  EmitStringMatcher("Name", Matches, OS);
+  StringMatcher("Name", Matches, OS).Emit();
   
   OS << "  return 0;\n";
   OS << "}\n\n";
@@ -1626,41 +1525,65 @@
     });
 
   // Check for ambiguous instructions.
-  unsigned NumAmbiguous = 0;
-  for (unsigned i = 0, e = Info.Instructions.size(); i != e; ++i) {
-    for (unsigned j = i + 1; j != e; ++j) {
-      InstructionInfo &A = *Info.Instructions[i];
-      InstructionInfo &B = *Info.Instructions[j];
-    
-      if (A.CouldMatchAmiguouslyWith(B)) {
-        DEBUG_WITH_TYPE("ambiguous_instrs", {
-            errs() << "warning: ambiguous instruction match:\n";
-            A.dump();
-            errs() << "\nis incomparable with:\n";
-            B.dump();
-            errs() << "\n\n";
-          });
-        ++NumAmbiguous;
+  DEBUG_WITH_TYPE("ambiguous_instrs", {
+    unsigned NumAmbiguous = 0;
+    for (unsigned i = 0, e = Info.Instructions.size(); i != e; ++i) {
+      for (unsigned j = i + 1; j != e; ++j) {
+        InstructionInfo &A = *Info.Instructions[i];
+        InstructionInfo &B = *Info.Instructions[j];
+      
+        if (A.CouldMatchAmiguouslyWith(B)) {
+          errs() << "warning: ambiguous instruction match:\n";
+          A.dump();
+          errs() << "\nis incomparable with:\n";
+          B.dump();
+          errs() << "\n\n";
+          ++NumAmbiguous;
+        }
       }
     }
-  }
-  if (NumAmbiguous)
-    DEBUG_WITH_TYPE("ambiguous_instrs", {
-        errs() << "warning: " << NumAmbiguous 
-               << " ambiguous instructions!\n";
-      });
+    if (NumAmbiguous)
+      errs() << "warning: " << NumAmbiguous 
+             << " ambiguous instructions!\n";
+  });
 
   // Write the output.
 
   EmitSourceFileHeader("Assembly Matcher Source Fragment", OS);
 
+  // Information for the class declaration.
+  OS << "\n#ifdef GET_ASSEMBLER_HEADER\n";
+  OS << "#undef GET_ASSEMBLER_HEADER\n";
+  OS << "  // This should be included into the middle of the declaration of \n";
+  OS << "  // your subclasses implementation of TargetAsmParser.\n";
+  OS << "  unsigned ComputeAvailableFeatures(const " <<
+           Target.getName() << "Subtarget *Subtarget) const;\n";
+  OS << "  enum MatchResultTy {\n";
+  OS << "    Match_Success, Match_MnemonicFail, Match_InvalidOperand,\n";
+  OS << "    Match_MissingFeature\n";
+  OS << "  };\n";
+  OS << "  MatchResultTy MatchInstructionImpl(const "
+     << "SmallVectorImpl<MCParsedAsmOperand*>"
+     << " &Operands, MCInst &Inst, unsigned &ErrorInfo);\n\n";
+  OS << "#endif // GET_ASSEMBLER_HEADER_INFO\n\n";
+
+  
+  
+  
+  OS << "\n#ifdef GET_REGISTER_MATCHER\n";
+  OS << "#undef GET_REGISTER_MATCHER\n\n";
+
   // Emit the subtarget feature enumeration.
   EmitSubtargetFeatureFlagEnumeration(Target, Info, OS);
 
   // Emit the function to match a register name to number.
   EmitMatchRegisterName(Target, AsmParser, OS);
+
+  OS << "#endif // GET_REGISTER_MATCHER\n\n";
   
-  OS << "#ifndef REGISTERS_ONLY\n\n";
+
+  OS << "\n#ifdef GET_MATCHER_IMPLEMENTATION\n";
+  OS << "#undef GET_MATCHER_IMPLEMENTATION\n\n";
 
   // Generate the unified function to convert operands into an MCInst.
   EmitConvertToMCInst(Target, Info.Instructions, OS);
@@ -1680,22 +1603,14 @@
   // Emit the available features compute function.
   EmitComputeAvailableFeatures(Target, Info, OS);
 
-  // Finally, build the match function.
 
   size_t MaxNumOperands = 0;
   for (std::vector<InstructionInfo*>::const_iterator it =
          Info.Instructions.begin(), ie = Info.Instructions.end();
        it != ie; ++it)
     MaxNumOperands = std::max(MaxNumOperands, (*it)->Operands.size());
-
-  const std::string &MatchName =
-    AsmParser->getValueAsString("MatchInstructionName");
-  OS << "bool " << Target.getName() << ClassName << "::\n"
-     << MatchName
-     << "(const SmallVectorImpl<MCParsedAsmOperand*> &Operands,\n";
-  OS.indent(MatchName.size() + 1);
-  OS << "MCInst &Inst) {\n";
-
+  
+  
   // Emit the static match table; unused classes get initalized to 0 which is
   // guaranteed to be InvalidMatchClass.
   //
@@ -1706,20 +1621,41 @@
   // order the match kinds appropriately (putting mnemonics last), then we
   // should only end up using a few bits for each class, especially the ones
   // following the mnemonic.
-  OS << "  static const struct MatchEntry {\n";
+  OS << "namespace {\n";
+  OS << "  struct MatchEntry {\n";
   OS << "    unsigned Opcode;\n";
+  OS << "    const char *Mnemonic;\n";
   OS << "    ConversionKind ConvertFn;\n";
   OS << "    MatchClassKind Classes[" << MaxNumOperands << "];\n";
   OS << "    unsigned RequiredFeatures;\n";
-  OS << "  } MatchTable[" << Info.Instructions.size() << "] = {\n";
-
+  OS << "  };\n\n";
+  
+  OS << "// Predicate for searching for an opcode.\n";
+  OS << "  struct LessOpcode {\n";
+  OS << "    bool operator()(const MatchEntry &LHS, StringRef RHS) {\n";
+  OS << "      return StringRef(LHS.Mnemonic) < RHS;\n";
+  OS << "    }\n";
+  OS << "    bool operator()(StringRef LHS, const MatchEntry &RHS) {\n";
+  OS << "      return LHS < StringRef(RHS.Mnemonic);\n";
+  OS << "    }\n";
+  OS << "    bool operator()(const MatchEntry &LHS, const MatchEntry &RHS) {\n";
+  OS << "      return StringRef(LHS.Mnemonic) < StringRef(RHS.Mnemonic);\n";
+  OS << "    }\n";
+  OS << "  };\n";
+  
+  OS << "} // end anonymous namespace.\n\n";
+  
+  OS << "static const MatchEntry MatchTable["
+     << Info.Instructions.size() << "] = {\n";
+  
   for (std::vector<InstructionInfo*>::const_iterator it =
-         Info.Instructions.begin(), ie = Info.Instructions.end();
+       Info.Instructions.begin(), ie = Info.Instructions.end();
        it != ie; ++it) {
     InstructionInfo &II = **it;
-
-    OS << "    { " << Target.getName() << "::" << II.InstrName
-       << ", " << II.ConversionFnKind << ", { ";
+    
+    OS << "  { " << Target.getName() << "::" << II.InstrName
+    << ", \"" << II.Tokens[0] << "\""
+    << ", " << II.ConversionFnKind << ", { ";
     for (unsigned i = 0, e = II.Operands.size(); i != e; ++i) {
       InstructionInfo::Operand &Op = II.Operands[i];
       
@@ -1727,7 +1663,7 @@
       OS << Op.Class->Name;
     }
     OS << " }, ";
-
+    
     // Write the required features mask.
     if (!II.RequiredFeatures.empty()) {
       for (unsigned i = 0, e = II.RequiredFeatures.size(); i != e; ++i) {
@@ -1736,12 +1672,18 @@
       }
     } else
       OS << "0";
-
+    
     OS << "},\n";
   }
+  
+  OS << "};\n\n";
 
-  OS << "  };\n\n";
-
+  // Finally, build the match function.
+  OS << Target.getName() << ClassName << "::MatchResultTy "
+     << Target.getName() << ClassName << "::\n"
+     << "MatchInstructionImpl(const SmallVectorImpl<MCParsedAsmOperand*>"
+     << " &Operands,\n";
+  OS << "                     MCInst &Inst, unsigned &ErrorInfo) {\n";
 
   // Emit code to get the available features.
   OS << "  // Get the current feature set.\n";
@@ -1749,41 +1691,80 @@
 
   // Emit code to compute the class list for this operand vector.
   OS << "  // Eliminate obvious mismatches.\n";
-  OS << "  if (Operands.size() > " << MaxNumOperands << ")\n";
-  OS << "    return true;\n\n";
+  OS << "  if (Operands.size() > " << (MaxNumOperands+1) << ") {\n";
+  OS << "    ErrorInfo = " << (MaxNumOperands+1) << ";\n";
+  OS << "    return Match_InvalidOperand;\n";
+  OS << "  }\n\n";
 
   OS << "  // Compute the class list for this operand vector.\n";
   OS << "  MatchClassKind Classes[" << MaxNumOperands << "];\n";
-  OS << "  for (unsigned i = 0, e = Operands.size(); i != e; ++i) {\n";
-  OS << "    Classes[i] = ClassifyOperand(Operands[i]);\n\n";
+  OS << "  for (unsigned i = 1, e = Operands.size(); i != e; ++i) {\n";
+  OS << "    Classes[i-1] = ClassifyOperand(Operands[i]);\n\n";
 
   OS << "    // Check for invalid operands before matching.\n";
-  OS << "    if (Classes[i] == InvalidMatchClass)\n";
-  OS << "      return true;\n";
+  OS << "    if (Classes[i-1] == InvalidMatchClass) {\n";
+  OS << "      ErrorInfo = i;\n";
+  OS << "      return Match_InvalidOperand;\n";
+  OS << "    }\n";
   OS << "  }\n\n";
 
   OS << "  // Mark unused classes.\n";
-  OS << "  for (unsigned i = Operands.size(), e = " << MaxNumOperands << "; "
+  OS << "  for (unsigned i = Operands.size()-1, e = " << MaxNumOperands << "; "
      << "i != e; ++i)\n";
   OS << "    Classes[i] = InvalidMatchClass;\n\n";
 
+  OS << "  // Get the instruction mnemonic, which is the first token.\n";
+  OS << "  StringRef Mnemonic = ((" << Target.getName()
+     << "Operand*)Operands[0])->getToken();\n\n";
+
+  OS << "  // Some state to try to produce better error messages.\n";
+  OS << "  bool HadMatchOtherThanFeatures = false;\n\n";
+  OS << "  // Set ErrorInfo to the operand that mismatches if it is \n";
+  OS << "  // wrong for all instances of the instruction.\n";
+  OS << "  ErrorInfo = ~0U;\n";
+
   // Emit code to search the table.
   OS << "  // Search the table.\n";
-  OS << "  for (const MatchEntry *it = MatchTable, "
-     << "*ie = MatchTable + " << Info.Instructions.size()
-     << "; it != ie; ++it) {\n";
-
-  // Emit check that the required features are available.
-    OS << "    if ((AvailableFeatures & it->RequiredFeatures) "
-       << "!= it->RequiredFeatures)\n";
-    OS << "      continue;\n";
+  OS << "  std::pair<const MatchEntry*, const MatchEntry*> MnemonicRange =\n";
+  OS << "    std::equal_range(MatchTable, MatchTable+"
+     << Info.Instructions.size() << ", Mnemonic, LessOpcode());\n\n";
+  
+  OS << "  // Return a more specific error code if no mnemonics match.\n";
+  OS << "  if (MnemonicRange.first == MnemonicRange.second)\n";
+  OS << "    return Match_MnemonicFail;\n\n";
+  
+  OS << "  for (const MatchEntry *it = MnemonicRange.first, "
+     << "*ie = MnemonicRange.second;\n";
+  OS << "       it != ie; ++it) {\n";
 
+  OS << "    // equal_range guarantees that instruction mnemonic matches.\n";
+  OS << "    assert(Mnemonic == it->Mnemonic);\n";
+  
   // Emit check that the subclasses match.
-  for (unsigned i = 0; i != MaxNumOperands; ++i) {
-    OS << "    if (!IsSubclass(Classes[" 
-       << i << "], it->Classes[" << i << "]))\n";
-    OS << "      continue;\n";
-  }
+  OS << "    bool OperandsValid = true;\n";
+  OS << "    for (unsigned i = 0; i != " << MaxNumOperands << "; ++i) {\n";
+  OS << "      if (IsSubclass(Classes[i], it->Classes[i]))\n";
+  OS << "        continue;\n";
+  OS << "      // If this operand is broken for all of the instances of this\n";
+  OS << "      // mnemonic, keep track of it so we can report loc info.\n";
+  OS << "      if (it == MnemonicRange.first || ErrorInfo == i+1)\n";
+  OS << "        ErrorInfo = i+1;\n";
+  OS << "      else\n";
+  OS << "        ErrorInfo = ~0U;";
+  OS << "      // Otherwise, just reject this instance of the mnemonic.\n";
+  OS << "      OperandsValid = false;\n";
+  OS << "      break;\n";
+  OS << "    }\n\n";
+  
+  OS << "    if (!OperandsValid) continue;\n";
+
+  // Emit check that the required features are available.
+  OS << "    if ((AvailableFeatures & it->RequiredFeatures) "
+     << "!= it->RequiredFeatures) {\n";
+  OS << "      HadMatchOtherThanFeatures = true;\n";
+  OS << "      continue;\n";
+  OS << "    }\n";
+  
   OS << "\n";
   OS << "    ConvertToMCInst(it->ConvertFn, Inst, it->Opcode, Operands);\n";
 
@@ -1793,11 +1774,13 @@
   if (!InsnCleanupFn.empty())
     OS << "    " << InsnCleanupFn << "(Inst);\n";
 
-  OS << "    return false;\n";
+  OS << "    return Match_Success;\n";
   OS << "  }\n\n";
 
-  OS << "  return true;\n";
+  OS << "  // Okay, we had no match.  Try to return a useful error code.\n";
+  OS << "  if (HadMatchOtherThanFeatures) return Match_MissingFeature;\n";
+  OS << "  return Match_InvalidOperand;\n";
   OS << "}\n\n";
   
-  OS << "#endif // REGISTERS_ONLY\n";
+  OS << "#endif // GET_MATCHER_IMPLEMENTATION\n\n";
 }

Modified: llvm/branches/wendling/eh/utils/TableGen/AsmWriterEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/TableGen/AsmWriterEmitter.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/TableGen/AsmWriterEmitter.cpp (original)
+++ llvm/branches/wendling/eh/utils/TableGen/AsmWriterEmitter.cpp Tue Oct 26 19:48:03 2010
@@ -101,22 +101,22 @@
 }
 
 void AsmWriterEmitter::
-FindUniqueOperandCommands(std::vector<std::string> &UniqueOperandCommands, 
+FindUniqueOperandCommands(std::vector<std::string> &UniqueOperandCommands,
                           std::vector<unsigned> &InstIdxs,
                           std::vector<unsigned> &InstOpsUsed) const {
   InstIdxs.assign(NumberedInstructions.size(), ~0U);
-  
+
   // This vector parallels UniqueOperandCommands, keeping track of which
   // instructions each case are used for.  It is a comma separated string of
   // enums.
   std::vector<std::string> InstrsForCase;
   InstrsForCase.resize(UniqueOperandCommands.size());
   InstOpsUsed.assign(UniqueOperandCommands.size(), 0);
-  
+
   for (unsigned i = 0, e = NumberedInstructions.size(); i != e; ++i) {
     const AsmWriterInst *Inst = getAsmWriterInstByID(i);
     if (Inst == 0) continue;  // PHI, INLINEASM, PROLOG_LABEL, etc.
-    
+
     std::string Command;
     if (Inst->Operands.empty())
       continue;   // Instruction already done.
@@ -143,13 +143,13 @@
       InstOpsUsed.push_back(1);
     }
   }
-  
+
   // For each entry of UniqueOperandCommands, there is a set of instructions
   // that uses it.  If the next command of all instructions in the set are
   // identical, fold it into the command.
   for (unsigned CommandIdx = 0, e = UniqueOperandCommands.size();
        CommandIdx != e; ++CommandIdx) {
-    
+
     for (unsigned Op = 1; ; ++Op) {
       // Scan for the first instruction in the set.
       std::vector<unsigned>::iterator NIT =
@@ -158,7 +158,7 @@
 
       // If this instruction has no more operands, we isn't anything to merge
       // into this command.
-      const AsmWriterInst *FirstInst = 
+      const AsmWriterInst *FirstInst =
         getAsmWriterInstByID(NIT-InstIdxs.begin());
       if (!FirstInst || FirstInst->Operands.size() == Op)
         break;
@@ -175,7 +175,7 @@
            NIT = std::find(NIT+1, InstIdxs.end(), CommandIdx)) {
         // Okay, found another instruction in this command set.  If the operand
         // matches, we're ok, otherwise bail out.
-        const AsmWriterInst *OtherInst = 
+        const AsmWriterInst *OtherInst =
           getAsmWriterInstByID(NIT-InstIdxs.begin());
 
         if (OtherInst &&
@@ -189,16 +189,16 @@
         }
       }
       if (!AllSame) break;
-      
+
       // Okay, everything in this command set has the same next operand.  Add it
       // to UniqueOperandCommands and remember that it was consumed.
       std::string Command = "    " + FirstInst->Operands[Op].getCode() + "\n";
-      
+
       UniqueOperandCommands[CommandIdx] += Command;
       InstOpsUsed[CommandIdx]++;
     }
   }
-  
+
   // Prepend some of the instructions each case is used for onto the case val.
   for (unsigned i = 0, e = InstrsForCase.size(); i != e; ++i) {
     std::string Instrs = InstrsForCase[i];
@@ -206,9 +206,9 @@
       Instrs.erase(Instrs.begin()+70, Instrs.end());
       Instrs += "...";
     }
-    
+
     if (!Instrs.empty())
-      UniqueOperandCommands[i] = "    // " + Instrs + "\n" + 
+      UniqueOperandCommands[i] = "    // " + Instrs + "\n" +
         UniqueOperandCommands[i];
   }
 }
@@ -243,12 +243,15 @@
   CodeGenTarget Target;
   Record *AsmWriter = Target.getAsmWriter();
   std::string ClassName = AsmWriter->getValueAsString("AsmWriterClassName");
-  
+  bool isMC = AsmWriter->getValueAsBit("isMCAsmWriter");
+  const char *MachineInstrClassName = isMC ? "MCInst" : "MachineInstr";
+
   O <<
   "/// printInstruction - This method is automatically generated by tablegen\n"
   "/// from the instruction set description.\n"
     "void " << Target.getName() << ClassName
-            << "::printInstruction(const MachineInstr *MI, raw_ostream &O) {\n";
+            << "::printInstruction(const " << MachineInstrClassName
+            << " *MI, raw_ostream &O) {\n";
 
   std::vector<AsmWriterInst> Instructions;
 
@@ -257,14 +260,14 @@
     if (!(*I)->AsmString.empty() &&
         (*I)->TheDef->getName() != "PHI")
       Instructions.push_back(
-        AsmWriterInst(**I, 
+        AsmWriterInst(**I,
                       AsmWriter->getValueAsInt("Variant"),
                       AsmWriter->getValueAsInt("FirstOperandColumn"),
                       AsmWriter->getValueAsInt("OperandSpacing")));
 
   // Get the instruction numbering.
   NumberedInstructions = Target.getInstructionsByEnumValue();
-  
+
   // Compute the CodeGenInstruction -> AsmWriterInst mapping.  Note that not
   // all machine instructions are necessarily being printed, so there may be
   // target instructions not in this map.
@@ -273,11 +276,11 @@
 
   // Build an aggregate string, and build a table of offsets into it.
   StringToOffsetTable StringTable;
-  
+
   /// OpcodeInfo - This encodes the index of the string to use for the first
   /// chunk of the output as well as indices used for operand printing.
   std::vector<unsigned> OpcodeInfo;
-  
+
   unsigned MaxStringIdx = 0;
   for (unsigned i = 0, e = NumberedInstructions.size(); i != e; ++i) {
     AsmWriterInst *AWI = CGIAWIMap[NumberedInstructions[i]];
@@ -285,7 +288,7 @@
     if (AWI == 0) {
       // Something not handled by the asmwriter printer.
       Idx = ~0U;
-    } else if (AWI->Operands[0].OperandType != 
+    } else if (AWI->Operands[0].OperandType !=
                         AsmWriterOperand::isLiteralTextOperand ||
                AWI->Operands[0].Str.empty()) {
       // Something handled by the asmwriter printer, but with no leading string.
@@ -295,51 +298,51 @@
       UnescapeString(Str);
       Idx = StringTable.GetOrAddStringOffset(Str);
       MaxStringIdx = std::max(MaxStringIdx, Idx);
-      
+
       // Nuke the string from the operand list.  It is now handled!
       AWI->Operands.erase(AWI->Operands.begin());
     }
-    
+
     // Bias offset by one since we want 0 as a sentinel.
     OpcodeInfo.push_back(Idx+1);
   }
-  
+
   // Figure out how many bits we used for the string index.
   unsigned AsmStrBits = Log2_32_Ceil(MaxStringIdx+2);
-  
+
   // To reduce code size, we compactify common instructions into a few bits
   // in the opcode-indexed table.
   unsigned BitsLeft = 32-AsmStrBits;
 
   std::vector<std::vector<std::string> > TableDrivenOperandPrinters;
-  
+
   while (1) {
     std::vector<std::string> UniqueOperandCommands;
     std::vector<unsigned> InstIdxs;
     std::vector<unsigned> NumInstOpsHandled;
     FindUniqueOperandCommands(UniqueOperandCommands, InstIdxs,
                               NumInstOpsHandled);
-    
+
     // If we ran out of operands to print, we're done.
     if (UniqueOperandCommands.empty()) break;
-    
+
     // Compute the number of bits we need to represent these cases, this is
     // ceil(log2(numentries)).
     unsigned NumBits = Log2_32_Ceil(UniqueOperandCommands.size());
-    
+
     // If we don't have enough bits for this operand, don't include it.
     if (NumBits > BitsLeft) {
       DEBUG(errs() << "Not enough bits to densely encode " << NumBits
                    << " more bits\n");
       break;
     }
-    
+
     // Otherwise, we can include this in the initial lookup table.  Add it in.
     BitsLeft -= NumBits;
     for (unsigned i = 0, e = InstIdxs.size(); i != e; ++i)
       if (InstIdxs[i] != ~0U)
         OpcodeInfo[i] |= InstIdxs[i] << (BitsLeft+AsmStrBits);
-    
+
     // Remove the info about this operand.
     for (unsigned i = 0, e = NumberedInstructions.size(); i != e; ++i) {
       if (AsmWriterInst *Inst = getAsmWriterInstByID(i))
@@ -351,13 +354,13 @@
                                Inst->Operands.begin()+NumOps);
         }
     }
-    
+
     // Remember the handlers for this set of operands.
     TableDrivenOperandPrinters.push_back(UniqueOperandCommands);
   }
-  
-  
-  
+
+
+
   O<<"  static const unsigned OpInfo[] = {\n";
   for (unsigned i = 0, e = NumberedInstructions.size(); i != e; ++i) {
     O << "    " << OpcodeInfo[i] << "U,\t// "
@@ -366,7 +369,7 @@
   // Add a dummy entry so the array init doesn't end with a comma.
   O << "    0U\n";
   O << "  };\n\n";
-  
+
   // Emit the string itself.
   O << "  const char *AsmStrs = \n";
   StringTable.EmitString(O);
@@ -388,13 +391,13 @@
     // ceil(log2(numentries)).
     unsigned NumBits = Log2_32_Ceil(Commands.size());
     assert(NumBits <= BitsLeft && "consistency error");
-    
+
     // Emit code to extract this field from Bits.
     BitsLeft -= NumBits;
-    
+
     O << "\n  // Fragment " << i << " encoded into " << NumBits
       << " bits for " << Commands.size() << " unique commands.\n";
-    
+
     if (Commands.size() == 2) {
       // Emit two possibilitys with if/else.
       O << "  if ((Bits >> " << (BitsLeft+AsmStrBits) << ") & "
@@ -403,11 +406,14 @@
         << "  } else {\n"
         << Commands[0]
         << "  }\n\n";
+    } else if (Commands.size() == 1) {
+      // Emit a single possibility.
+      O << Commands[0] << "\n\n";
     } else {
       O << "  switch ((Bits >> " << (BitsLeft+AsmStrBits) << ") & "
         << ((1 << NumBits)-1) << ") {\n"
         << "  default:   // unreachable.\n";
-      
+
       // Print out all the cases.
       for (unsigned i = 0, e = Commands.size(); i != e; ++i) {
         O << "  case " << i << ":\n";
@@ -417,7 +423,7 @@
       O << "  }\n\n";
     }
   }
-  
+
   // Okay, delete instructions with no operand info left.
   for (unsigned i = 0, e = Instructions.size(); i != e; ++i) {
     // Entire instruction has been emitted?
@@ -428,12 +434,12 @@
     }
   }
 
-    
+
   // Because this is a vector, we want to emit from the end.  Reverse all of the
   // elements in the vector.
   std::reverse(Instructions.begin(), Instructions.end());
-  
-  
+
+
   // Now that we've emitted all of the operand info that fit into 32 bits, emit
   // information for those instructions that are left.  This is a less dense
   // encoding, but we expect the main 32-bit table to handle the majority of
@@ -457,7 +463,7 @@
   Record *AsmWriter = Target.getAsmWriter();
   std::string ClassName = AsmWriter->getValueAsString("AsmWriterClassName");
   const std::vector<CodeGenRegister> &Registers = Target.getRegisters();
-  
+
   StringToOffsetTable StringTable;
   O <<
   "\n\n/// getRegisterName - This method is automatically generated by tblgen\n"
@@ -475,21 +481,21 @@
     std::string AsmName = Reg.TheDef->getValueAsString("AsmName");
     if (AsmName.empty())
       AsmName = Reg.getName();
-    
-    
+
+
     if ((i % 14) == 0)
       O << "\n    ";
-    
+
     O << StringTable.GetOrAddStringOffset(AsmName) << ", ";
   }
   O << "0\n"
     << "  };\n"
     << "\n";
-  
+
   O << "  const char *AsmStrs =\n";
   StringTable.EmitString(O);
   O << ";\n";
-  
+
   O << "  return AsmStrs+RegAsmOffset[RegNo-1];\n"
     << "}\n";
 }
@@ -501,7 +507,7 @@
 
   const std::vector<const CodeGenInstruction*> &NumberedInstructions =
     Target.getInstructionsByEnumValue();
-  
+
   StringToOffsetTable StringTable;
   O <<
 "\n\n#ifdef GET_INSTRUCTION_NAME\n"
@@ -517,21 +523,21 @@
   << "  static const unsigned InstAsmOffset[] = {";
   for (unsigned i = 0, e = NumberedInstructions.size(); i != e; ++i) {
     const CodeGenInstruction &Inst = *NumberedInstructions[i];
-    
+
     std::string AsmName = Inst.TheDef->getName();
     if ((i % 14) == 0)
       O << "\n    ";
-    
+
     O << StringTable.GetOrAddStringOffset(AsmName) << ", ";
   }
   O << "0\n"
   << "  };\n"
   << "\n";
-  
+
   O << "  const char *Strs =\n";
   StringTable.EmitString(O);
   O << ";\n";
-  
+
   O << "  return Strs+InstAsmOffset[Opcode];\n"
   << "}\n\n#endif\n";
 }
@@ -540,7 +546,7 @@
 
 void AsmWriterEmitter::run(raw_ostream &O) {
   EmitSourceFileHeader("Assembly Writer Source Fragment", O);
-  
+
   EmitPrintInstruction(O);
   EmitGetRegisterName(O);
   EmitGetInstructionName(O);

Modified: llvm/branches/wendling/eh/utils/TableGen/AsmWriterInst.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/TableGen/AsmWriterInst.h?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/TableGen/AsmWriterInst.h (original)
+++ llvm/branches/wendling/eh/utils/TableGen/AsmWriterInst.h Tue Oct 26 19:48:03 2010
@@ -23,51 +23,51 @@
 namespace llvm {
   class CodeGenInstruction;
   class Record;
-  
+
   struct AsmWriterOperand {
     enum OpType {
       // Output this text surrounded by quotes to the asm.
-      isLiteralTextOperand, 
+      isLiteralTextOperand,
       // This is the name of a routine to call to print the operand.
       isMachineInstrOperand,
       // Output this text verbatim to the asm writer.  It is code that
       // will output some text to the asm.
       isLiteralStatementOperand
     } OperandType;
-    
+
     /// Str - For isLiteralTextOperand, this IS the literal text.  For
     /// isMachineInstrOperand, this is the PrinterMethodName for the operand..
-    /// For isLiteralStatementOperand, this is the code to insert verbatim 
+    /// For isLiteralStatementOperand, this is the code to insert verbatim
     /// into the asm writer.
     std::string Str;
-    
+
     /// CGIOpNo - For isMachineInstrOperand, this is the index of the operand in
     /// the CodeGenInstruction.
     unsigned CGIOpNo;
-    
+
     /// MiOpNo - For isMachineInstrOperand, this is the operand number of the
     /// machine instruction.
     unsigned MIOpNo;
-    
+
     /// MiModifier - For isMachineInstrOperand, this is the modifier string for
     /// an operand, specified with syntax like ${opname:modifier}.
     std::string MiModifier;
-    
+
     // To make VS STL happy
     AsmWriterOperand(OpType op = isLiteralTextOperand):OperandType(op) {}
-    
+
     AsmWriterOperand(const std::string &LitStr,
                      OpType op = isLiteralTextOperand)
     : OperandType(op), Str(LitStr) {}
-    
+
     AsmWriterOperand(const std::string &Printer,
                      unsigned _CGIOpNo,
                      unsigned _MIOpNo,
                      const std::string &Modifier,
-                     OpType op = isMachineInstrOperand) 
+                     OpType op = isMachineInstrOperand)
     : OperandType(op), Str(Printer), CGIOpNo(_CGIOpNo), MIOpNo(_MIOpNo),
     MiModifier(Modifier) {}
-    
+
     bool operator!=(const AsmWriterOperand &Other) const {
       if (OperandType != Other.OperandType || Str != Other.Str) return true;
       if (OperandType == isMachineInstrOperand)
@@ -77,26 +77,26 @@
     bool operator==(const AsmWriterOperand &Other) const {
       return !operator!=(Other);
     }
-    
+
     /// getCode - Return the code that prints this operand.
     std::string getCode() const;
   };
-  
+
   class AsmWriterInst {
   public:
     std::vector<AsmWriterOperand> Operands;
     const CodeGenInstruction *CGI;
-    
-    AsmWriterInst(const CodeGenInstruction &CGI, 
+
+    AsmWriterInst(const CodeGenInstruction &CGI,
                   unsigned Variant,
                   int FirstOperandColumn,
                   int OperandSpacing);
-    
+
     /// MatchesAllButOneOp - If this instruction is exactly identical to the
     /// specified instruction except for one differing operand, return the
     /// differing operand number.  Otherwise return ~0.
     unsigned MatchesAllButOneOp(const AsmWriterInst &Other) const;
-    
+
   private:
     void AddLiteralString(const std::string &Str) {
       // If the last operand was already a literal text string, append this to

Modified: llvm/branches/wendling/eh/utils/TableGen/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/TableGen/CMakeLists.txt?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/TableGen/CMakeLists.txt (original)
+++ llvm/branches/wendling/eh/utils/TableGen/CMakeLists.txt Tue Oct 26 19:48:03 2010
@@ -1,3 +1,6 @@
+set(LLVM_REQUIRES_EH 1)
+set(LLVM_REQUIRES_RTTI 1)
+
 add_executable(tblgen
   ARMDecoderEmitter.cpp
   AsmMatcherEmitter.cpp
@@ -27,6 +30,7 @@
   OptParserEmitter.cpp
   Record.cpp
   RegisterInfoEmitter.cpp
+  StringMatcher.cpp
   SubtargetEmitter.cpp
   TGLexer.cpp
   TGParser.cpp

Modified: llvm/branches/wendling/eh/utils/TableGen/CallingConvEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/TableGen/CallingConvEmitter.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/TableGen/CallingConvEmitter.cpp (original)
+++ llvm/branches/wendling/eh/utils/TableGen/CallingConvEmitter.cpp Tue Oct 26 19:48:03 2010
@@ -169,6 +169,8 @@
       else
         O << "\n" << IndentStr << "  State.getTarget().getTargetData()"
           "->getABITypeAlignment(LocVT.getTypeForEVT(State.getContext()))";
+      if (Action->isSubClassOf("CCAssignToStackWithShadow"))
+        O << ", " << getQualifiedName(Action->getValueAsDef("ShadowReg"));
       O << ");\n" << IndentStr
         << "State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset"
         << Counter << ", LocVT, LocInfo));\n";

Modified: llvm/branches/wendling/eh/utils/TableGen/ClangAttrEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/TableGen/ClangAttrEmitter.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/TableGen/ClangAttrEmitter.cpp (original)
+++ llvm/branches/wendling/eh/utils/TableGen/ClangAttrEmitter.cpp Tue Oct 26 19:48:03 2010
@@ -13,10 +13,445 @@
 
 #include "ClangAttrEmitter.h"
 #include "Record.h"
+#include "llvm/ADT/StringSwitch.h"
 #include <algorithm>
+#include <cctype>
 
 using namespace llvm;
 
+static const std::vector<StringRef>
+getValueAsListOfStrings(Record &R, StringRef FieldName) {
+  ListInit *List = R.getValueAsListInit(FieldName);
+  assert (List && "Got a null ListInit");
+
+  std::vector<StringRef> Strings;
+  Strings.reserve(List->getSize());
+
+  for (ListInit::iterator i = List->begin(), e = List->end(); i != e; ++i) {
+    assert(*i && "Got a null element in a ListInit");
+    if (StringInit *S = dynamic_cast<StringInit *>(*i))
+      Strings.push_back(S->getValue());
+    else if (CodeInit *C = dynamic_cast<CodeInit *>(*i))
+      Strings.push_back(C->getValue());
+    else
+      assert(false && "Got a non-string, non-code element in a ListInit");
+  }
+
+  return Strings;
+}
+
+std::string ReadPCHRecord(StringRef type) {
+  return StringSwitch<std::string>(type)
+    .EndsWith("Decl *", "cast_or_null<" + std::string(type, 0, type.size()-1) +
+              ">(GetDecl(Record[Idx++]))")
+    .Case("QualType", "GetType(Record[Idx++])")
+    .Default("Record[Idx++]");
+}
+
+// Assumes that the way to get the value is SA->getname()
+std::string WritePCHRecord(StringRef type, StringRef name) {
+  return StringSwitch<std::string>(type)
+    .EndsWith("Decl *", "AddDeclRef(" + std::string(name) +
+                        ", Record);\n")
+    .Case("QualType", "AddTypeRef(" + std::string(name) + ", Record);\n")
+    .Default("Record.push_back(" + std::string(name) + ");\n");
+}
+
+namespace {
+  class Argument {
+    std::string lowerName, upperName;
+    StringRef attrName;
+
+  public:
+    Argument(Record &Arg, StringRef Attr)
+      : lowerName(Arg.getValueAsString("Name")), upperName(lowerName),
+        attrName(Attr) {
+      if (!lowerName.empty()) {
+        lowerName[0] = std::tolower(lowerName[0]);
+        upperName[0] = std::toupper(upperName[0]);
+      }
+    }
+    virtual ~Argument() {}
+
+    StringRef getLowerName() const { return lowerName; }
+    StringRef getUpperName() const { return upperName; }
+    StringRef getAttrName() const { return attrName; }
+
+    // These functions print the argument contents formatted in different ways.
+    virtual void writeAccessors(raw_ostream &OS) const = 0;
+    virtual void writeAccessorDefinitions(raw_ostream &OS) const {}
+    virtual void writeCloneArgs(raw_ostream &OS) const = 0;
+    virtual void writeCtorBody(raw_ostream &OS) const {}
+    virtual void writeCtorInitializers(raw_ostream &OS) const = 0;
+    virtual void writeCtorParameters(raw_ostream &OS) const = 0;
+    virtual void writeDeclarations(raw_ostream &OS) const = 0;
+    virtual void writePCHReadArgs(raw_ostream &OS) const = 0;
+    virtual void writePCHReadDecls(raw_ostream &OS) const = 0;
+    virtual void writePCHWrite(raw_ostream &OS) const = 0;
+  };
+
+  class SimpleArgument : public Argument {
+    std::string type;
+
+  public:
+    SimpleArgument(Record &Arg, StringRef Attr, std::string T)
+      : Argument(Arg, Attr), type(T)
+    {}
+
+    void writeAccessors(raw_ostream &OS) const {
+      OS << "  " << type << " get" << getUpperName() << "() const {\n";
+      OS << "    return " << getLowerName() << ";\n";
+      OS << "  }";
+    }
+    void writeCloneArgs(raw_ostream &OS) const {
+      OS << getLowerName();
+    }
+    void writeCtorInitializers(raw_ostream &OS) const {
+      OS << getLowerName() << "(" << getUpperName() << ")";
+    }
+    void writeCtorParameters(raw_ostream &OS) const {
+      OS << type << " " << getUpperName();
+    }
+    void writeDeclarations(raw_ostream &OS) const {
+      OS << type << " " << getLowerName() << ";";
+    }
+    void writePCHReadDecls(raw_ostream &OS) const {
+      std::string read = ReadPCHRecord(type);
+      OS << "    " << type << " " << getLowerName() << " = " << read << ";\n";
+    }
+    void writePCHReadArgs(raw_ostream &OS) const {
+      OS << getLowerName();
+    }
+    void writePCHWrite(raw_ostream &OS) const {
+      OS << "    " << WritePCHRecord(type, "SA->get" +
+                                           std::string(getUpperName()) + "()");
+    }
+  };
+
+  class StringArgument : public Argument {
+  public:
+    StringArgument(Record &Arg, StringRef Attr)
+      : Argument(Arg, Attr)
+    {}
+
+    void writeAccessors(raw_ostream &OS) const {
+      OS << "  llvm::StringRef get" << getUpperName() << "() const {\n";
+      OS << "    return llvm::StringRef(" << getLowerName() << ", "
+         << getLowerName() << "Length);\n";
+      OS << "  }\n";
+      OS << "  unsigned get" << getUpperName() << "Length() const {\n";
+      OS << "    return " << getLowerName() << "Length;\n";
+      OS << "  }\n";
+      OS << "  void set" << getUpperName()
+         << "(ASTContext &C, llvm::StringRef S) {\n";
+      OS << "    " << getLowerName() << "Length = S.size();\n";
+      OS << "    this->" << getLowerName() << " = new (C, 1) char ["
+         << getLowerName() << "Length];\n";
+      OS << "    std::memcpy(this->" << getLowerName() << ", S.data(), "
+         << getLowerName() << "Length);\n";
+      OS << "  }";
+    }
+    void writeCloneArgs(raw_ostream &OS) const {
+      OS << "get" << getUpperName() << "()";
+    }
+    void writeCtorBody(raw_ostream &OS) const {
+      OS << "      std::memcpy(" << getLowerName() << ", " << getUpperName()
+         << ".data(), " << getLowerName() << "Length);";
+    }
+    void writeCtorInitializers(raw_ostream &OS) const {
+      OS << getLowerName() << "Length(" << getUpperName() << ".size()),"
+         << getLowerName() << "(new (Ctx, 1) char[" << getLowerName()
+         << "Length])";
+    }
+    void writeCtorParameters(raw_ostream &OS) const {
+      OS << "llvm::StringRef " << getUpperName();
+    }
+    void writeDeclarations(raw_ostream &OS) const {
+      OS << "unsigned " << getLowerName() << "Length;\n";
+      OS << "char *" << getLowerName() << ";";
+    }
+    void writePCHReadDecls(raw_ostream &OS) const {
+      OS << "    std::string " << getLowerName()
+         << "= ReadString(Record, Idx);\n";
+    }
+    void writePCHReadArgs(raw_ostream &OS) const {
+      OS << getLowerName();
+    }
+    void writePCHWrite(raw_ostream &OS) const {
+      OS << "    AddString(SA->get" << getUpperName() << "(), Record);\n";
+    }
+  };
+
+  class AlignedArgument : public Argument {
+  public:
+    AlignedArgument(Record &Arg, StringRef Attr)
+      : Argument(Arg, Attr)
+    {}
+
+    void writeAccessors(raw_ostream &OS) const {
+      OS << "  bool is" << getUpperName() << "Dependent() const;\n";
+
+      OS << "  unsigned get" << getUpperName() << "(ASTContext &Ctx) const;\n";
+
+      OS << "  bool is" << getUpperName() << "Expr() const {\n";
+      OS << "    return is" << getLowerName() << "Expr;\n";
+      OS << "  }\n";
+
+      OS << "  Expr *get" << getUpperName() << "Expr() const {\n";
+      OS << "    assert(is" << getLowerName() << "Expr);\n";
+      OS << "    return " << getLowerName() << "Expr;\n";
+      OS << "  }\n";
+
+      OS << "  TypeSourceInfo *get" << getUpperName() << "Type() const {\n";
+      OS << "    assert(!is" << getLowerName() << "Expr);\n";
+      OS << "    return " << getLowerName() << "Type;\n";
+      OS << "  }";
+    }
+    void writeAccessorDefinitions(raw_ostream &OS) const {
+      OS << "bool " << getAttrName() << "Attr::is" << getUpperName()
+         << "Dependent() const {\n";
+      OS << "  if (is" << getLowerName() << "Expr)\n";
+      OS << "    return " << getLowerName() << "Expr && (" << getLowerName()
+         << "Expr->isValueDependent() || " << getLowerName()
+         << "Expr->isTypeDependent());\n"; 
+      OS << "  else\n";
+      OS << "    return " << getLowerName()
+         << "Type->getType()->isDependentType();\n";
+      OS << "}\n";
+
+      // FIXME: Do not do the calculation here
+      // FIXME: Handle types correctly
+      // A null pointer means maximum alignment
+      // FIXME: Load the platform-specific maximum alignment, rather than
+      //        16, the x86 max.
+      OS << "unsigned " << getAttrName() << "Attr::get" << getUpperName()
+         << "(ASTContext &Ctx) const {\n";
+      OS << "  assert(!is" << getUpperName() << "Dependent());\n";
+      OS << "  if (is" << getLowerName() << "Expr)\n";
+      OS << "    return (" << getLowerName() << "Expr ? " << getLowerName()
+         << "Expr->EvaluateAsInt(Ctx).getZExtValue() : 16)"
+         << "* Ctx.getCharWidth();\n";
+      OS << "  else\n";
+      OS << "    return 0; // FIXME\n";
+      OS << "}\n";
+    }
+    void writeCloneArgs(raw_ostream &OS) const {
+      OS << "is" << getLowerName() << "Expr, is" << getLowerName()
+         << "Expr ? static_cast<void*>(" << getLowerName()
+         << "Expr) : " << getLowerName()
+         << "Type";
+    }
+    void writeCtorBody(raw_ostream &OS) const {
+      OS << "    if (is" << getLowerName() << "Expr)\n";
+      OS << "       " << getLowerName() << "Expr = reinterpret_cast<Expr *>("
+         << getUpperName() << ");\n";
+      OS << "    else\n";
+      OS << "       " << getLowerName()
+         << "Type = reinterpret_cast<TypeSourceInfo *>(" << getUpperName()
+         << ");";
+    }
+    void writeCtorInitializers(raw_ostream &OS) const {
+      OS << "is" << getLowerName() << "Expr(Is" << getUpperName() << "Expr)";
+    }
+    void writeCtorParameters(raw_ostream &OS) const {
+      OS << "bool Is" << getUpperName() << "Expr, void *" << getUpperName();
+    }
+    void writeDeclarations(raw_ostream &OS) const {
+      OS << "bool is" << getLowerName() << "Expr;\n";
+      OS << "union {\n";
+      OS << "Expr *" << getLowerName() << "Expr;\n";
+      OS << "TypeSourceInfo *" << getLowerName() << "Type;\n";
+      OS << "};";
+    }
+    void writePCHReadArgs(raw_ostream &OS) const {
+      OS << "is" << getLowerName() << "Expr, " << getLowerName() << "Ptr";
+    }
+    void writePCHReadDecls(raw_ostream &OS) const {
+      OS << "    bool is" << getLowerName() << "Expr = Record[Idx++];\n";
+      OS << "    void *" << getLowerName() << "Ptr;\n";
+      OS << "    if (is" << getLowerName() << "Expr)\n";
+      OS << "      " << getLowerName() << "Ptr = ReadExpr(F);\n";
+      OS << "    else\n";
+      OS << "      " << getLowerName()
+         << "Ptr = GetTypeSourceInfo(F, Record, Idx);\n";
+    }
+    void writePCHWrite(raw_ostream &OS) const {
+      OS << "    Record.push_back(SA->is" << getUpperName() << "Expr());\n";
+      OS << "    if (SA->is" << getUpperName() << "Expr())\n";
+      OS << "      AddStmt(SA->get" << getUpperName() << "Expr());\n";
+      OS << "    else\n";
+      OS << "      AddTypeSourceInfo(SA->get" << getUpperName()
+         << "Type(), Record);\n";
+    }
+  };
+
+  class VariadicArgument : public Argument {
+    std::string type;
+
+  public:
+    VariadicArgument(Record &Arg, StringRef Attr, std::string T)
+      : Argument(Arg, Attr), type(T)
+    {}
+
+    std::string getType() const { return type; }
+
+    void writeAccessors(raw_ostream &OS) const {
+      OS << "  typedef " << type << "* " << getLowerName() << "_iterator;\n";
+      OS << "  " << getLowerName() << "_iterator " << getLowerName()
+         << "_begin() const {\n";
+      OS << "    return " << getLowerName() << ";\n";
+      OS << "  }\n";
+      OS << "  " << getLowerName() << "_iterator " << getLowerName()
+         << "_end() const {\n";
+      OS << "    return " << getLowerName() << " + " << getLowerName()
+         << "Size;\n";
+      OS << "  }\n";
+      OS << "  unsigned " << getLowerName() << "_size() const {\n"
+         << "    return " << getLowerName() << "Size;\n;";
+      OS << "  }";
+    }
+    void writeCloneArgs(raw_ostream &OS) const {
+      OS << getLowerName() << ", " << getLowerName() << "Size";
+    }
+    void writeCtorBody(raw_ostream &OS) const {
+      // FIXME: memcpy is not safe on non-trivial types.
+      OS << "    std::memcpy(" << getLowerName() << ", " << getUpperName()
+         << ", " << getLowerName() << "Size * sizeof(" << getType() << "));\n";
+    }
+    void writeCtorInitializers(raw_ostream &OS) const {
+      OS << getLowerName() << "Size(" << getUpperName() << "Size), "
+         << getLowerName() << "(new (Ctx, 16) " << getType() << "["
+         << getLowerName() << "Size])";
+    }
+    void writeCtorParameters(raw_ostream &OS) const {
+      OS << getType() << " *" << getUpperName() << ", unsigned "
+         << getUpperName() << "Size";
+    }
+    void writeDeclarations(raw_ostream &OS) const {
+      OS << "  unsigned " << getLowerName() << "Size;\n";
+      OS << "  " << getType() << " *" << getLowerName() << ";";
+    }
+    void writePCHReadDecls(raw_ostream &OS) const {
+      OS << "  unsigned " << getLowerName() << "Size = Record[Idx++];\n";
+      OS << "  llvm::SmallVector<" << type << ", 4> " << getLowerName()
+         << ";\n";
+      OS << "  " << getLowerName() << ".reserve(" << getLowerName()
+         << "Size);\n";
+      OS << "  for (unsigned i = " << getLowerName() << "Size; i; --i)\n";
+      
+      std::string read = ReadPCHRecord(type);
+      OS << "    " << getLowerName() << ".push_back(" << read << ");\n";
+    }
+    void writePCHReadArgs(raw_ostream &OS) const {
+      OS << getLowerName() << ".data(), " << getLowerName() << "Size";
+    }
+    void writePCHWrite(raw_ostream &OS) const{
+      OS << "    Record.push_back(SA->" << getLowerName() << "_size());\n";
+      OS << "    for (" << getAttrName() << "Attr::" << getLowerName()
+         << "_iterator i = SA->" << getLowerName() << "_begin(), e = SA->"
+         << getLowerName() << "_end(); i != e; ++i)\n";
+      OS << "      " << WritePCHRecord(type, "(*i)");
+    }
+  };
+
+  class EnumArgument : public Argument {
+    std::string type;
+    std::vector<StringRef> values, enums;
+  public:
+    EnumArgument(Record &Arg, StringRef Attr)
+      : Argument(Arg, Attr), type(Arg.getValueAsString("Type")),
+        values(getValueAsListOfStrings(Arg, "Values")),
+        enums(getValueAsListOfStrings(Arg, "Enums"))
+    {}
+
+    void writeAccessors(raw_ostream &OS) const {
+      OS << "  " << type << " get" << getUpperName() << "() const {\n";
+      OS << "    return " << getLowerName() << ";\n";
+      OS << "  }";
+    }
+    void writeCloneArgs(raw_ostream &OS) const {
+      OS << getLowerName();
+    }
+    void writeCtorInitializers(raw_ostream &OS) const {
+      OS << getLowerName() << "(" << getUpperName() << ")";
+    }
+    void writeCtorParameters(raw_ostream &OS) const {
+      OS << type << " " << getUpperName();
+    }
+    void writeDeclarations(raw_ostream &OS) const {
+      // Calculate the various enum values
+      std::vector<StringRef> uniques(enums);
+      std::sort(uniques.begin(), uniques.end());
+      uniques.erase(std::unique(uniques.begin(), uniques.end()),
+                    uniques.end());
+      // FIXME: Emit a proper error
+      assert(!uniques.empty());
+
+      std::vector<StringRef>::iterator i = uniques.begin(),
+                                       e = uniques.end();
+      // The last one needs to not have a comma.
+      --e;
+
+      OS << "public:\n";
+      OS << "  enum " << type << " {\n";
+      for (; i != e; ++i)
+        OS << "    " << *i << ",\n";
+      OS << "    " << *e << "\n";
+      OS << "  };\n";
+      OS << "private:\n";
+      OS << "  " << type << " " << getLowerName() << ";";
+    }
+    void writePCHReadDecls(raw_ostream &OS) const {
+      OS << "    " << getAttrName() << "Attr::" << type << " " << getLowerName()
+         << "(static_cast<" << getAttrName() << "Attr::" << type
+         << ">(Record[Idx++]));\n";
+    }
+    void writePCHReadArgs(raw_ostream &OS) const {
+      OS << getLowerName();
+    }
+    void writePCHWrite(raw_ostream &OS) const {
+      OS << "Record.push_back(SA->get" << getUpperName() << "());\n";
+    }
+  };
+}
+
+static Argument *createArgument(Record &Arg, StringRef Attr,
+                                Record *Search = 0) {
+  if (!Search)
+    Search = &Arg;
+
+  Argument *Ptr = 0;
+  llvm::StringRef ArgName = Search->getName();
+
+  if (ArgName == "AlignedArgument") Ptr = new AlignedArgument(Arg, Attr);
+  else if (ArgName == "EnumArgument") Ptr = new EnumArgument(Arg, Attr);
+  else if (ArgName == "ExprArgument") Ptr = new SimpleArgument(Arg, Attr,
+                                                               "Expr *");
+  else if (ArgName == "FunctionArgument")
+    Ptr = new SimpleArgument(Arg, Attr, "FunctionDecl *");
+  else if (ArgName == "IdentifierArgument")
+    Ptr = new SimpleArgument(Arg, Attr, "IdentifierInfo *");
+  else if (ArgName == "IntArgument") Ptr = new SimpleArgument(Arg, Attr, "int");
+  else if (ArgName == "StringArgument") Ptr = new StringArgument(Arg, Attr);
+  else if (ArgName == "TypeArgument")
+    Ptr = new SimpleArgument(Arg, Attr, "QualType");
+  else if (ArgName == "UnsignedArgument")
+    Ptr = new SimpleArgument(Arg, Attr, "unsigned");
+  else if (ArgName == "VariadicUnsignedArgument")
+    Ptr = new VariadicArgument(Arg, Attr, "unsigned");
+
+  if (!Ptr) {
+    std::vector<Record*> Bases = Search->getSuperClasses();
+    for (std::vector<Record*>::iterator i = Bases.begin(), e = Bases.end();
+         i != e; ++i) {
+      Ptr = createArgument(Arg, Attr, *i);
+      if (Ptr)
+        break;
+    }
+  }
+  return Ptr;
+}
+
 void ClangAttrClassEmitter::run(raw_ostream &OS) {
   OS << "// This file is generated by TableGen. Do not edit.\n\n";
   OS << "#ifndef LLVM_CLANG_ATTR_CLASSES_INC\n";
@@ -28,29 +463,63 @@
        i != e; ++i) {
     Record &R = **i;
 
-    if (R.getValueAsBit("DoNotEmit"))
-      continue;
-
     OS << "class " << R.getName() << "Attr : public Attr {\n";
 
-    std::vector<Record*> Args = R.getValueAsListOfDefs("Args");
+    std::vector<Record*> ArgRecords = R.getValueAsListOfDefs("Args");
+    std::vector<Argument*> Args;
+    std::vector<Argument*>::iterator ai, ae;
+    Args.reserve(ArgRecords.size());
+
+    for (std::vector<Record*>::iterator ri = ArgRecords.begin(),
+                                        re = ArgRecords.end();
+         ri != re; ++ri) {
+      Record &ArgRecord = **ri;
+      Argument *Arg = createArgument(ArgRecord, R.getName());
+      assert(Arg);
+      Args.push_back(Arg);
+
+      Arg->writeDeclarations(OS);
+      OS << "\n\n";
+    }
 
-    // FIXME: Handle arguments
-    assert(Args.empty() && "Can't yet handle arguments");
+    ae = Args.end();
 
     OS << "\n public:\n";
-    OS << "  " << R.getName() << "Attr(";
+    OS << "  " << R.getName() << "Attr(SourceLocation L, ASTContext &Ctx\n";
     
-    // Arguments go here
+    for (ai = Args.begin(); ai != ae; ++ai) {
+      OS << "              , ";
+      (*ai)->writeCtorParameters(OS);
+      OS << "\n";
+    }
     
-    OS << ")\n";
-    OS << "    : Attr(attr::" << R.getName() << ")";
+    OS << "             )\n";
+    OS << "    : Attr(attr::" << R.getName() << ", L)\n";
 
-    // Arguments go here
-    
-    OS << " {}\n\n";
+    for (ai = Args.begin(); ai != ae; ++ai) {
+      OS << "              , ";
+      (*ai)->writeCtorInitializers(OS);
+      OS << "\n";
+    }
+
+    OS << "  {\n";
+  
+    for (ai = Args.begin(); ai != ae; ++ai) {
+      (*ai)->writeCtorBody(OS);
+      OS << "\n";
+    }
+    OS << "  }\n\n";
+
+    OS << "  virtual " << R.getName() << "Attr *clone (ASTContext &C) const;\n";
+
+    for (ai = Args.begin(); ai != ae; ++ai) {
+      (*ai)->writeAccessors(OS);
+      OS << "\n\n";
+    }
+
+    OS << R.getValueAsCode("AdditionalMembers");
+    OS << "\n\n";
 
-    OS << "  virtual Attr *clone (ASTContext &C) const;\n";
     OS << "  static bool classof(const Attr *A) { return A->getKind() == "
        << "attr::" << R.getName() << "; }\n";
     OS << "  static bool classof(const " << R.getName()
@@ -61,6 +530,34 @@
   OS << "#endif\n";
 }
 
+void ClangAttrImplEmitter::run(raw_ostream &OS) {
+  OS << "// This file is generated by TableGen. Do not edit.\n\n";
+
+  std::vector<Record*> Attrs = Records.getAllDerivedDefinitions("Attr");
+  std::vector<Record*>::iterator i = Attrs.begin(), e = Attrs.end(), ri, re;
+  std::vector<Argument*>::iterator ai, ae;
+
+  for (; i != e; ++i) {
+    Record &R = **i;
+    std::vector<Record*> ArgRecords = R.getValueAsListOfDefs("Args");
+    std::vector<Argument*> Args;
+    for (ri = ArgRecords.begin(), re = ArgRecords.end(); ri != re; ++ri)
+      Args.push_back(createArgument(**ri, R.getName()));
+
+    for (ai = Args.begin(), ae = Args.end(); ai != ae; ++ai)
+      (*ai)->writeAccessorDefinitions(OS);
+
+    OS << R.getName() << "Attr *" << R.getName()
+       << "Attr::clone(ASTContext &C) const {\n";
+    OS << "  return new (C) " << R.getName() << "Attr(getLocation(), C";
+    for (ai = Args.begin(); ai != ae; ++ai) {
+      OS << ", ";
+      (*ai)->writeCloneArgs(OS);
+    }
+    OS << ");\n}\n\n";
+  }
+}
+
 void ClangAttrListEmitter::run(raw_ostream &OS) {
   OS << "// This file is generated by TableGen. Do not edit.\n\n";
 
@@ -82,3 +579,79 @@
   OS << "#undef LAST_ATTR\n";
   OS << "#undef ATTR\n";
 }
+
+void ClangAttrPCHReadEmitter::run(raw_ostream &OS) {
+  OS << "// This file is generated by TableGen. Do not edit.\n\n";
+
+  std::vector<Record*> Attrs = Records.getAllDerivedDefinitions("Attr"),
+                       ArgRecords;
+  std::vector<Record*>::iterator i = Attrs.begin(), e = Attrs.end(), ai, ae;
+  std::vector<Argument*> Args;
+  std::vector<Argument*>::iterator ri, re;
+
+  OS << "  switch (Kind) {\n";
+  OS << "  default:\n";
+  OS << "    assert(0 && \"Unknown attribute!\");\n";
+  OS << "    break;\n";
+  for (; i != e; ++i) {
+    Record &R = **i;
+    OS << "  case attr::" << R.getName() << ": {\n";
+    ArgRecords = R.getValueAsListOfDefs("Args");
+    Args.clear();
+    for (ai = ArgRecords.begin(), ae = ArgRecords.end(); ai != ae; ++ai) {
+      Argument *A = createArgument(**ai, R.getName());
+      Args.push_back(A);
+      A->writePCHReadDecls(OS);
+    }
+    OS << "    New = new (*Context) " << R.getName() << "Attr(Loc, *Context";
+    for (ri = Args.begin(), re = Args.end(); ri != re; ++ri) {
+      OS << ", ";
+      (*ri)->writePCHReadArgs(OS);
+    }
+    OS << ");\n";
+    OS << "    break;\n";
+    OS << "  }\n";
+  }
+  OS << "  }\n";
+}
+
+void ClangAttrPCHWriteEmitter::run(raw_ostream &OS) {
+  std::vector<Record*> Attrs = Records.getAllDerivedDefinitions("Attr"), Args;
+  std::vector<Record*>::iterator i = Attrs.begin(), e = Attrs.end(), ai, ae;
+
+  OS << "  switch (A->getKind()) {\n";
+  OS << "  default:\n";
+  OS << "    llvm_unreachable(\"Unknown attribute kind!\");\n";
+  OS << "    break;\n";
+  for (; i != e; ++i) {
+    Record &R = **i;
+    OS << "  case attr::" << R.getName() << ": {\n";
+    Args = R.getValueAsListOfDefs("Args");
+    if (!Args.empty())
+      OS << "    const " << R.getName() << "Attr *SA = cast<" << R.getName()
+         << "Attr>(A);\n";
+    for (ai = Args.begin(), ae = Args.end(); ai != ae; ++ai)
+      createArgument(**ai, R.getName())->writePCHWrite(OS);
+    OS << "    break;\n";
+    OS << "  }\n";
+  }
+  OS << "  }\n";
+}
+
+void ClangAttrSpellingListEmitter::run(raw_ostream &OS) {
+  OS << "// This file is generated by TableGen. Do not edit.\n\n";
+
+  std::vector<Record*> Attrs = Records.getAllDerivedDefinitions("Attr");
+  
+  for (std::vector<Record*>::iterator I = Attrs.begin(), E = Attrs.end(); I != E; ++I) {
+    Record &Attr = **I;
+
+    std::vector<StringRef> Spellings = getValueAsListOfStrings(Attr, "Spellings");
+
+    for (std::vector<StringRef>::const_iterator I = Spellings.begin(), E = Spellings.end(); I != E; ++I) {
+      StringRef Spelling = *I;
+      OS << ".Case(\"" << Spelling << "\", true)\n";
+    }
+  }
+
+}

Modified: llvm/branches/wendling/eh/utils/TableGen/ClangAttrEmitter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/TableGen/ClangAttrEmitter.h?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/TableGen/ClangAttrEmitter.h (original)
+++ llvm/branches/wendling/eh/utils/TableGen/ClangAttrEmitter.h Tue Oct 26 19:48:03 2010
@@ -31,6 +31,19 @@
   void run(raw_ostream &OS);
 };
 
+/// ClangAttrImplEmitter - class emits the class method defintions for
+///   attributes for clang.
+class ClangAttrImplEmitter : public TableGenBackend {
+  RecordKeeper &Records;
+ 
+ public:
+  explicit ClangAttrImplEmitter(RecordKeeper &R)
+    : Records(R)
+    {}
+
+  void run(raw_ostream &OS);
+};
+
 /// ClangAttrListEmitter - class emits the enumeration list for attributes for
 ///   clang.
 class ClangAttrListEmitter : public TableGenBackend {
@@ -44,6 +57,45 @@
   void run(raw_ostream &OS);
 };
 
+/// ClangAttrPCHReadEmitter - class emits the code to read an attribute from
+///   a clang precompiled header.
+class ClangAttrPCHReadEmitter : public TableGenBackend {
+  RecordKeeper &Records;
+
+public:
+  explicit ClangAttrPCHReadEmitter(RecordKeeper &R)
+    : Records(R)
+    {}
+
+  void run(raw_ostream &OS);
+};
+
+/// ClangAttrPCHWriteEmitter - class emits the code to read an attribute from
+///   a clang precompiled header.
+class ClangAttrPCHWriteEmitter : public TableGenBackend {
+  RecordKeeper &Records;
+
+public:
+  explicit ClangAttrPCHWriteEmitter(RecordKeeper &R)
+    : Records(R)
+    {}
+
+  void run(raw_ostream &OS);
+};
+
+/// ClangAttrSpellingListEmitter - class emits the list of spellings for attributes for
+///   clang.
+class ClangAttrSpellingListEmitter : public TableGenBackend {
+  RecordKeeper &Records;
+
+ public:
+  explicit ClangAttrSpellingListEmitter(RecordKeeper &R)
+    : Records(R)
+    {}
+
+  void run(raw_ostream &OS);
+};
+
 }
 
 #endif

Modified: llvm/branches/wendling/eh/utils/TableGen/CodeEmitterGen.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/TableGen/CodeEmitterGen.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/TableGen/CodeEmitterGen.cpp (original)
+++ llvm/branches/wendling/eh/utils/TableGen/CodeEmitterGen.cpp Tue Oct 26 19:48:03 2010
@@ -42,7 +42,7 @@
       unsigned middle = (numBits + 1) / 2;
       NewBI->setBit(middle, BI->getBit(middle));
     }
-    
+
     // Update the bits in reversed order so that emitInstrOpBits will get the
     // correct endianness.
     R->getValue("Inst")->setValue(NewBI);
@@ -56,32 +56,32 @@
             BitsInit *BI, int bit) {
   if (VarBitInit *VBI = dynamic_cast<VarBitInit*>(BI->getBit(bit))) {
     TypedInit *TI = VBI->getVariable();
-    
+
     if (VarInit *VI = dynamic_cast<VarInit*>(TI)) {
       if (VI->getName() == VarName) return VBI->getBitNum();
     }
   }
-  
+
   return -1;
-} 
+}
 
 
 void CodeEmitterGen::run(raw_ostream &o) {
   CodeGenTarget Target;
   std::vector<Record*> Insts = Records.getAllDerivedDefinitions("Instruction");
-  
+
   // For little-endian instruction bit encodings, reverse the bit order
   if (Target.isLittleEndianEncoding()) reverseBits(Insts);
 
   EmitSourceFileHeader("Machine Code Emitter", o);
   std::string Namespace = Insts[0]->getValueAsString("Namespace") + "::";
-  
+
   const std::vector<const CodeGenInstruction*> &NumberedInstructions =
     Target.getInstructionsByEnumValue();
 
   // Emit function declaration
   o << "unsigned " << Target.getName() << "CodeEmitter::"
-    << "getBinaryCodeForInstr(const MachineInstr &MI) {\n";
+    << "getBinaryCodeForInstr(const MachineInstr &MI) const {\n";
 
   // Emit instruction base values
   o << "  static const unsigned InstBits[] = {\n";
@@ -91,12 +91,12 @@
        IN != EN; ++IN) {
     const CodeGenInstruction *CGI = *IN;
     Record *R = CGI->TheDef;
-    
+
     if (R->getValueAsString("Namespace") == "TargetOpcode") {
       o << "    0U,\n";
       continue;
     }
-    
+
     BitsInit *BI = R->getValueAsBitsInit("Inst");
 
     // Start by filling in fixed values...
@@ -109,10 +109,10 @@
     o << "    " << Value << "U," << '\t' << "// " << R->getName() << "\n";
   }
   o << "    0U\n  };\n";
-  
+
   // Map to accumulate all the cases.
   std::map<std::string, std::vector<std::string> > CaseMap;
-  
+
   // Construct all cases statement for each opcode
   for (std::vector<Record*>::iterator IC = Insts.begin(), EC = Insts.end();
         IC != EC; ++IC) {
@@ -125,27 +125,27 @@
     BitsInit *BI = R->getValueAsBitsInit("Inst");
     const std::vector<RecordVal> &Vals = R->getValues();
     CodeGenInstruction &CGI = Target.getInstruction(R);
-    
+
     // Loop over all of the fields in the instruction, determining which are the
     // operands to the instruction.
-    unsigned op = 0;
+    unsigned NumberedOp = 0;
     for (unsigned i = 0, e = Vals.size(); i != e; ++i) {
       if (!Vals[i].getPrefix() && !Vals[i].getValue()->isComplete()) {
         // Is the operand continuous? If so, we can just mask and OR it in
         // instead of doing it bit-by-bit, saving a lot in runtime cost.
         const std::string &VarName = Vals[i].getName();
         bool gotOp = false;
-        
+
         for (int bit = BI->getNumBits()-1; bit >= 0; ) {
           int varBit = getVariableBit(VarName, BI, bit);
-          
+
           if (varBit == -1) {
             --bit;
           } else {
             int beginInstBit = bit;
             int beginVarBit = varBit;
             int N = 1;
-            
+
             for (--bit; bit >= 0;) {
               varBit = getVariableBit(VarName, BI, bit);
               if (varBit == -1 || varBit != (beginVarBit - N)) break;
@@ -154,22 +154,50 @@
             }
 
             if (!gotOp) {
-              /// If this operand is not supposed to be emitted by the generated
-              /// emitter, skip it.
-              while (CGI.isFlatOperandNotEmitted(op))
-                ++op;
-              
-              Case += "      // op: " + VarName + "\n"
-                   +  "      op = getMachineOpValue(MI, MI.getOperand("
-                   +  utostr(op++) + "));\n";
+              // If the operand matches by name, reference according to that
+              // operand number. Non-matching operands are assumed to be in
+              // order.
+              unsigned OpIdx;
+              if (CGI.hasOperandNamed(VarName, OpIdx)) {
+                // Get the machine operand number for the indicated operand.
+                OpIdx = CGI.OperandList[OpIdx].MIOperandNo;
+                assert (!CGI.isFlatOperandNotEmitted(OpIdx) &&
+                        "Explicitly used operand also marked as not emitted!");
+              } else {
+                /// If this operand is not supposed to be emitted by the
+                /// generated emitter, skip it.
+                while (CGI.isFlatOperandNotEmitted(NumberedOp))
+                  ++NumberedOp;
+                OpIdx = NumberedOp++;
+              }
+              std::pair<unsigned, unsigned> SO = CGI.getSubOperandNumber(OpIdx);
+              std::string &EncoderMethodName =
+                CGI.OperandList[SO.first].EncoderMethodName;
+
+              // If the source operand has a custom encoder, use it. This will
+              // get the encoding for all of the suboperands.
+              if (!EncoderMethodName.empty()) {
+                // A custom encoder has all of the information for the
+                // sub-operands, if there are more than one, so only
+                // query the encoder once per source operand.
+                if (SO.second == 0) {
+                  Case += "      // op: " + VarName + "\n"
+                       + "      op = " + EncoderMethodName + "(MI, "
+                       + utostr(OpIdx) + ");\n";
+                }
+              } else {
+                Case += "      // op: " + VarName + "\n"
+                     +  "      op = getMachineOpValue(MI, MI.getOperand("
+                     +  utostr(OpIdx) + "));\n";
+              }
               gotOp = true;
             }
-            
+
             unsigned opMask = ~0U >> (32-N);
             int opShift = beginVarBit - N + 1;
             opMask <<= opShift;
             opShift = beginInstBit - beginVarBit;
-            
+
             if (opShift > 0) {
               Case += "      Value |= (op & " + utostr(opMask) + "U) << "
                    +  itostr(opShift) + ";\n";

Modified: llvm/branches/wendling/eh/utils/TableGen/CodeGenDAGPatterns.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/TableGen/CodeGenDAGPatterns.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/TableGen/CodeGenDAGPatterns.cpp (original)
+++ llvm/branches/wendling/eh/utils/TableGen/CodeGenDAGPatterns.cpp Tue Oct 26 19:48:03 2010
@@ -473,18 +473,21 @@
 }
 
 //! Dump the dependent variable set:
+#ifndef NDEBUG
 void DumpDepVars(MultipleUseVarSet &DepVars) {
   if (DepVars.empty()) {
     DEBUG(errs() << "<empty set>");
   } else {
     DEBUG(errs() << "[ ");
-    for (MultipleUseVarSet::const_iterator i = DepVars.begin(), e = DepVars.end();
-         i != e; ++i) {
+    for (MultipleUseVarSet::const_iterator i = DepVars.begin(),
+         e = DepVars.end(); i != e; ++i) {
       DEBUG(errs() << (*i) << " ");
     }
     DEBUG(errs() << "]");
   }
 }
+#endif
+
 }
 
 //===----------------------------------------------------------------------===//
@@ -2197,10 +2200,10 @@
       if (IntInfo->ModRef >= CodeGenIntrinsic::ReadArgMem)
         mayLoad = true;// These may load memory.
 
-      if (IntInfo->ModRef >= CodeGenIntrinsic::WriteArgMem)
+      if (IntInfo->ModRef >= CodeGenIntrinsic::ReadWriteArgMem)
         mayStore = true;// Intrinsics that can write to memory are 'mayStore'.
 
-      if (IntInfo->ModRef >= CodeGenIntrinsic::WriteMem)
+      if (IntInfo->ModRef >= CodeGenIntrinsic::ReadWriteMem)
         // WriteMem intrinsics can have other strange effects.
         HasSideEffects = true;
     }
@@ -2970,7 +2973,8 @@
     DEBUG(errs() << "Dependent/multiply used variables: ");
     DEBUG(DumpDepVars(DepVars));
     DEBUG(errs() << "\n");
-    GenerateVariantsOf(PatternsToMatch[i].getSrcPattern(), Variants, *this, DepVars);
+    GenerateVariantsOf(PatternsToMatch[i].getSrcPattern(), Variants, *this,
+                       DepVars);
 
     assert(!Variants.empty() && "Must create at least original variant!");
     Variants.erase(Variants.begin());  // Remove the original pattern.
@@ -2997,7 +3001,8 @@
             PatternsToMatch[p].getPredicates())
           continue;
         // Check to see if this variant already exists.
-        if (Variant->isIsomorphicTo(PatternsToMatch[p].getSrcPattern(), DepVars)) {
+        if (Variant->isIsomorphicTo(PatternsToMatch[p].getSrcPattern(),
+                                    DepVars)) {
           DEBUG(errs() << "  *** ALREADY EXISTS, ignoring variant.\n");
           AlreadyExists = true;
           break;

Modified: llvm/branches/wendling/eh/utils/TableGen/CodeGenInstruction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/TableGen/CodeGenInstruction.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/TableGen/CodeGenInstruction.cpp (original)
+++ llvm/branches/wendling/eh/utils/TableGen/CodeGenInstruction.cpp Tue Oct 26 19:48:03 2010
@@ -166,10 +166,14 @@
 
     Record *Rec = Arg->getDef();
     std::string PrintMethod = "printOperand";
+    std::string EncoderMethod;
     unsigned NumOps = 1;
     DagInit *MIOpInfo = 0;
     if (Rec->isSubClassOf("Operand")) {
       PrintMethod = Rec->getValueAsString("PrintMethod");
+      // If there is an explicit encoder method, use it.
+      if (Rec->getValue("EncoderMethod"))
+        EncoderMethod = Rec->getValueAsString("EncoderMethod");
       MIOpInfo = Rec->getValueAsDag("MIOperandInfo");
 
       // Verify that MIOpInfo has an 'ops' root value.
@@ -204,7 +208,7 @@
       throw "In instruction '" + R->getName() + "', operand #" + utostr(i) +
         " has the same name as a previous operand!";
 
-    OperandList.push_back(OperandInfo(Rec, ArgName, PrintMethod,
+    OperandList.push_back(OperandInfo(Rec, ArgName, PrintMethod, EncoderMethod,
                                       MIOperandNo, NumOps, MIOpInfo));
     MIOperandNo += NumOps;
   }
@@ -234,13 +238,26 @@
 /// specified name, throw an exception.
 ///
 unsigned CodeGenInstruction::getOperandNamed(const std::string &Name) const {
-  assert(!Name.empty() && "Cannot search for operand with no name!");
-  for (unsigned i = 0, e = OperandList.size(); i != e; ++i)
-    if (OperandList[i].Name == Name) return i;
+  unsigned OpIdx;
+  if (hasOperandNamed(Name, OpIdx)) return OpIdx;
   throw "Instruction '" + TheDef->getName() +
         "' does not have an operand named '$" + Name + "'!";
 }
 
+/// hasOperandNamed - Query whether the instruction has an operand of the
+/// given name. If so, return true and set OpIdx to the index of the
+/// operand. Otherwise, return false.
+bool CodeGenInstruction::hasOperandNamed(const std::string &Name,
+                                         unsigned &OpIdx) const {
+  assert(!Name.empty() && "Cannot search for operand with no name!");
+  for (unsigned i = 0, e = OperandList.size(); i != e; ++i)
+    if (OperandList[i].Name == Name) {
+      OpIdx = i;
+      return true;
+    }
+  return false;
+}
+
 std::pair<unsigned,unsigned>
 CodeGenInstruction::ParseOperandName(const std::string &Op,
                                      bool AllowWholeOp) {

Modified: llvm/branches/wendling/eh/utils/TableGen/CodeGenInstruction.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/TableGen/CodeGenInstruction.h?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/TableGen/CodeGenInstruction.h (original)
+++ llvm/branches/wendling/eh/utils/TableGen/CodeGenInstruction.h Tue Oct 26 19:48:03 2010
@@ -32,7 +32,7 @@
     /// AsmString - The format string used to emit a .s file for the
     /// instruction.
     std::string AsmString;
-    
+
     class ConstraintInfo {
       enum { None, EarlyClobber, Tied } Kind;
       unsigned OtherTiedOperand;
@@ -45,24 +45,24 @@
         I.OtherTiedOperand = 0;
         return I;
       }
-      
+
       static ConstraintInfo getTied(unsigned Op) {
         ConstraintInfo I;
         I.Kind = Tied;
         I.OtherTiedOperand = Op;
         return I;
       }
-      
+
       bool isNone() const { return Kind == None; }
       bool isEarlyClobber() const { return Kind == EarlyClobber; }
       bool isTied() const { return Kind == Tied; }
-      
+
       unsigned getTiedOperand() const {
         assert(isTied());
         return OtherTiedOperand;
       }
     };
-    
+
     /// OperandInfo - The information we keep track of for each operand in the
     /// operand list for a tablegen instruction.
     struct OperandInfo {
@@ -78,6 +78,10 @@
       /// the asmprinter.
       std::string PrinterMethodName;
 
+      /// EncoderMethodName - The method used to get the machine operand value
+      /// for binary encoding. "getMachineOpValue" by default.
+      std::string EncoderMethodName;
+
       /// MIOperandNo - Currently (this is meant to be phased out), some logical
       /// operands correspond to multiple MachineInstr operands.  In the X86
       /// target for example, one address operand is represented as 4
@@ -91,19 +95,20 @@
       /// the DisableEncoding list.  These should not be emitted by the code
       /// emitter.
       std::vector<bool> DoNotEncode;
-      
+
       /// MIOperandInfo - Default MI operand type. Note an operand may be made
       /// up of multiple MI operands.
       DagInit *MIOperandInfo;
-      
+
       /// Constraint info for this operand.  This operand can have pieces, so we
       /// track constraint info for each.
       std::vector<ConstraintInfo> Constraints;
 
-      OperandInfo(Record *R, const std::string &N, const std::string &PMN, 
-                  unsigned MION, unsigned MINO, DagInit *MIOI)
-        : Rec(R), Name(N), PrinterMethodName(PMN), MIOperandNo(MION),
-          MINumOperands(MINO), MIOperandInfo(MIOI) {}
+      OperandInfo(Record *R, const std::string &N, const std::string &PMN,
+                  const std::string &EMN, unsigned MION, unsigned MINO,
+                  DagInit *MIOI)
+        : Rec(R), Name(N), PrinterMethodName(PMN), EncoderMethodName(EMN),
+          MIOperandNo(MION), MINumOperands(MINO), MIOperandInfo(MIOI) {}
     };
 
     /// NumDefs - Number of def operands declared, this is the number of
@@ -144,7 +149,7 @@
     bool isAsCheapAsAMove;
     bool hasExtraSrcRegAllocReq;
     bool hasExtraDefRegAllocReq;
-    
+
     /// ParseOperandName - Parse an operand name like "$foo" or "$foo.bar",
     /// where $foo is a whole operand and $foo.bar refers to a suboperand.
     /// This throws an exception if the name is invalid.  If AllowWholeOp is
@@ -152,13 +157,13 @@
     /// not.
     std::pair<unsigned,unsigned> ParseOperandName(const std::string &Op,
                                                   bool AllowWholeOp = true);
-    
+
     /// getFlattenedOperandNumber - Flatten a operand/suboperand pair into a
     /// flat machineinstr operand #.
     unsigned getFlattenedOperandNumber(std::pair<unsigned,unsigned> Op) const {
       return OperandList[Op.first].MIOperandNo + Op.second;
     }
-    
+
     /// getSubOperandNumber - Unflatten a operand number into an
     /// operand/suboperand pair.
     std::pair<unsigned,unsigned> getSubOperandNumber(unsigned Op) const {
@@ -168,8 +173,8 @@
           return std::make_pair(i, Op-OperandList[i].MIOperandNo);
       }
     }
-    
-    
+
+
     /// isFlatOperandNotEmitted - Return true if the specified flat operand #
     /// should not be emitted with the code emitter.
     bool isFlatOperandNotEmitted(unsigned FlatOpNo) const {
@@ -185,11 +190,16 @@
     /// non-empty name.  If the instruction does not have an operand with the
     /// specified name, throw an exception.
     unsigned getOperandNamed(const std::string &Name) const;
-    
+
+    /// hasOperandNamed - Query whether the instruction has an operand of the
+    /// given name. If so, return true and set OpIdx to the index of the
+    /// operand. Otherwise, return false.
+    bool hasOperandNamed(const std::string &Name, unsigned &OpIdx) const;
+
     /// HasOneImplicitDefWithKnownVT - If the instruction has at least one
     /// implicit def and it has a known VT, return the VT, otherwise return
     /// MVT::Other.
-    MVT::SimpleValueType 
+    MVT::SimpleValueType
       HasOneImplicitDefWithKnownVT(const CodeGenTarget &TargetInfo) const;
   };
 }

Modified: llvm/branches/wendling/eh/utils/TableGen/CodeGenIntrinsics.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/TableGen/CodeGenIntrinsics.h?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/TableGen/CodeGenIntrinsics.h (original)
+++ llvm/branches/wendling/eh/utils/TableGen/CodeGenIntrinsics.h Tue Oct 26 19:48:03 2010
@@ -60,7 +60,7 @@
 
     // Memory mod/ref behavior of this intrinsic.
     enum {
-      NoMem, ReadArgMem, ReadMem, WriteArgMem, WriteMem
+      NoMem, ReadArgMem, ReadMem, ReadWriteArgMem, ReadWriteMem
     } ModRef;
 
     /// This is set to true if the intrinsic is overloaded by its argument

Modified: llvm/branches/wendling/eh/utils/TableGen/CodeGenRegisters.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/TableGen/CodeGenRegisters.h?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/TableGen/CodeGenRegisters.h (original)
+++ llvm/branches/wendling/eh/utils/TableGen/CodeGenRegisters.h Tue Oct 26 19:48:03 2010
@@ -19,6 +19,7 @@
 #include "llvm/ADT/DenseMap.h"
 #include <string>
 #include <vector>
+#include <set>
 #include <cstdlib>
 
 namespace llvm {
@@ -55,6 +56,37 @@
       assert(0 && "VTNum greater than number of ValueTypes in RegClass!");
       abort();
     }
+    
+    // Returns true if RC is a strict subclass.
+    // RC is a sub-class of this class if it is a valid replacement for any
+    // instruction operand where a register of this classis required. It must 
+    // satisfy these conditions:
+    //
+    // 1. All RC registers are also in this.
+    // 2. The RC spill size must not be smaller than our spill size.
+    // 3. RC spill alignment must be compatible with ours.
+    //
+    bool hasSubClass(const CodeGenRegisterClass *RC) const {
+
+      if (RC->Elements.size() > Elements.size() ||
+          (SpillAlignment && RC->SpillAlignment % SpillAlignment) ||
+          SpillSize > RC->SpillSize)
+        return false;
+
+      std::set<Record*> RegSet;
+      for (unsigned i = 0, e = Elements.size(); i != e; ++i) {
+        Record *Reg = Elements[i];
+        RegSet.insert(Reg);
+      }
+
+      for (unsigned i = 0, e = RC->Elements.size(); i != e; ++i) {
+        Record *Reg = RC->Elements[i];
+        if (!RegSet.count(Reg))
+          return false;
+      }
+
+      return true;
+    }
 
     CodeGenRegisterClass(Record *R);
   };

Modified: llvm/branches/wendling/eh/utils/TableGen/CodeGenTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/TableGen/CodeGenTarget.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/TableGen/CodeGenTarget.cpp (original)
+++ llvm/branches/wendling/eh/utils/TableGen/CodeGenTarget.cpp Tue Oct 26 19:48:03 2010
@@ -48,46 +48,47 @@
 
 std::string llvm::getEnumName(MVT::SimpleValueType T) {
   switch (T) {
-  case MVT::Other: return "MVT::Other";
-  case MVT::i1:    return "MVT::i1";
-  case MVT::i8:    return "MVT::i8";
-  case MVT::i16:   return "MVT::i16";
-  case MVT::i32:   return "MVT::i32";
-  case MVT::i64:   return "MVT::i64";
-  case MVT::i128:  return "MVT::i128";
-  case MVT::iAny:  return "MVT::iAny";
-  case MVT::fAny:  return "MVT::fAny";
-  case MVT::vAny:  return "MVT::vAny";
-  case MVT::f32:   return "MVT::f32";
-  case MVT::f64:   return "MVT::f64";
-  case MVT::f80:   return "MVT::f80";
-  case MVT::f128:  return "MVT::f128";
+  case MVT::Other:    return "MVT::Other";
+  case MVT::i1:       return "MVT::i1";
+  case MVT::i8:       return "MVT::i8";
+  case MVT::i16:      return "MVT::i16";
+  case MVT::i32:      return "MVT::i32";
+  case MVT::i64:      return "MVT::i64";
+  case MVT::i128:     return "MVT::i128";
+  case MVT::iAny:     return "MVT::iAny";
+  case MVT::fAny:     return "MVT::fAny";
+  case MVT::vAny:     return "MVT::vAny";
+  case MVT::f32:      return "MVT::f32";
+  case MVT::f64:      return "MVT::f64";
+  case MVT::f80:      return "MVT::f80";
+  case MVT::f128:     return "MVT::f128";
   case MVT::ppcf128:  return "MVT::ppcf128";
-  case MVT::Flag:  return "MVT::Flag";
-  case MVT::isVoid:return "MVT::isVoid";
-  case MVT::v2i8:  return "MVT::v2i8";
-  case MVT::v4i8:  return "MVT::v4i8";
-  case MVT::v8i8:  return "MVT::v8i8";
-  case MVT::v16i8: return "MVT::v16i8";
-  case MVT::v32i8: return "MVT::v32i8";
-  case MVT::v2i16: return "MVT::v2i16";
-  case MVT::v4i16: return "MVT::v4i16";
-  case MVT::v8i16: return "MVT::v8i16";
-  case MVT::v16i16: return "MVT::v16i16";
-  case MVT::v2i32: return "MVT::v2i32";
-  case MVT::v4i32: return "MVT::v4i32";
-  case MVT::v8i32: return "MVT::v8i32";
-  case MVT::v1i64: return "MVT::v1i64";
-  case MVT::v2i64: return "MVT::v2i64";
-  case MVT::v4i64: return "MVT::v4i64";
-  case MVT::v8i64: return "MVT::v8i64";
-  case MVT::v2f32: return "MVT::v2f32";
-  case MVT::v4f32: return "MVT::v4f32";
-  case MVT::v8f32: return "MVT::v8f32";
-  case MVT::v2f64: return "MVT::v2f64";
-  case MVT::v4f64: return "MVT::v4f64";
+  case MVT::x86mmx:   return "MVT::x86mmx";
+  case MVT::Flag:     return "MVT::Flag";
+  case MVT::isVoid:   return "MVT::isVoid";
+  case MVT::v2i8:     return "MVT::v2i8";
+  case MVT::v4i8:     return "MVT::v4i8";
+  case MVT::v8i8:     return "MVT::v8i8";
+  case MVT::v16i8:    return "MVT::v16i8";
+  case MVT::v32i8:    return "MVT::v32i8";
+  case MVT::v2i16:    return "MVT::v2i16";
+  case MVT::v4i16:    return "MVT::v4i16";
+  case MVT::v8i16:    return "MVT::v8i16";
+  case MVT::v16i16:   return "MVT::v16i16";
+  case MVT::v2i32:    return "MVT::v2i32";
+  case MVT::v4i32:    return "MVT::v4i32";
+  case MVT::v8i32:    return "MVT::v8i32";
+  case MVT::v1i64:    return "MVT::v1i64";
+  case MVT::v2i64:    return "MVT::v2i64";
+  case MVT::v4i64:    return "MVT::v4i64";
+  case MVT::v8i64:    return "MVT::v8i64";
+  case MVT::v2f32:    return "MVT::v2f32";
+  case MVT::v4f32:    return "MVT::v4f32";
+  case MVT::v8f32:    return "MVT::v8f32";
+  case MVT::v2f64:    return "MVT::v2f64";
+  case MVT::v4f64:    return "MVT::v4f64";
   case MVT::Metadata: return "MVT::Metadata";
-  case MVT::iPTR:  return "MVT::iPTR";
+  case MVT::iPTR:     return "MVT::iPTR";
   case MVT::iPTRAny:  return "MVT::iPTRAny";
   default: assert(0 && "ILLEGAL VALUE TYPE!"); return "";
   }
@@ -406,6 +407,10 @@
       Properties |= 1 << SDNPMemOperand;
     } else if (PropList[i]->getName() == "SDNPVariadic") {
       Properties |= 1 << SDNPVariadic;
+    } else if (PropList[i]->getName() == "SDNPWantRoot") {
+      Properties |= 1 << SDNPWantRoot;
+    } else if (PropList[i]->getName() == "SDNPWantParent") {
+      Properties |= 1 << SDNPWantParent;
     } else {
       errs() << "Unsupported SD Node property '" << PropList[i]->getName()
              << "' on ComplexPattern '" << R->getName() << "'!\n";
@@ -434,7 +439,7 @@
 CodeGenIntrinsic::CodeGenIntrinsic(Record *R) {
   TheDef = R;
   std::string DefName = R->getName();
-  ModRef = WriteMem;
+  ModRef = ReadWriteMem;
   isOverloaded = false;
   isCommutative = false;
   
@@ -555,10 +560,8 @@
       ModRef = ReadArgMem;
     else if (Property->getName() == "IntrReadMem")
       ModRef = ReadMem;
-    else if (Property->getName() == "IntrWriteArgMem")
-      ModRef = WriteArgMem;
-    else if (Property->getName() == "IntrWriteMem")
-      ModRef = WriteMem;
+    else if (Property->getName() == "IntrReadWriteArgMem")
+      ModRef = ReadWriteArgMem;
     else if (Property->getName() == "Commutative")
       isCommutative = true;
     else if (Property->isSubClassOf("NoCapture")) {

Modified: llvm/branches/wendling/eh/utils/TableGen/CodeGenTarget.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/TableGen/CodeGenTarget.h?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/TableGen/CodeGenTarget.h (original)
+++ llvm/branches/wendling/eh/utils/TableGen/CodeGenTarget.h Tue Oct 26 19:48:03 2010
@@ -42,7 +42,9 @@
   SDNPMayStore,
   SDNPSideEffect,
   SDNPMemOperand,
-  SDNPVariadic
+  SDNPVariadic,
+  SDNPWantRoot,
+  SDNPWantParent
 };
 
 /// getValueType - Return the MVT::SimpleValueType that the specified TableGen

Modified: llvm/branches/wendling/eh/utils/TableGen/DAGISelEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/TableGen/DAGISelEmitter.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/TableGen/DAGISelEmitter.cpp (original)
+++ llvm/branches/wendling/eh/utils/TableGen/DAGISelEmitter.cpp Tue Oct 26 19:48:03 2010
@@ -57,51 +57,6 @@
   return Cost;
 }
 
-//===----------------------------------------------------------------------===//
-// Predicate emitter implementation.
-//
-
-void DAGISelEmitter::EmitPredicateFunctions(raw_ostream &OS) {
-  OS << "\n// Predicate functions.\n";
-
-  // Walk the pattern fragments, adding them to a map, which sorts them by
-  // name.
-  typedef std::map<std::string, std::pair<Record*, TreePattern*> > PFsByNameTy;
-  PFsByNameTy PFsByName;
-
-  for (CodeGenDAGPatterns::pf_iterator I = CGP.pf_begin(), E = CGP.pf_end();
-       I != E; ++I)
-    PFsByName.insert(std::make_pair(I->first->getName(), *I));
-
-  
-  for (PFsByNameTy::iterator I = PFsByName.begin(), E = PFsByName.end();
-       I != E; ++I) {
-    Record *PatFragRecord = I->second.first;// Record that derives from PatFrag.
-    TreePattern *P = I->second.second;
-    
-    // If there is a code init for this fragment, emit the predicate code.
-    std::string Code = PatFragRecord->getValueAsCode("Predicate");
-    if (Code.empty()) continue;
-    
-    if (P->getOnlyTree()->isLeaf())
-      OS << "inline bool Predicate_" << PatFragRecord->getName()
-      << "(SDNode *N) const {\n";
-    else {
-      std::string ClassName =
-        CGP.getSDNodeInfo(P->getOnlyTree()->getOperator()).getSDClassName();
-      const char *C2 = ClassName == "SDNode" ? "N" : "inN";
-      
-      OS << "inline bool Predicate_" << PatFragRecord->getName()
-         << "(SDNode *" << C2 << ") const {\n";
-      if (ClassName != "SDNode")
-        OS << "  " << ClassName << " *N = cast<" << ClassName << ">(inN);\n";
-    }
-    OS << Code << "\n}\n";
-  }
-  
-  OS << "\n\n";
-}
-
 namespace {
 // PatternSortingPredicate - return true if we prefer to match LHS before RHS.
 // In particular, we want to match maximal patterns first and lowest cost within
@@ -168,9 +123,6 @@
           errs() << "\n";
         });
 
-  // FIXME: These are being used by hand written code, gross.
-  EmitPredicateFunctions(OS);
-
   // Add all the patterns to a temporary list so we can sort them.
   std::vector<const PatternToMatch*> Patterns;
   for (CodeGenDAGPatterns::ptm_iterator I = CGP.ptm_begin(), E = CGP.ptm_end();

Modified: llvm/branches/wendling/eh/utils/TableGen/DAGISelEmitter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/TableGen/DAGISelEmitter.h?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/TableGen/DAGISelEmitter.h (original)
+++ llvm/branches/wendling/eh/utils/TableGen/DAGISelEmitter.h Tue Oct 26 19:48:03 2010
@@ -31,8 +31,6 @@
 
   // run - Output the isel, returning true on failure.
   void run(raw_ostream &OS);
-private:
-  void EmitPredicateFunctions(raw_ostream &OS);
 };
 
 } // End llvm namespace

Modified: llvm/branches/wendling/eh/utils/TableGen/DAGISelMatcherEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/TableGen/DAGISelMatcherEmitter.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/TableGen/DAGISelMatcherEmitter.cpp (original)
+++ llvm/branches/wendling/eh/utils/TableGen/DAGISelMatcherEmitter.cpp Tue Oct 26 19:48:03 2010
@@ -7,7 +7,7 @@
 //
 //===----------------------------------------------------------------------===//
 //
-// This file contains code to generate C++ code a matcher.
+// This file contains code to generate C++ code for a matcher.
 //
 //===----------------------------------------------------------------------===//
 
@@ -633,8 +633,9 @@
   // Emit CompletePattern matchers.
   // FIXME: This should be const.
   if (!ComplexPatterns.empty()) {
-    OS << "bool CheckComplexPattern(SDNode *Root, SDValue N,\n";
-    OS << "      unsigned PatternNo, SmallVectorImpl<SDValue> &Result) {\n";
+    OS << "bool CheckComplexPattern(SDNode *Root, SDNode *Parent, SDValue N,\n";
+    OS << "                         unsigned PatternNo,\n";
+    OS << "         SmallVectorImpl<std::pair<SDValue, SDNode*> > &Result) {\n";
     OS << "  unsigned NextRes = Result.size();\n";
     OS << "  switch (PatternNo) {\n";
     OS << "  default: assert(0 && \"Invalid pattern # in table?\");\n";
@@ -649,9 +650,20 @@
       OS << "    Result.resize(NextRes+" << NumOps << ");\n";
       OS << "    return "  << P.getSelectFunc();
 
-      OS << "(Root, N";
+      OS << "(";
+      // If the complex pattern wants the root of the match, pass it in as the
+      // first argument.
+      if (P.hasProperty(SDNPWantRoot))
+        OS << "Root, ";
+      
+      // If the complex pattern wants the parent of the operand being matched,
+      // pass it in as the next argument.
+      if (P.hasProperty(SDNPWantParent))
+        OS << "Parent, ";
+      
+      OS << "N";
       for (unsigned i = 0; i != NumOps; ++i)
-        OS << ", Result[NextRes+" << i << ']';
+        OS << ", Result[NextRes+" << i << "].first";
       OS << ");\n";
     }
     OS << "  }\n";

Modified: llvm/branches/wendling/eh/utils/TableGen/DAGISelMatcherGen.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/TableGen/DAGISelMatcherGen.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/TableGen/DAGISelMatcherGen.cpp (original)
+++ llvm/branches/wendling/eh/utils/TableGen/DAGISelMatcherGen.cpp Tue Oct 26 19:48:03 2010
@@ -102,7 +102,6 @@
     void EmitResultCode();
     
     Matcher *GetMatcher() const { return TheMatcher; }
-    Matcher *GetCurPredicate() const { return CurPredicate; }
   private:
     void AddMatcher(Matcher *NewNode);
     void InferPossibleTypes();
@@ -689,8 +688,8 @@
         !CGP.getDefaultOperand(OperandNode).DefaultOps.empty()) {
       // This is a predicate or optional def operand; emit the
       // 'default ops' operands.
-      const DAGDefaultOperand &DefaultOp =
-        CGP.getDefaultOperand(II.OperandList[InstOpNo].Rec);
+      const DAGDefaultOperand &DefaultOp
+	= CGP.getDefaultOperand(OperandNode);
       for (unsigned i = 0, e = DefaultOp.DefaultOps.size(); i != e; ++i)
         EmitResultOperand(DefaultOp.DefaultOps[i], InstOps);
       continue;
@@ -908,6 +907,3 @@
   // Unconditional match.
   return Gen.GetMatcher();
 }
-
-
-

Modified: llvm/branches/wendling/eh/utils/TableGen/EDEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/TableGen/EDEmitter.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/TableGen/EDEmitter.cpp (original)
+++ llvm/branches/wendling/eh/utils/TableGen/EDEmitter.cpp Tue Oct 26 19:48:03 2010
@@ -35,22 +35,22 @@
 ///////////////////////////////////////////////////////////
 
 namespace {
-  
+
   class EnumEmitter {
   private:
     std::string Name;
     std::vector<std::string> Entries;
   public:
-    EnumEmitter(const char *N) : Name(N) { 
+    EnumEmitter(const char *N) : Name(N) {
     }
-    int addEntry(const char *e) { 
+    int addEntry(const char *e) {
       Entries.push_back(std::string(e));
-      return Entries.size() - 1; 
+      return Entries.size() - 1;
     }
     void emit(raw_ostream &o, unsigned int &i) {
       o.indent(i) << "enum " << Name.c_str() << " {" << "\n";
       i += 2;
-      
+
       unsigned int index = 0;
       unsigned int numEntries = Entries.size();
       for (index = 0; index < numEntries; ++index) {
@@ -59,15 +59,15 @@
           o << ",";
         o << "\n";
       }
-      
+
       i -= 2;
       o.indent(i) << "};" << "\n";
     }
-    
+
     void emitAsFlags(raw_ostream &o, unsigned int &i) {
       o.indent(i) << "enum " << Name.c_str() << " {" << "\n";
       i += 2;
-      
+
       unsigned int index = 0;
       unsigned int numEntries = Entries.size();
       unsigned int flag = 1;
@@ -78,46 +78,18 @@
         o << "\n";
         flag <<= 1;
       }
-      
-      i -= 2;
-      o.indent(i) << "};" << "\n";
-    }
-  };
 
-  class StructEmitter {
-  private:
-    std::string Name;
-    typedef std::pair<const char*, const char*> member;
-    std::vector< member > Members;
-  public:
-    StructEmitter(const char *N) : Name(N) {
-    }
-    void addMember(const char *t, const char *n) {
-      member m(t, n);
-      Members.push_back(m);
-    }
-    void emit(raw_ostream &o, unsigned int &i) {
-      o.indent(i) << "struct " << Name.c_str() << " {" << "\n";
-      i += 2;
-      
-      unsigned int index = 0;
-      unsigned int numMembers = Members.size();
-      for (index = 0; index < numMembers; ++index) {
-        o.indent(i) << Members[index].first << " ";
-        o.indent(i) << Members[index].second << ";" << "\n";
-      }
-      
       i -= 2;
       o.indent(i) << "};" << "\n";
     }
   };
-  
+
   class ConstantEmitter {
   public:
     virtual ~ConstantEmitter() { }
     virtual void emit(raw_ostream &o, unsigned int &i) = 0;
   };
-  
+
   class LiteralConstantEmitter : public ConstantEmitter {
   private:
     bool IsNumber;
@@ -126,11 +98,7 @@
       const char* String;
     };
   public:
-    LiteralConstantEmitter(const char *string) : 
-      IsNumber(false),
-      String(string) {
-    }
-    LiteralConstantEmitter(int number = 0) : 
+    LiteralConstantEmitter(int number = 0) :
       IsNumber(true),
       Number(number) {
     }
@@ -139,11 +107,6 @@
       Number = 0;
       String = string;
     }
-    void set(int number) {
-      IsNumber = true;
-      String = NULL;
-      Number = number;
-    }
     bool is(const char *string) {
       return !strcmp(String, string);
     }
@@ -154,7 +117,7 @@
         o << String;
     }
   };
-  
+
   class CompoundConstantEmitter : public ConstantEmitter {
   private:
     unsigned int Padding;
@@ -164,7 +127,7 @@
     }
     CompoundConstantEmitter &addEntry(ConstantEmitter *e) {
       Entries.push_back(e);
-      
+
       return *this;
     }
     ~CompoundConstantEmitter() {
@@ -177,12 +140,12 @@
     void emit(raw_ostream &o, unsigned int &i) {
       o << "{" << "\n";
       i += 2;
-  
+
       unsigned int index;
       unsigned int numEntries = Entries.size();
-      
+
       unsigned int numToPrint;
-      
+
       if (Padding) {
         if (numEntries > Padding) {
           fprintf(stderr, "%u entries but %u padding\n", numEntries, Padding);
@@ -192,24 +155,24 @@
       } else {
         numToPrint = numEntries;
       }
-          
+
       for (index = 0; index < numToPrint; ++index) {
         o.indent(i);
         if (index < numEntries)
           Entries[index]->emit(o, i);
         else
           o << "-1";
-        
+
         if (index < (numToPrint - 1))
           o << ",";
         o << "\n";
       }
-      
+
       i -= 2;
       o.indent(i) << "}";
     }
   };
-  
+
   class FlagsConstantEmitter : public ConstantEmitter {
   private:
     std::vector<std::string> Flags;
@@ -225,7 +188,7 @@
       unsigned int numFlags = Flags.size();
       if (numFlags == 0)
         o << "0";
-      
+
       for (index = 0; index < numFlags; ++index) {
         o << Flags[index].c_str();
         if (index < (numFlags - 1))
@@ -255,15 +218,15 @@
                           const CodeGenInstruction &inst,
                           unsigned syntax) {
   unsigned int numArgs = 0;
-  
+
   AsmWriterInst awInst(inst, syntax, -1, -1);
-  
+
   std::vector<AsmWriterOperand>::iterator operandIterator;
-  
+
   for (operandIterator = awInst.Operands.begin();
        operandIterator != awInst.Operands.end();
        ++operandIterator) {
-    if (operandIterator->OperandType == 
+    if (operandIterator->OperandType ==
         AsmWriterOperand::isMachineInstrOperand) {
       operandOrder->addEntry(
         new LiteralConstantEmitter(operandIterator->CGIOpNo));
@@ -311,7 +274,7 @@
   REG("SEGMENT_REG");
   REG("DEBUG_REG");
   REG("CONTROL_REG");
-  
+
   IMM("i8imm");
   IMM("i16imm");
   IMM("i16i8imm");
@@ -321,7 +284,7 @@
   IMM("i64i8imm");
   IMM("i64i32imm");
   IMM("SSECC");
-  
+
   // all R, I, R, I, R
   MEM("i8mem");
   MEM("i8mem_NOREX");
@@ -343,12 +306,12 @@
   MEM("f128mem");
   MEM("f256mem");
   MEM("opaque512mem");
-  
+
   // all R, I, R, I
   LEA("lea32mem");
   LEA("lea64_32mem");
   LEA("lea64mem");
-  
+
   // all I
   PCR("i16imm_pcrel");
   PCR("i32imm_pcrel");
@@ -359,7 +322,7 @@
   PCR("offset32");
   PCR("offset64");
   PCR("brtarget");
-  
+
   return 1;
 }
 
@@ -381,19 +344,19 @@
   const CodeGenInstruction &inst) {
   if (!inst.TheDef->isSubClassOf("X86Inst"))
     return;
-  
+
   unsigned int index;
   unsigned int numOperands = inst.OperandList.size();
-  
+
   for (index = 0; index < numOperands; ++index) {
-    const CodeGenInstruction::OperandInfo &operandInfo = 
+    const CodeGenInstruction::OperandInfo &operandInfo =
       inst.OperandList[index];
     Record &rec = *operandInfo.Rec;
-    
+
     if (X86TypeFromOpName(operandTypes[index], rec.getName())) {
       errs() << "Operand type: " << rec.getName().c_str() << "\n";
       errs() << "Operand name: " << operandInfo.Name.c_str() << "\n";
-      errs() << "Instruction mame: " << inst.TheDef->getName().c_str() << "\n";
+      errs() << "Instruction name: " << inst.TheDef->getName().c_str() << "\n";
       llvm_unreachable("Unhandled type");
     }
   }
@@ -412,9 +375,9 @@
   const char *opName,
   const char *opFlag) {
   unsigned opIndex;
-  
+
   opIndex = inst.getOperandNamed(std::string(opName));
-  
+
   operandFlags[opIndex]->addEntry(opFlag);
 }
 
@@ -451,7 +414,7 @@
 }
 
 /// X86ExtractSemantics - Performs various checks on the name of an X86
-///   instruction to determine what sort of an instruction it is and then adds 
+///   instruction to determine what sort of an instruction it is and then adds
 ///   the appropriate flags to the instruction and its operands
 ///
 /// @arg instType     - A reference to the type for the instruction as a whole
@@ -462,7 +425,7 @@
   FlagsConstantEmitter *(&operandFlags)[EDIS_MAX_OPERANDS],
   const CodeGenInstruction &inst) {
   const std::string &name = inst.TheDef->getName();
-    
+
   if (name.find("MOV") != name.npos) {
     if (name.find("MOV_V") != name.npos) {
       // ignore (this is a pseudoinstruction)
@@ -487,7 +450,7 @@
       MOV("src", "dst");
     }
   }
-  
+
   if (name.find("JMP") != name.npos ||
       name.find("J") == 0) {
     if (name.find("FAR") != name.npos && name.find("i") != name.npos) {
@@ -496,10 +459,14 @@
       BRANCH("dst");
     }
   }
-  
+
   if (name.find("PUSH") != name.npos) {
-    if (name.find("FS") != name.npos ||
-        name.find("GS") != name.npos) {
+    if (name.find("CS") != name.npos ||
+        name.find("DS") != name.npos ||
+        name.find("ES") != name.npos ||
+        name.find("FS") != name.npos ||
+        name.find("GS") != name.npos ||
+        name.find("SS") != name.npos) {
       instType.set("kInstructionTypePush");
       // TODO add support for fixed operands
     } else if (name.find("F") != name.npos) {
@@ -514,12 +481,16 @@
       PUSH("reg");
     }
   }
-  
+
   if (name.find("POP") != name.npos) {
     if (name.find("POPCNT") != name.npos) {
       // ignore (not a real pop)
-    } else if (name.find("FS") != name.npos ||
-             name.find("GS") != name.npos) {
+    } else if (name.find("CS") != name.npos ||
+               name.find("DS") != name.npos ||
+               name.find("ES") != name.npos ||
+               name.find("FS") != name.npos ||
+               name.find("GS") != name.npos ||
+               name.find("SS") != name.npos) {
       instType.set("kInstructionTypePop");
       // TODO add support for fixed operands
     } else if (name.find("F") != name.npos) {
@@ -532,7 +503,7 @@
       POP("reg");
     }
   }
-  
+
   if (name.find("CALL") != name.npos) {
     if (name.find("ADJ") != name.npos) {
       // ignore (not a call)
@@ -546,7 +517,7 @@
       CALL("dst");
     }
   }
-  
+
   if (name.find("RET") != name.npos) {
     RETURN();
   }
@@ -590,32 +561,39 @@
   REG("QPR");
   REG("QQPR");
   REG("QQQQPR");
-  
+
   IMM("i32imm");
   IMM("bf_inv_mask_imm");
   IMM("jtblock_operand");
   IMM("nohash_imm");
   IMM("cpinst_operand");
+  IMM("setend_op");
   IMM("cps_opt");
   IMM("vfp_f64imm");
   IMM("vfp_f32imm");
+  IMM("memb_opt");
   IMM("msr_mask");
   IMM("neg_zero");
   IMM("imm0_31");
+  IMM("imm0_31_m1");
   IMM("nModImm");
   IMM("imm0_4095");
   IMM("jt2block_operand");
   IMM("t_imm_s4");
   IMM("pclabel");
-  
+  IMM("shift_imm");
+
   MISC("brtarget", "kOperandTypeARMBranchTarget");                // ?
   MISC("so_reg", "kOperandTypeARMSoReg");                         // R, R, I
   MISC("t2_so_reg", "kOperandTypeThumb2SoReg");                   // R, I
   MISC("so_imm", "kOperandTypeARMSoImm");                         // I
+  MISC("rot_imm", "kOperandTypeARMRotImm");                       // I
   MISC("t2_so_imm", "kOperandTypeThumb2SoImm");                   // I
   MISC("so_imm2part", "kOperandTypeARMSoImm2Part");               // I
   MISC("pred", "kOperandTypeARMPredicate");                       // I, R
   MISC("it_pred", "kOperandTypeARMPredicate");                    // I
+  MISC("addrmode_imm12", "kOperandTypeAddrModeImm12");            // R, I
+  MISC("ldst_so_reg", "kOperandTypeLdStSOReg");                   // R, R, I
   MISC("addrmode2", "kOperandTypeARMAddrMode2");                  // R, R, I
   MISC("am2offset", "kOperandTypeARMAddrMode2Offset");            // R, I
   MISC("addrmode3", "kOperandTypeARMAddrMode3");                  // R, R, I
@@ -632,7 +610,7 @@
   MISC("t2addrmode_imm12", "kOperandTypeThumb2AddrModeImm12");    // R, I
   MISC("t2addrmode_so_reg", "kOperandTypeThumb2AddrModeSoReg");   // R, R, I
   MISC("t2addrmode_imm8s4", "kOperandTypeThumb2AddrModeImm8s4");  // R, I
-  MISC("t2am_imm8s4_offset", "kOperandTypeThumb2AddrModeImm8s4Offset");  
+  MISC("t2am_imm8s4_offset", "kOperandTypeThumb2AddrModeImm8s4Offset");
                                                                   // R, I
   MISC("tb_addrmode", "kOperandTypeARMTBAddrMode");               // I
   MISC("t_addrmode_s1", "kOperandTypeThumbAddrModeS1");           // R, I, R
@@ -640,7 +618,7 @@
   MISC("t_addrmode_s4", "kOperandTypeThumbAddrModeS4");           // R, I, R
   MISC("t_addrmode_rr", "kOperandTypeThumbAddrModeRR");           // R, R
   MISC("t_addrmode_sp", "kOperandTypeThumbAddrModeSP");           // R, I
-  
+
   return 1;
 }
 
@@ -666,25 +644,25 @@
   if (!inst.TheDef->isSubClassOf("InstARM") &&
       !inst.TheDef->isSubClassOf("InstThumb"))
     return;
-  
+
   unsigned int index;
   unsigned int numOperands = inst.OperandList.size();
-  
+
   if (numOperands > EDIS_MAX_OPERANDS) {
-    errs() << "numOperands == " << numOperands << " > " << 
+    errs() << "numOperands == " << numOperands << " > " <<
       EDIS_MAX_OPERANDS << '\n';
     llvm_unreachable("Too many operands");
   }
-  
+
   for (index = 0; index < numOperands; ++index) {
-    const CodeGenInstruction::OperandInfo &operandInfo = 
+    const CodeGenInstruction::OperandInfo &operandInfo =
     inst.OperandList[index];
     Record &rec = *operandInfo.Rec;
-    
+
     if (ARMFlagFromOpName(operandTypes[index], rec.getName())) {
       errs() << "Operand type: " << rec.getName() << '\n';
       errs() << "Operand name: " << operandInfo.Name << '\n';
-      errs() << "Instruction mame: " << inst.TheDef->getName() << '\n';
+      errs() << "Instruction name: " << inst.TheDef->getName() << '\n';
       llvm_unreachable("Unhandled type");
     }
   }
@@ -696,7 +674,7 @@
 }
 
 /// ARMExtractSemantics - Performs various checks on the name of an ARM
-///   instruction to determine what sort of an instruction it is and then adds 
+///   instruction to determine what sort of an instruction it is and then adds
 ///   the appropriate flags to the instruction and its operands
 ///
 /// @arg instType     - A reference to the type for the instruction as a whole
@@ -709,7 +687,7 @@
   FlagsConstantEmitter *(&operandFlags)[EDIS_MAX_OPERANDS],
   const CodeGenInstruction &inst) {
   const std::string &name = inst.TheDef->getName();
-  
+
   if (name == "tBcc"   ||
       name == "tB"     ||
       name == "t2Bcc"  ||
@@ -718,7 +696,7 @@
       name == "tCBNZ") {
     BRANCH("target");
   }
-  
+
   if (name == "tBLr9"      ||
       name == "BLr9_pred"  ||
       name == "tBLXi_r9"   ||
@@ -727,7 +705,7 @@
       name == "t2BXJ"      ||
       name == "BXJ") {
     BRANCH("func");
-    
+
     unsigned opIndex;
     opIndex = inst.getOperandNamed("func");
     if (operandTypes[opIndex]->is("kOperandTypeImmediate"))
@@ -737,7 +715,7 @@
 
 #undef BRANCH
 
-/// populateInstInfo - Fills an array of InstInfos with information about each 
+/// populateInstInfo - Fills an array of InstInfos with information about each
 ///   instruction in a target
 ///
 /// @arg infoArray  - The array of InstInfo objects to populate
@@ -746,45 +724,45 @@
                              CodeGenTarget &target) {
   const std::vector<const CodeGenInstruction*> &numberedInstructions =
     target.getInstructionsByEnumValue();
-  
+
   unsigned int index;
   unsigned int numInstructions = numberedInstructions.size();
-  
+
   for (index = 0; index < numInstructions; ++index) {
     const CodeGenInstruction& inst = *numberedInstructions[index];
-    
+
     CompoundConstantEmitter *infoStruct = new CompoundConstantEmitter;
     infoArray.addEntry(infoStruct);
-    
+
     LiteralConstantEmitter *instType = new LiteralConstantEmitter;
     infoStruct->addEntry(instType);
-    
-    LiteralConstantEmitter *numOperandsEmitter = 
+
+    LiteralConstantEmitter *numOperandsEmitter =
       new LiteralConstantEmitter(inst.OperandList.size());
     infoStruct->addEntry(numOperandsEmitter);
-    
+
     CompoundConstantEmitter *operandTypeArray = new CompoundConstantEmitter;
     infoStruct->addEntry(operandTypeArray);
-    
+
     LiteralConstantEmitter *operandTypes[EDIS_MAX_OPERANDS];
-                         
+
     CompoundConstantEmitter *operandFlagArray = new CompoundConstantEmitter;
     infoStruct->addEntry(operandFlagArray);
-        
+
     FlagsConstantEmitter *operandFlags[EDIS_MAX_OPERANDS];
-    
-    for (unsigned operandIndex = 0; 
-         operandIndex < EDIS_MAX_OPERANDS; 
+
+    for (unsigned operandIndex = 0;
+         operandIndex < EDIS_MAX_OPERANDS;
          ++operandIndex) {
       operandTypes[operandIndex] = new LiteralConstantEmitter;
       operandTypeArray->addEntry(operandTypes[operandIndex]);
-      
+
       operandFlags[operandIndex] = new FlagsConstantEmitter;
       operandFlagArray->addEntry(operandFlags[operandIndex]);
     }
- 
+
     unsigned numSyntaxes = 0;
-    
+
     if (target.getName() == "X86") {
       X86PopulateOperands(operandTypes, inst);
       X86ExtractSemantics(*instType, operandFlags, inst);
@@ -795,24 +773,24 @@
       ARMExtractSemantics(*instType, operandTypes, operandFlags, inst);
       numSyntaxes = 1;
     }
-    
-    CompoundConstantEmitter *operandOrderArray = new CompoundConstantEmitter;    
-    
+
+    CompoundConstantEmitter *operandOrderArray = new CompoundConstantEmitter;
+
     infoStruct->addEntry(operandOrderArray);
-    
-    for (unsigned syntaxIndex = 0; 
-         syntaxIndex < EDIS_MAX_SYNTAXES; 
+
+    for (unsigned syntaxIndex = 0;
+         syntaxIndex < EDIS_MAX_SYNTAXES;
          ++syntaxIndex) {
-      CompoundConstantEmitter *operandOrder = 
+      CompoundConstantEmitter *operandOrder =
         new CompoundConstantEmitter(EDIS_MAX_OPERANDS);
-      
+
       operandOrderArray->addEntry(operandOrder);
-      
+
       if (syntaxIndex < numSyntaxes) {
         populateOperandOrder(operandOrder, inst, syntaxIndex);
       }
     }
-    
+
     infoStruct = NULL;
   }
 }
@@ -828,8 +806,11 @@
   operandTypes.addEntry("kOperandTypeARMBranchTarget");
   operandTypes.addEntry("kOperandTypeARMSoReg");
   operandTypes.addEntry("kOperandTypeARMSoImm");
+  operandTypes.addEntry("kOperandTypeARMRotImm");
   operandTypes.addEntry("kOperandTypeARMSoImm2Part");
   operandTypes.addEntry("kOperandTypeARMPredicate");
+  operandTypes.addEntry("kOperandTypeAddrModeImm12");
+  operandTypes.addEntry("kOperandTypeLdStSOReg");
   operandTypes.addEntry("kOperandTypeARMAddrMode2");
   operandTypes.addEntry("kOperandTypeARMAddrMode2Offset");
   operandTypes.addEntry("kOperandTypeARMAddrMode3");
@@ -856,16 +837,16 @@
   operandTypes.addEntry("kOperandTypeThumb2AddrModeImm8s4");
   operandTypes.addEntry("kOperandTypeThumb2AddrModeImm8s4Offset");
   operandTypes.emit(o, i);
-  
+
   o << "\n";
-  
+
   EnumEmitter operandFlags("OperandFlags");
   operandFlags.addEntry("kOperandFlagSource");
   operandFlags.addEntry("kOperandFlagTarget");
   operandFlags.emitAsFlags(o, i);
-  
+
   o << "\n";
-  
+
   EnumEmitter instructionTypes("InstructionTypes");
   instructionTypes.addEntry("kInstructionTypeNone");
   instructionTypes.addEntry("kInstructionTypeMove");
@@ -875,25 +856,25 @@
   instructionTypes.addEntry("kInstructionTypeCall");
   instructionTypes.addEntry("kInstructionTypeReturn");
   instructionTypes.emit(o, i);
-  
+
   o << "\n";
 }
 
 void EDEmitter::run(raw_ostream &o) {
   unsigned int i = 0;
-  
+
   CompoundConstantEmitter infoArray;
   CodeGenTarget target;
-  
+
   populateInstInfo(infoArray, target);
-  
+
   emitCommonEnums(o, i);
-  
+
   o << "namespace {\n";
-  
+
   o << "llvm::EDInstInfo instInfo" << target.getName().c_str() << "[] = ";
   infoArray.emit(o, i);
   o << ";" << "\n";
-  
+
   o << "}\n";
 }

Modified: llvm/branches/wendling/eh/utils/TableGen/FastISelEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/TableGen/FastISelEmitter.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/TableGen/FastISelEmitter.cpp (original)
+++ llvm/branches/wendling/eh/utils/TableGen/FastISelEmitter.cpp Tue Oct 26 19:48:03 2010
@@ -108,13 +108,14 @@
       else
         return false;
         
-      // For now, require the register operands' register classes to all
-      // be the same.
+      // For now, this needs to be a register class of some sort.
       if (!RC)
         return false;
-      // For now, all the operands must have the same register class.
+
+      // For now, all the operands must have the same register class or be
+      // a strict subclass of the destination.
       if (DstRC) {
-        if (DstRC != RC)
+        if (DstRC != RC && !DstRC->hasSubClass(RC))
           return false;
       } else
         DstRC = RC;
@@ -264,15 +265,6 @@
     CodeGenInstruction &II = CGP.getTargetInfo().getInstruction(Op);
     if (II.OperandList.empty())
       continue;
-
-    // For now ignore instructions that have predicate operands.
-    bool HasPredicate = false;
-    for (unsigned i = 0, e = II.OperandList.size(); i != e; ++i) {
-      if(II.OperandList[i].Rec->isSubClassOf("PredicateOperand"))
-        HasPredicate = true;
-    }
-    if (HasPredicate)
-      continue;
       
     // For now, ignore multi-instruction patterns.
     bool MultiInsts = false;

Modified: llvm/branches/wendling/eh/utils/TableGen/IntrinsicEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/TableGen/IntrinsicEmitter.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/TableGen/IntrinsicEmitter.cpp (original)
+++ llvm/branches/wendling/eh/utils/TableGen/IntrinsicEmitter.cpp Tue Oct 26 19:48:03 2010
@@ -14,6 +14,7 @@
 #include "CodeGenTarget.h"
 #include "IntrinsicEmitter.h"
 #include "Record.h"
+#include "StringMatcher.h"
 #include "llvm/ADT/StringExtras.h"
 #include <algorithm>
 using namespace llvm;
@@ -67,16 +68,19 @@
 
 void IntrinsicEmitter::EmitPrefix(raw_ostream &OS) {
   OS << "// VisualStudio defines setjmp as _setjmp\n"
-        "#if defined(_MSC_VER) && defined(setjmp)\n"
-        "#define setjmp_undefined_for_visual_studio\n"
-        "#undef setjmp\n"
+        "#if defined(_MSC_VER) && defined(setjmp) && \\\n"
+        "                         !defined(setjmp_undefined_for_msvc)\n"
+        "#  pragma push_macro(\"setjmp\")\n"
+        "#  undef setjmp\n"
+        "#  define setjmp_undefined_for_msvc\n"
         "#endif\n\n";
 }
 
 void IntrinsicEmitter::EmitSuffix(raw_ostream &OS) {
-  OS << "#if defined(_MSC_VER) && defined(setjmp_undefined_for_visual_studio)\n"
+  OS << "#if defined(_MSC_VER) && defined(setjmp_undefined_for_msvc)\n"
         "// let's return it to _setjmp state\n"
-        "#define setjmp _setjmp\n"
+        "#  pragma pop_macro(\"setjmp\")\n"
+        "#  undef setjmp_undefined_for_msvc\n"
         "#endif\n\n";
 }
 
@@ -96,37 +100,48 @@
 void IntrinsicEmitter::
 EmitFnNameRecognizer(const std::vector<CodeGenIntrinsic> &Ints, 
                      raw_ostream &OS) {
-  // Build a function name -> intrinsic name mapping.
-  std::map<std::string, unsigned> IntMapping;
+  // Build a 'first character of function name' -> intrinsic # mapping.
+  std::map<char, std::vector<unsigned> > IntMapping;
   for (unsigned i = 0, e = Ints.size(); i != e; ++i)
-    IntMapping[Ints[i].Name] = i;
-    
+    IntMapping[Ints[i].Name[5]].push_back(i);
+  
   OS << "// Function name -> enum value recognizer code.\n";
   OS << "#ifdef GET_FUNCTION_RECOGNIZER\n";
-  OS << "  switch (Name[5]) {\n";
-  OS << "  default:\n";
-  // Emit the intrinsics in sorted order.
-  char LastChar = 0;
-  for (std::map<std::string, unsigned>::iterator I = IntMapping.begin(),
+  OS << "  StringRef NameR(Name+6, Len-6);   // Skip over 'llvm.'\n";
+  OS << "  switch (Name[5]) {                  // Dispatch on first letter.\n";
+  OS << "  default: break;\n";
+  // Emit the intrinsic matching stuff by first letter.
+  for (std::map<char, std::vector<unsigned> >::iterator I = IntMapping.begin(),
        E = IntMapping.end(); I != E; ++I) {
-    if (I->first[5] != LastChar) {
-      LastChar = I->first[5];
-      OS << "    break;\n";
-      OS << "  case '" << LastChar << "':\n";
+    OS << "  case '" << I->first << "':\n";
+    std::vector<unsigned> &IntList = I->second;
+
+    // Emit all the overloaded intrinsics first, build a table of the
+    // non-overloaded ones.
+    std::vector<StringMatcher::StringPair> MatchTable;
+    
+    for (unsigned i = 0, e = IntList.size(); i != e; ++i) {
+      unsigned IntNo = IntList[i];
+      std::string Result = "return " + TargetPrefix + "Intrinsic::" +
+        Ints[IntNo].EnumName + ";";
+
+      if (!Ints[IntNo].isOverloaded) {
+        MatchTable.push_back(std::make_pair(Ints[IntNo].Name.substr(6),Result));
+        continue;
+      }
+
+      // For overloaded intrinsics, only the prefix needs to match
+      std::string TheStr = Ints[IntNo].Name.substr(6);
+      TheStr += '.';  // Require "bswap." instead of bswap.
+      OS << "    if (NameR.startswith(\"" << TheStr << "\")) "
+         << Result << '\n';
     }
     
-    // For overloaded intrinsics, only the prefix needs to match
-    if (Ints[I->second].isOverloaded)
-      OS << "    if (Len > " << I->first.size()
-       << " && !memcmp(Name, \"" << I->first << ".\", "
-       << (I->first.size() + 1) << ")) return " << TargetPrefix << "Intrinsic::"
-       << Ints[I->second].EnumName << ";\n";
-    else 
-      OS << "    if (Len == " << I->first.size()
-         << " && !memcmp(Name, \"" << I->first << "\", "
-         << I->first.size() << ")) return " << TargetPrefix << "Intrinsic::"
-         << Ints[I->second].EnumName << ";\n";
+    // Emit the matcher logic for the fixed length strings.
+    StringMatcher("NameR", MatchTable, OS).Emit(1);
+    OS << "    break;  // end of '" << I->first << "' case.\n";
   }
+  
   OS << "  }\n";
   OS << "#endif\n\n";
 }
@@ -180,6 +195,8 @@
     OS << "Type::getVoidTy(Context)";
   } else if (VT == MVT::Metadata) {
     OS << "Type::getMetadataTy(Context)";
+  } else if (VT == MVT::x86mmx) {
+    OS << "Type::getX86_MMXTy(Context)";
   } else {
     assert(false && "Unsupported ValueType!");
   }
@@ -545,7 +562,7 @@
   OS << "switch (iid) {\n";
   OS << "default:\n    return UnknownModRefBehavior;\n";
   for (unsigned i = 0, e = Ints.size(); i != e; ++i) {
-    if (Ints[i].ModRef == CodeGenIntrinsic::WriteMem)
+    if (Ints[i].ModRef == CodeGenIntrinsic::ReadWriteMem)
       continue;
     OS << "case " << TargetPrefix << "Intrinsic::" << Ints[i].EnumName
       << ":\n";
@@ -559,7 +576,7 @@
     case CodeGenIntrinsic::ReadMem:
       OS << "  return OnlyReadsMemory;\n";
       break;
-    case CodeGenIntrinsic::WriteArgMem:
+    case CodeGenIntrinsic::ReadWriteArgMem:
       OS << "  return AccessesArguments;\n";
       break;
     }
@@ -584,112 +601,22 @@
   OS << "#endif\n\n";
 }
 
-/// EmitBuiltinComparisons - Emit comparisons to determine whether the specified
-/// sorted range of builtin names is equal to the current builtin.  This breaks
-/// it down into a simple tree.
-///
-/// At this point, we know that all the builtins in the range have the same name
-/// for the first 'CharStart' characters.  Only the end of the name needs to be
-/// discriminated.
-typedef std::map<std::string, std::string>::const_iterator StrMapIterator;
-static void EmitBuiltinComparisons(StrMapIterator Start, StrMapIterator End,
-                                   unsigned CharStart, unsigned Indent,
-                                   std::string TargetPrefix, raw_ostream &OS) {
-  if (Start == End) return; // empty range.
-  
-  // Determine what, if anything, is the same about all these strings.
-  std::string CommonString = Start->first;
-  unsigned NumInRange = 0;
-  for (StrMapIterator I = Start; I != End; ++I, ++NumInRange) {
-    // Find the first character that doesn't match.
-    const std::string &ThisStr = I->first;
-    unsigned NonMatchChar = CharStart;
-    while (NonMatchChar < CommonString.size() && 
-           NonMatchChar < ThisStr.size() &&
-           CommonString[NonMatchChar] == ThisStr[NonMatchChar])
-      ++NonMatchChar;
-    // Truncate off pieces that don't match.
-    CommonString.resize(NonMatchChar);
-  }
-  
-  // Just compare the rest of the string.
-  if (NumInRange == 1) {
-    if (CharStart != CommonString.size()) {
-      OS << std::string(Indent*2, ' ') << "if (!memcmp(BuiltinName";
-      if (CharStart) OS << "+" << CharStart;
-      OS << ", \"" << (CommonString.c_str()+CharStart) << "\", ";
-      OS << CommonString.size() - CharStart << "))\n";
-      ++Indent;
-    }
-    OS << std::string(Indent*2, ' ') << "IntrinsicID = " << TargetPrefix
-       << "Intrinsic::";
-    OS << Start->second << ";\n";
-    return;
-  }
-
-  // At this point, we potentially have a common prefix for these builtins, emit
-  // a check for this common prefix.
-  if (CommonString.size() != CharStart) {
-    OS << std::string(Indent*2, ' ') << "if (!memcmp(BuiltinName";
-    if (CharStart) OS << "+" << CharStart;
-    OS << ", \"" << (CommonString.c_str()+CharStart) << "\", ";
-    OS << CommonString.size()-CharStart << ")) {\n";
-    
-    EmitBuiltinComparisons(Start, End, CommonString.size(), Indent+1, 
-                           TargetPrefix, OS);
-    OS << std::string(Indent*2, ' ') << "}\n";
-    return;
-  }
-  
-  // Output a switch on the character that differs across the set.
-  OS << std::string(Indent*2, ' ') << "switch (BuiltinName[" << CharStart
-      << "]) {";
-  if (CharStart)
-    OS << "  // \"" << std::string(Start->first.begin(), 
-                                   Start->first.begin()+CharStart) << "\"";
-  OS << "\n";
-  
-  for (StrMapIterator I = Start; I != End; ) {
-    char ThisChar = I->first[CharStart];
-    OS << std::string(Indent*2, ' ') << "case '" << ThisChar << "':\n";
-    // Figure out the range that has this common character.
-    StrMapIterator NextChar = I;
-    for (++NextChar; NextChar != End && NextChar->first[CharStart] == ThisChar;
-         ++NextChar)
-      /*empty*/;
-    EmitBuiltinComparisons(I, NextChar, CharStart+1, Indent+1, TargetPrefix,OS);
-    OS << std::string(Indent*2, ' ') << "  break;\n";
-    I = NextChar;
-  }
-  OS << std::string(Indent*2, ' ') << "}\n";
-}
-
 /// EmitTargetBuiltins - All of the builtins in the specified map are for the
 /// same target, and we already checked it.
 static void EmitTargetBuiltins(const std::map<std::string, std::string> &BIM,
                                const std::string &TargetPrefix,
                                raw_ostream &OS) {
-  // Rearrange the builtins by length.
-  std::vector<std::map<std::string, std::string> > BuiltinsByLen;
-  BuiltinsByLen.reserve(100);
-  
-  for (StrMapIterator I = BIM.begin(), E = BIM.end(); I != E; ++I) {
-    if (I->first.size() >= BuiltinsByLen.size())
-      BuiltinsByLen.resize(I->first.size()+1);
-    BuiltinsByLen[I->first.size()].insert(*I);
-  }
-  
-  // Now that we have all the builtins by their length, emit a switch stmt.
-  OS << "    switch (strlen(BuiltinName)) {\n";
-  OS << "    default: break;\n";
-  for (unsigned i = 0, e = BuiltinsByLen.size(); i != e; ++i) {
-    if (BuiltinsByLen[i].empty()) continue;
-    OS << "    case " << i << ":\n";
-    EmitBuiltinComparisons(BuiltinsByLen[i].begin(), BuiltinsByLen[i].end(),
-                           0, 3, TargetPrefix, OS);
-    OS << "      break;\n";
+  
+  std::vector<StringMatcher::StringPair> Results;
+  
+  for (std::map<std::string, std::string>::const_iterator I = BIM.begin(),
+       E = BIM.end(); I != E; ++I) {
+    std::string ResultCode =
+    "return " + TargetPrefix + "Intrinsic::" + I->second + ";";
+    Results.push_back(StringMatcher::StringPair(I->first, ResultCode));
   }
-  OS << "    }\n";
+
+  StringMatcher("BuiltinName", Results, OS).Emit();
 }
 
         
@@ -719,24 +646,20 @@
   if (TargetOnly) {
     OS << "static " << TargetPrefix << "Intrinsic::ID "
        << "getIntrinsicForGCCBuiltin(const char "
-       << "*TargetPrefix, const char *BuiltinName) {\n";
-    OS << "  " << TargetPrefix << "Intrinsic::ID IntrinsicID = ";
+       << "*TargetPrefixStr, const char *BuiltinNameStr) {\n";
   } else {
     OS << "Intrinsic::ID Intrinsic::getIntrinsicForGCCBuiltin(const char "
-       << "*TargetPrefix, const char *BuiltinName) {\n";
-    OS << "  Intrinsic::ID IntrinsicID = ";
+       << "*TargetPrefixStr, const char *BuiltinNameStr) {\n";
   }
   
-  if (TargetOnly)
-    OS << "(" << TargetPrefix<< "Intrinsic::ID)";
-
-  OS << "Intrinsic::not_intrinsic;\n";
+  OS << "  StringRef BuiltinName(BuiltinNameStr);\n";
+  OS << "  StringRef TargetPrefix(TargetPrefixStr);\n\n";
   
   // Note: this could emit significantly better code if we cared.
   for (BIMTy::iterator I = BuiltinMap.begin(), E = BuiltinMap.end();I != E;++I){
     OS << "  ";
     if (!I->first.empty())
-      OS << "if (!strcmp(TargetPrefix, \"" << I->first << "\")) ";
+      OS << "if (TargetPrefix == \"" << I->first << "\") ";
     else
       OS << "/* Target Independent Builtins */ ";
     OS << "{\n";
@@ -745,7 +668,10 @@
     EmitTargetBuiltins(I->second, TargetPrefix, OS);
     OS << "  }\n";
   }
-  OS << "  return IntrinsicID;\n";
+  OS << "  return ";
+  if (!TargetPrefix.empty())
+    OS << "(" << TargetPrefix << "Intrinsic::ID)";
+  OS << "Intrinsic::not_intrinsic;\n";
   OS << "}\n";
   OS << "#endif\n\n";
 }

Modified: llvm/branches/wendling/eh/utils/TableGen/LLVMCConfigurationEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/TableGen/LLVMCConfigurationEmitter.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/TableGen/LLVMCConfigurationEmitter.cpp (original)
+++ llvm/branches/wendling/eh/utils/TableGen/LLVMCConfigurationEmitter.cpp Tue Oct 26 19:48:03 2010
@@ -25,6 +25,7 @@
 #include <string>
 #include <typeinfo>
 
+
 using namespace llvm;
 
 namespace {
@@ -33,6 +34,7 @@
 /// Typedefs
 
 typedef std::vector<Record*> RecordVector;
+typedef std::vector<const DagInit*> DagVector;
 typedef std::vector<std::string> StrVector;
 
 //===----------------------------------------------------------------------===//
@@ -49,7 +51,7 @@
 const char * const DefaultHelpString = "NO HELP MESSAGE PROVIDED";
 
 // Name for the "sink" option.
-const char * const SinkOptionName = "AutoGeneratedSinkOption";
+const char * const SinkOptionName = "SinkOption";
 
 //===----------------------------------------------------------------------===//
 /// Helper functions
@@ -109,11 +111,6 @@
     throw GetOperatorName(d) + ": too few arguments!";
 }
 
-// IsDagEmpty - is this DAG marked with an empty marker?
-bool IsDagEmpty (const DagInit& d) {
-  return GetOperatorName(d) == "empty_dag_marker";
-}
-
 // EscapeVariableName - Escape commas and other symbols not allowed
 // in the C++ variable names. Makes it possible to use options named
 // like "Wa," (useful for prefix options).
@@ -168,18 +165,6 @@
     throw ErrorString;
 }
 
-// apply is needed because C++'s syntax doesn't let us construct a function
-// object and call it in the same statement.
-template<typename F, typename T0>
-void apply(F Fun, T0& Arg0) {
-  return Fun(Arg0);
-}
-
-template<typename F, typename T0, typename T1>
-void apply(F Fun, T0& Arg0, T1& Arg1) {
-  return Fun(Arg0, Arg1);
-}
-
 //===----------------------------------------------------------------------===//
 /// Back-end specific code
 
@@ -234,10 +219,9 @@
 
 namespace OptionDescriptionFlags {
   enum OptionDescriptionFlags { Required = 0x1, Hidden = 0x2,
-                                ReallyHidden = 0x4, Extern = 0x8,
-                                OneOrMore = 0x10, Optional = 0x20,
-                                CommaSeparated = 0x40, ForwardNotSplit = 0x80,
-                                ZeroOrMore = 0x100 };
+                                ReallyHidden = 0x4, OneOrMore = 0x8,
+                                Optional = 0x10, CommaSeparated = 0x20,
+                                ForwardNotSplit = 0x40, ZeroOrMore = 0x80 };
 }
 
 /// OptionDescription - Represents data contained in a single
@@ -262,7 +246,13 @@
 
   /// GenVariableName - Returns the variable name used in the
   /// generated C++ code.
-  std::string GenVariableName() const;
+  std::string GenVariableName() const
+  { return "autogenerated::" + GenOptionType() + EscapeVariableName(Name); }
+
+  /// GenPlainVariableName - Returns the variable name without the namespace
+  /// prefix.
+  std::string GenPlainVariableName() const
+  { return GenOptionType() + EscapeVariableName(Name); }
 
   /// Merge - Merge two option descriptions.
   void Merge (const OptionDescription& other);
@@ -279,9 +269,6 @@
   bool isCommaSeparated() const;
   void setCommaSeparated();
 
-  bool isExtern() const;
-  void setExtern();
-
   bool isForwardNotSplit() const;
   void setForwardNotSplit();
 
@@ -319,6 +306,10 @@
   { return (OptionType::IsList(this->Type)
             && !OptionType::IsSwitchList(this->Type)); }
 
+private:
+
+  // GenOptionType - Helper function used by GenVariableName().
+  std::string GenOptionType() const;
 };
 
 void OptionDescription::CheckConsistency() const {
@@ -372,13 +363,6 @@
   Flags |= OptionDescriptionFlags::ForwardNotSplit;
 }
 
-bool OptionDescription::isExtern() const {
-  return Flags & OptionDescriptionFlags::Extern;
-}
-void OptionDescription::setExtern() {
-  Flags |= OptionDescriptionFlags::Extern;
-}
-
 bool OptionDescription::isRequired() const {
   return Flags & OptionDescriptionFlags::Required;
 }
@@ -439,22 +423,21 @@
   }
 }
 
-std::string OptionDescription::GenVariableName() const {
-  const std::string& EscapedName = EscapeVariableName(Name);
+std::string OptionDescription::GenOptionType() const {
   switch (Type) {
   case OptionType::Alias:
-    return "AutoGeneratedAlias_" + EscapedName;
+    return "Alias_";
   case OptionType::PrefixList:
   case OptionType::ParameterList:
-    return "AutoGeneratedList_" + EscapedName;
+    return "List_";
   case OptionType::Switch:
-    return "AutoGeneratedSwitch_" + EscapedName;
+    return "Switch_";
   case OptionType::SwitchList:
-    return "AutoGeneratedSwitchList_" + EscapedName;
+    return "SwitchList_";
   case OptionType::Prefix:
   case OptionType::Parameter:
   default:
-    return "AutoGeneratedParameter_" + EscapedName;
+    return "Parameter_";
   }
 }
 
@@ -474,7 +457,6 @@
   // wrong type.
   const OptionDescription& FindSwitch(const std::string& OptName) const;
   const OptionDescription& FindParameter(const std::string& OptName) const;
-  const OptionDescription& FindList(const std::string& OptName) const;
   const OptionDescription& FindParameterList(const std::string& OptName) const;
   const OptionDescription&
   FindListOrParameter(const std::string& OptName) const;
@@ -509,14 +491,6 @@
 }
 
 const OptionDescription&
-OptionDescriptions::FindList(const std::string& OptName) const {
-  const OptionDescription& OptDesc = this->FindOption(OptName);
-  if (!OptDesc.isList())
-    throw OptName + ": incorrect option type - should be a list!";
-  return OptDesc;
-}
-
-const OptionDescription&
 OptionDescriptions::FindParameterList(const std::string& OptName) const {
   const OptionDescription& OptDesc = this->FindOption(OptName);
   if (!OptDesc.isList() || OptDesc.isSwitchList())
@@ -624,7 +598,6 @@
   ((Obj)->*(h))(Dag, IndentLevel, O);
 }
 
-
 template <typename H>
 typename HandlerTable<H>::HandlerMap HandlerTable<H>::Handlers_;
 
@@ -653,7 +626,6 @@
     : optDesc_(OD)
   {
     if (!staticMembersInitialized_) {
-      AddHandler("extern", &CollectOptionProperties::onExtern);
       AddHandler("help", &CollectOptionProperties::onHelp);
       AddHandler("hidden", &CollectOptionProperties::onHidden);
       AddHandler("init", &CollectOptionProperties::onInit);
@@ -682,11 +654,6 @@
   /// Option property handlers --
   /// Methods that handle option properties such as (help) or (hidden).
 
-  void onExtern (const DagInit& d) {
-    CheckNumberOfArguments(d, 0);
-    optDesc_.setExtern();
-  }
-
   void onHelp (const DagInit& d) {
     CheckNumberOfArguments(d, 1);
     optDesc_.Help = EscapeQuotes(InitPtrToString(d.getArg(0)));
@@ -799,16 +766,16 @@
 
     OptionDescription OD(Type, Name);
 
-    if (!OD.isExtern())
-      CheckNumberOfArguments(d, 2);
+    CheckNumberOfArguments(d, 2);
 
     if (OD.isAlias()) {
       // Aliases store the aliased option name in the 'Help' field.
       OD.Help = InitPtrToString(d.getArg(1));
     }
-    else if (!OD.isExtern()) {
+    else {
       processOptionProperties(d, OD);
     }
+
     OptDescs_.InsertDescription(OD);
   }
 
@@ -827,18 +794,16 @@
 
 /// CollectOptionDescriptions - Collects option properties from all
 /// OptionLists.
-void CollectOptionDescriptions (RecordVector::const_iterator B,
-                                RecordVector::const_iterator E,
+void CollectOptionDescriptions (const RecordVector& V,
                                 OptionDescriptions& OptDescs)
 {
   // For every OptionList:
-  for (; B!=E; ++B) {
-    RecordVector::value_type T = *B;
+  for (RecordVector::const_iterator B = V.begin(), E = V.end(); B!=E; ++B)
+  {
     // Throws an exception if the value does not exist.
-    ListInit* PropList = T->getValueAsListInit("options");
+    ListInit* PropList = (*B)->getValueAsListInit("options");
 
-    // For every option description in this list:
-    // collect the information and
+    // For every option description in this list: invoke AddOption.
     std::for_each(PropList->begin(), PropList->end(), AddOption(OptDescs));
   }
 }
@@ -856,7 +821,7 @@
   StrVector InLanguage;
   std::string InFileOption;
   std::string OutFileOption;
-  std::string OutLanguage;
+  StrVector OutLanguage;
   std::string OutputSuffix;
   unsigned Flags;
   const Init* OnEmpty;
@@ -869,11 +834,7 @@
 
   // Default ctor here is needed because StringMap can only store
   // DefaultConstructible objects
-  ToolDescription ()
-    : CmdLine(0), Actions(0), OutFileOption("-o"),
-      Flags(0), OnEmpty(0)
-  {}
-  ToolDescription (const std::string& n)
+  ToolDescription (const std::string &n = "")
     : Name(n), CmdLine(0), Actions(0), OutFileOption("-o"),
       Flags(0), OnEmpty(0)
   {}
@@ -946,31 +907,24 @@
     toolDesc_.CmdLine = d.getArg(0);
   }
 
-  void onInLanguage (const DagInit& d) {
+  /// onInOutLanguage - Common implementation of on{In,Out}Language().
+  void onInOutLanguage (const DagInit& d, StrVector& OutVec) {
     CheckNumberOfArguments(d, 1);
-    Init* arg = d.getArg(0);
 
-    // Find out the argument's type.
-    if (typeid(*arg) == typeid(StringInit)) {
-      // It's a string.
-      toolDesc_.InLanguage.push_back(InitPtrToString(arg));
+    // Copy strings to the output vector.
+    for (unsigned i = 0, NumArgs = d.getNumArgs(); i < NumArgs; ++i) {
+      OutVec.push_back(InitPtrToString(d.getArg(i)));
     }
-    else {
-      // It's a list.
-      const ListInit& lst = InitPtrToList(arg);
-      StrVector& out = toolDesc_.InLanguage;
 
-      // Copy strings to the output vector.
-      for (ListInit::const_iterator B = lst.begin(), E = lst.end();
-           B != E; ++B) {
-        out.push_back(InitPtrToString(*B));
-      }
+    // Remove duplicates.
+    std::sort(OutVec.begin(), OutVec.end());
+    StrVector::iterator newE = std::unique(OutVec.begin(), OutVec.end());
+    OutVec.erase(newE, OutVec.end());
+  }
 
-      // Remove duplicates.
-      std::sort(out.begin(), out.end());
-      StrVector::iterator newE = std::unique(out.begin(), out.end());
-      out.erase(newE, out.end());
-    }
+
+  void onInLanguage (const DagInit& d) {
+    this->onInOutLanguage(d, toolDesc_.InLanguage);
   }
 
   void onJoin (const DagInit& d) {
@@ -979,8 +933,7 @@
   }
 
   void onOutLanguage (const DagInit& d) {
-    CheckNumberOfArguments(d, 1);
-    toolDesc_.OutLanguage = InitPtrToString(d.getArg(0));
+    this->onInOutLanguage(d, toolDesc_.OutLanguage);
   }
 
   void onOutFileOption (const DagInit& d) {
@@ -1012,12 +965,12 @@
 /// CollectToolDescriptions - Gather information about tool properties
 /// from the parsed TableGen data (basically a wrapper for the
 /// CollectToolProperties function object).
-void CollectToolDescriptions (RecordVector::const_iterator B,
-                              RecordVector::const_iterator E,
+void CollectToolDescriptions (const RecordVector& Tools,
                               ToolDescriptions& ToolDescs)
 {
   // Iterate over a properties list of every Tool definition
-  for (;B!=E;++B) {
+  for (RecordVector::const_iterator B = Tools.begin(),
+         E = Tools.end(); B!=E; ++B) {
     const Record* T = *B;
     // Throws an exception if the value does not exist.
     ListInit* PropList = T->getValueAsListInit("properties");
@@ -1033,30 +986,17 @@
 
 /// FillInEdgeVector - Merge all compilation graph definitions into
 /// one single edge list.
-void FillInEdgeVector(RecordVector::const_iterator B,
-                      RecordVector::const_iterator E, RecordVector& Out) {
-  for (; B != E; ++B) {
-    const ListInit* edges = (*B)->getValueAsListInit("edges");
-
-    for (unsigned i = 0; i < edges->size(); ++i)
-      Out.push_back(edges->getElementAsRecord(i));
-  }
-}
-
-/// CalculatePriority - Calculate the priority of this plugin.
-int CalculatePriority(RecordVector::const_iterator B,
-                      RecordVector::const_iterator E) {
-  int priority = 0;
-
-  if (B != E) {
-    priority  = static_cast<int>((*B)->getValueAsInt("priority"));
-
-    if (++B != E)
-      throw "More than one 'PluginPriority' instance found: "
-        "most probably an error!";
+void FillInEdgeVector(const RecordVector& CompilationGraphs,
+                      DagVector& Out) {
+  for (RecordVector::const_iterator B = CompilationGraphs.begin(),
+         E = CompilationGraphs.end(); B != E; ++B) {
+    const ListInit* Edges = (*B)->getValueAsListInit("edges");
+
+    for (ListInit::const_iterator B = Edges->begin(),
+           E = Edges->end(); B != E; ++B) {
+      Out.push_back(&InitPtrToDag(*B));
+    }
   }
-
-  return priority;
 }
 
 /// NotInGraph - Helper function object for FilterNotInGraph.
@@ -1076,18 +1016,18 @@
 
 /// FilterNotInGraph - Filter out from ToolDescs all Tools not
 /// mentioned in the compilation graph definition.
-void FilterNotInGraph (const RecordVector& EdgeVector,
+void FilterNotInGraph (const DagVector& EdgeVector,
                        ToolDescriptions& ToolDescs) {
 
   // List all tools mentioned in the graph.
   llvm::StringSet<> ToolsInGraph;
 
-  for (RecordVector::const_iterator B = EdgeVector.begin(),
+  for (DagVector::const_iterator B = EdgeVector.begin(),
          E = EdgeVector.end(); B != E; ++B) {
 
-    const Record* Edge = *B;
-    const std::string& NodeA = Edge->getValueAsString("a");
-    const std::string& NodeB = Edge->getValueAsString("b");
+    const DagInit* Edge = *B;
+    const std::string& NodeA = InitPtrToString(Edge->getArg(0));
+    const std::string& NodeB = InitPtrToString(Edge->getArg(1));
 
     if (NodeA != "root")
       ToolsInGraph.insert(NodeA);
@@ -1102,49 +1042,62 @@
 }
 
 /// FillInToolToLang - Fills in two tables that map tool names to
-/// (input, output) languages.  Helper function used by TypecheckGraph().
+/// input & output language names.  Helper function used by TypecheckGraph().
 void FillInToolToLang (const ToolDescriptions& ToolDescs,
                        StringMap<StringSet<> >& ToolToInLang,
-                       StringMap<std::string>& ToolToOutLang) {
+                       StringMap<StringSet<> >& ToolToOutLang) {
   for (ToolDescriptions::const_iterator B = ToolDescs.begin(),
          E = ToolDescs.end(); B != E; ++B) {
     const ToolDescription& D = *(*B);
     for (StrVector::const_iterator B = D.InLanguage.begin(),
            E = D.InLanguage.end(); B != E; ++B)
       ToolToInLang[D.Name].insert(*B);
-    ToolToOutLang[D.Name] = D.OutLanguage;
+    for (StrVector::const_iterator B = D.OutLanguage.begin(),
+           E = D.OutLanguage.end(); B != E; ++B)
+      ToolToOutLang[D.Name].insert(*B);
   }
 }
 
+/// Intersect - Is set intersection non-empty?
+bool Intersect (const StringSet<>& S1, const StringSet<>& S2) {
+  for (StringSet<>::const_iterator B = S1.begin(), E = S1.end(); B != E; ++B) {
+    if (S2.count(B->first()) != 0)
+      return true;
+  }
+  return false;
+}
+
 /// TypecheckGraph - Check that names for output and input languages
-/// on all edges do match. This doesn't do much when the information
-/// about the whole graph is not available (i.e. when compiling most
-/// plugins).
-void TypecheckGraph (const RecordVector& EdgeVector,
+/// on all edges do match.
+void TypecheckGraph (const DagVector& EdgeVector,
                      const ToolDescriptions& ToolDescs) {
   StringMap<StringSet<> > ToolToInLang;
-  StringMap<std::string> ToolToOutLang;
+  StringMap<StringSet<> > ToolToOutLang;
 
   FillInToolToLang(ToolDescs, ToolToInLang, ToolToOutLang);
-  StringMap<std::string>::iterator IAE = ToolToOutLang.end();
-  StringMap<StringSet<> >::iterator IBE = ToolToInLang.end();
 
-  for (RecordVector::const_iterator B = EdgeVector.begin(),
+  for (DagVector::const_iterator B = EdgeVector.begin(),
          E = EdgeVector.end(); B != E; ++B) {
-    const Record* Edge = *B;
-    const std::string& NodeA = Edge->getValueAsString("a");
-    const std::string& NodeB = Edge->getValueAsString("b");
-    StringMap<std::string>::iterator IA = ToolToOutLang.find(NodeA);
+    const DagInit* Edge = *B;
+    const std::string& NodeA = InitPtrToString(Edge->getArg(0));
+    const std::string& NodeB = InitPtrToString(Edge->getArg(1));
+    StringMap<StringSet<> >::iterator IA = ToolToOutLang.find(NodeA);
     StringMap<StringSet<> >::iterator IB = ToolToInLang.find(NodeB);
 
+    if (NodeB == "root")
+      throw "Edges back to the root are not allowed!";
+
     if (NodeA != "root") {
-      if (IA != IAE && IB != IBE && IB->second.count(IA->second) == 0)
+      if (IA == ToolToOutLang.end())
+        throw NodeA + ": no output language defined!";
+      if (IB == ToolToInLang.end())
+        throw NodeB + ": no input language defined!";
+
+      if (!Intersect(IA->second, IB->second)) {
         throw "Edge " + NodeA + "->" + NodeB
           + ": output->input language mismatch";
+      }
     }
-
-    if (NodeB == "root")
-      throw "Edges back to the root are not allowed!";
   }
 }
 
@@ -1220,25 +1173,20 @@
     if (ActionName == "forward" || ActionName == "forward_as" ||
         ActionName == "forward_value" ||
         ActionName == "forward_transformed_value" ||
-        ActionName == "switch_on" || ActionName == "any_switch_on" ||
-        ActionName == "parameter_equals" ||
-        ActionName == "element_in_list" || ActionName == "not_empty" ||
-        ActionName == "empty") {
+        ActionName == "parameter_equals" || ActionName == "element_in_list") {
       CheckNumberOfArguments(Stmt, 1);
 
       Init* Arg = Stmt.getArg(0);
-      if (typeid(*Arg) == typeid(StringInit)) {
-        const std::string& Name = InitPtrToString(Arg);
-        OptionNames_.insert(Name);
-      }
-      else {
-        // It's a list.
-        const ListInit& List = InitPtrToList(Arg);
-        for (ListInit::const_iterator B = List.begin(), E = List.end();
-             B != E; ++B) {
-          const std::string& Name = InitPtrToString(*B);
-          OptionNames_.insert(Name);
-        }
+      if (typeid(*Arg) == typeid(StringInit))
+        OptionNames_.insert(InitPtrToString(Arg));
+    }
+    else if (ActionName == "any_switch_on" || ActionName == "switch_on" ||
+             ActionName == "any_not_empty" || ActionName == "any_empty" ||
+             ActionName == "not_empty" || ActionName == "empty") {
+      for (unsigned i = 0, NumArgs = Stmt.getNumArgs(); i < NumArgs; ++i) {
+        Init* Arg = Stmt.getArg(i);
+        if (typeid(*Arg) == typeid(StringInit))
+          OptionNames_.insert(InitPtrToString(Arg));
       }
     }
     else if (ActionName == "and" || ActionName == "or" || ActionName == "not") {
@@ -1253,6 +1201,7 @@
   {}
 
   void operator()(const Init* Statement) {
+    // Statement is either a dag, or a list of dags.
     if (typeid(*Statement) == typeid(ListInit)) {
       const ListInit& DagList = *static_cast<const ListInit*>(Statement);
       for (ListInit::const_iterator B = DagList.begin(), E = DagList.end();
@@ -1272,10 +1221,15 @@
   }
 };
 
+/// IsOptionalEdge - Validate that the 'optional_edge' has proper structure.
+bool IsOptionalEdge (const DagInit& Edg) {
+  return (GetOperatorName(Edg) == "optional_edge") && (Edg.getNumArgs() > 2);
+}
+
 /// CheckForSuperfluousOptions - Check that there are no side
 /// effect-free options (specified only in the OptionList). Otherwise,
 /// output a warning.
-void CheckForSuperfluousOptions (const RecordVector& Edges,
+void CheckForSuperfluousOptions (const DagVector& EdgeVector,
                                  const ToolDescriptions& ToolDescs,
                                  const OptionDescriptions& OptDescs) {
   llvm::StringSet<> nonSuperfluousOptions;
@@ -1293,13 +1247,13 @@
   // Add all options mentioned in the 'case' clauses of the
   // OptionalEdges of the compilation graph to the set of
   // non-superfluous options.
-  for (RecordVector::const_iterator B = Edges.begin(), E = Edges.end();
-       B != E; ++B) {
-    const Record* Edge = *B;
-    DagInit& Weight = *Edge->getValueAsDag("weight");
-
-    if (!IsDagEmpty(Weight))
+  for (DagVector::const_iterator B = EdgeVector.begin(),
+         E = EdgeVector.end(); B != E; ++B) {
+    const DagInit& Edge = **B;
+    if (IsOptionalEdge(Edge)) {
+      const DagInit& Weight = InitPtrToDag(Edge.getArg(2));
       WalkCase(&Weight, ExtractOptionNames(nonSuperfluousOptions), Id());
+    }
   }
 
   // Check that all options in OptDescs belong to the set of
@@ -1328,24 +1282,20 @@
   return false;
 }
 
-/// EmitListTest - Helper function used by EmitCaseTest1ArgList().
+/// EmitMultipleArgumentTest - Helper function used by
+/// EmitCaseTestMultipleArgs()
 template <typename F>
-void EmitListTest(const ListInit& L, const char* LogicOp,
-                  F Callback, raw_ostream& O)
+void EmitMultipleArgumentTest(const DagInit& D, const char* LogicOp,
+                              F Callback, raw_ostream& O)
 {
-  // This is a lot like EmitLogicalOperationTest, but works on ListInits instead
-  // of Dags...
-  bool isFirst = true;
-  for (ListInit::const_iterator B = L.begin(), E = L.end(); B != E; ++B) {
-    if (isFirst)
-      isFirst = false;
-    else
-      O << ' ' << LogicOp << ' ';
-    Callback(InitPtrToString(*B), O);
+  for (unsigned i = 0, NumArgs = D.getNumArgs(); i < NumArgs; ++i) {
+    if (i != 0)
+       O << ' ' << LogicOp << ' ';
+    Callback(InitPtrToString(D.getArg(i)), O);
   }
 }
 
-// Callbacks for use with EmitListTest.
+// Callbacks for use with EmitMultipleArgumentTest
 
 class EmitSwitchOn {
   const OptionDescriptions& OptDescs_;
@@ -1383,54 +1333,48 @@
 };
 
 
-/// EmitCaseTest1ArgList - Helper function used by EmitCaseTest1Arg();
-bool EmitCaseTest1ArgList(const std::string& TestName,
-                          const DagInit& d,
-                          const OptionDescriptions& OptDescs,
-                          raw_ostream& O) {
-  const ListInit& L = InitPtrToList(d.getArg(0));
-
+/// EmitCaseTestMultipleArgs - Helper function used by EmitCaseTest1Arg()
+bool EmitCaseTestMultipleArgs (const std::string& TestName,
+                               const DagInit& d,
+                               const OptionDescriptions& OptDescs,
+                               raw_ostream& O) {
   if (TestName == "any_switch_on") {
-    EmitListTest(L, "||", EmitSwitchOn(OptDescs), O);
+    EmitMultipleArgumentTest(d, "||", EmitSwitchOn(OptDescs), O);
     return true;
   }
   else if (TestName == "switch_on") {
-    EmitListTest(L, "&&", EmitSwitchOn(OptDescs), O);
+    EmitMultipleArgumentTest(d, "&&", EmitSwitchOn(OptDescs), O);
     return true;
   }
   else if (TestName == "any_not_empty") {
-    EmitListTest(L, "||", EmitEmptyTest(true, OptDescs), O);
+    EmitMultipleArgumentTest(d, "||", EmitEmptyTest(true, OptDescs), O);
     return true;
   }
   else if (TestName == "any_empty") {
-    EmitListTest(L, "||", EmitEmptyTest(false, OptDescs), O);
+    EmitMultipleArgumentTest(d, "||", EmitEmptyTest(false, OptDescs), O);
     return true;
   }
   else if (TestName == "not_empty") {
-    EmitListTest(L, "&&", EmitEmptyTest(true, OptDescs), O);
+    EmitMultipleArgumentTest(d, "&&", EmitEmptyTest(true, OptDescs), O);
     return true;
   }
   else if (TestName == "empty") {
-    EmitListTest(L, "&&", EmitEmptyTest(false, OptDescs), O);
+    EmitMultipleArgumentTest(d, "&&", EmitEmptyTest(false, OptDescs), O);
     return true;
   }
 
   return false;
 }
 
-/// EmitCaseTest1ArgStr - Helper function used by EmitCaseTest1Arg();
-bool EmitCaseTest1ArgStr(const std::string& TestName,
-                         const DagInit& d,
-                         const OptionDescriptions& OptDescs,
-                         raw_ostream& O) {
-  const std::string& OptName = InitPtrToString(d.getArg(0));
+/// EmitCaseTest1Arg - Helper function used by EmitCaseTest1OrMoreArgs()
+bool EmitCaseTest1Arg (const std::string& TestName,
+                       const DagInit& d,
+                       const OptionDescriptions& OptDescs,
+                       raw_ostream& O) {
+  const std::string& Arg = InitPtrToString(d.getArg(0));
 
-  if (TestName == "switch_on") {
-    apply(EmitSwitchOn(OptDescs), OptName, O);
-    return true;
-  }
-  else if (TestName == "input_languages_contain") {
-    O << "InLangs.count(\"" << OptName << "\") != 0";
+  if (TestName == "input_languages_contain") {
+    O << "InLangs.count(\"" << Arg << "\") != 0";
     return true;
   }
   else if (TestName == "in_language") {
@@ -1438,28 +1382,22 @@
     // tools can process several files in different languages simultaneously.
 
     // TODO: make this work with Edge::Weight (if possible).
-    O << "LangMap.GetLanguage(inFile) == \"" << OptName << '\"';
-    return true;
-  }
-  else if (TestName == "not_empty" || TestName == "empty") {
-    bool EmitNegate = (TestName == "not_empty");
-    apply(EmitEmptyTest(EmitNegate, OptDescs), OptName, O);
+    O << "LangMap.GetLanguage(inFile) == \"" << Arg << '\"';
     return true;
   }
 
   return false;
 }
 
-/// EmitCaseTest1Arg - Helper function used by EmitCaseConstructHandler();
-bool EmitCaseTest1Arg(const std::string& TestName,
-                      const DagInit& d,
-                      const OptionDescriptions& OptDescs,
-                      raw_ostream& O) {
+/// EmitCaseTest1OrMoreArgs - Helper function used by
+/// EmitCaseConstructHandler()
+bool EmitCaseTest1OrMoreArgs(const std::string& TestName,
+                             const DagInit& d,
+                             const OptionDescriptions& OptDescs,
+                             raw_ostream& O) {
   CheckNumberOfArguments(d, 1);
-  if (typeid(*d.getArg(0)) == typeid(ListInit))
-    return EmitCaseTest1ArgList(TestName, d, OptDescs, O);
-  else
-    return EmitCaseTest1ArgStr(TestName, d, OptDescs, O);
+  return EmitCaseTest1Arg(TestName, d, OptDescs, O) ||
+    EmitCaseTestMultipleArgs(TestName, d, OptDescs, O);
 }
 
 /// EmitCaseTest2Args - Helper function used by EmitCaseConstructHandler().
@@ -1503,10 +1441,10 @@
                               const OptionDescriptions& OptDescs,
                               raw_ostream& O) {
   O << '(';
-  for (unsigned j = 0, NumArgs = d.getNumArgs(); j < NumArgs; ++j) {
-    const DagInit& InnerTest = InitPtrToDag(d.getArg(j));
+  for (unsigned i = 0, NumArgs = d.getNumArgs(); i < NumArgs; ++i) {
+    const DagInit& InnerTest = InitPtrToDag(d.getArg(i));
     EmitCaseTest(InnerTest, IndentLevel, OptDescs, O);
-    if (j != NumArgs - 1) {
+    if (i != NumArgs - 1) {
       O << ")\n";
       O.indent(IndentLevel + Indent1) << ' ' << LogicOp << " (";
     }
@@ -1540,7 +1478,7 @@
     EmitLogicalNot(d, IndentLevel, OptDescs, O);
   else if (EmitCaseTest0Args(TestName, O))
     return;
-  else if (EmitCaseTest1Arg(TestName, d, OptDescs, O))
+  else if (EmitCaseTest1OrMoreArgs(TestName, d, OptDescs, O))
     return;
   else if (EmitCaseTest2Args(TestName, d, IndentLevel, OptDescs, O))
     return;
@@ -1587,10 +1525,12 @@
   {}
 
   void operator() (const Init* Statement, unsigned IndentLevel) {
+    // Is this a nested 'case'?
+    bool IsCase = dynamic_cast<const DagInit*>(Statement) &&
+      GetOperatorName(static_cast<const DagInit&>(*Statement)) == "case";
 
-    // Ignore nested 'case' DAG.
-    if (!(dynamic_cast<const DagInit*>(Statement) &&
-          GetOperatorName(static_cast<const DagInit&>(*Statement)) == "case")) {
+    // If so, ignore it, it is handled by our caller, WalkCase.
+    if (!IsCase) {
       if (typeid(*Statement) == typeid(ListInit)) {
         const ListInit& DagList = *static_cast<const ListInit*>(Statement);
         for (ListInit::const_iterator B = DagList.begin(), E = DagList.end();
@@ -1975,7 +1915,6 @@
 
 /// EmitActionHandlersCallback - Emit code that handles actions. Used by
 /// EmitGenerateActionMethod() as an argument to EmitCaseConstructHandler().
-
 class EmitActionHandlersCallback;
 
 typedef void (EmitActionHandlersCallback::* EmitActionHandlersCallbackHandler)
@@ -2177,8 +2116,8 @@
       << "std::vector<std::pair<unsigned, std::string> > vec;\n";
     O.indent(Indent2) << "bool stop_compilation = !HasChildren;\n";
     O.indent(Indent2) << "bool no_out_file = false;\n";
-    O.indent(Indent2) << "const char* output_suffix = \""
-                      << D.OutputSuffix << "\";\n";
+    O.indent(Indent2) << "std::string output_suffix(\""
+                      << D.OutputSuffix << "\");\n";
   }
 }
 
@@ -2235,19 +2174,22 @@
 
   O.indent(Indent3) << "out_file = this->OutFilename("
                     << (IsJoin ? "sys::Path(),\n" : "inFile,\n");
-  O.indent(Indent4) << "TempDir, stop_compilation, output_suffix).str();\n\n";
+  O.indent(Indent4) <<
+    "TempDir, stop_compilation, output_suffix.c_str()).str();\n\n";
   O.indent(Indent3) << "vec.push_back(std::make_pair(65536, out_file));\n";
 
   O.indent(Indent2) << "}\n\n";
 
   // Handle the Sink property.
+  std::string SinkOption("autogenerated::");
+  SinkOption += SinkOptionName;
   if (D.isSink()) {
-    O.indent(Indent2) << "if (!" << SinkOptionName << ".empty()) {\n";
+    O.indent(Indent2) << "if (!" << SinkOption << ".empty()) {\n";
     O.indent(Indent3) << "for (cl::list<std::string>::iterator B = "
-                      << SinkOptionName << ".begin(), E = " << SinkOptionName
+                      << SinkOption << ".begin(), E = " << SinkOption
                       << ".end(); B != E; ++B)\n";
-    O.indent(Indent4) << "vec.push_back(std::make_pair(" << SinkOptionName
-                      << ".getPosition(B - " << SinkOptionName
+    O.indent(Indent4) << "vec.push_back(std::make_pair(" << SinkOption
+                      << ".getPosition(B - " << SinkOption
                       <<  ".begin()), *B));\n";
     O.indent(Indent2) << "}\n";
   }
@@ -2285,11 +2227,8 @@
   O.indent(Indent2) << "return InputLanguages_;\n";
   O.indent(Indent1) << "}\n\n";
 
-  if (D.OutLanguage.empty())
-    throw "Tool " + D.Name + " has no 'out_language' property!";
-
-  O.indent(Indent1) << "const char* OutputLanguage() const {\n";
-  O.indent(Indent2) << "return \"" << D.OutLanguage << "\";\n";
+  O.indent(Indent1) << "const char** OutputLanguages() const {\n";
+  O.indent(Indent2) << "return OutputLanguages_;\n";
   O.indent(Indent1) << "}\n\n";
 }
 
@@ -2334,17 +2273,28 @@
   O.indent(Indent1) << "}\n\n";
 }
 
+/// EmitStrArray - Emit definition of a 'const char**' static member
+/// variable. Helper used by EmitStaticMemberDefinitions();
+void EmitStrArray(const std::string& Name, const std::string& VarName,
+                  const StrVector& StrVec, raw_ostream& O) {
+  O << "const char* " << Name << "::" << VarName << "[] = {";
+  for (StrVector::const_iterator B = StrVec.begin(), E = StrVec.end();
+       B != E; ++B)
+    O << '\"' << *B << "\", ";
+  O << "0};\n";
+}
+
 /// EmitStaticMemberDefinitions - Emit static member definitions for a
 /// given Tool class.
 void EmitStaticMemberDefinitions(const ToolDescription& D, raw_ostream& O) {
   if (D.InLanguage.empty())
     throw "Tool " + D.Name + " has no 'in_language' property!";
+  if (D.OutLanguage.empty())
+    throw "Tool " + D.Name + " has no 'out_language' property!";
 
-  O << "const char* " << D.Name << "::InputLanguages_[] = {";
-  for (StrVector::const_iterator B = D.InLanguage.begin(),
-         E = D.InLanguage.end(); B != E; ++B)
-    O << '\"' << *B << "\", ";
-  O << "0};\n\n";
+  EmitStrArray(D.Name, "InputLanguages_", D.InLanguage, O);
+  EmitStrArray(D.Name, "OutputLanguages_", D.OutLanguage, O);
+  O << '\n';
 }
 
 /// EmitToolClassDefinition - Emit a Tool class definition.
@@ -2362,7 +2312,8 @@
     O << "Tool";
 
   O << " {\nprivate:\n";
-  O.indent(Indent1) << "static const char* InputLanguages_[];\n\n";
+  O.indent(Indent1) << "static const char* InputLanguages_[];\n";
+  O.indent(Indent1) << "static const char* OutputLanguages_[];\n\n";
 
   O << "public:\n";
   EmitNameMethod(D, O);
@@ -2381,8 +2332,7 @@
 /// EmitOptionDefinitions - Iterate over a list of option descriptions
 /// and emit registration code.
 void EmitOptionDefinitions (const OptionDescriptions& descs,
-                            bool HasSink, bool HasExterns,
-                            raw_ostream& O)
+                            bool HasSink, raw_ostream& O)
 {
   std::vector<OptionDescription> Aliases;
 
@@ -2396,16 +2346,8 @@
       continue;
     }
 
-    if (val.isExtern())
-      O << "extern ";
-
     O << val.GenTypeDeclaration() << ' '
-      << val.GenVariableName();
-
-    if (val.isExtern()) {
-      O << ";\n";
-      continue;
-    }
+      << val.GenPlainVariableName();
 
     O << "(\"" << val.Name << "\"\n";
 
@@ -2456,7 +2398,7 @@
     const OptionDescription& val = *B;
 
     O << val.GenTypeDeclaration() << ' '
-      << val.GenVariableName()
+      << val.GenPlainVariableName()
       << "(\"" << val.Name << '\"';
 
     const OptionDescription& D = descs.FindOption(val.Help);
@@ -2467,9 +2409,7 @@
 
   // Emit the sink option.
   if (HasSink)
-    O << (HasExterns ? "extern cl" : "cl")
-      << "::list<std::string> " << SinkOptionName
-      << (HasExterns ? ";\n" : "(cl::Sink);\n");
+    O << "cl::list<std::string> " << SinkOptionName << "(cl::Sink);\n";
 
   O << '\n';
 }
@@ -2494,21 +2434,13 @@
 
   const OptionDescriptions& OptDescs_;
 
-  void onListOrDag(const DagInit& d, HandlerImpl h,
-                   unsigned IndentLevel, raw_ostream& O) const
+  void onEachArgument(const DagInit& d, HandlerImpl h,
+                      unsigned IndentLevel, raw_ostream& O) const
   {
     CheckNumberOfArguments(d, 1);
-    const Init* I = d.getArg(0);
 
-    // If I is a list, apply h to each element.
-    if (typeid(*I) == typeid(ListInit)) {
-      const ListInit& L = *static_cast<const ListInit*>(I);
-      for (ListInit::const_iterator B = L.begin(), E = L.end(); B != E; ++B)
-        ((this)->*(h))(*B, IndentLevel, O);
-    }
-    // Otherwise, apply h to I.
-    else {
-      ((this)->*(h))(I, IndentLevel, O);
+    for (unsigned i = 0, NumArgs = d.getNumArgs(); i < NumArgs; ++i) {
+      ((this)->*(h))(d.getArg(i), IndentLevel, O);
     }
   }
 
@@ -2535,16 +2467,17 @@
   void onUnsetOption(const DagInit& d,
                      unsigned IndentLevel, raw_ostream& O) const
   {
-    this->onListOrDag(d, &EmitPreprocessOptionsCallback::onUnsetOptionImpl,
-                      IndentLevel, O);
+    this->onEachArgument(d, &EmitPreprocessOptionsCallback::onUnsetOptionImpl,
+                         IndentLevel, O);
   }
 
-  void onSetOptionImpl(const DagInit& d,
+  void onSetOptionImpl(const DagInit& D,
                        unsigned IndentLevel, raw_ostream& O) const {
-    CheckNumberOfArguments(d, 2);
-    const std::string& OptName = InitPtrToString(d.getArg(0));
-    const Init* Value = d.getArg(1);
+    CheckNumberOfArguments(D, 2);
+
+    const std::string& OptName = InitPtrToString(D.getArg(0));
     const OptionDescription& OptDesc = OptDescs_.FindOption(OptName);
+    const Init* Value = D.getArg(1);
 
     if (OptDesc.isList()) {
       const ListInit& List = InitPtrToList(Value);
@@ -2574,7 +2507,7 @@
                             << " = \"" << Str << "\";\n";
     }
     else {
-      throw "Can't apply 'set_option' to alias option -" + OptName + " !";
+      throw "Can't apply 'set_option' to alias option '" + OptName + "'!";
     }
   }
 
@@ -2594,15 +2527,22 @@
   {
     CheckNumberOfArguments(d, 1);
 
-    // Two arguments: (set_option "parameter", VALUE), where VALUE can be a
-    // boolean, a string or a string list.
-    if (d.getNumArgs() > 1)
-      this->onSetOptionImpl(d, IndentLevel, O);
-    // One argument: (set_option "switch")
-    // or (set_option ["switch1", "switch2", ...])
-    else
-      this->onListOrDag(d, &EmitPreprocessOptionsCallback::onSetSwitch,
-                        IndentLevel, O);
+    // 2-argument form: (set_option "A", true), (set_option "B", "C"),
+    // (set_option "D", ["E", "F"])
+    if (d.getNumArgs() == 2) {
+      const OptionDescription& OptDesc =
+        OptDescs_.FindOption(InitPtrToString(d.getArg(0)));
+      const Init* Opt2 = d.getArg(1);
+
+      if (!OptDesc.isSwitch() || typeid(*Opt2) != typeid(StringInit)) {
+        this->onSetOptionImpl(d, IndentLevel, O);
+        return;
+      }
+    }
+
+    // Multiple argument form: (set_option "A"), (set_option "B", "C", "D")
+    this->onEachArgument(d, &EmitPreprocessOptionsCallback::onSetSwitch,
+                         IndentLevel, O);
   }
 
 public:
@@ -2628,11 +2568,11 @@
 
 };
 
-/// EmitPreprocessOptions - Emit the PreprocessOptionsLocal() function.
+/// EmitPreprocessOptions - Emit the PreprocessOptions() function.
 void EmitPreprocessOptions (const RecordKeeper& Records,
                             const OptionDescriptions& OptDecs, raw_ostream& O)
 {
-  O << "int PreprocessOptionsLocal() {\n";
+  O << "int PreprocessOptions () {\n";
 
   const RecordVector& OptionPreprocessors =
     Records.getAllDerivedDefinitions("OptionPreprocessor");
@@ -2650,54 +2590,92 @@
   O << "}\n\n";
 }
 
-/// EmitPopulateLanguageMap - Emit the PopulateLanguageMapLocal() function.
-void EmitPopulateLanguageMap (const RecordKeeper& Records, raw_ostream& O)
+class DoEmitPopulateLanguageMap;
+typedef void (DoEmitPopulateLanguageMap::* DoEmitPopulateLanguageMapHandler)
+(const DagInit& D);
+
+class DoEmitPopulateLanguageMap
+: public HandlerTable<DoEmitPopulateLanguageMapHandler>
 {
-  O << "int PopulateLanguageMapLocal(LanguageMap& langMap) {\n";
+private:
+  raw_ostream& O_;
+
+public:
 
-  // Get the relevant field out of RecordKeeper
-  const Record* LangMapRecord = Records.getDef("LanguageMap");
+  explicit DoEmitPopulateLanguageMap (raw_ostream& O) : O_(O) {
+    if (!staticMembersInitialized_) {
+      AddHandler("lang_to_suffixes",
+                 &DoEmitPopulateLanguageMap::onLangToSuffixes);
 
-  // It is allowed for a plugin to have no language map.
-  if (LangMapRecord) {
+      staticMembersInitialized_ = true;
+    }
+  }
+
+  void operator() (Init* I) {
+    InvokeDagInitHandler(this, I);
+  }
 
-    ListInit* LangsToSuffixesList = LangMapRecord->getValueAsListInit("map");
-    if (!LangsToSuffixesList)
-      throw "Error in the language map definition!";
+private:
 
-    for (unsigned i = 0; i < LangsToSuffixesList->size(); ++i) {
-      const Record* LangToSuffixes = LangsToSuffixesList->getElementAsRecord(i);
+  void onLangToSuffixes (const DagInit& d) {
+    CheckNumberOfArguments(d, 2);
 
-      const std::string& Lang = LangToSuffixes->getValueAsString("lang");
-      const ListInit* Suffixes = LangToSuffixes->getValueAsListInit("suffixes");
+    const std::string& Lang = InitPtrToString(d.getArg(0));
+    Init* Suffixes = d.getArg(1);
 
-      for (unsigned i = 0; i < Suffixes->size(); ++i)
-        O.indent(Indent1) << "langMap[\""
-                          << InitPtrToString(Suffixes->getElement(i))
-                          << "\"] = \"" << Lang << "\";\n";
+    // Second argument to lang_to_suffixes is either a single string...
+    if (typeid(*Suffixes) == typeid(StringInit)) {
+      O_.indent(Indent1) << "langMap[\"" << InitPtrToString(Suffixes)
+                         << "\"] = \"" << Lang << "\";\n";
+    }
+    // ...or a list of strings.
+    else {
+      const ListInit& Lst = InitPtrToList(Suffixes);
+      assert(Lst.size() != 0);
+      for (ListInit::const_iterator B = Lst.begin(), E = Lst.end();
+           B != E; ++B) {
+        O_.indent(Indent1) << "langMap[\"" << InitPtrToString(*B)
+                           << "\"] = \"" << Lang << "\";\n";
+      }
     }
   }
 
+};
+
+/// EmitPopulateLanguageMap - Emit the PopulateLanguageMap() function.
+void EmitPopulateLanguageMap (const RecordKeeper& Records, raw_ostream& O)
+{
+  O << "int PopulateLanguageMap (LanguageMap& langMap) {\n";
+
+  // For each LanguageMap:
+  const RecordVector& LangMaps =
+    Records.getAllDerivedDefinitions("LanguageMap");
+
+  // Call DoEmitPopulateLanguageMap.
+  for (RecordVector::const_iterator B = LangMaps.begin(),
+         E = LangMaps.end(); B!=E; ++B) {
+    ListInit* LangMap = (*B)->getValueAsListInit("map");
+    std::for_each(LangMap->begin(), LangMap->end(),
+                  DoEmitPopulateLanguageMap(O));
+  }
+
   O << '\n';
   O.indent(Indent1) << "return 0;\n";
   O << "}\n\n";
 }
 
-/// IncDecWeight - Helper function passed to EmitCaseConstructHandler()
-/// by EmitEdgeClass().
-void IncDecWeight (const Init* i, unsigned IndentLevel,
-                   raw_ostream& O) {
+/// EmitEdgePropertyHandlerCallback - Emits code that handles edge
+/// properties. Helper function passed to EmitCaseConstructHandler() by
+/// EmitEdgeClass().
+void EmitEdgePropertyHandlerCallback (const Init* i, unsigned IndentLevel,
+                                      raw_ostream& O) {
   const DagInit& d = InitPtrToDag(i);
   const std::string& OpName = GetOperatorName(d);
 
   if (OpName == "inc_weight") {
     O.indent(IndentLevel) << "ret += ";
   }
-  else if (OpName == "dec_weight") {
-    O.indent(IndentLevel) << "ret -= ";
-  }
   else if (OpName == "error") {
-    // TODO: fix this
     CheckNumberOfArguments(d, 1);
     O.indent(IndentLevel) << "PrintError(\""
                           << InitPtrToString(d.getArg(0))
@@ -2719,7 +2697,7 @@
 
 /// EmitEdgeClass - Emit a single Edge# class.
 void EmitEdgeClass (unsigned N, const std::string& Target,
-                    DagInit* Case, const OptionDescriptions& OptDescs,
+                    const DagInit& Case, const OptionDescriptions& OptDescs,
                     raw_ostream& O) {
 
   // Class constructor.
@@ -2730,40 +2708,48 @@
 
   // Function Weight().
   O.indent(Indent1)
-    << "unsigned Weight(const InputLanguagesSet& InLangs) const {\n";
+    << "int Weight(const InputLanguagesSet& InLangs) const {\n";
   O.indent(Indent2) << "unsigned ret = 0;\n";
 
   // Handle the 'case' construct.
-  EmitCaseConstructHandler(Case, Indent2, IncDecWeight, false, OptDescs, O);
+  EmitCaseConstructHandler(&Case, Indent2, EmitEdgePropertyHandlerCallback,
+                           false, OptDescs, O);
 
   O.indent(Indent2) << "return ret;\n";
   O.indent(Indent1) << "}\n\n};\n\n";
 }
 
 /// EmitEdgeClasses - Emit Edge* classes that represent graph edges.
-void EmitEdgeClasses (const RecordVector& EdgeVector,
+void EmitEdgeClasses (const DagVector& EdgeVector,
                       const OptionDescriptions& OptDescs,
                       raw_ostream& O) {
   int i = 0;
-  for (RecordVector::const_iterator B = EdgeVector.begin(),
+  for (DagVector::const_iterator B = EdgeVector.begin(),
          E = EdgeVector.end(); B != E; ++B) {
-    const Record* Edge = *B;
-    const std::string& NodeB = Edge->getValueAsString("b");
-    DagInit& Weight = *Edge->getValueAsDag("weight");
+    const DagInit& Edge = **B;
+    const std::string& Name = GetOperatorName(Edge);
+
+    if (Name == "optional_edge") {
+      assert(IsOptionalEdge(Edge));
+      const std::string& NodeB = InitPtrToString(Edge.getArg(1));
+
+      const DagInit& Weight = InitPtrToDag(Edge.getArg(2));
+      EmitEdgeClass(i, NodeB, Weight, OptDescs, O);
+    }
+    else if (Name != "edge") {
+      throw "Unknown edge class: '" + Name + "'!";
+    }
 
-    if (!IsDagEmpty(Weight))
-      EmitEdgeClass(i, NodeB, &Weight, OptDescs, O);
     ++i;
   }
 }
 
-/// EmitPopulateCompilationGraph - Emit the PopulateCompilationGraphLocal()
-/// function.
-void EmitPopulateCompilationGraph (const RecordVector& EdgeVector,
+/// EmitPopulateCompilationGraph - Emit the PopulateCompilationGraph() function.
+void EmitPopulateCompilationGraph (const DagVector& EdgeVector,
                                    const ToolDescriptions& ToolDescs,
                                    raw_ostream& O)
 {
-  O << "int PopulateCompilationGraphLocal(CompilationGraph& G) {\n";
+  O << "int PopulateCompilationGraph (CompilationGraph& G) {\n";
 
   for (ToolDescriptions::const_iterator B = ToolDescs.begin(),
          E = ToolDescs.end(); B != E; ++B)
@@ -2774,19 +2760,18 @@
   // Insert edges.
 
   int i = 0;
-  for (RecordVector::const_iterator B = EdgeVector.begin(),
+  for (DagVector::const_iterator B = EdgeVector.begin(),
          E = EdgeVector.end(); B != E; ++B) {
-    const Record* Edge = *B;
-    const std::string& NodeA = Edge->getValueAsString("a");
-    const std::string& NodeB = Edge->getValueAsString("b");
-    DagInit& Weight = *Edge->getValueAsDag("weight");
+    const DagInit& Edge = **B;
+    const std::string& NodeA = InitPtrToString(Edge.getArg(0));
+    const std::string& NodeB = InitPtrToString(Edge.getArg(1));
 
     O.indent(Indent1) << "if (int ret = G.insertEdge(\"" << NodeA << "\", ";
 
-    if (IsDagEmpty(Weight))
-      O << "new SimpleEdge(\"" << NodeB << "\")";
-    else
+    if (IsOptionalEdge(Edge))
       O << "new Edge" << i << "()";
+    else
+      O << "new SimpleEdge(\"" << NodeB << "\")";
 
     O << "))\n";
     O.indent(Indent2) << "return ret;\n";
@@ -2901,13 +2886,10 @@
       return;
     }
 
-    // We're invoked on a command line.
+    // We're invoked on a command line string.
     this->onCmdLine(InitPtrToString(Arg));
   }
 
-  void operator()(const DagInit* Test, unsigned, bool) {
-    this->operator()(Test);
-  }
   void operator()(const Init* Statement, unsigned) {
     this->operator()(Statement);
   }
@@ -2951,7 +2933,6 @@
   if (HookNames.empty())
     return;
 
-  O << "namespace hooks {\n";
   for (HookInfoMap::const_iterator B = HookNames.begin(),
          E = HookNames.end(); B != E; ++B) {
     const char* HookName = B->first();
@@ -2970,23 +2951,6 @@
 
     O <<");\n";
   }
-  O << "}\n\n";
-}
-
-/// EmitRegisterPlugin - Emit code to register this plugin.
-void EmitRegisterPlugin(int Priority, raw_ostream& O) {
-  O << "struct Plugin : public llvmc::BasePlugin {\n\n";
-  O.indent(Indent1) << "int Priority() const { return "
-                    << Priority << "; }\n\n";
-  O.indent(Indent1) << "int PreprocessOptions() const\n";
-  O.indent(Indent1) << "{ return PreprocessOptionsLocal(); }\n\n";
-  O.indent(Indent1) << "int PopulateLanguageMap(LanguageMap& langMap) const\n";
-  O.indent(Indent1) << "{ return PopulateLanguageMapLocal(langMap); }\n\n";
-  O.indent(Indent1)
-    << "int PopulateCompilationGraph(CompilationGraph& graph) const\n";
-  O.indent(Indent1) << "{ return PopulateCompilationGraphLocal(graph); }\n"
-                    << "};\n\n"
-                    << "static llvmc::RegisterPlugin<Plugin> RP;\n\n";
 }
 
 /// EmitIncludes - Emit necessary #include directives and some
@@ -2995,8 +2959,6 @@
   O << "#include \"llvm/CompilerDriver/BuiltinOptions.h\"\n"
     << "#include \"llvm/CompilerDriver/CompilationGraph.h\"\n"
     << "#include \"llvm/CompilerDriver/Error.h\"\n"
-    << "#include \"llvm/CompilerDriver/ForceLinkageMacros.h\"\n"
-    << "#include \"llvm/CompilerDriver/Plugin.h\"\n"
     << "#include \"llvm/CompilerDriver/Tool.h\"\n\n"
 
     << "#include \"llvm/Support/CommandLine.h\"\n"
@@ -3010,21 +2972,17 @@
     << "using namespace llvm;\n"
     << "using namespace llvmc;\n\n"
 
-    << "extern cl::opt<std::string> OutputFilename;\n\n"
-
     << "inline const char* checkCString(const char* s)\n"
     << "{ return s == NULL ? \"\" : s; }\n\n";
 }
 
 
-/// PluginData - Holds all information about a plugin.
-struct PluginData {
+/// DriverData - Holds all information about the driver.
+struct DriverData {
   OptionDescriptions OptDescs;
-  bool HasSink;
-  bool HasExterns;
   ToolDescriptions ToolDescs;
-  RecordVector Edges;
-  int Priority;
+  DagVector Edges;
+  bool HasSink;
 };
 
 /// HasSink - Go through the list of tool descriptions and check if
@@ -3038,46 +2996,27 @@
   return false;
 }
 
-/// HasExterns - Go through the list of option descriptions and check
-/// if there are any external options.
-bool HasExterns(const OptionDescriptions& OptDescs) {
- for (OptionDescriptions::const_iterator B = OptDescs.begin(),
-         E = OptDescs.end(); B != E; ++B)
-    if (B->second.isExtern())
-      return true;
-
-  return false;
-}
-
-/// CollectPluginData - Collect tool and option properties,
-/// compilation graph edges and plugin priority from the parse tree.
-void CollectPluginData (const RecordKeeper& Records, PluginData& Data) {
+/// CollectDriverData - Collect compilation graph edges, tool properties and
+/// option properties from the parse tree.
+void CollectDriverData (const RecordKeeper& Records, DriverData& Data) {
   // Collect option properties.
   const RecordVector& OptionLists =
     Records.getAllDerivedDefinitions("OptionList");
-  CollectOptionDescriptions(OptionLists.begin(), OptionLists.end(),
-                            Data.OptDescs);
+  CollectOptionDescriptions(OptionLists, Data.OptDescs);
 
   // Collect tool properties.
   const RecordVector& Tools = Records.getAllDerivedDefinitions("Tool");
-  CollectToolDescriptions(Tools.begin(), Tools.end(), Data.ToolDescs);
+  CollectToolDescriptions(Tools, Data.ToolDescs);
   Data.HasSink = HasSink(Data.ToolDescs);
-  Data.HasExterns = HasExterns(Data.OptDescs);
 
   // Collect compilation graph edges.
   const RecordVector& CompilationGraphs =
     Records.getAllDerivedDefinitions("CompilationGraph");
-  FillInEdgeVector(CompilationGraphs.begin(), CompilationGraphs.end(),
-                   Data.Edges);
-
-  // Calculate the priority of this plugin.
-  const RecordVector& Priorities =
-    Records.getAllDerivedDefinitions("PluginPriority");
-  Data.Priority = CalculatePriority(Priorities.begin(), Priorities.end());
+  FillInEdgeVector(CompilationGraphs, Data.Edges);
 }
 
-/// CheckPluginData - Perform some sanity checks on the collected data.
-void CheckPluginData(PluginData& Data) {
+/// CheckDriverData - Perform some sanity checks on the collected data.
+void CheckDriverData(DriverData& Data) {
   // Filter out all tools not mentioned in the compilation graph.
   FilterNotInGraph(Data.Edges, Data.ToolDescs);
 
@@ -3089,24 +3028,24 @@
   CheckForSuperfluousOptions(Data.Edges, Data.ToolDescs, Data.OptDescs);
 }
 
-void EmitPluginCode(const PluginData& Data, raw_ostream& O) {
+void EmitDriverCode(const DriverData& Data, raw_ostream& O) {
   // Emit file header.
   EmitIncludes(O);
 
   // Emit global option registration code.
-  EmitOptionDefinitions(Data.OptDescs, Data.HasSink, Data.HasExterns, O);
+  O << "namespace llvmc {\n"
+    << "namespace autogenerated {\n\n";
+  EmitOptionDefinitions(Data.OptDescs, Data.HasSink, O);
+  O << "} // End namespace autogenerated.\n"
+    << "} // End namespace llvmc.\n\n";
 
   // Emit hook declarations.
+  O << "namespace hooks {\n";
   EmitHookDeclarations(Data.ToolDescs, Data.OptDescs, O);
+  O << "} // End namespace hooks.\n\n";
 
   O << "namespace {\n\n";
-
-  // Emit PreprocessOptionsLocal() function.
-  EmitPreprocessOptions(Records, Data.OptDescs, O);
-
-  // Emit PopulateLanguageMapLocal() function
-  // (language map maps from file extensions to language names).
-  EmitPopulateLanguageMap(Records, O);
+  O << "using namespace llvmc::autogenerated;\n\n";
 
   // Emit Tool classes.
   for (ToolDescriptions::const_iterator B = Data.ToolDescs.begin(),
@@ -3116,18 +3055,23 @@
   // Emit Edge# classes.
   EmitEdgeClasses(Data.Edges, Data.OptDescs, O);
 
-  // Emit PopulateCompilationGraphLocal() function.
-  EmitPopulateCompilationGraph(Data.Edges, Data.ToolDescs, O);
-
-  // Emit code for plugin registration.
-  EmitRegisterPlugin(Data.Priority, O);
-
   O << "} // End anonymous namespace.\n\n";
 
-  // Force linkage magic.
   O << "namespace llvmc {\n";
-  O << "LLVMC_FORCE_LINKAGE_DECL(LLVMC_PLUGIN_NAME) {}\n";
-  O << "}\n";
+  O << "namespace autogenerated {\n\n";
+
+  // Emit PreprocessOptions() function.
+  EmitPreprocessOptions(Records, Data.OptDescs, O);
+
+  // Emit PopulateLanguageMap() function
+  // (language map maps from file extensions to language names).
+  EmitPopulateLanguageMap(Records, O);
+
+  // Emit PopulateCompilationGraph() function.
+  EmitPopulateCompilationGraph(Data.Edges, Data.ToolDescs, O);
+
+  O << "} // End namespace autogenerated.\n";
+  O << "} // End namespace llvmc.\n\n";
 
   // EOF
 }
@@ -3139,13 +3083,13 @@
 /// run - The back-end entry point.
 void LLVMCConfigurationEmitter::run (raw_ostream &O) {
   try {
-  PluginData Data;
+    DriverData Data;
 
-  CollectPluginData(Records, Data);
-  CheckPluginData(Data);
+    CollectDriverData(Records, Data);
+    CheckDriverData(Data);
 
-  this->EmitSourceFileHeader("LLVMC Configuration Library", O);
-  EmitPluginCode(Data, O);
+    this->EmitSourceFileHeader("llvmc-based driver: auto-generated code", O);
+    EmitDriverCode(Data, O);
 
   } catch (std::exception& Error) {
     throw Error.what() + std::string(" - usually this means a syntax error.");

Modified: llvm/branches/wendling/eh/utils/TableGen/NeonEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/TableGen/NeonEmitter.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/TableGen/NeonEmitter.cpp (original)
+++ llvm/branches/wendling/eh/utils/TableGen/NeonEmitter.cpp Tue Oct 26 19:48:03 2010
@@ -145,6 +145,9 @@
       type = 'f';
       usgn = false;
       break;
+    case 'g':
+      quad = false;
+      break;
     case 'w':
       type = Widen(type);
       quad = true;
@@ -549,10 +552,14 @@
   }
   
   std::string ts = TypeString(proto[0], typestr);
-  std::string s = ts + " r; r";
-  
-  if (structTypes)
-    s += ".val";
+  std::string s;
+  if (op == OpHi || op == OpLo) {
+    s = "union { " + ts + " r; double d; } u; u.d";
+  } else {
+    s = ts + " r; r";
+    if (structTypes)
+      s += ".val";
+  }
   
   s += " = ";
 
@@ -628,10 +635,10 @@
     s += ", (__neon_int64x1_t)" + b + ", 0, 1)";
     break;
   case OpHi:
-    s += "(__neon_int64x1_t)(((__neon_int64x2_t)" + a + ")[1])";
+    s += "(((__neon_float64x2_t)" + a + ")[1])";
     break;
   case OpLo:
-    s += "(__neon_int64x1_t)(((__neon_int64x2_t)" + a + ")[0])";
+    s += "(((__neon_float64x2_t)" + a + ")[0])";
     break;
   case OpDup:
     s += Duplicate(nElts << (int)quad, typestr, a);
@@ -668,7 +675,10 @@
     throw "unknown OpKind!";
     break;
   }
-  s += "; return r;";
+  if (op == OpHi || op == OpLo)
+    s += "; return u.r;";
+  else
+    s += "; return r;";
   return s;
 }
 
@@ -686,15 +696,15 @@
   bool cnst = false;
   bool pntr = false;
   
-  // base type to get the type string for.
+  // Base type to get the type string for.
   char type = ClassifyType(typestr, quad, poly, usgn);
   
   // Based on the modifying character, change the type and width if necessary.
   type = ModType(mod, type, quad, poly, usgn, scal, cnst, pntr);
-  
+
   if (usgn)
     ret |= 0x08;
-  if (quad)
+  if (quad && proto[1] != 'g')
     ret |= 0x10;
   
   switch (type) {
@@ -909,7 +919,7 @@
       OS << "typedef __attribute__(( __vector_size__(";
       
       OS << utostr(8*v*(quad ? 2 : 1)) << ") )) ";
-      if (!quad)
+      if (!quad && v == 1)
         OS << " ";
       
       OS << TypeString('s', TDTypeVec[i]);
@@ -920,6 +930,11 @@
     }
   }
   OS << "\n";
+  OS << "typedef __attribute__(( __vector_size__(8) ))  "
+    "double __neon_float64x1_t;\n";
+  OS << "typedef __attribute__(( __vector_size__(16) )) "
+    "double __neon_float64x2_t;\n";
+  OS << "\n";
 
   // Emit struct typedefs.
   for (unsigned vi = 1; vi != 5; ++vi) {

Modified: llvm/branches/wendling/eh/utils/TableGen/Record.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/TableGen/Record.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/TableGen/Record.cpp (original)
+++ llvm/branches/wendling/eh/utils/TableGen/Record.cpp Tue Oct 26 19:48:03 2010
@@ -152,16 +152,6 @@
       return new BinOpInit(BinOpInit::STRCONCAT, L, R, new StringRecTy);
     return BO;
   }
-  if (BO->getOpcode() == BinOpInit::NAMECONCAT) {
-    if (BO->getType()->getAsString() == getAsString()) {
-      Init *L = BO->getLHS()->convertInitializerTo(this);
-      Init *R = BO->getRHS()->convertInitializerTo(this);
-      if (L == 0 || R == 0) return 0;
-      if (L != BO->getLHS() || R != BO->getRHS())
-        return new BinOpInit(BinOpInit::NAMECONCAT, L, R, new StringRecTy);
-      return BO;
-    }
-  }
 
   return convertValue((TypedInit*)BO);
 }
@@ -236,16 +226,6 @@
       return new BinOpInit(BinOpInit::CONCAT, L, R, new DagRecTy);
     return BO;
   }
-  if (BO->getOpcode() == BinOpInit::NAMECONCAT) {
-    if (BO->getType()->getAsString() == getAsString()) {
-      Init *L = BO->getLHS()->convertInitializerTo(this);
-      Init *R = BO->getRHS()->convertInitializerTo(this);
-      if (L == 0 || R == 0) return 0;
-      if (L != BO->getLHS() || R != BO->getRHS())
-        return new BinOpInit(BinOpInit::CONCAT, L, R, new DagRecTy);
-      return BO;
-    }
-  }
   return 0;
 }
 
@@ -518,9 +498,8 @@
         // From TGParser::ParseIDValue
         if (CurRec) {
           if (const RecordVal *RV = CurRec->getValue(Name)) {
-            if (RV->getType() != getType()) {
-              throw "type mismatch in nameconcat";
-            }
+            if (RV->getType() != getType())
+              throw "type mismatch in cast";
             return new VarInit(Name, RV->getType());
           }
 
@@ -529,9 +508,8 @@
             const RecordVal *RV = CurRec->getValue(TemplateArgName);
             assert(RV && "Template arg doesn't exist??");
 
-            if (RV->getType() != getType()) {
-              throw "type mismatch in nameconcat";
-            }
+            if (RV->getType() != getType())
+              throw "type mismatch in cast";
 
             return new VarInit(TemplateArgName, RV->getType());
           }
@@ -543,9 +521,8 @@
             const RecordVal *RV = CurMultiClass->Rec.getValue(MCName);
             assert(RV && "Template arg doesn't exist??");
 
-            if (RV->getType() != getType()) {
-              throw "type mismatch in nameconcat";
-            }
+            if (RV->getType() != getType())
+              throw "type mismatch in cast";
 
             return new VarInit(MCName, RV->getType());
           }
@@ -628,23 +605,6 @@
   return Result + "(" + LHS->getAsString() + ")";
 }
 
-RecTy *UnOpInit::getFieldType(const std::string &FieldName) const {
-  switch (getOpcode()) {
-  default: assert(0 && "Unknown unop");
-  case CAST: {
-    RecordRecTy *RecordType = dynamic_cast<RecordRecTy *>(getType());
-    if (RecordType) {
-      RecordVal *Field = RecordType->getRecord()->getValue(FieldName);
-      if (Field) {
-        return Field->getType();
-      }
-    }
-    break;
-  }
-  }
-  return 0;
-}
-
 Init *BinOpInit::Fold(Record *CurRec, MultiClass *CurMultiClass) {
   switch (getOpcode()) {
   default: assert(0 && "Unknown binop");
@@ -677,57 +637,6 @@
       return new StringInit(LHSs->getValue() + RHSs->getValue());
     break;
   }
-  case NAMECONCAT: {
-    StringInit *LHSs = dynamic_cast<StringInit*>(LHS);
-    StringInit *RHSs = dynamic_cast<StringInit*>(RHS);
-    if (LHSs && RHSs) {
-      std::string Name(LHSs->getValue() + RHSs->getValue());
-
-      // From TGParser::ParseIDValue
-      if (CurRec) {
-        if (const RecordVal *RV = CurRec->getValue(Name)) {
-          if (RV->getType() != getType()) {
-            throw "type mismatch in nameconcat";
-          }
-          return new VarInit(Name, RV->getType());
-        }
-
-        std::string TemplateArgName = CurRec->getName()+":"+Name;
-        if (CurRec->isTemplateArg(TemplateArgName)) {
-          const RecordVal *RV = CurRec->getValue(TemplateArgName);
-          assert(RV && "Template arg doesn't exist??");
-
-          if (RV->getType() != getType()) {
-            throw "type mismatch in nameconcat";
-          }
-
-          return new VarInit(TemplateArgName, RV->getType());
-        }
-      }
-
-      if (CurMultiClass) {
-        std::string MCName = CurMultiClass->Rec.getName()+"::"+Name;
-        if (CurMultiClass->Rec.isTemplateArg(MCName)) {
-          const RecordVal *RV = CurMultiClass->Rec.getValue(MCName);
-          assert(RV && "Template arg doesn't exist??");
-
-          if (RV->getType() != getType()) {
-            throw "type mismatch in nameconcat";
-          }
-
-          return new VarInit(MCName, RV->getType());
-        }
-      }
-
-      if (Record *D = Records.getDef(Name))
-        return new DefInit(D);
-
-      errs() << "Variable not defined in !nameconcat: '" + Name + "'\n";
-      assert(0 && "Variable not found in !nameconcat");
-      return 0;
-    }
-    break;
-  }
   case EQ: {
     // try to fold eq comparison for 'bit' and 'int', otherwise fallback
     // to string objects.
@@ -788,8 +697,6 @@
   case SRL: Result = "!srl"; break;
   case EQ: Result = "!eq"; break;
   case STRCONCAT: Result = "!strconcat"; break;
-  case NAMECONCAT:
-    Result = "!nameconcat<" + getType()->getAsString() + ">"; break;
   }
   return Result + "(" + LHS->getAsString() + ", " + RHS->getAsString() + ")";
 }
@@ -1046,6 +953,17 @@
     + RHS->getAsString() + ")";
 }
 
+RecTy *TypedInit::getFieldType(const std::string &FieldName) const {
+  RecordRecTy *RecordType = dynamic_cast<RecordRecTy *>(getType());
+  if (RecordType) {
+    RecordVal *Field = RecordType->getRecord()->getValue(FieldName);
+    if (Field) {
+      return Field->getType();
+    }
+  }
+  return 0;
+}
+
 Init *TypedInit::convertInitializerBitRange(const std::vector<unsigned> &Bits) {
   BitsRecTy *T = dynamic_cast<BitsRecTy*>(getType());
   if (T == 0) return 0;  // Cannot subscript a non-bits variable...

Modified: llvm/branches/wendling/eh/utils/TableGen/Record.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/TableGen/Record.h?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/TableGen/Record.h (original)
+++ llvm/branches/wendling/eh/utils/TableGen/Record.h Tue Oct 26 19:48:03 2010
@@ -535,6 +535,12 @@
   virtual Init *convertInitializerBitRange(const std::vector<unsigned> &Bits);
   virtual Init *convertInitListSlice(const std::vector<unsigned> &Elements);
 
+  /// getFieldType - This method is used to implement the FieldInit class.
+  /// Implementors of this method should return the type of the named field if
+  /// they are of record type.
+  ///
+  virtual RecTy *getFieldType(const std::string &FieldName) const;
+
   /// resolveBitReference - This method is used to implement
   /// VarBitInit::resolveReferences.  If the bit is able to be resolved, we
   /// simply return the resolved value, otherwise we return null.
@@ -835,12 +841,6 @@
 
   virtual Init *resolveReferences(Record &R, const RecordVal *RV);
 
-  /// getFieldType - This method is used to implement the FieldInit class.
-  /// Implementors of this method should return the type of the named field if
-  /// they are of record type.
-  ///
-  virtual RecTy *getFieldType(const std::string &FieldName) const;
-
   virtual std::string getAsString() const;
 };
 
@@ -848,7 +848,7 @@
 ///
 class BinOpInit : public OpInit {
 public:
-  enum BinaryOp { SHL, SRA, SRL, STRCONCAT, CONCAT, NAMECONCAT, EQ };
+  enum BinaryOp { SHL, SRA, SRL, STRCONCAT, CONCAT, EQ };
 private:
   BinaryOp Opc;
   Init *LHS, *RHS;
@@ -1233,10 +1233,10 @@
     ID(LastID++), Name(N), Loc(loc) {}
   ~Record() {}
 
-  
+
   static unsigned getNewUID() { return LastID++; }
-    
-    
+
+
   unsigned getID() const { return ID; }
 
   const std::string &getName() const { return Name; }
@@ -1350,9 +1350,9 @@
   ///
   std::vector<Record*> getValueAsListOfDefs(StringRef FieldName) const;
 
-  /// getValueAsListOfInts - This method looks up the specified field and returns
-  /// its value as a vector of integers, throwing an exception if the field does
-  /// not exist or if the value is not the right type.
+  /// getValueAsListOfInts - This method looks up the specified field and
+  /// returns its value as a vector of integers, throwing an exception if the
+  /// field does not exist or if the value is not the right type.
   ///
   std::vector<int64_t> getValueAsListOfInts(StringRef FieldName) const;
 
@@ -1490,7 +1490,7 @@
 
 extern RecordKeeper Records;
 
-void PrintError(SMLoc ErrorLoc, const std::string &Msg);
+void PrintError(SMLoc ErrorLoc, const Twine &Msg);
 
 } // End llvm namespace
 

Modified: llvm/branches/wendling/eh/utils/TableGen/RegisterInfoEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/TableGen/RegisterInfoEmitter.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/TableGen/RegisterInfoEmitter.cpp (original)
+++ llvm/branches/wendling/eh/utils/TableGen/RegisterInfoEmitter.cpp Tue Oct 26 19:48:03 2010
@@ -119,16 +119,6 @@
   OS << "} // End llvm namespace \n";
 }
 
-bool isSubRegisterClass(const CodeGenRegisterClass &RC,
-                        std::set<Record*> &RegSet) {
-  for (unsigned i = 0, e = RC.Elements.size(); i != e; ++i) {
-    Record *Reg = RC.Elements[i];
-    if (!RegSet.count(Reg))
-      return false;
-  }
-  return true;
-}
-
 static void addSuperReg(Record *R, Record *S,
                   std::map<Record*, std::set<Record*>, LessRecord> &SubRegs,
                   std::map<Record*, std::set<Record*>, LessRecord> &SuperRegs,
@@ -498,12 +488,6 @@
       // Give the register class a legal C name if it's anonymous.
       std::string Name = RC.TheDef->getName();
 
-      std::set<Record*> RegSet;
-      for (unsigned i = 0, e = RC.Elements.size(); i != e; ++i) {
-        Record *Reg = RC.Elements[i];
-        RegSet.insert(Reg);
-      }
-
       OS << "  // " << Name 
          << " Register Class sub-classes...\n"
          << "  static const TargetRegisterClass* const "
@@ -513,21 +497,9 @@
       for (unsigned rc2 = 0, e2 = RegisterClasses.size(); rc2 != e2; ++rc2) {
         const CodeGenRegisterClass &RC2 = RegisterClasses[rc2];
 
-        // RC2 is a sub-class of RC if it is a valid replacement for any
-        // instruction operand where an RC register is required. It must satisfy
-        // these conditions:
-        //
-        // 1. All RC2 registers are also in RC.
-        // 2. The RC2 spill size must not be smaller that the RC spill size.
-        // 3. RC2 spill alignment must be compatible with RC.
-        //
         // Sub-classes are used to determine if a virtual register can be used
         // as an instruction operand, or if it must be copied first.
-
-        if (rc == rc2 || RC2.Elements.size() > RC.Elements.size() ||
-            (RC.SpillAlignment && RC2.SpillAlignment % RC.SpillAlignment) ||
-            RC.SpillSize > RC2.SpillSize || !isSubRegisterClass(RC2, RegSet))
-          continue;
+        if (rc == rc2 || !RC.hasSubClass(&RC2)) continue;
       
         if (!Empty) OS << ", ";
         OS << "&" << getQualifiedName(RC2.TheDef) << "RegClass";

Modified: llvm/branches/wendling/eh/utils/TableGen/SubtargetEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/TableGen/SubtargetEmitter.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/TableGen/SubtargetEmitter.cpp (original)
+++ llvm/branches/wendling/eh/utils/TableGen/SubtargetEmitter.cpp Tue Oct 26 19:48:03 2010
@@ -172,13 +172,10 @@
 // CollectAllItinClasses - Gathers and enumerates all the itinerary classes.
 // Returns itinerary class count.
 //
-unsigned SubtargetEmitter::CollectAllItinClasses(raw_ostream &OS,
-                              std::map<std::string, unsigned> &ItinClassesMap) {
-  // Gather and sort all itinerary classes
-  std::vector<Record*> ItinClassList =
-                            Records.getAllDerivedDefinitions("InstrItinClass");
-  std::sort(ItinClassList.begin(), ItinClassList.end(), LessRecord());
-
+unsigned SubtargetEmitter::
+CollectAllItinClasses(raw_ostream &OS,
+                      std::map<std::string, unsigned> &ItinClassesMap,
+                      std::vector<Record*> &ItinClassList) {
   // For each itinerary class
   unsigned N = ItinClassList.size();
   for (unsigned i = 0; i < N; i++) {
@@ -265,13 +262,32 @@
   }
 }
 
+void SubtargetEmitter::FormItineraryBypassString(const std::string &Name,
+                                                 Record *ItinData,
+                                                 std::string &ItinString,
+                                                 unsigned NOperandCycles) {
+  const std::vector<Record*> &BypassList =
+    ItinData->getValueAsListOfDefs("Bypasses");
+  unsigned N = BypassList.size();
+  unsigned i = 0;
+  for (; i < N;) {
+    ItinString += Name + "Bypass::" + BypassList[i]->getName();
+    if (++i < NOperandCycles) ItinString += ", ";
+  }
+  for (; i < NOperandCycles;) {
+    ItinString += " 0";
+    if (++i < NOperandCycles) ItinString += ", ";
+  }
+}
+
 //
 // EmitStageAndOperandCycleData - Generate unique itinerary stages and
 // operand cycle tables.  Record itineraries for processors.
 //
 void SubtargetEmitter::EmitStageAndOperandCycleData(raw_ostream &OS,
        unsigned NItinClasses,
-       std::map<std::string, unsigned> &ItinClassesMap, 
+       std::map<std::string, unsigned> &ItinClassesMap,
+       std::vector<Record*> &ItinClassList,
        std::vector<std::vector<InstrItinerary> > &ProcList) {
   // Gather processor iteraries
   std::vector<Record*> ProcItinList =
@@ -298,6 +314,19 @@
          << " = 1 << " << j << ";\n";
 
     OS << "}\n";
+
+    std::vector<Record*> BPs = Proc->getValueAsListOfDefs("BP");
+    if (BPs.size()) {
+      OS << "\n// Pipeline forwarding pathes for itineraries \"" << Name
+         << "\"\n" << "namespace " << Name << "Bypass {\n";
+
+      OS << "  const unsigned NoBypass = 0;\n";
+      for (unsigned j = 0, BPN = BPs.size(); j < BPN; ++j)
+        OS << "  const unsigned " << BPs[j]->getName()
+           << " = 1 << " << j << ";\n";
+
+      OS << "}\n";
+    }
   }
 
   // Begin stages table
@@ -307,10 +336,14 @@
   // Begin operand cycle table
   std::string OperandCycleTable = "static const unsigned OperandCycles[] = {\n";
   OperandCycleTable += "  0, // No itinerary\n";
+
+  // Begin pipeline bypass table
+  std::string BypassTable = "static const unsigned ForwardingPathes[] = {\n";
+  BypassTable += "  0, // No itinerary\n";
         
   unsigned StageCount = 1, OperandCycleCount = 1;
   unsigned ItinStageEnum = 1, ItinOperandCycleEnum = 1;
-  std::map<std::string, unsigned> ItinStageMap, ItinOperandCycleMap;
+  std::map<std::string, unsigned> ItinStageMap, ItinOperandMap;
   for (unsigned i = 0, N = ProcItinList.size(); i < N; i++) {
     // Next record
     Record *Proc = ProcItinList[i];
@@ -344,6 +377,10 @@
       FormItineraryOperandCycleString(ItinData, ItinOperandCycleString,
                                       NOperandCycles);
 
+      std::string ItinBypassString;
+      FormItineraryBypassString(Name, ItinData, ItinBypassString,
+                                NOperandCycles);
+
       // Check to see if stage already exists and create if it doesn't
       unsigned FindStage = 0;
       if (NStages > 0) {
@@ -361,27 +398,35 @@
       // Check to see if operand cycle already exists and create if it doesn't
       unsigned FindOperandCycle = 0;
       if (NOperandCycles > 0) {
-        FindOperandCycle = ItinOperandCycleMap[ItinOperandCycleString];
+        std::string ItinOperandString = ItinOperandCycleString+ItinBypassString;
+        FindOperandCycle = ItinOperandMap[ItinOperandString];
         if (FindOperandCycle == 0) {
           // Emit as  cycle, // index
           OperandCycleTable += ItinOperandCycleString + ", // " + 
             itostr(ItinOperandCycleEnum) + "\n";
           // Record Itin class number.
-          ItinOperandCycleMap[ItinOperandCycleString] = 
+          ItinOperandMap[ItinOperandCycleString] = 
             FindOperandCycle = OperandCycleCount;
+
+          // Emit as bypass, // index
+          BypassTable += ItinBypassString + ", // " + 
+            itostr(ItinOperandCycleEnum) + "\n";
+
           OperandCycleCount += NOperandCycles;
           ItinOperandCycleEnum++;
         }
       }
       
-      // Set up itinerary as location and location + stage count
-      InstrItinerary Intinerary = { FindStage, FindStage + NStages,
-                                    FindOperandCycle, FindOperandCycle + NOperandCycles};
-
       // Locate where to inject into processor itinerary table
       const std::string &Name = ItinData->getValueAsDef("TheClass")->getName();
       unsigned Find = ItinClassesMap[Name];
       
+      // Set up itinerary as location and location + stage count
+      unsigned NumUOps = ItinClassList[Find]->getValueAsInt("NumMicroOps");
+      InstrItinerary Intinerary = { NumUOps, FindStage, FindStage + NStages,
+                                    FindOperandCycle,
+                                    FindOperandCycle + NOperandCycles};
+
       // Inject - empty slots will be 0, 0
       ItinList[Find] = Intinerary;
     }
@@ -389,7 +434,7 @@
     // Add process itinerary to list
     ProcList.push_back(ItinList);
   }
-  
+
   // Closing stage
   StageTable += "  { 0, 0, 0, llvm::InstrStage::Required } // End itinerary\n";
   StageTable += "};\n";
@@ -398,9 +443,13 @@
   OperandCycleTable += "  0 // End itinerary\n";
   OperandCycleTable += "};\n";
 
+  BypassTable += "  0 // End itinerary\n";
+  BypassTable += "};\n";
+
   // Emit tables.
   OS << StageTable;
   OS << OperandCycleTable;
+  OS << BypassTable;
   
   // Emit size of tables
   OS<<"\nenum {\n";
@@ -443,9 +492,11 @@
       // Emit in the form of 
       // { firstStage, lastStage, firstCycle, lastCycle } // index
       if (Intinerary.FirstStage == 0) {
-        OS << "  { 0, 0, 0, 0 }";
+        OS << "  { 1, 0, 0, 0, 0 }";
       } else {
-        OS << "  { " << Intinerary.FirstStage << ", " << 
+        OS << "  { " <<
+          Intinerary.NumMicroOps << ", " <<
+          Intinerary.FirstStage << ", " << 
           Intinerary.LastStage << ", " << 
           Intinerary.FirstOperandCycle << ", " << 
           Intinerary.LastOperandCycle << " }";
@@ -455,7 +506,7 @@
     }
     
     // End processor itinerary table
-    OS << "  { ~0U, ~0U, ~0U, ~0U } // end marker\n";
+    OS << "  { 1, ~0U, ~0U, ~0U, ~0U } // end marker\n";
     OS << "};\n";
   }
 }
@@ -511,16 +562,22 @@
 //
 void SubtargetEmitter::EmitData(raw_ostream &OS) {
   std::map<std::string, unsigned> ItinClassesMap;
-  std::vector<std::vector<InstrItinerary> > ProcList;
+  // Gather and sort all itinerary classes
+  std::vector<Record*> ItinClassList =
+    Records.getAllDerivedDefinitions("InstrItinClass");
+  std::sort(ItinClassList.begin(), ItinClassList.end(), LessRecord());
   
   // Enumerate all the itinerary classes
-  unsigned NItinClasses = CollectAllItinClasses(OS, ItinClassesMap);
+  unsigned NItinClasses = CollectAllItinClasses(OS, ItinClassesMap,
+                                                ItinClassList);
   // Make sure the rest is worth the effort
   HasItineraries = NItinClasses != 1;   // Ignore NoItinerary.
   
   if (HasItineraries) {
+    std::vector<std::vector<InstrItinerary> > ProcList;
     // Emit the stage data
-    EmitStageAndOperandCycleData(OS, NItinClasses, ItinClassesMap, ProcList);
+    EmitStageAndOperandCycleData(OS, NItinClasses, ItinClassesMap,
+                                 ItinClassList, ProcList);
     // Emit the processor itinerary data
     EmitProcessorData(OS, ProcList);
     // Emit the processor lookup data
@@ -569,7 +626,8 @@
     OS << "\n"
        << "  InstrItinerary *Itinerary = (InstrItinerary *)"
        <<              "Features.getInfo(ProcItinKV, ProcItinKVSize);\n"
-       << "  InstrItins = InstrItineraryData(Stages, OperandCycles, Itinerary);\n";
+       << "  InstrItins = InstrItineraryData(Stages, OperandCycles, "
+       << "ForwardingPathes, Itinerary);\n";
   }
 
   OS << "  return Features.getCPU();\n"

Modified: llvm/branches/wendling/eh/utils/TableGen/SubtargetEmitter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/TableGen/SubtargetEmitter.h?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/TableGen/SubtargetEmitter.h (original)
+++ llvm/branches/wendling/eh/utils/TableGen/SubtargetEmitter.h Tue Oct 26 19:48:03 2010
@@ -33,14 +33,19 @@
   void FeatureKeyValues(raw_ostream &OS);
   void CPUKeyValues(raw_ostream &OS);
   unsigned CollectAllItinClasses(raw_ostream &OS,
-                               std::map<std::string, unsigned> &ItinClassesMap);
+                                 std::map<std::string,unsigned> &ItinClassesMap,
+                                 std::vector<Record*> &ItinClassList);
   void FormItineraryStageString(const std::string &Names,
                                 Record *ItinData, std::string &ItinString,
                                 unsigned &NStages);
   void FormItineraryOperandCycleString(Record *ItinData, std::string &ItinString,
                                        unsigned &NOperandCycles);
+  void FormItineraryBypassString(const std::string &Names,
+                                 Record *ItinData,
+                                 std::string &ItinString, unsigned NOperandCycles);
   void EmitStageAndOperandCycleData(raw_ostream &OS, unsigned NItinClasses,
                      std::map<std::string, unsigned> &ItinClassesMap,
+                     std::vector<Record*> &ItinClassList,
                      std::vector<std::vector<InstrItinerary> > &ProcList);
   void EmitProcessorData(raw_ostream &OS,
                        std::vector<std::vector<InstrItinerary> > &ProcList);

Modified: llvm/branches/wendling/eh/utils/TableGen/TGLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/TableGen/TGLexer.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/TableGen/TGLexer.cpp (original)
+++ llvm/branches/wendling/eh/utils/TableGen/TGLexer.cpp Tue Oct 26 19:48:03 2010
@@ -12,6 +12,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "TGLexer.h"
+#include "llvm/ADT/Twine.h"
 #include "llvm/Support/SourceMgr.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Config/config.h"
@@ -36,17 +37,17 @@
 
 /// ReturnError - Set the error to the specified string at the specified
 /// location.  This is defined to always return tgtok::Error.
-tgtok::TokKind TGLexer::ReturnError(const char *Loc, const std::string &Msg) {
+tgtok::TokKind TGLexer::ReturnError(const char *Loc, const Twine &Msg) {
   PrintError(Loc, Msg);
   return tgtok::Error;
 }
 
 
-void TGLexer::PrintError(const char *Loc, const std::string &Msg) const {
+void TGLexer::PrintError(const char *Loc, const Twine &Msg) const {
   SrcMgr.PrintMessage(SMLoc::getFromPointer(Loc), Msg, "error");
 }
 
-void TGLexer::PrintError(SMLoc Loc, const std::string &Msg) const {
+void TGLexer::PrintError(SMLoc Loc, const Twine &Msg) const {
   SrcMgr.PrintMessage(Loc, Msg, "error");
 }
 
@@ -95,7 +96,7 @@
 
   switch (CurChar) {
   default:
-    // Handle letters: [a-zA-Z_]
+    // Handle letters: [a-zA-Z_#]
     if (isalpha(CurChar) || CurChar == '_' || CurChar == '#')
       return LexIdentifier();
       
@@ -214,23 +215,13 @@
 
 
 tgtok::TokKind TGLexer::LexIdentifier() {
-  // The first letter is [a-zA-Z_].
+  // The first letter is [a-zA-Z_#].
   const char *IdentStart = TokStart;
   
-  // Match the rest of the identifier regex: [0-9a-zA-Z_]*
-  while (isalpha(*CurPtr) || isdigit(*CurPtr) || *CurPtr == '_'
-         || *CurPtr == '#') {
-    // If this contains a '#', make sure it's value
-    if (*CurPtr == '#') {
-      if (strncmp(CurPtr, "#NAME#", 6) != 0) {
-        return tgtok::Error;
-      }
-      CurPtr += 6;
-    }
-    else {
-      ++CurPtr;
-    }
-  }
+  // Match the rest of the identifier regex: [0-9a-zA-Z_#]*
+  while (isalpha(*CurPtr) || isdigit(*CurPtr) || *CurPtr == '_' ||
+         *CurPtr == '#')
+    ++CurPtr;
   
   
   // Check to see if this identifier is a keyword.
@@ -436,7 +427,6 @@
   if (Len == 3  && !memcmp(Start, "shl", 3)) return tgtok::XSHL;
   if (Len == 2  && !memcmp(Start, "eq", 2)) return tgtok::XEq;
   if (Len == 9  && !memcmp(Start, "strconcat", 9))   return tgtok::XStrConcat;
-  if (Len == 10 && !memcmp(Start, "nameconcat", 10)) return tgtok::XNameConcat;
   if (Len == 5 && !memcmp(Start, "subst", 5)) return tgtok::XSubst;
   if (Len == 7 && !memcmp(Start, "foreach", 7)) return tgtok::XForEach;
   if (Len == 4 && !memcmp(Start, "cast", 4)) return tgtok::XCast;

Modified: llvm/branches/wendling/eh/utils/TableGen/TGLexer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/TableGen/TGLexer.h?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/TableGen/TGLexer.h (original)
+++ llvm/branches/wendling/eh/utils/TableGen/TGLexer.h Tue Oct 26 19:48:03 2010
@@ -23,7 +23,8 @@
 class MemoryBuffer;
 class SourceMgr;
 class SMLoc;
-  
+class Twine;
+
 namespace tgtok {
   enum TokKind {
     // Markers
@@ -44,7 +45,7 @@
     MultiClass, String,
     
     // !keywords.
-    XConcat, XSRA, XSRL, XSHL, XStrConcat, XNameConcat, XCast, XSubst,
+    XConcat, XSRA, XSRL, XSHL, XStrConcat, XCast, XSubst,
     XForEach, XCar, XCdr, XNull, XIf, XEq,
 
     // Integer value.
@@ -95,14 +96,14 @@
 
   SMLoc getLoc() const;
 
-  void PrintError(const char *Loc, const std::string &Msg) const;
-  void PrintError(SMLoc Loc, const std::string &Msg) const;
+  void PrintError(const char *Loc, const Twine &Msg) const;
+  void PrintError(SMLoc Loc, const Twine &Msg) const;
   
 private:
   /// LexToken - Read the next token and return its code.
   tgtok::TokKind LexToken();
   
-  tgtok::TokKind ReturnError(const char *Loc, const std::string &Msg);
+  tgtok::TokKind ReturnError(const char *Loc, const Twine &Msg);
   
   int getNextChar();
   void SkipBCPLComment();

Modified: llvm/branches/wendling/eh/utils/TableGen/TGParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/TableGen/TGParser.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/TableGen/TGParser.cpp (original)
+++ llvm/branches/wendling/eh/utils/TableGen/TGParser.cpp Tue Oct 26 19:48:03 2010
@@ -16,6 +16,8 @@
 #include "llvm/ADT/StringExtras.h"
 #include <algorithm>
 #include <sstream>
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/Support/CommandLine.h"
 using namespace llvm;
 
 //===----------------------------------------------------------------------===//
@@ -294,20 +296,23 @@
          K == tgtok::Defm || K == tgtok::Let || K == tgtok::MultiClass;
 }
 
+static std::string GetNewAnonymousName() {
+  static unsigned AnonCounter = 0;
+  return "anonymous."+utostr(AnonCounter++);
+}
+
 /// ParseObjectName - If an object name is specified, return it.  Otherwise,
 /// return an anonymous name.
 ///   ObjectName ::= ID
 ///   ObjectName ::= /*empty*/
 ///
 std::string TGParser::ParseObjectName() {
-  if (Lex.getCode() == tgtok::Id) {
-    std::string Ret = Lex.getCurStrVal();
-    Lex.Lex();
-    return Ret;
-  }
+  if (Lex.getCode() != tgtok::Id)
+    return GetNewAnonymousName();
 
-  static unsigned AnonCounter = 0;
-  return "anonymous."+utostr(AnonCounter++);
+  std::string Ret = Lex.getCurStrVal();
+  Lex.Lex();
+  return Ret;
 }
 
 
@@ -793,81 +798,68 @@
   case tgtok::XSRL:
   case tgtok::XSHL:
   case tgtok::XEq:
-  case tgtok::XStrConcat:
-  case tgtok::XNameConcat: {  // Value ::= !binop '(' Value ',' Value ')'
+  case tgtok::XStrConcat: {  // Value ::= !binop '(' Value ',' Value ')'
+    tgtok::TokKind OpTok = Lex.getCode();
+    SMLoc OpLoc = Lex.getLoc();
+    Lex.Lex();  // eat the operation
+
     BinOpInit::BinaryOp Code;
     RecTy *Type = 0;
 
-
-    switch (Lex.getCode()) {
+    switch (OpTok) {
     default: assert(0 && "Unhandled code!");
-    case tgtok::XConcat:
-      Lex.Lex();  // eat the operation
-      Code = BinOpInit::CONCAT;
-      Type = new DagRecTy();
-      break;
-    case tgtok::XSRA:
-      Lex.Lex();  // eat the operation
-      Code = BinOpInit::SRA;
-      Type = new IntRecTy();
-      break;
-    case tgtok::XSRL:
-      Lex.Lex();  // eat the operation
-      Code = BinOpInit::SRL;
-      Type = new IntRecTy();
-      break;
-    case tgtok::XSHL:
-      Lex.Lex();  // eat the operation
-      Code = BinOpInit::SHL;
-      Type = new IntRecTy();
-      break;
-    case tgtok::XEq:  
-      Lex.Lex();  // eat the operation
-      Code = BinOpInit::EQ;
-      Type = new IntRecTy();
-      break;
+    case tgtok::XConcat: Code = BinOpInit::CONCAT; Type = new DagRecTy(); break;
+    case tgtok::XSRA:    Code = BinOpInit::SRA;    Type = new IntRecTy(); break;
+    case tgtok::XSRL:    Code = BinOpInit::SRL;    Type = new IntRecTy(); break;
+    case tgtok::XSHL:    Code = BinOpInit::SHL;    Type = new IntRecTy(); break;
+    case tgtok::XEq:     Code = BinOpInit::EQ;     Type = new IntRecTy(); break;
     case tgtok::XStrConcat:
-      Lex.Lex();  // eat the operation
       Code = BinOpInit::STRCONCAT;
       Type = new StringRecTy();
       break;
-    case tgtok::XNameConcat:
-      Lex.Lex();  // eat the operation
-      Code = BinOpInit::NAMECONCAT;
-
-      Type = ParseOperatorType();
-
-      if (Type == 0) {
-        TokError("did not get type for binary operator");
-        return 0;
-      }
-
-      break;
     }
+
     if (Lex.getCode() != tgtok::l_paren) {
       TokError("expected '(' after binary operator");
       return 0;
     }
     Lex.Lex();  // eat the '('
 
-    Init *LHS = ParseValue(CurRec);
-    if (LHS == 0) return 0;
+    SmallVector<Init*, 2> InitList;
 
-    if (Lex.getCode() != tgtok::comma) {
-      TokError("expected ',' in binary operator");
-      return 0;
-    }
-    Lex.Lex();  // eat the ','
+    InitList.push_back(ParseValue(CurRec));
+    if (InitList.back() == 0) return 0;
 
-    Init *RHS = ParseValue(CurRec);
-    if (RHS == 0) return 0;
+    while (Lex.getCode() == tgtok::comma) {
+      Lex.Lex();  // eat the ','
+
+      InitList.push_back(ParseValue(CurRec));
+      if (InitList.back() == 0) return 0;
+    }
 
     if (Lex.getCode() != tgtok::r_paren) {
-      TokError("expected ')' in binary operator");
+      TokError("expected ')' in operator");
       return 0;
     }
     Lex.Lex();  // eat the ')'
-    return (new BinOpInit(Code, LHS, RHS, Type))->Fold(CurRec, CurMultiClass);
+
+    // We allow multiple operands to associative operators like !strconcat as
+    // shorthand for nesting them.
+    if (Code == BinOpInit::STRCONCAT) {
+      while (InitList.size() > 2) {
+        Init *RHS = InitList.pop_back_val();
+        RHS = (new BinOpInit(Code, InitList.back(), RHS, Type))
+                      ->Fold(CurRec, CurMultiClass);
+        InitList.back() = RHS;
+      }
+    }
+
+    if (InitList.size() == 2)
+      return (new BinOpInit(Code, InitList[0], InitList[1], Type))
+        ->Fold(CurRec, CurMultiClass);
+
+    Error(OpLoc, "expected two operands to operator");
+    return 0;
   }
 
   case tgtok::XIf:
@@ -1037,8 +1029,13 @@
     break;
   }
   case tgtok::CodeFragment:
-    R = new CodeInit(Lex.getCurStrVal()); Lex.Lex(); break;
-  case tgtok::question: R = new UnsetInit(); Lex.Lex(); break;
+    R = new CodeInit(Lex.getCurStrVal());
+    Lex.Lex();
+    break;
+  case tgtok::question:
+    R = new UnsetInit();
+    Lex.Lex();
+    break;
   case tgtok::Id: {
     SMLoc NameLoc = Lex.getLoc();
     std::string Name = Lex.getCurStrVal();
@@ -1212,21 +1209,13 @@
   }
   case tgtok::l_paren: {         // Value ::= '(' IDValue DagArgList ')'
     Lex.Lex();   // eat the '('
-    if (Lex.getCode() != tgtok::Id
-        && Lex.getCode() != tgtok::XCast
-        && Lex.getCode() != tgtok::XNameConcat) {
+    if (Lex.getCode() != tgtok::Id && Lex.getCode() != tgtok::XCast) {
       TokError("expected identifier in dag init");
       return 0;
     }
 
-    Init *Operator = 0;
-    if (Lex.getCode() == tgtok::Id) {
-      Operator = ParseIDValue(CurRec);
-      if (Operator == 0) return 0;
-    } else {
-      Operator = ParseOperation(CurRec);
-      if (Operator == 0) return 0;
-    }
+    Init *Operator = ParseValue(CurRec);
+    if (Operator == 0) return 0;
 
     // If the operator name is present, parse it.
     std::string OperatorName;
@@ -1252,7 +1241,6 @@
     Lex.Lex();  // eat the ')'
 
     return new DagInit(Operator, OperatorName, DagArgs);
-    break;
   }
 
   case tgtok::XCar:
@@ -1264,13 +1252,11 @@
   case tgtok::XSRL:
   case tgtok::XSHL:
   case tgtok::XEq:
-  case tgtok::XStrConcat:
-  case tgtok::XNameConcat:  // Value ::= !binop '(' Value ',' Value ')'
+  case tgtok::XStrConcat:   // Value ::= !binop '(' Value ',' Value ')'
   case tgtok::XIf:
   case tgtok::XForEach:
   case tgtok::XSubst: {  // Value ::= !ternop '(' Value ',' Value ',' Value ')'
     return ParseOperation(CurRec);
-    break;
   }
   }
 
@@ -1899,12 +1885,15 @@
 ///
 bool TGParser::ParseDefm(MultiClass *CurMultiClass) {
   assert(Lex.getCode() == tgtok::Defm && "Unexpected token!");
-  if (Lex.Lex() != tgtok::Id)  // eat the defm.
-    return TokError("expected identifier after defm");
+
+  std::string DefmPrefix;
+  if (Lex.Lex() == tgtok::Id) {  // eat the defm.
+    DefmPrefix = Lex.getCurStrVal();
+    Lex.Lex();  // Eat the defm prefix.
+  }
 
   SMLoc DefmPrefixLoc = Lex.getLoc();
-  std::string DefmPrefix = Lex.getCurStrVal();
-  if (Lex.Lex() != tgtok::colon)
+  if (Lex.getCode() != tgtok::colon)
     return TokError("expected ':' after defm identifier");
 
   // Keep track of the new generated record definitions.
@@ -1939,14 +1928,21 @@
     for (unsigned i = 0, e = MC->DefPrototypes.size(); i != e; ++i) {
       Record *DefProto = MC->DefPrototypes[i];
 
-      // Add in the defm name
+      // Add in the defm name.  If the defm prefix is empty, give each
+      // instantiated def a unique name.  Otherwise, if "#NAME#" exists in the
+      // name, substitute the prefix for #NAME#.  Otherwise, use the defm name
+      // as a prefix.
       std::string DefName = DefProto->getName();
-      std::string::size_type idx = DefName.find("#NAME#");
-      if (idx != std::string::npos) {
-        DefName.replace(idx, 6, DefmPrefix);
+      if (DefmPrefix.empty()) {
+        DefName = GetNewAnonymousName();
       } else {
-        // Add the suffix to the defm name to get the new name.
-        DefName = DefmPrefix + DefName;
+        std::string::size_type idx = DefName.find("#NAME#");
+        if (idx != std::string::npos) {
+          DefName.replace(idx, 6, DefmPrefix);
+        } else {
+          // Add the suffix to the defm name to get the new name.
+          DefName = DefmPrefix + DefName;
+        }
       }
 
       Record *CurRec = new Record(DefName, DefmPrefixLoc);

Modified: llvm/branches/wendling/eh/utils/TableGen/TGParser.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/TableGen/TGParser.h?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/TableGen/TGParser.h (original)
+++ llvm/branches/wendling/eh/utils/TableGen/TGParser.h Tue Oct 26 19:48:03 2010
@@ -15,6 +15,7 @@
 #define TGPARSER_H
 
 #include "TGLexer.h"
+#include "llvm/ADT/Twine.h"
 #include "llvm/Support/SourceMgr.h"
 #include <map>
 
@@ -53,11 +54,11 @@
   /// routines return true on error, or false on success.
   bool ParseFile();
   
-  bool Error(SMLoc L, const std::string &Msg) const {
+  bool Error(SMLoc L, const Twine &Msg) const {
     Lex.PrintError(L, Msg);
     return true;
   }
-  bool TokError(const std::string &Msg) const {
+  bool TokError(const Twine &Msg) const {
     return Error(Lex.getLoc(), Msg);
   }
 private:  // Semantic analysis methods.

Modified: llvm/branches/wendling/eh/utils/TableGen/TableGen.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/TableGen/TableGen.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/TableGen/TableGen.cpp (original)
+++ llvm/branches/wendling/eh/utils/TableGen/TableGen.cpp Tue Oct 26 19:48:03 2010
@@ -40,7 +40,7 @@
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/PrettyStackTrace.h"
-#include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/ToolOutputFile.h"
 #include "llvm/System/Signals.h"
 #include <algorithm>
 #include <cstdio>
@@ -55,7 +55,11 @@
   GenDisassembler,
   GenCallingConv,
   GenClangAttrClasses,
+  GenClangAttrImpl,
   GenClangAttrList,
+  GenClangAttrPCHRead,
+  GenClangAttrPCHWrite,
+  GenClangAttrSpellingList,
   GenClangDiagsDefs,
   GenClangDiagGroups,
   GenClangDeclNodes,
@@ -116,8 +120,16 @@
                                "Generate target intrinsic information"),
                     clEnumValN(GenClangAttrClasses, "gen-clang-attr-classes",
                                "Generate clang attribute clases"),
+                    clEnumValN(GenClangAttrImpl, "gen-clang-attr-impl",
+                               "Generate clang attribute implementations"),
                     clEnumValN(GenClangAttrList, "gen-clang-attr-list",
                                "Generate a clang attribute list"),
+                    clEnumValN(GenClangAttrPCHRead, "gen-clang-attr-pch-read",
+                               "Generate clang PCH attribute reader"),
+                    clEnumValN(GenClangAttrPCHWrite, "gen-clang-attr-pch-write",
+                               "Generate clang PCH attribute writer"),
+                    clEnumValN(GenClangAttrSpellingList, "gen-clang-attr-spelling-list",
+                               "Generate a clang attribute spelling list"),
                     clEnumValN(GenClangDiagsDefs, "gen-clang-diags-defs",
                                "Generate Clang diagnostics definitions"),
                     clEnumValN(GenClangDiagGroups, "gen-clang-diag-groups",
@@ -165,7 +177,7 @@
 
 static SourceMgr SrcMgr;
 
-void llvm::PrintError(SMLoc ErrorLoc, const std::string &Msg) {
+void llvm::PrintError(SMLoc ErrorLoc, const Twine &Msg) {
   SrcMgr.PrintMessage(ErrorLoc, Msg, "error");
 }
 
@@ -207,113 +219,122 @@
     return 1;
 
   std::string Error;
-  raw_fd_ostream Out(OutputFilename.c_str(), Error);
+  tool_output_file Out(OutputFilename.c_str(), Error);
   if (!Error.empty()) {
     errs() << argv[0] << ": error opening " << OutputFilename
            << ":" << Error << "\n";
     return 1;
   }
 
-  // Make sure the file gets removed if *gasp* tablegen crashes...
-  sys::RemoveFileOnSignal(sys::Path(OutputFilename));
-
   try {
     switch (Action) {
     case PrintRecords:
-      Out << Records;           // No argument, dump all contents
+      Out.os() << Records;           // No argument, dump all contents
       break;
     case GenEmitter:
-      CodeEmitterGen(Records).run(Out);
+      CodeEmitterGen(Records).run(Out.os());
       break;
 
     case GenRegisterEnums:
-      RegisterInfoEmitter(Records).runEnums(Out);
+      RegisterInfoEmitter(Records).runEnums(Out.os());
       break;
     case GenRegister:
-      RegisterInfoEmitter(Records).run(Out);
+      RegisterInfoEmitter(Records).run(Out.os());
       break;
     case GenRegisterHeader:
-      RegisterInfoEmitter(Records).runHeader(Out);
+      RegisterInfoEmitter(Records).runHeader(Out.os());
       break;
     case GenInstrEnums:
-      InstrEnumEmitter(Records).run(Out);
+      InstrEnumEmitter(Records).run(Out.os());
       break;
     case GenInstrs:
-      InstrInfoEmitter(Records).run(Out);
+      InstrInfoEmitter(Records).run(Out.os());
       break;
     case GenCallingConv:
-      CallingConvEmitter(Records).run(Out);
+      CallingConvEmitter(Records).run(Out.os());
       break;
     case GenAsmWriter:
-      AsmWriterEmitter(Records).run(Out);
+      AsmWriterEmitter(Records).run(Out.os());
       break;
     case GenARMDecoder:
-      ARMDecoderEmitter(Records).run(Out);
+      ARMDecoderEmitter(Records).run(Out.os());
       break;
     case GenAsmMatcher:
-      AsmMatcherEmitter(Records).run(Out);
+      AsmMatcherEmitter(Records).run(Out.os());
       break;
     case GenClangAttrClasses:
-      ClangAttrClassEmitter(Records).run(Out);
+      ClangAttrClassEmitter(Records).run(Out.os());
+      break;
+    case GenClangAttrImpl:
+      ClangAttrImplEmitter(Records).run(Out.os());
       break;
     case GenClangAttrList:
-      ClangAttrListEmitter(Records).run(Out);
+      ClangAttrListEmitter(Records).run(Out.os());
+      break;
+    case GenClangAttrPCHRead:
+      ClangAttrPCHReadEmitter(Records).run(Out.os());
+      break;
+    case GenClangAttrPCHWrite:
+      ClangAttrPCHWriteEmitter(Records).run(Out.os());
+      break;
+    case GenClangAttrSpellingList:
+      ClangAttrSpellingListEmitter(Records).run(Out.os());
       break;
     case GenClangDiagsDefs:
-      ClangDiagsDefsEmitter(Records, ClangComponent).run(Out);
+      ClangDiagsDefsEmitter(Records, ClangComponent).run(Out.os());
       break;
     case GenClangDiagGroups:
-      ClangDiagGroupsEmitter(Records).run(Out);
+      ClangDiagGroupsEmitter(Records).run(Out.os());
       break;
     case GenClangDeclNodes:
-      ClangASTNodesEmitter(Records, "Decl", "Decl").run(Out);
-      ClangDeclContextEmitter(Records).run(Out);
+      ClangASTNodesEmitter(Records, "Decl", "Decl").run(Out.os());
+      ClangDeclContextEmitter(Records).run(Out.os());
       break;
     case GenClangStmtNodes:
-      ClangASTNodesEmitter(Records, "Stmt", "").run(Out);
+      ClangASTNodesEmitter(Records, "Stmt", "").run(Out.os());
       break;
     case GenDisassembler:
-      DisassemblerEmitter(Records).run(Out);
+      DisassemblerEmitter(Records).run(Out.os());
       break;
     case GenOptParserDefs:
-      OptParserEmitter(Records, true).run(Out);
+      OptParserEmitter(Records, true).run(Out.os());
       break;
     case GenOptParserImpl:
-      OptParserEmitter(Records, false).run(Out);
+      OptParserEmitter(Records, false).run(Out.os());
       break;
     case GenDAGISel:
-      DAGISelEmitter(Records).run(Out);
+      DAGISelEmitter(Records).run(Out.os());
       break;
     case GenFastISel:
-      FastISelEmitter(Records).run(Out);
+      FastISelEmitter(Records).run(Out.os());
       break;
     case GenSubtarget:
-      SubtargetEmitter(Records).run(Out);
+      SubtargetEmitter(Records).run(Out.os());
       break;
     case GenIntrinsic:
-      IntrinsicEmitter(Records).run(Out);
+      IntrinsicEmitter(Records).run(Out.os());
       break;
     case GenTgtIntrinsic:
-      IntrinsicEmitter(Records, true).run(Out);
+      IntrinsicEmitter(Records, true).run(Out.os());
       break;
     case GenLLVMCConf:
-      LLVMCConfigurationEmitter(Records).run(Out);
+      LLVMCConfigurationEmitter(Records).run(Out.os());
       break;
     case GenEDInfo:
-      EDEmitter(Records).run(Out);
+      EDEmitter(Records).run(Out.os());
       break;
     case GenArmNeon:
-      NeonEmitter(Records).run(Out);
+      NeonEmitter(Records).run(Out.os());
       break;
     case GenArmNeonSema:
-      NeonEmitter(Records).runHeader(Out);
+      NeonEmitter(Records).runHeader(Out.os());
       break;
     case PrintEnums:
     {
       std::vector<Record*> Recs = Records.getAllDerivedDefinitions(Class);
       for (unsigned i = 0, e = Recs.size(); i != e; ++i)
-        Out << Recs[i]->getName() << ", ";
-      Out << "\n";
+        Out.os() << Recs[i]->getName() << ", ";
+      Out.os() << "\n";
       break;
     }
     default:
@@ -321,6 +342,8 @@
       return 1;
     }
 
+    // Declare success.
+    Out.keep();
     return 0;
 
   } catch (const TGError &Error) {
@@ -335,7 +358,5 @@
     errs() << argv[0] << ": Unknown unexpected exception occurred.\n";
   }
 
-  if (OutputFilename != "-")
-    std::remove(OutputFilename.c_str());    // Remove the file, it's broken
   return 1;
 }

Modified: llvm/branches/wendling/eh/utils/TableGen/X86DisassemblerTables.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/TableGen/X86DisassemblerTables.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/TableGen/X86DisassemblerTables.cpp (original)
+++ llvm/branches/wendling/eh/utils/TableGen/X86DisassemblerTables.cpp Tue Oct 26 19:48:03 2010
@@ -161,7 +161,7 @@
 /// @param i        - The indentation level for that output stream.
 static void emitEmptyTable(raw_ostream &o, uint32_t &i)
 {
-  o.indent(i * 2) << "static InstrUID modRMEmptyTable[1] = { 0 };" << "\n";
+  o.indent(i * 2) << "static const InstrUID modRMEmptyTable[1] = { 0 };\n";
   o << "\n";
 }
 
@@ -275,7 +275,7 @@
     return;
   }
     
-  o1.indent(i1) << "static InstrUID modRMTable" << thisTableNumber;
+  o1.indent(i1) << "static const InstrUID modRMTable" << thisTableNumber;
     
   switch (dt) {
     default:
@@ -365,7 +365,7 @@
   uint32_t &i2,
   ContextDecision &decision,
   const char* name) const {
-  o2.indent(i2) << "struct ContextDecision " << name << " = {" << "\n";
+  o2.indent(i2) << "static const struct ContextDecision " << name << " = {\n";
   i2++;
   o2.indent(i2) << "{ /* opcodeDecisions */" << "\n";
   i2++;
@@ -392,10 +392,8 @@
 
 void DisassemblerTables::emitInstructionInfo(raw_ostream &o, uint32_t &i) 
   const {
-  o.indent(i * 2) << "struct InstructionSpecifier ";
-  o << INSTRUCTIONS_STR << "[";
-  o << InstructionSpecifiers.size();
-  o << "] = {" << "\n";
+  o.indent(i * 2) << "static const struct InstructionSpecifier ";
+  o << INSTRUCTIONS_STR "[" << InstructionSpecifiers.size() << "] = {\n";
   
   i++;
 
@@ -456,8 +454,8 @@
 void DisassemblerTables::emitContextTable(raw_ostream &o, uint32_t &i) const {
   uint16_t index;
 
-  o.indent(i * 2) << "InstructionContext ";
-  o << CONTEXTS_STR << "[256] = {" << "\n";
+  o.indent(i * 2) << "static const InstructionContext " CONTEXTS_STR
+                     "[256] = {\n";
   i++;
 
   for (index = 0; index < 256; ++index) {

Modified: llvm/branches/wendling/eh/utils/TableGen/X86RecognizableInstr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/TableGen/X86RecognizableInstr.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/TableGen/X86RecognizableInstr.cpp (original)
+++ llvm/branches/wendling/eh/utils/TableGen/X86RecognizableInstr.cpp Tue Oct 26 19:48:03 2010
@@ -51,10 +51,11 @@
     MRM0m = 24, MRM1m = 25, MRM2m = 26, MRM3m = 27,
     MRM4m = 28, MRM5m = 29, MRM6m = 30, MRM7m = 31,
     MRMInitReg  = 32,
-    
 #define MAP(from, to) MRM_##from = to,
     MRM_MAPPING
 #undef MAP
+    RawFrmImm8  = 43,
+    RawFrmImm16 = 44,
     lastMRM
   };
   
@@ -311,7 +312,7 @@
     return FILTER_STRONG;
 
   // Special cases.
-  
+
   if (Name.find("PCMPISTRI") != Name.npos && Name != "PCMPISTRI")
     return FILTER_WEAK;
   if (Name.find("PCMPESTRI") != Name.npos && Name != "PCMPESTRI")
@@ -587,6 +588,20 @@
     HANDLE_OPERAND(memory)
     HANDLE_OPTIONAL(relocation)
     break;
+  case X86Local::RawFrmImm8:
+    // operand 1 is a 16-bit immediate
+    // operand 2 is an 8-bit immediate
+    assert(numPhysicalOperands == 2 &&
+           "Unexpected number of operands for X86Local::RawFrmImm8");
+    HANDLE_OPERAND(immediate)
+    HANDLE_OPERAND(immediate)
+    break;
+  case X86Local::RawFrmImm16:
+    // operand 1 is a 16-bit immediate
+    // operand 2 is a 16-bit immediate
+    HANDLE_OPERAND(immediate)
+    HANDLE_OPERAND(immediate)
+    break;
   case X86Local::MRMInitReg:
     // Ignored.
     break;
@@ -829,10 +844,13 @@
   TYPE("GR8",                 TYPE_R8)
   TYPE("VR128",               TYPE_XMM128)
   TYPE("f128mem",             TYPE_M128)
+  TYPE("f256mem",             TYPE_M256)
   TYPE("FR64",                TYPE_XMM64)
   TYPE("f64mem",              TYPE_M64FP)
+  TYPE("sdmem",               TYPE_M64FP)
   TYPE("FR32",                TYPE_XMM32)
   TYPE("f32mem",              TYPE_M32FP)
+  TYPE("ssmem",               TYPE_M32FP)
   TYPE("RST",                 TYPE_ST)
   TYPE("i128mem",             TYPE_M128)
   TYPE("i64i32imm_pcrel",     TYPE_REL64)
@@ -924,7 +942,10 @@
   ENCODING("i32mem",          ENCODING_RM)
   ENCODING("i64mem",          ENCODING_RM)
   ENCODING("i8mem",           ENCODING_RM)
+  ENCODING("ssmem",           ENCODING_RM)
+  ENCODING("sdmem",           ENCODING_RM)
   ENCODING("f128mem",         ENCODING_RM)
+  ENCODING("f256mem",         ENCODING_RM)
   ENCODING("f64mem",          ENCODING_RM)
   ENCODING("f32mem",          ENCODING_RM)
   ENCODING("i128mem",         ENCODING_RM)

Modified: llvm/branches/wendling/eh/utils/buildit/GNUmakefile
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/buildit/GNUmakefile?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/buildit/GNUmakefile (original)
+++ llvm/branches/wendling/eh/utils/buildit/GNUmakefile Tue Oct 26 19:48:03 2010
@@ -71,14 +71,14 @@
 	    $(RC_ProjectSourceVersion) $(RC_ProjectSourceSubversion) 
 
 EmbeddedHosted:
-	$(MAKE) ARM_HOSTED_BUILD=yes PREFIX=/usr install
+	$(MAKE) ARM_HOSTED_BUILD=yes PREFIX=/usr/local install
 
 # When building for the iOS simulator, MACOSX_DEPLOYMENT_TARGET is not set
 # by default, but it needs to be set when building tools that run on the host
 # (e.g., tblgen), so set it here.
 EmbeddedSim:
 	export MACOSX_DEPLOYMENT_TARGET=`sw_vers -productVersion`; \
-	$(MAKE) IOS_SIM_BUILD=yes PREFIX=/usr install
+	$(MAKE) IOS_SIM_BUILD=yes PREFIX=$(SDKROOT)/usr/local install
 
 # installhdrs does nothing, because the headers aren't useful until
 # the compiler is installed.

Modified: llvm/branches/wendling/eh/utils/buildit/build_llvm
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/buildit/build_llvm?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/buildit/build_llvm (original)
+++ llvm/branches/wendling/eh/utils/buildit/build_llvm Tue Oct 26 19:48:03 2010
@@ -269,8 +269,11 @@
         -exec lipo -extract ppc7400 -extract i386 -extract x86_64 {} -output {} \;
 fi
 
-# The Hello dylib is an example of how to build a pass. No need to install it.
-rm $DEST_DIR$DEST_ROOT/lib/LLVMHello.dylib
+# The Hello dylib is an example of how to build a pass.
+# The BugpointPasses module is only used to test bugpoint.
+# These unversioned dylibs cause verification failures, so do not install them.
+rm $DEST_DIR$DEST_ROOT/lib/libLLVMHello.dylib
+rm $DEST_DIR$DEST_ROOT/lib/libBugpointPasses.dylib
 
 # Compress manpages
 MDIR=$DEST_DIR$DEST_ROOT/share/man/man1

Modified: llvm/branches/wendling/eh/utils/emacs/llvm-mode.el
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/emacs/llvm-mode.el?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/emacs/llvm-mode.el (original)
+++ llvm/branches/wendling/eh/utils/emacs/llvm-mode.el Tue Oct 26 19:48:03 2010
@@ -19,7 +19,7 @@
    ;; Unnamed variable slots
    '("%[-]?[0-9]+" . font-lock-variable-name-face)
    ;; Types
-   '("\\bvoid\\b\\|\\bi[0-9]+\\b\\|\\float\\b\\|\\bdouble\\b\\|\\btype\\b\\|\\blabel\\b\\|\\bopaque\\b" . font-lock-type-face)
+   `(,(regexp-opt '("void" "i[0-9]+" "float" "double" "type" "label" "opaque") 'words) . font-lock-type-face)
    ;; Integer literals
    '("\\b[-]?[0-9]+\\b" . font-lock-preprocessor-face)
    ;; Floating point constants
@@ -27,15 +27,20 @@
    ;; Hex constants
    '("\\b0x[0-9A-Fa-f]+\\b" . font-lock-preprocessor-face)
    ;; Keywords
-   '("\\bbegin\\b\\|\\bend\\b\\|\\btrue\\b\\|\\bfalse\\b\\|\\bzeroinitializer\\b\\|\\bdeclare\\b\\|\\bdefine\\b\\|\\bglobal\\b\\|\\bconstant\\b\\|\\bconst\\b\\|\\binternal\\b\\|\\blinkonce\\b\\|\\blinkonce_odr\\b\\|\\bweak\\b\\|\\bweak_odr\\b\\|\\bappending\\b\\|\\buninitialized\\b\\|\\bimplementation\\b\\|\\b\\.\\.\\.\\b\\|\\bnull\\b\\|\\bundef\\b\\|\\bto\\b\\|\\bexcept\\b\\|\\bnot\\b\\|\\btarget\\b\\|\\bendian\\b\\|\\blittle\\b\\|\\bbig\\b\\|\\bpointersize\\b\\|\\bdeplibs\\b\\|\\bvolatile\\b\\|\\bfastcc\\b\\|\\bcoldcc\\b\\|\\bcc\\b" . font-lock-keyword-face)
+   `(,(regexp-opt '("begin" "end" "true" "false" "zeroinitializer" "declare"
+                    "define" "global" "constant" "const" "internal" "linkonce" "linkonce_odr"
+                    "weak" "weak_odr" "appending" "uninitialized" "implementation" "..."
+                    "null" "undef" "to" "except" "not" "target" "endian" "little" "big"
+                    "pointersize" "deplibs" "volatile" "fastcc" "coldcc" "cc") 'words) . font-lock-keyword-face)
    ;; Arithmetic and Logical Operators
-   '("\\badd\\b\\|\\bsub\\b\\|\\bmul\\b\\|\\bdiv\\b\\|\\brem\\b\\|\\band\\b\\|\\bor\\b\\|\\bxor\\b\\|\\bset\\(ne\\b\\|\\beq\\b\\|\\blt\\b\\|\\bgt\\b\\|\\ble\\b\\|\\bge\\b\\)" . font-lock-keyword-face)
+   `(,(regexp-opt '("add" "sub" "mul" "div" "rem" "and" "or" "xor"
+                    "setne" "seteq" "setlt" "setgt" "setle" "setge") 'words) . font-lock-keyword-face)
    ;; Special instructions
-   '("\\bphi\\b\\|\\btail\\b\\|\\bcall\\b\\|\\bcast\\b\\|\\bselect\\b\\|\\bto\\b\\|\\bshl\\b\\|\\bshr\\b\\|\\bvaarg\\b\\|\\bvanext\\b" . font-lock-keyword-face)
+   `(,(regexp-opt '("phi" "tail" "call" "cast" "select" "to" "shl" "shr" "vaarg" "vanext") 'words) . font-lock-keyword-face)
    ;; Control instructions
-   '("\\bret\\b\\|\\bbr\\b\\|\\bswitch\\b\\|\\binvoke\\b\\|\\bunwind\\b\\|\\bunreachable\\b" . font-lock-keyword-face)
+   `(,(regexp-opt '("ret" "br" "switch" "invoke" "unwind" "unreachable") 'words) . font-lock-keyword-face)
    ;; Memory operators
-   '("\\bmalloc\\b\\|\\balloca\\b\\|\\bfree\\b\\|\\bload\\b\\|\\bstore\\b\\|\\bgetelementptr\\b" . font-lock-keyword-face)
+   `(,(regexp-opt '("malloc" "alloca" "free" "load" "store" "getelementptr") 'words) . font-lock-keyword-face)
    )
   "Syntax highlighting for LLVM"
   )

Modified: llvm/branches/wendling/eh/utils/emacs/tablegen-mode.el
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/emacs/tablegen-mode.el?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/emacs/tablegen-mode.el (original)
+++ llvm/branches/wendling/eh/utils/emacs/tablegen-mode.el Tue Oct 26 19:48:03 2010
@@ -12,13 +12,11 @@
 (make-face 'td-decorators-face)
 
 (defvar tablegen-font-lock-keywords
-  (let ((kw (mapconcat 'identity
-                       '("class" "defm" "def" "field" "include" "in"
+  (let ((kw (regexp-opt '("class" "defm" "def" "field" "include" "in"
                          "let" "multiclass")
-                       "\\|"))
-        (type-kw (mapconcat 'identity
-                            '("bit" "bits" "code" "dag" "int" "list" "string")
-                            "\\|"))
+                        'words))
+        (type-kw (regexp-opt '("bit" "bits" "code" "dag" "int" "list" "string")
+                             'words))
         )
     (list
      ;; Comments
@@ -36,10 +34,10 @@
 
      '("^[ \t]*\\(@.+\\)" 1 'td-decorators-face)
      ;; Keywords
-     (cons (concat "\\<\\(" kw "\\)\\>[ \n\t(]") 1)
+     (cons (concat kw "[ \n\t(]") 1)
 
      ;; Type keywords
-     (cons (concat "\\<\\(" type-kw "\\)[ \n\t(]") 1)
+     (cons (concat type-kw "[ \n\t(]") 1)
      ))
   "Additional expressions to highlight in TableGen mode.")
 (put 'tablegen-mode 'font-lock-defaults '(tablegen-font-lock-keywords))

Modified: llvm/branches/wendling/eh/utils/findmisopt
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/findmisopt?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/findmisopt (original)
+++ llvm/branches/wendling/eh/utils/findmisopt Tue Oct 26 19:48:03 2010
@@ -7,7 +7,7 @@
 #      it from finding a problem unless the set of failing optimizations are
 #      known and given to it on the command line.
 #
-#      Given a bytecode file that produces correct output (or return code), 
+#      Given a bitcode file that produces correct output (or return code), 
 #      this script will run through all the optimizations passes that gccas
 #      uses (in the same order) and will narrow down which optimizations
 #      cause the program either generate different output or return a 
@@ -21,7 +21,7 @@
 #
 #   Where:
 #      bcfile 
-#          is the bytecode file input (the unoptimized working case)
+#          is the bitcode file input (the unoptimized working case)
 #      outdir
 #          is a directory into which intermediate results are placed
 #      progargs

Modified: llvm/branches/wendling/eh/utils/findoptdiff
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/findoptdiff?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/findoptdiff (original)
+++ llvm/branches/wendling/eh/utils/findoptdiff Tue Oct 26 19:48:03 2010
@@ -14,7 +14,7 @@
 #      second build contains some experimental optimization features that
 #      are suspected of producing a misoptimization.
 #
-#      The script takes two bytecode files, one from each build. They are
+#      The script takes two bitcode files, one from each build. They are
 #      presumed to be a compilation of the same program or program fragment
 #      with the only difference being the builds.
 #
@@ -39,9 +39,9 @@
 #      llvm2
 #          is the path to the second llvm build dir
 #      bc1
-#          is the bytecode file for the first llvm environment
+#          is the bitcode file for the first llvm environment
 #      bc2
-#          is the bytecode file for the second llvm environment
+#          is the bitcode file for the second llvm environment
 #      filter1
 #          is an optional filter for filtering the llvm1 generated assembly
 #      filter2

Modified: llvm/branches/wendling/eh/utils/lit/TODO
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/lit/TODO?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/lit/TODO (original)
+++ llvm/branches/wendling/eh/utils/lit/TODO Tue Oct 26 19:48:03 2010
@@ -2,18 +2,8 @@
 
  - Add --show-unsupported, don't show by default?
 
- - Finish documentation.
-
  - Optionally use multiprocessing.
 
- - Support llvmc and ocaml tests.
-
  - Support valgrind in all configs, and LLVM style valgrind.
 
- - Provide test suite config for running unit tests.
-
  - Support a timeout / ulimit.
-
- - Support "disabling" tests? The advantage of making this distinct from XFAIL
-   is it makes it more obvious that it is a temporary measure (and lit can put
-   in a separate category).

Modified: llvm/branches/wendling/eh/utils/lit/lit/LitConfig.py
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/lit/lit/LitConfig.py?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/lit/lit/LitConfig.py (original)
+++ llvm/branches/wendling/eh/utils/lit/lit/LitConfig.py Tue Oct 26 19:48:03 2010
@@ -8,6 +8,9 @@
     easily.
     """
 
+    # Provide access to Test module.
+    import Test
+
     # Provide access to built-in formats.
     import LitFormats as formats
 

Modified: llvm/branches/wendling/eh/utils/lit/lit/LitFormats.py
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/lit/lit/LitFormats.py?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/lit/lit/LitFormats.py (original)
+++ llvm/branches/wendling/eh/utils/lit/lit/LitFormats.py Tue Oct 26 19:48:03 2010
@@ -1,2 +1,3 @@
+from TestFormats import FileBasedTest
 from TestFormats import GoogleTest, ShTest, TclTest
 from TestFormats import SyntaxCheckTest, OneCommandPerFileTest

Modified: llvm/branches/wendling/eh/utils/lit/lit/TestFormats.py
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/lit/lit/TestFormats.py?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/lit/lit/TestFormats.py (original)
+++ llvm/branches/wendling/eh/utils/lit/lit/TestFormats.py Tue Oct 26 19:48:03 2010
@@ -1,14 +1,21 @@
 import os
+import platform
 
 import Test
 import TestRunner
 import Util
 
+kIsWindows = platform.system() == 'Windows'
+
 class GoogleTest(object):
     def __init__(self, test_sub_dir, test_suffix):
-        self.test_sub_dir = str(test_sub_dir)
+        self.test_sub_dir = str(test_sub_dir).split(';')
         self.test_suffix = str(test_suffix)
 
+        # On Windows, assume tests will also end in '.exe'.
+        if kIsWindows:
+            self.test_suffix += '.exe'
+
     def getGTestTests(self, path, litConfig, localConfig):
         """getGTestTests(path) - [name]
 
@@ -21,7 +28,10 @@
 
         try:
             lines = Util.capture([path, '--gtest_list_tests'],
-                                 env=localConfig.environment).split('\n')
+                                 env=localConfig.environment)
+            if kIsWindows:
+              lines = lines.replace('\r', '')
+            lines = lines.split('\n')
         except:
             litConfig.error("unable to discover google-tests in %r" % path)
             raise StopIteration
@@ -37,7 +47,7 @@
                 index += 1
             while len(nested_tests) > index:
                 nested_tests.pop()
-            
+
             ln = ln[index*2:]
             if ln.endswith('.'):
                 nested_tests.append(ln)
@@ -49,10 +59,13 @@
         source_path = testSuite.getSourcePath(path_in_suite)
         for filename in os.listdir(source_path):
             # Check for the one subdirectory (build directory) tests will be in.
-            if filename != self.test_sub_dir:
+            if not filename in self.test_sub_dir:
                 continue
 
             filepath = os.path.join(source_path, filename)
+            if not os.path.isdir(filepath):
+                continue
+
             for subfilename in os.listdir(filepath):
                 if subfilename.endswith(self.test_suffix):
                     execpath = os.path.join(filepath, subfilename)
@@ -77,7 +90,7 @@
 
         out, err, exitCode = TestRunner.executeCommand(
             cmd, env=test.config.environment)
-            
+
         if not exitCode:
             return Test.PASS,''
 

Modified: llvm/branches/wendling/eh/utils/lit/lit/TestRunner.py
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/lit/lit/TestRunner.py?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/lit/lit/TestRunner.py (original)
+++ llvm/branches/wendling/eh/utils/lit/lit/TestRunner.py Tue Oct 26 19:48:03 2010
@@ -178,6 +178,13 @@
         else:
             input = subprocess.PIPE
 
+    # Explicitly close any redirected files. We need to do this now because we
+    # need to release any handles we may have on the temporary files (important
+    # on Win32, for example). Since we have already spawned the subprocess, our
+    # handles have already been transferred so we do not need them anymore.
+    for f in opened_files:
+        f.close()
+
     # FIXME: There is probably still deadlock potential here. Yawn.
     procData = [None] * len(procs)
     procData[-1] = procs[-1].communicate()
@@ -215,10 +222,6 @@
         else:
             exitCode = res
 
-    # Explicitly close any redirected files.
-    for f in opened_files:
-        f.close()
-
     # Remove any named temporary files we created.
     for f in named_temp_files:
         try:
@@ -312,11 +315,6 @@
         out,err,exitCode = executeCommand(command, cwd=cwd,
                                           env=test.config.environment)
 
-        # Tcl commands fail on standard error output.
-        if err:
-            exitCode = 1
-            out = 'Command has output on stderr!\n\n' + out
-
         return out,err,exitCode
     else:
         results = []
@@ -328,11 +326,6 @@
 
     out = err = ''
 
-    # Tcl commands fail on standard error output.
-    if [True for _,_,err,res in results if err]:
-        exitCode = 1
-        out += 'Command has output on stderr!\n\n'
-
     for i,(cmd, cmd_out, cmd_err, res) in enumerate(results):
         out += 'Command %d: %s\n' % (i, ' '.join('"%s"' % s for s in cmd.args))
         out += 'Command %d Result: %r\n' % (i, res)
@@ -480,21 +473,27 @@
     isXFail = isExpectedFail(xfails, xtargets, test.suite.config.target_triple)
     return script,isXFail,tmpBase,execdir
 
-def formatTestOutput(status, out, err, exitCode, script):
+def formatTestOutput(status, out, err, exitCode, failDueToStderr, script):
     output = StringIO.StringIO()
     print >>output, "Script:"
     print >>output, "--"
     print >>output, '\n'.join(script)
     print >>output, "--"
-    print >>output, "Exit Code: %r" % exitCode
-    print >>output, "Command Output (stdout):"
-    print >>output, "--"
-    output.write(out)
-    print >>output, "--"
-    print >>output, "Command Output (stderr):"
-    print >>output, "--"
-    output.write(err)
-    print >>output, "--"
+    print >>output, "Exit Code: %r" % exitCode,
+    if failDueToStderr:
+        print >>output, "(but there was output on stderr)"
+    else:
+        print >>output
+    if out:
+        print >>output, "Command Output (stdout):"
+        print >>output, "--"
+        output.write(out)
+        print >>output, "--"
+    if err:
+        print >>output, "Command Output (stderr):"
+        print >>output, "--"
+        output.write(err)
+        print >>output, "--"
     return (status, output.getvalue())
 
 def executeTclTest(test, litConfig):
@@ -519,18 +518,30 @@
     if len(res) == 2:
         return res
 
+    # Test for failure. In addition to the exit code, Tcl commands are
+    # considered to fail if there is any standard error output.
     out,err,exitCode = res
     if isXFail:
-        ok = exitCode != 0
-        status = (Test.XPASS, Test.XFAIL)[ok]
+        ok = exitCode != 0 or err
+        if ok:
+            status = Test.XFAIL
+        else:
+            status = Test.XPASS
     else:
-        ok = exitCode == 0
-        status = (Test.FAIL, Test.PASS)[ok]
+        ok = exitCode == 0 and not err
+        if ok:
+            status = Test.PASS
+        else:
+            status = Test.FAIL
 
     if ok:
         return (status,'')
 
-    return formatTestOutput(status, out, err, exitCode, script)
+    # Set a flag for formatTestOutput so it can explain why the test was
+    # considered to have failed, despite having an exit code of 0.
+    failDueToStderr = exitCode == 0 and err
+
+    return formatTestOutput(status, out, err, exitCode, failDueToStderr, script)
 
 def executeShTest(test, litConfig, useExternalSh):
     if test.config.unsupported:
@@ -558,12 +569,21 @@
     out,err,exitCode = res
     if isXFail:
         ok = exitCode != 0
-        status = (Test.XPASS, Test.XFAIL)[ok]
+        if ok:
+            status = Test.XFAIL
+        else:
+            status = Test.XPASS
     else:
         ok = exitCode == 0
-        status = (Test.FAIL, Test.PASS)[ok]
+        if ok:
+            status = Test.PASS
+        else:
+            status = Test.FAIL
 
     if ok:
         return (status,'')
 
-    return formatTestOutput(status, out, err, exitCode, script)
+    # Sh tests are not considered to fail just from stderr output.
+    failDueToStderr = False
+
+    return formatTestOutput(status, out, err, exitCode, failDueToStderr, script)

Modified: llvm/branches/wendling/eh/utils/lit/lit/TestingConfig.py
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/lit/lit/TestingConfig.py?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/lit/lit/TestingConfig.py (original)
+++ llvm/branches/wendling/eh/utils/lit/lit/TestingConfig.py Tue Oct 26 19:48:03 2010
@@ -10,6 +10,7 @@
         if config is None:
             # Set the environment based on the command line arguments.
             environment = {
+                'LIBRARY_PATH' : os.environ.get('LIBRARY_PATH',''),
                 'LD_LIBRARY_PATH' : os.environ.get('LD_LIBRARY_PATH',''),
                 'PATH' : os.pathsep.join(litConfig.path +
                                          [os.environ.get('PATH','')]),

Modified: llvm/branches/wendling/eh/utils/lit/lit/__init__.py
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/lit/lit/__init__.py?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/lit/lit/__init__.py (original)
+++ llvm/branches/wendling/eh/utils/lit/lit/__init__.py Tue Oct 26 19:48:03 2010
@@ -1,10 +1,10 @@
 """'lit' Testing Tool"""
 
-from lit import main
+from main import main
 
 __author__ = 'Daniel Dunbar'
 __email__ = 'daniel at zuster.org'
-__versioninfo__ = (0, 1, 0)
-__version__ = '.'.join(map(str, __versioninfo__))
+__versioninfo__ = (0, 2, 0)
+__version__ = '.'.join(map(str, __versioninfo__)) + 'dev'
 
 __all__ = []

Removed: llvm/branches/wendling/eh/utils/lit/lit/lit.py
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/lit/lit/lit.py?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/utils/lit/lit/lit.py (original)
+++ llvm/branches/wendling/eh/utils/lit/lit/lit.py (removed)
@@ -1,649 +0,0 @@
-#!/usr/bin/env python
-
-"""
-lit - LLVM Integrated Tester.
-
-See lit.pod for more information.
-"""
-
-import math, os, platform, random, re, sys, time, threading, traceback
-
-import ProgressBar
-import TestRunner
-import Util
-
-from TestingConfig import TestingConfig
-import LitConfig
-import Test
-
-# Configuration files to look for when discovering test suites. These can be
-# overridden with --config-prefix.
-#
-# FIXME: Rename to 'config.lit', 'site.lit', and 'local.lit' ?
-gConfigName = 'lit.cfg'
-gSiteConfigName = 'lit.site.cfg'
-
-kLocalConfigName = 'lit.local.cfg'
-
-class TestingProgressDisplay:
-    def __init__(self, opts, numTests, progressBar=None):
-        self.opts = opts
-        self.numTests = numTests
-        self.current = None
-        self.lock = threading.Lock()
-        self.progressBar = progressBar
-        self.completed = 0
-
-    def update(self, test):
-        # Avoid locking overhead in quiet mode
-        if self.opts.quiet and not test.result.isFailure:
-            self.completed += 1
-            return
-
-        # Output lock.
-        self.lock.acquire()
-        try:
-            self.handleUpdate(test)
-        finally:
-            self.lock.release()
-
-    def finish(self):
-        if self.progressBar:
-            self.progressBar.clear()
-        elif self.opts.quiet:
-            pass
-        elif self.opts.succinct:
-            sys.stdout.write('\n')
-
-    def handleUpdate(self, test):
-        self.completed += 1
-        if self.progressBar:
-            self.progressBar.update(float(self.completed)/self.numTests,
-                                    test.getFullName())
-
-        if self.opts.succinct and not test.result.isFailure:
-            return
-
-        if self.progressBar:
-            self.progressBar.clear()
-
-        print '%s: %s (%d of %d)' % (test.result.name, test.getFullName(),
-                                     self.completed, self.numTests)
-
-        if test.result.isFailure and self.opts.showOutput:
-            print "%s TEST '%s' FAILED %s" % ('*'*20, test.getFullName(),
-                                              '*'*20)
-            print test.output
-            print "*" * 20
-
-        sys.stdout.flush()
-
-class TestProvider:
-    def __init__(self, tests, maxTime):
-        self.maxTime = maxTime
-        self.iter = iter(tests)
-        self.lock = threading.Lock()
-        self.startTime = time.time()
-
-    def get(self):
-        # Check if we have run out of time.
-        if self.maxTime is not None:
-            if time.time() - self.startTime > self.maxTime:
-                return None
-
-        # Otherwise take the next test.
-        self.lock.acquire()
-        try:
-            item = self.iter.next()
-        except StopIteration:
-            item = None
-        self.lock.release()
-        return item
-
-class Tester(threading.Thread):
-    def __init__(self, litConfig, provider, display):
-        threading.Thread.__init__(self)
-        self.litConfig = litConfig
-        self.provider = provider
-        self.display = display
-
-    def run(self):
-        while 1:
-            item = self.provider.get()
-            if item is None:
-                break
-            self.runTest(item)
-
-    def runTest(self, test):
-        result = None
-        startTime = time.time()
-        try:
-            result, output = test.config.test_format.execute(test,
-                                                             self.litConfig)
-        except KeyboardInterrupt:
-            # This is a sad hack. Unfortunately subprocess goes
-            # bonkers with ctrl-c and we start forking merrily.
-            print '\nCtrl-C detected, goodbye.'
-            os.kill(0,9)
-        except:
-            if self.litConfig.debug:
-                raise
-            result = Test.UNRESOLVED
-            output = 'Exception during script execution:\n'
-            output += traceback.format_exc()
-            output += '\n'
-        elapsed = time.time() - startTime
-
-        test.setResult(result, output, elapsed)
-        self.display.update(test)
-
-def dirContainsTestSuite(path):
-    cfgpath = os.path.join(path, gSiteConfigName)
-    if os.path.exists(cfgpath):
-        return cfgpath
-    cfgpath = os.path.join(path, gConfigName)
-    if os.path.exists(cfgpath):
-        return cfgpath
-
-def getTestSuite(item, litConfig, cache):
-    """getTestSuite(item, litConfig, cache) -> (suite, relative_path)
-
-    Find the test suite containing @arg item.
-
-    @retval (None, ...) - Indicates no test suite contains @arg item.
-    @retval (suite, relative_path) - The suite that @arg item is in, and its
-    relative path inside that suite.
-    """
-    def search1(path):
-        # Check for a site config or a lit config.
-        cfgpath = dirContainsTestSuite(path)
-
-        # If we didn't find a config file, keep looking.
-        if not cfgpath:
-            parent,base = os.path.split(path)
-            if parent == path:
-                return (None, ())
-
-            ts, relative = search(parent)
-            return (ts, relative + (base,))
-
-        # We found a config file, load it.
-        if litConfig.debug:
-            litConfig.note('loading suite config %r' % cfgpath)
-
-        cfg = TestingConfig.frompath(cfgpath, None, litConfig, mustExist = True)
-        source_root = os.path.realpath(cfg.test_source_root or path)
-        exec_root = os.path.realpath(cfg.test_exec_root or path)
-        return Test.TestSuite(cfg.name, source_root, exec_root, cfg), ()
-
-    def search(path):
-        # Check for an already instantiated test suite.
-        res = cache.get(path)
-        if res is None:
-            cache[path] = res = search1(path)
-        return res
-
-    # Canonicalize the path.
-    item = os.path.realpath(item)
-
-    # Skip files and virtual components.
-    components = []
-    while not os.path.isdir(item):
-        parent,base = os.path.split(item)
-        if parent == item:
-            return (None, ())
-        components.append(base)
-        item = parent
-    components.reverse()
-
-    ts, relative = search(item)
-    return ts, tuple(relative + tuple(components))
-
-def getLocalConfig(ts, path_in_suite, litConfig, cache):
-    def search1(path_in_suite):
-        # Get the parent config.
-        if not path_in_suite:
-            parent = ts.config
-        else:
-            parent = search(path_in_suite[:-1])
-
-        # Load the local configuration.
-        source_path = ts.getSourcePath(path_in_suite)
-        cfgpath = os.path.join(source_path, kLocalConfigName)
-        if litConfig.debug:
-            litConfig.note('loading local config %r' % cfgpath)
-        return TestingConfig.frompath(cfgpath, parent, litConfig,
-                                    mustExist = False,
-                                    config = parent.clone(cfgpath))
-
-    def search(path_in_suite):
-        key = (ts, path_in_suite)
-        res = cache.get(key)
-        if res is None:
-            cache[key] = res = search1(path_in_suite)
-        return res
-
-    return search(path_in_suite)
-
-def getTests(path, litConfig, testSuiteCache, localConfigCache):
-    # Find the test suite for this input and its relative path.
-    ts,path_in_suite = getTestSuite(path, litConfig, testSuiteCache)
-    if ts is None:
-        litConfig.warning('unable to find test suite for %r' % path)
-        return (),()
-
-    if litConfig.debug:
-        litConfig.note('resolved input %r to %r::%r' % (path, ts.name,
-                                                        path_in_suite))
-
-    return ts, getTestsInSuite(ts, path_in_suite, litConfig,
-                               testSuiteCache, localConfigCache)
-
-def getTestsInSuite(ts, path_in_suite, litConfig,
-                    testSuiteCache, localConfigCache):
-    # Check that the source path exists (errors here are reported by the
-    # caller).
-    source_path = ts.getSourcePath(path_in_suite)
-    if not os.path.exists(source_path):
-        return
-
-    # Check if the user named a test directly.
-    if not os.path.isdir(source_path):
-        lc = getLocalConfig(ts, path_in_suite[:-1], litConfig, localConfigCache)
-        yield Test.Test(ts, path_in_suite, lc)
-        return
-
-    # Otherwise we have a directory to search for tests, start by getting the
-    # local configuration.
-    lc = getLocalConfig(ts, path_in_suite, litConfig, localConfigCache)
-
-    # Search for tests.
-    if lc.test_format is not None:
-        for res in lc.test_format.getTestsInDirectory(ts, path_in_suite,
-                                                      litConfig, lc):
-            yield res
-
-    # Search subdirectories.
-    for filename in os.listdir(source_path):
-        # FIXME: This doesn't belong here?
-        if filename in ('Output', '.svn') or filename in lc.excludes:
-            continue
-
-        # Ignore non-directories.
-        file_sourcepath = os.path.join(source_path, filename)
-        if not os.path.isdir(file_sourcepath):
-            continue
-
-        # Check for nested test suites, first in the execpath in case there is a
-        # site configuration and then in the source path.
-        file_execpath = ts.getExecPath(path_in_suite + (filename,))
-        if dirContainsTestSuite(file_execpath):
-            sub_ts, subiter = getTests(file_execpath, litConfig,
-                                       testSuiteCache, localConfigCache)
-        elif dirContainsTestSuite(file_sourcepath):
-            sub_ts, subiter = getTests(file_sourcepath, litConfig,
-                                       testSuiteCache, localConfigCache)
-        else:
-            # Otherwise, continue loading from inside this test suite.
-            subiter = getTestsInSuite(ts, path_in_suite + (filename,),
-                                      litConfig, testSuiteCache,
-                                      localConfigCache)
-            sub_ts = None
-
-        N = 0
-        for res in subiter:
-            N += 1
-            yield res
-        if sub_ts and not N:
-            litConfig.warning('test suite %r contained no tests' % sub_ts.name)
-
-def runTests(numThreads, litConfig, provider, display):
-    # If only using one testing thread, don't use threads at all; this lets us
-    # profile, among other things.
-    if numThreads == 1:
-        t = Tester(litConfig, provider, display)
-        t.run()
-        return
-
-    # Otherwise spin up the testing threads and wait for them to finish.
-    testers = [Tester(litConfig, provider, display)
-               for i in range(numThreads)]
-    for t in testers:
-        t.start()
-    try:
-        for t in testers:
-            t.join()
-    except KeyboardInterrupt:
-        sys.exit(2)
-
-def load_test_suite(inputs):
-    import unittest
-
-    # Create the global config object.
-    litConfig = LitConfig.LitConfig(progname = 'lit',
-                                    path = [],
-                                    quiet = False,
-                                    useValgrind = False,
-                                    valgrindLeakCheck = False,
-                                    valgrindArgs = [],
-                                    useTclAsSh = False,
-                                    noExecute = False,
-                                    debug = False,
-                                    isWindows = (platform.system()=='Windows'),
-                                    params = {})
-
-    # Load the tests from the inputs.
-    tests = []
-    testSuiteCache = {}
-    localConfigCache = {}
-    for input in inputs:
-        prev = len(tests)
-        tests.extend(getTests(input, litConfig,
-                              testSuiteCache, localConfigCache)[1])
-        if prev == len(tests):
-            litConfig.warning('input %r contained no tests' % input)
-
-    # If there were any errors during test discovery, exit now.
-    if litConfig.numErrors:
-        print >>sys.stderr, '%d errors, exiting.' % litConfig.numErrors
-        sys.exit(2)
-
-    # Return a unittest test suite which just runs the tests in order.
-    def get_test_fn(test):
-        return unittest.FunctionTestCase(
-            lambda: test.config.test_format.execute(
-                test, litConfig),
-            description = test.getFullName())
-
-    from LitTestCase import LitTestCase
-    return unittest.TestSuite([LitTestCase(test, litConfig) for test in tests])
-
-def main():
-    # Bump the GIL check interval, its more important to get any one thread to a
-    # blocking operation (hopefully exec) than to try and unblock other threads.
-    #
-    # FIXME: This is a hack.
-    import sys
-    sys.setcheckinterval(1000)
-
-    global options
-    from optparse import OptionParser, OptionGroup
-    parser = OptionParser("usage: %prog [options] {file-or-path}")
-
-    parser.add_option("-j", "--threads", dest="numThreads", metavar="N",
-                      help="Number of testing threads",
-                      type=int, action="store", default=None)
-    parser.add_option("", "--config-prefix", dest="configPrefix",
-                      metavar="NAME", help="Prefix for 'lit' config files",
-                      action="store", default=None)
-    parser.add_option("", "--param", dest="userParameters",
-                      metavar="NAME=VAL",
-                      help="Add 'NAME' = 'VAL' to the user defined parameters",
-                      type=str, action="append", default=[])
-
-    group = OptionGroup(parser, "Output Format")
-    # FIXME: I find these names very confusing, although I like the
-    # functionality.
-    group.add_option("-q", "--quiet", dest="quiet",
-                     help="Suppress no error output",
-                     action="store_true", default=False)
-    group.add_option("-s", "--succinct", dest="succinct",
-                     help="Reduce amount of output",
-                     action="store_true", default=False)
-    group.add_option("-v", "--verbose", dest="showOutput",
-                     help="Show all test output",
-                     action="store_true", default=False)
-    group.add_option("", "--no-progress-bar", dest="useProgressBar",
-                     help="Do not use curses based progress bar",
-                     action="store_false", default=True)
-    parser.add_option_group(group)
-
-    group = OptionGroup(parser, "Test Execution")
-    group.add_option("", "--path", dest="path",
-                     help="Additional paths to add to testing environment",
-                     action="append", type=str, default=[])
-    group.add_option("", "--vg", dest="useValgrind",
-                     help="Run tests under valgrind",
-                     action="store_true", default=False)
-    group.add_option("", "--vg-leak", dest="valgrindLeakCheck",
-                     help="Check for memory leaks under valgrind",
-                     action="store_true", default=False)
-    group.add_option("", "--vg-arg", dest="valgrindArgs", metavar="ARG",
-                     help="Specify an extra argument for valgrind",
-                     type=str, action="append", default=[])
-    group.add_option("", "--time-tests", dest="timeTests",
-                     help="Track elapsed wall time for each test",
-                     action="store_true", default=False)
-    group.add_option("", "--no-execute", dest="noExecute",
-                     help="Don't execute any tests (assume PASS)",
-                     action="store_true", default=False)
-    parser.add_option_group(group)
-
-    group = OptionGroup(parser, "Test Selection")
-    group.add_option("", "--max-tests", dest="maxTests", metavar="N",
-                     help="Maximum number of tests to run",
-                     action="store", type=int, default=None)
-    group.add_option("", "--max-time", dest="maxTime", metavar="N",
-                     help="Maximum time to spend testing (in seconds)",
-                     action="store", type=float, default=None)
-    group.add_option("", "--shuffle", dest="shuffle",
-                     help="Run tests in random order",
-                     action="store_true", default=False)
-    parser.add_option_group(group)
-
-    group = OptionGroup(parser, "Debug and Experimental Options")
-    group.add_option("", "--debug", dest="debug",
-                      help="Enable debugging (for 'lit' development)",
-                      action="store_true", default=False)
-    group.add_option("", "--show-suites", dest="showSuites",
-                      help="Show discovered test suites",
-                      action="store_true", default=False)
-    group.add_option("", "--no-tcl-as-sh", dest="useTclAsSh",
-                      help="Don't run Tcl scripts using 'sh'",
-                      action="store_false", default=True)
-    group.add_option("", "--repeat", dest="repeatTests", metavar="N",
-                      help="Repeat tests N times (for timing)",
-                      action="store", default=None, type=int)
-    parser.add_option_group(group)
-
-    (opts, args) = parser.parse_args()
-
-    if not args:
-        parser.error('No inputs specified')
-
-    if opts.configPrefix is not None:
-        global gConfigName, gSiteConfigName
-        gConfigName = '%s.cfg' % opts.configPrefix
-        gSiteConfigName = '%s.site.cfg' % opts.configPrefix
-
-    if opts.numThreads is None:
-# Python <2.5 has a race condition causing lit to always fail with numThreads>1
-# http://bugs.python.org/issue1731717
-# I haven't seen this bug occur with 2.5.2 and later, so only enable multiple
-# threads by default there.
-       if sys.hexversion >= 0x2050200:
-               opts.numThreads = Util.detectCPUs()
-       else:
-               opts.numThreads = 1
-
-    inputs = args
-
-    # Create the user defined parameters.
-    userParams = {}
-    for entry in opts.userParameters:
-        if '=' not in entry:
-            name,val = entry,''
-        else:
-            name,val = entry.split('=', 1)
-        userParams[name] = val
-
-    # Create the global config object.
-    litConfig = LitConfig.LitConfig(progname = os.path.basename(sys.argv[0]),
-                                    path = opts.path,
-                                    quiet = opts.quiet,
-                                    useValgrind = opts.useValgrind,
-                                    valgrindLeakCheck = opts.valgrindLeakCheck,
-                                    valgrindArgs = opts.valgrindArgs,
-                                    useTclAsSh = opts.useTclAsSh,
-                                    noExecute = opts.noExecute,
-                                    debug = opts.debug,
-                                    isWindows = (platform.system()=='Windows'),
-                                    params = userParams)
-
-    # Expand '@...' form in inputs.
-    actual_inputs = []
-    for input in inputs:
-        if os.path.exists(input) or not input.startswith('@'):
-            actual_inputs.append(input)
-        else:
-            f = open(input[1:])
-            try:
-                for ln in f:
-                    ln = ln.strip()
-                    if ln:
-                        actual_inputs.append(ln)
-            finally:
-                f.close()
-                    
-            
-    # Load the tests from the inputs.
-    tests = []
-    testSuiteCache = {}
-    localConfigCache = {}
-    for input in actual_inputs:
-        prev = len(tests)
-        tests.extend(getTests(input, litConfig,
-                              testSuiteCache, localConfigCache)[1])
-        if prev == len(tests):
-            litConfig.warning('input %r contained no tests' % input)
-
-    # If there were any errors during test discovery, exit now.
-    if litConfig.numErrors:
-        print >>sys.stderr, '%d errors, exiting.' % litConfig.numErrors
-        sys.exit(2)
-
-    if opts.showSuites:
-        suitesAndTests = dict([(ts,[])
-                               for ts,_ in testSuiteCache.values()
-                               if ts])
-        for t in tests:
-            suitesAndTests[t.suite].append(t)
-
-        print '-- Test Suites --'
-        suitesAndTests = suitesAndTests.items()
-        suitesAndTests.sort(key = lambda (ts,_): ts.name)
-        for ts,ts_tests in suitesAndTests:
-            print '  %s - %d tests' %(ts.name, len(ts_tests))
-            print '    Source Root: %s' % ts.source_root
-            print '    Exec Root  : %s' % ts.exec_root
-
-    # Select and order the tests.
-    numTotalTests = len(tests)
-    if opts.shuffle:
-        random.shuffle(tests)
-    else:
-        tests.sort(key = lambda t: t.getFullName())
-    if opts.maxTests is not None:
-        tests = tests[:opts.maxTests]
-
-    extra = ''
-    if len(tests) != numTotalTests:
-        extra = ' of %d' % numTotalTests
-    header = '-- Testing: %d%s tests, %d threads --'%(len(tests),extra,
-                                                      opts.numThreads)
-
-    if opts.repeatTests:
-        tests = [t.copyWithIndex(i)
-                 for t in tests
-                 for i in range(opts.repeatTests)]
-
-    progressBar = None
-    if not opts.quiet:
-        if opts.succinct and opts.useProgressBar:
-            try:
-                tc = ProgressBar.TerminalController()
-                progressBar = ProgressBar.ProgressBar(tc, header)
-            except ValueError:
-                print header
-                progressBar = ProgressBar.SimpleProgressBar('Testing: ')
-        else:
-            print header
-
-    # Don't create more threads than tests.
-    opts.numThreads = min(len(tests), opts.numThreads)
-
-    startTime = time.time()
-    display = TestingProgressDisplay(opts, len(tests), progressBar)
-    provider = TestProvider(tests, opts.maxTime)
-    runTests(opts.numThreads, litConfig, provider, display)
-    display.finish()
-
-    if not opts.quiet:
-        print 'Testing Time: %.2fs'%(time.time() - startTime)
-
-    # Update results for any tests which weren't run.
-    for t in tests:
-        if t.result is None:
-            t.setResult(Test.UNRESOLVED, '', 0.0)
-
-    # List test results organized by kind.
-    hasFailures = False
-    byCode = {}
-    for t in tests:
-        if t.result not in byCode:
-            byCode[t.result] = []
-        byCode[t.result].append(t)
-        if t.result.isFailure:
-            hasFailures = True
-
-    # FIXME: Show unresolved and (optionally) unsupported tests.
-    for title,code in (('Unexpected Passing Tests', Test.XPASS),
-                       ('Failing Tests', Test.FAIL)):
-        elts = byCode.get(code)
-        if not elts:
-            continue
-        print '*'*20
-        print '%s (%d):' % (title, len(elts))
-        for t in elts:
-            print '    %s' % t.getFullName()
-        print
-
-    if opts.timeTests:
-        # Collate, in case we repeated tests.
-        times = {}
-        for t in tests:
-            key = t.getFullName()
-            times[key] = times.get(key, 0.) + t.elapsed
-
-        byTime = list(times.items())
-        byTime.sort(key = lambda (name,elapsed): elapsed)
-        if byTime:
-            Util.printHistogram(byTime, title='Tests')
-
-    for name,code in (('Expected Passes    ', Test.PASS),
-                      ('Expected Failures  ', Test.XFAIL),
-                      ('Unsupported Tests  ', Test.UNSUPPORTED),
-                      ('Unresolved Tests   ', Test.UNRESOLVED),
-                      ('Unexpected Passes  ', Test.XPASS),
-                      ('Unexpected Failures', Test.FAIL),):
-        if opts.quiet and not code.isFailure:
-            continue
-        N = len(byCode.get(code,[]))
-        if N:
-            print '  %s: %d' % (name,N)
-
-    # If we encountered any additional errors, exit abnormally.
-    if litConfig.numErrors:
-        print >>sys.stderr, '\n%d error(s), exiting.' % litConfig.numErrors
-        sys.exit(2)
-
-    # Warn about warnings.
-    if litConfig.numWarnings:
-        print >>sys.stderr, '\n%d warning(s) in tests.' % litConfig.numWarnings
-
-    if hasFailures:
-        sys.exit(1)
-    sys.exit(0)
-
-if __name__=='__main__':
-    main()

Modified: llvm/branches/wendling/eh/utils/lit/setup.py
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/lit/setup.py?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/lit/setup.py (original)
+++ llvm/branches/wendling/eh/utils/lit/setup.py Tue Oct 26 19:48:03 2010
@@ -3,7 +3,7 @@
 # FIXME: Support distutils?
 from setuptools import setup, find_packages
 setup(
-    name = "Lit",
+    name = "lit",
     version = lit.__version__,
 
     author = lit.__author__,
@@ -14,15 +14,16 @@
     description = "A Software Testing Tool",
     keywords = 'test C++ automatic discovery',
     long_description = """\
-Lit
-+++
+*lit*
++++++
 
 About
 =====
 
-Lit is a portable tool for executing LLVM and Clang style test suites,
-summarizing their results, and providing indication of failures. Lit is designed
-to be a lightweight testing tool with as simple a user interface as possible.
+*lit* is a portable tool for executing LLVM and Clang style test suites,
+summarizing their results, and providing indication of failures. *lit* is
+designed to be a lightweight testing tool with as simple a user interface as
+possible.
 
 
 Features
@@ -37,15 +38,15 @@
 Documentation
 =============
 
-The offical Lit documentation is in the man page, available online in the `LLVM
-Command Guide http://llvm.org/cmds/lit.html`_.
+The offical *lit* documentation is in the man page, available online at the LLVM
+Command Guide: http://llvm.org/cmds/lit.html.
 
 
 Source
 ======
 
-The Lit source is available as part of LLVM, in the `LLVM SVN repository
-<http://llvm.org/svn/llvm-project/llvm/trunk/utils/lit`_.
+The *lit* source is available as part of LLVM, in the LLVM SVN repository:
+http://llvm.org/svn/llvm-project/llvm/trunk/utils/lit.
 """,
 
     classifiers=[
@@ -55,7 +56,7 @@
         'License :: OSI Approved :: University of Illinois/NCSA Open Source License',
         'Natural Language :: English',
         'Operating System :: OS Independent',
-        'Progamming Language :: Python',
+        'Programming Language :: Python',
         'Topic :: Software Development :: Testing',
         ],
 

Modified: llvm/branches/wendling/eh/utils/llvm-native-gcc
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/llvm-native-gcc?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/llvm-native-gcc (original)
+++ llvm/branches/wendling/eh/utils/llvm-native-gcc Tue Oct 26 19:48:03 2010
@@ -193,10 +193,10 @@
 
 llvm-native-gcc is a wrapper around the LLVM command-line tools which generates
 a native object (.o) file by compiling FILE with llvm-gcc, and then running 
-an LLVM back-end (CBE by default) over the resulting bytecode, and then
+an LLVM back-end (CBE by default) over the resulting bitcode, and then
 compiling the resulting code to a native object file.
 
-If called as "native-build", it compiles bytecode to native code, and takes
+If called as "native-build", it compiles bitcode to native code, and takes
 different options.
 
 =head1 OPTIONS

Modified: llvm/branches/wendling/eh/utils/llvm-native-gxx
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/llvm-native-gxx?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/llvm-native-gxx (original)
+++ llvm/branches/wendling/eh/utils/llvm-native-gxx Tue Oct 26 19:48:03 2010
@@ -193,10 +193,10 @@
 
 llvm-native-g++ is a wrapper around the LLVM command-line tools which generates
 a native object (.o) file by compiling FILE with llvm-g++, and then running 
-an LLVM back-end (CBE by default) over the resulting bytecode, and then
+an LLVM back-end (CBE by default) over the resulting bitcode, and then
 compiling the resulting code to a native object file.
 
-If called as "native-build", it compiles bytecode to native code, and takes
+If called as "native-build", it compiles bitcode to native code, and takes
 different options.
 
 =head1 OPTIONS

Modified: llvm/branches/wendling/eh/utils/llvm.grm
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/llvm.grm?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/llvm.grm (original)
+++ llvm/branches/wendling/eh/utils/llvm.grm Tue Oct 26 19:48:03 2010
@@ -8,6 +8,8 @@
 IR that is semantically valid. Most of the IR produced doesn't
 pass the Verifier.
 
+TODO: Metadata, in all its forms
+
 *)
 
 I ::=   "title:    LLVM assembly language\n"
@@ -90,6 +92,8 @@
  | dllexport
  | common
  | private
+ | "linker_private"
+ | "linker_private_weak"
  ;
 
 GVExternalLinkage

Modified: llvm/branches/wendling/eh/utils/llvmdo
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/llvmdo?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/llvmdo (original)
+++ llvm/branches/wendling/eh/utils/llvmdo Tue Oct 26 19:48:03 2010
@@ -76,8 +76,6 @@
 shift;
 
 paths_to_ignore="\
-  -path */CVS -o \
-  -path */CVS/* -o \
   -path */.svn/ -o \
   -path */.svn/* -o \
   -path docs/doxygen/* -o \
@@ -130,7 +128,6 @@
   -o -name llvmgrep \
   -o -name check-each-file \
   -o -name codgen-diff \
-  -o -name cvsupdate \
   -o -name llvm-native-gcc \
   -o -name llvm-native-gxx \
   -o -name makellvm \
@@ -153,7 +150,6 @@
      -name \.* \
   -o -name *~ \
   -o -name #* \
-  -o -name *.cvs \
   -o -name configure \
   -o -name slow.ll \
   -o -name *libtool* \

Removed: llvm/branches/wendling/eh/utils/mkpatch
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/mkpatch?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/utils/mkpatch (original)
+++ llvm/branches/wendling/eh/utils/mkpatch (removed)
@@ -1,37 +0,0 @@
-#!/bin/bash
-#
-# This script makes a patch for LLVM ensuring the correct diff options and
-# putting the files in a standard review order.
-
-
-function error {
-  retcode="$?"
-  echo "mkpatch: error: $1 ($retcode)"
-  exit 1
-}
-
-if [ ! -e llvm.spec.in ] ; then
-  error "Please change directory to the LLVM top source directory"
-fi
-if [ "$#" -ne 1 ] ; then
-  error "usage: utils/mkpatch [PATCH_NAME]"
-fi
-NAME="$1"
-echo "mkpatch: Generating differences on top level files"
-svn diff -N -x -u > "$NAME".patch.raw 2>&1
-echo "mkpatch: Generating differences on all directories"
-svn diff -x -u  >> "$NAME".patch.raw 2>&1 \
-  autoconf docs utils include lib/System lib/Support lib/VMCore lib/AsmParser \
-  lib/Bitcode lib/Analysis lib/Transforms lib/CodeGen lib/Target \
-  lib/ExecutionEngine lib/Linker lib/MC \
-  tools test unittests runtime projects examples Xcode
-
-echo "mkpatch: Removing cruft from the patch file"
-sed -e '/^[?] .*/d' -e '/^cvs diff: Diffing/d' "$NAME".patch.raw | awk '\
-BEGIN { deleting = 0; } \
-/^Index: .*[.]cvs$/ { deleting = 1; fname=substr($0,7); \
-  print "Skipping: ", fname > "/dev/stderr"; } \
-/^Index:.*/ && !/^Index: .*[.]cvs$/ { deleting = 0; } \
-{ if (! deleting) { print; } } '  > "$NAME".patch  || \
-  error "sed/awk cleanup failed"
-

Modified: llvm/branches/wendling/eh/utils/profile.pl
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/profile.pl?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/profile.pl (original)
+++ llvm/branches/wendling/eh/utils/profile.pl Tue Oct 26 19:48:03 2010
@@ -5,7 +5,7 @@
 # Synopsis: Insert instrumentation code into a program, run it with the JIT,
 #           then print out a profile report.
 #
-# Syntax:   profile.pl [OPTIONS] bytecodefile <arguments>
+# Syntax:   profile.pl [OPTIONS] bitcodefile <arguments>
 #
 # OPTIONS may include one or more of the following:
 #     -block    - Enable basicblock profiling
@@ -56,7 +56,7 @@
   $LLVMProfOpts .= " " . $_;
 }
 
-die "Must specify LLVM bytecode file as first argument!" if (@ARGV == 0);
+die "Must specify LLVM bitcode file as first argument!" if (@ARGV == 0);
 
 my $BytecodeFile = $ARGV[0];
 

Modified: llvm/branches/wendling/eh/utils/unittest/UnitTestMain/TestMain.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/unittest/UnitTestMain/TestMain.cpp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/unittest/UnitTestMain/TestMain.cpp (original)
+++ llvm/branches/wendling/eh/utils/unittest/UnitTestMain/TestMain.cpp Tue Oct 26 19:48:03 2010
@@ -7,9 +7,36 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "llvm/Config/config.h"
+#include "llvm/System/Signals.h"
 #include "gtest/gtest.h"
 
+
+#if defined(LLVM_ON_WIN32)
+# include <Windows.h>
+# if defined(_MSC_VER)
+#   include <crtdbg.h>
+# endif
+#endif
+
 int main(int argc, char **argv) {
+  llvm::sys::PrintStackTraceOnErrorSignal();
   testing::InitGoogleTest(&argc, argv);
+
+# if defined(LLVM_ON_WIN32)
+  // Disable all of the possible ways Windows conspires to make automated
+  // testing impossible.
+  ::SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);
+#   if defined(_MSC_VER)
+    ::_set_error_mode(_OUT_TO_STDERR);
+    _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
+    _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
+    _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
+    _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
+    _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
+    _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
+#   endif
+# endif
+
   return RUN_ALL_TESTS();
 }

Modified: llvm/branches/wendling/eh/utils/unittest/googletest/gtest.cc
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/unittest/googletest/gtest.cc?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/unittest/googletest/gtest.cc (original)
+++ llvm/branches/wendling/eh/utils/unittest/googletest/gtest.cc Tue Oct 26 19:48:03 2010
@@ -1964,8 +1964,8 @@
 
 }  // namespace internal
 
-#if GTEST_OS_WINDOWS
-// We are on Windows.
+#if GTEST_HAS_SEH
+// We are on Windows with SEH.
 
 // Adds an "exception thrown" fatal failure to the current test.
 static void AddExceptionThrownFailure(DWORD exception_code,
@@ -1978,7 +1978,7 @@
                                            message.GetString());
 }
 
-#endif  // GTEST_OS_WINDOWS
+#endif  // GTEST_HAS_SEH
 
 // Google Test requires all tests in the same test case to use the same test
 // fixture class.  This function checks if the current test has the
@@ -2224,35 +2224,6 @@
   return impl_->result()->increment_death_test_count();
 }
 
-namespace {
-
-// A predicate that checks the test name of a TestInfo against a known
-// value.
-//
-// This is used for implementation of the TestCase class only.  We put
-// it in the anonymous namespace to prevent polluting the outer
-// namespace.
-//
-// TestNameIs is copyable.
-class TestNameIs {
- public:
-  // Constructor.
-  //
-  // TestNameIs has NO default constructor.
-  explicit TestNameIs(const char* name)
-      : name_(name) {}
-
-  // Returns true iff the test name of test_info matches name_.
-  bool operator()(const TestInfo * test_info) const {
-    return test_info && internal::String(test_info->name()).Compare(name_) == 0;
-  }
-
- private:
-  internal::String name_;
-};
-
-}  // namespace
-
 namespace internal {
 
 // This method expands all parameterized tests registered with macros TEST_P

Modified: llvm/branches/wendling/eh/utils/unittest/googletest/include/gtest/internal/gtest-port.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/unittest/googletest/include/gtest/internal/gtest-port.h?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/unittest/googletest/include/gtest/internal/gtest-port.h (original)
+++ llvm/branches/wendling/eh/utils/unittest/googletest/include/gtest/internal/gtest-port.h Tue Oct 26 19:48:03 2010
@@ -403,7 +403,8 @@
 // defining __GNUC__ and friends, but cannot compile GCC's tuple
 // implementation.  MSVC 2008 (9.0) provides TR1 tuple in a 323 MB
 // Feature Pack download, which we cannot assume the user has.
-#if (defined(__GNUC__) && !defined(__CUDACC__) && (GTEST_GCC_VER_ >= 40000)) \
+#if (defined(__GNUC__) && !(defined(__CUDACC__) || defined(__clang__)) \
+                       && (GTEST_GCC_VER_ >= 40000)) \
     || _MSC_VER >= 1600
 #define GTEST_USE_OWN_TR1_TUPLE 0
 #else

Removed: llvm/branches/wendling/eh/utils/userloc.pl
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/userloc.pl?rev=117424&view=auto
==============================================================================
--- llvm/branches/wendling/eh/utils/userloc.pl (original)
+++ llvm/branches/wendling/eh/utils/userloc.pl (removed)
@@ -1,216 +0,0 @@
-#!/usr/bin/perl -w
-#
-# Program:  userloc.pl
-#
-# Synopsis: This program uses "cvs annotate" to get a summary of how many lines
-#           of code the various developres are responsible for. It takes one
-#           argument, the directory to process. If the argument is not specified
-#           then the cwd is used. The directory must be an LLVM tree checked out
-#           from cvs. 
-#
-# Syntax:   userloc.pl [-tag=tag|-html... <directory>...
-#
-# Options:
-#           -tag=tag
-#               Use "tag" to select the revision (as per cvs -r option)
-#           -filedetails
-#               Report details about lines of code in each file for each user
-#           -html
-#               Generate HTML output instead of text output
-#           -topdir
-#               Specify where the top llvm source directory is. Otherwise the
-#               llvm-config tool is used to find it.
-# Directories:
-#   The directories passed after the options should be relative paths to
-#   directories of interest from the top of the llvm source tree, e.g. "lib"
-#   or "include", etc.
-
-die "Usage userloc.pl [-tag=tag|-html] <directories>..." 
-  if ($#ARGV < 0);
-
-my $tag = "";
-my $html = 0;
-my $debug = 0;
-my $filedetails = "";
-my $srcroot = "";
-while ( defined($ARGV[0]) && substr($ARGV[0],0,1) eq '-' )
-{
-  if ($ARGV[0] =~ /-tag=.*/) {
-    $tag = $ARGV[0];
-    $tag =~ s#-tag=(.*)#$1#;
-  } elsif ($ARGV[0] =~ /-filedetails/) {
-    $filedetails = 1;
-  } elsif ($ARGV[0] eq "-html") {
-    $html = 1;
-  } elsif ($ARGV[0] eq "-debug") {
-    $debug = 1;
-  } elsif ($ARGV[0] eq "-topdir") {
-    shift; $srcroot = $ARGV[0]; shift;
-  } else {
-    die "Invalid option: $ARGV[0]";
-  }
-  shift;
-}
-
-if (length($srcroot) == 0) {
-  chomp($srcroot = `llvm-config --src-root`);
-}
-if (! -d "$srcroot") {
-  die "Invalid source root: $srcroot\n";
-}
-chdir($srcroot);
-my $llvmdo = "$srcroot/utils/llvmdo -topdir '$srcroot'";
-my %Stats;
-my %FileStats;
-
-my $annotate = "cvs -z6 annotate -lf ";
-if (length($tag) > 0)
-{
-  $annotate = $annotate . " -r" . $tag;
-}
-
-sub GetCVSFiles
-{
-  my $d = $_[0];
-  my $files ="";
-  open FILELIST, 
-    "$llvmdo -dirs \"$d\" -code-only echo |" || die "Can't get list of files with llvmdo";
-  while ( defined($line = <FILELIST>) ) {
-    chomp($file = $line);
-    print "File: $file\n" if ($debug);
-    $files = "$files $file";
-  }
-  return $files;
-}
-
-sub ScanDir
-{
-  my $Dir = $_[0];
-  my $files = GetCVSFiles($Dir);
-
-  open (DATA,"$annotate $files 2>&1 |")
-    || die "Can't read cvs annotation data";
-
-  my $curfile = "";
-  while ( defined($line = <DATA>) )
-  {
-    chomp($line);
-    if ($line =~ '^Annotations for.*') {
-      $curfile = $line;
-      $curfile =~ s#^Annotations for ([[:print:]]*)#$1#;
-      print "Scanning: $curfile\n" if ($debug);
-    } elsif ($line =~ /^[0-9.]*[ \t]*\([^)]*\):/) {
-      $uname = $line;
-      $uname =~ s#^[0-9.]*[ \t]*\(([a-zA-Z0-9_.-]*) [^)]*\):.*#$1#;
-      $Stats{$uname}++;
-      if ($filedetails) {
-        $FileStats{$uname} = {} unless exists $FileStats{$uname};
-        ${$FileStats{$uname}}{$curfile}++;
-      }
-    }
-  }
-  close DATA;
-}
-
-sub printStats
-{
-  my $dir = $_[0];
-  my $hash = $_[1];
-  my $user;
-  my $total = 0;
-
-  foreach $user (keys %Stats) { $total += $Stats{$user}; }
-
-  if ($html) { 
-    print "<p>Total Source Lines: $total<br/></p>\n";
-    print "<table>";
-    print " <tr><th style=\"text-align:right\">LOC</th>\n";
-    print " <th style=\"text-align:right\">\%LOC</th>\n";
-    print " <th style=\"text-align:left\">User</th>\n";
-    print "</tr>\n";
-  }
-
-  foreach $user ( sort keys %Stats )
-  {
-    my $v = $Stats{$user};
-    if (defined($v))
-    {
-      if ($html) {
-        printf "<tr><td style=\"text-align:right\">%d</td><td style=\"text-align:right\">(%4.1f%%)</td><td style=\"text-align:left\">", $v, (100.0/$total)*$v;
-        if ($filedetails) {
-          print "<a href=\"#$user\">$user</a></td></tr>";
-        } else {
-          print $user,"</td></tr>";
-        }
-      } else {
-        printf "%8d  (%4.1f%%)  %s\n", $v, (100.0/$total)*$v, $user;
-      }
-    }
-  }
-  print "</table>\n" if ($html);
-
-  if ($filedetails) {
-    foreach $user (sort keys %FileStats) {
-      my $total = 0;
-      foreach $file (sort keys %{$FileStats{$user}}) { 
-        $total += ${$FileStats{$user}}{$file}
-      }
-      if ($html) {
-        print "<table><tr><th style=\"text-align:left\" colspan=\"3\"><a name=\"$user\">$user</a></th></tr>\n";
-      } else {
-        print $user,":\n";
-      }
-      foreach $file (sort keys %{$FileStats{$user}}) {
-        my $v = ${$FileStats{$user}}{$file};
-        if ($html) { 
-          printf "<tr><td style=\"text-align:right\">  %d</td><td
-          style=\"text-align:right\"> %4.1f%%</td><td
-          style=\"text-align:left\">%s</td></tr>",$v, (100.0/$total)*$v,$file;
-        } else {
-          printf "%8d  (%4.1f%%)  %s\n", $v, (100.0/$total)*$v, $file;
-        }
-      }
-      if ($html) { print "</table>\n"; }
-    }
-  }
-}
-
-
-if ($html)
-{
-print "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n";
-print "<html>\n<head>\n";
-print "  <title>LLVM LOC Based On CVS Annotation</title>\n";
-print "  <link rel=\"stylesheet\" href=\"llvm.css\" type=\"text/css\"/>\n";
-print "</head>\n";
-print "<body><div class=\"doc_title\">LLVM LOC Based On CVS Annotation</div>\n";
-print "<p>This document shows the total lines of code per user in each\n";
-print "LLVM directory. Lines of code are attributed by the user that last\n";
-print "committed the line. This does not necessarily reflect authorship.</p>\n";
-}
-
-my @DIRS;
-if ($#ARGV > 0) {
-  @DIRS = @ARGV;
-} else {
-  push @DIRS, 'include';
-  push @DIRS, 'lib';
-  push @DIRS, 'tools';
-  push @DIRS, 'runtime';
-  push @DIRS, 'docs';
-  push @DIRS, 'test';
-  push @DIRS, 'utils';
-  push @DIRS, 'examples';
-  push @DIRS, 'projects/Stacker';
-  push @DIRS, 'projects/sample';
-  push @DIRS, 'autoconf';
-}
-  
-for $Index ( 0 .. $#DIRS) { 
-  print "Scanning Dir: $DIRS[$Index]\n" if ($debug);
-  ScanDir($DIRS[$Index]); 
-}
-
-printStats;
-
-print "</body></html>\n" if ($html) ;

Modified: llvm/branches/wendling/eh/utils/valgrind/i386-pc-linux-gnu.supp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/valgrind/i386-pc-linux-gnu.supp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/valgrind/i386-pc-linux-gnu.supp (original)
+++ llvm/branches/wendling/eh/utils/valgrind/i386-pc-linux-gnu.supp Tue Oct 26 19:48:03 2010
@@ -28,6 +28,12 @@
 }
 
 {
+   We don't care if as leaks
+   Memcheck:Leak
+   obj:/usr/bin/as
+}
+
+{
    We don't care if python leaks
    Memcheck:Leak
    fun:malloc

Modified: llvm/branches/wendling/eh/utils/valgrind/x86_64-pc-linux-gnu.supp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/valgrind/x86_64-pc-linux-gnu.supp?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/valgrind/x86_64-pc-linux-gnu.supp (original)
+++ llvm/branches/wendling/eh/utils/valgrind/x86_64-pc-linux-gnu.supp Tue Oct 26 19:48:03 2010
@@ -2,8 +2,7 @@
    False leak under RegisterPass
    Memcheck:Leak
    ...
-   fun:_ZN83_GLOBAL_*PassRegistrar12RegisterPassERKN4llvm8PassInfoE
-   fun:_ZN4llvm8PassInfo12registerPassEv
+   fun:_ZN4llvm12PassRegistry12registerPassERKNS_8PassInfoE
 }
 
 # Python false positives according to
@@ -28,6 +27,18 @@
 }
 
 {
+   We don't care if as leaks
+   Memcheck:Leak
+   obj:/usr/bin/as
+}
+
+{
+   We don't care if grep leaks
+   Memcheck:Leak
+   obj:/bin/grep
+}
+
+{
    We don't care if python leaks
    Memcheck:Leak
    fun:malloc

Modified: llvm/branches/wendling/eh/utils/vim/llvm.vim
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/vim/llvm.vim?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/vim/llvm.vim (original)
+++ llvm/branches/wendling/eh/utils/vim/llvm.vim Tue Oct 26 19:48:03 2010
@@ -49,6 +49,7 @@
 syn keyword llvmKeyword except deplibs
 syn keyword llvmKeyword volatile fastcc coldcc cc ccc
 syn keyword llvmKeyword x86_stdcallcc x86_fastcallcc
+syn keyword llvmKeyword ptx_kernel ptx_device
 syn keyword llvmKeyword signext zeroext inreg sret nounwind noreturn
 syn keyword llvmKeyword nocapture byval nest readnone readonly noalias
 syn keyword llvmKeyword inlinehint noinline alwaysinline optsize ssp sspreq
@@ -57,11 +58,9 @@
 syn keyword llvmKeyword addrspace section alias sideeffect c gc
 syn keyword llvmKeyword target datalayout triple
 syn keyword llvmKeyword blockaddress
-syn keyword llvmKeyword union
 
 " Obsolete keywords.
-syn keyword llvmError  uninitialized implementation
-syn keyword llvmError  getresult big little endian begin end
+syn keyword llvmError  getresult begin end
 
 " Misc syntax.
 syn match   llvmNoName /[%@]\d\+\>/

Modified: llvm/branches/wendling/eh/utils/vim/vimrc
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/utils/vim/vimrc?rev=117425&r1=117424&r2=117425&view=diff
==============================================================================
--- llvm/branches/wendling/eh/utils/vim/vimrc (original)
+++ llvm/branches/wendling/eh/utils/vim/vimrc Tue Oct 26 19:48:03 2010
@@ -91,3 +91,131 @@
 "set showmode
 "set incsearch
 "set ruler
+
+" Clang code-completion support. This is somewhat experimental!
+
+" A path to a clang executable.
+let g:clang_path = "clang++"
+
+" A list of options to add to the clang commandline, for example to add
+" include paths, predefined macros, and language options.
+let g:clang_opts = [
+  \ "-x","c++",
+  \ "-D__STDC_LIMIT_MACROS=1","-D__STDC_CONSTANT_MACROS=1",
+  \ "-Iinclude" ]
+
+function! ClangComplete(findstart, base)
+   if a:findstart == 1
+      " In findstart mode, look for the beginning of the current identifier.
+      let l:line = getline('.')
+      let l:start = col('.') - 1
+      while l:start > 0 && l:line[l:start - 1] =~ '\i'
+         let l:start -= 1
+      endwhile
+      return l:start
+   endif
+
+   " Get the current line and column numbers.
+   let l:l = line('.')
+   let l:c = col('.')
+
+   " Build a clang commandline to do code completion on stdin.
+   let l:the_command = shellescape(g:clang_path) .
+                     \ " -cc1 -code-completion-at=-:" . l:l . ":" . l:c
+   for l:opt in g:clang_opts
+      let l:the_command .= " " . shellescape(l:opt)
+   endfor
+
+   " Copy the contents of the current buffer into a string for stdin.
+   " TODO: The extra space at the end is for working around clang's
+   " apparent inability to do code completion at the very end of the
+   " input.
+   " TODO: Is it better to feed clang the entire file instead of truncating
+   " it at the current line?
+   let l:process_input = join(getline(1, l:l), "\n") . " "
+
+   " Run it!
+   let l:input_lines = split(system(l:the_command, l:process_input), "\n")
+
+   " Parse the output.
+   for l:input_line in l:input_lines
+      " Vim's substring operator is annoyingly inconsistent with python's.
+      if l:input_line[:11] == 'COMPLETION: '
+         let l:value = l:input_line[12:]
+
+        " Chop off anything after " : ", if present, and move it to the menu.
+        let l:menu = ""
+        let l:spacecolonspace = stridx(l:value, " : ")
+        if l:spacecolonspace != -1
+           let l:menu = l:value[l:spacecolonspace+3:]
+           let l:value = l:value[:l:spacecolonspace-1]
+        endif
+
+        " Chop off " (Hidden)", if present, and move it to the menu.
+        let l:hidden = stridx(l:value, " (Hidden)")
+        if l:hidden != -1
+           let l:menu .= " (Hidden)"
+           let l:value = l:value[:l:hidden-1]
+        endif
+
+        " Handle "Pattern". TODO: Make clang less weird.
+        if l:value == "Pattern"
+           let l:value = l:menu
+           let l:pound = stridx(l:value, "#")
+           " Truncate the at the first [#, <#, or {#.
+           if l:pound != -1
+              let l:value = l:value[:l:pound-2]
+           endif
+        endif
+
+         " Filter out results which don't match the base string.
+         if a:base != ""
+            if l:value[:strlen(a:base)-1] != a:base
+               continue
+            end
+         endif
+
+        " TODO: Don't dump the raw input into info, though it's nice for now.
+        " TODO: The kind string?
+        let l:item = {
+          \ "word": l:value,
+          \ "menu": l:menu,
+          \ "info": l:input_line,
+          \ "dup": 1 }
+
+        " Report a result.
+        if complete_add(l:item) == 0
+           return []
+        endif
+        if complete_check()
+           return []
+        endif
+
+      elseif l:input_line[:9] == "OVERLOAD: "
+         " An overload candidate. Use a crazy hack to get vim to
+         " display the results. TODO: Make this better.
+         let l:value = l:input_line[10:]
+         let l:item = {
+           \ "word": " ",
+           \ "menu": l:value,
+           \ "info": l:input_line,
+           \ "dup": 1}
+
+        " Report a result.
+        if complete_add(l:item) == 0
+           return []
+        endif
+        if complete_check()
+           return []
+        endif
+
+      endif
+   endfor
+
+
+   return []
+endfunction ClangComplete
+
+" This to enables the somewhat-experimental clang-based
+" autocompletion support.
+set omnifunc=ClangComplete





More information about the llvm-branch-commits mailing list