[llvm-commits] [llvm] r53163 [7/7] - in /llvm/branches/non-call-eh: ./ autoconf/ bindings/ocaml/llvm/ docs/ docs/CommandGuide/ docs/tutorial/ examples/BrainF/ examples/Fibonacci/ examples/HowToUseJIT/ examples/ModuleMaker/ examples/ParallelJIT/ include/llvm-c/ include/llvm/ include/llvm/ADT/ include/llvm/Analysis/ include/llvm/Bitcode/ include/llvm/CodeGen/ include/llvm/Debugger/ include/llvm/ExecutionEngine/ include/llvm/Support/ include/llvm/System/ include/llvm/Target/ include/llvm/Transforms/ include/llvm/Transform...

Nick Lewycky nicholas at mxc.ca
Sun Jul 6 13:45:51 PDT 2008


Modified: llvm/branches/non-call-eh/test/Other/invalid-commandline-option.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Other/invalid-commandline-option.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Other/invalid-commandline-option.ll (original)
+++ llvm/branches/non-call-eh/test/Other/invalid-commandline-option.ll Sun Jul  6 15:45:41 2008
@@ -1,3 +1,3 @@
-; RUN: llvm-as < /dev/null | not opt --foo > /dev/null
+; RUN: llvm-as < /dev/null | not opt --foo >& /dev/null
 
 ; there is no --foo

Modified: llvm/branches/non-call-eh/test/Scripts/count
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Scripts/count?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Scripts/count (original)
+++ llvm/branches/non-call-eh/test/Scripts/count Sun Jul  6 15:45:41 2008
@@ -9,7 +9,7 @@
 
 set -e
 set -u
-input_lines=$(wc -l)
+input_lines=`wc -l`
 if [ "$input_lines" -ne "$1" ]; then
   echo "count: expected $1 lines and got ${input_lines}."
   exit 1

Modified: llvm/branches/non-call-eh/test/TableGen/BitsInitOverflow.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/TableGen/BitsInitOverflow.td?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/TableGen/BitsInitOverflow.td (original)
+++ llvm/branches/non-call-eh/test/TableGen/BitsInitOverflow.td Sun Jul  6 15:45:41 2008
@@ -1,4 +1,4 @@
-// RUN: not tblgen %s
+// RUN: not tblgen %s 2> /dev/null
 
 def {
   bits<2> X = 5;  // bitfield is too small, reject

Modified: llvm/branches/non-call-eh/test/TableGen/UnterminatedComment.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/TableGen/UnterminatedComment.td?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/TableGen/UnterminatedComment.td (original)
+++ llvm/branches/non-call-eh/test/TableGen/UnterminatedComment.td Sun Jul  6 15:45:41 2008
@@ -1,4 +1,4 @@
-// RUN: not tblgen < %s
+// RUN: not tblgen < %s >& /dev/null
 
 def x;
 

Removed: llvm/branches/non-call-eh/test/Transforms/ADCE/2003-12-19-MergeReturn.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/ADCE/2003-12-19-MergeReturn.ll?rev=53162&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/ADCE/2003-12-19-MergeReturn.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/ADCE/2003-12-19-MergeReturn.ll (removed)
@@ -1,27 +0,0 @@
-; This testcase was failing because without merging the return blocks, ADCE
-; didn't know that it could get rid of the then.0 block.
-
-; RUN: llvm-as < %s | opt -adce | llvm-dis | not grep load
-
-
-define void @main(i32 %argc, i8** %argv) {
-entry:
-        call void @__main( )
-        %tmp.1 = icmp ule i32 %argc, 5          ; <i1> [#uses=1]
-        br i1 %tmp.1, label %then.0, label %return
-
-then.0:         ; preds = %entry
-        %tmp.8 = load i8** %argv                ; <i8*> [#uses=1]
-        %tmp.10 = load i8* %tmp.8               ; <i8> [#uses=1]
-        %tmp.11 = icmp eq i8 %tmp.10, 98                ; <i1> [#uses=1]
-        br i1 %tmp.11, label %then.1, label %return
-
-then.1:         ; preds = %then.0
-        ret void
-
-return:         ; preds = %then.0, %entry
-        ret void
-}
-
-declare void @__main()
-

Removed: llvm/branches/non-call-eh/test/Transforms/ADCE/2007-07-23-InfiniteLoop.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/ADCE/2007-07-23-InfiniteLoop.ll?rev=53162&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/ADCE/2007-07-23-InfiniteLoop.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/ADCE/2007-07-23-InfiniteLoop.ll (removed)
@@ -1,14 +0,0 @@
-; RUN: llvm-as < %s |   opt -adce | llvm-dis | grep switch
-; PR 1564
-; XFAIL: *
-  
-define fastcc void @out() {
-    start:
-            br label %loop
-    unreachable:
-            unreachable
-    loop:
-            switch i32 0, label %unreachable [
-                     i32 0, label %loop
-            ]
-}

Removed: llvm/branches/non-call-eh/test/Transforms/ADCE/adcetest.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/ADCE/adcetest.ll?rev=53162&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/ADCE/adcetest.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/ADCE/adcetest.ll (removed)
@@ -1,36 +0,0 @@
-; This is the test case taken from Appel's book that illustrates a hard case
-; that SCCP gets right, and when followed by ADCE, is completely eliminated
-;
-; RUN: llvm-as < %s | opt -sccp -adce -simplifycfg | llvm-dis | not grep br
-
-define i32 @"test function"(i32 %i0, i32 %j0) {
-BB1:
-        br label %BB2
-
-BB2:            ; preds = %BB7, %BB1
-        %j2 = phi i32 [ %j4, %BB7 ], [ 1, %BB1 ]                ; <i32> [#uses=2]
-        %k2 = phi i32 [ %k4, %BB7 ], [ 0, %BB1 ]                ; <i32> [#uses=4]
-        %kcond = icmp slt i32 %k2, 100          ; <i1> [#uses=1]
-        br i1 %kcond, label %BB3, label %BB4
-
-BB3:            ; preds = %BB2
-        %jcond = icmp slt i32 %j2, 20           ; <i1> [#uses=1]
-        br i1 %jcond, label %BB5, label %BB6
-
-BB4:            ; preds = %BB2
-        ret i32 %j2
-
-BB5:            ; preds = %BB3
-        %k3 = add i32 %k2, 1            ; <i32> [#uses=1]
-        br label %BB7
-
-BB6:            ; preds = %BB3
-        %k5 = add i32 %k2, 1            ; <i32> [#uses=1]
-        br label %BB7
-
-BB7:            ; preds = %BB6, %BB5
-        %j4 = phi i32 [ 1, %BB5 ], [ %k2, %BB6 ]                ; <i32> [#uses=1]
-        %k4 = phi i32 [ %k3, %BB5 ], [ %k5, %BB6 ]              ; <i32> [#uses=1]
-        br label %BB2
-}
-

Removed: llvm/branches/non-call-eh/test/Transforms/ADCE/dead-phi-edge.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/ADCE/dead-phi-edge.ll?rev=53162&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/ADCE/dead-phi-edge.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/ADCE/dead-phi-edge.ll (removed)
@@ -1,17 +0,0 @@
-; RUN: llvm-as < %s | opt -adce | llvm-dis | not grep call
-
-; The call is not live just because the PHI uses the call retval!
-
-define i32 @test(i32 %X) {
-; <label>:0
-        br label %Done
-
-DeadBlock:              ; No predecessors!
-        %Y = call i32 @test( i32 0 )            ; <i32> [#uses=1]
-        br label %Done
-
-Done:           ; preds = %DeadBlock, %0
-        %Z = phi i32 [ %X, %0 ], [ %Y, %DeadBlock ]             ; <i32> [#uses=1]
-        ret i32 %Z
-}
-

Modified: llvm/branches/non-call-eh/test/Transforms/ADCE/dg.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/ADCE/dg.exp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/ADCE/dg.exp (original)
+++ llvm/branches/non-call-eh/test/Transforms/ADCE/dg.exp Sun Jul  6 15:45:41 2008
@@ -1,3 +1,3 @@
 load_lib llvm.exp
 
-RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]

Modified: llvm/branches/non-call-eh/test/Transforms/ArgumentPromotion/aggregate-promote.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/ArgumentPromotion/aggregate-promote.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/ArgumentPromotion/aggregate-promote.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/ArgumentPromotion/aggregate-promote.ll Sun Jul  6 15:45:41 2008
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -argpromotion -instcombine | not grep load
+; RUN: llvm-as < %s | opt -argpromotion -instcombine | llvm-dis | not grep load
 
 %QuadTy = type { i32, i32, i32, i32 }
 @G = constant %QuadTy {

Modified: llvm/branches/non-call-eh/test/Transforms/ArgumentPromotion/control-flow.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/ArgumentPromotion/control-flow.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/ArgumentPromotion/control-flow.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/ArgumentPromotion/control-flow.ll Sun Jul  6 15:45:41 2008
@@ -1,5 +1,5 @@
 ; RUN: llvm-as < %s | opt -argpromotion | llvm-dis | \
-; RUN:    not grep {load int\* null}
+; RUN:    not grep {load i32\* null}
 
 define internal i32 @callee(i1 %C, i32* %P) {
         br i1 %C, label %T, label %F

Modified: llvm/branches/non-call-eh/test/Transforms/ArgumentPromotion/dg.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/ArgumentPromotion/dg.exp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/ArgumentPromotion/dg.exp (original)
+++ llvm/branches/non-call-eh/test/Transforms/ArgumentPromotion/dg.exp Sun Jul  6 15:45:41 2008
@@ -1,3 +1,3 @@
 load_lib llvm.exp
 
-RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]

Modified: llvm/branches/non-call-eh/test/Transforms/BlockPlacement/basictest.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/BlockPlacement/basictest.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/BlockPlacement/basictest.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/BlockPlacement/basictest.ll Sun Jul  6 15:45:41 2008
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -block-placement -disable-output -print
+; RUN: llvm-as < %s | opt -block-placement -disable-output -print 2> /dev/null
 
 define i32 @test() {
         br i1 true, label %X, label %Y

Modified: llvm/branches/non-call-eh/test/Transforms/BlockPlacement/dg.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/BlockPlacement/dg.exp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/BlockPlacement/dg.exp (original)
+++ llvm/branches/non-call-eh/test/Transforms/BlockPlacement/dg.exp Sun Jul  6 15:45:41 2008
@@ -1,3 +1,3 @@
 load_lib llvm.exp
 
-RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]

Modified: llvm/branches/non-call-eh/test/Transforms/CodeExtractor/dg.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/CodeExtractor/dg.exp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/CodeExtractor/dg.exp (original)
+++ llvm/branches/non-call-eh/test/Transforms/CodeExtractor/dg.exp Sun Jul  6 15:45:41 2008
@@ -1,3 +1,3 @@
 load_lib llvm.exp
 
-RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]

Modified: llvm/branches/non-call-eh/test/Transforms/ConstProp/dg.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/ConstProp/dg.exp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/ConstProp/dg.exp (original)
+++ llvm/branches/non-call-eh/test/Transforms/ConstProp/dg.exp Sun Jul  6 15:45:41 2008
@@ -1,3 +1,3 @@
 load_lib llvm.exp
 
-RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]

Modified: llvm/branches/non-call-eh/test/Transforms/ConstantMerge/dg.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/ConstantMerge/dg.exp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/ConstantMerge/dg.exp (original)
+++ llvm/branches/non-call-eh/test/Transforms/ConstantMerge/dg.exp Sun Jul  6 15:45:41 2008
@@ -1,3 +1,3 @@
 load_lib llvm.exp
 
-RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]

Modified: llvm/branches/non-call-eh/test/Transforms/DeadArgElim/2007-12-20-ParamAttrs.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/DeadArgElim/2007-12-20-ParamAttrs.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/DeadArgElim/2007-12-20-ParamAttrs.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/DeadArgElim/2007-12-20-ParamAttrs.ll Sun Jul  6 15:45:41 2008
@@ -1,8 +1,9 @@
-; RUN: llvm-as < %s | opt -deadargelim | llvm-dis | grep nounwind | count 2
-; RUN: llvm-as < %s | opt -deadargelim | llvm-dis | grep signext | count 2
-; RUN: llvm-as < %s | opt -deadargelim | llvm-dis | not grep inreg
-; RUN: llvm-as < %s | opt -deadargelim | llvm-dis | not grep zeroext
-; RUN: llvm-as < %s | opt -deadargelim | llvm-dis | not grep byval
+; RUN: llvm-as < %s | opt -deadargelim | llvm-dis > %t
+; RUN: cat %t | grep nounwind | count 2
+; RUN: cat %t | grep signext | count 2
+; RUN: cat %t | not grep inreg
+; RUN: cat %t | not grep zeroext
+; RUN: cat %t | not grep byval
 
 	%struct = type { }
 

Added: llvm/branches/non-call-eh/test/Transforms/DeadArgElim/2008-06-23-DeadAfterLive.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/DeadArgElim/2008-06-23-DeadAfterLive.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/DeadArgElim/2008-06-23-DeadAfterLive.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/DeadArgElim/2008-06-23-DeadAfterLive.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,23 @@
+; RUN: llvm-as < %s | opt -deadargelim -die | llvm-dis > %t
+; RUN: cat %t | grep 123
+
+; This test tries to catch wrongful removal of return values for a specific case
+; that was break llvm-gcc builds.
+
+; This function has a live return value, it is used by @alive.
+define internal i32 @test5() {
+  ret i32 123 
+}
+
+; This function doesn't use the return value @test5 and tries to lure DAE into
+; marking @test5's return value dead because only this call is unused.
+define i32 @dead() {
+  %DEAD = call i32 @test5()
+  ret i32 0
+}
+
+; This function ensures the retval of @test5 is live.
+define i32 @alive() {
+  %LIVE = call i32 @test5()
+  ret i32 %LIVE
+}

Modified: llvm/branches/non-call-eh/test/Transforms/DeadArgElim/deadretval2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/DeadArgElim/deadretval2.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/DeadArgElim/deadretval2.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/DeadArgElim/deadretval2.ll Sun Jul  6 15:45:41 2008
@@ -1,4 +1,6 @@
-; RUN: llvm-as < %s | opt -deadargelim -die | llvm-dis | not grep DEAD
+; RUN: llvm-as < %s | opt -deadargelim -die | llvm-dis > %t
+; RUN: cat %t | not grep DEAD
+; RUN: cat %t | grep LIVE | count 4
 
 @P = external global i32                ; <i32*> [#uses=1]
 
@@ -31,3 +33,27 @@
         %DEAD2 = call i32 @id( i32 %DEAD )              ; <i32> [#uses=0]
         ret void
 }
+
+; These test if returning another functions return value properly marks that
+; other function's return value as live. We do this twice, with the functions in
+; different orders (ie, first the caller, than the callee and first the callee
+; and then the caller) since DAE processes functions one by one and handles
+; these cases slightly different.
+
+define internal i32 @test5() {
+  ret i32 123 
+}
+
+define i32 @test6() {
+  %LIVE = call i32 @test5()
+  ret i32 %LIVE
+}
+
+define i32 @test7() {
+  %LIVE = call i32 @test8()
+  ret i32 %LIVE
+}
+
+define internal i32 @test8() {
+  ret i32 124
+}

Modified: llvm/branches/non-call-eh/test/Transforms/DeadArgElim/dg.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/DeadArgElim/dg.exp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/DeadArgElim/dg.exp (original)
+++ llvm/branches/non-call-eh/test/Transforms/DeadArgElim/dg.exp Sun Jul  6 15:45:41 2008
@@ -1,3 +1,3 @@
 load_lib llvm.exp
 
-RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]

Added: llvm/branches/non-call-eh/test/Transforms/DeadArgElim/keepalive.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/DeadArgElim/keepalive.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/DeadArgElim/keepalive.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/DeadArgElim/keepalive.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,36 @@
+; RUN: llvm-as < %s | opt -deadargelim | llvm-dis > %t
+; RUN: cat %t | grep {define internal \{  \} @test}
+; RUN: cat %t | grep {define internal \{ i32 \} @test}
+; RUN: cat %t | grep {define internal \<\{ i32, i32 \}\> @test}
+
+; Check if the pass doesn't modify anything that doesn't need changing. We feed
+; an unused argument to each function to lure it into changing _something_ about
+; the function and then changing to much.
+
+
+; This checks if the struct retval isn't changed into a void
+define internal {  } @test(i32 %DEADARG1) {
+        ret {  } {  } 
+}
+
+; This checks if the struct retval isn't removed
+define internal {i32} @test1(i32 %DEADARG1) {
+        ret { i32 } { i32 1 } 
+}
+
+; This checks if the struct doesn't get non-packed
+define internal <{ i32, i32 }> @test2(i32 %DEADARG1) {
+        ret <{ i32, i32 }> <{ i32 1, i32 2 }>
+}
+
+; We use this external function to make sure the return values don't become dead
+declare void @user({  }, { i32 }, <{ i32, i32 }>)
+
+define void @caller() {
+        %A = call {  } @test(i32 0)
+        %B = call { i32 } @test1(i32 1)
+        %C = call <{ i32, i32 }> @test2(i32 2)
+        call void @user({  } %A, { i32 } %B, <{ i32, i32 }> %C)
+        ret void
+}
+

Added: llvm/branches/non-call-eh/test/Transforms/DeadArgElim/multdeadretval.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/DeadArgElim/multdeadretval.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/DeadArgElim/multdeadretval.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/DeadArgElim/multdeadretval.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,40 @@
+; This test sees if return values (and arguments) are properly removed when they
+; are unused. All unused values are typed i16, so we can easily check. We also
+; run instcombine to fold insert/extractvalue chains and we run dce to clean up
+; any remaining dead stuff.
+; RUN: llvm-as < %s | opt -deadargelim -instcombine -dce | llvm-dis | not grep i16
+; XFAIL: *
+
+define internal {i16, i32} @test(i16 %DEADARG) {
+        %A = insertvalue {i16,i32} undef, i16 1, 0
+        %B = insertvalue {i16,i32} %A, i32 1001, 1
+        ret {i16,i32} %B
+}
+
+define internal {i32, i16} @test2() {
+        %DEAD = call i16 @test4()
+        %A = insertvalue {i32,i16} undef, i32 1, 0
+        %B = insertvalue {i32,i16} %A, i16 %DEAD, 1
+        ret {i32,i16} %B
+}
+
+define internal i32 @test3(i16 %A) {
+        %ret = call {i16, i32} @test( i16 %A )                ; <i32> [#uses=0]
+        %DEAD = extractvalue {i16, i32} %ret, 0
+        %LIVE = extractvalue {i16, i32} %ret, 1
+        ret i32 %LIVE
+}
+
+define internal i16 @test4() {
+        ret i16 0
+}
+
+define i32 @main() {
+        %ret = call {i32, i16} @test2()                ; <i32> [#uses=1]
+        %LIVE = extractvalue {i32, i16} %ret, 0
+        %DEAD = extractvalue {i32, i16} %ret, 1
+        %Y = add i32 %LIVE, -123           ; <i32> [#uses=1]
+        %LIVE2 = call i32 @test3(i16 %DEAD)                ; <i32> [#uses=1]
+        %Z = add i32 %LIVE2, %Y           ; <i32> [#uses=1]
+        ret i32 %Z
+}

Modified: llvm/branches/non-call-eh/test/Transforms/DeadStoreElimination/2004-11-28-LiveStoreDeleted.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/DeadStoreElimination/2004-11-28-LiveStoreDeleted.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/DeadStoreElimination/2004-11-28-LiveStoreDeleted.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/DeadStoreElimination/2004-11-28-LiveStoreDeleted.ll Sun Jul  6 15:45:41 2008
@@ -1,5 +1,5 @@
 ; RUN: llvm-as < %s | opt -dse -scalarrepl -instcombine | \
-; RUN:   llvm-dis | not grep {ret int undef}
+; RUN:   llvm-dis | not grep {ret i32 undef}
 
 define i32 @test(double %__x) {
         %__u = alloca { [3 x i32] }             ; <{ [3 x i32] }*> [#uses=2]

Modified: llvm/branches/non-call-eh/test/Transforms/DeadStoreElimination/dg.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/DeadStoreElimination/dg.exp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/DeadStoreElimination/dg.exp (original)
+++ llvm/branches/non-call-eh/test/Transforms/DeadStoreElimination/dg.exp Sun Jul  6 15:45:41 2008
@@ -1,3 +1,3 @@
 load_lib llvm.exp
 
-RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]

Added: llvm/branches/non-call-eh/test/Transforms/DeadStoreElimination/volatile-load.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/DeadStoreElimination/volatile-load.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/DeadStoreElimination/volatile-load.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/DeadStoreElimination/volatile-load.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,8 @@
+; RUN: llvm-as < %s | opt -dse | llvm-dis | grep {volatile load}
+
+ at g_1 = global i32 0
+
+define void @foo() nounwind  {
+	%t = volatile load i32* @g_1
+	ret void
+}

Modified: llvm/branches/non-call-eh/test/Transforms/GCSE/dg.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/GCSE/dg.exp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/GCSE/dg.exp (original)
+++ llvm/branches/non-call-eh/test/Transforms/GCSE/dg.exp Sun Jul  6 15:45:41 2008
@@ -1,3 +1,3 @@
 load_lib llvm.exp
 
-RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]

Added: llvm/branches/non-call-eh/test/Transforms/GVN/2008-07-02-Unreachable.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/GVN/2008-07-02-Unreachable.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/GVN/2008-07-02-Unreachable.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/GVN/2008-07-02-Unreachable.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,36 @@
+; RUN: llvm-as < %s | opt -gvn | llvm-dis | grep undef
+; PR2503
+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.3.0"
+ at g_3 = external global i8		; <i8*> [#uses=2]
+
+define i32 @func_1() nounwind  {
+entry:
+	br i1 false, label %ifelse, label %ifthen
+
+ifthen:		; preds = %entry
+	br label %ifend
+
+ifelse:		; preds = %entry
+	%tmp3 = load i8* @g_3		; <i8> [#uses=0]
+	br label %forcond.thread
+
+forcond.thread:		; preds = %ifelse
+	br label %afterfor
+
+forcond:		; preds = %forinc
+	br i1 false, label %afterfor, label %forbody
+
+forbody:		; preds = %forcond
+	br label %forinc
+
+forinc:		; preds = %forbody
+	br label %forcond
+
+afterfor:		; preds = %forcond, %forcond.thread
+	%tmp10 = load i8* @g_3		; <i8> [#uses=0]
+	br label %ifend
+
+ifend:		; preds = %afterfor, %ifthen
+	ret i32 0
+}

Modified: llvm/branches/non-call-eh/test/Transforms/GVN/dg.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/GVN/dg.exp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/GVN/dg.exp (original)
+++ llvm/branches/non-call-eh/test/Transforms/GVN/dg.exp Sun Jul  6 15:45:41 2008
@@ -1,3 +1,3 @@
 load_lib llvm.exp
 
-RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]

Added: llvm/branches/non-call-eh/test/Transforms/GVN/local-pre.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/GVN/local-pre.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/GVN/local-pre.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/GVN/local-pre.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,18 @@
+; RUN: llvm-as < %s | opt -gvn -enable-pre | llvm-dis | grep {b.pre}
+
+define i32 @main(i32 %p) {
+block1:
+  
+	br i1 true, label %block2, label %block3
+
+block2:
+ %a = add i32 %p, 1
+ br label %block4
+
+block3:
+  br label %block4
+
+block4:
+  %b = add i32 %p, 1
+  ret i32 %b
+}

Added: llvm/branches/non-call-eh/test/Transforms/GVN/nonlocal-cse.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/GVN/nonlocal-cse.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/GVN/nonlocal-cse.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/GVN/nonlocal-cse.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,49 @@
+; RUN: llvm-as < %s | opt -gvn | llvm-dis | 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"
+
+define i32 @test(i32 %g, i8* %P) nounwind  {
+entry:
+	%tmp2 = call i32 @strlen( i8* %P ) nounwind readonly 		; <i32> [#uses=1]
+	%tmp3 = icmp eq i32 %tmp2, 100		; <i1> [#uses=1]
+	%tmp34 = zext i1 %tmp3 to i8		; <i8> [#uses=1]
+	%toBool = icmp ne i8 %tmp34, 0		; <i1> [#uses=1]
+	br i1 %toBool, label %bb, label %bb6
+
+bb:		; preds = %entry
+	br label %bb27
+
+bb6:		; preds = %entry
+	%tmp8 = add i32 %g, 42		; <i32> [#uses=2]
+	%tmp10 = call i32 @strlen( i8* %P ) nounwind readonly 		; <i32> [#uses=1]
+	%tmp11 = icmp eq i32 %tmp10, 100		; <i1> [#uses=1]
+	%tmp1112 = zext i1 %tmp11 to i8		; <i8> [#uses=1]
+	%toBool13 = icmp ne i8 %tmp1112, 0		; <i1> [#uses=1]
+	br i1 %toBool13, label %bb14, label %bb16
+
+bb14:		; preds = %bb6
+	br label %bb27
+
+bb16:		; preds = %bb6
+	%tmp18 = mul i32 %tmp8, 2		; <i32> [#uses=1]
+	%tmp20 = call i32 @strlen( i8* %P ) nounwind readonly 		; <i32> [#uses=1]
+	%tmp21 = icmp eq i32 %tmp20, 100		; <i1> [#uses=1]
+	%tmp2122 = zext i1 %tmp21 to i8		; <i8> [#uses=1]
+	%toBool23 = icmp ne i8 %tmp2122, 0		; <i1> [#uses=1]
+	br i1 %toBool23, label %bb24, label %bb26
+
+bb24:		; preds = %bb16
+	br label %bb27
+
+bb26:		; preds = %bb16
+	br label %bb27
+
+bb27:		; preds = %bb26, %bb24, %bb14, %bb
+	%tmp.0 = phi i32 [ 11, %bb26 ], [ %tmp18, %bb24 ], [ %tmp8, %bb14 ], [ %g, %bb ]		; <i32> [#uses=1]
+	br label %return
+
+return:		; preds = %bb27
+	ret i32 %tmp.0
+}
+
+declare i32 @strlen(i8*) nounwind readonly 

Modified: llvm/branches/non-call-eh/test/Transforms/GVNPRE/dg.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/GVNPRE/dg.exp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/GVNPRE/dg.exp (original)
+++ llvm/branches/non-call-eh/test/Transforms/GVNPRE/dg.exp Sun Jul  6 15:45:41 2008
@@ -1,3 +1,3 @@
 load_lib llvm.exp
 
-RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]

Modified: llvm/branches/non-call-eh/test/Transforms/GlobalDCE/dg.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/GlobalDCE/dg.exp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/GlobalDCE/dg.exp (original)
+++ llvm/branches/non-call-eh/test/Transforms/GlobalDCE/dg.exp Sun Jul  6 15:45:41 2008
@@ -1,3 +1,3 @@
 load_lib llvm.exp
 
-RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]

Added: llvm/branches/non-call-eh/test/Transforms/GlobalOpt/2008-04-26-SROA-Global-Align.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/GlobalOpt/2008-04-26-SROA-Global-Align.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/GlobalOpt/2008-04-26-SROA-Global-Align.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/GlobalOpt/2008-04-26-SROA-Global-Align.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,32 @@
+; Verify that when @G is SROA'd that the new globals have correct 
+; alignments.  Elements 0 and 2 must be 16-byte aligned, and element 
+; 1 must be at least 8 byte aligned (but could be more). 
+
+; RUN: llvm-as < %s | opt -globalopt | llvm-dis | grep {@G.0 = internal global .*align 16}
+; RUN: llvm-as < %s | opt -globalopt | llvm-dis | grep {@G.1 = internal global .*align 8}
+; RUN: llvm-as < %s | opt -globalopt | llvm-dis | grep {@G.2 = internal global .*align 16}
+; rdar://5891920
+
+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:32:32-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
+target triple = "x86_64-apple-darwin8"
+
+%T = type { double, double, double }
+
+ at G = internal global %T zeroinitializer, align 16
+
+
+define void @test() {
+  store double 1.0, double* getelementptr (%T* @G, i32 0, i32 0), align 16
+  store double 2.0, double* getelementptr (%T* @G, i32 0, i32 1), align 8
+  store double 3.0, double* getelementptr (%T* @G, i32 0, i32 2), align 16
+  ret void
+}
+
+define double @test2() {
+  %V1 = load double* getelementptr (%T* @G, i32 0, i32 0), align 16
+  %V2 = load double* getelementptr (%T* @G, i32 0, i32 1), align 8
+  %V3 = load double* getelementptr (%T* @G, i32 0, i32 2), align 16
+  %R = add double %V1, %V2
+  %R2 = add double %R, %V3
+  ret double %R2
+}

Modified: llvm/branches/non-call-eh/test/Transforms/GlobalOpt/dg.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/GlobalOpt/dg.exp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/GlobalOpt/dg.exp (original)
+++ llvm/branches/non-call-eh/test/Transforms/GlobalOpt/dg.exp Sun Jul  6 15:45:41 2008
@@ -1,3 +1,3 @@
 load_lib llvm.exp
 
-RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]

Added: llvm/branches/non-call-eh/test/Transforms/IPConstantProp/2008-06-09-WeakProp.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/IPConstantProp/2008-06-09-WeakProp.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/IPConstantProp/2008-06-09-WeakProp.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/IPConstantProp/2008-06-09-WeakProp.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,15 @@
+; RUN: llvm-as < %s | opt -ipconstprop | llvm-dis | grep {ret i32 %r}
+; Should not propagate the result of a weak function.
+; PR2411
+
+define weak i32 @foo() nounwind  {
+entry:
+        ret i32 1
+}
+
+define i32 @main() nounwind  {
+entry:
+        %r = call i32 @foo( ) nounwind
+        ret i32 %r
+}
+

Modified: llvm/branches/non-call-eh/test/Transforms/IPConstantProp/dg.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/IPConstantProp/dg.exp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/IPConstantProp/dg.exp (original)
+++ llvm/branches/non-call-eh/test/Transforms/IPConstantProp/dg.exp Sun Jul  6 15:45:41 2008
@@ -1,3 +1,3 @@
 load_lib llvm.exp
 
-RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]

Added: llvm/branches/non-call-eh/test/Transforms/IPConstantProp/return-argument.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/IPConstantProp/return-argument.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/IPConstantProp/return-argument.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/IPConstantProp/return-argument.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,49 @@
+; RUN: llvm-as < %s | opt -ipconstprop | llvm-dis > %t
+; RUN: cat %t | grep {store i32 %Z, i32\\* %Q}
+; RUN: cat %t | grep {add i32 1, 3}
+
+;; This function returns its second argument on all return statements
+define internal i32* @incdec(i1 %C, i32* %V) {
+        %X = load i32* %V
+        br i1 %C, label %T, label %F
+
+T:              ; preds = %0
+        %X1 = add i32 %X, 1
+        store i32 %X1, i32* %V
+        ret i32* %V
+
+F:              ; preds = %0
+        %X2 = sub i32 %X, 1
+        store i32 %X2, i32* %V
+        ret i32* %V
+}
+
+;; This function returns its first argument as a part of a multiple return
+;; value
+define internal { i32, i32 } @foo(i32 %A, i32 %B) {
+        %X = add i32 %A, %B
+        %Y = insertvalue { i32, i32 } undef, i32 %A, 0
+        %Z = insertvalue { i32, i32 } %Y, i32 %X, 1
+        ret { i32, i32 } %Z
+}
+
+define void @caller(i1 %C) {
+        %Q = alloca i32
+        ;; Call incdec to see if %W is properly replaced by %Q
+        %W = call i32* @incdec(i1 %C, i32* %Q )             ; <i32> [#uses=1]
+        ;; Call @foo twice, to prevent the arguments from propagating into the
+        ;; function (so we can check the returned argument is properly
+        ;; propagated per-caller).
+        %S1 = call { i32, i32 } @foo(i32 1, i32 2);
+        %X1 = extractvalue { i32, i32 } %S1, 0
+        %S2 = invoke { i32, i32 } @foo(i32 3, i32 4) to label %OK unwind label %RET;
+OK:
+        %X2 = extractvalue { i32, i32 } %S2, 0
+        ;; Do some stuff with the returned values which we can grep for
+        %Z  = add i32 %X1, %X2
+        store i32 %Z, i32* %W
+        br label %RET
+RET:
+        ret void
+}
+

Modified: llvm/branches/non-call-eh/test/Transforms/IPConstantProp/return-constant.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/IPConstantProp/return-constant.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/IPConstantProp/return-constant.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/IPConstantProp/return-constant.ll Sun Jul  6 15:45:41 2008
@@ -1,5 +1,5 @@
 ; RUN: llvm-as < %s | opt -ipconstprop -instcombine | \
-; RUN:    llvm-dis | grep {ret i1 true}
+; RUN:    llvm-dis | grep {ret i1 true} | count 2
 define internal i32 @foo(i1 %C) {
         br i1 %C, label %T, label %F
 
@@ -16,3 +16,11 @@
         ret i1 %Y
 }
 
+define i1 @invokecaller(i1 %C) {
+        %X = invoke i32 @foo( i1 %C ) to label %OK unwind label %FAIL             ; <i32> [#uses=1]
+OK:
+        %Y = icmp ne i32 %X, 0          ; <i1> [#uses=1]
+        ret i1 %Y 
+FAIL:
+        ret i1 false
+}

Modified: llvm/branches/non-call-eh/test/Transforms/IPConstantProp/return-constants.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/IPConstantProp/return-constants.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/IPConstantProp/return-constants.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/IPConstantProp/return-constants.ll Sun Jul  6 15:45:41 2008
@@ -1,20 +1,41 @@
-; RUN: llvm-as < %s | opt -ipconstprop | llvm-dis | grep {add i32 21, 21}
+; RUN: llvm-as < %s | opt -ipconstprop | llvm-dis > %t
+;; Check that the 21 constants got propagated properly
+; RUN: cat %t | grep {%M = add i32 21, 21}
+;; Check that the second return values didn't get propagated
+; RUN: cat %t | grep {%N = add i32 %B, %D}
 
-define internal {i32, i32} @foo(i1 %C) {
-        br i1 %C, label %T, label %F
+define internal {i32, i32} @foo(i1 %Q) {
+        br i1 %Q, label %T, label %F
 
 T:              ; preds = %0
-        ret i32 21, i32 21
+        ret i32 21, i32 22
 
 F:              ; preds = %0
-        ret i32 21, i32 21
+        ret i32 21, i32 23
 }
 
-define i32 @caller(i1 %C) {
-        %X = call {i32, i32} @foo( i1 %C )
+define internal {i32, i32} @bar(i1 %Q) {
+        %A = insertvalue { i32, i32 } undef, i32 21, 0
+        br i1 %Q, label %T, label %F
+
+T:              ; preds = %0
+        %B = insertvalue { i32, i32 } %A, i32 22, 1
+        ret { i32, i32 } %B
+
+F:              ; preds = %0
+        %C = insertvalue { i32, i32 } %A, i32 23, 1
+        ret { i32, i32 } %C
+}
+
+define { i32, i32 } @caller(i1 %Q) {
+        %X = call {i32, i32} @foo( i1 %Q )
         %A = getresult {i32, i32} %X, 0
         %B = getresult {i32, i32} %X, 1
-        %Y = add i32 %A, %B
-        ret i32 %Y
+        %Y = call {i32, i32} @bar( i1 %Q )
+        %C = extractvalue {i32, i32} %Y, 0
+        %D = extractvalue {i32, i32} %Y, 1
+        %M = add i32 %A, %C
+        %N = add i32 %B, %D
+        ret { i32, i32 } %X
 }
 

Modified: llvm/branches/non-call-eh/test/Transforms/IndVarsSimplify/2003-12-21-IndVarSize.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/IndVarsSimplify/2003-12-21-IndVarSize.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/IndVarsSimplify/2003-12-21-IndVarSize.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/IndVarsSimplify/2003-12-21-IndVarSize.ll Sun Jul  6 15:45:41 2008
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars | llvm-dis | grep indvar | not grep uint
+; RUN: llvm-as < %s | opt -indvars | llvm-dis | grep indvar | not grep i32
 
 @G = global i64 0               ; <i64*> [#uses=1]
 

Modified: llvm/branches/non-call-eh/test/Transforms/IndVarsSimplify/2004-04-05-InvokeCastCrash.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/IndVarsSimplify/2004-04-05-InvokeCastCrash.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/IndVarsSimplify/2004-04-05-InvokeCastCrash.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/IndVarsSimplify/2004-04-05-InvokeCastCrash.ll Sun Jul  6 15:45:41 2008
@@ -1,5 +1,5 @@
 ; RUN: llvm-as < %s | opt -indvars -disable-output
-; ModuleID = '2004-04-05-InvokeCastCrash.llx'
+; ModuleID = '2004-04-05-InvokeCastCrash.ll'
 	%struct.__false_type = type { i8 }
 	%"struct.__gnu_cxx::_Hashtable_node<const llvm::Constant*>" = type { %"struct.__gnu_cxx::_Hashtable_node<const llvm::Constant*>"*, %"struct.llvm::Constant"* }
 	%"struct.__gnu_cxx::_Hashtable_node<std::pair<const llvm::Value* const, int> >" = type { %"struct.__gnu_cxx::_Hashtable_node<std::pair<const llvm::Value* const, int> >"*, %"struct.std::pair<const llvm::Value* const,int>" }

Added: llvm/branches/non-call-eh/test/Transforms/IndVarsSimplify/2008-06-15-SCEVExpanderBug.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/IndVarsSimplify/2008-06-15-SCEVExpanderBug.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/IndVarsSimplify/2008-06-15-SCEVExpanderBug.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/IndVarsSimplify/2008-06-15-SCEVExpanderBug.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,17 @@
+; RUN: llvm-as < %s | opt -indvars -disable-output
+; PR2434
+
+define fastcc void @regcppop() nounwind  {
+entry:
+	%tmp61 = add i32 0, -5		; <i32> [#uses=1]
+	br label %bb
+
+bb:		; preds = %bb, %entry
+	%PL_savestack_ix.tmp.0 = phi i32 [ %tmp61, %entry ], [ %tmp127, %bb ]		; <i32> [#uses=2]
+	%indvar10 = phi i32 [ 0, %entry ], [ %indvar.next11, %bb ]		; <i32> [#uses=2]
+	%tmp13 = mul i32 %indvar10, -4		; <i32> [#uses=0]
+	%tmp111 = add i32 %PL_savestack_ix.tmp.0, -3		; <i32> [#uses=0]
+	%tmp127 = add i32 %PL_savestack_ix.tmp.0, -4		; <i32> [#uses=1]
+	%indvar.next11 = add i32 %indvar10, 1		; <i32> [#uses=1]
+	br label %bb
+}

Modified: llvm/branches/non-call-eh/test/Transforms/IndVarsSimplify/dg.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/IndVarsSimplify/dg.exp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/IndVarsSimplify/dg.exp (original)
+++ llvm/branches/non-call-eh/test/Transforms/IndVarsSimplify/dg.exp Sun Jul  6 15:45:41 2008
@@ -1,3 +1,3 @@
 load_lib llvm.exp
 
-RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]

Modified: llvm/branches/non-call-eh/test/Transforms/IndVarsSimplify/exit_value_tests.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/IndVarsSimplify/exit_value_tests.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/IndVarsSimplify/exit_value_tests.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/IndVarsSimplify/exit_value_tests.ll Sun Jul  6 15:45:41 2008
@@ -2,7 +2,7 @@
 ; these loops all have predictable exit values we can replace the use outside
 ; of the loop with a closed-form computation, making the loop dead.
 ;
-; RUN: llvm-as < %s | opt -indvars -adce -simplifycfg | \
+; RUN: llvm-as < %s | opt -indvars -loop-deletion -simplifycfg | \
 ; RUN:   llvm-dis | not grep br
 
 define i32 @polynomial_constant() {

Modified: llvm/branches/non-call-eh/test/Transforms/IndVarsSimplify/loop_evaluate_1.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/IndVarsSimplify/loop_evaluate_1.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/IndVarsSimplify/loop_evaluate_1.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/IndVarsSimplify/loop_evaluate_1.ll Sun Jul  6 15:45:41 2008
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars -adce -simplifycfg | llvm-dis | not grep br
+; RUN: llvm-as < %s | opt -indvars -loop-deletion -simplifycfg | llvm-dis | not grep br
 ;
 ; Testcase distilled from 256.bzip2
 

Modified: llvm/branches/non-call-eh/test/Transforms/IndVarsSimplify/loop_evaluate_2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/IndVarsSimplify/loop_evaluate_2.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/IndVarsSimplify/loop_evaluate_2.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/IndVarsSimplify/loop_evaluate_2.ll Sun Jul  6 15:45:41 2008
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars -adce -simplifycfg | opt \
+; RUN: llvm-as < %s | opt -indvars -loop-deletion -simplifycfg | opt \
 ; RUN:     -analyze -loops | not grep "^Loop Containing" 
 ; PR1179
 

Modified: llvm/branches/non-call-eh/test/Transforms/IndVarsSimplify/tripcount_compute.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/IndVarsSimplify/tripcount_compute.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/IndVarsSimplify/tripcount_compute.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/IndVarsSimplify/tripcount_compute.ll Sun Jul  6 15:45:41 2008
@@ -3,7 +3,7 @@
 ; the exit value of the loop will be for some value, allowing us to substitute
 ; it directly into users outside of the loop, making the loop dead.
 ;
-; RUN: llvm-as < %s | opt -indvars -adce -simplifycfg | llvm-dis | not grep br
+; RUN: llvm-as < %s | opt -indvars -loop-deletion -simplifycfg | llvm-dis | not grep br
 
 define i32 @linear_setne() {
 entry:

Modified: llvm/branches/non-call-eh/test/Transforms/Inline/2007-12-19-InlineNoUnwind.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/Inline/2007-12-19-InlineNoUnwind.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/Inline/2007-12-19-InlineNoUnwind.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/Inline/2007-12-19-InlineNoUnwind.ll Sun Jul  6 15:45:41 2008
@@ -1,5 +1,5 @@
-; RUN: llvm-as < %s -o - | opt -inline | llvm-dis | grep nounwind
-; RUN: llvm-as < %s -o - | opt -inline | llvm-dis | grep unreachable
+; RUN: llvm-as %s -o - | opt -inline | llvm-dis | grep nounwind
+; RUN: llvm-as %s -o - | opt -inline | llvm-dis | grep unreachable
 
 declare i1 @extern()
 

Modified: llvm/branches/non-call-eh/test/Transforms/Inline/basictest.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/Inline/basictest.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/Inline/basictest.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/Inline/basictest.ll Sun Jul  6 15:45:41 2008
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -inline -disable-output -print
+; RUN: llvm-as < %s | opt -inline -disable-output -print 2> /dev/null
 
 define i32 @func(i32 %i) {
         ret i32 %i

Modified: llvm/branches/non-call-eh/test/Transforms/Inline/dg.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/Inline/dg.exp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/Inline/dg.exp (original)
+++ llvm/branches/non-call-eh/test/Transforms/Inline/dg.exp Sun Jul  6 15:45:41 2008
@@ -1,3 +1,3 @@
 load_lib llvm.exp
 
-RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]

Modified: llvm/branches/non-call-eh/test/Transforms/Inline/inline_dce.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/Inline/inline_dce.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/Inline/inline_dce.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/Inline/inline_dce.ll Sun Jul  6 15:45:41 2008
@@ -2,7 +2,7 @@
 ; inlined into all of their callers.
 
 ; RUN: llvm-as < %s | opt -inline | llvm-dis | \
-; RUN:   not grep %reallysmall
+; RUN:   not grep @reallysmall
 
 define internal i32 @reallysmall(i32 %A) {
         ret i32 %A

Removed: llvm/branches/non-call-eh/test/Transforms/Inline/unwindto.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/Inline/unwindto.ll?rev=53162&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/Inline/unwindto.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/Inline/unwindto.ll (removed)
@@ -1,13 +0,0 @@
-; RUN: llvm-as < %s | opt -inline | llvm-dis | grep "br label %cleanup"
-
-define void @g() {
-  unwind
-}
-
-define i32 @f1() {
-entry: unwinds to %cleanup
-  call void @g()
-  ret i32 0
-cleanup:
-  ret i32 1
-}

Modified: llvm/branches/non-call-eh/test/Transforms/InstCombine/2003-11-13-ConstExprCastCall.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/2003-11-13-ConstExprCastCall.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/2003-11-13-ConstExprCastCall.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/2003-11-13-ConstExprCastCall.ll Sun Jul  6 15:45:41 2008
@@ -3,7 +3,6 @@
 declare void @free(i8*)
 
 define void @test(i32* %X) {
-        call i32 (...)* bitcast (void (i8*)* @free to i32 (...)*)( i32* %X )            ; <i32>:1 [#uses=0]
+        call void (...)* bitcast (void (i8*)* @free to void (...)*)( i32* %X )          ; <i32>:1 [#uses=0]
         ret void
 }
-

Modified: llvm/branches/non-call-eh/test/Transforms/InstCombine/2004-09-20-BadLoadCombine2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/2004-09-20-BadLoadCombine2.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/2004-09-20-BadLoadCombine2.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/2004-09-20-BadLoadCombine2.ll Sun Jul  6 15:45:41 2008
@@ -1,5 +1,5 @@
 ; RUN: llvm-as < %s | opt -instcombine -mem2reg -simplifycfg | \
-; RUN:   llvm-dis | grep -v store | not grep {int 1}
+; RUN:   llvm-dis | grep -v store | not grep {i32 1}
 
 ; Test to make sure that instcombine does not accidentally propagate the load
 ; into the PHI, which would break the program.

Modified: llvm/branches/non-call-eh/test/Transforms/InstCombine/2004-11-27-SetCCForCastLargerAndConstant.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/2004-11-27-SetCCForCastLargerAndConstant.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/2004-11-27-SetCCForCastLargerAndConstant.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/2004-11-27-SetCCForCastLargerAndConstant.ll Sun Jul  6 15:45:41 2008
@@ -9,7 +9,7 @@
 ; be eliminated. In many cases the setCC is also eliminated based on the
 ; constant value and the range of the casted value.
 ;
-; RUN: llvm-as < %s -o - | opt -instcombine | llvm-dis | \
+; RUN: llvm-as %s -o - | opt -instcombine | llvm-dis | \
 ; RUN:    notcast .*int
 ; END.
 define i1 @lt_signed_to_large_unsigned(i8 %SB) {

Modified: llvm/branches/non-call-eh/test/Transforms/InstCombine/2006-10-19-SignedToUnsignedCastAndConst-2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/2006-10-19-SignedToUnsignedCastAndConst-2.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/2006-10-19-SignedToUnsignedCastAndConst-2.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/2006-10-19-SignedToUnsignedCastAndConst-2.ll Sun Jul  6 15:45:41 2008
@@ -1,5 +1,5 @@
 ; The optimizer should be able to remove cast operation here.
-; RUN: llvm-as < %s -o - | opt -instcombine | llvm-dis | \
+; RUN: llvm-as %s -o - | opt -instcombine | llvm-dis | \
 ; RUN:    not grep sext.*i32
 
 define i1 @eq_signed_to_small_unsigned(i8 %SB) {

Modified: llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-01-06-BitCastAttributes.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-01-06-BitCastAttributes.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-01-06-BitCastAttributes.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-01-06-BitCastAttributes.ll Sun Jul  6 15:45:41 2008
@@ -1,4 +1,5 @@
-; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep bitcast
+; Ignore stderr, we expect warnings there
+; RUN: llvm-as < %s 2> /dev/null | opt -instcombine | llvm-dis | not grep bitcast
 
 define void @a() {
 	ret void

Modified: llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-01-21-MismatchedCastAndCompare.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-01-21-MismatchedCastAndCompare.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-01-21-MismatchedCastAndCompare.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-01-21-MismatchedCastAndCompare.ll Sun Jul  6 15:45:41 2008
@@ -1,5 +1,5 @@
-; RUN: llvm-as < %s | opt -instcombine | notcast
-; RUN: llvm-as < %s | opt -instcombine | not grep {icmp s}
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | notcast
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {icmp s}
 ; PR1940
 
 define i1 @test1(i8 %A, i8 %B) {

Added: llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-04-22-ByValBitcast.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-04-22-ByValBitcast.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-04-22-ByValBitcast.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-04-22-ByValBitcast.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,15 @@
+;; The bitcast cannot be eliminated because byval arguments need
+;; the correct type, or at least a type of the correct size.
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep bitcast
+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"
+	%struct.NSRect = type { [4 x float] }
+
+define void @foo(i8* %context) nounwind  {
+entry:
+	%tmp1 = bitcast i8* %context to %struct.NSRect*		; <%struct.NSRect*> [#uses=1]
+	call void (i32, ...)* @bar( i32 3, %struct.NSRect* byval align 4  %tmp1 ) nounwind 
+	ret void
+}
+
+declare void @bar(i32, ...)

Added: llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-04-28-VolatileStore.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-04-28-VolatileStore.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-04-28-VolatileStore.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-04-28-VolatileStore.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,8 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {volatile store}
+
+define void @test() {
+	%votf = alloca <4 x float>		; <<4 x float>*> [#uses=1]
+	volatile store <4 x float> zeroinitializer, <4 x float>* %votf, align 16
+	ret void
+}
+

Added: llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-04-29-VolatileLoadDontMerge.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-04-29-VolatileLoadDontMerge.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-04-29-VolatileLoadDontMerge.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-04-29-VolatileLoadDontMerge.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,25 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {volatile load} | 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-darwin8"
+ at g_1 = internal global i32 0		; <i32*> [#uses=3]
+
+define i32 @main() nounwind  {
+entry:
+	%tmp93 = icmp slt i32 0, 10		; <i1> [#uses=0]
+	%tmp34 = volatile load i32* @g_1, align 4		; <i32> [#uses=1]
+	br label %bb
+
+bb:		; preds = %bb, %entry
+	%b.0.reg2mem.0 = phi i32 [ 0, %entry ], [ %tmp6, %bb ]		; <i32> [#uses=1]
+	%tmp3.reg2mem.0 = phi i32 [ %tmp34, %entry ], [ %tmp3, %bb ]		; <i32> [#uses=1]
+	%tmp4 = add i32 %tmp3.reg2mem.0, 5		; <i32> [#uses=1]
+	volatile store i32 %tmp4, i32* @g_1, align 4
+	%tmp6 = add i32 %b.0.reg2mem.0, 1		; <i32> [#uses=2]
+	%tmp9 = icmp slt i32 %tmp6, 10		; <i1> [#uses=1]
+	%tmp3 = volatile load i32* @g_1, align 4		; <i32> [#uses=1]
+	br i1 %tmp9, label %bb, label %bb11
+
+bb11:		; preds = %bb
+	ret i32 0
+}
+

Added: llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-04-29-VolatileLoadMerge.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-04-29-VolatileLoadMerge.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-04-29-VolatileLoadMerge.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-04-29-VolatileLoadMerge.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,21 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {volatile load} | count 1
+; PR2262
+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-darwin8"
+ at g_1 = internal global i32 0		; <i32*> [#uses=3]
+
+define i32 @main(i32 %i) nounwind  {
+entry:
+	%tmp93 = icmp slt i32 %i, 10		; <i1> [#uses=0]
+	%tmp34 = volatile load i32* @g_1, align 4		; <i32> [#uses=1]
+	br i1 %tmp93, label %bb11, label %bb
+
+bb:		; preds = %bb, %entry
+	%tmp3 = volatile load i32* @g_1, align 4		; <i32> [#uses=1]
+	br label %bb11
+
+bb11:		; preds = %bb
+	%tmp4 = phi i32 [ %tmp34, %entry ], [ %tmp3, %bb ]		; <i32> [#uses=1]
+	ret i32 %tmp4
+}
+

Added: llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-05-08-LiveStoreDelete.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-05-08-LiveStoreDelete.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-05-08-LiveStoreDelete.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-05-08-LiveStoreDelete.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,25 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {store i8} | count 3
+; PR2297
+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-darwin8"
+
+define i32 @a() nounwind  {
+entry:
+	%"alloca point" = bitcast i32 0 to i32		; <i32> [#uses=0]
+	%tmp1 = call i8* @malloc( i32 10 ) nounwind 		; <i8*> [#uses=5]
+	%tmp3 = getelementptr i8* %tmp1, i32 1		; <i8*> [#uses=1]
+	store i8 0, i8* %tmp3, align 1
+	%tmp5 = getelementptr i8* %tmp1, i32 0		; <i8*> [#uses=1]
+	store i8 1, i8* %tmp5, align 1
+	%tmp7 = call i32 @strlen( i8* %tmp1 ) nounwind readonly 		; <i32> [#uses=1]
+	%tmp9 = getelementptr i8* %tmp1, i32 0		; <i8*> [#uses=1]
+	store i8 0, i8* %tmp9, align 1
+	%tmp11 = call i32 (...)* @b( i8* %tmp1 ) nounwind 		; <i32> [#uses=0]
+	ret i32 %tmp7
+}
+
+declare i8* @malloc(i32) nounwind 
+
+declare i32 @strlen(i8*) nounwind readonly 
+
+declare i32 @b(...)

Added: llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-05-08-StrLenSink.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-05-08-StrLenSink.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-05-08-StrLenSink.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-05-08-StrLenSink.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,28 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | %prcontext strlen 1 | not grep ret
+; PR2297
+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-darwin8"
+
+define i32 @a() nounwind  {
+entry:
+	%"alloca point" = bitcast i32 0 to i32		; <i32> [#uses=0]
+	%tmp1 = call i8* @malloc( i32 10 ) nounwind 		; <i8*> [#uses=5]
+	%tmp3 = getelementptr i8* %tmp1, i32 1		; <i8*> [#uses=1]
+	store i8 0, i8* %tmp3, align 1
+	%tmp5 = getelementptr i8* %tmp1, i32 0		; <i8*> [#uses=1]
+	store i8 1, i8* %tmp5, align 1
+	%tmp7 = call i32 @strlen( i8* %tmp1 ) nounwind readonly 		; <i32> [#uses=1]
+	%tmp9 = getelementptr i8* %tmp1, i32 0		; <i8*> [#uses=1]
+	store i8 0, i8* %tmp9, align 1
+	%tmp11 = call i32 (...)* @b( i8* %tmp1 ) nounwind 		; <i32> [#uses=0]
+	br label %return
+
+return:		; preds = %entry
+	ret i32 %tmp7
+}
+
+declare i8* @malloc(i32) nounwind 
+
+declare i32 @strlen(i8*) nounwind readonly 
+
+declare i32 @b(...)

Added: llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-05-09-SinkOfInvoke.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-05-09-SinkOfInvoke.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-05-09-SinkOfInvoke.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-05-09-SinkOfInvoke.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,33 @@
+; RUN: llvm-as < %s | opt -instcombine -disable-output
+; PR2303
+	%"struct.std::ctype<char>" = type { %"struct.std::locale::facet", i32*, i8, i32*, i32*, i16*, i8, [256 x i8], [256 x i8], i8 }
+	%"struct.std::locale::facet" = type { i32 (...)**, i32 }
+
+declare i32* @_ZNSt6locale5facet15_S_get_c_localeEv()
+
+declare i32** @__ctype_toupper_loc() readnone 
+
+declare i32** @__ctype_tolower_loc() readnone 
+
+define void @_ZNSt5ctypeIcEC2EPiPKtbm(%"struct.std::ctype<char>"* %this, i32* %unnamed_arg, i16* %__table, i8 zeroext  %__del, i64 %__refs) {
+entry:
+	%tmp8 = invoke i32* @_ZNSt6locale5facet15_S_get_c_localeEv( )
+			to label %invcont unwind label %lpad		; <i32*> [#uses=0]
+
+invcont:		; preds = %entry
+	%tmp32 = invoke i32** @__ctype_toupper_loc( ) readnone 
+			to label %invcont31 unwind label %lpad		; <i32**> [#uses=0]
+
+invcont31:		; preds = %invcont
+	%tmp38 = invoke i32** @__ctype_tolower_loc( ) readnone 
+			to label %invcont37 unwind label %lpad		; <i32**> [#uses=1]
+
+invcont37:		; preds = %invcont31
+	%tmp39 = load i32** %tmp38, align 8		; <i32*> [#uses=1]
+	%tmp41 = getelementptr %"struct.std::ctype<char>"* %this, i32 0, i32 4		; <i32**> [#uses=1]
+	store i32* %tmp39, i32** %tmp41, align 8
+	ret void
+
+lpad:		; preds = %invcont31, %invcont, %entry
+	unreachable
+}

Added: llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-05-17-InfLoop.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-05-17-InfLoop.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-05-17-InfLoop.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-05-17-InfLoop.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,23 @@
+; RUN: llvm-as < %s | opt -instcombine -disable-output
+; PR2339
+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-s0:0:64-f80:32:32"
+target triple = "i686-pc-linux-gnu"
+
+declare void @BZALLOC(i32)
+
+define void @f(i32) {
+entry:
+	%blockSize100k = alloca i32		; <i32*> [#uses=2]
+	store i32 %0, i32* %blockSize100k
+	%n = alloca i32		; <i32*> [#uses=2]
+	load i32* %blockSize100k		; <i32>:1 [#uses=1]
+	store i32 %1, i32* %n
+	load i32* %n		; <i32>:2 [#uses=1]
+	add i32 %2, 2		; <i32>:3 [#uses=1]
+	mul i32 %3, ptrtoint (i32* getelementptr (i32* null, i32 1) to i32)		; <i32>:4 [#uses=1]
+	call void @BZALLOC( i32 %4 )
+	br label %return
+
+return:		; preds = %entry
+	ret void
+}

Added: llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-05-18-FoldIntToPtr.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-05-18-FoldIntToPtr.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-05-18-FoldIntToPtr.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-05-18-FoldIntToPtr.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,13 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i1 false} | count 2
+; PR2329
+
+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-pc-linux-gnu"
+
+define i1 @f1() {
+  ret i1 icmp eq (i8* inttoptr (i32 1 to i8*), i8* inttoptr (i32 2 to i8*))
+}
+
+define i1 @f2() {
+  ret i1 icmp eq (i8* inttoptr (i16 1 to i8*), i8* inttoptr (i16 2 to i8*))
+}

Added: llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-05-22-IDivVector.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-05-22-IDivVector.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-05-22-IDivVector.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-05-22-IDivVector.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,6 @@
+; RUN: llvm-as < %s | opt -instcombine -disable-output
+
+define <3 x i8> @f(<3 x i8> %i) {
+  %A = sdiv <3 x i8> %i, %i
+  ret <3 x i8> %A
+}

Added: llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-05-22-NegValVector.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-05-22-NegValVector.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-05-22-NegValVector.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-05-22-NegValVector.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,8 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep sub
+
+define <3 x i8> @f(<3 x i8> %a) {
+  %A = sub <3 x i8> zeroinitializer, %a
+  %B = mul <3 x i8> %A, <i8 5, i8 5, i8 5>
+  ret <3 x i8> %B
+}
+

Added: llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-05-23-CompareFold.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-05-23-CompareFold.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-05-23-CompareFold.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-05-23-CompareFold.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i1 false}
+; PR2359
+define i1 @f(i8* %x) {
+entry:
+       %tmp462 = load i8* %x, align 1          ; <i8> [#uses=1]
+       %tmp462463 = sitofp i8 %tmp462 to float         ; <float> [#uses=1]
+       %tmp464 = fcmp ugt float %tmp462463, 0x47EFFFFFE0000000         ; <i1>
+       ret i1 %tmp464
+}
+
+

Added: llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-05-31-AddBool.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-05-31-AddBool.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-05-31-AddBool.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-05-31-AddBool.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,7 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {xor}
+; PR2389
+
+define i1 @test(i1 %a, i1 %b) {
+  %A = add i1 %a, %b
+  ret i1 %A
+}

Added: llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-05-31-Bools.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-05-31-Bools.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-05-31-Bools.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-05-31-Bools.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,24 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis > %t
+; RUN: grep {xor} %t
+; RUN: grep {and} %t
+; RUN: not grep {div} %t
+
+define i1 @foo1(i1 %a, i1 %b) {
+  %A = sub i1 %a, %b
+  ret i1 %A
+}
+
+define i1 @foo2(i1 %a, i1 %b) {
+  %A = mul i1 %a, %b
+  ret i1 %A
+}
+
+define i1 @foo3(i1 %a, i1 %b) {
+  %A = udiv i1 %a, %b
+  ret i1 %A
+}
+
+define i1 @foo4(i1 %a, i1 %b) {
+  %A = sdiv i1 %a, %b
+  ret i1 %A
+}

Added: llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-06-05-ashr-crash.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-06-05-ashr-crash.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-06-05-ashr-crash.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-06-05-ashr-crash.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,7 @@
+; RUN: llvm-as < %s | opt -instcombine
+
+define i65 @foo(i65 %x) nounwind  {
+entry:
+	%tmp2 = ashr i65 %x, 65		; <i65> [#uses=1]
+	ret i65 %tmp2
+}

Added: llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-06-08-ICmpPHI.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-06-08-ICmpPHI.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-06-08-ICmpPHI.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-06-08-ICmpPHI.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,47 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {phi i32} | count 2
+
+define void @test() nounwind  {
+entry:
+	br label %bb
+
+bb:		; preds = %bb16, %entry
+	%i.0 = phi i32 [ 0, %entry ], [ %indvar.next, %somebb ]		; <i32> [#uses=1]
+	%x.0 = phi i32 [ 37, %entry ], [ %tmp17, %somebb ]		; <i32> [#uses=1]
+	%tmp = tail call i32 (...)* @bork( ) nounwind 		; <i32> [#uses=0]
+	%tmp1 = tail call i32 (...)* @bork( ) nounwind 		; <i32> [#uses=0]
+	%tmp2 = tail call i32 (...)* @bork( ) nounwind 		; <i32> [#uses=1]
+	%tmp3 = icmp eq i32 %tmp2, 0		; <i1> [#uses=1]
+	br i1 %tmp3, label %bb7, label %bb5
+
+bb5:		; preds = %bb
+	%tmp6 = tail call i32 (...)* @bork( ) nounwind 		; <i32> [#uses=0]
+	br label %bb7
+
+bb7:		; preds = %bb5, %bb
+	%tmp8 = tail call i32 (...)* @bork( ) nounwind 		; <i32> [#uses=0]
+	%tmp9 = tail call i32 (...)* @bork( ) nounwind 		; <i32> [#uses=0]
+	%tmp11 = icmp eq i32 %x.0, 37		; <i1> [#uses=1]
+	br i1 %tmp11, label %bb14, label %bb16
+
+bb14:		; preds = %bb7
+	%tmp15 = tail call i32 (...)* @bar( ) nounwind 		; <i32> [#uses=0]
+	br label %bb16
+
+bb16:		; preds = %bb14, %bb7
+	%tmp17 = tail call i32 (...)* @zap( ) nounwind 		; <i32> [#uses=1]
+	%indvar.next = add i32 %i.0, 1		; <i32> [#uses=2]
+	%exitcond = icmp eq i32 %indvar.next, 42		; <i1> [#uses=1]
+	br i1 %exitcond, label %return, label %somebb
+
+somebb:
+	br label %bb
+
+return:		; preds = %bb16
+	ret void
+}
+
+declare i32 @bork(...)
+
+declare i32 @bar(...)
+
+declare i32 @zap(...)

Added: llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-06-13-InfiniteLoopStore.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-06-13-InfiniteLoopStore.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-06-13-InfiniteLoopStore.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-06-13-InfiniteLoopStore.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,20 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {store i32} | count 2
+
+ at g_139 = global i32 0           ; <i32*> [#uses=2]
+
+define void @func_56(i32 %p_60) nounwind  {
+entry:
+        store i32 1, i32* @g_139, align 4
+        %tmp1 = icmp ne i32 %p_60, 0            ; <i1> [#uses=1]
+        %tmp12 = zext i1 %tmp1 to i8            ; <i8> [#uses=1]
+        %toBool = icmp ne i8 %tmp12, 0          ; <i1> [#uses=1]
+        br i1 %toBool, label %bb, label %return
+
+bb:             ; preds = %bb, %entry
+        store i32 1, i32* @g_139, align 4
+        br label %bb
+
+return:         ; preds = %entry
+        ret void
+}
+

Added: llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-06-13-ReadOnlyCallStore.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-06-13-ReadOnlyCallStore.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-06-13-ReadOnlyCallStore.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-06-13-ReadOnlyCallStore.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,19 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {store i8} | count 2
+
+define i32 @a(i8* %s) nounwind  {
+entry:
+	store i8 0, i8* %s, align 1 ; This store cannot be eliminated!
+	%tmp3 = call i32 @strlen( i8* %s ) nounwind readonly
+	%tmp5 = icmp ne i32 %tmp3, 0
+	br i1 %tmp5, label %bb, label %bb8
+
+bb:		; preds = %entry
+	store i8 0, i8* %s, align 1
+	br label %bb8
+
+bb8:
+	ret i32 %tmp3
+}
+
+declare i32 @strlen(i8*) nounwind readonly 
+

Added: llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-06-19-UncondLoad.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-06-19-UncondLoad.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-06-19-UncondLoad.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-06-19-UncondLoad.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,16 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep load | count 3
+; PR2471
+
+declare i32 @x(i32*)
+define i32 @b(i32* %a, i32* %b) {
+entry:
+        %tmp1 = load i32* %a            
+        %tmp3 = load i32* %b           
+        %add = add i32 %tmp1, %tmp3   
+        %call = call i32 @x( i32* %a )
+        %tobool = icmp ne i32 %add, 0
+	; not safe to turn into an uncond load
+        %cond = select i1 %tobool, i32* %b, i32* %a             
+        %tmp8 = load i32* %cond       
+        ret i32 %tmp8
+}

Added: llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-06-21-CompareMiscomp.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-06-21-CompareMiscomp.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-06-21-CompareMiscomp.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-06-21-CompareMiscomp.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {icmp eq i32 %In, 15}
+; PR2479
+; (See also PR1800.)
+
+define i1 @test(i32 %In) {
+	%c1 = icmp ugt i32 %In, 13
+	%c2 = icmp eq i32 %In, 15
+	%V = and i1 %c1, %c2
+	ret i1 %V
+}
+

Added: llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-06-24-StackRestore.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-06-24-StackRestore.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-06-24-StackRestore.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-06-24-StackRestore.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,39 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {call.*llvm.stackrestore}
+; PR2488
+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-pc-linux-gnu"
+ at p = weak global i8* null		; <i8**> [#uses=2]
+
+define i32 @main() nounwind  {
+entry:
+	%tmp248 = call i8* @llvm.stacksave( )		; <i8*> [#uses=1]
+	%tmp2752 = alloca i32		; <i32*> [#uses=2]
+	%tmpcast53 = bitcast i32* %tmp2752 to i8*		; <i8*> [#uses=1]
+	store i32 2, i32* %tmp2752, align 4
+	volatile store i8* %tmpcast53, i8** @p, align 4
+	br label %bb44
+
+bb:		; preds = %bb44
+	ret i32 0
+
+bb44:		; preds = %bb44, %entry
+	%indvar = phi i32 [ 0, %entry ], [ %tmp3857, %bb44 ]		; <i32> [#uses=1]
+	%tmp249 = phi i8* [ %tmp248, %entry ], [ %tmp2, %bb44 ]		; <i8*> [#uses=1]
+	%tmp3857 = add i32 %indvar, 1		; <i32> [#uses=3]
+	call void @llvm.stackrestore( i8* %tmp249 )
+	%tmp2 = call i8* @llvm.stacksave( )		; <i8*> [#uses=1]
+	%tmp4 = srem i32 %tmp3857, 1000		; <i32> [#uses=2]
+	%tmp5 = add i32 %tmp4, 1		; <i32> [#uses=1]
+	%tmp27 = alloca i32, i32 %tmp5		; <i32*> [#uses=3]
+	%tmpcast = bitcast i32* %tmp27 to i8*		; <i8*> [#uses=1]
+	store i32 1, i32* %tmp27, align 4
+	%tmp34 = getelementptr i32* %tmp27, i32 %tmp4		; <i32*> [#uses=1]
+	store i32 2, i32* %tmp34, align 4
+	volatile store i8* %tmpcast, i8** @p, align 4
+	%exitcond = icmp eq i32 %tmp3857, 999999		; <i1> [#uses=1]
+	br i1 %exitcond, label %bb, label %bb44
+}
+
+declare i8* @llvm.stacksave() nounwind 
+
+declare void @llvm.stackrestore(i8*) nounwind 

Added: llvm/branches/non-call-eh/test/Transforms/InstCombine/add-shrink.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/add-shrink.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/add-shrink.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/add-shrink.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,14 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {add i32}
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep sext | count 1
+
+; Should only have one sext and the add should be i32 instead of i64.
+
+define i64 @test1(i32 %A) {
+	%B = ashr i32 %A, 7		; <i32> [#uses=1]
+	%C = ashr i32 %A, 9		; <i32> [#uses=1]
+	%D = sext i32 %B to i64		; <i64> [#uses=1]
+	%E = sext i32 %C to i64		; <i64> [#uses=1]
+	%F = add i64 %D, %E		; <i64> [#uses=1]
+	ret i64 %F
+}
+

Added: llvm/branches/non-call-eh/test/Transforms/InstCombine/add-sitofp.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/add-sitofp.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/add-sitofp.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/add-sitofp.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {add i32}
+
+define double @x(i32 %a, i32 %b) nounwind {
+  %m = lshr i32 %a, 24
+  %n = and i32 %m, %b
+  %o = sitofp i32 %n to double
+  %p = add double %o, 1.0
+  ret double %p
+}

Modified: llvm/branches/non-call-eh/test/Transforms/InstCombine/add2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/add2.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/add2.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/add2.ll Sun Jul  6 15:45:41 2008
@@ -29,3 +29,18 @@
 
 declare i32 @callee(i32)
 
+
+define i32 @test3(i32 %A) {
+  %B = and i32 %A, 7
+  %C = and i32 %A, 32
+  %F = add i32 %B, %C
+  ret i32 %F
+}
+
+define i32 @test4(i32 %A) {
+  %B = and i32 %A, 128
+  %C = lshr i32 %A, 30
+  %F = add i32 %B, %C
+  ret i32 %F
+}
+

Modified: llvm/branches/non-call-eh/test/Transforms/InstCombine/apint-call-cast-target.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/apint-call-cast-target.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/apint-call-cast-target.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/apint-call-cast-target.ll Sun Jul  6 15:45:41 2008
@@ -10,4 +10,8 @@
 	ret i32 %tmp
 }
 
-declare i7* @ctime(i999*)
+define i7* @ctime(i999*) {
+entry:
+	%tmp = call i7* bitcast (i32 ()* @main to i7* ()*)( )
+	ret i7* %tmp
+}

Modified: llvm/branches/non-call-eh/test/Transforms/InstCombine/bittest.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/bittest.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/bittest.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/bittest.ll Sun Jul  6 15:45:41 2008
@@ -1,5 +1,5 @@
 ; RUN: llvm-as < %s | opt -instcombine -simplifycfg | llvm-dis |\
-; RUN:    not grep {call void %abort}
+; RUN:    not grep {call void @abort}
 
 @b_rec.0 = external global i32          ; <i32*> [#uses=2]
 

Modified: llvm/branches/non-call-eh/test/Transforms/InstCombine/bswap-fold.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/bswap-fold.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/bswap-fold.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/bswap-fold.ll Sun Jul  6 15:45:41 2008
@@ -1,7 +1,5 @@
-; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
-; RUN:   grep ret | count 3
-; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
-; RUN:   not grep call.*bswap
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep ret | count 6
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep call.*bswap
 
 define i1 @test1(i16 %tmp2) {
         %tmp10 = call i16 @llvm.bswap.i16( i16 %tmp2 )          ; <i16> [#uses=1]
@@ -27,3 +25,28 @@
 
 declare i16 @llvm.bswap.i16(i16)
 
+; rdar://5992453
+; A & 255
+define i32 @test4(i32 %a) nounwind  {
+entry:
+	%tmp2 = tail call i32 @llvm.bswap.i32( i32 %a )	
+	%tmp4 = lshr i32 %tmp2, 24
+	ret i32 %tmp4
+}
+
+; A
+define i32 @test5(i32 %a) nounwind  {
+entry:
+	%tmp2 = tail call i32 @llvm.bswap.i32( i32 %a )
+	%tmp4 = tail call i32 @llvm.bswap.i32( i32 %tmp2 )
+	ret i32 %tmp4
+}
+
+; a >> 24
+define i32 @test6(i32 %a) nounwind  {
+entry:
+	%tmp2 = tail call i32 @llvm.bswap.i32( i32 %a )	
+	%tmp4 = and i32 %tmp2, 255
+	ret i32 %tmp4
+}
+

Modified: llvm/branches/non-call-eh/test/Transforms/InstCombine/call.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/call.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/call.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/call.ll Sun Jul  6 15:45:41 2008
@@ -1,4 +1,5 @@
-; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; Ignore stderr, we expect warnings there
+; RUN: llvm-as < %s 2> /dev/null | opt -instcombine | llvm-dis | \
 ; RUN:    grep call | notcast
 ; END.
 

Added: llvm/branches/non-call-eh/test/Transforms/InstCombine/cast-mul-select.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/cast-mul-select.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/cast-mul-select.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/cast-mul-select.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,29 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | notcast
+
+define i32 @mul(i32 %x, i32 %y) {
+  %A = trunc i32 %x to i8
+  %B = trunc i32 %y to i8
+  %C = mul i8 %A, %B
+  %D = zext i8 %C to i32
+  ret i32 %D
+}
+
+define i32 @select1(i1 %cond, i32 %x, i32 %y, i32 %z) {
+  %A = trunc i32 %x to i8
+  %B = trunc i32 %y to i8
+  %C = trunc i32 %z to i8
+  %D = add i8 %A, %B
+  %E = select i1 %cond, i8 %C, i8 %D
+  %F = zext i8 %E to i32
+  ret i32 %F
+}
+
+define i8 @select2(i1 %cond, i8 %x, i8 %y, i8 %z) {
+  %A = zext i8 %x to i32
+  %B = zext i8 %y to i32
+  %C = zext i8 %z to i32
+  %D = add i32 %A, %B
+  %E = select i1 %cond, i32 %C, i32 %D
+  %F = trunc i32 %E to i8
+  ret i8 %F
+}

Modified: llvm/branches/non-call-eh/test/Transforms/InstCombine/dg.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/dg.exp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/dg.exp (original)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/dg.exp Sun Jul  6 15:45:41 2008
@@ -1,3 +1,3 @@
 load_lib llvm.exp
 
-RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]

Modified: llvm/branches/non-call-eh/test/Transforms/InstCombine/div.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/div.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/div.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/div.ll Sun Jul  6 15:45:41 2008
@@ -1,8 +1,6 @@
 ; This test makes sure that div instructions are properly eliminated.
-;
 
 ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep div
-; END.
 
 define i32 @test1(i32 %A) {
         %B = sdiv i32 %A, 1             ; <i32> [#uses=1]
@@ -72,3 +70,15 @@
         %B = udiv i32 %X, %A            ; <i32> [#uses=1]
         ret i32 %B
 }
+
+; PR2328
+define i32 @test12(i32 %x) nounwind  {
+	%tmp3 = udiv i32 %x, %x		; 1
+	ret i32 %tmp3
+}
+
+define i32 @test13(i32 %x) nounwind  {
+	%tmp3 = sdiv i32 %x, %x		; 1
+	ret i32 %tmp3
+}
+

Added: llvm/branches/non-call-eh/test/Transforms/InstCombine/extractvalue.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/extractvalue.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/extractvalue.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/extractvalue.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,24 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep extractvalue
+
+; Instcombine should fold various combinations of insertvalue and extractvalue
+; together
+declare void @bar({i32, i32} %a)
+
+define i32 @foo() {
+        ; Build a simple struct and pull values out again
+        %s1.1 = insertvalue {i32, i32} undef, i32 0, 0
+        %s1 = insertvalue {i32, i32} %s1.1, i32 1, 1
+        %v1 = extractvalue {i32, i32} %s1, 0
+        %v2 = extractvalue {i32, i32} %s1, 1
+        
+        ; Build a nested struct and pull a sub struct out of it
+        ; This requires instcombine to insert a few insertvalue instructions
+        %ns1.1 = insertvalue {i32, {i32, i32}} undef, i32 %v1, 0
+        %ns1.2 = insertvalue {i32, {i32, i32}} %ns1.1, i32 %v1, 1, 0
+        %ns1   = insertvalue {i32, {i32, i32}} %ns1.2, i32 %v2, 1, 1
+        %s2    = extractvalue {i32, {i32, i32}} %ns1, 1
+        call void @bar({i32, i32} %s2)
+        %v3 = extractvalue {i32, {i32, i32}} %ns1, 1, 1
+        ret i32 %v3
+}
+

Added: llvm/branches/non-call-eh/test/Transforms/InstCombine/fp-ret-bitcast.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/fp-ret-bitcast.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/fp-ret-bitcast.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/fp-ret-bitcast.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,27 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN:    grep {call float bitcast} | count 1
+	%struct.NSObject = type { %struct.objc_class* }
+ 	%struct.NSArray = type { %struct.NSObject }
+	%struct.objc_class = type opaque
+ 	%struct.objc_selector = type opaque
+
+@"\01L_OBJC_METH_VAR_NAME_112" = internal global [15 x i8] c"whiteComponent\00", section "__TEXT,__cstring,cstring_literals"
+@"\01L_OBJC_SELECTOR_REFERENCES_81" = internal global %struct.objc_selector* bitcast ([15 x i8]* @"\01L_OBJC_METH_VAR_NAME_112" to %struct.objc_selector*), section "__OBJC,__message_refs,literal_pointers,no_dead_strip"
+
+define void @bork() nounwind  {
+entry:
+	%color = alloca %struct.NSArray*
+	%color.466 = alloca %struct.NSObject*
+	%tmp103 = load %struct.NSArray** %color, align 4
+	%tmp103104 = getelementptr %struct.NSArray* %tmp103, i32 0, i32 0
+	store %struct.NSObject* %tmp103104, %struct.NSObject** %color.466, align 4
+	%tmp105 = load %struct.objc_selector** @"\01L_OBJC_SELECTOR_REFERENCES_81", align 4
+	%tmp106 = load %struct.NSObject** %color.466, align 4
+	%tmp107 = call float bitcast (void (%struct.NSObject*, ...)* @objc_msgSend_fpret to float (%struct.NSObject*, %struct.objc_selector*)*)( %struct.NSObject* %tmp106, %struct.objc_selector* %tmp105 ) nounwind
+	br label %exit
+
+exit:
+	ret void
+}
+
+declare void @objc_msgSend_fpret(%struct.NSObject*, ...)

Added: llvm/branches/non-call-eh/test/Transforms/InstCombine/getelementptr-seteq.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/getelementptr-seteq.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/getelementptr-seteq.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/getelementptr-seteq.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,13 @@
+; Test folding of constantexpr geps into normal geps.
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {icmp eq i64 %X, -1}
+; PR2235
+
+%S = type { i32, [ 100 x i32] }
+
+define i1 @test(i64 %X, %S* %P) {
+        %A = getelementptr %S* %P, i32 0, i32 1, i64 %X
+        %B = getelementptr %S* %P, i32 0, i32 0
+	%C = icmp eq i32* %A, %B
+	ret i1 %C
+}
+

Modified: llvm/branches/non-call-eh/test/Transforms/InstCombine/memmove.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/memmove.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/memmove.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/memmove.ll Sun Jul  6 15:45:41 2008
@@ -4,6 +4,10 @@
 ; RUN:    not grep {call void @llvm.memmove}
 
 @S = internal constant [33 x i8] c"panic: restorelist inconsistency\00"		; <[33 x i8]*> [#uses=1]
+ at h = constant [2 x i8] c"h\00"		; <[2 x i8]*> [#uses=1]
+ at hel = constant [4 x i8] c"hel\00"		; <[4 x i8]*> [#uses=1]
+ at hello_u = constant [8 x i8] c"hello_u\00"		; <[8 x i8]*> [#uses=1]
+
 
 declare void @llvm.memmove.i32(i8*, i8*, i32, i32)
 
@@ -17,3 +21,22 @@
 	call void @llvm.memmove.i32( i8* %A, i8* getelementptr ([33 x i8]* @S, i32 0, i32 0), i32 %N, i32 1 )
 	ret void
 }
+
+define i32 @test3() {
+	%h_p = getelementptr [2 x i8]* @h, i32 0, i32 0		; <i8*> [#uses=1]
+	%hel_p = getelementptr [4 x i8]* @hel, i32 0, i32 0		; <i8*> [#uses=1]
+	%hello_u_p = getelementptr [8 x i8]* @hello_u, i32 0, i32 0		; <i8*> [#uses=1]
+	%target = alloca [1024 x i8]		; <[1024 x i8]*> [#uses=1]
+	%target_p = getelementptr [1024 x i8]* %target, i32 0, i32 0		; <i8*> [#uses=3]
+	call void @llvm.memmove.i32( i8* %target_p, i8* %h_p, i32 2, i32 2 )
+	call void @llvm.memmove.i32( i8* %target_p, i8* %hel_p, i32 4, i32 4 )
+	call void @llvm.memmove.i32( i8* %target_p, i8* %hello_u_p, i32 8, i32 8 )
+	ret i32 0
+}
+
+; PR2370
+define void @test4(i8* %a) {
+        tail call void @llvm.memmove.i32( i8* %a, i8* %a, i32 100, i32 1 )
+        ret void
+}
+

Added: llvm/branches/non-call-eh/test/Transforms/InstCombine/memset.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/memset.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/memset.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/memset.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,15 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {call.*llvm.memset}
+
+declare void @llvm.memset.i32(i8*, i8, i32, i32)
+
+define i32 @main() {
+	%target = alloca [1024 x i8]		; <[1024 x i8]*> [#uses=1]
+	%target_p = getelementptr [1024 x i8]* %target, i32 0, i32 0		; <i8*> [#uses=5]
+	call void @llvm.memset.i32( i8* %target_p, i8 1, i32 0, i32 1 )
+	call void @llvm.memset.i32( i8* %target_p, i8 1, i32 1, i32 1 )
+	call void @llvm.memset.i32( i8* %target_p, i8 1, i32 2, i32 2 )
+	call void @llvm.memset.i32( i8* %target_p, i8 1, i32 4, i32 4 )
+	call void @llvm.memset.i32( i8* %target_p, i8 1, i32 8, i32 8 )
+	ret i32 0
+}
+

Added: llvm/branches/non-call-eh/test/Transforms/InstCombine/mul-masked-bits.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/mul-masked-bits.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/mul-masked-bits.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/mul-masked-bits.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep ashr
+
+define i32 @foo(i32 %x, i32 %y) {
+  %a = and i32 %x, 7
+  %b = and i32 %y, 7
+  %c = mul i32 %a, %b
+  %d = shl i32 %c, 26
+  %e = ashr i32 %d, 26
+  ret i32 %e
+}

Modified: llvm/branches/non-call-eh/test/Transforms/InstCombine/not.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/not.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/not.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/not.ll Sun Jul  6 15:45:41 2008
@@ -42,3 +42,13 @@
         ret i32 %d
 }
 
+; PR2298
+define i8 @test6(i32 %a, i32 %b) zeroext nounwind  {
+entry:
+	%tmp1not = xor i32 %a, -1		; <i32> [#uses=1]
+	%tmp2not = xor i32 %b, -1		; <i32> [#uses=1]
+	%tmp3 = icmp slt i32 %tmp1not, %tmp2not		; <i1> [#uses=1]
+	%retval67 = zext i1 %tmp3 to i8		; <i8> [#uses=1]
+	ret i8 %retval67
+}
+

Modified: llvm/branches/non-call-eh/test/Transforms/InstCombine/setcc-cast-cast.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/setcc-cast-cast.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/setcc-cast-cast.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/setcc-cast-cast.ll Sun Jul  6 15:45:41 2008
@@ -2,7 +2,7 @@
 ; that folding doesn't happen in case a zext is applied where a sext should have
 ; been when a setcc is used with two casts.
 ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
-; RUN:    not grep {br bool false}
+; RUN:    not grep {br i1 false}
 ; END.
 
 define i32 @bug(i8 %inbuff) {

Added: llvm/branches/non-call-eh/test/Transforms/InstCombine/sext-misc.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/sext-misc.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/sext-misc.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/sext-misc.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,65 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep sext
+
+declare i32 @llvm.ctpop.i32(i32)
+declare i32 @llvm.ctlz.i32(i32)
+declare i32 @llvm.cttz.i32(i32)
+
+define i64 @foo(i32 %x) {
+  %t = call i32 @llvm.ctpop.i32(i32 %x)
+  %s = sext i32 %t to i64
+  ret i64 %s
+}
+define i64 @boo(i32 %x) {
+  %t = call i32 @llvm.ctlz.i32(i32 %x)
+  %s = sext i32 %t to i64
+  ret i64 %s
+}
+define i64 @zoo(i32 %x) {
+  %t = call i32 @llvm.cttz.i32(i32 %x)
+  %s = sext i32 %t to i64
+  ret i64 %s
+}
+define i64 @coo(i32 %x) {
+  %t = udiv i32 %x, 3
+  %s = sext i32 %t to i64
+  ret i64 %s
+}
+define i64 @moo(i32 %x) {
+  %t = urem i32 %x, 30000
+  %s = sext i32 %t to i64
+  ret i64 %s
+}
+define i64 @yoo(i32 %x) {
+  %u = lshr i32 %x, 3
+  %t = mul i32 %u, 3
+  %s = sext i32 %t to i64
+  ret i64 %s
+}
+define i64 @voo(i32 %x) {
+  %t = and i32 %x, 511
+  %u = sub i32 20000, %t
+  %s = sext i32 %u to i64
+  ret i64 %s
+}
+define i32 @woo(i8 %a, i32 %f, i1 %p, i32* %z) {
+  %d = lshr i32 %f, 24
+  %e = select i1 %p, i32 %d, i32 0
+  %s = trunc i32 %e to i16
+  %n = sext i16 %s to i32
+  ret i32 %n
+}
+
+; rdar://6013816
+define i16 @test(i16 %t, i1 %cond) nounwind {
+entry:
+	br i1 %cond, label %T, label %F
+T:
+	%t2 = sext i16 %t to i32
+	br label %F
+
+F:
+	%V = phi i32 [%t2, %T], [42, %entry]
+	%W = trunc i32 %V to i16
+	ret i16 %W
+}
+

Added: llvm/branches/non-call-eh/test/Transforms/InstCombine/shl-icmp.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/shl-icmp.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/shl-icmp.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/shl-icmp.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,29 @@
+; RUN: llvm-as < %s | opt -instcombine -stats -disable-output |& \
+; RUN:   grep {Number of insts combined} | grep 5
+
+define i8 @t1(i8 zeroext %x, i8 zeroext %y) zeroext nounwind {
+entry:
+	%tmp1 = lshr i8 %x, 7
+	%cond1 = icmp ne i8 %tmp1, 0
+	br i1 %cond1, label %bb1, label %bb2
+
+bb1:
+	ret i8 %tmp1
+
+bb2:
+        %tmp2 = add i8 %tmp1, %y
+	ret i8 %tmp2
+}
+
+define i8 @t2(i8 zeroext %x) zeroext nounwind {
+entry:
+	%tmp1 = lshr i8 %x, 7
+	%cond1 = icmp ne i8 %tmp1, 0
+	br i1 %cond1, label %bb1, label %bb2
+
+bb1:
+	ret i8 0
+
+bb2:
+	ret i8 1
+}

Added: llvm/branches/non-call-eh/test/Transforms/InstCombine/sitofp.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/sitofp.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/sitofp.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/sitofp.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,43 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep sitofp
+
+define i1 @test1(i8 %A) {
+  %B = sitofp i8 %A to double
+  %C = fcmp ult double %B, 128.0
+  ret i1 %C  ;  True!
+}
+define i1 @test2(i8 %A) {
+  %B = sitofp i8 %A to double
+  %C = fcmp ugt double %B, -128.1
+  ret i1 %C  ;  True!
+}
+
+define i1 @test3(i8 %A) {
+  %B = sitofp i8 %A to double
+  %C = fcmp ule double %B, 127.0
+  ret i1 %C  ;  true!
+}
+
+define i1 @test4(i8 %A) {
+  %B = sitofp i8 %A to double
+  %C = fcmp ult double %B, 127.0
+  ret i1 %C  ;  A != 127
+}
+
+define i32 @test5(i32 %A) {
+  %B = sitofp i32 %A to double
+  %C = fptosi double %B to i32
+  %D = uitofp i32 %C to double
+  %E = fptoui double %D to i32
+  ret i32 %E
+}
+
+define i32 @test6(i32 %A) {
+	%B = and i32 %A, 7		; <i32> [#uses=1]
+	%C = and i32 %A, 32		; <i32> [#uses=1]
+	%D = sitofp i32 %B to double		; <double> [#uses=1]
+	%E = sitofp i32 %C to double		; <double> [#uses=1]
+	%F = add double %D, %E		; <double> [#uses=1]
+	%G = fptosi double %F to i32		; <i32> [#uses=1]
+	ret i32 %G
+}
+

Added: llvm/branches/non-call-eh/test/Transforms/InstCombine/srem-simplify-bug.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/srem-simplify-bug.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/srem-simplify-bug.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/srem-simplify-bug.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i1 false}
+; PR2276
+
+define i1 @f(i32 %x) {
+  %A = or i32 %x, 1
+  %B = srem i32 %A, 1
+  %C = icmp ne i32 %B, 0
+  ret i1 %C
+}

Modified: llvm/branches/non-call-eh/test/Transforms/InstCombine/sub.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/sub.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/sub.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/sub.ll Sun Jul  6 15:45:41 2008
@@ -134,3 +134,13 @@
 	%tmp.4 = icmp ne i32 %tmp.2, %g		; <i1> [#uses=1]
 	ret i1 %tmp.4
 }
+
+; PR2298
+define i8 @test22(i32 %a, i32 %b) zeroext nounwind  {
+	%tmp2 = sub i32 0, %a		; <i32> [#uses=1]
+	%tmp4 = sub i32 0, %b		; <i32> [#uses=1]
+	%tmp5 = icmp eq i32 %tmp2, %tmp4		; <i1> [#uses=1]
+	%retval89 = zext i1 %tmp5 to i8		; <i8> [#uses=1]
+	ret i8 %retval89
+}
+

Added: llvm/branches/non-call-eh/test/Transforms/InstCombine/udiv-simplify-bug-0.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/udiv-simplify-bug-0.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/udiv-simplify-bug-0.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/udiv-simplify-bug-0.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,14 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i64 0} | count 2
+
+define i64 @foo(i32 %x) nounwind {
+  %y = lshr i32 %x, 1
+  %r = udiv i32 %y, -1
+  %z = sext i32 %r to i64
+  ret i64 %z
+}
+define i64 @bar(i32 %x) nounwind {
+  %y = lshr i32 %x, 31
+  %r = udiv i32 %y, 3
+  %z = sext i32 %r to i64
+  ret i64 %z
+}

Added: llvm/branches/non-call-eh/test/Transforms/InstCombine/udiv-simplify-bug-1.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/udiv-simplify-bug-1.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/udiv-simplify-bug-1.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/udiv-simplify-bug-1.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,25 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis > %t1.ll
+; RUN: grep udiv %t1.ll | count 3
+; RUN: grep zext %t1.ll | count 3
+; PR2274
+
+; The udiv instructions shouldn't be optimized away, and the
+; sext instructions should be optimized to zext.
+
+define i64 @foo(i32 %x) nounwind {
+  %r = udiv i32 %x, -1
+  %z = sext i32 %r to i64
+  ret i64 %z
+}
+define i64 @bar(i32 %x) nounwind {
+  %y = lshr i32 %x, 30
+  %r = udiv i32 %y, 3
+  %z = sext i32 %r to i64
+  ret i64 %z
+}
+define i64 @qux(i32 %x, i32 %v) nounwind {
+  %y = lshr i32 %x, 31
+  %r = udiv i32 %y, %v
+  %z = sext i32 %r to i64
+  ret i64 %z
+}

Added: llvm/branches/non-call-eh/test/Transforms/InstCombine/urem-simplify-bug.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/urem-simplify-bug.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/urem-simplify-bug.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/urem-simplify-bug.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,32 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {= or i32 %x, -5	}
+
+ at .str = internal constant [5 x i8] c"foo\0A\00"		; <[5 x i8]*> [#uses=1]
+ at .str1 = internal constant [5 x i8] c"bar\0A\00"		; <[5 x i8]*> [#uses=1]
+
+define i32 @main() nounwind  {
+entry:
+	%x = call i32 @func_11( ) nounwind 		; <i32> [#uses=1]
+	%tmp3 = or i32 %x, -5		; <i32> [#uses=1]
+	%tmp5 = urem i32 251, %tmp3		; <i32> [#uses=1]
+	%tmp6 = icmp ne i32 %tmp5, 0		; <i1> [#uses=1]
+	%tmp67 = zext i1 %tmp6 to i32		; <i32> [#uses=1]
+	%tmp9 = urem i32 %tmp67, 95		; <i32> [#uses=1]
+	%tmp10 = and i32 %tmp9, 1		; <i32> [#uses=1]
+	%tmp12 = icmp eq i32 %tmp10, 0		; <i1> [#uses=1]
+	br i1 %tmp12, label %bb14, label %bb
+
+bb:		; preds = %entry
+	br label %bb15
+
+bb14:		; preds = %entry
+	br label %bb15
+
+bb15:		; preds = %bb14, %bb
+	%iftmp.0.0 = phi i8* [ getelementptr ([5 x i8]* @.str1, i32 0, i32 0), %bb14 ], [ getelementptr ([5 x i8]* @.str, i32 0, i32 0), %bb ]		; <i8*> [#uses=1]
+	%tmp17 = call i32 (i8*, ...)* @printf( i8* %iftmp.0.0 ) nounwind 		; <i32> [#uses=0]
+	ret i32 0
+}
+
+declare i32 @func_11()
+
+declare i32 @printf(i8*, ...) nounwind 

Modified: llvm/branches/non-call-eh/test/Transforms/InstCombine/zext-fold.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/InstCombine/zext-fold.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/InstCombine/zext-fold.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/InstCombine/zext-fold.ll Sun Jul  6 15:45:41 2008
@@ -1,6 +1,5 @@
 ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {zext } | count 1
 ; PR1570
-; XFAIL: *
 
 define i32 @test2(float %X, float %Y) {
 entry:

Propchange: llvm/branches/non-call-eh/test/Transforms/Internalize/

------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sun Jul  6 15:45:41 2008
@@ -0,0 +1 @@
+Output

Added: llvm/branches/non-call-eh/test/Transforms/Internalize/2008-05-09-AllButMain.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/Internalize/2008-05-09-AllButMain.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/Internalize/2008-05-09-AllButMain.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/Internalize/2008-05-09-AllButMain.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,27 @@
+; No arguments means internalize all but main
+; RUN: llvm-as < %s | opt -internalize | llvm-dis | grep internal | count 4
+; Internalize all but foo and j
+; RUN: llvm-as < %s | opt -internalize -internalize-public-api-list foo -internalize-public-api-list j | llvm-dis | grep internal | count 3
+; Non existent files should be treated as if they were empty (so internalize all but main)
+; RUN: llvm-as < %s | opt -internalize -internalize-public-api-file /nonexistent/file 2> /dev/null | llvm-dis | grep internal | count 4
+; RUN: llvm-as < %s | opt -internalize -internalize-public-api-list bar -internalize-public-api-list foo -internalize-public-api-file /nonexistent/file 2> /dev/null | llvm-dis | grep internal | count 3
+; -file and -list options should be merged, the .apifile contains foo and j
+; RUN: llvm-as < %s | opt -internalize -internalize-public-api-list bar -internalize-public-api-file %s.apifile | llvm-dis | grep internal | count 2
+
+ at i = weak global i32 0          ; <i32*> [#uses=0]
+ at j = weak global i32 0          ; <i32*> [#uses=0]
+
+define void @main(...) {
+entry:  
+        ret void
+}
+
+define void @foo(...) {
+entry:  
+        ret void
+}
+
+define void @bar(...) {
+entry:  
+        ret void
+}

Added: llvm/branches/non-call-eh/test/Transforms/Internalize/2008-05-09-AllButMain.ll.apifile
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/Internalize/2008-05-09-AllButMain.ll.apifile?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/Internalize/2008-05-09-AllButMain.ll.apifile (added)
+++ llvm/branches/non-call-eh/test/Transforms/Internalize/2008-05-09-AllButMain.ll.apifile Sun Jul  6 15:45:41 2008
@@ -0,0 +1,2 @@
+foo
+j

Added: llvm/branches/non-call-eh/test/Transforms/Internalize/dg.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/Internalize/dg.exp?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/Internalize/dg.exp (added)
+++ llvm/branches/non-call-eh/test/Transforms/Internalize/dg.exp Sun Jul  6 15:45:41 2008
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]

Propchange: llvm/branches/non-call-eh/test/Transforms/JumpThreading/

------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sun Jul  6 15:45:41 2008
@@ -0,0 +1 @@
+Output

Added: llvm/branches/non-call-eh/test/Transforms/JumpThreading/2008-04-24-InfLoop.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/JumpThreading/2008-04-24-InfLoop.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/JumpThreading/2008-04-24-InfLoop.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/JumpThreading/2008-04-24-InfLoop.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,142 @@
+; RUN: llvm-as < %s | opt -jump-threading -disable-output
+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"
+ at Link = global [1 x i32] [ i32 -1 ]		; <[1 x i32]*> [#uses=2]
+ at W = global [1 x i32] [ i32 2 ]		; <[1 x i32]*> [#uses=1]
+
+define i32 @f(i32 %k, i32 %p) nounwind  {
+entry:
+	br label %bb
+
+bb:		; preds = %bb56, %bb76.loopexit.us, %entry
+	%j.2 = phi i32 [ 0, %entry ], [ 1, %bb56 ], [ 1, %bb76.loopexit.us ]		; <i32> [#uses=5]
+	%pdest.2 = phi i32 [ 0, %entry ], [ %pdest.8, %bb56 ], [ %pdest.7.us, %bb76.loopexit.us ]		; <i32> [#uses=3]
+	%p_addr.0 = phi i32 [ %p, %entry ], [ 0, %bb56 ], [ %p_addr.1.us, %bb76.loopexit.us ]		; <i32> [#uses=3]
+	%k_addr.0 = phi i32 [ %k, %entry ], [ %tmp59, %bb56 ], [ %tmp59.us, %bb76.loopexit.us ]		; <i32> [#uses=4]
+	%tmp2 = icmp sgt i32 %pdest.2, 2		; <i1> [#uses=1]
+	br i1 %tmp2, label %bb4.preheader, label %bb13
+
+bb4.preheader:		; preds = %bb
+	%tmp109 = sub i32 1, %j.2		; <i32> [#uses=2]
+	%tmp110 = icmp slt i32 %tmp109, -2		; <i1> [#uses=1]
+	%smax111 = select i1 %tmp110, i32 -2, i32 %tmp109		; <i32> [#uses=2]
+	%tmp112 = add i32 %j.2, %smax111		; <i32> [#uses=2]
+	br label %bb4
+
+bb4:		; preds = %bb4, %bb4.preheader
+	%indvar = phi i32 [ 0, %bb4.preheader ], [ %indvar.next, %bb4 ]		; <i32> [#uses=1]
+	%indvar.next = add i32 %indvar, 1		; <i32> [#uses=2]
+	%exitcond = icmp eq i32 %indvar.next, %tmp112		; <i1> [#uses=1]
+	br i1 %exitcond, label %bb13.loopexit, label %bb4
+
+bb13.loopexit:		; preds = %bb4
+	%tmp = add i32 %j.2, %pdest.2		; <i32> [#uses=1]
+	%tmp102 = add i32 %tmp, %smax111		; <i32> [#uses=1]
+	%tmp104 = add i32 %tmp112, -1		; <i32> [#uses=1]
+	%tmp106 = sub i32 %j.2, %tmp104		; <i32> [#uses=1]
+	%tmp107 = add i32 %tmp106, -1		; <i32> [#uses=1]
+	br label %bb13
+
+bb13:		; preds = %bb13.loopexit, %bb
+	%j.1 = phi i32 [ %tmp107, %bb13.loopexit ], [ %j.2, %bb ]		; <i32> [#uses=4]
+	%pdest.1 = phi i32 [ %tmp102, %bb13.loopexit ], [ %pdest.2, %bb ]		; <i32> [#uses=2]
+	%tmp15 = icmp eq i32 %j.1, 1		; <i1> [#uses=1]
+	br i1 %tmp15, label %bb82, label %bb27.preheader
+
+bb27.preheader:		; preds = %bb13
+	%tmp21 = icmp eq i32 %j.1, %p_addr.0		; <i1> [#uses=0]
+	br label %bb27.outer
+
+bb27.outer:		; preds = %bb27.outer.bb24.split_crit_edge, %bb27.preheader
+	%indvar118 = phi i32 [ 0, %bb27.preheader ], [ %indvar.next119, %bb27.outer.bb24.split_crit_edge ]		; <i32> [#uses=2]
+	%pdest.3.ph = add i32 %indvar118, %pdest.1		; <i32> [#uses=2]
+	%tmp30 = icmp sgt i32 %pdest.3.ph, %p_addr.0		; <i1> [#uses=1]
+	br i1 %tmp30, label %bb27.outer.bb24.split_crit_edge, label %bb27.outer.split
+
+bb27.outer.bb24.split_crit_edge:		; preds = %bb27.outer
+	%indvar.next119 = add i32 %indvar118, 1		; <i32> [#uses=1]
+	br label %bb27.outer
+
+bb27.outer.split:		; preds = %bb27.outer
+	%tmp35 = getelementptr [1 x i32]* @W, i32 0, i32 %k_addr.0		; <i32*> [#uses=3]
+	%tmp48 = icmp slt i32 %p_addr.0, 1		; <i1> [#uses=1]
+	%tmp53 = icmp sgt i32 %k_addr.0, 0		; <i1> [#uses=1]
+	br label %bb33
+
+bb33:		; preds = %bb51.split, %bb27.outer.split
+	%pdest.5 = phi i32 [ %pdest.3.ph, %bb27.outer.split ], [ %pdest.4, %bb51.split ]		; <i32> [#uses=1]
+	%tmp36 = load i32* %tmp35, align 4		; <i32> [#uses=2]
+	br i1 %tmp48, label %bb37.us, label %bb37
+
+bb37.us:		; preds = %bb42.us, %bb37.us, %bb33
+	%D1361.1.us = phi i32 [ %tmp36, %bb33 ], [ 0, %bb42.us ], [ %D1361.1.us, %bb37.us ]		; <i32> [#uses=2]
+	%tmp39.us = icmp eq i32 %D1361.1.us, 0		; <i1> [#uses=1]
+	br i1 %tmp39.us, label %bb37.us, label %bb42.us
+
+bb42.us:		; preds = %bb37.us
+	store i32 0, i32* %tmp35, align 4
+	br label %bb37.us
+
+bb37:		; preds = %bb33
+	%tmp39 = icmp eq i32 %tmp36, 0		; <i1> [#uses=1]
+	br i1 %tmp39, label %bb51.split, label %bb42
+
+bb42:		; preds = %bb37
+	store i32 0, i32* %tmp35, align 4
+	br label %bb51.split
+
+bb51.split:		; preds = %bb42, %bb37
+	%pdest.4 = phi i32 [ 1, %bb42 ], [ %pdest.5, %bb37 ]		; <i32> [#uses=3]
+	br i1 %tmp53, label %bb33, label %bb56.preheader
+
+bb56.preheader:		; preds = %bb51.split
+	%tmp7394 = icmp sgt i32 %j.1, 0		; <i1> [#uses=1]
+	br i1 %tmp7394, label %bb56.us, label %bb56
+
+bb56.us:		; preds = %bb76.loopexit.us, %bb56.preheader
+	%pdest.8.us = phi i32 [ %pdest.4, %bb56.preheader ], [ %pdest.7.us, %bb76.loopexit.us ]		; <i32> [#uses=1]
+	%k_addr.1.us = phi i32 [ %k_addr.0, %bb56.preheader ], [ %tmp59.us, %bb76.loopexit.us ]		; <i32> [#uses=1]
+	%tmp58.us = getelementptr [1 x i32]* @Link, i32 0, i32 %k_addr.1.us		; <i32*> [#uses=1]
+	%tmp59.us = load i32* %tmp58.us, align 4		; <i32> [#uses=3]
+	%tmp6295.us = icmp ne i32 %tmp59.us, -1		; <i1> [#uses=2]
+	br label %bb60.us
+
+bb60.us:		; preds = %bb60.us, %bb56.us
+	%pdest.7.reg2mem.0.us = phi i32 [ %pdest.8.us, %bb56.us ], [ %pdest.7.us, %bb60.us ]		; <i32> [#uses=1]
+	%p_addr.1.reg2mem.0.us = phi i32 [ 0, %bb56.us ], [ %p_addr.1.us, %bb60.us ]		; <i32> [#uses=1]
+	%tmp67.us = zext i1 %tmp6295.us to i32		; <i32> [#uses=2]
+	%pdest.7.us = add i32 %pdest.7.reg2mem.0.us, %tmp67.us		; <i32> [#uses=3]
+	%p_addr.1.us = add i32 %p_addr.1.reg2mem.0.us, %tmp67.us		; <i32> [#uses=3]
+	%tmp73.us = icmp slt i32 %p_addr.1.us, %j.1		; <i1> [#uses=1]
+	br i1 %tmp73.us, label %bb60.us, label %bb76.loopexit.us
+
+bb76.loopexit.us:		; preds = %bb60.us
+	br i1 %tmp6295.us, label %bb56.us, label %bb
+
+bb56:		; preds = %bb56, %bb56.preheader
+	%pdest.8 = phi i32 [ %pdest.4, %bb56.preheader ], [ %pdest.8, %bb56 ]		; <i32> [#uses=2]
+	%k_addr.1 = phi i32 [ %k_addr.0, %bb56.preheader ], [ %tmp59, %bb56 ]		; <i32> [#uses=1]
+	%tmp58 = getelementptr [1 x i32]* @Link, i32 0, i32 %k_addr.1		; <i32*> [#uses=1]
+	%tmp59 = load i32* %tmp58, align 4		; <i32> [#uses=3]
+	%tmp6295 = icmp ne i32 %tmp59, -1		; <i1> [#uses=1]
+	br i1 %tmp6295, label %bb56, label %bb
+
+bb82:		; preds = %bb13
+	ret i32 %pdest.1
+}
+
+define i32 @main() nounwind  {
+entry:
+	%tmp1 = tail call i32 @f( i32 0, i32 2 ) nounwind 		; <i32> [#uses=1]
+	%tmp2 = icmp eq i32 %tmp1, 0		; <i1> [#uses=1]
+	br i1 %tmp2, label %bb, label %bb4
+
+bb:		; preds = %entry
+	tail call void @abort( ) noreturn nounwind 
+	unreachable
+
+bb4:		; preds = %entry
+	ret i32 0
+}
+
+declare void @abort() noreturn nounwind 

Added: llvm/branches/non-call-eh/test/Transforms/JumpThreading/2008-05-05-MRV-Crash.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/JumpThreading/2008-05-05-MRV-Crash.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/JumpThreading/2008-05-05-MRV-Crash.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/JumpThreading/2008-05-05-MRV-Crash.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,25 @@
+; RUN: llvm-as < %s | opt -jump-threading -disable-output
+; PR2285
+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"
+	%struct.system__secondary_stack__mark_id = type { i64, i64 }
+
+define void @_ada_c35507b() {
+entry:
+	br label %bb
+
+bb:		; preds = %bb13, %entry
+	%ch.0 = phi i8 [ 0, %entry ], [ 0, %bb13 ]		; <i8> [#uses=1]
+	%tmp11 = icmp ugt i8 %ch.0, 31		; <i1> [#uses=1]
+	%tmp120 = call %struct.system__secondary_stack__mark_id @system__secondary_stack__ss_mark( )		; <%struct.system__secondary_stack__mark_id> [#uses=1]
+	br i1 %tmp11, label %bb110, label %bb13
+
+bb13:		; preds = %bb
+	br label %bb
+
+bb110:		; preds = %bb
+	%mrv_gr124 = getresult %struct.system__secondary_stack__mark_id %tmp120, 1		; <i64> [#uses=0]
+	unreachable
+}
+
+declare %struct.system__secondary_stack__mark_id @system__secondary_stack__ss_mark()

Added: llvm/branches/non-call-eh/test/Transforms/JumpThreading/and-and-cond.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/JumpThreading/and-and-cond.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/JumpThreading/and-and-cond.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/JumpThreading/and-and-cond.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,33 @@
+; RUN: llvm-as < %s | opt -jump-threading -mem2reg -instcombine -simplifycfg  | llvm-dis | grep {ret i32 %v1}
+; There should be no uncond branches left.
+; RUN: llvm-as < %s | opt -jump-threading -mem2reg -instcombine -simplifycfg  | llvm-dis | not grep {br label}
+
+declare i32 @f1()
+declare i32 @f2()
+declare void @f3()
+
+define i32 @test(i1 %cond, i1 %cond2, i1 %cond3) {
+	br i1 %cond, label %T1, label %F1
+
+T1:
+	%v1 = call i32 @f1()
+	br label %Merge
+
+F1:
+	%v2 = call i32 @f2()
+	br label %Merge
+
+Merge:
+	%A = phi i1 [true, %T1], [false, %F1]
+	%B = phi i32 [%v1, %T1], [%v2, %F1]
+	%C = and i1 %A, %cond2
+	%D = and i1 %C, %cond3
+	br i1 %D, label %T2, label %F2
+
+T2:
+	call void @f3()
+	ret i32 %B
+
+F2:
+	ret i32 %B
+}

Added: llvm/branches/non-call-eh/test/Transforms/JumpThreading/and-cond.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/JumpThreading/and-cond.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/JumpThreading/and-cond.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/JumpThreading/and-cond.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,32 @@
+; RUN: llvm-as < %s | opt -jump-threading -mem2reg -instcombine -simplifycfg  | llvm-dis | grep {ret i32 %v1}
+; There should be no uncond branches left.
+; RUN: llvm-as < %s | opt -jump-threading -mem2reg -instcombine -simplifycfg  | llvm-dis | not grep {br label}
+
+declare i32 @f1()
+declare i32 @f2()
+declare void @f3()
+
+define i32 @test(i1 %cond, i1 %cond2) {
+	br i1 %cond, label %T1, label %F1
+
+T1:
+	%v1 = call i32 @f1()
+	br label %Merge
+
+F1:
+	%v2 = call i32 @f2()
+	br label %Merge
+
+Merge:
+	%A = phi i1 [true, %T1], [false, %F1]
+	%B = phi i32 [%v1, %T1], [%v2, %F1]
+	%C = and i1 %A, %cond2
+	br i1 %C, label %T2, label %F2
+
+T2:
+	call void @f3()
+	ret i32 %B
+
+F2:
+	ret i32 %B
+}

Added: llvm/branches/non-call-eh/test/Transforms/JumpThreading/basic.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/JumpThreading/basic.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/JumpThreading/basic.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/JumpThreading/basic.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,31 @@
+; RUN: llvm-as < %s | opt -jump-threading -simplifycfg -mem2reg | llvm-dis | grep {ret i32 %v1}
+; There should be no uncond branches left.
+; RUN: llvm-as < %s | opt -jump-threading -simplifycfg -mem2reg | llvm-dis | not grep {br label}
+
+declare i32 @f1()
+declare i32 @f2()
+declare void @f3()
+
+define i32 @test(i1 %cond) {
+	br i1 %cond, label %T1, label %F1
+
+T1:
+	%v1 = call i32 @f1()
+	br label %Merge
+
+F1:
+	%v2 = call i32 @f2()
+	br label %Merge
+
+Merge:
+	%A = phi i1 [true, %T1], [false, %F1]
+	%B = phi i32 [%v1, %T1], [%v2, %F1]
+	br i1 %A, label %T2, label %F2
+
+T2:
+	call void @f3()
+	ret i32 %B
+
+F2:
+	ret i32 %B
+}

Added: llvm/branches/non-call-eh/test/Transforms/JumpThreading/compare.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/JumpThreading/compare.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/JumpThreading/compare.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/JumpThreading/compare.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,30 @@
+; There should be no phi nodes left.
+; RUN: llvm-as < %s | opt -jump-threading -simplifycfg -mem2reg | llvm-dis | not grep {phi i32}
+
+declare i32 @f1()
+declare i32 @f2()
+declare void @f3()
+
+define i32 @test(i1 %cond) {
+	br i1 %cond, label %T1, label %F1
+
+T1:
+	%v1 = call i32 @f1()
+	br label %Merge
+
+F1:
+	%v2 = call i32 @f2()
+	br label %Merge
+
+Merge:
+	%B = phi i32 [%v1, %T1], [12, %F1]
+	%A = icmp ne i32 %B, 42
+	br i1 %A, label %T2, label %F2
+
+T2:
+	call void @f3()
+	ret i32 1
+
+F2:
+	ret i32 0
+}

Added: llvm/branches/non-call-eh/test/Transforms/JumpThreading/dg.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/JumpThreading/dg.exp?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/JumpThreading/dg.exp (added)
+++ llvm/branches/non-call-eh/test/Transforms/JumpThreading/dg.exp Sun Jul  6 15:45:41 2008
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.ll]]

Modified: llvm/branches/non-call-eh/test/Transforms/LCSSA/dg.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/LCSSA/dg.exp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/LCSSA/dg.exp (original)
+++ llvm/branches/non-call-eh/test/Transforms/LCSSA/dg.exp Sun Jul  6 15:45:41 2008
@@ -1,3 +1,3 @@
 load_lib llvm.exp
 
-RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]

Modified: llvm/branches/non-call-eh/test/Transforms/LICM/2003-02-27-PreheaderProblem.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/LICM/2003-02-27-PreheaderProblem.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/LICM/2003-02-27-PreheaderProblem.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/LICM/2003-02-27-PreheaderProblem.ll Sun Jul  6 15:45:41 2008
@@ -3,7 +3,7 @@
 ; happens because preheader insertion doesn't insert a preheader for this
 ; case... bad.
 
-; RUN: llvm-as < %s | opt -licm -adce -simplifycfg | llvm-dis | \
+; RUN: llvm-as < %s | opt -licm -loop-deletion -simplifycfg | llvm-dis | \
 ; RUN:   not grep {br }
 
 define i32 @main(i32 %argc) {

Added: llvm/branches/non-call-eh/test/Transforms/LICM/2008-05-20-AliasSetVAArg.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/LICM/2008-05-20-AliasSetVAArg.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/LICM/2008-05-20-AliasSetVAArg.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/LICM/2008-05-20-AliasSetVAArg.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,30 @@
+; RUN: llvm-as < %s | opt -licm -disable-output
+; PR2346
+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-pc-linux-gnu"
+	%struct._zval_struct = type { %union._double, i32, i8, i8, i8, i8 }
+	%union._double = type { double }
+
+define i8* @zend_fetch_resource(%struct._zval_struct** %passed_id, i32 %default_id, i8* %resource_type_name, i32* %found_resource_type, i32 %num_resource_types, ...) {
+entry:
+	br label %whilebody.i.i
+
+whilebody.i.i:		; preds = %whilebody.i.i, %entry
+	br i1 false, label %ifthen.i.i, label %whilebody.i.i
+
+ifthen.i.i:		; preds = %whilebody.i.i
+	br label %forcond
+
+forcond:		; preds = %forbody, %ifthen.i.i
+	br i1 false, label %forbody, label %afterfor
+
+forbody:		; preds = %forcond
+	va_arg i8** null, i32		; <i32>:0 [#uses=0]
+	br i1 false, label %ifthen59, label %forcond
+
+ifthen59:		; preds = %forbody
+	unreachable
+
+afterfor:		; preds = %forcond
+	ret i8* null
+}

Modified: llvm/branches/non-call-eh/test/Transforms/LICM/dg.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/LICM/dg.exp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/LICM/dg.exp (original)
+++ llvm/branches/non-call-eh/test/Transforms/LICM/dg.exp Sun Jul  6 15:45:41 2008
@@ -1,3 +1,3 @@
 load_lib llvm.exp
 
-RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]

Propchange: llvm/branches/non-call-eh/test/Transforms/LoopDeletion/

------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sun Jul  6 15:45:41 2008
@@ -0,0 +1 @@
+Output

Added: llvm/branches/non-call-eh/test/Transforms/LoopDeletion/2007-07-23-InfiniteLoop.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/LoopDeletion/2007-07-23-InfiniteLoop.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/LoopDeletion/2007-07-23-InfiniteLoop.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/LoopDeletion/2007-07-23-InfiniteLoop.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,13 @@
+; RUN: llvm-as < %s | opt -loop-deletion | llvm-dis | grep switch
+; PR 1564
+  
+define fastcc void @out() {
+    start:
+            br label %loop
+    unreachable:
+            unreachable
+    loop:
+            switch i32 0, label %unreachable [
+                     i32 0, label %loop
+            ]
+}

Added: llvm/branches/non-call-eh/test/Transforms/LoopDeletion/2008-05-06-Phi.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/LoopDeletion/2008-05-06-Phi.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/LoopDeletion/2008-05-06-Phi.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/LoopDeletion/2008-05-06-Phi.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,109 @@
+; RUN: llvm-as < %s | opt -inline -tailduplicate -instcombine -jump-threading -licm -loop-unswitch -instcombine -indvars -loop-deletion -gvn -simplifycfg -verify 
+
+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"
+	%struct.BF_BitstreamElement = type { i32, i16 }
+	%struct.BF_BitstreamPart = type { i32, %struct.BF_BitstreamElement* }
+	%struct.BF_PartHolder = type { i32, %struct.BF_BitstreamPart* }
+	%struct.Bit_stream_struc = type { i8*, i32, %struct.FILE*, i8*, i32, i32, i32, i32 }
+	%struct.FILE = type { i8*, i32, i32, i16, i16, %struct.__sbuf, i32, i8*, i32 (i8*)*, i32 (i8*, i8*, i32)*, i64 (i8*, i64, i32)*, i32 (i8*, i8*, i32)*, %struct.__sbuf, %struct.__sFILEX*, i32, [3 x i8], [1 x i8], %struct.__sbuf, i32, i64 }
+	%struct.III_scalefac_t = type { [22 x i32], [13 x [3 x i32]] }
+	%struct.III_side_info_t = type { i32, i32, i32, [2 x [4 x i32]], [2 x %struct.anon] }
+	%struct.__sFILEX = type opaque
+	%struct.__sbuf = type { i8*, i32 }
+	%struct.anon = type { [2 x %struct.gr_info_ss] }
+	%struct.gr_info = type { i32, i32, i32, i32, i32, i32, i32, i32, [3 x i32], [3 x i32], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32*, [4 x i32] }
+	%struct.gr_info_ss = type { %struct.gr_info }
+	%struct.lame_global_flags = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i8*, i8*, i32, i32, float, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, float, i32, i32, i32, float, float, float, float, i32, i32, i32, i32, i32, i32, i32, i32 }
+ at scaleFactorsPH = external global [2 x [2 x %struct.BF_PartHolder*]]		; <[2 x [2 x %struct.BF_PartHolder*]]*> [#uses=1]
+ at slen1_tab = external constant [16 x i32]		; <[16 x i32]*> [#uses=1]
+
+declare %struct.BF_PartHolder* @BF_addElement(%struct.BF_PartHolder*, %struct.BF_BitstreamElement*) nounwind 
+
+define %struct.BF_PartHolder* @BF_addEntry(%struct.BF_PartHolder* %thePH, i32 %value, i32 %length) nounwind  {
+entry:
+	%myElement = alloca %struct.BF_BitstreamElement		; <%struct.BF_BitstreamElement*> [#uses=2]
+	%tmp1 = getelementptr %struct.BF_BitstreamElement* %myElement, i32 0, i32 0		; <i32*> [#uses=1]
+	store i32 %value, i32* %tmp1, align 8
+	%tmp7 = icmp eq i32 %length, 0		; <i1> [#uses=1]
+	br i1 %tmp7, label %bb13, label %bb
+
+bb:		; preds = %entry
+	%tmp10 = call %struct.BF_PartHolder* @BF_addElement( %struct.BF_PartHolder* %thePH, %struct.BF_BitstreamElement* %myElement ) nounwind 		; <%struct.BF_PartHolder*> [#uses=1]
+	ret %struct.BF_PartHolder* %tmp10
+
+bb13:		; preds = %entry
+	ret %struct.BF_PartHolder* %thePH
+}
+
+define void @III_format_bitstream(%struct.lame_global_flags* %gfp, i32 %bitsPerFrame, [2 x [576 x i32]]* %l3_enc, %struct.III_side_info_t* %l3_side, [2 x %struct.III_scalefac_t]* %scalefac, %struct.Bit_stream_struc* %in_bs) nounwind  {
+entry:
+	call fastcc void @encodeMainData( %struct.lame_global_flags* %gfp, [2 x [576 x i32]]* %l3_enc, %struct.III_side_info_t* %l3_side, [2 x %struct.III_scalefac_t]* %scalefac ) nounwind 
+	unreachable
+}
+
+define internal fastcc void @encodeMainData(%struct.lame_global_flags* %gfp, [2 x [576 x i32]]* %l3_enc, %struct.III_side_info_t* %si, [2 x %struct.III_scalefac_t]* %scalefac) nounwind  {
+entry:
+	%tmp69 = getelementptr %struct.lame_global_flags* %gfp, i32 0, i32 43		; <i32*> [#uses=1]
+	%tmp70 = load i32* %tmp69, align 4		; <i32> [#uses=1]
+	%tmp71 = icmp eq i32 %tmp70, 1		; <i1> [#uses=1]
+	br i1 %tmp71, label %bb352, label %bb498
+
+bb113:		; preds = %bb132
+	%tmp123 = getelementptr [2 x %struct.III_scalefac_t]* %scalefac, i32 0, i32 0, i32 1, i32 %sfb.0, i32 %window.0		; <i32*> [#uses=1]
+	%tmp124 = load i32* %tmp123, align 4		; <i32> [#uses=1]
+	%tmp126 = load %struct.BF_PartHolder** %tmp80, align 4		; <%struct.BF_PartHolder*> [#uses=1]
+	%tmp128 = call %struct.BF_PartHolder* @BF_addEntry( %struct.BF_PartHolder* %tmp126, i32 %tmp124, i32 %tmp93 ) nounwind 		; <%struct.BF_PartHolder*> [#uses=1]
+	store %struct.BF_PartHolder* %tmp128, %struct.BF_PartHolder** %tmp80, align 4
+	%tmp131 = add i32 %window.0, 1		; <i32> [#uses=1]
+	br label %bb132
+
+bb132:		; preds = %bb140, %bb113
+	%window.0 = phi i32 [ %tmp131, %bb113 ], [ 0, %bb140 ]		; <i32> [#uses=3]
+	%tmp134 = icmp slt i32 %window.0, 3		; <i1> [#uses=1]
+	br i1 %tmp134, label %bb113, label %bb137
+
+bb137:		; preds = %bb132
+	%tmp139 = add i32 %sfb.0, 1		; <i32> [#uses=1]
+	br label %bb140
+
+bb140:		; preds = %bb341, %bb137
+	%sfb.0 = phi i32 [ %tmp139, %bb137 ], [ 0, %bb341 ]		; <i32> [#uses=3]
+	%tmp142 = icmp slt i32 %sfb.0, 6		; <i1> [#uses=1]
+	br i1 %tmp142, label %bb132, label %bb174
+
+bb166:		; preds = %bb174
+	%tmp160 = load %struct.BF_PartHolder** %tmp80, align 4		; <%struct.BF_PartHolder*> [#uses=1]
+	%tmp162 = call %struct.BF_PartHolder* @BF_addEntry( %struct.BF_PartHolder* %tmp160, i32 0, i32 0 ) nounwind 		; <%struct.BF_PartHolder*> [#uses=0]
+	unreachable
+
+bb174:		; preds = %bb140
+	%tmp176 = icmp slt i32 6, 12		; <i1> [#uses=1]
+	br i1 %tmp176, label %bb166, label %bb341
+
+bb341:		; preds = %bb352, %bb174
+	%tmp80 = getelementptr [2 x [2 x %struct.BF_PartHolder*]]* @scaleFactorsPH, i32 0, i32 0, i32 0		; <%struct.BF_PartHolder**> [#uses=3]
+	%tmp92 = getelementptr [16 x i32]* @slen1_tab, i32 0, i32 0		; <i32*> [#uses=1]
+	%tmp93 = load i32* %tmp92, align 4		; <i32> [#uses=1]
+	br label %bb140
+
+bb352:		; preds = %entry
+	%tmp354 = icmp slt i32 0, 2		; <i1> [#uses=1]
+	br i1 %tmp354, label %bb341, label %return
+
+bb498:		; preds = %entry
+	ret void
+
+return:		; preds = %bb352
+	ret void
+}
+
+define void @getframebits(%struct.lame_global_flags* %gfp, i32* %bitsPerFrame, i32* %mean_bits) nounwind  {
+entry:
+	unreachable
+}
+
+define i32 @lame_encode_buffer(%struct.lame_global_flags* %gfp, i16* %buffer_l, i16* %buffer_r, i32 %nsamples, i8* %mp3buf, i32 %mp3buf_size) nounwind  {
+entry:
+	unreachable
+}

Added: llvm/branches/non-call-eh/test/Transforms/LoopDeletion/dcetest.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/LoopDeletion/dcetest.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/LoopDeletion/dcetest.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/LoopDeletion/dcetest.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,36 @@
+; This is the test case taken from Appel's book that illustrates a hard case
+; that SCCP gets right, and when followed by ADCE, is completely eliminated
+;
+; RUN: llvm-as < %s | opt -sccp -simplifycfg -indvars -loop-deletion -dce -simplifycfg | llvm-dis | not grep br
+
+define i32 @"test function"(i32 %i0, i32 %j0) {
+BB1:
+        br label %BB2
+
+BB2:            ; preds = %BB7, %BB1
+        %j2 = phi i32 [ %j4, %BB7 ], [ 1, %BB1 ]                ; <i32> [#uses=2]
+        %k2 = phi i32 [ %k4, %BB7 ], [ 0, %BB1 ]                ; <i32> [#uses=4]
+        %kcond = icmp slt i32 %k2, 100          ; <i1> [#uses=1]
+        br i1 %kcond, label %BB3, label %BB4
+
+BB3:            ; preds = %BB2
+        %jcond = icmp slt i32 %j2, 20           ; <i1> [#uses=1]
+        br i1 %jcond, label %BB5, label %BB6
+
+BB4:            ; preds = %BB2
+        ret i32 %j2
+
+BB5:            ; preds = %BB3
+        %k3 = add i32 %k2, 1            ; <i32> [#uses=1]
+        br label %BB7
+
+BB6:            ; preds = %BB3
+        %k5 = add i32 %k2, 1            ; <i32> [#uses=1]
+        br label %BB7
+
+BB7:            ; preds = %BB6, %BB5
+        %j4 = phi i32 [ 1, %BB5 ], [ %k2, %BB6 ]                ; <i32> [#uses=1]
+        %k4 = phi i32 [ %k3, %BB5 ], [ %k5, %BB6 ]              ; <i32> [#uses=1]
+        br label %BB2
+}
+

Added: llvm/branches/non-call-eh/test/Transforms/LoopDeletion/dg.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/LoopDeletion/dg.exp?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/LoopDeletion/dg.exp (added)
+++ llvm/branches/non-call-eh/test/Transforms/LoopDeletion/dg.exp Sun Jul  6 15:45:41 2008
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]

Added: llvm/branches/non-call-eh/test/Transforms/LoopIndexSplit/2008-05-19-IndVar.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/LoopIndexSplit/2008-05-19-IndVar.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/LoopIndexSplit/2008-05-19-IndVar.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/LoopIndexSplit/2008-05-19-IndVar.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,41 @@
+; RUN: llvm-as < %s | opt -loop-index-split | llvm-dis | grep tmp8 | count 3
+; count 3 = increment + phi + store
+;PR2294
+ at g_2 = external global i16		; <i16*> [#uses=4]
+ at g_5 = external global i32		; <i32*> [#uses=1]
+ at .str = external constant [4 x i8]		; <[4 x i8]*> [#uses=1]
+
+declare void @func_1() nounwind 
+
+define i32 @main() nounwind  {
+entry:
+	%tmp101.i = load i16* @g_2, align 2		; <i16> [#uses=1]
+	%tmp112.i = icmp sgt i16 %tmp101.i, 0		; <i1> [#uses=1]
+	br i1 %tmp112.i, label %bb.preheader.i, label %func_1.exit
+bb.preheader.i:		; preds = %entry
+	%g_2.promoted.i = load i16* @g_2		; <i16> [#uses=1]
+	br label %bb.i
+bb.i:		; preds = %bb6.i, %bb.preheader.i
+	%g_2.tmp.0.i = phi i16 [ %g_2.promoted.i, %bb.preheader.i ], [ %tmp8.i, %bb6.i ]		; <i16> [#uses=2]
+	%tmp2.i = icmp eq i16 %g_2.tmp.0.i, 0		; <i1> [#uses=1]
+	br i1 %tmp2.i, label %bb4.i, label %bb6.i
+bb4.i:		; preds = %bb.i
+	%tmp5.i = volatile load i32* @g_5, align 4		; <i32> [#uses=0]
+	br label %bb6.i
+bb6.i:		; preds = %bb4.i, %bb.i
+	%tmp8.i = add i16 %g_2.tmp.0.i, 1		; <i16> [#uses=3]
+	%tmp11.i = icmp sgt i16 %tmp8.i, 0		; <i1> [#uses=1]
+	br i1 %tmp11.i, label %bb.i, label %return.loopexit.i
+return.loopexit.i:		; preds = %bb6.i
+	%tmp8.i.lcssa = phi i16 [ %tmp8.i, %bb6.i ]		; <i16> [#uses=1]
+	store i16 %tmp8.i.lcssa, i16* @g_2
+	br label %func_1.exit
+func_1.exit:		; preds = %return.loopexit.i, %entry
+	%tmp1 = load i16* @g_2, align 2		; <i16> [#uses=1]
+	%tmp12 = sext i16 %tmp1 to i32		; <i32> [#uses=1]
+	%tmp3 = tail call i32 (i8*, ...)* @printf( i8* getelementptr ([4 x i8]* @.str, i32 0, i32 0), i32 %tmp12 ) nounwind 		; <i32> [#uses=0]
+	ret i32 0
+}
+
+declare i32 @printf(i8*, ...) nounwind 
+

Added: llvm/branches/non-call-eh/test/Transforms/LoopIndexSplit/2008-06-03-DomFrontier.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/LoopIndexSplit/2008-06-03-DomFrontier.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/LoopIndexSplit/2008-06-03-DomFrontier.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/LoopIndexSplit/2008-06-03-DomFrontier.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,32 @@
+; RUN: llvm-as < %s | opt -loop-rotate -loop-unswitch -loop-index-split -instcombine -disable-output
+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"
+	%struct.__CFData = type opaque
+	%struct.__CFString = type opaque
+
+define %struct.__CFData* @WirelessCreatePSK(%struct.__CFString* %inPassphrase, %struct.__CFData* %inSSID) nounwind  {
+entry:
+	br label %bb52
+
+bb52:		; preds = %bb142, %bb52, %entry
+	br i1 false, label %bb142, label %bb52
+
+bb63:		; preds = %bb142, %bb131
+	%t.0.reg2mem.0 = phi i32 [ %tmp133, %bb131 ], [ 0, %bb142 ]		; <i32> [#uses=2]
+	%tmp65 = icmp ult i32 %t.0.reg2mem.0, 16		; <i1> [#uses=1]
+	br i1 %tmp65, label %bb68, label %bb89
+
+bb68:		; preds = %bb63
+	br label %bb131
+
+bb89:		; preds = %bb63
+	br label %bb131
+
+bb131:		; preds = %bb89, %bb68
+	%tmp133 = add i32 %t.0.reg2mem.0, 1		; <i32> [#uses=2]
+	%tmp136 = icmp ult i32 %tmp133, 80		; <i1> [#uses=1]
+	br i1 %tmp136, label %bb63, label %bb142
+
+bb142:		; preds = %bb131, %bb52
+	br i1 undef, label %bb63, label %bb52
+}

Modified: llvm/branches/non-call-eh/test/Transforms/LoopIndexSplit/dg.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/LoopIndexSplit/dg.exp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/LoopIndexSplit/dg.exp (original)
+++ llvm/branches/non-call-eh/test/Transforms/LoopIndexSplit/dg.exp Sun Jul  6 15:45:41 2008
@@ -1,3 +1,3 @@
 load_lib llvm.exp
 
-RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]

Added: llvm/branches/non-call-eh/test/Transforms/LoopRotate/LRCrash-5.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/LoopRotate/LRCrash-5.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/LoopRotate/LRCrash-5.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/LoopRotate/LRCrash-5.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,26 @@
+; RUN: llvm-as < %s | opt -loop-rotate -disable-output
+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"
+	%struct.NSArray = type { %struct.NSObject }
+	%struct.NSObject = type { %struct.objc_class* }
+	%struct.NSRange = type { i64, i64 }
+	%struct._message_ref_t = type { %struct.NSObject* (%struct.NSObject*, %struct._message_ref_t*, ...)*, %struct.objc_selector* }
+	%struct.objc_class = type opaque
+	%struct.objc_selector = type opaque
+@"\01L_OBJC_MESSAGE_REF_26" = external global %struct._message_ref_t		; <%struct._message_ref_t*> [#uses=1]
+
+define %struct.NSArray* @"-[NSString(DocSetPrivateAddition) _dsa_stringAsPathComponent]"(%struct.NSArray* %self, %struct._message_ref_t* %_cmd) {
+entry:
+	br label %bb116
+
+bb116:		; preds = %bb131, %entry
+	%tmp123 = call %struct.NSRange null( %struct.NSObject* null, %struct._message_ref_t* @"\01L_OBJC_MESSAGE_REF_26", %struct.NSArray* null )		; <%struct.NSRange> [#uses=1]
+	br i1 false, label %bb141, label %bb131
+
+bb131:		; preds = %bb116
+	%mrv_gr125 = getresult %struct.NSRange %tmp123, 1		; <i64> [#uses=0]
+	br label %bb116
+
+bb141:		; preds = %bb116
+	ret %struct.NSArray* null
+}

Modified: llvm/branches/non-call-eh/test/Transforms/LoopRotate/dg.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/LoopRotate/dg.exp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/LoopRotate/dg.exp (original)
+++ llvm/branches/non-call-eh/test/Transforms/LoopRotate/dg.exp Sun Jul  6 15:45:41 2008
@@ -1,3 +1,3 @@
 load_lib llvm.exp
 
-RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]

Removed: llvm/branches/non-call-eh/test/Transforms/LoopRotate/pr1154.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/LoopRotate/pr1154.ll?rev=53162&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/LoopRotate/pr1154.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/LoopRotate/pr1154.ll (removed)
@@ -1,127 +0,0 @@
-; RUN: llvm-as < %s | opt -std-compile-opts | llvm-dis | \
-; RUN:   %prcontext strstr 2 | grep -v declare | grep bb36.outer:
-
- at str = internal constant [68 x i8] c"Dot. date. datum. 123. Some more doubtful demonstration dummy data.\00"		; <[68 x i8]*> [#uses=1]
- at str1 = internal constant [5 x i8] c"ummy\00"		; <[5 x i8]*> [#uses=1]
- at str2 = internal constant [6 x i8] c" data\00"		; <[6 x i8]*> [#uses=1]
- at str3 = internal constant [3 x i8] c"by\00"		; <[3 x i8]*> [#uses=1]
-
-define i32 @stringSearch_Clib(i32 %count) {
-entry:
-	%count_addr = alloca i32		; <i32*> [#uses=2]
-	%retval = alloca i32, align 4		; <i32*> [#uses=2]
-	%tmp = alloca i32, align 4		; <i32*> [#uses=2]
-	%i = alloca i32, align 4		; <i32*> [#uses=5]
-	%c = alloca i32, align 4		; <i32*> [#uses=9]
-	%j = alloca i32, align 4		; <i32*> [#uses=4]
-	%p = alloca i8*, align 4		; <i8**> [#uses=6]
-	%b = alloca [68 x i8], align 16		; <[68 x i8]*> [#uses=6]
-	%"alloca point" = bitcast i32 0 to i32		; <i32> [#uses=0]
-	store i32 %count, i32* %count_addr
-	store i32 0, i32* %c
-	%b1 = bitcast [68 x i8]* %b to i8*		; <i8*> [#uses=1]
-	%tmp2 = getelementptr [68 x i8]* @str, i64 0, i64 0		; <i8*> [#uses=1]
-	call void @llvm.memcpy.i32( i8* %b1, i8* %tmp2, i32 68, i32 1 )
-	store i32 0, i32* %j
-	br label %bb41
-
-bb:		; preds = %bb41
-	store i32 0, i32* %i
-	%tmp3 = load i32* %i		; <i32> [#uses=1]
-	store i32 %tmp3, i32* %c
-	br label %bb36
-
-bb4:		; preds = %bb36
-	%b5 = bitcast [68 x i8]* %b to i8*		; <i8*> [#uses=1]
-	%tmp6 = getelementptr [5 x i8]* @str1, i64 0, i64 0		; <i8*> [#uses=1]
-	%tmp7 = call i8* @strstr( i8* %b5, i8* %tmp6 ) readonly		; <i8*> [#uses=1]
-	store i8* %tmp7, i8** %p
-	%tmp8 = load i8** %p		; <i8*> [#uses=1]
-	%ttmp8 = icmp ne i8* %tmp8, null		; <i1> [#uses=1]
-	%ttmp10 = zext i1 %ttmp8 to i8		; <i8> [#uses=1]
-	%ttmp7 = icmp ne i8 %ttmp10, 0		; <i1> [#uses=1]
-	br i1 %ttmp7, label %cond_true, label %cond_next
-
-cond_true:		; preds = %bb4
-	%tmp9 = load i8** %p		; <i8*> [#uses=1]
-	%tmp910 = ptrtoint i8* %tmp9 to i32		; <i32> [#uses=1]
-	%b11 = bitcast [68 x i8]* %b to i8*		; <i8*> [#uses=1]
-	%b1112 = ptrtoint i8* %b11 to i32		; <i32> [#uses=1]
-	%tmp13 = sub i32 %tmp910, %b1112		; <i32> [#uses=1]
-	%tmp14 = load i32* %c		; <i32> [#uses=1]
-	%tmp15 = add i32 %tmp13, %tmp14		; <i32> [#uses=1]
-	store i32 %tmp15, i32* %c
-	br label %cond_next
-
-cond_next:		; preds = %cond_true, %bb4
-	%b16 = bitcast [68 x i8]* %b to i8*		; <i8*> [#uses=1]
-	%tmp17 = getelementptr [6 x i8]* @str2, i64 0, i64 0		; <i8*> [#uses=1]
-	%tmp18 = call i8* @strstr( i8* %b16, i8* %tmp17 ) readonly		; <i8*> [#uses=1]
-	store i8* %tmp18, i8** %p
-	%tmp19 = load i8** %p		; <i8*> [#uses=1]
-	%ttmp6 = icmp ne i8* %tmp19, null		; <i1> [#uses=1]
-	%ttmp9 = zext i1 %ttmp6 to i8		; <i8> [#uses=1]
-	%ttmp4 = icmp ne i8 %ttmp9, 0		; <i1> [#uses=1]
-	br i1 %ttmp4, label %cond_true20, label %cond_next28
-
-cond_true20:		; preds = %cond_next
-	%tmp21 = load i8** %p		; <i8*> [#uses=1]
-	%tmp2122 = ptrtoint i8* %tmp21 to i32		; <i32> [#uses=1]
-	%b23 = bitcast [68 x i8]* %b to i8*		; <i8*> [#uses=1]
-	%b2324 = ptrtoint i8* %b23 to i32		; <i32> [#uses=1]
-	%tmp25 = sub i32 %tmp2122, %b2324		; <i32> [#uses=1]
-	%tmp26 = load i32* %c		; <i32> [#uses=1]
-	%tmp27 = add i32 %tmp25, %tmp26		; <i32> [#uses=1]
-	store i32 %tmp27, i32* %c
-	br label %cond_next28
-
-cond_next28:		; preds = %cond_true20, %cond_next
-	%b29 = bitcast [68 x i8]* %b to i8*		; <i8*> [#uses=1]
-	%tmp30 = getelementptr [3 x i8]* @str3, i64 0, i64 0		; <i8*> [#uses=1]
-	%tmp31 = call i32 @strcspn( i8* %b29, i8* %tmp30 ) readonly		; <i32> [#uses=1]
-	%tmp32 = load i32* %c		; <i32> [#uses=1]
-	%tmp33 = add i32 %tmp31, %tmp32		; <i32> [#uses=1]
-	store i32 %tmp33, i32* %c
-	%tmp34 = load i32* %i		; <i32> [#uses=1]
-	%tmp35 = add i32 %tmp34, 1		; <i32> [#uses=1]
-	store i32 %tmp35, i32* %i
-	br label %bb36
-
-bb36:		; preds = %cond_next28, %bb
-	%tmp37 = load i32* %i		; <i32> [#uses=1]
-	%ttmp3 = icmp sle i32 %tmp37, 249		; <i1> [#uses=1]
-	%ttmp12 = zext i1 %ttmp3 to i8		; <i8> [#uses=1]
-	%ttmp1 = icmp ne i8 %ttmp12, 0		; <i1> [#uses=1]
-	br i1 %ttmp1, label %bb4, label %bb38
-
-bb38:		; preds = %bb36
-	%tmp39 = load i32* %j		; <i32> [#uses=1]
-	%tmp40 = add i32 %tmp39, 1		; <i32> [#uses=1]
-	store i32 %tmp40, i32* %j
-	br label %bb41
-
-bb41:		; preds = %bb38, %entry
-	%tmp42 = load i32* %j		; <i32> [#uses=1]
-	%tmp43 = load i32* %count_addr		; <i32> [#uses=1]
-	%ttmp2 = icmp slt i32 %tmp42, %tmp43		; <i1> [#uses=1]
-	%ttmp11 = zext i1 %ttmp2 to i8		; <i8> [#uses=1]
-	%ttmp5 = icmp ne i8 %ttmp11, 0		; <i1> [#uses=1]
-	br i1 %ttmp5, label %bb, label %bb44
-
-bb44:		; preds = %bb41
-	%tmp45 = load i32* %c		; <i32> [#uses=1]
-	store i32 %tmp45, i32* %tmp
-	%tmp46 = load i32* %tmp		; <i32> [#uses=1]
-	store i32 %tmp46, i32* %retval
-	br label %return
-
-return:		; preds = %bb44
-	%retval47 = load i32* %retval		; <i32> [#uses=1]
-	ret i32 %retval47
-}
-
-declare void @llvm.memcpy.i32(i8*, i8*, i32, i32)
-
-declare i8* @strstr(i8*, i8*) readonly
-
-declare i32 @strcspn(i8*, i8*) readonly

Modified: llvm/branches/non-call-eh/test/Transforms/LoopSimplify/dg.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/LoopSimplify/dg.exp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/LoopSimplify/dg.exp (original)
+++ llvm/branches/non-call-eh/test/Transforms/LoopSimplify/dg.exp Sun Jul  6 15:45:41 2008
@@ -1,3 +1,3 @@
 load_lib llvm.exp
 
-RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]

Added: llvm/branches/non-call-eh/test/Transforms/LoopStrengthReduce/change-compare-stride-trickiness-0.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/LoopStrengthReduce/change-compare-stride-trickiness-0.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/LoopStrengthReduce/change-compare-stride-trickiness-0.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/LoopStrengthReduce/change-compare-stride-trickiness-0.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,24 @@
+; RUN: llvm-as < %s | llc --x86-asm-syntax=att | grep {cmpl	\$4}
+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"
+
+; This is like change-compare-stride-trickiness-1.ll except the comparison
+; happens before the relevant use, so the comparison stride can't be
+; easily changed.
+
+define void @foo() {
+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
+}

Added: llvm/branches/non-call-eh/test/Transforms/LoopStrengthReduce/change-compare-stride-trickiness-1.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/LoopStrengthReduce/change-compare-stride-trickiness-1.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/LoopStrengthReduce/change-compare-stride-trickiness-1.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/LoopStrengthReduce/change-compare-stride-trickiness-1.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,24 @@
+; RUN: llvm-as < %s | llc --x86-asm-syntax=att | grep {cmpl	\$8}
+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"
+
+; This is like change-compare-stride-trickiness-0.ll except the comparison
+; happens after the relevant use, so the comparison stride can be
+; easily changed.
+
+define void @foo() {
+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=0]
+	%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]
+	br i1 %tmp611.us1535, label %exit, label %loop
+
+exit:
+	ret void
+}

Added: llvm/branches/non-call-eh/test/Transforms/LoopStrengthReduce/dead-phi.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/LoopStrengthReduce/dead-phi.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/LoopStrengthReduce/dead-phi.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/LoopStrengthReduce/dead-phi.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,21 @@
+; RUN: llvm-as < %s | opt -loop-reduce | llvm-dis | grep phi | count 1
+
+define void @foo(i32 %n) {
+entry:
+  br label %loop
+
+loop:
+  %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
+
+  ; These three instructions form an isolated cycle and can be deleted.
+  %j = phi i32 [ 0, %entry ], [ %j.y, %loop ]
+  %j.x = add i32 %j, 1
+  %j.y = mul i32 %j.x, 2
+
+  %i.next = add i32 %i, 1
+  %c = icmp ne i32 %i.next, %n
+  br i1 %c, label %loop, label %exit
+
+exit:
+  ret void
+}

Modified: llvm/branches/non-call-eh/test/Transforms/LoopStrengthReduce/dg.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/LoopStrengthReduce/dg.exp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/LoopStrengthReduce/dg.exp (original)
+++ llvm/branches/non-call-eh/test/Transforms/LoopStrengthReduce/dg.exp Sun Jul  6 15:45:41 2008
@@ -1,3 +1,3 @@
 load_lib llvm.exp
 
-RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]

Modified: llvm/branches/non-call-eh/test/Transforms/LoopStrengthReduce/dont-hoist-simple-loop-constants.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/LoopStrengthReduce/dont-hoist-simple-loop-constants.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/LoopStrengthReduce/dont-hoist-simple-loop-constants.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/LoopStrengthReduce/dont-hoist-simple-loop-constants.ll Sun Jul  6 15:45:41 2008
@@ -1,5 +1,5 @@
 ; RUN: llvm-as < %s | opt -loop-reduce | llvm-dis | \
-; RUN:   not grep {cast uint 1 to uint}
+; RUN:   not grep {bitcast i32 1 to i32}
 ; END.
 ; The setlt wants to use a value that is incremented one more than the dominant
 ; IV.  Don't insert the 1 outside the loop, preventing folding it into the add.

Modified: llvm/branches/non-call-eh/test/Transforms/LoopUnroll/dg.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/LoopUnroll/dg.exp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/LoopUnroll/dg.exp (original)
+++ llvm/branches/non-call-eh/test/Transforms/LoopUnroll/dg.exp Sun Jul  6 15:45:41 2008
@@ -1,3 +1,3 @@
 load_lib llvm.exp
 
-RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]

Added: llvm/branches/non-call-eh/test/Transforms/LoopUnswitch/2008-06-02-DomInfo.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/LoopUnswitch/2008-06-02-DomInfo.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/LoopUnswitch/2008-06-02-DomInfo.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/LoopUnswitch/2008-06-02-DomInfo.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,26 @@
+; RUN: llvm-as < %s | opt -loop-unswitch -instcombine -gvn -disable-output
+; PR2372
+target triple = "i386-pc-linux-gnu"
+
+define i32 @func_3(i16 signext  %p_5, i16 signext  %p_6) nounwind  {
+entry:
+	%tmp3 = icmp eq i16 %p_5, 0		; <i1> [#uses=1]
+	%tmp1314 = sext i16 %p_6 to i32		; <i32> [#uses=1]
+	%tmp28 = icmp ugt i32 %tmp1314, 3		; <i1> [#uses=1]
+	%bothcond = or i1 %tmp28, false		; <i1> [#uses=1]
+	br label %bb
+bb:		; preds = %bb54, %entry
+	br i1 %tmp3, label %bb54, label %bb5
+bb5:		; preds = %bb
+	br i1 %bothcond, label %bb54, label %bb31
+bb31:		; preds = %bb5
+	br label %bb54
+bb54:		; preds = %bb31, %bb5, %bb
+	br i1 false, label %bb64, label %bb
+bb64:		; preds = %bb54
+	%tmp6566 = sext i16 %p_6 to i32		; <i32> [#uses=1]
+	%tmp68 = tail call i32 (...)* @func_18( i32 1, i32 %tmp6566, i32 1 ) nounwind 		; <i32> [#uses=0]
+	ret i32 undef
+}
+
+declare i32 @func_18(...)

Added: llvm/branches/non-call-eh/test/Transforms/LoopUnswitch/2008-06-17-DomFrontier.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/LoopUnswitch/2008-06-17-DomFrontier.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/LoopUnswitch/2008-06-17-DomFrontier.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/LoopUnswitch/2008-06-17-DomFrontier.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,22 @@
+; RUN: llvm-as < %s | opt -licm -loop-unswitch -disable-output
+ at g_56 = external global i16		; <i16*> [#uses=2]
+
+define i32 @func_67(i32 %p_68, i8 signext  %p_69, i8 signext  %p_71) nounwind  {
+entry:
+	br label %bb
+bb:		; preds = %bb44, %entry
+	br label %bb3
+bb3:		; preds = %bb36, %bb
+	%bothcond = or i1 false, false		; <i1> [#uses=1]
+	br i1 %bothcond, label %bb29, label %bb19
+bb19:		; preds = %bb3
+	br i1 false, label %bb36, label %bb29
+bb29:		; preds = %bb19, %bb3
+	ret i32 0
+bb36:		; preds = %bb19
+	store i16 0, i16* @g_56, align 2
+	br i1 false, label %bb44, label %bb3
+bb44:		; preds = %bb44, %bb36
+	%tmp46 = load i16* @g_56, align 2		; <i16> [#uses=0]
+	br i1 false, label %bb, label %bb44
+}

Modified: llvm/branches/non-call-eh/test/Transforms/LoopUnswitch/dg.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/LoopUnswitch/dg.exp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/LoopUnswitch/dg.exp (original)
+++ llvm/branches/non-call-eh/test/Transforms/LoopUnswitch/dg.exp Sun Jul  6 15:45:41 2008
@@ -1,3 +1,3 @@
 load_lib llvm.exp
 
-RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]

Modified: llvm/branches/non-call-eh/test/Transforms/LowerInvoke/dg.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/LowerInvoke/dg.exp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/LowerInvoke/dg.exp (original)
+++ llvm/branches/non-call-eh/test/Transforms/LowerInvoke/dg.exp Sun Jul  6 15:45:41 2008
@@ -1,3 +1,3 @@
 load_lib llvm.exp
 
-RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]

Modified: llvm/branches/non-call-eh/test/Transforms/LowerSetJmp/dg.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/LowerSetJmp/dg.exp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/LowerSetJmp/dg.exp (original)
+++ llvm/branches/non-call-eh/test/Transforms/LowerSetJmp/dg.exp Sun Jul  6 15:45:41 2008
@@ -1,3 +1,3 @@
 load_lib llvm.exp
 
-RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]

Modified: llvm/branches/non-call-eh/test/Transforms/LowerSwitch/dg.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/LowerSwitch/dg.exp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/LowerSwitch/dg.exp (original)
+++ llvm/branches/non-call-eh/test/Transforms/LowerSwitch/dg.exp Sun Jul  6 15:45:41 2008
@@ -1,3 +1,3 @@
 load_lib llvm.exp
 
-RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]

Modified: llvm/branches/non-call-eh/test/Transforms/Mem2Reg/dg.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/Mem2Reg/dg.exp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/Mem2Reg/dg.exp (original)
+++ llvm/branches/non-call-eh/test/Transforms/Mem2Reg/dg.exp Sun Jul  6 15:45:41 2008
@@ -1,3 +1,3 @@
 load_lib llvm.exp
 
-RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]

Added: llvm/branches/non-call-eh/test/Transforms/MemCpyOpt/2008-04-29-SRetRemoval.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/MemCpyOpt/2008-04-29-SRetRemoval.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/MemCpyOpt/2008-04-29-SRetRemoval.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/MemCpyOpt/2008-04-29-SRetRemoval.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,17 @@
+; RUN: llvm-as < %s | opt -memcpyopt | llvm-dis | grep {call.*memcpy.*agg.result}
+
+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-darwin8"
+ at x = external global { x86_fp80, x86_fp80 }		; <{ x86_fp80, x86_fp80 }*> [#uses=1]
+
+define void @foo({ x86_fp80, x86_fp80 }* noalias sret %agg.result) nounwind  {
+entry:
+	%x.0 = alloca { x86_fp80, x86_fp80 }		; <{ x86_fp80, x86_fp80 }*> [#uses=1]
+	%x.01 = bitcast { x86_fp80, x86_fp80 }* %x.0 to i8*		; <i8*> [#uses=2]
+	call void @llvm.memcpy.i32( i8* %x.01, i8* bitcast ({ x86_fp80, x86_fp80 }* @x to i8*), i32 32, i32 16 )
+	%agg.result2 = bitcast { x86_fp80, x86_fp80 }* %agg.result to i8*		; <i8*> [#uses=1]
+	call void @llvm.memcpy.i32( i8* %agg.result2, i8* %x.01, i32 32, i32 16 )
+	ret void
+}
+
+declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) nounwind 

Added: llvm/branches/non-call-eh/test/Transforms/MemCpyOpt/2008-06-01-MemCpy-MemMove.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/MemCpyOpt/2008-06-01-MemCpy-MemMove.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/MemCpyOpt/2008-06-01-MemCpy-MemMove.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/MemCpyOpt/2008-06-01-MemCpy-MemMove.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,107 @@
+; RUN: llvm-as < %s | opt -memcpyopt | llvm-dis | grep {call.*memmove.*arg1.*}
+; PR2401
+
+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 = "i686-pc-linux-gnu"
+	%struct.Info = type <{ i32, i32, i8*, i8*, i8*, [32 x i8*], i32, [32 x i32], i32, i32, i32, [32 x i32] }>
+	%struct.S98 = type <{ [31 x double] }>
+	%struct._IO_FILE = type <{ i32, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, %struct._IO_marker*, %struct._IO_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._IO_FILE*, i32 }>
+	%struct.anon = type <{  }>
+	%union.anon = type {  }
+ at info = common global %struct.Info zeroinitializer, align 4		; <%struct.Info*> [#uses=13]
+ at fails = common global i32 0, align 4		; <i32*> [#uses=37]
+ at s98 = common global %struct.S98 zeroinitializer, align 4		; <%struct.S98*> [#uses=2]
+ at a98 = common global [5 x %struct.S98] zeroinitializer, align 4		; <[5 x %struct.S98]*> [#uses=5]
+ at stdout = external global %struct._IO_FILE*		; <%struct._IO_FILE**> [#uses=1]
+
+declare void @llvm.memmove.i32(i8*, i8*, i32, i32) nounwind 
+
+define void @test98() nounwind  {
+entry:
+	%arg = alloca %struct.S98, align 8		; <%struct.S98*> [#uses=2]
+	%tmp13 = alloca %struct.S98		; <%struct.S98*> [#uses=2]
+	%tmp14 = alloca %struct.S98		; <%struct.S98*> [#uses=2]
+	%tmp15 = alloca %struct.S98		; <%struct.S98*> [#uses=2]
+	%tmp17 = alloca %struct.S98		; <%struct.S98*> [#uses=2]
+	%tmp21 = alloca %struct.S98		; <%struct.S98*> [#uses=0]
+	%tmp23 = alloca %struct.S98		; <%struct.S98*> [#uses=0]
+	%tmp25 = alloca %struct.S98		; <%struct.S98*> [#uses=0]
+	%tmp27 = alloca %struct.S98		; <%struct.S98*> [#uses=0]
+	%tmp29 = alloca %struct.S98		; <%struct.S98*> [#uses=0]
+	%tmp31 = alloca %struct.S98		; <%struct.S98*> [#uses=0]
+	%tmp33 = alloca %struct.S98		; <%struct.S98*> [#uses=0]
+	call void @llvm.memset.i32( i8* bitcast (%struct.S98* @s98 to i8*), i8 0, i32 248, i32 4 )
+	call void @llvm.memset.i32( i8* bitcast ([5 x %struct.S98]* @a98 to i8*), i8 0, i32 1240, i32 4 )
+	call void @llvm.memset.i32( i8* bitcast (%struct.Info* @info to i8*), i8 0, i32 420, i32 4 )
+	store i8* bitcast (%struct.S98* @s98 to i8*), i8** getelementptr (%struct.Info* @info, i32 0, i32 2)
+	store i8* bitcast ([5 x %struct.S98]* @a98 to i8*), i8** getelementptr (%struct.Info* @info, i32 0, i32 3)
+	store i8* bitcast (%struct.S98* getelementptr ([5 x %struct.S98]* @a98, i32 0, i32 3) to i8*), i8** getelementptr (%struct.Info* @info, i32 0, i32 4)
+	store i32 248, i32* getelementptr (%struct.Info* @info, i32 0, i32 6)
+	store i32 4, i32* getelementptr (%struct.Info* @info, i32 0, i32 8)
+	store i32 4, i32* getelementptr (%struct.Info* @info, i32 0, i32 9)
+	store i32 4, i32* getelementptr (%struct.Info* @info, i32 0, i32 10)
+	%tmp = load i32* getelementptr (%struct.Info* @info, i32 0, i32 8)		; <i32> [#uses=1]
+	%sub = add i32 %tmp, -1		; <i32> [#uses=1]
+	%and = and i32 %sub, ptrtoint (%struct.S98* getelementptr ([5 x %struct.S98]* @a98, i32 0, i32 3) to i32)		; <i32> [#uses=1]
+	%tobool = icmp eq i32 %and, 0		; <i1> [#uses=1]
+	br i1 %tobool, label %ifend, label %ifthen
+
+ifthen:		; preds = %entry
+	%tmp3 = load i32* @fails		; <i32> [#uses=1]
+	%inc = add i32 %tmp3, 1		; <i32> [#uses=1]
+	store i32 %inc, i32* @fails
+	br label %ifend
+
+ifend:		; preds = %ifthen, %entry
+	store i8* bitcast (double* getelementptr (%struct.S98* @s98, i32 0, i32 0, i32 18) to i8*), i8** getelementptr (%struct.Info* @info, i32 0, i32 5, i32 0)
+	store i32 8, i32* getelementptr (%struct.Info* @info, i32 0, i32 7, i32 0)
+	store i32 4, i32* getelementptr (%struct.Info* @info, i32 0, i32 11, i32 0)
+	store double 0xC1075E4620000000, double* getelementptr (%struct.S98* @s98, i32 0, i32 0, i32 18)
+	store double 0x410CD219E0000000, double* getelementptr ([5 x %struct.S98]* @a98, i32 0, i32 2, i32 0, i32 18)
+	store i32 1, i32* getelementptr (%struct.Info* @info, i32 0, i32 0)
+	store i32 0, i32* getelementptr (%struct.Info* @info, i32 0, i32 1)
+	%tmp16 = bitcast %struct.S98* %tmp15 to i8*		; <i8*> [#uses=1]
+	call void @llvm.memmove.i32( i8* %tmp16, i8* bitcast (%struct.S98* @s98 to i8*), i32 248, i32 4 )
+	%tmp18 = bitcast %struct.S98* %tmp17 to i8*		; <i8*> [#uses=1]
+	call void @llvm.memmove.i32( i8* %tmp18, i8* bitcast (%struct.S98* getelementptr ([5 x %struct.S98]* @a98, i32 0, i32 2) to i8*), i32 248, i32 4 )
+	call void @check98( %struct.S98* sret  %tmp14, %struct.S98* byval  %tmp15, %struct.S98* getelementptr ([5 x %struct.S98]* @a98, i32 0, i32 1), %struct.S98* byval  %tmp17 )
+	%tmp19 = bitcast %struct.S98* %tmp13 to i8*		; <i8*> [#uses=1]
+	%tmp20 = bitcast %struct.S98* %tmp14 to i8*		; <i8*> [#uses=1]
+	call void @llvm.memmove.i32( i8* %tmp19, i8* %tmp20, i32 248, i32 8 )
+	%tmp1 = bitcast %struct.S98* %arg to i8*		; <i8*> [#uses=1]
+	%tmp2 = bitcast %struct.S98* %tmp13 to i8*		; <i8*> [#uses=1]
+	call void @llvm.memcpy.i64( i8* %tmp1, i8* %tmp2, i64 248, i32 8 )
+	%arrayidx.i = getelementptr %struct.S98* %arg, i32 0, i32 0, i32 18		; <double*> [#uses=1]
+	%tmp1.i = load double* %arrayidx.i, align 8		; <double> [#uses=1]
+	%tmp2.i = load double* getelementptr (%struct.S98* @s98, i32 0, i32 0, i32 18)		; <double> [#uses=1]
+	%cmp.i = fcmp une double %tmp1.i, %tmp2.i		; <i1> [#uses=1]
+	br i1 %cmp.i, label %ifthen.i, label %checkx98.exit
+
+ifthen.i:		; preds = %ifend
+	%tmp3.i = load i32* @fails		; <i32> [#uses=1]
+	%inc.i = add i32 %tmp3.i, 1		; <i32> [#uses=1]
+	store i32 %inc.i, i32* @fails
+	br label %checkx98.exit
+
+checkx98.exit:		; preds = %ifthen.i, %ifend
+	ret void
+}
+
+declare void @check98(%struct.S98* sret  %agg.result, %struct.S98* byval  %arg0, %struct.S98* %arg1, %struct.S98* byval  %arg2) nounwind
+
+declare void @llvm.va_start(i8*) nounwind 
+
+declare void @llvm.va_end(i8*) nounwind 
+
+declare i32 @main() noreturn
+
+declare i32 @fflush(%struct._IO_FILE*)
+
+declare void @abort() noreturn nounwind 
+
+declare void @exit(i32) noreturn nounwind 
+
+declare void @llvm.memset.i32(i8*, i8, i32, i32) nounwind 
+
+declare void @llvm.memcpy.i64(i8*, i8*, i64, i32) nounwind 

Modified: llvm/branches/non-call-eh/test/Transforms/MemCpyOpt/dg.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/MemCpyOpt/dg.exp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/MemCpyOpt/dg.exp (original)
+++ llvm/branches/non-call-eh/test/Transforms/MemCpyOpt/dg.exp Sun Jul  6 15:45:41 2008
@@ -1,3 +1,3 @@
 load_lib llvm.exp
 
-RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]

Modified: llvm/branches/non-call-eh/test/Transforms/MemCpyOpt/form-memset.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/MemCpyOpt/form-memset.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/MemCpyOpt/form-memset.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/MemCpyOpt/form-memset.ll Sun Jul  6 15:45:41 2008
@@ -1,5 +1,5 @@
-; RUN: llvm-as < %s | opt -memcpyopt -form-memset-from-stores | llvm-dis | not grep store
-; RUN: llvm-as < %s | opt -memcpyopt -form-memset-from-stores | llvm-dis | grep {call.*llvm.memset}
+; RUN: llvm-as < %s | opt -memcpyopt | llvm-dis | not grep store
+; RUN: llvm-as < %s | opt -memcpyopt | llvm-dis | grep {call.*llvm.memset}
 
 ; All the stores in this example should be merged into a single memset.
 

Modified: llvm/branches/non-call-eh/test/Transforms/MemCpyOpt/form-memset2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/MemCpyOpt/form-memset2.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/MemCpyOpt/form-memset2.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/MemCpyOpt/form-memset2.ll Sun Jul  6 15:45:41 2008
@@ -1,5 +1,5 @@
-; RUN: llvm-as < %s | opt -memcpyopt -form-memset-from-stores | llvm-dis | not grep store
-; RUN: llvm-as < %s | opt -memcpyopt -form-memset-from-stores | llvm-dis | grep {call.*llvm.memset} | count 3
+; RUN: llvm-as < %s | opt -memcpyopt | llvm-dis | not grep store
+; RUN: llvm-as < %s | opt -memcpyopt | llvm-dis | grep {call.*llvm.memset} | count 3
 
 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-darwin8"

Modified: llvm/branches/non-call-eh/test/Transforms/PredicateSimplifier/dg.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/PredicateSimplifier/dg.exp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/PredicateSimplifier/dg.exp (original)
+++ llvm/branches/non-call-eh/test/Transforms/PredicateSimplifier/dg.exp Sun Jul  6 15:45:41 2008
@@ -1,3 +1,3 @@
 load_lib llvm.exp
 
-RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]

Added: llvm/branches/non-call-eh/test/Transforms/PruneEH/2008-06-02-Weak.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/PruneEH/2008-06-02-Weak.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/PruneEH/2008-06-02-Weak.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/PruneEH/2008-06-02-Weak.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,12 @@
+; RUN: llvm-as < %s | opt -prune-eh | llvm-dis | not grep nounwind
+
+define weak void @f() {
+entry:
+        ret void
+}
+
+define void @g() {
+entry:
+	call void @f()
+	ret void
+}

Modified: llvm/branches/non-call-eh/test/Transforms/PruneEH/dg.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/PruneEH/dg.exp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/PruneEH/dg.exp (original)
+++ llvm/branches/non-call-eh/test/Transforms/PruneEH/dg.exp Sun Jul  6 15:45:41 2008
@@ -1,3 +1,3 @@
 load_lib llvm.exp
 
-RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]

Removed: llvm/branches/non-call-eh/test/Transforms/PruneEH/unwindto.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/PruneEH/unwindto.ll?rev=53162&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/PruneEH/unwindto.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/PruneEH/unwindto.ll (removed)
@@ -1,15 +0,0 @@
-; RUN: llvm-as < %s | opt -prune-eh | llvm-dis | not grep {unwinds to}
-
-define i8 @test7(i1 %b) {
-entry: unwinds to %cleanup
-  br i1 %b, label %cond_true, label %cond_false
-cond_true: unwinds to %cleanup
-  br label %cleanup
-cond_false: unwinds to %cleanup
-  br label %cleanup
-cleanup:
-  %x = phi i8 [0, %entry], [1, %cond_true], [1, %cond_true],
-                           [2, %cond_false], [2, %cond_false]
-  ret i8 %x
-}
-

Modified: llvm/branches/non-call-eh/test/Transforms/RaiseAllocations/dg.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/RaiseAllocations/dg.exp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/RaiseAllocations/dg.exp (original)
+++ llvm/branches/non-call-eh/test/Transforms/RaiseAllocations/dg.exp Sun Jul  6 15:45:41 2008
@@ -1,3 +1,3 @@
 load_lib llvm.exp
 
-RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]

Modified: llvm/branches/non-call-eh/test/Transforms/Reassociate/dg.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/Reassociate/dg.exp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/Reassociate/dg.exp (original)
+++ llvm/branches/non-call-eh/test/Transforms/Reassociate/dg.exp Sun Jul  6 15:45:41 2008
@@ -1,3 +1,3 @@
 load_lib llvm.exp
 
-RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]

Modified: llvm/branches/non-call-eh/test/Transforms/Reassociate/mulfactor2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/Reassociate/mulfactor2.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/Reassociate/mulfactor2.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/Reassociate/mulfactor2.ll Sun Jul  6 15:45:41 2008
@@ -1,7 +1,7 @@
 ; This should turn into one multiply and one add.
 
 ; RUN: llvm-as < %s | \
-; RUN:   opt -instcombine -reassociate -instcombine | llvm-dis -o %t 
+; RUN:   opt -instcombine -reassociate -instcombine | llvm-dis > %t 
 ; RUN: grep mul %t | count 1
 ; RUN: grep add %t | count 1
 

Modified: llvm/branches/non-call-eh/test/Transforms/SCCP/2008-03-10-sret.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/SCCP/2008-03-10-sret.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/SCCP/2008-03-10-sret.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/SCCP/2008-03-10-sret.ll Sun Jul  6 15:45:41 2008
@@ -1,12 +1,14 @@
-; RUN: llvm-as < %s  | opt -ipsccp -disable-output
+; RUN: llvm-as < %s  | opt -ipsccp | llvm-dis | grep {ret i32 36}
+; RUN: llvm-as < %s  | opt -ipsccp | llvm-dis | grep {ret i32 18, i32 17}
 
 define internal {i32, i32} @bar(i32 %A) {
-	%X = add i32 1, 2
-	ret i32 %A, i32 %A
+	%X = add i32 1, %A
+	ret i32 %X, i32 %A
 }
 
 define i32 @foo() {
 	%X = call {i32, i32} @bar(i32 17)
         %Y = getresult {i32, i32} %X, 0
-	ret i32 %Y
+	%Z = add i32 %Y, %Y
+	ret i32 %Z
 }

Added: llvm/branches/non-call-eh/test/Transforms/SCCP/2008-04-22-multiple-ret-sccp.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/SCCP/2008-04-22-multiple-ret-sccp.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/SCCP/2008-04-22-multiple-ret-sccp.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/SCCP/2008-04-22-multiple-ret-sccp.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s  | opt -sccp | llvm-dis | grep {ret i32 %Z}
+; rdar://5778210
+
+declare {i32, i32} @bar(i32 %A) 
+
+define i32 @foo() {
+	%X = call {i32, i32} @bar(i32 17)
+        %Y = getresult {i32, i32} %X, 0
+	%Z = add i32 %Y, %Y
+	ret i32 %Z
+}

Added: llvm/branches/non-call-eh/test/Transforms/SCCP/2008-05-23-UndefCallFold.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/SCCP/2008-05-23-UndefCallFold.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/SCCP/2008-05-23-UndefCallFold.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/SCCP/2008-05-23-UndefCallFold.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,14 @@
+; RUN: llvm-as < %s | opt -sccp | llvm-dis | not grep {ret i32 undef}
+; PR2358
+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-pc-linux-gnu"
+
+define i32 @x(i32 %b) {
+entry:
+ %val = call i32 @llvm.cttz.i32(i32 undef)
+ ret i32 %val
+}
+
+declare i32 @llvm.cttz.i32(i32)
+

Modified: llvm/branches/non-call-eh/test/Transforms/SCCP/calltest.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/SCCP/calltest.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/SCCP/calltest.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/SCCP/calltest.ll Sun Jul  6 15:45:41 2008
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -sccp -adce -simplifycfg | llvm-dis | \
+; RUN: llvm-as < %s | opt -sccp -loop-deletion -simplifycfg | llvm-dis | \
 ; RUN:   not grep br
 
 ; No matter how hard you try, sqrt(1.0) is always 1.0.  This allows the

Modified: llvm/branches/non-call-eh/test/Transforms/SCCP/dg.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/SCCP/dg.exp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/SCCP/dg.exp (original)
+++ llvm/branches/non-call-eh/test/Transforms/SCCP/dg.exp Sun Jul  6 15:45:41 2008
@@ -1,3 +1,3 @@
 load_lib llvm.exp
 
-RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]

Added: llvm/branches/non-call-eh/test/Transforms/SRETPromotion/2008-06-04-function-pointer-passing.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/SRETPromotion/2008-06-04-function-pointer-passing.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/SRETPromotion/2008-06-04-function-pointer-passing.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/SRETPromotion/2008-06-04-function-pointer-passing.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,24 @@
+; This test lures sretpromotion into promoting the sret argument of foo, even
+; when the function is used as an argument to bar. It used to not check for
+; this, assuming that all users of foo were direct calls, resulting in an
+; assertion failure later on.
+
+; We're mainly testing for opt not to crash, but we'll check to see if the sret
+; attribute is still there for good measure.
+; RUN: llvm-as < %s | opt -sretpromotion | llvm-dis | grep sret
+
+%struct.S = type <{ i32, i32 }>
+
+define i32 @main() {
+entry:
+	%tmp = alloca %struct.S		; <%struct.S*> [#uses=1]
+	call void @bar( %struct.S* sret  %tmp, void (%struct.S*, ...)* @foo )
+	ret i32 undef
+}
+
+declare void @bar(%struct.S* sret , void (%struct.S*, ...)*)
+
+define internal void @foo(%struct.S* sret  %agg.result, ...) {
+entry:
+	ret void
+}

Added: llvm/branches/non-call-eh/test/Transforms/SRETPromotion/2008-06-05-non-call-use.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/SRETPromotion/2008-06-05-non-call-use.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/SRETPromotion/2008-06-05-non-call-use.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/SRETPromotion/2008-06-05-non-call-use.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,20 @@
+; This test shows an sret function that is used as an operand to a bitcast.
+; StructRetPromotion used to assume that a function was only used by call or
+; invoke instructions, making this code cause an assertion failure.
+
+; We're mainly testing for opt not to crash, but we'll check to see if the sret
+; attribute is still there for good measure.
+; RUN: llvm-as < %s | opt -sretpromotion | llvm-dis | grep sret
+
+%struct.S = type <{ i32, i32 }>
+
+define i32 @main() {
+entry:
+        %bar = bitcast void (%struct.S*)* @foo to i32 ()*
+	ret i32 undef
+}
+
+define internal void @foo(%struct.S* sret) {
+entry:
+	ret void
+}

Modified: llvm/branches/non-call-eh/test/Transforms/SRETPromotion/dg.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/SRETPromotion/dg.exp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/SRETPromotion/dg.exp (original)
+++ llvm/branches/non-call-eh/test/Transforms/SRETPromotion/dg.exp Sun Jul  6 15:45:41 2008
@@ -1,3 +1,3 @@
 load_lib llvm.exp
 
-RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]

Modified: llvm/branches/non-call-eh/test/Transforms/ScalarRepl/2003-09-12-IncorrectPromote.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/ScalarRepl/2003-09-12-IncorrectPromote.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/ScalarRepl/2003-09-12-IncorrectPromote.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/ScalarRepl/2003-09-12-IncorrectPromote.ll Sun Jul  6 15:45:41 2008
@@ -1,7 +1,7 @@
 ; Scalar replacement was incorrectly promoting this alloca!!
 ;
 ; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | \
-; RUN:   sed {s/;.*//g} | grep \[
+; RUN:   sed {s/;.*//g} | grep {\\\[}
 
 define i8* @test() {
 	%A = alloca [30 x i8]		; <[30 x i8]*> [#uses=1]

Modified: llvm/branches/non-call-eh/test/Transforms/ScalarRepl/2003-10-29-ArrayProblem.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/ScalarRepl/2003-10-29-ArrayProblem.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/ScalarRepl/2003-10-29-ArrayProblem.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/ScalarRepl/2003-10-29-ArrayProblem.ll Sun Jul  6 15:45:41 2008
@@ -1,5 +1,5 @@
 ; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | \
-; RUN:   grep alloca | grep \{
+; RUN:   grep alloca | grep \\{
 
 declare i32 @.callback_1(i8*)
 

Added: llvm/branches/non-call-eh/test/Transforms/ScalarRepl/2008-06-05-loadstore-agg.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/ScalarRepl/2008-06-05-loadstore-agg.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/ScalarRepl/2008-06-05-loadstore-agg.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/ScalarRepl/2008-06-05-loadstore-agg.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,32 @@
+; This test shows an alloca of a struct and an array that can be reduced to
+; multiple variables easily. However, the alloca is used by a store
+; instruction, which was not possible before aggregrates were first class
+; values. This checks of scalarrepl splits up the struct and array properly.
+
+; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | not grep alloca
+
+define i32 @foo() {
+	%target = alloca { i32, i32 }		; <{ i32, i32 }*> [#uses=1]
+        ; Build a first class struct to store
+	%res1 = insertvalue { i32, i32 } undef, i32 1, 0		; <{ i32, i32 }> [#uses=1]
+	%res2 = insertvalue { i32, i32 } %res1, i32 2, 1		; <{ i32, i32 }> [#uses=1]
+        ; And store it
+	store { i32, i32 } %res2, { i32, i32 }* %target
+        ; Actually use %target, so it doesn't get removed alltogether
+        %ptr = getelementptr { i32, i32 }* %target, i32 0, i32 0
+        %val = load i32* %ptr
+	ret i32 %val
+}
+
+define i32 @bar() {
+	%target = alloca [ 2 x i32 ]		; <{ i32, i32 }*> [#uses=1]
+        ; Build a first class array to store
+	%res1 = insertvalue [ 2 x i32 ] undef, i32 1, 0		; <{ i32, i32 }> [#uses=1]
+	%res2 = insertvalue [ 2 x i32 ] %res1, i32 2, 1		; <{ i32, i32 }> [#uses=1]
+        ; And store it
+	store [ 2 x i32 ] %res2, [ 2 x i32 ]* %target
+        ; Actually use %target, so it doesn't get removed alltogether
+        %ptr = getelementptr [ 2 x i32 ]* %target, i32 0, i32 0
+        %val = load i32* %ptr
+	ret i32 %val
+}

Added: llvm/branches/non-call-eh/test/Transforms/ScalarRepl/2008-06-22-LargeArray.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/ScalarRepl/2008-06-22-LargeArray.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/ScalarRepl/2008-06-22-LargeArray.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/ScalarRepl/2008-06-22-LargeArray.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,18 @@
+; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | grep {call.*mem} 
+; PR2369
+
+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-darwin8"
+
+define void @memtest1(i8* %dst, i8* %src) nounwind  {
+entry:
+	%temp = alloca [100 x i8]		; <[100 x i8]*> [#uses=2]
+	%"alloca point" = bitcast i32 0 to i32		; <i32> [#uses=0]
+	%temp1 = bitcast [100 x i8]* %temp to i8*		; <i8*> [#uses=1]
+	call void @llvm.memcpy.i32( i8* %temp1, i8* %src, i32 100, i32 1 )
+	%temp3 = bitcast [100 x i8]* %temp to i8*		; <i8*> [#uses=1]
+	call void @llvm.memcpy.i32( i8* %dst, i8* %temp3, i32 100, i32 1 )
+	ret void
+}
+
+declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) nounwind 

Modified: llvm/branches/non-call-eh/test/Transforms/ScalarRepl/dg.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/ScalarRepl/dg.exp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/ScalarRepl/dg.exp (original)
+++ llvm/branches/non-call-eh/test/Transforms/ScalarRepl/dg.exp Sun Jul  6 15:45:41 2008
@@ -1,3 +1,3 @@
 load_lib llvm.exp
 
-RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]

Modified: llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/2003-08-17-BranchFold.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/2003-08-17-BranchFold.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/2003-08-17-BranchFold.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/2003-08-17-BranchFold.ll Sun Jul  6 15:45:41 2008
@@ -2,7 +2,7 @@
 ; 'br Dest'
 
 ; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | \
-; RUN:   not grep {br bool %c2}
+; RUN:   not grep {br i1 %c2}
 
 declare void @noop()
 

Modified: llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/2003-08-17-BranchFoldOrdering.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/2003-08-17-BranchFoldOrdering.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/2003-08-17-BranchFoldOrdering.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/2003-08-17-BranchFoldOrdering.ll Sun Jul  6 15:45:41 2008
@@ -4,7 +4,7 @@
 ; the ConstantFoldTerminator function.
 
 ; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | \
-; RUN:   not grep {br bool %c2}
+; RUN:   not grep {br i1 %c2}
 
 declare void @noop()
 

Added: llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/2008-04-23-MergeMultipleResultRet.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/2008-04-23-MergeMultipleResultRet.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/2008-04-23-MergeMultipleResultRet.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/2008-04-23-MergeMultipleResultRet.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,43 @@
+; RUN: llvm-as < %s | opt -simplifycfg -disable-output
+; rdar://5882392
+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"
+	%struct.Py_complex = type { double, double }
+
+define %struct.Py_complex @_Py_c_pow(double %a.0, double %a.1, double %b.0, double %b.1) nounwind  {
+entry:
+	%tmp7 = fcmp une double %b.0, 0.000000e+00		; <i1> [#uses=1]
+	%tmp11 = fcmp une double %b.1, 0.000000e+00		; <i1> [#uses=1]
+	%bothcond = or i1 %tmp7, %tmp11		; <i1> [#uses=1]
+	br i1 %bothcond, label %bb15, label %bb53
+
+bb15:		; preds = %entry
+	%tmp18 = fcmp une double %a.0, 0.000000e+00		; <i1> [#uses=1]
+	%tmp24 = fcmp une double %a.1, 0.000000e+00		; <i1> [#uses=1]
+	%bothcond1 = or i1 %tmp18, %tmp24		; <i1> [#uses=1]
+	br i1 %bothcond1, label %bb29, label %bb27
+
+bb27:		; preds = %bb15
+	%tmp28 = call i32* @__error( ) nounwind 		; <i32*> [#uses=1]
+	store i32 33, i32* %tmp28, align 4
+	ret double undef, double undef
+
+bb29:		; preds = %bb15
+	%tmp36 = fcmp une double %b.1, 0.000000e+00		; <i1> [#uses=1]
+	br i1 %tmp36, label %bb39, label %bb47
+
+bb39:		; preds = %bb29
+	br label %bb47
+
+bb47:		; preds = %bb39, %bb29
+	ret double undef, double undef
+
+bb53:		; preds = %entry
+	ret double undef, double undef
+}
+
+declare i32* @__error()
+
+declare double @pow(double, double) nounwind readonly 
+
+declare double @cos(double) nounwind readonly 

Added: llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/2008-04-27-MultipleReturnCrash.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/2008-04-27-MultipleReturnCrash.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/2008-04-27-MultipleReturnCrash.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/2008-04-27-MultipleReturnCrash.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,30 @@
+; RUN: llvm-as < %s | opt -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"
+
+define { x86_fp80, x86_fp80 } @catanl({ x86_fp80, x86_fp80 }* byval  %Z, i1 %cond) nounwind  {
+bb:		; preds = %entry
+	br i1  %cond, label %bb48, label %bb40
+
+bb40:		; preds = %bb
+	store i32 34, i32* null, align 4
+	br label %bb196
+
+bb48:		; preds = %bb.bb48_crit_edge, %entry.bb48_crit_edge
+	%tmp53 = icmp eq i32 0, 1280		; <i1> [#uses=1]
+	br i1 %tmp53, label %bb56, label %bb174
+
+bb56:		; preds = %bb48
+	%iftmp.0.0 = select i1 false, x86_fp80 0xK3FFFC90FDAA22168C235, x86_fp80 0xKBFFFC90FDAA22168C235		; <x86_fp80> [#uses=0]
+	br label %bb196
+
+
+bb174:		; preds = %bb144, %bb114
+	%tmp191 = mul x86_fp80 0xK00000000000000000000, 0xK3FFE8000000000000000		; <x86_fp80> [#uses=1]
+	br label %bb196
+
+bb196:		; preds = %bb174, %bb56, %bb40
+	%Res.1.0 = phi x86_fp80 [ 0xK7FFF8000000000000000, %bb40 ], [ %tmp191, %bb174 ], [ 0xK00000000000000000000, %bb56 ]		; <x86_fp80> [#uses=1]
+	ret x86_fp80 0xK00000000000000000000, x86_fp80 %Res.1.0
+}

Added: llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/2008-05-16-PHIBlockMerge.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/2008-05-16-PHIBlockMerge.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/2008-05-16-PHIBlockMerge.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/2008-05-16-PHIBlockMerge.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,131 @@
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis > %t
+; RUN: not grep {^BB.tomerge} %t
+; RUN  grep {^BB.nomerge} %t | count 2
+
+; ModuleID = '<stdin>' 
+declare i1 @foo()
+
+declare i1 @bar(i32)
+
+; This function can't be merged
+define void @a() {
+entry:
+	br label %BB.nomerge
+
+BB.nomerge:		; preds = %Common, %entry
+        ; This phi has a conflicting value (0) with below phi (2), so blocks
+        ; can't be merged.
+	%a = phi i32 [ 1, %entry ], [ 0, %Common ]		; <i32> [#uses=1]
+	br label %Succ
+
+Succ:		; preds = %Common, %BB.nomerge
+	%b = phi i32 [ %a, %BB.nomerge ], [ 2, %Common ]		; <i32> [#uses=0]
+	%conde = call i1 @foo( )		; <i1> [#uses=1]
+	br i1 %conde, label %Common, label %Exit
+
+Common:		; preds = %Succ
+	%cond = call i1 @foo( )		; <i1> [#uses=1]
+	br i1 %cond, label %BB.nomerge, label %Succ
+
+Exit:		; preds = %Succ
+	ret void
+}
+
+; This function can't be merged
+define void @b() {
+entry:
+	br label %BB.nomerge
+
+BB.nomerge:		; preds = %Common, %entry
+	br label %Succ
+
+Succ:		; preds = %Common, %BB.nomerge
+        ; This phi has confliction values for Common and (through BB) Common,
+        ; blocks can't be merged
+	%b = phi i32 [ 1, %BB.nomerge ], [ 2, %Common ]		; <i32> [#uses=0]
+	%conde = call i1 @foo( )		; <i1> [#uses=1]
+	br i1 %conde, label %Common, label %Exit
+
+Common:		; preds = %Succ
+	%cond = call i1 @foo( )		; <i1> [#uses=1]
+	br i1 %cond, label %BB.nomerge, label %Succ
+
+Exit:		; preds = %Succ
+	ret void
+}
+
+; This function can be merged
+define void @c() {
+entry:
+	br label %BB.tomerge
+
+BB.tomerge:		; preds = %Common, %entry
+	br label %Succ
+
+Succ:		; preds = %Common, %BB.tomerge, %Pre-Exit
+        ; This phi has identical values for Common and (through BB) Common,
+        ; blocks can't be merged
+	%b = phi i32 [ 1, %BB.tomerge ], [ 1, %Common ], [ 2, %Pre-Exit ]
+	%conde = call i1 @foo( )		; <i1> [#uses=1]
+	br i1 %conde, label %Common, label %Pre-Exit
+
+Common:		; preds = %Succ
+	%cond = call i1 @foo( )		; <i1> [#uses=1]
+	br i1 %cond, label %BB.tomerge, label %Succ
+
+Pre-Exit:       ; preds = %Succ
+        ; This adds a backedge, so the %b phi node gets a third branch and is
+        ; not completely trivial
+	%cond2 = call i1 @foo( )		; <i1> [#uses=1]
+	br i1 %cond2, label %Succ, label %Exit
+        
+Exit:		; preds = %Pre-Exit
+	ret void
+}
+
+; This function can be merged
+define void @d() {
+entry:
+	br label %BB.tomerge
+
+BB.tomerge:		; preds = %Common, %entry
+        ; This phi has a matching value (0) with below phi (0), so blocks
+        ; can be merged.
+	%a = phi i32 [ 1, %entry ], [ 0, %Common ]		; <i32> [#uses=1]
+	br label %Succ
+
+Succ:		; preds = %Common, %BB.tomerge
+	%b = phi i32 [ %a, %BB.tomerge ], [ 0, %Common ]		; <i32> [#uses=0]
+	%conde = call i1 @foo( )		; <i1> [#uses=1]
+	br i1 %conde, label %Common, label %Exit
+
+Common:		; preds = %Succ
+	%cond = call i1 @foo( )		; <i1> [#uses=1]
+	br i1 %cond, label %BB.tomerge, label %Succ
+
+Exit:		; preds = %Succ
+	ret void
+}
+
+; This function can be merged
+define void @e() {
+entry:
+	br label %BB.tomerge
+
+BB.tomerge:		; preds = %Use, %entry
+        ; This phi is used somewhere else than Succ, but this should not prevent
+        ; merging this block
+	%a = phi i32 [ 1, %entry ], [ 0, %Use ]		; <i32> [#uses=1]
+	br label %Succ
+
+Succ:		; preds = %BB.tomerge
+	%conde = call i1 @foo( )		; <i1> [#uses=1]
+	br i1 %conde, label %Use, label %Exit
+
+Use:		; preds = %Succ
+	%cond = call i1 @bar( i32 %a )		; <i1> [#uses=1]
+	br i1 %cond, label %BB.tomerge, label %Exit
+
+Exit:		; preds = %Use, %Succ
+	ret void
+}

Added: llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/SpeculativeExec.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/SpeculativeExec.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/SpeculativeExec.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/SpeculativeExec.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,21 @@
+; RUN: llvm-as < %s | opt -simplifycfg  | llvm-dis | grep select
+; RUN: llvm-as < %s | opt -simplifycfg  | llvm-dis | grep br | count 2
+
+define i32 @t2(i32 %a, i32 %b, i32 %c) nounwind  {
+entry:
+        %tmp1 = icmp eq i32 %b, 0
+        br i1 %tmp1, label %bb1, label %bb3
+
+bb1:            ; preds = %entry
+	%tmp2 = icmp sgt i32 %c, 1
+	br i1 %tmp2, label %bb2, label %bb3
+
+bb2:		; preds = bb1
+	%tmp3 = add i32 %a, 1
+	br label %bb3
+
+bb3:		; preds = %bb2, %entry
+	%tmp4 = phi i32 [ %b, %entry ], [ %a, %bb1 ], [ %tmp3, %bb2 ]
+        %tmp5 = sub i32 %tmp4, 1
+	ret i32 %tmp5
+}

Modified: llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/branch-fold-test.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/branch-fold-test.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/branch-fold-test.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/branch-fold-test.ll Sun Jul  6 15:45:41 2008
@@ -1,7 +1,7 @@
 ; This test ensures that the simplifycfg pass continues to constant fold
 ; terminator instructions.
 
-; RUN: llvm-as < %s | opt -simplifycfg | not grep br
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | not grep br
 
 define i32 @test(i32 %A, i32 %B) {
 J:

Modified: llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/branch-phi-thread.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/branch-phi-thread.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/branch-phi-thread.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/branch-phi-thread.ll Sun Jul  6 15:45:41 2008
@@ -1,5 +1,5 @@
 ; RUN: llvm-as < %s | opt -simplifycfg -adce | llvm-dis | \
-; RUN:   not grep {call void %f1}
+; RUN:   not grep {call void @f1}
 ; END.
 
 declare void @f1()

Modified: llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/dg.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/dg.exp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/dg.exp (original)
+++ llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/dg.exp Sun Jul  6 15:45:41 2008
@@ -1,3 +1,3 @@
 load_lib llvm.exp
 
-RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]

Modified: llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/switch_thread.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/switch_thread.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/switch_thread.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/switch_thread.ll Sun Jul  6 15:45:41 2008
@@ -1,5 +1,5 @@
 ; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | \
-; RUN:   not grep {call void %DEAD}
+; RUN:   not grep {call void @DEAD}
 
 ; Test that we can thread a simple known condition through switch statements.
 

Removed: llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/unwindto.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/unwindto.ll?rev=53162&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/unwindto.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/unwindto.ll (removed)
@@ -1,61 +0,0 @@
-; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | grep {unwinds to} | count 3
-
-declare void @g(i32)
-
-define i32 @f1() {
-entry:
-  br label %bb1
-bb1: unwinds to %cleanup1
-  call void @g(i32 0)
-  br label %bb2
-bb2: unwinds to %cleanup2
-  call void @g(i32 1)
-  br label %exit
-exit:
-  ret i32 0
-cleanup1:
-  ret i32 1
-cleanup2:
-  ret i32 2
-}
-
-define i32 @f2() {
-entry: unwinds to %cleanup
-  br label %bb1
-bb1: unwinds to %cleanup
-  br label %bb2
-bb2: unwinds to %cleanup
-  br label %bb3
-bb3:
-  br label %bb4
-bb4: unwinds to %cleanup
-  ret i32 0
-cleanup:
-  ret i32 1
-}
-
-define i32 @f3() {
-entry: unwinds to %cleanup
-  call void @g(i32 0)
-  ret i32 0
-cleanup:
-  unwind
-}
-
-define i32 @f4() {
-entry: unwinds to %cleanup
-  call void @g(i32 0)
-  br label %cleanup
-cleanup:
-  unwind
-}
-
-define i32 @f5() {
-entry: unwinds to %cleanup
-  call void @g(i32 0)
-  br label %other
-other:
-  ret i32 0
-cleanup:
-  unwind
-}

Added: llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/2008-05-19-memcmp.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/2008-05-19-memcmp.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/2008-05-19-memcmp.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/2008-05-19-memcmp.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,14 @@
+; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | grep i32
+; PR2341
+
+ at _2E_str = external constant [5 x i8]		; <[5 x i8]*> [#uses=1]
+
+declare i32 @memcmp(i8*, i8*, i32) nounwind readonly 
+
+define i1 @f(i8** %start_addr) {
+entry:
+	%tmp4 = load i8** %start_addr, align 4		; <i8*> [#uses=1]
+	%tmp5 = call i32 @memcmp( i8* %tmp4, i8* getelementptr ([5 x i8]* @_2E_str, i32 0, i32 0), i32 4 ) nounwind readonly 		; <i32> [#uses=1]
+	%tmp6 = icmp eq i32 %tmp5, 0		; <i1> [#uses=1]
+	ret i1 %tmp6
+}

Modified: llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/FFS.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/FFS.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/FFS.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/FFS.ll Sun Jul  6 15:45:41 2008
@@ -1,6 +1,6 @@
 ; Test that the ToAsciiOptimizer works correctly
 ; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | \
-; RUN:   not grep {call.*%ffs}
+; RUN:   not grep {call.*@ffs}
 
 @non_const = external global i32		; <i32*> [#uses=1]
 

Modified: llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/MemCpy.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/MemCpy.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/MemCpy.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/MemCpy.ll Sun Jul  6 15:45:41 2008
@@ -1,6 +1,4 @@
-; Test that the StrCatOptimizer works correctly
-; RUN: llvm-as < %s | opt -constprop -simplify-libcalls | \
-; RUN:   llvm-dis | not grep {call.*llvm.memcpy.i32}
+; RUN: llvm-as < %s | opt -constprop -instcombine | llvm-dis | not grep {call.*llvm.memcpy.i32}
 
 @h = constant [2 x i8] c"h\00"		; <[2 x i8]*> [#uses=1]
 @hel = constant [4 x i8] c"hel\00"		; <[4 x i8]*> [#uses=1]

Removed: llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/MemMove.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/MemMove.ll?rev=53162&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/MemMove.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/MemMove.ll (removed)
@@ -1,22 +0,0 @@
-; Test that the StrCatOptimizer works correctly
-; RUN: llvm-as < %s | opt -constprop -simplify-libcalls | \
-; RUN:   llvm-dis | not grep {call.*llvm.memmove.i32}
-
- at h = constant [2 x i8] c"h\00"		; <[2 x i8]*> [#uses=1]
- at hel = constant [4 x i8] c"hel\00"		; <[4 x i8]*> [#uses=1]
- at hello_u = constant [8 x i8] c"hello_u\00"		; <[8 x i8]*> [#uses=1]
-
-declare void @llvm.memmove.i32(i8*, i8*, i32, i32)
-
-define i32 @main() {
-	%h_p = getelementptr [2 x i8]* @h, i32 0, i32 0		; <i8*> [#uses=1]
-	%hel_p = getelementptr [4 x i8]* @hel, i32 0, i32 0		; <i8*> [#uses=1]
-	%hello_u_p = getelementptr [8 x i8]* @hello_u, i32 0, i32 0		; <i8*> [#uses=1]
-	%target = alloca [1024 x i8]		; <[1024 x i8]*> [#uses=1]
-	%target_p = getelementptr [1024 x i8]* %target, i32 0, i32 0		; <i8*> [#uses=3]
-	call void @llvm.memmove.i32( i8* %target_p, i8* %h_p, i32 2, i32 2 )
-	call void @llvm.memmove.i32( i8* %target_p, i8* %hel_p, i32 4, i32 4 )
-	call void @llvm.memmove.i32( i8* %target_p, i8* %hello_u_p, i32 8, i32 8 )
-	ret i32 0
-}
-

Removed: llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/MemSet.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/MemSet.ll?rev=53162&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/MemSet.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/MemSet.ll (removed)
@@ -1,18 +0,0 @@
-; Test that the LLVMMemSetOptimizer works correctly
-; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | \
-; RUN:   not grep {call.*llvm.memset}
-; END.
-
-declare void @llvm.memset.i32(i8*, i8, i32, i32)
-
-define i32 @main() {
-	%target = alloca [1024 x i8]		; <[1024 x i8]*> [#uses=1]
-	%target_p = getelementptr [1024 x i8]* %target, i32 0, i32 0		; <i8*> [#uses=5]
-	call void @llvm.memset.i32( i8* %target_p, i8 1, i32 0, i32 1 )
-	call void @llvm.memset.i32( i8* %target_p, i8 1, i32 1, i32 1 )
-	call void @llvm.memset.i32( i8* %target_p, i8 1, i32 2, i32 2 )
-	call void @llvm.memset.i32( i8* %target_p, i8 1, i32 4, i32 4 )
-	call void @llvm.memset.i32( i8* %target_p, i8 1, i32 8, i32 8 )
-	ret i32 0
-}
-

Modified: llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/StrChr.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/StrChr.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/StrChr.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/StrChr.ll Sun Jul  6 15:45:41 2008
@@ -1,6 +1,6 @@
 ; Test that the StrChrOptimizer works correctly
 ; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | \
-; RUN:   not grep {call.*%strchr}
+; RUN:   not grep {call.*@strchr}
 
 @hello = constant [14 x i8] c"hello world\5Cn\00"		; <[14 x i8]*> [#uses=1]
 @null = constant [1 x i8] zeroinitializer		; <[1 x i8]*> [#uses=1]

Added: llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/abs.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/abs.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/abs.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/abs.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | grep {select i1 %ispos}
+; PR2337
+
+define i32 @test(i32 %x) {
+entry:
+	%call = call i32 @abs( i32 %x )		; <i32> [#uses=1]
+	ret i32 %call
+}
+
+declare i32 @abs(i32)
+

Modified: llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/dg.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/dg.exp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/dg.exp (original)
+++ llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/dg.exp Sun Jul  6 15:45:41 2008
@@ -1,3 +1,3 @@
 load_lib llvm.exp
 
-RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]

Added: llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/exp2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/exp2.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/exp2.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/exp2.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,38 @@
+; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | grep {call.*ldexp} | count 4
+; rdar://5852514
+
+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-darwin8"
+
+define double @t1(i32 %x) nounwind  {
+entry:
+	%tmp12 = sitofp i32 %x to double		; <double> [#uses=1]
+	%exp2 = tail call double @exp2( double %tmp12 )		; <double> [#uses=1]
+	ret double %exp2
+}
+
+define float @t4(i8 zeroext  %x) nounwind  {
+entry:
+	%tmp12 = uitofp i8 %x to float		; <float> [#uses=1]
+	%tmp3 = tail call float @exp2f( float %tmp12 ) nounwind readonly 		; <float> [#uses=1]
+	ret float %tmp3
+}
+
+declare float @exp2f(float) nounwind readonly 
+
+define double @t3(i16 zeroext  %x) nounwind  {
+entry:
+	%tmp12 = uitofp i16 %x to double		; <double> [#uses=1]
+	%exp2 = tail call double @exp2( double %tmp12 )		; <double> [#uses=1]
+	ret double %exp2
+}
+
+define double @t2(i16 signext  %x) nounwind  {
+entry:
+	%tmp12 = sitofp i16 %x to double		; <double> [#uses=1]
+	%exp2 = tail call double @exp2( double %tmp12 )		; <double> [#uses=1]
+	ret double %exp2
+}
+
+declare double @exp2(double)
+

Modified: llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/floor.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/floor.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/floor.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/floor.ll Sun Jul  6 15:45:41 2008
@@ -31,7 +31,7 @@
 
 define float @test_nearbyint(float %C) {
 	%D = fpext float %C to double		; <double> [#uses=1]
-	; --> floorf
+	; --> nearbyintf
         %E = call double @nearbyint( double %D )		; <double> [#uses=1]
 	%F = fptrunc double %E to float		; <float> [#uses=1]
 	ret float %F

Modified: llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/memcmp.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/memcmp.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/memcmp.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/memcmp.ll Sun Jul  6 15:45:41 2008
@@ -1,7 +1,5 @@
 ; Test that the memcmpOptimizer works correctly
-; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | \
-; RUN:   not grep {call.*memcmp}
-; RUN: llvm-as < %s | opt -simplify-libcalls -disable-output
+; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | not grep {call.*memcmp}
 
 @h = constant [2 x i8] c"h\00"		; <[2 x i8]*> [#uses=0]
 @hel = constant [4 x i8] c"hel\00"		; <[4 x i8]*> [#uses=0]

Modified: llvm/branches/non-call-eh/test/Transforms/StripSymbols/dg.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/StripSymbols/dg.exp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/StripSymbols/dg.exp (original)
+++ llvm/branches/non-call-eh/test/Transforms/StripSymbols/dg.exp Sun Jul  6 15:45:41 2008
@@ -1,3 +1,3 @@
 load_lib llvm.exp
 
-RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]

Modified: llvm/branches/non-call-eh/test/Transforms/TailCallElim/dg.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/TailCallElim/dg.exp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/TailCallElim/dg.exp (original)
+++ llvm/branches/non-call-eh/test/Transforms/TailCallElim/dg.exp Sun Jul  6 15:45:41 2008
@@ -1,3 +1,3 @@
 load_lib llvm.exp
 
-RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]

Added: llvm/branches/non-call-eh/test/Transforms/TailDup/2008-05-13-InfiniteLoop.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/TailDup/2008-05-13-InfiniteLoop.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/TailDup/2008-05-13-InfiniteLoop.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/TailDup/2008-05-13-InfiniteLoop.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,26 @@
+; RUN: llvm-as < %s | opt -tailduplicate | llc
+; PR2323
+
+define i32 @func_27(i32 %p_28) nounwind  {
+entry:
+  %tmp125 = trunc i32 %p_28 to i8   ; <i8> [#uses=1]
+  %tmp5.i = icmp eq i8 %tmp125, 0   ; <i1> [#uses=1]
+  br i1 %tmp5.i, label %bb8.i, label %bb.i
+
+bb.i:   ; preds = %entry
+  br label %bb39.i
+
+bb8.i:    ; preds = %entry
+  br label %bb11.i
+
+bb11.i:   ; preds = %bb39.i, %bb8.i
+  %tmp126 = trunc i32 %p_28 to i8   ; <i8> [#uses=1]
+  br label %bb39.i
+
+bb39.i:   ; preds = %bb11.i, %bb.i
+  %tmp127 = trunc i32 %p_28 to i8   ; <i8> [#uses=1]
+  br label %bb11.i
+
+func_29.exit:   ; No predecessors!
+  ret i32 undef
+}

Added: llvm/branches/non-call-eh/test/Transforms/TailDup/2008-06-11-AvoidDupLoopHeader.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/TailDup/2008-06-11-AvoidDupLoopHeader.ll?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/TailDup/2008-06-11-AvoidDupLoopHeader.ll (added)
+++ llvm/branches/non-call-eh/test/Transforms/TailDup/2008-06-11-AvoidDupLoopHeader.ll Sun Jul  6 15:45:41 2008
@@ -0,0 +1,27 @@
+; RUN: llvm-as < %s | opt -tailduplicate -taildup-threshold=3 -stats -disable-output | not grep tailduplicate
+; XFAIL: *
+
+define i32 @foo(i32 %l) nounwind  {
+entry:
+	%cond = icmp eq i32 %l, 1		; <i1> [#uses=1]
+	br i1 %cond, label %bb, label %bb9
+
+bb:		; preds = %entry
+	br label %bb9
+
+bb5:		; preds = %bb9
+	%tmp7 = call i32 (...)* @bar( i32 %x.0 ) nounwind 		; <i32> [#uses=1]
+	br label %bb9
+
+bb9:		; preds = %bb5, %bb, %entry
+	%x.0 = phi i32 [ 0, %entry ], [ %tmp7, %bb5 ], [ 1525, %bb ]		; <i32> [#uses=2]
+	%l_addr.0 = phi i32 [ %l, %entry ], [ %tmp11, %bb5 ], [ %l, %bb ]		; <i32> [#uses=1]
+	%tmp11 = add i32 %l_addr.0, -1		; <i32> [#uses=2]
+	%tmp13 = icmp eq i32 %tmp11, -1		; <i1> [#uses=1]
+	br i1 %tmp13, label %bb15, label %bb5
+
+bb15:		; preds = %bb9
+	ret i32 %x.0
+}
+
+declare i32 @bar(...)

Modified: llvm/branches/non-call-eh/test/Transforms/TailDup/MergeTest.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/TailDup/MergeTest.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/TailDup/MergeTest.ll (original)
+++ llvm/branches/non-call-eh/test/Transforms/TailDup/MergeTest.ll Sun Jul  6 15:45:41 2008
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -tailduplicate  | llvm-dis | grep add | not grep uses=1
+; RUN: llvm-as < %s | opt -tailduplicate -taildup-threshold=2 | llvm-dis | grep add | not grep uses=1
 
 define i32 @test1(i1 %C, i32 %A, i32* %P) {
 entry:

Modified: llvm/branches/non-call-eh/test/Transforms/TailDup/dg.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Transforms/TailDup/dg.exp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Transforms/TailDup/dg.exp (original)
+++ llvm/branches/non-call-eh/test/Transforms/TailDup/dg.exp Sun Jul  6 15:45:41 2008
@@ -1,3 +1,3 @@
 load_lib llvm.exp
 
-RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]

Modified: llvm/branches/non-call-eh/test/Verifier/2004-05-21-SwitchConstantMismatch.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Verifier/2004-05-21-SwitchConstantMismatch.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Verifier/2004-05-21-SwitchConstantMismatch.ll (original)
+++ llvm/branches/non-call-eh/test/Verifier/2004-05-21-SwitchConstantMismatch.ll Sun Jul  6 15:45:41 2008
@@ -1,4 +1,4 @@
-; RUN: not llvm-as -f %s -o /dev/null
+; RUN: not llvm-as < %s >& /dev/null
 
 
 

Modified: llvm/branches/non-call-eh/test/Verifier/2006-07-11-StoreStruct.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Verifier/2006-07-11-StoreStruct.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Verifier/2006-07-11-StoreStruct.ll (original)
+++ llvm/branches/non-call-eh/test/Verifier/2006-07-11-StoreStruct.ll Sun Jul  6 15:45:41 2008
@@ -1,5 +1,7 @@
-; RUN: not llvm-as < %s |& grep {Instruction operands must be first-class}
-; PR826
+; RUN: llvm-as < %s |& not grep {Instruction operands must be first-class}
+
+; This previously was for PR826, but structs are now first-class so
+; the following is now valid.
 
         %struct_4 = type { i32 }
 

Modified: llvm/branches/non-call-eh/test/Verifier/2007-12-21-InvokeParamAttrs.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Verifier/2007-12-21-InvokeParamAttrs.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Verifier/2007-12-21-InvokeParamAttrs.ll (original)
+++ llvm/branches/non-call-eh/test/Verifier/2007-12-21-InvokeParamAttrs.ll Sun Jul  6 15:45:41 2008
@@ -1,4 +1,4 @@
-; RUN: not llvm-as < %s
+; RUN: not llvm-as < %s >& /dev/null
 
 declare void @foo(i8*)
 

Modified: llvm/branches/non-call-eh/test/Verifier/2008-01-11-VarargAttrs.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Verifier/2008-01-11-VarargAttrs.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Verifier/2008-01-11-VarargAttrs.ll (original)
+++ llvm/branches/non-call-eh/test/Verifier/2008-01-11-VarargAttrs.ll Sun Jul  6 15:45:41 2008
@@ -1,4 +1,4 @@
-; RUN: not llvm-as < %s -o /dev/null
+; RUN: not llvm-as < %s >& /dev/null
 
 	%struct = type {  }
 

Modified: llvm/branches/non-call-eh/test/Verifier/byval-1.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Verifier/byval-1.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Verifier/byval-1.ll (original)
+++ llvm/branches/non-call-eh/test/Verifier/byval-1.ll Sun Jul  6 15:45:41 2008
@@ -1,2 +1,2 @@
-; RUN: not llvm-as < %s -o /dev/null -f
+; RUN: not llvm-as < %s >& /dev/null
 declare void @h(i32 byval %num)

Modified: llvm/branches/non-call-eh/test/Verifier/byval-2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Verifier/byval-2.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Verifier/byval-2.ll (original)
+++ llvm/branches/non-call-eh/test/Verifier/byval-2.ll Sun Jul  6 15:45:41 2008
@@ -1,3 +1,3 @@
-; RUN: llvm-as < %s -o /dev/null -f
+; RUN: llvm-as %s -o /dev/null -f
 	%s = type opaque
 declare void @h(%s* byval %num)

Modified: llvm/branches/non-call-eh/test/Verifier/byval-4.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Verifier/byval-4.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Verifier/byval-4.ll (original)
+++ llvm/branches/non-call-eh/test/Verifier/byval-4.ll Sun Jul  6 15:45:41 2008
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s -o /dev/null -f
+; RUN: llvm-as %s -o /dev/null -f
 %struct.foo = type { i64 }
 
 declare void @h(%struct.foo* byval %num)

Modified: llvm/branches/non-call-eh/test/Verifier/dg.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Verifier/dg.exp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Verifier/dg.exp (original)
+++ llvm/branches/non-call-eh/test/Verifier/dg.exp Sun Jul  6 15:45:41 2008
@@ -1,3 +1,3 @@
 load_lib llvm.exp
 
-RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]

Modified: llvm/branches/non-call-eh/test/Verifier/gcread-ptrptr.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Verifier/gcread-ptrptr.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Verifier/gcread-ptrptr.ll (original)
+++ llvm/branches/non-call-eh/test/Verifier/gcread-ptrptr.ll Sun Jul  6 15:45:41 2008
@@ -1,4 +1,4 @@
-; RUN: not llvm-as < %s
+; RUN: not llvm-as < %s >& /dev/null
 ; PR1633
 
 %meta = type { i8* }

Modified: llvm/branches/non-call-eh/test/Verifier/gcroot-alloca.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Verifier/gcroot-alloca.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Verifier/gcroot-alloca.ll (original)
+++ llvm/branches/non-call-eh/test/Verifier/gcroot-alloca.ll Sun Jul  6 15:45:41 2008
@@ -1,4 +1,4 @@
-; RUN: not llvm-as < %s
+; RUN: not llvm-as < %s >& /dev/null
 ; PR1633
 
 %meta = type { i8* }

Modified: llvm/branches/non-call-eh/test/Verifier/gcroot-meta.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Verifier/gcroot-meta.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Verifier/gcroot-meta.ll (original)
+++ llvm/branches/non-call-eh/test/Verifier/gcroot-meta.ll Sun Jul  6 15:45:41 2008
@@ -1,4 +1,4 @@
-; RUN: not llvm-as < %s
+; RUN: not llvm-as < %s >& /dev/null
 ; PR1633
 
 %meta = type { i8* }

Modified: llvm/branches/non-call-eh/test/Verifier/gcroot-ptrptr.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Verifier/gcroot-ptrptr.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Verifier/gcroot-ptrptr.ll (original)
+++ llvm/branches/non-call-eh/test/Verifier/gcroot-ptrptr.ll Sun Jul  6 15:45:41 2008
@@ -1,4 +1,4 @@
-; RUN: not llvm-as < %s
+; RUN: not llvm-as < %s >& /dev/null
 ; PR1633
 
 %meta = type { i8* }

Modified: llvm/branches/non-call-eh/test/Verifier/gcwrite-ptrptr.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Verifier/gcwrite-ptrptr.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Verifier/gcwrite-ptrptr.ll (original)
+++ llvm/branches/non-call-eh/test/Verifier/gcwrite-ptrptr.ll Sun Jul  6 15:45:41 2008
@@ -1,4 +1,4 @@
-; RUN: not llvm-as < %s
+; RUN: not llvm-as < %s >& /dev/null
 ; PR1633
 
 %meta = type { i8* }

Modified: llvm/branches/non-call-eh/test/Verifier/invoke-2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/Verifier/invoke-2.ll?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/Verifier/invoke-2.ll (original)
+++ llvm/branches/non-call-eh/test/Verifier/invoke-2.ll Sun Jul  6 15:45:41 2008
@@ -1,4 +1,4 @@
-; RUN: not llvm-as < %s -f |& grep {not verify as correct}
+; RUN: not llvm-as %s -f |& grep {not verify as correct}
 ; PR1042
 
 define i32 @foo() {

Modified: llvm/branches/non-call-eh/test/lib/llvm.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/lib/llvm.exp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/lib/llvm.exp (original)
+++ llvm/branches/non-call-eh/test/lib/llvm.exp Sun Jul  6 15:45:41 2008
@@ -31,8 +31,12 @@
         set resultmsg "$test$PRS\nFailed with posix($posixNum,$posixMsg)$errmsg"
       }
       NONE {
+        # Any other error such as stderr output of a program, or syntax error in
+        # the RUN line.
+        set resultmsg "$test$PRS\nFailed with unknown error (or has stderr output)$errmsg" 
       }
       default {
+        set resultmsg "$test$PRS\nFailed with unknown error$errmsg" 
       }
     }
   } 
@@ -53,9 +57,9 @@
   #replace %prcontext with prcontext.tcl (Must replace before %p)
   regsub -all {%prcontext} $new_line $prcontext new_line
   #replace %llvmgcc with actual path to llvmgcc
-  regsub -all {%llvmgcc} $new_line "$llvmgcc -emit-llvm" new_line
+  regsub -all {%llvmgcc} $new_line "$llvmgcc -emit-llvm -w" new_line
   #replace %llvmgxx with actual path to llvmg++
-  regsub -all {%llvmgxx} $new_line "$llvmgxx -emit-llvm" new_line
+  regsub -all {%llvmgxx} $new_line "$llvmgxx -emit-llvm -w" new_line
   #replace %compile_cxx with C++ compilation command
   regsub -all {%compile_cxx} $new_line "$compile_cxx" new_line
   #replace %compile_c with C compilation command
@@ -234,7 +238,7 @@
     c++     { set file cc1plus }
     objc    { set file cc1 }
     objc++  { set file cc1 }
-    fortran { set file fcc1 }
+    fortran { set file f951 }
     default { return 0 }
   }
   foreach supported_lang [split "$llvmgcc_langs" ,] {

Modified: llvm/branches/non-call-eh/test/lib/llvm2cpp.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/test/lib/llvm2cpp.exp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/test/lib/llvm2cpp.exp (original)
+++ llvm/branches/non-call-eh/test/lib/llvm2cpp.exp Sun Jul  6 15:45:41 2008
@@ -9,7 +9,7 @@
   global subdir llvmtoolsdir llvmlibsdir objdir srcdir objroot srcroot 
   set timeout 30
   set path [file join $objdir $subdir]
-  set llvm2cpp [file join $llvmtoolsdir llvm2cpp ]
+  set llc [file join $llvmtoolsdir llc ]
   set llvmas [file join $llvmtoolsdir llvm-as ]
   set llvmdis [file join $llvmtoolsdir llvm-dis ]
 
@@ -65,7 +65,7 @@
     }
 
     set retval [ catch { 
-      exec -keepnewline $llvm2cpp -f -o $generated < $bytecode 2>/dev/null } msg]
+      exec -keepnewline $llc -march=cpp -f -o $generated < $bytecode 2>/dev/null } msg]
 
     if { $retval != 0 } {
       fail "$test: llvm2cpp returned $retval\n$msg"

Modified: llvm/branches/non-call-eh/tools/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/Makefile?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/tools/Makefile (original)
+++ llvm/branches/non-call-eh/tools/Makefile Sun Jul  6 15:45:41 2008
@@ -15,18 +15,15 @@
                  opt llvm-as llvm-dis \
                  llc llvm-ranlib llvm-ar llvm-nm \
                  llvm-ld llvm-prof llvm-link \
-		 lli gccas gccld llvm-extract llvm-db llvm2cpp \
+		 lli gccas gccld llvm-extract llvm-db \
 		 bugpoint llvm-bcanalyzer llvm-stub llvmc2
 
 
 include $(LEVEL)/Makefile.config
 
-# Disable liblto as it is going away
-#PARALLEL_DIRS += lto
-
 # only build new lto project on Darwin for now
 ifeq ($(OS),Darwin)
-PARALLEL_DIRS += lto2
+PARALLEL_DIRS += lto
 endif
 
 include $(LEVEL)/Makefile.common

Modified: llvm/branches/non-call-eh/tools/bugpoint/CrashDebugger.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/bugpoint/CrashDebugger.cpp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/tools/bugpoint/CrashDebugger.cpp (original)
+++ llvm/branches/non-call-eh/tools/bugpoint/CrashDebugger.cpp Sun Jul  6 15:45:41 2008
@@ -14,7 +14,7 @@
 #include "BugDriver.h"
 #include "ToolRunner.h"
 #include "ListReducer.h"
-#include "llvm/Constant.h"
+#include "llvm/Constants.h"
 #include "llvm/DerivedTypes.h"
 #include "llvm/Instructions.h"
 #include "llvm/Module.h"
@@ -300,17 +300,16 @@
         for (succ_iterator SI = succ_begin(BB), E = succ_end(BB); SI != E; ++SI)
           (*SI)->removePredecessor(BB);
 
-        if (BB->getTerminator()->getType() != Type::VoidTy)
-          BB->getTerminator()->replaceAllUsesWith(
-                      Constant::getNullValue(BB->getTerminator()->getType()));
+        TerminatorInst *BBTerm = BB->getTerminator();
+        
+        if (isa<StructType>(BBTerm->getType()))
+           BBTerm->replaceAllUsesWith(UndefValue::get(BBTerm->getType()));
+        else if (BB->getTerminator()->getType() != Type::VoidTy)
+          BBTerm->replaceAllUsesWith(Constant::getNullValue(BBTerm->getType()));
 
-        // Delete the old terminator instruction...
+        // Replace the old terminator instruction.
         BB->getInstList().pop_back();
-
-        // Add a new return instruction of the appropriate type...
-        const Type *RetTy = BB->getParent()->getReturnType();
-        ReturnInst::Create(RetTy == Type::VoidTy ? 0 :
-                           Constant::getNullValue(RetTy), BB);
+        new UnreachableInst(BB);
       }
 
   // The CFG Simplifier pass may delete one of the basic blocks we are

Modified: llvm/branches/non-call-eh/tools/bugpoint/ExecutionDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/bugpoint/ExecutionDriver.cpp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/tools/bugpoint/ExecutionDriver.cpp (original)
+++ llvm/branches/non-call-eh/tools/bugpoint/ExecutionDriver.cpp Sun Jul  6 15:45:41 2008
@@ -28,7 +28,7 @@
   // for miscompilation.
   //
   enum OutputType {
-    AutoPick, RunLLI, RunJIT, RunLLC, RunCBE, CBE_bug, LLC_Safe
+    AutoPick, RunLLI, RunJIT, RunLLC, RunCBE, CBE_bug, LLC_Safe, Custom
   };
 
   cl::opt<double>
@@ -48,6 +48,9 @@
                             clEnumValN(RunCBE, "run-cbe", "Compile with CBE"),
                             clEnumValN(CBE_bug,"cbe-bug", "Find CBE bugs"),
                             clEnumValN(LLC_Safe, "llc-safe", "Use LLC for all"),
+                            clEnumValN(Custom, "run-custom",
+                            "Use -exec-command to define a command to execute "
+                            "the bitcode. Useful for cross-compilation."),
                             clEnumValEnd),
                  cl::init(AutoPick));
 
@@ -71,8 +74,13 @@
                          "into executing programs"));
 
   cl::list<std::string>
-    AdditionalLinkerArgs("Xlinker", 
+  AdditionalLinkerArgs("Xlinker", 
       cl::desc("Additional arguments to pass to the linker"));
+
+  cl::opt<std::string>
+  CustomExecCommand("exec-command", cl::init("simulate"),
+      cl::desc("Command to execute the bitcode (use with -run-custom) "
+               "(default: simulate)"));
 }
 
 namespace llvm {
@@ -148,11 +156,18 @@
     Interpreter = AbstractInterpreter::createCBE(getToolName(), Message,
                                                  &ToolArgv);
     break;
+  case Custom:
+    Interpreter = AbstractInterpreter::createCustom(getToolName(), Message,
+                                                    CustomExecCommand);
+    break;
   default:
     Message = "Sorry, this back-end is not supported by bugpoint right now!\n";
     break;
   }
-  std::cerr << Message;
+  if (!Interpreter)
+    std::cerr << Message;
+  else // Display informational messages on stdout instead of stderr
+    std::cout << Message;
 
   // Initialize auxiliary tools for debugging
   if (InterpreterSel == RunCBE) {

Modified: llvm/branches/non-call-eh/tools/bugpoint/ExtractFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/bugpoint/ExtractFunction.cpp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/tools/bugpoint/ExtractFunction.cpp (original)
+++ llvm/branches/non-call-eh/tools/bugpoint/ExtractFunction.cpp Sun Jul  6 15:45:41 2008
@@ -71,7 +71,9 @@
   Instruction *TheInst = RI;              // Got the corresponding instruction!
 
   // If this instruction produces a value, replace any users with null values
-  if (TheInst->getType() != Type::VoidTy)
+  if (isa<StructType>(TheInst->getType()))
+    TheInst->replaceAllUsesWith(UndefValue::get(TheInst->getType()));
+  else if (TheInst->getType() != Type::VoidTy)
     TheInst->replaceAllUsesWith(Constant::getNullValue(TheInst->getType()));
 
   // Remove the instruction from the program.

Modified: llvm/branches/non-call-eh/tools/bugpoint/Miscompilation.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/bugpoint/Miscompilation.cpp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/tools/bugpoint/Miscompilation.cpp (original)
+++ llvm/branches/non-call-eh/tools/bugpoint/Miscompilation.cpp Sun Jul  6 15:45:41 2008
@@ -734,18 +734,22 @@
           // Resolve the call to function F via the JIT API:
           //
           // call resolver(GetElementPtr...)
-          CallInst *Resolver = CallInst::Create(resolverFunc, ResolverArgs.begin(),
-                                                ResolverArgs.end(),
-                                                "resolver", LookupBB);
-          // cast the result from the resolver to correctly-typed function
-          CastInst *CastedResolver = new BitCastInst(Resolver, 
-            PointerType::getUnqual(F->getFunctionType()), "resolverCast", LookupBB);
+          CallInst *Resolver =
+            CallInst::Create(resolverFunc, ResolverArgs.begin(),
+                             ResolverArgs.end(), "resolver", LookupBB);
+
+          // Cast the result from the resolver to correctly-typed function.
+          CastInst *CastedResolver =
+            new BitCastInst(Resolver,
+                            PointerType::getUnqual(F->getFunctionType()),
+                            "resolverCast", LookupBB);
 
           // Save the value in our cache.
           new StoreInst(CastedResolver, Cache, LookupBB);
           BranchInst::Create(DoCallBB, LookupBB);
 
-          PHINode *FuncPtr = PHINode::Create(NullPtr->getType(), "fp", DoCallBB);
+          PHINode *FuncPtr = PHINode::Create(NullPtr->getType(),
+                                             "fp", DoCallBB);
           FuncPtr->addIncoming(CastedResolver, LookupBB);
           FuncPtr->addIncoming(CachedVal, EntryBB);
 

Modified: llvm/branches/non-call-eh/tools/bugpoint/OptimizerDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/bugpoint/OptimizerDriver.cpp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/tools/bugpoint/OptimizerDriver.cpp (original)
+++ llvm/branches/non-call-eh/tools/bugpoint/OptimizerDriver.cpp Sun Jul  6 15:45:41 2008
@@ -114,6 +114,8 @@
   return 0;
 }
 
+cl::opt<bool> SilencePasses("silence-passes", cl::desc("Suppress output of running passes (both stdout and stderr)"));
+
 /// 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,
@@ -192,7 +194,12 @@
     prog = sys::Program::FindProgramByName("valgrind");
   else
     prog = tool;
-  int result = sys::Program::ExecuteAndWait(prog, args, 0, 0,
+  
+  // Redirect stdout and stderr to nowhere if SilencePasses is given
+  sys::Path Nowhere;
+  const sys::Path *Redirects[3] = {0, &Nowhere, &Nowhere};
+
+  int result = sys::Program::ExecuteAndWait(prog, args, 0, (SilencePasses ? Redirects : 0),
                                             Timeout, MemoryLimit, &ErrMsg);
 
   // If we are supposed to delete the bitcode file or if the passes crashed,

Modified: llvm/branches/non-call-eh/tools/bugpoint/ToolRunner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/bugpoint/ToolRunner.cpp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/tools/bugpoint/ToolRunner.cpp (original)
+++ llvm/branches/non-call-eh/tools/bugpoint/ToolRunner.cpp Sun Jul  6 15:45:41 2008
@@ -174,6 +174,110 @@
   return 0;
 }
 
+//===---------------------------------------------------------------------===//
+// Custom execution command implementation of AbstractIntepreter interface
+//
+// Allows using a custom command for executing the bitcode, thus allows,
+// for example, to invoke a cross compiler for code generation followed by 
+// a simulator that executes the generated binary.
+namespace {
+  class CustomExecutor : public AbstractInterpreter {
+    std::string ExecutionCommand;
+    std::vector<std::string> ExecutorArgs;
+  public:
+    CustomExecutor(
+      const std::string &ExecutionCmd, std::vector<std::string> ExecArgs) :
+      ExecutionCommand(ExecutionCmd), ExecutorArgs(ExecArgs) {}
+
+    virtual int ExecuteProgram(const std::string &Bitcode,
+                               const std::vector<std::string> &Args,
+                               const std::string &InputFile,
+                               const std::string &OutputFile,
+                               const std::vector<std::string> &GCCArgs,
+                               const std::vector<std::string> &SharedLibs =
+                               std::vector<std::string>(),
+                               unsigned Timeout = 0,
+                               unsigned MemoryLimit = 0);
+  };
+}
+
+int CustomExecutor::ExecuteProgram(const std::string &Bitcode,
+                        const std::vector<std::string> &Args,
+                        const std::string &InputFile,
+                        const std::string &OutputFile,
+                        const std::vector<std::string> &GCCArgs,
+                        const std::vector<std::string> &SharedLibs,
+                        unsigned Timeout,
+                        unsigned MemoryLimit) {
+
+  std::vector<const char*> ProgramArgs;
+  ProgramArgs.push_back(ExecutionCommand.c_str());
+
+  for (std::size_t i = 0; i < ExecutorArgs.size(); ++i)
+    ProgramArgs.push_back(ExecutorArgs.at(i).c_str());
+  ProgramArgs.push_back(Bitcode.c_str());
+  ProgramArgs.push_back(0);
+
+  // Add optional parameters to the running program from Argv
+  for (unsigned i=0, e = Args.size(); i != e; ++i)
+    ProgramArgs.push_back(Args[i].c_str());
+
+  return RunProgramWithTimeout(
+    sys::Path(ExecutionCommand),
+    &ProgramArgs[0], sys::Path(InputFile), sys::Path(OutputFile), 
+    sys::Path(OutputFile), Timeout, MemoryLimit);
+}
+
+// Custom execution environment create method, takes the execution command
+// as arguments
+AbstractInterpreter *AbstractInterpreter::createCustom(
+                    const std::string &ProgramPath,
+                    std::string &Message,
+                    const std::string &ExecCommandLine) {
+
+  std::string Command = "";
+  std::vector<std::string> Args;
+  std::string delimiters = " ";
+
+  // Tokenize the ExecCommandLine to the command and the args to allow
+  // defining a full command line as the command instead of just the
+  // executed program. We cannot just pass the whole string after the command
+  // as a single argument because then program sees only a single
+  // command line argument (with spaces in it: "foo bar" instead 
+  // of "foo" and "bar").
+
+  // code borrowed from: 
+  // http://oopweb.com/CPP/Documents/CPPHOWTO/Volume/C++Programming-HOWTO-7.html
+  std::string::size_type lastPos = 
+    ExecCommandLine.find_first_not_of(delimiters, 0);
+  std::string::size_type pos = 
+    ExecCommandLine.find_first_of(delimiters, lastPos);
+
+  while (std::string::npos != pos || std::string::npos != lastPos) {
+    std::string token = ExecCommandLine.substr(lastPos, pos - lastPos);
+    if (Command == "")
+       Command = token;
+    else
+       Args.push_back(token);
+    // Skip delimiters.  Note the "not_of"
+    lastPos = ExecCommandLine.find_first_not_of(delimiters, pos);
+    // Find next "non-delimiter"
+    pos = ExecCommandLine.find_first_of(delimiters, lastPos);
+  }
+
+  std::string CmdPath = FindExecutable(Command, ProgramPath).toString();
+  if (CmdPath.empty()) {
+    Message = 
+      std::string("Cannot find '") + Command + 
+      "' in executable directory or PATH!\n";
+    return 0;
+  }
+
+  Message = "Found command in: " + CmdPath + "\n";
+
+  return new CustomExecutor(CmdPath, Args);
+}
+
 //===----------------------------------------------------------------------===//
 // LLC Implementation of AbstractIntepreter interface
 //

Modified: llvm/branches/non-call-eh/tools/bugpoint/ToolRunner.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/bugpoint/ToolRunner.h?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/tools/bugpoint/ToolRunner.h (original)
+++ llvm/branches/non-call-eh/tools/bugpoint/ToolRunner.h Sun Jul  6 15:45:41 2008
@@ -98,6 +98,10 @@
                                         std::string &Message,
                                         const std::vector<std::string> *Args=0);
 
+  static AbstractInterpreter* createCustom(const std::string &ProgramPath,
+                                           std::string &Message,
+                                           const std::string &ExecCommandLine);
+
 
   virtual ~AbstractInterpreter() {}
 

Modified: llvm/branches/non-call-eh/tools/llc/llc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/llc/llc.cpp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/tools/llc/llc.cpp (original)
+++ llvm/branches/non-call-eh/tools/llc/llc.cpp Sun Jul  6 15:45:41 2008
@@ -134,10 +134,15 @@
     
   switch (FileType) {
   case TargetMachine::AssemblyFile:
-    if (MArch->Name[0] != 'c' || MArch->Name[1] != 0)  // not CBE
+    if (MArch->Name[0] == 'c') {
+      if (MArch->Name[1] == 0)
+        OutputFilename += ".cbe.c";
+      else if (MArch->Name[1] == 'p' && MArch->Name[2] == 'p')
+        OutputFilename += ".cpp";
+      else
+        OutputFilename += ".s";
+    } else
       OutputFilename += ".s";
-    else
-      OutputFilename += ".cbe.c";
     break;
   case TargetMachine::ObjectFile:
     OutputFilename += ".o";

Modified: llvm/branches/non-call-eh/tools/lli/lli.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/lli/lli.cpp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/tools/lli/lli.cpp (original)
+++ llvm/branches/non-call-eh/tools/lli/lli.cpp Sun Jul  6 15:45:41 2008
@@ -52,6 +52,11 @@
   cl::opt<bool>
   DisableCoreFiles("disable-core-files", cl::Hidden,
                    cl::desc("Disable emission of core files if possible"));
+
+  cl::opt<bool>
+  NoLazyCompilation("disable-lazy-compilation",
+                  cl::desc("Disable JIT lazy compilation"),
+                  cl::init(false));
 }
 
 static ExecutionEngine *EE = 0;
@@ -76,8 +81,8 @@
   
   // Load the bitcode...
   std::string ErrorMsg;
-  ModuleProvider *MP = 0;
-  if (MemoryBuffer *Buffer = MemoryBuffer::getFileOrSTDIN(InputFile,&ErrorMsg)){
+  ModuleProvider *MP = NULL;
+  if (MemoryBuffer *Buffer = MemoryBuffer::getFileOrSTDIN(InputFile,&ErrorMsg)) {
     MP = getBitcodeModuleProvider(Buffer, &ErrorMsg);
     if (!MP) delete Buffer;
   }
@@ -89,18 +94,27 @@
   }
 
   // Get the module as the MP could go away once EE takes over.
-  Module *Mod = MP->getModule();
+  Module *Mod = NoLazyCompilation
+    ? MP->materializeModule(&ErrorMsg) : MP->getModule();
+  if (!Mod) {
+    std::cerr << argv[0] << ": bitcode didn't read correctly.\n";
+    std::cerr << "Reason: " << ErrorMsg << "\n";
+    exit(1);
+  }
 
   // If we are supposed to override the target triple, do so now.
   if (!TargetTriple.empty())
     Mod->setTargetTriple(TargetTriple);
-  
+
   EE = ExecutionEngine::create(MP, ForceInterpreter, &ErrorMsg);
   if (!EE && !ErrorMsg.empty()) {
     std::cerr << argv[0] << ":error creating EE: " << ErrorMsg << "\n";
     exit(1);
   }
 
+  if (NoLazyCompilation)
+    EE->DisableLazyCompilation();
+
   // If the user specifically requested an argv[0] to pass into the program,
   // do it now.
   if (!FakeArgv0.empty()) {
@@ -120,8 +134,8 @@
   // using the contents of Args to determine argc & argv, and the contents of
   // EnvVars to determine envp.
   //
-  Function *Fn = Mod->getFunction("main");
-  if (!Fn) {
+  Function *MainFn = Mod->getFunction("main");
+  if (!MainFn) {
     std::cerr << "'main' function not found in module.\n";
     return -1;
   }
@@ -136,9 +150,17 @@
  
   // Run static constructors.
   EE->runStaticConstructorsDestructors(false);
-  
+
+  if (NoLazyCompilation) {
+    for (Module::iterator I = Mod->begin(), E = Mod->end(); I != E; ++I) {
+      Function *Fn = &*I;
+      if (Fn != MainFn && !Fn->isDeclaration())
+        EE->getPointerToFunction(Fn);
+    }
+  }
+
   // Run main.
-  int Result = EE->runFunctionAsMain(Fn, InputArgv, envp);
+  int Result = EE->runFunctionAsMain(MainFn, InputArgv, envp);
 
   // Run static destructors.
   EE->runStaticConstructorsDestructors(true);

Modified: llvm/branches/non-call-eh/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp (original)
+++ llvm/branches/non-call-eh/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp Sun Jul  6 15:45:41 2008
@@ -172,7 +172,6 @@
     switch (CodeID) {
     default: return 0;
     case bitc::FUNC_CODE_DECLAREBLOCKS: return "DECLAREBLOCKS";
-    case bitc::FUNC_CODE_INST_BB_UNWINDDEST: return "UNWINDDEST";
     
     case bitc::FUNC_CODE_INST_BINOP:       return "INST_BINOP";
     case bitc::FUNC_CODE_INST_CAST:        return "INST_CAST";

Modified: llvm/branches/non-call-eh/tools/llvm-ld/Optimize.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/llvm-ld/Optimize.cpp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/tools/llvm-ld/Optimize.cpp (original)
+++ llvm/branches/non-call-eh/tools/llvm-ld/Optimize.cpp Sun Jul  6 15:45:41 2008
@@ -35,35 +35,6 @@
 //Don't verify at the end
 static cl::opt<bool> DontVerify("disable-verify", cl::ReallyHidden);
 
-// Optimization Enumeration
-enum OptimizationLevels {
-  OPT_FAST_COMPILE         = 1,
-  OPT_SIMPLE               = 2,
-  OPT_AGGRESSIVE           = 3,
-  OPT_LINK_TIME            = 4,
-  OPT_AGGRESSIVE_LINK_TIME = 5
-};
-
-// Optimization Options
-static cl::opt<OptimizationLevels> OptLevel(
-  cl::desc("Choose level of optimization to apply:"),
-  cl::init(OPT_FAST_COMPILE), cl::values(
-    clEnumValN(OPT_FAST_COMPILE,"O0",
-      "An alias for the -O1 option."),
-    clEnumValN(OPT_FAST_COMPILE,"O1",
-      "Optimize for linking speed, not execution speed."),
-    clEnumValN(OPT_SIMPLE,"O2",
-      "Perform only required/minimal optimizations"),
-    clEnumValN(OPT_AGGRESSIVE,"O3",
-      "An alias for the -O2 option."),
-    clEnumValN(OPT_LINK_TIME,"O4",
-      "Perform standard link time optimizations"),
-    clEnumValN(OPT_AGGRESSIVE_LINK_TIME,"O5",
-      "Perform aggressive link time optimizations"),
-    clEnumValEnd
-  )
-);
-
 static cl::opt<bool> DisableInline("disable-inlining",
   cl::desc("Do not run the inliner pass"));
 
@@ -162,20 +133,23 @@
 
     // The IPO passes may leave cruft around.  Clean up after them.
     addPass(Passes, createInstructionCombiningPass());
-
+    addPass(Passes, createJumpThreadingPass());        // Thread jumps.
     addPass(Passes, createScalarReplAggregatesPass()); // Break up allocas
 
     // Run a few AA driven optimizations here and now, to cleanup the code.
     addPass(Passes, createGlobalsModRefPass());      // IP alias analysis
 
     addPass(Passes, createLICMPass());               // Hoist loop invariants
-    addPass(Passes, createMemCpyOptPass());          // Remove dead memcpy's
     addPass(Passes, createGVNPass());                  // Remove redundancies
+    addPass(Passes, createMemCpyOptPass());          // Remove dead memcpy's
     addPass(Passes, createDeadStoreEliminationPass()); // Nuke dead stores
 
     // Cleanup and simplify the code after the scalar optimizations.
     addPass(Passes, createInstructionCombiningPass());
 
+    addPass(Passes, createJumpThreadingPass());        // Thread jumps.
+    addPass(Passes, createPromoteMemoryToRegisterPass()); // Cleanup jumpthread.
+    
     // Delete basic blocks, which optimization passes may have killed...
     addPass(Passes, createCFGSimplificationPass());
 
@@ -205,7 +179,7 @@
   if (!DisableOptimizations) {
     addPass(Passes, createInstructionCombiningPass());
     addPass(Passes, createCFGSimplificationPass());
-    addPass(Passes, createDeadCodeEliminationPass());
+    addPass(Passes, createAggressiveDCEPass());
     addPass(Passes, createGlobalDCEPass());
   }
 

Modified: llvm/branches/non-call-eh/tools/llvm-ld/llvm-ld.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/llvm-ld/llvm-ld.cpp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/tools/llvm-ld/llvm-ld.cpp (original)
+++ llvm/branches/non-call-eh/tools/llvm-ld/llvm-ld.cpp Sun Jul  6 15:45:41 2008
@@ -251,6 +251,9 @@
   // Run LLC to convert the bitcode file into assembly code.
   std::vector<const char*> args;
   args.push_back(llc.c_str());
+  // We will use GCC to assemble the program so set the assembly syntax to AT&T,
+  // regardless of what the target in the bitcode file is.
+  args.push_back("-x86-asm-syntax=att");
   args.push_back("-f");
   args.push_back("-o");
   args.push_back(OutputFilename.c_str());
@@ -530,8 +533,24 @@
     // Optimize the module
     Optimize(Composite.get());
 
+#if defined(_WIN32) || defined(__CYGWIN__)
+    if (!LinkAsLibrary) {
+      // Default to "a.exe" instead of "a.out".
+      if (OutputFilename.getNumOccurrences() == 0)
+        OutputFilename = "a.exe";
+
+      // If there is no suffix add an "exe" one.
+      sys::Path ExeFile( OutputFilename );
+      if (ExeFile.getSuffix() == "") {
+        ExeFile.appendSuffix("exe");
+        OutputFilename = ExeFile.toString();
+      }
+    }
+#endif
+
     // Generate the bitcode for the optimized module.
     std::string RealBitcodeOutput = OutputFilename;
+
     if (!LinkAsLibrary) RealBitcodeOutput += ".bc";
     GenerateBitcode(Composite.get(), RealBitcodeOutput);
 

Modified: llvm/branches/non-call-eh/tools/llvm-link/llvm-link.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/llvm-link/llvm-link.cpp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/tools/llvm-link/llvm-link.cpp (original)
+++ llvm/branches/non-call-eh/tools/llvm-link/llvm-link.cpp Sun Jul  6 15:45:41 2008
@@ -19,6 +19,7 @@
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/MemoryBuffer.h"
+#include "llvm/Support/Streams.h"
 #include "llvm/System/Signals.h"
 #include "llvm/System/Path.h"
 #include <fstream>

Modified: llvm/branches/non-call-eh/tools/llvm-nm/llvm-nm.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/llvm-nm/llvm-nm.cpp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/tools/llvm-nm/llvm-nm.cpp (original)
+++ llvm/branches/non-call-eh/tools/llvm-nm/llvm-nm.cpp Sun Jul  6 15:45:41 2008
@@ -70,6 +70,7 @@
 static char TypeCharForSymbol(GlobalValue &GV) {
   if (GV.isDeclaration())                                  return 'U';
   if (GV.hasLinkOnceLinkage())                             return 'C';
+  if (GV.hasCommonLinkage())                               return 'C';
   if (GV.hasWeakLinkage())                                 return 'W';
   if (isa<Function>(GV) && GV.hasInternalLinkage())        return 't';
   if (isa<Function>(GV))                                   return 'T';

Modified: llvm/branches/non-call-eh/tools/llvm-stub/llvm-stub.c
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/llvm-stub/llvm-stub.c?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/tools/llvm-stub/llvm-stub.c (original)
+++ llvm/branches/non-call-eh/tools/llvm-stub/llvm-stub.c Sun Jul  6 15:45:41 2008
@@ -45,11 +45,16 @@
   /* argv[0] is the JIT */
   Args[0] = Interp;
 
-#ifdef __CYGWIN32__
-  /* Cygwin strips the .exe suffix off of argv[0] to "help" us.  Put it back 
-   * on.
-   */
-  argv[0] = strcat(strcpy((char*)malloc(strlen(argv[0])+5), argv[0]), ".exe");
+#ifdef LLVM_ON_WIN32
+  {
+    int len = strlen(argv[0]);
+    if (len < 4 || strcmp(argv[0] + len - 4, ".exe") != 0) {
+      /* .exe suffix is stripped off of argv[0] if the executable was run on the
+       * command line without one. Put it back on.
+       */
+      argv[0] = strcat(strcpy((char*)malloc(len + 5), argv[0]), ".exe");
+    }
+  }
 #endif
 
   /* argv[1] is argv[0] + ".bc". */

Removed: llvm/branches/non-call-eh/tools/llvm2cpp/CppWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/llvm2cpp/CppWriter.cpp?rev=53162&view=auto

==============================================================================
--- llvm/branches/non-call-eh/tools/llvm2cpp/CppWriter.cpp (original)
+++ llvm/branches/non-call-eh/tools/llvm2cpp/CppWriter.cpp (removed)
@@ -1,1968 +0,0 @@
-//===-- CppWriter.cpp - Printing LLVM IR as a C++ Source File -------------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements the writing of the LLVM IR as a set of C++ calls to the
-// LLVM IR interface. The input module is assumed to be verified.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/CallingConv.h"
-#include "llvm/Constants.h"
-#include "llvm/DerivedTypes.h"
-#include "llvm/InlineAsm.h"
-#include "llvm/Instruction.h"
-#include "llvm/Instructions.h"
-#include "llvm/Module.h"
-#include "llvm/TypeSymbolTable.h"
-#include "llvm/ADT/StringExtras.h"
-#include "llvm/ADT/STLExtras.h"
-#include "llvm/ADT/SmallPtrSet.h"
-#include "llvm/Support/CommandLine.h"
-#include "llvm/Support/CFG.h"
-#include "llvm/Support/ManagedStatic.h"
-#include "llvm/Support/MathExtras.h"
-#include "llvm/Config/config.h"
-#include <algorithm>
-#include <iostream>
-#include <set>
-
-using namespace llvm;
-
-static cl::opt<std::string>
-FuncName("funcname", cl::desc("Specify the name of the generated function"),
-         cl::value_desc("function name"));
-
-enum WhatToGenerate {
-  GenProgram,
-  GenModule,
-  GenContents,
-  GenFunction,
-  GenFunctions,
-  GenInline,
-  GenVariable,
-  GenType
-};
-
-static cl::opt<WhatToGenerate> GenerationType(cl::Optional,
-  cl::desc("Choose what kind of output to generate"),
-  cl::init(GenProgram),
-  cl::values(
-    clEnumValN(GenProgram,  "gen-program",   "Generate a complete program"),
-    clEnumValN(GenModule,   "gen-module",    "Generate a module definition"),
-    clEnumValN(GenContents, "gen-contents",  "Generate contents of a module"),
-    clEnumValN(GenFunction, "gen-function",  "Generate a function definition"),
-    clEnumValN(GenFunctions,"gen-functions", "Generate all function definitions"),
-    clEnumValN(GenInline,   "gen-inline",    "Generate an inline function"),
-    clEnumValN(GenVariable, "gen-variable",  "Generate a variable definition"),
-    clEnumValN(GenType,     "gen-type",      "Generate a type definition"),
-    clEnumValEnd
-  )
-);
-
-static cl::opt<std::string> NameToGenerate("for", cl::Optional,
-  cl::desc("Specify the name of the thing to generate"),
-  cl::init("!bad!"));
-
-namespace {
-typedef std::vector<const Type*> TypeList;
-typedef std::map<const Type*,std::string> TypeMap;
-typedef std::map<const Value*,std::string> ValueMap;
-typedef std::set<std::string> NameSet;
-typedef std::set<const Type*> TypeSet;
-typedef std::set<const Value*> ValueSet;
-typedef std::map<const Value*,std::string> ForwardRefMap;
-
-class CppWriter {
-  const char* progname;
-  std::ostream &Out;
-  const Module *TheModule;
-  uint64_t uniqueNum;
-  TypeMap TypeNames;
-  ValueMap ValueNames;
-  TypeMap UnresolvedTypes;
-  TypeList TypeStack;
-  NameSet UsedNames;
-  TypeSet DefinedTypes;
-  ValueSet DefinedValues;
-  ForwardRefMap ForwardRefs;
-  bool is_inline;
-
-public:
-  inline CppWriter(std::ostream &o, const Module *M, const char* pn="llvm2cpp")
-    : progname(pn), Out(o), TheModule(M), uniqueNum(0), TypeNames(),
-      ValueNames(), UnresolvedTypes(), TypeStack(), is_inline(false) { }
-
-  const Module* getModule() { return TheModule; }
-
-  void printProgram(const std::string& fname, const std::string& modName );
-  void printModule(const std::string& fname, const std::string& modName );
-  void printContents(const std::string& fname, const std::string& modName );
-  void printFunction(const std::string& fname, const std::string& funcName );
-  void printFunctions();
-  void printInline(const std::string& fname, const std::string& funcName );
-  void printVariable(const std::string& fname, const std::string& varName );
-  void printType(const std::string& fname, const std::string& typeName );
-
-  void error(const std::string& msg);
-
-private:
-  void printLinkageType(GlobalValue::LinkageTypes LT);
-  void printVisibilityType(GlobalValue::VisibilityTypes VisTypes);
-  void printCallingConv(unsigned cc);
-  void printEscapedString(const std::string& str);
-  void printCFP(const ConstantFP* CFP);
-
-  std::string getCppName(const Type* val);
-  inline void printCppName(const Type* val);
-
-  std::string getCppName(const Value* val);
-  inline void printCppName(const Value* val);
-
-  void printParamAttrs(const PAListPtr &PAL, const std::string &name);
-  bool printTypeInternal(const Type* Ty);
-  inline void printType(const Type* Ty);
-  void printTypes(const Module* M);
-
-  void printConstant(const Constant *CPV);
-  void printConstants(const Module* M);
-
-  void printVariableUses(const GlobalVariable *GV);
-  void printVariableHead(const GlobalVariable *GV);
-  void printVariableBody(const GlobalVariable *GV);
-
-  void printFunctionUses(const Function *F);
-  void printFunctionHead(const Function *F);
-  void printFunctionBody(const Function *F);
-  void printInstruction(const Instruction *I, const std::string& bbname);
-  std::string getOpName(Value*);
-
-  void printModuleBody();
-
-};
-
-static unsigned indent_level = 0;
-inline std::ostream& nl(std::ostream& Out, int delta = 0) {
-  Out << "\n";
-  if (delta >= 0 || indent_level >= unsigned(-delta))
-    indent_level += delta;
-  for (unsigned i = 0; i < indent_level; ++i) 
-    Out << "  ";
-  return Out;
-}
-
-inline void in() { indent_level++; }
-inline void out() { if (indent_level >0) indent_level--; }
-
-inline void
-sanitize(std::string& str) {
-  for (size_t i = 0; i < str.length(); ++i)
-    if (!isalnum(str[i]) && str[i] != '_')
-      str[i] = '_';
-}
-
-inline std::string
-getTypePrefix(const Type* Ty ) {
-  switch (Ty->getTypeID()) {
-    case Type::VoidTyID:     return "void_";
-    case Type::IntegerTyID:  
-      return std::string("int") + utostr(cast<IntegerType>(Ty)->getBitWidth()) +
-        "_";
-    case Type::FloatTyID:    return "float_"; 
-    case Type::DoubleTyID:   return "double_"; 
-    case Type::LabelTyID:    return "label_"; 
-    case Type::FunctionTyID: return "func_"; 
-    case Type::StructTyID:   return "struct_"; 
-    case Type::ArrayTyID:    return "array_"; 
-    case Type::PointerTyID:  return "ptr_"; 
-    case Type::VectorTyID:   return "packed_"; 
-    case Type::OpaqueTyID:   return "opaque_"; 
-    default:                 return "other_"; 
-  }
-  return "unknown_";
-}
-
-// Looks up the type in the symbol table and returns a pointer to its name or
-// a null pointer if it wasn't found. Note that this isn't the same as the
-// Mode::getTypeName function which will return an empty string, not a null
-// pointer if the name is not found.
-inline const std::string* 
-findTypeName(const TypeSymbolTable& ST, const Type* Ty)
-{
-  TypeSymbolTable::const_iterator TI = ST.begin();
-  TypeSymbolTable::const_iterator TE = ST.end();
-  for (;TI != TE; ++TI)
-    if (TI->second == Ty)
-      return &(TI->first);
-  return 0;
-}
-
-void
-CppWriter::error(const std::string& msg) {
-  std::cerr << progname << ": " << msg << "\n";
-  exit(2);
-}
-
-// printCFP - Print a floating point constant .. very carefully :)
-// This makes sure that conversion to/from floating yields the same binary
-// result so that we don't lose precision.
-void 
-CppWriter::printCFP(const ConstantFP *CFP) {
-  APFloat APF = APFloat(CFP->getValueAPF());  // copy
-  if (CFP->getType() == Type::FloatTy)
-    APF.convert(APFloat::IEEEdouble, APFloat::rmNearestTiesToEven);
-  Out << "ConstantFP::get(";
-  if (CFP->getType() == Type::DoubleTy)
-    Out << "Type::DoubleTy, ";
-  else
-    Out << "Type::FloatTy, ";
-  Out << "APFloat(";
-#if HAVE_PRINTF_A
-  char Buffer[100];
-  sprintf(Buffer, "%A", APF.convertToDouble());
-  if ((!strncmp(Buffer, "0x", 2) ||
-       !strncmp(Buffer, "-0x", 3) ||
-       !strncmp(Buffer, "+0x", 3)) &&
-      APF.bitwiseIsEqual(APFloat(atof(Buffer)))) {
-    if (CFP->getType() == Type::DoubleTy)
-      Out << "BitsToDouble(" << Buffer << ")";
-    else
-      Out << "BitsToFloat((float)" << Buffer << ")";
-    Out << ")";
-  } else {
-#endif
-    std::string StrVal = ftostr(CFP->getValueAPF());
-
-    while (StrVal[0] == ' ')
-      StrVal.erase(StrVal.begin());
-
-    // Check to make sure that the stringized number is not some string like 
-    // "Inf" or NaN.  Check that the string matches the "[-+]?[0-9]" regex.
-    if (((StrVal[0] >= '0' && StrVal[0] <= '9') ||
-        ((StrVal[0] == '-' || StrVal[0] == '+') &&
-         (StrVal[1] >= '0' && StrVal[1] <= '9'))) &&
-        (CFP->isExactlyValue(atof(StrVal.c_str())))) {
-      if (CFP->getType() == Type::DoubleTy)
-        Out <<  StrVal;
-      else
-        Out << StrVal << "f";
-      }
-    else if (CFP->getType() == Type::DoubleTy)
-      Out << "BitsToDouble(0x" << std::hex 
-          << CFP->getValueAPF().convertToAPInt().getZExtValue()
-          << std::dec << "ULL) /* " << StrVal << " */";
-    else 
-      Out << "BitsToFloat(0x" << std::hex 
-          << (uint32_t)CFP->getValueAPF().convertToAPInt().getZExtValue()
-          << std::dec << "U) /* " << StrVal << " */";
-    Out << ")";
-#if HAVE_PRINTF_A
-  }
-#endif
-  Out << ")";
-}
-
-void
-CppWriter::printCallingConv(unsigned cc){
-  // Print the calling convention.
-  switch (cc) {
-    case CallingConv::C:     Out << "CallingConv::C"; break;
-    case CallingConv::Fast:  Out << "CallingConv::Fast"; break;
-    case CallingConv::Cold:  Out << "CallingConv::Cold"; break;
-    case CallingConv::FirstTargetCC: Out << "CallingConv::FirstTargetCC"; break;
-    default:                 Out << cc; break;
-  }
-}
-
-void 
-CppWriter::printLinkageType(GlobalValue::LinkageTypes LT) {
-  switch (LT) {
-    case GlobalValue::InternalLinkage:  
-      Out << "GlobalValue::InternalLinkage"; break;
-    case GlobalValue::LinkOnceLinkage:  
-      Out << "GlobalValue::LinkOnceLinkage "; break;
-    case GlobalValue::WeakLinkage:      
-      Out << "GlobalValue::WeakLinkage"; break;
-    case GlobalValue::AppendingLinkage: 
-      Out << "GlobalValue::AppendingLinkage"; break;
-    case GlobalValue::ExternalLinkage: 
-      Out << "GlobalValue::ExternalLinkage"; break;
-    case GlobalValue::DLLImportLinkage: 
-      Out << "GlobalValue::DLLImportLinkage"; break;
-    case GlobalValue::DLLExportLinkage: 
-      Out << "GlobalValue::DLLExportLinkage"; break;
-    case GlobalValue::ExternalWeakLinkage: 
-      Out << "GlobalValue::ExternalWeakLinkage"; break;
-    case GlobalValue::GhostLinkage:
-      Out << "GlobalValue::GhostLinkage"; break;
-  }
-}
-
-void
-CppWriter::printVisibilityType(GlobalValue::VisibilityTypes VisType) {
-  switch (VisType) {
-    default: assert(0 && "Unknown GVar visibility");
-    case GlobalValue::DefaultVisibility:
-      Out << "GlobalValue::DefaultVisibility";
-      break;
-    case GlobalValue::HiddenVisibility:
-      Out << "GlobalValue::HiddenVisibility";
-      break;
-    case GlobalValue::ProtectedVisibility:
-      Out << "GlobalValue::ProtectedVisibility";
-      break;
-  }
-}
-
-// printEscapedString - Print each character of the specified string, escaping
-// it if it is not printable or if it is an escape char.
-void 
-CppWriter::printEscapedString(const std::string &Str) {
-  for (unsigned i = 0, e = Str.size(); i != e; ++i) {
-    unsigned char C = Str[i];
-    if (isprint(C) && C != '"' && C != '\\') {
-      Out << C;
-    } else {
-      Out << "\\x"
-          << (char) ((C/16  < 10) ? ( C/16 +'0') : ( C/16 -10+'A'))
-          << (char)(((C&15) < 10) ? ((C&15)+'0') : ((C&15)-10+'A'));
-    }
-  }
-}
-
-std::string
-CppWriter::getCppName(const Type* Ty)
-{
-  // First, handle the primitive types .. easy
-  if (Ty->isPrimitiveType() || Ty->isInteger()) {
-    switch (Ty->getTypeID()) {
-      case Type::VoidTyID:   return "Type::VoidTy";
-      case Type::IntegerTyID: {
-        unsigned BitWidth = cast<IntegerType>(Ty)->getBitWidth();
-        return "IntegerType::get(" + utostr(BitWidth) + ")";
-      }
-      case Type::FloatTyID:  return "Type::FloatTy";
-      case Type::DoubleTyID: return "Type::DoubleTy";
-      case Type::LabelTyID:  return "Type::LabelTy";
-      default:
-        error("Invalid primitive type");
-        break;
-    }
-    return "Type::VoidTy"; // shouldn't be returned, but make it sensible
-  }
-
-  // Now, see if we've seen the type before and return that
-  TypeMap::iterator I = TypeNames.find(Ty);
-  if (I != TypeNames.end())
-    return I->second;
-
-  // Okay, let's build a new name for this type. Start with a prefix
-  const char* prefix = 0;
-  switch (Ty->getTypeID()) {
-    case Type::FunctionTyID:    prefix = "FuncTy_"; break;
-    case Type::StructTyID:      prefix = "StructTy_"; break;
-    case Type::ArrayTyID:       prefix = "ArrayTy_"; break;
-    case Type::PointerTyID:     prefix = "PointerTy_"; break;
-    case Type::OpaqueTyID:      prefix = "OpaqueTy_"; break;
-    case Type::VectorTyID:      prefix = "VectorTy_"; break;
-    default:                    prefix = "OtherTy_"; break; // prevent breakage
-  }
-
-  // See if the type has a name in the symboltable and build accordingly
-  const std::string* tName = findTypeName(TheModule->getTypeSymbolTable(), Ty);
-  std::string name;
-  if (tName) 
-    name = std::string(prefix) + *tName;
-  else
-    name = std::string(prefix) + utostr(uniqueNum++);
-  sanitize(name);
-
-  // Save the name
-  return TypeNames[Ty] = name;
-}
-
-void
-CppWriter::printCppName(const Type* Ty)
-{
-  printEscapedString(getCppName(Ty));
-}
-
-std::string
-CppWriter::getCppName(const Value* val) {
-  std::string name;
-  ValueMap::iterator I = ValueNames.find(val);
-  if (I != ValueNames.end() && I->first == val)
-    return  I->second;
-
-  if (const GlobalVariable* GV = dyn_cast<GlobalVariable>(val)) {
-    name = std::string("gvar_") + 
-           getTypePrefix(GV->getType()->getElementType());
-  } else if (isa<Function>(val)) {
-    name = std::string("func_");
-  } else if (const Constant* C = dyn_cast<Constant>(val)) {
-    name = std::string("const_") + getTypePrefix(C->getType());
-  } else if (const Argument* Arg = dyn_cast<Argument>(val)) {
-    if (is_inline) {
-      unsigned argNum = std::distance(Arg->getParent()->arg_begin(),
-          Function::const_arg_iterator(Arg)) + 1;
-      name = std::string("arg_") + utostr(argNum);
-      NameSet::iterator NI = UsedNames.find(name);
-      if (NI != UsedNames.end())
-        name += std::string("_") + utostr(uniqueNum++);
-      UsedNames.insert(name);
-      return ValueNames[val] = name;
-    } else {
-      name = getTypePrefix(val->getType());
-    }
-  } else {
-    name = getTypePrefix(val->getType());
-  }
-  name += (val->hasName() ? val->getName() : utostr(uniqueNum++));
-  sanitize(name);
-  NameSet::iterator NI = UsedNames.find(name);
-  if (NI != UsedNames.end())
-    name += std::string("_") + utostr(uniqueNum++);
-  UsedNames.insert(name);
-  return ValueNames[val] = name;
-}
-
-void
-CppWriter::printCppName(const Value* val) {
-  printEscapedString(getCppName(val));
-}
-
-void
-CppWriter::printParamAttrs(const PAListPtr &PAL, const std::string &name) {
-  Out << "PAListPtr " << name << "_PAL = 0;";
-  nl(Out);
-  if (!PAL.isEmpty()) {
-    Out << '{'; in(); nl(Out);
-    Out << "SmallVector<ParamAttrsWithIndex, 4> Attrs;"; nl(Out);
-    Out << "ParamAttrsWithIndex PAWI;"; nl(Out);
-    for (unsigned i = 0; i < PAL.getNumSlots(); ++i) {
-      uint16_t index = PAL.getSlot(i).Index;
-      ParameterAttributes attrs = PAL.getSlot(i).Attrs;
-      Out << "PAWI.index = " << index << "; PAWI.attrs = 0 ";
-      if (attrs & ParamAttr::SExt)
-        Out << " | ParamAttr::SExt";
-      if (attrs & ParamAttr::ZExt)
-        Out << " | ParamAttr::ZExt";
-      if (attrs & ParamAttr::StructRet)
-        Out << " | ParamAttr::StructRet";
-      if (attrs & ParamAttr::InReg)
-        Out << " | ParamAttr::InReg";
-      if (attrs & ParamAttr::NoReturn)
-        Out << " | ParamAttr::NoReturn";
-      if (attrs & ParamAttr::NoUnwind)
-        Out << " | ParamAttr::NoUnwind";
-      if (attrs & ParamAttr::ByVal)
-        Out << " | ParamAttr::ByVal";
-      if (attrs & ParamAttr::NoAlias)
-        Out << " | ParamAttr::NoAlias";
-      if (attrs & ParamAttr::Nest)
-        Out << " | ParamAttr::Nest";
-      if (attrs & ParamAttr::ReadNone)
-        Out << " | ParamAttr::ReadNone";
-      if (attrs & ParamAttr::ReadOnly)
-        Out << " | ParamAttr::ReadOnly";
-      Out << ";";
-      nl(Out);
-      Out << "Attrs.push_back(PAWI);";
-      nl(Out);
-    }
-    Out << name << "_PAL = PAListPtr::get(Attrs.begin(), Attrs.end());";
-    nl(Out);
-    out(); nl(Out);
-    Out << '}'; nl(Out);
-  }
-}
-
-bool
-CppWriter::printTypeInternal(const Type* Ty) {
-  // We don't print definitions for primitive types
-  if (Ty->isPrimitiveType() || Ty->isInteger())
-    return false;
-
-  // If we already defined this type, we don't need to define it again.
-  if (DefinedTypes.find(Ty) != DefinedTypes.end())
-    return false;
-
-  // Everything below needs the name for the type so get it now.
-  std::string typeName(getCppName(Ty));
-
-  // Search the type stack for recursion. If we find it, then generate this
-  // as an OpaqueType, but make sure not to do this multiple times because
-  // the type could appear in multiple places on the stack. Once the opaque
-  // definition is issued, it must not be re-issued. Consequently we have to
-  // check the UnresolvedTypes list as well.
-  TypeList::const_iterator TI = std::find(TypeStack.begin(),TypeStack.end(),Ty);
-  if (TI != TypeStack.end()) {
-    TypeMap::const_iterator I = UnresolvedTypes.find(Ty);
-    if (I == UnresolvedTypes.end()) {
-      Out << "PATypeHolder " << typeName << "_fwd = OpaqueType::get();";
-      nl(Out);
-      UnresolvedTypes[Ty] = typeName;
-    }
-    return true;
-  }
-
-  // We're going to print a derived type which, by definition, contains other
-  // types. So, push this one we're printing onto the type stack to assist with
-  // recursive definitions.
-  TypeStack.push_back(Ty);
-
-  // Print the type definition
-  switch (Ty->getTypeID()) {
-    case Type::FunctionTyID:  {
-      const FunctionType* FT = cast<FunctionType>(Ty);
-      Out << "std::vector<const Type*>" << typeName << "_args;";
-      nl(Out);
-      FunctionType::param_iterator PI = FT->param_begin();
-      FunctionType::param_iterator PE = FT->param_end();
-      for (; PI != PE; ++PI) {
-        const Type* argTy = static_cast<const Type*>(*PI);
-        bool isForward = printTypeInternal(argTy);
-        std::string argName(getCppName(argTy));
-        Out << typeName << "_args.push_back(" << argName;
-        if (isForward)
-          Out << "_fwd";
-        Out << ");";
-        nl(Out);
-      }
-      bool isForward = printTypeInternal(FT->getReturnType());
-      std::string retTypeName(getCppName(FT->getReturnType()));
-      Out << "FunctionType* " << typeName << " = FunctionType::get(";
-      in(); nl(Out) << "/*Result=*/" << retTypeName;
-      if (isForward)
-        Out << "_fwd";
-      Out << ",";
-      nl(Out) << "/*Params=*/" << typeName << "_args,";
-      nl(Out) << "/*isVarArg=*/" << (FT->isVarArg() ? "true" : "false") << ");";
-      out(); 
-      nl(Out);
-      break;
-    }
-    case Type::StructTyID: {
-      const StructType* ST = cast<StructType>(Ty);
-      Out << "std::vector<const Type*>" << typeName << "_fields;";
-      nl(Out);
-      StructType::element_iterator EI = ST->element_begin();
-      StructType::element_iterator EE = ST->element_end();
-      for (; EI != EE; ++EI) {
-        const Type* fieldTy = static_cast<const Type*>(*EI);
-        bool isForward = printTypeInternal(fieldTy);
-        std::string fieldName(getCppName(fieldTy));
-        Out << typeName << "_fields.push_back(" << fieldName;
-        if (isForward)
-          Out << "_fwd";
-        Out << ");";
-        nl(Out);
-      }
-      Out << "StructType* " << typeName << " = StructType::get("
-          << typeName << "_fields, /*isPacked=*/"
-          << (ST->isPacked() ? "true" : "false") << ");";
-      nl(Out);
-      break;
-    }
-    case Type::ArrayTyID: {
-      const ArrayType* AT = cast<ArrayType>(Ty);
-      const Type* ET = AT->getElementType();
-      bool isForward = printTypeInternal(ET);
-      std::string elemName(getCppName(ET));
-      Out << "ArrayType* " << typeName << " = ArrayType::get("
-          << elemName << (isForward ? "_fwd" : "") 
-          << ", " << utostr(AT->getNumElements()) << ");";
-      nl(Out);
-      break;
-    }
-    case Type::PointerTyID: {
-      const PointerType* PT = cast<PointerType>(Ty);
-      const Type* ET = PT->getElementType();
-      bool isForward = printTypeInternal(ET);
-      std::string elemName(getCppName(ET));
-      Out << "PointerType* " << typeName << " = PointerType::get("
-          << elemName << (isForward ? "_fwd" : "")
-          << ", " << utostr(PT->getAddressSpace()) << ");";
-      nl(Out);
-      break;
-    }
-    case Type::VectorTyID: {
-      const VectorType* PT = cast<VectorType>(Ty);
-      const Type* ET = PT->getElementType();
-      bool isForward = printTypeInternal(ET);
-      std::string elemName(getCppName(ET));
-      Out << "VectorType* " << typeName << " = VectorType::get("
-          << elemName << (isForward ? "_fwd" : "") 
-          << ", " << utostr(PT->getNumElements()) << ");";
-      nl(Out);
-      break;
-    }
-    case Type::OpaqueTyID: {
-      Out << "OpaqueType* " << typeName << " = OpaqueType::get();";
-      nl(Out);
-      break;
-    }
-    default:
-      error("Invalid TypeID");
-  }
-
-  // If the type had a name, make sure we recreate it.
-  const std::string* progTypeName = 
-    findTypeName(TheModule->getTypeSymbolTable(),Ty);
-  if (progTypeName) {
-    Out << "mod->addTypeName(\"" << *progTypeName << "\", " 
-        << typeName << ");";
-    nl(Out);
-  }
-
-  // Pop us off the type stack
-  TypeStack.pop_back();
-
-  // Indicate that this type is now defined.
-  DefinedTypes.insert(Ty);
-
-  // Early resolve as many unresolved types as possible. Search the unresolved
-  // types map for the type we just printed. Now that its definition is complete
-  // we can resolve any previous references to it. This prevents a cascade of
-  // unresolved types.
-  TypeMap::iterator I = UnresolvedTypes.find(Ty);
-  if (I != UnresolvedTypes.end()) {
-    Out << "cast<OpaqueType>(" << I->second 
-        << "_fwd.get())->refineAbstractTypeTo(" << I->second << ");";
-    nl(Out);
-    Out << I->second << " = cast<";
-    switch (Ty->getTypeID()) {
-      case Type::FunctionTyID: Out << "FunctionType"; break;
-      case Type::ArrayTyID:    Out << "ArrayType"; break;
-      case Type::StructTyID:   Out << "StructType"; break;
-      case Type::VectorTyID:   Out << "VectorType"; break;
-      case Type::PointerTyID:  Out << "PointerType"; break;
-      case Type::OpaqueTyID:   Out << "OpaqueType"; break;
-      default:                 Out << "NoSuchDerivedType"; break;
-    }
-    Out << ">(" << I->second << "_fwd.get());";
-    nl(Out); nl(Out);
-    UnresolvedTypes.erase(I);
-  }
-
-  // Finally, separate the type definition from other with a newline.
-  nl(Out);
-
-  // We weren't a recursive type
-  return false;
-}
-
-// Prints a type definition. Returns true if it could not resolve all the types
-// in the definition but had to use a forward reference.
-void
-CppWriter::printType(const Type* Ty) {
-  assert(TypeStack.empty());
-  TypeStack.clear();
-  printTypeInternal(Ty);
-  assert(TypeStack.empty());
-}
-
-void
-CppWriter::printTypes(const Module* M) {
-
-  // Walk the symbol table and print out all its types
-  const TypeSymbolTable& symtab = M->getTypeSymbolTable();
-  for (TypeSymbolTable::const_iterator TI = symtab.begin(), TE = symtab.end(); 
-       TI != TE; ++TI) {
-
-    // For primitive types and types already defined, just add a name
-    TypeMap::const_iterator TNI = TypeNames.find(TI->second);
-    if (TI->second->isInteger() || TI->second->isPrimitiveType() || 
-        TNI != TypeNames.end()) {
-      Out << "mod->addTypeName(\"";
-      printEscapedString(TI->first);
-      Out << "\", " << getCppName(TI->second) << ");";
-      nl(Out);
-    // For everything else, define the type
-    } else {
-      printType(TI->second);
-    }
-  }
-
-  // Add all of the global variables to the value table...
-  for (Module::const_global_iterator I = TheModule->global_begin(), 
-       E = TheModule->global_end(); I != E; ++I) {
-    if (I->hasInitializer())
-      printType(I->getInitializer()->getType());
-    printType(I->getType());
-  }
-
-  // Add all the functions to the table
-  for (Module::const_iterator FI = TheModule->begin(), FE = TheModule->end();
-       FI != FE; ++FI) {
-    printType(FI->getReturnType());
-    printType(FI->getFunctionType());
-    // Add all the function arguments
-    for(Function::const_arg_iterator AI = FI->arg_begin(),
-        AE = FI->arg_end(); AI != AE; ++AI) {
-      printType(AI->getType());
-    }
-
-    // Add all of the basic blocks and instructions
-    for (Function::const_iterator BB = FI->begin(),
-         E = FI->end(); BB != E; ++BB) {
-      printType(BB->getType());
-      for (BasicBlock::const_iterator I = BB->begin(), E = BB->end(); I!=E; 
-           ++I) {
-        printType(I->getType());
-        for (unsigned i = 0; i < I->getNumOperands(); ++i)
-          printType(I->getOperand(i)->getType());
-      }
-    }
-  }
-}
-
-
-// printConstant - Print out a constant pool entry...
-void CppWriter::printConstant(const Constant *CV) {
-  // First, if the constant is actually a GlobalValue (variable or function) or
-  // its already in the constant list then we've printed it already and we can
-  // just return.
-  if (isa<GlobalValue>(CV) || ValueNames.find(CV) != ValueNames.end())
-    return;
-
-  std::string constName(getCppName(CV));
-  std::string typeName(getCppName(CV->getType()));
-  if (CV->isNullValue()) {
-    Out << "Constant* " << constName << " = Constant::getNullValue("
-        << typeName << ");";
-    nl(Out);
-    return;
-  }
-  if (isa<GlobalValue>(CV)) {
-    // Skip variables and functions, we emit them elsewhere
-    return;
-  }
-  if (const ConstantInt *CI = dyn_cast<ConstantInt>(CV)) {
-    Out << "ConstantInt* " << constName << " = ConstantInt::get(APInt(" 
-        << cast<IntegerType>(CI->getType())->getBitWidth() << ", "
-        << " \"" << CI->getValue().toStringSigned(10)  << "\", 10));";
-  } else if (isa<ConstantAggregateZero>(CV)) {
-    Out << "ConstantAggregateZero* " << constName 
-        << " = ConstantAggregateZero::get(" << typeName << ");";
-  } else if (isa<ConstantPointerNull>(CV)) {
-    Out << "ConstantPointerNull* " << constName 
-        << " = ConstanPointerNull::get(" << typeName << ");";
-  } else if (const ConstantFP *CFP = dyn_cast<ConstantFP>(CV)) {
-    Out << "ConstantFP* " << constName << " = ";
-    printCFP(CFP);
-    Out << ";";
-  } else if (const ConstantArray *CA = dyn_cast<ConstantArray>(CV)) {
-    if (CA->isString() && CA->getType()->getElementType() == Type::Int8Ty) {
-      Out << "Constant* " << constName << " = ConstantArray::get(\"";
-      std::string tmp = CA->getAsString();
-      bool nullTerminate = false;
-      if (tmp[tmp.length()-1] == 0) {
-        tmp.erase(tmp.length()-1);
-        nullTerminate = true;
-      }
-      printEscapedString(tmp);
-      // Determine if we want null termination or not.
-      if (nullTerminate)
-        Out << "\", true"; // Indicate that the null terminator should be added.
-      else
-        Out << "\", false";// No null terminator
-      Out << ");";
-    } else { 
-      Out << "std::vector<Constant*> " << constName << "_elems;";
-      nl(Out);
-      unsigned N = CA->getNumOperands();
-      for (unsigned i = 0; i < N; ++i) {
-        printConstant(CA->getOperand(i)); // recurse to print operands
-        Out << constName << "_elems.push_back("
-            << getCppName(CA->getOperand(i)) << ");";
-        nl(Out);
-      }
-      Out << "Constant* " << constName << " = ConstantArray::get(" 
-          << typeName << ", " << constName << "_elems);";
-    }
-  } else if (const ConstantStruct *CS = dyn_cast<ConstantStruct>(CV)) {
-    Out << "std::vector<Constant*> " << constName << "_fields;";
-    nl(Out);
-    unsigned N = CS->getNumOperands();
-    for (unsigned i = 0; i < N; i++) {
-      printConstant(CS->getOperand(i));
-      Out << constName << "_fields.push_back("
-          << getCppName(CS->getOperand(i)) << ");";
-      nl(Out);
-    }
-    Out << "Constant* " << constName << " = ConstantStruct::get(" 
-        << typeName << ", " << constName << "_fields);";
-  } else if (const ConstantVector *CP = dyn_cast<ConstantVector>(CV)) {
-    Out << "std::vector<Constant*> " << constName << "_elems;";
-    nl(Out);
-    unsigned N = CP->getNumOperands();
-    for (unsigned i = 0; i < N; ++i) {
-      printConstant(CP->getOperand(i));
-      Out << constName << "_elems.push_back("
-          << getCppName(CP->getOperand(i)) << ");";
-      nl(Out);
-    }
-    Out << "Constant* " << constName << " = ConstantVector::get(" 
-        << typeName << ", " << constName << "_elems);";
-  } else if (isa<UndefValue>(CV)) {
-    Out << "UndefValue* " << constName << " = UndefValue::get(" 
-        << typeName << ");";
-  } else if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(CV)) {
-    if (CE->getOpcode() == Instruction::GetElementPtr) {
-      Out << "std::vector<Constant*> " << constName << "_indices;";
-      nl(Out);
-      printConstant(CE->getOperand(0));
-      for (unsigned i = 1; i < CE->getNumOperands(); ++i ) {
-        printConstant(CE->getOperand(i));
-        Out << constName << "_indices.push_back("
-            << getCppName(CE->getOperand(i)) << ");";
-        nl(Out);
-      }
-      Out << "Constant* " << constName 
-          << " = ConstantExpr::getGetElementPtr(" 
-          << getCppName(CE->getOperand(0)) << ", " 
-          << "&" << constName << "_indices[0], "
-          << constName << "_indices.size()"
-          << " );";
-    } else if (CE->isCast()) {
-      printConstant(CE->getOperand(0));
-      Out << "Constant* " << constName << " = ConstantExpr::getCast(";
-      switch (CE->getOpcode()) {
-        default: assert(0 && "Invalid cast opcode");
-        case Instruction::Trunc: Out << "Instruction::Trunc"; break;
-        case Instruction::ZExt:  Out << "Instruction::ZExt"; break;
-        case Instruction::SExt:  Out << "Instruction::SExt"; break;
-        case Instruction::FPTrunc:  Out << "Instruction::FPTrunc"; break;
-        case Instruction::FPExt:  Out << "Instruction::FPExt"; break;
-        case Instruction::FPToUI:  Out << "Instruction::FPToUI"; break;
-        case Instruction::FPToSI:  Out << "Instruction::FPToSI"; break;
-        case Instruction::UIToFP:  Out << "Instruction::UIToFP"; break;
-        case Instruction::SIToFP:  Out << "Instruction::SIToFP"; break;
-        case Instruction::PtrToInt:  Out << "Instruction::PtrToInt"; break;
-        case Instruction::IntToPtr:  Out << "Instruction::IntToPtr"; break;
-        case Instruction::BitCast:  Out << "Instruction::BitCast"; break;
-      }
-      Out << ", " << getCppName(CE->getOperand(0)) << ", " 
-          << getCppName(CE->getType()) << ");";
-    } else {
-      unsigned N = CE->getNumOperands();
-      for (unsigned i = 0; i < N; ++i ) {
-        printConstant(CE->getOperand(i));
-      }
-      Out << "Constant* " << constName << " = ConstantExpr::";
-      switch (CE->getOpcode()) {
-        case Instruction::Add:    Out << "getAdd(";  break;
-        case Instruction::Sub:    Out << "getSub("; break;
-        case Instruction::Mul:    Out << "getMul("; break;
-        case Instruction::UDiv:   Out << "getUDiv("; break;
-        case Instruction::SDiv:   Out << "getSDiv("; break;
-        case Instruction::FDiv:   Out << "getFDiv("; break;
-        case Instruction::URem:   Out << "getURem("; break;
-        case Instruction::SRem:   Out << "getSRem("; break;
-        case Instruction::FRem:   Out << "getFRem("; break;
-        case Instruction::And:    Out << "getAnd("; break;
-        case Instruction::Or:     Out << "getOr("; break;
-        case Instruction::Xor:    Out << "getXor("; break;
-        case Instruction::ICmp:   
-          Out << "getICmp(ICmpInst::ICMP_";
-          switch (CE->getPredicate()) {
-            case ICmpInst::ICMP_EQ:  Out << "EQ"; break;
-            case ICmpInst::ICMP_NE:  Out << "NE"; break;
-            case ICmpInst::ICMP_SLT: Out << "SLT"; break;
-            case ICmpInst::ICMP_ULT: Out << "ULT"; break;
-            case ICmpInst::ICMP_SGT: Out << "SGT"; break;
-            case ICmpInst::ICMP_UGT: Out << "UGT"; break;
-            case ICmpInst::ICMP_SLE: Out << "SLE"; break;
-            case ICmpInst::ICMP_ULE: Out << "ULE"; break;
-            case ICmpInst::ICMP_SGE: Out << "SGE"; break;
-            case ICmpInst::ICMP_UGE: Out << "UGE"; break;
-            default: error("Invalid ICmp Predicate");
-          }
-          break;
-        case Instruction::FCmp:
-          Out << "getFCmp(FCmpInst::FCMP_";
-          switch (CE->getPredicate()) {
-            case FCmpInst::FCMP_FALSE: Out << "FALSE"; break;
-            case FCmpInst::FCMP_ORD:   Out << "ORD"; break;
-            case FCmpInst::FCMP_UNO:   Out << "UNO"; break;
-            case FCmpInst::FCMP_OEQ:   Out << "OEQ"; break;
-            case FCmpInst::FCMP_UEQ:   Out << "UEQ"; break;
-            case FCmpInst::FCMP_ONE:   Out << "ONE"; break;
-            case FCmpInst::FCMP_UNE:   Out << "UNE"; break;
-            case FCmpInst::FCMP_OLT:   Out << "OLT"; break;
-            case FCmpInst::FCMP_ULT:   Out << "ULT"; break;
-            case FCmpInst::FCMP_OGT:   Out << "OGT"; break;
-            case FCmpInst::FCMP_UGT:   Out << "UGT"; break;
-            case FCmpInst::FCMP_OLE:   Out << "OLE"; break;
-            case FCmpInst::FCMP_ULE:   Out << "ULE"; break;
-            case FCmpInst::FCMP_OGE:   Out << "OGE"; break;
-            case FCmpInst::FCMP_UGE:   Out << "UGE"; break;
-            case FCmpInst::FCMP_TRUE:  Out << "TRUE"; break;
-            default: error("Invalid FCmp Predicate");
-          }
-          break;
-        case Instruction::Shl:     Out << "getShl("; break;
-        case Instruction::LShr:    Out << "getLShr("; break;
-        case Instruction::AShr:    Out << "getAShr("; break;
-        case Instruction::Select:  Out << "getSelect("; break;
-        case Instruction::ExtractElement: Out << "getExtractElement("; break;
-        case Instruction::InsertElement:  Out << "getInsertElement("; break;
-        case Instruction::ShuffleVector:  Out << "getShuffleVector("; break;
-        default:
-          error("Invalid constant expression");
-          break;
-      }
-      Out << getCppName(CE->getOperand(0));
-      for (unsigned i = 1; i < CE->getNumOperands(); ++i) 
-        Out << ", " << getCppName(CE->getOperand(i));
-      Out << ");";
-    }
-  } else {
-    error("Bad Constant");
-    Out << "Constant* " << constName << " = 0; ";
-  }
-  nl(Out);
-}
-
-void
-CppWriter::printConstants(const Module* M) {
-  // Traverse all the global variables looking for constant initializers
-  for (Module::const_global_iterator I = TheModule->global_begin(), 
-       E = TheModule->global_end(); I != E; ++I)
-    if (I->hasInitializer())
-      printConstant(I->getInitializer());
-
-  // Traverse the LLVM functions looking for constants
-  for (Module::const_iterator FI = TheModule->begin(), FE = TheModule->end();
-       FI != FE; ++FI) {
-    // Add all of the basic blocks and instructions
-    for (Function::const_iterator BB = FI->begin(),
-         E = FI->end(); BB != E; ++BB) {
-      for (BasicBlock::const_iterator I = BB->begin(), E = BB->end(); I!=E; 
-           ++I) {
-        for (unsigned i = 0; i < I->getNumOperands(); ++i) {
-          if (Constant* C = dyn_cast<Constant>(I->getOperand(i))) {
-            printConstant(C);
-          }
-        }
-      }
-    }
-  }
-}
-
-void CppWriter::printVariableUses(const GlobalVariable *GV) {
-  nl(Out) << "// Type Definitions";
-  nl(Out);
-  printType(GV->getType());
-  if (GV->hasInitializer()) {
-    Constant* Init = GV->getInitializer();
-    printType(Init->getType());
-    if (Function* F = dyn_cast<Function>(Init)) {
-      nl(Out)<< "/ Function Declarations"; nl(Out);
-      printFunctionHead(F);
-    } else if (GlobalVariable* gv = dyn_cast<GlobalVariable>(Init)) {
-      nl(Out) << "// Global Variable Declarations"; nl(Out);
-      printVariableHead(gv);
-    } else  {
-      nl(Out) << "// Constant Definitions"; nl(Out);
-      printConstant(gv);
-    }
-    if (GlobalVariable* gv = dyn_cast<GlobalVariable>(Init)) {
-      nl(Out) << "// Global Variable Definitions"; nl(Out);
-      printVariableBody(gv);
-    }
-  }
-}
-
-void CppWriter::printVariableHead(const GlobalVariable *GV) {
-  nl(Out) << "GlobalVariable* " << getCppName(GV);
-  if (is_inline) {
-     Out << " = mod->getGlobalVariable(";
-     printEscapedString(GV->getName());
-     Out << ", " << getCppName(GV->getType()->getElementType()) << ",true)";
-     nl(Out) << "if (!" << getCppName(GV) << ") {";
-     in(); nl(Out) << getCppName(GV);
-  }
-  Out << " = new GlobalVariable(";
-  nl(Out) << "/*Type=*/";
-  printCppName(GV->getType()->getElementType());
-  Out << ",";
-  nl(Out) << "/*isConstant=*/" << (GV->isConstant()?"true":"false");
-  Out << ",";
-  nl(Out) << "/*Linkage=*/";
-  printLinkageType(GV->getLinkage());
-  Out << ",";
-  nl(Out) << "/*Initializer=*/0, ";
-  if (GV->hasInitializer()) {
-    Out << "// has initializer, specified below";
-  }
-  nl(Out) << "/*Name=*/\"";
-  printEscapedString(GV->getName());
-  Out << "\",";
-  nl(Out) << "mod);";
-  nl(Out);
-
-  if (GV->hasSection()) {
-    printCppName(GV);
-    Out << "->setSection(\"";
-    printEscapedString(GV->getSection());
-    Out << "\");";
-    nl(Out);
-  }
-  if (GV->getAlignment()) {
-    printCppName(GV);
-    Out << "->setAlignment(" << utostr(GV->getAlignment()) << ");";
-    nl(Out);
-  };
-  if (GV->getVisibility() != GlobalValue::DefaultVisibility) {
-    printCppName(GV);
-    Out << "->setVisibility(";
-    printVisibilityType(GV->getVisibility());
-    Out << ");";
-    nl(Out);
-  }
-  if (is_inline) {
-    out(); Out << "}"; nl(Out);
-  }
-}
-
-void 
-CppWriter::printVariableBody(const GlobalVariable *GV) {
-  if (GV->hasInitializer()) {
-    printCppName(GV);
-    Out << "->setInitializer(";
-    //if (!isa<GlobalValue(GV->getInitializer()))
-    //else 
-      Out << getCppName(GV->getInitializer()) << ");";
-      nl(Out);
-  }
-}
-
-std::string
-CppWriter::getOpName(Value* V) {
-  if (!isa<Instruction>(V) || DefinedValues.find(V) != DefinedValues.end())
-    return getCppName(V);
-
-  // See if its alread in the map of forward references, if so just return the
-  // name we already set up for it
-  ForwardRefMap::const_iterator I = ForwardRefs.find(V);
-  if (I != ForwardRefs.end())
-    return I->second;
-
-  // This is a new forward reference. Generate a unique name for it
-  std::string result(std::string("fwdref_") + utostr(uniqueNum++));
-
-  // Yes, this is a hack. An Argument is the smallest instantiable value that
-  // we can make as a placeholder for the real value. We'll replace these
-  // Argument instances later.
-  Out << "Argument* " << result << " = new Argument(" 
-      << getCppName(V->getType()) << ");";
-  nl(Out);
-  ForwardRefs[V] = result;
-  return result;
-}
-
-// printInstruction - This member is called for each Instruction in a function.
-void 
-CppWriter::printInstruction(const Instruction *I, const std::string& bbname) {
-  std::string iName(getCppName(I));
-
-  // Before we emit this instruction, we need to take care of generating any
-  // forward references. So, we get the names of all the operands in advance
-  std::string* opNames = new std::string[I->getNumOperands()];
-  for (unsigned i = 0; i < I->getNumOperands(); i++) {
-    opNames[i] = getOpName(I->getOperand(i));
-  }
-
-  switch (I->getOpcode()) {
-    case Instruction::Ret: {
-      const ReturnInst* ret =  cast<ReturnInst>(I);
-      Out << "new ReturnInst("
-          << (ret->getReturnValue() ? opNames[0] + ", " : "") << bbname << ");";
-      break;
-    }
-    case Instruction::Br: {
-      const BranchInst* br = cast<BranchInst>(I);
-      Out << "new BranchInst(" ;
-      if (br->getNumOperands() == 3 ) {
-        Out << opNames[0] << ", " 
-            << opNames[1] << ", "
-            << opNames[2] << ", ";
-
-      } else if (br->getNumOperands() == 1) {
-        Out << opNames[0] << ", ";
-      } else {
-        error("Branch with 2 operands?");
-      }
-      Out << bbname << ");";
-      break;
-    }
-    case Instruction::Switch: {
-      const SwitchInst* sw = cast<SwitchInst>(I);
-      Out << "SwitchInst* " << iName << " = new SwitchInst("
-          << opNames[0] << ", "
-          << opNames[1] << ", "
-          << sw->getNumCases() << ", " << bbname << ");";
-      nl(Out);
-      for (unsigned i = 2; i < sw->getNumOperands(); i += 2 ) {
-        Out << iName << "->addCase(" 
-            << opNames[i] << ", "
-            << opNames[i+1] << ");";
-        nl(Out);
-      }
-      break;
-    }
-    case Instruction::Invoke: {
-      const InvokeInst* inv = cast<InvokeInst>(I);
-      Out << "std::vector<Value*> " << iName << "_params;";
-      nl(Out);
-      for (unsigned i = 3; i < inv->getNumOperands(); ++i) {
-        Out << iName << "_params.push_back("
-            << opNames[i] << ");";
-        nl(Out);
-      }
-      Out << "InvokeInst *" << iName << " = new InvokeInst("
-          << opNames[0] << ", "
-          << opNames[1] << ", "
-          << opNames[2] << ", "
-          << iName << "_params.begin(), " << iName << "_params.end(), \"";    
-      printEscapedString(inv->getName());
-      Out << "\", " << bbname << ");";
-      nl(Out) << iName << "->setCallingConv(";
-      printCallingConv(inv->getCallingConv());
-      Out << ");";
-      printParamAttrs(inv->getParamAttrs(), iName);
-      Out << iName << "->setParamAttrs(" << iName << "_PAL);";
-      nl(Out);
-      break;
-    }
-    case Instruction::Unwind: {
-      Out << "new UnwindInst("
-          << bbname << ");";
-      break;
-    }
-    case Instruction::Unreachable:{
-      Out << "new UnreachableInst("
-          << bbname << ");";
-      break;
-    }
-    case Instruction::Add:
-    case Instruction::Sub:
-    case Instruction::Mul:
-    case Instruction::UDiv:
-    case Instruction::SDiv:
-    case Instruction::FDiv:
-    case Instruction::URem:
-    case Instruction::SRem:
-    case Instruction::FRem:
-    case Instruction::And:
-    case Instruction::Or:
-    case Instruction::Xor:
-    case Instruction::Shl: 
-    case Instruction::LShr: 
-    case Instruction::AShr:{
-      Out << "BinaryOperator* " << iName << " = BinaryOperator::create(";
-      switch (I->getOpcode()) {
-        case Instruction::Add: Out << "Instruction::Add"; break;
-        case Instruction::Sub: Out << "Instruction::Sub"; break;
-        case Instruction::Mul: Out << "Instruction::Mul"; break;
-        case Instruction::UDiv:Out << "Instruction::UDiv"; break;
-        case Instruction::SDiv:Out << "Instruction::SDiv"; break;
-        case Instruction::FDiv:Out << "Instruction::FDiv"; break;
-        case Instruction::URem:Out << "Instruction::URem"; break;
-        case Instruction::SRem:Out << "Instruction::SRem"; break;
-        case Instruction::FRem:Out << "Instruction::FRem"; break;
-        case Instruction::And: Out << "Instruction::And"; break;
-        case Instruction::Or:  Out << "Instruction::Or";  break;
-        case Instruction::Xor: Out << "Instruction::Xor"; break;
-        case Instruction::Shl: Out << "Instruction::Shl"; break;
-        case Instruction::LShr:Out << "Instruction::LShr"; break;
-        case Instruction::AShr:Out << "Instruction::AShr"; break;
-        default: Out << "Instruction::BadOpCode"; break;
-      }
-      Out << ", " << opNames[0] << ", " << opNames[1] << ", \"";
-      printEscapedString(I->getName());
-      Out << "\", " << bbname << ");";
-      break;
-    }
-    case Instruction::FCmp: {
-      Out << "FCmpInst* " << iName << " = new FCmpInst(";
-      switch (cast<FCmpInst>(I)->getPredicate()) {
-        case FCmpInst::FCMP_FALSE: Out << "FCmpInst::FCMP_FALSE"; break;
-        case FCmpInst::FCMP_OEQ  : Out << "FCmpInst::FCMP_OEQ"; break;
-        case FCmpInst::FCMP_OGT  : Out << "FCmpInst::FCMP_OGT"; break;
-        case FCmpInst::FCMP_OGE  : Out << "FCmpInst::FCMP_OGE"; break;
-        case FCmpInst::FCMP_OLT  : Out << "FCmpInst::FCMP_OLT"; break;
-        case FCmpInst::FCMP_OLE  : Out << "FCmpInst::FCMP_OLE"; break;
-        case FCmpInst::FCMP_ONE  : Out << "FCmpInst::FCMP_ONE"; break;
-        case FCmpInst::FCMP_ORD  : Out << "FCmpInst::FCMP_ORD"; break;
-        case FCmpInst::FCMP_UNO  : Out << "FCmpInst::FCMP_UNO"; break;
-        case FCmpInst::FCMP_UEQ  : Out << "FCmpInst::FCMP_UEQ"; break;
-        case FCmpInst::FCMP_UGT  : Out << "FCmpInst::FCMP_UGT"; break;
-        case FCmpInst::FCMP_UGE  : Out << "FCmpInst::FCMP_UGE"; break;
-        case FCmpInst::FCMP_ULT  : Out << "FCmpInst::FCMP_ULT"; break;
-        case FCmpInst::FCMP_ULE  : Out << "FCmpInst::FCMP_ULE"; break;
-        case FCmpInst::FCMP_UNE  : Out << "FCmpInst::FCMP_UNE"; break;
-        case FCmpInst::FCMP_TRUE : Out << "FCmpInst::FCMP_TRUE"; break;
-        default: Out << "FCmpInst::BAD_ICMP_PREDICATE"; break;
-      }
-      Out << ", " << opNames[0] << ", " << opNames[1] << ", \"";
-      printEscapedString(I->getName());
-      Out << "\", " << bbname << ");";
-      break;
-    }
-    case Instruction::ICmp: {
-      Out << "ICmpInst* " << iName << " = new ICmpInst(";
-      switch (cast<ICmpInst>(I)->getPredicate()) {
-        case ICmpInst::ICMP_EQ:  Out << "ICmpInst::ICMP_EQ";  break;
-        case ICmpInst::ICMP_NE:  Out << "ICmpInst::ICMP_NE";  break;
-        case ICmpInst::ICMP_ULE: Out << "ICmpInst::ICMP_ULE"; break;
-        case ICmpInst::ICMP_SLE: Out << "ICmpInst::ICMP_SLE"; break;
-        case ICmpInst::ICMP_UGE: Out << "ICmpInst::ICMP_UGE"; break;
-        case ICmpInst::ICMP_SGE: Out << "ICmpInst::ICMP_SGE"; break;
-        case ICmpInst::ICMP_ULT: Out << "ICmpInst::ICMP_ULT"; break;
-        case ICmpInst::ICMP_SLT: Out << "ICmpInst::ICMP_SLT"; break;
-        case ICmpInst::ICMP_UGT: Out << "ICmpInst::ICMP_UGT"; break;
-        case ICmpInst::ICMP_SGT: Out << "ICmpInst::ICMP_SGT"; break;
-        default: Out << "ICmpInst::BAD_ICMP_PREDICATE"; break;
-      }
-      Out << ", " << opNames[0] << ", " << opNames[1] << ", \"";
-      printEscapedString(I->getName());
-      Out << "\", " << bbname << ");";
-      break;
-    }
-    case Instruction::Malloc: {
-      const MallocInst* mallocI = cast<MallocInst>(I);
-      Out << "MallocInst* " << iName << " = new MallocInst("
-          << getCppName(mallocI->getAllocatedType()) << ", ";
-      if (mallocI->isArrayAllocation())
-        Out << opNames[0] << ", " ;
-      Out << "\"";
-      printEscapedString(mallocI->getName());
-      Out << "\", " << bbname << ");";
-      if (mallocI->getAlignment())
-        nl(Out) << iName << "->setAlignment(" 
-            << mallocI->getAlignment() << ");";
-      break;
-    }
-    case Instruction::Free: {
-      Out << "FreeInst* " << iName << " = new FreeInst("
-          << getCppName(I->getOperand(0)) << ", " << bbname << ");";
-      break;
-    }
-    case Instruction::Alloca: {
-      const AllocaInst* allocaI = cast<AllocaInst>(I);
-      Out << "AllocaInst* " << iName << " = new AllocaInst("
-          << getCppName(allocaI->getAllocatedType()) << ", ";
-      if (allocaI->isArrayAllocation())
-        Out << opNames[0] << ", ";
-      Out << "\"";
-      printEscapedString(allocaI->getName());
-      Out << "\", " << bbname << ");";
-      if (allocaI->getAlignment())
-        nl(Out) << iName << "->setAlignment(" 
-            << allocaI->getAlignment() << ");";
-      break;
-    }
-    case Instruction::Load:{
-      const LoadInst* load = cast<LoadInst>(I);
-      Out << "LoadInst* " << iName << " = new LoadInst(" 
-          << opNames[0] << ", \"";
-      printEscapedString(load->getName());
-      Out << "\", " << (load->isVolatile() ? "true" : "false" )
-          << ", " << bbname << ");";
-      break;
-    }
-    case Instruction::Store: {
-      const StoreInst* store = cast<StoreInst>(I);
-      Out << "StoreInst* " << iName << " = new StoreInst(" 
-          << opNames[0] << ", "
-          << opNames[1] << ", "
-          << (store->isVolatile() ? "true" : "false") 
-          << ", " << bbname << ");";
-      break;
-    }
-    case Instruction::GetElementPtr: {
-      const GetElementPtrInst* gep = cast<GetElementPtrInst>(I);
-      if (gep->getNumOperands() <= 2) {
-        Out << "GetElementPtrInst* " << iName << " = new GetElementPtrInst("
-            << opNames[0]; 
-        if (gep->getNumOperands() == 2)
-          Out << ", " << opNames[1];
-      } else {
-        Out << "std::vector<Value*> " << iName << "_indices;";
-        nl(Out);
-        for (unsigned i = 1; i < gep->getNumOperands(); ++i ) {
-          Out << iName << "_indices.push_back("
-              << opNames[i] << ");";
-          nl(Out);
-        }
-        Out << "Instruction* " << iName << " = new GetElementPtrInst(" 
-            << opNames[0] << ", " << iName << "_indices.begin(), " 
-            << iName << "_indices.end()";
-      }
-      Out << ", \"";
-      printEscapedString(gep->getName());
-      Out << "\", " << bbname << ");";
-      break;
-    }
-    case Instruction::PHI: {
-      const PHINode* phi = cast<PHINode>(I);
-
-      Out << "PHINode* " << iName << " = new PHINode("
-          << getCppName(phi->getType()) << ", \"";
-      printEscapedString(phi->getName());
-      Out << "\", " << bbname << ");";
-      nl(Out) << iName << "->reserveOperandSpace(" 
-        << phi->getNumIncomingValues()
-          << ");";
-      nl(Out);
-      for (unsigned i = 0; i < phi->getNumOperands(); i+=2) {
-        Out << iName << "->addIncoming("
-            << opNames[i] << ", " << opNames[i+1] << ");";
-        nl(Out);
-      }
-      break;
-    }
-    case Instruction::Trunc: 
-    case Instruction::ZExt:
-    case Instruction::SExt:
-    case Instruction::FPTrunc:
-    case Instruction::FPExt:
-    case Instruction::FPToUI:
-    case Instruction::FPToSI:
-    case Instruction::UIToFP:
-    case Instruction::SIToFP:
-    case Instruction::PtrToInt:
-    case Instruction::IntToPtr:
-    case Instruction::BitCast: {
-      const CastInst* cst = cast<CastInst>(I);
-      Out << "CastInst* " << iName << " = new ";
-      switch (I->getOpcode()) {
-        case Instruction::Trunc:    Out << "TruncInst"; break;
-        case Instruction::ZExt:     Out << "ZExtInst"; break;
-        case Instruction::SExt:     Out << "SExtInst"; break;
-        case Instruction::FPTrunc:  Out << "FPTruncInst"; break;
-        case Instruction::FPExt:    Out << "FPExtInst"; break;
-        case Instruction::FPToUI:   Out << "FPToUIInst"; break;
-        case Instruction::FPToSI:   Out << "FPToSIInst"; break;
-        case Instruction::UIToFP:   Out << "UIToFPInst"; break;
-        case Instruction::SIToFP:   Out << "SIToFPInst"; break;
-        case Instruction::PtrToInt: Out << "PtrToIntInst"; break;
-        case Instruction::IntToPtr: Out << "IntToPtrInst"; break;
-        case Instruction::BitCast:  Out << "BitCastInst"; break;
-        default: assert(!"Unreachable"); break;
-      }
-      Out << "(" << opNames[0] << ", "
-          << getCppName(cst->getType()) << ", \"";
-      printEscapedString(cst->getName());
-      Out << "\", " << bbname << ");";
-      break;
-    }
-    case Instruction::Call:{
-      const CallInst* call = cast<CallInst>(I);
-      if (InlineAsm* ila = dyn_cast<InlineAsm>(call->getOperand(0))) {
-        Out << "InlineAsm* " << getCppName(ila) << " = InlineAsm::get("
-            << getCppName(ila->getFunctionType()) << ", \""
-            << ila->getAsmString() << "\", \""
-            << ila->getConstraintString() << "\","
-            << (ila->hasSideEffects() ? "true" : "false") << ");";
-        nl(Out);
-      }
-      if (call->getNumOperands() > 2) {
-        Out << "std::vector<Value*> " << iName << "_params;";
-        nl(Out);
-        for (unsigned i = 1; i < call->getNumOperands(); ++i) {
-          Out << iName << "_params.push_back(" << opNames[i] << ");";
-          nl(Out);
-        }
-        Out << "CallInst* " << iName << " = new CallInst("
-            << opNames[0] << ", " << iName << "_params.begin(), "
-            << iName << "_params.end(), \"";
-      } else if (call->getNumOperands() == 2) {
-        Out << "CallInst* " << iName << " = new CallInst("
-            << opNames[0] << ", " << opNames[1] << ", \"";
-      } else {
-        Out << "CallInst* " << iName << " = new CallInst(" << opNames[0] 
-            << ", \"";
-      }
-      printEscapedString(call->getName());
-      Out << "\", " << bbname << ");";
-      nl(Out) << iName << "->setCallingConv(";
-      printCallingConv(call->getCallingConv());
-      Out << ");";
-      nl(Out) << iName << "->setTailCall(" 
-          << (call->isTailCall() ? "true":"false");
-      Out << ");";
-      printParamAttrs(call->getParamAttrs(), iName);
-      Out << iName << "->setParamAttrs(" << iName << "_PAL);";
-      nl(Out);
-      break;
-    }
-    case Instruction::Select: {
-      const SelectInst* sel = cast<SelectInst>(I);
-      Out << "SelectInst* " << getCppName(sel) << " = new SelectInst(";
-      Out << opNames[0] << ", " << opNames[1] << ", " << opNames[2] << ", \"";
-      printEscapedString(sel->getName());
-      Out << "\", " << bbname << ");";
-      break;
-    }
-    case Instruction::UserOp1:
-      /// FALL THROUGH
-    case Instruction::UserOp2: {
-      /// FIXME: What should be done here?
-      break;
-    }
-    case Instruction::VAArg: {
-      const VAArgInst* va = cast<VAArgInst>(I);
-      Out << "VAArgInst* " << getCppName(va) << " = new VAArgInst("
-          << opNames[0] << ", " << getCppName(va->getType()) << ", \"";
-      printEscapedString(va->getName());
-      Out << "\", " << bbname << ");";
-      break;
-    }
-    case Instruction::ExtractElement: {
-      const ExtractElementInst* eei = cast<ExtractElementInst>(I);
-      Out << "ExtractElementInst* " << getCppName(eei) 
-          << " = new ExtractElementInst(" << opNames[0]
-          << ", " << opNames[1] << ", \"";
-      printEscapedString(eei->getName());
-      Out << "\", " << bbname << ");";
-      break;
-    }
-    case Instruction::InsertElement: {
-      const InsertElementInst* iei = cast<InsertElementInst>(I);
-      Out << "InsertElementInst* " << getCppName(iei) 
-          << " = new InsertElementInst(" << opNames[0]
-          << ", " << opNames[1] << ", " << opNames[2] << ", \"";
-      printEscapedString(iei->getName());
-      Out << "\", " << bbname << ");";
-      break;
-    }
-    case Instruction::ShuffleVector: {
-      const ShuffleVectorInst* svi = cast<ShuffleVectorInst>(I);
-      Out << "ShuffleVectorInst* " << getCppName(svi) 
-          << " = new ShuffleVectorInst(" << opNames[0]
-          << ", " << opNames[1] << ", " << opNames[2] << ", \"";
-      printEscapedString(svi->getName());
-      Out << "\", " << bbname << ");";
-      break;
-    }
-  }
-  DefinedValues.insert(I);
-  nl(Out);
-  delete [] opNames;
-}
-
-// Print out the types, constants and declarations needed by one function
-void CppWriter::printFunctionUses(const Function* F) {
-
-  nl(Out) << "// Type Definitions"; nl(Out);
-  if (!is_inline) {
-    // Print the function's return type
-    printType(F->getReturnType());
-
-    // Print the function's function type
-    printType(F->getFunctionType());
-
-    // Print the types of each of the function's arguments
-    for(Function::const_arg_iterator AI = F->arg_begin(), AE = F->arg_end(); 
-        AI != AE; ++AI) {
-      printType(AI->getType());
-    }
-  }
-
-  // Print type definitions for every type referenced by an instruction and
-  // make a note of any global values or constants that are referenced
-  SmallPtrSet<GlobalValue*,64> gvs;
-  SmallPtrSet<Constant*,64> consts;
-  for (Function::const_iterator BB = F->begin(), BE = F->end(); BB != BE; ++BB){
-    for (BasicBlock::const_iterator I = BB->begin(), E = BB->end(); 
-         I != E; ++I) {
-      // Print the type of the instruction itself
-      printType(I->getType());
-
-      // Print the type of each of the instruction's operands
-      for (unsigned i = 0; i < I->getNumOperands(); ++i) {
-        Value* operand = I->getOperand(i);
-        printType(operand->getType());
-
-        // If the operand references a GVal or Constant, make a note of it
-        if (GlobalValue* GV = dyn_cast<GlobalValue>(operand)) {
-          gvs.insert(GV);
-          if (GlobalVariable *GVar = dyn_cast<GlobalVariable>(GV)) 
-            if (GVar->hasInitializer())
-              consts.insert(GVar->getInitializer());
-        } else if (Constant* C = dyn_cast<Constant>(operand))
-          consts.insert(C);
-      }
-    }
-  }
-
-  // Print the function declarations for any functions encountered
-  nl(Out) << "// Function Declarations"; nl(Out);
-  for (SmallPtrSet<GlobalValue*,64>::iterator I = gvs.begin(), E = gvs.end();
-       I != E; ++I) {
-    if (Function* Fun = dyn_cast<Function>(*I)) {
-      if (!is_inline || Fun != F)
-        printFunctionHead(Fun);
-    }
-  }
-
-  // Print the global variable declarations for any variables encountered
-  nl(Out) << "// Global Variable Declarations"; nl(Out);
-  for (SmallPtrSet<GlobalValue*,64>::iterator I = gvs.begin(), E = gvs.end();
-       I != E; ++I) {
-    if (GlobalVariable* F = dyn_cast<GlobalVariable>(*I))
-      printVariableHead(F);
-  }
-
-  // Print the constants found
-  nl(Out) << "// Constant Definitions"; nl(Out);
-  for (SmallPtrSet<Constant*,64>::iterator I = consts.begin(), E = consts.end();
-       I != E; ++I) {
-      printConstant(*I);
-  }
-
-  // Process the global variables definitions now that all the constants have
-  // been emitted. These definitions just couple the gvars with their constant
-  // initializers.
-  nl(Out) << "// Global Variable Definitions"; nl(Out);
-  for (SmallPtrSet<GlobalValue*,64>::iterator I = gvs.begin(), E = gvs.end();
-       I != E; ++I) {
-    if (GlobalVariable* GV = dyn_cast<GlobalVariable>(*I))
-      printVariableBody(GV);
-  }
-}
-
-void CppWriter::printFunctionHead(const Function* F) {
-  nl(Out) << "Function* " << getCppName(F); 
-  if (is_inline) {
-    Out << " = mod->getFunction(\"";
-    printEscapedString(F->getName());
-    Out << "\", " << getCppName(F->getFunctionType()) << ");";
-    nl(Out) << "if (!" << getCppName(F) << ") {";
-    nl(Out) << getCppName(F);
-  }
-  Out<< " = new Function(";
-  nl(Out,1) << "/*Type=*/" << getCppName(F->getFunctionType()) << ",";
-  nl(Out) << "/*Linkage=*/";
-  printLinkageType(F->getLinkage());
-  Out << ",";
-  nl(Out) << "/*Name=*/\"";
-  printEscapedString(F->getName());
-  Out << "\", mod); " << (F->isDeclaration()? "// (external, no body)" : "");
-  nl(Out,-1);
-  printCppName(F);
-  Out << "->setCallingConv(";
-  printCallingConv(F->getCallingConv());
-  Out << ");";
-  nl(Out);
-  if (F->hasSection()) {
-    printCppName(F);
-    Out << "->setSection(\"" << F->getSection() << "\");";
-    nl(Out);
-  }
-  if (F->getAlignment()) {
-    printCppName(F);
-    Out << "->setAlignment(" << F->getAlignment() << ");";
-    nl(Out);
-  }
-  if (F->getVisibility() != GlobalValue::DefaultVisibility) {
-    printCppName(F);
-    Out << "->setVisibility(";
-    printVisibilityType(F->getVisibility());
-    Out << ");";
-    nl(Out);
-  }
-  if (F->hasCollector()) {
-    printCppName(F);
-    Out << "->setCollector(\"" << F->getCollector() << "\");";
-    nl(Out);
-  }
-  if (is_inline) {
-    Out << "}";
-    nl(Out);
-  }
-  printParamAttrs(F->getParamAttrs(), getCppName(F));
-  printCppName(F);
-  Out << "->setParamAttrs(" << getCppName(F) << "_PAL);";
-  nl(Out);
-}
-
-void CppWriter::printFunctionBody(const Function *F) {
-  if (F->isDeclaration())
-    return; // external functions have no bodies.
-
-  // Clear the DefinedValues and ForwardRefs maps because we can't have 
-  // cross-function forward refs
-  ForwardRefs.clear();
-  DefinedValues.clear();
-
-  // Create all the argument values
-  if (!is_inline) {
-    if (!F->arg_empty()) {
-      Out << "Function::arg_iterator args = " << getCppName(F) 
-          << "->arg_begin();";
-      nl(Out);
-    }
-    for (Function::const_arg_iterator AI = F->arg_begin(), AE = F->arg_end();
-         AI != AE; ++AI) {
-      Out << "Value* " << getCppName(AI) << " = args++;";
-      nl(Out);
-      if (AI->hasName()) {
-        Out << getCppName(AI) << "->setName(\"" << AI->getName() << "\");";
-        nl(Out);
-      }
-    }
-  }
-
-  // Create all the basic blocks
-  nl(Out);
-  for (Function::const_iterator BI = F->begin(), BE = F->end(); 
-       BI != BE; ++BI) {
-    std::string bbname(getCppName(BI));
-    Out << "BasicBlock* " << bbname << " = new BasicBlock(\"";
-    if (BI->hasName())
-      printEscapedString(BI->getName());
-    Out << "\"," << getCppName(BI->getParent()) << ",0);";
-    nl(Out);
-  }
-
-  // Output all of its basic blocks... for the function
-  for (Function::const_iterator BI = F->begin(), BE = F->end(); 
-       BI != BE; ++BI) {
-    std::string bbname(getCppName(BI));
-    nl(Out) << "// Block " << BI->getName() << " (" << bbname << ")";
-    nl(Out);
-
-    // Output all of the instructions in the basic block...
-    for (BasicBlock::const_iterator I = BI->begin(), E = BI->end(); 
-         I != E; ++I) {
-      printInstruction(I,bbname);
-    }
-  }
-
-  // Loop over the ForwardRefs and resolve them now that all instructions
-  // are generated.
-  if (!ForwardRefs.empty()) {
-    nl(Out) << "// Resolve Forward References";
-    nl(Out);
-  }
-  
-  while (!ForwardRefs.empty()) {
-    ForwardRefMap::iterator I = ForwardRefs.begin();
-    Out << I->second << "->replaceAllUsesWith(" 
-        << getCppName(I->first) << "); delete " << I->second << ";";
-    nl(Out);
-    ForwardRefs.erase(I);
-  }
-}
-
-void CppWriter::printInline(const std::string& fname, const std::string& func) {
-  const Function* F = TheModule->getFunction(func);
-  if (!F) {
-    error(std::string("Function '") + func + "' not found in input module");
-    return;
-  }
-  if (F->isDeclaration()) {
-    error(std::string("Function '") + func + "' is external!");
-    return;
-  }
-  nl(Out) << "BasicBlock* " << fname << "(Module* mod, Function *" 
-      << getCppName(F);
-  unsigned arg_count = 1;
-  for (Function::const_arg_iterator AI = F->arg_begin(), AE = F->arg_end();
-       AI != AE; ++AI) {
-    Out << ", Value* arg_" << arg_count;
-  }
-  Out << ") {";
-  nl(Out);
-  is_inline = true;
-  printFunctionUses(F);
-  printFunctionBody(F);
-  is_inline = false;
-  Out << "return " << getCppName(F->begin()) << ";";
-  nl(Out) << "}";
-  nl(Out);
-}
-
-void CppWriter::printModuleBody() {
-  // Print out all the type definitions
-  nl(Out) << "// Type Definitions"; nl(Out);
-  printTypes(TheModule);
-
-  // Functions can call each other and global variables can reference them so 
-  // define all the functions first before emitting their function bodies.
-  nl(Out) << "// Function Declarations"; nl(Out);
-  for (Module::const_iterator I = TheModule->begin(), E = TheModule->end(); 
-       I != E; ++I)
-    printFunctionHead(I);
-
-  // Process the global variables declarations. We can't initialze them until
-  // after the constants are printed so just print a header for each global
-  nl(Out) << "// Global Variable Declarations\n"; nl(Out);
-  for (Module::const_global_iterator I = TheModule->global_begin(), 
-       E = TheModule->global_end(); I != E; ++I) {
-    printVariableHead(I);
-  }
-
-  // Print out all the constants definitions. Constants don't recurse except
-  // through GlobalValues. All GlobalValues have been declared at this point
-  // so we can proceed to generate the constants.
-  nl(Out) << "// Constant Definitions"; nl(Out);
-  printConstants(TheModule);
-
-  // Process the global variables definitions now that all the constants have
-  // been emitted. These definitions just couple the gvars with their constant
-  // initializers.
-  nl(Out) << "// Global Variable Definitions"; nl(Out);
-  for (Module::const_global_iterator I = TheModule->global_begin(), 
-       E = TheModule->global_end(); I != E; ++I) {
-    printVariableBody(I);
-  }
-
-  // Finally, we can safely put out all of the function bodies.
-  nl(Out) << "// Function Definitions"; nl(Out);
-  for (Module::const_iterator I = TheModule->begin(), E = TheModule->end(); 
-       I != E; ++I) {
-    if (!I->isDeclaration()) {
-      nl(Out) << "// Function: " << I->getName() << " (" << getCppName(I) 
-          << ")";
-      nl(Out) << "{";
-      nl(Out,1);
-      printFunctionBody(I);
-      nl(Out,-1) << "}";
-      nl(Out);
-    }
-  }
-}
-
-void CppWriter::printProgram(
-  const std::string& fname, 
-  const std::string& mName
-) {
-  Out << "#include <llvm/Module.h>\n";
-  Out << "#include <llvm/DerivedTypes.h>\n";
-  Out << "#include <llvm/Constants.h>\n";
-  Out << "#include <llvm/GlobalVariable.h>\n";
-  Out << "#include <llvm/Function.h>\n";
-  Out << "#include <llvm/CallingConv.h>\n";
-  Out << "#include <llvm/BasicBlock.h>\n";
-  Out << "#include <llvm/Instructions.h>\n";
-  Out << "#include <llvm/InlineAsm.h>\n";
-  Out << "#include <llvm/Support/MathExtras.h>\n";
-  Out << "#include <llvm/Pass.h>\n";
-  Out << "#include <llvm/PassManager.h>\n";
-  Out << "#include <llvm/Analysis/Verifier.h>\n";
-  Out << "#include <llvm/Assembly/PrintModulePass.h>\n";
-  Out << "#include <algorithm>\n";
-  Out << "#include <iostream>\n\n";
-  Out << "using namespace llvm;\n\n";
-  Out << "Module* " << fname << "();\n\n";
-  Out << "int main(int argc, char**argv) {\n";
-  Out << "  Module* Mod = " << fname << "();\n";
-  Out << "  verifyModule(*Mod, PrintMessageAction);\n";
-  Out << "  std::cerr.flush();\n";
-  Out << "  std::cout.flush();\n";
-  Out << "  PassManager PM;\n";
-  Out << "  PM.add(new PrintModulePass(&llvm::cout));\n";
-  Out << "  PM.run(*Mod);\n";
-  Out << "  return 0;\n";
-  Out << "}\n\n";
-  printModule(fname,mName);
-}
-
-void CppWriter::printModule(
-  const std::string& fname, 
-  const std::string& mName
-) {
-  nl(Out) << "Module* " << fname << "() {";
-  nl(Out,1) << "// Module Construction";
-  nl(Out) << "Module* mod = new Module(\"" << mName << "\");"; 
-  if (!TheModule->getTargetTriple().empty()) {
-    nl(Out) << "mod->setDataLayout(\"" << TheModule->getDataLayout() << "\");";
-  }
-  if (!TheModule->getTargetTriple().empty()) {
-    nl(Out) << "mod->setTargetTriple(\"" << TheModule->getTargetTriple() 
-            << "\");";
-  }
-
-  if (!TheModule->getModuleInlineAsm().empty()) {
-    nl(Out) << "mod->setModuleInlineAsm(\"";
-    printEscapedString(TheModule->getModuleInlineAsm());
-    Out << "\");";
-  }
-  nl(Out);
-  
-  // Loop over the dependent libraries and emit them.
-  Module::lib_iterator LI = TheModule->lib_begin();
-  Module::lib_iterator LE = TheModule->lib_end();
-  while (LI != LE) {
-    Out << "mod->addLibrary(\"" << *LI << "\");";
-    nl(Out);
-    ++LI;
-  }
-  printModuleBody();
-  nl(Out) << "return mod;";
-  nl(Out,-1) << "}";
-  nl(Out);
-}
-
-void CppWriter::printContents(
-  const std::string& fname, // Name of generated function
-  const std::string& mName // Name of module generated module
-) {
-  Out << "\nModule* " << fname << "(Module *mod) {\n";
-  Out << "\nmod->setModuleIdentifier(\"" << mName << "\");\n";
-  printModuleBody();
-  Out << "\nreturn mod;\n";
-  Out << "\n}\n";
-}
-
-void CppWriter::printFunction(
-  const std::string& fname, // Name of generated function
-  const std::string& funcName // Name of function to generate
-) {
-  const Function* F = TheModule->getFunction(funcName);
-  if (!F) {
-    error(std::string("Function '") + funcName + "' not found in input module");
-    return;
-  }
-  Out << "\nFunction* " << fname << "(Module *mod) {\n";
-  printFunctionUses(F);
-  printFunctionHead(F);
-  printFunctionBody(F);
-  Out << "return " << getCppName(F) << ";\n";
-  Out << "}\n";
-}
-
-void CppWriter::printFunctions() {
-  const Module::FunctionListType &funcs = TheModule->getFunctionList();
-  Module::const_iterator I  = funcs.begin();
-  Module::const_iterator IE = funcs.end();
-
-  for (; I != IE; ++I) {
-    const Function &func = *I;
-    if (!func.isDeclaration()) {
-      std::string name("define_");
-      name += func.getName();
-      printFunction(name, func.getName());
-    }
-  }
-}
-
-void CppWriter::printVariable(
-  const std::string& fname,  /// Name of generated function
-  const std::string& varName // Name of variable to generate
-) {
-  const GlobalVariable* GV = TheModule->getNamedGlobal(varName);
-
-  if (!GV) {
-    error(std::string("Variable '") + varName + "' not found in input module");
-    return;
-  }
-  Out << "\nGlobalVariable* " << fname << "(Module *mod) {\n";
-  printVariableUses(GV);
-  printVariableHead(GV);
-  printVariableBody(GV);
-  Out << "return " << getCppName(GV) << ";\n";
-  Out << "}\n";
-}
-
-void CppWriter::printType(
-  const std::string& fname,  /// Name of generated function
-  const std::string& typeName // Name of type to generate
-) {
-  const Type* Ty = TheModule->getTypeByName(typeName);
-  if (!Ty) {
-    error(std::string("Type '") + typeName + "' not found in input module");
-    return;
-  }
-  Out << "\nType* " << fname << "(Module *mod) {\n";
-  printType(Ty);
-  Out << "return " << getCppName(Ty) << ";\n";
-  Out << "}\n";
-}
-
-}  // end anonymous llvm
-
-namespace llvm {
-
-void WriteModuleToCppFile(Module* mod, std::ostream& o) {
-  // Initialize a CppWriter for us to use
-  CppWriter W(o, mod);
-
-  // Emit a header
-  o << "// Generated by llvm2cpp - DO NOT MODIFY!\n\n";
-
-  // Get the name of the function we're supposed to generate
-  std::string fname = FuncName.getValue();
-
-  // Get the name of the thing we are to generate
-  std::string tgtname = NameToGenerate.getValue();
-  if (GenerationType == GenModule || 
-      GenerationType == GenContents || 
-      GenerationType == GenProgram ||
-      GenerationType == GenFunctions) {
-    if (tgtname == "!bad!") {
-      if (mod->getModuleIdentifier() == "-")
-        tgtname = "<stdin>";
-      else
-        tgtname = mod->getModuleIdentifier();
-    }
-  } else if (tgtname == "!bad!") {
-    W.error("You must use the -for option with -gen-{function,variable,type}");
-  }
-
-  switch (WhatToGenerate(GenerationType)) {
-    case GenProgram:
-      if (fname.empty())
-        fname = "makeLLVMModule";
-      W.printProgram(fname,tgtname);
-      break;
-    case GenModule:
-      if (fname.empty())
-        fname = "makeLLVMModule";
-      W.printModule(fname,tgtname);
-      break;
-    case GenContents:
-      if (fname.empty())
-        fname = "makeLLVMModuleContents";
-      W.printContents(fname,tgtname);
-      break;
-    case GenFunction:
-      if (fname.empty())
-        fname = "makeLLVMFunction";
-      W.printFunction(fname,tgtname);
-      break;
-  case GenFunctions:
-      W.printFunctions();
-      break;
-    case GenInline:
-      if (fname.empty())
-        fname = "makeLLVMInline";
-      W.printInline(fname,tgtname);
-      break;
-    case GenVariable:
-      if (fname.empty())
-        fname = "makeLLVMVariable";
-      W.printVariable(fname,tgtname);
-      break;
-    case GenType:
-      if (fname.empty())
-        fname = "makeLLVMType";
-      W.printType(fname,tgtname);
-      break;
-    default:
-      W.error("Invalid generation option");
-  }
-}
-
-}

Removed: llvm/branches/non-call-eh/tools/llvm2cpp/CppWriter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/llvm2cpp/CppWriter.h?rev=53162&view=auto

==============================================================================
--- llvm/branches/non-call-eh/tools/llvm2cpp/CppWriter.h (original)
+++ llvm/branches/non-call-eh/tools/llvm2cpp/CppWriter.h (removed)
@@ -1,18 +0,0 @@
-//===--- CppWriter.h - Generate C++ IR to C++ Source Interface ------------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file declares a function, WriteModuleToCppFile that will convert a 
-// Module into the corresponding C++ code to construct the same module.
-//
-//===------------------------------------------------------------------------===
-#include <ostream>
-namespace llvm {
-class Module;
-void WriteModuleToCppFile(Module* mod, std::ostream& out);
-}

Removed: llvm/branches/non-call-eh/tools/llvm2cpp/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/llvm2cpp/Makefile?rev=53162&view=auto

==============================================================================
--- llvm/branches/non-call-eh/tools/llvm2cpp/Makefile (original)
+++ llvm/branches/non-call-eh/tools/llvm2cpp/Makefile (removed)
@@ -1,15 +0,0 @@
-##===- tools/llvm2cpp/Makefile -----------------------------*- Makefile -*-===##
-# 
-#                     The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License. See LICENSE.TXT for details.
-# 
-##===----------------------------------------------------------------------===##
-LEVEL = ../..
-TOOLNAME = llvm2cpp
-LINK_COMPONENTS = bitreader
-
-include $(LEVEL)/Makefile.common
-
-CompileCommonOpts := $(CompileCommonOpts) -Wno-format 

Removed: llvm/branches/non-call-eh/tools/llvm2cpp/llvm2cpp.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/llvm2cpp/llvm2cpp.cpp?rev=53162&view=auto

==============================================================================
--- llvm/branches/non-call-eh/tools/llvm2cpp/llvm2cpp.cpp (original)
+++ llvm/branches/non-call-eh/tools/llvm2cpp/llvm2cpp.cpp (removed)
@@ -1,122 +0,0 @@
-//===--- llvm2cpp.cpp - LLVM IR to C++ Translator -------------------------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This program converts an input LLVM assembly file (.ll) into a C++ source
-// file that makes calls to the LLVM C++ API to produce the same module. The
-// generated program verifies what it built and then runs the PrintAssemblyPass
-// to reproduce the input originally given to llvm2cpp.
-//
-// Use the --help option for help with command line options.
-//
-//===------------------------------------------------------------------------===
-
-#include "llvm/Module.h"
-#include "llvm/Bitcode/ReaderWriter.h"
-#include "llvm/Analysis/Verifier.h"
-#include "llvm/Support/CommandLine.h"
-#include "llvm/Support/ManagedStatic.h"
-#include "llvm/Support/MemoryBuffer.h"
-#include "llvm/Support/SystemUtils.h"
-#include "llvm/System/Signals.h"
-#include "CppWriter.h"
-#include <fstream>
-#include <iostream>
-#include <memory>
-using namespace llvm;
-
-static cl::opt<std::string>
-InputFilename(cl::Positional, cl::desc("<input LLVM bitcode file>"), 
-  cl::init("-"));
-
-static cl::opt<std::string>
-OutputFilename("o", cl::desc("Override output filename"),
-               cl::value_desc("filename"));
-
-static cl::opt<bool>
-Force("f", cl::desc("Overwrite output files"));
-
-int main(int argc, char **argv) {
-  llvm_shutdown_obj X;  // Call llvm_shutdown() on exit.
-  cl::ParseCommandLineOptions(argc, argv, "llvm .ll -> .cpp assembler\n");
-  sys::PrintStackTraceOnErrorSignal();
-
-  int exitCode = 0;
-  std::ostream *Out = 0;
-  std::string ErrorMessage;
-  
-  std::auto_ptr<Module> M;
-  std::auto_ptr<MemoryBuffer> Buffer(
-       MemoryBuffer::getFileOrSTDIN(InputFilename, &ErrorMessage));
-  if (Buffer.get())
-    M.reset(ParseBitcodeFile(Buffer.get(), &ErrorMessage));
-  if (M.get() == 0) {
-    std::cerr << argv[0] << ": ";
-    if (ErrorMessage.size())
-      std::cerr << ErrorMessage << "\n";
-    else
-      std::cerr << "bitcode didn't read correctly.\n";
-    return 1;
-  }
-
-  if (OutputFilename != "") {   // Specified an output filename?
-    if (OutputFilename != "-") {  // Not stdout?
-      if (!Force && std::ifstream(OutputFilename.c_str())) {
-        // If force is not specified, make sure not to overwrite a file!
-        std::cerr << argv[0] << ": error opening '" << OutputFilename
-                  << "': file exists!\n"
-                  << "Use -f command line argument to force output\n";
-        return 1;
-      }
-      Out = new std::ofstream(OutputFilename.c_str(), std::ios::out |
-                              std::ios::trunc | std::ios::binary);
-    } else {                      // Specified stdout
-      Out = &std::cout;
-    }
-  } else {
-    if (InputFilename == "-") {
-      OutputFilename = "-";
-      Out = &std::cout;
-    } else {
-      std::string IFN = InputFilename;
-      int Len = IFN.length();
-      if (IFN[Len-3] == '.' && IFN[Len-2] == 'l' && IFN[Len-1] == 'l') {
-        // Source ends in .ll
-        OutputFilename = std::string(IFN.begin(), IFN.end()-3);
-      } else {
-        OutputFilename = IFN;   // Append a .cpp to it
-      }
-      OutputFilename += ".cpp";
-
-      if (!Force && std::ifstream(OutputFilename.c_str())) {
-        // If force is not specified, make sure not to overwrite a file!
-        std::cerr << argv[0] << ": error opening '" << OutputFilename
-                  << "': file exists!\n"
-                  << "Use -f command line argument to force output\n";
-        return 1;
-      }
-
-      Out = new std::ofstream(OutputFilename.c_str(), std::ios::out |
-                              std::ios::trunc | std::ios::binary);
-      // Make sure that the Out file gets unlinked from the disk if we get a
-      // SIGINT
-      sys::RemoveFileOnSignal(sys::Path(OutputFilename));
-    }
-  }
-
-  if (!Out->good()) {
-    std::cerr << argv[0] << ": error opening " << OutputFilename << "!\n";
-    return 1;
-  }
-
-  WriteModuleToCppFile(M.get(), *Out);
-
-  if (Out != &std::cout) delete Out;
-  return exitCode;
-}
-

Propchange: llvm/branches/non-call-eh/tools/llvmc2/

------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Sun Jul  6 15:45:41 2008
@@ -1,3 +1,4 @@
 Tools.inc
+AutoGenerated.inc
 Debug
 Release

Added: llvm/branches/non-call-eh/tools/llvmc2/Action.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/llvmc2/Action.cpp?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/tools/llvmc2/Action.cpp (added)
+++ llvm/branches/non-call-eh/tools/llvmc2/Action.cpp Sun Jul  6 15:45:41 2008
@@ -0,0 +1,78 @@
+//===--- Action.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.
+//
+//===----------------------------------------------------------------------===//
+//
+//  Action class - implementation and auxiliary functions.
+//
+//===----------------------------------------------------------------------===//
+
+#include "Action.h"
+
+#include "llvm/Support/CommandLine.h"
+#include "llvm/System/Program.h"
+
+#include <iostream>
+#include <stdexcept>
+
+using namespace llvm;
+using namespace llvmc;
+
+extern cl::opt<bool> DryRun;
+extern cl::opt<bool> VerboseMode;
+
+namespace {
+  int ExecuteProgram(const std::string& name,
+                     const StrVector& args) {
+    sys::Path prog = sys::Program::FindProgramByName(name);
+
+    if (prog.isEmpty())
+      throw std::runtime_error("Can't find program '" + name + "'");
+    if (!prog.canExecute())
+      throw std::runtime_error("Program '" + name + "' is not executable.");
+
+    // Build the command line vector and the redirects array.
+    const sys::Path* redirects[3] = {0,0,0};
+    sys::Path stdout_redirect;
+
+    std::vector<const char*> argv;
+    argv.reserve((args.size()+2));
+    argv.push_back(name.c_str());
+
+    for (StrVector::const_iterator B = args.begin(), E = args.end();
+         B!=E; ++B) {
+      if (*B == ">") {
+        ++B;
+        stdout_redirect.set(*B);
+        redirects[1] = &stdout_redirect;
+      }
+      else {
+        argv.push_back((*B).c_str());
+      }
+    }
+    argv.push_back(0);  // null terminate list.
+
+    // Invoke the program.
+    return sys::Program::ExecuteAndWait(prog, &argv[0], 0, &redirects[0]);
+  }
+
+  void print_string (const std::string& str) {
+    std::cerr << str << ' ';
+  }
+}
+
+int llvmc::Action::Execute() const {
+  if (DryRun || VerboseMode) {
+    std::cerr << Command_ << " ";
+    std::for_each(Args_.begin(), Args_.end(), print_string);
+    std::cerr << '\n';
+  }
+  if (DryRun)
+    return 0;
+  else
+    return ExecuteProgram(Command_, Args_);
+}

Added: llvm/branches/non-call-eh/tools/llvmc2/Action.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/llvmc2/Action.h?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/tools/llvmc2/Action.h (added)
+++ llvm/branches/non-call-eh/tools/llvmc2/Action.h Sun Jul  6 15:45:41 2008
@@ -0,0 +1,42 @@
+//===--- Action.h - 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.
+//
+//===----------------------------------------------------------------------===//
+//
+//  Action - encapsulates a single shell command.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_TOOLS_LLVMC2_ACTION_H
+#define LLVM_TOOLS_LLVMC2_ACTION_H
+
+#include <string>
+#include <vector>
+
+namespace llvmc {
+
+  typedef std::vector<std::string> StrVector;
+
+  /// Action - A class that encapsulates a single shell command.
+  class Action {
+    /// Command_ - The actual command (for example, 'ls').
+    std::string Command_;
+    /// Args_ - Command arguments. Stdout redirection ("> file") is allowed.
+    std::vector<std::string> Args_;
+  public:
+    Action() {}
+    Action (const std::string& C, const StrVector& A)
+      : Command_(C), Args_(A)
+    {}
+
+    /// Execute - Executes the represented action.
+    int Execute() const;
+  };
+
+}
+
+#endif // LLVM_TOOLS_LLVMC2_ACTION_H

Added: llvm/branches/non-call-eh/tools/llvmc2/AutoGenerated.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/llvmc2/AutoGenerated.cpp?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/tools/llvmc2/AutoGenerated.cpp (added)
+++ llvm/branches/non-call-eh/tools/llvmc2/AutoGenerated.cpp Sun Jul  6 15:45:41 2008
@@ -0,0 +1,35 @@
+//===--- AutoGenerated.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.
+//
+//===----------------------------------------------------------------------===//
+//
+//  Auto-generated tool descriptions - implementation.
+//
+//===----------------------------------------------------------------------===//
+
+#include "AutoGenerated.h"
+#include "CompilationGraph.h"
+#include "Tool.h"
+
+#include "llvm/ADT/StringExtras.h"
+#include "llvm/Support/CommandLine.h"
+
+#include <cstdlib>
+#include <stdexcept>
+
+using namespace llvm;
+using namespace llvmc;
+
+namespace llvmc {
+  extern LanguageMap GlobalLanguageMap;
+  extern const std::string& GetLanguage(const sys::Path& File);
+}
+
+extern cl::opt<std::string> OutputFilename;
+
+// The auto-generated file
+#include "AutoGenerated.inc"

Added: llvm/branches/non-call-eh/tools/llvmc2/AutoGenerated.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/llvmc2/AutoGenerated.h?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/tools/llvmc2/AutoGenerated.h (added)
+++ llvm/branches/non-call-eh/tools/llvmc2/AutoGenerated.h Sun Jul  6 15:45:41 2008
@@ -0,0 +1,34 @@
+//===--- AutoGenerated.h - 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.
+//
+//===----------------------------------------------------------------------===//
+//
+//  Auto-generated tool descriptions - public interface.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_TOOLS_LLVMC2_AUTOGENERATED_H
+#define LLVM_TOOLS_LLVMC2_AUTOGENERATED_H
+
+#include "llvm/ADT/StringMap.h"
+
+#include <string>
+
+namespace llvmc {
+
+  typedef llvm::StringMap<std::string> LanguageMap;
+  class CompilationGraph;
+
+  /// PopulateLanguageMap - The auto-generated function that fills in
+  /// the language map (map from file extensions to language names).
+  void PopulateLanguageMap();
+  /// PopulateCompilationGraph - The auto-generated function that
+  /// populates the compilation graph with nodes and edges.
+  void PopulateCompilationGraph(CompilationGraph& tools);
+}
+
+#endif // LLVM_TOOLS_LLVMC2_AUTOGENERATED_H

Modified: llvm/branches/non-call-eh/tools/llvmc2/Common.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/llvmc2/Common.td?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/tools/llvmc2/Common.td (original)
+++ llvm/branches/non-call-eh/tools/llvmc2/Common.td Sun Jul  6 15:45:41 2008
@@ -1,4 +1,4 @@
-//===- Tools.td - Common definitions for LLVMCC  -----------*- tablegen -*-===//
+//===- Common.td - Common definitions for LLVMCC  ----------*- tablegen -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -15,6 +15,10 @@
       list<dag> properties = l;
 }
 
+// Special Tool instance - the root node of the compilation graph.
+
+def root : Tool<[]>;
+
 // Possible Tool properties
 
 def in_language;
@@ -26,6 +30,7 @@
 
 // Possible option types
 
+def alias_option;
 def switch_option;
 def parameter_option;
 def parameter_list_option;
@@ -41,6 +46,34 @@
 def help;
 def required;
 
+// Empty DAG marker.
+def empty;
+
+// The 'case' construct.
+def case;
+
+// Primitive tests.
+def switch_on;
+def parameter_equals;
+def element_in_list;
+def input_languages_contain;
+def not_empty;
+// TOTHINK: remove?
+def default;
+
+// Boolean operators.
+def and;
+def or;
+
+// Increase/decrease the edge weight.
+def inc_weight;
+def dec_weight;
+
+// Option list - used to specify aliases and sometimes help strings.
+class OptionList<list<dag> l> {
+      list<dag> options = l;
+}
+
 // Map from suffixes to language names
 
 class LangToSuffixes<string str, list<string> lst> {
@@ -52,12 +85,22 @@
       list<LangToSuffixes> map = lst;
 }
 
-// Toolchain classes
+// Compilation graph
 
-class ToolChain <list<Tool> lst> {
-      list <Tool> tools = lst;
+class EdgeBase<Tool t1, Tool t2, dag d> {
+      Tool a = t1;
+      Tool b = t2;
+      dag weight = d;
 }
 
-class ToolChains <list<ToolChain> lst> {
-      list<ToolChain> chains = lst;
+class Edge<Tool t1, Tool t2> : EdgeBase<t1, t2, (empty)>;
+
+// Edge and SimpleEdge are synonyms.
+class SimpleEdge<Tool t1, Tool t2> : EdgeBase<t1, t2, (empty)>;
+
+// Optionally enabled edge.
+class OptionalEdge<Tool t1, Tool t2, dag props> : EdgeBase<t1, t2, props>;
+
+class CompilationGraph<list<EdgeBase> lst> {
+      list<EdgeBase> edges = lst;
 }

Added: llvm/branches/non-call-eh/tools/llvmc2/CompilationGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/llvmc2/CompilationGraph.cpp?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/tools/llvmc2/CompilationGraph.cpp (added)
+++ llvm/branches/non-call-eh/tools/llvmc2/CompilationGraph.cpp Sun Jul  6 15:45:41 2008
@@ -0,0 +1,442 @@
+//===--- CompilationGraph.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.
+//
+//===----------------------------------------------------------------------===//
+//
+//  Compilation graph - implementation.
+//
+//===----------------------------------------------------------------------===//
+
+#include "Error.h"
+#include "CompilationGraph.h"
+
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/DOTGraphTraits.h"
+#include "llvm/Support/GraphWriter.h"
+
+#include <algorithm>
+#include <iterator>
+#include <limits>
+#include <queue>
+#include <stdexcept>
+
+using namespace llvm;
+using namespace llvmc;
+
+extern cl::list<std::string> InputFilenames;
+extern cl::opt<std::string> OutputFilename;
+extern cl::list<std::string> Languages;
+
+namespace llvmc {
+  /// ExtsToLangs - Map from file extensions to language names.
+  LanguageMap GlobalLanguageMap;
+
+  /// GetLanguage -  Find the language name corresponding to the given file.
+  const std::string& GetLanguage(const sys::Path& File) {
+    LanguageMap::const_iterator Lang = GlobalLanguageMap.find(File.getSuffix());
+    if (Lang == GlobalLanguageMap.end())
+      throw std::runtime_error("Unknown suffix: " + File.getSuffix());
+    return Lang->second;
+  }
+}
+
+namespace {
+
+  /// ChooseEdge - Return the edge with the maximum weight.
+  template <class C>
+  const Edge* ChooseEdge(const C& EdgesContainer,
+                         const InputLanguagesSet& InLangs,
+                         const std::string& NodeName = "root") {
+    const Edge* MaxEdge = 0;
+    unsigned MaxWeight = 0;
+    bool SingleMax = true;
+
+    for (typename C::const_iterator B = EdgesContainer.begin(),
+           E = EdgesContainer.end(); B != E; ++B) {
+      const Edge* E = B->getPtr();
+      unsigned EW = E->Weight(InLangs);
+      if (EW > MaxWeight) {
+        MaxEdge = E;
+        MaxWeight = EW;
+        SingleMax = true;
+      } else if (EW == MaxWeight) {
+        SingleMax = false;
+      }
+    }
+
+    if (!SingleMax)
+      throw std::runtime_error("Node " + NodeName +
+                               ": multiple maximal outward edges found!"
+                               " Most probably a specification error.");
+    if (!MaxEdge)
+      throw std::runtime_error("Node " + NodeName +
+                               ": no maximal outward edge found!"
+                               " Most probably a specification error.");
+    return MaxEdge;
+  }
+
+}
+
+CompilationGraph::CompilationGraph() {
+  NodesMap["root"] = Node(this);
+}
+
+Node& CompilationGraph::getNode(const std::string& ToolName) {
+  nodes_map_type::iterator I = NodesMap.find(ToolName);
+  if (I == NodesMap.end())
+    throw std::runtime_error("Node " + ToolName + " is not in the graph");
+  return I->second;
+}
+
+const Node& CompilationGraph::getNode(const std::string& ToolName) const {
+  nodes_map_type::const_iterator I = NodesMap.find(ToolName);
+  if (I == NodesMap.end())
+    throw std::runtime_error("Node " + ToolName + " is not in the graph!");
+  return I->second;
+}
+
+// Find the tools list corresponding to the given language name.
+const CompilationGraph::tools_vector_type&
+CompilationGraph::getToolsVector(const std::string& LangName) const
+{
+  tools_map_type::const_iterator I = ToolsMap.find(LangName);
+  if (I == ToolsMap.end())
+    throw std::runtime_error("No tool corresponding to the language "
+                             + LangName + " found");
+  return I->second;
+}
+
+void CompilationGraph::insertNode(Tool* V) {
+  if (NodesMap.count(V->Name()) == 0) {
+    Node N;
+    N.OwningGraph = this;
+    N.ToolPtr = V;
+    NodesMap[V->Name()] = N;
+  }
+}
+
+void CompilationGraph::insertEdge(const std::string& A, Edge* Edg) {
+  Node& B = getNode(Edg->ToolName());
+  if (A == "root") {
+    const char** InLangs = B.ToolPtr->InputLanguages();
+    for (;*InLangs; ++InLangs)
+      ToolsMap[*InLangs].push_back(IntrusiveRefCntPtr<Edge>(Edg));
+    NodesMap["root"].AddEdge(Edg);
+  }
+  else {
+    Node& N = getNode(A);
+    N.AddEdge(Edg);
+  }
+  // Increase the inward edge counter.
+  B.IncrInEdges();
+}
+
+namespace {
+  sys::Path MakeTempFile(const sys::Path& TempDir, const std::string& BaseName,
+                         const std::string& Suffix) {
+    sys::Path Out;
+
+    // Make sure we don't end up with path names like '/file.o' if the
+    // TempDir is empty.
+    if (TempDir.empty()) {
+      Out.set(BaseName);
+    }
+    else {
+      Out = TempDir;
+      Out.appendComponent(BaseName);
+    }
+    Out.appendSuffix(Suffix);
+    // NOTE: makeUnique always *creates* a unique temporary file,
+    // which is good, since there will be no races. However, some
+    // tools do not like it when the output file already exists, so
+    // they have to be placated with -f or something like that.
+    Out.makeUnique(true, NULL);
+    return Out;
+  }
+}
+
+// Pass input file through the chain until we bump into a Join node or
+// a node that says that it is the last.
+void CompilationGraph::PassThroughGraph (const sys::Path& InFile,
+                                         const Node* StartNode,
+                                         const InputLanguagesSet& InLangs,
+                                         const sys::Path& TempDir) const {
+  bool Last = false;
+  sys::Path In = InFile;
+  const Node* CurNode = StartNode;
+
+  while(!Last) {
+    sys::Path Out;
+    Tool* CurTool = CurNode->ToolPtr.getPtr();
+
+    if (CurTool->IsJoin()) {
+      JoinTool& JT = dynamic_cast<JoinTool&>(*CurTool);
+      JT.AddToJoinList(In);
+      break;
+    }
+
+    // Since toolchains do not have to end with a Join node, we should
+    // check if this Node is the last.
+    if (!CurNode->HasChildren() || CurTool->IsLast()) {
+      if (!OutputFilename.empty()) {
+        Out.set(OutputFilename);
+      }
+      else {
+        Out.set(In.getBasename());
+        Out.appendSuffix(CurTool->OutputSuffix());
+      }
+      Last = true;
+    }
+    else {
+      Out = MakeTempFile(TempDir, In.getBasename(), CurTool->OutputSuffix());
+    }
+
+    if (int ret = CurTool->GenerateAction(In, Out, InLangs).Execute())
+      throw error_code(ret);
+
+    if (Last)
+      return;
+
+    CurNode = &getNode(ChooseEdge(CurNode->OutEdges,
+                                  InLangs,
+                                  CurNode->Name())->ToolName());
+    In = Out; Out.clear();
+  }
+}
+
+// Find the head of the toolchain corresponding to the given file.
+// Also, insert an input language into InLangs.
+const Node* CompilationGraph::
+FindToolChain(const sys::Path& In, const std::string* forceLanguage,
+              InputLanguagesSet& InLangs) const {
+
+  // Determine the input language.
+  const std::string& InLanguage =
+    forceLanguage ? *forceLanguage : GetLanguage(In);
+
+  // Add the current input language to the input language set.
+  InLangs.insert(InLanguage);
+
+  // Find the toolchain for the input language.
+  const tools_vector_type& TV = getToolsVector(InLanguage);
+  if (TV.empty())
+    throw std::runtime_error("No toolchain corresponding to language "
+                             + InLanguage + " found");
+  return &getNode(ChooseEdge(TV, InLangs)->ToolName());
+}
+
+// Helper function used by Build().
+// Traverses initial portions of the toolchains (up to the first Join node).
+// This function is also responsible for handling the -x option.
+void CompilationGraph::BuildInitial (InputLanguagesSet& InLangs,
+                                     const sys::Path& TempDir) {
+  // This is related to -x option handling.
+  cl::list<std::string>::const_iterator xIter = Languages.begin(),
+    xBegin = xIter, xEnd = Languages.end();
+  bool xEmpty = true;
+  const std::string* xLanguage = 0;
+  unsigned xPos = 0, xPosNext = 0, filePos = 0;
+
+  if (xIter != xEnd) {
+    xEmpty = false;
+    xPos = Languages.getPosition(xIter - xBegin);
+    cl::list<std::string>::const_iterator xNext = llvm::next(xIter);
+    xPosNext = (xNext == xEnd) ? std::numeric_limits<unsigned>::max()
+      : Languages.getPosition(xNext - xBegin);
+    xLanguage = (*xIter == "none") ? 0 : &(*xIter);
+  }
+
+  // For each input file:
+  for (cl::list<std::string>::const_iterator B = InputFilenames.begin(),
+         CB = B, E = InputFilenames.end(); B != E; ++B) {
+    sys::Path In = sys::Path(*B);
+
+    // Code for handling the -x option.
+    // Output: std::string* xLanguage (can be NULL).
+    if (!xEmpty) {
+      filePos = InputFilenames.getPosition(B - CB);
+
+      if (xPos < filePos) {
+        if (filePos < xPosNext) {
+          xLanguage = (*xIter == "none") ? 0 : &(*xIter);
+        }
+        else { // filePos >= xPosNext
+          // Skip xIters while filePos > xPosNext
+          while (filePos > xPosNext) {
+            ++xIter;
+            xPos = xPosNext;
+
+            cl::list<std::string>::const_iterator xNext = llvm::next(xIter);
+            if (xNext == xEnd)
+              xPosNext = std::numeric_limits<unsigned>::max();
+            else
+              xPosNext = Languages.getPosition(xNext - xBegin);
+            xLanguage = (*xIter == "none") ? 0 : &(*xIter);
+          }
+        }
+      }
+    }
+
+    // Find the toolchain corresponding to this file.
+    const Node* N = FindToolChain(In, xLanguage, InLangs);
+    // Pass file through the chain starting at head.
+    PassThroughGraph(In, N, InLangs, TempDir);
+  }
+}
+
+// Sort the nodes in topological order.
+void CompilationGraph::TopologicalSort(std::vector<const Node*>& Out) {
+  std::queue<const Node*> Q;
+  Q.push(&getNode("root"));
+
+  while (!Q.empty()) {
+    const Node* A = Q.front();
+    Q.pop();
+    Out.push_back(A);
+    for (Node::const_iterator EB = A->EdgesBegin(), EE = A->EdgesEnd();
+         EB != EE; ++EB) {
+      Node* B = &getNode((*EB)->ToolName());
+      B->DecrInEdges();
+      if (B->HasNoInEdges())
+        Q.push(B);
+    }
+  }
+}
+
+namespace {
+  bool NotJoinNode(const Node* N) {
+    return N->ToolPtr ? !N->ToolPtr->IsJoin() : true;
+  }
+}
+
+// Call TopologicalSort and filter the resulting list to include
+// only Join nodes.
+void CompilationGraph::
+TopologicalSortFilterJoinNodes(std::vector<const Node*>& Out) {
+  std::vector<const Node*> TopSorted;
+  TopologicalSort(TopSorted);
+  std::remove_copy_if(TopSorted.begin(), TopSorted.end(),
+                      std::back_inserter(Out), NotJoinNode);
+}
+
+int CompilationGraph::Build (const sys::Path& TempDir) {
+
+  InputLanguagesSet InLangs;
+
+  // Traverse initial parts of the toolchains and fill in InLangs.
+  BuildInitial(InLangs, TempDir);
+
+  std::vector<const Node*> JTV;
+  TopologicalSortFilterJoinNodes(JTV);
+
+  // For all join nodes in topological order:
+  for (std::vector<const Node*>::iterator B = JTV.begin(), E = JTV.end();
+       B != E; ++B) {
+
+    sys::Path Out;
+    const Node* CurNode = *B;
+    JoinTool* JT = &dynamic_cast<JoinTool&>(*CurNode->ToolPtr.getPtr());
+    bool IsLast = false;
+
+    // Are there any files in the join list?
+    if (JT->JoinListEmpty())
+      continue;
+
+    // Is this the last tool in the toolchain?
+    // NOTE: we can process several toolchains in parallel.
+    if (!CurNode->HasChildren() || JT->IsLast()) {
+      if (OutputFilename.empty()) {
+        Out.set("a");
+        Out.appendSuffix(JT->OutputSuffix());
+      }
+      else
+        Out.set(OutputFilename);
+      IsLast = true;
+    }
+    else {
+      Out = MakeTempFile(TempDir, "tmp", JT->OutputSuffix());
+    }
+
+    if (int ret = JT->GenerateAction(Out, InLangs).Execute())
+      throw error_code(ret);
+
+    if (!IsLast) {
+      const Node* NextNode =
+        &getNode(ChooseEdge(CurNode->OutEdges, InLangs,
+                            CurNode->Name())->ToolName());
+      PassThroughGraph(Out, NextNode, InLangs, TempDir);
+    }
+  }
+
+  return 0;
+}
+
+// Code related to graph visualization.
+
+namespace llvm {
+  template <>
+  struct DOTGraphTraits<llvmc::CompilationGraph*>
+    : public DefaultDOTGraphTraits
+  {
+
+    template<typename GraphType>
+    static std::string getNodeLabel(const Node* N, const GraphType&)
+    {
+      if (N->ToolPtr)
+        if (N->ToolPtr->IsJoin())
+          return N->Name() + "\n (join" +
+            (N->HasChildren() ? ")"
+             : std::string(": ") + N->ToolPtr->OutputLanguage() + ')');
+        else
+          return N->Name();
+      else
+        return "root";
+    }
+
+    template<typename EdgeIter>
+    static std::string getEdgeSourceLabel(const Node* N, EdgeIter I) {
+      if (N->ToolPtr) {
+        return N->ToolPtr->OutputLanguage();
+      }
+      else {
+        const char** InLangs = I->ToolPtr->InputLanguages();
+        std::string ret;
+
+        for (; *InLangs; ++InLangs) {
+          if (*(InLangs + 1)) {
+            ret += *InLangs;
+            ret +=  ", ";
+          }
+          else {
+            ret += *InLangs;
+          }
+        }
+
+        return ret;
+      }
+    }
+  };
+
+}
+
+void CompilationGraph::writeGraph() {
+  std::ofstream O("compilation-graph.dot");
+
+  if (O.good()) {
+    llvm::WriteGraph(this, "compilation-graph");
+    O.close();
+  }
+  else {
+    throw std::runtime_error("Error opening file 'compilation-graph.dot'"
+                             " for writing!");
+  }
+}
+
+void CompilationGraph::viewGraph() {
+  llvm::ViewGraph(this, "compilation-graph");
+}

Added: llvm/branches/non-call-eh/tools/llvmc2/CompilationGraph.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/llvmc2/CompilationGraph.h?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/tools/llvmc2/CompilationGraph.h (added)
+++ llvm/branches/non-call-eh/tools/llvmc2/CompilationGraph.h Sun Jul  6 15:45:41 2008
@@ -0,0 +1,291 @@
+//===--- CompilationGraph.h - 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.
+//
+//===----------------------------------------------------------------------===//
+//
+//  Compilation graph - definition.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_TOOLS_LLVMC2_COMPILATION_GRAPH_H
+#define LLVM_TOOLS_LLVMC2_COMPILATION_GRAPH_H
+
+#include "AutoGenerated.h"
+#include "Tool.h"
+
+#include "llvm/ADT/GraphTraits.h"
+#include "llvm/ADT/IntrusiveRefCntPtr.h"
+#include "llvm/ADT/iterator.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringMap.h"
+#include "llvm/ADT/StringSet.h"
+#include "llvm/System/Path.h"
+
+#include <cassert>
+#include <string>
+
+namespace llvmc {
+
+  typedef llvm::StringSet<> InputLanguagesSet;
+
+  /// Edge - Represents an edge of the compilation graph.
+  class Edge : public llvm::RefCountedBaseVPTR<Edge> {
+  public:
+    Edge(const std::string& T) : ToolName_(T) {}
+    virtual ~Edge() {};
+
+    const std::string& ToolName() const { return ToolName_; }
+    virtual unsigned Weight(const InputLanguagesSet& InLangs) const = 0;
+  private:
+    std::string ToolName_;
+  };
+
+  /// SimpleEdge - An edge that has no properties.
+  class SimpleEdge : public Edge {
+  public:
+    SimpleEdge(const std::string& T) : Edge(T) {}
+    unsigned Weight(const InputLanguagesSet&) const { return 1; }
+  };
+
+  /// Node - A node (vertex) of the compilation graph.
+  struct Node {
+    // A Node holds a list of the outward edges.
+    typedef llvm::SmallVector<llvm::IntrusiveRefCntPtr<Edge>, 3> container_type;
+    typedef container_type::iterator iterator;
+    typedef container_type::const_iterator const_iterator;
+
+    Node() : OwningGraph(0), InEdges(0) {}
+    Node(CompilationGraph* G) : OwningGraph(G), InEdges(0) {}
+    Node(CompilationGraph* G, Tool* T) :
+      OwningGraph(G), ToolPtr(T), InEdges(0) {}
+
+    bool HasChildren() const { return !OutEdges.empty(); }
+    const std::string Name() const
+    { return ToolPtr ? ToolPtr->Name() : "root"; }
+
+    // Iteration.
+    iterator EdgesBegin() { return OutEdges.begin(); }
+    const_iterator EdgesBegin() const { return OutEdges.begin(); }
+    iterator EdgesEnd() { return OutEdges.end(); }
+    const_iterator EdgesEnd() const { return OutEdges.end(); }
+
+    /// AddEdge - Add an outward edge. Takes ownership of the provided
+    /// Edge object.
+    void AddEdge(Edge* E)
+    { OutEdges.push_back(llvm::IntrusiveRefCntPtr<Edge>(E)); }
+
+    // Inward edge counter. Used to implement topological sort.
+    void IncrInEdges() { ++InEdges; }
+    void DecrInEdges() { --InEdges; }
+    bool HasNoInEdges() const { return InEdges == 0; }
+
+    // Needed to implement NodeChildIterator/GraphTraits
+    CompilationGraph* OwningGraph;
+    // The corresponding Tool.
+    // WARNING: ToolPtr can be NULL (for the root node).
+    llvm::IntrusiveRefCntPtr<Tool> ToolPtr;
+    // Links to children.
+    container_type OutEdges;
+    // Inward edge counter. Updated in
+    // CompilationGraph::insertEdge(). Used for topological sorting.
+    unsigned InEdges;
+  };
+
+  class NodesIterator;
+
+  /// CompilationGraph - The compilation graph itself.
+  class CompilationGraph {
+    /// nodes_map_type - The main data structure.
+    typedef llvm::StringMap<Node> nodes_map_type;
+    /// tools_vector_type, tools_map_type - Data structures used to
+    /// map from language names to tools. (We can have several tools
+    /// associated with each language name, hence the need for a
+    /// vector.)
+    typedef
+    llvm::SmallVector<llvm::IntrusiveRefCntPtr<Edge>, 3> tools_vector_type;
+    typedef llvm::StringMap<tools_vector_type> tools_map_type;
+
+    /// ToolsMap - Map from language names to lists of tool names.
+    tools_map_type ToolsMap;
+    /// NodesMap - Map from tool names to Tool objects.
+    nodes_map_type NodesMap;
+
+  public:
+
+    CompilationGraph();
+
+    /// insertNode - Insert a new node into the graph. Takes
+    /// ownership of the object.
+    void insertNode(Tool* T);
+
+    /// insertEdge - Insert a new edge into the graph. Takes ownership
+    /// of the Edge object.
+    void insertEdge(const std::string& A, Edge* E);
+
+    /// Build - Build target(s) from the input file set. Command-line
+    /// options are passed implicitly as global variables.
+    int Build(llvm::sys::Path const& tempDir);
+
+    /// getNode - Return a reference to the node correponding to the
+    /// given tool name. Throws std::runtime_error.
+    Node& getNode(const std::string& ToolName);
+    const Node& getNode(const std::string& ToolName) const;
+
+    /// viewGraph - This function is meant for use from the debugger.
+    /// You can just say 'call G->viewGraph()' and a ghostview window
+    /// should pop up from the program, displaying the compilation
+    /// graph. This depends on there being a 'dot' and 'gv' program
+    /// in your path.
+    void viewGraph();
+
+    /// writeGraph - Write a compilation-graph.dot file.
+    void writeGraph();
+
+    // GraphTraits support.
+    friend NodesIterator GraphBegin(CompilationGraph*);
+    friend NodesIterator GraphEnd(CompilationGraph*);
+
+  private:
+    // Helper functions.
+
+    /// getToolsVector - Return a reference to the list of tool names
+    /// corresponding to the given language name. Throws
+    /// std::runtime_error.
+    const tools_vector_type& getToolsVector(const std::string& LangName) const;
+
+    /// PassThroughGraph - Pass the input file through the toolchain
+    /// starting at StartNode.
+    void PassThroughGraph (const llvm::sys::Path& In, const Node* StartNode,
+                           const InputLanguagesSet& InLangs,
+                           const llvm::sys::Path& TempDir) const;
+
+    /// FindToolChain - Find head of the toolchain corresponding to the given file.
+    const Node* FindToolChain(const llvm::sys::Path& In,
+                              const std::string* forceLanguage,
+                              InputLanguagesSet& InLangs) const;
+
+    /// BuildInitial - Traverse the initial parts of the toolchains.
+    void BuildInitial(InputLanguagesSet& InLangs,
+                      const llvm::sys::Path& TempDir);
+
+    /// TopologicalSort - Sort the nodes in topological order.
+    void TopologicalSort(std::vector<const Node*>& Out);
+    /// TopologicalSortFilterJoinNodes - Call TopologicalSort and
+    /// filter the resulting list to include only Join nodes.
+    void TopologicalSortFilterJoinNodes(std::vector<const Node*>& Out);
+  };
+
+  // GraphTraits support code.
+
+  /// NodesIterator - Auxiliary class needed to implement GraphTraits
+  /// support. Can be generalised to something like value_iterator
+  /// for map-like containers.
+  class NodesIterator : public llvm::StringMap<Node>::iterator {
+    typedef llvm::StringMap<Node>::iterator super;
+    typedef NodesIterator ThisType;
+    typedef Node* pointer;
+    typedef Node& reference;
+
+  public:
+    NodesIterator(super I) : super(I) {}
+
+    inline reference operator*() const {
+      return super::operator->()->second;
+    }
+    inline pointer operator->() const {
+      return &super::operator->()->second;
+    }
+  };
+
+  inline NodesIterator GraphBegin(CompilationGraph* G) {
+    return NodesIterator(G->NodesMap.begin());
+  }
+
+  inline NodesIterator GraphEnd(CompilationGraph* G) {
+    return NodesIterator(G->NodesMap.end());
+  }
+
+
+  /// NodeChildIterator - Another auxiliary class needed by GraphTraits.
+  class NodeChildIterator : public bidirectional_iterator<Node, ptrdiff_t> {
+    typedef NodeChildIterator ThisType;
+    typedef Node::container_type::iterator iterator;
+
+    CompilationGraph* OwningGraph;
+    iterator EdgeIter;
+  public:
+    typedef Node* pointer;
+    typedef Node& reference;
+
+    NodeChildIterator(Node* N, iterator I) :
+      OwningGraph(N->OwningGraph), EdgeIter(I) {}
+
+    const ThisType& operator=(const ThisType& I) {
+      assert(OwningGraph == I.OwningGraph);
+      EdgeIter = I.EdgeIter;
+      return *this;
+    }
+
+    inline bool operator==(const ThisType& I) const
+    { return EdgeIter == I.EdgeIter; }
+    inline bool operator!=(const ThisType& I) const
+    { return EdgeIter != I.EdgeIter; }
+
+    inline pointer operator*() const {
+      return &OwningGraph->getNode((*EdgeIter)->ToolName());
+    }
+    inline pointer operator->() const {
+      return &OwningGraph->getNode((*EdgeIter)->ToolName());
+    }
+
+    ThisType& operator++() { ++EdgeIter; return *this; } // Preincrement
+    ThisType operator++(int) { // Postincrement
+      ThisType tmp = *this;
+      ++*this;
+      return tmp;
+    }
+
+    inline ThisType& operator--() { --EdgeIter; return *this; }  // Predecrement
+    inline ThisType operator--(int) { // Postdecrement
+      ThisType tmp = *this;
+      --*this;
+      return tmp;
+    }
+
+  };
+}
+
+namespace llvm {
+  template <>
+  struct GraphTraits<llvmc::CompilationGraph*> {
+    typedef llvmc::CompilationGraph GraphType;
+    typedef llvmc::Node NodeType;
+    typedef llvmc::NodeChildIterator ChildIteratorType;
+
+    static NodeType* getEntryNode(GraphType* G) {
+      return &G->getNode("root");
+    }
+
+    static ChildIteratorType child_begin(NodeType* N) {
+      return ChildIteratorType(N, N->OutEdges.begin());
+    }
+    static ChildIteratorType child_end(NodeType* N) {
+      return ChildIteratorType(N, N->OutEdges.end());
+    }
+
+    typedef llvmc::NodesIterator nodes_iterator;
+    static nodes_iterator nodes_begin(GraphType *G) {
+      return GraphBegin(G);
+    }
+    static nodes_iterator nodes_end(GraphType *G) {
+      return GraphEnd(G);
+    }
+  };
+
+}
+
+#endif // LLVM_TOOLS_LLVMC2_COMPILATION_GRAPH_H

Removed: llvm/branches/non-call-eh/tools/llvmc2/Core.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/llvmc2/Core.cpp?rev=53162&view=auto

==============================================================================
--- llvm/branches/non-call-eh/tools/llvmc2/Core.cpp (original)
+++ llvm/branches/non-call-eh/tools/llvmc2/Core.cpp (removed)
@@ -1,115 +0,0 @@
-//===--- Core.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.
-//
-//===----------------------------------------------------------------------===//
-//
-//  Core driver abstractions.
-//
-//===----------------------------------------------------------------------===//
-
-#include "Core.h"
-#include "Utility.h"
-
-#include "llvm/ADT/STLExtras.h"
-#include "llvm/ADT/StringExtras.h"
-#include "llvm/Support/CommandLine.h"
-
-#include <algorithm>
-#include <iostream>
-#include <stdexcept>
-
-using namespace llvm;
-using namespace llvmcc;
-
-extern cl::list<std::string> InputFilenames;
-extern cl::opt<std::string> OutputFilename;
-extern cl::opt<bool> VerboseMode;
-
-namespace {
-  void print_string (const std::string& str) {
-    std::cerr << str << ' ';
-  }
-}
-
-int llvmcc::Action::Execute() {
-  if (VerboseMode) {
-    std::cerr << Command_ << " ";
-    std::for_each(Args_.begin(), Args_.end(), print_string);
-    std::cerr << '\n';
-  }
-  return ExecuteProgram(Command_, Args_);
-}
-
-int llvmcc::CompilationGraph::Build (const sys::Path& tempDir) const {
-  sys::Path In(InputFilenames.at(0)), Out;
-
-  // Find out which language corresponds to the suffix of the first input file
-  LanguageMap::const_iterator Lang = ExtsToLangs.find(In.getSuffix());
-  if (Lang == ExtsToLangs.end())
-    throw std::runtime_error("Unknown suffix!");
-
-  // Find the toolchain corresponding to this language
-  ToolChainMap::const_iterator ToolsIt = ToolChains.find(Lang->second);
-  if (ToolsIt == ToolChains.end())
-    throw std::runtime_error("Unknown language!");
-  ToolChain Tools = ToolsIt->second;
-
-  PathVector JoinList;
-
-  for (cl::list<std::string>::const_iterator B = InputFilenames.begin(),
-        E = InputFilenames.end(); B != E; ++B) {
-    In = sys::Path(*B);
-
-    // Pass input file through the toolchain
-    for (ToolChain::const_iterator B = Tools.begin(), E = Tools.end();
-         B != E; ++B) {
-
-      const Tool* CurTool = B->getPtr();
-
-      // Is this the last step in the chain?
-      if (llvm::next(B) == E || CurTool->IsLast()) {
-        JoinList.push_back(In);
-        break;
-      }
-      else {
-        Out = tempDir;
-        Out.appendComponent(In.getBasename());
-        Out.appendSuffix(CurTool->OutputSuffix());
-        Out.makeUnique(true, NULL);
-        Out.eraseFromDisk();
-      }
-
-      if (CurTool->GenerateAction(In, Out).Execute() != 0)
-        throw std::runtime_error("Tool returned error code!");
-
-      In = Out; Out.clear();
-    }
-  }
-
-  // Pass .o files to linker
-  const Tool* JoinNode = (--Tools.end())->getPtr();
-
-  // If the final output name is empty, set it to "a.out"
-  if (!OutputFilename.empty()) {
-    Out = sys::Path(OutputFilename);
-  }
-  else {
-    Out = sys::Path("a");
-    Out.appendSuffix(JoinNode->OutputSuffix());
-  }
-
-  if (JoinNode->GenerateAction(JoinList, Out).Execute() != 0)
-    throw std::runtime_error("Tool returned error code!");
-
-  return 0;
-}
-
-void llvmcc::Tool::UnpackValues (const std::string& from,
-                                 std::vector<std::string>& to) const {
-  SplitString(from, to, ",");
-}
-

Removed: llvm/branches/non-call-eh/tools/llvmc2/Core.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/llvmc2/Core.h?rev=53162&view=auto

==============================================================================
--- llvm/branches/non-call-eh/tools/llvmc2/Core.h (original)
+++ llvm/branches/non-call-eh/tools/llvmc2/Core.h (removed)
@@ -1,83 +0,0 @@
-//===--- Core.h - 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.
-//
-//===----------------------------------------------------------------------===//
-//
-//  Core driver abstractions.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_TOOLS_LLVMCC_CORE_H
-#define LLVM_TOOLS_LLVMCC_CORE_H
-
-#include "Utility.h"
-
-#include "llvm/ADT/IntrusiveRefCntPtr.h"
-#include "llvm/ADT/StringMap.h"
-#include "llvm/System/Path.h"
-
-#include <stdexcept>
-#include <string>
-#include <vector>
-
-// Core functionality
-
-namespace llvmcc {
-
-  typedef std::vector<llvm::sys::Path> PathVector;
-  typedef llvm::StringMap<std::string> LanguageMap;
-
-  class Action {
-    std::string Command_;
-    std::vector<std::string> Args_;
-  public:
-    Action (std::string const& C,
-            std::vector<std::string> const& A)
-      : Command_(C), Args_(A)
-    {}
-
-    int Execute();
-  };
-
-  class Tool : public llvm::RefCountedBaseVPTR<Tool> {
-  public:
-    virtual Action GenerateAction (PathVector const& inFiles,
-                                  llvm::sys::Path const& outFile) const = 0;
-
-    virtual Action GenerateAction (llvm::sys::Path const& inFile,
-                                  llvm::sys::Path const& outFile) const = 0;
-
-    virtual std::string Name() const = 0;
-    virtual std::string InputLanguage() const = 0;
-    virtual std::string OutputLanguage() const = 0;
-    virtual std::string OutputSuffix() const = 0;
-
-    virtual bool IsLast() const = 0;
-    virtual bool IsJoin() const = 0;
-
-    // Helper function that is called by the auto-generated code
-    // Splits strings of the form ",-foo,-bar,-baz"
-    // TOFIX: find a better name
-    void UnpackValues (std::string const& from,
-                       std::vector<std::string>& to) const;
-
-    virtual ~Tool()
-    {}
-  };
-
-  typedef std::vector<llvm::IntrusiveRefCntPtr<Tool> > ToolChain;
-  typedef llvm::StringMap<ToolChain> ToolChainMap;
-
-  struct CompilationGraph {
-    ToolChainMap ToolChains;
-    LanguageMap ExtsToLangs;
-
-    int Build(llvm::sys::Path const& tempDir) const;
-  };
-}
-
-#endif // LLVM_TOOLS_LLVMCC_CORE_H

Added: llvm/branches/non-call-eh/tools/llvmc2/Error.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/llvmc2/Error.h?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/tools/llvmc2/Error.h (added)
+++ llvm/branches/non-call-eh/tools/llvmc2/Error.h Sun Jul  6 15:45:41 2008
@@ -0,0 +1,33 @@
+//===--- Error.h - 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.
+//
+//===----------------------------------------------------------------------===//
+//
+//  Exception classes for LLVMC.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_TOOLS_LLVMC2_ERROR_H
+#define LLVM_TOOLS_LLVMC2_ERROR_H
+
+#include <stdexcept>
+
+namespace llvmc {
+
+  class error_code: public std::runtime_error {
+    int Code_;
+  public:
+    error_code (int c)
+      : std::runtime_error("Tool returned error code"), Code_(c)
+    {}
+
+    int code() const { return Code_; }
+  };
+
+}
+
+#endif //LLVM_TOOLS_LLVMC2_ERROR_H

Removed: llvm/branches/non-call-eh/tools/llvmc2/Example.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/llvmc2/Example.td?rev=53162&view=auto

==============================================================================
--- llvm/branches/non-call-eh/tools/llvmc2/Example.td (original)
+++ llvm/branches/non-call-eh/tools/llvmc2/Example.td (removed)
@@ -1,24 +0,0 @@
-//===- Example.td - LLVMCC 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 toolchain descriptions used by llvmcc.
-//
-//===----------------------------------------------------------------------===//
-
-include "Common.td"
-include "Tools.td"
-
-// Toolchains
-
-def ToolChains : ToolChains<[
-    ToolChain<[llvm_gcc_c, llc, llvm_gcc_assembler, llvm_gcc_linker]>,
-    ToolChain<[llvm_gcc_cpp, llc, llvm_gcc_assembler, llvm_gcc_linker]>,
-    ToolChain<[llvm_as, llc, llvm_gcc_assembler, llvm_gcc_linker]>,
-    ToolChain<[llvm_gcc_assembler, llvm_gcc_linker]>
-    ]>;

Removed: llvm/branches/non-call-eh/tools/llvmc2/ExampleWithOpt.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/llvmc2/ExampleWithOpt.td?rev=53162&view=auto

==============================================================================
--- llvm/branches/non-call-eh/tools/llvmc2/ExampleWithOpt.td (original)
+++ llvm/branches/non-call-eh/tools/llvmc2/ExampleWithOpt.td (removed)
@@ -1,24 +0,0 @@
-//===- ExampleWithOpt.td - LLVMCC 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 toolchain descriptions used by llvmcc.
-//
-//===----------------------------------------------------------------------===//
-
-include "Common.td"
-include "Tools.td"
-
-// Toolchains
-
-def ToolChains : ToolChains<[
-    ToolChain<[llvm_gcc_c, opt, llc, llvm_gcc_assembler, llvm_gcc_linker]>,
-    ToolChain<[llvm_gcc_cpp, opt, llc, llvm_gcc_assembler, llvm_gcc_linker]>,
-    ToolChain<[llvm_as, opt, llc, llvm_gcc_assembler, llvm_gcc_linker]>,
-    ToolChain<[llvm_gcc_assembler, llvm_gcc_linker]>
-    ]>;

Added: llvm/branches/non-call-eh/tools/llvmc2/Graph.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/llvmc2/Graph.td?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/tools/llvmc2/Graph.td (added)
+++ llvm/branches/non-call-eh/tools/llvmc2/Graph.td Sun Jul  6 15:45:41 2008
@@ -0,0 +1,49 @@
+//===- Graph.td - LLVMCC 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 llvmcc.
+//
+//===----------------------------------------------------------------------===//
+
+include "Common.td"
+include "Tools.td"
+
+// Toolchains
+
+def CompilationGraph : CompilationGraph<[
+    Edge<root, llvm_gcc_c>,
+    Edge<root, llvm_gcc_assembler>,
+    Edge<root, llvm_gcc_cpp>,
+    Edge<root, llvm_as>,
+
+    Edge<llvm_gcc_c, llc>,
+    Edge<llvm_gcc_cpp, llc>,
+    Edge<llvm_as, llc>,
+
+    OptionalEdge<llvm_gcc_c, opt, (case (switch_on "opt"), (inc_weight))>,
+    OptionalEdge<llvm_gcc_cpp, 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
+                     (input_languages_contain "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
+                     (input_languages_contain "c++"), (inc_weight),
+                     (or (parameter_equals "linker", "g++"),
+                         (parameter_equals "linker", "c++")), (inc_weight))>
+    ]>;

Modified: llvm/branches/non-call-eh/tools/llvmc2/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/llvmc2/Makefile?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/tools/llvmc2/Makefile (original)
+++ llvm/branches/non-call-eh/tools/llvmc2/Makefile Sun Jul  6 15:45:41 2008
@@ -1,4 +1,4 @@
-##===- tools/llvmcc/Makefile -------------------------------*- Makefile -*-===##
+##===- tools/llvmc2/Makefile -------------------------------*- Makefile -*-===##
 #
 #                     The LLVM Compiler Infrastructure
 #
@@ -8,25 +8,22 @@
 ##===----------------------------------------------------------------------===##
 LEVEL = ../..
 TOOLNAME = llvmc2
-BUILT_SOURCES = Tools.inc
+BUILT_SOURCES = AutoGenerated.inc
 LINK_COMPONENTS = support system
 REQUIRES_EH := 1
 
 include $(LEVEL)/Makefile.common
 
-TOOLS_TARGET=default
-ifeq ($(TOOLS_TARGET), default)
-	TOOLS_SOURCE=Example.td
-else
-	TOOLS_SOURCE=ExampleWithOpt.td
-endif
+GRAPH=Graph.td
+$(GRAPH) : Common.td
+Graph.td : Tools.td
+TOOLS_SOURCE=$(GRAPH)
 
 # TOFIX: integrate this part into Makefile.rules?
 # The degree of horrorshowness in that file is too much for me atm.
-$(ObjDir)/Tools.inc.tmp: $(TOOLS_SOURCE) $(ObjDir)/.dir
-	$(Echo) "Building LLVMCC configuration library with tblgen"
-	$(Verb) $(TableGen) -gen-llvmcc -o $(call SYSPATH, $@) $<
+$(ObjDir)/AutoGenerated.inc.tmp: $(TOOLS_SOURCE) $(ObjDir)/.dir $(TBLGEN)
+	$(Echo) "Building LLVMC configuration library with tblgen"
+	$(Verb) $(TableGen) -gen-llvmc -o $(call SYSPATH, $@) $<
 
-Tools.inc : $(ObjDir)/Tools.inc.tmp
+AutoGenerated.inc : $(ObjDir)/AutoGenerated.inc.tmp
 	$(Verb) $(CMP) -s $@ $< || $(CP) $< $@
-

Added: llvm/branches/non-call-eh/tools/llvmc2/Tool.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/llvmc2/Tool.h?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/tools/llvmc2/Tool.h (added)
+++ llvm/branches/non-call-eh/tools/llvmc2/Tool.h Sun Jul  6 15:45:41 2008
@@ -0,0 +1,74 @@
+//===--- Tool.h - 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.
+//
+//===----------------------------------------------------------------------===//
+//
+//  Tool abstract base class - an interface to tool descriptions.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_TOOLS_LLVMC2_TOOL_H
+#define LLVM_TOOLS_LLVMC2_TOOL_H
+
+#include "Action.h"
+
+#include "llvm/ADT/IntrusiveRefCntPtr.h"
+#include "llvm/ADT/StringSet.h"
+#include "llvm/System/Path.h"
+
+#include <string>
+#include <vector>
+
+namespace llvmc {
+
+  typedef std::vector<llvm::sys::Path> PathVector;
+  typedef llvm::StringSet<> InputLanguagesSet;
+
+  /// Tool - A class
+  class Tool : public llvm::RefCountedBaseVPTR<Tool> {
+  public:
+
+    virtual ~Tool() {}
+
+    virtual Action GenerateAction (const PathVector& inFiles,
+                                   const llvm::sys::Path& outFile,
+                                   const InputLanguagesSet& InLangs) const = 0;
+
+    virtual Action GenerateAction (const llvm::sys::Path& inFile,
+                                   const llvm::sys::Path& outFile,
+                                   const InputLanguagesSet& InLangs) const = 0;
+
+    virtual const char*  Name() const = 0;
+    virtual const char** InputLanguages() const = 0;
+    virtual const char*  OutputLanguage() const = 0;
+    virtual const char*  OutputSuffix() const = 0;
+
+    virtual bool IsLast() const = 0;
+    virtual bool IsJoin() const = 0;
+  };
+
+  /// JoinTool - A Tool that has an associated input file list.
+  class JoinTool : public Tool {
+  public:
+    void AddToJoinList(const llvm::sys::Path& P) { JoinList_.push_back(P); }
+    void ClearJoinList() { JoinList_.clear(); }
+    bool JoinListEmpty() const { return JoinList_.empty(); }
+
+    Action GenerateAction(const llvm::sys::Path& outFile,
+                          const InputLanguagesSet& InLangs) const {
+      return GenerateAction(JoinList_, outFile, InLangs);
+    }
+    // We shouldn't shadow base class's version of GenerateAction.
+    using Tool::GenerateAction;
+
+  private:
+    PathVector JoinList_;
+  };
+
+}
+
+#endif //LLVM_TOOLS_LLVMC2_TOOL_H

Removed: llvm/branches/non-call-eh/tools/llvmc2/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/llvmc2/Tools.cpp?rev=53162&view=auto

==============================================================================
--- llvm/branches/non-call-eh/tools/llvmc2/Tools.cpp (original)
+++ llvm/branches/non-call-eh/tools/llvmc2/Tools.cpp (removed)
@@ -1,28 +0,0 @@
-//===--- Tools.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.
-//
-//===----------------------------------------------------------------------===//
-//
-//  Auto-generated tool descriptions.
-//
-//===----------------------------------------------------------------------===//
-
-#include "Tools.h"
-#include "Core.h"
-
-#include "llvm/ADT/IntrusiveRefCntPtr.h"
-#include "llvm/Support/CommandLine.h"
-
-#include <stdexcept>
-#include <string>
-#include <vector>
-
-using namespace llvm;
-using namespace llvmcc;
-
-// Include the auto-generated file
-#include "Tools.inc"

Removed: llvm/branches/non-call-eh/tools/llvmc2/Tools.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/llvmc2/Tools.h?rev=53162&view=auto

==============================================================================
--- llvm/branches/non-call-eh/tools/llvmc2/Tools.h (original)
+++ llvm/branches/non-call-eh/tools/llvmc2/Tools.h (removed)
@@ -1,26 +0,0 @@
-//===--- Tools.h - 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.
-//
-//===----------------------------------------------------------------------===//
-//
-//  Auto-generated tool descriptions.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_TOOLS_LLVMCC_TOOLS_H
-#define LLVM_TOOLS_LLVMCC_TOOLS_H
-
-#include "Core.h"
-
-namespace llvmcc {
-
-  void PopulateLanguageMap(LanguageMap& language_map);
-  void PopulateCompilationGraph(CompilationGraph& tools);
-
-}
-
-#endif //LLVM_TOOLS_LLVMCC_TOOLS_H

Modified: llvm/branches/non-call-eh/tools/llvmc2/Tools.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/llvmc2/Tools.td?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/tools/llvmc2/Tools.td (original)
+++ llvm/branches/non-call-eh/tools/llvmc2/Tools.td Sun Jul  6 15:45:41 2008
@@ -11,35 +11,55 @@
 //
 //===----------------------------------------------------------------------===//
 
-// Open issue: should we use DAG lists in Tool specifications
+// TOTHINK: Open issue: should we use DAG lists in Tool specifications
 // or change to something like
+
 // def LLVMGccC : < Tool<
 // [ InLanguage<"c">,
 //   PrefixListOption<"Wl", [UnpackValues, PropertyName<Arg>, ...]>
 //  ...] ?
+
 // DAG lists look more aesthetically pleasing to me.
 
 def llvm_gcc_c : Tool<
 [(in_language "c"),
- (out_language "llvm-assembler"),
+ (out_language "llvm-bitcode"),
  (output_suffix "bc"),
- (cmd_line "llvm-gcc -c $INFILE -o $OUTFILE -emit-llvm"),
+ (cmd_line (case
+            (switch_on "E"),
+              (case (not_empty "o"),
+                    "llvm-gcc -E -x c++ $INFILE -o $OUTFILE",
+                    (default),
+                    "llvm-gcc -E -x c++ $INFILE"),
+            (default),
+              "llvm-gcc -c -x c $INFILE -o $OUTFILE -emit-llvm")),
+ (switch_option "E", (stop_compilation),
+   (help "Stop after the preprocessing stage, do not run the compiler")),
  (sink)
 ]>;
 
 def llvm_gcc_cpp : Tool<
 [(in_language "c++"),
- (out_language "llvm-assembler"),
+ (out_language "llvm-bitcode"),
  (output_suffix "bc"),
- (cmd_line "llvm-g++ -c $INFILE -o $OUTFILE -emit-llvm"),
+ (cmd_line (case
+            (switch_on "E"),
+              (case (not_empty "o"),
+                    "llvm-g++ -E -x c++ $INFILE -o $OUTFILE",
+                    (default),
+                    "llvm-g++ -E -x c++ $INFILE"),
+            (default),
+              "llvm-g++ -c -x c++ $INFILE -o $OUTFILE -emit-llvm")),
+ (switch_option "E", (stop_compilation)),
  (sink)
 ]>;
 
 def opt : Tool<
 [(in_language "llvm-bitcode"),
  (out_language "llvm-bitcode"),
+ (switch_option "opt", (help "Enable opt")),
  (output_suffix "bc"),
- (cmd_line "opt $INFILE -o $OUTFILE")
+ (cmd_line "opt -f $INFILE -o $OUTFILE")
 ]>;
 
 def llvm_as : Tool<
@@ -53,26 +73,45 @@
 [(in_language "llvm-bitcode"),
  (out_language "assembler"),
  (output_suffix "s"),
- (cmd_line "llc $INFILE -o $OUTFILE")
+ (switch_option "S", (stop_compilation),
+                (help "Stop after compilation, do not assemble")),
+ (cmd_line "llc -f $INFILE -o $OUTFILE")
 ]>;
 
 def llvm_gcc_assembler : Tool<
 [(in_language "assembler"),
  (out_language "object-code"),
  (output_suffix "o"),
- (cmd_line "llvm-gcc -c $INFILE -o $OUTFILE"),
- (prefix_list_option "Wa", (unpack_values), (help "pass options to assembler"))
+ (cmd_line "llvm-gcc -c -x assembler $INFILE -o $OUTFILE"),
+ (switch_option "c", (stop_compilation),
+                (help "Compile and assemble, but do not link")),
+ (prefix_list_option "Wa,", (unpack_values), (help "Pass options to assembler"))
 ]>;
 
+// Default linker
 def llvm_gcc_linker : Tool<
 [(in_language "object-code"),
  (out_language "executable"),
  (output_suffix "out"),
  (cmd_line "llvm-gcc $INFILE -o $OUTFILE"),
  (join),
- (prefix_list_option "L", (forward), (help "add a directory to link path")),
- (prefix_list_option "l", (forward), (help "search a library when linking")),
- (prefix_list_option "Wl", (unpack_values), (help "pass options to linker"))
+ (prefix_list_option "L", (forward), (help "Add a directory to link path")),
+ (prefix_list_option "l", (forward), (help "Search a library when linking")),
+ (prefix_list_option "Wl,", (unpack_values), (help "Pass options to linker"))
+]>;
+
+// Alternative linker for C++
+def llvm_gcc_cpp_linker : Tool<
+[(in_language "object-code"),
+ (out_language "executable"),
+ (output_suffix "out"),
+ (cmd_line "llvm-g++ $INFILE -o $OUTFILE"),
+ (join),
+ (parameter_option "linker",
+                   (help "Choose linker (possible values: gcc, g++)")),
+ (prefix_list_option "L", (forward)),
+ (prefix_list_option "l", (forward)),
+ (prefix_list_option "Wl,", (unpack_values))
 ]>;
 
 // Language map
@@ -84,4 +123,5 @@
      LangToSuffixes<"llvm-assembler", ["ll"]>,
      LangToSuffixes<"llvm-bitcode", ["bc"]>,
      LangToSuffixes<"object-code", ["o"]>,
-     LangToSuffixes<"executable", ["out"]>]>;
+     LangToSuffixes<"executable", ["out"]>
+     ]>;

Removed: llvm/branches/non-call-eh/tools/llvmc2/Utility.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/llvmc2/Utility.cpp?rev=53162&view=auto

==============================================================================
--- llvm/branches/non-call-eh/tools/llvmc2/Utility.cpp (original)
+++ llvm/branches/non-call-eh/tools/llvmc2/Utility.cpp (removed)
@@ -1,39 +0,0 @@
-//===--- Utility.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.
-//
-//===----------------------------------------------------------------------===//
-//
-//  Various helper and utility functions - implementation.
-//
-//===----------------------------------------------------------------------===//
-
-#include "Utility.h"
-
-#include "llvm/System/Program.h"
-
-#include <stdexcept>
-
-using namespace llvm;
-
-int llvmcc::ExecuteProgram(const std::string& name,
-                           const std::vector<std::string>& args) {
-  sys::Path prog = sys::Program::FindProgramByName(name);
-
-  if (prog.isEmpty())
-    throw std::runtime_error("Can't find program '" + name + "'");
-  if (!prog.canExecute())
-    throw std::runtime_error("Program '" + name + "' is not executable.");
-
-  // Invoke the program
-  std::vector<const char*> argv((args.size()+2));
-  argv[0] = name.c_str();
-  for (unsigned i = 1; i <= args.size(); ++i)
-    argv[i] = args[i-1].c_str();
-  argv[args.size()+1] = 0;  // null terminate list.
-
-  return sys::Program::ExecuteAndWait(prog, &argv[0]);
-}

Removed: llvm/branches/non-call-eh/tools/llvmc2/Utility.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/llvmc2/Utility.h?rev=53162&view=auto

==============================================================================
--- llvm/branches/non-call-eh/tools/llvmc2/Utility.h (original)
+++ llvm/branches/non-call-eh/tools/llvmc2/Utility.h (removed)
@@ -1,27 +0,0 @@
-//===--- Utility.h - 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.
-//
-//===----------------------------------------------------------------------===//
-//
-//  Various helper and utility functions.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_TOOLS_LLVMCC_UTILITY_H
-#define LLVM_TOOLS_LLVMCC_UTILITY_H
-
-#include <string>
-#include <vector>
-
-namespace llvmcc {
-
-  int ExecuteProgram (const std::string& name,
-                      const std::vector<std::string>& arguments);
-
-}
-
-#endif // LLVM_TOOLS_LLVMCC_UTILITY_H

Modified: llvm/branches/non-call-eh/tools/llvmc2/doc/LLVMC-Enhancements.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/llvmc2/doc/LLVMC-Enhancements.rst?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/tools/llvmc2/doc/LLVMC-Enhancements.rst (original)
+++ llvm/branches/non-call-eh/tools/llvmc2/doc/LLVMC-Enhancements.rst Sun Jul  6 15:45:41 2008
@@ -2,7 +2,7 @@
 ============
 
 Disclaimer: this document is currently somewhat out-of-date and is
-retained for reference; for documentation, refer to
+retained for reference; for more recent documentation please refer to
 LLVMC-Tutorial.rst.
 
 A complete rewrite of the LLVMC compiler driver is proposed, aimed at

Added: llvm/branches/non-call-eh/tools/llvmc2/doc/LLVMC-Reference.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/llvmc2/doc/LLVMC-Reference.rst?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/tools/llvmc2/doc/LLVMC-Reference.rst (added)
+++ llvm/branches/non-call-eh/tools/llvmc2/doc/LLVMC-Reference.rst Sun Jul  6 15:45:41 2008
@@ -0,0 +1,418 @@
+===================================
+Customizing LLVMC: Reference Manual
+===================================
+
+LLVMC is a generic compiler driver, designed to be customizable and
+extensible. It plays the same role for LLVM as the ``gcc`` program
+does for GCC - LLVMC's job is essentially to transform a set of input
+files into a set of targets depending on configuration rules and user
+options. What makes LLVMC different is that these transformation rules
+are completely customizable - in fact, LLVMC knows nothing about the
+specifics of transformation (even the command-line options are mostly
+not hard-coded) and regards the transformation structure as an
+abstract graph. This makes it possible to adapt LLVMC for other
+purposes - for example, as a build tool for game resources.
+
+Because LLVMC employs TableGen [1]_ as its configuration language, you
+need to be familiar with it to customize LLVMC.
+
+
+.. contents::
+
+
+Compiling with LLVMC
+====================
+
+LLVMC tries hard to be as compatible with ``gcc`` as possible,
+although there are some small differences. Most of the time, however,
+you shouldn't be able to notice them::
+
+     $ # This works as expected:
+     $ llvmc2 -O3 -Wall hello.cpp
+     $ ./a.out
+     hello
+
+One nice feature of LLVMC is that one doesn't have to distinguish
+between different compilers for different languages (think ``g++`` and
+``gcc``) - the right toolchain is chosen automatically based on input
+language names (which are, in turn, determined from file
+extensions). If you want to force files ending with ".c" to compile as
+C++, use the ``-x`` option, just like you would do it with ``gcc``::
+
+      $ llvmc2 -x c hello.cpp
+      $ # hello.cpp is really a C file
+      $ ./a.out
+      hello
+
+On the other hand, when using LLVMC as a linker to combine several C++
+object files you should provide the ``--linker`` option since it's
+impossible for LLVMC to choose the right linker in that case::
+
+    $ llvmc2 -c hello.cpp
+    $ llvmc2 hello.o
+    [A lot of link-time errors skipped]
+    $ llvmc2 --linker=c++ hello.o
+    $ ./a.out
+    hello
+
+Predefined options
+==================
+
+LLVMC has some built-in options that can't be overridden in the
+configuration files:
+
+* ``-o FILE`` - Output file name.
+
+* ``-x LANGUAGE`` - Specify the language of the following input files
+  until the next -x option.
+
+* ``-v`` - Enable verbose mode, i.e. print out all executed commands.
+
+* ``--view-graph`` - Show a graphical representation of the compilation
+  graph. Requires that you have ``dot`` and ``gv`` commands
+  installed. Hidden option, useful for debugging.
+
+* ``--write-graph`` - Write a ``compilation-graph.dot`` file in the
+  current directory with the compilation graph description in the
+  Graphviz format. Hidden option, useful for debugging.
+
+* ``--save-temps`` - Write temporary files to the current directory
+  and do not delete them on exit. Hidden option, useful for debugging.
+
+* ``--help``, ``--help-hidden``, ``--version`` - These options have
+  their standard meaning.
+
+
+Customizing LLVMC: the compilation graph
+========================================
+
+At the time of writing LLVMC does not support on-the-fly reloading of
+configuration, so to customize LLVMC you'll have to recompile the
+source code (which lives under ``$LLVM_DIR/tools/llvmc2``). The
+default configuration files are ``Common.td`` (contains common
+definitions, don't forget to ``include`` it in your configuration
+files), ``Tools.td`` (tool descriptions) and ``Graph.td`` (compilation
+graph definition).
+
+To compile LLVMC with your own configuration file (say,``MyGraph.td``),
+run ``make`` like this::
+
+    $ cd $LLVM_DIR/tools/llvmc2
+    $ make GRAPH=MyGraph.td TOOLNAME=my_llvmc
+
+This will build an executable named ``my_llvmc``. There are also
+several sample configuration files in the ``llvmc2/examples``
+subdirectory that should help to get you started.
+
+Internally, LLVMC stores information about possible source
+transformations in form of a graph. Nodes in this graph represent
+tools, and edges between two nodes represent a transformation path. A
+special "root" node is used to mark entry points for the
+transformations. LLVMC also assigns a weight to each edge (more on
+this later) to choose between several alternative edges.
+
+The definition of the compilation graph (see file ``Graph.td``) is
+just a list of edges::
+
+    def CompilationGraph : CompilationGraph<[
+        Edge<root, llvm_gcc_c>,
+        Edge<root, llvm_gcc_assembler>,
+        ...
+
+        Edge<llvm_gcc_c, llc>,
+        Edge<llvm_gcc_cpp, llc>,
+        ...
+
+        OptionalEdge<llvm_gcc_c, opt, [(switch_on "opt")]>,
+        OptionalEdge<llvm_gcc_cpp, opt, [(switch_on "opt")]>,
+        ...
+
+        OptionalEdge<llvm_gcc_assembler, llvm_gcc_cpp_linker,
+            (case (input_languages_contain "c++"), (inc_weight),
+                  (or (parameter_equals "linker", "g++"),
+                      (parameter_equals "linker", "c++")), (inc_weight))>,
+        ...
+
+        ]>;
+
+As you can see, the edges can be either default or optional, where
+optional edges are differentiated by sporting a ``case`` expression
+used to calculate the edge's weight.
+
+The default edges are assigned a weight of 1, and optional edges get a
+weight of 0 + 2*N where N is the number of tests that evaluated to
+true in the ``case`` expression. It is also possible to provide an
+integer parameter to ``inc_weight`` and ``dec_weight`` - in this case,
+the weight is increased (or decreased) by the provided value instead
+of the default 2.
+
+When passing an input file through the graph, LLVMC picks the edge
+with the maximum weight. To avoid ambiguity, there should be only one
+default edge between two nodes (with the exception of the root node,
+which gets a special treatment - there you are allowed to specify one
+default edge *per language*).
+
+To get a visual representation of the compilation graph (useful for
+debugging), run ``llvmc2 --view-graph``. You will need ``dot`` and
+``gsview`` installed for this to work properly.
+
+
+Writing a tool description
+==========================
+
+As was said earlier, nodes in the compilation graph represent tools,
+which are described separately. A tool definition looks like this
+(taken from the ``Tools.td`` file)::
+
+  def llvm_gcc_cpp : Tool<[
+      (in_language "c++"),
+      (out_language "llvm-assembler"),
+      (output_suffix "bc"),
+      (cmd_line "llvm-g++ -c $INFILE -o $OUTFILE -emit-llvm"),
+      (sink)
+      ]>;
+
+This defines a new tool called ``llvm_gcc_cpp``, which is an alias for
+``llvm-g++``. As you can see, a tool definition is just a list of
+properties; most of them should be self-explanatory. The ``sink``
+property means that this tool should be passed all command-line
+options that lack explicit descriptions.
+
+The complete list of the currently implemented tool properties follows:
+
+* Possible tool properties:
+
+  - ``in_language`` - input language name.
+
+  - ``out_language`` - output language name.
+
+  - ``output_suffix`` - output file suffix.
+
+  - ``cmd_line`` - the actual command used to run the tool. You can
+    use ``$INFILE`` and ``$OUTFILE`` variables, output redirection
+    with ``>``, hook invocations (``$CALL``), environment variables
+    (via ``$ENV``) and the ``case`` construct (more on this below).
+
+  - ``join`` - this tool is a "join node" in the graph, i.e. it gets a
+    list of input files and joins them together. Used for linkers.
+
+  - ``sink`` - all command-line options that are not handled by other
+    tools are passed to this tool.
+
+The next tool definition is slightly more complex::
+
+  def llvm_gcc_linker : Tool<[
+      (in_language "object-code"),
+      (out_language "executable"),
+      (output_suffix "out"),
+      (cmd_line "llvm-gcc $INFILE -o $OUTFILE"),
+      (join),
+      (prefix_list_option "L", (forward),
+                          (help "add a directory to link path")),
+      (prefix_list_option "l", (forward),
+                          (help "search a library when linking")),
+      (prefix_list_option "Wl", (unpack_values),
+                          (help "pass options to linker"))
+      ]>;
+
+This tool has a "join" property, which means that it behaves like a
+linker. This tool also defines several command-line options: ``-l``,
+``-L`` and ``-Wl`` which have their usual meaning. An option has two
+attributes: a name and a (possibly empty) list of properties. All
+currently implemented option types and properties are described below:
+
+* Possible option types:
+
+   - ``switch_option`` - a simple boolean switch, for example ``-time``.
+
+   - ``parameter_option`` - option that takes an argument, for example
+     ``-std=c99``;
+
+   - ``parameter_list_option`` - same as the above, but more than one
+     occurence of the option is allowed.
+
+   - ``prefix_option`` - same as the parameter_option, but the option name
+     and parameter value are not separated.
+
+   - ``prefix_list_option`` - same as the above, but more than one
+     occurence of the option is allowed; example: ``-lm -lpthread``.
+
+   - ``alias_option`` - a special option type for creating
+     aliases. Unlike other option types, aliases are not allowed to
+     have any properties besides the aliased option name. Usage
+     example: ``(alias_option "preprocess", "E")``
+
+
+* Possible option properties:
+
+   - ``append_cmd`` - append a string to the tool invocation command.
+
+   - ``forward`` - forward this option unchanged.
+
+   - ``output_suffix`` - modify the output suffix of this
+     tool. Example : ``(switch "E", (output_suffix "i")``.
+
+   - ``stop_compilation`` - stop compilation after this phase.
+
+   - ``unpack_values`` - used for for splitting and forwarding
+     comma-separated lists of options, e.g. ``-Wa,-foo=bar,-baz`` is
+     converted to ``-foo=bar -baz`` and appended to the tool invocation
+     command.
+
+   - ``help`` - help string associated with this option. Used for
+     ``--help`` output.
+
+   - ``required`` - this option is obligatory.
+
+
+Option list - specifying all options in a single place
+======================================================
+
+It can be handy to have all information about options gathered in a
+single place to provide an overview. This can be achieved by using a
+so-called ``OptionList``::
+
+    def Options : OptionList<[
+    (switch_option "E", (help "Help string")),
+    (alias_option "quiet", "q")
+    ...
+    ]>;
+
+``OptionList`` is also a good place to specify option aliases.
+
+Tool-specific option properties like ``append_cmd`` have (obviously)
+no meaning in the context of ``OptionList``, so the only properties
+allowed there are ``help`` and ``required``.
+
+Option lists are used at the file scope. See file
+``examples/Clang.td`` for an example of ``OptionList`` usage.
+
+Using hooks and environment variables in the ``cmd_line`` property
+==================================================================
+
+Normally, LLVMC executes programs from the system ``PATH``. Sometimes,
+this is not sufficient: for example, we may want to specify tool names
+in the configuration file. This can be achieved via the mechanism of
+hooks - to compile LLVMC with your hooks, just drop a .cpp file into
+``tools/llvmc2`` directory. Hooks should live in the ``hooks``
+namespace and have the signature ``std::string hooks::MyHookName
+(void)``. They can be used from the ``cmd_line`` tool property::
+
+    (cmd_line "$CALL(MyHook)/path/to/file -o $CALL(AnotherHook)")
+
+It is also possible to use environment variables in the same manner::
+
+   (cmd_line "$ENV(VAR1)/path/to/file -o $ENV(VAR2)")
+
+To change the command line string based on user-provided options use
+the ``case`` expression (documented below)::
+
+    (cmd_line
+      (case
+        (switch_on "E"),
+           "llvm-g++ -E -x c $INFILE -o $OUTFILE",
+        (default),
+           "llvm-g++ -c -x c $INFILE -o $OUTFILE -emit-llvm"))
+
+Conditional evaluation: the ``case`` expression
+===============================================
+
+The 'case' construct can be used to calculate weights of the optional
+edges and to choose between several alternative command line strings
+in the ``cmd_line`` tool property. It is designed after the
+similarly-named construct in functional languages and takes the form
+``(case (test_1), statement_1, (test_2), statement_2, ... (test_N),
+statement_N)``. The statements are evaluated only if the corresponding
+tests evaluate to true.
+
+Examples::
+
+    // Increases edge weight by 5 if "-A" is provided on the
+    // command-line, and by 5 more if "-B" is also provided.
+    (case
+        (switch_on "A"), (inc_weight 5),
+        (switch_on "B"), (inc_weight 5))
+
+    // Evaluates to "cmdline1" if option "-A" is provided on the
+    // command line, otherwise to "cmdline2"
+    (case
+        (switch_on "A"), "cmdline1",
+        (switch_on "B"), "cmdline2",
+        (default), "cmdline3")
+
+Note the slight difference in 'case' expression handling in contexts
+of edge weights and command line specification - in the second example
+the value of the ``"B"`` switch is never checked when switch ``"A"`` is
+enabled, and the whole expression always evaluates to ``"cmdline1"`` in
+that case.
+
+Case expressions can also be nested, i.e. the following is legal::
+
+    (case (switch_on "E"), (case (switch_on "o"), ..., (default), ...)
+          (default), ...)
+
+You should, however, try to avoid doing that because it hurts
+readability. It is usually better to split tool descriptions and/or
+use TableGen inheritance instead.
+
+* Possible tests are:
+
+  - ``switch_on`` - Returns true if a given command-line option is
+    provided by the user. Example: ``(switch_on "opt")``. Note that
+    you have to define all possible command-line options separately in
+    the tool descriptions. See the next section for the discussion of
+    different kinds of command-line options.
+
+  - ``parameter_equals`` - Returns true if a command-line parameter equals
+    a given value. Example: ``(parameter_equals "W", "all")``.
+
+  - ``element_in_list`` - Returns true if a command-line parameter list
+    includes a given value. Example: ``(parameter_in_list "l", "pthread")``.
+
+  - ``input_languages_contain`` - Returns true if a given language
+    belongs to the current input language set. Example:
+    ```(input_languages_contain "c++")``.
+
+  - ``in_language`` - Evaluates to true if the language of the input
+    file equals to the argument. Valid only when using ``case``
+    expression in a ``cmd_line`` tool property. 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. Example: ```(not_empty "o")``.
+
+  - ``default`` - Always evaluates to true. Should always be the last
+    test in the ``case`` expression.
+
+  - ``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`` - Another logical combinator that returns true only if any
+    one of its arguments returns true. Example: ``(or (test1),
+    (test2), ... (testN))``.
+
+
+Language map
+============
+
+One last thing that you will need to modify when adding support for a
+new language to LLVMC is the language map, which defines mappings from
+file extensions to language names. It is used to choose the proper
+toolchain(s) for a given input file set. Language map definition is
+located in the file ``Tools.td`` and looks like this::
+
+    def LanguageMap : LanguageMap<
+        [LangToSuffixes<"c++", ["cc", "cp", "cxx", "cpp", "CPP", "c++", "C"]>,
+         LangToSuffixes<"c", ["c"]>,
+         ...
+        ]>;
+
+
+References
+==========
+
+.. [1] TableGen Fundamentals
+       http://llvm.cs.uiuc.edu/docs/TableGenFundamentals.html

Added: llvm/branches/non-call-eh/tools/llvmc2/doc/LLVMC-Tutorial.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/llvmc2/doc/LLVMC-Tutorial.rst?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/tools/llvmc2/doc/LLVMC-Tutorial.rst (added)
+++ llvm/branches/non-call-eh/tools/llvmc2/doc/LLVMC-Tutorial.rst Sun Jul  6 15:45:41 2008
@@ -0,0 +1,92 @@
+======================
+Tutorial - Using LLVMC
+======================
+
+LLVMC is a generic compiler driver, which plays the same role for LLVM
+as the ``gcc`` program does for GCC - the difference being that LLVMC
+is designed to be more adaptable and easier to customize. This
+tutorial describes the basic usage and configuration of LLVMC.
+
+
+.. contents::
+
+
+Compiling with LLVMC
+====================
+
+In general, LLVMC tries to be command-line compatible with ``gcc`` as
+much as possible, so most of the familiar options work::
+
+     $ llvmc2 -O3 -Wall hello.cpp
+     $ ./a.out
+     hello
+
+For further help on command-line LLVMC usage, refer to the ``llvmc
+--help`` output.
+
+Using LLVMC to generate toolchain drivers
+=========================================
+
+At the time of writing LLVMC does not support on-the-fly reloading of
+configuration, so it will be necessary to recompile its source
+code. LLVMC uses TableGen [1]_ as its configuration language, so
+you'll need to familiar with it.
+
+Start by compiling ``examples/Simple.td``, which is a simple wrapper
+for ``gcc``::
+
+    $ cd $LLVM_DIR/tools/llvmc2
+    $ make TOOLNAME=mygcc GRAPH=examples/Simple.td
+    $ edit hello.c
+    $ mygcc hello.c
+    $ ./hello.out
+    Hello
+
+Contents of the file ``Simple.td`` look like this::
+
+    // Include common definitions
+    include "Common.td"
+
+    // Tool descriptions
+    def gcc : Tool<
+    [(in_language "c"),
+     (out_language "executable"),
+     (output_suffix "out"),
+     (cmd_line "gcc $INFILE -o $OUTFILE"),
+     (sink)
+    ]>;
+
+    // Language map
+    def LanguageMap : LanguageMap<[LangToSuffixes<"c", ["c"]>]>;
+
+    // Compilation graph
+    def CompilationGraph : CompilationGraph<[Edge<root, gcc>]>;
+
+As you can see, this file consists of three parts: tool descriptions,
+language map, and the compilation graph definition.
+
+At the heart of LLVMC is the idea of a transformation graph: vertices
+in this graph are tools, and edges signify that there is a
+transformation path between two tools (for example, assembly source
+produced by the compiler can be transformed into executable code by an
+assembler). A special node named ``root`` is used to mark the graph
+entry points.
+
+Tool descriptions are basically lists of properties: most properties
+in the example above should be self-explanatory; the ``sink`` property
+means that all options lacking an explicit description should be
+forwarded to this tool.
+
+``LanguageMap`` associates a language name with a list of suffixes and
+is used for deciding which toolchain corresponds to a given input
+file.
+
+To learn more about LLVMC customization, refer to the reference
+manual and sample configuration files in the ``examples`` directory.
+
+References
+==========
+
+.. [1] TableGen Fundamentals
+       http://llvm.cs.uiuc.edu/docs/TableGenFundamentals.html
+

Added: llvm/branches/non-call-eh/tools/llvmc2/doc/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/llvmc2/doc/Makefile?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/tools/llvmc2/doc/Makefile (added)
+++ llvm/branches/non-call-eh/tools/llvmc2/doc/Makefile Sun Jul  6 15:45:41 2008
@@ -0,0 +1,13 @@
+
+RST2HTML=rst2html
+
+all : LLVMC-Reference.html LLVMC-Tutorial.html
+
+LLVMC-Tutorial.html : LLVMC-Tutorial.rst
+	$(RST2HTML) $< $@
+
+LLVMC-Reference.html : LLVMC-Reference.rst
+	$(RST2HTML) $< $@
+
+clean :
+	rm *.html

Added: llvm/branches/non-call-eh/tools/llvmc2/examples/Clang.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/llvmc2/examples/Clang.td?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/tools/llvmc2/examples/Clang.td (added)
+++ llvm/branches/non-call-eh/tools/llvmc2/examples/Clang.td Sun Jul  6 15:45:41 2008
@@ -0,0 +1,86 @@
+// A (first stab at a) replacement for the Clang's ccc script.
+// To compile, use this command:
+//    make TOOLNAME=ccc GRAPH=examples/Clang.td
+
+include "Common.td"
+
+
+// TOFIX: Add an explicit option list for aliases and things like this.
+def Options : OptionList<[
+(switch_option "E",
+    (help "Stop after the preprocessing stage, do not run the compiler"))
+]>;
+
+class clang_base<string language, dag cmdline> : Tool<
+[(in_language language),
+ (out_language "llvm-bitcode"),
+ (output_suffix "bc"),
+ (cmd_line cmdline),
+ (switch_option "E", (stop_compilation), (output_suffix "i")),
+ (sink)
+]>;
+
+def clang_c : clang_base<"c",
+(case
+(switch_on "E"),
+    (case
+    (not_empty "o"),
+        "clang -E -x c $INFILE -o $OUTFILE",
+    (default),
+        "clang -E -x c $INFILE"),
+(default),
+    "clang -emit-llvm-bc -x c $INFILE -o $OUTFILE")>;
+
+def clang_cpp : clang_base<"c++",
+(case
+(switch_on "E"),
+    (case
+    (not_empty "o"),
+        "clang -E -x c++ $INFILE -o $OUTFILE",
+    (default),
+        "clang -E -x c++ $INFILE"),
+(default),
+    "clang -emit-llvm-bc -x c++ $INFILE -o $OUTFILE")>;
+
+def clang_objective_c : clang_base<"objective-c",
+(case
+(switch_on "E"),
+    (case
+    (not_empty "o"),
+        "clang -E -x objective-c $INFILE -o $OUTFILE",
+    (default),
+        "clang -E -x objective-c $INFILE"),
+(default),
+    "clang -emit-llvm-bc -x objective-c $INFILE -o $OUTFILE")>;
+
+// Default linker
+def llvm_ld : Tool<
+[(in_language "llvm-bitcode"),
+ (out_language "executable"),
+ (output_suffix "out"),
+ (cmd_line "llvm-ld -native -disable-internalize $INFILE -o $OUTFILE"),
+ (prefix_list_option "L", (forward), (help "Specify a library search path")),
+ (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<[
+    Edge<root, clang_c>,
+    Edge<root, clang_cpp>,
+    Edge<root, clang_objective_c>,
+    Edge<clang_c, llvm_ld>,
+    Edge<clang_cpp, llvm_ld>,
+    Edge<clang_objective_c, llvm_ld>
+    ]>;
+

Added: llvm/branches/non-call-eh/tools/llvmc2/examples/Simple.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/llvmc2/examples/Simple.td?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/tools/llvmc2/examples/Simple.td (added)
+++ llvm/branches/non-call-eh/tools/llvmc2/examples/Simple.td Sun Jul  6 15:45:41 2008
@@ -0,0 +1,17 @@
+// A simple wrapper for gcc.
+// To compile, use this command:
+//    make TOOLNAME=llvmc_simple GRAPH=examples/Simple.td
+
+include "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>]>;

Added: llvm/branches/non-call-eh/tools/llvmc2/llvmc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/llvmc2/llvmc.cpp?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/tools/llvmc2/llvmc.cpp (added)
+++ llvm/branches/non-call-eh/tools/llvmc2/llvmc.cpp Sun Jul  6 15:45:41 2008
@@ -0,0 +1,113 @@
+//===--- llvmc.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.
+//
+//===----------------------------------------------------------------------===//
+//
+//  This tool provides a single point of access to the LLVM
+//  compilation tools.  It has many options. To discover the options
+//  supported please refer to the tools' manual page or run the tool
+//  with the --help option.
+//
+//===----------------------------------------------------------------------===//
+
+#include "CompilationGraph.h"
+#include "Error.h"
+#include "Tool.h"
+
+#include "llvm/System/Path.h"
+#include "llvm/Support/CommandLine.h"
+
+#include <iostream>
+#include <stdexcept>
+#include <string>
+
+namespace cl = llvm::cl;
+namespace sys = llvm::sys;
+using namespace llvmc;
+
+// Built-in command-line options.
+// External linkage here is intentional.
+
+cl::list<std::string> InputFilenames(cl::Positional, cl::desc("<input file>"),
+                                     cl::ZeroOrMore);
+cl::opt<std::string> OutputFilename("o", cl::desc("Output file name"),
+                                    cl::value_desc("file"));
+cl::list<std::string> Languages("x",
+          cl::desc("Specify the language of the following input files"),
+          cl::ZeroOrMore);
+cl::opt<bool> DryRun("dry-run",
+                     cl::desc("Only pretend to run commands"));
+cl::opt<bool> VerboseMode("v",
+                          cl::desc("Enable verbose mode"));
+cl::opt<bool> WriteGraph("write-graph",
+                         cl::desc("Write compilation-graph.dot file"),
+                         cl::Hidden);
+cl::opt<bool> ViewGraph("view-graph",
+                         cl::desc("Show compilation graph in GhostView"),
+                         cl::Hidden);
+cl::opt<bool> SaveTemps("save-temps",
+                         cl::desc("Keep temporary files"),
+                         cl::Hidden);
+
+namespace {
+  /// BuildTargets - A small wrapper for CompilationGraph::Build.
+  int BuildTargets(CompilationGraph& graph) {
+    int ret;
+    const sys::Path& tempDir = SaveTemps
+      ? sys::Path("")
+      : sys::Path(sys::Path::GetTemporaryDirectory());
+
+    try {
+      ret = graph.Build(tempDir);
+    }
+    catch(...) {
+      tempDir.eraseFromDisk(true);
+      throw;
+    }
+
+    if (!SaveTemps)
+      tempDir.eraseFromDisk(true);
+    return ret;
+  }
+}
+
+int main(int argc, char** argv) {
+  try {
+    CompilationGraph graph;
+
+    cl::ParseCommandLineOptions
+      (argc, argv, "LLVM Compiler Driver (Work In Progress)", true);
+    PopulateCompilationGraph(graph);
+
+    if (WriteGraph) {
+      graph.writeGraph();
+      if (!ViewGraph)
+        return 0;
+    }
+
+    if (ViewGraph) {
+      graph.viewGraph();
+      return 0;
+    }
+
+    if (InputFilenames.empty()) {
+      throw std::runtime_error("no input files");
+    }
+
+    return BuildTargets(graph);
+  }
+  catch(llvmc::error_code& ec) {
+    return ec.code();
+  }
+  catch(const std::exception& ex) {
+    std::cerr << argv[0] << ": " << ex.what() << '\n';
+  }
+  catch(...) {
+    std::cerr << argv[0] << ": unknown error!\n";
+  }
+  return 1;
+}

Removed: llvm/branches/non-call-eh/tools/llvmc2/llvmcc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/llvmc2/llvmcc.cpp?rev=53162&view=auto

==============================================================================
--- llvm/branches/non-call-eh/tools/llvmc2/llvmcc.cpp (original)
+++ llvm/branches/non-call-eh/tools/llvmc2/llvmcc.cpp (removed)
@@ -1,73 +0,0 @@
-//===--- llvmcc.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.
-//
-//===----------------------------------------------------------------------===//
-//
-//  This tool provides a single point of access to the LLVM
-//  compilation tools.  It has many options. To discover the options
-//  supported please refer to the tools' manual page or run the tool
-//  with the --help option.
-//
-//===----------------------------------------------------------------------===//
-
-#include "Core.h"
-#include "Utility.h"
-#include "Tools.h"
-
-#include "llvm/System/Path.h"
-#include "llvm/Support/CommandLine.h"
-
-#include <iostream>
-#include <stdexcept>
-#include <string>
-
-using namespace llvm;
-using namespace llvmcc;
-
-// These variables are also used in Core.cpp,
-// so they should have external linkage.
-cl::list<std::string> InputFilenames(cl::Positional,
-                                     cl::desc("<input file>"), cl::OneOrMore);
-cl::opt<std::string> OutputFilename("o", cl::desc("Output file name"),
-                                    cl::value_desc("file"));
-cl::opt<bool> VerboseMode("v", cl::desc("Enable verbose mode"));
-
-
-namespace {
-  int BuildTargets(const CompilationGraph& graph) {
-    int ret;
-    sys::Path tempDir(sys::Path::GetTemporaryDirectory());
-
-    try {
-      ret = graph.Build(tempDir);
-    }
-    catch(...) {
-      tempDir.eraseFromDisk(true);
-      throw;
-    }
-
-    tempDir.eraseFromDisk(true);
-    return ret;
-  }
-}
-
-int main(int argc, char** argv) {
-  try {
-    CompilationGraph graph;
-
-    cl::ParseCommandLineOptions(argc, argv,
-                                "LLVM Compiler Driver(Work In Progress)");
-    PopulateCompilationGraph(graph);
-    return BuildTargets(graph);
-  }
-  catch(const std::exception& ex) {
-    std::cerr << ex.what() << '\n';
-  }
-  catch(...) {
-    std::cerr << "Unknown error!\n";
-  }
-}

Propchange: llvm/branches/non-call-eh/tools/lto/

------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sun Jul  6 15:45:41 2008
@@ -0,0 +1,2 @@
+Release
+Debug

Added: llvm/branches/non-call-eh/tools/lto/LTOCodeGenerator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/lto/LTOCodeGenerator.cpp?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/tools/lto/LTOCodeGenerator.cpp (added)
+++ llvm/branches/non-call-eh/tools/lto/LTOCodeGenerator.cpp Sun Jul  6 15:45:41 2008
@@ -0,0 +1,457 @@
+//===-LTOCodeGenerator.cpp - LLVM Link Time Optimizer ---------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// 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 
+// intended to be used by linker to optimize code at link time.
+//
+//===----------------------------------------------------------------------===//
+
+#include "LTOModule.h"
+#include "LTOCodeGenerator.h"
+
+
+#include "llvm/Module.h"
+#include "llvm/PassManager.h"
+#include "llvm/Linker.h"
+#include "llvm/Constants.h"
+#include "llvm/DerivedTypes.h"
+#include "llvm/ModuleProvider.h"
+#include "llvm/Bitcode/ReaderWriter.h"
+#include "llvm/Support/SystemUtils.h"
+#include "llvm/Support/Mangler.h"
+#include "llvm/Support/MemoryBuffer.h"
+#include "llvm/System/Signals.h"
+#include "llvm/Analysis/Passes.h"
+#include "llvm/Analysis/LoopPass.h"
+#include "llvm/Analysis/Verifier.h"
+#include "llvm/Analysis/LoadValueNumbering.h"
+#include "llvm/CodeGen/FileWriters.h"
+#include "llvm/Target/SubtargetFeature.h"
+#include "llvm/Target/TargetOptions.h"
+#include "llvm/Target/TargetData.h"
+#include "llvm/Target/TargetMachine.h"
+#include "llvm/Target/TargetMachineRegistry.h"
+#include "llvm/Target/TargetAsmInfo.h"
+#include "llvm/Transforms/IPO.h"
+#include "llvm/Transforms/Scalar.h"
+#include "llvm/ADT/StringExtras.h"
+#include "llvm/Config/config.h"
+
+
+#include <fstream>
+#include <unistd.h>
+#include <stdlib.h>
+#include <fcntl.h>
+
+
+using namespace llvm;
+
+
+
+const char* LTOCodeGenerator::getVersionString()
+{
+#ifdef LLVM_VERSION_INFO
+    return PACKAGE_NAME " version " PACKAGE_VERSION ", " LLVM_VERSION_INFO;
+#else
+    return PACKAGE_NAME " version " PACKAGE_VERSION;
+#endif
+}
+
+
+LTOCodeGenerator::LTOCodeGenerator() 
+    : _linker("LinkTimeOptimizer", "ld-temp.o"), _target(NULL),
+      _emitDwarfDebugInfo(false), _scopeRestrictionsDone(false),
+      _codeModel(LTO_CODEGEN_PIC_MODEL_DYNAMIC),
+      _nativeObjectFile(NULL)
+{
+
+}
+
+LTOCodeGenerator::~LTOCodeGenerator()
+{
+    delete _target;
+    delete _nativeObjectFile;
+}
+
+
+
+bool LTOCodeGenerator::addModule(LTOModule* mod, std::string& errMsg)
+{
+    return _linker.LinkInModule(mod->getLLVVMModule(), &errMsg);
+}
+    
+
+bool LTOCodeGenerator::setDebugInfo(lto_debug_model debug, std::string& errMsg)
+{
+    switch (debug) {
+        case LTO_DEBUG_MODEL_NONE:
+            _emitDwarfDebugInfo = false;
+            return false;
+            
+        case LTO_DEBUG_MODEL_DWARF:
+            _emitDwarfDebugInfo = true;
+            return false;
+    }
+    errMsg = "unknown debug format";
+    return true;
+}
+
+
+bool LTOCodeGenerator::setCodePICModel(lto_codegen_model model, 
+                                                        std::string& errMsg)
+{
+    switch (model) {
+        case LTO_CODEGEN_PIC_MODEL_STATIC:
+        case LTO_CODEGEN_PIC_MODEL_DYNAMIC:
+        case LTO_CODEGEN_PIC_MODEL_DYNAMIC_NO_PIC:
+            _codeModel = model;
+            return false;
+    }
+    errMsg = "unknown pic model";
+    return true;
+}
+
+void LTOCodeGenerator::addMustPreserveSymbol(const char* sym)
+{
+    _mustPreserveSymbols[sym] = 1;
+}
+
+
+bool LTOCodeGenerator::writeMergedModules(const char* path, std::string& errMsg)
+{
+    if ( this->determineTarget(errMsg) ) 
+        return true;
+
+    // mark which symbols can not be internalized 
+    this->applyScopeRestrictions();
+
+    // create output file
+    std::ofstream out(path, std::ios_base::out|std::ios::trunc|std::ios::binary);
+    if ( out.fail() ) {
+        errMsg = "could not open bitcode file for writing: ";
+        errMsg += path;
+        return true;
+    }
+    
+    // write bitcode to it
+    WriteBitcodeToFile(_linker.getModule(), out);
+    if ( out.fail() ) {
+        errMsg = "could not write bitcode file: ";
+        errMsg += path;
+        return true;
+    }
+    
+    return false;
+}
+
+
+const void* LTOCodeGenerator::compile(size_t* length, std::string& errMsg)
+{
+    // make unique temp .s file to put generated assembly code
+    sys::Path uniqueAsmPath("lto-llvm.s");
+    if ( uniqueAsmPath.createTemporaryFileOnDisk(true, &errMsg) )
+        return NULL;
+    sys::RemoveFileOnSignal(uniqueAsmPath);
+       
+    // generate assembly code
+    std::ofstream asmFile(uniqueAsmPath.c_str());
+    bool genResult = this->generateAssemblyCode(asmFile, errMsg);
+    asmFile.close();
+    if ( genResult ) {
+        if ( uniqueAsmPath.exists() )
+            uniqueAsmPath.eraseFromDisk();
+        return NULL;
+    }
+    
+    // make unique temp .o file to put generated object file
+    sys::PathWithStatus uniqueObjPath("lto-llvm.o");
+    if ( uniqueObjPath.createTemporaryFileOnDisk(true, &errMsg) ) {
+        if ( uniqueAsmPath.exists() )
+            uniqueAsmPath.eraseFromDisk();
+        return NULL;
+    }
+    sys::RemoveFileOnSignal(uniqueObjPath);
+
+    // assemble the assembly code
+    const std::string& uniqueObjStr = uniqueObjPath.toString();
+    bool asmResult = this->assemble(uniqueAsmPath.toString(), 
+                                                        uniqueObjStr, errMsg);
+    if ( !asmResult ) {
+        // remove old buffer if compile() called twice
+        delete _nativeObjectFile;
+        
+        // read .o file into memory buffer
+        _nativeObjectFile = MemoryBuffer::getFile(uniqueObjStr.c_str(),&errMsg);
+    }
+
+    // remove temp files
+    uniqueAsmPath.eraseFromDisk();
+    uniqueObjPath.eraseFromDisk();
+
+    // return buffer, unless error
+    if ( _nativeObjectFile == NULL )
+        return NULL;
+    *length = _nativeObjectFile->getBufferSize();
+    return _nativeObjectFile->getBufferStart();
+}
+
+
+bool LTOCodeGenerator::assemble(const std::string& asmPath, 
+                                const std::string& objPath, std::string& errMsg)
+{
+    // find compiler driver
+    const sys::Path gcc = sys::Program::FindProgramByName("gcc");
+    if ( gcc.isEmpty() ) {
+        errMsg = "can't locate gcc";
+        return true;
+    }
+
+    // build argument list
+    std::vector<const char*> args;
+    std::string targetTriple = _linker.getModule()->getTargetTriple();
+    args.push_back(gcc.c_str());
+    if ( targetTriple.find("darwin") != targetTriple.size() ) {
+        if (strncmp(targetTriple.c_str(), "i686-apple-", 11) == 0) {
+            args.push_back("-arch");
+            args.push_back("i386");
+        }
+        else if (strncmp(targetTriple.c_str(), "x86_64-apple-", 13) == 0) {
+            args.push_back("-arch");
+            args.push_back("x86_64");
+        }
+        else if (strncmp(targetTriple.c_str(), "powerpc-apple-", 14) == 0) {
+            args.push_back("-arch");
+            args.push_back("ppc");
+        }
+        else if (strncmp(targetTriple.c_str(), "powerpc64-apple-", 16) == 0) {
+            args.push_back("-arch");
+            args.push_back("ppc64");
+        }
+    }
+    args.push_back("-c");
+    args.push_back("-x");
+    args.push_back("assembler");
+    args.push_back("-o");
+    args.push_back(objPath.c_str());
+    args.push_back(asmPath.c_str());
+    args.push_back(0);
+
+    // invoke assembler
+    if ( sys::Program::ExecuteAndWait(gcc, &args[0], 0, 0, 0, 0, &errMsg) ) {
+        errMsg = "error in assembly";    
+        return true;
+    }
+    return false; // success
+}
+
+
+
+bool LTOCodeGenerator::determineTarget(std::string& errMsg)
+{
+    if ( _target == NULL ) {
+        // create target machine from info for merged modules
+        Module* mergedModule = _linker.getModule();
+        const TargetMachineRegistry::entry* march = 
+          TargetMachineRegistry::getClosestStaticTargetForModule(
+                                                       *mergedModule, errMsg);
+        if ( march == NULL )
+            return true;
+
+        // construct LTModule, hand over ownership of module and target
+        std::string FeatureStr =
+          getFeatureString(_linker.getModule()->getTargetTriple().c_str());
+        _target = march->CtorFn(*mergedModule, FeatureStr.c_str());
+    }
+    return false;
+}
+
+void LTOCodeGenerator::applyScopeRestrictions()
+{
+    if ( !_scopeRestrictionsDone ) {
+        Module* mergedModule = _linker.getModule();
+
+        // Start off with a verification pass.
+        PassManager passes;
+        passes.add(createVerifierPass());
+
+        // mark which symbols can not be internalized 
+        if ( !_mustPreserveSymbols.empty() ) {
+            Mangler mangler(*mergedModule, 
+                                _target->getTargetAsmInfo()->getGlobalPrefix());
+            std::vector<const char*> mustPreserveList;
+            for (Module::iterator f = mergedModule->begin(), 
+                                        e = mergedModule->end(); f != e; ++f) {
+                if ( !f->isDeclaration() 
+                  && _mustPreserveSymbols.count(mangler.getValueName(f)) )
+                    mustPreserveList.push_back(::strdup(f->getName().c_str()));
+            }
+            for (Module::global_iterator v = mergedModule->global_begin(), 
+                                 e = mergedModule->global_end(); v !=  e; ++v) {
+                if ( !v->isDeclaration()
+                  && _mustPreserveSymbols.count(mangler.getValueName(v)) )
+                    mustPreserveList.push_back(::strdup(v->getName().c_str()));
+            }
+            passes.add(createInternalizePass(mustPreserveList));
+        }
+        // apply scope restrictions
+        passes.run(*mergedModule);
+        
+        _scopeRestrictionsDone = true;
+    }
+}
+
+/// Optimize merged modules using various IPO passes
+bool LTOCodeGenerator::generateAssemblyCode(std::ostream& out, std::string& errMsg)
+{
+    if (  this->determineTarget(errMsg) ) 
+        return true;
+
+    // mark which symbols can not be internalized 
+    this->applyScopeRestrictions();
+
+    Module* mergedModule = _linker.getModule();
+
+     // If target supports exception handling then enable it now.
+    if ( _target->getTargetAsmInfo()->doesSupportExceptionHandling() )
+        llvm::ExceptionHandling = true;
+
+    // set codegen model
+    switch( _codeModel ) {
+        case LTO_CODEGEN_PIC_MODEL_STATIC:
+            _target->setRelocationModel(Reloc::Static);
+            break;
+        case LTO_CODEGEN_PIC_MODEL_DYNAMIC:
+            _target->setRelocationModel(Reloc::PIC_);
+            break;
+        case LTO_CODEGEN_PIC_MODEL_DYNAMIC_NO_PIC:
+            _target->setRelocationModel(Reloc::DynamicNoPIC);
+            break;
+    }
+
+    for (unsigned opt_index = 0, opt_size = _codegenOptions.size();
+         opt_index < opt_size; ++opt_index) {
+      std::vector<const char *> cgOpts;
+      std::string &optString = _codegenOptions[opt_index];
+      for (std::string Opt = getToken(optString);
+           !Opt.empty(); Opt = getToken(optString))
+        cgOpts.push_back(Opt.c_str());
+     
+      int pseudo_argc = cgOpts.size()-1;
+      cl::ParseCommandLineOptions(pseudo_argc, (char**)&cgOpts[0]);
+     }
+
+    // Instantiate the pass manager to organize the passes.
+    PassManager passes;
+
+    // Start off with a verification pass.
+    passes.add(createVerifierPass());
+
+    // Add an appropriate TargetData instance for this module...
+    passes.add(new TargetData(*_target->getTargetData()));
+    
+    // Propagate constants at call sites into the functions they call.  This
+    // opens opportunities for globalopt (and inlining) by substituting function
+    // pointers passed as arguments to direct uses of functions.  
+    passes.add(createIPSCCPPass());
+
+    // Now that we internalized some globals, see if we can hack on them!
+    passes.add(createGlobalOptimizerPass());
+
+    // Linking modules together can lead to duplicated global constants, only
+    // keep one copy of each constant...
+    passes.add(createConstantMergePass());
+
+    // Remove unused arguments from functions...
+    passes.add(createDeadArgEliminationPass());
+
+    // Reduce the code after globalopt and ipsccp.  Both can open up significant
+    // simplification opportunities, and both can propagate functions through
+    // function pointers.  When this happens, we often have to resolve varargs
+    // calls, etc, so let instcombine do this.
+    passes.add(createInstructionCombiningPass());
+    passes.add(createFunctionInliningPass());     // Inline small functions
+    passes.add(createPruneEHPass());              // Remove dead EH info
+    passes.add(createGlobalDCEPass());            // Remove dead functions
+
+    // If we didn't decide to inline a function, check to see if we can
+    // transform it to pass arguments by value instead of by reference.
+    passes.add(createArgumentPromotionPass());
+
+    // The IPO passes may leave cruft around.  Clean up after them.
+    passes.add(createInstructionCombiningPass());
+    passes.add(createJumpThreadingPass());        // Thread jumps.
+    passes.add(createScalarReplAggregatesPass()); // Break up allocas
+
+    // Run a few AA driven optimizations here and now, to cleanup the code.
+    passes.add(createGlobalsModRefPass());        // IP alias analysis
+    passes.add(createLICMPass());                 // Hoist loop invariants
+    passes.add(createGVNPass());                  // Remove common subexprs
+    passes.add(createMemCpyOptPass());            // Remove dead memcpy's
+    passes.add(createDeadStoreEliminationPass()); // Nuke dead stores
+
+    // Cleanup and simplify the code after the scalar optimizations.
+    passes.add(createInstructionCombiningPass());
+    passes.add(createJumpThreadingPass());        // Thread jumps.
+    passes.add(createPromoteMemoryToRegisterPass()); // Cleanup after threading.
+
+
+    // Delete basic blocks, which optimization passes may have killed...
+    passes.add(createCFGSimplificationPass());
+
+    // Now that we have optimized the program, discard unreachable functions...
+    passes.add(createGlobalDCEPass());
+
+    // Make sure everything is still good.
+    passes.add(createVerifierPass());
+
+    FunctionPassManager* codeGenPasses =
+            new FunctionPassManager(new ExistingModuleProvider(mergedModule));
+
+    codeGenPasses->add(new TargetData(*_target->getTargetData()));
+
+    MachineCodeEmitter* mce = NULL;
+
+    switch (_target->addPassesToEmitFile(*codeGenPasses, out,
+                                      TargetMachine::AssemblyFile, true)) {
+        case FileModel::MachOFile:
+            mce = AddMachOWriter(*codeGenPasses, out, *_target);
+            break;
+        case FileModel::ElfFile:
+            mce = AddELFWriter(*codeGenPasses, out, *_target);
+            break;
+        case FileModel::AsmFile:
+            break;
+        case FileModel::Error:
+        case FileModel::None:
+            errMsg = "target file type not supported";
+            return true;
+    }
+
+    if (_target->addPassesToEmitFileFinish(*codeGenPasses, mce, true)) {
+        errMsg = "target does not support generation of this file type";
+        return true;
+    }
+
+    // Run our queue of passes all at once now, efficiently.
+    passes.run(*mergedModule);
+
+    // Run the code generator, and write assembly file
+    codeGenPasses->doInitialization();
+
+    for (Module::iterator
+           it = mergedModule->begin(), e = mergedModule->end(); it != e; ++it)
+      if (!it->isDeclaration())
+        codeGenPasses->run(*it);
+
+    codeGenPasses->doFinalization();
+    return false; // success
+}
+
+
+

Added: llvm/branches/non-call-eh/tools/lto/LTOCodeGenerator.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/lto/LTOCodeGenerator.h?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/tools/lto/LTOCodeGenerator.h (added)
+++ llvm/branches/non-call-eh/tools/lto/LTOCodeGenerator.h Sun Jul  6 15:45:41 2008
@@ -0,0 +1,66 @@
+//===-LTOCodeGenerator.h - LLVM Link Time Optimizer -----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+// 
+//===----------------------------------------------------------------------===//
+//
+// This file declares the LTOCodeGenerator class. 
+//
+//===----------------------------------------------------------------------===//
+
+
+#ifndef LTO_CODE_GENERATOR_H
+#define LTO_CODE_GENERATOR_H
+
+#include "llvm/Linker.h"
+#include "llvm/ADT/StringMap.h"
+#include "llvm/ADT/SmallVector.h"
+
+#include <string>
+
+
+//
+// C++ class which implements the opaque lto_code_gen_t
+//
+class LTOCodeGenerator {
+public:
+    static const char*        getVersionString();
+    
+                            LTOCodeGenerator();
+                            ~LTOCodeGenerator();
+                            
+    bool                addModule(class LTOModule*, std::string& errMsg);
+    bool                setDebugInfo(lto_debug_model, std::string& errMsg);
+    bool                setCodePICModel(lto_codegen_model, std::string& errMsg);
+    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) {
+                          _codegenOptions.push_back(std::string(opts)); 
+                        }
+private:
+    bool                generateAssemblyCode(std::ostream& out, 
+                                                        std::string& errMsg);
+    bool                assemble(const std::string& asmPath, 
+                            const std::string& objPath, std::string& errMsg);
+    void                applyScopeRestrictions();
+    bool                determineTarget(std::string& errMsg);
+    
+    typedef llvm::StringMap<uint8_t> StringSet;
+
+    llvm::Linker                _linker;
+    llvm::TargetMachine*        _target;
+    bool                        _emitDwarfDebugInfo;
+    bool                        _scopeRestrictionsDone;
+    lto_codegen_model           _codeModel;
+    StringSet                   _mustPreserveSymbols;
+    llvm::MemoryBuffer*         _nativeObjectFile;
+    llvm::SmallVector<std::string, 4> _codegenOptions;
+};
+
+#endif // LTO_CODE_GENERATOR_H
+

Added: llvm/branches/non-call-eh/tools/lto/LTOModule.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/lto/LTOModule.cpp?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/tools/lto/LTOModule.cpp (added)
+++ llvm/branches/non-call-eh/tools/lto/LTOModule.cpp Sun Jul  6 15:45:41 2008
@@ -0,0 +1,340 @@
+//===-LTOModule.cpp - LLVM Link Time Optimizer ----------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// 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 
+// intended to be used by linker to optimize code at link time.
+//
+//===----------------------------------------------------------------------===//
+
+#include "LTOModule.h"
+
+#include "llvm/Module.h"
+#include "llvm/ModuleProvider.h"
+#include "llvm/ADT/OwningPtr.h"
+#include "llvm/Bitcode/ReaderWriter.h"
+#include "llvm/Support/SystemUtils.h"
+#include "llvm/Support/Mangler.h"
+#include "llvm/Support/MemoryBuffer.h"
+#include "llvm/Support/MathExtras.h"
+#include "llvm/System/Path.h"
+#include "llvm/System/Process.h"
+#include "llvm/Target/SubtargetFeature.h"
+#include "llvm/Target/TargetMachine.h"
+#include "llvm/Target/TargetMachineRegistry.h"
+#include "llvm/Target/TargetAsmInfo.h"
+
+#include <fstream>
+
+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 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 == 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<ModuleProvider> mp(getBitcodeModuleProvider(buffer));
+    // on success, mp owns buffer and both are deleted at end of this method
+    if ( !mp ) {
+        delete buffer;
+        return false;
+    }
+    std::string actualTarget = mp->getModule()->getTargetTriple();
+    return ( strncmp(actualTarget.c_str(), triplePrefix, 
+                    strlen(triplePrefix)) == 0);
+}
+
+
+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);
+}
+
+/// 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(startPtr, endPtr);
+    else
+        return MemoryBuffer::getMemBuffer(startPtr, endPtr);
+}
+
+
+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);
+}
+
+/// getFeatureString - Return a string listing the features associated with the
+/// target triple.
+///
+/// FIXME: This is an inelegant way of specifying the features of a
+/// subtarget. It would be better if we could encode this information into the
+/// IR. See <rdar://5972456>.
+std::string getFeatureString(const char *TargetTriple) {
+  SubtargetFeatures Features;
+
+  if (strncmp(TargetTriple, "powerpc-apple-", 14) == 0) {
+    Features.AddFeature("altivec", true);
+  } else if (strncmp(TargetTriple, "powerpc64-apple-", 16) == 0) {
+    Features.AddFeature("64bit", true);
+    Features.AddFeature("altivec", true);
+  }
+
+  return Features.getString();
+}
+
+LTOModule* LTOModule::makeLTOModule(MemoryBuffer* buffer, std::string& errMsg)
+{
+    // parse bitcode buffer
+    OwningPtr<Module> m(ParseBitcodeFile(buffer, &errMsg));
+    if ( !m )
+        return NULL;
+    // find machine architecture for this module
+    const TargetMachineRegistry::entry* march = 
+            TargetMachineRegistry::getClosestStaticTargetForModule(*m, errMsg);
+
+    if ( march == NULL ) 
+        return NULL;
+
+    // construct LTModule, hand over ownership of module and target
+    std::string FeatureStr = getFeatureString(m->getTargetTriple().c_str());
+    TargetMachine* target = march->CtorFn(*m, FeatureStr);
+    return new LTOModule(m.take(), target);
+}
+
+
+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::addDefinedDataSymbol(GlobalValue* v, Mangler &mangler)
+{    
+    // add to list of defined symbols
+    addDefinedSymbol(v, mangler, false); 
+
+    // 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)
+{    
+    // string is owned by _defines
+    const char* symbolName = ::strdup(mangler.getValueName(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 != NULL) && 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->hasExternalLinkage() || def->hasWeakLinkage() )
+        attr |= LTO_SYMBOL_SCOPE_DEFAULT;
+    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::addPotentialUndefinedSymbol(GlobalValue* decl, Mangler &mangler)
+{   
+   const char* name = mangler.getValueName(decl).c_str();
+    // ignore all llvm.* symbols
+    if ( strncmp(name, "llvm.", 5) != 0 ) {
+        _undefines[name] = 1;
+    }
+}
+
+
+
+// Find exeternal 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.
+        Mangler mangler(*_module, _target->getTargetAsmInfo()->getGlobalPrefix());
+
+        // 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);
+        }
+
+        // make symbols for all undefines
+        for (StringSet::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->getKeyData(), it->getKeyData()+
+                                                  it->getKeyLength()) == 0 ) {
+                NameAndAttributes info;
+                info.name = it->getKeyData();
+                info.attributes = LTO_SYMBOL_DEFINITION_UNDEFINED;
+                _symbols.push_back(info);
+            }
+        }
+    }    
+}
+
+
+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);
+}
+
+const char* LTOModule::getSymbolName(uint32_t index)
+{
+    lazyParseSymbols();
+    if ( index < _symbols.size() )
+        return _symbols[index].name;
+    else
+        return NULL;
+}
+

Added: llvm/branches/non-call-eh/tools/lto/LTOModule.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/lto/LTOModule.h?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/tools/lto/LTOModule.h (added)
+++ llvm/branches/non-call-eh/tools/lto/LTOModule.h Sun Jul  6 15:45:41 2008
@@ -0,0 +1,105 @@
+//===-LTOModule.h - LLVM Link Time Optimizer ------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+// 
+//===----------------------------------------------------------------------===//
+//
+// This file declares the LTOModule class. 
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LTO_MODULE_H
+#define LTO_MODULE_H
+
+#include "llvm/Module.h"
+#include "llvm/ADT/OwningPtr.h"
+#include "llvm/Target/TargetMachine.h"
+#include "llvm/ADT/StringMap.h"
+
+#include "llvm-c/lto.h"
+
+#include <vector>
+#include <string>
+
+
+// forward references to llvm classes
+namespace llvm {
+    class Mangler;
+    class MemoryBuffer;
+    class GlobalValue;
+    class Value;
+    class Function;
+}
+
+
+//
+// C++ class which implements the opaque lto_module_t
+//
+class LTOModule {
+public:
+
+    static bool              isBitcodeFile(const void* mem, size_t length);
+    static bool              isBitcodeFile(const char* path);
+
+    static bool              isBitcodeFileForTarget(const void* mem, 
+                                    size_t length, const char* triplePrefix);
+
+    static bool              isBitcodeFileForTarget(const char* path, 
+                                                    const char* triplePrefix);
+
+    static LTOModule*        makeLTOModule(const char* path, std::string& errMsg);
+    static LTOModule*        makeLTOModule(const void* mem, size_t length,
+                                                            std::string& errMsg);
+
+    const char*              getTargetTriple();
+    uint32_t                 getSymbolCount();
+    lto_symbol_attributes    getSymbolAttributes(uint32_t index);
+    const char*              getSymbolName(uint32_t index);
+    
+    llvm::Module *           getLLVVMModule() { return _module.get(); }
+
+private:
+                            LTOModule(llvm::Module* m, llvm::TargetMachine* t);
+
+    void                    lazyParseSymbols();
+    void                    addDefinedSymbol(llvm::GlobalValue* def, 
+                                                    llvm::Mangler& mangler, 
+                                                    bool isFunction);
+    void                    addPotentialUndefinedSymbol(llvm::GlobalValue* decl, 
+                                                        llvm::Mangler &mangler);
+    void                    findExternalRefs(llvm::Value* value, 
+                                                llvm::Mangler& mangler);
+    void                    addDefinedFunctionSymbol(llvm::Function* f, 
+                                                        llvm::Mangler &mangler);
+    void                    addDefinedDataSymbol(llvm::GlobalValue* v, 
+                                                        llvm::Mangler &mangler);
+    static bool             isTargetMatch(llvm::MemoryBuffer* memBuffer, 
+                                                    const char* triplePrefix);
+    
+    static LTOModule*       makeLTOModule(llvm::MemoryBuffer* buffer, 
+                                                        std::string& errMsg);
+	static llvm::MemoryBuffer* makeBuffer(const void* mem, size_t length);
+                                                        
+    typedef llvm::StringMap<uint8_t> StringSet;
+    
+    struct NameAndAttributes { 
+        const char*            name; 
+        lto_symbol_attributes  attributes; 
+    };
+
+    llvm::OwningPtr<llvm::Module>           _module;
+    llvm::OwningPtr<llvm::TargetMachine>    _target;
+    bool                                    _symbolsParsed;
+    std::vector<NameAndAttributes>          _symbols;
+    // _defines and _undefines only needed to disambiguate tentative definitions
+    StringSet                               _defines;    
+    StringSet                               _undefines; 
+};
+
+extern std::string getFeatureString(const char *TargetTriple);
+
+#endif // LTO_MODULE_H
+

Added: llvm/branches/non-call-eh/tools/lto/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/lto/Makefile?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/tools/lto/Makefile (added)
+++ llvm/branches/non-call-eh/tools/lto/Makefile Sun Jul  6 15:45:41 2008
@@ -0,0 +1,53 @@
+##===- tools/lto2/Makefile ---------------------------------*- Makefile -*-===##
+# 
+#                     The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+# 
+##===----------------------------------------------------------------------===##
+
+LEVEL = ../..
+LIBRARYNAME = LTO
+
+# Include this here so we can get the configuration of the targets
+# that have been configured for construction. We have to do this 
+# early so we can set up LINK_COMPONENTS before includeing Makefile.rules
+include $(LEVEL)/Makefile.config
+
+LINK_LIBS_IN_SHARED = 1
+ifeq ($(OS),Darwin)
+  SHARED_LIBRARY = 1
+  BUILD_ARCHIVE = 0
+  DONT_BUILD_RELINKED = 1
+else
+  BUILD_ARCHIVE = 1
+endif
+
+LINK_COMPONENTS := $(TARGETS_TO_BUILD) ipo scalaropts linker bitreader bitwriter
+
+include $(LEVEL)/Makefile.common
+
+ifeq ($(OS),Darwin)
+    # set dylib internal version number to llvmCore submission number
+    ifdef LLVM_SUBMIT_VERSION
+        LLVMLibsOptions := $(LLVMLibsOptions) -Wl,-current_version \
+                        -Wl,$(LLVM_SUBMIT_VERSION).$(LLVM_SUBMIT_SUBVERSION) \
+                        -Wl,-compatibility_version -Wl,1
+    endif
+    # extra options to override libtool defaults 
+    LLVMLibsOptions    := $(LLVMLibsOptions)  \
+                         -no-undefined  -avoid-version \
+                         -Wl,-exported_symbols_list -Wl,$(PROJ_SRC_DIR)/lto.exports \
+                         -Wl,-dead_strip \
+                         -Wl,-seg1addr -Wl,0xE0000000 
+
+    # Mac OS X 10.4 and earlier tools do not allow a second -install_name on command line
+    DARWIN_VERS := $(shell echo $(TARGET_TRIPLE) | sed 's/.*darwin\([0-9]*\).*/\1/')
+    ifneq ($(DARWIN_VERS),8)
+       LLVMLibsOptions    := $(LLVMLibsOptions)  \
+                            -Wl,-install_name \
+                            -Wl,"@executable_path/../lib/lib$(LIBRARYNAME)$(SHLIBEXT)"
+    endif
+      
+endif

Added: llvm/branches/non-call-eh/tools/lto/lto.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/lto/lto.cpp?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/tools/lto/lto.cpp (added)
+++ llvm/branches/non-call-eh/tools/lto/lto.cpp Sun Jul  6 15:45:41 2008
@@ -0,0 +1,247 @@
+//===-lto.cpp - LLVM Link Time Optimizer ----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// 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 
+// intended to be used by linker to optimize code at link time.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm-c/lto.h"
+
+#include "LTOModule.h"
+#include "LTOCodeGenerator.h"
+
+
+// holds most recent error string
+// *** not thread safe ***
+static std::string sLastErrorString;
+
+
+
+//
+// returns a printable string
+//
+extern const char* lto_get_version()
+{
+    return LTOCodeGenerator::getVersionString();
+}
+
+//
+// returns the last error string or NULL if last operation was successful
+//
+const char* lto_get_error_message()
+{
+    return sLastErrorString.c_str();
+}
+
+
+
+//
+// validates if a file is a loadable object file
+//
+bool lto_module_is_object_file(const char* path)
+{
+    return LTOModule::isBitcodeFile(path);
+}
+
+
+//
+// validates if a file is a loadable object file compilable for requested target
+//
+bool lto_module_is_object_file_for_target(const char* path, 
+                                            const char* target_triplet_prefix)
+{
+    return LTOModule::isBitcodeFileForTarget(path, target_triplet_prefix);
+}
+
+
+//
+// validates if a buffer is a loadable object file
+//
+bool lto_module_is_object_file_in_memory(const void* mem, size_t length)
+{
+    return LTOModule::isBitcodeFile(mem, length);
+}
+
+
+//
+// validates if a buffer is a loadable object file compilable for the target
+//
+bool lto_module_is_object_file_in_memory_for_target(const void* mem, 
+                            size_t length, const char* target_triplet_prefix)
+{
+    return LTOModule::isBitcodeFileForTarget(mem, length, target_triplet_prefix);
+}
+
+
+
+//
+// loads an object file from disk  
+// returns NULL on error (check lto_get_error_message() for details)
+//
+lto_module_t lto_module_create(const char* path)
+{
+     return LTOModule::makeLTOModule(path, sLastErrorString);
+}
+
+
+//
+// loads an object file from memory 
+// returns NULL on error (check lto_get_error_message() for details)
+//
+lto_module_t lto_module_create_from_memory(const void* mem, size_t length)
+{
+     return LTOModule::makeLTOModule(mem, length, sLastErrorString);
+}
+
+
+//
+// frees all memory for a module
+// upon return the lto_module_t is no longer valid
+//
+void lto_module_dispose(lto_module_t mod)
+{
+    delete mod;
+}
+
+
+//
+// returns triplet string which the object module was compiled under
+//
+const char* lto_module_get_target_triple(lto_module_t mod)
+{
+    return mod->getTargetTriple();
+}
+
+
+//
+// returns the number of symbols in the object module
+//
+uint32_t lto_module_get_num_symbols(lto_module_t mod)
+{
+    return mod->getSymbolCount();
+}
+
+//
+// returns the name of the ith symbol in the object module
+//
+const char* lto_module_get_symbol_name(lto_module_t mod, uint32_t index)
+{
+    return mod->getSymbolName(index);
+}
+
+
+//
+// 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)
+{
+    return mod->getSymbolAttributes(index);
+}
+
+
+
+
+
+//
+// instantiates a code generator
+// returns NULL if there is an error
+//
+lto_code_gen_t lto_codegen_create()
+{
+     return new LTOCodeGenerator();
+}
+
+
+
+//
+// frees all memory for a code generator
+// upon return the lto_code_gen_t is no longer valid
+//
+void lto_codegen_dispose(lto_code_gen_t cg)
+{
+    delete cg;
+}
+
+
+
+//
+// add an object module to the set of modules for which code will be generated
+// returns true on error (check lto_get_error_message() for details)
+//
+bool lto_codegen_add_module(lto_code_gen_t cg, lto_module_t mod)
+{
+    return cg->addModule(mod, sLastErrorString);
+}
+
+
+//
+// sets what if any format of debug info should be generated
+// returns true on error (check lto_get_error_message() for details)
+//
+bool lto_codegen_set_debug_model(lto_code_gen_t cg, lto_debug_model debug)
+{
+    return cg->setDebugInfo(debug, sLastErrorString);
+}
+
+
+//
+// sets what code model to generated
+// returns true on error (check lto_get_error_message() for details)
+//
+bool lto_codegen_set_pic_model(lto_code_gen_t cg, lto_codegen_model model)
+{
+    return cg->setCodePICModel(model, sLastErrorString);
+}
+
+//
+// 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
+// inlined into every usage and optimized away.
+//
+void lto_codegen_add_must_preserve_symbol(lto_code_gen_t cg, const char* symbol)
+{
+    cg->addMustPreserveSymbol(symbol);
+}
+
+
+//
+// writes a new file at the specified path that contains the
+// merged contents of all modules added so far.
+// returns true on error (check lto_get_error_message() for details)
+//
+bool lto_codegen_write_merged_modules(lto_code_gen_t cg, const char* path)
+{
+   return cg->writeMergedModules(path, sLastErrorString);
+}
+
+
+//
+// Generates code for all added modules into one native object file.
+// On sucess returns a pointer to a generated mach-o/ELF buffer and
+// length set to the buffer size.  The buffer is owned by the 
+// lto_code_gen_t and will be freed when lto_codegen_dispose()
+// is called, or lto_codegen_compile() is called again.
+// On failure, returns NULL (check lto_get_error_message() for details).
+//
+extern const void*
+lto_codegen_compile(lto_code_gen_t cg, size_t* length)
+{
+    return cg->compile(length, sLastErrorString);
+}
+
+extern void
+lto_codegen_debug_options(lto_code_gen_t cg, const char * opt)
+{
+  cg->setCodeGenDebugOptions(opt);
+}
+
+
+

Added: llvm/branches/non-call-eh/tools/lto/lto.exports
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/lto/lto.exports?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/tools/lto/lto.exports (added)
+++ llvm/branches/non-call-eh/tools/lto/lto.exports Sun Jul  6 15:45:41 2008
@@ -0,0 +1,22 @@
+_lto_get_error_message
+_lto_get_version
+_lto_module_create
+_lto_module_create_from_memory
+_lto_module_get_num_symbols
+_lto_module_get_symbol_attribute
+_lto_module_get_symbol_name
+_lto_module_get_target_triple
+_lto_module_is_object_file
+_lto_module_is_object_file_for_target
+_lto_module_is_object_file_in_memory
+_lto_module_is_object_file_in_memory_for_target
+_lto_module_dispose
+_lto_codegen_add_module
+_lto_codegen_add_must_preserve_symbol
+_lto_codegen_compile
+_lto_codegen_create
+_lto_codegen_dispose
+_lto_codegen_set_debug_model
+_lto_codegen_set_pic_model
+_lto_codegen_write_merged_modules
+

Modified: llvm/branches/non-call-eh/tools/opt/GraphPrinters.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/opt/GraphPrinters.cpp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/tools/opt/GraphPrinters.cpp (original)
+++ llvm/branches/non-call-eh/tools/opt/GraphPrinters.cpp Sun Jul  6 15:45:41 2008
@@ -18,6 +18,7 @@
 #include "llvm/Pass.h"
 #include "llvm/Value.h"
 #include "llvm/Analysis/CallGraph.h"
+#include "llvm/Analysis/Dominators.h"
 #include <iostream>
 #include <fstream>
 using namespace llvm;
@@ -81,3 +82,34 @@
   RegisterPass<CallGraphPrinter> P2("print-callgraph",
                                     "Print Call Graph to 'dot' file");
 }
+
+//===----------------------------------------------------------------------===//
+//                            DomInfoPrinter Pass
+//===----------------------------------------------------------------------===//
+
+namespace {
+  class DomInfoPrinter : public FunctionPass {
+  public:
+    static char ID; // Pass identification, replacement for typeid
+    DomInfoPrinter() : FunctionPass((intptr_t)&ID) {}
+
+    virtual void getAnalysisUsage(AnalysisUsage &AU) const {
+      AU.setPreservesAll();
+      AU.addRequired<DominatorTree>();
+      AU.addRequired<DominanceFrontier>();
+
+    }
+
+    virtual bool runOnFunction(Function &F) {
+      DominatorTree &DT = getAnalysis<DominatorTree>();
+      DT.dump();
+      DominanceFrontier &DF = getAnalysis<DominanceFrontier>();
+      DF.dump();
+      return false;
+    }
+  };
+
+  char DomInfoPrinter::ID = 0;
+  static RegisterPass<DomInfoPrinter>
+  DIP("print-dom-info", "Dominator Info Printer", true, true);
+}

Modified: llvm/branches/non-call-eh/tools/opt/opt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/tools/opt/opt.cpp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/tools/opt/opt.cpp (original)
+++ llvm/branches/non-call-eh/tools/opt/opt.cpp Sun Jul  6 15:45:41 2008
@@ -262,11 +262,12 @@
 
   if (!DisableInline)
     addPass(PM, createFunctionInliningPass());   // Inline small functions
-  addPass(PM, createSimplifyLibCallsPass());     // Library Call Optimizations
   addPass(PM, createArgumentPromotionPass());    // Scalarize uninlined fn args
 
   addPass(PM, createTailDuplicationPass());      // Simplify cfg by copying code
+  addPass(PM, createSimplifyLibCallsPass());     // Library Call Optimizations
   addPass(PM, createInstructionCombiningPass()); // Cleanup for scalarrepl.
+  addPass(PM, createJumpThreadingPass());        // Thread jumps.
   addPass(PM, createCFGSimplificationPass());    // Merge & remove BBs
   addPass(PM, createScalarReplAggregatesPass()); // Break up aggregate allocas
   addPass(PM, createInstructionCombiningPass()); // Combine silly seq's
@@ -279,8 +280,10 @@
   addPass(PM, createLICMPass());                 // Hoist loop invariants
   addPass(PM, createLoopUnswitchPass());         // Unswitch loops.
   addPass(PM, createLoopIndexSplitPass());       // Index split loops.
-  addPass(PM, createInstructionCombiningPass()); // Clean up after LICM/reassoc
+  // FIXME : Removing instcombine causes nestedloop regression.
+  addPass(PM, createInstructionCombiningPass()); 
   addPass(PM, createIndVarSimplifyPass());       // Canonicalize indvars
+  addPass(PM, createLoopDeletionPass());         // Delete dead loops
   addPass(PM, createLoopUnrollPass());           // Unroll small loops
   addPass(PM, createInstructionCombiningPass()); // Clean up after the unroller
   addPass(PM, createGVNPass());                  // Remove redundancies
@@ -293,7 +296,7 @@
   addPass(PM, createCondPropagationPass());      // Propagate conditionals
 
   addPass(PM, createDeadStoreEliminationPass()); // Delete dead stores
-  addPass(PM, createAggressiveDCEPass());        // SSA based 'Aggressive DCE'
+  addPass(PM, createAggressiveDCEPass());        // Delete dead instructions
   addPass(PM, createCFGSimplificationPass());    // Merge & remove BBs
   addPass(PM, createStripDeadPrototypesPass());  // Get rid of dead prototypes
   addPass(PM, createDeadTypeEliminationPass());  // Eliminate dead types

Modified: llvm/branches/non-call-eh/utils/GenLibDeps.pl
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/utils/GenLibDeps.pl?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/utils/GenLibDeps.pl (original)
+++ llvm/branches/non-call-eh/utils/GenLibDeps.pl Sun Jul  6 15:45:41 2008
@@ -96,7 +96,7 @@
     print "  <dt><b>$lib</b</dt><dd><ul>\n";
   }
   open UNDEFS, 
-    "$nmPath -g -u $Directory/$lib | sed -e 's/^  *U //' | sort | uniq |";
+    "$nmPath -g -u $Directory/$lib | sed -e 's/^[ 0]* U //' | sort | uniq |";
   my %DepLibs;
   while (<UNDEFS>) {
     chomp;

Modified: llvm/branches/non-call-eh/utils/NewNightlyTest.pl
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/utils/NewNightlyTest.pl?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/utils/NewNightlyTest.pl (original)
+++ llvm/branches/non-call-eh/utils/NewNightlyTest.pl Sun Jul  6 15:45:41 2008
@@ -558,7 +558,7 @@
 my $NumDirsInCVS  = 0;
 if ($USESVN) {
   $NumFilesInCVS = `egrep '^A' $COLog | wc -l` + 0;
-  $NumDirsInCVS  = `sed -e 's#/[^/]*$##' $COLog | sort | uniq | wc -l` + 0;
+  $NumDirsInCVS  = `sed -e 's#/[^/]*\$##' $COLog | sort | uniq | wc -l` + 0;
 } else {
   $NumFilesInCVS = `egrep '^U' $COLog | wc -l` + 0;
   $NumDirsInCVS  = `egrep '^cvs (checkout|server|update):' $COLog | wc -l` + 0;

Modified: llvm/branches/non-call-eh/utils/TableGen/AsmWriterEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/utils/TableGen/AsmWriterEmitter.cpp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/utils/TableGen/AsmWriterEmitter.cpp (original)
+++ llvm/branches/non-call-eh/utils/TableGen/AsmWriterEmitter.cpp Sun Jul  6 15:45:41 2008
@@ -363,7 +363,7 @@
   
   for (unsigned i = 0, e = NumberedInstructions.size(); i != e; ++i) {
     const AsmWriterInst *Inst = getAsmWriterInstByID(i);
-    if (Inst == 0) continue;  // PHI, INLINEASM, LABEL, etc.
+    if (Inst == 0) continue;  // PHI, INLINEASM, DBG_LABEL, etc.
     
     std::string Command;
     if (Inst->Operands.empty())
@@ -641,7 +641,7 @@
     << "    O << \"\\t\";\n"
     << "    printInlineAsm(MI);\n"
     << "    return true;\n"
-    << "  } else if (MI->getOpcode() == TargetInstrInfo::LABEL) {\n"
+    << "  } else if (MI->isLabel()) {\n"
     << "    printLabel(MI);\n"
     << "    return true;\n"
     << "  } else if (MI->getOpcode() == TargetInstrInfo::DECLARE) {\n"

Modified: llvm/branches/non-call-eh/utils/TableGen/CallingConvEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/utils/TableGen/CallingConvEmitter.cpp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/utils/TableGen/CallingConvEmitter.cpp (original)
+++ llvm/branches/non-call-eh/utils/TableGen/CallingConvEmitter.cpp Sun Jul  6 15:45:41 2008
@@ -26,9 +26,9 @@
   // other.
   for (unsigned i = 0, e = CCs.size(); i != e; ++i) {
     O << "static bool " << CCs[i]->getName()
-      << "(unsigned ValNo, MVT::ValueType ValVT,\n"
+      << "(unsigned ValNo, MVT ValVT,\n"
       << std::string(CCs[i]->getName().size()+13, ' ')
-      << "MVT::ValueType LocVT, CCValAssign::LocInfo LocInfo,\n"
+      << "MVT LocVT, CCValAssign::LocInfo LocInfo,\n"
       << std::string(CCs[i]->getName().size()+13, ' ')
       << "ISD::ArgFlagsTy ArgFlags, CCState &State);\n";
   }
@@ -44,9 +44,9 @@
   Counter = 0;
 
   O << "\n\nstatic bool " << CC->getName()
-    << "(unsigned ValNo, MVT::ValueType ValVT,\n"
+    << "(unsigned ValNo, MVT ValVT,\n"
     << std::string(CC->getName().size()+13, ' ')
-    << "MVT::ValueType LocVT, CCValAssign::LocInfo LocInfo,\n"
+    << "MVT LocVT, CCValAssign::LocInfo LocInfo,\n"
     << std::string(CC->getName().size()+13, ' ')
     << "ISD::ArgFlagsTy ArgFlags, CCState &State) {\n";
   // Emit all of the actions, in order.
@@ -163,12 +163,12 @@
         O << Size << ", ";
       else
         O << "\n" << IndentStr << "  State.getTarget().getTargetData()"
-          "->getABITypeSize(MVT::getTypeForValueType(LocVT)), ";
+          "->getABITypeSize(LocVT.getTypeForMVT()), ";
       if (Align)
         O << Align;
       else
         O << "\n" << IndentStr << "  State.getTarget().getTargetData()"
-          "->getABITypeAlignment(MVT::getTypeForValueType(LocVT))";
+          "->getABITypeAlignment(LocVT.getTypeForMVT())";
       O << ");\n" << IndentStr
         << "State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset"
         << Counter << ", LocVT, LocInfo));\n";

Modified: llvm/branches/non-call-eh/utils/TableGen/CodeEmitterGen.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/utils/TableGen/CodeEmitterGen.cpp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/utils/TableGen/CodeEmitterGen.cpp (original)
+++ llvm/branches/non-call-eh/utils/TableGen/CodeEmitterGen.cpp Sun Jul  6 15:45:41 2008
@@ -26,7 +26,9 @@
     Record *R = *I;
     if (R->getName() == "PHI" ||
         R->getName() == "INLINEASM" ||
-        R->getName() == "LABEL" ||
+        R->getName() == "DBG_LABEL" ||
+        R->getName() == "EH_LABEL" ||
+        R->getName() == "GC_LABEL" ||
         R->getName() == "DECLARE" ||
         R->getName() == "EXTRACT_SUBREG" ||
         R->getName() == "INSERT_SUBREG" ||
@@ -102,7 +104,9 @@
     
     if (R->getName() == "PHI" ||
         R->getName() == "INLINEASM" ||
-        R->getName() == "LABEL" ||
+        R->getName() == "DBG_LABEL" ||
+        R->getName() == "EH_LABEL" ||
+        R->getName() == "GC_LABEL" ||
         R->getName() == "DECLARE" ||
         R->getName() == "EXTRACT_SUBREG" ||
         R->getName() == "INSERT_SUBREG" ||
@@ -137,7 +141,9 @@
     
     if (InstName == "PHI" ||
         InstName == "INLINEASM" ||
-        InstName == "LABEL"||
+        InstName == "DBG_LABEL"||
+        InstName == "EH_LABEL"||
+        InstName == "GC_LABEL"||
         InstName == "DECLARE"||
         InstName == "EXTRACT_SUBREG" ||
         InstName == "INSERT_SUBREG" ||

Modified: llvm/branches/non-call-eh/utils/TableGen/CodeGenDAGPatterns.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/utils/TableGen/CodeGenDAGPatterns.cpp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/utils/TableGen/CodeGenDAGPatterns.cpp (original)
+++ llvm/branches/non-call-eh/utils/TableGen/CodeGenDAGPatterns.cpp Sun Jul  6 15:45:41 2008
@@ -27,9 +27,9 @@
 /// FilterVTs - Filter a list of VT's according to a predicate.
 ///
 template<typename T>
-static std::vector<MVT::ValueType> 
-FilterVTs(const std::vector<MVT::ValueType> &InVTs, T Filter) {
-  std::vector<MVT::ValueType> Result;
+static std::vector<MVT::SimpleValueType>
+FilterVTs(const std::vector<MVT::SimpleValueType> &InVTs, T Filter) {
+  std::vector<MVT::SimpleValueType> Result;
   for (unsigned i = 0, e = InVTs.size(); i != e; ++i)
     if (Filter(InVTs[i]))
       Result.push_back(InVTs[i]);
@@ -41,19 +41,31 @@
 FilterEVTs(const std::vector<unsigned char> &InVTs, T Filter) {
   std::vector<unsigned char> Result;
   for (unsigned i = 0, e = InVTs.size(); i != e; ++i)
-    if (Filter((MVT::ValueType)InVTs[i]))
+    if (Filter((MVT::SimpleValueType)InVTs[i]))
       Result.push_back(InVTs[i]);
   return Result;
 }
 
 static std::vector<unsigned char>
-ConvertVTs(const std::vector<MVT::ValueType> &InVTs) {
+ConvertVTs(const std::vector<MVT::SimpleValueType> &InVTs) {
   std::vector<unsigned char> Result;
   for (unsigned i = 0, e = InVTs.size(); i != e; ++i)
     Result.push_back(InVTs[i]);
   return Result;
 }
 
+static inline bool isInteger(MVT::SimpleValueType VT) {
+  return MVT(VT).isInteger();
+}
+
+static inline bool isFloatingPoint(MVT::SimpleValueType VT) {
+  return MVT(VT).isFloatingPoint();
+}
+
+static inline bool isVector(MVT::SimpleValueType VT) {
+  return MVT(VT).isVector();
+}
+
 static bool LHSIsSubsetOfRHS(const std::vector<unsigned char> &LHS,
                              const std::vector<unsigned char> &RHS) {
   if (LHS.size() > RHS.size()) return false;
@@ -66,7 +78,7 @@
 /// isExtIntegerVT - Return true if the specified extended value type vector
 /// contains isInt or an integer value type.
 namespace llvm {
-namespace MVT {
+namespace EMVT {
 bool isExtIntegerInVTs(const std::vector<unsigned char> &EVTs) {
   assert(!EVTs.empty() && "Cannot check for integer in empty ExtVT list!");
   return EVTs[0] == isInt || !(FilterEVTs(EVTs, isInteger).empty());
@@ -78,7 +90,7 @@
   assert(!EVTs.empty() && "Cannot check for integer in empty ExtVT list!");
   return EVTs[0] == isFP || !(FilterEVTs(EVTs, isFloatingPoint).empty());
 }
-} // end namespace MVT.
+} // end namespace EMVT.
 } // end namespace llvm.
 
 
@@ -223,23 +235,23 @@
   }
   case SDTCisInt: {
     // If there is only one integer type supported, this must be it.
-    std::vector<MVT::ValueType> IntVTs =
-      FilterVTs(CGT.getLegalValueTypes(), MVT::isInteger);
+    std::vector<MVT::SimpleValueType> IntVTs =
+      FilterVTs(CGT.getLegalValueTypes(), isInteger);
 
     // If we found exactly one supported integer type, apply it.
     if (IntVTs.size() == 1)
       return NodeToApply->UpdateNodeType(IntVTs[0], TP);
-    return NodeToApply->UpdateNodeType(MVT::isInt, TP);
+    return NodeToApply->UpdateNodeType(EMVT::isInt, TP);
   }
   case SDTCisFP: {
     // If there is only one FP type supported, this must be it.
-    std::vector<MVT::ValueType> FPVTs =
-      FilterVTs(CGT.getLegalValueTypes(), MVT::isFloatingPoint);
+    std::vector<MVT::SimpleValueType> FPVTs =
+      FilterVTs(CGT.getLegalValueTypes(), isFloatingPoint);
         
     // If we found exactly one supported FP type, apply it.
     if (FPVTs.size() == 1)
       return NodeToApply->UpdateNodeType(FPVTs[0], TP);
-    return NodeToApply->UpdateNodeType(MVT::isFP, TP);
+    return NodeToApply->UpdateNodeType(EMVT::isFP, TP);
   }
   case SDTCisSameAs: {
     TreePatternNode *OtherNode =
@@ -255,9 +267,9 @@
         !static_cast<DefInit*>(NodeToApply->getLeafValue())->getDef()
                ->isSubClassOf("ValueType"))
       TP.error(N->getOperator()->getName() + " expects a VT operand!");
-    MVT::ValueType VT =
+    MVT::SimpleValueType VT =
      getValueType(static_cast<DefInit*>(NodeToApply->getLeafValue())->getDef());
-    if (!MVT::isInteger(VT))
+    if (!isInteger(VT))
       TP.error(N->getOperator()->getName() + " VT operand must be integer!");
     
     TreePatternNode *OtherNode =
@@ -265,7 +277,7 @@
     
     // It must be integer.
     bool MadeChange = false;
-    MadeChange |= OtherNode->UpdateNodeType(MVT::isInt, TP);
+    MadeChange |= OtherNode->UpdateNodeType(EMVT::isInt, TP);
     
     // This code only handles nodes that have one type set.  Assert here so
     // that we can change this if we ever need to deal with multiple value
@@ -285,26 +297,26 @@
     // This code does not currently handle nodes which have multiple types,
     // where some types are integer, and some are fp.  Assert that this is not
     // the case.
-    assert(!(MVT::isExtIntegerInVTs(NodeToApply->getExtTypes()) &&
-             MVT::isExtFloatingPointInVTs(NodeToApply->getExtTypes())) &&
-           !(MVT::isExtIntegerInVTs(BigOperand->getExtTypes()) &&
-             MVT::isExtFloatingPointInVTs(BigOperand->getExtTypes())) &&
+    assert(!(EMVT::isExtIntegerInVTs(NodeToApply->getExtTypes()) &&
+             EMVT::isExtFloatingPointInVTs(NodeToApply->getExtTypes())) &&
+           !(EMVT::isExtIntegerInVTs(BigOperand->getExtTypes()) &&
+             EMVT::isExtFloatingPointInVTs(BigOperand->getExtTypes())) &&
            "SDTCisOpSmallerThanOp does not handle mixed int/fp types!");
-    if (MVT::isExtIntegerInVTs(NodeToApply->getExtTypes()))
-      MadeChange |= BigOperand->UpdateNodeType(MVT::isInt, TP);
-    else if (MVT::isExtFloatingPointInVTs(NodeToApply->getExtTypes()))
-      MadeChange |= BigOperand->UpdateNodeType(MVT::isFP, TP);
-    if (MVT::isExtIntegerInVTs(BigOperand->getExtTypes()))
-      MadeChange |= NodeToApply->UpdateNodeType(MVT::isInt, TP);
-    else if (MVT::isExtFloatingPointInVTs(BigOperand->getExtTypes()))
-      MadeChange |= NodeToApply->UpdateNodeType(MVT::isFP, TP);
-
-    std::vector<MVT::ValueType> VTs = CGT.getLegalValueTypes();
-    
-    if (MVT::isExtIntegerInVTs(NodeToApply->getExtTypes())) {
-      VTs = FilterVTs(VTs, MVT::isInteger);
-    } else if (MVT::isExtFloatingPointInVTs(NodeToApply->getExtTypes())) {
-      VTs = FilterVTs(VTs, MVT::isFloatingPoint);
+    if (EMVT::isExtIntegerInVTs(NodeToApply->getExtTypes()))
+      MadeChange |= BigOperand->UpdateNodeType(EMVT::isInt, TP);
+    else if (EMVT::isExtFloatingPointInVTs(NodeToApply->getExtTypes()))
+      MadeChange |= BigOperand->UpdateNodeType(EMVT::isFP, TP);
+    if (EMVT::isExtIntegerInVTs(BigOperand->getExtTypes()))
+      MadeChange |= NodeToApply->UpdateNodeType(EMVT::isInt, TP);
+    else if (EMVT::isExtFloatingPointInVTs(BigOperand->getExtTypes()))
+      MadeChange |= NodeToApply->UpdateNodeType(EMVT::isFP, TP);
+
+    std::vector<MVT::SimpleValueType> VTs = CGT.getLegalValueTypes();
+
+    if (EMVT::isExtIntegerInVTs(NodeToApply->getExtTypes())) {
+      VTs = FilterVTs(VTs, isInteger);
+    } else if (EMVT::isExtFloatingPointInVTs(NodeToApply->getExtTypes())) {
+      VTs = FilterVTs(VTs, isFloatingPoint);
     } else {
       VTs.clear();
     }
@@ -331,11 +343,12 @@
       getOperandNum(x.SDTCisIntVectorOfSameSize_Info.OtherOperandNum,
                     N, NumResults);
     if (OtherOperand->hasTypeSet()) {
-      if (!MVT::isVector(OtherOperand->getTypeNum(0)))
+      if (!isVector(OtherOperand->getTypeNum(0)))
         TP.error(N->getOperator()->getName() + " VT operand must be a vector!");
-      MVT::ValueType IVT = OtherOperand->getTypeNum(0);
-      IVT = MVT::getIntVectorWithNumElements(MVT::getVectorNumElements(IVT));
-      return NodeToApply->UpdateNodeType(IVT, TP);
+      MVT IVT = OtherOperand->getTypeNum(0);
+      unsigned NumElements = IVT.getVectorNumElements();
+      IVT = MVT::getIntVectorWithNumElements(NumElements);
+      return NodeToApply->UpdateNodeType(IVT.getSimpleVT(), TP);
     }
     return false;
   }
@@ -344,11 +357,11 @@
       getOperandNum(x.SDTCisIntVectorOfSameSize_Info.OtherOperandNum,
                     N, NumResults);
     if (OtherOperand->hasTypeSet()) {
-      if (!MVT::isVector(OtherOperand->getTypeNum(0)))
+      if (!isVector(OtherOperand->getTypeNum(0)))
         TP.error(N->getOperator()->getName() + " VT operand must be a vector!");
-      MVT::ValueType IVT = OtherOperand->getTypeNum(0);
-      IVT = MVT::getVectorElementType(IVT);
-      return NodeToApply->UpdateNodeType(IVT, TP);
+      MVT IVT = OtherOperand->getTypeNum(0);
+      IVT = IVT.getVectorElementType();
+      return NodeToApply->UpdateNodeType(IVT.getSimpleVT(), TP);
     }
     return false;
   }
@@ -388,6 +401,8 @@
       Properties |= 1 << SDNPMayLoad;
     } else if (PropList[i]->getName() == "SDNPSideEffect") {
       Properties |= 1 << SDNPSideEffect;
+    } else if (PropList[i]->getName() == "SDNPMemOperand") {
+      Properties |= 1 << SDNPMemOperand;
     } else {
       cerr << "Unknown SD Node property '" << PropList[i]->getName()
            << "' on node '" << R->getName() << "'!\n";
@@ -421,7 +436,7 @@
                                      TreePattern &TP) {
   assert(!ExtVTs.empty() && "Cannot update node type with empty type vector!");
   
-  if (ExtVTs[0] == MVT::isUnknown || LHSIsSubsetOfRHS(getExtTypes(), ExtVTs)) 
+  if (ExtVTs[0] == EMVT::isUnknown || LHSIsSubsetOfRHS(getExtTypes(), ExtVTs))
     return false;
   if (isTypeCompletelyUnknown() || LHSIsSubsetOfRHS(ExtVTs, getExtTypes())) {
     setTypes(ExtVTs);
@@ -429,10 +444,10 @@
   }
 
   if (getExtTypeNum(0) == MVT::iPTR) {
-    if (ExtVTs[0] == MVT::iPTR || ExtVTs[0] == MVT::isInt)
+    if (ExtVTs[0] == MVT::iPTR || ExtVTs[0] == EMVT::isInt)
       return false;
-    if (MVT::isExtIntegerInVTs(ExtVTs)) {
-      std::vector<unsigned char> FVTs = FilterEVTs(ExtVTs, MVT::isInteger);
+    if (EMVT::isExtIntegerInVTs(ExtVTs)) {
+      std::vector<unsigned char> FVTs = FilterEVTs(ExtVTs, isInteger);
       if (FVTs.size()) {
         setTypes(ExtVTs);
         return true;
@@ -440,17 +455,17 @@
     }
   }
   
-  if (ExtVTs[0] == MVT::isInt && MVT::isExtIntegerInVTs(getExtTypes())) {
+  if (ExtVTs[0] == EMVT::isInt && EMVT::isExtIntegerInVTs(getExtTypes())) {
     assert(hasTypeSet() && "should be handled above!");
-    std::vector<unsigned char> FVTs = FilterEVTs(getExtTypes(), MVT::isInteger);
+    std::vector<unsigned char> FVTs = FilterEVTs(getExtTypes(), isInteger);
     if (getExtTypes() == FVTs)
       return false;
     setTypes(FVTs);
     return true;
   }
-  if (ExtVTs[0] == MVT::iPTR && MVT::isExtIntegerInVTs(getExtTypes())) {
+  if (ExtVTs[0] == MVT::iPTR && EMVT::isExtIntegerInVTs(getExtTypes())) {
     //assert(hasTypeSet() && "should be handled above!");
-    std::vector<unsigned char> FVTs = FilterEVTs(getExtTypes(), MVT::isInteger);
+    std::vector<unsigned char> FVTs = FilterEVTs(getExtTypes(), isInteger);
     if (getExtTypes() == FVTs)
       return false;
     if (FVTs.size()) {
@@ -458,10 +473,10 @@
       return true;
     }
   }      
-  if (ExtVTs[0] == MVT::isFP  && MVT::isExtFloatingPointInVTs(getExtTypes())) {
+  if (ExtVTs[0] == EMVT::isFP  && EMVT::isExtFloatingPointInVTs(getExtTypes())) {
     assert(hasTypeSet() && "should be handled above!");
     std::vector<unsigned char> FVTs =
-      FilterEVTs(getExtTypes(), MVT::isFloatingPoint);
+      FilterEVTs(getExtTypes(), isFloatingPoint);
     if (getExtTypes() == FVTs)
       return false;
     setTypes(FVTs);
@@ -473,12 +488,14 @@
   //
   // Similarly, we should probably set the type here to the intersection of
   // {isInt|isFP} and ExtVTs
-  if ((getExtTypeNum(0) == MVT::isInt && MVT::isExtIntegerInVTs(ExtVTs)) ||
-      (getExtTypeNum(0) == MVT::isFP  && MVT::isExtFloatingPointInVTs(ExtVTs))){
+  if ((getExtTypeNum(0) == EMVT::isInt &&
+       EMVT::isExtIntegerInVTs(ExtVTs)) ||
+      (getExtTypeNum(0) == EMVT::isFP &&
+       EMVT::isExtFloatingPointInVTs(ExtVTs))) {
     setTypes(ExtVTs);
     return true;
   }
-  if (getExtTypeNum(0) == MVT::isInt && ExtVTs[0] == MVT::iPTR) {
+  if (getExtTypeNum(0) == EMVT::isInt && ExtVTs[0] == MVT::iPTR) {
     setTypes(ExtVTs);
     return true;
   }
@@ -506,9 +523,9 @@
   // nodes that are multiply typed.
   switch (getExtTypeNum(0)) {
   case MVT::Other: OS << ":Other"; break;
-  case MVT::isInt: OS << ":isInt"; break;
-  case MVT::isFP : OS << ":isFP"; break;
-  case MVT::isUnknown: ; /*OS << ":?";*/ break;
+  case EMVT::isInt: OS << ":isInt"; break;
+  case EMVT::isFP : OS << ":isFP"; break;
+  case EMVT::isUnknown: ; /*OS << ":?";*/ break;
   case MVT::iPTR:  OS << ":iPTR"; break;
   default: {
     std::string VTName = llvm::getName(getTypeNum(0));
@@ -662,7 +679,10 @@
   
   // Get a new copy of this fragment to stitch into here.
   //delete this;    // FIXME: implement refcounting!
-  return FragTree;
+  
+  // The fragment we inlined could have recursive inlining that is needed.  See
+  // if there are any pattern fragments in it and inline them as needed.
+  return FragTree->InlinePatternFragments(TP);
 }
 
 /// getImplicitType - Check to see if the specified record has an implicit
@@ -672,7 +692,7 @@
 static std::vector<unsigned char> getImplicitType(Record *R, bool NotRegisters,
                                       TreePattern &TP) {
   // Some common return values
-  std::vector<unsigned char> Unknown(1, MVT::isUnknown);
+  std::vector<unsigned char> Unknown(1, EMVT::isUnknown);
   std::vector<unsigned char> Other(1, MVT::Other);
 
   // Check to see if this is a register or a register class...
@@ -727,6 +747,15 @@
   return &CDP.getIntrinsicInfo(IID);
 }
 
+/// isCommutativeIntrinsic - Return true if the node corresponds to a
+/// commutative intrinsic.
+bool
+TreePatternNode::isCommutativeIntrinsic(const CodeGenDAGPatterns &CDP) const {
+  if (const CodeGenIntrinsic *Int = getIntrinsicInfo(CDP))
+    return Int->isCommutative;
+  return false;
+}
+
 
 /// ApplyTypeConstraints - Apply all of the type constraints relevent to
 /// this node and its children in the tree.  This returns true if it makes a
@@ -740,27 +769,29 @@
       return UpdateNodeType(getImplicitType(DI->getDef(), NotRegisters, TP),TP);
     } else if (IntInit *II = dynamic_cast<IntInit*>(getLeafValue())) {
       // Int inits are always integers. :)
-      bool MadeChange = UpdateNodeType(MVT::isInt, TP);
+      bool MadeChange = UpdateNodeType(EMVT::isInt, TP);
       
       if (hasTypeSet()) {
         // At some point, it may make sense for this tree pattern to have
         // multiple types.  Assert here that it does not, so we revisit this
         // code when appropriate.
         assert(getExtTypes().size() >= 1 && "TreePattern doesn't have a type!");
-        MVT::ValueType VT = getTypeNum(0);
+        MVT::SimpleValueType VT = getTypeNum(0);
         for (unsigned i = 1, e = getExtTypes().size(); i != e; ++i)
           assert(getTypeNum(i) == VT && "TreePattern has too many types!");
         
         VT = getTypeNum(0);
         if (VT != MVT::iPTR) {
-          unsigned Size = MVT::getSizeInBits(VT);
+          unsigned Size = MVT(VT).getSizeInBits();
           // Make sure that the value is representable for this type.
           if (Size < 32) {
             int Val = (II->getValue() << (32-Size)) >> (32-Size);
             if (Val != II->getValue()) {
               // If sign-extended doesn't fit, does it fit as unsigned?
-              unsigned ValueMask = unsigned(MVT::getIntVTBitMask(VT));
-              unsigned UnsignedVal = unsigned(II->getValue());
+              unsigned ValueMask;
+              unsigned UnsignedVal;
+              ValueMask = unsigned(MVT(VT).getIntegerVTBitMask());
+              UnsignedVal = unsigned(II->getValue());
 
               if ((ValueMask & UnsignedVal) != UnsignedVal) {
                 TP.error("Integer value '" + itostr(II->getValue())+
@@ -803,10 +834,10 @@
     return MadeChange;
   } else if (const CodeGenIntrinsic *Int = getIntrinsicInfo(CDP)) {
     bool MadeChange = false;
-    
+
     // Apply the result type to the node.
     MadeChange = UpdateNodeType(Int->ArgVTs[0], TP);
-    
+
     if (getNumChildren() != Int->ArgVTs.size())
       TP.error("Intrinsic '" + Int->Name + "' expects " +
                utostr(Int->ArgVTs.size()-1) + " operands, not " +
@@ -816,7 +847,7 @@
     MadeChange |= getChild(0)->UpdateNodeType(MVT::iPTR, TP);
     
     for (unsigned i = 1, e = getNumChildren(); i != e; ++i) {
-      MVT::ValueType OpVT = Int->ArgVTs[i];
+      MVT::SimpleValueType OpVT = Int->ArgVTs[i];
       MadeChange |= getChild(i)->UpdateNodeType(OpVT, TP);
       MadeChange |= getChild(i)->ApplyTypeConstraints(TP, NotRegisters);
     }
@@ -838,11 +869,11 @@
     if (getOperator()->getName() == "vector_shuffle" &&
         getChild(2)->getOperator()->getName() == "build_vector") {
       TreePatternNode *BV = getChild(2);
-      const std::vector<MVT::ValueType> &LegalVTs
+      const std::vector<MVT::SimpleValueType> &LegalVTs
         = CDP.getTargetInfo().getLegalValueTypes();
-      MVT::ValueType LegalIntVT = MVT::Other;
+      MVT::SimpleValueType LegalIntVT = MVT::Other;
       for (unsigned i = 0, e = LegalVTs.size(); i != e; ++i)
-        if (MVT::isInteger(LegalVTs[i]) && !MVT::isVector(LegalVTs[i])) {
+        if (isInteger(LegalVTs[i]) && !isVector(LegalVTs[i])) {
           LegalIntVT = LegalVTs[i];
           break;
         }
@@ -874,7 +905,7 @@
         MadeChange = UpdateNodeType(VT, TP);
       } else if (ResultNode->getName() == "unknown") {
         std::vector<unsigned char> VT;
-        VT.push_back(MVT::isUnknown);
+        VT.push_back(EMVT::isUnknown);
         MadeChange = UpdateNodeType(VT, TP);
       } else {
         assert(ResultNode->isSubClassOf("RegisterClass") &&
@@ -903,7 +934,7 @@
         TP.error("Instruction '" + getOperator()->getName() +
                  "' expects more operands than were provided.");
       
-      MVT::ValueType VT;
+      MVT::SimpleValueType VT;
       TreePatternNode *Child = getChild(ChildNo++);
       if (OperandNode->isSubClassOf("RegisterClass")) {
         const CodeGenRegisterClass &RC = 
@@ -915,7 +946,7 @@
       } else if (OperandNode->getName() == "ptr_rc") {
         MadeChange |= Child->UpdateNodeType(MVT::iPTR, TP);
       } else if (OperandNode->getName() == "unknown") {
-        MadeChange |= Child->UpdateNodeType(MVT::isUnknown, TP);
+        MadeChange |= Child->UpdateNodeType(EMVT::isUnknown, TP);
       } else {
         assert(0 && "Unknown operand type!");
         abort();
@@ -982,11 +1013,13 @@
   // If this node is a commutative operator, check that the LHS isn't an
   // immediate.
   const SDNodeInfo &NodeInfo = CDP.getSDNodeInfo(getOperator());
-  if (NodeInfo.hasProperty(SDNPCommutative)) {
+  bool isCommIntrinsic = isCommutativeIntrinsic(CDP);
+  if (NodeInfo.hasProperty(SDNPCommutative) || isCommIntrinsic) {
     // Scan all of the operands of the node and make sure that only the last one
     // is a constant node, unless the RHS also is.
     if (!OnlyOnRHSOfCommutative(getChild(getNumChildren()-1))) {
-      for (unsigned i = 0, e = getNumChildren()-1; i != e; ++i)
+      bool Skip = isCommIntrinsic ? 1 : 0; // First operand is intrinsic id.
+      for (unsigned i = Skip, e = getNumChildren()-1; i != e; ++i)
         if (OnlyOnRHSOfCommutative(getChild(i))) {
           Reason="Immediate value must be on the RHS of commutative operators!";
           return false;
@@ -1353,9 +1386,8 @@
   
   // Now that we've parsed all of the tree fragments, do a closure on them so
   // that there are not references to PatFrags left inside of them.
-  for (std::map<Record*, TreePattern*>::iterator I = PatternFragments.begin(),
-       E = PatternFragments.end(); I != E; ++I) {
-    TreePattern *ThePat = I->second;
+  for (unsigned i = 0, e = Fragments.size(); i != e; ++i) {
+    TreePattern *ThePat = PatternFragments[Fragments[i]];
     ThePat->InlinePatternFragments();
         
     // Infer as many types as possible.  Don't worry about it if we don't infer
@@ -2233,8 +2265,10 @@
   CombineChildVariants(N, ChildVariants, OutVariants, CDP, DepVars);
 
   // If this node is commutative, consider the commuted order.
-  if (NodeInfo.hasProperty(SDNPCommutative)) {
-    assert(N->getNumChildren()==2 &&"Commutative but doesn't have 2 children!");
+  bool isCommIntrinsic = N->isCommutativeIntrinsic(CDP);
+  if (NodeInfo.hasProperty(SDNPCommutative) || isCommIntrinsic) {
+    assert((N->getNumChildren()==2 || isCommIntrinsic) &&
+           "Commutative but doesn't have 2 children!");
     // Don't count children which are actually register references.
     unsigned NC = 0;
     for (unsigned i = 0, e = N->getNumChildren(); i != e; ++i) {
@@ -2248,7 +2282,20 @@
       NC++;
     }
     // Consider the commuted order.
-    if (NC == 2)
+    if (isCommIntrinsic) {
+      // Commutative intrinsic. First operand is the intrinsic id, 2nd and 3rd
+      // operands are the commutative operands, and there might be more operands
+      // after those.
+      assert(NC >= 3 &&
+             "Commutative intrinsic should have at least 3 childrean!");
+      std::vector<std::vector<TreePatternNode*> > Variants;
+      Variants.push_back(ChildVariants[0]); // Intrinsic id.
+      Variants.push_back(ChildVariants[2]);
+      Variants.push_back(ChildVariants[1]);
+      for (unsigned i = 3; i != NC; ++i)
+        Variants.push_back(ChildVariants[i]);
+      CombineChildVariants(N, Variants, OutVariants, CDP, DepVars);
+    } else if (NC == 2)
       CombineChildVariants(N, ChildVariants[1], ChildVariants[0],
                            OutVariants, CDP, DepVars);
   }

Modified: llvm/branches/non-call-eh/utils/TableGen/CodeGenDAGPatterns.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/utils/TableGen/CodeGenDAGPatterns.h?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/utils/TableGen/CodeGenDAGPatterns.h (original)
+++ llvm/branches/non-call-eh/utils/TableGen/CodeGenDAGPatterns.h Sun Jul  6 15:45:41 2008
@@ -31,15 +31,15 @@
   class CodeGenDAGPatterns;
   class ComplexPattern;
 
-/// MVT::DAGISelGenValueType - These are some extended forms of MVT::ValueType
-/// that we use as lattice values during type inferrence.
-namespace MVT {
+/// EMVT::DAGISelGenValueType - These are some extended forms of
+/// MVT::SimpleValueType that we use as lattice values during type inference.
+namespace EMVT {
   enum DAGISelGenValueType {
     isFP  = MVT::LAST_VALUETYPE,
     isInt,
     isUnknown
   };
-  
+
   /// isExtIntegerVT - Return true if the specified extended value type vector
   /// contains isInt or an integer value type.
   bool isExtIntegerInVTs(const std::vector<unsigned char> &EVTs);
@@ -66,7 +66,7 @@
   
   union {   // The discriminated union.
     struct {
-      MVT::ValueType VT;
+      unsigned char VT;
     } SDTCisVT_Info;
     struct {
       unsigned OtherOperandNum;
@@ -142,7 +142,7 @@
 /// patterns), and as such should be ref counted.  We currently just leak all
 /// TreePatternNode objects!
 class TreePatternNode {
-  /// The inferred type for this node, or MVT::isUnknown if it hasn't
+  /// The inferred type for this node, or EMVT::isUnknown if it hasn't
   /// been determined yet.
   std::vector<unsigned char> Types;
   
@@ -170,10 +170,10 @@
 public:
   TreePatternNode(Record *Op, const std::vector<TreePatternNode*> &Ch) 
     : Types(), Operator(Op), Val(0), TransformFn(0),
-    Children(Ch) { Types.push_back(MVT::isUnknown); }
+    Children(Ch) { Types.push_back(EMVT::isUnknown); }
   TreePatternNode(Init *val)    // leaf ctor
     : Types(), Operator(0), Val(val), TransformFn(0) {
-    Types.push_back(MVT::isUnknown);
+    Types.push_back(EMVT::isUnknown);
   }
   ~TreePatternNode();
   
@@ -185,15 +185,15 @@
     return (Types[0] < MVT::LAST_VALUETYPE) || (Types[0] == MVT::iPTR);
   }
   bool isTypeCompletelyUnknown() const {
-    return Types[0] == MVT::isUnknown;
+    return Types[0] == EMVT::isUnknown;
   }
   bool isTypeDynamicallyResolved() const {
     return Types[0] == MVT::iPTR;
   }
-  MVT::ValueType getTypeNum(unsigned Num) const {
+  MVT::SimpleValueType getTypeNum(unsigned Num) const {
     assert(hasTypeSet() && "Doesn't have a type yet!");
     assert(Types.size() > Num && "Type num out of range!");
-    return (MVT::ValueType)Types[Num];
+    return (MVT::SimpleValueType)Types[Num];
   }
   unsigned char getExtTypeNum(unsigned Num) const { 
     assert(Types.size() > Num && "Extended type num out of range!");
@@ -201,7 +201,7 @@
   }
   const std::vector<unsigned char> &getExtTypes() const { return Types; }
   void setTypes(const std::vector<unsigned char> &T) { Types = T; }
-  void removeTypes() { Types = std::vector<unsigned char>(1,MVT::isUnknown); }
+  void removeTypes() { Types = std::vector<unsigned char>(1, EMVT::isUnknown); }
   
   Init *getLeafValue() const { assert(isLeaf()); return Val; }
   Record *getOperator() const { assert(!isLeaf()); return Operator; }
@@ -221,6 +221,10 @@
   /// getIntrinsicInfo - If this node corresponds to an intrinsic, return the
   /// CodeGenIntrinsic information for it, otherwise return a null pointer.
   const CodeGenIntrinsic *getIntrinsicInfo(const CodeGenDAGPatterns &CDP) const;
+
+  /// isCommutativeIntrinsic - Return true if the node is an intrinsic which is
+  /// marked isCommutative.
+  bool isCommutativeIntrinsic(const CodeGenDAGPatterns &CDP) const;
   
   void print(std::ostream &OS) const;
   void dump() const;

Modified: llvm/branches/non-call-eh/utils/TableGen/CodeGenInstruction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/utils/TableGen/CodeGenInstruction.cpp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/utils/TableGen/CodeGenInstruction.cpp (original)
+++ llvm/branches/non-call-eh/utils/TableGen/CodeGenInstruction.cpp Sun Jul  6 15:45:41 2008
@@ -99,6 +99,7 @@
   hasSideEffects = R->getValueAsBit("hasSideEffects");
   mayHaveSideEffects = R->getValueAsBit("mayHaveSideEffects");
   neverHasSideEffects = R->getValueAsBit("neverHasSideEffects");
+  isAsCheapAsAMove = R->getValueAsBit("isAsCheapAsAMove");
   hasOptionalDef = false;
   isVariadic = false;
 

Modified: llvm/branches/non-call-eh/utils/TableGen/CodeGenInstruction.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/utils/TableGen/CodeGenInstruction.h?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/utils/TableGen/CodeGenInstruction.h (original)
+++ llvm/branches/non-call-eh/utils/TableGen/CodeGenInstruction.h Sun Jul  6 15:45:41 2008
@@ -102,7 +102,10 @@
     bool hasCtrlDep;
     bool isNotDuplicable;
     bool hasOptionalDef;
-    bool hasSideEffects, mayHaveSideEffects, neverHasSideEffects;
+    bool hasSideEffects;
+    bool mayHaveSideEffects;
+    bool neverHasSideEffects;
+    bool isAsCheapAsAMove;
     
     /// ParseOperandName - Parse an operand name like "$foo" or "$foo.bar",
     /// where $foo is a whole operand and $foo.bar refers to a suboperand.

Modified: llvm/branches/non-call-eh/utils/TableGen/CodeGenIntrinsics.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/utils/TableGen/CodeGenIntrinsics.h?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/utils/TableGen/CodeGenIntrinsics.h (original)
+++ llvm/branches/non-call-eh/utils/TableGen/CodeGenIntrinsics.h Sun Jul  6 15:45:41 2008
@@ -29,13 +29,13 @@
     std::string EnumName;      // The name of the enum "bswap_i32"
     std::string GCCBuiltinName;// Name of the corresponding GCC builtin, or "".
     std::string TargetPrefix;  // Target prefix, e.g. "ppc" for t-s intrinsics.
-    
-    /// ArgVTs - The MVT::ValueType for each argument type.  Note that this list
-    /// is only populated when in the context of a target .td file.  When
-    /// building Intrinsics.td, this isn't available, because we don't know the
-    /// target pointer size.
-    std::vector<MVT::ValueType> ArgVTs;
-    
+
+    /// ArgVTs - The MVT::SimpleValueType for each argument type.  Note that
+    /// this list is only populated when in the context of a target .td file.
+    /// When building Intrinsics.td, this isn't available, because we don't know
+    /// the target pointer size.
+    std::vector<MVT::SimpleValueType> ArgVTs;
+
     /// ArgTypeDefs - The records for each argument type.
     ///
     std::vector<Record*> ArgTypeDefs;
@@ -49,6 +49,10 @@
     // types.
     bool isOverloaded;
 
+    // isCommutative - True if the intrinsic is commutative.
+    //
+    bool isCommutative;
+
     CodeGenIntrinsic(Record *R);
   };
 

Modified: llvm/branches/non-call-eh/utils/TableGen/CodeGenRegisters.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/utils/TableGen/CodeGenRegisters.h?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/utils/TableGen/CodeGenRegisters.h (original)
+++ llvm/branches/non-call-eh/utils/TableGen/CodeGenRegisters.h Sun Jul  6 15:45:41 2008
@@ -36,7 +36,7 @@
     Record *TheDef;
     std::string Namespace;
     std::vector<Record*> Elements;
-    std::vector<MVT::ValueType> VTs;
+    std::vector<MVT::SimpleValueType> VTs;
     unsigned SpillSize;
     unsigned SpillAlignment;
     int CopyCost;
@@ -44,10 +44,10 @@
     std::string MethodProtos, MethodBodies;
 
     const std::string &getName() const;
-    const std::vector<MVT::ValueType> &getValueTypes() const { return VTs; }
+    const std::vector<MVT::SimpleValueType> &getValueTypes() const {return VTs;}
     unsigned getNumValueTypes() const { return VTs.size(); }
     
-    MVT::ValueType getValueTypeNum(unsigned VTNum) const {
+    MVT::SimpleValueType getValueTypeNum(unsigned VTNum) const {
       if (VTNum < VTs.size())
         return VTs[VTNum];
       assert(0 && "VTNum greater than number of ValueTypes in RegClass!");

Modified: llvm/branches/non-call-eh/utils/TableGen/CodeGenTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/utils/TableGen/CodeGenTarget.cpp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/utils/TableGen/CodeGenTarget.cpp (original)
+++ llvm/branches/non-call-eh/utils/TableGen/CodeGenTarget.cpp Sun Jul  6 15:45:41 2008
@@ -27,13 +27,13 @@
 AsmWriterNum("asmwriternum", cl::init(0),
              cl::desc("Make -gen-asm-writer emit assembly writer #N"));
 
-/// getValueType - Return the MCV::ValueType that the specified TableGen record
-/// corresponds to.
-MVT::ValueType llvm::getValueType(Record *Rec) {
-  return (MVT::ValueType)Rec->getValueAsInt("Value");
+/// getValueType - Return the MVT::SimpleValueType that the specified TableGen
+/// record corresponds to.
+MVT::SimpleValueType llvm::getValueType(Record *Rec) {
+  return (MVT::SimpleValueType)Rec->getValueAsInt("Value");
 }
 
-std::string llvm::getName(MVT::ValueType T) {
+std::string llvm::getName(MVT::SimpleValueType T) {
   switch (T) {
   case MVT::Other: return "UNKNOWN";
   case MVT::i1:    return "MVT::i1";
@@ -69,7 +69,7 @@
   }
 }
 
-std::string llvm::getEnumName(MVT::ValueType T) {
+std::string llvm::getEnumName(MVT::SimpleValueType T) {
   switch (T) {
   case MVT::Other: return "MVT::Other";
   case MVT::i1:    return "MVT::i1";
@@ -181,7 +181,7 @@
     const CodeGenRegisterClass &RC = RegisterClasses[i];
     for (unsigned ei = 0, ee = RC.Elements.size(); ei != ee; ++ei) {
       if (R == RC.Elements[ei]) {
-        const std::vector<MVT::ValueType> &InVTs = RC.getValueTypes();
+        const std::vector<MVT::SimpleValueType> &InVTs = RC.getValueTypes();
         for (unsigned i = 0, e = InVTs.size(); i != e; ++i)
           Result.push_back(InVTs[i]);
       }
@@ -231,7 +231,7 @@
   unsigned Size = R->getValueAsInt("Size");
 
   Namespace = R->getValueAsString("Namespace");
-  SpillSize = Size ? Size : MVT::getSizeInBits(VTs[0]);
+  SpillSize = Size ? Size : MVT(VTs[0]).getSizeInBits();
   SpillAlignment = R->getValueAsInt("Alignment");
   CopyCost = R->getValueAsInt("CopyCost");
   MethodBodies = R->getValueAsCode("MethodBodies");
@@ -286,9 +286,17 @@
   if (I == Instructions.end()) throw "Could not find 'INLINEASM' instruction!";
   const CodeGenInstruction *INLINEASM = &I->second;
   
-  I = getInstructions().find("LABEL");
-  if (I == Instructions.end()) throw "Could not find 'LABEL' instruction!";
-  const CodeGenInstruction *LABEL = &I->second;
+  I = getInstructions().find("DBG_LABEL");
+  if (I == Instructions.end()) throw "Could not find 'DBG_LABEL' instruction!";
+  const CodeGenInstruction *DBG_LABEL = &I->second;
+  
+  I = getInstructions().find("EH_LABEL");
+  if (I == Instructions.end()) throw "Could not find 'EH_LABEL' instruction!";
+  const CodeGenInstruction *EH_LABEL = &I->second;
+  
+  I = getInstructions().find("GC_LABEL");
+  if (I == Instructions.end()) throw "Could not find 'GC_LABEL' instruction!";
+  const CodeGenInstruction *GC_LABEL = &I->second;
   
   I = getInstructions().find("DECLARE");
   if (I == Instructions.end()) throw "Could not find 'DECLARE' instruction!";
@@ -317,7 +325,9 @@
   // Print out the rest of the instructions now.
   NumberedInstructions.push_back(PHI);
   NumberedInstructions.push_back(INLINEASM);
-  NumberedInstructions.push_back(LABEL);
+  NumberedInstructions.push_back(DBG_LABEL);
+  NumberedInstructions.push_back(EH_LABEL);
+  NumberedInstructions.push_back(GC_LABEL);
   NumberedInstructions.push_back(DECLARE);
   NumberedInstructions.push_back(EXTRACT_SUBREG);
   NumberedInstructions.push_back(INSERT_SUBREG);
@@ -326,7 +336,9 @@
   for (inst_iterator II = inst_begin(), E = inst_end(); II != E; ++II)
     if (&II->second != PHI &&
         &II->second != INLINEASM &&
-        &II->second != LABEL &&
+        &II->second != DBG_LABEL &&
+        &II->second != EH_LABEL &&
+        &II->second != GC_LABEL &&
         &II->second != DECLARE &&
         &II->second != EXTRACT_SUBREG &&
         &II->second != INSERT_SUBREG &&
@@ -366,6 +378,8 @@
       Properties |= 1 << SDNPMayLoad;
     } else if (PropList[i]->getName() == "SDNPSideEffect") {
       Properties |= 1 << SDNPSideEffect;
+    } else if (PropList[i]->getName() == "SDNPMemOperand") {
+      Properties |= 1 << SDNPMemOperand;
     } else {
       cerr << "Unsupported SD Node property '" << PropList[i]->getName()
            << "' on ComplexPattern '" << R->getName() << "'!\n";
@@ -404,6 +418,7 @@
   std::string DefName = R->getName();
   ModRef = WriteMem;
   isOverloaded = false;
+  isCommutative = false;
   
   if (DefName.size() <= 4 || 
       std::string(DefName.begin(), DefName.begin()+4) != "int_")
@@ -443,7 +458,7 @@
   for (unsigned i = 0, e = TypeList->getSize(); i != e; ++i) {
     Record *TyEl = TypeList->getElementAsRecord(i);
     assert(TyEl->isSubClassOf("LLVMType") && "Expected a type!");
-    MVT::ValueType VT = getValueType(TyEl->getValueAsDef("VT"));
+    MVT::SimpleValueType VT = getValueType(TyEl->getValueAsDef("VT"));
     isOverloaded |= VT == MVT::iAny || VT == MVT::fAny;
     ArgVTs.push_back(VT);
     ArgTypeDefs.push_back(TyEl);
@@ -469,6 +484,8 @@
       ModRef = WriteArgMem;
     else if (Property->getName() == "IntrWriteMem")
       ModRef = WriteMem;
+    else if (Property->getName() == "Commutative")
+      isCommutative = true;
     else
       assert(0 && "Unknown property!");
   }

Modified: llvm/branches/non-call-eh/utils/TableGen/CodeGenTarget.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/utils/TableGen/CodeGenTarget.h?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/utils/TableGen/CodeGenTarget.h (original)
+++ llvm/branches/non-call-eh/utils/TableGen/CodeGenTarget.h Sun Jul  6 15:45:41 2008
@@ -30,6 +30,8 @@
 class CodeGenTarget;
 
 // SelectionDAG node properties.
+//  SDNPMemOperand: indicates that a node touches memory and therefore must
+//                  have an associated memory operand that describes the access.
 enum SDNP {
   SDNPCommutative, 
   SDNPAssociative, 
@@ -39,18 +41,19 @@
   SDNPOptInFlag,
   SDNPMayLoad,
   SDNPMayStore,
-  SDNPSideEffect
+  SDNPSideEffect,
+  SDNPMemOperand
 };
 
 // ComplexPattern attributes.
 enum CPAttr { CPAttrParentAsRoot };
 
-/// getValueType - Return the MVT::ValueType that the specified TableGen record
-/// corresponds to.
-MVT::ValueType getValueType(Record *Rec);
+/// getValueType - Return the MVT::SimpleValueType that the specified TableGen
+/// record corresponds to.
+MVT::SimpleValueType getValueType(Record *Rec);
 
-std::string getName(MVT::ValueType T);
-std::string getEnumName(MVT::ValueType T);
+std::string getName(MVT::SimpleValueType T);
+std::string getEnumName(MVT::SimpleValueType T);
 
 /// getQualifiedName - Return the name of the specified record, with a
 /// namespace qualifier if the record contains one.
@@ -64,7 +67,7 @@
   mutable std::map<std::string, CodeGenInstruction> Instructions;
   mutable std::vector<CodeGenRegister> Registers;
   mutable std::vector<CodeGenRegisterClass> RegisterClasses;
-  mutable std::vector<MVT::ValueType> LegalValueTypes;
+  mutable std::vector<MVT::SimpleValueType> LegalValueTypes;
   void ReadRegisters() const;
   void ReadRegisterClasses() const;
   void ReadInstructions() const;
@@ -121,19 +124,19 @@
     return FoundRC;
   }
 
-  /// getRegisterVTs - Find the union of all possible ValueTypes for the
+  /// getRegisterVTs - Find the union of all possible SimpleValueTypes for the
   /// specified physical register.
   std::vector<unsigned char> getRegisterVTs(Record *R) const;
   
-  const std::vector<MVT::ValueType> &getLegalValueTypes() const {
+  const std::vector<MVT::SimpleValueType> &getLegalValueTypes() const {
     if (LegalValueTypes.empty()) ReadLegalValueTypes();
     return LegalValueTypes;
   }
   
   /// isLegalValueType - Return true if the specified value type is natively
   /// supported by the target (i.e. there are registers that directly hold it).
-  bool isLegalValueType(MVT::ValueType VT) const {
-    const std::vector<MVT::ValueType> &LegalVTs = getLegalValueTypes();
+  bool isLegalValueType(MVT::SimpleValueType VT) const {
+    const std::vector<MVT::SimpleValueType> &LegalVTs = getLegalValueTypes();
     for (unsigned i = 0, e = LegalVTs.size(); i != e; ++i)
       if (LegalVTs[i] == VT) return true;
     return false;    
@@ -175,7 +178,7 @@
 /// ComplexPattern - ComplexPattern info, corresponding to the ComplexPattern
 /// tablegen class in TargetSelectionDAG.td
 class ComplexPattern {
-  MVT::ValueType Ty;
+  MVT::SimpleValueType Ty;
   unsigned NumOperands;
   std::string SelectFunc;
   std::vector<Record*> RootNodes;
@@ -185,7 +188,7 @@
   ComplexPattern() : NumOperands(0) {};
   ComplexPattern(Record *R);
 
-  MVT::ValueType getValueType() const { return Ty; }
+  MVT::SimpleValueType getValueType() const { return Ty; }
   unsigned getNumOperands() const { return NumOperands; }
   const std::string &getSelectFunc() const { return SelectFunc; }
   const std::vector<Record*> &getRootNodes() const {

Modified: llvm/branches/non-call-eh/utils/TableGen/DAGISelEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/utils/TableGen/DAGISelEmitter.cpp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/utils/TableGen/DAGISelEmitter.cpp (original)
+++ llvm/branches/non-call-eh/utils/TableGen/DAGISelEmitter.cpp Sun Jul  6 15:45:41 2008
@@ -51,8 +51,8 @@
 /// patterns before small ones.  This is used to determine the size of a
 /// pattern.
 static unsigned getPatternSize(TreePatternNode *P, CodeGenDAGPatterns &CGP) {
-  assert((MVT::isExtIntegerInVTs(P->getExtTypes()) || 
-          MVT::isExtFloatingPointInVTs(P->getExtTypes()) ||
+  assert((EMVT::isExtIntegerInVTs(P->getExtTypes()) ||
+          EMVT::isExtFloatingPointInVTs(P->getExtTypes()) ||
           P->getExtTypeNum(0) == MVT::isVoid ||
           P->getExtTypeNum(0) == MVT::Flag ||
           P->getExtTypeNum(0) == MVT::iPTR) && 
@@ -160,7 +160,7 @@
 
 /// getRegisterValueType - Look up and return the first ValueType of specified 
 /// RegisterClass record
-static MVT::ValueType getRegisterValueType(Record *R, const CodeGenTarget &T) {
+static MVT::SimpleValueType getRegisterValueType(Record *R, const CodeGenTarget &T) {
   if (const CodeGenRegisterClass *RC = T.getRegisterClassForRegister(R))
     return RC->getValueTypeNum(0);
   return MVT::Other;
@@ -206,6 +206,28 @@
   return false;
 }
 
+static std::string getOpcodeName(Record *Op, CodeGenDAGPatterns &CGP) {
+  return CGP.getSDNodeInfo(Op).getEnumName();
+}
+
+static
+bool DisablePatternForFastISel(TreePatternNode *N, CodeGenDAGPatterns &CGP) {
+  bool isStore = !N->isLeaf() &&
+    getOpcodeName(N->getOperator(), CGP) == "ISD::STORE";
+  if (!isStore && NodeHasProperty(N, SDNPHasChain, CGP))
+    return false;
+
+  bool HasChain = false;
+  for (unsigned i = 0, e = N->getNumChildren(); i != e; ++i) {
+    TreePatternNode *Child = N->getChild(i);
+    if (PatternHasProperty(Child, SDNPHasChain, CGP)) {
+      HasChain = true;
+      break;
+    }
+  }
+  return HasChain;
+}
+
 //===----------------------------------------------------------------------===//
 // Node Transformation emitter implementation.
 //
@@ -331,6 +353,15 @@
   /// instructions.
   std::vector<std::string> &TargetOpcodes;
   std::vector<std::string> &TargetVTs;
+  /// OutputIsVariadic - Records whether the instruction output pattern uses
+  /// variable_ops.  This requires that the Emit function be passed an
+  /// additional argument to indicate where the input varargs operands
+  /// begin.
+  bool &OutputIsVariadic;
+  /// NumInputRootOps - Records the number of operands the root node of the
+  /// input pattern has.  This information is used in the generated code to
+  /// pass to Emit functions when variable_ops processing is needed.
+  unsigned &NumInputRootOps;
 
   std::string ChainName;
   unsigned TmpNo;
@@ -367,10 +398,13 @@
                      std::vector<std::pair<unsigned, std::string> > &gc,
                      std::set<std::string> &gd,
                      std::vector<std::string> &to,
-                     std::vector<std::string> &tv)
+                     std::vector<std::string> &tv,
+                     bool &oiv,
+                     unsigned &niro)
   : CGP(cgp), Predicates(preds), Pattern(pattern), Instruction(instr),
     GeneratedCode(gc), GeneratedDecl(gd),
     TargetOpcodes(to), TargetVTs(tv),
+    OutputIsVariadic(oiv), NumInputRootOps(niro),
     TmpNo(0), OpcNo(0), VTNo(0) {}
 
   /// EmitMatchCode - Emit a matcher for N, going to the label for PatternNo
@@ -382,16 +416,19 @@
 
     // Save loads/stores matched by a pattern.
     if (!N->isLeaf() && N->getName().empty()) {
-      std::string EnumName = N->getOperator()->getValueAsString("Opcode");
-      if (EnumName == "ISD::LOAD" ||
-          EnumName == "ISD::STORE") {
+      if (NodeHasProperty(N, SDNPMemOperand, CGP))
         LSI.push_back(RootName);
-      }
     }
 
     bool isRoot = (P == NULL);
     // Emit instruction predicates. Each predicate is just a string for now.
     if (isRoot) {
+      // Record input varargs info.
+      NumInputRootOps = N->getNumChildren();
+
+      if (DisablePatternForFastISel(N, CGP))
+        emitCheck("!FastISel");
+
       std::string PredicateCheck;
       for (unsigned i = 0, e = Predicates->getSize(); i != e; ++i) {
         if (DefInit *Pred = dynamic_cast<DefInit*>(Predicates->getElement(i))) {
@@ -468,10 +505,8 @@
           //      /        [YY]
           //      |         ^
           //     [XX]-------|
-          bool NeedCheck = false;
-          if (P != Pattern)
-            NeedCheck = true;
-          else {
+          bool NeedCheck = P != Pattern;
+          if (!NeedCheck) {
             const SDNodeInfo &PInfo = CGP.getSDNodeInfo(P->getOperator());
             NeedCheck =
               P->getOperator() == CGP.get_intrinsic_void_sdnode() ||
@@ -887,7 +922,7 @@
       if (InstPatNode && InstPatNode->getOperator()->getName() == "set") {
         InstPatNode = InstPatNode->getChild(InstPatNode->getNumChildren()-1);
       }
-      bool HasVarOps     = isRoot && II.isVariadic;
+      bool IsVariadic = isRoot && II.isVariadic;
       // FIXME: fix how we deal with physical register operands.
       bool HasImpInputs  = isRoot && Inst.getNumImpOperands() > 0;
       bool HasImpResults = isRoot && DstRegs.size() > 0;
@@ -904,17 +939,20 @@
       unsigned NumResults = Inst.getNumResults();    
       unsigned NumDstRegs = HasImpResults ? DstRegs.size() : 0;
 
+      // Record output varargs info.
+      OutputIsVariadic = IsVariadic;
+
       if (NodeHasOptInFlag) {
         emitCode("bool HasInFlag = "
            "(N.getOperand(N.getNumOperands()-1).getValueType() == MVT::Flag);");
       }
-      if (HasVarOps)
+      if (IsVariadic)
         emitCode("SmallVector<SDOperand, 8> Ops" + utostr(OpcNo) + ";");
 
       // How many results is this pattern expected to produce?
       unsigned NumPatResults = 0;
       for (unsigned i = 0, e = Pattern->getExtTypes().size(); i != e; i++) {
-        MVT::ValueType VT = Pattern->getTypeNum(i);
+        MVT::SimpleValueType VT = Pattern->getTypeNum(i);
         if (VT != MVT::isVoid && VT != MVT::Flag)
           NumPatResults++;
       }
@@ -946,23 +984,16 @@
       // in the 'execute always' values.  Match up the node operands to the
       // instruction operands to do this.
       std::vector<std::string> AllOps;
-      unsigned NumEAInputs = 0; // # of synthesized 'execute always' inputs.
       for (unsigned ChildNo = 0, InstOpNo = NumResults;
            InstOpNo != II.OperandList.size(); ++InstOpNo) {
         std::vector<std::string> Ops;
         
-        // If this is a normal operand or a predicate operand without
-        // 'execute always', emit it.
+        // Determine what to emit for this operand.
         Record *OperandNode = II.OperandList[InstOpNo].Rec;
-        if ((!OperandNode->isSubClassOf("PredicateOperand") &&
-             !OperandNode->isSubClassOf("OptionalDefOperand")) ||
-            CGP.getDefaultOperand(OperandNode).DefaultOps.empty()) {
-          Ops = EmitResultCode(N->getChild(ChildNo), DstRegs,
-                               InFlagDecled, ResNodeDecled);
-          AllOps.insert(AllOps.end(), Ops.begin(), Ops.end());
-          ++ChildNo;
-        } else {
-          // Otherwise, this is a predicate or optional def operand, emit the
+        if ((OperandNode->isSubClassOf("PredicateOperand") ||
+             OperandNode->isSubClassOf("OptionalDefOperand")) &&
+            !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);
@@ -970,20 +1001,14 @@
             Ops = EmitResultCode(DefaultOp.DefaultOps[i], DstRegs,
                                  InFlagDecled, ResNodeDecled);
             AllOps.insert(AllOps.end(), Ops.begin(), Ops.end());
-            NumEAInputs += Ops.size();
           }
-        }
-      }
-
-      // Generate MemOperandSDNodes nodes for each memory accesses covered by 
-      // this pattern.
-      if (II.isSimpleLoad | II.mayLoad | II.mayStore) {
-        std::vector<std::string>::const_iterator mi, mie;
-        for (mi = LSI.begin(), mie = LSI.end(); mi != mie; ++mi) {
-          emitCode("SDOperand LSI_" + *mi + " = "
-                   "CurDAG->getMemOperand(cast<LSBaseSDNode>(" +
-                   *mi + ")->getMemOperand());");
-          AllOps.push_back("LSI_" + *mi);
+        } else {
+          // Otherwise this is a normal operand or a predicate operand without
+          // 'execute always'; emit it.
+          Ops = EmitResultCode(N->getChild(ChildNo), DstRegs,
+                               InFlagDecled, ResNodeDecled);
+          AllOps.insert(AllOps.end(), Ops.begin(), Ops.end());
+          ++ChildNo;
         }
       }
 
@@ -1040,7 +1065,7 @@
         for (unsigned i = 0; i < NumDstRegs; i++) {
           Record *RR = DstRegs[i];
           if (RR->isSubClassOf("Register")) {
-            MVT::ValueType RVT = getRegisterValueType(RR, CGT);
+            MVT::SimpleValueType RVT = getRegisterValueType(RR, CGT);
             Code += ", " + getEnumName(RVT);
           }
         }
@@ -1049,19 +1074,12 @@
         if (NodeHasOutFlag)
           Code += ", MVT::Flag";
 
-        // Figure out how many fixed inputs the node has.  This is important to
-        // know which inputs are the variable ones if present.
-        unsigned NumInputs = AllOps.size();
-        NumInputs += NodeHasChain;
-        
         // Inputs.
-        if (HasVarOps) {
+        if (IsVariadic) {
           for (unsigned i = 0, e = AllOps.size(); i != e; ++i)
             emitCode("Ops" + utostr(OpsNo) + ".push_back(" + AllOps[i] + ");");
           AllOps.clear();
-        }
 
-        if (HasVarOps) {
           // Figure out whether any operands at the end of the op list are not
           // part of the variable section.
           std::string EndAdjust;
@@ -1070,7 +1088,7 @@
           else if (NodeHasOptInFlag)
             EndAdjust = "-(HasInFlag?1:0)"; // May have a flag.
 
-          emitCode("for (unsigned i = " + utostr(NumInputs - NumEAInputs) +
+          emitCode("for (unsigned i = NumInputRootOps + " + utostr(NodeHasChain) +
                    ", e = N.getNumOperands()" + EndAdjust + "; i != e; ++i) {");
 
           emitCode("  AddToISelQueue(N.getOperand(i));");
@@ -1078,14 +1096,29 @@
           emitCode("}");
         }
 
+        // Generate MemOperandSDNodes nodes for each memory accesses covered by 
+        // this pattern.
+        if (II.isSimpleLoad | II.mayLoad | II.mayStore) {
+          std::vector<std::string>::const_iterator mi, mie;
+          for (mi = LSI.begin(), mie = LSI.end(); mi != mie; ++mi) {
+            emitCode("SDOperand LSI_" + *mi + " = "
+                     "CurDAG->getMemOperand(cast<MemSDNode>(" +
+                     *mi + ")->getMemOperand());");
+            if (IsVariadic)
+              emitCode("Ops" + utostr(OpsNo) + ".push_back(LSI_" + *mi + ");");
+            else
+              AllOps.push_back("LSI_" + *mi);
+          }
+        }
+
         if (NodeHasChain) {
-          if (HasVarOps)
+          if (IsVariadic)
             emitCode("Ops" + utostr(OpsNo) + ".push_back(" + ChainName + ");");
           else
             AllOps.push_back(ChainName);
         }
 
-        if (HasVarOps) {
+        if (IsVariadic) {
           if (NodeHasInFlag || HasImpInputs)
             emitCode("Ops" + utostr(OpsNo) + ".push_back(InFlag);");
           else if (NodeHasOptInFlag) {
@@ -1298,7 +1331,7 @@
 
           Record *RR = DI->getDef();
           if (RR->isSubClassOf("Register")) {
-            MVT::ValueType RVT = getRegisterValueType(RR, T);
+            MVT::SimpleValueType RVT = getRegisterValueType(RR, T);
             if (RVT == MVT::Flag) {
               if (!InFlagDecled) {
                 emitCode("SDOperand InFlag = " + RootName + utostr(OpNo) + ";");
@@ -1350,11 +1383,17 @@
                   std::vector<std::pair<unsigned, std::string> > &GeneratedCode,
                                            std::set<std::string> &GeneratedDecl,
                                         std::vector<std::string> &TargetOpcodes,
-                                          std::vector<std::string> &TargetVTs) {
+                                            std::vector<std::string> &TargetVTs,
+                                            bool &OutputIsVariadic,
+                                            unsigned &NumInputRootOps) {
+  OutputIsVariadic = false;
+  NumInputRootOps = 0;
+
   PatternCodeEmitter Emitter(CGP, Pattern.getPredicates(),
                              Pattern.getSrcPattern(), Pattern.getDstPattern(),
                              GeneratedCode, GeneratedDecl,
-                             TargetOpcodes, TargetVTs);
+                             TargetOpcodes, TargetVTs,
+                             OutputIsVariadic, NumInputRootOps);
 
   // Emit the matcher, capturing named arguments in VariableMap.
   bool FoundChain = false;
@@ -1532,10 +1571,6 @@
     OS << std::string(Indent-2, ' ') << "}\n";
 }
 
-static std::string getOpcodeName(Record *Op, CodeGenDAGPatterns &CGP) {
-  return CGP.getSDNodeInfo(Op).getEnumName();
-}
-
 static std::string getLegalCName(std::string OpName) {
   std::string::size_type pos = OpName.find("::");
   if (pos != std::string::npos)
@@ -1615,12 +1650,13 @@
                      PatternSortingPredicate(CGP));
 
     // Split them into groups by type.
-    std::map<MVT::ValueType, std::vector<const PatternToMatch*> >PatternsByType;
+    std::map<MVT::SimpleValueType,
+             std::vector<const PatternToMatch*> > PatternsByType;
     for (unsigned i = 0, e = PatternsOfOp.size(); i != e; ++i) {
       const PatternToMatch *Pat = PatternsOfOp[i];
       TreePatternNode *SrcPat = Pat->getSrcPattern();
-      MVT::ValueType VT = SrcPat->getTypeNum(0);
-      std::map<MVT::ValueType, 
+      MVT::SimpleValueType VT = SrcPat->getTypeNum(0);
+      std::map<MVT::SimpleValueType,
                std::vector<const PatternToMatch*> >::iterator TI = 
         PatternsByType.find(VT);
       if (TI != PatternsByType.end())
@@ -1632,10 +1668,11 @@
       }
     }
 
-    for (std::map<MVT::ValueType, std::vector<const PatternToMatch*> >::iterator
+    for (std::map<MVT::SimpleValueType,
+                  std::vector<const PatternToMatch*> >::iterator
            II = PatternsByType.begin(), EE = PatternsByType.end(); II != EE;
          ++II) {
-      MVT::ValueType OpVT = II->first;
+      MVT::SimpleValueType OpVT = II->first;
       std::vector<const PatternToMatch*> &Patterns = II->second;
       typedef std::vector<std::pair<unsigned,std::string> > CodeList;
       typedef std::vector<std::pair<unsigned,std::string> >::iterator CodeListI;
@@ -1644,17 +1681,24 @@
       std::vector<std::vector<std::string> > PatternOpcodes;
       std::vector<std::vector<std::string> > PatternVTs;
       std::vector<std::set<std::string> > PatternDecls;
+      std::vector<bool> OutputIsVariadicFlags;
+      std::vector<unsigned> NumInputRootOpsCounts;
       for (unsigned i = 0, e = Patterns.size(); i != e; ++i) {
         CodeList GeneratedCode;
         std::set<std::string> GeneratedDecl;
         std::vector<std::string> TargetOpcodes;
         std::vector<std::string> TargetVTs;
+        bool OutputIsVariadic;
+        unsigned NumInputRootOps;
         GenerateCodeForPattern(*Patterns[i], GeneratedCode, GeneratedDecl,
-                               TargetOpcodes, TargetVTs);
+                               TargetOpcodes, TargetVTs,
+                               OutputIsVariadic, NumInputRootOps);
         CodeForPatterns.push_back(std::make_pair(Patterns[i], GeneratedCode));
         PatternDecls.push_back(GeneratedDecl);
         PatternOpcodes.push_back(TargetOpcodes);
         PatternVTs.push_back(TargetVTs);
+        OutputIsVariadicFlags.push_back(OutputIsVariadic);
+        NumInputRootOpsCounts.push_back(NumInputRootOps);
       }
     
       // Scan the code to see if all of the patterns are reachable and if it is
@@ -1689,6 +1733,8 @@
         std::vector<std::string> &TargetOpcodes = PatternOpcodes[i];
         std::vector<std::string> &TargetVTs = PatternVTs[i];
         std::set<std::string> Decls = PatternDecls[i];
+        bool OutputIsVariadic = OutputIsVariadicFlags[i];
+        unsigned NumInputRootOps = NumInputRootOpsCounts[i];
         std::vector<std::string> AddedInits;
         int CodeSize = (int)GeneratedCode.size();
         int LastPred = -1;
@@ -1706,7 +1752,7 @@
           CallerCode += ", " + TargetOpcodes[j];
         }
         for (unsigned j = 0, e = TargetVTs.size(); j != e; ++j) {
-          CalleeCode += ", MVT::ValueType VT" + utostr(j);
+          CalleeCode += ", MVT VT" + utostr(j);
           CallerCode += ", " + TargetVTs[j];
         }
         for (std::set<std::string>::iterator
@@ -1715,6 +1761,12 @@
           CalleeCode += ", SDOperand &" + Name;
           CallerCode += ", " + Name;
         }
+
+        if (OutputIsVariadic) {
+          CalleeCode += ", unsigned NumInputRootOps";
+          CallerCode += ", " + utostr(NumInputRootOps);
+        }
+
         CallerCode += ");";
         CalleeCode += ") ";
         // Prevent emission routines from being inlined to reduce selection
@@ -1818,7 +1870,7 @@
      << "  for (unsigned j = 0, e = Ops.size(); j != e; ++j)\n"
      << "    AddToISelQueue(Ops[j]);\n\n"
     
-     << "  std::vector<MVT::ValueType> VTs;\n"
+     << "  std::vector<MVT> VTs;\n"
      << "  VTs.push_back(MVT::Other);\n"
      << "  VTs.push_back(MVT::Flag);\n"
      << "  SDOperand New = CurDAG->getNode(ISD::INLINEASM, VTs, &Ops[0], "
@@ -1827,22 +1879,26 @@
      << "}\n\n";
 
   OS << "SDNode *Select_UNDEF(const SDOperand &N) {\n"
-     << "  return CurDAG->getTargetNode(TargetInstrInfo::IMPLICIT_DEF,\n"
-     << "                               N.getValueType());\n"
+     << "  return CurDAG->SelectNodeTo(N.Val, TargetInstrInfo::IMPLICIT_DEF,\n"
+     << "                              N.getValueType());\n"
      << "}\n\n";
 
-  OS << "SDNode *Select_LABEL(const SDOperand &N) {\n"
+  OS << "SDNode *Select_DBG_LABEL(const SDOperand &N) {\n"
      << "  SDOperand Chain = N.getOperand(0);\n"
-     << "  SDOperand N1 = N.getOperand(1);\n"
-     << "  SDOperand N2 = N.getOperand(2);\n"
-     << "  unsigned C1 = cast<ConstantSDNode>(N1)->getValue();\n"
-     << "  unsigned C2 = cast<ConstantSDNode>(N2)->getValue();\n"
-     << "  SDOperand Tmp1 = CurDAG->getTargetConstant(C1, MVT::i32);\n"
-     << "  SDOperand Tmp2 = CurDAG->getTargetConstant(C2, MVT::i32);\n"
+     << "  unsigned C = cast<LabelSDNode>(N)->getLabelID();\n"
+     << "  SDOperand Tmp = CurDAG->getTargetConstant(C, MVT::i32);\n"
      << "  AddToISelQueue(Chain);\n"
-     << "  SDOperand Ops[] = { Tmp1, Tmp2, Chain };\n"
-     << "  return CurDAG->getTargetNode(TargetInstrInfo::LABEL,\n"
-     << "                               MVT::Other, Ops, 3);\n"
+     << "  return CurDAG->SelectNodeTo(N.Val, TargetInstrInfo::DBG_LABEL,\n"
+     << "                              MVT::Other, Tmp, Chain);\n"
+     << "}\n\n";
+
+  OS << "SDNode *Select_EH_LABEL(const SDOperand &N) {\n"
+     << "  SDOperand Chain = N.getOperand(0);\n"
+     << "  unsigned C = cast<LabelSDNode>(N)->getLabelID();\n"
+     << "  SDOperand Tmp = CurDAG->getTargetConstant(C, MVT::i32);\n"
+     << "  AddToISelQueue(Chain);\n"
+     << "  return CurDAG->SelectNodeTo(N.Val, TargetInstrInfo::EH_LABEL,\n"
+     << "                              MVT::Other, Tmp, Chain);\n"
      << "}\n\n";
 
   OS << "SDNode *Select_DECLARE(const SDOperand &N) {\n"
@@ -1861,9 +1917,8 @@
      << "  SDOperand Tmp2 = "
      << "CurDAG->getTargetGlobalAddress(GV, TLI.getPointerTy());\n"
      << "  AddToISelQueue(Chain);\n"
-     << "  SDOperand Ops[] = { Tmp1, Tmp2, Chain };\n"
-     << "  return CurDAG->getTargetNode(TargetInstrInfo::DECLARE,\n"
-     << "                               MVT::Other, Ops, 3);\n"
+     << "  return CurDAG->SelectNodeTo(N.Val, TargetInstrInfo::DECLARE,\n"
+     << "                              MVT::Other, Tmp1, Tmp2, Chain);\n"
      << "}\n\n";
 
   OS << "SDNode *Select_EXTRACT_SUBREG(const SDOperand &N) {\n"
@@ -1872,9 +1927,8 @@
      << "  unsigned C = cast<ConstantSDNode>(N1)->getValue();\n"
      << "  SDOperand Tmp = CurDAG->getTargetConstant(C, MVT::i32);\n"
      << "  AddToISelQueue(N0);\n"
-     << "  SDOperand Ops[] = { N0, Tmp };\n"
-     << "  return CurDAG->getTargetNode(TargetInstrInfo::EXTRACT_SUBREG,\n"
-     << "                               N.getValueType(), Ops, 2);\n"
+     << "  return CurDAG->SelectNodeTo(N.Val, TargetInstrInfo::EXTRACT_SUBREG,\n"
+     << "                              N.getValueType(), N0, Tmp);\n"
      << "}\n\n";
 
   OS << "SDNode *Select_INSERT_SUBREG(const SDOperand &N) {\n"
@@ -1884,10 +1938,9 @@
      << "  unsigned C = cast<ConstantSDNode>(N2)->getValue();\n"
      << "  SDOperand Tmp = CurDAG->getTargetConstant(C, MVT::i32);\n"
      << "  AddToISelQueue(N1);\n"
-     << "  SDOperand Ops[] = { N0, N1, Tmp };\n"
      << "  AddToISelQueue(N0);\n"
-     << "  return CurDAG->getTargetNode(TargetInstrInfo::INSERT_SUBREG,\n"
-     << "                               N.getValueType(), Ops, 3);\n"
+     << "  return CurDAG->SelectNodeTo(N.Val, TargetInstrInfo::INSERT_SUBREG,\n"
+     << "                              N.getValueType(), N0, N1, Tmp);\n"
      << "}\n\n";
 
   OS << "// The main instruction selector code.\n"
@@ -1897,7 +1950,7 @@
      << "INSTRUCTION_LIST_END)) {\n"
      << "    return NULL;   // Already selected.\n"
      << "  }\n\n"
-     << "  MVT::ValueType NVT = N.Val->getValueType(0);\n"
+     << "  MVT::SimpleValueType NVT = N.Val->getValueType(0).getSimpleVT();\n"
      << "  switch (N.getOpcode()) {\n"
      << "  default: break;\n"
      << "  case ISD::EntryToken:       // These leaves remain the same.\n"
@@ -1928,7 +1981,8 @@
      << "    return NULL;\n"
      << "  }\n"
      << "  case ISD::INLINEASM: return Select_INLINEASM(N);\n"
-     << "  case ISD::LABEL: return Select_LABEL(N);\n"
+     << "  case ISD::DBG_LABEL: return Select_DBG_LABEL(N);\n"
+     << "  case ISD::EH_LABEL: return Select_EH_LABEL(N);\n"
      << "  case ISD::DECLARE: return Select_DECLARE(N);\n"
      << "  case ISD::EXTRACT_SUBREG: return Select_EXTRACT_SUBREG(N);\n"
      << "  case ISD::INSERT_SUBREG: return Select_INSERT_SUBREG(N);\n"
@@ -1974,7 +2028,7 @@
       
     // If there is an iPTR result version of this pattern, emit it here.
     if (HasPtrPattern) {
-      OS << "      if (NVT == TLI.getPointerTy())\n";
+      OS << "      if (TLI.getPointerTy() == NVT)\n";
       OS << "        return Select_" << getLegalCName(OpName) <<"_iPTR(N);\n";
     }
     if (HasDefaultPattern) {
@@ -2011,147 +2065,10 @@
   OS << "// *** NOTE: This file is #included into the middle of the target\n"
      << "// *** instruction selector class.  These functions are really "
      << "methods.\n\n";
-  
-  OS << "// Instruction selector priority queue:\n"
-     << "std::vector<SDNode*> ISelQueue;\n";
-  OS << "/// Keep track of nodes which have already been added to queue.\n"
-     << "unsigned char *ISelQueued;\n";
-  OS << "/// Keep track of nodes which have already been selected.\n"
-     << "unsigned char *ISelSelected;\n";
-
-
-  OS << "/// IsChainCompatible - Returns true if Chain is Op or Chain does\n";
-  OS << "/// not reach Op.\n";
-  OS << "static bool IsChainCompatible(SDNode *Chain, SDNode *Op) {\n";
-  OS << "  if (Chain->getOpcode() == ISD::EntryToken)\n";
-  OS << "    return true;\n";
-  OS << "  else if (Chain->getOpcode() == ISD::TokenFactor)\n";
-  OS << "    return false;\n";
-  OS << "  else if (Chain->getNumOperands() > 0) {\n";
-  OS << "    SDOperand C0 = Chain->getOperand(0);\n";
-  OS << "    if (C0.getValueType() == MVT::Other)\n";
-  OS << "      return C0.Val != Op && IsChainCompatible(C0.Val, Op);\n";
-  OS << "  }\n";
-  OS << "  return true;\n";
-  OS << "}\n";
-
-  OS << "/// Sorting functions for the selection queue.\n"
-     << "struct isel_sort : public std::binary_function"
-     << "<SDNode*, SDNode*, bool> {\n"
-     << "  bool operator()(const SDNode* left, const SDNode* right) "
-     << "const {\n"
-     << "    return (left->getNodeId() > right->getNodeId());\n"
-     << "  }\n"
-     << "};\n\n";
 
-  OS << "inline void setQueued(int Id) {\n";
-  OS << "  ISelQueued[Id / 8] |= 1 << (Id % 8);\n";
-  OS << "}\n";
-  OS << "inline bool isQueued(int Id) {\n";
-  OS << "  return ISelQueued[Id / 8] & (1 << (Id % 8));\n";
-  OS << "}\n";
-  OS << "inline void setSelected(int Id) {\n";
-  OS << "  ISelSelected[Id / 8] |= 1 << (Id % 8);\n";
-  OS << "}\n";
-  OS << "inline bool isSelected(int Id) {\n";
-  OS << "  return ISelSelected[Id / 8] & (1 << (Id % 8));\n";
-  OS << "}\n\n";
-
-  OS << "void AddToISelQueue(SDOperand N) DISABLE_INLINE {\n";
-  OS << "  int Id = N.Val->getNodeId();\n";
-  OS << "  if (Id != -1 && !isQueued(Id)) {\n";
-  OS << "    ISelQueue.push_back(N.Val);\n";
- OS << "    std::push_heap(ISelQueue.begin(), ISelQueue.end(), isel_sort());\n";
-  OS << "    setQueued(Id);\n";
-  OS << "  }\n";
-  OS << "}\n\n";
-
-  
-  OS << "class VISIBILITY_HIDDEN ISelQueueUpdater :\n";
-  OS << "  public SelectionDAG::DAGUpdateListener {\n";
-  OS << "    std::vector<SDNode*> &ISelQueue;\n";
-  OS << "    bool HadDelete;\n";
-  OS << "  public:\n";
-  OS << "    explicit ISelQueueUpdater(std::vector<SDNode*> &isq)\n";
-  OS << "      : ISelQueue(isq), HadDelete(false) {}\n";
-  OS << "    \n";
-  OS << "    bool hadDelete() const { return HadDelete; }\n";
-  OS << "    \n";
-  OS << "    virtual void NodeDeleted(SDNode *N) {\n";
-  OS << "      ISelQueue.erase(std::remove(ISelQueue.begin(), ISelQueue.end(),";
-  OS << " N),\n                      ISelQueue.end());\n";
-  OS << "      HadDelete = true;\n";
-  OS << "    }\n";
-  OS << "    \n";
-  OS << "    // Ignore updates.\n";
-  OS << "    virtual void NodeUpdated(SDNode *N) {}\n";
-  OS << "  };\n";
-  
-  OS << "inline void UpdateQueue(const ISelQueueUpdater &ISQU) {\n";
-  OS << "  if (ISQU.hadDelete())\n";
-  OS << "    std::make_heap(ISelQueue.begin(), ISelQueue.end(),isel_sort());\n";
-  OS << "}\n\n";
-
-  OS << "void ReplaceUses(SDOperand F, SDOperand T) DISABLE_INLINE {\n";
-  OS << "  ISelQueueUpdater ISQU(ISelQueue);\n";
-  OS << "  CurDAG->ReplaceAllUsesOfValueWith(F, T, &ISQU);\n";
-  OS << "  setSelected(F.Val->getNodeId());\n";
-  OS << "  UpdateQueue(ISQU);\n";
-  OS << "}\n";
-  OS << "void ReplaceUses(SDNode *F, SDNode *T) DISABLE_INLINE {\n";
-  OS << "  unsigned FNumVals = F->getNumValues();\n";
-  OS << "  unsigned TNumVals = T->getNumValues();\n";
-  OS << "  ISelQueueUpdater ISQU(ISelQueue);\n";
-  OS << "  if (FNumVals != TNumVals) {\n";
-  OS << "    for (unsigned i = 0, e = std::min(FNumVals, TNumVals); "
-     << "i < e; ++i)\n";
-  OS << "      CurDAG->ReplaceAllUsesOfValueWith(SDOperand(F, i), "
-     << "SDOperand(T, i), &ISQU);\n";
-  OS << "  } else {\n";
-  OS << "    CurDAG->ReplaceAllUsesWith(F, T, &ISQU);\n";
-  OS << "  }\n";
-  OS << "  setSelected(F->getNodeId());\n";
-  OS << "  UpdateQueue(ISQU);\n";
-  OS << "}\n\n";
-
-  OS << "// SelectRoot - Top level entry to DAG isel.\n";
-  OS << "SDOperand SelectRoot(SDOperand Root) {\n";
-  OS << "  SelectRootInit();\n";
-  OS << "  unsigned NumBytes = (DAGSize + 7) / 8;\n";
-  OS << "  ISelQueued   = new unsigned char[NumBytes];\n";
-  OS << "  ISelSelected = new unsigned char[NumBytes];\n";
-  OS << "  memset(ISelQueued,   0, NumBytes);\n";
-  OS << "  memset(ISelSelected, 0, NumBytes);\n";
-  OS << "\n";
-  OS << "  // Create a dummy node (which is not added to allnodes), that adds\n"
-     << "  // a reference to the root node, preventing it from being deleted,\n"
-     << "  // and tracking any changes of the root.\n"
-     << "  HandleSDNode Dummy(CurDAG->getRoot());\n"
-     << "  ISelQueue.push_back(CurDAG->getRoot().Val);\n";
-  OS << "  while (!ISelQueue.empty()) {\n";
-  OS << "    SDNode *Node = ISelQueue.front();\n";
-  OS << "    std::pop_heap(ISelQueue.begin(), ISelQueue.end(), isel_sort());\n";
-  OS << "    ISelQueue.pop_back();\n";
-  OS << "    if (!isSelected(Node->getNodeId())) {\n";
-  OS << "      SDNode *ResNode = Select(SDOperand(Node, 0));\n";
-  OS << "      if (ResNode != Node) {\n";
-  OS << "        if (ResNode)\n";
-  OS << "          ReplaceUses(Node, ResNode);\n";
-  OS << "        if (Node->use_empty()) { // Don't delete EntryToken, etc.\n";
-  OS << "          ISelQueueUpdater ISQU(ISelQueue);\n";
-  OS << "          CurDAG->RemoveDeadNode(Node, &ISQU);\n";
-  OS << "          UpdateQueue(ISQU);\n";
-  OS << "        }\n";
-  OS << "      }\n";
-  OS << "    }\n";
-  OS << "  }\n";
-  OS << "\n";
-  OS << "  delete[] ISelQueued;\n";
-  OS << "  ISelQueued = NULL;\n";
-  OS << "  delete[] ISelSelected;\n";
-  OS << "  ISelSelected = NULL;\n";
-  OS << "  return Dummy.getValue();\n";
-  OS << "}\n";
+  OS << "// Include standard, target-independent definitions and methods used\n"
+     << "// by the instruction selector.\n";
+  OS << "#include <llvm/CodeGen/DAGISelHeader.h>\n\n";
   
   EmitNodeTransforms(OS);
   EmitPredicateFunctions(OS);

Modified: llvm/branches/non-call-eh/utils/TableGen/DAGISelEmitter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/utils/TableGen/DAGISelEmitter.h?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/utils/TableGen/DAGISelEmitter.h (original)
+++ llvm/branches/non-call-eh/utils/TableGen/DAGISelEmitter.h Sun Jul  6 15:45:41 2008
@@ -41,7 +41,9 @@
                   std::vector<std::pair<unsigned, std::string> > &GeneratedCode,
                               std::set<std::string> &GeneratedDecl,
                               std::vector<std::string> &TargetOpcodes,
-                              std::vector<std::string> &TargetVTs);
+                              std::vector<std::string> &TargetVTs,
+                              bool &OutputIsVariadic,
+                              unsigned &NumInputRootOps);
   void EmitPatterns(std::vector<std::pair<const PatternToMatch*, 
                   std::vector<std::pair<unsigned, std::string> > > > &Patterns, 
                     unsigned Indent, std::ostream &OS);

Modified: llvm/branches/non-call-eh/utils/TableGen/InstrInfoEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/utils/TableGen/InstrInfoEmitter.cpp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/utils/TableGen/InstrInfoEmitter.cpp (original)
+++ llvm/branches/non-call-eh/utils/TableGen/InstrInfoEmitter.cpp Sun Jul  6 15:45:41 2008
@@ -201,33 +201,34 @@
     // Each logical operand can be multiple MI operands.
     MinOperands = Inst.OperandList.back().MIOperandNo +
                   Inst.OperandList.back().MINumOperands;
-  
+
   OS << "  { ";
   OS << Num << ",\t" << MinOperands << ",\t"
      << Inst.NumDefs << ",\t" << getItinClassNumber(Inst.TheDef)
      << ",\t\"" << Inst.TheDef->getName() << "\", 0";
 
   // Emit all of the target indepedent flags...
-  if (Inst.isReturn)     OS << "|(1<<TID::Return)";
-  if (Inst.isBranch)     OS << "|(1<<TID::Branch)";
-  if (Inst.isIndirectBranch) OS << "|(1<<TID::IndirectBranch)";
-  if (Inst.isBarrier)    OS << "|(1<<TID::Barrier)";
-  if (Inst.hasDelaySlot) OS << "|(1<<TID::DelaySlot)";
-  if (Inst.isCall)       OS << "|(1<<TID::Call)";
-  if (Inst.isSimpleLoad) OS << "|(1<<TID::SimpleLoad)";
-  if (Inst.mayLoad)      OS << "|(1<<TID::MayLoad)";
-  if (Inst.mayStore)     OS << "|(1<<TID::MayStore)";
-  if (Inst.isPredicable) OS << "|(1<<TID::Predicable)";
+  if (Inst.isReturn)           OS << "|(1<<TID::Return)";
+  if (Inst.isBranch)           OS << "|(1<<TID::Branch)";
+  if (Inst.isIndirectBranch)   OS << "|(1<<TID::IndirectBranch)";
+  if (Inst.isBarrier)          OS << "|(1<<TID::Barrier)";
+  if (Inst.hasDelaySlot)       OS << "|(1<<TID::DelaySlot)";
+  if (Inst.isCall)             OS << "|(1<<TID::Call)";
+  if (Inst.isSimpleLoad)       OS << "|(1<<TID::SimpleLoad)";
+  if (Inst.mayLoad)            OS << "|(1<<TID::MayLoad)";
+  if (Inst.mayStore)           OS << "|(1<<TID::MayStore)";
+  if (Inst.isPredicable)       OS << "|(1<<TID::Predicable)";
   if (Inst.isConvertibleToThreeAddress) OS << "|(1<<TID::ConvertibleTo3Addr)";
-  if (Inst.isCommutable) OS << "|(1<<TID::Commutable)";
-  if (Inst.isTerminator) OS << "|(1<<TID::Terminator)";
+  if (Inst.isCommutable)       OS << "|(1<<TID::Commutable)";
+  if (Inst.isTerminator)       OS << "|(1<<TID::Terminator)";
   if (Inst.isReMaterializable) OS << "|(1<<TID::Rematerializable)";
   if (Inst.isNotDuplicable)    OS << "|(1<<TID::NotDuplicable)";
   if (Inst.hasOptionalDef)     OS << "|(1<<TID::HasOptionalDef)";
   if (Inst.usesCustomDAGSchedInserter)
     OS << "|(1<<TID::UsesCustomDAGSchedInserter)";
   if (Inst.isVariadic)         OS << "|(1<<TID::Variadic)";
-  if (Inst.hasSideEffects)          OS << "|(1<<TID::UnmodeledSideEffects)";
+  if (Inst.hasSideEffects)     OS << "|(1<<TID::UnmodeledSideEffects)";
+  if (Inst.isAsCheapAsAMove)   OS << "|(1<<TID::CheapAsAMove)";
   OS << ", 0";
 
   // Emit all of the target-specific flags...
@@ -278,7 +279,9 @@
     // This isn't an error if this is a builtin instruction.
     if (R->getName() != "PHI" &&
         R->getName() != "INLINEASM" &&
-        R->getName() != "LABEL" &&
+        R->getName() != "DBG_LABEL" &&
+        R->getName() != "EH_LABEL" &&
+        R->getName() != "GC_LABEL" &&
         R->getName() != "DECLARE" &&
         R->getName() != "EXTRACT_SUBREG" &&
         R->getName() != "INSERT_SUBREG" &&

Modified: llvm/branches/non-call-eh/utils/TableGen/IntrinsicEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/utils/TableGen/IntrinsicEmitter.cpp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/utils/TableGen/IntrinsicEmitter.cpp (original)
+++ llvm/branches/non-call-eh/utils/TableGen/IntrinsicEmitter.cpp Sun Jul  6 15:45:41 2008
@@ -114,9 +114,9 @@
   OS << "#endif\n\n";
 }
 
-static void EmitTypeForValueType(std::ostream &OS, MVT::ValueType VT) {
-  if (MVT::isInteger(VT)) {
-    unsigned BitWidth = MVT::getSizeInBits(VT);
+static void EmitTypeForValueType(std::ostream &OS, MVT::SimpleValueType VT) {
+  if (MVT(VT).isInteger()) {
+    unsigned BitWidth = MVT(VT).getSizeInBits();
     OS << "IntegerType::get(" << BitWidth << ")";
   } else if (VT == MVT::Other) {
     // MVT::OtherVT is used to mean the empty struct type here.
@@ -140,7 +140,7 @@
 
 static void EmitTypeGenerate(std::ostream &OS, Record *ArgType, 
                              unsigned &ArgNo) {
-  MVT::ValueType VT = getValueType(ArgType->getValueAsDef("VT"));
+  MVT::SimpleValueType VT = getValueType(ArgType->getValueAsDef("VT"));
 
   if (ArgType->isSubClassOf("LLVMMatchType")) {
     unsigned Number = ArgType->getValueAsInt("Number");
@@ -153,10 +153,11 @@
     // increment it when we actually hit an overloaded type. Getting this wrong
     // leads to very subtle bugs!
     OS << "Tys[" << ArgNo++ << "]";
-  } else if (MVT::isVector(VT)) {
+  } else if (MVT(VT).isVector()) {
+    MVT VVT = VT;
     OS << "VectorType::get(";
-    EmitTypeForValueType(OS, MVT::getVectorElementType(VT));
-    OS << ", " << MVT::getVectorNumElements(VT) << ")";
+    EmitTypeForValueType(OS, VVT.getVectorElementType().getSimpleVT());
+    OS << ", " << VVT.getVectorNumElements() << ")";
   } else if (VT == MVT::iPTR) {
     OS << "PointerType::getUnqual(";
     EmitTypeGenerate(OS, ArgType->getValueAsDef("ElTy"), ArgNo);
@@ -225,7 +226,7 @@
         assert(Number < j && "Invalid matching number!");
         OS << "~" << Number;
       } else {
-        MVT::ValueType VT = getValueType(ArgType->getValueAsDef("VT"));
+        MVT::SimpleValueType VT = getValueType(ArgType->getValueAsDef("VT"));
         OS << getEnumName(VT);
         if (VT == MVT::isVoid && j != 0 && j != ArgTypes.size()-1)
           throw "Var arg type not last argument";

Removed: llvm/branches/non-call-eh/utils/TableGen/LLVMCCConfigurationEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/utils/TableGen/LLVMCCConfigurationEmitter.cpp?rev=53162&view=auto

==============================================================================
--- llvm/branches/non-call-eh/utils/TableGen/LLVMCCConfigurationEmitter.cpp (original)
+++ llvm/branches/non-call-eh/utils/TableGen/LLVMCCConfigurationEmitter.cpp (removed)
@@ -1,935 +0,0 @@
-//===- LLVMCConfigurationEmitter.cpp - Generate LLVMCC config -------------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open
-// Source License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This tablegen backend is responsible for emitting LLVMCC configuration code.
-//
-//===----------------------------------------------------------------------===//
-
-#include "LLVMCCConfigurationEmitter.h"
-#include "Record.h"
-
-#include "llvm/ADT/IntrusiveRefCntPtr.h"
-#include "llvm/ADT/SmallVector.h"
-#include "llvm/ADT/StringExtras.h"
-#include "llvm/ADT/StringMap.h"
-#include "llvm/Support/Streams.h"
-
-#include <algorithm>
-#include <cassert>
-#include <functional>
-#include <string>
-
-using namespace llvm;
-
-namespace {
-
-//===----------------------------------------------------------------------===//
-/// Typedefs
-
-typedef std::vector<Record*> RecordVector;
-typedef std::vector<std::string> StrVector;
-
-//===----------------------------------------------------------------------===//
-/// Constants
-
-// Indentation strings
-const char * Indent1 = "    ";
-const char * Indent2 = "        ";
-const char * Indent3 = "            ";
-const char * Indent4 = "                ";
-
-// Default help string
-const char * DefaultHelpString = "NO HELP MESSAGE PROVIDED";
-
-// Name for the "sink" option
-const char * SinkOptionName = "AutoGeneratedSinkOption";
-
-//===----------------------------------------------------------------------===//
-/// Helper functions
-
-std::string InitPtrToString(Init* ptr) {
-  StringInit& val = dynamic_cast<StringInit&>(*ptr);
-  return val.getValue();
-}
-
-//===----------------------------------------------------------------------===//
-/// Back-end specific code
-
-// A command-line option can have one of the following types:
-//
-// Switch - a simple switch w/o arguments, e.g. -O2
-//
-// Parameter - an option that takes one(and only one) argument, e.g. -o file,
-// --output=file
-//
-// ParameterList - same as Parameter, but more than one occurence
-// of the option is allowed, e.g. -lm -lpthread
-//
-// Prefix - argument is everything after the prefix,
-// e.g. -Wa,-foo,-bar, -DNAME=VALUE
-//
-// PrefixList - same as Prefix, but more than one option occurence is
-// allowed
-
-namespace OptionType {
-  enum OptionType { Switch, Parameter, ParameterList, Prefix, PrefixList};
-}
-
-bool IsListOptionType (OptionType::OptionType t) {
-  return (t == OptionType::ParameterList || t == OptionType::PrefixList);
-}
-
-// Code duplication here is necessary because one option can affect
-// several tools and those tools may have different actions associated
-// with this option. GlobalOptionDescriptions are used to generate
-// the option registration code, while ToolOptionDescriptions are used
-// to generate tool-specific code.
-
-// Base class for option descriptions
-
-struct OptionDescription {
-  OptionType::OptionType Type;
-  std::string Name;
-
-  OptionDescription(OptionType::OptionType t = OptionType::Switch,
-                    const std::string& n = "")
-  : Type(t), Name(n)
-  {}
-
-  const char* GenTypeDeclaration() const {
-    switch (Type) {
-    case OptionType::PrefixList:
-    case OptionType::ParameterList:
-      return "cl::list<std::string>";
-    case OptionType::Switch:
-      return "cl::opt<bool>";
-    case OptionType::Parameter:
-    case OptionType::Prefix:
-    default:
-      return "cl::opt<std::string>";
-    }
-  }
-
-  std::string GenVariableName() const {
-    switch (Type) {
-    case OptionType::Switch:
-     return "AutoGeneratedSwitch" + Name;
-   case OptionType::Prefix:
-     return "AutoGeneratedPrefix" + Name;
-   case OptionType::PrefixList:
-     return "AutoGeneratedPrefixList" + Name;
-   case OptionType::Parameter:
-     return "AutoGeneratedParameter" + Name;
-   case OptionType::ParameterList:
-   default:
-     return "AutoGeneratedParameterList" + Name;
-   }
-  }
-
-};
-
-// Global option description
-
-namespace GlobalOptionDescriptionFlags {
-  enum GlobalOptionDescriptionFlags { Required = 0x1 };
-}
-
-struct GlobalOptionDescription : public OptionDescription {
-  std::string Help;
-  unsigned Flags;
-
-  // StringMap can only store DefaultConstructible objects
-  GlobalOptionDescription() : OptionDescription(), Flags(0)
-  {}
-
-  GlobalOptionDescription (OptionType::OptionType t, const std::string& n)
-    : OptionDescription(t, n), Help(DefaultHelpString), Flags(0)
-  {}
-
-  bool isRequired() const {
-    return Flags & GlobalOptionDescriptionFlags::Required;
-  }
-  void setRequired() {
-    Flags |= GlobalOptionDescriptionFlags::Required;
-  }
-
-  // Merge two option descriptions
-  void Merge (const GlobalOptionDescription& other)
-  {
-    if (other.Type != Type)
-      throw "Conflicting definitions for the option " + Name + "!";
-
-    if (Help.empty() && !other.Help.empty())
-      Help = other.Help;
-    else if (!Help.empty() && !other.Help.empty())
-      cerr << "Warning: more than one help string defined for option "
-        + Name + "\n";
-
-    Flags |= other.Flags;
-  }
-};
-
-// A GlobalOptionDescription array
-// + some flags affecting generation of option declarations
-struct GlobalOptionDescriptions {
-  typedef StringMap<GlobalOptionDescription> container_type;
-  typedef container_type::const_iterator const_iterator;
-
-  // A list of GlobalOptionDescriptions
-  container_type Descriptions;
-  // Should the emitter generate a "cl::sink" option?
-  bool HasSink;
-
-  // Support for STL-style iteration
-  const_iterator begin() const { return Descriptions.begin(); }
-  const_iterator end() const { return Descriptions.end(); }
-};
-
-
-// Tool-local option description
-
-// Properties without arguments are implemented as flags
-namespace ToolOptionDescriptionFlags {
-  enum ToolOptionDescriptionFlags { StopCompilation = 0x1,
-                                    Forward = 0x2, UnpackValues = 0x4};
-}
-namespace OptionPropertyType {
-  enum OptionPropertyType { AppendCmd };
-}
-
-typedef std::pair<OptionPropertyType::OptionPropertyType, std::string>
-OptionProperty;
-typedef SmallVector<OptionProperty, 4> OptionPropertyList;
-
-struct ToolOptionDescription : public OptionDescription {
-  unsigned Flags;
-  OptionPropertyList Props;
-
-  // StringMap can only store DefaultConstructible objects
-  ToolOptionDescription() : OptionDescription(), Flags(0) {}
-
-  ToolOptionDescription (OptionType::OptionType t, const std::string& n)
-    : OptionDescription(t, n)
-  {}
-
-  // Various boolean properties
-  bool isStopCompilation() const {
-    return Flags & ToolOptionDescriptionFlags::StopCompilation;
-  }
-  void setStopCompilation() {
-    Flags |= ToolOptionDescriptionFlags::StopCompilation;
-  }
-
-  bool isForward() const {
-    return Flags & ToolOptionDescriptionFlags::Forward;
-  }
-  void setForward() {
-    Flags |= ToolOptionDescriptionFlags::Forward;
-  }
-
-  bool isUnpackValues() const {
-    return Flags & ToolOptionDescriptionFlags::UnpackValues;
-  }
-  void setUnpackValues() {
-    Flags |= ToolOptionDescriptionFlags::UnpackValues;
-  }
-
-  void AddProperty (OptionPropertyType::OptionPropertyType t,
-                    const std::string& val)
-  {
-    Props.push_back(std::make_pair(t, val));
-  }
-};
-
-typedef StringMap<ToolOptionDescription> ToolOptionDescriptions;
-
-// Tool information record
-
-namespace ToolFlags {
-  enum ToolFlags { Join = 0x1, Sink = 0x2 };
-}
-
-struct ToolProperties : public RefCountedBase<ToolProperties> {
-  std::string Name;
-  StrVector CmdLine;
-  std::string InLanguage;
-  std::string OutLanguage;
-  std::string OutputSuffix;
-  unsigned Flags;
-  ToolOptionDescriptions OptDescs;
-
-  // Various boolean properties
-  void setSink()      { Flags |= ToolFlags::Sink; }
-  bool isSink() const { return Flags & ToolFlags::Sink; }
-  void setJoin()      { Flags |= ToolFlags::Join; }
-  bool isJoin() const { return Flags & ToolFlags::Join; }
-
-  // Default ctor here is needed because StringMap can only store
-  // DefaultConstructible objects
-  ToolProperties() {}
-  ToolProperties (const std::string& n) : Name(n) {}
-};
-
-
-// A list of Tool information records
-// IntrusiveRefCntPtrs are used because StringMap has no copy constructor
-// (and we want to avoid copying ToolProperties anyway)
-typedef std::vector<IntrusiveRefCntPtr<ToolProperties> > ToolPropertiesList;
-
-
-// Function object for iterating over a list of tool property records
-class CollectProperties {
-private:
-
-  /// Implementation details
-
-  // "Property handler" - a function that extracts information
-  // about a given tool property from its DAG representation
-  typedef void (CollectProperties::*PropertyHandler)(DagInit*);
-
-  // Map from property names -> property handlers
-  typedef StringMap<PropertyHandler> PropertyHandlerMap;
-
-  // "Option property handler" - a function that extracts information
-  // about a given option property from its DAG representation
-  typedef void (CollectProperties::*
-                OptionPropertyHandler)(DagInit*, GlobalOptionDescription &);
-
-  // Map from option property names -> option property handlers
-  typedef StringMap<OptionPropertyHandler> OptionPropertyHandlerMap;
-
-  // Static maps from strings to CollectProperties methods("handlers")
-  static PropertyHandlerMap propertyHandlers_;
-  static OptionPropertyHandlerMap optionPropertyHandlers_;
-  static bool staticMembersInitialized_;
-
-
-  /// This is where the information is stored
-
-  // Current Tool properties
-  ToolProperties& toolProps_;
-  // OptionDescriptions table(used to register options globally)
-  GlobalOptionDescriptions& optDescs_;
-
-public:
-
-  explicit CollectProperties (ToolProperties& p, GlobalOptionDescriptions& d)
-    : toolProps_(p), optDescs_(d)
-  {
-    if (!staticMembersInitialized_) {
-      // Init tool property handlers
-      propertyHandlers_["cmd_line"] = &CollectProperties::onCmdLine;
-      propertyHandlers_["in_language"] = &CollectProperties::onInLanguage;
-      propertyHandlers_["join"] = &CollectProperties::onJoin;
-      propertyHandlers_["out_language"] = &CollectProperties::onOutLanguage;
-      propertyHandlers_["output_suffix"] = &CollectProperties::onOutputSuffix;
-      propertyHandlers_["parameter_option"]
-        = &CollectProperties::onParameter;
-      propertyHandlers_["parameter_list_option"] =
-        &CollectProperties::onParameterList;
-      propertyHandlers_["prefix_option"] = &CollectProperties::onPrefix;
-      propertyHandlers_["prefix_list_option"] =
-        &CollectProperties::onPrefixList;
-      propertyHandlers_["sink"] = &CollectProperties::onSink;
-      propertyHandlers_["switch_option"] = &CollectProperties::onSwitch;
-
-      // Init option property handlers
-      optionPropertyHandlers_["append_cmd"] = &CollectProperties::onAppendCmd;
-      optionPropertyHandlers_["forward"] = &CollectProperties::onForward;
-      optionPropertyHandlers_["help"] = &CollectProperties::onHelp;
-      optionPropertyHandlers_["required"] = &CollectProperties::onRequired;
-      optionPropertyHandlers_["stop_compilation"] =
-        &CollectProperties::onStopCompilation;
-      optionPropertyHandlers_["unpack_values"] =
-        &CollectProperties::onUnpackValues;
-
-      staticMembersInitialized_ = true;
-    }
-  }
-
-  // Gets called for every tool property;
-  // Just forwards to the corresponding property handler.
-  void operator() (Init* i) {
-    DagInit& d = dynamic_cast<DagInit&>(*i);
-    std::string property_name = d.getOperator()->getAsString();
-    PropertyHandlerMap::iterator method
-      = propertyHandlers_.find(property_name);
-
-    if (method != propertyHandlers_.end()) {
-      PropertyHandler h = method->second;
-      (this->*h)(&d);
-    }
-    else {
-      throw "Unknown tool property: " + property_name + "!";
-    }
-  }
-
-private:
-
-  /// Property handlers --
-  /// Functions that extract information about tool properties from
-  /// DAG representation.
-
-  void onCmdLine (DagInit* d) {
-    checkNumberOfArguments(d, 1);
-    SplitString(InitPtrToString(d->getArg(0)), toolProps_.CmdLine);
-    if (toolProps_.CmdLine.empty())
-      throw std::string("Tool " + toolProps_.Name + " has empty command line!");
-  }
-
-  void onInLanguage (DagInit* d) {
-    checkNumberOfArguments(d, 1);
-    toolProps_.InLanguage = InitPtrToString(d->getArg(0));
-  }
-
-  void onJoin (DagInit* d) {
-    checkNumberOfArguments(d, 0);
-    toolProps_.setJoin();
-  }
-
-  void onOutLanguage (DagInit* d) {
-    checkNumberOfArguments(d, 1);
-    toolProps_.OutLanguage = InitPtrToString(d->getArg(0));
-  }
-
-  void onOutputSuffix (DagInit* d) {
-    checkNumberOfArguments(d, 1);
-    toolProps_.OutputSuffix = InitPtrToString(d->getArg(0));
-  }
-
-  void onSink (DagInit* d) {
-    checkNumberOfArguments(d, 0);
-    optDescs_.HasSink = true;
-    toolProps_.setSink();
-  }
-
-  void onSwitch (DagInit* d)        { addOption(d, OptionType::Switch); }
-  void onParameter (DagInit* d)     { addOption(d, OptionType::Parameter); }
-  void onParameterList (DagInit* d) { addOption(d, OptionType::ParameterList); }
-  void onPrefix (DagInit* d)        { addOption(d, OptionType::Prefix); }
-  void onPrefixList (DagInit* d)    { addOption(d, OptionType::PrefixList); }
-
-  /// Option property handlers --
-  /// Methods that handle properties that are common for all types of
-  /// options (like append_cmd, stop_compilation)
-
-  void onAppendCmd (DagInit* d, GlobalOptionDescription& o) {
-    checkNumberOfArguments(d, 1);
-    std::string const& cmd = InitPtrToString(d->getArg(0));
-
-    toolProps_.OptDescs[o.Name].AddProperty(OptionPropertyType::AppendCmd, cmd);
-  }
-
-  void onForward (DagInit* d, GlobalOptionDescription& o) {
-    checkNumberOfArguments(d, 0);
-    toolProps_.OptDescs[o.Name].setForward();
-  }
-
-  void onHelp (DagInit* d, GlobalOptionDescription& o) {
-    checkNumberOfArguments(d, 1);
-    const std::string& help_message = InitPtrToString(d->getArg(0));
-
-    o.Help = help_message;
-  }
-
-  void onRequired (DagInit* d, GlobalOptionDescription& o) {
-    checkNumberOfArguments(d, 0);
-    o.setRequired();
-  }
-
-  void onStopCompilation (DagInit* d, GlobalOptionDescription& o) {
-    checkNumberOfArguments(d, 0);
-    if (o.Type != OptionType::Switch)
-      throw std::string("Only options of type Switch can stop compilation!");
-    toolProps_.OptDescs[o.Name].setStopCompilation();
-  }
-
-  void onUnpackValues (DagInit* d, GlobalOptionDescription& o) {
-    checkNumberOfArguments(d, 0);
-    toolProps_.OptDescs[o.Name].setUnpackValues();
-  }
-
-  /// Helper functions
-
-  // Add an option of type t
-  void addOption (DagInit* d, OptionType::OptionType t) {
-    checkNumberOfArguments(d, 2);
-    const std::string& name = InitPtrToString(d->getArg(0));
-
-    GlobalOptionDescription o(t, name);
-    toolProps_.OptDescs[name].Type = t;
-    toolProps_.OptDescs[name].Name = name;
-    processOptionProperties(d, o);
-    insertDescription(o);
-  }
-
-  // Ensure that the number of args in d is <= min_arguments,
-  // throw exception otherwise
-  void checkNumberOfArguments (DagInit* d, unsigned min_arguments) {
-    if (d->getNumArgs() < min_arguments)
-      throw "Property " + d->getOperator()->getAsString()
-        + " has too few arguments!";
-  }
-
-  // Insert new GlobalOptionDescription into GlobalOptionDescriptions list
-  void insertDescription (const GlobalOptionDescription& o)
-  {
-    if (optDescs_.Descriptions.count(o.Name)) {
-      GlobalOptionDescription& D = optDescs_.Descriptions[o.Name];
-      D.Merge(o);
-    }
-    else {
-      optDescs_.Descriptions[o.Name] = o;
-    }
-  }
-
-  // Go through the list of option properties and call a corresponding
-  // handler for each.
-  //
-  // Parameters:
-  // name - option name
-  // d - option property list
-  void processOptionProperties (DagInit* d, GlobalOptionDescription& o) {
-    // First argument is option name
-    checkNumberOfArguments(d, 2);
-
-    for (unsigned B = 1, E = d->getNumArgs(); B!=E; ++B) {
-      DagInit& option_property
-        = dynamic_cast<DagInit&>(*d->getArg(B));
-      const std::string& option_property_name
-        = option_property.getOperator()->getAsString();
-      OptionPropertyHandlerMap::iterator method
-        = optionPropertyHandlers_.find(option_property_name);
-
-      if (method != optionPropertyHandlers_.end()) {
-        OptionPropertyHandler h = method->second;
-        (this->*h)(&option_property, o);
-      }
-      else {
-        throw "Unknown option property: " + option_property_name + "!";
-      }
-    }
-  }
-};
-
-// Static members of CollectProperties
-CollectProperties::PropertyHandlerMap
-CollectProperties::propertyHandlers_;
-
-CollectProperties::OptionPropertyHandlerMap
-CollectProperties::optionPropertyHandlers_;
-
-bool CollectProperties::staticMembersInitialized_ = false;
-
-
-// Gather information from the parsed TableGen data
-// (Basically a wrapper for CollectProperties)
-void CollectToolProperties (RecordVector::const_iterator B,
-                            RecordVector::const_iterator E,
-                            ToolPropertiesList& TPList,
-                            GlobalOptionDescriptions& OptDescs)
-{
-  // Iterate over a properties list of every Tool definition
-  for (;B!=E;++B) {
-    RecordVector::value_type T = *B;
-    ListInit* PropList = T->getValueAsListInit("properties");
-    if (!PropList)
-      throw std::string("Tool has no property list!");
-
-    IntrusiveRefCntPtr<ToolProperties>
-      ToolProps(new ToolProperties(T->getName()));
-
-    std::for_each(PropList->begin(), PropList->end(),
-                  CollectProperties(*ToolProps, OptDescs));
-    TPList.push_back(ToolProps);
-  }
-}
-
-// Used by EmitGenerateActionMethod
-void EmitOptionPropertyHandlingCode (const ToolProperties& P,
-                                     const ToolOptionDescription& D,
-                                     std::ostream& O)
-{
-  // if clause
-  O << Indent2 << "if (";
-  if (D.Type == OptionType::Switch)
-    O << D.GenVariableName();
-  else
-    O << '!' << D.GenVariableName() << ".empty()";
-
-  O <<") {\n";
-
-  // Handle option properties that take an argument
-  for (OptionPropertyList::const_iterator B = D.Props.begin(),
-        E = D.Props.end(); B!=E; ++B) {
-    const OptionProperty& val = *B;
-
-    switch (val.first) {
-      // (append_cmd cmd) property
-    case OptionPropertyType::AppendCmd:
-      O << Indent3 << "vec.push_back(\"" << val.second << "\");\n";
-      break;
-      // Other properties with argument
-    default:
-      break;
-    }
-  }
-
-  // Handle flags
-
-  // (forward) property
-  if (D.isForward()) {
-    switch (D.Type) {
-    case OptionType::Switch:
-      O << Indent3 << "vec.push_back(\"-" << D.Name << "\");\n";
-      break;
-    case OptionType::Parameter:
-      O << Indent3 << "vec.push_back(\"-" << D.Name << "\");\n";
-      O << Indent3 << "vec.push_back(" << D.GenVariableName() << ");\n";
-      break;
-    case OptionType::Prefix:
-      O << Indent3 << "vec.push_back(\"-" << D.Name << "\" + "
-        << D.GenVariableName() << ");\n";
-      break;
-    case OptionType::PrefixList:
-      O << Indent3 << "for (" << D.GenTypeDeclaration()
-        << "::iterator B = " << D.GenVariableName() << ".begin(),\n"
-        << Indent3 << "E = " << D.GenVariableName() << ".end(); B != E; ++B)\n"
-        << Indent4 << "vec.push_back(\"-" << D.Name << "\" + "
-        << "*B);\n";
-      break;
-    case OptionType::ParameterList:
-      O << Indent3 << "for (" << D.GenTypeDeclaration()
-        << "::iterator B = " << D.GenVariableName() << ".begin(),\n"
-        << Indent3 << "E = " << D.GenVariableName()
-        << ".end() ; B != E; ++B) {\n"
-        << Indent4 << "vec.push_back(\"-" << D.Name << "\");\n"
-        << Indent4 << "vec.push_back(*B);\n"
-        << Indent3 << "}\n";
-      break;
-    }
-  }
-
-  // (unpack_values) property
-  if (D.isUnpackValues()) {
-    if (IsListOptionType(D.Type)) {
-      O << Indent3 << "for (" << D.GenTypeDeclaration()
-        << "::iterator B = " << D.GenVariableName() << ".begin(),\n"
-        << Indent3 << "E = " << D.GenVariableName()
-        << ".end(); B != E; ++B)\n"
-        << Indent4 << "UnpackValues(*B, vec);\n";
-    }
-    else if (D.Type == OptionType::Prefix || D.Type == OptionType::Parameter){
-      O << Indent3 << "UnpackValues("
-        << D.GenVariableName() << ", vec);\n";
-    }
-    else {
-      // TOFIX: move this to the type-checking phase
-      throw std::string("Switches can't have unpack_values property!");
-    }
-  }
-
-  // close if clause
-  O << Indent2 << "}\n";
-}
-
-// Emite one of two versions of GenerateAction method
-void EmitGenerateActionMethod (const ToolProperties& P, int V, std::ostream& O)
-{
-  assert(V==1 || V==2);
-  if (V==1)
-    O << Indent1 << "Action GenerateAction(const PathVector& inFiles,\n";
-  else
-    O << Indent1 << "Action GenerateAction(const sys::Path& inFile,\n";
-
-  O << Indent2 << "const sys::Path& outFile) const\n"
-    << Indent1 << "{\n"
-    << Indent2 << "std::vector<std::string> vec;\n";
-
-  // Parse CmdLine tool property
-  StrVector::const_iterator I = P.CmdLine.begin();
-  ++I;
-  for (StrVector::const_iterator E = P.CmdLine.end(); I != E; ++I) {
-    const std::string& cmd = *I;
-    O << Indent2;
-    if (cmd == "$INFILE") {
-      if (V==1)
-        O << "for (PathVector::const_iterator B = inFiles.begin()"
-          << ", E = inFiles.end();\n"
-          << Indent2 << "B != E; ++B)\n"
-          << Indent3 << "vec.push_back(B->toString());\n";
-      else
-        O << "vec.push_back(inFile.toString());\n";
-    }
-    else if (cmd == "$OUTFILE") {
-      O << "vec.push_back(outFile.toString());\n";
-    }
-    else {
-      O << "vec.push_back(\"" << cmd << "\");\n";
-    }
-  }
-
-  // For every understood option, emit handling code
-  for (ToolOptionDescriptions::const_iterator B = P.OptDescs.begin(),
-        E = P.OptDescs.end(); B != E; ++B) {
-    const ToolOptionDescription& val = B->second;
-    EmitOptionPropertyHandlingCode(P, val, O);
-  }
-
-  // Handle Sink property
-  if (P.isSink()) {
-    O << Indent2 << "if (!" << SinkOptionName << ".empty()) {\n"
-      << Indent3 << "vec.insert(vec.end(), "
-      << SinkOptionName << ".begin(), " << SinkOptionName << ".end());\n"
-      << Indent2 << "}\n";
-  }
-
-  O << Indent2 << "return Action(\"" << P.CmdLine.at(0) << "\", vec);\n"
-    << Indent1 << "}\n\n";
-}
-
-// Emit GenerateAction methods for Tool classes
-void EmitGenerateActionMethods (const ToolProperties& P, std::ostream& O) {
-
-  if (!P.isJoin())
-    O << Indent1 << "Action GenerateAction(const PathVector& inFiles,\n"
-      << Indent2 << "const llvm::sys::Path& outFile) const\n"
-      << Indent1 << "{\n"
-      << Indent2 << "throw std::runtime_error(\"" << P.Name
-      << " is not a Join tool!\");\n"
-      << Indent1 << "}\n\n";
-  else
-    EmitGenerateActionMethod(P, 1, O);
-
-  EmitGenerateActionMethod(P, 2, O);
-}
-
-// Emit IsLast() method for Tool classes
-void EmitIsLastMethod (const ToolProperties& P, std::ostream& O) {
-  O << Indent1 << "bool IsLast() const {\n"
-    << Indent2 << "bool last = false;\n";
-
-  for (ToolOptionDescriptions::const_iterator B = P.OptDescs.begin(),
-        E = P.OptDescs.end(); B != E; ++B) {
-    const ToolOptionDescription& val = B->second;
-
-    if (val.isStopCompilation())
-      O << Indent2
-        << "if (" << val.GenVariableName()
-        << ")\n" << Indent3 << "last = true;\n";
-  }
-
-  O << Indent2 << "return last;\n"
-    << Indent1 <<  "}\n\n";
-}
-
-// Emit static [Input,Output]Language() methods for Tool classes
-void EmitInOutLanguageMethods (const ToolProperties& P, std::ostream& O) {
-  O << Indent1 << "std::string InputLanguage() const {\n"
-    << Indent2 << "return \"" << P.InLanguage << "\";\n"
-    << Indent1 << "}\n\n";
-
-  O << Indent1 << "std::string OutputLanguage() const {\n"
-    << Indent2 << "return \"" << P.OutLanguage << "\";\n"
-    << Indent1 << "}\n\n";
-}
-
-// Emit static [Input,Output]Language() methods for Tool classes
-void EmitOutputSuffixMethod (const ToolProperties& P, std::ostream& O) {
-  O << Indent1 << "std::string OutputSuffix() const {\n"
-    << Indent2 << "return \"" << P.OutputSuffix << "\";\n"
-    << Indent1 << "}\n\n";
-}
-
-// Emit static Name() method for Tool classes
-void EmitNameMethod (const ToolProperties& P, std::ostream& O) {
-  O << Indent1 << "std::string Name() const {\n"
-    << Indent2 << "return \"" << P.Name << "\";\n"
-    << Indent1 << "}\n\n";
-}
-
-// Emit static Name() method for Tool classes
-void EmitIsJoinMethod (const ToolProperties& P, std::ostream& O) {
-  O << Indent1 << "bool IsJoin() const {\n";
-  if (P.isJoin())
-    O << Indent2 << "return true;\n";
-  else
-    O << Indent2 << "return false;\n";
-  O << Indent1 << "}\n\n";
-}
-
-// Emit a Tool class definition
-void EmitToolClassDefinition (const ToolProperties& P, std::ostream& O) {
-  // Header
-  O << "class " << P.Name << " : public Tool {\n"
-    << "public:\n";
-
-  EmitNameMethod(P, O);
-  EmitInOutLanguageMethods(P, O);
-  EmitOutputSuffixMethod(P, O);
-  EmitIsJoinMethod(P, O);
-  EmitGenerateActionMethods(P, O);
-  EmitIsLastMethod(P, O);
-
-  // Close class definition
-  O << "};\n\n";
-}
-
-// Iterate over a list of option descriptions and emit registration code
-void EmitOptionDescriptions (const GlobalOptionDescriptions& descs,
-                             std::ostream& O)
-{
-  // Emit static cl::Option variables
-  for (GlobalOptionDescriptions::const_iterator B = descs.begin(),
-         E = descs.end(); B!=E; ++B) {
-    const GlobalOptionDescription& val = B->second;
-
-    O << val.GenTypeDeclaration() << ' '
-      << val.GenVariableName()
-      << "(\"" << val.Name << '\"';
-
-    if (val.Type == OptionType::Prefix || val.Type == OptionType::PrefixList)
-      O << ", cl::Prefix";
-
-    if (val.isRequired()) {
-      switch (val.Type) {
-      case OptionType::PrefixList:
-      case OptionType::ParameterList:
-        O << ", cl::OneOrMore";
-        break;
-      default:
-        O << ", cl::Required";
-      }
-    }
-
-    O << ", cl::desc(\"" << val.Help << "\"));\n";
-  }
-
-  if (descs.HasSink)
-    O << "cl::list<std::string> " << SinkOptionName << "(cl::Sink);\n";
-
-  O << '\n';
-}
-
-void EmitPopulateLanguageMap (const RecordKeeper& Records, std::ostream& O)
-{
-  // Get the relevant field out of RecordKeeper
-  Record* LangMapRecord = Records.getDef("LanguageMap");
-  if (!LangMapRecord)
-    throw std::string("Language map definition not found!");
-
-  ListInit* LangsToSuffixesList = LangMapRecord->getValueAsListInit("map");
-  if (!LangsToSuffixesList)
-    throw std::string("Error in the language map definition!");
-
-  // Generate code
-  O << "void llvmcc::PopulateLanguageMap(LanguageMap& language_map) {\n";
-
-  for (unsigned i = 0; i < LangsToSuffixesList->size(); ++i) {
-    Record* LangToSuffixes = LangsToSuffixesList->getElementAsRecord(i);
-
-    const std::string& Lang = LangToSuffixes->getValueAsString("lang");
-    const ListInit* Suffixes = LangToSuffixes->getValueAsListInit("suffixes");
-
-    for (unsigned i = 0; i < Suffixes->size(); ++i)
-      O << Indent1 << "language_map[\""
-        << InitPtrToString(Suffixes->getElement(i))
-        << "\"] = \"" << Lang << "\";\n";
-  }
-
-  O << "}\n\n";
-}
-
-void EmitPopulateCompilationGraph (const RecordKeeper& Records,
-                                   StringMap<std::string>& ToolToLang,
-                                   std::ostream& O)
-{
-  // Get the relevant field out of RecordKeeper
-  Record* ToolChains = Records.getDef("ToolChains");
-  if (!ToolChains)
-    throw std::string("No ToolChains specification found!");
-  ListInit* chains = ToolChains->getValueAsListInit("chains");
-  if (!chains)
-    throw std::string("Error in toolchain list definition!");
-
-  // Generate code
-  O << "void llvmcc::PopulateCompilationGraph(CompilationGraph& G) {\n"
-    << Indent1 << "PopulateLanguageMap(G.ExtsToLangs);\n"
-    << Indent1 << "std::vector<IntrusiveRefCntPtr<Tool> > vec;\n\n";
-
-  for (unsigned i = 0; i < chains->size(); ++i) {
-    Record* ToolChain = chains->getElementAsRecord(i);
-    ListInit* Tools = ToolChain->getValueAsListInit("tools");
-
-    // Get name of the first tool in the list
-    const std::string& firstTool =
-      dynamic_cast<DefInit&>(**Tools->begin()).getDef()->getName();
-
-    for (ListInit::iterator B = Tools->begin(),
-          E = Tools->end(); B != E; ++B) {
-      Record* val = dynamic_cast<DefInit&>(**B).getDef();
-      O << Indent1 << "vec.push_back(IntrusiveRefCntPtr<Tool>(new "
-        << val->getName() << "()));\n";
-    }
-    O << Indent1 << "G.ToolChains[\"" << ToolToLang[firstTool]
-      << "\"] = vec;\n";
-    O << Indent1 << "vec.clear();\n\n";
-  }
-
-  O << "}\n\n";
-}
-
-void FillInToolToLang (const ToolPropertiesList& T,
-                       StringMap<std::string>& M) {
-  for (ToolPropertiesList::const_iterator B = T.begin(), E = T.end();
-       B != E; ++B) {
-    const ToolProperties& P = *(*B);
-    M[P.Name] = P.InLanguage;
-  }
-}
-
-// End of anonymous namespace
-}
-
-// Back-end entry point
-void LLVMCCConfigurationEmitter::run (std::ostream &O) {
-  // Emit file header
-  EmitSourceFileHeader("LLVMCC Configuration Library", O);
-
-  // Get a list of all defined Tools
-  RecordVector Tools = Records.getAllDerivedDefinitions("Tool");
-  if (Tools.empty())
-    throw std::string("No tool definitions found!");
-
-  // Gather information from the Tool descriptions
-  ToolPropertiesList tool_props;
-  GlobalOptionDescriptions opt_descs;
-  CollectToolProperties(Tools.begin(), Tools.end(), tool_props, opt_descs);
-
-  // Emit global option registration code
-  EmitOptionDescriptions(opt_descs, O);
-
-  // Emit PopulateLanguageMap function
-  // (a language map maps from file extensions to language names)
-  EmitPopulateLanguageMap(Records, O);
-
-  // Emit Tool classes
-  for (ToolPropertiesList::const_iterator B = tool_props.begin(),
-         E = tool_props.end(); B!=E; ++B)
-    EmitToolClassDefinition(*(*B), O);
-
-  // Fill in table that maps tool names to languages
-  StringMap<std::string> ToolToLang;
-  FillInToolToLang(tool_props, ToolToLang);
-
-  // Emit PopulateCompilationGraph function
-  EmitPopulateCompilationGraph(Records, ToolToLang, O);
-
-  // EOF
-}

Removed: llvm/branches/non-call-eh/utils/TableGen/LLVMCCConfigurationEmitter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/utils/TableGen/LLVMCCConfigurationEmitter.h?rev=53162&view=auto

==============================================================================
--- llvm/branches/non-call-eh/utils/TableGen/LLVMCCConfigurationEmitter.h (original)
+++ llvm/branches/non-call-eh/utils/TableGen/LLVMCCConfigurationEmitter.h (removed)
@@ -1,30 +0,0 @@
-//===- LLVMCConfigurationEmitter.cpp - Generate LLVMCC config -------------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open
-// Source License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This tablegen backend is responsible for emitting LLVMCC configuration code.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVMCCCONF_EMITTER_H
-#define LLVMCCCONF_EMITTER_H
-
-#include "TableGenBackend.h"
-
-namespace llvm {
-  class LLVMCCConfigurationEmitter : public TableGenBackend {
-    RecordKeeper &Records;
-  public:
-    explicit LLVMCCConfigurationEmitter(RecordKeeper &R) : Records(R) {}
-
-    // run - Output the asmwriter, returning true on failure.
-    void run(std::ostream &o);
-  };
-}
-
-#endif //LLVMCCCONF_EMITTER_H

Added: llvm/branches/non-call-eh/utils/TableGen/LLVMCConfigurationEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/utils/TableGen/LLVMCConfigurationEmitter.cpp?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/utils/TableGen/LLVMCConfigurationEmitter.cpp (added)
+++ llvm/branches/non-call-eh/utils/TableGen/LLVMCConfigurationEmitter.cpp Sun Jul  6 15:45:41 2008
@@ -0,0 +1,1736 @@
+//===- LLVMCConfigurationEmitter.cpp - Generate LLVMC config ----*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open
+// Source License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This tablegen backend is responsible for emitting LLVMC configuration code.
+//
+//===----------------------------------------------------------------------===//
+
+#include "LLVMCConfigurationEmitter.h"
+#include "Record.h"
+
+#include "llvm/ADT/IntrusiveRefCntPtr.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/StringMap.h"
+#include "llvm/ADT/StringSet.h"
+#include "llvm/Support/Streams.h"
+#include <algorithm>
+#include <cassert>
+#include <functional>
+#include <stdexcept>
+#include <string>
+#include <typeinfo>
+using namespace llvm;
+
+namespace {
+
+//===----------------------------------------------------------------------===//
+/// Typedefs
+
+typedef std::vector<Record*> RecordVector;
+typedef std::vector<std::string> StrVector;
+
+//===----------------------------------------------------------------------===//
+/// Constants
+
+// Indentation strings.
+const char * Indent1 = "    ";
+const char * Indent2 = "        ";
+const char * Indent3 = "            ";
+const char * Indent4 = "                ";
+
+// Default help string.
+const char * DefaultHelpString = "NO HELP MESSAGE PROVIDED";
+
+// Name for the "sink" option.
+const char * SinkOptionName = "AutoGeneratedSinkOption";
+
+//===----------------------------------------------------------------------===//
+/// Helper functions
+
+int InitPtrToInt(const Init* ptr) {
+  const IntInit& val = dynamic_cast<const IntInit&>(*ptr);
+  return val.getValue();
+}
+
+const std::string& InitPtrToString(const Init* ptr) {
+  const StringInit& val = dynamic_cast<const StringInit&>(*ptr);
+  return val.getValue();
+}
+
+const ListInit& InitPtrToList(const Init* ptr) {
+  const ListInit& val = dynamic_cast<const ListInit&>(*ptr);
+  return val;
+}
+
+const DagInit& InitPtrToDag(const Init* ptr) {
+  const DagInit& val = dynamic_cast<const DagInit&>(*ptr);
+  return val;
+}
+
+// checkNumberOfArguments - Ensure that the number of args in d is
+// less than or equal to min_arguments, otherwise throw an exception.
+void checkNumberOfArguments (const DagInit* d, unsigned min_arguments) {
+  if (d->getNumArgs() < min_arguments)
+    throw "Property " + d->getOperator()->getAsString()
+      + " has too few arguments!";
+}
+
+// isDagEmpty - is this DAG marked with an empty marker?
+bool isDagEmpty (const DagInit* d) {
+  return d->getOperator()->getAsString() == "empty";
+}
+
+//===----------------------------------------------------------------------===//
+/// Back-end specific code
+
+// A command-line option can have one of the following types:
+//
+// Alias - an alias for another option.
+//
+// Switch - a simple switch without arguments, e.g. -O2
+//
+// Parameter - an option that takes one(and only one) argument, e.g. -o file,
+// --output=file
+//
+// ParameterList - same as Parameter, but more than one occurence
+// of the option is allowed, e.g. -lm -lpthread
+//
+// Prefix - argument is everything after the prefix,
+// e.g. -Wa,-foo,-bar, -DNAME=VALUE
+//
+// PrefixList - same as Prefix, but more than one option occurence is
+// allowed.
+
+namespace OptionType {
+  enum OptionType { Alias, Switch,
+                    Parameter, ParameterList, Prefix, PrefixList};
+}
+
+bool IsListOptionType (OptionType::OptionType t) {
+  return (t == OptionType::ParameterList || t == OptionType::PrefixList);
+}
+
+// Code duplication here is necessary because one option can affect
+// several tools and those tools may have different actions associated
+// with this option. GlobalOptionDescriptions are used to generate
+// the option registration code, while ToolOptionDescriptions are used
+// to generate tool-specific code.
+
+/// OptionDescription - Base class for option descriptions.
+struct OptionDescription {
+  OptionType::OptionType Type;
+  std::string Name;
+
+  OptionDescription(OptionType::OptionType t = OptionType::Switch,
+                    const std::string& n = "")
+  : Type(t), Name(n)
+  {}
+
+  const char* GenTypeDeclaration() const {
+    switch (Type) {
+    case OptionType::Alias:
+      return "cl::alias";
+    case OptionType::PrefixList:
+    case OptionType::ParameterList:
+      return "cl::list<std::string>";
+    case OptionType::Switch:
+      return "cl::opt<bool>";
+    case OptionType::Parameter:
+    case OptionType::Prefix:
+    default:
+      return "cl::opt<std::string>";
+    }
+  }
+
+  // Escape commas and other symbols not allowed in the C++ variable
+  // names. Makes it possible to use options with names like "Wa,"
+  // (useful for prefix options).
+  std::string EscapeVariableName(const std::string& Var) const {
+    std::string ret;
+    for (unsigned i = 0; i != Var.size(); ++i) {
+      if (Var[i] == ',') {
+        ret += "_comma_";
+      }
+      else {
+        ret.push_back(Var[i]);
+      }
+    }
+    return ret;
+  }
+
+  std::string GenVariableName() const {
+    const std::string& EscapedName = EscapeVariableName(Name);
+    switch (Type) {
+    case OptionType::Alias:
+     return "AutoGeneratedAlias" + EscapedName;
+    case OptionType::Switch:
+      return "AutoGeneratedSwitch" + EscapedName;
+    case OptionType::Prefix:
+      return "AutoGeneratedPrefix" + EscapedName;
+    case OptionType::PrefixList:
+      return "AutoGeneratedPrefixList" + EscapedName;
+    case OptionType::Parameter:
+      return "AutoGeneratedParameter" + EscapedName;
+    case OptionType::ParameterList:
+    default:
+      return "AutoGeneratedParameterList" + EscapedName;
+    }
+  }
+
+};
+
+// Global option description.
+
+namespace GlobalOptionDescriptionFlags {
+  enum GlobalOptionDescriptionFlags { Required = 0x1 };
+}
+
+struct GlobalOptionDescription : public OptionDescription {
+  std::string Help;
+  unsigned Flags;
+
+  // We need to provide a default constructor because
+  // StringMap can only store DefaultConstructible objects.
+  GlobalOptionDescription() : OptionDescription(), Flags(0)
+  {}
+
+  GlobalOptionDescription (OptionType::OptionType t, const std::string& n,
+                           const std::string& h = DefaultHelpString)
+    : OptionDescription(t, n), Help(h), Flags(0)
+  {}
+
+  bool isRequired() const {
+    return Flags & GlobalOptionDescriptionFlags::Required;
+  }
+  void setRequired() {
+    Flags |= GlobalOptionDescriptionFlags::Required;
+  }
+
+  /// Merge - Merge two option descriptions.
+  void Merge (const GlobalOptionDescription& other)
+  {
+    if (other.Type != Type)
+      throw "Conflicting definitions for the option " + Name + "!";
+
+    if (Help == DefaultHelpString)
+      Help = other.Help;
+    else if (other.Help != DefaultHelpString) {
+      llvm::cerr << "Warning: more than one help string defined for option "
+        + Name + "\n";
+    }
+
+    Flags |= other.Flags;
+  }
+};
+
+/// GlobalOptionDescriptions - A GlobalOptionDescription array
+/// together with some flags affecting generation of option
+/// declarations.
+struct GlobalOptionDescriptions {
+  typedef StringMap<GlobalOptionDescription> container_type;
+  typedef container_type::const_iterator const_iterator;
+
+  /// Descriptions - A list of GlobalOptionDescriptions.
+  container_type Descriptions;
+  /// HasSink - Should the emitter generate a "cl::sink" option?
+  bool HasSink;
+
+  /// FindOption - exception-throwing wrapper for find().
+  const GlobalOptionDescription& FindOption(const std::string& OptName) const {
+    const_iterator I = Descriptions.find(OptName);
+    if (I != Descriptions.end())
+      return I->second;
+    else
+      throw OptName + ": no such option!";
+  }
+
+  /// insertDescription - Insert new GlobalOptionDescription into
+  /// GlobalOptionDescriptions list
+  void insertDescription (const GlobalOptionDescription& o)
+  {
+    container_type::iterator I = Descriptions.find(o.Name);
+    if (I != Descriptions.end()) {
+      GlobalOptionDescription& D = I->second;
+      D.Merge(o);
+    }
+    else {
+      Descriptions[o.Name] = o;
+    }
+  }
+
+  // Support for STL-style iteration
+  const_iterator begin() const { return Descriptions.begin(); }
+  const_iterator end() const { return Descriptions.end(); }
+};
+
+
+// Tool-local option description.
+
+// Properties without arguments are implemented as flags.
+namespace ToolOptionDescriptionFlags {
+  enum ToolOptionDescriptionFlags { StopCompilation = 0x1,
+                                    Forward = 0x2, UnpackValues = 0x4};
+}
+namespace OptionPropertyType {
+  enum OptionPropertyType { AppendCmd, OutputSuffix };
+}
+
+typedef std::pair<OptionPropertyType::OptionPropertyType, std::string>
+OptionProperty;
+typedef SmallVector<OptionProperty, 4> OptionPropertyList;
+
+struct ToolOptionDescription : public OptionDescription {
+  unsigned Flags;
+  OptionPropertyList Props;
+
+  // StringMap can only store DefaultConstructible objects
+  ToolOptionDescription() : OptionDescription(), Flags(0) {}
+
+  ToolOptionDescription (OptionType::OptionType t, const std::string& n)
+    : OptionDescription(t, n)
+  {}
+
+  // Various boolean properties
+  bool isStopCompilation() const {
+    return Flags & ToolOptionDescriptionFlags::StopCompilation;
+  }
+  void setStopCompilation() {
+    Flags |= ToolOptionDescriptionFlags::StopCompilation;
+  }
+
+  bool isForward() const {
+    return Flags & ToolOptionDescriptionFlags::Forward;
+  }
+  void setForward() {
+    Flags |= ToolOptionDescriptionFlags::Forward;
+  }
+
+  bool isUnpackValues() const {
+    return Flags & ToolOptionDescriptionFlags::UnpackValues;
+  }
+  void setUnpackValues() {
+    Flags |= ToolOptionDescriptionFlags::UnpackValues;
+  }
+
+  void AddProperty (OptionPropertyType::OptionPropertyType t,
+                    const std::string& val)
+  {
+    Props.push_back(std::make_pair(t, val));
+  }
+};
+
+typedef StringMap<ToolOptionDescription> ToolOptionDescriptions;
+
+// Tool information record
+
+namespace ToolFlags {
+  enum ToolFlags { Join = 0x1, Sink = 0x2 };
+}
+
+struct ToolProperties : public RefCountedBase<ToolProperties> {
+  std::string Name;
+  Init* CmdLine;
+  StrVector InLanguage;
+  std::string OutLanguage;
+  std::string OutputSuffix;
+  unsigned Flags;
+  ToolOptionDescriptions OptDescs;
+
+  // Various boolean properties
+  void setSink()      { Flags |= ToolFlags::Sink; }
+  bool isSink() const { return Flags & ToolFlags::Sink; }
+  void setJoin()      { Flags |= ToolFlags::Join; }
+  bool isJoin() const { return Flags & ToolFlags::Join; }
+
+  // Default ctor here is needed because StringMap can only store
+  // DefaultConstructible objects
+  ToolProperties() : CmdLine(0), Flags(0) {}
+  ToolProperties (const std::string& n) : Name(n), CmdLine(0), Flags(0) {}
+};
+
+
+/// ToolPropertiesList - A list of Tool information records
+/// IntrusiveRefCntPtrs are used here because StringMap has no copy
+/// constructor (and we want to avoid copying ToolProperties anyway).
+typedef std::vector<IntrusiveRefCntPtr<ToolProperties> > ToolPropertiesList;
+
+
+/// CollectOptionProperties - Function object for iterating over a
+/// list (usually, a DAG) of option property records.
+class CollectOptionProperties {
+private:
+  // Implementation details.
+
+  /// OptionPropertyHandler - a function that extracts information
+  /// about a given option property from its DAG representation.
+  typedef void (CollectOptionProperties::* OptionPropertyHandler)
+  (const DagInit*);
+
+  /// OptionPropertyHandlerMap - A map from option property names to
+  /// option property handlers
+  typedef StringMap<OptionPropertyHandler> OptionPropertyHandlerMap;
+
+  static OptionPropertyHandlerMap optionPropertyHandlers_;
+  static bool staticMembersInitialized_;
+
+  /// This is where the information is stored
+
+  /// toolProps_ -  Properties of the current Tool.
+  ToolProperties* toolProps_;
+  /// optDescs_ - OptionDescriptions table (used to register options
+  /// globally).
+  GlobalOptionDescription& optDesc_;
+
+public:
+
+  explicit CollectOptionProperties(ToolProperties* TP,
+                                   GlobalOptionDescription& OD)
+    : toolProps_(TP), optDesc_(OD)
+  {
+    if (!staticMembersInitialized_) {
+      optionPropertyHandlers_["append_cmd"] =
+        &CollectOptionProperties::onAppendCmd;
+      optionPropertyHandlers_["forward"] =
+        &CollectOptionProperties::onForward;
+      optionPropertyHandlers_["help"] =
+        &CollectOptionProperties::onHelp;
+      optionPropertyHandlers_["output_suffix"] =
+        &CollectOptionProperties::onOutputSuffix;
+      optionPropertyHandlers_["required"] =
+        &CollectOptionProperties::onRequired;
+      optionPropertyHandlers_["stop_compilation"] =
+        &CollectOptionProperties::onStopCompilation;
+      optionPropertyHandlers_["unpack_values"] =
+        &CollectOptionProperties::onUnpackValues;
+
+      staticMembersInitialized_ = true;
+    }
+  }
+
+  /// operator() - Gets called for every option property; Just forwards
+  /// to the corresponding property handler.
+  void operator() (Init* i) {
+    const DagInit& option_property = InitPtrToDag(i);
+    const std::string& option_property_name
+      = option_property.getOperator()->getAsString();
+    OptionPropertyHandlerMap::iterator method
+      = optionPropertyHandlers_.find(option_property_name);
+
+    if (method != optionPropertyHandlers_.end()) {
+      OptionPropertyHandler h = method->second;
+      (this->*h)(&option_property);
+    }
+    else {
+      throw "Unknown option property: " + option_property_name + "!";
+    }
+  }
+
+private:
+
+  /// Option property handlers --
+  /// Methods that handle properties that are common for all types of
+  /// options (like append_cmd, stop_compilation)
+
+  void onAppendCmd (const DagInit* d) {
+    checkNumberOfArguments(d, 1);
+    checkToolProps(d);
+    const std::string& cmd = InitPtrToString(d->getArg(0));
+
+    toolProps_->OptDescs[optDesc_.Name].
+      AddProperty(OptionPropertyType::AppendCmd, cmd);
+  }
+
+  void onOutputSuffix (const DagInit* d) {
+    checkNumberOfArguments(d, 1);
+    checkToolProps(d);
+    const std::string& suf = InitPtrToString(d->getArg(0));
+
+    if (toolProps_->OptDescs[optDesc_.Name].Type != OptionType::Switch)
+      throw "Option " + optDesc_.Name
+        + " can't have 'output_suffix' property since it isn't a switch!";
+
+    toolProps_->OptDescs[optDesc_.Name].AddProperty
+      (OptionPropertyType::OutputSuffix, suf);
+  }
+
+  void onForward (const DagInit* d) {
+    checkNumberOfArguments(d, 0);
+    checkToolProps(d);
+    toolProps_->OptDescs[optDesc_.Name].setForward();
+  }
+
+  void onHelp (const DagInit* d) {
+    checkNumberOfArguments(d, 1);
+    const std::string& help_message = InitPtrToString(d->getArg(0));
+
+    optDesc_.Help = help_message;
+  }
+
+  void onRequired (const DagInit* d) {
+    checkNumberOfArguments(d, 0);
+    checkToolProps(d);
+    optDesc_.setRequired();
+  }
+
+  void onStopCompilation (const DagInit* d) {
+    checkNumberOfArguments(d, 0);
+    checkToolProps(d);
+    if (optDesc_.Type != OptionType::Switch)
+      throw std::string("Only options of type Switch can stop compilation!");
+    toolProps_->OptDescs[optDesc_.Name].setStopCompilation();
+  }
+
+  void onUnpackValues (const DagInit* d) {
+    checkNumberOfArguments(d, 0);
+    checkToolProps(d);
+    toolProps_->OptDescs[optDesc_.Name].setUnpackValues();
+  }
+
+  // Helper functions
+
+  /// checkToolProps - Throw an error if toolProps_ == 0.
+  void checkToolProps(const DagInit* d) {
+    if (!d)
+      throw "Option property " + d->getOperator()->getAsString()
+        + " can't be used in this context";
+  }
+
+};
+
+CollectOptionProperties::OptionPropertyHandlerMap
+CollectOptionProperties::optionPropertyHandlers_;
+
+bool CollectOptionProperties::staticMembersInitialized_ = false;
+
+
+/// processOptionProperties - Go through the list of option
+/// properties and call a corresponding handler for each.
+void processOptionProperties (const DagInit* d, ToolProperties* t,
+                              GlobalOptionDescription& o) {
+  checkNumberOfArguments(d, 2);
+  DagInit::const_arg_iterator B = d->arg_begin();
+  // Skip the first argument: it's always the option name.
+  ++B;
+  std::for_each(B, d->arg_end(), CollectOptionProperties(t, o));
+}
+
+/// AddOption - A function object wrapper for
+/// processOptionProperties. Used by CollectProperties and
+/// CollectPropertiesFromOptionList.
+class AddOption {
+private:
+  GlobalOptionDescriptions& OptDescs_;
+  ToolProperties* ToolProps_;
+
+public:
+  explicit AddOption(GlobalOptionDescriptions& OD, ToolProperties* TP = 0)
+    : OptDescs_(OD), ToolProps_(TP)
+  {}
+
+  void operator()(const Init* i) {
+    const DagInit& d = InitPtrToDag(i);
+    checkNumberOfArguments(&d, 2);
+
+    const OptionType::OptionType Type =
+      getOptionType(d.getOperator()->getAsString());
+    const std::string& Name = InitPtrToString(d.getArg(0));
+
+    GlobalOptionDescription OD(Type, Name);
+    if (Type != OptionType::Alias) {
+      processOptionProperties(&d, ToolProps_, OD);
+      if (ToolProps_) {
+        ToolProps_->OptDescs[Name].Type = Type;
+        ToolProps_->OptDescs[Name].Name = Name;
+      }
+    }
+    else {
+      OD.Help = InitPtrToString(d.getArg(1));
+    }
+    OptDescs_.insertDescription(OD);
+  }
+
+private:
+  OptionType::OptionType getOptionType(const std::string& T) const {
+    if (T == "alias_option")
+      return OptionType::Alias;
+    else if (T == "switch_option")
+      return OptionType::Switch;
+    else if (T == "parameter_option")
+      return OptionType::Parameter;
+    else if (T == "parameter_list_option")
+      return OptionType::ParameterList;
+    else if (T == "prefix_option")
+      return OptionType::Prefix;
+    else if (T == "prefix_list_option")
+      return OptionType::PrefixList;
+    else
+      throw "Unknown option type: " + T + '!';
+  }
+};
+
+
+/// CollectProperties - Function object for iterating over a list of
+/// tool property records.
+class CollectProperties {
+private:
+
+  // Implementation details
+
+  /// PropertyHandler - a function that extracts information
+  /// about a given tool property from its DAG representation
+  typedef void (CollectProperties::*PropertyHandler)(const DagInit*);
+
+  /// PropertyHandlerMap - A map from property names to property
+  /// handlers.
+  typedef StringMap<PropertyHandler> PropertyHandlerMap;
+
+  // Static maps from strings to CollectProperties methods("handlers")
+  static PropertyHandlerMap propertyHandlers_;
+  static bool staticMembersInitialized_;
+
+
+  /// This is where the information is stored
+
+  /// toolProps_ -  Properties of the current Tool.
+  ToolProperties& toolProps_;
+  /// optDescs_ - OptionDescriptions table (used to register options
+  /// globally).
+  GlobalOptionDescriptions& optDescs_;
+
+public:
+
+  explicit CollectProperties (ToolProperties& p, GlobalOptionDescriptions& d)
+    : toolProps_(p), optDescs_(d)
+  {
+    if (!staticMembersInitialized_) {
+      propertyHandlers_["cmd_line"] = &CollectProperties::onCmdLine;
+      propertyHandlers_["in_language"] = &CollectProperties::onInLanguage;
+      propertyHandlers_["join"] = &CollectProperties::onJoin;
+      propertyHandlers_["out_language"] = &CollectProperties::onOutLanguage;
+      propertyHandlers_["output_suffix"] = &CollectProperties::onOutputSuffix;
+      propertyHandlers_["parameter_option"]
+        = &CollectProperties::addOption;
+      propertyHandlers_["parameter_list_option"] =
+        &CollectProperties::addOption;
+      propertyHandlers_["prefix_option"] = &CollectProperties::addOption;
+      propertyHandlers_["prefix_list_option"] =
+        &CollectProperties::addOption;
+      propertyHandlers_["sink"] = &CollectProperties::onSink;
+      propertyHandlers_["switch_option"] = &CollectProperties::addOption;
+      propertyHandlers_["alias_option"] = &CollectProperties::addOption;
+
+      staticMembersInitialized_ = true;
+    }
+  }
+
+  /// operator() - Gets called for every tool property; Just forwards
+  /// to the corresponding property handler.
+  void operator() (Init* i) {
+    const DagInit& d = InitPtrToDag(i);
+    const std::string& property_name = d.getOperator()->getAsString();
+    PropertyHandlerMap::iterator method
+      = propertyHandlers_.find(property_name);
+
+    if (method != propertyHandlers_.end()) {
+      PropertyHandler h = method->second;
+      (this->*h)(&d);
+    }
+    else {
+      throw "Unknown tool property: " + property_name + "!";
+    }
+  }
+
+private:
+
+  /// Property handlers --
+  /// Functions that extract information about tool properties from
+  /// DAG representation.
+
+  void onCmdLine (const DagInit* d) {
+    checkNumberOfArguments(d, 1);
+    toolProps_.CmdLine = d->getArg(0);
+  }
+
+  void onInLanguage (const DagInit* d) {
+    checkNumberOfArguments(d, 1);
+    Init* arg = d->getArg(0);
+
+    // Find out the argument's type.
+    if (typeid(*arg) == typeid(StringInit)) {
+      // It's a string.
+      toolProps_.InLanguage.push_back(InitPtrToString(arg));
+    }
+    else {
+      // It's a list.
+      const ListInit& lst = InitPtrToList(arg);
+      StrVector& out = toolProps_.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(out.begin(), out.end());
+      StrVector::iterator newE = std::unique(out.begin(), out.end());
+      out.erase(newE, out.end());
+    }
+  }
+
+  void onJoin (const DagInit* d) {
+    checkNumberOfArguments(d, 0);
+    toolProps_.setJoin();
+  }
+
+  void onOutLanguage (const DagInit* d) {
+    checkNumberOfArguments(d, 1);
+    toolProps_.OutLanguage = InitPtrToString(d->getArg(0));
+  }
+
+  void onOutputSuffix (const DagInit* d) {
+    checkNumberOfArguments(d, 1);
+    toolProps_.OutputSuffix = InitPtrToString(d->getArg(0));
+  }
+
+  void onSink (const DagInit* d) {
+    checkNumberOfArguments(d, 0);
+    optDescs_.HasSink = true;
+    toolProps_.setSink();
+  }
+
+  // Just forwards to the AddOption function object. Somewhat
+  // non-optimal, but avoids code duplication.
+  void addOption (const DagInit* d) {
+    checkNumberOfArguments(d, 2);
+    AddOption(optDescs_, &toolProps_)(d);
+  }
+
+};
+
+// Defintions of static members of CollectProperties.
+CollectProperties::PropertyHandlerMap CollectProperties::propertyHandlers_;
+bool CollectProperties::staticMembersInitialized_ = false;
+
+
+/// CollectToolProperties - Gather information about tool properties
+/// from the parsed TableGen data (basically a wrapper for the
+/// CollectProperties function object).
+void CollectToolProperties (RecordVector::const_iterator B,
+                            RecordVector::const_iterator E,
+                            ToolPropertiesList& TPList,
+                            GlobalOptionDescriptions& OptDescs)
+{
+  // Iterate over a properties list of every Tool definition
+  for (;B!=E;++B) {
+    Record* T = *B;
+    // Throws an exception if the value does not exist.
+    ListInit* PropList = T->getValueAsListInit("properties");
+
+    IntrusiveRefCntPtr<ToolProperties>
+      ToolProps(new ToolProperties(T->getName()));
+
+    std::for_each(PropList->begin(), PropList->end(),
+                  CollectProperties(*ToolProps, OptDescs));
+    TPList.push_back(ToolProps);
+  }
+}
+
+
+/// CollectPropertiesFromOptionList - Gather information about
+/// *global* option properties from the OptionList.
+void CollectPropertiesFromOptionList (RecordVector::const_iterator B,
+                                      RecordVector::const_iterator E,
+                                      GlobalOptionDescriptions& OptDescs)
+{
+  // Iterate over a properties list of every Tool definition
+  for (;B!=E;++B) {
+    RecordVector::value_type T = *B;
+    // Throws an exception if the value does not exist.
+    ListInit* PropList = T->getValueAsListInit("options");
+
+    std::for_each(PropList->begin(), PropList->end(), AddOption(OptDescs));
+  }
+}
+
+/// CheckForSuperfluousOptions - Check that there are no side
+/// effect-free options (specified only in the OptionList). Otherwise,
+/// output a warning.
+void CheckForSuperfluousOptions (const ToolPropertiesList& TPList,
+                                 const GlobalOptionDescriptions& OptDescs) {
+  llvm::StringSet<> nonSuperfluousOptions;
+
+  // Add all options mentioned in the TPList to the set of
+  // non-superfluous options.
+  for (ToolPropertiesList::const_iterator B = TPList.begin(),
+         E = TPList.end(); B != E; ++B) {
+    const ToolProperties& TP = *(*B);
+    for (ToolOptionDescriptions::const_iterator B = TP.OptDescs.begin(),
+           E = TP.OptDescs.end(); B != E; ++B) {
+      nonSuperfluousOptions.insert(B->first());
+    }
+  }
+
+  // Check that all options in OptDescs belong to the set of
+  // non-superfluous options.
+  for (GlobalOptionDescriptions::const_iterator B = OptDescs.begin(),
+         E = OptDescs.end(); B != E; ++B) {
+    const GlobalOptionDescription& Val = B->second;
+    if (!nonSuperfluousOptions.count(Val.Name)
+        && Val.Type != OptionType::Alias)
+      cerr << "Warning: option '-" << Val.Name << "' has no effect! "
+        "Probable cause: this option is specified only in the OptionList.\n";
+  }
+}
+
+/// EmitCaseTest1Arg - Helper function used by
+/// EmitCaseConstructHandler.
+bool EmitCaseTest1Arg(const std::string& TestName,
+                      const DagInit& d,
+                      const GlobalOptionDescriptions& OptDescs,
+                      std::ostream& O) {
+  // TOFIX - Add a mechanism for OS detection.
+  checkNumberOfArguments(&d, 1);
+  const std::string& OptName = InitPtrToString(d.getArg(0));
+  if (TestName == "switch_on") {
+    const GlobalOptionDescription& OptDesc = OptDescs.FindOption(OptName);
+    if (OptDesc.Type != OptionType::Switch)
+      throw OptName + ": incorrect option type!";
+    O << OptDesc.GenVariableName();
+    return true;
+  } else if (TestName == "input_languages_contain") {
+    O << "InLangs.count(\"" << OptName << "\") != 0";
+    return true;
+  } else if (TestName == "in_language") {
+    // Works only for cmd_line!
+    O << "GetLanguage(inFile) == \"" << OptName << '\"';
+    return true;
+  } else if (TestName == "not_empty") {
+    if (OptName == "o") {
+      O << "!OutputFilename.empty()";
+      return true;
+    }
+    else {
+      const GlobalOptionDescription& OptDesc = OptDescs.FindOption(OptName);
+      if (OptDesc.Type == OptionType::Switch)
+        throw OptName + ": incorrect option type!";
+      O << '!' << OptDesc.GenVariableName() << ".empty()";
+      return true;
+    }
+  }
+
+  return false;
+}
+
+/// EmitCaseTest2Args - Helper function used by
+/// EmitCaseConstructHandler.
+bool EmitCaseTest2Args(const std::string& TestName,
+                       const DagInit& d,
+                       const char* IndentLevel,
+                       const GlobalOptionDescriptions& OptDescs,
+                       std::ostream& O) {
+  checkNumberOfArguments(&d, 2);
+  const std::string& OptName = InitPtrToString(d.getArg(0));
+  const std::string& OptArg = InitPtrToString(d.getArg(1));
+  const GlobalOptionDescription& OptDesc = OptDescs.FindOption(OptName);
+
+  if (TestName == "parameter_equals") {
+    if (OptDesc.Type != OptionType::Parameter
+        && OptDesc.Type != OptionType::Prefix)
+      throw OptName + ": incorrect option type!";
+    O << OptDesc.GenVariableName() << " == \"" << OptArg << "\"";
+    return true;
+  }
+  else if (TestName == "element_in_list") {
+    if (OptDesc.Type != OptionType::ParameterList
+        && OptDesc.Type != OptionType::PrefixList)
+      throw OptName + ": incorrect option type!";
+    const std::string& VarName = OptDesc.GenVariableName();
+    O << "std::find(" << VarName << ".begin(),\n"
+      << IndentLevel << Indent1 << VarName << ".end(), \""
+      << OptArg << "\") != " << VarName << ".end()";
+    return true;
+  }
+
+  return false;
+}
+
+// Forward declaration.
+// EmitLogicalOperationTest and EmitCaseTest are mutually recursive.
+void EmitCaseTest(const DagInit& d, const char* IndentLevel,
+                  const GlobalOptionDescriptions& OptDescs,
+                  std::ostream& O);
+
+/// EmitLogicalOperationTest - Helper function used by
+/// EmitCaseConstructHandler.
+void EmitLogicalOperationTest(const DagInit& d, const char* LogicOp,
+                              const char* IndentLevel,
+                              const GlobalOptionDescriptions& OptDescs,
+                              std::ostream& O) {
+  O << '(';
+  for (unsigned j = 0, NumArgs = d.getNumArgs(); j < NumArgs; ++j) {
+    const DagInit& InnerTest = InitPtrToDag(d.getArg(j));
+    EmitCaseTest(InnerTest, IndentLevel, OptDescs, O);
+    if (j != NumArgs - 1)
+      O << ")\n" << IndentLevel << Indent1 << ' ' << LogicOp << " (";
+    else
+      O << ')';
+  }
+}
+
+/// EmitCaseTest - Helper function used by EmitCaseConstructHandler.
+void EmitCaseTest(const DagInit& d, const char* IndentLevel,
+                  const GlobalOptionDescriptions& OptDescs,
+                  std::ostream& O) {
+  const std::string& TestName = d.getOperator()->getAsString();
+
+  if (TestName == "and")
+    EmitLogicalOperationTest(d, "&&", IndentLevel, OptDescs, O);
+  else if (TestName == "or")
+    EmitLogicalOperationTest(d, "||", IndentLevel, OptDescs, O);
+  else if (EmitCaseTest1Arg(TestName, d, OptDescs, O))
+    return;
+  else if (EmitCaseTest2Args(TestName, d, IndentLevel, OptDescs, O))
+    return;
+  else
+    throw TestName + ": unknown edge property!";
+}
+
+// Emit code that handles the 'case' construct.
+// Takes a function object that should emit code for every case clause.
+// Callback's type is
+// void F(Init* Statement, const char* IndentLevel, std::ostream& O).
+template <typename F>
+void EmitCaseConstructHandler(const DagInit* d, const char* IndentLevel,
+                              F Callback, bool EmitElseIf,
+                              const GlobalOptionDescriptions& OptDescs,
+                              std::ostream& O) {
+  assert(d->getOperator()->getAsString() == "case");
+
+  unsigned numArgs = d->getNumArgs();
+  if (d->getNumArgs() < 2)
+    throw "There should be at least one clause in the 'case' expression:\n"
+      + d->getAsString();
+
+  for (unsigned i = 0; i != numArgs; ++i) {
+    const DagInit& Test = InitPtrToDag(d->getArg(i));
+
+    // Emit the test.
+    if (Test.getOperator()->getAsString() == "default") {
+      if (i+2 != numArgs)
+        throw std::string("The 'default' clause should be the last in the"
+                          "'case' construct!");
+      O << IndentLevel << "else {\n";
+    }
+    else {
+      O << IndentLevel << ((i != 0 && EmitElseIf) ? "else if (" : "if (");
+      EmitCaseTest(Test, IndentLevel, OptDescs, O);
+      O << ") {\n";
+    }
+
+    // Emit the corresponding statement.
+    ++i;
+    if (i == numArgs)
+      throw "Case construct handler: no corresponding action "
+        "found for the test " + Test.getAsString() + '!';
+
+    Init* arg = d->getArg(i);
+    if (dynamic_cast<DagInit*>(arg)
+        && static_cast<DagInit*>(arg)->getOperator()->getAsString() == "case") {
+      EmitCaseConstructHandler(static_cast<DagInit*>(arg),
+                               (std::string(IndentLevel) + Indent1).c_str(),
+                               Callback, EmitElseIf, OptDescs, O);
+    }
+    else {
+      Callback(arg, IndentLevel, O);
+    }
+    O << IndentLevel << "}\n";
+  }
+}
+
+/// EmitForwardOptionPropertyHandlingCode - Helper function used to
+/// implement EmitOptionPropertyHandlingCode(). Emits code for
+/// handling the (forward) option property.
+void EmitForwardOptionPropertyHandlingCode (const ToolOptionDescription& D,
+                                            std::ostream& O) {
+  switch (D.Type) {
+  case OptionType::Switch:
+    O << Indent3 << "vec.push_back(\"-" << D.Name << "\");\n";
+    break;
+  case OptionType::Parameter:
+    O << Indent3 << "vec.push_back(\"-" << D.Name << "\");\n";
+    O << Indent3 << "vec.push_back(" << D.GenVariableName() << ");\n";
+    break;
+  case OptionType::Prefix:
+    O << Indent3 << "vec.push_back(\"-" << D.Name << "\" + "
+      << D.GenVariableName() << ");\n";
+    break;
+  case OptionType::PrefixList:
+    O << Indent3 << "for (" << D.GenTypeDeclaration()
+      << "::iterator B = " << D.GenVariableName() << ".begin(),\n"
+      << Indent3 << "E = " << D.GenVariableName() << ".end(); B != E; ++B)\n"
+      << Indent4 << "vec.push_back(\"-" << D.Name << "\" + "
+      << "*B);\n";
+    break;
+  case OptionType::ParameterList:
+    O << Indent3 << "for (" << D.GenTypeDeclaration()
+      << "::iterator B = " << D.GenVariableName() << ".begin(),\n"
+      << Indent3 << "E = " << D.GenVariableName()
+      << ".end() ; B != E; ++B) {\n"
+      << Indent4 << "vec.push_back(\"-" << D.Name << "\");\n"
+      << Indent4 << "vec.push_back(*B);\n"
+      << Indent3 << "}\n";
+    break;
+  case OptionType::Alias:
+  default:
+    throw std::string("Aliases are not allowed in tool option descriptions!");
+  }
+}
+
+// ToolOptionHasInterestingProperties - A helper function used by
+// EmitOptionPropertyHandlingCode() that tells us whether we should
+// emit any property handling code at all.
+bool ToolOptionHasInterestingProperties(const ToolOptionDescription& D) {
+  bool ret = false;
+  for (OptionPropertyList::const_iterator B = D.Props.begin(),
+         E = D.Props.end(); B != E; ++B) {
+      const OptionProperty& OptProp = *B;
+      if (OptProp.first == OptionPropertyType::AppendCmd)
+        ret = true;
+    }
+  if (D.isForward() || D.isUnpackValues())
+    ret = true;
+  return ret;
+}
+
+/// EmitOptionPropertyHandlingCode - Helper function used by
+/// EmitGenerateActionMethod(). Emits code that handles option
+/// properties.
+void EmitOptionPropertyHandlingCode (const ToolOptionDescription& D,
+                                     std::ostream& O)
+{
+  if (!ToolOptionHasInterestingProperties(D))
+    return;
+  // Start of the if-clause.
+  O << Indent2 << "if (";
+  if (D.Type == OptionType::Switch)
+    O << D.GenVariableName();
+  else
+    O << '!' << D.GenVariableName() << ".empty()";
+
+  O <<") {\n";
+
+  // Handle option properties that take an argument.
+  for (OptionPropertyList::const_iterator B = D.Props.begin(),
+        E = D.Props.end(); B!=E; ++B) {
+    const OptionProperty& val = *B;
+
+    switch (val.first) {
+      // (append_cmd cmd) property
+    case OptionPropertyType::AppendCmd:
+      O << Indent3 << "vec.push_back(\"" << val.second << "\");\n";
+      break;
+      // Other properties with argument
+    default:
+      break;
+    }
+  }
+
+  // Handle flags
+
+  // (forward) property
+  if (D.isForward())
+    EmitForwardOptionPropertyHandlingCode(D, O);
+
+  // (unpack_values) property
+  if (D.isUnpackValues()) {
+    if (IsListOptionType(D.Type)) {
+      O << Indent3 << "for (" << D.GenTypeDeclaration()
+        << "::iterator B = " << D.GenVariableName() << ".begin(),\n"
+        << Indent3 << "E = " << D.GenVariableName()
+        << ".end(); B != E; ++B)\n"
+        << Indent4 << "llvm::SplitString(*B, vec, \",\");\n";
+    }
+    else if (D.Type == OptionType::Prefix || D.Type == OptionType::Parameter){
+      O << Indent3 << "llvm::SplitString("
+        << D.GenVariableName() << ", vec, \",\");\n";
+    }
+    else {
+      throw std::string("Switches can't have unpack_values property!");
+    }
+  }
+
+  // End of the if-clause.
+  O << Indent2 << "}\n";
+}
+
+/// SubstituteSpecialCommands - Perform string substitution for $CALL
+/// and $ENV. Helper function used by EmitCmdLineVecFill().
+std::string SubstituteSpecialCommands(const std::string& cmd) {
+  size_t cparen = cmd.find(")");
+  std::string ret;
+
+  if (cmd.find("$CALL(") == 0) {
+    if (cmd.size() == 6)
+      throw std::string("$CALL invocation: empty argument list!");
+
+    ret += "hooks::";
+    ret += std::string(cmd.begin() + 6, cmd.begin() + cparen);
+    ret += "()";
+  }
+  else if (cmd.find("$ENV(") == 0) {
+    if (cmd.size() == 5)
+      throw std::string("$ENV invocation: empty argument list!");
+
+    ret += "std::getenv(\"";
+    ret += std::string(cmd.begin() + 5, cmd.begin() + cparen);
+    ret += "\")";
+  }
+  else {
+    throw "Unknown special command: " + cmd;
+  }
+
+  if (cmd.begin() + cparen + 1 != cmd.end()) {
+    ret += " + std::string(\"";
+    ret += (cmd.c_str() + cparen + 1);
+    ret += "\")";
+  }
+
+  return ret;
+}
+
+/// EmitCmdLineVecFill - Emit code that fills in the command line
+/// vector. Helper function used by EmitGenerateActionMethod().
+void EmitCmdLineVecFill(const Init* CmdLine, const std::string& ToolName,
+                        bool Version, const char* IndentLevel,
+                        std::ostream& O) {
+  StrVector StrVec;
+  SplitString(InitPtrToString(CmdLine), StrVec);
+  if (StrVec.empty())
+    throw "Tool " + ToolName + " has empty command line!";
+
+  StrVector::const_iterator I = StrVec.begin();
+  ++I;
+  for (StrVector::const_iterator E = StrVec.end(); I != E; ++I) {
+    const std::string& cmd = *I;
+    O << IndentLevel;
+    if (cmd.at(0) == '$') {
+      if (cmd == "$INFILE") {
+        if (Version)
+          O << "for (PathVector::const_iterator B = inFiles.begin()"
+            << ", E = inFiles.end();\n"
+            << IndentLevel << "B != E; ++B)\n"
+            << IndentLevel << Indent1 << "vec.push_back(B->toString());\n";
+        else
+          O << "vec.push_back(inFile.toString());\n";
+      }
+      else if (cmd == "$OUTFILE") {
+        O << "vec.push_back(outFile.toString());\n";
+      }
+      else {
+        O << "vec.push_back(" << SubstituteSpecialCommands(cmd);
+        O << ");\n";
+      }
+    }
+    else {
+      O << "vec.push_back(\"" << cmd << "\");\n";
+    }
+  }
+  O << IndentLevel << "cmd = "
+    << ((StrVec[0][0] == '$') ? SubstituteSpecialCommands(StrVec[0])
+        : "\"" + StrVec[0] + "\"")
+    << ";\n";
+}
+
+/// EmitCmdLineVecFillCallback - A function object wrapper around
+/// EmitCmdLineVecFill(). Used by EmitGenerateActionMethod() as an
+/// argument to EmitCaseConstructHandler().
+class EmitCmdLineVecFillCallback {
+  bool Version;
+  const std::string& ToolName;
+ public:
+  EmitCmdLineVecFillCallback(bool Ver, const std::string& TN)
+    : Version(Ver), ToolName(TN) {}
+
+  void operator()(const Init* Statement, const char* IndentLevel,
+                  std::ostream& O) const
+  {
+    EmitCmdLineVecFill(Statement, ToolName, Version,
+                       (std::string(IndentLevel) + Indent1).c_str(), O);
+  }
+};
+
+// EmitGenerateActionMethod - Emit one of two versions of the
+// Tool::GenerateAction() method.
+void EmitGenerateActionMethod (const ToolProperties& P,
+                               const GlobalOptionDescriptions& OptDescs,
+                               bool Version, std::ostream& O) {
+  if (Version)
+    O << Indent1 << "Action GenerateAction(const PathVector& inFiles,\n";
+  else
+    O << Indent1 << "Action GenerateAction(const sys::Path& inFile,\n";
+
+  O << Indent2 << "const sys::Path& outFile,\n"
+    << Indent2 << "const InputLanguagesSet& InLangs) const\n"
+    << Indent1 << "{\n"
+    << Indent2 << "const char* cmd;\n"
+    << Indent2 << "std::vector<std::string> vec;\n";
+
+  // cmd_line is either a string or a 'case' construct.
+  if (typeid(*P.CmdLine) == typeid(StringInit))
+    EmitCmdLineVecFill(P.CmdLine, P.Name, Version, Indent2, O);
+  else
+    EmitCaseConstructHandler(&InitPtrToDag(P.CmdLine), Indent2,
+                             EmitCmdLineVecFillCallback(Version, P.Name),
+                             true, OptDescs, O);
+
+  // For every understood option, emit handling code.
+  for (ToolOptionDescriptions::const_iterator B = P.OptDescs.begin(),
+        E = P.OptDescs.end(); B != E; ++B) {
+    const ToolOptionDescription& val = B->second;
+    EmitOptionPropertyHandlingCode(val, O);
+  }
+
+  // Handle the Sink property.
+  if (P.isSink()) {
+    O << Indent2 << "if (!" << SinkOptionName << ".empty()) {\n"
+      << Indent3 << "vec.insert(vec.end(), "
+      << SinkOptionName << ".begin(), " << SinkOptionName << ".end());\n"
+      << Indent2 << "}\n";
+  }
+
+  O << Indent2 << "return Action(cmd, vec);\n"
+    << Indent1 << "}\n\n";
+}
+
+/// EmitGenerateActionMethods - Emit two GenerateAction() methods for
+/// a given Tool class.
+void EmitGenerateActionMethods (const ToolProperties& P,
+                                const GlobalOptionDescriptions& OptDescs,
+                                std::ostream& O) {
+  if (!P.isJoin())
+    O << Indent1 << "Action GenerateAction(const PathVector& inFiles,\n"
+      << Indent2 << "const llvm::sys::Path& outFile,\n"
+      << Indent2 << "const InputLanguagesSet& InLangs) const\n"
+      << Indent1 << "{\n"
+      << Indent2 << "throw std::runtime_error(\"" << P.Name
+      << " is not a Join tool!\");\n"
+      << Indent1 << "}\n\n";
+  else
+    EmitGenerateActionMethod(P, OptDescs, true, O);
+
+  EmitGenerateActionMethod(P, OptDescs, false, O);
+}
+
+/// EmitIsLastMethod - Emit the IsLast() method for a given Tool
+/// class.
+void EmitIsLastMethod (const ToolProperties& P, std::ostream& O) {
+  O << Indent1 << "bool IsLast() const {\n"
+    << Indent2 << "bool last = false;\n";
+
+  for (ToolOptionDescriptions::const_iterator B = P.OptDescs.begin(),
+        E = P.OptDescs.end(); B != E; ++B) {
+    const ToolOptionDescription& val = B->second;
+
+    if (val.isStopCompilation())
+      O << Indent2
+        << "if (" << val.GenVariableName()
+        << ")\n" << Indent3 << "last = true;\n";
+  }
+
+  O << Indent2 << "return last;\n"
+    << Indent1 <<  "}\n\n";
+}
+
+/// EmitInOutLanguageMethods - Emit the [Input,Output]Language()
+/// methods for a given Tool class.
+void EmitInOutLanguageMethods (const ToolProperties& P, std::ostream& O) {
+  O << Indent1 << "const char** InputLanguages() const {\n"
+    << Indent2 << "return InputLanguages_;\n"
+    << Indent1 << "}\n\n";
+
+  O << Indent1 << "const char* OutputLanguage() const {\n"
+    << Indent2 << "return \"" << P.OutLanguage << "\";\n"
+    << Indent1 << "}\n\n";
+}
+
+/// EmitOutputSuffixMethod - Emit the OutputSuffix() method for a
+/// given Tool class.
+void EmitOutputSuffixMethod (const ToolProperties& P, std::ostream& O) {
+  O << Indent1 << "const char* OutputSuffix() const {\n"
+    << Indent2 << "const char* ret = \"" << P.OutputSuffix << "\";\n";
+
+  for (ToolOptionDescriptions::const_iterator B = P.OptDescs.begin(),
+         E = P.OptDescs.end(); B != E; ++B) {
+    const ToolOptionDescription& OptDesc = B->second;
+    for (OptionPropertyList::const_iterator B = OptDesc.Props.begin(),
+           E = OptDesc.Props.end(); B != E; ++B) {
+      const OptionProperty& OptProp = *B;
+      if (OptProp.first == OptionPropertyType::OutputSuffix) {
+        O << Indent2 << "if (" << OptDesc.GenVariableName() << ")\n"
+          << Indent3 << "ret = \"" << OptProp.second << "\";\n";
+      }
+    }
+  }
+
+  O << Indent2 << "return ret;\n"
+    << Indent1 << "}\n\n";
+}
+
+/// EmitNameMethod - Emit the Name() method for a given Tool class.
+void EmitNameMethod (const ToolProperties& P, std::ostream& O) {
+  O << Indent1 << "const char* Name() const {\n"
+    << Indent2 << "return \"" << P.Name << "\";\n"
+    << Indent1 << "}\n\n";
+}
+
+/// EmitIsJoinMethod - Emit the IsJoin() method for a given Tool
+/// class.
+void EmitIsJoinMethod (const ToolProperties& P, std::ostream& O) {
+  O << Indent1 << "bool IsJoin() const {\n";
+  if (P.isJoin())
+    O << Indent2 << "return true;\n";
+  else
+    O << Indent2 << "return false;\n";
+  O << Indent1 << "}\n\n";
+}
+
+/// EmitStaticMemberDefinitions - Emit static member definitions for a
+/// given Tool class.
+void EmitStaticMemberDefinitions(const ToolProperties& P, std::ostream& O) {
+  O << "const char* " << P.Name << "::InputLanguages_[] = {";
+  for (StrVector::const_iterator B = P.InLanguage.begin(),
+         E = P.InLanguage.end(); B != E; ++B)
+    O << '\"' << *B << "\", ";
+  O << "0};\n\n";
+}
+
+/// EmitToolClassDefinition - Emit a Tool class definition.
+void EmitToolClassDefinition (const ToolProperties& P,
+                              const GlobalOptionDescriptions& OptDescs,
+                              std::ostream& O) {
+  if (P.Name == "root")
+    return;
+
+  // Header
+  O << "class " << P.Name << " : public ";
+  if (P.isJoin())
+    O << "JoinTool";
+  else
+    O << "Tool";
+
+  O << "{\nprivate:\n"
+    << Indent1 << "static const char* InputLanguages_[];\n\n";
+
+  O << "public:\n";
+  EmitNameMethod(P, O);
+  EmitInOutLanguageMethods(P, O);
+  EmitOutputSuffixMethod(P, O);
+  EmitIsJoinMethod(P, O);
+  EmitGenerateActionMethods(P, OptDescs, O);
+  EmitIsLastMethod(P, O);
+
+  // Close class definition
+  O << "};\n";
+
+  EmitStaticMemberDefinitions(P, O);
+
+}
+
+/// EmitOptionDescriptions - Iterate over a list of option
+/// descriptions and emit registration code.
+void EmitOptionDescriptions (const GlobalOptionDescriptions& descs,
+                             std::ostream& O)
+{
+  std::vector<GlobalOptionDescription> Aliases;
+
+  // Emit static cl::Option variables.
+  for (GlobalOptionDescriptions::const_iterator B = descs.begin(),
+         E = descs.end(); B!=E; ++B) {
+    const GlobalOptionDescription& val = B->second;
+
+    if (val.Type == OptionType::Alias) {
+      Aliases.push_back(val);
+      continue;
+    }
+
+    O << val.GenTypeDeclaration() << ' '
+      << val.GenVariableName()
+      << "(\"" << val.Name << '\"';
+
+    if (val.Type == OptionType::Prefix || val.Type == OptionType::PrefixList)
+      O << ", cl::Prefix";
+
+    if (val.isRequired()) {
+      switch (val.Type) {
+      case OptionType::PrefixList:
+      case OptionType::ParameterList:
+        O << ", cl::OneOrMore";
+        break;
+      default:
+        O << ", cl::Required";
+      }
+    }
+
+    if (!val.Help.empty())
+      O << ", cl::desc(\"" << val.Help << "\")";
+
+    O << ");\n";
+  }
+
+  // Emit the aliases (they should go after all the 'proper' options).
+  for (std::vector<GlobalOptionDescription>::const_iterator
+         B = Aliases.begin(), E = Aliases.end(); B != E; ++B) {
+    const GlobalOptionDescription& val = *B;
+
+    O << val.GenTypeDeclaration() << ' '
+      << val.GenVariableName()
+      << "(\"" << val.Name << '\"';
+
+    GlobalOptionDescriptions::container_type
+      ::const_iterator F = descs.Descriptions.find(val.Help);
+    if (F != descs.Descriptions.end())
+      O << ", cl::aliasopt(" << F->second.GenVariableName() << ")";
+    else
+      throw val.Name + ": alias to an unknown option!";
+
+    O << ", cl::desc(\"" << "An alias for -" + val.Help  << "\"));\n";
+  }
+
+  // Emit the sink option.
+  if (descs.HasSink)
+    O << "cl::list<std::string> " << SinkOptionName << "(cl::Sink);\n";
+
+  O << '\n';
+}
+
+/// EmitPopulateLanguageMap - Emit the PopulateLanguageMap() function.
+void EmitPopulateLanguageMap (const RecordKeeper& Records, std::ostream& O)
+{
+  // Get the relevant field out of RecordKeeper
+  Record* LangMapRecord = Records.getDef("LanguageMap");
+  if (!LangMapRecord)
+    throw std::string("Language map definition not found!");
+
+  ListInit* LangsToSuffixesList = LangMapRecord->getValueAsListInit("map");
+  if (!LangsToSuffixesList)
+    throw std::string("Error in the language map definition!");
+
+  // Generate code
+  O << "void llvmc::PopulateLanguageMap() {\n";
+
+  for (unsigned i = 0; i < LangsToSuffixesList->size(); ++i) {
+    Record* LangToSuffixes = LangsToSuffixesList->getElementAsRecord(i);
+
+    const std::string& Lang = LangToSuffixes->getValueAsString("lang");
+    const ListInit* Suffixes = LangToSuffixes->getValueAsListInit("suffixes");
+
+    for (unsigned i = 0; i < Suffixes->size(); ++i)
+      O << Indent1 << "GlobalLanguageMap[\""
+        << InitPtrToString(Suffixes->getElement(i))
+        << "\"] = \"" << Lang << "\";\n";
+  }
+
+  O << "}\n\n";
+}
+
+/// FillInToolToLang - Fills in two tables that map tool names to
+/// (input, output) languages.  Used by the typechecker.
+void FillInToolToLang (const ToolPropertiesList& TPList,
+                       StringMap<StringSet<> >& ToolToInLang,
+                       StringMap<std::string>& ToolToOutLang) {
+  for (ToolPropertiesList::const_iterator B = TPList.begin(), E = TPList.end();
+       B != E; ++B) {
+    const ToolProperties& P = *(*B);
+    for (StrVector::const_iterator B = P.InLanguage.begin(),
+           E = P.InLanguage.end(); B != E; ++B)
+      ToolToInLang[P.Name].insert(*B);
+    ToolToOutLang[P.Name] = P.OutLanguage;
+  }
+}
+
+/// TypecheckGraph - Check that names for output and input languages
+/// on all edges do match.
+// TOFIX: It would be nice if this function also checked for cycles
+// and multiple default edges in the graph (better error
+// reporting). Unfortunately, it is awkward to do right now because
+// our intermediate representation is not sufficiently
+// sofisticated. Algorithms like these should be run on a real graph
+// instead of AST.
+void TypecheckGraph (Record* CompilationGraph,
+                     const ToolPropertiesList& TPList) {
+  StringMap<StringSet<> > ToolToInLang;
+  StringMap<std::string> ToolToOutLang;
+
+  FillInToolToLang(TPList, ToolToInLang, ToolToOutLang);
+  ListInit* edges = CompilationGraph->getValueAsListInit("edges");
+  StringMap<std::string>::iterator IAE = ToolToOutLang.end();
+  StringMap<StringSet<> >::iterator IBE = ToolToInLang.end();
+
+  for (unsigned i = 0; i < edges->size(); ++i) {
+    Record* Edge = edges->getElementAsRecord(i);
+    Record* A = Edge->getValueAsDef("a");
+    Record* B = Edge->getValueAsDef("b");
+    StringMap<std::string>::iterator IA = ToolToOutLang.find(A->getName());
+    StringMap<StringSet<> >::iterator IB = ToolToInLang.find(B->getName());
+    if (IA == IAE)
+      throw A->getName() + ": no such tool!";
+    if (IB == IBE)
+      throw B->getName() + ": no such tool!";
+    if (A->getName() != "root" && IB->second.count(IA->second) == 0)
+      throw "Edge " + A->getName() + "->" + B->getName()
+        + ": output->input language mismatch";
+    if (B->getName() == "root")
+      throw std::string("Edges back to the root are not allowed!");
+  }
+}
+
+/// IncDecWeight - Helper function passed to EmitCaseConstructHandler()
+/// by EmitEdgeClass().
+void IncDecWeight (const Init* i, const char* IndentLevel,
+                   std::ostream& O) {
+  const DagInit& d = InitPtrToDag(i);
+  const std::string& OpName = d.getOperator()->getAsString();
+
+  if (OpName == "inc_weight")
+    O << IndentLevel << Indent1 << "ret += ";
+  else if (OpName == "dec_weight")
+    O << IndentLevel << Indent1 << "ret -= ";
+  else
+    throw "Unknown operator in edge properties list: " + OpName + '!';
+
+  if (d.getNumArgs() > 0)
+    O << InitPtrToInt(d.getArg(0)) << ";\n";
+  else
+    O << "2;\n";
+
+}
+
+/// EmitEdgeClass - Emit a single Edge# class.
+void EmitEdgeClass (unsigned N, const std::string& Target,
+                    DagInit* Case, const GlobalOptionDescriptions& OptDescs,
+                    std::ostream& O) {
+
+  // Class constructor.
+  O << "class Edge" << N << ": public Edge {\n"
+    << "public:\n"
+    << Indent1 << "Edge" << N << "() : Edge(\"" << Target
+    << "\") {}\n\n"
+
+  // Function Weight().
+    << Indent1 << "unsigned Weight(const InputLanguagesSet& InLangs) const {\n"
+    << Indent2 << "unsigned ret = 0;\n";
+
+  // Handle the 'case' construct.
+  EmitCaseConstructHandler(Case, Indent2, IncDecWeight, false, OptDescs, O);
+
+  O << Indent2 << "return ret;\n"
+    << Indent1 << "};\n\n};\n\n";
+}
+
+/// EmitEdgeClasses - Emit Edge* classes that represent graph edges.
+void EmitEdgeClasses (Record* CompilationGraph,
+                      const GlobalOptionDescriptions& OptDescs,
+                      std::ostream& O) {
+  ListInit* edges = CompilationGraph->getValueAsListInit("edges");
+
+  for (unsigned i = 0; i < edges->size(); ++i) {
+    Record* Edge = edges->getElementAsRecord(i);
+    Record* B = Edge->getValueAsDef("b");
+    DagInit* Weight = Edge->getValueAsDag("weight");
+
+    if (isDagEmpty(Weight))
+      continue;
+
+    EmitEdgeClass(i, B->getName(), Weight, OptDescs, O);
+  }
+}
+
+/// EmitPopulateCompilationGraph - Emit the PopulateCompilationGraph()
+/// function.
+void EmitPopulateCompilationGraph (Record* CompilationGraph,
+                                   std::ostream& O)
+{
+  ListInit* edges = CompilationGraph->getValueAsListInit("edges");
+
+  // Generate code
+  O << "void llvmc::PopulateCompilationGraph(CompilationGraph& G) {\n"
+    << Indent1 << "PopulateLanguageMap();\n\n";
+
+  // Insert vertices
+
+  RecordVector Tools = Records.getAllDerivedDefinitions("Tool");
+  if (Tools.empty())
+    throw std::string("No tool definitions found!");
+
+  for (RecordVector::iterator B = Tools.begin(), E = Tools.end(); B != E; ++B) {
+    const std::string& Name = (*B)->getName();
+    if (Name != "root")
+      O << Indent1 << "G.insertNode(new "
+        << Name << "());\n";
+  }
+
+  O << '\n';
+
+  // Insert edges
+  for (unsigned i = 0; i < edges->size(); ++i) {
+    Record* Edge = edges->getElementAsRecord(i);
+    Record* A = Edge->getValueAsDef("a");
+    Record* B = Edge->getValueAsDef("b");
+    DagInit* Weight = Edge->getValueAsDag("weight");
+
+    O << Indent1 << "G.insertEdge(\"" << A->getName() << "\", ";
+
+    if (isDagEmpty(Weight))
+      O << "new SimpleEdge(\"" << B->getName() << "\")";
+    else
+      O << "new Edge" << i << "()";
+
+    O << ");\n";
+  }
+
+  O << "}\n\n";
+}
+
+/// ExtractHookNames - Extract the hook names from all instances of
+/// $CALL(HookName) in the provided command line string. Helper
+/// function used by FillInHookNames().
+void ExtractHookNames(const Init* CmdLine, StrVector& HookNames) {
+  StrVector cmds;
+  llvm::SplitString(InitPtrToString(CmdLine), cmds);
+  for (StrVector::const_iterator B = cmds.begin(), E = cmds.end();
+       B != E; ++B) {
+    const std::string& cmd = *B;
+    if (cmd.find("$CALL(") == 0) {
+      if (cmd.size() == 6)
+        throw std::string("$CALL invocation: empty argument list!");
+      HookNames.push_back(std::string(cmd.begin() + 6,
+                                      cmd.begin() + cmd.find(")")));
+    }
+  }
+}
+
+/// ExtractHookNamesFromCaseConstruct - Extract hook names from the
+/// 'case' expression, handle nesting. Helper function used by
+/// FillInHookNames().
+void ExtractHookNamesFromCaseConstruct(Init* Case, StrVector& HookNames) {
+  const DagInit& d = InitPtrToDag(Case);
+  bool even = false;
+  for (DagInit::const_arg_iterator B = d.arg_begin(), E = d.arg_end();
+       B != E; ++B) {
+    Init* arg = *B;
+    if (even && dynamic_cast<DagInit*>(arg)
+        && static_cast<DagInit*>(arg)->getOperator()->getAsString() == "case")
+      ExtractHookNamesFromCaseConstruct(arg, HookNames);
+    else if (even)
+      ExtractHookNames(arg, HookNames);
+    even = !even;
+  }
+}
+
+/// FillInHookNames - Actually extract the hook names from all command
+/// line strings. Helper function used by EmitHookDeclarations().
+void FillInHookNames(const ToolPropertiesList& TPList,
+                     StrVector& HookNames) {
+  // For all command lines:
+  for (ToolPropertiesList::const_iterator B = TPList.begin(),
+         E = TPList.end(); B != E; ++B) {
+    const ToolProperties& P = *(*B);
+    if (!P.CmdLine)
+      continue;
+    if (dynamic_cast<StringInit*>(P.CmdLine))
+      // This is a string.
+      ExtractHookNames(P.CmdLine, HookNames);
+    else
+      // This is a 'case' construct.
+      ExtractHookNamesFromCaseConstruct(P.CmdLine, HookNames);
+  }
+}
+
+/// EmitHookDeclarations - Parse CmdLine fields of all the tool
+/// property records and emit hook function declaration for each
+/// instance of $CALL(HookName).
+void EmitHookDeclarations(const ToolPropertiesList& ToolProps,
+                          std::ostream& O) {
+  StrVector HookNames;
+  FillInHookNames(ToolProps, HookNames);
+  if (HookNames.empty())
+    return;
+  std::sort(HookNames.begin(), HookNames.end());
+  StrVector::const_iterator E = std::unique(HookNames.begin(), HookNames.end());
+
+  O << "namespace hooks {\n";
+  for (StrVector::const_iterator B = HookNames.begin(); B != E; ++B)
+    O << Indent1 << "std::string " << *B << "();\n";
+
+  O << "}\n\n";
+}
+
+// End of anonymous namespace
+}
+
+/// run - The back-end entry point.
+void LLVMCConfigurationEmitter::run (std::ostream &O) {
+  try {
+
+  // Emit file header.
+  EmitSourceFileHeader("LLVMC Configuration Library", O);
+
+  // Get a list of all defined Tools.
+  RecordVector Tools = Records.getAllDerivedDefinitions("Tool");
+  if (Tools.empty())
+    throw std::string("No tool definitions found!");
+
+  // Gather information from the Tool description dags.
+  ToolPropertiesList tool_props;
+  GlobalOptionDescriptions opt_descs;
+  CollectToolProperties(Tools.begin(), Tools.end(), tool_props, opt_descs);
+
+  RecordVector OptionLists = Records.getAllDerivedDefinitions("OptionList");
+  CollectPropertiesFromOptionList(OptionLists.begin(), OptionLists.end(),
+                                  opt_descs);
+
+  // Check that there are no options without side effects (specified
+  // only in the OptionList).
+  CheckForSuperfluousOptions(tool_props, opt_descs);
+
+  // Emit global option registration code.
+  EmitOptionDescriptions(opt_descs, O);
+
+  // Emit hook declarations.
+  EmitHookDeclarations(tool_props, O);
+
+  // Emit PopulateLanguageMap() function
+  // (a language map maps from file extensions to language names).
+  EmitPopulateLanguageMap(Records, O);
+
+  // Emit Tool classes.
+  for (ToolPropertiesList::const_iterator B = tool_props.begin(),
+         E = tool_props.end(); B!=E; ++B)
+    EmitToolClassDefinition(*(*B), opt_descs, O);
+
+  Record* CompilationGraphRecord = Records.getDef("CompilationGraph");
+  if (!CompilationGraphRecord)
+    throw std::string("Compilation graph description not found!");
+
+  // Typecheck the compilation graph.
+  TypecheckGraph(CompilationGraphRecord, tool_props);
+
+  // Emit Edge# classes.
+  EmitEdgeClasses(CompilationGraphRecord, opt_descs, O);
+
+  // Emit PopulateCompilationGraph() function.
+  EmitPopulateCompilationGraph(CompilationGraphRecord, O);
+
+  // EOF
+  } catch (std::exception& Error) {
+    throw Error.what() + std::string(" - usually this means a syntax error.");
+  }
+}

Added: llvm/branches/non-call-eh/utils/TableGen/LLVMCConfigurationEmitter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/utils/TableGen/LLVMCConfigurationEmitter.h?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/utils/TableGen/LLVMCConfigurationEmitter.h (added)
+++ llvm/branches/non-call-eh/utils/TableGen/LLVMCConfigurationEmitter.h Sun Jul  6 15:45:41 2008
@@ -0,0 +1,33 @@
+//===- LLVMCConfigurationEmitter.cpp - Generate LLVMCC config ---*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open
+// Source License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This tablegen backend is responsible for emitting LLVMCC configuration code.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_UTILS_TABLEGEN_LLVMCCONF_EMITTER_H
+#define LLVM_UTILS_TABLEGEN_LLVMCCONF_EMITTER_H
+
+#include "TableGenBackend.h"
+
+namespace llvm {
+
+  /// LLVMCConfigurationEmitter - TableGen backend that generates
+  /// configuration code for LLVMC.
+  class LLVMCConfigurationEmitter : public TableGenBackend {
+    RecordKeeper &Records;
+  public:
+    explicit LLVMCConfigurationEmitter(RecordKeeper &R) : Records(R) {}
+
+    // run - Output the asmwriter, returning true on failure.
+    void run(std::ostream &o);
+  };
+}
+
+#endif //LLVM_UTILS_TABLEGEN_LLVMCCONF_EMITTER_H

Modified: llvm/branches/non-call-eh/utils/TableGen/Record.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/utils/TableGen/Record.cpp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/utils/TableGen/Record.cpp (original)
+++ llvm/branches/non-call-eh/utils/TableGen/Record.cpp Sun Jul  6 15:45:41 2008
@@ -666,8 +666,6 @@
   }
 
   if (NewRec != Rec) {
-    dump();
-    NewRec->dump(); cerr << "\n";
     return new FieldInit(NewRec, FieldName);
   }
   return this;

Modified: llvm/branches/non-call-eh/utils/TableGen/RegisterInfoEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/utils/TableGen/RegisterInfoEmitter.cpp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/utils/TableGen/RegisterInfoEmitter.cpp (original)
+++ llvm/branches/non-call-eh/utils/TableGen/RegisterInfoEmitter.cpp Sun Jul  6 15:45:41 2008
@@ -64,6 +64,8 @@
      << "  virtual int getDwarfRegNumFull(unsigned RegNum, "
      << "unsigned Flavour) const;\n"
      << "  virtual int getDwarfRegNum(unsigned RegNum, bool isEH) const = 0;\n"
+     << "  virtual bool needsStackRealignment(const MachineFunction &) const\n"
+     << "     { return false; }\n"
      << "  unsigned getSubReg(unsigned RegNo, unsigned Index) const;\n"
      << "};\n\n";
 
@@ -221,7 +223,7 @@
     // Emit the register list now.
     OS << "  // " << Name 
        << " Register Class Value Types...\n"
-       << "  static const MVT::ValueType " << Name
+       << "  static const MVT " << Name
        << "[] = {\n    ";
     for (unsigned i = 0, e = RC.VTs.size(); i != e; ++i)
       OS << getEnumName(RC.VTs[i]) << ", ";
@@ -416,7 +418,6 @@
   OS << "  };\n";
 
   // Emit register sub-registers / super-registers, aliases...
-  std::map<Record*, std::set<Record*> > RegisterImmSubRegs;
   std::map<Record*, std::set<Record*> > RegisterSubRegs;
   std::map<Record*, std::set<Record*> > RegisterSuperRegs;
   std::map<Record*, std::set<Record*> > RegisterAliases;
@@ -457,11 +458,80 @@
         cerr << "Warning: register " << getQualifiedName(SubReg)
              << " specified as a sub-register of " << getQualifiedName(R)
              << " multiple times!\n";
-      RegisterImmSubRegs[R].insert(SubReg);
       addSubSuperReg(R, SubReg, RegisterSubRegs, RegisterSuperRegs,
                      RegisterAliases);
     }
   }
+  
+  // Print the SubregHashTable, a simple quadratically probed
+  // hash table for determining if a register is a subregister
+  // of another register.
+  unsigned NumSubRegs = 0;
+  std::map<Record*, unsigned> RegNo;
+  for (unsigned i = 0, e = Regs.size(); i != e; ++i) {
+    RegNo[Regs[i].TheDef] = i;
+    NumSubRegs += RegisterSubRegs[Regs[i].TheDef].size();
+  }
+  
+  unsigned SubregHashTableSize = NextPowerOf2(2 * NumSubRegs);
+  unsigned* SubregHashTable = new unsigned[2 * SubregHashTableSize];
+  std::fill(SubregHashTable, SubregHashTable + 2 * SubregHashTableSize, ~0U);
+  
+  for (unsigned i = 0, e = Regs.size(); i != e; ++i) {
+    Record* R = Regs[i].TheDef;
+    for (std::set<Record*>::iterator I = RegisterSubRegs[R].begin(),
+         E = RegisterSubRegs[R].end(); I != E; ++I) {
+      Record* RJ = *I;
+      // We have to increase the indices of both registers by one when
+      // computing the hash because, in the generated code, there
+      // will be an extra empty slot at register 0.
+      size_t index = ((i+1) + (RegNo[RJ]+1) * 37) & (SubregHashTableSize-1);
+      unsigned ProbeAmt = 2;
+      while (SubregHashTable[index*2] != ~0U &&
+             SubregHashTable[index*2+1] != ~0U) {
+        index = (index + ProbeAmt) & (SubregHashTableSize-1);
+        ProbeAmt += 2;
+      }
+      
+      SubregHashTable[index*2] = i;
+      SubregHashTable[index*2+1] = RegNo[RJ];
+    }
+  }
+  
+  if (SubregHashTableSize) {
+    std::string Namespace = Regs[0].TheDef->getValueAsString("Namespace");
+    
+    OS << "\n\n  const unsigned SubregHashTable[] = { ";
+    for (unsigned i = 0; i < SubregHashTableSize - 1; ++i) {
+      if (i != 0)
+        // Insert spaces for nice formatting.
+        OS << "                                       ";
+      
+      if (SubregHashTable[2*i] != ~0U) {
+        OS << getQualifiedName(Regs[SubregHashTable[2*i]].TheDef) << ", "
+           << getQualifiedName(Regs[SubregHashTable[2*i+1]].TheDef) << ", \n";
+      } else {
+        OS << Namespace << "::NoRegister, " << Namespace << "::NoRegister, \n";
+      }
+    }
+    
+    unsigned Idx = SubregHashTableSize*2-2;
+    if (SubregHashTable[Idx] != ~0U) {
+      OS << "                                       "
+         << getQualifiedName(Regs[SubregHashTable[Idx]].TheDef) << ", "
+         << getQualifiedName(Regs[SubregHashTable[Idx+1]].TheDef) << " };\n";
+    } else {
+      OS << Namespace << "::NoRegister, " << Namespace << "::NoRegister };\n";
+    }
+    
+    OS << "  const unsigned SubregHashTableSize = "
+       << SubregHashTableSize << ";\n";
+  } else {
+    OS << "\n\n  const unsigned SubregHashTable[] = { ~0U, ~0U };\n"
+       << "  const unsigned SubregHashTableSize = 1;\n";
+  }
+  
+  delete [] SubregHashTable;
 
   if (!RegisterAliases.empty())
     OS << "\n\n  // Register Alias Sets...\n";
@@ -500,21 +570,6 @@
     OS << "0 };\n";
   }
 
-  if (!RegisterImmSubRegs.empty())
-    OS << "\n\n  // Register Immediate Sub-registers Sets...\n";
-
-  // Loop over all of the registers which have sub-registers, emitting the
-  // sub-registers list to memory.
-  for (std::map<Record*, std::set<Record*> >::iterator
-         I = RegisterImmSubRegs.begin(), E = RegisterImmSubRegs.end();
-       I != E; ++I) {
-    OS << "  const unsigned " << I->first->getName() << "_ImmSubRegsSet[] = { ";
-    for (std::set<Record*>::iterator ASI = I->second.begin(),
-           E = I->second.end(); ASI != E; ++ASI)
-      OS << getQualifiedName(*ASI) << ", ";
-    OS << "0 };\n";
-  }
-
   if (!RegisterSuperRegs.empty())
     OS << "\n\n  // Register Super-registers Sets...\n";
 
@@ -538,7 +593,7 @@
   }
 
   OS<<"\n  const TargetRegisterDesc RegisterDescriptors[] = { // Descriptors\n";
-  OS << "    { \"NOREG\",\t\"NOREG\",\t0,\t0,\t0,\t0 },\n";
+  OS << "    { \"NOREG\",\t\"NOREG\",\t0,\t0,\t0 },\n";
 
   // Now that register alias and sub-registers sets have been emitted, emit the
   // register descriptors now.
@@ -569,10 +624,6 @@
       OS << Reg.getName() << "_SubRegsSet,\t";
     else
       OS << "Empty_SubRegsSet,\t";
-    if (RegisterImmSubRegs.count(Reg.TheDef))
-      OS << Reg.getName() << "_ImmSubRegsSet,\t";
-    else
-      OS << "Empty_SubRegsSet,\t";
     if (RegisterSuperRegs.count(Reg.TheDef))
       OS << Reg.getName() << "_SuperRegsSet },\n";
     else
@@ -626,7 +677,9 @@
      << "(int CallFrameSetupOpcode, int CallFrameDestroyOpcode)\n"
      << "  : TargetRegisterInfo(RegisterDescriptors, " << Registers.size()+1
      << ", RegisterClasses, RegisterClasses+" << RegisterClasses.size() <<",\n "
-     << "                 CallFrameSetupOpcode, CallFrameDestroyOpcode) {}\n\n";
+     << "                 CallFrameSetupOpcode, CallFrameDestroyOpcode,\n"
+     << "                 SubregHashTable, SubregHashTableSize) {\n"
+     << "}\n\n";
 
   // Collect all information about dwarf register numbers
 

Modified: llvm/branches/non-call-eh/utils/TableGen/TableGen.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/utils/TableGen/TableGen.cpp?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/utils/TableGen/TableGen.cpp (original)
+++ llvm/branches/non-call-eh/utils/TableGen/TableGen.cpp Sun Jul  6 15:45:41 2008
@@ -31,7 +31,7 @@
 #include "DAGISelEmitter.h"
 #include "SubtargetEmitter.h"
 #include "IntrinsicEmitter.h"
-#include "LLVMCCConfigurationEmitter.h"
+#include "LLVMCConfigurationEmitter.h"
 #include <algorithm>
 #include <cstdio>
 #include <fstream>
@@ -47,7 +47,7 @@
   GenDAGISel,
   GenSubtarget,
   GenIntrinsic,
-  GenLLVMCCConf,
+  GenLLVMCConf,
   PrintEnums
 };
 
@@ -78,8 +78,8 @@
                                "Generate subtarget enumerations"),
                     clEnumValN(GenIntrinsic, "gen-intrinsic",
                                "Generate intrinsic information"),
-                    clEnumValN(GenLLVMCCConf, "gen-llvmcc",
-                               "Generate LLVMCC configuration library"),
+                    clEnumValN(GenLLVMCConf, "gen-llvmc",
+                               "Generate LLVMC configuration library"),
                     clEnumValN(PrintEnums, "print-enums",
                                "Print enum values for a class"),
                     clEnumValEnd));
@@ -104,7 +104,7 @@
 
 /// ParseFile - this function begins the parsing of the specified tablegen
 /// file.
-static bool ParseFile(const std::string &Filename, 
+static bool ParseFile(const std::string &Filename,
                       const std::vector<std::string> &IncludeDirs) {
   std::string ErrorStr;
   MemoryBuffer *F = MemoryBuffer::getFileOrSTDIN(Filename.c_str(), &ErrorStr);
@@ -112,13 +112,13 @@
     cerr << "Could not open input file '" + Filename + "': " << ErrorStr <<"\n";
     return true;
   }
-  
+
   TGParser Parser(F);
-  
+
   // Record the location of the include directory so that the lexer can find
   // it later.
   Parser.setIncludeDirs(IncludeDirs);
-  
+
   return Parser.ParseFile();
 }
 
@@ -183,8 +183,8 @@
     case GenIntrinsic:
       IntrinsicEmitter(Records).run(*Out);
       break;
-    case GenLLVMCCConf:
-      LLVMCCConfigurationEmitter(Records).run(*Out);
+    case GenLLVMCConf:
+      LLVMCConfigurationEmitter(Records).run(*Out);
       break;
     case PrintEnums:
     {

Modified: llvm/branches/non-call-eh/utils/buildit/build_llvm
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/utils/buildit/build_llvm?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/utils/buildit/build_llvm (original)
+++ llvm/branches/non-call-eh/utils/buildit/build_llvm Sun Jul  6 15:45:41 2008
@@ -173,21 +173,19 @@
 
 # Remove PPC64 fat slices.
 cd $DEST_DIR$DEST_ROOT/bin
-
 if [ $MACOSX_DEPLOYMENT_TARGET = "10.4" ]; then
     find . -perm 755 -type f -exec lipo -extract ppc -extract i386 {} -output {} \;
-else
+elif [ $MACOSX_DEPLOYMENT_TARGET = "10.5" ]; then
     find . -perm 755 -type f -exec lipo -extract ppc7400 -extract i386 {} -output {} \;
+else
+    find . -perm 755 -type f -exec lipo -extract ppc7400 -extract i386 -extract x86_64 {} -output {} \;
 fi
 
 cd $DEST_DIR$DEST_ROOT
-
 mkdir -p $DT_HOME/lib
 mv lib/libLTO.dylib $DT_HOME/lib/libLTO.dylib
 rm -f lib/libLTO.a lib/libLTO.la
 
-
-
 ################################################################################
 # Create SYM_DIR with information required for debugging.
 
@@ -235,6 +233,11 @@
 chgrp -R wheel $DEST_DIR
 
 ################################################################################
+# Remove tar ball from docs directory
+
+find $DEST_DIR -name html.tar.gz -exec rm {} \;
+
+################################################################################
 # w00t! Done!
 
 exit 0

Added: llvm/branches/non-call-eh/utils/llvm.grm
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/utils/llvm.grm?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/utils/llvm.grm (added)
+++ llvm/branches/non-call-eh/utils/llvm.grm Sun Jul  6 15:45:41 2008
@@ -0,0 +1,389 @@
+(*
+
+polygen grammar for LLVM assembly language.
+
+This file defines an LLVM assembly language grammar for polygen,
+which is a tool for generating random text based on a grammar.
+It is strictly syntax-based, and makes no attempt to generate
+IR that is semantically valid. Most of the IR produced doesn't
+pass the Verifier.
+
+*)
+
+I ::=   "title:    LLVM assembly language\n"
+      ^ "status:   experimental\n"
+      ^ "audience: LLVM developers\n"
+;
+
+S ::= Module ;
+
+(*
+Define rules for non-keyword tokens. This is currently just a bunch
+of hacks. They don't cover many valid forms of tokens, and they also
+generate some invalid forms of tokens. The LLVM parser has custom
+C++ code to lex these; custom C++ code for emitting them would be
+convenient, but polygen doesn't support that.
+*)
+NonZeroDecimalDigit ::=     1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 ;
+DecimalDigit        ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 ;
+DecimalDigitSeq     ::= DecimalDigit [^ DecimalDigitSeq ];
+HexDigit            ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
+                      | a | b | c | d | e | f ;
+HexDigitSeq         ::= HexDigit [^ HexDigitSeq ];
+StringChar          ::= a | b | c | d | e | f | g | h | i | j | k | l | m
+                      | n | o | p | q | r | s | t | u | v | w | x | y | z ;
+StringConstantSeq   ::= StringChar [^ StringConstantSeq ];
+StringConstant      ::= StringChar [^ StringConstantSeq ];
+EUINT64VAL          ::= NonZeroDecimalDigit [^ DecimalDigitSeq ];
+ESINT64VAL          ::= [ "-" ] ^ EUINT64VAL ;
+EUAPINTVAL          ::= EUINT64VAL ;
+ESAPINTVAL          ::= ESINT64VAL ;
+LOCALVALID          ::= "%" ^ DecimalDigitSeq ;
+GLOBALVALID         ::= "@" ^ DecimalDigitSeq ;
+INTTYPE             ::= "i" ^ EUINT64VAL ;
+GLOBALVAR           ::= "@" ^ StringConstant ;
+LOCALVAR            ::= "%" ^ StringConstant ;
+STRINGCONSTANT      ::= "\"" ^ StringConstant ^ "\"" ;
+ATSTRINGCONSTANT    ::= "@" ^ STRINGCONSTANT ;
+PCTSTRINGCONSTANT   ::= "%" ^ STRINGCONSTANT ;
+LABELSTR            ::= StringConstant ;
+FPVAL               ::= ESAPINTVAL ^ "." ^ EUAPINTVAL | "0x" ^ HexDigitSeq ;
+
+(*
+The rest of this file is derived directly from llvmAsmParser.y.
+*)
+
+ArithmeticOps ::= add | sub | mul | udiv | sdiv | fdiv | urem | srem | frem ;
+LogicalOps    ::= shl | lshr | ashr | and | or | xor;
+CastOps       ::= trunc | zext | sext | fptrunc | fpext | bitcast |
+                  uitofp | sitofp | fptoui | fptosi | inttoptr | ptrtoint ;
+
+IPredicates ::= eq | ne | slt | sgt | sle | sge | ult | ugt | ule | uge ;
+
+FPredicates ::= oeq | one | olt | ogt | ole | oge | ord | uno | ueq | une
+              | ult | ugt | ule | uge | true | false ;
+
+IntType ::= INTTYPE;
+FPType  ::= float | double | "ppc_fp128" | fp128 | "x86_fp80";
+
+LocalName ::= LOCALVAR | STRINGCONSTANT | PCTSTRINGCONSTANT ;
+OptLocalName ::= LocalName | _ ;
+
+OptAddrSpace ::= - addrspace "(" ^ EUINT64VAL ^ ")" | _ ;
+
+OptLocalAssign ::= LocalName "=" | _ ;
+
+GlobalName ::= GLOBALVAR | ATSTRINGCONSTANT ;
+
+OptGlobalAssign ::= GlobalAssign | _ ;
+
+GlobalAssign ::= GlobalName "=" ;
+
+GVInternalLinkage
+  ::= + internal
+ | weak
+ | linkonce
+ | appending
+ | dllexport
+ | common
+ ;
+
+GVExternalLinkage
+  ::= dllimport
+ | "extern_weak"
+ | + external
+ ;
+
+GVVisibilityStyle
+  ::= + _
+ | default
+ | hidden
+ | protected
+ ;
+
+FunctionDeclareLinkage
+  ::= + _
+ | dllimport
+ | "extern_weak"
+ ;
+
+FunctionDefineLinkage
+  ::= + _
+ | internal
+ | linkonce
+ | weak
+ | dllexport
+ ;
+
+AliasLinkage ::= + _ | weak | internal ;
+
+OptCallingConv ::= + _ |
+                 ccc |
+                 fastcc |
+                 coldcc |
+                 "x86_stdcallcc" |
+                 "x86_fastcallcc" |
+                 cc EUINT64VAL ;
+
+ParamAttr ::= zeroext
+ | zext
+ | signext
+ | sext
+ | inreg
+ | sret
+ | noalias
+ | byval
+ | nest
+ | align EUINT64VAL
+ ;
+
+OptParamAttrs ::= + _ | OptParamAttrs ParamAttr ;
+
+FuncAttr      ::= noreturn
+ | nounwind
+ | zeroext
+ | signext
+ | readnone
+ | readonly
+ ;
+
+OptFuncAttrs  ::= + _ | OptFuncAttrs FuncAttr ;
+
+OptGC         ::= + _ | gc STRINGCONSTANT ;
+
+OptAlign      ::= + _ | align EUINT64VAL ;
+OptCAlign     ::= + _ | ^ "," align EUINT64VAL ;
+
+SectionString ::= section STRINGCONSTANT ;
+
+OptSection    ::= + _ | SectionString ;
+
+GlobalVarAttributes ::= + _ | ^ "," GlobalVarAttribute GlobalVarAttributes ;
+GlobalVarAttribute  ::= SectionString | align EUINT64VAL ;
+
+PrimType ::= INTTYPE | float | double | "ppc_fp128" | fp128 | "x86_fp80"
+          | - label ;
+
+Types
+  ::= opaque
+ | PrimType
+ | Types OptAddrSpace ^ "*"
+ | SymbolicValueRef
+ | "\\" ^ EUINT64VAL
+ | Types "(" ^ ArgTypeListI ^ ")" OptFuncAttrs
+ | void "(" ^ ArgTypeListI ^ ")" OptFuncAttrs
+ | "[" ^ EUINT64VAL "x" Types ^ "]"
+ | "<" ^ EUINT64VAL "x" Types ^ ">"
+ | "{" TypeListI "}"
+ | "{" "}"
+ | "<" ^ "{" TypeListI "}" ^ ">"
+ | "<" ^ "{" "}" ^ ">"
+ ;
+
+ArgType ::= Types OptParamAttrs ;
+
+ResultTypes ::= Types | void ;
+
+ArgTypeList ::= ArgType | ArgTypeList ^ "," ArgType ;
+
+ArgTypeListI ::= ArgTypeList | ArgTypeList ^ "," "..." | "..." | _ ;
+
+TypeListI ::= Types | TypeListI ^ "," Types ;
+
+ConstVal::= Types "[" ^ ConstVector ^ "]"
+ | Types "[" "]"
+ | Types "c" ^ STRINGCONSTANT
+ | Types "<" ^ ConstVector ^ ">"
+ | Types "{" ConstVector "}"
+ | Types "{" "}"
+ | Types "<" ^ "{" ConstVector "}" ^ ">"
+ | Types "<" ^ "{" "}" ^ ">"
+ | Types null
+ | Types undef
+ | Types SymbolicValueRef
+ | Types ConstExpr
+ | Types zeroinitializer
+ | IntType ESINT64VAL
+ | IntType ESAPINTVAL
+ | IntType EUINT64VAL
+ | IntType EUAPINTVAL
+ | INTTYPE true
+ | INTTYPE false
+ | FPType FPVAL ;
+
+ConstExpr::= CastOps "(" ^ ConstVal to Types ^ ")"
+ | getelementptr "(" ^ ConstVal IndexList ^ ")"
+ | select "(" ^ ConstVal ^ "," ConstVal ^ "," ConstVal ^ ")"
+ | ArithmeticOps "(" ^ ConstVal ^ "," ConstVal ^ ")"
+ | LogicalOps "(" ^ ConstVal ^ "," ConstVal ^ ")"
+ | icmp IPredicates "(" ^ ConstVal ^ "," ConstVal ^ ")"
+ | fcmp FPredicates "(" ^ ConstVal ^ "," ConstVal ^ ")"
+ | vicmp IPredicates "(" ^ ConstVal ^ "," ConstVal ^ ")"
+ | vfcmp FPredicates "(" ^ ConstVal ^ "," ConstVal ^ ")"
+ | extractelement "(" ^ ConstVal ^ "," ConstVal ^ ")"
+ | insertelement "(" ^ ConstVal ^ "," ConstVal ^ "," ConstVal ^ ")"
+ | shufflevector "(" ^ ConstVal ^ "," ConstVal ^ "," ConstVal ^ ")"
+ | extractvalue "(" ^ ConstVal ^ ConstantIndexList ^ ")"
+ | insertvalue "(" ^ ConstVal ^ "," ConstVal ^ ConstantIndexList ^ ")" ;
+
+ConstVector ::= ConstVector ^ "," ConstVal | ConstVal ;
+
+GlobalType ::= global | constant ;
+
+ThreadLocal ::= - "thread_local" | _ ;
+
+AliaseeRef ::= ResultTypes SymbolicValueRef
+ | bitcast "(" ^ AliaseeRef to Types ^ ")" ;
+
+Module ::= +++ DefinitionList | --- _ ;
+
+DefinitionList ::= - Definition | + DefinitionList Definition ;
+
+Definition
+  ::= ^ ( +++++ define Function
+ | declare FunctionProto
+ | - module asm AsmBlock
+ | OptLocalAssign type Types
+ | OptLocalAssign type void
+ | OptGlobalAssign GVVisibilityStyle ThreadLocal GlobalType ConstVal
+   OptAddrSpace GlobalVarAttributes
+ | OptGlobalAssign GVInternalLinkage GVVisibilityStyle ThreadLocal GlobalType
+   ConstVal OptAddrSpace GlobalVarAttributes
+ | OptGlobalAssign GVExternalLinkage GVVisibilityStyle ThreadLocal GlobalType
+   Types OptAddrSpace GlobalVarAttributes
+ | OptGlobalAssign GVVisibilityStyle alias AliasLinkage AliaseeRef
+ | target TargetDefinition
+ | deplibs "=" LibrariesDefinition
+ ) ^ "\n";
+
+AsmBlock ::= STRINGCONSTANT ;
+
+TargetDefinition ::= triple "=" STRINGCONSTANT
+ | datalayout "=" STRINGCONSTANT ;
+
+LibrariesDefinition ::= "[" LibList "]";
+
+LibList ::= LibList ^ "," STRINGCONSTANT | STRINGCONSTANT | _ ;
+
+ArgListH ::= ArgListH ^ "," Types OptParamAttrs OptLocalName
+ | Types OptParamAttrs OptLocalName ;
+
+ArgList ::= ArgListH | ArgListH ^ "," "..." | "..." | _ ;
+
+FunctionHeaderH ::= OptCallingConv ResultTypes GlobalName "(" ^ ArgList ^ ")"
+                  OptFuncAttrs OptSection OptAlign OptGC ;
+
+BEGIN ::= ( begin | "{" ) ^ "\n";
+
+FunctionHeader ::=
+  FunctionDefineLinkage GVVisibilityStyle FunctionHeaderH BEGIN ;
+
+END ::= ^ ( end | "}" ) ^ "\n";
+
+Function ::= BasicBlockList END ;
+
+FunctionProto ::= FunctionDeclareLinkage GVVisibilityStyle FunctionHeaderH ;
+
+OptSideEffect ::= _ | sideeffect ;
+
+ConstValueRef ::= ESINT64VAL
+ | EUINT64VAL
+ | FPVAL
+ | true
+ | false
+ | null
+ | undef
+ | zeroinitializer
+ | "<" ConstVector ">"
+ | "[" ConstVector "]"
+ | "[" "]"
+ | "c" ^ STRINGCONSTANT
+ | "{" ConstVector "}"
+ | "{" "}"
+ | "<" ^ "{" ConstVector "}" ^ ">"
+ | "<" ^ "{" "}" ^ ">"
+ | ConstExpr
+ | asm OptSideEffect STRINGCONSTANT ^ "," STRINGCONSTANT ;
+
+SymbolicValueRef ::= LOCALVALID
+ | GLOBALVALID
+ | LocalName
+ | GlobalName ;
+
+ValueRef ::= SymbolicValueRef | ConstValueRef;
+
+ResolvedVal ::= Types ValueRef ;
+
+ReturnedVal ::= ResolvedVal | ReturnedVal ^ "," ResolvedVal ;
+
+BasicBlockList ::= BasicBlockList BasicBlock | FunctionHeader BasicBlock ;
+
+BasicBlock ::= InstructionList OptLocalAssign BBTerminatorInst ;
+
+InstructionList ::= +++ InstructionList Inst
+ | - _
+ | ^ LABELSTR ^ ":\n" ;
+
+BBTerminatorInst ::= ^ "  " ^
+ ( ret ReturnedVal
+ | ret void
+ | br label ValueRef
+ | br INTTYPE ValueRef ^ "," label ValueRef ^ "," label ValueRef
+ | switch IntType ValueRef ^ "," label ValueRef "[" JumpTable "]"
+ | switch IntType ValueRef ^ "," label ValueRef "[" "]"
+ | invoke OptCallingConv ResultTypes ValueRef "(" ^ ParamList ^ ")" OptFuncAttrs
+   to label ValueRef unwind label ValueRef
+ | unwind
+ | unreachable ) ^ "\n";
+
+JumpTable ::= JumpTable IntType ConstValueRef ^ "," label ValueRef
+ | IntType ConstValueRef ^ "," label ValueRef ;
+
+Inst ::= ^ "  " ^ OptLocalAssign InstVal ^ "\n";
+
+PHIList ::= Types "[" ValueRef ^ "," ValueRef "]"
+ | PHIList ^ "," "[" ValueRef ^ "," ValueRef "]" ;
+
+ParamList ::= Types OptParamAttrs ValueRef OptParamAttrs
+ | label OptParamAttrs ValueRef OptParamAttrs
+ | ParamList ^ "," Types OptParamAttrs ValueRef OptParamAttrs
+ | ParamList ^ "," label OptParamAttrs ValueRef OptParamAttrs
+ | - _ ;
+
+IndexList ::= _ | IndexList ^ "," ResolvedVal ;
+
+ConstantIndexList ::= "," EUINT64VAL | ConstantIndexList ^ "," EUINT64VAL ;
+
+OptTailCall ::= tail call | call ;
+
+InstVal ::=
+   ArithmeticOps Types ValueRef ^ "," ValueRef
+ | LogicalOps Types ValueRef ^ "," ValueRef
+ | icmp IPredicates Types ValueRef ^ "," ValueRef
+ | fcmp FPredicates Types ValueRef ^ "," ValueRef
+ | vicmp IPredicates Types ValueRef ^ "," ValueRef
+ | vfcmp FPredicates Types ValueRef ^ "," ValueRef
+ | CastOps ResolvedVal to Types
+ | select ResolvedVal ^ "," ResolvedVal ^ "," ResolvedVal
+ | "va_arg" ResolvedVal ^ "," Types
+ | extractelement ResolvedVal ^ "," ResolvedVal
+ | insertelement ResolvedVal ^ "," ResolvedVal ^ "," ResolvedVal
+ | shufflevector ResolvedVal ^ "," ResolvedVal ^ "," ResolvedVal
+ | phi PHIList
+ | OptTailCall OptCallingConv ResultTypes ValueRef "(" ^ ParamList ^ ")"
+   OptFuncAttrs
+ | MemoryInst ;
+
+OptVolatile ::= - volatile | _ ;
+
+MemoryInst ::= malloc Types OptCAlign
+ | malloc Types ^ "," INTTYPE ValueRef OptCAlign
+ | alloca Types OptCAlign
+ | alloca Types ^ "," INTTYPE ValueRef OptCAlign
+ | free ResolvedVal
+ | OptVolatile load Types ValueRef OptCAlign
+ | OptVolatile store ResolvedVal ^ "," Types ValueRef OptCAlign
+ | getresult Types ValueRef ^ "," EUINT64VAL
+ | getelementptr Types ValueRef IndexList
+ | extractvalue Types ValueRef ^ ConstantIndexList 
+ | insertvalue Types ValueRef ^ "," Types ValueRef ^ ConstantIndexList ;

Modified: llvm/branches/non-call-eh/utils/vim/tablegen.vim
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/utils/vim/tablegen.vim?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/utils/vim/tablegen.vim (original)
+++ llvm/branches/non-call-eh/utils/vim/tablegen.vim Sun Jul  6 15:45:41 2008
@@ -9,17 +9,26 @@
   finish
 endif
 
+" May be changed if you have a really slow machine
+syntax sync minlines=100
+
 syn case match
 
-syn keyword tgKeyword   def let in code dag field include
-syn keyword tgType      class int string list bit bits 
-" FIXME: this does not handle hex (0x...) or binary (0b...) constants
+syn keyword tgKeyword   def let in code dag field include defm
+syn keyword tgType      class int string list bit bits multiclass
+
 syn match   tgNumber    /\<\d\+\>/
 syn match   tgNumber    /\<\d\+\.\d*\>/
-syn match   tgComment   /\/\/.*$/
-" FIXME: this does not capture multi-line C-style comments
-syn match   tgComment   /\/\*.*\*\//
-syn region  tgString    start=/"/ skip=/\\"/ end=/"/
+syn match   tgNumber    /\<0b[01]\+\>/
+syn match   tgNumber    /\<0x[0-9a-fA-F]\+\>/
+syn region  tgString    start=/"/ skip=/\\"/ end=/"/    oneline
+
+syn region  tgCode      start=/\[{/ end=/}\]/
+
+syn keyword tgTodo             contained TODO FIXME
+syn match   tgComment   /\/\/.*$/         contains=tgTodo
+" Handle correctly imbricated comment
+syn region  tgComment2 matchgroup=tgComment2  start=+/\*+ end=+\*/+ contains=tgTodo,tgComment2
 
 if version >= 508 || !exists("did_c_syn_inits")
   if version < 508
@@ -33,7 +42,11 @@
   HiLink tgType Type
   HiLink tgNumber Number
   HiLink tgComment Comment
+  HiLink tgComment2 Comment
   HiLink tgString String
+  " May find a better Hilight group...
+  HiLink tgCode Special
+  HiLink tgTodo Todo
 
   delcommand HiLink
 endif

Modified: llvm/branches/non-call-eh/win32/Analysis/Analysis.vcproj
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/win32/Analysis/Analysis.vcproj?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/win32/Analysis/Analysis.vcproj (original)
+++ llvm/branches/non-call-eh/win32/Analysis/Analysis.vcproj Sun Jul  6 15:45:41 2008
@@ -22,7 +22,7 @@
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="4"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
@@ -93,7 +93,7 @@
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="4"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
@@ -353,6 +353,14 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\lib\Analysis\LibCallAliasAnalysis.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\..\lib\Analysis\LibCallSemantics.cpp"
+				>
+			</File>
+			<File
 				RelativePath="..\..\lib\Analysis\LoadValueNumbering.cpp"
 				>
 			</File>
@@ -365,6 +373,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\lib\Analysis\LoopVR.cpp"
+				>
+			</File>
+			<File
 				RelativePath="..\..\lib\Analysis\MemoryDependenceAnalysis.cpp"
 				>
 			</File>
@@ -393,6 +405,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\lib\Analysis\SparsePropagation.cpp"
+				>
+			</File>
+			<File
 				RelativePath="..\..\lib\Analysis\Trace.cpp"
 				>
 			</File>
@@ -400,6 +416,10 @@
 				RelativePath="..\..\lib\Analysis\ValueNumbering.cpp"
 				>
 			</File>
+			<File
+				RelativePath="..\..\lib\Analysis\ValueTracking.cpp"
+				>
+			</File>
 			<Filter
 				Name="IPA"
 				>
@@ -495,6 +515,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\include\llvm\Analysis\LoopVR.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\include\llvm\Analysis\Passes.h"
 				>
 			</File>

Modified: llvm/branches/non-call-eh/win32/Archive/Archive.vcproj
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/win32/Archive/Archive.vcproj?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/win32/Archive/Archive.vcproj (original)
+++ llvm/branches/non-call-eh/win32/Archive/Archive.vcproj Sun Jul  6 15:45:41 2008
@@ -22,7 +22,7 @@
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="4"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
@@ -93,7 +93,7 @@
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="4"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool

Modified: llvm/branches/non-call-eh/win32/AsmParser/AsmParser.vcproj
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/win32/AsmParser/AsmParser.vcproj?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/win32/AsmParser/AsmParser.vcproj (original)
+++ llvm/branches/non-call-eh/win32/AsmParser/AsmParser.vcproj Sun Jul  6 15:45:41 2008
@@ -23,7 +23,7 @@
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="4"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
@@ -94,7 +94,7 @@
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="4"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
@@ -380,11 +380,11 @@
 			Name="Generated Files"
 			>
 			<File
-				RelativePath="llvmAsmParser.cpp"
+				RelativePath=".\llvmAsmParser.cpp"
 				>
 			</File>
 			<File
-				RelativePath="llvmAsmParser.h"
+				RelativePath=".\llvmAsmParser.h"
 				>
 			</File>
 		</Filter>

Modified: llvm/branches/non-call-eh/win32/Bitcode/Bitcode.vcproj
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/win32/Bitcode/Bitcode.vcproj?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/win32/Bitcode/Bitcode.vcproj (original)
+++ llvm/branches/non-call-eh/win32/Bitcode/Bitcode.vcproj Sun Jul  6 15:45:41 2008
@@ -22,7 +22,7 @@
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="4"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
@@ -89,7 +89,7 @@
 			/>
 		</Configuration>
 		<Configuration
-			Name="Release|Win32"
+			Name="Debug|x64"
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="4"
@@ -110,17 +110,22 @@
 			/>
 			<Tool
 				Name="VCMIDLTool"
+				TargetEnvironment="3"
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
+				Optimization="0"
 				AdditionalIncludeDirectories="..\..\include;.."
-				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;WIN32;NDEBUG;_LIB;__STDC_LIMIT_MACROS"
+				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;_DEBUG;_LIB;__STDC_LIMIT_MACROS;WIN32"
 				StringPooling="true"
-				RuntimeLibrary="2"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
 				ForceConformanceInForLoopScope="true"
 				RuntimeTypeInfo="true"
 				UsePrecompiledHeader="0"
 				ProgramDataBaseFileName="$(OutDir)\$(ProjectName).pdb"
+				BrowseInformation="1"
 				WarningLevel="3"
 				Detect64BitPortabilityProblems="false"
 				DebugInformationFormat="3"
@@ -156,11 +161,11 @@
 			/>
 		</Configuration>
 		<Configuration
-			Name="Debug|x64"
+			Name="Release|Win32"
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="4"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
@@ -177,22 +182,17 @@
 			/>
 			<Tool
 				Name="VCMIDLTool"
-				TargetEnvironment="3"
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				Optimization="0"
 				AdditionalIncludeDirectories="..\..\include;.."
-				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;_DEBUG;_LIB;__STDC_LIMIT_MACROS;WIN32"
+				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;WIN32;NDEBUG;_LIB;__STDC_LIMIT_MACROS"
 				StringPooling="true"
-				MinimalRebuild="true"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="3"
+				RuntimeLibrary="2"
 				ForceConformanceInForLoopScope="true"
 				RuntimeTypeInfo="true"
 				UsePrecompiledHeader="0"
 				ProgramDataBaseFileName="$(OutDir)\$(ProjectName).pdb"
-				BrowseInformation="1"
 				WarningLevel="3"
 				Detect64BitPortabilityProblems="false"
 				DebugInformationFormat="3"
@@ -253,6 +253,7 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
+				Optimization="0"
 				AdditionalIncludeDirectories="..\..\include;.."
 				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;WIN32;NDEBUG;_LIB;__STDC_LIMIT_MACROS"
 				StringPooling="true"

Modified: llvm/branches/non-call-eh/win32/CBackend/CBackend.vcproj
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/win32/CBackend/CBackend.vcproj?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/win32/CBackend/CBackend.vcproj (original)
+++ llvm/branches/non-call-eh/win32/CBackend/CBackend.vcproj Sun Jul  6 15:45:41 2008
@@ -22,7 +22,7 @@
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="4"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
@@ -93,7 +93,7 @@
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="4"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool

Modified: llvm/branches/non-call-eh/win32/CodeGen/CodeGen.vcproj
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/win32/CodeGen/CodeGen.vcproj?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/win32/CodeGen/CodeGen.vcproj (original)
+++ llvm/branches/non-call-eh/win32/CodeGen/CodeGen.vcproj Sun Jul  6 15:45:41 2008
@@ -22,7 +22,7 @@
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="4"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
@@ -93,7 +93,7 @@
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="4"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
@@ -353,6 +353,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\lib\CodeGen\LiveStackAnalysis.cpp"
+				>
+			</File>
+			<File
 				RelativePath="..\..\lib\CodeGen\LiveVariables.cpp"
 				>
 			</File>
@@ -373,6 +377,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\lib\CodeGen\MachineDebugInfoDesc.cpp"
+				>
+			</File>
+			<File
 				RelativePath="..\..\lib\CodeGen\MachineDominators.cpp"
 				>
 			</File>
@@ -473,6 +481,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\lib\CodeGen\StackSlotColoring.cpp"
+				>
+			</File>
+			<File
 				RelativePath="..\..\lib\CodeGen\StrongPHIElimination.cpp"
 				>
 			</File>
@@ -508,27 +520,23 @@
 					>
 				</File>
 				<File
-					RelativePath="..\..\lib\CodeGen\SelectionDAG\LegalizeTypes.cpp"
-					>
-				</File>
-				<File
-					RelativePath="..\..\lib\CodeGen\SelectionDAG\LegalizeTypesExpand.cpp"
+					RelativePath="..\..\lib\CodeGen\SelectionDAG\LegalizeFloatTypes.cpp"
 					>
 				</File>
 				<File
-					RelativePath="..\..\lib\CodeGen\SelectionDAG\LegalizeTypesFloatToInt.cpp"
+					RelativePath="..\..\lib\CodeGen\SelectionDAG\LegalizeIntegerTypes.cpp"
 					>
 				</File>
 				<File
-					RelativePath="..\..\lib\CodeGen\SelectionDAG\LegalizeTypesPromote.cpp"
+					RelativePath="..\..\lib\CodeGen\SelectionDAG\LegalizeTypes.cpp"
 					>
 				</File>
 				<File
-					RelativePath="..\..\lib\CodeGen\SelectionDAG\LegalizeTypesScalarize.cpp"
+					RelativePath="..\..\lib\CodeGen\SelectionDAG\LegalizeTypesGeneric.cpp"
 					>
 				</File>
 				<File
-					RelativePath="..\..\lib\CodeGen\SelectionDAG\LegalizeTypesSplit.cpp"
+					RelativePath="..\..\lib\CodeGen\SelectionDAG\LegalizeVectorTypes.cpp"
 					>
 				</File>
 				<File
@@ -639,6 +647,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\include\llvm\CodeGen\MachineDebugInfoDesc.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\include\llvm\CodeGen\MachineDominators.h"
 				>
 			</File>

Modified: llvm/branches/non-call-eh/win32/Configure/Configure.vcproj
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/win32/Configure/Configure.vcproj?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/win32/Configure/Configure.vcproj (original)
+++ llvm/branches/non-call-eh/win32/Configure/Configure.vcproj Sun Jul  6 15:45:41 2008
@@ -23,7 +23,7 @@
 			OutputDirectory="$(ConfigurationName)"
 			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
@@ -235,16 +235,16 @@
 				</FileConfiguration>
 			</File>
 			<File
-				RelativePath="..\..\include\llvm\Adt\hash_map.in"
+				RelativePath="..\..\include\llvm\ADT\hash_map.h.in"
 				>
 				<FileConfiguration
 					Name="Configure|Win32"
 					>
 					<Tool
 						Name="VCCustomBuildTool"
-						Description="Generating $(SolutionDir)llvm\ADT\hash_map"
-						CommandLine="copy "$(InputPath)" "$(ProjectDir)..\llvm\ADT\hash_map"&#x0D;&#x0A;"
-						Outputs=""$(ProjectDir)..\llvm\ADT\hash_map""
+						Description="Generating $(SolutionDir)llvm\ADT\hash_map.h"
+						CommandLine="copy "$(InputPath)" "$(ProjectDir)..\llvm\ADT\hash_map.h"&#x0D;&#x0A;"
+						Outputs=""$(ProjectDir)..\llvm\ADT\hash_map.h""
 					/>
 				</FileConfiguration>
 				<FileConfiguration
@@ -252,23 +252,23 @@
 					>
 					<Tool
 						Name="VCCustomBuildTool"
-						Description="Generating $(SolutionDir)llvm\ADT\hash_map"
-						CommandLine="copy "$(InputPath)" "$(ProjectDir)..\llvm\ADT\hash_map"&#x0D;&#x0A;"
-						Outputs=""$(ProjectDir)..\llvm\ADT\hash_map""
+						Description="Generating $(SolutionDir)llvm\ADT\hash_map.h"
+						CommandLine="copy "$(InputPath)" "$(ProjectDir)..\llvm\ADT\hash_map.h"&#x0D;&#x0A;"
+						Outputs=""$(ProjectDir)..\llvm\ADT\hash_map.h""
 					/>
 				</FileConfiguration>
 			</File>
 			<File
-				RelativePath="..\..\include\llvm\Adt\hash_set.in"
+				RelativePath="..\..\include\llvm\ADT\hash_set.h.in"
 				>
 				<FileConfiguration
 					Name="Configure|Win32"
 					>
 					<Tool
 						Name="VCCustomBuildTool"
-						Description="Generating $(SolutionDir)llvm\ADT\hash_set"
-						CommandLine="copy "$(InputPath)" "$(ProjectDir)..\llvm\ADT\hash_set"&#x0D;&#x0A;"
-						Outputs=""$(ProjectDir)..\llvm\ADT\hash_set""
+						Description="Generating $(SolutionDir)llvm\ADT\hash_set.h"
+						CommandLine="copy "$(InputPath)" "$(ProjectDir)..\llvm\ADT\hash_set.h"&#x0D;&#x0A;"
+						Outputs=""$(ProjectDir)..\llvm\ADT\hash_set.h""
 					/>
 				</FileConfiguration>
 				<FileConfiguration
@@ -276,23 +276,23 @@
 					>
 					<Tool
 						Name="VCCustomBuildTool"
-						Description="Generating $(SolutionDir)llvm\ADT\hash_set"
-						CommandLine="copy "$(InputPath)" "$(ProjectDir)..\llvm\ADT\hash_set"&#x0D;&#x0A;"
-						Outputs=""$(ProjectDir)..\llvm\ADT\hash_set""
+						Description="Generating $(SolutionDir)llvm\ADT\hash_set.h"
+						CommandLine="copy "$(InputPath)" "$(ProjectDir)..\llvm\ADT\hash_set.h"&#x0D;&#x0A;"
+						Outputs=""$(ProjectDir)..\llvm\ADT\hash_set.h""
 					/>
 				</FileConfiguration>
 			</File>
 			<File
-				RelativePath="..\..\include\llvm\Adt\iterator.in"
+				RelativePath="..\..\include\llvm\ADT\iterator.h.in"
 				>
 				<FileConfiguration
 					Name="Configure|Win32"
 					>
 					<Tool
 						Name="VCCustomBuildTool"
-						Description="Generating $(SolutionDir)llvm\ADT\iterator"
-						CommandLine="copy "$(InputPath)" "$(ProjectDir)..\llvm\ADT\iterator"&#x0D;&#x0A;"
-						Outputs=""$(ProjectDir)..\llvm\ADT\iterator""
+						Description="Generating $(SolutionDir)llvm\ADT\iterator.h"
+						CommandLine="copy "$(InputPath)" "$(ProjectDir)..\llvm\ADT\iterator.h"&#x0D;&#x0A;"
+						Outputs=""$(ProjectDir)..\llvm\ADT\iterator.h""
 					/>
 				</FileConfiguration>
 				<FileConfiguration
@@ -300,9 +300,9 @@
 					>
 					<Tool
 						Name="VCCustomBuildTool"
-						Description="Generating $(SolutionDir)llvm\ADT\iterator"
-						CommandLine="copy "$(InputPath)" "$(ProjectDir)..\llvm\ADT\iterator"&#x0D;&#x0A;"
-						Outputs=""$(ProjectDir)..\llvm\ADT\iterator""
+						Description="Generating $(SolutionDir)llvm\ADT\iterator.h"
+						CommandLine="copy "$(InputPath)" "$(ProjectDir)..\llvm\ADT\iterator.h"&#x0D;&#x0A;"
+						Outputs=""$(ProjectDir)..\llvm\ADT\iterator.h""
 					/>
 				</FileConfiguration>
 			</File>

Modified: llvm/branches/non-call-eh/win32/ExecutionEngine/ExecutionEngine.vcproj
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/win32/ExecutionEngine/ExecutionEngine.vcproj?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/win32/ExecutionEngine/ExecutionEngine.vcproj (original)
+++ llvm/branches/non-call-eh/win32/ExecutionEngine/ExecutionEngine.vcproj Sun Jul  6 15:45:41 2008
@@ -22,7 +22,7 @@
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="4"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
@@ -93,7 +93,7 @@
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="4"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool

Modified: llvm/branches/non-call-eh/win32/Fibonacci/Fibonacci.vcproj
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/win32/Fibonacci/Fibonacci.vcproj?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/win32/Fibonacci/Fibonacci.vcproj (original)
+++ llvm/branches/non-call-eh/win32/Fibonacci/Fibonacci.vcproj Sun Jul  6 15:45:41 2008
@@ -23,7 +23,7 @@
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
@@ -110,7 +110,7 @@
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool

Modified: llvm/branches/non-call-eh/win32/Linker/Linker.vcproj
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/win32/Linker/Linker.vcproj?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/win32/Linker/Linker.vcproj (original)
+++ llvm/branches/non-call-eh/win32/Linker/Linker.vcproj Sun Jul  6 15:45:41 2008
@@ -22,7 +22,7 @@
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="4"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
@@ -93,7 +93,7 @@
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="4"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool

Modified: llvm/branches/non-call-eh/win32/Support/Support.vcproj
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/win32/Support/Support.vcproj?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/win32/Support/Support.vcproj (original)
+++ llvm/branches/non-call-eh/win32/Support/Support.vcproj Sun Jul  6 15:45:41 2008
@@ -23,7 +23,7 @@
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="4"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
@@ -90,7 +90,7 @@
 			/>
 		</Configuration>
 		<Configuration
-			Name="Release|Win32"
+			Name="Debug|x64"
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="4"
@@ -111,17 +111,22 @@
 			/>
 			<Tool
 				Name="VCMIDLTool"
+				TargetEnvironment="3"
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
+				Optimization="0"
 				AdditionalIncludeDirectories="..\..\include;.."
-				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;WIN32;NDEBUG;_LIB;__STDC_LIMIT_MACROS"
+				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;WIN32;_DEBUG;_LIB;__STDC_LIMIT_MACROS"
 				StringPooling="true"
-				RuntimeLibrary="2"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
 				ForceConformanceInForLoopScope="true"
 				RuntimeTypeInfo="true"
 				UsePrecompiledHeader="0"
 				ProgramDataBaseFileName="$(OutDir)\$(ProjectName).pdb"
+				BrowseInformation="1"
 				WarningLevel="3"
 				Detect64BitPortabilityProblems="false"
 				DebugInformationFormat="3"
@@ -157,11 +162,11 @@
 			/>
 		</Configuration>
 		<Configuration
-			Name="Debug|x64"
+			Name="Release|Win32"
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="4"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
@@ -178,22 +183,17 @@
 			/>
 			<Tool
 				Name="VCMIDLTool"
-				TargetEnvironment="3"
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				Optimization="0"
 				AdditionalIncludeDirectories="..\..\include;.."
-				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;WIN32;_DEBUG;_LIB;__STDC_LIMIT_MACROS"
+				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;WIN32;NDEBUG;_LIB;__STDC_LIMIT_MACROS"
 				StringPooling="true"
-				MinimalRebuild="true"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="3"
+				RuntimeLibrary="2"
 				ForceConformanceInForLoopScope="true"
 				RuntimeTypeInfo="true"
 				UsePrecompiledHeader="0"
 				ProgramDataBaseFileName="$(OutDir)\$(ProjectName).pdb"
-				BrowseInformation="1"
 				WarningLevel="3"
 				Detect64BitPortabilityProblems="false"
 				DebugInformationFormat="3"
@@ -254,6 +254,7 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
+				Optimization="0"
 				AdditionalIncludeDirectories="..\..\include;.."
 				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;WIN32;NDEBUG;_LIB;__STDC_LIMIT_MACROS"
 				StringPooling="true"
@@ -377,14 +378,6 @@
 				RelativePath="..\..\lib\Support\SlowOperationInformer.cpp"
 				>
 				<FileConfiguration
-					Name="Release|Win32"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
 					Name="Release|x64"
 					ExcludedFromBuild="true"
 					>
@@ -680,6 +673,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\include\llvm\ADT\PriorityQueue.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\include\llvm\Adt\SCCIterator.h"
 				>
 			</File>

Modified: llvm/branches/non-call-eh/win32/System/System.vcproj
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/win32/System/System.vcproj?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/win32/System/System.vcproj (original)
+++ llvm/branches/non-call-eh/win32/System/System.vcproj Sun Jul  6 15:45:41 2008
@@ -23,7 +23,7 @@
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="4"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
@@ -94,7 +94,6 @@
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="4"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
@@ -111,24 +110,15 @@
 			/>
 			<Tool
 				Name="VCMIDLTool"
-				TargetEnvironment="3"
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
 				AdditionalIncludeDirectories="..\..\include;.."
-				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;WIN32;_DEBUG;_LIB;__STDC_LIMIT_MACROS"
-				StringPooling="true"
-				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="3"
-				ForceConformanceInForLoopScope="true"
-				RuntimeTypeInfo="true"
-				UsePrecompiledHeader="0"
 				ProgramDataBaseFileName="$(OutDir)\$(ProjectName).pdb"
 				BrowseInformation="1"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="false"
 				DebugInformationFormat="3"
 				DisableSpecificWarnings="4355,4146,4800"
 			/>
@@ -143,7 +133,6 @@
 			/>
 			<Tool
 				Name="VCLibrarianTool"
-				OutputFile="$(OutDir)/System.lib"
 			/>
 			<Tool
 				Name="VCALinkTool"
@@ -183,17 +172,22 @@
 			/>
 			<Tool
 				Name="VCMIDLTool"
+				TargetEnvironment="3"
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
+				Optimization="0"
 				AdditionalIncludeDirectories="..\..\include;.."
 				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;WIN32;NDEBUG;_LIB;__STDC_LIMIT_MACROS"
 				StringPooling="true"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
 				RuntimeLibrary="2"
 				ForceConformanceInForLoopScope="true"
 				RuntimeTypeInfo="true"
 				UsePrecompiledHeader="0"
 				ProgramDataBaseFileName="$(OutDir)\$(ProjectName).pdb"
+				BrowseInformation="1"
 				WarningLevel="3"
 				Detect64BitPortabilityProblems="false"
 				DebugInformationFormat="3"
@@ -254,6 +248,7 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
+				Optimization="0"
 				AdditionalIncludeDirectories="..\..\include;.."
 				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;WIN32;NDEBUG;_LIB;__STDC_LIMIT_MACROS"
 				StringPooling="true"
@@ -262,6 +257,7 @@
 				RuntimeTypeInfo="true"
 				UsePrecompiledHeader="0"
 				ProgramDataBaseFileName="$(OutDir)\$(ProjectName).pdb"
+				BrowseInformation="1"
 				WarningLevel="3"
 				Detect64BitPortabilityProblems="false"
 				DebugInformationFormat="3"

Modified: llvm/branches/non-call-eh/win32/TableGen/TableGen.vcproj
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/win32/TableGen/TableGen.vcproj?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/win32/TableGen/TableGen.vcproj (original)
+++ llvm/branches/non-call-eh/win32/TableGen/TableGen.vcproj Sun Jul  6 15:45:41 2008
@@ -23,7 +23,7 @@
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
@@ -105,7 +105,7 @@
 			/>
 		</Configuration>
 		<Configuration
-			Name="Release|Win32"
+			Name="Debug|x64"
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="1"
@@ -126,17 +126,22 @@
 			/>
 			<Tool
 				Name="VCMIDLTool"
+				TargetEnvironment="3"
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
+				Optimization="0"
 				AdditionalIncludeDirectories="..\..\include;..;..\..\utils\tablegen"
-				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;__STDC_LIMIT_MACROS"
+				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;__STDC_LIMIT_MACROS"
 				StringPooling="true"
-				RuntimeLibrary="2"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
 				ForceConformanceInForLoopScope="true"
 				RuntimeTypeInfo="true"
 				UsePrecompiledHeader="0"
 				ProgramDataBaseFileName="$(OutDir)\$(ProjectName).pdb"
+				BrowseInformation="1"
 				WarningLevel="3"
 				Detect64BitPortabilityProblems="false"
 				DebugInformationFormat="3"
@@ -154,13 +159,12 @@
 			<Tool
 				Name="VCLinkerTool"
 				OutputFile="$(OutDir)\TableGen.exe"
-				LinkIncremental="1"
+				LinkIncremental="2"
 				AdditionalLibraryDirectories=""
 				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)/TableGen.pdb"
 				SubSystem="1"
-				OptimizeReferences="2"
-				EnableCOMDATFolding="2"
-				TargetMachine="1"
+				TargetMachine="17"
 			/>
 			<Tool
 				Name="VCALinkTool"
@@ -188,11 +192,11 @@
 			/>
 		</Configuration>
 		<Configuration
-			Name="Debug|x64"
+			Name="Release|Win32"
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
@@ -209,22 +213,17 @@
 			/>
 			<Tool
 				Name="VCMIDLTool"
-				TargetEnvironment="3"
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				Optimization="0"
 				AdditionalIncludeDirectories="..\..\include;..;..\..\utils\tablegen"
-				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;__STDC_LIMIT_MACROS"
+				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;__STDC_LIMIT_MACROS"
 				StringPooling="true"
-				MinimalRebuild="true"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="3"
+				RuntimeLibrary="2"
 				ForceConformanceInForLoopScope="true"
 				RuntimeTypeInfo="true"
 				UsePrecompiledHeader="0"
 				ProgramDataBaseFileName="$(OutDir)\$(ProjectName).pdb"
-				BrowseInformation="1"
 				WarningLevel="3"
 				Detect64BitPortabilityProblems="false"
 				DebugInformationFormat="3"
@@ -242,12 +241,13 @@
 			<Tool
 				Name="VCLinkerTool"
 				OutputFile="$(OutDir)\TableGen.exe"
-				LinkIncremental="2"
+				LinkIncremental="1"
 				AdditionalLibraryDirectories=""
 				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(OutDir)/TableGen.pdb"
 				SubSystem="1"
-				TargetMachine="17"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"
 			/>
 			<Tool
 				Name="VCALinkTool"
@@ -300,6 +300,7 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
+				Optimization="0"
 				AdditionalIncludeDirectories="..\..\include;..;..\..\utils\tablegen"
 				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;__STDC_LIMIT_MACROS"
 				StringPooling="true"
@@ -327,6 +328,7 @@
 				OutputFile="$(OutDir)\TableGen.exe"
 				LinkIncremental="1"
 				AdditionalLibraryDirectories=""
+				IgnoreAllDefaultLibraries="false"
 				GenerateDebugInformation="true"
 				SubSystem="1"
 				OptimizeReferences="2"
@@ -408,7 +410,7 @@
 				>
 			</File>
 			<File
-				RelativePath="..\..\utils\TableGen\LLVMCCConfigurationEmitter.cpp"
+				RelativePath="..\..\utils\TableGen\LLVMCConfigurationEmitter.cpp"
 				>
 			</File>
 			<File

Modified: llvm/branches/non-call-eh/win32/Target/Target.vcproj
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/win32/Target/Target.vcproj?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/win32/Target/Target.vcproj (original)
+++ llvm/branches/non-call-eh/win32/Target/Target.vcproj Sun Jul  6 15:45:41 2008
@@ -22,7 +22,7 @@
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="4"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
@@ -93,7 +93,7 @@
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="4"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
@@ -309,6 +309,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\lib\Target\Target.cpp"
+				>
+			</File>
+			<File
 				RelativePath="..\..\lib\Target\TargetAsmInfo.cpp"
 				>
 			</File>

Modified: llvm/branches/non-call-eh/win32/Transforms/Transforms.vcproj
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/win32/Transforms/Transforms.vcproj?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/win32/Transforms/Transforms.vcproj (original)
+++ llvm/branches/non-call-eh/win32/Transforms/Transforms.vcproj Sun Jul  6 15:45:41 2008
@@ -22,7 +22,7 @@
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="4"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
@@ -93,7 +93,7 @@
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="4"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
@@ -352,6 +352,10 @@
 					>
 				</File>
 				<File
+					RelativePath="..\..\lib\Transforms\IPO\ExtractGV.cpp"
+					>
+				</File>
+				<File
 					RelativePath="..\..\lib\Transforms\Ipo\GlobalDCE.cpp"
 					>
 				</File>
@@ -396,10 +400,6 @@
 					>
 				</File>
 				<File
-					RelativePath="..\..\lib\Transforms\Ipo\SimplifyLibCalls.cpp"
-					>
-				</File>
-				<File
 					RelativePath="..\..\lib\Transforms\IPO\StripDeadPrototypes.cpp"
 					>
 				</File>
@@ -464,10 +464,18 @@
 					>
 				</File>
 				<File
+					RelativePath="..\..\lib\Transforms\Scalar\JumpThreading.cpp"
+					>
+				</File>
+				<File
 					RelativePath="..\..\lib\Transforms\Scalar\LICM.cpp"
 					>
 				</File>
 				<File
+					RelativePath="..\..\lib\Transforms\Scalar\LoopDeletion.cpp"
+					>
+				</File>
+				<File
 					RelativePath="..\..\lib\Transforms\Scalar\LoopIndexSplit.cpp"
 					>
 				</File>
@@ -516,10 +524,32 @@
 					>
 				</File>
 				<File
-					RelativePath="..\..\lib\Transforms\Scalar\SimplifyCFG.cpp"
+					RelativePath="..\..\lib\Transforms\Scalar\SimplifyCFGPass.cpp"
 					>
 				</File>
 				<File
+					RelativePath="..\..\lib\Transforms\Scalar\SimplifyLibCalls.cpp"
+					>
+					<FileConfiguration
+						Name="Debug|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							ObjectFile="$(IntDir)\$(InputName)1.obj"
+							XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							ObjectFile="$(IntDir)\$(InputName)1.obj"
+							XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
+						/>
+					</FileConfiguration>
+				</File>
+				<File
 					RelativePath="..\..\lib\Transforms\Scalar\TailDuplication.cpp"
 					>
 				</File>
@@ -529,10 +559,6 @@
 				</File>
 			</Filter>
 			<Filter
-				Name="Parallel"
-				>
-			</Filter>
-			<Filter
 				Name="Utils"
 				>
 				<File
@@ -652,6 +678,10 @@
 					>
 				</File>
 				<File
+					RelativePath="..\..\lib\Transforms\Utils\UnrollLoop.cpp"
+					>
+				</File>
+				<File
 					RelativePath="..\..\lib\Transforms\Utils\ValueMapper.cpp"
 					>
 				</File>

Modified: llvm/branches/non-call-eh/win32/VMCore/VMCore.vcproj
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/win32/VMCore/VMCore.vcproj?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/win32/VMCore/VMCore.vcproj (original)
+++ llvm/branches/non-call-eh/win32/VMCore/VMCore.vcproj Sun Jul  6 15:45:41 2008
@@ -23,7 +23,7 @@
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="4"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
@@ -90,7 +90,7 @@
 			/>
 		</Configuration>
 		<Configuration
-			Name="Release|Win32"
+			Name="Debug|x64"
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="4"
@@ -111,17 +111,22 @@
 			/>
 			<Tool
 				Name="VCMIDLTool"
+				TargetEnvironment="3"
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
+				Optimization="0"
 				AdditionalIncludeDirectories="..\..\include;.."
-				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;WIN32;NDEBUG;_LIB;__STDC_LIMIT_MACROS"
+				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;WIN32;_DEBUG;_LIB;__STDC_LIMIT_MACROS"
 				StringPooling="true"
-				RuntimeLibrary="2"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
 				ForceConformanceInForLoopScope="true"
 				RuntimeTypeInfo="true"
 				UsePrecompiledHeader="0"
 				ProgramDataBaseFileName="$(OutDir)\$(ProjectName).pdb"
+				BrowseInformation="1"
 				WarningLevel="3"
 				Detect64BitPortabilityProblems="false"
 				DebugInformationFormat="3"
@@ -157,11 +162,11 @@
 			/>
 		</Configuration>
 		<Configuration
-			Name="Debug|x64"
+			Name="Release|Win32"
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="4"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
@@ -178,22 +183,17 @@
 			/>
 			<Tool
 				Name="VCMIDLTool"
-				TargetEnvironment="3"
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				Optimization="0"
 				AdditionalIncludeDirectories="..\..\include;.."
-				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;WIN32;_DEBUG;_LIB;__STDC_LIMIT_MACROS"
+				PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;WIN32;NDEBUG;_LIB;__STDC_LIMIT_MACROS"
 				StringPooling="true"
-				MinimalRebuild="true"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="3"
+				RuntimeLibrary="2"
 				ForceConformanceInForLoopScope="true"
 				RuntimeTypeInfo="true"
 				UsePrecompiledHeader="0"
 				ProgramDataBaseFileName="$(OutDir)\$(ProjectName).pdb"
-				BrowseInformation="1"
 				WarningLevel="3"
 				Detect64BitPortabilityProblems="false"
 				DebugInformationFormat="3"
@@ -372,24 +372,24 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
-					Name="Release|Win32"
+					Name="Debug|x64"
 					>
 					<Tool
 						Name="VCCustomBuildTool"
 						Description="Performing TableGen Step"
 						CommandLine="echo Building $(InputFileName) code emitter with tblgen&#x0D;&#x0A;$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)\TableGen.exe -gen-intrinsic -I ..\..\include $(InputPath) -o $(SolutionDir)llvm\intrinsics.gen&#x0D;&#x0A;"
-						AdditionalDependencies="$(ProjectDir)..\$(IntDir)\TableGen.exe;$(InputDir)IntrinsicsX86.td;$(InputDir)IntrinsicsPowerPC.td"
+						AdditionalDependencies="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)\TableGen.exe;$(InputDir)IntrinsicsX86.td"
 						Outputs="$(SolutionDir)llvm\intrinsics.gen"
 					/>
 				</FileConfiguration>
 				<FileConfiguration
-					Name="Debug|x64"
+					Name="Release|Win32"
 					>
 					<Tool
 						Name="VCCustomBuildTool"
 						Description="Performing TableGen Step"
-						CommandLine="echo Building $(InputFileName) code emitter with tblgen&#x0D;&#x0A;$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)\TableGen.exe -gen-intrinsic -I ..\..\include $(InputPath) -o $(SolutionDir)llvm\intrinsics.gen"
-						AdditionalDependencies="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)\TableGen.exe;$(InputDir)IntrinsicsX86.td;$(InputDir)IntrinsicsPowerPC.td"
+						CommandLine="echo Building $(InputFileName) code emitter with tblgen&#x0D;&#x0A;$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)\TableGen.exe -gen-intrinsic -I ..\..\include $(InputPath) -o $(SolutionDir)llvm\intrinsics.gen&#x0D;&#x0A;"
+						AdditionalDependencies="$(ProjectDir)..\$(IntDir)\TableGen.exe;$(InputDir)IntrinsicsX86.td;$(InputDir)IntrinsicsPowerPC.td"
 						Outputs="$(SolutionDir)llvm\intrinsics.gen"
 					/>
 				</FileConfiguration>
@@ -399,8 +399,8 @@
 					<Tool
 						Name="VCCustomBuildTool"
 						Description="Performing TableGen Step"
-						CommandLine="echo Building $(InputFileName) code emitter with tblgen&#x0D;&#x0A;$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)\TableGen.exe -gen-intrinsic -I ..\..\include $(InputPath) -o $(SolutionDir)llvm\intrinsics.gen"
-						AdditionalDependencies="$(ProjectDir)..\$(IntDir)\TableGen.exe;$(InputDir)IntrinsicsX86.td;$(InputDir)IntrinsicsPowerPC.td"
+						CommandLine="echo Building $(InputFileName) code emitter with tblgen&#x0D;&#x0A;$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)\TableGen.exe -gen-intrinsic -I ..\..\include $(InputPath) -o $(SolutionDir)llvm\intrinsics.gen&#x0D;&#x0A;"
+						AdditionalDependencies="$(ProjectDir)..\$(IntDir)\TableGen.exe;$(InputDir)IntrinsicsX86.td"
 						Outputs="$(SolutionDir)llvm\intrinsics.gen"
 					/>
 				</FileConfiguration>
@@ -442,6 +442,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\lib\VMCore\Use.cpp"
+				>
+			</File>
+			<File
 				RelativePath="..\..\lib\VMCore\Value.cpp"
 				>
 			</File>

Modified: llvm/branches/non-call-eh/win32/bugpoint/bugpoint.vcproj
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/win32/bugpoint/bugpoint.vcproj?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/win32/bugpoint/bugpoint.vcproj (original)
+++ llvm/branches/non-call-eh/win32/bugpoint/bugpoint.vcproj Sun Jul  6 15:45:41 2008
@@ -22,7 +22,7 @@
 			OutputDirectory="$(SolutionDir)\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
@@ -107,7 +107,7 @@
 			OutputDirectory="$(SolutionDir)\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool

Modified: llvm/branches/non-call-eh/win32/clang.sln
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/win32/clang.sln?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/win32/clang.sln (original)
+++ llvm/branches/non-call-eh/win32/clang.sln Sun Jul  6 15:45:41 2008
@@ -1,458 +1,293 @@
 Microsoft Visual Studio Solution File, Format Version 9.00
 # Visual Studio 2005
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "support", "Support\Support.vcproj", "{28AA9146-3482-4F41-9CC6-407B1D258508}"
-	ProjectSection(WebsiteProperties) = preProject
-		Debug.AspNetCompiler.Debug = "True"
-		Release.AspNetCompiler.Debug = "False"
-	EndProjectSection
 	ProjectSection(ProjectDependencies) = postProject
 		{19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TableGen", "TableGen\TableGen.vcproj", "{339C2249-26B6-4172-B484-85653029AF57}"
-	ProjectSection(WebsiteProperties) = preProject
-		Debug.AspNetCompiler.Debug = "True"
-		Release.AspNetCompiler.Debug = "False"
-	EndProjectSection
 	ProjectSection(ProjectDependencies) = postProject
-		{28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508}
-		{19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E}
 		{0F8407F3-FA23-4CF1-83A9-DCBE0B361489} = {0F8407F3-FA23-4CF1-83A9-DCBE0B361489}
+		{19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E}
+		{28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Fibonacci", "Fibonacci\Fibonacci.vcproj", "{48FB551D-E37E-42EC-BC97-FF7219774867}"
-	ProjectSection(WebsiteProperties) = preProject
-		Debug.AspNetCompiler.Debug = "True"
-		Release.AspNetCompiler.Debug = "False"
-	EndProjectSection
 	ProjectSection(ProjectDependencies) = postProject
-		{0622E827-8464-489D-8B1C-B0B496F35C08} = {0622E827-8464-489D-8B1C-B0B496F35C08}
-		{28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508}
-		{059FBAB8-C76D-48A0-AA75-3C57BD3EAFE4} = {059FBAB8-C76D-48A0-AA75-3C57BD3EAFE4}
-		{08CEB1BB-C2A4-4587-B9A9-AEDB8FB44897} = {08CEB1BB-C2A4-4587-B9A9-AEDB8FB44897}
-		{45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB}
-		{76295AE8-A083-460E-9F80-6F2B8923264A} = {76295AE8-A083-460E-9F80-6F2B8923264A}
-		{0F8407F3-FA23-4CF1-83A9-DCBE0B361489} = {0F8407F3-FA23-4CF1-83A9-DCBE0B361489}
 		{144EEBF6-8C9B-4473-B715-2C821666AF6C} = {144EEBF6-8C9B-4473-B715-2C821666AF6C}
+		{0F8407F3-FA23-4CF1-83A9-DCBE0B361489} = {0F8407F3-FA23-4CF1-83A9-DCBE0B361489}
+		{76295AE8-A083-460E-9F80-6F2B8923264A} = {76295AE8-A083-460E-9F80-6F2B8923264A}
+		{45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB}
+		{08CEB1BB-C2A4-4587-B9A9-AEDB8FB44897} = {08CEB1BB-C2A4-4587-B9A9-AEDB8FB44897}
+		{059FBAB8-C76D-48A0-AA75-3C57BD3EAFE4} = {059FBAB8-C76D-48A0-AA75-3C57BD3EAFE4}
+		{28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508}
+		{0622E827-8464-489D-8B1C-B0B496F35C08} = {0622E827-8464-489D-8B1C-B0B496F35C08}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ExecutionEngine", "ExecutionEngine\ExecutionEngine.vcproj", "{76295AE8-A083-460E-9F80-6F2B8923264A}"
-	ProjectSection(WebsiteProperties) = preProject
-		Debug.AspNetCompiler.Debug = "True"
-		Release.AspNetCompiler.Debug = "False"
-	EndProjectSection
 	ProjectSection(ProjectDependencies) = postProject
-		{19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E}
 		{45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB}
+		{19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VMCore", "VMCore\VMCore.vcproj", "{45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB}"
-	ProjectSection(WebsiteProperties) = preProject
-		Debug.AspNetCompiler.Debug = "True"
-		Release.AspNetCompiler.Debug = "False"
-	EndProjectSection
 	ProjectSection(ProjectDependencies) = postProject
-		{19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E}
 		{339C2249-26B6-4172-B484-85653029AF57} = {339C2249-26B6-4172-B484-85653029AF57}
+		{19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Target", "Target\Target.vcproj", "{059FBAB8-C76D-48A0-AA75-3C57BD3EAFE4}"
-	ProjectSection(WebsiteProperties) = preProject
-		Debug.AspNetCompiler.Debug = "True"
-		Release.AspNetCompiler.Debug = "False"
-	EndProjectSection
 	ProjectSection(ProjectDependencies) = postProject
 		{19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CodeGen", "CodeGen\CodeGen.vcproj", "{08CEB1BB-C2A4-4587-B9A9-AEDB8FB44897}"
-	ProjectSection(WebsiteProperties) = preProject
-		Debug.AspNetCompiler.Debug = "True"
-		Release.AspNetCompiler.Debug = "False"
-	EndProjectSection
 	ProjectSection(ProjectDependencies) = postProject
-		{19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E}
-		{339C2249-26B6-4172-B484-85653029AF57} = {339C2249-26B6-4172-B484-85653029AF57}
 		{45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB}
+		{339C2249-26B6-4172-B484-85653029AF57} = {339C2249-26B6-4172-B484-85653029AF57}
+		{19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "System", "System\System.vcproj", "{0F8407F3-FA23-4CF1-83A9-DCBE0B361489}"
-	ProjectSection(WebsiteProperties) = preProject
-		Debug.AspNetCompiler.Debug = "True"
-		Release.AspNetCompiler.Debug = "False"
-	EndProjectSection
 	ProjectSection(ProjectDependencies) = postProject
 		{19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Analysis", "Analysis\Analysis.vcproj", "{0622E827-8464-489D-8B1C-B0B496F35C08}"
-	ProjectSection(WebsiteProperties) = preProject
-		Debug.AspNetCompiler.Debug = "True"
-		Release.AspNetCompiler.Debug = "False"
-	EndProjectSection
 	ProjectSection(ProjectDependencies) = postProject
-		{19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E}
 		{45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB}
+		{19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "x86", "x86\x86.vcproj", "{144EEBF6-8C9B-4473-B715-2C821666AF6C}"
-	ProjectSection(WebsiteProperties) = preProject
-		Debug.AspNetCompiler.Debug = "True"
-		Release.AspNetCompiler.Debug = "False"
-	EndProjectSection
 	ProjectSection(ProjectDependencies) = postProject
-		{19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E}
-		{339C2249-26B6-4172-B484-85653029AF57} = {339C2249-26B6-4172-B484-85653029AF57}
-		{08CEB1BB-C2A4-4587-B9A9-AEDB8FB44897} = {08CEB1BB-C2A4-4587-B9A9-AEDB8FB44897}
 		{C59374C1-9FC0-4147-B836-327DFDC52D99} = {C59374C1-9FC0-4147-B836-327DFDC52D99}
+		{08CEB1BB-C2A4-4587-B9A9-AEDB8FB44897} = {08CEB1BB-C2A4-4587-B9A9-AEDB8FB44897}
+		{339C2249-26B6-4172-B484-85653029AF57} = {339C2249-26B6-4172-B484-85653029AF57}
+		{19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Transforms", "Transforms\Transforms.vcproj", "{C59374C1-9FC0-4147-B836-327DFDC52D99}"
-	ProjectSection(WebsiteProperties) = preProject
-		Debug.AspNetCompiler.Debug = "True"
-		Release.AspNetCompiler.Debug = "False"
-	EndProjectSection
 	ProjectSection(ProjectDependencies) = postProject
-		{19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E}
-		{339C2249-26B6-4172-B484-85653029AF57} = {339C2249-26B6-4172-B484-85653029AF57}
 		{45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB}
+		{339C2249-26B6-4172-B484-85653029AF57} = {339C2249-26B6-4172-B484-85653029AF57}
+		{19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Configure", "Configure\Configure.vcproj", "{19514E48-456C-4B9D-8637-F2285476461E}"
-	ProjectSection(WebsiteProperties) = preProject
-		Debug.AspNetCompiler.Debug = "True"
-		Release.AspNetCompiler.Debug = "False"
-	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lli", "lli\lli.vcproj", "{FB6FFD68-C1E4-4DCF-AB02-36D205D5263E}"
-	ProjectSection(WebsiteProperties) = preProject
-		Debug.AspNetCompiler.Debug = "True"
-		Release.AspNetCompiler.Debug = "False"
-	EndProjectSection
 	ProjectSection(ProjectDependencies) = postProject
-		{0622E827-8464-489D-8B1C-B0B496F35C08} = {0622E827-8464-489D-8B1C-B0B496F35C08}
-		{28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508}
-		{F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62} = {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62}
-		{059FBAB8-C76D-48A0-AA75-3C57BD3EAFE4} = {059FBAB8-C76D-48A0-AA75-3C57BD3EAFE4}
-		{08CEB1BB-C2A4-4587-B9A9-AEDB8FB44897} = {08CEB1BB-C2A4-4587-B9A9-AEDB8FB44897}
-		{45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB}
-		{76295AE8-A083-460E-9F80-6F2B8923264A} = {76295AE8-A083-460E-9F80-6F2B8923264A}
-		{0F8407F3-FA23-4CF1-83A9-DCBE0B361489} = {0F8407F3-FA23-4CF1-83A9-DCBE0B361489}
 		{144EEBF6-8C9B-4473-B715-2C821666AF6C} = {144EEBF6-8C9B-4473-B715-2C821666AF6C}
+		{0F8407F3-FA23-4CF1-83A9-DCBE0B361489} = {0F8407F3-FA23-4CF1-83A9-DCBE0B361489}
+		{76295AE8-A083-460E-9F80-6F2B8923264A} = {76295AE8-A083-460E-9F80-6F2B8923264A}
+		{45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB}
+		{08CEB1BB-C2A4-4587-B9A9-AEDB8FB44897} = {08CEB1BB-C2A4-4587-B9A9-AEDB8FB44897}
+		{059FBAB8-C76D-48A0-AA75-3C57BD3EAFE4} = {059FBAB8-C76D-48A0-AA75-3C57BD3EAFE4}
+		{F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62} = {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62}
+		{28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508}
+		{0622E827-8464-489D-8B1C-B0B496F35C08} = {0622E827-8464-489D-8B1C-B0B496F35C08}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llc", "llc\llc.vcproj", "{ADE86BDC-B04C-43DF-B9BB-90492C7B14AC}"
-	ProjectSection(WebsiteProperties) = preProject
-		Debug.AspNetCompiler.Debug = "True"
-		Release.AspNetCompiler.Debug = "False"
-	EndProjectSection
 	ProjectSection(ProjectDependencies) = postProject
-		{0622E827-8464-489D-8B1C-B0B496F35C08} = {0622E827-8464-489D-8B1C-B0B496F35C08}
-		{28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508}
-		{F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62} = {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62}
-		{059FBAB8-C76D-48A0-AA75-3C57BD3EAFE4} = {059FBAB8-C76D-48A0-AA75-3C57BD3EAFE4}
-		{08CEB1BB-C2A4-4587-B9A9-AEDB8FB44897} = {08CEB1BB-C2A4-4587-B9A9-AEDB8FB44897}
-		{057777CD-DED5-46DF-BF9A-6B76DE212549} = {057777CD-DED5-46DF-BF9A-6B76DE212549}
-		{45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB}
-		{0F8407F3-FA23-4CF1-83A9-DCBE0B361489} = {0F8407F3-FA23-4CF1-83A9-DCBE0B361489}
 		{144EEBF6-8C9B-4473-B715-2C821666AF6C} = {144EEBF6-8C9B-4473-B715-2C821666AF6C}
+		{0F8407F3-FA23-4CF1-83A9-DCBE0B361489} = {0F8407F3-FA23-4CF1-83A9-DCBE0B361489}
+		{45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB}
+		{057777CD-DED5-46DF-BF9A-6B76DE212549} = {057777CD-DED5-46DF-BF9A-6B76DE212549}
+		{08CEB1BB-C2A4-4587-B9A9-AEDB8FB44897} = {08CEB1BB-C2A4-4587-B9A9-AEDB8FB44897}
+		{059FBAB8-C76D-48A0-AA75-3C57BD3EAFE4} = {059FBAB8-C76D-48A0-AA75-3C57BD3EAFE4}
+		{F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62} = {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62}
+		{28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508}
+		{0622E827-8464-489D-8B1C-B0B496F35C08} = {0622E827-8464-489D-8B1C-B0B496F35C08}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llvm-dis", "llvm-dis\llvm-dis.vcproj", "{B13476BC-30AB-4EA0-BC1E-212C0A459405}"
-	ProjectSection(WebsiteProperties) = preProject
-		Debug.AspNetCompiler.Debug = "True"
-		Release.AspNetCompiler.Debug = "False"
-	EndProjectSection
 	ProjectSection(ProjectDependencies) = postProject
-		{28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508}
-		{19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E}
-		{F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62} = {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62}
-		{45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB}
 		{0F8407F3-FA23-4CF1-83A9-DCBE0B361489} = {0F8407F3-FA23-4CF1-83A9-DCBE0B361489}
+		{45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB}
+		{F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62} = {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62}
+		{19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E}
+		{28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llvm-as", "llvm-as\llvm-as.vcproj", "{4FBC40A5-E626-4A6C-A9D3-FAE5C28D30CC}"
-	ProjectSection(WebsiteProperties) = preProject
-		Debug.AspNetCompiler.Debug = "True"
-		Release.AspNetCompiler.Debug = "False"
-	EndProjectSection
 	ProjectSection(ProjectDependencies) = postProject
-		{28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508}
-		{19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E}
-		{F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62} = {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62}
-		{45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB}
-		{0F8407F3-FA23-4CF1-83A9-DCBE0B361489} = {0F8407F3-FA23-4CF1-83A9-DCBE0B361489}
 		{3DC216F5-1DDD-478A-84F8-C124E5C31982} = {3DC216F5-1DDD-478A-84F8-C124E5C31982}
+		{0F8407F3-FA23-4CF1-83A9-DCBE0B361489} = {0F8407F3-FA23-4CF1-83A9-DCBE0B361489}
+		{45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB}
+		{F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62} = {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62}
+		{19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E}
+		{28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AsmParser", "AsmParser\AsmParser.vcproj", "{3DC216F5-1DDD-478A-84F8-C124E5C31982}"
-	ProjectSection(WebsiteProperties) = preProject
-		Debug.AspNetCompiler.Debug = "True"
-		Release.AspNetCompiler.Debug = "False"
-	EndProjectSection
 	ProjectSection(ProjectDependencies) = postProject
 		{19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llvm-ar", "llvm-ar\llvm-ar.vcproj", "{0FF2B75C-49C1-4B49-A44A-531C93000296}"
-	ProjectSection(WebsiteProperties) = preProject
-		Debug.AspNetCompiler.Debug = "True"
-		Release.AspNetCompiler.Debug = "False"
-	EndProjectSection
 	ProjectSection(ProjectDependencies) = postProject
-		{28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508}
-		{19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E}
-		{F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D61} = {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D61}
-		{F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62} = {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62}
-		{45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB}
 		{0F8407F3-FA23-4CF1-83A9-DCBE0B361489} = {0F8407F3-FA23-4CF1-83A9-DCBE0B361489}
+		{45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB}
+		{F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62} = {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62}
+		{F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D61} = {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D61}
+		{19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E}
+		{28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llvm-ranlib", "llvm-ranlib\llvm-ranlib.vcproj", "{BB16C7EE-B4ED-4714-B5ED-B775C62A6612}"
-	ProjectSection(WebsiteProperties) = preProject
-		Debug.AspNetCompiler.Debug = "True"
-		Release.AspNetCompiler.Debug = "False"
-	EndProjectSection
 	ProjectSection(ProjectDependencies) = postProject
-		{28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508}
-		{19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E}
-		{F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D61} = {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D61}
-		{F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62} = {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62}
-		{45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB}
 		{0F8407F3-FA23-4CF1-83A9-DCBE0B361489} = {0F8407F3-FA23-4CF1-83A9-DCBE0B361489}
+		{45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB}
+		{F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62} = {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62}
+		{F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D61} = {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D61}
+		{19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E}
+		{28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llvm-link", "llvm-link\llvm-link.vcproj", "{5E249789-49E1-4600-B12B-8AD2BB6439B2}"
-	ProjectSection(WebsiteProperties) = preProject
-		Debug.AspNetCompiler.Debug = "True"
-		Release.AspNetCompiler.Debug = "False"
-	EndProjectSection
 	ProjectSection(ProjectDependencies) = postProject
-		{28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508}
-		{19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E}
-		{F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62} = {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62}
-		{342CF48F-760A-4040-A9A1-7D75AA2471CE} = {342CF48F-760A-4040-A9A1-7D75AA2471CE}
-		{45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB}
 		{0F8407F3-FA23-4CF1-83A9-DCBE0B361489} = {0F8407F3-FA23-4CF1-83A9-DCBE0B361489}
+		{45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB}
+		{342CF48F-760A-4040-A9A1-7D75AA2471CE} = {342CF48F-760A-4040-A9A1-7D75AA2471CE}
+		{F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62} = {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62}
+		{19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E}
+		{28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Linker", "Linker\Linker.vcproj", "{342CF48F-760A-4040-A9A1-7D75AA2471CE}"
-	ProjectSection(WebsiteProperties) = preProject
-		Debug.AspNetCompiler.Debug = "True"
-		Release.AspNetCompiler.Debug = "False"
-	EndProjectSection
 	ProjectSection(ProjectDependencies) = postProject
-		{28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508}
-		{19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E}
 		{0F8407F3-FA23-4CF1-83A9-DCBE0B361489} = {0F8407F3-FA23-4CF1-83A9-DCBE0B361489}
+		{19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E}
+		{28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CBackend", "CBackend\CBackend.vcproj", "{057777CD-DED5-46DF-BF9A-6B76DE212549}"
-	ProjectSection(WebsiteProperties) = preProject
-		Debug.AspNetCompiler.Debug = "True"
-		Release.AspNetCompiler.Debug = "False"
-	EndProjectSection
 	ProjectSection(ProjectDependencies) = postProject
-		{19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E}
 		{45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB}
+		{19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "opt", "opt\opt.vcproj", "{006D8B41-C3C7-4448-85E1-AF8907E591E5}"
-	ProjectSection(WebsiteProperties) = preProject
-		Debug.AspNetCompiler.Debug = "True"
-		Release.AspNetCompiler.Debug = "False"
-	EndProjectSection
 	ProjectSection(ProjectDependencies) = postProject
-		{0622E827-8464-489D-8B1C-B0B496F35C08} = {0622E827-8464-489D-8B1C-B0B496F35C08}
-		{28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508}
-		{19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E}
-		{F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62} = {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62}
-		{059FBAB8-C76D-48A0-AA75-3C57BD3EAFE4} = {059FBAB8-C76D-48A0-AA75-3C57BD3EAFE4}
-		{C59374C1-9FC0-4147-B836-327DFDC52D99} = {C59374C1-9FC0-4147-B836-327DFDC52D99}
-		{45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB}
 		{0F8407F3-FA23-4CF1-83A9-DCBE0B361489} = {0F8407F3-FA23-4CF1-83A9-DCBE0B361489}
+		{45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB}
+		{C59374C1-9FC0-4147-B836-327DFDC52D99} = {C59374C1-9FC0-4147-B836-327DFDC52D99}
+		{059FBAB8-C76D-48A0-AA75-3C57BD3EAFE4} = {059FBAB8-C76D-48A0-AA75-3C57BD3EAFE4}
+		{F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62} = {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62}
+		{19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E}
+		{28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508}
+		{0622E827-8464-489D-8B1C-B0B496F35C08} = {0622E827-8464-489D-8B1C-B0B496F35C08}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llvm-bcanalyzer", "llvm-bcanalyzer\llvm-bcanalyzer.vcproj", "{E0B1E329-BE3E-456D-B372-5F397BE42C84}"
-	ProjectSection(WebsiteProperties) = preProject
-		Debug.AspNetCompiler.Debug = "True"
-		Release.AspNetCompiler.Debug = "False"
-	EndProjectSection
 	ProjectSection(ProjectDependencies) = postProject
-		{28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508}
-		{19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E}
-		{45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB}
 		{0F8407F3-FA23-4CF1-83A9-DCBE0B361489} = {0F8407F3-FA23-4CF1-83A9-DCBE0B361489}
+		{45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB}
+		{19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E}
+		{28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llvm-ld", "llvm-ld\llvm-ld.vcproj", "{64D8AA46-88DB-41F4-B837-053AE02406B8}"
-	ProjectSection(WebsiteProperties) = preProject
-		Debug.AspNetCompiler.Debug = "True"
-		Release.AspNetCompiler.Debug = "False"
-	EndProjectSection
 	ProjectSection(ProjectDependencies) = postProject
-		{0622E827-8464-489D-8B1C-B0B496F35C08} = {0622E827-8464-489D-8B1C-B0B496F35C08}
-		{28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508}
-		{19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E}
-		{F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D61} = {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D61}
-		{F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62} = {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62}
-		{342CF48F-760A-4040-A9A1-7D75AA2471CE} = {342CF48F-760A-4040-A9A1-7D75AA2471CE}
-		{059FBAB8-C76D-48A0-AA75-3C57BD3EAFE4} = {059FBAB8-C76D-48A0-AA75-3C57BD3EAFE4}
-		{C59374C1-9FC0-4147-B836-327DFDC52D99} = {C59374C1-9FC0-4147-B836-327DFDC52D99}
-		{45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB}
 		{0F8407F3-FA23-4CF1-83A9-DCBE0B361489} = {0F8407F3-FA23-4CF1-83A9-DCBE0B361489}
+		{45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB}
+		{C59374C1-9FC0-4147-B836-327DFDC52D99} = {C59374C1-9FC0-4147-B836-327DFDC52D99}
+		{059FBAB8-C76D-48A0-AA75-3C57BD3EAFE4} = {059FBAB8-C76D-48A0-AA75-3C57BD3EAFE4}
+		{342CF48F-760A-4040-A9A1-7D75AA2471CE} = {342CF48F-760A-4040-A9A1-7D75AA2471CE}
+		{F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62} = {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62}
+		{F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D61} = {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D61}
+		{19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E}
+		{28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508}
+		{0622E827-8464-489D-8B1C-B0B496F35C08} = {0622E827-8464-489D-8B1C-B0B496F35C08}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llvm-nm", "llvm-nm\llvm-nm.vcproj", "{5FF862CE-80A0-4B48-A80B-68AE325A0432}"
-	ProjectSection(WebsiteProperties) = preProject
-		Debug.AspNetCompiler.Debug = "True"
-		Release.AspNetCompiler.Debug = "False"
-	EndProjectSection
 	ProjectSection(ProjectDependencies) = postProject
-		{28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508}
-		{19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E}
-		{F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D61} = {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D61}
-		{F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62} = {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62}
-		{45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB}
 		{0F8407F3-FA23-4CF1-83A9-DCBE0B361489} = {0F8407F3-FA23-4CF1-83A9-DCBE0B361489}
+		{45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB}
+		{F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62} = {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62}
+		{F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D61} = {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D61}
+		{19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E}
+		{28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llvm-prof", "llvm-prof\llvm-prof.vcproj", "{ACBE81D9-64B1-4133-823A-807A4E60B454}"
-	ProjectSection(WebsiteProperties) = preProject
-		Debug.AspNetCompiler.Debug = "True"
-		Release.AspNetCompiler.Debug = "False"
-	EndProjectSection
 	ProjectSection(ProjectDependencies) = postProject
-		{0622E827-8464-489D-8B1C-B0B496F35C08} = {0622E827-8464-489D-8B1C-B0B496F35C08}
-		{28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508}
-		{19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E}
-		{F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62} = {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62}
-		{45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB}
 		{0F8407F3-FA23-4CF1-83A9-DCBE0B361489} = {0F8407F3-FA23-4CF1-83A9-DCBE0B361489}
+		{45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB}
+		{F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62} = {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62}
+		{19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E}
+		{28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508}
+		{0622E827-8464-489D-8B1C-B0B496F35C08} = {0622E827-8464-489D-8B1C-B0B496F35C08}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bugpoint", "bugpoint\bugpoint.vcproj", "{57249192-8E29-4D85-8B7A-FEFF1760B1DA}"
-	ProjectSection(WebsiteProperties) = preProject
-		Debug.AspNetCompiler.Debug = "True"
-		Release.AspNetCompiler.Debug = "False"
-	EndProjectSection
 	ProjectSection(ProjectDependencies) = postProject
-		{0622E827-8464-489D-8B1C-B0B496F35C08} = {0622E827-8464-489D-8B1C-B0B496F35C08}
-		{28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508}
-		{19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E}
-		{F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62} = {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62}
-		{342CF48F-760A-4040-A9A1-7D75AA2471CE} = {342CF48F-760A-4040-A9A1-7D75AA2471CE}
-		{059FBAB8-C76D-48A0-AA75-3C57BD3EAFE4} = {059FBAB8-C76D-48A0-AA75-3C57BD3EAFE4}
-		{C59374C1-9FC0-4147-B836-327DFDC52D99} = {C59374C1-9FC0-4147-B836-327DFDC52D99}
-		{45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB}
-		{0F8407F3-FA23-4CF1-83A9-DCBE0B361489} = {0F8407F3-FA23-4CF1-83A9-DCBE0B361489}
 		{3DC216F5-1DDD-478A-84F8-C124E5C31982} = {3DC216F5-1DDD-478A-84F8-C124E5C31982}
+		{0F8407F3-FA23-4CF1-83A9-DCBE0B361489} = {0F8407F3-FA23-4CF1-83A9-DCBE0B361489}
+		{45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB}
+		{C59374C1-9FC0-4147-B836-327DFDC52D99} = {C59374C1-9FC0-4147-B836-327DFDC52D99}
+		{059FBAB8-C76D-48A0-AA75-3C57BD3EAFE4} = {059FBAB8-C76D-48A0-AA75-3C57BD3EAFE4}
+		{342CF48F-760A-4040-A9A1-7D75AA2471CE} = {342CF48F-760A-4040-A9A1-7D75AA2471CE}
+		{F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62} = {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62}
+		{19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E}
+		{28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508}
+		{0622E827-8464-489D-8B1C-B0B496F35C08} = {0622E827-8464-489D-8B1C-B0B496F35C08}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Bitcode", "Bitcode\Bitcode.vcproj", "{F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62}"
-	ProjectSection(WebsiteProperties) = preProject
-		Debug.AspNetCompiler.Debug = "True"
-		Release.AspNetCompiler.Debug = "False"
-	EndProjectSection
 	ProjectSection(ProjectDependencies) = postProject
 		{28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Archive", "Archive\Archive.vcproj", "{F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D61}"
-	ProjectSection(WebsiteProperties) = preProject
-		Debug.AspNetCompiler.Debug = "True"
-		Release.AspNetCompiler.Debug = "False"
-	EndProjectSection
 	ProjectSection(ProjectDependencies) = postProject
-		{19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E}
 		{45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB}
+		{19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E}
 	EndProjectSection
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "LLVM", "LLVM", "{455BCF47-13B6-451E-8321-8ED9C4866BAA}"
-	ProjectSection(WebsiteProperties) = preProject
-		Debug.AspNetCompiler.Debug = "True"
-		Release.AspNetCompiler.Debug = "False"
-	EndProjectSection
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Clang", "Clang", "{DAC2AB11-F09C-454B-86FD-9BDBBA25827F}"
-	ProjectSection(WebsiteProperties) = preProject
-		Debug.AspNetCompiler.Debug = "True"
-		Release.AspNetCompiler.Debug = "False"
-	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "clangLex", "..\tools\clang\win32\clangLex\clangLex.vcproj", "{030F6909-B2FA-4E53-BEA7-9A559CFC2F73}"
-	ProjectSection(WebsiteProperties) = preProject
-		Debug.AspNetCompiler.Debug = "True"
-		Release.AspNetCompiler.Debug = "False"
-	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "clangParse", "..\tools\clang\win32\clangParse\clangParse.vcproj", "{05DF3074-11AF-491A-B078-83BD2EDC31F6}"
-	ProjectSection(WebsiteProperties) = preProject
-		Debug.AspNetCompiler.Debug = "True"
-		Release.AspNetCompiler.Debug = "False"
-	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "clangAST", "..\tools\clang\win32\clangAST\clangAST.vcproj", "{5125C3DB-FBD6-4BF8-8D8B-CE51D6E93BCD}"
-	ProjectSection(WebsiteProperties) = preProject
-		Debug.AspNetCompiler.Debug = "True"
-		Release.AspNetCompiler.Debug = "False"
-	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "clangSema", "..\tools\clang\win32\clangSema\clangSema.vcproj", "{4727E8B7-AA99-41C9-AB09-A8A862595DB7}"
-	ProjectSection(WebsiteProperties) = preProject
-		Debug.AspNetCompiler.Debug = "True"
-		Release.AspNetCompiler.Debug = "False"
-	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "clangCodeGen", "..\tools\clang\win32\clangCodeGen\clangCodeGen.vcproj", "{4CEC5897-D957-47E7-A6AE-2021D4F44A8F}"
-	ProjectSection(WebsiteProperties) = preProject
-		Debug.AspNetCompiler.Debug = "True"
-		Release.AspNetCompiler.Debug = "False"
-	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "clangDriver", "..\tools\clang\win32\clangDriver\clangDriver.vcproj", "{7E7DA455-C276-4B93-8D02-8F7E2F629BAF}"
-	ProjectSection(WebsiteProperties) = preProject
-		Debug.AspNetCompiler.Debug = "True"
-		Release.AspNetCompiler.Debug = "False"
-	EndProjectSection
 	ProjectSection(ProjectDependencies) = postProject
 		{030F6909-B2FA-4E53-BEA7-9A559CFC2F73} = {030F6909-B2FA-4E53-BEA7-9A559CFC2F73}
+		{0622E827-8464-489D-8B1C-B0B496F35C08} = {0622E827-8464-489D-8B1C-B0B496F35C08}
+		{0F8407F3-FA23-4CF1-83A9-DCBE0B361489} = {0F8407F3-FA23-4CF1-83A9-DCBE0B361489}
+		{5125C3DB-FBD6-4BF8-8D8B-CE51D6E93BCD} = {5125C3DB-FBD6-4BF8-8D8B-CE51D6E93BCD}
+		{45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB}
+		{08CEB1BB-C2A4-4587-B9A9-AEDB8FB44897} = {08CEB1BB-C2A4-4587-B9A9-AEDB8FB44897}
 		{059FBAB8-C76D-48A0-AA75-3C57BD3EAFE4} = {059FBAB8-C76D-48A0-AA75-3C57BD3EAFE4}
+		{4727E8B7-AA99-41C9-AB09-A8A862595DB7} = {4727E8B7-AA99-41C9-AB09-A8A862595DB7}
 		{F9FBDDA2-9EE1-473C-A456-BE20B7B2439D} = {F9FBDDA2-9EE1-473C-A456-BE20B7B2439D}
-		{28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508}
-		{05DF3074-11AF-491A-B078-83BD2EDC31F6} = {05DF3074-11AF-491A-B078-83BD2EDC31F6}
-		{298B4876-6EF1-4E80-85D7-72F80693BBEB} = {298B4876-6EF1-4E80-85D7-72F80693BBEB}
 		{4CEC5897-D957-47E7-A6AE-2021D4F44A8F} = {4CEC5897-D957-47E7-A6AE-2021D4F44A8F}
-		{4727E8B7-AA99-41C9-AB09-A8A862595DB7} = {4727E8B7-AA99-41C9-AB09-A8A862595DB7}
-		{45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB}
-		{5125C3DB-FBD6-4BF8-8D8B-CE51D6E93BCD} = {5125C3DB-FBD6-4BF8-8D8B-CE51D6E93BCD}
-		{0F8407F3-FA23-4CF1-83A9-DCBE0B361489} = {0F8407F3-FA23-4CF1-83A9-DCBE0B361489}
-		{6C98551A-4C36-4E74-8419-4D3EEEC9D8E0} = {6C98551A-4C36-4E74-8419-4D3EEEC9D8E0}
+		{298B4876-6EF1-4E80-85D7-72F80693BBEB} = {298B4876-6EF1-4E80-85D7-72F80693BBEB}
+		{05DF3074-11AF-491A-B078-83BD2EDC31F6} = {05DF3074-11AF-491A-B078-83BD2EDC31F6}
 		{F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62} = {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62}
+		{28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508}
+		{6C98551A-4C36-4E74-8419-4D3EEEC9D8E0} = {6C98551A-4C36-4E74-8419-4D3EEEC9D8E0}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "clangBasic", "..\tools\clang\win32\clangBasic\clangBasic.vcproj", "{298B4876-6EF1-4E80-85D7-72F80693BBEB}"
-	ProjectSection(WebsiteProperties) = preProject
-		Debug.AspNetCompiler.Debug = "True"
-		Release.AspNetCompiler.Debug = "False"
-	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "clangAnalysis", "..\tools\clang\win32\clangAnalysis\clangAnalysis.vcproj", "{6C98551A-4C36-4E74-8419-4D3EEEC9D8E0}"
-	ProjectSection(WebsiteProperties) = preProject
-		Debug.AspNetCompiler.Debug = "True"
-		Release.AspNetCompiler.Debug = "False"
-	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "clangRewrite", "..\tools\clang\win32\clangRewrite\clangRewrite.vcproj", "{F9FBDDA2-9EE1-473C-A456-BE20B7B2439D}"
-	ProjectSection(WebsiteProperties) = preProject
-		Debug.AspNetCompiler.Debug = "True"
-		Release.AspNetCompiler.Debug = "False"
-	EndProjectSection
 EndProject
 Global
-	GlobalSection(DPCodeReviewSolutionGUID) = preSolution
-		DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000}
-	EndGlobalSection
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Configure|Win32 = Configure|Win32
 		Debug|Win32 = Debug|Win32
@@ -738,4 +573,7 @@
 		{6C98551A-4C36-4E74-8419-4D3EEEC9D8E0} = {DAC2AB11-F09C-454B-86FD-9BDBBA25827F}
 		{F9FBDDA2-9EE1-473C-A456-BE20B7B2439D} = {DAC2AB11-F09C-454B-86FD-9BDBBA25827F}
 	EndGlobalSection
+	GlobalSection(DPCodeReviewSolutionGUID) = preSolution
+		DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000}
+	EndGlobalSection
 EndGlobal

Added: llvm/branches/non-call-eh/win32/common.vsprops
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/win32/common.vsprops?rev=53163&view=auto

==============================================================================
--- llvm/branches/non-call-eh/win32/common.vsprops (added)
+++ llvm/branches/non-call-eh/win32/common.vsprops Sun Jul  6 15:45:41 2008
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioPropertySheet
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="common"
+	>
+	<Tool
+		Name="VCCLCompilerTool"
+		PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS"
+	/>
+</VisualStudioPropertySheet>

Modified: llvm/branches/non-call-eh/win32/dobison.cmd
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/win32/dobison.cmd?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/win32/dobison.cmd (original)
+++ llvm/branches/non-call-eh/win32/dobison.cmd Sun Jul  6 15:45:41 2008
@@ -22,6 +22,8 @@
 
 :nobison
 echo Bison not found.  Using pre-generated files.
+copy %~pn4.cpp.cvs .\%3.cpp
 copy %~pn4.cpp.cvs %5\%3.cpp
+copy %~pn4.h.cvs .\%3.h
 copy %~pn4.h.cvs %5\%3.h
 exit

Modified: llvm/branches/non-call-eh/win32/llc/llc.vcproj
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/win32/llc/llc.vcproj?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/win32/llc/llc.vcproj (original)
+++ llvm/branches/non-call-eh/win32/llc/llc.vcproj Sun Jul  6 15:45:41 2008
@@ -22,7 +22,7 @@
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
@@ -108,7 +108,7 @@
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool

Modified: llvm/branches/non-call-eh/win32/lli/lli.vcproj
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/win32/lli/lli.vcproj?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/win32/lli/lli.vcproj (original)
+++ llvm/branches/non-call-eh/win32/lli/lli.vcproj Sun Jul  6 15:45:41 2008
@@ -22,7 +22,7 @@
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
@@ -108,7 +108,7 @@
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool

Modified: llvm/branches/non-call-eh/win32/llvm-ar/llvm-ar.vcproj
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/win32/llvm-ar/llvm-ar.vcproj?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/win32/llvm-ar/llvm-ar.vcproj (original)
+++ llvm/branches/non-call-eh/win32/llvm-ar/llvm-ar.vcproj Sun Jul  6 15:45:41 2008
@@ -22,7 +22,7 @@
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
@@ -107,7 +107,7 @@
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool

Modified: llvm/branches/non-call-eh/win32/llvm-as/llvm-as.vcproj
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/win32/llvm-as/llvm-as.vcproj?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/win32/llvm-as/llvm-as.vcproj (original)
+++ llvm/branches/non-call-eh/win32/llvm-as/llvm-as.vcproj Sun Jul  6 15:45:41 2008
@@ -22,7 +22,7 @@
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
@@ -107,7 +107,7 @@
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool

Modified: llvm/branches/non-call-eh/win32/llvm-bcanalyzer/llvm-bcanalyzer.vcproj
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/win32/llvm-bcanalyzer/llvm-bcanalyzer.vcproj?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/win32/llvm-bcanalyzer/llvm-bcanalyzer.vcproj (original)
+++ llvm/branches/non-call-eh/win32/llvm-bcanalyzer/llvm-bcanalyzer.vcproj Sun Jul  6 15:45:41 2008
@@ -22,7 +22,7 @@
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
@@ -107,7 +107,7 @@
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool

Modified: llvm/branches/non-call-eh/win32/llvm-dis/llvm-dis.vcproj
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/win32/llvm-dis/llvm-dis.vcproj?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/win32/llvm-dis/llvm-dis.vcproj (original)
+++ llvm/branches/non-call-eh/win32/llvm-dis/llvm-dis.vcproj Sun Jul  6 15:45:41 2008
@@ -22,7 +22,7 @@
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
@@ -107,7 +107,7 @@
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool

Modified: llvm/branches/non-call-eh/win32/llvm-ld/llvm-ld.vcproj
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/win32/llvm-ld/llvm-ld.vcproj?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/win32/llvm-ld/llvm-ld.vcproj (original)
+++ llvm/branches/non-call-eh/win32/llvm-ld/llvm-ld.vcproj Sun Jul  6 15:45:41 2008
@@ -22,7 +22,7 @@
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
@@ -107,7 +107,7 @@
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool

Modified: llvm/branches/non-call-eh/win32/llvm-link/llvm-link.vcproj
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/win32/llvm-link/llvm-link.vcproj?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/win32/llvm-link/llvm-link.vcproj (original)
+++ llvm/branches/non-call-eh/win32/llvm-link/llvm-link.vcproj Sun Jul  6 15:45:41 2008
@@ -22,7 +22,7 @@
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
@@ -107,7 +107,7 @@
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool

Modified: llvm/branches/non-call-eh/win32/llvm-nm/llvm-nm.vcproj
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/win32/llvm-nm/llvm-nm.vcproj?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/win32/llvm-nm/llvm-nm.vcproj (original)
+++ llvm/branches/non-call-eh/win32/llvm-nm/llvm-nm.vcproj Sun Jul  6 15:45:41 2008
@@ -22,7 +22,7 @@
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
@@ -107,7 +107,7 @@
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool

Modified: llvm/branches/non-call-eh/win32/llvm-prof/llvm-prof.vcproj
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/win32/llvm-prof/llvm-prof.vcproj?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/win32/llvm-prof/llvm-prof.vcproj (original)
+++ llvm/branches/non-call-eh/win32/llvm-prof/llvm-prof.vcproj Sun Jul  6 15:45:41 2008
@@ -22,7 +22,7 @@
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
@@ -107,7 +107,7 @@
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool

Modified: llvm/branches/non-call-eh/win32/llvm-ranlib/llvm-ranlib.vcproj
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/win32/llvm-ranlib/llvm-ranlib.vcproj?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/win32/llvm-ranlib/llvm-ranlib.vcproj (original)
+++ llvm/branches/non-call-eh/win32/llvm-ranlib/llvm-ranlib.vcproj Sun Jul  6 15:45:41 2008
@@ -22,7 +22,7 @@
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
@@ -107,7 +107,7 @@
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool

Modified: llvm/branches/non-call-eh/win32/opt/opt.vcproj
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/win32/opt/opt.vcproj?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/win32/opt/opt.vcproj (original)
+++ llvm/branches/non-call-eh/win32/opt/opt.vcproj Sun Jul  6 15:45:41 2008
@@ -22,7 +22,7 @@
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
@@ -107,7 +107,7 @@
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool

Modified: llvm/branches/non-call-eh/win32/x86/x86.vcproj
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/win32/x86/x86.vcproj?rev=53163&r1=53162&r2=53163&view=diff

==============================================================================
--- llvm/branches/non-call-eh/win32/x86/x86.vcproj (original)
+++ llvm/branches/non-call-eh/win32/x86/x86.vcproj Sun Jul  6 15:45:41 2008
@@ -23,7 +23,7 @@
 			OutputDirectory="$(SolutionDir)\bin\$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="4"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
 			CharacterSet="2"
 			>
 			<Tool





More information about the llvm-commits mailing list