From sabre at nondot.org Mon Oct 29 00:47:53 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 29 Oct 2007 05:47:53 -0000 Subject: [llvm-commits] [llvm] r43442 - in /llvm/trunk: include/llvm/Intrinsics.td test/Transforms/InstCombine/2007-10-28-stacksave.ll Message-ID: <200710290547.l9T5lrPN013200@zion.cs.uiuc.edu> Author: lattner Date: Mon Oct 29 00:47:52 2007 New Revision: 43442 URL: http://llvm.org/viewvc/llvm-project?rev=43442&view=rev Log: Model stacksave and stackrestore as both writing memory, since we don't model their dependences on allocas correctly. This fixes PR1745. Added: llvm/trunk/test/Transforms/InstCombine/2007-10-28-stacksave.ll Modified: llvm/trunk/include/llvm/Intrinsics.td Modified: llvm/trunk/include/llvm/Intrinsics.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Intrinsics.td?rev=43442&r1=43441&r2=43442&view=diff ============================================================================== --- llvm/trunk/include/llvm/Intrinsics.td (original) +++ llvm/trunk/include/llvm/Intrinsics.td Mon Oct 29 00:47:52 2007 @@ -149,7 +149,10 @@ // def int_returnaddress : Intrinsic<[llvm_ptr_ty, llvm_i32_ty], [IntrNoMem]>; def int_frameaddress : Intrinsic<[llvm_ptr_ty, llvm_i32_ty], [IntrNoMem]>; -def int_stacksave : Intrinsic<[llvm_ptr_ty], [IntrReadMem]>, + +// Note: we treat stacksave/stackrestore as writemem because we don't otherwise +// model their dependencies on allocas. +def int_stacksave : Intrinsic<[llvm_ptr_ty]>, GCCBuiltin<"__builtin_stack_save">; def int_stackrestore : Intrinsic<[llvm_void_ty, llvm_ptr_ty]>, GCCBuiltin<"__builtin_stack_restore">; Added: llvm/trunk/test/Transforms/InstCombine/2007-10-28-stacksave.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/2007-10-28-stacksave.ll?rev=43442&view=auto ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/2007-10-28-stacksave.ll (added) +++ llvm/trunk/test/Transforms/InstCombine/2007-10-28-stacksave.ll Mon Oct 29 00:47:52 2007 @@ -0,0 +1,47 @@ +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {call.*stacksave} +; PR1745 +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-darwin8" + at p = weak global i8* null ; [#uses=1] + +define i32 @main() { +entry: + %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] + br label %lab + +lab: ; preds = %cleanup31, %entry + %n.0 = phi i32 [ 0, %entry ], [ %tmp25, %cleanup31 ] ; [#uses=2] + %tmp2 = call i8* @llvm.stacksave( ) ; [#uses=2] + %tmp4 = srem i32 %n.0, 47 ; [#uses=1] + %tmp5 = add i32 %tmp4, 1 ; [#uses=5] + %tmp7 = sub i32 %tmp5, 1 ; [#uses=0] + %tmp89 = zext i32 %tmp5 to i64 ; [#uses=1] + %tmp10 = mul i64 %tmp89, 32 ; [#uses=0] + %tmp12 = mul i32 %tmp5, 4 ; [#uses=0] + %tmp1314 = zext i32 %tmp5 to i64 ; [#uses=1] + %tmp15 = mul i64 %tmp1314, 32 ; [#uses=0] + %tmp17 = mul i32 %tmp5, 4 ; [#uses=1] + %tmp18 = alloca i8, i32 %tmp17 ; [#uses=1] + %tmp1819 = bitcast i8* %tmp18 to i32* ; [#uses=2] + %tmp21 = getelementptr i32* %tmp1819, i32 0 ; [#uses=1] + store i32 1, i32* %tmp21, align 4 + %tmp2223 = bitcast i32* %tmp1819 to i8* ; [#uses=1] + volatile store i8* %tmp2223, i8** @p, align 4 + %tmp25 = add i32 %n.0, 1 ; [#uses=2] + %tmp27 = icmp sle i32 %tmp25, 999999 ; [#uses=1] + %tmp2728 = zext i1 %tmp27 to i8 ; [#uses=1] + %toBool = icmp ne i8 %tmp2728, 0 ; [#uses=1] + br i1 %toBool, label %cleanup31, label %cond_next + +cond_next: ; preds = %lab + call void @llvm.stackrestore( i8* %tmp2 ) + ret i32 0 + +cleanup31: ; preds = %lab + call void @llvm.stackrestore( i8* %tmp2 ) + br label %lab +} + +declare i8* @llvm.stacksave() + +declare void @llvm.stackrestore(i8*) From sabre at nondot.org Mon Oct 29 01:19:48 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 29 Oct 2007 06:19:48 -0000 Subject: [llvm-commits] [llvm] r43444 - /llvm/trunk/lib/Target/X86/README-SSE.txt Message-ID: <200710290619.l9T6JmQa015094@zion.cs.uiuc.edu> Author: lattner Date: Mon Oct 29 01:19:48 2007 New Revision: 43444 URL: http://llvm.org/viewvc/llvm-project?rev=43444&view=rev Log: add a note. Modified: llvm/trunk/lib/Target/X86/README-SSE.txt Modified: llvm/trunk/lib/Target/X86/README-SSE.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/README-SSE.txt?rev=43444&r1=43443&r2=43444&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/README-SSE.txt (original) +++ llvm/trunk/lib/Target/X86/README-SSE.txt Mon Oct 29 01:19:48 2007 @@ -708,3 +708,36 @@ //===---------------------------------------------------------------------===// +These functions: + +#include +__m128i a; +void x(unsigned short n) { + a = _mm_slli_epi32 (a, n); +} +void y(unsigned n) { + a = _mm_slli_epi32 (a, n); +} + +compile to ( -O3 -static -fomit-frame-pointer): +_x: + movzwl 4(%esp), %eax + movd %eax, %xmm0 + movaps _a, %xmm1 + pslld %xmm0, %xmm1 + movaps %xmm1, _a + ret +_y: + movd 4(%esp), %xmm0 + movaps _a, %xmm1 + pslld %xmm0, %xmm1 + movaps %xmm1, _a + ret + +"y" looks good, but "x" does silly movzwl stuff around into a GPR. It seems +like movd would be sufficient in both cases as the value is already zero +extended in the 32-bit stack slot IIRC. For signed short, it should also be +save, as a really-signed value would be undefined for pslld. + + +//===---------------------------------------------------------------------===// From evan.cheng at apple.com Mon Oct 29 02:57:51 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 29 Oct 2007 07:57:51 -0000 Subject: [llvm-commits] [llvm] r43446 - /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Message-ID: <200710290757.l9T7vpmC027034@zion.cs.uiuc.edu> Author: evancheng Date: Mon Oct 29 02:57:50 2007 New Revision: 43446 URL: http://llvm.org/viewvc/llvm-project?rev=43446&view=rev Log: Avoid doing something dumb like rewriting using a 64-bit iv in 32-bit mode. Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=43446&r1=43445&r2=43446&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Oct 29 02:57:50 2007 @@ -5125,7 +5125,11 @@ bool X86TargetLowering::isTruncateFree(const Type *Ty1, const Type *Ty2) const { if (!Ty1->isInteger() || !Ty2->isInteger()) return false; - return Ty1->getPrimitiveSizeInBits() > Ty2->getPrimitiveSizeInBits(); + unsigned NumBits1 = Ty1->getPrimitiveSizeInBits(); + unsigned NumBits2 = Ty2->getPrimitiveSizeInBits(); + if (NumBits1 <= NumBits2) + return false; + return Subtarget->is64Bit() || NumBits1 < 64; } From baldrick at free.fr Mon Oct 29 04:29:39 2007 From: baldrick at free.fr (Duncan Sands) Date: Mon, 29 Oct 2007 10:29:39 +0100 Subject: [llvm-commits] [llvm] r43424 - /llvm/trunk/lib/VMCore/Verifier.cpp In-Reply-To: <5B46F47E-569B-40BA-B7EC-ACD95F5DFC60@apple.com> References: <200710282250.l9SMoWI9028509@zion.cs.uiuc.edu> <5B46F47E-569B-40BA-B7EC-ACD95F5DFC60@apple.com> Message-ID: <200710291029.42858.baldrick@free.fr> > I renamed the option, but independently of that, I don't think this > is a good idea. The goal for this option is to support front-end who > want to use the verifier to catch things are are likely to be > malformed IR that they are constructing. As such, this should be > added to the *API* for verifier, not as a command line option. What > do you think? One advantage of a command line option is that when someone reports a bug and supplies a .ll file, you can easily run it through the pedantic verifier, and possibly quickly discover possible sources of problems. That said, I tend to agree with you that it should be part of the API. Ciao, Duncan. From sabre at nondot.org Mon Oct 29 12:06:35 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 29 Oct 2007 17:06:35 -0000 Subject: [llvm-commits] [llvm] r43452 - /llvm/trunk/test/Transforms/InstCombine/stacksaverestore.ll Message-ID: <200710291706.l9TH6ZIq021576@zion.cs.uiuc.edu> Author: lattner Date: Mon Oct 29 12:06:35 2007 New Revision: 43452 URL: http://llvm.org/viewvc/llvm-project?rev=43452&view=rev Log: update testcase Modified: llvm/trunk/test/Transforms/InstCombine/stacksaverestore.ll Modified: llvm/trunk/test/Transforms/InstCombine/stacksaverestore.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/stacksaverestore.ll?rev=43452&r1=43451&r2=43452&view=diff ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/stacksaverestore.ll (original) +++ llvm/trunk/test/Transforms/InstCombine/stacksaverestore.ll Mon Oct 29 12:06:35 2007 @@ -1,4 +1,4 @@ -; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | not grep call +; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | not grep {call.*stackrestore} ;; Test that llvm.stackrestore is removed when possible. From sabre at nondot.org Mon Oct 29 12:14:49 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 29 Oct 2007 12:14:49 -0500 Subject: [llvm-commits] CVS: llvm-www/InTheNews.html Message-ID: <200710291714.l9THEnmu022156@zion.cs.uiuc.edu> Changes in directory llvm-www: InTheNews.html updated: 1.24 -> 1.25 --- Log message: Fix punctuation --- Diffs of the changes: (+2 -2) InTheNews.html | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm-www/InTheNews.html diff -u llvm-www/InTheNews.html:1.24 llvm-www/InTheNews.html:1.25 --- llvm-www/InTheNews.html:1.24 Mon Oct 29 12:13:42 2007 +++ llvm-www/InTheNews.html Mon Oct 29 12:14:22 2007 @@ -15,7 +15,7 @@
News Articles

2007

    -
  • 2007-10-28Ars Technica, "Mac OS X 10.5 Leopard Review", John Siracusa
  • +
  • 2007-10-28, Ars Technica, "Mac OS X 10.5 Leopard Review", John Siracusa
  • 2007-10-17, digitalbackcountry, "Interview with Scott Petersen on the C/C++ in Flash Player Sneak", Ryan Stewart
  • 2007-10-03, peterelst, "Flash on C/C++", Scott Petersen. Second video on linked page.
  • 2007-09-29, zrusin, "Gallium3D, Shaders and LLVM", Zack Rusin
  • @@ -112,6 +112,6 @@ Valid HTML 4.01!
    - Last modified: $Date: 2007/10/29 17:13:42 $ + Last modified: $Date: 2007/10/29 17:14:22 $ From lattner at cs.uiuc.edu Mon Oct 29 12:14:49 2007 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 29 Oct 2007 12:14:49 -0500 Subject: [llvm-commits] CVS: llvm-www/InTheNews.html Message-ID: <200710291714.l9THEnFc022157@zion.cs.uiuc.edu> Changes in directory llvm-www: InTheNews.html updated: 1.23 -> 1.24 --- Log message: add a link --- Diffs of the changes: (+2 -1) InTheNews.html | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm-www/InTheNews.html diff -u llvm-www/InTheNews.html:1.23 llvm-www/InTheNews.html:1.24 --- llvm-www/InTheNews.html:1.23 Thu Oct 18 01:19:32 2007 +++ llvm-www/InTheNews.html Mon Oct 29 12:13:42 2007 @@ -15,6 +15,7 @@
    News Articles

    2007

      +
    • 2007-10-28Ars Technica, "Mac OS X 10.5 Leopard Review", John Siracusa
    • 2007-10-17, digitalbackcountry, "Interview with Scott Petersen on the C/C++ in Flash Player Sneak", Ryan Stewart
    • 2007-10-03, peterelst, "Flash on C/C++", Scott Petersen. Second video on linked page.
    • 2007-09-29, zrusin, "Gallium3D, Shaders and LLVM", Zack Rusin
    • @@ -111,6 +112,6 @@ Valid HTML 4.01!
      - Last modified: $Date: 2007/10/18 06:19:32 $ + Last modified: $Date: 2007/10/29 17:13:42 $ From lauro.venancio at gmail.com Mon Oct 29 12:55:30 2007 From: lauro.venancio at gmail.com (Lauro Ramos Venancio) Date: Mon, 29 Oct 2007 14:55:30 -0300 Subject: [llvm-commits] [llvm-gcc-4.2] r43378 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: <200710260329.l9Q3TumG032245@zion.cs.uiuc.edu> References: <200710260329.l9Q3TumG032245@zion.cs.uiuc.edu> Message-ID: <9c10c9f0710291055n25ca7edeu1efd5a0dc6701da5@mail.gmail.com> Hi Dale, This patch broke the llvm-gcc compilation for arm-linux. Lauro /home/laurov/tester/llvm-gcc-4.2/build/./gcc/xgcc -B/home/laurov/tester/llvm-gcc-4.2/build/./gcc/ -B/opt/crosstool/gcc-4.1.2-glibc-2.5/arm-linux-gnueabi/arm-linux-gnueabi/bin/ -B/opt/crosstool/gcc-4.1.2-glibc-2.5/arm-linux-gnueabi/arm-linux-gnueabi/lib/ -isystem /opt/crosstool/gcc-4.1.2-glibc-2.5/arm-linux-gnueabi/arm-linux-gnueabi/include -isystem /opt/crosstool/gcc-4.1.2-glibc-2.5/arm-linux-gnueabi/arm-linux-gnueabi/sys-include -O2 -O2 -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -fPIC -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -I. -I. -I../../gcc -I../../gcc/. -I../../gcc/../include -I../../gcc/../libcpp/include -I../../gcc/../libdecnumber -I../libdecnumber -I/home/laurov/tester/llvm/include -I/home/laurov/tester/llvm/build/include -DL_clear_cache -fvisibility=hidden -DHIDE_EXPORTS -c ../../gcc/libgcc2.c -o libgcc/./_clear_cache.o ../../gcc/libgcc2.c: In function '__clear_cache': ../../gcc/libgcc2.c:2039: error: Invalid or unsupported inline assembly! Preprocessed code: # 74 "../../gcc/libgcc2.c" 2 # 2034 "../../gcc/libgcc2.c" void __clear_cache (char *beg __attribute__((__unused__)), char *end __attribute__((__unused__))) { { register unsigned long _beg __asm ("a1") = (unsigned long) (beg); register unsigned long _end __asm ("a2") = (unsigned long) (end); register unsigned long _flg __asm ("a3") = 0; register unsigned long _scno __asm ("r7") = 0xf0002; __asm __volatile ("swi 0x9f0002 @ sys_cacheflush" : "=r" (_beg) : "0" (_beg), "r" (_end), "r" (_flg), "r" (_scno)); }; } 2007/10/26, Dale Johannesen : > Author: johannes > Date: Thu Oct 25 22:29:56 2007 > New Revision: 43378 > > URL: http://llvm.org/viewvc/llvm-project?rev=43378&view=rev > Log: > (inline asm) don't canonicalize single-hard-reg > constraints; they're already canonical. > > > Modified: > llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp > > Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=43378&r1=43377&r2=43378&view=diff > > ============================================================================== > --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) > +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Thu Oct 25 22:29:56 2007 > @@ -3526,6 +3526,7 @@ > if (IsInOut) > ++NumInOut, ++NumInputs; > > + std::string SimplifiedConstraint; > // If this output register is pinned to a machine register, use that machine > // register instead of the specified constraint. > if (TREE_CODE(Operand) == VAR_DECL && DECL_HARD_REGISTER(Operand)) { > @@ -3539,14 +3540,14 @@ > memcpy(NewConstraint+2, reg_names[RegNum], RegNameLen); > NewConstraint[RegNameLen+2] = '}'; > NewConstraint[RegNameLen+3] = 0; > - Constraint = NewConstraint; > + SimplifiedConstraint = NewConstraint; > } > + } else { > + // If we can simplify the constraint into something else, do so now. This > + // avoids LLVM having to know about all the (redundant) GCC constraints. > + SimplifiedConstraint = CanonicalizeConstraint(Constraint+1); > } > > - // If we can simplify the constraint into something else, do so now. This > - // avoids LLVM having to know about all the (redundant) GCC constraints. > - std::string SimplifiedConstraint = CanonicalizeConstraint(Constraint+1); > - > LValue Dest = EmitLV(Operand); > const Type *DestValTy = > cast(Dest.Ptr->getType())->getElementType(); > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From lattner at apple.com Mon Oct 29 13:05:38 2007 From: lattner at apple.com (Tanya Lattner) Date: Mon, 29 Oct 2007 11:05:38 -0700 Subject: [llvm-commits] llvm-gcc4.0 build broken Message-ID: I'm currently getting this build error: gcc -c -g -O2 -DIN_GCC -W -Wall -Wwrite-strings -Wstrict- prototypes -Wmissing-prototypes -pedantic -Wno-long-long -Wno- variadic-macros -Wold-style-definition -fno-common -mdynamic-no-pic - DHAVE_CONFIG_H -DENABLE_LLVM -I/Users/lattner/work/llvm/include - D_DEBUG -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -I. -I. -I../../src/ gcc -I../../src/gcc/. -I../../src/gcc/../include -I./../intl -I../../ src/gcc/../libcpp/include -I/Users/lattner/work/llvm/include -I/ Users/lattner/work/llvm/include ../../src/gcc/gimplify.c -o gimplify.o Instructions.cpp:206: failed assertion `(NumParams == FTy- >getNumParams() || (FTy->isVarArg() && NumParams > FTy->getNumParams ())) && "Calling a function with bad signature!"' ../../src/gcc/gimplify.c: In function 'gimplify_expr': ../../src/gcc/gimplify.c:3817: internal compiler error: Abort trap Please submit a full bug report, I've been trying to pinpoint what patch broken the build but have not been successful yet. I suspect its something between Friday and today since I think I last updated and built successfully then. -Tanya From dalej at apple.com Mon Oct 29 13:22:06 2007 From: dalej at apple.com (Dale Johannesen) Date: Mon, 29 Oct 2007 18:22:06 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r43456 - /llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp Message-ID: <200710291822.l9TIM64X026140@zion.cs.uiuc.edu> Author: johannes Date: Mon Oct 29 13:22:05 2007 New Revision: 43456 URL: http://llvm.org/viewvc/llvm-project?rev=43456&view=rev Log: Fix bug in 43378. Modified: llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp Modified: llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp?rev=43456&r1=43455&r2=43456&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp Mon Oct 29 13:22:05 2007 @@ -3977,11 +3977,13 @@ NewConstraint[RegNameLen+2] = '}'; NewConstraint[RegNameLen+3] = 0; SimplifiedConstraint = NewConstraint; + } else { + // If we can simplify the constraint into something else, do so now. This + // avoids LLVM having to know about all the (redundant) GCC constraints. + SimplifiedConstraint = CanonicalizeConstraint(Constraint+1); } } else { - // If we can simplify the constraint into something else, do so now. This - // avoids LLVM having to know about all the (redundant) GCC constraints. - SimplifiedConstraint = CanonicalizeConstraint(Constraint+1); + SimplifiedConstraint = CanonicalizeConstraint(Constraint+1); } LValue Dest = EmitLV(Operand); From asl at math.spbu.ru Mon Oct 29 13:14:15 2007 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Mon, 29 Oct 2007 21:14:15 +0300 Subject: [llvm-commits] Warnings in llvm Message-ID: <1193681655.30755.16.camel@asl.dorms.spbu.ru> Ted, I'm getting the following warning on TOT: /home/asl/proj/llvm/src/lib/Bitcode/Reader/Deserialize.cpp: In member function `void llvm::Deserializer::ReadUIntPtr(uintptr_t&)': /home/asl/proj/llvm/src/lib/Bitcode/Reader/Deserialize.cpp:111: warning: converting to non-pointer type `unsigned int' from NULL -- With best regards, Anton Korobeynikov. Faculty of Mathematics & Mechanics, Saint Petersburg State University. From dalej at apple.com Mon Oct 29 13:26:54 2007 From: dalej at apple.com (Dale Johannesen) Date: Mon, 29 Oct 2007 18:26:54 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r43457 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Message-ID: <200710291826.l9TIQtbe026493@zion.cs.uiuc.edu> Author: johannes Date: Mon Oct 29 13:26:54 2007 New Revision: 43457 URL: http://llvm.org/viewvc/llvm-project?rev=43457&view=rev Log: Fix bug in 43378. Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=43457&r1=43456&r2=43457&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Mon Oct 29 13:26:54 2007 @@ -3541,11 +3541,13 @@ NewConstraint[RegNameLen+2] = '}'; NewConstraint[RegNameLen+3] = 0; SimplifiedConstraint = NewConstraint; + } else { + // If we can simplify the constraint into something else, do so now. This + // avoids LLVM having to know about all the (redundant) GCC constraints. + SimplifiedConstraint = CanonicalizeConstraint(Constraint+1); } } else { - // If we can simplify the constraint into something else, do so now. This - // avoids LLVM having to know about all the (redundant) GCC constraints. - SimplifiedConstraint = CanonicalizeConstraint(Constraint+1); + SimplifiedConstraint = CanonicalizeConstraint(Constraint+1); } LValue Dest = EmitLV(Operand); From dalej at apple.com Mon Oct 29 13:30:35 2007 From: dalej at apple.com (Dale Johannesen) Date: Mon, 29 Oct 2007 11:30:35 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r43378 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: <9c10c9f0710291055n25ca7edeu1efd5a0dc6701da5@mail.gmail.com> References: <200710260329.l9Q3TumG032245@zion.cs.uiuc.edu> <9c10c9f0710291055n25ca7edeu1efd5a0dc6701da5@mail.gmail.com> Message-ID: On Oct 29, 2007, at 10:55 AM, Lauro Ramos Venancio wrote: > Hi Dale, > > This patch broke the llvm-gcc compilation for arm-linux. > > Lauro Fixed, sorry. From dalej at apple.com Mon Oct 29 13:33:25 2007 From: dalej at apple.com (Dale Johannesen) Date: Mon, 29 Oct 2007 18:33:25 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r43458 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Message-ID: <200710291833.l9TIXPsS026729@zion.cs.uiuc.edu> Author: johannes Date: Mon Oct 29 13:33:25 2007 New Revision: 43458 URL: http://llvm.org/viewvc/llvm-project?rev=43458&view=rev Log: Eliminate annoying warning. Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=43458&r1=43457&r2=43458&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Mon Oct 29 13:33:25 2007 @@ -5871,7 +5871,13 @@ // The lvalue is just the address. return Convert(TREE_OPERAND(exp, 0)); case COMPOUND_LITERAL_EXPR: // FIXME: not gimple - defined by C front-end - return EmitLV(COMPOUND_LITERAL_EXPR_DECL(exp)); + /* This used to read + return EmitLV(COMPOUND_LITERAL_EXPR_DECL(exp)); + but gcc warns about that and there doesn't seem to be any way to stop it + with casts or the like. The following is equivalent with no checking + (since we know TREE_CODE(exp) is COMPOUND_LITERAL_EXPR the checking + doesn't accomplish anything anyway). */ + return EmitLV(DECL_EXPR_DECL (TREE_OPERAND (exp, 0))); } } From kremenek at apple.com Mon Oct 29 13:43:39 2007 From: kremenek at apple.com (Ted Kremenek) Date: Mon, 29 Oct 2007 18:43:39 -0000 Subject: [llvm-commits] [llvm] r43459 - /llvm/trunk/lib/Bitcode/Reader/Deserialize.cpp Message-ID: <200710291843.l9TIhd6W027350@zion.cs.uiuc.edu> Author: kremenek Date: Mon Oct 29 13:43:39 2007 New Revision: 43459 URL: http://llvm.org/viewvc/llvm-project?rev=43459&view=rev Log: Fixed warning concerning implicit conversion from a NULL pointer constant to an unsigned int. We now just directly assign the literal 0. Modified: llvm/trunk/lib/Bitcode/Reader/Deserialize.cpp Modified: llvm/trunk/lib/Bitcode/Reader/Deserialize.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/Deserialize.cpp?rev=43459&r1=43458&r2=43459&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Reader/Deserialize.cpp (original) +++ llvm/trunk/lib/Bitcode/Reader/Deserialize.cpp Mon Oct 29 13:43:39 2007 @@ -108,7 +108,7 @@ unsigned PtrId = ReadInt(); if (PtrId == 0) { - PtrRef = NULL; + PtrRef = 0; return; } From djg at cray.com Mon Oct 29 14:23:54 2007 From: djg at cray.com (Dan Gohman) Date: Mon, 29 Oct 2007 19:23:54 -0000 Subject: [llvm-commits] [llvm] r43460 - /llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Message-ID: <200710291923.l9TJNsVj029580@zion.cs.uiuc.edu> Author: djg Date: Mon Oct 29 14:23:53 2007 New Revision: 43460 URL: http://llvm.org/viewvc/llvm-project?rev=43460&view=rev Log: Avoid calling ValidStride when not all uses are addresses. Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=43460&r1=43459&r2=43460&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Mon Oct 29 14:23:53 2007 @@ -1013,15 +1013,14 @@ (unsigned(abs(SInt)) < SSInt || (SInt % SSInt) != 0)) continue; int64_t Scale = SInt / SSInt; - // When scale is 1, we don't need to worry about whether the - // multiplication can be folded into the addressing mode. - if (!AllUsesAreAddresses && Scale != 1) - continue; // Check that this stride is valid for all the types used for loads and // stores; if it can be used for some and not others, we might as well use // the original stride everywhere, since we have to create the IV for it - // anyway. - if (ValidStride(HasBaseReg, Scale, UsersToProcess)) + // anyway. If the scale is 1, then we don't need to worry about folding + // multiplications. + if (Scale == 1 || + (AllUsesAreAddresses && + ValidStride(HasBaseReg, Scale, UsersToProcess))) for (std::vector::iterator II = SI->second.IVs.begin(), IE = SI->second.IVs.end(); II != IE; ++II) // FIXME: Only handle base == 0 for now. From djg at cray.com Mon Oct 29 14:26:15 2007 From: djg at cray.com (Dan Gohman) Date: Mon, 29 Oct 2007 19:26:15 -0000 Subject: [llvm-commits] [llvm] r43461 - /llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Message-ID: <200710291926.l9TJQGk6029775@zion.cs.uiuc.edu> Author: djg Date: Mon Oct 29 14:26:14 2007 New Revision: 43461 URL: http://llvm.org/viewvc/llvm-project?rev=43461&view=rev Log: Fix a typo in a comment. Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=43461&r1=43460&r2=43461&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Mon Oct 29 14:26:14 2007 @@ -1690,7 +1690,7 @@ // Note: this processes each stride/type pair individually. All users passed // into StrengthReduceStridedIVUsers have the same type AND stride. Also, - // node that we iterate over IVUsesByStride indirectly by using StrideOrder. + // note that we iterate over IVUsesByStride indirectly by using StrideOrder. // This extra layer of indirection makes the ordering of strides deterministic // - not dependent on map order. for (unsigned Stride = 0, e = StrideOrder.size(); Stride != e; ++Stride) { From djg at cray.com Mon Oct 29 14:31:25 2007 From: djg at cray.com (Dan Gohman) Date: Mon, 29 Oct 2007 19:31:25 -0000 Subject: [llvm-commits] [llvm] r43462 - /llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Message-ID: <200710291931.l9TJVPvj029988@zion.cs.uiuc.edu> Author: djg Date: Mon Oct 29 14:31:25 2007 New Revision: 43462 URL: http://llvm.org/viewvc/llvm-project?rev=43462&view=rev Log: Remove an unused function argument. Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=43462&r1=43461&r2=43462&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Mon Oct 29 14:31:25 2007 @@ -171,7 +171,7 @@ private: bool AddUsersIfInteresting(Instruction *I, Loop *L, SmallPtrSet &Processed); - SCEVHandle GetExpressionSCEV(Instruction *E, Loop *L); + SCEVHandle GetExpressionSCEV(Instruction *E); ICmpInst *ChangeCompareStride(Loop *L, ICmpInst *Cond, IVStrideUse* &CondUse, const SCEVHandle* &CondStride); @@ -242,13 +242,13 @@ /// GetExpressionSCEV - Compute and return the SCEV for the specified /// instruction. -SCEVHandle LoopStrengthReduce::GetExpressionSCEV(Instruction *Exp, Loop *L) { +SCEVHandle LoopStrengthReduce::GetExpressionSCEV(Instruction *Exp) { // Pointer to pointer bitcast instructions return the same value as their // operand. if (BitCastInst *BCI = dyn_cast(Exp)) { if (SE->hasSCEV(BCI) || !isa(BCI->getOperand(0))) return SE->getSCEV(BCI); - SCEVHandle R = GetExpressionSCEV(cast(BCI->getOperand(0)), L); + SCEVHandle R = GetExpressionSCEV(cast(BCI->getOperand(0))); SE->setSCEV(BCI, R); return R; } @@ -262,8 +262,8 @@ return SE->getSCEV(Exp); // Analyze all of the subscripts of this getelementptr instruction, looking - // for uses that are determined by the trip count of L. First, skip all - // operands the are not dependent on the IV. + // for uses that are determined by the trip count of the loop. First, skip + // all operands the are not dependent on the IV. // Build up the base expression. Insert an LLVM cast of the pointer to // uintptr_t first. @@ -417,7 +417,7 @@ return true; // Instruction already handled. // Get the symbolic expression for this instruction. - SCEVHandle ISE = GetExpressionSCEV(I, L); + SCEVHandle ISE = GetExpressionSCEV(I); if (isa(ISE)) return false; // Get the start and stride for this expression. From djg at cray.com Mon Oct 29 14:32:39 2007 From: djg at cray.com (Dan Gohman) Date: Mon, 29 Oct 2007 19:32:39 -0000 Subject: [llvm-commits] [llvm] r43463 - /llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Message-ID: <200710291932.l9TJWdYs030044@zion.cs.uiuc.edu> Author: djg Date: Mon Oct 29 14:32:39 2007 New Revision: 43463 URL: http://llvm.org/viewvc/llvm-project?rev=43463&view=rev Log: Update a comment to reflect the current code. Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=43463&r1=43462&r2=43463&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Mon Oct 29 14:32:39 2007 @@ -51,8 +51,8 @@ /// IVStrideUse - Keep track of one use of a strided induction variable, where /// the stride is stored externally. The Offset member keeps track of the - /// offset from the IV, User is the actual user of the operand, and 'Operand' - /// is the operand # of the User that is the use. + /// offset from the IV, User is the actual user of the operand, and + /// 'OperandValToReplace' is the operand of the User that is the use. struct VISIBILITY_HIDDEN IVStrideUse { SCEVHandle Offset; Instruction *User; From lattner at apple.com Mon Oct 29 14:40:56 2007 From: lattner at apple.com (Tanya Lattner) Date: Mon, 29 Oct 2007 12:40:56 -0700 Subject: [llvm-commits] llvm-gcc4.0 build broken In-Reply-To: References: Message-ID: <3EC85AE7-E98B-4059-8C57-6DC71A313052@apple.com> n/m. Just me. -Tanya On Oct 29, 2007, at 11:05 AM, Tanya Lattner wrote: > I'm currently getting this build error: > > gcc -c -g -O2 -DIN_GCC -W -Wall -Wwrite-strings -Wstrict- > prototypes -Wmissing-prototypes -pedantic -Wno-long-long -Wno- > variadic-macros -Wold-style-definition -fno-common -mdynamic-no-pic - > DHAVE_CONFIG_H -DENABLE_LLVM -I/Users/lattner/work/llvm/include - > D_DEBUG -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -I. -I. -I../../src/ > gcc -I../../src/gcc/. -I../../src/gcc/../include -I./../intl -I../../ > src/gcc/../libcpp/include -I/Users/lattner/work/llvm/include -I/ > Users/lattner/work/llvm/include ../../src/gcc/gimplify.c -o gimplify.o > Instructions.cpp:206: failed assertion `(NumParams == FTy- >> getNumParams() || (FTy->isVarArg() && NumParams > FTy->getNumParams > ())) && "Calling a function with bad signature!"' > ../../src/gcc/gimplify.c: In function 'gimplify_expr': > ../../src/gcc/gimplify.c:3817: internal compiler error: Abort trap > Please submit a full bug report, > > I've been trying to pinpoint what patch broken the build but have not > been successful yet. I suspect its something between Friday and today > since I think I last updated and built successfully then. > > > -Tanya > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From djg at cray.com Mon Oct 29 14:52:04 2007 From: djg at cray.com (Dan Gohman) Date: Mon, 29 Oct 2007 19:52:04 -0000 Subject: [llvm-commits] [llvm] r43464 - in /llvm/trunk: include/llvm/Analysis/AliasSetTracker.h lib/Analysis/ValueNumbering.cpp lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Message-ID: <200710291952.l9TJq4oL031021@zion.cs.uiuc.edu> Author: djg Date: Mon Oct 29 14:52:04 2007 New Revision: 43464 URL: http://llvm.org/viewvc/llvm-project?rev=43464&view=rev Log: Add explicit keywords. Modified: llvm/trunk/include/llvm/Analysis/AliasSetTracker.h llvm/trunk/lib/Analysis/ValueNumbering.cpp llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Modified: llvm/trunk/include/llvm/Analysis/AliasSetTracker.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/AliasSetTracker.h?rev=43464&r1=43463&r2=43464&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/AliasSetTracker.h (original) +++ llvm/trunk/include/llvm/Analysis/AliasSetTracker.h Mon Oct 29 14:52:04 2007 @@ -164,7 +164,7 @@ class iterator : public forward_iterator { HashNodePair *CurNode; public: - iterator(HashNodePair *CN = 0) : CurNode(CN) {} + explicit iterator(HashNodePair *CN = 0) : CurNode(CN) {} bool operator==(const iterator& x) const { return CurNode == x.CurNode; @@ -262,7 +262,7 @@ /// AliasSetTracker ctor - Create an empty collection of AliasSets, and use /// the specified alias analysis object to disambiguate load and store /// addresses. - AliasSetTracker(AliasAnalysis &aa) : AA(aa) {} + explicit AliasSetTracker(AliasAnalysis &aa) : AA(aa) {} /// add methods - These methods are used to add different types of /// instructions to the alias sets. Adding a new instruction can result in Modified: llvm/trunk/lib/Analysis/ValueNumbering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ValueNumbering.cpp?rev=43464&r1=43463&r2=43464&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ValueNumbering.cpp (original) +++ llvm/trunk/lib/Analysis/ValueNumbering.cpp Mon Oct 29 14:52:04 2007 @@ -78,7 +78,7 @@ /// struct VISIBILITY_HIDDEN BVNImpl : public InstVisitor { std::vector &RetVals; - BVNImpl(std::vector &RV) : RetVals(RV) {} + explicit BVNImpl(std::vector &RV) : RetVals(RV) {} void visitCastInst(CastInst &I); void visitGetElementPtrInst(GetElementPtrInst &I); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp?rev=43464&r1=43463&r2=43464&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Mon Oct 29 14:52:04 2007 @@ -99,7 +99,7 @@ SmallVector Worklist; public: - DAGTypeLegalizer(SelectionDAG &dag) + explicit DAGTypeLegalizer(SelectionDAG &dag) : TLI(dag.getTargetLoweringInfo()), DAG(dag), ValueTypeActions(TLI.getValueTypeActions()) { assert(MVT::LAST_VALUETYPE <= 32 && From evan.cheng at apple.com Mon Oct 29 14:58:20 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 29 Oct 2007 19:58:20 -0000 Subject: [llvm-commits] [llvm] r43465 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/DAGCombiner.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h test/CodeGen/X86/2007-10-29-ExtendSetCC.ll Message-ID: <200710291958.l9TJwLuB031417@zion.cs.uiuc.edu> Author: evancheng Date: Mon Oct 29 14:58:20 2007 New Revision: 43465 URL: http://llvm.org/viewvc/llvm-project?rev=43465&view=rev Log: Enable more fold (sext (load x)) -> (sext (truncate (sextload x))) transformation. Previously, it's restricted by ensuring the number of load uses is one. Now the restriction is loosened up by allowing setcc uses to be "extended" (e.g. setcc x, c, eq -> setcc sext(x), sext(c), eq). Added: llvm/trunk/test/CodeGen/X86/2007-10-29-ExtendSetCC.ll Modified: llvm/trunk/include/llvm/Target/TargetLowering.h llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.h Modified: llvm/trunk/include/llvm/Target/TargetLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=43465&r1=43464&r2=43465&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetLowering.h (original) +++ llvm/trunk/include/llvm/Target/TargetLowering.h Mon Oct 29 14:58:20 2007 @@ -1000,6 +1000,10 @@ virtual bool isTruncateFree(const Type *Ty1, const Type *Ty2) const { return false; } + + virtual bool isTruncateFree(MVT::ValueType VT1, MVT::ValueType VT2) const { + return false; + } //===--------------------------------------------------------------------===// // Div utility functions Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=43465&r1=43464&r2=43465&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Oct 29 14:58:20 2007 @@ -2497,6 +2497,74 @@ cast(N->getOperand(2))->get()); } +// ExtendUsesToFormExtLoad - Trying to extend uses of a load to enable this: +// "fold ({s|z}ext (load x)) -> ({s|z}ext (truncate ({s|z}extload x)))" +// transformation. Returns true if extension are possible and the above +// mentioned transformation is profitable. +static bool ExtendUsesToFormExtLoad(SDNode *N, SDOperand N0, + unsigned ExtOpc, + SmallVector &ExtendNodes, + TargetLowering &TLI) { + bool HasCopyToRegUses = false; + bool isTruncFree = TLI.isTruncateFree(N->getValueType(0), N0.getValueType()); + for (SDNode::use_iterator UI = N0.Val->use_begin(), UE = N0.Val->use_end(); + UI != UE; ++UI) { + SDNode *User = *UI; + if (User == N) + continue; + // FIXME: Only extend SETCC N, N and SETCC N, c for now. + if (User->getOpcode() == ISD::SETCC) { + ISD::CondCode CC = cast(User->getOperand(2))->get(); + if (ExtOpc == ISD::ZERO_EXTEND && ISD::isSignedIntSetCC(CC)) + // Sign bits will be lost after a zext. + return false; + bool Add = false; + for (unsigned i = 0; i != 2; ++i) { + SDOperand UseOp = User->getOperand(i); + if (UseOp == N0) + continue; + if (!isa(UseOp)) + return false; + Add = true; + } + if (Add) + ExtendNodes.push_back(User); + } else { + for (unsigned i = 0, e = User->getNumOperands(); i != e; ++i) { + SDOperand UseOp = User->getOperand(i); + if (UseOp == N0) { + // If truncate from extended type to original load type is free + // on this target, then it's ok to extend a CopyToReg. + if (isTruncFree && User->getOpcode() == ISD::CopyToReg) + HasCopyToRegUses = true; + else + return false; + } + } + } + } + + if (HasCopyToRegUses) { + bool BothLiveOut = false; + for (SDNode::use_iterator UI = N->use_begin(), UE = N->use_end(); + UI != UE; ++UI) { + SDNode *User = *UI; + for (unsigned i = 0, e = User->getNumOperands(); i != e; ++i) { + SDOperand UseOp = User->getOperand(i); + if (UseOp.Val == N && UseOp.ResNo == 0) { + BothLiveOut = true; + break; + } + } + } + if (BothLiveOut) + // Both unextended and extended values are live out. There had better be + // good a reason for the transformation. + return ExtendNodes.size(); + } + return true; +} + SDOperand DAGCombiner::visitSIGN_EXTEND(SDNode *N) { SDOperand N0 = N->getOperand(0); MVT::ValueType VT = N->getValueType(0); @@ -2560,19 +2628,40 @@ } // fold (sext (load x)) -> (sext (truncate (sextload x))) - if (ISD::isNON_EXTLoad(N0.Val) && N0.hasOneUse() && + if (ISD::isNON_EXTLoad(N0.Val) && (!AfterLegalize||TLI.isLoadXLegal(ISD::SEXTLOAD, N0.getValueType()))){ - LoadSDNode *LN0 = cast(N0); - SDOperand ExtLoad = DAG.getExtLoad(ISD::SEXTLOAD, VT, LN0->getChain(), - LN0->getBasePtr(), LN0->getSrcValue(), - LN0->getSrcValueOffset(), - N0.getValueType(), - LN0->isVolatile(), - LN0->getAlignment()); - CombineTo(N, ExtLoad); - CombineTo(N0.Val, DAG.getNode(ISD::TRUNCATE, N0.getValueType(), ExtLoad), - ExtLoad.getValue(1)); - return SDOperand(N, 0); // Return N so it doesn't get rechecked! + bool DoXform = true; + SmallVector SetCCs; + if (!N0.hasOneUse()) + DoXform = ExtendUsesToFormExtLoad(N, N0, ISD::SIGN_EXTEND, SetCCs, TLI); + if (DoXform) { + LoadSDNode *LN0 = cast(N0); + SDOperand ExtLoad = DAG.getExtLoad(ISD::SEXTLOAD, VT, LN0->getChain(), + LN0->getBasePtr(), LN0->getSrcValue(), + LN0->getSrcValueOffset(), + N0.getValueType(), + LN0->isVolatile(), + LN0->getAlignment()); + CombineTo(N, ExtLoad); + SDOperand Trunc = DAG.getNode(ISD::TRUNCATE, N0.getValueType(), ExtLoad); + CombineTo(N0.Val, Trunc, ExtLoad.getValue(1)); + // Extend SetCC uses if necessary. + for (unsigned i = 0, e = SetCCs.size(); i != e; ++i) { + SDNode *SetCC = SetCCs[i]; + SmallVector Ops; + for (unsigned j = 0; j != 2; ++j) { + SDOperand SOp = SetCC->getOperand(j); + if (SOp == Trunc) + Ops.push_back(ExtLoad); + else + Ops.push_back(DAG.getNode(ISD::SIGN_EXTEND, VT, SOp)); + } + Ops.push_back(SetCC->getOperand(2)); + CombineTo(SetCC, DAG.getNode(ISD::SETCC, SetCC->getValueType(0), + &Ops[0], Ops.size())); + } + return SDOperand(N, 0); // Return N so it doesn't get rechecked! + } } // fold (sext (sextload x)) -> (sext (truncate (sextload x))) @@ -2656,19 +2745,40 @@ } // fold (zext (load x)) -> (zext (truncate (zextload x))) - if (ISD::isNON_EXTLoad(N0.Val) && N0.hasOneUse() && + if (ISD::isNON_EXTLoad(N0.Val) && (!AfterLegalize||TLI.isLoadXLegal(ISD::ZEXTLOAD, N0.getValueType()))) { - LoadSDNode *LN0 = cast(N0); - SDOperand ExtLoad = DAG.getExtLoad(ISD::ZEXTLOAD, VT, LN0->getChain(), - LN0->getBasePtr(), LN0->getSrcValue(), - LN0->getSrcValueOffset(), - N0.getValueType(), - LN0->isVolatile(), - LN0->getAlignment()); - CombineTo(N, ExtLoad); - CombineTo(N0.Val, DAG.getNode(ISD::TRUNCATE, N0.getValueType(), ExtLoad), - ExtLoad.getValue(1)); - return SDOperand(N, 0); // Return N so it doesn't get rechecked! + bool DoXform = true; + SmallVector SetCCs; + if (!N0.hasOneUse()) + DoXform = ExtendUsesToFormExtLoad(N, N0, ISD::ZERO_EXTEND, SetCCs, TLI); + if (DoXform) { + LoadSDNode *LN0 = cast(N0); + SDOperand ExtLoad = DAG.getExtLoad(ISD::ZEXTLOAD, VT, LN0->getChain(), + LN0->getBasePtr(), LN0->getSrcValue(), + LN0->getSrcValueOffset(), + N0.getValueType(), + LN0->isVolatile(), + LN0->getAlignment()); + CombineTo(N, ExtLoad); + SDOperand Trunc = DAG.getNode(ISD::TRUNCATE, N0.getValueType(), ExtLoad); + CombineTo(N0.Val, Trunc, ExtLoad.getValue(1)); + // Extend SetCC uses if necessary. + for (unsigned i = 0, e = SetCCs.size(); i != e; ++i) { + SDNode *SetCC = SetCCs[i]; + SmallVector Ops; + for (unsigned j = 0; j != 2; ++j) { + SDOperand SOp = SetCC->getOperand(j); + if (SOp == Trunc) + Ops.push_back(ExtLoad); + else + Ops.push_back(DAG.getNode(ISD::SIGN_EXTEND, VT, SOp)); + } + Ops.push_back(SetCC->getOperand(2)); + CombineTo(SetCC, DAG.getNode(ISD::SETCC, SetCC->getValueType(0), + &Ops[0], Ops.size())); + } + return SDOperand(N, 0); // Return N so it doesn't get rechecked! + } } // fold (zext (zextload x)) -> (zext (truncate (zextload x))) Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=43465&r1=43464&r2=43465&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Oct 29 14:58:20 2007 @@ -5132,6 +5132,16 @@ return Subtarget->is64Bit() || NumBits1 < 64; } +bool X86TargetLowering::isTruncateFree(MVT::ValueType VT1, + MVT::ValueType VT2) const { + if (!MVT::isInteger(VT1) || !MVT::isInteger(VT2)) + return false; + unsigned NumBits1 = MVT::getSizeInBits(VT1); + unsigned NumBits2 = MVT::getSizeInBits(VT2); + if (NumBits1 <= NumBits2) + return false; + return Subtarget->is64Bit() || NumBits1 < 64; +} /// isShuffleMaskLegal - Targets can use this to indicate that they only /// support *some* VECTOR_SHUFFLE operations, those with specific masks. Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.h?rev=43465&r1=43464&r2=43465&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.h (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.h Mon Oct 29 14:58:20 2007 @@ -363,6 +363,7 @@ /// type Ty1 to type Ty2. e.g. On x86 it's free to truncate a i32 value in /// register EAX to i16 by referencing its sub-register AX. virtual bool isTruncateFree(const Type *Ty1, const Type *Ty2) const; + virtual bool isTruncateFree(MVT::ValueType VT1, MVT::ValueType VT2) const; /// isShuffleMaskLegal - Targets can use this to indicate that they only /// support *some* VECTOR_SHUFFLE operations, those with specific masks. Added: llvm/trunk/test/CodeGen/X86/2007-10-29-ExtendSetCC.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2007-10-29-ExtendSetCC.ll?rev=43465&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/2007-10-29-ExtendSetCC.ll (added) +++ llvm/trunk/test/CodeGen/X86/2007-10-29-ExtendSetCC.ll Mon Oct 29 14:58:20 2007 @@ -0,0 +1,17 @@ +; RUN: llvm-as < %s | llc -march=x86 | grep mov | count 1 + +define i16 @t() signext { +entry: + %tmp180 = load i16* null, align 2 ; [#uses=3] + %tmp180181 = sext i16 %tmp180 to i32 ; [#uses=1] + %tmp185 = icmp slt i16 %tmp180, 0 ; [#uses=1] + br i1 %tmp185, label %cond_true188, label %cond_next245 + +cond_true188: ; preds = %entry + %tmp195196 = trunc i16 %tmp180 to i8 ; [#uses=0] + ret i16 0 + +cond_next245: ; preds = %entry + %tmp256 = and i32 %tmp180181, 15 ; [#uses=0] + ret i16 0 +} From djg at cray.com Mon Oct 29 15:14:29 2007 From: djg at cray.com (Dan Gohman) Date: Mon, 29 Oct 2007 20:14:29 -0000 Subject: [llvm-commits] [llvm] r43466 - /llvm/trunk/lib/Transforms/Scalar/LowerPacked.cpp Message-ID: <200710292014.l9TKEUgg032322@zion.cs.uiuc.edu> Author: djg Date: Mon Oct 29 15:14:29 2007 New Revision: 43466 URL: http://llvm.org/viewvc/llvm-project?rev=43466&view=rev Log: Do a real assert if there is an unhandled vector instruction instead of just printing to cerr. Modified: llvm/trunk/lib/Transforms/Scalar/LowerPacked.cpp Modified: llvm/trunk/lib/Transforms/Scalar/LowerPacked.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LowerPacked.cpp?rev=43466&r1=43465&r2=43466&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LowerPacked.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LowerPacked.cpp Mon Oct 29 15:14:29 2007 @@ -76,13 +76,13 @@ void visitInsertElementInst(InsertElementInst& IE); /// This function asserts if the instruction is a VectorType but - /// is handled by another function. + /// is not handled by another function. /// /// @brief Asserts if VectorType instruction is not handled elsewhere. /// @param I the unhandled instruction void visitInstruction(Instruction &I) { - if (isa(I.getType())) - cerr << "Unhandled Instruction with Packed ReturnType: " << I << '\n'; + assert(!isa(I.getType()) && + "Unhandled Instruction with Packed ReturnType!"); } private: /// @brief Retrieves lowered values for a packed value. From djg at cray.com Mon Oct 29 15:24:00 2007 From: djg at cray.com (Dan Gohman) Date: Mon, 29 Oct 2007 20:24:00 -0000 Subject: [llvm-commits] [llvm] r43467 - /llvm/trunk/lib/Transforms/Scalar/LowerPacked.cpp Message-ID: <200710292024.l9TKO0g7000498@zion.cs.uiuc.edu> Author: djg Date: Mon Oct 29 15:24:00 2007 New Revision: 43467 URL: http://llvm.org/viewvc/llvm-project?rev=43467&view=rev Log: Use an array instead of a fixed-length std::vector. Modified: llvm/trunk/lib/Transforms/Scalar/LowerPacked.cpp Modified: llvm/trunk/lib/Transforms/Scalar/LowerPacked.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LowerPacked.cpp?rev=43467&r1=43466&r2=43467&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LowerPacked.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LowerPacked.cpp Mon Oct 29 15:24:00 2007 @@ -22,6 +22,7 @@ #include "llvm/Support/Compiler.h" #include "llvm/Support/InstVisitor.h" #include "llvm/Support/Streams.h" +#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringExtras.h" #include #include @@ -75,8 +76,9 @@ /// @param IE the insertelement operator to convert void visitInsertElementInst(InsertElementInst& IE); - /// This function asserts if the instruction is a VectorType but - /// is not handled by another function. + /// This function asserts that the given instruction does not have + /// vector type. Instructions with vector type should be handled by + /// the other functions in this class. /// /// @brief Asserts if VectorType instruction is not handled elsewhere. /// @param I the unhandled instruction @@ -214,7 +216,7 @@ // Make sure what we are dealing with is a vector type if (const VectorType* PKT = dyn_cast(LI.getType())) { // Initialization, Idx is needed for getelementptr needed later - std::vector Idx(2); + Value *Idx[2]; Idx[0] = ConstantInt::get(Type::Int32Ty,0); ArrayType* AT = ArrayType::get(PKT->getContainedType(0), @@ -235,7 +237,7 @@ // Get the pointer Value* val = new GetElementPtrInst(array, - Idx.begin(), Idx.end(), + Idx, array_endof(Idx), LI.getName() + ".ge." + utostr(i), &LI); @@ -313,7 +315,7 @@ if (const VectorType* PKT = dyn_cast(SI.getOperand(0)->getType())) { // We will need this for getelementptr - std::vector Idx(2); + Value *Idx[2]; Idx[0] = ConstantInt::get(Type::Int32Ty,0); ArrayType* AT = ArrayType::get(PKT->getContainedType(0), @@ -333,7 +335,7 @@ // Generate the indices for getelementptr Idx[1] = ConstantInt::get(Type::Int32Ty,i); Value* val = new GetElementPtrInst(array, - Idx.begin(), Idx.end(), + Idx, array_endof(Idx), "store.ge." + utostr(i) + ".", &SI); From djg at cray.com Mon Oct 29 15:34:37 2007 From: djg at cray.com (Dan Gohman) Date: Mon, 29 Oct 2007 20:34:37 -0000 Subject: [llvm-commits] [llvm] r43468 - /llvm/trunk/lib/Transforms/Scalar/LowerPacked.cpp Message-ID: <200710292034.l9TKYbAn001117@zion.cs.uiuc.edu> Author: djg Date: Mon Oct 29 15:34:35 2007 New Revision: 43468 URL: http://llvm.org/viewvc/llvm-project?rev=43468&view=rev Log: Don't bitcast from pointer-to-vector to pointer-to-array when lowering load and store instructions. Modified: llvm/trunk/lib/Transforms/Scalar/LowerPacked.cpp Modified: llvm/trunk/lib/Transforms/Scalar/LowerPacked.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LowerPacked.cpp?rev=43468&r1=43467&r2=43468&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LowerPacked.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LowerPacked.cpp Mon Oct 29 15:34:35 2007 @@ -217,15 +217,7 @@ if (const VectorType* PKT = dyn_cast(LI.getType())) { // Initialization, Idx is needed for getelementptr needed later Value *Idx[2]; - Idx[0] = ConstantInt::get(Type::Int32Ty,0); - - ArrayType* AT = ArrayType::get(PKT->getContainedType(0), - PKT->getNumElements()); - PointerType* APT = PointerType::get(AT); - - // Cast the pointer to vector type to an equivalent array - Value* array = new BitCastInst(LI.getPointerOperand(), APT, - LI.getName() + ".a", &LI); + Idx[0] = ConstantInt::get(Type::Int32Ty, 0); // Convert this load into num elements number of loads std::vector values; @@ -236,7 +228,7 @@ Idx[1] = ConstantInt::get(Type::Int32Ty,i); // Get the pointer - Value* val = new GetElementPtrInst(array, + Value* val = new GetElementPtrInst(LI.getPointerOperand(), Idx, array_endof(Idx), LI.getName() + ".ge." + utostr(i), @@ -316,15 +308,7 @@ dyn_cast(SI.getOperand(0)->getType())) { // We will need this for getelementptr Value *Idx[2]; - Idx[0] = ConstantInt::get(Type::Int32Ty,0); - - ArrayType* AT = ArrayType::get(PKT->getContainedType(0), - PKT->getNumElements()); - PointerType* APT = PointerType::get(AT); - - // Cast the pointer to packed to an array of equivalent type - Value* array = new BitCastInst(SI.getPointerOperand(), APT, - "store.ge.a.", &SI); + Idx[0] = ConstantInt::get(Type::Int32Ty, 0); std::vector& values = getValues(SI.getOperand(0)); @@ -334,7 +318,7 @@ for (unsigned i = 0, e = PKT->getNumElements(); i != e; ++i) { // Generate the indices for getelementptr Idx[1] = ConstantInt::get(Type::Int32Ty,i); - Value* val = new GetElementPtrInst(array, + Value* val = new GetElementPtrInst(SI.getPointerOperand(), Idx, array_endof(Idx), "store.ge." + utostr(i) + ".", From djg at cray.com Mon Oct 29 15:44:42 2007 From: djg at cray.com (Dan Gohman) Date: Mon, 29 Oct 2007 20:44:42 -0000 Subject: [llvm-commits] [llvm] r43470 - in /llvm/trunk: lib/CodeGen/SelectionDAG/DAGCombiner.cpp test/CodeGen/X86/bitcast-int-to-vector.ll Message-ID: <200710292044.l9TKig5U001620@zion.cs.uiuc.edu> Author: djg Date: Mon Oct 29 15:44:42 2007 New Revision: 43470 URL: http://llvm.org/viewvc/llvm-project?rev=43470&view=rev Log: Fix a DAGCombiner abort on a bitcast from a scalar to a vector. Added: llvm/trunk/test/CodeGen/X86/bitcast-int-to-vector.ll Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=43470&r1=43469&r2=43470&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Oct 29 15:44:42 2007 @@ -4212,7 +4212,8 @@ unsigned NumElts = MVT::getVectorNumElements(VT); if (InVec.getOpcode() == ISD::BIT_CONVERT) { MVT::ValueType BCVT = InVec.getOperand(0).getValueType(); - if (NumElts != MVT::getVectorNumElements(BCVT)) + if (!MVT::isVector(BCVT) || + NumElts != MVT::getVectorNumElements(BCVT)) return SDOperand(); InVec = InVec.getOperand(0); EVT = MVT::getVectorElementType(BCVT); Added: llvm/trunk/test/CodeGen/X86/bitcast-int-to-vector.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/bitcast-int-to-vector.ll?rev=43470&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/bitcast-int-to-vector.ll (added) +++ llvm/trunk/test/CodeGen/X86/bitcast-int-to-vector.ll Mon Oct 29 15:44:42 2007 @@ -0,0 +1,10 @@ +; RUN: llvm-as < %s | llc -march=x86 + +define i1 @foo(i64 %a) +{ + %t = bitcast i64 %a to <2 x float> + %r = extractelement <2 x float> %t, i32 0 + %s = extractelement <2 x float> %t, i32 1 + %b = fcmp uno float %r, %s + ret i1 %b +} From hartmut.kaiser at gmail.com Mon Oct 29 16:56:15 2007 From: hartmut.kaiser at gmail.com (Hartmut Kaiser) Date: Mon, 29 Oct 2007 21:56:15 -0000 Subject: [llvm-commits] [llvm] r43479 - in /llvm/trunk/win32: Bitcode/Bitcode.vcproj CodeGen/CodeGen.vcproj Support/Support.vcproj Message-ID: <200710292156.l9TLuFTf005276@zion.cs.uiuc.edu> Author: hkaiser Date: Mon Oct 29 16:56:15 2007 New Revision: 43479 URL: http://llvm.org/viewvc/llvm-project?rev=43479&view=rev Log: Updated VC++ build system Modified: llvm/trunk/win32/Bitcode/Bitcode.vcproj llvm/trunk/win32/CodeGen/CodeGen.vcproj llvm/trunk/win32/Support/Support.vcproj Modified: llvm/trunk/win32/Bitcode/Bitcode.vcproj URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/win32/Bitcode/Bitcode.vcproj?rev=43479&r1=43478&r2=43479&view=diff ============================================================================== --- llvm/trunk/win32/Bitcode/Bitcode.vcproj (original) +++ llvm/trunk/win32/Bitcode/Bitcode.vcproj Mon Oct 29 16:56:15 2007 @@ -176,6 +176,10 @@ RelativePath="..\..\lib\Bitcode\Reader\Deserialize.cpp" > + + + + Modified: llvm/trunk/win32/CodeGen/CodeGen.vcproj URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/win32/CodeGen/CodeGen.vcproj?rev=43479&r1=43478&r2=43479&view=diff ============================================================================== --- llvm/trunk/win32/CodeGen/CodeGen.vcproj (original) +++ llvm/trunk/win32/CodeGen/CodeGen.vcproj Mon Oct 29 16:56:15 2007 @@ -416,6 +416,10 @@ > + + Modified: llvm/trunk/win32/Support/Support.vcproj URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/win32/Support/Support.vcproj?rev=43479&r1=43478&r2=43479&view=diff ============================================================================== --- llvm/trunk/win32/Support/Support.vcproj (original) +++ llvm/trunk/win32/Support/Support.vcproj Mon Oct 29 16:56:15 2007 @@ -276,6 +276,10 @@ > + + From evan.cheng at apple.com Mon Oct 29 17:07:18 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 29 Oct 2007 22:07:18 -0000 Subject: [llvm-commits] [llvm] r43480 - in /llvm/trunk: lib/Transforms/Scalar/LoopStrengthReduce.cpp test/CodeGen/X86/loop-strength-reduce6.ll Message-ID: <200710292207.l9TM7IaQ005784@zion.cs.uiuc.edu> Author: evancheng Date: Mon Oct 29 17:07:18 2007 New Revision: 43480 URL: http://llvm.org/viewvc/llvm-project?rev=43480&view=rev Log: - Bug fixes. - Allow icmp rewrite using an iv / stride of a smaller integer type. Added: llvm/trunk/test/CodeGen/X86/loop-strength-reduce6.ll Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=43480&r1=43479&r2=43480&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Mon Oct 29 17:07:18 2007 @@ -1476,6 +1476,8 @@ uint64_t SignBit = 1ULL << (BitWidth-1); const Type *CmpTy = C->getType(); const Type *NewCmpTy = NULL; + unsigned TyBits = CmpTy->getPrimitiveSizeInBits(); + unsigned NewTyBits = 0; int64_t NewCmpVal = CmpVal; SCEVHandle *NewStride = NULL; Value *NewIncV = NULL; @@ -1521,7 +1523,31 @@ } NewCmpTy = NewIncV->getType(); - if (RequiresTypeConversion(CmpTy, NewCmpTy)) { + NewTyBits = isa(NewCmpTy) + ? UIntPtrTy->getPrimitiveSizeInBits() + : NewCmpTy->getPrimitiveSizeInBits(); + if (RequiresTypeConversion(NewCmpTy, CmpTy)) { + // Check if it is possible to rewrite it using a iv / stride of a smaller + // integer type. + bool TruncOk = false; + if (NewCmpTy->isInteger()) { + unsigned Bits = NewTyBits; + if (ICmpInst::isSignedPredicate(Predicate)) + --Bits; + uint64_t Mask = (1ULL << Bits) - 1; + if (((uint64_t)NewCmpVal & Mask) == (uint64_t)NewCmpVal) + TruncOk = true; + } + if (!TruncOk) { + NewCmpVal = CmpVal; + continue; + } + } + + // Don't rewrite if use offset is non-constant and the new type is + // of a different type. + // FIXME: too conservative? + if (NewTyBits != TyBits && !isa(CondUse->Offset)) { NewCmpVal = CmpVal; continue; } @@ -1552,13 +1578,12 @@ if (NewCmpVal != CmpVal) { // Create a new compare instruction using new stride / iv. ICmpInst *OldCond = Cond; - Value *RHS = ConstantInt::get(C->getType(), NewCmpVal); - // Both sides of a ICmpInst must be of the same type. - if (NewCmpTy != CmpTy) { - if (isa(NewCmpTy) && !isa(CmpTy)) - RHS= SCEVExpander::InsertCastOfTo(Instruction::IntToPtr, RHS, NewCmpTy); - else - RHS = SCEVExpander::InsertCastOfTo(Instruction::BitCast, RHS, NewCmpTy); + Value *RHS; + if (!isa(NewCmpTy)) + RHS = ConstantInt::get(NewCmpTy, NewCmpVal); + else { + RHS = ConstantInt::get(UIntPtrTy, NewCmpVal); + RHS = SCEVExpander::InsertCastOfTo(Instruction::IntToPtr, RHS, NewCmpTy); } // Insert new compare instruction. Cond = new ICmpInst(Predicate, NewIncV, RHS); @@ -1572,8 +1597,11 @@ OldCond->eraseFromParent(); IVUsesByStride[*CondStride].Users.pop_back(); - SCEVHandle NewOffset = SE->getMulExpr(CondUse->Offset, - SE->getConstant(ConstantInt::get(CondUse->Offset->getType(), Scale))); + SCEVHandle NewOffset = TyBits == NewTyBits + ? SE->getMulExpr(CondUse->Offset, + SE->getConstant(ConstantInt::get(CmpTy, Scale))) + : SE->getConstant(ConstantInt::get(NewCmpTy, + cast(CondUse->Offset)->getValue()->getSExtValue()*Scale)); IVUsesByStride[*NewStride].addUser(NewOffset, Cond, NewIncV); CondUse = &IVUsesByStride[*NewStride].Users.back(); CondStride = NewStride; Added: llvm/trunk/test/CodeGen/X86/loop-strength-reduce6.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/loop-strength-reduce6.ll?rev=43480&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/loop-strength-reduce6.ll (added) +++ llvm/trunk/test/CodeGen/X86/loop-strength-reduce6.ll Mon Oct 29 17:07:18 2007 @@ -0,0 +1,66 @@ +; RUN: llvm-as < %s | llc -march=x86-64 | not grep inc + +define fastcc i32 @decodeMP3(i32 %isize, i32* %done) { +entry: + br i1 false, label %cond_next191, label %cond_true189 + +cond_true189: ; preds = %entry + ret i32 0 + +cond_next191: ; preds = %entry + br i1 false, label %cond_next37.i, label %cond_false.i9 + +cond_false.i9: ; preds = %cond_next191 + ret i32 0 + +cond_next37.i: ; preds = %cond_next191 + br i1 false, label %cond_false50.i, label %cond_true44.i + +cond_true44.i: ; preds = %cond_next37.i + br i1 false, label %cond_true11.i.i, label %bb414.preheader.i + +cond_true11.i.i: ; preds = %cond_true44.i + ret i32 0 + +cond_false50.i: ; preds = %cond_next37.i + ret i32 0 + +bb414.preheader.i: ; preds = %cond_true44.i + br i1 false, label %bb.i18, label %do_layer3.exit + +bb.i18: ; preds = %bb414.preheader.i + br i1 false, label %bb358.i, label %cond_true79.i + +cond_true79.i: ; preds = %bb.i18 + ret i32 0 + +bb331.i: ; preds = %bb358.i, %cond_true.i149.i + br i1 false, label %cond_true.i149.i, label %cond_false.i151.i + +cond_true.i149.i: ; preds = %bb331.i + br i1 false, label %bb178.preheader.i.i, label %bb331.i + +cond_false.i151.i: ; preds = %bb331.i + ret i32 0 + +bb163.i.i: ; preds = %bb178.preheader.i.i, %bb163.i.i + %rawout2.451.rec.i.i = phi i64 [ 0, %bb178.preheader.i.i ], [ %indvar.next260.i, %bb163.i.i ] ; [#uses=2] + %i.052.i.i = trunc i64 %rawout2.451.rec.i.i to i32 ; [#uses=1] + %tmp165.i144.i = shl i32 %i.052.i.i, 5 ; [#uses=1] + %tmp165169.i.i = sext i32 %tmp165.i144.i to i64 ; [#uses=0] + %indvar.next260.i = add i64 %rawout2.451.rec.i.i, 1 ; [#uses=2] + %exitcond261.i = icmp eq i64 %indvar.next260.i, 18 ; [#uses=1] + br i1 %exitcond261.i, label %bb178.preheader.i.i, label %bb163.i.i + +bb178.preheader.i.i: ; preds = %bb163.i.i, %cond_true.i149.i + br label %bb163.i.i + +bb358.i: ; preds = %bb.i18 + br i1 false, label %bb331.i, label %bb406.i + +bb406.i: ; preds = %bb358.i + ret i32 0 + +do_layer3.exit: ; preds = %bb414.preheader.i + ret i32 0 +} From dpatel at apple.com Mon Oct 29 18:53:12 2007 From: dpatel at apple.com (Devang Patel) Date: Mon, 29 Oct 2007 23:53:12 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r43483 - /llvm-gcc-4.0/trunk/gcc/objc/objc-act.c Message-ID: <200710292353.l9TNrDn1012888@zion.cs.uiuc.edu> Author: dpatel Date: Mon Oct 29 18:53:11 2007 New Revision: 43483 URL: http://llvm.org/viewvc/llvm-project?rev=43483&view=rev Log: Really detect array reference. Modified: llvm-gcc-4.0/trunk/gcc/objc/objc-act.c Modified: llvm-gcc-4.0/trunk/gcc/objc/objc-act.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/objc/objc-act.c?rev=43483&r1=43482&r2=43483&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/objc/objc-act.c (original) +++ llvm-gcc-4.0/trunk/gcc/objc/objc-act.c Mon Oct 29 18:53:11 2007 @@ -6875,10 +6875,39 @@ } /* APPLE LOCAL end radar 4591756 */ +/* LLVM LOCAL begin LLVM */ +/* llvm-gcc intentionally preserver array notation &array[i] and avoid + pointer arithmetic. + Example 1: struct { int *a; } b; b->a[2] = 42; + Example 2: struct { int a[42]; } b; b->a[2] = 42. + In both of this cases, expr is preserved as ARRAY_REF. Normally, gcc + would decomponse first example into a pointer arithmetic expression. + So in llvm mode, check expression's field type to ensure that this is really a + array reference or not. */ +static int objc_is_really_array_ref(tree expr) { + tree component = NULL_TREE; + tree field = NULL_TREE; + + if (TREE_CODE(expr) != ARRAY_REF) + return 0; + + component = TREE_OPERAND(expr, 0); + if (!component || TREE_CODE(component) != COMPONENT_REF) + return 0; + + field = TREE_OPERAND(component, 1); + if (!field || TREE_CODE(TREE_TYPE(field)) != ARRAY_TYPE) + return 0; + + return 1; +} +/* LLVM LOCAL end LLVM */ + static int objc_is_ivar_reference_p (tree expr) { - return (TREE_CODE (expr) == ARRAY_REF + /* LLVM LOCAL pointer arithmetic */ + return (objc_is_really_array_ref(expr) == 1 ? objc_is_ivar_reference_p (TREE_OPERAND (expr, 0)) : TREE_CODE (expr) == COMPONENT_REF ? TREE_CODE (TREE_OPERAND (expr, 1)) == FIELD_DECL From dpatel at apple.com Mon Oct 29 19:10:50 2007 From: dpatel at apple.com (Devang Patel) Date: Tue, 30 Oct 2007 00:10:50 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r43486 - /llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Message-ID: <200710300010.l9U0AoYE015041@zion.cs.uiuc.edu> Author: dpatel Date: Mon Oct 29 19:10:50 2007 New Revision: 43486 URL: http://llvm.org/viewvc/llvm-project?rev=43486&view=rev Log: Really detect array ref. Modified: llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Modified: llvm-gcc-4.2/trunk/gcc/objc/objc-act.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/objc/objc-act.c?rev=43486&r1=43485&r2=43486&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/objc/objc-act.c (original) +++ llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Mon Oct 29 19:10:50 2007 @@ -6741,10 +6741,39 @@ } /* APPLE LOCAL end radar 4591756 */ +/* LLVM LOCAL begin LLVM */ +/* llvm-gcc intentionally preserver array notation &array[i] and avoid + pointer arithmetic. + Example 1: struct { int *a; } b; b->a[2] = 42; + Example 2: struct { int a[42]; } b; b->a[2] = 42. + In both of this cases, expr is preserved as ARRAY_REF. Normally, gcc + would decomponse first example into a pointer arithmetic expression. + So in llvm mode, check expression's field type to ensure that this is really a + array reference or not. */ +static int objc_is_really_array_ref(tree expr) { + tree component = NULL_TREE; + tree field = NULL_TREE; + + if (TREE_CODE(expr) != ARRAY_REF) + return 0; + + component = TREE_OPERAND(expr, 0); + if (!component || TREE_CODE(component) != COMPONENT_REF) + return 0; + + field = TREE_OPERAND(component, 1); + if (!field || TREE_CODE(TREE_TYPE(field)) != ARRAY_TYPE) + return 0; + + return 1; +} +/* LLVM LOCAL end LLVM */ + static int objc_is_ivar_reference_p (tree expr) { - return (TREE_CODE (expr) == ARRAY_REF + /* LLVM LOCAL pointer arithmetic */ + return (objc_is_really_array_ref(expr) == 1 ? objc_is_ivar_reference_p (TREE_OPERAND (expr, 0)) : TREE_CODE (expr) == COMPONENT_REF ? TREE_CODE (TREE_OPERAND (expr, 1)) == FIELD_DECL From dpatel at apple.com Mon Oct 29 19:14:40 2007 From: dpatel at apple.com (Devang Patel) Date: Tue, 30 Oct 2007 00:14:40 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r43487 - /llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Message-ID: <200710300014.l9U0Eecb015201@zion.cs.uiuc.edu> Author: dpatel Date: Mon Oct 29 19:14:40 2007 New Revision: 43487 URL: http://llvm.org/viewvc/llvm-project?rev=43487&view=rev Log: Fix http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20071015/054686.html Modified: llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Modified: llvm-gcc-4.2/trunk/gcc/objc/objc-act.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/objc/objc-act.c?rev=43487&r1=43486&r2=43487&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/objc/objc-act.c (original) +++ llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Mon Oct 29 19:14:40 2007 @@ -10976,8 +10976,12 @@ meth_var_types), eltlist); - eltlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), eltlist); - + /* LLVM LOCAL begin */ + eltlist = tree_cons (NULL_TREE, + convert (objc_method_list_ptr, + build_int_cst (NULL_TREE, 0)), + eltlist); + /* LLVM LOCAL end */ initlist = tree_cons (NULL_TREE, objc_build_constructor (type, nreverse (eltlist)), From dalej at apple.com Mon Oct 29 20:18:38 2007 From: dalej at apple.com (Dale Johannesen) Date: Tue, 30 Oct 2007 01:18:38 -0000 Subject: [llvm-commits] [llvm] r43488 - /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Message-ID: <200710300118.l9U1Icba018883@zion.cs.uiuc.edu> Author: johannes Date: Mon Oct 29 20:18:38 2007 New Revision: 43488 URL: http://llvm.org/viewvc/llvm-project?rev=43488&view=rev Log: Add missing MMX PSUBQ. Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=43488&r1=43487&r2=43488&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Oct 29 20:18:38 2007 @@ -498,6 +498,7 @@ setOperationAction(ISD::SUB, MVT::v8i8, Legal); setOperationAction(ISD::SUB, MVT::v4i16, Legal); setOperationAction(ISD::SUB, MVT::v2i32, Legal); + setOperationAction(ISD::SUB, MVT::v1i64, Legal); setOperationAction(ISD::MULHS, MVT::v4i16, Legal); setOperationAction(ISD::MUL, MVT::v4i16, Legal); From dalej at apple.com Mon Oct 29 20:20:07 2007 From: dalej at apple.com (Dale Johannesen) Date: Tue, 30 Oct 2007 01:20:07 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r43489 - /llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386.cpp Message-ID: <200710300120.l9U1K7sO018980@zion.cs.uiuc.edu> Author: johannes Date: Mon Oct 29 20:20:06 2007 New Revision: 43489 URL: http://llvm.org/viewvc/llvm-project?rev=43489&view=rev Log: Add missing MMX PSUBQ. Add missing typecasts in PSLLQI and PSRLQI. Modified: llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386.cpp Modified: llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386.cpp?rev=43489&r1=43488&r2=43489&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386.cpp (original) +++ llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386.cpp Mon Oct 29 20:20:06 2007 @@ -63,6 +63,7 @@ case IX86_BUILTIN_PSUBB: case IX86_BUILTIN_PSUBW: case IX86_BUILTIN_PSUBD: + case IX86_BUILTIN_PSUBQ: case IX86_BUILTIN_PSUBB128: case IX86_BUILTIN_PSUBW128: case IX86_BUILTIN_PSUBD128: @@ -112,6 +113,8 @@ case IX86_BUILTIN_PSLLQI: { Function *psllq = Intrinsic::getDeclaration(TheModule, Intrinsic::x86_mmx_psll_q); + Ops[0] = Builder.CreateBitCast(Ops[0], MVT::getTypeForValueType(MVT::v2i32), + "tmp"); Ops[1] = BuildVector(Ops[1], UndefValue::get(Type::Int32Ty), NULL); Result = Builder.CreateCall(psllq, Ops.begin(), Ops.begin()+2, "tmp"); Result = Builder.CreateBitCast(Result, ResultType, "tmp"); @@ -163,6 +166,8 @@ case IX86_BUILTIN_PSRLQI: { Function *psrlq = Intrinsic::getDeclaration(TheModule, Intrinsic::x86_mmx_psrl_q); + Ops[0] = Builder.CreateBitCast(Ops[0], MVT::getTypeForValueType(MVT::v2i32), + "tmp"); Ops[1] = BuildVector(Ops[1], UndefValue::get(Type::Int32Ty), NULL); Result = Builder.CreateCall(psrlq, Ops.begin(), Ops.begin()+2, "tmp"); Result = Builder.CreateBitCast(Result, ResultType, "tmp"); From dalej at apple.com Mon Oct 29 20:44:33 2007 From: dalej at apple.com (Dale Johannesen) Date: Tue, 30 Oct 2007 01:44:33 -0000 Subject: [llvm-commits] [llvm] r43490 - /llvm/trunk/include/llvm/IntrinsicsX86.td Message-ID: <200710300144.l9U1iX8e020089@zion.cs.uiuc.edu> Author: johannes Date: Mon Oct 29 20:44:33 2007 New Revision: 43490 URL: http://llvm.org/viewvc/llvm-project?rev=43490&view=rev Log: Fix argument types for PSLLQ, PSRLQ. Modified: llvm/trunk/include/llvm/IntrinsicsX86.td Modified: llvm/trunk/include/llvm/IntrinsicsX86.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IntrinsicsX86.td?rev=43490&r1=43489&r2=43490&view=diff ============================================================================== --- llvm/trunk/include/llvm/IntrinsicsX86.td (original) +++ llvm/trunk/include/llvm/IntrinsicsX86.td Mon Oct 29 20:44:33 2007 @@ -759,7 +759,7 @@ Intrinsic<[llvm_v2i32_ty, llvm_v2i32_ty, llvm_v2i32_ty], [IntrNoMem]>; def int_x86_mmx_psll_q : GCCBuiltin<"__builtin_ia32_psllq">, - Intrinsic<[llvm_v2i32_ty, llvm_v2i32_ty, + Intrinsic<[llvm_v1i64_ty, llvm_v1i64_ty, llvm_v2i32_ty], [IntrNoMem]>; def int_x86_mmx_psrl_w : GCCBuiltin<"__builtin_ia32_psrlw">, @@ -769,7 +769,7 @@ Intrinsic<[llvm_v2i32_ty, llvm_v2i32_ty, llvm_v2i32_ty], [IntrNoMem]>; def int_x86_mmx_psrl_q : GCCBuiltin<"__builtin_ia32_psrlq">, - Intrinsic<[llvm_v2i32_ty, llvm_v2i32_ty, + Intrinsic<[llvm_v1i64_ty, llvm_v1i64_ty, llvm_v2i32_ty], [IntrNoMem]>; def int_x86_mmx_psra_w : GCCBuiltin<"__builtin_ia32_psraw">, From dalej at apple.com Mon Oct 29 20:45:17 2007 From: dalej at apple.com (Dale Johannesen) Date: Tue, 30 Oct 2007 01:45:17 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r43491 - /llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386.cpp Message-ID: <200710300145.l9U1jHM9020137@zion.cs.uiuc.edu> Author: johannes Date: Mon Oct 29 20:45:17 2007 New Revision: 43491 URL: http://llvm.org/viewvc/llvm-project?rev=43491&view=rev Log: Revert PSLLQ/PSRLQ part of previous patch; this isn't the right place to fix it. Modified: llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386.cpp Modified: llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386.cpp?rev=43491&r1=43490&r2=43491&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386.cpp (original) +++ llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386.cpp Mon Oct 29 20:45:17 2007 @@ -113,8 +113,6 @@ case IX86_BUILTIN_PSLLQI: { Function *psllq = Intrinsic::getDeclaration(TheModule, Intrinsic::x86_mmx_psll_q); - Ops[0] = Builder.CreateBitCast(Ops[0], MVT::getTypeForValueType(MVT::v2i32), - "tmp"); Ops[1] = BuildVector(Ops[1], UndefValue::get(Type::Int32Ty), NULL); Result = Builder.CreateCall(psllq, Ops.begin(), Ops.begin()+2, "tmp"); Result = Builder.CreateBitCast(Result, ResultType, "tmp"); @@ -166,8 +164,6 @@ case IX86_BUILTIN_PSRLQI: { Function *psrlq = Intrinsic::getDeclaration(TheModule, Intrinsic::x86_mmx_psrl_q); - Ops[0] = Builder.CreateBitCast(Ops[0], MVT::getTypeForValueType(MVT::v2i32), - "tmp"); Ops[1] = BuildVector(Ops[1], UndefValue::get(Type::Int32Ty), NULL); Result = Builder.CreateCall(psrlq, Ops.begin(), Ops.begin()+2, "tmp"); Result = Builder.CreateBitCast(Result, ResultType, "tmp"); From dalej at apple.com Mon Oct 29 20:52:58 2007 From: dalej at apple.com (Dale Johannesen) Date: Tue, 30 Oct 2007 01:52:58 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r43492 - /llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Message-ID: <200710300152.l9U1qwrG020705@zion.cs.uiuc.edu> Author: johannes Date: Mon Oct 29 20:52:58 2007 New Revision: 43492 URL: http://llvm.org/viewvc/llvm-project?rev=43492&view=rev Log: Add missing MMX PSUBQ. Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp?rev=43492&r1=43491&r2=43492&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Mon Oct 29 20:52:58 2007 @@ -63,6 +63,7 @@ case IX86_BUILTIN_PSUBB: case IX86_BUILTIN_PSUBW: case IX86_BUILTIN_PSUBD: + case IX86_BUILTIN_PSUBQ: case IX86_BUILTIN_PSUBB128: case IX86_BUILTIN_PSUBW128: case IX86_BUILTIN_PSUBD128: From dpatel at apple.com Mon Oct 29 23:41:47 2007 From: dpatel at apple.com (Devang Patel) Date: Tue, 30 Oct 2007 04:41:47 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r43495 - /llvm-gcc-4.0/trunk/gcc/objc/objc-act.c Message-ID: <200710300441.l9U4fmbT030569@zion.cs.uiuc.edu> Author: dpatel Date: Mon Oct 29 23:41:47 2007 New Revision: 43495 URL: http://llvm.org/viewvc/llvm-project?rev=43495&view=rev Log: Fix typo. Modified: llvm-gcc-4.0/trunk/gcc/objc/objc-act.c Modified: llvm-gcc-4.0/trunk/gcc/objc/objc-act.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/objc/objc-act.c?rev=43495&r1=43494&r2=43495&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/objc/objc-act.c (original) +++ llvm-gcc-4.0/trunk/gcc/objc/objc-act.c Mon Oct 29 23:41:47 2007 @@ -6876,7 +6876,7 @@ /* APPLE LOCAL end radar 4591756 */ /* LLVM LOCAL begin LLVM */ -/* llvm-gcc intentionally preserver array notation &array[i] and avoid +/* llvm-gcc intentionally preserve array notation &array[i] and avoid pointer arithmetic. Example 1: struct { int *a; } b; b->a[2] = 42; Example 2: struct { int a[42]; } b; b->a[2] = 42. From dpatel at apple.com Mon Oct 29 23:43:09 2007 From: dpatel at apple.com (Devang Patel) Date: Tue, 30 Oct 2007 04:43:09 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r43496 - /llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Message-ID: <200710300443.l9U4h9LO030697@zion.cs.uiuc.edu> Author: dpatel Date: Mon Oct 29 23:43:09 2007 New Revision: 43496 URL: http://llvm.org/viewvc/llvm-project?rev=43496&view=rev Log: Fix grammer. Modified: llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Modified: llvm-gcc-4.2/trunk/gcc/objc/objc-act.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/objc/objc-act.c?rev=43496&r1=43495&r2=43496&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/objc/objc-act.c (original) +++ llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Mon Oct 29 23:43:09 2007 @@ -6742,7 +6742,7 @@ /* APPLE LOCAL end radar 4591756 */ /* LLVM LOCAL begin LLVM */ -/* llvm-gcc intentionally preserver array notation &array[i] and avoid +/* llvm-gcc intentionally preserves array notation &array[i] and avoids pointer arithmetic. Example 1: struct { int *a; } b; b->a[2] = 42; Example 2: struct { int a[42]; } b; b->a[2] = 42. From dpatel at apple.com Mon Oct 29 23:44:09 2007 From: dpatel at apple.com (Devang Patel) Date: Tue, 30 Oct 2007 04:44:09 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r43497 - /llvm-gcc-4.0/trunk/gcc/objc/objc-act.c Message-ID: <200710300444.l9U4iAoS030888@zion.cs.uiuc.edu> Author: dpatel Date: Mon Oct 29 23:44:07 2007 New Revision: 43497 URL: http://llvm.org/viewvc/llvm-project?rev=43497&view=rev Log: Fix grammer. Modified: llvm-gcc-4.0/trunk/gcc/objc/objc-act.c Modified: llvm-gcc-4.0/trunk/gcc/objc/objc-act.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/objc/objc-act.c?rev=43497&r1=43496&r2=43497&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/objc/objc-act.c (original) +++ llvm-gcc-4.0/trunk/gcc/objc/objc-act.c Mon Oct 29 23:44:07 2007 @@ -6876,7 +6876,7 @@ /* APPLE LOCAL end radar 4591756 */ /* LLVM LOCAL begin LLVM */ -/* llvm-gcc intentionally preserve array notation &array[i] and avoid +/* llvm-gcc intentionally preserves array notation &array[i] and avoids pointer arithmetic. Example 1: struct { int *a; } b; b->a[2] = 42; Example 2: struct { int a[42]; } b; b->a[2] = 42. From baldrick at free.fr Tue Oct 30 07:40:59 2007 From: baldrick at free.fr (Duncan Sands) Date: Tue, 30 Oct 2007 12:40:59 -0000 Subject: [llvm-commits] [llvm] r43498 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200710301240.l9UCex67002111@zion.cs.uiuc.edu> Author: baldrick Date: Tue Oct 30 07:40:58 2007 New Revision: 43498 URL: http://llvm.org/viewvc/llvm-project?rev=43498&view=rev Log: If a call to getTruncStore is for a normal store, offload to getStore rather than trying to handle both cases at once (the assertions for example assume the store really is truncating). Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=43498&r1=43497&r2=43498&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Oct 30 07:40:58 2007 @@ -2460,7 +2460,9 @@ int SVOffset, MVT::ValueType SVT, bool isVolatile, unsigned Alignment) { MVT::ValueType VT = Val.getValueType(); - bool isTrunc = VT != SVT; + + if (VT == SVT) + return getStore(Chain, Val, Ptr, SV, SVOffset, isVolatile, Alignment); assert(MVT::getSizeInBits(VT) > MVT::getSizeInBits(SVT) && "Not a truncation?"); @@ -2485,7 +2487,7 @@ FoldingSetNodeID ID; AddNodeIDNode(ID, ISD::STORE, VTs, Ops, 4); ID.AddInteger(ISD::UNINDEXED); - ID.AddInteger(isTrunc); + ID.AddInteger(1); ID.AddInteger((unsigned int)SVT); ID.AddPointer(SV); ID.AddInteger(SVOffset); @@ -2494,7 +2496,7 @@ void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) return SDOperand(E, 0); - SDNode *N = new StoreSDNode(Ops, VTs, ISD::UNINDEXED, isTrunc, + SDNode *N = new StoreSDNode(Ops, VTs, ISD::UNINDEXED, true, SVT, SV, SVOffset, Alignment, isVolatile); CSEMap.InsertNode(N, IP); AllNodes.push_back(N); From baldrick at free.fr Tue Oct 30 07:50:40 2007 From: baldrick at free.fr (Duncan Sands) Date: Tue, 30 Oct 2007 12:50:40 -0000 Subject: [llvm-commits] [llvm] r43499 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Message-ID: <200710301250.l9UCoeXg002635@zion.cs.uiuc.edu> Author: baldrick Date: Tue Oct 30 07:50:39 2007 New Revision: 43499 URL: http://llvm.org/viewvc/llvm-project?rev=43499&view=rev Log: Add support for expanding trunc stores. Consider storing an i170 on a 32 bit machine. This is first promoted to a trunc-i170 store of an i256. On a little-endian machine this expands to a store of an i128 and a trunc-i42 store of an i128. The trunc-i42 store is further expanded to a trunc-i42 store of an i64, then to a store of an i32 and a trunc-i10 store of an i32. At this point the operand type is legal (i32) and expansion stops (legalization of the trunc-i10 needs to be handled in LegalizeDAG.cpp). On big-endian machines the high bits are stored first, and some bit-fiddling is needed in order to generate aligned stores. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp?rev=43499&r1=43498&r2=43499&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Tue Oct 30 07:50:39 2007 @@ -1936,75 +1936,139 @@ SDOperand DAGTypeLegalizer::ExpandOperand_STORE(StoreSDNode *N, unsigned OpNo) { assert(OpNo == 1 && "Can only expand the stored value so far"); - assert(!N->isTruncatingStore() && "Can't expand truncstore!"); - unsigned IncrementSize = 0; + MVT::ValueType VT = N->getOperand(1).getValueType(); + MVT::ValueType NVT = TLI.getTypeToTransformTo(VT); + SDOperand Ch = N->getChain(); + SDOperand Ptr = N->getBasePtr(); + int SVOffset = N->getSrcValueOffset(); + unsigned Alignment = N->getAlignment(); + bool isVolatile = N->isVolatile(); SDOperand Lo, Hi; - - // If this is a vector type, then we have to calculate the increment as - // the product of the element size in bytes, and the number of elements - // in the high half of the vector. - if (MVT::isVector(N->getValue().getValueType())) { - assert(0 && "Vectors not supported yet"); -#if 0 - SDNode *InVal = ST->getValue().Val; - unsigned NumElems = MVT::getVectorNumElements(InVal->getValueType(0)); - MVT::ValueType EVT = MVT::getVectorElementType(InVal->getValueType(0)); - - // Figure out if there is a simple type corresponding to this Vector - // type. If so, convert to the vector type. - MVT::ValueType TVT = MVT::getVectorType(EVT, NumElems); - if (TLI.isTypeLegal(TVT)) { - // Turn this into a normal store of the vector type. - Tmp3 = LegalizeOp(Node->getOperand(1)); - Result = DAG.getStore(Tmp1, Tmp3, Tmp2, ST->getSrcValue(), - SVOffset, isVolatile, Alignment); - Result = LegalizeOp(Result); - break; - } else if (NumElems == 1) { - // Turn this into a normal store of the scalar type. - Tmp3 = ScalarizeVectorOp(Node->getOperand(1)); - Result = DAG.getStore(Tmp1, Tmp3, Tmp2, ST->getSrcValue(), - SVOffset, isVolatile, Alignment); - // The scalarized value type may not be legal, e.g. it might require - // promotion or expansion. Relegalize the scalar store. - return LegalizeOp(Result); + + assert(!(MVT::getSizeInBits(NVT) & 7) && "Expanded type not byte sized!"); + + if (!N->isTruncatingStore()) { + unsigned IncrementSize = 0; + + // If this is a vector type, then we have to calculate the increment as + // the product of the element size in bytes, and the number of elements + // in the high half of the vector. + if (MVT::isVector(N->getValue().getValueType())) { + assert(0 && "Vectors not supported yet"); + #if 0 + SDNode *InVal = ST->getValue().Val; + unsigned NumElems = MVT::getVectorNumElements(InVal->getValueType(0)); + MVT::ValueType EVT = MVT::getVectorElementType(InVal->getValueType(0)); + + // Figure out if there is a simple type corresponding to this Vector + // type. If so, convert to the vector type. + MVT::ValueType TVT = MVT::getVectorType(EVT, NumElems); + if (TLI.isTypeLegal(TVT)) { + // Turn this into a normal store of the vector type. + Tmp3 = LegalizeOp(Node->getOperand(1)); + Result = DAG.getStore(Tmp1, Tmp3, Tmp2, ST->getSrcValue(), + SVOffset, isVolatile, Alignment); + Result = LegalizeOp(Result); + break; + } else if (NumElems == 1) { + // Turn this into a normal store of the scalar type. + Tmp3 = ScalarizeVectorOp(Node->getOperand(1)); + Result = DAG.getStore(Tmp1, Tmp3, Tmp2, ST->getSrcValue(), + SVOffset, isVolatile, Alignment); + // The scalarized value type may not be legal, e.g. it might require + // promotion or expansion. Relegalize the scalar store. + return LegalizeOp(Result); + } else { + SplitVectorOp(Node->getOperand(1), Lo, Hi); + IncrementSize = NumElems/2 * MVT::getSizeInBits(EVT)/8; + } + #endif } else { - SplitVectorOp(Node->getOperand(1), Lo, Hi); - IncrementSize = NumElems/2 * MVT::getSizeInBits(EVT)/8; + GetExpandedOp(N->getValue(), Lo, Hi); + IncrementSize = Hi.Val ? MVT::getSizeInBits(Hi.getValueType())/8 : 0; + + if (!TLI.isLittleEndian()) + std::swap(Lo, Hi); } -#endif + + Lo = DAG.getStore(Ch, Lo, Ptr, N->getSrcValue(), + SVOffset, isVolatile, Alignment); + + assert(Hi.Val && "FIXME: int <-> float should be handled with promote!"); + #if 0 + if (Hi.Val == NULL) { + // Must be int <-> float one-to-one expansion. + return Lo; + } + #endif + + Ptr = DAG.getNode(ISD::ADD, Ptr.getValueType(), Ptr, + getIntPtrConstant(IncrementSize)); + assert(isTypeLegal(Ptr.getValueType()) && "Pointers must be legal!"); + Hi = DAG.getStore(Ch, Hi, Ptr, N->getSrcValue(), SVOffset+IncrementSize, + isVolatile, MinAlign(Alignment, IncrementSize)); + return DAG.getNode(ISD::TokenFactor, MVT::Other, Lo, Hi); + } else if (MVT::getSizeInBits(N->getStoredVT()) <= MVT::getSizeInBits(NVT)) { + GetExpandedOp(N->getValue(), Lo, Hi); + return DAG.getTruncStore(Ch, Lo, Ptr, N->getSrcValue(), SVOffset, + N->getStoredVT(), isVolatile, Alignment); + } else if (TLI.isLittleEndian()) { + // Little-endian - low bits are at low addresses. + GetExpandedOp(N->getValue(), Lo, Hi); + + Lo = DAG.getStore(Ch, Lo, Ptr, N->getSrcValue(), SVOffset, + isVolatile, Alignment); + + unsigned ExcessBits = + MVT::getSizeInBits(N->getStoredVT()) - MVT::getSizeInBits(NVT); + MVT::ValueType NEVT = MVT::getIntegerType(ExcessBits); + + // Increment the pointer to the other half. + unsigned IncrementSize = MVT::getSizeInBits(NVT)/8; + Ptr = DAG.getNode(ISD::ADD, Ptr.getValueType(), Ptr, + getIntPtrConstant(IncrementSize)); + Hi = DAG.getTruncStore(Ch, Hi, Ptr, N->getSrcValue(), + SVOffset+IncrementSize, NEVT, + isVolatile, MinAlign(Alignment, IncrementSize)); + return DAG.getNode(ISD::TokenFactor, MVT::Other, Lo, Hi); } else { + // Big-endian - high bits are at low addresses. Favor aligned stores at + // the cost of some bit-fiddling. GetExpandedOp(N->getValue(), Lo, Hi); - IncrementSize = Hi.Val ? MVT::getSizeInBits(Hi.getValueType())/8 : 0; - - if (!TLI.isLittleEndian()) - std::swap(Lo, Hi); - } - - SDOperand Chain = N->getChain(); - SDOperand Ptr = N->getBasePtr(); - int SVOffset = N->getSrcValueOffset(); - unsigned Alignment = N->getAlignment(); - bool isVolatile = N->isVolatile(); - - Lo = DAG.getStore(Chain, Lo, Ptr, N->getSrcValue(), - SVOffset, isVolatile, Alignment); - - assert(Hi.Val && "FIXME: int <-> float should be handled with promote!"); -#if 0 - if (Hi.Val == NULL) { - // Must be int <-> float one-to-one expansion. - return Lo; + + MVT::ValueType EVT = N->getStoredVT(); + unsigned EBytes = (MVT::getSizeInBits(EVT) + 7)/8; + unsigned IncrementSize = MVT::getSizeInBits(NVT)/8; + unsigned ExcessBits = (EBytes - IncrementSize)*8; + MVT::ValueType HiVT = + MVT::getIntegerType(MVT::getSizeInBits(EVT)-ExcessBits); + + if (ExcessBits < MVT::getSizeInBits(NVT)) { + // Transfer high bits from the top of Lo to the bottom of Hi. + Hi = DAG.getNode(ISD::SHL, NVT, Hi, + DAG.getConstant(MVT::getSizeInBits(NVT) - ExcessBits, + TLI.getShiftAmountTy())); + Hi = DAG.getNode(ISD::OR, NVT, Hi, + DAG.getNode(ISD::SRL, NVT, Lo, + DAG.getConstant(ExcessBits, + TLI.getShiftAmountTy()))); + } + + // Store both the high bits and maybe some of the low bits. + Hi = DAG.getTruncStore(Ch, Hi, Ptr, N->getSrcValue(), + SVOffset, HiVT, isVolatile, Alignment); + + // Increment the pointer to the other half. + Ptr = DAG.getNode(ISD::ADD, Ptr.getValueType(), Ptr, + getIntPtrConstant(IncrementSize)); + // Store the lowest ExcessBits bits in the second half. + Lo = DAG.getTruncStore(Ch, Lo, Ptr, N->getSrcValue(), + SVOffset+IncrementSize, + MVT::getIntegerType(ExcessBits), + isVolatile, MinAlign(Alignment, IncrementSize)); + return DAG.getNode(ISD::TokenFactor, MVT::Other, Lo, Hi); } -#endif - - Ptr = DAG.getNode(ISD::ADD, Ptr.getValueType(), Ptr, - getIntPtrConstant(IncrementSize)); - assert(isTypeLegal(Ptr.getValueType()) && "Pointers must be legal!"); - Hi = DAG.getStore(Chain, Hi, Ptr, N->getSrcValue(), SVOffset+IncrementSize, - isVolatile, MinAlign(Alignment, IncrementSize)); - return DAG.getNode(ISD::TokenFactor, MVT::Other, Lo, Hi); } From baldrick at free.fr Tue Oct 30 08:14:37 2007 From: baldrick at free.fr (Duncan Sands) Date: Tue, 30 Oct 2007 13:14:37 -0000 Subject: [llvm-commits] [llvm] r43500 - in /llvm/trunk/lib/Target/X86: X86ATTAsmPrinter.h X86IntelAsmPrinter.h Message-ID: <200710301314.l9UDEb4u004086@zion.cs.uiuc.edu> Author: baldrick Date: Tue Oct 30 08:14:37 2007 New Revision: 43500 URL: http://llvm.org/viewvc/llvm-project?rev=43500&view=rev Log: Fix for visibility warnings generated by gcc-4.2. Modified: llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.h llvm/trunk/lib/Target/X86/X86IntelAsmPrinter.h Modified: llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.h?rev=43500&r1=43499&r2=43500&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.h (original) +++ llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.h Tue Oct 30 08:14:37 2007 @@ -19,7 +19,7 @@ namespace llvm { -struct X86ATTAsmPrinter : public X86SharedAsmPrinter { +struct VISIBILITY_HIDDEN X86ATTAsmPrinter : public X86SharedAsmPrinter { X86ATTAsmPrinter(std::ostream &O, X86TargetMachine &TM, const TargetAsmInfo *T) : X86SharedAsmPrinter(O, TM, T) { } Modified: llvm/trunk/lib/Target/X86/X86IntelAsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86IntelAsmPrinter.h?rev=43500&r1=43499&r2=43500&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86IntelAsmPrinter.h (original) +++ llvm/trunk/lib/Target/X86/X86IntelAsmPrinter.h Tue Oct 30 08:14:37 2007 @@ -20,7 +20,7 @@ namespace llvm { -struct X86IntelAsmPrinter : public X86SharedAsmPrinter { +struct VISIBILITY_HIDDEN X86IntelAsmPrinter : public X86SharedAsmPrinter { X86IntelAsmPrinter(std::ostream &O, X86TargetMachine &TM, const TargetAsmInfo *T) : X86SharedAsmPrinter(O, TM, T) { From djg at cray.com Tue Oct 30 14:00:50 2007 From: djg at cray.com (Dan Gohman) Date: Tue, 30 Oct 2007 19:00:50 -0000 Subject: [llvm-commits] [llvm] r43510 - in /llvm/trunk: lib/VMCore/ConstantFold.cpp test/Transforms/InstCombine/fold-vector-zero.ll Message-ID: <200710301900.l9UJ0oUG022315@zion.cs.uiuc.edu> Author: djg Date: Tue Oct 30 14:00:49 2007 New Revision: 43510 URL: http://llvm.org/viewvc/llvm-project?rev=43510&view=rev Log: Add support for folding binary operators with vector zero operands. Added: llvm/trunk/test/Transforms/InstCombine/fold-vector-zero.ll Modified: llvm/trunk/lib/VMCore/ConstantFold.cpp Modified: llvm/trunk/lib/VMCore/ConstantFold.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ConstantFold.cpp?rev=43510&r1=43509&r2=43510&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/ConstantFold.cpp (original) +++ llvm/trunk/lib/VMCore/ConstantFold.cpp Tue Oct 30 14:00:49 2007 @@ -450,14 +450,20 @@ /// EvalVectorOp - Given two vector constants and a function pointer, apply the /// function pointer to each element pair, producing a new ConstantVector -/// constant. +/// constant. Either or both of V1 and V2 may be NULL, meaning a +/// ConstantAggregateZero operand. static Constant *EvalVectorOp(const ConstantVector *V1, const ConstantVector *V2, + const VectorType *VTy, Constant *(*FP)(Constant*, Constant*)) { std::vector Res; - for (unsigned i = 0, e = V1->getNumOperands(); i != e; ++i) - Res.push_back(FP(const_cast(V1->getOperand(i)), - const_cast(V2->getOperand(i)))); + const Type *EltTy = VTy->getElementType(); + for (unsigned i = 0, e = VTy->getNumElements(); i != e; ++i) { + const Constant *C1 = V1 ? V1->getOperand(i) : Constant::getNullValue(EltTy); + const Constant *C2 = V2 ? V2->getOperand(i) : Constant::getNullValue(EltTy); + Res.push_back(FP(const_cast(C1), + const_cast(C2))); + } return ConstantVector::get(Res); } @@ -707,36 +713,40 @@ return ConstantFP::get(CFP1->getType(), C3V); } } - } else if (const ConstantVector *CP1 = dyn_cast(C1)) { - if (const ConstantVector *CP2 = dyn_cast(C2)) { + } else if (const VectorType *VTy = dyn_cast(C1->getType())) { + const ConstantVector *CP1 = dyn_cast(C1); + const ConstantVector *CP2 = dyn_cast(C2); + assert((CP1 != NULL || isa(C1)) && + "Unexpected kind of vector constant!"); + assert((CP2 != NULL || isa(C2)) && + "Unexpected kind of vector constant!"); switch (Opcode) { default: break; case Instruction::Add: - return EvalVectorOp(CP1, CP2, ConstantExpr::getAdd); + return EvalVectorOp(CP1, CP2, VTy, ConstantExpr::getAdd); case Instruction::Sub: - return EvalVectorOp(CP1, CP2, ConstantExpr::getSub); + return EvalVectorOp(CP1, CP2, VTy, ConstantExpr::getSub); case Instruction::Mul: - return EvalVectorOp(CP1, CP2, ConstantExpr::getMul); + return EvalVectorOp(CP1, CP2, VTy, ConstantExpr::getMul); case Instruction::UDiv: - return EvalVectorOp(CP1, CP2, ConstantExpr::getUDiv); + return EvalVectorOp(CP1, CP2, VTy, ConstantExpr::getUDiv); case Instruction::SDiv: - return EvalVectorOp(CP1, CP2, ConstantExpr::getSDiv); + return EvalVectorOp(CP1, CP2, VTy, ConstantExpr::getSDiv); case Instruction::FDiv: - return EvalVectorOp(CP1, CP2, ConstantExpr::getFDiv); + return EvalVectorOp(CP1, CP2, VTy, ConstantExpr::getFDiv); case Instruction::URem: - return EvalVectorOp(CP1, CP2, ConstantExpr::getURem); + return EvalVectorOp(CP1, CP2, VTy, ConstantExpr::getURem); case Instruction::SRem: - return EvalVectorOp(CP1, CP2, ConstantExpr::getSRem); + return EvalVectorOp(CP1, CP2, VTy, ConstantExpr::getSRem); case Instruction::FRem: - return EvalVectorOp(CP1, CP2, ConstantExpr::getFRem); + return EvalVectorOp(CP1, CP2, VTy, ConstantExpr::getFRem); case Instruction::And: - return EvalVectorOp(CP1, CP2, ConstantExpr::getAnd); + return EvalVectorOp(CP1, CP2, VTy, ConstantExpr::getAnd); case Instruction::Or: - return EvalVectorOp(CP1, CP2, ConstantExpr::getOr); + return EvalVectorOp(CP1, CP2, VTy, ConstantExpr::getOr); case Instruction::Xor: - return EvalVectorOp(CP1, CP2, ConstantExpr::getXor); - } + return EvalVectorOp(CP1, CP2, VTy, ConstantExpr::getXor); } } Added: llvm/trunk/test/Transforms/InstCombine/fold-vector-zero.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/fold-vector-zero.ll?rev=43510&view=auto ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/fold-vector-zero.ll (added) +++ llvm/trunk/test/Transforms/InstCombine/fold-vector-zero.ll Tue Oct 30 14:00:49 2007 @@ -0,0 +1,35 @@ +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep zeroinitializer + +define void @foo(i64 %A, i64 %B) { +bb8: + br label %bb30 + +bb30: + %s0 = phi i64 [ 0, %bb8 ], [ %r21, %bb30 ] + %l0 = phi i64 [ -2222, %bb8 ], [ %r23, %bb30 ] + %r2 = add i64 %s0, %B + %r3 = inttoptr i64 %r2 to <2 x double>* + %r4 = load <2 x double>* %r3, align 8 + %r6 = bitcast <2 x double> %r4 to <2 x i64> + %r7 = bitcast <2 x double> zeroinitializer to <2 x i64> + %r8 = insertelement <2 x i64> undef, i64 9223372036854775807, i32 0 + %r9 = insertelement <2 x i64> undef, i64 -9223372036854775808, i32 0 + %r10 = insertelement <2 x i64> %r8, i64 9223372036854775807, i32 1 + %r11 = insertelement <2 x i64> %r9, i64 -9223372036854775808, i32 1 + %r12 = and <2 x i64> %r6, %r10 + %r13 = and <2 x i64> %r7, %r11 + %r14 = or <2 x i64> %r12, %r13 + %r15 = bitcast <2 x i64> %r14 to <2 x double> + %r18 = add i64 %s0, %A + %r19 = inttoptr i64 %r18 to <2 x double>* + store <2 x double> %r15, <2 x double>* %r19, align 8 + %r21 = add i64 16, %s0 + %r23 = add i64 1, %l0 + %r25 = icmp slt i64 %r23, 0 + %r26 = zext i1 %r25 to i64 + %r27 = icmp ne i64 %r26, 0 + br i1 %r27, label %bb30, label %bb5 + +bb5: + ret void +} From evan.cheng at apple.com Tue Oct 30 15:11:21 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 30 Oct 2007 20:11:21 -0000 Subject: [llvm-commits] [llvm] r43511 - /llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <200710302011.l9UKBLag025647@zion.cs.uiuc.edu> Author: evancheng Date: Tue Oct 30 15:11:21 2007 New Revision: 43511 URL: http://llvm.org/viewvc/llvm-project?rev=43511&view=rev Log: Typo. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=43511&r1=43510&r2=43511&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Tue Oct 30 15:11:21 2007 @@ -2771,7 +2771,7 @@ if (SOp == Trunc) Ops.push_back(ExtLoad); else - Ops.push_back(DAG.getNode(ISD::SIGN_EXTEND, VT, SOp)); + Ops.push_back(DAG.getNode(ISD::ZERO_EXTEND, VT, SOp)); } Ops.push_back(SetCC->getOperand(2)); CombineTo(SetCC, DAG.getNode(ISD::SETCC, SetCC->getValueType(0), From dalej at apple.com Tue Oct 30 17:10:42 2007 From: dalej at apple.com (Dale Johannesen) Date: Tue, 30 Oct 2007 22:10:42 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r43521 - /llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Message-ID: <200710302210.l9UMAgw1031437@zion.cs.uiuc.edu> Author: johannes Date: Tue Oct 30 17:10:42 2007 New Revision: 43521 URL: http://llvm.org/viewvc/llvm-project?rev=43521&view=rev Log: Add missing vec_set_v4hi builtin. / Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp?rev=43521&r1=43520&r2=43521&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Tue Oct 30 17:10:42 2007 @@ -455,6 +455,7 @@ case IX86_BUILTIN_VEC_EXT_V8HI: Result = Builder.CreateExtractElement(Ops[0], Ops[1], "tmp"); return true; + case IX86_BUILTIN_VEC_SET_V4HI: case IX86_BUILTIN_VEC_SET_V8HI: // GCC sometimes doesn't produce the right element type. Ops[1] = Builder.CreateIntCast(Ops[1], Type::Int16Ty, false, "tmp"); From dalej at apple.com Tue Oct 30 17:13:05 2007 From: dalej at apple.com (Dale Johannesen) Date: Tue, 30 Oct 2007 22:13:05 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r43522 - /llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386.cpp Message-ID: <200710302213.l9UMD5EP031520@zion.cs.uiuc.edu> Author: johannes Date: Tue Oct 30 17:13:05 2007 New Revision: 43522 URL: http://llvm.org/viewvc/llvm-project?rev=43522&view=rev Log: Add missing vec_set_v4hi builtin. Modified: llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386.cpp Modified: llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386.cpp?rev=43522&r1=43521&r2=43522&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386.cpp (original) +++ llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386.cpp Tue Oct 30 17:13:05 2007 @@ -455,6 +455,7 @@ case IX86_BUILTIN_VEC_EXT_V8HI: Result = Builder.CreateExtractElement(Ops[0], Ops[1], "tmp"); return true; + case IX86_BUILTIN_VEC_SET_V4HI: case IX86_BUILTIN_VEC_SET_V8HI: // GCC sometimes doesn't produce the right element type. Ops[1] = Builder.CreateIntCast(Ops[1], Type::Int16Ty, false, "tmp"); From dalej at apple.com Tue Oct 30 17:15:38 2007 From: dalej at apple.com (Dale Johannesen) Date: Tue, 30 Oct 2007 22:15:38 -0000 Subject: [llvm-commits] [llvm] r43523 - in /llvm/trunk: include/llvm/IntrinsicsX86.td lib/Target/X86/X86InstrSSE.td Message-ID: <200710302215.l9UMFcSg031626@zion.cs.uiuc.edu> Author: johannes Date: Tue Oct 30 17:15:38 2007 New Revision: 43523 URL: http://llvm.org/viewvc/llvm-project?rev=43523&view=rev Log: Add missing SSE builtins: CVTPD2PI, CVTPS2PI, CVTTPD2PI, CVTTPS2PI, CVTPI2PD, CVTPI2PS. Modified: llvm/trunk/include/llvm/IntrinsicsX86.td llvm/trunk/lib/Target/X86/X86InstrSSE.td Modified: llvm/trunk/include/llvm/IntrinsicsX86.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IntrinsicsX86.td?rev=43523&r1=43522&r2=43523&view=diff ============================================================================== --- llvm/trunk/include/llvm/IntrinsicsX86.td (original) +++ llvm/trunk/include/llvm/IntrinsicsX86.td Tue Oct 30 17:15:38 2007 @@ -124,6 +124,13 @@ def int_x86_sse_cvtsi642ss : GCCBuiltin<"__builtin_ia32_cvtsi642ss">, Intrinsic<[llvm_v4f32_ty, llvm_v4f32_ty, llvm_i64_ty], [IntrNoMem]>; + def int_x86_sse_cvtps2pi : GCCBuiltin<"__builtin_ia32_cvtps2pi">, + Intrinsic<[llvm_v2i32_ty, llvm_v4f32_ty], [IntrNoMem]>; + def int_x86_sse_cvttps2pi: GCCBuiltin<"__builtin_ia32_cvttps2pi">, + Intrinsic<[llvm_v2i32_ty, llvm_v4f32_ty], [IntrNoMem]>; + def int_x86_sse_cvtpi2ps : GCCBuiltin<"__builtin_ia32_cvtpi2ps">, + Intrinsic<[llvm_v4f32_ty, llvm_v4f32_ty, + llvm_v2i32_ty], [IntrNoMem]>; } // SIMD load ops @@ -400,6 +407,12 @@ def int_x86_sse2_cvtss2sd : GCCBuiltin<"__builtin_ia32_cvtss2sd">, Intrinsic<[llvm_v2f64_ty, llvm_v2f64_ty, llvm_v4f32_ty], [IntrNoMem]>; + def int_x86_sse_cvtpd2pi : GCCBuiltin<"__builtin_ia32_cvtpd2pi">, + Intrinsic<[llvm_v2i32_ty, llvm_v2f64_ty], [IntrNoMem]>; + def int_x86_sse_cvttpd2pi: GCCBuiltin<"__builtin_ia32_cvttpd2pi">, + Intrinsic<[llvm_v2i32_ty, llvm_v2f64_ty], [IntrNoMem]>; + def int_x86_sse_cvtpi2pd : GCCBuiltin<"__builtin_ia32_cvtpi2pd">, + Intrinsic<[llvm_v2f64_ty, llvm_v2i32_ty], [IntrNoMem]>; } // SIMD load ops Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrSSE.td?rev=43523&r1=43522&r2=43523&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrSSE.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrSSE.td Tue Oct 30 17:15:38 2007 @@ -331,6 +331,34 @@ [(set GR32:$dst, (int_x86_sse_cvtss2si (load addr:$src)))]>; +// Match intrinisics which expect MM and XMM operand(s). +def Int_CVTPS2PIrr : PSI<0x2D, MRMSrcReg, (outs VR64:$dst), (ins VR128:$src), + "cvtps2pi\t{$src, $dst|$dst, $src}", + [(set VR64:$dst, (int_x86_sse_cvtps2pi VR128:$src))]>; +def Int_CVTPS2PIrm : PSI<0x2D, MRMSrcMem, (outs VR64:$dst), (ins f64mem:$src), + "cvtps2pi\t{$src, $dst|$dst, $src}", + [(set VR64:$dst, (int_x86_sse_cvtps2pi + (load addr:$src)))]>; +def Int_CVTTPS2PIrr: PSI<0x2C, MRMSrcReg, (outs VR64:$dst), (ins VR128:$src), + "cvttps2pi\t{$src, $dst|$dst, $src}", + [(set VR64:$dst, (int_x86_sse_cvttps2pi VR128:$src))]>; +def Int_CVTTPS2PIrm: PSI<0x2C, MRMSrcMem, (outs VR64:$dst), (ins f64mem:$src), + "cvttps2pi\t{$src, $dst|$dst, $src}", + [(set VR64:$dst, (int_x86_sse_cvttps2pi + (load addr:$src)))]>; +let isTwoAddress = 1 in { + def Int_CVTPI2PSrr : PSI<0x2A, MRMSrcReg, + (outs VR128:$dst), (ins VR128:$src1, VR64:$src2), + "cvtpi2ps\t{$src2, $dst|$dst, $src2}", + [(set VR128:$dst, (int_x86_sse_cvtpi2ps VR128:$src1, + VR64:$src2))]>; + def Int_CVTPI2PSrm : PSI<0x2A, MRMSrcMem, + (outs VR128:$dst), (ins VR128:$src1, i64mem:$src2), + "cvtpi2ps\t{$src2, $dst|$dst, $src2}", + [(set VR128:$dst, (int_x86_sse_cvtpi2ps VR128:$src1, + (load addr:$src2)))]>; +} + // Aliases for intrinsics def Int_CVTTSS2SIrr : SSI<0x2C, MRMSrcReg, (outs GR32:$dst), (ins VR128:$src), "cvttss2si\t{$src, $dst|$dst, $src}", @@ -1022,6 +1050,29 @@ [(set GR32:$dst, (int_x86_sse2_cvtsd2si (load addr:$src)))]>; +// Match intrinisics which expect MM and XMM operand(s). +def Int_CVTPD2PIrr : PDI<0x2D, MRMSrcReg, (outs VR64:$dst), (ins VR128:$src), + "cvtpd2pi\t{$src, $dst|$dst, $src}", + [(set VR64:$dst, (int_x86_sse_cvtpd2pi VR128:$src))]>; +def Int_CVTPD2PIrm : PDI<0x2D, MRMSrcMem, (outs VR64:$dst), (ins f128mem:$src), + "cvtpd2pi\t{$src, $dst|$dst, $src}", + [(set VR64:$dst, (int_x86_sse_cvtpd2pi + (load addr:$src)))]>; +def Int_CVTTPD2PIrr: PDI<0x2C, MRMSrcReg, (outs VR64:$dst), (ins VR128:$src), + "cvttpd2pi\t{$src, $dst|$dst, $src}", + [(set VR64:$dst, (int_x86_sse_cvttpd2pi VR128:$src))]>; +def Int_CVTTPD2PIrm: PDI<0x2C, MRMSrcMem, (outs VR64:$dst), (ins f128mem:$src), + "cvttpd2pi\t{$src, $dst|$dst, $src}", + [(set VR64:$dst, (int_x86_sse_cvttpd2pi + (load addr:$src)))]>; +def Int_CVTPI2PDrr : PDI<0x2A, MRMSrcReg, (outs VR128:$dst), (ins VR64:$src), + "cvtpi2pd\t{$src, $dst|$dst, $src}", + [(set VR128:$dst, (int_x86_sse_cvtpi2pd VR64:$src))]>; +def Int_CVTPI2PDrm : PDI<0x2A, MRMSrcMem, (outs VR128:$dst), (ins i64mem:$src), + "cvtpi2pd\t{$src, $dst|$dst, $src}", + [(set VR128:$dst, (int_x86_sse_cvtpi2pd + (load addr:$src)))]>; + // Aliases for intrinsics def Int_CVTTSD2SIrr : SDI<0x2C, MRMSrcReg, (outs GR32:$dst), (ins VR128:$src), "cvttsd2si\t{$src, $dst|$dst, $src}", From evan.cheng at apple.com Tue Oct 30 17:27:27 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 30 Oct 2007 22:27:27 -0000 Subject: [llvm-commits] [llvm] r43524 - in /llvm/trunk: lib/Transforms/Scalar/LoopStrengthReduce.cpp test/CodeGen/X86/2007-10-30-LSRCrash.ll Message-ID: <200710302227.l9UMRRuO032205@zion.cs.uiuc.edu> Author: evancheng Date: Tue Oct 30 17:27:26 2007 New Revision: 43524 URL: http://llvm.org/viewvc/llvm-project?rev=43524&view=rev Log: It's not safe to tell SplitCriticalEdge to merge identical edges. It may delete the phi instruction that's being processed. Added: llvm/trunk/test/CodeGen/X86/2007-10-30-LSRCrash.ll Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=43524&r1=43523&r2=43524&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Tue Oct 30 17:27:26 2007 @@ -127,12 +127,12 @@ /// StrideOrder - An ordering of the keys in IVUsesByStride that is stable: /// We use this to iterate over the IVUsesByStride collection without being /// dependent on random ordering of pointers in the process. - std::vector StrideOrder; + SmallVector StrideOrder; /// CastedValues - As we need to cast values to uintptr_t, this keeps track /// of the casted version of each value. This is accessed by /// getCastedVersionOf. - std::map CastedPointers; + DenseMap CastedPointers; /// DeadInsts - Keep track of instructions we may have made dead, so that /// we can remove them after we are done working. @@ -393,8 +393,7 @@ // post-incremented value. for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) if (PN->getIncomingValue(i) == IV) { - SplitCriticalEdge(PN->getIncomingBlock(i), PN->getParent(), P, - true); + SplitCriticalEdge(PN->getIncomingBlock(i), PN->getParent(), P, false); // Splitting the critical edge can reduce the number of entries in this // PHI. e = PN->getNumIncomingValues(); @@ -627,7 +626,7 @@ // have multiple entries for the same predecessor. We use a map to make sure // that a PHI node only has a single Value* for each predecessor (which also // prevents us from inserting duplicate code in some blocks). - std::map InsertedCode; + DenseMap InsertedCode; PHINode *PN = cast(Inst); for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) { if (PN->getIncomingValue(i) == OperandValToReplace) { @@ -640,7 +639,7 @@ (PN->getParent() != L->getHeader() || !L->contains(PHIPred))) { // First step, split the critical edge. - SplitCriticalEdge(PHIPred, PN->getParent(), P, true); + SplitCriticalEdge(PHIPred, PN->getParent(), P, false); // Next step: move the basic block. In particular, if the PHI node // is outside of the loop, and PredTI is in the loop, we want to @@ -1286,7 +1285,7 @@ // Get a base value. SCEVHandle Base = UsersToProcess[i].Base; - // Compact everything with this base to be consequetive with this one. + // Compact everything with this base to be consequtive with this one. for (unsigned j = i+1; j != e; ++j) { if (UsersToProcess[j].Base == Base) { std::swap(UsersToProcess[i+1], UsersToProcess[j]); @@ -1355,10 +1354,9 @@ // If we are reusing the iv, then it must be multiplied by a constant // factor take advantage of addressing mode scale component. if (RewriteFactor != 0) { - RewriteExpr = - SE->getMulExpr(SE->getIntegerSCEV(RewriteFactor, - RewriteExpr->getType()), - RewriteExpr); + RewriteExpr = SE->getMulExpr(SE->getIntegerSCEV(RewriteFactor, + RewriteExpr->getType()), + RewriteExpr); // The common base is emitted in the loop preheader. But since we // are reusing an IV, it has not been used to initialize the PHI node. Added: llvm/trunk/test/CodeGen/X86/2007-10-30-LSRCrash.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2007-10-30-LSRCrash.ll?rev=43524&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/2007-10-30-LSRCrash.ll (added) +++ llvm/trunk/test/CodeGen/X86/2007-10-30-LSRCrash.ll Tue Oct 30 17:27:26 2007 @@ -0,0 +1,48 @@ +; RUN: llvm-as < %s | llc -march=x86 + +define i32 @unique(i8* %full, i32 %p, i32 %len, i32 %mode, i32 %verbos, i32 %flags) { +entry: + br i1 false, label %cond_true15, label %cond_next107 + +cond_true15: ; preds = %entry + br i1 false, label %bb98.preheader, label %bb + +bb: ; preds = %cond_true15 + ret i32 0 + +bb98.preheader: ; preds = %cond_true15 + br i1 false, label %bb103, label %bb69.outer + +bb76.split: ; preds = %bb69.outer.split.split, %bb69.us208 + br i1 false, label %bb103, label %bb69.outer + +bb69.outer: ; preds = %bb76.split, %bb98.preheader + %from.0.reg2mem.0.ph.rec = phi i32 [ %tmp75.rec, %bb76.split ], [ 0, %bb98.preheader ] ; [#uses=1] + %tmp75.rec = add i32 %from.0.reg2mem.0.ph.rec, 1 ; [#uses=2] + %tmp75 = getelementptr i8* null, i32 %tmp75.rec ; [#uses=6] + br i1 false, label %bb69.us208, label %bb69.outer.split.split + +bb69.us208: ; preds = %bb69.outer + switch i32 0, label %bb76.split [ + i32 47, label %bb89 + i32 58, label %bb89 + i32 92, label %bb89 + ] + +bb69.outer.split.split: ; preds = %bb69.outer + switch i8 0, label %bb76.split [ + i8 47, label %bb89 + i8 58, label %bb89 + i8 92, label %bb89 + ] + +bb89: ; preds = %bb69.outer.split.split, %bb69.outer.split.split, %bb69.outer.split.split, %bb69.us208, %bb69.us208, %bb69.us208 + %tmp75.lcssa189 = phi i8* [ %tmp75, %bb69.us208 ], [ %tmp75, %bb69.us208 ], [ %tmp75, %bb69.us208 ], [ %tmp75, %bb69.outer.split.split ], [ %tmp75, %bb69.outer.split.split ], [ %tmp75, %bb69.outer.split.split ] ; [#uses=0] + ret i32 0 + +bb103: ; preds = %bb76.split, %bb98.preheader + ret i32 0 + +cond_next107: ; preds = %entry + ret i32 0 +} From dpatel at apple.com Tue Oct 30 18:07:47 2007 From: dpatel at apple.com (Devang Patel) Date: Tue, 30 Oct 2007 23:07:47 -0000 Subject: [llvm-commits] [llvm] r43527 - /llvm/trunk/test/CFrontend/2007-10-30-Volatile.c Message-ID: <200710302307.l9UN7lKU001335@zion.cs.uiuc.edu> Author: dpatel Date: Tue Oct 30 18:07:47 2007 New Revision: 43527 URL: http://llvm.org/viewvc/llvm-project?rev=43527&view=rev Log: New test. Added: llvm/trunk/test/CFrontend/2007-10-30-Volatile.c Added: llvm/trunk/test/CFrontend/2007-10-30-Volatile.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CFrontend/2007-10-30-Volatile.c?rev=43527&view=auto ============================================================================== --- llvm/trunk/test/CFrontend/2007-10-30-Volatile.c (added) +++ llvm/trunk/test/CFrontend/2007-10-30-Volatile.c Tue Oct 30 18:07:47 2007 @@ -0,0 +1,6 @@ +// RUN: %llvmgcc -S %s -o /dev/null -Wall -Werror +void bork() { + char * volatile p; + volatile int cc; + p += cc; +} From dpatel at apple.com Tue Oct 30 18:08:25 2007 From: dpatel at apple.com (Devang Patel) Date: Tue, 30 Oct 2007 23:08:25 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r43528 - /llvm-gcc-4.0/trunk/gcc/c-common.c Message-ID: <200710302308.l9UN8PpZ001367@zion.cs.uiuc.edu> Author: dpatel Date: Tue Oct 30 18:08:24 2007 New Revision: 43528 URL: http://llvm.org/viewvc/llvm-project?rev=43528&view=rev Log: Fix http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20071029/055013.html Modified: llvm-gcc-4.0/trunk/gcc/c-common.c Modified: llvm-gcc-4.0/trunk/gcc/c-common.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/c-common.c?rev=43528&r1=43527&r2=43528&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/c-common.c (original) +++ llvm-gcc-4.0/trunk/gcc/c-common.c Tue Oct 30 18:08:24 2007 @@ -2432,8 +2432,8 @@ TREE_CONSTANT (folded) = TREE_CONSTANT (ptrop) & TREE_CONSTANT (intop); /* If the original was void* + int, we converted it to char* + int. Convert - back to the appropriate void* result. */ - if (!size_set) + back to the appropriate void* result and match type qualifiers. */ + if (!size_set || TYPE_QUALS(result_type) != TYPE_QUALS(TREE_TYPE(folded))) folded = convert(result_type, folded); return folded; } From isanbard at gmail.com Tue Oct 30 18:27:38 2007 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 30 Oct 2007 16:27:38 -0700 Subject: [llvm-commits] [llvm-gcc-4.0] r43528 - /llvm-gcc-4.0/trunk/gcc/c-common.c In-Reply-To: <200710302308.l9UN8PpZ001367@zion.cs.uiuc.edu> References: <200710302308.l9UN8PpZ001367@zion.cs.uiuc.edu> Message-ID: <16e5fdf90710301627j2cc2fa02v3a161a94897b8027@mail.gmail.com> On 10/30/07, Devang Patel wrote: > Fix > http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20071029/055013.html > 4.2 maybe? :) -bw From kremenek at apple.com Tue Oct 30 18:35:55 2007 From: kremenek at apple.com (Ted Kremenek) Date: Tue, 30 Oct 2007 23:35:55 -0000 Subject: [llvm-commits] [llvm] r43531 - /llvm/trunk/include/llvm/ADT/FoldingSet.h Message-ID: <200710302335.l9UNZtMv002519@zion.cs.uiuc.edu> Author: kremenek Date: Tue Oct 30 18:35:55 2007 New Revision: 43531 URL: http://llvm.org/viewvc/llvm-project?rev=43531&view=rev Log: Added member function "size()" to FoldingSet to return the number of nodes in the FoldingSet. Modified: llvm/trunk/include/llvm/ADT/FoldingSet.h Modified: llvm/trunk/include/llvm/ADT/FoldingSet.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/FoldingSet.h?rev=43531&r1=43530&r2=43531&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/FoldingSet.h (original) +++ llvm/trunk/include/llvm/ADT/FoldingSet.h Tue Oct 30 18:35:55 2007 @@ -202,7 +202,10 @@ /// it is not already in the folding set. InsertPos must be obtained from /// FindNodeOrInsertPos. void InsertNode(Node *N, void *InsertPos); - + + /// size - Returns the number of nodes in the folding set. + unsigned size() const { return NumNodes; } + private: /// GrowHashTable - Double the size of the hash table and rehash everything. From dpatel at apple.com Tue Oct 30 18:37:43 2007 From: dpatel at apple.com (Devang Patel) Date: Tue, 30 Oct 2007 23:37:43 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r43532 - /llvm-gcc-4.2/trunk/gcc/c-common.c Message-ID: <200710302337.l9UNbhg1002581@zion.cs.uiuc.edu> Author: dpatel Date: Tue Oct 30 18:37:43 2007 New Revision: 43532 URL: http://llvm.org/viewvc/llvm-project?rev=43532&view=rev Log: Fix http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20071029/055013.html Modified: llvm-gcc-4.2/trunk/gcc/c-common.c Modified: llvm-gcc-4.2/trunk/gcc/c-common.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-common.c?rev=43532&r1=43531&r2=43532&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/c-common.c (original) +++ llvm-gcc-4.2/trunk/gcc/c-common.c Tue Oct 30 18:37:43 2007 @@ -2550,8 +2550,8 @@ TREE_CONSTANT (folded) = TREE_CONSTANT (ptrop) & TREE_CONSTANT (intop); /* If the original was void* + int, we converted it to char* + int. Convert - back to the appropriate void* result. */ - if (!size_set) + back to the appropriate void* result and match type qualifiers. */ + if (!size_set || TYPE_QUALS(result_type) != TYPE_QUALS(TREE_TYPE(folded))) folded = convert(result_type, folded); return folded; } From evan.cheng at apple.com Tue Oct 30 18:45:15 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 30 Oct 2007 23:45:15 -0000 Subject: [llvm-commits] [llvm] r43533 - /llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Message-ID: <200710302345.l9UNjFis002965@zion.cs.uiuc.edu> Author: evancheng Date: Tue Oct 30 18:45:15 2007 New Revision: 43533 URL: http://llvm.org/viewvc/llvm-project?rev=43533&view=rev Log: At end of LSR, replace uses of now constant (as result of SplitCriticalEdge) PHI node with the constant value. Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=43533&r1=43532&r2=43533&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Tue Oct 30 18:45:15 2007 @@ -228,6 +228,21 @@ while (!Insts.empty()) { Instruction *I = *Insts.begin(); Insts.erase(I); + + if (PHINode *PN = dyn_cast(I)) { + // If all incoming values to the Phi are the same, we can replace the Phi + // with that value. + if (Value *PNV = PN->hasConstantValue()) { + if (Instruction *U = dyn_cast(PNV)) + Insts.insert(U); + PN->replaceAllUsesWith(PNV); + SE->deleteValueFromRecords(PN); + PN->eraseFromParent(); + Changed = true; + continue; + } + } + if (isInstructionTriviallyDead(I)) { for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i) if (Instruction *U = dyn_cast(I->getOperand(i))) @@ -359,7 +374,8 @@ /// the loop, resulting in reg-reg copies (if we use the pre-inc value when we /// should use the post-inc value). static bool IVUseShouldUsePostIncValue(Instruction *User, Instruction *IV, - Loop *L, DominatorTree *DT, Pass *P) { + Loop *L, DominatorTree *DT, Pass *P, + SmallPtrSet &DeadInsts){ // If the user is in the loop, use the preinc value. if (L->contains(User->getParent())) return false; @@ -399,6 +415,9 @@ e = PN->getNumIncomingValues(); if (--NumUses == 0) break; } + + // PHI node might have become a constant value after SplitCriticalEdge. + DeadInsts.insert(User); return true; } @@ -461,7 +480,7 @@ // Okay, we found a user that we cannot reduce. Analyze the instruction // and decide what to do with it. If we are a use inside of the loop, use // the value before incrementation, otherwise use it after incrementation. - if (IVUseShouldUsePostIncValue(User, I, L, DT, this)) { + if (IVUseShouldUsePostIncValue(User, I, L, DT, this, DeadInsts)) { // The value used will be incremented by the stride more than we are // expecting, so subtract this off. SCEVHandle NewStart = SE->getMinusSCEV(Start, Stride); @@ -522,8 +541,8 @@ // operands of Inst to use the new expression 'NewBase', with 'Imm' added // to it. void RewriteInstructionToUseNewBase(const SCEVHandle &NewBase, - SCEVExpander &Rewriter, Loop *L, - Pass *P); + SCEVExpander &Rewriter, Loop *L, Pass *P, + SmallPtrSet &DeadInsts); Value *InsertCodeForBaseAtPosition(const SCEVHandle &NewBase, SCEVExpander &Rewriter, @@ -584,8 +603,8 @@ // operands of Inst to use the new expression 'NewBase', with 'Imm' added // to it. void BasedUser::RewriteInstructionToUseNewBase(const SCEVHandle &NewBase, - SCEVExpander &Rewriter, - Loop *L, Pass *P) { + SCEVExpander &Rewriter, Loop *L, Pass *P, + SmallPtrSet &DeadInsts) { if (!isa(Inst)) { // By default, insert code at the user instruction. BasicBlock::iterator InsertPt = Inst; @@ -676,6 +695,10 @@ Rewriter.clear(); } } + + // PHI node might have become a constant value after SplitCriticalEdge. + DeadInsts.insert(Inst); + DOUT << " CHANGED: IMM =" << *Imm << " Inst = " << *Inst; } @@ -1373,7 +1396,8 @@ // Add BaseV to the PHI value if needed. RewriteExpr = SE->getAddExpr(RewriteExpr, SE->getUnknown(BaseV)); - User.RewriteInstructionToUseNewBase(RewriteExpr, Rewriter, L, this); + User.RewriteInstructionToUseNewBase(RewriteExpr, Rewriter, L, this, + DeadInsts); // Mark old value we replaced as possibly dead, so that it is elminated // if we just replaced the last use of that value. @@ -1457,7 +1481,7 @@ /// v1 = v1 + 3 /// if (v1 < 30) goto loop ICmpInst *LoopStrengthReduce::ChangeCompareStride(Loop *L, ICmpInst *Cond, - IVStrideUse* &CondUse, + IVStrideUse* &CondUse, const SCEVHandle* &CondStride) { if (StrideOrder.size() < 2 || IVUsesByStride[*CondStride].Users.size() != 1) @@ -1734,7 +1758,7 @@ PHINode *PN; while ((PN = dyn_cast(I))) { ++I; // Preincrement iterator to avoid invalidating it when deleting PN. - + // At this point, we know that we have killed one or more GEP // instructions. It is worth checking to see if the cann indvar is also // dead, so that we can remove it as well. The requirements for the cann From dalej at apple.com Tue Oct 30 19:32:36 2007 From: dalej at apple.com (Dale Johannesen) Date: Wed, 31 Oct 2007 00:32:36 -0000 Subject: [llvm-commits] [llvm] r43535 - in /llvm/trunk/lib: CodeGen/SelectionDAG/LegalizeDAG.cpp Target/X86/X86ISelLowering.cpp Message-ID: <200710310032.l9V0Wa4O005229@zion.cs.uiuc.edu> Author: johannes Date: Tue Oct 30 19:32:36 2007 New Revision: 43535 URL: http://llvm.org/viewvc/llvm-project?rev=43535&view=rev Log: Make i64=expand_vector_elt(v2i64) work in 32-bit mode. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=43535&r1=43534&r2=43535&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Tue Oct 30 19:32:36 2007 @@ -5299,6 +5299,11 @@ #endif assert(0 && "Do not know how to expand this operator!"); abort(); + case ISD::EXTRACT_VECTOR_ELT: + assert(VT==MVT::i64 && "Do not know how to expand this operator!"); + // ExpandEXTRACT_VECTOR_ELT tolerates invalid result types. + Lo = ExpandEXTRACT_VECTOR_ELT(Op); + return ExpandOp(Lo, Lo, Hi); case ISD::UNDEF: NVT = TLI.getTypeToExpandTo(VT); Lo = DAG.getNode(ISD::UNDEF, NVT); Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=43535&r1=43534&r2=43535&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Tue Oct 30 19:32:36 2007 @@ -608,7 +608,8 @@ setOperationAction(ISD::VECTOR_SHUFFLE, MVT::v2f64, Custom); setOperationAction(ISD::VECTOR_SHUFFLE, MVT::v2i64, Custom); setOperationAction(ISD::EXTRACT_VECTOR_ELT, MVT::v2f64, Custom); - setOperationAction(ISD::EXTRACT_VECTOR_ELT, MVT::v2i64, Custom); + if (Subtarget->is64Bit()) + setOperationAction(ISD::EXTRACT_VECTOR_ELT, MVT::v2i64, Custom); // Promote v16i8, v8i16, v4i32 load, select, and, or, xor to v2i64. for (unsigned VT = (unsigned)MVT::v16i8; VT != (unsigned)MVT::v2i64; VT++) { From dpatel at apple.com Tue Oct 30 20:03:47 2007 From: dpatel at apple.com (Devang Patel) Date: Wed, 31 Oct 2007 01:03:47 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r43537 - /llvm-gcc-4.0/trunk/gcc/objc/objc-act.c Message-ID: <200710310103.l9V13lEm006514@zion.cs.uiuc.edu> Author: dpatel Date: Tue Oct 30 20:03:47 2007 New Revision: 43537 URL: http://llvm.org/viewvc/llvm-project?rev=43537&view=rev Log: Set 'used' bit to shut up "defined but not used" warning. Modified: llvm-gcc-4.0/trunk/gcc/objc/objc-act.c Modified: llvm-gcc-4.0/trunk/gcc/objc/objc-act.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/objc/objc-act.c?rev=43537&r1=43536&r2=43537&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/objc/objc-act.c (original) +++ llvm-gcc-4.0/trunk/gcc/objc/objc-act.c Tue Oct 30 20:03:47 2007 @@ -3868,6 +3868,7 @@ set_user_assembler_name (var, IDENTIFIER_POINTER (DECL_NAME (var))); /* Let optimizer know that this var is not removable. */ DECL_PRESERVE_P (var) = 1; + TREE_USED(var) = 1; } else /* Fall through. Build using 'name' */ From dpatel at apple.com Tue Oct 30 20:05:20 2007 From: dpatel at apple.com (Devang Patel) Date: Wed, 31 Oct 2007 01:05:20 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r43538 - /llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Message-ID: <200710310105.l9V15Kmg006591@zion.cs.uiuc.edu> Author: dpatel Date: Tue Oct 30 20:05:20 2007 New Revision: 43538 URL: http://llvm.org/viewvc/llvm-project?rev=43538&view=rev Log: Set 'used' bit to shut up "defined but not used" warning. Modified: llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Modified: llvm-gcc-4.2/trunk/gcc/objc/objc-act.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/objc/objc-act.c?rev=43538&r1=43537&r2=43538&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/objc/objc-act.c (original) +++ llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Tue Oct 30 20:05:20 2007 @@ -3876,6 +3876,7 @@ set_user_assembler_name (var, IDENTIFIER_POINTER (DECL_NAME (var))); /* Let optimizer know that this var is not removable. */ DECL_PRESERVE_P (var) = 1; + TREE_USED(var) = 1; } else /* Fall through. Build using 'name' */ From criswell at cs.uiuc.edu Tue Oct 30 21:23:19 2007 From: criswell at cs.uiuc.edu (John Criswell) Date: Tue, 30 Oct 2007 21:23:19 -0500 Subject: [llvm-commits] CVS: llvm-www/Users.html Message-ID: <200710310223.VAA20646@choi.cs.uiuc.edu> Changes in directory llvm-www: Users.html updated: 1.22 -> 1.23 --- Log message: Added David Penry's research group. --- Diffs of the changes: (+10 -1) Users.html | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletion(-) Index: llvm-www/Users.html diff -u llvm-www/Users.html:1.22 llvm-www/Users.html:1.23 --- llvm-www/Users.html:1.22 Wed Oct 3 23:39:57 2007 +++ llvm-www/Users.html Tue Oct 30 21:22:28 2007 @@ -95,6 +95,15 @@ + + + Brigham Young University + David Penry's Research Group + Microarchitectural Simulator Partitioning and Synthesis
      + Adaptive Online Parallel Optimization + + + Ghent University @@ -263,6 +272,6 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!">
      LLVM Development List
      - Last modified: $Date: 2007/10/04 04:39:57 $ + Last modified: $Date: 2007/10/31 02:22:28 $ From resistor at mac.com Tue Oct 30 22:30:15 2007 From: resistor at mac.com (Owen Anderson) Date: Wed, 31 Oct 2007 03:30:15 -0000 Subject: [llvm-commits] [llvm] r43541 - in /llvm/trunk: include/llvm/Analysis/DominatorInternals.h include/llvm/Analysis/Dominators.h include/llvm/CodeGen/MachineDominators.h lib/CodeGen/MachineDominators.cpp Message-ID: <200710310330.l9V3UFrc012725@zion.cs.uiuc.edu> Author: resistor Date: Tue Oct 30 22:30:14 2007 New Revision: 43541 URL: http://llvm.org/viewvc/llvm-project?rev=43541&view=rev Log: Some fixes to get MachineDomTree working better. Added: llvm/trunk/lib/CodeGen/MachineDominators.cpp Modified: llvm/trunk/include/llvm/Analysis/DominatorInternals.h llvm/trunk/include/llvm/Analysis/Dominators.h llvm/trunk/include/llvm/CodeGen/MachineDominators.h Modified: llvm/trunk/include/llvm/Analysis/DominatorInternals.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DominatorInternals.h?rev=43541&r1=43540&r2=43541&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/DominatorInternals.h (original) +++ llvm/trunk/include/llvm/Analysis/DominatorInternals.h Tue Oct 30 22:30:14 2007 @@ -273,21 +273,24 @@ // which postdominates all real exits if there are multiple exit blocks. typename GraphT::NodeType* Root = DT.Roots.size() == 1 ? DT.Roots[0] : 0; - DT.DomTreeNodes[Root] = DT.RootNode = new DomTreeNode(Root, 0); + DT.DomTreeNodes[Root] = DT.RootNode = + new DomTreeNodeBase(Root, 0); // Loop over all of the reachable blocks in the function... - for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) + for (typename FuncT::iterator I = F.begin(), E = F.end(); I != E; ++I) if (typename GraphT::NodeType* ImmDom = DT.getIDom(I)) { // Reachable block. - DomTreeNode *BBNode = DT.DomTreeNodes[I]; + DomTreeNodeBase *BBNode = DT.DomTreeNodes[I]; if (BBNode) continue; // Haven't calculated this node yet? // Get or calculate the node for the immediate dominator - DomTreeNode *IDomNode = DT.getNodeForBlock(ImmDom); + DomTreeNodeBase *IDomNode = + DT.getNodeForBlock(ImmDom); // Add a new tree node for this BasicBlock, and link it as a child of // IDomNode - DomTreeNode *C = new DomTreeNode(I, IDomNode); + DomTreeNodeBase *C = + new DomTreeNodeBase(I, IDomNode); DT.DomTreeNodes[I] = IDomNode->addChild(C); } Modified: llvm/trunk/include/llvm/Analysis/Dominators.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/Dominators.h?rev=43541&r1=43540&r2=43541&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/Dominators.h (original) +++ llvm/trunk/include/llvm/Analysis/Dominators.h Tue Oct 30 22:30:14 2007 @@ -132,6 +132,7 @@ }; EXTERN_TEMPLATE_INSTANTIATION(class DomTreeNodeBase); +EXTERN_TEMPLATE_INSTANTIATION(class DomTreeNodeBase); template static std::ostream &operator<<(std::ostream &o, @@ -156,7 +157,6 @@ } typedef DomTreeNodeBase DomTreeNode; -typedef DomTreeNodeBase MachineDomTreeNode; //===----------------------------------------------------------------------===// /// DominatorTree - Calculate the immediate dominator tree for a function. @@ -607,6 +607,12 @@ return I != IDoms.end() ? I->second : 0; } + inline void addRoot(NodeT* BB) { + // Unreachable block is not a root node. + if (!isa(&BB->back())) + this->Roots.push_back(BB); + } + public: /// recalculate - compute a dominator tree for the given function template @@ -615,9 +621,9 @@ reset(); // Initialize roots - this->Roots.push_back(&F.getEntryBlock()); - this->IDoms[&F.getEntryBlock()] = 0; - this->DomTreeNodes[&F.getEntryBlock()] = 0; + this->Roots.push_back(&F.front()); + this->IDoms[&F.front()] = 0; + this->DomTreeNodes[&F.front()] = 0; this->Vertex.push_back(0); Calculate(*this, F); @@ -627,13 +633,10 @@ reset(); // Reset from the last time we were run... // Initialize the roots list - for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) { - TerminatorInst *Insn = I->getTerminator(); - if (Insn->getNumSuccessors() == 0) { - // Unreachable block is not a root node. - if (!isa(Insn)) - this->Roots.push_back(I); - } + for (typename FT::iterator I = F.begin(), E = F.end(); I != E; ++I) { + if (std::distance(GraphTraits::child_begin(I), + GraphTraits::child_end(I)) == 0) + addRoot(I); // Prepopulate maps so that we don't get iterator invalidation issues later. this->IDoms[I] = 0; Modified: llvm/trunk/include/llvm/CodeGen/MachineDominators.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineDominators.h?rev=43541&r1=43540&r2=43541&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineDominators.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineDominators.h Tue Oct 30 22:30:14 2007 @@ -24,7 +24,17 @@ namespace llvm { -void WriteAsOperand(std::ostream &, const MachineBasicBlock*, bool t) { } +inline void WriteAsOperand(std::ostream &, const MachineBasicBlock*, bool t) { } + +template<> +inline void DominatorTreeBase::addRoot(MachineBasicBlock* MBB) { + this->Roots.push_back(MBB); +} + +EXTERN_TEMPLATE_INSTANTIATION(class DomTreeNodeBase); +EXTERN_TEMPLATE_INSTANTIATION(class DominatorTreeBase); + +typedef DomTreeNodeBase MachineDomTreeNode; //===------------------------------------- /// DominatorTree Class - Concrete subclass of DominatorTreeBase that is used to @@ -60,7 +70,11 @@ return DT->getRootNode(); } - virtual bool runOnFunction(Function &F); + virtual bool runOnMachineFunction(MachineFunction &F) { + DT->recalculate(F); + + return false; + } virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); Added: llvm/trunk/lib/CodeGen/MachineDominators.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineDominators.cpp?rev=43541&view=auto ============================================================================== --- llvm/trunk/lib/CodeGen/MachineDominators.cpp (added) +++ llvm/trunk/lib/CodeGen/MachineDominators.cpp Tue Oct 30 22:30:14 2007 @@ -0,0 +1,24 @@ +//===- MachineDominators.cpp - Machine Dominator Calculation --------------===// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by the LLVM research group and is distributed under +// the University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file implements simple dominator construction algorithms for finding +// forward dominators on machine functions. +// +//===----------------------------------------------------------------------===// + +#include "llvm/CodeGen/MachineDominators.h" + +using namespace llvm; + +TEMPLATE_INSTANTIATION(class DomTreeNodeBase); +TEMPLATE_INSTANTIATION(class DominatorTreeBase); + +char MachineDominatorTree::ID = 0; +static RegisterPass +E("machinedomtree", "MachineDominator Tree Construction", true); \ No newline at end of file From resistor at mac.com Tue Oct 30 22:37:57 2007 From: resistor at mac.com (Owen Anderson) Date: Wed, 31 Oct 2007 03:37:57 -0000 Subject: [llvm-commits] [llvm] r43542 - in /llvm/trunk: include/llvm/CodeGen/Passes.h lib/CodeGen/StrongPHIElimination.cpp Message-ID: <200710310337.l9V3bvII013070@zion.cs.uiuc.edu> Author: resistor Date: Tue Oct 30 22:37:57 2007 New Revision: 43542 URL: http://llvm.org/viewvc/llvm-project?rev=43542&view=rev Log: Add the skeleton of a better PHI elimination pass. Added: llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Modified: llvm/trunk/include/llvm/CodeGen/Passes.h Modified: llvm/trunk/include/llvm/CodeGen/Passes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/Passes.h?rev=43542&r1=43541&r2=43542&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/Passes.h (original) +++ llvm/trunk/include/llvm/CodeGen/Passes.h Tue Oct 30 22:37:57 2007 @@ -44,6 +44,14 @@ /// these register allocator like this: AU.addRequiredID(PHIEliminationID); /// extern const PassInfo *PHIEliminationID; + + /// StrongPHIElimination pass - This pass eliminates machine instruction PHI + /// nodes by inserting copy instructions. This destroys SSA information, but + /// is the desired input for some register allocators. This pass is + /// "required" by these register allocator like this: + /// AU.addRequiredID(PHIEliminationID); + /// This pass is still in development + extern const PassInfo *StrongPHIEliminationID; /// SimpleRegisterCoalescing pass. Aggressively coalesces every register /// copy it can. Added: llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp?rev=43542&view=auto ============================================================================== --- llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp (added) +++ llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Tue Oct 30 22:37:57 2007 @@ -0,0 +1,112 @@ +//===- StrongPhiElimination.cpp - Eliminate PHI nodes by inserting copies -===// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by Owen Anderson and is distributed under +// the University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This pass eliminates machine instruction PHI nodes by inserting copy +// instructions, using an intelligent copy-folding technique based on +// dominator information. This is technique is derived from: +// +// Budimlic, et al. Fast copy coalescing and live-range identification. +// In Proceedings of the ACM SIGPLAN 2002 Conference on Programming Language +// Design and Implementation (Berlin, Germany, June 17 - 19, 2002). +// PLDI '02. ACM, New York, NY, 25-32. +// DOI= http://doi.acm.org/10.1145/512529.512534 +// +//===----------------------------------------------------------------------===// + +#define DEBUG_TYPE "strongphielim" +#include "llvm/CodeGen/Passes.h" +#include "llvm/CodeGen/MachineDominators.h" +#include "llvm/CodeGen/MachineFunctionPass.h" +#include "llvm/CodeGen/MachineInstr.h" +#include "llvm/Target/TargetInstrInfo.h" +#include "llvm/Target/TargetMachine.h" +#include "llvm/ADT/Statistic.h" +#include "llvm/Support/Compiler.h" +using namespace llvm; + + +namespace { + struct VISIBILITY_HIDDEN StrongPHIElimination : public MachineFunctionPass { + static char ID; // Pass identification, replacement for typeid + StrongPHIElimination() : MachineFunctionPass((intptr_t)&ID) {} + + bool runOnMachineFunction(MachineFunction &Fn) { + computeDFS(Fn); + + + return false; + } + + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.addRequired(); + MachineFunctionPass::getAnalysisUsage(AU); + } + + virtual void releaseMemory() { + preorder.clear(); + maxpreorder.clear(); + } + + private: + DenseMap preorder; + DenseMap maxpreorder; + + void computeDFS(MachineFunction& MF); + }; + + char StrongPHIElimination::ID = 0; + RegisterPass X("strong-phi-node-elimination", + "Eliminate PHI nodes for register allocation, intelligently"); +} + +const PassInfo *llvm::StrongPHIEliminationID = X.getPassInfo(); + +/// computeDFS - Computes the DFS-in and DFS-out numbers of the dominator tree +/// of the given MachineFunction. These numbers are then used in other parts +/// of the PHI elimination process. +void StrongPHIElimination::computeDFS(MachineFunction& MF) { + SmallPtrSet frontier; + SmallPtrSet visited; + + unsigned time = 0; + + MachineDominatorTree& DT = getAnalysis(); + + MachineDomTreeNode* node = DT.getRootNode(); + + std::vector worklist; + worklist.push_back(node); + + while (!worklist.empty()) { + MachineDomTreeNode* currNode = worklist.back(); + + if (!frontier.count(currNode)) { + frontier.insert(currNode); + ++time; + preorder.insert(std::make_pair(currNode->getBlock(), time)); + } + + bool inserted = false; + for (MachineDomTreeNode::iterator I = node->begin(), E = node->end(); + I != E; ++I) + if (!frontier.count(*I) && !visited.count(*I)) { + worklist.push_back(*I); + inserted = true; + break; + } + + if (!inserted) { + frontier.erase(currNode); + visited.insert(currNode); + maxpreorder.insert(std::make_pair(currNode->getBlock(), time)); + + worklist.pop_back(); + } + } +} \ No newline at end of file From clattner at apple.com Tue Oct 30 23:58:47 2007 From: clattner at apple.com (Chris Lattner) Date: Tue, 30 Oct 2007 21:58:47 -0700 Subject: [llvm-commits] [llvm] r43535 - in /llvm/trunk/lib: CodeGen/SelectionDAG/LegalizeDAG.cpp Target/X86/X86ISelLowering.cpp In-Reply-To: <200710310032.l9V0Wa4O005229@zion.cs.uiuc.edu> References: <200710310032.l9V0Wa4O005229@zion.cs.uiuc.edu> Message-ID: <9A743B10-CD98-4170-BA58-28F784D651A7@apple.com> > URL: http://llvm.org/viewvc/llvm-project?rev=43535&view=rev > Log: > Make i64=expand_vector_elt(v2i64) work in 32-bit mode. Testcase please :) -Chris > > > Modified: > llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp > llvm/trunk/lib/Target/X86/X86ISelLowering.cpp > > Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=43535&r1=43534&r2=43535&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) > +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Tue Oct 30 > 19:32:36 2007 > @@ -5299,6 +5299,11 @@ > #endif > assert(0 && "Do not know how to expand this operator!"); > abort(); > + case ISD::EXTRACT_VECTOR_ELT: > + assert(VT==MVT::i64 && "Do not know how to expand this > operator!"); > + // ExpandEXTRACT_VECTOR_ELT tolerates invalid result types. > + Lo = ExpandEXTRACT_VECTOR_ELT(Op); > + return ExpandOp(Lo, Lo, Hi); > case ISD::UNDEF: > NVT = TLI.getTypeToExpandTo(VT); > Lo = DAG.getNode(ISD::UNDEF, NVT); > > Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=43535&r1=43534&r2=43535&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) > +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Tue Oct 30 > 19:32:36 2007 > @@ -608,7 +608,8 @@ > setOperationAction(ISD::VECTOR_SHUFFLE, MVT::v2f64, Custom); > setOperationAction(ISD::VECTOR_SHUFFLE, MVT::v2i64, Custom); > setOperationAction(ISD::EXTRACT_VECTOR_ELT, MVT::v2f64, Custom); > - setOperationAction(ISD::EXTRACT_VECTOR_ELT, MVT::v2i64, Custom); > + if (Subtarget->is64Bit()) > + setOperationAction(ISD::EXTRACT_VECTOR_ELT, MVT::v2i64, > Custom); > > // Promote v16i8, v8i16, v4i32 load, select, and, or, xor to > v2i64. > for (unsigned VT = (unsigned)MVT::v16i8; VT != > (unsigned)MVT::v2i64; VT++) { > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From sabre at nondot.org Wed Oct 31 00:53:32 2007 From: sabre at nondot.org (Chris Lattner) Date: Wed, 31 Oct 2007 05:53:32 -0000 Subject: [llvm-commits] [llvm] r43545 - /llvm/trunk/docs/FAQ.html Message-ID: <200710310553.l9V5rWBk020786@zion.cs.uiuc.edu> Author: lattner Date: Wed Oct 31 00:53:31 2007 New Revision: 43545 URL: http://llvm.org/viewvc/llvm-project?rev=43545&view=rev Log: __main is dead along with llvm-gcc3. Modified: llvm/trunk/docs/FAQ.html Modified: llvm/trunk/docs/FAQ.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/FAQ.html?rev=43545&r1=43544&r2=43545&view=diff ============================================================================== --- llvm/trunk/docs/FAQ.html (original) +++ llvm/trunk/docs/FAQ.html Wed Oct 31 00:53:31 2007 @@ -89,8 +89,6 @@
    • Questions about code generated by the GCC front-end
        -
      1. What is this __main() call that gets inserted into - main()?
      2. What is this llvm.global_ctors and _GLOBAL__I__tmp_webcompile... stuff that happens when I #include <iostream>?
      3. @@ -591,29 +589,6 @@ Questions about code generated by the GCC front-end -

        - -What is this __main() call that gets inserted into main()? -

        - -
        -

        -The __main call is inserted by the C/C++ compiler in order to guarantee -that static constructors and destructors are called when the program starts up -and shuts down. In C, you can create static constructors and destructors by -using GCC extensions, and in C++ you can do so by creating a global variable -whose class has a ctor or dtor. -

        - -

        -The actual implementation of __main lives in the -llvm/runtime/GCCLibraries/crtend/ directory in the source-base, and is -linked in automatically when you link the program. -

        -
        - - -

        What is this llvm.global_ctors and From sabre at nondot.org Wed Oct 31 01:30:23 2007 From: sabre at nondot.org (Chris Lattner) Date: Wed, 31 Oct 2007 06:30:23 -0000 Subject: [llvm-commits] [llvm] r43546 - in /llvm/trunk/docs/tutorial: LangImpl5-cfg.png LangImpl5.html index.html Message-ID: <200710310630.l9V6UNRi023091@zion.cs.uiuc.edu> Author: lattner Date: Wed Oct 31 01:30:21 2007 New Revision: 43546 URL: http://llvm.org/viewvc/llvm-project?rev=43546&view=rev Log: Add the first half of chapter 5: if/then/else. To come: for statement. Added: llvm/trunk/docs/tutorial/LangImpl5-cfg.png (with props) llvm/trunk/docs/tutorial/LangImpl5.html Modified: llvm/trunk/docs/tutorial/index.html Added: llvm/trunk/docs/tutorial/LangImpl5-cfg.png URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/LangImpl5-cfg.png?rev=43546&view=auto ============================================================================== Binary file - no diff available. Propchange: llvm/trunk/docs/tutorial/LangImpl5-cfg.png ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: llvm/trunk/docs/tutorial/LangImpl5.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/LangImpl5.html?rev=43546&view=auto ============================================================================== --- llvm/trunk/docs/tutorial/LangImpl5.html (added) +++ llvm/trunk/docs/tutorial/LangImpl5.html Wed Oct 31 01:30:21 2007 @@ -0,0 +1,523 @@ + + + + + Kaleidoscope: Extending the Language: Control Flow + + + + + + + +

        Kaleidoscope: Extending the Language: Control Flow
        + +
        +

        Written by Chris Lattner

        +
        + + + + + +
        + +

        Welcome to Part 5 of the "Implementing a language with +LLVM" tutorial. Parts 1-4 described the implementation of the simple +Kaleidoscope language and included support for generating LLVM IR, following by +optimizations and a JIT compiler. Unfortunately, as presented, Kaleidoscope is +mostly useless: it has no control flow other than call and return. This means +that you can't have conditional branches in the code, significantly limiting its +power. In this episode of "build that compiler", we'll extend Kaleidoscope to +have an if/then/else expression plus a simple looping construct.

        + +
        + + + + + +
        + +

        +Extending Kaleidoscope to support if/then/else is quite straight-forward. It +basically requires adding lexer support for this "new" concept to the lexer, +parser, AST, and LLVM code emitter. This example is nice, because it shows how +easy it is to "grow" a language over time, incrementally extending it as new +ideas are discovered.

        + +

        Before we get going on "how" we do this extension, lets talk about what we +want. The basic idea is that we want to be able to write this sort of thing: +

        + +
        +
        +def fib(x)
        +  if x < 3 then
        +    1
        +  else
        +    fib(x-1)+fib(x-2);
        +
        +
        + +

        In Kaleidoscope, every construct is an expression: there are no statements. +As such, the if/then/else expression needs to return a value like any other. +Since we're using a mostly functional form, we'll have it evaluate its +conditional, then return the 'then' or 'else' value based on how the condition +was resolved. This is very similar to the C "?:" expression.

        + +

        The semantics of the if/then/else expression is that it first evaluates the +condition to a boolean equality value: 0.0 is false and everything else is true. +If the condition is true, the first subexpression is evaluated and returned, if +the condition is false, the second subexpression is evaluated and returned. +Since Kaleidoscope allows side-effects, this behavior is important to nail down. +

        + +

        Now that we know what we want, lets break this down into its constituent +pieces.

        + +
        + + + + + + +
        + +

        The lexer extensions are straight-forward. First we add new enum values +for the relevant tokens:

        + +
        +
        +  // control
        +  tok_if = -6, tok_then = -7, tok_else = -8,
        +
        +
        + +

        Once we have that, we recognize the new keywords in the lexer, pretty simple +stuff:

        + +
        +
        +    ...
        +    if (IdentifierStr == "def") return tok_def;
        +    if (IdentifierStr == "extern") return tok_extern;
        +    if (IdentifierStr == "if") return tok_if;
        +    if (IdentifierStr == "then") return tok_then;
        +    if (IdentifierStr == "else") return tok_else;
        +    return tok_identifier;
        +
        +
        + +
        + + + + + +
        + +

        To represent the new expression we add a new AST node for it:

        + +
        +
        +/// IfExprAST - Expression class for if/then/else.
        +class IfExprAST : public ExprAST {
        +  ExprAST *Cond, *Then, *Else;
        +public:
        +  IfExprAST(ExprAST *cond, ExprAST *then, ExprAST *_else)
        +    : Cond(cond), Then(then), Else(_else) {}
        +  virtual Value *Codegen();
        +};
        +
        +
        + +

        The AST node just has pointers to the various subexpressions.

        + +
        + + + + + +
        + +

        Now that we have the relevant tokens coming from the lexer and we have the +AST node to build, our parsing logic is relatively straight-forward. First we +define a new parsing function:

        + +
        +
        +/// ifexpr ::= 'if' expression 'then' expression 'else' expression
        +static ExprAST *ParseIfExpr() {
        +  getNextToken();  // eat the if.
        +  
        +  // condition.
        +  ExprAST *Cond = ParseExpression();
        +  if (!Cond) return 0;
        +  
        +  if (CurTok != tok_then)
        +    return Error("expected then");
        +  getNextToken();  // eat the then
        +  
        +  ExprAST *Then = ParseExpression();
        +  if (Then == 0) return 0;
        +  
        +  if (CurTok != tok_else)
        +    return Error("expected else");
        +  
        +  getNextToken();
        +  
        +  ExprAST *Else = ParseExpression();
        +  if (!Else) return 0;
        +  
        +  return new IfExprAST(Cond, Then, Else);
        +}
        +
        +
        + +

        Next we hook it up as a primary expression:

        + +
        +
        +static ExprAST *ParsePrimary() {
        +  switch (CurTok) {
        +  default: return Error("unknown token when expecting an expression");
        +  case tok_identifier: return ParseIdentifierExpr();
        +  case tok_number:     return ParseNumberExpr();
        +  case '(':            return ParseParenExpr();
        +  case tok_if:         return ParseIfExpr();
        +  }
        +}
        +
        +
        + +
        + + + + + +
        + +

        Now that we have it parsing and building the AST, the final piece is adding +LLVM code generation support. This is the most interesting part of the +if/then/else example, because this is where it starts to introduce new concepts. +All of the code above has been described in previous chapters fairly thoroughly. +

        + +

        To motivate the code we want to produce, lets take a look at a simple +example. Consider:

        + +
        +
        +extern foo();
        +extern bar();
        +def baz(x) if x then foo() else bar();
        +
        +
        + +

        If you disable optimizations, the code you'll (soon) get from Kaleidoscope +looks like this:

        + +
        +
        +declare double @foo()
        +
        +declare double @bar()
        +
        +define double @baz(double %x) {
        +entry:
        +	%ifcond = fcmp one double %x, 0.000000e+00
        +	br i1 %ifcond, label %then, label %else
        +
        +then:		; preds = %entry
        +	%calltmp = call double @foo()
        +	br label %ifcont
        +
        +else:		; preds = %entry
        +	%calltmp1 = call double @bar()
        +	br label %ifcont
        +
        +ifcont:		; preds = %else, %then
        +	%iftmp = phi double [ %calltmp, %then ], [ %calltmp1, %else ]
        +	ret double %iftmp
        +}
        +
        +
        + +

        To visualize the control flow graph, you can use a nifty feature of the LLVM +'opt' tool. If you put this LLVM IR +into "t.ll" and run "llvm-as < t.ll | opt -analyze -view-cfg", a window will pop up and you'll +see this graph:

        + +
        Example CFG
        + +

        Another way to get this is to call "F->viewCFG()" or +"F->viewCFGOnly()" (where F is a "Function*") either by +inserting actual calls into the code and recompiling or by calling these in the +debugger. LLVM has many nice features for visualizing various graphs.

        + +

        Coming back to the generated code, it is fairly simple: the entry block +evaluates the conditional expression ("x" in our case here) and compares the +result to 0.0 with the "fcmp one" +instruction ('one' is "ordered and not equal"). Based on the result of this +expression, the code jumps to either the "then" or "else" blocks, which contain +the expressions for the true/false case.

        + +

        Once the then/else blocks is finished executing, they both branch back to the +else block to execute the code that happens after the if/then/else. In this +case the only thing left to do is to return to the caller of the function. The +question then becomes: how does the code know which expression to return?

        + +

        The answer to this question involves an important SSA operation: the +Phi +operation. If you're not familiar with SSA, the wikipedia +article is a good introduction and there are various other introductions to +it available on your favorite search engine. The short version is that +"execution" of the Phi operation requires "remembering" which block control came +from. The Phi operation takes on the value corresponding to the input control +block. In this case, if control comes in from the "then" block, it gets the +value of "calltmp". If control comes from the "else" block, it gets the value +of "calltmp1".

        + +

        At this point, you are probably starting to think "on no! this means my +simple and elegant front-end will have to start generating SSA form in order to +use LLVM!". Fortunately, this is not the case, and we strongly advise +not implementing an SSA construction algorithm in your front-end +unless there is an amazingly good reason to do so. In practice, there are two +sorts of values that float around in code written in your average imperative +programming language that might need Phi nodes:

        + +
          +
        1. Code that involves user variables: x = 1; x = x + 1;
        2. +
        3. Values that are implicit in the structure of your AST, such as the phi node +in this case.
        4. +
        + +

        At a future point in this tutorial ("mutable variables"), we'll talk about #1 +in depth. For now, just believe me that you don't need SSA construction to +handle them. For #2, you have the choice of using the techniques that we will +describe for #1, or you can insert Phi nodes directly if convenient. In this +case, it is really really easy to generate the Phi node, so we choose to do it +directly.

        + +

        Okay, enough of the motivation and overview, lets generate code!

        + +
        + + + + + +
        + +

        In order to generate code for this, we implement the Codegen method +for IfExprAST:

        + +
        +
        +Value *IfExprAST::Codegen() {
        +  Value *CondV = Cond->Codegen();
        +  if (CondV == 0) return 0;
        +  
        +  // Convert condition to a bool by comparing equal to 0.0.
        +  CondV = Builder.CreateFCmpONE(CondV, 
        +                                ConstantFP::get(Type::DoubleTy, APFloat(0.0)),
        +                                "ifcond");
        +
        +
        + +

        This code is straight-forward and similar to what we saw before. We emit the +expression for the condition, then compare that value to zero to get a truth +value as a 1-bit (bool) value.

        + +
        +
        +  Function *TheFunction = Builder.GetInsertBlock()->getParent();
        +  
        +  // Create blocks for the then and else cases.  Insert the 'then' block at the
        +  // end of the function.
        +  BasicBlock *ThenBB = new BasicBlock("then", TheFunction);
        +  BasicBlock *ElseBB = new BasicBlock("else");
        +  BasicBlock *MergeBB = new BasicBlock("ifcont");
        +
        +  Builder.CreateCondBr(CondV, ThenBB, ElseBB);
        +
        +
        + +

        This code creates the basic blocks that are related to the if/then/else +statement, and correspond directly to the blocks in the example above. The +first line of this gets the current Function object that is being built. It +gets this by asking the builder for the current BasicBlock, and asking that +block for its "parent" (the function it is currently embedded into).

        + +

        Once it has that, it creates three blocks. Note that it passes "TheFunction" +into the constructor for the "then" block. This causes the constructor to +automatically insert the new block onto the end of the specified function. The +other two blocks are created, but aren't yet inserted into the function.

        + +

        Once the blocks are created, we can emit the conditional branch that chooses +between them. Note that creating new blocks does not implicitly affect the +LLVMBuilder, so it is still inserting into the block that the condition +went into. Also note that it is creating a branch to the "then" block and the +"else" block, even though the "else" block isn't inserted into the function yet. +This is all ok: it is the standard way that LLVM supports forward +references.

        + +
        +
        +  // Emit then value.
        +  Builder.SetInsertPoint(ThenBB);
        +  
        +  Value *ThenV = Then->Codegen();
        +  if (ThenV == 0) return 0;
        +  
        +  Builder.CreateBr(MergeBB);
        +  // Codegen of 'Then' can change the current block, update ThenBB for the PHI.
        +  ThenBB = Builder.GetInsertBlock();
        +
        +
        + +

        After the conditional branch is inserted, we move the builder to start +inserting into the "then" block. Strictly speaking, this call moves the +insertion point to be at the end of the specified block. However, since the +"then" block is empty, it also starts out by inserting at the beginning of the +block. :)

        + +

        Once the insertion point is set, we recursively codegen the "then" expression +from the AST. To finish off the then block, we create an unconditional branch +to the merge block. One interesting (and very important) aspect of the LLVM IR +is that it requires all basic blocks +to be "terminated" with a control flow +instruction such as return or branch. This means that all control flow, +including fall throughs must be made explicit in the LLVM IR. If you +violate this rule, the verifier will emit an error.

        + +

        The final line here is quite subtle, but is very important. The basic issue +is that when we create the Phi node in the merge block, we need to set up the +block/value pairs that indicate how the Phi will work. Importantly, the Phi +node expects to have an extry for each predecessor of the block in the CFG. Why +then are we getting the current block when we just set it to ThenBB 5 lines +above? The problem is that the "Then" expression may actually itself change the +block that the Builder is emitting into if, for example, it contains a nested +"if/then/else" expression. Because calling Codegen recursively could +arbitrarily change the notion of the current block, we are required to get an +up-to-date value for code that will set up the Phi node.

        + +
        +
        +  // Emit else block.
        +  TheFunction->getBasicBlockList().push_back(ElseBB);
        +  Builder.SetInsertPoint(ElseBB);
        +  
        +  Value *ElseV = Else->Codegen();
        +  if (ElseV == 0) return 0;
        +  
        +  Builder.CreateBr(MergeBB);
        +  // Codegen of 'Else' can change the current block, update ElseBB for the PHI.
        +  ElseBB = Builder.GetInsertBlock();
        +
        +
        + +

        Code generation for the 'else' block is basically identical to codegen for +the 'then' block. The only significant difference is the first line, which adds +the 'else' block to the function. Recall previously that the 'else' block was +created, but not added to the function. Now that the 'then' and 'else' blocks +are emitted, we can finish up with the merge code:

        + +
        +
        +  // Emit merge block.
        +  TheFunction->getBasicBlockList().push_back(MergeBB);
        +  Builder.SetInsertPoint(MergeBB);
        +  PHINode *PN = Builder.CreatePHI(Type::DoubleTy, "iftmp");
        +  
        +  PN->addIncoming(ThenV, ThenBB);
        +  PN->addIncoming(ElseV, ElseBB);
        +  return PN;
        +}
        +
        +
        + +

        The first two lines here are now familiar: the first adds the "merge" block +to the Function object (it was previously floating, like the else block above). +The second block changes the insertion point so that newly created code will go +into the "merge" block. Once that is done, we need to create the PHI node and +set up the block/value pairs for the PHI.

        + +

        Finally, the CodeGen function returns the phi node as the value computed by +the if/then/else expression. In our example above, this returned value will +feed into the code for the top-level function, which will create the return +instruction.

        + +

        Overall, we now have the ability to execution conditional code in +Kaleidoscope. With this extension, Kaleidoscope is a fairly complete language +that can calculate a wide variety of numeric functions. Next up we'll add +another useful expression that is familiar from non-functional languages...

        + +
        + + + + + +
        + +

        ...

        + +
        + + + + + +
        + +

        +Here is the complete code listing for our running example, enhanced with the +if/then/else and for expressions.. To build this example, use: +

        + +
        +
        +   # Compile
        +   g++ -g toy.cpp `llvm-config --cppflags --ldflags --libs core jit native` -O3 -o toy
        +   # Run
        +   ./toy
        +
        +
        + +

        Here is the code:

        + +
        +
        +...
        +
        +
        + +
        + + +
        +
        + Valid CSS! + Valid HTML 4.01! + + Chris Lattner
        + The LLVM Compiler Infrastructure
        + Last modified: $Date: 2007-10-17 11:05:13 -0700 (Wed, 17 Oct 2007) $ +
        + + Modified: llvm/trunk/docs/tutorial/index.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/index.html?rev=43546&r1=43545&r2=43546&view=diff ============================================================================== --- llvm/trunk/docs/tutorial/index.html (original) +++ llvm/trunk/docs/tutorial/index.html Wed Oct 31 01:30:21 2007 @@ -31,7 +31,7 @@
      4. Implementing a Parser and AST
      5. Implementing Code Generation to LLVM IR
      6. Adding JIT and Optimizer Support
      7. -
      8. Extending the language: if/then/else
      9. +
      10. Extending the language: control flow
      11. Extending the language: operator overloading
      12. Extending the language: mutable variables
      13. Thoughts and ideas for extensions
      14. From sabre at nondot.org Wed Oct 31 01:47:39 2007 From: sabre at nondot.org (Chris Lattner) Date: Wed, 31 Oct 2007 06:47:39 -0000 Subject: [llvm-commits] [llvm] r43547 - /llvm/trunk/docs/tutorial/LangImpl5.html Message-ID: <200710310647.l9V6ldcc024512@zion.cs.uiuc.edu> Author: lattner Date: Wed Oct 31 01:47:39 2007 New Revision: 43547 URL: http://llvm.org/viewvc/llvm-project?rev=43547&view=rev Log: add the code for expression code that we'll add, though most of the description is missing. Modified: llvm/trunk/docs/tutorial/LangImpl5.html Modified: llvm/trunk/docs/tutorial/LangImpl5.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/LangImpl5.html?rev=43547&r1=43546&r2=43547&view=diff ============================================================================== --- llvm/trunk/docs/tutorial/LangImpl5.html (original) +++ llvm/trunk/docs/tutorial/LangImpl5.html Wed Oct 31 01:47:39 2007 @@ -473,7 +473,271 @@
        -

        ...

        +

        Now that we know how to add basic control flow constructs to the language, +we have the tools to add more powerful things. Lets add something more +aggressive, a 'for' expression:

        + +
        +
        + # print 100 '*' (ascii 42) characters
        + extern putchard(char)
        + for x = 1, x < 100, 1.0 in putchard(42);
        +
        +
        + +

        This expression defines a new variable ("x" in this case) which iterates from +a starting value, while the condition ("x < 100" in this case) is true, +incrementing by an optional step value ("1.0" in this case). If the step value +is omitted, it defaults to 1.0. While the loop is true, it executes its +body expression. Because we don't have anything better to return, we'll just +define the loop as always returning 0.0. In the future when we have mutable +variables, it will get more useful.

        + +

        As before, lets talk about the changes that we need to Kaleidoscope to +support this.

        + +
        + + + + + +
        + +

        The lexer extensions are the same sort of thing as for if/then/else:

        + +
        +
        +  ... in enum Token ...
        +  // control
        +  tok_if = -6, tok_then = -7, tok_else = -8,
        +  tok_for = -9, tok_in = -10
        +
        +  ... in gettok ...
        +  if (IdentifierStr == "def") return tok_def;
        +  if (IdentifierStr == "extern") return tok_extern;
        +  if (IdentifierStr == "if") return tok_if;
        +  if (IdentifierStr == "then") return tok_then;
        +  if (IdentifierStr == "else") return tok_else;
        +  if (IdentifierStr == "for") return tok_for;
        +  if (IdentifierStr == "in") return tok_in;
        +  return tok_identifier;
        +
        +
        + +
        + + + + + +
        + +

        The AST node is similarly simple. It basically boils down to capturing +the variable name and the consituent expressions in the node.

        + +
        +
        +/// ForExprAST - Expression class for for/in.
        +class ForExprAST : public ExprAST {
        +  std::string VarName;
        +  ExprAST *Start, *End, *Step, *Body;
        +public:
        +  ForExprAST(const std::string &varname, ExprAST *start, ExprAST *end,
        +             ExprAST *step, ExprAST *body)
        +    : VarName(varname), Start(start), End(end), Step(step), Body(body) {}
        +  virtual Value *Codegen();
        +};
        +
        +
        + +
        + + + + + +
        + +

        The parser code is also fairly standard. The only interesting thing here is +handling of the optional step value. The parser code handles it by checking to +see if the second comma is present. If not, it sets the step value to null in +the AST node:

        + +
        +
        +/// forexpr ::= 'for' identifer '=' expr ',' expr (',' expr)? 'in' expression
        +static ExprAST *ParseForExpr() {
        +  getNextToken();  // eat the for.
        +
        +  if (CurTok != tok_identifier)
        +    return Error("expected identifier after for");
        +  
        +  std::string IdName = IdentifierStr;
        +  getNextToken();  // eat identifer.
        +  
        +  if (CurTok != '=')
        +    return Error("expected '=' after for");
        +  getNextToken();  // eat '='.
        +  
        +  
        +  ExprAST *Start = ParseExpression();
        +  if (Start == 0) return 0;
        +  if (CurTok != ',')
        +    return Error("expected ',' after for start value");
        +  getNextToken();
        +  
        +  ExprAST *End = ParseExpression();
        +  if (End == 0) return 0;
        +  
        +  // The step value is optional.
        +  ExprAST *Step = 0;
        +  if (CurTok == ',') {
        +    getNextToken();
        +    Step = ParseExpression();
        +    if (Step == 0) return 0;
        +  }
        +  
        +  if (CurTok != tok_in)
        +    return Error("expected 'in' after for");
        +  getNextToken();  // eat 'in'.
        +  
        +  ExprAST *Body = ParseExpression();
        +  if (Body == 0) return 0;
        +
        +  return new ForExprAST(IdName, Start, End, Step, Body);
        +}
        +
        +
        + +
        + + + + + +
        + +

        Now we get to the good part: the LLVM IR we want to generate for this thing. +

        + + + +
        + + + + + +
        + + +
        +
        +Value *ForExprAST::Codegen() {
        +  // Output this as:
        +  //   ...
        +  //   start = startexpr
        +  //   goto loop
        +  // loop: 
        +  //   variable = phi [start, loopheader], [nextvariable, loopend]
        +  //   ...
        +  //   bodyexpr
        +  //   ...
        +  // loopend:
        +  //   step = stepexpr
        +  //   nextvariable = variable + step
        +  //   endcond = endexpr
        +  //   br endcond, loop, endloop
        +  // outloop:
        +  
        +  // Emit the start code first, without 'variable' in scope.
        +  Value *StartVal = Start->Codegen();
        +  if (StartVal == 0) return 0;
        +  
        +  // Make the new basic block for the loop header, inserting after current
        +  // block.
        +  Function *TheFunction = Builder.GetInsertBlock()->getParent();
        +  BasicBlock *PreheaderBB = Builder.GetInsertBlock();
        +  BasicBlock *LoopBB = new BasicBlock("loop", TheFunction);
        +  
        +  // Insert an explicit fall through from the current block to the LoopBB.
        +  // Start insertion in LoopBB.
        +  Builder.CreateBr(LoopBB);
        +  Builder.SetInsertPoint(LoopBB);
        +  
        +  // Start the PHI node with an entry for Start.
        +  PHINode *Variable = Builder.CreatePHI(Type::DoubleTy, VarName.c_str());
        +  Variable->addIncoming(StartVal, PreheaderBB);
        +  
        +  // Within the loop, the variable is defined equal to the PHI node.  If it
        +  // shadows an existing variable, we have to restore it, so save it now.
        +  Value *OldVal = NamedValues[VarName];
        +  NamedValues[VarName] = Variable;
        +  
        +  // Emit the body of the loop.  This, like any other expr, can change the
        +  // current BB.  Note that we ignore the value computed by the body, but don't
        +  // allow an error.
        +  if (Body->Codegen() == 0)
        +    return 0;
        +  
        +  // Emit the step value.
        +  Value *StepVal;
        +  if (Step) {
        +    StepVal = Step->Codegen();
        +    if (StepVal == 0) return 0;
        +  } else {
        +    // If not specified, use 1.0.
        +    StepVal = ConstantFP::get(Type::DoubleTy, APFloat(1.0));
        +  }
        +  
        +  Value *NextVar = Builder.CreateAdd(Variable, StepVal, "nextvar");
        +
        +  // When evaluating the end condition, the value of the variable is the
        +  // incremented value.
        +  NamedValues[VarName] = Variable;
        +  
        +  
        +  // Compute the end condition.
        +  Value *EndCond = End->Codegen();
        +  if (EndCond == 0) return EndCond;
        +  
        +  // Convert condition to a bool by comparing equal to 0.0.
        +  EndCond = Builder.CreateFCmpONE(EndCond, 
        +                                  ConstantFP::get(Type::DoubleTy, APFloat(0.0)),
        +                                  "loopcond");
        +  
        +  // Create the "after loop" block and insert it.
        +  BasicBlock *LoopEndBB = Builder.GetInsertBlock();
        +  BasicBlock *AfterBB = new BasicBlock("afterloop", TheFunction);
        +  
        +  // Insert the conditional branch into the end of LoopEndBB.
        +  Builder.CreateCondBr(EndCond, LoopBB, AfterBB);
        +  
        +  // Any new code will be inserted in AfterBB.
        +  Builder.SetInsertPoint(AfterBB);
        +  
        +  // Add a new entry to the PHI node for the backedge.
        +  Variable->addIncoming(NextVar, LoopEndBB);
        +  
        +  // Restore the unshadowed variable.
        +  if (OldVal)
        +    NamedValues[VarName] = OldVal;
        +  else
        +    NamedValues.erase(VarName);
        +
        +  
        +  // for expr always returns 0.0.
        +  return Constant::getNullValue(Type::DoubleTy);
        +}
        +
        +
        +
        From sabre at nondot.org Wed Oct 31 02:29:44 2007 From: sabre at nondot.org (Chris Lattner) Date: Wed, 31 Oct 2007 07:29:44 -0000 Subject: [llvm-commits] [llvm] r43548 - /llvm/trunk/docs/tutorial/LangImpl5.html Message-ID: <200710310729.l9V7TimW026749@zion.cs.uiuc.edu> Author: lattner Date: Wed Oct 31 02:29:43 2007 New Revision: 43548 URL: http://llvm.org/viewvc/llvm-project?rev=43548&view=rev Log: okay, fine, make me finish this chapter. :) Feedback appreciated! Modified: llvm/trunk/docs/tutorial/LangImpl5.html Modified: llvm/trunk/docs/tutorial/LangImpl5.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/LangImpl5.html?rev=43548&r1=43547&r2=43548&view=diff ============================================================================== --- llvm/trunk/docs/tutorial/LangImpl5.html (original) +++ llvm/trunk/docs/tutorial/LangImpl5.html Wed Oct 31 02:29:43 2007 @@ -479,14 +479,18 @@
        - # print 100 '*' (ascii 42) characters
          extern putchard(char)
        - for x = 1, x < 100, 1.0 in putchard(42);
        + def printstar(n)
        +   for i = 1, i < n, 1.0 in
        +     putchard(42);  # ascii 42 = '*'
        +     
        + # print 100 '*' characters
        + printstar(100);
         
        -

        This expression defines a new variable ("x" in this case) which iterates from -a starting value, while the condition ("x < 100" in this case) is true, +

        This expression defines a new variable ("i" in this case) which iterates from +a starting value, while the condition ("i < n" in this case) is true, incrementing by an optional step value ("1.0" in this case). If the step value is omitted, it defaults to 1.0. While the loop is true, it executes its body expression. Because we don't have anything better to return, we'll just @@ -623,9 +627,41 @@

        Now we get to the good part: the LLVM IR we want to generate for this thing. +With the simple example above, we get this LLVM IR (note that this dump is +generated with optimizations disabled):

        +
        +
        +declare double @putchard(double)
        +
        +define double @printstar(double %n) {
        +entry:
        +        ; initial value = 1.0 (inlined into phi)
        +	br label %loop
        +
        +loop:		; preds = %loop, %entry
        +	%i = phi double [ 1.000000e+00, %entry ], [ %nextvar, %loop ]
        +        ; body
        +	%calltmp = call double @putchard( double 4.200000e+01 )
        +        ; increment
        +	%nextvar = add double %i, 1.000000e+00
        +
        +        ; termination test
        +	%multmp = fcmp ult double %i, %n
        +	%booltmp = uitofp i1 %multmp to double
        +	%loopcond = fcmp one double %booltmp, 0.000000e+00
        +	br i1 %loopcond, label %loop, label %afterloop
        +
        +afterloop:		; preds = %loop
        +        ; loop always returns 0.0
        +	ret double 0.000000e+00
        +}
        +
        +
        +

        This loop contains all the same constructs we saw before: a phi node, several +expressions, and some basic blocks. Lets see how this fits together.

        @@ -636,30 +672,25 @@
        +

        The first part of codegen is very simple: we just output the start expression +for the loop value:

         Value *ForExprAST::Codegen() {
        -  // Output this as:
        -  //   ...
        -  //   start = startexpr
        -  //   goto loop
        -  // loop: 
        -  //   variable = phi [start, loopheader], [nextvariable, loopend]
        -  //   ...
        -  //   bodyexpr
        -  //   ...
        -  // loopend:
        -  //   step = stepexpr
        -  //   nextvariable = variable + step
        -  //   endcond = endexpr
        -  //   br endcond, loop, endloop
        -  // outloop:
        -  
           // Emit the start code first, without 'variable' in scope.
           Value *StartVal = Start->Codegen();
           if (StartVal == 0) return 0;
        -  
        +
        +
        + +

        With this out of the way, the next step is to set up the LLVM basic block +for the start of the loop body. In the case above, the whole loop body is one +block, but remember that the body code itself could consist of multiple blocks +(e.g. if it is a if/then/else expression).

        + +
        +
           // Make the new basic block for the loop header, inserting after current
           // block.
           Function *TheFunction = Builder.GetInsertBlock()->getParent();
        @@ -667,14 +698,35 @@
           BasicBlock *LoopBB = new BasicBlock("loop", TheFunction);
           
           // Insert an explicit fall through from the current block to the LoopBB.
        -  // Start insertion in LoopBB.
           Builder.CreateBr(LoopBB);
        +
        +
        + +

        This code is similar to what we saw for if/then/else. Because we will need +it to create the Phi node, we remember the block that falls through into the +loop. Once we have that, we create the actual block that starts the loop and +create an unconditional branch for the fall-through between the two blocks.

        + +
        +
        +  // Start insertion in LoopBB.
           Builder.SetInsertPoint(LoopBB);
           
           // Start the PHI node with an entry for Start.
           PHINode *Variable = Builder.CreatePHI(Type::DoubleTy, VarName.c_str());
           Variable->addIncoming(StartVal, PreheaderBB);
        -  
        +
        +
        + +

        Now that the "preheader" for the loop is set up, we switch to emitting code +for the loop body. To begin with, we move the insertion point and create the +PHI node for the loop induction variable. SInce we already know the incoming +value for the starting value, we add it to the Phi node. Note that the Phi will +eventually get a second value for the backedge, but we can't set it up yet +(because it doesn't exist!).

        + +
        +
           // Within the loop, the variable is defined equal to the PHI node.  If it
           // shadows an existing variable, we have to restore it, so save it now.
           Value *OldVal = NamedValues[VarName];
        @@ -685,7 +737,26 @@
           // allow an error.
           if (Body->Codegen() == 0)
             return 0;
        -  
        +
        +
        + +

        Now the code starts to get more interesting. Our 'for' loop introduces a new +variable to the symbol table. This means that our symbol table can now contain +either function arguments or loop variables. To handle this, before we codegen +the body of the loop, we add the loop variable as the current value for its +name. Note that it is possible that there is a variable of the same name in the +outer scope. It would be easy to make this an error (emit an error and return +null if there is already an entry for VarName) but we choose to allow shadowing +of variables. In order to handle this correctly, we remember the Value that +we are potentially shadowing in OldVal (which will be null if there is +no shadowed variable).

        + +

        Once the loop variable is set into the symbol table, the code recursively +codegen's the body. This allows the body to use the loop variable: any +references to it will naturally find it in the symbol table.

        + +
        +
           // Emit the step value.
           Value *StepVal;
           if (Step) {
        @@ -697,12 +768,15 @@
           }
           
           Value *NextVar = Builder.CreateAdd(Variable, StepVal, "nextvar");
        +
        +
        - // When evaluating the end condition, the value of the variable is the - // incremented value. - NamedValues[VarName] = Variable; - - +

        Now that the body is emitted, we compute the next value of the iteration +variable by adding the step value or 1.0 if it isn't present. 'NextVar' +will be the value of the loop variable on the next iteration of the loop.

        + +
        +
           // Compute the end condition.
           Value *EndCond = End->Codegen();
           if (EndCond == 0) return EndCond;
        @@ -711,7 +785,15 @@
           EndCond = Builder.CreateFCmpONE(EndCond, 
                                           ConstantFP::get(Type::DoubleTy, APFloat(0.0)),
                                           "loopcond");
        -  
        +
        +
        + +

        Finally, we evaluate the exit value of the loop, to determine whether the +loop should exit. This mirrors the condition evaluation for the if/then/else +statement.

        + +
        +
           // Create the "after loop" block and insert it.
           BasicBlock *LoopEndBB = Builder.GetInsertBlock();
           BasicBlock *AfterBB = new BasicBlock("afterloop", TheFunction);
        @@ -721,7 +803,18 @@
           
           // Any new code will be inserted in AfterBB.
           Builder.SetInsertPoint(AfterBB);
        +
        +
        + +

        With the code for the body of the loop complete, we just need to finish up +the control flow for it. This remembers the end block (for the phi node), then +creates the block for the loop exit ("afterloop"). Based on the value of the +exit condition, it creates a conditional branch that chooses between executing +the loop again and exiting the loop. Any future code is emitted in the +"afterloop" block, so it sets the insertion position to it.

        +
        +
           // Add a new entry to the PHI node for the backedge.
           Variable->addIncoming(NextVar, LoopEndBB);
           
        @@ -730,7 +823,6 @@
             NamedValues[VarName] = OldVal;
           else
             NamedValues.erase(VarName);
        -
           
           // for expr always returns 0.0.
           return Constant::getNullValue(Type::DoubleTy);
        @@ -738,6 +830,17 @@
         
        +

        The final code handles various cleanups: now that we have the "NextVar" +value, we can add the incoming value to the loop PHI node. After that, we +remove the loop variable from the symbol table, so that it isn't in scope after +the for loop. Finally, code generation of the for loop always returns 0.0, so +that is what we return from ForExprAST::Codegen.

        + +

        With this, we conclude the "adding control flow to Kaleidoscope" chapter of +the tutorial. We added two control flow constructs, and used them to motivate +a couple of aspects of the LLVM IR that are important for front-end implementors +to know. In the next chapter of our saga, we will get a bit crazier and add +operator overloading to our poor innocent language.

        @@ -765,7 +868,849 @@
        -...
        +#include "llvm/DerivedTypes.h"
        +#include "llvm/ExecutionEngine/ExecutionEngine.h"
        +#include "llvm/Module.h"
        +#include "llvm/ModuleProvider.h"
        +#include "llvm/PassManager.h"
        +#include "llvm/Analysis/Verifier.h"
        +#include "llvm/Target/TargetData.h"
        +#include "llvm/Transforms/Scalar.h"
        +#include "llvm/Support/LLVMBuilder.h"
        +#include <cstdio>
        +#include <string>
        +#include <map>
        +#include <vector>
        +using namespace llvm;
        +
        +//===----------------------------------------------------------------------===//
        +// Lexer
        +//===----------------------------------------------------------------------===//
        +
        +// The lexer returns tokens [0-255] if it is an unknown character, otherwise one
        +// of these for known things.
        +enum Token {
        +  tok_eof = -1,
        +
        +  // commands
        +  tok_def = -2, tok_extern = -3,
        +
        +  // primary
        +  tok_identifier = -4, tok_number = -5,
        +  
        +  // control
        +  tok_if = -6, tok_then = -7, tok_else = -8,
        +  tok_for = -9, tok_in = -10
        +};
        +
        +static std::string IdentifierStr;  // Filled in if tok_identifier
        +static double NumVal;              // Filled in if tok_number
        +
        +/// gettok - Return the next token from standard input.
        +static int gettok() {
        +  static int LastChar = ' ';
        +
        +  // Skip any whitespace.
        +  while (isspace(LastChar))
        +    LastChar = getchar();
        +
        +  if (isalpha(LastChar)) { // identifier: [a-zA-Z][a-zA-Z0-9]*
        +    IdentifierStr = LastChar;
        +    while (isalnum((LastChar = getchar())))
        +      IdentifierStr += LastChar;
        +
        +    if (IdentifierStr == "def") return tok_def;
        +    if (IdentifierStr == "extern") return tok_extern;
        +    if (IdentifierStr == "if") return tok_if;
        +    if (IdentifierStr == "then") return tok_then;
        +    if (IdentifierStr == "else") return tok_else;
        +    if (IdentifierStr == "for") return tok_for;
        +    if (IdentifierStr == "in") return tok_in;
        +    return tok_identifier;
        +  }
        +
        +  if (isdigit(LastChar) || LastChar == '.') {   // Number: [0-9.]+
        +    std::string NumStr;
        +    do {
        +      NumStr += LastChar;
        +      LastChar = getchar();
        +    } while (isdigit(LastChar) || LastChar == '.');
        +
        +    NumVal = strtod(NumStr.c_str(), 0);
        +    return tok_number;
        +  }
        +
        +  if (LastChar == '#') {
        +    // Comment until end of line.
        +    do LastChar = getchar();
        +    while (LastChar != EOF && LastChar != '\n' & LastChar != '\r');
        +    
        +    if (LastChar != EOF)
        +      return gettok();
        +  }
        +  
        +  // Check for end of file.  Don't eat the EOF.
        +  if (LastChar == EOF)
        +    return tok_eof;
        +
        +  // Otherwise, just return the character as its ascii value.
        +  int ThisChar = LastChar;
        +  LastChar = getchar();
        +  return ThisChar;
        +}
        +
        +//===----------------------------------------------------------------------===//
        +// Abstract Syntax Tree (aka Parse Tree)
        +//===----------------------------------------------------------------------===//
        +
        +/// ExprAST - Base class for all expression nodes.
        +class ExprAST {
        +public:
        +  virtual ~ExprAST() {}
        +  virtual Value *Codegen() = 0;
        +};
        +
        +/// NumberExprAST - Expression class for numeric literals like "1.0".
        +class NumberExprAST : public ExprAST {
        +  double Val;
        +public:
        +  NumberExprAST(double val) : Val(val) {}
        +  virtual Value *Codegen();
        +};
        +
        +/// VariableExprAST - Expression class for referencing a variable, like "a".
        +class VariableExprAST : public ExprAST {
        +  std::string Name;
        +public:
        +  VariableExprAST(const std::string &name) : Name(name) {}
        +  virtual Value *Codegen();
        +};
        +
        +/// BinaryExprAST - Expression class for a binary operator.
        +class BinaryExprAST : public ExprAST {
        +  char Op;
        +  ExprAST *LHS, *RHS;
        +public:
        +  BinaryExprAST(char op, ExprAST *lhs, ExprAST *rhs) 
        +    : Op(op), LHS(lhs), RHS(rhs) {}
        +  virtual Value *Codegen();
        +};
        +
        +/// CallExprAST - Expression class for function calls.
        +class CallExprAST : public ExprAST {
        +  std::string Callee;
        +  std::vector<ExprAST*> Args;
        +public:
        +  CallExprAST(const std::string &callee, std::vector<ExprAST*> &args)
        +    : Callee(callee), Args(args) {}
        +  virtual Value *Codegen();
        +};
        +
        +/// IfExprAST - Expression class for if/then/else.
        +class IfExprAST : public ExprAST {
        +  ExprAST *Cond, *Then, *Else;
        +public:
        +  IfExprAST(ExprAST *cond, ExprAST *then, ExprAST *_else)
        +  : Cond(cond), Then(then), Else(_else) {}
        +  virtual Value *Codegen();
        +};
        +
        +/// ForExprAST - Expression class for for/in.
        +class ForExprAST : public ExprAST {
        +  std::string VarName;
        +  ExprAST *Start, *End, *Step, *Body;
        +public:
        +  ForExprAST(const std::string &varname, ExprAST *start, ExprAST *end,
        +             ExprAST *step, ExprAST *body)
        +    : VarName(varname), Start(start), End(end), Step(step), Body(body) {}
        +  virtual Value *Codegen();
        +};
        +
        +/// PrototypeAST - This class represents the "prototype" for a function,
        +/// which captures its argument names as well as if it is an operator.
        +class PrototypeAST {
        +  std::string Name;
        +  std::vector<std::string> Args;
        +public:
        +  PrototypeAST(const std::string &name, const std::vector<std::string> &args)
        +    : Name(name), Args(args) {}
        +  
        +  Function *Codegen();
        +};
        +
        +/// FunctionAST - This class represents a function definition itself.
        +class FunctionAST {
        +  PrototypeAST *Proto;
        +  ExprAST *Body;
        +public:
        +  FunctionAST(PrototypeAST *proto, ExprAST *body)
        +    : Proto(proto), Body(body) {}
        +  
        +  Function *Codegen();
        +};
        +
        +//===----------------------------------------------------------------------===//
        +// Parser
        +//===----------------------------------------------------------------------===//
        +
        +/// CurTok/getNextToken - Provide a simple token buffer.  CurTok is the current
        +/// token the parser it looking at.  getNextToken reads another token from the
        +/// lexer and updates CurTok with its results.
        +static int CurTok;
        +static int getNextToken() {
        +  return CurTok = gettok();
        +}
        +
        +/// BinopPrecedence - This holds the precedence for each binary operator that is
        +/// defined.
        +static std::map<char, int> BinopPrecedence;
        +
        +/// GetTokPrecedence - Get the precedence of the pending binary operator token.
        +static int GetTokPrecedence() {
        +  if (!isascii(CurTok))
        +    return -1;
        +  
        +  // Make sure it's a declared binop.
        +  int TokPrec = BinopPrecedence[CurTok];
        +  if (TokPrec <= 0) return -1;
        +  return TokPrec;
        +}
        +
        +/// Error* - These are little helper functions for error handling.
        +ExprAST *Error(const char *Str) { fprintf(stderr, "Error: %s\n", Str);return 0;}
        +PrototypeAST *ErrorP(const char *Str) { Error(Str); return 0; }
        +FunctionAST *ErrorF(const char *Str) { Error(Str); return 0; }
        +
        +static ExprAST *ParseExpression();
        +
        +/// identifierexpr
        +///   ::= identifer
        +///   ::= identifer '(' expression* ')'
        +static ExprAST *ParseIdentifierExpr() {
        +  std::string IdName = IdentifierStr;
        +  
        +  getNextToken();  // eat identifer.
        +  
        +  if (CurTok != '(') // Simple variable ref.
        +    return new VariableExprAST(IdName);
        +  
        +  // Call.
        +  getNextToken();  // eat (
        +  std::vector<ExprAST*> Args;
        +  if (CurTok != ')') {
        +    while (1) {
        +      ExprAST *Arg = ParseExpression();
        +      if (!Arg) return 0;
        +      Args.push_back(Arg);
        +      
        +      if (CurTok == ')') break;
        +      
        +      if (CurTok != ',')
        +        return Error("Expected ')'");
        +      getNextToken();
        +    }
        +  }
        +
        +  // Eat the ')'.
        +  getNextToken();
        +  
        +  return new CallExprAST(IdName, Args);
        +}
        +
        +/// numberexpr ::= number
        +static ExprAST *ParseNumberExpr() {
        +  ExprAST *Result = new NumberExprAST(NumVal);
        +  getNextToken(); // consume the number
        +  return Result;
        +}
        +
        +/// parenexpr ::= '(' expression ')'
        +static ExprAST *ParseParenExpr() {
        +  getNextToken();  // eat (.
        +  ExprAST *V = ParseExpression();
        +  if (!V) return 0;
        +  
        +  if (CurTok != ')')
        +    return Error("expected ')'");
        +  getNextToken();  // eat ).
        +  return V;
        +}
        +
        +/// ifexpr ::= 'if' expression 'then' expression 'else' expression
        +static ExprAST *ParseIfExpr() {
        +  getNextToken();  // eat the if.
        +  
        +  // condition.
        +  ExprAST *Cond = ParseExpression();
        +  if (!Cond) return 0;
        +  
        +  if (CurTok != tok_then)
        +    return Error("expected then");
        +  getNextToken();  // eat the then
        +  
        +  ExprAST *Then = ParseExpression();
        +  if (Then == 0) return 0;
        +  
        +  if (CurTok != tok_else)
        +    return Error("expected else");
        +  
        +  getNextToken();
        +  
        +  ExprAST *Else = ParseExpression();
        +  if (!Else) return 0;
        +  
        +  return new IfExprAST(Cond, Then, Else);
        +}
        +
        +/// forexpr ::= 'for' identifer '=' expr ',' expr (',' expr)? 'in' expression
        +static ExprAST *ParseForExpr() {
        +  getNextToken();  // eat the for.
        +
        +  if (CurTok != tok_identifier)
        +    return Error("expected identifier after for");
        +  
        +  std::string IdName = IdentifierStr;
        +  getNextToken();  // eat identifer.
        +  
        +  if (CurTok != '=')
        +    return Error("expected '=' after for");
        +  getNextToken();  // eat '='.
        +  
        +  
        +  ExprAST *Start = ParseExpression();
        +  if (Start == 0) return 0;
        +  if (CurTok != ',')
        +    return Error("expected ',' after for start value");
        +  getNextToken();
        +  
        +  ExprAST *End = ParseExpression();
        +  if (End == 0) return 0;
        +  
        +  // The step value is optional.
        +  ExprAST *Step = 0;
        +  if (CurTok == ',') {
        +    getNextToken();
        +    Step = ParseExpression();
        +    if (Step == 0) return 0;
        +  }
        +  
        +  if (CurTok != tok_in)
        +    return Error("expected 'in' after for");
        +  getNextToken();  // eat 'in'.
        +  
        +  ExprAST *Body = ParseExpression();
        +  if (Body == 0) return 0;
        +
        +  return new ForExprAST(IdName, Start, End, Step, Body);
        +}
        +
        +
        +/// primary
        +///   ::= identifierexpr
        +///   ::= numberexpr
        +///   ::= parenexpr
        +///   ::= ifexpr
        +///   ::= forexpr
        +static ExprAST *ParsePrimary() {
        +  switch (CurTok) {
        +  default: return Error("unknown token when expecting an expression");
        +  case tok_identifier: return ParseIdentifierExpr();
        +  case tok_number:     return ParseNumberExpr();
        +  case '(':            return ParseParenExpr();
        +  case tok_if:         return ParseIfExpr();
        +  case tok_for:        return ParseForExpr();
        +  }
        +}
        +
        +/// binoprhs
        +///   ::= ('+' primary)*
        +static ExprAST *ParseBinOpRHS(int ExprPrec, ExprAST *LHS) {
        +  // If this is a binop, find its precedence.
        +  while (1) {
        +    int TokPrec = GetTokPrecedence();
        +    
        +    // If this is a binop that binds at least as tightly as the current binop,
        +    // consume it, otherwise we are done.
        +    if (TokPrec < ExprPrec)
        +      return LHS;
        +    
        +    // Okay, we know this is a binop.
        +    int BinOp = CurTok;
        +    getNextToken();  // eat binop
        +    
        +    // Parse the primary expression after the binary operator.
        +    ExprAST *RHS = ParsePrimary();
        +    if (!RHS) return 0;
        +    
        +    // If BinOp binds less tightly with RHS than the operator after RHS, let
        +    // the pending operator take RHS as its LHS.
        +    int NextPrec = GetTokPrecedence();
        +    if (TokPrec < NextPrec) {
        +      RHS = ParseBinOpRHS(TokPrec+1, RHS);
        +      if (RHS == 0) return 0;
        +    }
        +    
        +    // Merge LHS/RHS.
        +    LHS = new BinaryExprAST(BinOp, LHS, RHS);
        +  }
        +}
        +
        +/// expression
        +///   ::= primary binoprhs
        +///
        +static ExprAST *ParseExpression() {
        +  ExprAST *LHS = ParsePrimary();
        +  if (!LHS) return 0;
        +  
        +  return ParseBinOpRHS(0, LHS);
        +}
        +
        +/// prototype
        +///   ::= id '(' id* ')'
        +static PrototypeAST *ParsePrototype() {
        +  if (CurTok != tok_identifier)
        +    return ErrorP("Expected function name in prototype");
        +
        +  std::string FnName = IdentifierStr;
        +  getNextToken();
        +  
        +  if (CurTok != '(')
        +    return ErrorP("Expected '(' in prototype");
        +  
        +  std::vector<std::string> ArgNames;
        +  while (getNextToken() == tok_identifier)
        +    ArgNames.push_back(IdentifierStr);
        +  if (CurTok != ')')
        +    return ErrorP("Expected ')' in prototype");
        +  
        +  // success.
        +  getNextToken();  // eat ')'.
        +  
        +  return new PrototypeAST(FnName, ArgNames);
        +}
        +
        +/// definition ::= 'def' prototype expression
        +static FunctionAST *ParseDefinition() {
        +  getNextToken();  // eat def.
        +  PrototypeAST *Proto = ParsePrototype();
        +  if (Proto == 0) return 0;
        +
        +  if (ExprAST *E = ParseExpression())
        +    return new FunctionAST(Proto, E);
        +  return 0;
        +}
        +
        +/// toplevelexpr ::= expression
        +static FunctionAST *ParseTopLevelExpr() {
        +  if (ExprAST *E = ParseExpression()) {
        +    // Make an anonymous proto.
        +    PrototypeAST *Proto = new PrototypeAST("", std::vector<std::string>());
        +    return new FunctionAST(Proto, E);
        +  }
        +  return 0;
        +}
        +
        +/// external ::= 'extern' prototype
        +static PrototypeAST *ParseExtern() {
        +  getNextToken();  // eat extern.
        +  return ParsePrototype();
        +}
        +
        +//===----------------------------------------------------------------------===//
        +// Code Generation
        +//===----------------------------------------------------------------------===//
        +
        +static Module *TheModule;
        +static LLVMFoldingBuilder Builder;
        +static std::map<std::string, Value*> NamedValues;
        +static FunctionPassManager *TheFPM;
        +
        +Value *ErrorV(const char *Str) { Error(Str); return 0; }
        +
        +Value *NumberExprAST::Codegen() {
        +  return ConstantFP::get(Type::DoubleTy, APFloat(Val));
        +}
        +
        +Value *VariableExprAST::Codegen() {
        +  // Look this variable up in the function.
        +  Value *V = NamedValues[Name];
        +  return V ? V : ErrorV("Unknown variable name");
        +}
        +
        +Value *BinaryExprAST::Codegen() {
        +  Value *L = LHS->Codegen();
        +  Value *R = RHS->Codegen();
        +  if (L == 0 || R == 0) return 0;
        +  
        +  switch (Op) {
        +  case '+': return Builder.CreateAdd(L, R, "addtmp");
        +  case '-': return Builder.CreateSub(L, R, "subtmp");
        +  case '*': return Builder.CreateMul(L, R, "multmp");
        +  case '<':
        +    L = Builder.CreateFCmpULT(L, R, "multmp");
        +    // Convert bool 0/1 to double 0.0 or 1.0
        +    return Builder.CreateUIToFP(L, Type::DoubleTy, "booltmp");
        +  default: return ErrorV("invalid binary operator");
        +  }
        +}
        +
        +Value *CallExprAST::Codegen() {
        +  // Look up the name in the global module table.
        +  Function *CalleeF = TheModule->getFunction(Callee);
        +  if (CalleeF == 0)
        +    return ErrorV("Unknown function referenced");
        +  
        +  // If argument mismatch error.
        +  if (CalleeF->arg_size() != Args.size())
        +    return ErrorV("Incorrect # arguments passed");
        +
        +  std::vector<Value*> ArgsV;
        +  for (unsigned i = 0, e = Args.size(); i != e; ++i) {
        +    ArgsV.push_back(Args[i]->Codegen());
        +    if (ArgsV.back() == 0) return 0;
        +  }
        +  
        +  return Builder.CreateCall(CalleeF, ArgsV.begin(), ArgsV.end(), "calltmp");
        +}
        +
        +Value *IfExprAST::Codegen() {
        +  Value *CondV = Cond->Codegen();
        +  if (CondV == 0) return 0;
        +  
        +  // Convert condition to a bool by comparing equal to 0.0.
        +  CondV = Builder.CreateFCmpONE(CondV, 
        +                                ConstantFP::get(Type::DoubleTy, APFloat(0.0)),
        +                                "ifcond");
        +  
        +  Function *TheFunction = Builder.GetInsertBlock()->getParent();
        +  
        +  // Create blocks for the then and else cases.  Insert the 'then' block at the
        +  // end of the function.
        +  BasicBlock *ThenBB = new BasicBlock("then", TheFunction);
        +  BasicBlock *ElseBB = new BasicBlock("else");
        +  BasicBlock *MergeBB = new BasicBlock("ifcont");
        +  
        +  Builder.CreateCondBr(CondV, ThenBB, ElseBB);
        +  
        +  // Emit then value.
        +  Builder.SetInsertPoint(ThenBB);
        +  
        +  Value *ThenV = Then->Codegen();
        +  if (ThenV == 0) return 0;
        +  
        +  Builder.CreateBr(MergeBB);
        +  // Codegen of 'Then' can change the current block, update ThenBB for the PHI.
        +  ThenBB = Builder.GetInsertBlock();
        +  
        +  // Emit else block.
        +  TheFunction->getBasicBlockList().push_back(ElseBB);
        +  Builder.SetInsertPoint(ElseBB);
        +  
        +  Value *ElseV = Else->Codegen();
        +  if (ElseV == 0) return 0;
        +  
        +  Builder.CreateBr(MergeBB);
        +  // Codegen of 'Else' can change the current block, update ElseBB for the PHI.
        +  ElseBB = Builder.GetInsertBlock();
        +  
        +  // Emit merge block.
        +  TheFunction->getBasicBlockList().push_back(MergeBB);
        +  Builder.SetInsertPoint(MergeBB);
        +  PHINode *PN = Builder.CreatePHI(Type::DoubleTy, "iftmp");
        +  
        +  PN->addIncoming(ThenV, ThenBB);
        +  PN->addIncoming(ElseV, ElseBB);
        +  return PN;
        +}
        +
        +Value *ForExprAST::Codegen() {
        +  // Output this as:
        +  //   ...
        +  //   start = startexpr
        +  //   goto loop
        +  // loop: 
        +  //   variable = phi [start, loopheader], [nextvariable, loopend]
        +  //   ...
        +  //   bodyexpr
        +  //   ...
        +  // loopend:
        +  //   step = stepexpr
        +  //   nextvariable = variable + step
        +  //   endcond = endexpr
        +  //   br endcond, loop, endloop
        +  // outloop:
        +  
        +  // Emit the start code first, without 'variable' in scope.
        +  Value *StartVal = Start->Codegen();
        +  if (StartVal == 0) return 0;
        +  
        +  // Make the new basic block for the loop header, inserting after current
        +  // block.
        +  Function *TheFunction = Builder.GetInsertBlock()->getParent();
        +  BasicBlock *PreheaderBB = Builder.GetInsertBlock();
        +  BasicBlock *LoopBB = new BasicBlock("loop", TheFunction);
        +  
        +  // Insert an explicit fall through from the current block to the LoopBB.
        +  Builder.CreateBr(LoopBB);
        +
        +  // Start insertion in LoopBB.
        +  Builder.SetInsertPoint(LoopBB);
        +  
        +  // Start the PHI node with an entry for Start.
        +  PHINode *Variable = Builder.CreatePHI(Type::DoubleTy, VarName.c_str());
        +  Variable->addIncoming(StartVal, PreheaderBB);
        +  
        +  // Within the loop, the variable is defined equal to the PHI node.  If it
        +  // shadows an existing variable, we have to restore it, so save it now.
        +  Value *OldVal = NamedValues[VarName];
        +  NamedValues[VarName] = Variable;
        +  
        +  // Emit the body of the loop.  This, like any other expr, can change the
        +  // current BB.  Note that we ignore the value computed by the body, but don't
        +  // allow an error.
        +  if (Body->Codegen() == 0)
        +    return 0;
        +  
        +  // Emit the step value.
        +  Value *StepVal;
        +  if (Step) {
        +    StepVal = Step->Codegen();
        +    if (StepVal == 0) return 0;
        +  } else {
        +    // If not specified, use 1.0.
        +    StepVal = ConstantFP::get(Type::DoubleTy, APFloat(1.0));
        +  }
        +  
        +  Value *NextVar = Builder.CreateAdd(Variable, StepVal, "nextvar");
        +
        +  // Compute the end condition.
        +  Value *EndCond = End->Codegen();
        +  if (EndCond == 0) return EndCond;
        +  
        +  // Convert condition to a bool by comparing equal to 0.0.
        +  EndCond = Builder.CreateFCmpONE(EndCond, 
        +                                  ConstantFP::get(Type::DoubleTy, APFloat(0.0)),
        +                                  "loopcond");
        +  
        +  // Create the "after loop" block and insert it.
        +  BasicBlock *LoopEndBB = Builder.GetInsertBlock();
        +  BasicBlock *AfterBB = new BasicBlock("afterloop", TheFunction);
        +  
        +  // Insert the conditional branch into the end of LoopEndBB.
        +  Builder.CreateCondBr(EndCond, LoopBB, AfterBB);
        +  
        +  // Any new code will be inserted in AfterBB.
        +  Builder.SetInsertPoint(AfterBB);
        +  
        +  // Add a new entry to the PHI node for the backedge.
        +  Variable->addIncoming(NextVar, LoopEndBB);
        +  
        +  // Restore the unshadowed variable.
        +  if (OldVal)
        +    NamedValues[VarName] = OldVal;
        +  else
        +    NamedValues.erase(VarName);
        +
        +  
        +  // for expr always returns 0.0.
        +  return Constant::getNullValue(Type::DoubleTy);
        +}
        +
        +Function *PrototypeAST::Codegen() {
        +  // Make the function type:  double(double,double) etc.
        +  std::vector<const Type*> Doubles(Args.size(), Type::DoubleTy);
        +  FunctionType *FT = FunctionType::get(Type::DoubleTy, Doubles, false);
        +  
        +  Function *F = new Function(FT, Function::ExternalLinkage, Name, TheModule);
        +  
        +  // If F conflicted, there was already something named 'Name'.  If it has a
        +  // body, don't allow redefinition or reextern.
        +  if (F->getName() != Name) {
        +    // Delete the one we just made and get the existing one.
        +    F->eraseFromParent();
        +    F = TheModule->getFunction(Name);
        +    
        +    // If F already has a body, reject this.
        +    if (!F->empty()) {
        +      ErrorF("redefinition of function");
        +      return 0;
        +    }
        +    
        +    // If F took a different number of args, reject.
        +    if (F->arg_size() != Args.size()) {
        +      ErrorF("redefinition of function with different # args");
        +      return 0;
        +    }
        +  }
        +  
        +  // Set names for all arguments.
        +  unsigned Idx = 0;
        +  for (Function::arg_iterator AI = F->arg_begin(); Idx != Args.size();
        +       ++AI, ++Idx) {
        +    AI->setName(Args[Idx]);
        +    
        +    // Add arguments to variable symbol table.
        +    NamedValues[Args[Idx]] = AI;
        +  }
        +  
        +  return F;
        +}
        +
        +Function *FunctionAST::Codegen() {
        +  NamedValues.clear();
        +  
        +  Function *TheFunction = Proto->Codegen();
        +  if (TheFunction == 0)
        +    return 0;
        +  
        +  // Create a new basic block to start insertion into.
        +  BasicBlock *BB = new BasicBlock("entry", TheFunction);
        +  Builder.SetInsertPoint(BB);
        +  
        +  if (Value *RetVal = Body->Codegen()) {
        +    // Finish off the function.
        +    Builder.CreateRet(RetVal);
        +
        +    // Validate the generated code, checking for consistency.
        +    verifyFunction(*TheFunction);
        +
        +    // Optimize the function.
        +    TheFPM->run(*TheFunction);
        +    
        +    return TheFunction;
        +  }
        +  
        +  // Error reading body, remove function.
        +  TheFunction->eraseFromParent();
        +  return 0;
        +}
        +
        +//===----------------------------------------------------------------------===//
        +// Top-Level parsing and JIT Driver
        +//===----------------------------------------------------------------------===//
        +
        +static ExecutionEngine *TheExecutionEngine;
        +
        +static void HandleDefinition() {
        +  if (FunctionAST *F = ParseDefinition()) {
        +    if (Function *LF = F->Codegen()) {
        +      fprintf(stderr, "Read function definition:");
        +      LF->dump();
        +    }
        +  } else {
        +    // Skip token for error recovery.
        +    getNextToken();
        +  }
        +}
        +
        +static void HandleExtern() {
        +  if (PrototypeAST *P = ParseExtern()) {
        +    if (Function *F = P->Codegen()) {
        +      fprintf(stderr, "Read extern: ");
        +      F->dump();
        +    }
        +  } else {
        +    // Skip token for error recovery.
        +    getNextToken();
        +  }
        +}
        +
        +static void HandleTopLevelExpression() {
        +  // Evaluate a top level expression into an anonymous function.
        +  if (FunctionAST *F = ParseTopLevelExpr()) {
        +    if (Function *LF = F->Codegen()) {
        +      // JIT the function, returning a function pointer.
        +      void *FPtr = TheExecutionEngine->getPointerToFunction(LF);
        +      
        +      // Cast it to the right type (takes no arguments, returns a double) so we
        +      // can call it as a native function.
        +      double (*FP)() = (double (*)())FPtr;
        +      fprintf(stderr, "Evaluated to %f\n", FP());
        +    }
        +  } else {
        +    // Skip token for error recovery.
        +    getNextToken();
        +  }
        +}
        +
        +/// top ::= definition | external | expression | ';'
        +static void MainLoop() {
        +  while (1) {
        +    fprintf(stderr, "ready> ");
        +    switch (CurTok) {
        +    case tok_eof:    return;
        +    case ';':        getNextToken(); break;  // ignore top level semicolons.
        +    case tok_def:    HandleDefinition(); break;
        +    case tok_extern: HandleExtern(); break;
        +    default:         HandleTopLevelExpression(); break;
        +    }
        +  }
        +}
        +
        +
        +
        +//===----------------------------------------------------------------------===//
        +// "Library" functions that can be "extern'd" from user code.
        +//===----------------------------------------------------------------------===//
        +
        +/// putchard - putchar that takes a double and returns 0.
        +extern "C" 
        +double putchard(double X) {
        +  putchar((char)X);
        +  return 0;
        +}
        +
        +//===----------------------------------------------------------------------===//
        +// Main driver code.
        +//===----------------------------------------------------------------------===//
        +
        +int main() {
        +  // Install standard binary operators.
        +  // 1 is lowest precedence.
        +  BinopPrecedence['<'] = 10;
        +  BinopPrecedence['+'] = 20;
        +  BinopPrecedence['-'] = 20;
        +  BinopPrecedence['*'] = 40;  // highest.
        +
        +  // Prime the first token.
        +  fprintf(stderr, "ready> ");
        +  getNextToken();
        +
        +  // Make the module, which holds all the code.
        +  TheModule = new Module("my cool jit");
        +  
        +  // Create the JIT.
        +  TheExecutionEngine = ExecutionEngine::create(TheModule);
        +
        +  {
        +    ExistingModuleProvider OurModuleProvider(TheModule);
        +    FunctionPassManager OurFPM(&OurModuleProvider);
        +      
        +    // Set up the optimizer pipeline.  Start with registering info about how the
        +    // target lays out data structures.
        +    OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData()));
        +    // Do simple "peephole" optimizations and bit-twiddling optzns.
        +    OurFPM.add(createInstructionCombiningPass());
        +    // Reassociate expressions.
        +    OurFPM.add(createReassociatePass());
        +    // Eliminate Common SubExpressions.
        +    OurFPM.add(createGVNPass());
        +    // Simplify the control flow graph (deleting unreachable blocks, etc).
        +    OurFPM.add(createCFGSimplificationPass());
        +    // Set the global so the code gen can use this.
        +    TheFPM = &OurFPM;
        +
        +    // Run the main "interpreter loop" now.
        +    MainLoop();
        +    
        +    TheFPM = 0;
        +  }  // Free module provider and pass manager.
        +                                   
        +                                   
        +  // Print out all of the generated code.
        +  TheModule->dump();
        +  return 0;
        +}
         
        From sabre at nondot.org Wed Oct 31 02:30:40 2007 From: sabre at nondot.org (Chris Lattner) Date: Wed, 31 Oct 2007 07:30:40 -0000 Subject: [llvm-commits] [llvm] r43549 - /llvm/trunk/docs/tutorial/LangImpl4.html Message-ID: <200710310730.l9V7UeP2026955@zion.cs.uiuc.edu> Author: lattner Date: Wed Oct 31 02:30:39 2007 New Revision: 43549 URL: http://llvm.org/viewvc/llvm-project?rev=43549&view=rev Log: fix validation Modified: llvm/trunk/docs/tutorial/LangImpl4.html Modified: llvm/trunk/docs/tutorial/LangImpl4.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/LangImpl4.html?rev=43549&r1=43548&r2=43549&view=diff ============================================================================== --- llvm/trunk/docs/tutorial/LangImpl4.html (original) +++ llvm/trunk/docs/tutorial/LangImpl4.html Wed Oct 31 02:30:39 2007 @@ -360,7 +360,7 @@
        -ready> def testfunc(x y) x + y*2;  
        +ready> def testfunc(x y) x + y*2;  
         Read function definition:
         define double @testfunc(double %x, double %y) {
         entry:
        
        
        
        
        From baldrick at free.fr  Wed Oct 31 03:49:25 2007
        From: baldrick at free.fr (Duncan Sands)
        Date: Wed, 31 Oct 2007 08:49:25 -0000
        Subject: [llvm-commits] [llvm] r43550 - in /llvm/trunk:
         include/llvm/CodeGen/MachineDominators.h lib/CodeGen/MachineDominators.cpp
         lib/CodeGen/StrongPHIElimination.cpp
        Message-ID: <200710310849.l9V8nPTq006029@zion.cs.uiuc.edu>
        
        Author: baldrick
        Date: Wed Oct 31 03:49:24 2007
        New Revision: 43550
        
        URL: http://llvm.org/viewvc/llvm-project?rev=43550&view=rev
        Log:
        Add a newline at the end of the file.
        
        Modified:
            llvm/trunk/include/llvm/CodeGen/MachineDominators.h
            llvm/trunk/lib/CodeGen/MachineDominators.cpp
            llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp
        
        Modified: llvm/trunk/include/llvm/CodeGen/MachineDominators.h
        URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineDominators.h?rev=43550&r1=43549&r2=43550&view=diff
        
        ==============================================================================
        --- llvm/trunk/include/llvm/CodeGen/MachineDominators.h (original)
        +++ llvm/trunk/include/llvm/CodeGen/MachineDominators.h Wed Oct 31 03:49:24 2007
        @@ -181,4 +181,4 @@
         
         }
         
        -#endif
        \ No newline at end of file
        +#endif
        
        Modified: llvm/trunk/lib/CodeGen/MachineDominators.cpp
        URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineDominators.cpp?rev=43550&r1=43549&r2=43550&view=diff
        
        ==============================================================================
        --- llvm/trunk/lib/CodeGen/MachineDominators.cpp (original)
        +++ llvm/trunk/lib/CodeGen/MachineDominators.cpp Wed Oct 31 03:49:24 2007
        @@ -21,4 +21,4 @@
         
         char MachineDominatorTree::ID = 0;
         static RegisterPass
        -E("machinedomtree", "MachineDominator Tree Construction", true);
        \ No newline at end of file
        +E("machinedomtree", "MachineDominator Tree Construction", true);
        
        Modified: llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp
        URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp?rev=43550&r1=43549&r2=43550&view=diff
        
        ==============================================================================
        --- llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp (original)
        +++ llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Wed Oct 31 03:49:24 2007
        @@ -109,4 +109,4 @@
               worklist.pop_back();
             }
           }
        -}
        \ No newline at end of file
        +}
        
        
        
        
        From baldrick at free.fr  Wed Oct 31 03:57:43 2007
        From: baldrick at free.fr (Duncan Sands)
        Date: Wed, 31 Oct 2007 08:57:43 -0000
        Subject: [llvm-commits] [llvm] r43551 -
        	/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp
        Message-ID: <200710310857.l9V8vhAH006802@zion.cs.uiuc.edu>
        
        Author: baldrick
        Date: Wed Oct 31 03:57:43 2007
        New Revision: 43551
        
        URL: http://llvm.org/viewvc/llvm-project?rev=43551&view=rev
        Log:
        Promotion of sdiv/srem/udiv/urem.
        
        Modified:
            llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp
        
        Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp
        URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp?rev=43551&r1=43550&r2=43551&view=diff
        
        ==============================================================================
        --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp (original)
        +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Wed Oct 31 03:57:43 2007
        @@ -147,6 +147,8 @@
           SDOperand PromoteResult_SETCC(SDNode *N);
           SDOperand PromoteResult_LOAD(LoadSDNode *N);
           SDOperand PromoteResult_SimpleIntBinOp(SDNode *N);
        +  SDOperand PromoteResult_SDIV(SDNode *N);
        +  SDOperand PromoteResult_UDIV(SDNode *N);
           SDOperand PromoteResult_SHL(SDNode *N);
           SDOperand PromoteResult_SRA(SDNode *N);
           SDOperand PromoteResult_SRL(SDNode *N);
        @@ -554,6 +556,12 @@
           case ISD::SUB:
           case ISD::MUL:      Result = PromoteResult_SimpleIntBinOp(N); break;
         
        +  case ISD::SDIV:
        +  case ISD::SREM:     Result = PromoteResult_SDIV(N); break;
        +
        +  case ISD::UDIV:
        +  case ISD::UREM:     Result = PromoteResult_UDIV(N); break;
        +
           case ISD::SHL:      Result = PromoteResult_SHL(N); break;
           case ISD::SRA:      Result = PromoteResult_SRA(N); break;
           case ISD::SRL:      Result = PromoteResult_SRL(N); break;
        @@ -694,6 +702,30 @@
           return DAG.getNode(N->getOpcode(), LHS.getValueType(), LHS, RHS);
         }
         
        +SDOperand DAGTypeLegalizer::PromoteResult_SDIV(SDNode *N) {
        +  // Sign extend the input.
        +  SDOperand LHS = GetPromotedOp(N->getOperand(0));
        +  SDOperand RHS = GetPromotedOp(N->getOperand(1));
        +  MVT::ValueType VT = N->getValueType(0);
        +  LHS = DAG.getNode(ISD::SIGN_EXTEND_INREG, LHS.getValueType(), LHS,
        +                    DAG.getValueType(VT));
        +  RHS = DAG.getNode(ISD::SIGN_EXTEND_INREG, RHS.getValueType(), RHS,
        +                    DAG.getValueType(VT));
        +
        +  return DAG.getNode(N->getOpcode(), LHS.getValueType(), LHS, RHS);
        +}
        +
        +SDOperand DAGTypeLegalizer::PromoteResult_UDIV(SDNode *N) {
        +  // Zero extend the input.
        +  SDOperand LHS = GetPromotedOp(N->getOperand(0));
        +  SDOperand RHS = GetPromotedOp(N->getOperand(1));
        +  MVT::ValueType VT = N->getValueType(0);
        +  LHS = DAG.getZeroExtendInReg(LHS, VT);
        +  RHS = DAG.getZeroExtendInReg(RHS, VT);
        +
        +  return DAG.getNode(N->getOpcode(), LHS.getValueType(), LHS, RHS);
        +}
        +
         SDOperand DAGTypeLegalizer::PromoteResult_SHL(SDNode *N) {
           return DAG.getNode(ISD::SHL, TLI.getTypeToTransformTo(N->getValueType(0)),
                              GetPromotedOp(N->getOperand(0)), N->getOperand(1));
        
        
        
        
        From rafael.espindola at gmail.com  Wed Oct 31 06:52:08 2007
        From: rafael.espindola at gmail.com (Rafael Espindola)
        Date: Wed, 31 Oct 2007 11:52:08 -0000
        Subject: [llvm-commits] [llvm] r43552 - in /llvm/trunk/lib/Target:
         ARM/ARMISelLowering.cpp ARM/ARMSubtarget.h X86/X86ISelLowering.cpp
         X86/X86Subtarget.cpp X86/X86Subtarget.h
        Message-ID: <200710311152.l9VBq9no022304@zion.cs.uiuc.edu>
        
        Author: rafael
        Date: Wed Oct 31 06:52:06 2007
        New Revision: 43552
        
        URL: http://llvm.org/viewvc/llvm-project?rev=43552&view=rev
        Log:
        Make ARM an X86 memcpy expansion more similar to each other.
        Now both subtarget define getMaxInlineSizeThreshold and the expansion uses it.
        
        This should not change generated code.
        
        
        Modified:
            llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp
            llvm/trunk/lib/Target/ARM/ARMSubtarget.h
            llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
            llvm/trunk/lib/Target/X86/X86Subtarget.cpp
            llvm/trunk/lib/Target/X86/X86Subtarget.h
        
        Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp
        URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=43552&r1=43551&r2=43552&view=diff
        
        ==============================================================================
        --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original)
        +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Wed Oct 31 06:52:06 2007
        @@ -1315,7 +1315,8 @@
           // this once Thumb ldmia / stmia support is added.
           unsigned Size = I->getValue();
           if (AlwaysInline ||
        -      (!ST->isThumb() && Size < 64 && (Align & 3) == 0))
        +      (!ST->isThumb() && Size <= Subtarget->getMaxInlineSizeThreshold() &&
        +       (Align & 3) == 0))
             return LowerMEMCPYInline(ChainOp, DestOp, SourceOp, Size, Align, DAG);
           return LowerMEMCPYCall(ChainOp, DestOp, SourceOp, CountOp, DAG);
         }
        
        Modified: llvm/trunk/lib/Target/ARM/ARMSubtarget.h
        URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMSubtarget.h?rev=43552&r1=43551&r2=43552&view=diff
        
        ==============================================================================
        --- llvm/trunk/lib/Target/ARM/ARMSubtarget.h (original)
        +++ llvm/trunk/lib/Target/ARM/ARMSubtarget.h Wed Oct 31 06:52:06 2007
        @@ -62,6 +62,7 @@
           ///
           ARMSubtarget(const Module &M, const std::string &FS, bool thumb);
         
        +  unsigned getMaxInlineSizeThreshold() const { return 64; }
           /// ParseSubtargetFeatures - Parses features string setting specified 
           /// subtarget options.  Definition of function is auto generated by tblgen.
           void ParseSubtargetFeatures(const std::string &FS, const std::string &CPU);
        
        Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
        URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=43552&r1=43551&r2=43552&view=diff
        
        ==============================================================================
        --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
        +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Wed Oct 31 06:52:06 2007
        @@ -4332,7 +4332,7 @@
           // The libc version is likely to be faster for these cases. It can use the
           // address value and run time information about the CPU.
           if ((Align & 3) != 0 ||
        -      (I && I->getValue() > Subtarget->getMinRepStrSizeThreshold())) {
        +      (I && I->getValue() > Subtarget->getMaxInlineSizeThreshold())) {
             MVT::ValueType IntPtr = getPointerTy();
             const Type *IntPtrTy = getTargetData()->getIntPtrType();
             TargetLowering::ArgListTy Args; 
        @@ -4510,7 +4510,7 @@
             return LowerMEMCPYCall(ChainOp, DestOp, SourceOp, CountOp, DAG);
         
           // If size is more than the threshold, call memcpy.
        -  if (Size > Subtarget->getMinRepStrSizeThreshold())
        +  if (Size > Subtarget->getMaxInlineSizeThreshold())
             return LowerMEMCPYCall(ChainOp, DestOp, SourceOp, CountOp, DAG);
         
           return LowerMEMCPYInline(ChainOp, DestOp, SourceOp, Size, Align, DAG);
        
        Modified: llvm/trunk/lib/Target/X86/X86Subtarget.cpp
        URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.cpp?rev=43552&r1=43551&r2=43552&view=diff
        
        ==============================================================================
        --- llvm/trunk/lib/Target/X86/X86Subtarget.cpp (original)
        +++ llvm/trunk/lib/Target/X86/X86Subtarget.cpp Wed Oct 31 06:52:06 2007
        @@ -223,7 +223,7 @@
           , HasX86_64(false)
           , stackAlignment(8)
           // FIXME: this is a known good value for Yonah. How about others?
        -  , MinRepStrSizeThreshold(128)
        +  , MaxInlineSizeThreshold(128)
           , Is64Bit(is64Bit)
           , HasLow4GUserAddress(true)
           , TargetType(isELF) { // Default to ELF unless otherwise specified.
        
        Modified: llvm/trunk/lib/Target/X86/X86Subtarget.h
        URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.h?rev=43552&r1=43551&r2=43552&view=diff
        
        ==============================================================================
        --- llvm/trunk/lib/Target/X86/X86Subtarget.h (original)
        +++ llvm/trunk/lib/Target/X86/X86Subtarget.h Wed Oct 31 06:52:06 2007
        @@ -69,9 +69,9 @@
           /// entry to the function and which must be maintained by every function.
           unsigned stackAlignment;
         
        -  /// Min. memset / memcpy size that is turned into rep/movs, rep/stos ops.
        +  /// Max. memset / memcpy size that is turned into rep/movs, rep/stos ops.
           ///
        -  unsigned MinRepStrSizeThreshold;
        +  unsigned MaxInlineSizeThreshold;
         
         private:
           /// Is64Bit - True if the processor supports 64-bit instructions and module
        @@ -97,11 +97,9 @@
           /// function for this subtarget.
           unsigned getStackAlignment() const { return stackAlignment; }
         
        -  /// getMinRepStrSizeThreshold - Returns the minimum memset / memcpy size
        -  /// required to turn the operation into a X86 rep/movs or rep/stos
        -  /// instruction. This is only used if the src / dst alignment is not DWORD
        -  /// aligned.
        -  unsigned getMinRepStrSizeThreshold() const { return MinRepStrSizeThreshold; }
        +  /// getMaxInlineSizeThreshold - Returns the maximum memset / memcpy size
        +  /// that still makes it profitable to inline the call.
        +  unsigned getMaxInlineSizeThreshold() const { return MaxInlineSizeThreshold; }
         
           /// ParseSubtargetFeatures - Parses features string setting specified
           /// subtarget options.  Definition of function is auto generated by tblgen.
        
        
        
        
        From criswell at cs.uiuc.edu  Wed Oct 31 09:30:08 2007
        From: criswell at cs.uiuc.edu (John Criswell)
        Date: Wed, 31 Oct 2007 09:30:08 -0500
        Subject: [llvm-commits] CVS: llvm-www/Users.html
        Message-ID: <200710311430.JAA21770@choi.cs.uiuc.edu>
        
        
        
        Changes in directory llvm-www:
        
        Users.html updated: 1.23 -> 1.24
        ---
        Log message:
        
        Changed "Academic/Research" to "Academic Research" per Vikram's request.
        
        
        ---
        Diffs of the changes:  (+2 -2)
        
         Users.html |    4 ++--
         1 files changed, 2 insertions(+), 2 deletions(-)
        
        
        Index: llvm-www/Users.html
        diff -u llvm-www/Users.html:1.23 llvm-www/Users.html:1.24
        --- llvm-www/Users.html:1.23	Tue Oct 30 21:22:28 2007
        +++ llvm-www/Users.html	Wed Oct 31 09:29:25 2007
        @@ -76,7 +76,7 @@
         
         
         
        -
        Academic/Research Users
        +
        Academic Research Users

        @@ -272,6 +272,6 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!">
        LLVM Development List
        - Last modified: $Date: 2007/10/31 02:22:28 $ + Last modified: $Date: 2007/10/31 14:29:25 $ From djg at cray.com Wed Oct 31 09:35:40 2007 From: djg at cray.com (Dan Gohman) Date: Wed, 31 Oct 2007 14:35:40 -0000 Subject: [llvm-commits] [llvm] r43553 - /llvm/trunk/lib/Transforms/Scalar/LICM.cpp Message-ID: <200710311435.l9VEZe3X029408@zion.cs.uiuc.edu> Author: djg Date: Wed Oct 31 09:35:39 2007 New Revision: 43553 URL: http://llvm.org/viewvc/llvm-project?rev=43553&view=rev Log: Fix a typo in a comment. Modified: llvm/trunk/lib/Transforms/Scalar/LICM.cpp Modified: llvm/trunk/lib/Transforms/Scalar/LICM.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LICM.cpp?rev=43553&r1=43552&r2=43553&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LICM.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LICM.cpp Wed Oct 31 09:35:39 2007 @@ -802,7 +802,7 @@ // If one use of value V inside the loop is safe then it is OK to promote // this value. On the otherside if there is not any unsafe use inside the - // looop then also it is OK to promote this value. Otherwise it is + // loop then also it is OK to promote this value. Otherwise it is // unsafe to promote this value. if (PointerOk) { bool oneSafeUse = false; From rafael.espindola at gmail.com Wed Oct 31 09:39:59 2007 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Wed, 31 Oct 2007 14:39:59 -0000 Subject: [llvm-commits] [llvm] r43554 - in /llvm/trunk/lib/Target: ARM/ARMISelLowering.cpp ARM/ARMISelLowering.h ARM/ARMSubtarget.h X86/X86ISelLowering.cpp Message-ID: <200710311439.l9VEdxdu029568@zion.cs.uiuc.edu> Author: rafael Date: Wed Oct 31 09:39:58 2007 New Revision: 43554 URL: http://llvm.org/viewvc/llvm-project?rev=43554&view=rev Log: Make ARM and X86 LowerMEMCPY identical by moving the isThumb check into getMaxInlineSizeThreshold and by restructuring the X86 version. New I just have to move this to a common place :-) Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp llvm/trunk/lib/Target/ARM/ARMISelLowering.h llvm/trunk/lib/Target/ARM/ARMSubtarget.h llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=43554&r1=43553&r2=43554&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Wed Oct 31 09:39:58 2007 @@ -1287,8 +1287,7 @@ return DAG.getNode(ISD::BUILD_PAIR, MVT::i64, Lo, Hi); } -SDOperand ARMTargetLowering::LowerMEMCPY(SDOperand Op, SelectionDAG &DAG, - const ARMSubtarget *ST) { +SDOperand ARMTargetLowering::LowerMEMCPY(SDOperand Op, SelectionDAG &DAG) { SDOperand ChainOp = Op.getOperand(0); SDOperand DestOp = Op.getOperand(1); SDOperand SourceOp = Op.getOperand(2); @@ -1311,11 +1310,9 @@ // The libc version is likely to be faster for the these cases. It can // use the address value and run time information about the CPU. // With glibc 2.6.1 on a core 2, coping an array of 100M longs was 30% faster - // FIXME: For now, we don't lower memcpy's to loads / stores for Thumb. Change - // this once Thumb ldmia / stmia support is added. unsigned Size = I->getValue(); if (AlwaysInline || - (!ST->isThumb() && Size <= Subtarget->getMaxInlineSizeThreshold() && + (Size <= Subtarget->getMaxInlineSizeThreshold() && (Align & 3) == 0)) return LowerMEMCPYInline(ChainOp, DestOp, SourceOp, Size, Align, DAG); return LowerMEMCPYCall(ChainOp, DestOp, SourceOp, CountOp, DAG); @@ -1461,7 +1458,7 @@ case ISD::RETURNADDR: break; case ISD::FRAMEADDR: break; case ISD::GLOBAL_OFFSET_TABLE: return LowerGLOBAL_OFFSET_TABLE(Op, DAG); - case ISD::MEMCPY: return LowerMEMCPY(Op, DAG, Subtarget); + case ISD::MEMCPY: return LowerMEMCPY(Op, DAG); } return SDOperand(); } Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.h?rev=43554&r1=43553&r2=43554&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.h (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.h Wed Oct 31 09:39:58 2007 @@ -134,8 +134,7 @@ SDOperand LowerGLOBAL_OFFSET_TABLE(SDOperand Op, SelectionDAG &DAG); SDOperand LowerFORMAL_ARGUMENTS(SDOperand Op, SelectionDAG &DAG); SDOperand LowerBR_JT(SDOperand Op, SelectionDAG &DAG); - SDOperand LowerMEMCPY(SDOperand Op, SelectionDAG &DAG, - const ARMSubtarget *ST); + SDOperand LowerMEMCPY(SDOperand Op, SelectionDAG &DAG); SDOperand LowerMEMCPYCall(SDOperand Chain, SDOperand Dest, SDOperand Source, SDOperand Count, SelectionDAG &DAG); Modified: llvm/trunk/lib/Target/ARM/ARMSubtarget.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMSubtarget.h?rev=43554&r1=43553&r2=43554&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMSubtarget.h (original) +++ llvm/trunk/lib/Target/ARM/ARMSubtarget.h Wed Oct 31 09:39:58 2007 @@ -62,7 +62,11 @@ /// ARMSubtarget(const Module &M, const std::string &FS, bool thumb); - unsigned getMaxInlineSizeThreshold() const { return 64; } + unsigned getMaxInlineSizeThreshold() const { + // FIXME: For now, we don't lower memcpy's to loads / stores for Thumb. + // Change this once Thumb ldmia / stmia support is added. + return isThumb() ? 0 : 64; + } /// ParseSubtargetFeatures - Parses features string setting specified /// subtarget options. Definition of function is auto generated by tblgen. void ParseSubtargetFeatures(const std::string &FS, const std::string &CPU); Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=43554&r1=43553&r2=43554&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Wed Oct 31 09:39:58 2007 @@ -4496,24 +4496,17 @@ assert(!AlwaysInline && "Cannot inline copy of unknown size"); return LowerMEMCPYCall(ChainOp, DestOp, SourceOp, CountOp, DAG); } - unsigned Size = I->getValue(); - - if (AlwaysInline) - return LowerMEMCPYInline(ChainOp, DestOp, SourceOp, Size, Align, DAG); + // If not DWORD aligned or if size is more than threshold, then call memcpy. // The libc version is likely to be faster for the following cases. It can // use the address value and run time information about the CPU. // With glibc 2.6.1 on a core 2, coping an array of 100M longs was 30% faster - - // If not DWORD aligned, call memcpy. - if ((Align & 3) != 0) - return LowerMEMCPYCall(ChainOp, DestOp, SourceOp, CountOp, DAG); - - // If size is more than the threshold, call memcpy. - if (Size > Subtarget->getMaxInlineSizeThreshold()) - return LowerMEMCPYCall(ChainOp, DestOp, SourceOp, CountOp, DAG); - - return LowerMEMCPYInline(ChainOp, DestOp, SourceOp, Size, Align, DAG); + unsigned Size = I->getValue(); + if (AlwaysInline || + (Size <= Subtarget->getMaxInlineSizeThreshold() && + (Align & 3) == 0)) + return LowerMEMCPYInline(ChainOp, DestOp, SourceOp, Size, Align, DAG); + return LowerMEMCPYCall(ChainOp, DestOp, SourceOp, CountOp, DAG); } SDOperand X86TargetLowering::LowerMEMCPYCall(SDOperand Chain, From kremenek at apple.com Wed Oct 31 12:12:47 2007 From: kremenek at apple.com (Ted Kremenek) Date: Wed, 31 Oct 2007 17:12:47 -0000 Subject: [llvm-commits] [llvm] r43559 - /llvm/trunk/include/llvm/ADT/FoldingSet.h Message-ID: <200710311712.l9VHCljW005349@zion.cs.uiuc.edu> Author: kremenek Date: Wed Oct 31 12:12:47 2007 New Revision: 43559 URL: http://llvm.org/viewvc/llvm-project?rev=43559&view=rev Log: Changed access control within FoldingSet for some ivars from "private" to "protected". This allows iterators to work. Modified: llvm/trunk/include/llvm/ADT/FoldingSet.h Modified: llvm/trunk/include/llvm/ADT/FoldingSet.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/FoldingSet.h?rev=43559&r1=43558&r2=43559&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/FoldingSet.h (original) +++ llvm/trunk/include/llvm/ADT/FoldingSet.h Wed Oct 31 12:12:47 2007 @@ -106,7 +106,7 @@ /// back to the bucket to facilitate node removal. /// class FoldingSetImpl { -private: +protected: /// Buckets - Array of bucket chains. /// void **Buckets; From kremenek at apple.com Wed Oct 31 13:23:21 2007 From: kremenek at apple.com (Ted Kremenek) Date: Wed, 31 Oct 2007 18:23:21 -0000 Subject: [llvm-commits] [llvm] r43565 - in /llvm/trunk: include/llvm/Bitcode/Serialize.h lib/Bitcode/Writer/Serialize.cpp Message-ID: <200710311823.l9VINMHR009220@zion.cs.uiuc.edu> Author: kremenek Date: Wed Oct 31 13:23:21 2007 New Revision: 43565 URL: http://llvm.org/viewvc/llvm-project?rev=43565&view=rev Log: Added Serializer::EmitRef to deal with emitting arbitrary references. Modified Serializer::EmitPtr to handle const pointers. Modified: llvm/trunk/include/llvm/Bitcode/Serialize.h llvm/trunk/lib/Bitcode/Writer/Serialize.cpp Modified: llvm/trunk/include/llvm/Bitcode/Serialize.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/Serialize.h?rev=43565&r1=43564&r2=43565&view=diff ============================================================================== --- llvm/trunk/include/llvm/Bitcode/Serialize.h (original) +++ llvm/trunk/include/llvm/Bitcode/Serialize.h Wed Oct 31 13:23:21 2007 @@ -27,7 +27,7 @@ SmallVector Record; bool inBlock; - typedef DenseMap MapTy; + typedef DenseMap MapTy; MapTy PtrMap; public: @@ -42,7 +42,10 @@ void EmitCStr(const char* beg, const char* end); void EmitCStr(const char* cstr); - void EmitPtr(void* ptr) { EmitInt(getPtrId(ptr)); } + void EmitPtr(const void* ptr) { EmitInt(getPtrId(ptr)); } + + template + void EmitRef(const T& ref) { EmitPtr(&ref); } template void EmitOwnedPtr(T* ptr) { @@ -55,7 +58,7 @@ private: void EmitRecord(); inline bool inRecord() { return Record.size() > 0; } - unsigned getPtrId(void* ptr); + unsigned getPtrId(const void* ptr); }; } // end namespace llvm Modified: llvm/trunk/lib/Bitcode/Writer/Serialize.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/Serialize.cpp?rev=43565&r1=43564&r2=43565&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Writer/Serialize.cpp (original) +++ llvm/trunk/lib/Bitcode/Writer/Serialize.cpp Wed Oct 31 13:23:21 2007 @@ -57,7 +57,7 @@ EmitCStr(s,s+strlen(s)); } -unsigned Serializer::getPtrId(void* ptr) { +unsigned Serializer::getPtrId(const void* ptr) { if (!ptr) return 0; From kremenek at apple.com Wed Oct 31 14:58:32 2007 From: kremenek at apple.com (Ted Kremenek) Date: Wed, 31 Oct 2007 19:58:32 -0000 Subject: [llvm-commits] [llvm] r43570 - in /llvm/trunk: include/llvm/Bitcode/Deserialize.h lib/Bitcode/Reader/Deserialize.cpp Message-ID: <200710311958.l9VJwXQD014203@zion.cs.uiuc.edu> Author: kremenek Date: Wed Oct 31 14:58:32 2007 New Revision: 43570 URL: http://llvm.org/viewvc/llvm-project?rev=43570&view=rev Log: Implemented deserialization of references. References are handled just like pointers, except that they cannot be backpatched. This means that references are essentially non-owning pointers where the referred object must be deserialized prior to the reference being deserialized. Because of the nature of references, this ordering of objects is always possible. Fixed a bug in backpatching code (returning the backpatched pointer would accidentally include a bit flag). Modified: llvm/trunk/include/llvm/Bitcode/Deserialize.h llvm/trunk/lib/Bitcode/Reader/Deserialize.cpp Modified: llvm/trunk/include/llvm/Bitcode/Deserialize.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/Deserialize.h?rev=43570&r1=43569&r2=43570&view=diff ============================================================================== --- llvm/trunk/include/llvm/Bitcode/Deserialize.h (original) +++ llvm/trunk/include/llvm/Bitcode/Deserialize.h Wed Oct 31 14:58:32 2007 @@ -56,7 +56,7 @@ BPatchEntry(void* P) : Ptr(reinterpret_cast(P)) {} - bool hasFinalPtr() const { return Ptr & 0x1 ? true : false; } + bool hasFinalPtr() const { return Ptr & 0x1 ? false : true; } void setFinalPtr(BPNode*& FreeList, void* P); BPNode* getBPNode() const { @@ -69,7 +69,10 @@ Ptr = reinterpret_cast(N) | 0x1; } - uintptr_t getRawPtr() const { return Ptr; } + uintptr_t getFinalPtr() const { + assert (!(Ptr & 0x1) && "Backpatch pointer not yet deserialized."); + return Ptr; + } static inline bool isPod() { return true; } }; @@ -132,17 +135,30 @@ } template - void ReadPtr(T*& PtrRef) { ReadUIntPtr(reinterpret_cast(PtrRef));} - - void ReadPtr(uintptr_t& PtrRef) { ReadUIntPtr(PtrRef); } + void ReadPtr(T*& PtrRef) { + ReadUIntPtr(reinterpret_cast(PtrRef)); + } + template + void ReadPtr(const T*& PtrRef) { + ReadPtr(const_cast(PtrRef)); + } + void ReadUIntPtr(uintptr_t& PtrRef); + template + T& ReadRef() { + T* p = reinterpret_cast(ReadInternalRefPtr()); + return *p; + } + + void RegisterPtr(unsigned PtrId, void* Ptr); private: void ReadRecord(); bool inRecord(); + uintptr_t ReadInternalRefPtr(); }; } // end namespace llvm Modified: llvm/trunk/lib/Bitcode/Reader/Deserialize.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/Deserialize.cpp?rev=43570&r1=43569&r2=43570&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Reader/Deserialize.cpp (original) +++ llvm/trunk/lib/Bitcode/Reader/Deserialize.cpp Wed Oct 31 14:58:32 2007 @@ -115,7 +115,7 @@ BPatchEntry& E = BPatchMap[PtrId]; if (E.hasFinalPtr()) - PtrRef = E.getRawPtr(); + PtrRef = E.getFinalPtr(); else { // Register backpatch. Check the freelist for a BPNode. BPNode* N; @@ -132,6 +132,18 @@ } } +uintptr_t Deserializer::ReadInternalRefPtr() { + unsigned PtrId = ReadInt(); + + assert (PtrId != 0 && "References cannot refer the NULL address."); + + BPatchEntry& E = BPatchMap[PtrId]; + + assert (E.hasFinalPtr() && + "Cannot backpatch references. Object must be already deserialized."); + + return E.getFinalPtr(); +} void Deserializer::BPatchEntry::setFinalPtr(BPNode*& FreeList, void* P) { assert (!hasFinalPtr()); From resistor at mac.com Wed Oct 31 16:04:18 2007 From: resistor at mac.com (Owen Anderson) Date: Wed, 31 Oct 2007 21:04:18 -0000 Subject: [llvm-commits] [llvm] r43578 - /llvm/trunk/lib/VMCore/Verifier.cpp Message-ID: <200710312104.l9VL4I2M017819@zion.cs.uiuc.edu> Author: resistor Date: Wed Oct 31 16:04:18 2007 New Revision: 43578 URL: http://llvm.org/viewvc/llvm-project?rev=43578&view=rev Log: Add a preverifier pass to check that every basic block ends in a terminator, so that we don't segfault when verifying invalid code. Modified: llvm/trunk/lib/VMCore/Verifier.cpp Modified: llvm/trunk/lib/VMCore/Verifier.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=43578&r1=43577&r2=43578&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Verifier.cpp (original) +++ llvm/trunk/lib/VMCore/Verifier.cpp Wed Oct 31 16:04:18 2007 @@ -71,7 +71,25 @@ cl::opt Pedantic("verify-pedantic", cl::desc("Reject code with undefined behaviour")); - + + struct VISIBILITY_HIDDEN PreVerifier : public FunctionPass { + static char ID; // Pass ID, replacement for typeid + + PreVerifier() : FunctionPass((intptr_t)&ID) { } + + bool runOnFunction(Function &F) { + for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) + assert(I->back().isTerminator() + && "Block does not end with a terminator?"); + + return false; + } + }; + + char PreVerifier::ID = 0; + RegisterPass PreVer("preverify", "Preliminary module verification"); + const PassInfo *PreVerifyID = PreVer.getPassInfo(); + struct VISIBILITY_HIDDEN Verifier : public FunctionPass, InstVisitor { static char ID; // Pass ID, replacement for typeid @@ -161,6 +179,7 @@ virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); + AU.addRequiredID(PreVerifyID); if (RealPass) AU.addRequired(); } From dpatel at apple.com Wed Oct 31 16:20:58 2007 From: dpatel at apple.com (Devang Patel) Date: Wed, 31 Oct 2007 14:20:58 -0700 Subject: [llvm-commits] [llvm] r43578 - /llvm/trunk/lib/VMCore/Verifier.cpp In-Reply-To: <200710312104.l9VL4I2M017819@zion.cs.uiuc.edu> References: <200710312104.l9VL4I2M017819@zion.cs.uiuc.edu> Message-ID: <149102B2-89C1-419E-8FFF-D715A12D90B3@apple.com> Why can't you check this at the beginning of Verifier::visitBasicBlock() ? - Devang // verifyBasicBlock - Verify that a basic block is well formed... // void Verifier::visitBasicBlock(BasicBlock &BB) { On Oct 31, 2007, at 2:04 PM, Owen Anderson wrote: > Author: resistor > Date: Wed Oct 31 16:04:18 2007 > New Revision: 43578 > > URL: http://llvm.org/viewvc/llvm-project?rev=43578&view=rev > Log: > Add a preverifier pass to check that every basic block ends in a > terminator, so that we don't segfault when verifying invalid code. > > Modified: > llvm/trunk/lib/VMCore/Verifier.cpp > > Modified: llvm/trunk/lib/VMCore/Verifier.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=43578&r1=43577&r2=43578&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/VMCore/Verifier.cpp (original) > +++ llvm/trunk/lib/VMCore/Verifier.cpp Wed Oct 31 16:04:18 2007 > @@ -71,7 +71,25 @@ > cl::opt > Pedantic("verify-pedantic", > cl::desc("Reject code with undefined behaviour")); > - > + > + struct VISIBILITY_HIDDEN PreVerifier : public FunctionPass { > + static char ID; // Pass ID, replacement for typeid > + > + PreVerifier() : FunctionPass((intptr_t)&ID) { } > + > + bool runOnFunction(Function &F) { > + for (Function::iterator I = F.begin(), E = F.end(); I != E; + > +I) > + assert(I->back().isTerminator() > + && "Block does not end with a terminator?"); > + > + return false; > + } > + }; > + > + char PreVerifier::ID = 0; > + RegisterPass PreVer("preverify", "Preliminary module > verification"); > + const PassInfo *PreVerifyID = PreVer.getPassInfo(); > + > struct VISIBILITY_HIDDEN > Verifier : public FunctionPass, InstVisitor { > static char ID; // Pass ID, replacement for typeid > @@ -161,6 +179,7 @@ > > virtual void getAnalysisUsage(AnalysisUsage &AU) const { > AU.setPreservesAll(); > + AU.addRequiredID(PreVerifyID); > if (RealPass) > AU.addRequired(); > } > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits - Devang From djg at cray.com Wed Oct 31 16:36:32 2007 From: djg at cray.com (Dan Gohman) Date: Wed, 31 Oct 2007 21:36:32 -0000 Subject: [llvm-commits] [llvm] r43579 - /llvm/trunk/lib/VMCore/ConstantFold.cpp Message-ID: <200710312136.l9VLaWUN020601@zion.cs.uiuc.edu> Author: djg Date: Wed Oct 31 16:36:31 2007 New Revision: 43579 URL: http://llvm.org/viewvc/llvm-project?rev=43579&view=rev Log: Fix a regression in test/CodeGen/X86/2007-04-24-VectorCrash.ll introduced by r43510. Gracefully handle constants with vector type that aren't ConstantVector or ConstantAggregateZero. Modified: llvm/trunk/lib/VMCore/ConstantFold.cpp Modified: llvm/trunk/lib/VMCore/ConstantFold.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ConstantFold.cpp?rev=43579&r1=43578&r2=43579&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/ConstantFold.cpp (original) +++ llvm/trunk/lib/VMCore/ConstantFold.cpp Wed Oct 31 16:36:31 2007 @@ -716,10 +716,8 @@ } else if (const VectorType *VTy = dyn_cast(C1->getType())) { const ConstantVector *CP1 = dyn_cast(C1); const ConstantVector *CP2 = dyn_cast(C2); - assert((CP1 != NULL || isa(C1)) && - "Unexpected kind of vector constant!"); - assert((CP2 != NULL || isa(C2)) && - "Unexpected kind of vector constant!"); + if ((CP1 != NULL || isa(C1)) && + (CP2 != NULL || isa(C2))) { switch (Opcode) { default: break; @@ -747,6 +745,7 @@ return EvalVectorOp(CP1, CP2, VTy, ConstantExpr::getOr); case Instruction::Xor: return EvalVectorOp(CP1, CP2, VTy, ConstantExpr::getXor); + } } } From asl at math.spbu.ru Wed Oct 31 16:30:33 2007 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Thu, 01 Nov 2007 00:30:33 +0300 Subject: [llvm-commits] [llvm] r43578 - /llvm/trunk/lib/VMCore/Verifier.cpp In-Reply-To: <149102B2-89C1-419E-8FFF-D715A12D90B3.SS2498SS@apple.com> References: <200710312104.l9VL4I2M017819@zion.cs.uiuc.edu> <149102B2-89C1-419E-8FFF-D715A12D90B3.SS2498SS@apple.com> Message-ID: <1193866233.26720.75.camel@asl.dorms.spbu.ru> > Why can't you check this at the beginning of > Verifier::visitBasicBlock() ? I think due to this: >AU.addRequired(); DomTree crashes on invalid CFG. -- With best regards, Anton Korobeynikov. Faculty of Mathematics & Mechanics, Saint Petersburg State University. From dpatel at apple.com Wed Oct 31 16:42:28 2007 From: dpatel at apple.com (Devang Patel) Date: Wed, 31 Oct 2007 14:42:28 -0700 Subject: [llvm-commits] [llvm] r43578 - /llvm/trunk/lib/VMCore/Verifier.cpp In-Reply-To: <1193866233.26720.75.camel@asl.dorms.spbu.ru> References: <200710312104.l9VL4I2M017819@zion.cs.uiuc.edu> <149102B2-89C1-419E-8FFF-D715A12D90B3.SS2498SS@apple.com> <1193866233.26720.75.camel@asl.dorms.spbu.ru> Message-ID: <00E474C0-6312-4479-A39C-641FF2D31841@apple.com> On Oct 31, 2007, at 2:30 PM, Anton Korobeynikov wrote: > >> Why can't you check this at the beginning of >> Verifier::visitBasicBlock() ? > I think due to this: > >> AU.addRequired(); > > DomTree crashes on invalid CFG. aha. ok. - Devang From kremenek at apple.com Wed Oct 31 17:42:03 2007 From: kremenek at apple.com (Ted Kremenek) Date: Wed, 31 Oct 2007 22:42:03 -0000 Subject: [llvm-commits] [llvm] r43583 - in /llvm/trunk: include/llvm/Bitcode/Deserialize.h lib/Bitcode/Reader/Deserialize.cpp Message-ID: <200710312242.l9VMg3Dt023752@zion.cs.uiuc.edu> Author: kremenek Date: Wed Oct 31 17:42:03 2007 New Revision: 43583 URL: http://llvm.org/viewvc/llvm-project?rev=43583&view=rev Log: constified several pointer arguments for methods in the Deserializer. Modified: llvm/trunk/include/llvm/Bitcode/Deserialize.h llvm/trunk/lib/Bitcode/Reader/Deserialize.cpp Modified: llvm/trunk/include/llvm/Bitcode/Deserialize.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/Deserialize.h?rev=43583&r1=43582&r2=43583&view=diff ============================================================================== --- llvm/trunk/include/llvm/Bitcode/Deserialize.h (original) +++ llvm/trunk/include/llvm/Bitcode/Deserialize.h Wed Oct 31 17:42:03 2007 @@ -57,7 +57,7 @@ BPatchEntry(void* P) : Ptr(reinterpret_cast(P)) {} bool hasFinalPtr() const { return Ptr & 0x1 ? false : true; } - void setFinalPtr(BPNode*& FreeList, void* P); + void setFinalPtr(BPNode*& FreeList, const void* P); BPNode* getBPNode() const { assert (!hasFinalPtr()); @@ -152,8 +152,11 @@ return *p; } + void RegisterPtr(unsigned PtrId, const void* Ptr); - void RegisterPtr(unsigned PtrId, void* Ptr); + void RegisterPtr(const void* Ptr) { + RegisterPtr(ReadInt(),Ptr); + } private: void ReadRecord(); Modified: llvm/trunk/lib/Bitcode/Reader/Deserialize.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/Deserialize.cpp?rev=43583&r1=43582&r2=43583&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Reader/Deserialize.cpp (original) +++ llvm/trunk/lib/Bitcode/Reader/Deserialize.cpp Wed Oct 31 17:42:03 2007 @@ -98,9 +98,9 @@ buff.push_back('\0'); } -void Deserializer::RegisterPtr(unsigned PtrId,void* Ptr) { +void Deserializer::RegisterPtr(unsigned PtrId, const void* Ptr) { BPatchEntry& E = BPatchMap[PtrId]; - assert (E.hasFinalPtr() && "Pointer already registered."); + assert (!E.hasFinalPtr() && "Pointer already registered."); E.setFinalPtr(FreeList,Ptr); } @@ -145,7 +145,7 @@ return E.getFinalPtr(); } -void Deserializer::BPatchEntry::setFinalPtr(BPNode*& FreeList, void* P) { +void Deserializer::BPatchEntry::setFinalPtr(BPNode*& FreeList, const void* P) { assert (!hasFinalPtr()); // Perform backpatching. From kremenek at apple.com Wed Oct 31 19:54:57 2007 From: kremenek at apple.com (Ted Kremenek) Date: Thu, 01 Nov 2007 00:54:57 -0000 Subject: [llvm-commits] [llvm] r43594 - /llvm/trunk/include/llvm/ADT/DenseMap.h Message-ID: <200711010054.lA10sv6n000331@zion.cs.uiuc.edu> Author: kremenek Date: Wed Oct 31 19:54:57 2007 New Revision: 43594 URL: http://llvm.org/viewvc/llvm-project?rev=43594&view=rev Log: Added typedef "value_type" to DenseMap (similar typedef appears in std::map). Added method FindAndConstruct() to DenseMap, which does the same thing as operator[], except that it refers value_type& (a reference to both the key and mapped data pair). This method is useful for clients that wish to access the stored key value, as opposed to the key used to do the actual lookup (these need not always be the same). Redefined operator[] to use FindAndConstruct() (same logic). Modified: llvm/trunk/include/llvm/ADT/DenseMap.h Modified: llvm/trunk/include/llvm/ADT/DenseMap.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/DenseMap.h?rev=43594&r1=43593&r2=43594&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/DenseMap.h (original) +++ llvm/trunk/include/llvm/ADT/DenseMap.h Wed Oct 31 19:54:57 2007 @@ -63,6 +63,8 @@ unsigned NumEntries; unsigned NumTombstones; public: + typedef BucketT value_type; + DenseMap(const DenseMap& other) { NumBuckets = 0; CopyFrom(other); @@ -174,13 +176,17 @@ ++NumTombstones; return true; } - - ValueT &operator[](const KeyT &Key) { + + value_type& FindAndConstruct(const KeyT &Key) { BucketT *TheBucket; if (LookupBucketFor(Key, TheBucket)) - return TheBucket->second; - - return InsertIntoBucket(Key, ValueT(), TheBucket)->second; + return *TheBucket; + + return *InsertIntoBucket(Key, ValueT(), TheBucket); + } + + ValueT &operator[](const KeyT &Key) { + return FindAndConstruct(Key).second; } DenseMap& operator=(const DenseMap& other) { From kremenek at apple.com Wed Oct 31 19:57:37 2007 From: kremenek at apple.com (Ted Kremenek) Date: Thu, 01 Nov 2007 00:57:37 -0000 Subject: [llvm-commits] [llvm] r43595 - in /llvm/trunk: include/llvm/Bitcode/Deserialize.h lib/Bitcode/Reader/Deserialize.cpp Message-ID: <200711010057.lA10vbe8000423@zion.cs.uiuc.edu> Author: kremenek Date: Wed Oct 31 19:57:37 2007 New Revision: 43595 URL: http://llvm.org/viewvc/llvm-project?rev=43595&view=rev Log: Rewrote backpatcher. Backpatcher now stores the "has final pointer" flag in the **key** of the backpatch map, as opposed to the mapped value which contains either the final pointer, or a pointer to a chain of pointers that need to be backpatched. The bit flag was moved to the key because we were erroneously assuming that the backpatched pointers would be at an alignment of >= 2 bytes, which obviously doesn't work for character strings. Now we just steal the bit from the key. Modified: llvm/trunk/include/llvm/Bitcode/Deserialize.h llvm/trunk/lib/Bitcode/Reader/Deserialize.cpp Modified: llvm/trunk/include/llvm/Bitcode/Deserialize.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/Deserialize.h?rev=43595&r1=43594&r2=43595&view=diff ============================================================================== --- llvm/trunk/include/llvm/Bitcode/Deserialize.h (original) +++ llvm/trunk/include/llvm/Bitcode/Deserialize.h Wed Oct 31 19:57:37 2007 @@ -30,54 +30,49 @@ //===----------------------------------------------------------===// // Internal type definitions. //===----------------------------------------------------------===// - - struct PtrIdInfo { - static inline unsigned getEmptyKey() { return ~((unsigned) 0x0); } - static inline unsigned getTombstoneKey() { return getEmptyKey()-1; } - static inline unsigned getHashValue(unsigned X) { return X; } - static inline bool isEqual(unsigned X, unsigned Y) { return X == Y; } - static inline bool isPod() { return true; } - }; struct BPNode { BPNode* Next; uintptr_t& PtrRef; + BPNode(BPNode* n, uintptr_t& pref) : Next(n), PtrRef(pref) { PtrRef = 0; } }; - class BPatchEntry { - uintptr_t Ptr; + struct BPEntry { + union { BPNode* Head; void* Ptr; }; + + BPEntry() : Head(NULL) {} + + static inline bool isPod() { return true; } + + void SetPtr(BPNode*& FreeList, void* P); + }; + + class BPKey { + unsigned Raw; + public: + BPKey(unsigned PtrId) : Raw(PtrId << 1) { assert (PtrId > 0); } - BPatchEntry() : Ptr(0x1) {} - - BPatchEntry(void* P) : Ptr(reinterpret_cast(P)) {} - - bool hasFinalPtr() const { return Ptr & 0x1 ? false : true; } - void setFinalPtr(BPNode*& FreeList, const void* P); - - BPNode* getBPNode() const { - assert (!hasFinalPtr()); - return reinterpret_cast(Ptr & ~0x1); - } + void MarkFinal() { Raw |= 0x1; } + bool hasFinalPtr() const { return Raw & 0x1 ? true : false; } + unsigned getID() const { return Raw >> 1; } - void setBPNode(BPNode* N) { - assert (!hasFinalPtr()); - Ptr = reinterpret_cast(N) | 0x1; + static inline BPKey getEmptyKey() { return 0; } + static inline BPKey getTombstoneKey() { return 1; } + static inline unsigned getHashValue(const BPKey& K) { return K.Raw & ~0x1; } + + static bool isEqual(const BPKey& K1, const BPKey& K2) { + return (K1.Raw ^ K2.Raw) & ~0x1 ? false : true; } - uintptr_t getFinalPtr() const { - assert (!(Ptr & 0x1) && "Backpatch pointer not yet deserialized."); - return Ptr; - } - - static inline bool isPod() { return true; } + static bool isPod() { return true; } }; - - typedef llvm::DenseMap MapTy; + + typedef llvm::DenseMap MapTy; //===----------------------------------------------------------===// // Internal data members. @@ -162,6 +157,27 @@ void ReadRecord(); bool inRecord(); uintptr_t ReadInternalRefPtr(); + + static inline bool HasFinalPtr(MapTy::value_type& V) { + return V.first.hasFinalPtr(); + } + + static inline uintptr_t GetFinalPtr(MapTy::value_type& V) { + return reinterpret_cast(V.second.Ptr); + } + + static inline BPNode* GetBPNode(MapTy::value_type& V) { + return V.second.Head; + } + + static inline void SetBPNode(MapTy::value_type& V, BPNode* N) { + V.second.Head = N; + } + + void SetPtr(MapTy::value_type& V, const void* P) { + V.first.MarkFinal(); + V.second.SetPtr(FreeList,const_cast(P)); + } }; } // end namespace llvm Modified: llvm/trunk/lib/Bitcode/Reader/Deserialize.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/Deserialize.cpp?rev=43595&r1=43594&r2=43595&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Reader/Deserialize.cpp (original) +++ llvm/trunk/lib/Bitcode/Reader/Deserialize.cpp Wed Oct 31 19:57:37 2007 @@ -25,7 +25,7 @@ #ifdef NDEBUG for (MapTy::iterator I=BPatchMap.begin(), E=BPatchMap.end(); I!=E; ++I) - assert (I->second.hasFinalPtr() && + assert (I->first.hasFinalPtr() && "Some pointers were not backpatched."); #endif } @@ -99,9 +99,11 @@ } void Deserializer::RegisterPtr(unsigned PtrId, const void* Ptr) { - BPatchEntry& E = BPatchMap[PtrId]; - assert (!E.hasFinalPtr() && "Pointer already registered."); - E.setFinalPtr(FreeList,Ptr); + MapTy::value_type& E = BPatchMap.FindAndConstruct(BPKey(PtrId)); + + assert (!HasFinalPtr(E) && "Pointer already registered."); + + SetPtr(E,Ptr); } void Deserializer::ReadUIntPtr(uintptr_t& PtrRef) { @@ -111,11 +113,11 @@ PtrRef = 0; return; } + + MapTy::value_type& E = BPatchMap.FindAndConstruct(BPKey(PtrId)); - BPatchEntry& E = BPatchMap[PtrId]; - - if (E.hasFinalPtr()) - PtrRef = E.getFinalPtr(); + if (HasFinalPtr(E)) + PtrRef = GetFinalPtr(E); else { // Register backpatch. Check the freelist for a BPNode. BPNode* N; @@ -127,8 +129,8 @@ else // No available BPNode. Allocate one. N = (BPNode*) Allocator.Allocate(); - new (N) BPNode(E.getBPNode(),PtrRef); - E.setBPNode(N); + new (N) BPNode(GetBPNode(E),PtrRef); + SetBPNode(E,N); } } @@ -137,32 +139,28 @@ assert (PtrId != 0 && "References cannot refer the NULL address."); - BPatchEntry& E = BPatchMap[PtrId]; + MapTy::value_type& E = BPatchMap.FindAndConstruct(BPKey(PtrId)); - assert (E.hasFinalPtr() && + assert (!HasFinalPtr(E) && "Cannot backpatch references. Object must be already deserialized."); - return E.getFinalPtr(); + return GetFinalPtr(E); } -void Deserializer::BPatchEntry::setFinalPtr(BPNode*& FreeList, const void* P) { - assert (!hasFinalPtr()); - - // Perform backpatching. - +void Deserializer::BPEntry::SetPtr(BPNode*& FreeList, void* P) { BPNode* Last = NULL; - for (BPNode* N = getBPNode() ; N != NULL; N = N->Next) { + for (BPNode* N = Head; N != NULL; N=N->Next) { Last = N; N->PtrRef |= reinterpret_cast(P); } if (Last) { Last->Next = FreeList; - FreeList = getBPNode(); + FreeList = Head; } - Ptr = reinterpret_cast(P); + Ptr = const_cast(P); } From sabre at nondot.org Wed Oct 31 21:18:41 2007 From: sabre at nondot.org (Chris Lattner) Date: Thu, 01 Nov 2007 02:18:41 -0000 Subject: [llvm-commits] [llvm] r43596 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/2007-10-31-RangeCrash.ll Message-ID: <200711010218.lA12If0O004598@zion.cs.uiuc.edu> Author: lattner Date: Wed Oct 31 21:18:41 2007 New Revision: 43596 URL: http://llvm.org/viewvc/llvm-project?rev=43596&view=rev Log: Fix InstCombine/2007-10-31-RangeCrash.ll Added: llvm/trunk/test/Transforms/InstCombine/2007-10-31-RangeCrash.ll Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=43596&r1=43595&r2=43596&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Wed Oct 31 21:18:41 2007 @@ -4028,6 +4028,10 @@ case ICmpInst::ICMP_EQ: // (X u< 13 | X == 14) -> no change break; case ICmpInst::ICMP_UGT: // (X u< 13 | X u> 15) ->(X-13) u> 2 + // If RHSCst is [us]MAXINT, it is always false. Not handling + // this can cause overflow. + if (RHSCst->isMaxValue(false)) + return ReplaceInstUsesWith(I, LHS); return InsertRangeTest(LHSVal, LHSCst, AddOne(RHSCst), false, false, I); case ICmpInst::ICMP_SGT: // (X u< 13 | X s> 15) -> no change @@ -4045,6 +4049,10 @@ case ICmpInst::ICMP_EQ: // (X s< 13 | X == 14) -> no change break; case ICmpInst::ICMP_SGT: // (X s< 13 | X s> 15) ->(X-13) s> 2 + // If RHSCst is [us]MAXINT, it is always false. Not handling + // this can cause overflow. + if (RHSCst->isMaxValue(true)) + return ReplaceInstUsesWith(I, LHS); return InsertRangeTest(LHSVal, LHSCst, AddOne(RHSCst), true, false, I); case ICmpInst::ICMP_UGT: // (X s< 13 | X u> 15) -> no change Added: llvm/trunk/test/Transforms/InstCombine/2007-10-31-RangeCrash.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/2007-10-31-RangeCrash.ll?rev=43596&view=auto ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/2007-10-31-RangeCrash.ll (added) +++ llvm/trunk/test/Transforms/InstCombine/2007-10-31-RangeCrash.ll Wed Oct 31 21:18:41 2007 @@ -0,0 +1,35 @@ +; RUN: llvm-as < %s | opt -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-f128:64:128" +target triple = "powerpc-apple-darwin8" + +define i32 @test() { +entry: + %tmp50.i17 = icmp slt i32 0, 4 ; [#uses=1] + br i1 %tmp50.i17, label %bb.i, label %calculateColorSpecificBlackLevel.exit + +bb.i: ; preds = %entry + br label %bb51.i.i + +bb27.i.i: ; preds = %bb51.i.i + %tmp31.i.i = load i16* null, align 2 ; [#uses=2] + %tmp35.i.i = icmp ult i16 %tmp31.i.i, 1 ; [#uses=1] + %tmp41.i.i = icmp ugt i16 %tmp31.i.i, -1 ; [#uses=1] + %bothcond.i.i = or i1 %tmp35.i.i, %tmp41.i.i ; [#uses=1] + %bothcond1.i.i = zext i1 %bothcond.i.i to i32 ; [#uses=1] + %tmp46.i.i = xor i32 %bothcond1.i.i, 1 ; [#uses=1] + %count.0.i.i = add i32 %count.1.i.i, %tmp46.i.i ; [#uses=1] + %tmp50.i.i = add i32 %x.0.i.i, 2 ; [#uses=1] + br label %bb51.i.i + +bb51.i.i: ; preds = %bb27.i.i, %bb.i + %count.1.i.i = phi i32 [ %count.0.i.i, %bb27.i.i ], [ 0, %bb.i ] ; [#uses=1] + %x.0.i.i = phi i32 [ %tmp50.i.i, %bb27.i.i ], [ 0, %bb.i ] ; [#uses=2] + %tmp54.i.i = icmp slt i32 %x.0.i.i, 0 ; [#uses=1] + br i1 %tmp54.i.i, label %bb27.i.i, label %bb57.i.i + +bb57.i.i: ; preds = %bb51.i.i + ret i32 0 + +calculateColorSpecificBlackLevel.exit: ; preds = %entry + ret i32 undef +} From sabre at nondot.org Wed Oct 31 21:30:35 2007 From: sabre at nondot.org (Chris Lattner) Date: Thu, 01 Nov 2007 02:30:35 -0000 Subject: [llvm-commits] [llvm] r43597 - in /llvm/trunk: lib/VMCore/Constants.cpp test/Transforms/InstCombine/2007-10-31-StringCrash.ll Message-ID: <200711010230.lA12UZgp005326@zion.cs.uiuc.edu> Author: lattner Date: Wed Oct 31 21:30:35 2007 New Revision: 43597 URL: http://llvm.org/viewvc/llvm-project?rev=43597&view=rev Log: Fix InstCombine/2007-10-31-StringCrash.ll by removing an obvious (in hindsight) infinite recursion. Simplify the code. Added: llvm/trunk/test/Transforms/InstCombine/2007-10-31-StringCrash.ll Modified: llvm/trunk/lib/VMCore/Constants.cpp Modified: llvm/trunk/lib/VMCore/Constants.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=43597&r1=43596&r2=43597&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Constants.cpp (original) +++ llvm/trunk/lib/VMCore/Constants.cpp Wed Oct 31 21:30:35 2007 @@ -2268,18 +2268,14 @@ } } } - } else if (Constant *C = dyn_cast(this)) { - if (GlobalValue *GV = dyn_cast(C)) - return GV->getStringValue(Chop, Offset); - else if (ConstantExpr *CE = dyn_cast(C)) { - if (CE->getOpcode() == Instruction::GetElementPtr) { - // Turn a gep into the specified offset. - if (CE->getNumOperands() == 3 && - cast(CE->getOperand(1))->isNullValue() && - isa(CE->getOperand(2))) { - Offset += cast(CE->getOperand(2))->getZExtValue(); - return CE->getOperand(0)->getStringValue(Chop, Offset); - } + } else if (ConstantExpr *CE = dyn_cast(this)) { + if (CE->getOpcode() == Instruction::GetElementPtr) { + // Turn a gep into the specified offset. + if (CE->getNumOperands() == 3 && + cast(CE->getOperand(1))->isNullValue() && + isa(CE->getOperand(2))) { + Offset += cast(CE->getOperand(2))->getZExtValue(); + return CE->getOperand(0)->getStringValue(Chop, Offset); } } } Added: llvm/trunk/test/Transforms/InstCombine/2007-10-31-StringCrash.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/2007-10-31-StringCrash.ll?rev=43597&view=auto ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/2007-10-31-StringCrash.ll (added) +++ llvm/trunk/test/Transforms/InstCombine/2007-10-31-StringCrash.ll Wed Oct 31 21:30:35 2007 @@ -0,0 +1,21 @@ +; RUN: llvm-as < %s | opt -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 = "i686-apple-darwin8" + +declare void @__darwin_gcc3_preregister_frame_info() + +define void @_start(i32 %argc, i8** %argv, i8** %envp) { +entry: + %tmp1 = bitcast void ()* @__darwin_gcc3_preregister_frame_info to i32* ; [#uses=1] + %tmp2 = load i32* %tmp1, align 4 ; [#uses=1] + %tmp3 = icmp ne i32 %tmp2, 0 ; [#uses=1] + %tmp34 = zext i1 %tmp3 to i8 ; [#uses=1] + %toBool = icmp ne i8 %tmp34, 0 ; [#uses=1] + br i1 %toBool, label %cond_true, label %return + +cond_true: ; preds = %entry + ret void + +return: ; preds = %entry + ret void +} From dalej at apple.com Wed Oct 31 21:38:24 2007 From: dalej at apple.com (Dale Johannesen) Date: Thu, 01 Nov 2007 02:38:24 -0000 Subject: [llvm-commits] [llvm] r43598 - /llvm/trunk/test/CodeGen/X86/2007-10-31-extractelement-i64.ll Message-ID: <200711010238.lA12cOZd005721@zion.cs.uiuc.edu> Author: johannes Date: Wed Oct 31 21:38:24 2007 New Revision: 43598 URL: http://llvm.org/viewvc/llvm-project?rev=43598&view=rev Log: Test that expand_vector_elt(v2i64) works in 32-bit mode. Added: llvm/trunk/test/CodeGen/X86/2007-10-31-extractelement-i64.ll Added: llvm/trunk/test/CodeGen/X86/2007-10-31-extractelement-i64.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2007-10-31-extractelement-i64.ll?rev=43598&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/2007-10-31-extractelement-i64.ll (added) +++ llvm/trunk/test/CodeGen/X86/2007-10-31-extractelement-i64.ll Wed Oct 31 21:38:24 2007 @@ -0,0 +1,82 @@ +; RUN: llvm-as < %s | llc -march=x86 -mattr=sse2 +; ModuleID = 'yyy.c' +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-darwin8" + +define <1 x i64> @a(<2 x i64> %__A) { +entry: + %__A_addr = alloca <2 x i64> ; <<2 x i64>*> [#uses=2] + %retval = alloca <1 x i64>, align 8 ; <<1 x i64>*> [#uses=3] + %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] + store <2 x i64> %__A, <2 x i64>* %__A_addr + %tmp = load <2 x i64>* %__A_addr, align 16 ; <<2 x i64>> [#uses=1] + %tmp1 = bitcast <2 x i64> %tmp to <2 x i64> ; <<2 x i64>> [#uses=1] + %tmp2 = extractelement <2 x i64> %tmp1, i32 0 ; [#uses=1] + %tmp3 = bitcast i64 %tmp2 to <1 x i64> ; <<1 x i64>> [#uses=1] + store <1 x i64> %tmp3, <1 x i64>* %retval, align 8 + %tmp4 = load <1 x i64>* %retval, align 8 ; <<1 x i64>> [#uses=0] + br label %return + +return: ; preds = %entry + %retval5 = load <1 x i64>* %retval ; <<1 x i64>> [#uses=1] + ret <1 x i64> %retval5 +} + +define <1 x i64> @b(<2 x i64> %__A) { +entry: + %__A_addr = alloca <2 x i64> ; <<2 x i64>*> [#uses=2] + %retval = alloca <1 x i64>, align 8 ; <<1 x i64>*> [#uses=3] + %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] + store <2 x i64> %__A, <2 x i64>* %__A_addr + %tmp = load <2 x i64>* %__A_addr, align 16 ; <<2 x i64>> [#uses=1] + %tmp1 = bitcast <2 x i64> %tmp to <2 x i64> ; <<2 x i64>> [#uses=1] + %tmp2 = extractelement <2 x i64> %tmp1, i32 1 ; [#uses=1] + %tmp3 = bitcast i64 %tmp2 to <1 x i64> ; <<1 x i64>> [#uses=1] + store <1 x i64> %tmp3, <1 x i64>* %retval, align 8 + %tmp4 = load <1 x i64>* %retval, align 8 ; <<1 x i64>> [#uses=0] + br label %return + +return: ; preds = %entry + %retval5 = load <1 x i64>* %retval ; <<1 x i64>> [#uses=1] + ret <1 x i64> %retval5 +} + +define i64 @c(<2 x i64> %__A) { +entry: + %__A_addr = alloca <2 x i64> ; <<2 x i64>*> [#uses=2] + %retval = alloca i64, align 8 ; [#uses=2] + %tmp = alloca i64, align 8 ; [#uses=2] + %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] + store <2 x i64> %__A, <2 x i64>* %__A_addr + %tmp1 = load <2 x i64>* %__A_addr, align 16 ; <<2 x i64>> [#uses=1] + %tmp2 = bitcast <2 x i64> %tmp1 to <2 x i64> ; <<2 x i64>> [#uses=1] + %tmp3 = extractelement <2 x i64> %tmp2, i32 0 ; [#uses=1] + store i64 %tmp3, i64* %tmp, align 8 + %tmp4 = load i64* %tmp, align 8 ; [#uses=1] + store i64 %tmp4, i64* %retval, align 8 + br label %return + +return: ; preds = %entry + %retval5 = load i64* %retval ; [#uses=1] + ret i64 %retval5 +} + +define i64 @d(<2 x i64> %__A) { +entry: + %__A_addr = alloca <2 x i64> ; <<2 x i64>*> [#uses=2] + %retval = alloca i64, align 8 ; [#uses=2] + %tmp = alloca i64, align 8 ; [#uses=2] + %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] + store <2 x i64> %__A, <2 x i64>* %__A_addr + %tmp1 = load <2 x i64>* %__A_addr, align 16 ; <<2 x i64>> [#uses=1] + %tmp2 = bitcast <2 x i64> %tmp1 to <2 x i64> ; <<2 x i64>> [#uses=1] + %tmp3 = extractelement <2 x i64> %tmp2, i32 1 ; [#uses=1] + store i64 %tmp3, i64* %tmp, align 8 + %tmp4 = load i64* %tmp, align 8 ; [#uses=1] + store i64 %tmp4, i64* %retval, align 8 + br label %return + +return: ; preds = %entry + %retval5 = load i64* %retval ; [#uses=1] + ret i64 %retval5 +} From clattner at apple.com Wed Oct 31 22:50:31 2007 From: clattner at apple.com (Chris Lattner) Date: Wed, 31 Oct 2007 20:50:31 -0700 Subject: [llvm-commits] [llvm] r43578 - /llvm/trunk/lib/VMCore/Verifier.cpp In-Reply-To: <200710312104.l9VL4I2M017819@zion.cs.uiuc.edu> References: <200710312104.l9VL4I2M017819@zion.cs.uiuc.edu> Message-ID: <61DC5147-BAFF-4748-9D78-169BE970A5A1@apple.com> On Oct 31, 2007, at 2:04 PM, Owen Anderson wrote: > Author: resistor > Date: Wed Oct 31 16:04:18 2007 > New Revision: 43578 > > URL: http://llvm.org/viewvc/llvm-project?rev=43578&view=rev > Log: > Add a preverifier pass to check that every basic block ends in a > terminator, so that we don't segfault when verifying invalid code. Oh, for the love of tabs... The tabs are stabbing by eyeballs out! :) :) -Chris > > Modified: > llvm/trunk/lib/VMCore/Verifier.cpp > > Modified: llvm/trunk/lib/VMCore/Verifier.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=43578&r1=43577&r2=43578&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/VMCore/Verifier.cpp (original) > +++ llvm/trunk/lib/VMCore/Verifier.cpp Wed Oct 31 16:04:18 2007 > @@ -71,7 +71,25 @@ > cl::opt > Pedantic("verify-pedantic", > cl::desc("Reject code with undefined behaviour")); > - > + > + struct VISIBILITY_HIDDEN PreVerifier : public FunctionPass { > + static char ID; // Pass ID, replacement for typeid > + > + PreVerifier() : FunctionPass((intptr_t)&ID) { } > + > + bool runOnFunction(Function &F) { > + for (Function::iterator I = F.begin(), E = F.end(); I != E; + > +I) > + assert(I->back().isTerminator() > + && "Block does not end with a terminator?"); > + > + return false; > + } > + }; > + > + char PreVerifier::ID = 0; > + RegisterPass PreVer("preverify", "Preliminary module > verification"); > + const PassInfo *PreVerifyID = PreVer.getPassInfo(); > + > struct VISIBILITY_HIDDEN > Verifier : public FunctionPass, InstVisitor { > static char ID; // Pass ID, replacement for typeid > @@ -161,6 +179,7 @@ > > virtual void getAnalysisUsage(AnalysisUsage &AU) const { > AU.setPreservesAll(); > + AU.addRequiredID(PreVerifyID); > if (RealPass) > AU.addRequired(); > } > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From resistor at mac.com Wed Oct 31 22:54:24 2007 From: resistor at mac.com (Owen Anderson) Date: Thu, 01 Nov 2007 03:54:24 -0000 Subject: [llvm-commits] [llvm] r43601 - /llvm/trunk/lib/VMCore/Verifier.cpp Message-ID: <200711010354.lA13sOwi011032@zion.cs.uiuc.edu> Author: resistor Date: Wed Oct 31 22:54:23 2007 New Revision: 43601 URL: http://llvm.org/viewvc/llvm-project?rev=43601&view=rev Log: Now with less tabs! Modified: llvm/trunk/lib/VMCore/Verifier.cpp Modified: llvm/trunk/lib/VMCore/Verifier.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=43601&r1=43600&r2=43601&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Verifier.cpp (original) +++ llvm/trunk/lib/VMCore/Verifier.cpp Wed Oct 31 22:54:23 2007 @@ -73,17 +73,17 @@ cl::desc("Reject code with undefined behaviour")); struct VISIBILITY_HIDDEN PreVerifier : public FunctionPass { - static char ID; // Pass ID, replacement for typeid + static char ID; // Pass ID, replacement for typeid - PreVerifier() : FunctionPass((intptr_t)&ID) { } + PreVerifier() : FunctionPass((intptr_t)&ID) { } - bool runOnFunction(Function &F) { + bool runOnFunction(Function &F) { for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) assert(I->back().isTerminator() && "Block does not end with a terminator?"); - return false; - } + return false; + } }; char PreVerifier::ID = 0; From sabre at nondot.org Wed Oct 31 23:20:16 2007 From: sabre at nondot.org (Chris Lattner) Date: Thu, 01 Nov 2007 04:20:16 -0000 Subject: [llvm-commits] [llvm] r43602 - /llvm/trunk/docs/GettingStarted.html Message-ID: <200711010420.lA14KGRe012732@zion.cs.uiuc.edu> Author: lattner Date: Wed Oct 31 23:20:16 2007 New Revision: 43602 URL: http://llvm.org/viewvc/llvm-project?rev=43602&view=rev Log: add a broken gcc version, thanks to P. Durante for pointing this out. Modified: llvm/trunk/docs/GettingStarted.html Modified: llvm/trunk/docs/GettingStarted.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/GettingStarted.html?rev=43602&r1=43601&r2=43602&view=diff ============================================================================== --- llvm/trunk/docs/GettingStarted.html (original) +++ llvm/trunk/docs/GettingStarted.html Wed Oct 31 23:20:16 2007 @@ -17,37 +17,37 @@
      15. Getting Started Quickly (A Summary)
      16. Requirements
          -
        1. Hardware -
        2. Software -
        3. Broken versions of GCC and other tools +
        4. Hardware
        5. +
        6. Software
        7. +
        8. Broken versions of GCC and other tools
      17. Getting Started with LLVM
          -
        1. Terminology and Notation -
        2. Setting Up Your Environment -
        3. Unpacking the LLVM Archives -
        4. Checkout LLVM from Subversion -
        5. Install the GCC Front End -
        6. Local LLVM Configuration -
        7. Compiling the LLVM Suite Source Code -
        8. Cross-Compiling LLVM -
        9. The Location of LLVM Object Files -
        10. Optional Configuration Items +
        11. Terminology and Notation
        12. +
        13. Setting Up Your Environment
        14. +
        15. Unpacking the LLVM Archives
        16. +
        17. Checkout LLVM from Subversion
        18. +
        19. Install the GCC Front End
        20. +
        21. Local LLVM Configuration
        22. +
        23. Compiling the LLVM Suite Source Code
        24. +
        25. Cross-Compiling LLVM
        26. +
        27. The Location of LLVM Object Files
        28. +
        29. Optional Configuration Items
      18. Program layout
          -
        1. llvm/examples -
        2. llvm/include -
        3. llvm/lib -
        4. llvm/projects -
        5. llvm/runtime -
        6. llvm/test -
        7. llvm-test -
        8. llvm/tools -
        9. llvm/utils -
        10. llvm/win32 +
        11. llvm/examples
        12. +
        13. llvm/include
        14. +
        15. llvm/lib
        16. +
        17. llvm/projects
        18. +
        19. llvm/runtime
        20. +
        21. llvm/test
        22. +
        23. llvm-test
        24. +
        25. llvm/tools
        26. +
        27. llvm/utils
        28. +
        29. llvm/win32
      19. An Example Using the LLVM Tool Chain @@ -532,6 +532,10 @@ builds with "make ENABLE_OPTIMIZED=1 OPTIMIZE_OPTION=-O2 ..."

        GCC 3.4.x on X86-64/amd64: GCC miscompiles portions of LLVM.

        +

        GCC 3.4.4 (CodeSourcery ARM 2005q3-2): this compiler miscompiles LLVM + when building with optimizations enabled. It appears to work with + "make ENABLE_OPTIMIZED=1 OPTIMIZE_OPTION=-O1" or build a debug + build.

        IA-64 GCC 4.0.0: The IA-64 version of GCC 4.0.0 is known to miscompile LLVM.

        Apple Xcode 2.3: GCC crashes when compiling LLVM at -O3 (which is the From sabre at nondot.org Wed Oct 31 23:43:13 2007 From: sabre at nondot.org (Chris Lattner) Date: Thu, 01 Nov 2007 04:43:13 -0000 Subject: [llvm-commits] [llvm] r43603 - /llvm/trunk/lib/VMCore/Verifier.cpp Message-ID: <200711010443.lA14hEo5013870@zion.cs.uiuc.edu> Author: lattner Date: Wed Oct 31 23:43:13 2007 New Revision: 43603 URL: http://llvm.org/viewvc/llvm-project?rev=43603&view=rev Log: remove verifier command line option: this should be part of the API, not a command line optn. Modified: llvm/trunk/lib/VMCore/Verifier.cpp Modified: llvm/trunk/lib/VMCore/Verifier.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=43603&r1=43602&r2=43603&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Verifier.cpp (original) +++ llvm/trunk/lib/VMCore/Verifier.cpp Wed Oct 31 23:43:13 2007 @@ -60,7 +60,6 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringExtras.h" #include "llvm/ADT/STLExtras.h" -#include "llvm/Support/CommandLine.h" #include "llvm/Support/Compiler.h" #include #include @@ -68,10 +67,6 @@ using namespace llvm; namespace { // Anonymous namespace for class - cl::opt - Pedantic("verify-pedantic", - cl::desc("Reject code with undefined behaviour")); - struct VISIBILITY_HIDDEN PreVerifier : public FunctionPass { static char ID; // Pass ID, replacement for typeid @@ -830,12 +825,6 @@ CI.getOperand(i+1), FTy->getParamType(i), &CI); if (Function *F = CI.getCalledFunction()) { - if (Pedantic) { - // Verify that calling convention of Function and CallInst match - Assert1(F->getCallingConv() == CI.getCallingConv(), - "Call uses different calling convention than function", &CI); - } - if (Intrinsic::ID ID = (Intrinsic::ID)F->getIntrinsicID()) visitIntrinsicFunctionCall(ID, CI); } From resistor at mac.com Thu Nov 1 00:29:21 2007 From: resistor at mac.com (Owen Anderson) Date: Thu, 01 Nov 2007 05:29:21 -0000 Subject: [llvm-commits] [llvm] r43605 - in /llvm/trunk: lib/Transforms/Scalar/DeadStoreElimination.cpp test/Transforms/DeadStoreElimination/PartialStore.ll Message-ID: <200711010529.lA15TL35016673@zion.cs.uiuc.edu> Author: resistor Date: Thu Nov 1 00:29:16 2007 New Revision: 43605 URL: http://llvm.org/viewvc/llvm-project?rev=43605&view=rev Log: Fix test/Transforms/DeadStoreElimination/PartialStore.ll, which had been silently failing because of an incorrect run line for some time. Modified: llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp llvm/trunk/test/Transforms/DeadStoreElimination/PartialStore.ll Modified: llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp?rev=43605&r1=43604&r2=43605&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp Thu Nov 1 00:29:16 2007 @@ -63,14 +63,18 @@ /// from allocas, it is safe to ignore GEP indices, since /// either the store will be in the alloca, and thus dead, /// or beyond the end of the alloca, and thus undefined. - void TranslatePointerBitCasts(Value*& v) { + void TranslatePointerBitCasts(Value*& v, bool zeroGepsOnly = false) { assert(isa(v->getType()) && "Translating a non-pointer type?"); while (true) { if (BitCastInst* C = dyn_cast(v)) v = C->getOperand(0); else if (GetElementPtrInst* G = dyn_cast(v)) - v = G->getOperand(0); + if (!zeroGepsOnly || G->hasAllZeroIndices()) { + v = G->getOperand(0); + } else { + break; + } else break; } @@ -95,7 +99,8 @@ bool DSE::runOnBasicBlock(BasicBlock &BB) { MemoryDependenceAnalysis& MD = getAnalysis(); - + TargetData &TD = getAnalysis(); + // Record the last-seen store to this pointer DenseMap lastStore; // Record instructions possibly made dead by deleting a store @@ -119,6 +124,7 @@ } else pointer = cast(BBI)->getPointerOperand(); + TranslatePointerBitCasts(pointer, true); StoreInst*& last = lastStore[pointer]; bool deletedStore = false; @@ -130,7 +136,9 @@ while (dep != MemoryDependenceAnalysis::None && dep != MemoryDependenceAnalysis::NonLocal && isa(dep)) { - if (dep != last) { + if (dep != last || + TD.getTypeSize(last->getOperand(0)->getType()) > + TD.getTypeSize(BBI->getOperand(0)->getType())) { dep = MD.getDependency(BBI, dep); continue; } Modified: llvm/trunk/test/Transforms/DeadStoreElimination/PartialStore.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/DeadStoreElimination/PartialStore.ll?rev=43605&r1=43604&r2=43605&view=diff ============================================================================== --- llvm/trunk/test/Transforms/DeadStoreElimination/PartialStore.ll (original) +++ llvm/trunk/test/Transforms/DeadStoreElimination/PartialStore.ll Thu Nov 1 00:29:16 2007 @@ -1,5 +1,5 @@ ; RUN: llvm-upgrade < %s | llvm-as | opt -dse | llvm-dis | \ -; RUN: not grep {store sbyte} +; RUN: not grep {store i8} ; Ensure that the dead store is deleted in this case. It is wholely ; overwritten by the second store. int %test() { From evan.cheng at apple.com Thu Nov 1 01:22:48 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 01 Nov 2007 06:22:48 -0000 Subject: [llvm-commits] [llvm] r43606 - in /llvm/trunk: include/llvm/CodeGen/SimpleRegisterCoalescing.h lib/CodeGen/SimpleRegisterCoalescing.cpp Message-ID: <200711010622.lA16Mmx3020633@zion.cs.uiuc.edu> Author: evancheng Date: Thu Nov 1 01:22:48 2007 New Revision: 43606 URL: http://llvm.org/viewvc/llvm-project?rev=43606&view=rev Log: - Coalesce extract_subreg when both intervals are relatively small. - Some code clean up. Modified: llvm/trunk/include/llvm/CodeGen/SimpleRegisterCoalescing.h llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Modified: llvm/trunk/include/llvm/CodeGen/SimpleRegisterCoalescing.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SimpleRegisterCoalescing.h?rev=43606&r1=43605&r2=43606&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SimpleRegisterCoalescing.h (original) +++ llvm/trunk/include/llvm/CodeGen/SimpleRegisterCoalescing.h Thu Nov 1 01:22:48 2007 @@ -109,11 +109,11 @@ /// JoinCopy - Attempt to join intervals corresponding to SrcReg/DstReg, /// which are the src/dst of the copy instruction CopyMI. This returns true - /// if the copy was successfully coalesced away, or if it is never possible - /// to coalesce these this copy, due to register constraints. It returns - /// false if it is not currently possible to coalesce this interval, but - /// it may be possible if other things get coalesced. - bool JoinCopy(MachineInstr *CopyMI, unsigned SrcReg, unsigned DstReg); + /// if the copy was successfully coalesced away. If it is not currently + /// possible to coalesce this interval, but it may be possible if other + /// things get coalesced, then it returns true by reference in 'Again'. + bool JoinCopy(MachineInstr *CopyMI, unsigned SrcReg, unsigned DstReg, + bool &Again); /// JoinIntervals - Attempt to join these two intervals. On failure, this /// returns false. Otherwise, if one of the intervals being joined is a Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=43606&r1=43605&r2=43606&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original) +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Thu Nov 1 01:22:48 2007 @@ -197,22 +197,24 @@ /// JoinCopy - Attempt to join intervals corresponding to SrcReg/DstReg, /// which are the src/dst of the copy instruction CopyMI. This returns true -/// if the copy was successfully coalesced away, or if it is never possible -/// to coalesce this copy, due to register constraints. It returns -/// false if it is not currently possible to coalesce this interval, but -/// it may be possible if other things get coalesced. +/// if the copy was successfully coalesced away. If it is not currently +/// possible to coalesce this interval, but it may be possible if other +/// things get coalesced, then it returns true by reference in 'Again'. bool SimpleRegisterCoalescing::JoinCopy(MachineInstr *CopyMI, - unsigned SrcReg, unsigned DstReg) { + unsigned SrcReg, unsigned DstReg, + bool &Again) { DOUT << li_->getInstructionIndex(CopyMI) << '\t' << *CopyMI; // Get representative registers. unsigned repSrcReg = rep(SrcReg); unsigned repDstReg = rep(DstReg); + Again = false; + // If they are already joined we continue. if (repSrcReg == repDstReg) { DOUT << "\tCopy already coalesced.\n"; - return true; // Not coalescable. + return false; // Not coalescable. } bool SrcIsPhys = MRegisterInfo::isPhysicalRegister(repSrcReg); @@ -221,17 +223,17 @@ // If they are both physical registers, we cannot join them. if (SrcIsPhys && DstIsPhys) { DOUT << "\tCan not coalesce physregs.\n"; - return true; // Not coalescable. + return false; // Not coalescable. } // We only join virtual registers with allocatable physical registers. if (SrcIsPhys && !allocatableRegs_[repSrcReg]) { DOUT << "\tSrc reg is unallocatable physreg.\n"; - return true; // Not coalescable. + return false; // Not coalescable. } if (DstIsPhys && !allocatableRegs_[repDstReg]) { DOUT << "\tDst reg is unallocatable physreg.\n"; - return true; // Not coalescable. + return false; // Not coalescable. } bool isExtSubReg = CopyMI->getOpcode() == TargetInstrInfo::EXTRACT_SUBREG; @@ -265,19 +267,30 @@ RHS.overlaps(li_->getInterval(RealDstReg))) { DOUT << "Interfere with register "; DEBUG(li_->getInterval(RealDstReg).print(DOUT, mri_)); - return true; // Not coalescable + return false; // Not coalescable } for (const unsigned* SR = mri_->getSubRegisters(RealDstReg); *SR; ++SR) if (li_->hasInterval(*SR) && RHS.overlaps(li_->getInterval(*SR))) { DOUT << "Interfere with sub-register "; DEBUG(li_->getInterval(*SR).print(DOUT, mri_)); - return true; // Not coalescable + return false; // Not coalescable } - } else if (li_->getInterval(repDstReg).getSize() > - li_->getInterval(repSrcReg).getSize()) { + } else { + unsigned SrcSize= li_->getInterval(repSrcReg).getSize() / InstrSlots::NUM; + unsigned DstSize= li_->getInterval(repDstReg).getSize() / InstrSlots::NUM; + const TargetRegisterClass *RC=mf_->getSSARegMap()->getRegClass(repDstReg); + unsigned Threshold = allocatableRCRegs_[RC].count(); // Be conservative. If both sides are virtual registers, do not coalesce - // if the sub-register live interval is longer. - return false; + // if this will cause a high use density interval to target a smaller set + // of registers. + if (DstSize > Threshold || SrcSize > Threshold) { + LiveVariables::VarInfo &svi = lv_->getVarInfo(repSrcReg); + LiveVariables::VarInfo &dvi = lv_->getVarInfo(repDstReg); + if ((float)dvi.NumUses / DstSize < (float)svi.NumUses / SrcSize) { + Again = true; // May be possible to coalesce later. + return false; + } + } } } else if (differingRegisterClasses(repSrcReg, repDstReg)) { // If they are not of the same register class, we cannot join them. @@ -286,6 +299,7 @@ // a physical register that's compatible with the other side. e.g. // r1024 = MOV32to32_ r1025 // but later r1024 is assigned EAX then r1025 may be coalesced with EAX. + Again = true; // May be possible to coalesce later. return false; } @@ -359,6 +373,7 @@ JoinVInt.preference = JoinPReg; ++numAborts; DOUT << "\tMay tie down a physical register, abort!\n"; + Again = true; // May be possible to coalesce later. return false; } } @@ -401,6 +416,7 @@ // Otherwise, we are unable to join the intervals. DOUT << "Interference!\n"; + Again = true; // May be possible to coalesce later. return false; } @@ -971,13 +987,17 @@ // Try coalescing physical register + virtual register first. for (unsigned i = 0, e = PhysCopies.size(); i != e; ++i) { CopyRec &TheCopy = PhysCopies[i]; - if (!JoinCopy(TheCopy.MI, TheCopy.SrcReg, TheCopy.DstReg)) - TryAgain.push_back(TheCopy); + bool Again = false; + if (!JoinCopy(TheCopy.MI, TheCopy.SrcReg, TheCopy.DstReg, Again)) + if (Again) + TryAgain.push_back(TheCopy); } for (unsigned i = 0, e = VirtCopies.size(); i != e; ++i) { CopyRec &TheCopy = VirtCopies[i]; - if (!JoinCopy(TheCopy.MI, TheCopy.SrcReg, TheCopy.DstReg)) - TryAgain.push_back(TheCopy); + bool Again = false; + if (!JoinCopy(TheCopy.MI, TheCopy.SrcReg, TheCopy.DstReg, Again)) + if (Again) + TryAgain.push_back(TheCopy); } } @@ -1021,10 +1041,13 @@ for (unsigned i = 0, e = TryAgainList.size(); i != e; ++i) { CopyRec &TheCopy = TryAgainList[i]; - if (TheCopy.MI && - JoinCopy(TheCopy.MI, TheCopy.SrcReg, TheCopy.DstReg)) { - TheCopy.MI = 0; // Mark this one as done. - ProgressMade = true; + if (TheCopy.MI) { + bool Again = false; + bool Success = JoinCopy(TheCopy.MI,TheCopy.SrcReg,TheCopy.DstReg,Again); + if (Success || !Again) { + TheCopy.MI = 0; // Mark this one as done. + ProgressMade = true; + } } } } From sabre at nondot.org Thu Nov 1 01:49:54 2007 From: sabre at nondot.org (Chris Lattner) Date: Thu, 01 Nov 2007 06:49:54 -0000 Subject: [llvm-commits] [llvm] r43607 - in /llvm/trunk/docs/tutorial: LangImpl6.html index.html Message-ID: <200711010649.lA16ns7i022086@zion.cs.uiuc.edu> Author: lattner Date: Thu Nov 1 01:49:54 2007 New Revision: 43607 URL: http://llvm.org/viewvc/llvm-project?rev=43607&view=rev Log: Add the start of chapter 6, still much to go. Added: llvm/trunk/docs/tutorial/LangImpl6.html Modified: llvm/trunk/docs/tutorial/index.html Added: llvm/trunk/docs/tutorial/LangImpl6.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/LangImpl6.html?rev=43607&view=auto ============================================================================== --- llvm/trunk/docs/tutorial/LangImpl6.html (added) +++ llvm/trunk/docs/tutorial/LangImpl6.html Thu Nov 1 01:49:54 2007 @@ -0,0 +1,227 @@ + + + + + Kaleidoscope: Extending the Language: Operator Overloading + + + + + + + +

        Kaleidoscope: Extending the Language: Operator Overloading
        + +
        +

        Written by Chris Lattner

        +
        + + + + + +
        + +

        Welcome to Part 6 of the "Implementing a language with +LLVM" tutorial. At this point in our tutorial, we now have a fully +functional language that is fairly minimal, but also useful. One big problem +with it though is that it doesn't have many useful operators (like division, +logical negation, or even any comparisons other than less-than.

        + +

        This chapter of the tutorial takes a wild digression into adding operator +overloading to the simple and beautiful Kaleidoscope language, giving us a +simple and ugly language in some ways, but also a powerful one at the same time. +One of the great things about creating your own language is that you get to +decide what is good or bad. In this tutorial we'll assume that it is okay and +use this as a way to show some interesting parsing techniques.

        + +
        + + + + + +
        + +

        +The operator overloading that we will add to Kaleidoscope is more general than +languages like C++. In C++, you are only allowed to redefine existing +operators: you can't programatically change the grammar, introduce new +operators, change precedence levels, etc. In this chapter, we will add this +capability to Kaleidoscope, which will allow us to round out the set of +operators that are supported, culminating in a more interesting example app.

        + +

        The point of going into operator overloading in a tutorial like this is to +show the power and flexibility of using a hand-written parser. The parser we +are using so far is using recursive descent for most parts of the grammar, and +operator precedence parsing for the expressions. See Chapter 2 for details. Without using operator +precedence parsing, it would be very difficult to allow the programmer to +introduce new operators into the grammar: the grammar is dynamically extensible +as the JIT runs.

        + +

        The two specific features we'll add are programmable unary operators (right +now, Kaleidoscope has no unary operators at all) as well as binary operators. +An example of this is:

        + +
        +
        +# Logical unary not.
        +def unary!(v)
        +  if v then
        +    0
        +  else
        +    1;
        +
        +# Define > with the same precedence as <.
        +def binary> 10 (LHS RHS)
        +  !(LHS < RHS);     # alternatively, could just use "RHS < LHS"
        +
        +# Binary "logical or", (note that it does not "short circuit")
        +def binary| 5 (LHS RHS)
        +  if LHS then
        +    1
        +  else if RHS then
        +    1
        +  else
        +    0;
        +
        +# Define = with slightly lower precedence than relationals.
        +def binary= 9 (LHS RHS)
        +  !(LHS < RHS | LHS > RHS);
        +
        +
        + +

        Many languages aspire to being able to implement their standard runtime +library in the language itself. In Kaleidoscope, we can implement significant +parts of the language in the library!

        + +

        We will break down implementation of these features into two parts: +implementing support for overloading of binary operators and adding unary +operators.

        + +
        + + + + + +
        + +

        Adding support for overloaded binary operators is pretty simple with our +current framework. We'll first add support for the unary/binary keywords:

        + +
        +
        +enum Token {
        +  ...
        +  // operators
        +  tok_binary = -11, tok_unary = -12
        +};
        +...
        +static int gettok() {
        +...
        +    if (IdentifierStr == "for") return tok_for;
        +    if (IdentifierStr == "in") return tok_in;
        +    if (IdentifierStr == "binary") return tok_binary;
        +    if (IdentifierStr == "unary") return tok_unary;
        +    return tok_identifier;
        +
        +
        + +

        This just adds lexer support for the unary and binary keywords, like we +did in previous chapters. One nice thing +about our current AST is that we represent binary operators fully generally +with their ASCII code as the opcode. For our extended operators, we'll use the +same representation, so we don't need any new AST or parser support.

        + +

        On the other hand, we have to be able to represent the definitions of these +new operators, in the "def binary| 5" part of the function definition. In the +grammar so far, the "name" for the function definition is parsed as the +"prototype" production and into the PrototypeAST AST node. To +represent our new user-defined operators as prototypes, we have to extend +the PrototypeAST AST node like this:

        + +
        +
        +/// PrototypeAST - This class represents the "prototype" for a function,
        +/// which captures its argument names as well as if it is an operator.
        +class PrototypeAST {
        +  std::string Name;
        +  std::vector<std::string> Args;
        +  bool isOperator;
        +  unsigned Precedence;  // Precedence if a binary op.
        +public:
        +  PrototypeAST(const std::string &name, const std::vector<std::string> &args,
        +               bool isoperator = false, unsigned prec = 0)
        +  : Name(name), Args(args), isOperator(isoperator), Precedence(prec) {}
        +  
        +  bool isUnaryOp() const { return isOperator && Args.size() == 1; }
        +  bool isBinaryOp() const { return isOperator && Args.size() == 2; }
        +  
        +  char getOperatorName() const {
        +    assert(isUnaryOp() || isBinaryOp());
        +    return Name[Name.size()-1];
        +  }
        +  
        +  unsigned getBinaryPrecedence() const { return Precedence; }
        +  
        +  Function *Codegen();
        +};
        +
        +
        + +

        Basically, in addition to knowing a name for the prototype, we now keep track +of whether it was an operator, and if it was, what precedence level the operator +is at. The precedence is only used for binary operators.

        + + +

        ...

        + +
        + + + + + + +
        + +

        +Here is the complete code listing for our running example, enhanced with the +if/then/else and for expressions.. To build this example, use: +

        + +
        +
        +   # Compile
        +   g++ -g toy.cpp `llvm-config --cppflags --ldflags --libs core jit native` -O3 -o toy
        +   # Run
        +   ./toy
        +
        +
        + +

        Here is the code:

        + +
        +
        +
        +
        + +
        + + +
        +
        + Valid CSS! + Valid HTML 4.01! + + Chris Lattner
        + The LLVM Compiler Infrastructure
        + Last modified: $Date: 2007-10-17 11:05:13 -0700 (Wed, 17 Oct 2007) $ +
        + + Modified: llvm/trunk/docs/tutorial/index.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/index.html?rev=43607&r1=43606&r2=43607&view=diff ============================================================================== --- llvm/trunk/docs/tutorial/index.html (original) +++ llvm/trunk/docs/tutorial/index.html Thu Nov 1 01:49:54 2007 @@ -32,7 +32,7 @@
      20. Implementing Code Generation to LLVM IR
      21. Adding JIT and Optimizer Support
      22. Extending the language: control flow
      23. -
      24. Extending the language: operator overloading
      25. +
      26. Extending the language: operator overloading
      27. Extending the language: mutable variables
      28. Thoughts and ideas for extensions
    • From isanbard at gmail.com Thu Nov 1 03:24:42 2007 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 01 Nov 2007 08:24:42 -0000 Subject: [llvm-commits] [llvm] r43608 - /llvm/trunk/include/llvm/Constants.h Message-ID: <200711010824.lA18Oib6002409@zion.cs.uiuc.edu> Author: void Date: Thu Nov 1 03:24:40 2007 New Revision: 43608 URL: http://llvm.org/viewvc/llvm-project?rev=43608&view=rev Log: Get rid of compilation warning during release builds Modified: llvm/trunk/include/llvm/Constants.h Modified: llvm/trunk/include/llvm/Constants.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Constants.h?rev=43608&r1=43607&r2=43608&view=diff ============================================================================== --- llvm/trunk/include/llvm/Constants.h (original) +++ llvm/trunk/include/llvm/Constants.h Thu Nov 1 03:24:40 2007 @@ -247,8 +247,8 @@ return isExactlyValue(APFloat(V)); else if (&Val.getSemantics() == &APFloat::IEEEsingle) return isExactlyValue(APFloat((float)V)); - else - assert(0); + assert(0); + return false; } /// Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const ConstantFP *) { return true; } From isanbard at gmail.com Thu Nov 1 03:51:47 2007 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 01 Nov 2007 08:51:47 -0000 Subject: [llvm-commits] [llvm] r43609 - /llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Message-ID: <200711010851.lA18pmKa003369@zion.cs.uiuc.edu> Author: void Date: Thu Nov 1 03:51:44 2007 New Revision: 43609 URL: http://llvm.org/viewvc/llvm-project?rev=43609&view=rev Log: Silence, accersed warning Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=43609&r1=43608&r2=43609&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Thu Nov 1 03:51:44 2007 @@ -1407,7 +1407,7 @@ MVT::ValueType SVT = cast(Node->getOperand(1))->getVT(); SDOperand TruncOp = SDOperand(getTruncate(N0, SVT), 0); - unsigned Opc; + unsigned Opc = 0; switch (NVT) { case MVT::i16: if (SVT == MVT::i8) Opc = X86::MOVSX16rr8; From isanbard at gmail.com Thu Nov 1 04:38:20 2007 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 01 Nov 2007 09:38:20 -0000 Subject: [llvm-commits] [llvm] r43610 - /llvm/trunk/lib/System/ltdl.c Message-ID: <200711010938.lA19cLBG005676@zion.cs.uiuc.edu> Author: void Date: Thu Nov 1 04:38:19 2007 New Revision: 43610 URL: http://llvm.org/viewvc/llvm-project?rev=43610&view=rev Log: Silence a warning saying that the variables always resolve to "true" in an expression. Modified: llvm/trunk/lib/System/ltdl.c Modified: llvm/trunk/lib/System/ltdl.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/ltdl.c?rev=43610&r1=43609&r2=43610&view=diff ============================================================================== --- llvm/trunk/lib/System/ltdl.c (original) +++ llvm/trunk/lib/System/ltdl.c Thu Nov 1 04:38:19 2007 @@ -865,13 +865,13 @@ #define LT_DLSTRERROR(name) lt_dlerror_strings[LT_CONC(LT_ERROR_,name)] -static const char objdir[] = LTDL_OBJDIR; -static const char archive_ext[] = LTDL_ARCHIVE_EXT; +static const char *objdir = LTDL_OBJDIR; +static const char *archive_ext = LTDL_ARCHIVE_EXT; #ifdef LTDL_SHLIB_EXT -static const char shlib_ext[] = LTDL_SHLIB_EXT; +static const char *shlib_ext = LTDL_SHLIB_EXT; #endif #ifdef LTDL_SYSSEARCHPATH -static const char sys_search_path[] = LTDL_SYSSEARCHPATH; +static const char *sys_search_path = LTDL_SYSSEARCHPATH; #endif From baldrick at free.fr Thu Nov 1 05:50:27 2007 From: baldrick at free.fr (Duncan Sands) Date: Thu, 01 Nov 2007 10:50:27 -0000 Subject: [llvm-commits] [llvm] r43611 - /llvm/trunk/lib/VMCore/Verifier.cpp Message-ID: <200711011050.lA1AoRAG009528@zion.cs.uiuc.edu> Author: baldrick Date: Thu Nov 1 05:50:26 2007 New Revision: 43611 URL: http://llvm.org/viewvc/llvm-project?rev=43611&view=rev Log: Don't barf on empty basic blocks. Do not rely on assert doing something - this needs to work for release builds too. I chose to just abort rather than following the fancy logic of abortIfBroken, because (1) it is a pain to do otherwise, and (2) nothing is going to work if the module is this broken. Modified: llvm/trunk/lib/VMCore/Verifier.cpp Modified: llvm/trunk/lib/VMCore/Verifier.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=43611&r1=43610&r2=43611&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Verifier.cpp (original) +++ llvm/trunk/lib/VMCore/Verifier.cpp Thu Nov 1 05:50:26 2007 @@ -69,22 +69,34 @@ namespace { // Anonymous namespace for class struct VISIBILITY_HIDDEN PreVerifier : public FunctionPass { static char ID; // Pass ID, replacement for typeid - + PreVerifier() : FunctionPass((intptr_t)&ID) { } - + + // Check that the prerequisites for successful DominatorTree construction + // are satisfied. bool runOnFunction(Function &F) { - for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) - assert(I->back().isTerminator() - && "Block does not end with a terminator?"); - - return false; + bool Broken = false; + + for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) { + if (I->empty() || !I->back().isTerminator()) { + cerr << "Basic Block does not have terminator!\n"; + WriteAsOperand(*cerr, I, true); + cerr << "\n"; + Broken = true; + } + } + + if (Broken) + abort(); + + return false; } }; - + char PreVerifier::ID = 0; RegisterPass PreVer("preverify", "Preliminary module verification"); const PassInfo *PreVerifyID = PreVer.getPassInfo(); - + struct VISIBILITY_HIDDEN Verifier : public FunctionPass, InstVisitor { static char ID; // Pass ID, replacement for typeid From baldrick at free.fr Thu Nov 1 15:53:17 2007 From: baldrick at free.fr (Duncan Sands) Date: Thu, 01 Nov 2007 20:53:17 -0000 Subject: [llvm-commits] [llvm] r43620 - in /llvm/trunk: include/llvm/Target/ lib/Analysis/ lib/CodeGen/SelectionDAG/ lib/ExecutionEngine/ lib/ExecutionEngine/Interpreter/ lib/ExecutionEngine/JIT/ lib/Target/ lib/Transforms/IPO/ lib/Transforms/Scalar/ lib/Transforms/Utils/ Message-ID: <200711012053.lA1KrIUW007528@zion.cs.uiuc.edu> Author: baldrick Date: Thu Nov 1 15:53:16 2007 New Revision: 43620 URL: http://llvm.org/viewvc/llvm-project?rev=43620&view=rev Log: Executive summary: getTypeSize -> getTypeStoreSize / getABITypeSize. The meaning of getTypeSize was not clear - clarifying it is important now that we have x86 long double and arbitrary precision integers. The issue with long double is that it requires 80 bits, and this is not a multiple of its alignment. This gives a primitive type for which getTypeSize differed from getABITypeSize. For arbitrary precision integers it is even worse: there is the minimum number of bits needed to hold the type (eg: 36 for an i36), the maximum number of bits that will be overwriten when storing the type (40 bits for i36) and the ABI size (i.e. the storage size rounded up to a multiple of the alignment; 64 bits for i36). This patch removes getTypeSize (not really - it is still there but deprecated to allow for a gradual transition). Instead there is: (1) getTypeSizeInBits - a number of bits that suffices to hold all values of the type. For a primitive type, this is the minimum number of bits. For an i36 this is 36 bits. For x86 long double it is 80. This corresponds to gcc's TYPE_PRECISION. (2) getTypeStoreSizeInBits - the maximum number of bits that is written when storing the type (or read when reading it). For an i36 this is 40 bits, for an x86 long double it is 80 bits. This is the size alias analysis is interested in (getTypeStoreSize returns the number of bytes). There doesn't seem to be anything corresponding to this in gcc. (3) getABITypeSizeInBits - this is getTypeStoreSizeInBits rounded up to a multiple of the alignment. For an i36 this is 64, for an x86 long double this is 96 or 128 depending on the OS. This is the spacing between consecutive elements when you form an array out of this type (getABITypeSize returns the number of bytes). This is TYPE_SIZE in gcc. Since successive elements in a SequentialType (arrays, pointers and vectors) need to be aligned, the spacing between them will be given by getABITypeSize. This means that the size of an array is the length times the getABITypeSize. It also means that GEP computations need to use getABITypeSize when computing offsets. Furthermore, if an alloca allocates several elements at once then these too need to be aligned, so the size of the alloca has to be the number of elements multiplied by getABITypeSize. Logically speaking this doesn't have to be the case when allocating just one element, but it is simpler to also use getABITypeSize in this case. So alloca's and mallocs should use getABITypeSize. Finally, since gcc's only notion of size is that given by getABITypeSize, if you want to output assembler etc the same as gcc then getABITypeSize is the size you want. Since a store will overwrite no more than getTypeStoreSize bytes, and a read will read no more than that many bytes, this is the notion of size appropriate for alias analysis calculations. In this patch I have corrected all type size uses except some of those in ScalarReplAggregates, lib/Codegen, lib/Target (the hard cases). I will get around to auditing these too at some point, but I could do with some help. Finally, I made one change which I think wise but others might consider pointless and suboptimal: in an unpacked struct the amount of space allocated for a field is now given by the ABI size rather than getTypeStoreSize. I did this because every other place that reserves memory for a type (eg: alloca) now uses getABITypeSize, and I didn't want to make an exception for unpacked structs, i.e. I did it to make things more uniform. This only effects structs containing long doubles and arbitrary precision integers. If someone wants to pack these types more tightly they can always use a packed struct. Modified: llvm/trunk/include/llvm/Target/TargetData.h llvm/trunk/lib/Analysis/AliasAnalysis.cpp llvm/trunk/lib/Analysis/AliasAnalysisEvaluator.cpp llvm/trunk/lib/Analysis/AliasSetTracker.cpp llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp llvm/trunk/lib/Analysis/ConstantFolding.cpp llvm/trunk/lib/Analysis/LoadValueNumbering.cpp llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp llvm/trunk/lib/ExecutionEngine/Interpreter/Execution.cpp llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp llvm/trunk/lib/Target/TargetData.cpp llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp llvm/trunk/lib/Transforms/Scalar/LICM.cpp llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp llvm/trunk/lib/Transforms/Utils/LowerAllocations.cpp Modified: llvm/trunk/include/llvm/Target/TargetData.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetData.h?rev=43620&r1=43619&r2=43620&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetData.h (original) +++ llvm/trunk/include/llvm/Target/TargetData.h Thu Nov 1 15:53:16 2007 @@ -155,26 +155,48 @@ /// Target pointer size, in bits unsigned char getPointerSizeInBits() const { return 8*PointerMemSize; } - /// getTypeSize - Return the number of bytes necessary to hold the specified - /// type. - uint64_t getTypeSize(const Type *Ty) const; - - /// getABITypeSize - Return the number of bytes allocated for the specified - /// type when used as an element in a larger object, including alignment - /// padding. - uint64_t getABITypeSize(const Type *Ty) const { + /// getTypeSizeInBits - Return the number of bits necessary to hold the + /// specified type. For example, returns 36 for i36 and 80 for x86_fp80. + uint64_t getTypeSizeInBits(const Type* Ty) const; + + /// getTypeStoreSize - Return the maximum number of bytes that may be + /// overwritten by storing the specified type. For example, returns 5 + /// for i36 and 10 for x86_fp80. + uint64_t getTypeStoreSize(const Type *Ty) const { + return (getTypeSizeInBits(Ty)+7)/8; + } + + /// getTypeStoreSizeInBits - Return the maximum number of bits that may be + /// overwritten by storing the specified type; always a multiple of 8. For + /// example, returns 40 for i36 and 80 for x86_fp80. + uint64_t getTypeStoreSizeInBits(const Type *Ty) const { + return 8*getTypeStoreSize(Ty); + } + + /// getABITypeSize - Return the offset in bytes between successive objects + /// of the specified type, including alignment padding. This is the amount + /// that alloca reserves for this type. For example, returns 12 or 16 for + /// x86_fp80, depending on alignment. + uint64_t getABITypeSize(const Type* Ty) const { unsigned char Align = getABITypeAlignment(Ty); - return (getTypeSize(Ty) + Align - 1)/Align*Align; + return (getTypeStoreSize(Ty) + Align - 1)/Align*Align; } - /// getTypeSizeInBits - Return the number of bits necessary to hold the - /// specified type. - uint64_t getTypeSizeInBits(const Type* Ty) const; + /// getABITypeSizeInBits - Return the offset in bits between successive + /// objects of the specified type, including alignment padding; always a + /// multiple of 8. This is the amount that alloca reserves for this type. + /// For example, returns 96 or 128 for x86_fp80, depending on alignment. + uint64_t getABITypeSizeInBits(const Type* Ty) const { + return 8*getABITypeSize(Ty); + } - /// getABITypeSizeInBits - Return the number of bytes allocated for the - /// specified type when used as an element in a larger object, including - /// alignment padding. - uint64_t getABITypeSizeInBits(const Type* Ty) const; + /// getTypeSize - Obsolete method, do not use. Replaced by getTypeStoreSize + /// and getABITypeSize. For alias analysis of loads and stores you probably + /// want getTypeStoreSize. Use getABITypeSize for GEP computations and alloca + /// sizing. + uint64_t getTypeSize(const Type *Ty) const { + return getTypeStoreSize(Ty); + } /// getABITypeAlignment - Return the minimum ABI-required alignment for the /// specified type. @@ -238,6 +260,10 @@ return StructSize; } + uint64_t getSizeInBits() const { + return 8*StructSize; + } + unsigned getAlignment() const { return StructAlignment; } Modified: llvm/trunk/lib/Analysis/AliasAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/AliasAnalysis.cpp?rev=43620&r1=43619&r2=43620&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/AliasAnalysis.cpp (original) +++ llvm/trunk/lib/Analysis/AliasAnalysis.cpp Thu Nov 1 15:53:16 2007 @@ -95,7 +95,7 @@ AliasAnalysis::ModRefResult AliasAnalysis::getModRefInfo(LoadInst *L, Value *P, unsigned Size) { - return alias(L->getOperand(0), TD->getTypeSize(L->getType()), + return alias(L->getOperand(0), TD->getTypeStoreSize(L->getType()), P, Size) ? Ref : NoModRef; } @@ -103,8 +103,8 @@ AliasAnalysis::getModRefInfo(StoreInst *S, Value *P, unsigned Size) { // If the stored address cannot alias the pointer in question, then the // pointer cannot be modified by the store. - if (!alias(S->getOperand(1), TD->getTypeSize(S->getOperand(0)->getType()), - P, Size)) + if (!alias(S->getOperand(1), + TD->getTypeStoreSize(S->getOperand(0)->getType()), P, Size)) return NoModRef; // If the pointer is a pointer to constant memory, then it could not have been Modified: llvm/trunk/lib/Analysis/AliasAnalysisEvaluator.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/AliasAnalysisEvaluator.cpp?rev=43620&r1=43619&r2=43620&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/AliasAnalysisEvaluator.cpp (original) +++ llvm/trunk/lib/Analysis/AliasAnalysisEvaluator.cpp Thu Nov 1 15:53:16 2007 @@ -137,12 +137,12 @@ I1 != E; ++I1) { unsigned I1Size = 0; const Type *I1ElTy = cast((*I1)->getType())->getElementType(); - if (I1ElTy->isSized()) I1Size = TD.getTypeSize(I1ElTy); + if (I1ElTy->isSized()) I1Size = TD.getTypeStoreSize(I1ElTy); for (std::set::iterator I2 = Pointers.begin(); I2 != I1; ++I2) { unsigned I2Size = 0; const Type *I2ElTy =cast((*I2)->getType())->getElementType(); - if (I2ElTy->isSized()) I2Size = TD.getTypeSize(I2ElTy); + if (I2ElTy->isSized()) I2Size = TD.getTypeStoreSize(I2ElTy); switch (AA.alias(*I1, I1Size, *I2, I2Size)) { case AliasAnalysis::NoAlias: @@ -169,7 +169,7 @@ V != Ve; ++V) { unsigned Size = 0; const Type *ElTy = cast((*V)->getType())->getElementType(); - if (ElTy->isSized()) Size = TD.getTypeSize(ElTy); + if (ElTy->isSized()) Size = TD.getTypeStoreSize(ElTy); switch (AA.getModRefInfo(*C, *V, Size)) { case AliasAnalysis::NoModRef: Modified: llvm/trunk/lib/Analysis/AliasSetTracker.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/AliasSetTracker.cpp?rev=43620&r1=43619&r2=43620&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/AliasSetTracker.cpp (original) +++ llvm/trunk/lib/Analysis/AliasSetTracker.cpp Thu Nov 1 15:53:16 2007 @@ -269,7 +269,7 @@ bool AliasSetTracker::add(LoadInst *LI) { bool NewPtr; AliasSet &AS = addPointer(LI->getOperand(0), - AA.getTargetData().getTypeSize(LI->getType()), + AA.getTargetData().getTypeStoreSize(LI->getType()), AliasSet::Refs, NewPtr); if (LI->isVolatile()) AS.setVolatile(); return NewPtr; @@ -279,7 +279,7 @@ bool NewPtr; Value *Val = SI->getOperand(0); AliasSet &AS = addPointer(SI->getOperand(1), - AA.getTargetData().getTypeSize(Val->getType()), + AA.getTargetData().getTypeStoreSize(Val->getType()), AliasSet::Mods, NewPtr); if (SI->isVolatile()) AS.setVolatile(); return NewPtr; @@ -395,7 +395,7 @@ } bool AliasSetTracker::remove(LoadInst *LI) { - unsigned Size = AA.getTargetData().getTypeSize(LI->getType()); + unsigned Size = AA.getTargetData().getTypeStoreSize(LI->getType()); AliasSet *AS = findAliasSetForPointer(LI->getOperand(0), Size); if (!AS) return false; remove(*AS); @@ -403,7 +403,8 @@ } bool AliasSetTracker::remove(StoreInst *SI) { - unsigned Size = AA.getTargetData().getTypeSize(SI->getOperand(0)->getType()); + unsigned Size = + AA.getTargetData().getTypeStoreSize(SI->getOperand(0)->getType()); AliasSet *AS = findAliasSetForPointer(SI->getOperand(1), Size); if (!AS) return false; remove(*AS); Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp?rev=43620&r1=43619&r2=43620&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp (original) +++ llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Thu Nov 1 15:53:16 2007 @@ -364,7 +364,7 @@ // global/alloca/malloc, it cannot be accessing the global (it's // undefined to load or store bytes before or after an object). const Type *ElTy = cast(O1->getType())->getElementType(); - unsigned GlobalSize = getTargetData().getTypeSize(ElTy); + unsigned GlobalSize = getTargetData().getABITypeSize(ElTy); if (GlobalSize < V2Size && V2Size != ~0U) return NoAlias; } @@ -382,7 +382,7 @@ // global/alloca/malloc, it cannot be accessing the object (it's // undefined to load or store bytes before or after an object). const Type *ElTy = cast(O2->getType())->getElementType(); - unsigned GlobalSize = getTargetData().getTypeSize(ElTy); + unsigned GlobalSize = getTargetData().getABITypeSize(ElTy); if (GlobalSize < V1Size && V1Size != ~0U) return NoAlias; } Modified: llvm/trunk/lib/Analysis/ConstantFolding.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ConstantFolding.cpp?rev=43620&r1=43619&r2=43620&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ConstantFolding.cpp (original) +++ llvm/trunk/lib/Analysis/ConstantFolding.cpp Thu Nov 1 15:53:16 2007 @@ -74,7 +74,7 @@ Offset += TD.getStructLayout(ST)->getElementOffset(CI->getZExtValue()); } else { const SequentialType *SQT = cast(*GTI); - Offset += TD.getTypeSize(SQT->getElementType())*CI->getSExtValue(); + Offset += TD.getABITypeSize(SQT->getElementType())*CI->getSExtValue(); } } return true; Modified: llvm/trunk/lib/Analysis/LoadValueNumbering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LoadValueNumbering.cpp?rev=43620&r1=43619&r2=43620&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/LoadValueNumbering.cpp (original) +++ llvm/trunk/lib/Analysis/LoadValueNumbering.cpp Thu Nov 1 15:53:16 2007 @@ -293,7 +293,7 @@ Function *F = LoadBB->getParent(); // Find out how many bytes of memory are loaded by the load instruction... - unsigned LoadSize = getAnalysis().getTypeSize(LI->getType()); + unsigned LoadSize = getAnalysis().getTypeStoreSize(LI->getType()); AliasAnalysis &AA = getAnalysis(); // Figure out if the load is invalidated from the entry of the block it is in Modified: llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp?rev=43620&r1=43619&r2=43620&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp (original) +++ llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp Thu Nov 1 15:53:16 2007 @@ -78,20 +78,20 @@ uint64_t pointerSize = 0; if (StoreInst* S = dyn_cast(QI)) { pointer = S->getPointerOperand(); - pointerSize = TD.getTypeSize(S->getOperand(0)->getType()); + pointerSize = TD.getTypeStoreSize(S->getOperand(0)->getType()); } else if (LoadInst* L = dyn_cast(QI)) { pointer = L->getPointerOperand(); - pointerSize = TD.getTypeSize(L->getType()); + pointerSize = TD.getTypeStoreSize(L->getType()); } else if (AllocationInst* AI = dyn_cast(QI)) { pointer = AI; if (ConstantInt* C = dyn_cast(AI->getArraySize())) pointerSize = C->getZExtValue() * \ - TD.getTypeSize(AI->getAllocatedType()); + TD.getABITypeSize(AI->getAllocatedType()); else pointerSize = ~0UL; } else if (VAArgInst* V = dyn_cast(QI)) { pointer = V->getOperand(0); - pointerSize = TD.getTypeSize(V->getType()); + pointerSize = TD.getTypeStoreSize(V->getType()); } else if (FreeInst* F = dyn_cast(QI)) { pointer = F->getPointerOperand(); @@ -287,15 +287,15 @@ bool queryIsVolatile = false; if (StoreInst* S = dyn_cast(query)) { dependee = S->getPointerOperand(); - dependeeSize = TD.getTypeSize(S->getOperand(0)->getType()); + dependeeSize = TD.getTypeStoreSize(S->getOperand(0)->getType()); queryIsVolatile = S->isVolatile(); } else if (LoadInst* L = dyn_cast(query)) { dependee = L->getPointerOperand(); - dependeeSize = TD.getTypeSize(L->getType()); + dependeeSize = TD.getTypeStoreSize(L->getType()); queryIsVolatile = L->isVolatile(); } else if (VAArgInst* V = dyn_cast(query)) { dependee = V->getOperand(0); - dependeeSize = TD.getTypeSize(V->getType()); + dependeeSize = TD.getTypeStoreSize(V->getType()); } else if (FreeInst* F = dyn_cast(query)) { dependee = F->getPointerOperand(); @@ -330,7 +330,7 @@ } pointer = S->getPointerOperand(); - pointerSize = TD.getTypeSize(S->getOperand(0)->getType()); + pointerSize = TD.getTypeStoreSize(S->getOperand(0)->getType()); } else if (LoadInst* L = dyn_cast(QI)) { // All volatile loads/stores depend on each other if (queryIsVolatile && L->isVolatile()) { @@ -343,17 +343,17 @@ } pointer = L->getPointerOperand(); - pointerSize = TD.getTypeSize(L->getType()); + pointerSize = TD.getTypeStoreSize(L->getType()); } else if (AllocationInst* AI = dyn_cast(QI)) { pointer = AI; if (ConstantInt* C = dyn_cast(AI->getArraySize())) pointerSize = C->getZExtValue() * \ - TD.getTypeSize(AI->getAllocatedType()); + TD.getABITypeSize(AI->getAllocatedType()); else pointerSize = ~0UL; } else if (VAArgInst* V = dyn_cast(QI)) { pointer = V->getOperand(0); - pointerSize = TD.getTypeSize(V->getType()); + pointerSize = TD.getTypeStoreSize(V->getType()); } else if (FreeInst* F = dyn_cast(QI)) { pointer = F->getPointerOperand(); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=43620&r1=43619&r2=43620&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Thu Nov 1 15:53:16 2007 @@ -3524,7 +3524,7 @@ MVT::ValueType slotVT = (Node->getOpcode() == ISD::FP_EXTEND) ? oldVT : newVT; const Type *Ty = MVT::getTypeForValueType(slotVT); - uint64_t TySize = TLI.getTargetData()->getTypeSize(Ty); + uint64_t TySize = TLI.getTargetData()->getABITypeSize(Ty); unsigned Align = TLI.getTargetData()->getPrefTypeAlignment(Ty); MachineFunction &MF = DAG.getMachineFunction(); int SSFI = @@ -3618,7 +3618,7 @@ // slots and always reusing the same one. We currently always create // new ones, as reuse may inhibit scheduling. const Type *Ty = MVT::getTypeForValueType(ExtraVT); - uint64_t TySize = TLI.getTargetData()->getTypeSize(Ty); + uint64_t TySize = TLI.getTargetData()->getABITypeSize(Ty); unsigned Align = TLI.getTargetData()->getPrefTypeAlignment(Ty); MachineFunction &MF = DAG.getMachineFunction(); int SSFI = Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp?rev=43620&r1=43619&r2=43620&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp Thu Nov 1 15:53:16 2007 @@ -482,7 +482,7 @@ Align = TM.getTargetData()->getPreferredTypeAlignmentShift(Type); if (Align == 0) { // Alignment of vector types. FIXME! - Align = TM.getTargetData()->getTypeSize(Type); + Align = TM.getTargetData()->getABITypeSize(Type); Align = Log2_64(Align); } } Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=43620&r1=43619&r2=43620&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Thu Nov 1 15:53:16 2007 @@ -261,7 +261,7 @@ if (AllocaInst *AI = dyn_cast(I)) if (ConstantInt *CUI = dyn_cast(AI->getArraySize())) { const Type *Ty = AI->getAllocatedType(); - uint64_t TySize = TLI.getTargetData()->getTypeSize(Ty); + uint64_t TySize = TLI.getTargetData()->getABITypeSize(Ty); unsigned Align = std::max((unsigned)TLI.getTargetData()->getPrefTypeAlignment(Ty), AI->getAlignment()); @@ -2335,7 +2335,7 @@ return; // getValue will auto-populate this. const Type *Ty = I.getAllocatedType(); - uint64_t TySize = TLI.getTargetData()->getTypeSize(Ty); + uint64_t TySize = TLI.getTargetData()->getABITypeSize(Ty); unsigned Align = std::max((unsigned)TLI.getTargetData()->getPrefTypeAlignment(Ty), I.getAlignment()); @@ -3546,7 +3546,7 @@ // Otherwise, create a stack slot and emit a store to it before the // asm. const Type *Ty = OpVal->getType(); - uint64_t TySize = TLI.getTargetData()->getTypeSize(Ty); + uint64_t TySize = TLI.getTargetData()->getABITypeSize(Ty); unsigned Align = TLI.getTargetData()->getPrefTypeAlignment(Ty); MachineFunction &MF = DAG.getMachineFunction(); int SSFI = MF.getFrameInfo()->CreateStackObject(TySize, Align); @@ -3804,7 +3804,7 @@ Src = DAG.getNode(ISD::ZERO_EXTEND, IntPtr, Src); // Scale the source by the type size. - uint64_t ElementSize = TD->getTypeSize(I.getType()->getElementType()); + uint64_t ElementSize = TD->getABITypeSize(I.getType()->getElementType()); Src = DAG.getNode(ISD::MUL, Src.getValueType(), Src, getIntPtrConstant(ElementSize)); @@ -3917,7 +3917,7 @@ const StructType *STy = cast(Ty->getElementType()); unsigned StructAlign = Log2_32(getTargetData()->getCallFrameTypeAlignment(STy)); - unsigned StructSize = getTargetData()->getTypeSize(STy); + unsigned StructSize = getTargetData()->getABITypeSize(STy); Flags |= (StructAlign << ISD::ParamFlags::ByValAlignOffs); Flags |= (StructSize << ISD::ParamFlags::ByValSizeOffs); } @@ -4047,7 +4047,7 @@ const StructType *STy = cast(Ty->getElementType()); unsigned StructAlign = Log2_32(getTargetData()->getCallFrameTypeAlignment(STy)); - unsigned StructSize = getTargetData()->getTypeSize(STy); + unsigned StructSize = getTargetData()->getABITypeSize(STy); Flags |= (StructAlign << ISD::ParamFlags::ByValAlignOffs); Flags |= (StructSize << ISD::ParamFlags::ByValSizeOffs); } Modified: llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp?rev=43620&r1=43619&r2=43620&view=diff ============================================================================== --- llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp (original) +++ llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp Thu Nov 1 15:53:16 2007 @@ -735,7 +735,7 @@ return; } else if (const ConstantVector *CP = dyn_cast(Init)) { unsigned ElementSize = - getTargetData()->getTypeSize(CP->getType()->getElementType()); + getTargetData()->getABITypeSize(CP->getType()->getElementType()); for (unsigned i = 0, e = CP->getNumOperands(); i != e; ++i) InitializeMemory(CP->getOperand(i), (char*)Addr+i*ElementSize); return; @@ -744,7 +744,7 @@ StoreValueToMemory(Val, (GenericValue*)Addr, Init->getType()); return; } else if (isa(Init)) { - memset(Addr, 0, (size_t)getTargetData()->getTypeSize(Init->getType())); + memset(Addr, 0, (size_t)getTargetData()->getABITypeSize(Init->getType())); return; } @@ -752,7 +752,7 @@ case Type::ArrayTyID: { const ConstantArray *CPA = cast(Init); unsigned ElementSize = - getTargetData()->getTypeSize(CPA->getType()->getElementType()); + getTargetData()->getABITypeSize(CPA->getType()->getElementType()); for (unsigned i = 0, e = CPA->getNumOperands(); i != e; ++i) InitializeMemory(CPA->getOperand(i), (char*)Addr+i*ElementSize); return; @@ -843,7 +843,7 @@ const Type *Ty = I->getType()->getElementType(); // Allocate some memory for it! - unsigned Size = TD->getTypeSize(Ty); + unsigned Size = TD->getABITypeSize(Ty); addGlobalMapping(I, new char[Size]); } else { // External variable reference. Try to use the dynamic loader to @@ -897,7 +897,7 @@ DOUT << "Global '" << GV->getName() << "' -> " << GA << "\n"; const Type *ElTy = GV->getType()->getElementType(); - size_t GVSize = (size_t)getTargetData()->getTypeSize(ElTy); + size_t GVSize = (size_t)getTargetData()->getABITypeSize(ElTy); if (GA == 0) { // If it's not already specified, allocate memory for the global. GA = new char[GVSize]; Modified: llvm/trunk/lib/ExecutionEngine/Interpreter/Execution.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Interpreter/Execution.cpp?rev=43620&r1=43619&r2=43620&view=diff ============================================================================== --- llvm/trunk/lib/ExecutionEngine/Interpreter/Execution.cpp (original) +++ llvm/trunk/lib/ExecutionEngine/Interpreter/Execution.cpp Thu Nov 1 15:53:16 2007 @@ -746,7 +746,7 @@ unsigned NumElements = getOperandValue(I.getOperand(0), SF).IntVal.getZExtValue(); - unsigned TypeSize = (size_t)TD.getTypeSize(Ty); + unsigned TypeSize = (size_t)TD.getABITypeSize(Ty); // Avoid malloc-ing zero bytes, use max()... unsigned MemToAlloc = std::max(1U, NumElements * TypeSize); @@ -806,7 +806,7 @@ Idx = (int64_t)IdxGV.IntVal.getZExtValue(); else assert(0 && "Invalid index type for getelementptr"); - Total += TD.getTypeSize(ST->getElementType())*Idx; + Total += TD.getABITypeSize(ST->getElementType())*Idx; } } Modified: llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp?rev=43620&r1=43619&r2=43620&view=diff ============================================================================== --- llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp (original) +++ llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp Thu Nov 1 15:53:16 2007 @@ -337,7 +337,7 @@ // actually initialize the global after current function has finished // compilation. const Type *GlobalType = GV->getType()->getElementType(); - size_t S = getTargetData()->getTypeSize(GlobalType); + size_t S = getTargetData()->getABITypeSize(GlobalType); size_t A = getTargetData()->getPrefTypeAlignment(GlobalType); if (A <= 8) { Ptr = malloc(S); Modified: llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp?rev=43620&r1=43619&r2=43620&view=diff ============================================================================== --- llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp (original) +++ llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp Thu Nov 1 15:53:16 2007 @@ -899,7 +899,7 @@ unsigned Size = CPE.Offset; const Type *Ty = CPE.isMachineConstantPoolEntry() ? CPE.Val.MachineCPVal->getType() : CPE.Val.ConstVal->getType(); - Size += TheJIT->getTargetData()->getTypeSize(Ty); + Size += TheJIT->getTargetData()->getABITypeSize(Ty); ConstantPoolBase = allocateSpace(Size, 1 << MCP->getConstantPoolAlignment()); ConstantPool = MCP; Modified: llvm/trunk/lib/Target/TargetData.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetData.cpp?rev=43620&r1=43619&r2=43620&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetData.cpp (original) +++ llvm/trunk/lib/Target/TargetData.cpp Thu Nov 1 15:53:16 2007 @@ -49,14 +49,13 @@ // Loop over each of the elements, placing them in memory... for (unsigned i = 0, e = NumElements; i != e; ++i) { const Type *Ty = ST->getElementType(i); - unsigned TyAlign; - uint64_t TySize; - TyAlign = (ST->isPacked() ? 1 : TD.getABITypeAlignment(Ty)); - TySize = TD.getTypeSize(Ty); - - // Add padding if necessary to make the data element aligned properly... - if (StructSize % TyAlign != 0) - StructSize = (StructSize/TyAlign + 1) * TyAlign; // Add padding... + unsigned TyAlign = ST->isPacked() ? + 1 : TD.getABITypeAlignment(Ty); + uint64_t TySize = ST->isPacked() ? + TD.getTypeStoreSize(Ty) : TD.getABITypeSize(Ty); + + // Add padding if necessary to align the data element properly... + StructSize = (StructSize + TyAlign - 1)/TyAlign * TyAlign; // Keep track of maximum alignment constraint StructAlignment = std::max(TyAlign, StructAlignment); @@ -406,83 +405,47 @@ } -uint64_t TargetData::getTypeSize(const Type *Ty) const { +uint64_t TargetData::getTypeSizeInBits(const Type *Ty) const { assert(Ty->isSized() && "Cannot getTypeInfo() on a type that is unsized!"); switch (Ty->getTypeID()) { case Type::LabelTyID: case Type::PointerTyID: - return getPointerSize(); + return getPointerSizeInBits(); case Type::ArrayTyID: { const ArrayType *ATy = cast(Ty); - uint64_t Size; - unsigned char Alignment; - Size = getTypeSize(ATy->getElementType()); - Alignment = getABITypeAlignment(ATy->getElementType()); - uint64_t AlignedSize = (Size + Alignment - 1)/Alignment*Alignment; - return AlignedSize*ATy->getNumElements(); + return getABITypeSizeInBits(ATy->getElementType())*ATy->getNumElements(); } case Type::StructTyID: { // Get the layout annotation... which is lazily created on demand. const StructLayout *Layout = getStructLayout(cast(Ty)); - return Layout->getSizeInBytes(); - } - case Type::IntegerTyID: { - unsigned BitWidth = cast(Ty)->getBitWidth(); - if (BitWidth <= 8) { - return 1; - } else if (BitWidth <= 16) { - return 2; - } else if (BitWidth <= 32) { - return 4; - } else if (BitWidth <= 64) { - return 8; - } else { - // The size of this > 64 bit type is chosen as a multiple of the - // preferred alignment of the largest "native" size the target supports. - // We first obtain the the alignment info for this type and then compute - // the next largest multiple of that size. - uint64_t size = getAlignmentInfo(INTEGER_ALIGN, BitWidth, false) * 8; - return (((BitWidth / (size)) + (BitWidth % size != 0)) * size) / 8; - } - break; + return Layout->getSizeInBits(); } + case Type::IntegerTyID: + return cast(Ty)->getBitWidth(); case Type::VoidTyID: - return 1; + return 8; case Type::FloatTyID: - return 4; + return 32; case Type::DoubleTyID: - return 8; + return 64; case Type::PPC_FP128TyID: case Type::FP128TyID: - return 16; + return 128; // In memory objects this is always aligned to a higher boundary, but - // only 10 bytes contain information. + // only 80 bits contain information. case Type::X86_FP80TyID: - return 10; + return 80; case Type::VectorTyID: { const VectorType *PTy = cast(Ty); - return PTy->getBitWidth() / 8; + return PTy->getBitWidth(); } default: - assert(0 && "TargetData::getTypeSize(): Unsupported type"); + assert(0 && "TargetData::getTypeSizeInBits(): Unsupported type"); break; } return 0; } -uint64_t TargetData::getTypeSizeInBits(const Type *Ty) const { - if (Ty->isInteger()) - return cast(Ty)->getBitWidth(); - else - return getTypeSize(Ty) * 8; -} - -uint64_t TargetData::getABITypeSizeInBits(const Type *Ty) const { - if (Ty->isInteger()) - return cast(Ty)->getBitWidth(); - else - return getABITypeSize(Ty) * 8; -} /*! \param abi_or_pref Flag that determines which alignment is returned. true returns the ABI alignment, false returns the preferred alignment. @@ -542,7 +505,7 @@ break; } - return getAlignmentInfo((AlignTypeEnum)AlignType, getTypeSize(Ty) * 8, + return getAlignmentInfo((AlignTypeEnum)AlignType, getTypeSizeInBits(Ty), abi_or_pref); } @@ -603,7 +566,7 @@ // Get the array index and the size of each array element. int64_t arrayIdx = cast(Indices[CurIDX])->getSExtValue(); - Result += arrayIdx * (int64_t)getTypeSize(Ty); + Result += arrayIdx * (int64_t)getABITypeSize(Ty); } } @@ -623,7 +586,7 @@ if (Alignment < 4) { // If the global is not external, see if it is large. If so, give it a // larger alignment. - if (getTypeSize(ElemType) > 128) + if (getTypeSizeInBits(ElemType) > 128) Alignment = 4; // 16-byte alignment. } } Modified: llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp?rev=43620&r1=43619&r2=43620&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp Thu Nov 1 15:53:16 2007 @@ -277,7 +277,7 @@ const PointerType *LoadTy = cast(Load->getOperand(0)->getType()); - unsigned LoadSize = (unsigned)TD.getTypeSize(LoadTy->getElementType()); + unsigned LoadSize = (unsigned)TD.getTypeStoreSize(LoadTy->getElementType()); if (AA.canInstructionRangeModify(BB->front(), *Load, Arg, LoadSize)) return false; // Pointer is invalidated! Modified: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp?rev=43620&r1=43619&r2=43620&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Thu Nov 1 15:53:16 2007 @@ -1227,7 +1227,7 @@ // (2048 bytes currently), as we don't want to introduce a 16M global or // something. if (NElements->getZExtValue()* - TD.getTypeSize(MI->getAllocatedType()) < 2048) { + TD.getABITypeSize(MI->getAllocatedType()) < 2048) { GVI = OptimizeGlobalAddressOfMalloc(GV, MI); return true; } Modified: llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp?rev=43620&r1=43619&r2=43620&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp Thu Nov 1 15:53:16 2007 @@ -634,7 +634,7 @@ cast(AddrInst->getOperand(i))->getZExtValue(); ConstantOffset += SL->getElementOffset(Idx); } else { - uint64_t TypeSize = TD->getTypeSize(GTI.getIndexedType()); + uint64_t TypeSize = TD->getABITypeSize(GTI.getIndexedType()); if (ConstantInt *CI = dyn_cast(AddrInst->getOperand(i))) { ConstantOffset += CI->getSExtValue()*TypeSize; } else if (TypeSize) { // Scales of zero don't do anything. Modified: llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp?rev=43620&r1=43619&r2=43620&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp Thu Nov 1 15:53:16 2007 @@ -137,8 +137,8 @@ dep != MemoryDependenceAnalysis::NonLocal && isa(dep)) { if (dep != last || - TD.getTypeSize(last->getOperand(0)->getType()) > - TD.getTypeSize(BBI->getOperand(0)->getType())) { + TD.getTypeStoreSize(last->getOperand(0)->getType()) > + TD.getTypeStoreSize(BBI->getOperand(0)->getType())) { dep = MD.getDependency(BBI, dep); continue; } @@ -210,7 +210,7 @@ Value* depPointer = dependency->getPointerOperand(); const Type* depType = dependency->getOperand(0)->getType(); - unsigned depPointerSize = TD.getTypeSize(depType); + unsigned depPointerSize = TD.getTypeStoreSize(depType); // Check for aliasing AliasAnalysis::AliasResult A = AA.alias(F->getPointerOperand(), ~0UL, @@ -329,7 +329,7 @@ unsigned pointerSize = ~0UL; if (ConstantInt* C = dyn_cast((*I)->getArraySize())) pointerSize = C->getZExtValue() * \ - TD.getTypeSize((*I)->getAllocatedType()); + TD.getABITypeSize((*I)->getAllocatedType()); // See if the call site touches it AliasAnalysis::ModRefResult A = AA.getModRefInfo(CS, *I, pointerSize); @@ -394,7 +394,7 @@ unsigned pointerSize = ~0UL; if (ConstantInt* C = dyn_cast((*I)->getArraySize())) pointerSize = C->getZExtValue() * \ - TD.getTypeSize((*I)->getAllocatedType()); + TD.getABITypeSize((*I)->getAllocatedType()); // See if this pointer could alias it AliasAnalysis::AliasResult A = AA.alias(*I, pointerSize, Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=43620&r1=43619&r2=43620&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Thu Nov 1 15:53:16 2007 @@ -4438,7 +4438,7 @@ for (unsigned i = 1, e = GEP->getNumOperands(); i != e; ++i, ++GTI) { Value *Op = GEP->getOperand(i); - uint64_t Size = TD.getTypeSize(GTI.getIndexedType()) & PtrSizeMask; + uint64_t Size = TD.getABITypeSize(GTI.getIndexedType()) & PtrSizeMask; if (ConstantInt *OpC = dyn_cast(Op)) { if (OpC->isZero()) continue; @@ -4523,7 +4523,7 @@ return ReplaceInstUsesWith(I, UndefValue::get(I.getType())); if (C->isNullValue()) EmitIt = false; - else if (TD->getTypeSize(GTI.getIndexedType()) == 0) { + else if (TD->getABITypeSize(GTI.getIndexedType()) == 0) { EmitIt = false; // This is indexing into a zero sized array? } else if (isa(C)) return ReplaceInstUsesWith(I, // No comparison is needed here. @@ -6305,8 +6305,8 @@ // same, we open the door to infinite loops of various kinds. if (!AI.hasOneUse() && CastElTyAlign == AllocElTyAlign) return 0; - uint64_t AllocElTySize = TD->getTypeSize(AllocElTy); - uint64_t CastElTySize = TD->getTypeSize(CastElTy); + uint64_t AllocElTySize = TD->getABITypeSize(AllocElTy); + uint64_t CastElTySize = TD->getABITypeSize(CastElTy); if (CastElTySize == 0 || AllocElTySize == 0) return 0; // See if we can satisfy the modulus by pulling a scale out of the array @@ -6573,7 +6573,7 @@ // is something like [0 x {int, int}] const Type *IntPtrTy = TD->getIntPtrType(); int64_t FirstIdx = 0; - if (int64_t TySize = TD->getTypeSize(GEPIdxTy)) { + if (int64_t TySize = TD->getABITypeSize(GEPIdxTy)) { FirstIdx = Offset/TySize; Offset %= TySize; @@ -6605,7 +6605,7 @@ } } else if (isa(GEPIdxTy) || isa(GEPIdxTy)) { const SequentialType *STy = cast(GEPIdxTy); - if (uint64_t EltSize = TD->getTypeSize(STy->getElementType())) { + if (uint64_t EltSize = TD->getABITypeSize(STy->getElementType())){ NewIndices.push_back(ConstantInt::get(IntPtrTy,Offset/EltSize)); Offset %= EltSize; } else { @@ -8644,7 +8644,7 @@ // insert it. This explicit cast can make subsequent optimizations more // obvious. Value *Op = GEP.getOperand(i); - if (TD->getTypeSize(Op->getType()) > TD->getPointerSize()) + if (TD->getTypeSizeInBits(Op->getType()) > TD->getPointerSizeInBits()) if (Constant *C = dyn_cast(Op)) { GEP.setOperand(i, ConstantExpr::getTrunc(C, TD->getIntPtrType())); MadeChange = true; @@ -8724,12 +8724,12 @@ } else if (Constant *GO1C = dyn_cast(GO1)) { GO1 = ConstantExpr::getIntegerCast(GO1C, SO1->getType(), true); } else { - unsigned PS = TD->getPointerSize(); - if (TD->getTypeSize(SO1->getType()) == PS) { + unsigned PS = TD->getPointerSizeInBits(); + if (TD->getTypeSizeInBits(SO1->getType()) == PS) { // Convert GO1 to SO1's type. GO1 = InsertCastToIntPtrTy(GO1, SO1->getType(), &GEP, this); - } else if (TD->getTypeSize(GO1->getType()) == PS) { + } else if (TD->getTypeSizeInBits(GO1->getType()) == PS) { // Convert SO1 to GO1's type. SO1 = InsertCastToIntPtrTy(SO1, GO1->getType(), &GEP, this); } else { @@ -8818,8 +8818,8 @@ const Type *SrcElTy = cast(X->getType())->getElementType(); const Type *ResElTy=cast(PtrOp->getType())->getElementType(); if (isa(SrcElTy) && - TD->getTypeSize(cast(SrcElTy)->getElementType()) == - TD->getTypeSize(ResElTy)) { + TD->getABITypeSize(cast(SrcElTy)->getElementType()) == + TD->getABITypeSize(ResElTy)) { Value *Idx[2]; Idx[0] = Constant::getNullValue(Type::Int32Ty); Idx[1] = GEP.getOperand(1); @@ -8837,7 +8837,7 @@ if (isa(SrcElTy) && (ResElTy == Type::Int8Ty || ResElTy == Type::Int8Ty)) { uint64_t ArrayEltSize = - TD->getTypeSize(cast(SrcElTy)->getElementType()); + TD->getABITypeSize(cast(SrcElTy)->getElementType()); // Check to see if "tmp" is a scale by a multiple of ArrayEltSize. We // allow either a mul, shift, or constant here. @@ -8938,7 +8938,7 @@ // Note that we only do this for alloca's, because malloc should allocate and // return a unique pointer, even for a zero byte allocation. if (isa(AI) && AI.getAllocatedType()->isSized() && - TD->getTypeSize(AI.getAllocatedType()) == 0) + TD->getABITypeSize(AI.getAllocatedType()) == 0) return ReplaceInstUsesWith(AI, Constant::getNullValue(AI.getType())); return 0; Modified: llvm/trunk/lib/Transforms/Scalar/LICM.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LICM.cpp?rev=43620&r1=43619&r2=43620&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LICM.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LICM.cpp Thu Nov 1 15:53:16 2007 @@ -366,7 +366,7 @@ // Don't hoist loads which have may-aliased stores in loop. unsigned Size = 0; if (LI->getType()->isSized()) - Size = AA->getTargetData().getTypeSize(LI->getType()); + Size = AA->getTargetData().getTypeStoreSize(LI->getType()); return !pointerInvalidatedByLoop(LI->getOperand(0), Size); } else if (CallInst *CI = dyn_cast(&I)) { // Handle obvious cases efficiently. Modified: llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp?rev=43620&r1=43619&r2=43620&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp Thu Nov 1 15:53:16 2007 @@ -1120,11 +1120,8 @@ uint32_t typeToWidth(const Type *Ty) const { if (TD) return TD->getTypeSizeInBits(Ty); - - if (const IntegerType *ITy = dyn_cast(Ty)) - return ITy->getBitWidth(); - - return 0; + else + return Ty->getPrimitiveSizeInBits(); } static bool isRelatedBy(const ConstantRange &CR1, const ConstantRange &CR2, Modified: llvm/trunk/lib/Transforms/Utils/LowerAllocations.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LowerAllocations.cpp?rev=43620&r1=43619&r2=43620&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/LowerAllocations.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/LowerAllocations.cpp Thu Nov 1 15:53:16 2007 @@ -116,7 +116,7 @@ // malloc(type) becomes sbyte *malloc(size) Value *MallocArg; if (LowerMallocArgToInteger) - MallocArg = ConstantInt::get(Type::Int64Ty, TD.getTypeSize(AllocTy)); + MallocArg = ConstantInt::get(Type::Int64Ty, TD.getABITypeSize(AllocTy)); else MallocArg = ConstantExpr::getSizeOf(AllocTy); MallocArg = ConstantExpr::getTruncOrBitCast(cast(MallocArg), From baldrick at free.fr Thu Nov 1 15:56:26 2007 From: baldrick at free.fr (Duncan Sands) Date: Thu, 01 Nov 2007 20:56:26 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r43621 - in /llvm-gcc-4.2/trunk/gcc: llvm-convert.cpp llvm-types.cpp Message-ID: <200711012056.lA1KuRf9007655@zion.cs.uiuc.edu> Author: baldrick Date: Thu Nov 1 15:56:26 2007 New Revision: 43621 URL: http://llvm.org/viewvc/llvm-project?rev=43621&view=rev Log: Change most uses of getTypeSize to getTypeStoreSize or getABITypeSize, hopefully correctly. Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=43621&r1=43620&r2=43621&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Thu Nov 1 15:56:26 2007 @@ -2885,7 +2885,7 @@ // We can't get the type size (and thus convert to using a GEP instr) from // pointers to opaque structs if the type isn't abstract. if (ElTy->isSized()) { - int64_t EltSize = TD.getTypeSize(ElTy); + int64_t EltSize = TD.getABITypeSize(ElTy); // If EltSize exactly divides Offset, then we know that we can turn this // into a getelementptr instruction. @@ -5712,7 +5712,7 @@ static Constant *ConvertStructFieldInitializerToType(Constant *Val, const Type *FieldTy) { const TargetData &TD = getTargetData(); - assert(TD.getTypeSize(FieldTy) == TD.getTypeSize(Val->getType()) && + assert(TD.getABITypeSize(FieldTy) == TD.getABITypeSize(Val->getType()) && "Mismatched initializer type isn't same size as initializer!"); // If this is an integer initializer for an array of ubytes, we are @@ -5834,7 +5834,7 @@ tree UnionType = TREE_TYPE(exp); if (TYPE_SIZE(UnionType) && TREE_CODE(TYPE_SIZE(UnionType)) == INTEGER_CST) { unsigned UnionSize = ((unsigned)TREE_INT_CST_LOW(TYPE_SIZE(UnionType))+7)/8; - unsigned InitSize = getTargetData().getTypeSize(Elts[0]->getType()); + unsigned InitSize = getTargetData().getABITypeSize(Elts[0]->getType()); if (UnionSize != InitSize) { const Type *FillTy; assert(UnionSize > InitSize && "Init shouldn't be larger than union!"); Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp?rev=43621&r1=43620&r2=43621&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Thu Nov 1 15:56:26 2007 @@ -1173,7 +1173,7 @@ /// getTypeSize - Return the size of the specified type in bytes. /// unsigned getTypeSize(const Type *Ty) const { - return TD.getTypeSize(Ty); + return Packed ? TD.getTypeStoreSize(Ty) : TD.getABITypeSize(Ty); } /// getLLVMType - Return the LLVM type for the specified object. @@ -1859,7 +1859,7 @@ const Type *TheTy = ConvertType(TREE_TYPE(Field)); bool isPacked = false; - unsigned Size = TD.getTypeSize(TheTy); + unsigned Size = TD.getABITypeSize(TheTy); unsigned Align = TD.getABITypeAlignment(TheTy); if (const StructType *STy = dyn_cast(TheTy)) if (STy->isPacked()) @@ -1892,7 +1892,7 @@ std::vector UnionElts; unsigned UnionSize = 0; if (UnionTy) { // Not an empty union. - UnionSize = TD.getTypeSize(UnionTy); + UnionSize = TD.getABITypeSize(UnionTy); UnionElts.push_back(UnionTy); } From baldrick at free.fr Thu Nov 1 15:57:39 2007 From: baldrick at free.fr (Duncan Sands) Date: Thu, 01 Nov 2007 20:57:39 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r43622 - in /llvm-gcc-4.0/trunk/gcc: llvm-convert.cpp llvm-types.cpp Message-ID: <200711012057.lA1KvdPJ007721@zion.cs.uiuc.edu> Author: baldrick Date: Thu Nov 1 15:57:38 2007 New Revision: 43622 URL: http://llvm.org/viewvc/llvm-project?rev=43622&view=rev Log: Change most uses of getTypeSize to getTypeStoreSize or getABITypeSize, hopefully correctly. Modified: llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp llvm-gcc-4.0/trunk/gcc/llvm-types.cpp Modified: llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp?rev=43622&r1=43621&r2=43622&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp Thu Nov 1 15:57:38 2007 @@ -3364,7 +3364,7 @@ // We can't get the type size (and thus convert to using a GEP instr) from // pointers to opaque structs if the type isn't abstract. if (ElTy->isSized()) { - int64_t EltSize = TD.getTypeSize(ElTy); + int64_t EltSize = TD.getABITypeSize(ElTy); // If EltSize exactly divides Offset, then we know that we can turn this // into a getelementptr instruction. @@ -6152,7 +6152,7 @@ static Constant *ConvertStructFieldInitializerToType(Constant *Val, const Type *FieldTy) { const TargetData &TD = getTargetData(); - assert(TD.getTypeSize(FieldTy) == TD.getTypeSize(Val->getType()) && + assert(TD.getABITypeSize(FieldTy) == TD.getABITypeSize(Val->getType()) && "Mismatched initializer type isn't same size as initializer!"); // If this is an integer initializer for an array of ubytes, we are @@ -6271,7 +6271,7 @@ tree UnionType = TREE_TYPE(exp); if (TYPE_SIZE(UnionType) && TREE_CODE(TYPE_SIZE(UnionType)) == INTEGER_CST) { unsigned UnionSize = ((unsigned)TREE_INT_CST_LOW(TYPE_SIZE(UnionType))+7)/8; - unsigned InitSize = getTargetData().getTypeSize(Elts[0]->getType()); + unsigned InitSize = getTargetData().getABITypeSize(Elts[0]->getType()); if (UnionSize != InitSize) { const Type *FillTy; assert(UnionSize > InitSize && "Init shouldn't be larger than union!"); Modified: llvm-gcc-4.0/trunk/gcc/llvm-types.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-types.cpp?rev=43622&r1=43621&r2=43622&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/llvm-types.cpp (original) +++ llvm-gcc-4.0/trunk/gcc/llvm-types.cpp Thu Nov 1 15:57:38 2007 @@ -1149,7 +1149,7 @@ /// getTypeSize - Return the size of the specified type in bytes. /// unsigned getTypeSize(const Type *Ty) const { - return TD.getTypeSize(Ty); + return Packed ? TD.getTypeStoreSize(Ty) : TD.getABITypeSize(Ty); } /// getLLVMType - Return the LLVM type for the specified object. @@ -1849,7 +1849,7 @@ const Type *TheTy = ConvertType(TREE_TYPE(Field)); bool isPacked = false; - unsigned Size = TD.getTypeSize(TheTy); + unsigned Size = TD.getABITypeSize(TheTy); unsigned Align = TD.getABITypeAlignment(TheTy); if (const StructType *STy = dyn_cast(TheTy)) if (STy->isPacked()) @@ -1882,7 +1882,7 @@ std::vector UnionElts; unsigned UnionSize = 0; if (UnionTy) { // Not an empty union. - UnionSize = TD.getTypeSize(UnionTy); + UnionSize = TD.getABITypeSize(UnionTy); UnionElts.push_back(UnionTy); } From dalej at apple.com Thu Nov 1 16:19:38 2007 From: dalej at apple.com (Dale Johannesen) Date: Thu, 1 Nov 2007 14:19:38 -0700 Subject: [llvm-commits] [llvm] r43620 - in /llvm/trunk: include/llvm/Target/ lib/Analysis/ lib/CodeGen/SelectionDAG/ lib/ExecutionEngine/ lib/ExecutionEngine/Interpreter/ lib/ExecutionEngine/JIT/ lib/Target/ lib/Transforms/IPO/ lib/Transforms/Scalar/ lib/Transforms/Utils/ In-Reply-To: <200711012053.lA1KrIUW007528@zion.cs.uiuc.edu> References: <200711012053.lA1KrIUW007528@zion.cs.uiuc.edu> Message-ID: <9D0B8548-7317-4659-BFE9-B575A3F8E215@apple.com> On Nov 1, 2007, at 1:53 PM, Duncan Sands wrote: > Finally, I made one change which I think wise but others might > consider pointless and suboptimal: in an unpacked struct the > amount of space allocated for a field is now given by the ABI > size rather than getTypeStoreSize. I did this because every > other place that reserves memory for a type (eg: alloca) now > uses getABITypeSize, and I didn't want to make an exception > for unpacked structs, i.e. I did it to make things more uniform. > This only effects structs containing long doubles and arbitrary > precision integers. If someone wants to pack these types more > tightly they can always use a packed struct. Not sure I'm understanding this. The layout of structs is not something we can change around: we need to be runtime-compatible with gcc. (There have been bugs in this area and perhaps still are, but that's the eventual requirement.) IIRC this was previously achieved by looking at the alignment. Are you just achieving the same layout a different way (I have no objection), or is the layout changing? From kremenek at apple.com Thu Nov 1 17:23:35 2007 From: kremenek at apple.com (Ted Kremenek) Date: Thu, 01 Nov 2007 22:23:35 -0000 Subject: [llvm-commits] [llvm] r43624 - in /llvm/trunk: include/llvm/Bitcode/Deserialize.h include/llvm/Bitcode/Serialization.h lib/Bitcode/Reader/Deserialize.cpp Message-ID: <200711012223.lA1MNZE4011977@zion.cs.uiuc.edu> Author: kremenek Date: Thu Nov 1 17:23:34 2007 New Revision: 43624 URL: http://llvm.org/viewvc/llvm-project?rev=43624&view=rev Log: Removed ReadVal from SerializeTrait, and also removed it from Deserializer. There were issues with Visual C++ barfing when instantiating SerializeTrait when "T" was an abstract class AND SerializeTrait::ReadVal was *never* called: template struct SerializeTrait { static inline T ReadVal(Deserializer& D) { T::ReadVal(D); } }; Visual C++ would complain about "T" being an abstract class, even though ReadVal was never instantiated (although one of the other member functions were). Removing this from the trait is not a big deal. It was used hardly ever, and users who want "read-by-value" deserialization can simply call the appropriate methods directly instead of relying on trait-based-dispatch. The trait dispatch for serialization/deserialization is simply sugar in many cases (like this one). Modified: llvm/trunk/include/llvm/Bitcode/Deserialize.h llvm/trunk/include/llvm/Bitcode/Serialization.h llvm/trunk/lib/Bitcode/Reader/Deserialize.cpp Modified: llvm/trunk/include/llvm/Bitcode/Deserialize.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/Deserialize.h?rev=43624&r1=43623&r2=43624&view=diff ============================================================================== --- llvm/trunk/include/llvm/Bitcode/Deserialize.h (original) +++ llvm/trunk/include/llvm/Bitcode/Deserialize.h Thu Nov 1 17:23:34 2007 @@ -103,11 +103,6 @@ SerializeTrait::Read(*this,X); return X; } - - template - inline T ReadVal() { - return SerializeTrait::ReadVal(*this); - } template inline T* Materialize() { Modified: llvm/trunk/include/llvm/Bitcode/Serialization.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/Serialization.h?rev=43624&r1=43623&r2=43624&view=diff ============================================================================== --- llvm/trunk/include/llvm/Bitcode/Serialization.h (original) +++ llvm/trunk/include/llvm/Bitcode/Serialization.h Thu Nov 1 17:23:34 2007 @@ -37,15 +37,13 @@ struct SerializeTrait { static inline void Emit(Serializer& S, const T& X) { X.Emit(S); } static inline void Read(Deserializer& D, T& X) { X.Read(D); } - static inline T ReadVal(Deserializer& D) { T::ReadVal(D); } static inline T* Materialize(Deserializer& D) { return T::Materialize(D); } }; #define SERIALIZE_INT_TRAIT(TYPE)\ template <> struct SerializeTrait {\ static void Emit(Serializer& S, TYPE X);\ - static void Read(Deserializer& S, TYPE& X);\ - static TYPE ReadVal(Deserializer& S); }; + static void Read(Deserializer& S, TYPE& X); }; SERIALIZE_INT_TRAIT(bool) SERIALIZE_INT_TRAIT(unsigned char) Modified: llvm/trunk/lib/Bitcode/Reader/Deserialize.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/Deserialize.cpp?rev=43624&r1=43623&r2=43624&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Reader/Deserialize.cpp (original) +++ llvm/trunk/lib/Bitcode/Reader/Deserialize.cpp Thu Nov 1 17:23:34 2007 @@ -166,9 +166,7 @@ #define INT_READ(TYPE)\ void SerializeTrait::Read(Deserializer& D, TYPE& X) {\ - X = (TYPE) D.ReadInt(); }\ -TYPE SerializeTrait::ReadVal(Deserializer& D) {\ - return (TYPE) D.ReadInt(); } + X = (TYPE) D.ReadInt(); } INT_READ(bool) INT_READ(unsigned char) From neil at daikokuya.co.uk Thu Nov 1 17:43:40 2007 From: neil at daikokuya.co.uk (Neil Booth) Date: Thu, 01 Nov 2007 22:43:40 -0000 Subject: [llvm-commits] [llvm] r43626 - in /llvm/trunk: include/llvm/ADT/APFloat.h lib/Support/APFloat.cpp Message-ID: <200711012243.lA1MheOE012938@zion.cs.uiuc.edu> Author: neil Date: Thu Nov 1 17:43:37 2007 New Revision: 43626 URL: http://llvm.org/viewvc/llvm-project?rev=43626&view=rev Log: When converting to integer, do bit manipulations in the destination memory rather than in a copy of the APFloat. This avoids problems when the destination is wider than our significand and is cleaner. Also provide deterministic values in all cases where conversion fails, namely zero for NaNs and the minimal or maximal value respectively for underflow or overflow. Modified: llvm/trunk/include/llvm/ADT/APFloat.h llvm/trunk/lib/Support/APFloat.cpp Modified: llvm/trunk/include/llvm/ADT/APFloat.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/APFloat.h?rev=43626&r1=43625&r2=43626&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/APFloat.h (original) +++ llvm/trunk/include/llvm/ADT/APFloat.h Thu Nov 1 17:43:37 2007 @@ -275,6 +275,8 @@ cmpResult compareAbsoluteValue(const APFloat &) const; opStatus handleOverflow(roundingMode); bool roundAwayFromZero(roundingMode, lostFraction, unsigned int) const; + opStatus convertToSignExtendedInteger(integerPart *, unsigned int, bool, + roundingMode) const; opStatus convertFromUnsignedParts(const integerPart *, unsigned int, roundingMode); opStatus convertFromHexadecimalString(const char *, roundingMode); Modified: llvm/trunk/lib/Support/APFloat.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APFloat.cpp?rev=43626&r1=43625&r2=43626&view=diff ============================================================================== --- llvm/trunk/lib/Support/APFloat.cpp (original) +++ llvm/trunk/lib/Support/APFloat.cpp Thu Nov 1 17:43:37 2007 @@ -1733,7 +1733,8 @@ /* Convert a floating point number to an integer according to the rounding mode. If the rounded integer value is out of range this - returns an invalid operation exception. If the rounded value is in + returns an invalid operation exception and the contents of the + destination parts are unspecified. If the rounded value is in range but the floating point number is not the exact integer, the C standard doesn't require an inexact exception to be raised. IEEE 854 does require it so we do that. @@ -1741,95 +1742,131 @@ Note that for conversions to integer type the C standard requires round-to-zero to always be used. */ APFloat::opStatus -APFloat::convertToInteger(integerPart *parts, unsigned int width, - bool isSigned, - roundingMode rounding_mode) const +APFloat::convertToSignExtendedInteger(integerPart *parts, unsigned int width, + bool isSigned, + roundingMode rounding_mode) const { lostFraction lost_fraction; - unsigned int msb, partsCount; - int bits; + const integerPart *src; + unsigned int dstPartsCount, truncatedBits; - assertArithmeticOK(*semantics); - partsCount = partCountForBits(width); - - /* Handle the three special cases first. We produce - a deterministic result even for the Invalid cases. */ - if (category == fcNaN) { - // Neither sign nor isSigned affects this. - APInt::tcSet(parts, 0, partsCount); + /* Handle the three special cases first. */ + if(category == fcInfinity || category == fcNaN) return opInvalidOp; - } - if (category == fcInfinity) { - if (!sign && isSigned) - APInt::tcSetLeastSignificantBits(parts, partsCount, width-1); - else if (!sign && !isSigned) - APInt::tcSetLeastSignificantBits(parts, partsCount, width); - else if (sign && isSigned) { - APInt::tcSetLeastSignificantBits(parts, partsCount, 1); - APInt::tcShiftLeft(parts, partsCount, width-1); - } else // sign && !isSigned - APInt::tcSet(parts, 0, partsCount); - return opInvalidOp; - } - if (category == fcZero) { - APInt::tcSet(parts, 0, partsCount); + + dstPartsCount = partCountForBits(width); + + if(category == fcZero) { + APInt::tcSet(parts, 0, dstPartsCount); return opOK; } - /* Shift the bit pattern so the fraction is lost. */ - APFloat tmp(*this); - - bits = (int) semantics->precision - 1 - exponent; + src = significandParts(); - if(bits > 0) { - lost_fraction = tmp.shiftSignificandRight(bits); + /* Step 1: place our absolute value, with any fraction truncated, in + the destination. */ + if (exponent < 0) { + /* Our absolute value is less than one; truncate everything. */ + APInt::tcSet(parts, 0, dstPartsCount); + truncatedBits = semantics->precision; } else { - if ((unsigned) -bits >= semantics->precision) { - // Unrepresentably large. - if (!sign && isSigned) - APInt::tcSetLeastSignificantBits(parts, partsCount, width-1); - else if (!sign && !isSigned) - APInt::tcSetLeastSignificantBits(parts, partsCount, width); - else if (sign && isSigned) { - APInt::tcSetLeastSignificantBits(parts, partsCount, 1); - APInt::tcShiftLeft(parts, partsCount, width-1); - } else // sign && !isSigned - APInt::tcSet(parts, 0, partsCount); - return (opStatus)(opOverflow | opInexact); + /* We want the most significant (exponent + 1) bits; the rest are + truncated. */ + unsigned int bits = exponent + 1U; + + /* Hopelessly large in magnitude? */ + if (bits > width) + return opInvalidOp; + + if (bits < semantics->precision) { + /* We truncate (semantics->precision - bits) bits. */ + truncatedBits = semantics->precision - bits; + APInt::tcExtract(parts, dstPartsCount, src, bits, truncatedBits); + } else { + /* We want at least as many bits as are available. */ + APInt::tcExtract(parts, dstPartsCount, src, semantics->precision, 0); + APInt::tcShiftLeft(parts, dstPartsCount, bits - semantics->precision); + truncatedBits = 0; + } + } + + /* Step 2: work out any lost fraction, and increment the absolute + value if we would round away from zero. */ + if (truncatedBits) { + lost_fraction = lostFractionThroughTruncation(src, partCount(), + truncatedBits); + if (lost_fraction != lfExactlyZero + && roundAwayFromZero(rounding_mode, lost_fraction, truncatedBits)) { + if (APInt::tcIncrement(parts, dstPartsCount)) + return opInvalidOp; /* Overflow. */ } - tmp.shiftSignificandLeft(-bits); + } else { lost_fraction = lfExactlyZero; } - if(lost_fraction != lfExactlyZero - && tmp.roundAwayFromZero(rounding_mode, lost_fraction, 0)) - tmp.incrementSignificand(); + /* Step 3: check if we fit in the destination. */ + unsigned int omsb = APInt::tcMSB(parts, dstPartsCount) + 1; - msb = tmp.significandMSB(); + if (sign) { + if (!isSigned) { + /* Negative numbers cannot be represented as unsigned. */ + if (omsb != 0) + return opInvalidOp; + } else { + /* It takes omsb bits to represent the unsigned integer value. + We lose a bit for the sign, but care is needed as the + maximally negative integer is a special case. */ + if (omsb == width && APInt::tcLSB(parts, dstPartsCount) + 1 != omsb) + return opInvalidOp; + + /* This case can happen because of rounding. */ + if (omsb > width) + return opInvalidOp; + } - /* Negative numbers cannot be represented as unsigned. */ - if(!isSigned && tmp.sign && msb != -1U) - return opInvalidOp; + APInt::tcNegate (parts, dstPartsCount); + } else { + if (omsb >= width + !isSigned) + return opInvalidOp; + } - /* It takes exponent + 1 bits to represent the truncated floating - point number without its sign. We lose a bit for the sign, but - the maximally negative integer is a special case. */ - if(msb + 1 > width) /* !! Not same as msb >= width !! */ - return opInvalidOp; + if (lost_fraction == lfExactlyZero) + return opOK; + else + return opInexact; +} - if(isSigned && msb + 1 == width - && (!tmp.sign || tmp.significandLSB() != msb)) - return opInvalidOp; +/* Same as convertToSignExtendedInteger, except we provide + deterministic values in case of an invalid operation exception, + namely zero for NaNs and the minimal or maximal value respectively + for underflow or overflow. */ +APFloat::opStatus +APFloat::convertToInteger(integerPart *parts, unsigned int width, + bool isSigned, + roundingMode rounding_mode) const +{ + opStatus fs; - APInt::tcAssign(parts, tmp.significandParts(), partsCount); + fs = convertToSignExtendedInteger(parts, width, isSigned, rounding_mode); - if(tmp.sign) - APInt::tcNegate(parts, partsCount); + if (fs == opInvalidOp) { + unsigned int bits, dstPartsCount; - if(lost_fraction == lfExactlyZero) - return opOK; - else - return opInexact; + dstPartsCount = partCountForBits(width); + + if (category == fcNaN) + bits = 0; + else if (sign) + bits = isSigned; + else + bits = width - isSigned; + + APInt::tcSetLeastSignificantBits(parts, dstPartsCount, bits); + if (sign && isSigned) + APInt::tcShiftLeft(parts, dstPartsCount, width - 1); + } + + return fs; } /* Convert an unsigned integer SRC to a floating point number, @@ -2162,7 +2199,6 @@ partCount++; } while (p <= D.lastSigDigit); - category = fcNormal; fs = roundSignificandWithExponent(decSignificand, partCount, D.exponent, rounding_mode); From neil at daikokuya.co.uk Thu Nov 1 17:51:07 2007 From: neil at daikokuya.co.uk (Neil Booth) Date: Thu, 01 Nov 2007 22:51:07 -0000 Subject: [llvm-commits] [llvm] r43627 - /llvm/trunk/lib/Support/APFloat.cpp Message-ID: <200711012251.lA1Mp7ej013361@zion.cs.uiuc.edu> Author: neil Date: Thu Nov 1 17:51:07 2007 New Revision: 43627 URL: http://llvm.org/viewvc/llvm-project?rev=43627&view=rev Log: Add back line whose removal somehow crept into prior patch Modified: llvm/trunk/lib/Support/APFloat.cpp Modified: llvm/trunk/lib/Support/APFloat.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APFloat.cpp?rev=43627&r1=43626&r2=43627&view=diff ============================================================================== --- llvm/trunk/lib/Support/APFloat.cpp (original) +++ llvm/trunk/lib/Support/APFloat.cpp Thu Nov 1 17:51:07 2007 @@ -2199,6 +2199,7 @@ partCount++; } while (p <= D.lastSigDigit); + category = fcNormal; fs = roundSignificandWithExponent(decSignificand, partCount, D.exponent, rounding_mode); From evan.cheng at apple.com Thu Nov 1 20:26:22 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 02 Nov 2007 01:26:22 -0000 Subject: [llvm-commits] [llvm] r43630 - in /llvm/trunk: lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/2007-11-01-ISelCrash.ll Message-ID: <200711020126.lA21QN9R019581@zion.cs.uiuc.edu> Author: evancheng Date: Thu Nov 1 20:26:22 2007 New Revision: 43630 URL: http://llvm.org/viewvc/llvm-project?rev=43630&view=rev Log: Missing a getNumOperands check. Added: llvm/trunk/test/CodeGen/X86/2007-11-01-ISelCrash.ll Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=43630&r1=43629&r2=43630&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Thu Nov 1 20:26:22 2007 @@ -1451,42 +1451,45 @@ } /// IsEligibleForTailCallElimination - Check to see whether the next instruction -// following the call is a return. A function is eligible if caller/callee -// calling conventions match, currently only fastcc supports tail calls, and the -// function CALL is immediatly followed by a RET. +/// following the call is a return. A function is eligible if caller/callee +/// calling conventions match, currently only fastcc supports tail calls, and +/// the function CALL is immediatly followed by a RET. bool X86TargetLowering::IsEligibleForTailCallOptimization(SDOperand Call, SDOperand Ret, SelectionDAG& DAG) const { - bool IsEligible = false; + if (!PerformTailCallOpt) + return false; // Check whether CALL node immediatly preceeds the RET node and whether the // return uses the result of the node or is a void return. - if ((Ret.getNumOperands() == 1 && - (Ret.getOperand(0)== SDOperand(Call.Val,1) || - Ret.getOperand(0)== SDOperand(Call.Val,0))) || - (Ret.getOperand(0)== SDOperand(Call.Val,Call.Val->getNumValues()-1) && - Ret.getOperand(1)== SDOperand(Call.Val,0))) { + unsigned NumOps = Ret.getNumOperands(); + if ((NumOps == 1 && + (Ret.getOperand(0) == SDOperand(Call.Val,1) || + Ret.getOperand(0) == SDOperand(Call.Val,0))) || + (NumOps == 2 && + Ret.getOperand(0) == SDOperand(Call.Val,Call.Val->getNumValues()-1) && + Ret.getOperand(1) == SDOperand(Call.Val,0))) { MachineFunction &MF = DAG.getMachineFunction(); unsigned CallerCC = MF.getFunction()->getCallingConv(); unsigned CalleeCC = cast(Call.getOperand(1))->getValue(); if (CalleeCC == CallingConv::Fast && CallerCC == CalleeCC) { SDOperand Callee = Call.getOperand(4); // On elf/pic %ebx needs to be livein. - if(getTargetMachine().getRelocationModel() == Reloc::PIC_ && - Subtarget->isPICStyleGOT()) { - // Can only do local tail calls with PIC. - GlobalValue * GV = 0; - GlobalAddressSDNode *G = dyn_cast(Callee); - if(G != 0 && - (GV = G->getGlobal()) && - (GV->hasHiddenVisibility() || GV->hasProtectedVisibility())) - IsEligible=true; - } else { - IsEligible=true; - } + if (getTargetMachine().getRelocationModel() != Reloc::PIC_ || + !Subtarget->isPICStyleGOT()) + return true; + + // Can only do local tail calls with PIC. + GlobalValue * GV = 0; + GlobalAddressSDNode *G = dyn_cast(Callee); + if(G != 0 && + (GV = G->getGlobal()) && + (GV->hasHiddenVisibility() || GV->hasProtectedVisibility())) + return true; } } - return IsEligible; + + return false; } SDOperand X86TargetLowering::LowerX86_TailCallTo(SDOperand Op, Added: llvm/trunk/test/CodeGen/X86/2007-11-01-ISelCrash.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2007-11-01-ISelCrash.ll?rev=43630&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/2007-11-01-ISelCrash.ll (added) +++ llvm/trunk/test/CodeGen/X86/2007-11-01-ISelCrash.ll Thu Nov 1 20:26:22 2007 @@ -0,0 +1,10 @@ + %"struct.K::JL" = type <{ i8 }> + %struct.jv = type { i64 } + +declare fastcc i64 @f(i32, %"struct.K::JL"*, i8*, i8*, %struct.jv*) + +define void @t(%"struct.K::JL"* %obj, i8* %name, i8* %sig, %struct.jv* %args) { +entry: + %tmp5 = tail call fastcc i64 @f( i32 1, %"struct.K::JL"* %obj, i8* %name, i8* %sig, %struct.jv* %args ) ; [#uses=0] + ret void +} From dpatel at apple.com Thu Nov 1 20:43:04 2007 From: dpatel at apple.com (Devang Patel) Date: Thu, 1 Nov 2007 18:43:04 -0700 Subject: [llvm-commits] [llvm] r43620 - in /llvm/trunk: include/llvm/Target/ lib/Analysis/ lib/CodeGen/SelectionDAG/ lib/ExecutionEngine/ lib/ExecutionEngine/Interpreter/ lib/ExecutionEngine/JIT/ lib/Target/ lib/Transforms/IPO/ lib/Transforms/Scalar/ lib/Transforms/Utils/ In-Reply-To: <200711012053.lA1KrIUW007528@zion.cs.uiuc.edu> References: <200711012053.lA1KrIUW007528@zion.cs.uiuc.edu> Message-ID: On Nov 1, 2007, at 1:53 PM, Duncan Sands wrote: > Finally, I made one change which I think wise but others might > consider pointless and suboptimal: in an unpacked struct the > amount of space allocated for a field is now given by the ABI > size rather than getTypeStoreSize. I did this because every > other place that reserves memory for a type (eg: alloca) now > uses getABITypeSize, and I didn't want to make an exception > for unpacked structs, i.e. I did it to make things more uniform. > This only effects structs containing long doubles and arbitrary > precision integers. If someone wants to pack these types more > tightly they can always use a packed struct. Naively, I just used getTypeSizeInBits() clang yesterday. I'll sync up clang once dust settles on llvm side in next day or two. Now, how far we are from ability to use arbitrary precision integers to represent struct bit fields directly ? translating struct STest4 {char a; int b:2; int c:3; int d; } st4; into %struct.STest4 = type { i8, i2, i3, i32 } instead of %struct.STest4 = type { i8, i8, i32 } ?:) - Devang -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20071101/6d11d28c/attachment.html From hartmut.kaiser at gmail.com Thu Nov 1 20:44:09 2007 From: hartmut.kaiser at gmail.com (Hartmut Kaiser) Date: Fri, 02 Nov 2007 01:44:09 -0000 Subject: [llvm-commits] [llvm] r43631 - in /llvm/trunk/win32: CodeGen/CodeGen.vcproj clang.sln Message-ID: <200711020144.lA21i9xM020244@zion.cs.uiuc.edu> Author: hkaiser Date: Thu Nov 1 20:44:08 2007 New Revision: 43631 URL: http://llvm.org/viewvc/llvm-project?rev=43631&view=rev Log: Updated VC++ build system Modified: llvm/trunk/win32/CodeGen/CodeGen.vcproj llvm/trunk/win32/clang.sln Modified: llvm/trunk/win32/CodeGen/CodeGen.vcproj URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/win32/CodeGen/CodeGen.vcproj?rev=43631&r1=43630&r2=43631&view=diff ============================================================================== --- llvm/trunk/win32/CodeGen/CodeGen.vcproj (original) +++ llvm/trunk/win32/CodeGen/CodeGen.vcproj Thu Nov 1 20:44:08 2007 @@ -222,6 +222,10 @@ > + + @@ -290,6 +294,10 @@ > + + Modified: llvm/trunk/win32/clang.sln URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/win32/clang.sln?rev=43631&r1=43630&r2=43631&view=diff ============================================================================== --- llvm/trunk/win32/clang.sln (original) +++ llvm/trunk/win32/clang.sln Thu Nov 1 20:44:08 2007 @@ -15,9 +15,9 @@ Release.AspNetCompiler.Debug = "False" EndProjectSection ProjectSection(ProjectDependencies) = postProject - {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} + {19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E} + {0F8407F3-FA23-4CF1-83A9-DCBE0B361489} = {0F8407F3-FA23-4CF1-83A9-DCBE0B361489} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Fibonacci", "Fibonacci\Fibonacci.vcproj", "{48FB551D-E37E-42EC-BC97-FF7219774867}" @@ -26,14 +26,14 @@ Release.AspNetCompiler.Debug = "False" EndProjectSection ProjectSection(ProjectDependencies) = postProject - {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} + {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} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ExecutionEngine", "ExecutionEngine\ExecutionEngine.vcproj", "{76295AE8-A083-460E-9F80-6F2B8923264A}" @@ -42,8 +42,8 @@ Release.AspNetCompiler.Debug = "False" EndProjectSection ProjectSection(ProjectDependencies) = postProject - {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} {19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E} + {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VMCore", "VMCore\VMCore.vcproj", "{45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB}" @@ -52,8 +52,8 @@ Release.AspNetCompiler.Debug = "False" EndProjectSection ProjectSection(ProjectDependencies) = postProject - {339C2249-26B6-4172-B484-85653029AF57} = {339C2249-26B6-4172-B484-85653029AF57} {19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E} + {339C2249-26B6-4172-B484-85653029AF57} = {339C2249-26B6-4172-B484-85653029AF57} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Target", "Target\Target.vcproj", "{059FBAB8-C76D-48A0-AA75-3C57BD3EAFE4}" @@ -71,9 +71,9 @@ Release.AspNetCompiler.Debug = "False" EndProjectSection ProjectSection(ProjectDependencies) = postProject - {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} + {339C2249-26B6-4172-B484-85653029AF57} = {339C2249-26B6-4172-B484-85653029AF57} + {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "System", "System\System.vcproj", "{0F8407F3-FA23-4CF1-83A9-DCBE0B361489}" @@ -91,8 +91,8 @@ Release.AspNetCompiler.Debug = "False" EndProjectSection ProjectSection(ProjectDependencies) = postProject - {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} {19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E} + {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "x86", "x86\x86.vcproj", "{144EEBF6-8C9B-4473-B715-2C821666AF6C}" @@ -101,10 +101,10 @@ Release.AspNetCompiler.Debug = "False" EndProjectSection ProjectSection(ProjectDependencies) = postProject - {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} + {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} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Transforms", "Transforms\Transforms.vcproj", "{C59374C1-9FC0-4147-B836-327DFDC52D99}" @@ -113,9 +113,9 @@ Release.AspNetCompiler.Debug = "False" EndProjectSection ProjectSection(ProjectDependencies) = postProject - {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} + {339C2249-26B6-4172-B484-85653029AF57} = {339C2249-26B6-4172-B484-85653029AF57} + {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Configure", "Configure\Configure.vcproj", "{19514E48-456C-4B9D-8637-F2285476461E}" @@ -130,15 +130,15 @@ Release.AspNetCompiler.Debug = "False" EndProjectSection ProjectSection(ProjectDependencies) = postProject - {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} + {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} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llc", "llc\llc.vcproj", "{ADE86BDC-B04C-43DF-B9BB-90492C7B14AC}" @@ -147,15 +147,15 @@ Release.AspNetCompiler.Debug = "False" EndProjectSection ProjectSection(ProjectDependencies) = postProject - {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} + {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} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llvm-dis", "llvm-dis\llvm-dis.vcproj", "{B13476BC-30AB-4EA0-BC1E-212C0A459405}" @@ -164,11 +164,11 @@ Release.AspNetCompiler.Debug = "False" EndProjectSection ProjectSection(ProjectDependencies) = postProject - {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} + {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} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llvm-as", "llvm-as\llvm-as.vcproj", "{4FBC40A5-E626-4A6C-A9D3-FAE5C28D30CC}" @@ -177,12 +177,12 @@ Release.AspNetCompiler.Debug = "False" EndProjectSection ProjectSection(ProjectDependencies) = postProject - {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} + {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} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AsmParser", "AsmParser\AsmParser.vcproj", "{3DC216F5-1DDD-478A-84F8-C124E5C31982}" @@ -200,12 +200,12 @@ Release.AspNetCompiler.Debug = "False" EndProjectSection ProjectSection(ProjectDependencies) = postProject - {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} + {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} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llvm-ranlib", "llvm-ranlib\llvm-ranlib.vcproj", "{BB16C7EE-B4ED-4714-B5ED-B775C62A6612}" @@ -214,12 +214,12 @@ Release.AspNetCompiler.Debug = "False" EndProjectSection ProjectSection(ProjectDependencies) = postProject - {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} + {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} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llvm-link", "llvm-link\llvm-link.vcproj", "{5E249789-49E1-4600-B12B-8AD2BB6439B2}" @@ -228,12 +228,12 @@ Release.AspNetCompiler.Debug = "False" EndProjectSection ProjectSection(ProjectDependencies) = postProject - {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} + {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} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Linker", "Linker\Linker.vcproj", "{342CF48F-760A-4040-A9A1-7D75AA2471CE}" @@ -242,9 +242,9 @@ Release.AspNetCompiler.Debug = "False" EndProjectSection ProjectSection(ProjectDependencies) = postProject - {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} + {19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E} + {0F8407F3-FA23-4CF1-83A9-DCBE0B361489} = {0F8407F3-FA23-4CF1-83A9-DCBE0B361489} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CBackend", "CBackend\CBackend.vcproj", "{057777CD-DED5-46DF-BF9A-6B76DE212549}" @@ -253,8 +253,8 @@ Release.AspNetCompiler.Debug = "False" EndProjectSection ProjectSection(ProjectDependencies) = postProject - {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} {19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E} + {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "opt", "opt\opt.vcproj", "{006D8B41-C3C7-4448-85E1-AF8907E591E5}" @@ -263,14 +263,14 @@ Release.AspNetCompiler.Debug = "False" EndProjectSection ProjectSection(ProjectDependencies) = postProject - {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} + {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} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llvm-bcanalyzer", "llvm-bcanalyzer\llvm-bcanalyzer.vcproj", "{E0B1E329-BE3E-456D-B372-5F397BE42C84}" @@ -279,10 +279,10 @@ Release.AspNetCompiler.Debug = "False" EndProjectSection ProjectSection(ProjectDependencies) = postProject - {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} + {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} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llvm-ld", "llvm-ld\llvm-ld.vcproj", "{64D8AA46-88DB-41F4-B837-053AE02406B8}" @@ -291,16 +291,16 @@ Release.AspNetCompiler.Debug = "False" EndProjectSection ProjectSection(ProjectDependencies) = postProject - {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} + {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} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llvm-nm", "llvm-nm\llvm-nm.vcproj", "{5FF862CE-80A0-4B48-A80B-68AE325A0432}" @@ -309,12 +309,12 @@ Release.AspNetCompiler.Debug = "False" EndProjectSection ProjectSection(ProjectDependencies) = postProject - {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} + {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} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llvm-prof", "llvm-prof\llvm-prof.vcproj", "{ACBE81D9-64B1-4133-823A-807A4E60B454}" @@ -323,12 +323,12 @@ Release.AspNetCompiler.Debug = "False" EndProjectSection ProjectSection(ProjectDependencies) = postProject - {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} + {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} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bugpoint", "bugpoint\bugpoint.vcproj", "{57249192-8E29-4D85-8B7A-FEFF1760B1DA}" @@ -337,16 +337,16 @@ Release.AspNetCompiler.Debug = "False" EndProjectSection ProjectSection(ProjectDependencies) = postProject - {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} + {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} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Bitcode", "Bitcode\Bitcode.vcproj", "{F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62}" @@ -364,8 +364,8 @@ Release.AspNetCompiler.Debug = "False" EndProjectSection ProjectSection(ProjectDependencies) = postProject - {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} {19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E} + {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "LLVM", "LLVM", "{455BCF47-13B6-451E-8321-8ED9C4866BAA}" @@ -417,17 +417,18 @@ EndProjectSection ProjectSection(ProjectDependencies) = postProject {030F6909-B2FA-4E53-BEA7-9A559CFC2F73} = {030F6909-B2FA-4E53-BEA7-9A559CFC2F73} - {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62} = {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62} - {6C98551A-4C36-4E74-8419-4D3EEEC9D8E0} = {6C98551A-4C36-4E74-8419-4D3EEEC9D8E0} - {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} - {4727E8B7-AA99-41C9-AB09-A8A862595DB7} = {4727E8B7-AA99-41C9-AB09-A8A862595DB7} - {4CEC5897-D957-47E7-A6AE-2021D4F44A8F} = {4CEC5897-D957-47E7-A6AE-2021D4F44A8F} - {298B4876-6EF1-4E80-85D7-72F80693BBEB} = {298B4876-6EF1-4E80-85D7-72F80693BBEB} - {05DF3074-11AF-491A-B078-83BD2EDC31F6} = {05DF3074-11AF-491A-B078-83BD2EDC31F6} - {28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508} + {059FBAB8-C76D-48A0-AA75-3C57BD3EAFE4} = {059FBAB8-C76D-48A0-AA75-3C57BD3EAFE4} {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} + {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62} = {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "clangBasic", "..\tools\clang\win32\clangBasic\clangBasic.vcproj", "{298B4876-6EF1-4E80-85D7-72F80693BBEB}" From clattner at apple.com Thu Nov 1 21:17:27 2007 From: clattner at apple.com (Chris Lattner) Date: Thu, 1 Nov 2007 19:17:27 -0700 Subject: [llvm-commits] [llvm] r43620 - in /llvm/trunk: include/llvm/Target/ lib/Analysis/ lib/CodeGen/SelectionDAG/ lib/ExecutionEngine/ lib/ExecutionEngine/Interpreter/ lib/ExecutionEngine/JIT/ lib/Target/ lib/Transforms/IPO/ lib/Transforms/Scalar/ lib/Transforms/Utils/ In-Reply-To: References: <200711012053.lA1KrIUW007528@zion.cs.uiuc.edu> Message-ID: On Nov 1, 2007, at 6:43 PM, Devang Patel wrote: > > On Nov 1, 2007, at 1:53 PM, Duncan Sands wrote: > >> Finally, I made one change which I think wise but others might >> consider pointless and suboptimal: in an unpacked struct the >> amount of space allocated for a field is now given by the ABI >> size rather than getTypeStoreSize. I did this because every >> other place that reserves memory for a type (eg: alloca) now >> uses getABITypeSize, and I didn't want to make an exception >> for unpacked structs, i.e. I did it to make things more uniform. >> This only effects structs containing long doubles and arbitrary >> precision integers. If someone wants to pack these types more >> tightly they can always use a packed struct. > > Naively, I just used getTypeSizeInBits() clang yesterday. I'll sync > up clang once dust settles on llvm side in next day or two. > > Now, how far we are from ability to use arbitrary precision integers > to represent struct bit fields directly ? > > translating > struct STest4 {char a; int b:2; int c:3; int d; } st4; > into > %struct.STest4 = type { i8, i2, i3, i32 } > instead of > %struct.STest4 = type { i8, i8, i32 } > ?:) > We won't ever want to do that. "apints in structs" will be stored with their extra bits as garbage: they won't pack together. {i2, i3} will take two bytes for example. In practice, we will always have to compile the above into { i8, i8, i32 }. -Chris -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20071101/58bc2e79/attachment.html From resistor at mac.com Thu Nov 1 23:01:24 2007 From: resistor at mac.com (Owen Anderson) Date: Fri, 02 Nov 2007 04:01:24 -0000 Subject: [llvm-commits] [llvm] r43633 - /llvm/trunk/include/llvm/Analysis/AliasAnalysis.h Message-ID: <200711020401.lA241OJ9026082@zion.cs.uiuc.edu> Author: resistor Date: Thu Nov 1 23:01:21 2007 New Revision: 43633 URL: http://llvm.org/viewvc/llvm-project?rev=43633&view=rev Log: VAArgInst does, in fact, read memory. Modified: llvm/trunk/include/llvm/Analysis/AliasAnalysis.h Modified: llvm/trunk/include/llvm/Analysis/AliasAnalysis.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/AliasAnalysis.h?rev=43633&r1=43632&r2=43633&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/AliasAnalysis.h (original) +++ llvm/trunk/include/llvm/Analysis/AliasAnalysis.h Thu Nov 1 23:01:21 2007 @@ -260,7 +260,7 @@ return getModRefInfo(CallSite(I), P, Size); } ModRefResult getModRefInfo(VAArgInst* I, Value* P, unsigned Size) { - return AliasAnalysis::Mod; + return AliasAnalysis::ModRef; } ModRefResult getModRefInfo(Instruction *I, Value *P, unsigned Size) { switch (I->getOpcode()) { From isanbard at gmail.com Fri Nov 2 00:41:00 2007 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 02 Nov 2007 05:41:00 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r43634 - /llvm-gcc-4.0/tags/llvm-gcc-1200-20/ Message-ID: <200711020541.lA25f0jh030659@zion.cs.uiuc.edu> Author: void Date: Fri Nov 2 00:40:58 2007 New Revision: 43634 URL: http://llvm.org/viewvc/llvm-project?rev=43634&view=rev Log: Creating llvm-gcc-1200-20 branch Added: llvm-gcc-4.0/tags/llvm-gcc-1200-20/ - copied from r43633, llvm-gcc-4.0/trunk/ From isanbard at gmail.com Fri Nov 2 00:41:09 2007 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 02 Nov 2007 05:41:09 -0000 Subject: [llvm-commits] [llvm] r43635 - /llvm/tags/Apple/llvm-1200-20/ Message-ID: <200711020541.lA25f9be030673@zion.cs.uiuc.edu> Author: void Date: Fri Nov 2 00:41:07 2007 New Revision: 43635 URL: http://llvm.org/viewvc/llvm-project?rev=43635&view=rev Log: Creating llvm-1200-20 branch Added: llvm/tags/Apple/llvm-1200-20/ - copied from r43634, llvm/trunk/ From sabre at nondot.org Fri Nov 2 00:42:52 2007 From: sabre at nondot.org (Chris Lattner) Date: Fri, 02 Nov 2007 05:42:52 -0000 Subject: [llvm-commits] [llvm] r43636 - in /llvm/trunk/docs/tutorial: LangImpl6.html index.html Message-ID: <200711020542.lA25gq7j030747@zion.cs.uiuc.edu> Author: lattner Date: Fri Nov 2 00:42:52 2007 New Revision: 43636 URL: http://llvm.org/viewvc/llvm-project?rev=43636&view=rev Log: Finish chapter 6, and add a spiffy demo that shows off the language. Modified: llvm/trunk/docs/tutorial/LangImpl6.html llvm/trunk/docs/tutorial/index.html Modified: llvm/trunk/docs/tutorial/LangImpl6.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/LangImpl6.html?rev=43636&r1=43635&r2=43636&view=diff ============================================================================== --- llvm/trunk/docs/tutorial/LangImpl6.html (original) +++ llvm/trunk/docs/tutorial/LangImpl6.html Fri Nov 2 00:42:52 2007 @@ -3,7 +3,7 @@ - Kaleidoscope: Extending the Language: Operator Overloading + Kaleidoscope: Extending the Language: User-defined Operators @@ -11,7 +11,7 @@ -
      Kaleidoscope: Extending the Language: Operator Overloading
      +
      Kaleidoscope: Extending the Language: User-defined Operators

      Written by Chris Lattner

      @@ -29,30 +29,34 @@ with it though is that it doesn't have many useful operators (like division, logical negation, or even any comparisons other than less-than.

      -

      This chapter of the tutorial takes a wild digression into adding operator -overloading to the simple and beautiful Kaleidoscope language, giving us a +

      This chapter of the tutorial takes a wild digression into adding user-defined +operators to the simple and beautiful Kaleidoscope language, giving us a simple and ugly language in some ways, but also a powerful one at the same time. One of the great things about creating your own language is that you get to decide what is good or bad. In this tutorial we'll assume that it is okay and use this as a way to show some interesting parsing techniques.

      +

      At the end of this tutorial, we'll run through a nice +little example that shows an example application that you can build with +Kaleidoscope and the feature set it now has.

      +
      - +

      -The operator overloading that we will add to Kaleidoscope is more general than +The "operator overloading" that we will add to Kaleidoscope is more general than languages like C++. In C++, you are only allowed to redefine existing operators: you can't programatically change the grammar, introduce new operators, change precedence levels, etc. In this chapter, we will add this capability to Kaleidoscope, which will allow us to round out the set of operators that are supported, culminating in a more interesting example app.

      -

      The point of going into operator overloading in a tutorial like this is to +

      The point of going into user-defined operators in a tutorial like this is to show the power and flexibility of using a hand-written parser. The parser we are using so far is using recursive descent for most parts of the grammar, and operator precedence parsing for the expressions. See

      We will break down implementation of these features into two parts: -implementing support for overloading of binary operators and adding unary +implementing support for user-defined binary operators and adding unary operators.

      - +
      -

      Adding support for overloaded binary operators is pretty simple with our +

      Adding support for user-defined binary operators is pretty simple with our current framework. We'll first add support for the unary/binary keywords:

      @@ -174,10 +178,604 @@

      Basically, in addition to knowing a name for the prototype, we now keep track of whether it was an operator, and if it was, what precedence level the operator -is at. The precedence is only used for binary operators.

      +is at. The precedence is only used for binary operators (as you'll see below, +it just doesn't apply for unary operators). Now that we have a way to represent +the prototype for a user-defined operator, we need to parse it:

      + +
      +
      +/// prototype
      +///   ::= id '(' id* ')'
      +///   ::= binary LETTER number? (id, id)
      +static PrototypeAST *ParsePrototype() {
      +  std::string FnName;
      +  
      +  int Kind = 0;  // 0 = identifier, 1 = unary, 2 = binary.
      +  unsigned BinaryPrecedence = 30;
      +  
      +  switch (CurTok) {
      +  default:
      +    return ErrorP("Expected function name in prototype");
      +  case tok_identifier:
      +    FnName = IdentifierStr;
      +    Kind = 0;
      +    getNextToken();
      +    break;
      +  case tok_binary:
      +    getNextToken();
      +    if (!isascii(CurTok))
      +      return ErrorP("Expected binary operator");
      +    FnName = "binary";
      +    FnName += (char)CurTok;
      +    Kind = 2;
      +    getNextToken();
      +    
      +    // Read the precedence if present.
      +    if (CurTok == tok_number) {
      +      if (NumVal < 1 || NumVal > 100)
      +        return ErrorP("Invalid precedecnce: must be 1..100");
      +      BinaryPrecedence = (unsigned)NumVal;
      +      getNextToken();
      +    }
      +    break;
      +  }
      +  
      +  if (CurTok != '(')
      +    return ErrorP("Expected '(' in prototype");
      +  
      +  std::vector<std::string> ArgNames;
      +  while (getNextToken() == tok_identifier)
      +    ArgNames.push_back(IdentifierStr);
      +  if (CurTok != ')')
      +    return ErrorP("Expected ')' in prototype");
      +  
      +  // success.
      +  getNextToken();  // eat ')'.
      +  
      +  // Verify right number of names for operator.
      +  if (Kind && ArgNames.size() != Kind)
      +    return ErrorP("Invalid number of operands for operator");
      +  
      +  return new PrototypeAST(FnName, ArgNames, Kind != 0, BinaryPrecedence);
      +}
      +
      +
      + +

      This is all fairly straight-forward parsing code, and we have already seen +a lot of similar code in the past. One interesting piece of this is the part +that sets up FnName for binary operators. This builds names like +"binary@" for a newly defined "@" operator. This takes advantage of the fact +that symbol names in the LLVM symbol table are allowed to have any character in +them, inluding embedded nul characters.

      + +

      The next interesting piece is codegen support for these binary operators. +Given our current structure, this is a simple addition of a default case for our +existing binary operator node:

      + +
      +
      +Value *BinaryExprAST::Codegen() {
      +  Value *L = LHS->Codegen();
      +  Value *R = RHS->Codegen();
      +  if (L == 0 || R == 0) return 0;
      +  
      +  switch (Op) {
      +  case '+': return Builder.CreateAdd(L, R, "addtmp");
      +  case '-': return Builder.CreateSub(L, R, "subtmp");
      +  case '*': return Builder.CreateMul(L, R, "multmp");
      +  case '<':
      +    L = Builder.CreateFCmpULT(L, R, "multmp");
      +    // Convert bool 0/1 to double 0.0 or 1.0
      +    return Builder.CreateUIToFP(L, Type::DoubleTy, "booltmp");
      +  default: break;
      +  }
      +  
      +  // If it wasn't a builtin binary operator, it must be a user defined one. Emit
      +  // a call to it.
      +  Function *F = TheModule->getFunction(std::string("binary")+Op);
      +  assert(F && "binary operator not found!");
      +  
      +  Value *Ops[] = { L, R };
      +  return Builder.CreateCall(F, Ops, Ops+2, "binop");
      +}
      +
      +
      +
      + +

      As you can see above, the new code is actually really simple. It just does +a lookup for the appropriate operator in the symbol table and generates a +function call to it. Since user-defined operators are just built as normal +functions (because the "prototype" boils down into a function with the right +name) everything falls into place.

      + +

      The final missing piece is a bit of top level magic, here:

      + +
      +
      +Function *FunctionAST::Codegen() {
      +  NamedValues.clear();
      +  
      +  Function *TheFunction = Proto->Codegen();
      +  if (TheFunction == 0)
      +    return 0;
      +  
      +  // If this is an operator, install it.
      +  if (Proto->isBinaryOp())
      +    BinopPrecedence[Proto->getOperatorName()] = Proto->getBinaryPrecedence();
      +  
      +  // Create a new basic block to start insertion into.
      +  BasicBlock *BB = new BasicBlock("entry", TheFunction);
      +  Builder.SetInsertPoint(BB);
      +  
      +  if (Value *RetVal = Body->Codegen()) {
      +    ...
      +
      +
      + +

      Basically, before codegening a function, if it is a user-defined operator, we +register it in the precedence table. This allows the binary operator parsing +logic we already have to handle it. Since it is a fully-general operator +precedence parser, this is all we need to do to "extend the grammar".

      + +

      With that, we have useful user-defined binary operators. This builds a lot +on the previous framework we built for other operators. Adding unary operators +is a bit more challenging, because we don't have any framework for it yet, lets +see what it takes.

      + +
      + + + + + +
      + +

      Since we don't currently support unary operators in the Kaleidoscope +langugage, we'll need to add everything for them. Above, we added simple +support for the 'unary' keyword to the lexer. In addition to that, we need an +AST node:

      + +
      +
      +/// UnaryExprAST - Expression class for a unary operator.
      +class UnaryExprAST : public ExprAST {
      +  char Opcode;
      +  ExprAST *Operand;
      +public:
      +  UnaryExprAST(char opcode, ExprAST *operand) 
      +    : Opcode(opcode), Operand(operand) {}
      +  virtual Value *Codegen();
      +};
      +
      +
      + +

      This AST node is very simple and obvious by now. It directly mirrors the +binary operator AST node, except that it only has one child. With this, we +need to add the parsing logic. Parsing a unary operator is pretty simple: we'll +add a new function to do it:

      + +
      +
      +/// unary
      +///   ::= primary
      +///   ::= '!' unary
      +static ExprAST *ParseUnary() {
      +  // If the current token is not an operator, it must be a primary expr.
      +  if (!isascii(CurTok) || CurTok == '(' || CurTok == ',')
      +    return ParsePrimary();
      +  
      +  // If this is a unary operator, read it.
      +  int Opc = CurTok;
      +  getNextToken();
      +  if (ExprAST *Operand = ParseUnary())
      +    return new UnaryExprAST(Opc, Operand);
      +  return 0;
      +}
      +
      +
      + +

      The grammar we add is pretty straight-forward here. If we see a unary +operator when parsing a primary operator, we eat the operator as a prefix and +parse the remaining piece as another unary operator. This allows us to handle +multiple unary operators (e.g. "!!x"). Note that unary operators can't have +ambiguous parses like binary operators can, so there is no need for precedence +information.

      + +

      The problem with the above is that we need to call ParseUnary from somewhere. +To do this, we change previous callers of ParsePrimary to call ParseUnary +instead:

      + +
      +
      +/// binoprhs
      +///   ::= ('+' unary)*
      +static ExprAST *ParseBinOpRHS(int ExprPrec, ExprAST *LHS) {
      +  ...
      +    // Parse the unary expression after the binary operator.
      +    ExprAST *RHS = ParseUnary();
      +    if (!RHS) return 0;
      +  ...
      +}
      +/// expression
      +///   ::= unary binoprhs
      +///
      +static ExprAST *ParseExpression() {
      +  ExprAST *LHS = ParseUnary();
      +  if (!LHS) return 0;
      +  
      +  return ParseBinOpRHS(0, LHS);
      +}
      +
      +
      + +

      With these two simple changes, we now parse unary operators and build the +AST for them. Next up, we need to add parser support for prototypes, to parse +the unary operator prototype. We extend the binary operator code above +with:

      + +
      +
      +/// prototype
      +///   ::= id '(' id* ')'
      +///   ::= binary LETTER number? (id, id)
      +///   ::= unary LETTER (id)
      +static PrototypeAST *ParsePrototype() {
      +  std::string FnName;
      +  
      +  int Kind = 0;  // 0 = identifier, 1 = unary, 2 = binary.
      +  unsigned BinaryPrecedence = 30;
      +  
      +  switch (CurTok) {
      +  default:
      +    return ErrorP("Expected function name in prototype");
      +  case tok_identifier:
      +    FnName = IdentifierStr;
      +    Kind = 0;
      +    getNextToken();
      +    break;
      +  case tok_unary:
      +    getNextToken();
      +    if (!isascii(CurTok))
      +      return ErrorP("Expected unary operator");
      +    FnName = "unary";
      +    FnName += (char)CurTok;
      +    Kind = 1;
      +    getNextToken();
      +    break;
      +  case tok_binary:
      +    ...
      +
      +
      + +

      As with binary operators, we name unary operators with a name that includes +the operator character. This assists us at code generation time. Speaking of, +the final piece we need to add is codegen support for unary operators. It looks +like this:

      + +
      +
      +Value *UnaryExprAST::Codegen() {
      +  Value *OperandV = Operand->Codegen();
      +  if (OperandV == 0) return 0;
      +  
      +  Function *F = TheModule->getFunction(std::string("unary")+Opcode);
      +  if (F == 0)
      +    return ErrorV("Unknown unary operator");
      +  
      +  return Builder.CreateCall(F, OperandV, "unop");
      +}
      +
      +
      + +

      This code is similar to, but simpler than, the code for binary operators. It +is simpler primarily because it doesn't need to handle any predefined operators. +

      + +
      + + + + + +
      + +

      It is somewhat hard to believe, but with a few simple extensions we've +covered in the last chapters, we have grown a realish language. With this, we +can do a lot of interesting things, including I/O, math, and a bunch of other +things. For example, we can now add a nice sequencing operator (printd is +defined to print out the specified value and a newline):

      + +
      +
      +ready> extern printd(x);
      +Read extern: declare double @printd(double)
      +ready> def binary : 1 (x y) 0;  # Low-precedence operator that ignores operands.
      +..
      +ready> printd(123) : printd(456) : printd(789);
      +123.000000
      +456.000000
      +789.000000
      +Evaluated to 0.000000
      +
      +
      + +

      We can also define a bunch of other "primative" operations, such as:

      + +
      +
      +# Logical unary not.
      +def unary!(v)
      +  if v then
      +    0
      +  else
      +    1;
      +    
      +# Unary negate.
      +def unary-(v)
      +  0-v;
       
      +# Define > with the same precedence as >.  We could also easily define
      +# <= etc.
      +def binary> 10 (LHS RHS)
      +  !(LHS < RHS);
      +
      +# Binary logical or, which does not short circuit. 
      +def binary| 5 (LHS RHS)
      +  if LHS then
      +    1
      +  else if RHS then
      +    1
      +  else
      +    0;
      +
      +# Binary logical and, which does not short circuit. 
      +def binary& 6 (LHS RHS)
      +  if !LHS then
      +    0
      +  else
      +    !!RHS;
       
      -

      ...

      +# Define = with slightly lower precedence than relationals. +def binary = 9 (LHS RHS) + !(LHS < RHS | LHS > RHS); + +
      +
      + + +

      Given the previous if/then/else support, we can also define interesting +functions for I/O. For example, the following prints out a character whose +"density" reflects the value passed in: the lower the value, the denser the +character:

      + +
      +
      +ready>
      +
      +extern putchard(char)
      +def printdensity(d)
      +  if d > 8 then
      +    putchard(32)  # ' '
      +  else if d > 4 then
      +    putchard(46)  # '.'
      +  else if d > 2 then
      +    putchard(43)  # '+'
      +  else
      +    putchard(42); # '*'
      +...
      +ready> printdensity(1): printdensity(2): printdensity(3) : 
      +          printdensity(4): printdensity(5): printdensity(9): putchard(10);
      +*++.. 
      +Evaluated to 0.000000
      +
      +
      + +

      Based on these simple primitive operations, we can start to define more +interesting things. For example, here's a little function that solves for the +number of iterations it takes for a function in the complex plane to +converge:

      + +
      +
      +# determine whether the specific location diverges.
      +# Solve for z = z^2 + c in the complex plane.
      +def mandleconverger(real imag iters creal cimag)
      +  if iters > 255 | (real*real + imag*imag > 4) then
      +    iters
      +  else
      +    mandleconverger(real*real - imag*imag + creal,
      +                    2*real*imag + cimag,
      +                    iters+1, creal, cimag);
      +
      +# return the number of iterations required for the iteration to escape
      +def mandleconverge(real imag)
      +  mandleconverger(real, imag, 0, real, imag);
      +
      +
      + +

      This "z = z^2 + c" function is a beautiful little creature that is the basis +for computation of the Mandelbrot Set. Our +mandelconverge function returns the number of iterations that it takes +for a complex orbit to escape, saturating to 255. This is not a very useful +function by itself, but if you plot its value over a two-dimensional plane, +you can see the mandelbrot set. Given that we are limited to using putchard +here, our amazing graphical output is limited, but we can whip together +something using the density plotter above:

      + +
      +
      +# compute and plot the mandlebrot set with the specified 2 dimentional range
      +# info.
      +def mandelhelp(xmin xmax xstep   ymin ymax ystep)
      +  for y = ymin, y < ymax, ystep in (
      +    (for x = xmin, x < xmax, xstep in
      +       printdensity(mandleconverge(x,y)))
      +    : putchard(10)
      +  )
      + 
      +# mandel - This is a convenient helper function for ploting the mandelbrot set
      +# from the specified position with the specified magnification.
      +def mandel(realstart imagstart realmag imagmag) 
      +  mandelhelp(realstart, realstart+realmag*78, realmag,
      +             imagstart, imagstart+imagmag*40, imagmag);
      +
      +
      + +

      Given this, we can try plotting out the mandlebrot set! Lets try it out:

      + +
      +
      +ready> mandel(-2.3, -1.3, 0.05, 0.07);
      +*******************************+++++++++++*************************************
      +*************************+++++++++++++++++++++++*******************************
      +**********************+++++++++++++++++++++++++++++****************************
      +*******************+++++++++++++++++++++.. ...++++++++*************************
      +*****************++++++++++++++++++++++.... ...+++++++++***********************
      +***************+++++++++++++++++++++++.....   ...+++++++++*********************
      +**************+++++++++++++++++++++++....     ....+++++++++********************
      +*************++++++++++++++++++++++......      .....++++++++*******************
      +************+++++++++++++++++++++.......       .......+++++++******************
      +***********+++++++++++++++++++....                ... .+++++++*****************
      +**********+++++++++++++++++.......                     .+++++++****************
      +*********++++++++++++++...........                    ...+++++++***************
      +********++++++++++++............                      ...++++++++**************
      +********++++++++++... ..........                        .++++++++**************
      +*******+++++++++.....                                   .+++++++++*************
      +*******++++++++......                                  ..+++++++++*************
      +*******++++++.......                                   ..+++++++++*************
      +*******+++++......                                     ..+++++++++*************
      +*******.... ....                                      ...+++++++++*************
      +*******.... .                                         ...+++++++++*************
      +*******+++++......                                    ...+++++++++*************
      +*******++++++.......                                   ..+++++++++*************
      +*******++++++++......                                   .+++++++++*************
      +*******+++++++++.....                                  ..+++++++++*************
      +********++++++++++... ..........                        .++++++++**************
      +********++++++++++++............                      ...++++++++**************
      +*********++++++++++++++..........                     ...+++++++***************
      +**********++++++++++++++++........                     .+++++++****************
      +**********++++++++++++++++++++....                ... ..+++++++****************
      +***********++++++++++++++++++++++.......       .......++++++++*****************
      +************+++++++++++++++++++++++......      ......++++++++******************
      +**************+++++++++++++++++++++++....      ....++++++++********************
      +***************+++++++++++++++++++++++.....   ...+++++++++*********************
      +*****************++++++++++++++++++++++....  ...++++++++***********************
      +*******************+++++++++++++++++++++......++++++++*************************
      +*********************++++++++++++++++++++++.++++++++***************************
      +*************************+++++++++++++++++++++++*******************************
      +******************************+++++++++++++************************************
      +*******************************************************************************
      +*******************************************************************************
      +*******************************************************************************
      +Evaluated to 0.000000
      +ready> mandel(-2, -1, 0.02, 0.04);
      +**************************+++++++++++++++++++++++++++++++++++++++++++++++++++++
      +***********************++++++++++++++++++++++++++++++++++++++++++++++++++++++++
      +*********************+++++++++++++++++++++++++++++++++++++++++++++++++++++++++.
      +*******************+++++++++++++++++++++++++++++++++++++++++++++++++++++++++...
      +*****************+++++++++++++++++++++++++++++++++++++++++++++++++++++++++.....
      +***************++++++++++++++++++++++++++++++++++++++++++++++++++++++++........
      +**************++++++++++++++++++++++++++++++++++++++++++++++++++++++...........
      +************+++++++++++++++++++++++++++++++++++++++++++++++++++++..............
      +***********++++++++++++++++++++++++++++++++++++++++++++++++++........        . 
      +**********++++++++++++++++++++++++++++++++++++++++++++++.............          
      +********+++++++++++++++++++++++++++++++++++++++++++..................          
      +*******+++++++++++++++++++++++++++++++++++++++.......................          
      +******+++++++++++++++++++++++++++++++++++...........................           
      +*****++++++++++++++++++++++++++++++++............................              
      +*****++++++++++++++++++++++++++++...............................               
      +****++++++++++++++++++++++++++......   .........................               
      +***++++++++++++++++++++++++.........     ......    ...........                 
      +***++++++++++++++++++++++............                                          
      +**+++++++++++++++++++++..............                                          
      +**+++++++++++++++++++................                                          
      +*++++++++++++++++++.................                                           
      +*++++++++++++++++............ ...                                              
      +*++++++++++++++..............                                                  
      +*+++....++++................                                                   
      +*..........  ...........                                                       
      +*                                                                              
      +*..........  ...........                                                       
      +*+++....++++................                                                   
      +*++++++++++++++..............                                                  
      +*++++++++++++++++............ ...                                              
      +*++++++++++++++++++.................                                           
      +**+++++++++++++++++++................                                          
      +**+++++++++++++++++++++..............                                          
      +***++++++++++++++++++++++............                                          
      +***++++++++++++++++++++++++.........     ......    ...........                 
      +****++++++++++++++++++++++++++......   .........................               
      +*****++++++++++++++++++++++++++++...............................               
      +*****++++++++++++++++++++++++++++++++............................              
      +******+++++++++++++++++++++++++++++++++++...........................           
      +*******+++++++++++++++++++++++++++++++++++++++.......................          
      +********+++++++++++++++++++++++++++++++++++++++++++..................          
      +Evaluated to 0.000000
      +ready> mandel(-0.9, -1.4, 0.02, 0.03);
      +*******************************************************************************
      +*******************************************************************************
      +*******************************************************************************
      +**********+++++++++++++++++++++************************************************
      +*+++++++++++++++++++++++++++++++++++++++***************************************
      ++++++++++++++++++++++++++++++++++++++++++++++**********************************
      +++++++++++++++++++++++++++++++++++++++++++++++++++*****************************
      +++++++++++++++++++++++++++++++++++++++++++++++++++++++*************************
      ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++**********************
      ++++++++++++++++++++++++++++++++++.........++++++++++++++++++*******************
      ++++++++++++++++++++++++++++++++....   ......+++++++++++++++++++****************
      ++++++++++++++++++++++++++++++.......  ........+++++++++++++++++++**************
      +++++++++++++++++++++++++++++........   ........++++++++++++++++++++************
      ++++++++++++++++++++++++++++.........     ..  ...+++++++++++++++++++++**********
      +++++++++++++++++++++++++++...........        ....++++++++++++++++++++++********
      +++++++++++++++++++++++++.............       .......++++++++++++++++++++++******
      ++++++++++++++++++++++++.............        ........+++++++++++++++++++++++****
      +++++++++++++++++++++++...........           ..........++++++++++++++++++++++***
      +++++++++++++++++++++...........                .........++++++++++++++++++++++*
      +++++++++++++++++++............                  ...........++++++++++++++++++++
      +++++++++++++++++...............                 .............++++++++++++++++++
      +++++++++++++++.................                 ...............++++++++++++++++
      +++++++++++++..................                  .................++++++++++++++
      ++++++++++..................                      .................+++++++++++++
      +++++++........        .                               .........  ..++++++++++++
      +++............                                         ......    ....++++++++++
      +..............                                                    ...++++++++++
      +..............                                                    ....+++++++++
      +..............                                                    .....++++++++
      +.............                                                    ......++++++++
      +...........                                                     .......++++++++
      +.........                                                       ........+++++++
      +.........                                                       ........+++++++
      +.........                                                           ....+++++++
      +........                                                             ...+++++++
      +.......                                                              ...+++++++
      +                                                                    ....+++++++
      +                                                                   .....+++++++
      +                                                                    ....+++++++
      +                                                                    ....+++++++
      +                                                                    ....+++++++
      +Evaluated to 0.000000
      +ready> ^D
      +
      +
      + +

      At this point, you may be starting to realize that Kaleidoscope is a real +and powerful language. It may not be self-similar :), but it can be used to +plot things that are!

      + +

      With this, we conclude the "adding user-defined operators" chapter of the +tutorial. We successfully extended our language with the ability to extend the +language in the library, and showed how this can be used to build a simple but +interesting end user application in Kaleidoscope. At this point, Kaleidoscope +can build a variety of applications that are functional and can call functions +with side-effects, but it can't actually define and mutate a variable at all. +

      + +

      Strikingly, lack of this feature is an important limitation for some +languages, and it is not at all obvious how to add +support for mutable variables without having to add an "SSA construction" +phase to your front-end. In the next chapter, we will describe how you can +add this without building SSA in your front-end.

      @@ -206,6 +804,968 @@
      +#include "llvm/DerivedTypes.h"
      +#include "llvm/ExecutionEngine/ExecutionEngine.h"
      +#include "llvm/Module.h"
      +#include "llvm/ModuleProvider.h"
      +#include "llvm/PassManager.h"
      +#include "llvm/Analysis/Verifier.h"
      +#include "llvm/Target/TargetData.h"
      +#include "llvm/Transforms/Scalar.h"
      +#include "llvm/Support/LLVMBuilder.h"
      +#include <cstdio>
      +#include <string>
      +#include <map>
      +#include <vector>
      +using namespace llvm;
      +
      +//===----------------------------------------------------------------------===//
      +// Lexer
      +//===----------------------------------------------------------------------===//
      +
      +// The lexer returns tokens [0-255] if it is an unknown character, otherwise one
      +// of these for known things.
      +enum Token {
      +  tok_eof = -1,
      +
      +  // commands
      +  tok_def = -2, tok_extern = -3,
      +
      +  // primary
      +  tok_identifier = -4, tok_number = -5,
      +  
      +  // control
      +  tok_if = -6, tok_then = -7, tok_else = -8,
      +  tok_for = -9, tok_in = -10,
      +  
      +  // operators
      +  tok_binary = -11, tok_unary = -12
      +};
      +
      +static std::string IdentifierStr;  // Filled in if tok_identifier
      +static double NumVal;              // Filled in if tok_number
      +
      +/// gettok - Return the next token from standard input.
      +static int gettok() {
      +  static int LastChar = ' ';
      +
      +  // Skip any whitespace.
      +  while (isspace(LastChar))
      +    LastChar = getchar();
      +
      +  if (isalpha(LastChar)) { // identifier: [a-zA-Z][a-zA-Z0-9]*
      +    IdentifierStr = LastChar;
      +    while (isalnum((LastChar = getchar())))
      +      IdentifierStr += LastChar;
      +
      +    if (IdentifierStr == "def") return tok_def;
      +    if (IdentifierStr == "extern") return tok_extern;
      +    if (IdentifierStr == "if") return tok_if;
      +    if (IdentifierStr == "then") return tok_then;
      +    if (IdentifierStr == "else") return tok_else;
      +    if (IdentifierStr == "for") return tok_for;
      +    if (IdentifierStr == "in") return tok_in;
      +    if (IdentifierStr == "binary") return tok_binary;
      +    if (IdentifierStr == "unary") return tok_unary;
      +    return tok_identifier;
      +  }
      +
      +  if (isdigit(LastChar) || LastChar == '.') {   // Number: [0-9.]+
      +    std::string NumStr;
      +    do {
      +      NumStr += LastChar;
      +      LastChar = getchar();
      +    } while (isdigit(LastChar) || LastChar == '.');
      +
      +    NumVal = strtod(NumStr.c_str(), 0);
      +    return tok_number;
      +  }
      +
      +  if (LastChar == '#') {
      +    // Comment until end of line.
      +    do LastChar = getchar();
      +    while (LastChar != EOF && LastChar != '\n' & LastChar != '\r');
      +    
      +    if (LastChar != EOF)
      +      return gettok();
      +  }
      +  
      +  // Check for end of file.  Don't eat the EOF.
      +  if (LastChar == EOF)
      +    return tok_eof;
      +
      +  // Otherwise, just return the character as its ascii value.
      +  int ThisChar = LastChar;
      +  LastChar = getchar();
      +  return ThisChar;
      +}
      +
      +//===----------------------------------------------------------------------===//
      +// Abstract Syntax Tree (aka Parse Tree)
      +//===----------------------------------------------------------------------===//
      +
      +/// ExprAST - Base class for all expression nodes.
      +class ExprAST {
      +public:
      +  virtual ~ExprAST() {}
      +  virtual Value *Codegen() = 0;
      +};
      +
      +/// NumberExprAST - Expression class for numeric literals like "1.0".
      +class NumberExprAST : public ExprAST {
      +  double Val;
      +public:
      +  NumberExprAST(double val) : Val(val) {}
      +  virtual Value *Codegen();
      +};
      +
      +/// VariableExprAST - Expression class for referencing a variable, like "a".
      +class VariableExprAST : public ExprAST {
      +  std::string Name;
      +public:
      +  VariableExprAST(const std::string &name) : Name(name) {}
      +  virtual Value *Codegen();
      +};
      +
      +/// UnaryExprAST - Expression class for a unary operator.
      +class UnaryExprAST : public ExprAST {
      +  char Opcode;
      +  ExprAST *Operand;
      +public:
      +  UnaryExprAST(char opcode, ExprAST *operand) 
      +    : Opcode(opcode), Operand(operand) {}
      +  virtual Value *Codegen();
      +};
      +
      +/// BinaryExprAST - Expression class for a binary operator.
      +class BinaryExprAST : public ExprAST {
      +  char Op;
      +  ExprAST *LHS, *RHS;
      +public:
      +  BinaryExprAST(char op, ExprAST *lhs, ExprAST *rhs) 
      +    : Op(op), LHS(lhs), RHS(rhs) {}
      +  virtual Value *Codegen();
      +};
      +
      +/// CallExprAST - Expression class for function calls.
      +class CallExprAST : public ExprAST {
      +  std::string Callee;
      +  std::vector<ExprAST*> Args;
      +public:
      +  CallExprAST(const std::string &callee, std::vector<ExprAST*> &args)
      +    : Callee(callee), Args(args) {}
      +  virtual Value *Codegen();
      +};
      +
      +/// IfExprAST - Expression class for if/then/else.
      +class IfExprAST : public ExprAST {
      +  ExprAST *Cond, *Then, *Else;
      +public:
      +  IfExprAST(ExprAST *cond, ExprAST *then, ExprAST *_else)
      +  : Cond(cond), Then(then), Else(_else) {}
      +  virtual Value *Codegen();
      +};
      +
      +/// ForExprAST - Expression class for for/in.
      +class ForExprAST : public ExprAST {
      +  std::string VarName;
      +  ExprAST *Start, *End, *Step, *Body;
      +public:
      +  ForExprAST(const std::string &varname, ExprAST *start, ExprAST *end,
      +             ExprAST *step, ExprAST *body)
      +    : VarName(varname), Start(start), End(end), Step(step), Body(body) {}
      +  virtual Value *Codegen();
      +};
      +
      +/// PrototypeAST - This class represents the "prototype" for a function,
      +/// which captures its argument names as well as if it is an operator.
      +class PrototypeAST {
      +  std::string Name;
      +  std::vector<std::string> Args;
      +  bool isOperator;
      +  unsigned Precedence;  // Precedence if a binary op.
      +public:
      +  PrototypeAST(const std::string &name, const std::vector<std::string> &args,
      +               bool isoperator = false, unsigned prec = 0)
      +  : Name(name), Args(args), isOperator(isoperator), Precedence(prec) {}
      +  
      +  bool isUnaryOp() const { return isOperator && Args.size() == 1; }
      +  bool isBinaryOp() const { return isOperator && Args.size() == 2; }
      +  
      +  char getOperatorName() const {
      +    assert(isUnaryOp() || isBinaryOp());
      +    return Name[Name.size()-1];
      +  }
      +  
      +  unsigned getBinaryPrecedence() const { return Precedence; }
      +  
      +  Function *Codegen();
      +};
      +
      +/// FunctionAST - This class represents a function definition itself.
      +class FunctionAST {
      +  PrototypeAST *Proto;
      +  ExprAST *Body;
      +public:
      +  FunctionAST(PrototypeAST *proto, ExprAST *body)
      +    : Proto(proto), Body(body) {}
      +  
      +  Function *Codegen();
      +};
      +
      +//===----------------------------------------------------------------------===//
      +// Parser
      +//===----------------------------------------------------------------------===//
      +
      +/// CurTok/getNextToken - Provide a simple token buffer.  CurTok is the current
      +/// token the parser it looking at.  getNextToken reads another token from the
      +/// lexer and updates CurTok with its results.
      +static int CurTok;
      +static int getNextToken() {
      +  return CurTok = gettok();
      +}
      +
      +/// BinopPrecedence - This holds the precedence for each binary operator that is
      +/// defined.
      +static std::map<char, int> BinopPrecedence;
      +
      +/// GetTokPrecedence - Get the precedence of the pending binary operator token.
      +static int GetTokPrecedence() {
      +  if (!isascii(CurTok))
      +    return -1;
      +  
      +  // Make sure it's a declared binop.
      +  int TokPrec = BinopPrecedence[CurTok];
      +  if (TokPrec <= 0) return -1;
      +  return TokPrec;
      +}
      +
      +/// Error* - These are little helper functions for error handling.
      +ExprAST *Error(const char *Str) { fprintf(stderr, "Error: %s\n", Str);return 0;}
      +PrototypeAST *ErrorP(const char *Str) { Error(Str); return 0; }
      +FunctionAST *ErrorF(const char *Str) { Error(Str); return 0; }
      +
      +static ExprAST *ParseExpression();
      +
      +/// identifierexpr
      +///   ::= identifer
      +///   ::= identifer '(' expression* ')'
      +static ExprAST *ParseIdentifierExpr() {
      +  std::string IdName = IdentifierStr;
      +  
      +  getNextToken();  // eat identifer.
      +  
      +  if (CurTok != '(') // Simple variable ref.
      +    return new VariableExprAST(IdName);
      +  
      +  // Call.
      +  getNextToken();  // eat (
      +  std::vector<ExprAST*> Args;
      +  if (CurTok != ')') {
      +    while (1) {
      +      ExprAST *Arg = ParseExpression();
      +      if (!Arg) return 0;
      +      Args.push_back(Arg);
      +      
      +      if (CurTok == ')') break;
      +      
      +      if (CurTok != ',')
      +        return Error("Expected ')'");
      +      getNextToken();
      +    }
      +  }
      +
      +  // Eat the ')'.
      +  getNextToken();
      +  
      +  return new CallExprAST(IdName, Args);
      +}
      +
      +/// numberexpr ::= number
      +static ExprAST *ParseNumberExpr() {
      +  ExprAST *Result = new NumberExprAST(NumVal);
      +  getNextToken(); // consume the number
      +  return Result;
      +}
      +
      +/// parenexpr ::= '(' expression ')'
      +static ExprAST *ParseParenExpr() {
      +  getNextToken();  // eat (.
      +  ExprAST *V = ParseExpression();
      +  if (!V) return 0;
      +  
      +  if (CurTok != ')')
      +    return Error("expected ')'");
      +  getNextToken();  // eat ).
      +  return V;
      +}
      +
      +/// ifexpr ::= 'if' expression 'then' expression 'else' expression
      +static ExprAST *ParseIfExpr() {
      +  getNextToken();  // eat the if.
      +  
      +  // condition.
      +  ExprAST *Cond = ParseExpression();
      +  if (!Cond) return 0;
      +  
      +  if (CurTok != tok_then)
      +    return Error("expected then");
      +  getNextToken();  // eat the then
      +  
      +  ExprAST *Then = ParseExpression();
      +  if (Then == 0) return 0;
      +  
      +  if (CurTok != tok_else)
      +    return Error("expected else");
      +  
      +  getNextToken();
      +  
      +  ExprAST *Else = ParseExpression();
      +  if (!Else) return 0;
      +  
      +  return new IfExprAST(Cond, Then, Else);
      +}
      +
      +/// forexpr ::= 'for' identifer '=' expr ',' expr (',' expr)? 'in' expression
      +static ExprAST *ParseForExpr() {
      +  getNextToken();  // eat the for.
      +
      +  if (CurTok != tok_identifier)
      +    return Error("expected identifier after for");
      +  
      +  std::string IdName = IdentifierStr;
      +  getNextToken();  // eat identifer.
      +  
      +  if (CurTok != '=')
      +    return Error("expected '=' after for");
      +  getNextToken();  // eat '='.
      +  
      +  
      +  ExprAST *Start = ParseExpression();
      +  if (Start == 0) return 0;
      +  if (CurTok != ',')
      +    return Error("expected ',' after for start value");
      +  getNextToken();
      +  
      +  ExprAST *End = ParseExpression();
      +  if (End == 0) return 0;
      +  
      +  // The step value is optional.
      +  ExprAST *Step = 0;
      +  if (CurTok == ',') {
      +    getNextToken();
      +    Step = ParseExpression();
      +    if (Step == 0) return 0;
      +  }
      +  
      +  if (CurTok != tok_in)
      +    return Error("expected 'in' after for");
      +  getNextToken();  // eat 'in'.
      +  
      +  ExprAST *Body = ParseExpression();
      +  if (Body == 0) return 0;
      +
      +  return new ForExprAST(IdName, Start, End, Step, Body);
      +}
      +
      +
      +/// primary
      +///   ::= identifierexpr
      +///   ::= numberexpr
      +///   ::= parenexpr
      +///   ::= ifexpr
      +///   ::= forexpr
      +static ExprAST *ParsePrimary() {
      +  switch (CurTok) {
      +  default: return Error("unknown token when expecting an expression");
      +  case tok_identifier: return ParseIdentifierExpr();
      +  case tok_number:     return ParseNumberExpr();
      +  case '(':            return ParseParenExpr();
      +  case tok_if:         return ParseIfExpr();
      +  case tok_for:        return ParseForExpr();
      +  }
      +}
      +
      +/// unary
      +///   ::= primary
      +///   ::= '!' unary
      +static ExprAST *ParseUnary() {
      +  // If the current token is not an operator, it must be a primary expr.
      +  if (!isascii(CurTok) || CurTok == '(' || CurTok == ',')
      +    return ParsePrimary();
      +  
      +  // If this is a unary operator, read it.
      +  int Opc = CurTok;
      +  getNextToken();
      +  if (ExprAST *Operand = ParseUnary())
      +    return new UnaryExprAST(Opc, Operand);
      +  return 0;
      +}
      +
      +/// binoprhs
      +///   ::= ('+' unary)*
      +static ExprAST *ParseBinOpRHS(int ExprPrec, ExprAST *LHS) {
      +  // If this is a binop, find its precedence.
      +  while (1) {
      +    int TokPrec = GetTokPrecedence();
      +    
      +    // If this is a binop that binds at least as tightly as the current binop,
      +    // consume it, otherwise we are done.
      +    if (TokPrec < ExprPrec)
      +      return LHS;
      +    
      +    // Okay, we know this is a binop.
      +    int BinOp = CurTok;
      +    getNextToken();  // eat binop
      +    
      +    // Parse the unary expression after the binary operator.
      +    ExprAST *RHS = ParseUnary();
      +    if (!RHS) return 0;
      +    
      +    // If BinOp binds less tightly with RHS than the operator after RHS, let
      +    // the pending operator take RHS as its LHS.
      +    int NextPrec = GetTokPrecedence();
      +    if (TokPrec < NextPrec) {
      +      RHS = ParseBinOpRHS(TokPrec+1, RHS);
      +      if (RHS == 0) return 0;
      +    }
      +    
      +    // Merge LHS/RHS.
      +    LHS = new BinaryExprAST(BinOp, LHS, RHS);
      +  }
      +}
      +
      +/// expression
      +///   ::= unary binoprhs
      +///
      +static ExprAST *ParseExpression() {
      +  ExprAST *LHS = ParseUnary();
      +  if (!LHS) return 0;
      +  
      +  return ParseBinOpRHS(0, LHS);
      +}
      +
      +/// prototype
      +///   ::= id '(' id* ')'
      +///   ::= binary LETTER number? (id, id)
      +///   ::= unary LETTER (id)
      +static PrototypeAST *ParsePrototype() {
      +  std::string FnName;
      +  
      +  int Kind = 0;  // 0 = identifier, 1 = unary, 2 = binary.
      +  unsigned BinaryPrecedence = 30;
      +  
      +  switch (CurTok) {
      +  default:
      +    return ErrorP("Expected function name in prototype");
      +  case tok_identifier:
      +    FnName = IdentifierStr;
      +    Kind = 0;
      +    getNextToken();
      +    break;
      +  case tok_unary:
      +    getNextToken();
      +    if (!isascii(CurTok))
      +      return ErrorP("Expected unary operator");
      +    FnName = "unary";
      +    FnName += (char)CurTok;
      +    Kind = 1;
      +    getNextToken();
      +    break;
      +  case tok_binary:
      +    getNextToken();
      +    if (!isascii(CurTok))
      +      return ErrorP("Expected binary operator");
      +    FnName = "binary";
      +    FnName += (char)CurTok;
      +    Kind = 2;
      +    getNextToken();
      +    
      +    // Read the precedence if present.
      +    if (CurTok == tok_number) {
      +      if (NumVal < 1 || NumVal > 100)
      +        return ErrorP("Invalid precedecnce: must be 1..100");
      +      BinaryPrecedence = (unsigned)NumVal;
      +      getNextToken();
      +    }
      +    break;
      +  }
      +  
      +  if (CurTok != '(')
      +    return ErrorP("Expected '(' in prototype");
      +  
      +  std::vector<std::string> ArgNames;
      +  while (getNextToken() == tok_identifier)
      +    ArgNames.push_back(IdentifierStr);
      +  if (CurTok != ')')
      +    return ErrorP("Expected ')' in prototype");
      +  
      +  // success.
      +  getNextToken();  // eat ')'.
      +  
      +  // Verify right number of names for operator.
      +  if (Kind && ArgNames.size() != Kind)
      +    return ErrorP("Invalid number of operands for operator");
      +  
      +  return new PrototypeAST(FnName, ArgNames, Kind != 0, BinaryPrecedence);
      +}
      +
      +/// definition ::= 'def' prototype expression
      +static FunctionAST *ParseDefinition() {
      +  getNextToken();  // eat def.
      +  PrototypeAST *Proto = ParsePrototype();
      +  if (Proto == 0) return 0;
      +
      +  if (ExprAST *E = ParseExpression())
      +    return new FunctionAST(Proto, E);
      +  return 0;
      +}
      +
      +/// toplevelexpr ::= expression
      +static FunctionAST *ParseTopLevelExpr() {
      +  if (ExprAST *E = ParseExpression()) {
      +    // Make an anonymous proto.
      +    PrototypeAST *Proto = new PrototypeAST("", std::vector<std::string>());
      +    return new FunctionAST(Proto, E);
      +  }
      +  return 0;
      +}
      +
      +/// external ::= 'extern' prototype
      +static PrototypeAST *ParseExtern() {
      +  getNextToken();  // eat extern.
      +  return ParsePrototype();
      +}
      +
      +//===----------------------------------------------------------------------===//
      +// Code Generation
      +//===----------------------------------------------------------------------===//
      +
      +static Module *TheModule;
      +static LLVMFoldingBuilder Builder;
      +static std::map<std::string, Value*> NamedValues;
      +static FunctionPassManager *TheFPM;
      +
      +Value *ErrorV(const char *Str) { Error(Str); return 0; }
      +
      +Value *NumberExprAST::Codegen() {
      +  return ConstantFP::get(Type::DoubleTy, APFloat(Val));
      +}
      +
      +Value *VariableExprAST::Codegen() {
      +  // Look this variable up in the function.
      +  Value *V = NamedValues[Name];
      +  return V ? V : ErrorV("Unknown variable name");
      +}
      +
      +Value *UnaryExprAST::Codegen() {
      +  Value *OperandV = Operand->Codegen();
      +  if (OperandV == 0) return 0;
      +  
      +  Function *F = TheModule->getFunction(std::string("unary")+Opcode);
      +  if (F == 0)
      +    return ErrorV("Unknown unary operator");
      +  
      +  return Builder.CreateCall(F, OperandV, "unop");
      +}
      +
      +
      +Value *BinaryExprAST::Codegen() {
      +  Value *L = LHS->Codegen();
      +  Value *R = RHS->Codegen();
      +  if (L == 0 || R == 0) return 0;
      +  
      +  switch (Op) {
      +  case '+': return Builder.CreateAdd(L, R, "addtmp");
      +  case '-': return Builder.CreateSub(L, R, "subtmp");
      +  case '*': return Builder.CreateMul(L, R, "multmp");
      +  case '<':
      +    L = Builder.CreateFCmpULT(L, R, "multmp");
      +    // Convert bool 0/1 to double 0.0 or 1.0
      +    return Builder.CreateUIToFP(L, Type::DoubleTy, "booltmp");
      +  default: break;
      +  }
      +  
      +  // If it wasn't a builtin binary operator, it must be a user defined one. Emit
      +  // a call to it.
      +  Function *F = TheModule->getFunction(std::string("binary")+Op);
      +  assert(F && "binary operator not found!");
      +  
      +  Value *Ops[] = { L, R };
      +  return Builder.CreateCall(F, Ops, Ops+2, "binop");
      +}
      +
      +Value *CallExprAST::Codegen() {
      +  // Look up the name in the global module table.
      +  Function *CalleeF = TheModule->getFunction(Callee);
      +  if (CalleeF == 0)
      +    return ErrorV("Unknown function referenced");
      +  
      +  // If argument mismatch error.
      +  if (CalleeF->arg_size() != Args.size())
      +    return ErrorV("Incorrect # arguments passed");
      +
      +  std::vector<Value*> ArgsV;
      +  for (unsigned i = 0, e = Args.size(); i != e; ++i) {
      +    ArgsV.push_back(Args[i]->Codegen());
      +    if (ArgsV.back() == 0) return 0;
      +  }
      +  
      +  return Builder.CreateCall(CalleeF, ArgsV.begin(), ArgsV.end(), "calltmp");
      +}
      +
      +Value *IfExprAST::Codegen() {
      +  Value *CondV = Cond->Codegen();
      +  if (CondV == 0) return 0;
      +  
      +  // Convert condition to a bool by comparing equal to 0.0.
      +  CondV = Builder.CreateFCmpONE(CondV, 
      +                                ConstantFP::get(Type::DoubleTy, APFloat(0.0)),
      +                                "ifcond");
      +  
      +  Function *TheFunction = Builder.GetInsertBlock()->getParent();
      +  
      +  // Create blocks for the then and else cases.  Insert the 'then' block at the
      +  // end of the function.
      +  BasicBlock *ThenBB = new BasicBlock("then", TheFunction);
      +  BasicBlock *ElseBB = new BasicBlock("else");
      +  BasicBlock *MergeBB = new BasicBlock("ifcont");
      +  
      +  Builder.CreateCondBr(CondV, ThenBB, ElseBB);
      +  
      +  // Emit then value.
      +  Builder.SetInsertPoint(ThenBB);
      +  
      +  Value *ThenV = Then->Codegen();
      +  if (ThenV == 0) return 0;
      +  
      +  Builder.CreateBr(MergeBB);
      +  // Codegen of 'Then' can change the current block, update ThenBB for the PHI.
      +  ThenBB = Builder.GetInsertBlock();
      +  
      +  // Emit else block.
      +  TheFunction->getBasicBlockList().push_back(ElseBB);
      +  Builder.SetInsertPoint(ElseBB);
      +  
      +  Value *ElseV = Else->Codegen();
      +  if (ElseV == 0) return 0;
      +  
      +  Builder.CreateBr(MergeBB);
      +  // Codegen of 'Else' can change the current block, update ElseBB for the PHI.
      +  ElseBB = Builder.GetInsertBlock();
      +  
      +  // Emit merge block.
      +  TheFunction->getBasicBlockList().push_back(MergeBB);
      +  Builder.SetInsertPoint(MergeBB);
      +  PHINode *PN = Builder.CreatePHI(Type::DoubleTy, "iftmp");
      +  
      +  PN->addIncoming(ThenV, ThenBB);
      +  PN->addIncoming(ElseV, ElseBB);
      +  return PN;
      +}
      +
      +Value *ForExprAST::Codegen() {
      +  // Output this as:
      +  //   ...
      +  //   start = startexpr
      +  //   goto loop
      +  // loop: 
      +  //   variable = phi [start, loopheader], [nextvariable, loopend]
      +  //   ...
      +  //   bodyexpr
      +  //   ...
      +  // loopend:
      +  //   step = stepexpr
      +  //   nextvariable = variable + step
      +  //   endcond = endexpr
      +  //   br endcond, loop, endloop
      +  // outloop:
      +  
      +  // Emit the start code first, without 'variable' in scope.
      +  Value *StartVal = Start->Codegen();
      +  if (StartVal == 0) return 0;
      +  
      +  // Make the new basic block for the loop header, inserting after current
      +  // block.
      +  Function *TheFunction = Builder.GetInsertBlock()->getParent();
      +  BasicBlock *PreheaderBB = Builder.GetInsertBlock();
      +  BasicBlock *LoopBB = new BasicBlock("loop", TheFunction);
      +  
      +  // Insert an explicit fall through from the current block to the LoopBB.
      +  Builder.CreateBr(LoopBB);
      +
      +  // Start insertion in LoopBB.
      +  Builder.SetInsertPoint(LoopBB);
      +  
      +  // Start the PHI node with an entry for Start.
      +  PHINode *Variable = Builder.CreatePHI(Type::DoubleTy, VarName.c_str());
      +  Variable->addIncoming(StartVal, PreheaderBB);
      +  
      +  // Within the loop, the variable is defined equal to the PHI node.  If it
      +  // shadows an existing variable, we have to restore it, so save it now.
      +  Value *OldVal = NamedValues[VarName];
      +  NamedValues[VarName] = Variable;
      +  
      +  // Emit the body of the loop.  This, like any other expr, can change the
      +  // current BB.  Note that we ignore the value computed by the body, but don't
      +  // allow an error.
      +  if (Body->Codegen() == 0)
      +    return 0;
      +  
      +  // Emit the step value.
      +  Value *StepVal;
      +  if (Step) {
      +    StepVal = Step->Codegen();
      +    if (StepVal == 0) return 0;
      +  } else {
      +    // If not specified, use 1.0.
      +    StepVal = ConstantFP::get(Type::DoubleTy, APFloat(1.0));
      +  }
      +  
      +  Value *NextVar = Builder.CreateAdd(Variable, StepVal, "nextvar");
      +
      +  // Compute the end condition.
      +  Value *EndCond = End->Codegen();
      +  if (EndCond == 0) return EndCond;
      +  
      +  // Convert condition to a bool by comparing equal to 0.0.
      +  EndCond = Builder.CreateFCmpONE(EndCond, 
      +                                  ConstantFP::get(Type::DoubleTy, APFloat(0.0)),
      +                                  "loopcond");
      +  
      +  // Create the "after loop" block and insert it.
      +  BasicBlock *LoopEndBB = Builder.GetInsertBlock();
      +  BasicBlock *AfterBB = new BasicBlock("afterloop", TheFunction);
      +  
      +  // Insert the conditional branch into the end of LoopEndBB.
      +  Builder.CreateCondBr(EndCond, LoopBB, AfterBB);
      +  
      +  // Any new code will be inserted in AfterBB.
      +  Builder.SetInsertPoint(AfterBB);
      +  
      +  // Add a new entry to the PHI node for the backedge.
      +  Variable->addIncoming(NextVar, LoopEndBB);
      +  
      +  // Restore the unshadowed variable.
      +  if (OldVal)
      +    NamedValues[VarName] = OldVal;
      +  else
      +    NamedValues.erase(VarName);
      +
      +  
      +  // for expr always returns 0.0.
      +  return Constant::getNullValue(Type::DoubleTy);
      +}
      +
      +Function *PrototypeAST::Codegen() {
      +  // Make the function type:  double(double,double) etc.
      +  std::vector<const Type*> Doubles(Args.size(), Type::DoubleTy);
      +  FunctionType *FT = FunctionType::get(Type::DoubleTy, Doubles, false);
      +  
      +  Function *F = new Function(FT, Function::ExternalLinkage, Name, TheModule);
      +  
      +  // If F conflicted, there was already something named 'Name'.  If it has a
      +  // body, don't allow redefinition or reextern.
      +  if (F->getName() != Name) {
      +    // Delete the one we just made and get the existing one.
      +    F->eraseFromParent();
      +    F = TheModule->getFunction(Name);
      +    
      +    // If F already has a body, reject this.
      +    if (!F->empty()) {
      +      ErrorF("redefinition of function");
      +      return 0;
      +    }
      +    
      +    // If F took a different number of args, reject.
      +    if (F->arg_size() != Args.size()) {
      +      ErrorF("redefinition of function with different # args");
      +      return 0;
      +    }
      +  }
      +  
      +  // Set names for all arguments.
      +  unsigned Idx = 0;
      +  for (Function::arg_iterator AI = F->arg_begin(); Idx != Args.size();
      +       ++AI, ++Idx) {
      +    AI->setName(Args[Idx]);
      +    
      +    // Add arguments to variable symbol table.
      +    NamedValues[Args[Idx]] = AI;
      +  }
      +  
      +  return F;
      +}
      +
      +Function *FunctionAST::Codegen() {
      +  NamedValues.clear();
      +  
      +  Function *TheFunction = Proto->Codegen();
      +  if (TheFunction == 0)
      +    return 0;
      +  
      +  // If this is an operator, install it.
      +  if (Proto->isBinaryOp())
      +    BinopPrecedence[Proto->getOperatorName()] = Proto->getBinaryPrecedence();
      +  
      +  // Create a new basic block to start insertion into.
      +  BasicBlock *BB = new BasicBlock("entry", TheFunction);
      +  Builder.SetInsertPoint(BB);
      +  
      +  if (Value *RetVal = Body->Codegen()) {
      +    // Finish off the function.
      +    Builder.CreateRet(RetVal);
      +
      +    // Validate the generated code, checking for consistency.
      +    verifyFunction(*TheFunction);
      +
      +    // Optimize the function.
      +    TheFPM->run(*TheFunction);
      +    
      +    return TheFunction;
      +  }
      +  
      +  // Error reading body, remove function.
      +  TheFunction->eraseFromParent();
      +
      +  if (Proto->isBinaryOp())
      +    BinopPrecedence.erase(Proto->getOperatorName());
      +  return 0;
      +}
      +
      +//===----------------------------------------------------------------------===//
      +// Top-Level parsing and JIT Driver
      +//===----------------------------------------------------------------------===//
      +
      +static ExecutionEngine *TheExecutionEngine;
      +
      +static void HandleDefinition() {
      +  if (FunctionAST *F = ParseDefinition()) {
      +    if (Function *LF = F->Codegen()) {
      +      fprintf(stderr, "Read function definition:");
      +      LF->dump();
      +    }
      +  } else {
      +    // Skip token for error recovery.
      +    getNextToken();
      +  }
      +}
      +
      +static void HandleExtern() {
      +  if (PrototypeAST *P = ParseExtern()) {
      +    if (Function *F = P->Codegen()) {
      +      fprintf(stderr, "Read extern: ");
      +      F->dump();
      +    }
      +  } else {
      +    // Skip token for error recovery.
      +    getNextToken();
      +  }
      +}
      +
      +static void HandleTopLevelExpression() {
      +  // Evaluate a top level expression into an anonymous function.
      +  if (FunctionAST *F = ParseTopLevelExpr()) {
      +    if (Function *LF = F->Codegen()) {
      +      // JIT the function, returning a function pointer.
      +      void *FPtr = TheExecutionEngine->getPointerToFunction(LF);
      +      
      +      // Cast it to the right type (takes no arguments, returns a double) so we
      +      // can call it as a native function.
      +      double (*FP)() = (double (*)())FPtr;
      +      fprintf(stderr, "Evaluated to %f\n", FP());
      +    }
      +  } else {
      +    // Skip token for error recovery.
      +    getNextToken();
      +  }
      +}
      +
      +/// top ::= definition | external | expression | ';'
      +static void MainLoop() {
      +  while (1) {
      +    fprintf(stderr, "ready> ");
      +    switch (CurTok) {
      +    case tok_eof:    return;
      +    case ';':        getNextToken(); break;  // ignore top level semicolons.
      +    case tok_def:    HandleDefinition(); break;
      +    case tok_extern: HandleExtern(); break;
      +    default:         HandleTopLevelExpression(); break;
      +    }
      +  }
      +}
      +
      +
      +
      +//===----------------------------------------------------------------------===//
      +// "Library" functions that can be "extern'd" from user code.
      +//===----------------------------------------------------------------------===//
      +
      +/// putchard - putchar that takes a double and returns 0.
      +extern "C" 
      +double putchard(double X) {
      +  putchar((char)X);
      +  return 0;
      +}
      +
      +/// printd - printf that takes a double prints it as "%f\n", returning 0.
      +extern "C" 
      +double printd(double X) {
      +  printf("%f\n", X);
      +  return 0;
      +}
      +
      +//===----------------------------------------------------------------------===//
      +// Main driver code.
      +//===----------------------------------------------------------------------===//
      +
      +int main() {
      +  // Install standard binary operators.
      +  // 1 is lowest precedence.
      +  BinopPrecedence['<'] = 10;
      +  BinopPrecedence['+'] = 20;
      +  BinopPrecedence['-'] = 20;
      +  BinopPrecedence['*'] = 40;  // highest.
      +
      +  // Prime the first token.
      +  fprintf(stderr, "ready> ");
      +  getNextToken();
      +
      +  // Make the module, which holds all the code.
      +  TheModule = new Module("my cool jit");
      +  
      +  // Create the JIT.
      +  TheExecutionEngine = ExecutionEngine::create(TheModule);
      +
      +  {
      +    ExistingModuleProvider OurModuleProvider(TheModule);
      +    FunctionPassManager OurFPM(&OurModuleProvider);
      +      
      +    // Set up the optimizer pipeline.  Start with registering info about how the
      +    // target lays out data structures.
      +    OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData()));
      +    // Do simple "peephole" optimizations and bit-twiddling optzns.
      +    OurFPM.add(createInstructionCombiningPass());
      +    // Reassociate expressions.
      +    OurFPM.add(createReassociatePass());
      +    // Eliminate Common SubExpressions.
      +    OurFPM.add(createGVNPass());
      +    // Simplify the control flow graph (deleting unreachable blocks, etc).
      +    OurFPM.add(createCFGSimplificationPass());
      +    // Set the global so the code gen can use this.
      +    TheFPM = &OurFPM;
      +
      +    // Run the main "interpreter loop" now.
      +    MainLoop();
      +    
      +    TheFPM = 0;
      +  }  // Free module provider and pass manager.
      +                                   
      +                                   
      +  // Print out all of the generated code.
      +  TheModule->dump();
      +  return 0;
      +}
       
      Modified: llvm/trunk/docs/tutorial/index.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/index.html?rev=43636&r1=43635&r2=43636&view=diff ============================================================================== --- llvm/trunk/docs/tutorial/index.html (original) +++ llvm/trunk/docs/tutorial/index.html Fri Nov 2 00:42:52 2007 @@ -32,7 +32,7 @@
    • Implementing Code Generation to LLVM IR
    • Adding JIT and Optimizer Support
    • Extending the language: control flow
    • -
    • Extending the language: operator overloading
    • +
    • Extending the language: user-defined operators
    • Extending the language: mutable variables
    • Thoughts and ideas for extensions
    • From sabre at nondot.org Fri Nov 2 00:54:25 2007 From: sabre at nondot.org (Chris Lattner) Date: Fri, 02 Nov 2007 05:54:25 -0000 Subject: [llvm-commits] [llvm] r43637 - /llvm/trunk/docs/tutorial/LangImpl6.html Message-ID: <200711020554.lA25sPQa031362@zion.cs.uiuc.edu> Author: lattner Date: Fri Nov 2 00:54:25 2007 New Revision: 43637 URL: http://llvm.org/viewvc/llvm-project?rev=43637&view=rev Log: fix typos Modified: llvm/trunk/docs/tutorial/LangImpl6.html Modified: llvm/trunk/docs/tutorial/LangImpl6.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/LangImpl6.html?rev=43637&r1=43636&r2=43637&view=diff ============================================================================== --- llvm/trunk/docs/tutorial/LangImpl6.html (original) +++ llvm/trunk/docs/tutorial/LangImpl6.html Fri Nov 2 00:54:25 2007 @@ -480,7 +480,7 @@

      It is somewhat hard to believe, but with a few simple extensions we've -covered in the last chapters, we have grown a realish language. With this, we +covered in the last chapters, we have grown a real-ish language. With this, we can do a lot of interesting things, including I/O, math, and a bunch of other things. For example, we can now add a nice sequencing operator (printd is defined to print out the specified value and a newline):

      @@ -499,7 +499,7 @@
      -

      We can also define a bunch of other "primative" operations, such as:

      +

      We can also define a bunch of other "primitive" operations, such as:

      @@ -593,7 +593,7 @@
       
      -

      This "z = z^2 + c" function is a beautiful little creature that is the basis +

      This "z = z2 + c" function is a beautiful little creature that is the basis for computation of the Mandelbrot Set. Our mandelconverge function returns the number of iterations that it takes @@ -768,7 +768,7 @@ language in the library, and showed how this can be used to build a simple but interesting end user application in Kaleidoscope. At this point, Kaleidoscope can build a variety of applications that are functional and can call functions -with side-effects, but it can't actually define and mutate a variable at all. +with side-effects, but it can't actually define and mutate a variable itself.

      Strikingly, lack of this feature is an important limitation for some From baldrick at free.fr Fri Nov 2 03:58:01 2007 From: baldrick at free.fr (Duncan Sands) Date: Fri, 2 Nov 2007 09:58:01 +0100 Subject: [llvm-commits] [llvm] r43620 - in /llvm/trunk: include/llvm/Target/ lib/Analysis/ lib/CodeGen/SelectionDAG/ lib/ExecutionEngine/ lib/ExecutionEngine/Interpreter/ lib/ExecutionEngine/JIT/ lib/Target/ lib/Transforms/IPO/ lib/Transforms/Scalar/ lib/Transforms/Utils/ In-Reply-To: <9D0B8548-7317-4659-BFE9-B575A3F8E215@apple.com> References: <200711012053.lA1KrIUW007528@zion.cs.uiuc.edu> <9D0B8548-7317-4659-BFE9-B575A3F8E215@apple.com> Message-ID: <200711020958.02147.baldrick@free.fr> Hi Dale, > > Finally, I made one change which I think wise but others might > > consider pointless and suboptimal: in an unpacked struct the > > amount of space allocated for a field is now given by the ABI > > size rather than getTypeStoreSize. I did this because every > > other place that reserves memory for a type (eg: alloca) now > > uses getABITypeSize, and I didn't want to make an exception > > for unpacked structs, i.e. I did it to make things more uniform. > > This only effects structs containing long doubles and arbitrary > > precision integers. If someone wants to pack these types more > > tightly they can always use a packed struct. > > Not sure I'm understanding this. The layout of structs is not > something we can > change around: we need to be runtime-compatible with gcc. (There have > been bugs in this area and perhaps still are, but that's the eventual > requirement.) this doesn't change anything as far as llvm-gcc is concerned. Consider struct { long double d; char c; } The gcc size for long double is 12 bytes on my machine (the gcc size is always equal to getABITypeSize), so when we convert this struct in llvm-types we get the following specification from gcc: long double d at offset 0 charc c at offset 12 Before, we would add padding when converting this to LLVM, to make up for the difference in types sizes, giving the following LLVM struct: long double <- 10 bytes (offset 0) char [2] <- 2 bytes of padding (offset 10) char <- 1 byte (offset 12) Now that long double has the same size in LLVM as in gcc, we convert this to: long double <- 12 bytes (offset 0) char <- 1 byte (offset 12) So the only effect of this change should be that we no longer need to pad structs containing x86 long doubles. > IIRC this was previously achieved by looking at the alignment. Are you > just achieving the same layout a different way (I have no objection), or > is the layout changing? The same layout is being achieved a different way. Best wishes, Duncan. From baldrick at free.fr Fri Nov 2 04:04:51 2007 From: baldrick at free.fr (Duncan Sands) Date: Fri, 2 Nov 2007 10:04:51 +0100 Subject: [llvm-commits] =?iso-8859-6?q?=5Bllvm=5D_r43620_-_in_/llvm/trunk?= =?iso-8859-6?q?=3A_include/llvm/Target/_lib/Analysis/_lib/CodeGen/Selecti?= =?iso-8859-6?q?onDAG/_lib/ExecutionEngine/_lib/ExecutionEngine/Interprete?= =?iso-8859-6?q?r/=09lib/ExecutionEngine/JIT/_lib/Target/_lib/Transforms/I?= =?iso-8859-6?q?PO/=09lib/Transforms/Scalar/_lib/Transforms/Utils/?= In-Reply-To: References: <200711012053.lA1KrIUW007528@zion.cs.uiuc.edu> Message-ID: <200711021004.52009.baldrick@free.fr> > > Now, how far we are from ability to use arbitrary precision integers > > to represent struct bit fields directly ? > > > > translating > > struct STest4 {char a; int b:2; int c:3; int d; } st4; > > into > > %struct.STest4 = type { i8, i2, i3, i32 } > > instead of > > %struct.STest4 = type { i8, i8, i32 } > > ?:) > > > We won't ever want to do that. "apints in structs" will be stored > with their extra bits as garbage: they won't pack together. {i2, i3} > will take two bytes for example. In practice, we will always have to > compile the above into { i8, i8, i32 }. Yes, this is correct. That said, you could always load b via an i2 load. It might be convenient to use apints to load the minimum number of bits, though it's not clear that it wins you anything much. However the final value may need to end up in an apint to satisfy C semantics, see PR1721. Ciao, Duncan. From neil at daikokuya.co.uk Fri Nov 2 10:10:05 2007 From: neil at daikokuya.co.uk (Neil Booth) Date: Fri, 02 Nov 2007 15:10:05 -0000 Subject: [llvm-commits] [llvm] r43638 - in /llvm/trunk: lib/Support/APFloat.cpp utils/TableGen/FileLexer.cpp.cvs utils/TableGen/FileLexer.l.cvs Message-ID: <200711021510.lA2FA5F5018817@zion.cs.uiuc.edu> Author: neil Date: Fri Nov 2 10:10:05 2007 New Revision: 43638 URL: http://llvm.org/viewvc/llvm-project?rev=43638&view=rev Log: Remove some unnecessary C-style statics. Restore an assertion that arithmetic can be performed on this format. Modified: llvm/trunk/lib/Support/APFloat.cpp llvm/trunk/utils/TableGen/FileLexer.cpp.cvs llvm/trunk/utils/TableGen/FileLexer.l.cvs Modified: llvm/trunk/lib/Support/APFloat.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APFloat.cpp?rev=43638&r1=43637&r2=43638&view=diff ============================================================================== --- llvm/trunk/lib/Support/APFloat.cpp (original) +++ llvm/trunk/lib/Support/APFloat.cpp Fri Nov 2 10:10:05 2007 @@ -121,7 +121,7 @@ If the exponent overflows, returns a large exponent with the appropriate sign. */ - static int + int readExponent(const char *p) { bool isNegative; @@ -159,7 +159,7 @@ /* This is ugly and needs cleaning up, but I don't immediately see how whilst remaining safe. */ - static int + int totalExponent(const char *p, int exponentAdjustment) { integerPart unsignedExponent; @@ -433,7 +433,7 @@ /* Place pow(5, power) in DST, and return the number of parts used. DST must be at least one part larger than size of the answer. */ - static unsigned int + unsigned int powerOf5(integerPart *dst, unsigned int power) { static integerPart firstEightPowers[] = { 1, 5, 25, 125, 625, 3125, @@ -504,7 +504,7 @@ /* Write out an integerPart in hexadecimal, starting with the most significant nibble. Write out exactly COUNT hexdigits, return COUNT. */ - static unsigned int + unsigned int partAsHex (char *dst, integerPart part, unsigned int count, const char *hexDigitChars) { @@ -522,7 +522,7 @@ } /* Write out an unsigned decimal integer. */ - static char * + char * writeUnsignedDecimal (char *dst, unsigned int n) { char buff[40], *p; @@ -540,7 +540,7 @@ } /* Write out a signed decimal integer. */ - static char * + char * writeSignedDecimal (char *dst, int value) { if (value < 0) { @@ -1750,6 +1750,8 @@ const integerPart *src; unsigned int dstPartsCount, truncatedBits; + assertArithmeticOK(*semantics); + /* Handle the three special cases first. */ if(category == fcInfinity || category == fcNaN) return opInvalidOp; Modified: llvm/trunk/utils/TableGen/FileLexer.cpp.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/FileLexer.cpp.cvs?rev=43638&r1=43637&r2=43638&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/FileLexer.cpp.cvs (original) +++ llvm/trunk/utils/TableGen/FileLexer.cpp.cvs Fri Nov 2 10:10:05 2007 @@ -21,7 +21,7 @@ /* A lexical scanner generated by flex */ /* Scanner skeleton version: - * $Header: /cvs/root/flex/flex/skel.c,v 1.2 2004/05/07 00:28:17 jkh Exp $ + * $NetBSD: flex.skl,v 1.22 2005/08/08 01:28:08 christos Exp $ */ #define FLEX_SCANNER @@ -257,11 +257,11 @@ YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); +YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, yy_size_t len )); +#ifdef __cplusplus +YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, int size )); YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); - -static void *yy_flex_alloc YY_PROTO(( yy_size_t )); -static inline void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); -static void yy_flex_free YY_PROTO(( void * )); +#endif #define yy_new_buffer yy_create_buffer @@ -291,6 +291,14 @@ extern char *yytext; #define yytext_ptr yytext +static void *yy_flex_alloc YY_PROTO(( yy_size_t )); +static inline void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )) +#ifdef __GNUC__ + __attribute__((__unused__)) +#endif +; +static void yy_flex_free YY_PROTO(( void * )); + static yy_state_type yy_get_previous_state YY_PROTO(( void )); static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); static int yy_get_next_buffer YY_PROTO(( void )); @@ -502,7 +510,7 @@ #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; -#line 1 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 1 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l" #define INITIAL 0 /*===-- FileLexer.l - Scanner for TableGen Files ----------------*- C++ -*-===// // @@ -518,9 +526,9 @@ // //===----------------------------------------------------------------------===*/ #define YY_NEVER_INTERACTIVE 1 -#define comment 1 +#define in_comment 1 -#line 30 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 30 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l" #include "llvm/Config/config.h" #include "llvm/Support/Streams.h" #include "Record.h" @@ -666,7 +674,7 @@ using namespace llvm; -#line 670 "Lexer.cpp" +#line 678 "Lexer.cpp" /* Macros after this point can all be overridden by user definitions in * section 1. @@ -681,15 +689,19 @@ #endif #ifndef YY_NO_UNPUT -static inline void yyunput YY_PROTO(( int c, char *buf_ptr )); +static inline void yyunput YY_PROTO(( int c, char *buf_ptr )) +#ifdef __GNUC__ + __attribute__((__unused__)) +#endif +; #endif #ifndef yytext_ptr -static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); +static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, yy_size_t )); #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen YY_PROTO(( yyconst char * )); +static yy_size_t yy_flex_strlen YY_PROTO(( yyconst char * )); #endif #ifndef YY_NO_INPUT @@ -746,7 +758,7 @@ /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) +#define ECHO (void) fwrite( yytext, (size_t)yyleng, 1, yyout ) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -766,7 +778,7 @@ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ - else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ + else if ( ((result = fread( buf, 1, (size_t)max_size, yyin )) == 0) \ && ferror( yyin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); #endif @@ -805,7 +817,7 @@ /* Code executed at the end of each rule. */ #ifndef YY_BREAK -#define YY_BREAK break; +#define YY_BREAK /*LINTED*/break; #endif #define YY_RULE_SETUP \ @@ -817,11 +829,16 @@ register char *yy_cp, *yy_bp; register int yy_act; -#line 185 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 185 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l" -#line 824 "Lexer.cpp" +#line 836 "Lexer.cpp" +#if defined(YY_USES_REJECT) && (defined(__GNUC__) || defined(lint)) + /* XXX: shut up `unused label' warning with %options yylineno */ + if (/*CONSTCOND*/0 && yy_full_match) + goto find_rule; +#endif if ( yy_init ) { yy_init = 0; @@ -846,7 +863,7 @@ yy_load_buffer_state(); } - while ( 1 ) /* loops until end-of-file is reached */ + while (/*CONSTCOND*/ 1 ) /* loops until end-of-file is reached */ { yy_cp = yy_c_buf_p; @@ -913,188 +930,188 @@ { /* beginning of action switch */ case 1: YY_RULE_SETUP -#line 187 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 187 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l" { /* Ignore comments */ } YY_BREAK case 2: YY_RULE_SETUP -#line 189 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 189 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l" { HandleInclude(yytext); } YY_BREAK case 3: YY_RULE_SETUP -#line 190 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 190 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l" { Filelval.StrVal = new std::string(yytext+2, yytext+yyleng-2); return CODEFRAGMENT; } YY_BREAK case 4: YY_RULE_SETUP -#line 193 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 193 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l" { return INT; } YY_BREAK case 5: YY_RULE_SETUP -#line 194 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 194 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l" { return BIT; } YY_BREAK case 6: YY_RULE_SETUP -#line 195 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 195 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l" { return BITS; } YY_BREAK case 7: YY_RULE_SETUP -#line 196 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 196 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l" { return STRING; } YY_BREAK case 8: YY_RULE_SETUP -#line 197 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 197 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l" { return LIST; } YY_BREAK case 9: YY_RULE_SETUP -#line 198 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 198 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l" { return CODE; } YY_BREAK case 10: YY_RULE_SETUP -#line 199 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 199 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l" { return DAG; } YY_BREAK case 11: YY_RULE_SETUP -#line 201 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 201 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l" { return CLASS; } YY_BREAK case 12: YY_RULE_SETUP -#line 202 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 202 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l" { return DEF; } YY_BREAK case 13: YY_RULE_SETUP -#line 203 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 203 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l" { return DEFM; } YY_BREAK case 14: YY_RULE_SETUP -#line 204 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 204 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l" { return MULTICLASS; } YY_BREAK case 15: YY_RULE_SETUP -#line 205 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 205 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l" { return FIELD; } YY_BREAK case 16: YY_RULE_SETUP -#line 206 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 206 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l" { return LET; } YY_BREAK case 17: YY_RULE_SETUP -#line 207 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 207 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l" { return IN; } YY_BREAK case 18: YY_RULE_SETUP -#line 209 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 209 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l" { return CONCATTOK; } YY_BREAK case 19: YY_RULE_SETUP -#line 210 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 210 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l" { return SRATOK; } YY_BREAK case 20: YY_RULE_SETUP -#line 211 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 211 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l" { return SRLTOK; } YY_BREAK case 21: YY_RULE_SETUP -#line 212 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 212 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l" { return SHLTOK; } YY_BREAK case 22: YY_RULE_SETUP -#line 213 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 213 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l" { return STRCONCATTOK; } YY_BREAK case 23: YY_RULE_SETUP -#line 216 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 216 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l" { Filelval.StrVal = new std::string(yytext, yytext+yyleng); return ID; } YY_BREAK case 24: YY_RULE_SETUP -#line 218 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 218 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l" { Filelval.StrVal = new std::string(yytext+1, yytext+yyleng); return VARNAME; } YY_BREAK case 25: YY_RULE_SETUP -#line 221 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 221 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l" { Filelval.StrVal = new std::string(yytext+1, yytext+yyleng-1); return STRVAL; } YY_BREAK case 26: YY_RULE_SETUP -#line 224 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 224 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l" { Filelval.IntVal = ParseInt(Filetext); return INTVAL; } YY_BREAK case 27: YY_RULE_SETUP -#line 226 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 226 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l" { /* Ignore whitespace */ } YY_BREAK case 28: YY_RULE_SETUP -#line 229 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" -{ BEGIN(comment); CommentDepth++; } +#line 229 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l" +{ BEGIN(in_comment); CommentDepth++; } YY_BREAK case 29: YY_RULE_SETUP -#line 230 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 230 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l" {} /* eat anything that's not a '*' or '/' */ YY_BREAK case 30: YY_RULE_SETUP -#line 231 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 231 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l" {} /* eat up '*'s not followed by '/'s */ YY_BREAK case 31: YY_RULE_SETUP -#line 232 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 232 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l" { ++CommentDepth; } YY_BREAK case 32: YY_RULE_SETUP -#line 233 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 233 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l" {} /* eat up /'s not followed by *'s */ YY_BREAK case 33: YY_RULE_SETUP -#line 234 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 234 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l" { if (!--CommentDepth) { BEGIN(INITIAL); } } YY_BREAK -case YY_STATE_EOF(comment): -#line 235 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +case YY_STATE_EOF(in_comment): +#line 235 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l" { err() << "Unterminated comment!\n"; exit(1); } YY_BREAK case 34: YY_RULE_SETUP -#line 237 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 237 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l" { return Filetext[0]; } YY_BREAK case 35: YY_RULE_SETUP -#line 239 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 239 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l" YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK -#line 1098 "Lexer.cpp" +#line 1115 "Lexer.cpp" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -1513,7 +1530,7 @@ /* Reset buffer status. */ yyrestart( yyin ); - /* fall through */ + /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { @@ -1658,7 +1675,7 @@ #ifndef YY_ALWAYS_INTERACTIVE #ifndef YY_NEVER_INTERACTIVE -extern int isatty YY_PROTO(( int )); +#include #endif #endif @@ -1754,6 +1771,12 @@ return b; } +#ifdef __cplusplus +YY_BUFFER_STATE yy_scan_buffer( char *base, int size ) + { + return yy_scan_buffer(base, (yy_size_t) size); + } +#endif #endif @@ -1765,7 +1788,7 @@ yyconst char *yy_str; #endif { - int len; + yy_size_t len; for ( len = 0; yy_str[len]; ++len ) ; @@ -1776,17 +1799,16 @@ #ifndef YY_NO_SCAN_BYTES #ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) +YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, yy_size_t len ) #else YY_BUFFER_STATE yy_scan_bytes( bytes, len ) yyconst char *bytes; -int len; +yy_size_t len; #endif { YY_BUFFER_STATE b; char *buf; - yy_size_t n; - int i; + yy_size_t n, i; /* Get memory for full buffer, including space for trailing EOB's. */ n = len + 2; @@ -1810,6 +1832,12 @@ return b; } +#ifdef __cplusplus +YY_BUFFER_STATE yy_scan_bytes( yyconst char *base, int size ) + { + return yy_scan_bytes(base, (yy_size_t) size); + } +#endif #endif @@ -1902,15 +1930,15 @@ #ifndef yytext_ptr #ifdef YY_USE_PROTOS -static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) +static void yy_flex_strncpy( char *s1, yyconst char *s2, yy_size_t n ) #else static void yy_flex_strncpy( s1, s2, n ) char *s1; yyconst char *s2; -int n; +yy_size_t n; #endif { - register int i; + register yy_size_t i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } @@ -1918,13 +1946,13 @@ #ifdef YY_NEED_STRLEN #ifdef YY_USE_PROTOS -static int yy_flex_strlen( yyconst char *s ) +static yy_size_t yy_flex_strlen( yyconst char *s ) #else -static int yy_flex_strlen( s ) +static yy_size_t yy_flex_strlen( s ) yyconst char *s; #endif { - register int n; + register yy_size_t n; for ( n = 0; s[n]; ++n ) ; @@ -1978,6 +2006,6 @@ return 0; } #endif -#line 239 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 239 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l" Modified: llvm/trunk/utils/TableGen/FileLexer.l.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/FileLexer.l.cvs?rev=43638&r1=43637&r2=43638&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/FileLexer.l.cvs (original) +++ llvm/trunk/utils/TableGen/FileLexer.l.cvs Fri Nov 2 10:10:05 2007 @@ -24,7 +24,7 @@ %option noreject %option noyymore -%x comment +%x in_comment %{ #include "llvm/Config/config.h" @@ -226,13 +226,13 @@ [ \t\n\r]+ { /* Ignore whitespace */ } -"/*" { BEGIN(comment); CommentDepth++; } -[^*/]* {} /* eat anything that's not a '*' or '/' */ -"*"+[^*/]* {} /* eat up '*'s not followed by '/'s */ -"/*" { ++CommentDepth; } -"/"+[^*/]* {} /* eat up /'s not followed by *'s */ -"*"+"/" { if (!--CommentDepth) { BEGIN(INITIAL); } } -<> { err() << "Unterminated comment!\n"; exit(1); } +"/*" { BEGIN(in_comment); CommentDepth++; } +[^*/]* {} /* eat anything that's not a '*' or '/' */ +"*"+[^*/]* {} /* eat up '*'s not followed by '/'s */ +"/*" { ++CommentDepth; } +"/"+[^*/]* {} /* eat up /'s not followed by *'s */ +"*"+"/" { if (!--CommentDepth) { BEGIN(INITIAL); } } +<> { err() << "Unterminated comment!\n"; exit(1); } . { return Filetext[0]; } From baldrick at free.fr Fri Nov 2 10:18:07 2007 From: baldrick at free.fr (Duncan Sands) Date: Fri, 02 Nov 2007 15:18:07 -0000 Subject: [llvm-commits] [llvm] r43639 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Message-ID: <200711021518.lA2FI7fk019390@zion.cs.uiuc.edu> Author: baldrick Date: Fri Nov 2 10:18:06 2007 New Revision: 43639 URL: http://llvm.org/viewvc/llvm-project?rev=43639&view=rev Log: Fix a thinko. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp?rev=43639&r1=43638&r2=43639&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Fri Nov 2 10:18:06 2007 @@ -783,12 +783,11 @@ // If the target wants to, allow it to lower this itself. std::pair P = TLI.ExpandOperationResult(N, DAG); if (P.first.Val) { - Lo = P.first; - Hi = P.second; + SetExpandedOp(SDOperand(N, ResNo), P.first, P.second); return; } } - + switch (N->getOpcode()) { default: #ifndef NDEBUG From sabre at nondot.org Fri Nov 2 12:04:20 2007 From: sabre at nondot.org (Chris Lattner) Date: Fri, 02 Nov 2007 17:04:20 -0000 Subject: [llvm-commits] [llvm] r43642 - /llvm/trunk/lib/Target/X86/README.txt Message-ID: <200711021704.lA2H4KXo025092@zion.cs.uiuc.edu> Author: lattner Date: Fri Nov 2 12:04:20 2007 New Revision: 43642 URL: http://llvm.org/viewvc/llvm-project?rev=43642&view=rev Log: add a note Modified: llvm/trunk/lib/Target/X86/README.txt Modified: llvm/trunk/lib/Target/X86/README.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/README.txt?rev=43642&r1=43641&r2=43642&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/README.txt (original) +++ llvm/trunk/lib/Target/X86/README.txt Fri Nov 2 12:04:20 2007 @@ -651,6 +651,26 @@ etc. +Another is: +int usesbb(unsigned int a, unsigned int b) { + return (a < b ? -1 : 0); +} +to: +_usesbb: + movl 8(%esp), %eax + cmpl %eax, 4(%esp) + sbbl %eax, %eax + ret + +instead of: +_usesbb: + xorl %eax, %eax + movl 8(%esp), %ecx + cmpl %ecx, 4(%esp) + movl $4294967295, %ecx + cmovb %ecx, %eax + ret + //===---------------------------------------------------------------------===// Currently we don't have elimination of redundant stack manipulations. Consider From evan.cheng at apple.com Fri Nov 2 12:35:08 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 02 Nov 2007 17:35:08 -0000 Subject: [llvm-commits] [llvm] r43644 - in /llvm/trunk: lib/CodeGen/VirtRegMap.cpp test/CodeGen/X86/2007-11-02-BadAsm.ll Message-ID: <200711021735.lA2HZ8Ww026533@zion.cs.uiuc.edu> Author: evancheng Date: Fri Nov 2 12:35:08 2007 New Revision: 43644 URL: http://llvm.org/viewvc/llvm-project?rev=43644&view=rev Log: One more extract_subreg coalescing bug. Added: llvm/trunk/test/CodeGen/X86/2007-11-02-BadAsm.ll Modified: llvm/trunk/lib/CodeGen/VirtRegMap.cpp Modified: llvm/trunk/lib/CodeGen/VirtRegMap.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/VirtRegMap.cpp?rev=43644&r1=43643&r2=43644&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/VirtRegMap.cpp (original) +++ llvm/trunk/lib/CodeGen/VirtRegMap.cpp Fri Nov 2 12:35:08 2007 @@ -835,6 +835,19 @@ return false; } +/// findSuperReg - Find the SubReg's super-register of given register class +/// where its SubIdx sub-register is SubReg. +static unsigned findSuperReg(const TargetRegisterClass *RC, unsigned SubReg, + unsigned SubIdx, const MRegisterInfo *MRI) { + for (TargetRegisterClass::iterator I = RC->begin(), E = RC->end(); + I != E; ++I) { + unsigned Reg = *I; + if (MRI->getSubReg(Reg, SubIdx) == SubReg) + return Reg; + } + return 0; +} + /// rewriteMBB - Keep track of which spills are available even after the /// register allocator is done with them. If possible, avoid reloading vregs. void LocalSpiller::RewriteMBB(MachineBasicBlock &MBB, VirtRegMap &VRM) { @@ -1056,7 +1069,7 @@ << " instead of reloading into same physreg.\n"; unsigned RReg = isSubReg ? MRI->getSubReg(PhysReg, SubIdx) : PhysReg; MI.getOperand(i).setReg(RReg); - ReusedOperands.markClobbered(PhysReg); + ReusedOperands.markClobbered(RReg); ++NumReused; continue; } @@ -1295,6 +1308,13 @@ continue; } + unsigned SubIdx = 0; + bool isSubReg = RegMap->isSubRegister(VirtReg); + if (isSubReg) { + SubIdx = RegMap->getSubRegisterIndex(VirtReg); + VirtReg = RegMap->getSuperRegister(VirtReg); + } + bool DoReMat = VRM.isReMaterialized(VirtReg); if (DoReMat) ReMatDefs.insert(&MI); @@ -1307,9 +1327,15 @@ // the store from the correct physical register. unsigned PhysReg; int TiedOp = MI.getInstrDescriptor()->findTiedToSrcOperand(i); - if (TiedOp != -1) + if (TiedOp != -1) { PhysReg = MI.getOperand(TiedOp).getReg(); - else { + if (isSubReg) { + unsigned SuperReg = findSuperReg(RC, PhysReg, SubIdx, MRI); + assert(SuperReg && MRI->getSubReg(SuperReg, SubIdx) == PhysReg && + "Can't find corresponding super-register!"); + PhysReg = SuperReg; + } + } else { PhysReg = VRM.getPhys(VirtReg); if (ReusedOperands.isClobbered(PhysReg)) { // Another def has taken the assigned physreg. It must have been a @@ -1320,8 +1346,10 @@ } MF.setPhysRegUsed(PhysReg); - ReusedOperands.markClobbered(PhysReg); - MI.getOperand(i).setReg(PhysReg); + unsigned RReg = isSubReg ? MRI->getSubReg(PhysReg, SubIdx) : PhysReg; + ReusedOperands.markClobbered(RReg); + MI.getOperand(i).setReg(RReg); + if (!MO.isDead()) { MRI->storeRegToStackSlot(MBB, next(MII), PhysReg, StackSlot, RC); DOUT << "Store:\t" << *next(MII); Added: llvm/trunk/test/CodeGen/X86/2007-11-02-BadAsm.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2007-11-02-BadAsm.ll?rev=43644&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/2007-11-02-BadAsm.ll (added) +++ llvm/trunk/test/CodeGen/X86/2007-11-02-BadAsm.ll Fri Nov 2 12:35:08 2007 @@ -0,0 +1,144 @@ +; RUN: llvm-as < %s | llc -mtriple=x86_64-apple-darwin | grep movl | not grep rax + + %struct.color_sample = type { i64 } + %struct.gs_matrix = type { float, i64, float, i64, float, i64, float, i64, float, i64, float, i64 } + %struct.ref = type { %struct.color_sample, i16, i16 } + %struct.status = type { %struct.gs_matrix, i8*, i32, i32, i8*, i32, i32, i32, i32, i32, i32, i32 } + +define i32 @ztype1imagepath(%struct.ref* %op) { +entry: + br i1 false, label %cond_next, label %UnifiedReturnBlock + +cond_next: ; preds = %entry + br i1 false, label %cond_next68, label %UnifiedReturnBlock + +cond_next68: ; preds = %cond_next + %tmp5.i.i = malloc i8, i32 0 ; [#uses=2] + br i1 false, label %bb81.outer.i, label %xit.i + +bb81.outer.i: ; preds = %bb87.i, %cond_next68 + %tmp67.i = add i32 0, 1 ; [#uses=1] + br label %bb81.i + +bb61.i: ; preds = %bb81.i + %tmp71.i = getelementptr i8* %tmp5.i.i, i64 0 ; [#uses=1] + %tmp72.i = load i8* %tmp71.i, align 1 ; [#uses=1] + %tmp73.i = icmp eq i8 %tmp72.i, 0 ; [#uses=1] + br i1 %tmp73.i, label %bb81.i, label %xit.i + +bb81.i: ; preds = %bb61.i, %bb81.outer.i + br i1 false, label %bb87.i, label %bb61.i + +bb87.i: ; preds = %bb81.i + br i1 false, label %bb81.outer.i, label %xit.i + +xit.i: ; preds = %bb87.i, %bb61.i, %cond_next68 + %lsbx.0.reg2mem.1.i = phi i32 [ 0, %cond_next68 ], [ 0, %bb61.i ], [ %tmp67.i, %bb87.i ] ; [#uses=1] + %tmp6162.i.i = fptrunc double 0.000000e+00 to float ; [#uses=1] + %tmp67.i15.i = fptrunc double 0.000000e+00 to float ; [#uses=1] + %tmp24.i27.i = icmp eq i64 0, 0 ; [#uses=1] + br i1 %tmp24.i27.i, label %cond_next.i79.i, label %cond_true.i34.i + +cond_true.i34.i: ; preds = %xit.i + ret i32 0 + +cond_next.i79.i: ; preds = %xit.i + %phitmp167.i = fptosi double 0.000000e+00 to i64 ; [#uses=1] + %tmp142143.i = fpext float %tmp6162.i.i to double ; [#uses=1] + %tmp2.i139.i = add double %tmp142143.i, 5.000000e-01 ; [#uses=1] + %tmp23.i140.i = fptosi double %tmp2.i139.i to i64 ; [#uses=1] + br i1 false, label %cond_true.i143.i, label %round_coord.exit148.i + +cond_true.i143.i: ; preds = %cond_next.i79.i + %tmp8.i142.i = icmp sgt i64 %tmp23.i140.i, -32768 ; [#uses=1] + br i1 %tmp8.i142.i, label %cond_true11.i145.i, label %round_coord.exit148.i + +cond_true11.i145.i: ; preds = %cond_true.i143.i + ret i32 0 + +round_coord.exit148.i: ; preds = %cond_true.i143.i, %cond_next.i79.i + %tmp144149.i = phi i32 [ 32767, %cond_next.i79.i ], [ -32767, %cond_true.i143.i ] ; [#uses=1] + store i32 %tmp144149.i, i32* null, align 8 + %tmp147148.i = fpext float %tmp67.i15.i to double ; [#uses=1] + %tmp2.i128.i = add double %tmp147148.i, 5.000000e-01 ; [#uses=1] + %tmp23.i129.i = fptosi double %tmp2.i128.i to i64 ; [#uses=2] + %tmp5.i130.i = icmp slt i64 %tmp23.i129.i, 32768 ; [#uses=1] + br i1 %tmp5.i130.i, label %cond_true.i132.i, label %round_coord.exit137.i + +cond_true.i132.i: ; preds = %round_coord.exit148.i + %tmp8.i131.i = icmp sgt i64 %tmp23.i129.i, -32768 ; [#uses=1] + br i1 %tmp8.i131.i, label %cond_true11.i134.i, label %round_coord.exit137.i + +cond_true11.i134.i: ; preds = %cond_true.i132.i + br label %round_coord.exit137.i + +round_coord.exit137.i: ; preds = %cond_true11.i134.i, %cond_true.i132.i, %round_coord.exit148.i + %tmp149138.i = phi i32 [ 0, %cond_true11.i134.i ], [ 32767, %round_coord.exit148.i ], [ -32767, %cond_true.i132.i ] ; [#uses=1] + br i1 false, label %cond_true.i121.i, label %round_coord.exit126.i + +cond_true.i121.i: ; preds = %round_coord.exit137.i + br i1 false, label %cond_true11.i123.i, label %round_coord.exit126.i + +cond_true11.i123.i: ; preds = %cond_true.i121.i + br label %round_coord.exit126.i + +round_coord.exit126.i: ; preds = %cond_true11.i123.i, %cond_true.i121.i, %round_coord.exit137.i + %tmp153127.i = phi i32 [ 0, %cond_true11.i123.i ], [ 32767, %round_coord.exit137.i ], [ -32767, %cond_true.i121.i ] ; [#uses=1] + br i1 false, label %cond_true.i110.i, label %round_coord.exit115.i + +cond_true.i110.i: ; preds = %round_coord.exit126.i + br i1 false, label %cond_true11.i112.i, label %round_coord.exit115.i + +cond_true11.i112.i: ; preds = %cond_true.i110.i + br label %round_coord.exit115.i + +round_coord.exit115.i: ; preds = %cond_true11.i112.i, %cond_true.i110.i, %round_coord.exit126.i + %tmp157116.i = phi i32 [ 0, %cond_true11.i112.i ], [ 32767, %round_coord.exit126.i ], [ -32767, %cond_true.i110.i ] ; [#uses=2] + br i1 false, label %cond_true.i99.i, label %round_coord.exit104.i + +cond_true.i99.i: ; preds = %round_coord.exit115.i + br i1 false, label %cond_true11.i101.i, label %round_coord.exit104.i + +cond_true11.i101.i: ; preds = %cond_true.i99.i + %tmp1213.i100.i = trunc i64 %phitmp167.i to i32 ; [#uses=1] + br label %cond_next172.i + +round_coord.exit104.i: ; preds = %cond_true.i99.i, %round_coord.exit115.i + %UnifiedRetVal.i102.i = phi i32 [ 32767, %round_coord.exit115.i ], [ -32767, %cond_true.i99.i ] ; [#uses=1] + %tmp164.i = call fastcc i32 @put_int( %struct.status* null, i32 %tmp157116.i ) ; [#uses=0] + br label %cond_next172.i + +cond_next172.i: ; preds = %round_coord.exit104.i, %cond_true11.i101.i + %tmp161105.reg2mem.0.i = phi i32 [ %tmp1213.i100.i, %cond_true11.i101.i ], [ %UnifiedRetVal.i102.i, %round_coord.exit104.i ] ; [#uses=1] + %tmp174.i = icmp eq i32 %tmp153127.i, 0 ; [#uses=1] + %bothcond.i = and i1 false, %tmp174.i ; [#uses=1] + %tmp235.i = call fastcc i32 @put_int( %struct.status* null, i32 %tmp149138.i ) ; [#uses=0] + %tmp245.i = load i8** null, align 8 ; [#uses=2] + %tmp246.i = getelementptr i8* %tmp245.i, i64 1 ; [#uses=1] + br i1 %bothcond.i, label %cond_next254.i, label %bb259.i + +cond_next254.i: ; preds = %cond_next172.i + store i8 13, i8* %tmp245.i, align 1 + br label %bb259.i + +bb259.i: ; preds = %cond_next254.i, %cond_next172.i + %storemerge.i = phi i8* [ %tmp246.i, %cond_next254.i ], [ null, %cond_next172.i ] ; [#uses=0] + %tmp261.i = shl i32 %lsbx.0.reg2mem.1.i, 2 ; [#uses=1] + store i32 %tmp261.i, i32* null, align 8 + %tmp270.i = add i32 0, %tmp157116.i ; [#uses=1] + store i32 %tmp270.i, i32* null, align 8 + %tmp275.i = add i32 0, %tmp161105.reg2mem.0.i ; [#uses=0] + br i1 false, label %trace_cells.exit.i, label %bb.preheader.i.i + +bb.preheader.i.i: ; preds = %bb259.i + ret i32 0 + +trace_cells.exit.i: ; preds = %bb259.i + free i8* %tmp5.i.i + ret i32 0 + +UnifiedReturnBlock: ; preds = %cond_next, %entry + ret i32 -20 +} + +declare fastcc i32 @put_int(%struct.status*, i32) From evan.cheng at apple.com Fri Nov 2 12:36:58 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 02 Nov 2007 17:36:58 -0000 Subject: [llvm-commits] [llvm] r43645 - /llvm/trunk/test/CodeGen/X86/2007-11-01-ISelCrash.ll Message-ID: <200711021736.lA2Hax7e026626@zion.cs.uiuc.edu> Author: evancheng Date: Fri Nov 2 12:36:58 2007 New Revision: 43645 URL: http://llvm.org/viewvc/llvm-project?rev=43645&view=rev Log: Add run line. Modified: llvm/trunk/test/CodeGen/X86/2007-11-01-ISelCrash.ll Modified: llvm/trunk/test/CodeGen/X86/2007-11-01-ISelCrash.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2007-11-01-ISelCrash.ll?rev=43645&r1=43644&r2=43645&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/2007-11-01-ISelCrash.ll (original) +++ llvm/trunk/test/CodeGen/X86/2007-11-01-ISelCrash.ll Fri Nov 2 12:36:58 2007 @@ -1,3 +1,5 @@ +; RUN: llvm-as < %s | llc -march=x86 + %"struct.K::JL" = type <{ i8 }> %struct.jv = type { i64 } From evan.cheng at apple.com Fri Nov 2 12:45:40 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 02 Nov 2007 17:45:40 -0000 Subject: [llvm-commits] [llvm] r43646 - /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Message-ID: <200711021745.lA2HjekK027165@zion.cs.uiuc.edu> Author: evancheng Date: Fri Nov 2 12:45:40 2007 New Revision: 43646 URL: http://llvm.org/viewvc/llvm-project?rev=43646&view=rev Log: Unbreak tailcall opt. Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=43646&r1=43645&r2=43646&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Fri Nov 2 12:45:40 2007 @@ -1466,7 +1466,7 @@ if ((NumOps == 1 && (Ret.getOperand(0) == SDOperand(Call.Val,1) || Ret.getOperand(0) == SDOperand(Call.Val,0))) || - (NumOps == 2 && + (NumOps > 1 && Ret.getOperand(0) == SDOperand(Call.Val,Call.Val->getNumValues()-1) && Ret.getOperand(1) == SDOperand(Call.Val,0))) { MachineFunction &MF = DAG.getMachineFunction(); From kremenek at apple.com Fri Nov 2 13:04:21 2007 From: kremenek at apple.com (Ted Kremenek) Date: Fri, 02 Nov 2007 18:04:21 -0000 Subject: [llvm-commits] [llvm] r43647 - /llvm/trunk/include/llvm/Bitcode/Deserialize.h Message-ID: <200711021804.lA2I4LMg027998@zion.cs.uiuc.edu> Author: kremenek Date: Fri Nov 2 13:04:20 2007 New Revision: 43647 URL: http://llvm.org/viewvc/llvm-project?rev=43647&view=rev Log: Added overloaded version of Deserializer::ReadOwnedPtr which allows the target pointer to be passed by reference. This can result in less typing, as the object to be deserialized can be inferred from the argument. Modified: llvm/trunk/include/llvm/Bitcode/Deserialize.h Modified: llvm/trunk/include/llvm/Bitcode/Deserialize.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/Deserialize.h?rev=43647&r1=43646&r2=43647&view=diff ============================================================================== --- llvm/trunk/include/llvm/Bitcode/Deserialize.h (original) +++ llvm/trunk/include/llvm/Bitcode/Deserialize.h Fri Nov 2 13:04:20 2007 @@ -125,6 +125,11 @@ } template + inline void ReadOwnedPtr(T*& Ptr) { + Ptr = ReadOwnedPtr(); + } + + template void ReadPtr(T*& PtrRef) { ReadUIntPtr(reinterpret_cast(PtrRef)); } From dalej at apple.com Fri Nov 2 15:24:03 2007 From: dalej at apple.com (Dale Johannesen) Date: Fri, 02 Nov 2007 20:24:03 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r43650 - in /llvm-gcc-4.2/trunk: configure configure.in Message-ID: <200711022024.lA2KO3uU003159@zion.cs.uiuc.edu> Author: johannes Date: Fri Nov 2 15:24:02 2007 New Revision: 43650 URL: http://llvm.org/viewvc/llvm-project?rev=43650&view=rev Log: Don't build libobjc on powerpc-darwin. (Unfortunately, this does not apply to multilibs.) Modified: llvm-gcc-4.2/trunk/configure llvm-gcc-4.2/trunk/configure.in Modified: llvm-gcc-4.2/trunk/configure URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/configure?rev=43650&r1=43649&r2=43650&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/configure (original) +++ llvm-gcc-4.2/trunk/configure Fri Nov 2 15:24:02 2007 @@ -1211,6 +1211,8 @@ powerpc-*-darwin* | i[3456789]86-*-darwin*) noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes gdb gprof" noconfigdirs="$noconfigdirs sim target-rda target-libstdc++-v3" + # LLVM LOCAL + noconfigdirs="$noconfigdirs target-libobjc" ;; *-*-darwin*) noconfigdirs="$noconfigdirs ld gas gdb gprof" @@ -1872,7 +1874,7 @@ # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1876: checking for $ac_word" >&5 +echo "configure:1878: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1902,7 +1904,7 @@ # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1906: checking for $ac_word" >&5 +echo "configure:1908: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1953,7 +1955,7 @@ # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1957: checking for $ac_word" >&5 +echo "configure:1959: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1985,7 +1987,7 @@ fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1989: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:1991: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -1996,12 +1998,12 @@ cat > conftest.$ac_ext << EOF -#line 2000 "configure" +#line 2002 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:2005: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2007: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -2027,12 +2029,12 @@ { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:2031: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:2033: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:2036: checking whether we are using GNU C" >&5 +echo "configure:2038: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2041,7 +2043,7 @@ yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2045: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2047: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -2060,7 +2062,7 @@ ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:2064: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:2066: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2127,7 +2129,7 @@ # Extract the first word of "${ac_tool_prefix}gnatbind", so it can be a program name with args. set dummy ${ac_tool_prefix}gnatbind; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2131: checking for $ac_word" >&5 +echo "configure:2133: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_GNATBIND'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2159,7 +2161,7 @@ # Extract the first word of "gnatbind", so it can be a program name with args. set dummy gnatbind; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2163: checking for $ac_word" >&5 +echo "configure:2165: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_GNATBIND'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2192,7 +2194,7 @@ fi echo $ac_n "checking whether compiler driver understands Ada""... $ac_c" 1>&6 -echo "configure:2196: checking whether compiler driver understands Ada" >&5 +echo "configure:2198: checking whether compiler driver understands Ada" >&5 if eval "test \"`echo '$''{'acx_cv_cc_gcc_supports_ada'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2224,7 +2226,7 @@ fi echo $ac_n "checking how to compare bootstrapped objects""... $ac_c" 1>&6 -echo "configure:2228: checking how to compare bootstrapped objects" >&5 +echo "configure:2230: checking how to compare bootstrapped objects" >&5 if eval "test \"`echo '$''{'gcc_cv_prog_cmp_skip'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2344,9 +2346,9 @@ CFLAGS="$CFLAGS $gmpinc" # Check GMP actually works echo $ac_n "checking for correct version of gmp.h""... $ac_c" 1>&6 -echo "configure:2348: checking for correct version of gmp.h" >&5 +echo "configure:2350: checking for correct version of gmp.h" >&5 cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2363: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6 else @@ -2370,9 +2372,9 @@ if test x"$have_gmp" = xyes; then echo $ac_n "checking for correct version of mpfr.h""... $ac_c" 1>&6 -echo "configure:2374: checking for correct version of mpfr.h" >&5 +echo "configure:2376: checking for correct version of mpfr.h" >&5 cat > conftest.$ac_ext < @@ -2384,7 +2386,7 @@ ; return 0; } EOF -if { (eval echo configure:2388: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2390: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6 else @@ -2398,9 +2400,9 @@ saved_LIBS="$LIBS" LIBS="$LIBS $gmplibs" echo $ac_n "checking for any version of mpfr.h""... $ac_c" 1>&6 -echo "configure:2402: checking for any version of mpfr.h" >&5 +echo "configure:2404: checking for any version of mpfr.h" >&5 cat > conftest.$ac_ext < #include @@ -2408,7 +2410,7 @@ mpfr_t n; mpfr_init(n); ; return 0; } EOF -if { (eval echo configure:2412: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2414: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "$ac_t""yes" 1>&6 else @@ -3519,7 +3521,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3523: checking for $ac_word" >&5 +echo "configure:3525: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3559,7 +3561,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3563: checking for $ac_word" >&5 +echo "configure:3565: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_BISON'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3598,7 +3600,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3602: checking for $ac_word" >&5 +echo "configure:3604: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_M4'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3637,7 +3639,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3641: checking for $ac_word" >&5 +echo "configure:3643: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3677,7 +3679,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3681: checking for $ac_word" >&5 +echo "configure:3683: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_FLEX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3716,7 +3718,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3720: checking for $ac_word" >&5 +echo "configure:3722: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_MAKEINFO'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3769,7 +3771,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3773: checking for $ac_word" >&5 +echo "configure:3775: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_EXPECT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3810,7 +3812,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3814: checking for $ac_word" >&5 +echo "configure:3816: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RUNTEST'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3858,7 +3860,7 @@ # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3862: checking for $ac_word" >&5 +echo "configure:3864: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3889,7 +3891,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3893: checking for $ac_word" >&5 +echo "configure:3895: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3933,7 +3935,7 @@ # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3937: checking for $ac_word" >&5 +echo "configure:3939: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3964,7 +3966,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3968: checking for $ac_word" >&5 +echo "configure:3970: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4008,7 +4010,7 @@ # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4012: checking for $ac_word" >&5 +echo "configure:4014: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4039,7 +4041,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4043: checking for $ac_word" >&5 +echo "configure:4045: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4083,7 +4085,7 @@ # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4087: checking for $ac_word" >&5 +echo "configure:4089: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4114,7 +4116,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4118: checking for $ac_word" >&5 +echo "configure:4120: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4158,7 +4160,7 @@ # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4162: checking for $ac_word" >&5 +echo "configure:4164: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LIPO'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4189,7 +4191,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4193: checking for $ac_word" >&5 +echo "configure:4195: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LIPO'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4233,7 +4235,7 @@ # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4237: checking for $ac_word" >&5 +echo "configure:4239: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_NM'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4264,7 +4266,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4268: checking for $ac_word" >&5 +echo "configure:4270: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_NM'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4308,7 +4310,7 @@ # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4312: checking for $ac_word" >&5 +echo "configure:4314: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4339,7 +4341,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4343: checking for $ac_word" >&5 +echo "configure:4345: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4378,7 +4380,7 @@ # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4382: checking for $ac_word" >&5 +echo "configure:4384: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4409,7 +4411,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4413: checking for $ac_word" >&5 +echo "configure:4415: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4448,7 +4450,7 @@ # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4452: checking for $ac_word" >&5 +echo "configure:4454: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4479,7 +4481,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4483: checking for $ac_word" >&5 +echo "configure:4485: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4523,7 +4525,7 @@ # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4527: checking for $ac_word" >&5 +echo "configure:4529: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_OBJCOPY'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4554,7 +4556,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4558: checking for $ac_word" >&5 +echo "configure:4560: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_OBJCOPY'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4598,7 +4600,7 @@ # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4602: checking for $ac_word" >&5 +echo "configure:4604: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4629,7 +4631,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4633: checking for $ac_word" >&5 +echo "configure:4635: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4693,7 +4695,7 @@ if test -n "$with_build_time_tools"; then for ncn_progname in cc gcc; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:4697: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:4699: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_CC_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -4710,7 +4712,7 @@ # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4714: checking for $ac_word" >&5 +echo "configure:4716: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4741,7 +4743,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4745: checking for $ac_word" >&5 +echo "configure:4747: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4786,7 +4788,7 @@ if test -n "$with_build_time_tools"; then for ncn_progname in c++ g++ cxx gxx; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:4790: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:4792: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_CXX_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -4803,7 +4805,7 @@ # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4807: checking for $ac_word" >&5 +echo "configure:4809: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CXX_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4834,7 +4836,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4838: checking for $ac_word" >&5 +echo "configure:4840: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CXX_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4879,7 +4881,7 @@ if test -n "$with_build_time_tools"; then for ncn_progname in gcc; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:4883: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:4885: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_GCC_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -4896,7 +4898,7 @@ # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4900: checking for $ac_word" >&5 +echo "configure:4902: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_GCC_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4927,7 +4929,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4931: checking for $ac_word" >&5 +echo "configure:4933: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_GCC_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4967,7 +4969,7 @@ if test -n "$with_build_time_tools"; then for ncn_progname in gcj; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:4971: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:4973: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_GCJ_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -4984,7 +4986,7 @@ # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4988: checking for $ac_word" >&5 +echo "configure:4990: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_GCJ_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5015,7 +5017,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5019: checking for $ac_word" >&5 +echo "configure:5021: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_GCJ_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5060,7 +5062,7 @@ if test -n "$with_build_time_tools"; then for ncn_progname in gfortran; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5064: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:5066: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_GFORTRAN_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -5077,7 +5079,7 @@ # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5081: checking for $ac_word" >&5 +echo "configure:5083: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_GFORTRAN_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5108,7 +5110,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5112: checking for $ac_word" >&5 +echo "configure:5114: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_GFORTRAN_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5217,7 +5219,7 @@ if test -z "$ac_cv_path_AR_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then echo $ac_n "checking for ar in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5221: checking for ar in $with_build_time_tools" >&5 +echo "configure:5223: checking for ar in $with_build_time_tools" >&5 if test -x $with_build_time_tools/ar; then AR_FOR_TARGET=`cd $with_build_time_tools && pwd`/ar ac_cv_path_AR_FOR_TARGET=$AR_FOR_TARGET @@ -5235,7 +5237,7 @@ # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5239: checking for $ac_word" >&5 +echo "configure:5241: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_AR_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5272,7 +5274,7 @@ if test -n "$with_build_time_tools"; then for ncn_progname in ar; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5276: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:5278: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_AR_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -5289,7 +5291,7 @@ # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5293: checking for $ac_word" >&5 +echo "configure:5295: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5320,7 +5322,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5324: checking for $ac_word" >&5 +echo "configure:5326: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5372,7 +5374,7 @@ if test -z "$ac_cv_path_AS_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then echo $ac_n "checking for as in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5376: checking for as in $with_build_time_tools" >&5 +echo "configure:5378: checking for as in $with_build_time_tools" >&5 if test -x $with_build_time_tools/as; then AS_FOR_TARGET=`cd $with_build_time_tools && pwd`/as ac_cv_path_AS_FOR_TARGET=$AS_FOR_TARGET @@ -5390,7 +5392,7 @@ # Extract the first word of "as", so it can be a program name with args. set dummy as; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5394: checking for $ac_word" >&5 +echo "configure:5396: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_AS_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5427,7 +5429,7 @@ if test -n "$with_build_time_tools"; then for ncn_progname in as; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5431: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:5433: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_AS_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -5444,7 +5446,7 @@ # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5448: checking for $ac_word" >&5 +echo "configure:5450: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AS_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5475,7 +5477,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5479: checking for $ac_word" >&5 +echo "configure:5481: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AS_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5527,7 +5529,7 @@ if test -z "$ac_cv_path_DLLTOOL_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then echo $ac_n "checking for dlltool in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5531: checking for dlltool in $with_build_time_tools" >&5 +echo "configure:5533: checking for dlltool in $with_build_time_tools" >&5 if test -x $with_build_time_tools/dlltool; then DLLTOOL_FOR_TARGET=`cd $with_build_time_tools && pwd`/dlltool ac_cv_path_DLLTOOL_FOR_TARGET=$DLLTOOL_FOR_TARGET @@ -5545,7 +5547,7 @@ # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5549: checking for $ac_word" >&5 +echo "configure:5551: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_DLLTOOL_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5582,7 +5584,7 @@ if test -n "$with_build_time_tools"; then for ncn_progname in dlltool; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5586: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:5588: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_DLLTOOL_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -5599,7 +5601,7 @@ # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5603: checking for $ac_word" >&5 +echo "configure:5605: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5630,7 +5632,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5634: checking for $ac_word" >&5 +echo "configure:5636: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5682,7 +5684,7 @@ if test -z "$ac_cv_path_LD_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then echo $ac_n "checking for ld in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5686: checking for ld in $with_build_time_tools" >&5 +echo "configure:5688: checking for ld in $with_build_time_tools" >&5 if test -x $with_build_time_tools/ld; then LD_FOR_TARGET=`cd $with_build_time_tools && pwd`/ld ac_cv_path_LD_FOR_TARGET=$LD_FOR_TARGET @@ -5700,7 +5702,7 @@ # Extract the first word of "ld", so it can be a program name with args. set dummy ld; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5704: checking for $ac_word" >&5 +echo "configure:5706: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_LD_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5737,7 +5739,7 @@ if test -n "$with_build_time_tools"; then for ncn_progname in ld; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5741: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:5743: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_LD_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -5754,7 +5756,7 @@ # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5758: checking for $ac_word" >&5 +echo "configure:5760: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LD_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5785,7 +5787,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5789: checking for $ac_word" >&5 +echo "configure:5791: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LD_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5837,7 +5839,7 @@ if test -z "$ac_cv_path_LIPO_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then echo $ac_n "checking for lipo in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5841: checking for lipo in $with_build_time_tools" >&5 +echo "configure:5843: checking for lipo in $with_build_time_tools" >&5 if test -x $with_build_time_tools/lipo; then LIPO_FOR_TARGET=`cd $with_build_time_tools && pwd`/lipo ac_cv_path_LIPO_FOR_TARGET=$LIPO_FOR_TARGET @@ -5855,7 +5857,7 @@ # Extract the first word of "lipo", so it can be a program name with args. set dummy lipo; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5859: checking for $ac_word" >&5 +echo "configure:5861: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_LIPO_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5892,7 +5894,7 @@ if test -n "$with_build_time_tools"; then for ncn_progname in lipo; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5896: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:5898: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_LIPO_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -5909,7 +5911,7 @@ # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5913: checking for $ac_word" >&5 +echo "configure:5915: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LIPO_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5940,7 +5942,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5944: checking for $ac_word" >&5 +echo "configure:5946: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LIPO_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5992,7 +5994,7 @@ if test -z "$ac_cv_path_NM_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then echo $ac_n "checking for nm in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5996: checking for nm in $with_build_time_tools" >&5 +echo "configure:5998: checking for nm in $with_build_time_tools" >&5 if test -x $with_build_time_tools/nm; then NM_FOR_TARGET=`cd $with_build_time_tools && pwd`/nm ac_cv_path_NM_FOR_TARGET=$NM_FOR_TARGET @@ -6010,7 +6012,7 @@ # Extract the first word of "nm", so it can be a program name with args. set dummy nm; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6014: checking for $ac_word" >&5 +echo "configure:6016: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_NM_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6047,7 +6049,7 @@ if test -n "$with_build_time_tools"; then for ncn_progname in nm; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:6051: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:6053: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_NM_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -6064,7 +6066,7 @@ # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6068: checking for $ac_word" >&5 +echo "configure:6070: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_NM_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6095,7 +6097,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6099: checking for $ac_word" >&5 +echo "configure:6101: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_NM_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6147,7 +6149,7 @@ if test -z "$ac_cv_path_OBJDUMP_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then echo $ac_n "checking for objdump in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:6151: checking for objdump in $with_build_time_tools" >&5 +echo "configure:6153: checking for objdump in $with_build_time_tools" >&5 if test -x $with_build_time_tools/objdump; then OBJDUMP_FOR_TARGET=`cd $with_build_time_tools && pwd`/objdump ac_cv_path_OBJDUMP_FOR_TARGET=$OBJDUMP_FOR_TARGET @@ -6165,7 +6167,7 @@ # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6169: checking for $ac_word" >&5 +echo "configure:6171: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_OBJDUMP_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6202,7 +6204,7 @@ if test -n "$with_build_time_tools"; then for ncn_progname in objdump; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:6206: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:6208: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_OBJDUMP_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -6219,7 +6221,7 @@ # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6223: checking for $ac_word" >&5 +echo "configure:6225: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6250,7 +6252,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6254: checking for $ac_word" >&5 +echo "configure:6256: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6302,7 +6304,7 @@ if test -z "$ac_cv_path_RANLIB_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then echo $ac_n "checking for ranlib in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:6306: checking for ranlib in $with_build_time_tools" >&5 +echo "configure:6308: checking for ranlib in $with_build_time_tools" >&5 if test -x $with_build_time_tools/ranlib; then RANLIB_FOR_TARGET=`cd $with_build_time_tools && pwd`/ranlib ac_cv_path_RANLIB_FOR_TARGET=$RANLIB_FOR_TARGET @@ -6320,7 +6322,7 @@ # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6324: checking for $ac_word" >&5 +echo "configure:6326: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_RANLIB_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6357,7 +6359,7 @@ if test -n "$with_build_time_tools"; then for ncn_progname in ranlib; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:6361: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:6363: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_RANLIB_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -6374,7 +6376,7 @@ # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6378: checking for $ac_word" >&5 +echo "configure:6380: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6405,7 +6407,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6409: checking for $ac_word" >&5 +echo "configure:6411: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6457,7 +6459,7 @@ if test -z "$ac_cv_path_STRIP_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then echo $ac_n "checking for strip in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:6461: checking for strip in $with_build_time_tools" >&5 +echo "configure:6463: checking for strip in $with_build_time_tools" >&5 if test -x $with_build_time_tools/strip; then STRIP_FOR_TARGET=`cd $with_build_time_tools && pwd`/strip ac_cv_path_STRIP_FOR_TARGET=$STRIP_FOR_TARGET @@ -6475,7 +6477,7 @@ # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6479: checking for $ac_word" >&5 +echo "configure:6481: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_STRIP_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6512,7 +6514,7 @@ if test -n "$with_build_time_tools"; then for ncn_progname in strip; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:6516: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:6518: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_STRIP_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -6529,7 +6531,7 @@ # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6533: checking for $ac_word" >&5 +echo "configure:6535: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6560,7 +6562,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6564: checking for $ac_word" >&5 +echo "configure:6566: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6612,7 +6614,7 @@ if test -z "$ac_cv_path_WINDRES_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then echo $ac_n "checking for windres in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:6616: checking for windres in $with_build_time_tools" >&5 +echo "configure:6618: checking for windres in $with_build_time_tools" >&5 if test -x $with_build_time_tools/windres; then WINDRES_FOR_TARGET=`cd $with_build_time_tools && pwd`/windres ac_cv_path_WINDRES_FOR_TARGET=$WINDRES_FOR_TARGET @@ -6630,7 +6632,7 @@ # Extract the first word of "windres", so it can be a program name with args. set dummy windres; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6634: checking for $ac_word" >&5 +echo "configure:6636: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_WINDRES_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6667,7 +6669,7 @@ if test -n "$with_build_time_tools"; then for ncn_progname in windres; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:6671: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:6673: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_WINDRES_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -6684,7 +6686,7 @@ # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6688: checking for $ac_word" >&5 +echo "configure:6690: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_WINDRES_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6715,7 +6717,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6719: checking for $ac_word" >&5 +echo "configure:6721: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_WINDRES_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6765,7 +6767,7 @@ RAW_CXX_FOR_TARGET="$CXX_FOR_TARGET" echo $ac_n "checking where to find the target ar""... $ac_c" 1>&6 -echo "configure:6769: checking where to find the target ar" >&5 +echo "configure:6771: checking where to find the target ar" >&5 if test "x${build}" != "x${host}" ; then if expr "x$AR_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -6798,7 +6800,7 @@ fi fi echo $ac_n "checking where to find the target as""... $ac_c" 1>&6 -echo "configure:6802: checking where to find the target as" >&5 +echo "configure:6804: checking where to find the target as" >&5 if test "x${build}" != "x${host}" ; then if expr "x$AS_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -6831,7 +6833,7 @@ fi fi echo $ac_n "checking where to find the target cc""... $ac_c" 1>&6 -echo "configure:6835: checking where to find the target cc" >&5 +echo "configure:6837: checking where to find the target cc" >&5 if test "x${build}" != "x${host}" ; then if expr "x$CC_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -6864,7 +6866,7 @@ fi fi echo $ac_n "checking where to find the target c++""... $ac_c" 1>&6 -echo "configure:6868: checking where to find the target c++" >&5 +echo "configure:6870: checking where to find the target c++" >&5 if test "x${build}" != "x${host}" ; then if expr "x$CXX_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -6900,7 +6902,7 @@ fi fi echo $ac_n "checking where to find the target c++ for libstdc++""... $ac_c" 1>&6 -echo "configure:6904: checking where to find the target c++ for libstdc++" >&5 +echo "configure:6906: checking where to find the target c++ for libstdc++" >&5 if test "x${build}" != "x${host}" ; then if expr "x$RAW_CXX_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -6936,7 +6938,7 @@ fi fi echo $ac_n "checking where to find the target dlltool""... $ac_c" 1>&6 -echo "configure:6940: checking where to find the target dlltool" >&5 +echo "configure:6942: checking where to find the target dlltool" >&5 if test "x${build}" != "x${host}" ; then if expr "x$DLLTOOL_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -6969,7 +6971,7 @@ fi fi echo $ac_n "checking where to find the target gcc""... $ac_c" 1>&6 -echo "configure:6973: checking where to find the target gcc" >&5 +echo "configure:6975: checking where to find the target gcc" >&5 if test "x${build}" != "x${host}" ; then if expr "x$GCC_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -7002,7 +7004,7 @@ fi fi echo $ac_n "checking where to find the target gcj""... $ac_c" 1>&6 -echo "configure:7006: checking where to find the target gcj" >&5 +echo "configure:7008: checking where to find the target gcj" >&5 if test "x${build}" != "x${host}" ; then if expr "x$GCJ_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -7038,7 +7040,7 @@ fi fi echo $ac_n "checking where to find the target gfortran""... $ac_c" 1>&6 -echo "configure:7042: checking where to find the target gfortran" >&5 +echo "configure:7044: checking where to find the target gfortran" >&5 if test "x${build}" != "x${host}" ; then if expr "x$GFORTRAN_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -7074,7 +7076,7 @@ fi fi echo $ac_n "checking where to find the target ld""... $ac_c" 1>&6 -echo "configure:7078: checking where to find the target ld" >&5 +echo "configure:7080: checking where to find the target ld" >&5 if test "x${build}" != "x${host}" ; then if expr "x$LD_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -7107,7 +7109,7 @@ fi fi echo $ac_n "checking where to find the target lipo""... $ac_c" 1>&6 -echo "configure:7111: checking where to find the target lipo" >&5 +echo "configure:7113: checking where to find the target lipo" >&5 if test "x${build}" != "x${host}" ; then if expr "x$LIPO_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -7130,7 +7132,7 @@ fi fi echo $ac_n "checking where to find the target nm""... $ac_c" 1>&6 -echo "configure:7134: checking where to find the target nm" >&5 +echo "configure:7136: checking where to find the target nm" >&5 if test "x${build}" != "x${host}" ; then if expr "x$NM_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -7163,7 +7165,7 @@ fi fi echo $ac_n "checking where to find the target objdump""... $ac_c" 1>&6 -echo "configure:7167: checking where to find the target objdump" >&5 +echo "configure:7169: checking where to find the target objdump" >&5 if test "x${build}" != "x${host}" ; then if expr "x$OBJDUMP_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -7196,7 +7198,7 @@ fi fi echo $ac_n "checking where to find the target ranlib""... $ac_c" 1>&6 -echo "configure:7200: checking where to find the target ranlib" >&5 +echo "configure:7202: checking where to find the target ranlib" >&5 if test "x${build}" != "x${host}" ; then if expr "x$RANLIB_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -7229,7 +7231,7 @@ fi fi echo $ac_n "checking where to find the target strip""... $ac_c" 1>&6 -echo "configure:7233: checking where to find the target strip" >&5 +echo "configure:7235: checking where to find the target strip" >&5 if test "x${build}" != "x${host}" ; then if expr "x$STRIP_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -7262,7 +7264,7 @@ fi fi echo $ac_n "checking where to find the target windres""... $ac_c" 1>&6 -echo "configure:7266: checking where to find the target windres" >&5 +echo "configure:7268: checking where to find the target windres" >&5 if test "x${build}" != "x${host}" ; then if expr "x$WINDRES_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -7323,7 +7325,7 @@ echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 -echo "configure:7327: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo "configure:7329: checking whether to enable maintainer-specific portions of Makefiles" >&5 # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then enableval="$enable_maintainer_mode" @@ -7372,9 +7374,9 @@ # Pass -fkeep-inline-functions for stage 1 if the GCC version supports it. CFLAGS="$CFLAGS -fkeep-inline-functions" echo $ac_n "checking whether -fkeep-inline-functions is supported""... $ac_c" 1>&6 -echo "configure:7376: checking whether -fkeep-inline-functions is supported" >&5 +echo "configure:7378: checking whether -fkeep-inline-functions is supported" >&5 cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7393: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6; stage1_cflags="$stage1_cflags -fkeep-inline-functions" else Modified: llvm-gcc-4.2/trunk/configure.in URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/configure.in?rev=43650&r1=43649&r2=43650&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/configure.in (original) +++ llvm-gcc-4.2/trunk/configure.in Fri Nov 2 15:24:02 2007 @@ -371,6 +371,8 @@ powerpc-*-darwin* | i[[3456789]]86-*-darwin*) noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes gdb gprof" noconfigdirs="$noconfigdirs sim target-rda target-libstdc++-v3" + # LLVM LOCAL + noconfigdirs="$noconfigdirs target-libobjc" ;; *-*-darwin*) noconfigdirs="$noconfigdirs ld gas gdb gprof" From djg at cray.com Fri Nov 2 17:22:04 2007 From: djg at cray.com (Dan Gohman) Date: Fri, 02 Nov 2007 22:22:04 -0000 Subject: [llvm-commits] [llvm] r43651 - in /llvm/trunk/lib: CodeGen/SelectionDAG/SelectionDAGISel.cpp Transforms/Utils/LowerSwitch.cpp Message-ID: <200711022222.lA2MM4iI011436@zion.cs.uiuc.edu> Author: djg Date: Fri Nov 2 17:22:02 2007 New Revision: 43651 URL: http://llvm.org/viewvc/llvm-project?rev=43651&view=rev Log: Change illegal uses of ++ to uses of STLExtra.h's next function. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp llvm/trunk/lib/Transforms/Utils/LowerSwitch.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=43651&r1=43650&r2=43651&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Fri Nov 2 17:22:02 2007 @@ -1921,7 +1921,7 @@ if (Cases.size()>=2) // Must recompute end() each iteration because it may be // invalidated by erase if we hold on to it - for (CaseItr I=Cases.begin(), J=++(Cases.begin()); J!=Cases.end(); ) { + for (CaseItr I=Cases.begin(), J=next(Cases.begin()); J!=Cases.end(); ) { int64_t nextValue = cast(J->Low)->getSExtValue(); int64_t currentValue = cast(I->High)->getSExtValue(); MachineBasicBlock* nextBB = J->BB; Modified: llvm/trunk/lib/Transforms/Utils/LowerSwitch.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LowerSwitch.cpp?rev=43651&r1=43650&r2=43651&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/LowerSwitch.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/LowerSwitch.cpp Fri Nov 2 17:22:02 2007 @@ -19,6 +19,7 @@ #include "llvm/Function.h" #include "llvm/Instructions.h" #include "llvm/Pass.h" +#include "llvm/ADT/STLExtras.h" #include "llvm/Support/Debug.h" #include "llvm/Support/Compiler.h" #include @@ -247,7 +248,7 @@ // Merge case into clusters if (Cases.size()>=2) - for (CaseItr I=Cases.begin(), J=++(Cases.begin()), E=Cases.end(); J!=E; ) { + for (CaseItr I=Cases.begin(), J=next(Cases.begin()), E=Cases.end(); J!=E; ) { int64_t nextValue = cast(J->Low)->getSExtValue(); int64_t currentValue = cast(I->High)->getSExtValue(); BasicBlock* nextBB = J->BB; From djg at cray.com Fri Nov 2 17:24:01 2007 From: djg at cray.com (Dan Gohman) Date: Fri, 02 Nov 2007 22:24:01 -0000 Subject: [llvm-commits] [llvm] r43652 - in /llvm/trunk/lib: CodeGen/SelectionDAG/SelectionDAGISel.cpp Transforms/Utils/LowerSwitch.cpp Message-ID: <200711022224.lA2MO1xw011526@zion.cs.uiuc.edu> Author: djg Date: Fri Nov 2 17:24:01 2007 New Revision: 43652 URL: http://llvm.org/viewvc/llvm-project?rev=43652&view=rev Log: Add std:: to sort calls. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp llvm/trunk/lib/Transforms/Utils/LowerSwitch.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=43652&r1=43651&r2=43652&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Fri Nov 2 17:24:01 2007 @@ -1915,7 +1915,7 @@ SI.getSuccessorValue(i), SMBB)); } - sort(Cases.begin(), Cases.end(), CaseCmp()); + std::sort(Cases.begin(), Cases.end(), CaseCmp()); // Merge case into clusters if (Cases.size()>=2) Modified: llvm/trunk/lib/Transforms/Utils/LowerSwitch.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LowerSwitch.cpp?rev=43652&r1=43651&r2=43652&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/LowerSwitch.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/LowerSwitch.cpp Fri Nov 2 17:24:01 2007 @@ -244,7 +244,7 @@ Cases.push_back(CaseRange(SI->getSuccessorValue(i), SI->getSuccessorValue(i), SI->getSuccessor(i))); - sort(Cases.begin(), Cases.end(), CaseCmp()); + std::sort(Cases.begin(), Cases.end(), CaseCmp()); // Merge case into clusters if (Cases.size()>=2) From isanbard at gmail.com Fri Nov 2 20:01:16 2007 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 03 Nov 2007 01:01:16 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r43655 - in /llvm-gcc-4.2/trunk: configure configure.in Message-ID: <200711030101.lA311GN4019683@zion.cs.uiuc.edu> Author: void Date: Fri Nov 2 20:01:16 2007 New Revision: 43655 URL: http://llvm.org/viewvc/llvm-project?rev=43655&view=rev Log: Remove the use of the "-fkeep-inline-functions" flag. LLVM inlines everything, and, because some files here use LLVM headers and those headers have inlined functions in them, keeping them non-inlined in the LLVM-GCC part results in undefined symbol problems. Modified: llvm-gcc-4.2/trunk/configure llvm-gcc-4.2/trunk/configure.in Modified: llvm-gcc-4.2/trunk/configure URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/configure?rev=43655&r1=43654&r2=43655&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/configure (original) +++ llvm-gcc-4.2/trunk/configure Fri Nov 2 20:01:16 2007 @@ -1,83 +1,740 @@ #! /bin/sh - # Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.13 -# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# Generated by GNU Autoconf 2.61. # +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + + + +# PATH needs CR +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +as_nl=' +' +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# CDPATH. +$as_unset CDPATH + + +if test "x$CONFIG_SHELL" = x; then + if (eval ":") 2>/dev/null; then + as_have_required=yes +else + as_have_required=no +fi + + if test $as_have_required = yes && (eval ": +(as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0) || { (exit 1); exit 1; } + +( + as_lineno_1=\$LINENO + as_lineno_2=\$LINENO + test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && + test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } +") 2> /dev/null; then + : +else + as_candidate_shells= + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + case $as_dir in + /*) + for as_base in sh bash ksh sh5; do + as_candidate_shells="$as_candidate_shells $as_dir/$as_base" + done;; + esac +done +IFS=$as_save_IFS + + + for as_shell in $as_candidate_shells $SHELL; do + # Try only shells that exist, to save several forks. + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { ("$as_shell") 2> /dev/null <<\_ASEOF +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + +: +_ASEOF +}; then + CONFIG_SHELL=$as_shell + as_have_required=yes + if { "$as_shell" 2> /dev/null <<\_ASEOF +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + +: +(as_func_return () { + (exit $1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = "$1" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test $exitcode = 0) || { (exit 1); exit 1; } + +( + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } + +_ASEOF +}; then + break +fi + +fi + + done + + if test "x$CONFIG_SHELL" != x; then + for as_var in BASH_ENV ENV + do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + done + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} +fi + + + if test $as_have_required = no; then + echo This script requires a shell more modern than all the + echo shells that I found on your system. Please install a + echo modern shell, or manually run the script under such a + echo shell if you do have one. + { (exit 1); exit 1; } +fi + + +fi + +fi + + + +(eval "as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0") || { + echo No shell found that supports shell functions. + echo Please tell autoconf at gnu.org about your system, + echo including any error possibly output before this + echo message +} + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # scripts with optimization help from Paolo Bonzini. Blame Lee + # E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; +esac + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir +fi +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + + +exec 7<&0 &1 -# Defaults: -ac_help= +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# ac_default_prefix=/usr/local -# Any additions from configure.in: -ac_help="$ac_help - --with-build-libsubdir=[DIR] Directory where to find libraries for build system" -ac_help="$ac_help - --enable-libada Builds libada directory" -ac_help="$ac_help - --enable-libssp Builds libssp directory" -ac_help="$ac_help - --with-mpfr-dir=PATH This option has been REMOVED" -ac_help="$ac_help - --with-mpfr=PATH Specify prefix directory for installed MPFR package - Equivalent to --with-mpfr-include=PATH/include - plus --with-mpfr-lib=PATH/lib" -ac_help="$ac_help - --with-mpfr-include=PATH - Specify directory for installed MPFR include files" -ac_help="$ac_help - --with-mpfr-lib=PATH Specify the directory for the installed MPFR library" -ac_help="$ac_help - --with-gmp-dir=PATH This option has been REMOVED" -ac_help="$ac_help - --with-gmp=PATH Specify prefix directory for the installed GMP package - Equivalent to --with-gmp-include=PATH/include - plus --with-gmp-lib=PATH/lib" -ac_help="$ac_help - --with-gmp-include=PATH Specify directory for installed GMP include files" -ac_help="$ac_help - --with-gmp-lib=PATH Specify the directory for the installed GMP library" -ac_help="$ac_help - --enable-objc-gc enable the use of Boehm's garbage collector with - the GNU Objective-C runtime." -ac_help="$ac_help - --with-build-sysroot=sysroot - use sysroot as the system root during the build" -ac_help="$ac_help - --enable-bootstrap Enable bootstrapping [yes if native build]" -ac_help="$ac_help - --enable-serial-[{host,target,build}-]configure - Force sequential configuration of - sub-packages for the host, target or build - machine, or all sub-packages" -ac_help="$ac_help - --with-build-time-tools=path - use given path to find target tools during the build" -ac_help="$ac_help - --enable-maintainer-mode enable make rules and dependencies not useful - (and sometimes confusing) to the casual installer" -ac_help="$ac_help - --enable-stage1-checking[=all] choose additional checking for stage1 - of the compiler." -ac_help="$ac_help - --enable-werror enable -Werror in bootstrap stage2 and later" -ac_help="$ac_help - --with-datarootdir Use datarootdir as the data root directory." -ac_help="$ac_help - --with-docdir Install documentation in this directory." -ac_help="$ac_help - --with-htmldir Install html in this directory." +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Identity of this package. +PACKAGE_NAME= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= + +ac_unique_file="move-if-change" +ac_subst_vars='SHELL +PATH_SEPARATOR +PACKAGE_NAME +PACKAGE_TARNAME +PACKAGE_VERSION +PACKAGE_STRING +PACKAGE_BUGREPORT +exec_prefix +prefix +program_transform_name +bindir +sbindir +libexecdir +datarootdir +datadir +sysconfdir +sharedstatedir +localstatedir +includedir +oldincludedir +docdir +infodir +htmldir +dvidir +pdfdir +psdir +libdir +localedir +mandir +DEFS +ECHO_C +ECHO_N +ECHO_T +LIBS +build_alias +host_alias +target_alias +build +build_cpu +build_vendor +build_os +host +host_cpu +host_vendor +host_os +target +target_cpu +target_vendor +target_os +INSTALL_PROGRAM +INSTALL_SCRIPT +INSTALL_DATA +LN +LN_S +TOPLEVEL_CONFIGURE_ARGUMENTS +build_libsubdir +build_subdir +host_subdir +target_subdir +CC +CFLAGS +LDFLAGS +CPPFLAGS +ac_ct_CC +EXEEXT +OBJEXT +GNATBIND +do_compare +gmplibs +gmpinc +stage1_languages +SYSROOT_CFLAGS_FOR_TARGET +RPATH_ENVVAR +tooldir +build_tooldir +CONFIGURE_GDB_TK +GDB_TK +INSTALL_GDB_TK +build_configargs +build_configdirs +host_configargs +configdirs +target_configargs +CC_FOR_BUILD +config_shell +YACC +BISON +M4 +LEX +FLEX +MAKEINFO +EXPECT +RUNTEST +AR +AS +DLLTOOL +LD +LIPO +NM +RANLIB +STRIP +WINDRES +OBJCOPY +OBJDUMP +CXX +CFLAGS_FOR_BUILD +CXXFLAGS +CC_FOR_TARGET +CXX_FOR_TARGET +GCC_FOR_TARGET +GCJ_FOR_TARGET +GFORTRAN_FOR_TARGET +AR_FOR_TARGET +AS_FOR_TARGET +DLLTOOL_FOR_TARGET +LD_FOR_TARGET +LIPO_FOR_TARGET +NM_FOR_TARGET +OBJDUMP_FOR_TARGET +RANLIB_FOR_TARGET +STRIP_FOR_TARGET +WINDRES_FOR_TARGET +FLAGS_FOR_TARGET +RAW_CXX_FOR_TARGET +COMPILER_AS_FOR_TARGET +COMPILER_LD_FOR_TARGET +COMPILER_NM_FOR_TARGET +MAINTAINER_MODE_TRUE +MAINTAINER_MODE_FALSE +MAINT +stage1_cflags +stage1_checking +stage2_werror_flag +LIBOBJS +LTLIBOBJS' +ac_subst_files='serialization_dependencies +host_makefile_frag +target_makefile_frag +alphaieee_frag +ospace_frag' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS' + # Initialize some variables set by options. +ac_init_help= +ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. -build=NONE -cache_file=./config.cache +cache_file=/dev/null exec_prefix=NONE -host=NONE no_create= -nonopt=NONE no_recursion= prefix=NONE program_prefix=NONE @@ -86,94 +743,117 @@ silent= site= srcdir= -target=NONE verbose= x_includes=NONE x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' -datadir='${prefix}/share' +datarootdir='${prefix}/share' +datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' -libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' -infodir='${prefix}/info' -mandir='${prefix}/man' - -# Initialize some other variables. -subdirs= -MFLAGS= MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} -# Maximum number of lines to put in a shell here document. -ac_max_here_lines=12 +docdir='${datarootdir}/doc/${PACKAGE}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' ac_prev= +ac_dashdash= for ac_option do - # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then - eval "$ac_prev=\$ac_option" + eval $ac_prev=\$ac_option ac_prev= continue fi - case "$ac_option" in - -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) ac_optarg= ;; + case $ac_option in + *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. - case "$ac_option" in + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir="$ac_optarg" ;; + bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) - ac_prev=build ;; + ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build="$ac_optarg" ;; + build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file="$ac_optarg" ;; + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; - -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) - datadir="$ac_optarg" ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; -disable-* | --disable-*) - ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - eval "enable_${ac_feature}=no" ;; + expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` + eval enable_$ac_feature=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; -enable-* | --enable-*) - ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; - *) ac_optarg=yes ;; - esac - eval "enable_${ac_feature}='$ac_optarg'" ;; + expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` + eval enable_$ac_feature=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ @@ -182,116 +862,77 @@ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) - exec_prefix="$ac_optarg" ;; + exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; - -help | --help | --hel | --he) - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat << EOF -Usage: configure [options] [host] -Options: [defaults in brackets after descriptions] -Configuration: - --cache-file=FILE cache test results in FILE - --help print this message - --no-create do not create output files - --quiet, --silent do not print \`checking...' messages - --version print the version of autoconf that created configure -Directory and file names: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [same as prefix] - --bindir=DIR user executables in DIR [EPREFIX/bin] - --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] - --libexecdir=DIR program executables in DIR [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data in DIR - [PREFIX/share] - --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data in DIR - [PREFIX/com] - --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] - --libdir=DIR object code libraries in DIR [EPREFIX/lib] - --includedir=DIR C header files in DIR [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] - --infodir=DIR info documentation in DIR [PREFIX/info] - --mandir=DIR man documentation in DIR [PREFIX/man] - --srcdir=DIR find the sources in DIR [configure dir or ..] - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM - run sed PROGRAM on installed program names -EOF - cat << EOF -Host type: - --build=BUILD configure for building on BUILD [BUILD=HOST] - --host=HOST configure for HOST [guessed] - --target=TARGET configure for TARGET [TARGET=HOST] -Features and packages: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --x-includes=DIR X include files are in DIR - --x-libraries=DIR X library files are in DIR -EOF - if test -n "$ac_help"; then - echo "--enable and --with options recognized:$ac_help" - fi - exit 0 ;; + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; -host | --host | --hos | --ho) - ac_prev=host ;; + ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) - host="$ac_optarg" ;; + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir="$ac_optarg" ;; + includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir="$ac_optarg" ;; + infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir="$ac_optarg" ;; + libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) - libexecdir="$ac_optarg" ;; + libexecdir=$ac_optarg ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst \ - | --locals | --local | --loca | --loc | --lo) + | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* \ - | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - localstatedir="$ac_optarg" ;; + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir="$ac_optarg" ;; + mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) + | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ @@ -305,26 +946,26 @@ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir="$ac_optarg" ;; + oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix="$ac_optarg" ;; + prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix="$ac_optarg" ;; + program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix="$ac_optarg" ;; + program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ @@ -341,7 +982,17 @@ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name="$ac_optarg" ;; + program_transform_name=$ac_optarg ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) @@ -351,7 +1002,7 @@ ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) - sbindir="$ac_optarg" ;; + sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ @@ -362,58 +1013,53 @@ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) - sharedstatedir="$ac_optarg" ;; + sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) - site="$ac_optarg" ;; + site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir="$ac_optarg" ;; + srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir="$ac_optarg" ;; + sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target ;; + ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target="$ac_optarg" ;; + target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; - -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.13" - exit 0 ;; + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; -with-* | --with-*) - ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; - *) ac_optarg=yes ;; - esac - eval "with_${ac_package}='$ac_optarg'" ;; + expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/[-.]/_/g'` + eval with_$ac_package=\$ac_optarg ;; -without-* | --without-*) - ac_package=`echo $ac_option|sed -e 's/-*without-//'` + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - eval "with_${ac_package}=no" ;; + expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/[-.]/_/g'` + eval with_$ac_package=no ;; --x) # Obsolete; use --with-x. @@ -424,287 +1070,880 @@ ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes="$ac_optarg" ;; + x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries="$ac_optarg" ;; + x_libraries=$ac_optarg ;; - -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } ;; + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + *) - if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then - echo "configure: warning: $ac_option: invalid host type" 1>&2 - fi - if test "x$nonopt" != xNONE; then - { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } - fi - nonopt="$ac_option" + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then - { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } -fi - -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -# File descriptor usage: -# 0 standard input -# 1 file creation -# 2 errors and warnings -# 3 some systems may open it to /dev/tty -# 4 used on the Kubota Titan -# 6 checking for... messages and results -# 5 compiler messages saved in config.log -if test "$silent" = yes; then - exec 6>/dev/null -else - exec 6>&1 + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } fi -exec 5>./config.log - -echo "\ -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. -" 1>&5 -# Strip out --no-create and --no-recursion so they do not pile up. -# Also quote any args containing shell metacharacters. -ac_configure_args= -for ac_arg +# Be sure to have absolute directory names. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir do - case "$ac_arg" in - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) ;; - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) - ac_configure_args="$ac_configure_args '$ac_arg'" ;; - *) ac_configure_args="$ac_configure_args $ac_arg" ;; + eval ac_val=\$$ac_var + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac + { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; } done -# NLS nuisances. -# Only set these to C if already set. These must not be set unconditionally -# because not all systems understand e.g. LANG=C (notably SCO). -# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! -# Non-C LC_CTYPE values break the ctype check. -if test "${LANG+set}" = set; then LANG=C; export LANG; fi -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi -if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi -if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + { echo "$as_me: error: Working directory cannot be determined" >&2 + { (exit 1); exit 1; }; } +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + { echo "$as_me: error: pwd does not report name of working directory" >&2 + { (exit 1); exit 1; }; } -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo > confdefs.h - -# A filename unique to this package, relative to the directory that -# configure is in, which we can look for to find out if srcdir is correct. -ac_unique_file=move-if-change # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes - # Try the directory containing this script, then its parent. - ac_prog=$0 - ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` - test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$0" || +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +echo X"$0" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` srcdir=$ac_confdir - if test ! -r $srcdir/$ac_unique_file; then + if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi -if test ! -r $srcdir/$ac_unique_file; then - if test "$ac_srcdir_defaulted" = yes; then - { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } - else - { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } - fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 + { (exit 1); exit 1; }; } + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. fi -srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures this package to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] + --target=TARGET configure for building compilers for TARGET [HOST] +_ACEOF +fi + +if test -n "$ac_init_help"; then + + cat <<\_ACEOF + +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-libada Builds libada directory + --enable-libssp Builds libssp directory + --enable-objc-gc enable the use of Boehm's garbage collector with + the GNU Objective-C runtime. + --enable-bootstrap Enable bootstrapping yes if native build + --enable-serial-{host,target,build}-configure + Force sequential configuration of + sub-packages for the host, target or build + machine, or all sub-packages + --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer + --enable-stage1-checking=all choose additional checking for stage1 + of the compiler. + --enable-werror enable -Werror in bootstrap stage2 and later + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-build-libsubdir=DIR Directory where to find libraries for build system + --with-mpfr-dir=PATH This option has been REMOVED + --with-mpfr=PATH Specify prefix directory for installed MPFR package + Equivalent to --with-mpfr-include=PATH/include + plus --with-mpfr-lib=PATH/lib + --with-mpfr-include=PATH + Specify directory for installed MPFR include files + --with-mpfr-lib=PATH Specify the directory for the installed MPFR library + --with-gmp-dir=PATH This option has been REMOVED + --with-gmp=PATH Specify prefix directory for the installed GMP package + Equivalent to --with-gmp-include=PATH/include + plus --with-gmp-lib=PATH/lib + --with-gmp-include=PATH Specify directory for installed GMP include files + --with-gmp-lib=PATH Specify the directory for the installed GMP library + --with-build-sysroot=sysroot + use sysroot as the system root during the build + --with-build-time-tools=path + use given path to find target tools during the build + --with-datarootdir Use datarootdir as the data root directory. + --with-docdir Install documentation in this directory. + --with-htmldir Install html in this directory. + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +configure +generated by GNU Autoconf 2.61 + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by $as_me, which was +generated by GNU Autoconf 2.61. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + echo "PATH: $as_dir" +done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$ac_configure_args1 '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + ac_configure_args="$ac_configure_args '$ac_arg'" + ;; + esac + done +done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 +echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + *) $as_unset $ac_var ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------------- ## +## File substitutions. ## +## ------------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi +if test -n "$CONFIG_SITE"; then + set x "$CONFIG_SITE" +elif test "x$prefix" != xNONE; then + set x "$prefix/share/config.site" "$prefix/etc/config.site" +else + set x "$ac_default_prefix/share/config.site" \ + "$ac_default_prefix/etc/config.site" fi -for ac_site_file in $CONFIG_SITE; do +shift +for ac_site_file +do if test -r "$ac_site_file"; then - echo "loading site script $ac_site_file" + { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then - echo "loading cache $cache_file" - . $cache_file + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi else - echo "creating cache $cache_file" - > $cache_file + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } fi + + + + + + + + + + + + + + + + ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -ac_exeext= -ac_objext=o -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - # Stardent Vistra SVR4 grep lacks -e, says ghazi at caip.rutgers.edu. - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_aux_dir= -for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do - if test -f $ac_dir/install-sh; then +for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do + if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break - elif test -f $ac_dir/install.sh; then + elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break fi done if test -z "$ac_aux_dir"; then - { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 +echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} + { (exit 1); exit 1; }; } fi -ac_config_guess=$ac_aux_dir/config.guess -ac_config_sub=$ac_aux_dir/config.sub -ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. - -# Do some error checking and defaulting for the host and target type. -# The inputs are: -# configure --host=HOST --target=TARGET --build=BUILD NONOPT -# -# The rules are: -# 1. You are not allowed to specify --host, --target, and nonopt at the -# same time. -# 2. Host defaults to nonopt. -# 3. If nonopt is not specified, then host defaults to the current host, -# as determined by config.guess. -# 4. Target and build default to nonopt. -# 5. If nonopt is not specified, then target and build default to host. - -# The aliases save the names the user supplied, while $host etc. -# will get canonicalized. -case $host---$target---$nonopt in -NONE---*---* | *---NONE---* | *---*---NONE) ;; -*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;; -esac +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Make sure we can run config.sub. -if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : -else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5 +echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;} + { (exit 1); exit 1; }; } + +{ echo "$as_me:$LINENO: checking build system type" >&5 +echo $ECHO_N "checking build system type... $ECHO_C" >&6; } +if test "${ac_cv_build+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` +test "x$ac_build_alias" = x && + { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 +echo "$as_me: error: cannot guess build type; you must specify one" >&2;} + { (exit 1); exit 1; }; } +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5 +echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_build" >&5 +echo "${ECHO_T}$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5 +echo "$as_me: error: invalid value of canonical build" >&2;} + { (exit 1); exit 1; }; };; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ echo "$as_me:$LINENO: checking host system type" >&5 +echo $ECHO_N "checking host system type... $ECHO_C" >&6; } +if test "${ac_cv_host+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5 +echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;} + { (exit 1); exit 1; }; } fi -echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:630: checking host system type" >&5 - -host_alias=$host -case "$host_alias" in -NONE) - case $nonopt in - NONE) - if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : - else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } - fi ;; - *) host_alias=$nonopt ;; - esac ;; -esac - -host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` -host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$ac_t""$host" 1>&6 - -echo $ac_n "checking target system type""... $ac_c" 1>&6 -echo "configure:651: checking target system type" >&5 - -target_alias=$target -case "$target_alias" in -NONE) - case $nonopt in - NONE) target_alias=$host_alias ;; - *) target_alias=$nonopt ;; - esac ;; -esac +fi +{ echo "$as_me:$LINENO: result: $ac_cv_host" >&5 +echo "${ECHO_T}$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5 +echo "$as_me: error: invalid value of canonical host" >&2;} + { (exit 1); exit 1; }; };; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + +{ echo "$as_me:$LINENO: checking target system type" >&5 +echo $ECHO_N "checking target system type... $ECHO_C" >&6; } +if test "${ac_cv_target+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "x$target_alias" = x; then + ac_cv_target=$ac_cv_host +else + ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || + { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&5 +echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&2;} + { (exit 1); exit 1; }; } +fi -target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias` -target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$ac_t""$target" 1>&6 - -echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:669: checking build system type" >&5 - -build_alias=$build -case "$build_alias" in -NONE) - case $nonopt in - NONE) build_alias=$host_alias ;; - *) build_alias=$nonopt ;; - esac ;; -esac +fi +{ echo "$as_me:$LINENO: result: $ac_cv_target" >&5 +echo "${ECHO_T}$ac_cv_target" >&6; } +case $ac_cv_target in +*-*-*) ;; +*) { { echo "$as_me:$LINENO: error: invalid value of canonical target" >&5 +echo "$as_me: error: invalid value of canonical target" >&2;} + { (exit 1); exit 1; }; };; +esac +target=$ac_cv_target +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_target +shift +target_cpu=$1 +target_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +target_os=$* +IFS=$ac_save_IFS +case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac -build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias` -build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$ac_t""$build" 1>&6 -test "$host_alias" != "$target_alias" && +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +test -n "$target_alias" && test "$program_prefix$program_suffix$program_transform_name" = \ NONENONEs,x,x, && program_prefix=${target_alias}- - -if test "$program_transform_name" = s,x,x,; then - program_transform_name= -else - # Double any \ or $. echo might interpret backslashes. - cat <<\EOF_SED > conftestsed -s,\\,\\\\,g; s,\$,$$,g -EOF_SED - program_transform_name="`echo $program_transform_name|sed -f conftestsed`" - rm -f conftestsed -fi test "$program_prefix" != NONE && - program_transform_name="s,^,${program_prefix},; $program_transform_name" + program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && - program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" - -# sed with no file args requires a program. -test "$program_transform_name" = "" && program_transform_name="s,x,x," + program_transform_name="s&\$&$program_suffix&;$program_transform_name" +# Double any \ or $. echo might interpret backslashes. +# By default was `s,x,x', remove it if useless. +cat <<\_ACEOF >conftest.sed +s/[\\$]/&&/g;s/;s,x,x,$// +_ACEOF +program_transform_name=`echo $program_transform_name | sed -f conftest.sed` +rm -f conftest.sed # Get 'install' or 'install-sh' and its variants. @@ -715,67 +1954,83 @@ # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. -echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:724: checking for a BSD compatible install" >&5 +{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; } if test -z "$INSTALL"; then -if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" - for ac_dir in $PATH; do - # Account for people who put trailing slashes in PATH elements. - case "$ac_dir/" in - /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - if test -f $ac_dir/$ac_prog; then + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && - grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : else - ac_cv_path_install="$ac_dir/$ac_prog -c" - break 2 + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 fi fi done - ;; - esac - done - IFS="$ac_save_IFS" + done + ;; +esac +done +IFS=$as_save_IFS + fi if test "${ac_cv_path_install+set}" = set; then - INSTALL="$ac_cv_path_install" + INSTALL=$ac_cv_path_install else - # As a last resort, use the slow shell script. We don't cache a - # path for INSTALL within a source directory, because that will + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is - # removed, or if the path is relative. - INSTALL="$ac_install_sh" + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh fi fi -echo "$ac_t""$INSTALL" 1>&6 +{ echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' -echo $ac_n "checking whether ln works""... $ac_c" 1>&6 -echo "configure:777: checking whether ln works" >&5 -if eval "test \"`echo '$''{'acx_cv_prog_LN'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking whether ln works" >&5 +echo $ECHO_N "checking whether ln works... $ECHO_C" >&6; } +if test "${acx_cv_prog_LN+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else rm -f conftestdata_t echo >conftestdata_f @@ -790,31 +2045,23 @@ fi if test $acx_cv_prog_LN = no; then LN="cp" - echo "$ac_t""no, using $LN" 1>&6 + { echo "$as_me:$LINENO: result: no, using $LN" >&5 +echo "${ECHO_T}no, using $LN" >&6; } else LN="$acx_cv_prog_LN" - echo "$ac_t""yes" 1>&6 + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } fi -echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:801: checking whether ln -s works" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking whether ln -s works" >&5 +echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6; } +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - rm -f conftestdata -if ln -s X conftestdata 2>/dev/null -then - rm -f conftestdata - ac_cv_prog_LN_S="ln -s" -else - ac_cv_prog_LN_S=ln -fi -fi -LN_S="$ac_cv_prog_LN_S" -if test "$ac_cv_prog_LN_S" = "ln -s"; then - echo "$ac_t""yes" 1>&6 -else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no, using $LN_S" >&5 +echo "${ECHO_T}no, using $LN_S" >&6; } fi @@ -891,11 +2138,11 @@ ### or a host dependent tool. Then put it into the appropriate list ### (library or tools, host or target), doing a dependency sort. -# Subdirs will be configured in the order listed in build_configdirs, +# Subdirs will be configured in the order listed in build_configdirs, # configdirs, or target_configdirs; see the serialization section below. -# Dependency sorting is only needed when *configuration* must be done in -# a particular order. In all cases a dependency should be specified in +# Dependency sorting is only needed when *configuration* must be done in +# a particular order. In all cases a dependency should be specified in # the Makefile, whether or not it's implicitly specified here. # Double entries in build_configdirs, configdirs, or target_configdirs may @@ -975,7 +2222,7 @@ is_cross_compiler=no else is_cross_compiler=yes -fi +fi # Find the build and target subdir names. case ${build_alias} in @@ -993,7 +2240,7 @@ *) target_noncanonical=${target_alias} ;; esac - + # post-stage1 host modules use a different CC_FOR_BUILD so, in order to # have matching libraries, they should use host libraries: Makefile.tpl # arranges to pass --with-build-libsubdir=$(HOST_SUBDIR). @@ -1005,10 +2252,10 @@ # Prefix 'build-' so this never conflicts with target_subdir. build_subdir="build-${build_noncanonical}" -# Check whether --with-build-libsubdir or --without-build-libsubdir was given. + +# Check whether --with-build-libsubdir was given. if test "${with_build_libsubdir+set}" = set; then - withval="$with_build_libsubdir" - build_libsubdir="$withval" + withval=$with_build_libsubdir; build_libsubdir="$withval" else build_libsubdir="$build_subdir" fi @@ -1022,7 +2269,7 @@ fi # No prefix. target_subdir=${target_noncanonical} - + # Skipdirs are removed silently. skipdirs= @@ -1043,7 +2290,7 @@ noconfigdirs="$noconfigdirs gas" fi -# some tools are so dependent upon X11 that if we're not building with X, +# some tools are so dependent upon X11 that if we're not building with X, # it's not even worth trying to configure, much less build, that tool. case ${with_x} in @@ -1051,13 +2298,13 @@ no) skipdirs="${skipdirs} tk itcl libgui" # We won't be able to build gdbtk without X. - enable_gdbtk=no + enable_gdbtk=no ;; *) echo "*** bad value \"${with_x}\" for -with-x flag; ignored" 1>&2 ;; esac # Some tools are only suitable for building in a "native" situation. -# Remove these if host!=target. +# Remove these if host!=target. native_only="autoconf automake libtool fileutils find gawk gettext gzip hello indent m4 rcs recode sed shellutils tar textutils uudecode wdiff target-groff guile perl time ash bash bzip2 prms gnuserv target-gperf" # Similarly, some are only suitable for cross toolchains. @@ -1095,7 +2342,7 @@ # Only spaces may be used in this macro; not newlines or tabs. unsupported_languages= -# Remove more programs from consideration, based on the host or +# Remove more programs from consideration, based on the host or # target this usually means that a port of the program doesn't # exist yet. @@ -1131,10 +2378,9 @@ esac -# Check whether --enable-libada or --disable-libada was given. +# Check whether --enable-libada was given. if test "${enable_libada+set}" = set; then - enableval="$enable_libada" - ENABLE_LIBADA=$enableval + enableval=$enable_libada; ENABLE_LIBADA=$enableval else ENABLE_LIBADA=yes fi @@ -1143,10 +2389,9 @@ noconfigdirs="$noconfigdirs gnattools" fi -# Check whether --enable-libssp or --disable-libssp was given. +# Check whether --enable-libssp was given. if test "${enable_libssp+set}" = set; then - enableval="$enable_libssp" - ENABLE_LIBSSP=$enableval + enableval=$enable_libssp; ENABLE_LIBSSP=$enableval else ENABLE_LIBSSP=yes fi @@ -1298,7 +2543,7 @@ ;; sh-*-linux*) noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss" - ;; + ;; sh*-*-pe|mips*-*-pe|*arm-wince-pe) noconfigdirs="$noconfigdirs ${libgcj}" noconfigdirs="$noconfigdirs target-examples" @@ -1461,7 +2706,7 @@ i[3456789]86-*-mingw32*) target_configdirs="$target_configdirs target-winsup" noconfigdirs="$noconfigdirs expect target-libgloss target-newlib ${libgcj}" - ;; + ;; *-*-cygwin*) target_configdirs="$target_configdirs target-libtermcap target-winsup" noconfigdirs="$noconfigdirs target-gperf target-libgloss ${libgcj}" @@ -1471,7 +2716,7 @@ elif test -d "$srcdir/newlib"; then echo "Warning: winsup/cygwin is missing so newlib can't be built." fi - ;; + ;; i[3456789]86-moss-msdos | i[3456789]86-*-moss* | \ i[3456789]86-*-uwin* | i[3456789]86-*-interix* ) ;; @@ -1650,7 +2895,7 @@ ;; *-*-lynxos*) noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}" - ;; + ;; *-*-*) noconfigdirs="$noconfigdirs ${libgcj}" ;; @@ -1871,214 +3116,791 @@ # This is all going to change when we autoconfiscate... CC_FOR_BUILD="\$(CC)" + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1878: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf at gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf at gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="gcc" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -CC="$ac_cv_prog_CC" +CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + fi fi - if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1908: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_prog_rejected=no - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift - if test $# -gt 0; then + if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift - set dummy "$ac_dir/$ac_word" "$@" - shift - ac_cv_prog_CC="$@" + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi -CC="$ac_cv_prog_CC" +CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi - if test -z "$CC"; then - case "`uname -s`" in - *win32* | *WIN32*) - # Extract the first word of "cl", so it can be a program name with args. -set dummy cl; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1959: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="cl" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -CC="$ac_cv_prog_CC" +CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi - ;; - esac + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 fi - test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1991: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf at gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf at gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi -cat > conftest.$ac_ext << EOF +fi -#line 2002 "configure" -#include "confdefs.h" -main(){return(0);} -EOF -if { (eval echo configure:2007: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - ac_cv_prog_cc_works=yes - # If we can't run a trivial program, we are probably using a cross compiler. - if (./conftest; exit) 2>/dev/null; then - ac_cv_prog_cc_cross=no +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO: checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (ac_try="$ac_compiler --version >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler --version >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -v >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -v >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -V >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -V >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; } +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +# +# List of possible output files, starting from the most likely. +# The algorithm is not robust to junk in `.', hence go to wildcards (a.*) +# only as a last resort. b.out is created by i960 compilers. +ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' +# +# The IRIX 6 linker writes into existing files which may not be +# executable, retaining their permissions. Remove them first so a +# subsequent execution test works. +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { (ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + ac_file='' +fi + +{ echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6; } +if test -z "$ac_file"; then + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext + +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; } +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no else - ac_cv_prog_cc_cross=yes + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + fi fi -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_prog_cc_works=no fi -rm -fr conftest* -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 -if test $ac_cv_prog_cc_works = no; then - { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } -fi -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:2033: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 -echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 -cross_compiling=$ac_cv_prog_cc_cross - -echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:2038: checking whether we are using GNU C" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +rm -f a.out a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; } +{ echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6; } + +{ echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; } +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done else - cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gcc=yes + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +{ echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; } +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done else - ac_cv_prog_gcc=no -fi -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -echo "$ac_t""$ac_cv_prog_gcc" 1>&6 +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif -if test $ac_cv_prog_gcc = yes; then - GCC=yes + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_compiler_gnu=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; } +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; } +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_g=yes else - GCC= -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -ac_test_CFLAGS="${CFLAGS+set}" -ac_save_CFLAGS="$CFLAGS" -CFLAGS= -echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:2066: checking whether ${CC-cc} accepts -g" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + CFLAGS="" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : else - echo 'void f(){}' > conftest.c -if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else - ac_cv_prog_cc_g=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -rm -f conftest* +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then - CFLAGS="$ac_save_CFLAGS" + CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" @@ -2092,6 +3914,126 @@ CFLAGS= fi fi +{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 +echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } +if test "${ac_cv_prog_cc_c89+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_c89=$ac_arg +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6; } ;; + xno) + { echo "$as_me:$LINENO: result: unsupported" >&5 +echo "${ECHO_T}unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; +esac + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu # We must set the default linker to the linker used by gcc for the correct @@ -2118,85 +4060,109 @@ CXXFLAGS=${CXXFLAGS-"-g -O2"} fi -if test $host != $build; then - ac_tool_prefix=${host_alias}- -else - ac_tool_prefix= -fi -# Extract the first word of "${ac_tool_prefix}gnatbind", so it can be a program name with args. +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gnatbind", so it can be a program name with args. set dummy ${ac_tool_prefix}gnatbind; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2133: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_GNATBIND'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_GNATBIND+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$GNATBIND"; then ac_cv_prog_GNATBIND="$GNATBIND" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_GNATBIND="${ac_tool_prefix}gnatbind" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_GNATBIND="${ac_tool_prefix}gnatbind" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -GNATBIND="$ac_cv_prog_GNATBIND" +GNATBIND=$ac_cv_prog_GNATBIND if test -n "$GNATBIND"; then - echo "$ac_t""$GNATBIND" 1>&6 + { echo "$as_me:$LINENO: result: $GNATBIND" >&5 +echo "${ECHO_T}$GNATBIND" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi +fi if test -z "$ac_cv_prog_GNATBIND"; then -if test -n "$ac_tool_prefix"; then + ac_ct_GNATBIND=$GNATBIND # Extract the first word of "gnatbind", so it can be a program name with args. set dummy gnatbind; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2165: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_GNATBIND'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_GNATBIND+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test -n "$GNATBIND"; then - ac_cv_prog_GNATBIND="$GNATBIND" # Let the user override the test. + if test -n "$ac_ct_GNATBIND"; then + ac_cv_prog_ac_ct_GNATBIND="$ac_ct_GNATBIND" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_GNATBIND="gnatbind" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_GNATBIND" && ac_cv_prog_GNATBIND="no" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_GNATBIND="gnatbind" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -GNATBIND="$ac_cv_prog_GNATBIND" -if test -n "$GNATBIND"; then - echo "$ac_t""$GNATBIND" 1>&6 +ac_ct_GNATBIND=$ac_cv_prog_ac_ct_GNATBIND +if test -n "$ac_ct_GNATBIND"; then + { echo "$as_me:$LINENO: result: $ac_ct_GNATBIND" >&5 +echo "${ECHO_T}$ac_ct_GNATBIND" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi + if test "x$ac_ct_GNATBIND" = x; then + GNATBIND="no" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf at gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf at gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + GNATBIND=$ac_ct_GNATBIND + fi else - GNATBIND="no" -fi + GNATBIND="$ac_cv_prog_GNATBIND" fi -echo $ac_n "checking whether compiler driver understands Ada""... $ac_c" 1>&6 -echo "configure:2198: checking whether compiler driver understands Ada" >&5 -if eval "test \"`echo '$''{'acx_cv_cc_gcc_supports_ada'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking whether compiler driver understands Ada" >&5 +echo $ECHO_N "checking whether compiler driver understands Ada... $ECHO_C" >&6; } +if test "${acx_cv_cc_gcc_supports_ada+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.adb <&6 +{ echo "$as_me:$LINENO: result: $acx_cv_cc_gcc_supports_ada" >&5 +echo "${ECHO_T}$acx_cv_cc_gcc_supports_ada" >&6; } if test x$GNATBIND != xno && test x$acx_cv_cc_gcc_supports_ada != xno; then have_gnat=yes @@ -2225,10 +4191,10 @@ have_gnat=no fi -echo $ac_n "checking how to compare bootstrapped objects""... $ac_c" 1>&6 -echo "configure:2230: checking how to compare bootstrapped objects" >&5 -if eval "test \"`echo '$''{'gcc_cv_prog_cmp_skip'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking how to compare bootstrapped objects" >&5 +echo $ECHO_N "checking how to compare bootstrapped objects... $ECHO_C" >&6; } +if test "${gcc_cv_prog_cmp_skip+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else echo abfoo >t1 echo cdfoo >t2 @@ -2250,8 +4216,8 @@ rm t1 t2 fi - -echo "$ac_t""$gcc_cv_prog_cmp_skip" 1>&6 +{ echo "$as_me:$LINENO: result: $gcc_cv_prog_cmp_skip" >&5 +echo "${ECHO_T}$gcc_cv_prog_cmp_skip" >&6; } do_compare="$gcc_cv_prog_cmp_skip" @@ -2262,30 +4228,33 @@ have_gmp=yes # Specify a location for mpfr # check for this first so it ends up on the link line before gmp. -# Check whether --with-mpfr-dir or --without-mpfr-dir was given. + +# Check whether --with-mpfr-dir was given. if test "${with_mpfr_dir+set}" = set; then - withval="$with_mpfr_dir" - { echo "configure: error: The --with-mpfr-dir=PATH option has been removed. -Use --with-mpfr=PATH or --with-mpfr-include=PATH plus --with-mpfr-lib=PATH" 1>&2; exit 1; } + withval=$with_mpfr_dir; { { echo "$as_me:$LINENO: error: The --with-mpfr-dir=PATH option has been removed. +Use --with-mpfr=PATH or --with-mpfr-include=PATH plus --with-mpfr-lib=PATH" >&5 +echo "$as_me: error: The --with-mpfr-dir=PATH option has been removed. +Use --with-mpfr=PATH or --with-mpfr-include=PATH plus --with-mpfr-lib=PATH" >&2;} + { (exit 1); exit 1; }; } fi -# Check whether --with-mpfr or --without-mpfr was given. + +# Check whether --with-mpfr was given. if test "${with_mpfr+set}" = set; then - withval="$with_mpfr" - : + withval=$with_mpfr; fi -# Check whether --with-mpfr_include or --without-mpfr_include was given. + +# Check whether --with-mpfr_include was given. if test "${with_mpfr_include+set}" = set; then - withval="$with_mpfr_include" - : + withval=$with_mpfr_include; fi -# Check whether --with-mpfr_lib or --without-mpfr_lib was given. + +# Check whether --with-mpfr_lib was given. if test "${with_mpfr_lib+set}" = set; then - withval="$with_mpfr_lib" - : + withval=$with_mpfr_lib; fi @@ -2301,32 +4270,35 @@ fi # Specify a location for gmp -# Check whether --with-gmp-dir or --without-gmp-dir was given. + +# Check whether --with-gmp-dir was given. if test "${with_gmp_dir+set}" = set; then - withval="$with_gmp_dir" - { echo "configure: error: The --with-gmp-dir=PATH option has been removed. -Use --with-gmp=PATH or --with-gmp-include=PATH plus --with-gmp-lib=PATH" 1>&2; exit 1; } + withval=$with_gmp_dir; { { echo "$as_me:$LINENO: error: The --with-gmp-dir=PATH option has been removed. +Use --with-gmp=PATH or --with-gmp-include=PATH plus --with-gmp-lib=PATH" >&5 +echo "$as_me: error: The --with-gmp-dir=PATH option has been removed. +Use --with-gmp=PATH or --with-gmp-include=PATH plus --with-gmp-lib=PATH" >&2;} + { (exit 1); exit 1; }; } fi gmplibs="$gmplibs -lgmp" -# Check whether --with-gmp or --without-gmp was given. + +# Check whether --with-gmp was given. if test "${with_gmp+set}" = set; then - withval="$with_gmp" - : + withval=$with_gmp; fi -# Check whether --with-gmp_include or --without-gmp_include was given. + +# Check whether --with-gmp_include was given. if test "${with_gmp_include+set}" = set; then - withval="$with_gmp_include" - : + withval=$with_gmp_include; fi -# Check whether --with-gmp_lib or --without-gmp_lib was given. + +# Check whether --with-gmp_lib was given. if test "${with_gmp_lib+set}" = set; then - withval="$with_gmp_lib" - : + withval=$with_gmp_lib; fi @@ -2345,81 +4317,159 @@ saved_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $gmpinc" # Check GMP actually works -echo $ac_n "checking for correct version of gmp.h""... $ac_c" 1>&6 -echo "configure:2350: checking for correct version of gmp.h" >&5 -cat > conftest.$ac_ext <&5 +echo $ECHO_N "checking for correct version of gmp.h... $ECHO_C" >&6; } + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include "gmp.h" -int main() { +int +main () +{ #if __GNU_MP_VERSION < 4 || (__GNU_MP_VERSION == 4 && __GNU_MP_VERSION_MINOR < 1) choke me #endif -; return 0; } -EOF -if { (eval echo configure:2363: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - echo "$ac_t""yes" 1>&6 -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - echo "$ac_t""no" 1>&6; have_gmp=no + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; }; have_gmp=no fi -rm -f conftest* + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test x"$have_gmp" = xyes; then - echo $ac_n "checking for correct version of mpfr.h""... $ac_c" 1>&6 -echo "configure:2376: checking for correct version of mpfr.h" >&5 - cat > conftest.$ac_ext <&5 +echo $ECHO_N "checking for correct version of mpfr.h... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include "gmp.h" #include -int main() { +int +main () +{ #if MPFR_VERSION < MPFR_VERSION_NUM(2,2,1) choke me #endif -; return 0; } -EOF -if { (eval echo configure:2390: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - echo "$ac_t""yes" 1>&6 -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - echo "$ac_t""buggy version of MPFR detected" 1>&6 + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: buggy version of MPFR detected" >&5 +echo "${ECHO_T}buggy version of MPFR detected" >&6; } fi -rm -f conftest* + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext saved_LIBS="$LIBS" LIBS="$LIBS $gmplibs" - echo $ac_n "checking for any version of mpfr.h""... $ac_c" 1>&6 -echo "configure:2404: checking for any version of mpfr.h" >&5 - cat > conftest.$ac_ext <&5 +echo $ECHO_N "checking for any version of mpfr.h... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #include -int main() { +int +main () +{ mpfr_t n; mpfr_init(n); -; return 0; } -EOF -if { (eval echo configure:2414: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - echo "$ac_t""yes" 1>&6 -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - echo "$ac_t""no" 1>&6; have_gmp=no + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; }; have_gmp=no fi -rm -f conftest* + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext LIBS="$saved_LIBS" fi CFLAGS="$saved_CFLAGS" @@ -2503,7 +4553,7 @@ # an apparent bug in bash 1.12 on linux. ${srcdir}/gcc/[*]/config-lang.in) ;; *) - # From the config-lang.in, get $language, $target_libs, + # From the config-lang.in, get $language, $target_libs, # $lang_dirs, $boot_language, and $build_by_default language= target_libs= @@ -2548,7 +4598,9 @@ case ,${enable_languages}, in *,${language},*) # Specifically requested language; tell them. - { echo "configure: error: The gcc/$i directory contains parts of $language but is missing" 1>&2; exit 1; } + { { echo "$as_me:$LINENO: error: The gcc/$i directory contains parts of $language but is missing" >&5 +echo "$as_me: error: The gcc/$i directory contains parts of $language but is missing" >&2;} + { (exit 1); exit 1; }; } ;; *) # Silently disable. @@ -2561,7 +4613,9 @@ case ,${enable_languages},:${have_gmp}:${need_gmp} in *,${language},*:no:yes) # Specifically requested language; tell them. - { echo "configure: error: GMP 4.1 and MPFR 2.2.1 or newer versions required by $language" 1>&2; exit 1; } + { { echo "$as_me:$LINENO: error: GMP 4.1 and MPFR 2.2.1 or newer versions required by $language" >&5 +echo "$as_me: error: GMP 4.1 and MPFR 2.2.1 or newer versions required by $language" >&2;} + { (exit 1); exit 1; }; } ;; *:no:yes) # Silently disable. @@ -2598,9 +4652,13 @@ missing_languages=`echo "$missing_languages" | sed -e "s/^,//" -e "s/,$//"` if test "x$missing_languages" != x; then - { echo "configure: error: + { { echo "$as_me:$LINENO: error: The following requested languages could not be built: ${missing_languages} -Recognised languages are: ${potential_languages}" 1>&2; exit 1; } +Recognised languages are: ${potential_languages}" >&5 +echo "$as_me: error: +The following requested languages could not be built: ${missing_languages} +Recognised languages are: ${potential_languages}" >&2;} + { (exit 1); exit 1; }; } fi if test "x$new_enable_languages" != "x$enable_languages"; then @@ -2619,12 +4677,13 @@ done # Check for Boehm's garbage collector -# Check whether --enable-objc-gc or --disable-objc-gc was given. +# Check whether --enable-objc-gc was given. if test "${enable_objc_gc+set}" = set; then - enableval="$enable_objc_gc" - case ,${enable_languages},:${enable_objc_gc}:${noconfigdirs} in + enableval=$enable_objc_gc; case ,${enable_languages},:${enable_objc_gc}:${noconfigdirs} in *,objc,*:*:yes:*target-boehm-gc*) - { echo "configure: error: Boehm's garbage collector was requested yet not supported in this configuration" 1>&2; exit 1; } + { { echo "$as_me:$LINENO: error: Boehm's garbage collector was requested yet not supported in this configuration" >&5 +echo "$as_me: error: Boehm's garbage collector was requested yet not supported in this configuration" >&2;} + { (exit 1); exit 1; }; } ;; esac fi @@ -2705,7 +4764,7 @@ build_configdirs_all="$build_configdirs" build_configdirs= for i in ${build_configdirs_all} ; do - j=`echo $i | sed -e s/build-//g` + j=`echo $i | sed -e s/build-//g` if test -f ${srcdir}/$j/configure ; then build_configdirs="${build_configdirs} $i" fi @@ -2722,7 +4781,7 @@ target_configdirs_all="$target_configdirs" target_configdirs= for i in ${target_configdirs_all} ; do - j=`echo $i | sed -e s/target-//g` + j=`echo $i | sed -e s/target-//g` if test -f ${srcdir}/$j/configure ; then target_configdirs="${target_configdirs} $i" fi @@ -2770,10 +4829,10 @@ copy_dirs= -# Check whether --with-build-sysroot or --without-build-sysroot was given. + +# Check whether --with-build-sysroot was given. if test "${with_build_sysroot+set}" = set; then - withval="$with_build_sysroot" - if test x"$withval" != x ; then + withval=$with_build_sysroot; if test x"$withval" != x ; then SYSROOT_CFLAGS_FOR_TARGET="--sysroot=$withval" fi else @@ -2824,11 +4883,11 @@ # This is done by determining whether or not the appropriate directory # is available, and by checking whether or not specific configurations # have requested that this magic not happen. -# -# The command line options always override the explicit settings in +# +# The command line options always override the explicit settings in # configure.in, and the settings in configure.in override this magic. # -# If the default for a toolchain is to use GNU as and ld, and you don't +# If the default for a toolchain is to use GNU as and ld, and you don't # want to do that, then you should use the --without-gnu-as and # --without-gnu-ld options for the configure script. @@ -2944,7 +5003,7 @@ target_makefile_frag="config/mt-gnu" ;; *-*-aix4.[3456789]* | *-*-aix[56789].*) - # nm and ar from AIX 4.3 and above require -X32_64 flag to all ar and nm + # nm and ar from AIX 4.3 and above require -X32_64 flag to all ar and nm # commands to handle both 32-bit and 64-bit objects. These flags are # harmless if we're using GNU nm or ar. extra_arflags_for_target=" -X32_64" @@ -3004,7 +5063,7 @@ # hpux11 in 64bit mode has libraries in a weird place. Arrange to find # them automatically. case "${host}" in - hppa*64*-*-hpux11*) + hppa*64*-*-hpux11*) extra_host_args="$extra_host_args -x-libraries=/usr/lib/pa20_64 -x-includes=/usr/X11R6/include" ;; esac @@ -3041,7 +5100,7 @@ if test -s conftest || test -s conftest.exe ; then we_are_ok=yes fi -fi +fi case $we_are_ok in no) echo 1>&2 "*** The command '${CC} -o conftest ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} conftest.c' failed." @@ -3132,10 +5191,9 @@ # to maintain later. In this particular case, you just have to be careful # not to nest @if/@endif pairs, because configure will not warn you at all. -# Check whether --enable-bootstrap or --disable-bootstrap was given. +# Check whether --enable-bootstrap was given. if test "${enable_bootstrap+set}" = set; then - enableval="$enable_bootstrap" - : + enableval=$enable_bootstrap; else enable_bootstrap=default fi @@ -3165,16 +5223,21 @@ # Other configurations, but we have a compiler. Assume the user knows # what he's doing. yes:*:*:yes) - echo "configure: warning: trying to bootstrap a cross compiler" 1>&2 + { echo "$as_me:$LINENO: WARNING: trying to bootstrap a cross compiler" >&5 +echo "$as_me: WARNING: trying to bootstrap a cross compiler" >&2;} ;; # No compiler: if they passed --enable-bootstrap explicitly, fail no:*:*:yes) - { echo "configure: error: cannot bootstrap without a compiler" 1>&2; exit 1; } ;; + { { echo "$as_me:$LINENO: error: cannot bootstrap without a compiler" >&5 +echo "$as_me: error: cannot bootstrap without a compiler" >&2;} + { (exit 1); exit 1; }; } ;; # Fail if wrong command line *) - { echo "configure: error: invalid option for --enable-bootstrap" 1>&2; exit 1; } + { { echo "$as_me:$LINENO: error: invalid option for --enable-bootstrap" >&5 +echo "$as_me: error: invalid option for --enable-bootstrap" >&2;} + { (exit 1); exit 1; }; } ;; esac @@ -3231,10 +5294,9 @@ # Create the serialization dependencies. This uses a temporary file. -# Check whether --enable-serial-configure or --disable-serial-configure was given. +# Check whether --enable-serial-configure was given. if test "${enable_serial_configure+set}" = set; then - enableval="$enable_serial_configure" - : + enableval=$enable_serial_configure; fi @@ -3311,7 +5373,7 @@ s,\$,$$,g EOF_SED sed -f conftestsed < conftestsed.out - ${ac_configure_args} + ${ac_configure_args} EOF_SED baseargs=`cat conftestsed.out` rm -f conftestsed conftestsed.out @@ -3320,7 +5382,7 @@ # --program-suffix have been applied to it. Autoconf has already # doubled dollar signs and backslashes in program_transform_name; we want # the backslashes un-doubled, and then the entire thing wrapped in single -# quotes, because this will be expanded first by make and then by the shell. +# quotes, because this will be expanded first by make and then by the shell. # Also, because we want to override the logic in subdir configure scripts to # choose program_transform_name, replace any s,x,x, with s,y,y,. sed -e "s,\\\\\\\\,\\\\,g; s,','\\\\'',g; s/s,x,x,/s,y,y,/" < conftestsed.out @@ -3518,36 +5580,44 @@ for ac_prog in 'bison -y' byacc yacc do -# Extract the first word of "$ac_prog", so it can be a program name with args. + # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3525: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_YACC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$YACC"; then ac_cv_prog_YACC="$YACC" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_YACC="$ac_prog" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_YACC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -YACC="$ac_cv_prog_YACC" +YACC=$ac_cv_prog_YACC if test -n "$YACC"; then - echo "$ac_t""$YACC" 1>&6 + { echo "$as_me:$LINENO: result: $YACC" >&5 +echo "${ECHO_T}$YACC" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi -test -n "$YACC" && break + + test -n "$YACC" && break done test -n "$YACC" || YACC="$MISSING bison -y" @@ -3558,36 +5628,44 @@ for ac_prog in bison do -# Extract the first word of "$ac_prog", so it can be a program name with args. + # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3565: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_BISON'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_BISON+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$BISON"; then ac_cv_prog_BISON="$BISON" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_BISON="$ac_prog" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_BISON="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -BISON="$ac_cv_prog_BISON" +BISON=$ac_cv_prog_BISON if test -n "$BISON"; then - echo "$ac_t""$BISON" 1>&6 + { echo "$as_me:$LINENO: result: $BISON" >&5 +echo "${ECHO_T}$BISON" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi -test -n "$BISON" && break + + test -n "$BISON" && break done test -n "$BISON" || BISON="$MISSING bison" @@ -3597,36 +5675,44 @@ for ac_prog in gm4 gnum4 m4 do -# Extract the first word of "$ac_prog", so it can be a program name with args. + # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3604: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_M4'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_M4+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$M4"; then ac_cv_prog_M4="$M4" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_M4="$ac_prog" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_M4="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -M4="$ac_cv_prog_M4" +M4=$ac_cv_prog_M4 if test -n "$M4"; then - echo "$ac_t""$M4" 1>&6 + { echo "$as_me:$LINENO: result: $M4" >&5 +echo "${ECHO_T}$M4" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi -test -n "$M4" && break + + test -n "$M4" && break done test -n "$M4" || M4="$MISSING m4" @@ -3636,36 +5722,44 @@ for ac_prog in flex lex do -# Extract the first word of "$ac_prog", so it can be a program name with args. + # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3643: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_LEX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$LEX"; then ac_cv_prog_LEX="$LEX" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_LEX="$ac_prog" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_LEX="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -LEX="$ac_cv_prog_LEX" +LEX=$ac_cv_prog_LEX if test -n "$LEX"; then - echo "$ac_t""$LEX" 1>&6 + { echo "$as_me:$LINENO: result: $LEX" >&5 +echo "${ECHO_T}$LEX" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi -test -n "$LEX" && break + + test -n "$LEX" && break done test -n "$LEX" || LEX="$MISSING flex" @@ -3676,36 +5770,44 @@ for ac_prog in flex do -# Extract the first word of "$ac_prog", so it can be a program name with args. + # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3683: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_FLEX'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_FLEX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$FLEX"; then ac_cv_prog_FLEX="$FLEX" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_FLEX="$ac_prog" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_FLEX="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -FLEX="$ac_cv_prog_FLEX" +FLEX=$ac_cv_prog_FLEX if test -n "$FLEX"; then - echo "$ac_t""$FLEX" 1>&6 + { echo "$as_me:$LINENO: result: $FLEX" >&5 +echo "${ECHO_T}$FLEX" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi -test -n "$FLEX" && break + + test -n "$FLEX" && break done test -n "$FLEX" || FLEX="$MISSING flex" @@ -3715,36 +5817,44 @@ for ac_prog in makeinfo do -# Extract the first word of "$ac_prog", so it can be a program name with args. + # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3722: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_MAKEINFO'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_MAKEINFO+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$MAKEINFO"; then ac_cv_prog_MAKEINFO="$MAKEINFO" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_MAKEINFO="$ac_prog" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_MAKEINFO="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -MAKEINFO="$ac_cv_prog_MAKEINFO" +MAKEINFO=$ac_cv_prog_MAKEINFO if test -n "$MAKEINFO"; then - echo "$ac_t""$MAKEINFO" 1>&6 + { echo "$as_me:$LINENO: result: $MAKEINFO" >&5 +echo "${ECHO_T}$MAKEINFO" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi -test -n "$MAKEINFO" && break + + test -n "$MAKEINFO" && break done test -n "$MAKEINFO" || MAKEINFO="$MISSING makeinfo" @@ -3768,36 +5878,44 @@ for ac_prog in expect do -# Extract the first word of "$ac_prog", so it can be a program name with args. + # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3775: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_EXPECT'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_EXPECT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$EXPECT"; then ac_cv_prog_EXPECT="$EXPECT" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_EXPECT="$ac_prog" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_EXPECT="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -EXPECT="$ac_cv_prog_EXPECT" +EXPECT=$ac_cv_prog_EXPECT if test -n "$EXPECT"; then - echo "$ac_t""$EXPECT" 1>&6 + { echo "$as_me:$LINENO: result: $EXPECT" >&5 +echo "${ECHO_T}$EXPECT" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi -test -n "$EXPECT" && break + + test -n "$EXPECT" && break done test -n "$EXPECT" || EXPECT="expect" @@ -3809,36 +5927,44 @@ for ac_prog in runtest do -# Extract the first word of "$ac_prog", so it can be a program name with args. + # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3816: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_RUNTEST'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_RUNTEST+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$RUNTEST"; then ac_cv_prog_RUNTEST="$RUNTEST" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_RUNTEST="$ac_prog" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_RUNTEST="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -RUNTEST="$ac_cv_prog_RUNTEST" +RUNTEST=$ac_cv_prog_RUNTEST if test -n "$RUNTEST"; then - echo "$ac_t""$RUNTEST" 1>&6 + { echo "$as_me:$LINENO: result: $RUNTEST" >&5 +echo "${ECHO_T}$RUNTEST" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi -test -n "$RUNTEST" && break + + test -n "$RUNTEST" && break done test -n "$RUNTEST" || RUNTEST="runtest" @@ -3859,64 +5985,80 @@ if test -n "$ncn_tool_prefix"; then # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3864: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_AR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_AR="${ncn_tool_prefix}${ncn_progname}" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AR="${ncn_tool_prefix}${ncn_progname}" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -AR="$ac_cv_prog_AR" +AR=$ac_cv_prog_AR if test -n "$AR"; then - echo "$ac_t""$AR" 1>&6 + { echo "$as_me:$LINENO: result: $AR" >&5 +echo "${ECHO_T}$AR" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi + fi if test -z "$ac_cv_prog_AR" && test $build = $host ; then # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3895: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_AR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_AR="${ncn_progname}" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AR="${ncn_progname}" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -AR="$ac_cv_prog_AR" +AR=$ac_cv_prog_AR if test -n "$AR"; then - echo "$ac_t""$AR" 1>&6 + { echo "$as_me:$LINENO: result: $AR" >&5 +echo "${ECHO_T}$AR" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi - + + fi test -n "$ac_cv_prog_AR" && break done @@ -3934,64 +6076,80 @@ if test -n "$ncn_tool_prefix"; then # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3939: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_AS+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AS"; then ac_cv_prog_AS="$AS" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_AS="${ncn_tool_prefix}${ncn_progname}" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AS="${ncn_tool_prefix}${ncn_progname}" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -AS="$ac_cv_prog_AS" +AS=$ac_cv_prog_AS if test -n "$AS"; then - echo "$ac_t""$AS" 1>&6 + { echo "$as_me:$LINENO: result: $AS" >&5 +echo "${ECHO_T}$AS" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi + fi if test -z "$ac_cv_prog_AS" && test $build = $host ; then # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3970: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_AS+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AS"; then ac_cv_prog_AS="$AS" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_AS="${ncn_progname}" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AS="${ncn_progname}" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -AS="$ac_cv_prog_AS" +AS=$ac_cv_prog_AS if test -n "$AS"; then - echo "$ac_t""$AS" 1>&6 + { echo "$as_me:$LINENO: result: $AS" >&5 +echo "${ECHO_T}$AS" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi - + + fi test -n "$ac_cv_prog_AS" && break done @@ -4009,64 +6167,80 @@ if test -n "$ncn_tool_prefix"; then # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4014: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_DLLTOOL+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_DLLTOOL="${ncn_tool_prefix}${ncn_progname}" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_DLLTOOL="${ncn_tool_prefix}${ncn_progname}" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -DLLTOOL="$ac_cv_prog_DLLTOOL" +DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then - echo "$ac_t""$DLLTOOL" 1>&6 + { echo "$as_me:$LINENO: result: $DLLTOOL" >&5 +echo "${ECHO_T}$DLLTOOL" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi + fi if test -z "$ac_cv_prog_DLLTOOL" && test $build = $host ; then # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4045: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_DLLTOOL+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_DLLTOOL="${ncn_progname}" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_DLLTOOL="${ncn_progname}" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -DLLTOOL="$ac_cv_prog_DLLTOOL" +DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then - echo "$ac_t""$DLLTOOL" 1>&6 + { echo "$as_me:$LINENO: result: $DLLTOOL" >&5 +echo "${ECHO_T}$DLLTOOL" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi - + + fi test -n "$ac_cv_prog_DLLTOOL" && break done @@ -4084,64 +6258,80 @@ if test -n "$ncn_tool_prefix"; then # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4089: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_LD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$LD"; then ac_cv_prog_LD="$LD" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_LD="${ncn_tool_prefix}${ncn_progname}" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_LD="${ncn_tool_prefix}${ncn_progname}" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -LD="$ac_cv_prog_LD" +LD=$ac_cv_prog_LD if test -n "$LD"; then - echo "$ac_t""$LD" 1>&6 + { echo "$as_me:$LINENO: result: $LD" >&5 +echo "${ECHO_T}$LD" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi + fi if test -z "$ac_cv_prog_LD" && test $build = $host ; then # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4120: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_LD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$LD"; then ac_cv_prog_LD="$LD" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_LD="${ncn_progname}" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_LD="${ncn_progname}" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -LD="$ac_cv_prog_LD" +LD=$ac_cv_prog_LD if test -n "$LD"; then - echo "$ac_t""$LD" 1>&6 + { echo "$as_me:$LINENO: result: $LD" >&5 +echo "${ECHO_T}$LD" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi - + + fi test -n "$ac_cv_prog_LD" && break done @@ -4159,64 +6349,80 @@ if test -n "$ncn_tool_prefix"; then # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4164: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_LIPO'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_LIPO+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$LIPO"; then ac_cv_prog_LIPO="$LIPO" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_LIPO="${ncn_tool_prefix}${ncn_progname}" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_LIPO="${ncn_tool_prefix}${ncn_progname}" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -LIPO="$ac_cv_prog_LIPO" +LIPO=$ac_cv_prog_LIPO if test -n "$LIPO"; then - echo "$ac_t""$LIPO" 1>&6 + { echo "$as_me:$LINENO: result: $LIPO" >&5 +echo "${ECHO_T}$LIPO" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi + fi if test -z "$ac_cv_prog_LIPO" && test $build = $host ; then # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4195: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_LIPO'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_LIPO+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$LIPO"; then ac_cv_prog_LIPO="$LIPO" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_LIPO="${ncn_progname}" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_LIPO="${ncn_progname}" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -LIPO="$ac_cv_prog_LIPO" +LIPO=$ac_cv_prog_LIPO if test -n "$LIPO"; then - echo "$ac_t""$LIPO" 1>&6 + { echo "$as_me:$LINENO: result: $LIPO" >&5 +echo "${ECHO_T}$LIPO" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi - + + fi test -n "$ac_cv_prog_LIPO" && break done @@ -4234,64 +6440,80 @@ if test -n "$ncn_tool_prefix"; then # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4239: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_NM'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_NM+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$NM"; then ac_cv_prog_NM="$NM" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_NM="${ncn_tool_prefix}${ncn_progname}" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_NM="${ncn_tool_prefix}${ncn_progname}" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -NM="$ac_cv_prog_NM" +NM=$ac_cv_prog_NM if test -n "$NM"; then - echo "$ac_t""$NM" 1>&6 + { echo "$as_me:$LINENO: result: $NM" >&5 +echo "${ECHO_T}$NM" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi + fi if test -z "$ac_cv_prog_NM" && test $build = $host ; then # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4270: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_NM'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_NM+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$NM"; then ac_cv_prog_NM="$NM" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_NM="${ncn_progname}" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_NM="${ncn_progname}" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -NM="$ac_cv_prog_NM" +NM=$ac_cv_prog_NM if test -n "$NM"; then - echo "$ac_t""$NM" 1>&6 + { echo "$as_me:$LINENO: result: $NM" >&5 +echo "${ECHO_T}$NM" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi - + + fi test -n "$ac_cv_prog_NM" && break done @@ -4309,64 +6531,80 @@ if test -n "$ncn_tool_prefix"; then # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4314: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_RANLIB="${ncn_tool_prefix}${ncn_progname}" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_RANLIB="${ncn_tool_prefix}${ncn_progname}" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -RANLIB="$ac_cv_prog_RANLIB" +RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then - echo "$ac_t""$RANLIB" 1>&6 + { echo "$as_me:$LINENO: result: $RANLIB" >&5 +echo "${ECHO_T}$RANLIB" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi + fi if test -z "$ac_cv_prog_RANLIB" && test $build = $host ; then # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4345: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_RANLIB="${ncn_progname}" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_RANLIB="${ncn_progname}" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -RANLIB="$ac_cv_prog_RANLIB" +RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then - echo "$ac_t""$RANLIB" 1>&6 + { echo "$as_me:$LINENO: result: $RANLIB" >&5 +echo "${ECHO_T}$RANLIB" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi - + + fi test -n "$ac_cv_prog_RANLIB" && break done @@ -4379,64 +6617,80 @@ if test -n "$ncn_tool_prefix"; then # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4384: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_STRIP="${ncn_tool_prefix}${ncn_progname}" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_STRIP="${ncn_tool_prefix}${ncn_progname}" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -STRIP="$ac_cv_prog_STRIP" +STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then - echo "$ac_t""$STRIP" 1>&6 + { echo "$as_me:$LINENO: result: $STRIP" >&5 +echo "${ECHO_T}$STRIP" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi + fi if test -z "$ac_cv_prog_STRIP" && test $build = $host ; then # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4415: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_STRIP="${ncn_progname}" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_STRIP="${ncn_progname}" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -STRIP="$ac_cv_prog_STRIP" +STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then - echo "$ac_t""$STRIP" 1>&6 + { echo "$as_me:$LINENO: result: $STRIP" >&5 +echo "${ECHO_T}$STRIP" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi - + + fi test -n "$ac_cv_prog_STRIP" && break done @@ -4449,64 +6703,80 @@ if test -n "$ncn_tool_prefix"; then # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4454: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_WINDRES+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$WINDRES"; then ac_cv_prog_WINDRES="$WINDRES" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_WINDRES="${ncn_tool_prefix}${ncn_progname}" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_WINDRES="${ncn_tool_prefix}${ncn_progname}" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -WINDRES="$ac_cv_prog_WINDRES" +WINDRES=$ac_cv_prog_WINDRES if test -n "$WINDRES"; then - echo "$ac_t""$WINDRES" 1>&6 + { echo "$as_me:$LINENO: result: $WINDRES" >&5 +echo "${ECHO_T}$WINDRES" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi + fi if test -z "$ac_cv_prog_WINDRES" && test $build = $host ; then # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4485: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_WINDRES+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$WINDRES"; then ac_cv_prog_WINDRES="$WINDRES" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_WINDRES="${ncn_progname}" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_WINDRES="${ncn_progname}" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -WINDRES="$ac_cv_prog_WINDRES" +WINDRES=$ac_cv_prog_WINDRES if test -n "$WINDRES"; then - echo "$ac_t""$WINDRES" 1>&6 + { echo "$as_me:$LINENO: result: $WINDRES" >&5 +echo "${ECHO_T}$WINDRES" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi - + + fi test -n "$ac_cv_prog_WINDRES" && break done @@ -4524,64 +6794,80 @@ if test -n "$ncn_tool_prefix"; then # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4529: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_OBJCOPY'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_OBJCOPY+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$OBJCOPY"; then ac_cv_prog_OBJCOPY="$OBJCOPY" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_OBJCOPY="${ncn_tool_prefix}${ncn_progname}" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_OBJCOPY="${ncn_tool_prefix}${ncn_progname}" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -OBJCOPY="$ac_cv_prog_OBJCOPY" +OBJCOPY=$ac_cv_prog_OBJCOPY if test -n "$OBJCOPY"; then - echo "$ac_t""$OBJCOPY" 1>&6 + { echo "$as_me:$LINENO: result: $OBJCOPY" >&5 +echo "${ECHO_T}$OBJCOPY" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi + fi if test -z "$ac_cv_prog_OBJCOPY" && test $build = $host ; then # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4560: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_OBJCOPY'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_OBJCOPY+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$OBJCOPY"; then ac_cv_prog_OBJCOPY="$OBJCOPY" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_OBJCOPY="${ncn_progname}" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_OBJCOPY="${ncn_progname}" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -OBJCOPY="$ac_cv_prog_OBJCOPY" +OBJCOPY=$ac_cv_prog_OBJCOPY if test -n "$OBJCOPY"; then - echo "$ac_t""$OBJCOPY" 1>&6 + { echo "$as_me:$LINENO: result: $OBJCOPY" >&5 +echo "${ECHO_T}$OBJCOPY" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi - + + fi test -n "$ac_cv_prog_OBJCOPY" && break done @@ -4599,64 +6885,80 @@ if test -n "$ncn_tool_prefix"; then # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4604: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_OBJDUMP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_OBJDUMP="${ncn_tool_prefix}${ncn_progname}" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_OBJDUMP="${ncn_tool_prefix}${ncn_progname}" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -OBJDUMP="$ac_cv_prog_OBJDUMP" +OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then - echo "$ac_t""$OBJDUMP" 1>&6 + { echo "$as_me:$LINENO: result: $OBJDUMP" >&5 +echo "${ECHO_T}$OBJDUMP" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi + fi if test -z "$ac_cv_prog_OBJDUMP" && test $build = $host ; then # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4635: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_OBJDUMP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_OBJDUMP="${ncn_progname}" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_OBJDUMP="${ncn_progname}" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -OBJDUMP="$ac_cv_prog_OBJDUMP" +OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then - echo "$ac_t""$OBJDUMP" 1>&6 + { echo "$as_me:$LINENO: result: $OBJDUMP" >&5 +echo "${ECHO_T}$OBJDUMP" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi - + + fi test -n "$ac_cv_prog_OBJDUMP" && break done @@ -4677,14 +6979,15 @@ # Target tools. -# Check whether --with-build-time-tools or --without-build-time-tools was given. + +# Check whether --with-build-time-tools was given. if test "${with_build_time_tools+set}" = set; then - withval="$with_build_time_tools" - case x"$withval" in + withval=$with_build_time_tools; case x"$withval" in x/*) ;; *) with_build_time_tools= - echo "configure: warning: argument to --with-build-time-tools must be an absolute path" 1>&2 + { echo "$as_me:$LINENO: WARNING: argument to --with-build-time-tools must be an absolute path" >&5 +echo "$as_me: WARNING: argument to --with-build-time-tools must be an absolute path" >&2;} ;; esac else @@ -4694,14 +6997,16 @@ if test -n "$with_build_time_tools"; then for ncn_progname in cc gcc; do - echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:4699: checking for ${ncn_progname} in $with_build_time_tools" >&5 + { echo "$as_me:$LINENO: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo $ECHO_N "checking for ${ncn_progname} in $with_build_time_tools... $ECHO_C" >&6; } if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_CC_FOR_TARGET=$with_build_time_tools/${ncn_progname} - echo "$ac_t""yes" 1>&6 + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } break else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi done fi @@ -4711,69 +7016,85 @@ if test -n "$ncn_target_tool_prefix"; then # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4716: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC_FOR_TARGET'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC_FOR_TARGET+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC_FOR_TARGET"; then ac_cv_prog_CC_FOR_TARGET="$CC_FOR_TARGET" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC_FOR_TARGET="${ncn_target_tool_prefix}${ncn_progname}" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC_FOR_TARGET="${ncn_target_tool_prefix}${ncn_progname}" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -CC_FOR_TARGET="$ac_cv_prog_CC_FOR_TARGET" +CC_FOR_TARGET=$ac_cv_prog_CC_FOR_TARGET if test -n "$CC_FOR_TARGET"; then - echo "$ac_t""$CC_FOR_TARGET" 1>&6 + { echo "$as_me:$LINENO: result: $CC_FOR_TARGET" >&5 +echo "${ECHO_T}$CC_FOR_TARGET" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi + fi if test -z "$ac_cv_prog_CC_FOR_TARGET" && test $build = $target ; then # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4747: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC_FOR_TARGET'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC_FOR_TARGET+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC_FOR_TARGET"; then ac_cv_prog_CC_FOR_TARGET="$CC_FOR_TARGET" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC_FOR_TARGET="${ncn_progname}" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC_FOR_TARGET="${ncn_progname}" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -CC_FOR_TARGET="$ac_cv_prog_CC_FOR_TARGET" +CC_FOR_TARGET=$ac_cv_prog_CC_FOR_TARGET if test -n "$CC_FOR_TARGET"; then - echo "$ac_t""$CC_FOR_TARGET" 1>&6 + { echo "$as_me:$LINENO: result: $CC_FOR_TARGET" >&5 +echo "${ECHO_T}$CC_FOR_TARGET" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi - + + fi test -n "$ac_cv_prog_CC_FOR_TARGET" && break done fi - + if test -z "$ac_cv_prog_CC_FOR_TARGET" ; then set dummy cc gcc if test $build = $target ; then @@ -4787,14 +7108,16 @@ if test -n "$with_build_time_tools"; then for ncn_progname in c++ g++ cxx gxx; do - echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:4792: checking for ${ncn_progname} in $with_build_time_tools" >&5 + { echo "$as_me:$LINENO: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo $ECHO_N "checking for ${ncn_progname} in $with_build_time_tools... $ECHO_C" >&6; } if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_CXX_FOR_TARGET=$with_build_time_tools/${ncn_progname} - echo "$ac_t""yes" 1>&6 + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } break else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi done fi @@ -4804,69 +7127,85 @@ if test -n "$ncn_target_tool_prefix"; then # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4809: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CXX_FOR_TARGET'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CXX_FOR_TARGET+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CXX_FOR_TARGET"; then ac_cv_prog_CXX_FOR_TARGET="$CXX_FOR_TARGET" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CXX_FOR_TARGET="${ncn_target_tool_prefix}${ncn_progname}" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CXX_FOR_TARGET="${ncn_target_tool_prefix}${ncn_progname}" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -CXX_FOR_TARGET="$ac_cv_prog_CXX_FOR_TARGET" +CXX_FOR_TARGET=$ac_cv_prog_CXX_FOR_TARGET if test -n "$CXX_FOR_TARGET"; then - echo "$ac_t""$CXX_FOR_TARGET" 1>&6 + { echo "$as_me:$LINENO: result: $CXX_FOR_TARGET" >&5 +echo "${ECHO_T}$CXX_FOR_TARGET" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi + fi if test -z "$ac_cv_prog_CXX_FOR_TARGET" && test $build = $target ; then # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4840: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CXX_FOR_TARGET'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CXX_FOR_TARGET+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CXX_FOR_TARGET"; then ac_cv_prog_CXX_FOR_TARGET="$CXX_FOR_TARGET" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CXX_FOR_TARGET="${ncn_progname}" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CXX_FOR_TARGET="${ncn_progname}" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -CXX_FOR_TARGET="$ac_cv_prog_CXX_FOR_TARGET" +CXX_FOR_TARGET=$ac_cv_prog_CXX_FOR_TARGET if test -n "$CXX_FOR_TARGET"; then - echo "$ac_t""$CXX_FOR_TARGET" 1>&6 + { echo "$as_me:$LINENO: result: $CXX_FOR_TARGET" >&5 +echo "${ECHO_T}$CXX_FOR_TARGET" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi - + + fi test -n "$ac_cv_prog_CXX_FOR_TARGET" && break done fi - + if test -z "$ac_cv_prog_CXX_FOR_TARGET" ; then set dummy c++ g++ cxx gxx if test $build = $target ; then @@ -4880,14 +7219,16 @@ if test -n "$with_build_time_tools"; then for ncn_progname in gcc; do - echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:4885: checking for ${ncn_progname} in $with_build_time_tools" >&5 + { echo "$as_me:$LINENO: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo $ECHO_N "checking for ${ncn_progname} in $with_build_time_tools... $ECHO_C" >&6; } if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_GCC_FOR_TARGET=$with_build_time_tools/${ncn_progname} - echo "$ac_t""yes" 1>&6 + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } break else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi done fi @@ -4897,69 +7238,85 @@ if test -n "$ncn_target_tool_prefix"; then # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4902: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_GCC_FOR_TARGET'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_GCC_FOR_TARGET+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$GCC_FOR_TARGET"; then ac_cv_prog_GCC_FOR_TARGET="$GCC_FOR_TARGET" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_GCC_FOR_TARGET="${ncn_target_tool_prefix}${ncn_progname}" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_GCC_FOR_TARGET="${ncn_target_tool_prefix}${ncn_progname}" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -GCC_FOR_TARGET="$ac_cv_prog_GCC_FOR_TARGET" +GCC_FOR_TARGET=$ac_cv_prog_GCC_FOR_TARGET if test -n "$GCC_FOR_TARGET"; then - echo "$ac_t""$GCC_FOR_TARGET" 1>&6 + { echo "$as_me:$LINENO: result: $GCC_FOR_TARGET" >&5 +echo "${ECHO_T}$GCC_FOR_TARGET" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi + fi if test -z "$ac_cv_prog_GCC_FOR_TARGET" && test $build = $target ; then # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4933: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_GCC_FOR_TARGET'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_GCC_FOR_TARGET+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$GCC_FOR_TARGET"; then ac_cv_prog_GCC_FOR_TARGET="$GCC_FOR_TARGET" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_GCC_FOR_TARGET="${ncn_progname}" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_GCC_FOR_TARGET="${ncn_progname}" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -GCC_FOR_TARGET="$ac_cv_prog_GCC_FOR_TARGET" +GCC_FOR_TARGET=$ac_cv_prog_GCC_FOR_TARGET if test -n "$GCC_FOR_TARGET"; then - echo "$ac_t""$GCC_FOR_TARGET" 1>&6 + { echo "$as_me:$LINENO: result: $GCC_FOR_TARGET" >&5 +echo "${ECHO_T}$GCC_FOR_TARGET" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi - + + fi test -n "$ac_cv_prog_GCC_FOR_TARGET" && break done fi - + if test -z "$ac_cv_prog_GCC_FOR_TARGET" ; then GCC_FOR_TARGET="${CC_FOR_TARGET}" else @@ -4968,14 +7325,16 @@ if test -n "$with_build_time_tools"; then for ncn_progname in gcj; do - echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:4973: checking for ${ncn_progname} in $with_build_time_tools" >&5 + { echo "$as_me:$LINENO: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo $ECHO_N "checking for ${ncn_progname} in $with_build_time_tools... $ECHO_C" >&6; } if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_GCJ_FOR_TARGET=$with_build_time_tools/${ncn_progname} - echo "$ac_t""yes" 1>&6 + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } break else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi done fi @@ -4985,69 +7344,85 @@ if test -n "$ncn_target_tool_prefix"; then # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4990: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_GCJ_FOR_TARGET'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_GCJ_FOR_TARGET+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$GCJ_FOR_TARGET"; then ac_cv_prog_GCJ_FOR_TARGET="$GCJ_FOR_TARGET" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_GCJ_FOR_TARGET="${ncn_target_tool_prefix}${ncn_progname}" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_GCJ_FOR_TARGET="${ncn_target_tool_prefix}${ncn_progname}" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -GCJ_FOR_TARGET="$ac_cv_prog_GCJ_FOR_TARGET" +GCJ_FOR_TARGET=$ac_cv_prog_GCJ_FOR_TARGET if test -n "$GCJ_FOR_TARGET"; then - echo "$ac_t""$GCJ_FOR_TARGET" 1>&6 + { echo "$as_me:$LINENO: result: $GCJ_FOR_TARGET" >&5 +echo "${ECHO_T}$GCJ_FOR_TARGET" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi + fi if test -z "$ac_cv_prog_GCJ_FOR_TARGET" && test $build = $target ; then # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5021: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_GCJ_FOR_TARGET'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_GCJ_FOR_TARGET+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$GCJ_FOR_TARGET"; then ac_cv_prog_GCJ_FOR_TARGET="$GCJ_FOR_TARGET" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_GCJ_FOR_TARGET="${ncn_progname}" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_GCJ_FOR_TARGET="${ncn_progname}" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -GCJ_FOR_TARGET="$ac_cv_prog_GCJ_FOR_TARGET" +GCJ_FOR_TARGET=$ac_cv_prog_GCJ_FOR_TARGET if test -n "$GCJ_FOR_TARGET"; then - echo "$ac_t""$GCJ_FOR_TARGET" 1>&6 + { echo "$as_me:$LINENO: result: $GCJ_FOR_TARGET" >&5 +echo "${ECHO_T}$GCJ_FOR_TARGET" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi - + + fi test -n "$ac_cv_prog_GCJ_FOR_TARGET" && break done fi - + if test -z "$ac_cv_prog_GCJ_FOR_TARGET" ; then set dummy gcj if test $build = $target ; then @@ -5061,14 +7436,16 @@ if test -n "$with_build_time_tools"; then for ncn_progname in gfortran; do - echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5066: checking for ${ncn_progname} in $with_build_time_tools" >&5 + { echo "$as_me:$LINENO: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo $ECHO_N "checking for ${ncn_progname} in $with_build_time_tools... $ECHO_C" >&6; } if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_GFORTRAN_FOR_TARGET=$with_build_time_tools/${ncn_progname} - echo "$ac_t""yes" 1>&6 + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } break else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi done fi @@ -5078,69 +7455,85 @@ if test -n "$ncn_target_tool_prefix"; then # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5083: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_GFORTRAN_FOR_TARGET'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_GFORTRAN_FOR_TARGET+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$GFORTRAN_FOR_TARGET"; then ac_cv_prog_GFORTRAN_FOR_TARGET="$GFORTRAN_FOR_TARGET" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_GFORTRAN_FOR_TARGET="${ncn_target_tool_prefix}${ncn_progname}" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_GFORTRAN_FOR_TARGET="${ncn_target_tool_prefix}${ncn_progname}" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -GFORTRAN_FOR_TARGET="$ac_cv_prog_GFORTRAN_FOR_TARGET" +GFORTRAN_FOR_TARGET=$ac_cv_prog_GFORTRAN_FOR_TARGET if test -n "$GFORTRAN_FOR_TARGET"; then - echo "$ac_t""$GFORTRAN_FOR_TARGET" 1>&6 + { echo "$as_me:$LINENO: result: $GFORTRAN_FOR_TARGET" >&5 +echo "${ECHO_T}$GFORTRAN_FOR_TARGET" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi + fi if test -z "$ac_cv_prog_GFORTRAN_FOR_TARGET" && test $build = $target ; then # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5114: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_GFORTRAN_FOR_TARGET'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_GFORTRAN_FOR_TARGET+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$GFORTRAN_FOR_TARGET"; then ac_cv_prog_GFORTRAN_FOR_TARGET="$GFORTRAN_FOR_TARGET" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_GFORTRAN_FOR_TARGET="${ncn_progname}" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_GFORTRAN_FOR_TARGET="${ncn_progname}" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -GFORTRAN_FOR_TARGET="$ac_cv_prog_GFORTRAN_FOR_TARGET" +GFORTRAN_FOR_TARGET=$ac_cv_prog_GFORTRAN_FOR_TARGET if test -n "$GFORTRAN_FOR_TARGET"; then - echo "$ac_t""$GFORTRAN_FOR_TARGET" 1>&6 + { echo "$as_me:$LINENO: result: $GFORTRAN_FOR_TARGET" >&5 +echo "${ECHO_T}$GFORTRAN_FOR_TARGET" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi - + + fi test -n "$ac_cv_prog_GFORTRAN_FOR_TARGET" && break done fi - + if test -z "$ac_cv_prog_GFORTRAN_FOR_TARGET" ; then set dummy gfortran if test $build = $target ; then @@ -5162,7 +7555,7 @@ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else - PATH_SEPARATOR=: + PATH_SEPARATOR=: fi rm -f conf$$.sh fi @@ -5218,14 +7611,16 @@ if test -z "$ac_cv_path_AR_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then - echo $ac_n "checking for ar in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5223: checking for ar in $with_build_time_tools" >&5 + { echo "$as_me:$LINENO: checking for ar in $with_build_time_tools" >&5 +echo $ECHO_N "checking for ar in $with_build_time_tools... $ECHO_C" >&6; } if test -x $with_build_time_tools/ar; then AR_FOR_TARGET=`cd $with_build_time_tools && pwd`/ar ac_cv_path_AR_FOR_TARGET=$AR_FOR_TARGET - echo "$ac_t""$ac_cv_path_AR_FOR_TARGET" 1>&6 + { echo "$as_me:$LINENO: result: $ac_cv_path_AR_FOR_TARGET" >&5 +echo "${ECHO_T}$ac_cv_path_AR_FOR_TARGET" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi elif test $build != $host && test $have_gcc_for_target = yes; then AR_FOR_TARGET=`$GCC_FOR_TARGET --print-prog-name=ar` @@ -5236,51 +7631,58 @@ if test -z "$ac_cv_path_AR_FOR_TARGET" ; then # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5241: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_AR_FOR_TARGET'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_AR_FOR_TARGET+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - case "$AR_FOR_TARGET" in - /*) + case $AR_FOR_TARGET in + [\\/]* | ?:[\\/]*) ac_cv_path_AR_FOR_TARGET="$AR_FOR_TARGET" # Let the user override the test with a path. ;; - ?:/*) - ac_cv_path_AR_FOR_TARGET="$AR_FOR_TARGET" # Let the user override the test with a dos path. - ;; *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$gcc_cv_tool_dirs" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_path_AR_FOR_TARGET="$ac_dir/$ac_word" - break - fi - done - IFS="$ac_save_ifs" + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $gcc_cv_tool_dirs +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_AR_FOR_TARGET="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + ;; esac fi -AR_FOR_TARGET="$ac_cv_path_AR_FOR_TARGET" +AR_FOR_TARGET=$ac_cv_path_AR_FOR_TARGET if test -n "$AR_FOR_TARGET"; then - echo "$ac_t""$AR_FOR_TARGET" 1>&6 + { echo "$as_me:$LINENO: result: $AR_FOR_TARGET" >&5 +echo "${ECHO_T}$AR_FOR_TARGET" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi + fi if test -z "$ac_cv_path_AR_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then for ncn_progname in ar; do - echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5278: checking for ${ncn_progname} in $with_build_time_tools" >&5 + { echo "$as_me:$LINENO: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo $ECHO_N "checking for ${ncn_progname} in $with_build_time_tools... $ECHO_C" >&6; } if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_AR_FOR_TARGET=$with_build_time_tools/${ncn_progname} - echo "$ac_t""yes" 1>&6 + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } break else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi done fi @@ -5290,69 +7692,85 @@ if test -n "$ncn_target_tool_prefix"; then # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5295: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_AR_FOR_TARGET'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_AR_FOR_TARGET+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AR_FOR_TARGET"; then ac_cv_prog_AR_FOR_TARGET="$AR_FOR_TARGET" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_AR_FOR_TARGET="${ncn_target_tool_prefix}${ncn_progname}" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AR_FOR_TARGET="${ncn_target_tool_prefix}${ncn_progname}" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -AR_FOR_TARGET="$ac_cv_prog_AR_FOR_TARGET" +AR_FOR_TARGET=$ac_cv_prog_AR_FOR_TARGET if test -n "$AR_FOR_TARGET"; then - echo "$ac_t""$AR_FOR_TARGET" 1>&6 + { echo "$as_me:$LINENO: result: $AR_FOR_TARGET" >&5 +echo "${ECHO_T}$AR_FOR_TARGET" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi + fi if test -z "$ac_cv_prog_AR_FOR_TARGET" && test $build = $target ; then # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5326: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_AR_FOR_TARGET'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_AR_FOR_TARGET+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AR_FOR_TARGET"; then ac_cv_prog_AR_FOR_TARGET="$AR_FOR_TARGET" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_AR_FOR_TARGET="${ncn_progname}" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AR_FOR_TARGET="${ncn_progname}" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -AR_FOR_TARGET="$ac_cv_prog_AR_FOR_TARGET" +AR_FOR_TARGET=$ac_cv_prog_AR_FOR_TARGET if test -n "$AR_FOR_TARGET"; then - echo "$ac_t""$AR_FOR_TARGET" 1>&6 + { echo "$as_me:$LINENO: result: $AR_FOR_TARGET" >&5 +echo "${ECHO_T}$AR_FOR_TARGET" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi - + + fi test -n "$ac_cv_prog_AR_FOR_TARGET" && break done fi - + if test -z "$ac_cv_prog_AR_FOR_TARGET" ; then set dummy ar if test $build = $target ; then @@ -5373,14 +7791,16 @@ if test -z "$ac_cv_path_AS_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then - echo $ac_n "checking for as in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5378: checking for as in $with_build_time_tools" >&5 + { echo "$as_me:$LINENO: checking for as in $with_build_time_tools" >&5 +echo $ECHO_N "checking for as in $with_build_time_tools... $ECHO_C" >&6; } if test -x $with_build_time_tools/as; then AS_FOR_TARGET=`cd $with_build_time_tools && pwd`/as ac_cv_path_AS_FOR_TARGET=$AS_FOR_TARGET - echo "$ac_t""$ac_cv_path_AS_FOR_TARGET" 1>&6 + { echo "$as_me:$LINENO: result: $ac_cv_path_AS_FOR_TARGET" >&5 +echo "${ECHO_T}$ac_cv_path_AS_FOR_TARGET" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi elif test $build != $host && test $have_gcc_for_target = yes; then AS_FOR_TARGET=`$GCC_FOR_TARGET --print-prog-name=as` @@ -5391,51 +7811,58 @@ if test -z "$ac_cv_path_AS_FOR_TARGET" ; then # Extract the first word of "as", so it can be a program name with args. set dummy as; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5396: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_AS_FOR_TARGET'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_AS_FOR_TARGET+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - case "$AS_FOR_TARGET" in - /*) + case $AS_FOR_TARGET in + [\\/]* | ?:[\\/]*) ac_cv_path_AS_FOR_TARGET="$AS_FOR_TARGET" # Let the user override the test with a path. ;; - ?:/*) - ac_cv_path_AS_FOR_TARGET="$AS_FOR_TARGET" # Let the user override the test with a dos path. - ;; *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$gcc_cv_tool_dirs" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_path_AS_FOR_TARGET="$ac_dir/$ac_word" - break - fi - done - IFS="$ac_save_ifs" + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $gcc_cv_tool_dirs +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_AS_FOR_TARGET="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + ;; esac fi -AS_FOR_TARGET="$ac_cv_path_AS_FOR_TARGET" +AS_FOR_TARGET=$ac_cv_path_AS_FOR_TARGET if test -n "$AS_FOR_TARGET"; then - echo "$ac_t""$AS_FOR_TARGET" 1>&6 + { echo "$as_me:$LINENO: result: $AS_FOR_TARGET" >&5 +echo "${ECHO_T}$AS_FOR_TARGET" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi + fi if test -z "$ac_cv_path_AS_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then for ncn_progname in as; do - echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5433: checking for ${ncn_progname} in $with_build_time_tools" >&5 + { echo "$as_me:$LINENO: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo $ECHO_N "checking for ${ncn_progname} in $with_build_time_tools... $ECHO_C" >&6; } if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_AS_FOR_TARGET=$with_build_time_tools/${ncn_progname} - echo "$ac_t""yes" 1>&6 + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } break else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi done fi @@ -5445,69 +7872,85 @@ if test -n "$ncn_target_tool_prefix"; then # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5450: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_AS_FOR_TARGET'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_AS_FOR_TARGET+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AS_FOR_TARGET"; then ac_cv_prog_AS_FOR_TARGET="$AS_FOR_TARGET" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_AS_FOR_TARGET="${ncn_target_tool_prefix}${ncn_progname}" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AS_FOR_TARGET="${ncn_target_tool_prefix}${ncn_progname}" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -AS_FOR_TARGET="$ac_cv_prog_AS_FOR_TARGET" +AS_FOR_TARGET=$ac_cv_prog_AS_FOR_TARGET if test -n "$AS_FOR_TARGET"; then - echo "$ac_t""$AS_FOR_TARGET" 1>&6 + { echo "$as_me:$LINENO: result: $AS_FOR_TARGET" >&5 +echo "${ECHO_T}$AS_FOR_TARGET" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi + fi if test -z "$ac_cv_prog_AS_FOR_TARGET" && test $build = $target ; then # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5481: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_AS_FOR_TARGET'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_AS_FOR_TARGET+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AS_FOR_TARGET"; then ac_cv_prog_AS_FOR_TARGET="$AS_FOR_TARGET" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_AS_FOR_TARGET="${ncn_progname}" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AS_FOR_TARGET="${ncn_progname}" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -AS_FOR_TARGET="$ac_cv_prog_AS_FOR_TARGET" +AS_FOR_TARGET=$ac_cv_prog_AS_FOR_TARGET if test -n "$AS_FOR_TARGET"; then - echo "$ac_t""$AS_FOR_TARGET" 1>&6 + { echo "$as_me:$LINENO: result: $AS_FOR_TARGET" >&5 +echo "${ECHO_T}$AS_FOR_TARGET" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi - + + fi test -n "$ac_cv_prog_AS_FOR_TARGET" && break done fi - + if test -z "$ac_cv_prog_AS_FOR_TARGET" ; then set dummy as if test $build = $target ; then @@ -5528,14 +7971,16 @@ if test -z "$ac_cv_path_DLLTOOL_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then - echo $ac_n "checking for dlltool in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5533: checking for dlltool in $with_build_time_tools" >&5 + { echo "$as_me:$LINENO: checking for dlltool in $with_build_time_tools" >&5 +echo $ECHO_N "checking for dlltool in $with_build_time_tools... $ECHO_C" >&6; } if test -x $with_build_time_tools/dlltool; then DLLTOOL_FOR_TARGET=`cd $with_build_time_tools && pwd`/dlltool ac_cv_path_DLLTOOL_FOR_TARGET=$DLLTOOL_FOR_TARGET - echo "$ac_t""$ac_cv_path_DLLTOOL_FOR_TARGET" 1>&6 + { echo "$as_me:$LINENO: result: $ac_cv_path_DLLTOOL_FOR_TARGET" >&5 +echo "${ECHO_T}$ac_cv_path_DLLTOOL_FOR_TARGET" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi elif test $build != $host && test $have_gcc_for_target = yes; then DLLTOOL_FOR_TARGET=`$GCC_FOR_TARGET --print-prog-name=dlltool` @@ -5546,51 +7991,58 @@ if test -z "$ac_cv_path_DLLTOOL_FOR_TARGET" ; then # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5551: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_DLLTOOL_FOR_TARGET'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_DLLTOOL_FOR_TARGET+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - case "$DLLTOOL_FOR_TARGET" in - /*) + case $DLLTOOL_FOR_TARGET in + [\\/]* | ?:[\\/]*) ac_cv_path_DLLTOOL_FOR_TARGET="$DLLTOOL_FOR_TARGET" # Let the user override the test with a path. ;; - ?:/*) - ac_cv_path_DLLTOOL_FOR_TARGET="$DLLTOOL_FOR_TARGET" # Let the user override the test with a dos path. - ;; *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$gcc_cv_tool_dirs" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_path_DLLTOOL_FOR_TARGET="$ac_dir/$ac_word" - break - fi - done - IFS="$ac_save_ifs" + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $gcc_cv_tool_dirs +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_DLLTOOL_FOR_TARGET="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + ;; esac fi -DLLTOOL_FOR_TARGET="$ac_cv_path_DLLTOOL_FOR_TARGET" +DLLTOOL_FOR_TARGET=$ac_cv_path_DLLTOOL_FOR_TARGET if test -n "$DLLTOOL_FOR_TARGET"; then - echo "$ac_t""$DLLTOOL_FOR_TARGET" 1>&6 + { echo "$as_me:$LINENO: result: $DLLTOOL_FOR_TARGET" >&5 +echo "${ECHO_T}$DLLTOOL_FOR_TARGET" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi + fi if test -z "$ac_cv_path_DLLTOOL_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then for ncn_progname in dlltool; do - echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5588: checking for ${ncn_progname} in $with_build_time_tools" >&5 + { echo "$as_me:$LINENO: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo $ECHO_N "checking for ${ncn_progname} in $with_build_time_tools... $ECHO_C" >&6; } if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_DLLTOOL_FOR_TARGET=$with_build_time_tools/${ncn_progname} - echo "$ac_t""yes" 1>&6 + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } break else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi done fi @@ -5600,69 +8052,85 @@ if test -n "$ncn_target_tool_prefix"; then # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5605: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL_FOR_TARGET'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_DLLTOOL_FOR_TARGET+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$DLLTOOL_FOR_TARGET"; then ac_cv_prog_DLLTOOL_FOR_TARGET="$DLLTOOL_FOR_TARGET" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_DLLTOOL_FOR_TARGET="${ncn_target_tool_prefix}${ncn_progname}" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_DLLTOOL_FOR_TARGET="${ncn_target_tool_prefix}${ncn_progname}" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -DLLTOOL_FOR_TARGET="$ac_cv_prog_DLLTOOL_FOR_TARGET" +DLLTOOL_FOR_TARGET=$ac_cv_prog_DLLTOOL_FOR_TARGET if test -n "$DLLTOOL_FOR_TARGET"; then - echo "$ac_t""$DLLTOOL_FOR_TARGET" 1>&6 + { echo "$as_me:$LINENO: result: $DLLTOOL_FOR_TARGET" >&5 +echo "${ECHO_T}$DLLTOOL_FOR_TARGET" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi + fi if test -z "$ac_cv_prog_DLLTOOL_FOR_TARGET" && test $build = $target ; then # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5636: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL_FOR_TARGET'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_DLLTOOL_FOR_TARGET+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$DLLTOOL_FOR_TARGET"; then ac_cv_prog_DLLTOOL_FOR_TARGET="$DLLTOOL_FOR_TARGET" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_DLLTOOL_FOR_TARGET="${ncn_progname}" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_DLLTOOL_FOR_TARGET="${ncn_progname}" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -DLLTOOL_FOR_TARGET="$ac_cv_prog_DLLTOOL_FOR_TARGET" +DLLTOOL_FOR_TARGET=$ac_cv_prog_DLLTOOL_FOR_TARGET if test -n "$DLLTOOL_FOR_TARGET"; then - echo "$ac_t""$DLLTOOL_FOR_TARGET" 1>&6 + { echo "$as_me:$LINENO: result: $DLLTOOL_FOR_TARGET" >&5 +echo "${ECHO_T}$DLLTOOL_FOR_TARGET" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi - + + fi test -n "$ac_cv_prog_DLLTOOL_FOR_TARGET" && break done fi - + if test -z "$ac_cv_prog_DLLTOOL_FOR_TARGET" ; then set dummy dlltool if test $build = $target ; then @@ -5683,14 +8151,16 @@ if test -z "$ac_cv_path_LD_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then - echo $ac_n "checking for ld in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5688: checking for ld in $with_build_time_tools" >&5 + { echo "$as_me:$LINENO: checking for ld in $with_build_time_tools" >&5 +echo $ECHO_N "checking for ld in $with_build_time_tools... $ECHO_C" >&6; } if test -x $with_build_time_tools/ld; then LD_FOR_TARGET=`cd $with_build_time_tools && pwd`/ld ac_cv_path_LD_FOR_TARGET=$LD_FOR_TARGET - echo "$ac_t""$ac_cv_path_LD_FOR_TARGET" 1>&6 + { echo "$as_me:$LINENO: result: $ac_cv_path_LD_FOR_TARGET" >&5 +echo "${ECHO_T}$ac_cv_path_LD_FOR_TARGET" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi elif test $build != $host && test $have_gcc_for_target = yes; then LD_FOR_TARGET=`$GCC_FOR_TARGET --print-prog-name=ld` @@ -5701,51 +8171,58 @@ if test -z "$ac_cv_path_LD_FOR_TARGET" ; then # Extract the first word of "ld", so it can be a program name with args. set dummy ld; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5706: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_LD_FOR_TARGET'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_LD_FOR_TARGET+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - case "$LD_FOR_TARGET" in - /*) + case $LD_FOR_TARGET in + [\\/]* | ?:[\\/]*) ac_cv_path_LD_FOR_TARGET="$LD_FOR_TARGET" # Let the user override the test with a path. ;; - ?:/*) - ac_cv_path_LD_FOR_TARGET="$LD_FOR_TARGET" # Let the user override the test with a dos path. - ;; *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$gcc_cv_tool_dirs" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_path_LD_FOR_TARGET="$ac_dir/$ac_word" - break - fi - done - IFS="$ac_save_ifs" + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $gcc_cv_tool_dirs +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_LD_FOR_TARGET="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + ;; esac fi -LD_FOR_TARGET="$ac_cv_path_LD_FOR_TARGET" +LD_FOR_TARGET=$ac_cv_path_LD_FOR_TARGET if test -n "$LD_FOR_TARGET"; then - echo "$ac_t""$LD_FOR_TARGET" 1>&6 + { echo "$as_me:$LINENO: result: $LD_FOR_TARGET" >&5 +echo "${ECHO_T}$LD_FOR_TARGET" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi + fi if test -z "$ac_cv_path_LD_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then for ncn_progname in ld; do - echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5743: checking for ${ncn_progname} in $with_build_time_tools" >&5 + { echo "$as_me:$LINENO: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo $ECHO_N "checking for ${ncn_progname} in $with_build_time_tools... $ECHO_C" >&6; } if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_LD_FOR_TARGET=$with_build_time_tools/${ncn_progname} - echo "$ac_t""yes" 1>&6 + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } break else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi done fi @@ -5755,69 +8232,85 @@ if test -n "$ncn_target_tool_prefix"; then # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5760: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_LD_FOR_TARGET'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_LD_FOR_TARGET+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$LD_FOR_TARGET"; then ac_cv_prog_LD_FOR_TARGET="$LD_FOR_TARGET" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_LD_FOR_TARGET="${ncn_target_tool_prefix}${ncn_progname}" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_LD_FOR_TARGET="${ncn_target_tool_prefix}${ncn_progname}" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -LD_FOR_TARGET="$ac_cv_prog_LD_FOR_TARGET" +LD_FOR_TARGET=$ac_cv_prog_LD_FOR_TARGET if test -n "$LD_FOR_TARGET"; then - echo "$ac_t""$LD_FOR_TARGET" 1>&6 + { echo "$as_me:$LINENO: result: $LD_FOR_TARGET" >&5 +echo "${ECHO_T}$LD_FOR_TARGET" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi + fi if test -z "$ac_cv_prog_LD_FOR_TARGET" && test $build = $target ; then # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5791: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_LD_FOR_TARGET'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_LD_FOR_TARGET+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$LD_FOR_TARGET"; then ac_cv_prog_LD_FOR_TARGET="$LD_FOR_TARGET" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_LD_FOR_TARGET="${ncn_progname}" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_LD_FOR_TARGET="${ncn_progname}" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -LD_FOR_TARGET="$ac_cv_prog_LD_FOR_TARGET" +LD_FOR_TARGET=$ac_cv_prog_LD_FOR_TARGET if test -n "$LD_FOR_TARGET"; then - echo "$ac_t""$LD_FOR_TARGET" 1>&6 + { echo "$as_me:$LINENO: result: $LD_FOR_TARGET" >&5 +echo "${ECHO_T}$LD_FOR_TARGET" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi - + + fi test -n "$ac_cv_prog_LD_FOR_TARGET" && break done fi - + if test -z "$ac_cv_prog_LD_FOR_TARGET" ; then set dummy ld if test $build = $target ; then @@ -5838,14 +8331,16 @@ if test -z "$ac_cv_path_LIPO_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then - echo $ac_n "checking for lipo in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5843: checking for lipo in $with_build_time_tools" >&5 + { echo "$as_me:$LINENO: checking for lipo in $with_build_time_tools" >&5 +echo $ECHO_N "checking for lipo in $with_build_time_tools... $ECHO_C" >&6; } if test -x $with_build_time_tools/lipo; then LIPO_FOR_TARGET=`cd $with_build_time_tools && pwd`/lipo ac_cv_path_LIPO_FOR_TARGET=$LIPO_FOR_TARGET - echo "$ac_t""$ac_cv_path_LIPO_FOR_TARGET" 1>&6 + { echo "$as_me:$LINENO: result: $ac_cv_path_LIPO_FOR_TARGET" >&5 +echo "${ECHO_T}$ac_cv_path_LIPO_FOR_TARGET" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi elif test $build != $host && test $have_gcc_for_target = yes; then LIPO_FOR_TARGET=`$GCC_FOR_TARGET --print-prog-name=lipo` @@ -5856,51 +8351,58 @@ if test -z "$ac_cv_path_LIPO_FOR_TARGET" ; then # Extract the first word of "lipo", so it can be a program name with args. set dummy lipo; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5861: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_LIPO_FOR_TARGET'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_LIPO_FOR_TARGET+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - case "$LIPO_FOR_TARGET" in - /*) + case $LIPO_FOR_TARGET in + [\\/]* | ?:[\\/]*) ac_cv_path_LIPO_FOR_TARGET="$LIPO_FOR_TARGET" # Let the user override the test with a path. ;; - ?:/*) - ac_cv_path_LIPO_FOR_TARGET="$LIPO_FOR_TARGET" # Let the user override the test with a dos path. - ;; *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$gcc_cv_tool_dirs" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_path_LIPO_FOR_TARGET="$ac_dir/$ac_word" - break - fi - done - IFS="$ac_save_ifs" + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $gcc_cv_tool_dirs +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_LIPO_FOR_TARGET="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + ;; esac fi -LIPO_FOR_TARGET="$ac_cv_path_LIPO_FOR_TARGET" +LIPO_FOR_TARGET=$ac_cv_path_LIPO_FOR_TARGET if test -n "$LIPO_FOR_TARGET"; then - echo "$ac_t""$LIPO_FOR_TARGET" 1>&6 + { echo "$as_me:$LINENO: result: $LIPO_FOR_TARGET" >&5 +echo "${ECHO_T}$LIPO_FOR_TARGET" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi + fi if test -z "$ac_cv_path_LIPO_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then for ncn_progname in lipo; do - echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5898: checking for ${ncn_progname} in $with_build_time_tools" >&5 + { echo "$as_me:$LINENO: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo $ECHO_N "checking for ${ncn_progname} in $with_build_time_tools... $ECHO_C" >&6; } if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_LIPO_FOR_TARGET=$with_build_time_tools/${ncn_progname} - echo "$ac_t""yes" 1>&6 + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } break else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi done fi @@ -5910,69 +8412,85 @@ if test -n "$ncn_target_tool_prefix"; then # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5915: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_LIPO_FOR_TARGET'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_LIPO_FOR_TARGET+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$LIPO_FOR_TARGET"; then ac_cv_prog_LIPO_FOR_TARGET="$LIPO_FOR_TARGET" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_LIPO_FOR_TARGET="${ncn_target_tool_prefix}${ncn_progname}" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_LIPO_FOR_TARGET="${ncn_target_tool_prefix}${ncn_progname}" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -LIPO_FOR_TARGET="$ac_cv_prog_LIPO_FOR_TARGET" +LIPO_FOR_TARGET=$ac_cv_prog_LIPO_FOR_TARGET if test -n "$LIPO_FOR_TARGET"; then - echo "$ac_t""$LIPO_FOR_TARGET" 1>&6 + { echo "$as_me:$LINENO: result: $LIPO_FOR_TARGET" >&5 +echo "${ECHO_T}$LIPO_FOR_TARGET" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi + fi if test -z "$ac_cv_prog_LIPO_FOR_TARGET" && test $build = $target ; then # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5946: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_LIPO_FOR_TARGET'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_LIPO_FOR_TARGET+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$LIPO_FOR_TARGET"; then ac_cv_prog_LIPO_FOR_TARGET="$LIPO_FOR_TARGET" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_LIPO_FOR_TARGET="${ncn_progname}" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_LIPO_FOR_TARGET="${ncn_progname}" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -LIPO_FOR_TARGET="$ac_cv_prog_LIPO_FOR_TARGET" +LIPO_FOR_TARGET=$ac_cv_prog_LIPO_FOR_TARGET if test -n "$LIPO_FOR_TARGET"; then - echo "$ac_t""$LIPO_FOR_TARGET" 1>&6 + { echo "$as_me:$LINENO: result: $LIPO_FOR_TARGET" >&5 +echo "${ECHO_T}$LIPO_FOR_TARGET" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi - + + fi test -n "$ac_cv_prog_LIPO_FOR_TARGET" && break done fi - + if test -z "$ac_cv_prog_LIPO_FOR_TARGET" ; then set dummy lipo if test $build = $target ; then @@ -5993,14 +8511,16 @@ if test -z "$ac_cv_path_NM_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then - echo $ac_n "checking for nm in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5998: checking for nm in $with_build_time_tools" >&5 + { echo "$as_me:$LINENO: checking for nm in $with_build_time_tools" >&5 +echo $ECHO_N "checking for nm in $with_build_time_tools... $ECHO_C" >&6; } if test -x $with_build_time_tools/nm; then NM_FOR_TARGET=`cd $with_build_time_tools && pwd`/nm ac_cv_path_NM_FOR_TARGET=$NM_FOR_TARGET - echo "$ac_t""$ac_cv_path_NM_FOR_TARGET" 1>&6 + { echo "$as_me:$LINENO: result: $ac_cv_path_NM_FOR_TARGET" >&5 +echo "${ECHO_T}$ac_cv_path_NM_FOR_TARGET" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi elif test $build != $host && test $have_gcc_for_target = yes; then NM_FOR_TARGET=`$GCC_FOR_TARGET --print-prog-name=nm` @@ -6011,51 +8531,58 @@ if test -z "$ac_cv_path_NM_FOR_TARGET" ; then # Extract the first word of "nm", so it can be a program name with args. set dummy nm; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6016: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_NM_FOR_TARGET'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_NM_FOR_TARGET+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - case "$NM_FOR_TARGET" in - /*) + case $NM_FOR_TARGET in + [\\/]* | ?:[\\/]*) ac_cv_path_NM_FOR_TARGET="$NM_FOR_TARGET" # Let the user override the test with a path. ;; - ?:/*) - ac_cv_path_NM_FOR_TARGET="$NM_FOR_TARGET" # Let the user override the test with a dos path. - ;; *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$gcc_cv_tool_dirs" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_path_NM_FOR_TARGET="$ac_dir/$ac_word" - break - fi - done - IFS="$ac_save_ifs" + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $gcc_cv_tool_dirs +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_NM_FOR_TARGET="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + ;; esac fi -NM_FOR_TARGET="$ac_cv_path_NM_FOR_TARGET" +NM_FOR_TARGET=$ac_cv_path_NM_FOR_TARGET if test -n "$NM_FOR_TARGET"; then - echo "$ac_t""$NM_FOR_TARGET" 1>&6 + { echo "$as_me:$LINENO: result: $NM_FOR_TARGET" >&5 +echo "${ECHO_T}$NM_FOR_TARGET" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi + fi if test -z "$ac_cv_path_NM_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then for ncn_progname in nm; do - echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:6053: checking for ${ncn_progname} in $with_build_time_tools" >&5 + { echo "$as_me:$LINENO: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo $ECHO_N "checking for ${ncn_progname} in $with_build_time_tools... $ECHO_C" >&6; } if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_NM_FOR_TARGET=$with_build_time_tools/${ncn_progname} - echo "$ac_t""yes" 1>&6 + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } break else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi done fi @@ -6065,69 +8592,85 @@ if test -n "$ncn_target_tool_prefix"; then # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6070: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_NM_FOR_TARGET'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_NM_FOR_TARGET+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$NM_FOR_TARGET"; then ac_cv_prog_NM_FOR_TARGET="$NM_FOR_TARGET" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_NM_FOR_TARGET="${ncn_target_tool_prefix}${ncn_progname}" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_NM_FOR_TARGET="${ncn_target_tool_prefix}${ncn_progname}" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -NM_FOR_TARGET="$ac_cv_prog_NM_FOR_TARGET" +NM_FOR_TARGET=$ac_cv_prog_NM_FOR_TARGET if test -n "$NM_FOR_TARGET"; then - echo "$ac_t""$NM_FOR_TARGET" 1>&6 + { echo "$as_me:$LINENO: result: $NM_FOR_TARGET" >&5 +echo "${ECHO_T}$NM_FOR_TARGET" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi + fi if test -z "$ac_cv_prog_NM_FOR_TARGET" && test $build = $target ; then # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6101: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_NM_FOR_TARGET'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_NM_FOR_TARGET+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$NM_FOR_TARGET"; then ac_cv_prog_NM_FOR_TARGET="$NM_FOR_TARGET" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_NM_FOR_TARGET="${ncn_progname}" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_NM_FOR_TARGET="${ncn_progname}" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -NM_FOR_TARGET="$ac_cv_prog_NM_FOR_TARGET" +NM_FOR_TARGET=$ac_cv_prog_NM_FOR_TARGET if test -n "$NM_FOR_TARGET"; then - echo "$ac_t""$NM_FOR_TARGET" 1>&6 + { echo "$as_me:$LINENO: result: $NM_FOR_TARGET" >&5 +echo "${ECHO_T}$NM_FOR_TARGET" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi - + + fi test -n "$ac_cv_prog_NM_FOR_TARGET" && break done fi - + if test -z "$ac_cv_prog_NM_FOR_TARGET" ; then set dummy nm if test $build = $target ; then @@ -6148,14 +8691,16 @@ if test -z "$ac_cv_path_OBJDUMP_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then - echo $ac_n "checking for objdump in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:6153: checking for objdump in $with_build_time_tools" >&5 + { echo "$as_me:$LINENO: checking for objdump in $with_build_time_tools" >&5 +echo $ECHO_N "checking for objdump in $with_build_time_tools... $ECHO_C" >&6; } if test -x $with_build_time_tools/objdump; then OBJDUMP_FOR_TARGET=`cd $with_build_time_tools && pwd`/objdump ac_cv_path_OBJDUMP_FOR_TARGET=$OBJDUMP_FOR_TARGET - echo "$ac_t""$ac_cv_path_OBJDUMP_FOR_TARGET" 1>&6 + { echo "$as_me:$LINENO: result: $ac_cv_path_OBJDUMP_FOR_TARGET" >&5 +echo "${ECHO_T}$ac_cv_path_OBJDUMP_FOR_TARGET" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi elif test $build != $host && test $have_gcc_for_target = yes; then OBJDUMP_FOR_TARGET=`$GCC_FOR_TARGET --print-prog-name=objdump` @@ -6166,51 +8711,58 @@ if test -z "$ac_cv_path_OBJDUMP_FOR_TARGET" ; then # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6171: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_OBJDUMP_FOR_TARGET'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_OBJDUMP_FOR_TARGET+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - case "$OBJDUMP_FOR_TARGET" in - /*) + case $OBJDUMP_FOR_TARGET in + [\\/]* | ?:[\\/]*) ac_cv_path_OBJDUMP_FOR_TARGET="$OBJDUMP_FOR_TARGET" # Let the user override the test with a path. ;; - ?:/*) - ac_cv_path_OBJDUMP_FOR_TARGET="$OBJDUMP_FOR_TARGET" # Let the user override the test with a dos path. - ;; *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$gcc_cv_tool_dirs" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_path_OBJDUMP_FOR_TARGET="$ac_dir/$ac_word" - break - fi - done - IFS="$ac_save_ifs" + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $gcc_cv_tool_dirs +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_OBJDUMP_FOR_TARGET="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + ;; esac fi -OBJDUMP_FOR_TARGET="$ac_cv_path_OBJDUMP_FOR_TARGET" +OBJDUMP_FOR_TARGET=$ac_cv_path_OBJDUMP_FOR_TARGET if test -n "$OBJDUMP_FOR_TARGET"; then - echo "$ac_t""$OBJDUMP_FOR_TARGET" 1>&6 + { echo "$as_me:$LINENO: result: $OBJDUMP_FOR_TARGET" >&5 +echo "${ECHO_T}$OBJDUMP_FOR_TARGET" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi + fi if test -z "$ac_cv_path_OBJDUMP_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then for ncn_progname in objdump; do - echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:6208: checking for ${ncn_progname} in $with_build_time_tools" >&5 + { echo "$as_me:$LINENO: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo $ECHO_N "checking for ${ncn_progname} in $with_build_time_tools... $ECHO_C" >&6; } if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_OBJDUMP_FOR_TARGET=$with_build_time_tools/${ncn_progname} - echo "$ac_t""yes" 1>&6 + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } break else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi done fi @@ -6220,69 +8772,85 @@ if test -n "$ncn_target_tool_prefix"; then # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6225: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP_FOR_TARGET'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_OBJDUMP_FOR_TARGET+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$OBJDUMP_FOR_TARGET"; then ac_cv_prog_OBJDUMP_FOR_TARGET="$OBJDUMP_FOR_TARGET" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_OBJDUMP_FOR_TARGET="${ncn_target_tool_prefix}${ncn_progname}" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_OBJDUMP_FOR_TARGET="${ncn_target_tool_prefix}${ncn_progname}" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -OBJDUMP_FOR_TARGET="$ac_cv_prog_OBJDUMP_FOR_TARGET" +OBJDUMP_FOR_TARGET=$ac_cv_prog_OBJDUMP_FOR_TARGET if test -n "$OBJDUMP_FOR_TARGET"; then - echo "$ac_t""$OBJDUMP_FOR_TARGET" 1>&6 + { echo "$as_me:$LINENO: result: $OBJDUMP_FOR_TARGET" >&5 +echo "${ECHO_T}$OBJDUMP_FOR_TARGET" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi + fi if test -z "$ac_cv_prog_OBJDUMP_FOR_TARGET" && test $build = $target ; then # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6256: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP_FOR_TARGET'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_OBJDUMP_FOR_TARGET+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$OBJDUMP_FOR_TARGET"; then ac_cv_prog_OBJDUMP_FOR_TARGET="$OBJDUMP_FOR_TARGET" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_OBJDUMP_FOR_TARGET="${ncn_progname}" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_OBJDUMP_FOR_TARGET="${ncn_progname}" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -OBJDUMP_FOR_TARGET="$ac_cv_prog_OBJDUMP_FOR_TARGET" +OBJDUMP_FOR_TARGET=$ac_cv_prog_OBJDUMP_FOR_TARGET if test -n "$OBJDUMP_FOR_TARGET"; then - echo "$ac_t""$OBJDUMP_FOR_TARGET" 1>&6 + { echo "$as_me:$LINENO: result: $OBJDUMP_FOR_TARGET" >&5 +echo "${ECHO_T}$OBJDUMP_FOR_TARGET" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi - + + fi test -n "$ac_cv_prog_OBJDUMP_FOR_TARGET" && break done fi - + if test -z "$ac_cv_prog_OBJDUMP_FOR_TARGET" ; then set dummy objdump if test $build = $target ; then @@ -6303,14 +8871,16 @@ if test -z "$ac_cv_path_RANLIB_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then - echo $ac_n "checking for ranlib in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:6308: checking for ranlib in $with_build_time_tools" >&5 + { echo "$as_me:$LINENO: checking for ranlib in $with_build_time_tools" >&5 +echo $ECHO_N "checking for ranlib in $with_build_time_tools... $ECHO_C" >&6; } if test -x $with_build_time_tools/ranlib; then RANLIB_FOR_TARGET=`cd $with_build_time_tools && pwd`/ranlib ac_cv_path_RANLIB_FOR_TARGET=$RANLIB_FOR_TARGET - echo "$ac_t""$ac_cv_path_RANLIB_FOR_TARGET" 1>&6 + { echo "$as_me:$LINENO: result: $ac_cv_path_RANLIB_FOR_TARGET" >&5 +echo "${ECHO_T}$ac_cv_path_RANLIB_FOR_TARGET" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi elif test $build != $host && test $have_gcc_for_target = yes; then RANLIB_FOR_TARGET=`$GCC_FOR_TARGET --print-prog-name=ranlib` @@ -6321,51 +8891,58 @@ if test -z "$ac_cv_path_RANLIB_FOR_TARGET" ; then # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6326: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_RANLIB_FOR_TARGET'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_RANLIB_FOR_TARGET+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - case "$RANLIB_FOR_TARGET" in - /*) + case $RANLIB_FOR_TARGET in + [\\/]* | ?:[\\/]*) ac_cv_path_RANLIB_FOR_TARGET="$RANLIB_FOR_TARGET" # Let the user override the test with a path. ;; - ?:/*) - ac_cv_path_RANLIB_FOR_TARGET="$RANLIB_FOR_TARGET" # Let the user override the test with a dos path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$gcc_cv_tool_dirs" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_path_RANLIB_FOR_TARGET="$ac_dir/$ac_word" - break - fi - done - IFS="$ac_save_ifs" - ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $gcc_cv_tool_dirs +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_RANLIB_FOR_TARGET="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + ;; esac fi -RANLIB_FOR_TARGET="$ac_cv_path_RANLIB_FOR_TARGET" +RANLIB_FOR_TARGET=$ac_cv_path_RANLIB_FOR_TARGET if test -n "$RANLIB_FOR_TARGET"; then - echo "$ac_t""$RANLIB_FOR_TARGET" 1>&6 + { echo "$as_me:$LINENO: result: $RANLIB_FOR_TARGET" >&5 +echo "${ECHO_T}$RANLIB_FOR_TARGET" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi + fi if test -z "$ac_cv_path_RANLIB_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then for ncn_progname in ranlib; do - echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:6363: checking for ${ncn_progname} in $with_build_time_tools" >&5 + { echo "$as_me:$LINENO: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo $ECHO_N "checking for ${ncn_progname} in $with_build_time_tools... $ECHO_C" >&6; } if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_RANLIB_FOR_TARGET=$with_build_time_tools/${ncn_progname} - echo "$ac_t""yes" 1>&6 + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } break else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi done fi @@ -6375,69 +8952,85 @@ if test -n "$ncn_target_tool_prefix"; then # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6380: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB_FOR_TARGET'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_RANLIB_FOR_TARGET+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$RANLIB_FOR_TARGET"; then ac_cv_prog_RANLIB_FOR_TARGET="$RANLIB_FOR_TARGET" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_RANLIB_FOR_TARGET="${ncn_target_tool_prefix}${ncn_progname}" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_RANLIB_FOR_TARGET="${ncn_target_tool_prefix}${ncn_progname}" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -RANLIB_FOR_TARGET="$ac_cv_prog_RANLIB_FOR_TARGET" +RANLIB_FOR_TARGET=$ac_cv_prog_RANLIB_FOR_TARGET if test -n "$RANLIB_FOR_TARGET"; then - echo "$ac_t""$RANLIB_FOR_TARGET" 1>&6 + { echo "$as_me:$LINENO: result: $RANLIB_FOR_TARGET" >&5 +echo "${ECHO_T}$RANLIB_FOR_TARGET" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi + fi if test -z "$ac_cv_prog_RANLIB_FOR_TARGET" && test $build = $target ; then # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6411: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB_FOR_TARGET'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_RANLIB_FOR_TARGET+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$RANLIB_FOR_TARGET"; then ac_cv_prog_RANLIB_FOR_TARGET="$RANLIB_FOR_TARGET" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_RANLIB_FOR_TARGET="${ncn_progname}" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_RANLIB_FOR_TARGET="${ncn_progname}" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -RANLIB_FOR_TARGET="$ac_cv_prog_RANLIB_FOR_TARGET" +RANLIB_FOR_TARGET=$ac_cv_prog_RANLIB_FOR_TARGET if test -n "$RANLIB_FOR_TARGET"; then - echo "$ac_t""$RANLIB_FOR_TARGET" 1>&6 + { echo "$as_me:$LINENO: result: $RANLIB_FOR_TARGET" >&5 +echo "${ECHO_T}$RANLIB_FOR_TARGET" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi - + + fi test -n "$ac_cv_prog_RANLIB_FOR_TARGET" && break done fi - + if test -z "$ac_cv_prog_RANLIB_FOR_TARGET" ; then set dummy ranlib if test $build = $target ; then @@ -6458,14 +9051,16 @@ if test -z "$ac_cv_path_STRIP_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then - echo $ac_n "checking for strip in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:6463: checking for strip in $with_build_time_tools" >&5 + { echo "$as_me:$LINENO: checking for strip in $with_build_time_tools" >&5 +echo $ECHO_N "checking for strip in $with_build_time_tools... $ECHO_C" >&6; } if test -x $with_build_time_tools/strip; then STRIP_FOR_TARGET=`cd $with_build_time_tools && pwd`/strip ac_cv_path_STRIP_FOR_TARGET=$STRIP_FOR_TARGET - echo "$ac_t""$ac_cv_path_STRIP_FOR_TARGET" 1>&6 + { echo "$as_me:$LINENO: result: $ac_cv_path_STRIP_FOR_TARGET" >&5 +echo "${ECHO_T}$ac_cv_path_STRIP_FOR_TARGET" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi elif test $build != $host && test $have_gcc_for_target = yes; then STRIP_FOR_TARGET=`$GCC_FOR_TARGET --print-prog-name=strip` @@ -6476,51 +9071,58 @@ if test -z "$ac_cv_path_STRIP_FOR_TARGET" ; then # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6481: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_STRIP_FOR_TARGET'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_STRIP_FOR_TARGET+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - case "$STRIP_FOR_TARGET" in - /*) + case $STRIP_FOR_TARGET in + [\\/]* | ?:[\\/]*) ac_cv_path_STRIP_FOR_TARGET="$STRIP_FOR_TARGET" # Let the user override the test with a path. ;; - ?:/*) - ac_cv_path_STRIP_FOR_TARGET="$STRIP_FOR_TARGET" # Let the user override the test with a dos path. - ;; *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$gcc_cv_tool_dirs" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_path_STRIP_FOR_TARGET="$ac_dir/$ac_word" - break - fi - done - IFS="$ac_save_ifs" + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $gcc_cv_tool_dirs +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_STRIP_FOR_TARGET="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + ;; esac fi -STRIP_FOR_TARGET="$ac_cv_path_STRIP_FOR_TARGET" +STRIP_FOR_TARGET=$ac_cv_path_STRIP_FOR_TARGET if test -n "$STRIP_FOR_TARGET"; then - echo "$ac_t""$STRIP_FOR_TARGET" 1>&6 + { echo "$as_me:$LINENO: result: $STRIP_FOR_TARGET" >&5 +echo "${ECHO_T}$STRIP_FOR_TARGET" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi + fi if test -z "$ac_cv_path_STRIP_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then for ncn_progname in strip; do - echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:6518: checking for ${ncn_progname} in $with_build_time_tools" >&5 + { echo "$as_me:$LINENO: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo $ECHO_N "checking for ${ncn_progname} in $with_build_time_tools... $ECHO_C" >&6; } if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_STRIP_FOR_TARGET=$with_build_time_tools/${ncn_progname} - echo "$ac_t""yes" 1>&6 + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } break else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi done fi @@ -6530,69 +9132,85 @@ if test -n "$ncn_target_tool_prefix"; then # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6535: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_STRIP_FOR_TARGET'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_STRIP_FOR_TARGET+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$STRIP_FOR_TARGET"; then ac_cv_prog_STRIP_FOR_TARGET="$STRIP_FOR_TARGET" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_STRIP_FOR_TARGET="${ncn_target_tool_prefix}${ncn_progname}" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_STRIP_FOR_TARGET="${ncn_target_tool_prefix}${ncn_progname}" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -STRIP_FOR_TARGET="$ac_cv_prog_STRIP_FOR_TARGET" +STRIP_FOR_TARGET=$ac_cv_prog_STRIP_FOR_TARGET if test -n "$STRIP_FOR_TARGET"; then - echo "$ac_t""$STRIP_FOR_TARGET" 1>&6 + { echo "$as_me:$LINENO: result: $STRIP_FOR_TARGET" >&5 +echo "${ECHO_T}$STRIP_FOR_TARGET" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi + fi if test -z "$ac_cv_prog_STRIP_FOR_TARGET" && test $build = $target ; then # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6566: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_STRIP_FOR_TARGET'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_STRIP_FOR_TARGET+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$STRIP_FOR_TARGET"; then ac_cv_prog_STRIP_FOR_TARGET="$STRIP_FOR_TARGET" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_STRIP_FOR_TARGET="${ncn_progname}" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_STRIP_FOR_TARGET="${ncn_progname}" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -STRIP_FOR_TARGET="$ac_cv_prog_STRIP_FOR_TARGET" +STRIP_FOR_TARGET=$ac_cv_prog_STRIP_FOR_TARGET if test -n "$STRIP_FOR_TARGET"; then - echo "$ac_t""$STRIP_FOR_TARGET" 1>&6 + { echo "$as_me:$LINENO: result: $STRIP_FOR_TARGET" >&5 +echo "${ECHO_T}$STRIP_FOR_TARGET" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi - + + fi test -n "$ac_cv_prog_STRIP_FOR_TARGET" && break done fi - + if test -z "$ac_cv_prog_STRIP_FOR_TARGET" ; then set dummy strip if test $build = $target ; then @@ -6613,14 +9231,16 @@ if test -z "$ac_cv_path_WINDRES_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then - echo $ac_n "checking for windres in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:6618: checking for windres in $with_build_time_tools" >&5 + { echo "$as_me:$LINENO: checking for windres in $with_build_time_tools" >&5 +echo $ECHO_N "checking for windres in $with_build_time_tools... $ECHO_C" >&6; } if test -x $with_build_time_tools/windres; then WINDRES_FOR_TARGET=`cd $with_build_time_tools && pwd`/windres ac_cv_path_WINDRES_FOR_TARGET=$WINDRES_FOR_TARGET - echo "$ac_t""$ac_cv_path_WINDRES_FOR_TARGET" 1>&6 + { echo "$as_me:$LINENO: result: $ac_cv_path_WINDRES_FOR_TARGET" >&5 +echo "${ECHO_T}$ac_cv_path_WINDRES_FOR_TARGET" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi elif test $build != $host && test $have_gcc_for_target = yes; then WINDRES_FOR_TARGET=`$GCC_FOR_TARGET --print-prog-name=windres` @@ -6631,51 +9251,58 @@ if test -z "$ac_cv_path_WINDRES_FOR_TARGET" ; then # Extract the first word of "windres", so it can be a program name with args. set dummy windres; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6636: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_WINDRES_FOR_TARGET'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_WINDRES_FOR_TARGET+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - case "$WINDRES_FOR_TARGET" in - /*) + case $WINDRES_FOR_TARGET in + [\\/]* | ?:[\\/]*) ac_cv_path_WINDRES_FOR_TARGET="$WINDRES_FOR_TARGET" # Let the user override the test with a path. ;; - ?:/*) - ac_cv_path_WINDRES_FOR_TARGET="$WINDRES_FOR_TARGET" # Let the user override the test with a dos path. - ;; *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$gcc_cv_tool_dirs" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_path_WINDRES_FOR_TARGET="$ac_dir/$ac_word" - break - fi - done - IFS="$ac_save_ifs" + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $gcc_cv_tool_dirs +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_WINDRES_FOR_TARGET="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + ;; esac fi -WINDRES_FOR_TARGET="$ac_cv_path_WINDRES_FOR_TARGET" +WINDRES_FOR_TARGET=$ac_cv_path_WINDRES_FOR_TARGET if test -n "$WINDRES_FOR_TARGET"; then - echo "$ac_t""$WINDRES_FOR_TARGET" 1>&6 + { echo "$as_me:$LINENO: result: $WINDRES_FOR_TARGET" >&5 +echo "${ECHO_T}$WINDRES_FOR_TARGET" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi + fi if test -z "$ac_cv_path_WINDRES_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then for ncn_progname in windres; do - echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:6673: checking for ${ncn_progname} in $with_build_time_tools" >&5 + { echo "$as_me:$LINENO: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo $ECHO_N "checking for ${ncn_progname} in $with_build_time_tools... $ECHO_C" >&6; } if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_WINDRES_FOR_TARGET=$with_build_time_tools/${ncn_progname} - echo "$ac_t""yes" 1>&6 + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } break else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi done fi @@ -6685,69 +9312,85 @@ if test -n "$ncn_target_tool_prefix"; then # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6690: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_WINDRES_FOR_TARGET'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_WINDRES_FOR_TARGET+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$WINDRES_FOR_TARGET"; then ac_cv_prog_WINDRES_FOR_TARGET="$WINDRES_FOR_TARGET" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_WINDRES_FOR_TARGET="${ncn_target_tool_prefix}${ncn_progname}" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_WINDRES_FOR_TARGET="${ncn_target_tool_prefix}${ncn_progname}" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -WINDRES_FOR_TARGET="$ac_cv_prog_WINDRES_FOR_TARGET" +WINDRES_FOR_TARGET=$ac_cv_prog_WINDRES_FOR_TARGET if test -n "$WINDRES_FOR_TARGET"; then - echo "$ac_t""$WINDRES_FOR_TARGET" 1>&6 + { echo "$as_me:$LINENO: result: $WINDRES_FOR_TARGET" >&5 +echo "${ECHO_T}$WINDRES_FOR_TARGET" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi + fi if test -z "$ac_cv_prog_WINDRES_FOR_TARGET" && test $build = $target ; then # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6721: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_WINDRES_FOR_TARGET'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_WINDRES_FOR_TARGET+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$WINDRES_FOR_TARGET"; then ac_cv_prog_WINDRES_FOR_TARGET="$WINDRES_FOR_TARGET" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_WINDRES_FOR_TARGET="${ncn_progname}" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_WINDRES_FOR_TARGET="${ncn_progname}" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + fi fi -WINDRES_FOR_TARGET="$ac_cv_prog_WINDRES_FOR_TARGET" +WINDRES_FOR_TARGET=$ac_cv_prog_WINDRES_FOR_TARGET if test -n "$WINDRES_FOR_TARGET"; then - echo "$ac_t""$WINDRES_FOR_TARGET" 1>&6 + { echo "$as_me:$LINENO: result: $WINDRES_FOR_TARGET" >&5 +echo "${ECHO_T}$WINDRES_FOR_TARGET" >&6; } else - echo "$ac_t""no" 1>&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi - + + fi test -n "$ac_cv_prog_WINDRES_FOR_TARGET" && break done fi - + if test -z "$ac_cv_prog_WINDRES_FOR_TARGET" ; then set dummy windres if test $build = $target ; then @@ -6766,15 +9409,17 @@ RAW_CXX_FOR_TARGET="$CXX_FOR_TARGET" -echo $ac_n "checking where to find the target ar""... $ac_c" 1>&6 -echo "configure:6771: checking where to find the target ar" >&5 +{ echo "$as_me:$LINENO: checking where to find the target ar" >&5 +echo $ECHO_N "checking where to find the target ar... $ECHO_C" >&6; } if test "x${build}" != "x${host}" ; then if expr "x$AR_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path - echo "$ac_t""pre-installed in `dirname $AR_FOR_TARGET`" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed in \`dirname $AR_FOR_TARGET\`" >&5 +echo "${ECHO_T}pre-installed in \`dirname $AR_FOR_TARGET\`" >&6; } else # Canadian cross, just use what we found - echo "$ac_t""pre-installed" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed" >&5 +echo "${ECHO_T}pre-installed" >&6; } fi else ok=yes @@ -6782,32 +9427,38 @@ *" binutils "*) ;; *) ok=no ;; esac - + if test $ok = yes; then # An in-tree tool is available and we can use it AR_FOR_TARGET='$$r/$(HOST_SUBDIR)/binutils/ar' - echo "$ac_t""just compiled" 1>&6 + { echo "$as_me:$LINENO: result: just compiled" >&5 +echo "${ECHO_T}just compiled" >&6; } elif expr "x$AR_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path - echo "$ac_t""pre-installed in `dirname $AR_FOR_TARGET`" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed in \`dirname $AR_FOR_TARGET\`" >&5 +echo "${ECHO_T}pre-installed in \`dirname $AR_FOR_TARGET\`" >&6; } elif test "x$target" = "x$host"; then # We can use an host tool AR_FOR_TARGET='$(AR)' - echo "$ac_t""host tool" 1>&6 + { echo "$as_me:$LINENO: result: host tool" >&5 +echo "${ECHO_T}host tool" >&6; } else # We need a cross tool - echo "$ac_t""pre-installed" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed" >&5 +echo "${ECHO_T}pre-installed" >&6; } fi fi -echo $ac_n "checking where to find the target as""... $ac_c" 1>&6 -echo "configure:6804: checking where to find the target as" >&5 +{ echo "$as_me:$LINENO: checking where to find the target as" >&5 +echo $ECHO_N "checking where to find the target as... $ECHO_C" >&6; } if test "x${build}" != "x${host}" ; then if expr "x$AS_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path - echo "$ac_t""pre-installed in `dirname $AS_FOR_TARGET`" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed in \`dirname $AS_FOR_TARGET\`" >&5 +echo "${ECHO_T}pre-installed in \`dirname $AS_FOR_TARGET\`" >&6; } else # Canadian cross, just use what we found - echo "$ac_t""pre-installed" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed" >&5 +echo "${ECHO_T}pre-installed" >&6; } fi else ok=yes @@ -6815,32 +9466,38 @@ *" gas "*) ;; *) ok=no ;; esac - + if test $ok = yes; then # An in-tree tool is available and we can use it AS_FOR_TARGET='$$r/$(HOST_SUBDIR)/gas/as-new' - echo "$ac_t""just compiled" 1>&6 + { echo "$as_me:$LINENO: result: just compiled" >&5 +echo "${ECHO_T}just compiled" >&6; } elif expr "x$AS_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path - echo "$ac_t""pre-installed in `dirname $AS_FOR_TARGET`" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed in \`dirname $AS_FOR_TARGET\`" >&5 +echo "${ECHO_T}pre-installed in \`dirname $AS_FOR_TARGET\`" >&6; } elif test "x$target" = "x$host"; then # We can use an host tool AS_FOR_TARGET='$(AS)' - echo "$ac_t""host tool" 1>&6 + { echo "$as_me:$LINENO: result: host tool" >&5 +echo "${ECHO_T}host tool" >&6; } else # We need a cross tool - echo "$ac_t""pre-installed" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed" >&5 +echo "${ECHO_T}pre-installed" >&6; } fi fi -echo $ac_n "checking where to find the target cc""... $ac_c" 1>&6 -echo "configure:6837: checking where to find the target cc" >&5 +{ echo "$as_me:$LINENO: checking where to find the target cc" >&5 +echo $ECHO_N "checking where to find the target cc... $ECHO_C" >&6; } if test "x${build}" != "x${host}" ; then if expr "x$CC_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path - echo "$ac_t""pre-installed in `dirname $CC_FOR_TARGET`" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed in \`dirname $CC_FOR_TARGET\`" >&5 +echo "${ECHO_T}pre-installed in \`dirname $CC_FOR_TARGET\`" >&6; } else # Canadian cross, just use what we found - echo "$ac_t""pre-installed" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed" >&5 +echo "${ECHO_T}pre-installed" >&6; } fi else ok=yes @@ -6848,32 +9505,38 @@ *" gcc "*) ;; *) ok=no ;; esac - + if test $ok = yes; then # An in-tree tool is available and we can use it CC_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/xgcc -B$$r/$(HOST_SUBDIR)/gcc/' - echo "$ac_t""just compiled" 1>&6 + { echo "$as_me:$LINENO: result: just compiled" >&5 +echo "${ECHO_T}just compiled" >&6; } elif expr "x$CC_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path - echo "$ac_t""pre-installed in `dirname $CC_FOR_TARGET`" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed in \`dirname $CC_FOR_TARGET\`" >&5 +echo "${ECHO_T}pre-installed in \`dirname $CC_FOR_TARGET\`" >&6; } elif test "x$target" = "x$host"; then # We can use an host tool CC_FOR_TARGET='$(CC)' - echo "$ac_t""host tool" 1>&6 + { echo "$as_me:$LINENO: result: host tool" >&5 +echo "${ECHO_T}host tool" >&6; } else # We need a cross tool - echo "$ac_t""pre-installed" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed" >&5 +echo "${ECHO_T}pre-installed" >&6; } fi fi -echo $ac_n "checking where to find the target c++""... $ac_c" 1>&6 -echo "configure:6870: checking where to find the target c++" >&5 +{ echo "$as_me:$LINENO: checking where to find the target c++" >&5 +echo $ECHO_N "checking where to find the target c++... $ECHO_C" >&6; } if test "x${build}" != "x${host}" ; then if expr "x$CXX_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path - echo "$ac_t""pre-installed in `dirname $CXX_FOR_TARGET`" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed in \`dirname $CXX_FOR_TARGET\`" >&5 +echo "${ECHO_T}pre-installed in \`dirname $CXX_FOR_TARGET\`" >&6; } else # Canadian cross, just use what we found - echo "$ac_t""pre-installed" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed" >&5 +echo "${ECHO_T}pre-installed" >&6; } fi else ok=yes @@ -6888,28 +9551,34 @@ if test $ok = yes; then # An in-tree tool is available and we can use it CXX_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/g++ -B$$r/$(HOST_SUBDIR)/gcc/ -nostdinc++ `test ! -f $$r/$(TARGET_SUBDIR)/libstdc++-v3/scripts/testsuite_flags || $(SHELL) $$r/$(TARGET_SUBDIR)/libstdc++-v3/scripts/testsuite_flags --build-includes` -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs' - echo "$ac_t""just compiled" 1>&6 + { echo "$as_me:$LINENO: result: just compiled" >&5 +echo "${ECHO_T}just compiled" >&6; } elif expr "x$CXX_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path - echo "$ac_t""pre-installed in `dirname $CXX_FOR_TARGET`" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed in \`dirname $CXX_FOR_TARGET\`" >&5 +echo "${ECHO_T}pre-installed in \`dirname $CXX_FOR_TARGET\`" >&6; } elif test "x$target" = "x$host"; then # We can use an host tool CXX_FOR_TARGET='$(CXX)' - echo "$ac_t""host tool" 1>&6 + { echo "$as_me:$LINENO: result: host tool" >&5 +echo "${ECHO_T}host tool" >&6; } else # We need a cross tool - echo "$ac_t""pre-installed" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed" >&5 +echo "${ECHO_T}pre-installed" >&6; } fi fi -echo $ac_n "checking where to find the target c++ for libstdc++""... $ac_c" 1>&6 -echo "configure:6906: checking where to find the target c++ for libstdc++" >&5 +{ echo "$as_me:$LINENO: checking where to find the target c++ for libstdc++" >&5 +echo $ECHO_N "checking where to find the target c++ for libstdc++... $ECHO_C" >&6; } if test "x${build}" != "x${host}" ; then if expr "x$RAW_CXX_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path - echo "$ac_t""pre-installed in `dirname $RAW_CXX_FOR_TARGET`" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed in \`dirname $RAW_CXX_FOR_TARGET\`" >&5 +echo "${ECHO_T}pre-installed in \`dirname $RAW_CXX_FOR_TARGET\`" >&6; } else # Canadian cross, just use what we found - echo "$ac_t""pre-installed" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed" >&5 +echo "${ECHO_T}pre-installed" >&6; } fi else ok=yes @@ -6924,28 +9593,34 @@ if test $ok = yes; then # An in-tree tool is available and we can use it RAW_CXX_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/xgcc -shared-libgcc -B$$r/$(HOST_SUBDIR)/gcc -nostdinc++ -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs' - echo "$ac_t""just compiled" 1>&6 + { echo "$as_me:$LINENO: result: just compiled" >&5 +echo "${ECHO_T}just compiled" >&6; } elif expr "x$RAW_CXX_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path - echo "$ac_t""pre-installed in `dirname $RAW_CXX_FOR_TARGET`" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed in \`dirname $RAW_CXX_FOR_TARGET\`" >&5 +echo "${ECHO_T}pre-installed in \`dirname $RAW_CXX_FOR_TARGET\`" >&6; } elif test "x$target" = "x$host"; then # We can use an host tool RAW_CXX_FOR_TARGET='$(CXX)' - echo "$ac_t""host tool" 1>&6 + { echo "$as_me:$LINENO: result: host tool" >&5 +echo "${ECHO_T}host tool" >&6; } else # We need a cross tool - echo "$ac_t""pre-installed" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed" >&5 +echo "${ECHO_T}pre-installed" >&6; } fi fi -echo $ac_n "checking where to find the target dlltool""... $ac_c" 1>&6 -echo "configure:6942: checking where to find the target dlltool" >&5 +{ echo "$as_me:$LINENO: checking where to find the target dlltool" >&5 +echo $ECHO_N "checking where to find the target dlltool... $ECHO_C" >&6; } if test "x${build}" != "x${host}" ; then if expr "x$DLLTOOL_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path - echo "$ac_t""pre-installed in `dirname $DLLTOOL_FOR_TARGET`" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed in \`dirname $DLLTOOL_FOR_TARGET\`" >&5 +echo "${ECHO_T}pre-installed in \`dirname $DLLTOOL_FOR_TARGET\`" >&6; } else # Canadian cross, just use what we found - echo "$ac_t""pre-installed" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed" >&5 +echo "${ECHO_T}pre-installed" >&6; } fi else ok=yes @@ -6953,32 +9628,38 @@ *" binutils "*) ;; *) ok=no ;; esac - + if test $ok = yes; then # An in-tree tool is available and we can use it DLLTOOL_FOR_TARGET='$$r/$(HOST_SUBDIR)/binutils/dlltool' - echo "$ac_t""just compiled" 1>&6 + { echo "$as_me:$LINENO: result: just compiled" >&5 +echo "${ECHO_T}just compiled" >&6; } elif expr "x$DLLTOOL_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path - echo "$ac_t""pre-installed in `dirname $DLLTOOL_FOR_TARGET`" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed in \`dirname $DLLTOOL_FOR_TARGET\`" >&5 +echo "${ECHO_T}pre-installed in \`dirname $DLLTOOL_FOR_TARGET\`" >&6; } elif test "x$target" = "x$host"; then # We can use an host tool DLLTOOL_FOR_TARGET='$(DLLTOOL)' - echo "$ac_t""host tool" 1>&6 + { echo "$as_me:$LINENO: result: host tool" >&5 +echo "${ECHO_T}host tool" >&6; } else # We need a cross tool - echo "$ac_t""pre-installed" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed" >&5 +echo "${ECHO_T}pre-installed" >&6; } fi fi -echo $ac_n "checking where to find the target gcc""... $ac_c" 1>&6 -echo "configure:6975: checking where to find the target gcc" >&5 +{ echo "$as_me:$LINENO: checking where to find the target gcc" >&5 +echo $ECHO_N "checking where to find the target gcc... $ECHO_C" >&6; } if test "x${build}" != "x${host}" ; then if expr "x$GCC_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path - echo "$ac_t""pre-installed in `dirname $GCC_FOR_TARGET`" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed in \`dirname $GCC_FOR_TARGET\`" >&5 +echo "${ECHO_T}pre-installed in \`dirname $GCC_FOR_TARGET\`" >&6; } else # Canadian cross, just use what we found - echo "$ac_t""pre-installed" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed" >&5 +echo "${ECHO_T}pre-installed" >&6; } fi else ok=yes @@ -6986,32 +9667,38 @@ *" gcc "*) ;; *) ok=no ;; esac - + if test $ok = yes; then # An in-tree tool is available and we can use it GCC_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/xgcc -B$$r/$(HOST_SUBDIR)/gcc/' - echo "$ac_t""just compiled" 1>&6 + { echo "$as_me:$LINENO: result: just compiled" >&5 +echo "${ECHO_T}just compiled" >&6; } elif expr "x$GCC_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path - echo "$ac_t""pre-installed in `dirname $GCC_FOR_TARGET`" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed in \`dirname $GCC_FOR_TARGET\`" >&5 +echo "${ECHO_T}pre-installed in \`dirname $GCC_FOR_TARGET\`" >&6; } elif test "x$target" = "x$host"; then # We can use an host tool GCC_FOR_TARGET='$()' - echo "$ac_t""host tool" 1>&6 + { echo "$as_me:$LINENO: result: host tool" >&5 +echo "${ECHO_T}host tool" >&6; } else # We need a cross tool - echo "$ac_t""pre-installed" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed" >&5 +echo "${ECHO_T}pre-installed" >&6; } fi fi -echo $ac_n "checking where to find the target gcj""... $ac_c" 1>&6 -echo "configure:7008: checking where to find the target gcj" >&5 +{ echo "$as_me:$LINENO: checking where to find the target gcj" >&5 +echo $ECHO_N "checking where to find the target gcj... $ECHO_C" >&6; } if test "x${build}" != "x${host}" ; then if expr "x$GCJ_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path - echo "$ac_t""pre-installed in `dirname $GCJ_FOR_TARGET`" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed in \`dirname $GCJ_FOR_TARGET\`" >&5 +echo "${ECHO_T}pre-installed in \`dirname $GCJ_FOR_TARGET\`" >&6; } else # Canadian cross, just use what we found - echo "$ac_t""pre-installed" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed" >&5 +echo "${ECHO_T}pre-installed" >&6; } fi else ok=yes @@ -7026,28 +9713,34 @@ if test $ok = yes; then # An in-tree tool is available and we can use it GCJ_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/gcj -B$$r/$(HOST_SUBDIR)/gcc/' - echo "$ac_t""just compiled" 1>&6 + { echo "$as_me:$LINENO: result: just compiled" >&5 +echo "${ECHO_T}just compiled" >&6; } elif expr "x$GCJ_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path - echo "$ac_t""pre-installed in `dirname $GCJ_FOR_TARGET`" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed in \`dirname $GCJ_FOR_TARGET\`" >&5 +echo "${ECHO_T}pre-installed in \`dirname $GCJ_FOR_TARGET\`" >&6; } elif test "x$target" = "x$host"; then # We can use an host tool GCJ_FOR_TARGET='$(GCJ)' - echo "$ac_t""host tool" 1>&6 + { echo "$as_me:$LINENO: result: host tool" >&5 +echo "${ECHO_T}host tool" >&6; } else # We need a cross tool - echo "$ac_t""pre-installed" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed" >&5 +echo "${ECHO_T}pre-installed" >&6; } fi fi -echo $ac_n "checking where to find the target gfortran""... $ac_c" 1>&6 -echo "configure:7044: checking where to find the target gfortran" >&5 +{ echo "$as_me:$LINENO: checking where to find the target gfortran" >&5 +echo $ECHO_N "checking where to find the target gfortran... $ECHO_C" >&6; } if test "x${build}" != "x${host}" ; then if expr "x$GFORTRAN_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path - echo "$ac_t""pre-installed in `dirname $GFORTRAN_FOR_TARGET`" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed in \`dirname $GFORTRAN_FOR_TARGET\`" >&5 +echo "${ECHO_T}pre-installed in \`dirname $GFORTRAN_FOR_TARGET\`" >&6; } else # Canadian cross, just use what we found - echo "$ac_t""pre-installed" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed" >&5 +echo "${ECHO_T}pre-installed" >&6; } fi else ok=yes @@ -7062,28 +9755,34 @@ if test $ok = yes; then # An in-tree tool is available and we can use it GFORTRAN_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/gfortran -B$$r/$(HOST_SUBDIR)/gcc/' - echo "$ac_t""just compiled" 1>&6 + { echo "$as_me:$LINENO: result: just compiled" >&5 +echo "${ECHO_T}just compiled" >&6; } elif expr "x$GFORTRAN_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path - echo "$ac_t""pre-installed in `dirname $GFORTRAN_FOR_TARGET`" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed in \`dirname $GFORTRAN_FOR_TARGET\`" >&5 +echo "${ECHO_T}pre-installed in \`dirname $GFORTRAN_FOR_TARGET\`" >&6; } elif test "x$target" = "x$host"; then # We can use an host tool GFORTRAN_FOR_TARGET='$(GFORTRAN)' - echo "$ac_t""host tool" 1>&6 + { echo "$as_me:$LINENO: result: host tool" >&5 +echo "${ECHO_T}host tool" >&6; } else # We need a cross tool - echo "$ac_t""pre-installed" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed" >&5 +echo "${ECHO_T}pre-installed" >&6; } fi fi -echo $ac_n "checking where to find the target ld""... $ac_c" 1>&6 -echo "configure:7080: checking where to find the target ld" >&5 +{ echo "$as_me:$LINENO: checking where to find the target ld" >&5 +echo $ECHO_N "checking where to find the target ld... $ECHO_C" >&6; } if test "x${build}" != "x${host}" ; then if expr "x$LD_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path - echo "$ac_t""pre-installed in `dirname $LD_FOR_TARGET`" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed in \`dirname $LD_FOR_TARGET\`" >&5 +echo "${ECHO_T}pre-installed in \`dirname $LD_FOR_TARGET\`" >&6; } else # Canadian cross, just use what we found - echo "$ac_t""pre-installed" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed" >&5 +echo "${ECHO_T}pre-installed" >&6; } fi else ok=yes @@ -7091,55 +9790,66 @@ *" ld "*) ;; *) ok=no ;; esac - + if test $ok = yes; then # An in-tree tool is available and we can use it LD_FOR_TARGET='$$r/$(HOST_SUBDIR)/ld/ld-new' - echo "$ac_t""just compiled" 1>&6 + { echo "$as_me:$LINENO: result: just compiled" >&5 +echo "${ECHO_T}just compiled" >&6; } elif expr "x$LD_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path - echo "$ac_t""pre-installed in `dirname $LD_FOR_TARGET`" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed in \`dirname $LD_FOR_TARGET\`" >&5 +echo "${ECHO_T}pre-installed in \`dirname $LD_FOR_TARGET\`" >&6; } elif test "x$target" = "x$host"; then # We can use an host tool LD_FOR_TARGET='$(LD)' - echo "$ac_t""host tool" 1>&6 + { echo "$as_me:$LINENO: result: host tool" >&5 +echo "${ECHO_T}host tool" >&6; } else # We need a cross tool - echo "$ac_t""pre-installed" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed" >&5 +echo "${ECHO_T}pre-installed" >&6; } fi fi -echo $ac_n "checking where to find the target lipo""... $ac_c" 1>&6 -echo "configure:7113: checking where to find the target lipo" >&5 +{ echo "$as_me:$LINENO: checking where to find the target lipo" >&5 +echo $ECHO_N "checking where to find the target lipo... $ECHO_C" >&6; } if test "x${build}" != "x${host}" ; then if expr "x$LIPO_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path - echo "$ac_t""pre-installed in `dirname $LIPO_FOR_TARGET`" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed in \`dirname $LIPO_FOR_TARGET\`" >&5 +echo "${ECHO_T}pre-installed in \`dirname $LIPO_FOR_TARGET\`" >&6; } else # Canadian cross, just use what we found - echo "$ac_t""pre-installed" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed" >&5 +echo "${ECHO_T}pre-installed" >&6; } fi else if expr "x$LIPO_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path - echo "$ac_t""pre-installed in `dirname $LIPO_FOR_TARGET`" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed in \`dirname $LIPO_FOR_TARGET\`" >&5 +echo "${ECHO_T}pre-installed in \`dirname $LIPO_FOR_TARGET\`" >&6; } elif test "x$target" = "x$host"; then # We can use an host tool LIPO_FOR_TARGET='$(LIPO)' - echo "$ac_t""host tool" 1>&6 + { echo "$as_me:$LINENO: result: host tool" >&5 +echo "${ECHO_T}host tool" >&6; } else # We need a cross tool - echo "$ac_t""pre-installed" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed" >&5 +echo "${ECHO_T}pre-installed" >&6; } fi fi -echo $ac_n "checking where to find the target nm""... $ac_c" 1>&6 -echo "configure:7136: checking where to find the target nm" >&5 +{ echo "$as_me:$LINENO: checking where to find the target nm" >&5 +echo $ECHO_N "checking where to find the target nm... $ECHO_C" >&6; } if test "x${build}" != "x${host}" ; then if expr "x$NM_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path - echo "$ac_t""pre-installed in `dirname $NM_FOR_TARGET`" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed in \`dirname $NM_FOR_TARGET\`" >&5 +echo "${ECHO_T}pre-installed in \`dirname $NM_FOR_TARGET\`" >&6; } else # Canadian cross, just use what we found - echo "$ac_t""pre-installed" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed" >&5 +echo "${ECHO_T}pre-installed" >&6; } fi else ok=yes @@ -7147,32 +9857,38 @@ *" binutils "*) ;; *) ok=no ;; esac - + if test $ok = yes; then # An in-tree tool is available and we can use it NM_FOR_TARGET='$$r/$(HOST_SUBDIR)/binutils/nm-new' - echo "$ac_t""just compiled" 1>&6 + { echo "$as_me:$LINENO: result: just compiled" >&5 +echo "${ECHO_T}just compiled" >&6; } elif expr "x$NM_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path - echo "$ac_t""pre-installed in `dirname $NM_FOR_TARGET`" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed in \`dirname $NM_FOR_TARGET\`" >&5 +echo "${ECHO_T}pre-installed in \`dirname $NM_FOR_TARGET\`" >&6; } elif test "x$target" = "x$host"; then # We can use an host tool NM_FOR_TARGET='$(NM)' - echo "$ac_t""host tool" 1>&6 + { echo "$as_me:$LINENO: result: host tool" >&5 +echo "${ECHO_T}host tool" >&6; } else # We need a cross tool - echo "$ac_t""pre-installed" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed" >&5 +echo "${ECHO_T}pre-installed" >&6; } fi fi -echo $ac_n "checking where to find the target objdump""... $ac_c" 1>&6 -echo "configure:7169: checking where to find the target objdump" >&5 +{ echo "$as_me:$LINENO: checking where to find the target objdump" >&5 +echo $ECHO_N "checking where to find the target objdump... $ECHO_C" >&6; } if test "x${build}" != "x${host}" ; then if expr "x$OBJDUMP_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path - echo "$ac_t""pre-installed in `dirname $OBJDUMP_FOR_TARGET`" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed in \`dirname $OBJDUMP_FOR_TARGET\`" >&5 +echo "${ECHO_T}pre-installed in \`dirname $OBJDUMP_FOR_TARGET\`" >&6; } else # Canadian cross, just use what we found - echo "$ac_t""pre-installed" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed" >&5 +echo "${ECHO_T}pre-installed" >&6; } fi else ok=yes @@ -7180,32 +9896,38 @@ *" binutils "*) ;; *) ok=no ;; esac - + if test $ok = yes; then # An in-tree tool is available and we can use it OBJDUMP_FOR_TARGET='$$r/$(HOST_SUBDIR)/binutils/objdump' - echo "$ac_t""just compiled" 1>&6 + { echo "$as_me:$LINENO: result: just compiled" >&5 +echo "${ECHO_T}just compiled" >&6; } elif expr "x$OBJDUMP_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path - echo "$ac_t""pre-installed in `dirname $OBJDUMP_FOR_TARGET`" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed in \`dirname $OBJDUMP_FOR_TARGET\`" >&5 +echo "${ECHO_T}pre-installed in \`dirname $OBJDUMP_FOR_TARGET\`" >&6; } elif test "x$target" = "x$host"; then # We can use an host tool OBJDUMP_FOR_TARGET='$(OBJDUMP)' - echo "$ac_t""host tool" 1>&6 + { echo "$as_me:$LINENO: result: host tool" >&5 +echo "${ECHO_T}host tool" >&6; } else # We need a cross tool - echo "$ac_t""pre-installed" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed" >&5 +echo "${ECHO_T}pre-installed" >&6; } fi fi -echo $ac_n "checking where to find the target ranlib""... $ac_c" 1>&6 -echo "configure:7202: checking where to find the target ranlib" >&5 +{ echo "$as_me:$LINENO: checking where to find the target ranlib" >&5 +echo $ECHO_N "checking where to find the target ranlib... $ECHO_C" >&6; } if test "x${build}" != "x${host}" ; then if expr "x$RANLIB_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path - echo "$ac_t""pre-installed in `dirname $RANLIB_FOR_TARGET`" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed in \`dirname $RANLIB_FOR_TARGET\`" >&5 +echo "${ECHO_T}pre-installed in \`dirname $RANLIB_FOR_TARGET\`" >&6; } else # Canadian cross, just use what we found - echo "$ac_t""pre-installed" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed" >&5 +echo "${ECHO_T}pre-installed" >&6; } fi else ok=yes @@ -7213,32 +9935,38 @@ *" binutils "*) ;; *) ok=no ;; esac - + if test $ok = yes; then # An in-tree tool is available and we can use it RANLIB_FOR_TARGET='$$r/$(HOST_SUBDIR)/binutils/ranlib' - echo "$ac_t""just compiled" 1>&6 + { echo "$as_me:$LINENO: result: just compiled" >&5 +echo "${ECHO_T}just compiled" >&6; } elif expr "x$RANLIB_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path - echo "$ac_t""pre-installed in `dirname $RANLIB_FOR_TARGET`" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed in \`dirname $RANLIB_FOR_TARGET\`" >&5 +echo "${ECHO_T}pre-installed in \`dirname $RANLIB_FOR_TARGET\`" >&6; } elif test "x$target" = "x$host"; then # We can use an host tool RANLIB_FOR_TARGET='$(RANLIB)' - echo "$ac_t""host tool" 1>&6 + { echo "$as_me:$LINENO: result: host tool" >&5 +echo "${ECHO_T}host tool" >&6; } else # We need a cross tool - echo "$ac_t""pre-installed" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed" >&5 +echo "${ECHO_T}pre-installed" >&6; } fi fi -echo $ac_n "checking where to find the target strip""... $ac_c" 1>&6 -echo "configure:7235: checking where to find the target strip" >&5 +{ echo "$as_me:$LINENO: checking where to find the target strip" >&5 +echo $ECHO_N "checking where to find the target strip... $ECHO_C" >&6; } if test "x${build}" != "x${host}" ; then if expr "x$STRIP_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path - echo "$ac_t""pre-installed in `dirname $STRIP_FOR_TARGET`" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed in \`dirname $STRIP_FOR_TARGET\`" >&5 +echo "${ECHO_T}pre-installed in \`dirname $STRIP_FOR_TARGET\`" >&6; } else # Canadian cross, just use what we found - echo "$ac_t""pre-installed" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed" >&5 +echo "${ECHO_T}pre-installed" >&6; } fi else ok=yes @@ -7246,32 +9974,38 @@ *" binutils "*) ;; *) ok=no ;; esac - + if test $ok = yes; then # An in-tree tool is available and we can use it STRIP_FOR_TARGET='$$r/$(HOST_SUBDIR)/binutils/strip' - echo "$ac_t""just compiled" 1>&6 + { echo "$as_me:$LINENO: result: just compiled" >&5 +echo "${ECHO_T}just compiled" >&6; } elif expr "x$STRIP_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path - echo "$ac_t""pre-installed in `dirname $STRIP_FOR_TARGET`" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed in \`dirname $STRIP_FOR_TARGET\`" >&5 +echo "${ECHO_T}pre-installed in \`dirname $STRIP_FOR_TARGET\`" >&6; } elif test "x$target" = "x$host"; then # We can use an host tool STRIP_FOR_TARGET='$(STRIP)' - echo "$ac_t""host tool" 1>&6 + { echo "$as_me:$LINENO: result: host tool" >&5 +echo "${ECHO_T}host tool" >&6; } else # We need a cross tool - echo "$ac_t""pre-installed" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed" >&5 +echo "${ECHO_T}pre-installed" >&6; } fi fi -echo $ac_n "checking where to find the target windres""... $ac_c" 1>&6 -echo "configure:7268: checking where to find the target windres" >&5 +{ echo "$as_me:$LINENO: checking where to find the target windres" >&5 +echo $ECHO_N "checking where to find the target windres... $ECHO_C" >&6; } if test "x${build}" != "x${host}" ; then if expr "x$WINDRES_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path - echo "$ac_t""pre-installed in `dirname $WINDRES_FOR_TARGET`" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed in \`dirname $WINDRES_FOR_TARGET\`" >&5 +echo "${ECHO_T}pre-installed in \`dirname $WINDRES_FOR_TARGET\`" >&6; } else # Canadian cross, just use what we found - echo "$ac_t""pre-installed" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed" >&5 +echo "${ECHO_T}pre-installed" >&6; } fi else ok=yes @@ -7279,21 +10013,25 @@ *" binutils "*) ;; *) ok=no ;; esac - + if test $ok = yes; then # An in-tree tool is available and we can use it WINDRES_FOR_TARGET='$$r/$(HOST_SUBDIR)/binutils/windres' - echo "$ac_t""just compiled" 1>&6 + { echo "$as_me:$LINENO: result: just compiled" >&5 +echo "${ECHO_T}just compiled" >&6; } elif expr "x$WINDRES_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path - echo "$ac_t""pre-installed in `dirname $WINDRES_FOR_TARGET`" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed in \`dirname $WINDRES_FOR_TARGET\`" >&5 +echo "${ECHO_T}pre-installed in \`dirname $WINDRES_FOR_TARGET\`" >&6; } elif test "x$target" = "x$host"; then # We can use an host tool WINDRES_FOR_TARGET='$(WINDRES)' - echo "$ac_t""host tool" 1>&6 + { echo "$as_me:$LINENO: result: host tool" >&5 +echo "${ECHO_T}host tool" >&6; } else # We need a cross tool - echo "$ac_t""pre-installed" 1>&6 + { echo "$as_me:$LINENO: result: pre-installed" >&5 +echo "${ECHO_T}pre-installed" >&6; } fi fi @@ -7324,17 +10062,17 @@ -echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 -echo "configure:7329: checking whether to enable maintainer-specific portions of Makefiles" >&5 -# Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. +{ echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6; } +# Check whether --enable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then - enableval="$enable_maintainer_mode" - USE_MAINTAINER_MODE=$enableval + enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval else USE_MAINTAINER_MODE=no fi -echo "$ac_t""$USE_MAINTAINER_MODE" 1>&6 +{ echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5 +echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6; } if test "$USE_MAINTAINER_MODE" = yes; then @@ -7343,7 +10081,7 @@ else MAINTAINER_MODE_TRUE='#' MAINTAINER_MODE_FALSE= -fi +fi MAINT=$MAINTAINER_MODE_TRUE # --------------------- @@ -7367,49 +10105,77 @@ ;; esac +# LLVM LOCAL begin - LLVM uses inlined functions +if false ; then # This is aimed to mimic bootstrap with a non-GCC compiler to catch problems. if test "$GCC" = yes; then saved_CFLAGS="$CFLAGS" # Pass -fkeep-inline-functions for stage 1 if the GCC version supports it. CFLAGS="$CFLAGS -fkeep-inline-functions" - echo $ac_n "checking whether -fkeep-inline-functions is supported""... $ac_c" 1>&6 -echo "configure:7378: checking whether -fkeep-inline-functions is supported" >&5 - cat > conftest.$ac_ext <&5 +echo $ECHO_N "checking whether -fkeep-inline-functions is supported... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #if (__GNUC__ < 3) \ || (__GNUC__ == 3 && (__GNUC_MINOR__ < 3 \ || (__GNUC_MINOR__ == 3 && __GNUC_PATCHLEVEL__ < 1))) #error http://gcc.gnu.org/PR29382 #endif - -int main() { -; return 0; } -EOF -if { (eval echo configure:7393: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - echo "$ac_t""yes" 1>&6; stage1_cflags="$stage1_cflags -fkeep-inline-functions" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - echo "$ac_t""no" 1>&6 +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; }; stage1_cflags="$stage1_cflags -fkeep-inline-functions" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi -rm -f conftest* + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS="$saved_CFLAGS" fi +fi +# LLVM LOCAL end - LLVM uses inlined functions. # Enable --enable-checking in stage1 of the compiler. -# Check whether --enable-stage1-checking or --disable-stage1-checking was given. +# Check whether --enable-stage1-checking was given. if test "${enable_stage1_checking+set}" = set; then - enableval="$enable_stage1_checking" - stage1_checking=--enable-checking=${enable_stage1_checking} + enableval=$enable_stage1_checking; stage1_checking=--enable-checking=${enable_stage1_checking} else if test "x$enable_checking" = xno; then stage1_checking=--enable-checking @@ -7421,10 +10187,9 @@ # Enable -Werror in bootstrap stage2 and later. -# Check whether --enable-werror or --disable-werror was given. +# Check whether --enable-werror was given. if test "${enable_werror+set}" = set; then - enableval="$enable_werror" - : + enableval=$enable_werror; else if test -d gcc && test x"`cat $srcdir/gcc/DEV-PHASE`" = xexperimental; then enable_werror=yes @@ -7440,28 +10205,28 @@ # Flags needed to enable html installing and building -# Check whether --with-datarootdir or --without-datarootdir was given. + +# Check whether --with-datarootdir was given. if test "${with_datarootdir+set}" = set; then - withval="$with_datarootdir" - datarootdir="\${prefix}/${withval}" + withval=$with_datarootdir; datarootdir="\${prefix}/${withval}" else datarootdir="\${prefix}/share" fi -# Check whether --with-docdir or --without-docdir was given. + +# Check whether --with-docdir was given. if test "${with_docdir+set}" = set; then - withval="$with_docdir" - docdir="\${prefix}/${withval}" + withval=$with_docdir; docdir="\${prefix}/${withval}" else docdir="\${datarootdir}/doc" fi -# Check whether --with-htmldir or --without-htmldir was given. + +# Check whether --with-htmldir was given. if test "${with_htmldir+set}" = set; then - withval="$with_htmldir" - htmldir="\${prefix}/${withval}" + withval=$with_htmldir; htmldir="\${prefix}/${withval}" else htmldir="\${docdir}" fi @@ -7471,365 +10236,1169 @@ -trap '' 1 2 15 -cat > confcache <<\EOF +ac_config_files="$ac_config_files Makefile" + +cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure -# scripts and configure runs. It is not useful on other systems. -# If it contains results you don't want to keep, you may remove or edit it. +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. # -# By default, configure uses ./config.cache as the cache file, -# creating it if it does not exist already. You can give configure -# the --cache-file=FILE option to use a different cache file; that is -# what configure does when it calls configure scripts in -# subdirectories, so they share the cache. -# Giving --cache-file=/dev/null disables caching, for debugging configure. -# config.status only pays attention to the cache file if you give it the -# --recheck option to rerun configure. +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. # -EOF +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. -# So, don't put newlines in cache variables' values. +# So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. -(set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote substitution - # turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - -e "s/'/'\\\\''/g" \ - -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' - ;; - esac >> confcache -if cmp -s $cache_file confcache; then - : -else - if test -w $cache_file; then - echo "updating cache $cache_file" - cat confcache > $cache_file +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 +echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + *) $as_unset $ac_var ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + test "x$cache_file" != "x/dev/null" && + { echo "$as_me:$LINENO: updating cache $cache_file" >&5 +echo "$as_me: updating cache $cache_file" >&6;} + cat confcache >$cache_file else - echo "not updating unwritable cache $cache_file" + { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 +echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' -# Any assignment to VPATH causes Sun make to only execute -# the first set of double-colon rules, so remove it if not needed. -# If there is a colon in the path, we need to keep it. -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' -fi - -trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 - # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. -cat > conftest.defs <<\EOF -s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g -s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g -s%\[%\\&%g -s%\]%\\&%g -s%\$%$$%g -EOF -DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` -rm -f conftest.defs +# +# If the first sed substitution is executed (which looks for macros that +# take arguments), then branch to the quote section. Otherwise, +# look for a macro that doesn't take arguments. +ac_script=' +t clear +:clear +s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g +t quote +s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g +t quote +b any +:quote +s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g +s/\[/\\&/g +s/\]/\\&/g +s/\$/$$/g +H +:any +${ + g + s/^\n// + s/\n/ /g + p +} +' +DEFS=`sed -n "$ac_script" confdefs.h` + + +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs +LTLIBOBJS=$ac_ltlibobjs -# Without the "./", some shells look in PATH for config.status. -: ${CONFIG_STATUS=./config.status} -echo creating $CONFIG_STATUS -rm -f $CONFIG_STATUS -cat > $CONFIG_STATUS <&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated by $as_me. # Run this file to recreate the current configuration. -# This directory was configured as follows, -# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# -# $0 $ac_configure_args -# # Compiler output produced by configure, useful for debugging -# configure, is in ./config.log if it exists. +# configure, is in config.log if it exists. -ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" -for ac_option +debug=false +ac_cs_recheck=false +ac_cs_silent=false +SHELL=\${CONFIG_SHELL-$SHELL} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + + + +# PATH needs CR +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +as_nl=' +' +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME do - case "\$ac_option" in + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# CDPATH. +$as_unset CDPATH + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # scripts with optimization help from Paolo Bonzini. Blame Lee + # E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; +esac + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir +fi +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 + +# Save the log message, to keep $[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by $as_me, which was +generated by GNU Autoconf 2.61. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +# Files that config.status was made for. +config_files="$ac_config_files" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + +Configuration files: +$config_files + +Report bugs to ." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +config.status +configured by $0, generated by GNU Autoconf 2.61, + with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" + +Copyright (C) 2006 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" - exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; - -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.13" - exit 0 ;; - -help | --help | --hel | --he | --h) - echo "\$ac_cs_usage"; exit 0 ;; - *) echo "\$ac_cs_usage"; exit 1 ;; + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + echo "$ac_cs_version"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --he | --h | --help | --hel | -h ) + echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +if \$ac_cs_recheck; then + echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + CONFIG_SHELL=$SHELL + export CONFIG_SHELL + exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; esac done -ac_given_srcdir=$srcdir -ac_given_INSTALL="$INSTALL" -trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 -EOF -cat >> $CONFIG_STATUS </dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} -# Protect against being on the right side of a sed subst in config.status. -sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; - s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF -$ac_vpsub -$extrasub -s%@SHELL@%$SHELL%g -s%@CFLAGS@%$CFLAGS%g -s%@CPPFLAGS@%$CPPFLAGS%g -s%@CXXFLAGS@%$CXXFLAGS%g -s%@FFLAGS@%$FFLAGS%g -s%@DEFS@%$DEFS%g -s%@LDFLAGS@%$LDFLAGS%g -s%@LIBS@%$LIBS%g -s%@exec_prefix@%$exec_prefix%g -s%@prefix@%$prefix%g -s%@program_transform_name@%$program_transform_name%g -s%@bindir@%$bindir%g -s%@sbindir@%$sbindir%g -s%@libexecdir@%$libexecdir%g -s%@datadir@%$datadir%g -s%@sysconfdir@%$sysconfdir%g -s%@sharedstatedir@%$sharedstatedir%g -s%@localstatedir@%$localstatedir%g -s%@libdir@%$libdir%g -s%@includedir@%$includedir%g -s%@oldincludedir@%$oldincludedir%g -s%@infodir@%$infodir%g -s%@mandir@%$mandir%g -s%@host@%$host%g -s%@host_alias@%$host_alias%g -s%@host_cpu@%$host_cpu%g -s%@host_vendor@%$host_vendor%g -s%@host_os@%$host_os%g -s%@target@%$target%g -s%@target_alias@%$target_alias%g -s%@target_cpu@%$target_cpu%g -s%@target_vendor@%$target_vendor%g -s%@target_os@%$target_os%g -s%@build@%$build%g -s%@build_alias@%$build_alias%g -s%@build_cpu@%$build_cpu%g -s%@build_vendor@%$build_vendor%g -s%@build_os@%$build_os%g -s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g -s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g -s%@INSTALL_DATA@%$INSTALL_DATA%g -s%@LN@%$LN%g -s%@LN_S@%$LN_S%g -s%@TOPLEVEL_CONFIGURE_ARGUMENTS@%$TOPLEVEL_CONFIGURE_ARGUMENTS%g -s%@build_libsubdir@%$build_libsubdir%g -s%@build_subdir@%$build_subdir%g -s%@host_subdir@%$host_subdir%g -s%@target_subdir@%$target_subdir%g -s%@CC@%$CC%g -s%@GNATBIND@%$GNATBIND%g -s%@do_compare@%$do_compare%g -s%@gmplibs@%$gmplibs%g -s%@gmpinc@%$gmpinc%g -s%@stage1_languages@%$stage1_languages%g -s%@SYSROOT_CFLAGS_FOR_TARGET@%$SYSROOT_CFLAGS_FOR_TARGET%g -/@serialization_dependencies@/r $serialization_dependencies -s%@serialization_dependencies@%%g -/@host_makefile_frag@/r $host_makefile_frag -s%@host_makefile_frag@%%g -/@target_makefile_frag@/r $target_makefile_frag -s%@target_makefile_frag@%%g -/@alphaieee_frag@/r $alphaieee_frag -s%@alphaieee_frag@%%g -/@ospace_frag@/r $ospace_frag -s%@ospace_frag@%%g -s%@RPATH_ENVVAR@%$RPATH_ENVVAR%g -s%@tooldir@%$tooldir%g -s%@build_tooldir@%$build_tooldir%g -s%@CONFIGURE_GDB_TK@%$CONFIGURE_GDB_TK%g -s%@GDB_TK@%$GDB_TK%g -s%@INSTALL_GDB_TK@%$INSTALL_GDB_TK%g -s%@build_configargs@%$build_configargs%g -s%@build_configdirs@%$build_configdirs%g -s%@host_configargs@%$host_configargs%g -s%@configdirs@%$configdirs%g -s%@target_configargs@%$target_configargs%g -s%@CC_FOR_BUILD@%$CC_FOR_BUILD%g -s%@config_shell@%$config_shell%g -s%@YACC@%$YACC%g -s%@BISON@%$BISON%g -s%@M4@%$M4%g -s%@LEX@%$LEX%g -s%@FLEX@%$FLEX%g -s%@MAKEINFO@%$MAKEINFO%g -s%@EXPECT@%$EXPECT%g -s%@RUNTEST@%$RUNTEST%g -s%@AR@%$AR%g -s%@AS@%$AS%g -s%@DLLTOOL@%$DLLTOOL%g -s%@LD@%$LD%g -s%@LIPO@%$LIPO%g -s%@NM@%$NM%g -s%@RANLIB@%$RANLIB%g -s%@STRIP@%$STRIP%g -s%@WINDRES@%$WINDRES%g -s%@OBJCOPY@%$OBJCOPY%g -s%@OBJDUMP@%$OBJDUMP%g -s%@CXX@%$CXX%g -s%@CFLAGS_FOR_BUILD@%$CFLAGS_FOR_BUILD%g -s%@CC_FOR_TARGET@%$CC_FOR_TARGET%g -s%@CXX_FOR_TARGET@%$CXX_FOR_TARGET%g -s%@GCC_FOR_TARGET@%$GCC_FOR_TARGET%g -s%@GCJ_FOR_TARGET@%$GCJ_FOR_TARGET%g -s%@GFORTRAN_FOR_TARGET@%$GFORTRAN_FOR_TARGET%g -s%@AR_FOR_TARGET@%$AR_FOR_TARGET%g -s%@AS_FOR_TARGET@%$AS_FOR_TARGET%g -s%@DLLTOOL_FOR_TARGET@%$DLLTOOL_FOR_TARGET%g -s%@LD_FOR_TARGET@%$LD_FOR_TARGET%g -s%@LIPO_FOR_TARGET@%$LIPO_FOR_TARGET%g -s%@NM_FOR_TARGET@%$NM_FOR_TARGET%g -s%@OBJDUMP_FOR_TARGET@%$OBJDUMP_FOR_TARGET%g -s%@RANLIB_FOR_TARGET@%$RANLIB_FOR_TARGET%g -s%@STRIP_FOR_TARGET@%$STRIP_FOR_TARGET%g -s%@WINDRES_FOR_TARGET@%$WINDRES_FOR_TARGET%g -s%@FLAGS_FOR_TARGET@%$FLAGS_FOR_TARGET%g -s%@RAW_CXX_FOR_TARGET@%$RAW_CXX_FOR_TARGET%g -s%@COMPILER_AS_FOR_TARGET@%$COMPILER_AS_FOR_TARGET%g -s%@COMPILER_LD_FOR_TARGET@%$COMPILER_LD_FOR_TARGET%g -s%@COMPILER_NM_FOR_TARGET@%$COMPILER_NM_FOR_TARGET%g -s%@MAINTAINER_MODE_TRUE@%$MAINTAINER_MODE_TRUE%g -s%@MAINTAINER_MODE_FALSE@%$MAINTAINER_MODE_FALSE%g -s%@MAINT@%$MAINT%g -s%@stage1_cflags@%$stage1_cflags%g -s%@stage1_checking@%$stage1_checking%g -s%@stage2_werror_flag@%$stage2_werror_flag%g -s%@datarootdir@%$datarootdir%g -s%@docdir@%$docdir%g -s%@htmldir@%$htmldir%g +# +# Set up the sed scripts for CONFIG_FILES section. +# -CEOF -EOF +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "$CONFIG_FILES"; then + +_ACEOF + +# Create sed commands to just substitute file output variables. + +# Remaining file output variables are in a fragment that also has non-file +# output varibles. + + + +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + cat >conf$$subs.sed <<_ACEOF +SHELL!$SHELL$ac_delim +PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim +PACKAGE_NAME!$PACKAGE_NAME$ac_delim +PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim +PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim +PACKAGE_STRING!$PACKAGE_STRING$ac_delim +PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim +exec_prefix!$exec_prefix$ac_delim +prefix!$prefix$ac_delim +program_transform_name!$program_transform_name$ac_delim +bindir!$bindir$ac_delim +sbindir!$sbindir$ac_delim +libexecdir!$libexecdir$ac_delim +datarootdir!$datarootdir$ac_delim +datadir!$datadir$ac_delim +sysconfdir!$sysconfdir$ac_delim +sharedstatedir!$sharedstatedir$ac_delim +localstatedir!$localstatedir$ac_delim +includedir!$includedir$ac_delim +oldincludedir!$oldincludedir$ac_delim +docdir!$docdir$ac_delim +infodir!$infodir$ac_delim +htmldir!$htmldir$ac_delim +dvidir!$dvidir$ac_delim +pdfdir!$pdfdir$ac_delim +psdir!$psdir$ac_delim +libdir!$libdir$ac_delim +localedir!$localedir$ac_delim +mandir!$mandir$ac_delim +DEFS!$DEFS$ac_delim +ECHO_C!$ECHO_C$ac_delim +ECHO_N!$ECHO_N$ac_delim +ECHO_T!$ECHO_T$ac_delim +LIBS!$LIBS$ac_delim +build_alias!$build_alias$ac_delim +host_alias!$host_alias$ac_delim +target_alias!$target_alias$ac_delim +build!$build$ac_delim +build_cpu!$build_cpu$ac_delim +build_vendor!$build_vendor$ac_delim +build_os!$build_os$ac_delim +host!$host$ac_delim +host_cpu!$host_cpu$ac_delim +host_vendor!$host_vendor$ac_delim +host_os!$host_os$ac_delim +target!$target$ac_delim +target_cpu!$target_cpu$ac_delim +target_vendor!$target_vendor$ac_delim +target_os!$target_os$ac_delim +INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim +INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim +INSTALL_DATA!$INSTALL_DATA$ac_delim +LN!$LN$ac_delim +LN_S!$LN_S$ac_delim +TOPLEVEL_CONFIGURE_ARGUMENTS!$TOPLEVEL_CONFIGURE_ARGUMENTS$ac_delim +build_libsubdir!$build_libsubdir$ac_delim +build_subdir!$build_subdir$ac_delim +host_subdir!$host_subdir$ac_delim +target_subdir!$target_subdir$ac_delim +CC!$CC$ac_delim +CFLAGS!$CFLAGS$ac_delim +LDFLAGS!$LDFLAGS$ac_delim +CPPFLAGS!$CPPFLAGS$ac_delim +ac_ct_CC!$ac_ct_CC$ac_delim +EXEEXT!$EXEEXT$ac_delim +OBJEXT!$OBJEXT$ac_delim +GNATBIND!$GNATBIND$ac_delim +do_compare!$do_compare$ac_delim +gmplibs!$gmplibs$ac_delim +gmpinc!$gmpinc$ac_delim +stage1_languages!$stage1_languages$ac_delim +SYSROOT_CFLAGS_FOR_TARGET!$SYSROOT_CFLAGS_FOR_TARGET$ac_delim +RPATH_ENVVAR!$RPATH_ENVVAR$ac_delim +tooldir!$tooldir$ac_delim +build_tooldir!$build_tooldir$ac_delim +CONFIGURE_GDB_TK!$CONFIGURE_GDB_TK$ac_delim +GDB_TK!$GDB_TK$ac_delim +INSTALL_GDB_TK!$INSTALL_GDB_TK$ac_delim +build_configargs!$build_configargs$ac_delim +build_configdirs!$build_configdirs$ac_delim +host_configargs!$host_configargs$ac_delim +configdirs!$configdirs$ac_delim +_ACEOF -cat >> $CONFIG_STATUS <<\EOF + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 82; then + break + elif $ac_last_try; then + { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done -# Split the substitutions into bite-sized pieces for seds with -# small command number limits, like on Digital OSF/1 and HP-UX. -ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. -ac_file=1 # Number of current file. -ac_beg=1 # First line for current file. -ac_end=$ac_max_sed_cmds # Line after last line for current file. -ac_more_lines=: -ac_sed_cmds="" -while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file - else - sed "${ac_end}q" conftest.subs > conftest.s$ac_file - fi - if test ! -s conftest.s$ac_file; then - ac_more_lines=false - rm -f conftest.s$ac_file +ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` +if test -n "$ac_eof"; then + ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` + ac_eof=`expr $ac_eof + 1` +fi + +cat >>$CONFIG_STATUS <<_ACEOF +cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +/^[ ]*@serialization_dependencies@[ ]*$/{ +r $serialization_dependencies +d +} +/^[ ]*@host_makefile_frag@[ ]*$/{ +r $host_makefile_frag +d +} +/^[ ]*@target_makefile_frag@[ ]*$/{ +r $target_makefile_frag +d +} +/^[ ]*@alphaieee_frag@[ ]*$/{ +r $alphaieee_frag +d +} +/^[ ]*@ospace_frag@[ ]*$/{ +r $ospace_frag +d +} +_ACEOF +sed ' +s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g +s/^/s,@/; s/!/@,|#_!!_#|/ +:n +t n +s/'"$ac_delim"'$/,g/; t +s/$/\\/; p +N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n +' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF +CEOF$ac_eof +_ACEOF + + +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + cat >conf$$subs.sed <<_ACEOF +target_configargs!$target_configargs$ac_delim +CC_FOR_BUILD!$CC_FOR_BUILD$ac_delim +config_shell!$config_shell$ac_delim +YACC!$YACC$ac_delim +BISON!$BISON$ac_delim +M4!$M4$ac_delim +LEX!$LEX$ac_delim +FLEX!$FLEX$ac_delim +MAKEINFO!$MAKEINFO$ac_delim +EXPECT!$EXPECT$ac_delim +RUNTEST!$RUNTEST$ac_delim +AR!$AR$ac_delim +AS!$AS$ac_delim +DLLTOOL!$DLLTOOL$ac_delim +LD!$LD$ac_delim +LIPO!$LIPO$ac_delim +NM!$NM$ac_delim +RANLIB!$RANLIB$ac_delim +STRIP!$STRIP$ac_delim +WINDRES!$WINDRES$ac_delim +OBJCOPY!$OBJCOPY$ac_delim +OBJDUMP!$OBJDUMP$ac_delim +CXX!$CXX$ac_delim +CFLAGS_FOR_BUILD!$CFLAGS_FOR_BUILD$ac_delim +CXXFLAGS!$CXXFLAGS$ac_delim +CC_FOR_TARGET!$CC_FOR_TARGET$ac_delim +CXX_FOR_TARGET!$CXX_FOR_TARGET$ac_delim +GCC_FOR_TARGET!$GCC_FOR_TARGET$ac_delim +GCJ_FOR_TARGET!$GCJ_FOR_TARGET$ac_delim +GFORTRAN_FOR_TARGET!$GFORTRAN_FOR_TARGET$ac_delim +AR_FOR_TARGET!$AR_FOR_TARGET$ac_delim +AS_FOR_TARGET!$AS_FOR_TARGET$ac_delim +DLLTOOL_FOR_TARGET!$DLLTOOL_FOR_TARGET$ac_delim +LD_FOR_TARGET!$LD_FOR_TARGET$ac_delim +LIPO_FOR_TARGET!$LIPO_FOR_TARGET$ac_delim +NM_FOR_TARGET!$NM_FOR_TARGET$ac_delim +OBJDUMP_FOR_TARGET!$OBJDUMP_FOR_TARGET$ac_delim +RANLIB_FOR_TARGET!$RANLIB_FOR_TARGET$ac_delim +STRIP_FOR_TARGET!$STRIP_FOR_TARGET$ac_delim +WINDRES_FOR_TARGET!$WINDRES_FOR_TARGET$ac_delim +FLAGS_FOR_TARGET!$FLAGS_FOR_TARGET$ac_delim +RAW_CXX_FOR_TARGET!$RAW_CXX_FOR_TARGET$ac_delim +COMPILER_AS_FOR_TARGET!$COMPILER_AS_FOR_TARGET$ac_delim +COMPILER_LD_FOR_TARGET!$COMPILER_LD_FOR_TARGET$ac_delim +COMPILER_NM_FOR_TARGET!$COMPILER_NM_FOR_TARGET$ac_delim +MAINTAINER_MODE_TRUE!$MAINTAINER_MODE_TRUE$ac_delim +MAINTAINER_MODE_FALSE!$MAINTAINER_MODE_FALSE$ac_delim +MAINT!$MAINT$ac_delim +stage1_cflags!$stage1_cflags$ac_delim +stage1_checking!$stage1_checking$ac_delim +stage2_werror_flag!$stage2_werror_flag$ac_delim +LIBOBJS!$LIBOBJS$ac_delim +LTLIBOBJS!$LTLIBOBJS$ac_delim +_ACEOF + + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 53; then + break + elif $ac_last_try; then + { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } else - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f conftest.s$ac_file" - else - ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" - fi - ac_file=`expr $ac_file + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_cmds` + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done -if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat + +ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` +if test -n "$ac_eof"; then + ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` + ac_eof=`expr $ac_eof + 1` +fi + +cat >>$CONFIG_STATUS <<_ACEOF +cat >"\$tmp/subs-2.sed" <<\CEOF$ac_eof +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end +_ACEOF +sed ' +s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g +s/^/s,@/; s/!/@,|#_!!_#|/ +:n +t n +s/'"$ac_delim"'$/,g/; t +s/$/\\/; p +N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n +' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF +:end +s/|#_!!_#|//g +CEOF$ac_eof +_ACEOF + + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/ +s/:*\${srcdir}:*/:/ +s/:*@srcdir@:*/:/ +s/^\([^=]*=[ ]*\):*/\1/ +s/:*$// +s/^[^=]*=[ ]*$// +}' fi -EOF -cat >> $CONFIG_STATUS <>$CONFIG_STATUS <<\_ACEOF +fi # test -n "$CONFIG_FILES" -CONFIG_FILES=\${CONFIG_FILES-"Makefile"} -EOF -cat >> $CONFIG_STATUS <<\EOF -for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` - ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - *) ac_file_in="${ac_file}.in" ;; - esac - - # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. - - # Remove last slash and all that follows it. Not all systems have dirname. - ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` - if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - # The file is in a subdirectory. - test ! -d "$ac_dir" && mkdir "$ac_dir" - ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" - # A "../" for each directory in $ac_dir_suffix. - ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` - else - ac_dir_suffix= ac_dots= - fi - - case "$ac_given_srcdir" in - .) srcdir=. - if test -z "$ac_dots"; then top_srcdir=. - else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; - /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; - *) # Relative path. - srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" - top_srcdir="$ac_dots$ac_given_srcdir" ;; - esac - - case "$ac_given_INSTALL" in - [/$]*) INSTALL="$ac_given_INSTALL" ;; - *) INSTALL="$ac_dots$ac_given_INSTALL" ;; - esac - - echo creating "$ac_file" - rm -f "$ac_file" - configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." - case "$ac_file" in - *Makefile*) ac_comsub="1i\\ -# $configure_input" ;; - *) ac_comsub= ;; - esac - - ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` - sed -e "$ac_comsub -s%@configure_input@%$configure_input%g -s%@srcdir@%$srcdir%g -s%@top_srcdir@%$top_srcdir%g -s%@INSTALL@%$INSTALL%g -" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file -fi; done -rm -f conftest.s* -EOF -cat >> $CONFIG_STATUS <&5 +echo "$as_me: error: Invalid tag $ac_tag." >&2;} + { (exit 1); exit 1; }; };; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift -EOF -cat >> $CONFIG_STATUS <<\EOF + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 +echo "$as_me: error: cannot find input file: $ac_f" >&2;} + { (exit 1); exit 1; }; };; + esac + ac_file_inputs="$ac_file_inputs $ac_f" + done -exit 0 -EOF + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input="Generated from "`IFS=: + echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + fi + + case $ac_tag in + *:-:* | *:-) cat >"$tmp/stdin";; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + { as_dir="$ac_dir" + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +echo "$as_me: error: cannot create directory $as_dir" >&2;} + { (exit 1); exit 1; }; }; } + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= + +case `sed -n '/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p +' $ac_file_inputs` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s&@configure_input@&$configure_input&;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +$ac_datarootdir_hack +" $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&5 +echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&2;} + + rm -f "$tmp/stdin" + case $ac_file in + -) cat "$tmp/out"; rm -f "$tmp/out";; + *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; + esac + ;; + + + + esac + +done # for ac_tag + + +{ (exit 0); exit 0; } +_ACEOF chmod +x $CONFIG_STATUS -rm -fr confdefs* $ac_clean_files -test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 +ac_clean_files=$ac_clean_files_save + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi Modified: llvm-gcc-4.2/trunk/configure.in URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/configure.in?rev=43655&r1=43654&r2=43655&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/configure.in (original) +++ llvm-gcc-4.2/trunk/configure.in Fri Nov 2 20:01:16 2007 @@ -2424,6 +2424,8 @@ ;; esac +# LLVM LOCAL begin - LLVM uses inlined functions +if false ; then # This is aimed to mimic bootstrap with a non-GCC compiler to catch problems. if test "$GCC" = yes; then saved_CFLAGS="$CFLAGS" @@ -2443,6 +2445,8 @@ CFLAGS="$saved_CFLAGS" fi +fi +# LLVM LOCAL end - LLVM uses inlined functions. AC_SUBST(stage1_cflags) From isanbard at gmail.com Fri Nov 2 20:05:03 2007 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 03 Nov 2007 01:05:03 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r43656 - in /llvm-gcc-4.2/trunk/gcc: Makefile.in c-common.c config/rs6000/rs6000.c configure configure.ac cp/except.c passes.c varasm.c Message-ID: <200711030105.lA3154of019851@zion.cs.uiuc.edu> Author: void Date: Fri Nov 2 20:05:03 2007 New Revision: 43656 URL: http://llvm.org/viewvc/llvm-project?rev=43656&view=rev Log: configure: - Use "-Wno-overlength-strings" to silence a warning during bootstrapping. except.c: - Not having a prototype causes a warning. varasm.c & c-common.c: - "warning" takes an int as its first argument. Makefile.in: - We don't need cse.o. passes.c: - Don't emit a warning for the lack of a print_rtl_slim_with_bb function. rs6000.c: - Comment out prototypes which don't have definitions. Modified: llvm-gcc-4.2/trunk/gcc/Makefile.in llvm-gcc-4.2/trunk/gcc/c-common.c llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.c llvm-gcc-4.2/trunk/gcc/configure llvm-gcc-4.2/trunk/gcc/configure.ac llvm-gcc-4.2/trunk/gcc/cp/except.c llvm-gcc-4.2/trunk/gcc/passes.c llvm-gcc-4.2/trunk/gcc/varasm.c Modified: llvm-gcc-4.2/trunk/gcc/Makefile.in URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/Makefile.in?rev=43656&r1=43655&r2=43656&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/Makefile.in (original) +++ llvm-gcc-4.2/trunk/gcc/Makefile.in Fri Nov 2 20:05:03 2007 @@ -1174,7 +1174,9 @@ ddg.o haifa-sched.o modulo-sched.o, $(OBJS-common)) # Remove other random RTL optimizations. -OBJS-common := $(filter-out bt-load.o caller-save.o combine.o cse.o ifcvt.o \ +#OBJS-common := $(filter-out bt-load.o caller-save.o combine.o cse.o ifcvt.o \ +# simplify-rtx.o, $(OBJS-common)) +OBJS-common := $(filter-out bt-load.o caller-save.o combine.o ifcvt.o \ simplify-rtx.o, $(OBJS-common)) # LLVM LOCAL begin - Remove gcse.o Modified: llvm-gcc-4.2/trunk/gcc/c-common.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-common.c?rev=43656&r1=43655&r2=43656&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/c-common.c (original) +++ llvm-gcc-4.2/trunk/gcc/c-common.c Fri Nov 2 20:05:03 2007 @@ -6080,7 +6080,7 @@ if (!TYPE_P (*node) || !POINTER_TYPE_P (*node)) { - warning ("%qs attribute ignored", IDENTIFIER_POINTER (name)); + warning (0, "%qs attribute ignored", IDENTIFIER_POINTER (name)); *no_add_attrs = true; } Modified: llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.c?rev=43656&r1=43655&r2=43656&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.c (original) +++ llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.c Fri Nov 2 20:05:03 2007 @@ -682,11 +682,15 @@ /* LLVM LOCAL - Disable scheduler. */ #endif static bool rs6000_rtx_costs (rtx, int, int, int *); +/* LLVM LOCAL begin - Not defined */ +#ifndef ENABLE_LLVM static int rs6000_adjust_cost (rtx, rtx, rtx, int); static bool is_microcoded_insn (rtx); static int is_dispatch_slot_restricted (rtx); static bool is_cracked_insn (rtx); static bool is_branch_slot_insn (rtx); +#endif +/* LLVM LOCAL end - Not defined */ /* LLVM LOCAL - Disable scheduler. */ #ifndef ENABLE_LLVM static int rs6000_adjust_priority (rtx, int); Modified: llvm-gcc-4.2/trunk/gcc/configure URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/configure?rev=43656&r1=43655&r2=43656&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/configure (original) +++ llvm-gcc-4.2/trunk/gcc/configure Fri Nov 2 20:05:03 2007 @@ -6255,7 +6255,7 @@ if test $ac_cv_prog_cc_w_no_long_long = yes \ && test $ac_cv_prog_cc_w_no_variadic_macros = yes \ && test $ac_cv_prog_cc_w_no_overlength_strings = yes ; then - strict1_warn="-pedantic -Wno-long-long -Wno-variadic-macros" + strict1_warn="-pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings" fi # Add -Wold-style-definition if it's accepted Modified: llvm-gcc-4.2/trunk/gcc/configure.ac URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/configure.ac?rev=43656&r1=43655&r2=43656&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/configure.ac (original) +++ llvm-gcc-4.2/trunk/gcc/configure.ac Fri Nov 2 20:05:03 2007 @@ -353,7 +353,8 @@ if test $ac_cv_prog_cc_w_no_long_long = yes \ && test $ac_cv_prog_cc_w_no_variadic_macros = yes \ && test $ac_cv_prog_cc_w_no_overlength_strings = yes ; then - strict1_warn="-pedantic -Wno-long-long -Wno-variadic-macros" + && test $ac_cv_prog_cc_w_no_overlength_strings = yes ; then + strict1_warn="-pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings" fi # Add -Wold-style-definition if it's accepted Modified: llvm-gcc-4.2/trunk/gcc/cp/except.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/except.c?rev=43656&r1=43655&r2=43656&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/cp/except.c (original) +++ llvm-gcc-4.2/trunk/gcc/cp/except.c Fri Nov 2 20:05:03 2007 @@ -58,6 +58,7 @@ /* LLVM local begin */ /* Do nothing (return NULL_TREE). */ +static tree return_null_tree (void); tree return_null_tree (void) Modified: llvm-gcc-4.2/trunk/gcc/passes.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/passes.c?rev=43656&r1=43655&r2=43656&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/passes.c (original) +++ llvm-gcc-4.2/trunk/gcc/passes.c Fri Nov 2 20:05:03 2007 @@ -813,13 +813,14 @@ dump_file, dump_flags); else { +#ifndef ENABLE_LLVM if (dump_flags & TDF_SLIM) print_rtl_slim_with_bb (dump_file, get_insns (), dump_flags); else if ((curr_properties & PROP_cfg) && (dump_flags & TDF_BLOCKS)) print_rtl_with_bb (dump_file, get_insns ()); else print_rtl (dump_file, get_insns ()); - +#endif if (curr_properties & PROP_cfg && graph_dump_format != no_graph && (dump_flags & TDF_GRAPH)) Modified: llvm-gcc-4.2/trunk/gcc/varasm.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/varasm.c?rev=43656&r1=43655&r2=43656&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/varasm.c (original) +++ llvm-gcc-4.2/trunk/gcc/varasm.c Fri Nov 2 20:05:03 2007 @@ -5179,7 +5179,7 @@ target_decl = find_decl_and_mark_needed (p->decl, p->target); #ifdef TARGET_DOES_NOT_SUPPORT_ALIAS_DEFINITIONS if (target_decl) - warning ("%Jalias definitions not supported; ignored", target_decl); + warning (0, "%Jalias definitions not supported; ignored", target_decl); #else emit_alias_to_llvm(p->decl, p->target, target_decl); #endif @@ -5266,9 +5266,9 @@ if (target_decl && TREE_ASM_WRITTEN (target_decl)) #ifdef ENABLE_LLVM #ifdef TARGET_DOES_NOT_SUPPORT_ALIAS_DEFINITIONS - warning ("%Jalias definitions not supported; ignored", target_decl); + warning (0, "%Jalias definitions not supported; ignored", target_decl); #else - emit_alias_to_llvm(decl, target, target_decl); + emit_alias_to_llvm(decl, target, target_decl); #endif #else do_assemble_alias (decl, target); From isanbard at gmail.com Fri Nov 2 20:09:08 2007 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 03 Nov 2007 01:09:08 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r43657 - /llvm-gcc-4.2/trunk/gcc/Makefile.in Message-ID: <200711030109.lA3198ow020014@zion.cs.uiuc.edu> Author: void Date: Fri Nov 2 20:09:08 2007 New Revision: 43657 URL: http://llvm.org/viewvc/llvm-project?rev=43657&view=rev Log: Remove the -Wno-overlength-strings flag from C++ compiles Modified: llvm-gcc-4.2/trunk/gcc/Makefile.in Modified: llvm-gcc-4.2/trunk/gcc/Makefile.in URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/Makefile.in?rev=43657&r1=43656&r2=43657&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/Makefile.in (original) +++ llvm-gcc-4.2/trunk/gcc/Makefile.in Fri Nov 2 20:09:08 2007 @@ -936,7 +936,7 @@ # LLVM LOCAL begin # Disable C-only warning flags if they are present. ALL_CXXFLAGS = $(filter-out -Wstrict-prototypes -Wmissing-prototypes \ - -Wold-style-definition, $(ALL_CFLAGS)) -Wno-unused + -Wold-style-definition -Wno-overlength-strings, $(ALL_CFLAGS)) -Wno-unused ALL_CXXFLAGS += -DTARGET_NAME=\"$(target_noncanonical)\" # Turn off LLVM assertions in a non-checking build. @@ -1174,8 +1174,6 @@ ddg.o haifa-sched.o modulo-sched.o, $(OBJS-common)) # Remove other random RTL optimizations. -#OBJS-common := $(filter-out bt-load.o caller-save.o combine.o cse.o ifcvt.o \ -# simplify-rtx.o, $(OBJS-common)) OBJS-common := $(filter-out bt-load.o caller-save.o combine.o ifcvt.o \ simplify-rtx.o, $(OBJS-common)) From isanbard at gmail.com Fri Nov 2 20:22:47 2007 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 2 Nov 2007 18:22:47 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r43655 - in /llvm-gcc-4.2/trunk: configure configure.in In-Reply-To: <200711030101.lA311GN4019683@zion.cs.uiuc.edu> References: <200711030101.lA311GN4019683@zion.cs.uiuc.edu> Message-ID: <16e5fdf90711021822j58cc35c1t9b43d055c3f65186@mail.gmail.com> On 11/2/07, Bill Wendling wrote: > Author: void > Date: Fri Nov 2 20:01:16 2007 > New Revision: 43655 > > URL: http://llvm.org/viewvc/llvm-project?rev=43655&view=rev > Log: > Remove the use of the "-fkeep-inline-functions" flag. LLVM inlines > everything, and, because some files here use LLVM headers and those > headers have inlined functions in them, keeping them non-inlined in > the LLVM-GCC part results in undefined symbol problems. > Some clarification. I was getting "undefined symbols" errors when compiling LLVM-GCC 4.2 the "Apple way" for these methods: inline void PATypeHandle::addUser() { assert(Ty && "Type Handle has a null type!"); if (Ty->isAbstract()) Ty->addAbstractTypeUser(User); } inline void PATypeHandle::removeUser() { if (Ty->isAbstract()) Ty->removeAbstractTypeUser(User); } // Define inline methods for PATypeHolder... inline void PATypeHolder::addRef() { if (Ty->isAbstract()) Ty->addRef(); } inline void PATypeHolder::dropRef() { if (Ty->isAbstract()) Ty->dropRef(); } I talked with Dale and he said that the flag wouldn't prevent inlining from happening, but it will keep around a copy of the function that was inlined. This reduces this fix to a hack. I'm not sure of the root cause of the undefined symbols. I can guess at a few things, though. Once we get LLVM-GCC 4.2 building the Apple Way, then we can redress this issue if people have worries about it. -bw From isanbard at gmail.com Fri Nov 2 20:32:17 2007 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 03 Nov 2007 01:32:17 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r43658 - /llvm-gcc-4.2/trunk/build_gcc Message-ID: <200711030132.lA31WHG7021295@zion.cs.uiuc.edu> Author: void Date: Fri Nov 2 20:32:17 2007 New Revision: 43658 URL: http://llvm.org/viewvc/llvm-project?rev=43658&view=rev Log: First stab at the modifications necessary to get LLVM-GCC 4.2 building the "Apple Way". Modified: llvm-gcc-4.2/trunk/build_gcc Modified: llvm-gcc-4.2/trunk/build_gcc URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/build_gcc?rev=43658&r1=43657&r2=43658&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/build_gcc (original) +++ llvm-gcc-4.2/trunk/build_gcc Fri Nov 2 20:32:17 2007 @@ -22,10 +22,22 @@ # installed. TARGETS=`echo $2 | $TRANSLATE_ARCH` +# LLVM LOCAL begin +# LLVM does not require host name translation. +LLVM_HOSTS=$1 +# LLVM target list is comma separated list. +#FIXME : Hard code targets. See LLVMTARGETOBJ comment in gcc/Makefile.in +LLVM_TARGETS="x86,powerpc" +# LLVm LOCAL end + # The GNU makefile target ('bootstrap' by default). BOOTSTRAP=${BOOTSTRAP-bootstrap} -if [ "$BOOTSTRAP" != bootstrap ]; then - bootstrap=--disable-bootstrap +if [ "x$LLVM_DEBUG" == "x" ]; then + if [ "$BOOTSTRAP" != bootstrap ]; then + bootstrap=--disable-bootstrap + fi +else + BOOTSTRAP= fi # The B&I build srcript (~rc/bin/buildit) accepts an '-othercflags' @@ -33,7 +45,13 @@ # $RC_NONARCH_CFLAGS (and mysteriously prepends '-pipe' thereto). # We will allow this to override the default $CFLAGS and $CXXFLAGS. -CFLAGS="-g -O2 ${RC_NONARCH_CFLAGS/-pipe/}" +if [ "x$LLVM_DEBUG" == "x" ]; then + CFLAGS="-g -O2 ${RC_NONARCH_CFLAGS/-pipe/}" + OPTIMIZE_OPTS="ENABLE_OPTIMIZED=1" +else + CFLAGS="-g" + OPTIMIZE_OPTS= +fi # This isn't a parameter; it is the architecture of the current machine. BUILD=`arch | $TRANSLATE_ARCH` @@ -68,10 +86,20 @@ # The nineth parameter is the subversion number of the submission, e.g. 03. LLVM_GCC_SUBMIT_SUBVERSION="$9" +# The tenth parameter is a yes/no that indicates whether assertions should be +# enabled in the LLVM libs/tools. +LLVM_ASSERTIONS="${10}" + # LLVM_INSTALL_PREFIX - This is the prefix where LLVM tools/headers/libraries # and the llvm-gcc/llvm-g++ symlinks get installed. LLVM_INSTALL_PREFIX=/usr/local +# LLVM_ARCHS - This tells us which architectures we'd like the libraries to be +# build for. The default is 4-way. +if [ "x$LLVM_ARCHS" == "x" ]; then + LLVM_ARCHS="ppc i386 ppc64 x86_64" +fi +# APPLE LOCAL end LLVM # The current working directory is where the build will happen. # It may already contain a partial result of an interrupted build, @@ -97,6 +125,12 @@ fi # LLVM LOCAL end +# APPLE LOCAL begin ARM ARM_CONFIGFLAGS +# For ARM, grab all system files from an SDK. +ARM_SYSROOT="/Developer/SDKs/Extra" +ARM_CONFIGFLAGS="--with-sysroot=\"$ARM_SYSROOT\"" +# APPLE LOCAL end ARM ARM_CONFIGFLAGS + # This is the libstdc++ version to use. LIBSTDCXX_VERSION=4.0.0 @@ -123,9 +157,17 @@ rm -f /usr/lib/gcc/*/4.0.0/specs # These are the configure and build flags that are used. -CONFIGFLAGS="--disable-checking -enable-werror \ +# APPLE LOCAL begin LLVM Support for non /usr $DEST_ROOT, use libstdc++ + +if [ "x$LLVM_DEBUG" == "x" ]; then + CHECKING_FLAGS="--disable-checking --enable-werror" +else + CHECKING_FLAGS="--enable-checking" +fi + +CONFIGFLAGS="$CHECKING_FLAGS \ --prefix=$DEST_ROOT \ - --mandir=\${prefix}/share/man \ + --mandir=$LLVM_INSTALL_PREFIX/share/man \ --enable-languages=c,objc,c++,obj-c++ \ --program-transform-name=/^[cg][^.-]*$/s/$/-$MAJ_VERS/ \ --with-gxx-include-dir=\${prefix}/include/c++/$LIBSTDCXX_VERSION \ @@ -134,8 +176,38 @@ # LLVM LOCAL begin if [ "$ENABLE_LLVM" == true ]; then - CONFIGFLAGS="$CONFIGFLAGS --enable-llvm=/usr/local" + CONFIGFLAGS="$CONFIGFLAGS --enable-llvm=$DIR/obj-llvm" + + # Build the LLVM tree universal. + LLVMCONFIGFLAGS="--prefix=$DEST_DIR$LLVM_INSTALL_PREFIX \ + --enable-targets=$LLVM_TARGETS \ + --enable-assertions=$LLVM_ASSERTIONS" + mkdir -p $DIR/obj-llvm || exit 1 + cd $DIR/obj-llvm || exit 1 + if [ \! -f Makefile.config ]; then + $SRC_DIR/llvm/configure $LLVMCONFIGFLAGS || exit 1 + fi + + if [ "x$LLVM_SUBMIT_SUBVERSION" = "x00" -o "x$LLVM_SUBMIT_SUBVERSION" = "x0" ]; then + LLVM_VERSION="$LLVM_SUBMIT_VERSION" + else + LLVM_VERSION="$LLVM_SUBMIT_VERSION-$LLVM_SUBMIT_SUBVERSION" + fi + + # Note: Don't pass -jN here. Building universal already has + # parallelism and we don't want to make the builders hit swap by + # firing off too many gcc's at the same time. + ## FIXME: Remove -O2 when rdar://4560645 is fixed. + make $OPTIMIZE_OPTS UNIVERSAL=1 UNIVERSAL_ARCH="$LLVM_ARCHS" \ + OPTIMIZE_OPTION='-O2' \ + CXXFLAGS="-DLLVM_VERSION_INFO='\" Apple Build #$LLVM_VERSION\"'" + + if ! test $? == 0 ; then + echo "error: LLVM 'make' failed!" + exit 1 + fi fi +# LLVM LOCAL end # Figure out how many make processes to run. SYSCTL=`sysctl -n hw.activecpu` @@ -160,6 +232,10 @@ # Build llvm-gcc in 'dylib mode'. MAKEFLAGS="$MAKEFLAGS BUILD_LLVM_INTO_A_DYLIB=1" MAKEFLAGS="$MAKEFLAGS LLVM_VERSION_INFO=$LLVM_GCC_SUBMIT_VERSION" + + if [ "$LLVM_ASSERTIONS" == no ]; then + MAKEFLAGS="$MAKEFLAGS DISABLE_LLVMASSERTIONS=1" + fi fi # LLVM LOCAL end @@ -172,8 +248,10 @@ --host=$BUILD-apple-darwin$DARWIN_VERS --target=$BUILD-apple-darwin$DARWIN_VERS || exit 1 fi # Unset RC_DEBUG_OPTIONS because it causes the bootstrap to fail. -RC_DEBUG_OPTIONS= \ - make $MAKEFLAGS CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1 +# Also keep unset for cross compilers so that the cross built libraries are +# comparable to the native built libraries. +unset RC_DEBUG_OPTIONS +make $MAKEFLAGS CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1 make $MAKEFLAGS html CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1 make $MAKEFLAGS DESTDIR=$DIR/dst-$BUILD-$BUILD install-gcc install-target \ CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1 @@ -217,7 +295,12 @@ mkdir -p $DIR/obj-$BUILD-$t $DIR/dst-$BUILD-$t || exit 1 cd $DIR/obj-$BUILD-$t || exit 1 if [ \! -f Makefile ]; then - $SRC_DIR/configure $CONFIGFLAGS --enable-werror-always \ + if [ "x$LLVM_DEBUG" == "x" ]; then + WERROR_FLAGS="--enable-werror-always" + else + WERROR_FLAGS="" + fi + $SRC_DIR/configure $CONFIGFLAGS $WERROR_FLAGS \ --program-prefix=$t-apple-darwin$DARWIN_VERS- \ --host=$BUILD-apple-darwin$DARWIN_VERS --target=$t-apple-darwin$DARWIN_VERS || exit 1 fi @@ -282,15 +365,16 @@ # LLVM LOCAL Don't install HTML docs. if [ "$ENABLE_LLVM" == false ]; then -# HTML documentation -HTMLDIR="/Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.DeveloperTools.docset/Contents/Resources/Documents/documentation/DeveloperTools" -mkdir -p ".$HTMLDIR" || exit 1 -cp -Rp $DIR/obj-$BUILD-$BUILD/gcc/HTML/* ".$HTMLDIR/" || exit 1 + # HTML documentation + HTMLDIR="/Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.DeveloperTools.docset/Contents/Resources/Documents/documentation/DeveloperTools" + mkdir -p ".$HTMLDIR" || exit 1 + cp -Rp $DIR/obj-$BUILD-$BUILD/gcc/HTML/* ".$HTMLDIR/" || exit 1 fi # Manual pages -mkdir -p .$DEST_ROOT/share || exit 1 -cp -Rp $DIR/dst-$BUILD-$BUILD$DEST_ROOT/share/man .$DEST_ROOT/share/ \ +mkdir -p .$LLVM_INSTALL_PREFIX/share || exit 1 +# LLVM LOCAL build_gcc bug with non-/usr $DEST_ROOT +cp -Rp $DIR/dst-$BUILD-$BUILD$LLVM_INSTALL_PREFIX/share/man .$LLVM_INSTALL_PREFIX/share/ \ || exit 1 # exclude fsf-funding.7 gfdl.7 gpl.7 as they are currently built in # the gcc project @@ -346,21 +430,21 @@ .$DEST_ROOT/lib/gcc || exit 1 done -# And copy libgomp stuff and libobjc-gnu by hand... +# And copy libgomp stuff by hand... for t in $TARGETS ; do for h in $HOSTS ; do if [ $h = $t ] ; then - cp -p $DIR/dst-$h-$t$DEST_ROOT/lib/lib{gomp,objc-gnu}.a \ + cp -p $DIR/dst-$h-$t$DEST_ROOT/lib/libgomp.a \ .$DEST_ROOT/lib/gcc/$t-apple-darwin$DARWIN_VERS/$VERS/ || exit 1 cp -p $DIR/dst-$h-$t$DEST_ROOT/lib/libgomp.spec \ .$DEST_ROOT/lib/gcc/$t-apple-darwin$DARWIN_VERS/$VERS/ || exit 1 if [ $h = 'powerpc' ] ; then - cp -p $DIR/dst-$h-$t$DEST_ROOT/lib/ppc64/lib{gomp,objc-gnu}.a \ + cp -p $DIR/dst-$h-$t$DEST_ROOT/lib/ppc64/libgomp.a \ .$DEST_ROOT/lib/gcc/$t-apple-darwin$DARWIN_VERS/$VERS/ppc64/ || exit 1 cp -p $DIR/dst-$h-$t$DEST_ROOT/lib/ppc64/libgomp.spec \ .$DEST_ROOT/lib/gcc/$t-apple-darwin$DARWIN_VERS/$VERS/ppc64/ || exit 1 elif [ $h = 'i686' ] ; then - cp -p $DIR/dst-$h-$t$DEST_ROOT/lib/x86_64/lib{gomp,objc-gnu}.a \ + cp -p $DIR/dst-$h-$t$DEST_ROOT/lib/x86_64/libgomp.a \ .$DEST_ROOT/lib/gcc/$t-apple-darwin$DARWIN_VERS/$VERS/x86_64/ || exit 1 cp -p $DIR/dst-$h-$t$DEST_ROOT/lib/x86_64/libgomp.spec \ .$DEST_ROOT/lib/gcc/$t-apple-darwin$DARWIN_VERS/$VERS/x86_64/ || exit 1 @@ -401,7 +485,7 @@ done # Add extra man page symlinks for 'c++' and for arch-specific names. -MDIR=$DEST_DIR$DEST_ROOT/share/man/man1 +MDIR=$DEST_DIR$LLVM_INSTALL_PREFIX/share/man/man1 ln -f $MDIR/g++-$MAJ_VERS.1 $MDIR/c++-$MAJ_VERS.1 || exit 1 for t in $TARGETS ; do ln -f $MDIR/gcc-$MAJ_VERS.1 $MDIR/$t-apple-darwin$DARWIN_VERS-gcc-$VERS.1 \ @@ -473,6 +557,77 @@ | xargs strip || exit 1 find $DEST_DIR -name \*.a -print | xargs strip -SX || exit 1 find $DEST_DIR -name \*.a -print | xargs ranlib || exit 1 + +# LLVM LOCAL begin +# Install LLVM libraries/headers/tools. +if [ "$ENABLE_LLVM" == true ]; then + cd $DIR/obj-llvm || exit 1 + + ## Install the tree into the destination directory. + make $MAKEFLAGS $OPTIMIZE_OPTS UNIVERSAL=1 OPTIMIZE_OPTION='-O2' install + + if ! test $? == 0 ; then + echo "error: LLVM 'make install' failed!" + exit 1 + fi + + ## Install Version.h + if [ "x$LLVM_SUBMIT_SUBVERSION" = "x00" -o "x$LLVM_SUBMIT_SUBVERSION" = "x0" ]; then + RC_ProjectSourceSubversion=0 + else + case "$LLVM_SUBMIT_SUBVERSION" in + 01) RC_ProjectSourceSubversion=1 ;; + 02) RC_ProjectSourceSubversion=2 ;; + 03) RC_ProjectSourceSubversion=3 ;; + 04) RC_ProjectSourceSubversion=4 ;; + 05) RC_ProjectSourceSubversion=5 ;; + 06) RC_ProjectSourceSubversion=6 ;; + 07) RC_ProjectSourceSubversion=7 ;; + 08) RC_ProjectSourceSubversion=8 ;; + 09) RC_ProjectSourceSubversion=9 ;; + *) RC_ProjectSourceSubversion=$LLVM_SUBMIT_SUBVERSION ;; + esac + fi + + echo "#define LLVM_VERSION ${RC_ProjectSourceVersion}" > $DEST_DIR$LLVM_INSTALL_PREFIX/include/llvm/Version.h + echo "#define LLVM_MINOR_VERSION ${RC_ProjectSourceSubversion}" >> $DEST_DIR$LLVM_INSTALL_PREFIX/include/llvm/Version.h + + ## Strip local symbols from llvm libraries. + strip -S $DEST_DIR$LLVM_INSTALL_PREFIX/lib/*.[oa] + strip -Sx $DEST_DIR$LLVM_INSTALL_PREFIX/lib/*.so + + # Remove .dir files + cd $DEST_DIR$LLVM_INSTALL_PREFIX/ + rm bin/.dir etc/llvm/.dir lib/.dir + + # Remove PPC64 fat slices. + cd $DEST_DIR$LLVM_INSTALL_PREFIX/bin + if [ $MACOSX_DEPLOYMENT_TARGET = "10.4" ]; then + find . -perm 755 -type f -exec lipo -extract ppc -extract i386 {} -output {} \; + else + find . -perm 755 -type f -exec lipo -extract ppc7400 -extract i386 {} -output {} \; + fi + cd $DEST_DIR$LLVM_INSTALL_PREFIX + lipo -extract ppc -extract i386 lib/LLVMlto.0.0.0.so -output lib/LLVMlto.0.0.0.so + + # Set up the llvm-gcc/llvm-g++ symlinks. + cd $DEST_DIR$LLVM_INSTALL_PREFIX/bin + ln -s -f ../../../$DEST_ROOT/bin/gcc-$MAJ_VERS llvm-gcc || exit 1 + ln -s -f ../../../$DEST_ROOT/bin/g++-$MAJ_VERS llvm-g++ || exit 1 + + # Copy one of the libllvmgcc.dylib's up to libexec/gcc. + cp $DEST_DIR/$DEST_ROOT/libexec/gcc/$BUILD-apple-darwin$DARWIN_VERS/$VERS/libllvmgcc.dylib \ + $DEST_DIR/$DEST_ROOT/libexec/gcc/ + + # Replace the installed ones with symlinks to the common one. + for t in $TARGETS ; do + cd $DEST_DIR/$DEST_ROOT/libexec/gcc/$t-apple-darwin$DARWIN_VERS/$VERS/ + rm libllvmgcc.dylib + ln -s ../../libllvmgcc.dylib + done +fi +# LLVM LOCAL end + find $DEST_DIR -name \*.dSYM -print | xargs rm -r || exit 1 chgrp -h -R wheel $DEST_DIR chgrp -R wheel $DEST_DIR From evan.cheng at apple.com Sat Nov 3 01:29:02 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 2 Nov 2007 23:29:02 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r43655 - in /llvm-gcc-4.2/trunk: configure configure.in In-Reply-To: <16e5fdf90711021822j58cc35c1t9b43d055c3f65186@mail.gmail.com> References: <200711030101.lA311GN4019683@zion.cs.uiuc.edu> <16e5fdf90711021822j58cc35c1t9b43d055c3f65186@mail.gmail.com> Message-ID: On Nov 2, 2007, at 6:22 PM, Bill Wendling wrote: > On 11/2/07, Bill Wendling wrote: >> Author: void >> Date: Fri Nov 2 20:01:16 2007 >> New Revision: 43655 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=43655&view=rev >> Log: >> Remove the use of the "-fkeep-inline-functions" flag. LLVM inlines >> everything, and, because some files here use LLVM headers and those >> headers have inlined functions in them, keeping them non-inlined in >> the LLVM-GCC part results in undefined symbol problems. >> > Some clarification. I was getting "undefined symbols" errors when > compiling LLVM-GCC 4.2 the "Apple way" for these methods: > > inline void PATypeHandle::addUser() { > assert(Ty && "Type Handle has a null type!"); > if (Ty->isAbstract()) > Ty->addAbstractTypeUser(User); > } > inline void PATypeHandle::removeUser() { > if (Ty->isAbstract()) > Ty->removeAbstractTypeUser(User); > } > > // Define inline methods for PATypeHolder... > > inline void PATypeHolder::addRef() { > if (Ty->isAbstract()) > Ty->addRef(); > } > > inline void PATypeHolder::dropRef() { > if (Ty->isAbstract()) > Ty->dropRef(); > } > > I talked with Dale and he said that the flag wouldn't prevent inlining > from happening, but it will keep around a copy of the function that > was inlined. This reduces this fix to a hack. I'm not sure of the root > cause of the undefined symbols. I can guess at a few things, though. Should we use "static inline" instead of plain out "inline" to prevent copies of the functions? Evan > > Once we get LLVM-GCC 4.2 building the Apple Way, then we can redress > this issue if people have worries about it. > > -bw > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From sabre at nondot.org Sat Nov 3 02:00:26 2007 From: sabre at nondot.org (Chris Lattner) Date: Sat, 03 Nov 2007 07:00:26 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r43660 - /llvm-gcc-4.0/trunk/gcc/varasm.c Message-ID: <200711030700.lA370Q5D005999@zion.cs.uiuc.edu> Author: lattner Date: Sat Nov 3 02:00:24 2007 New Revision: 43660 URL: http://llvm.org/viewvc/llvm-project?rev=43660&view=rev Log: do not emit a warning for: void setkey(const char *) __asm("_" "setkey" "$UNIX2003"); void setkey(const char *) __asm("_" "setkey" "$UNIX2003"); Modified: llvm-gcc-4.0/trunk/gcc/varasm.c Modified: llvm-gcc-4.0/trunk/gcc/varasm.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/varasm.c?rev=43660&r1=43659&r2=43660&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/varasm.c (original) +++ llvm-gcc-4.0/trunk/gcc/varasm.c Sat Nov 3 02:00:24 2007 @@ -5576,7 +5576,13 @@ const char * default_strip_name_encoding (const char *str) { + /* APPLE LOCAL begin LLVM */ +#ifndef ENABLE_LLVM return str + (*str == '*'); +#else + return str + (*str == '\1'); +#endif + /* APPLE LOCAL end LLVM */ } /* Assume ELF-ish defaults, since that's pretty much the most liberal From sabre at nondot.org Sat Nov 3 02:01:20 2007 From: sabre at nondot.org (Chris Lattner) Date: Sat, 03 Nov 2007 07:01:20 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r43661 - /llvm-gcc-4.2/trunk/gcc/varasm.c Message-ID: <200711030701.lA371KKg006050@zion.cs.uiuc.edu> Author: lattner Date: Sat Nov 3 02:01:20 2007 New Revision: 43661 URL: http://llvm.org/viewvc/llvm-project?rev=43661&view=rev Log: Do not emit a warning for: void setkey(const char *) __asm("_" "setkey" "$UNIX2003"); void setkey(const char *) __asm("_" "setkey" "$UNIX2003"); Modified: llvm-gcc-4.2/trunk/gcc/varasm.c Modified: llvm-gcc-4.2/trunk/gcc/varasm.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/varasm.c?rev=43661&r1=43660&r2=43661&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/varasm.c (original) +++ llvm-gcc-4.2/trunk/gcc/varasm.c Sat Nov 3 02:01:20 2007 @@ -6029,7 +6029,13 @@ const char * default_strip_name_encoding (const char *str) { + /* APPLE LOCAL begin LLVM */ +#ifndef ENABLE_LLVM return str + (*str == '*'); +#else + return str + (*str == '\1'); +#endif + /* APPLE LOCAL end LLVM */ } #ifdef ASM_OUTPUT_DEF From evan.cheng at apple.com Sat Nov 3 02:20:12 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Sat, 03 Nov 2007 07:20:12 -0000 Subject: [llvm-commits] [llvm] r43662 - in /llvm/trunk: include/llvm/CodeGen/LiveIntervalAnalysis.h lib/CodeGen/LiveIntervalAnalysis.cpp lib/CodeGen/RegAllocLinearScan.cpp test/CodeGen/X86/postalloc-coalescing.ll Message-ID: <200711030720.lA37KCMf006661@zion.cs.uiuc.edu> Author: evancheng Date: Sat Nov 3 02:20:12 2007 New Revision: 43662 URL: http://llvm.org/viewvc/llvm-project?rev=43662&view=rev Log: There are times when the coalescer would not coalesce away a copy but the copy can be eliminated by the allocator is the destination and source targets the same register. The most common case is when the source and destination registers are in different class. For example, on x86 mov32to32_ targets GR32_ which contains a subset of the registers in GR32. The allocator can do 2 things: 1. Set the preferred allocation for the destination of a copy to that of its source. 2. After allocation is done, change the allocation of a copy destination (if legal) so the copy can be eliminated. This eliminates 443 extra moves from 403.gcc. Added: llvm/trunk/test/CodeGen/X86/postalloc-coalescing.ll Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h?rev=43662&r1=43661&r2=43662&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h (original) +++ llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h Sat Nov 3 02:20:12 2007 @@ -162,6 +162,11 @@ return i2miMap_[index]; } + /// conflictsWithPhysRegDef - Returns true if the specified register + /// is defined during the duration of the specified interval. + bool conflictsWithPhysRegDef(const LiveInterval &li, VirtRegMap &vrm, + unsigned reg); + /// findLiveInMBBs - Given a live range, if the value of the range /// is live in any MBB returns true as well as the list of basic blocks /// where the value is live in. Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=43662&r1=43661&r2=43662&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Sat Nov 3 02:20:12 2007 @@ -442,6 +442,39 @@ return added; } +/// conflictsWithPhysRegDef - Returns true if the specified register +/// is defined during the duration of the specified interval. +bool LiveIntervals::conflictsWithPhysRegDef(const LiveInterval &li, + VirtRegMap &vrm, unsigned reg) { + for (LiveInterval::Ranges::const_iterator + I = li.ranges.begin(), E = li.ranges.end(); I != E; ++I) { + for (unsigned index = getBaseIndex(I->start), + end = getBaseIndex(I->end-1) + InstrSlots::NUM; index != end; + index += InstrSlots::NUM) { + // skip deleted instructions + while (index != end && !getInstructionFromIndex(index)) + index += InstrSlots::NUM; + if (index == end) break; + + MachineInstr *MI = getInstructionFromIndex(index); + for (unsigned i = 0; i != MI->getNumOperands(); ++i) { + MachineOperand& mop = MI->getOperand(i); + if (!mop.isRegister() || !mop.isDef()) + continue; + unsigned PhysReg = mop.getReg(); + if (PhysReg == 0) + continue; + if (MRegisterInfo::isVirtualRegister(PhysReg)) + PhysReg = vrm.getPhys(PhysReg); + if (mri_->regsOverlap(PhysReg, reg)) + return true; + } + } + } + + return false; +} + void LiveIntervals::printRegName(unsigned reg) const { if (MRegisterInfo::isPhysicalRegister(reg)) cerr << mri_->getName(reg); Modified: llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp?rev=43662&r1=43661&r2=43662&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp Sat Nov 3 02:20:12 2007 @@ -24,6 +24,7 @@ #include "llvm/CodeGen/SSARegMap.h" #include "llvm/Target/MRegisterInfo.h" #include "llvm/Target/TargetMachine.h" +#include "llvm/Target/TargetInstrInfo.h" #include "llvm/ADT/EquivalenceClasses.h" #include "llvm/ADT/Statistic.h" #include "llvm/ADT/STLExtras.h" @@ -38,6 +39,7 @@ STATISTIC(NumIters , "Number of iterations performed"); STATISTIC(NumBacktracks, "Number of times we had to backtrack"); +STATISTIC(NumCoalesce, "Number of copies coalesced"); static RegisterRegAlloc linearscanRegAlloc("linearscan", " linear scan register allocator", @@ -60,6 +62,9 @@ MachineFunction* mf_; const TargetMachine* tm_; const MRegisterInfo* mri_; + const TargetInstrInfo* tii_; + SSARegMap *regmap_; + BitVector allocatableRegs_; LiveIntervals* li_; /// handled_ - Intervals are added to the handled_ set in the order of their @@ -122,6 +127,15 @@ /// is available, or spill. void assignRegOrStackSlotAtInterval(LiveInterval* cur); + /// attemptTrivialCoalescing - If a simple interval is defined by a copy, + /// try allocate the definition the same register as the source register + /// if the register is not defined during live time of the interval. This + /// eliminate a copy. This is used to coalesce copies which were not + /// coalesced away before allocation either due to dest and src being in + /// different register classes or because the coalescer was overly + /// conservative. + unsigned attemptTrivialCoalescing(LiveInterval &cur, unsigned Reg); + /// /// register handling helpers /// @@ -187,10 +201,54 @@ RelatedRegClasses.unionSets(I->second, OneClassForEachPhysReg[*AS]); } +/// attemptTrivialCoalescing - If a simple interval is defined by a copy, +/// try allocate the definition the same register as the source register +/// if the register is not defined during live time of the interval. This +/// eliminate a copy. This is used to coalesce copies which were not +/// coalesced away before allocation either due to dest and src being in +/// different register classes or because the coalescer was overly +/// conservative. +unsigned RALinScan::attemptTrivialCoalescing(LiveInterval &cur, unsigned Reg) { + if (cur.preference && cur.preference == Reg || !cur.containsOneValue()) + return Reg; + + VNInfo *vni = cur.getValNumInfo(0); + if (!vni->def || vni->def == ~1U || vni->def == ~0U) + return Reg; + MachineInstr *CopyMI = li_->getInstructionFromIndex(vni->def); + unsigned SrcReg, DstReg; + if (!CopyMI || !tii_->isMoveInstr(*CopyMI, SrcReg, DstReg)) + return Reg; + if (MRegisterInfo::isVirtualRegister(SrcReg)) + if (!vrm_->isAssignedReg(SrcReg)) + return Reg; + else + SrcReg = vrm_->getPhys(SrcReg); + if (Reg == SrcReg) + return Reg; + + const TargetRegisterClass *RC = regmap_->getRegClass(cur.reg); + if (!RC->contains(SrcReg)) + return Reg; + + // Try to coalesce. + if (!li_->conflictsWithPhysRegDef(cur, *vrm_, SrcReg)) { + vrm_->clearVirt(cur.reg); + vrm_->assignVirt2Phys(cur.reg, SrcReg); + ++NumCoalesce; + return SrcReg; + } + + return Reg; +} + bool RALinScan::runOnMachineFunction(MachineFunction &fn) { mf_ = &fn; tm_ = &fn.getTarget(); mri_ = tm_->getRegisterInfo(); + tii_ = tm_->getInstrInfo(); + regmap_ = mf_->getSSARegMap(); + allocatableRegs_ = mri_->getAllocatableSet(fn); li_ = &getAnalysis(); // We don't run the coalescer here because we have no reason to @@ -292,12 +350,12 @@ MachineFunction::iterator EntryMBB = mf_->begin(); SmallVector LiveInMBBs; for (LiveIntervals::iterator i = li_->begin(), e = li_->end(); i != e; ++i) { - const LiveInterval &cur = i->second; + LiveInterval &cur = i->second; unsigned Reg = 0; if (MRegisterInfo::isPhysicalRegister(cur.reg)) Reg = i->second.reg; else if (vrm_->isAssignedReg(cur.reg)) - Reg = vrm_->getPhys(cur.reg); + Reg = attemptTrivialCoalescing(cur, vrm_->getPhys(cur.reg)); if (!Reg) continue; for (LiveInterval::Ranges::const_iterator I = cur.begin(), E = cur.end(); @@ -441,9 +499,31 @@ std::vector > SpillWeightsToAdd; unsigned StartPosition = cur->beginNumber(); - const TargetRegisterClass *RC = mf_->getSSARegMap()->getRegClass(cur->reg); + const TargetRegisterClass *RC = regmap_->getRegClass(cur->reg); const TargetRegisterClass *RCLeader = RelatedRegClasses.getLeaderValue(RC); - + + // If this live interval is defined by a move instruction and its source is + // assigned a physical register that is compatible with the target register + // class, then we should try to assign it the same register. + // This can happen when the move is from a larger register class to a smaller + // one, e.g. X86::mov32to32_. These move instructions are not coalescable. + if (!cur->preference && cur->containsOneValue()) { + VNInfo *vni = cur->getValNumInfo(0); + if (vni->def && vni->def != ~1U && vni->def != ~0U) { + MachineInstr *CopyMI = li_->getInstructionFromIndex(vni->def); + unsigned SrcReg, DstReg; + if (tii_->isMoveInstr(*CopyMI, SrcReg, DstReg)) { + unsigned Reg = 0; + if (MRegisterInfo::isPhysicalRegister(SrcReg)) + Reg = SrcReg; + else if (vrm_->isAssignedReg(SrcReg)) + Reg = vrm_->getPhys(SrcReg); + if (Reg && allocatableRegs_[Reg] && RC->contains(Reg)) + cur->preference = Reg; + } + } + } + // for every interval in inactive we overlap with, mark the // register as not free and update spill weights. for (IntervalPtrs::const_iterator i = inactive_.begin(), @@ -451,7 +531,7 @@ unsigned Reg = i->first->reg; assert(MRegisterInfo::isVirtualRegister(Reg) && "Can only allocate virtual registers!"); - const TargetRegisterClass *RegRC = mf_->getSSARegMap()->getRegClass(Reg); + const TargetRegisterClass *RegRC = regmap_->getRegClass(Reg); // If this is not in a related reg class to the register we're allocating, // don't check it. if (RelatedRegClasses.getLeaderValue(RegRC) == RCLeader && @@ -472,7 +552,7 @@ // We got a register. However, if it's in the fixed_ list, we might // conflict with it. Check to see if we conflict with it or any of its // aliases. - std::set RegAliases; + SmallSet RegAliases; for (const unsigned *AS = mri_->getAliasSet(physReg); *AS; ++AS) RegAliases.insert(*AS); @@ -642,7 +722,7 @@ unsigned earliestStart = cur->beginNumber(); // set of spilled vregs (used later to rollback properly) - std::set spilled; + SmallSet spilled; // spill live intervals of virtual regs mapped to the physical register we // want to clear (and its aliases). We only spill those that overlap with the @@ -744,7 +824,7 @@ std::vector inactiveCounts(mri_->getNumRegs(), 0); unsigned MaxInactiveCount = 0; - const TargetRegisterClass *RC = mf_->getSSARegMap()->getRegClass(cur->reg); + const TargetRegisterClass *RC = regmap_->getRegClass(cur->reg); const TargetRegisterClass *RCLeader = RelatedRegClasses.getLeaderValue(RC); for (IntervalPtrs::iterator i = inactive_.begin(), e = inactive_.end(); @@ -755,7 +835,7 @@ // If this is not in a related reg class to the register we're allocating, // don't check it. - const TargetRegisterClass *RegRC = mf_->getSSARegMap()->getRegClass(reg); + const TargetRegisterClass *RegRC = regmap_->getRegClass(reg); if (RelatedRegClasses.getLeaderValue(RegRC) == RCLeader) { reg = vrm_->getPhys(reg); ++inactiveCounts[reg]; Added: llvm/trunk/test/CodeGen/X86/postalloc-coalescing.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/postalloc-coalescing.ll?rev=43662&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/postalloc-coalescing.ll (added) +++ llvm/trunk/test/CodeGen/X86/postalloc-coalescing.ll Sat Nov 3 02:20:12 2007 @@ -0,0 +1,35 @@ +; RUN: llvm-as < %s | llc -march=x86 | grep mov | count 3 + +define fastcc i32 @_Z18yy_get_next_bufferv() { +entry: + br label %bb131 + +bb116: ; preds = %bb131 + %tmp125126 = trunc i32 %c.1 to i8 ; [#uses=1] + store i8 %tmp125126, i8* null, align 1 + br label %bb131 + +bb131: ; preds = %bb116, %entry + %c.2 = phi i32 [ %c.1, %bb116 ], [ 42, %entry ] ; [#uses=1] + %c.1 = select i1 false, i32 0, i32 %c.2 ; [#uses=4] + %tmp181 = icmp eq i32 %c.1, -1 ; [#uses=1] + br i1 %tmp181, label %bb158, label %bb116 + +bb158: ; preds = %bb131 + br i1 true, label %cond_true163, label %cond_next178 + +cond_true163: ; preds = %bb158 + %tmp172173 = trunc i32 %c.1 to i8 ; [#uses=1] + store i8 %tmp172173, i8* null, align 1 + br label %cond_next178 + +cond_next178: ; preds = %cond_true163, %bb158 + %tmp180 = icmp eq i32 %c.1, -1 ; [#uses=1] + br i1 %tmp180, label %cond_next184, label %cond_next199 + +cond_next184: ; preds = %cond_next178 + ret i32 0 + +cond_next199: ; preds = %cond_next178 + ret i32 0 +} From baldrick at free.fr Sat Nov 3 03:15:21 2007 From: baldrick at free.fr (Duncan Sands) Date: Sat, 3 Nov 2007 09:15:21 +0100 Subject: [llvm-commits] [llvm-gcc-4.2] r43656 - in /llvm-gcc-4.2/trunk/gcc: Makefile.in c-common.c config/rs6000/rs6000.c configure configure.ac cp/except.c passes.c varasm.c In-Reply-To: <200711030105.lA3154of019851@zion.cs.uiuc.edu> References: <200711030105.lA3154of019851@zion.cs.uiuc.edu> Message-ID: <200711030915.22899.baldrick@free.fr> > - Use "-Wno-overlength-strings" to silence a warning during > bootstrapping. Because the warning was bogus? Best wishes, Duncan. From sabre at nondot.org Sat Nov 3 03:55:32 2007 From: sabre at nondot.org (Chris Lattner) Date: Sat, 03 Nov 2007 08:55:32 -0000 Subject: [llvm-commits] [llvm] r43663 - in /llvm/trunk/docs/tutorial: LangImpl7.html index.html Message-ID: <200711030855.lA38tY6Y017856@zion.cs.uiuc.edu> Author: lattner Date: Sat Nov 3 03:55:29 2007 New Revision: 43663 URL: http://llvm.org/viewvc/llvm-project?rev=43663&view=rev Log: hack and slash the first 20% of chapter seven. Added: llvm/trunk/docs/tutorial/LangImpl7.html Modified: llvm/trunk/docs/tutorial/index.html Added: llvm/trunk/docs/tutorial/LangImpl7.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/LangImpl7.html?rev=43663&view=auto ============================================================================== --- llvm/trunk/docs/tutorial/LangImpl7.html (added) +++ llvm/trunk/docs/tutorial/LangImpl7.html Sat Nov 3 03:55:29 2007 @@ -0,0 +1,298 @@ + + + + + Kaleidoscope: Extending the Language: Mutable Variables / SSA + construction + + + + + + + +

      Kaleidoscope: Extending the Language: Mutable Variables
      + +
      +

      Written by Chris Lattner

      +
      + + + + + +
      + +

      Welcome to Part 7 of the "Implementing a language with +LLVM" tutorial. In parts 1 through 6, we've built a very respectable, +albeit simple, functional +programming language. In our journey, we learned some parsing techniques, +how to build and represent an AST, how to build LLVM IR, and how to optimize +the resultant code and JIT compile it.

      + +

      While Kaleidoscope is interesting as a functional language, this makes it +"too easy" to generate LLVM IR for it. In particular, a functional language +makes it very easy to build LLVM IR directly in SSA form. +Since LLVM requires that the input code be in SSA form, this is a very nice +property and it is often unclear to newcomers how to generate code for an +imperative language with mutable variables.

      + +

      The short (and happy) summary of this chapter is that there is no need for +your front-end to build SSA form: LLVM provides highly tuned and well tested +support for this, though the way it works is a bit unexpected for some.

      + +
      + + + + + +
      + +

      +To understand why mutable variables cause complexities in SSA construction, +consider this extremely simple C example: +

      + +
      +
      +int G, H;
      +int test(_Bool Condition) {
      +  int X;
      +  if (Condition)
      +    X = G;
      +  else
      +    X = H;
      +  return X;
      +}
      +
      +
      + +

      In this case, we have the variable "X", whose value depends on the path +executed in the program. Because there are two different possible values for X +before the return instruction, a PHI node is inserted to merge the two values. +The LLVM IR that we want for this example looks like this:

      + +
      +
      + at G = weak global i32 0   ; type of @G is i32*
      + at H = weak global i32 0   ; type of @H is i32*
      +
      +define i32 @test(i1 %Condition) {
      +entry:
      +	br i1 %Condition, label %cond_true, label %cond_false
      +
      +cond_true:
      +	%X.0 = load i32* @G
      +	br label %cond_next
      +
      +cond_false:
      +	%X.1 = load i32* @H
      +	br label %cond_next
      +
      +cond_next:
      +	%X.2 = phi i32 [ %X.1, %cond_false ], [ %X.0, %cond_true ]
      +	ret i32 %X.2
      +}
      +
      +
      + +

      In this example, the loads from the G and H global variables are explicit in +the LLVM IR, and they live in the then/else branches of the if statement +(cond_true/cond_false). In order to merge the incoming values, the X.2 phi node +in the cond_next block selects the right value to use based on where control +flow is coming from: if control flow comes from the cond_false block, X.2 gets +the value of X.1. Alternatively, if control flow comes from cond_tree, it gets +the value of X.0. The intent of this chapter is not to explain the details of +SSA form. For more information, see one of the many online +references.

      + +

      The question for this article is "who places phi nodes when lowering +assignments to mutable variables?". The issue here is that LLVM +requires that its IR be in SSA form: there is no "non-ssa" mode for it. +However, SSA construction requires non-trivial algorithms and data structures, +so it is inconvenient and wasteful for every front-end to have to reproduce this +logic.

      + +
      + + + + + +
      + +

      The 'trick' here is that while LLVM does require all register values to be +in SSA form, it does not require (or permit) memory objects to be in SSA form. +In the example above, note that the loads from G and H are direct accesses to +G and H: they are not renamed or versioned. This differs from some other +compiler systems, which does try to version memory objects. In LLVM, instead of +encoding dataflow analysis of memory into the LLVM IR, it is handled with Analysis Passes which are computed on +demand.

      + +

      +With this in mind, the high-level idea is that we want to make a stack variable +(which lives in memory, because it is on the stack) for each mutable object in +a function. To take advantage of this trick, we need to talk about how LLVM +represents stack variables. +

      + +

      In LLVM, all memory accesses are explicit with load/store instructions, and +it is carefully designed to not have (or need) an "address-of" operator. Notice +how the type of the @G/@H global variables is actually "i32*" even though the +variable is defined as "i32". What this means is that @G defines space +for an i32 in the global data area, but its name actually refers to the +address for that space. Stack variables work the same way, but instead of being +declared with global variable definitions, they are declared with the +LLVM alloca instruction:

      + +
      +
      +define i32 @test(i1 %Condition) {
      +entry:
      +	%X = alloca i32           ; type of %X is i32*.
      +	...
      +	%tmp = load i32* %X       ; load the stack value %X from the stack.
      +	%tmp2 = add i32 %tmp, 1   ; increment it
      +	store i32 %tmp2, i32* %X  ; store it back
      +	...
      +
      +
      + +

      This code shows an example of how you can declare and manipulate a stack +variable in the LLVM IR. Stack memory allocated with the alloca instruction is +fully general: you can pass the address of the stack slot to functions, you can +store it in other variables, etc. In our example above, we could rewrite the +example to use the alloca technique to avoid using a PHI node:

      + +
      +
      + at G = weak global i32 0   ; type of @G is i32*
      + at H = weak global i32 0   ; type of @H is i32*
      +
      +define i32 @test(i1 %Condition) {
      +entry:
      +	%X = alloca i32           ; type of %X is i32*.
      +	br i1 %Condition, label %cond_true, label %cond_false
      +
      +cond_true:
      +	%X.0 = load i32* @G
      +        store i32 %X.0, i32* %X   ; Update X
      +	br label %cond_next
      +
      +cond_false:
      +	%X.1 = load i32* @H
      +        store i32 %X.1, i32* %X   ; Update X
      +	br label %cond_next
      +
      +cond_next:
      +	%X.2 = load i32* %X       ; Read X
      +	ret i32 %X.2
      +}
      +
      +
      + +

      With this, we have discovered a way to handle arbitrary mutable variables +without the need to create Phi nodes at all:

      + +
        +
      1. Each mutable variable becomes a stack allocation.
      2. +
      3. Each read of the variable becomes a load from the stack.
      4. +
      5. Each update of the variable becomes a store to the stack.
      6. +
      7. Taking the address of a variable just uses the stack address directly.
      8. +
      + +

      While this solution has solved our immediate problem, it introduced another +one: we have now apparently introduced a lot of stack traffic for very simple +and common operations, a major performance problem. Fortunately for us, the +LLVM optimizer has a highly-tuned optimization pass named "mem2reg" that handles +this case, promoting allocas like this into SSA registers, inserting Phi nodes +as appropriate. If you run this example through the pass, for example, you'll +get:

      + +
      +
      +$ llvm-as < example.ll | opt -mem2reg | llvm-dis
      + at G = weak global i32 0
      + at H = weak global i32 0
      +
      +define i32 @test(i1 %Condition) {
      +entry:
      +	br i1 %Condition, label %cond_true, label %cond_false
      +
      +cond_true:
      +	%X.0 = load i32* @G
      +	br label %cond_next
      +
      +cond_false:
      +	%X.1 = load i32* @H
      +	br label %cond_next
      +
      +cond_next:
      +	%X.01 = phi i32 [ %X.1, %cond_false ], [ %X.0, %cond_true ]
      +	ret i32 %X.01
      +}
      +
      + +

      The mem2reg pass is guaranteed to work, and + +which cases. +

      + +

      The final question you may be asking is: should I bother with this nonsense +for my front-end? Wouldn't it be better if I just did SSA construction +directly, avoiding use of the mem2reg optimization pass? + +Proven, well tested, debug info, etc. +

      +
      + + + + + + +
      + +

      +Here is the complete code listing for our running example, enhanced with the +if/then/else and for expressions.. To build this example, use: +

      + +
      +
      +   # Compile
      +   g++ -g toy.cpp `llvm-config --cppflags --ldflags --libs core jit native` -O3 -o toy
      +   # Run
      +   ./toy
      +
      +
      + +

      Here is the code:

      + +
      +
      +
      +
      + +
      + + +
      +
      + Valid CSS! + Valid HTML 4.01! + + Chris Lattner
      + The LLVM Compiler Infrastructure
      + Last modified: $Date: 2007-10-17 11:05:13 -0700 (Wed, 17 Oct 2007) $ +
      + + Modified: llvm/trunk/docs/tutorial/index.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/index.html?rev=43663&r1=43662&r2=43663&view=diff ============================================================================== --- llvm/trunk/docs/tutorial/index.html (original) +++ llvm/trunk/docs/tutorial/index.html Sat Nov 3 03:55:29 2007 @@ -33,7 +33,7 @@
    • Adding JIT and Optimizer Support
    • Extending the language: control flow
    • Extending the language: user-defined operators
    • -
    • Extending the language: mutable variables
    • +
    • Extending the language: mutable variables / SSA construction
    • Thoughts and ideas for extensions
    • Advanced Topics From isanbard at gmail.com Sat Nov 3 04:16:50 2007 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 3 Nov 2007 02:16:50 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r43655 - in /llvm-gcc-4.2/trunk: configure configure.in In-Reply-To: References: <200711030101.lA311GN4019683@zion.cs.uiuc.edu> <16e5fdf90711021822j58cc35c1t9b43d055c3f65186@mail.gmail.com> Message-ID: On Nov 2, 2007, at 11:29 PM, Evan Cheng wrote: > Should we use "static inline" instead of plain out "inline" to > prevent copies of the functions? > I can check it out. But here's another thing. The comment in the configure.in file that sets this flag is: # This is aimed to mimic bootstrap with a non-GCC compiler to catch problems. So maybe we don't really need this flag because LLVM-GCC is a GCC compiler. :-) -bw From isanbard at gmail.com Sat Nov 3 04:11:58 2007 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 3 Nov 2007 02:11:58 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r43656 - in /llvm-gcc-4.2/trunk/gcc: Makefile.in c-common.c config/rs6000/rs6000.c configure configure.ac cp/except.c passes.c varasm.c In-Reply-To: <200711030915.22899.baldrick@free.fr> References: <200711030105.lA3154of019851@zion.cs.uiuc.edu> <200711030915.22899.baldrick@free.fr> Message-ID: <413EF7E9-6589-48B8-9D80-1173A17D5F65@gmail.com> On Nov 3, 2007, at 1:15 AM, Duncan Sands wrote: >> - Use "-Wno-overlength-strings" to silence a warning during >> bootstrapping. > > Because the warning was bogus? > Depends on what you mean by bogus. :-) Yes, the strings were over the max allowed by the standard, but it is in gcc.c, so I assume (foolishly, I know ;-) ) that they know what they're doing. Also notice that the if-then in the shell is checking: test $ac_cv_prog_cc_w_no_overlength_strings = yes but it wasn't adding that to the strict1_warn variable. So this is basically making it equal to what's in Apple's GCC 4.2. -bw From isanbard at gmail.com Sat Nov 3 04:21:33 2007 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 03 Nov 2007 09:21:33 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r43664 - /llvm-gcc-4.2/trunk/gcc/configure.ac Message-ID: <200711030921.lA39LXp0019243@zion.cs.uiuc.edu> Author: void Date: Sat Nov 3 04:21:32 2007 New Revision: 43664 URL: http://llvm.org/viewvc/llvm-project?rev=43664&view=rev Log: Oops. Modified: llvm-gcc-4.2/trunk/gcc/configure.ac Modified: llvm-gcc-4.2/trunk/gcc/configure.ac URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/configure.ac?rev=43664&r1=43663&r2=43664&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/configure.ac (original) +++ llvm-gcc-4.2/trunk/gcc/configure.ac Sat Nov 3 04:21:32 2007 @@ -353,7 +353,6 @@ if test $ac_cv_prog_cc_w_no_long_long = yes \ && test $ac_cv_prog_cc_w_no_variadic_macros = yes \ && test $ac_cv_prog_cc_w_no_overlength_strings = yes ; then - && test $ac_cv_prog_cc_w_no_overlength_strings = yes ; then strict1_warn="-pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings" fi From dalej at apple.com Sat Nov 3 10:43:42 2007 From: dalej at apple.com (Dale Johannesen) Date: Sat, 3 Nov 2007 08:43:42 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r43656 - in /llvm-gcc-4.2/trunk/gcc: Makefile.in c-common.c config/rs6000/rs6000.c configure configure.ac cp/except.c passes.c varasm.c In-Reply-To: <413EF7E9-6589-48B8-9D80-1173A17D5F65@gmail.com> References: <200711030105.lA3154of019851@zion.cs.uiuc.edu> <200711030915.22899.baldrick@free.fr> <413EF7E9-6589-48B8-9D80-1173A17D5F65@gmail.com> Message-ID: On Nov 3, 2007, at 2:11 AM, Bill Wendling wrote: > On Nov 3, 2007, at 1:15 AM, Duncan Sands wrote: > >>> - Use "-Wno-overlength-strings" to silence a warning during >>> bootstrapping. >> >> Because the warning was bogus? >> > Depends on what you mean by bogus. :-) > > Yes, the strings were over the max allowed by the standard, but it is > in gcc.c, so I assume (foolishly, I know ;-) ) that they know what > they're doing. Those long strings have been there as long as I can remember. You'll see -Werror is disabled for that file in the 4.0 Makefile.in. For 4.2 they seem to have changed the mechanism...disallowing this particular warning seems in principle like the right way to go. > Also notice that the if-then in the shell is checking: > > test $ac_cv_prog_cc_w_no_overlength_strings = yes > > but it wasn't adding that to the strict1_warn variable. So this is > basically making it equal to what's in Apple's GCC 4.2. > > -bw > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From dalej at apple.com Sat Nov 3 11:17:59 2007 From: dalej at apple.com (Dale Johannesen) Date: Sat, 3 Nov 2007 09:17:59 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r43655 - in /llvm-gcc-4.2/trunk: configure configure.in In-Reply-To: References: <200711030101.lA311GN4019683@zion.cs.uiuc.edu> <16e5fdf90711021822j58cc35c1t9b43d055c3f65186@mail.gmail.com> Message-ID: <067B5197-223F-4CCC-B5A2-3B83555999AA@apple.com> On Nov 2, 2007, at 11:29 PM, Evan Cheng wrote: > On Nov 2, 2007, at 6:22 PM, Bill Wendling wrote: >> On 11/2/07, Bill Wendling wrote: >>> Author: void >>> Date: Fri Nov 2 20:01:16 2007 >>> New Revision: 43655 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=43655&view=rev >>> Log: >>> Remove the use of the "-fkeep-inline-functions" flag. LLVM inlines >>> everything, and, because some files here use LLVM headers and those >>> headers have inlined functions in them, keeping them non-inlined in >>> the LLVM-GCC part results in undefined symbol problems. >>> >> Some clarification. I was getting "undefined symbols" errors when >> compiling LLVM-GCC 4.2 the "Apple way" for these methods: >> >> inline void PATypeHandle::addUser() { >> assert(Ty && "Type Handle has a null type!"); >> if (Ty->isAbstract()) >> Ty->addAbstractTypeUser(User); >> } >> ,,,, >> I talked with Dale and he said that the flag wouldn't prevent >> inlining >> from happening, but it will keep around a copy of the function that >> was inlined. Right (at least, that is how it is supposed to work:). I didn't understand why that would cause undefined symbol problems, hence the conversation. >> This reduces this fix to a hack. I'm not sure of the root >> cause of the undefined symbols. I can guess at a few things, though. > > Should we use "static inline" instead of plain out "inline" to > prevent copies of the functions? I think we need to figure out why it is a problem first. For gcc we may want the always_inline attribute, but that won't be portable to other compilers. > Evan > >> >> Once we get LLVM-GCC 4.2 building the Apple Way, then we can redress >> this issue if people have worries about it. OK with me. >> -bw >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From sabre at nondot.org Sat Nov 3 17:22:32 2007 From: sabre at nondot.org (Chris Lattner) Date: Sat, 03 Nov 2007 22:22:32 -0000 Subject: [llvm-commits] [llvm] r43667 - /llvm/trunk/docs/tutorial/LangImpl7.html Message-ID: <200711032222.lA3MMWfN021918@zion.cs.uiuc.edu> Author: lattner Date: Sat Nov 3 17:22:30 2007 New Revision: 43667 URL: http://llvm.org/viewvc/llvm-project?rev=43667&view=rev Log: finish the 'Memory in LLVM' section Modified: llvm/trunk/docs/tutorial/LangImpl7.html Modified: llvm/trunk/docs/tutorial/LangImpl7.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/LangImpl7.html?rev=43667&r1=43666&r2=43667&view=diff ============================================================================== --- llvm/trunk/docs/tutorial/LangImpl7.html (original) +++ llvm/trunk/docs/tutorial/LangImpl7.html Sat Nov 3 17:22:30 2007 @@ -238,17 +238,63 @@ ret i32 %X.01 } +
    • -

      The mem2reg pass is guaranteed to work, and - -which cases. -

      +

      The mem2reg pass implements the standard "iterated dominator frontier" +algorithm for constructing SSA form and has a number of optimizations that speed +up very common degenerate cases. mem2reg really is the answer for dealing with +mutable variables, and we highly recommend that you depend on it. Note that +mem2reg only works on variables in certain circumstances:

      + +
        +
      1. mem2reg is alloca-driven: it looks for allocas and if it can handle them, it +promotes them. It does not apply to global variables or heap allocations.
      2. + +
      3. mem2reg only looks for alloca instructions in the entry block of the +function. Being in the entry block guarantees that the alloca is only executed +once, which makes analysis simpler.
      4. + +
      5. mem2reg only promotes allocas whose uses are direct loads and stores. If +the address of the stack object is passed to a function, or if any funny pointer +arithmetic is involved, the alloca will not be promoted.
      6. + +
      7. mem2reg only works on allocas of scalar values, and only if the array size +of the allocation is 1 (or missing in the .ll file). mem2reg is not capable of +promoting structs or arrays to registers. Note that the "scalarrepl" pass is +more powerful and can promote structs, "unions", and arrays in many cases.
      8. -

        The final question you may be asking is: should I bother with this nonsense -for my front-end? Wouldn't it be better if I just did SSA construction -directly, avoiding use of the mem2reg optimization pass? +

      -Proven, well tested, debug info, etc. +

      +All of these properties are easy to satisfy for most imperative languages, and +we'll illustrated this below with Kaleidoscope. The final question you may be +asking is: should I bother with this nonsense for my front-end? Wouldn't it be +better if I just did SSA construction directly, avoiding use of the mem2reg +optimization pass? In short, we strongly recommend that use you this technique +for building SSA form, unless there is an extremely good reason not to. Using +this technique is:

      + +
        +
      • Proven and well tested: llvm-gcc and clang both use this technique for local +mutable variables. As such, the most common clients of LLVM are using this to +handle a bulk of their variables. You can be sure that bugs are found fast and +fixed early.
      • + +
      • Extremely Fast: mem2reg has a number of special cases that make it fast in +common cases as well as fully general. For example, it has fast-paths for +variables that are only used in a single block, variables that only have one +assignment point, good heuristics to avoid insertion of unneeded phi nodes, etc. +
      • + +
      • Needed for debug info generation: +Debug information in LLVM relies on having the address of the variable +exposed to attach debug info to it. This technique dovetails very naturally +with this style of debug info.
      • +
      + +

      If nothing else, this makes it much easier to get your front-end up and +running, and is very simple to implement. Lets extend Kaleidoscope with mutable +variables now!

      From nicholas at mxc.ca Sat Nov 3 23:06:17 2007 From: nicholas at mxc.ca (Nick Lewycky) Date: Sun, 04 Nov 2007 00:06:17 -0400 Subject: [llvm-commits] [llvm] r43667 - /llvm/trunk/docs/tutorial/LangImpl7.html In-Reply-To: <200711032222.lA3MMWfN021918@zion.cs.uiuc.edu> References: <200711032222.lA3MMWfN021918@zion.cs.uiuc.edu> Message-ID: <472D4539.9000400@mxc.ca> Chris Lattner wrote: > +we'll illustrated this below with Kaleidoscope. The final question you may be We've illustrated? We'll illustrate? Nick From sabre at nondot.org Sun Nov 4 01:37:56 2007 From: sabre at nondot.org (Chris Lattner) Date: Sun, 04 Nov 2007 06:37:56 -0000 Subject: [llvm-commits] [llvm] r43668 - /llvm/trunk/lib/Transforms/Scalar/TailDuplication.cpp Message-ID: <200711040637.lA46buSb010922@zion.cs.uiuc.edu> Author: lattner Date: Sun Nov 4 01:37:55 2007 New Revision: 43668 URL: http://llvm.org/viewvc/llvm-project?rev=43668&view=rev Log: Disable tail duplication of call instructions. The cost metric is way off for these in general, and this works around buggy code like that in PR1764. we'll see if there is a big performance impact of this. If so, I'll revert it tomorrow. Modified: llvm/trunk/lib/Transforms/Scalar/TailDuplication.cpp Modified: llvm/trunk/lib/Transforms/Scalar/TailDuplication.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/TailDuplication.cpp?rev=43668&r1=43667&r2=43668&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/TailDuplication.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/TailDuplication.cpp Sun Nov 4 01:37:55 2007 @@ -115,6 +115,11 @@ for (unsigned Size = 0; I != Dest->end(); ++I) { if (Size == Threshold) return false; // The block is too large. + + // Don't tail duplicate call instructions. They are very large compared to + // other instructions. + if (isa(I) || isa(I)) return false; + // Only count instructions that are not debugger intrinsics. if (!isa(I)) ++Size; } From sabre at nondot.org Sun Nov 4 01:51:13 2007 From: sabre at nondot.org (Chris Lattner) Date: Sun, 04 Nov 2007 06:51:13 -0000 Subject: [llvm-commits] [llvm] r43669 - in /llvm/trunk: lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/2007-11-03-x86-64-q-constraint.ll Message-ID: <200711040651.lA46pDXa011689@zion.cs.uiuc.edu> Author: lattner Date: Sun Nov 4 01:51:12 2007 New Revision: 43669 URL: http://llvm.org/viewvc/llvm-project?rev=43669&view=rev Log: Fix PR1763 by allowing the 'q' constraint to work with 64-bit regs on x86-64. Added: llvm/trunk/test/CodeGen/X86/2007-11-03-x86-64-q-constraint.ll Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=43669&r1=43668&r2=43669&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Sun Nov 4 01:51:12 2007 @@ -5708,7 +5708,9 @@ return make_vector(X86::AX, X86::DX, X86::CX, X86::BX, 0); else if (VT == MVT::i8) return make_vector(X86::AL, X86::DL, X86::CL, X86::BL, 0); - break; + else if (VT == MVT::i64) + return make_vector(X86::RAX, X86::RDX, X86::RCX, X86::RBX, 0); + break; } } Added: llvm/trunk/test/CodeGen/X86/2007-11-03-x86-64-q-constraint.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2007-11-03-x86-64-q-constraint.ll?rev=43669&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/2007-11-03-x86-64-q-constraint.ll (added) +++ llvm/trunk/test/CodeGen/X86/2007-11-03-x86-64-q-constraint.ll Sun Nov 4 01:51:12 2007 @@ -0,0 +1,9 @@ +; RUN: llvm-as < %s | llc +; PR1763 +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128" +target triple = "x86_64-unknown-linux-gnu" + +define void @yield() { + %tmp9 = call i64 asm sideeffect "xchgb ${0:b},$1", "=q,*m,0,~{dirflag},~{fpsr},~{flags},~{memory}"( i64* null, i64 0 ) ; + ret void +} From evan.cheng at apple.com Sun Nov 4 02:32:21 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Sun, 04 Nov 2007 08:32:21 -0000 Subject: [llvm-commits] [llvm] r43670 - /llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp Message-ID: <200711040832.lA48WLIt016539@zion.cs.uiuc.edu> Author: evancheng Date: Sun Nov 4 02:32:21 2007 New Revision: 43670 URL: http://llvm.org/viewvc/llvm-project?rev=43670&view=rev Log: If an interval is being undone clear its preference as well since the source interval may have been undone as well. Modified: llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp Modified: llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp?rev=43670&r1=43669&r2=43670&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp Sun Nov 4 02:32:21 2007 @@ -209,7 +209,7 @@ /// different register classes or because the coalescer was overly /// conservative. unsigned RALinScan::attemptTrivialCoalescing(LiveInterval &cur, unsigned Reg) { - if (cur.preference && cur.preference == Reg || !cur.containsOneValue()) + if ((cur.preference && cur.preference == Reg) || !cur.containsOneValue()) return Reg; VNInfo *vni = cur.getValNumInfo(0); @@ -791,6 +791,11 @@ vrm_->clearVirt(i->reg); unhandled_.push(i); } + + // It interval has a preference, it must be defined by a copy. Clear the + // preference now since the source interval allocation may have been undone + // as well. + i->preference = 0; } // Rewind the iterators in the active, inactive, and fixed lists back to the From isanbard at gmail.com Sun Nov 4 05:47:52 2007 From: isanbard at gmail.com (Bill Wendling) Date: Sun, 04 Nov 2007 11:47:52 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r43671 - /llvm-gcc-4.2/trunk/gcc/llvm-symbol-stubs.cpp Message-ID: <200711041147.lA4Blqkb013961@zion.cs.uiuc.edu> Author: void Date: Sun Nov 4 05:47:51 2007 New Revision: 43671 URL: http://llvm.org/viewvc/llvm-project?rev=43671&view=rev Log: Add symbol stubs for simplify_const_unary_operation and get_attr_i387_cw Modified: llvm-gcc-4.2/trunk/gcc/llvm-symbol-stubs.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-symbol-stubs.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-symbol-stubs.cpp?rev=43671&r1=43670&r2=43671&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-symbol-stubs.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-symbol-stubs.cpp Sun Nov 4 05:47:51 2007 @@ -49,6 +49,7 @@ SYMBOL(simplify_gen_relational) SYMBOL(simplify_gen_ternary) SYMBOL(avoid_constant_pool_reference) +SYMBOL(simplify_const_unary_operation) // insn-attr-tab.o (i386) SYMBOL(get_attr_fp_int_src) @@ -58,4 +59,4 @@ SYMBOL(get_attr_prefix_0f) SYMBOL(get_attr_type) SYMBOL(get_attr_unit) - +SYMBOL(get_attr_i387_cw) From baldrick at free.fr Sun Nov 4 08:43:58 2007 From: baldrick at free.fr (Duncan Sands) Date: Sun, 04 Nov 2007 14:43:58 -0000 Subject: [llvm-commits] [llvm] r43672 - in /llvm/trunk: include/llvm/Target/TargetData.h lib/Transforms/Scalar/ScalarReplAggregates.cpp test/Transforms/ScalarRepl/2007-11-03-bigendian_apint.ll Message-ID: <200711041443.lA4EhwHn020511@zion.cs.uiuc.edu> Author: baldrick Date: Sun Nov 4 08:43:57 2007 New Revision: 43672 URL: http://llvm.org/viewvc/llvm-project?rev=43672&view=rev Log: Change uses of getTypeSize to getABITypeSize, getTypeStoreSize or getTypeSizeInBits as appropriate in ScalarReplAggregates. The right change to make was not always obvious, so it would be good to have an sroa guru review this. While there I noticed some bugs, and fixed them: (1) arrays of x86 long double have holes due to alignment padding, but this wasn't being spotted by HasStructPadding (renamed to HasPadding). The same goes for arrays of oddly sized ints. Vectors also suffer from this, in fact the problem for vectors is much worse because basic vector assumptions seem to be broken by vectors of type with alignment padding. I didn't try to fix any of these vector problems. (2) The code for extracting smaller integers from larger ones (in the "int union" case) was wrong on big-endian machines for integers with size not a multiple of 8, like i1. Probably this is impossible to hit via llvm-gcc, but I fixed it anyway while there and added a testcase. I also got rid of some trailing whitespace and changed a function name which had an obvious typo in it. Added: llvm/trunk/test/Transforms/ScalarRepl/2007-11-03-bigendian_apint.ll Modified: llvm/trunk/include/llvm/Target/TargetData.h llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Modified: llvm/trunk/include/llvm/Target/TargetData.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetData.h?rev=43672&r1=43671&r2=43672&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetData.h (original) +++ llvm/trunk/include/llvm/Target/TargetData.h Sun Nov 4 08:43:57 2007 @@ -277,7 +277,11 @@ assert(Idx < NumElements && "Invalid element idx!"); return MemberOffsets[Idx]; } - + + uint64_t getElementOffsetInBits(unsigned Idx) const { + return getElementOffset(Idx)*8; + } + private: friend class TargetData; // Only TargetData can create this class StructLayout(const StructType *ST, const TargetData &TD); Modified: llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp?rev=43672&r1=43671&r2=43672&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Sun Nov 4 08:43:57 2007 @@ -220,7 +220,7 @@ (isa(AI->getAllocatedType()) || isa(AI->getAllocatedType())) && AI->getAllocatedType()->isSized() && - TD.getTypeSize(AI->getAllocatedType()) < SRThreshold) { + TD.getABITypeSize(AI->getAllocatedType()) < SRThreshold) { // Check that all of the users of the allocation are capable of being // transformed. switch (isSafeAllocaToScalarRepl(AI)) { @@ -519,7 +519,8 @@ // If not the whole aggregate, give up. const TargetData &TD = getAnalysis(); - if (Length->getZExtValue() != TD.getTypeSize(AI->getType()->getElementType())) + if (Length->getZExtValue() != + TD.getABITypeSize(AI->getType()->getElementType())) return MarkUnsafe(Info); // We only know about memcpy/memset/memmove. @@ -658,17 +659,17 @@ const Type *ValTy = EltTy; if (const VectorType *VTy = dyn_cast(ValTy)) ValTy = VTy->getElementType(); - + // Construct an integer with the right value. - unsigned EltSize = TD.getTypeSize(ValTy); - APInt OneVal(EltSize*8, CI->getZExtValue()); + unsigned EltSize = TD.getTypeSizeInBits(ValTy); + APInt OneVal(EltSize, CI->getZExtValue()); APInt TotalVal(OneVal); // Set each byte. - for (unsigned i = 0; i != EltSize-1; ++i) { + for (unsigned i = 0; 8*i < EltSize; ++i) { TotalVal = TotalVal.shl(8); TotalVal |= OneVal; } - + // Convert the integer value to the appropriate type. StoreVal = ConstantInt::get(TotalVal); if (isa(ValTy)) @@ -701,7 +702,7 @@ OtherElt = new BitCastInst(OtherElt, BytePtrTy,OtherElt->getNameStr(), MI); - unsigned EltSize = TD.getTypeSize(EltTy); + unsigned EltSize = TD.getABITypeSize(EltTy); // Finally, insert the meminst for this element. if (isa(MI) || isa(MI)) { @@ -730,43 +731,45 @@ } } -/// HasStructPadding - Return true if the specified type has any structure -/// padding, false otherwise. -static bool HasStructPadding(const Type *Ty, const TargetData &TD) { +/// HasPadding - Return true if the specified type has any structure or +/// alignment padding, false otherwise. +static bool HasPadding(const Type *Ty, const TargetData &TD) { if (const StructType *STy = dyn_cast(Ty)) { const StructLayout *SL = TD.getStructLayout(STy); unsigned PrevFieldBitOffset = 0; for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) { - unsigned FieldBitOffset = SL->getElementOffset(i)*8; - + unsigned FieldBitOffset = SL->getElementOffsetInBits(i); + // Padding in sub-elements? - if (HasStructPadding(STy->getElementType(i), TD)) + if (HasPadding(STy->getElementType(i), TD)) return true; - + // Check to see if there is any padding between this element and the // previous one. if (i) { - unsigned PrevFieldEnd = + unsigned PrevFieldEnd = PrevFieldBitOffset+TD.getTypeSizeInBits(STy->getElementType(i-1)); if (PrevFieldEnd < FieldBitOffset) return true; } - + PrevFieldBitOffset = FieldBitOffset; } - + // Check for tail padding. if (unsigned EltCount = STy->getNumElements()) { unsigned PrevFieldEnd = PrevFieldBitOffset + TD.getTypeSizeInBits(STy->getElementType(EltCount-1)); - if (PrevFieldEnd < SL->getSizeInBytes()*8) + if (PrevFieldEnd < SL->getSizeInBits()) return true; } } else if (const ArrayType *ATy = dyn_cast(Ty)) { - return HasStructPadding(ATy->getElementType(), TD); + return HasPadding(ATy->getElementType(), TD); + } else if (const VectorType *VTy = dyn_cast(Ty)) { + return HasPadding(VTy->getElementType(), TD); } - return false; + return TD.getTypeSizeInBits(Ty) != TD.getABITypeSizeInBits(Ty); } /// isSafeStructAllocaToScalarRepl - Check to see if the specified allocation of @@ -793,10 +796,9 @@ // types, but may actually be used. In these cases, we refuse to promote the // struct. if (Info.isMemCpySrc && Info.isMemCpyDst && - HasStructPadding(AI->getType()->getElementType(), - getAnalysis())) + HasPadding(AI->getType()->getElementType(), getAnalysis())) return 0; - + // If we require cleanup, return 1, otherwise return 3. return Info.needsCanon ? 1 : 3; } @@ -929,10 +931,10 @@ return false; } -/// getUIntAtLeastAsBitAs - Return an unsigned integer type that is at least +/// getUIntAtLeastAsBigAs - Return an unsigned integer type that is at least /// as big as the specified type. If there is no suitable type, this returns /// null. -const Type *getUIntAtLeastAsBitAs(unsigned NumBits) { +const Type *getUIntAtLeastAsBigAs(unsigned NumBits) { if (NumBits > 64) return 0; if (NumBits > 32) return Type::Int64Ty; if (NumBits > 16) return Type::Int32Ty; @@ -974,7 +976,7 @@ // Check to see if this is stepping over an element: GEP Ptr, int C if (GEP->getNumOperands() == 2 && isa(GEP->getOperand(1))) { unsigned Idx = cast(GEP->getOperand(1))->getZExtValue(); - unsigned ElSize = TD.getTypeSize(PTy->getElementType()); + unsigned ElSize = TD.getABITypeSize(PTy->getElementType()); unsigned BitOffset = Idx*ElSize*8; if (BitOffset > 64 || !isPowerOf2_32(ElSize)) return 0; @@ -983,7 +985,7 @@ if (SubElt == 0) return 0; if (SubElt != Type::VoidTy && SubElt->isInteger()) { const Type *NewTy = - getUIntAtLeastAsBitAs(TD.getTypeSize(SubElt)*8+BitOffset); + getUIntAtLeastAsBigAs(TD.getABITypeSizeInBits(SubElt)+BitOffset); if (NewTy == 0 || MergeInType(NewTy, UsedType, TD)) return 0; continue; } @@ -1020,7 +1022,7 @@ } else { return 0; } - const Type *NTy = getUIntAtLeastAsBitAs(TD.getTypeSize(AggTy)*8); + const Type *NTy = getUIntAtLeastAsBigAs(TD.getABITypeSizeInBits(AggTy)); if (NTy == 0 || MergeInType(NTy, UsedType, TD)) return 0; const Type *SubTy = CanConvertToScalar(GEP, IsNotTrivial); if (SubTy == 0) return 0; @@ -1083,7 +1085,7 @@ NV = new BitCastInst(NV, LI->getType(), LI->getName(), LI); } else { // Must be an element access. - unsigned Elt = Offset/(TD.getTypeSize(PTy->getElementType())*8); + unsigned Elt = Offset/TD.getABITypeSizeInBits(PTy->getElementType()); NV = new ExtractElementInst( NV, ConstantInt::get(Type::Int32Ty, Elt), "tmp", LI); } @@ -1094,17 +1096,20 @@ NV = new BitCastInst(NV, LI->getType(), LI->getName(), LI); } else { const IntegerType *NTy = cast(NV->getType()); - unsigned LIBitWidth = TD.getTypeSizeInBits(LI->getType()); - + // If this is a big-endian system and the load is narrower than the // full alloca type, we need to do a shift to get the right bits. int ShAmt = 0; if (TD.isBigEndian()) { - ShAmt = NTy->getBitWidth()-LIBitWidth-Offset; + // On big-endian machines, the lowest bit is stored at the bit offset + // from the pointer given by getTypeStoreSizeInBits. This matters for + // integers with a bitwidth that is not a multiple of 8. + ShAmt = TD.getTypeStoreSizeInBits(NTy) - + TD.getTypeStoreSizeInBits(LI->getType()) - Offset; } else { ShAmt = Offset; } - + // Note: we support negative bitwidths (with shl) which are not defined. // We do this to support (f.e.) loads off the end of a structure where // only some bits are used. @@ -1118,6 +1123,7 @@ LI->getName(), LI); // Finally, unconditionally truncate the integer to the right width. + unsigned LIBitWidth = TD.getTypeSizeInBits(LI->getType()); if (LIBitWidth < NTy->getBitWidth()) NV = new TruncInst(NV, IntegerType::get(LIBitWidth), LI->getName(), LI); @@ -1151,9 +1157,9 @@ // access or a bitcast to another vector type. if (isa(SV->getType())) { SV = new BitCastInst(SV, AllocaType, SV->getName(), SI); - } else { + } else { // Must be an element insertion. - unsigned Elt = Offset/(TD.getTypeSize(PTy->getElementType())*8); + unsigned Elt = Offset/TD.getABITypeSizeInBits(PTy->getElementType()); SV = new InsertElementInst(Old, SV, ConstantInt::get(Type::Int32Ty, Elt), "tmp", SI); @@ -1170,7 +1176,7 @@ // If it is a pointer, do the same, and also handle ptr->ptr casts // here. unsigned SrcWidth = TD.getTypeSizeInBits(SV->getType()); - unsigned DestWidth = AllocaType->getPrimitiveSizeInBits(); + unsigned DestWidth = TD.getTypeSizeInBits(AllocaType); if (SV->getType()->isFloatingPoint()) SV = new BitCastInst(SV, IntegerType::get(SrcWidth), SV->getName(), SI); @@ -1180,16 +1186,20 @@ // Always zero extend the value if needed. if (SV->getType() != AllocaType) SV = new ZExtInst(SV, AllocaType, SV->getName(), SI); - + // If this is a big-endian system and the store is narrower than the // full alloca type, we need to do a shift to get the right bits. int ShAmt = 0; if (TD.isBigEndian()) { - ShAmt = DestWidth-SrcWidth-Offset; + // On big-endian machines, the lowest bit is stored at the bit offset + // from the pointer given by getTypeStoreSizeInBits. This matters for + // integers with a bitwidth that is not a multiple of 8. + ShAmt = TD.getTypeStoreSizeInBits(AllocaType) - + TD.getTypeStoreSizeInBits(SV->getType()) - Offset; } else { ShAmt = Offset; } - + // Note: we support negative bitwidths (with shr) which are not defined. // We do this to support (f.e.) stores off the end of a structure where // only some bits in the structure are set. @@ -1225,8 +1235,9 @@ const PointerType *AggPtrTy = cast(GEP->getOperand(0)->getType()); const TargetData &TD = getAnalysis(); - unsigned AggSizeInBits = TD.getTypeSize(AggPtrTy->getElementType())*8; - + unsigned AggSizeInBits = + TD.getABITypeSizeInBits(AggPtrTy->getElementType()); + // Check to see if this is stepping over an element: GEP Ptr, int C unsigned NewOffset = Offset; if (GEP->getNumOperands() == 2) { @@ -1239,12 +1250,13 @@ unsigned Idx = cast(GEP->getOperand(2))->getZExtValue(); const Type *AggTy = AggPtrTy->getElementType(); if (const SequentialType *SeqTy = dyn_cast(AggTy)) { - unsigned ElSizeBits = TD.getTypeSize(SeqTy->getElementType())*8; + unsigned ElSizeBits = + TD.getABITypeSizeInBits(SeqTy->getElementType()); NewOffset += ElSizeBits*Idx; } else if (const StructType *STy = dyn_cast(AggTy)) { unsigned EltBitOffset = - TD.getStructLayout(STy)->getElementOffset(Idx)*8; + TD.getStructLayout(STy)->getElementOffsetInBits(Idx); NewOffset += EltBitOffset; } else { Added: llvm/trunk/test/Transforms/ScalarRepl/2007-11-03-bigendian_apint.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/ScalarRepl/2007-11-03-bigendian_apint.ll?rev=43672&view=auto ============================================================================== --- llvm/trunk/test/Transforms/ScalarRepl/2007-11-03-bigendian_apint.ll (added) +++ llvm/trunk/test/Transforms/ScalarRepl/2007-11-03-bigendian_apint.ll Sun Nov 4 08:43:57 2007 @@ -0,0 +1,30 @@ +; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | not grep shr + +%struct.S = type { i16 } + +define i1 @f(i16 signext %b) zeroext { +entry: + %b_addr = alloca i16 ; [#uses=2] + %retval = alloca i32 ; [#uses=2] + %s = alloca %struct.S ; <%struct.S*> [#uses=2] + %tmp = alloca i32 ; [#uses=2] + %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] + store i16 %b, i16* %b_addr + %tmp1 = getelementptr %struct.S* %s, i32 0, i32 0 ; [#uses=1] + %tmp2 = load i16* %b_addr, align 2 ; [#uses=1] + store i16 %tmp2, i16* %tmp1, align 2 + %tmp3 = getelementptr %struct.S* %s, i32 0, i32 0 ; [#uses=1] + %tmp34 = bitcast i16* %tmp3 to [2 x i1]* ; <[2 x i1]*> [#uses=1] + %tmp5 = getelementptr [2 x i1]* %tmp34, i32 0, i32 1 ; [#uses=1] + %tmp6 = load i1* %tmp5, align 1 ; [#uses=1] + %tmp67 = zext i1 %tmp6 to i32 ; [#uses=1] + store i32 %tmp67, i32* %tmp, align 4 + %tmp8 = load i32* %tmp, align 4 ; [#uses=1] + store i32 %tmp8, i32* %retval, align 4 + br label %return + +return: ; preds = %entry + %retval9 = load i32* %retval ; [#uses=1] + %retval910 = trunc i32 %retval9 to i1 ; [#uses=1] + ret i1 %retval910 +} From gordonhenriksen at mac.com Sun Nov 4 10:12:17 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Sun, 04 Nov 2007 16:12:17 -0000 Subject: [llvm-commits] [llvm] r43673 - in /llvm/trunk/Xcode/LLVM.xcodeproj: ./ project.pbxproj Message-ID: <200711041612.lA4GCHtW023767@zion.cs.uiuc.edu> Author: gordon Date: Sun Nov 4 10:12:17 2007 New Revision: 43673 URL: http://llvm.org/viewvc/llvm-project?rev=43673&view=rev Log: Removing a dead reference from LLVM.xcodeproj. Modified: llvm/trunk/Xcode/LLVM.xcodeproj/ (props changed) llvm/trunk/Xcode/LLVM.xcodeproj/project.pbxproj Propchange: llvm/trunk/Xcode/LLVM.xcodeproj/ ------------------------------------------------------------------------------ --- svn:ignore (original) +++ svn:ignore Sun Nov 4 10:12:17 2007 @@ -1,2 +1,4 @@ *.perspective *.pbxuser +*.mode1v3 +*.mode2v3 Modified: llvm/trunk/Xcode/LLVM.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/Xcode/LLVM.xcodeproj/project.pbxproj?rev=43673&r1=43672&r2=43673&view=diff ============================================================================== --- llvm/trunk/Xcode/LLVM.xcodeproj/project.pbxproj (original) +++ llvm/trunk/Xcode/LLVM.xcodeproj/project.pbxproj Sun Nov 4 10:12:17 2007 @@ -92,7 +92,6 @@ 9F7793480C73BC2000551F9C /* GVNPRE.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GVNPRE.cpp; sourceTree = ""; }; 9F7793490C73BC2000551F9C /* LoopIndexSplit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LoopIndexSplit.cpp; sourceTree = ""; }; 9F77934A0C73BC2000551F9C /* LoopRotation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LoopRotation.cpp; sourceTree = ""; }; - 9F77934B0C73BC2000551F9C /* RedundantLoadElimination.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RedundantLoadElimination.cpp; sourceTree = ""; }; 9F7793500C73BD1500551F9C /* ELFWriter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ELFWriter.h; sourceTree = ""; }; 9F7793510C73BD1500551F9C /* IfConversion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IfConversion.cpp; sourceTree = ""; }; 9F7793520C73BD1500551F9C /* LowerSubregs.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LowerSubregs.cpp; sourceTree = ""; }; @@ -2071,7 +2070,6 @@ DE66F1AF08ABEFB400323D32 /* LowerPacked.cpp */, CF8F1B5B0B64FA2F00BB4199 /* PredicateSimplifier.cpp */, DE66F1B508ABEFB400323D32 /* Reassociate.cpp */, - 9F77934B0C73BC2000551F9C /* RedundantLoadElimination.cpp */, CF73C0B9098A546000627152 /* Reg2Mem.cpp */, DE66F1B608ABEFB400323D32 /* ScalarReplAggregates.cpp */, DE66F1B708ABEFB400323D32 /* SCCP.cpp */, From gordonhenriksen at mac.com Sun Nov 4 10:15:04 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Sun, 04 Nov 2007 16:15:04 -0000 Subject: [llvm-commits] [llvm] r43674 - in /llvm/trunk: docs/Passes.html lib/Transforms/IPO/StripSymbols.cpp lib/Transforms/Scalar/LowerPacked.cpp lib/Transforms/Scalar/SimplifyCFG.cpp lib/Transforms/Utils/LowerSwitch.cpp lib/Transforms/Utils/PromoteMemoryToRegister.cpp Message-ID: <200711041615.lA4GF4kU023857@zion.cs.uiuc.edu> Author: gordon Date: Sun Nov 4 10:15:04 2007 New Revision: 43674 URL: http://llvm.org/viewvc/llvm-project?rev=43674&view=rev Log: Finishing initial docs for all transformations in Passes.html. Also cleaned up some comments in source files. Modified: llvm/trunk/docs/Passes.html llvm/trunk/lib/Transforms/IPO/StripSymbols.cpp llvm/trunk/lib/Transforms/Scalar/LowerPacked.cpp llvm/trunk/lib/Transforms/Scalar/SimplifyCFG.cpp llvm/trunk/lib/Transforms/Utils/LowerSwitch.cpp llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp Modified: llvm/trunk/docs/Passes.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/Passes.html?rev=43674&r1=43673&r2=43674&view=diff ============================================================================== --- llvm/trunk/docs/Passes.html (original) +++ llvm/trunk/docs/Passes.html Sun Nov 4 10:15:04 2007 @@ -1149,7 +1149,11 @@ Internalize Global Symbols
      -

      Yet to be written.

      +

      + This pass loops over all of the functions in the input module, looking for a + main function. If a main function is found, all other functions and all + global variables with initializers are marked as internal. +

      @@ -1157,7 +1161,13 @@ Interprocedural constant propagation
      -

      Yet to be written.

      +

      + This pass implements an extremely simple interprocedural constant + propagation pass. It could certainly be improved in many different ways, + like using a worklist. This pass makes arguments dead, but does not remove + them. The existing dead argument elimination pass should be run after this + to clean up the mess. +

      @@ -1165,7 +1175,10 @@ Interprocedural Sparse Conditional Constant Propagation
      -

      Yet to be written.

      +

      + An interprocedural variant of Sparse Conditional Constant + Propagation. +

      @@ -1173,7 +1186,28 @@ Loop-Closed SSA Form Pass
      -

      Yet to be written.

      +

      + This pass transforms loops by placing phi nodes at the end of the loops for + all values that are live across the loop boundary. For example, it turns + the left into the right code: +

      + +
      for (...)                for (...)
      +  if (c)                   if (c)
      +    X1 = ...                 X1 = ...
      +  else                     else
      +    X2 = ...                 X2 = ...
      +  X3 = phi(X1, X2)         X3 = phi(X1, X2)
      +... = X3 + 4              X4 = phi(X3)
      +                          ... = X4 + 4
      + +

      + This is still valid LLVM; the extra phi nodes are purely redundant, and will + be trivially eliminated by InstCombine. The major benefit of + this transformation is that it makes many other loop optimizations, such as + LoopUnswitching, simpler. +

      @@ -1181,7 +1215,36 @@ Loop Invariant Code Motion
      -

      Yet to be written.

      +

      + This pass performs loop invariant code motion, attempting to remove as much + code from the body of a loop as possible. It does this by either hoisting + code into the preheader block, or by sinking code to the exit blocks if it is + safe. This pass also promotes must-aliased memory locations in the loop to + live in registers, thus hoisting and sinking "invariant" loads and stores. +

      + +

      + This pass uses alias analysis for two purposes: +

      + +
        +
      • Moving loop invariant loads and calls out of loops. If we can determine + that a load or call inside of a loop never aliases anything stored to, + we can hoist it or sink it like any other instruction.
      • +
      • Scalar Promotion of Memory - If there is a store instruction inside of + the loop, we try to move the store to happen AFTER the loop instead of + inside of the loop. This can only happen if a few conditions are true: +
          +
        • The pointer stored through is loop invariant.
        • +
        • There are no stores or loads in the loop which may alias + the pointer. There are no calls in the loop which mod/ref the + pointer.
        • +
        + If these conditions are true, we can promote the loads and stores in the + loop of the pointer to use a temporary alloca'd variable. We then use + the mem2reg functionality to construct the appropriate SSA form for the + variable.
      • +
      @@ -1189,7 +1252,12 @@ Extract loops into new functions
      -

      Yet to be written.

      +

      + A pass wrapper around the ExtractLoop() scalar transformation to + extract each top-level loop into its own new function. If the loop is the + only loop in a given function, it is not touched. This is a pass most + useful for debugging via bugpoint. +

      @@ -1197,7 +1265,11 @@ Extract at most one loop into a new function
      -

      Yet to be written.

      +

      + Similar to Extract loops into new functions, + this pass extracts one natural loop from the program into a function if it + can. This is used by bugpoint. +

      @@ -1205,7 +1277,10 @@ Index Split Loops
      -

      Yet to be written.

      +

      + This pass divides loop's iteration range by spliting loop such that each + individual loop is executed efficiently. +

      @@ -1213,7 +1288,13 @@ Loop Strength Reduction
      -

      Yet to be written.

      +

      + This pass performs a strength reduction on array references inside loops that + have as one or more of their components the loop induction variable. This is + accomplished by creating a new value to hold the initial value of the array + access for the first iteration, and then creating a new GEP instruction in + the loop to increment the value by the appropriate amount. +

      @@ -1221,7 +1302,7 @@ Rotate Loops
      -

      Yet to be written.

      +

      A simple loop rotation transformation.

      @@ -1229,7 +1310,11 @@ Unroll loops
      -

      Yet to be written.

      +

      + This pass implements a simple loop unroller. It works best when loops have + been canonicalized by the -indvars pass, + allowing it to determine the trip counts of loops easily. +

      @@ -1237,7 +1322,29 @@ Unswitch loops
      -

      Yet to be written.

      +

      + This pass transforms loops that contain branches on loop-invariant conditions + to have multiple loops. For example, it turns the left into the right code: +

      + +
      for (...)                  if (lic)
      +  A                          for (...)
      +  if (lic)                     A; B; C
      +    B                      else
      +  C                          for (...)
      +                               A; C
      + +

      + This can increase the size of the code exponentially (doubling it every time + a loop is unswitched) so we only unswitch if the resultant code will be + smaller than a threshold. +

      + +

      + This pass expects LICM to be run before it to hoist invariant conditions out + of the loop, to make the unswitching opportunity obvious. +

      @@ -1245,7 +1352,40 @@ Canonicalize natural loops
      -

      Yet to be written.

      +

      + This pass performs several transformations to transform natural loops into a + simpler form, which makes subsequent analyses and transformations simpler and + more effective. +

      + +

      + Loop pre-header insertion guarantees that there is a single, non-critical + entry edge from outside of the loop to the loop header. This simplifies a + number of analyses and transformations, such as LICM. +

      + +

      + Loop exit-block insertion guarantees that all exit blocks from the loop + (blocks which are outside of the loop that have predecessors inside of the + loop) only have predecessors from inside of the loop (and are thus dominated + by the loop header). This simplifies transformations such as store-sinking + that are built into LICM. +

      + +

      + This pass also guarantees that loops will have exactly one backedge. +

      + +

      + Note that the simplifycfg pass will clean up blocks which are split out but + end up being unnecessary, so usage of this pass should not pessimize + generated code. +

      + +

      + This pass obviously modifies the CFG, but updates loop information and + dominator information. +

      @@ -1253,7 +1393,10 @@ lowers packed operations to operations on smaller packed datatypes
      -

      Yet to be written.

      +

      + Lowers operations on vector datatypes into operations on more primitive vector + datatypes, and finally to scalar operations. +

      @@ -1261,7 +1404,15 @@ Lower allocations from instructions to calls
      -

      Yet to be written.

      +

      + Turn malloc and free instructions into @malloc and + @free calls. +

      + +

      + This is a target-dependent tranformation because it depends on the size of + data types and alignment constraints. +

      @@ -1269,7 +1420,22 @@ Lower GC intrinsics, for GCless code generators
      -

      Yet to be written.

      +

      + This file implements lowering for the llvm.gc* intrinsics for targets + that do not natively support them (which includes the C backend). Note that + the code generated is not as efficient as it would be for targets that + natively support the GC intrinsics, but it is useful for getting new targets + up-and-running quickly. +

      + +

      + This pass implements the code transformation described in this paper: +

      + +

      + "Accurate Garbage Collection in an Uncooperative Environment" + Fergus Henderson, ISMM, 2002 +

      @@ -1277,7 +1443,40 @@ Lower invoke and unwind, for unwindless code generators
      -

      Yet to be written.

      +

      + This transformation is designed for use by code generators which do not yet + support stack unwinding. This pass supports two models of exception handling + lowering, the 'cheap' support and the 'expensive' support. +

      + +

      + 'Cheap' exception handling support gives the program the ability to execute + any program which does not "throw an exception", by turning 'invoke' + instructions into calls and by turning 'unwind' instructions into calls to + abort(). If the program does dynamically use the unwind instruction, the + program will print a message then abort. +

      + +

      + 'Expensive' exception handling support gives the full exception handling + support to the program at the cost of making the 'invoke' instruction + really expensive. It basically inserts setjmp/longjmp calls to emulate the + exception handling as necessary. +

      + +

      + Because the 'expensive' support slows down programs a lot, and EH is only + used for a subset of the programs, it must be specifically enabled by the + -enable-correct-eh-support option. +

      + +

      + Note that after this pass runs the CFG is not entirely accurate (exceptional + control flow edges are not correct anymore) so only very simple things should + be done after the lowerinvoke pass has run (like generation of native code). + This should not be used as a general purpose "my LLVM-to-LLVM pass doesn't + support the invoke instruction yet" lowering pass. +

      @@ -1285,7 +1484,18 @@ Lower select instructions to branches
      -

      Yet to be written.

      +

      + Lowers select instructions into conditional branches for targets that do not + have conditional moves or that have not implemented the select instruction + yet. +

      + +

      + Note that this pass could be improved. In particular it turns every select + instruction into a new conditional branch, even though some common cases have + select instructions on the same predicate next to each other. It would be + better to use the same branch for the whole group of selects. +

      @@ -1293,7 +1503,28 @@ Lower Set Jump
      -

      Yet to be written.

      +

      + Lowers setjmp and longjmp to use the LLVM invoke and unwind + instructions as necessary. +

      + +

      + Lowering of longjmp is fairly trivial. We replace the call with a + call to the LLVM library function __llvm_sjljeh_throw_longjmp(). + This unwinds the stack for us calling all of the destructors for + objects allocated on the stack. +

      + +

      + At a setjmp call, the basic block is split and the setjmp + removed. The calls in a function that have a setjmp are converted to + invoke where the except part checks to see if it's a longjmp + exception and, if so, if it's handled in the function. If it is, then it gets + the value returned by the longjmp and goes to where the basic block + was split. invoke instructions are handled in a similar fashion with + the original except block being executed if it isn't a longjmp + except that is handled by that function. +

      @@ -1301,7 +1532,11 @@ Lower SwitchInst's to branches
      -

      Yet to be written.

      +

      + Rewrites switch instructions with a sequence of branches, which + allows targets to get away with not implementing the switch instruction until + it is convenient. +

      @@ -1309,7 +1544,15 @@ Promote Memory to Register
      -

      Yet to be written.

      +

      + This file promotes memory references to be register references. It promotes + alloca instructions which only have loads and + stores as uses. An alloca is transformed by using dominator + frontiers to place phi nodes, then traversing the function in + depth-first order to rewrite loads and stores as + appropriate. This is just the standard SSA construction algorithm to construct + "pruned" SSA form. +

      @@ -1317,7 +1560,10 @@ Unify function exit nodes
      -

      Yet to be written.

      +

      + Ensure that functions have at most one ret instruction in them. + Additionally, it keeps track of which node is the new exit node of the CFG. +

      @@ -1325,7 +1571,21 @@ Predicate Simplifier
      -

      Yet to be written.

      +

      + Path-sensitive optimizer. In a branch where x == y, replace uses of + x with y. Permits further optimization, such as the + elimination of the unreachable call: +

      + +
      void test(int *p, int *q)
      +{
      +  if (p != q)
      +    return;
      +
      +  if (*p != *q)
      +    foo(); // unreachable
      +}
      @@ -1333,7 +1593,12 @@ Remove unused exception handling info
      -

      Yet to be written.

      +

      + This file implements a simple interprocedural pass which walks the call-graph, + turning invoke instructions into call instructions if and + only if the callee cannot throw an exception. It implements this as a + bottom-up traversal of the call-graph. +

      @@ -1341,7 +1606,10 @@ Raise allocations from calls to instructions
      -

      Yet to be written.

      +

      + Converts @malloc and @free calls to malloc and + free instructions. +

      @@ -1349,7 +1617,22 @@ Reassociate expressions
      -

      Yet to be written.

      +

      + This pass reassociates commutative expressions in an order that is designed + to promote better constant propagation, GCSE, LICM, PRE, etc. +

      + +

      + For example: 4 + (x + 5) ??? x + (4 + 5) +

      + +

      + In the implementation of this algorithm, constants are assigned rank = 0, + function arguments are rank = 1, and other values are assigned ranks + corresponding to the reverse post order traversal of current function + (starting at 2), which effectively gives values in deep loops higher rank + than values not in loops. +

      @@ -1357,7 +1640,16 @@ Demote all values to stack slots
      -

      Yet to be written.

      +

      + This file demotes all registers to memory references. It is intented to be + the inverse of -mem2reg. By converting to + load instructions, the only values live accross basic blocks are + alloca instructions and load instructions before + phi nodes. It is intended that this should make CFG hacking much + easier. To make later hacking easier, the entry block is split into two, such + that all introduced alloca instructions (and nothing else) are in the + entry block. +

      @@ -1365,7 +1657,21 @@ Scalar Replacement of Aggregates
      -

      Yet to be written.

      +

      + The well-known scalar replacement of aggregates transformation. This + transform breaks up alloca instructions of aggregate type (structure + or array) into individual alloca instructions for each member if + possible. Then, if possible, it transforms the individual alloca + instructions into nice clean scalar SSA form. +

      + +

      + This combines a simple scalar replacement of aggregates algorithm with the mem2reg algorithm because often interact, + especially for C++ programs. As such, iterating between scalarrepl, + then mem2reg until we run out of things to + promote works well. +

      @@ -1373,7 +1679,22 @@ Sparse Conditional Constant Propagation
      -

      Yet to be written.

      +

      + Sparse conditional constant propagation and merging, which can be summarized + as: +

      + +
        +
      1. Assumes values are constant unless proven otherwise
      2. +
      3. Assumes BasicBlocks are dead unless proven otherwise
      4. +
      5. Proves values to be constant, and replaces them with constants
      6. +
      7. Proves conditional branches to be unconditional
      8. +
      + +

      + Note that this pass has a habit of making definitions be dead. It is a good + idea to to run a DCE pass sometime after running this pass. +

      @@ -1381,7 +1702,12 @@ Simplify well-known library calls
      -

      Yet to be written.

      +

      + Applies a variety of small optimizations for calls to specific well-known + function calls (e.g. runtime library functions). For example, a call + exit(3) that occurs within the main() function can be + transformed into simply return 3. +

      @@ -1389,7 +1715,18 @@ Simplify the CFG
      -

      Yet to be written.

      +

      + Performs dead code elimination and basic block merging. Specifically: +

      + +
        +
      1. Removes basic blocks with no predecessors.
      2. +
      3. Merges a basic block into its predecessor if there is only one and the + predecessor only has one successor.
      4. +
      5. Eliminates PHI nodes for basic blocks with a single predecessor.
      6. +
      7. Eliminates a basic block that only contains an unconditional + branch.
      8. +
      @@ -1397,7 +1734,21 @@ Strip all symbols from a module
      -

      Yet to be written.

      +

      + Performs code stripping. This transformation can delete: +

      + +
        +
      1. names for virtual registers
      2. +
      3. symbols for internal globals and functions
      4. +
      5. debug information
      6. +
      + +

      + Note that this transformation makes code much less readable, so it should + only be used in situations where the strip utility would be used, + such as reducing code size or making it harder to reverse engineer code. +

      @@ -1405,7 +1756,31 @@ Tail Call Elimination
      -

      Yet to be written.

      +

      + This file transforms calls of the current function (self recursion) followed + by a return instruction with a branch to the entry of the function, creating + a loop. This pass also implements the following extensions to the basic + algorithm: +

      + +
        +
      • Trivial instructions between the call and return do not prevent the + transformation from taking place, though currently the analysis cannot + support moving any really useful instructions (only dead ones). +
      • This pass transforms functions that are prevented from being tail + recursive by an associative expression to use an accumulator variable, + thus compiling the typical naive factorial or fib implementation + into efficient code. +
      • TRE is performed if the function returns void, if the return + returns the result returned by the call, or if the function returns a + run-time constant on all exits from the function. It is possible, though + unlikely, that the return returns something else (like constant 0), and + can still be TRE'd. It can be TRE'd if all other return + instructions in the function return the exact same value. +
      • If it can prove that callees do not access theier caller stack frame, + they are marked as eligible for tail call elimination (by the code + generator). +
      @@ -1413,7 +1788,13 @@ Tail Duplication
      -

      Yet to be written.

      +

      + This pass performs a limited form of tail duplication, intended to simplify + CFGs by removing some unconditional branches. This pass is necessary to + straighten out loops created by the C front-end, but also is capable of + making other code nicer. After this pass is run, the CFG simplify pass + should be run to clean up the mess. +

      Modified: llvm/trunk/lib/Transforms/IPO/StripSymbols.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/StripSymbols.cpp?rev=43674&r1=43673&r2=43674&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/StripSymbols.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/StripSymbols.cpp Sun Nov 4 10:15:04 2007 @@ -7,18 +7,16 @@ // //===----------------------------------------------------------------------===// // -// This file implements stripping symbols out of symbol tables. -// -// Specifically, this allows you to strip all of the symbols out of: -// * All functions in a module -// * All non-essential symbols in a module (all function symbols + all module -// scope symbols) -// * Debug information. -// -// Notice that: -// * This pass makes code much less readable, so it should only be used in -// situations where the 'strip' utility would be used (such as reducing -// code size, and making it harder to reverse engineer code). +// The StripSymbols transformation implements code stripping. Specifically, it +// can delete: +// +// * names for virtual registers +// * symbols for internal globals and functions +// * debug information +// +// Note that this transformation makes code much less readable, so it should +// only be used in situations where the 'strip' utility would be used, such as +// reducing code size or making it harder to reverse engineer code. // //===----------------------------------------------------------------------===// Modified: llvm/trunk/lib/Transforms/Scalar/LowerPacked.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LowerPacked.cpp?rev=43674&r1=43673&r2=43674&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LowerPacked.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LowerPacked.cpp Sun Nov 4 10:15:04 2007 @@ -7,8 +7,8 @@ // //===----------------------------------------------------------------------===// // -// This file implements lowering Packed datatypes into more primitive -// Packed datatypes, and finally to scalar operations. +// This file implements lowering vector datatypes into more primitive +// vector datatypes, and finally to scalar operations. // //===----------------------------------------------------------------------===// Modified: llvm/trunk/lib/Transforms/Scalar/SimplifyCFG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SimplifyCFG.cpp?rev=43674&r1=43673&r2=43674&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/SimplifyCFG.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/SimplifyCFG.cpp Sun Nov 4 10:15:04 2007 @@ -8,13 +8,13 @@ //===----------------------------------------------------------------------===// // // This file implements dead code elimination and basic block merging. +// Specifically: // -// Specifically, this: -// * removes basic blocks with no predecessors -// * merges a basic block into its predecessor if there is only one and the +// * Removes basic blocks with no predecessors. +// * Merges a basic block into its predecessor if there is only one and the // predecessor only has one successor. -// * Eliminates PHI nodes for basic blocks with a single predecessor -// * Eliminates a basic block that only contains an unconditional branch +// * Eliminates PHI nodes for basic blocks with a single predecessor. +// * Eliminates a basic block that only contains an unconditional branch. // //===----------------------------------------------------------------------===// Modified: llvm/trunk/lib/Transforms/Utils/LowerSwitch.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LowerSwitch.cpp?rev=43674&r1=43673&r2=43674&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/LowerSwitch.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/LowerSwitch.cpp Sun Nov 4 10:15:04 2007 @@ -7,9 +7,9 @@ // //===----------------------------------------------------------------------===// // -// The LowerSwitch transformation rewrites switch statements with a sequence of -// branches, which allows targets to get away with not implementing the switch -// statement until it is convenient. +// The LowerSwitch transformation rewrites switch instructions with a sequence +// of branches, which allows targets to get away with not implementing the +// switch instruction until it is convenient. // //===----------------------------------------------------------------------===// Modified: llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp?rev=43674&r1=43673&r2=43674&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp Sun Nov 4 10:15:04 2007 @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// // -// This file promote memory references to be register references. It promotes +// This file promotes memory references to be register references. It promotes // alloca instructions which only have loads and stores as uses. An alloca is // transformed by using dominator frontiers to place PHI nodes, then traversing // the function in depth-first order to rewrite loads and stores as appropriate. From gordonhenriksen at mac.com Sun Nov 4 10:17:00 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Sun, 04 Nov 2007 16:17:00 -0000 Subject: [llvm-commits] [llvm] r43675 - /llvm/trunk/docs/Passes.html Message-ID: <200711041617.lA4GH0mx023938@zion.cs.uiuc.edu> Author: gordon Date: Sun Nov 4 10:17:00 2007 New Revision: 43675 URL: http://llvm.org/viewvc/llvm-project?rev=43675&view=rev Log: Fix a validation error. Modified: llvm/trunk/docs/Passes.html Modified: llvm/trunk/docs/Passes.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/Passes.html?rev=43675&r1=43674&r2=43675&view=diff ============================================================================== --- llvm/trunk/docs/Passes.html (original) +++ llvm/trunk/docs/Passes.html Sun Nov 4 10:17:00 2007 @@ -989,7 +989,7 @@ the dependence on the exit value of the induction variable. If the only purpose of the loop is to compute the exit value of some derived expression, this transformation will make the loop dead. -

      +

      This transformation should be followed by strength reduction after all of the From gordonhenriksen at mac.com Sun Nov 4 10:59:53 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Sun, 4 Nov 2007 11:59:53 -0500 Subject: [llvm-commits] [PATCH] -emitbitcode is a noop Message-ID: <562AEA71-3D81-4E53-BF84-5103B1BD9E22@mac.com> As registered, -emitbitcode is a noop pass. Better to just override WriteBitcodePass::getPassName and not bother with creating a command- line option. Any objections? ? Gordon -------------- next part -------------- A non-text attachment was scrubbed... Name: noop-bitwriter.patch Type: application/octet-stream Size: 1212 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20071104/6c204e17/attachment.obj -------------- next part -------------- From clattner at apple.com Sun Nov 4 11:11:59 2007 From: clattner at apple.com (Chris Lattner) Date: Sun, 4 Nov 2007 09:11:59 -0800 Subject: [llvm-commits] [llvm] r43674 - in /llvm/trunk: docs/Passes.html lib/Transforms/IPO/StripSymbols.cpp lib/Transforms/Scalar/LowerPacked.cpp lib/Transforms/Scalar/SimplifyCFG.cpp lib/Transforms/Utils/LowerSwitch.cpp lib/Transforms/Utils/PromoteMemoryToRegister.cpp In-Reply-To: <200711041615.lA4GF4kU023857@zion.cs.uiuc.edu> References: <200711041615.lA4GF4kU023857@zion.cs.uiuc.edu> Message-ID: On Nov 4, 2007, at 8:15 AM, Gordon Henriksen wrote: > Author: gordon > Date: Sun Nov 4 10:15:04 2007 > New Revision: 43674 > > URL: http://llvm.org/viewvc/llvm-project?rev=43674&view=rev > Log: > Finishing initial docs for all transformations in Passes.html. Whoa, very nice!! -Chris From clattner at apple.com Sun Nov 4 11:22:17 2007 From: clattner at apple.com (Chris Lattner) Date: Sun, 4 Nov 2007 09:22:17 -0800 Subject: [llvm-commits] [llvm] r43668 - /llvm/trunk/lib/Transforms/Scalar/TailDuplication.cpp In-Reply-To: <200711040637.lA46buSb010922@zion.cs.uiuc.edu> References: <200711040637.lA46buSb010922@zion.cs.uiuc.edu> Message-ID: <7E8F95B5-E395-499E-8E76-E7400AFB11EE@apple.com> On Nov 3, 2007, at 11:37 PM, Chris Lattner wrote: > Author: lattner > Date: Sun Nov 4 01:37:55 2007 > New Revision: 43668 > > URL: http://llvm.org/viewvc/llvm-project?rev=43668&view=rev > Log: > Disable tail duplication of call instructions. The cost > metric is way off for these in general, and this works around > buggy code like that in PR1764. we'll see if there is a big > performance impact of this. If so, I'll revert it tomorrow. This caused a couple of regressions (notably in treeadd on ppc g5, which is very sensitive to dispatch group formation) but several significant wins, particularly in code size. I'm going to leave it in, -Chris > > Modified: > llvm/trunk/lib/Transforms/Scalar/TailDuplication.cpp > > Modified: llvm/trunk/lib/Transforms/Scalar/TailDuplication.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/TailDuplication.cpp?rev=43668&r1=43667&r2=43668&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Transforms/Scalar/TailDuplication.cpp (original) > +++ llvm/trunk/lib/Transforms/Scalar/TailDuplication.cpp Sun Nov 4 > 01:37:55 2007 > @@ -115,6 +115,11 @@ > > for (unsigned Size = 0; I != Dest->end(); ++I) { > if (Size == Threshold) return false; // The block is too large. > + > + // Don't tail duplicate call instructions. They are very large > compared to > + // other instructions. > + if (isa(I) || isa(I)) return false; > + > // Only count instructions that are not debugger intrinsics. > if (!isa(I)) ++Size; > } > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From nicholas at mxc.ca Sun Nov 4 11:32:10 2007 From: nicholas at mxc.ca (Nick Lewycky) Date: Sun, 04 Nov 2007 17:32:10 -0000 Subject: [llvm-commits] [llvm] r43676 - in /llvm/trunk/lib/Target/PowerPC: PPCAsmPrinter.cpp PPCTargetAsmInfo.cpp Message-ID: <200711041732.lA4HWA9r026760@zion.cs.uiuc.edu> Author: nicholas Date: Sun Nov 4 11:32:10 2007 New Revision: 43676 URL: http://llvm.org/viewvc/llvm-project?rev=43676&view=rev Log: Fix crash before main on ppc/linux with static constructors. PR1771 Modified: llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp Modified: llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp?rev=43676&r1=43675&r2=43676&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp Sun Nov 4 11:32:10 2007 @@ -668,6 +668,8 @@ if (I->hasExternalLinkage()) { O << "\t.global " << name << '\n'; O << "\t.type " << name << ", @object\n"; + if (TAI->getBSSSection()) + SwitchToDataSection(TAI->getBSSSection(), I); O << name << ":\n"; O << "\t.zero " << Size << "\n"; } else if (I->hasInternalLinkage()) { Modified: llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp?rev=43676&r1=43675&r2=43676&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp Sun Nov 4 11:32:10 2007 @@ -60,6 +60,7 @@ HiddenDirective = "\t.private_extern\t"; SupportsExceptionHandling = false; NeedsIndirectEncoding = true; + BSSSection = 0; DwarfAbbrevSection = ".section __DWARF,__debug_abbrev,regular,debug"; DwarfInfoSection = ".section __DWARF,__debug_info,regular,debug"; @@ -94,6 +95,7 @@ StaticDtorsSection = ".section\t.dtors,\"aw\", at progbits"; UsedDirective = "\t# .no_dead_strip\t"; WeakRefDirective = "\t.weak\t"; + BSSSection = "\t.section\t\".sbss\",\"aw\", at nobits"; DwarfAbbrevSection = "\t.section\t.debug_abbrev,\"\", at progbits"; DwarfInfoSection = "\t.section\t.debug_info,\"\", at progbits"; From gordonhenriksen at mac.com Sun Nov 4 12:10:19 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Sun, 04 Nov 2007 18:10:19 -0000 Subject: [llvm-commits] [llvm] r43677 - /llvm/trunk/docs/Passes.html Message-ID: <200711041810.lA4IAJgb028314@zion.cs.uiuc.edu> Author: gordon Date: Sun Nov 4 12:10:18 2007 New Revision: 43677 URL: http://llvm.org/viewvc/llvm-project?rev=43677&view=rev Log: Completing Passes.html with the exception of -emitbitcode, which should be removed. This document could still stand for significant improvement: * Editing the pass descriptions; most were lifted with minimal editing from comments. Although implementation details were elided, many of the were not written for the audience that would be interested in this document. * More "before and after" examples. * More implicit dependency details. (Perhaps listing transforms in -std-compile-opts order would help alleviate this.) * Adding documentation for how to invoke passes programmatically. * Rearranging the document into a more logical taxonomy. For instance, putting profiling passes together. Modified: llvm/trunk/docs/Passes.html Modified: llvm/trunk/docs/Passes.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/Passes.html?rev=43677&r1=43676&r2=43677&view=diff ============================================================================== --- llvm/trunk/docs/Passes.html (original) +++ llvm/trunk/docs/Passes.html Sun Nov 4 12:10:18 2007 @@ -1808,7 +1808,10 @@ Dead Argument Hacking (BUGPOINT USE ONLY; DO NOT USE)

      -

      Yet to be written.

      +

      + Same as dead argument elimination, but deletes arguments to functions which + are external. This is only for use by bugpoint.

      @@ -1816,7 +1819,9 @@ Extract Basic Blocks From Module (for bugpoint use)
      -

      Yet to be written.

      +

      + This pass is used by bugpoint to extract all blocks from the module into their + own functions.

      @@ -1832,7 +1837,50 @@ Module Verifier
      -

      Yet to be written.

      +

      + Verifies an LLVM IR code. This is useful to run after an optimization which is + undergoing testing. Note that llvm-as verifies its input before + emitting bitcode, and also that malformed bitcode is likely to make LLVM + crash. All language front-ends are therefore encouraged to verify their output + before performing optimizing transformations. +

      + +

      +

    • Both of a binary operator's parameters are of the same type.
    • +
    • Verify that the indices of mem access instructions match other + operands.
    • +
    • Verify that arithmetic and other things are only performed on + first-class types. Verify that shifts and logicals only happen on + integrals f.e.
    • +
    • All of the constants in a switch statement are of the correct type.
    • +
    • The code is in valid SSA form.
    • +
    • It should be illegal to put a label into any other type (like a + structure) or to return one. [except constant arrays!]
    • +
    • Only phi nodes can be self referential: 'add int %0, %0 ; :0' is + bad.
    • +
    • PHI nodes must have an entry for each predecessor, with no extras.
    • +
    • PHI nodes must be the first thing in a basic block, all grouped + together.
    • +
    • PHI nodes must have at least one entry.
    • +
    • All basic blocks should only end with terminator insts, not contain + them.
    • +
    • The entry node to a function must not have predecessors.
    • +
    • All Instructions must be embedded into a basic block.
    • +
    • Functions cannot take a void-typed parameter.
    • +
    • Verify that a function's argument list agrees with its declared + type.
    • +
    • It is illegal to specify a name for a void value.
    • +
    • It is illegal to have a internal global value with no initializer.
    • +
    • It is illegal to have a ret instruction that returns a value that does + not agree with the function return value type.
    • +
    • Function call argument types match the function prototype.
    • +
    • All other things that are tested by asserts spread about the code.
    • +

      + +

      + Note that this does not provide full security verification (like Java), but + instead just tries to ensure that code is well-formed. +

      @@ -1840,7 +1888,9 @@ View CFG of function
      -

      Yet to be written.

      +

      + Displays the control flow graph using the GraphViz tool. +

      @@ -1848,7 +1898,10 @@ View CFG of function (with no function bodies)
      -

      Yet to be written.

      +

      + Displays the control flow graph using the GraphViz tool, but omitting function + bodies. +

      From gordonhenriksen at mac.com Sun Nov 4 12:14:09 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Sun, 04 Nov 2007 18:14:09 -0000 Subject: [llvm-commits] [llvm] r43678 - /llvm/trunk/docs/Passes.html Message-ID: <200711041814.lA4IE9nt028488@zion.cs.uiuc.edu> Author: gordon Date: Sun Nov 4 12:14:08 2007 New Revision: 43678 URL: http://llvm.org/viewvc/llvm-project?rev=43678&view=rev Log: Typo fix. Modified: llvm/trunk/docs/Passes.html Modified: llvm/trunk/docs/Passes.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/Passes.html?rev=43678&r1=43677&r2=43678&view=diff ============================================================================== --- llvm/trunk/docs/Passes.html (original) +++ llvm/trunk/docs/Passes.html Sun Nov 4 12:14:08 2007 @@ -1845,7 +1845,7 @@ before performing optimizing transformations.

      -

      +

      • Both of a binary operator's parameters are of the same type.
      • Verify that the indices of mem access instructions match other operands.
      • @@ -1875,7 +1875,7 @@ not agree with the function return value type.
      • Function call argument types match the function prototype.
      • All other things that are tested by asserts spread about the code.
      • -

        +

      Note that this does not provide full security verification (like Java), but From gordonhenriksen at mac.com Sun Nov 4 12:17:59 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Sun, 04 Nov 2007 18:17:59 -0000 Subject: [llvm-commits] [llvm] r43679 - /llvm/trunk/docs/Passes.html Message-ID: <200711041817.lA4IHxAq028669@zion.cs.uiuc.edu> Author: gordon Date: Sun Nov 4 12:17:58 2007 New Revision: 43679 URL: http://llvm.org/viewvc/llvm-project?rev=43679&view=rev Log: Validation fix. Modified: llvm/trunk/docs/Passes.html Modified: llvm/trunk/docs/Passes.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/Passes.html?rev=43679&r1=43678&r2=43679&view=diff ============================================================================== --- llvm/trunk/docs/Passes.html (original) +++ llvm/trunk/docs/Passes.html Sun Nov 4 12:17:58 2007 @@ -1856,8 +1856,8 @@

    • The code is in valid SSA form.
    • It should be illegal to put a label into any other type (like a structure) or to return one. [except constant arrays!]
    • -
    • Only phi nodes can be self referential: 'add int %0, %0 ; :0' is - bad.
    • +
    • Only phi nodes can be self referential: %x = add int %x, %x is + invalid.
    • PHI nodes must have an entry for each predecessor, with no extras.
    • PHI nodes must be the first thing in a basic block, all grouped together.
    • From sabre at nondot.org Sun Nov 4 13:23:29 2007 From: sabre at nondot.org (Chris Lattner) Date: Sun, 04 Nov 2007 19:23:29 -0000 Subject: [llvm-commits] [llvm] r43680 - in /llvm/trunk: lib/Target/X86/X86ATTAsmPrinter.cpp test/CodeGen/X86/2007-11-04-rip-immediate-constant.ll Message-ID: <200711041923.lA4JNTc5032129@zion.cs.uiuc.edu> Author: lattner Date: Sun Nov 4 13:23:28 2007 New Revision: 43680 URL: http://llvm.org/viewvc/llvm-project?rev=43680&view=rev Log: Fix PR1761 by not printing (rip) suffix when in -static mode. Evan, please review this. Added: llvm/trunk/test/CodeGen/X86/2007-11-04-rip-immediate-constant.ll Modified: llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp Modified: llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp?rev=43680&r1=43679&r2=43680&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp Sun Nov 4 13:23:28 2007 @@ -361,7 +361,8 @@ O << "@GOT"; else O << "@GOTOFF"; - } else if (Subtarget->isPICStyleRIPRel() && !NotRIPRel) { + } else if (Subtarget->isPICStyleRIPRel() && !NotRIPRel && + TM.getRelocationModel() != Reloc::Static) { if ((GV->isDeclaration() || GV->hasWeakLinkage() || GV->hasLinkOnceLinkage()) && Added: llvm/trunk/test/CodeGen/X86/2007-11-04-rip-immediate-constant.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2007-11-04-rip-immediate-constant.ll?rev=43680&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/2007-11-04-rip-immediate-constant.ll (added) +++ llvm/trunk/test/CodeGen/X86/2007-11-04-rip-immediate-constant.ll Sun Nov 4 13:23:28 2007 @@ -0,0 +1,11 @@ +; RUN: llvm-as < %s | llc -relocation-model=static | grep {foo _str$} +; PR1761 +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-darwin8" + at str = internal constant [12 x i8] c"init/main.c\00" ; <[12 x i8]*> [#uses=1] + +define i32 @unknown_bootoption() { +entry: + tail call void asm sideeffect "foo ${0:c}\0A", "i,~{dirflag},~{fpsr},~{flags}"( i8* getelementptr ([12 x i8]* @str, i32 0, i64 0) ) + ret i32 undef +} From clattner at apple.com Sun Nov 4 13:38:03 2007 From: clattner at apple.com (Chris Lattner) Date: Sun, 4 Nov 2007 11:38:03 -0800 Subject: [llvm-commits] [PATCH] -emitbitcode is a noop In-Reply-To: <562AEA71-3D81-4E53-BF84-5103B1BD9E22@mac.com> References: <562AEA71-3D81-4E53-BF84-5103B1BD9E22@mac.com> Message-ID: <16C3B66A-D21C-4B59-8353-72F0369562C3@apple.com> On Nov 4, 2007, at 8:59 AM, Gordon Henriksen wrote: > As registered, -emitbitcode is a noop pass. Better to just override > WriteBitcodePass::getPassName and not bother with creating a command- > line option. > > Any objections? Looks good to me. Does opt -std-compile-opts -debug-pass=Arguments still do something sensible? -Chris From nicholas at mxc.ca Sun Nov 4 13:41:29 2007 From: nicholas at mxc.ca (Nick Lewycky) Date: Sun, 04 Nov 2007 19:41:29 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r43681 - /llvm-gcc-4.0/trunk/gcc/config/rs6000/rs6000.c Message-ID: <200711041941.lA4JfTUV000469@zion.cs.uiuc.edu> Author: nicholas Date: Sun Nov 4 13:41:27 2007 New Revision: 43681 URL: http://llvm.org/viewvc/llvm-project?rev=43681&view=rev Log: lr_already_set_up_for_pic is only defined when TARGET_MACHO is defined. Modified: llvm-gcc-4.0/trunk/gcc/config/rs6000/rs6000.c Modified: llvm-gcc-4.0/trunk/gcc/config/rs6000/rs6000.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/config/rs6000/rs6000.c?rev=43681&r1=43680&r2=43681&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/config/rs6000/rs6000.c (original) +++ llvm-gcc-4.0/trunk/gcc/config/rs6000/rs6000.c Sun Nov 4 13:41:27 2007 @@ -16535,7 +16535,12 @@ If we're saving AltiVec regs via a function, we're not last. */ && (info->first_altivec_reg_save > LAST_ALTIVEC_REGNO || VECTOR_SAVE_INLINE (info->first_altivec_reg_save))) - gen_following_label = lr_already_set_up_for_pic = 1; + gen_following_label = +#if TARGET_MACHO + lr_already_set_up_for_pic = +#endif + 1; + /* APPLE LOCAL end reduce code size */ /* APPLE LOCAL begin +2 (could be conditionalized) */ From sabre at nondot.org Sun Nov 4 13:42:13 2007 From: sabre at nondot.org (Chris Lattner) Date: Sun, 04 Nov 2007 19:42:13 -0000 Subject: [llvm-commits] [llvm] r43682 - /llvm/trunk/docs/tutorial/LangImpl7.html Message-ID: <200711041942.lA4JgD9W000501@zion.cs.uiuc.edu> Author: lattner Date: Sun Nov 4 13:42:13 2007 New Revision: 43682 URL: http://llvm.org/viewvc/llvm-project?rev=43682&view=rev Log: fix typos Modified: llvm/trunk/docs/tutorial/LangImpl7.html Modified: llvm/trunk/docs/tutorial/LangImpl7.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/LangImpl7.html?rev=43682&r1=43681&r2=43682&view=diff ============================================================================== --- llvm/trunk/docs/tutorial/LangImpl7.html (original) +++ llvm/trunk/docs/tutorial/LangImpl7.html Sun Nov 4 13:42:13 2007 @@ -130,7 +130,7 @@ in SSA form, it does not require (or permit) memory objects to be in SSA form. In the example above, note that the loads from G and H are direct accesses to G and H: they are not renamed or versioned. This differs from some other -compiler systems, which does try to version memory objects. In LLVM, instead of +compiler systems, which do try to version memory objects. In LLVM, instead of encoding dataflow analysis of memory into the LLVM IR, it is handled with Analysis Passes which are computed on demand.

      @@ -267,7 +267,7 @@

      All of these properties are easy to satisfy for most imperative languages, and -we'll illustrated this below with Kaleidoscope. The final question you may be +we'll illustrate this below with Kaleidoscope. The final question you may be asking is: should I bother with this nonsense for my front-end? Wouldn't it be better if I just did SSA construction directly, avoiding use of the mem2reg optimization pass? In short, we strongly recommend that use you this technique From nicholas at mxc.ca Sun Nov 4 13:43:20 2007 From: nicholas at mxc.ca (Nick Lewycky) Date: Sun, 04 Nov 2007 14:43:20 -0500 Subject: [llvm-commits] llvm-gcc on PPC without TARGET_MACHO defined Message-ID: <472E20D8.8040603@mxc.ca> In llvm-gcc 4.0, "rs6000_output_mi_thunk" in gcc/config/rs6000/rs6000.c fails to compile unless TARGET_MACHO is defined. The problem is this block of code: /* This JMP is in a coalesced section, and Mach-O forbids us to directly reference anything else in a coalesced section; if our target gets coalesced away, the linker (static or dynamic) won't know where to send our JMP. Ergo, force a stub. */ label_decl = add_compiler_branch_island (function, line_number); which isn't protected by an "#if TARGET_MACHO". I've been working around the problem using the attached patch, which simply defines "branch_island_list" whether TARGET_MACHO is attached or not. Is this the correct fix? Nick -------------- next part -------------- A non-text attachment was scrubbed... Name: branch-island-list.patch Type: text/x-diff Size: 501 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20071104/06d5d2b1/attachment.bin From evan.cheng at apple.com Sun Nov 4 13:57:20 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Sun, 4 Nov 2007 11:57:20 -0800 Subject: [llvm-commits] [llvm] r43680 - in /llvm/trunk: lib/Target/X86/X86ATTAsmPrinter.cpp test/CodeGen/X86/2007-11-04-rip-immediate-constant.ll In-Reply-To: <200711041923.lA4JNTc5032129@zion.cs.uiuc.edu> References: <200711041923.lA4JNTc5032129@zion.cs.uiuc.edu> Message-ID: <76032B4E-C916-4692-BC45-97027DEFFE65@apple.com> It's correct. Thanks! Evan On Nov 4, 2007, at 11:23 AM, Chris Lattner wrote: > Author: lattner > Date: Sun Nov 4 13:23:28 2007 > New Revision: 43680 > > URL: http://llvm.org/viewvc/llvm-project?rev=43680&view=rev > Log: > Fix PR1761 by not printing (rip) suffix when in -static mode. > Evan, please review this. > > Added: > llvm/trunk/test/CodeGen/X86/2007-11-04-rip-immediate-constant.ll > Modified: > llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp > > Modified: llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/ > X86ATTAsmPrinter.cpp?rev=43680&r1=43679&r2=43680&view=diff > > ====================================================================== > ======== > --- llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp (original) > +++ llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp Sun Nov 4 > 13:23:28 2007 > @@ -361,7 +361,8 @@ > O << "@GOT"; > else > O << "@GOTOFF"; > - } else if (Subtarget->isPICStyleRIPRel() && !NotRIPRel) { > + } else if (Subtarget->isPICStyleRIPRel() && !NotRIPRel && > + TM.getRelocationModel() != Reloc::Static) { > if ((GV->isDeclaration() || > GV->hasWeakLinkage() || > GV->hasLinkOnceLinkage()) && > > Added: llvm/trunk/test/CodeGen/X86/2007-11-04-rip-immediate- > constant.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ > X86/2007-11-04-rip-immediate-constant.ll?rev=43680&view=auto > > ====================================================================== > ======== > --- llvm/trunk/test/CodeGen/X86/2007-11-04-rip-immediate- > constant.ll (added) > +++ llvm/trunk/test/CodeGen/X86/2007-11-04-rip-immediate- > constant.ll Sun Nov 4 13:23:28 2007 > @@ -0,0 +1,11 @@ > +; RUN: llvm-as < %s | llc -relocation-model=static | grep {foo _str$} > +; PR1761 > +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-darwin8" > + at str = internal constant [12 x i8] c"init/main.c\00" ; <[12 x i8] > *> [#uses=1] > + > +define i32 @unknown_bootoption() { > +entry: > + tail call void asm sideeffect "foo ${0:c}\0A", "i,~{dirflag},~ > {fpsr},~{flags}"( i8* getelementptr ([12 x i8]* @str, i32 0, i64 0) ) > + ret i32 undef > +} > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From gordonhenriksen at mac.com Sun Nov 4 14:28:31 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Sun, 04 Nov 2007 20:28:31 -0000 Subject: [llvm-commits] [llvm] r43683 - /llvm/trunk/lib/Bitcode/Writer/BitcodeWriterPass.cpp Message-ID: <200711042028.lA4KSVPh002627@zion.cs.uiuc.edu> Author: gordon Date: Sun Nov 4 14:28:31 2007 New Revision: 43683 URL: http://llvm.org/viewvc/llvm-project?rev=43683&view=rev Log: Deleting -emitbitcode option which did nothing. Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriterPass.cpp Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriterPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitcodeWriterPass.cpp?rev=43683&r1=43682&r2=43683&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Writer/BitcodeWriterPass.cpp (original) +++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriterPass.cpp Sun Nov 4 14:28:31 2007 @@ -17,22 +17,21 @@ namespace { class WriteBitcodePass : public ModulePass { - std::ostream *Out; // ostream to print on + std::ostream &Out; // ostream to print on public: static char ID; // Pass identifcation, replacement for typeid - WriteBitcodePass() : ModulePass((intptr_t) &ID), Out(0) { } - WriteBitcodePass(std::ostream &o) : ModulePass((intptr_t) &ID), Out(&o) {} + WriteBitcodePass(std::ostream &o) : ModulePass((intptr_t) &ID), Out(o) {} + + const char *getPassName() const { return "Bitcode Writer"; } bool runOnModule(Module &M) { - if (Out) - WriteBitcodeToFile(&M, *Out); + WriteBitcodeToFile(&M, Out); return false; } }; } char WriteBitcodePass::ID = 0; -static RegisterPass X("emitbitcode", "Bitcode Writer"); /// CreateBitcodeWriterPass - Create and return a pass that writes the module /// to the specified ostream. From gordonhenriksen at mac.com Sun Nov 4 14:28:48 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Sun, 4 Nov 2007 15:28:48 -0500 Subject: [llvm-commits] [PATCH] -emitbitcode is a noop In-Reply-To: <16C3B66A-D21C-4B59-8353-72F0369562C3@apple.com> References: <562AEA71-3D81-4E53-BF84-5103B1BD9E22@mac.com> <16C3B66A-D21C-4B59-8353-72F0369562C3@apple.com> Message-ID: <10A7FB15-41C0-4707-BB51-FA1B31267212@mac.com> On Nov 4, 2007, at 14:38, Chris Lattner wrote: > On Nov 4, 2007, at 8:59 AM, Gordon Henriksen wrote: > >> As registered, -emitbitcode is a noop pass. Better to just override >> WriteBitcodePass::getPassName and not bother with creating a >> command-line option. >> >> Any objections? > > Looks good to me. Applied. > Does opt -std-compile-opts -debug-pass=Arguments still do something > sensible? No change in behavior. ? Gordon From resistor at mac.com Sun Nov 4 16:33:27 2007 From: resistor at mac.com (Owen Anderson) Date: Sun, 04 Nov 2007 22:33:27 -0000 Subject: [llvm-commits] [llvm] r43684 - /llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Message-ID: <200711042233.lA4MXREU008615@zion.cs.uiuc.edu> Author: resistor Date: Sun Nov 4 16:33:26 2007 New Revision: 43684 URL: http://llvm.org/viewvc/llvm-project?rev=43684&view=rev Log: Another step of stronger PHI elimination down. Modified: llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Modified: llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp?rev=43684&r1=43683&r2=43684&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp (original) +++ llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Sun Nov 4 16:33:26 2007 @@ -21,6 +21,7 @@ #define DEBUG_TYPE "strongphielim" #include "llvm/CodeGen/Passes.h" +#include "llvm/CodeGen/LiveVariables.h" #include "llvm/CodeGen/MachineDominators.h" #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineInstr.h" @@ -44,6 +45,8 @@ } virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.addPreserved(); + AU.addPreservedID(PHIEliminationID); AU.addRequired(); MachineFunctionPass::getAnalysisUsage(AU); } @@ -54,10 +57,35 @@ } private: + struct DomForestNode { + private: + std::vector children; + MachineInstr* instr; + + void addChild(DomForestNode* DFN) { children.push_back(DFN); } + + public: + typedef std::vector::iterator iterator; + + DomForestNode(MachineInstr* MI, DomForestNode* parent) : instr(MI) { + if (parent) + parent->addChild(this); + } + + MachineInstr* getInstr() { return instr; } + + DomForestNode::iterator begin() { return children.begin(); } + DomForestNode::iterator end() { return children.end(); } + }; + DenseMap preorder; DenseMap maxpreorder; void computeDFS(MachineFunction& MF); + + std::vector + computeDomForest(SmallPtrSet& instrs); + }; char StrongPHIElimination::ID = 0; @@ -110,3 +138,63 @@ } } } + +class PreorderSorter { +private: + DenseMap& preorder; + +public: + PreorderSorter(DenseMap& p) : preorder(p) { } + + bool operator()(MachineInstr* A, MachineInstr* B) { + if (A == B) + return false; + + if (preorder[A->getParent()] < preorder[B->getParent()]) + return true; + else if (preorder[A->getParent()] > preorder[B->getParent()]) + return false; + + if (A->getOpcode() == TargetInstrInfo::PHI && + B->getOpcode() == TargetInstrInfo::PHI) + return A < B; + + MachineInstr* begin = A->getParent()->begin(); + return std::distance(begin, A) < std::distance(begin, B); + } +}; + +std::vector +StrongPHIElimination::computeDomForest(SmallPtrSet& instrs) { + DomForestNode* VirtualRoot = new DomForestNode(0, 0); + maxpreorder.insert(std::make_pair((MachineBasicBlock*)0, ~0UL)); + + std::vector worklist; + worklist.reserve(instrs.size()); + for (SmallPtrSet::iterator I = instrs.begin(), + E = instrs.end(); I != E; ++I) + worklist.push_back(*I); + PreorderSorter PS(preorder); + std::sort(worklist.begin(), worklist.end(), PS); + + DomForestNode* CurrentParent = VirtualRoot; + std::vector stack; + stack.push_back(VirtualRoot); + + for (std::vector::iterator I = worklist.begin(), + E = worklist.end(); I != E; ++I) { + while (preorder[(*I)->getParent()] > + maxpreorder[CurrentParent->getInstr()->getParent()]) { + stack.pop_back(); + CurrentParent = stack.back(); + } + + DomForestNode* child = new DomForestNode(*I, CurrentParent); + stack.push_back(child); + CurrentParent = child; + } + + std::vector ret; + ret.insert(ret.end(), VirtualRoot->begin(), VirtualRoot->end()); + return ret; +} From baldrick at free.fr Sun Nov 4 16:46:43 2007 From: baldrick at free.fr (Duncan Sands) Date: Sun, 04 Nov 2007 22:46:43 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r43686 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Message-ID: <200711042246.lA4MkidN009183@zion.cs.uiuc.edu> Author: baldrick Date: Sun Nov 4 16:46:42 2007 New Revision: 43686 URL: http://llvm.org/viewvc/llvm-project?rev=43686&view=rev Log: Remove last uses of getTypeSize. Since these are all bitfield accesses all types should be integers, and since we don't generate funky integer types yet, there's no need to worry about strange goings on with the size. Thus this simple conversion should do. Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=43686&r1=43685&r2=43686&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Sun Nov 4 16:46:42 2007 @@ -2568,7 +2568,7 @@ Value *OldVal = LI; // If the target is big-endian, invert the bit in the word. - unsigned ValSizeInBits = TD.getTypeSize(OldVal->getType())*8; + unsigned ValSizeInBits = TD.getTypeSizeInBits(OldVal->getType()); if (BITS_BIG_ENDIAN) LV.BitStart = ValSizeInBits-LV.BitStart-LV.BitSize; @@ -5026,7 +5026,7 @@ unsigned BitSize = (unsigned)TREE_INT_CST_LOW(TREE_OPERAND(exp, 1)); const Type *ValTy = ConvertType(TREE_TYPE(exp)); - unsigned ValueSizeInBits = 8*TD.getTypeSize(ValTy); + unsigned ValueSizeInBits = TD.getTypeSizeInBits(ValTy); assert(BitSize <= ValueSizeInBits && "ValTy isn't large enough to hold the value loaded!"); @@ -5660,7 +5660,7 @@ // function to insert (the STy element may be an array of bytes or // something). const Type *STyFieldTy = STy->getElementType(FieldNo); - unsigned STyFieldBitSize = getTargetData().getTypeSize(STyFieldTy)*8; + unsigned STyFieldBitSize = getTargetData().getTypeSizeInBits(STyFieldTy); // If the bitfield starts after this field, advance to the next field. This // can happen because we start looking at the first element overlapped by From baldrick at free.fr Sun Nov 4 16:48:54 2007 From: baldrick at free.fr (Duncan Sands) Date: Sun, 04 Nov 2007 22:48:54 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r43687 - /llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp Message-ID: <200711042248.lA4Mmsh2009282@zion.cs.uiuc.edu> Author: baldrick Date: Sun Nov 4 16:48:54 2007 New Revision: 43687 URL: http://llvm.org/viewvc/llvm-project?rev=43687&view=rev Log: Remove last uses of getTypeSize. Since these are all bitfield accesses all types should be integers, and since we don't generate funky integer types yet, there's no need to worry about strange goings on with the size. Thus this simple conversion should do. Modified: llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp Modified: llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp?rev=43687&r1=43686&r2=43687&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp Sun Nov 4 16:48:54 2007 @@ -3048,7 +3048,7 @@ Value *OldVal = LI; // If the target is big-endian, invert the bit in the word. - unsigned ValSizeInBits = TD.getTypeSize(OldVal->getType())*8; + unsigned ValSizeInBits = TD.getTypeSizeInBits(OldVal->getType()); if (BITS_BIG_ENDIAN) LV.BitStart = ValSizeInBits-LV.BitStart-LV.BitSize; @@ -5487,7 +5487,7 @@ unsigned BitSize = (unsigned)TREE_INT_CST_LOW(TREE_OPERAND(exp, 1)); const Type *ValTy = ConvertType(TREE_TYPE(exp)); - unsigned ValueSizeInBits = 8*TD.getTypeSize(ValTy); + unsigned ValueSizeInBits = TD.getTypeSizeInBits(ValTy); assert(BitSize <= ValueSizeInBits && "ValTy isn't large enough to hold the value loaded!"); @@ -6100,7 +6100,7 @@ // function to insert (the STy element may be an array of bytes or // something). const Type *STyFieldTy = STy->getElementType(FieldNo); - unsigned STyFieldBitSize = getTargetData().getTypeSize(STyFieldTy)*8; + unsigned STyFieldBitSize = getTargetData().getTypeSizeInBits(STyFieldTy); // If the bitfield starts after this field, advance to the next field. This // can happen because we start looking at the first element overlapped by From baldrick at free.fr Sun Nov 4 18:04:44 2007 From: baldrick at free.fr (Duncan Sands) Date: Mon, 05 Nov 2007 00:04:44 -0000 Subject: [llvm-commits] [llvm] r43688 - in /llvm/trunk: include/llvm/CodeGen/ include/llvm/Target/ lib/CodeGen/ lib/Target/ARM/ lib/Target/Alpha/ lib/Target/IA64/ lib/Target/MSIL/ lib/Target/Mips/ lib/Target/PowerPC/ lib/Target/Sparc/ lib/Target/X86/ Message-ID: <200711050004.lA504jq5013066@zion.cs.uiuc.edu> Author: baldrick Date: Sun Nov 4 18:04:43 2007 New Revision: 43688 URL: http://llvm.org/viewvc/llvm-project?rev=43688&view=rev Log: Eliminate the remaining uses of getTypeSize. This should only effect x86 when using long double. Now 12/16 bytes are output for long double globals (the exact amount depends on the alignment). This brings globals in line with the rest of LLVM: the space reserved for an object is now always the ABI size. One tricky point is that only 10 bytes should be output for long double if it is a field in a packed struct, which is the reason for the additional argument to EmitGlobalConstant. Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h llvm/trunk/include/llvm/Target/TargetData.h llvm/trunk/lib/CodeGen/AsmPrinter.cpp llvm/trunk/lib/CodeGen/ELFWriter.cpp llvm/trunk/lib/CodeGen/MachOWriter.cpp llvm/trunk/lib/CodeGen/MachOWriter.h llvm/trunk/lib/CodeGen/MachineFunction.cpp llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp llvm/trunk/lib/Target/Alpha/AlphaAsmPrinter.cpp llvm/trunk/lib/Target/IA64/IA64AsmPrinter.cpp llvm/trunk/lib/Target/MSIL/MSILWriter.cpp llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp llvm/trunk/lib/Target/Sparc/SparcAsmPrinter.cpp llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=43688&r1=43687&r2=43688&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original) +++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Sun Nov 4 18:04:43 2007 @@ -286,8 +286,8 @@ void EmitConstantValueOnly(const Constant *CV); /// EmitGlobalConstant - Print a general LLVM constant to the .s file. - /// - void EmitGlobalConstant(const Constant* CV); + /// If Packed is false, pad to the ABI size. + void EmitGlobalConstant(const Constant* CV, bool Packed = false); virtual void EmitMachineConstantPoolValue(MachineConstantPoolValue *MCPV); Modified: llvm/trunk/include/llvm/Target/TargetData.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetData.h?rev=43688&r1=43687&r2=43688&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetData.h (original) +++ llvm/trunk/include/llvm/Target/TargetData.h Sun Nov 4 18:04:43 2007 @@ -190,14 +190,6 @@ return 8*getABITypeSize(Ty); } - /// getTypeSize - Obsolete method, do not use. Replaced by getTypeStoreSize - /// and getABITypeSize. For alias analysis of loads and stores you probably - /// want getTypeStoreSize. Use getABITypeSize for GEP computations and alloca - /// sizing. - uint64_t getTypeSize(const Type *Ty) const { - return getTypeStoreSize(Ty); - } - /// getABITypeAlignment - Return the minimum ABI-required alignment for the /// specified type. unsigned char getABITypeAlignment(const Type *Ty) const; Modified: llvm/trunk/lib/CodeGen/AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter.cpp?rev=43688&r1=43687&r2=43688&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter.cpp Sun Nov 4 18:04:43 2007 @@ -192,13 +192,13 @@ MachineConstantPoolEntry CPE = CP[i]; const Type *Ty = CPE.getType(); if (TAI->getFourByteConstantSection() && - TM.getTargetData()->getTypeSize(Ty) == 4) + TM.getTargetData()->getABITypeSize(Ty) == 4) FourByteCPs.push_back(std::make_pair(CPE, i)); else if (TAI->getEightByteConstantSection() && - TM.getTargetData()->getTypeSize(Ty) == 8) + TM.getTargetData()->getABITypeSize(Ty) == 8) EightByteCPs.push_back(std::make_pair(CPE, i)); else if (TAI->getSixteenByteConstantSection() && - TM.getTargetData()->getTypeSize(Ty) == 16) + TM.getTargetData()->getABITypeSize(Ty) == 16) SixteenByteCPs.push_back(std::make_pair(CPE, i)); else OtherCPs.push_back(std::make_pair(CPE, i)); @@ -229,7 +229,7 @@ if (i != e-1) { const Type *Ty = CP[i].first.getType(); unsigned EntSize = - TM.getTargetData()->getTypeSize(Ty); + TM.getTargetData()->getABITypeSize(Ty); unsigned ValEnd = CP[i].first.getOffset() + EntSize; // Emit inter-object padding for alignment. EmitZeros(CP[i+1].first.getOffset()-ValEnd); @@ -750,7 +750,7 @@ // We can emit the pointer value into this slot if the slot is an // integer slot greater or equal to the size of the pointer. if (Ty->isInteger() && - TD->getTypeSize(Ty) >= TD->getTypeSize(Op->getType())) + TD->getABITypeSize(Ty) >= TD->getABITypeSize(Op->getType())) return EmitConstantValueOnly(Op); assert(0 && "FIXME: Don't yet support this kind of constant cast expr"); @@ -805,23 +805,21 @@ } /// EmitGlobalConstant - Print a general LLVM constant to the .s file. -/// -void AsmPrinter::EmitGlobalConstant(const Constant *CV) { +/// If Packed is false, pad to the ABI size. +void AsmPrinter::EmitGlobalConstant(const Constant *CV, bool Packed) { const TargetData *TD = TM.getTargetData(); + unsigned Size = Packed ? + TD->getTypeStoreSize(CV->getType()) : TD->getABITypeSize(CV->getType()); if (CV->isNullValue() || isa(CV)) { - EmitZeros(TD->getTypeSize(CV->getType())); + EmitZeros(Size); return; } else if (const ConstantArray *CVA = dyn_cast(CV)) { if (CVA->isString()) { EmitString(CVA); } else { // Not a string. Print the values in successive locations - for (unsigned i = 0, e = CVA->getNumOperands(); i != e; ++i) { - EmitGlobalConstant(CVA->getOperand(i)); - const Type* EltTy = CVA->getType()->getElementType(); - uint64_t padSize = TD->getABITypeSize(EltTy) - TD->getTypeSize(EltTy); - EmitZeros(padSize); - } + for (unsigned i = 0, e = CVA->getNumOperands(); i != e; ++i) + EmitGlobalConstant(CVA->getOperand(i), false); } return; } else if (const ConstantStruct *CVS = dyn_cast(CV)) { @@ -832,14 +830,14 @@ const Constant* field = CVS->getOperand(i); // Check if padding is needed and insert one or more 0s. - uint64_t fieldSize = TD->getTypeSize(field->getType()); + uint64_t fieldSize = TD->getTypeStoreSize(field->getType()); uint64_t padSize = ((i == e-1? cvsLayout->getSizeInBytes() : cvsLayout->getElementOffset(i+1)) - cvsLayout->getElementOffset(i)) - fieldSize; sizeSoFar += fieldSize + padSize; // Now print the actual field value - EmitGlobalConstant(field); + EmitGlobalConstant(field, CVS->getType()->isPacked()); // Insert the field padding unless it's zero bytes... EmitZeros(padSize); @@ -916,6 +914,7 @@ << "\t" << TAI->getCommentString() << " long double most significant halfword\n"; } + EmitZeros(Size - TD->getTypeStoreSize(Type::X86_FP80Ty)); return; } else if (CFP->getType() == Type::PPC_FP128Ty) { // all long double variants are printed as hex @@ -978,7 +977,7 @@ const VectorType *PTy = CP->getType(); for (unsigned I = 0, E = PTy->getNumElements(); I < E; ++I) - EmitGlobalConstant(CP->getOperand(I)); + EmitGlobalConstant(CP->getOperand(I), false); return; } Modified: llvm/trunk/lib/CodeGen/ELFWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ELFWriter.cpp?rev=43688&r1=43687&r2=43688&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/ELFWriter.cpp (original) +++ llvm/trunk/lib/CodeGen/ELFWriter.cpp Sun Nov 4 18:04:43 2007 @@ -258,7 +258,7 @@ const Type *GVType = (const Type*)GV->getType(); unsigned Align = TM.getTargetData()->getPrefTypeAlignment(GVType); - unsigned Size = TM.getTargetData()->getTypeSize(GVType); + unsigned Size = TM.getTargetData()->getABITypeSize(GVType); // If this global has a zero initializer, it is part of the .bss or common // section. Modified: llvm/trunk/lib/CodeGen/MachOWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachOWriter.cpp?rev=43688&r1=43687&r2=43688&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachOWriter.cpp (original) +++ llvm/trunk/lib/CodeGen/MachOWriter.cpp Sun Nov 4 18:04:43 2007 @@ -259,7 +259,7 @@ // "giant object for PIC" optimization. for (unsigned i = 0, e = CP.size(); i != e; ++i) { const Type *Ty = CP[i].getType(); - unsigned Size = TM.getTargetData()->getTypeSize(Ty); + unsigned Size = TM.getTargetData()->getABITypeSize(Ty); MachOWriter::MachOSection *Sec = MOW.getConstSection(CP[i].Val.ConstVal); OutputBuffer SecDataOut(Sec->SectionData, is64Bit, isLittleEndian); @@ -333,7 +333,7 @@ void MachOWriter::AddSymbolToSection(MachOSection *Sec, GlobalVariable *GV) { const Type *Ty = GV->getType()->getElementType(); - unsigned Size = TM.getTargetData()->getTypeSize(Ty); + unsigned Size = TM.getTargetData()->getABITypeSize(Ty); unsigned Align = GV->getAlignment(); if (Align == 0) Align = TM.getTargetData()->getPrefTypeAlignment(Ty); @@ -380,7 +380,7 @@ void MachOWriter::EmitGlobal(GlobalVariable *GV) { const Type *Ty = GV->getType()->getElementType(); - unsigned Size = TM.getTargetData()->getTypeSize(Ty); + unsigned Size = TM.getTargetData()->getABITypeSize(Ty); bool NoInit = !GV->hasInitializer(); // If this global has a zero initializer, it is part of the .bss or common @@ -803,7 +803,8 @@ if (isa(PC)) { continue; } else if (const ConstantVector *CP = dyn_cast(PC)) { - unsigned ElementSize = TD->getTypeSize(CP->getType()->getElementType()); + unsigned ElementSize = + TD->getABITypeSize(CP->getType()->getElementType()); for (unsigned i = 0, e = CP->getNumOperands(); i != e; ++i) WorkList.push_back(CPair(CP->getOperand(i), PA+i*ElementSize)); } else if (const ConstantExpr *CE = dyn_cast(PC)) { @@ -904,9 +905,10 @@ abort(); } } else if (isa(PC)) { - memset((void*)PA, 0, (size_t)TD->getTypeSize(PC->getType())); + memset((void*)PA, 0, (size_t)TD->getABITypeSize(PC->getType())); } else if (const ConstantArray *CPA = dyn_cast(PC)) { - unsigned ElementSize = TD->getTypeSize(CPA->getType()->getElementType()); + unsigned ElementSize = + TD->getABITypeSize(CPA->getType()->getElementType()); for (unsigned i = 0, e = CPA->getNumOperands(); i != e; ++i) WorkList.push_back(CPair(CPA->getOperand(i), PA+i*ElementSize)); } else if (const ConstantStruct *CPS = dyn_cast(PC)) { Modified: llvm/trunk/lib/CodeGen/MachOWriter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachOWriter.h?rev=43688&r1=43687&r2=43688&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachOWriter.h (original) +++ llvm/trunk/lib/CodeGen/MachOWriter.h Sun Nov 4 18:04:43 2007 @@ -466,7 +466,7 @@ const Type *Ty = C->getType(); if (Ty->isPrimitiveType() || Ty->isInteger()) { - unsigned Size = TM.getTargetData()->getTypeSize(Ty); + unsigned Size = TM.getTargetData()->getABITypeSize(Ty); switch(Size) { default: break; // Fall through to __TEXT,__const case 4: Modified: llvm/trunk/lib/CodeGen/MachineFunction.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineFunction.cpp?rev=43688&r1=43687&r2=43688&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineFunction.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineFunction.cpp Sun Nov 4 18:04:43 2007 @@ -435,7 +435,7 @@ unsigned Offset = 0; if (!Constants.empty()) { Offset = Constants.back().getOffset(); - Offset += TD->getTypeSize(Constants.back().getType()); + Offset += TD->getABITypeSize(Constants.back().getType()); Offset = (Offset+AlignMask)&~AlignMask; } @@ -459,7 +459,7 @@ unsigned Offset = 0; if (!Constants.empty()) { Offset = Constants.back().getOffset(); - Offset += TD->getTypeSize(Constants.back().getType()); + Offset += TD->getABITypeSize(Constants.back().getType()); Offset = (Offset+AlignMask)&~AlignMask; } Modified: llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp?rev=43688&r1=43687&r2=43688&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp Sun Nov 4 18:04:43 2007 @@ -821,7 +821,7 @@ std::string name = Mang->getValueName(I); Constant *C = I->getInitializer(); const Type *Type = C->getType(); - unsigned Size = TD->getTypeSize(Type); + unsigned Size = TD->getABITypeSize(Type); unsigned Align = TD->getPreferredAlignmentLog(I); const char *VisibilityDirective = NULL; Modified: llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp?rev=43688&r1=43687&r2=43688&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp Sun Nov 4 18:04:43 2007 @@ -298,7 +298,7 @@ const TargetData &TD = *Fn.getTarget().getTargetData(); for (unsigned i = 0, e = CPs.size(); i != e; ++i) { - unsigned Size = TD.getTypeSize(CPs[i].getType()); + unsigned Size = TD.getABITypeSize(CPs[i].getType()); // Verify that all constant pool entries are a multiple of 4 bytes. If not, // we would have to pad them out or something so that instructions stay // aligned. Modified: llvm/trunk/lib/Target/Alpha/AlphaAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaAsmPrinter.cpp?rev=43688&r1=43687&r2=43688&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AlphaAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/Alpha/AlphaAsmPrinter.cpp Sun Nov 4 18:04:43 2007 @@ -214,7 +214,7 @@ std::string name = Mang->getValueName(I); Constant *C = I->getInitializer(); - unsigned Size = TD->getTypeSize(C->getType()); + unsigned Size = TD->getABITypeSize(C->getType()); unsigned Align = TD->getPreferredAlignmentLog(I); //1: hidden? Modified: llvm/trunk/lib/Target/IA64/IA64AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64AsmPrinter.cpp?rev=43688&r1=43687&r2=43688&view=diff ============================================================================== --- llvm/trunk/lib/Target/IA64/IA64AsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/IA64/IA64AsmPrinter.cpp Sun Nov 4 18:04:43 2007 @@ -271,7 +271,7 @@ O << "\n\n"; std::string name = Mang->getValueName(I); Constant *C = I->getInitializer(); - unsigned Size = TD->getTypeSize(C->getType()); + unsigned Size = TD->getABITypeSize(C->getType()); unsigned Align = TD->getPreferredTypeAlignmentShift(C->getType()); if (C->isNullValue() && @@ -279,11 +279,11 @@ I->hasWeakLinkage() /* FIXME: Verify correct */)) { SwitchToDataSection(".data", I); if (I->hasInternalLinkage()) { - O << "\t.lcomm " << name << "#," << TD->getTypeSize(C->getType()) + O << "\t.lcomm " << name << "#," << TD->getABITypeSize(C->getType()) << "," << (1 << Align); O << "\n"; } else { - O << "\t.common " << name << "#," << TD->getTypeSize(C->getType()) + O << "\t.common " << name << "#," << TD->getABITypeSize(C->getType()) << "," << (1 << Align); O << "\n"; } Modified: llvm/trunk/lib/Target/MSIL/MSILWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSIL/MSILWriter.cpp?rev=43688&r1=43687&r2=43688&view=diff ============================================================================== --- llvm/trunk/lib/Target/MSIL/MSILWriter.cpp (original) +++ llvm/trunk/lib/Target/MSIL/MSILWriter.cpp Sun Nov 4 18:04:43 2007 @@ -368,7 +368,7 @@ case Type::DoubleTyID: return "r8"; case Type::PointerTyID: - return "i"+utostr(TD->getTypeSize(Ty)); + return "i"+utostr(TD->getABITypeSize(Ty)); default: cerr << "TypeID = " << Ty->getTypeID() << '\n'; assert(0 && "Invalid type in TypeToPostfix()"); @@ -677,14 +677,14 @@ uint64_t FieldIndex = cast(IndexValue)->getZExtValue(); // Offset is the sum of all previous structure fields. for (uint64_t F = 0; FgetTypeSize(StrucTy->getContainedType((unsigned)F)); + Size += TD->getABITypeSize(StrucTy->getContainedType((unsigned)F)); printPtrLoad(Size); printSimpleInstruction("add"); continue; } else if (const SequentialType* SeqTy = dyn_cast(*I)) { - Size = TD->getTypeSize(SeqTy->getElementType()); + Size = TD->getABITypeSize(SeqTy->getElementType()); } else { - Size = TD->getTypeSize(*I); + Size = TD->getABITypeSize(*I); } // Add offset of current element to stack top. if (!isZeroValue(IndexValue)) { @@ -1008,7 +1008,7 @@ void MSILWriter::printAllocaInstruction(const AllocaInst* Inst) { - uint64_t Size = TD->getTypeSize(Inst->getAllocatedType()); + uint64_t Size = TD->getABITypeSize(Inst->getAllocatedType()); // Constant optimization. if (const ConstantInt* CInt = dyn_cast(Inst->getOperand(0))) { printPtrLoad(CInt->getZExtValue()*Size); @@ -1426,7 +1426,7 @@ // Print not duplicated type if (Printed.insert(Ty).second) { Out << ".class value explicit ansi sealed '" << Name << "'"; - Out << " { .pack " << 1 << " .size " << TD->getTypeSize(Ty) << " }\n\n"; + Out << " { .pack " << 1 << " .size " << TD->getABITypeSize(Ty)<< " }\n\n"; } } } @@ -1454,7 +1454,7 @@ const Type* Ty = C->getType(); // Print zero initialized constant. if (isa(C) || C->isNullValue()) { - TySize = TD->getTypeSize(C->getType()); + TySize = TD->getABITypeSize(C->getType()); Offset += TySize; Out << "int8 (0) [" << TySize << "]"; return; @@ -1462,14 +1462,14 @@ // Print constant initializer switch (Ty->getTypeID()) { case Type::IntegerTyID: { - TySize = TD->getTypeSize(Ty); + TySize = TD->getABITypeSize(Ty); const ConstantInt* Int = cast(C); Out << getPrimitiveTypeName(Ty,true) << "(" << Int->getSExtValue() << ")"; break; } case Type::FloatTyID: case Type::DoubleTyID: { - TySize = TD->getTypeSize(Ty); + TySize = TD->getABITypeSize(Ty); const ConstantFP* FP = cast(C); if (Ty->getTypeID() == Type::FloatTyID) Out << "int32 (" << @@ -1488,7 +1488,7 @@ } break; case Type::PointerTyID: - TySize = TD->getTypeSize(C->getType()); + TySize = TD->getABITypeSize(C->getType()); // Initialize with global variable address if (const GlobalVariable *G = dyn_cast(C)) { std::string name = getValueName(G); Modified: llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp?rev=43688&r1=43687&r2=43688&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp Sun Nov 4 18:04:43 2007 @@ -419,7 +419,7 @@ O << "\n\n"; std::string name = Mang->getValueName(I); Constant *C = I->getInitializer(); - unsigned Size = TD->getTypeSize(C->getType()); + unsigned Size = TD->getABITypeSize(C->getType()); unsigned Align = TD->getPrefTypeAlignment(C->getType()); if (C->isNullValue() && (I->hasLinkOnceLinkage() || @@ -431,7 +431,7 @@ O << "\t.local " << name << "\n"; O << "\t.comm " << name << "," - << TD->getTypeSize(C->getType()) + << TD->getABITypeSize(C->getType()) << "," << Align << "\n"; } else { Modified: llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp?rev=43688&r1=43687&r2=43688&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp Sun Nov 4 18:04:43 2007 @@ -657,7 +657,7 @@ O << Directive << name << "\n"; Constant *C = I->getInitializer(); - unsigned Size = TD->getTypeSize(C->getType()); + unsigned Size = TD->getABITypeSize(C->getType()); unsigned Align = TD->getPreferredAlignmentLog(I); if (C->isNullValue() && /* FIXME: Verify correct */ @@ -909,7 +909,7 @@ Constant *C = I->getInitializer(); const Type *Type = C->getType(); - unsigned Size = TD->getTypeSize(Type); + unsigned Size = TD->getABITypeSize(Type); unsigned Align = TD->getPreferredAlignmentLog(I); if (C->isNullValue() && /* FIXME: Verify correct */ Modified: llvm/trunk/lib/Target/Sparc/SparcAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcAsmPrinter.cpp?rev=43688&r1=43687&r2=43688&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/Sparc/SparcAsmPrinter.cpp Sun Nov 4 18:04:43 2007 @@ -228,7 +228,7 @@ O << "\n\n"; std::string name = Mang->getValueName(I); Constant *C = I->getInitializer(); - unsigned Size = TD->getTypeSize(C->getType()); + unsigned Size = TD->getABITypeSize(C->getType()); unsigned Align = TD->getPrefTypeAlignment(C->getType()); if (C->isNullValue() && @@ -238,7 +238,7 @@ if (I->hasInternalLinkage()) O << "\t.local " << name << "\n"; - O << "\t.comm " << name << "," << TD->getTypeSize(C->getType()) + O << "\t.comm " << name << "," << TD->getABITypeSize(C->getType()) << "," << Align; O << "\n"; } else { Modified: llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp?rev=43688&r1=43687&r2=43688&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp Sun Nov 4 18:04:43 2007 @@ -51,7 +51,7 @@ for (Function::const_arg_iterator AI = F->arg_begin(), AE = F->arg_end(); AI != AE; ++AI) // Size should be aligned to DWORD boundary - Size += ((TD->getTypeSize(AI->getType()) + 3)/4)*4; + Size += ((TD->getABITypeSize(AI->getType()) + 3)/4)*4; // We're not supporting tooooo huge arguments :) Info.setBytesToPopOnReturn((unsigned int)Size); @@ -156,7 +156,7 @@ std::string name = Mang->getValueName(I); Constant *C = I->getInitializer(); const Type *Type = C->getType(); - unsigned Size = TD->getTypeSize(Type); + unsigned Size = TD->getABITypeSize(Type); unsigned Align = TD->getPreferredAlignmentLog(I); if (I->hasHiddenVisibility()) { From sabre at nondot.org Sun Nov 4 18:23:57 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 05 Nov 2007 00:23:57 -0000 Subject: [llvm-commits] [llvm] r43689 - /llvm/trunk/docs/tutorial/LangImpl7.html Message-ID: <200711050023.lA50Nv6b013886@zion.cs.uiuc.edu> Author: lattner Date: Sun Nov 4 18:23:57 2007 New Revision: 43689 URL: http://llvm.org/viewvc/llvm-project?rev=43689&view=rev Log: finish the chapter. Modified: llvm/trunk/docs/tutorial/LangImpl7.html Modified: llvm/trunk/docs/tutorial/LangImpl7.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/LangImpl7.html?rev=43689&r1=43688&r2=43689&view=diff ============================================================================== --- llvm/trunk/docs/tutorial/LangImpl7.html (original) +++ llvm/trunk/docs/tutorial/LangImpl7.html Sun Nov 4 18:23:57 2007 @@ -296,8 +296,664 @@ running, and is very simple to implement. Lets extend Kaleidoscope with mutable variables now!

      + + + + + + + +
      + +

      Now that we know the sort of problem we want to tackle, lets see what this +looks like in the context of our little Kaleidoscope language. We're going to +add two features:

      + +
        +
      1. The ability to mutate variables with the '=' operator.
      2. +
      3. The ability to define new variables.
      4. +
      + +

      While the first item is really what this is about, we only have variables +for incoming arguments and for induction variables, and redefining them only +goes so far :). Also, the ability to define new variables is a +useful thing regardless of whether you will be mutating them. Here's a +motivating example that shows how we could use these:

      + +
      +
      +# Define ':' for sequencing: as a low-precedence operator that ignores operands
      +# and just returns the RHS.
      +def binary : 1 (x y) y;
      +
      +# Recursive fib, we could do this before.
      +def fib(x)
      +  if (x < 3) then
      +    1
      +  else
      +    fib(x-1)+fib(x-2);
      +
      +# Iterative fib.
      +def fibi(x)
      +  var a = 1, b = 1, c in
      +  (for i = 3, i &;t; x in 
      +     c = a + b :
      +     a = b :
      +     b = c) :
      +  b;
      +
      +# Call it. 
      +fibi(10);
      +
      +
      + +

      +In order to mutate variables, we have to change our existing variables to use +the "alloca trick". Once we have that, we'll add our new operator, then extend +Kaleidoscope to support new variable definitions. +

      + +
      + + + + + +
      + +

      +The symbol table in Kaleidoscope is managed at code generation time by the +'NamedValues' map. This map currently keeps track of the LLVM "Value*" +that holds the double value for the named variable. In order to support +mutation, we need to change this slightly, so that it NamedValues holds +the memory location of the variable in question. Note that this +change is a refactoring: it changes the structure of the code, but does not +(by itself) change the behavior of the compiler. All of these changes are +isolated in the Kaleidoscope code generator.

      + +

      +At this point in Kaleidoscope's development, it only supports variables for two +things: incoming arguments to functions and the induction variable of 'for' +loops. For consistency, we'll allow mutation of these variables in addition to +other user-defined variables. This means that these will both need memory +locations. +

      + +

      To start our transformation of Kaleidoscope, we'll change the NamedValues +map to map to AllocaInst* instead of Value*. Once we do this, the C++ compiler +will tell use what parts of the code we need to update:

      + +
      +
      +static std::map<std::string, AllocaInst*> NamedValues;
      +
      +
      + +

      Also, since we will need to create these alloca's, we'll use a helper +function that ensures that the allocas are created in the entry block of the +function:

      + +
      +
      +/// CreateEntryBlockAlloca - Create an alloca instruction in the entry block of
      +/// the function.  This is used for mutable variables etc.
      +static AllocaInst *CreateEntryBlockAlloca(Function *TheFunction,
      +                                          const std::string &VarName) {
      +  LLVMBuilder TmpB(&TheFunction->getEntryBlock(),
      +                   TheFunction->getEntryBlock().begin());
      +  return TmpB.CreateAlloca(Type::DoubleTy, 0, VarName.c_str());
      +}
      +
      +
      + +

      This funny looking code creates an LLVMBuilder object that is pointing at +the first instruction (.begin()) of the entry block. It then creates an alloca +with the expected name and returns it. Because all values in Kaleidoscope are +doubles, there is no need to pass in a type to use.

      + +

      With this in place, the first functionality change we want to make is to +variable references. In our new scheme, variables live on the stack, so code +generating a reference to them actually needs to produce a load from the stack +slot:

      + +
      +
      +Value *VariableExprAST::Codegen() {
      +  // Look this variable up in the function.
      +  Value *V = NamedValues[Name];
      +  if (V == 0) return ErrorV("Unknown variable name");
      +
      +  // Load the value.
      +  return Builder.CreateLoad(V, Name.c_str());
      +}
      +
      +
      + +

      As you can see, this is pretty straight-forward. Next we need to update the +things that define the variables to set up the alloca. We'll start with +ForExprAST::Codegen (see the full code listing for +the unabridged code):

      + +
      +
      +  Function *TheFunction = Builder.GetInsertBlock()->getParent();
      +
      +  // Create an alloca for the variable in the entry block.
      +  AllocaInst *Alloca = CreateEntryBlockAlloca(TheFunction, VarName);
      +  
      +    // Emit the start code first, without 'variable' in scope.
      +  Value *StartVal = Start->Codegen();
      +  if (StartVal == 0) return 0;
      +  
      +  // Store the value into the alloca.
      +  Builder.CreateStore(StartVal, Alloca);
      +  ...
      +
      +  // Compute the end condition.
      +  Value *EndCond = End->Codegen();
      +  if (EndCond == 0) return EndCond;
      +  
      +  // Reload, increment, and restore the alloca.  This handles the case where
      +  // the body of the loop mutates the variable.
      +  Value *CurVar = Builder.CreateLoad(Alloca);
      +  Value *NextVar = Builder.CreateAdd(CurVar, StepVal, "nextvar");
      +  Builder.CreateStore(NextVar, Alloca);
      +  ...
      +
      +
      + +

      This code is virtually identical to the code before we allowed mutable variables. The +big difference is that we no longer have to construct a PHI node, and we use +load/store to access the variable as needed.

      + +

      To support mutable argument variables, we need to also make allocas for them. +The code for this is also pretty simple:

      + +
      +
      +/// CreateArgumentAllocas - Create an alloca for each argument and register the
      +/// argument in the symbol table so that references to it will succeed.
      +void PrototypeAST::CreateArgumentAllocas(Function *F) {
      +  Function::arg_iterator AI = F->arg_begin();
      +  for (unsigned Idx = 0, e = Args.size(); Idx != e; ++Idx, ++AI) {
      +    // Create an alloca for this variable.
      +    AllocaInst *Alloca = CreateEntryBlockAlloca(F, Args[Idx]);
      +
      +    // Store the initial value into the alloca.
      +    Builder.CreateStore(AI, Alloca);
      +
      +    // Add arguments to variable symbol table.
      +    NamedValues[Args[Idx]] = Alloca;
      +  }
      +}
      +
      +
      + +

      For each argument, we make an alloca, store the input value to the function +into the alloca, and register the alloca as the memory location for the +argument. This method gets invoked by FunctionAST::Codegen right after +it sets up the entry block for the function.

      + +

      The final missing piece is adding the 'mem2reg' pass, which allows us to get +good codegen once again:

      + +
      +
      +    // Set up the optimizer pipeline.  Start with registering info about how the
      +    // target lays out data structures.
      +    OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData()));
      +    // Promote allocas to registers.
      +    OurFPM.add(createPromoteMemoryToRegisterPass());
      +    // Do simple "peephole" optimizations and bit-twiddling optzns.
      +    OurFPM.add(createInstructionCombiningPass());
      +    // Reassociate expressions.
      +    OurFPM.add(createReassociatePass());
      +
      +
      + +

      It is interesting to see what the code looks like before and after the +mem2reg optimization runs. For example, this is the before/after code for our +recursive fib. Before the optimization:

      + +
      +
      +define double @fib(double %x) {
      +entry:
      +	%x1 = alloca double
      +	store double %x, double* %x1
      +	%x2 = load double* %x1
      +	%multmp = fcmp ult double %x2, 3.000000e+00
      +	%booltmp = uitofp i1 %multmp to double
      +	%ifcond = fcmp one double %booltmp, 0.000000e+00
      +	br i1 %ifcond, label %then, label %else
      +
      +then:		; preds = %entry
      +	br label %ifcont
      +
      +else:		; preds = %entry
      +	%x3 = load double* %x1
      +	%subtmp = sub double %x3, 1.000000e+00
      +	%calltmp = call double @fib( double %subtmp )
      +	%x4 = load double* %x1
      +	%subtmp5 = sub double %x4, 2.000000e+00
      +	%calltmp6 = call double @fib( double %subtmp5 )
      +	%addtmp = add double %calltmp, %calltmp6
      +	br label %ifcont
      +
      +ifcont:		; preds = %else, %then
      +	%iftmp = phi double [ 1.000000e+00, %then ], [ %addtmp, %else ]
      +	ret double %iftmp
      +}
      +
      +
      + +

      Here there is only one variable (x, the input argument) but you can still +see the extremely simple-minded code generation strategy we are using. In the +entry block, an alloca is created, and the initial input value is stored into +it. Each reference to the variable does a reload from the stack. Also, note +that we didn't modify the if/then/else expression, so it still inserts a PHI +node. While we could make an alloca for it, it is actually easier to create a +PHI node for it, so we still just make the PHI.

      + +

      Here is the code after the mem2reg pass runs:

      + +
      +
      +define double @fib(double %x) {
      +entry:
      +	%multmp = fcmp ult double %x, 3.000000e+00
      +	%booltmp = uitofp i1 %multmp to double
      +	%ifcond = fcmp one double %booltmp, 0.000000e+00
      +	br i1 %ifcond, label %then, label %else
      +
      +then:
      +	br label %ifcont
      +
      +else:
      +	%subtmp = sub double %x, 1.000000e+00
      +	%calltmp = call double @fib( double %subtmp )
      +	%subtmp5 = sub double %x, 2.000000e+00
      +	%calltmp6 = call double @fib( double %subtmp5 )
      +	%addtmp = add double %calltmp, %calltmp6
      +	br label %ifcont
      +
      +ifcont:		; preds = %else, %then
      +	%iftmp = phi double [ 1.000000e+00, %then ], [ %addtmp, %else ]
      +	ret double %iftmp
      +}
      +
      +
      + +

      This is a trivial case for mem2reg, since there are no redefinitions of the +variable. The point of showing this is to calm your tension about inserting +such blatent inefficiencies :).

      + +

      After the rest of the optimizers run, we get:

      + +
      +
      +define double @fib(double %x) {
      +entry:
      +	%multmp = fcmp ult double %x, 3.000000e+00
      +	%booltmp = uitofp i1 %multmp to double
      +	%ifcond = fcmp ueq double %booltmp, 0.000000e+00
      +	br i1 %ifcond, label %else, label %ifcont
      +
      +else:
      +	%subtmp = sub double %x, 1.000000e+00
      +	%calltmp = call double @fib( double %subtmp )
      +	%subtmp5 = sub double %x, 2.000000e+00
      +	%calltmp6 = call double @fib( double %subtmp5 )
      +	%addtmp = add double %calltmp, %calltmp6
      +	ret double %addtmp
      +
      +ifcont:
      +	ret double 1.000000e+00
      +}
      +
      +
      + +

      Here we see that the simplifycfg pass decided to clone the return instruction +into the end of the 'else' block. This allowed it to eliminate some branches +and the PHI node.

      + +

      Now that all symbol table references are updated to use stack variables, +we'll add the assignment operator.

      + +
      + + + + + +
      + +

      With our current framework, adding a new assignment operator is really +simple. We will parse it just like any other binary operator, but handle it +internally (instead of allowing the user to define it). The first step is to +set a precedence:

      + +
      +
      + int main() {
      +   // Install standard binary operators.
      +   // 1 is lowest precedence.
      +   BinopPrecedence['='] = 2;
      +   BinopPrecedence['<'] = 10;
      +   BinopPrecedence['+'] = 20;
      +   BinopPrecedence['-'] = 20;
      +
      +
      + +

      Now that the parser knows the precedence of the binary operator, it takes +care of all the parsing and AST generation. We just need to implement codegen +for the assignment operator. This looks like:

      + +
      +
      +Value *BinaryExprAST::Codegen() {
      +  // Special case '=' because we don't want to emit the LHS as an expression.
      +  if (Op == '=') {
      +    // Assignment requires the LHS to be an identifier.
      +    VariableExprAST *LHSE = dynamic_cast<VariableExprAST*>(LHS);
      +    if (!LHSE)
      +      return ErrorV("destination of '=' must be a variable");
      +
      +
      + +

      Unlike the rest of the binary operators, our assignment operator doesn't +follow the "emit LHS, emit RHS, do computation" model. As such, it is handled +as a special case before the other binary operators are handled. The other +strange thing about it is that it requires the LHS to be a variable directly. +

      + +
      +
      +    // Codegen the RHS.
      +    Value *Val = RHS->Codegen();
      +    if (Val == 0) return 0;
      +
      +    // Look up the name.
      +    Value *Variable = NamedValues[LHSE->getName()];
      +    if (Variable == 0) return ErrorV("Unknown variable name");
      +
      +    Builder.CreateStore(Val, Variable);
      +    return Val;
      +  }
      +  ...  
      +
      +
      + +

      Once it has the variable, codegen'ing the assignment is straight-forward: +we emit the RHS of the assignment, create a store, and return the computed +value. Returning a value allows for chained assignments like "X = (Y = Z)".

      + +

      Now that we have an assignment operator, we can mutate loop variables and +arguments. For example, we can now run code like this:

      + +
      +
      +# Function to print a double.
      +extern printd(x);
      +
      +# Define ':' for sequencing: as a low-precedence operator that ignores operands
      +# and just returns the RHS.
      +def binary : 1 (x y) y;
      +
      +def test(x)
      +  printd(x) :
      +  x = 4 :
      +  printd(x);
      +
      +test(123);
      +
      +
      + +

      When run, this example prints "123" and then "4", showing that we did +actually mutate the value! Okay, we have now officially implemented our goal: +getting this to work requires SSA construction in the general case. However, +to be really useful, we want the ability to define our own local variables, lets +add this next! +

      + +
      + + + + + +
      + +

      Adding var/in is just like any other other extensions we made to +Kaleidoscope: we extend the lexer, the parser, the AST and the code generator. +The first step for adding our new 'var/in' construct is to extend the lexer. +As before, this is pretty trivial, the code looks like this:

      + +
      +
      +enum Token {
      +  ...
      +  // var definition
      +  tok_var = -13
      +...
      +}
      +...
      +static int gettok() {
      +...
      +    if (IdentifierStr == "in") return tok_in;
      +    if (IdentifierStr == "binary") return tok_binary;
      +    if (IdentifierStr == "unary") return tok_unary;
      +    if (IdentifierStr == "var") return tok_var;
      +    return tok_identifier;
      +...
      +
      +
      + +

      The next step is to define the AST node that we will construct. For var/in, +it will look like this:

      + +
      +
      +/// VarExprAST - Expression class for var/in
      +class VarExprAST : public ExprAST {
      +  std::vector<std::pair<std::string, ExprAST*> > VarNames;
      +  ExprAST *Body;
      +public:
      +  VarExprAST(const std::vector<std::pair<std::string, ExprAST*> > &varnames,
      +             ExprAST *body)
      +  : VarNames(varnames), Body(body) {}
      +  
      +  virtual Value *Codegen();
      +};
      +
      +
      + +

      var/in allows a list of names to be defined all at once, and each name can +optionally have an initializer value. As such, we capture this information in +the VarNames vector. Also, var/in has a body, this body is allowed to access +the variables defined by the let/in.

      + +

      With this ready, we can define the parser pieces. First thing we do is add +it as a primary expression:

      + +
      +
      +/// primary
      +///   ::= identifierexpr
      +///   ::= numberexpr
      +///   ::= parenexpr
      +///   ::= ifexpr
      +///   ::= forexpr
      +///   ::= varexpr
      +static ExprAST *ParsePrimary() {
      +  switch (CurTok) {
      +  default: return Error("unknown token when expecting an expression");
      +  case tok_identifier: return ParseIdentifierExpr();
      +  case tok_number:     return ParseNumberExpr();
      +  case '(':            return ParseParenExpr();
      +  case tok_if:         return ParseIfExpr();
      +  case tok_for:        return ParseForExpr();
      +  case tok_var:        return ParseVarExpr();
      +  }
      +}
      +
      +
      + +

      Next we define ParseVarExpr:

      + +
      +
      +/// varexpr ::= 'var' identifer ('=' expression)? 
      +//                    (',' identifer ('=' expression)?)* 'in' expression
      +static ExprAST *ParseVarExpr() {
      +  getNextToken();  // eat the var.
      +
      +  std::vector<std::pair<std::string, ExprAST*> > VarNames;
      +
      +  // At least one variable name is required.
      +  if (CurTok != tok_identifier)
      +    return Error("expected identifier after var");
      +
      +
      + +

      The first part of this code parses the list of identifier/expr pairs into the +local VarNames vector. + +

      +
      +  while (1) {
      +    std::string Name = IdentifierStr;
      +    getNextToken();  // eat identifer.
      +
      +    // Read the optional initializer.
      +    ExprAST *Init = 0;
      +    if (CurTok == '=') {
      +      getNextToken(); // eat the '='.
      +      
      +      Init = ParseExpression();
      +      if (Init == 0) return 0;
      +    }
      +    
      +    VarNames.push_back(std::make_pair(Name, Init));
      +    
      +    // End of var list, exit loop.
      +    if (CurTok != ',') break;
      +    getNextToken(); // eat the ','.
      +    
      +    if (CurTok != tok_identifier)
      +      return Error("expected identifier list after var");
      +  }
      +
      +
      + +

      Once all the variables are parsed, we then parse the body and create the +AST node:

      + +
      +
      +  // At this point, we have to have 'in'.
      +  if (CurTok != tok_in)
      +    return Error("expected 'in' keyword after 'var'");
      +  getNextToken();  // eat 'in'.
      +  
      +  ExprAST *Body = ParseExpression();
      +  if (Body == 0) return 0;
      +  
      +  return new VarExprAST(VarNames, Body);
      +}
      +
      +
      + +

      Now that we can parse and represent the code, we need to support emission of +LLVM IR for it. This code starts out with:

      + +
      +
      +Value *VarExprAST::Codegen() {
      +  std::vector<AllocaInst *> OldBindings;
      +  
      +  Function *TheFunction = Builder.GetInsertBlock()->getParent();
      +
      +  // Register all variables and emit their initializer.
      +  for (unsigned i = 0, e = VarNames.size(); i != e; ++i) {
      +    const std::string &VarName = VarNames[i].first;
      +    ExprAST *Init = VarNames[i].second;
      +
      +
      + +

      Basically it loops over all the variables, installing them one at a time. +For each variable we put into the symbol table, we remember the previous value +that we replace in OldBindings.

      + +
      +
      +    // Emit the initializer before adding the variable to scope, this prevents
      +    // the initializer from referencing the variable itself, and permits stuff
      +    // like this:
      +    //  var a = 1 in
      +    //    var a = a in ...   # refers to outer 'a'.
      +    Value *InitVal;
      +    if (Init) {
      +      InitVal = Init->Codegen();
      +      if (InitVal == 0) return 0;
      +    } else { // If not specified, use 0.0.
      +      InitVal = ConstantFP::get(Type::DoubleTy, APFloat(0.0));
      +    }
      +    
      +    AllocaInst *Alloca = CreateEntryBlockAlloca(TheFunction, VarName);
      +    Builder.CreateStore(InitVal, Alloca);
      +
      +    // Remember the old variable binding so that we can restore the binding when
      +    // we unrecurse.
      +    OldBindings.push_back(NamedValues[VarName]);
      +    
      +    // Remember this binding.
      +    NamedValues[VarName] = Alloca;
      +  }
      +
      +

      There are more comments here than code. The basic idea is that we emit the +initializer, create the alloca, then update the symbol table to point to it. +Once all the variables are installed in the symbol table, we evaluate the body +of the var/in expression:

      + +
      +
      +  // Codegen the body, now that all vars are in scope.
      +  Value *BodyVal = Body->Codegen();
      +  if (BodyVal == 0) return 0;
      +
      +
      + +

      Finally, before returning, we restore the previous variable bindings:

      + +
      +
      +  // Pop all our variables from scope.
      +  for (unsigned i = 0, e = VarNames.size(); i != e; ++i)
      +    NamedValues[VarNames[i].first] = OldBindings[i];
      +
      +  // Return the body computation.
      +  return BodyVal;
      +}
      +
      +
      + +

      The end result of all of this is that we get properly scoped variable +definitions, and we even (trivially) allow mutation of them :).

      + +

      With this, we completed what we set out to do. Our nice iterative fib +example from the intro compiles and runs just fine. The mem2reg pass optimizes +all of our stack variables into SSA registers, inserting PHI nodes where needed, +and our front-end remains simple: no iterated dominator frontier computation +anywhere in sight.

      + +
      @@ -306,8 +962,8 @@

      -Here is the complete code listing for our running example, enhanced with the -if/then/else and for expressions.. To build this example, use: +Here is the complete code listing for our running example, enhanced with mutable +variables and var/in support. To build this example, use:

      @@ -323,6 +979,1141 @@
      +#include "llvm/DerivedTypes.h"
      +#include "llvm/ExecutionEngine/ExecutionEngine.h"
      +#include "llvm/Module.h"
      +#include "llvm/ModuleProvider.h"
      +#include "llvm/PassManager.h"
      +#include "llvm/Analysis/Verifier.h"
      +#include "llvm/Target/TargetData.h"
      +#include "llvm/Transforms/Scalar.h"
      +#include "llvm/Support/LLVMBuilder.h"
      +#include <cstdio>
      +#include <string>
      +#include <map>
      +#include <vector>
      +using namespace llvm;
      +
      +//===----------------------------------------------------------------------===//
      +// Lexer
      +//===----------------------------------------------------------------------===//
      +
      +// The lexer returns tokens [0-255] if it is an unknown character, otherwise one
      +// of these for known things.
      +enum Token {
      +  tok_eof = -1,
      +
      +  // commands
      +  tok_def = -2, tok_extern = -3,
      +
      +  // primary
      +  tok_identifier = -4, tok_number = -5,
      +  
      +  // control
      +  tok_if = -6, tok_then = -7, tok_else = -8,
      +  tok_for = -9, tok_in = -10,
      +  
      +  // operators
      +  tok_binary = -11, tok_unary = -12,
      +  
      +  // var definition
      +  tok_var = -13
      +};
      +
      +static std::string IdentifierStr;  // Filled in if tok_identifier
      +static double NumVal;              // Filled in if tok_number
      +
      +/// gettok - Return the next token from standard input.
      +static int gettok() {
      +  static int LastChar = ' ';
      +
      +  // Skip any whitespace.
      +  while (isspace(LastChar))
      +    LastChar = getchar();
      +
      +  if (isalpha(LastChar)) { // identifier: [a-zA-Z][a-zA-Z0-9]*
      +    IdentifierStr = LastChar;
      +    while (isalnum((LastChar = getchar())))
      +      IdentifierStr += LastChar;
      +
      +    if (IdentifierStr == "def") return tok_def;
      +    if (IdentifierStr == "extern") return tok_extern;
      +    if (IdentifierStr == "if") return tok_if;
      +    if (IdentifierStr == "then") return tok_then;
      +    if (IdentifierStr == "else") return tok_else;
      +    if (IdentifierStr == "for") return tok_for;
      +    if (IdentifierStr == "in") return tok_in;
      +    if (IdentifierStr == "binary") return tok_binary;
      +    if (IdentifierStr == "unary") return tok_unary;
      +    if (IdentifierStr == "var") return tok_var;
      +    return tok_identifier;
      +  }
      +
      +  if (isdigit(LastChar) || LastChar == '.') {   // Number: [0-9.]+
      +    std::string NumStr;
      +    do {
      +      NumStr += LastChar;
      +      LastChar = getchar();
      +    } while (isdigit(LastChar) || LastChar == '.');
      +
      +    NumVal = strtod(NumStr.c_str(), 0);
      +    return tok_number;
      +  }
      +
      +  if (LastChar == '#') {
      +    // Comment until end of line.
      +    do LastChar = getchar();
      +    while (LastChar != EOF && LastChar != '\n' & LastChar != '\r');
      +    
      +    if (LastChar != EOF)
      +      return gettok();
      +  }
      +  
      +  // Check for end of file.  Don't eat the EOF.
      +  if (LastChar == EOF)
      +    return tok_eof;
      +
      +  // Otherwise, just return the character as its ascii value.
      +  int ThisChar = LastChar;
      +  LastChar = getchar();
      +  return ThisChar;
      +}
      +
      +//===----------------------------------------------------------------------===//
      +// Abstract Syntax Tree (aka Parse Tree)
      +//===----------------------------------------------------------------------===//
      +
      +/// ExprAST - Base class for all expression nodes.
      +class ExprAST {
      +public:
      +  virtual ~ExprAST() {}
      +  virtual Value *Codegen() = 0;
      +};
      +
      +/// NumberExprAST - Expression class for numeric literals like "1.0".
      +class NumberExprAST : public ExprAST {
      +  double Val;
      +public:
      +  NumberExprAST(double val) : Val(val) {}
      +  virtual Value *Codegen();
      +};
      +
      +/// VariableExprAST - Expression class for referencing a variable, like "a".
      +class VariableExprAST : public ExprAST {
      +  std::string Name;
      +public:
      +  VariableExprAST(const std::string &name) : Name(name) {}
      +  const std::string &getName() const { return Name; }
      +  virtual Value *Codegen();
      +};
      +
      +/// UnaryExprAST - Expression class for a unary operator.
      +class UnaryExprAST : public ExprAST {
      +  char Opcode;
      +  ExprAST *Operand;
      +public:
      +  UnaryExprAST(char opcode, ExprAST *operand) 
      +    : Opcode(opcode), Operand(operand) {}
      +  virtual Value *Codegen();
      +};
      +
      +/// BinaryExprAST - Expression class for a binary operator.
      +class BinaryExprAST : public ExprAST {
      +  char Op;
      +  ExprAST *LHS, *RHS;
      +public:
      +  BinaryExprAST(char op, ExprAST *lhs, ExprAST *rhs) 
      +    : Op(op), LHS(lhs), RHS(rhs) {}
      +  virtual Value *Codegen();
      +};
      +
      +/// CallExprAST - Expression class for function calls.
      +class CallExprAST : public ExprAST {
      +  std::string Callee;
      +  std::vector<ExprAST*> Args;
      +public:
      +  CallExprAST(const std::string &callee, std::vector<ExprAST*> &args)
      +    : Callee(callee), Args(args) {}
      +  virtual Value *Codegen();
      +};
      +
      +/// IfExprAST - Expression class for if/then/else.
      +class IfExprAST : public ExprAST {
      +  ExprAST *Cond, *Then, *Else;
      +public:
      +  IfExprAST(ExprAST *cond, ExprAST *then, ExprAST *_else)
      +  : Cond(cond), Then(then), Else(_else) {}
      +  virtual Value *Codegen();
      +};
      +
      +/// ForExprAST - Expression class for for/in.
      +class ForExprAST : public ExprAST {
      +  std::string VarName;
      +  ExprAST *Start, *End, *Step, *Body;
      +public:
      +  ForExprAST(const std::string &varname, ExprAST *start, ExprAST *end,
      +             ExprAST *step, ExprAST *body)
      +    : VarName(varname), Start(start), End(end), Step(step), Body(body) {}
      +  virtual Value *Codegen();
      +};
      +
      +/// VarExprAST - Expression class for var/in
      +class VarExprAST : public ExprAST {
      +  std::vector<std::pair<std::string, ExprAST*> > VarNames;
      +  ExprAST *Body;
      +public:
      +  VarExprAST(const std::vector<std::pair<std::string, ExprAST*> > &varnames,
      +             ExprAST *body)
      +  : VarNames(varnames), Body(body) {}
      +  
      +  virtual Value *Codegen();
      +};
      +
      +/// PrototypeAST - This class represents the "prototype" for a function,
      +/// which captures its argument names as well as if it is an operator.
      +class PrototypeAST {
      +  std::string Name;
      +  std::vector<std::string> Args;
      +  bool isOperator;
      +  unsigned Precedence;  // Precedence if a binary op.
      +public:
      +  PrototypeAST(const std::string &name, const std::vector<std::string> &args,
      +               bool isoperator = false, unsigned prec = 0)
      +  : Name(name), Args(args), isOperator(isoperator), Precedence(prec) {}
      +  
      +  bool isUnaryOp() const { return isOperator && Args.size() == 1; }
      +  bool isBinaryOp() const { return isOperator && Args.size() == 2; }
      +  
      +  char getOperatorName() const {
      +    assert(isUnaryOp() || isBinaryOp());
      +    return Name[Name.size()-1];
      +  }
      +  
      +  unsigned getBinaryPrecedence() const { return Precedence; }
      +  
      +  Function *Codegen();
      +  
      +  void CreateArgumentAllocas(Function *F);
      +};
      +
      +/// FunctionAST - This class represents a function definition itself.
      +class FunctionAST {
      +  PrototypeAST *Proto;
      +  ExprAST *Body;
      +public:
      +  FunctionAST(PrototypeAST *proto, ExprAST *body)
      +    : Proto(proto), Body(body) {}
      +  
      +  Function *Codegen();
      +};
      +
      +//===----------------------------------------------------------------------===//
      +// Parser
      +//===----------------------------------------------------------------------===//
      +
      +/// CurTok/getNextToken - Provide a simple token buffer.  CurTok is the current
      +/// token the parser it looking at.  getNextToken reads another token from the
      +/// lexer and updates CurTok with its results.
      +static int CurTok;
      +static int getNextToken() {
      +  return CurTok = gettok();
      +}
      +
      +/// BinopPrecedence - This holds the precedence for each binary operator that is
      +/// defined.
      +static std::map<char, int> BinopPrecedence;
      +
      +/// GetTokPrecedence - Get the precedence of the pending binary operator token.
      +static int GetTokPrecedence() {
      +  if (!isascii(CurTok))
      +    return -1;
      +  
      +  // Make sure it's a declared binop.
      +  int TokPrec = BinopPrecedence[CurTok];
      +  if (TokPrec <= 0) return -1;
      +  return TokPrec;
      +}
      +
      +/// Error* - These are little helper functions for error handling.
      +ExprAST *Error(const char *Str) { fprintf(stderr, "Error: %s\n", Str);return 0;}
      +PrototypeAST *ErrorP(const char *Str) { Error(Str); return 0; }
      +FunctionAST *ErrorF(const char *Str) { Error(Str); return 0; }
      +
      +static ExprAST *ParseExpression();
      +
      +/// identifierexpr
      +///   ::= identifer
      +///   ::= identifer '(' expression* ')'
      +static ExprAST *ParseIdentifierExpr() {
      +  std::string IdName = IdentifierStr;
      +  
      +  getNextToken();  // eat identifer.
      +  
      +  if (CurTok != '(') // Simple variable ref.
      +    return new VariableExprAST(IdName);
      +  
      +  // Call.
      +  getNextToken();  // eat (
      +  std::vector<ExprAST*> Args;
      +  if (CurTok != ')') {
      +    while (1) {
      +      ExprAST *Arg = ParseExpression();
      +      if (!Arg) return 0;
      +      Args.push_back(Arg);
      +      
      +      if (CurTok == ')') break;
      +      
      +      if (CurTok != ',')
      +        return Error("Expected ')'");
      +      getNextToken();
      +    }
      +  }
      +
      +  // Eat the ')'.
      +  getNextToken();
      +  
      +  return new CallExprAST(IdName, Args);
      +}
      +
      +/// numberexpr ::= number
      +static ExprAST *ParseNumberExpr() {
      +  ExprAST *Result = new NumberExprAST(NumVal);
      +  getNextToken(); // consume the number
      +  return Result;
      +}
      +
      +/// parenexpr ::= '(' expression ')'
      +static ExprAST *ParseParenExpr() {
      +  getNextToken();  // eat (.
      +  ExprAST *V = ParseExpression();
      +  if (!V) return 0;
      +  
      +  if (CurTok != ')')
      +    return Error("expected ')'");
      +  getNextToken();  // eat ).
      +  return V;
      +}
      +
      +/// ifexpr ::= 'if' expression 'then' expression 'else' expression
      +static ExprAST *ParseIfExpr() {
      +  getNextToken();  // eat the if.
      +  
      +  // condition.
      +  ExprAST *Cond = ParseExpression();
      +  if (!Cond) return 0;
      +  
      +  if (CurTok != tok_then)
      +    return Error("expected then");
      +  getNextToken();  // eat the then
      +  
      +  ExprAST *Then = ParseExpression();
      +  if (Then == 0) return 0;
      +  
      +  if (CurTok != tok_else)
      +    return Error("expected else");
      +  
      +  getNextToken();
      +  
      +  ExprAST *Else = ParseExpression();
      +  if (!Else) return 0;
      +  
      +  return new IfExprAST(Cond, Then, Else);
      +}
      +
      +/// forexpr ::= 'for' identifer '=' expr ',' expr (',' expr)? 'in' expression
      +static ExprAST *ParseForExpr() {
      +  getNextToken();  // eat the for.
      +
      +  if (CurTok != tok_identifier)
      +    return Error("expected identifier after for");
      +  
      +  std::string IdName = IdentifierStr;
      +  getNextToken();  // eat identifer.
      +  
      +  if (CurTok != '=')
      +    return Error("expected '=' after for");
      +  getNextToken();  // eat '='.
      +  
      +  
      +  ExprAST *Start = ParseExpression();
      +  if (Start == 0) return 0;
      +  if (CurTok != ',')
      +    return Error("expected ',' after for start value");
      +  getNextToken();
      +  
      +  ExprAST *End = ParseExpression();
      +  if (End == 0) return 0;
      +  
      +  // The step value is optional.
      +  ExprAST *Step = 0;
      +  if (CurTok == ',') {
      +    getNextToken();
      +    Step = ParseExpression();
      +    if (Step == 0) return 0;
      +  }
      +  
      +  if (CurTok != tok_in)
      +    return Error("expected 'in' after for");
      +  getNextToken();  // eat 'in'.
      +  
      +  ExprAST *Body = ParseExpression();
      +  if (Body == 0) return 0;
      +
      +  return new ForExprAST(IdName, Start, End, Step, Body);
      +}
      +
      +/// varexpr ::= 'var' identifer ('=' expression)? 
      +//                    (',' identifer ('=' expression)?)* 'in' expression
      +static ExprAST *ParseVarExpr() {
      +  getNextToken();  // eat the var.
      +
      +  std::vector<std::pair<std::string, ExprAST*> > VarNames;
      +
      +  // At least one variable name is required.
      +  if (CurTok != tok_identifier)
      +    return Error("expected identifier after var");
      +  
      +  while (1) {
      +    std::string Name = IdentifierStr;
      +    getNextToken();  // eat identifer.
      +
      +    // Read the optional initializer.
      +    ExprAST *Init = 0;
      +    if (CurTok == '=') {
      +      getNextToken(); // eat the '='.
      +      
      +      Init = ParseExpression();
      +      if (Init == 0) return 0;
      +    }
      +    
      +    VarNames.push_back(std::make_pair(Name, Init));
      +    
      +    // End of var list, exit loop.
      +    if (CurTok != ',') break;
      +    getNextToken(); // eat the ','.
      +    
      +    if (CurTok != tok_identifier)
      +      return Error("expected identifier list after var");
      +  }
      +  
      +  // At this point, we have to have 'in'.
      +  if (CurTok != tok_in)
      +    return Error("expected 'in' keyword after 'var'");
      +  getNextToken();  // eat 'in'.
      +  
      +  ExprAST *Body = ParseExpression();
      +  if (Body == 0) return 0;
      +  
      +  return new VarExprAST(VarNames, Body);
      +}
      +
      +
      +/// primary
      +///   ::= identifierexpr
      +///   ::= numberexpr
      +///   ::= parenexpr
      +///   ::= ifexpr
      +///   ::= forexpr
      +///   ::= varexpr
      +static ExprAST *ParsePrimary() {
      +  switch (CurTok) {
      +  default: return Error("unknown token when expecting an expression");
      +  case tok_identifier: return ParseIdentifierExpr();
      +  case tok_number:     return ParseNumberExpr();
      +  case '(':            return ParseParenExpr();
      +  case tok_if:         return ParseIfExpr();
      +  case tok_for:        return ParseForExpr();
      +  case tok_var:        return ParseVarExpr();
      +  }
      +}
      +
      +/// unary
      +///   ::= primary
      +///   ::= '!' unary
      +static ExprAST *ParseUnary() {
      +  // If the current token is not an operator, it must be a primary expr.
      +  if (!isascii(CurTok) || CurTok == '(' || CurTok == ',')
      +    return ParsePrimary();
      +  
      +  // If this is a unary operator, read it.
      +  int Opc = CurTok;
      +  getNextToken();
      +  if (ExprAST *Operand = ParseUnary())
      +    return new UnaryExprAST(Opc, Operand);
      +  return 0;
      +}
      +
      +/// binoprhs
      +///   ::= ('+' unary)*
      +static ExprAST *ParseBinOpRHS(int ExprPrec, ExprAST *LHS) {
      +  // If this is a binop, find its precedence.
      +  while (1) {
      +    int TokPrec = GetTokPrecedence();
      +    
      +    // If this is a binop that binds at least as tightly as the current binop,
      +    // consume it, otherwise we are done.
      +    if (TokPrec < ExprPrec)
      +      return LHS;
      +    
      +    // Okay, we know this is a binop.
      +    int BinOp = CurTok;
      +    getNextToken();  // eat binop
      +    
      +    // Parse the unary expression after the binary operator.
      +    ExprAST *RHS = ParseUnary();
      +    if (!RHS) return 0;
      +    
      +    // If BinOp binds less tightly with RHS than the operator after RHS, let
      +    // the pending operator take RHS as its LHS.
      +    int NextPrec = GetTokPrecedence();
      +    if (TokPrec < NextPrec) {
      +      RHS = ParseBinOpRHS(TokPrec+1, RHS);
      +      if (RHS == 0) return 0;
      +    }
      +    
      +    // Merge LHS/RHS.
      +    LHS = new BinaryExprAST(BinOp, LHS, RHS);
      +  }
      +}
      +
      +/// expression
      +///   ::= unary binoprhs
      +///
      +static ExprAST *ParseExpression() {
      +  ExprAST *LHS = ParseUnary();
      +  if (!LHS) return 0;
      +  
      +  return ParseBinOpRHS(0, LHS);
      +}
      +
      +/// prototype
      +///   ::= id '(' id* ')'
      +///   ::= binary LETTER number? (id, id)
      +///   ::= unary LETTER (id)
      +static PrototypeAST *ParsePrototype() {
      +  std::string FnName;
      +  
      +  int Kind = 0;  // 0 = identifier, 1 = unary, 2 = binary.
      +  unsigned BinaryPrecedence = 30;
      +  
      +  switch (CurTok) {
      +  default:
      +    return ErrorP("Expected function name in prototype");
      +  case tok_identifier:
      +    FnName = IdentifierStr;
      +    Kind = 0;
      +    getNextToken();
      +    break;
      +  case tok_unary:
      +    getNextToken();
      +    if (!isascii(CurTok))
      +      return ErrorP("Expected unary operator");
      +    FnName = "unary";
      +    FnName += (char)CurTok;
      +    Kind = 1;
      +    getNextToken();
      +    break;
      +  case tok_binary:
      +    getNextToken();
      +    if (!isascii(CurTok))
      +      return ErrorP("Expected binary operator");
      +    FnName = "binary";
      +    FnName += (char)CurTok;
      +    Kind = 2;
      +    getNextToken();
      +    
      +    // Read the precedence if present.
      +    if (CurTok == tok_number) {
      +      if (NumVal < 1 || NumVal > 100)
      +        return ErrorP("Invalid precedecnce: must be 1..100");
      +      BinaryPrecedence = (unsigned)NumVal;
      +      getNextToken();
      +    }
      +    break;
      +  }
      +  
      +  if (CurTok != '(')
      +    return ErrorP("Expected '(' in prototype");
      +  
      +  std::vector<std::string> ArgNames;
      +  while (getNextToken() == tok_identifier)
      +    ArgNames.push_back(IdentifierStr);
      +  if (CurTok != ')')
      +    return ErrorP("Expected ')' in prototype");
      +  
      +  // success.
      +  getNextToken();  // eat ')'.
      +  
      +  // Verify right number of names for operator.
      +  if (Kind && ArgNames.size() != Kind)
      +    return ErrorP("Invalid number of operands for operator");
      +  
      +  return new PrototypeAST(FnName, ArgNames, Kind != 0, BinaryPrecedence);
      +}
      +
      +/// definition ::= 'def' prototype expression
      +static FunctionAST *ParseDefinition() {
      +  getNextToken();  // eat def.
      +  PrototypeAST *Proto = ParsePrototype();
      +  if (Proto == 0) return 0;
      +
      +  if (ExprAST *E = ParseExpression())
      +    return new FunctionAST(Proto, E);
      +  return 0;
      +}
      +
      +/// toplevelexpr ::= expression
      +static FunctionAST *ParseTopLevelExpr() {
      +  if (ExprAST *E = ParseExpression()) {
      +    // Make an anonymous proto.
      +    PrototypeAST *Proto = new PrototypeAST("", std::vector<std::string>());
      +    return new FunctionAST(Proto, E);
      +  }
      +  return 0;
      +}
      +
      +/// external ::= 'extern' prototype
      +static PrototypeAST *ParseExtern() {
      +  getNextToken();  // eat extern.
      +  return ParsePrototype();
      +}
      +
      +//===----------------------------------------------------------------------===//
      +// Code Generation
      +//===----------------------------------------------------------------------===//
      +
      +static Module *TheModule;
      +static LLVMFoldingBuilder Builder;
      +static std::map<std::string, AllocaInst*> NamedValues;
      +static FunctionPassManager *TheFPM;
      +
      +Value *ErrorV(const char *Str) { Error(Str); return 0; }
      +
      +/// CreateEntryBlockAlloca - Create an alloca instruction in the entry block of
      +/// the function.  This is used for mutable variables etc.
      +static AllocaInst *CreateEntryBlockAlloca(Function *TheFunction,
      +                                          const std::string &VarName) {
      +  LLVMBuilder TmpB(&TheFunction->getEntryBlock(),
      +                   TheFunction->getEntryBlock().begin());
      +  return TmpB.CreateAlloca(Type::DoubleTy, 0, VarName.c_str());
      +}
      +
      +
      +Value *NumberExprAST::Codegen() {
      +  return ConstantFP::get(Type::DoubleTy, APFloat(Val));
      +}
      +
      +Value *VariableExprAST::Codegen() {
      +  // Look this variable up in the function.
      +  Value *V = NamedValues[Name];
      +  if (V == 0) return ErrorV("Unknown variable name");
      +
      +  // Load the value.
      +  return Builder.CreateLoad(V, Name.c_str());
      +}
      +
      +Value *UnaryExprAST::Codegen() {
      +  Value *OperandV = Operand->Codegen();
      +  if (OperandV == 0) return 0;
      +  
      +  Function *F = TheModule->getFunction(std::string("unary")+Opcode);
      +  if (F == 0)
      +    return ErrorV("Unknown unary operator");
      +  
      +  return Builder.CreateCall(F, OperandV, "unop");
      +}
      +
      +
      +Value *BinaryExprAST::Codegen() {
      +  // Special case '=' because we don't want to emit the LHS as an expression.
      +  if (Op == '=') {
      +    // Assignment requires the LHS to be an identifier.
      +    VariableExprAST *LHSE = dynamic_cast<VariableExprAST*>(LHS);
      +    if (!LHSE)
      +      return ErrorV("destination of '=' must be a variable");
      +    // Codegen the RHS.
      +    Value *Val = RHS->Codegen();
      +    if (Val == 0) return 0;
      +
      +    // Look up the name.
      +    Value *Variable = NamedValues[LHSE->getName()];
      +    if (Variable == 0) return ErrorV("Unknown variable name");
      +
      +    Builder.CreateStore(Val, Variable);
      +    return Val;
      +  }
      +  
      +  
      +  Value *L = LHS->Codegen();
      +  Value *R = RHS->Codegen();
      +  if (L == 0 || R == 0) return 0;
      +  
      +  switch (Op) {
      +  case '+': return Builder.CreateAdd(L, R, "addtmp");
      +  case '-': return Builder.CreateSub(L, R, "subtmp");
      +  case '*': return Builder.CreateMul(L, R, "multmp");
      +  case '<':
      +    L = Builder.CreateFCmpULT(L, R, "multmp");
      +    // Convert bool 0/1 to double 0.0 or 1.0
      +    return Builder.CreateUIToFP(L, Type::DoubleTy, "booltmp");
      +  default: break;
      +  }
      +  
      +  // If it wasn't a builtin binary operator, it must be a user defined one. Emit
      +  // a call to it.
      +  Function *F = TheModule->getFunction(std::string("binary")+Op);
      +  assert(F && "binary operator not found!");
      +  
      +  Value *Ops[] = { L, R };
      +  return Builder.CreateCall(F, Ops, Ops+2, "binop");
      +}
      +
      +Value *CallExprAST::Codegen() {
      +  // Look up the name in the global module table.
      +  Function *CalleeF = TheModule->getFunction(Callee);
      +  if (CalleeF == 0)
      +    return ErrorV("Unknown function referenced");
      +  
      +  // If argument mismatch error.
      +  if (CalleeF->arg_size() != Args.size())
      +    return ErrorV("Incorrect # arguments passed");
      +
      +  std::vector<Value*> ArgsV;
      +  for (unsigned i = 0, e = Args.size(); i != e; ++i) {
      +    ArgsV.push_back(Args[i]->Codegen());
      +    if (ArgsV.back() == 0) return 0;
      +  }
      +  
      +  return Builder.CreateCall(CalleeF, ArgsV.begin(), ArgsV.end(), "calltmp");
      +}
      +
      +Value *IfExprAST::Codegen() {
      +  Value *CondV = Cond->Codegen();
      +  if (CondV == 0) return 0;
      +  
      +  // Convert condition to a bool by comparing equal to 0.0.
      +  CondV = Builder.CreateFCmpONE(CondV, 
      +                                ConstantFP::get(Type::DoubleTy, APFloat(0.0)),
      +                                "ifcond");
      +  
      +  Function *TheFunction = Builder.GetInsertBlock()->getParent();
      +  
      +  // Create blocks for the then and else cases.  Insert the 'then' block at the
      +  // end of the function.
      +  BasicBlock *ThenBB = new BasicBlock("then", TheFunction);
      +  BasicBlock *ElseBB = new BasicBlock("else");
      +  BasicBlock *MergeBB = new BasicBlock("ifcont");
      +  
      +  Builder.CreateCondBr(CondV, ThenBB, ElseBB);
      +  
      +  // Emit then value.
      +  Builder.SetInsertPoint(ThenBB);
      +  
      +  Value *ThenV = Then->Codegen();
      +  if (ThenV == 0) return 0;
      +  
      +  Builder.CreateBr(MergeBB);
      +  // Codegen of 'Then' can change the current block, update ThenBB for the PHI.
      +  ThenBB = Builder.GetInsertBlock();
      +  
      +  // Emit else block.
      +  TheFunction->getBasicBlockList().push_back(ElseBB);
      +  Builder.SetInsertPoint(ElseBB);
      +  
      +  Value *ElseV = Else->Codegen();
      +  if (ElseV == 0) return 0;
      +  
      +  Builder.CreateBr(MergeBB);
      +  // Codegen of 'Else' can change the current block, update ElseBB for the PHI.
      +  ElseBB = Builder.GetInsertBlock();
      +  
      +  // Emit merge block.
      +  TheFunction->getBasicBlockList().push_back(MergeBB);
      +  Builder.SetInsertPoint(MergeBB);
      +  PHINode *PN = Builder.CreatePHI(Type::DoubleTy, "iftmp");
      +  
      +  PN->addIncoming(ThenV, ThenBB);
      +  PN->addIncoming(ElseV, ElseBB);
      +  return PN;
      +}
      +
      +Value *ForExprAST::Codegen() {
      +  // Output this as:
      +  //   var = alloca double
      +  //   ...
      +  //   start = startexpr
      +  //   store start -> var
      +  //   goto loop
      +  // loop: 
      +  //   ...
      +  //   bodyexpr
      +  //   ...
      +  // loopend:
      +  //   step = stepexpr
      +  //   endcond = endexpr
      +  //
      +  //   curvar = load var
      +  //   nextvar = curvar + step
      +  //   store nextvar -> var
      +  //   br endcond, loop, endloop
      +  // outloop:
      +  
      +  Function *TheFunction = Builder.GetInsertBlock()->getParent();
      +
      +  // Create an alloca for the variable in the entry block.
      +  AllocaInst *Alloca = CreateEntryBlockAlloca(TheFunction, VarName);
      +  
      +  // Emit the start code first, without 'variable' in scope.
      +  Value *StartVal = Start->Codegen();
      +  if (StartVal == 0) return 0;
      +  
      +  // Store the value into the alloca.
      +  Builder.CreateStore(StartVal, Alloca);
      +  
      +  // Make the new basic block for the loop header, inserting after current
      +  // block.
      +  BasicBlock *PreheaderBB = Builder.GetInsertBlock();
      +  BasicBlock *LoopBB = new BasicBlock("loop", TheFunction);
      +  
      +  // Insert an explicit fall through from the current block to the LoopBB.
      +  Builder.CreateBr(LoopBB);
      +
      +  // Start insertion in LoopBB.
      +  Builder.SetInsertPoint(LoopBB);
      +  
      +  // Within the loop, the variable is defined equal to the PHI node.  If it
      +  // shadows an existing variable, we have to restore it, so save it now.
      +  AllocaInst *OldVal = NamedValues[VarName];
      +  NamedValues[VarName] = Alloca;
      +  
      +  // Emit the body of the loop.  This, like any other expr, can change the
      +  // current BB.  Note that we ignore the value computed by the body, but don't
      +  // allow an error.
      +  if (Body->Codegen() == 0)
      +    return 0;
      +  
      +  // Emit the step value.
      +  Value *StepVal;
      +  if (Step) {
      +    StepVal = Step->Codegen();
      +    if (StepVal == 0) return 0;
      +  } else {
      +    // If not specified, use 1.0.
      +    StepVal = ConstantFP::get(Type::DoubleTy, APFloat(1.0));
      +  }
      +  
      +  // Compute the end condition.
      +  Value *EndCond = End->Codegen();
      +  if (EndCond == 0) return EndCond;
      +  
      +  // Reload, increment, and restore the alloca.  This handles the case where
      +  // the body of the loop mutates the variable.
      +  Value *CurVar = Builder.CreateLoad(Alloca, VarName.c_str());
      +  Value *NextVar = Builder.CreateAdd(CurVar, StepVal, "nextvar");
      +  Builder.CreateStore(NextVar, Alloca);
      +  
      +  // Convert condition to a bool by comparing equal to 0.0.
      +  EndCond = Builder.CreateFCmpONE(EndCond, 
      +                                  ConstantFP::get(Type::DoubleTy, APFloat(0.0)),
      +                                  "loopcond");
      +  
      +  // Create the "after loop" block and insert it.
      +  BasicBlock *LoopEndBB = Builder.GetInsertBlock();
      +  BasicBlock *AfterBB = new BasicBlock("afterloop", TheFunction);
      +  
      +  // Insert the conditional branch into the end of LoopEndBB.
      +  Builder.CreateCondBr(EndCond, LoopBB, AfterBB);
      +  
      +  // Any new code will be inserted in AfterBB.
      +  Builder.SetInsertPoint(AfterBB);
      +  
      +  // Restore the unshadowed variable.
      +  if (OldVal)
      +    NamedValues[VarName] = OldVal;
      +  else
      +    NamedValues.erase(VarName);
      +
      +  
      +  // for expr always returns 0.0.
      +  return Constant::getNullValue(Type::DoubleTy);
      +}
      +
      +Value *VarExprAST::Codegen() {
      +  std::vector<AllocaInst *> OldBindings;
      +  
      +  Function *TheFunction = Builder.GetInsertBlock()->getParent();
      +
      +  // Register all variables and emit their initializer.
      +  for (unsigned i = 0, e = VarNames.size(); i != e; ++i) {
      +    const std::string &VarName = VarNames[i].first;
      +    ExprAST *Init = VarNames[i].second;
      +    
      +    // Emit the initializer before adding the variable to scope, this prevents
      +    // the initializer from referencing the variable itself, and permits stuff
      +    // like this:
      +    //  var a = 1 in
      +    //    var a = a in ...   # refers to outer 'a'.
      +    Value *InitVal;
      +    if (Init) {
      +      InitVal = Init->Codegen();
      +      if (InitVal == 0) return 0;
      +    } else { // If not specified, use 0.0.
      +      InitVal = ConstantFP::get(Type::DoubleTy, APFloat(0.0));
      +    }
      +    
      +    AllocaInst *Alloca = CreateEntryBlockAlloca(TheFunction, VarName);
      +    Builder.CreateStore(InitVal, Alloca);
      +
      +    // Remember the old variable binding so that we can restore the binding when
      +    // we unrecurse.
      +    OldBindings.push_back(NamedValues[VarName]);
      +    
      +    // Remember this binding.
      +    NamedValues[VarName] = Alloca;
      +  }
      +  
      +  // Codegen the body, now that all vars are in scope.
      +  Value *BodyVal = Body->Codegen();
      +  if (BodyVal == 0) return 0;
      +  
      +  // Pop all our variables from scope.
      +  for (unsigned i = 0, e = VarNames.size(); i != e; ++i)
      +    NamedValues[VarNames[i].first] = OldBindings[i];
      +
      +  // Return the body computation.
      +  return BodyVal;
      +}
      +
      +
      +Function *PrototypeAST::Codegen() {
      +  // Make the function type:  double(double,double) etc.
      +  std::vector<const Type*> Doubles(Args.size(), Type::DoubleTy);
      +  FunctionType *FT = FunctionType::get(Type::DoubleTy, Doubles, false);
      +  
      +  Function *F = new Function(FT, Function::ExternalLinkage, Name, TheModule);
      +  
      +  // If F conflicted, there was already something named 'Name'.  If it has a
      +  // body, don't allow redefinition or reextern.
      +  if (F->getName() != Name) {
      +    // Delete the one we just made and get the existing one.
      +    F->eraseFromParent();
      +    F = TheModule->getFunction(Name);
      +    
      +    // If F already has a body, reject this.
      +    if (!F->empty()) {
      +      ErrorF("redefinition of function");
      +      return 0;
      +    }
      +    
      +    // If F took a different number of args, reject.
      +    if (F->arg_size() != Args.size()) {
      +      ErrorF("redefinition of function with different # args");
      +      return 0;
      +    }
      +  }
      +  
      +  // Set names for all arguments.
      +  unsigned Idx = 0;
      +  for (Function::arg_iterator AI = F->arg_begin(); Idx != Args.size();
      +       ++AI, ++Idx)
      +    AI->setName(Args[Idx]);
      +    
      +  return F;
      +}
      +
      +/// CreateArgumentAllocas - Create an alloca for each argument and register the
      +/// argument in the symbol table so that references to it will succeed.
      +void PrototypeAST::CreateArgumentAllocas(Function *F) {
      +  Function::arg_iterator AI = F->arg_begin();
      +  for (unsigned Idx = 0, e = Args.size(); Idx != e; ++Idx, ++AI) {
      +    // Create an alloca for this variable.
      +    AllocaInst *Alloca = CreateEntryBlockAlloca(F, Args[Idx]);
      +
      +    // Store the initial value into the alloca.
      +    Builder.CreateStore(AI, Alloca);
      +
      +    // Add arguments to variable symbol table.
      +    NamedValues[Args[Idx]] = Alloca;
      +  }
      +}
      +
      +
      +Function *FunctionAST::Codegen() {
      +  NamedValues.clear();
      +  
      +  Function *TheFunction = Proto->Codegen();
      +  if (TheFunction == 0)
      +    return 0;
      +  
      +  // If this is an operator, install it.
      +  if (Proto->isBinaryOp())
      +    BinopPrecedence[Proto->getOperatorName()] = Proto->getBinaryPrecedence();
      +  
      +  // Create a new basic block to start insertion into.
      +  BasicBlock *BB = new BasicBlock("entry", TheFunction);
      +  Builder.SetInsertPoint(BB);
      +  
      +  // Add all arguments to the symbol table and create their allocas.
      +  Proto->CreateArgumentAllocas(TheFunction);
      +  
      +  if (Value *RetVal = Body->Codegen()) {
      +    // Finish off the function.
      +    Builder.CreateRet(RetVal);
      +
      +    // Validate the generated code, checking for consistency.
      +    verifyFunction(*TheFunction);
      +
      +    // Optimize the function.
      +    TheFPM->run(*TheFunction);
      +    
      +    return TheFunction;
      +  }
      +  
      +  // Error reading body, remove function.
      +  TheFunction->eraseFromParent();
      +
      +  if (Proto->isBinaryOp())
      +    BinopPrecedence.erase(Proto->getOperatorName());
      +  return 0;
      +}
      +
      +//===----------------------------------------------------------------------===//
      +// Top-Level parsing and JIT Driver
      +//===----------------------------------------------------------------------===//
      +
      +static ExecutionEngine *TheExecutionEngine;
      +
      +static void HandleDefinition() {
      +  if (FunctionAST *F = ParseDefinition()) {
      +    if (Function *LF = F->Codegen()) {
      +      fprintf(stderr, "Read function definition:");
      +      LF->dump();
      +    }
      +  } else {
      +    // Skip token for error recovery.
      +    getNextToken();
      +  }
      +}
      +
      +static void HandleExtern() {
      +  if (PrototypeAST *P = ParseExtern()) {
      +    if (Function *F = P->Codegen()) {
      +      fprintf(stderr, "Read extern: ");
      +      F->dump();
      +    }
      +  } else {
      +    // Skip token for error recovery.
      +    getNextToken();
      +  }
      +}
      +
      +static void HandleTopLevelExpression() {
      +  // Evaluate a top level expression into an anonymous function.
      +  if (FunctionAST *F = ParseTopLevelExpr()) {
      +    if (Function *LF = F->Codegen()) {
      +      // JIT the function, returning a function pointer.
      +      void *FPtr = TheExecutionEngine->getPointerToFunction(LF);
      +      
      +      // Cast it to the right type (takes no arguments, returns a double) so we
      +      // can call it as a native function.
      +      double (*FP)() = (double (*)())FPtr;
      +      fprintf(stderr, "Evaluated to %f\n", FP());
      +    }
      +  } else {
      +    // Skip token for error recovery.
      +    getNextToken();
      +  }
      +}
      +
      +/// top ::= definition | external | expression | ';'
      +static void MainLoop() {
      +  while (1) {
      +    fprintf(stderr, "ready> ");
      +    switch (CurTok) {
      +    case tok_eof:    return;
      +    case ';':        getNextToken(); break;  // ignore top level semicolons.
      +    case tok_def:    HandleDefinition(); break;
      +    case tok_extern: HandleExtern(); break;
      +    default:         HandleTopLevelExpression(); break;
      +    }
      +  }
      +}
      +
      +
      +
      +//===----------------------------------------------------------------------===//
      +// "Library" functions that can be "extern'd" from user code.
      +//===----------------------------------------------------------------------===//
      +
      +/// putchard - putchar that takes a double and returns 0.
      +extern "C" 
      +double putchard(double X) {
      +  putchar((char)X);
      +  return 0;
      +}
      +
      +/// printd - printf that takes a double prints it as "%f\n", returning 0.
      +extern "C" 
      +double printd(double X) {
      +  printf("%f\n", X);
      +  return 0;
      +}
      +
      +//===----------------------------------------------------------------------===//
      +// Main driver code.
      +//===----------------------------------------------------------------------===//
      +
      +int main() {
      +  // Install standard binary operators.
      +  // 1 is lowest precedence.
      +  BinopPrecedence['='] = 2;
      +  BinopPrecedence['<'] = 10;
      +  BinopPrecedence['+'] = 20;
      +  BinopPrecedence['-'] = 20;
      +  BinopPrecedence['*'] = 40;  // highest.
      +
      +  // Prime the first token.
      +  fprintf(stderr, "ready> ");
      +  getNextToken();
      +
      +  // Make the module, which holds all the code.
      +  TheModule = new Module("my cool jit");
      +  
      +  // Create the JIT.
      +  TheExecutionEngine = ExecutionEngine::create(TheModule);
      +
      +  {
      +    ExistingModuleProvider OurModuleProvider(TheModule);
      +    FunctionPassManager OurFPM(&OurModuleProvider);
      +      
      +    // Set up the optimizer pipeline.  Start with registering info about how the
      +    // target lays out data structures.
      +    OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData()));
      +    // Promote allocas to registers.
      +    OurFPM.add(createPromoteMemoryToRegisterPass());
      +    // Do simple "peephole" optimizations and bit-twiddling optzns.
      +    OurFPM.add(createInstructionCombiningPass());
      +    // Reassociate expressions.
      +    OurFPM.add(createReassociatePass());
      +    // Eliminate Common SubExpressions.
      +    OurFPM.add(createGVNPass());
      +    // Simplify the control flow graph (deleting unreachable blocks, etc).
      +    OurFPM.add(createCFGSimplificationPass());
      +
      +    // Set the global so the code gen can use this.
      +    TheFPM = &OurFPM;
      +
      +    // Run the main "interpreter loop" now.
      +    MainLoop();
      +    
      +    TheFPM = 0;
      +  }  // Free module provider and pass manager.
      +                                   
      +                                   
      +  // Print out all of the generated code.
      +  TheModule->dump();
      +  return 0;
      +}
       
      From baldrick at free.fr Sun Nov 4 18:35:08 2007 From: baldrick at free.fr (Duncan Sands) Date: Mon, 05 Nov 2007 00:35:08 -0000 Subject: [llvm-commits] [llvm] r43691 - /llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Message-ID: <200711050035.lA50Z8Xl014470@zion.cs.uiuc.edu> Author: baldrick Date: Sun Nov 4 18:35:07 2007 New Revision: 43691 URL: http://llvm.org/viewvc/llvm-project?rev=43691&view=rev Log: If a long double is in a packed struct, it may be that there is no padding. Modified: llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Modified: llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp?rev=43691&r1=43690&r2=43691&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Sun Nov 4 18:35:07 2007 @@ -733,7 +733,8 @@ /// HasPadding - Return true if the specified type has any structure or /// alignment padding, false otherwise. -static bool HasPadding(const Type *Ty, const TargetData &TD) { +static bool HasPadding(const Type *Ty, const TargetData &TD, + bool inPacked = false) { if (const StructType *STy = dyn_cast(Ty)) { const StructLayout *SL = TD.getStructLayout(STy); unsigned PrevFieldBitOffset = 0; @@ -741,7 +742,7 @@ unsigned FieldBitOffset = SL->getElementOffsetInBits(i); // Padding in sub-elements? - if (HasPadding(STy->getElementType(i), TD)) + if (HasPadding(STy->getElementType(i), TD, STy->isPacked())) return true; // Check to see if there is any padding between this element and the @@ -765,11 +766,12 @@ } } else if (const ArrayType *ATy = dyn_cast(Ty)) { - return HasPadding(ATy->getElementType(), TD); + return HasPadding(ATy->getElementType(), TD, false); } else if (const VectorType *VTy = dyn_cast(Ty)) { - return HasPadding(VTy->getElementType(), TD); + return HasPadding(VTy->getElementType(), TD, false); } - return TD.getTypeSizeInBits(Ty) != TD.getABITypeSizeInBits(Ty); + return inPacked ? + false : TD.getTypeSizeInBits(Ty) != TD.getABITypeSizeInBits(Ty); } /// isSafeStructAllocaToScalarRepl - Check to see if the specified allocation of From evan.cheng at apple.com Sun Nov 4 18:59:10 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 05 Nov 2007 00:59:10 -0000 Subject: [llvm-commits] [llvm] r43692 - in /llvm/trunk: lib/CodeGen/LiveIntervalAnalysis.cpp test/CodeGen/X86/2007-11-04-LiveIntervalCrash.ll Message-ID: <200711050059.lA50xAoR015491@zion.cs.uiuc.edu> Author: evancheng Date: Sun Nov 4 18:59:10 2007 New Revision: 43692 URL: http://llvm.org/viewvc/llvm-project?rev=43692&view=rev Log: Fix PR1187. Added: llvm/trunk/test/CodeGen/X86/2007-11-04-LiveIntervalCrash.ll Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=43692&r1=43691&r2=43692&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Sun Nov 4 18:59:10 2007 @@ -466,7 +466,7 @@ continue; if (MRegisterInfo::isVirtualRegister(PhysReg)) PhysReg = vrm.getPhys(PhysReg); - if (mri_->regsOverlap(PhysReg, reg)) + if (PhysReg && mri_->regsOverlap(PhysReg, reg)) return true; } } Added: llvm/trunk/test/CodeGen/X86/2007-11-04-LiveIntervalCrash.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2007-11-04-LiveIntervalCrash.ll?rev=43692&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/2007-11-04-LiveIntervalCrash.ll (added) +++ llvm/trunk/test/CodeGen/X86/2007-11-04-LiveIntervalCrash.ll Sun Nov 4 18:59:10 2007 @@ -0,0 +1,37 @@ +; RUN: llvm-as < %s | llc -mtriple=x86_64-unknown-linux-gnu +; PR1187 + + %struct.dentry = type { %struct.dentry_operations* } + %struct.dentry_operations = type { i32 (%struct.dentry*, %struct.qstr*)* } + %struct.qstr = type { i32, i32, i8* } + +define %struct.dentry* @d_hash_and_lookup(%struct.dentry* %dir, %struct.qstr* %name) { +entry: + br i1 false, label %bb37, label %bb + +bb: ; preds = %bb, %entry + %name8.0.reg2mem.0.rec = phi i64 [ %indvar.next, %bb ], [ 0, %entry ] ; [#uses=1] + %hash.0.reg2mem.0 = phi i64 [ %tmp27, %bb ], [ 0, %entry ] ; [#uses=1] + %tmp13 = load i8* null, align 1 ; [#uses=1] + %tmp1314 = zext i8 %tmp13 to i64 ; [#uses=1] + %tmp25 = lshr i64 %tmp1314, 4 ; [#uses=1] + %tmp22 = add i64 %tmp25, %hash.0.reg2mem.0 ; [#uses=1] + %tmp26 = add i64 %tmp22, 0 ; [#uses=1] + %tmp27 = mul i64 %tmp26, 11 ; [#uses=2] + %indvar.next = add i64 %name8.0.reg2mem.0.rec, 1 ; [#uses=2] + %exitcond = icmp eq i64 %indvar.next, 0 ; [#uses=1] + br i1 %exitcond, label %bb37.loopexit, label %bb + +bb37.loopexit: ; preds = %bb + %phitmp = trunc i64 %tmp27 to i32 ; [#uses=1] + br label %bb37 + +bb37: ; preds = %bb37.loopexit, %entry + %hash.0.reg2mem.1 = phi i32 [ %phitmp, %bb37.loopexit ], [ 0, %entry ] ; [#uses=1] + store i32 %hash.0.reg2mem.1, i32* null, align 8 + %tmp75 = tail call i32 null( %struct.dentry* %dir, %struct.qstr* %name ) ; [#uses=0] + %tmp84 = tail call i32 (...)* @d_lookup( %struct.dentry* %dir, %struct.qstr* %name ) ; [#uses=0] + ret %struct.dentry* null +} + +declare i32 @d_lookup(...) From evan.cheng at apple.com Sun Nov 4 19:00:44 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 05 Nov 2007 01:00:44 -0000 Subject: [llvm-commits] [llvm] r43693 - /llvm/trunk/test/CodeGen/X86/2007-11-04-LiveIntervalCrash.ll Message-ID: <200711050100.lA510iha015559@zion.cs.uiuc.edu> Author: evancheng Date: Sun Nov 4 19:00:44 2007 New Revision: 43693 URL: http://llvm.org/viewvc/llvm-project?rev=43693&view=rev Log: Doh. PR1187 -> PR1766. Modified: llvm/trunk/test/CodeGen/X86/2007-11-04-LiveIntervalCrash.ll Modified: llvm/trunk/test/CodeGen/X86/2007-11-04-LiveIntervalCrash.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2007-11-04-LiveIntervalCrash.ll?rev=43693&r1=43692&r2=43693&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/2007-11-04-LiveIntervalCrash.ll (original) +++ llvm/trunk/test/CodeGen/X86/2007-11-04-LiveIntervalCrash.ll Sun Nov 4 19:00:44 2007 @@ -1,5 +1,5 @@ ; RUN: llvm-as < %s | llc -mtriple=x86_64-unknown-linux-gnu -; PR1187 +; PR1766 %struct.dentry = type { %struct.dentry_operations* } %struct.dentry_operations = type { i32 (%struct.dentry*, %struct.qstr*)* } From gordonhenriksen at mac.com Sun Nov 4 19:54:08 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Mon, 05 Nov 2007 01:54:08 -0000 Subject: [llvm-commits] [llvm] r43694 - in /llvm/trunk: include/llvm/Transforms/IPO.h lib/Transforms/IPO/LoopExtractor.cpp tools/bugpoint/ExtractFunction.cpp Message-ID: <200711050154.lA51s8QQ017747@zion.cs.uiuc.edu> Author: gordon Date: Sun Nov 4 19:54:05 2007 New Revision: 43694 URL: http://llvm.org/viewvc/llvm-project?rev=43694&view=rev Log: Deleting redundant copy of block extractor pass. See also PR1775. Modified: llvm/trunk/include/llvm/Transforms/IPO.h llvm/trunk/lib/Transforms/IPO/LoopExtractor.cpp llvm/trunk/tools/bugpoint/ExtractFunction.cpp Modified: llvm/trunk/include/llvm/Transforms/IPO.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/IPO.h?rev=43694&r1=43693&r2=43694&view=diff ============================================================================== --- llvm/trunk/include/llvm/Transforms/IPO.h (original) +++ llvm/trunk/include/llvm/Transforms/IPO.h Sun Nov 4 19:54:05 2007 @@ -153,7 +153,7 @@ /// createBlockExtractorPass - This pass extracts all blocks (except those /// specified in the argument list) from the functions in the module. /// -ModulePass *createBlockExtractorPass(std::vector &BTNE); +ModulePass *createBlockExtractorPass(const std::vector &BTNE); /// createOptimizeWellKnownCallsPass - This pass optimizes specific calls to /// specific well-known (library) functions. Modified: llvm/trunk/lib/Transforms/IPO/LoopExtractor.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/LoopExtractor.cpp?rev=43694&r1=43693&r2=43694&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/LoopExtractor.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/LoopExtractor.cpp Sun Nov 4 19:54:05 2007 @@ -151,7 +151,7 @@ std::vector BlocksToNotExtract; public: static char ID; // Pass identification, replacement for typeid - explicit BlockExtractorPass(std::vector &B) + explicit BlockExtractorPass(const std::vector &B) : ModulePass((intptr_t)&ID), BlocksToNotExtract(B) {} BlockExtractorPass() : ModulePass((intptr_t)&ID) {} @@ -166,7 +166,8 @@ // createBlockExtractorPass - This pass extracts all blocks (except those // specified in the argument list) from the functions in the module. // -ModulePass *llvm::createBlockExtractorPass(std::vector &BTNE) { +ModulePass *llvm::createBlockExtractorPass(const std::vector &BTNE) +{ return new BlockExtractorPass(BTNE); } Modified: llvm/trunk/tools/bugpoint/ExtractFunction.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/ExtractFunction.cpp?rev=43694&r1=43693&r2=43694&view=diff ============================================================================== --- llvm/trunk/tools/bugpoint/ExtractFunction.cpp (original) +++ llvm/trunk/tools/bugpoint/ExtractFunction.cpp Sun Nov 4 19:54:05 2007 @@ -297,52 +297,6 @@ // Basic Block Extraction Code //===----------------------------------------------------------------------===// -namespace { - std::vector BlocksToNotExtract; - - /// BlockExtractorPass - This pass is used by bugpoint to extract all blocks - /// from the module into their own functions except for those specified by the - /// BlocksToNotExtract list. - class BlockExtractorPass : public ModulePass { - bool runOnModule(Module &M); - public: - static char ID; // Pass ID, replacement for typeid - BlockExtractorPass() : ModulePass((intptr_t)&ID) {} - }; - char BlockExtractorPass::ID = 0; - RegisterPass - XX("extract-bbs", "Extract Basic Blocks From Module (for bugpoint use)"); -} - -bool BlockExtractorPass::runOnModule(Module &M) { - std::set TranslatedBlocksToNotExtract; - for (unsigned i = 0, e = BlocksToNotExtract.size(); i != e; ++i) { - BasicBlock *BB = BlocksToNotExtract[i]; - Function *F = BB->getParent(); - - // Map the corresponding function in this module. - Function *MF = M.getFunction(F->getName()); - - // Figure out which index the basic block is in its function. - Function::iterator BBI = MF->begin(); - std::advance(BBI, std::distance(F->begin(), Function::iterator(BB))); - TranslatedBlocksToNotExtract.insert(BBI); - } - - // Now that we know which blocks to not extract, figure out which ones we WANT - // to extract. - std::vector BlocksToExtract; - for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F) - for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) - if (!TranslatedBlocksToNotExtract.count(BB)) - BlocksToExtract.push_back(BB); - - for (unsigned i = 0, e = BlocksToExtract.size(); i != e; ++i) - ExtractBasicBlock(BlocksToExtract[i]); - - return !BlocksToExtract.empty(); -} - /// ExtractMappedBlocksFromModule - Extract all but the specified basic blocks /// into their own functions. The only detail is that M is actually a module /// cloned from the one the BBs are in, so some mapping needs to be performed. @@ -351,13 +305,10 @@ Module *BugDriver::ExtractMappedBlocksFromModule(const std::vector &BBs, Module *M) { - // Set the global list so that pass will be able to access it. - BlocksToNotExtract = BBs; - std::vector PI; - PI.push_back(getPI(new BlockExtractorPass())); + // FIXME: BBs is actually ignored. See http://llvm.org/PR1775 + PI.push_back(getPI(createBlockExtractorPass(BBs))); Module *Ret = runPassesOn(M, PI); - BlocksToNotExtract.clear(); if (Ret == 0) { std::cout << "*** Basic Block extraction failed, please report a bug!\n"; M = swapProgramIn(M); From sabre at nondot.org Sun Nov 4 19:58:13 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 05 Nov 2007 01:58:13 -0000 Subject: [llvm-commits] [llvm] r43695 - in /llvm/trunk/docs/tutorial: LangImpl8.html index.html Message-ID: <200711050158.lA51wDxu017924@zion.cs.uiuc.edu> Author: lattner Date: Sun Nov 4 19:58:13 2007 New Revision: 43695 URL: http://llvm.org/viewvc/llvm-project?rev=43695&view=rev Log: Add the first section of chapter 8. Added: llvm/trunk/docs/tutorial/LangImpl8.html Modified: llvm/trunk/docs/tutorial/index.html Added: llvm/trunk/docs/tutorial/LangImpl8.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/LangImpl8.html?rev=43695&view=auto ============================================================================== --- llvm/trunk/docs/tutorial/LangImpl8.html (added) +++ llvm/trunk/docs/tutorial/LangImpl8.html Sun Nov 4 19:58:13 2007 @@ -0,0 +1,143 @@ + + + + + Kaleidoscope: Conclusion, ideas for extensions, and other useful tidbits + + + + + + + +
      Kaleidoscope: Conclusion
      + +
      +

      Written by Chris Lattner

      +
      + + + + + +
      + +

      Welcome to the the final chapter of the "Implementing a +language with LLVM" tutorial. In the course of this tutorial, we have grown +our little Kaleidoscope language from being a useless toy, to being a +semi-interesting (but probably still useless) toy. :)

      + +

      It is interesting to see how far we've come, and how little code it has +taken. We built the entire lexer, parser, AST, code generator, and an +interactive run-loop (with a JIT!) by-hand in under 700 lines of +(non-comment/non-blank) code.

      + +

      Our little language supports a couple of interesting features: it supports +user defined binary and unary operators, it uses JIT compilation for immediate +evaluation, and it supports a few control flow constructs with SSA construction. +

      + +

      Part of the idea of this tutorial was to show you how easy and fun it can be +to define, build, and play with languages. Building a compiler need not be a +scary or mystical process! Now that you've seen some of the basics, I strongly +encourage you to take the code and hack on it. For example, try adding:

      + +
        +
      • global variables - While global variables have questional value in +modern software engineering, they are often useful when putting together quick +little hacks like the Kaleidoscope compiler itself. Fortunately, our current +setup makes it very easy to add global variables: just have value lookup check +to see if an unresolved variable is in the global variable symbol table before +rejecting it. To create a new global variable, make an instance of the LLVM +GlobalVariable class.
      • + +
      • typed variables - Kaleidoscope currently only supports variables of +type double. This gives the language a very nice elegance, because only +supporting one type means that you never have to specify types. Different +languages have different ways of handling this. The easiest way is to require +the user to specify types for every variable definition, and record the type +of the variable in the symbol table along with its Value*.
      • + +
      • arrays, structs, vectors, etc - Once you add types, you can start +extending the type system in all sorts of interesting ways. Simple arrays are +very easy and are quite useful for many different applications. Adding them is +mostly an exercise in learning how the LLVM getelementptr instruction works. +The getelementptr instruction is so nifty/unconventional, it has its own FAQ!).
      • + +
      • standard runtime - Our current language allows the user to access +arbitrary external functions, and we use it for things like "printd" and +"putchard". As you extend the language to add higher-level constructs, often +these constructs make the most amount of sense to be lowered into calls into a +language-supplied runtime. For example, if you add hash tables to the language, +it would probably make sense to add the routines to a runtime, instead of +inlining them all the way.
      • + +
      • memory management - Currently we can only access the stack in +Kaleidoscope. It would also be useful to be able to allocate heap memory, +either with calls to the standard libc malloc/free interface or with a garbage +collector. If you choose to use garbage collection, note that LLVM fully +supports Accurate Garbage Collection +including algorithms that move objects and need to scan/update the stack.
      • + +
      • debugger support - LLVM supports generation of DWARF Debug info which is understood by +common debuggers like GDB. Adding support for debug info is fairly +straight-forward. The best way to understand it is to compile some C/C++ code +with "llvm-gcc -g -O0" and taking a look at what it produces.
      • + +
      • exception handlingsupport - LLVM supports generation of zero cost exceptions which interoperate +with code compiled in other languages. You could also generate code by +implicitly making every function return an error value and checking it. You +could also make explicit use of setjmp/longjmp. There are many different ways +to go here.
      • + +
      • object orientation, generics, database access, complex numbers, +geometric programming, ... - Really, there is +no end of crazy features that you can add to the language.
      • + +
      + +

      +Have fun - try doing something crazy and unusual. Building a language like +everyone else always has is much less fun than trying something a little crazy +and off the wall and seeing how it turns out. If you get stuck or want to talk +about it, feel free to email the llvmdev mailing +list: it has lots of people who are interested in languages and are often +willing to help out. +

      + +

      Before we end, I want to talk about some "tips and tricks" for generating +LLVM IR. These are some of the more subtle things that may not be obvious, but +are very useful if you want to take advantage of LLVM's capabilities.

      + +
      + + + + + +
      + +

      + +
      + + +
      +
      + Valid CSS! + Valid HTML 4.01! + + Chris Lattner
      + The LLVM Compiler Infrastructure
      + Last modified: $Date: 2007-10-17 11:05:13 -0700 (Wed, 17 Oct 2007) $ +
      + + Modified: llvm/trunk/docs/tutorial/index.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/index.html?rev=43695&r1=43694&r2=43695&view=diff ============================================================================== --- llvm/trunk/docs/tutorial/index.html (original) +++ llvm/trunk/docs/tutorial/index.html Sun Nov 4 19:58:13 2007 @@ -34,7 +34,7 @@
    • Extending the language: control flow
    • Extending the language: user-defined operators
    • Extending the language: mutable variables / SSA construction
    • -
    • Thoughts and ideas for extensions
    • +
    • Conclusion, ideas for extensions, and other useful tidbits
    • Advanced Topics
        From gordonhenriksen at mac.com Sun Nov 4 20:05:37 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Mon, 05 Nov 2007 02:05:37 -0000 Subject: [llvm-commits] [llvm] r43696 - /llvm/trunk/docs/Passes.html Message-ID: <200711050205.lA525bbW018223@zion.cs.uiuc.edu> Author: gordon Date: Sun Nov 4 20:05:35 2007 New Revision: 43696 URL: http://llvm.org/viewvc/llvm-project?rev=43696&view=rev Log: Bringing Passes.html up-to-date with the deletion of the -emitbitcode option and the addition of -preverify. Modified: llvm/trunk/docs/Passes.html Modified: llvm/trunk/docs/Passes.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/Passes.html?rev=43696&r1=43695&r2=43696&view=diff ============================================================================== --- llvm/trunk/docs/Passes.html (original) +++ llvm/trunk/docs/Passes.html Sun Nov 4 20:05:35 2007 @@ -179,7 +179,7 @@ OptionName -deadarghaX0rDead Argument Hacking (BUGPOINT USE ONLY; DO NOT USE) -extract-blocksExtract Basic Blocks From Module (for bugpoint use) --emitbitcodeBitcode Writer +-preverifyPreliminary module verification -verifyModule Verifier -view-cfgView CFG of function -view-cfg-onlyView CFG of function (with no function bodies) @@ -1826,10 +1826,18 @@
        -

        Yet to be written.

        +

        + Ensures that the module is in the form required by the Module Verifier pass. +

        + +

        + Running the verifier runs this pass automatically, so there should be no need + to use it directly. +

        From bruno.cardoso at gmail.com Sun Nov 4 21:02:33 2007 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Mon, 05 Nov 2007 03:02:33 -0000 Subject: [llvm-commits] [llvm] r43697 - in /llvm/trunk/lib/Target/Mips: MipsAsmPrinter.cpp MipsISelDAGToDAG.cpp MipsISelLowering.cpp MipsISelLowering.h MipsInstrInfo.td MipsMachineFunction.h MipsRegisterInfo.cpp MipsRegisterInfo.h MipsTargetMachine.cpp Message-ID: <200711050302.lA532XAN020535@zion.cs.uiuc.edu> Author: bruno Date: Sun Nov 4 21:02:32 2007 New Revision: 43697 URL: http://llvm.org/viewvc/llvm-project?rev=43697&view=rev Log: Added support for PIC code with "explicit relocations" *only*. Removed all macro code for PIC (goodbye "la"). Support tested with shootout bench. Modified: llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp llvm/trunk/lib/Target/Mips/MipsISelLowering.h llvm/trunk/lib/Target/Mips/MipsInstrInfo.td llvm/trunk/lib/Target/Mips/MipsMachineFunction.h llvm/trunk/lib/Target/Mips/MipsRegisterInfo.cpp llvm/trunk/lib/Target/Mips/MipsRegisterInfo.h llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp Modified: llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp?rev=43697&r1=43696&r2=43697&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp Sun Nov 4 21:02:32 2007 @@ -250,7 +250,7 @@ emitMaskDirective(MF); emitFMaskDirective(MF); - if (MF.getTarget().getRelocationModel() == Reloc::Static) { + if (TM.getRelocationModel() == Reloc::Static) { emitSetDirective(NOREORDER); emitSetDirective(NOMACRO); } @@ -262,7 +262,7 @@ void MipsAsmPrinter:: emitFunctionEnd(MachineFunction &MF) { - if (MF.getTarget().getRelocationModel() == Reloc::Static) { + if (TM.getRelocationModel() == Reloc::Static) { emitSetDirective(MACRO); emitSetDirective(REORDER); } @@ -305,6 +305,9 @@ printInstruction(II); ++EmittedInsts; } + + // Each Basic Block is separated by a newline + O << '\n'; } // Emit function end directives @@ -319,17 +322,41 @@ { const MachineOperand &MO = MI->getOperand(opNum); const MRegisterInfo &RI = *TM.getRegisterInfo(); - bool closeP=false; - - // %hi and %lo used on mips gas to break large constants + bool closeP = false; + bool isPIC = (TM.getRelocationModel() == Reloc::PIC_); + bool isCodeLarge = (TM.getCodeModel() == CodeModel::Large); + + // %hi and %lo used on mips gas to load global addresses on + // static code. %got is used to load global addresses when + // using PIC_. %call16 is used to load direct call targets + // on PIC_ and small code size. %call_lo and %call_hi load + // direct call targets on PIC_ and large code size. if (MI->getOpcode() == Mips::LUi && !MO.isRegister() && !MO.isImmediate()) { - O << "%hi("; + if ((isPIC) && (isCodeLarge)) + O << "%call_hi("; + else + O << "%hi("; closeP = true; } else if ((MI->getOpcode() == Mips::ADDiu) && !MO.isRegister() && !MO.isImmediate()) { O << "%lo("; closeP = true; + } else if ((isPIC) && (MI->getOpcode() == Mips::LW) + && (!MO.isRegister()) && (!MO.isImmediate())) { + const MachineOperand &firstMO = MI->getOperand(opNum-1); + const MachineOperand &lastMO = MI->getOperand(opNum+1); + if ((firstMO.isRegister()) && (lastMO.isRegister())) { + if ((firstMO.getReg() == Mips::T9) && (lastMO.getReg() == Mips::GP) + && (!isCodeLarge)) + O << "%call16("; + else if ((firstMO.getReg() != Mips::T9) && (lastMO.getReg() == Mips::GP)) + O << "%got("; + else if ((firstMO.getReg() == Mips::T9) && (lastMO.getReg() != Mips::GP) + && (isCodeLarge)) + O << "%call_lo("; + closeP = true; + } } switch (MO.getType()) @@ -361,6 +388,7 @@ O << MO.getSymbolName(); break; + // FIXME: Verify correct case MachineOperand::MO_ConstantPoolIndex: O << TAI->getPrivateGlobalPrefix() << "CPI" << getFunctionNumber() << "_" << MO.getConstantPoolIndex(); @@ -385,7 +413,9 @@ return; } - // Load/Store memory operands -- imm($reg) + // Load/Store memory operands -- imm($reg) + // If PIC target the target is loaded as the + // pattern lw $25,%call16($28) printOperand(MI, opNum); O << "("; printOperand(MI, opNum+1); Modified: llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp?rev=43697&r1=43696&r2=43697&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp Sun Nov 4 21:02:32 2007 @@ -15,6 +15,7 @@ #include "Mips.h" #include "MipsISelLowering.h" +#include "MipsMachineFunction.h" #include "MipsRegisterInfo.h" #include "MipsSubtarget.h" #include "MipsTargetMachine.h" @@ -135,20 +136,24 @@ return true; } - // TargetExternalSymbol and TargetGlobalAddress are - // lowered and their addresses go into registers, so - // they should not be touched here. - if ((Addr.getOpcode() == ISD::TargetExternalSymbol || - Addr.getOpcode() == ISD::TargetGlobalAddress)) - return false; + // on PIC code Load GA + if (TM.getRelocationModel() == Reloc::PIC_) { + if (Addr.getOpcode() == ISD::TargetGlobalAddress) { + Base = CurDAG->getRegister(Mips::GP, MVT::i32); + Offset = Addr; + return true; + } + } else { + if ((Addr.getOpcode() == ISD::TargetExternalSymbol || + Addr.getOpcode() == ISD::TargetGlobalAddress)) + return false; + } // Operand is a result from an ADD. - if (Addr.getOpcode() == ISD::ADD) - { - if (ConstantSDNode *CN = dyn_cast(Addr.getOperand(1))) - { - if (Predicate_immSExt16(CN)) - { + if (Addr.getOpcode() == ISD::ADD) { + if (ConstantSDNode *CN = dyn_cast(Addr.getOperand(1))) { + if (Predicate_immSExt16(CN)) { + // If the first operand is a FI, get the TargetFI Node if (FrameIndexSDNode *FIN = dyn_cast (Addr.getOperand(0))) { @@ -247,6 +252,51 @@ SDOperand MFInFlag = SDOperand(RemNode, 0); return CurDAG->getTargetNode(Mips::MFHI, MVT::i32, MFInFlag); } + + /// Handle direct and indirect calls when using PIC. On PIC, when + /// GOT is smaller than about 64k (small code) the GA target is + /// loaded with only one instruction. Otherwise GA's target must + /// be loaded with 3 instructions. + case MipsISD::JmpLink: { + if (TM.getRelocationModel() == Reloc::PIC_) { + //bool isCodeLarge = (TM.getCodeModel() == CodeModel::Large); + SDOperand Chain = Node->getOperand(0); + SDOperand Callee = Node->getOperand(1); + AddToISelQueue(Chain); + SDOperand T9Reg = CurDAG->getRegister(Mips::T9, MVT::i32); + SDOperand InFlag(0, 0); + + if ( (isa(Callee)) || + (isa(Callee)) ) + { + /// Direct call for global addresses and external symbols + SDOperand GPReg = CurDAG->getRegister(Mips::GP, MVT::i32); + + // Use load to get GOT target + SDOperand Ops[] = { Callee, GPReg, Chain }; + SDOperand Load = SDOperand(CurDAG->getTargetNode(Mips::LW, MVT::i32, + MVT::Other, Ops, 3), 0); + Chain = Load.getValue(1); + AddToISelQueue(Chain); + + // Call target must be on T9 + Chain = CurDAG->getCopyToReg(Chain, T9Reg, Load, InFlag); + } else + /// Indirect call + Chain = CurDAG->getCopyToReg(Chain, T9Reg, Callee, InFlag); + + AddToISelQueue(Chain); + + // Emit Jump and Link Register + SDNode *ResNode = CurDAG->getTargetNode(Mips::JALR, MVT::Other, + MVT::Flag, T9Reg, Chain); + Chain = SDOperand(ResNode, 0); + InFlag = SDOperand(ResNode, 1); + ReplaceUses(SDOperand(Node, 0), Chain); + ReplaceUses(SDOperand(Node, 1), InFlag); + return ResNode; + } + } } // Select the default instruction Modified: llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp?rev=43697&r1=43696&r2=43697&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp Sun Nov 4 21:02:32 2007 @@ -39,13 +39,11 @@ { switch (Opcode) { - case MipsISD::JmpLink : return "MipsISD::JmpLink"; - case MipsISD::Hi : return "MipsISD::Hi"; - case MipsISD::Lo : return "MipsISD::Lo"; - case MipsISD::Ret : return "MipsISD::Ret"; - case MipsISD::Add : return "MipsISD::Add"; - case MipsISD::LoadAddr : return "MipsISD::LoadAddr"; - default : return NULL; + case MipsISD::JmpLink : return "MipsISD::JmpLink"; + case MipsISD::Hi : return "MipsISD::Hi"; + case MipsISD::Lo : return "MipsISD::Lo"; + case MipsISD::Ret : return "MipsISD::Ret"; + default : return NULL; } } @@ -149,21 +147,24 @@ { SDOperand ResNode; GlobalValue *GV = cast(Op)->getGlobal(); - SDOperand GA = DAG.getTargetGlobalAddress(GV, MVT::i32); + bool isPIC = (getTargetMachine().getRelocationModel() == Reloc::PIC_); - // On PIC code global addresses are loaded with "la" instruction - if (!(getTargetMachine().getRelocationModel() == Reloc::PIC_)) { - const MVT::ValueType *VTs = DAG.getNodeValueTypes(MVT::i32, MVT::Flag); + SDOperand HiPart; + if (!isPIC) { + const MVT::ValueType *VTs = DAG.getNodeValueTypes(MVT::i32); SDOperand Ops[] = { GA }; + HiPart = DAG.getNode(MipsISD::Hi, VTs, 1, Ops, 1); + } else // Emit Load from Global Pointer + HiPart = DAG.getLoad(MVT::i32, DAG.getEntryNode(), GA, NULL, 0); + + // On functions and global targets not internal linked only + // a load from got/GP is necessary for PIC to work. + if ((isPIC) && ((!GV->hasInternalLinkage()) || (isa(GV)))) + return HiPart; - SDOperand Hi = DAG.getNode(MipsISD::Hi, VTs, 2, Ops, 1); - SDOperand Lo = DAG.getNode(MipsISD::Lo, MVT::i32, GA); - - SDOperand InFlag = Hi.getValue(1); - ResNode = DAG.getNode(MipsISD::Add, MVT::i32, Lo, Hi, InFlag); - } else - ResNode = DAG.getNode(MipsISD::LoadAddr, MVT::i32, GA); + SDOperand Lo = DAG.getNode(MipsISD::Lo, MVT::i32, GA); + ResNode = DAG.getNode(ISD::ADD, MVT::i32, HiPart, Lo); return ResNode; } @@ -211,7 +212,7 @@ /// LowerCCCCallTo - functions arguments are copied from virtual /// regs to (physical regs)/(stack frame), CALLSEQ_START and /// CALLSEQ_END are emitted. -/// TODO: isVarArg, isTailCall, sret, GOT, linkage types. +/// TODO: isVarArg, isTailCall, sret. SDOperand MipsTargetLowering:: LowerCCCCallTo(SDOperand Op, SelectionDAG &DAG, unsigned CC) { @@ -244,7 +245,7 @@ SmallVector MemOpChains; SDOperand StackPtr; - unsigned LastStackLoc=0; + int LastStackLoc=0; // Walk the register/memloc assignments, inserting copies/loads. for (unsigned i = 0, e = ArgLocs.size(); i != e; ++i) { @@ -268,8 +269,8 @@ break; } - // Arguments that can be passed on register, - // must be kept at RegsToPass vector + // Arguments that can be passed on register must be kept at + // RegsToPass vector if (VA.isRegLoc()) { RegsToPass.push_back(std::make_pair(VA.getLocReg(), Arg)); } else { @@ -294,14 +295,6 @@ } } - // Create a stack location to hold GP when PIC is used - if (getTargetMachine().getRelocationModel() == Reloc::PIC_) { - LastStackLoc = (!LastStackLoc) ? (16) : (LastStackLoc+4); - MipsFunctionInfo *MipsFI = MF.getInfo(); - MFI->CreateFixedObject(4, LastStackLoc); - MipsFI->setGPStackOffset(LastStackLoc); - } - // Transform all store nodes into one single node because // all store nodes are independent of each other. if (!MemOpChains.empty()) @@ -321,13 +314,13 @@ // If the callee is a GlobalAddress/ExternalSymbol node (quite common, every // direct call is) turn it into a TargetGlobalAddress/TargetExternalSymbol - // node so that legalize doesn't hack it. Otherwise we have an indirect call, - // if PIC is used, the call must use register GP - if (GlobalAddressSDNode *G = dyn_cast(Callee)) + // node so that legalize doesn't hack it. + if (GlobalAddressSDNode *G = dyn_cast(Callee)) Callee = DAG.getTargetGlobalAddress(G->getGlobal(), getPointerTy()); else if (ExternalSymbolSDNode *S = dyn_cast(Callee)) Callee = DAG.getTargetExternalSymbol(S->getSymbol(), getPointerTy()); + // MipsJmpLink = #chain, #target_address, #opt_in_flags... // = Chain, Callee, Reg#1, Reg#2, ... // @@ -349,6 +342,37 @@ Chain = DAG.getNode(MipsISD::JmpLink, NodeTys, &Ops[0], Ops.size()); InFlag = Chain.getValue(1); + // Create a stack location to hold GP when PIC is used. This stack + // location is used on function prologue to save GP and also after all + // emited CALL's to restore GP. + if (getTargetMachine().getRelocationModel() == Reloc::PIC_) { + + // Function can have an arbitrary number of calls, so + // hold the LastStackLoc with the biggest offset. + int FI; + MipsFunctionInfo *MipsFI = MF.getInfo(); + if (LastStackLoc >= MipsFI->getGPStackOffset()) { + + LastStackLoc = (!LastStackLoc) ? (16) : (LastStackLoc+4); + // Create the frame index only once. SPOffset here can be anything + // (this will be fixed on processFunctionBeforeFrameFinalized) + if (MipsFI->getGPStackOffset() == -1) { + FI = MFI->CreateFixedObject(4, 0); + MipsFI->setGPFI(FI); + } + MipsFI->setGPStackOffset(LastStackLoc); + } + + + // Reload GP value. + FI = MipsFI->getGPFI(); + SDOperand FIN = DAG.getFrameIndex(FI,getPointerTy()); + SDOperand GPLoad = DAG.getLoad(MVT::i32, Chain, FIN, NULL, 0); + Chain = GPLoad.getValue(1); + Chain = DAG.getCopyToReg(Chain, DAG.getRegister(Mips::GP, MVT::i32), + GPLoad, SDOperand(0,0)); + } + // Create the CALLSEQ_END node. NodeTys = DAG.getVTList(MVT::Other, MVT::Flag); Ops.clear(); @@ -389,10 +413,11 @@ ResultVals.push_back(Chain.getValue(0)); } - // Merge everything together with a MERGE_VALUES node. ResultVals.push_back(Chain); + + // Merge everything together with a MERGE_VALUES node. return DAG.getNode(ISD::MERGE_VALUES, TheCall->getVTList(), - &ResultVals[0], ResultVals.size()).Val; + &ResultVals[0], ResultVals.size()).Val; } //===----------------------------------------------------------------------===// Modified: llvm/trunk/lib/Target/Mips/MipsISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelLowering.h?rev=43697&r1=43696&r2=43697&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsISelLowering.h (original) +++ llvm/trunk/lib/Target/Mips/MipsISelLowering.h Sun Nov 4 21:02:32 2007 @@ -38,13 +38,7 @@ Lo, // Return - Ret, - - // Need to support addition with a input flag - Add, - - // Used on PIC Code to load global addresses - LoadAddr + Ret }; } Modified: llvm/trunk/lib/Target/Mips/MipsInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsInstrInfo.td?rev=43697&r1=43696&r2=43697&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsInstrInfo.td (original) +++ llvm/trunk/lib/Target/Mips/MipsInstrInfo.td Sun Nov 4 21:02:32 2007 @@ -22,20 +22,11 @@ def MipsJmpLink : SDNode<"MipsISD::JmpLink",SDT_MipsJmpLink, [SDNPHasChain, SDNPOutFlag]>; -// Hi and Lo nodes are created to let easy manipulation of 16-bit when -// handling 32-bit immediates. They are used on MipsISelLowering to -// lower stuff like GlobalAddress, ExternalSymbol, ... on static model -// This two nodes have nothing to do with Mips Registers Hi and Lo. -def MipsHi : SDNode<"MipsISD::Hi", SDTIntUnaryOp, [SDNPOutFlag]>; -def MipsLo : SDNode<"MipsISD::Lo", SDTIntUnaryOp>; - -// Necessary to generate glued instructions when loading GlobalAddress -// into registers. -def MipsAdd : SDNode<"MipsISD::Add", SDTIntBinOp, [SDNPCommutative, - SDNPAssociative, SDNPOptInFlag]>; - -// Used to Load Addresses on PIC code. -def MipsLoadAddr: SDNode<"MipsISD::LoadAddr", SDTIntUnaryOp>; +// Hi and Lo nodes are used to handle global addresses. Used on +// MipsISelLowering to lower stuff like GlobalAddress, ExternalSymbol +// static model. (nothing to do with Mips Registers Hi and Lo) +def MipsHi : SDNode<"MipsISD::Hi", SDTIntUnaryOp, [SDNPOutFlag]>; +def MipsLo : SDNode<"MipsISD::Lo", SDTIntUnaryOp>; // Return def SDT_MipsRet : SDTypeProfile<0, 1, [SDTCisInt<0>]>; @@ -371,15 +362,9 @@ // are used, we have the same behavior, but get also a bunch of warnings // from the assembler. def CPLOAD: PseudoInstMips<(outs), (ins CPURegs:$reg), - ".set noreorder\n\t.cpload $reg\n\t.set reorder", []>; + ".set noreorder\n\t.cpload $reg\n\t.set reorder\n", []>; def CPRESTORE: PseudoInstMips<(outs), (ins uimm16:$loc), - ".cprestore $loc", []>; - -// Used on PIC code only, it loads the address of label into register reg. The -// address is calculated from the global pointer ($gp) and is expanded by the -// assembler into two instructions "lw" and "addiu". -def LA: PseudoInstMips<(outs CPURegs:$dst), (ins addrlabel:$label), - "la $dst, $label", []>; + ".cprestore $loc\n", []>; //===----------------------------------------------------------------------===// // Instruction definition @@ -393,17 +378,13 @@ // ADDiu just accept 16-bit immediates but we handle this on Pat's. // immZExt32 is used here so it can match GlobalAddress immediates. -def ADDiu : ArithI<0x09, "addiu", MipsAdd, uimm16, immZExt16>; +def ADDiu : ArithI<0x09, "addiu", add, uimm16, immZExt16>; def ADDi : ArithI<0x08, "addi", add, simm16, immSExt16>; def MUL : ArithR<0x1c, 0x02, "mul", mul, IIImul>; def ADDu : ArithR<0x00, 0x21, "addu", add, IIAlu>; def SUBu : ArithR<0x00, 0x23, "subu", sub, IIAlu>; def ADD : ArithOverflowR<0x00, 0x20, "add">; def SUB : ArithOverflowR<0x00, 0x22, "sub">; -def MADD : MArithR<0x00, "madd">; -def MADDU : MArithR<0x01, "maddu">; -def MSUB : MArithR<0x04, "msub">; -def MSUBU : MArithR<0x05, "msubu">; // Logical def AND : LogicR<0x24, "and", and>; @@ -481,10 +462,16 @@ // Count Leading // CLO/CLZ are part of the newer MIPS32(tm) instruction // set and not older Mips I keep this for future use -// though. +// though. //def CLO : CountLeading<0x21, "clo">; //def CLZ : CountLeading<0x20, "clz">; +// MADD*/MSUB* are not part of MipsI either. +//def MADD : MArithR<0x00, "madd">; +//def MADDU : MArithR<0x01, "maddu">; +//def MSUB : MArithR<0x04, "msub">; +//def MSUBU : MArithR<0x05, "msubu">; + // No operation let addr=0 in def NOP : FJ<0, (outs), (ins), "nop", [], IIAlu>; @@ -529,9 +516,8 @@ // GlobalAddress, Constant Pool, ExternalSymbol, and JumpTable def : Pat<(MipsHi tglobaladdr:$in), (LUi tglobaladdr:$in)>; def : Pat<(MipsLo tglobaladdr:$in), (ADDiu ZERO, tglobaladdr:$in)>; -def : Pat<(MipsAdd CPURegs:$hi, (MipsLo tglobaladdr:$lo)), +def : Pat<(add CPURegs:$hi, (MipsLo tglobaladdr:$lo)), (ADDiu CPURegs:$hi, tglobaladdr:$lo)>; -def : Pat<(MipsLoadAddr tglobaladdr:$in), (LA tglobaladdr:$in)>; // Mips does not have not, so we increase the operation def : Pat<(not CPURegs:$in), @@ -544,6 +530,9 @@ def : Pat<(truncstorei1 CPURegs:$src, addr:$addr), (SB CPURegs:$src, addr:$addr)>; +// some peepholes +def : Pat<(store (i32 0), addr:$dst), (SW ZERO, addr:$dst)>; + /// /// brcond patterns /// Modified: llvm/trunk/lib/Target/Mips/MipsMachineFunction.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsMachineFunction.h?rev=43697&r1=43696&r2=43697&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsMachineFunction.h (original) +++ llvm/trunk/lib/Target/Mips/MipsMachineFunction.h Sun Nov 4 21:02:32 2007 @@ -33,11 +33,6 @@ /// the Return Address must be saved int RAStackOffset; - /// When PIC is used the GP must be saved on the stack - /// on the function prologue, so a reference to its stack - /// location must be kept. - int GPStackOffset; - /// MipsFIHolder - Holds a FrameIndex and it's Stack Pointer Offset struct MipsFIHolder { @@ -48,6 +43,13 @@ : FI(FrameIndex), SPOffset(StackPointerOffset) {} }; + /// When PIC is used the GP must be saved on the stack + /// on the function prologue and must be reloaded from this + /// stack location after every call. A reference to its stack + /// location and frame index must be kept to be used on + /// emitPrologue and processFunctionBeforeFrameFinalized. + MipsFIHolder GPHolder; + // On LowerFORMAL_ARGUMENTS the stack size is unknown, // so the Stack Pointer Offset calculation of "not in // register arguments" must be postponed to emitPrologue. @@ -64,7 +66,7 @@ public: MipsFunctionInfo(MachineFunction& MF) - : FPStackOffset(0), RAStackOffset(0), + : FPStackOffset(0), RAStackOffset(0), GPHolder(-1,-1), HasLoadArgs(false), HasStoreVarArgs(false) {} @@ -74,8 +76,10 @@ int getRAStackOffset() const { return RAStackOffset; } void setRAStackOffset(int Off) { RAStackOffset = Off; } - int getGPStackOffset() const { return GPStackOffset; } - void setGPStackOffset(int Off) { GPStackOffset = Off; } + int getGPStackOffset() const { return GPHolder.SPOffset; } + int getGPFI() const { return GPHolder.FI; } + void setGPStackOffset(int Off) { GPHolder.SPOffset = Off; } + void setGPFI(int FI) { GPHolder.FI = FI; } int getTopSavedRegOffset() const { return (RAStackOffset > FPStackOffset) ? Modified: llvm/trunk/lib/Target/Mips/MipsRegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsRegisterInfo.cpp?rev=43697&r1=43696&r2=43697&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsRegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsRegisterInfo.cpp Sun Nov 4 21:02:32 2007 @@ -203,6 +203,12 @@ return NewMI; } +MachineInstr *MipsRegisterInfo:: +foldMemoryOperand(MachineInstr* MI, unsigned OpNum, + MachineInstr* LoadMI) const { + return NULL; +} + //===----------------------------------------------------------------------===// // // Callee Saved Registers methods @@ -325,7 +331,7 @@ eliminateFrameIndex(MachineBasicBlock::iterator II, int SPAdj, RegScavenger *RS) const { - MachineInstr &MI = *II; + MachineInstr &MI = *II; MachineFunction &MF = *MI.getParent()->getParent(); unsigned i = 0; @@ -359,7 +365,7 @@ #endif MI.getOperand(i-1).ChangeToImmediate(Offset); - MI.getOperand(i).ChangeToRegister(getFrameRegister(MF),false); + MI.getOperand(i).ChangeToRegister(getFrameRegister(MF), false); } void MipsRegisterInfo:: @@ -453,7 +459,6 @@ if ((isPIC) && (MFI->hasCalls())) BuildMI(MBB, MBBI, TII.get(Mips::CPRESTORE)) .addImm(MipsFI->getGPStackOffset()); - } void MipsRegisterInfo:: @@ -498,6 +503,17 @@ void MipsRegisterInfo:: processFunctionBeforeFrameFinalized(MachineFunction &MF) const { + // Set the SPOffset on the FI where GP must be saved/loaded. + MachineFrameInfo *MFI = MF.getFrameInfo(); + if (MFI->hasCalls()) { + MipsFunctionInfo *MipsFI = MF.getInfo(); + #ifndef NDEBUG + DOUT << "processFunctionBeforeFrameFinalized\n"; + DOUT << "GPOffset :" << MipsFI->getGPStackOffset() << "\n"; + DOUT << "FI :" << MipsFI->getGPFI() << "\n"; + #endif + MFI->setObjectOffset(MipsFI->getGPFI(), MipsFI->getGPStackOffset()); + } } unsigned MipsRegisterInfo:: Modified: llvm/trunk/lib/Target/Mips/MipsRegisterInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsRegisterInfo.h?rev=43697&r1=43696&r2=43697&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsRegisterInfo.h (original) +++ llvm/trunk/lib/Target/Mips/MipsRegisterInfo.h Sun Nov 4 21:02:32 2007 @@ -59,9 +59,7 @@ int FrameIndex) const; MachineInstr* foldMemoryOperand(MachineInstr* MI, unsigned OpNum, - MachineInstr* LoadMI) const { - return 0; - } + MachineInstr* LoadMI) const; void copyRegToReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, unsigned DestReg, unsigned SrcReg, Modified: llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp?rev=43697&r1=43696&r2=43697&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp Sun Nov 4 21:02:32 2007 @@ -35,6 +35,9 @@ // On function prologue, the stack is created by decrementing // its pointer. Once decremented, all references are done with positive // offset from the stack/frame pointer, so StackGrowsUp is used. +// When using CodeModel::Large the behaviour +// +// MipsTargetMachine:: MipsTargetMachine(const Module &M, const std::string &FS): Subtarget(*this, M, FS), DataLayout("E-p:32:32:32"), @@ -43,6 +46,8 @@ { if (getRelocationModel() != Reloc::Static) setRelocationModel(Reloc::PIC_); + if (getCodeModel() == CodeModel::Default) + setCodeModel(CodeModel::Small); } // return 0 and must specify -march to gen MIPS code. From evan.cheng at apple.com Sun Nov 4 21:04:27 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 05 Nov 2007 03:04:27 -0000 Subject: [llvm-commits] [llvm] r43698 - /llvm/trunk/test/CodeGen/X86/x86-64-mem.ll Message-ID: <200711050304.lA534RcZ020597@zion.cs.uiuc.edu> Author: evancheng Date: Sun Nov 4 21:04:26 2007 New Revision: 43698 URL: http://llvm.org/viewvc/llvm-project?rev=43698&view=rev Log: Fix test case. Chris didn't do make check. :-) Modified: llvm/trunk/test/CodeGen/X86/x86-64-mem.ll Modified: llvm/trunk/test/CodeGen/X86/x86-64-mem.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/x86-64-mem.ll?rev=43698&r1=43697&r2=43698&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/x86-64-mem.ll (original) +++ llvm/trunk/test/CodeGen/X86/x86-64-mem.ll Sun Nov 4 21:04:26 2007 @@ -1,38 +1,37 @@ -; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=x86_64-apple-darwin -o %t1 -f +; RUN: llvm-as < %s | llc -mtriple=x86_64-apple-darwin -o %t1 -f ; RUN: grep GOTPCREL %t1 | count 4 ; RUN: grep rip %t1 | count 6 ; RUN: grep movq %t1 | count 6 ; RUN: grep leaq %t1 | count 1 -; RUN: llvm-upgrade < %s | llvm-as | \ +; RUN: llvm-as < %s | \ ; RUN: llc -mtriple=x86_64-pc-linux -relocation-model=static -o %t2 -f -; RUN: grep rip %t2 | count 4 ; RUN: grep movl %t2 | count 2 ; RUN: grep movq %t2 | count 2 -%ptr = external global int* -%src = external global [0 x int] -%dst = external global [0 x int] -%lptr = internal global int* null -%ldst = internal global [500 x int] zeroinitializer, align 32 -%lsrc = internal global [500 x int] zeroinitializer, align 32 -%bsrc = internal global [500000 x int] zeroinitializer, align 32 -%bdst = internal global [500000 x int] zeroinitializer, align 32 + at ptr = external global i32* ; [#uses=1] + at src = external global [0 x i32] ; <[0 x i32]*> [#uses=1] + at dst = external global [0 x i32] ; <[0 x i32]*> [#uses=1] + at lptr = internal global i32* null ; [#uses=1] + at ldst = internal global [500 x i32] zeroinitializer, align 32 ; <[500 x i32]*> [#uses=1] + at lsrc = internal global [500 x i32] zeroinitializer, align 32 ; <[500 x i32]*> [#uses=0] + at bsrc = internal global [500000 x i32] zeroinitializer, align 32 ; <[500000 x i32]*> [#uses=0] + at bdst = internal global [500000 x i32] zeroinitializer, align 32 ; <[500000 x i32]*> [#uses=0] -void %test1() { - %tmp = load int* getelementptr ([0 x int]* %src, int 0, int 0) - store int %tmp, int* getelementptr ([0 x int]* %dst, int 0, int 0) +define void @test1() { + %tmp = load i32* getelementptr ([0 x i32]* @src, i32 0, i32 0) ; [#uses=1] + store i32 %tmp, i32* getelementptr ([0 x i32]* @dst, i32 0, i32 0) ret void } -void %test2() { - store int* getelementptr ([0 x int]* %dst, int 0, int 0), int** %ptr +define void @test2() { + store i32* getelementptr ([0 x i32]* @dst, i32 0, i32 0), i32** @ptr ret void } -void %test3() { - store int* getelementptr ([500 x int]* %ldst, int 0, int 0), int** %lptr +define void @test3() { + store i32* getelementptr ([500 x i32]* @ldst, i32 0, i32 0), i32** @lptr br label %return -return: +return: ; preds = %0 ret void } From evan.cheng at apple.com Sun Nov 4 21:11:55 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 05 Nov 2007 03:11:55 -0000 Subject: [llvm-commits] [llvm] r43699 - in /llvm/trunk: lib/CodeGen/LiveVariables.cpp test/CodeGen/X86/2007-11-04-LiveVariablesBug.ll Message-ID: <200711050311.lA53BtZI020908@zion.cs.uiuc.edu> Author: evancheng Date: Sun Nov 4 21:11:55 2007 New Revision: 43699 URL: http://llvm.org/viewvc/llvm-project?rev=43699&view=rev Log: Handle cases where a register and one of its super-register are both marked as defined on the same instruction. This fixes PR1767. Added: llvm/trunk/test/CodeGen/X86/2007-11-04-LiveVariablesBug.ll Modified: llvm/trunk/lib/CodeGen/LiveVariables.cpp Modified: llvm/trunk/lib/CodeGen/LiveVariables.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveVariables.cpp?rev=43699&r1=43698&r2=43699&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveVariables.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveVariables.cpp Sun Nov 4 21:11:55 2007 @@ -203,7 +203,7 @@ RegInfo->isSuperRegister(IncomingReg, Reg) && MO.isKill()) // A super-register kill already exists. - return true; + Found = true; } } @@ -357,7 +357,9 @@ } else if (PhysRegPartUse[Reg]) // Add implicit use / kill to last partial use. addRegisterKilled(Reg, PhysRegPartUse[Reg], true); - else + else if (LastRef != MI) + // Defined, but not used. However, watch out for cases where a super-reg + // is also defined on the same MI. addRegisterDead(Reg, LastRef); } Added: llvm/trunk/test/CodeGen/X86/2007-11-04-LiveVariablesBug.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2007-11-04-LiveVariablesBug.ll?rev=43699&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/2007-11-04-LiveVariablesBug.ll (added) +++ llvm/trunk/test/CodeGen/X86/2007-11-04-LiveVariablesBug.ll Sun Nov 4 21:11:55 2007 @@ -0,0 +1,16 @@ +; RUN: llvm-as < %s | llc -mtriple=x86_64-unknown-linux-gnu +; PR1767 + +define void @xor_sse_2(i64 %bytes, i64* %p1, i64* %p2) { +entry: + %p2_addr = alloca i64* ; [#uses=2] + %lines = alloca i32 ; [#uses=2] + store i64* %p2, i64** %p2_addr, align 8 + %tmp1 = lshr i64 %bytes, 8 ; [#uses=1] + %tmp12 = trunc i64 %tmp1 to i32 ; [#uses=2] + store i32 %tmp12, i32* %lines, align 4 + %tmp6 = call i64* asm sideeffect "foo", +"=r,=*r,=*r,r,0,1,2,~{dirflag},~{fpsr},~{flags},~{memory}"( i64** %p2_addr, +i32* %lines, i64 256, i64* %p1, i64* %p2, i32 %tmp12 ) ; [#uses=0] + ret void +}