From jeffc at jolt-lang.org Mon Jan 3 10:34:30 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Mon, 3 Jan 2005 10:34:30 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86TargetMachine.cpp Message-ID: <200501031634.KAA00322@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86TargetMachine.cpp updated: 1.73 -> 1.74 --- Log message: Revert elimination of global variable hack... still needed. --- Diffs of the changes: (+7 -0) Index: llvm/lib/Target/X86/X86TargetMachine.cpp diff -u llvm/lib/Target/X86/X86TargetMachine.cpp:1.73 llvm/lib/Target/X86/X86TargetMachine.cpp:1.74 --- llvm/lib/Target/X86/X86TargetMachine.cpp:1.73 Sat Jan 1 22:23:12 2005 +++ llvm/lib/Target/X86/X86TargetMachine.cpp Mon Jan 3 10:34:19 2005 @@ -27,6 +27,13 @@ X86VectorEnum llvm::X86Vector = NoSSE; +/// X86TargetMachineModule - Note that this is used on hosts that cannot link +/// in a library unless there are references into the library. In particular, +/// it seems that it is not possible to get things to work on Win32 without +/// this. Though it is unused, do not remove it. +extern "C" int X86TargetMachineModule; +int X86TargetMachineModule = 0; + namespace { cl::opt NoSSAPeephole("disable-ssa-peephole", cl::init(true), cl::desc("Disable the ssa-based peephole optimizer " From jeffc at jolt-lang.org Mon Jan 3 10:37:27 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Mon, 3 Jan 2005 10:37:27 -0600 Subject: [llvm-commits] CVS: llvm/win32/CodeGen/CodeGen.vcproj Message-ID: <200501031637.KAA00349@zion.cs.uiuc.edu> Changes in directory llvm/win32/CodeGen: CodeGen.vcproj updated: 1.6 -> 1.7 --- Log message: Add additional header file to VS project. Patch submitted by Morten. --- Diffs of the changes: (+3 -0) Index: llvm/win32/CodeGen/CodeGen.vcproj diff -u llvm/win32/CodeGen/CodeGen.vcproj:1.6 llvm/win32/CodeGen/CodeGen.vcproj:1.7 --- llvm/win32/CodeGen/CodeGen.vcproj:1.6 Sat Dec 18 20:29:00 2004 +++ llvm/win32/CodeGen/CodeGen.vcproj Mon Jan 3 10:37:16 2005 @@ -214,6 +214,9 @@ RelativePath="..\..\include\llvm\CodeGen\MachineInstrBuilder.h"> + + Changes in directory llvm: Makefile.rules updated: 1.285 -> 1.286 --- Log message: Joining the quote fray... Reverting the quote patch. For some reason, this breaks the building of llvm/runtime (the shell doesn't like it for some reason). I might play with it to see if I can get the quotes done in such a way that the shell like it, but no promises. --- Diffs of the changes: (+2 -2) Index: llvm/Makefile.rules diff -u llvm/Makefile.rules:1.285 llvm/Makefile.rules:1.286 --- llvm/Makefile.rules:1.285 Sun Jan 2 22:04:54 2005 +++ llvm/Makefile.rules Mon Jan 3 11:41:56 2005 @@ -257,8 +257,8 @@ ifndef LOPT LOPT := $(LLVMToolDir)/opt$(EXEEXT) endif -LLVMGCCWITHPATH := "PATH=$(LLVMToolDir):$(PATH)" $(LLVMGCC) -LLVMGXXWITHPATH := "PATH=$(LLVMToolDir):$(PATH)" $(LLVMGXX) +LLVMGCCWITHPATH := PATH=$(LLVMToolDir):$(PATH) $(LLVMGCC) +LLVMGXXWITHPATH := PATH=$(LLVMToolDir):$(PATH) $(LLVMGXX) #-------------------------------------------------------------------- # Adjust to user's request From criswell at cs.uiuc.edu Mon Jan 3 11:43:11 2005 From: criswell at cs.uiuc.edu (John Criswell) Date: Mon, 3 Jan 2005 11:43:11 -0600 Subject: [llvm-commits] CVS: llvm/Makefile.rules Message-ID: <200501031743.LAA22381@choi.cs.uiuc.edu> Changes in directory llvm: Makefile.rules updated: 1.286 -> 1.287 --- Log message: Quote the paths and not the assignment of the PATH variable. This seems to make things happier. --- Diffs of the changes: (+2 -2) Index: llvm/Makefile.rules diff -u llvm/Makefile.rules:1.286 llvm/Makefile.rules:1.287 --- llvm/Makefile.rules:1.286 Mon Jan 3 11:41:56 2005 +++ llvm/Makefile.rules Mon Jan 3 11:42:57 2005 @@ -257,8 +257,8 @@ ifndef LOPT LOPT := $(LLVMToolDir)/opt$(EXEEXT) endif -LLVMGCCWITHPATH := PATH=$(LLVMToolDir):$(PATH) $(LLVMGCC) -LLVMGXXWITHPATH := PATH=$(LLVMToolDir):$(PATH) $(LLVMGXX) +LLVMGCCWITHPATH := PATH="$(LLVMToolDir):$(PATH)" $(LLVMGCC) +LLVMGXXWITHPATH := PATH="$(LLVMToolDir):$(PATH)" $(LLVMGXX) #-------------------------------------------------------------------- # Adjust to user's request From lattner at cs.uiuc.edu Mon Jan 3 16:01:37 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 3 Jan 2005 16:01:37 -0600 Subject: [llvm-commits] CVS: llvm-gcc/gcc/c-common.c Message-ID: <200501032201.j03M1bwd010445@apoc.cs.uiuc.edu> Changes in directory llvm-gcc/gcc: c-common.c updated: 1.3 -> 1.4 --- Log message: Fix an infinite loop in my change to c-typeck.c --- Diffs of the changes: (+4 -1) Index: llvm-gcc/gcc/c-common.c diff -u llvm-gcc/gcc/c-common.c:1.3 llvm-gcc/gcc/c-common.c:1.4 --- llvm-gcc/gcc/c-common.c:1.3 Thu Feb 5 10:05:44 2004 +++ llvm-gcc/gcc/c-common.c Mon Jan 3 16:01:22 2005 @@ -44,6 +44,9 @@ #include "toplev.h" #include "llvm-out.h" +struct initializer_stack; +extern struct initializer_stack *initializer_stack; + cpp_reader *parse_in; /* Declared in c-pragma.h. */ /* We let tm.h override the types used here, to handle trivial differences @@ -2562,7 +2565,7 @@ TREE_UNSIGNED (sizetype)), intop); /* Don't create an ARRAY_REF if this is a potentially a static initializer. */ - if (EMIT_LLVM && (!TREE_CONSTANT (ptrop) || !TREE_CONSTANT(intop))) { + if (EMIT_LLVM && !initializer_stack) { /* In LLVM we really want to represent this as &P[i], not as P+i*sizeof(*P) */ tree arrayref; From lattner at cs.uiuc.edu Mon Jan 3 16:03:28 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 3 Jan 2005 16:03:28 -0600 Subject: [llvm-commits] CVS: llvm-gcc/gcc/c-common.c Message-ID: <200501032203.j03M3SR5011155@apoc.cs.uiuc.edu> Changes in directory llvm-gcc/gcc: c-common.c updated: 1.4 -> 1.5 --- Log message: Disable this code entirely for now. --- Diffs of the changes: (+1 -1) Index: llvm-gcc/gcc/c-common.c diff -u llvm-gcc/gcc/c-common.c:1.4 llvm-gcc/gcc/c-common.c:1.5 --- llvm-gcc/gcc/c-common.c:1.4 Mon Jan 3 16:01:22 2005 +++ llvm-gcc/gcc/c-common.c Mon Jan 3 16:03:15 2005 @@ -2565,7 +2565,7 @@ TREE_UNSIGNED (sizetype)), intop); /* Don't create an ARRAY_REF if this is a potentially a static initializer. */ - if (EMIT_LLVM && !initializer_stack) { + if (0 && EMIT_LLVM) { /* In LLVM we really want to represent this as &P[i], not as P+i*sizeof(*P) */ tree arrayref; From lattner at cs.uiuc.edu Mon Jan 3 16:13:31 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 3 Jan 2005 16:13:31 -0600 Subject: [llvm-commits] CVS: llvm-gcc/gcc/c-typeck.c c-common.c Message-ID: <200501032213.j03MDVcZ012062@apoc.cs.uiuc.edu> Changes in directory llvm-gcc/gcc: c-typeck.c updated: 1.4 -> 1.5 c-common.c updated: 1.5 -> 1.6 --- Log message: Fix this more correctly, restoring our creation of a getelementptr for pointer arithmetic. --- Diffs of the changes: (+8 -7) Index: llvm-gcc/gcc/c-typeck.c diff -u llvm-gcc/gcc/c-typeck.c:1.4 llvm-gcc/gcc/c-typeck.c:1.5 --- llvm-gcc/gcc/c-typeck.c:1.4 Sun Jan 2 22:17:21 2005 +++ llvm-gcc/gcc/c-typeck.c Mon Jan 3 16:13:16 2005 @@ -46,8 +46,7 @@ #include "target.h" #include "llvm-out.h" -struct initializer_stack; -extern struct initializer_stack *initializer_stack; +extern int parsing_initializer; /* Nonzero if we've already printed a "missing braces around initializer" message within this initializer. */ @@ -2418,7 +2417,7 @@ /* DON'T fold this, unless its a constant expression which might * initialize a global. */ - if (!EMIT_LLVM || initializer_stack) + if (!EMIT_LLVM || parsing_initializer) return build_binary_op (PLUS_EXPR, TREE_OPERAND (arg, 0), TREE_OPERAND (arg, 1), 1); } @@ -2469,7 +2468,7 @@ return error_mark_node; } - if (EMIT_LLVM && !initializer_stack) { + if (EMIT_LLVM && !parsing_initializer) { /* For LLVM, don't fold pointer arithmetic unless doing so * produces a constant! */ @@ -4348,6 +4347,8 @@ if (asmspec_tree) asmspec = TREE_STRING_POINTER (asmspec_tree); + ++parsing_initializer; + p->decl = constructor_decl; p->asmspec = constructor_asmspec; p->require_constant_value = require_constant_value; @@ -4430,6 +4431,7 @@ constructor_top_level = p->top_level; initializer_stack = p->next; free (p); + --parsing_initializer; } /* Call here when we see the initializer is surrounded by braces. Index: llvm-gcc/gcc/c-common.c diff -u llvm-gcc/gcc/c-common.c:1.5 llvm-gcc/gcc/c-common.c:1.6 --- llvm-gcc/gcc/c-common.c:1.5 Mon Jan 3 16:03:15 2005 +++ llvm-gcc/gcc/c-common.c Mon Jan 3 16:13:16 2005 @@ -44,8 +44,7 @@ #include "toplev.h" #include "llvm-out.h" -struct initializer_stack; -extern struct initializer_stack *initializer_stack; +int parsing_initializer = 0; cpp_reader *parse_in; /* Declared in c-pragma.h. */ @@ -2565,7 +2564,7 @@ TREE_UNSIGNED (sizetype)), intop); /* Don't create an ARRAY_REF if this is a potentially a static initializer. */ - if (0 && EMIT_LLVM) { + if (EMIT_LLVM && !parsing_initializer) { /* In LLVM we really want to represent this as &P[i], not as P+i*sizeof(*P) */ tree arrayref; From lattner at cs.uiuc.edu Mon Jan 3 16:26:52 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 3 Jan 2005 16:26:52 -0600 Subject: [llvm-commits] CVS: llvm/test/TestRunner.sh Message-ID: <200501032226.j03MQqZp012682@apoc.cs.uiuc.edu> Changes in directory llvm/test: TestRunner.sh updated: 1.8 -> 1.9 --- Log message: Fix this script to work with hyphenated llvm-gcc and friend. --- Diffs of the changes: (+1 -1) Index: llvm/test/TestRunner.sh diff -u llvm/test/TestRunner.sh:1.8 llvm/test/TestRunner.sh:1.9 --- llvm/test/TestRunner.sh:1.8 Sat Nov 27 14:31:14 2004 +++ llvm/test/TestRunner.sh Mon Jan 3 16:26:38 2005 @@ -30,7 +30,7 @@ ulimit -t 40 SCRIPT=$OUTPUT.script -grep 'RUN:' $FILENAME | sed "s|^.*RUN:\(.*\)$|\1|g;s|%s|$SUBST|g;s|%llvmgcc|llvmgcc|g;s|%llvmgxx|llvmg++|g" > $SCRIPT +grep 'RUN:' $FILENAME | sed "s|^.*RUN:\(.*\)$|\1|g;s|%s|$SUBST|g;s|%llvmgcc|llvm-gcc|g;s|%llvmgxx|llvm-g++|g" > $SCRIPT /bin/sh $SCRIPT > $OUTPUT 2>&1 || ( From lattner at cs.uiuc.edu Mon Jan 3 16:28:10 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 3 Jan 2005 16:28:10 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/C++Frontend/2005-01-03-StaticInitializers.cpp Message-ID: <200501032228.j03MSA4T014031@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/C++Frontend: 2005-01-03-StaticInitializers.cpp added (r1.1) --- Log message: Add a testcase to check that initializer that CAN be evaluated statically ARE. These used to result in dynamic initializations. --- Diffs of the changes: (+8 -0) Index: llvm/test/Regression/C++Frontend/2005-01-03-StaticInitializers.cpp diff -c /dev/null llvm/test/Regression/C++Frontend/2005-01-03-StaticInitializers.cpp:1.1 *** /dev/null Mon Jan 3 16:28:08 2005 --- llvm/test/Regression/C++Frontend/2005-01-03-StaticInitializers.cpp Mon Jan 3 16:27:58 2005 *************** *** 0 **** --- 1,8 ---- + // RUN: %llvmgxx %s -S -o - | grep '%XX = global int 4' + + struct S { + int A[2]; + }; + + int XX = (int)&(((struct S*)0)->A[1]); + From lattner at cs.uiuc.edu Mon Jan 3 16:29:29 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 3 Jan 2005 16:29:29 -0600 Subject: [llvm-commits] CVS: llvm-gcc/gcc/cp/parser.c typeck.c Message-ID: <200501032229.j03MTTba015152@apoc.cs.uiuc.edu> Changes in directory llvm-gcc/gcc/cp: parser.c updated: 1.2 -> 1.3 typeck.c updated: 1.3 -> 1.4 --- Log message: Do not form array expressions if we are parsing an initializer. GCC cannot handle array expressions as constants, which results in these causing runtime initialization of initializers instead of compile time initialization in some cases. This fixes C++Frontend/2005-01-03-StaticInitializers.cpp --- Diffs of the changes: (+12 -12) Index: llvm-gcc/gcc/cp/parser.c diff -u llvm-gcc/gcc/cp/parser.c:1.2 llvm-gcc/gcc/cp/parser.c:1.3 --- llvm-gcc/gcc/cp/parser.c:1.2 Sat Nov 27 19:23:05 2004 +++ llvm-gcc/gcc/cp/parser.c Mon Jan 3 16:29:14 2005 @@ -10878,7 +10878,7 @@ set to FALSE if there is no initializer present. If there is an initializer, and it is not a constant-expression, *NON_CONSTANT_P is set to true; otherwise it is set to false. */ - +extern int parsing_initializer; static tree cp_parser_initializer (cp_parser* parser, bool* is_parenthesized_init, bool* non_constant_p) @@ -10895,6 +10895,8 @@ /* Assume that the initializer is constant. */ *non_constant_p = false; + ++parsing_initializer; + if (token->type == CPP_EQ) { /* Consume the `='. */ @@ -10912,6 +10914,7 @@ init = error_mark_node; } + --parsing_initializer; return init; } Index: llvm-gcc/gcc/cp/typeck.c diff -u llvm-gcc/gcc/cp/typeck.c:1.3 llvm-gcc/gcc/cp/typeck.c:1.4 --- llvm-gcc/gcc/cp/typeck.c:1.3 Thu Feb 5 10:05:47 2004 +++ llvm-gcc/gcc/cp/typeck.c Mon Jan 3 16:29:15 2005 @@ -20,6 +20,7 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +extern int parsing_initializer; /* This file is part of the C++ front end. It contains routines to build C++ expressions given their operands, @@ -2223,7 +2224,7 @@ * instead, generate an array ref, even though the first argument is a * pointer, not an array! */ - if (EMIT_LLVM) + if (EMIT_LLVM && !parsing_initializer) return build (ARRAY_REF, TREE_TYPE(TREE_TYPE(ar)), ar, ind); return build_indirect_ref (cp_build_binary_op (PLUS_EXPR, ar, ind), @@ -3907,7 +3908,7 @@ } /* For &x[y], return x+y */ - if (TREE_CODE (arg) == ARRAY_REF && !EMIT_LLVM) + if (TREE_CODE (arg) == ARRAY_REF && (!EMIT_LLVM || parsing_initializer)) { if (!cxx_mark_addressable (TREE_OPERAND (arg, 0))) return error_mark_node; @@ -4037,7 +4038,6 @@ } else { - tree addrLLVMTmp; /* Unfortunately we cxannot just build an address expression here, because we would not handle address-constant-expressions or offsetof correctly. */ @@ -4049,17 +4049,14 @@ rval = build_base_path (PLUS_EXPR, rval, binfo, 1); rval = build_nop (argtype, rval); + if (!EMIT_LLVM || parsing_initializer) addr = fold (build (PLUS_EXPR, argtype, rval, cp_convert (argtype, byte_position (field)))); - - addrLLVMTmp = fold(build1(ADDR_EXPR, argtype, arg)); - if (EMIT_LLVM && - (TREE_CONSTANT(addrLLVMTmp) || !TREE_CONSTANT(addr))) { - /* For LLVM, don't fold pointer arithmetic unless doing so - * produces a constant! + else + /* For LLVM, don't fold pointer arithmetic unless parsing a + * static initializer. */ - addr = addrLLVMTmp; - } + addr = fold(build1(ADDR_EXPR, argtype, arg)); } if (TREE_CODE (argtype) == POINTER_TYPE From criswell at cs.uiuc.edu Mon Jan 3 16:34:55 2005 From: criswell at cs.uiuc.edu (John Criswell) Date: Mon, 3 Jan 2005 16:34:55 -0600 Subject: [llvm-commits] CVS: llvm-gcc/gcc/config/i386/i386.c i386.h Message-ID: <200501032234.QAA24146@choi.cs.uiuc.edu> Changes in directory llvm-gcc/gcc/config/i386: i386.c updated: 1.1.1.2 -> 1.2 i386.h updated: 1.2 -> 1.3 --- Log message: Applied patches from Markus F.X.J. Oberhumer for X86-64 support. Most of the changes in i386.c disable the special va-args support for X86-64. I'm not sure what effect, if any, the i386.h alignment change has in real code generation, but it doesn't seem to break anything and looks correct. --- Diffs of the changes: (+15 -5) Index: llvm-gcc/gcc/config/i386/i386.c diff -u llvm-gcc/gcc/config/i386/i386.c:1.1.1.2 llvm-gcc/gcc/config/i386/i386.c:1.2 --- llvm-gcc/gcc/config/i386/i386.c:1.1.1.2 Tue Jan 13 10:49:45 2004 +++ llvm-gcc/gcc/config/i386/i386.c Mon Jan 3 16:34:39 2005 @@ -1381,9 +1381,15 @@ error ("-malign-double makes no sense in the 64bit mode"); if (TARGET_RTD) error ("-mrtd calling convention not supported in the 64bit mode"); +#if EMIT_LLVM + /* set to standard X86 values (using 64-bit long doubles under LLVM) */ + target_flags &= ~(MASK_SSE2 | MASK_SSE | MASK_MMX | MASK_128BIT_LONG_DOUBLE); + ix86_fpmath = FPMATH_387; +#else /* Enable by default the SSE and MMX builtins. */ target_flags |= (MASK_SSE2 | MASK_SSE | MASK_MMX | MASK_128BIT_LONG_DOUBLE); ix86_fpmath = FPMATH_SSE; +#endif } else { @@ -2795,7 +2801,8 @@ tree f_gpr, f_fpr, f_ovf, f_sav, record, type_decl; /* For i386 we use plain pointer to argument area. */ - if (!TARGET_64BIT) + /* LLVM also uses the i386 standard version in 64-bit mode */ + if (!TARGET_64BIT || EMIT_LLVM) return build_pointer_type (char_type_node); record = (*lang_hooks.types.make_type) (RECORD_TYPE); @@ -2858,7 +2865,8 @@ int stdarg_p; int i; - if (!TARGET_64BIT) + /* LLVM also uses the i386 standard version in 64-bit mode */ + if (!TARGET_64BIT || EMIT_LLVM) return; /* Indicate to allocate space on the stack for varargs save area. */ @@ -2948,7 +2956,8 @@ tree gpr, fpr, ovf, sav, t; /* Only 64bit target needs something special. */ - if (!TARGET_64BIT) + /* LLVM also uses the i386 standard version in 64-bit mode */ + if (!TARGET_64BIT || EMIT_LLVM) { std_expand_builtin_va_start (valist, nextarg); return; @@ -3015,7 +3024,8 @@ int indirect_p = 0; /* Only 64bit target needs something special. */ - if (!TARGET_64BIT) + /* LLVM also uses the i386 standard version in 64-bit mode */ + if (!TARGET_64BIT || EMIT_LLVM) { return std_expand_builtin_va_arg (valist, type); } Index: llvm-gcc/gcc/config/i386/i386.h diff -u llvm-gcc/gcc/config/i386/i386.h:1.2 llvm-gcc/gcc/config/i386/i386.h:1.3 --- llvm-gcc/gcc/config/i386/i386.h:1.2 Thu Jan 8 17:03:36 2004 +++ llvm-gcc/gcc/config/i386/i386.h Mon Jan 3 16:34:39 2005 @@ -826,7 +826,7 @@ #if !EMIT_LLVM #define BIGGEST_ALIGNMENT 128 #else -#define BIGGEST_ALIGNMENT 32 +#define BIGGEST_ALIGNMENT 64 #endif /* Decide whether a variable of mode MODE should be 128 bit aligned. */ From lattner at cs.uiuc.edu Mon Jan 3 19:56:43 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 3 Jan 2005 19:56:43 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/ADT/StringExtras.h Message-ID: <200501040156.j041uhaF028122@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/ADT: StringExtras.h updated: 1.23 -> 1.24 --- Log message: Do not let 'ftostr' return a string that starts with spaces. This allows the AsmWriter to emit FP constants like 1.0 in normal exponential notation instead of hex notation. --- Diffs of the changes: (+3 -1) Index: llvm/include/llvm/ADT/StringExtras.h diff -u llvm/include/llvm/ADT/StringExtras.h:1.23 llvm/include/llvm/ADT/StringExtras.h:1.24 --- llvm/include/llvm/ADT/StringExtras.h:1.23 Wed Sep 1 17:55:34 2004 +++ llvm/include/llvm/ADT/StringExtras.h Mon Jan 3 19:56:28 2005 @@ -100,7 +100,9 @@ static inline std::string ftostr(double V) { char Buffer[200]; sprintf(Buffer, "%20.6e", V); - return Buffer; + char *B = Buffer; + while (*B == ' ') ++B; + return B; } static inline std::string LowercaseString(const std::string &S) { From lattner at cs.uiuc.edu Mon Jan 3 19:57:09 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 3 Jan 2005 19:57:09 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/AsmWriter.cpp Message-ID: <200501040157.j041v9LP028134@apoc.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: AsmWriter.cpp updated: 1.167 -> 1.168 --- Log message: To not break TBAA rules, use a union. --- Diffs of the changes: (+9 -5) Index: llvm/lib/VMCore/AsmWriter.cpp diff -u llvm/lib/VMCore/AsmWriter.cpp:1.167 llvm/lib/VMCore/AsmWriter.cpp:1.168 --- llvm/lib/VMCore/AsmWriter.cpp:1.167 Thu Dec 9 23:41:10 2004 +++ llvm/lib/VMCore/AsmWriter.cpp Mon Jan 3 19:56:57 2005 @@ -421,7 +421,8 @@ (StrVal[1] >= '0' && StrVal[1] <= '9'))) // Reparse stringized version! if (atof(StrVal.c_str()) == CFP->getValue()) { - Out << StrVal; return; + Out << StrVal; + return; } // Otherwise we could not reparse it to exactly the same value, so we must @@ -430,11 +431,14 @@ // Behave nicely in the face of C TBAA rules... see: // http://www.nullstone.com/htmls/category/aliastyp.htm // - double Val = CFP->getValue(); - char *Ptr = (char*)&Val; - assert(sizeof(double) == sizeof(uint64_t) && sizeof(double) == 8 && + union { + double D; + uint64_t U; + } V; + V.D = CFP->getValue(); + assert(sizeof(double) == sizeof(uint64_t) && "assuming that double is 64 bits!"); - Out << "0x" << utohexstr(*(uint64_t*)Ptr); + Out << "0x" << utohexstr(V.U); } else if (isa(CV)) { Out << "zeroinitializer"; From lattner at cs.uiuc.edu Mon Jan 3 19:58:38 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 3 Jan 2005 19:58:38 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Assembler/2005-01-03-FPConstantDisassembly.ll Message-ID: <200501040158.j041wcrF028173@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/Assembler: 2005-01-03-FPConstantDisassembly.ll added (r1.1) --- Log message: Test that trivial constants are not printed in hex notation. --- Diffs of the changes: (+6 -0) Index: llvm/test/Regression/Assembler/2005-01-03-FPConstantDisassembly.ll diff -c /dev/null llvm/test/Regression/Assembler/2005-01-03-FPConstantDisassembly.ll:1.1 *** /dev/null Mon Jan 3 19:58:36 2005 --- llvm/test/Regression/Assembler/2005-01-03-FPConstantDisassembly.ll Mon Jan 3 19:58:26 2005 *************** *** 0 **** --- 1,6 ---- + ; RUN: llvm-as < %s | llvm-dis | grep '1.0' + + double %test() { + ret double 1.0 ;; This should not require hex notation + } + From llvm at cs.uiuc.edu Tue Jan 4 00:00:33 2005 From: llvm at cs.uiuc.edu (LLVM) Date: Tue, 4 Jan 2005 00:00:33 -0600 Subject: [llvm-commits] CVS: llvm/win32/CBackend/ Message-ID: <200501040600.AAA04937@zion.cs.uiuc.edu> Changes in directory llvm/win32/CBackend: --- Log message: Directory /var/cvs/llvm/llvm/win32/CBackend added to the repository --- Diffs of the changes: (+0 -0) From jeffc at jolt-lang.org Tue Jan 4 00:02:06 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Tue, 4 Jan 2005 00:02:06 -0600 Subject: [llvm-commits] CVS: llvm/win32/llvm.sln Message-ID: <200501040602.AAA04979@zion.cs.uiuc.edu> Changes in directory llvm/win32: llvm.sln updated: 1.13 -> 1.14 --- Log message: Add C backend to llc in Visual Studio. --- Diffs of the changes: (+10 -0) Index: llvm/win32/llvm.sln diff -u llvm/win32/llvm.sln:1.13 llvm/win32/llvm.sln:1.14 --- llvm/win32/llvm.sln:1.13 Sat Jan 1 22:44:36 2005 +++ llvm/win32/llvm.sln Tue Jan 4 00:01:54 2005 @@ -93,6 +93,7 @@ {28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508} {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D61} = {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D61} {059FBAB8-C76D-48A0-AA75-3C57BD3EAFE4} = {059FBAB8-C76D-48A0-AA75-3C57BD3EAFE4} + {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} @@ -157,6 +158,11 @@ {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}" + ProjectSection(ProjectDependencies) = postProject + {19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E} + EndProjectSection +EndProject Global GlobalSection(SolutionConfiguration) = preSolution Debug = Debug @@ -251,6 +257,10 @@ {342CF48F-760A-4040-A9A1-7D75AA2471CE}.Debug.Build.0 = Debug|Win32 {342CF48F-760A-4040-A9A1-7D75AA2471CE}.Release.ActiveCfg = Release|Win32 {342CF48F-760A-4040-A9A1-7D75AA2471CE}.Release.Build.0 = Release|Win32 + {057777CD-DED5-46DF-BF9A-6B76DE212549}.Debug.ActiveCfg = Debug|Win32 + {057777CD-DED5-46DF-BF9A-6B76DE212549}.Debug.Build.0 = Debug|Win32 + {057777CD-DED5-46DF-BF9A-6B76DE212549}.Release.ActiveCfg = Release|Win32 + {057777CD-DED5-46DF-BF9A-6B76DE212549}.Release.Build.0 = Release|Win32 EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution EndGlobalSection From jeffc at jolt-lang.org Tue Jan 4 00:02:06 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Tue, 4 Jan 2005 00:02:06 -0600 Subject: [llvm-commits] CVS: llvm/win32/CBackend/CBackend.vcproj Message-ID: <200501040602.AAA04980@zion.cs.uiuc.edu> Changes in directory llvm/win32/CBackend: CBackend.vcproj added (r1.1) --- Log message: Add C backend to llc in Visual Studio. --- Diffs of the changes: (+124 -0) Index: llvm/win32/CBackend/CBackend.vcproj diff -c /dev/null llvm/win32/CBackend/CBackend.vcproj:1.1 *** /dev/null Tue Jan 4 00:02:05 2005 --- llvm/win32/CBackend/CBackend.vcproj Tue Jan 4 00:01:54 2005 *************** *** 0 **** --- 1,124 ---- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From jeffc at jolt-lang.org Tue Jan 4 00:02:06 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Tue, 4 Jan 2005 00:02:06 -0600 Subject: [llvm-commits] CVS: llvm/win32/llc/llc.vcproj Message-ID: <200501040602.AAA04985@zion.cs.uiuc.edu> Changes in directory llvm/win32/llc: llc.vcproj updated: 1.5 -> 1.6 --- Log message: Add C backend to llc in Visual Studio. --- Diffs of the changes: (+2 -2) Index: llvm/win32/llc/llc.vcproj diff -u llvm/win32/llc/llc.vcproj:1.5 llvm/win32/llc/llc.vcproj:1.6 --- llvm/win32/llc/llc.vcproj:1.5 Sat Jan 1 22:23:12 2005 +++ llvm/win32/llc/llc.vcproj Tue Jan 4 00:01:55 2005 @@ -36,7 +36,7 @@ Name="VCCustomBuildTool"/> Changes in directory llvm/win32/Analysis: Analysis.vcproj updated: 1.6 -> 1.7 --- Log message: Add C backend to llc in Visual Studio. --- Diffs of the changes: (+44 -15) Index: llvm/win32/Analysis/Analysis.vcproj diff -u llvm/win32/Analysis/Analysis.vcproj:1.6 llvm/win32/Analysis/Analysis.vcproj:1.7 --- llvm/win32/Analysis/Analysis.vcproj:1.6 Sat Dec 18 20:29:00 2004 +++ llvm/win32/Analysis/Analysis.vcproj Tue Jan 4 00:01:54 2005 @@ -163,6 +163,31 @@ + + + + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + + + From jeffc at jolt-lang.org Tue Jan 4 00:18:21 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Tue, 4 Jan 2005 00:18:21 -0600 Subject: [llvm-commits] CVS: llvm/win32/TableGen/TableGen.vcproj Message-ID: <200501040618.AAA05048@zion.cs.uiuc.edu> Changes in directory llvm/win32/TableGen: TableGen.vcproj updated: 1.10 -> 1.11 --- Log message: Make bison/flex build steps output the same message in Visual Studio as on Unix. --- Diffs of the changes: (+4 -4) Index: llvm/win32/TableGen/TableGen.vcproj diff -u llvm/win32/TableGen/TableGen.vcproj:1.10 llvm/win32/TableGen/TableGen.vcproj:1.11 --- llvm/win32/TableGen/TableGen.vcproj:1.10 Sat Jan 1 15:35:39 2005 +++ llvm/win32/TableGen/TableGen.vcproj Tue Jan 4 00:18:10 2005 @@ -138,7 +138,7 @@ Name="Debug|Win32"> @@ -147,7 +147,7 @@ Name="Release|Win32"> @@ -159,7 +159,7 @@ Name="Debug|Win32"> Changes in directory llvm/win32/AsmParser: AsmParser.vcproj updated: 1.2 -> 1.3 --- Log message: Make bison/flex build steps output the same message in Visual Studio as on Unix. --- Diffs of the changes: (+4 -4) Index: llvm/win32/AsmParser/AsmParser.vcproj diff -u llvm/win32/AsmParser/AsmParser.vcproj:1.2 llvm/win32/AsmParser/AsmParser.vcproj:1.3 --- llvm/win32/AsmParser/AsmParser.vcproj:1.2 Sat Jan 1 16:30:19 2005 +++ llvm/win32/AsmParser/AsmParser.vcproj Tue Jan 4 00:18:10 2005 @@ -113,7 +113,7 @@ Name="Debug|Win32"> @@ -121,7 +121,7 @@ Name="Release|Win32"> @@ -132,7 +132,7 @@ Name="Debug|Win32"> Changes in directory llvm/projects/sample/autoconf/m4: --- Log message: Directory /var/cvs/llvm/llvm/projects/sample/autoconf/m4 added to the repository --- Diffs of the changes: (+0 -0) From reid at x10sys.com Wed Jan 5 00:41:21 2005 From: reid at x10sys.com (Reid Spencer) Date: Wed, 5 Jan 2005 00:41:21 -0600 Subject: [llvm-commits] CVS: llvm/projects/sample/autoconf/AutoRegen.sh aclocal.m4 configure.ac Message-ID: <200501050641.AAA06187@zion.cs.uiuc.edu> Changes in directory llvm/projects/sample/autoconf: AutoRegen.sh added (r1.1) aclocal.m4 updated: 1.1 -> 1.2 configure.ac updated: 1.2 -> 1.3 --- Log message: Cleanup configuration for Cygwin --- Diffs of the changes: (+46 -6163) Index: llvm/projects/sample/autoconf/AutoRegen.sh diff -c /dev/null llvm/projects/sample/autoconf/AutoRegen.sh:1.1 *** /dev/null Wed Jan 5 00:41:20 2005 --- llvm/projects/sample/autoconf/AutoRegen.sh Wed Jan 5 00:41:10 2005 *************** *** 0 **** --- 1,30 ---- + #!/bin/sh + die () { + echo "$@" 1>&2 + exit 1 + } + test -d autoconf && test -f autoconf/configure.ac && cd autoconf + test -f configure.ac || die "Can't find 'autoconf' dir; please cd into it first" + autoconf --version | egrep '2\.5[0-9]' > /dev/null + if test $? -ne 0 ; then + die "Your autoconf was not detected as being 2.5x" + fi + cwd=`pwd` + if test -d ../../../autoconf/m4 ; then + cd ../../../autoconf/m4 + llvm_m4=`pwd` + cd $cwd + elif test -d ../../llvm/autoconf/m4 ; then + cd ../../llvm/autoconf/m4 + llvm_m4=`pwd` + cd $cwd + else + die "Can't find the LLVM autoconf/m4 directory. llvm-test should be checked out to projects directory" + fi + echo "Regenerating aclocal.m4 with aclocal" + rm -f aclocal.m4 + aclocal -I $cwd/m4 -I $llvm_m4 || die "aclocal failed" + echo "Regenerating configure with autoconf 2.5x" + autoconf --force --warnings=all -o ../configure configure.ac || die "autoconf failed" + cd .. + exit 0 Index: llvm/projects/sample/autoconf/aclocal.m4 diff -u llvm/projects/sample/autoconf/aclocal.m4:1.1 llvm/projects/sample/autoconf/aclocal.m4:1.2 --- llvm/projects/sample/autoconf/aclocal.m4:1.1 Wed Oct 15 20:44:19 2003 +++ llvm/projects/sample/autoconf/aclocal.m4 Wed Jan 5 00:41:10 2005 @@ -1,6168 +1,21 @@ -# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- -## Copyright 1996, 1997, 1998, 1999, 2000, 2001 -## Free Software Foundation, Inc. -## Originally by Gordon Matzigkeit , 1996 -## -## This program is free software; you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2 of the License, or -## (at your option) any later version. -## -## This program is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with this program; if not, write to the Free Software -## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -## -## As a special exception to the GNU General Public License, if you -## distribute this file as part of a program that contains a -## configuration script generated by Autoconf, you may include it under -## the same distribution terms that you use for the rest of that program. +# generated automatically by aclocal 1.9.2 -*- Autoconf -*- -# serial 47 AC_PROG_LIBTOOL - - -# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) -# ----------------------------------------------------------- -# If this macro is not defined by Autoconf, define it here. -m4_ifdef([AC_PROVIDE_IFELSE], - [], - [m4_define([AC_PROVIDE_IFELSE], - [m4_ifdef([AC_PROVIDE_$1], - [$2], [$3])])]) - - -# AC_PROG_LIBTOOL -# --------------- -AC_DEFUN([AC_PROG_LIBTOOL], -[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl -dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX -dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX. - AC_PROVIDE_IFELSE([AC_PROG_CXX], - [AC_LIBTOOL_CXX], - [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX - ])]) -dnl And a similar setup for Fortran 77 support - AC_PROVIDE_IFELSE([AC_PROG_F77], - [AC_LIBTOOL_F77], - [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77 -])]) - -dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly. -dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run -dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both. - AC_PROVIDE_IFELSE([AC_PROG_GCJ], - [AC_LIBTOOL_GCJ], - [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], - [AC_LIBTOOL_GCJ], - [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ], - [AC_LIBTOOL_GCJ], - [ifdef([AC_PROG_GCJ], - [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])]) - ifdef([A][M_PROG_GCJ], - [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])]) - ifdef([LT_AC_PROG_GCJ], - [define([LT_AC_PROG_GCJ], - defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])]) -])])# AC_PROG_LIBTOOL - - -# _AC_PROG_LIBTOOL -# ---------------- -AC_DEFUN([_AC_PROG_LIBTOOL], -[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl -AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl -AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl -AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/mklib' -AC_SUBST(LIBTOOL)dnl - -# Prevent multiple expansion -define([AC_PROG_LIBTOOL], []) -])# _AC_PROG_LIBTOOL - - -# AC_LIBTOOL_SETUP -# ---------------- -AC_DEFUN([AC_LIBTOOL_SETUP], -[AC_PREREQ(2.50)dnl -AC_REQUIRE([AC_ENABLE_SHARED])dnl -AC_REQUIRE([AC_ENABLE_STATIC])dnl -AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_PROG_LD])dnl -AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl -AC_REQUIRE([AC_PROG_NM])dnl - -AC_REQUIRE([AC_PROG_LN_S])dnl -AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl -# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! -AC_REQUIRE([AC_OBJEXT])dnl -AC_REQUIRE([AC_EXEEXT])dnl -dnl - -AC_LIBTOOL_SYS_MAX_CMD_LEN -AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE -AC_LIBTOOL_OBJDIR - -AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl -_LT_AC_PROG_ECHO_BACKSLASH - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='sed -e s/^X//' -[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'] - -# Same as above, but do not quote variable references. -[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'] - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' - -# Constants: -rm="rm -f" - -# Global variables: -default_ofile=mklib -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except M$VC, -# which needs '.lib'). -libext=a -ltmain="$ac_aux_dir/ltmain.sh" -ofile="$default_ofile" -with_gnu_ld="$lt_cv_prog_gnu_ld" - -AC_CHECK_TOOL(AR, ar, false) -AC_CHECK_TOOL(RANLIB, ranlib, :) -AC_CHECK_TOOL(STRIP, strip, :) - -old_CC="$CC" -old_CFLAGS="$CFLAGS" - -# Set sane defaults for various variables -test -z "$AR" && AR=ar -test -z "$AR_FLAGS" && AR_FLAGS=cru -test -z "$AS" && AS=as -test -z "$CC" && CC=cc -test -z "$LTCC" && LTCC=$CC -test -z "$DLLTOOL" && DLLTOOL=dlltool -test -z "$LD" && LD=ld -test -z "$LN_S" && LN_S="ln -s" -test -z "$MAGIC_CMD" && MAGIC_CMD=file -test -z "$NM" && NM=nm -test -z "$SED" && SED=sed -test -z "$OBJDUMP" && OBJDUMP=objdump -test -z "$RANLIB" && RANLIB=: -test -z "$STRIP" && STRIP=: -test -z "$ac_objext" && ac_objext=o - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -if test -n "$RANLIB"; then - case $host_os in - openbsd*) - old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" - ;; - *) - old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" -fi - -# Only perform the check for file, if the check method requires it -case $deplibs_check_method in -file_magic*) - if test "$file_magic_cmd" = '$MAGIC_CMD'; then - AC_PATH_MAGIC - fi - ;; -esac - -AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) -AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], -enable_win32_dll=yes, enable_win32_dll=no) - -AC_ARG_ENABLE([libtool-lock], - [AC_HELP_STRING([--disable-libtool-lock], - [avoid locking (might break parallel builds)])]) -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes - -AC_ARG_WITH([pic], - [AC_HELP_STRING([--with-pic], - [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], - [pic_mode="$withval"], - [pic_mode=default]) -test -z "$pic_mode" && pic_mode=default - -# Use C for the default configuration in the libtool script -tagname= -AC_LIBTOOL_LANG_C_CONFIG -_LT_AC_TAGCONFIG -])# AC_LIBTOOL_SETUP - - -# _LT_AC_SYS_COMPILER -# ------------------- -AC_DEFUN([_LT_AC_SYS_COMPILER], -[AC_REQUIRE([AC_PROG_CC])dnl - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# Allow CC to be a program name with arguments. -compiler=$CC -])# _LT_AC_SYS_COMPILER - - -# _LT_AC_SYS_LIBPATH_AIX -# ---------------------- -# Links a minimal program and checks the executable -# for the system default hardcoded library path. In most cases, -# this is /usr/lib:/lib, but when the MPI compilers are used -# the location of the communication and MPI libs are included too. -# If we don't find anything, use the default library path according -# to the aix ld manual. -AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX], -[AC_LINK_IFELSE(AC_LANG_PROGRAM,[ -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi],[]) -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi -])# _LT_AC_SYS_LIBPATH_AIX - - -# _LT_AC_SHELL_INIT(ARG) -# ---------------------- -AC_DEFUN([_LT_AC_SHELL_INIT], -[ifdef([AC_DIVERSION_NOTICE], - [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], - [AC_DIVERT_PUSH(NOTICE)]) -$1 -AC_DIVERT_POP -])# _LT_AC_SHELL_INIT - - -# _LT_AC_PROG_ECHO_BACKSLASH -# -------------------------- -# Add some code to the start of the generated configure script which -# will find an echo command which doesn't interpret backslashes. -AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH], -[_LT_AC_SHELL_INIT([ -# Check that we are running under the correct shell. -SHELL=${CONFIG_SHELL-/bin/sh} - -case X$ECHO in -X*--fallback-echo) - # Remove one level of quotation (which was required for Make). - ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` - ;; -esac - -echo=${ECHO-echo} -if test "X[$]1" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift -elif test "X[$]1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then - # Yippee, $echo works! - : -else - # Restart under the correct shell. - exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} -fi - -if test "X[$]1" = X--fallback-echo; then - # used as fallback echo - shift - cat </dev/null && - echo_test_string="`eval $cmd`" && - (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null - then - break - fi - done -fi - -if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - : -else - # The Solaris, AIX, and Digital Unix default echo programs unquote - # backslashes. This makes it impossible to quote backslashes using - # echo "$something" | sed 's/\\/\\\\/g' - # - # So, first we look for a working echo in the user's PATH. - - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for dir in $PATH /usr/ucb; do - IFS="$lt_save_ifs" - if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && - test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - echo="$dir/echo" - break - fi - done - IFS="$lt_save_ifs" - - if test "X$echo" = Xecho; then - # We didn't find a better echo, so look for alternatives. - if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # This shell has a builtin print -r that does the trick. - echo='print -r' - elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && - test "X$CONFIG_SHELL" != X/bin/ksh; then - # If we have ksh, try running configure again with it. - ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} - export ORIGINAL_CONFIG_SHELL - CONFIG_SHELL=/bin/ksh - export CONFIG_SHELL - exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} - else - # Try using printf. - echo='printf %s\n' - if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # Cool, printf works - : - elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL - export CONFIG_SHELL - SHELL="$CONFIG_SHELL" - export SHELL - echo="$CONFIG_SHELL [$]0 --fallback-echo" - elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - echo="$CONFIG_SHELL [$]0 --fallback-echo" - else - # maybe with a smaller string... - prev=: - - for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do - if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null - then - break - fi - prev="$cmd" - done - - if test "$prev" != 'sed 50q "[$]0"'; then - echo_test_string=`eval $prev` - export echo_test_string - exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} - else - # Oops. We lost completely, so just stick with echo. - echo=echo - fi - fi - fi - fi -fi -fi - -# Copy echo and quote the copy suitably for passing to libtool from -# the Makefile, instead of quoting the original, which is used later. -ECHO=$echo -if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then - ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" -fi - -AC_SUBST(ECHO) -])])# _LT_AC_PROG_ECHO_BACKSLASH - - -# _LT_AC_LOCK -# ----------- -AC_DEFUN([_LT_AC_LOCK], -[AC_ARG_ENABLE([libtool-lock], - [AC_HELP_STRING([--disable-libtool-lock], - [avoid locking (might break parallel builds)])]) -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -ia64-*-hpux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.$ac_objext` in - *ELF-32*) - HPUX_IA64_MODE="32" - ;; - *ELF-64*) - HPUX_IA64_MODE="64" - ;; - esac - fi - rm -rf conftest* - ;; -*-*-irix6*) - # Find out which ABI we are using. - echo '[#]line __oline__ "configure"' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - if test "$lt_cv_prog_gnu_ld" = yes; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -melf32bsmip" - ;; - *N32*) - LD="${LD-ld} -melf32bmipn32" - ;; - *64-bit*) - LD="${LD-ld} -melf64bmip" - ;; - esac - else - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi - fi - rm -rf conftest* - ;; - -x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case "`/usr/bin/file conftest.o`" in - *32-bit*) - case $host in - x86_64-*linux*) - LD="${LD-ld} -m elf_i386" - ;; - ppc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) - LD="${LD-ld} -m elf_s390" - ;; - sparc64-*linux*) - LD="${LD-ld} -m elf32_sparc" - ;; - esac - ;; - *64-bit*) - case $host in - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; - ppc*-*linux*|powerpc*-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*) - LD="${LD-ld} -m elf64_s390" - ;; - sparc*-*linux*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; - -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -belf" - AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, - [AC_LANG_PUSH(C) - AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) - AC_LANG_POP]) - if test x"$lt_cv_cc_needs_belf" != x"yes"; then - # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS="$SAVE_CFLAGS" - fi - ;; -AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], -[*-*-cygwin* | *-*-mingw* | *-*-pw32*) - AC_CHECK_TOOL(DLLTOOL, dlltool, false) - AC_CHECK_TOOL(AS, as, false) - AC_CHECK_TOOL(OBJDUMP, objdump, false) - ;; - ]) -esac - -need_locks="$enable_libtool_lock" - -])# _LT_AC_LOCK - - -# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) -# ---------------------------------------------------------------- -# Check whether the given compiler option works -AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], -[AC_CACHE_CHECK([$1], [$2], - [$2=no - ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$3" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then - $2=yes - fi - fi - $rm conftest* -]) - -if test x"[$]$2" = xyes; then - ifelse([$5], , :, [$5]) -else - ifelse([$6], , :, [$6]) -fi -])# AC_LIBTOOL_COMPILER_OPTION - - -# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -# [ACTION-SUCCESS], [ACTION-FAILURE]) -# ------------------------------------------------------------ -# Check whether the given compiler option works -AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], -[AC_CACHE_CHECK([$1], [$2], - [$2=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $3" - printf "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&AS_MESSAGE_LOG_FD - else - $2=yes - fi - fi - $rm conftest* - LDFLAGS="$save_LDFLAGS" -]) - -if test x"[$]$2" = xyes; then - ifelse([$4], , :, [$4]) -else - ifelse([$5], , :, [$5]) -fi -])# AC_LIBTOOL_LINKER_OPTION - - -# AC_LIBTOOL_SYS_MAX_CMD_LEN -# -------------------------- -AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], -[# find the maximum length of command line arguments -AC_MSG_CHECKING([the maximum length of command line arguments]) -AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl - i=0 - testring="ABCD" - - case $build_os in - msdosdjgpp*) - # On DJGPP, this test can blow up pretty badly due to problems in libc - # (any single argument exceeding 2000 bytes causes a buffer overrun - # during glob expansion). Even if it were fixed, the result of this - # check would be larger than it should be. - lt_cv_sys_max_cmd_len=12288; # 12K is about right - ;; - - gnu*) - # Under GNU Hurd, this test is not required because there is - # no limit to the length of command line arguments. - # Libtool will interpret -1 as no limit whatsoever - lt_cv_sys_max_cmd_len=-1; - ;; - - cygwin* | mingw*) - # On Win9x/ME, this test blows up -- it succeeds, but takes - # about 5 minutes as the teststring grows exponentially. - # Worse, since 9x/ME are not pre-emptively multitasking, - # you end up with a "frozen" computer, even though with patience - # the test eventually succeeds (with a max line length of 256k). - # Instead, let's just punt: use the minimum linelength reported by - # all of the supported platforms: 8192 (on NT/2K/XP). - lt_cv_sys_max_cmd_len=8192; - ;; - - *) - # If test is not a shell built-in, we'll probably end up computing a - # maximum length that is only half of the actual maximum length, but - # we can't tell. - while (test "X"`$CONFIG_SHELL [$]0 --fallback-echo "X$testring" 2>/dev/null` \ - = "XX$testring") >/dev/null 2>&1 && - new_result=`expr "X$testring" : ".*" 2>&1` && - lt_cv_sys_max_cmd_len=$new_result && - test $i != 17 # 1/2 MB should be enough - do - i=`expr $i + 1` - testring=$testring$testring - done - testring= - # Add a significant safety factor because C++ compilers can tack on massive - # amounts of additional arguments before passing them to the linker. - # It appears as though 1/2 is a usable value. - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` - ;; - esac -]) -if test -n $lt_cv_sys_max_cmd_len ; then - AC_MSG_RESULT($lt_cv_sys_max_cmd_len) -else - AC_MSG_RESULT(none) -fi -])# AC_LIBTOOL_SYS_MAX_CMD_LEN - - -# _LT_AC_CHECK_DLFCN -# -------------------- -AC_DEFUN([_LT_AC_CHECK_DLFCN], -[AC_CHECK_HEADERS(dlfcn.h)dnl -])# _LT_AC_CHECK_DLFCN - - -# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, -# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) -# ------------------------------------------------------------------ -AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF], -[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl -if test "$cross_compiling" = yes; then : - [$4] -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext < -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -extern "C" void exit (int); -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - - exit (status); -}] -EOF - if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) $1 ;; - x$lt_dlneed_uscore) $2 ;; - x$lt_unknown|x*) $3 ;; - esac - else : - # compilation failed - $3 - fi -fi -rm -fr conftest* -])# _LT_AC_TRY_DLOPEN_SELF - - -# AC_LIBTOOL_DLOPEN_SELF -# ------------------- -AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], -[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl -if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - mingw* | pw32*) - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - - cygwin*) - lt_cv_dlopen="dlopen" - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - AC_CHECK_LIB([dl], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ]) - ;; - - *) - AC_CHECK_FUNC([shl_load], - [lt_cv_dlopen="shl_load"], - [AC_CHECK_LIB([dld], [shl_load], - [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"], - [AC_CHECK_FUNC([dlopen], - [lt_cv_dlopen="dlopen"], - [AC_CHECK_LIB([dl], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], - [AC_CHECK_LIB([svld], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], - [AC_CHECK_LIB([dld], [dld_link], - [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"]) - ]) - ]) - ]) - ]) - ]) - ;; - esac - - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - else - enable_dlopen=no - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS="$LDFLAGS" - eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS="$LIBS" - LIBS="$lt_cv_dlopen_libs $LIBS" - - AC_CACHE_CHECK([whether a program can dlopen itself], - lt_cv_dlopen_self, [dnl - _LT_AC_TRY_DLOPEN_SELF( - lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, - lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) - ]) - - if test "x$lt_cv_dlopen_self" = xyes; then - LDFLAGS="$LDFLAGS $link_static_flag" - AC_CACHE_CHECK([whether a statically linked program can dlopen itself], - lt_cv_dlopen_self_static, [dnl - _LT_AC_TRY_DLOPEN_SELF( - lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, - lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) - ]) - fi - - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - ;; - esac - - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi -])# AC_LIBTOOL_DLOPEN_SELF - - -# AC_LIBTOOL_PROG_CC_C_O([TAGNAME]) -# --------------------------------- -# Check to see if options -c and -o are simultaneously supported by compiler -AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O], -[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl -AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], - [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)], - [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no - $rm -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - # According to Tom Tromey, Ian Lance Taylor reported there are C compilers - # that will create temporary files in the current directory regardless of - # the output directory. Thus, making CWD read-only will cause this test - # to fail, enabling locking or at least warning the user not to do parallel - # builds. - chmod -w . - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s out/conftest.err; then - _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes - fi - fi - chmod u+w . - $rm conftest* out/* - rmdir out - cd .. - rmdir conftest - $rm conftest* -]) -])# AC_LIBTOOL_PROG_CC_C_O - - -# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME]) -# ----------------------------------------- -# Check to see if we can do hard links to lock some files if needed -AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], -[AC_REQUIRE([_LT_AC_LOCK])dnl - -hard_links="nottested" -if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - AC_MSG_CHECKING([if we can lock with hard links]) - hard_links=yes - $rm conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - AC_MSG_RESULT([$hard_links]) - if test "$hard_links" = no; then - AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) - need_locks=warn - fi -else - need_locks=no -fi -])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS - - -# AC_LIBTOOL_OBJDIR -# ----------------- -AC_DEFUN([AC_LIBTOOL_OBJDIR], -[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], -[rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - lt_cv_objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - lt_cv_objdir=_libs -fi -rmdir .libs 2>/dev/null]) -objdir=$lt_cv_objdir -])# AC_LIBTOOL_OBJDIR - - -# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME]) -# ---------------------------------------------- -# Check hardcoding attributes. -AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], -[AC_MSG_CHECKING([how to hardcode library paths into programs]) -_LT_AC_TAGVAR(hardcode_action, $1)= -if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \ - test -n "$_LT_AC_TAGVAR(runpath_var $1)" || \ - test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)"="Xyes" ; then - - # We can hardcode non-existant directories. - if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no && - test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then - # Linking always hardcodes the temporary library directory. - _LT_AC_TAGVAR(hardcode_action, $1)=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - _LT_AC_TAGVAR(hardcode_action, $1)=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - _LT_AC_TAGVAR(hardcode_action, $1)=unsupported -fi -AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)]) - -if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi -])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH - - -# AC_LIBTOOL_SYS_LIB_STRIP -# ------------------------ -AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP], -[striplib= -old_striplib= -AC_MSG_CHECKING([whether stripping libraries is possible]) -if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - AC_MSG_RESULT([yes]) -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) -fi - ;; - *) - AC_MSG_RESULT([no]) - ;; - esac -fi -])# AC_LIBTOOL_SYS_LIB_STRIP - - -# AC_LIBTOOL_SYS_DYNAMIC_LINKER -# ----------------------------- -# PORTME Fill in your ld.so characteristics -AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER], -[AC_MSG_CHECKING([dynamic linker characteristics]) -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix4* | aix5*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[[01]] | aix4.[[01]].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi4*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32*) - version_type=windows - shrext=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32*) - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $rm \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/lib /lib/w32api /usr/lib /usr/local/lib" - ;; - mingw*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - esac - ;; - - *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' - ;; - esac - dynamic_linker='Win32 ld.exe' - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - # FIXME: Relying on posixy $() will cause problems for - # cross-compilation, but unfortunately the echo tests do not - # yet detect zsh echo's removal of \ escapes. - library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext='$(test .$module = .yes && echo .so || echo .dylib)' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - fi - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -freebsd*) - objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[01]* | freebsdelf3.[01]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - *) # from 3.2 on - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case "$host_cpu" in - ia64*) - shrext='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. - postinstall_cmds='chmod 555 $lib' - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -nto-qnx) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -openbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[[89]] | openbsd2.[[89]].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -sco3.2v5*) - version_type=osf - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - export_dynamic_flag_spec='${wl}-Blargedynsym' - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -AC_MSG_RESULT([$dynamic_linker]) -test "$dynamic_linker" = no && can_build_shared=no -])# AC_LIBTOOL_SYS_DYNAMIC_LINKER - - -# _LT_AC_TAGCONFIG -# ---------------- -AC_DEFUN([_LT_AC_TAGCONFIG], -[AC_ARG_WITH([tags], - [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@], - [include additional configurations @<:@automatic@:>@])], - [tagnames="$withval"]) - -if test -f "$ltmain" && test -n "$tagnames"; then - if test ! -f "${ofile}"; then - AC_MSG_WARN([output file `$ofile' does not exist]) - fi - - if test -z "$LTCC"; then - eval "`$SHELL ${ofile} --config | grep '^LTCC='`" - if test -z "$LTCC"; then - AC_MSG_WARN([output file `$ofile' does not look like a libtool script]) - else - AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile']) - fi - fi - - # Extract list of available tagged configurations in $ofile. - # Note that this assumes the entire list is on one line. - available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` - - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for tagname in $tagnames; do - IFS="$lt_save_ifs" - # Check whether tagname contains only valid characters - case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in - "") ;; - *) AC_MSG_ERROR([invalid tag name: $tagname]) - ;; - esac - - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null - then - AC_MSG_ERROR([tag name \"$tagname\" already exists]) - fi - - # Update the list of available tags. - if test -n "$tagname"; then - echo appending configuration tag \"$tagname\" to $ofile - - case $tagname in - CXX) - if test -n "$CXX" && test "X$CXX" != "Xno"; then - AC_LIBTOOL_LANG_CXX_CONFIG - else - tagname="" - fi - ;; - - F77) - if test -n "$F77" && test "X$F77" != "Xno"; then - AC_LIBTOOL_LANG_F77_CONFIG - else - tagname="" - fi - ;; - - GCJ) - if test -n "$GCJ" && test "X$GCJ" != "Xno"; then - AC_LIBTOOL_LANG_GCJ_CONFIG - else - tagname="" - fi - ;; - - RC) - AC_LIBTOOL_LANG_RC_CONFIG - ;; - - *) - AC_MSG_ERROR([Unsupported tag name: $tagname]) - ;; - esac - - # Append the new tag name to the list of available tags. - if test -n "$tagname" ; then - available_tags="$available_tags $tagname" - fi - fi - done - IFS="$lt_save_ifs" - - # Now substitute the updated list of available tags. - if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then - mv "${ofile}T" "$ofile" - chmod +x "$ofile" - else - rm -f "${ofile}T" - AC_MSG_ERROR([unable to update list of available tagged configurations.]) - fi -fi -])# _LT_AC_TAGCONFIG - - -# AC_LIBTOOL_DLOPEN -# ----------------- -# enable checks for dlopen support -AC_DEFUN([AC_LIBTOOL_DLOPEN], - [AC_BEFORE([$0],[AC_LIBTOOL_SETUP]) -])# AC_LIBTOOL_DLOPEN - - -# AC_LIBTOOL_WIN32_DLL -# -------------------- -# declare package support for building win32 dll's -AC_DEFUN([AC_LIBTOOL_WIN32_DLL], -[AC_BEFORE([$0], [AC_LIBTOOL_SETUP]) -])# AC_LIBTOOL_WIN32_DLL - - -# AC_ENABLE_SHARED([DEFAULT]) -# --------------------------- -# implement the --enable-shared flag -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -AC_DEFUN([AC_ENABLE_SHARED], -[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE([shared], - [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@], - [build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_shared=yes ;; - no) enable_shared=no ;; - *) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_shared=]AC_ENABLE_SHARED_DEFAULT) -])# AC_ENABLE_SHARED - - -# AC_DISABLE_SHARED -# ----------------- -#- set the default shared flag to --disable-shared -AC_DEFUN([AC_DISABLE_SHARED], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -AC_ENABLE_SHARED(no) -])# AC_DISABLE_SHARED - - -# AC_ENABLE_STATIC([DEFAULT]) -# --------------------------- -# implement the --enable-static flag -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -AC_DEFUN([AC_ENABLE_STATIC], -[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE([static], - [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@], - [build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_static=yes ;; - no) enable_static=no ;; - *) - enable_static=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_static=]AC_ENABLE_STATIC_DEFAULT) -])# AC_ENABLE_STATIC - - -# AC_DISABLE_STATIC -# ----------------- -# set the default static flag to --disable-static -AC_DEFUN([AC_DISABLE_STATIC], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -AC_ENABLE_STATIC(no) -])# AC_DISABLE_STATIC - - -# AC_ENABLE_FAST_INSTALL([DEFAULT]) -# --------------------------------- -# implement the --enable-fast-install flag -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -AC_DEFUN([AC_ENABLE_FAST_INSTALL], -[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE([fast-install], - [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], - [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_fast_install=yes ;; - no) enable_fast_install=no ;; - *) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT) -])# AC_ENABLE_FAST_INSTALL - - -# AC_DISABLE_FAST_INSTALL -# ----------------------- -# set the default to --disable-fast-install -AC_DEFUN([AC_DISABLE_FAST_INSTALL], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -AC_ENABLE_FAST_INSTALL(no) -])# AC_DISABLE_FAST_INSTALL - - -# AC_LIBTOOL_PICMODE([MODE]) -# -------------------------- -# implement the --with-pic flag -# MODE is either `yes' or `no'. If omitted, it defaults to `both'. -AC_DEFUN([AC_LIBTOOL_PICMODE], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -pic_mode=ifelse($#,1,$1,default) -])# AC_LIBTOOL_PICMODE - - -# AC_PROG_EGREP -# ------------- -# This is predefined starting with Autoconf 2.54, so this conditional -# definition can be removed once we require Autoconf 2.54 or later. -m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP], -[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep], - [if echo a | (grep -E '(a|b)') >/dev/null 2>&1 - then ac_cv_prog_egrep='grep -E' - else ac_cv_prog_egrep='egrep' - fi]) - EGREP=$ac_cv_prog_egrep - AC_SUBST([EGREP]) -])]) - - -# AC_PATH_TOOL_PREFIX -# ------------------- -# find a file program which can recognise shared library -AC_DEFUN([AC_PATH_TOOL_PREFIX], -[AC_REQUIRE([AC_PROG_EGREP])dnl -AC_MSG_CHECKING([for $1]) -AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, -[case $MAGIC_CMD in -[[\\/*] | ?:[\\/]*]) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR -dnl $ac_dummy forces splitting on constant user-supplied paths. -dnl POSIX.2 word splitting is done only on the output of word expansions, -dnl not every word. This closes a longstanding sh security hole. - ac_dummy="ifelse([$2], , $PATH, [$2])" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$1; then - lt_cv_path_MAGIC_CMD="$ac_dir/$1" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool at gnu.org - -EOF - fi ;; - esac - fi - break - fi - done - IFS="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" - ;; -esac]) -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - AC_MSG_RESULT($MAGIC_CMD) -else - AC_MSG_RESULT(no) -fi -])# AC_PATH_TOOL_PREFIX - - -# AC_PATH_MAGIC -# ------------- -# find a file program which can recognise a shared library -AC_DEFUN([AC_PATH_MAGIC], -[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) -if test -z "$lt_cv_path_MAGIC_CMD"; then - if test -n "$ac_tool_prefix"; then - AC_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) - else - MAGIC_CMD=: - fi -fi -])# AC_PATH_MAGIC - - -# AC_PROG_LD -# ---------- -# find the path to the GNU or non-GNU linker -AC_DEFUN([AC_PROG_LD], -[AC_ARG_WITH([gnu-ld], - [AC_HELP_STRING([--with-gnu-ld], - [assume the C compiler uses GNU ld @<:@default=no@:>@])], - [test "$withval" = no || with_gnu_ld=yes], - [with_gnu_ld=no]) -AC_REQUIRE([LT_AC_PROG_SED])dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - AC_MSG_CHECKING([for ld used by $CC]) - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [[\\/]]* | ?:[[\\/]]*) - re_direlt='/[[^/]][[^/]]*/\.\./' - # Canonicalize the path of ld - ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` - while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - AC_MSG_CHECKING([for GNU ld]) -else - AC_MSG_CHECKING([for non-GNU ld]) -fi -AC_CACHE_VAL(lt_cv_path_LD, -[if test -z "$LD"; then - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null; then - case $host_cpu in - i*86 ) - # Not sure whether the presence of OpenBSD here was a mistake. - # Let's accept both of them until this is cleared up. - lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[[3-9]]86 (compact )?demand paged shared library' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - ;; - esac - else - lt_cv_deplibs_check_method=pass_all - fi - ;; - -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - -hpux10.20* | hpux11*) - lt_cv_file_magic_cmd=/usr/bin/file - case "$host_cpu" in - ia64*) - lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - hppa*64*) - [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] - lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl - ;; - *) - lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' - lt_cv_file_magic_test_file=/usr/lib/libc.sl - ;; - esac - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - irix5* | nonstopux*) - # this will be overridden with pass_all, but let us keep it just in case - lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" - ;; - *) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - # this will be overridden with pass_all, but let us keep it just in case - lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[[1234]] dynamic lib MIPS - version 1" - ;; - esac - lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*` - lt_cv_deplibs_check_method=pass_all - ;; - -# This must be Linux ELF. -linux*) - case $host_cpu in - alpha* | hppa* | i*86 | ia64* | m68* | mips | mipsel | powerpc* | sparc* | s390* | sh*) - lt_cv_deplibs_check_method=pass_all ;; - *) - # glibc up to 2.1.1 does not perform some relocations on ARM - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; - esac - lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` - ;; - -netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' - fi - ;; - -newos6*) - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libnls.so - ;; - -nto-qnx) - lt_cv_deplibs_check_method=unknown - ;; - -openbsd*) - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object' - else - lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' - fi - ;; - -osf3* | osf4* | osf5*) - # this will be overridden with pass_all, but let us keep it just in case - lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' - lt_cv_file_magic_test_file=/shlib/libc.so - lt_cv_deplibs_check_method=pass_all - ;; - -sco3.2v5*) - lt_cv_deplibs_check_method=pass_all - ;; - -solaris*) - lt_cv_deplibs_check_method=pass_all - lt_cv_file_magic_test_file=/lib/libc.so - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - case $host_vendor in - motorola) - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` - ;; - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - sequent) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' - ;; - sni) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" - lt_cv_file_magic_test_file=/lib/libc.so - ;; - siemens) - lt_cv_deplibs_check_method=pass_all - ;; - esac - ;; - -sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; -esac -]) -file_magic_cmd=$lt_cv_file_magic_cmd -deplibs_check_method=$lt_cv_deplibs_check_method -test -z "$deplibs_check_method" && deplibs_check_method=unknown -])# AC_DEPLIBS_CHECK_METHOD - - -# AC_PROG_NM -# ---------- -# find the path to a BSD-compatible name lister -AC_DEFUN([AC_PROG_NM], -[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM, -[if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM="$NM" -else - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - tmp_nm="$ac_dir/${ac_tool_prefix}nm" - if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - # Tru64's nm complains that /dev/null is an invalid object file - case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in - */dev/null* | *'Invalid file or object type'*) - lt_cv_path_NM="$tmp_nm -B" - break - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break - ;; - *) - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - ;; - esac - esac - fi - done - IFS="$lt_save_ifs" - test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm -fi]) -NM="$lt_cv_path_NM" -])# AC_PROG_NM - - -# AC_CHECK_LIBM -# ------------- -# check for math library -AC_DEFUN([AC_CHECK_LIBM], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -LIBM= -case $host in -*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*) - # These system don't have libm, or don't need it - ;; -*-ncr-sysv4.3*) - AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") - AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") - ;; -*) - AC_CHECK_LIB(m, cos, LIBM="-lm") - ;; -esac -])# AC_CHECK_LIBM - - -# AC_LIBLTDL_CONVENIENCE([DIRECTORY]) -# ----------------------------------- -# sets LIBLTDL to the link flags for the libltdl convenience library and -# LTDLINCL to the include flags for the libltdl header and adds -# --enable-ltdl-convenience to the configure arguments. Note that LIBLTDL -# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If -# DIRECTORY is not provided, it is assumed to be `libltdl'. LIBLTDL will -# be prefixed with '${top_builddir}/' and LTDLINCL will be prefixed with -# '${top_srcdir}/' (note the single quotes!). If your package is not -# flat and you're not using automake, define top_builddir and -# top_srcdir appropriately in the Makefiles. -AC_DEFUN([AC_LIBLTDL_CONVENIENCE], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl - case $enable_ltdl_convenience in - no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; - "") enable_ltdl_convenience=yes - ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; - esac - LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la - LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) - # For backwards non-gettext consistent compatibility... - INCLTDL="$LTDLINCL" -])# AC_LIBLTDL_CONVENIENCE - - -# AC_LIBLTDL_INSTALLABLE([DIRECTORY]) -# ----------------------------------- -# sets LIBLTDL to the link flags for the libltdl installable library and -# LTDLINCL to the include flags for the libltdl header and adds -# --enable-ltdl-install to the configure arguments. Note that LIBLTDL -# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If -# DIRECTORY is not provided and an installed libltdl is not found, it is -# assumed to be `libltdl'. LIBLTDL will be prefixed with '${top_builddir}/' -# and LTDLINCL will be prefixed with '${top_srcdir}/' (note the single -# quotes!). If your package is not flat and you're not using automake, -# define top_builddir and top_srcdir appropriately in the Makefiles. -# In the future, this macro may have to be called after AC_PROG_LIBTOOL. -AC_DEFUN([AC_LIBLTDL_INSTALLABLE], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl - AC_CHECK_LIB(ltdl, lt_dlinit, - [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], - [if test x"$enable_ltdl_install" = xno; then - AC_MSG_WARN([libltdl not installed, but installation disabled]) - else - enable_ltdl_install=yes - fi - ]) - if test x"$enable_ltdl_install" = x"yes"; then - ac_configure_args="$ac_configure_args --enable-ltdl-install" - LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la - LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) - else - ac_configure_args="$ac_configure_args --enable-ltdl-install=no" - LIBLTDL="-lltdl" - LTDLINCL= - fi - # For backwards non-gettext consistent compatibility... - INCLTDL="$LTDLINCL" -])# AC_LIBLTDL_INSTALLABLE - - -# AC_LIBTOOL_CXX -# -------------- -# enable support for C++ libraries -AC_DEFUN([AC_LIBTOOL_CXX], -[AC_REQUIRE([_LT_AC_LANG_CXX]) -])# AC_LIBTOOL_CXX - - -# _LT_AC_LANG_CXX -# --------------- -AC_DEFUN([_LT_AC_LANG_CXX], -[AC_REQUIRE([AC_PROG_CXX]) -AC_REQUIRE([AC_PROG_CXXCPP]) -_LT_AC_SHELL_INIT([tagnames=`echo "$tagnames,CXX" | sed 's/^,//'`]) -])# _LT_AC_LANG_CXX - - -# AC_LIBTOOL_F77 -# -------------- -# enable support for Fortran 77 libraries -AC_DEFUN([AC_LIBTOOL_F77], -[AC_REQUIRE([_LT_AC_LANG_F77]) -])# AC_LIBTOOL_F77 - - -# _LT_AC_LANG_F77 -# --------------- -AC_DEFUN([_LT_AC_LANG_F77], -[AC_REQUIRE([AC_PROG_F77]) -_LT_AC_SHELL_INIT([tagnames=`echo "$tagnames,F77" | sed 's/^,//'`]) -])# _LT_AC_LANG_F77 - - -# AC_LIBTOOL_GCJ -# -------------- -# enable support for GCJ libraries -AC_DEFUN([AC_LIBTOOL_GCJ], -[AC_REQUIRE([_LT_AC_LANG_GCJ]) -])# AC_LIBTOOL_GCJ - - -# _LT_AC_LANG_GCJ -# --------------- -AC_DEFUN([_LT_AC_LANG_GCJ], -[AC_PROVIDE_IFELSE([AC_PROG_GCJ],[], - [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[], - [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[], - [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])], - [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])], - [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])]) -_LT_AC_SHELL_INIT([tagnames=`echo "$tagnames,GCJ" | sed 's/^,//'`]) -])# _LT_AC_LANG_GCJ - - -# AC_LIBTOOL_RC -# -------------- -# enable support for Windows resource files -AC_DEFUN([AC_LIBTOOL_RC], -[AC_REQUIRE([LT_AC_PROG_RC]) -_LT_AC_SHELL_INIT([tagnames=`echo "$tagnames,RC" | sed 's/^,//'`]) -])# AC_LIBTOOL_RC - - -# AC_LIBTOOL_LANG_C_CONFIG -# ------------------------ -# Ensure that the configuration vars for the C compiler are -# suitably defined. Those variables are subsequently used by -# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. -AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG]) -AC_DEFUN([_LT_AC_LANG_C_CONFIG], -[lt_save_CC="$CC" -AC_LANG_PUSH(C) - -# Source file extension for C test sources. -ac_ext=c - -# Object file extension for compiled C test sources. -objext=o -_LT_AC_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}\n' - -_LT_AC_SYS_COMPILER - -# -# Check for any special shared library compilation flags. -# -_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)= -if test "$GCC" = no; then - case $host_os in - sco3.2v5*) - _LT_AC_TAGVAR(lt_prog_cc_shlib, $1)='-belf' - ;; - esac -fi -if test -n "$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)"; then - AC_MSG_WARN([`$CC' requires `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to build shared libraries]) - if echo "$old_CC $old_CFLAGS " | grep "[[ ]]$]_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)[[[ ]]" >/dev/null; then : - else - AC_MSG_WARN([add `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to the CC or CFLAGS env variable and reconfigure]) - _LT_AC_TAGVAR(lt_cv_prog_cc_can_build_shared, $1)=no - fi -fi - - -# -# Check to make sure the static flag actually works. -# -AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $_LT_AC_TAGVAR(lt_prog_compiler_static, $1) works], - _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1), - $_LT_AC_TAGVAR(lt_prog_compiler_static, $1), - [], - [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=]) - - -## CAVEAT EMPTOR: -## There is no encapsulation within the following macros, do not change -## the running order or otherwise move them around unless you know exactly -## what you are doing... -AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) -AC_LIBTOOL_PROG_COMPILER_PIC($1) -AC_LIBTOOL_PROG_CC_C_O($1) -AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) -AC_LIBTOOL_PROG_LD_SHLIBS($1) -AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) -AC_LIBTOOL_SYS_LIB_STRIP -AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) -AC_LIBTOOL_DLOPEN_SELF($1) - -# Report which librarie types wil actually be built -AC_MSG_CHECKING([if libtool supports shared libraries]) -AC_MSG_RESULT([$can_build_shared]) - -AC_MSG_CHECKING([whether to build shared libraries]) -test "$can_build_shared" = "no" && enable_shared=no - -# On AIX, shared libraries and static libraries use the same namespace, and -# are all built from PIC. -case "$host_os" in -aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - -aix4*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; - darwin* | rhapsody*) - if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - case "$host_os" in - rhapsody* | darwin1.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' - ;; - *) # Darwin 1.3 on - test -z ${LD_TWOLEVEL_NAMESPACE} && _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - ;; - esac - # FIXME: Relying on posixy $() will cause problems for - # cross-compilation, but unfortunately the echo tests do not - # yet detect zsh echo's removal of \ escapes. Also zsh mangles - # `"' quotes if we put them in here... so don't! - output_verbose_link_cmd='echo' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring' - _LT_AC_TAGVAR(module_cmds, $1)='$CC -bundle $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -bundle $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_automatic, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - fi - ;; -esac -AC_MSG_RESULT([$enable_shared]) - -AC_MSG_CHECKING([whether to build static libraries]) -# Make sure either enable_shared or enable_static is yes. -test "$enable_shared" = yes || enable_static=yes -AC_MSG_RESULT([$enable_static]) - -AC_LIBTOOL_CONFIG($1) - -AC_LANG_POP -CC="$lt_save_CC" -])# AC_LIBTOOL_LANG_C_CONFIG - - -# AC_LIBTOOL_LANG_CXX_CONFIG -# -------------------------- -# Ensure that the configuration vars for the C compiler are -# suitably defined. Those variables are subsequently used by -# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. -AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)]) -AC_DEFUN([_LT_AC_LANG_CXX_CONFIG], -[AC_LANG_PUSH(C++) -AC_REQUIRE([AC_PROG_CXX]) -AC_REQUIRE([AC_PROG_CXXCPP]) - -_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_AC_TAGVAR(allow_undefined_flag, $1)= -_LT_AC_TAGVAR(always_export_symbols, $1)=no -_LT_AC_TAGVAR(archive_expsym_cmds, $1)= -_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_AC_TAGVAR(hardcode_direct, $1)=no -_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= -_LT_AC_TAGVAR(hardcode_libdir_separator, $1)= -_LT_AC_TAGVAR(hardcode_minus_L, $1)=no -_LT_AC_TAGVAR(hardcode_automatic, $1)=no -_LT_AC_TAGVAR(module_cmds, $1)= -_LT_AC_TAGVAR(module_expsym_cmds, $1)= -_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown -_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_AC_TAGVAR(no_undefined_flag, $1)= -_LT_AC_TAGVAR(whole_archive_flag_spec, $1)= -_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Dependencies to place before and after the object being linked: -_LT_AC_TAGVAR(predep_objects, $1)= -_LT_AC_TAGVAR(postdep_objects, $1)= -_LT_AC_TAGVAR(predeps, $1)= -_LT_AC_TAGVAR(postdeps, $1)= -_LT_AC_TAGVAR(compiler_lib_search_path, $1)= - -# Source file extension for C++ test sources. -ac_ext=cc - -# Object file extension for compiled C++ test sources. -objext=o -_LT_AC_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_AC_SYS_COMPILER - -# Allow CC to be a program name with arguments. -lt_save_CC=$CC -lt_save_LD=$LD -lt_save_GCC=$GCC -GCC=$GXX -lt_save_with_gnu_ld=$with_gnu_ld -lt_save_path_LD=$lt_cv_path_LD -if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then - lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx -else - unset lt_cv_prog_gnu_ld -fi -if test -n "${lt_cv_path_LDCXX+set}"; then - lt_cv_path_LD=$lt_cv_path_LDCXX -else - unset lt_cv_path_LD -fi -test -z "${LDCXX+set}" || LD=$LDCXX -CC=${CXX-"c++"} -compiler=$CC -_LT_AC_TAGVAR(compiler, $1)=$CC -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` - -# We don't want -fno-exception wen compiling C++ code, so set the -# no_builtin_flag separately -if test "$GXX" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' -else - _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= -fi - -if test "$GXX" = yes; then - # Set up default GNU C++ configuration - - AC_PROG_LD - - # Check if GNU C++ uses GNU ld as the underlying linker, since the - # archiving commands below assume that GNU ld is being used. - if test "$with_gnu_ld" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - - # If archive_cmds runs LD, not CC, wlarc should be empty - # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to - # investigate it a little bit more. (MM) - wlarc='${wl}' - - # ancient GNU ld didn't support --whole-archive et. al. - if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ - grep 'no-whole-archive' > /dev/null; then - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - fi - else - with_gnu_ld=no - wlarc= - - # A generic and very simple default shared library creation - # command for GNU C++ for the case where it uses the native - # linker, instead of GNU ld. If possible, this setting should - # overridden to take advantage of the native linker features on - # the platform it is being used on. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - fi - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - -else - GXX=no - with_gnu_ld=no - wlarc= -fi - -# PORTME: fill in a description of your system's C++ link characteristics -AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) -_LT_AC_TAGVAR(ld_shlibs, $1)=yes -case $host_os in - aix3*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) - for ld_flag in $LDFLAGS; do - case $ld_flag in - *-brtl*) - aix_use_runtimelinking=yes - break - ;; - esac - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - _LT_AC_TAGVAR(archive_cmds, $1)='' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - - if test "$GXX" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - else - # We have old collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= - fi - esac - shared_flag='-shared' - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' - _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - # Exported symbols can be pulled into shared objects from archives - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds it's shared libraries. - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - chorus*) - case $cc_basename in - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(always_export_symbols, $1)=no - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - darwin* | rhapsody*) - if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - case "$host_os" in - rhapsody* | darwin1.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' - ;; - *) # Darwin 1.3 on - test -z ${LD_TWOLEVEL_NAMESPACE} && _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - ;; - esac - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - _LT_AC_TAGVAR(module_cmds, $1)='$CC -bundle ${wl}-bind_at_load $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags' - - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -bundle $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_automatic, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - fi - ;; - - dgux*) - case $cc_basename in - ec++) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - ghcx) - # Green Hills C++ Compiler - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - freebsd[12]*) - # C++ shared libraries reported to be fairly broken before switch to ELF - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - freebsd-elf*) - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - ;; - freebsd*) - # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF - # conventions - _LT_AC_TAGVAR(ld_shlibs, $1)=yes - ;; - gnu*) - ;; - hpux9*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - aCC) - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | egrep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - hpux10*|hpux11*) - if test $with_gnu_ld = no; then - case "$host_cpu" in - hppa*64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - ia64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - ;; - *) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - ;; - esac - fi - case "$host_cpu" in - hppa*64*) - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - ia64*) - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - *) - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - esac - - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - aCC) - case "$host_cpu" in - hppa*64*|ia64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes; then - if test $with_gnu_ld = no; then - case "$host_cpu" in - ia64*|hppa*64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - fi - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - irix5* | irix6*) - case $cc_basename in - CC) - # SGI C++ - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - - # Archives containing C++ object files must be created using - # "CC -ar", where "CC" is the IRIX C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' - ;; - *) - if test "$GXX" = yes; then - if test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' - fi - fi - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - ;; - esac - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - linux*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' - ;; - icpc) - # Intel C++ - with_gnu_ld=yes - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - ;; - cxx) - # Compaq C++ - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' - - runpath_var=LD_RUN_PATH - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - esac - ;; - lynxos*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - m88k*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - mvs*) - case $cc_basename in - cxx) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' - wlarc= - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - fi - # Workaround some broken pre-1.5 toolchains - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' - ;; - osf3*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' - - ;; - RCC) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - cxx) - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - osf4* | osf5*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Archives containing C++ object files must be created using - # the KAI C++ compiler. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' - ;; - RCC) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - cxx) - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ - echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ - $rm $lib.exp' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - psos*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - sco*) - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC) - # Sun C++ 4.x - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - lcc) - # Lucid - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - solaris*) - case $cc_basename in - CC) - # Sun C++ 4.2, 5.x and Centerline C++ - _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The C++ compiler is used as linker so we must use $wl - # flag to pass the commands to the underlying system - # linker. - # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - ;; - esac - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[[LR]]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' - ;; - gcx) - # Green Hills C++ Compiler - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - - # The C++ compiler must be used to create the archive. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' - ;; - *) - # GNU C++ compiler with Solaris linker - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' - if $CC --version | grep -v '^2\.7' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" - else - # g++ 2.7 appears to require `-G' NOT `-shared' on this - # platform. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" - fi - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' - fi - ;; - esac - ;; - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - ;; - tandem*) - case $cc_basename in - NCC) - # NonStop-UX NCC 3.20 - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - vxworks*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; -esac -AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) -test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - -_LT_AC_TAGVAR(GCC, $1)="$GXX" -_LT_AC_TAGVAR(LD, $1)="$LD" - -## CAVEAT EMPTOR: -## There is no encapsulation within the following macros, do not change -## the running order or otherwise move them around unless you know exactly -## what you are doing... -AC_LIBTOOL_POSTDEP_PREDEP($1) -AC_LIBTOOL_PROG_COMPILER_PIC($1) -AC_LIBTOOL_PROG_CC_C_O($1) -AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) -AC_LIBTOOL_PROG_LD_SHLIBS($1) -AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) -AC_LIBTOOL_SYS_LIB_STRIP -AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) -AC_LIBTOOL_DLOPEN_SELF($1) - -AC_LIBTOOL_CONFIG($1) - -AC_LANG_POP -CC=$lt_save_CC -LDCXX=$LD -LD=$lt_save_LD -GCC=$lt_save_GCC -with_gnu_ldcxx=$with_gnu_ld -with_gnu_ld=$lt_save_with_gnu_ld -lt_cv_path_LDCXX=$lt_cv_path_LD -lt_cv_path_LD=$lt_save_path_LD -lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld -lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld -])# AC_LIBTOOL_LANG_CXX_CONFIG - -# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME]) -# ------------------------ -# Figure out "hidden" library dependencies from verbose -# compiler output when linking a shared library. -# Parse the compiler output and extract the necessary -# objects, libraries and library flags. -AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[ -dnl we can't use the lt_simple_compile_test_code here, -dnl because it contains code intended for an executable, -dnl not a library. It's possible we should let each -dnl tag define a new lt_????_link_test_code variable, -dnl but it's only used here... -ifelse([$1],[],[cat > conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext <> "$cfgfile" -ifelse([$1], [], -[#! $SHELL - -# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. -# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) -# NOTE: Changes made to this file will be lost: look at ltmain.sh. -# -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 -# Free Software Foundation, Inc. -# -# This file is part of GNU Libtool: -# Originally by Gordon Matzigkeit , 1996 -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# A sed program that does not truncate output. -SED=$lt_SED - -# Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="$SED -e s/^X//" - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi - -# The names of the tagged configurations supported by this script. -available_tags= - -# ### BEGIN LIBTOOL CONFIG], -[# ### BEGIN LIBTOOL TAG CONFIG: $tagname]) - -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1) - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host - -# An echo program that does not interpret backslashes. -echo=$lt_echo - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# A C compiler. -LTCC=$lt_LTCC - -# A language-specific compiler. -CC=$lt_[]_LT_AC_TAGVAR(compiler, $1) - -# Is the compiler the GNU C compiler? -with_gcc=$_LT_AC_TAGVAR(GCC, $1) - -# An ERE matcher. -EGREP=$lt_EGREP - -# The linker used to build libraries. -LD=$lt_[]_LT_AC_TAGVAR(LD, $1) - -# Whether we need hard or soft links. -LN_S=$lt_LN_S - -# A BSD-compatible nm program. -NM=$lt_NM - -# A symbol stripping program -STRIP=$STRIP - -# Used to examine libraries when file_magic_cmd begins "file" -MAGIC_CMD=$MAGIC_CMD - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" - -# Used on cygwin: assembler. -AS="$AS" - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# How to pass a linker flag through the compiler. -wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) - -# Object file suffix (normally "o"). -objext="$ac_objext" - -# Old archive suffix (normally "a"). -libext="$libext" - -# Shared library suffix (normally ".so"). -shrext='$shrext' - -# Executable file suffix (normally ""). -exeext="$exeext" - -# Additional compiler flags for building library objects. -pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) -pic_mode=$pic_mode - -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) - -# Must we lock files when doing compilation ? -need_locks=$lt_need_locks - -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1) - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1) - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1) - -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1) - -# Library versioning type. -version_type=$version_type - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Commands used to build and install an old-style archive. -RANLIB=$lt_RANLIB -old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1) -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1) - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) - -# Commands used to build and install a shared archive. -archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1) -archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1) -postinstall_cmds=$lt_postinstall_cmds -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1) -module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1) - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1) - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1) - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1) - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1) - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$lt_file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1) - -# Flag that forces no undefined symbols. -no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1) - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$lt_finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1) - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) - -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1) - -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1) - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1) - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1) - -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1) - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at relink time. -variables_saved_for_relink="$variables_saved_for_relink" - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1) - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$_LT_AC_TAGVAR(fix_srcfile_path, $1)" - -# Set to yes if exported symbols are required. -always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1) - -# The commands to list exported symbols. -export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1) - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1) - -# Symbols that must always be exported. -include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1) - -ifelse([$1],[], -[# ### END LIBTOOL CONFIG], -[# ### END LIBTOOL TAG CONFIG: $tagname]) - -__EOF__ - -ifelse([$1],[], [ - case $host_os in - aix3*) - cat <<\EOF >> "$cfgfile" - -# AIX sometimes has problems with the GCC collect2 program. For some -# reason, if we set the COLLECT_NAMES environment variable, the problems -# vanish in a puff of smoke. -if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES -fi -EOF - ;; - esac - - # We use sed instead of cat because bash on DJGPP gets confused if - # if finds mixed CR/LF and LF-only lines. Since sed operates in - # text mode, it properly converts lines to CR/LF. This bash problem - # is reportedly fixed, but why not run on old versions too? - sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) - - mv -f "$cfgfile" "$ofile" || \ - (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") - chmod +x "$ofile" -]) -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - test -f Makefile && make "$ltmain" -fi -])# AC_LIBTOOL_CONFIG - - -# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME]) -# ------------------------------------------- -AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], -[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl - -_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= - -if test "$GCC" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' - - AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], - lt_cv_prog_compiler_rtti_exceptions, - [-fno-rtti -fno-exceptions], [], - [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) -fi -])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI - - -# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE -# --------------------------------- -AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], -[AC_REQUIRE([AC_CANONICAL_HOST]) -AC_REQUIRE([AC_PROG_NM]) -AC_REQUIRE([AC_OBJEXT]) -# Check for command to grab the raw symbol name followed by C symbol from nm. -AC_MSG_CHECKING([command to parse $NM output from $compiler object]) -AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], -[ -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[[BCDEGRST]]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' - -# Transform the above into a raw symbol and a C symbol. -symxfrm='\1 \2\3 \3' - -# Transform an extracted symbol line into a proper C declaration -lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[[BCDT]]' - ;; -cygwin* | mingw* | pw32*) - symcode='[[ABCDGISTW]]' - ;; -hpux*) # Its linker distinguishes data from code symbols - if test "$host_cpu" = ia64; then - symcode='[[ABCDEGRST]]' - fi - lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - ;; -irix* | nonstopux*) - symcode='[[BCDEGRST]]' - ;; -osf*) - symcode='[[BCDEGQRST]]' - ;; -solaris* | sysv5*) - symcode='[[BDT]]' - ;; -sysv4) - symcode='[[DFNSTU]]' - ;; -esac - -# Handle CRLF in mingw tool chain -opt_cr= -case $build_os in -mingw*) - opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -case `$NM -V 2>&1` in -*GNU* | *'with BFD'*) - symcode='[[ABCDGISTW]]' ;; -esac - -# Try without a prefix undercore, then with it. -for ac_symprfx in "" "_"; do - - # Write the raw and C identifiers. - lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" - - # Check to see that the pipe works correctly. - pipe_works=no - - rm -f conftest* - cat > conftest.$ac_ext < $nlist) && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if grep ' nm_test_var$' "$nlist" >/dev/null; then - if grep ' nm_test_func$' "$nlist" >/dev/null; then - cat < conftest.$ac_ext -#ifdef __cplusplus -extern "C" { -#endif - -EOF - # Now generate the symbol file. - eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' - - cat <> conftest.$ac_ext -#if defined (__STDC__) && __STDC__ -# define lt_ptr_t void * -#else -# define lt_ptr_t char * -# define const -#endif - -/* The mapping between symbol names and symbols. */ -const struct { - const char *name; - lt_ptr_t address; -} -lt_preloaded_symbols[[]] = -{ -EOF - $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext - cat <<\EOF >> conftest.$ac_ext - {0, (lt_ptr_t) 0} -}; - -#ifdef __cplusplus -} -#endif -EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - lt_save_LIBS="$LIBS" - lt_save_CFLAGS="$CFLAGS" - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" - if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then - pipe_works=yes - fi - LIBS="$lt_save_LIBS" - CFLAGS="$lt_save_CFLAGS" - else - echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD - fi - else - echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD - fi - else - echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD - cat conftest.$ac_ext >&5 - fi - rm -f conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done -]) -if test -z "$lt_cv_sys_global_symbol_pipe"; then - lt_cv_sys_global_symbol_to_cdecl= -fi -if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then - AC_MSG_RESULT(failed) -else - AC_MSG_RESULT(ok) -fi -]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE - - -# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME]) -# --------------------------------------- -AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC], -[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)= -_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= -_LT_AC_TAGVAR(lt_prog_compiler_static, $1)= - -AC_MSG_CHECKING([for $compiler option to produce PIC]) - ifelse([$1],[CXX],[ - # C++ specific cases for pic, static, wl, etc. - if test "$GXX" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' - ;; - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - mingw* | os2* | pw32*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' - ;; - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - ;; - *djgpp*) - # DJGPP does not support shared libraries at all - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - ;; - sysv4*MP*) - if test -d /usr/nec; then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic - fi - ;; - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - else - case $host_os in - aix4* | aix5*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - else - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' - fi - ;; - chorus*) - case $cc_basename in - cxch68) - # Green Hills C++ Compiler - # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" - ;; - esac - ;; - dgux*) - case $cc_basename in - ec++) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - ;; - ghcx) - # Green Hills C++ Compiler - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - *) - ;; - esac - ;; - freebsd*) - # FreeBSD uses GNU C++ - ;; - hpux9* | hpux10* | hpux11*) - case $cc_basename in - CC) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" - if test "$host_cpu" != ia64; then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - fi - ;; - aCC) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - ;; - esac - ;; - *) - ;; - esac - ;; - irix5* | irix6* | nonstopux*) - case $cc_basename in - CC) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - # CC pic flag -KPIC is the default. - ;; - *) - ;; - esac - ;; - linux*) - case $cc_basename in - KCC) - # KAI C++ Compiler - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - icpc) - # Intel C++ - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - cxx) - # Compaq C++ - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - *) - ;; - esac - ;; - lynxos*) - ;; - m88k*) - ;; - mvs*) - case $cc_basename in - cxx) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' - ;; - *) - ;; - esac - ;; - netbsd*) - ;; - osf3* | osf4* | osf5*) - case $cc_basename in - KCC) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' - ;; - RCC) - # Rational C++ 2.4.1 - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - cxx) - # Digital/Compaq C++ - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - *) - ;; - esac - ;; - psos*) - ;; - sco*) - case $cc_basename in - CC) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - *) - ;; - esac - ;; - solaris*) - case $cc_basename in - CC) - # Sun C++ 4.2, 5.x and Centerline C++ - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - ;; - gcx) - # Green Hills C++ Compiler - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - ;; - *) - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC) - # Sun C++ 4.x - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - lcc) - # Lucid - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - *) - ;; - esac - ;; - tandem*) - case $cc_basename in - NCC) - # NonStop-UX NCC 3.20 - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - ;; - *) - ;; - esac - ;; - unixware*) - ;; - vxworks*) - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - esac - fi -], -[ - if test "$GCC" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' - ;; - - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - enable_shared=no - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic - fi - ;; - - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - ;; - - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - else - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' - fi - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' - ;; - - hpux9* | hpux10* | hpux11*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # PIC (with -KPIC) is the default. - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - newsos6) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - linux*) - case $CC in - icc|ecc) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - ccc) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # All Alpha code is PIC. - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - esac - ;; - - osf3* | osf4* | osf5*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # All OSF/1 code is PIC. - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - sco3.2v5*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kpic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-dn' - ;; - - solaris*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sunos4*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - uts4*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - *) - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - esac - fi -]) -AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)]) - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then - AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works], - _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1), - [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [], - [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in - "" | " "*) ;; - *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;; - esac], - [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) -fi -case "$host_os" in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])" - ;; -esac -]) - - -# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME]) -# ------------------------------------ -# See if the linker supports building shared libraries. -AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS], -[AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) -ifelse([$1],[CXX],[ - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - case $host_os in - aix4* | aix5*) - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - else - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - fi - ;; - pw32*) - _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" - ;; - cygwin* | mingw*) - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' - ;; - *) - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - ;; - esac -],[ - runpath_var= - _LT_AC_TAGVAR(allow_undefined_flag, $1)= - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no - _LT_AC_TAGVAR(archive_cmds, $1)= - _LT_AC_TAGVAR(archive_expsym_cmds, $1)= - _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)= - _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)= - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - _LT_AC_TAGVAR(thread_safe_flag_spec, $1)= - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_minus_L, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown - _LT_AC_TAGVAR(hardcode_automatic, $1)=no - _LT_AC_TAGVAR(module_cmds, $1)= - _LT_AC_TAGVAR(module_expsym_cmds, $1)= - _LT_AC_TAGVAR(always_export_symbols, $1)=no - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - _LT_AC_TAGVAR(include_expsyms, $1)= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_" - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - openbsd*) - with_gnu_ld=no - ;; - esac - - _LT_AC_TAGVAR(ld_shlibs, $1)=yes - if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # See if GNU ld supports shared libraries. - case $host_os in - aix3* | aix4* | aix5*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - _LT_AC_TAGVAR(ld_shlibs, $1)=no - cat <&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -EOF - fi - ;; - - amigaos*) - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - - # Samuel A. Falvo II reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can't use - # them. - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - - beos*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(always_export_symbols, $1)=no - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - else - ld_shlibs=no - fi - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris* | sysv5*) - if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then - _LT_AC_TAGVAR(ld_shlibs, $1)=no - cat <&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -EOF - elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - sunos4*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - - if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = yes; then - runpath_var=LD_RUN_PATH - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - fi - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - if test "$GCC" = yes && test -z "$link_static_flag"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported - fi - ;; - - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - else - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - _LT_AC_TAGVAR(archive_cmds, $1)='' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - - if test "$GCC" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - else - # We have old collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= - fi - esac - shared_flag='-shared' - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' - _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - # Exported symbols can be pulled into shared objects from archives - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds it's shared libraries. - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - # see comment about different semantics on the GNU ld section - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - - bsdi4*) - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic - ;; - - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext=".dll" - # FIXME: Setting linknames here is a bad hack. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true' - # FIXME: Should let the user specify the lib program. - _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - ;; - - darwin* | rhapsody*) - if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - case "$host_os" in - rhapsody* | darwin1.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' - ;; - *) # Darwin 1.3 on - test -z ${LD_TWOLEVEL_NAMESPACE} && _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - ;; - esac - # FIXME: Relying on posixy $() will cause problems for - # cross-compilation, but unfortunately the echo tests do not - # yet detect zsh echo's removal of \ escapes. Also zsh mangles - # `"' quotes if we put them in here... so don't! - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - _LT_AC_TAGVAR(module_cmds, $1)='$CC -bundle ${wl}-bind_at_load $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -bundle $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_automatic, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - fi - ;; - - dgux*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - freebsd1*) - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd*) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - hpux9*) - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - ;; - - hpux10* | hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*|ia64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case "$host_cpu" in - hppa*64*|ia64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - ;; - esac - fi - if test "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - ia64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - ;; - *) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - newsos6) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - openbsd*) - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - else - case $host_os in - openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - ;; - esac - fi - ;; - - os2*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - else - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' - - # Both c and cxx compiler support -rpath directly - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - fi - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - - sco3.2v5*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ;; - - solaris*) - _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; - esac - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv4) - case $host_vendor in - sni) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - ;; - motorola) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv4.3*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - _LT_AC_TAGVAR(ld_shlibs, $1)=yes - fi - ;; - - sysv4.2uw2*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; - - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) - _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z ${wl}text' - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - runpath_var='LD_RUN_PATH' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv5*) - _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var='LD_RUN_PATH' - ;; - - uts4*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *) - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - fi -]) -AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) -test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -# -# Do we need to explicitly link libc? -# -case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in -x|xyes) - # Assume -lc should be added - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $_LT_AC_TAGVAR(archive_cmds, $1) in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - AC_MSG_CHECKING([whether -lc should be explicitly linked in]) - $rm conftest* - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - if AC_TRY_EVAL(ac_compile) 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1) - _LT_AC_TAGVAR(allow_undefined_flag, $1)= - if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) - then - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - else - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - fi - _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $rm conftest* - AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)]) - ;; - esac - fi - ;; -esac -])# AC_LIBTOOL_PROG_LD_SHLIBS - - -# _LT_AC_FILE_LTDLL_C -# ------------------- -# Be careful that the start marker always follows a newline. -AC_DEFUN([_LT_AC_FILE_LTDLL_C], [ -# /* ltdll.c starts here */ -# #define WIN32_LEAN_AND_MEAN -# #include -# #undef WIN32_LEAN_AND_MEAN -# #include -# -# #ifndef __CYGWIN__ -# # ifdef __CYGWIN32__ -# # define __CYGWIN__ __CYGWIN32__ -# # endif -# #endif -# -# #ifdef __cplusplus -# extern "C" { -# #endif -# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); -# #ifdef __cplusplus -# } -# #endif -# -# #ifdef __CYGWIN__ -# #include -# DECLARE_CYGWIN_DLL( DllMain ); -# #endif -# HINSTANCE __hDllInstance_base; -# -# BOOL APIENTRY -# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) -# { -# __hDllInstance_base = hInst; -# return TRUE; -# } -# /* ltdll.c ends here */ -])# _LT_AC_FILE_LTDLL_C - - -# _LT_AC_TAGVAR(VARNAME, [TAGNAME]) -# --------------------------------- -AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])]) - - -# old names -AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) -AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) -AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) -AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) -AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) -AC_DEFUN([AM_PROG_LD], [AC_PROG_LD]) -AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) - -# This is just to silence aclocal about the macro not being used -ifelse([AC_DISABLE_FAST_INSTALL]) - -AC_DEFUN([LT_AC_PROG_GCJ], -[AC_CHECK_TOOL(GCJ, gcj, no) - test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" - AC_SUBST(GCJFLAGS) -]) - -AC_DEFUN([LT_AC_PROG_RC], -[AC_CHECK_TOOL(RC, windres, no) -]) - -############################################################ -# NOTE: This macro has been submitted for inclusion into # -# GNU Autoconf as AC_PROG_SED. When it is available in # -# a released version of Autoconf we should remove this # -# macro and use it instead. # -############################################################ -# LT_AC_PROG_SED -# -------------- -# Check for a fully-functional sed program, that truncates -# as few characters as possible. Prefer GNU sed if found. -AC_DEFUN([LT_AC_PROG_SED], -[AC_MSG_CHECKING([for a sed that does not truncate output]) -AC_CACHE_VAL(lt_cv_path_SED, -[# Loop through the user's path and test for sed and gsed. -# Then use that list of sed's as ones to test for truncation. -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for lt_ac_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then - lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" - fi - done - done -done -lt_ac_max=0 -lt_ac_count=0 -# Add /usr/xpg4/bin/sed as it is typically found on Solaris -# along with /bin/sed that truncates output. -for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do - test ! -f $lt_ac_sed && break - cat /dev/null > conftest.in - lt_ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >conftest.in - # Check for GNU sed and select it if it is found. - if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then - lt_cv_path_SED=$lt_ac_sed - break - fi - while true; do - cat conftest.in conftest.in >conftest.tmp - mv conftest.tmp conftest.in - cp conftest.in conftest.nl - echo >>conftest.nl - $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break - cmp -s conftest.out conftest.nl || break - # 10000 chars as input seems more than enough - test $lt_ac_count -gt 10 && break - lt_ac_count=`expr $lt_ac_count + 1` - if test $lt_ac_count -gt $lt_ac_max; then - lt_ac_max=$lt_ac_count - lt_cv_path_SED=$lt_ac_sed - fi - done -done -SED=$lt_cv_path_SED -]) -AC_MSG_RESULT([$SED]) -]) -############################################################################# -# Additional Macros -############################################################################# - -# -# Check for C++ namespace support. This is from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_namespaces.html -# -AC_DEFUN([AC_CXX_NAMESPACES], -[AC_CACHE_CHECK(whether the compiler implements namespaces, -ac_cv_cxx_namespaces, -[AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_COMPILE([namespace Outer { namespace Inner { int i = 0; }}], - [using namespace Outer::Inner; return i;], - ac_cv_cxx_namespaces=yes, ac_cv_cxx_namespaces=no) - AC_LANG_RESTORE -]) -if test "$ac_cv_cxx_namespaces" = yes; then - AC_DEFINE(HAVE_NAMESPACES,,[define if the compiler implements namespaces]) -fi -]) - -# -# Check for hash_map extension. This is from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_hash_map.html -# -AC_DEFUN([AC_CXX_HAVE_EXT_HASH_MAP], -[AC_CACHE_CHECK(whether the compiler has ext/hash_map, -ac_cv_cxx_have_ext_hash_map, -[AC_REQUIRE([AC_CXX_NAMESPACES]) - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_COMPILE([#include -#ifdef HAVE_NAMESPACES -using namespace std; -#endif],[hash_map t; return 0;], - ac_cv_cxx_have_ext_hash_map=std, ac_cv_cxx_have_ext_hash_map=no) - AC_TRY_COMPILE([#include -#ifdef HAVE_NAMESPACES -using namespace __gnu_cxx; -#endif],[hash_map t; return 0;], - ac_cv_cxx_have_ext_hash_map=gnu, ac_cv_cxx_have_ext_hash_map=no) - AC_LANG_RESTORE -]) -if test "$ac_cv_cxx_have_ext_hash_map" = std; then - AC_DEFINE(HAVE_STD_EXT_HASH_MAP,,[define if the compiler has ext/hash_map]) -fi -if test "$ac_cv_cxx_have_ext_hash_map" = gnu; then - AC_DEFINE(HAVE_GNU_EXT_HASH_MAP,,[define if the compiler has ext/hash_map]) -fi -]) - -# -# Check for hash_set extension. This is modified from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_hash_set.html -# -AC_DEFUN([AC_CXX_HAVE_EXT_HASH_SET], -[AC_CACHE_CHECK(whether the compiler has ext/hash_set, -ac_cv_cxx_have_ext_hash_set, -[AC_REQUIRE([AC_CXX_NAMESPACES]) - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_COMPILE([#include -#ifdef HAVE_NAMESPACES -using namespace std; -#endif],[hash_set t; return 0;], - ac_cv_cxx_have_ext_hash_set=std, ac_cv_cxx_have_ext_hash_set=no) - AC_TRY_COMPILE([#include -#ifdef HAVE_NAMESPACES -using namespace __gnu_cxx; -#endif],[hash_set t; return 0;], - ac_cv_cxx_have_ext_hash_set=gnu, ac_cv_cxx_have_ext_hash_set=no) - AC_LANG_RESTORE -]) -if test "$ac_cv_cxx_have_ext_hash_set" = std; then - AC_DEFINE(HAVE_STD_EXT_HASH_SET,,[define if the compiler has ext/hash_set in std]) -fi -if test "$ac_cv_cxx_have_ext_hash_set" = gnu; then - AC_DEFINE(HAVE_GNU_EXT_HASH_SET,,[define if the compiler has ext/hash_set in __gnu_cc]) -fi -]) - -# -# Check for standard iterator extension. This is modified from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_hash_set.html -# -AC_DEFUN([AC_CXX_HAVE_STD_ITERATOR], -[AC_CACHE_CHECK(whether the compiler has the standard iterator, -ac_cv_cxx_have_std_iterator, -[AC_REQUIRE([AC_CXX_NAMESPACES]) - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_COMPILE([#include -#ifdef HAVE_NAMESPACES -using namespace std; -#endif],[iterator t; return 0;], - ac_cv_cxx_have_std_iterator=yes, ac_cv_cxx_have_std_iterator=no) - AC_LANG_RESTORE -]) -if test "$ac_cv_cxx_have_std_iterator" = yes; then - AC_DEFINE(HAVE_STD_ITERATOR,,[define if the compiler has STL iterators]) -fi -]) - -# -# Check for bidirectional iterator extension. This is modified from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_hash_set.html -# -AC_DEFUN([AC_CXX_HAVE_BI_ITERATOR], -[AC_CACHE_CHECK(whether the compiler has the bidirectional iterator, -ac_cv_cxx_have_bi_iterator, -[AC_REQUIRE([AC_CXX_NAMESPACES]) - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_COMPILE([#include -#ifdef HAVE_NAMESPACES -using namespace std; -#endif],[bidirectional_iterator t; return 0;], - ac_cv_cxx_have_bi_iterator=yes, ac_cv_cxx_have_bi_iterator=no) - AC_LANG_RESTORE -]) -if test "$ac_cv_cxx_have_bi_iterator" = yes; then - AC_DEFINE(HAVE_BI_ITERATOR,,[define if the compiler has bidirectional iterator]) -fi -]) - -# -# Check for forward iterator extension. This is modified from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_hash_set.html -# -AC_DEFUN([AC_CXX_HAVE_FWD_ITERATOR], -[AC_CACHE_CHECK(whether the compiler has forward iterators, -ac_cv_cxx_have_fwd_iterator, -[AC_REQUIRE([AC_CXX_NAMESPACES]) - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_COMPILE([#include -#ifdef HAVE_NAMESPACES -using namespace std; -#endif],[forward_iterator t; return 0;], - ac_cv_cxx_have_fwd_iterator=yes, ac_cv_cxx_have_fwd_iterator=no) - AC_LANG_RESTORE -]) -if test "$ac_cv_cxx_have_fwd_iterator" = yes; then - AC_DEFINE(HAVE_FWD_ITERATOR,,[define if the compiler has STL iterators]) -fi -]) - -# -# Check for slist extension. This is from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_slist.html -# -AC_DEFUN([AC_CXX_HAVE_EXT_SLIST], -[AC_CACHE_CHECK(whether the compiler has ext/slist, -ac_cv_cxx_have_ext_slist, -[AC_REQUIRE([AC_CXX_NAMESPACES]) - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_COMPILE([#include -#ifdef HAVE_NAMESPACES -using namespace std; -#endif],[slist s; return 0;], - ac_cv_cxx_have_ext_slist=std, ac_cv_cxx_have_ext_slist=no) - AC_TRY_COMPILE([#include -#ifdef HAVE_NAMESPACES -using namespace __gnu_cxx; -#endif],[slist s; return 0;], - ac_cv_cxx_have_ext_slist=gnu, ac_cv_cxx_have_ext_slist=no) - - AC_LANG_RESTORE -]) -if test "$ac_cv_cxx_have_ext_slist" = std; then - AC_DEFINE(HAVE_EXT_SLIST,std,[define if the compiler has ext/slist]) -fi -if test "$ac_cv_cxx_have_ext_slist" = gnu; then - AC_DEFINE(HAVE_EXT_SLIST,gnu,[define if the compiler has ext/slist]) -fi -]) - -# -# Check for FLEX. This is modified from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_namespaces.html -# -AC_DEFUN([AC_PROG_FLEX], -[AC_CACHE_CHECK(, -ac_cv_has_flex, -[AC_PROG_LEX() -]) -if test "$LEX" != "flex"; then - AC_MSG_ERROR([flex not found but required]) -fi -]) - -# -# Check for Bison. This is modified from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_namespaces.html -# -AC_DEFUN([AC_PROG_BISON], -[AC_CACHE_CHECK(, -ac_cv_has_bison, -[AC_PROG_YACC() -]) -if test "$YACC" != "bison -y"; then - AC_MSG_ERROR([bison not found but required]) -else - AC_SUBST(YACC,[bison],[location of bison]) -fi -]) - -# -# Check for GNU Make. This is from -# http://www.gnu.org/software/ac-archive/htmldoc/check_gnu_make.html -# -AC_DEFUN( - [CHECK_GNU_MAKE], [ AC_CACHE_CHECK( for GNU make,_cv_gnu_make_command, - _cv_gnu_make_command='' ; -dnl Search all the common names for GNU make - for a in "$MAKE" make gmake gnumake ; do - if test -z "$a" ; then continue ; fi ; - if ( sh -c "$a --version" 2> /dev/null | grep GNU 2>&1 > /dev/null ) ; then - _cv_gnu_make_command=$a ; - break; - fi - done ; - ) ; -dnl If there was a GNU version, then set @ifGNUmake@ to the empty string, '#' otherwise - if test "x$_cv_gnu_make_command" != "x" ; then - ifGNUmake='' ; - else - ifGNUmake='#' ; - AC_MSG_RESULT("Not found"); - fi - AC_SUBST(ifGNUmake) -] ) - -# -# Check for the ability to mmap a file. This is modified from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_slist.html -# -AC_DEFUN([AC_FUNC_MMAP_FILE], -[AC_CACHE_CHECK(for mmap of files, -ac_cv_func_mmap_file, -[AC_LANG_SAVE - AC_LANG_C - AC_TRY_RUN([ -#ifdef HAVE_SYS_MMAN_H -#include -#endif - -#ifdef HAVE_SYS_TYPES_H -#include -#endif - -#ifdef HAVE_FCNTL_H -#include -#endif - - int fd; - int main () { - fd = creat ("foo",0777); fd = (int) mmap (0, 1, PROT_READ, MAP_SHARED, fd, 0); unlink ("foo"); return (fd != MAP_FAILED);}], - ac_cv_func_mmap_file=yes, ac_cv_func_mmap_file=no) - AC_LANG_RESTORE -]) -if test "$ac_cv_func_mmap_file" = yes; then - AC_DEFINE(HAVE_MMAP_FILE) - AC_SUBST(MMAP_FILE,[yes]) -fi -]) - -# -# Check for anonymous mmap macros. This is modified from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_slist.html -# -AC_DEFUN([AC_HEADER_MMAP_ANONYMOUS], -[AC_CACHE_CHECK(for MAP_ANONYMOUS vs. MAP_ANON, -ac_cv_header_mmap_anon, -[AC_LANG_SAVE - AC_LANG_C - AC_TRY_COMPILE([#include - #include - #include ], - [mmap (0, 1, PROT_READ, MAP_ANONYMOUS, -1, 0); return (0);], - ac_cv_header_mmap_anon=yes, ac_cv_header_mmap_anon=no) - AC_LANG_RESTORE -]) -if test "$ac_cv_header_mmap_anon" = yes; then - AC_DEFINE(HAVE_MMAP_ANONYMOUS) -fi -]) +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 +# Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. # # Configure a Makefile without clobbering it if it exists and is not out of -# date. This is modified from: -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_slist.html +# date. This macro is unique to LLVM. # AC_DEFUN([AC_CONFIG_MAKEFILE], [AC_CONFIG_COMMANDS($1,${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/$1 $1,${srcdir}/autoconf/mkinstalldirs `dirname $1`) ]) - Index: llvm/projects/sample/autoconf/configure.ac diff -u llvm/projects/sample/autoconf/configure.ac:1.2 llvm/projects/sample/autoconf/configure.ac:1.3 --- llvm/projects/sample/autoconf/configure.ac:1.2 Sat Jan 1 03:26:55 2005 +++ llvm/projects/sample/autoconf/configure.ac Wed Jan 5 00:41:10 2005 @@ -4,10 +4,10 @@ AC_INIT([[[SAMPLE]]],[[[x.xx]]],[bugs at yourdomain]) dnl Place all of the extra autoconf files into the config subdirectory -AC_CONFIG_AUX_DIR([autoconf]) +AC_CONFIG_AUX_DIR(autoconf) dnl Configure a header file -AC_CONFIG_FILES([Makefile.common]) +AC_CONFIG_FILES(Makefile.common) dnl Configure Makefiles dnl List every Makefile that ecists within your source tree @@ -54,10 +54,10 @@ dnl ************************************************************************** dnl Location of LLVM source code -AC_ARG_WITH(llvmsrc,AC_HELP_STRING([--with-llvmsrc],[Location of LLVM Source Code]),AC_SUBST(LLVM_SRC,[$withval]),AC_SUBST(LLVM_SRC,[`cd ${srcdir}/../..; pwd`])) +AC_ARG_WITH(llvmsrc,AS_HELP_STRING([--with-llvmsrc],[Location of LLVM Source Code]),AC_SUBST(LLVM_SRC,[$withval]),AC_SUBST(LLVM_SRC,[`cd ${srcdir}/../..; pwd`])) dnl Location of LLVM object code -AC_ARG_WITH(llvmobj,AC_HELP_STRING([--with-llvmobj],[Location of LLVM Object Code]),AC_SUBST(LLVM_OBJ,[$withval]),AC_SUBST(LLVM_OBJ,[`cd ../..; pwd`])) +AC_ARG_WITH(llvmobj,AS_HELP_STRING([--with-llvmobj],[Location of LLVM Object Code]),AC_SUBST(LLVM_OBJ,[$withval]),AC_SUBST(LLVM_OBJ,[`cd ../..; pwd`])) dnl ************************************************************************** dnl * Create the output files From lattner at cs.uiuc.edu Wed Jan 5 09:23:21 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 5 Jan 2005 09:23:21 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Assembler/2004-02-01-NegativeZero.llx Message-ID: <200501051523.j05FNLhQ011685@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/Assembler: 2004-02-01-NegativeZero.llx updated: 1.2 -> 1.3 --- Log message: Update this test to pass. --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Assembler/2004-02-01-NegativeZero.llx diff -u llvm/test/Regression/Assembler/2004-02-01-NegativeZero.llx:1.2 llvm/test/Regression/Assembler/2004-02-01-NegativeZero.llx:1.3 --- llvm/test/Regression/Assembler/2004-02-01-NegativeZero.llx:1.2 Sun Feb 1 16:47:16 2004 +++ llvm/test/Regression/Assembler/2004-02-01-NegativeZero.llx Wed Jan 5 09:23:06 2005 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llvm-dis | grep 0x80 +; RUN: llvm-as < %s | llvm-dis | grep -- -0.0 global double 0x8000000000000000 From lattner at cs.uiuc.edu Wed Jan 5 10:00:16 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 5 Jan 2005 10:00:16 -0600 Subject: [llvm-commits] CVS: llvm/docs/CommandGuide/html/.cvsignore Message-ID: <200501051600.j05G0G97026947@apoc.cs.uiuc.edu> Changes in directory llvm/docs/CommandGuide/html: .cvsignore updated: 1.1 -> 1.2 --- Log message: Ignore .dir --- Diffs of the changes: (+1 -0) Index: llvm/docs/CommandGuide/html/.cvsignore diff -u llvm/docs/CommandGuide/html/.cvsignore:1.1 llvm/docs/CommandGuide/html/.cvsignore:1.2 --- llvm/docs/CommandGuide/html/.cvsignore:1.1 Fri May 14 15:26:34 2004 +++ llvm/docs/CommandGuide/html/.cvsignore Wed Jan 5 10:00:00 2005 @@ -1 +1,2 @@ *html +.dir From lattner at cs.uiuc.edu Wed Jan 5 10:00:53 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 5 Jan 2005 10:00:53 -0600 Subject: [llvm-commits] CVS: llvm/docs/CommandGuide/man/.cvsignore Message-ID: <200501051600.j05G0rbe026999@apoc.cs.uiuc.edu> Changes in directory llvm/docs/CommandGuide/man: .cvsignore added (r1.1) --- Log message: Ignore generated file --- Diffs of the changes: (+1 -0) Index: llvm/docs/CommandGuide/man/.cvsignore diff -c /dev/null llvm/docs/CommandGuide/man/.cvsignore:1.1 *** /dev/null Wed Jan 5 10:00:51 2005 --- llvm/docs/CommandGuide/man/.cvsignore Wed Jan 5 10:00:41 2005 *************** *** 0 **** --- 1 ---- + .dir From lattner at cs.uiuc.edu Wed Jan 5 10:00:55 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 5 Jan 2005 10:00:55 -0600 Subject: [llvm-commits] CVS: llvm/docs/CommandGuide/man/man1/.cvsignore Message-ID: <200501051600.j05G0tI9027004@apoc.cs.uiuc.edu> Changes in directory llvm/docs/CommandGuide/man/man1: .cvsignore updated: 1.1 -> 1.2 --- Log message: Ignore generated file --- Diffs of the changes: (+1 -0) Index: llvm/docs/CommandGuide/man/man1/.cvsignore diff -u llvm/docs/CommandGuide/man/man1/.cvsignore:1.1 llvm/docs/CommandGuide/man/man1/.cvsignore:1.2 --- llvm/docs/CommandGuide/man/man1/.cvsignore:1.1 Fri May 14 15:26:39 2004 +++ llvm/docs/CommandGuide/man/man1/.cvsignore Wed Jan 5 10:00:42 2005 @@ -1 +1,2 @@ *.1 +.dir From lattner at cs.uiuc.edu Wed Jan 5 10:01:13 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 5 Jan 2005 10:01:13 -0600 Subject: [llvm-commits] CVS: llvm/docs/CommandGuide/ps/.cvsignore Message-ID: <200501051601.j05G1DDx027038@apoc.cs.uiuc.edu> Changes in directory llvm/docs/CommandGuide/ps: .cvsignore updated: 1.1 -> 1.2 --- Log message: ignore generated file --- Diffs of the changes: (+1 -0) Index: llvm/docs/CommandGuide/ps/.cvsignore diff -u llvm/docs/CommandGuide/ps/.cvsignore:1.1 llvm/docs/CommandGuide/ps/.cvsignore:1.2 --- llvm/docs/CommandGuide/ps/.cvsignore:1.1 Fri May 14 15:26:45 2004 +++ llvm/docs/CommandGuide/ps/.cvsignore Wed Jan 5 10:01:00 2005 @@ -1 +1,2 @@ *ps +.dir From lattner at cs.uiuc.edu Wed Jan 5 10:09:30 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 5 Jan 2005 10:09:30 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86RegisterInfo.td Message-ID: <200501051609.j05G9Uss027116@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86RegisterInfo.td updated: 1.16 -> 1.17 --- Log message: Minor optimization to allocate R8 registers in a better order. --- Diffs of the changes: (+7 -1) Index: llvm/lib/Target/X86/X86RegisterInfo.td diff -u llvm/lib/Target/X86/X86RegisterInfo.td:1.16 llvm/lib/Target/X86/X86RegisterInfo.td:1.17 --- llvm/lib/Target/X86/X86RegisterInfo.td:1.16 Thu Dec 2 12:17:31 2004 +++ llvm/lib/Target/X86/X86RegisterInfo.td Wed Jan 5 10:09:16 2005 @@ -61,7 +61,13 @@ // top-level register classes. The order specified in the register list is // implicitly defined to be the register allocation order. // -def R8 : RegisterClass; + +// List AL,CL,DL before AH,CH,DH, as X86 processors often suffer from false +// dependences between upper and lower parts of the register. BL and BH are +// last because they are call clobbered. Both Athlon and P4 chips suffer this +// issue. +def R8 : RegisterClass; + def R16 : RegisterClass { let Methods = [{ iterator allocation_order_end(MachineFunction &MF) const { From lattner at cs.uiuc.edu Wed Jan 5 10:27:49 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 5 Jan 2005 10:27:49 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/SSARegMap.h Message-ID: <200501051627.j05GRnHO016407@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: SSARegMap.h updated: 1.11 -> 1.12 --- Log message: add an assertion --- Diffs of the changes: (+1 -0) Index: llvm/include/llvm/CodeGen/SSARegMap.h diff -u llvm/include/llvm/CodeGen/SSARegMap.h:1.11 llvm/include/llvm/CodeGen/SSARegMap.h:1.12 --- llvm/include/llvm/CodeGen/SSARegMap.h:1.11 Wed Sep 1 17:55:34 2004 +++ llvm/include/llvm/CodeGen/SSARegMap.h Wed Jan 5 10:27:34 2005 @@ -39,6 +39,7 @@ /// function with the specified register class. /// unsigned createVirtualRegister(const TargetRegisterClass *RegClass) { + assert(RegClass && "Cannot create register without RegClass!"); RegClassMap.grow(NextRegNum); RegClassMap[NextRegNum] = RegClass; return NextRegNum++; From lattner at cs.uiuc.edu Wed Jan 5 10:30:27 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 5 Jan 2005 10:30:27 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelSimple.cpp Message-ID: <200501051630.j05GURFR016456@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelSimple.cpp updated: 1.303 -> 1.304 --- Log message: 1. If a double FP constant must be put into a constant pool, but it can be precisely represented as a float, put it into the constant pool as a float. 2. Use the cbw/cwd/cdq instructions instead of an explicit SAR for signed division. --- Diffs of the changes: (+23 -9) Index: llvm/lib/Target/X86/X86ISelSimple.cpp diff -u llvm/lib/Target/X86/X86ISelSimple.cpp:1.303 llvm/lib/Target/X86/X86ISelSimple.cpp:1.304 --- llvm/lib/Target/X86/X86ISelSimple.cpp:1.303 Thu Dec 16 18:46:51 2004 +++ llvm/lib/Target/X86/X86ISelSimple.cpp Wed Jan 5 10:30:14 2005 @@ -560,12 +560,26 @@ BuildMI(*MBB, IP, X86::FLD0, 0, R); else if (CFP->isExactlyValue(+1.0)) BuildMI(*MBB, IP, X86::FLD1, 0, R); - else { - // Otherwise we need to spill the constant to memory... + else { // FIXME: PI, other native values + // FIXME: Could handle -1.0 with FLD1/FCHS + // FIXME: 2*PI -> LDPI + FADD + + // Otherwise we need to spill the constant to memory. MachineConstantPool *CP = F->getConstantPool(); - unsigned CPI = CP->getConstantPoolIndex(CFP); + const Type *Ty = CFP->getType(); + // If a FP immediate is precise when represented as a float, we put it + // into the constant pool as a float, even if it's is statically typed as + // a double. + if (Ty == Type::DoubleTy) + if (CFP->isExactlyValue((float)CFP->getValue())) { + Ty = Type::FloatTy; + CFP = cast(ConstantExpr::getCast(CFP, Ty)); + } + + unsigned CPI = CP->getConstantPoolIndex(CFP); + assert(Ty == Type::FloatTy || Ty == Type::DoubleTy && "Unknown FP type!"); unsigned LoadOpcode = Ty == Type::FloatTy ? X86::FLD32m : X86::FLD64m; addConstantPoolReference(BuildMI(*MBB, IP, LoadOpcode, 4, R), CPI); @@ -848,7 +862,7 @@ UsesFPReg: // Okay, this block uses an FP register. If the block has successors (ie, // it's not an unwind/return), insert the FP_REG_KILL instruction. - if (BB->succ_size () && RequiresFPRegKill(BB)) { + if (BB->succ_size() && RequiresFPRegKill(BB)) { BuildMI(*BB, BB->getFirstTerminator(), X86::FP_REG_KILL, 0); ++NumFPKill; } @@ -2880,6 +2894,7 @@ static const unsigned Regs[] ={ X86::AL , X86::AX , X86::EAX }; static const unsigned ClrOpcode[]={ X86::MOV8ri, X86::MOV16ri, X86::MOV32ri }; static const unsigned ExtRegs[] ={ X86::AH , X86::DX , X86::EDX }; + static const unsigned SExOpcode[]={ X86::CBW , X86::CWD , X86::CDQ }; static const unsigned DivOpcode[][4] = { { X86::DIV8r , X86::DIV16r , X86::DIV32r , 0 }, // Unsigned division @@ -2895,10 +2910,8 @@ BuildMI(*BB, IP, MovOpcode[Class], 1, Reg).addReg(Op0Reg); if (Ty->isSigned()) { - // Emit a sign extension instruction... - unsigned ShiftResult = makeAnotherReg(Op0->getType()); - BuildMI(*BB, IP, SAROpcode[Class], 2,ShiftResult).addReg(Op0Reg).addImm(31); - BuildMI(*BB, IP, MovOpcode[Class], 1, ExtReg).addReg(ShiftResult); + // Emit a sign extension instruction. + BuildMI(*BB, IP, SExOpcode[Class], 0); // Emit the appropriate divide or remainder instruction... BuildMI(*BB, IP, DivOpcode[1][Class], 1).addReg(Op1Reg); @@ -3407,7 +3420,8 @@ // reading it back. unsigned FltAlign = TM.getTargetData().getFloatAlignment(); int FrameIdx = F->getFrameInfo()->CreateStackObject(4, FltAlign); - addFrameReference(BuildMI(*BB, IP, X86::FST32m, 5), FrameIdx).addReg(SrcReg); + addFrameReference(BuildMI(*BB, IP, X86::FST32m, 5), + FrameIdx).addReg(SrcReg); addFrameReference(BuildMI(*BB, IP, X86::FLD32m, 5, DestReg), FrameIdx); } } else if (SrcClass == cLong) { From reid at x10sys.com Wed Jan 5 11:26:10 2005 From: reid at x10sys.com (Reid Spencer) Date: Wed, 5 Jan 2005 11:26:10 -0600 Subject: [llvm-commits] CVS: llvm/projects/sample/autoconf/.cvsignore Message-ID: <200501051726.LAA00935@zion.cs.uiuc.edu> Changes in directory llvm/projects/sample/autoconf: .cvsignore added (r1.1) --- Log message: Ignore autoconf/aclocal generated stuff. --- Diffs of the changes: (+1 -0) Index: llvm/projects/sample/autoconf/.cvsignore diff -c /dev/null llvm/projects/sample/autoconf/.cvsignore:1.1 *** /dev/null Wed Jan 5 11:26:10 2005 --- llvm/projects/sample/autoconf/.cvsignore Wed Jan 5 11:26:00 2005 *************** *** 0 **** --- 1 ---- + autom4te.cache From reid at x10sys.com Wed Jan 5 11:29:40 2005 From: reid at x10sys.com (Reid Spencer) Date: Wed, 5 Jan 2005 11:29:40 -0600 Subject: [llvm-commits] CVS: llvm/utils/GenLibDeps.pl Message-ID: <200501051729.LAA00968@zion.cs.uiuc.edu> Changes in directory llvm/utils: GenLibDeps.pl updated: 1.2 -> 1.3 --- Log message: 1. Make sure that "dot" can be found in the path 2. Fix a bug where the lib directory specified also had to be cwd 3. Weight the output so archive->archive edges are shorter 4. Generate two different graphs: one for libraries, one for objects. 5. Adjust the properties of the graphs till it looks nice. --- Diffs of the changes: (+30 -3) Index: llvm/utils/GenLibDeps.pl diff -u llvm/utils/GenLibDeps.pl:1.2 llvm/utils/GenLibDeps.pl:1.3 --- llvm/utils/GenLibDeps.pl:1.2 Thu Dec 30 17:13:12 2004 +++ llvm/utils/GenLibDeps.pl Wed Jan 5 11:29:29 2005 @@ -12,6 +12,10 @@ # Give first option a name. my $Directory = $ARGV[0]; +# Find the "dot" program +chomp(my $DotPath = `which dot`); +die "Can't find 'dot'" if (! -x "$DotPath"); + # Open the directory and read its contents, sorting by name and differentiating # by whether its a library (.a) or an object file (.o) opendir DIR,$Directory; @@ -28,7 +32,7 @@ # Gather definitions from the libraries foreach $lib (@libs ) { open DEFS, - "nm -g --defined-only $lib | grep ' [ABCDGRST] ' | sed -e 's/^[0-9A-Fa-f]* [ABCDGRST] //' | sort | uniq |"; + "nm -g --defined-only $Directory/$lib | grep ' [ABCDGRST] ' | sed -e 's/^[0-9A-Fa-f]* [ABCDGRST] //' | sort | uniq |"; while () { chomp($_); $libdefs{$_} = $lib; @@ -39,7 +43,7 @@ # Gather definitions from the object files. foreach $obj (@objs ) { open DEFS, - "nm -g --defined-only $obj | grep ' [ABCDGRST] ' | sed -e 's/^[0-9A-Fa-f]* [ABCDGRST] //' | sort | uniq |"; + "nm -g --defined-only $Directory/$obj | grep ' [ABCDGRST] ' | sed -e 's/^[0-9A-Fa-f]* [ABCDGRST] //' | sort | uniq |"; while () { chomp($_); $objdefs{$_} = $obj; @@ -52,9 +56,11 @@ # object. The
provides a list of the libraries/objects it depends on. sub gen_one_entry { my $lib = $_[0]; + my $lib_ns = $lib; + $lib_ns =~ s/(.*)\.[oa]/$1/; print "
$lib
    \n"; open UNDEFS, - "nm -u $lib | grep ' U ' | sed -e 's/ U //' | sort | uniq |"; + "nm -u $Directory/$lib | grep ' U ' | sed -e 's/ U //' | sort | uniq |"; open DEPENDS, "| sort | uniq > GenLibDeps.out"; while () { @@ -75,6 +81,13 @@ while () { chomp; print "
  • $_
  • \n"; + $suffix = substr($_,length($_)-1,1); + $_ =~ s/(.*)\.[oa]/$1/; + if ($suffix eq "a") { + print DOT "$lib_ns -> $_ [ weight=0 ];\n"; + } else { + print DOT "$lib_ns -> $_ [ weight=10];\n"; + } } close DF; print "
\n"; @@ -87,15 +100,29 @@ # Print the definition list tag print "
\n"; +open DOT, "| $DotPath -Tgif > libdeps.gif"; + +print DOT "digraph LibDeps {size=\"40,15\"; ratio=\"1.33333\"; margin=\"0.25\"; rankdir=\"LR\"; mclimit=\"50.0\"; ordering=\"out\"; center=\"1\";\n"; +print DOT "node [shape=\"box\",color=\"#000088\",fillcolor=\"#FFFACD\",fontcolor=\"#5577DD\",style=\"filled\",fontsize=\"24\"];\n"; +print DOT "edge [style=\"solid\",color=\"#000088\"];\n"; # Print libraries first foreach $lib (@libs) { gen_one_entry($lib); } +print DOT "}\n"; +close DOT; +open DOT, "| $DotPath -Tgif > objdeps.gif"; +print DOT "digraph ObjDeps {size=\"40,15\"; ratio=\"1.33333\"; margin=\"0.25\"; rankdir=\"LR\"; mclimit=\"50.0\"; ordering=\"out\"; center=\"1\";\n"; +print DOT "node [shape=\"box\",color=\"#000088\",fillcolor=\"#FFFACD\",fontcolor=\"#5577DD\",style=\"filled\",fontsize=\"24\"];\n"; +print DOT "edge [style=\"solid\",color=\"#000088\"];\n"; # Print objects second foreach $obj (@objs) { gen_one_entry($obj); } +print DOT "}\n"; +close DOT; + # Print end tag of definition list element print "
\n"; From reid at x10sys.com Wed Jan 5 11:32:06 2005 From: reid at x10sys.com (Reid Spencer) Date: Wed, 5 Jan 2005 11:32:06 -0600 Subject: [llvm-commits] CVS: llvm/tools/opt/opt.cpp Message-ID: <200501051732.LAA01028@zion.cs.uiuc.edu> Changes in directory llvm/tools/opt: opt.cpp updated: 1.101 -> 1.102 --- Log message: Make opt honor the quiet option when printing the bytecode warning. --- Diffs of the changes: (+1 -1) Index: llvm/tools/opt/opt.cpp diff -u llvm/tools/opt/opt.cpp:1.101 llvm/tools/opt/opt.cpp:1.102 --- llvm/tools/opt/opt.cpp:1.101 Sat Jan 1 17:57:01 2005 +++ llvm/tools/opt/opt.cpp Wed Jan 5 11:31:55 2005 @@ -118,7 +118,7 @@ // If the output is set to be emitted to standard out, and standard out is a // console, print out a warning message and refuse to do it. We don't impress // anyone by spewing tons of binary goo to a terminal. - if (!Force && !NoOutput && !Quiet && CheckBytecodeOutputToConsole(Out)) { + if (!Force && !NoOutput && CheckBytecodeOutputToConsole(Out,!Quiet)) { NoOutput = true; } From alkis at cs.uiuc.edu Wed Jan 5 11:57:39 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Wed, 5 Jan 2005 11:57:39 -0600 Subject: [llvm-commits] CVS: llvm/autoconf/configure.ac Message-ID: <200501051757.LAA01273@zion.cs.uiuc.edu> Changes in directory llvm/autoconf: configure.ac updated: 1.161 -> 1.162 --- Log message: The Java project now lives under projects/llvm-java. --- Diffs of the changes: (+1 -1) Index: llvm/autoconf/configure.ac diff -u llvm/autoconf/configure.ac:1.161 llvm/autoconf/configure.ac:1.162 --- llvm/autoconf/configure.ac:1.161 Fri Dec 31 16:54:28 2004 +++ llvm/autoconf/configure.ac Wed Jan 5 11:57:28 2005 @@ -72,7 +72,7 @@ "llvm-test") AC_CONFIG_SUBDIRS([projects/llvm-test]) ;; "llvm-reopt") AC_CONFIG_SUBDIRS([projects/llvm-reopt]);; "llvm-gcc") AC_CONFIG_SUBDIRS([projects/llvm-gcc]) ;; - "Java") AC_CONFIG_SUBDIRS([projects/Java]) ;; + "Java") AC_CONFIG_SUBDIRS([projects/llvm-java]) ;; "llvm-tv") AC_CONFIG_SUBDIRS([projects/llvm-tv]) ;; "llvm-fefw") AC_CONFIG_SUBDIRS([projects/llvm-fefw]) ;; "poolalloc") AC_CONFIG_SUBDIRS([projects/poolalloc]) ;; From alkis at cs.uiuc.edu Wed Jan 5 11:57:39 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Wed, 5 Jan 2005 11:57:39 -0600 Subject: [llvm-commits] CVS: llvm/configure Message-ID: <200501051757.LAA01276@zion.cs.uiuc.edu> Changes in directory llvm: configure updated: 1.168 -> 1.169 --- Log message: The Java project now lives under projects/llvm-java. --- Diffs of the changes: (+1 -1) Index: llvm/configure diff -u llvm/configure:1.168 llvm/configure:1.169 --- llvm/configure:1.168 Fri Dec 31 16:54:28 2004 +++ llvm/configure Wed Jan 5 11:57:28 2005 @@ -435,7 +435,7 @@ ac_subdirs_all="$ac_subdirs_all projects/llvm-test" ac_subdirs_all="$ac_subdirs_all projects/llvm-reopt" ac_subdirs_all="$ac_subdirs_all projects/llvm-gcc" -ac_subdirs_all="$ac_subdirs_all projects/Java" +ac_subdirs_all="$ac_subdirs_all projects/llvm-java" ac_subdirs_all="$ac_subdirs_all projects/llvm-tv" ac_subdirs_all="$ac_subdirs_all projects/llvm-fefw" ac_subdirs_all="$ac_subdirs_all projects/poolalloc" From reid at x10sys.com Wed Jan 5 12:17:21 2005 From: reid at x10sys.com (Reid Spencer) Date: Wed, 5 Jan 2005 12:17:21 -0600 Subject: [llvm-commits] CVS: llvm/docs/SystemLibrary.html Message-ID: <200501051817.MAA01504@zion.cs.uiuc.edu> Changes in directory llvm/docs: SystemLibrary.html updated: 1.7 -> 1.8 --- Log message: Bulk upgrade of this document. Cruft removed, new stuff added, general reorganization of the content. This is now "done". --- Diffs of the changes: (+191 -355) Index: llvm/docs/SystemLibrary.html diff -u llvm/docs/SystemLibrary.html:1.7 llvm/docs/SystemLibrary.html:1.8 --- llvm/docs/SystemLibrary.html:1.7 Sun Nov 21 08:58:11 2004 +++ llvm/docs/SystemLibrary.html Wed Jan 5 12:17:10 2005 @@ -8,39 +8,26 @@
System Library
- -
-

Warning: This document is a work in progress.

-
- @@ -52,129 +39,118 @@
-

This document describes the requirements, design, and implementation - details of LLVM's System Library. The library is composed of the header files - in llvm/include/llvm/System and the source files in - llvm/lib/System. The goal of this library is to completely shield - LLVM from the variations in operating system interfaces. By centralizing - LLVM's use of operating system interfaces, we make it possible for the LLVM - tool chain and runtime libraries to be more easily ported to new platforms - since (theoretically) only llvm/lib/System needs to be ported. This - library also unclutters the rest of LLVM from #ifdef use and special - cases for specific operating systems. Such uses are replaced with simple calls - to the interfaces provided in llvm/include/llvm/System.

Note that - lib/System is not intended to be a complete operating system wrapper (such as - the Adaptive Communications Environment (ACE) or Apache Portable Runtime - (APR)), but only to provide the functionality necessary to support LLVM. +

This document provides some details on LLVM's System Library, located in + the source at lib/System and include/llvm/System. The + library's purpose is to shield LLVM from the differences between operating + systems for the few services LLVM needs from the operating system. Much of + LLVM is written using portability features of standard C++. However, in a few + areas, system dependent facilities are needed and the System Library is the + wrapper around those system calls.

+

By centralizing LLVM's use of operating system interfaces, we make it + possible for the LLVM tool chain and runtime libraries to be more easily + ported to new platforms since (theoretically) only lib/System needs + to be ported. This library also unclutters the rest of LLVM from #ifdef use + and special cases for specific operating systems. Such uses are replaced + with simple calls to the interfaces provided in include/llvm/System. +

+

Note that the System Library is not intended to be a complete operating + system wrapper (such as the Adaptive Communications Environment (ACE) or + Apache Portable Runtime (APR)), but only provides the functionality necessary + to support LLVM.

The System Library was written by Reid Spencer who formulated the - design based on similar original work as part of the eXtensible Programming - System (XPS).

+ design based on similar work originating from the eXtensible Programming + System (XPS). Several people helped with the effort; especially, + Jeff Cohen and Henrik Bach on the Win32 port.

-

The System library's requirements are aimed at shielding LLVM from the - variations in operating system interfaces. The following sections define the - requirements needed to fulfill this objective. Of necessity, these requirements - must be strictly followed in order to ensure the library's goal is reached.

+

In order to keep LLVM portable, LLVM developers should adhere to a set of + portability rules associated with the System Library. Adherence to these rules + should help the System Library achieve its goal of shielding LLVM from the + variations in operating system interfaces and doing so efficiently. The + following sections define the rules needed to fulfill this objective.

- +
-

The library must shield LLVM from all system libraries. To obtain - system level functionality, LLVM must #include "llvm/System/Thing.h" - and nothing else. This means that Thing.h cannot expose any system - header files. This protects LLVM from accidentally using system specific - functionality except through the lib/System interface. Specifically this - means that header files like "unistd.h", "windows.h", "stdio.h", and - "string.h" are verbotten outside the implementation of lib/System. -

+

Except in lib/System, no LLVM source code should directly + #include a system header. Care has been taken to remove all such + #includes from LLVM while lib/System was being + developed. Specifically this means that header files like "unistd.h", + "windows.h", "stdio.h", and "string.h" are forbidden to be included by LLVM + source code outside the implementation of lib/System.

+

To obtain system-dependent functionality, existing interfaces to the system + found in include/llvm/System should be used. If an appropriate + interface is not available, it should be added to include/llvm/System + and implemented in lib/System for all supported platforms.

-
Allow Standard C Headers + +

The System Library must shield LLVM from all system headers. To + obtain system level functionality, LLVM source must + #include "llvm/System/Thing.h" and nothing else. This means that + Thing.h cannot expose any system header files. This protects LLVM + from accidentally using system specific functionality and only allows it + via the lib/System interface.

+
+ + +

The standard C headers (the ones beginning with "c") are allowed - to be exposed through the lib/System interface. These headers and the things - they declare are considered to be platform agnostic. LLVM source files may - include them or obtain their inclusion through lib/System interfaces.

+ to be exposed through the lib/System interface. These headers and + the things they declare are considered to be platform agnostic. LLVM source + files may include them directly or obtain their inclusion through + lib/System interfaces.

-
Allow Standard C++ Headers +

The standard C++ headers from the standard C++ library and - standard template library are allowed to be exposed through the lib/System + standard template library may be exposed through the lib/System interface. These headers and the things they declare are considered to be platform agnostic. LLVM source files may include them or obtain their inclusion through lib/System interfaces.

- -
-

Any functions defined by system libraries (i.e. not defined by lib/System) - must not be exposed through the lib/System interface, even if the header file - for that function is not exposed. This prevents inadvertent use of system - specific functionality.

-

For example, the stat system call is notorious for having - variations in the data it provides. lib/System must not declare stat - nor allow it to be declared. Instead it should provide its own interface to - discovering information about files and directories. Those interfaces may be - implemented in terms of stat but that is strictly an implementation - detail.

-
- - - -
-

Any data defined by system libraries (i.e. not defined by lib/System) must - not be exposed through the lib/System interface, even if the header file for - that function is not exposed. As with functions, this prevents inadvertent use - of data that might not exist on all platforms.

-
- - - +
-

If an error occurs that lib/System cannot handle, the only action taken by - lib/System is to throw an instance of std:string. The contents of the string - must explain both what happened and the context in which it happened. The - format of the string should be a (possibly empty) list of contexts each - terminated with a : and a space, followed by the error message, optionally - followed by a reason, and optionally followed by a suggestion.

-

For example, failure to open a file named "foo" could result in a message - like:

-
  • foo: Unable to open file because it doesn't exist."
-

The "foo:" part is the context. The "Unable to open file" part is the error - message. The "because it doesn't exist." part is the reason. This message has - no suggestion. Where possible, the implementation of lib/System should use - operating system specific facilities for converting the error code returned by - a system call into an error message. This will help to make the error message - more familiar to users of that type of operating system.

-

Note that this requirement precludes the throwing of any other exceptions. - For example, various C++ standard library functions can cause exceptions to be - thrown (e.g. out of memory situation). In all cases, if there is a possibility - that non-string exceptions could be thrown, the lib/System library must ensure - that the exceptions are translated to std::string form.

+

The entry points specified in the interface of lib/System must be aimed at + completing some reasonably high level task needed by LLVM. We do not want to + simply wrap each operating system call. It would be preferable to wrap several + operating system calls that are always used in conjunction with one another by + LLVM.

+

For example, consider what is needed to execute a program, wait for it to + complete, and return its result code. On Unix, this involves the following + operating system calls: getenv, fork, execve, and wait. The + correct thing for lib/System to provide is a function, say + ExecuteProgramAndWait, that implements the functionality completely. + what we don't want is wrappers for the operating system calls involved.

+

There must not be a one-to-one relationship between operating + system calls and the System library's interface. Any such interface function + will be suspicious.

- +
-

None of the lib/System interface functions may be declared with C++ - throw() specifications on them. This requirement makes sure that the - compiler does not insert additional exception handling code into the interface - functions. This is a performance consideration: lib/System functions are at - the bottom of the many call chains and as such can be frequently called. We - need them to be as efficient as possible.

+

There must be no functionality specified in the interface of lib/System + that isn't actually used by LLVM. We're not writing a general purpose + operating system wrapper here, just enough to satisfy LLVM's needs. And, LLVM + doesn't need much. This design goal aims to keep the lib/System interface + small and understandable which should foster its actual use and adoption.

@@ -184,66 +160,65 @@

The implementation of a function for a given platform must be written exactly once. This implies that it must be possible to apply a function's implementation to multiple operating systems if those operating systems can - share the same implementation.

+ share the same implementation. This rule applies to the set of operating + systems supported for a given class of operating system (e.g. Unix, Win32). +

- - + +
-

In order to fulfill the requirements of the system library, strict design - objectives must be maintained in the library as it evolves. The goal here - is to provide interfaces to operating system concepts (files, memory maps, - sockets, signals, locking, etc) efficiently and in such a way that the - remainder of LLVM is completely operating system agnostic.

+

The System Library interfaces can be called quite frequently by LLVM. In + order to make those calls as efficient as possible, we discourage the use of + virtual methods. There is no need to use inheritance for implementation + differences, it just adds complexity. The #include mechanism works + just fine.

- +
-

There must be no functionality specified in the interface of lib/System - that isn't actually used by LLVM. We're not writing a general purpose - operating system wrapper here, just enough to satisfy LLVM's needs. And, LLVM - doesn't need much. This design goal aims to keep the lib/System interface - small and understandable which should foster its actual use and adoption.

+

Any functions defined by system libraries (i.e. not defined by lib/System) + must not be exposed through the lib/System interface, even if the header file + for that function is not exposed. This prevents inadvertent use of system + specific functionality.

+

For example, the stat system call is notorious for having + variations in the data it provides. lib/System must not declare + stat nor allow it to be declared. Instead it should provide its own + interface to discovering information about files and directories. Those + interfaces may be implemented in terms of stat but that is strictly + an implementation detail. The interface provided by the System Library must + be implemented on all platforms (even those without stat).

- +
-

The entry points specified in the interface of lib/System must be aimed at - completing some reasonably high level task needed by LLVM. We do not want to - simply wrap each operating system call. It would be preferable to wrap several - operating system calls that are always used in conjunction with one another by - LLVM.

-

For example, consider what is needed to execute a program, wait for it to - complete, and return its result code. On Unix, this involves the following - operating system calls: getenv, fork, execve, and wait. The - correct thing for lib/System to provide is a function, say - ExecuteProgramAndWait, that implements the functionality completely. - what we don't want is wrappers for the operating system calls involved.

-

There must not be a one-to-one relationship between operating - system calls and the System library's interface. Any such interface function - will be suspicious.

+

Any data defined by system libraries (i.e. not defined by lib/System) must + not be exposed through the lib/System interface, even if the header file for + that function is not exposed. As with functions, this prevents inadvertent use + of data that might not exist on all platforms.

- +
-

Operating system interfaces will generally provide errors results for every +

Operating system interfaces will generally provide error results for every little thing that could go wrong. In almost all cases, you can divide these error results into two groups: normal/good/soft and abnormal/bad/hard. That is, some of the errors are simply information like "file not found", "insufficient privileges", etc. while other errors are much harder like - "out of space", "bad disk sector", or "system call interrupted". Well call the - first group "soft" errors and the second group "hard" errors.

+ "out of space", "bad disk sector", or "system call interrupted". We'll call + the first group "soft" errors and the second group "hard" + errors.

lib/System must always attempt to minimize soft errors and always just throw a std::string on hard errors. This is a design requirement because the minimization of soft errors can affect the granularity and the nature of the interface. In general, if you find that you're wanting to throw soft errors, you must review the granularity of the interface because it is likely you're trying to implement something that is too low level. The rule of thumb is to - provide interface functions that "can't" fail, except when faced with hard - errors.

+ provide interface functions that can't fail, except when faced with + hard errors.

For a trivial example, suppose we wanted to add an "OpenFileForWriting" function. For many operating systems, if the file doesn't exist, attempting to open the file will produce an error. However, lib/System should not @@ -262,233 +237,94 @@

  • Handle internally the most common normal/good/soft error conditions so the rest of LLVM doesn't have to.
  • - -
    
    -Notes:
    -10. The implementation of a lib/System interface can vary drastically between
    -    platforms. That's okay as long as the end result of the interface function is
    -    the same. For example, a function to create a directory is pretty straight
    -    forward on all operating system. System V IPC on the other hand isn't even
    -    supported on all platforms. Instead of "supporting" System V IPC, lib/System
    -    should provide an interface to the basic concept of inter-process 
    -    communications. The implementations might use System V IPC if that was
    -    available or named pipes, or whatever gets the job done effectively for a
    -    given operating system.
    -
    -11. Implementations are separated first by the general class of operating system
    -    as provided by the configure script's $build variable. This variable is used
    -    to create a link from $BUILD_OBJ_ROOT/lib/System/platform to a directory in
    -    $BUILD_SRC_ROOT/lib/System directory with the same name as the $build
    -    variable. This provides a retargetable include mechanism. By using the link's
    -    name (platform) we can actually include the operating specific
    -    implementation. For example, support $build is "Darwin" for MacOS X. If we
    -    place:
    -      #include "platform/File.cpp"
    -    into a a file in lib/System, it will actually include
    -    lib/System/Darwin/File.cpp. What this does is quickly differentiate the basic
    -    class of operating system that will provide the implementation.
    - 
    -12. Implementation files in lib/System need may only do two things: (1) define 
    -    functions and data that is *TRULY* generic (completely platform agnostic) and
    -    (2) #include the platform specific implementation with:
    - 
    -       #include "platform/Impl.cpp"
    - 
    -    where Impl is the name of the implementation files.
    - 
    -13. Platform specific implementation files (platform/Impl.cpp) may only #include
    -    other Impl.cpp files found in directories under lib/System. The order of
    -    inclusion is very important (from most generic to most specific) so that we
    -    don't inadvertently place an implementation in the wrong place. For example,
    -    consider a fictitious implementation file named DoIt.cpp. Here's how the
    -    #includes should work for a Linux platform
    - 
    -    lib/System/DoIt.cpp
    -      #include "platform/DoIt.cpp"        // platform specific impl. of Doit
    -      DoIt
    - 
    -    lib/System/Linux/DoIt.cpp             // impl that works on all Linux 
    -      #include "../Unix/DoIt.cpp"         // generic Unix impl. of DoIt
    -      #include "../Unix/SUS/DoIt.cpp      // SUS specific impl. of DoIt
    -      #include "../Unix/SUS/v3/DoIt.cpp   // SUSv3 specific impl. of DoIt
    - 
    -    Note that the #includes in lib/System/Linux/DoIt.cpp are all optional but
    -    should be used where the implementation of some functionality can be shared
    -    across some set of Unix variants. We don't want to duplicate code across
    -    variants if their implementation could be shared.
    -
    -
    - - - -
    -

    no public data

    -

    onlyprimitive typed private/protected data

    -

    data size is "right" for platform, not max of all platforms

    -

    each class corresponds to O/S concept

    -
    - - - -
    -

    To be written.

    -
    - - - -
    -

    To be written.

    - +
    -

    To be written.

    +

    If an error occurs that lib/System cannot handle, the only action taken by + lib/System is to throw an instance of std:string. The contents of the string + must explain both what happened and the context in which it happened. The + format of the string should be a (possibly empty) list of contexts each + terminated with a : and a space, followed by the error message, optionally + followed by a reason, and optionally followed by a suggestion.

    +

    For example, failure to open a file named "foo" could result in a message + like:

    +
    • foo: Unable to open file because it doesn't exist."
    +

    The "foo:" part is the context. The "Unable to open file" part is the error + message. The "because it doesn't exist." part is the reason. This message has + no suggestion. Where possible, the implementation of lib/System should use + operating system specific facilities for converting the error code returned by + a system call into an error message. This will help to make the error message + more familiar to users of that type of operating system.

    +

    Note that this requirement precludes the throwing of any other exceptions. + For example, various C++ standard library functions can cause exceptions to be + thrown (e.g. out of memory situation). In all cases, if there is a possibility + that non-string exceptions could be thrown, the lib/System library must ensure + that the exceptions are translated to std::string form.

    - -
    -

    To be written.

    + - - -
    -

    To be written.

    +

    None of the lib/System interface functions may be declared with C++ + throw() specifications on them. This requirement makes sure that the + compiler does not insert additional exception handling code into the interface + functions. This is a performance consideration: lib/System functions are at + the bottom of many call chains and as such can be frequently called. We + need them to be as efficient as possible.

    - +
    -

    See bug 351 - for further details on the progress of this work

    +

    Implementations of the System Library interface are separated by their + general class of operating system. Currently only Unix and Win32 classes are + defined but more could be added for other operating system classifications. + To distinguish which implementation to compile, the code in lib/System uses + the LLVM_ON_UNIX and LLVM_ON_WIN32 #defines provided via configure through the + llvm/Config/config.h file. Each source file in lib/System, after implementing + the generic (operating system independent) functionality needs to include the + correct implementation using a set of #if defined(LLVM_ON_XYZ) + directives. For example, if we had lib/System/File.cpp, we'd expect to see in + that file:

    +
    
    +  #if defined(LLVM_ON_UNIX)
    +  #include "Unix/File.cpp"
    +  #endif
    +  #if defined(LLVM_ON_WIN32)
    +  #include "Win32/File.cpp"
    +  #endif
    +  
    +

    The implementation in lib/System/Unix/File.cpp should handle all Unix + variants. The implementation in lib/System/Win32/File.cpp should handle all + Win32 variants. What this does is quickly differentiate the basic class of + operating system that will provide the implementation. The specific details + for a given platform must still be determined through the use of + #ifdef.

    - -
    -

    In order to provide different implementations of the lib/System interface - for different platforms, it is necessary for the library to "sense" which - operating system is being compiled for and conditionally compile only the - applicable parts of the library. While several operating system wrapper - libraries (e.g. APR, ACE) choose to use #ifdef preprocessor statements in - combination with autoconf variable (HAVE_* family), lib/System chooses an - alternate strategy.

    -

    To put it succinctly, the lib/System strategy has traded "#ifdef hell" for - "#include hell". That is, a given implementation file defines one or more - functions for a particular operating system variant. The functions defined in - that file have no #ifdef's to disambiguate the platform since the file is only - compiled on one kind of platform. While this leads to the same function being - implemented differently in different files, it is our contention that this - leads to better maintenance and easier portability.

    -

    For example, consider a function having different implementations on a - variety of platforms. Many wrapper libraries choose to deal with the different - implementations by using #ifdef, like this:

    -
    
    -      void SomeFunction(void) {
    -      #if defined __LINUX
    -        // .. Linux implementation
    -      #elif defined __WIN32
    -        // .. Win32 implementation
    -      #elif defined __SunOS
    -        // .. SunOS implementation
    -      #else
    -      #warning "Don't know how to implement SomeFunction on this platform"
    -      #endif
    -      }
    -  
    -

    The problem with this is that its very messy to read, especially as the - number of operating systems and their variants grow. The above example is - actually tame compared to what can happen when the implementation depends on - specific flavors and versions of the operating system. In that case you end up - with multiple levels of nested #if statements. This is what we mean by "#ifdef - hell".

    -

    To avoid the situation above, we've chosen to locate all functions for a - given implementation file for a specific operating system into one place. This - has the following advantages:

    -

      -
    • No "#ifdef hell"
    • -
    • When porting, the strategy is quite straight forward: copy the - implementation file from a similar operating system to a new directory and - re-implement them.
    • -
    • Correctness is helped during porting because the new operating system's - implementation is wholly contained in a separate directory. There's no - chance to make an error in the #if statements and affect some other - operating system's implementation.
    • -
    -

    So, given that we have decided to use #include instead of #if to provide - platform specific implementations, there are actually three ways we can go - about doing this. None of them are perfect, but we believe we've chosen the - lesser of the three evils. Given that there is a variable named $OS which - names the platform for which we must build, here's a summary of the three - approaches we could use to determine the correct directory:

    -
      -
    1. Provide the compiler with a -I$(OS) on the command line. This could be - provided in only the lib/System makefile.
    2. -
    3. Use autoconf to transform #include statements in the implementation - files by using substitutions of @OS at . For example, if we had a file, - File.cpp.in, that contained "#include <@OS@/File.cpp>" this would get - transformed to "#include <actual/File.cpp>" where "actual" is the - actual name of the operating system
    4. -
    5. Create a link from $OBJ_DIR/platform to $SRC_DIR/$OS. This allows us to - use a generic directory name to get the correct platform, as in #include - <platform/File.cpp>
    6. -
    -

    Let's look at the pitfalls of each approach.

    -

    In approach #1, we end up with some confusion as to what gets included. - Suppose we have lib/System/File.cpp that includes just File.cpp to get the - platform specific part of the implementation. In this case, the include - directive with the <> syntax will include the right file but the include - directive with the "" syntax will recursively include the same file, - lib/System/File.cpp. In the case of #include <File.cpp>, the -I options - to the compiler are searched first so it works. But in the #include "File.cpp" - case, the current directory is searched first. Furthermore, in both cases, - neither include directive documents which File.cpp is getting included.

    -

    In approach #2, we have the problem of needing to reconfigure repeatedly. - Developer's generally hate that and we don't want lib/System to be a thorn in - everyone's side because it will constantly need updating as operating systems - change and as new operating systems are added. The problem occurs when a new - implementation file is added to the library. First of all, you have to add a - file with the .in suffix, then you have to add that file name to the list of - configurable files in the autoconf/configure.ac file, then you have to run - AutoRegen.sh to rebuild the configure script, then you have to run the - configure script. This is deemed to be a pretty large hassle.

    -

    In approach #3, we have the problem that not all platforms support links. - Fortunately the autoconf macro used to create the link can compensate for - this. If a link can't be made, the configure script will copy the correct - directory from $BUILD_SRC_DIR to $BUILD_OBJ_DIR under the new name. The only - problem with this is that if a copy is made, the copy doesn't get updated if - the programmer adds or modifies files in the $BUILD_SRC_DIR. A reconfigure or - manual copying is needed to get things to compile.

    -

    The approach we have taken in lib/System is #3. Here's why:

    -

      -
    • Approach #1 is rejected because it doesn't document what's actually - getting included and the potential for mistakes with alternate include - directive forms is high.
    • -
    • Approach #2 are both viable and only really impact development when new - files are added to the library.
    • -
    • However, approach #2 impacts every new file on every platform all the - time. With approach #3, only those platforms not supporting links will be - affected. The number of platforms not supporting links is very small and - they are generally archaic.
    • -
    • Given the above, approach #3 seems to have the least impact.
    • -
    + +
    +

    The implementation of a lib/System interface can vary drastically between + platforms. That's okay as long as the end result of the interface function + is the same. For example, a function to create a directory is pretty straight + forward on all operating system. System V IPC on the other hand isn't even + supported on all platforms. Instead of "supporting" System V IPC, lib/System + should provide an interface to the basic concept of inter-process + communications. The implementations might use System V IPC if that was + available or named pipes, or whatever gets the job done effectively for a + given operating system. In all cases, the interface and the implementation + must be semantically consistent.

    - -
    -

    The linux implementation of the system library will always be the - reference implementation. This means that (a) the concepts defined by the - linux must be identically replicated in the other implementations and (b) the - linux implementation must always be complete (provide implementations for all - concepts).

    + +
    +

    See bug 351 + for further details on the progress of this work

    @@ -502,7 +338,7 @@ Reid Spencer
    LLVM Compiler Infrastructure
    - Last modified: $Date: 2004/11/21 14:58:11 $ + Last modified: $Date: 2005/01/05 18:17:10 $ From reid at x10sys.com Wed Jan 5 12:21:50 2005 From: reid at x10sys.com (Reid Spencer) Date: Wed, 5 Jan 2005 12:21:50 -0600 Subject: [llvm-commits] CVS: llvm/docs/SystemLibrary.html Message-ID: <200501051821.MAA01594@zion.cs.uiuc.edu> Changes in directory llvm/docs: SystemLibrary.html updated: 1.8 -> 1.9 --- Log message: Add a missing
    --- Diffs of the changes: (+3 -3) Index: llvm/docs/SystemLibrary.html diff -u llvm/docs/SystemLibrary.html:1.8 llvm/docs/SystemLibrary.html:1.9 --- llvm/docs/SystemLibrary.html:1.8 Wed Jan 5 12:17:10 2005 +++ llvm/docs/SystemLibrary.html Wed Jan 5 12:21:39 2005 @@ -94,6 +94,7 @@ +

    The System Library must shield LLVM from all system headers. To obtain system level functionality, LLVM source must #include "llvm/System/Thing.h" and nothing else. This means that @@ -103,8 +104,7 @@

    - +

    The standard C headers (the ones beginning with "c") are allowed to be exposed through the lib/System interface. These headers and @@ -338,7 +338,7 @@ Reid Spencer
    LLVM Compiler Infrastructure
    - Last modified: $Date: 2005/01/05 18:17:10 $ + Last modified: $Date: 2005/01/05 18:21:39 $ From reid at x10sys.com Wed Jan 5 13:01:33 2005 From: reid at x10sys.com (Reid Spencer) Date: Wed, 5 Jan 2005 13:01:33 -0600 Subject: [llvm-commits] CVS: llvm/docs/index.html Message-ID: <200501051901.NAA02067@zion.cs.uiuc.edu> Changes in directory llvm/docs: index.html updated: 1.39 -> 1.40 --- Log message: Add the SystemLibrary.html document now that its done. --- Diffs of the changes: (+5 -1) Index: llvm/docs/index.html diff -u llvm/docs/index.html:1.39 llvm/docs/index.html:1.40 --- llvm/docs/index.html:1.39 Fri Dec 10 09:47:17 2004 +++ llvm/docs/index.html Wed Jan 5 13:01:20 2005 @@ -191,6 +191,10 @@ describes the design and configuration of the LLVM compiler driver tool, llvmc. +

  • System Library - This document describes +the LLVM System Library (lib/System) and how to keep LLVM source code +portable
  • + @@ -230,6 +234,6 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"> LLVM Compiler Infrastructure
    - Last modified: $Date: 2004/12/10 15:47:17 $ + Last modified: $Date: 2005/01/05 19:01:20 $ From lattner at cs.uiuc.edu Wed Jan 5 16:14:29 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 5 Jan 2005 16:14:29 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/ValueTypes.h Message-ID: <200501052214.j05METra018798@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: ValueTypes.h updated: 1.6 -> 1.7 --- Log message: Add a list end sentinal --- Diffs of the changes: (+2 -0) Index: llvm/include/llvm/CodeGen/ValueTypes.h diff -u llvm/include/llvm/CodeGen/ValueTypes.h:1.6 llvm/include/llvm/CodeGen/ValueTypes.h:1.7 --- llvm/include/llvm/CodeGen/ValueTypes.h:1.6 Sat Jan 1 09:58:41 2005 +++ llvm/include/llvm/CodeGen/ValueTypes.h Wed Jan 5 16:14:14 2005 @@ -39,6 +39,8 @@ f128 = 10, // This is a 128 bit floating point value isVoid = 11, // This has no value + + LAST_VALUETYPE, // This always remains at the end of the list. }; static inline bool isInteger(ValueType VT) { From alkis at cs.uiuc.edu Wed Jan 5 21:14:14 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Wed, 5 Jan 2005 21:14:14 -0600 Subject: [llvm-commits] CVS: llvm-java/test/Makefile.test Message-ID: <200501060314.VAA05844@zion.cs.uiuc.edu> Changes in directory llvm-java/test: Makefile.test updated: 1.30 -> 1.31 --- Log message: Capture stdout and stderr in different files and pass the test if stdout matches but stderr doesn't (and give a warning) --- Diffs of the changes: (+8 -7) Index: llvm-java/test/Makefile.test diff -u llvm-java/test/Makefile.test:1.30 llvm-java/test/Makefile.test:1.31 --- llvm-java/test/Makefile.test:1.30 Wed Dec 15 16:15:16 2004 +++ llvm-java/test/Makefile.test Wed Jan 5 21:14:03 2005 @@ -44,19 +44,20 @@ .PRECIOUS: %.out-nat %.out-jit %.diff # rule to run a .class file with the jvm -%.out-nat: %.class +%.out-nat %.err-nat: %.class -$(Verb)LD_LIBRARY_PATH=$(LibDir) $(JAVA) -cp Output $(notdir $*) \ - > $*.out-nat 2>&1 + > $*.out-nat 2> $*.err-nat # rule to run a .class file with the llvm jit -%.out-jit: %.llvm.bc - -$(Verb)$(LLI) $< > $*.out-jit 2>&1 +%.out-jit %.err-jit: %.llvm.bc + -$(Verb)$(LLI) $< > $*.out-jit 2> $*.err-jit # rule to diff test output -%.diff: %.out-nat %.out-jit +%.diff: %.out-nat %.err-nat %.out-jit %.err-jit $(Verb)diff $*.out-nat $*.out-jit > $@ \ - && echo "PASS: $(notdir $*)" \ - || echo "FAIL: $(notdir $*)" + && echo -n "PASS: $(notdir $*)" || echo -n "FAIL: $(notdir $*)" + $(Verb)diff $*.err-nat $*.err-jit > /dev/null \ + && echo "" || echo " (stderr mismatch)" # rule to link bytecode with runtime %.llvm %.llvm.bc: %.linked.bc $(LibDir)/libjrt.bca $(EXTRA_OBJS) $(LOPT) From lattner at cs.uiuc.edu Wed Jan 5 21:24:13 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 5 Jan 2005 21:24:13 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/ValueTypes.h Message-ID: <200501060324.j063ODFW001665@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: ValueTypes.h updated: 1.7 -> 1.8 --- Log message: Add a useful method --- Diffs of the changes: (+16 -0) Index: llvm/include/llvm/CodeGen/ValueTypes.h diff -u llvm/include/llvm/CodeGen/ValueTypes.h:1.7 llvm/include/llvm/CodeGen/ValueTypes.h:1.8 --- llvm/include/llvm/CodeGen/ValueTypes.h:1.7 Wed Jan 5 16:14:14 2005 +++ llvm/include/llvm/CodeGen/ValueTypes.h Wed Jan 5 21:23:59 2005 @@ -49,6 +49,22 @@ static inline bool isFloatingPoint(ValueType VT) { return VT >= f32 && VT <= f128; } + + static inline unsigned getSizeInBits(ValueType VT) { + switch (VT) { + default: assert(0 && "ValueType has no known size!"); + case MVT::i1 : return 1; + case MVT::i8 : return 8; + case MVT::i16 : return 16; + case MVT::f32 : + case MVT::i32 : return 32; + case MVT::f64 : + case MVT::i64 : return 64; + case MVT::f80 : return 80; + case MVT::f128: + case MVT::i128: return 128; + } + } }; } // End llvm namespace From lattner at cs.uiuc.edu Wed Jan 5 21:25:39 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 5 Jan 2005 21:25:39 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/ValueTypes.h Message-ID: <200501060325.j063PdcT001982@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: ValueTypes.h updated: 1.8 -> 1.9 --- Log message: Add required #include --- Diffs of the changes: (+2 -0) Index: llvm/include/llvm/CodeGen/ValueTypes.h diff -u llvm/include/llvm/CodeGen/ValueTypes.h:1.8 llvm/include/llvm/CodeGen/ValueTypes.h:1.9 --- llvm/include/llvm/CodeGen/ValueTypes.h:1.8 Wed Jan 5 21:23:59 2005 +++ llvm/include/llvm/CodeGen/ValueTypes.h Wed Jan 5 21:25:27 2005 @@ -16,6 +16,8 @@ #ifndef LLVM_CODEGEN_VALUETYPES_H #define LLVM_CODEGEN_VALUETYPES_H +#include + namespace llvm { /// MVT namespace - This namespace defines the ValueType enum, which contains From jeffc at jolt-lang.org Wed Jan 5 22:22:02 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Wed, 5 Jan 2005 22:22:02 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/CBackend/Writer.cpp Message-ID: <200501060422.WAA06517@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/CBackend: Writer.cpp updated: 1.217 -> 1.218 --- Log message: Fix CBE code so that it compiles with VC++. --- Diffs of the changes: (+1 -1) Index: llvm/lib/Target/CBackend/Writer.cpp diff -u llvm/lib/Target/CBackend/Writer.cpp:1.217 llvm/lib/Target/CBackend/Writer.cpp:1.218 --- llvm/lib/Target/CBackend/Writer.cpp:1.217 Tue Dec 28 22:00:09 2004 +++ llvm/lib/Target/CBackend/Writer.cpp Wed Jan 5 22:21:49 2005 @@ -735,7 +735,7 @@ << "#define alloca(x) __builtin_alloca(x)\n" << "#elif defined(__FreeBSD__)\n" << "#define alloca(x) __builtin_alloca(x)\n" - << "#else\n" + << "#elif !defined(_MSC_VER)\n" << "#include \n" << "#endif\n\n"; From llvm at cs.uiuc.edu Wed Jan 5 23:43:54 2005 From: llvm at cs.uiuc.edu (LLVM) Date: Wed, 5 Jan 2005 23:43:54 -0600 Subject: [llvm-commits] CVS: llvm/win32/opt/ Message-ID: <200501060543.XAA07149@zion.cs.uiuc.edu> Changes in directory llvm/win32/opt: --- Log message: Directory /var/cvs/llvm/llvm/win32/opt added to the repository --- Diffs of the changes: (+0 -0) From jeffc at jolt-lang.org Wed Jan 5 23:45:56 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Wed, 5 Jan 2005 23:45:56 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Transforms/Instrumentation.h Message-ID: <200501060545.XAA07198@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Transforms: Instrumentation.h updated: 1.4 -> 1.5 --- Log message: Fix incorrect return type. --- Diffs of the changes: (+1 -1) Index: llvm/include/llvm/Transforms/Instrumentation.h diff -u llvm/include/llvm/Transforms/Instrumentation.h:1.4 llvm/include/llvm/Transforms/Instrumentation.h:1.5 --- llvm/include/llvm/Transforms/Instrumentation.h:1.4 Thu Sep 30 15:13:55 2004 +++ llvm/include/llvm/Transforms/Instrumentation.h Wed Jan 5 23:45:45 2005 @@ -26,7 +26,7 @@ FunctionPass *createCombineBranchesPass(); // Reoptimizer support pass: emit table of global functions -FunctionPass *createEmitFunctionTablePass (); +ModulePass *createEmitFunctionTablePass (); //===----------------------------------------------------------------------===// From jeffc at jolt-lang.org Wed Jan 5 23:46:55 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Wed, 5 Jan 2005 23:46:55 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Instrumentation/EmitFunctions.cpp Message-ID: <200501060546.XAA07215@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Instrumentation: EmitFunctions.cpp updated: 1.21 -> 1.22 --- Log message: Add missing include --- Diffs of the changes: (+1 -0) Index: llvm/lib/Transforms/Instrumentation/EmitFunctions.cpp diff -u llvm/lib/Transforms/Instrumentation/EmitFunctions.cpp:1.21 llvm/lib/Transforms/Instrumentation/EmitFunctions.cpp:1.22 --- llvm/lib/Transforms/Instrumentation/EmitFunctions.cpp:1.21 Wed Oct 20 14:38:58 2004 +++ llvm/lib/Transforms/Instrumentation/EmitFunctions.cpp Wed Jan 5 23:46:44 2005 @@ -24,6 +24,7 @@ #include "llvm/Module.h" #include "llvm/Pass.h" #include "llvm/Support/CFG.h" +#include "llvm/Transforms/Instrumentation.h" using namespace llvm; namespace llvm { From jeffc at jolt-lang.org Wed Jan 5 23:47:29 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Wed, 5 Jan 2005 23:47:29 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Message-ID: <200501060547.XAA07234@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: LoopUnswitch.cpp updated: 1.3 -> 1.4 --- Log message: Put createLoopUnswitchPass() into proper namespace --- Diffs of the changes: (+1 -1) Index: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp diff -u llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.3 llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.4 --- llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.3 Fri Sep 3 13:19:51 2004 +++ llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Wed Jan 5 23:47:18 2005 @@ -68,7 +68,7 @@ RegisterOpt X("loop-unswitch", "Unswitch loops"); } -FunctionPass *createLoopUnswitchPass() { return new LoopUnswitch(); } +FunctionPass *llvm::createLoopUnswitchPass() { return new LoopUnswitch(); } bool LoopUnswitch::runOnFunction(Function &F) { bool Changed = false; From jeffc at jolt-lang.org Thu Jan 6 00:03:05 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Thu, 6 Jan 2005 00:03:05 -0600 Subject: [llvm-commits] CVS: llvm/tools/opt/opt.cpp Message-ID: <200501060603.AAA07426@zion.cs.uiuc.edu> Changes in directory llvm/tools/opt: opt.cpp updated: 1.102 -> 1.103 --- Log message: Add project opt to Visual Studio. --- Diffs of the changes: (+1 -0) Index: llvm/tools/opt/opt.cpp diff -u llvm/tools/opt/opt.cpp:1.102 llvm/tools/opt/opt.cpp:1.103 --- llvm/tools/opt/opt.cpp:1.102 Wed Jan 5 11:31:55 2005 +++ llvm/tools/opt/opt.cpp Thu Jan 6 00:02:53 2005 @@ -23,6 +23,7 @@ #include "llvm/System/Signals.h" #include "llvm/Support/PluginLoader.h" #include "llvm/Support/SystemUtils.h" +#include "llvm/Transforms/LinkAllPasses.h" #include #include #include From jeffc at jolt-lang.org Thu Jan 6 00:03:05 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Thu, 6 Jan 2005 00:03:05 -0600 Subject: [llvm-commits] CVS: llvm/win32/Transforms/Transforms.vcproj Message-ID: <200501060603.AAA07432@zion.cs.uiuc.edu> Changes in directory llvm/win32/Transforms: Transforms.vcproj updated: 1.8 -> 1.9 --- Log message: Add project opt to Visual Studio. --- Diffs of the changes: (+9 -0) Index: llvm/win32/Transforms/Transforms.vcproj diff -u llvm/win32/Transforms/Transforms.vcproj:1.8 llvm/win32/Transforms/Transforms.vcproj:1.9 --- llvm/win32/Transforms/Transforms.vcproj:1.8 Sat Dec 18 20:29:00 2004 +++ llvm/win32/Transforms/Transforms.vcproj Thu Jan 6 00:02:53 2005 @@ -229,6 +229,9 @@ + + + + + + Changes in directory llvm/win32: llvm.sln updated: 1.14 -> 1.15 --- Log message: Add project opt to Visual Studio. --- Diffs of the changes: (+16 -0) Index: llvm/win32/llvm.sln diff -u llvm/win32/llvm.sln:1.14 llvm/win32/llvm.sln:1.15 --- llvm/win32/llvm.sln:1.14 Tue Jan 4 00:01:54 2005 +++ llvm/win32/llvm.sln Thu Jan 6 00:02:53 2005 @@ -163,6 +163,18 @@ {19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E} EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "opt", "opt\opt.vcproj", "{006D8B41-C3C7-4448-85E1-AF8907E591E5}" + ProjectSection(ProjectDependencies) = postProject + {0622E827-8464-489D-8B1C-B0B496F35C08} = {0622E827-8464-489D-8B1C-B0B496F35C08} + {28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508} + {19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E} + {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D61} = {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D61} + {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 Global GlobalSection(SolutionConfiguration) = preSolution Debug = Debug @@ -261,6 +273,10 @@ {057777CD-DED5-46DF-BF9A-6B76DE212549}.Debug.Build.0 = Debug|Win32 {057777CD-DED5-46DF-BF9A-6B76DE212549}.Release.ActiveCfg = Release|Win32 {057777CD-DED5-46DF-BF9A-6B76DE212549}.Release.Build.0 = Release|Win32 + {006D8B41-C3C7-4448-85E1-AF8907E591E5}.Debug.ActiveCfg = Debug|Win32 + {006D8B41-C3C7-4448-85E1-AF8907E591E5}.Debug.Build.0 = Debug|Win32 + {006D8B41-C3C7-4448-85E1-AF8907E591E5}.Release.ActiveCfg = Release|Win32 + {006D8B41-C3C7-4448-85E1-AF8907E591E5}.Release.Build.0 = Release|Win32 EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution EndGlobalSection From jeffc at jolt-lang.org Thu Jan 6 00:03:05 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Thu, 6 Jan 2005 00:03:05 -0600 Subject: [llvm-commits] CVS: llvm/win32/opt/opt.vcproj Message-ID: <200501060603.AAA07436@zion.cs.uiuc.edu> Changes in directory llvm/win32/opt: opt.vcproj added (r1.1) --- Log message: Add project opt to Visual Studio. --- Diffs of the changes: (+137 -0) Index: llvm/win32/opt/opt.vcproj diff -c /dev/null llvm/win32/opt/opt.vcproj:1.1 *** /dev/null Thu Jan 6 00:03:03 2005 --- llvm/win32/opt/opt.vcproj Thu Jan 6 00:02:53 2005 *************** *** 0 **** --- 1,137 ---- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From jeffc at jolt-lang.org Thu Jan 6 00:03:05 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Thu, 6 Jan 2005 00:03:05 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Transforms/LinkAllPasses.h Message-ID: <200501060603.AAA07435@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Transforms: LinkAllPasses.h added (r1.1) --- Log message: Add project opt to Visual Studio. --- Diffs of the changes: (+114 -0) Index: llvm/include/llvm/Transforms/LinkAllPasses.h diff -c /dev/null llvm/include/llvm/Transforms/LinkAllPasses.h:1.1 *** /dev/null Thu Jan 6 00:03:03 2005 --- llvm/include/llvm/Transforms/LinkAllPasses.h Thu Jan 6 00:02:53 2005 *************** *** 0 **** --- 1,114 ---- + //===- llvm/Transforms/IPO.h - Interprocedural Transformations --*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Jeff Cohen and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This header file is required for building with Microsoft's VC++, as it has + // no way of linking all registered passes into executables other than by + // explicit use. + // + //===----------------------------------------------------------------------===// + + #ifndef LLVM_TRANSFORMS_LINKALLPASSES_H + #define LLVM_TRANSFORMS_LINKALLPASSES_H + + #include "llvm/Config/config.h" + + #ifdef LLVM_ON_WIN32 + + #include "llvm/Transforms/Instrumentation.h" + #include "llvm/Transforms/IPO.h" + #include "llvm/Transforms/Scalar.h" + #include "llvm/Transforms/Utils/UnifyFunctionExitNodes.h" + + // Trying not to include , though maybe we should... + extern "C" __declspec(dllimport) void* __stdcall GetCurrentProcess(); + + namespace { + struct ForceLinking { + ForceLinking() { + // We must reference the passes in such a way that VC++ will not + // delete it all as dead code, even with whole program optimization, + // yet is effectively a NO-OP. As the compiler isn't smart enough + // to know that GetCurrentProcess() never returns + // INVALID_HANDLE_VALUE, this will do the job. + if (GetCurrentProcess() != (void *) -1) + return; + + std::vector bbv; + + // The commented out calls below refer to non-existant creation + // functions. They will be uncommented as the functions are added. + + // (void) llvm::createADCEPass(); + // (void) llvm::createArgPromotionPass(); + // (void) llvm::createBasicBlockTracerPass(); + (void) llvm::createBlockExtractorPass(bbv); + // (void) llvm::createBlockPlacementPass(); + // (void) llvm::createBlockProfilerPass(); + (void) llvm::createBreakCriticalEdgesPass(); + // (void) llvm::createCEEPass(); + // (void) llvm::createCFGSimplifyPass(); + (void) llvm::createCombineBranchesPass(); + // (void) llvm::createConstantExpressionsLowerPass(); + (void) llvm::createConstantMergePass(); + (void) llvm::createConstantPropagationPass(); + // (void) llvm::createDAEPass(); + // (void) llvm::createDCEPass(); + // (void) llvm::createDSEPass(); + // (void) llvm::createDTEPass(); + (void) llvm::createDeadInstEliminationPass(); + // (void) llvm::createEdgeProfilerPass(); + (void) llvm::createEmitFunctionTablePass(); + // (void) llvm::createFunctionProfilerPass(); + (void) llvm::createFunctionResolvingPass(); + // (void) llvm::createFunctionTracerPass(); + (void) llvm::createGCSEPass(); + (void) llvm::createGlobalDCEPass(); + (void) llvm::createGlobalOptimizerPass(); + // (void) llvm::createIPCPPass(); + (void) llvm::createIPSCCPPass(); + (void) llvm::createIndVarSimplifyPass(); + // (void) llvm::createInstCombinerPass(); + // (void) llvm::createInstLoopsPass(); + (void) llvm::createInternalizePass(); + (void) llvm::createLICMPass(); + // (void) llvm::createLoopExtractorPass(); + (void) llvm::createLoopSimplifyPass(); + (void) llvm::createLoopStrengthReducePass(); + (void) llvm::createLoopUnrollPass(); + (void) llvm::createLoopUnswitchPass(); + (void) llvm::createLowerAllocationsPass(); + (void) llvm::createLowerGCPass(); + (void) llvm::createLowerInvokePass(); + (void) llvm::createLowerPackedPass(); + (void) llvm::createLowerSelectPass(); + (void) llvm::createLowerSetJmpPass(); + (void) llvm::createLowerSwitchPass(); + // (void) llvm::createPREPass(); + // (void) llvm::createProfilePathsPass(); + // (void) llvm::createPromotePass(); + (void) llvm::createPruneEHPass(); + // (void) llvm::createRPRPass(); + (void) llvm::createRaiseAllocationsPass(); + (void) llvm::createReassociatePass(); + (void) llvm::createSCCPPass(); + // (void) llvm::createSROAPass(); + // (void) llvm::createSimpleInlinerPass(); + (void) llvm::createSingleLoopExtractorPass(); + (void) llvm::createStripSymbolsPass(); + (void) llvm::createTailCallEliminationPass(); + (void) llvm::createTailDuplicationPass(); + // (void) llvm::createTraceBasicBlocksPass(); + (void) llvm::createUnifyFunctionExitNodesPass(); + } + } X; + }; + + #endif // LLVM_ON_WIN32 + + #endif From jeffc at jolt-lang.org Thu Jan 6 00:06:46 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Thu, 6 Jan 2005 00:06:46 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Transforms/LinkAllPasses.h Message-ID: <200501060606.AAA07480@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Transforms: LinkAllPasses.h updated: 1.1 -> 1.2 --- Log message: Get rid of those pesky tabs... --- Diffs of the changes: (+14 -14) Index: llvm/include/llvm/Transforms/LinkAllPasses.h diff -u llvm/include/llvm/Transforms/LinkAllPasses.h:1.1 llvm/include/llvm/Transforms/LinkAllPasses.h:1.2 --- llvm/include/llvm/Transforms/LinkAllPasses.h:1.1 Thu Jan 6 00:02:53 2005 +++ llvm/include/llvm/Transforms/LinkAllPasses.h Thu Jan 6 00:06:35 2005 @@ -29,20 +29,20 @@ extern "C" __declspec(dllimport) void* __stdcall GetCurrentProcess(); namespace { - struct ForceLinking { - ForceLinking() { - // We must reference the passes in such a way that VC++ will not - // delete it all as dead code, even with whole program optimization, - // yet is effectively a NO-OP. As the compiler isn't smart enough - // to know that GetCurrentProcess() never returns - // INVALID_HANDLE_VALUE, this will do the job. - if (GetCurrentProcess() != (void *) -1) - return; + struct ForceLinking { + ForceLinking() { + // We must reference the passes in such a way that VC++ will not + // delete it all as dead code, even with whole program optimization, + // yet is effectively a NO-OP. As the compiler isn't smart enough + // to know that GetCurrentProcess() never returns + // INVALID_HANDLE_VALUE, this will do the job. + if (GetCurrentProcess() != (void *) -1) + return; - std::vector bbv; + std::vector bbv; - // The commented out calls below refer to non-existant creation - // functions. They will be uncommented as the functions are added. + // The commented out calls below refer to non-existant creation + // functions. They will be uncommented as the functions are added. // (void) llvm::createADCEPass(); // (void) llvm::createArgPromotionPass(); @@ -105,8 +105,8 @@ (void) llvm::createTailDuplicationPass(); // (void) llvm::createTraceBasicBlocksPass(); (void) llvm::createUnifyFunctionExitNodesPass(); - } - } X; + } + } X; }; #endif // LLVM_ON_WIN32 From jeffc at jolt-lang.org Thu Jan 6 00:29:53 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Thu, 6 Jan 2005 00:29:53 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Transforms/LinkAllPasses.h Message-ID: <200501060629.AAA07733@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Transforms: LinkAllPasses.h updated: 1.2 -> 1.3 --- Log message: Fix minor mistakes --- Diffs of the changes: (+1 -3) Index: llvm/include/llvm/Transforms/LinkAllPasses.h diff -u llvm/include/llvm/Transforms/LinkAllPasses.h:1.2 llvm/include/llvm/Transforms/LinkAllPasses.h:1.3 --- llvm/include/llvm/Transforms/LinkAllPasses.h:1.2 Thu Jan 6 00:06:35 2005 +++ llvm/include/llvm/Transforms/LinkAllPasses.h Thu Jan 6 00:29:42 2005 @@ -1,4 +1,4 @@ -//===- llvm/Transforms/IPO.h - Interprocedural Transformations --*- C++ -*-===// +//===- llvm/Transforms/LinkAllPasses.h - Reference All Passes ---*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -16,8 +16,6 @@ #ifndef LLVM_TRANSFORMS_LINKALLPASSES_H #define LLVM_TRANSFORMS_LINKALLPASSES_H -#include "llvm/Config/config.h" - #ifdef LLVM_ON_WIN32 #include "llvm/Transforms/Instrumentation.h" From jeffc at jolt-lang.org Thu Jan 6 00:29:53 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Thu, 6 Jan 2005 00:29:53 -0600 Subject: [llvm-commits] CVS: llvm/tools/opt/opt.cpp Message-ID: <200501060629.AAA07736@zion.cs.uiuc.edu> Changes in directory llvm/tools/opt: opt.cpp updated: 1.103 -> 1.104 --- Log message: Fix minor mistakes --- Diffs of the changes: (+1 -0) Index: llvm/tools/opt/opt.cpp diff -u llvm/tools/opt/opt.cpp:1.103 llvm/tools/opt/opt.cpp:1.104 --- llvm/tools/opt/opt.cpp:1.103 Thu Jan 6 00:02:53 2005 +++ llvm/tools/opt/opt.cpp Thu Jan 6 00:29:42 2005 @@ -12,6 +12,7 @@ // //===----------------------------------------------------------------------===// +#include "llvm/Config/config.h" #include "llvm/Module.h" #include "llvm/PassManager.h" #include "llvm/Bytecode/Reader.h" From jeffc at jolt-lang.org Thu Jan 6 01:01:19 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Thu, 6 Jan 2005 01:01:19 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Transforms/LinkAllPasses.h Message-ID: <200501060701.BAA08147@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Transforms: LinkAllPasses.h updated: 1.3 -> 1.4 --- Log message: Get the #ifdef right on LinkAllPasses.h. --- Diffs of the changes: (+4 -3) Index: llvm/include/llvm/Transforms/LinkAllPasses.h diff -u llvm/include/llvm/Transforms/LinkAllPasses.h:1.3 llvm/include/llvm/Transforms/LinkAllPasses.h:1.4 --- llvm/include/llvm/Transforms/LinkAllPasses.h:1.3 Thu Jan 6 00:29:42 2005 +++ llvm/include/llvm/Transforms/LinkAllPasses.h Thu Jan 6 01:01:08 2005 @@ -16,14 +16,15 @@ #ifndef LLVM_TRANSFORMS_LINKALLPASSES_H #define LLVM_TRANSFORMS_LINKALLPASSES_H -#ifdef LLVM_ON_WIN32 +#ifdef _MSC_VER #include "llvm/Transforms/Instrumentation.h" #include "llvm/Transforms/IPO.h" #include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Utils/UnifyFunctionExitNodes.h" -// Trying not to include , though maybe we should... +// Trying not to include , though maybe we should... Problem is, +// it pollutes the global namespace in some really nasty ways. extern "C" __declspec(dllimport) void* __stdcall GetCurrentProcess(); namespace { @@ -107,6 +108,6 @@ } X; }; -#endif // LLVM_ON_WIN32 +#endif // _MSC_VER #endif From jeffc at jolt-lang.org Thu Jan 6 01:01:19 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Thu, 6 Jan 2005 01:01:19 -0600 Subject: [llvm-commits] CVS: llvm/tools/opt/opt.cpp Message-ID: <200501060701.BAA08148@zion.cs.uiuc.edu> Changes in directory llvm/tools/opt: opt.cpp updated: 1.104 -> 1.105 --- Log message: Get the #ifdef right on LinkAllPasses.h. --- Diffs of the changes: (+0 -1) Index: llvm/tools/opt/opt.cpp diff -u llvm/tools/opt/opt.cpp:1.104 llvm/tools/opt/opt.cpp:1.105 --- llvm/tools/opt/opt.cpp:1.104 Thu Jan 6 00:29:42 2005 +++ llvm/tools/opt/opt.cpp Thu Jan 6 01:01:08 2005 @@ -12,7 +12,6 @@ // //===----------------------------------------------------------------------===// -#include "llvm/Config/config.h" #include "llvm/Module.h" #include "llvm/PassManager.h" #include "llvm/Bytecode/Reader.h" From lattner at cs.uiuc.edu Thu Jan 6 10:26:54 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 6 Jan 2005 10:26:54 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/ConstantFolding.cpp Message-ID: <200501061626.j06GQsOd011072@apoc.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: ConstantFolding.cpp updated: 1.69 -> 1.70 --- Log message: No need to pessimize current code for future possibilities. --- Diffs of the changes: (+3 -4) Index: llvm/lib/VMCore/ConstantFolding.cpp diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.69 llvm/lib/VMCore/ConstantFolding.cpp:1.70 --- llvm/lib/VMCore/ConstantFolding.cpp:1.69 Mon Nov 22 13:15:27 2004 +++ llvm/lib/VMCore/ConstantFolding.cpp Thu Jan 6 10:26:38 2005 @@ -529,10 +529,9 @@ if (const GlobalValue *GV = dyn_cast(V)) { if (DestTy == Type::BoolTy) // FIXME: When we support 'external weak' references, we have to prevent - // this transformation from happening. In the meantime we avoid folding - // any cast of an external symbol. - if (!GV->isExternal()) - return ConstantBool::True; + // this transformation from happening. This code will need to be updated + // to ignore external weak symbols when we support it. + return ConstantBool::True; } else if (const ConstantExpr *CE = dyn_cast(V)) { if (CE->getOpcode() == Instruction::Cast) { Constant *Op = const_cast(CE->getOperand(0)); From tbrethou at cs.uiuc.edu Thu Jan 6 13:20:32 2005 From: tbrethou at cs.uiuc.edu (Tanya Brethour) Date: Thu, 6 Jan 2005 13:20:32 -0600 (CST) Subject: [llvm-commits] CVS: reopt/include/reopt/VirtualMem.h Message-ID: <200501061920.NAA09542@kain.cs.uiuc.edu> Changes in directory reopt/include/reopt: VirtualMem.h updated: 1.14 -> 1.15 --- Log message: Changed includes to include system headers instead of the ones generated by configure. This is bad for portability, but the reoptimizer is not portable to begi with. --- Diffs of the changes: (+2 -2) Index: reopt/include/reopt/VirtualMem.h diff -u reopt/include/reopt/VirtualMem.h:1.14 reopt/include/reopt/VirtualMem.h:1.15 --- reopt/include/reopt/VirtualMem.h:1.14 Thu Sep 2 11:55:42 2004 +++ reopt/include/reopt/VirtualMem.h Thu Jan 6 13:20:20 2005 @@ -9,8 +9,8 @@ #define REOPT_VIRTUALMEM_H #include "llvm/Support/DataTypes.h" -#include "llvm/Config/fcntl.h" -#include "llvm/Config/unistd.h" +#include +#include #include #include #include From lattner at cs.uiuc.edu Thu Jan 6 15:19:08 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 6 Jan 2005 15:19:08 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/X86/negatize_zero.ll Message-ID: <200501062119.j06LJ83b016271@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/X86: negatize_zero.ll added (r1.1) --- Log message: New testcase --- Diffs of the changes: (+6 -0) Index: llvm/test/Regression/CodeGen/X86/negatize_zero.ll diff -c /dev/null llvm/test/Regression/CodeGen/X86/negatize_zero.ll:1.1 *** /dev/null Thu Jan 6 15:19:03 2005 --- llvm/test/Regression/CodeGen/X86/negatize_zero.ll Thu Jan 6 15:18:53 2005 *************** *** 0 **** --- 1,6 ---- + ; RUN: llvm-as < %s | llc -march=x86 | grep fchs + + + double %T() { + ret double -1.0 ;; codegen as fld1/fchs, not as a load from cst pool + } From lattner at cs.uiuc.edu Thu Jan 6 15:19:29 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 6 Jan 2005 15:19:29 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelSimple.cpp Message-ID: <200501062119.j06LJTPh016282@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelSimple.cpp updated: 1.304 -> 1.305 --- Log message: Codegen -1 and -0.0 more efficiently. This implements CodeGen/X86/negatize_zero.ll --- Diffs of the changes: (+9 -2) Index: llvm/lib/Target/X86/X86ISelSimple.cpp diff -u llvm/lib/Target/X86/X86ISelSimple.cpp:1.304 llvm/lib/Target/X86/X86ISelSimple.cpp:1.305 --- llvm/lib/Target/X86/X86ISelSimple.cpp:1.304 Wed Jan 5 10:30:14 2005 +++ llvm/lib/Target/X86/X86ISelSimple.cpp Thu Jan 6 15:19:16 2005 @@ -560,8 +560,15 @@ BuildMI(*MBB, IP, X86::FLD0, 0, R); else if (CFP->isExactlyValue(+1.0)) BuildMI(*MBB, IP, X86::FLD1, 0, R); - else { // FIXME: PI, other native values - // FIXME: Could handle -1.0 with FLD1/FCHS + else if (CFP->isExactlyValue(-0.0)) { + unsigned Tmp = makeAnotherReg(Type::DoubleTy); + BuildMI(*MBB, IP, X86::FLD0, 0, Tmp); + BuildMI(*MBB, IP, X86::FCHS, 1, R).addReg(Tmp); + } else if (CFP->isExactlyValue(-1.0)) { + unsigned Tmp = makeAnotherReg(Type::DoubleTy); + BuildMI(*MBB, IP, X86::FLD1, 0, Tmp); + BuildMI(*MBB, IP, X86::FCHS, 1, R).addReg(Tmp); + } else { // FIXME: PI, other native values // FIXME: 2*PI -> LDPI + FADD // Otherwise we need to spill the constant to memory. From jeffc at jolt-lang.org Thu Jan 6 23:41:49 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Thu, 6 Jan 2005 23:41:49 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Transforms/Instrumentation.h Message-ID: <200501070541.XAA10572@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Transforms: Instrumentation.h updated: 1.5 -> 1.6 --- Log message: Fix return type --- Diffs of the changes: (+1 -1) Index: llvm/include/llvm/Transforms/Instrumentation.h diff -u llvm/include/llvm/Transforms/Instrumentation.h:1.5 llvm/include/llvm/Transforms/Instrumentation.h:1.6 --- llvm/include/llvm/Transforms/Instrumentation.h:1.5 Wed Jan 5 23:45:45 2005 +++ llvm/include/llvm/Transforms/Instrumentation.h Thu Jan 6 23:41:39 2005 @@ -20,7 +20,7 @@ class FunctionPass; // Reoptimizer support pass: add instrumentation calls to back-edges of loops -ModulePass *createLoopInstrumentationPass (); +FunctionPass *createLoopInstrumentationPass (); // Reoptimizer support pass: combine multiple back-edges w/ same target into one FunctionPass *createCombineBranchesPass(); From jeffc at jolt-lang.org Thu Jan 6 23:42:24 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Thu, 6 Jan 2005 23:42:24 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp Message-ID: <200501070542.XAA10590@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Instrumentation/ProfilePaths: InstLoops.cpp updated: 1.18 -> 1.19 --- Log message: Add missing include --- Diffs of the changes: (+1 -0) Index: llvm/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp diff -u llvm/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp:1.18 llvm/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp:1.19 --- llvm/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp:1.18 Thu Sep 30 15:14:29 2004 +++ llvm/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp Thu Jan 6 23:42:13 2005 @@ -21,6 +21,7 @@ #include "llvm/Pass.h" #include "llvm/Type.h" #include "llvm/Support/Debug.h" +#include "llvm/Transforms/Instrumentation.h" #include "../ProfilingUtils.h" namespace llvm { From jeffc at jolt-lang.org Fri Jan 7 00:12:52 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Fri, 7 Jan 2005 00:12:52 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Transforms/LinkAllPasses.h Message-ID: <200501070612.AAA10846@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Transforms: LinkAllPasses.h updated: 1.4 -> 1.5 --- Log message: Update list of passes --- Diffs of the changes: (+17 -30) Index: llvm/include/llvm/Transforms/LinkAllPasses.h diff -u llvm/include/llvm/Transforms/LinkAllPasses.h:1.4 llvm/include/llvm/Transforms/LinkAllPasses.h:1.5 --- llvm/include/llvm/Transforms/LinkAllPasses.h:1.4 Thu Jan 6 01:01:08 2005 +++ llvm/include/llvm/Transforms/LinkAllPasses.h Fri Jan 7 00:12:41 2005 @@ -43,40 +43,32 @@ // The commented out calls below refer to non-existant creation // functions. They will be uncommented as the functions are added. - // (void) llvm::createADCEPass(); - // (void) llvm::createArgPromotionPass(); - // (void) llvm::createBasicBlockTracerPass(); - (void) llvm::createBlockExtractorPass(bbv); - // (void) llvm::createBlockPlacementPass(); - // (void) llvm::createBlockProfilerPass(); + (void) llvm::createAggressiveDCEPass(); + (void) llvm::createArgumentPromotionPass(); (void) llvm::createBreakCriticalEdgesPass(); - // (void) llvm::createCEEPass(); - // (void) llvm::createCFGSimplifyPass(); + (void) llvm::createCFGSimplificationPass(); (void) llvm::createCombineBranchesPass(); - // (void) llvm::createConstantExpressionsLowerPass(); (void) llvm::createConstantMergePass(); (void) llvm::createConstantPropagationPass(); - // (void) llvm::createDAEPass(); - // (void) llvm::createDCEPass(); - // (void) llvm::createDSEPass(); - // (void) llvm::createDTEPass(); + (void) llvm::createCorrelatedExpressionEliminationPass(); + (void) llvm::createDeadArgEliminationPass(); + (void) llvm::createDeadCodeEliminationPass(); (void) llvm::createDeadInstEliminationPass(); - // (void) llvm::createEdgeProfilerPass(); + (void) llvm::createDeadStoreEliminationPass(); + (void) llvm::createDeadTypeEliminationPass(); (void) llvm::createEmitFunctionTablePass(); - // (void) llvm::createFunctionProfilerPass(); + (void) llvm::createFunctionInliningPass(); (void) llvm::createFunctionResolvingPass(); - // (void) llvm::createFunctionTracerPass(); (void) llvm::createGCSEPass(); (void) llvm::createGlobalDCEPass(); (void) llvm::createGlobalOptimizerPass(); - // (void) llvm::createIPCPPass(); + (void) llvm::createIPConstantPropagationPass(); (void) llvm::createIPSCCPPass(); (void) llvm::createIndVarSimplifyPass(); - // (void) llvm::createInstCombinerPass(); - // (void) llvm::createInstLoopsPass(); + (void) llvm::createInstructionCombiningPass(); (void) llvm::createInternalizePass(); (void) llvm::createLICMPass(); - // (void) llvm::createLoopExtractorPass(); + (void) llvm::createLoopInstrumentationPass(); (void) llvm::createLoopSimplifyPass(); (void) llvm::createLoopStrengthReducePass(); (void) llvm::createLoopUnrollPass(); @@ -85,25 +77,20 @@ (void) llvm::createLowerGCPass(); (void) llvm::createLowerInvokePass(); (void) llvm::createLowerPackedPass(); - (void) llvm::createLowerSelectPass(); (void) llvm::createLowerSetJmpPass(); (void) llvm::createLowerSwitchPass(); - // (void) llvm::createPREPass(); - // (void) llvm::createProfilePathsPass(); - // (void) llvm::createPromotePass(); + (void) llvm::createPromoteMemoryToRegister(); (void) llvm::createPruneEHPass(); - // (void) llvm::createRPRPass(); (void) llvm::createRaiseAllocationsPass(); + (void) llvm::createRaisePointerReferencesPass(); (void) llvm::createReassociatePass(); (void) llvm::createSCCPPass(); - // (void) llvm::createSROAPass(); - // (void) llvm::createSimpleInlinerPass(); + (void) llvm::createScalarReplAggregatesPass(); (void) llvm::createSingleLoopExtractorPass(); - (void) llvm::createStripSymbolsPass(); (void) llvm::createTailCallEliminationPass(); (void) llvm::createTailDuplicationPass(); - // (void) llvm::createTraceBasicBlocksPass(); - (void) llvm::createUnifyFunctionExitNodesPass(); + (void) llvm::createTraceValuesPassForBasicBlocks(); + (void) llvm::createTraceValuesPassForFunction(); } } X; }; From brukman at cs.uiuc.edu Fri Jan 7 00:45:18 2005 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri, 7 Jan 2005 00:45:18 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Transforms/LinkAllPasses.h Message-ID: <200501070645.AAA11087@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Transforms: LinkAllPasses.h updated: 1.5 -> 1.6 --- Log message: Fix spelling. --- Diffs of the changes: (+1 -1) Index: llvm/include/llvm/Transforms/LinkAllPasses.h diff -u llvm/include/llvm/Transforms/LinkAllPasses.h:1.5 llvm/include/llvm/Transforms/LinkAllPasses.h:1.6 --- llvm/include/llvm/Transforms/LinkAllPasses.h:1.5 Fri Jan 7 00:12:41 2005 +++ llvm/include/llvm/Transforms/LinkAllPasses.h Fri Jan 7 00:45:07 2005 @@ -40,7 +40,7 @@ std::vector bbv; - // The commented out calls below refer to non-existant creation + // The commented out calls below refer to non-existent creation // functions. They will be uncommented as the functions are added. (void) llvm::createAggressiveDCEPass(); From jeffc at jolt-lang.org Fri Jan 7 00:55:09 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Fri, 7 Jan 2005 00:55:09 -0600 Subject: [llvm-commits] CVS: llvm/win32/Transforms/Transforms.vcproj Message-ID: <200501070655.AAA11163@zion.cs.uiuc.edu> Changes in directory llvm/win32/Transforms: Transforms.vcproj updated: 1.9 -> 1.10 --- Log message: Remove bogus project folder --- Diffs of the changes: (+0 -4) Index: llvm/win32/Transforms/Transforms.vcproj diff -u llvm/win32/Transforms/Transforms.vcproj:1.9 llvm/win32/Transforms/Transforms.vcproj:1.10 --- llvm/win32/Transforms/Transforms.vcproj:1.9 Thu Jan 6 00:02:53 2005 +++ llvm/win32/Transforms/Transforms.vcproj Fri Jan 7 00:54:58 2005 @@ -169,10 +169,6 @@ - - Changes in directory llvm/lib/Transforms/Instrumentation/ProfilePaths: ProfilePaths.cpp updated: 1.41 -> 1.42 --- Log message: Add missing createXxxPass functions --- Diffs of the changes: (+3 -0) Index: llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp diff -u llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp:1.41 llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp:1.42 --- llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp:1.41 Wed Dec 8 10:05:02 2004 +++ llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp Fri Jan 7 00:57:28 2005 @@ -31,6 +31,7 @@ // //===----------------------------------------------------------------------===// +#include "llvm/Transforms/Instrumentation.h" #include "llvm/Transforms/Utils/UnifyFunctionExitNodes.h" #include "llvm/Support/CFG.h" #include "llvm/Constants.h" @@ -56,6 +57,8 @@ static RegisterOpt X("paths", "Profile Paths"); +FunctionPass *createProfilePathsPass() { return new ProfilePaths(); } + static Node *findBB(std::vector &st, BasicBlock *BB){ for(std::vector::iterator si=st.begin(); si!=st.end(); ++si){ if(((*si)->getElement())==BB){ From jeffc at jolt-lang.org Fri Jan 7 00:57:39 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Fri, 7 Jan 2005 00:57:39 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Transforms/Instrumentation.h LinkAllPasses.h Message-ID: <200501070657.AAA11263@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Transforms: Instrumentation.h updated: 1.6 -> 1.7 LinkAllPasses.h updated: 1.6 -> 1.7 --- Log message: Add missing createXxxPass functions --- Diffs of the changes: (+20 -3) Index: llvm/include/llvm/Transforms/Instrumentation.h diff -u llvm/include/llvm/Transforms/Instrumentation.h:1.6 llvm/include/llvm/Transforms/Instrumentation.h:1.7 --- llvm/include/llvm/Transforms/Instrumentation.h:1.6 Thu Jan 6 23:41:39 2005 +++ llvm/include/llvm/Transforms/Instrumentation.h Fri Jan 7 00:57:28 2005 @@ -28,6 +28,20 @@ // Reoptimizer support pass: emit table of global functions ModulePass *createEmitFunctionTablePass (); +// Reoptimizer support pass: insert function profiling instrumentation +ModulePass *createFunctionProfilerPass(); + +// Reoptimizer support pass: insert block profiling instrumentation +ModulePass *createBlockProfilerPass(); + +// Reoptimizer support pass: insert edge profiling instrumentation +ModulePass *createEdgeProfilerPass(); + +// Reoptimizer support pass: insert basic block tracing instrumentation +ModulePass *createTraceBasicBlockPass(); + +// Reoptimizer support pass: insert counting of execute paths instrumentation +FunctionPass *createProfilePathsPass(); //===----------------------------------------------------------------------===// // Support for inserting LLVM code to print values at basic block and function Index: llvm/include/llvm/Transforms/LinkAllPasses.h diff -u llvm/include/llvm/Transforms/LinkAllPasses.h:1.6 llvm/include/llvm/Transforms/LinkAllPasses.h:1.7 --- llvm/include/llvm/Transforms/LinkAllPasses.h:1.6 Fri Jan 7 00:45:07 2005 +++ llvm/include/llvm/Transforms/LinkAllPasses.h Fri Jan 7 00:57:28 2005 @@ -40,11 +40,9 @@ std::vector bbv; - // The commented out calls below refer to non-existent creation - // functions. They will be uncommented as the functions are added. - (void) llvm::createAggressiveDCEPass(); (void) llvm::createArgumentPromotionPass(); + (void) llvm::createBlockProfilerPass(); (void) llvm::createBreakCriticalEdgesPass(); (void) llvm::createCFGSimplificationPass(); (void) llvm::createCombineBranchesPass(); @@ -56,8 +54,10 @@ (void) llvm::createDeadInstEliminationPass(); (void) llvm::createDeadStoreEliminationPass(); (void) llvm::createDeadTypeEliminationPass(); + (void) llvm::createEdgeProfilerPass(); (void) llvm::createEmitFunctionTablePass(); (void) llvm::createFunctionInliningPass(); + (void) llvm::createFunctionProfilerPass(); (void) llvm::createFunctionResolvingPass(); (void) llvm::createGCSEPass(); (void) llvm::createGlobalDCEPass(); @@ -74,11 +74,13 @@ (void) llvm::createLoopUnrollPass(); (void) llvm::createLoopUnswitchPass(); (void) llvm::createLowerAllocationsPass(); + (void) llvm::createLowerConstantExpressionsPass(); (void) llvm::createLowerGCPass(); (void) llvm::createLowerInvokePass(); (void) llvm::createLowerPackedPass(); (void) llvm::createLowerSetJmpPass(); (void) llvm::createLowerSwitchPass(); + (void) llvm::createProfilePathsPass(); (void) llvm::createPromoteMemoryToRegister(); (void) llvm::createPruneEHPass(); (void) llvm::createRaiseAllocationsPass(); @@ -89,6 +91,7 @@ (void) llvm::createSingleLoopExtractorPass(); (void) llvm::createTailCallEliminationPass(); (void) llvm::createTailDuplicationPass(); + (void) llvm::createTraceBasicBlockPass(); (void) llvm::createTraceValuesPassForBasicBlocks(); (void) llvm::createTraceValuesPassForFunction(); } From jeffc at jolt-lang.org Fri Jan 7 00:57:39 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Fri, 7 Jan 2005 00:57:39 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp EdgeProfiling.cpp TraceBasicBlocks.cpp Message-ID: <200501070657.AAA11270@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Instrumentation: BlockProfiling.cpp updated: 1.10 -> 1.11 EdgeProfiling.cpp updated: 1.4 -> 1.5 TraceBasicBlocks.cpp updated: 1.9 -> 1.10 --- Log message: Add missing createXxxPass functions --- Diffs of the changes: (+17 -0) Index: llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp diff -u llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp:1.10 llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp:1.11 --- llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp:1.10 Sun Sep 19 23:44:01 2004 +++ llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp Fri Jan 7 00:57:28 2005 @@ -23,6 +23,7 @@ #include "llvm/DerivedTypes.h" #include "llvm/Module.h" #include "llvm/Pass.h" +#include "llvm/Transforms/Instrumentation.h" #include "ProfilingUtils.h" #include @@ -37,6 +38,11 @@ "Insert instrumentation for function profiling"); } +ModulePass *llvm::createFunctionProfilerPass() +{ + return new FunctionProfiler(); +} + bool FunctionProfiler::runOnModule(Module &M) { Function *Main = M.getMainFunction(); if (Main == 0) { @@ -77,6 +83,8 @@ "Insert instrumentation for block profiling"); } +ModulePass *llvm::createBlockProfilerPass() { return new BlockProfiler(); } + bool BlockProfiler::runOnModule(Module &M) { Function *Main = M.getMainFunction(); if (Main == 0) { Index: llvm/lib/Transforms/Instrumentation/EdgeProfiling.cpp diff -u llvm/lib/Transforms/Instrumentation/EdgeProfiling.cpp:1.4 llvm/lib/Transforms/Instrumentation/EdgeProfiling.cpp:1.5 --- llvm/lib/Transforms/Instrumentation/EdgeProfiling.cpp:1.4 Sun Sep 19 23:44:01 2004 +++ llvm/lib/Transforms/Instrumentation/EdgeProfiling.cpp Fri Jan 7 00:57:28 2005 @@ -22,6 +22,7 @@ #include "llvm/Module.h" #include "llvm/Pass.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h" +#include "llvm/Transforms/Instrumentation.h" #include "ProfilingUtils.h" #include #include @@ -36,6 +37,8 @@ "Insert instrumentation for edge profiling"); } +ModulePass *llvm::createEdgeProfilerPass() { return new EdgeProfiler(); } + bool EdgeProfiler::runOnModule(Module &M) { Function *Main = M.getMainFunction(); if (Main == 0) { Index: llvm/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp diff -u llvm/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp:1.9 llvm/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp:1.10 --- llvm/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp:1.9 Sun Sep 19 23:44:01 2004 +++ llvm/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp Fri Jan 7 00:57:28 2005 @@ -18,6 +18,7 @@ #include "llvm/Module.h" #include "llvm/Pass.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h" +#include "llvm/Transforms/Instrumentation.h" #include "llvm/Instructions.h" #include "ProfilingUtils.h" #include "llvm/Support/Debug.h" @@ -33,6 +34,11 @@ "Insert instrumentation for basic block tracing"); } +ModulePass *llvm::createTraceBasicBlockPass() +{ + return new TraceBasicBlocks(); +} + static void InsertInstrumentationCall (BasicBlock *BB, const std::string FnName, unsigned BBNumber) { From brukman at cs.uiuc.edu Fri Jan 7 01:05:45 2005 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri, 7 Jan 2005 01:05:45 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp Message-ID: <200501070705.BAA11389@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Instrumentation: BlockProfiling.cpp updated: 1.11 -> 1.12 --- Log message: Convert tabs to spaces --- Diffs of the changes: (+2 -3) Index: llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp diff -u llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp:1.11 llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp:1.12 --- llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp:1.11 Fri Jan 7 00:57:28 2005 +++ llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp Fri Jan 7 01:05:34 2005 @@ -38,9 +38,8 @@ "Insert instrumentation for function profiling"); } -ModulePass *llvm::createFunctionProfilerPass() -{ - return new FunctionProfiler(); +ModulePass *llvm::createFunctionProfilerPass() { + return new FunctionProfiler(); } bool FunctionProfiler::runOnModule(Module &M) { From lattner at cs.uiuc.edu Fri Jan 7 01:40:35 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jan 2005 01:40:35 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Function.h Message-ID: <200501070740.j077eZ8A031553@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm: Function.h updated: 1.56 -> 1.57 --- Log message: Add convenience method. --- Diffs of the changes: (+4 -0) Index: llvm/include/llvm/Function.h diff -u llvm/include/llvm/Function.h:1.56 llvm/include/llvm/Function.h:1.57 --- llvm/include/llvm/Function.h:1.56 Sun Dec 5 00:43:16 2004 +++ llvm/include/llvm/Function.h Fri Jan 7 01:40:20 2005 @@ -90,6 +90,10 @@ const Type *getReturnType() const; // Return the type of the ret val const FunctionType *getFunctionType() const; // Return the FunctionType for me + /// isVarArg - Return true if this function takes a variable number of + /// arguments. + bool isVarArg() const; + /// isExternal - Is the body of this function unknown? (The basic block list /// is empty if so.) This is true for external functions, defined as forward /// "declare"ations From lattner at cs.uiuc.edu Fri Jan 7 01:40:44 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jan 2005 01:40:44 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Function.cpp Message-ID: <200501070740.j077eiLH031561@apoc.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Function.cpp updated: 1.83 -> 1.84 --- Log message: Add convenience method. --- Diffs of the changes: (+4 -0) Index: llvm/lib/VMCore/Function.cpp diff -u llvm/lib/VMCore/Function.cpp:1.83 llvm/lib/VMCore/Function.cpp:1.84 --- llvm/lib/VMCore/Function.cpp:1.83 Sun Dec 5 00:43:27 2004 +++ llvm/lib/VMCore/Function.cpp Fri Jan 7 01:40:32 2005 @@ -142,6 +142,10 @@ return cast(getType()->getElementType()); } +bool Function::isVarArg() const { + return getFunctionType()->isVarArg(); +} + const Type *Function::getReturnType() const { return getFunctionType()->getReturnType(); } From jeffc at jolt-lang.org Fri Jan 7 01:44:15 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Fri, 7 Jan 2005 01:44:15 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Transforms/LinkAllPasses.h Message-ID: <200501070744.BAA11777@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Transforms: LinkAllPasses.h updated: 1.7 -> 1.8 --- Log message: Correct indentation levels --- Diffs of the changes: (+70 -70) Index: llvm/include/llvm/Transforms/LinkAllPasses.h diff -u llvm/include/llvm/Transforms/LinkAllPasses.h:1.7 llvm/include/llvm/Transforms/LinkAllPasses.h:1.8 --- llvm/include/llvm/Transforms/LinkAllPasses.h:1.7 Fri Jan 7 00:57:28 2005 +++ llvm/include/llvm/Transforms/LinkAllPasses.h Fri Jan 7 01:44:02 2005 @@ -1,6 +1,6 @@ //===- llvm/Transforms/LinkAllPasses.h - Reference All Passes ---*- C++ -*-===// // -// The LLVM Compiler Infrastructure +// The LLVM Compiler Infrastructure // // This file was developed by Jeff Cohen and is distributed under the // University of Illinois Open Source License. See LICENSE.TXT for details. @@ -23,79 +23,79 @@ #include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Utils/UnifyFunctionExitNodes.h" -// Trying not to include , though maybe we should... Problem is, +// Trying not to include , though maybe we should... Problem is, // it pollutes the global namespace in some really nasty ways. extern "C" __declspec(dllimport) void* __stdcall GetCurrentProcess(); namespace { - struct ForceLinking { - ForceLinking() { - // We must reference the passes in such a way that VC++ will not - // delete it all as dead code, even with whole program optimization, - // yet is effectively a NO-OP. As the compiler isn't smart enough - // to know that GetCurrentProcess() never returns - // INVALID_HANDLE_VALUE, this will do the job. - if (GetCurrentProcess() != (void *) -1) - return; - - std::vector bbv; - - (void) llvm::createAggressiveDCEPass(); - (void) llvm::createArgumentPromotionPass(); - (void) llvm::createBlockProfilerPass(); - (void) llvm::createBreakCriticalEdgesPass(); - (void) llvm::createCFGSimplificationPass(); - (void) llvm::createCombineBranchesPass(); - (void) llvm::createConstantMergePass(); - (void) llvm::createConstantPropagationPass(); - (void) llvm::createCorrelatedExpressionEliminationPass(); - (void) llvm::createDeadArgEliminationPass(); - (void) llvm::createDeadCodeEliminationPass(); - (void) llvm::createDeadInstEliminationPass(); - (void) llvm::createDeadStoreEliminationPass(); - (void) llvm::createDeadTypeEliminationPass(); - (void) llvm::createEdgeProfilerPass(); - (void) llvm::createEmitFunctionTablePass(); - (void) llvm::createFunctionInliningPass(); - (void) llvm::createFunctionProfilerPass(); - (void) llvm::createFunctionResolvingPass(); - (void) llvm::createGCSEPass(); - (void) llvm::createGlobalDCEPass(); - (void) llvm::createGlobalOptimizerPass(); - (void) llvm::createIPConstantPropagationPass(); - (void) llvm::createIPSCCPPass(); - (void) llvm::createIndVarSimplifyPass(); - (void) llvm::createInstructionCombiningPass(); - (void) llvm::createInternalizePass(); - (void) llvm::createLICMPass(); - (void) llvm::createLoopInstrumentationPass(); - (void) llvm::createLoopSimplifyPass(); - (void) llvm::createLoopStrengthReducePass(); - (void) llvm::createLoopUnrollPass(); - (void) llvm::createLoopUnswitchPass(); - (void) llvm::createLowerAllocationsPass(); - (void) llvm::createLowerConstantExpressionsPass(); - (void) llvm::createLowerGCPass(); - (void) llvm::createLowerInvokePass(); - (void) llvm::createLowerPackedPass(); - (void) llvm::createLowerSetJmpPass(); - (void) llvm::createLowerSwitchPass(); - (void) llvm::createProfilePathsPass(); - (void) llvm::createPromoteMemoryToRegister(); - (void) llvm::createPruneEHPass(); - (void) llvm::createRaiseAllocationsPass(); - (void) llvm::createRaisePointerReferencesPass(); - (void) llvm::createReassociatePass(); - (void) llvm::createSCCPPass(); - (void) llvm::createScalarReplAggregatesPass(); - (void) llvm::createSingleLoopExtractorPass(); - (void) llvm::createTailCallEliminationPass(); - (void) llvm::createTailDuplicationPass(); - (void) llvm::createTraceBasicBlockPass(); - (void) llvm::createTraceValuesPassForBasicBlocks(); - (void) llvm::createTraceValuesPassForFunction(); - } - } X; + struct ForceLinking { + ForceLinking() { + // We must reference the passes in such a way that VC++ will not + // delete it all as dead code, even with whole program optimization, + // yet is effectively a NO-OP. As the compiler isn't smart enough + // to know that GetCurrentProcess() never returns + // INVALID_HANDLE_VALUE, this will do the job. + if (GetCurrentProcess() != (void *) -1) + return; + + std::vector bbv; + + (void) llvm::createAggressiveDCEPass(); + (void) llvm::createArgumentPromotionPass(); + (void) llvm::createBlockProfilerPass(); + (void) llvm::createBreakCriticalEdgesPass(); + (void) llvm::createCFGSimplificationPass(); + (void) llvm::createCombineBranchesPass(); + (void) llvm::createConstantMergePass(); + (void) llvm::createConstantPropagationPass(); + (void) llvm::createCorrelatedExpressionEliminationPass(); + (void) llvm::createDeadArgEliminationPass(); + (void) llvm::createDeadCodeEliminationPass(); + (void) llvm::createDeadInstEliminationPass(); + (void) llvm::createDeadStoreEliminationPass(); + (void) llvm::createDeadTypeEliminationPass(); + (void) llvm::createEdgeProfilerPass(); + (void) llvm::createEmitFunctionTablePass(); + (void) llvm::createFunctionInliningPass(); + (void) llvm::createFunctionProfilerPass(); + (void) llvm::createFunctionResolvingPass(); + (void) llvm::createGCSEPass(); + (void) llvm::createGlobalDCEPass(); + (void) llvm::createGlobalOptimizerPass(); + (void) llvm::createIPConstantPropagationPass(); + (void) llvm::createIPSCCPPass(); + (void) llvm::createIndVarSimplifyPass(); + (void) llvm::createInstructionCombiningPass(); + (void) llvm::createInternalizePass(); + (void) llvm::createLICMPass(); + (void) llvm::createLoopInstrumentationPass(); + (void) llvm::createLoopSimplifyPass(); + (void) llvm::createLoopStrengthReducePass(); + (void) llvm::createLoopUnrollPass(); + (void) llvm::createLoopUnswitchPass(); + (void) llvm::createLowerAllocationsPass(); + (void) llvm::createLowerConstantExpressionsPass(); + (void) llvm::createLowerGCPass(); + (void) llvm::createLowerInvokePass(); + (void) llvm::createLowerPackedPass(); + (void) llvm::createLowerSetJmpPass(); + (void) llvm::createLowerSwitchPass(); + (void) llvm::createProfilePathsPass(); + (void) llvm::createPromoteMemoryToRegister(); + (void) llvm::createPruneEHPass(); + (void) llvm::createRaiseAllocationsPass(); + (void) llvm::createRaisePointerReferencesPass(); + (void) llvm::createReassociatePass(); + (void) llvm::createSCCPPass(); + (void) llvm::createScalarReplAggregatesPass(); + (void) llvm::createSingleLoopExtractorPass(); + (void) llvm::createTailCallEliminationPass(); + (void) llvm::createTailDuplicationPass(); + (void) llvm::createTraceBasicBlockPass(); + (void) llvm::createTraceValuesPassForBasicBlocks(); + (void) llvm::createTraceValuesPassForFunction(); + } + } X; }; #endif // _MSC_VER From lattner at cs.uiuc.edu Fri Jan 7 01:44:37 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jan 2005 01:44:37 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/TargetLowering.h Message-ID: <200501070744.j077ibQN032425@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: TargetLowering.h added (r1.1) --- Log message: First draft of a new Target interface --- Diffs of the changes: (+175 -0) Index: llvm/include/llvm/Target/TargetLowering.h diff -c /dev/null llvm/include/llvm/Target/TargetLowering.h:1.1 *** /dev/null Fri Jan 7 01:44:32 2005 --- llvm/include/llvm/Target/TargetLowering.h Fri Jan 7 01:44:22 2005 *************** *** 0 **** --- 1,175 ---- + //===-- llvm/Target/TargetLowering.h - Target Lowering Info -----*- C++ -*-===// + // + // 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 describes how to lower LLVM code to machine code. This has two + // main components: + // + // 1. Which ValueTypes are natively supported by the target. + // 2. Which operations are supported for supported ValueTypes. + // + // In addition it has a few other components, like information about FP + // immediates. + // + //===----------------------------------------------------------------------===// + + #ifndef LLVM_TARGET_TARGETLOWERING_H + #define LLVM_TARGET_TARGETLOWERING_H + + #include "llvm/Type.h" + #include "llvm/CodeGen/ValueTypes.h" + #include + + namespace llvm { + class Function; + class TargetMachine; + class TargetData; + class TargetRegisterClass; + class SDNode; + class SDOperand; + class SelectionDAG; + + //===----------------------------------------------------------------------===// + /// TargetLowering - This class defines information used to lower LLVM code to + /// legal SelectionDAG operators that the target instruction selector can accept + /// natively. + /// + /// This class also defines callbacks that targets must implement to lower + /// target-specific constructs to SelectionDAG operators. + /// + class TargetLowering { + TargetMachine &TM; + const TargetData &TD; + + MVT::ValueType PointerTy; + bool IsLittleEndian; + + /// RegClassForVT - This indicates the default register class to use for + /// each ValueType the target supports natively. + TargetRegisterClass *RegClassForVT[MVT::LAST_VALUETYPE]; + unsigned char NumElementsForVT[MVT::LAST_VALUETYPE]; + + unsigned short UnsupportedOps[128]; + + std::vector LegalFPImmediates; + + std::vector > AvailableRegClasses; + public: + TargetLowering(TargetMachine &TM); + virtual ~TargetLowering() {} + + TargetMachine &getTargetMachine() const { return TM; } + const TargetData &getTargetData() const { return TD; } + + bool isLittleEndian() const { return IsLittleEndian; } + MVT::ValueType getPointerTy() const { return PointerTy; } + + TargetRegisterClass *getRegClassFor(MVT::ValueType VT) { + TargetRegisterClass *RC = RegClassForVT[VT]; + assert(RC && "This value type is not natively supported!"); + return RC; + } + + /// hasNativeSupportFor + bool hasNativeSupportFor(MVT::ValueType VT) { + return RegClassForVT[VT] != 0; + } + + typedef std::vector::const_iterator legal_fpimm_iterator; + legal_fpimm_iterator legal_fpimm_begin() const { + return LegalFPImmediates.begin(); + } + legal_fpimm_iterator legal_fpimm_end() const { + return LegalFPImmediates.end(); + } + + bool isOperationSupported(unsigned Op, MVT::ValueType VT) { + return (UnsupportedOps[Op] & (1 << VT)) == 0; + } + + MVT::ValueType getValueType(const Type *Ty) { + switch (Ty->getTypeID()) { + default: assert(0 && "Unknown type!"); + case Type::VoidTyID: return MVT::isVoid; + case Type::BoolTyID: return MVT::i1; + case Type::UByteTyID: + case Type::SByteTyID: return MVT::i8; + case Type::ShortTyID: + case Type::UShortTyID: return MVT::i16; + case Type::IntTyID: + case Type::UIntTyID: return MVT::i32; + case Type::LongTyID: + case Type::ULongTyID: return MVT::i64; + case Type::FloatTyID: return MVT::f32; + case Type::DoubleTyID: return MVT::f64; + case Type::PointerTyID: return PointerTy; + } + } + + /// getNumElements - Return the number of registers that this ValueType will + /// eventually require. This is always one for all non-integer types, is + /// one for any types promoted to live in larger registers, but may be more + /// than one for types (like i64) that are split into pieces. + unsigned getNumElements(MVT::ValueType VT) const { + return NumElementsForVT[VT]; + } + + //===--------------------------------------------------------------------===// + // TargetLowering Configuration Methods - These methods should be invoked by + // the derived class constructor to configure this object for the target. + // + + protected: + + /// addRegisterClass - Add the specified register class as an available + /// regclass for the specified value type. This indicates the selector can + /// handle values of that class natively. + void addRegisterClass(MVT::ValueType VT, TargetRegisterClass *RC) { + AvailableRegClasses.push_back(std::make_pair(VT, RC)); + RegClassForVT[VT] = RC; + } + + /// computeRegisterProperties - Once all of the register classes are added, + /// this allows us to compute derived properties we expose. + void computeRegisterProperties(); + + + void setOperationUnsupported(unsigned Op, MVT::ValueType VT) { + assert(VT < 16 && "Too many value types!"); + UnsupportedOps[Op] |= 1 << VT; + } + + /// addLegalFPImmediate - Indicate that this target can instruction select + /// the specified FP immediate natively. + void addLegalFPImmediate(double Imm) { + LegalFPImmediates.push_back(Imm); + } + + + public: + + //===--------------------------------------------------------------------===// + // Lowering methods - These methods must be implemented by targets so that + // the SelectionDAGLowering code knows how to lower these. + // + + /// LowerArguments - This hook must be implemented to indicate how we should + /// lower the arguments for the specified function, into the specified DAG. + virtual std::vector + LowerArguments(Function &F, SelectionDAG &DAG) = 0; + + /// LowerCallTo - This hook lowers an abstract call to a function into an + /// actual call. + typedef std::vector > ArgListTy; + virtual SDNode *LowerCallTo(const Type *RetTy, SDOperand Callee, + ArgListTy &Args, SelectionDAG &DAG) = 0; + }; + } // end llvm namespace + + #endif From lattner at cs.uiuc.edu Fri Jan 7 01:45:05 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jan 2005 01:45:05 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/TargetLowering.cpp Message-ID: <200501070745.j077j5rX032469@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target: TargetLowering.cpp added (r1.1) --- Log message: First draft of new Target interface --- Diffs of the changes: (+48 -0) Index: llvm/lib/Target/TargetLowering.cpp diff -c /dev/null llvm/lib/Target/TargetLowering.cpp:1.1 *** /dev/null Fri Jan 7 01:45:03 2005 --- llvm/lib/Target/TargetLowering.cpp Fri Jan 7 01:44:53 2005 *************** *** 0 **** --- 1,48 ---- + //===-- TargetLowering.cpp - Implement the TargetLowering class -----------===// + // + // 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 implements the TargetLowering class. + // + //===----------------------------------------------------------------------===// + + #include "llvm/Target/TargetLowering.h" + #include "llvm/Target/TargetMachine.h" + #include "llvm/CodeGen/SelectionDAG.h" + using namespace llvm; + + TargetLowering::TargetLowering(TargetMachine &tm) + : TM(tm), TD(TM.getTargetData()) { + assert(ISD::BUILTIN_OP_END <= 128 && + "Fixed size array in TargetLowering is not large enough!"); + + IsLittleEndian = TD.isLittleEndian(); + PointerTy = getValueType(TD.getIntPtrType()); + memset(UnsupportedOps, 0, ISD::BUILTIN_OP_END*sizeof(short)); + memset(RegClassForVT, 0,MVT::LAST_VALUETYPE*sizeof(TargetRegisterClass*)); + } + + /// computeRegisterProperties - Once all of the register classes are added, + /// this allows us to compute derived properties we expose. + void TargetLowering::computeRegisterProperties() { + // Everything defaults to one. + for (unsigned i = 0; i != MVT::LAST_VALUETYPE; ++i) + NumElementsForVT[i] = 1; + + // Find the largest integer register class. + unsigned LargestIntReg = MVT::i128; + for (; RegClassForVT[LargestIntReg] == 0; --LargestIntReg) + assert(LargestIntReg != MVT::i1 && "No integer registers defined!"); + + // Every integer value type larger than this largest register takes twice as + // many registers to represent as the previous ValueType. + unsigned ExpandedReg = LargestIntReg; ++LargestIntReg; + for (++ExpandedReg; MVT::isInteger((MVT::ValueType)ExpandedReg);++ExpandedReg) + NumElementsForVT[ExpandedReg] = 2*NumElementsForVT[ExpandedReg-1]; + } + From lattner at cs.uiuc.edu Fri Jan 7 01:46:10 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jan 2005 01:46:10 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/SelectionDAGNodes.h Message-ID: <200501070746.j077kAen032495@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: SelectionDAGNodes.h added (r1.1) --- Log message: Initial implementation of the nodes in a SelectionDAG. --- Diffs of the changes: (+621 -0) Index: llvm/include/llvm/CodeGen/SelectionDAGNodes.h diff -c /dev/null llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.1 *** /dev/null Fri Jan 7 01:46:07 2005 --- llvm/include/llvm/CodeGen/SelectionDAGNodes.h Fri Jan 7 01:45:27 2005 *************** *** 0 **** --- 1,621 ---- + //===-- llvm/CodeGen/SelectionDAGNodes.h - SelectionDAG Nodes ---*- C++ -*-===// + // + // 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 declares the SDNode class and derived classes, which are used to + // represent the nodes and operations present in a SelectionDAG. These nodes + // and operations are machine code level operations, with some similarities to + // the GCC RTL representation. + // + // Clients should include the SelectionDAG.h file instead of this file directly. + // + //===----------------------------------------------------------------------===// + + #ifndef LLVM_CODEGEN_SELECTIONDAGNODES_H + #define LLVM_CODEGEN_SELECTIONDAGNODES_H + + #include "llvm/CodeGen/ValueTypes.h" + #include + #include + + namespace llvm { + + class SelectionDAG; + class GlobalValue; + class MachineBasicBlock; + class SDNode; + template struct simplify_type; + + /// ISD namespace - This namespace contains an enum which represents all of the + /// SelectionDAG node types and value types. + /// + namespace ISD { + //===--------------------------------------------------------------------===// + /// ISD::NodeType enum - This enum defines all of the operators valid in a + /// SelectionDAG. + /// + enum NodeType { + // Leaf nodes + EntryToken, Constant, ConstantFP, GlobalAddress, FrameIndex, ConstantPool, + BasicBlock, ExternalSymbol, + + // CopyToReg - This node has chain and child nodes, and an associated + // register number. The instruction selector must guarantee that the value + // of the value node is available in the virtual register stored in the + // CopyRegSDNode object. + CopyToReg, + + // CopyFromReg - This node indicates that the input value is a virtual or + // physical register that is defined outside of the scope of this + // SelectionDAG. The virtual register is available from the + // CopyRegSDNode object. + CopyFromReg, + + // EXTRACT_ELEMENT - This is used to get the first or second (determined by + // a Constant, which is required to be operand #1), element of the aggregate + // value specified as operand #0. This is only for use before legalization, + // for values that will be broken into multiple registers. + EXTRACT_ELEMENT, + + // BUILD_PAIR - This is the opposite of EXTRACT_ELEMENT in some ways. Given + // two values of the same integer value type, this produces a value twice as + // big. Like EXTRACT_ELEMENT, this can only be used before legalization. + BUILD_PAIR, + + + // Simple binary arithmetic operators. + ADD, SUB, MUL, SDIV, UDIV, SREM, UREM, + + // Bitwise operators. + AND, OR, XOR, SHL, SRA, SRL, + + // Select operator. + SELECT, + + // SetCC operator - This evaluates to a boolean (i1) true value if the + // condition is true. These nodes are instances of the + // SetCCSDNode class, which contains the condition code as extra + // state. + SETCC, + + // addc - Three input, two output operator: (X, Y, C) -> (X+Y+C, + // Cout). X,Y are integer inputs of agreeing size, C is a one bit + // value, and two values are produced: the sum and a carry out. + ADDC, SUBB, + + // Conversion operators. These are all single input single output + // operations. For all of these, the result type must be strictly + // wider or narrower (depending on the operation) than the source + // type. + + // SIGN_EXTEND - Used for integer types, replicating the sign bit + // into new bits. + SIGN_EXTEND, + + // ZERO_EXTEND - Used for integer types, zeroing the new bits. + ZERO_EXTEND, + + // TRUNCATE - Completely drop the high bits. + TRUNCATE, + + // FP_ROUND - Perform a rounding operation from the current + // precision down to the specified precision. + FP_ROUND, + + // FP_EXTEND - Extend a smaller FP type into a larger FP type. + FP_EXTEND, + + // Other operators. LOAD and STORE have token chains. + LOAD, STORE, + + // DYNAMIC_STACKALLOC - Allocate some number of bytes on the stack aligned + // to a specified boundary. The first operand is the token chain, the + // second is the number of bytes to allocate, and the third is the alignment + // boundary. + DYNAMIC_STACKALLOC, + + // Control flow instructions. These all have token chains. + + // BR - Unconditional branch. The first operand is the chain + // operand, the second is the MBB to branch to. + BR, + + // BRCOND - Conditional branch. The first operand is the chain, + // the second is the condition, the third is the block to branch + // to if the condition is true. + BRCOND, + + // RET - Return from function. The first operand is the chain, + // and any subsequent operands are the return values for the + // function. This operation can have variable number of operands. + RET, + + // CALL - Call to a function pointer. The first operand is the chain, the + // second is the destination function pointer (a GlobalAddress for a direct + // call). Arguments have already been lowered to explicit DAGs according to + // the calling convention in effect here. + CALL, + + // ADJCALLSTACKDOWN/ADJCALLSTACKUP - These operators mark the beginning and + // end of a call sequence and indicate how much the stack pointer needs to + // be adjusted for that particular call. The first operand is a chain, the + // second is a ConstantSDNode of intptr type. + ADJCALLSTACKDOWN, // Beginning of a call sequence + ADJCALLSTACKUP, // End of a call sequence + + + // BUILTIN_OP_END - This must be the last enum value in this list. + BUILTIN_OP_END, + }; + + //===--------------------------------------------------------------------===// + /// ISD::CondCode enum - These are ordered carefully to make the bitfields + /// below work out, when considering SETFALSE (something that never exists + /// dynamically) as 0. "U" -> Unsigned (for integer operands) or Unordered + /// (for floating point), "L" -> Less than, "G" -> Greater than, "E" -> Equal + /// to. If the "N" column is 1, the result of the comparison is undefined if + /// the input is a NAN. + /// + /// All of these (except for the 'always folded ops') should be handled for + /// floating point. For integer, only the SETEQ,SETNE,SETLT,SETLE,SETGT, + /// SETGE,SETULT,SETULE,SETUGT, and SETUGE opcodes are used. + /// + /// Note that these are laid out in a specific order to allow bit-twiddling + /// to transform conditions. + enum CondCode { + // Opcode N U L G E Intuitive operation + SETFALSE, // 0 0 0 0 Always false (always folded) + SETOEQ, // 0 0 0 1 True if ordered and equal + SETOGT, // 0 0 1 0 True if ordered and greater than + SETOGE, // 0 0 1 1 True if ordered and greater than or equal + SETOLT, // 0 1 0 0 True if ordered and less than + SETOLE, // 0 1 0 1 True if ordered and less than or equal + SETONE, // 0 1 1 0 True if ordered and operands are unequal + SETO, // 0 1 1 1 True if ordered (no nans) + SETUO, // 1 0 0 0 True if unordered: isnan(X) | isnan(Y) + SETUEQ, // 1 0 0 1 True if unordered or equal + SETUGT, // 1 0 1 0 True if unordered or greater than + SETUGE, // 1 0 1 1 True if unordered, greater than, or equal + SETULT, // 1 1 0 0 True if unordered or less than + SETULE, // 1 1 0 1 True if unordered, less than, or equal + SETUNE, // 1 1 1 0 True if unordered or not equal + SETTRUE, // 1 1 1 1 Always true (always folded) + // Don't care operations: undefined if the input is a nan. + SETFALSE2, // 1 X 0 0 0 Always false (always folded) + SETEQ, // 1 X 0 0 1 True if equal + SETGT, // 1 X 0 1 0 True if greater than + SETGE, // 1 X 0 1 1 True if greater than or equal + SETLT, // 1 X 1 0 0 True if less than + SETLE, // 1 X 1 0 1 True if less than or equal + SETNE, // 1 X 1 1 0 True if not equal + SETTRUE2, // 1 X 1 1 1 Always true (always folded) + + SETCC_INVALID, // Marker value. + }; + + /// isSignedIntSetCC - Return true if this is a setcc instruction that + /// performs a signed comparison when used with integer operands. + inline bool isSignedIntSetCC(CondCode Code) { + return Code == SETGT || Code == SETGE || Code == SETLT || Code == SETLE; + } + + /// isUnsignedIntSetCC - Return true if this is a setcc instruction that + /// performs an unsigned comparison when used with integer operands. + inline bool isUnsignedIntSetCC(CondCode Code) { + return Code == SETUGT || Code == SETUGE || Code == SETULT || Code == SETULE; + } + + /// isTrueWhenEqual - Return true if the specified condition returns true if + /// the two operands to the condition are equal. Note that if one of the two + /// operands is a NaN, this value is meaningless. + inline bool isTrueWhenEqual(CondCode Cond) { + return ((int)Cond & 1) != 0; + } + + /// getUnorderedFlavor - This function returns 0 if the condition is always + /// false if an operand is a NaN, 1 if the condition is always true if the + /// operand is a NaN, and 2 if the condition is undefined if the operand is a + /// NaN. + inline unsigned getUnorderedFlavor(CondCode Cond) { + return ((int)Cond >> 3) & 3; + } + + /// getSetCCInverse - Return the operation corresponding to !(X op Y), where + /// 'op' is a valid SetCC operation. + CondCode getSetCCInverse(CondCode Operation, bool isInteger); + + /// getSetCCSwappedOperands - Return the operation corresponding to (Y op X) + /// when given the operation for (X op Y). + CondCode getSetCCSwappedOperands(CondCode Operation); + + /// getSetCCOrOperation - Return the result of a logical OR between different + /// comparisons of identical values: ((X op1 Y) | (X op2 Y)). This + /// function returns SETCC_INVALID if it is not possible to represent the + /// resultant comparison. + CondCode getSetCCOrOperation(CondCode Op1, CondCode Op2, bool isInteger); + + /// getSetCCAndOperation - Return the result of a logical AND between + /// different comparisons of identical values: ((X op1 Y) & (X op2 Y)). This + /// function returns SETCC_INVALID if it is not possible to represent the + /// resultant comparison. + CondCode getSetCCAndOperation(CondCode Op1, CondCode Op2, bool isInteger); + } // end llvm::ISD namespace + + + //===----------------------------------------------------------------------===// + /// SDOperand - Unlike LLVM values, Selection DAG nodes may return multiple + /// values as the result of a computation. Many nodes return multiple values, + /// from loads (which define a token and a return value) to ADDC (which returns + /// a result and a carry value), to calls (which may return an arbitrary number + /// of values). + /// + /// As such, each use of a SelectionDAG computation must indicate the node that + /// computes it as well as which return value to use from that node. This pair + /// of information is represented with the SDOperand value type. + /// + struct SDOperand { + SDNode *Val; // The node defining the value we are using. + unsigned ResNo; // Which return value of the node we are using. + + SDOperand() : Val(0) {} + SDOperand(SDNode *val, unsigned resno) : Val(val), ResNo(resno) {} + + bool operator==(const SDOperand &O) const { + return Val == O.Val && ResNo == O.ResNo; + } + bool operator!=(const SDOperand &O) const { + return !operator==(O); + } + bool operator<(const SDOperand &O) const { + return Val < O.Val || (Val == O.Val && ResNo < O.ResNo); + } + + SDOperand getValue(unsigned R) const { + return SDOperand(Val, R); + } + + /// getValueType - Return the ValueType of the referenced return value. + /// + inline MVT::ValueType getValueType() const; + + // Forwarding methods - These forward to the corresponding methods in SDNode. + inline unsigned getOpcode() const; + inline unsigned getNumOperands() const; + inline const SDOperand &getOperand(unsigned i) const; + }; + + + /// simplify_type specializations - Allow casting operators to work directly on + /// SDOperands as if they were SDNode*'s. + template<> struct simplify_type { + typedef SDNode* SimpleType; + static SimpleType getSimplifiedValue(const SDOperand &Val) { + return static_cast(Val.Val); + } + }; + template<> struct simplify_type { + typedef SDNode* SimpleType; + static SimpleType getSimplifiedValue(const SDOperand &Val) { + return static_cast(Val.Val); + } + }; + + + /// SDNode - Represents one node in the SelectionDAG. + /// + class SDNode { + unsigned NodeType; + std::vector Operands; + + /// Values - The types of the values this node defines. SDNode's may define + /// multiple values simultaneously. + std::vector Values; + + /// Uses - These are all of the SDNode's that use a value produced by this + /// node. + std::vector Uses; + public: + + //===--------------------------------------------------------------------===// + // Accessors + // + unsigned getOpcode() const { return NodeType; } + + size_t use_size() const { return Uses.size(); } + bool use_empty() const { return Uses.empty(); } + bool hasOneUse() const { return Uses.size() == 1; } + + /// getNumOperands - Return the number of values used by this operation. + /// + unsigned getNumOperands() const { return Operands.size(); } + + const SDOperand &getOperand(unsigned Num) { + assert(Num < Operands.size() && "Invalid child # of SDNode!"); + return Operands[Num]; + } + + const SDOperand &getOperand(unsigned Num) const { + assert(Num < Operands.size() && "Invalid child # of SDNode!"); + return Operands[Num]; + } + + /// getNumValues - Return the number of values defined/returned by this + /// operator. + /// + unsigned getNumValues() const { return Values.size(); } + + /// getValueType - Return the type of a specified result. + /// + MVT::ValueType getValueType(unsigned ResNo) const { + assert(ResNo < Values.size() && "Illegal result number!"); + return Values[ResNo]; + } + + void dump() const; + + static bool classof(const SDNode *) { return true; } + + protected: + friend class SelectionDAG; + + SDNode(unsigned NT, MVT::ValueType VT) : NodeType(NT) { + Values.reserve(1); + Values.push_back(VT); + } + + SDNode(unsigned NT, SDOperand Op) + : NodeType(NT) { + Operands.reserve(1); Operands.push_back(Op); + Op.Val->Uses.push_back(this); + } + SDNode(unsigned NT, SDOperand N1, SDOperand N2) + : NodeType(NT) { + Operands.reserve(2); Operands.push_back(N1); Operands.push_back(N2); + N1.Val->Uses.push_back(this); N2.Val->Uses.push_back(this); + } + SDNode(unsigned NT, SDOperand N1, SDOperand N2, SDOperand N3) + : NodeType(NT) { + Operands.reserve(3); Operands.push_back(N1); Operands.push_back(N2); + Operands.push_back(N3); + N1.Val->Uses.push_back(this); N2.Val->Uses.push_back(this); + N3.Val->Uses.push_back(this); + } + SDNode(unsigned NT, std::vector &Nodes) : NodeType(NT) { + Operands.swap(Nodes); + for (unsigned i = 0, e = Nodes.size(); i != e; ++i) + Nodes[i].Val->Uses.push_back(this); + } + + virtual ~SDNode() { + // FIXME: Drop uses. + } + + void setValueTypes(MVT::ValueType VT) { + Values.reserve(1); + Values.push_back(VT); + } + void setValueTypes(MVT::ValueType VT1, MVT::ValueType VT2) { + Values.reserve(2); + Values.push_back(VT1); + Values.push_back(VT2); + } + /// Note: this method destroys the vector passed in. + void setValueTypes(std::vector &VTs) { + std::swap(Values, VTs); + } + }; + + + // Define inline functions from the SDOperand class. + + inline unsigned SDOperand::getOpcode() const { + return Val->getOpcode(); + } + inline MVT::ValueType SDOperand::getValueType() const { + return Val->getValueType(ResNo); + } + inline unsigned SDOperand::getNumOperands() const { + return Val->getNumOperands(); + } + inline const SDOperand &SDOperand::getOperand(unsigned i) const { + return Val->getOperand(i); + } + + + + class ConstantSDNode : public SDNode { + uint64_t Value; + protected: + friend class SelectionDAG; + ConstantSDNode(uint64_t val, MVT::ValueType VT) + : SDNode(ISD::Constant, VT), Value(val) { + } + public: + + uint64_t getValue() const { return Value; } + + int64_t getSignExtended() const { + unsigned Bits = MVT::getSizeInBits(getValueType(0)); + return ((int64_t)Value << 64-Bits) >> 64-Bits; + } + + bool isNullValue() const { return Value == 0; } + bool isAllOnesValue() const { + return Value == (1ULL << MVT::getSizeInBits(getValueType(0)))-1; + } + + static bool classof(const ConstantSDNode *) { return true; } + static bool classof(const SDNode *N) { + return N->getOpcode() == ISD::Constant; + } + }; + + class ConstantFPSDNode : public SDNode { + double Value; + protected: + friend class SelectionDAG; + ConstantFPSDNode(double val, MVT::ValueType VT) + : SDNode(ISD::ConstantFP, VT), Value(val) { + } + public: + + double getValue() const { return Value; } + + /// isExactlyValue - We don't rely on operator== working on double values, as + /// it returns true for things that are clearly not equal, like -0.0 and 0.0. + /// As such, this method can be used to do an exact bit-for-bit comparison of + /// two floating point values. + bool isExactlyValue(double V) const { + union { + double V; + uint64_t I; + } T1; + T1.V = Value; + union { + double V; + uint64_t I; + } T2; + T2.V = V; + return T1.I == T2.I; + } + + static bool classof(const ConstantFPSDNode *) { return true; } + static bool classof(const SDNode *N) { + return N->getOpcode() == ISD::ConstantFP; + } + }; + + class GlobalAddressSDNode : public SDNode { + GlobalValue *TheGlobal; + protected: + friend class SelectionDAG; + GlobalAddressSDNode(const GlobalValue *GA, MVT::ValueType VT) + : SDNode(ISD::GlobalAddress, VT) { + TheGlobal = const_cast(GA); + + } + public: + + GlobalValue *getGlobal() const { return TheGlobal; } + + static bool classof(const GlobalAddressSDNode *) { return true; } + static bool classof(const SDNode *N) { + return N->getOpcode() == ISD::GlobalAddress; + } + }; + + + class FrameIndexSDNode : public SDNode { + int FI; + protected: + friend class SelectionDAG; + FrameIndexSDNode(int fi, MVT::ValueType VT) + : SDNode(ISD::FrameIndex, VT), FI(fi) {} + public: + + int getIndex() const { return FI; } + + static bool classof(const FrameIndexSDNode *) { return true; } + static bool classof(const SDNode *N) { + return N->getOpcode() == ISD::FrameIndex; + } + }; + + class ConstantPoolSDNode : public SDNode { + unsigned CPI; + protected: + friend class SelectionDAG; + ConstantPoolSDNode(unsigned cpi, MVT::ValueType VT) + : SDNode(ISD::ConstantPool, VT), CPI(cpi) {} + public: + + unsigned getIndex() const { return CPI; } + + static bool classof(const ConstantPoolSDNode *) { return true; } + static bool classof(const SDNode *N) { + return N->getOpcode() == ISD::ConstantPool; + } + }; + + class BasicBlockSDNode : public SDNode { + MachineBasicBlock *MBB; + protected: + friend class SelectionDAG; + BasicBlockSDNode(MachineBasicBlock *mbb) + : SDNode(ISD::BasicBlock, MVT::Other), MBB(mbb) {} + public: + + MachineBasicBlock *getBasicBlock() const { return MBB; } + + static bool classof(const BasicBlockSDNode *) { return true; } + static bool classof(const SDNode *N) { + return N->getOpcode() == ISD::BasicBlock; + } + }; + + + class CopyRegSDNode : public SDNode { + unsigned Reg; + protected: + friend class SelectionDAG; + CopyRegSDNode(SDOperand Chain, SDOperand Src, unsigned reg) + : SDNode(ISD::CopyToReg, Chain, Src), Reg(reg) { + setValueTypes(MVT::Other); // Just a token chain. + } + CopyRegSDNode(unsigned reg, MVT::ValueType VT) + : SDNode(ISD::CopyFromReg, VT), Reg(reg) { + } + public: + + unsigned getReg() const { return Reg; } + + static bool classof(const CopyRegSDNode *) { return true; } + static bool classof(const SDNode *N) { + return N->getOpcode() == ISD::CopyToReg || + N->getOpcode() == ISD::CopyFromReg; + } + }; + + class ExternalSymbolSDNode : public SDNode { + const char *Symbol; + protected: + friend class SelectionDAG; + ExternalSymbolSDNode(const char *Sym, MVT::ValueType VT) + : SDNode(ISD::ExternalSymbol, VT), Symbol(Sym) { + } + public: + + const char *getSymbol() const { return Symbol; } + + static bool classof(const ExternalSymbolSDNode *) { return true; } + static bool classof(const SDNode *N) { + return N->getOpcode() == ISD::ExternalSymbol; + } + }; + + class SetCCSDNode : public SDNode { + ISD::CondCode Condition; + protected: + friend class SelectionDAG; + SetCCSDNode(ISD::CondCode Cond, SDOperand LHS, SDOperand RHS) + : SDNode(ISD::SETCC, LHS, RHS), Condition(Cond) { + setValueTypes(MVT::i1); + } + public: + + ISD::CondCode getCondition() const { return Condition; } + + static bool classof(const SetCCSDNode *) { return true; } + static bool classof(const SDNode *N) { + return N->getOpcode() == ISD::SETCC; + } + }; + + } // end llvm namespace + + #endif From lattner at cs.uiuc.edu Fri Jan 7 01:46:21 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jan 2005 01:46:21 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/SelectionDAG.h Message-ID: <200501070746.j077kL4O032511@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: SelectionDAG.h updated: 1.6 -> 1.7 --- Log message: Complete rewrite of the SelectionDAG class. --- Diffs of the changes: (+103 -316) Index: llvm/include/llvm/CodeGen/SelectionDAG.h diff -u llvm/include/llvm/CodeGen/SelectionDAG.h:1.6 llvm/include/llvm/CodeGen/SelectionDAG.h:1.7 --- llvm/include/llvm/CodeGen/SelectionDAG.h:1.6 Wed Sep 1 17:55:34 2004 +++ llvm/include/llvm/CodeGen/SelectionDAG.h Fri Jan 7 01:45:38 2005 @@ -1,4 +1,4 @@ -//===-- llvm/CodeGen/SelectionDAG.h - InstSelection DAG Rep. ----*- C++ -*-===// +//===-- llvm/CodeGen/SelectionDAG.h - InstSelection DAG ---------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -7,364 +7,151 @@ // //===----------------------------------------------------------------------===// // -// This file declares the SelectionDAG class, which is used to represent an LLVM -// function in a low-level representation suitable for instruction selection. -// This DAG is constructed as the first step of instruction selection in order -// to allow implementation of machine specific optimizations and code -// simplifications. -// -// The representation used by the SelectionDAG is a target-independent -// representation, which is loosly modeled after the GCC RTL representation, but -// is significantly simpler. +// This file declares the SelectionDAG class, and transitively defines the +// SDNode class and subclasses. // //===----------------------------------------------------------------------===// #ifndef LLVM_CODEGEN_SELECTIONDAG_H #define LLVM_CODEGEN_SELECTIONDAG_H -#include "llvm/CodeGen/ValueTypes.h" -#include "llvm/Support/DataTypes.h" +#include "llvm/CodeGen/SelectionDAGNodes.h" #include -#include -#include +#include // FIXME remove eventually, turning map into const char* map. namespace llvm { - -class Value; -class Type; -class Instruction; -class CallInst; -class BasicBlock; -class MachineBasicBlock; -class MachineFunction; -class TargetMachine; -class SelectionDAGNode; -class SelectionDAGBlock; -class SelectionDAGBuilder; -class SelectionDAGTargetBuilder; - -/// ISD namespace - This namespace contains an enum which represents all of the -/// SelectionDAG node types and value types. + class TargetLowering; + class TargetMachine; + class MachineFunction; + +/// SelectionDAG class - This is used to represent a portion of an LLVM function +/// in a low-level Data Dependence DAG representation suitable for instruction +/// selection. This DAG is constructed as the first step of instruction +/// selection in order to allow implementation of machine specific optimizations +/// and code simplifications. +/// +/// The representation used by the SelectionDAG is a target-independent +/// representation, which has some similarities to the GCC RTL representation, +/// but is significantly more simple, powerful, and is a graph form instead of a +/// linear form. /// -namespace ISD { - enum NodeType { - // ChainNode nodes are used to sequence operations within a basic block - // which cannot be reordered (such as loads, stores, calls, etc). - // BlockChainNodes are used to connect the DAG's for different basic blocks - // into one big DAG. - ChainNode, BlockChainNode, - - // ProtoNodes are nodes that are only half way constructed. - ProtoNode, - - // Leaf nodes - Constant, FrameIndex, BasicBlock, - - // Simple binary arithmetic operators - Plus, Minus, Times, SDiv, UDiv, SRem, URem, - - // Bitwise operators - And, Or, Xor, - - // Comparisons - SetEQ, SetNE, SetLT, SetLE, SetGT, SetGE, - - // Control flow instructions - Br, BrCond, Switch, Ret, RetVoid, - - // Other operators - Load, Store, PHI, Call, - - // Unknown operators, of a specified arity - Unspec1, Unspec2 - }; -} - class SelectionDAG { - friend class SelectionDAGBuilder; - MachineFunction &F; const TargetMachine &TM; - MVT::ValueType PointerType; // The ValueType the target uses for pointers - - // ValueMap - The SelectionDAGNode for each LLVM value in the function. - std::map ValueMap; + MachineFunction &MF; - // BlockMap - The MachineBasicBlock created for each LLVM BasicBlock - std::map BlockMap; - - // Root - The root of the entire DAG - SelectionDAGNode *Root; + // Root - The root of the entire DAG. EntryNode - The starting token. + SDOperand Root, EntryNode; // AllNodes - All of the nodes in the DAG - std::vector AllNodes; + std::vector AllNodes; + + // Maps to auto-CSE operations. + std::map >, + SDNode *> UnaryOps; + std::map >, + SDNode *> BinaryOps; + + std::map, ISD::CondCode>, + SetCCSDNode*> SetCCs; + + std::map >, + SDNode *> Loads; + + std::map GlobalValues; + std::map, SDNode*> Constants; + std::map, SDNode*> ConstantFPs; + std::map FrameIndices; + std::map ConstantPoolIndices; + std::map BBNodes; + std::map ExternalSymbols; public: - /// SelectionDAG constructor - Build a SelectionDAG for the specified - /// function. Implemented in DAGBuilder.cpp - /// - SelectionDAG(MachineFunction &F, const TargetMachine &TM, - SelectionDAGTargetBuilder &SDTB); + SelectionDAG(const TargetMachine &tm, MachineFunction &mf) : TM(tm), MF(mf) { + EntryNode = Root = getNode(ISD::EntryToken, MVT::Other); + } ~SelectionDAG(); - /// getValueType - Return the ValueType for the specified LLVM type. This - /// method works on all scalar LLVM types. - /// - MVT::ValueType getValueType(const Type *Ty) const; - - /// getRoot - Return the root of the current SelectionDAG. - /// - SelectionDAGNode *getRoot() const { return Root; } + MachineFunction &getMachineFunction() const { return MF; } + const TargetMachine &getTarget() { return TM; } - /// getMachineFunction - Return the MachineFunction object that this - /// SelectionDAG corresponds to. + /// getRoot - Return the root tag of the SelectionDAG. /// - MachineFunction &getMachineFunction() const { return F; } + const SDOperand &getRoot() const { return Root; } - //===--------------------------------------------------------------------===// - // Addition and updating methods - // + /// getEntryNode - Return the token chain corresponding to the entry of the + /// function. + const SDOperand &getEntryNode() const { return EntryNode; } - /// addNode - Add the specified node to the SelectionDAG so that it will be - /// deleted when the DAG is... + /// setRoot - Set the current root tag of the SelectionDAG. /// - SelectionDAGNode *addNode(SelectionDAGNode *N) { - AllNodes.push_back(N); - return N; - } - - /// addNodeForValue - Add the specified node to the SelectionDAG so that it - /// will be deleted when the DAG is... and update the value map to indicate - /// that the specified DAG node computes the value. Note that it is an error - /// to specify multiple DAG nodes that compute the same value. - /// - SelectionDAGNode *addNodeForValue(SelectionDAGNode *N, const Value *V) { - assert(ValueMap.count(V) == 0 && "Value already has a DAG node!"); - return addNode(ValueMap[V] = N); - } - - void dump() const; -private: - void addInstructionToDAG(const Instruction &I, const BasicBlock &BB); -}; + const SDOperand &setRoot(SDOperand N) { return Root = N; } - -/// SelectionDAGReducedValue - During the reducer pass we need the ability to -/// add an arbitrary (but usually 1 or 0) number of arbitrarily sized values to -/// the selection DAG. Because of this, we represent these values as a singly -/// linked list of values attached to the DAGNode. We end up putting the -/// arbitrary state for the value in subclasses of this node. -/// -/// Note that this class does not have a virtual dtor, this is because we know -/// that the subclasses will not hold state that needs to be destroyed. -/// -class SelectionDAGReducedValue { - unsigned Code; - SelectionDAGReducedValue *Next; -public: - SelectionDAGReducedValue(unsigned C) : Code(C), Next(0) {} - - /// getValueCode - Return the code for this reducer value... - /// - unsigned getValueCode() const { return Code; } - - /// getNext - Return the next value in the list + /// Legalize - This transforms the SelectionDAG into a SelectionDAG that is + /// compatible with the target instruction selector, as indicated by the + /// TargetLowering object. /// - const SelectionDAGReducedValue *getNext() const { return Next; } - void setNext(SelectionDAGReducedValue *N) { Next = N; } + /// Note that this is an involved process that may invalidate pointers into + /// the graph. + void Legalize(TargetLowering &TLI); - SelectionDAGReducedValue *getNext() { return Next; } -}; + SDOperand getConstant(uint64_t Val, MVT::ValueType VT); + SDOperand getConstantFP(double Val, MVT::ValueType VT); + SDOperand getGlobalAddress(const GlobalValue *GV, MVT::ValueType VT); + SDOperand getFrameIndex(int FI, MVT::ValueType VT); + SDOperand getConstantPool(unsigned CPIdx, MVT::ValueType VT); + SDOperand getBasicBlock(MachineBasicBlock *MBB); + SDOperand getExternalSymbol(const char *Sym, MVT::ValueType VT); - - -/// SelectionDAGNode - Represents one node in the selection DAG. -/// -class SelectionDAGNode { - std::vector Uses; - ISD::NodeType NodeType; - MVT::ValueType ValueType; - MachineBasicBlock *BB; - SelectionDAGReducedValue *ValList; - - /// Costs - Each pair of elements of 'Costs' contains the cost of producing - /// the value with the target specific slot number and the production number - /// to use to produce it. A zero value for the production number indicates - /// that the cost has not yet been computed. - unsigned *Costs; -public: - SelectionDAGNode(ISD::NodeType NT, MVT::ValueType VT, - MachineBasicBlock *bb = 0) - : NodeType(NT), ValueType(VT), BB(bb), ValList(0), Costs(0) {} - - SelectionDAGNode(ISD::NodeType NT, MVT::ValueType VT, MachineBasicBlock *bb, - SelectionDAGNode *N) - : NodeType(NT), ValueType(VT), BB(bb), ValList(0), Costs(0) { - assert(NT != ISD::ProtoNode && "Cannot specify uses for a protonode!"); - Uses.reserve(1); Uses.push_back(N); - } - SelectionDAGNode(ISD::NodeType NT, MVT::ValueType VT, MachineBasicBlock *bb, - SelectionDAGNode *N1, SelectionDAGNode *N2) - : NodeType(NT), ValueType(VT), BB(bb), ValList(0), Costs(0) { - assert(NT != ISD::ProtoNode && "Cannot specify uses for a protonode!"); - Uses.reserve(2); Uses.push_back(N1); Uses.push_back(N2); - } - SelectionDAGNode(ISD::NodeType NT, MVT::ValueType VT, MachineBasicBlock *bb, - SelectionDAGNode *N1, SelectionDAGNode *N2, - SelectionDAGNode *N3) - : NodeType(NT), ValueType(VT), BB(bb), ValList(0), Costs(0) { - assert(NT != ISD::ProtoNode && "Cannot specify uses for a protonode!"); - Uses.reserve(3); Uses.push_back(N1); Uses.push_back(N2); Uses.push_back(N3); - } - - ~SelectionDAGNode() { delete [] Costs; delete ValList; } - - void setNode(ISD::NodeType NT, MachineBasicBlock *bb) { - assert(NodeType == ISD::ProtoNode && NT != ISD::ProtoNode); - NodeType = NT; BB = bb; - } - void setNode(ISD::NodeType NT, MachineBasicBlock *bb, SelectionDAGNode *N) { - assert(NodeType == ISD::ProtoNode && NT != ISD::ProtoNode); - NodeType = NT; BB = bb; Uses.reserve(1); Uses.push_back(N); - } - void setNode(ISD::NodeType NT, MachineBasicBlock *bb, - SelectionDAGNode *N1, SelectionDAGNode *N2) { - assert(NodeType == ISD::ProtoNode && NT != ISD::ProtoNode); - NodeType = NT; BB = bb; - Uses.reserve(1); Uses.push_back(N1); Uses.push_back(N2); + SDOperand getCopyToReg(SDOperand Chain, SDOperand N, unsigned VReg) { + // Note: these are auto-CSE'd because the caller doesn't make requests that + // could cause duplicates to occur. + SDNode *NN = new CopyRegSDNode(Chain, N, VReg); + AllNodes.push_back(NN); + return SDOperand(NN, 0); } - //===--------------------------------------------------------------------===// - // Accessors - // - ISD::NodeType getNodeType() const { return NodeType; } - MVT::ValueType getValueType() const { return ValueType; } - MachineBasicBlock *getBB() const { return BB; } - - SelectionDAGNode *getUse(unsigned Num) { - assert(Num < Uses.size() && "Invalid child # of SelectionDAGNode!"); - return Uses[Num]; + SDOperand getCopyFromReg(unsigned VReg, MVT::ValueType VT) { + // Note: These nodes are auto-CSE'd by the caller of this method. + SDNode *NN = new CopyRegSDNode(VReg, VT); + AllNodes.push_back(NN); + return SDOperand(NN, 0); } - template - Type *getValue(unsigned Code) const { - SelectionDAGReducedValue *Vals = ValList; - while (1) { - assert(Vals && "Code does not exist in this list!"); - if (Vals->getValueCode() == Code) - return (Type*)Vals; - Vals = Vals->getNext(); - } - } - - template - Type *hasValue(unsigned Code) const { - SelectionDAGReducedValue *Vals = ValList; - while (Vals) { - if (Vals->getValueCode() == Code) - return (Type*)Vals; - Vals = Vals->getNext(); - } - return false; - } - - void addValue(SelectionDAGReducedValue *New) { - assert(New->getNext() == 0); - New->setNext(ValList); - ValList = New; + /// getCall - Note that this destroys the vector of RetVals passed in. + /// + SDNode *getCall(std::vector &RetVals, SDOperand Chain, + SDOperand Callee) { + SDNode *NN = new SDNode(ISD::CALL, Chain, Callee); + NN->setValueTypes(RetVals); + AllNodes.push_back(NN); + return NN; } - //===--------------------------------------------------------------------===// - // Utility methods used by the pattern matching instruction selector - // + SDOperand getSetCC(ISD::CondCode, SDOperand LHS, SDOperand RHS); - /// getPatternFor - Return the pattern selected to compute the specified slot, - /// or zero if there is no pattern yet. + /// getNode - Gets or creates the specified node. /// - unsigned getPatternFor(unsigned Slot) const { - return Costs ? Costs[Slot*2] : 0; - } + SDOperand getNode(unsigned Opcode, MVT::ValueType VT); + SDOperand getNode(unsigned Opcode, MVT::ValueType VT, SDOperand N); + SDOperand getNode(unsigned Opcode, MVT::ValueType VT, + SDOperand N1, SDOperand N2); + SDOperand getNode(unsigned Opcode, MVT::ValueType VT, + SDOperand N1, SDOperand N2, SDOperand N3); + SDOperand getNode(unsigned Opcode, MVT::ValueType VT, + std::vector &Children); - /// getCostFor - Return the cost to compute the value corresponding to Slot. + /// getLoad - Loads are not normal binary operators: their result type is not + /// determined by their operands, and they produce a value AND a token chain. /// - unsigned getCostFor(unsigned Slot) const { - return Costs ? Costs[Slot*2+1] : 0; - } + SDOperand getLoad(MVT::ValueType VT, SDOperand Chain, SDOperand Ptr); - /// setPatternCostFor - Sets the pattern and the cost for the specified slot - /// to the specified values. This allocates the Costs vector if necessary, so - /// you must specify the maximum number of slots that may be used. - /// - void setPatternCostFor(unsigned Slot, unsigned Pattern, unsigned Cost, - unsigned NumSlots) { - if (Costs == 0) { - Costs = new unsigned[NumSlots*2]; - for (unsigned i = 0; i != NumSlots*2; ++i) Costs[i] = 0; - } - Costs[Slot*2] = Pattern; - Costs[Slot*2+1] = Cost; + void replaceAllUsesWith(SDOperand Old, SDOperand New) { + assert(Old != New && "RAUW self!"); + assert(0 && "Unimplemented!"); } void dump() const; -private: - void printit(unsigned Offset, unsigned &LastID, - std::map &NodeIDs) const; }; - -/// SelectionDAGTargetBuilder - This class must be implemented by the target, to -/// indicate how to perform the extremely target-specific tasks of building DAG -/// nodes to represent the calling convention used by the target. -/// -struct SelectionDAGTargetBuilder { - /// expandArguments - This method is called once by the SelectionDAG - /// construction mechanisms to add DAG nodes for each formal argument to the - /// current function. If any of the incoming arguments lives on the stack, - /// this method should also create the stack slots for the arguments as - /// necessary. - virtual void expandArguments(SelectionDAG &SD) = 0; - - /// expandCall - This method is called once per function call by the - /// SelectionDAG construction algorithm. It must add DAG nodes to the - /// SelectionDAG specified to perform that call. - virtual void expandCall(SelectionDAG &SD, CallInst &CI) = 0; -}; - -namespace ISD { - enum { // Builtin Slot numbers - Constant_i1_Slot, - Constant_i8_Slot, - Constant_i16_Slot, - Constant_i32_Slot, - Constant_i64_Slot, - Constant_f32_Slot, - Constant_f64_Slot, - - FrameIndex_i32_Slot, - FrameIndex_i64_Slot, - BasicBlock_i32_Slot, - BasicBlock_i64_Slot, - NumBuiltinSlots - }; } -template -struct ReducedValue : public SelectionDAGReducedValue { - ReducedValue(const ValType &V) : SelectionDAGReducedValue(NodeCode), Val(V) {} - ValType Val; -}; - -typedef ReducedValue ReducedValue_FrameIndex_i32; -typedef ReducedValue ReducedValue_FrameIndex_i64; -typedef ReducedValue ReducedValue_BasicBlock_i32; -typedef ReducedValue ReducedValue_BasicBlock_i64; - -typedef ReducedValue ReducedValue_Constant_i1; -typedef ReducedValue ReducedValue_Constant_i8; -typedef ReducedValue ReducedValue_Constant_i16; -typedef ReducedValue ReducedValue_Constant_i32; -typedef ReducedValue ReducedValue_Constant_i64; -typedef ReducedValue ReducedValue_Constant_f32; -typedef ReducedValue ReducedValue_Constant_f64; - -} // End llvm namespace - #endif From lattner at cs.uiuc.edu Fri Jan 7 01:46:15 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jan 2005 01:46:15 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/SelectionDAGISel.h Message-ID: <200501070746.j077kFdu032504@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: SelectionDAGISel.h added (r1.1) --- Log message: Common base class for SelectionDAG-based instruction selectors. --- Diffs of the changes: (+64 -0) Index: llvm/include/llvm/CodeGen/SelectionDAGISel.h diff -c /dev/null llvm/include/llvm/CodeGen/SelectionDAGISel.h:1.1 *** /dev/null Fri Jan 7 01:46:13 2005 --- llvm/include/llvm/CodeGen/SelectionDAGISel.h Fri Jan 7 01:46:03 2005 *************** *** 0 **** --- 1,64 ---- + //===-- llvm/CodeGen/SelectionDAGISel.h - Common Base Class------*- C++ -*-===// + // + // 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 the SelectionDAGISel class, which is used as the common + // base class for SelectionDAG-based instruction selectors. + // + //===----------------------------------------------------------------------===// + + #ifndef LLVM_CODEGEN_SELECTIONDAG_ISEL_H + #define LLVM_CODEGEN_SELECTIONDAG_ISEL_H + + #include "llvm/Pass.h" + #include "llvm/CodeGen/ValueTypes.h" + + namespace llvm { + class SelectionDAG; + class SelectionDAGLowering; + class SSARegMap; + class MachineBasicBlock; + class MachineFunction; + class MachineInstr; + class TargetLowering; + class FunctionLoweringInfo; + + /// SelectionDAGISel - This is the common base class used for SelectionDAG-based + /// pattern-matching instruction selectors. + class SelectionDAGISel : public FunctionPass { + public: + TargetLowering &TLI; + SSARegMap *RegMap; + SelectionDAG *CurDAG; + MachineBasicBlock *BB; + + SelectionDAGISel(TargetLowering &tli) : TLI(tli) {} + + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.setPreservesAll(); + } + + virtual bool runOnFunction(Function &Fn); + + unsigned MakeReg(MVT::ValueType VT); + + virtual void InstructionSelectBasicBlock(SelectionDAG &SD) = 0; + + void CopyValueToVirtualRegister(SelectionDAGLowering &SDL, + Value *V, unsigned Reg); + void SelectBasicBlock(BasicBlock *BB, MachineFunction &MF, + FunctionLoweringInfo &FuncInfo); + + void BuildSelectionDAG(SelectionDAG &DAG, BasicBlock *LLVMBB, + std::vector > &PHINodesToUpdate, + FunctionLoweringInfo &FuncInfo); + }; + + } + + #endif /* LLVM_CODEGEN_SELECTIONDAG_ISEL_H */ From jeffc at jolt-lang.org Fri Jan 7 01:46:51 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Fri, 7 Jan 2005 01:46:51 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Transforms/LinkAllPasses.h Message-ID: <200501070746.BAA11819@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Transforms: LinkAllPasses.h updated: 1.8 -> 1.9 --- Log message: But not the identation of THAT line --- Diffs of the changes: (+1 -1) Index: llvm/include/llvm/Transforms/LinkAllPasses.h diff -u llvm/include/llvm/Transforms/LinkAllPasses.h:1.8 llvm/include/llvm/Transforms/LinkAllPasses.h:1.9 --- llvm/include/llvm/Transforms/LinkAllPasses.h:1.8 Fri Jan 7 01:44:02 2005 +++ llvm/include/llvm/Transforms/LinkAllPasses.h Fri Jan 7 01:46:40 2005 @@ -1,6 +1,6 @@ //===- llvm/Transforms/LinkAllPasses.h - Reference All Passes ---*- C++ -*-===// // -// The LLVM Compiler Infrastructure +// The LLVM Compiler Infrastructure // // This file was developed by Jeff Cohen and is distributed under the // University of Illinois Open Source License. See LICENSE.TXT for details. From lattner at cs.uiuc.edu Fri Jan 7 01:47:17 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jan 2005 01:47:17 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200501070747.j077lHmZ032529@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.7 -> 1.8 --- Log message: Complete rewrite of the SelectionDAG class. --- Diffs of the changes: (+755 -103) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.7 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.8 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.7 Sun Jul 4 07:19:56 2004 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Fri Jan 7 01:46:32 2005 @@ -1,4 +1,4 @@ -//===-- SelectionDAG.cpp - Implement the SelectionDAG* classes ------------===// +//===-- SelectionDAG.cpp - Implement the SelectionDAG data structures -----===// // // The LLVM Compiler Infrastructure // @@ -7,125 +7,777 @@ // //===----------------------------------------------------------------------===// // -// This file implements the SelectionDAG* classes, which are used to perform -// DAG-based instruction selection in a target-specific manner. +// This implements the SelectionDAG class. // //===----------------------------------------------------------------------===// #include "llvm/CodeGen/SelectionDAG.h" -#include "llvm/Type.h" +#include "llvm/Constants.h" +#include "llvm/GlobalValue.h" +#include "llvm/Assembly/Writer.h" +#include "llvm/CodeGen/MachineBasicBlock.h" #include - +#include using namespace llvm; +/// getSetCCSwappedOperands - Return the operation corresponding to (Y op X) +/// when given the operation for (X op Y). +ISD::CondCode ISD::getSetCCSwappedOperands(ISD::CondCode Operation) { + // To perform this operation, we just need to swap the L and G bits of the + // operation. + unsigned OldL = (Operation >> 2) & 1; + unsigned OldG = (Operation >> 1) & 1; + return ISD::CondCode((Operation & ~6) | // Keep the N, U, E bits + (OldL << 1) | // New G bit + (OldG << 2)); // New L bit. +} + +/// getSetCCInverse - Return the operation corresponding to !(X op Y), where +/// 'op' is a valid SetCC operation. +ISD::CondCode ISD::getSetCCInverse(ISD::CondCode Op, bool isInteger) { + unsigned Operation = Op; + if (isInteger) + Operation ^= 7; // Flip L, G, E bits, but not U. + else + Operation ^= 15; // Flip all of the condition bits. + if (Operation > ISD::SETTRUE2) + Operation &= ~8; // Don't let N and U bits get set. + return ISD::CondCode(Operation); +} + + +/// isSignedOp - For an integer comparison, return 1 if the comparison is a +/// signed operation and 2 if the result is an unsigned comparison. Return zero +/// if the operation does not depend on the sign of the input (setne and seteq). +static int isSignedOp(ISD::CondCode Opcode) { + switch (Opcode) { + default: assert(0 && "Illegal integer setcc operation!"); + case ISD::SETEQ: + case ISD::SETNE: return 0; + case ISD::SETLT: + case ISD::SETLE: + case ISD::SETGT: + case ISD::SETGE: return 1; + case ISD::SETULT: + case ISD::SETULE: + case ISD::SETUGT: + case ISD::SETUGE: return 2; + } +} + +/// getSetCCOrOperation - Return the result of a logical OR between different +/// comparisons of identical values: ((X op1 Y) | (X op2 Y)). This function +/// returns SETCC_INVALID if it is not possible to represent the resultant +/// comparison. +ISD::CondCode ISD::getSetCCOrOperation(ISD::CondCode Op1, ISD::CondCode Op2, + bool isInteger) { + if (isInteger && (isSignedOp(Op1) | isSignedOp(Op2)) == 3) + // Cannot fold a signed integer setcc with an unsigned integer setcc. + return ISD::SETCC_INVALID; + + unsigned Op = Op1 | Op2; // Combine all of the condition bits. + + // If the N and U bits get set then the resultant comparison DOES suddenly + // care about orderedness, and is true when ordered. + if (Op > ISD::SETTRUE2) + Op &= ~16; // Clear the N bit. + return ISD::CondCode(Op); +} + +/// getSetCCAndOperation - Return the result of a logical AND between different +/// comparisons of identical values: ((X op1 Y) & (X op2 Y)). This +/// function returns zero if it is not possible to represent the resultant +/// comparison. +ISD::CondCode ISD::getSetCCAndOperation(ISD::CondCode Op1, ISD::CondCode Op2, + bool isInteger) { + if (isInteger && (isSignedOp(Op1) | isSignedOp(Op2)) == 3) + // Cannot fold a signed setcc with an unsigned setcc. + return ISD::SETCC_INVALID; + + // Combine all of the condition bits. + return ISD::CondCode(Op1 & Op2); +} + SelectionDAG::~SelectionDAG() { for (unsigned i = 0, e = AllNodes.size(); i != e; ++i) delete AllNodes[i]; } +SDOperand SelectionDAG::getConstant(uint64_t Val, MVT::ValueType VT) { + assert(MVT::isInteger(VT) && "Cannot create FP integer constant!"); + // Mask out any bits that are not valid for this constant. + Val &= (1ULL << MVT::getSizeInBits(VT)) - 1; + + SDNode *&N = Constants[std::make_pair(Val, VT)]; + if (N) return SDOperand(N, 0); + N = new ConstantSDNode(Val, VT); + AllNodes.push_back(N); + return SDOperand(N, 0); +} + +SDOperand SelectionDAG::getConstantFP(double Val, MVT::ValueType VT) { + assert(MVT::isFloatingPoint(VT) && "Cannot create integer FP constant!"); + if (VT == MVT::f32) + Val = (float)Val; // Mask out extra precision. + + SDNode *&N = ConstantFPs[std::make_pair(Val, VT)]; + if (N) return SDOperand(N, 0); + N = new ConstantFPSDNode(Val, VT); + AllNodes.push_back(N); + return SDOperand(N, 0); +} -/// dump - Print out the current Selection DAG... -void SelectionDAG::dump() const { - Root->dump(); // Print from the root... + + +SDOperand SelectionDAG::getGlobalAddress(const GlobalValue *GV, + MVT::ValueType VT) { + SDNode *&N = GlobalValues[GV]; + if (N) return SDOperand(N, 0); + N = new GlobalAddressSDNode(GV,VT); + AllNodes.push_back(N); + return SDOperand(N, 0); +} + +SDOperand SelectionDAG::getFrameIndex(int FI, MVT::ValueType VT) { + SDNode *&N = FrameIndices[FI]; + if (N) return SDOperand(N, 0); + N = new FrameIndexSDNode(FI, VT); + AllNodes.push_back(N); + return SDOperand(N, 0); +} + +SDOperand SelectionDAG::getConstantPool(unsigned CPIdx, MVT::ValueType VT) { + SDNode *N = ConstantPoolIndices[CPIdx]; + if (N) return SDOperand(N, 0); + N = new ConstantPoolSDNode(CPIdx, VT); + AllNodes.push_back(N); + return SDOperand(N, 0); } -/// getValueType - Return the ValueType for the specified LLVM type. This -/// method works on all scalar LLVM types. +SDOperand SelectionDAG::getBasicBlock(MachineBasicBlock *MBB) { + SDNode *&N = BBNodes[MBB]; + if (N) return SDOperand(N, 0); + N = new BasicBlockSDNode(MBB); + AllNodes.push_back(N); + return SDOperand(N, 0); +} + +SDOperand SelectionDAG::getExternalSymbol(const char *Sym, MVT::ValueType VT) { + SDNode *&N = ExternalSymbols[Sym]; + if (N) return SDOperand(N, 0); + N = new ExternalSymbolSDNode(Sym, VT); + AllNodes.push_back(N); + return SDOperand(N, 0); +} + +SDOperand SelectionDAG::getSetCC(ISD::CondCode Cond, SDOperand N1, + SDOperand N2) { + // These setcc operations always fold. + switch (Cond) { + default: break; + case ISD::SETFALSE: + case ISD::SETFALSE2: return getConstant(0, MVT::i1); + case ISD::SETTRUE: + case ISD::SETTRUE2: return getConstant(1, MVT::i1); + } + + if (ConstantSDNode *N1C = dyn_cast(N1.Val)) + if (ConstantSDNode *N2C = dyn_cast(N2.Val)) { + uint64_t C1 = N1C->getValue(), C2 = N2C->getValue(); + + // Sign extend the operands if required + if (ISD::isSignedIntSetCC(Cond)) { + C1 = N1C->getSignExtended(); + C2 = N2C->getSignExtended(); + } + + switch (Cond) { + default: assert(0 && "Unknown integer setcc!"); + case ISD::SETEQ: return getConstant(C1 == C2, MVT::i1); + case ISD::SETNE: return getConstant(C1 != C2, MVT::i1); + case ISD::SETULT: return getConstant(C1 < C2, MVT::i1); + case ISD::SETUGT: return getConstant(C1 > C2, MVT::i1); + case ISD::SETULE: return getConstant(C1 <= C2, MVT::i1); + case ISD::SETUGE: return getConstant(C1 >= C2, MVT::i1); + case ISD::SETLT: return getConstant((int64_t)C1 < (int64_t)C2, MVT::i1); + case ISD::SETGT: return getConstant((int64_t)C1 < (int64_t)C2, MVT::i1); + case ISD::SETLE: return getConstant((int64_t)C1 < (int64_t)C2, MVT::i1); + case ISD::SETGE: return getConstant((int64_t)C1 < (int64_t)C2, MVT::i1); + } + } else { + // Ensure that the constant occurs on the RHS. + Cond = ISD::getSetCCSwappedOperands(Cond); + std::swap(N1, N2); + } + + if (ConstantFPSDNode *N1C = dyn_cast(N1.Val)) + if (ConstantFPSDNode *N2C = dyn_cast(N2.Val)) { + double C1 = N1C->getValue(), C2 = N2C->getValue(); + + switch (Cond) { + default: break; // FIXME: Implement the rest of these! + case ISD::SETEQ: return getConstant(C1 == C2, MVT::i1); + case ISD::SETNE: return getConstant(C1 != C2, MVT::i1); + case ISD::SETLT: return getConstant((int64_t)C1 < (int64_t)C2, MVT::i1); + case ISD::SETGT: return getConstant((int64_t)C1 < (int64_t)C2, MVT::i1); + case ISD::SETLE: return getConstant((int64_t)C1 < (int64_t)C2, MVT::i1); + case ISD::SETGE: return getConstant((int64_t)C1 < (int64_t)C2, MVT::i1); + } + } else { + // Ensure that the constant occurs on the RHS. + Cond = ISD::getSetCCSwappedOperands(Cond); + std::swap(N1, N2); + } + + if (N1 == N2) { + // We can always fold X == Y for integer setcc's. + if (MVT::isInteger(N1.getValueType())) + return getConstant(ISD::isTrueWhenEqual(Cond), MVT::i1); + unsigned UOF = ISD::getUnorderedFlavor(Cond); + if (UOF == 2) // FP operators that are undefined on NaNs. + return getConstant(ISD::isTrueWhenEqual(Cond), MVT::i1); + if (UOF == ISD::isTrueWhenEqual(Cond)) + return getConstant(UOF, MVT::i1); + // Otherwise, we can't fold it. However, we can simplify it to SETUO/SETO + // if it is not already. + Cond = UOF == 0 ? ISD::SETUO : ISD::SETO; + } + + + SetCCSDNode *&N = SetCCs[std::make_pair(std::make_pair(N1, N2), Cond)]; + if (N) return SDOperand(N, 0); + N = new SetCCSDNode(Cond, N1, N2); + AllNodes.push_back(N); + return SDOperand(N, 0); +} + + + +/// getNode - Gets or creates the specified node. /// -MVT::ValueType SelectionDAG::getValueType(const Type *Ty) const { - switch (Ty->getTypeID()) { - case Type::VoidTyID: assert(0 && "Void type object in getValueType!"); - default: assert(0 && "Unknown type in DAGBuilder!\n"); - case Type::BoolTyID: return MVT::i1; - case Type::SByteTyID: - case Type::UByteTyID: return MVT::i8; - case Type::ShortTyID: - case Type::UShortTyID: return MVT::i16; - case Type::IntTyID: - case Type::UIntTyID: return MVT::i32; - case Type::LongTyID: - case Type::ULongTyID: return MVT::i64; - case Type::FloatTyID: return MVT::f32; - case Type::DoubleTyID: return MVT::f64; - case Type::LabelTyID: - case Type::PointerTyID: return PointerType; - } -} - -void SelectionDAGNode::dump() const { - // Print out the DAG in post-order - std::map NodeIDs; - unsigned ID = 0; - printit(0, ID, NodeIDs); -} - -void SelectionDAGNode::printit(unsigned Offset, unsigned &LastID, - std::map &NodeIDs) const { - if (!NodeIDs.count(this)) { - // Emit all of the uses first... - for (unsigned i = 0, e = Uses.size(); i != e; ++i) - Uses[i]->printit(Offset+1, LastID, NodeIDs); - - NodeIDs[this] = LastID++; - - std::cerr << std::string(Offset, ' ') << "#" << LastID-1 << " "; - } else { - // Node has already been emitted... - std::cerr << std::string(Offset, ' ') << "#" << NodeIDs[this] << " "; - } - - switch (ValueType) { - case MVT::isVoid: std::cerr << "V:"; break; - case MVT::i1: std::cerr << "i1:"; break; - case MVT::i8: std::cerr << "i8:"; break; - case MVT::i16: std::cerr << "i16:"; break; - case MVT::i32: std::cerr << "i32:"; break; - case MVT::i64: std::cerr << "i64:"; break; - case MVT::f32: std::cerr << "f32:"; break; - case MVT::f64: std::cerr << "f64:"; break; - default: assert(0 && "Invalid node ValueType!"); - } - switch (NodeType) { - case ISD::ChainNode: std::cerr << "ChainNode"; break; - case ISD::BlockChainNode: std::cerr << "BlockChainNode"; break; - case ISD::ProtoNode: std::cerr << "ProtoNode"; break; - - case ISD::Constant: std::cerr << "Constant"; break; - case ISD::FrameIndex: std::cerr << "FrameIndex"; break; - case ISD::BasicBlock: std::cerr << "BasicBlock"; break; - - case ISD::Plus: std::cerr << "Plus"; break; - case ISD::Minus: std::cerr << "Minus"; break; - case ISD::Times: std::cerr << "Times"; break; - case ISD::SDiv: std::cerr << "SDiv"; break; - case ISD::UDiv: std::cerr << "UDiv"; break; - case ISD::SRem: std::cerr << "SRem"; break; - case ISD::URem: std::cerr << "URem"; break; - case ISD::And: std::cerr << "And"; break; - case ISD::Or: std::cerr << "Or"; break; - case ISD::Xor: std::cerr << "Xor"; break; - - case ISD::SetEQ: std::cerr << "SetEQ"; break; - case ISD::SetNE: std::cerr << "SetNE"; break; - case ISD::SetLT: std::cerr << "SetLT"; break; - case ISD::SetLE: std::cerr << "SetLE"; break; - case ISD::SetGT: std::cerr << "SetGT"; break; - case ISD::SetGE: std::cerr << "SetGE"; break; - - case ISD::Br: std::cerr << "Br"; break; - case ISD::BrCond: std::cerr << "BrCond"; break; - case ISD::Switch: std::cerr << "Switch"; break; - case ISD::Ret: std::cerr << "Ret"; break; - case ISD::RetVoid: std::cerr << "RetVoid"; break; - case ISD::Load: std::cerr << "Load"; break; - case ISD::Store: std::cerr << "Store"; break; - case ISD::PHI: std::cerr << "PHI"; break; - case ISD::Call: std::cerr << "Call"; break; +SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT) { + SDNode *N = new SDNode(Opcode, VT); + AllNodes.push_back(N); + return SDOperand(N, 0); +} + +static const Type *getTypeFor(MVT::ValueType VT) { + switch (VT) { + default: assert(0 && "Unknown MVT!"); + case MVT::i1: return Type::BoolTy; + case MVT::i8: return Type::UByteTy; + case MVT::i16: return Type::UShortTy; + case MVT::i32: return Type::UIntTy; + case MVT::i64: return Type::ULongTy; + case MVT::f32: return Type::FloatTy; + case MVT::f64: return Type::DoubleTy; + } +} + +SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT, + SDOperand Operand) { + if (ConstantSDNode *C = dyn_cast(Operand.Val)) { + uint64_t Val = C->getValue(); + switch (Opcode) { + default: break; + case ISD::SIGN_EXTEND: return getConstant(C->getSignExtended(), VT); + case ISD::ZERO_EXTEND: return getConstant(Val, VT); + case ISD::TRUNCATE: return getConstant(Val, VT); + } + } + + if (ConstantFPSDNode *C = dyn_cast(Operand.Val)) + switch (Opcode) { + case ISD::FP_ROUND: + case ISD::FP_EXTEND: + return getConstantFP(C->getValue(), VT); + } + + unsigned OpOpcode = Operand.Val->getOpcode(); + switch (Opcode) { + case ISD::SIGN_EXTEND: + if (Operand.getValueType() == VT) return Operand; // noop extension + if (OpOpcode == ISD::SIGN_EXTEND || OpOpcode == ISD::ZERO_EXTEND) + return getNode(OpOpcode, VT, Operand.Val->getOperand(0)); + break; + case ISD::ZERO_EXTEND: + if (Operand.getValueType() == VT) return Operand; // noop extension + if (OpOpcode == ISD::SIGN_EXTEND || OpOpcode == ISD::ZERO_EXTEND) + return getNode(OpOpcode, VT, Operand.Val->getOperand(0)); + break; + case ISD::TRUNCATE: + if (Operand.getValueType() == VT) return Operand; // noop truncate + if (OpOpcode == ISD::TRUNCATE) + return getNode(ISD::TRUNCATE, VT, Operand.Val->getOperand(0)); + break; + } + + SDNode *&N = UnaryOps[std::make_pair(Opcode, std::make_pair(Operand, VT))]; + if (N) return SDOperand(N, 0); + N = new SDNode(Opcode, Operand); + N->setValueTypes(VT); + AllNodes.push_back(N); + return SDOperand(N, 0); +} + +static bool isCommutativeBinOp(unsigned Opcode) { + switch (Opcode) { + case ISD::ADD: + case ISD::MUL: + case ISD::AND: + case ISD::OR: + case ISD::XOR: return true; + default: return false; // FIXME: Need commutative info for user ops! + } +} + +static bool isAssociativeBinOp(unsigned Opcode) { + switch (Opcode) { + case ISD::ADD: + case ISD::MUL: + case ISD::AND: + case ISD::OR: + case ISD::XOR: return true; + default: return false; // FIXME: Need associative info for user ops! + } +} + +static unsigned ExactLog2(uint64_t Val) { + unsigned Count = 0; + while (Val != 1) { + Val >>= 1; + ++Count; + } + return Count; +} + +// isInvertibleForFree - Return true if there is no cost to emitting the logical +// inverse of this node. +static bool isInvertibleForFree(SDOperand N) { + if (isa(N.Val)) return true; + if (isa(N.Val) && N.Val->hasOneUse()) + return true; + return false; +} + + +SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT, + SDOperand N1, SDOperand N2) { + ConstantSDNode *N1C = dyn_cast(N1.Val); + ConstantSDNode *N2C = dyn_cast(N2.Val); + if (N1C) { + if (N2C) { + uint64_t C1 = N1C->getValue(), C2 = N2C->getValue(); + switch (Opcode) { + case ISD::ADD: return getConstant(C1 + C2, VT); + case ISD::SUB: return getConstant(C1 - C2, VT); + case ISD::MUL: return getConstant(C1 * C2, VT); + case ISD::UDIV: + if (C2) return getConstant(C1 / C2, VT); + break; + case ISD::UREM : + if (C2) return getConstant(C1 % C2, VT); + break; + case ISD::SDIV : + if (C2) return getConstant(N1C->getSignExtended() / + N2C->getSignExtended(), VT); + break; + case ISD::SREM : + if (C2) return getConstant(N1C->getSignExtended() % + N2C->getSignExtended(), VT); + break; + case ISD::AND : return getConstant(C1 & C2, VT); + case ISD::OR : return getConstant(C1 | C2, VT); + case ISD::XOR : return getConstant(C1 ^ C2, VT); + default: break; + } + + } else { // Cannonicalize constant to RHS if commutative + if (isCommutativeBinOp(Opcode)) { + std::swap(N1C, N2C); + std::swap(N1, N2); + } + } + } + + if (N2C) { + uint64_t C2 = N2C->getValue(); + + switch (Opcode) { + case ISD::ADD: + if (!C2) return N1; // add X, 0 -> X + break; + case ISD::SUB: + if (!C2) return N1; // sub X, 0 -> X + break; + case ISD::MUL: + if (!C2) return N2; // mul X, 0 -> 0 + if (N2C->isAllOnesValue()) // mul X, -1 -> 0-X + return getNode(ISD::SUB, VT, getConstant(0, VT), N1); + + // FIXME: This should only be done if the target supports shift + // operations. + if ((C2 & C2-1) == 0) { + SDOperand ShAmt = getConstant(ExactLog2(C2), MVT::i8); + return getNode(ISD::SHL, VT, N1, ShAmt); + } + break; + + case ISD::UDIV: + // FIXME: This should only be done if the target supports shift + // operations. + if ((C2 & C2-1) == 0 && C2) { + SDOperand ShAmt = getConstant(ExactLog2(C2), MVT::i8); + return getNode(ISD::SRL, VT, N1, ShAmt); + } + break; + + case ISD::AND: + if (!C2) return N2; // X and 0 -> 0 + if (N2C->isAllOnesValue()) + return N1; // X and -1 -> X + break; + case ISD::OR: + if (!C2)return N1; // X or 0 -> X + if (N2C->isAllOnesValue()) + return N2; // X or -1 -> -1 + break; + case ISD::XOR: + if (!C2) return N1; // X xor 0 -> X + if (N2C->isAllOnesValue()) { + if (SetCCSDNode *SetCC = dyn_cast(N1.Val)){ + // !(X op Y) -> (X !op Y) + bool isInteger = MVT::isInteger(SetCC->getOperand(0).getValueType()); + return getSetCC(ISD::getSetCCInverse(SetCC->getCondition(),isInteger), + SetCC->getOperand(0), SetCC->getOperand(1)); + } else if (N1.getOpcode() == ISD::AND || N1.getOpcode() == ISD::OR) { + SDNode *Op = N1.Val; + // !(X or Y) -> (!X and !Y) iff X or Y are freely invertible + // !(X and Y) -> (!X or !Y) iff X or Y are freely invertible + SDOperand LHS = Op->getOperand(0), RHS = Op->getOperand(1); + if (isInvertibleForFree(RHS) || isInvertibleForFree(LHS)) { + LHS = getNode(ISD::XOR, VT, LHS, N2); // RHS = ~LHS + RHS = getNode(ISD::XOR, VT, RHS, N2); // RHS = ~RHS + if (Op->getOpcode() == ISD::AND) + return getNode(ISD::OR, VT, LHS, RHS); + return getNode(ISD::AND, VT, LHS, RHS); + } + } + // X xor -1 -> not(x) ? + } + break; + } + + // Reassociate ((X op C1) op C2) if possible. + if (N1.getOpcode() == Opcode && isAssociativeBinOp(Opcode)) + if (ConstantSDNode *N3C = dyn_cast(N1.Val->getOperand(1))) + return getNode(Opcode, VT, N3C->getOperand(0), + getNode(Opcode, VT, N2, N1.Val->getOperand(1))); + } + + ConstantFPSDNode *N1CFP = dyn_cast(N1.Val); + ConstantFPSDNode *N2CFP = dyn_cast(N2.Val); + if (N1CFP) + if (N2CFP) { + double C1 = N1CFP->getValue(), C2 = N2CFP->getValue(); + switch (Opcode) { + case ISD::ADD: return getConstantFP(C1 + C2, VT); + case ISD::SUB: return getConstantFP(C1 - C2, VT); + case ISD::MUL: return getConstantFP(C1 * C2, VT); + case ISD::SDIV: + if (C2) return getConstantFP(C1 / C2, VT); + break; + case ISD::SREM : + if (C2) return getConstantFP(fmod(C1, C2), VT); + break; + default: break; + } + + } else { // Cannonicalize constant to RHS if commutative + if (isCommutativeBinOp(Opcode)) { + std::swap(N1CFP, N2CFP); + std::swap(N1, N2); + } + } + + // Finally, fold operations that do not require constants. + switch (Opcode) { + case ISD::AND: + case ISD::OR: + if (SetCCSDNode *LHS = dyn_cast(N1.Val)) + if (SetCCSDNode *RHS = dyn_cast(N2.Val)) { + SDOperand LL = LHS->getOperand(0), RL = RHS->getOperand(0); + SDOperand LR = LHS->getOperand(1), RR = RHS->getOperand(1); + ISD::CondCode Op2 = RHS->getCondition(); + + // (X op1 Y) | (Y op2 X) -> (X op1 Y) | (X swapop2 Y) + if (LL == RR && LR == RL) { + Op2 = ISD::getSetCCSwappedOperands(Op2); + goto MatchedBackwards; + } + + if (LL == RL && LR == RR) { + MatchedBackwards: + ISD::CondCode Result; + bool isInteger = MVT::isInteger(LL.getValueType()); + if (Opcode == ISD::OR) + Result = ISD::getSetCCOrOperation(LHS->getCondition(), Op2, + isInteger); + else + Result = ISD::getSetCCAndOperation(LHS->getCondition(), Op2, + isInteger); + if (Result != ISD::SETCC_INVALID) + return getSetCC(Result, LL, LR); + } + } + break; + case ISD::XOR: + if (N1 == N2) return getConstant(0, VT); // xor X, Y -> 0 + break; + } + + SDNode *&N = BinaryOps[std::make_pair(Opcode, std::make_pair(N1, N2))]; + if (N) return SDOperand(N, 0); + N = new SDNode(Opcode, N1, N2); + N->setValueTypes(VT); + + AllNodes.push_back(N); + return SDOperand(N, 0); +} + +SDOperand SelectionDAG::getLoad(MVT::ValueType VT, + SDOperand Chain, SDOperand Ptr) { + SDNode *&N = Loads[std::make_pair(Ptr, std::make_pair(Chain, VT))]; + if (N) return SDOperand(N, 0); + N = new SDNode(ISD::LOAD, Chain, Ptr); + + // Loads have a token chain. + N->setValueTypes(VT, MVT::Other); + AllNodes.push_back(N); + return SDOperand(N, 0); +} + - case ISD::Unspec1: std::cerr << "Unspec1"; break; - case ISD::Unspec2: std::cerr << "Unspec2"; break; +SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT, + SDOperand N1, SDOperand N2, SDOperand N3) { + // Perform various simplifications. + ConstantSDNode *N1C = dyn_cast(N1.Val); + ConstantSDNode *N2C = dyn_cast(N2.Val); + ConstantSDNode *N3C = dyn_cast(N3.Val); + switch (Opcode) { + case ISD::SELECT: + if (N1C) + if (N1C->getValue()) + return N2; // select true, X, Y -> X + else + return N3; // select false, X, Y -> Y + + if (N2 == N3) return N2; // select C, X, X -> X + + if (VT == MVT::i1) { // Boolean SELECT + if (N2C) { + if (N3C) { + if (N2C->getValue()) // select C, 1, 0 -> C + return N1; + return getNode(ISD::XOR, VT, N1, N3); // select C, 0, 1 -> ~C + } + + if (N2C->getValue()) // select C, 1, X -> C | X + return getNode(ISD::OR, VT, N1, N3); + else // select C, 0, X -> ~C & X + return getNode(ISD::AND, VT, + getNode(ISD::XOR, N1.getValueType(), N1, + getConstant(1, N1.getValueType())), N3); + } else if (N3C) { + if (N3C->getValue()) // select C, X, 1 -> ~C | X + return getNode(ISD::OR, VT, + getNode(ISD::XOR, N1.getValueType(), N1, + getConstant(1, N1.getValueType())), N2); + else // select C, X, 0 -> C & X + return getNode(ISD::AND, VT, N1, N2); + } + } + + break; + } + + SDNode *N = new SDNode(Opcode, N1, N2, N3); + switch (Opcode) { + default: + N->setValueTypes(VT); + break; + case ISD::DYNAMIC_STACKALLOC: // DYNAMIC_STACKALLOC produces pointer and chain + N->setValueTypes(VT, MVT::Other); + break; + } + + // FIXME: memoize NODES + AllNodes.push_back(N); + return SDOperand(N, 0); +} + +SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT, + std::vector &Children) { + switch (Children.size()) { + case 0: return getNode(Opcode, VT); + case 1: return getNode(Opcode, VT, Children[0]); + case 2: return getNode(Opcode, VT, Children[0], Children[1]); + case 3: return getNode(Opcode, VT, Children[0], Children[1], Children[2]); + default: + // FIXME: MEMOIZE!! + SDNode *N = new SDNode(Opcode, Children); + N->setValueTypes(VT); + AllNodes.push_back(N); + return SDOperand(N, 0); + } +} + + + +void SDNode::dump() const { + std::cerr << (void*)this << ": "; + + for (unsigned i = 0, e = getNumValues(); i != e; ++i) { + if (i) std::cerr << ","; + switch (getValueType(i)) { + default: assert(0 && "Unknown value type!"); + case MVT::i1: std::cerr << "i1"; break; + case MVT::i8: std::cerr << "i8"; break; + case MVT::i16: std::cerr << "i16"; break; + case MVT::i32: std::cerr << "i32"; break; + case MVT::i64: std::cerr << "i64"; break; + case MVT::f32: std::cerr << "f32"; break; + case MVT::f64: std::cerr << "f64"; break; + case MVT::Other: std::cerr << "ch"; break; + } + } + std::cerr << " = "; + + switch (getOpcode()) { + default: std::cerr << "<>"; break; + case ISD::EntryToken: std::cerr << "EntryToken"; break; + case ISD::Constant: std::cerr << "Constant"; break; + case ISD::ConstantFP: std::cerr << "ConstantFP"; break; + case ISD::GlobalAddress: std::cerr << "GlobalAddress"; break; + case ISD::FrameIndex: std::cerr << "FrameIndex"; break; + case ISD::BasicBlock: std::cerr << "BasicBlock"; break; + case ISD::ExternalSymbol: std::cerr << "ExternalSymbol"; break; + case ISD::ConstantPool: std::cerr << "ConstantPoolIndex"; break; + case ISD::CopyToReg: std::cerr << "CopyToReg"; break; + case ISD::CopyFromReg: std::cerr << "CopyFromReg"; break; + + case ISD::ADD: std::cerr << "add"; break; + case ISD::SUB: std::cerr << "sub"; break; + case ISD::MUL: std::cerr << "mul"; break; + case ISD::SDIV: std::cerr << "sdiv"; break; + case ISD::UDIV: std::cerr << "udiv"; break; + case ISD::SREM: std::cerr << "srem"; break; + case ISD::UREM: std::cerr << "urem"; break; + case ISD::AND: std::cerr << "and"; break; + case ISD::OR: std::cerr << "or"; break; + case ISD::XOR: std::cerr << "xor"; break; + case ISD::SHL: std::cerr << "shl"; break; + case ISD::SRA: std::cerr << "sra"; break; + case ISD::SRL: std::cerr << "srl"; break; + + case ISD::SETCC: std::cerr << "setcc"; break; + case ISD::SELECT: std::cerr << "select"; break; + case ISD::ADDC: std::cerr << "addc"; break; + case ISD::SUBB: std::cerr << "subb"; break; + + // Conversion operators. + case ISD::SIGN_EXTEND: std::cerr << "sign_extend"; break; + case ISD::ZERO_EXTEND: std::cerr << "zero_extend"; break; + case ISD::TRUNCATE: std::cerr << "truncate"; break; + case ISD::FP_ROUND: std::cerr << "fp_round"; break; + case ISD::FP_EXTEND: std::cerr << "fp_extend"; break; + + // Control flow instructions + case ISD::BR: std::cerr << "br"; break; + case ISD::BRCOND: std::cerr << "brcond"; break; + case ISD::RET: std::cerr << "ret"; break; + case ISD::CALL: std::cerr << "call"; break; + case ISD::ADJCALLSTACKDOWN: std::cerr << "adjcallstackdown"; break; + case ISD::ADJCALLSTACKUP: std::cerr << "adjcallstackup"; break; + + // Other operators + case ISD::LOAD: std::cerr << "load"; break; + case ISD::STORE: std::cerr << "store"; break; + case ISD::DYNAMIC_STACKALLOC: std::cerr << "dynamic_stackalloc"; break; + case ISD::EXTRACT_ELEMENT: std::cerr << "extract_element"; break; + case ISD::BUILD_PAIR: std::cerr << "build_pair"; break; + } + + std::cerr << " "; + for (unsigned i = 0, e = getNumOperands(); i != e; ++i) { + if (i) std::cerr << ", "; + std::cerr << (void*)getOperand(i).Val; + if (unsigned RN = getOperand(i).ResNo) + std::cerr << ":" << RN; + } + + if (const ConstantSDNode *CSDN = dyn_cast(this)) { + std::cerr << "<" << CSDN->getValue() << ">"; + } else if (const ConstantFPSDNode *CSDN = dyn_cast(this)) { + std::cerr << "<" << CSDN->getValue() << ">"; + } else if (const GlobalAddressSDNode *GADN = + dyn_cast(this)) { + std::cerr << "<"; + WriteAsOperand(std::cerr, GADN->getGlobal()) << ">"; + } else if (const FrameIndexSDNode *FIDN = + dyn_cast(this)) { + std::cerr << "<" << FIDN->getIndex() << ">"; + } else if (const ConstantPoolSDNode *CP = dyn_cast(this)){ + std::cerr << "<" << CP->getIndex() << ">"; + } else if (const BasicBlockSDNode *BBDN = + dyn_cast(this)) { + std::cerr << "<"; + const Value *LBB = (const Value*)BBDN->getBasicBlock()->getBasicBlock(); + if (LBB) + std::cerr << LBB->getName() << " "; + std::cerr << (const void*)BBDN->getBasicBlock() << ">"; + } else if (const CopyRegSDNode *C2V = dyn_cast(this)) { + std::cerr << "getReg() << ">"; + } else if (const ExternalSymbolSDNode *ES = + dyn_cast(this)) { + std::cerr << "'" << ES->getSymbol() << "'"; + } else if (const SetCCSDNode *SetCC = dyn_cast(this)) { + std::cerr << " - condition = "; + switch (SetCC->getCondition()) { + default: assert(0 && "Unknown setcc condition!"); + case ISD::SETOEQ: std::cerr << "setoeq"; break; + case ISD::SETOGT: std::cerr << "setogt"; break; + case ISD::SETOGE: std::cerr << "setoge"; break; + case ISD::SETOLT: std::cerr << "setolt"; break; + case ISD::SETOLE: std::cerr << "setole"; break; + case ISD::SETONE: std::cerr << "setone"; break; + + case ISD::SETO: std::cerr << "seto"; break; + case ISD::SETUO: std::cerr << "setuo"; break; + case ISD::SETUEQ: std::cerr << "setue"; break; + case ISD::SETUGT: std::cerr << "setugt"; break; + case ISD::SETUGE: std::cerr << "setuge"; break; + case ISD::SETULT: std::cerr << "setult"; break; + case ISD::SETULE: std::cerr << "setule"; break; + case ISD::SETUNE: std::cerr << "setune"; break; + + case ISD::SETEQ: std::cerr << "seteq"; break; + case ISD::SETGT: std::cerr << "setgt"; break; + case ISD::SETGE: std::cerr << "setge"; break; + case ISD::SETLT: std::cerr << "setlt"; break; + case ISD::SETLE: std::cerr << "setle"; break; + case ISD::SETNE: std::cerr << "setne"; break; + } } - std::cerr << "\n"; } + +void SelectionDAG::dump() const { + std::cerr << "SelectionDAG has " << AllNodes.size() << " nodes:"; + for (unsigned i = 0, e = AllNodes.size(); i != e; ++i) { + std::cerr << "\n "; + AllNodes[i]->dump(); + } + std::cerr << "\n\n"; +} + From lattner at cs.uiuc.edu Fri Jan 7 01:47:36 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jan 2005 01:47:36 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGBuilder.cpp Message-ID: <200501070747.j077la35032542@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGBuilder.cpp (r1.8) removed --- Log message: This file is obsolete --- Diffs of the changes: (+0 -0) From lattner at cs.uiuc.edu Fri Jan 7 01:48:05 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jan 2005 01:48:05 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200501070748.j077m5Op032554@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp added (r1.1) --- Log message: Initial implementation of the SelectionDAGISel class. This contains most of the code for lowering from LLVM code to a SelectionDAG. --- Diffs of the changes: (+853 -0) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -c /dev/null llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.1 *** /dev/null Fri Jan 7 01:48:03 2005 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Fri Jan 7 01:47:53 2005 *************** *** 0 **** --- 1,853 ---- + //===-- SelectionDAGISel.cpp - Implement the SelectionDAGISel class -------===// + // + // 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 implements the SelectionDAGISel class. + // + //===----------------------------------------------------------------------===// + + #define DEBUG_TYPE "isel" + #include "llvm/CodeGen/SelectionDAGISel.h" + #include "llvm/Constants.h" + #include "llvm/DerivedTypes.h" + #include "llvm/Function.h" + #include "llvm/Instructions.h" + #include "llvm/Intrinsics.h" + #include "llvm/CodeGen/MachineFunction.h" + #include "llvm/CodeGen/MachineFrameInfo.h" + #include "llvm/CodeGen/MachineInstrBuilder.h" + #include "llvm/CodeGen/SelectionDAG.h" + #include "llvm/CodeGen/SSARegMap.h" + #include "llvm/Target/TargetData.h" + #include "llvm/Target/TargetFrameInfo.h" + #include "llvm/Target/TargetInstrInfo.h" + #include "llvm/Target/TargetLowering.h" + #include "llvm/Target/TargetMachine.h" + #include "llvm/Support/Debug.h" + #include + #include + using namespace llvm; + + namespace llvm { + //===--------------------------------------------------------------------===// + /// FunctionLoweringInfo - This contains information that is global to a + /// function that is used when lowering a region of the function. + struct FunctionLoweringInfo { + TargetLowering &TLI; + Function &Fn; + MachineFunction &MF; + SSARegMap *RegMap; + + FunctionLoweringInfo(TargetLowering &TLI, Function &Fn,MachineFunction &MF); + + /// MBBMap - A mapping from LLVM basic blocks to their machine code entry. + std::map MBBMap; + + /// ValueMap - Since we emit code for the function a basic block at a time, + /// we must remember which virtual registers hold the values for + /// cross-basic-block values. + std::map ValueMap; + + /// StaticAllocaMap - Keep track of frame indices for fixed sized allocas in + /// the entry block. This allows the allocas to be efficiently referenced + /// anywhere in the function. + std::map StaticAllocaMap; + + unsigned MakeReg(MVT::ValueType VT) { + return RegMap->createVirtualRegister(TLI.getRegClassFor(VT)); + } + + unsigned CreateRegForValue(const Value *V) { + MVT::ValueType VT = TLI.getValueType(V->getType()); + // The common case is that we will only create one register for this + // value. If we have that case, create and return the virtual register. + unsigned NV = TLI.getNumElements(VT); + if (NV == 1) return MakeReg(VT); + + // If this value is represented with multiple target registers, make sure + // to create enough consequtive registers of the right (smaller) type. + unsigned NT = VT-1; // Find the type to use. + while (TLI.getNumElements((MVT::ValueType)NT) != 1) + --NT; + + unsigned R = MakeReg((MVT::ValueType)NT); + for (unsigned i = 1; i != NV; ++i) + MakeReg((MVT::ValueType)NT); + return R; + } + + unsigned InitializeRegForValue(const Value *V) { + unsigned &R = ValueMap[V]; + assert(R == 0 && "Already initialized this value register!"); + return R = CreateRegForValue(V); + } + }; + } + + /// isUsedOutsideOfDefiningBlock - Return true if this instruction is used by + /// PHI nodes or outside of the basic block that defines it. + static bool isUsedOutsideOfDefiningBlock(Instruction *I) { + if (isa(I)) return true; + BasicBlock *BB = I->getParent(); + for (Value::use_iterator UI = I->use_begin(), E = I->use_end(); UI != E; ++UI) + if (cast(*UI)->getParent() != BB || isa(*UI)) + return true; + return false; + } + + FunctionLoweringInfo::FunctionLoweringInfo(TargetLowering &tli, + Function &fn, MachineFunction &mf) + : TLI(tli), Fn(fn), MF(mf), RegMap(MF.getSSARegMap()) { + + // Initialize the mapping of values to registers. This is only set up for + // instruction values that are used outside of the block that defines + // them. + for (Function::aiterator AI = Fn.abegin(), E = Fn.aend(); AI != E; ++AI) + InitializeRegForValue(AI); + + Function::iterator BB = Fn.begin(), E = Fn.end(); + for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) + if (AllocaInst *AI = dyn_cast(I)) + if (ConstantUInt *CUI = dyn_cast(AI->getArraySize())) { + const Type *Ty = AI->getAllocatedType(); + uint64_t TySize = TLI.getTargetData().getTypeSize(Ty); + unsigned Align = TLI.getTargetData().getTypeAlignment(Ty); + TySize *= CUI->getValue(); // Get total allocated size. + StaticAllocaMap[AI] = + MF.getFrameInfo()->CreateStackObject(TySize, Align); + } + + for (; BB != E; ++BB) + for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) + if (!I->use_empty() && isUsedOutsideOfDefiningBlock(I)) + if (!isa(I) || + !StaticAllocaMap.count(cast(I))) + InitializeRegForValue(I); + + // Create an initial MachineBasicBlock for each LLVM BasicBlock in F. This + // also creates the initial PHI MachineInstrs, though none of the input + // operands are populated. + for (Function::iterator BB = Fn.begin(), E = Fn.end(); BB != E; ++BB) { + MachineBasicBlock *MBB = new MachineBasicBlock(BB); + MBBMap[BB] = MBB; + MF.getBasicBlockList().push_back(MBB); + + // Create Machine PHI nodes for LLVM PHI nodes, lowering them as + // appropriate. + PHINode *PN; + for (BasicBlock::iterator I = BB->begin(); + (PN = dyn_cast(I)); ++I) { + unsigned NumElements =TLI.getNumElements(TLI.getValueType(PN->getType())); + unsigned PHIReg = ValueMap[PN]; + assert(PHIReg && "PHI node does not have an assigned virtual register!"); + for (unsigned i = 0; i != NumElements; ++i) + BuildMI(MBB, TargetInstrInfo::PHI, PN->getNumOperands(), PHIReg+i); + } + } + } + + + + //===----------------------------------------------------------------------===// + /// SelectionDAGLowering - This is the common target-independent lowering + /// implementation that is parameterized by a TargetLowering object. + /// Also, targets can overload any lowering method. + /// + namespace llvm { + class SelectionDAGLowering { + MachineBasicBlock *CurMBB; + + std::map NodeMap; + + public: + // TLI - This is information that describes the available target features we + // need for lowering. This indicates when operations are unavailable, + // implemented with a libcall, etc. + TargetLowering &TLI; + SelectionDAG &DAG; + const TargetData &TD; + + /// FuncInfo - Information about the function as a whole. + /// + FunctionLoweringInfo &FuncInfo; + + SelectionDAGLowering(SelectionDAG &dag, TargetLowering &tli, + FunctionLoweringInfo &funcinfo) + : TLI(tli), DAG(dag), TD(DAG.getTarget().getTargetData()), + FuncInfo(funcinfo) { + } + + void visit(Instruction &I) { visit(I.getOpcode(), I); } + + void visit(unsigned Opcode, User &I) { + switch (Opcode) { + default: assert(0 && "Unknown instruction type encountered!"); + abort(); + // Build the switch statement using the Instruction.def file. + #define HANDLE_INST(NUM, OPCODE, CLASS) \ + case Instruction::OPCODE:return visit##OPCODE((CLASS&)I); + #include "llvm/Instruction.def" + } + } + + void setCurrentBasicBlock(MachineBasicBlock *MBB) { CurMBB = MBB; } + + + SDOperand getIntPtrConstant(uint64_t Val) { + return DAG.getConstant(Val, TLI.getPointerTy()); + } + + SDOperand getValue(const Value *V) { + SDOperand &N = NodeMap[V]; + if (N.Val) return N; + + MVT::ValueType VT = TLI.getValueType(V->getType()); + if (Constant *C = const_cast(dyn_cast(V))) + if (ConstantExpr *CE = dyn_cast(C)) { + visit(CE->getOpcode(), *CE); + assert(N.Val && "visit didn't populate the ValueMap!"); + return N; + } else if (GlobalValue *GV = dyn_cast(C)) { + return N = DAG.getGlobalAddress(GV, VT); + } else if (isa(C)) { + return N = DAG.getConstant(0, TLI.getPointerTy()); + } else if (isa(C)) { + /// FIXME: Implement UNDEFVALUE better. + if (MVT::isInteger(VT)) + return N = DAG.getConstant(0, VT); + else if (MVT::isFloatingPoint(VT)) + return N = DAG.getConstantFP(0, VT); + else + assert(0 && "Unknown value type!"); + + } else if (ConstantFP *CFP = dyn_cast(C)) { + return N = DAG.getConstantFP(CFP->getValue(), VT); + } else { + // Canonicalize all constant ints to be unsigned. + return N = DAG.getConstant(cast(C)->getRawValue(),VT); + } + + if (const AllocaInst *AI = dyn_cast(V)) { + std::map::iterator SI = + FuncInfo.StaticAllocaMap.find(AI); + if (SI != FuncInfo.StaticAllocaMap.end()) + return DAG.getFrameIndex(SI->second, TLI.getPointerTy()); + } + + std::map::const_iterator VMI = + FuncInfo.ValueMap.find(V); + assert(VMI != FuncInfo.ValueMap.end() && "Value not in map!"); + return N = DAG.getCopyFromReg(VMI->second, VT); + } + + const SDOperand &setValue(const Value *V, SDOperand NewN) { + SDOperand &N = NodeMap[V]; + assert(N.Val == 0 && "Already set a value for this node!"); + return N = NewN; + } + + // Terminator instructions. + void visitRet(ReturnInst &I); + void visitBr(BranchInst &I); + void visitUnreachable(UnreachableInst &I) { /* noop */ } + + // These all get lowered before this pass. + void visitSwitch(SwitchInst &I) { assert(0 && "TODO"); } + void visitInvoke(InvokeInst &I) { assert(0 && "TODO"); } + void visitUnwind(UnwindInst &I) { assert(0 && "TODO"); } + + // + void visitBinary(User &I, unsigned Opcode); + void visitAdd(User &I) { visitBinary(I, ISD::ADD); } + void visitSub(User &I) { visitBinary(I, ISD::SUB); } + void visitMul(User &I) { visitBinary(I, ISD::MUL); } + void visitDiv(User &I) { + visitBinary(I, I.getType()->isUnsigned() ? ISD::UDIV : ISD::SDIV); + } + void visitRem(User &I) { + visitBinary(I, I.getType()->isUnsigned() ? ISD::UREM : ISD::SREM); + } + void visitAnd(User &I) { visitBinary(I, ISD::AND); } + void visitOr (User &I) { visitBinary(I, ISD::OR); } + void visitXor(User &I) { visitBinary(I, ISD::XOR); } + void visitShl(User &I) { visitBinary(I, ISD::SHL); } + void visitShr(User &I) { + visitBinary(I, I.getType()->isUnsigned() ? ISD::SRL : ISD::SRA); + } + + void visitSetCC(User &I, ISD::CondCode SignedOpc, ISD::CondCode UnsignedOpc); + void visitSetEQ(User &I) { visitSetCC(I, ISD::SETEQ, ISD::SETEQ); } + void visitSetNE(User &I) { visitSetCC(I, ISD::SETNE, ISD::SETNE); } + void visitSetLE(User &I) { visitSetCC(I, ISD::SETLE, ISD::SETULE); } + void visitSetGE(User &I) { visitSetCC(I, ISD::SETGE, ISD::SETUGE); } + void visitSetLT(User &I) { visitSetCC(I, ISD::SETLT, ISD::SETULT); } + void visitSetGT(User &I) { visitSetCC(I, ISD::SETGT, ISD::SETUGT); } + + void visitGetElementPtr(User &I); + void visitCast(User &I); + void visitSelect(User &I); + // + + void visitMalloc(MallocInst &I); + void visitFree(FreeInst &I); + void visitAlloca(AllocaInst &I); + void visitLoad(LoadInst &I); + void visitStore(StoreInst &I); + void visitPHI(PHINode &I) { } // PHI nodes are handled specially. + void visitCall(CallInst &I); + + // FIXME: These should go through the FunctionLoweringInfo object!!! + void visitVAStart(CallInst &I); + void visitVANext(VANextInst &I); + void visitVAArg(VAArgInst &I); + void visitVAEnd(CallInst &I); + void visitVACopy(CallInst &I); + void visitReturnAddress(CallInst &I); + void visitFrameAddress(CallInst &I); + + void visitMemSet(CallInst &I); + void visitMemCpy(CallInst &I); + void visitMemMove(CallInst &I); + + void visitUserOp1(Instruction &I) { + assert(0 && "UserOp1 should not exist at instruction selection time!"); + abort(); + } + void visitUserOp2(Instruction &I) { + assert(0 && "UserOp2 should not exist at instruction selection time!"); + abort(); + } + }; + } // end namespace llvm + + void SelectionDAGLowering::visitRet(ReturnInst &I) { + if (I.getNumOperands() == 0) { + DAG.setRoot(DAG.getNode(ISD::RET, MVT::Other, DAG.getRoot())); + return; + } + + SDOperand Op1 = getValue(I.getOperand(0)); + switch (Op1.getValueType()) { + default: assert(0 && "Unknown value type!"); + case MVT::i1: + case MVT::i8: + case MVT::i16: + // Extend integer types to 32-bits. + if (I.getOperand(0)->getType()->isSigned()) + Op1 = DAG.getNode(ISD::SIGN_EXTEND, MVT::i32, Op1); + else + Op1 = DAG.getNode(ISD::ZERO_EXTEND, MVT::i32, Op1); + break; + case MVT::f32: + // Extend float to double. + Op1 = DAG.getNode(ISD::FP_EXTEND, MVT::f64, Op1); + break; + case MVT::i32: + case MVT::i64: + case MVT::f64: + break; // No extension needed! + } + + DAG.setRoot(DAG.getNode(ISD::RET, MVT::Other, DAG.getRoot(), Op1)); + } + + void SelectionDAGLowering::visitBr(BranchInst &I) { + // Update machine-CFG edges. + MachineBasicBlock *Succ0MBB = FuncInfo.MBBMap[I.getSuccessor(0)]; + CurMBB->addSuccessor(Succ0MBB); + + // Figure out which block is immediately after the current one. + MachineBasicBlock *NextBlock = 0; + MachineFunction::iterator BBI = CurMBB; + if (++BBI != CurMBB->getParent()->end()) + NextBlock = BBI; + + if (I.isUnconditional()) { + // If this is not a fall-through branch, emit the branch. + if (Succ0MBB != NextBlock) + DAG.setRoot(DAG.getNode(ISD::BR, MVT::Other, DAG.getRoot(), + DAG.getBasicBlock(Succ0MBB))); + } else { + MachineBasicBlock *Succ1MBB = FuncInfo.MBBMap[I.getSuccessor(1)]; + CurMBB->addSuccessor(Succ1MBB); + + SDOperand Cond = getValue(I.getCondition()); + + if (Succ1MBB == NextBlock) { + // If the condition is false, fall through. This means we should branch + // if the condition is true to Succ #0. + DAG.setRoot(DAG.getNode(ISD::BRCOND, MVT::Other, DAG.getRoot(), + Cond, DAG.getBasicBlock(Succ0MBB))); + } else if (Succ0MBB == NextBlock) { + // If the condition is true, fall through. This means we should branch if + // the condition is false to Succ #1. Invert the condition first. + SDOperand True = DAG.getConstant(1, Cond.getValueType()); + Cond = DAG.getNode(ISD::XOR, Cond.getValueType(), Cond, True); + DAG.setRoot(DAG.getNode(ISD::BRCOND, MVT::Other, DAG.getRoot(), + Cond, DAG.getBasicBlock(Succ1MBB))); + } else { + // Neither edge is a fall through. If the comparison is true, jump to + // Succ#0, otherwise branch unconditionally to succ #1. + DAG.setRoot(DAG.getNode(ISD::BRCOND, MVT::Other, DAG.getRoot(), + Cond, DAG.getBasicBlock(Succ0MBB))); + DAG.setRoot(DAG.getNode(ISD::BR, MVT::Other, DAG.getRoot(), + DAG.getBasicBlock(Succ1MBB))); + } + } + } + + void SelectionDAGLowering::visitBinary(User &I, unsigned Opcode) { + SDOperand Op1 = getValue(I.getOperand(0)); + SDOperand Op2 = getValue(I.getOperand(1)); + setValue(&I, DAG.getNode(Opcode, Op1.getValueType(), Op1, Op2)); + } + + void SelectionDAGLowering::visitSetCC(User &I,ISD::CondCode SignedOpcode, + ISD::CondCode UnsignedOpcode) { + SDOperand Op1 = getValue(I.getOperand(0)); + SDOperand Op2 = getValue(I.getOperand(1)); + ISD::CondCode Opcode = SignedOpcode; + if (I.getOperand(0)->getType()->isUnsigned()) + Opcode = UnsignedOpcode; + setValue(&I, DAG.getSetCC(Opcode, Op1, Op2)); + } + + void SelectionDAGLowering::visitSelect(User &I) { + SDOperand Cond = getValue(I.getOperand(0)); + SDOperand TrueVal = getValue(I.getOperand(1)); + SDOperand FalseVal = getValue(I.getOperand(2)); + setValue(&I, DAG.getNode(ISD::SELECT, TrueVal.getValueType(), Cond, + TrueVal, FalseVal)); + } + + void SelectionDAGLowering::visitCast(User &I) { + SDOperand N = getValue(I.getOperand(0)); + MVT::ValueType SrcTy = TLI.getValueType(I.getOperand(0)->getType()); + MVT::ValueType DestTy = TLI.getValueType(I.getType()); + + if (N.getValueType() == DestTy) { + setValue(&I, N); // noop cast. + return; + } else if (isInteger(SrcTy) && isInteger(DestTy)) { + if (DestTy < SrcTy) // Truncating cast? + setValue(&I, DAG.getNode(ISD::TRUNCATE, DestTy, N)); + else if (I.getOperand(0)->getType()->isSigned()) + setValue(&I, DAG.getNode(ISD::SIGN_EXTEND, DestTy, N)); + else + setValue(&I, DAG.getNode(ISD::ZERO_EXTEND, DestTy, N)); + return; + } else if (isFloatingPoint(SrcTy) && isFloatingPoint(DestTy)) { + if (DestTy < SrcTy) // Rounding cast? + setValue(&I, DAG.getNode(ISD::FP_ROUND, DestTy, N)); + else + setValue(&I, DAG.getNode(ISD::FP_EXTEND, DestTy, N)); + } else { + // F->I or I->F + // FIXME: implement integer/fp conversions! + assert(0 && "This CAST is not yet implemented!\n"); + } + } + + void SelectionDAGLowering::visitGetElementPtr(User &I) { + SDOperand N = getValue(I.getOperand(0)); + const Type *Ty = I.getOperand(0)->getType(); + const Type *UIntPtrTy = TD.getIntPtrType(); + + for (GetElementPtrInst::op_iterator OI = I.op_begin()+1, E = I.op_end(); + OI != E; ++OI) { + Value *Idx = *OI; + if (const StructType *StTy = dyn_cast (Ty)) { + unsigned Field = cast(Idx)->getValue(); + if (Field) { + // N = N + Offset + uint64_t Offset = TD.getStructLayout(StTy)->MemberOffsets[Field]; + N = DAG.getNode(ISD::ADD, N.getValueType(), N, + getIntPtrConstant(Offset)); + } + Ty = StTy->getElementType(Field); + } else { + Ty = cast(Ty)->getElementType(); + if (!isa(Idx) || !cast(Idx)->isNullValue()) { + // N = N + Idx * ElementSize; + uint64_t ElementSize = TD.getTypeSize(Ty); + SDOperand IdxN = getValue(Idx); + IdxN = DAG.getNode(ISD::MUL, N.getValueType(), IdxN, + getIntPtrConstant(ElementSize)); + N = DAG.getNode(ISD::ADD, N.getValueType(), N, IdxN); + } + } + } + setValue(&I, N); + } + + void SelectionDAGLowering::visitAlloca(AllocaInst &I) { + // If this is a fixed sized alloca in the entry block of the function, + // allocate it statically on the stack. + if (FuncInfo.StaticAllocaMap.count(&I)) + return; // getValue will auto-populate this. + + const Type *Ty = I.getAllocatedType(); + uint64_t TySize = TLI.getTargetData().getTypeSize(Ty); + unsigned Align = TLI.getTargetData().getTypeAlignment(Ty); + + SDOperand AllocSize = getValue(I.getArraySize()); + + assert(AllocSize.getValueType() == TLI.getPointerTy() && + "FIXME: should extend or truncate to pointer size!"); + + AllocSize = DAG.getNode(ISD::MUL, TLI.getPointerTy(), AllocSize, + getIntPtrConstant(TySize)); + + // Handle alignment. If the requested alignment is less than or equal to the + // stack alignment, ignore it and round the size of the allocation up to the + // stack alignment size. If the size is greater than the stack alignment, we + // note this in the DYNAMIC_STACKALLOC node. + unsigned StackAlign = + TLI.getTargetMachine().getFrameInfo()->getStackAlignment(); + if (Align <= StackAlign) { + Align = 0; + // Add SA-1 to the size. + AllocSize = DAG.getNode(ISD::ADD, AllocSize.getValueType(), AllocSize, + getIntPtrConstant(StackAlign-1)); + // Mask out the low bits for alignment purposes. + AllocSize = DAG.getNode(ISD::AND, AllocSize.getValueType(), AllocSize, + getIntPtrConstant(~(uint64_t)(StackAlign-1))); + } + + SDOperand DSA = DAG.getNode(ISD::DYNAMIC_STACKALLOC, AllocSize.getValueType(), + DAG.getRoot(), AllocSize, + getIntPtrConstant(Align)); + DAG.setRoot(setValue(&I, DSA).getValue(1)); + + // Inform the Frame Information that we have just allocated a variable-sized + // object. + CurMBB->getParent()->getFrameInfo()->CreateVariableSizedObject(); + } + + + void SelectionDAGLowering::visitLoad(LoadInst &I) { + SDOperand Ptr = getValue(I.getOperand(0)); + SDOperand L = DAG.getLoad(TLI.getValueType(I.getType()), DAG.getRoot(), Ptr); + DAG.setRoot(setValue(&I, L).getValue(1)); + } + + + void SelectionDAGLowering::visitStore(StoreInst &I) { + Value *SrcV = I.getOperand(0); + SDOperand Src = getValue(SrcV); + SDOperand Ptr = getValue(I.getOperand(1)); + DAG.setRoot(DAG.getNode(ISD::STORE, MVT::Other, DAG.getRoot(), Src, Ptr)); + return; + } + + void SelectionDAGLowering::visitCall(CallInst &I) { + if (Function *F = I.getCalledFunction()) + switch (F->getIntrinsicID()) { + case 0: break; // Not an intrinsic. + case Intrinsic::vastart: visitVAStart(I); return; + case Intrinsic::vaend: visitVAEnd(I); return; + case Intrinsic::vacopy: visitVACopy(I); return; + case Intrinsic::returnaddress: + visitReturnAddress(I); return; + case Intrinsic::frameaddress: + visitFrameAddress(I); return; + default: + // FIXME: IMPLEMENT THESE. + // readport, writeport, readio, writeio + assert(0 && "This intrinsic is not implemented yet!"); + return; + case Intrinsic::memcpy: visitMemCpy(I); return; + case Intrinsic::memset: visitMemSet(I); return; + case Intrinsic::memmove: visitMemMove(I); return; + + case Intrinsic::isunordered: + setValue(&I, DAG.getSetCC(ISD::SETUO, getValue(I.getOperand(1)), + getValue(I.getOperand(2)))); + return; + } + + SDOperand Callee = getValue(I.getOperand(0)); + std::vector > Args; + + for (unsigned i = 1, e = I.getNumOperands(); i != e; ++i) { + Value *Arg = I.getOperand(i); + SDOperand ArgNode = getValue(Arg); + Args.push_back(std::make_pair(ArgNode, Arg->getType())); + } + + SDNode *Result = TLI.LowerCallTo(I.getType(), Callee, Args, DAG); + if (I.getType() != Type::VoidTy) + setValue(&I, SDOperand(Result, 0)); + } + + void SelectionDAGLowering::visitMalloc(MallocInst &I) { + SDOperand Src = getValue(I.getOperand(0)); + + MVT::ValueType IntPtr = TLI.getPointerTy(); + // FIXME: Extend or truncate to the intptr size. + assert(Src.getValueType() == IntPtr && "Need to adjust the amount!"); + + // Scale the source by the type size. + uint64_t ElementSize = TD.getTypeSize(I.getType()->getElementType()); + Src = DAG.getNode(ISD::MUL, Src.getValueType(), + Src, getIntPtrConstant(ElementSize)); + + std::vector > Args; + Args.push_back(std::make_pair(Src, TLI.getTargetData().getIntPtrType())); + SDNode *C = TLI.LowerCallTo(I.getType(), + DAG.getExternalSymbol("malloc", IntPtr), + Args, DAG); + setValue(&I, SDOperand(C, 0)); // Pointers always fit in registers + } + + void SelectionDAGLowering::visitFree(FreeInst &I) { + std::vector > Args; + Args.push_back(std::make_pair(getValue(I.getOperand(0)), + TLI.getTargetData().getIntPtrType())); + MVT::ValueType IntPtr = TLI.getPointerTy(); + TLI.LowerCallTo(Type::VoidTy, DAG.getExternalSymbol("free", IntPtr), + Args, DAG); + } + + void SelectionDAGLowering::visitVAStart(CallInst &I) { + // We have no sane default behavior, just emit a useful error message and bail + // out. + std::cerr << "Variable arguments support not implemented for this target!\n"; + abort(); + } + + void SelectionDAGLowering::visitVANext(VANextInst &I) { + // We have no sane default behavior, just emit a useful error message and bail + // out. + std::cerr << "Variable arguments support not implemented for this target!\n"; + abort(); + } + void SelectionDAGLowering::visitVAArg(VAArgInst &I) { + // We have no sane default behavior, just emit a useful error message and bail + // out. + std::cerr << "Variable arguments support not implemented for this target!\n"; + abort(); + } + + void SelectionDAGLowering::visitVAEnd(CallInst &I) { + // By default, this is a noop. On almost all targets, this is fine. + } + + void SelectionDAGLowering::visitVACopy(CallInst &I) { + // By default, vacopy just does a simple pointer copy. + setValue(&I, getValue(I.getOperand(1))); + } + + void SelectionDAGLowering::visitReturnAddress(CallInst &I) { + // It is always conservatively correct for llvm.returnaddress to return 0. + setValue(&I, getIntPtrConstant(0)); + } + + void SelectionDAGLowering::visitFrameAddress(CallInst &I) { + // It is always conservatively correct for llvm.frameaddress to return 0. + setValue(&I, getIntPtrConstant(0)); + } + + + void SelectionDAGLowering::visitMemSet(CallInst &I) { + MVT::ValueType IntPtr = TLI.getPointerTy(); + const Type *IntPtrTy = TLI.getTargetData().getIntPtrType(); + + // Extend the ubyte argument to be an int value for the call. + SDOperand Val = getValue(I.getOperand(2)); + Val = DAG.getNode(ISD::ZERO_EXTEND, MVT::i32, Val); + + std::vector > Args; + Args.push_back(std::make_pair(getValue(I.getOperand(1)), IntPtrTy)); + Args.push_back(std::make_pair(Val, Type::IntTy)); + Args.push_back(std::make_pair(getValue(I.getOperand(3)), IntPtrTy)); + + TLI.LowerCallTo(Type::VoidTy, DAG.getExternalSymbol("memset", IntPtr), + Args, DAG); + } + + void SelectionDAGLowering::visitMemCpy(CallInst &I) { + MVT::ValueType IntPtr = TLI.getPointerTy(); + const Type *IntPtrTy = TLI.getTargetData().getIntPtrType(); + + std::vector > Args; + Args.push_back(std::make_pair(getValue(I.getOperand(1)), IntPtrTy)); + Args.push_back(std::make_pair(getValue(I.getOperand(2)), IntPtrTy)); + Args.push_back(std::make_pair(getValue(I.getOperand(3)), IntPtrTy)); + + TLI.LowerCallTo(Type::VoidTy, DAG.getExternalSymbol("memcpy", IntPtr), + Args, DAG); + } + + void SelectionDAGLowering::visitMemMove(CallInst &I) { + MVT::ValueType IntPtr = TLI.getPointerTy(); + const Type *IntPtrTy = TLI.getTargetData().getIntPtrType(); + + std::vector > Args; + Args.push_back(std::make_pair(getValue(I.getOperand(1)), IntPtrTy)); + Args.push_back(std::make_pair(getValue(I.getOperand(2)), IntPtrTy)); + Args.push_back(std::make_pair(getValue(I.getOperand(3)), IntPtrTy)); + + TLI.LowerCallTo(Type::VoidTy, DAG.getExternalSymbol("memmove", IntPtr), + Args, DAG); + } + + unsigned SelectionDAGISel::MakeReg(MVT::ValueType VT) { + return RegMap->createVirtualRegister(TLI.getRegClassFor(VT)); + } + + + + bool SelectionDAGISel::runOnFunction(Function &Fn) { + MachineFunction &MF = MachineFunction::construct(&Fn, TLI.getTargetMachine()); + RegMap = MF.getSSARegMap(); + DEBUG(std::cerr << "\n\n\n=== " << Fn.getName() << "\n"); + + FunctionLoweringInfo FuncInfo(TLI, Fn, MF); + + for (Function::iterator I = Fn.begin(), E = Fn.end(); I != E; ++I) + SelectBasicBlock(I, MF, FuncInfo); + + return true; + } + + + void SelectionDAGISel::CopyValueToVirtualRegister(SelectionDAGLowering &SDL, + Value *V, unsigned Reg) { + SelectionDAG &DAG = SDL.DAG; + DAG.setRoot(DAG.getCopyToReg(DAG.getRoot(), SDL.getValue(V), Reg)); + } + + void SelectionDAGISel::BuildSelectionDAG(SelectionDAG &DAG, BasicBlock *LLVMBB, + std::vector > &PHINodesToUpdate, + FunctionLoweringInfo &FuncInfo) { + SelectionDAGLowering SDL(DAG, TLI, FuncInfo); + + // If this is the entry block, emit arguments. + Function *F = LLVMBB->getParent(); + if (LLVMBB == &F->front()) { + // FIXME: If an argument is only used in one basic block, we could directly + // emit it (ONLY) into that block, not emitting the COPY_TO_VREG node. This + // would improve codegen in several cases on X86 by allowing the loads to be + // folded into the user operation. + std::vector Args = TLI.LowerArguments(*LLVMBB->getParent(), DAG); + + unsigned a = 0; + for (Function::aiterator AI = F->abegin(), E = F->aend(); AI != E; ++AI,++a) + if (!AI->use_empty()) { + SDL.setValue(AI, Args[a]); + CopyValueToVirtualRegister(SDL, AI, FuncInfo.ValueMap[AI]); + } + } + + BB = FuncInfo.MBBMap[LLVMBB]; + SDL.setCurrentBasicBlock(BB); + + // Lower all of the non-terminator instructions. + for (BasicBlock::iterator I = LLVMBB->begin(), E = --LLVMBB->end(); + I != E; ++I) + SDL.visit(*I); + + // Ensure that all instructions which are used outside of their defining + // blocks are available as virtual registers. + for (BasicBlock::iterator I = LLVMBB->begin(), E = LLVMBB->end(); I != E;++I) + if (!I->use_empty()) { + std::map::iterator VMI = + FuncInfo.ValueMap.find(I); + if (VMI != FuncInfo.ValueMap.end()) + CopyValueToVirtualRegister(SDL, I, VMI->second); + } + + // Handle PHI nodes in successor blocks. Emit code into the SelectionDAG to + // ensure constants are generated when needed. Remember the virtual registers + // that need to be added to the Machine PHI nodes as input. We cannot just + // directly add them, because expansion might result in multiple MBB's for one + // BB. As such, the start of the BB might correspond to a different MBB than + // the end. + // + + // Emit constants only once even if used by multiple PHI nodes. + std::map ConstantsOut; + + // Check successor nodes PHI nodes that expect a constant to be available from + // this block. + TerminatorInst *TI = LLVMBB->getTerminator(); + for (unsigned succ = 0, e = TI->getNumSuccessors(); succ != e; ++succ) { + BasicBlock *SuccBB = TI->getSuccessor(succ); + MachineBasicBlock::iterator MBBI = FuncInfo.MBBMap[SuccBB]->begin(); + PHINode *PN; + + // At this point we know that there is a 1-1 correspondence between LLVM PHI + // nodes and Machine PHI nodes, but the incoming operands have not been + // emitted yet. + for (BasicBlock::iterator I = SuccBB->begin(); + (PN = dyn_cast(I)); ++I) { + unsigned Reg; + Value *PHIOp = PN->getIncomingValueForBlock(LLVMBB); + if (Constant *C = dyn_cast(PHIOp)) { + unsigned &RegOut = ConstantsOut[C]; + if (RegOut == 0) { + RegOut = FuncInfo.CreateRegForValue(C); + CopyValueToVirtualRegister(SDL, C, RegOut); + } + Reg = RegOut; + } else { + Reg = FuncInfo.ValueMap[PHIOp]; + assert(Reg && "Didn't codegen value into a register!??"); + } + + // Remember that this register needs to added to the machine PHI node as + // the input for this MBB. + unsigned NumElements =TLI.getNumElements(TLI.getValueType(PN->getType())); + for (unsigned i = 0, e = NumElements; i != e; ++i) + PHINodesToUpdate.push_back(std::make_pair(MBBI++, Reg+i)); + } + } + ConstantsOut.clear(); + + // Lower the terminator after the copies are emitted. + SDL.visit(*LLVMBB->getTerminator()); + } + + void SelectionDAGISel::SelectBasicBlock(BasicBlock *LLVMBB, MachineFunction &MF, + FunctionLoweringInfo &FuncInfo) { + SelectionDAG DAG(TLI.getTargetMachine(), MF); + CurDAG = &DAG; + std::vector > PHINodesToUpdate; + + // First step, lower LLVM code to some DAG. This DAG may use operations and + // types that are not supported by the target. + BuildSelectionDAG(DAG, LLVMBB, PHINodesToUpdate, FuncInfo); + + DEBUG(std::cerr << "Lowered selection DAG:\n"); + DEBUG(DAG.dump()); + + // Second step, hack on the DAG until it only uses operations and types that + // the target supports. + DAG.Legalize(TLI); + + DEBUG(std::cerr << "Legalized selection DAG:\n"); + DEBUG(DAG.dump()); + + // Finally, instruction select all of the operations to machine code, adding + // the code to the MachineBasicBlock. + InstructionSelectBasicBlock(DAG); + + DEBUG(std::cerr << "Selected machine code:\n"); + DEBUG(BB->dump()); + + // Finally, now that we know what the last MBB the LLVM BB expanded is, update + // PHI nodes in successors. + for (unsigned i = 0, e = PHINodesToUpdate.size(); i != e; ++i) { + MachineInstr *PHI = PHINodesToUpdate[i].first; + assert(PHI->getOpcode() == TargetInstrInfo::PHI && + "This is not a machine PHI node that we are updating!"); + PHI->addRegOperand(PHINodesToUpdate[i].second); + PHI->addMachineBasicBlockOperand(BB); + } + } From lattner at cs.uiuc.edu Fri Jan 7 01:48:22 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jan 2005 01:48:22 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200501070748.j077mM8D032560@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp added (r1.1) --- Log message: Initial implementation of the DAG legalization. This still has a long way to go, but it does work for some non-trivial cases now. --- Diffs of the changes: (+703 -0) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -c /dev/null llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.1 *** /dev/null Fri Jan 7 01:48:20 2005 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Fri Jan 7 01:47:09 2005 *************** *** 0 **** --- 1,703 ---- + //===-- LegalizeDAG.cpp - Implement SelectionDAG::Legalize ----------------===// + // + // 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 the SelectionDAG::Legalize method. + // + //===----------------------------------------------------------------------===// + + #include "llvm/CodeGen/SelectionDAG.h" + #include "llvm/CodeGen/MachineConstantPool.h" + #include "llvm/CodeGen/MachineFunction.h" + #include "llvm/Target/TargetLowering.h" + #include "llvm/Constants.h" + #include + using namespace llvm; + + //===----------------------------------------------------------------------===// + /// SelectionDAGLegalize - This takes an arbitrary SelectionDAG as input and + /// hacks on it until the target machine can handle it. This involves + /// eliminating value sizes the machine cannot handle (promoting small sizes to + /// large sizes or splitting up large values into small values) as well as + /// eliminating operations the machine cannot handle. + /// + /// This code also does a small amount of optimization and recognition of idioms + /// as part of its processing. For example, if a target does not support a + /// 'setcc' instruction efficiently, but does support 'brcc' instruction, this + /// will attempt merge setcc and brc instructions into brcc's. + /// + namespace { + class SelectionDAGLegalize { + TargetLowering &TLI; + SelectionDAG &DAG; + + /// LegalizeAction - This enum indicates what action we should take for each + /// value type the can occur in the program. + enum LegalizeAction { + Legal, // The target natively supports this value type. + Promote, // This should be promoted to the next larger type. + Expand, // This integer type should be broken into smaller pieces. + }; + + /// TransformToType - For any value types we are promoting or expanding, this + /// contains the value type that we are changing to. For Expanded types, this + /// contains one step of the expand (e.g. i64 -> i32), even if there are + /// multiple steps required (e.g. i64 -> i16) + MVT::ValueType TransformToType[MVT::LAST_VALUETYPE]; + + /// ValueTypeActions - This is a bitvector that contains two bits for each + /// value type, where the two bits correspond to the LegalizeAction enum. + /// This can be queried with "getTypeAction(VT)". + unsigned ValueTypeActions; + + /// NeedsAnotherIteration - This is set when we expand a large integer + /// operation into smaller integer operations, but the smaller operations are + /// not set. This occurs only rarely in practice, for targets that don't have + /// 32-bit or larger integer registers. + bool NeedsAnotherIteration; + + /// LegalizedNodes - For nodes that are of legal width, and that have more + /// than one use, this map indicates what regularized operand to use. This + /// allows us to avoid legalizing the same thing more than once. + std::map LegalizedNodes; + + /// ExpandedNodes - For nodes that need to be expanded, and which have more + /// than one use, this map indicates which which operands are the expanded + /// version of the input. This allows us to avoid expanding the same node + /// more than once. + std::map > ExpandedNodes; + + /// setValueTypeAction - Set the action for a particular value type. This + /// assumes an action has not already been set for this value type. + void setValueTypeAction(MVT::ValueType VT, LegalizeAction A) { + ValueTypeActions |= A << (VT*2); + if (A == Promote) { + MVT::ValueType PromoteTo; + if (VT == MVT::f32) + PromoteTo = MVT::f64; + else { + unsigned LargerReg = VT+1; + while (!TLI.hasNativeSupportFor((MVT::ValueType)LargerReg)) { + ++LargerReg; + assert(MVT::isInteger((MVT::ValueType)LargerReg) && + "Nothing to promote to??"); + } + PromoteTo = (MVT::ValueType)LargerReg; + } + + assert(MVT::isInteger(VT) == MVT::isInteger(PromoteTo) && + MVT::isFloatingPoint(VT) == MVT::isFloatingPoint(PromoteTo) && + "Can only promote from int->int or fp->fp!"); + assert(VT < PromoteTo && "Must promote to a larger type!"); + TransformToType[VT] = PromoteTo; + } else if (A == Expand) { + assert(MVT::isInteger(VT) && VT > MVT::i8 && + "Cannot expand this type: target must support SOME integer reg!"); + // Expand to the next smaller integer type! + TransformToType[VT] = (MVT::ValueType)(VT-1); + } + } + + public: + + SelectionDAGLegalize(TargetLowering &TLI, SelectionDAG &DAG); + + /// Run - While there is still lowering to do, perform a pass over the DAG. + /// Most regularization can be done in a single pass, but targets that require + /// large values to be split into registers multiple times (e.g. i64 -> 4x + /// i16) require iteration for these values (the first iteration will demote + /// to i32, the second will demote to i16). + void Run() { + do { + NeedsAnotherIteration = false; + LegalizeDAG(); + } while (NeedsAnotherIteration); + } + + /// getTypeAction - Return how we should legalize values of this type, either + /// it is already legal or we need to expand it into multiple registers of + /// smaller integer type, or we need to promote it to a larger type. + LegalizeAction getTypeAction(MVT::ValueType VT) const { + return (LegalizeAction)((ValueTypeActions >> (2*VT)) & 3); + } + + /// isTypeLegal - Return true if this type is legal on this target. + /// + bool isTypeLegal(MVT::ValueType VT) const { + return getTypeAction(VT) == Legal; + } + + private: + void LegalizeDAG(); + + SDOperand LegalizeOp(SDOperand O); + void ExpandOp(SDOperand O, SDOperand &Lo, SDOperand &Hi); + + SDOperand getIntPtrConstant(uint64_t Val) { + return DAG.getConstant(Val, TLI.getPointerTy()); + } + }; + } + + + SelectionDAGLegalize::SelectionDAGLegalize(TargetLowering &tli, + SelectionDAG &dag) + : TLI(tli), DAG(dag), ValueTypeActions(0) { + + assert(MVT::LAST_VALUETYPE <= 16 && + "Too many value types for ValueTypeActions to hold!"); + + // Inspect all of the ValueType's possible, deciding how to process them. + for (unsigned IntReg = MVT::i1; IntReg <= MVT::i128; ++IntReg) + // If TLI says we are expanding this type, expand it! + if (TLI.getNumElements((MVT::ValueType)IntReg) != 1) + setValueTypeAction((MVT::ValueType)IntReg, Expand); + else if (!TLI.hasNativeSupportFor((MVT::ValueType)IntReg)) + // Otherwise, if we don't have native support, we must promote to a + // larger type. + setValueTypeAction((MVT::ValueType)IntReg, Promote); + + // If the target does not have native support for F32, promote it to F64. + if (!TLI.hasNativeSupportFor(MVT::f32)) + setValueTypeAction(MVT::f32, Promote); + } + + + void SelectionDAGLegalize::LegalizeDAG() { + SDOperand OldRoot = DAG.getRoot(); + SDOperand NewRoot = LegalizeOp(OldRoot); + DAG.setRoot(NewRoot); + + ExpandedNodes.clear(); + LegalizedNodes.clear(); + + // Remove dead nodes now. + if (OldRoot != NewRoot) + // Delete all of these efficiently first. + ; + + // Then scan AllNodes. + } + + SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) { + // If this operation defines any values that cannot be represented in a + // register on this target, make sure to expand it. + if (Op.Val->getNumValues() == 1) {// Fast path == assertion only + assert(getTypeAction(Op.Val->getValueType(0)) == Legal && + "For a single use value, caller should check for legality!"); + } else { + for (unsigned i = 0, e = Op.Val->getNumValues(); i != e; ++i) + switch (getTypeAction(Op.Val->getValueType(i))) { + case Legal: break; // Nothing to do. + case Expand: { + SDOperand T1, T2; + ExpandOp(Op.getValue(i), T1, T2); + assert(LegalizedNodes.count(Op) && + "Expansion didn't add legal operands!"); + return LegalizedNodes[Op]; + } + case Promote: + // FIXME: Implement promotion! + assert(0 && "Promotion not implemented at all yet!"); + } + } + + // If there is more than one use of this, see if we already legalized it. + // There is no use remembering values that only have a single use, as the map + // entries will never be reused. + if (!Op.Val->hasOneUse()) { + std::map::iterator I = LegalizedNodes.find(Op); + if (I != LegalizedNodes.end()) return I->second; + } + + SDOperand Tmp1, Tmp2; + + SDOperand Result = Op; + SDNode *Node = Op.Val; + LegalizeAction Action; + + switch (Node->getOpcode()) { + default: + std::cerr << "NODE: "; Node->dump(); std::cerr << "\n"; + assert(0 && "Do not know how to legalize this operator!"); + abort(); + case ISD::EntryToken: + case ISD::FrameIndex: + case ISD::GlobalAddress: + case ISD::ConstantPool: + case ISD::CopyFromReg: // Nothing to do. + assert(getTypeAction(Node->getValueType(0)) == Legal && + "This must be legal!"); + break; + case ISD::Constant: + // We know we don't need to expand constants here, constants only have one + // value and we check that it is fine above. + + // FIXME: Maybe we should handle things like targets that don't support full + // 32-bit immediates? + break; + case ISD::ConstantFP: { + // Spill FP immediates to the constant pool if the target cannot directly + // codegen them. Targets often have some immediate values that can be + // efficiently generated into an FP register without a load. We explicitly + // leave these constants as ConstantFP nodes for the target to deal with. + + ConstantFPSDNode *CFP = cast(Node); + + // Check to see if this FP immediate is already legal. + bool isLegal = false; + for (TargetLowering::legal_fpimm_iterator I = TLI.legal_fpimm_begin(), + E = TLI.legal_fpimm_end(); I != E; ++I) + if (CFP->isExactlyValue(*I)) { + isLegal = true; + break; + } + + if (!isLegal) { + // Otherwise we need to spill the constant to memory. + MachineConstantPool *CP = DAG.getMachineFunction().getConstantPool(); + + bool Extend = false; + + // If a FP immediate is precise when represented as a float, we put it + // into the constant pool as a float, even if it's is statically typed + // as a double. + MVT::ValueType VT = CFP->getValueType(0); + bool isDouble = VT == MVT::f64; + ConstantFP *LLVMC = ConstantFP::get(isDouble ? Type::DoubleTy : + Type::FloatTy, CFP->getValue()); + if (isDouble && CFP->isExactlyValue((float)CFP->getValue())) { + LLVMC = cast(ConstantExpr::getCast(LLVMC, Type::FloatTy)); + VT = MVT::f32; + Extend = true; + } + + SDOperand CPIdx = DAG.getConstantPool(CP->getConstantPoolIndex(LLVMC), + TLI.getPointerTy()); + Result = DAG.getLoad(VT, DAG.getEntryNode(), CPIdx); + + if (Extend) Result = DAG.getNode(ISD::FP_EXTEND, MVT::f64, Result); + } + break; + } + case ISD::ADJCALLSTACKDOWN: + case ISD::ADJCALLSTACKUP: + Tmp1 = LegalizeOp(Node->getOperand(0)); // Legalize the chain. + // There is no need to legalize the size argument (Operand #1) + if (Tmp1 != Node->getOperand(0)) + Result = DAG.getNode(Node->getOpcode(), MVT::Other, Tmp1, + Node->getOperand(1)); + break; + case ISD::CALL: + Tmp1 = LegalizeOp(Node->getOperand(0)); // Legalize the chain. + Tmp2 = LegalizeOp(Node->getOperand(1)); // Legalize the callee. + if (Tmp2 != Node->getOperand(0) || Tmp2 != Node->getOperand(1)) { + std::vector RetTyVTs; + RetTyVTs.reserve(Node->getNumValues()); + for (unsigned i = 0, e = Node->getNumValues(); i != e; ++i) + RetTyVTs.push_back(Node->getValueType(0)); + Result = SDOperand(DAG.getCall(RetTyVTs, Tmp1, Tmp2), Op.ResNo); + } + break; + + case ISD::LOAD: + Tmp1 = LegalizeOp(Node->getOperand(0)); // Legalize the chain. + Tmp2 = LegalizeOp(Node->getOperand(1)); // Legalize the pointer. + if (Tmp1 != Node->getOperand(0) || + Tmp2 != Node->getOperand(1)) + Result = DAG.getLoad(Node->getValueType(0), Tmp1, Tmp2); + break; + + case ISD::EXTRACT_ELEMENT: + // Get both the low and high parts. + ExpandOp(Node->getOperand(0), Tmp1, Tmp2); + if (cast(Node->getOperand(1))->getValue()) + Result = Tmp2; // 1 -> Hi + else + Result = Tmp1; // 0 -> Lo + break; + + case ISD::CopyToReg: + Tmp1 = LegalizeOp(Node->getOperand(0)); // Legalize the chain. + + switch (getTypeAction(Node->getOperand(1).getValueType())) { + case Legal: + // Legalize the incoming value (must be legal). + Tmp2 = LegalizeOp(Node->getOperand(1)); + if (Tmp1 != Node->getOperand(0) || Tmp2 != Node->getOperand(1)) + Result = DAG.getCopyToReg(Tmp1, Tmp2, + cast(Node)->getReg()); + break; + case Expand: { + SDOperand Lo, Hi; + ExpandOp(Node->getOperand(1), Lo, Hi); + unsigned Reg = cast(Node)->getReg(); + Result = DAG.getCopyToReg(Tmp1, Lo, Reg); + Result = DAG.getCopyToReg(Result, Hi, Reg+1); + assert(isTypeLegal(Result.getValueType()) && + "Cannot expand multiple times yet (i64 -> i16)"); + break; + } + case Promote: + assert(0 && "Don't know what it means to promote this!"); + abort(); + } + break; + + case ISD::RET: + Tmp1 = LegalizeOp(Node->getOperand(0)); // Legalize the chain. + switch (Node->getNumOperands()) { + case 2: // ret val + switch (getTypeAction(Node->getOperand(1).getValueType())) { + case Legal: + Tmp2 = LegalizeOp(Node->getOperand(1)); + if (Tmp2 != Node->getOperand(1)) + Result = DAG.getNode(ISD::RET, MVT::Other, Tmp1, Tmp2); + break; + case Expand: { + SDOperand Lo, Hi; + ExpandOp(Node->getOperand(1), Lo, Hi); + Result = DAG.getNode(ISD::RET, MVT::Other, Tmp1, Lo, Hi); + break; + } + case Promote: + assert(0 && "Can't promote return value!"); + } + break; + case 1: // ret void + if (Tmp1 != Node->getOperand(0)) + Result = DAG.getNode(ISD::RET, MVT::Other, Tmp1); + break; + default: { // ret + std::vector NewValues; + NewValues.push_back(Tmp1); + for (unsigned i = 1, e = Node->getNumOperands(); i != e; ++i) + switch (getTypeAction(Node->getOperand(i).getValueType())) { + case Legal: + NewValues.push_back(LegalizeOp(Node->getOperand(1))); + break; + case Expand: { + SDOperand Lo, Hi; + ExpandOp(Node->getOperand(i), Lo, Hi); + NewValues.push_back(Lo); + NewValues.push_back(Hi); + break; + } + case Promote: + assert(0 && "Can't promote return value!"); + } + Result = DAG.getNode(ISD::RET, MVT::Other, NewValues); + break; + } + } + break; + case ISD::STORE: + Tmp1 = LegalizeOp(Node->getOperand(0)); // Legalize the chain. + Tmp2 = LegalizeOp(Node->getOperand(2)); // Legalize the pointer. + + switch (getTypeAction(Node->getOperand(1).getValueType())) { + case Legal: { + SDOperand Val = LegalizeOp(Node->getOperand(1)); + if (Val != Node->getOperand(1) || Tmp1 != Node->getOperand(0) || + Tmp2 != Node->getOperand(2)) + Result = DAG.getNode(ISD::STORE, MVT::Other, Tmp1, Val, Tmp2); + break; + } + case Promote: + assert(0 && "FIXME: promote for stores not implemented!"); + case Expand: + SDOperand Lo, Hi; + ExpandOp(Node->getOperand(1), Lo, Hi); + + if (!TLI.isLittleEndian()) + std::swap(Lo, Hi); + + // FIXME: These two stores are independent of each other! + Result = DAG.getNode(ISD::STORE, MVT::Other, Tmp1, Lo, Tmp2); + + unsigned IncrementSize; + switch (Lo.getValueType()) { + default: assert(0 && "Unknown ValueType to expand to!"); + case MVT::i32: IncrementSize = 4; break; + case MVT::i16: IncrementSize = 2; break; + case MVT::i8: IncrementSize = 1; break; + } + Tmp2 = DAG.getNode(ISD::ADD, Tmp2.getValueType(), Tmp2, + getIntPtrConstant(IncrementSize)); + assert(isTypeLegal(Tmp2.getValueType()) && + "Pointers must be legal!"); + Result = DAG.getNode(ISD::STORE, MVT::Other, Result, Hi, Tmp2); + } + break; + case ISD::SELECT: { + // FIXME: BOOLS MAY REQUIRE PROMOTION! + Tmp1 = LegalizeOp(Node->getOperand(0)); // Cond + Tmp2 = LegalizeOp(Node->getOperand(1)); // TrueVal + SDOperand Tmp3 = LegalizeOp(Node->getOperand(2)); // FalseVal + + if (Tmp1 != Node->getOperand(0) || + Tmp2 != Node->getOperand(1) || + Tmp3 != Node->getOperand(2)) + Result = DAG.getNode(ISD::SELECT, Node->getValueType(0), Tmp1, Tmp2,Tmp3); + break; + } + case ISD::SETCC: + switch (getTypeAction(Node->getOperand(0).getValueType())) { + case Legal: + Tmp1 = LegalizeOp(Node->getOperand(0)); // LHS + Tmp2 = LegalizeOp(Node->getOperand(1)); // RHS + if (Tmp1 != Node->getOperand(0) || Tmp2 != Node->getOperand(1)) + Result = DAG.getSetCC(cast(Node)->getCondition(), + Tmp1, Tmp2); + break; + case Promote: + assert(0 && "Can't promote setcc operands yet!"); + break; + case Expand: + SDOperand LHSLo, LHSHi, RHSLo, RHSHi; + ExpandOp(Node->getOperand(0), LHSLo, LHSHi); + ExpandOp(Node->getOperand(1), RHSLo, RHSHi); + switch (cast(Node)->getCondition()) { + case ISD::SETEQ: + case ISD::SETNE: + Tmp1 = DAG.getNode(ISD::XOR, LHSLo.getValueType(), LHSLo, RHSLo); + Tmp2 = DAG.getNode(ISD::XOR, LHSLo.getValueType(), LHSHi, RHSHi); + Tmp1 = DAG.getNode(ISD::OR, Tmp1.getValueType(), Tmp1, Tmp2); + Result = DAG.getSetCC(cast(Node)->getCondition(), Tmp1, + DAG.getConstant(0, Tmp1.getValueType())); + break; + default: + // FIXME: This generated code sucks. + ISD::CondCode LowCC; + switch (cast(Node)->getCondition()) { + default: assert(0 && "Unknown integer setcc!"); + case ISD::SETLT: + case ISD::SETULT: LowCC = ISD::SETULT; break; + case ISD::SETGT: + case ISD::SETUGT: LowCC = ISD::SETUGT; break; + case ISD::SETLE: + case ISD::SETULE: LowCC = ISD::SETULE; break; + case ISD::SETGE: + case ISD::SETUGE: LowCC = ISD::SETUGE; break; + } + + // Tmp1 = lo(op1) < lo(op2) // Always unsigned comparison + // Tmp2 = hi(op1) < hi(op2) // Signedness depends on operands + // dest = hi(op1) == hi(op2) ? Tmp1 : Tmp2; + + // NOTE: on targets without efficient SELECT of bools, we can always use + // this identity: (B1 ? B2 : B3) --> (B1 & B2)|(!B1&B3) + Tmp1 = DAG.getSetCC(LowCC, LHSLo, RHSLo); + Tmp2 = DAG.getSetCC(cast(Node)->getCondition(), + LHSHi, RHSHi); + Result = DAG.getSetCC(ISD::SETEQ, LHSHi, RHSHi); + Result = DAG.getNode(ISD::SELECT, MVT::i1, Result, Tmp1, Tmp2); + break; + } + } + break; + + case ISD::ADD: + case ISD::SUB: + case ISD::MUL: + case ISD::UDIV: + case ISD::SDIV: + case ISD::UREM: + case ISD::SREM: + case ISD::AND: + case ISD::OR: + case ISD::XOR: + Tmp1 = LegalizeOp(Node->getOperand(0)); // LHS + Tmp2 = LegalizeOp(Node->getOperand(1)); // RHS + if (Tmp1 != Node->getOperand(0) || + Tmp2 != Node->getOperand(1)) + Result = DAG.getNode(Node->getOpcode(), Node->getValueType(0), Tmp1,Tmp2); + break; + case ISD::ZERO_EXTEND: + case ISD::SIGN_EXTEND: + switch (getTypeAction(Node->getOperand(0).getValueType())) { + case Legal: + Tmp1 = LegalizeOp(Node->getOperand(0)); + if (Tmp1 != Node->getOperand(0)) + Result = DAG.getNode(Node->getOpcode(), Node->getValueType(0), Tmp1); + break; + default: + assert(0 && "Do not know how to expand or promote this yet!"); + } + break; + } + + if (!Op.Val->hasOneUse()) { + bool isNew = LegalizedNodes.insert(std::make_pair(Op, Result)).second; + assert(isNew && "Got into the map somehow?"); + } + + return Result; + } + + + /// ExpandOp - Expand the specified SDOperand into its two component pieces + /// Lo&Hi. Note that the Op MUST be an expanded type. As a result of this, the + /// LegalizeNodes map is filled in for any results that are not expanded, the + /// ExpandedNodes map is filled in for any results that are expanded, and the + /// Lo/Hi values are returned. + void SelectionDAGLegalize::ExpandOp(SDOperand Op, SDOperand &Lo, SDOperand &Hi){ + MVT::ValueType VT = Op.getValueType(); + MVT::ValueType NVT = TransformToType[VT]; + SDNode *Node = Op.Val; + assert(getTypeAction(VT) == Expand && "Not an expanded type!"); + assert(MVT::isInteger(VT) && "Cannot expand FP values!"); + assert(MVT::isInteger(NVT) && NVT < VT && + "Cannot expand to FP value or to larger int value!"); + + // If there is more than one use of this, see if we already expanded it. + // There is no use remembering values that only have a single use, as the map + // entries will never be reused. + if (!Node->hasOneUse()) { + std::map >::iterator I + = ExpandedNodes.find(Op); + if (I != ExpandedNodes.end()) { + Lo = I->second.first; + Hi = I->second.second; + return; + } + } + + // If we are lowering to a type that the target doesn't support, we will have + // to iterate lowering. + if (!isTypeLegal(NVT)) + NeedsAnotherIteration = true; + + LegalizeAction Action; + switch (Node->getOpcode()) { + default: + std::cerr << "NODE: "; Node->dump(); std::cerr << "\n"; + assert(0 && "Do not know how to expand this operator!"); + abort(); + case ISD::Constant: { + uint64_t Cst = cast(Node)->getValue(); + Lo = DAG.getConstant(Cst, NVT); + Hi = DAG.getConstant(Cst >> MVT::getSizeInBits(NVT), NVT); + break; + } + + case ISD::CopyFromReg: { + unsigned Reg = cast(Node)->getReg(); + // Aggregate register values are always in consequtive pairs. + Lo = DAG.getCopyFromReg(Reg, NVT); + Hi = DAG.getCopyFromReg(Reg+1, NVT); + assert(isTypeLegal(NVT) && "Cannot expand this multiple times yet!"); + break; + } + + case ISD::LOAD: { + SDOperand Ch = LegalizeOp(Node->getOperand(0)); // Legalize the chain. + SDOperand Ptr = LegalizeOp(Node->getOperand(1)); // Legalize the pointer. + Lo = DAG.getLoad(NVT, Ch, Ptr); + + // Increment the pointer to the other half. + unsigned IncrementSize; + switch (Lo.getValueType()) { + default: assert(0 && "Unknown ValueType to expand to!"); + case MVT::i32: IncrementSize = 4; break; + case MVT::i16: IncrementSize = 2; break; + case MVT::i8: IncrementSize = 1; break; + } + Ptr = DAG.getNode(ISD::ADD, Ptr.getValueType(), Ptr, + getIntPtrConstant(IncrementSize)); + // FIXME: This load is independent of the first one. + Hi = DAG.getLoad(NVT, Lo.getValue(1), Ptr); + + // Remember that we legalized the chain. + bool isNew = LegalizedNodes.insert(std::make_pair(Op.getValue(1), + Hi.getValue(1))).second; + assert(isNew && "This node was already legalized!"); + if (!TLI.isLittleEndian()) + std::swap(Lo, Hi); + break; + } + case ISD::CALL: { + SDOperand Chain = LegalizeOp(Node->getOperand(0)); // Legalize the chain. + SDOperand Callee = LegalizeOp(Node->getOperand(1)); // Legalize the callee. + + assert(Node->getNumValues() == 2 && Op.ResNo == 0 && + "Can only expand a call once so far, not i64 -> i16!"); + + std::vector RetTyVTs; + RetTyVTs.reserve(3); + RetTyVTs.push_back(NVT); + RetTyVTs.push_back(NVT); + RetTyVTs.push_back(MVT::Other); + SDNode *NC = DAG.getCall(RetTyVTs, Chain, Callee); + Lo = SDOperand(NC, 0); + Hi = SDOperand(NC, 1); + + // Insert the new chain mapping. + bool isNew = LegalizedNodes.insert(std::make_pair(Op.getValue(1), + Hi.getValue(2))).second; + assert(isNew && "This node was already legalized!"); + break; + } + case ISD::AND: + case ISD::OR: + case ISD::XOR: { // Simple logical operators -> two trivial pieces. + SDOperand LL, LH, RL, RH; + ExpandOp(Node->getOperand(0), LL, LH); + ExpandOp(Node->getOperand(1), RL, RH); + Lo = DAG.getNode(Node->getOpcode(), NVT, LL, RL); + Hi = DAG.getNode(Node->getOpcode(), NVT, LH, RH); + break; + } + case ISD::SELECT: { + SDOperand C, LL, LH, RL, RH; + // FIXME: BOOLS MAY REQUIRE PROMOTION! + C = LegalizeOp(Node->getOperand(0)); + ExpandOp(Node->getOperand(1), LL, LH); + ExpandOp(Node->getOperand(2), RL, RH); + Lo = DAG.getNode(ISD::SELECT, NVT, C, LL, RL); + Hi = DAG.getNode(ISD::SELECT, NVT, C, LH, RH); + break; + } + case ISD::SIGN_EXTEND: { + // The low part is just a sign extension of the input (which degenerates to + // a copy). + Lo = DAG.getNode(ISD::SIGN_EXTEND, NVT, LegalizeOp(Node->getOperand(0))); + + // The high part is obtained by SRA'ing all but one of the bits of the lo + // part. + unsigned SrcSize = MVT::getSizeInBits(Node->getOperand(0).getValueType()); + Hi = DAG.getNode(ISD::SRA, NVT, Lo, DAG.getConstant(SrcSize-1, MVT::i8)); + break; + } + case ISD::ZERO_EXTEND: + // The low part is just a zero extension of the input (which degenerates to + // a copy). + Lo = DAG.getNode(ISD::ZERO_EXTEND, NVT, LegalizeOp(Node->getOperand(0))); + + // The high part is just a zero. + Hi = DAG.getConstant(0, NVT); + break; + } + + // Remember in a map if the values will be reused later. + if (!Node->hasOneUse()) { + bool isNew = ExpandedNodes.insert(std::make_pair(Op, + std::make_pair(Lo, Hi))).second; + assert(isNew && "Value already expanded?!?"); + } + } + + + // SelectionDAG::Legalize - This is the entry point for the file. + // + void SelectionDAG::Legalize(TargetLowering &TLI) { + /// run - This is the main entry point to this class. + /// + SelectionDAGLegalize(TLI, *this).Run(); + } + From lattner at cs.uiuc.edu Fri Jan 7 01:48:45 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jan 2005 01:48:45 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86.h Message-ID: <200501070748.j077mjLk032572@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86.h updated: 1.29 -> 1.30 --- Log message: Add a new prototype --- Diffs of the changes: (+7 -2) Index: llvm/lib/Target/X86/X86.h diff -u llvm/lib/Target/X86/X86.h:1.29 llvm/lib/Target/X86/X86.h:1.30 --- llvm/lib/Target/X86/X86.h:1.29 Tue Aug 24 03:18:44 2004 +++ llvm/lib/Target/X86/X86.h Fri Jan 7 01:48:33 2005 @@ -35,6 +35,11 @@ /// FunctionPass *createX86SimpleInstructionSelector(TargetMachine &TM); +/// createX86PatternInstructionSelector - This pass converts an LLVM function +/// into a machine code representation in a more aggressive way. +/// +FunctionPass *createX86PatternInstructionSelector(TargetMachine &TM); + /// createX86SSAPeepholeOptimizerPass - Create a pass to perform SSA-based X86 /// specific peephole optimizations. /// @@ -70,11 +75,11 @@ /// FunctionPass *createEmitX86CodeToMemory(); +} // End llvm namespace + // Defines symbolic names for X86 registers. This defines a mapping from // register name to register number. // -} // End llvm namespace - #include "X86GenRegisterNames.inc" // Defines symbolic names for the X86 instructions. From lattner at cs.uiuc.edu Fri Jan 7 01:49:17 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jan 2005 01:49:17 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelPattern.cpp Message-ID: <200501070749.j077nH7f032587@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelPattern.cpp (r1.10) removed --- Log message: This file is now dead. --- Diffs of the changes: (+0 -0) From lattner at cs.uiuc.edu Fri Jan 7 01:49:54 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jan 2005 01:49:54 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelPattern.cpp Message-ID: <200501070749.j077nsTU032600@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelPattern.cpp updated: 1.11 -> 1.12 --- Log message: Reimplementation of the X86 pattern isel. This is still missing many large pieces, but can already do amazing things in some cases. --- Diffs of the changes: (+1415 -0) Index: llvm/lib/Target/X86/X86ISelPattern.cpp diff -u /dev/null llvm/lib/Target/X86/X86ISelPattern.cpp:1.12 --- /dev/null Fri Jan 7 01:49:52 2005 +++ llvm/lib/Target/X86/X86ISelPattern.cpp Fri Jan 7 01:49:41 2005 @@ -0,0 +1,1415 @@ +//===-- X86ISelPattern.cpp - A pattern matching inst selector for X86 -----===// +// +// 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 defines a pattern matching instruction selector for X86. +// +//===----------------------------------------------------------------------===// + +#include "X86.h" +#include "X86InstrBuilder.h" +#include "X86RegisterInfo.h" +#include "llvm/Function.h" +#include "llvm/CodeGen/MachineFunction.h" +#include "llvm/CodeGen/MachineFrameInfo.h" +#include "llvm/CodeGen/SelectionDAG.h" +#include "llvm/CodeGen/SelectionDAGISel.h" +#include "llvm/CodeGen/SSARegMap.h" +#include "llvm/Target/TargetData.h" +#include "llvm/Target/TargetLowering.h" +#include "llvm/Support/MathExtras.h" +#include "llvm/ADT/Statistic.h" +#include +using namespace llvm; + +//===----------------------------------------------------------------------===// +// X86TargetLowering - X86 Implementation of the TargetLowering interface +namespace { + class X86TargetLowering : public TargetLowering { + int VarArgsFrameIndex; // FrameIndex for start of varargs area. + public: + X86TargetLowering(TargetMachine &TM) : TargetLowering(TM) { + // Set up the TargetLowering object. + addRegisterClass(MVT::i8, X86::R8RegisterClass); + addRegisterClass(MVT::i16, X86::R16RegisterClass); + addRegisterClass(MVT::i32, X86::R32RegisterClass); + addRegisterClass(MVT::f64, X86::RFPRegisterClass); + + // FIXME: Eliminate these two classes when legalize can handle promotions + // well. + addRegisterClass(MVT::i1, X86::R8RegisterClass); + addRegisterClass(MVT::f32, X86::RFPRegisterClass); + + computeRegisterProperties(); + + setOperationUnsupported(ISD::MUL, MVT::i8); + setOperationUnsupported(ISD::SELECT, MVT::i1); + setOperationUnsupported(ISD::SELECT, MVT::i8); + + addLegalFPImmediate(+0.0); // FLD0 + addLegalFPImmediate(+1.0); // FLD1 + addLegalFPImmediate(-0.0); // FLD0/FCHS + addLegalFPImmediate(-1.0); // FLD1/FCHS + } + + /// LowerArguments - This hook must be implemented to indicate how we should + /// lower the arguments for the specified function, into the specified DAG. + virtual std::vector + LowerArguments(Function &F, SelectionDAG &DAG); + + /// LowerCallTo - This hook lowers an abstract call to a function into an + /// actual call. + virtual SDNode *LowerCallTo(const Type *RetTy, SDOperand Callee, + ArgListTy &Args, SelectionDAG &DAG); + }; +} + + +std::vector +X86TargetLowering::LowerArguments(Function &F, SelectionDAG &DAG) { + std::vector ArgValues; + + // Add DAG nodes to load the arguments... On entry to a function on the X86, + // the stack frame looks like this: + // + // [ESP] -- return address + // [ESP + 4] -- first argument (leftmost lexically) + // [ESP + 8] -- second argument, if first argument is four bytes in size + // ... + // + MachineFunction &MF = DAG.getMachineFunction(); + MachineFrameInfo *MFI = MF.getFrameInfo(); + + unsigned ArgOffset = 0; // Frame mechanisms handle retaddr slot + for (Function::aiterator I = F.abegin(), E = F.aend(); I != E; ++I) { + MVT::ValueType ObjectVT = getValueType(I->getType()); + unsigned ArgIncrement = 4; + unsigned ObjSize; + switch (ObjectVT) { + default: assert(0 && "Unhandled argument type!"); + case MVT::i1: + case MVT::i8: ObjSize = 1; break; + case MVT::i16: ObjSize = 2; break; + case MVT::i32: ObjSize = 4; break; + case MVT::i64: ObjSize = ArgIncrement = 8; break; + case MVT::f32: ObjSize = 4; break; + case MVT::f64: ObjSize = ArgIncrement = 8; break; + } + // Create the frame index object for this incoming parameter... + int FI = MFI->CreateFixedObject(ObjSize, ArgOffset); + + // Create the SelectionDAG nodes corresponding to a load from this parameter + SDOperand FIN = DAG.getFrameIndex(FI, MVT::i32); + + // Don't codegen dead arguments. FIXME: remove this check when we can nuke + // dead loads. + SDOperand ArgValue; + if (!I->use_empty()) + ArgValue = DAG.getLoad(ObjectVT, DAG.getEntryNode(), FIN); + else { + if (MVT::isInteger(ObjectVT)) + ArgValue = DAG.getConstant(0, ObjectVT); + else + ArgValue = DAG.getConstantFP(0, ObjectVT); + } + ArgValues.push_back(ArgValue); + + ArgOffset += ArgIncrement; // Move on to the next argument... + } + + // If the function takes variable number of arguments, make a frame index for + // the start of the first vararg value... for expansion of llvm.va_start. + if (F.isVarArg()) + VarArgsFrameIndex = MFI->CreateFixedObject(1, ArgOffset); + + return ArgValues; +} + +SDNode *X86TargetLowering::LowerCallTo(const Type *RetTy, SDOperand Callee, + ArgListTy &Args, SelectionDAG &DAG) { + // Count how many bytes are to be pushed on the stack. + unsigned NumBytes = 0; + + if (Args.empty()) { + // Save zero bytes. + DAG.setRoot(DAG.getNode(ISD::ADJCALLSTACKDOWN, MVT::Other, DAG.getRoot(), + DAG.getConstant(0, getPointerTy()))); + } else { + for (unsigned i = 0, e = Args.size(); i != e; ++i) + switch (getValueType(Args[i].second)) { + default: assert(0 && "Unknown value type!"); + case MVT::i1: + case MVT::i8: + case MVT::i16: + case MVT::i32: + case MVT::f32: + NumBytes += 4; + break; + case MVT::i64: + case MVT::f64: + NumBytes += 8; + break; + } + + DAG.setRoot(DAG.getNode(ISD::ADJCALLSTACKDOWN, MVT::Other, DAG.getRoot(), + DAG.getConstant(NumBytes, getPointerTy()))); + + // Arguments go on the stack in reverse order, as specified by the ABI. + unsigned ArgOffset = 0; + SDOperand StackPtr = DAG.getCopyFromReg(X86::ESP, MVT::i32); + for (unsigned i = 0, e = Args.size(); i != e; ++i) { + unsigned ArgReg; + SDOperand PtrOff = DAG.getConstant(ArgOffset, getPointerTy()); + PtrOff = DAG.getNode(ISD::ADD, MVT::i32, StackPtr, PtrOff); + + switch (getValueType(Args[i].second)) { + default: assert(0 && "Unexpected ValueType for argument!"); + case MVT::i1: + case MVT::i8: + case MVT::i16: + // Promote the integer to 32 bits. If the input type is signed use a + // sign extend, otherwise use a zero extend. + if (Args[i].second->isSigned()) + Args[i].first =DAG.getNode(ISD::SIGN_EXTEND, MVT::i32, Args[i].first); + else + Args[i].first =DAG.getNode(ISD::ZERO_EXTEND, MVT::i32, Args[i].first); + + // FALL THROUGH + case MVT::i32: + case MVT::f32: + // FIXME: Note that all of these stores are independent of each other. + DAG.setRoot(DAG.getNode(ISD::STORE, MVT::Other, DAG.getRoot(), + Args[i].first, PtrOff)); + ArgOffset += 4; + break; + case MVT::i64: + case MVT::f64: + // FIXME: Note that all of these stores are independent of each other. + DAG.setRoot(DAG.getNode(ISD::STORE, MVT::Other, DAG.getRoot(), + Args[i].first, PtrOff)); + ArgOffset += 8; + break; + } + } + } + + std::vector RetVals; + MVT::ValueType RetTyVT = getValueType(RetTy); + if (RetTyVT != MVT::isVoid) + RetVals.push_back(RetTyVT); + RetVals.push_back(MVT::Other); + + SDNode *TheCall = DAG.getCall(RetVals, DAG.getRoot(), Callee); + DAG.setRoot(SDOperand(TheCall, TheCall->getNumValues()-1)); + DAG.setRoot(DAG.getNode(ISD::ADJCALLSTACKUP, MVT::Other, DAG.getRoot(), + DAG.getConstant(NumBytes, getPointerTy()))); + return TheCall; +} + + + + + + +namespace { + Statistic<> + NumFPKill("x86-codegen", "Number of FP_REG_KILL instructions added"); + + //===--------------------------------------------------------------------===// + /// ISel - X86 specific code to select X86 machine instructions for + /// SelectionDAG operations. + /// + class ISel : public SelectionDAGISel { + /// ContainsFPCode - Every instruction we select that uses or defines a FP + /// register should set this to true. + bool ContainsFPCode; + + /// X86Lowering - This object fully describes how to lower LLVM code to an + /// X86-specific SelectionDAG. + X86TargetLowering X86Lowering; + + + /// ExprMap - As shared expressions are codegen'd, we keep track of which + /// vreg the value is produced in, so we only emit one copy of each compiled + /// tree. + std::map ExprMap; + std::set LoweredTokens; + + public: + ISel(TargetMachine &TM) : SelectionDAGISel(X86Lowering), X86Lowering(TM) { + } + + /// InstructionSelectBasicBlock - This callback is invoked by + /// SelectionDAGISel when it has created a SelectionDAG for us to codegen. + virtual void InstructionSelectBasicBlock(SelectionDAG &DAG) { + // While we're doing this, keep track of whether we see any FP code for + // FP_REG_KILL insertion. + ContainsFPCode = false; + + // Codegen the basic block. + Select(DAG.getRoot()); + + // Insert FP_REG_KILL instructions into basic blocks that need them. This + // only occurs due to the floating point stackifier not being aggressive + // enough to handle arbitrary global stackification. + // + // Currently we insert an FP_REG_KILL instruction into each block that + // uses or defines a floating point virtual register. + // + // When the global register allocators (like linear scan) finally update + // live variable analysis, we can keep floating point values in registers + // across basic blocks. This will be a huge win, but we are waiting on + // the global allocators before we can do this. + // + if (ContainsFPCode && BB->succ_size()) { + BuildMI(*BB, BB->getFirstTerminator(), X86::FP_REG_KILL, 0); + ++NumFPKill; + } + + // Clear state used for selection. + ExprMap.clear(); + LoweredTokens.clear(); + } + + void EmitCMP(SDOperand LHS, SDOperand RHS); + bool EmitBranchCC(MachineBasicBlock *Dest, SDOperand Cond); + unsigned SelectExpr(SDOperand N); + bool SelectAddress(SDOperand N, X86AddressMode &AM); + void Select(SDOperand N); + }; +} + +/// SelectAddress - Add the specified node to the specified addressing mode, +/// returning true if it cannot be done. +bool ISel::SelectAddress(SDOperand N, X86AddressMode &AM) { + switch (N.getOpcode()) { + default: break; + case ISD::FrameIndex: + if (AM.BaseType == X86AddressMode::RegBase && AM.Base.Reg == 0) { + AM.BaseType = X86AddressMode::FrameIndexBase; + AM.Base.FrameIndex = cast(N)->getIndex(); + return false; + } + break; + case ISD::GlobalAddress: + if (AM.GV == 0) { + AM.GV = cast(N)->getGlobal(); + return false; + } + break; + case ISD::Constant: + AM.Disp += cast(N)->getValue(); + return false; + case ISD::SHL: + if (AM.IndexReg == 0 || AM.Scale == 1) + if (ConstantSDNode *CN = dyn_cast(N.Val->getOperand(1))) { + unsigned Val = CN->getValue(); + if (Val == 1 || Val == 2 || Val == 3) { + AM.Scale = 1 << Val; + AM.IndexReg = SelectExpr(N.Val->getOperand(0)); + return false; + } + } + break; + + case ISD::ADD: { + X86AddressMode Backup = AM; + if (!SelectAddress(N.Val->getOperand(0), AM) && + !SelectAddress(N.Val->getOperand(1), AM)) + return false; + AM = Backup; + break; + } + } + + if (AM.BaseType != X86AddressMode::RegBase || + AM.Base.Reg) + return true; + + // Default, generate it as a register. + AM.BaseType = X86AddressMode::RegBase; + AM.Base.Reg = SelectExpr(N); + return false; +} + +/// Emit2SetCCsAndLogical - Emit the following sequence of instructions, +/// assuming that the temporary registers are in the 8-bit register class. +/// +/// Tmp1 = setcc1 +/// Tmp2 = setcc2 +/// DestReg = logicalop Tmp1, Tmp2 +/// +static void Emit2SetCCsAndLogical(MachineBasicBlock *BB, unsigned SetCC1, + unsigned SetCC2, unsigned LogicalOp, + unsigned DestReg) { + SSARegMap *RegMap = BB->getParent()->getSSARegMap(); + unsigned Tmp1 = RegMap->createVirtualRegister(X86::R8RegisterClass); + unsigned Tmp2 = RegMap->createVirtualRegister(X86::R8RegisterClass); + BuildMI(BB, SetCC1, 0, Tmp1); + BuildMI(BB, SetCC2, 0, Tmp2); + BuildMI(BB, LogicalOp, 2, DestReg).addReg(Tmp1).addReg(Tmp2); +} + +/// EmitSetCC - Emit the code to set the specified 8-bit register to 1 if the +/// condition codes match the specified SetCCOpcode. Note that some conditions +/// require multiple instructions to generate the correct value. +static void EmitSetCC(MachineBasicBlock *BB, unsigned DestReg, + ISD::CondCode SetCCOpcode, bool isFP) { + unsigned Opc; + if (!isFP) { + switch (SetCCOpcode) { + default: assert(0 && "Illegal integer SetCC!"); + case ISD::SETEQ: Opc = X86::SETEr; break; + case ISD::SETGT: Opc = X86::SETGr; break; + case ISD::SETGE: Opc = X86::SETGEr; break; + case ISD::SETLT: Opc = X86::SETLr; break; + case ISD::SETLE: Opc = X86::SETLEr; break; + case ISD::SETNE: Opc = X86::SETNEr; break; + case ISD::SETULT: Opc = X86::SETBr; break; + case ISD::SETUGT: Opc = X86::SETAr; break; + case ISD::SETULE: Opc = X86::SETBEr; break; + case ISD::SETUGE: Opc = X86::SETAEr; break; + } + } else { + // On a floating point condition, the flags are set as follows: + // ZF PF CF op + // 0 | 0 | 0 | X > Y + // 0 | 0 | 1 | X < Y + // 1 | 0 | 0 | X == Y + // 1 | 1 | 1 | unordered + // + switch (SetCCOpcode) { + default: assert(0 && "Invalid FP setcc!"); + case ISD::SETUEQ: + case ISD::SETEQ: + Opc = X86::SETEr; // True if ZF = 1 + break; + case ISD::SETOGT: + case ISD::SETGT: + Opc = X86::SETAr; // True if CF = 0 and ZF = 0 + break; + case ISD::SETOGE: + case ISD::SETGE: + Opc = X86::SETAEr; // True if CF = 0 + break; + case ISD::SETULT: + case ISD::SETLT: + Opc = X86::SETBr; // True if CF = 1 + break; + case ISD::SETULE: + case ISD::SETLE: + Opc = X86::SETBEr; // True if CF = 1 or ZF = 1 + break; + case ISD::SETONE: + case ISD::SETNE: + Opc = X86::SETNEr; // True if ZF = 0 + break; + case ISD::SETUO: + Opc = X86::SETPr; // True if PF = 1 + break; + case ISD::SETO: + Opc = X86::SETNPr; // True if PF = 0 + break; + case ISD::SETOEQ: // !PF & ZF + Emit2SetCCsAndLogical(BB, X86::SETNPr, X86::SETEr, X86::AND8rr, DestReg); + return; + case ISD::SETOLT: // !PF & CF + Emit2SetCCsAndLogical(BB, X86::SETNPr, X86::SETBr, X86::AND8rr, DestReg); + return; + case ISD::SETOLE: // !PF & (CF || ZF) + Emit2SetCCsAndLogical(BB, X86::SETNPr, X86::SETBEr, X86::AND8rr, DestReg); + return; + case ISD::SETUGT: // PF | (!ZF & !CF) + Emit2SetCCsAndLogical(BB, X86::SETPr, X86::SETAr, X86::OR8rr, DestReg); + return; + case ISD::SETUGE: // PF | !CF + Emit2SetCCsAndLogical(BB, X86::SETPr, X86::SETAEr, X86::OR8rr, DestReg); + return; + case ISD::SETUNE: // PF | !ZF + Emit2SetCCsAndLogical(BB, X86::SETPr, X86::SETNEr, X86::OR8rr, DestReg); + return; + } + } + BuildMI(BB, Opc, 0, DestReg); +} + + +/// EmitBranchCC - Emit code into BB that arranges for control to transfer to +/// the Dest block if the Cond condition is true. If we cannot fold this +/// condition into the branch, return true. +/// +bool ISel::EmitBranchCC(MachineBasicBlock *Dest, SDOperand Cond) { + // FIXME: Evaluate whether it would be good to emit code like (X < Y) | (A > + // B) using two conditional branches instead of one condbr, two setcc's, and + // an or. + if ((Cond.getOpcode() == ISD::OR || + Cond.getOpcode() == ISD::AND) && Cond.Val->hasOneUse()) { + // And and or set the flags for us, so there is no need to emit a TST of the + // result. It is only safe to do this if there is only a single use of the + // AND/OR though, otherwise we don't know it will be emitted here. + SelectExpr(Cond); + BuildMI(BB, X86::JNE, 1).addMBB(Dest); + return false; + } + + // Codegen br not C -> JE. + if (Cond.getOpcode() == ISD::XOR) + if (ConstantSDNode *NC = dyn_cast(Cond.Val->getOperand(1))) + if (NC->isAllOnesValue()) { + unsigned CondR = SelectExpr(Cond.Val->getOperand(0)); + BuildMI(BB, X86::TEST8rr, 2).addReg(CondR).addReg(CondR); + BuildMI(BB, X86::JE, 1).addMBB(Dest); + return false; + } + + SetCCSDNode *SetCC = dyn_cast(Cond); + if (SetCC == 0) + return true; // Can only handle simple setcc's so far. + + unsigned Opc; + + // Handle integer conditions first. + if (MVT::isInteger(SetCC->getOperand(0).getValueType())) { + switch (SetCC->getCondition()) { + default: assert(0 && "Illegal integer SetCC!"); + case ISD::SETEQ: Opc = X86::JE; break; + case ISD::SETGT: Opc = X86::JG; break; + case ISD::SETGE: Opc = X86::JGE; break; + case ISD::SETLT: Opc = X86::JL; break; + case ISD::SETLE: Opc = X86::JLE; break; + case ISD::SETNE: Opc = X86::JNE; break; + case ISD::SETULT: Opc = X86::JB; break; + case ISD::SETUGT: Opc = X86::JA; break; + case ISD::SETULE: Opc = X86::JBE; break; + case ISD::SETUGE: Opc = X86::JAE; break; + } + EmitCMP(SetCC->getOperand(0), SetCC->getOperand(1)); + BuildMI(BB, Opc, 1).addMBB(Dest); + return false; + } + + ContainsFPCode = true; + unsigned Opc2 = 0; // Second branch if needed. + + // On a floating point condition, the flags are set as follows: + // ZF PF CF op + // 0 | 0 | 0 | X > Y + // 0 | 0 | 1 | X < Y + // 1 | 0 | 0 | X == Y + // 1 | 1 | 1 | unordered + // + switch (SetCC->getCondition()) { + default: assert(0 && "Invalid FP setcc!"); + case ISD::SETUEQ: + case ISD::SETEQ: Opc = X86::JE; break; // True if ZF = 1 + case ISD::SETOGT: + case ISD::SETGT: Opc = X86::JA; break; // True if CF = 0 and ZF = 0 + case ISD::SETOGE: + case ISD::SETGE: Opc = X86::JAE; break; // True if CF = 0 + case ISD::SETULT: + case ISD::SETLT: Opc = X86::JB; break; // True if CF = 1 + case ISD::SETULE: + case ISD::SETLE: Opc = X86::JBE; break; // True if CF = 1 or ZF = 1 + case ISD::SETONE: + case ISD::SETNE: Opc = X86::JNE; break; // True if ZF = 0 + case ISD::SETUO: Opc = X86::JP; break; // True if PF = 1 + case ISD::SETO: Opc = X86::JNP; break; // True if PF = 0 + case ISD::SETUGT: // PF = 1 | (ZF = 0 & CF = 0) + Opc = X86::JA; // ZF = 0 & CF = 0 + Opc2 = X86::JP; // PF = 1 + break; + case ISD::SETUGE: // PF = 1 | CF = 0 + Opc = X86::JAE; // CF = 0 + Opc2 = X86::JP; // PF = 1 + break; + case ISD::SETUNE: // PF = 1 | ZF = 0 + Opc = X86::JNE; // ZF = 0 + Opc2 = X86::JP; // PF = 1 + break; + case ISD::SETOEQ: // PF = 0 & ZF = 1 + //X86::JNP, X86::JE + //X86::AND8rr + return true; // FIXME: Emit more efficient code for this branch. + case ISD::SETOLT: // PF = 0 & CF = 1 + //X86::JNP, X86::JB + //X86::AND8rr + return true; // FIXME: Emit more efficient code for this branch. + case ISD::SETOLE: // PF = 0 & (CF = 1 || ZF = 1) + //X86::JNP, X86::JBE + //X86::AND8rr + return true; // FIXME: Emit more efficient code for this branch. + } + + EmitCMP(SetCC->getOperand(0), SetCC->getOperand(1)); + BuildMI(BB, Opc, 1).addMBB(Dest); + if (Opc2) + BuildMI(BB, Opc2, 1).addMBB(Dest); + return false; +} + +void ISel::EmitCMP(SDOperand LHS, SDOperand RHS) { + unsigned Tmp1 = SelectExpr(LHS), Opc; + if (ConstantSDNode *CN = dyn_cast(RHS)) { + Opc = 0; + switch (RHS.getValueType()) { + default: break; + case MVT::i1: + case MVT::i8: Opc = X86::CMP8ri; break; + case MVT::i16: Opc = X86::CMP16ri; break; + case MVT::i32: Opc = X86::CMP32ri; break; + } + if (Opc) { + BuildMI(BB, Opc, 2).addReg(Tmp1).addImm(CN->getValue()); + return; + } + } + + switch (LHS.getValueType()) { + default: assert(0 && "Cannot compare this value!"); + case MVT::i1: + case MVT::i8: Opc = X86::CMP8rr; break; + case MVT::i16: Opc = X86::CMP16rr; break; + case MVT::i32: Opc = X86::CMP32rr; break; + case MVT::f32: + case MVT::f64: Opc = X86::FUCOMIr; ContainsFPCode = true; break; + } + unsigned Tmp2 = SelectExpr(RHS); + BuildMI(BB, Opc, 2).addReg(Tmp1).addReg(Tmp2); +} + +unsigned ISel::SelectExpr(SDOperand N) { + unsigned Result; + unsigned Tmp1, Tmp2, Tmp3; + unsigned Opc = 0; + + if (N.getOpcode() == ISD::CopyFromReg) + // Just use the specified register as our input. + return dyn_cast(N)->getReg(); + + // If there are multiple uses of this expression, memorize the + // register it is code generated in, instead of emitting it multiple + // times. + // FIXME: Disabled for our current selection model. + if (1 || !N.Val->hasOneUse()) { + unsigned &Reg = ExprMap[N]; + if (Reg) return Reg; + + if (N.getOpcode() != ISD::CALL) + Reg = Result = (N.getValueType() != MVT::Other) ? + MakeReg(N.getValueType()) : 1; + else { + // If this is a call instruction, make sure to prepare ALL of the result + // values as well as the chain. + if (N.Val->getNumValues() == 1) + Reg = Result = 1; // Void call, just a chain. + else { + Result = MakeReg(N.Val->getValueType(0)); + ExprMap[SDOperand(N.Val,0)] = Result; + for (unsigned i = 1, e = N.Val->getNumValues()-1; i != e; ++i) + ExprMap[SDOperand(N.Val, i)] = MakeReg(N.Val->getValueType(i)); + ExprMap[SDOperand(N.Val, N.Val->getNumValues()-1)] = 1; + } + } + } else { + Result = MakeReg(N.getValueType()); + } + + switch (N.getOpcode()) { + default: + N.Val->dump(); + assert(0 && "Node not handled!\n"); + case ISD::FrameIndex: + Tmp1 = cast(N)->getIndex(); + addFrameReference(BuildMI(BB, X86::LEA32r, 4, Result), (int)Tmp1); + return Result; + case ISD::ConstantPool: + Tmp1 = cast(N)->getIndex(); + addConstantPoolReference(BuildMI(BB, X86::LEA32r, 4, Result), Tmp1); + return Result; + case ISD::ConstantFP: + ContainsFPCode = true; + Tmp1 = Result; // Intermediate Register + if (cast(N)->getValue() < 0.0 || + cast(N)->isExactlyValue(-0.0)) + Tmp1 = MakeReg(MVT::f64); + + if (cast(N)->isExactlyValue(+0.0) || + cast(N)->isExactlyValue(-0.0)) + BuildMI(BB, X86::FLD0, 0, Tmp1); + else if (cast(N)->isExactlyValue(+1.0) || + cast(N)->isExactlyValue(-1.0)) + BuildMI(BB, X86::FLD1, 0, Tmp1); + else + assert(0 && "Unexpected constant!"); + if (Tmp1 != Result) + BuildMI(BB, X86::FCHS, 1, Result).addReg(Tmp1); + return Result; + case ISD::Constant: + switch (N.getValueType()) { + default: assert(0 && "Cannot use constants of this type!"); + case MVT::i1: + case MVT::i8: Opc = X86::MOV8ri; break; + case MVT::i16: Opc = X86::MOV16ri; break; + case MVT::i32: Opc = X86::MOV32ri; break; + } + BuildMI(BB, Opc, 1,Result).addImm(cast(N)->getValue()); + return Result; + case ISD::GlobalAddress: { + GlobalValue *GV = cast(N)->getGlobal(); + BuildMI(BB, X86::MOV32ri, 1, Result).addGlobalAddress(GV); + return Result; + } + case ISD::ExternalSymbol: { + const char *Sym = cast(N)->getSymbol(); + BuildMI(BB, X86::MOV32ri, 1, Result).addExternalSymbol(Sym); + return Result; + } + case ISD::FP_EXTEND: + Tmp1 = SelectExpr(N.getOperand(0)); + BuildMI(BB, X86::FpMOV, 1, Result).addReg(Tmp1); + ContainsFPCode = true; + return Result; + case ISD::ZERO_EXTEND: { + int DestIs16 = N.getValueType() == MVT::i16; + int SrcIs16 = N.getOperand(0).getValueType() == MVT::i16; + + static const unsigned Opc[3] = { + X86::MOVZX32rr8, X86::MOVZX32rr16, X86::MOVZX16rr8 + }; + Tmp1 = SelectExpr(N.getOperand(0)); + BuildMI(BB, Opc[SrcIs16+DestIs16*2], 1, Result).addReg(Tmp1); + return Result; + } + case ISD::SIGN_EXTEND: { + int DestIs16 = N.getValueType() == MVT::i16; + int SrcIs16 = N.getOperand(0).getValueType() == MVT::i16; + + static const unsigned Opc[3] = { + X86::MOVSX32rr8, X86::MOVSX32rr16, X86::MOVSX16rr8 + }; + Tmp1 = SelectExpr(N.getOperand(0)); + BuildMI(BB, Opc[SrcIs16+DestIs16*2], 1, Result).addReg(Tmp1); + return Result; + } + case ISD::TRUNCATE: + // Handle cast of LARGER int to SMALLER int using a move to EAX followed by + // a move out of AX or AL. + switch (N.getOperand(0).getValueType()) { + default: assert(0 && "Unknown truncate!"); + case MVT::i8: Tmp2 = X86::AL; Opc = X86::MOV8rr; break; + case MVT::i16: Tmp2 = X86::AX; Opc = X86::MOV16rr; break; + case MVT::i32: Tmp2 = X86::EAX; Opc = X86::MOV32rr; break; + } + Tmp1 = SelectExpr(N.getOperand(0)); + BuildMI(BB, Opc, 1, Tmp2).addReg(Tmp1); + + switch (N.getValueType()) { + default: assert(0 && "Unknown truncate!"); + case MVT::i1: + case MVT::i8: Tmp2 = X86::AL; Opc = X86::MOV8rr; break; + case MVT::i16: Tmp2 = X86::AX; Opc = X86::MOV16rr; break; + } + BuildMI(BB, Opc, 1, Result).addReg(Tmp2); + return Result; + + case ISD::FP_ROUND: + // Truncate from double to float by storing to memory as float, + // then reading it back into a register. + + // Create as stack slot to use. + Tmp1 = TLI.getTargetData().getFloatAlignment(); + Tmp2 = BB->getParent()->getFrameInfo()->CreateStackObject(4, Tmp1); + + // Codegen the input. + Tmp1 = SelectExpr(N.getOperand(0)); + + // Emit the store, then the reload. + addFrameReference(BuildMI(BB, X86::FST32m, 5), Tmp2).addReg(Tmp1); + addFrameReference(BuildMI(BB, X86::FLD32m, 5, Result), Tmp2); + ContainsFPCode = true; + return Result; + + case ISD::ADD: + // See if we can codegen this as an LEA to fold operations together. + if (N.getValueType() == MVT::i32) { + X86AddressMode AM; + if (!SelectAddress(N.getOperand(0), AM) && + !SelectAddress(N.getOperand(1), AM)) { + // If this is not just an add, emit the LEA. For a simple add (like + // reg+reg or reg+imm), we just emit an add. If might be a good idea to + // leave this as LEA, then peephole it to 'ADD' after two address elim + // happens. + if (AM.Scale != 1 || AM.BaseType == X86AddressMode::FrameIndexBase || + AM.Base.Reg && AM.IndexReg && (AM.Disp || AM.GV)) { + addFullAddress(BuildMI(BB, X86::LEA32r, 4, Result), AM); + return Result; + } + } + } + Tmp1 = SelectExpr(N.getOperand(0)); + if (ConstantSDNode *CN = dyn_cast(N.getOperand(1))) { + Opc = 0; + if (CN->getValue() == 1) { // add X, 1 -> inc X + switch (N.getValueType()) { + default: assert(0 && "Cannot integer add this type!"); + case MVT::i8: Opc = X86::INC8r; break; + case MVT::i16: Opc = X86::INC16r; break; + case MVT::i32: Opc = X86::INC32r; break; + } + } else if (CN->isAllOnesValue()) { // add X, -1 -> dec X + switch (N.getValueType()) { + default: assert(0 && "Cannot integer add this type!"); + case MVT::i8: Opc = X86::DEC8r; break; + case MVT::i16: Opc = X86::DEC16r; break; + case MVT::i32: Opc = X86::DEC32r; break; + } + } + + if (Opc) { + BuildMI(BB, Opc, 1, Result).addReg(Tmp1); + return Result; + } + + switch (N.getValueType()) { + default: assert(0 && "Cannot add this type!"); + case MVT::i8: Opc = X86::ADD8ri; break; + case MVT::i16: Opc = X86::ADD16ri; break; + case MVT::i32: Opc = X86::ADD32ri; break; + } + if (Opc) { + BuildMI(BB, Opc, 2, Result).addReg(Tmp1).addImm(CN->getValue()); + return Result; + } + } + + Tmp2 = SelectExpr(N.getOperand(1)); + switch (N.getValueType()) { + default: assert(0 && "Cannot add this type!"); + case MVT::i8: Opc = X86::ADD8rr; break; + case MVT::i16: Opc = X86::ADD16rr; break; + case MVT::i32: Opc = X86::ADD32rr; break; + case MVT::f32: + case MVT::f64: Opc = X86::FpADD; ContainsFPCode = true; break; + } + BuildMI(BB, Opc, 2, Result).addReg(Tmp1).addReg(Tmp2); + return Result; + case ISD::SUB: + if (MVT::isInteger(N.getValueType())) + if (ConstantSDNode *CN = dyn_cast(N.getOperand(0))) + if (CN->isNullValue()) { // 0 - N -> neg N + switch (N.getValueType()) { + default: assert(0 && "Cannot sub this type!"); + case MVT::i1: + case MVT::i8: Opc = X86::NEG8r; break; + case MVT::i16: Opc = X86::NEG16r; break; + case MVT::i32: Opc = X86::NEG32r; break; + } + Tmp1 = SelectExpr(N.getOperand(1)); + BuildMI(BB, Opc, 1, Result).addReg(Tmp1); + return Result; + } + + Tmp1 = SelectExpr(N.getOperand(0)); + if (ConstantSDNode *CN = dyn_cast(N.getOperand(1))) { + switch (N.getValueType()) { + default: assert(0 && "Cannot sub this type!"); + case MVT::i1: + case MVT::i8: Opc = X86::SUB8ri; break; + case MVT::i16: Opc = X86::SUB16ri; break; + case MVT::i32: Opc = X86::SUB32ri; break; + } + BuildMI(BB, Opc, 2, Result).addReg(Tmp1).addImm(CN->getValue()); + return Result; + } + Tmp2 = SelectExpr(N.getOperand(1)); + switch (N.getValueType()) { + default: assert(0 && "Cannot add this type!"); + case MVT::i1: + case MVT::i8: Opc = X86::SUB8rr; break; + case MVT::i16: Opc = X86::SUB16rr; break; + case MVT::i32: Opc = X86::SUB32rr; break; + case MVT::f32: + case MVT::f64: Opc = X86::FpSUB; ContainsFPCode = true; break; + } + BuildMI(BB, Opc, 2, Result).addReg(Tmp1).addReg(Tmp2); + return Result; + + case ISD::AND: + Tmp1 = SelectExpr(N.getOperand(0)); + if (ConstantSDNode *CN = dyn_cast(N.getOperand(1))) { + switch (N.getValueType()) { + default: assert(0 && "Cannot add this type!"); + case MVT::i1: + case MVT::i8: Opc = X86::AND8ri; break; + case MVT::i16: Opc = X86::AND16ri; break; + case MVT::i32: Opc = X86::AND32ri; break; + } + BuildMI(BB, Opc, 2, Result).addReg(Tmp1).addImm(CN->getValue()); + return Result; + } + Tmp2 = SelectExpr(N.getOperand(1)); + switch (N.getValueType()) { + default: assert(0 && "Cannot add this type!"); + case MVT::i1: + case MVT::i8: Opc = X86::AND8rr; break; + case MVT::i16: Opc = X86::AND16rr; break; + case MVT::i32: Opc = X86::AND32rr; break; + } + BuildMI(BB, Opc, 2, Result).addReg(Tmp1).addReg(Tmp2); + return Result; + case ISD::OR: + Tmp1 = SelectExpr(N.getOperand(0)); + if (ConstantSDNode *CN = dyn_cast(N.getOperand(1))) { + switch (N.getValueType()) { + default: assert(0 && "Cannot add this type!"); + case MVT::i1: + case MVT::i8: Opc = X86::OR8ri; break; + case MVT::i16: Opc = X86::OR16ri; break; + case MVT::i32: Opc = X86::OR32ri; break; + } + BuildMI(BB, Opc, 2, Result).addReg(Tmp1).addImm(CN->getValue()); + return Result; + } + Tmp2 = SelectExpr(N.getOperand(1)); + switch (N.getValueType()) { + default: assert(0 && "Cannot add this type!"); + case MVT::i1: + case MVT::i8: Opc = X86::OR8rr; break; + case MVT::i16: Opc = X86::OR16rr; break; + case MVT::i32: Opc = X86::OR32rr; break; + } + BuildMI(BB, Opc, 2, Result).addReg(Tmp1).addReg(Tmp2); + return Result; + case ISD::XOR: + Tmp1 = SelectExpr(N.getOperand(0)); + if (ConstantSDNode *CN = dyn_cast(N.getOperand(1))) { + switch (N.getValueType()) { + default: assert(0 && "Cannot add this type!"); + case MVT::i1: + case MVT::i8: Opc = X86::XOR8ri; break; + case MVT::i16: Opc = X86::XOR16ri; break; + case MVT::i32: Opc = X86::XOR32ri; break; + } + BuildMI(BB, Opc, 2, Result).addReg(Tmp1).addImm(CN->getValue()); + return Result; + } + Tmp2 = SelectExpr(N.getOperand(1)); + switch (N.getValueType()) { + default: assert(0 && "Cannot add this type!"); + case MVT::i1: + case MVT::i8: Opc = X86::XOR8rr; break; + case MVT::i16: Opc = X86::XOR16rr; break; + case MVT::i32: Opc = X86::XOR32rr; break; + } + BuildMI(BB, Opc, 2, Result).addReg(Tmp1).addReg(Tmp2); + return Result; + + case ISD::MUL: + Tmp1 = SelectExpr(N.getOperand(0)); + if (ConstantSDNode *CN = dyn_cast(N.getOperand(1))) { + Opc = 0; + switch (N.getValueType()) { + default: assert(0 && "Cannot multiply this type!"); + case MVT::i8: break; + case MVT::i16: Opc = X86::IMUL16rri; break; + case MVT::i32: Opc = X86::IMUL32rri; break; + } + if (Opc) { + BuildMI(BB, Opc, 2, Result).addReg(Tmp1).addImm(CN->getValue()); + return Result; + } + } + Tmp2 = SelectExpr(N.getOperand(1)); + switch (N.getValueType()) { + default: assert(0 && "Cannot add this type!"); + case MVT::i8: assert(0 && "FIXME: MUL i8 not implemented yet!"); + case MVT::i16: Opc = X86::IMUL16rr; break; + case MVT::i32: Opc = X86::IMUL32rr; break; + case MVT::f32: + case MVT::f64: Opc = X86::FpMUL; ContainsFPCode = true; break; + } + BuildMI(BB, Opc, 2, Result).addReg(Tmp1).addReg(Tmp2); + return Result; + + case ISD::SELECT: + // FIXME: implement folding of setcc into select. + if (N.getValueType() != MVT::i1 && N.getValueType() != MVT::i8) { + Tmp2 = SelectExpr(N.getOperand(1)); + Tmp3 = SelectExpr(N.getOperand(2)); + Tmp1 = SelectExpr(N.getOperand(0)); + + switch (N.getValueType()) { + default: assert(0 && "Cannot select this type!"); + case MVT::i16: Opc = X86::CMOVE16rr; break; + case MVT::i32: Opc = X86::CMOVE32rr; break; + case MVT::f32: + case MVT::f64: Opc = X86::FCMOVE; ContainsFPCode = true; break; + } + + // Get the condition into the zero flag. + BuildMI(BB, X86::TEST8rr, 2).addReg(Tmp1).addReg(Tmp1); + BuildMI(BB, Opc, 2, Result).addReg(Tmp2).addReg(Tmp3); + return Result; + } else { + // FIXME: This should not be implemented here, it should be in the generic + // code! + Tmp2 = SelectExpr(CurDAG->getNode(ISD::ZERO_EXTEND, MVT::i16, + N.getOperand(1))); + Tmp3 = SelectExpr(CurDAG->getNode(ISD::ZERO_EXTEND, MVT::i16, + N.getOperand(2))); + Tmp1 = SelectExpr(N.getOperand(0)); + BuildMI(BB, X86::TEST8rr, 2).addReg(Tmp1).addReg(Tmp1); + // FIXME: need subregs to do better than this! + unsigned TmpReg = MakeReg(MVT::i16); + BuildMI(BB, X86::CMOVE16rr, 2, TmpReg).addReg(Tmp2).addReg(Tmp3); + BuildMI(BB, X86::MOV16rr, 1, X86::AX).addReg(TmpReg); + BuildMI(BB, X86::MOV8rr, 1, Result).addReg(X86::AL); + return Result; + } + + case ISD::SDIV: + case ISD::UDIV: + case ISD::SREM: + case ISD::UREM: { + Tmp1 = SelectExpr(N.getOperand(0)); + + if (N.getOpcode() == ISD::SDIV) + if (ConstantSDNode *CN = dyn_cast(N.getOperand(1))) { + // FIXME: These special cases should be handled by the lowering impl! + unsigned RHS = CN->getValue(); + bool isNeg = false; + if ((int)RHS < 0) { + isNeg = true; + RHS = -RHS; + } + if (RHS && (RHS & (RHS-1)) == 0) { // Signed division by power of 2? + unsigned Log = log2(RHS); + unsigned TmpReg = MakeReg(N.getValueType()); + unsigned SAROpc, SHROpc, ADDOpc, NEGOpc; + switch (N.getValueType()) { + default: assert("Unknown type to signed divide!"); + case MVT::i8: + SAROpc = X86::SAR8ri; + SHROpc = X86::SHR8ri; + ADDOpc = X86::ADD8rr; + NEGOpc = X86::NEG8r; + break; + case MVT::i16: + SAROpc = X86::SAR16ri; + SHROpc = X86::SHR16ri; + ADDOpc = X86::ADD16rr; + NEGOpc = X86::NEG16r; + break; + case MVT::i32: + SAROpc = X86::SAR32ri; + SHROpc = X86::SHR32ri; + ADDOpc = X86::ADD32rr; + NEGOpc = X86::NEG32r; + break; + } + BuildMI(BB, SAROpc, 2, TmpReg).addReg(Tmp1).addImm(Log-1); + unsigned TmpReg2 = MakeReg(N.getValueType()); + BuildMI(BB, SHROpc, 2, TmpReg2).addReg(TmpReg).addImm(32-Log); + unsigned TmpReg3 = MakeReg(N.getValueType()); + BuildMI(BB, ADDOpc, 2, TmpReg3).addReg(Tmp1).addReg(TmpReg2); + + unsigned TmpReg4 = isNeg ? MakeReg(N.getValueType()) : Result; + BuildMI(BB, SAROpc, 2, TmpReg4).addReg(TmpReg3).addImm(Log); + if (isNeg) + BuildMI(BB, NEGOpc, 1, Result).addReg(TmpReg4); + return Result; + } + } + + Tmp2 = SelectExpr(N.getOperand(1)); + + bool isSigned = N.getOpcode() == ISD::SDIV || N.getOpcode() == ISD::SREM; + bool isDiv = N.getOpcode() == ISD::SDIV || N.getOpcode() == ISD::UDIV; + unsigned LoReg, HiReg, DivOpcode, MovOpcode, ClrOpcode, SExtOpcode; + switch (N.getValueType()) { + default: assert(0 && "Cannot sdiv this type!"); + case MVT::i8: + DivOpcode = isSigned ? X86::IDIV8r : X86::DIV8r; + LoReg = X86::AL; + HiReg = X86::AH; + MovOpcode = X86::MOV8rr; + ClrOpcode = X86::MOV8ri; + SExtOpcode = X86::CBW; + break; + case MVT::i16: + DivOpcode = isSigned ? X86::IDIV16r : X86::DIV16r; + LoReg = X86::AX; + HiReg = X86::DX; + MovOpcode = X86::MOV16rr; + ClrOpcode = X86::MOV16ri; + SExtOpcode = X86::CWD; + break; + case MVT::i32: + DivOpcode = isSigned ? X86::IDIV32r : X86::DIV32r; + LoReg =X86::EAX; + HiReg = X86::EDX; + MovOpcode = X86::MOV32rr; + ClrOpcode = X86::MOV32ri; + SExtOpcode = X86::CDQ; + break; + case MVT::i64: assert(0 && "FIXME: implement i64 DIV/REM libcalls!"); + case MVT::f32: + case MVT::f64: + ContainsFPCode = true; + if (N.getOpcode() == ISD::SDIV) + BuildMI(BB, X86::FpDIV, 2, Result).addReg(Tmp1).addReg(Tmp2); + else + assert(0 && "FIXME: Emit frem libcall to fmod!"); + return Result; + } + + // Set up the low part. + BuildMI(BB, MovOpcode, 1, LoReg).addReg(Tmp1); + + if (isSigned) { + // Sign extend the low part into the high part. + BuildMI(BB, SExtOpcode, 0); + } else { + // Zero out the high part, effectively zero extending the input. + BuildMI(BB, ClrOpcode, 1, HiReg).addImm(0); + } + + // Emit the DIV/IDIV instruction. + BuildMI(BB, DivOpcode, 1).addReg(Tmp2); + + // Get the result of the divide or rem. + BuildMI(BB, MovOpcode, 1, Result).addReg(isDiv ? LoReg : HiReg); + return Result; + } + + case ISD::SHL: + Tmp1 = SelectExpr(N.getOperand(0)); + if (ConstantSDNode *CN = dyn_cast(N.getOperand(1))) { + switch (N.getValueType()) { + default: assert(0 && "Cannot shift this type!"); + case MVT::i8: Opc = X86::SHL8ri; break; + case MVT::i16: Opc = X86::SHL16ri; break; + case MVT::i32: Opc = X86::SHL32ri; break; + } + BuildMI(BB, Opc, 2, Result).addReg(Tmp1).addImm(CN->getValue()); + return Result; + } + Tmp2 = SelectExpr(N.getOperand(1)); + switch (N.getValueType()) { + default: assert(0 && "Cannot shift this type!"); + case MVT::i8 : Opc = X86::SHL8rCL; break; + case MVT::i16: Opc = X86::SHL16rCL; break; + case MVT::i32: Opc = X86::SHL32rCL; break; + } + BuildMI(BB, X86::MOV8rr, 1, X86::CL).addReg(Tmp2); + BuildMI(BB, Opc, 2, Result).addReg(Tmp1).addReg(Tmp2); + return Result; + case ISD::SRL: + Tmp1 = SelectExpr(N.getOperand(0)); + if (ConstantSDNode *CN = dyn_cast(N.getOperand(1))) { + switch (N.getValueType()) { + default: assert(0 && "Cannot shift this type!"); + case MVT::i8: Opc = X86::SHR8ri; break; + case MVT::i16: Opc = X86::SHR16ri; break; + case MVT::i32: Opc = X86::SHR32ri; break; + } + BuildMI(BB, Opc, 2, Result).addReg(Tmp1).addImm(CN->getValue()); + return Result; + } + Tmp2 = SelectExpr(N.getOperand(1)); + switch (N.getValueType()) { + default: assert(0 && "Cannot shift this type!"); + case MVT::i8 : Opc = X86::SHR8rCL; break; + case MVT::i16: Opc = X86::SHR16rCL; break; + case MVT::i32: Opc = X86::SHR32rCL; break; + } + BuildMI(BB, X86::MOV8rr, 1, X86::CL).addReg(Tmp2); + BuildMI(BB, Opc, 2, Result).addReg(Tmp1).addReg(Tmp2); + return Result; + case ISD::SRA: + Tmp1 = SelectExpr(N.getOperand(0)); + if (ConstantSDNode *CN = dyn_cast(N.getOperand(1))) { + switch (N.getValueType()) { + default: assert(0 && "Cannot shift this type!"); + case MVT::i8: Opc = X86::SAR8ri; break; + case MVT::i16: Opc = X86::SAR16ri; break; + case MVT::i32: Opc = X86::SAR32ri; break; + } + BuildMI(BB, Opc, 2, Result).addReg(Tmp1).addImm(CN->getValue()); + return Result; + } + Tmp2 = SelectExpr(N.getOperand(1)); + switch (N.getValueType()) { + default: assert(0 && "Cannot shift this type!"); + case MVT::i8 : Opc = X86::SAR8rCL; break; + case MVT::i16: Opc = X86::SAR16rCL; break; + case MVT::i32: Opc = X86::SAR32rCL; break; + } + BuildMI(BB, X86::MOV8rr, 1, X86::CL).addReg(Tmp2); + BuildMI(BB, Opc, 2, Result).addReg(Tmp1).addReg(Tmp2); + return Result; + + case ISD::SETCC: + if (MVT::isFloatingPoint(N.getOperand(0).getValueType())) + ContainsFPCode = true; + EmitCMP(N.getOperand(0), N.getOperand(1)); + EmitSetCC(BB, Result, cast(N)->getCondition(), + MVT::isFloatingPoint(N.getOperand(1).getValueType())); + return Result; + case ISD::LOAD: { + Select(N.getOperand(0)); + + // Make sure we generate both values. + if (Result != 1) + ExprMap[N.getValue(1)] = 1; // Generate the token + else + Result = ExprMap[N.getValue(0)] = MakeReg(N.getValue(0).getValueType()); + + switch (N.Val->getValueType(0)) { + default: assert(0 && "Cannot load this type!"); + case MVT::i1: + case MVT::i8: Opc = X86::MOV8rm; break; + case MVT::i16: Opc = X86::MOV16rm; break; + case MVT::i32: Opc = X86::MOV32rm; break; + case MVT::f32: Opc = X86::FLD32m; ContainsFPCode = true; break; + case MVT::f64: Opc = X86::FLD64m; ContainsFPCode = true; break; + } + if (ConstantPoolSDNode *CP = dyn_cast(N.getOperand(1))){ + addConstantPoolReference(BuildMI(BB, Opc, 4, Result), CP->getIndex()); + } else { + X86AddressMode AM; + SelectAddress(N.getOperand(1), AM); + addFullAddress(BuildMI(BB, Opc, 4, Result), AM); + } + return Result; + } + case ISD::DYNAMIC_STACKALLOC: + Select(N.getOperand(0)); + + // Generate both result values. + if (Result != 1) + ExprMap[N.getValue(1)] = 1; // Generate the token + else + Result = ExprMap[N.getValue(0)] = MakeReg(N.getValue(0).getValueType()); + + // FIXME: We are currently ignoring the requested alignment for handling + // greater than the stack alignment. This will need to be revisited at some + // point. Align = N.getOperand(2); + + if (!isa(N.getOperand(2)) || + cast(N.getOperand(2))->getValue() != 0) { + std::cerr << "Cannot allocate stack object with greater alignment than" + << " the stack alignment yet!"; + abort(); + } + + if (ConstantSDNode *CN = dyn_cast(N.getOperand(1))) { + BuildMI(BB, X86::SUB32ri, 2, X86::ESP).addReg(X86::ESP) + .addImm(CN->getValue()); + } else { + Tmp1 = SelectExpr(N.getOperand(1)); + + // Subtract size from stack pointer, thereby allocating some space. + BuildMI(BB, X86::SUB32rr, 2, X86::ESP).addReg(X86::ESP).addReg(Tmp1); + } + + // Put a pointer to the space into the result register, by copying the stack + // pointer. + BuildMI(BB, X86::MOV32rr, 1, Result).addReg(X86::ESP); + return Result; + + case ISD::CALL: + Select(N.getOperand(0)); + if (GlobalAddressSDNode *GASD = + dyn_cast(N.getOperand(1))) { + BuildMI(BB, X86::CALLpcrel32, 1).addGlobalAddress(GASD->getGlobal(),true); + } else if (ExternalSymbolSDNode *ESSDN = + dyn_cast(N.getOperand(1))) { + BuildMI(BB, X86::CALLpcrel32, + 1).addExternalSymbol(ESSDN->getSymbol(), true); + } else { + Tmp1 = SelectExpr(N.getOperand(1)); + BuildMI(BB, X86::CALL32r, 1).addReg(Tmp1); + } + switch (N.Val->getValueType(0)) { + default: assert(0 && "Unknown value type for call result!"); + case MVT::Other: return 1; + case MVT::i1: + case MVT::i8: + BuildMI(BB, X86::MOV8rr, 1, Result).addReg(X86::AL); + break; + case MVT::i16: + BuildMI(BB, X86::MOV16rr, 1, Result).addReg(X86::AX); + break; + case MVT::i32: + BuildMI(BB, X86::MOV32rr, 1, Result).addReg(X86::EAX); + if (N.Val->getValueType(1) == MVT::i32) + BuildMI(BB, X86::MOV32rr, 1, Result+1).addReg(X86::EDX); + break; + case MVT::f32: + case MVT::f64: // Floating-point return values live in %ST(0) + ContainsFPCode = true; + BuildMI(BB, X86::FpGETRESULT, 1, Result); + break; + } + return Result+N.ResNo; + } + + return 0; +} + +void ISel::Select(SDOperand N) { + unsigned Tmp1, Tmp2, Opc; + + // FIXME: Disable for our current expansion model! + if (/*!N->hasOneUse() &&*/ !LoweredTokens.insert(N).second) + return; // Already selected. + + switch (N.getOpcode()) { + default: + N.Val->dump(); std::cerr << "\n"; + assert(0 && "Node not handled yet!"); + case ISD::EntryToken: return; // Noop + case ISD::CopyToReg: + Select(N.getOperand(0)); + Tmp1 = SelectExpr(N.getOperand(1)); + Tmp2 = cast(N)->getReg(); + + if (Tmp1 != Tmp2) { + switch (N.getOperand(1).getValueType()) { + default: assert(0 && "Invalid type for operation!"); + case MVT::i1: + case MVT::i8: Opc = X86::MOV8rr; break; + case MVT::i16: Opc = X86::MOV16rr; break; + case MVT::i32: Opc = X86::MOV32rr; break; + case MVT::f32: + case MVT::f64: Opc = X86::FpMOV; break; + } + BuildMI(BB, Opc, 1, Tmp2).addReg(Tmp1); + } + return; + case ISD::RET: + Select(N.getOperand(0)); + switch (N.getNumOperands()) { + default: + assert(0 && "Unknown return instruction!"); + case 3: + Tmp1 = SelectExpr(N.getOperand(1)); + Tmp2 = SelectExpr(N.getOperand(2)); + assert(N.getOperand(1).getValueType() == MVT::i32 && + N.getOperand(2).getValueType() == MVT::i32 && + "Unknown two-register value!"); + BuildMI(BB, X86::MOV32rr, 1, X86::EAX).addReg(Tmp1); + BuildMI(BB, X86::MOV32rr, 1, X86::EDX).addReg(Tmp2); + // Declare that EAX & EDX are live on exit. + BuildMI(BB, X86::IMPLICIT_USE, 3).addReg(X86::EAX).addReg(X86::EDX) + .addReg(X86::ESP); + break; + case 2: + Tmp1 = SelectExpr(N.getOperand(1)); + switch (N.getOperand(1).getValueType()) { + default: assert(0 && "All other types should have been promoted!!"); + case MVT::f64: + BuildMI(BB, X86::FpSETRESULT, 1).addReg(Tmp1); + // Declare that top-of-stack is live on exit + BuildMI(BB, X86::IMPLICIT_USE, 2).addReg(X86::ST0).addReg(X86::ESP); + break; + case MVT::i32: + BuildMI(BB, X86::MOV32rr, 1, X86::EAX).addReg(Tmp1); + BuildMI(BB, X86::IMPLICIT_USE, 2).addReg(X86::EAX).addReg(X86::ESP); + break; + } + break; + case 1: + break; + } + BuildMI(BB, X86::RET, 0); // Just emit a 'ret' instruction + return; + case ISD::BR: { + Select(N.getOperand(0)); + MachineBasicBlock *Dest = + cast(N.getOperand(1))->getBasicBlock(); + BuildMI(BB, X86::JMP, 1).addMBB(Dest); + return; + } + + case ISD::BRCOND: { + Select(N.getOperand(0)); + MachineBasicBlock *Dest = + cast(N.getOperand(2))->getBasicBlock(); + // Try to fold a setcc into the branch. If this fails, emit a test/jne + // pair. + if (EmitBranchCC(Dest, N.getOperand(1))) { + Tmp1 = SelectExpr(N.getOperand(1)); + BuildMI(BB, X86::TEST8rr, 2).addReg(Tmp1).addReg(Tmp1); + BuildMI(BB, X86::JNE, 1).addMBB(Dest); + } + return; + } + case ISD::LOAD: + case ISD::CALL: + case ISD::DYNAMIC_STACKALLOC: + SelectExpr(N); + return; + case ISD::STORE: { + Select(N.getOperand(0)); + // Select the address. + X86AddressMode AM; + SelectAddress(N.getOperand(2), AM); + + if (ConstantSDNode *CN = dyn_cast(N.getOperand(1))) { + Opc = 0; + switch (CN->getValueType(0)) { + default: assert(0 && "Invalid type for operation!"); + case MVT::i1: + case MVT::i8: Opc = X86::MOV8mi; break; + case MVT::i16: Opc = X86::MOV16mi; break; + case MVT::i32: Opc = X86::MOV32mi; break; + case MVT::f32: + case MVT::f64: break; + } + if (Opc) { + addFullAddress(BuildMI(BB, Opc, 4+1), AM).addImm(CN->getValue()); + return; + } + } + Tmp1 = SelectExpr(N.getOperand(1)); + + switch (N.getOperand(1).getValueType()) { + default: assert(0 && "Cannot store this type!"); + case MVT::i1: + case MVT::i8: Opc = X86::MOV8mr; break; + case MVT::i16: Opc = X86::MOV16mr; break; + case MVT::i32: Opc = X86::MOV32mr; break; + case MVT::f32: Opc = X86::FST32m; ContainsFPCode = true; break; + case MVT::f64: Opc = X86::FST64m; ContainsFPCode = true; break; + } + addFullAddress(BuildMI(BB, Opc, 4+1), AM).addReg(Tmp1); + return; + } + case ISD::ADJCALLSTACKDOWN: + case ISD::ADJCALLSTACKUP: + Select(N.getOperand(0)); + Tmp1 = cast(N.getOperand(1))->getValue(); + + Opc = N.getOpcode() == ISD::ADJCALLSTACKDOWN ? X86::ADJCALLSTACKDOWN : + X86::ADJCALLSTACKUP; + BuildMI(BB, Opc, 1).addImm(Tmp1); + return; + } + assert(0 && "Should not be reached!"); +} + + +/// createX86PatternInstructionSelector - This pass converts an LLVM function +/// into a machine code representation using pattern matching and a machine +/// description file. +/// +FunctionPass *llvm::createX86PatternInstructionSelector(TargetMachine &TM) { + return new ISel(TM); +} From lattner at cs.uiuc.edu Fri Jan 7 01:51:02 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jan 2005 01:51:02 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86TargetMachine.cpp Message-ID: <200501070751.j077p2Us032617@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86TargetMachine.cpp updated: 1.74 -> 1.75 --- Log message: Allow the selection-dag based selector to be diabled with -disable-pattern-isel. For now, this is the default, as the current selector is missing some big pieces. To enable the new selector, pass -disable-pattern-isel=false to llc or lli. --- Diffs of the changes: (+11 -2) Index: llvm/lib/Target/X86/X86TargetMachine.cpp diff -u llvm/lib/Target/X86/X86TargetMachine.cpp:1.74 llvm/lib/Target/X86/X86TargetMachine.cpp:1.75 --- llvm/lib/Target/X86/X86TargetMachine.cpp:1.74 Mon Jan 3 10:34:19 2005 +++ llvm/lib/Target/X86/X86TargetMachine.cpp Fri Jan 7 01:50:50 2005 @@ -41,6 +41,9 @@ cl::opt DisableOutput("disable-x86-llc-output", cl::Hidden, cl::desc("Disable the X86 asm printer, for use " "when profiling the code generator.")); + cl::opt DisablePatternISel("disable-pattern-isel", cl::Hidden, + cl::desc("Disable the pattern isel XXX FIXME"), + cl::init(true)); #if 0 // FIXME: This should eventually be handled with target triples and @@ -110,7 +113,10 @@ // Make sure that no unreachable blocks are instruction selected. PM.add(createUnreachableBlockEliminationPass()); - PM.add(createX86SimpleInstructionSelector(*this)); + if (DisablePatternISel) + PM.add(createX86SimpleInstructionSelector(*this)); + else + PM.add(createX86PatternInstructionSelector(*this)); // Run optional SSA-based machine code optimizations next... if (!NoSSAPeephole) @@ -165,7 +171,10 @@ // Make sure that no unreachable blocks are instruction selected. PM.add(createUnreachableBlockEliminationPass()); - PM.add(createX86SimpleInstructionSelector(TM)); + if (DisablePatternISel) + PM.add(createX86SimpleInstructionSelector(TM)); + else + PM.add(createX86PatternInstructionSelector(TM)); // Run optional SSA-based machine code optimizations next... if (!NoSSAPeephole) From lattner at cs.uiuc.edu Fri Jan 7 01:51:24 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jan 2005 01:51:24 -0600 Subject: [llvm-commits] CVS: llvm/Makefile.rules Message-ID: <200501070751.j077pO01032633@apoc.cs.uiuc.edu> Changes in directory llvm: Makefile.rules updated: 1.287 -> 1.288 --- Log message: X86 JIT requires the selection dag library. --- Diffs of the changes: (+1 -1) Index: llvm/Makefile.rules diff -u llvm/Makefile.rules:1.287 llvm/Makefile.rules:1.288 --- llvm/Makefile.rules:1.287 Mon Jan 3 11:42:57 2005 +++ llvm/Makefile.rules Fri Jan 7 01:51:11 2005 @@ -770,7 +770,7 @@ # What the X86 JIT requires ifdef ENABLE_X86_JIT - JIT_LIBS += LLVMX86 + JIT_LIBS += LLVMX86 LLVMSelectionDAG endif # You can enable the SparcV9 JIT on a non-SparcV9 host by setting the flag From lattner at cs.uiuc.edu Fri Jan 7 01:51:37 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jan 2005 01:51:37 -0600 Subject: [llvm-commits] CVS: llvm/tools/llc/Makefile Message-ID: <200501070751.j077pbeK032646@apoc.cs.uiuc.edu> Changes in directory llvm/tools/llc: Makefile updated: 1.65 -> 1.66 --- Log message: X86 BE requires SelectionDAG --- Diffs of the changes: (+1 -0) Index: llvm/tools/llc/Makefile diff -u llvm/tools/llc/Makefile:1.65 llvm/tools/llc/Makefile:1.66 --- llvm/tools/llc/Makefile:1.65 Thu Dec 16 17:07:13 2004 +++ llvm/tools/llc/Makefile Fri Jan 7 01:51:25 2005 @@ -19,6 +19,7 @@ LLVMSkeleton \ LLVMSparcV9RegAlloc \ LLVMSparcV9InstrSched \ + LLVMSelectionDAG \ LLVMCodeGen \ LLVMTarget.a \ LLVMSparcV9LiveVar \ From lattner at cs.uiuc.edu Fri Jan 7 01:56:23 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jan 2005 01:56:23 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/X86/fp-immediate-shorten.ll Message-ID: <200501070756.j077uNTV002595@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/X86: fp-immediate-shorten.ll added (r1.1) --- Log message: Add a testcase I forgot to commit earlier. --- Diffs of the changes: (+5 -0) Index: llvm/test/Regression/CodeGen/X86/fp-immediate-shorten.ll diff -c /dev/null llvm/test/Regression/CodeGen/X86/fp-immediate-shorten.ll:1.1 *** /dev/null Fri Jan 7 01:56:18 2005 --- llvm/test/Regression/CodeGen/X86/fp-immediate-shorten.ll Fri Jan 7 01:56:08 2005 *************** *** 0 **** --- 1,5 ---- + ;; Test that this FP immediate is stored in the constant pool as a float. + + ; RUN: llvm-as < %s | llc -march=x86 | grep '.long.1123418112' + + double %D() { ret double 123.0 } From lattner at cs.uiuc.edu Fri Jan 7 02:19:56 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jan 2005 02:19:56 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200501070819.j078JuMF011612@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.1 -> 1.2 --- Log message: Teach legalize how to handle condbranches --- Diffs of the changes: (+10 -0) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.1 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.2 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.1 Fri Jan 7 01:47:09 2005 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Fri Jan 7 02:19:42 2005 @@ -305,6 +305,16 @@ } break; + case ISD::BRCOND: + Tmp1 = LegalizeOp(Node->getOperand(0)); // Legalize the chain. + // FIXME: booleans might not be legal! + Tmp2 = LegalizeOp(Node->getOperand(1)); // Legalize the condition. + // Basic block destination (Op#2) is always legal. + if (Tmp1 != Node->getOperand(0) || Tmp2 != Node->getOperand(1)) + Result = DAG.getNode(ISD::BRCOND, MVT::Other, Tmp1, Tmp2, + Node->getOperand(2)); + break; + case ISD::LOAD: Tmp1 = LegalizeOp(Node->getOperand(0)); // Legalize the chain. Tmp2 = LegalizeOp(Node->getOperand(1)); // Legalize the pointer. From jeffc at jolt-lang.org Fri Jan 7 09:52:47 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Fri, 7 Jan 2005 09:52:47 -0600 Subject: [llvm-commits] CVS: llvm/win32/CodeGen/CodeGen.vcproj Message-ID: <200501071552.JAA04919@zion.cs.uiuc.edu> Changes in directory llvm/win32/CodeGen: CodeGen.vcproj updated: 1.7 -> 1.8 --- Log message: Get new SelectionDAG stuff building with Visual Studio. --- Diffs of the changes: (+19 -0) Index: llvm/win32/CodeGen/CodeGen.vcproj diff -u llvm/win32/CodeGen/CodeGen.vcproj:1.7 llvm/win32/CodeGen/CodeGen.vcproj:1.8 --- llvm/win32/CodeGen/CodeGen.vcproj:1.7 Mon Jan 3 10:37:16 2005 +++ llvm/win32/CodeGen/CodeGen.vcproj Fri Jan 7 09:52:36 2005 @@ -166,6 +166,19 @@ + + + + + + + + + + + + Changes in directory llvm/include/llvm/CodeGen: SelectionDAGNodes.h updated: 1.1 -> 1.2 --- Log message: Get new SelectionDAG stuff building with Visual Studio. --- Diffs of the changes: (+1 -0) Index: llvm/include/llvm/CodeGen/SelectionDAGNodes.h diff -u llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.1 llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.2 --- llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.1 Fri Jan 7 01:45:27 2005 +++ llvm/include/llvm/CodeGen/SelectionDAGNodes.h Fri Jan 7 09:52:36 2005 @@ -20,6 +20,7 @@ #define LLVM_CODEGEN_SELECTIONDAGNODES_H #include "llvm/CodeGen/ValueTypes.h" +#include "llvm/support/DataTypes.h" #include #include From jeffc at jolt-lang.org Fri Jan 7 09:52:47 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Fri, 7 Jan 2005 09:52:47 -0600 Subject: [llvm-commits] CVS: llvm/win32/Target/Target.vcproj Message-ID: <200501071552.JAA04922@zion.cs.uiuc.edu> Changes in directory llvm/win32/Target: Target.vcproj updated: 1.6 -> 1.7 --- Log message: Get new SelectionDAG stuff building with Visual Studio. --- Diffs of the changes: (+6 -0) Index: llvm/win32/Target/Target.vcproj diff -u llvm/win32/Target/Target.vcproj:1.6 llvm/win32/Target/Target.vcproj:1.7 --- llvm/win32/Target/Target.vcproj:1.6 Sat Dec 18 20:29:00 2004 +++ llvm/win32/Target/Target.vcproj Fri Jan 7 09:52:36 2005 @@ -119,6 +119,9 @@ RelativePath="..\..\lib\Target\TargetInstrInfo.cpp"> + + + + Changes in directory llvm/docs: index.html updated: 1.40 -> 1.41 --- Log message: Capitalize Bugpoint. --- Diffs of the changes: (+2 -2) Index: llvm/docs/index.html diff -u llvm/docs/index.html:1.40 llvm/docs/index.html:1.41 --- llvm/docs/index.html:1.40 Wed Jan 5 13:01:20 2005 +++ llvm/docs/index.html Fri Jan 7 11:00:44 2005 @@ -184,7 +184,7 @@ LLVM - This document describes the design and philosophy behind the LLVM source-level debugger. -
  • bugpoint - automatic bug finder and test-case +
  • Bugpoint - automatic bug finder and test-case reducer description and usage information.
  • Compiler Driver (llvmc) - This document @@ -234,6 +234,6 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"> LLVM Compiler Infrastructure
    - Last modified: $Date: 2005/01/05 19:01:20 $ + Last modified: $Date: 2005/01/07 17:00:44 $ From lattner at cs.uiuc.edu Fri Jan 7 12:55:44 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jan 2005 12:55:44 -0600 Subject: [llvm-commits] CVS: llvm-www/OpenProjects.html Message-ID: <200501071855.j07Itiil021556@apoc.cs.uiuc.edu> Changes in directory llvm-www: OpenProjects.html added (r1.1) --- Log message: New open projects doc, largely the same as docs/OpenProjects.html, but cleaned up and converted to www_* instead of doc_*. --- Diffs of the changes: (+379 -0) Index: llvm-www/OpenProjects.html diff -c /dev/null llvm-www/OpenProjects.html:1.1 *** /dev/null Fri Jan 7 12:55:39 2005 --- llvm-www/OpenProjects.html Fri Jan 7 12:55:28 2005 *************** *** 0 **** --- 1,379 ---- + + +
    Open LLVM Projects
    + + + +
    +

    Written by the LLVM Team

    +
    + + + + + + +
    + +

    This document is meant to be a sort of "big TODO list" for LLVM. Each + project in this document is something that would be useful for LLVM to have, and + would also be a great way to get familiar with the system. Some of these + projects are small and self-contained, which may be implemented in a couple of + days, others are larger. Several of these projects may lead to interesting + research projects in their own right. In any case, we welcome all + contributions.

    + +

    If you are thinking about tackling one of these projects, please send a mail + to the LLVM + Developer's mailing list, so that we know the project is being worked on. + Additionally this is a good way to get more information about a specific project + or to suggest other projects to add to this page. +

    + +

    The projects in this page are open-ended. More specific projects are + filed as unassigned enhancements in the + LLVM bug tracker. See the list of currently outstanding issues if you wish to help improve LLVM.

    + +
    + + + + + +
    + +

    Improvements to the current infrastructure are always very welcome and tend + to be fairly straight-forward to implement. Here are some of the key areas that + can use improvement...

    + +
    + + + + +
    + +

    + The LLVM bug tracker occasionally + has "code-cleanup" bugs filed in it. Taking one of these and fixing it is a good + way to get your feet wet in the LLVM code and discover how some of its components + work. +

    + +
    + + + + +
    + +

    It would be very useful to port glibc to LLVM. This would allow a + variety of interprocedural algorithms to be much more effective in the face of + library calls. The most important pieces to port are things like the string + library and the stdio related functions... low-level system calls like + 'read' should stay unimplemented in LLVM.

    + +
    + + + + +
    + +

    We are always looking for new testcases and benchmarks for use with LLVM. In + particular, it is useful to try compiling your favorite C source code with LLVM. + If it doesn't compile, try to figure out why or report it to the llvm-bugs list. If you + get the program to compile, it would be extremely useful to convert the build + system to be compatible with the LLVM Programs testsuite so that we can check it + into CVS and the automated tester can use it to track progress of the + compiler.

    + +

    When testing a code, try running it with a variety of optimizations, and with + all the back-ends: CBE, llc, and lli.

    + +
    + + + + +
    + +
      +
    1. Add support for platform-independent prefetch support. The GCC prefetch project page + has a good survey of the prefetching capabilities of a variety of modern + processors.
    2. + +
    + +
    + + + + +
    + +

    Find benchmarks either using our test results or on your own, + where LLVM code generators do not produce optimal code or simply where another + compiler produces better code. Try to minimize the test case that demonstrates + the issue. Then, either submit a + bug with your testcase and the code that LLVM produces vs. the code that it + should produce, or even better, see if you can improve the code + generator and submit a patch. The basic idea is that it's generally quite easy + for us to fix performance problems if we know about them, but we generally don't + have the resources to go finding out why performance is bad.

    + +
    + + + + +
    + +
      +
    1. Rework the PassManager to be more flexible
    2. + +
    3. Some transformations and analyses only work on reducible flow graphs. It + would be nice to have a transformation which could be "required" by these passes + which makes irreducible graphs reducible. This can easily be accomplished + through code duplication. See Making Graphs Reducible + with Controlled Node Splitting and perhaps Nesting of Reducible and + Irreducible Loops.
    4. + +
    + +
    + + + + + +
    + +

    Sometimes creating new things is more fun than improving existing things. + These projects tend to be more involved and perhaps require more work, but can + also be very rewarding.

    + +
    + + + + + +
    + +

    Many ideas for feature requests are stored in LLVM bugzilla. Just search for bugs with a "new-feature" keyword.

    + +
    + + + + +
    + +

    We have a strong base for development of + both pointer analysis based optimizations as well as pointer analyses + themselves. It seems natural to want to take advantage of this...

    + +
      +
    1. Implement a flow-sensitive context-sensitive alias analysis algorithm
      + - Pick one of the somewhat efficient algorithms, but strive for maximum + precision
    2. + +
    3. Implement a flow-sensitive context-insensitive alias analysis algorithm
      + - Just an efficient local algorithm perhaps?
    4. + +
    5. Implement new alias-analysis-based optimizations.
    6. +
    + +
    + + + + +
    + +

    We now have a unified infrastructure for writing profile-guided + transformations, which will work either at offline-compile-time or in the JIT, + but we don't have many transformations. We would welcome new profile-guided + transformations as well as improvements to the current profiling system. +

    + +

    Ideas for profile-guided transformations:

    + +
      +
    1. Superblock formation (with many optimizations)
    2. +
    3. Loop unrolling/peeling
    4. +
    5. Profile directed inlining
    6. +
    7. Code layout
    8. +
    9. ...
    10. +
    + +

    Improvements to the existing support:

    + +
      +
    1. The current block and edge profiling code that gets inserted is very simple + and inefficient. Through the use of control-dependence information, many fewer + counters could be inserted into the code. Also, if the execution count of a + loop is known to be a compile-time or runtime constant, all of the counters in + the loop could be avoided.
    2. + +
    3. You could implement one of the "static profiling" algorithms which analyze a + piece of code an make educated guesses about the relative execution frequencies + of various parts of the code.
    4. + +
    5. You could add path profiling support, or adapt the existing LLVM path + profiling code to work with the generic profiling interfaces.
    6. +
    + +
    + + + + +
    + +
      +
    1. Implement GVN-PRE, a + powerful and simple Partial Redundancy Elimination algorithm for SSA form
    2. +
    3. Implement a Dependence Analysis Infrastructure
      + - Design some way to represent and query dep analysis
    4. +
    5. Implement a strength reduction pass
    6. +
    7. Value range propagation pass
    8. +
    + +
    + + + + +
    + +
      +
    1. Improve the instruction selectors.
    2. +
    3. Implement support for the "switch" instruction without requiring the + lower-switches pass.
    4. +
    5. Implement interprocedural register allocation. The CallGraphSCCPass can be + used to implement a bottom-up analysis that will determine the *actual* + registers clobbered by a function. Use the pass to fine tune register usage + in callers based on *actual* registers used by the callee.
    6. +
    7. Write a new backend for a target (IA64? MIPS? MMIX?)
    8. +
    9. Improve the usefulness and utility of the Skeleton target backend: +
        +
      • Convert the non-functional Skeleton target to become an abstract machine + target (choose some simple instructions, a register set, etc). This will + become a much more useful example of a backend since it would be a simple + but functional backend. Examples of such architectures include MIX, + MMIX, DLX, + or come up with your own!
      • +
      • Use the new Skeleton backend in the Interpreter: compile LLVM to Skeleton + target, and then interpret that code instead of LLVM. Performance win would + be the primary goal, as the number of registers would be a small constant + instead of unbounded, for example.
      • +
    10. +
    + +
    + + + + +
    + +
      +
    1. Port the Bigloo + Scheme compiler, from Manuel Serrano at INRIA Sophia-Antipolis, to + output LLVM bytecode. It seems that it can already output .NET + bytecode, JVM bytecode, and C, so LLVM would ostensibly be another good + candidate.
    2. +
    3. Write a new frontend for C/C++ in C++, giving us the ability to + directly use LLVM C++ classes from within a compiler rather than use + C-based wrapper functions a la llvm-gcc. One possible starting point is the C++ + yacc grammar by Ed Willink.
    4. +
    5. Write a new frontend for some other language (Java? OCaml? Forth?)
    6. +
    7. Write a disassembler for machine code that would use TableGen to output + MachineInstrs for transformations, optimizations, etc.
    8. +
    9. Random test vector generator: Use a C grammar to generate random C code; + run it through llvm-gcc, then run a random set of passes on it using opt. + Try to crash opt. When opt crashes, use bugpoint to reduce the test case and + mail the result to yourself. Repeat ad infinitum.
    10. +
    11. Design a simple, recognizable logo.
    12. +
    + +
    + + + +
    +
    + Valid CSS! + Valid HTML 4.01! + + LLVM Compiler Infrastructure
    + Last modified: $Date: 2005/01/07 18:55:28 $ +
    + + From lattner at cs.uiuc.edu Fri Jan 7 12:57:47 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jan 2005 12:57:47 -0600 Subject: [llvm-commits] CVS: llvm/docs/index.html OpenProjects.html Message-ID: <200501071857.j07IvlSS021862@apoc.cs.uiuc.edu> Changes in directory llvm/docs: index.html updated: 1.41 -> 1.42 OpenProjects.html (r1.40) removed --- Log message: Remove the open projects page from the docs directory. --- Diffs of the changes: (+1 -5) Index: llvm/docs/index.html diff -u llvm/docs/index.html:1.41 llvm/docs/index.html:1.42 --- llvm/docs/index.html:1.41 Fri Jan 7 11:00:44 2005 +++ llvm/docs/index.html Fri Jan 7 12:57:33 2005 @@ -128,10 +128,6 @@ Details the LLVM coding standards and provides useful information on writing efficient C++ code.
  • -
  • Open Projects - Look here if you are -interested in doing something with LLVM but aren't sure what needs to be -done.
  • -
  • Extending LLVM - Look here to see how to add instructions and intrinsics to LLVM.
  • @@ -234,6 +230,6 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"> LLVM Compiler Infrastructure
    - Last modified: $Date: 2005/01/07 17:00:44 $ + Last modified: $Date: 2005/01/07 18:57:33 $ From lattner at cs.uiuc.edu Fri Jan 7 12:58:56 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jan 2005 12:58:56 -0600 Subject: [llvm-commits] CVS: llvm-www/OldNews.html Message-ID: <200501071858.j07Iwu27022786@apoc.cs.uiuc.edu> Changes in directory llvm-www: OldNews.html updated: 1.1 -> 1.2 --- Log message: Adjust link --- Diffs of the changes: (+1 -1) Index: llvm-www/OldNews.html diff -u llvm-www/OldNews.html:1.1 llvm-www/OldNews.html:1.2 --- llvm-www/OldNews.html:1.1 Tue Nov 18 17:04:53 2003 +++ llvm-www/OldNews.html Fri Jan 7 12:58:44 2005 @@ -29,7 +29,7 @@ Feb 6, 2003 - Added a new - open projects + open projects page, listing some desired improvements to LLVM. From jeffc at jolt-lang.org Fri Jan 7 13:22:00 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Fri, 7 Jan 2005 13:22:00 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/SelectionDAGNodes.h Message-ID: <200501071922.NAA07351@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: SelectionDAGNodes.h updated: 1.2 -> 1.3 --- Log message: Fix include. Too easy to make mistakes like this on Windows :( --- Diffs of the changes: (+1 -1) Index: llvm/include/llvm/CodeGen/SelectionDAGNodes.h diff -u llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.2 llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.3 --- llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.2 Fri Jan 7 09:52:36 2005 +++ llvm/include/llvm/CodeGen/SelectionDAGNodes.h Fri Jan 7 13:21:49 2005 @@ -20,7 +20,7 @@ #define LLVM_CODEGEN_SELECTIONDAGNODES_H #include "llvm/CodeGen/ValueTypes.h" -#include "llvm/support/DataTypes.h" +#include "llvm/Support/DataTypes.h" #include #include From lattner at cs.uiuc.edu Fri Jan 7 13:55:09 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jan 2005 13:55:09 -0600 Subject: [llvm-commits] CVS: llvm-www/www-index.html Message-ID: <200501071955.j07Jt9sc023267@apoc.cs.uiuc.edu> Changes in directory llvm-www: www-index.html updated: 1.118 -> 1.119 --- Log message: Add a link to the open-projects list. --- Diffs of the changes: (+2 -1) Index: llvm-www/www-index.html diff -u llvm-www/www-index.html:1.118 llvm-www/www-index.html:1.119 --- llvm-www/www-index.html:1.118 Thu Dec 9 16:58:11 2004 +++ llvm-www/www-index.html Fri Jan 7 13:54:54 2005 @@ -59,7 +59,8 @@ href="ProjectsWithLLVM/">list of projects which have used LLVM for various purposes, showing that you can get up-and-running quickly with LLVM, giving time to do interesting things, even if you only have a semester in a University -course.

    +course. We also have a list of ideas for +projects in LLVM.

    LLVM was started by the Lifelong Code From brukman at cs.uiuc.edu Fri Jan 7 13:55:20 2005 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri, 7 Jan 2005 13:55:20 -0600 Subject: [llvm-commits] CVS: CVSROOT/loginfo Message-ID: <200501071955.NAA07975@zion.cs.uiuc.edu> Changes in directory CVSROOT: loginfo updated: 1.9 -> 1.10 --- Log message: llvm-www module gone --- Diffs of the changes: (+0 -2) Index: CVSROOT/loginfo diff -u CVSROOT/loginfo:1.9 CVSROOT/loginfo:1.10 --- CVSROOT/loginfo:1.9 Wed Oct 20 19:57:22 2004 +++ CVSROOT/loginfo Fri Jan 7 13:55:09 2005 @@ -25,8 +25,6 @@ # or #DEFAULT (echo ""; id; echo %{sVv}; date; cat) >> $CVSROOT/CVSROOT/commitlog -# Automatically update the webpages -^llvm-www (/home/vadve/shared/InternalCVS/CVSROOT/update-www.sh &); /home/vadve/shared/PublicCVS/CVSROOT/commit-diffs.pl %{sVv} llvm-commits at cs.uiuc.edu ^reopt /home/vadve/shared/PublicCVS/CVSROOT/commit-diffs.pl %{sVv} llvm-commits at cs.uiuc.edu ^llva-emu /home/vadve/shared/PublicCVS/CVSROOT/commit-diffs.pl %{sVv} llvm-emu at nondot.org ^llvm-java /home/vadve/shared/PublicCVS/CVSROOT/commit-diffs.pl %{sVv} llvm-commits at cs.uiuc.edu From lattner at cs.uiuc.edu Fri Jan 7 15:09:09 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jan 2005 15:09:09 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/SelectionDAG.h SelectionDAGNodes.h Message-ID: <200501072109.j07L99p9025952@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: SelectionDAG.h updated: 1.7 -> 1.8 SelectionDAGNodes.h updated: 1.3 -> 1.4 --- Log message: Add a new SelectionDAG::RemoveDeadNodes method --- Diffs of the changes: (+20 -1) Index: llvm/include/llvm/CodeGen/SelectionDAG.h diff -u llvm/include/llvm/CodeGen/SelectionDAG.h:1.7 llvm/include/llvm/CodeGen/SelectionDAG.h:1.8 --- llvm/include/llvm/CodeGen/SelectionDAG.h:1.7 Fri Jan 7 01:45:38 2005 +++ llvm/include/llvm/CodeGen/SelectionDAG.h Fri Jan 7 15:08:55 2005 @@ -93,6 +93,12 @@ /// the graph. void Legalize(TargetLowering &TLI); + /// RemoveDeadNodes - This method deletes all unreachable nodes in the + /// SelectionDAG, including nodes (like loads) that have uses of their token + /// chain but no other uses and no side effect. If a node is passed in as an + /// argument, it is used as the seed for node deletion. + void RemoveDeadNodes(SDNode *N = 0); + SDOperand getConstant(uint64_t Val, MVT::ValueType VT); SDOperand getConstantFP(double Val, MVT::ValueType VT); SDOperand getGlobalAddress(const GlobalValue *GV, MVT::ValueType VT); @@ -150,6 +156,9 @@ } void dump() const; + +private: + void DeleteNodeIfDead(SDNode *N, void *NodeSet); }; } Index: llvm/include/llvm/CodeGen/SelectionDAGNodes.h diff -u llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.3 llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.4 --- llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.3 Fri Jan 7 13:21:49 2005 +++ llvm/include/llvm/CodeGen/SelectionDAGNodes.h Fri Jan 7 15:08:55 2005 @@ -409,6 +409,17 @@ void setValueTypes(std::vector &VTs) { std::swap(Values, VTs); } + + void removeUser(SDNode *User) { + // Remove this user from the operand's use list. + for (unsigned i = Uses.size(); ; --i) { + assert(i != 0 && "Didn't find user!"); + if (Uses[i-1] == User) { + Uses.erase(Uses.begin()+i-1); + break; + } + } + } }; @@ -498,7 +509,6 @@ GlobalAddressSDNode(const GlobalValue *GA, MVT::ValueType VT) : SDNode(ISD::GlobalAddress, VT) { TheGlobal = const_cast(GA); - } public: From lattner at cs.uiuc.edu Fri Jan 7 15:09:49 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jan 2005 15:09:49 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200501072109.j07L9n2f025971@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.2 -> 1.3 --- Log message: After legalizing a DAG, delete dead nodes to save space. --- Diffs of the changes: (+1 -6) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.2 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.3 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.2 Fri Jan 7 02:19:42 2005 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Fri Jan 7 15:09:37 2005 @@ -167,7 +167,6 @@ setValueTypeAction(MVT::f32, Promote); } - void SelectionDAGLegalize::LegalizeDAG() { SDOperand OldRoot = DAG.getRoot(); SDOperand NewRoot = LegalizeOp(OldRoot); @@ -177,11 +176,7 @@ LegalizedNodes.clear(); // Remove dead nodes now. - if (OldRoot != NewRoot) - // Delete all of these efficiently first. - ; - - // Then scan AllNodes. + DAG.RemoveDeadNodes(OldRoot.Val); } SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) { From lattner at cs.uiuc.edu Fri Jan 7 15:09:59 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jan 2005 15:09:59 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200501072109.j07L9xcP025977@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.8 -> 1.9 --- Log message: Implement RemoveDeadNodes --- Diffs of the changes: (+119 -0) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.8 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.9 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.8 Fri Jan 7 01:46:32 2005 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Fri Jan 7 15:09:16 2005 @@ -17,6 +17,7 @@ #include "llvm/Assembly/Writer.h" #include "llvm/CodeGen/MachineBasicBlock.h" #include +#include #include using namespace llvm; @@ -98,6 +99,124 @@ return ISD::CondCode(Op1 & Op2); } +/// RemoveDeadNodes - This method deletes all unreachable nodes in the +/// SelectionDAG, including nodes (like loads) that have uses of their token +/// chain but no other uses and no side effect. If a node is passed in as an +/// argument, it is used as the seed for node deletion. +void SelectionDAG::RemoveDeadNodes(SDNode *N) { + std::set AllNodeSet(AllNodes.begin(), AllNodes.end()); + + // Create a dummy node (which is not added to allnodes), that adds a reference + // to the root node, preventing it from being deleted. + SDNode *DummyNode = new SDNode(ISD::EntryToken, getRoot()); + + DeleteNodeIfDead(N, &AllNodeSet); + + Restart: + unsigned NumNodes = AllNodeSet.size(); + for (std::set::iterator I = AllNodeSet.begin(), E = AllNodeSet.end(); + I != E; ++I) { + // Try to delete this node. + DeleteNodeIfDead(*I, &AllNodeSet); + + // If we actually deleted any nodes, do not use invalid iterators in + // AllNodeSet. + if (AllNodeSet.size() != NumNodes) + goto Restart; + } + + // Restore AllNodes. + if (AllNodes.size() != NumNodes) + AllNodes.assign(AllNodeSet.begin(), AllNodeSet.end()); + + // If the root changed (e.g. it was a dead load, update the root). + setRoot(DummyNode->getOperand(0)); + + // Now that we are done with the dummy node, delete it. + DummyNode->getOperand(0).Val->removeUser(DummyNode); + delete DummyNode; +} + +void SelectionDAG::DeleteNodeIfDead(SDNode *N, void *NodeSet) { + if (!N->use_empty()) + return; + + // Okay, we really are going to delete this node. First take this out of the + // appropriate CSE map. + switch (N->getOpcode()) { + case ISD::Constant: + Constants.erase(std::make_pair(cast(N)->getValue(), + N->getValueType(0))); + break; + case ISD::ConstantFP: + ConstantFPs.erase(std::make_pair(cast(N)->getValue(), + N->getValueType(0))); + break; + case ISD::GlobalAddress: + GlobalValues.erase(cast(N)->getGlobal()); + break; + case ISD::FrameIndex: + FrameIndices.erase(cast(N)->getIndex()); + break; + case ISD::ConstantPool: + ConstantPoolIndices.erase(cast(N)->getIndex()); + break; + case ISD::BasicBlock: + BBNodes.erase(cast(N)->getBasicBlock()); + break; + case ISD::ExternalSymbol: + ExternalSymbols.erase(cast(N)->getSymbol()); + break; + + case ISD::LOAD: + Loads.erase(std::make_pair(N->getOperand(1), + std::make_pair(N->getOperand(0), + N->getValueType(0)))); + break; + case ISD::SETCC: + SetCCs.erase(std::make_pair(std::make_pair(N->getOperand(0), + N->getOperand(1)), + cast(N)->getCondition())); + break; + default: + if (N->getNumOperands() == 1) + UnaryOps.erase(std::make_pair(N->getOpcode(), + std::make_pair(N->getOperand(0), + N->getValueType(0)))); + else if (N->getNumOperands() == 2) + BinaryOps.erase(std::make_pair(N->getOpcode(), + std::make_pair(N->getOperand(0), + N->getOperand(1)))); + break; + } + + // Next, brutally remove the operand list. + std::vector Operands; + while (!N->Operands.empty()) { + SDOperand O = N->Operands.back(); + N->Operands.pop_back(); + Operands.push_back(O.Val); + O.Val->removeUser(N); + } + + // Remove the node from the nodes set and delete it. + std::set &AllNodeSet = *(std::set*)NodeSet; + AllNodeSet.erase(N); + delete N; + + // Now that the node is gone, check to see if any of the operands of this node + // are dead now. + + // Remove duplicate operand entries. + std::sort(Operands.begin(), Operands.end()); + Operands.erase(std::unique(Operands.begin(), Operands.end()), + Operands.end()); + + for (unsigned i = 0, e = Operands.size(); i != e; ++i) + DeleteNodeIfDead(Operands[i], NodeSet); +} + + SelectionDAG::~SelectionDAG() { for (unsigned i = 0, e = AllNodes.size(); i != e; ++i) delete AllNodes[i]; From lattner at cs.uiuc.edu Fri Jan 7 15:16:12 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jan 2005 15:16:12 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/Generic/fwdtwice.ll Message-ID: <200501072116.j07LGC64026021@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/Generic: fwdtwice.ll updated: 1.2 -> 1.3 --- Log message: modernize and clean up this test. --- Diffs of the changes: (+6 -13) Index: llvm/test/Regression/CodeGen/Generic/fwdtwice.ll diff -u llvm/test/Regression/CodeGen/Generic/fwdtwice.ll:1.2 llvm/test/Regression/CodeGen/Generic/fwdtwice.ll:1.3 --- llvm/test/Regression/CodeGen/Generic/fwdtwice.ll:1.2 Sat Nov 6 17:05:53 2004 +++ llvm/test/Regression/CodeGen/Generic/fwdtwice.ll Fri Jan 7 15:15:58 2005 @@ -13,23 +13,16 @@ ;; This came from %bb1 of sumarrray.ll generated from sumarray.c. -;;;; ****************************************************** -implementation -;;;; ****************************************************** - -int "SumArray"(int %Num) -begin -bb0: ;[#uses=3] +int %SumArray(int %Num) { + %Num = alloca int br label %Top Top: - %Num = alloca int ; [#uses=2] store int %Num, int * %Num - %reg108 = load int * %Num ; [#uses=2] - %cast1006 = cast int %reg108 to uint ; [#uses=1] - %cond1001 = setle uint %cast1006, 0 ; [#uses=1] + %reg108 = load int * %Num + %cast1006 = cast int %reg108 to uint + %cond1001 = setle uint %cast1006, 0 br bool %cond1001, label %bb6, label %Top bb6: ret int 42 -end - +} From lattner at cs.uiuc.edu Fri Jan 7 15:34:27 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jan 2005 15:34:27 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200501072134.j07LYRl4027014@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.3 -> 1.4 --- Log message: Fix a bug legalizing calls --- Diffs of the changes: (+1 -1) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.3 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.4 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.3 Fri Jan 7 15:09:37 2005 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Fri Jan 7 15:34:13 2005 @@ -295,7 +295,7 @@ std::vector RetTyVTs; RetTyVTs.reserve(Node->getNumValues()); for (unsigned i = 0, e = Node->getNumValues(); i != e; ++i) - RetTyVTs.push_back(Node->getValueType(0)); + RetTyVTs.push_back(Node->getValueType(i)); Result = SDOperand(DAG.getCall(RetTyVTs, Tmp1, Tmp2), Op.ResNo); } break; From lattner at cs.uiuc.edu Fri Jan 7 15:34:31 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jan 2005 15:34:31 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200501072134.j07LYV19027022@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.1 -> 1.2 --- Log message: Fix handling of dead PHI nodes. --- Diffs of the changes: (+30 -26) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.1 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.2 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.1 Fri Jan 7 01:47:53 2005 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Fri Jan 7 15:34:19 2005 @@ -141,13 +141,15 @@ // appropriate. PHINode *PN; for (BasicBlock::iterator I = BB->begin(); - (PN = dyn_cast(I)); ++I) { - unsigned NumElements =TLI.getNumElements(TLI.getValueType(PN->getType())); - unsigned PHIReg = ValueMap[PN]; - assert(PHIReg && "PHI node does not have an assigned virtual register!"); - for (unsigned i = 0; i != NumElements; ++i) - BuildMI(MBB, TargetInstrInfo::PHI, PN->getNumOperands(), PHIReg+i); - } + (PN = dyn_cast(I)); ++I) + if (!PN->use_empty()) { + unsigned NumElements = + TLI.getNumElements(TLI.getValueType(PN->getType())); + unsigned PHIReg = ValueMap[PN]; + assert(PHIReg &&"PHI node does not have an assigned virtual register!"); + for (unsigned i = 0; i != NumElements; ++i) + BuildMI(MBB, TargetInstrInfo::PHI, PN->getNumOperands(), PHIReg+i); + } } } @@ -786,27 +788,29 @@ // nodes and Machine PHI nodes, but the incoming operands have not been // emitted yet. for (BasicBlock::iterator I = SuccBB->begin(); - (PN = dyn_cast(I)); ++I) { - unsigned Reg; - Value *PHIOp = PN->getIncomingValueForBlock(LLVMBB); - if (Constant *C = dyn_cast(PHIOp)) { - unsigned &RegOut = ConstantsOut[C]; - if (RegOut == 0) { - RegOut = FuncInfo.CreateRegForValue(C); - CopyValueToVirtualRegister(SDL, C, RegOut); + (PN = dyn_cast(I)); ++I) + if (!PN->use_empty()) { + unsigned Reg; + Value *PHIOp = PN->getIncomingValueForBlock(LLVMBB); + if (Constant *C = dyn_cast(PHIOp)) { + unsigned &RegOut = ConstantsOut[C]; + if (RegOut == 0) { + RegOut = FuncInfo.CreateRegForValue(C); + CopyValueToVirtualRegister(SDL, C, RegOut); + } + Reg = RegOut; + } else { + Reg = FuncInfo.ValueMap[PHIOp]; + assert(Reg && "Didn't codegen value into a register!??"); } - Reg = RegOut; - } else { - Reg = FuncInfo.ValueMap[PHIOp]; - assert(Reg && "Didn't codegen value into a register!??"); + + // Remember that this register needs to added to the machine PHI node as + // the input for this MBB. + unsigned NumElements = + TLI.getNumElements(TLI.getValueType(PN->getType())); + for (unsigned i = 0, e = NumElements; i != e; ++i) + PHINodesToUpdate.push_back(std::make_pair(MBBI++, Reg+i)); } - - // Remember that this register needs to added to the machine PHI node as - // the input for this MBB. - unsigned NumElements =TLI.getNumElements(TLI.getValueType(PN->getType())); - for (unsigned i = 0, e = NumElements; i != e; ++i) - PHINodesToUpdate.push_back(std::make_pair(MBBI++, Reg+i)); - } } ConstantsOut.clear(); From lattner at cs.uiuc.edu Fri Jan 7 15:35:45 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jan 2005 15:35:45 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200501072135.j07LZjpp027310@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.4 -> 1.5 --- Log message: Fix another bug legalizing calls! --- Diffs of the changes: (+1 -1) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.4 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.5 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.4 Fri Jan 7 15:34:13 2005 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Fri Jan 7 15:35:32 2005 @@ -291,7 +291,7 @@ case ISD::CALL: Tmp1 = LegalizeOp(Node->getOperand(0)); // Legalize the chain. Tmp2 = LegalizeOp(Node->getOperand(1)); // Legalize the callee. - if (Tmp2 != Node->getOperand(0) || Tmp2 != Node->getOperand(1)) { + if (Tmp1 != Node->getOperand(0) || Tmp2 != Node->getOperand(1)) { std::vector RetTyVTs; RetTyVTs.reserve(Node->getNumValues()); for (unsigned i = 0, e = Node->getNumValues(); i != e; ++i) From lattner at cs.uiuc.edu Fri Jan 7 15:37:26 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jan 2005 15:37:26 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/Generic/ConstantExprLowering.llx Message-ID: <200501072137.j07LbQ5x027353@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/Generic: ConstantExprLowering.llx updated: 1.1 -> 1.2 --- Log message: Make this test a bit more interesting by making there actually be a use of the PHI node. --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/CodeGen/Generic/ConstantExprLowering.llx diff -u llvm/test/Regression/CodeGen/Generic/ConstantExprLowering.llx:1.1 llvm/test/Regression/CodeGen/Generic/ConstantExprLowering.llx:1.2 --- llvm/test/Regression/CodeGen/Generic/ConstantExprLowering.llx:1.1 Fri Jun 25 02:47:13 2004 +++ llvm/test/Regression/CodeGen/Generic/ConstantExprLowering.llx Fri Jan 7 15:37:13 2005 @@ -20,7 +20,7 @@ int cast (int* %XB to int) ), %less], [ sub ( int cast (int* %XA to int), int cast (int* %XB to int) ), %entry] - %tmp.39 = call int (sbyte*, ...)* %printf( sbyte* getelementptr ([16 x sbyte]* %.str_1, long 0, long 0) ) ; [#uses=0] + %tmp.39 = call int (sbyte*, ...)* %printf( sbyte* getelementptr ([16 x sbyte]* %.str_1, long 0, long 0), int %t2 ) ret void } From lattner at cs.uiuc.edu Fri Jan 7 15:46:08 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jan 2005 15:46:08 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200501072146.j07Lk8fG029871@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.5 -> 1.6 --- Log message: implement legalization of a bunch more operators. --- Diffs of the changes: (+6 -0) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.5 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.6 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.5 Fri Jan 7 15:35:32 2005 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Fri Jan 7 15:45:56 2005 @@ -224,6 +224,7 @@ case ISD::EntryToken: case ISD::FrameIndex: case ISD::GlobalAddress: + case ISD::ExternalSymbol: case ISD::ConstantPool: case ISD::CopyFromReg: // Nothing to do. assert(getTypeAction(Node->getValueType(0)) == Legal && @@ -517,6 +518,9 @@ case ISD::AND: case ISD::OR: case ISD::XOR: + case ISD::SHL: + case ISD::SRL: + case ISD::SRA: Tmp1 = LegalizeOp(Node->getOperand(0)); // LHS Tmp2 = LegalizeOp(Node->getOperand(1)); // RHS if (Tmp1 != Node->getOperand(0) || @@ -525,6 +529,8 @@ break; case ISD::ZERO_EXTEND: case ISD::SIGN_EXTEND: + case ISD::FP_EXTEND: + case ISD::FP_ROUND: switch (getTypeAction(Node->getOperand(0).getValueType())) { case Legal: Tmp1 = LegalizeOp(Node->getOperand(0)); From lattner at cs.uiuc.edu Fri Jan 7 15:57:09 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jan 2005 15:57:09 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200501072157.j07Lv96N030778@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.9 -> 1.10 --- Log message: Simplify: truncate ({zero|sign}_extend (X)) --- Diffs of the changes: (+9 -0) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.9 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.10 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.9 Fri Jan 7 15:09:16 2005 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Fri Jan 7 15:56:24 2005 @@ -428,6 +428,15 @@ if (Operand.getValueType() == VT) return Operand; // noop truncate if (OpOpcode == ISD::TRUNCATE) return getNode(ISD::TRUNCATE, VT, Operand.Val->getOperand(0)); + else if (OpOpcode == ISD::ZERO_EXTEND || OpOpcode == ISD::SIGN_EXTEND) { + // If the source is smaller than the dest, we still need an extend. + if (Operand.Val->getOperand(0).getValueType() < VT) + return getNode(OpOpcode, VT, Operand.Val->getOperand(0)); + else if (Operand.Val->getOperand(0).getValueType() > VT) + return getNode(ISD::TRUNCATE, VT, Operand.Val->getOperand(0)); + else + return Operand.Val->getOperand(0); + } break; } From lattner at cs.uiuc.edu Fri Jan 7 15:57:10 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jan 2005 15:57:10 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp SelectionDAGISel.cpp Message-ID: <200501072157.j07LvArS030787@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.6 -> 1.7 SelectionDAGISel.cpp updated: 1.2 -> 1.3 --- Log message: Implement support for long GEP indices on 32-bit archs and support for int GEP indices on 64-bit archs. --- Diffs of the changes: (+15 -3) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.6 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.7 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.6 Fri Jan 7 15:45:56 2005 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Fri Jan 7 15:56:57 2005 @@ -529,6 +529,7 @@ break; case ISD::ZERO_EXTEND: case ISD::SIGN_EXTEND: + case ISD::TRUNCATE: case ISD::FP_EXTEND: case ISD::FP_ROUND: switch (getTypeAction(Node->getOperand(0).getValueType())) { Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.2 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.3 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.2 Fri Jan 7 15:34:19 2005 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Fri Jan 7 15:56:57 2005 @@ -477,9 +477,20 @@ if (!isa(Idx) || !cast(Idx)->isNullValue()) { // N = N + Idx * ElementSize; uint64_t ElementSize = TD.getTypeSize(Ty); - SDOperand IdxN = getValue(Idx); - IdxN = DAG.getNode(ISD::MUL, N.getValueType(), IdxN, - getIntPtrConstant(ElementSize)); + SDOperand IdxN = getValue(Idx), Scale = getIntPtrConstant(ElementSize); + + // If the index is smaller or larger than intptr_t, truncate or extend + // it. + if (IdxN.getValueType() < Scale.getValueType()) { + if (Idx->getType()->isSigned()) + IdxN = DAG.getNode(ISD::SIGN_EXTEND, Scale.getValueType(), IdxN); + else + IdxN = DAG.getNode(ISD::ZERO_EXTEND, Scale.getValueType(), IdxN); + } else if (IdxN.getValueType() > Scale.getValueType()) + IdxN = DAG.getNode(ISD::TRUNCATE, Scale.getValueType(), IdxN); + + IdxN = DAG.getNode(ISD::MUL, N.getValueType(), IdxN, Scale); + N = DAG.getNode(ISD::ADD, N.getValueType(), N, IdxN); } } From lattner at cs.uiuc.edu Fri Jan 7 16:05:45 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jan 2005 16:05:45 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/Generic/2003-05-27-phifcmpd.ll 2003-05-27-useboolinotherbb.ll 2003-05-27-usefsubasbool.ll 2003-05-28-ManyArgs.ll 2003-05-30-BadPreselectPhi.ll 2003-07-06-BadIntCmp.ll 2003-07-07-BadLongConst.ll 2003-07-08-BadCastToBool.ll badarg6.ll Message-ID: <200501072205.j07M5jSs030865@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/Generic: 2003-05-27-phifcmpd.ll updated: 1.2 -> 1.3 2003-05-27-useboolinotherbb.ll updated: 1.2 -> 1.3 2003-05-27-usefsubasbool.ll updated: 1.2 -> 1.3 2003-05-28-ManyArgs.ll updated: 1.2 -> 1.3 2003-05-30-BadPreselectPhi.ll updated: 1.2 -> 1.3 2003-07-06-BadIntCmp.ll updated: 1.2 -> 1.3 2003-07-07-BadLongConst.ll updated: 1.2 -> 1.3 2003-07-08-BadCastToBool.ll updated: 1.3 -> 1.4 badarg6.ll updated: 1.2 -> 1.3 --- Log message: Cleanup a bunch of tests. In particular do not allow target directives in the .ll file or it forces the V9 backend. This is the CodeGen/Generic dir, so there is no use in doing that. --- Diffs of the changes: (+6 -242) Index: llvm/test/Regression/CodeGen/Generic/2003-05-27-phifcmpd.ll diff -u llvm/test/Regression/CodeGen/Generic/2003-05-27-phifcmpd.ll:1.2 llvm/test/Regression/CodeGen/Generic/2003-05-27-phifcmpd.ll:1.3 --- llvm/test/Regression/CodeGen/Generic/2003-05-27-phifcmpd.ll:1.2 Sat Nov 6 17:05:53 2004 +++ llvm/test/Regression/CodeGen/Generic/2003-05-27-phifcmpd.ll Fri Jan 7 16:05:30 2005 @@ -1,61 +1,6 @@ ; RUN: llvm-as -f %s -o - | llc -;; Date: May 28, 2003. -;; From: test/Programs/MultiSource/McCat-05-eks/QRfact.c -;; Function: Matrix QRiterate(Matrix A, Matrix U) -;; -;; Error: llc produces an invalid register for the -;; phi argument %tmp.213 produced by fcmpd: -;; -;; LLC Output: -;; -;; !****** Outputing Function: QRiterate_1 ****** -;; -;; .section ".text" -;; .align 4 -;; .global QRiterate_1 -;; .type QRiterate_1, 2 -;; QRiterate_1: -;; .L_QRiterate_1_LL_0: -;; save %o6, -192, %o6 -;; brgz %i0, .L_QRiterate_1_LL_1 -;; add %g0, %g0, %o0 -;; ba .L_QRiterate_1_LL_2 -;; nop -;; -;; .L_QRiterate_1_LL_1: -;; sethi %lm(LLVMGlobal__2), %o1 -;; sethi %hh(LLVMGlobal__2), %o0 -;; or %o0, %hm(LLVMGlobal__2), %o0 -;; sllx %o0, 32, %o0 -;; or %o1, %o0, %o1 -;; or %o1, %lo(LLVMGlobal__2), %o1 -;; ldd [%o1+0], %f32 -;; fcmpd %fcc0, %f2, %f32 -;; ba .L_QRiterate_1_LL_2 -;; add , %g0, %o0 -;; -;; .L_QRiterate_1_LL_2: -;; brnz %o0, .L_QRiterate_1_LL_1 -;; nop -;; ba .L_QRiterate_1_LL_3 -;; nop -;; -;; .L_QRiterate_1_LL_3: -;; jmpl %i7+8, %g0 -;; restore %g0, 0, %g0 -;; -;; .EndOf_QRiterate_1: -;; .size QRiterate_1, .EndOf_QRiterate_1-QRiterate_1 -;; - - -target endian = big -target pointersize = 64 - -implementation ; Functions: - -internal void %QRiterate(int %p.1, double %tmp.212) { +void %QRiterate(int %p.1, double %tmp.212) { entry: ; No predecessors! %tmp.184 = setgt int %p.1, 0 ; [#uses=1] br bool %tmp.184, label %shortcirc_next.1, label %shortcirc_done.1 Index: llvm/test/Regression/CodeGen/Generic/2003-05-27-useboolinotherbb.ll diff -u llvm/test/Regression/CodeGen/Generic/2003-05-27-useboolinotherbb.ll:1.2 llvm/test/Regression/CodeGen/Generic/2003-05-27-useboolinotherbb.ll:1.3 --- llvm/test/Regression/CodeGen/Generic/2003-05-27-useboolinotherbb.ll:1.2 Sat Nov 6 17:05:53 2004 +++ llvm/test/Regression/CodeGen/Generic/2003-05-27-useboolinotherbb.ll Fri Jan 7 16:05:30 2005 @@ -1,59 +1,7 @@ ; RUN: llvm-as -f %s -o - | llc -;; Date: May 27, 2003. -;; From: Variant of 2003-05-27-usefsubasbool.ll -;; -;; Error: llc fails to save a boolean value in a register (and later uses an -;; invalid register in a BRNZ) for a boolean value -;; used only by branches but in a different basic block. -;; -;; Cause: In SparcInstrSelection.cpp, for SetCC, when a result of setCC -;; is used only for branches, it is not saved into an int. register. -;; But if the boolean is used in a branch in a different basic block, -;; that branch uses a BRNZ inst. instead of a branch-on-CC. -;; -;; LLC Output before fix: -;; !****** Outputing Function: QRiterate_1 ****** -;; -;; .section ".text" -;; .align 4 -;; .global QRiterate_1 -;; .type QRiterate_1, 2 -;; QRiterate_1: -;; .L_QRiterate_1_LL_0: -;; save %o6, -192, %o6 -;; sethi %lm(LLVMGlobal__2), %o2 -;; sethi %hh(LLVMGlobal__2), %o1 -;; or %o1, %hm(LLVMGlobal__2), %o1 -;; sllx %o1, 32, %o1 -;; or %o2, %o1, %o2 -;; or %o2, %lo(LLVMGlobal__2), %o2 -;; ldd [%o2+0], %f32 -;; fcmpd %fcc0, %f0, %f32 -;; ba .L_QRiterate_1_LL_1 -;; nop -;; -;; .L_QRiterate_1_LL_1: -;; brnz , .L_QRiterate_1_LL_1 -;; nop -;; ba .L_QRiterate_1_LL_2 -;; nop -;; -;; .L_QRiterate_1_LL_2: -;; jmpl %i7+8, %g0 -;; restore %g0, 0, %g0 -;; -;; .EndOf_QRiterate_1: -;; .size QRiterate_1, .EndOf_QRiterate_1-QRiterate_1 -;; -target endian = big -target pointersize = 64 - -implementation ; Functions: - -internal void %QRiterate(double %tmp.212) { -entry: ; No predecessors! +void %QRiterate(double %tmp.212) { %tmp.213 = setne double %tmp.212, 0.000000e+00 br label %shortcirc_next.1 Index: llvm/test/Regression/CodeGen/Generic/2003-05-27-usefsubasbool.ll diff -u llvm/test/Regression/CodeGen/Generic/2003-05-27-usefsubasbool.ll:1.2 llvm/test/Regression/CodeGen/Generic/2003-05-27-usefsubasbool.ll:1.3 --- llvm/test/Regression/CodeGen/Generic/2003-05-27-usefsubasbool.ll:1.2 Sat Nov 6 17:05:53 2004 +++ llvm/test/Regression/CodeGen/Generic/2003-05-27-usefsubasbool.ll Fri Jan 7 16:05:30 2005 @@ -1,58 +1,6 @@ ; RUN: llvm-as -f %s -o - | llc -;; Date: May 27, 2003. -;; From: test/Programs/MultiSource/McCat-05-eks/QRfact.c -;; Function: Matrix QRiterate(Matrix A, Matrix U) -;; -;; Error: llc produces an invalid register for the -;; a boolean value computed using setne with a double. -;; -;; Cause: In SparcInstrSelection.cpp, for SetCC, when a result of setne -;; is used for a branch, it can generate a "branch-on-integer-register" -;; for integer registers. In that case, it never saves the value of -;; the boolean result. It was attempting to do the same thing for an -;; FP compare! -;; -;; LLC Output: -;; !****** Outputing Function: QRiterate_1 ****** -;; -;; .section ".text" -;; .align 4 -;; .global QRiterate_1 -;; .type QRiterate_1, 2 -;; QRiterate_1: -;; .L_QRiterate_1_LL_0: -;; save %o6, -192, %o6 -;; sethi %hh(LLVMGlobal__2), %o1 -;; sethi %lm(LLVMGlobal__2), %o0 -;; or %o1, %hm(LLVMGlobal__2), %o1 -;; sllx %o1, 32, %o1 -;; or %o0, %o1, %o0 -;; or %o0, %lo(LLVMGlobal__2), %o0 -;; ldd [%o0+0], %f32 -;; ba .L_QRiterate_1_LL_1 -;; fcmpd %fcc0, %f0, %f32 -;; -;; .L_QRiterate_1_LL_1: -;; brnz , .L_QRiterate_1_LL_1 -;; nop -;; ba .L_QRiterate_1_LL_2 -;; nop -;; -;; .L_QRiterate_1_LL_2: -;; jmpl %i7+8, %g0 -;; restore %g0, 0, %g0 -;; -;; .EndOf_QRiterate_1: -;; .size QRiterate_1, .EndOf_QRiterate_1-QRiterate_1 -;; - -target endian = big -target pointersize = 64 - -implementation ; Functions: - -internal void %QRiterate(double %tmp.212) { +void %QRiterate(double %tmp.212) { entry: ; No predecessors! br label %shortcirc_next.1 Index: llvm/test/Regression/CodeGen/Generic/2003-05-28-ManyArgs.ll diff -u llvm/test/Regression/CodeGen/Generic/2003-05-28-ManyArgs.ll:1.2 llvm/test/Regression/CodeGen/Generic/2003-05-28-ManyArgs.ll:1.3 --- llvm/test/Regression/CodeGen/Generic/2003-05-28-ManyArgs.ll:1.2 Sat Nov 6 17:05:53 2004 +++ llvm/test/Regression/CodeGen/Generic/2003-05-28-ManyArgs.ll Fri Jan 7 16:05:31 2005 @@ -19,8 +19,6 @@ ;; and/or to stack locations as needed. ;; -target endian = little -target pointersize = 32 %struct..s_annealing_sched = type { uint, float, float, float, float } %struct..s_chan = type { uint, float, float, float, float } %struct..s_det_routing_arch = type { uint, float, float, float, uint, int, short, short, short, float, float } Index: llvm/test/Regression/CodeGen/Generic/2003-05-30-BadPreselectPhi.ll diff -u llvm/test/Regression/CodeGen/Generic/2003-05-30-BadPreselectPhi.ll:1.2 llvm/test/Regression/CodeGen/Generic/2003-05-30-BadPreselectPhi.ll:1.3 --- llvm/test/Regression/CodeGen/Generic/2003-05-30-BadPreselectPhi.ll:1.2 Sat Nov 6 17:05:53 2004 +++ llvm/test/Regression/CodeGen/Generic/2003-05-30-BadPreselectPhi.ll Fri Jan 7 16:05:31 2005 @@ -8,33 +8,7 @@ ;; the Phi instead of in predecessor blocks. This later ;; causes llc to produces an invalid register ;; for the phi arguments. -;; -;; PreSelection Output: -;; *** LLVM code after pre-selection for function handlerfn: -;; -;; -;; %struct..task* %handlerfn(%struct..packet*) { -;; ;

    LLVM Oversight Group Mission

    + +

    Introduction

    + + The LLVM Oversight Group is a small group of LLVM developers that aim to + guide continued development, distribution, and community-building for + LLVM. Our broad aim is to foster the wider adoption and growth of LLVM. + A key part of that is to encourage participation and contributions from + both UIUC and non-UIUC users. + +

    + We do not aim to create a bureaucracy. On the contrary, we believe + that having a simple but organized process for overseeing LLVM should give + more confidence to potential users and contributors in the stability and + longevity of LLVM, and therefore encourage them to get involved. Having a + well-understood process for major contributions should also encourage + developers to contribute their work and stay involved. + +

    Membership and Communication

    + + The oversight group currently consists of Chris Lattner, Vikram Adve, Reid + Spencer and Misha Brukman. Our goal for the membership of this group is to + have Chris, Vikram and two or three other active LLVM developers, + including at least one from academia and one from industry. + +

    You can send e-mail to the group at + + oversight at llvm.cs.uiuc.edu. + This alias only reaches the oversight group, and messages can be kept + confidential on request. Please use this alias for any feedback or + suggestions regarding LLVM policy issues outlined in the mission statement + below (rather than broadcasting them to llvmdev). + +

    Mission

    + + The primary goals of the LLVM oversight group are: +
      +
    • Functionality and Stability in the Core Framework: +
        +
      • Adjudicate substantial changes to the core LLVM components, + which essentially includes everything in llvm/lib/ + and the key llvm tools.
      • +
      • Identify and prioritize improvements to the core.
      • +
    • +

    • Guidelines for who gets write-access to CVS: +
        +
      • The goal here is to encourage the most active contributors by + giving them direct CVS write access.
      • +
      • Our primary guiding principle here is that write access should + be limited to persons who have a track record of responsible + contributions, and are likely to remain active contributors + for a long time (not for short-term projects).
      • +
    • +

    • Public Awareness: +
        +
      • Be proactive in finding opportunities to attract users + and developers.
      • +
      • Give/organize LLVM tutorials at conferences.
      • +
      • Create publicity for new releases.
      • +
    • +

    • Licensing and Copyright: +
        +
      • Oversee changes in LLVM licensing.
      • +
      • Oversee LLVM copyright ownership issues.
      • +
      • Attempt to ensure that we don't violate copyrights of other + software used by or in LLVM, or infringe patents, especially + unintentional violations due to contributed code.
      • +
    • +

    • Release Management: +
        +
      • Collect feedback on what users would like to see in future releases.
      • +
      • Provide a "best guess" page on what will be in the next release.
      • +
      • Manage quarterly releases.
      • +
    • +

    • Open Projects and Ongoing Projects: +
        +
      • Identify projects we would like to see happen.
      • +
      • Maintain public information about these projects and priorities + to guide interested developers.
      • +
      • Maintain public information about ongoing major projects to + avoid redundancy (and minimize a major source of conflict!).
      • +
    • +

    • Dispute Resolution: +
        +
      • Resolve TECHNICAL disputes between parties that are unable + to resolve the issues themselves.
      • +
    • + +
    + + + +
    +
    Vikram Adve
    + + + Last modified: Fri Jan 7 16:16:30 CST 2005 + + + From lattner at cs.uiuc.edu Fri Jan 7 16:29:02 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jan 2005 16:29:02 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200501072229.j07MT2ps000370@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.8 -> 1.9 --- Log message: Fix a bug in load expansion legalization and ret legalization. This fixes CodeGen/Generic/select.ll:castconst. --- Diffs of the changes: (+17 -9) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.8 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.9 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.8 Fri Jan 7 16:12:08 2005 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Fri Jan 7 16:28:47 2005 @@ -72,6 +72,11 @@ /// more than once. std::map > ExpandedNodes; + void AddLegalizedOperand(SDOperand From, SDOperand To) { + bool isNew = LegalizedNodes.insert(std::make_pair(From, To)).second; + assert(isNew && "Got into the map somehow?"); + } + /// setValueTypeAction - Set the action for a particular value type. This /// assumes an action has not already been set for this value type. void setValueTypeAction(MVT::ValueType VT, LegalizeAction A) { @@ -323,7 +328,14 @@ if (Tmp1 != Node->getOperand(0) || Tmp2 != Node->getOperand(1)) Result = DAG.getLoad(Node->getValueType(0), Tmp1, Tmp2); - break; + else + Result = SDOperand(Node, 0); + + // Since loads produce two values, make sure to remember that we legalized + // both of them. + AddLegalizedOperand(SDOperand(Node, 0), Result); + AddLegalizedOperand(SDOperand(Node, 1), Result.getValue(1)); + return Result.getValue(Op.ResNo); case ISD::EXTRACT_ELEMENT: // Get both the low and high parts. @@ -368,7 +380,7 @@ switch (getTypeAction(Node->getOperand(1).getValueType())) { case Legal: Tmp2 = LegalizeOp(Node->getOperand(1)); - if (Tmp2 != Node->getOperand(1)) + if (Tmp1 != Node->getOperand(0) || Tmp2 != Node->getOperand(1)) Result = DAG.getNode(ISD::RET, MVT::Other, Tmp1, Tmp2); break; case Expand: { @@ -550,10 +562,8 @@ break; } - if (!Op.Val->hasOneUse()) { - bool isNew = LegalizedNodes.insert(std::make_pair(Op, Result)).second; - assert(isNew && "Got into the map somehow?"); - } + if (!Op.Val->hasOneUse()) + AddLegalizedOperand(Op, Result); return Result; } @@ -632,9 +642,7 @@ Hi = DAG.getLoad(NVT, Lo.getValue(1), Ptr); // Remember that we legalized the chain. - bool isNew = LegalizedNodes.insert(std::make_pair(Op.getValue(1), - Hi.getValue(1))).second; - assert(isNew && "This node was already legalized!"); + AddLegalizedOperand(Op.getValue(1), Hi.getValue(1)); if (!TLI.isLittleEndian()) std::swap(Lo, Hi); break; From lattner at cs.uiuc.edu Fri Jan 7 16:38:03 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jan 2005 16:38:03 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200501072238.j07Mc3Uv000864@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.9 -> 1.10 --- Log message: Add support for truncating integer casts from long. --- Diffs of the changes: (+13 -1) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.9 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.10 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.9 Fri Jan 7 16:28:47 2005 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Fri Jan 7 16:37:48 2005 @@ -556,8 +556,20 @@ if (Tmp1 != Node->getOperand(0)) Result = DAG.getNode(Node->getOpcode(), Node->getValueType(0), Tmp1); break; + case Expand: + // In the expand case, we must be dealing with a truncate, because + // otherwise the result would be larger than the source. + assert(Node->getOpcode() == ISD::TRUNCATE && + "Shouldn't need to expand other operators here!"); + ExpandOp(Node->getOperand(0), Tmp1, Tmp2); + + // Since the result is legal, we should just be able to truncate the low + // part of the source. + Result = DAG.getNode(ISD::TRUNCATE, Node->getValueType(0), Tmp1); + break; + default: - assert(0 && "Do not know how to expand or promote this yet!"); + assert(0 && "Do not know how to promote this yet!"); } break; } From lattner at cs.uiuc.edu Fri Jan 7 16:44:24 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jan 2005 16:44:24 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200501072244.j07MiOb1001513@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.10 -> 1.11 --- Log message: Fix a thinko in the reassociation code, fixing Generic/badlive.ll --- Diffs of the changes: (+1 -1) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.10 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.11 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.10 Fri Jan 7 15:56:24 2005 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Fri Jan 7 16:44:09 2005 @@ -599,7 +599,7 @@ // Reassociate ((X op C1) op C2) if possible. if (N1.getOpcode() == Opcode && isAssociativeBinOp(Opcode)) if (ConstantSDNode *N3C = dyn_cast(N1.Val->getOperand(1))) - return getNode(Opcode, VT, N3C->getOperand(0), + return getNode(Opcode, VT, N1.Val->getOperand(0), getNode(Opcode, VT, N2, N1.Val->getOperand(1))); } From lattner at cs.uiuc.edu Fri Jan 7 16:50:12 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jan 2005 16:50:12 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200501072250.j07MoC3Z002110@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.11 -> 1.12 --- Log message: Fold conditional branches on constants away. --- Diffs of the changes: (+6 -0) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.11 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.12 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.11 Fri Jan 7 16:44:09 2005 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Fri Jan 7 16:49:57 2005 @@ -727,6 +727,12 @@ } break; + case ISD::BRCOND: + if (N2C) + if (N2C->getValue()) // Unconditional branch + return getNode(ISD::BR, MVT::Other, N1, N3); + else + return N1; // Never-taken branch } SDNode *N = new SDNode(Opcode, N1, N2, N3); From reid at x10sys.com Fri Jan 7 17:10:00 2005 From: reid at x10sys.com (Reid Spencer) Date: Fri, 7 Jan 2005 17:10:00 -0600 Subject: [llvm-commits] CVS: llvm-www/Oversight.html Message-ID: <200501072310.RAA10719@zion.cs.uiuc.edu> Changes in directory llvm-www: Oversight.html updated: 1.1 -> 1.2 --- Log message: HTML 4.0 Strictify and llvm websitify the document. --- Diffs of the changes: (+102 -106) Index: llvm-www/Oversight.html diff -u llvm-www/Oversight.html:1.1 llvm-www/Oversight.html:1.2 --- llvm-www/Oversight.html:1.1 Fri Jan 7 16:21:29 2005 +++ llvm-www/Oversight.html Fri Jan 7 17:09:49 2005 @@ -1,107 +1,103 @@ - - - - LLVM Oversight Group Mission - - - -

    LLVM Oversight Group Mission

    - -

    Introduction

    - - The LLVM Oversight Group is a small group of LLVM developers that aim to - guide continued development, distribution, and community-building for - LLVM. Our broad aim is to foster the wider adoption and growth of LLVM. - A key part of that is to encourage participation and contributions from - both UIUC and non-UIUC users. - -

    - We do not aim to create a bureaucracy. On the contrary, we believe - that having a simple but organized process for overseeing LLVM should give - more confidence to potential users and contributors in the stability and - longevity of LLVM, and therefore encourage them to get involved. Having a - well-understood process for major contributions should also encourage - developers to contribute their work and stay involved. + +

    LLVM Oversight Group Mission
    +
    Introduction
    +

    The LLVM Oversight Group is a small group of LLVM developers that aim to + guide continued development, distribution, and community-building for + LLVM. Our broad aim is to foster the wider adoption and growth of LLVM. + A key part of that is to encourage participation and contributions from + both UIUC and non-UIUC users.

    + +

    We do not aim to create a bureaucracy. On the contrary, we believe + that having a simple but organized process for overseeing LLVM should give + more confidence to potential users and contributors in the stability and + longevity of LLVM, and therefore encourage them to get involved. Having a + well-understood process for major contributions should also encourage + developers to contribute their work and stay involved.

    -

    Membership and Communication

    - - The oversight group currently consists of Chris Lattner, Vikram Adve, Reid - Spencer and Misha Brukman. Our goal for the membership of this group is to - have Chris, Vikram and two or three other active LLVM developers, - including at least one from academia and one from industry. - -

    You can send e-mail to the group at - - oversight at llvm.cs.uiuc.edu. - This alias only reaches the oversight group, and messages can be kept - confidential on request. Please use this alias for any feedback or - suggestions regarding LLVM policy issues outlined in the mission statement - below (rather than broadcasting them to llvmdev). - -

    Mission

    - - The primary goals of the LLVM oversight group are: -
      -
    • Functionality and Stability in the Core Framework: -
        -
      • Adjudicate substantial changes to the core LLVM components, - which essentially includes everything in llvm/lib/ - and the key llvm tools.
      • -
      • Identify and prioritize improvements to the core.
      • -
    • -

    • Guidelines for who gets write-access to CVS: -
        -
      • The goal here is to encourage the most active contributors by - giving them direct CVS write access.
      • -
      • Our primary guiding principle here is that write access should - be limited to persons who have a track record of responsible - contributions, and are likely to remain active contributors - for a long time (not for short-term projects).
      • -
    • -

    • Public Awareness: -
        -
      • Be proactive in finding opportunities to attract users - and developers.
      • -
      • Give/organize LLVM tutorials at conferences.
      • -
      • Create publicity for new releases.
      • -
    • -

    • Licensing and Copyright: -
        -
      • Oversee changes in LLVM licensing.
      • -
      • Oversee LLVM copyright ownership issues.
      • -
      • Attempt to ensure that we don't violate copyrights of other - software used by or in LLVM, or infringe patents, especially - unintentional violations due to contributed code.
      • -
    • -

    • Release Management: -
        -
      • Collect feedback on what users would like to see in future releases.
      • -
      • Provide a "best guess" page on what will be in the next release.
      • -
      • Manage quarterly releases.
      • -
    • -

    • Open Projects and Ongoing Projects: -
        -
      • Identify projects we would like to see happen.
      • -
      • Maintain public information about these projects and priorities - to guide interested developers.
      • -
      • Maintain public information about ongoing major projects to - avoid redundancy (and minimize a major source of conflict!).
      • -
    • -

    • Dispute Resolution: -
        -
      • Resolve TECHNICAL disputes between parties that are unable - to resolve the issues themselves.
      • -
    • - -
    - - - -
    -
    Vikram Adve
    - - -Last modified: Fri Jan 7 16:16:30 CST 2005 - - - +
    Membership and Communication
    +

    The oversight group currently consists of Chris Lattner, Vikram Adve, Reid + Spencer and Misha Brukman. Our goal for the membership of this group is to + have Chris, Vikram and two or three other active LLVM developers, + including at least one from academia and one from industry.

    + +

    You can send e-mail to the group at + + oversight at llvm.cs.uiuc.edu. This alias only reaches + the oversight group, and messages can be kept confidential on request. + Please use this alias for any feedback or suggestions regarding LLVM + policy issues outlined in the mission statement below (rather than + broadcasting them to llvmdev). + +

    Mission
    +

    The primary goals of the LLVM oversight group are:

    +
      +
    • Functionality and Stability in the Core Framework: +
        +
      • Adjudicate substantial changes to the core LLVM components, + which essentially includes everything in llvm/lib/ + and the key llvm tools.
      • +
      • Identify and prioritize improvements to the core.
      • +
      +
    • +
    • Guidelines for who gets write-access to CVS: +
        +
      • The goal here is to encourage the most active contributors by + giving them direct CVS write access.
      • +
      • Our primary guiding principle here is that write access should + be limited to persons who have a track record of responsible + contributions, and are likely to remain active contributors + for a long time (not for short-term projects).
      • +
      +
    • +
    • Public Awareness: +
        +
      • Be proactive in finding opportunities to attract users + and developers.
      • +
      • Give/organize LLVM tutorials at conferences.
      • +
      • Create publicity for new releases.
      • +
      +
    • +
    • Licensing and Copyright: +
        +
      • Oversee changes in LLVM licensing.
      • +
      • Oversee LLVM copyright ownership issues.
      • +
      • Attempt to ensure that we don't violate copyrights of other + software used by or in LLVM, or infringe patents, especially + unintentional violations due to contributed code.
      • +
      +
    • +
    • Release Management: +
        +
      • Collect feedback on what users would like to see in future releases.
      • +
      • Provide a "best guess" page on what will be in the next release.
      • +
      • Manage quarterly releases.
      • +
      +
    • +
    • Open Projects and Ongoing Projects: +
        +
      • Identify projects we would like to see happen.
      • +
      • Maintain public information about these projects and priorities + to guide interested developers.
      • +
      • Maintain public information about ongoing major projects to + avoid redundancy (and minimize a major source of conflict!).
      • +
      +
    • +
    • Dispute Resolution: +
        +
      • Resolve TECHNICAL disputes between parties that are unable + to resolve the issues themselves.
      • +
      +
    • +
    + +
    +
    + Valid CSS! + Valid HTML 4.01! + +
    Vikram Adve
    + Last modified: $Date: 2005/01/07 23:09:49 $ +
    + From reid at x10sys.com Fri Jan 7 17:11:27 2005 From: reid at x10sys.com (Reid Spencer) Date: Fri, 7 Jan 2005 17:11:27 -0600 Subject: [llvm-commits] CVS: llvm-www/Oversight.html Message-ID: <200501072311.RAA10768@zion.cs.uiuc.edu> Changes in directory llvm-www: Oversight.html updated: 1.2 -> 1.3 --- Log message: Tone down the headings a bit. --- Diffs of the changes: (+5 -5) Index: llvm-www/Oversight.html diff -u llvm-www/Oversight.html:1.2 llvm-www/Oversight.html:1.3 --- llvm-www/Oversight.html:1.2 Fri Jan 7 17:09:49 2005 +++ llvm-www/Oversight.html Fri Jan 7 17:11:16 2005 @@ -1,6 +1,6 @@ -
    LLVM Oversight Group Mission
    -
    Introduction
    +
    LLVM Oversight Group Mission
    +
    Introduction

    The LLVM Oversight Group is a small group of LLVM developers that aim to guide continued development, distribution, and community-building for LLVM. Our broad aim is to foster the wider adoption and growth of LLVM. @@ -14,7 +14,7 @@ well-understood process for major contributions should also encourage developers to contribute their work and stay involved.

    -
    Membership and Communication
    +
    Membership and Communication

    The oversight group currently consists of Chris Lattner, Vikram Adve, Reid Spencer and Misha Brukman. Our goal for the membership of this group is to have Chris, Vikram and two or three other active LLVM developers, @@ -28,7 +28,7 @@ policy issues outlined in the mission statement below (rather than broadcasting them to llvmdev). -

    Mission
    +
    Mission

    The primary goals of the LLVM oversight group are:

    • Functionality and Stability in the Core Framework: @@ -98,6 +98,6 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!">
      Vikram Adve
      - Last modified: $Date: 2005/01/07 23:09:49 $ + Last modified: $Date: 2005/01/07 23:11:16 $ From reid at x10sys.com Fri Jan 7 17:22:44 2005 From: reid at x10sys.com (Reid Spencer) Date: Fri, 7 Jan 2005 17:22:44 -0600 Subject: [llvm-commits] CVS: llvm-www/header.incl Message-ID: <200501072322.RAA10924@zion.cs.uiuc.edu> Changes in directory llvm-www: header.incl updated: 1.29 -> 1.30 --- Log message: Make all docs HTML 4.01 Strict conforming. --- Diffs of the changes: (+2 -0) Index: llvm-www/header.incl diff -u llvm-www/header.incl:1.29 llvm-www/header.incl:1.30 --- llvm-www/header.incl:1.29 Thu Dec 9 17:02:51 2004 +++ llvm-www/header.incl Fri Jan 7 17:22:33 2005 @@ -1,3 +1,5 @@ + From reid at x10sys.com Fri Jan 7 17:25:28 2005 From: reid at x10sys.com (Reid Spencer) Date: Fri, 7 Jan 2005 17:25:28 -0600 Subject: [llvm-commits] CVS: llvm-www/header.incl Message-ID: <200501072325.RAA10971@zion.cs.uiuc.edu> Changes in directory llvm-www: header.incl updated: 1.30 -> 1.31 --- Log message: Make the header 4.01 Strict compliant. --- Diffs of the changes: (+9 -9) Index: llvm-www/header.incl diff -u llvm-www/header.incl:1.30 llvm-www/header.incl:1.31 --- llvm-www/header.incl:1.30 Fri Jan 7 17:22:33 2005 +++ llvm-www/header.incl Fri Jan 7 17:25:17 2005 @@ -7,7 +7,7 @@ - +
      The LLVM Compiler Infrastructure @@ -36,15 +36,15 @@ Download!
      -Download now: +Download now: LLVM 1.4

      -Try the
      +Try the
      online demo

      -View the open-source
      +View the open-source
      license
      @@ -52,7 +52,7 @@ Status Updates
      - + December 9, 2004
      October 11, 2004
      August 13, 2004
      @@ -75,7 +75,7 @@ Useful Links
      - Mailing Lists:
      + Mailing Lists:
      LLVM-announce
      LLVM-dev
      LLVM-bugs
      @@ -83,12 +83,12 @@

      - IRC Channel:
      + IRC Channel:
      irc.oftc.net #llvm

      - Dev. Resources:
      + Dev. Resources:
      doxygen cvsweb
      Nightly Tester
      @@ -97,7 +97,7 @@
      -Maintained by:
      Chris +Maintained by:
      Chris Lattner From lattner at cs.uiuc.edu Fri Jan 7 17:26:13 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jan 2005 17:26:13 -0600 Subject: [llvm-commits] CVS: llvm-www/llvm.css Message-ID: <200501072326.j07NQD6u004020@apoc.cs.uiuc.edu> Changes in directory llvm-www: llvm.css updated: 1.16 -> 1.17 --- Log message: Fix style to not look funny --- Diffs of the changes: (+1 -2) Index: llvm-www/llvm.css diff -u llvm-www/llvm.css:1.16 llvm-www/llvm.css:1.17 --- llvm-www/llvm.css:1.16 Wed Sep 8 14:08:34 2004 +++ llvm-www/llvm.css Fri Jan 7 17:25:58 2005 @@ -35,8 +35,7 @@ margin-bottom: 0.3em; } .www_subsection { width: 75%; - text-align: left; font-size: 12pt; padding: 4pt 4pt 4pt 4pt; - margin: 1.5em 0.5em 0.5em 0.5em } + text-align: left; font-size: 12pt; } .www_subsubsection { margin: 1.0em 0.5em 0.5em 0.5em; font-weight: bold; font-style: oblique; From lattner at cs.uiuc.edu Fri Jan 7 17:32:12 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jan 2005 17:32:12 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200501072332.j07NWCRp004349@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.12 -> 1.13 --- Log message: Fix a pointer invalidation problem. This fixes Generic/badarg6.ll --- Diffs of the changes: (+7 -13) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.12 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.13 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.12 Fri Jan 7 16:49:57 2005 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Fri Jan 7 17:32:00 2005 @@ -191,29 +191,22 @@ } // Next, brutally remove the operand list. - std::vector Operands; while (!N->Operands.empty()) { - SDOperand O = N->Operands.back(); + SDNode *O = N->Operands.back().Val; N->Operands.pop_back(); - Operands.push_back(O.Val); - O.Val->removeUser(N); + O->removeUser(N); + + // Now that we removed this operand, see if there are no uses of it left. + DeleteNodeIfDead(O, NodeSet); } // Remove the node from the nodes set and delete it. std::set &AllNodeSet = *(std::set*)NodeSet; AllNodeSet.erase(N); - delete N; // Now that the node is gone, check to see if any of the operands of this node // are dead now. - - // Remove duplicate operand entries. - std::sort(Operands.begin(), Operands.end()); - Operands.erase(std::unique(Operands.begin(), Operands.end()), - Operands.end()); - - for (unsigned i = 0, e = Operands.size(); i != e; ++i) - DeleteNodeIfDead(Operands[i], NodeSet); + delete N; } @@ -733,6 +726,7 @@ return getNode(ISD::BR, MVT::Other, N1, N3); else return N1; // Never-taken branch + break; } SDNode *N = new SDNode(Opcode, N1, N2, N3); From reid at x10sys.com Fri Jan 7 17:32:26 2005 From: reid at x10sys.com (Reid Spencer) Date: Fri, 7 Jan 2005 17:32:26 -0600 Subject: [llvm-commits] CVS: llvm-www/header.incl Message-ID: <200501072332.RAA11064@zion.cs.uiuc.edu> Changes in directory llvm-www: header.incl updated: 1.31 -> 1.32 --- Log message: Okay this isn't XHTML its HTML 4.01 --- Diffs of the changes: (+10 -10) Index: llvm-www/header.incl diff -u llvm-www/header.incl:1.31 llvm-www/header.incl:1.32 --- llvm-www/header.incl:1.31 Fri Jan 7 17:25:17 2005 +++ llvm-www/header.incl Fri Jan 7 17:32:15 2005 @@ -36,15 +36,15 @@ Download!
      -Download now: +Download now: LLVM 1.4

      -Try the
      +Try the
      online demo

      -View the open-source
      +View the open-source
      license
      @@ -52,7 +52,7 @@ Status Updates
      Useful Links
      - Mailing Lists:
      + Mailing Lists:
      LLVM-announce
      LLVM-dev
      LLVM-bugs
      @@ -83,12 +83,12 @@

      - IRC Channel:
      + IRC Channel:
      irc.oftc.net #llvm

      - Dev. Resources:
      + Dev. Resources:
      doxygen cvsweb
      Nightly Tester
      @@ -97,8 +97,8 @@
      -Maintained by:
      Chris -Lattner
      +Maintained by:
      Chris +Lattner
      From reid at x10sys.com Fri Jan 7 17:41:26 2005 From: reid at x10sys.com (Reid Spencer) Date: Fri, 7 Jan 2005 17:41:26 -0600 Subject: [llvm-commits] CVS: llvm-www/header.incl Message-ID: <200501072341.RAA11144@zion.cs.uiuc.edu> Changes in directory llvm-www: header.incl updated: 1.32 -> 1.33 --- Log message: I hate server side includes. --- Diffs of the changes: (+10 -10) Index: llvm-www/header.incl diff -u llvm-www/header.incl:1.32 llvm-www/header.incl:1.33 --- llvm-www/header.incl:1.32 Fri Jan 7 17:32:15 2005 +++ llvm-www/header.incl Fri Jan 7 17:41:15 2005 @@ -36,15 +36,15 @@ Download!
      -Download now: +Download now: LLVM 1.4

      -Try the
      +Try the
      online demo

      -View the open-source
      +View the open-source
      license
      @@ -52,7 +52,7 @@ Status Updates
      Useful Links
      - Mailing Lists:
      + Mailing Lists:
      LLVM-announce
      LLVM-dev
      LLVM-bugs
      @@ -83,12 +83,12 @@

      - IRC Channel:
      + IRC Channel:
      irc.oftc.net #llvm

      - Dev. Resources:
      + Dev. Resources:
      doxygen cvsweb
      Nightly Tester
      @@ -97,8 +97,8 @@
      -Maintained by:
      Chris -Lattner
      +Maintained by:
      Chris +Lattner
      From reid at x10sys.com Fri Jan 7 17:43:44 2005 From: reid at x10sys.com (Reid Spencer) Date: Fri, 7 Jan 2005 17:43:44 -0600 Subject: [llvm-commits] CVS: llvm-www/Oversight.html Message-ID: <200501072343.RAA11183@zion.cs.uiuc.edu> Changes in directory llvm-www: Oversight.html updated: 1.3 -> 1.4 --- Log message: * Drop the Introduction section * Add
      for text blocks with style="www_text" * Change author at bottom to oversight group. --- Diffs of the changes: (+9 -3) Index: llvm-www/Oversight.html diff -u llvm-www/Oversight.html:1.3 llvm-www/Oversight.html:1.4 --- llvm-www/Oversight.html:1.3 Fri Jan 7 17:11:16 2005 +++ llvm-www/Oversight.html Fri Jan 7 17:43:33 2005 @@ -1,6 +1,6 @@
      LLVM Oversight Group Mission
      -
      Introduction
      +

      The LLVM Oversight Group is a small group of LLVM developers that aim to guide continued development, distribution, and community-building for LLVM. Our broad aim is to foster the wider adoption and growth of LLVM. @@ -13,8 +13,10 @@ longevity of LLVM, and therefore encourage them to get involved. Having a well-understood process for major contributions should also encourage developers to contribute their work and stay involved.

      +
      Membership and Communication
      +

      The oversight group currently consists of Chris Lattner, Vikram Adve, Reid Spencer and Misha Brukman. Our goal for the membership of this group is to have Chris, Vikram and two or three other active LLVM developers, @@ -27,8 +29,10 @@ Please use this alias for any feedback or suggestions regarding LLVM policy issues outlined in the mission statement below (rather than broadcasting them to llvmdev). +

      Mission
      +

      The primary goals of the LLVM oversight group are:

      • Functionality and Stability in the Core Framework: @@ -89,7 +93,9 @@
    +
    +
    Valid HTML 4.01! -
    Vikram Adve
    - Last modified: $Date: 2005/01/07 23:11:16 $ +
    LLVM Oversight Group
    + Last modified: $Date: 2005/01/07 23:43:33 $
    From brukman at cs.uiuc.edu Fri Jan 7 19:11:26 2005 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri, 7 Jan 2005 19:11:26 -0600 Subject: [llvm-commits] CVS: llvm/docs/CompilerWriterInfo.html Message-ID: <200501080111.TAA11871@zion.cs.uiuc.edu> Changes in directory llvm/docs: CompilerWriterInfo.html updated: 1.1 -> 1.2 --- Log message: Eliminate empty sub-list --- Diffs of the changes: (+2 -5) Index: llvm/docs/CompilerWriterInfo.html diff -u llvm/docs/CompilerWriterInfo.html:1.1 llvm/docs/CompilerWriterInfo.html:1.2 --- llvm/docs/CompilerWriterInfo.html:1.1 Sun Nov 7 20:47:08 2004 +++ llvm/docs/CompilerWriterInfo.html Fri Jan 7 19:11:15 2005 @@ -31,10 +31,7 @@
  • Linux
  • OS X
  • -
  • Binary File Formats -
      -
    1. ...
    2. -
  • +
  • Binary File Formats
  • @@ -239,7 +236,7 @@ Misha Brukman
    LLVM Compiler Infrastructure
    - Last modified: $Date: 2004/11/08 02:47:08 $ + Last modified: $Date: 2005/01/08 01:11:15 $ From lattner at cs.uiuc.edu Fri Jan 7 23:44:23 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jan 2005 23:44:23 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/X86/store-fp-constant.ll Message-ID: <200501080544.j085iNXT009377@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/X86: store-fp-constant.ll added (r1.1) --- Log message: New testcase. --- Diffs of the changes: (+19 -0) Index: llvm/test/Regression/CodeGen/X86/store-fp-constant.ll diff -c /dev/null llvm/test/Regression/CodeGen/X86/store-fp-constant.ll:1.1 *** /dev/null Fri Jan 7 23:44:18 2005 --- llvm/test/Regression/CodeGen/X86/store-fp-constant.ll Fri Jan 7 23:44:07 2005 *************** *** 0 **** --- 1,19 ---- + ; RUN: llvm-as < %s | llc -march=x86 | not grep rodata + ; + ; Check that no FP constants in this testcase ends up in the + ; constant pool. + %G = external global float + + + declare void %extfloat(float %F) + declare void %extdouble(double) + + implementation + + void %testfloatstore() { + call void %extfloat(float 1234.4) + call void %extdouble(double 1234.4123) + store float 13.0123, float* %G + ret void + } + From lattner at cs.uiuc.edu Fri Jan 7 23:45:36 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jan 2005 23:45:36 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelSimple.cpp Message-ID: <200501080545.j085jawg009392@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelSimple.cpp updated: 1.305 -> 1.306 --- Log message: The X86 instruction selector already handles codegen of: store float 123.45, float* %P as an integer store. This adds handling of float immediate stores as integers for arguments passed function calls. This is now tested by CodeGen/X86/store-fp-constant.ll --- Diffs of the changes: (+33 -8) Index: llvm/lib/Target/X86/X86ISelSimple.cpp diff -u llvm/lib/Target/X86/X86ISelSimple.cpp:1.305 llvm/lib/Target/X86/X86ISelSimple.cpp:1.306 --- llvm/lib/Target/X86/X86ISelSimple.cpp:1.305 Thu Jan 6 15:19:16 2005 +++ llvm/lib/Target/X86/X86ISelSimple.cpp Fri Jan 7 23:45:24 2005 @@ -1631,15 +1631,40 @@ break; case cFP: - ArgReg = Args[i].Val ? getReg(Args[i].Val) : Args[i].Reg; - if (Args[i].Ty == Type::FloatTy) { - addRegOffset(BuildMI(BB, X86::FST32m, 5), - X86::ESP, ArgOffset).addReg(ArgReg); + if (ConstantFP *CFP = dyn_cast_or_null(Args[i].Val)) { + // Store constant FP values with integer instructions to avoid having to + // load the constants from the constant pool then do a store. + if (CFP->getType() == Type::FloatTy) { + union { + unsigned I; + float F; + } V; + V.F = CFP->getValue(); + addRegOffset(BuildMI(BB, X86::MOV32mi, 5), + X86::ESP, ArgOffset).addImm(V.I); + } else { + union { + uint64_t I; + double F; + } V; + V.F = CFP->getValue(); + addRegOffset(BuildMI(BB, X86::MOV32mi, 5), + X86::ESP, ArgOffset).addImm((unsigned)V.I); + addRegOffset(BuildMI(BB, X86::MOV32mi, 5), + X86::ESP, ArgOffset+4).addImm(unsigned(V.I >> 32)); + ArgOffset += 4; // 8 byte entry, not 4. + } } else { - assert(Args[i].Ty == Type::DoubleTy && "Unknown FP type!"); - addRegOffset(BuildMI(BB, X86::FST64m, 5), - X86::ESP, ArgOffset).addReg(ArgReg); - ArgOffset += 4; // 8 byte entry, not 4. + ArgReg = Args[i].Val ? getReg(Args[i].Val) : Args[i].Reg; + if (Args[i].Ty == Type::FloatTy) { + addRegOffset(BuildMI(BB, X86::FST32m, 5), + X86::ESP, ArgOffset).addReg(ArgReg); + } else { + assert(Args[i].Ty == Type::DoubleTy && "Unknown FP type!"); + addRegOffset(BuildMI(BB, X86::FST64m, 5), + X86::ESP, ArgOffset).addReg(ArgReg); + ArgOffset += 4; // 8 byte entry, not 4. + } } break; From lattner at cs.uiuc.edu Sat Jan 8 00:24:45 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 8 Jan 2005 00:24:45 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200501080624.j086OjfT010411@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.13 -> 1.14 --- Log message: 1ULL << 64 is undefined, don't do it. --- Diffs of the changes: (+3 -2) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.13 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.14 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.13 Fri Jan 7 17:32:00 2005 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sat Jan 8 00:24:30 2005 @@ -218,8 +218,9 @@ SDOperand SelectionDAG::getConstant(uint64_t Val, MVT::ValueType VT) { assert(MVT::isInteger(VT) && "Cannot create FP integer constant!"); // Mask out any bits that are not valid for this constant. - Val &= (1ULL << MVT::getSizeInBits(VT)) - 1; - + if (VT != MVT::i64) + Val &= ((uint64_t)1 << MVT::getSizeInBits(VT)) - 1; + SDNode *&N = Constants[std::make_pair(Val, VT)]; if (N) return SDOperand(N, 0); N = new ConstantSDNode(Val, VT); From lattner at cs.uiuc.edu Sat Jan 8 00:26:08 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 8 Jan 2005 00:26:08 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200501080626.j086Q8PP010425@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.10 -> 1.11 --- Log message: Implement the 'store FPIMM, Ptr' -> 'store INTIMM, Ptr' optimization for all targets. --- Diffs of the changes: (+25 -0) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.10 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.11 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.10 Fri Jan 7 16:37:48 2005 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Sat Jan 8 00:25:56 2005 @@ -424,6 +424,31 @@ Tmp1 = LegalizeOp(Node->getOperand(0)); // Legalize the chain. Tmp2 = LegalizeOp(Node->getOperand(2)); // Legalize the pointer. + // Turn 'store float 1.0, Ptr' -> 'store int 0x12345678, Ptr' + if (ConstantFPSDNode *CFP = + dyn_cast(Node->getOperand(1))) { + if (CFP->getValueType(0) == MVT::f32) { + union { + unsigned I; + float F; + } V; + V.F = CFP->getValue(); + Result = DAG.getNode(ISD::STORE, MVT::Other, Tmp1, + DAG.getConstant(V.I, MVT::i32), Tmp2); + } else { + assert(CFP->getValueType(0) == MVT::f64 && "Unknown FP type!"); + union { + uint64_t I; + double F; + } V; + V.F = CFP->getValue(); + Result = DAG.getNode(ISD::STORE, MVT::Other, Tmp1, + DAG.getConstant(V.I, MVT::i64), Tmp2); + } + Op = Result; + Node = Op.Val; + } + switch (getTypeAction(Node->getOperand(1).getValueType())) { case Legal: { SDOperand Val = LegalizeOp(Node->getOperand(1)); From lattner at cs.uiuc.edu Sat Jan 8 01:00:05 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 8 Jan 2005 01:00:05 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelSimple.cpp Message-ID: <200501080700.j08705hM011382@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelSimple.cpp updated: 1.306 -> 1.307 --- Log message: Wrap long line. --- Diffs of the changes: (+2 -2) Index: llvm/lib/Target/X86/X86ISelSimple.cpp diff -u llvm/lib/Target/X86/X86ISelSimple.cpp:1.306 llvm/lib/Target/X86/X86ISelSimple.cpp:1.307 --- llvm/lib/Target/X86/X86ISelSimple.cpp:1.306 Fri Jan 7 23:45:24 2005 +++ llvm/lib/Target/X86/X86ISelSimple.cpp Sat Jan 8 00:59:50 2005 @@ -1632,8 +1632,8 @@ case cFP: if (ConstantFP *CFP = dyn_cast_or_null(Args[i].Val)) { - // Store constant FP values with integer instructions to avoid having to - // load the constants from the constant pool then do a store. + // Store constant FP values with integer instructions to avoid having + // to load the constants from the constant pool then do a store. if (CFP->getType() == Type::FloatTy) { union { unsigned I; From lattner at cs.uiuc.edu Sat Jan 8 02:09:05 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 8 Jan 2005 02:09:05 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/SelectionDAGNodes.h Message-ID: <200501080809.j0889556012986@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: SelectionDAGNodes.h updated: 1.4 -> 1.5 --- Log message: Add operators for FP -> INT conversions and back. --- Diffs of the changes: (+10 -0) Index: llvm/include/llvm/CodeGen/SelectionDAGNodes.h diff -u llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.4 llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.5 --- llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.4 Fri Jan 7 15:08:55 2005 +++ llvm/include/llvm/CodeGen/SelectionDAGNodes.h Sat Jan 8 02:08:49 2005 @@ -104,6 +104,16 @@ // TRUNCATE - Completely drop the high bits. TRUNCATE, + // [SU]INT_TO_FP - These operators convert integers (whose interpreted sign + // depends on the first letter) to floating point. + SINT_TO_FP, + UINT_TO_FP, + + // FP_TO_[US]INT - Convert a floating point value to a signed or unsigned + // integer. + FP_TO_SINT, + FP_TO_UINT, + // FP_ROUND - Perform a rounding operation from the current // precision down to the specified precision. FP_ROUND, From lattner at cs.uiuc.edu Sat Jan 8 02:09:09 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 8 Jan 2005 02:09:09 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp SelectionDAG.cpp SelectionDAGISel.cpp Message-ID: <200501080809.j08899KX012998@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.11 -> 1.12 SelectionDAG.cpp updated: 1.14 -> 1.15 SelectionDAGISel.cpp updated: 1.3 -> 1.4 --- Log message: Add support for FP->INT conversions and back. --- Diffs of the changes: (+42 -17) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.11 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.12 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.11 Sat Jan 8 00:25:56 2005 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Sat Jan 8 02:08:56 2005 @@ -575,6 +575,11 @@ case ISD::TRUNCATE: case ISD::FP_EXTEND: case ISD::FP_ROUND: + case ISD::FP_TO_SINT: + case ISD::FP_TO_UINT: + case ISD::SINT_TO_FP: + case ISD::UINT_TO_FP: + switch (getTypeAction(Node->getOperand(0).getValueType())) { case Legal: Tmp1 = LegalizeOp(Node->getOperand(0)); Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.14 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.15 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.14 Sat Jan 8 00:24:30 2005 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sat Jan 8 02:08:56 2005 @@ -396,6 +396,8 @@ case ISD::SIGN_EXTEND: return getConstant(C->getSignExtended(), VT); case ISD::ZERO_EXTEND: return getConstant(Val, VT); case ISD::TRUNCATE: return getConstant(Val, VT); + case ISD::SINT_TO_FP: return getConstantFP(C->getSignExtended(), VT); + case ISD::UINT_TO_FP: return getConstantFP(C->getValue(), VT); } } @@ -404,6 +406,10 @@ case ISD::FP_ROUND: case ISD::FP_EXTEND: return getConstantFP(C->getValue(), VT); + case ISD::FP_TO_SINT: + return getConstant((int64_t)C->getValue(), VT); + case ISD::FP_TO_UINT: + return getConstant((uint64_t)C->getValue(), VT); } unsigned OpOpcode = Operand.Val->getOpcode(); @@ -821,6 +827,11 @@ case ISD::FP_ROUND: std::cerr << "fp_round"; break; case ISD::FP_EXTEND: std::cerr << "fp_extend"; break; + case ISD::SINT_TO_FP: std::cerr << "sint_to_fp"; break; + case ISD::UINT_TO_FP: std::cerr << "uint_to_fp"; break; + case ISD::FP_TO_SINT: std::cerr << "fp_to_sint"; break; + case ISD::FP_TO_UINT: std::cerr << "fp_to_uint"; break; + // Control flow instructions case ISD::BR: std::cerr << "br"; break; case ISD::BRCOND: std::cerr << "brcond"; break; Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.3 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.4 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.3 Fri Jan 7 15:56:57 2005 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Sat Jan 8 02:08:56 2005 @@ -434,24 +434,33 @@ if (N.getValueType() == DestTy) { setValue(&I, N); // noop cast. - return; - } else if (isInteger(SrcTy) && isInteger(DestTy)) { - if (DestTy < SrcTy) // Truncating cast? - setValue(&I, DAG.getNode(ISD::TRUNCATE, DestTy, N)); - else if (I.getOperand(0)->getType()->isSigned()) - setValue(&I, DAG.getNode(ISD::SIGN_EXTEND, DestTy, N)); - else - setValue(&I, DAG.getNode(ISD::ZERO_EXTEND, DestTy, N)); - return; - } else if (isFloatingPoint(SrcTy) && isFloatingPoint(DestTy)) { - if (DestTy < SrcTy) // Rounding cast? - setValue(&I, DAG.getNode(ISD::FP_ROUND, DestTy, N)); - else - setValue(&I, DAG.getNode(ISD::FP_EXTEND, DestTy, N)); + } else if (isInteger(SrcTy)) { + if (isInteger(DestTy)) { // Int -> Int cast + if (DestTy < SrcTy) // Truncating cast? + setValue(&I, DAG.getNode(ISD::TRUNCATE, DestTy, N)); + else if (I.getOperand(0)->getType()->isSigned()) + setValue(&I, DAG.getNode(ISD::SIGN_EXTEND, DestTy, N)); + else + setValue(&I, DAG.getNode(ISD::ZERO_EXTEND, DestTy, N)); + } else { // Int -> FP cast + if (I.getOperand(0)->getType()->isSigned()) + setValue(&I, DAG.getNode(ISD::SINT_TO_FP, DestTy, N)); + else + setValue(&I, DAG.getNode(ISD::UINT_TO_FP, DestTy, N)); + } } else { - // F->I or I->F - // FIXME: implement integer/fp conversions! - assert(0 && "This CAST is not yet implemented!\n"); + assert(isFloatingPoint(SrcTy) && "Unknown value type!"); + if (isFloatingPoint(DestTy)) { // FP -> FP cast + if (DestTy < SrcTy) // Rounding cast? + setValue(&I, DAG.getNode(ISD::FP_ROUND, DestTy, N)); + else + setValue(&I, DAG.getNode(ISD::FP_EXTEND, DestTy, N)); + } else { // FP -> Int cast. + if (I.getType()->isSigned()) + setValue(&I, DAG.getNode(ISD::FP_TO_SINT, DestTy, N)); + else + setValue(&I, DAG.getNode(ISD::FP_TO_UINT, DestTy, N)); + } } } From jeffc at jolt-lang.org Sat Jan 8 11:21:51 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Sat, 8 Jan 2005 11:21:51 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/LoopExtractor.cpp Message-ID: <200501081721.LAA14803@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: LoopExtractor.cpp updated: 1.15 -> 1.16 --- Log message: Add more missing createXxxPass functions. --- Diffs of the changes: (+5 -0) Index: llvm/lib/Transforms/IPO/LoopExtractor.cpp diff -u llvm/lib/Transforms/IPO/LoopExtractor.cpp:1.15 llvm/lib/Transforms/IPO/LoopExtractor.cpp:1.16 --- llvm/lib/Transforms/IPO/LoopExtractor.cpp:1.15 Sun Sep 19 23:43:34 2004 +++ llvm/lib/Transforms/IPO/LoopExtractor.cpp Sat Jan 8 11:21:39 2005 @@ -58,6 +58,11 @@ Y("loop-extract-single", "Extract at most one loop into a new function"); } // End anonymous namespace +// createLoopExtractorPass - This pass extracts all natural loops from the +// program into a function if it can. +// +ModulePass *llvm::createLoopExtractorPass() { return new LoopExtractor(); } + bool LoopExtractor::runOnFunction(Function &F) { LoopInfo &LI = getAnalysis(); From jeffc at jolt-lang.org Sat Jan 8 11:21:51 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Sat, 8 Jan 2005 11:21:51 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/BasicBlockPlacement.cpp PRE.cpp Message-ID: <200501081721.LAA14815@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: BasicBlockPlacement.cpp updated: 1.3 -> 1.4 PRE.cpp updated: 1.13 -> 1.14 --- Log message: Add more missing createXxxPass functions. --- Diffs of the changes: (+4 -0) Index: llvm/lib/Transforms/Scalar/BasicBlockPlacement.cpp diff -u llvm/lib/Transforms/Scalar/BasicBlockPlacement.cpp:1.3 llvm/lib/Transforms/Scalar/BasicBlockPlacement.cpp:1.4 --- llvm/lib/Transforms/Scalar/BasicBlockPlacement.cpp:1.3 Wed Sep 1 17:55:36 2004 +++ llvm/lib/Transforms/Scalar/BasicBlockPlacement.cpp Sat Jan 8 11:21:40 2005 @@ -31,6 +31,7 @@ #include "llvm/Pass.h" #include "llvm/Support/CFG.h" #include "llvm/ADT/Statistic.h" +#include "llvm/Transforms/Scalar.h" #include using namespace llvm; @@ -71,6 +72,8 @@ "Profile Guided Basic Block Placement"); } +FunctionPass *llvm::createBlockPlacementPass() { return new BlockPlacement(); } + bool BlockPlacement::runOnFunction(Function &F) { PI = &getAnalysis(); Index: llvm/lib/Transforms/Scalar/PRE.cpp diff -u llvm/lib/Transforms/Scalar/PRE.cpp:1.13 llvm/lib/Transforms/Scalar/PRE.cpp:1.14 --- llvm/lib/Transforms/Scalar/PRE.cpp:1.13 Tue Nov 30 11:09:06 2004 +++ llvm/lib/Transforms/Scalar/PRE.cpp Sat Jan 8 11:21:40 2005 @@ -102,6 +102,7 @@ RegisterOpt
     Z("pre", "Partial Redundancy Elimination");
     }
     
    +FunctionPass* llvm::createPREPass() { return new PRE(); }
     
     bool PRE::runOnFunction(Function &F) {
       VN  = &getAnalysis();
    
    
    
    
    
    From jeffc at jolt-lang.org  Sat Jan  8 11:21:51 2005
    From: jeffc at jolt-lang.org (Jeff Cohen)
    Date: Sat, 8 Jan 2005 11:21:51 -0600
    Subject: [llvm-commits] CVS: llvm/include/llvm/Transforms/IPO.h
    	LinkAllPasses.h Scalar.h 
    Message-ID: <200501081721.LAA14810@zion.cs.uiuc.edu>
    
    
    
    Changes in directory llvm/include/llvm/Transforms:
    
    IPO.h updated: 1.39 -> 1.40
    LinkAllPasses.h updated: 1.9 -> 1.10
    Scalar.h updated: 1.50 -> 1.51
    ---
    Log message:
    
    Add more missing createXxxPass functions.
    
    ---
    Diffs of the changes:  (+21 -1)
    
    Index: llvm/include/llvm/Transforms/IPO.h
    diff -u llvm/include/llvm/Transforms/IPO.h:1.39 llvm/include/llvm/Transforms/IPO.h:1.40
    --- llvm/include/llvm/Transforms/IPO.h:1.39	Fri Dec 10 01:55:01 2004
    +++ llvm/include/llvm/Transforms/IPO.h	Sat Jan  8 11:21:39 2005
    @@ -147,6 +147,11 @@
     
     //===----------------------------------------------------------------------===//
     //
    +/// createLoopExtractorPass - This pass extracts all natural loops from the
    +/// program into a function if it can.
    +///
    +ModulePass *createLoopExtractorPass();
    +
     /// createSingleLoopExtractorPass - This pass extracts one natural loop from the
     /// program into a function if it can.  This is used by bugpoint.
     ///
    
    
    Index: llvm/include/llvm/Transforms/LinkAllPasses.h
    diff -u llvm/include/llvm/Transforms/LinkAllPasses.h:1.9 llvm/include/llvm/Transforms/LinkAllPasses.h:1.10
    --- llvm/include/llvm/Transforms/LinkAllPasses.h:1.9	Fri Jan  7 01:46:40 2005
    +++ llvm/include/llvm/Transforms/LinkAllPasses.h	Sat Jan  8 11:21:39 2005
    @@ -42,6 +42,7 @@
     
           (void) llvm::createAggressiveDCEPass();
           (void) llvm::createArgumentPromotionPass();
    +      (void) llvm::createBlockPlacementPass();
           (void) llvm::createBlockProfilerPass();
           (void) llvm::createBreakCriticalEdgesPass();
           (void) llvm::createCFGSimplificationPass();
    @@ -68,6 +69,7 @@
           (void) llvm::createInstructionCombiningPass();
           (void) llvm::createInternalizePass();
           (void) llvm::createLICMPass();
    +      (void) llvm::createLoopExtractorPass();
           (void) llvm::createLoopInstrumentationPass();
           (void) llvm::createLoopSimplifyPass();
           (void) llvm::createLoopStrengthReducePass();
    @@ -78,8 +80,10 @@
           (void) llvm::createLowerGCPass();
           (void) llvm::createLowerInvokePass();
           (void) llvm::createLowerPackedPass();
    +      (void) llvm::createLowerSelectPass();
           (void) llvm::createLowerSetJmpPass();
           (void) llvm::createLowerSwitchPass();
    +      (void) llvm::createPREPass();
           (void) llvm::createProfilePathsPass();
           (void) llvm::createPromoteMemoryToRegister();
           (void) llvm::createPruneEHPass();
    @@ -89,11 +93,13 @@
           (void) llvm::createSCCPPass();
           (void) llvm::createScalarReplAggregatesPass();
           (void) llvm::createSingleLoopExtractorPass();
    +      (void) llvm::createStripSymbolsPass();
           (void) llvm::createTailCallEliminationPass();
           (void) llvm::createTailDuplicationPass();
           (void) llvm::createTraceBasicBlockPass();
           (void) llvm::createTraceValuesPassForBasicBlocks();
           (void) llvm::createTraceValuesPassForFunction();
    +      (void) llvm::createUnifyFunctionExitNodesPass();
         }
       } X;
     };
    
    
    Index: llvm/include/llvm/Transforms/Scalar.h
    diff -u llvm/include/llvm/Transforms/Scalar.h:1.50 llvm/include/llvm/Transforms/Scalar.h:1.51
    --- llvm/include/llvm/Transforms/Scalar.h:1.50	Thu Dec  2 15:24:19 2004
    +++ llvm/include/llvm/Transforms/Scalar.h	Sat Jan  8 11:21:39 2005
    @@ -275,7 +275,16 @@
     // Returns a pass which converts all instances of ConstantExpression
     // into regular LLVM instructions.
     FunctionPass* createLowerConstantExpressionsPass();
    -  
    +
    +//===----------------------------------------------------------------------===//
    +// This pass reorders basic blocks in order to increase the number of fall-
    +// through conditional branches.
    +FunctionPass *createBlockPlacementPass();
    +
    +//===----------------------------------------------------------------------===//
    +// This pass does partial redundancy elimination.
    +FunctionPass *createPREPass();
    +
     } // End llvm namespace
     
     #endif
    
    
    
    
    
    From jeffc at jolt-lang.org  Sat Jan  8 12:15:34 2005
    From: jeffc at jolt-lang.org (Jeff Cohen)
    Date: Sat, 8 Jan 2005 12:15:34 -0600
    Subject: [llvm-commits] CVS: llvm/include/llvm/Transforms/LinkAllPasses.h 
    Message-ID: <200501081815.MAA15098@zion.cs.uiuc.edu>
    
    
    
    Changes in directory llvm/include/llvm/Transforms:
    
    LinkAllPasses.h updated: 1.10 -> 1.11
    ---
    Log message:
    
    Add a few more passes to LinkAllPasses.h
    
    ---
    Diffs of the changes:  (+6 -0)
    
    Index: llvm/include/llvm/Transforms/LinkAllPasses.h
    diff -u llvm/include/llvm/Transforms/LinkAllPasses.h:1.10 llvm/include/llvm/Transforms/LinkAllPasses.h:1.11
    --- llvm/include/llvm/Transforms/LinkAllPasses.h:1.10	Sat Jan  8 11:21:39 2005
    +++ llvm/include/llvm/Transforms/LinkAllPasses.h	Sat Jan  8 12:15:23 2005
    @@ -18,6 +18,9 @@
     
     #ifdef _MSC_VER
     
    +#include "llvm/Analysis/Passes.h"
    +#include "llvm/Analysis/LoadValueNumbering.h"
    +#include "llvm/CodeGen/Passes.h"
     #include "llvm/Transforms/Instrumentation.h"
     #include "llvm/Transforms/IPO.h"
     #include "llvm/Transforms/Scalar.h"
    @@ -63,12 +66,14 @@
           (void) llvm::createGCSEPass();
           (void) llvm::createGlobalDCEPass();
           (void) llvm::createGlobalOptimizerPass();
    +      (void) llvm::createGlobalsModRefPass();
           (void) llvm::createIPConstantPropagationPass();
           (void) llvm::createIPSCCPPass();
           (void) llvm::createIndVarSimplifyPass();
           (void) llvm::createInstructionCombiningPass();
           (void) llvm::createInternalizePass();
           (void) llvm::createLICMPass();
    +      (void) llvm::createLoadValueNumberingPass();
           (void) llvm::createLoopExtractorPass();
           (void) llvm::createLoopInstrumentationPass();
           (void) llvm::createLoopSimplifyPass();
    @@ -100,6 +105,7 @@
           (void) llvm::createTraceValuesPassForBasicBlocks();
           (void) llvm::createTraceValuesPassForFunction();
           (void) llvm::createUnifyFunctionExitNodesPass();
    +      (void) llvm::createUnreachableBlockEliminationPass();
         }
       } X;
     };
    
    
    
    
    
    From jeffc at jolt-lang.org  Sat Jan  8 12:15:34 2005
    From: jeffc at jolt-lang.org (Jeff Cohen)
    Date: Sat, 8 Jan 2005 12:15:34 -0600
    Subject: [llvm-commits] CVS: llvm/win32/llvm.sln 
    Message-ID: <200501081815.MAA15101@zion.cs.uiuc.edu>
    
    
    
    Changes in directory llvm/win32:
    
    llvm.sln updated: 1.15 -> 1.16
    ---
    Log message:
    
    Add a few more passes to LinkAllPasses.h
    
    ---
    Diffs of the changes:  (+1 -0)
    
    Index: llvm/win32/llvm.sln
    diff -u llvm/win32/llvm.sln:1.15 llvm/win32/llvm.sln:1.16
    --- llvm/win32/llvm.sln:1.15	Thu Jan  6 00:02:53 2005
    +++ llvm/win32/llvm.sln	Sat Jan  8 12:15:23 2005
    @@ -170,6 +170,7 @@
     		{19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E}
     		{F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D61} = {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D61}
     		{059FBAB8-C76D-48A0-AA75-3C57BD3EAFE4} = {059FBAB8-C76D-48A0-AA75-3C57BD3EAFE4}
    +		{08CEB1BB-C2A4-4587-B9A9-AEDB8FB44897} = {08CEB1BB-C2A4-4587-B9A9-AEDB8FB44897}
     		{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}
    
    
    
    
    
    From criswell at cs.uiuc.edu  Sat Jan  8 13:10:59 2005
    From: criswell at cs.uiuc.edu (John Criswell)
    Date: Sat, 8 Jan 2005 13:10:59 -0600
    Subject: [llvm-commits] CVS: llvm/LICENSE.TXT 
    Message-ID: <200501081910.NAA20557@choi.cs.uiuc.edu>
    
    
    
    Changes in directory llvm:
    
    LICENSE.TXT updated: 1.23 -> 1.24
    ---
    Log message:
    
    Another year, another copyright update.
    
    
    ---
    Diffs of the changes:  (+1 -1)
    
    Index: llvm/LICENSE.TXT
    diff -u llvm/LICENSE.TXT:1.23 llvm/LICENSE.TXT:1.24
    --- llvm/LICENSE.TXT:1.23	Sat Nov 27 13:20:23 2004
    +++ llvm/LICENSE.TXT	Sat Jan  8 13:10:44 2005
    @@ -4,7 +4,7 @@
     University of Illinois/NCSA
     Open Source License
     
    -Copyright (c) 2003, 2004 University of Illinois at Urbana-Champaign.
    +Copyright (c) 2003, 2004, 2005 University of Illinois at Urbana-Champaign.
     All rights reserved.
     
     Developed by:
    
    
    
    
    
    From lattner at cs.uiuc.edu  Sat Jan  8 13:25:54 2005
    From: lattner at cs.uiuc.edu (Chris Lattner)
    Date: Sat, 8 Jan 2005 13:25:54 -0600
    Subject: [llvm-commits] CVS: llvm/include/llvm/Target/TargetLowering.h 
    Message-ID: <200501081925.j08JPsT1017570@apoc.cs.uiuc.edu>
    
    
    
    Changes in directory llvm/include/llvm/Target:
    
    TargetLowering.h updated: 1.1 -> 1.2
    ---
    Log message:
    
    Make LowerCallTo more generic and useful.
    
    
    ---
    Diffs of the changes:  (+6 -3)
    
    Index: llvm/include/llvm/Target/TargetLowering.h
    diff -u llvm/include/llvm/Target/TargetLowering.h:1.1 llvm/include/llvm/Target/TargetLowering.h:1.2
    --- llvm/include/llvm/Target/TargetLowering.h:1.1	Fri Jan  7 01:44:22 2005
    +++ llvm/include/llvm/Target/TargetLowering.h	Sat Jan  8 13:25:39 2005
    @@ -165,10 +165,13 @@
       LowerArguments(Function &F, SelectionDAG &DAG) = 0;
     
       /// LowerCallTo - This hook lowers an abstract call to a function into an
    -  /// actual call.
    +  /// actual call.  This returns a pair of operands.  The first element is the
    +  /// return value for the function (if RetTy is not VoidTy).  The second
    +  /// element is the outgoing token chain.
       typedef std::vector > ArgListTy;
    -  virtual SDNode *LowerCallTo(const Type *RetTy, SDOperand Callee,
    -                              ArgListTy &Args, SelectionDAG &DAG) = 0;
    +  virtual std::pair
    +  LowerCallTo(SDOperand Chain, const Type *RetTy, SDOperand Callee,
    +              ArgListTy &Args, SelectionDAG &DAG) = 0;
     };
     } // end llvm namespace
     
    
    
    
    
    
    From lattner at cs.uiuc.edu  Sat Jan  8 13:26:31 2005
    From: lattner at cs.uiuc.edu (Chris Lattner)
    Date: Sat, 8 Jan 2005 13:26:31 -0600
    Subject: [llvm-commits] 
    	CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
    Message-ID: <200501081926.j08JQV39017584@apoc.cs.uiuc.edu>
    
    
    
    Changes in directory llvm/lib/CodeGen/SelectionDAG:
    
    SelectionDAGISel.cpp updated: 1.4 -> 1.5
    ---
    Log message:
    
    Adjust to changes in LowerCAllTo interfaces
    
    
    ---
    Diffs of the changes:  (+27 -14)
    
    Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
    diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.4 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.5
    --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.4	Sat Jan  8 02:08:56 2005
    +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp	Sat Jan  8 13:26:18 2005
    @@ -602,9 +602,11 @@
         Args.push_back(std::make_pair(ArgNode, Arg->getType()));
       }
       
    -  SDNode *Result = TLI.LowerCallTo(I.getType(), Callee, Args, DAG);
    +  std::pair Result =
    +    TLI.LowerCallTo(DAG.getRoot(), I.getType(), Callee, Args, DAG);
       if (I.getType() != Type::VoidTy)
    -    setValue(&I, SDOperand(Result, 0));
    +    setValue(&I, Result.first);
    +  DAG.setRoot(Result.second);
     }
     
     void SelectionDAGLowering::visitMalloc(MallocInst &I) {
    @@ -621,10 +623,13 @@
     
       std::vector > Args;
       Args.push_back(std::make_pair(Src, TLI.getTargetData().getIntPtrType()));
    -  SDNode *C = TLI.LowerCallTo(I.getType(),
    -                              DAG.getExternalSymbol("malloc", IntPtr),
    -                              Args, DAG);
    -  setValue(&I, SDOperand(C, 0));  // Pointers always fit in registers
    +
    +  std::pair Result =
    +    TLI.LowerCallTo(DAG.getRoot(), I.getType(),
    +                    DAG.getExternalSymbol("malloc", IntPtr),
    +                    Args, DAG);
    +  setValue(&I, Result.first);  // Pointers always fit in registers
    +  DAG.setRoot(Result.second);
     }
     
     void SelectionDAGLowering::visitFree(FreeInst &I) {
    @@ -632,8 +637,10 @@
       Args.push_back(std::make_pair(getValue(I.getOperand(0)),
                                     TLI.getTargetData().getIntPtrType()));
       MVT::ValueType IntPtr = TLI.getPointerTy();
    -  TLI.LowerCallTo(Type::VoidTy, DAG.getExternalSymbol("free", IntPtr),
    -                  Args, DAG);
    +  std::pair Result =
    +    TLI.LowerCallTo(DAG.getRoot(), Type::VoidTy,
    +                    DAG.getExternalSymbol("free", IntPtr), Args, DAG);
    +  DAG.setRoot(Result.second);
     }
     
     void SelectionDAGLowering::visitVAStart(CallInst &I) {
    @@ -689,8 +696,10 @@
       Args.push_back(std::make_pair(Val, Type::IntTy));
       Args.push_back(std::make_pair(getValue(I.getOperand(3)), IntPtrTy));
       
    -  TLI.LowerCallTo(Type::VoidTy, DAG.getExternalSymbol("memset", IntPtr),
    -                  Args, DAG);
    +  std::pair Result =
    +    TLI.LowerCallTo(DAG.getRoot(), Type::VoidTy,
    +                    DAG.getExternalSymbol("memset", IntPtr), Args, DAG);
    +  DAG.setRoot(Result.second);
     }
     
     void SelectionDAGLowering::visitMemCpy(CallInst &I) {
    @@ -702,8 +711,10 @@
       Args.push_back(std::make_pair(getValue(I.getOperand(2)), IntPtrTy));
       Args.push_back(std::make_pair(getValue(I.getOperand(3)), IntPtrTy));
       
    -  TLI.LowerCallTo(Type::VoidTy, DAG.getExternalSymbol("memcpy", IntPtr),
    -                  Args, DAG);
    +  std::pair Result =
    +    TLI.LowerCallTo(DAG.getRoot(), Type::VoidTy,
    +                    DAG.getExternalSymbol("memcpy", IntPtr), Args, DAG);
    +  DAG.setRoot(Result.second);
     }
     
     void SelectionDAGLowering::visitMemMove(CallInst &I) {
    @@ -715,8 +726,10 @@
       Args.push_back(std::make_pair(getValue(I.getOperand(2)), IntPtrTy));
       Args.push_back(std::make_pair(getValue(I.getOperand(3)), IntPtrTy));
       
    -  TLI.LowerCallTo(Type::VoidTy, DAG.getExternalSymbol("memmove", IntPtr),
    -                  Args, DAG);
    +  std::pair Result =
    +    TLI.LowerCallTo(DAG.getRoot(), Type::VoidTy,
    +                    DAG.getExternalSymbol("memmove", IntPtr), Args, DAG);
    +  DAG.setRoot(Result.second);
     }
     
     unsigned SelectionDAGISel::MakeReg(MVT::ValueType VT) {
    
    
    
    
    
    From lattner at cs.uiuc.edu  Sat Jan  8 13:27:18 2005
    From: lattner at cs.uiuc.edu (Chris Lattner)
    Date: Sat, 8 Jan 2005 13:27:18 -0600
    Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp 
    Message-ID: <200501081927.j08JRItg017600@apoc.cs.uiuc.edu>
    
    
    
    Changes in directory llvm/lib/CodeGen/SelectionDAG:
    
    LegalizeDAG.cpp updated: 1.12 -> 1.13
    ---
    Log message:
    
    Implement handling of most long operators through libcalls.
    Fix a bug legalizing "ret (Val,Val)"
    
    
    ---
    Diffs of the changes:  (+65 -5)
    
    Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
    diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.12 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.13
    --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.12	Sat Jan  8 02:08:56 2005
    +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp	Sat Jan  8 13:27:05 2005
    @@ -19,6 +19,20 @@
     #include 
     using namespace llvm;
     
    +static const Type *getTypeFor(MVT::ValueType VT) {
    +  switch (VT) {
    +  default: assert(0 && "Unknown MVT!");
    +  case MVT::i1: return Type::BoolTy;
    +  case MVT::i8: return Type::UByteTy;
    +  case MVT::i16: return Type::UShortTy;
    +  case MVT::i32: return Type::UIntTy;
    +  case MVT::i64: return Type::ULongTy;
    +  case MVT::f32: return Type::FloatTy;
    +  case MVT::f64: return Type::DoubleTy;
    +  }
    +}
    +
    +
     //===----------------------------------------------------------------------===//
     /// SelectionDAGLegalize - This takes an arbitrary SelectionDAG as input and
     /// hacks on it until the target machine can handle it.  This involves
    @@ -403,7 +417,7 @@
           for (unsigned i = 1, e = Node->getNumOperands(); i != e; ++i)
             switch (getTypeAction(Node->getOperand(i).getValueType())) {
             case Legal:
    -          NewValues.push_back(LegalizeOp(Node->getOperand(1)));
    +          NewValues.push_back(LegalizeOp(Node->getOperand(i)));
               break;
             case Expand: {
               SDOperand Lo, Hi;
    @@ -638,10 +652,11 @@
         }
       }
     
    -  // If we are lowering to a type that the target doesn't support, we will have
    -  // to iterate lowering.
    -  if (!isTypeLegal(NVT))
    -    NeedsAnotherIteration = true;
    +  // Expanding to multiple registers needs to perform an optimization step, and
    +  // is not careful to avoid operations the target does not support.  Make sure
    +  // that all generated operations are legalized in the next iteration.
    +  NeedsAnotherIteration = true;
    +  const char *LibCallName = 0;
     
       LegalizeAction Action;
       switch (Node->getOpcode()) {
    @@ -750,6 +765,51 @@
         // The high part is just a zero.
         Hi = DAG.getConstant(0, NVT);
         break;
    +
    +    // These operators cannot be expanded directly, emit them as calls to
    +    // library functions.
    +  case ISD::FP_TO_SINT:
    +    if (Node->getOperand(0).getValueType() == MVT::f32)
    +      LibCallName = "__fixsfdi";
    +    else
    +      LibCallName = "__fixdfdi";
    +    break;
    +  case ISD::FP_TO_UINT:
    +    if (Node->getOperand(0).getValueType() == MVT::f32)
    +      LibCallName = "__fixunssfdi";
    +    else
    +      LibCallName = "__fixunsdfdi";
    +    break;
    +
    +  case ISD::ADD:  LibCallName = "__adddi3"; break;
    +  case ISD::SUB:  LibCallName = "__subdi3"; break;
    +  case ISD::MUL:  LibCallName = "__muldi3"; break;
    +  case ISD::SDIV: LibCallName = "__divdi3"; break;
    +  case ISD::UDIV: LibCallName = "__udivdi3"; break;
    +  case ISD::SREM: LibCallName = "__moddi3"; break;
    +  case ISD::UREM: LibCallName = "__umoddi3"; break;
    +  case ISD::SHL:  LibCallName = "__lshrdi3"; break;
    +  case ISD::SRA:  LibCallName = "__ashrdi3"; break;
    +  case ISD::SRL:  LibCallName = "__ashldi3"; break;
    +  }
    +
    +  // Int2FP -> __floatdisf/__floatdidf
    +
    +  // If this is to be expanded into a libcall... do so now.
    +  if (LibCallName) {
    +    TargetLowering::ArgListTy Args;
    +    for (unsigned i = 0, e = Node->getNumOperands(); i != e; ++i)
    +      Args.push_back(std::make_pair(Node->getOperand(i),
    +                               getTypeFor(Node->getOperand(i).getValueType())));
    +    SDOperand Callee = DAG.getExternalSymbol(LibCallName, TLI.getPointerTy());
    +
    +    // We don't care about token chains for libcalls.  We just use the entry
    +    // node as our input and ignore the output chain.  This allows us to place
    +    // calls wherever we need them to satisfy data dependences.
    +    SDOperand Result = TLI.LowerCallTo(DAG.getEntryNode(),
    +                                       getTypeFor(Op.getValueType()), Callee,
    +                                       Args, DAG).first;
    +    ExpandOp(Result, Lo, Hi);
       }
     
       // Remember in a map if the values will be reused later.
    
    
    
    
    
    From lattner at cs.uiuc.edu  Sat Jan  8 13:28:31 2005
    From: lattner at cs.uiuc.edu (Chris Lattner)
    Date: Sat, 8 Jan 2005 13:28:31 -0600
    Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelPattern.cpp 
    Message-ID: <200501081928.j08JSVVk017616@apoc.cs.uiuc.edu>
    
    
    
    Changes in directory llvm/lib/Target/X86:
    
    X86ISelPattern.cpp updated: 1.12 -> 1.13
    ---
    Log message:
    
    Adjust to changes in LowerCallTo interface
    Minor bugfixes
    
    
    ---
    Diffs of the changes:  (+39 -30)
    
    Index: llvm/lib/Target/X86/X86ISelPattern.cpp
    diff -u llvm/lib/Target/X86/X86ISelPattern.cpp:1.12 llvm/lib/Target/X86/X86ISelPattern.cpp:1.13
    --- llvm/lib/Target/X86/X86ISelPattern.cpp:1.12	Fri Jan  7 01:49:41 2005
    +++ llvm/lib/Target/X86/X86ISelPattern.cpp	Sat Jan  8 13:28:19 2005
    @@ -64,8 +64,9 @@
     
         /// LowerCallTo - This hook lowers an abstract call to a function into an
         /// actual call.
    -    virtual SDNode *LowerCallTo(const Type *RetTy, SDOperand Callee,
    -                                ArgListTy &Args, SelectionDAG &DAG);
    +    virtual std::pair
    +    LowerCallTo(SDOperand Chain, const Type *RetTy, SDOperand Callee,
    +                ArgListTy &Args, SelectionDAG &DAG);
       };
     }
     
    @@ -130,15 +131,17 @@
       return ArgValues;
     }
     
    -SDNode *X86TargetLowering::LowerCallTo(const Type *RetTy, SDOperand Callee,
    -                                       ArgListTy &Args, SelectionDAG &DAG) {
    +std::pair
    +X86TargetLowering::LowerCallTo(SDOperand Chain,
    +                               const Type *RetTy, SDOperand Callee,
    +                               ArgListTy &Args, SelectionDAG &DAG) {
       // Count how many bytes are to be pushed on the stack.
       unsigned NumBytes = 0;
     
       if (Args.empty()) {
         // Save zero bytes.
    -    DAG.setRoot(DAG.getNode(ISD::ADJCALLSTACKDOWN, MVT::Other, DAG.getRoot(),
    -                            DAG.getConstant(0, getPointerTy())));
    +    Chain = DAG.getNode(ISD::ADJCALLSTACKDOWN, MVT::Other, Chain,
    +                        DAG.getConstant(0, getPointerTy()));
       } else {
         for (unsigned i = 0, e = Args.size(); i != e; ++i)
           switch (getValueType(Args[i].second)) {
    @@ -156,8 +159,8 @@
             break;
           }
     
    -    DAG.setRoot(DAG.getNode(ISD::ADJCALLSTACKDOWN, MVT::Other, DAG.getRoot(), 
    -                            DAG.getConstant(NumBytes, getPointerTy())));
    +    Chain = DAG.getNode(ISD::ADJCALLSTACKDOWN, MVT::Other, Chain,
    +                        DAG.getConstant(NumBytes, getPointerTy()));
     
         // Arguments go on the stack in reverse order, as specified by the ABI.
         unsigned ArgOffset = 0;
    @@ -183,15 +186,15 @@
           case MVT::i32:
           case MVT::f32:
             // FIXME: Note that all of these stores are independent of each other.
    -        DAG.setRoot(DAG.getNode(ISD::STORE, MVT::Other, DAG.getRoot(),
    -                                Args[i].first, PtrOff));
    +        Chain = DAG.getNode(ISD::STORE, MVT::Other, Chain,
    +                            Args[i].first, PtrOff);
             ArgOffset += 4;
             break;
           case MVT::i64:
           case MVT::f64:
             // FIXME: Note that all of these stores are independent of each other.
    -        DAG.setRoot(DAG.getNode(ISD::STORE, MVT::Other, DAG.getRoot(),
    -                                Args[i].first, PtrOff));
    +        Chain = DAG.getNode(ISD::STORE, MVT::Other, Chain,
    +                            Args[i].first, PtrOff);
             ArgOffset += 8;
             break;
           }
    @@ -204,11 +207,11 @@
         RetVals.push_back(RetTyVT);
       RetVals.push_back(MVT::Other);
     
    -  SDNode *TheCall = DAG.getCall(RetVals, DAG.getRoot(), Callee);
    -  DAG.setRoot(SDOperand(TheCall, TheCall->getNumValues()-1));
    -  DAG.setRoot(DAG.getNode(ISD::ADJCALLSTACKUP, MVT::Other, DAG.getRoot(),
    -              DAG.getConstant(NumBytes, getPointerTy())));
    -  return TheCall;
    +  SDOperand TheCall = SDOperand(DAG.getCall(RetVals, Chain, Callee), 0);
    +  Chain = TheCall.getValue(RetVals.size()-1);
    +  Chain = DAG.getNode(ISD::ADJCALLSTACKUP, MVT::Other, Chain,
    +                      DAG.getConstant(NumBytes, getPointerTy()));
    +  return std::make_pair(TheCall, Chain);
     }
     
     
    @@ -587,6 +590,8 @@
       unsigned Tmp1, Tmp2, Tmp3;
       unsigned Opc = 0;
     
    +  SDNode *Node = N.Val;
    +
       if (N.getOpcode() == ISD::CopyFromReg)
         // Just use the specified register as our input.
         return dyn_cast(N)->getReg();
    @@ -595,7 +600,7 @@
       // register it is code generated in, instead of emitting it multiple
       // times.
       // FIXME: Disabled for our current selection model.
    -  if (1 || !N.Val->hasOneUse()) {
    +  if (1 || !Node->hasOneUse()) {
         unsigned &Reg = ExprMap[N];
         if (Reg) return Reg;
     
    @@ -605,14 +610,14 @@
         else {
           // If this is a call instruction, make sure to prepare ALL of the result
           // values as well as the chain.
    -      if (N.Val->getNumValues() == 1)
    +      if (Node->getNumValues() == 1)
             Reg = Result = 1;  // Void call, just a chain.
           else {
    -        Result = MakeReg(N.Val->getValueType(0));
    -        ExprMap[SDOperand(N.Val,0)] = Result;
    +        Result = MakeReg(Node->getValueType(0));
    +        ExprMap[N.getValue(0)] = Result;
             for (unsigned i = 1, e = N.Val->getNumValues()-1; i != e; ++i)
    -          ExprMap[SDOperand(N.Val, i)] = MakeReg(N.Val->getValueType(i));
    -        ExprMap[SDOperand(N.Val, N.Val->getNumValues()-1)] = 1;
    +          ExprMap[N.getValue(i)] = MakeReg(Node->getValueType(i));
    +        ExprMap[SDOperand(Node, Node->getNumValues()-1)] = 1;
           }
         }
       } else {
    @@ -621,7 +626,7 @@
     
       switch (N.getOpcode()) {
       default:
    -    N.Val->dump();
    +    Node->dump();
         assert(0 && "Node not handled!\n");
       case ISD::FrameIndex:
         Tmp1 = cast(N)->getIndex();
    @@ -733,7 +738,6 @@
         addFrameReference(BuildMI(BB, X86::FLD32m, 5, Result), Tmp2);
         ContainsFPCode = true;
         return Result;
    -
       case ISD::ADD:
         // See if we can codegen this as an LEA to fold operations together.
         if (N.getValueType() == MVT::i32) {
    @@ -1162,6 +1166,8 @@
                   MVT::isFloatingPoint(N.getOperand(1).getValueType()));
         return Result;
       case ISD::LOAD: {
    +    // The chain for this load is now lowered.
    +    LoweredTokens.insert(SDOperand(Node, 1));
         Select(N.getOperand(0));
     
         // Make sure we generate both values.
    @@ -1170,7 +1176,7 @@
         else
           Result = ExprMap[N.getValue(0)] = MakeReg(N.getValue(0).getValueType());
     
    -    switch (N.Val->getValueType(0)) {
    +    switch (Node->getValueType(0)) {
         default: assert(0 && "Cannot load this type!");
         case MVT::i1:
         case MVT::i8:  Opc = X86::MOV8rm; break;
    @@ -1224,6 +1230,9 @@
         return Result;
     
       case ISD::CALL:
    +    // The chain for this call is now lowered.
    +    LoweredTokens.insert(N.getValue(Node->getNumValues()-1));
    +
         Select(N.getOperand(0));
         if (GlobalAddressSDNode *GASD =
                    dyn_cast(N.getOperand(1))) {
    @@ -1236,7 +1245,7 @@
           Tmp1 = SelectExpr(N.getOperand(1));
           BuildMI(BB, X86::CALL32r, 1).addReg(Tmp1);
         }
    -    switch (N.Val->getValueType(0)) {
    +    switch (Node->getValueType(0)) {
         default: assert(0 && "Unknown value type for call result!");
         case MVT::Other: return 1;
         case MVT::i1:
    @@ -1248,7 +1257,7 @@
           break;
         case MVT::i32:
           BuildMI(BB, X86::MOV32rr, 1, Result).addReg(X86::EAX);
    -      if (N.Val->getValueType(1) == MVT::i32)
    +      if (Node->getValueType(1) == MVT::i32)
             BuildMI(BB, X86::MOV32rr, 1, Result+1).addReg(X86::EDX);
           break;
         case MVT::f32:
    @@ -1299,11 +1308,11 @@
         default:
           assert(0 && "Unknown return instruction!");
         case 3:
    -      Tmp1 = SelectExpr(N.getOperand(1));
    -      Tmp2 = SelectExpr(N.getOperand(2));
           assert(N.getOperand(1).getValueType() == MVT::i32 &&
     	     N.getOperand(2).getValueType() == MVT::i32 &&
     	     "Unknown two-register value!");
    +      Tmp1 = SelectExpr(N.getOperand(1));
    +      Tmp2 = SelectExpr(N.getOperand(2));
           BuildMI(BB, X86::MOV32rr, 1, X86::EAX).addReg(Tmp1);
           BuildMI(BB, X86::MOV32rr, 1, X86::EDX).addReg(Tmp2);
           // Declare that EAX & EDX are live on exit.
    
    
    
    
    
    From lattner at cs.uiuc.edu  Sat Jan  8 13:31:45 2005
    From: lattner at cs.uiuc.edu (Chris Lattner)
    Date: Sat, 8 Jan 2005 13:31:45 -0600
    Subject: [llvm-commits] CVS: llvm/lib/Support/Timer.cpp 
    Message-ID: <200501081931.j08JVjlm017905@apoc.cs.uiuc.edu>
    
    
    
    Changes in directory llvm/lib/Support:
    
    Timer.cpp updated: 1.39 -> 1.40
    ---
    Log message:
    
    Silence a VS warning.
    
    
    ---
    Diffs of the changes:  (+1 -1)
    
    Index: llvm/lib/Support/Timer.cpp
    diff -u llvm/lib/Support/Timer.cpp:1.39 llvm/lib/Support/Timer.cpp:1.40
    --- llvm/lib/Support/Timer.cpp:1.39	Mon Dec 27 02:03:04 2004
    +++ llvm/lib/Support/Timer.cpp	Sat Jan  8 13:31:31 2005
    @@ -95,7 +95,7 @@
     
     static inline long getMemUsage() {
       if (TrackSpace)
    -    return sys::Process::GetMallocUsage();
    +    return (long)sys::Process::GetMallocUsage();
       return 0;
     }
     
    
    
    
    
    
    From lattner at cs.uiuc.edu  Sat Jan  8 13:33:11 2005
    From: lattner at cs.uiuc.edu (Chris Lattner)
    Date: Sat, 8 Jan 2005 13:33:11 -0600
    Subject: [llvm-commits] CVS: llvm/lib/Support/Compressor.cpp 
    Message-ID: <200501081933.j08JXBlO017919@apoc.cs.uiuc.edu>
    
    
    
    Changes in directory llvm/lib/Support:
    
    Compressor.cpp updated: 1.9 -> 1.10
    ---
    Log message:
    
    Do not throw away bits for no reason
    
    
    ---
    Diffs of the changes:  (+1 -1)
    
    Index: llvm/lib/Support/Compressor.cpp
    diff -u llvm/lib/Support/Compressor.cpp:1.9 llvm/lib/Support/Compressor.cpp:1.10
    --- llvm/lib/Support/Compressor.cpp:1.9	Tue Nov 30 01:13:34 2004
    +++ llvm/lib/Support/Compressor.cpp	Sat Jan  8 13:32:59 2005
    @@ -328,7 +328,7 @@
     uint64_t 
     Compressor::compressToNewBuffer(const char* in, unsigned size, char*&out) {
       BufferContext bc(size);
    -  unsigned result = compress(in,size,BufferContext::callback,(void*)&bc);
    +  uint64_t result = compress(in,size,BufferContext::callback,(void*)&bc);
       out = bc.buff;
       return result;
     }
    
    
    
    
    
    From lattner at cs.uiuc.edu  Sat Jan  8 13:34:53 2005
    From: lattner at cs.uiuc.edu (Chris Lattner)
    Date: Sat, 8 Jan 2005 13:34:53 -0600
    Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/SCCP.cpp
    	ScalarReplAggregates.cpp 
    Message-ID: <200501081934.j08JYrr1017938@apoc.cs.uiuc.edu>
    
    
    
    Changes in directory llvm/lib/Transforms/Scalar:
    
    SCCP.cpp updated: 1.119 -> 1.120
    ScalarReplAggregates.cpp updated: 1.29 -> 1.30
    ---
    Log message:
    
    Silence warnings
    
    
    ---
    Diffs of the changes:  (+4 -3)
    
    Index: llvm/lib/Transforms/Scalar/SCCP.cpp
    diff -u llvm/lib/Transforms/Scalar/SCCP.cpp:1.119 llvm/lib/Transforms/Scalar/SCCP.cpp:1.120
    --- llvm/lib/Transforms/Scalar/SCCP.cpp:1.119	Sat Dec 11 17:15:19 2004
    +++ llvm/lib/Transforms/Scalar/SCCP.cpp	Sat Jan  8 13:34:41 2005
    @@ -771,12 +771,12 @@
           ConstantStruct *CS = dyn_cast(C);
           if (CS == 0) return 0;
           if (CU->getValue() >= CS->getNumOperands()) return 0;
    -      C = CS->getOperand(CU->getValue());
    +      C = CS->getOperand((unsigned)CU->getValue());
         } else if (ConstantSInt *CS = dyn_cast(CE->getOperand(i))) {
           ConstantArray *CA = dyn_cast(C);
           if (CA == 0) return 0;
           if ((uint64_t)CS->getValue() >= CA->getNumOperands()) return 0;
    -      C = CA->getOperand(CS->getValue());
    +      C = CA->getOperand((unsigned)CS->getValue());
         } else
           return 0;
       return C;
    
    
    Index: llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp
    diff -u llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.29 llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.30
    --- llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.29	Mon Nov 15 11:29:41 2004
    +++ llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp	Sat Jan  8 13:34:41 2005
    @@ -183,7 +183,8 @@
           Instruction *User = cast(AI->use_back());
           GetElementPtrInst *GEPI = cast(User);
           // We now know that the GEP is of the form: GEP , 0, 
    -      uint64_t Idx = cast(GEPI->getOperand(2))->getRawValue();
    +      unsigned Idx = 
    +         (unsigned)cast(GEPI->getOperand(2))->getRawValue();
           
           assert(Idx < ElementAllocas.size() && "Index out of range?");
           AllocaInst *AllocaToUse = ElementAllocas[Idx];
    
    
    
    
    
    From lattner at cs.uiuc.edu  Sat Jan  8 13:37:33 2005
    From: lattner at cs.uiuc.edu (Chris Lattner)
    Date: Sat, 8 Jan 2005 13:37:33 -0600
    Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopUnroll.cpp 
    Message-ID: <200501081937.j08JbXkw018137@apoc.cs.uiuc.edu>
    
    
    
    Changes in directory llvm/lib/Transforms/Scalar:
    
    LoopUnroll.cpp updated: 1.14 -> 1.15
    ---
    Log message:
    
    Silence VS warnings.
    
    
    ---
    Diffs of the changes:  (+7 -5)
    
    Index: llvm/lib/Transforms/Scalar/LoopUnroll.cpp
    diff -u llvm/lib/Transforms/Scalar/LoopUnroll.cpp:1.14 llvm/lib/Transforms/Scalar/LoopUnroll.cpp:1.15
    --- llvm/lib/Transforms/Scalar/LoopUnroll.cpp:1.14	Mon Nov 22 11:18:36 2004
    +++ llvm/lib/Transforms/Scalar/LoopUnroll.cpp	Sat Jan  8 13:37:20 2005
    @@ -136,21 +136,23 @@
       ConstantInt *TripCountC = dyn_cast_or_null(L->getTripCount());
       if (!TripCountC) return Changed;  // Must have constant trip count!
     
    -  unsigned TripCount = TripCountC->getRawValue();
    -  if (TripCount != TripCountC->getRawValue() || TripCount == 0)
    +  uint64_t TripCountFull = TripCountC->getRawValue();
    +  if (TripCountFull != TripCountC->getRawValue() || TripCountFull == 0)
         return Changed; // More than 2^32 iterations???
     
       unsigned LoopSize = ApproximateLoopSize(L);
       DEBUG(std::cerr << "Loop Unroll: F[" << BB->getParent()->getName()
             << "] Loop %" << BB->getName() << " Loop Size = " << LoopSize
    -        << " Trip Count = " << TripCount << " - ");
    -  uint64_t Size = (uint64_t)LoopSize*(uint64_t)TripCount;
    +        << " Trip Count = " << TripCountFull << " - ");
    +  uint64_t Size = (uint64_t)LoopSize*TripCountFull;
       if (Size > UnrollThreshold) {
         DEBUG(std::cerr << "TOO LARGE: " << Size << ">" << UnrollThreshold << "\n");
         return Changed;
       }
       DEBUG(std::cerr << "UNROLLING!\n");
    -  
    + 
    +  unsigned TripCount = (unsigned)TripCountFull;
    +
       BasicBlock *LoopExit = BI->getSuccessor(L->contains(BI->getSuccessor(0)));
     
       // Create a new basic block to temporarily hold all of the cloned code.
    
    
    
    
    
    From lattner at cs.uiuc.edu  Sat Jan  8 13:42:36 2005
    From: lattner at cs.uiuc.edu (Chris Lattner)
    Date: Sat, 8 Jan 2005 13:42:36 -0600
    Subject: [llvm-commits] 
    	CVS: llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
    	InstructionCombining.cpp 
    Message-ID: <200501081942.j08JgaBS018523@apoc.cs.uiuc.edu>
    
    
    
    Changes in directory llvm/lib/Transforms/Scalar:
    
    DeadStoreElimination.cpp updated: 1.9 -> 1.10
    InstructionCombining.cpp updated: 1.296 -> 1.297
    ---
    Log message:
    
    Fix uint64_t -> unsigned VS warnings.
    
    
    ---
    Diffs of the changes:  (+13 -12)
    
    Index: llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
    diff -u llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp:1.9 llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp:1.10
    --- llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp:1.9	Tue Dec 28 22:36:02 2004
    +++ llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp	Sat Jan  8 13:42:22 2005
    @@ -73,7 +73,7 @@
             unsigned Size = ~0U;
             if (!AI->isArrayAllocation() &&
                 AI->getType()->getElementType()->isSized())
    -          Size = TD.getTypeSize(AI->getType()->getElementType());
    +          Size = (unsigned)TD.getTypeSize(AI->getType()->getElementType());
             KillLocs.add(AI, Size);
           }
       }
    @@ -106,7 +106,7 @@
         // the stored location is already in the tracker, then this is a dead
         // store.  We can just delete it here, but while we're at it, we also
         // delete any trivially dead expression chains.
    -    unsigned ValSize = TD.getTypeSize(I->getOperand(0)->getType());
    +    unsigned ValSize = (unsigned)TD.getTypeSize(I->getOperand(0)->getType());
         Value *Ptr = I->getOperand(1);
     
         if (AliasSet *AS = KillLocs.getAliasSetForPointerIfExists(Ptr, ValSize))
    
    
    Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
    diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.296 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.297
    --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.296	Sat Jan  1 10:22:27 2005
    +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Sat Jan  8 13:42:22 2005
    @@ -2274,7 +2274,7 @@
     
                 if (LHSI->hasOneUse()) {
                   // Otherwise strength reduce the shift into an and.
    -              unsigned ShAmtVal = ShAmt->getValue();
    +              unsigned ShAmtVal = (unsigned)ShAmt->getValue();
                   unsigned TypeBits = CI->getType()->getPrimitiveSize()*8;
                   uint64_t Val = (1ULL << (TypeBits-ShAmtVal))-1;
     
    @@ -2317,7 +2317,7 @@
                 }
                   
                 if (LHSI->hasOneUse() || CI->isNullValue()) {
    -              unsigned ShAmtVal = ShAmt->getValue();
    +              unsigned ShAmtVal = (unsigned)ShAmt->getValue();
     
                   // Otherwise strength reduce the shift into an and.
                   uint64_t Val = ~0ULL;          // All ones.
    @@ -2931,8 +2931,8 @@
         if (ShiftInst *Op0SI = dyn_cast(Op0))
           if (ConstantUInt *ShiftAmt1C =
                                      dyn_cast(Op0SI->getOperand(1))) {
    -        unsigned ShiftAmt1 = ShiftAmt1C->getValue();
    -        unsigned ShiftAmt2 = CUI->getValue();
    +        unsigned ShiftAmt1 = (unsigned)ShiftAmt1C->getValue();
    +        unsigned ShiftAmt2 = (unsigned)CUI->getValue();
             
             // Check for (A << c1) << c2   and   (A >> c1) >> c2
             if (I.getOpcode() == Op0SI->getOpcode()) {
    @@ -3169,8 +3169,8 @@
             const Type *AllocElTy = AI->getAllocatedType();
             const Type *CastElTy = PTy->getElementType();
             if (AllocElTy->isSized() && CastElTy->isSized()) {
    -          unsigned AllocElTySize = TD->getTypeSize(AllocElTy);
    -          unsigned CastElTySize = TD->getTypeSize(CastElTy);
    +          uint64_t AllocElTySize = TD->getTypeSize(AllocElTy);
    +          uint64_t CastElTySize = TD->getTypeSize(CastElTy);
     
               // If the allocation is for an even multiple of the cast type size
               if (CastElTySize && (AllocElTySize % CastElTySize == 0)) {
    @@ -4190,12 +4190,13 @@
           ConstantUInt *CU = cast(I.getOperand());
           assert(CU->getValue() < STy->getNumElements() &&
                  "Struct index out of range!");
    +      unsigned El = (unsigned)CU->getValue();
           if (ConstantStruct *CS = dyn_cast(C)) {
    -        C = CS->getOperand(CU->getValue());
    +        C = CS->getOperand(El);
           } else if (isa(C)) {
    -	C = Constant::getNullValue(STy->getElementType(CU->getValue()));
    +	C = Constant::getNullValue(STy->getElementType(El));
           } else if (isa(C)) {
    -	C = UndefValue::get(STy->getElementType(CU->getValue()));
    +	C = UndefValue::get(STy->getElementType(El));
           } else {
             return 0;
           }
    @@ -4203,7 +4204,7 @@
           const ArrayType *ATy = cast(*I);
           if ((uint64_t)CI->getRawValue() >= ATy->getNumElements()) return 0;
           if (ConstantArray *CA = dyn_cast(C))
    -        C = CA->getOperand(CI->getRawValue());
    +        C = CA->getOperand((unsigned)CI->getRawValue());
           else if (isa(C))
             C = Constant::getNullValue(ATy->getElementType());
           else if (isa(C))
    
    
    
    
    
    From lattner at cs.uiuc.edu  Sat Jan  8 13:45:44 2005
    From: lattner at cs.uiuc.edu (Chris Lattner)
    Date: Sat, 8 Jan 2005 13:45:44 -0600
    Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
    	GlobalOpt.cpp 
    Message-ID: <200501081945.j08Jjig8018749@apoc.cs.uiuc.edu>
    
    
    
    Changes in directory llvm/lib/Transforms/IPO:
    
    ArgumentPromotion.cpp updated: 1.15 -> 1.16
    GlobalOpt.cpp updated: 1.32 -> 1.33
    ---
    Log message:
    
    Fix VS warnings.
    
    
    ---
    Diffs of the changes:  (+5 -4)
    
    Index: llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
    diff -u llvm/lib/Transforms/IPO/ArgumentPromotion.cpp:1.15 llvm/lib/Transforms/IPO/ArgumentPromotion.cpp:1.16
    --- llvm/lib/Transforms/IPO/ArgumentPromotion.cpp:1.15	Sat Nov 13 17:32:53 2004
    +++ llvm/lib/Transforms/IPO/ArgumentPromotion.cpp	Sat Jan  8 13:45:31 2005
    @@ -275,7 +275,7 @@
     
         const PointerType *LoadTy =
           cast(Load->getOperand(0)->getType());
    -    unsigned LoadSize = TD.getTypeSize(LoadTy->getElementType());
    +    unsigned LoadSize = (unsigned)TD.getTypeSize(LoadTy->getElementType());
     
         if (AA.canInstructionRangeModify(BB->front(), *Load, Arg, LoadSize))
           return false;  // Pointer is invalidated!
    
    
    Index: llvm/lib/Transforms/IPO/GlobalOpt.cpp
    diff -u llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.32 llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.33
    --- llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.32	Sun Dec 12 13:34:41 2004
    +++ llvm/lib/Transforms/IPO/GlobalOpt.cpp	Sat Jan  8 13:45:31 2005
    @@ -225,7 +225,7 @@
     static Constant *getAggregateConstantElement(Constant *Agg, Constant *Idx) {
       ConstantInt *CI = dyn_cast(Idx);
       if (!CI) return 0;
    -  uint64_t IdxV = CI->getRawValue();
    +  unsigned IdxV = (unsigned)CI->getRawValue();
     
       if (ConstantStruct *CS = dyn_cast(Agg)) {
         if (IdxV < CS->getNumOperands()) return CS->getOperand(IdxV);
    @@ -394,7 +394,8 @@
         // Ignore the 1th operand, which has to be zero or else the program is quite
         // broken (undefined).  Get the 2nd operand, which is the structure or array
         // index.
    -    unsigned Val = cast(GEP->getOperand(2))->getRawValue();
    +    unsigned Val =
    +       (unsigned)cast(GEP->getOperand(2))->getRawValue();
         if (Val >= NewGlobals.size()) Val = 0; // Out of bound array access.
     
         Value *NewPtr = NewGlobals[Val];
    @@ -641,7 +642,7 @@
         // If we have an array allocation, transform it to a single element
         // allocation to make the code below simpler.
         Type *NewTy = ArrayType::get(MI->getAllocatedType(),
    -                                 NElements->getRawValue());
    +                                 (unsigned)NElements->getRawValue());
         MallocInst *NewMI =
           new MallocInst(NewTy, Constant::getNullValue(Type::UIntTy),
                          MI->getName(), MI);
    
    
    
    
    
    From lattner at cs.uiuc.edu  Sat Jan  8 13:48:52 2005
    From: lattner at cs.uiuc.edu (Chris Lattner)
    Date: Sat, 8 Jan 2005 13:48:52 -0600
    Subject: [llvm-commits] CVS: llvm/lib/Transforms/ExprTypeConvert.cpp
    	TransformInternals.cpp 
    Message-ID: <200501081948.j08Jmq4I019343@apoc.cs.uiuc.edu>
    
    
    
    Changes in directory llvm/lib/Transforms:
    
    ExprTypeConvert.cpp updated: 1.99 -> 1.100
    TransformInternals.cpp updated: 1.46 -> 1.47
    ---
    Log message:
    
    Fix VS warnings
    
    
    ---
    Diffs of the changes:  (+13 -13)
    
    Index: llvm/lib/Transforms/ExprTypeConvert.cpp
    diff -u llvm/lib/Transforms/ExprTypeConvert.cpp:1.99 llvm/lib/Transforms/ExprTypeConvert.cpp:1.100
    --- llvm/lib/Transforms/ExprTypeConvert.cpp:1.99	Tue Sep 28 09:42:44 2004
    +++ llvm/lib/Transforms/ExprTypeConvert.cpp	Sat Jan  8 13:48:40 2005
    @@ -53,9 +53,9 @@
       ExprType Expr = ClassifyExpr(MI->getArraySize());
     
       // Get information about the base datatype being allocated, before & after
    -  int ReqTypeSize = TD.getTypeSize(Ty);
    +  uint64_t ReqTypeSize = TD.getTypeSize(Ty);
       if (ReqTypeSize == 0) return false;
    -  unsigned OldTypeSize = TD.getTypeSize(MI->getType()->getElementType());
    +  uint64_t OldTypeSize = TD.getTypeSize(MI->getType()->getElementType());
     
       // Must have a scale or offset to analyze it...
       if (!Expr.Offset && !Expr.Scale && OldTypeSize == 1) return false;
    @@ -66,8 +66,8 @@
     
       // The old type might not be of unit size, take old size into consideration
       // here...
    -  int64_t Offset = OffsetVal * OldTypeSize;
    -  int64_t Scale  = ScaleVal  * OldTypeSize;
    +  uint64_t Offset = OffsetVal * OldTypeSize;
    +  uint64_t Scale  = ScaleVal  * OldTypeSize;
       
       // In order to be successful, both the scale and the offset must be a multiple
       // of the requested data type's size.
    @@ -92,8 +92,8 @@
       const PointerType *AllocTy = cast(Ty);
       const Type *ElType = AllocTy->getElementType();
     
    -  unsigned DataSize = TD.getTypeSize(ElType);
    -  unsigned OldTypeSize = TD.getTypeSize(MI->getType()->getElementType());
    +  uint64_t DataSize = TD.getTypeSize(ElType);
    +  uint64_t OldTypeSize = TD.getTypeSize(MI->getType()->getElementType());
     
       // Get the offset and scale coefficients that we are allocating...
       int64_t OffsetVal = (Expr.Offset ? getConstantValue(Expr.Offset) : 0);
    @@ -101,8 +101,8 @@
     
       // The old type might not be of unit size, take old size into consideration
       // here...
    -  unsigned Offset = (uint64_t)OffsetVal * OldTypeSize / DataSize;
    -  unsigned Scale  = (uint64_t)ScaleVal  * OldTypeSize / DataSize;
    +  unsigned Offset = OffsetVal * OldTypeSize / DataSize;
    +  unsigned Scale  = ScaleVal  * OldTypeSize / DataSize;
     
       // Locate the malloc instruction, because we may be inserting instructions
       It = MI;
    @@ -784,7 +784,7 @@
         //
         if (I->getNumOperands() == 2) {
           const Type *OldElTy = cast(I->getType())->getElementType();
    -      unsigned DataSize = TD.getTypeSize(OldElTy);
    +      uint64_t DataSize = TD.getTypeSize(OldElTy);
           Value *Index = I->getOperand(1);
           Instruction *TempScale = 0;
     
    @@ -1103,7 +1103,7 @@
         //
         BasicBlock::iterator It = I;
         const Type *OldElTy = cast(I->getType())->getElementType();
    -    unsigned DataSize = TD.getTypeSize(OldElTy);
    +    uint64_t DataSize = TD.getTypeSize(OldElTy);
         Value *Index = I->getOperand(1);
     
         if (DataSize != 1) {
    
    
    Index: llvm/lib/Transforms/TransformInternals.cpp
    diff -u llvm/lib/Transforms/TransformInternals.cpp:1.46 llvm/lib/Transforms/TransformInternals.cpp:1.47
    --- llvm/lib/Transforms/TransformInternals.cpp:1.46	Thu Jul 29 07:17:33 2004
    +++ llvm/lib/Transforms/TransformInternals.cpp	Sat Jan  8 13:48:40 2005
    @@ -73,7 +73,7 @@
                "Offset not in composite!");
     
         NextType = ATy->getElementType();
    -    unsigned ChildSize = TD.getTypeSize(NextType);
    +    unsigned ChildSize = (unsigned)TD.getTypeSize(NextType);
         if (ConstantSInt::isValueValidForType(Type::IntTy, Offset/ChildSize))
           Indices.push_back(ConstantSInt::get(Type::IntTy, Offset/ChildSize));
         else
    @@ -84,10 +84,10 @@
         return Ty;    // Return the leaf type
       }
     
    -  unsigned SubOffs = Offset - ThisOffset;
    +  unsigned SubOffs = unsigned(Offset - ThisOffset);
       const Type *LeafTy = getStructOffsetType(NextType, SubOffs,
                                                Indices, TD, StopEarly);
    -  Offset = ThisOffset + SubOffs;
    +  Offset = unsigned(ThisOffset + SubOffs);
       return LeafTy;
     }
     
    
    
    
    
    
    From lattner at cs.uiuc.edu  Sat Jan  8 13:50:03 2005
    From: lattner at cs.uiuc.edu (Chris Lattner)
    Date: Sat, 8 Jan 2005 13:50:03 -0600
    Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/SelectionDAGNodes.h 
    Message-ID: <200501081950.j08Jo3mP019361@apoc.cs.uiuc.edu>
    
    
    
    Changes in directory llvm/include/llvm/CodeGen:
    
    SelectionDAGNodes.h updated: 1.5 -> 1.6
    ---
    Log message:
    
    Silence VS warnings.
    
    
    ---
    Diffs of the changes:  (+3 -2)
    
    Index: llvm/include/llvm/CodeGen/SelectionDAGNodes.h
    diff -u llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.5 llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.6
    --- llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.5	Sat Jan  8 02:08:49 2005
    +++ llvm/include/llvm/CodeGen/SelectionDAGNodes.h	Sat Jan  8 13:49:51 2005
    @@ -269,7 +269,8 @@
     /// computes it as well as which return value to use from that node.  This pair
     /// of information is represented with the SDOperand value type.
     ///
    -struct SDOperand {
    +class SDOperand {
    +public:
       SDNode *Val;        // The node defining the value we are using.
       unsigned ResNo;     // Which return value of the node we are using.
     
    @@ -463,7 +464,7 @@
     
       int64_t getSignExtended() const {
         unsigned Bits = MVT::getSizeInBits(getValueType(0));
    -    return ((int64_t)Value << 64-Bits) >> 64-Bits;
    +    return ((int64_t)Value << (64-Bits)) >> (64-Bits);
       }
     
       bool isNullValue() const { return Value == 0; }
    
    
    
    
    
    From lattner at cs.uiuc.edu  Sat Jan  8 13:52:43 2005
    From: lattner at cs.uiuc.edu (Chris Lattner)
    Date: Sat, 8 Jan 2005 13:52:43 -0600
    Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
    	SelectionDAGISel.cpp 
    Message-ID: <200501081952.j08Jqhu2019566@apoc.cs.uiuc.edu>
    
    
    
    Changes in directory llvm/lib/CodeGen/SelectionDAG:
    
    LegalizeDAG.cpp updated: 1.13 -> 1.14
    SelectionDAGISel.cpp updated: 1.5 -> 1.6
    ---
    Log message:
    
    Silence VS warnings.
    
    
    ---
    Diffs of the changes:  (+4 -5)
    
    Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
    diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.13 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.14
    --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.13	Sat Jan  8 13:27:05 2005
    +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp	Sat Jan  8 13:52:31 2005
    @@ -233,7 +233,6 @@
     
       SDOperand Result = Op;
       SDNode *Node = Op.Val;
    -  LegalizeAction Action;
     
       switch (Node->getOpcode()) {
       default:
    @@ -658,7 +657,6 @@
       NeedsAnotherIteration = true;
       const char *LibCallName = 0;
     
    -  LegalizeAction Action;
       switch (Node->getOpcode()) {
       default:
         std::cerr << "NODE: "; Node->dump(); std::cerr << "\n";
    
    
    Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
    diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.5 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.6
    --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.5	Sat Jan  8 13:26:18 2005
    +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp	Sat Jan  8 13:52:31 2005
    @@ -37,7 +37,8 @@
       //===--------------------------------------------------------------------===//
       /// FunctionLoweringInfo - This contains information that is global to a
       /// function that is used when lowering a region of the function.
    -  struct FunctionLoweringInfo {
    +  class FunctionLoweringInfo {
    +  public:
         TargetLowering &TLI;
         Function &Fn;
         MachineFunction &MF;
    @@ -119,11 +120,11 @@
             unsigned Align = TLI.getTargetData().getTypeAlignment(Ty);
             TySize *= CUI->getValue();   // Get total allocated size.
             StaticAllocaMap[AI] =
    -          MF.getFrameInfo()->CreateStackObject(TySize, Align);
    +          MF.getFrameInfo()->CreateStackObject((unsigned)TySize, Align);
           }
     
       for (; BB != E; ++BB)
    -    for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I)
    +    for (BasicBlock::iterator I = BB->begin(), e = BB->end(); I != e; ++I)
           if (!I->use_empty() && isUsedOutsideOfDefiningBlock(I))
             if (!isa(I) ||
                 !StaticAllocaMap.count(cast(I)))
    
    
    
    
    
    From lattner at cs.uiuc.edu  Sat Jan  8 13:54:05 2005
    From: lattner at cs.uiuc.edu (Chris Lattner)
    Date: Sat, 8 Jan 2005 13:54:05 -0600
    Subject: [llvm-commits] CVS: llvm/lib/CodeGen/RegAllocLinearScan.cpp
    	RegAllocIterativeScan.cpp 
    Message-ID: <200501081954.j08Js5OU019634@apoc.cs.uiuc.edu>
    
    
    
    Changes in directory llvm/lib/CodeGen:
    
    RegAllocLinearScan.cpp updated: 1.105 -> 1.106
    RegAllocIterativeScan.cpp updated: 1.19 -> 1.20
    ---
    Log message:
    
    Silence VS warnings
    
    
    ---
    Diffs of the changes:  (+2 -2)
    
    Index: llvm/lib/CodeGen/RegAllocLinearScan.cpp
    diff -u llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.105 llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.106
    --- llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.105	Wed Dec 15 01:04:17 2004
    +++ llvm/lib/CodeGen/RegAllocLinearScan.cpp	Sat Jan  8 13:53:50 2005
    @@ -423,7 +423,7 @@
     
       DEBUG(std::cerr << "\tassigning stack slot at interval "<< *cur << ":\n");
     
    -  float minWeight = HUGE_VAL;
    +  float minWeight = float(HUGE_VAL);
       unsigned minReg = 0;
       const TargetRegisterClass* rc = mf_->getSSARegMap()->getRegClass(cur->reg);
       for (TargetRegisterClass::iterator i = rc->allocation_order_begin(*mf_),
    
    
    Index: llvm/lib/CodeGen/RegAllocIterativeScan.cpp
    diff -u llvm/lib/CodeGen/RegAllocIterativeScan.cpp:1.19 llvm/lib/CodeGen/RegAllocIterativeScan.cpp:1.20
    --- llvm/lib/CodeGen/RegAllocIterativeScan.cpp:1.19	Wed Dec 15 01:04:32 2004
    +++ llvm/lib/CodeGen/RegAllocIterativeScan.cpp	Sat Jan  8 13:53:50 2005
    @@ -394,7 +394,7 @@
     
       DEBUG(std::cerr << "\tassigning stack slot at interval "<< *cur << ":\n");
     
    -  float minWeight = HUGE_VAL;
    +  float minWeight = (float)HUGE_VAL;
       unsigned minReg = 0;
       const TargetRegisterClass* rc = mf_->getSSARegMap()->getRegClass(cur->reg);
       for (TargetRegisterClass::iterator i = rc->allocation_order_begin(*mf_),
    
    
    
    
    
    From lattner at cs.uiuc.edu  Sat Jan  8 13:55:14 2005
    From: lattner at cs.uiuc.edu (Chris Lattner)
    Date: Sat, 8 Jan 2005 13:55:14 -0600
    Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
    	MachineFunction.cpp 
    Message-ID: <200501081955.j08JtEMQ019657@apoc.cs.uiuc.edu>
    
    
    
    Changes in directory llvm/lib/CodeGen:
    
    LiveIntervalAnalysis.cpp updated: 1.133 -> 1.134
    MachineFunction.cpp updated: 1.73 -> 1.74
    ---
    Log message:
    
    Silence warnings from VS
    
    
    ---
    Diffs of the changes:  (+5 -3)
    
    Index: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
    diff -u llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.133 llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.134
    --- llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.133	Mon Dec  6 22:03:45 2004
    +++ llvm/lib/CodeGen/LiveIntervalAnalysis.cpp	Sat Jan  8 13:54:59 2005
    @@ -261,7 +261,7 @@
     
                 // the spill weight is now infinity as it
                 // cannot be spilled again
    -            nI.weight = HUGE_VAL;
    +            nI.weight = float(HUGE_VAL);
                 LiveRange LR(start, end, nI.getNextValue());
                 DEBUG(std::cerr << " +" << LR);
                 nI.addRange(LR);
    @@ -694,6 +694,7 @@
     }
     
     LiveInterval LiveIntervals::createInterval(unsigned reg) {
    -  float Weight = MRegisterInfo::isPhysicalRegister(reg) ?  HUGE_VAL :0.0F;
    +  float Weight = MRegisterInfo::isPhysicalRegister(reg) ? 
    +                       (float)HUGE_VAL :0.0F;
       return LiveInterval(reg, Weight);
     }
    
    
    Index: llvm/lib/CodeGen/MachineFunction.cpp
    diff -u llvm/lib/CodeGen/MachineFunction.cpp:1.73 llvm/lib/CodeGen/MachineFunction.cpp:1.74
    --- llvm/lib/CodeGen/MachineFunction.cpp:1.73	Sun Sep  5 13:41:35 2004
    +++ llvm/lib/CodeGen/MachineFunction.cpp	Sat Jan  8 13:55:00 2005
    @@ -256,7 +256,8 @@
     /// CreateStackObject - Create a stack object for a value of the specified type.
     ///
     int MachineFrameInfo::CreateStackObject(const Type *Ty, const TargetData &TD) {
    -  return CreateStackObject(TD.getTypeSize(Ty), TD.getTypeAlignment(Ty));
    +  return CreateStackObject((unsigned)TD.getTypeSize(Ty), 
    +                           TD.getTypeAlignment(Ty));
     }
     
     
    
    
    
    
    
    From lattner at cs.uiuc.edu  Sat Jan  8 13:58:04 2005
    From: lattner at cs.uiuc.edu (Chris Lattner)
    Date: Sat, 8 Jan 2005 13:58:04 -0600
    Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/AsmPrinter.h 
    Message-ID: <200501081958.j08Jw4C1019711@apoc.cs.uiuc.edu>
    
    
    
    Changes in directory llvm/include/llvm/CodeGen:
    
    AsmPrinter.h updated: 1.9 -> 1.10
    ---
    Log message:
    
    Adjust prototype
    
    
    ---
    Diffs of the changes:  (+2 -1)
    
    Index: llvm/include/llvm/CodeGen/AsmPrinter.h
    diff -u llvm/include/llvm/CodeGen/AsmPrinter.h:1.9 llvm/include/llvm/CodeGen/AsmPrinter.h:1.10
    --- llvm/include/llvm/CodeGen/AsmPrinter.h:1.9	Tue Aug 17 21:22:34 2004
    +++ llvm/include/llvm/CodeGen/AsmPrinter.h	Sat Jan  8 13:57:49 2005
    @@ -17,6 +17,7 @@
     #define LLVM_CODEGEN_ASMPRINTER_H
     
     #include "llvm/CodeGen/MachineFunctionPass.h"
    +#include "llvm/Support/DataTypes.h"
     
     namespace llvm {
       class Constant;
    @@ -116,7 +117,7 @@
     
         /// emitZeros - Emit a block of zeros.
         ///
    -    void emitZeros(unsigned NumZeros) const;
    +    void emitZeros(uint64_t NumZeros) const;
     
         /// emitConstantValueOnly - Print out the specified constant, without a
         /// storage class.  Only constants of first-class type are allowed here.
    
    
    
    
    
    From lattner at cs.uiuc.edu  Sat Jan  8 13:59:22 2005
    From: lattner at cs.uiuc.edu (Chris Lattner)
    Date: Sat, 8 Jan 2005 13:59:22 -0600
    Subject: [llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp 
    Message-ID: <200501081959.j08JxMXE019862@apoc.cs.uiuc.edu>
    
    
    
    Changes in directory llvm/lib/CodeGen:
    
    AsmPrinter.cpp updated: 1.12 -> 1.13
    ---
    Log message:
    
    Silence VS warnings
    
    
    ---
    Diffs of the changes:  (+8 -7)
    
    Index: llvm/lib/CodeGen/AsmPrinter.cpp
    diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.12 llvm/lib/CodeGen/AsmPrinter.cpp:1.13
    --- llvm/lib/CodeGen/AsmPrinter.cpp:1.12	Sun Nov 28 11:56:47 2004
    +++ llvm/lib/CodeGen/AsmPrinter.cpp	Sat Jan  8 13:59:10 2005
    @@ -41,7 +41,7 @@
     
     /// emitZeros - Emit a block of zeros.
     ///
    -void AsmPrinter::emitZeros(unsigned NumZeros) const {
    +void AsmPrinter::emitZeros(uint64_t NumZeros) const {
       if (NumZeros) {
         if (ZeroDirective)
           O << ZeroDirective << NumZeros << "\n";
    @@ -78,7 +78,7 @@
           // generate a symbolic expression for the byte address
           const Constant *ptrVal = CE->getOperand(0);
           std::vector idxVec(CE->op_begin()+1, CE->op_end());
    -      if (unsigned Offset = TD.getIndexedOffset(ptrVal->getType(), idxVec)) {
    +      if (uint64_t Offset = TD.getIndexedOffset(ptrVal->getType(), idxVec)) {
             O << "(";
             emitConstantValueOnly(ptrVal);
             O << ") + " << Offset;
    @@ -139,7 +139,8 @@
     
       O << "\"";
       for (unsigned i = 0; i != CVA->getNumOperands(); ++i) {
    -    unsigned char C = cast(CVA->getOperand(i))->getRawValue();
    +    unsigned char C = 
    +        (unsigned char)cast(CVA->getOperand(i))->getRawValue();
     
         if (C == '"') {
           O << "\\\"";
    @@ -187,13 +188,13 @@
       } else if (const ConstantStruct *CVS = dyn_cast(CV)) {
         // Print the fields in successive locations. Pad to align if needed!
         const StructLayout *cvsLayout = TD.getStructLayout(CVS->getType());
    -    unsigned sizeSoFar = 0;
    +    uint64_t sizeSoFar = 0;
         for (unsigned i = 0, e = CVS->getNumOperands(); i != e; ++i) {
           const Constant* field = CVS->getOperand(i);
     
           // Check if padding is needed and insert one or more 0s.
    -      unsigned fieldSize = TD.getTypeSize(field->getType());
    -      unsigned padSize = ((i == e-1? cvsLayout->StructSize
    +      uint64_t fieldSize = TD.getTypeSize(field->getType());
    +      uint64_t padSize = ((i == e-1? cvsLayout->StructSize
                                : cvsLayout->MemberOffsets[i+1])
                               - cvsLayout->MemberOffsets[i]) - fieldSize;
           sizeSoFar += fieldSize + padSize;
    @@ -242,7 +243,7 @@
             float FVal;
             int32_t UVal;
           } U;
    -      U.FVal = Val;
    +      U.FVal = (float)Val;
           
           O << Data32bitsDirective << U.UVal << "\t" << CommentString
             << " float " << Val << "\n";
    
    
    
    
    
    From lattner at cs.uiuc.edu  Sat Jan  8 14:04:11 2005
    From: lattner at cs.uiuc.edu (Chris Lattner)
    Date: Sat, 8 Jan 2005 14:04:11 -0600
    Subject: [llvm-commits] CVS: llvm/lib/AsmParser/Lexer.l 
    Message-ID: <200501082004.j08K4BmA019994@apoc.cs.uiuc.edu>
    
    
    
    Changes in directory llvm/lib/AsmParser:
    
    Lexer.l updated: 1.57 -> 1.58
    ---
    Log message:
    
    Silence VS warnings.
    
    
    ---
    Diffs of the changes:  (+9 -3)
    
    Index: llvm/lib/AsmParser/Lexer.l
    diff -u llvm/lib/AsmParser/Lexer.l:1.57 llvm/lib/AsmParser/Lexer.l:1.58
    --- llvm/lib/AsmParser/Lexer.l:1.57	Thu Dec  9 23:40:19 2004
    +++ llvm/lib/AsmParser/Lexer.l	Sat Jan  8 14:03:59 2005
    @@ -107,7 +107,7 @@
       for (char *BIn = Buffer; *BIn; ) {
         if (BIn[0] == '\\' && isxdigit(BIn[1]) && isxdigit(BIn[2])) {
           char Tmp = BIn[3]; BIn[3] = 0;     // Terminate string
    -      *BOut = strtol(BIn+1, 0, 16);  // Convert to number
    +      *BOut = (char)strtol(BIn+1, 0, 16);  // Convert to number
           if (!AllowNull && !*BOut)
             ThrowException("String literal cannot accept \\00 escape!");
           
    @@ -302,13 +302,19 @@
                        return yytext[0] == 's' ? ESINT64VAL : EUINT64VAL;
                      }
     
    -{EPInteger}     { llvmAsmlval.UIntVal = atoull(yytext+1); return UINTVAL; }
    +{EPInteger}     {
    +                  uint64_t Val = atoull(yytext+1);
    +                  if ((unsigned)Val != Val)
    +                    ThrowException("Invalid value number (too large)!");
    +                  llvmAsmlval.UIntVal = unsigned(Val);
    +                  return UINTVAL;
    +                }
     {ENInteger}     {
                       uint64_t Val = atoull(yytext+2);
     		  // +1:  we have bigger negative range
     		  if (Val > (uint64_t)INT32_MAX+1)
     		    ThrowException("Constant too large for signed 32 bits!");
    -                  llvmAsmlval.SIntVal = -Val;
    +                  llvmAsmlval.SIntVal = (int)-Val;
     		  return SINTVAL;
                     }
     
    
    
    
    
    
    From lattner at cs.uiuc.edu  Sat Jan  8 14:05:47 2005
    From: lattner at cs.uiuc.edu (Chris Lattner)
    Date: Sat, 8 Jan 2005 14:05:47 -0600
    Subject: [llvm-commits] 
    	CVS: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
    Message-ID: <200501082005.j08K5lBC020095@apoc.cs.uiuc.edu>
    
    
    
    Changes in directory llvm/lib/ExecutionEngine/Interpreter:
    
    Execution.cpp updated: 1.134 -> 1.135
    ---
    Log message:
    
    Silence VS warnings
    
    
    ---
    Diffs of the changes:  (+4 -4)
    
    Index: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
    diff -u llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.134 llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.135
    --- llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.134	Sat Oct 16 13:20:00 2004
    +++ llvm/lib/ExecutionEngine/Interpreter/Execution.cpp	Sat Jan  8 14:05:34 2005
    @@ -703,7 +703,7 @@
       unsigned NumElements = getOperandValue(I.getOperand(0), SF).UIntVal;
     
       // Allocate enough memory to hold the type...
    -  void *Memory = malloc(NumElements * TD.getTypeSize(Ty));
    +  void *Memory = malloc(NumElements * (size_t)TD.getTypeSize(Ty));
     
       GenericValue Result = PTOGV(Memory);
       assert(Result.PointerVal != 0 && "Null pointer returned by malloc!");
    @@ -736,9 +736,9 @@
           const StructLayout *SLO = TD.getStructLayout(STy);
           
           const ConstantUInt *CPU = cast(I.getOperand());
    -      unsigned Index = CPU->getValue();
    +      unsigned Index = unsigned(CPU->getValue());
           
    -      Total += SLO->MemberOffsets[Index];
    +      Total += (PointerTy)SLO->MemberOffsets[Index];
         } else {
           const SequentialType *ST = cast(*I);
           // Get the index number for the array... which must be long type...
    @@ -756,7 +756,7 @@
           case Type::UIntTyID:   Idx = IdxGV.UIntVal; break;
           case Type::ULongTyID:  Idx = IdxGV.ULongVal; break;
           }
    -      Total += TD.getTypeSize(ST->getElementType())*Idx;
    +      Total += PointerTy(TD.getTypeSize(ST->getElementType())*Idx);
         }
       }
     
    
    
    
    
    
    From lattner at cs.uiuc.edu  Sat Jan  8 14:07:18 2005
    From: lattner at cs.uiuc.edu (Chris Lattner)
    Date: Sat, 8 Jan 2005 14:07:18 -0600
    Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/JIT/JIT.cpp
    	JITEmitter.cpp 
    Message-ID: <200501082007.j08K7IC2020208@apoc.cs.uiuc.edu>
    
    
    
    Changes in directory llvm/lib/ExecutionEngine/JIT:
    
    JIT.cpp updated: 1.52 -> 1.53
    JITEmitter.cpp updated: 1.60 -> 1.61
    ---
    Log message:
    
    Silence VS warnings.
    
    
    ---
    Diffs of the changes:  (+3 -2)
    
    Index: llvm/lib/ExecutionEngine/JIT/JIT.cpp
    diff -u llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.52 llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.53
    --- llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.52	Sun Dec  5 01:19:16 2004
    +++ llvm/lib/ExecutionEngine/JIT/JIT.cpp	Sat Jan  8 14:07:03 2005
    @@ -284,7 +284,8 @@
         // If the global hasn't been emitted to memory yet, allocate space.  We will
         // actually initialize the global after current function has finished
         // compilation.
    -    Ptr =new char[getTargetData().getTypeSize(GV->getType()->getElementType())];
    +    uint64_t S = getTargetData().getTypeSize(GV->getType()->getElementType());
    +    Ptr = new char[(size_t)S];
         PendingGlobals.push_back(GV);
       }
       addGlobalMapping(GV, Ptr);
    
    
    Index: llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp
    diff -u llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.60 llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.61
    --- llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.60	Mon Dec 13 10:04:04 2004
    +++ llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp	Sat Jan  8 14:07:03 2005
    @@ -360,7 +360,7 @@
       unsigned TotalSize = 0;
       for (unsigned i = 0, e = Constants.size(); i != e; ++i) {
         const Type *Ty = Constants[i]->getType();
    -    unsigned Size      = TheJIT->getTargetData().getTypeSize(Ty);
    +    unsigned Size      = (unsigned)TheJIT->getTargetData().getTypeSize(Ty);
         unsigned Alignment = TheJIT->getTargetData().getTypeAlignment(Ty);
         // Make sure to take into account the alignment requirements of the type.
         TotalSize = (TotalSize + Alignment-1) & ~(Alignment-1);
    
    
    
    
    
    From lattner at cs.uiuc.edu  Sat Jan  8 14:13:32 2005
    From: lattner at cs.uiuc.edu (Chris Lattner)
    Date: Sat, 8 Jan 2005 14:13:32 -0600
    Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp 
    Message-ID: <200501082013.j08KDWKM020426@apoc.cs.uiuc.edu>
    
    
    
    Changes in directory llvm/lib/ExecutionEngine:
    
    ExecutionEngine.cpp updated: 1.63 -> 1.64
    ---
    Log message:
    
    Silence VS warnings.
    
    
    ---
    Diffs of the changes:  (+37 -37)
    
    Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
    diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.63 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.64
    --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.63	Mon Nov 29 08:11:29 2004
    +++ llvm/lib/ExecutionEngine/ExecutionEngine.cpp	Sat Jan  8 14:13:19 2005
    @@ -262,19 +262,19 @@
       }
       
       switch (C->getType()->getTypeID()) {
    -#define GET_CONST_VAL(TY, CLASS) \
    -  case Type::TY##TyID: Result.TY##Val = cast(C)->getValue(); break
    -    GET_CONST_VAL(Bool   , ConstantBool);
    -    GET_CONST_VAL(UByte  , ConstantUInt);
    -    GET_CONST_VAL(SByte  , ConstantSInt);
    -    GET_CONST_VAL(UShort , ConstantUInt);
    -    GET_CONST_VAL(Short  , ConstantSInt);
    -    GET_CONST_VAL(UInt   , ConstantUInt);
    -    GET_CONST_VAL(Int    , ConstantSInt);
    -    GET_CONST_VAL(ULong  , ConstantUInt);
    -    GET_CONST_VAL(Long   , ConstantSInt);
    -    GET_CONST_VAL(Float  , ConstantFP);
    -    GET_CONST_VAL(Double , ConstantFP);
    +#define GET_CONST_VAL(TY, CTY, CLASS) \
    +  case Type::TY##TyID: Result.TY##Val = (CTY)cast(C)->getValue(); break
    +    GET_CONST_VAL(Bool   , bool          , ConstantBool);
    +    GET_CONST_VAL(UByte  , unsigned char , ConstantUInt);
    +    GET_CONST_VAL(SByte  , signed char   , ConstantSInt);
    +    GET_CONST_VAL(UShort , unsigned short, ConstantUInt);
    +    GET_CONST_VAL(Short  , signed short  , ConstantSInt);
    +    GET_CONST_VAL(UInt   , unsigned int  , ConstantUInt);
    +    GET_CONST_VAL(Int    , signed int    , ConstantSInt);
    +    GET_CONST_VAL(ULong  , unsigned long , ConstantUInt);
    +    GET_CONST_VAL(Long   , signed long   , ConstantSInt);
    +    GET_CONST_VAL(Float  , float         , ConstantFP);
    +    GET_CONST_VAL(Double , double        , ConstantFP);
     #undef GET_CONST_VAL
       case Type::PointerTyID:
         if (isa(C))
    @@ -318,15 +318,16 @@
                                   goto Store4BytesLittleEndian;
         case Type::DoubleTyID:
         case Type::ULongTyID:
    -    case Type::LongTyID:    Ptr->Untyped[0] =  Val.ULongVal        & 255;
    -                            Ptr->Untyped[1] = (Val.ULongVal >>  8) & 255;
    -                            Ptr->Untyped[2] = (Val.ULongVal >> 16) & 255;
    -                            Ptr->Untyped[3] = (Val.ULongVal >> 24) & 255;
    -                            Ptr->Untyped[4] = (Val.ULongVal >> 32) & 255;
    -                            Ptr->Untyped[5] = (Val.ULongVal >> 40) & 255;
    -                            Ptr->Untyped[6] = (Val.ULongVal >> 48) & 255;
    -                            Ptr->Untyped[7] = (Val.ULongVal >> 56) & 255;
    -                            break;
    +    case Type::LongTyID:
    +      Ptr->Untyped[0] = (unsigned char)(Val.ULongVal      );
    +      Ptr->Untyped[1] = (unsigned char)(Val.ULongVal >>  8);
    +      Ptr->Untyped[2] = (unsigned char)(Val.ULongVal >> 16);
    +      Ptr->Untyped[3] = (unsigned char)(Val.ULongVal >> 24);
    +      Ptr->Untyped[4] = (unsigned char)(Val.ULongVal >> 32);
    +      Ptr->Untyped[5] = (unsigned char)(Val.ULongVal >> 40);
    +      Ptr->Untyped[6] = (unsigned char)(Val.ULongVal >> 48);
    +      Ptr->Untyped[7] = (unsigned char)(Val.ULongVal >> 56);
    +      break;
         default:
           std::cout << "Cannot store value of type " << *Ty << "!\n";
         }
    @@ -351,15 +352,16 @@
                                   goto Store4BytesBigEndian;
         case Type::DoubleTyID:
         case Type::ULongTyID:
    -    case Type::LongTyID:    Ptr->Untyped[7] =  Val.ULongVal        & 255;
    -                            Ptr->Untyped[6] = (Val.ULongVal >>  8) & 255;
    -                            Ptr->Untyped[5] = (Val.ULongVal >> 16) & 255;
    -                            Ptr->Untyped[4] = (Val.ULongVal >> 24) & 255;
    -                            Ptr->Untyped[3] = (Val.ULongVal >> 32) & 255;
    -                            Ptr->Untyped[2] = (Val.ULongVal >> 40) & 255;
    -                            Ptr->Untyped[1] = (Val.ULongVal >> 48) & 255;
    -                            Ptr->Untyped[0] = (Val.ULongVal >> 56) & 255;
    -                            break;
    +    case Type::LongTyID:
    +      Ptr->Untyped[7] = (unsigned char)(Val.ULongVal      ); 
    +      Ptr->Untyped[6] = (unsigned char)(Val.ULongVal >>  8);
    +      Ptr->Untyped[5] = (unsigned char)(Val.ULongVal >> 16);
    +      Ptr->Untyped[4] = (unsigned char)(Val.ULongVal >> 24);
    +      Ptr->Untyped[3] = (unsigned char)(Val.ULongVal >> 32);
    +      Ptr->Untyped[2] = (unsigned char)(Val.ULongVal >> 40);
    +      Ptr->Untyped[1] = (unsigned char)(Val.ULongVal >> 48);
    +      Ptr->Untyped[0] = (unsigned char)(Val.ULongVal >> 56);
    +      break;
         default:
           std::cout << "Cannot store value of type " << *Ty << "!\n";
         }
    @@ -449,16 +451,14 @@
     void ExecutionEngine::InitializeMemory(const Constant *Init, void *Addr) {
       if (isa(Init)) {
         // FIXME: THIS SHOULD NOT BE NEEDED.
    -    unsigned Size = getTargetData().getTypeSize(Init->getType());
    -    memset(Addr, 0, Size);
    +    memset(Addr, 0, (size_t)getTargetData().getTypeSize(Init->getType()));
         return;
       } else if (Init->getType()->isFirstClassType()) {
         GenericValue Val = getConstantValue(Init);
         StoreValueToMemory(Val, (GenericValue*)Addr, Init->getType());
         return;
       } else if (isa(Init)) {
    -    unsigned Size = getTargetData().getTypeSize(Init->getType());
    -    memset(Addr, 0, Size);
    +    memset(Addr, 0, (size_t)getTargetData().getTypeSize(Init->getType()));
         return;
       }
     
    @@ -534,7 +534,7 @@
       DEBUG(std::cerr << "Global '" << GV->getName() << "' -> " << GA << "\n");
     
       const Type *ElTy = GV->getType()->getElementType();
    -  unsigned GVSize = getTargetData().getTypeSize(ElTy);
    +  size_t GVSize = (size_t)getTargetData().getTypeSize(ElTy);
       if (GA == 0) {
         // If it's not already specified, allocate memory for the global.
         GA = new char[GVSize];
    @@ -542,6 +542,6 @@
       }
     
       InitializeMemory(GV->getInitializer(), GA);
    -  NumInitBytes += GVSize;
    +  NumInitBytes += (unsigned)GVSize;
       ++NumGlobals;
     }
    
    
    
    
    
    From lattner at cs.uiuc.edu  Sat Jan  8 14:13:57 2005
    From: lattner at cs.uiuc.edu (Chris Lattner)
    Date: Sat, 8 Jan 2005 14:13:57 -0600
    Subject: [llvm-commits] 
    	CVS: llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
    Message-ID: <200501082013.j08KDv6r020438@apoc.cs.uiuc.edu>
    
    
    
    Changes in directory llvm/lib/ExecutionEngine/Interpreter:
    
    ExternalFunctions.cpp updated: 1.80 -> 1.81
    ---
    Log message:
    
    Silence warnings
    
    
    ---
    Diffs of the changes:  (+2 -2)
    
    Index: llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
    diff -u llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp:1.80 llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp:1.81
    --- llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp:1.80	Mon Nov 29 08:11:29 2004
    +++ llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp	Sat Jan  8 14:13:44 2005
    @@ -505,10 +505,10 @@
     static size_t GV_to_size_t (GenericValue GV) { 
       size_t count;
       if (sizeof (size_t) == sizeof (uint64_t)) {
    -    count = GV.ULongVal;
    +    count = (size_t)GV.ULongVal;
       } else {
         assert (sizeof (size_t) == sizeof (unsigned int));
    -    count = GV.UIntVal;
    +    count = (size_t)GV.UIntVal;
       }
       return count;
     }
    
    
    
    
    
    From jeffc at jolt-lang.org  Sat Jan  8 14:16:08 2005
    From: jeffc at jolt-lang.org (Jeff Cohen)
    Date: Sat, 8 Jan 2005 14:16:08 -0600
    Subject: [llvm-commits] CVS: llvm/lib/System/Unix/Process.cpp 
    Message-ID: <200501082016.OAA15858@zion.cs.uiuc.edu>
    
    
    
    Changes in directory llvm/lib/System/Unix:
    
    Process.cpp updated: 1.8 -> 1.9
    ---
    Log message:
    
    Use size_t instead of long to represent memory usage.  long is 32 bits
    on 64-bit Windows.
    
    ---
    Diffs of the changes:  (+2 -2)
    
    Index: llvm/lib/System/Unix/Process.cpp
    diff -u llvm/lib/System/Unix/Process.cpp:1.8 llvm/lib/System/Unix/Process.cpp:1.9
    --- llvm/lib/System/Unix/Process.cpp:1.8	Sat Jan  1 16:29:26 2005
    +++ llvm/lib/System/Unix/Process.cpp	Sat Jan  8 14:15:57 2005
    @@ -47,7 +47,7 @@
     static char* som = reinterpret_cast(::sbrk(0));
     #endif
     
    -uint64_t 
    +size_t 
     Process::GetMallocUsage()
     {
     #if defined(HAVE_MALLINFO)
    @@ -68,7 +68,7 @@
     #endif
     }
     
    -uint64_t
    +size_t
     Process::GetTotalMemoryUsage()
     {
     #if defined(HAVE_MALLINFO)
    
    
    
    
    
    From jeffc at jolt-lang.org  Sat Jan  8 14:16:09 2005
    From: jeffc at jolt-lang.org (Jeff Cohen)
    Date: Sat, 8 Jan 2005 14:16:09 -0600
    Subject: [llvm-commits] CVS: llvm/include/llvm/System/Process.h 
    Message-ID: <200501082016.OAA15862@zion.cs.uiuc.edu>
    
    
    
    Changes in directory llvm/include/llvm/System:
    
    Process.h updated: 1.4 -> 1.5
    ---
    Log message:
    
    Use size_t instead of long to represent memory usage.  long is 32 bits
    on 64-bit Windows.
    
    ---
    Diffs of the changes:  (+2 -2)
    
    Index: llvm/include/llvm/System/Process.h
    diff -u llvm/include/llvm/System/Process.h:1.4 llvm/include/llvm/System/Process.h:1.5
    --- llvm/include/llvm/System/Process.h:1.4	Sat Jan  1 16:29:26 2005
    +++ llvm/include/llvm/System/Process.h	Sat Jan  8 14:15:57 2005
    @@ -40,14 +40,14 @@
           /// allocated space. 
           /// @throws nothing
           /// @brief Return process memory usage.
    -      static uint64_t GetMallocUsage();
    +      static size_t GetMallocUsage();
     
           /// This static function will return the total memory usage of the 
           /// process. This includes code, data, stack and mapped pages usage. Notei
           /// that the value returned here is not necessarily the Running Set Size,
           /// it is the total virtual memory usage, regardless of mapped state of
           /// that memory.
    -      static uint64_t GetTotalMemoryUsage();
    +      static size_t GetTotalMemoryUsage();
     
           /// This static function will set \p user_time to the amount of CPU time 
           /// spent in user (non-kernel) mode and \p sys_time to the amount of CPU
    
    
    
    
    
    From jeffc at jolt-lang.org  Sat Jan  8 14:16:09 2005
    From: jeffc at jolt-lang.org (Jeff Cohen)
    Date: Sat, 8 Jan 2005 14:16:09 -0600
    Subject: [llvm-commits] CVS: llvm/include/llvm/Support/Timer.h 
    Message-ID: <200501082016.OAA15861@zion.cs.uiuc.edu>
    
    
    
    Changes in directory llvm/include/llvm/Support:
    
    Timer.h updated: 1.13 -> 1.14
    ---
    Log message:
    
    Use size_t instead of long to represent memory usage.  long is 32 bits
    on 64-bit Windows.
    
    ---
    Diffs of the changes:  (+5 -5)
    
    Index: llvm/include/llvm/Support/Timer.h
    diff -u llvm/include/llvm/Support/Timer.h:1.13 llvm/include/llvm/Support/Timer.h:1.14
    --- llvm/include/llvm/Support/Timer.h:1.13	Wed Sep  1 17:55:35 2004
    +++ llvm/include/llvm/Support/Timer.h	Sat Jan  8 14:15:57 2005
    @@ -36,9 +36,9 @@
       double Elapsed;        // Wall clock time elapsed in seconds
       double UserTime;       // User time elapsed
       double SystemTime;     // System time elapsed
    -  long   MemUsed;        // Memory allocated (in bytes)
    -  long   PeakMem;        // Peak memory used
    -  long   PeakMemBase;    // Temporary for peak calculation...
    +  size_t MemUsed;        // Memory allocated (in bytes)
    +  size_t PeakMem;        // Peak memory used
    +  size_t PeakMemBase;    // Temporary for peak calculation...
       std::string Name;      // The name of this time variable
       bool Started;          // Has this time variable ever been started?
       TimerGroup *TG;        // The TimerGroup this Timer is in.
    @@ -50,8 +50,8 @@
     
       double getProcessTime() const { return UserTime+SystemTime; }
       double getWallTime() const { return Elapsed; }
    -  long getMemUsed() const { return MemUsed; }
    -  long getPeakMem() const { return PeakMem; }
    +  size_t getMemUsed() const { return MemUsed; }
    +  size_t getPeakMem() const { return PeakMem; }
       std::string getName() const { return Name; }
     
       const Timer &operator=(const Timer &T) {
    
    
    
    
    
    From jeffc at jolt-lang.org  Sat Jan  8 14:16:09 2005
    From: jeffc at jolt-lang.org (Jeff Cohen)
    Date: Sat, 8 Jan 2005 14:16:09 -0600
    Subject: [llvm-commits] CVS: llvm/lib/Support/Timer.cpp 
    Message-ID: <200501082016.OAA15870@zion.cs.uiuc.edu>
    
    
    
    Changes in directory llvm/lib/Support:
    
    Timer.cpp updated: 1.40 -> 1.41
    ---
    Log message:
    
    Use size_t instead of long to represent memory usage.  long is 32 bits
    on 64-bit Windows.
    
    ---
    Diffs of the changes:  (+5 -5)
    
    Index: llvm/lib/Support/Timer.cpp
    diff -u llvm/lib/Support/Timer.cpp:1.40 llvm/lib/Support/Timer.cpp:1.41
    --- llvm/lib/Support/Timer.cpp:1.40	Sat Jan  8 13:31:31 2005
    +++ llvm/lib/Support/Timer.cpp	Sat Jan  8 14:15:57 2005
    @@ -93,15 +93,15 @@
       }
     }
     
    -static inline long getMemUsage() {
    +static inline size_t getMemUsage() {
       if (TrackSpace)
    -    return (long)sys::Process::GetMallocUsage();
    +    return sys::Process::GetMallocUsage();
       return 0;
     }
     
     struct TimeRecord {
       double Elapsed, UserTime, SystemTime;
    -  long MemUsed;
    +  size_t MemUsed;
     };
     
     static TimeRecord getTimeRecord(bool Start) {
    @@ -111,7 +111,7 @@
       sys::TimeValue user(0,0);
       sys::TimeValue sys(0,0);
     
    -  long MemUsed = 0;
    +  size_t MemUsed = 0;
       if (Start) {
         sys::Process::GetTimeUsage(now,user,sys);
         MemUsed = getMemUsage();
    @@ -171,7 +171,7 @@
     /// currently active timers, which will be printed when the timer group prints
     ///
     void Timer::addPeakMemoryMeasurement() {
    -  long MemUsed = getMemUsage();
    +  size_t MemUsed = getMemUsage();
     
       for (std::vector::iterator I = ActiveTimers.begin(),
              E = ActiveTimers.end(); I != E; ++I)
    
    
    
    
    
    From jeffc at jolt-lang.org  Sat Jan  8 14:16:09 2005
    From: jeffc at jolt-lang.org (Jeff Cohen)
    Date: Sat, 8 Jan 2005 14:16:09 -0600
    Subject: [llvm-commits] CVS: llvm/lib/System/Win32/Process.cpp 
    Message-ID: <200501082016.OAA15867@zion.cs.uiuc.edu>
    
    
    
    Changes in directory llvm/lib/System/Win32:
    
    Process.cpp updated: 1.7 -> 1.8
    ---
    Log message:
    
    Use size_t instead of long to represent memory usage.  long is 32 bits
    on 64-bit Windows.
    
    ---
    Diffs of the changes:  (+2 -2)
    
    Index: llvm/lib/System/Win32/Process.cpp
    diff -u llvm/lib/System/Win32/Process.cpp:1.7 llvm/lib/System/Win32/Process.cpp:1.8
    --- llvm/lib/System/Win32/Process.cpp:1.7	Sat Jan  1 16:54:05 2005
    +++ llvm/lib/System/Win32/Process.cpp	Sat Jan  8 14:15:57 2005
    @@ -51,7 +51,7 @@
       return PageSize;
     }
     
    -uint64_t 
    +size_t 
     Process::GetMallocUsage()
     {
       _HEAPINFO hinfo;
    @@ -65,7 +65,7 @@
       return size;
     }
     
    -uint64_t
    +size_t
     Process::GetTotalMemoryUsage()
     {
       PROCESS_MEMORY_COUNTERS pmc;
    
    
    
    
    
    From lattner at cs.uiuc.edu  Sat Jan  8 14:19:41 2005
    From: lattner at cs.uiuc.edu (Chris Lattner)
    Date: Sat, 8 Jan 2005 14:19:41 -0600
    Subject: [llvm-commits] CVS: llvm/include/llvm/DerivedTypes.h 
    Message-ID: <200501082019.j08KJfhW021607@apoc.cs.uiuc.edu>
    
    
    
    Changes in directory llvm/include/llvm:
    
    DerivedTypes.h updated: 1.64 -> 1.65
    ---
    Log message:
    
    Allow array types to have 64-bit size.
    
    
    ---
    Diffs of the changes:  (+4 -4)
    
    Index: llvm/include/llvm/DerivedTypes.h
    diff -u llvm/include/llvm/DerivedTypes.h:1.64 llvm/include/llvm/DerivedTypes.h:1.65
    --- llvm/include/llvm/DerivedTypes.h:1.64	Mon Nov 15 13:02:35 2004
    +++ llvm/include/llvm/DerivedTypes.h	Sat Jan  8 14:19:27 2005
    @@ -273,7 +273,7 @@
     ///
     class ArrayType : public SequentialType {
       friend class TypeMap;
    -  unsigned NumElements;
    +  uint64_t NumElements;
     
       ArrayType(const ArrayType &);                   // Do not implement
       const ArrayType &operator=(const ArrayType &);  // Do not implement
    @@ -284,15 +284,15 @@
       ///
       /// Private ctor - Only can be created by a static member...
       ///
    -  ArrayType(const Type *ElType, unsigned NumEl);
    +  ArrayType(const Type *ElType, uint64_t NumEl);
     
     public:
       /// ArrayType::get - This static method is the primary way to construct an
       /// ArrayType
       ///
    -  static ArrayType *get(const Type *ElementType, unsigned NumElements);
    +  static ArrayType *get(const Type *ElementType, uint64_t NumElements);
     
    -  inline unsigned    getNumElements() const { return NumElements; }
    +  inline uint64_t getNumElements() const { return NumElements; }
     
       // Implement the AbstractTypeUser interface.
       virtual void refineAbstractType(const DerivedType *OldTy, const Type *NewTy);
    
    
    
    
    
    From lattner at cs.uiuc.edu  Sat Jan  8 14:20:05 2005
    From: lattner at cs.uiuc.edu (Chris Lattner)
    Date: Sat, 8 Jan 2005 14:20:05 -0600
    Subject: [llvm-commits] CVS: llvm/lib/VMCore/Type.cpp 
    Message-ID: <200501082020.j08KK5PF021784@apoc.cs.uiuc.edu>
    
    
    
    Changes in directory llvm/lib/VMCore:
    
    Type.cpp updated: 1.120 -> 1.121
    ---
    Log message:
    
    Allow arrays to have more than 4G elements.
    
    
    ---
    Diffs of the changes:  (+5 -5)
    
    Index: llvm/lib/VMCore/Type.cpp
    diff -u llvm/lib/VMCore/Type.cpp:1.120 llvm/lib/VMCore/Type.cpp:1.121
    --- llvm/lib/VMCore/Type.cpp:1.120	Wed Dec  1 11:12:16 2004
    +++ llvm/lib/VMCore/Type.cpp	Sat Jan  8 14:19:51 2005
    @@ -401,7 +401,7 @@
       setAbstract(isAbstract);
     }
     
    -ArrayType::ArrayType(const Type *ElType, unsigned NumEl)
    +ArrayType::ArrayType(const Type *ElType, uint64_t NumEl)
       : SequentialType(ArrayTyID, ElType) {
       NumElements = NumEl;
     
    @@ -894,16 +894,16 @@
     namespace llvm {
     class ArrayValType {
       const Type *ValTy;
    -  unsigned Size;
    +  uint64_t Size;
     public:
    -  ArrayValType(const Type *val, int sz) : ValTy(val), Size(sz) {}
    +  ArrayValType(const Type *val, uint64_t sz) : ValTy(val), Size(sz) {}
     
       static ArrayValType get(const ArrayType *AT) {
         return ArrayValType(AT->getElementType(), AT->getNumElements());
       }
     
       static unsigned hashTypeStructure(const ArrayType *AT) {
    -    return AT->getNumElements();
    +    return (unsigned)AT->getNumElements();
       }
     
       // Subclass should override this... to update self as usual
    @@ -921,7 +921,7 @@
     static TypeMap ArrayTypes;
     
     
    -ArrayType *ArrayType::get(const Type *ElementType, unsigned NumElements) {
    +ArrayType *ArrayType::get(const Type *ElementType, uint64_t NumElements) {
       assert(ElementType && "Can't get array of null types!");
     
       ArrayValType AVT(ElementType, NumElements);
    
    
    
    
    
    From lattner at cs.uiuc.edu  Sat Jan  8 14:31:49 2005
    From: lattner at cs.uiuc.edu (Chris Lattner)
    Date: Sat, 8 Jan 2005 14:31:49 -0600
    Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelPattern.cpp 
    Message-ID: <200501082031.j08KVnne029816@apoc.cs.uiuc.edu>
    
    
    
    Changes in directory llvm/lib/Target/X86:
    
    X86ISelPattern.cpp updated: 1.13 -> 1.14
    ---
    Log message:
    
    Fix off by one error
    
    
    ---
    Diffs of the changes:  (+1 -1)
    
    Index: llvm/lib/Target/X86/X86ISelPattern.cpp
    diff -u llvm/lib/Target/X86/X86ISelPattern.cpp:1.13 llvm/lib/Target/X86/X86ISelPattern.cpp:1.14
    --- llvm/lib/Target/X86/X86ISelPattern.cpp:1.13	Sat Jan  8 13:28:19 2005
    +++ llvm/lib/Target/X86/X86ISelPattern.cpp	Sat Jan  8 14:31:34 2005
    @@ -208,7 +208,7 @@
       RetVals.push_back(MVT::Other);
     
       SDOperand TheCall = SDOperand(DAG.getCall(RetVals, Chain, Callee), 0);
    -  Chain = TheCall.getValue(RetVals.size()-1);
    +  Chain = TheCall.getValue(RetVals.size());
       Chain = DAG.getNode(ISD::ADJCALLSTACKUP, MVT::Other, Chain,
                           DAG.getConstant(NumBytes, getPointerTy()));
       return std::make_pair(TheCall, Chain);
    
    
    
    
    
    From lattner at cs.uiuc.edu  Sat Jan  8 14:35:28 2005
    From: lattner at cs.uiuc.edu (Chris Lattner)
    Date: Sat, 8 Jan 2005 14:35:28 -0600
    Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp 
    Message-ID: <200501082035.j08KZSMJ030123@apoc.cs.uiuc.edu>
    
    
    
    Changes in directory llvm/lib/CodeGen/SelectionDAG:
    
    LegalizeDAG.cpp updated: 1.14 -> 1.15
    ---
    Log message:
    
    Tighten up assertions.
    
    
    ---
    Diffs of the changes:  (+6 -8)
    
    Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
    diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.14 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.15
    --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.14	Sat Jan  8 13:52:31 2005
    +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp	Sat Jan  8 14:35:13 2005
    @@ -199,12 +199,12 @@
     }
     
     SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
    +  assert(getTypeAction(Op.getValueType()) == Legal &&
    +         "Caller should expand or promote operands that are not legal!");
    +
       // If this operation defines any values that cannot be represented in a
    -  // register on this target, make sure to expand it.
    -  if (Op.Val->getNumValues() == 1) {// Fast path == assertion only
    -    assert(getTypeAction(Op.Val->getValueType(0)) == Legal &&
    -           "For a single use value, caller should check for legality!");
    -  } else {
    +  // register on this target, make sure to expand or promote them.
    +  if (Op.Val->getNumValues() > 1) {
         for (unsigned i = 0, e = Op.Val->getNumValues(); i != e; ++i)
           switch (getTypeAction(Op.Val->getValueType(i))) {
           case Legal: break;  // Nothing to do.
    @@ -719,9 +719,7 @@
         Hi = SDOperand(NC, 1);
     
         // Insert the new chain mapping.
    -    bool isNew = LegalizedNodes.insert(std::make_pair(Op.getValue(1),
    -                                                      Hi.getValue(2))).second;
    -    assert(isNew && "This node was already legalized!");
    +    AddLegalizedOperand(Op.getValue(1), Hi.getValue(2));
         break;
       }
       case ISD::AND:
    
    
    
    
    
    From lattner at cs.uiuc.edu  Sat Jan  8 14:39:52 2005
    From: lattner at cs.uiuc.edu (Chris Lattner)
    Date: Sat, 8 Jan 2005 14:39:52 -0600
    Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelPattern.cpp 
    Message-ID: <200501082039.j08KdqUe030683@apoc.cs.uiuc.edu>
    
    
    
    Changes in directory llvm/lib/Target/X86:
    
    X86ISelPattern.cpp updated: 1.14 -> 1.15
    ---
    Log message:
    
    Okay, my off by one was actually off by two.  This fixes Generic/2003-07-07-BadLongConst.ll
    
    
    ---
    Diffs of the changes:  (+1 -1)
    
    Index: llvm/lib/Target/X86/X86ISelPattern.cpp
    diff -u llvm/lib/Target/X86/X86ISelPattern.cpp:1.14 llvm/lib/Target/X86/X86ISelPattern.cpp:1.15
    --- llvm/lib/Target/X86/X86ISelPattern.cpp:1.14	Sat Jan  8 14:31:34 2005
    +++ llvm/lib/Target/X86/X86ISelPattern.cpp	Sat Jan  8 14:39:31 2005
    @@ -208,7 +208,7 @@
       RetVals.push_back(MVT::Other);
     
       SDOperand TheCall = SDOperand(DAG.getCall(RetVals, Chain, Callee), 0);
    -  Chain = TheCall.getValue(RetVals.size());
    +  Chain = TheCall.getValue(RetVals.size()+1);
       Chain = DAG.getNode(ISD::ADJCALLSTACKUP, MVT::Other, Chain,
                           DAG.getConstant(NumBytes, getPointerTy()));
       return std::make_pair(TheCall, Chain);
    
    
    
    
    
    From lattner at cs.uiuc.edu  Sat Jan  8 14:51:51 2005
    From: lattner at cs.uiuc.edu (Chris Lattner)
    Date: Sat, 8 Jan 2005 14:51:51 -0600
    Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelPattern.cpp 
    Message-ID: <200501082051.j08KppQh009057@apoc.cs.uiuc.edu>
    
    
    
    Changes in directory llvm/lib/Target/X86:
    
    X86ISelPattern.cpp updated: 1.15 -> 1.16
    ---
    Log message:
    
    Okay 15th time is the charm.  Looking at the vector size is useless as it
    gets clobbered by a previous statement.  This fixes all calls finally.
    
    
    ---
    Diffs of the changes:  (+1 -1)
    
    Index: llvm/lib/Target/X86/X86ISelPattern.cpp
    diff -u llvm/lib/Target/X86/X86ISelPattern.cpp:1.15 llvm/lib/Target/X86/X86ISelPattern.cpp:1.16
    --- llvm/lib/Target/X86/X86ISelPattern.cpp:1.15	Sat Jan  8 14:39:31 2005
    +++ llvm/lib/Target/X86/X86ISelPattern.cpp	Sat Jan  8 14:51:36 2005
    @@ -208,7 +208,7 @@
       RetVals.push_back(MVT::Other);
     
       SDOperand TheCall = SDOperand(DAG.getCall(RetVals, Chain, Callee), 0);
    -  Chain = TheCall.getValue(RetVals.size()+1);
    +  Chain = TheCall.getValue(RetTyVT != MVT::isVoid);
       Chain = DAG.getNode(ISD::ADJCALLSTACKUP, MVT::Other, Chain,
                           DAG.getConstant(NumBytes, getPointerTy()));
       return std::make_pair(TheCall, Chain);
    
    
    
    
    
    From lattner at cs.uiuc.edu  Sat Jan  8 15:03:52 2005
    From: lattner at cs.uiuc.edu (Chris Lattner)
    Date: Sat, 8 Jan 2005 15:03:52 -0600
    Subject: [llvm-commits] CVS: llvm-test/Makefile.programs TEST.nightly.report
    	TEST.nightly.Makefile 
    Message-ID: <200501082103.j08L3qQh012559@apoc.cs.uiuc.edu>
    
    
    
    Changes in directory llvm-test:
    
    Makefile.programs updated: 1.143 -> 1.144
    TEST.nightly.report updated: 1.34 -> 1.35
    TEST.nightly.Makefile updated: 1.37 -> 1.38
    ---
    Log message:
    
    Rename the LLC-BETA stuff LLC-BETA instead of LINEARSCAN
    
    
    ---
    Diffs of the changes:  (+45 -45)
    
    Index: llvm-test/Makefile.programs
    diff -u llvm-test/Makefile.programs:1.143 llvm-test/Makefile.programs:1.144
    --- llvm-test/Makefile.programs:1.143	Tue Dec 14 14:37:12 2004
    +++ llvm-test/Makefile.programs	Sat Jan  8 15:03:37 2005
    @@ -98,7 +98,7 @@
     BYTECODE   := $(addsuffix .llvm.bc, $(PREFIXED_PROGRAMS_TO_TEST))
     
     LLCCODEGEN := $(addsuffix .llc.s,   $(PREFIXED_PROGRAMS_TO_TEST))
    -LLCLSCODEGEN := $(addsuffix .llc-ls.s,   $(PREFIXED_PROGRAMS_TO_TEST))
    +LLCBETACODEGEN := $(addsuffix .llc-beta.s,   $(PREFIXED_PROGRAMS_TO_TEST))
     CBECODEGEN := $(addsuffix .cbe,     $(PREFIXED_PROGRAMS_TO_TEST))
     
     # Output produced by programs run
    @@ -106,17 +106,17 @@
     NATOUTPUT := $(addsuffix .out-nat,  $(PREFIXED_PROGRAMS_TO_TEST))
     LLIOUTPUT := $(addsuffix .out-lli,  $(PREFIXED_PROGRAMS_TO_TEST))
     JITOUTPUT := $(addsuffix .out-jit,  $(PREFIXED_PROGRAMS_TO_TEST))
    -JITLSOUTPUT := $(addsuffix .out-jit-ls,  $(PREFIXED_PROGRAMS_TO_TEST))
    +JITBETAOUTPUT := $(addsuffix .out-jit-beta,  $(PREFIXED_PROGRAMS_TO_TEST))
     LLCOUTPUT := $(addsuffix .out-llc,  $(PREFIXED_PROGRAMS_TO_TEST))
    -LLCLSOUTPUT := $(addsuffix .out-llc-ls,  $(PREFIXED_PROGRAMS_TO_TEST))
    +LLCBETAOUTPUT := $(addsuffix .out-llc-beta,  $(PREFIXED_PROGRAMS_TO_TEST))
     CBEOUTPUT := $(addsuffix .out-cbe,  $(PREFIXED_PROGRAMS_TO_TEST))
     
     # Diffs of program runs vs the native program
     LLIDIFFS  := $(addsuffix .diff-lli, $(PREFIXED_PROGRAMS_TO_TEST))
     JITDIFFS  := $(addsuffix .diff-jit, $(PREFIXED_PROGRAMS_TO_TEST))
    -JITLSDIFFS  := $(addsuffix .diff-jit-ls, $(PREFIXED_PROGRAMS_TO_TEST))
    +JITBETADIFFS  := $(addsuffix .diff-jit-beta, $(PREFIXED_PROGRAMS_TO_TEST))
     LLCDIFFS  := $(addsuffix .diff-llc, $(PREFIXED_PROGRAMS_TO_TEST))
    -LLCLSDIFFS  := $(addsuffix .diff-llc-ls, $(PREFIXED_PROGRAMS_TO_TEST))
    +LLCBETADIFFS  := $(addsuffix .diff-llc-beta, $(PREFIXED_PROGRAMS_TO_TEST))
     CBEDIFFS  := $(addsuffix .diff-cbe, $(PREFIXED_PROGRAMS_TO_TEST))
     
     # Profiles for the program.
    @@ -124,12 +124,12 @@
     PRINTPROFOUTPUT := $(addsuffix .printprof, $(PREFIXED_PROGRAMS_TO_TEST))
     
     # Build Program outputs:
    -.PRECIOUS: Output/%.out-lli Output/%.out-jit Output/%.out-llc Output/%.out-llc-ls
    +.PRECIOUS: Output/%.out-lli Output/%.out-jit Output/%.out-llc Output/%.out-llc-beta
     .PRECIOUS: Output/%.out-nat Output/%.out-cbe
     
     # Build diffs from the output...
     .PRECIOUS: Output/%.diff-lli Output/%.diff-jit
    -.PRECIOUS: Output/%.diff-llc Output/%.diff-llc-ls Output/%.diff-cbe
    +.PRECIOUS: Output/%.diff-llc Output/%.diff-llc-beta Output/%.diff-cbe
     
     
     # Regardless of what other options are specified, build the program's bytecode
    @@ -163,8 +163,8 @@
     ifndef DISABLE_DIFFS
     ifndef DISABLE_LLC_DIFFS
     all:: $(LLCDIFFS)
    -ifdef ENABLE_LINEARSCAN
    -all:: $(LLCLSDIFFS)
    +ifdef ENABLE_LLCBETA
    +all:: $(LLCBETADIFFS)
     endif
     endif#DISABLE_LLC_DIFFS
     
    @@ -175,8 +175,8 @@
     ifdef TARGET_HAS_JIT
     ifndef DISABLE_JIT
     all:: $(JITDIFFS)
    -ifdef ENABLE_LINEARSCAN
    -all:: $(JITLSDIFFS)
    +ifdef ENABLE_LLCBETA
    +all:: $(JITBETADIFFS)
     endif
     endif#DISABLE_JIT
     endif#TARGET_HAS_JIT
    @@ -270,8 +270,8 @@
     Output/%.llc.s: Output/%.llvm.bc $(LLC)
     	-$(LLC) $(LLCFLAGS) -f $< -o $@
     
    -$(PROGRAMS_TO_TEST:%=Output/%.llc-ls.s): \
    -Output/%.llc-ls.s: Output/%.llvm.bc $(LLC)
    +$(PROGRAMS_TO_TEST:%=Output/%.llc-beta.s): \
    +Output/%.llc-beta.s: Output/%.llvm.bc $(LLC)
     	-$(LLC) $(LLCFLAGS) -f -regalloc=iterativescan $< -o $@
     
     
    @@ -285,8 +285,8 @@
     Output/%.llc: Output/%.llc.s
     	-$(CC) $(CFLAGS) $< $(LLCLIBS) $(LDFLAGS) -o $@
     
    -$(PROGRAMS_TO_TEST:%=Output/%.llc-ls): \
    -Output/%.llc-ls: Output/%.llc-ls.s
    +$(PROGRAMS_TO_TEST:%=Output/%.llc-beta): \
    +Output/%.llc-beta: Output/%.llc-beta.s
     	-$(CC) $(CFLAGS) $< $(LLCLIBS) $(LDFLAGS) -o $@
     
     
    @@ -331,19 +331,19 @@
     	@if test \! -f $@.exitok; then echo "TEST (jit): $* FAILED!"; rm -f $@; fi
     endif
     
    -$(PROGRAMS_TO_TEST:%=Output/%.out-jit-ls): \
    -Output/%.out-jit-ls: Output/%.llvm.bc $(LLI)
    +$(PROGRAMS_TO_TEST:%=Output/%.out-jit-beta): \
    +Output/%.out-jit-beta: Output/%.llvm.bc $(LLI)
     	-$(RUNSAFELY) $(STDIN_FILENAME) $@ $(LLI) -regalloc=iterativescan $(JIT_OPTS) $< $(RUN_OPTIONS)
     ifdef PROGRAM_REQUIRED_TO_EXIT_OK
    -	@if test \! -f $@.exitok; then echo "TEST (jit-ls): $* FAILED!"; rm -f $@; fi
    +	@if test \! -f $@.exitok; then echo "TEST (jit-beta): $* FAILED!"; rm -f $@; fi
     endif
     
     $(PROGRAMS_TO_TEST:%=Output/%.out-llc): \
     Output/%.out-llc: Output/%.llc
     	-$(RUNSAFELY) $(STDIN_FILENAME) $@ $< $(RUN_OPTIONS)
     
    -$(PROGRAMS_TO_TEST:%=Output/%.out-llc-ls): \
    -Output/%.out-llc-ls: Output/%.llc-ls
    +$(PROGRAMS_TO_TEST:%=Output/%.out-llc-beta): \
    +Output/%.out-llc-beta: Output/%.llc-beta
     	-$(RUNSAFELY) $(STDIN_FILENAME) $@ $< $(RUN_OPTIONS)
     
     $(PROGRAMS_TO_TEST:%=Output/%.out-cbe): \
    @@ -372,8 +372,8 @@
     Output/%.bugpoint-llc: Output/%.llvm.bc $(LBUGPOINT) Output/%.out-nat
     	$(LBUGPOINT) $< -run-llc $(BUGPOINT_OPTIONS) $(BUGPOINT_ARGS)
     
    -$(PROGRAMS_TO_TEST:%=Output/%.bugpoint-llc-ls): \
    -Output/%.bugpoint-llc-ls: Output/%.llvm.bc $(LBUGPOINT) Output/%.out-nat
    +$(PROGRAMS_TO_TEST:%=Output/%.bugpoint-llc-beta): \
    +Output/%.bugpoint-llc-beta: Output/%.llvm.bc $(LBUGPOINT) Output/%.out-nat
     	$(LBUGPOINT) $< -run-llc $(BUGPOINT_OPTIONS) -regalloc=iterativescan $(BUGPOINT_ARGS)
     
     $(PROGRAMS_TO_TEST:%=Output/%.bugpoint-jit): \
    @@ -422,17 +422,17 @@
     Output/%.diff-jit: Output/%.out-nat Output/%.out-jit
     	-$(DIFFPROG) jit $* $(HIDEDIFF)
     
    -$(PROGRAMS_TO_TEST:%=Output/%.diff-jit-ls): \
    -Output/%.diff-jit-ls: Output/%.out-nat Output/%.out-jit-ls
    -	-$(DIFFPROG) jit-ls $* $(HIDEDIFF)
    +$(PROGRAMS_TO_TEST:%=Output/%.diff-jit-beta): \
    +Output/%.diff-jit-beta: Output/%.out-nat Output/%.out-jit-beta
    +	-$(DIFFPROG) jit-beta $* $(HIDEDIFF)
     
     $(PROGRAMS_TO_TEST:%=Output/%.diff-llc): \
     Output/%.diff-llc: Output/%.out-nat Output/%.out-llc
     	-$(DIFFPROG) llc $* $(HIDEDIFF)
     
    -$(PROGRAMS_TO_TEST:%=Output/%.diff-llc-ls): \
    -Output/%.diff-llc-ls: Output/%.out-nat Output/%.out-llc-ls
    -	-$(DIFFPROG) llc-ls $* $(HIDEDIFF)
    +$(PROGRAMS_TO_TEST:%=Output/%.diff-llc-beta): \
    +Output/%.diff-llc-beta: Output/%.out-nat Output/%.out-llc-beta
    +	-$(DIFFPROG) llc-beta $* $(HIDEDIFF)
     
     $(PROGRAMS_TO_TEST:%=Output/%.diff-cbe): \
     Output/%.diff-cbe: Output/%.out-nat Output/%.out-cbe
    @@ -447,16 +447,16 @@
     Output/%.exe-jit: Output/%.diff-jit
     	-cp $< $@
     
    -$(PROGRAMS_TO_TEST:%=Output/%.exe-jit-ls): \
    -Output/%.exe-jit-ls: Output/%.diff-jit-ls
    +$(PROGRAMS_TO_TEST:%=Output/%.exe-jit-beta): \
    +Output/%.exe-jit-beta: Output/%.diff-jit-beta
     	-cp $< $@
     
     $(PROGRAMS_TO_TEST:%=Output/%.exe-llc): \
     Output/%.exe-llc: Output/%.diff-llc
     	-cp $< $@
     
    -$(PROGRAMS_TO_TEST:%=Output/%.exe-llc-ls): \
    -Output/%.exe-llc-ls: Output/%.diff-llc-ls
    +$(PROGRAMS_TO_TEST:%=Output/%.exe-llc-beta): \
    +Output/%.exe-llc-beta: Output/%.diff-llc-beta
     	-cp $< $@
     
     $(PROGRAMS_TO_TEST:%=Output/%.exe-cbe): \
    
    
    Index: llvm-test/TEST.nightly.report
    diff -u llvm-test/TEST.nightly.report:1.34 llvm-test/TEST.nightly.report:1.35
    --- llvm-test/TEST.nightly.report:1.34	Tue Dec 14 16:41:21 2004
    +++ llvm-test/TEST.nightly.report	Sat Jan  8 15:03:37 2005
    @@ -64,14 +64,14 @@
      ["GCCAS"    , "TEST-RESULT-compile: .*$WallTimeRE"],
      ["Bytecode" , 'TEST-RESULT-compile: *([0-9]+)'],
      ["LLC
    compile" , "TEST-RESULT-llc: .*$WallTimeRE"], - ["LLC-BETA
    compile" , "TEST-RESULT-llc-ls: .*$WallTimeRE"], + ["LLC-BETA
    compile" , "TEST-RESULT-llc-beta: .*$WallTimeRE"], ["JIT
    codegen" , "TEST-RESULT-jit-comptime: .*$WallTimeRE"], ["Machine
    code", 'TEST-RESULT-jit-machcode: *([0-9]+).*bytes of machine code'], [], ["GCC" , 'TEST-RESULT-nat-time: program\s*([.0-9m:]+)', \&FormatTime], ["CBE" , 'TEST-RESULT-cbe-time: program\s*([.0-9m:]+)', \&FormatTime], ["LLC" , 'TEST-RESULT-llc-time: program\s*([.0-9m:]+)', \&FormatTime], - ["LLC-BETA" , 'TEST-RESULT-llc-ls-time: program\s*([.0-9m:]+)', \&FormatTime], + ["LLC-BETA" , 'TEST-RESULT-llc-beta-time: program\s*([.0-9m:]+)',\&FormatTime], ["JIT" , 'TEST-RESULT-jit-time: program\s*([.0-9m:]+)', \&FormatTime], ["GCC/CBE" , \&GCCCBERatio], ["GCC/LLC" , \&GCCLLCRatio], Index: llvm-test/TEST.nightly.Makefile diff -u llvm-test/TEST.nightly.Makefile:1.37 llvm-test/TEST.nightly.Makefile:1.38 --- llvm-test/TEST.nightly.Makefile:1.37 Sat Dec 11 22:19:16 2004 +++ llvm-test/TEST.nightly.Makefile Sat Jan 8 15:03:37 2005 @@ -20,8 +20,8 @@ ifndef DISABLE_CBE REPORTS_TO_GEN += cbe endif -ifdef ENABLE_LINEARSCAN -REPORTS_TO_GEN += llc-ls +ifdef ENABLE_LLCBETA +REPORTS_TO_GEN += llc-beta endif REPORTS_SUFFIX := $(addsuffix .report.txt, $(REPORTS_TO_GEN)) @@ -72,20 +72,20 @@ fi # LLC experimental tests -$(PROGRAMS_TO_TEST:%=Output/%.nightly.llc-ls.report.txt): \ -Output/%.nightly.llc-ls.report.txt: Output/%.llvm.bc Output/%.exe-llc-ls $(LLC) +$(PROGRAMS_TO_TEST:%=Output/%.nightly.llc-beta.report.txt): \ +Output/%.nightly.llc-beta.report.txt: Output/%.llvm.bc Output/%.exe-llc-beta $(LLC) @echo > $@ - -head -n 100 Output/$*.exe-llc-ls >> $@ - @-if test -f Output/$*.exe-llc-ls; then \ - echo "TEST-PASS: llc-ls $(RELDIR)/$*" >> $@;\ + -head -n 100 Output/$*.exe-llc-beta >> $@ + @-if test -f Output/$*.exe-llc-beta; then \ + echo "TEST-PASS: llc-beta $(RELDIR)/$*" >> $@;\ $(LLC) $< -o /dev/null -f $(TIMEOPT) >> $@ 2>&1; \ - printf "TEST-RESULT-llc-ls: " >> $@;\ + printf "TEST-RESULT-llc-beta: " >> $@;\ grep "Total Execution Time" $@.info >> $@;\ - printf "TEST-RESULT-llc-ls-time: " >> $@;\ - grep "^program" Output/$*.out-llc-ls.time >> $@;\ + printf "TEST-RESULT-llc-beta-time: " >> $@;\ + grep "^program" Output/$*.out-llc-beta.time >> $@;\ echo >> $@;\ else \ - echo "TEST-FAIL: llc-ls $(RELDIR)/$*" >> $@;\ + echo "TEST-FAIL: llc-beta $(RELDIR)/$*" >> $@;\ fi From lattner at cs.uiuc.edu Sat Jan 8 15:04:11 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 8 Jan 2005 15:04:11 -0600 Subject: [llvm-commits] CVS: llvm/utils/NightlyTest.pl Message-ID: <200501082104.j08L4BDo012695@apoc.cs.uiuc.edu> Changes in directory llvm/utils: NightlyTest.pl updated: 1.85 -> 1.86 --- Log message: rename linscan -> LLCBETA as it should be --- Diffs of the changes: (+1 -1) Index: llvm/utils/NightlyTest.pl diff -u llvm/utils/NightlyTest.pl:1.85 llvm/utils/NightlyTest.pl:1.86 --- llvm/utils/NightlyTest.pl:1.85 Sat Dec 25 23:21:13 2004 +++ llvm/utils/NightlyTest.pl Sat Jan 8 15:03:58 2005 @@ -260,7 +260,7 @@ $MAKEOPTS = "$MAKEOPTS CompileOptimizeOpts='-O3 -DNDEBUG -finline-functions -Wpointer-arith -Wcast-align -Wno-deprecated -Wold-style-cast -Wabi -Woverloaded-virtual -ffor-scope'"; next; } - if (/^-enable-linscan$/) { $PROGTESTOPTS .= " ENABLE_LINEARSCAN=1"; next; } + if (/^-enable-llcbeta$/) { $PROGTESTOPTS .= " ENABLE_LLCBETA=1"; next; } if (/^-disable-llc$/) { $PROGTESTOPTS .= " DISABLE_LLC=1"; $CONFIGUREARGS .= " --disable-llc_diffs"; next; } if (/^-disable-jit$/) { $PROGTESTOPTS .= " DISABLE_JIT=1"; From jeffc at jolt-lang.org Sat Jan 8 16:01:27 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Sat, 8 Jan 2005 16:01:27 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Transforms/LinkAllPasses.h Message-ID: <200501082201.QAA16959@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Transforms: LinkAllPasses.h updated: 1.11 -> 1.12 --- Log message: Add even more missing createXxxPass functions. --- Diffs of the changes: (+11 -5) Index: llvm/include/llvm/Transforms/LinkAllPasses.h diff -u llvm/include/llvm/Transforms/LinkAllPasses.h:1.11 llvm/include/llvm/Transforms/LinkAllPasses.h:1.12 --- llvm/include/llvm/Transforms/LinkAllPasses.h:1.11 Sat Jan 8 12:15:23 2005 +++ llvm/include/llvm/Transforms/LinkAllPasses.h Sat Jan 8 16:01:16 2005 @@ -31,8 +31,8 @@ extern "C" __declspec(dllimport) void* __stdcall GetCurrentProcess(); namespace { - struct ForceLinking { - ForceLinking() { + struct ForcePassLinking { + ForcePassLinking() { // We must reference the passes in such a way that VC++ will not // delete it all as dead code, even with whole program optimization, // yet is effectively a NO-OP. As the compiler isn't smart enough @@ -41,10 +41,13 @@ if (GetCurrentProcess() != (void *) -1) return; - std::vector bbv; - + (void) llvm::createAAEvalPass(); (void) llvm::createAggressiveDCEPass(); + (void) llvm::createAliasAnalysisCounterPass(); + (void) llvm::createAndersensPass(); (void) llvm::createArgumentPromotionPass(); + (void) llvm::createBasicAliasAnalysisPass(); + (void) llvm::createBasicVNPass(); (void) llvm::createBlockPlacementPass(); (void) llvm::createBlockProfilerPass(); (void) llvm::createBreakCriticalEdgesPass(); @@ -74,6 +77,7 @@ (void) llvm::createInternalizePass(); (void) llvm::createLICMPass(); (void) llvm::createLoadValueNumberingPass(); + (void) llvm::createLoaderPass(); (void) llvm::createLoopExtractorPass(); (void) llvm::createLoopInstrumentationPass(); (void) llvm::createLoopSimplifyPass(); @@ -88,6 +92,8 @@ (void) llvm::createLowerSelectPass(); (void) llvm::createLowerSetJmpPass(); (void) llvm::createLowerSwitchPass(); + (void) llvm::createNoAAPass(); + (void) llvm::createNoProfileInfoPass(); (void) llvm::createPREPass(); (void) llvm::createProfilePathsPass(); (void) llvm::createPromoteMemoryToRegister(); @@ -107,7 +113,7 @@ (void) llvm::createUnifyFunctionExitNodesPass(); (void) llvm::createUnreachableBlockEliminationPass(); } - } X; + } _ForcePassLinking; }; #endif // _MSC_VER From jeffc at jolt-lang.org Sat Jan 8 16:01:27 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Sat, 8 Jan 2005 16:01:27 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/AliasAnalysisCounter.cpp AliasAnalysisEvaluator.cpp BasicAliasAnalysis.cpp ProfileInfo.cpp ProfileInfoLoaderPass.cpp ValueNumbering.cpp Message-ID: <200501082201.QAA16975@zion.cs.uiuc.edu> Changes in directory llvm/lib/Analysis: AliasAnalysisCounter.cpp updated: 1.10 -> 1.11 AliasAnalysisEvaluator.cpp updated: 1.20 -> 1.21 BasicAliasAnalysis.cpp updated: 1.63 -> 1.64 ProfileInfo.cpp updated: 1.5 -> 1.6 ProfileInfoLoaderPass.cpp updated: 1.8 -> 1.9 ValueNumbering.cpp updated: 1.13 -> 1.14 --- Log message: Add even more missing createXxxPass functions. --- Diffs of the changes: (+22 -0) Index: llvm/lib/Analysis/AliasAnalysisCounter.cpp diff -u llvm/lib/Analysis/AliasAnalysisCounter.cpp:1.10 llvm/lib/Analysis/AliasAnalysisCounter.cpp:1.11 --- llvm/lib/Analysis/AliasAnalysisCounter.cpp:1.10 Tue Dec 7 02:11:24 2004 +++ llvm/lib/Analysis/AliasAnalysisCounter.cpp Sat Jan 8 16:01:16 2005 @@ -12,6 +12,7 @@ // //===----------------------------------------------------------------------===// +#include "llvm/Analysis/Passes.h" #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Pass.h" #include @@ -124,3 +125,7 @@ X("count-aa", "Count Alias Analysis Query Responses"); RegisterAnalysisGroup Y; } + +ModulePass *llvm::createAliasAnalysisCounterPass() { + return new AliasAnalysisCounter(); +} Index: llvm/lib/Analysis/AliasAnalysisEvaluator.cpp diff -u llvm/lib/Analysis/AliasAnalysisEvaluator.cpp:1.20 llvm/lib/Analysis/AliasAnalysisEvaluator.cpp:1.21 --- llvm/lib/Analysis/AliasAnalysisEvaluator.cpp:1.20 Fri Nov 26 15:05:39 2004 +++ llvm/lib/Analysis/AliasAnalysisEvaluator.cpp Sat Jan 8 16:01:16 2005 @@ -21,6 +21,7 @@ #include "llvm/Instructions.h" #include "llvm/Pass.h" #include "llvm/DerivedTypes.h" +#include "llvm/Analysis/Passes.h" #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Assembly/Writer.h" #include "llvm/Target/TargetData.h" @@ -72,6 +73,8 @@ X("aa-eval", "Exhaustive Alias Analysis Precision Evaluator"); } +FunctionPass *llvm::createAAEvalPass() { return new AAEval(); } + static inline void PrintResults(const char *Msg, bool P, Value *V1, Value *V2, Module *M) { if (P) { Index: llvm/lib/Analysis/BasicAliasAnalysis.cpp diff -u llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.63 llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.64 --- llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.63 Wed Dec 15 11:13:24 2004 +++ llvm/lib/Analysis/BasicAliasAnalysis.cpp Sat Jan 8 16:01:16 2005 @@ -14,6 +14,7 @@ //===----------------------------------------------------------------------===// #include "llvm/Analysis/AliasAnalysis.h" +#include "llvm/Analysis/Passes.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" #include "llvm/Function.h" @@ -80,6 +81,7 @@ RegisterAnalysisGroup V; } // End of anonymous namespace +ImmutablePass *llvm::createNoAAPass() { return new NoAA(); } namespace { /// BasicAliasAnalysis - This is the default alias analysis implementation. @@ -124,6 +126,10 @@ RegisterAnalysisGroup Y; } // End of anonymous namespace +ImmutablePass *llvm::createBasicAliasAnalysisPass() { + return new BasicAliasAnalysis(); +} + // hasUniqueAddress - Return true if the specified value points to something // with a unique, discernable, address. static inline bool hasUniqueAddress(const Value *V) { Index: llvm/lib/Analysis/ProfileInfo.cpp diff -u llvm/lib/Analysis/ProfileInfo.cpp:1.5 llvm/lib/Analysis/ProfileInfo.cpp:1.6 --- llvm/lib/Analysis/ProfileInfo.cpp:1.5 Mon Mar 8 16:04:08 2004 +++ llvm/lib/Analysis/ProfileInfo.cpp Sat Jan 8 16:01:16 2005 @@ -12,6 +12,7 @@ // //===----------------------------------------------------------------------===// +#include "llvm/Analysis/Passes.h" #include "llvm/Analysis/ProfileInfo.h" #include "llvm/Pass.h" #include "llvm/Support/CFG.h" @@ -90,3 +91,5 @@ // Declare that we implement the ProfileInfo interface RegisterAnalysisGroup Y; } // End of anonymous namespace + +ImmutablePass *llvm::createNoProfileInfoPass() { return new NoProfileInfo(); } Index: llvm/lib/Analysis/ProfileInfoLoaderPass.cpp diff -u llvm/lib/Analysis/ProfileInfoLoaderPass.cpp:1.8 llvm/lib/Analysis/ProfileInfoLoaderPass.cpp:1.9 --- llvm/lib/Analysis/ProfileInfoLoaderPass.cpp:1.8 Sun Sep 19 23:45:57 2004 +++ llvm/lib/Analysis/ProfileInfoLoaderPass.cpp Sat Jan 8 16:01:16 2005 @@ -15,6 +15,7 @@ #include "llvm/BasicBlock.h" #include "llvm/InstrTypes.h" #include "llvm/Pass.h" +#include "llvm/Analysis/Passes.h" #include "llvm/Analysis/ProfileInfo.h" #include "llvm/Analysis/ProfileInfoLoader.h" #include "llvm/Support/CommandLine.h" @@ -54,6 +55,7 @@ RegisterAnalysisGroup Y; } // End of anonymous namespace +ModulePass *llvm::createLoaderPass() { return new LoaderPass(); } /// createProfileLoaderPass - This function returns a Pass that loads the /// profiling information for the module from the specified filename, making it Index: llvm/lib/Analysis/ValueNumbering.cpp diff -u llvm/lib/Analysis/ValueNumbering.cpp:1.13 llvm/lib/Analysis/ValueNumbering.cpp:1.14 --- llvm/lib/Analysis/ValueNumbering.cpp:1.13 Thu Dec 23 15:17:41 2004 +++ llvm/lib/Analysis/ValueNumbering.cpp Sat Jan 8 16:01:16 2005 @@ -12,6 +12,7 @@ // //===----------------------------------------------------------------------===// +#include "llvm/Analysis/Passes.h" #include "llvm/Analysis/ValueNumbering.h" #include "llvm/Support/InstVisitor.h" #include "llvm/BasicBlock.h" @@ -85,6 +86,8 @@ }; } +ImmutablePass *llvm::createBasicVNPass() { return new BasicVN(); } + // getEqualNumberNodes - Return nodes with the same value number as the // specified Value. This fills in the argument vector with any equal values. // From jeffc at jolt-lang.org Sat Jan 8 16:01:27 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Sat, 8 Jan 2005 16:01:27 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/Passes.h Message-ID: <200501082201.QAA16960@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: Passes.h updated: 1.1 -> 1.2 --- Log message: Add even more missing createXxxPass functions. --- Diffs of the changes: (+58 -2) Index: llvm/include/llvm/Analysis/Passes.h diff -u llvm/include/llvm/Analysis/Passes.h:1.1 llvm/include/llvm/Analysis/Passes.h:1.2 --- llvm/include/llvm/Analysis/Passes.h:1.1 Mon Jun 28 01:31:26 2004 +++ llvm/include/llvm/Analysis/Passes.h Sat Jan 8 16:01:16 2005 @@ -16,14 +16,70 @@ #define LLVM_ANALYSIS_PASSES_H namespace llvm { + class FunctionPass; + class ImmutablePass; + class ModulePass; class Pass; //===--------------------------------------------------------------------===// // - // createGlobalsModRefPass - This function creates and returns an instance of - // the GlobalsModRef alias analysis pass. + // createGlobalsModRefPass - This pass provides alias and mod/ref info for + // global values that do not have their addresses taken. // Pass *createGlobalsModRefPass(); + + //===--------------------------------------------------------------------===// + // + // createAliasAnalysisCounterPass - This pass counts alias queries and how the + // alias analysis implementation responds. + // + ModulePass *createAliasAnalysisCounterPass(); + + //===--------------------------------------------------------------------===// + // + // createAAEvalPass - This pass implements a simple N^2 alias analysis + // accuracy evaluator. + // + FunctionPass *createAAEvalPass(); + + //===--------------------------------------------------------------------===// + // + // createNoAAPass - This pass implements a "I don't know" alias analysis. + // + ImmutablePass *createNoAAPass(); + + //===--------------------------------------------------------------------===// + // + // createBasicAliasAnalysisPass - This pass implements the default alias + // analysis. + // + ImmutablePass *createBasicAliasAnalysisPass(); + + //===--------------------------------------------------------------------===// + // + // createAndersensPass - This pass implements Andersen's interprocedural alias + // analysis. + // + ModulePass *createAndersensPass(); + + //===--------------------------------------------------------------------===// + // + // createBasicVNPass - This pass walks SSA def-use chains to trivially + // identify lexically identical expressions. + // + ImmutablePass *createBasicVNPass(); + + //===--------------------------------------------------------------------===// + // + // createLoaderPass - This pass loads information from a profile dump file. + // + ModulePass *createLoaderPass(); + + //===--------------------------------------------------------------------===// + // + // createNoProfileInfoPass - This pass implements the default "no profile". + // + ImmutablePass *createNoProfileInfoPass(); } #endif From jeffc at jolt-lang.org Sat Jan 8 16:01:27 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Sat, 8 Jan 2005 16:01:27 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/IPA/Andersens.cpp Message-ID: <200501082201.QAA16978@zion.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/IPA: Andersens.cpp updated: 1.9 -> 1.10 --- Log message: Add even more missing createXxxPass functions. --- Diffs of the changes: (+3 -0) Index: llvm/lib/Analysis/IPA/Andersens.cpp diff -u llvm/lib/Analysis/IPA/Andersens.cpp:1.9 llvm/lib/Analysis/IPA/Andersens.cpp:1.10 --- llvm/lib/Analysis/IPA/Andersens.cpp:1.9 Sat Oct 16 13:16:19 2004 +++ llvm/lib/Analysis/IPA/Andersens.cpp Sat Jan 8 16:01:16 2005 @@ -58,6 +58,7 @@ #include "llvm/Support/InstIterator.h" #include "llvm/Support/InstVisitor.h" #include "llvm/Analysis/AliasAnalysis.h" +#include "llvm/Analysis/Passes.h" #include "llvm/Support/Debug.h" #include "llvm/ADT/Statistic.h" #include @@ -334,6 +335,8 @@ RegisterAnalysisGroup Y; } +ModulePass *llvm::createAndersensPass() { return new Andersens(); } + //===----------------------------------------------------------------------===// // AliasAnalysis Interface Implementation //===----------------------------------------------------------------------===// From jeffc at jolt-lang.org Sat Jan 8 16:44:17 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Sat, 8 Jan 2005 16:44:17 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/DerivedTypes.h Message-ID: <200501082244.QAA17254@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: DerivedTypes.h updated: 1.65 -> 1.66 --- Log message: Fix VC++ compilation error --- Diffs of the changes: (+1 -0) Index: llvm/include/llvm/DerivedTypes.h diff -u llvm/include/llvm/DerivedTypes.h:1.65 llvm/include/llvm/DerivedTypes.h:1.66 --- llvm/include/llvm/DerivedTypes.h:1.65 Sat Jan 8 14:19:27 2005 +++ llvm/include/llvm/DerivedTypes.h Sat Jan 8 16:44:06 2005 @@ -19,6 +19,7 @@ #define LLVM_DERIVED_TYPES_H #include "llvm/Type.h" +#include "llvm/Support/DataTypes.h" namespace llvm { From lattner at cs.uiuc.edu Sat Jan 8 16:49:14 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 8 Jan 2005 16:49:14 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200501082249.j08MnEtr014615@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.6 -> 1.7 --- Log message: Add support for llvm.setjmp and longjmp. Only 3 SingleSource/UnitTests fail now. --- Diffs of the changes: (+8 -1) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.6 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.7 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.6 Sat Jan 8 13:52:31 2005 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Sat Jan 8 16:48:57 2005 @@ -569,6 +569,7 @@ } void SelectionDAGLowering::visitCall(CallInst &I) { + const char *RenameFn = 0; if (Function *F = I.getCalledFunction()) switch (F->getIntrinsicID()) { case 0: break; // Not an intrinsic. @@ -584,6 +585,8 @@ // readport, writeport, readio, writeio assert(0 && "This intrinsic is not implemented yet!"); return; + case Intrinsic::setjmp: RenameFn = "setjmp"; break; + case Intrinsic::longjmp: RenameFn = "longjmp"; break; case Intrinsic::memcpy: visitMemCpy(I); return; case Intrinsic::memset: visitMemSet(I); return; case Intrinsic::memmove: visitMemMove(I); return; @@ -594,7 +597,11 @@ return; } - SDOperand Callee = getValue(I.getOperand(0)); + SDOperand Callee; + if (!RenameFn) + Callee = getValue(I.getOperand(0)); + else + Callee = DAG.getExternalSymbol(RenameFn, TLI.getPointerTy()); std::vector > Args; for (unsigned i = 1, e = I.getNumOperands(); i != e; ++i) { From jeffc at jolt-lang.org Sat Jan 8 17:44:14 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Sat, 8 Jan 2005 17:44:14 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CFrontend/2004-03-07-BitfieldCrash.c Message-ID: <200501082344.RAA17506@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CFrontend: 2004-03-07-BitfieldCrash.c updated: 1.4 -> 1.5 --- Log message: Test fails on all platforms, not just linux --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/CFrontend/2004-03-07-BitfieldCrash.c diff -u llvm/test/Regression/CFrontend/2004-03-07-BitfieldCrash.c:1.4 llvm/test/Regression/CFrontend/2004-03-07-BitfieldCrash.c:1.5 --- llvm/test/Regression/CFrontend/2004-03-07-BitfieldCrash.c:1.4 Mon Nov 22 13:11:40 2004 +++ llvm/test/Regression/CFrontend/2004-03-07-BitfieldCrash.c Sat Jan 8 17:44:03 2005 @@ -1,7 +1,7 @@ // RUN: %llvmgcc -S %s -o /dev/null /* - * XFAIL: linux + * XFAIL: * */ struct s { unsigned long long u33: 33; From lattner at cs.uiuc.edu Sat Jan 8 18:00:47 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 8 Jan 2005 18:00:47 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/TargetLowering.h Message-ID: <200501090000.j0900luj006791@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: TargetLowering.h updated: 1.2 -> 1.3 --- Log message: Add interfaces to lower varargs and return/frame address intrinsics. --- Diffs of the changes: (+31 -0) Index: llvm/include/llvm/Target/TargetLowering.h diff -u llvm/include/llvm/Target/TargetLowering.h:1.2 llvm/include/llvm/Target/TargetLowering.h:1.3 --- llvm/include/llvm/Target/TargetLowering.h:1.2 Sat Jan 8 13:25:39 2005 +++ llvm/include/llvm/Target/TargetLowering.h Sat Jan 8 18:00:31 2005 @@ -172,6 +172,37 @@ virtual std::pair LowerCallTo(SDOperand Chain, const Type *RetTy, SDOperand Callee, ArgListTy &Args, SelectionDAG &DAG) = 0; + + + /// LowerVAStart - This lowers the llvm.va_start intrinsic. If not + /// implemented, this method prints a message and aborts. + virtual std::pair + LowerVAStart(SDOperand Chain, SelectionDAG &DAG); + + /// LowerVAEnd - This lowers llvm.va_end and returns the resultant chain. If + /// not implemented, this defaults to a noop. + virtual SDOperand LowerVAEnd(SDOperand Chain, SDOperand L, SelectionDAG &DAG); + + /// LowerVACopy - This lowers llvm.va_copy and returns the resultant + /// value/chain pair. If not implemented, this defaults to returning the + /// input operand. + virtual std::pair + LowerVACopy(SDOperand Chain, SDOperand L, SelectionDAG &DAG); + + /// LowerVAArgNext - This lowers the vaarg and vanext instructions (depending + /// on whether the first argument is true). If not implemented, this prints a + /// message and aborts. + virtual std::pair + LowerVAArgNext(bool isVANext, SDOperand Chain, SDOperand VAList, + const Type *ArgTy, SelectionDAG &DAG); + + /// LowerFrameReturnAddress - This hook lowers a call to llvm.returnaddress or + /// llvm.frameaddress (depending on the value of the first argument). The + /// return values are the result pointer and the resultant token chain. If + /// not implemented, both of these intrinsics will return null. + virtual std::pair + LowerFrameReturnAddress(bool isFrameAddr, SDOperand Chain, unsigned Depth, + SelectionDAG &DAG); }; } // end llvm namespace From lattner at cs.uiuc.edu Sat Jan 8 18:01:02 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 8 Jan 2005 18:01:02 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200501090001.j09012Cq006820@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.7 -> 1.8 --- Log message: Use new interfaces to correctly lower varargs and return/frame address intrinsics. --- Diffs of the changes: (+61 -25) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.7 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.8 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.7 Sat Jan 8 16:48:57 2005 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Sat Jan 8 18:00:49 2005 @@ -304,14 +304,12 @@ void visitPHI(PHINode &I) { } // PHI nodes are handled specially. void visitCall(CallInst &I); - // FIXME: These should go through the FunctionLoweringInfo object!!! void visitVAStart(CallInst &I); void visitVANext(VANextInst &I); void visitVAArg(VAArgInst &I); void visitVAEnd(CallInst &I); void visitVACopy(CallInst &I); - void visitReturnAddress(CallInst &I); - void visitFrameAddress(CallInst &I); + void visitFrameReturnAddress(CallInst &I, bool isFrameAddress); void visitMemSet(CallInst &I); void visitMemCpy(CallInst &I); @@ -576,10 +574,8 @@ case Intrinsic::vastart: visitVAStart(I); return; case Intrinsic::vaend: visitVAEnd(I); return; case Intrinsic::vacopy: visitVACopy(I); return; - case Intrinsic::returnaddress: - visitReturnAddress(I); return; - case Intrinsic::frameaddress: - visitFrameAddress(I); return; + case Intrinsic::returnaddress: visitFrameReturnAddress(I, false); return; + case Intrinsic::frameaddress: visitFrameReturnAddress(I, true); return; default: // FIXME: IMPLEMENT THESE. // readport, writeport, readio, writeio @@ -651,45 +647,85 @@ DAG.setRoot(Result.second); } -void SelectionDAGLowering::visitVAStart(CallInst &I) { +std::pair +TargetLowering::LowerVAStart(SDOperand Chain, SelectionDAG &DAG) { // We have no sane default behavior, just emit a useful error message and bail // out. - std::cerr << "Variable arguments support not implemented for this target!\n"; + std::cerr << "Variable arguments handling not implemented on this target!\n"; abort(); } -void SelectionDAGLowering::visitVANext(VANextInst &I) { +SDOperand TargetLowering::LowerVAEnd(SDOperand Chain, SDOperand L, + SelectionDAG &DAG) { + // Default to a noop. + return Chain; +} + +std::pair +TargetLowering::LowerVACopy(SDOperand Chain, SDOperand L, SelectionDAG &DAG) { + // Default to returning the input list. + return std::make_pair(L, Chain); +} + +std::pair +TargetLowering::LowerVAArgNext(bool isVANext, SDOperand Chain, SDOperand VAList, + const Type *ArgTy, SelectionDAG &DAG) { // We have no sane default behavior, just emit a useful error message and bail // out. - std::cerr << "Variable arguments support not implemented for this target!\n"; + std::cerr << "Variable arguments handling not implemented on this target!\n"; abort(); } + + +void SelectionDAGLowering::visitVAStart(CallInst &I) { + std::pair Result = TLI.LowerVAStart(DAG.getRoot(), DAG); + setValue(&I, Result.first); + DAG.setRoot(Result.second); +} + void SelectionDAGLowering::visitVAArg(VAArgInst &I) { - // We have no sane default behavior, just emit a useful error message and bail - // out. - std::cerr << "Variable arguments support not implemented for this target!\n"; - abort(); + std::pair Result = + TLI.LowerVAArgNext(false, DAG.getRoot(), getValue(I.getOperand(0)), + I.getType(), DAG); + setValue(&I, Result.first); + DAG.setRoot(Result.second); +} + +void SelectionDAGLowering::visitVANext(VANextInst &I) { + std::pair Result = + TLI.LowerVAArgNext(true, DAG.getRoot(), getValue(I.getOperand(0)), + I.getArgType(), DAG); + setValue(&I, Result.first); + DAG.setRoot(Result.second); } void SelectionDAGLowering::visitVAEnd(CallInst &I) { - // By default, this is a noop. On almost all targets, this is fine. + DAG.setRoot(TLI.LowerVAEnd(DAG.getRoot(), getValue(I.getOperand(1)), DAG)); } void SelectionDAGLowering::visitVACopy(CallInst &I) { - // By default, vacopy just does a simple pointer copy. - setValue(&I, getValue(I.getOperand(1))); + std::pair Result = + TLI.LowerVACopy(DAG.getRoot(), getValue(I.getOperand(1)), DAG); + setValue(&I, Result.first); + DAG.setRoot(Result.second); } -void SelectionDAGLowering::visitReturnAddress(CallInst &I) { - // It is always conservatively correct for llvm.returnaddress to return 0. - setValue(&I, getIntPtrConstant(0)); -} -void SelectionDAGLowering::visitFrameAddress(CallInst &I) { - // It is always conservatively correct for llvm.frameaddress to return 0. - setValue(&I, getIntPtrConstant(0)); +// It is always conservatively correct for llvm.returnaddress and +// llvm.frameaddress to return 0. +std::pair +TargetLowering::LowerFrameReturnAddress(bool isFrameAddr, SDOperand Chain, + unsigned Depth, SelectionDAG &DAG) { + return std::make_pair(DAG.getConstant(0, getPointerTy()), Chain); } +void SelectionDAGLowering::visitFrameReturnAddress(CallInst &I, bool isFrame) { + unsigned Depth = (unsigned)cast(I.getOperand(1))->getValue(); + std::pair Result = + TLI.LowerFrameReturnAddress(isFrame, DAG.getRoot(), Depth, DAG); + setValue(&I, Result.first); + DAG.setRoot(Result.second); +} void SelectionDAGLowering::visitMemSet(CallInst &I) { MVT::ValueType IntPtr = TLI.getPointerTy(); From lattner at cs.uiuc.edu Sat Jan 8 18:01:41 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 8 Jan 2005 18:01:41 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelPattern.cpp Message-ID: <200501090001.j0901fuI007005@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelPattern.cpp updated: 1.16 -> 1.17 --- Log message: Implement varargs and returnaddress/frameaddress intrinsics. With this patch, all of SingleSource/UnitTests passes. --- Diffs of the changes: (+66 -1) Index: llvm/lib/Target/X86/X86ISelPattern.cpp diff -u llvm/lib/Target/X86/X86ISelPattern.cpp:1.16 llvm/lib/Target/X86/X86ISelPattern.cpp:1.17 --- llvm/lib/Target/X86/X86ISelPattern.cpp:1.16 Sat Jan 8 14:51:36 2005 +++ llvm/lib/Target/X86/X86ISelPattern.cpp Sat Jan 8 18:01:27 2005 @@ -32,6 +32,7 @@ namespace { class X86TargetLowering : public TargetLowering { int VarArgsFrameIndex; // FrameIndex for start of varargs area. + int ReturnAddrIndex; // FrameIndex for return slot. public: X86TargetLowering(TargetMachine &TM) : TargetLowering(TM) { // Set up the TargetLowering object. @@ -67,6 +68,17 @@ virtual std::pair LowerCallTo(SDOperand Chain, const Type *RetTy, SDOperand Callee, ArgListTy &Args, SelectionDAG &DAG); + + virtual std::pair + LowerVAStart(SDOperand Chain, SelectionDAG &DAG); + + virtual std::pair + LowerVAArgNext(bool isVANext, SDOperand Chain, SDOperand VAList, + const Type *ArgTy, SelectionDAG &DAG); + + virtual std::pair + LowerFrameReturnAddress(bool isFrameAddr, SDOperand Chain, unsigned Depth, + SelectionDAG &DAG); }; } @@ -127,7 +139,7 @@ // the start of the first vararg value... for expansion of llvm.va_start. if (F.isVarArg()) VarArgsFrameIndex = MFI->CreateFixedObject(1, ArgOffset); - + ReturnAddrIndex = 0; // No return address slot generated yet. return ArgValues; } @@ -214,6 +226,59 @@ return std::make_pair(TheCall, Chain); } +std::pair +X86TargetLowering::LowerVAStart(SDOperand Chain, SelectionDAG &DAG) { + // vastart just returns the address of the VarArgsFrameIndex slot. + return std::make_pair(DAG.getFrameIndex(VarArgsFrameIndex, MVT::i32), Chain); +} + +std::pair X86TargetLowering:: +LowerVAArgNext(bool isVANext, SDOperand Chain, SDOperand VAList, + const Type *ArgTy, SelectionDAG &DAG) { + MVT::ValueType ArgVT = getValueType(ArgTy); + SDOperand Result; + if (!isVANext) { + Result = DAG.getLoad(ArgVT, DAG.getEntryNode(), VAList); + } else { + unsigned Amt; + if (ArgVT == MVT::i32) + Amt = 4; + else { + assert((ArgVT == MVT::i64 || ArgVT == MVT::f64) && + "Other types should have been promoted for varargs!"); + Amt = 8; + } + Result = DAG.getNode(ISD::ADD, VAList.getValueType(), VAList, + DAG.getConstant(Amt, VAList.getValueType())); + } + return std::make_pair(Result, Chain); +} + + +std::pair X86TargetLowering:: +LowerFrameReturnAddress(bool isFrameAddress, SDOperand Chain, unsigned Depth, + SelectionDAG &DAG) { + SDOperand Result; + if (Depth) // Depths > 0 not supported yet! + Result = DAG.getConstant(0, getPointerTy()); + else { + if (ReturnAddrIndex == 0) { + // Set up a frame object for the return address. + MachineFunction &MF = DAG.getMachineFunction(); + ReturnAddrIndex = MF.getFrameInfo()->CreateFixedObject(4, -4); + } + + SDOperand RetAddrFI = DAG.getFrameIndex(ReturnAddrIndex, MVT::i32); + + if (!isFrameAddress) + // Just load the return address + Result = DAG.getLoad(MVT::i32, DAG.getEntryNode(), RetAddrFI); + else + Result = DAG.getNode(ISD::SUB, MVT::i32, RetAddrFI, + DAG.getConstant(4, MVT::i32)); + } + return std::make_pair(Result, Chain); +} From lattner at cs.uiuc.edu Sat Jan 8 19:16:36 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 8 Jan 2005 19:16:36 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200501090116.j091Ga8s018539@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.8 -> 1.9 --- Log message: Handle static alloca arguments to PHI nodes. --- Diffs of the changes: (+8 -3) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.8 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.9 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.8 Sat Jan 8 18:00:49 2005 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Sat Jan 8 19:16:24 2005 @@ -836,8 +836,7 @@ // blocks are available as virtual registers. for (BasicBlock::iterator I = LLVMBB->begin(), E = LLVMBB->end(); I != E;++I) if (!I->use_empty()) { - std::map::iterator VMI = - FuncInfo.ValueMap.find(I); + std::map::iterator VMI =FuncInfo.ValueMap.find(I); if (VMI != FuncInfo.ValueMap.end()) CopyValueToVirtualRegister(SDL, I, VMI->second); } @@ -878,7 +877,13 @@ Reg = RegOut; } else { Reg = FuncInfo.ValueMap[PHIOp]; - assert(Reg && "Didn't codegen value into a register!??"); + if (Reg == 0) { + assert(isa(PHIOp) && + FuncInfo.StaticAllocaMap.count(cast(PHIOp)) && + "Didn't codegen value into a register!??"); + Reg = FuncInfo.CreateRegForValue(PHIOp); + CopyValueToVirtualRegister(SDL, PHIOp, Reg); + } } // Remember that this register needs to added to the machine PHI node as From lattner at cs.uiuc.edu Sat Jan 8 19:49:44 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 8 Jan 2005 19:49:44 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelSimple.cpp Message-ID: <200501090149.j091ni4d027640@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelSimple.cpp updated: 1.307 -> 1.308 --- Log message: Fix a subtle bug involving constant expr casts from int to fp --- Diffs of the changes: (+2 -2) Index: llvm/lib/Target/X86/X86ISelSimple.cpp diff -u llvm/lib/Target/X86/X86ISelSimple.cpp:1.307 llvm/lib/Target/X86/X86ISelSimple.cpp:1.308 --- llvm/lib/Target/X86/X86ISelSimple.cpp:1.307 Sat Jan 8 00:59:50 2005 +++ llvm/lib/Target/X86/X86ISelSimple.cpp Sat Jan 8 19:49:29 2005 @@ -3576,13 +3576,13 @@ // Compute whether the sign bit is set by shifting the reg right 31 bits. unsigned IsNeg = makeAnotherReg(Type::IntTy); - BuildMI(BB, X86::SHR32ri, 2, IsNeg).addReg(SrcReg).addImm(31); + BuildMI(*BB, IP, X86::SHR32ri, 2, IsNeg).addReg(SrcReg).addImm(31); // Create a CP value that has the offset in one word and 0 in the other. static ConstantInt *TheOffset = ConstantUInt::get(Type::ULongTy, 0x4f80000000000000ULL); unsigned CPI = F->getConstantPool()->getConstantPoolIndex(TheOffset); - BuildMI(BB, X86::FADD32m, 5, RealDestReg).addReg(DestReg) + BuildMI(*BB, IP, X86::FADD32m, 5, RealDestReg).addReg(DestReg) .addConstantPoolIndex(CPI).addZImm(4).addReg(IsNeg).addSImm(0); } else if (SrcTy == Type::ULongTy) { From jeffc at jolt-lang.org Sat Jan 8 22:13:20 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Sat, 8 Jan 2005 22:13:20 -0600 Subject: [llvm-commits] CVS: llvm/win32/Configure/Configure.vcproj Message-ID: <200501090413.WAA18920@zion.cs.uiuc.edu> Changes in directory llvm/win32/Configure: Configure.vcproj updated: 1.6 -> 1.7 --- Log message: Workaround a VC++ bug. Microsoft puts the hash_map class in namespace stdext, but this classes uses a utility function in namespace std. But Microsoft apparently assumes everyone will "using namespace std;". As LLVM doesn't.... Add a "use std::_Distance;" to get it working. --- Diffs of the changes: (+1 -1) Index: llvm/win32/Configure/Configure.vcproj diff -u llvm/win32/Configure/Configure.vcproj:1.6 llvm/win32/Configure/Configure.vcproj:1.7 --- llvm/win32/Configure/Configure.vcproj:1.6 Sat Jan 1 12:17:40 2005 +++ llvm/win32/Configure/Configure.vcproj Sat Jan 8 22:13:09 2005 @@ -98,7 +98,7 @@ From jeffc at jolt-lang.org Sat Jan 8 22:18:39 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Sat, 8 Jan 2005 22:18:39 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/MemoryDepAnalysis.cpp Message-ID: <200501090418.WAA18959@zion.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: MemoryDepAnalysis.cpp updated: 1.20 -> 1.21 --- Log message: Get lib/Analysis/DataStructure to compile with VC++ --- Diffs of the changes: (+2 -1) Index: llvm/lib/Analysis/DataStructure/MemoryDepAnalysis.cpp diff -u llvm/lib/Analysis/DataStructure/MemoryDepAnalysis.cpp:1.20 llvm/lib/Analysis/DataStructure/MemoryDepAnalysis.cpp:1.21 --- llvm/lib/Analysis/DataStructure/MemoryDepAnalysis.cpp:1.20 Mon Dec 6 22:03:45 2004 +++ llvm/lib/Analysis/DataStructure/MemoryDepAnalysis.cpp Sat Jan 8 22:18:28 2005 @@ -49,7 +49,8 @@ /// not copied over from one table to another since it is no longer useful. ///-------------------------------------------------------------------------- -struct ModRefTable { +class ModRefTable { +public: typedef hash_map ModRefMap; typedef ModRefMap::const_iterator const_map_iterator; typedef ModRefMap:: iterator map_iterator; From jeffc at jolt-lang.org Sat Jan 8 22:18:39 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Sat, 8 Jan 2005 22:18:39 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DataStructure/DSGraph.h DSNode.h DSSupport.h DataStructure.h Message-ID: <200501090418.WAA18969@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis/DataStructure: DSGraph.h updated: 1.82 -> 1.83 DSNode.h updated: 1.45 -> 1.46 DSSupport.h updated: 1.34 -> 1.35 DataStructure.h updated: 1.80 -> 1.81 --- Log message: Get lib/Analysis/DataStructure to compile with VC++ --- Diffs of the changes: (+6 -1) Index: llvm/include/llvm/Analysis/DataStructure/DSGraph.h diff -u llvm/include/llvm/Analysis/DataStructure/DSGraph.h:1.82 llvm/include/llvm/Analysis/DataStructure/DSGraph.h:1.83 --- llvm/include/llvm/Analysis/DataStructure/DSGraph.h:1.82 Wed Dec 8 15:04:10 2004 +++ llvm/include/llvm/Analysis/DataStructure/DSGraph.h Sat Jan 8 22:18:28 2005 @@ -16,6 +16,7 @@ #define LLVM_ANALYSIS_DSGRAPH_H #include "llvm/Analysis/DataStructure/DSNode.h" +#include "llvm/ADT/hash_map" namespace llvm { @@ -97,7 +98,8 @@ //===----------------------------------------------------------------------===// /// DSGraph - The graph that represents a function. /// -struct DSGraph { +class DSGraph { +public: // Public data-type declarations... typedef DSScalarMap ScalarMapTy; typedef hash_map ReturnNodesTy; Index: llvm/include/llvm/Analysis/DataStructure/DSNode.h diff -u llvm/include/llvm/Analysis/DataStructure/DSNode.h:1.45 llvm/include/llvm/Analysis/DataStructure/DSNode.h:1.46 --- llvm/include/llvm/Analysis/DataStructure/DSNode.h:1.45 Wed Oct 27 11:14:50 2004 +++ llvm/include/llvm/Analysis/DataStructure/DSNode.h Sat Jan 8 22:18:28 2005 @@ -15,6 +15,7 @@ #define LLVM_ANALYSIS_DSNODE_H #include "llvm/Analysis/DataStructure/DSSupport.h" +#include "llvm/ADT/hash_map" namespace llvm { Index: llvm/include/llvm/Analysis/DataStructure/DSSupport.h diff -u llvm/include/llvm/Analysis/DataStructure/DSSupport.h:1.34 llvm/include/llvm/Analysis/DataStructure/DSSupport.h:1.35 --- llvm/include/llvm/Analysis/DataStructure/DSSupport.h:1.34 Fri Oct 29 23:03:47 2004 +++ llvm/include/llvm/Analysis/DataStructure/DSSupport.h Sat Jan 8 22:18:28 2005 @@ -15,6 +15,7 @@ #define LLVM_ANALYSIS_DSSUPPORT_H #include +#include "llvm/ADT/hash_map" #include "llvm/ADT/hash_set" #include "llvm/Support/CallSite.h" Index: llvm/include/llvm/Analysis/DataStructure/DataStructure.h diff -u llvm/include/llvm/Analysis/DataStructure/DataStructure.h:1.80 llvm/include/llvm/Analysis/DataStructure/DataStructure.h:1.81 --- llvm/include/llvm/Analysis/DataStructure/DataStructure.h:1.80 Sun Sep 19 23:42:27 2004 +++ llvm/include/llvm/Analysis/DataStructure/DataStructure.h Sat Jan 8 22:18:28 2005 @@ -16,6 +16,7 @@ #include "llvm/Pass.h" #include "llvm/Target/TargetData.h" +#include "llvm/ADT/hash_map" #include "llvm/ADT/hash_set" namespace llvm { From jeffc at jolt-lang.org Sat Jan 8 22:18:39 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Sat, 8 Jan 2005 22:18:39 -0600 Subject: [llvm-commits] CVS: llvm/win32/Analysis/Analysis.vcproj Message-ID: <200501090418.WAA18967@zion.cs.uiuc.edu> Changes in directory llvm/win32/Analysis: Analysis.vcproj updated: 1.7 -> 1.8 --- Log message: Get lib/Analysis/DataStructure to compile with VC++ --- Diffs of the changes: (+67 -0) Index: llvm/win32/Analysis/Analysis.vcproj diff -u llvm/win32/Analysis/Analysis.vcproj:1.7 llvm/win32/Analysis/Analysis.vcproj:1.8 --- llvm/win32/Analysis/Analysis.vcproj:1.7 Tue Jan 4 00:01:54 2005 +++ llvm/win32/Analysis/Analysis.vcproj Sat Jan 8 22:18:28 2005 @@ -188,6 +188,73 @@ RelativePath="..\..\lib\Analysis\Ipa\PrintSCC.cpp"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Changes in directory llvm-test/External/SPEC: Makefile.spec updated: 1.46 -> 1.47 --- Log message: Grr, I forgot spec had seperate rules for these. Update llc-beta for spec. --- Diffs of the changes: (+15 -15) Index: llvm-test/External/SPEC/Makefile.spec diff -u llvm-test/External/SPEC/Makefile.spec:1.46 llvm-test/External/SPEC/Makefile.spec:1.47 --- llvm-test/External/SPEC/Makefile.spec:1.46 Wed Dec 1 22:21:48 2004 +++ llvm-test/External/SPEC/Makefile.spec Sun Jan 9 11:45:48 2005 @@ -81,13 +81,13 @@ -(cd Output/jit-$(RUN_TYPE); cat $(LOCAL_OUTPUTS)) > $@ -cp Output/jit-$(RUN_TYPE)/$(STDOUT_FILENAME).time $@.time -$(PROGRAMS_TO_TEST:%=Output/%.out-jit-ls): \ -Output/%.out-jit-ls: Output/%.llvm.bc $(LLI) - $(SPEC_SANDBOX) jit-ls-$(RUN_TYPE) $@ $(REF_IN_DIR) \ +$(PROGRAMS_TO_TEST:%=Output/%.out-jit-beta): \ +Output/%.out-jit-beta: Output/%.llvm.bc $(LLI) + $(SPEC_SANDBOX) jit-beta-$(RUN_TYPE) $@ $(REF_IN_DIR) \ $(RUNSAFELY) $(STDIN_FILENAME) $(STDOUT_FILENAME) \ $(LLI) -regalloc=iterativescan $(JIT_OPTS) ../$*.llvm.bc $(RUN_OPTIONS) - -(cd Output/jit-ls-$(RUN_TYPE); cat $(LOCAL_OUTPUTS)) > $@ - -cp Output/jit-ls-$(RUN_TYPE)/$(STDOUT_FILENAME).time $@.time + -(cd Output/jit-beta-$(RUN_TYPE); cat $(LOCAL_OUTPUTS)) > $@ + -cp Output/jit-beta-$(RUN_TYPE)/$(STDOUT_FILENAME).time $@.time $(PROGRAMS_TO_TEST:%=Output/%.out-llc): \ Output/%.out-llc: Output/%.llc @@ -97,13 +97,13 @@ -(cd Output/llc-$(RUN_TYPE); cat $(LOCAL_OUTPUTS)) > $@ -cp Output/llc-$(RUN_TYPE)/$(STDOUT_FILENAME).time $@.time -$(PROGRAMS_TO_TEST:%=Output/%.out-llc-ls): \ -Output/%.out-llc-ls: Output/%.llc-ls - $(SPEC_SANDBOX) llc-ls-$(RUN_TYPE) $@ $(REF_IN_DIR) \ +$(PROGRAMS_TO_TEST:%=Output/%.out-llc-beta): \ +Output/%.out-llc-beta: Output/%.llc-beta + $(SPEC_SANDBOX) llc-beta-$(RUN_TYPE) $@ $(REF_IN_DIR) \ $(RUNSAFELY) $(STDIN_FILENAME) $(STDOUT_FILENAME) \ - ../$*.llc-ls $(RUN_OPTIONS) - -(cd Output/llc-ls-$(RUN_TYPE); cat $(LOCAL_OUTPUTS)) > $@ - -cp Output/llc-ls-$(RUN_TYPE)/$(STDOUT_FILENAME).time $@.time + ../$*.llc-beta $(RUN_OPTIONS) + -(cd Output/llc-beta-$(RUN_TYPE); cat $(LOCAL_OUTPUTS)) > $@ + -cp Output/llc-beta-$(RUN_TYPE)/$(STDOUT_FILENAME).time $@.time $(PROGRAMS_TO_TEST:%=Output/%.out-cbe): \ Output/%.out-cbe: Output/%.cbe @@ -142,8 +142,8 @@ $(LBUGPOINT) ../$*.llvm.bc -run-llc $(BUGPOINT_OPTIONS) $(BUGPOINT_ARGS) @echo "===> Leaving Output/bugpoint-$(RUN_TYPE)" -$(PROGRAMS_TO_TEST:%=Output/%.bugpoint-llc-ls): \ -Output/%.bugpoint-llc-ls: Output/%.llvm.bc $(LBUGPOINT) Output/%.out-nat +$(PROGRAMS_TO_TEST:%=Output/%.bugpoint-llc-beta): \ +Output/%.bugpoint-llc-beta: Output/%.llvm.bc $(LBUGPOINT) Output/%.out-nat $(SPEC_SANDBOX) bugpoint-$(RUN_TYPE) $@ $(REF_IN_DIR) \ $(LBUGPOINT) ../$*.llvm.bc -run-llc $(BUGPOINT_OPTIONS) \ -regalloc=iterativescan $(BUGPOINT_ARGS) @@ -155,8 +155,8 @@ $(LBUGPOINT) ../$*.llvm.bc -run-jit $(BUGPOINT_OPTIONS) $(BUGPOINT_ARGS) @echo "===> Leaving Output/bugpoint-$(RUN_TYPE)" -$(PROGRAMS_TO_TEST:%=Output/%.bugpoint-jit-ls): \ -Output/%.bugpoint-jit-ls: Output/%.llvm.bc $(LBUGPOINT) Output/%.out-nat +$(PROGRAMS_TO_TEST:%=Output/%.bugpoint-jit-beta): \ +Output/%.bugpoint-jit-beta: Output/%.llvm.bc $(LBUGPOINT) Output/%.out-nat $(SPEC_SANDBOX) bugpoint-$(RUN_TYPE) $@ $(REF_IN_DIR) \ $(LBUGPOINT) ../$*.llvm.bc -run-jit $(BUGPOINT_OPTIONS) \ -regalloc=iterativescan $(BUGPOINT_ARGS) From lattner at cs.uiuc.edu Sun Jan 9 12:52:59 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 9 Jan 2005 12:52:59 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelPattern.cpp Message-ID: <200501091852.j09IqxJQ018299@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelPattern.cpp updated: 1.17 -> 1.18 --- Log message: Initial implementation of FP->INT and INT->FP casts Also, fix zero_extend from bool to i8, which fixes Shootout/objinst. --- Diffs of the changes: (+220 -3) Index: llvm/lib/Target/X86/X86ISelPattern.cpp diff -u llvm/lib/Target/X86/X86ISelPattern.cpp:1.17 llvm/lib/Target/X86/X86ISelPattern.cpp:1.18 --- llvm/lib/Target/X86/X86ISelPattern.cpp:1.17 Sat Jan 8 18:01:27 2005 +++ llvm/lib/Target/X86/X86ISelPattern.cpp Sun Jan 9 12:52:44 2005 @@ -14,7 +14,9 @@ #include "X86.h" #include "X86InstrBuilder.h" #include "X86RegisterInfo.h" +#include "llvm/Constants.h" // FIXME: REMOVE #include "llvm/Function.h" +#include "llvm/CodeGen/MachineConstantPool.h" // FIXME: REMOVE #include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineFrameInfo.h" #include "llvm/CodeGen/SelectionDAG.h" @@ -657,9 +659,9 @@ SDNode *Node = N.Val; - if (N.getOpcode() == ISD::CopyFromReg) + if (Node->getOpcode() == ISD::CopyFromReg) // Just use the specified register as our input. - return dyn_cast(N)->getReg(); + return dyn_cast(Node)->getReg(); // If there are multiple uses of this expression, memorize the // register it is code generated in, instead of emitting it multiple @@ -747,11 +749,18 @@ case ISD::ZERO_EXTEND: { int DestIs16 = N.getValueType() == MVT::i16; int SrcIs16 = N.getOperand(0).getValueType() == MVT::i16; + Tmp1 = SelectExpr(N.getOperand(0)); + + // FIXME: This hack is here for zero extension casts from bool to i8. This + // would not be needed if bools were promoted by Legalize. + if (N.getValueType() == MVT::i8) { + BuildMI(BB, X86::MOV8rr, 1, Result).addReg(Tmp1); + return Result; + } static const unsigned Opc[3] = { X86::MOVZX32rr8, X86::MOVZX32rr16, X86::MOVZX16rr8 }; - Tmp1 = SelectExpr(N.getOperand(0)); BuildMI(BB, Opc[SrcIs16+DestIs16*2], 1, Result).addReg(Tmp1); return Result; } @@ -759,6 +768,10 @@ int DestIs16 = N.getValueType() == MVT::i16; int SrcIs16 = N.getOperand(0).getValueType() == MVT::i16; + // FIXME: Legalize should promote bools to i8! + assert(N.getOperand(0).getValueType() != MVT::i1 && + "Sign extend from bool not implemented!"); + static const unsigned Opc[3] = { X86::MOVSX32rr8, X86::MOVSX32rr16, X86::MOVSX16rr8 }; @@ -792,6 +805,7 @@ // then reading it back into a register. // Create as stack slot to use. + // FIXME: This should automatically be made by the Legalizer! Tmp1 = TLI.getTargetData().getFloatAlignment(); Tmp2 = BB->getParent()->getFrameInfo()->CreateStackObject(4, Tmp1); @@ -803,6 +817,209 @@ addFrameReference(BuildMI(BB, X86::FLD32m, 5, Result), Tmp2); ContainsFPCode = true; return Result; + + case ISD::SINT_TO_FP: + case ISD::UINT_TO_FP: { + // FIXME: Most of this grunt work should be done by legalize! + + // Promote the integer to a type supported by FLD. We do this because there + // are no unsigned FLD instructions, so we must promote an unsigned value to + // a larger signed value, then use FLD on the larger value. + // + MVT::ValueType PromoteType = MVT::Other; + MVT::ValueType SrcTy = N.getOperand(0).getValueType(); + unsigned PromoteOpcode = 0; + unsigned RealDestReg = Result; + switch (SrcTy) { + case MVT::i1: + case MVT::i8: + // We don't have the facilities for directly loading byte sized data from + // memory (even signed). Promote it to 16 bits. + PromoteType = MVT::i16; + PromoteOpcode = Node->getOpcode() == ISD::SINT_TO_FP ? + X86::MOVSX16rr8 : X86::MOVZX16rr8; + break; + case MVT::i16: + if (Node->getOpcode() == ISD::UINT_TO_FP) { + PromoteType = MVT::i32; + PromoteOpcode = X86::MOVZX32rr16; + } + break; + default: + // Don't fild into the real destination. + if (Node->getOpcode() == ISD::UINT_TO_FP) + Result = MakeReg(Node->getValueType(0)); + break; + } + + Tmp1 = SelectExpr(N.getOperand(0)); // Get the operand register + + if (PromoteType != MVT::Other) { + Tmp2 = MakeReg(PromoteType); + BuildMI(BB, PromoteOpcode, 1, Tmp2).addReg(Tmp1); + SrcTy = PromoteType; + Tmp1 = Tmp2; + } + + // Spill the integer to memory and reload it from there. + unsigned Size = MVT::getSizeInBits(SrcTy)/8; + MachineFunction *F = BB->getParent(); + int FrameIdx = F->getFrameInfo()->CreateStackObject(Size, Size); + + switch (SrcTy) { + case MVT::i64: + // FIXME: this won't work for cast [u]long to FP + addFrameReference(BuildMI(BB, X86::MOV32mr, 5), + FrameIdx).addReg(Tmp1); + addFrameReference(BuildMI(BB, X86::MOV32mr, 5), + FrameIdx, 4).addReg(Tmp1+1); + addFrameReference(BuildMI(BB, X86::FILD64m, 5, Result), FrameIdx); + break; + case MVT::i32: + addFrameReference(BuildMI(BB, X86::MOV32mr, 5), + FrameIdx).addReg(Tmp1); + addFrameReference(BuildMI(BB, X86::FILD32m, 5, Result), FrameIdx); + break; + case MVT::i16: + addFrameReference(BuildMI(BB, X86::MOV16mr, 5), + FrameIdx).addReg(Tmp1); + addFrameReference(BuildMI(BB, X86::FILD16m, 5, Result), FrameIdx); + break; + default: break; // No promotion required. + } + + if (Node->getOpcode() == ISD::UINT_TO_FP && SrcTy == MVT::i32) { + // If this is a cast from uint -> double, we need to be careful when if + // the "sign" bit is set. If so, we don't want to make a negative number, + // we want to make a positive number. Emit code to add an offset if the + // sign bit is set. + + // Compute whether the sign bit is set by shifting the reg right 31 bits. + unsigned IsNeg = MakeReg(MVT::i32); + BuildMI(BB, X86::SHR32ri, 2, IsNeg).addReg(Tmp1).addImm(31); + + // Create a CP value that has the offset in one word and 0 in the other. + static ConstantInt *TheOffset = ConstantUInt::get(Type::ULongTy, + 0x4f80000000000000ULL); + unsigned CPI = F->getConstantPool()->getConstantPoolIndex(TheOffset); + BuildMI(BB, X86::FADD32m, 5, RealDestReg).addReg(Result) + .addConstantPoolIndex(CPI).addZImm(4).addReg(IsNeg).addSImm(0); + + } else if (Node->getOpcode() == ISD::UINT_TO_FP && SrcTy == MVT::i64) { + // We need special handling for unsigned 64-bit integer sources. If the + // input number has the "sign bit" set, then we loaded it incorrectly as a + // negative 64-bit number. In this case, add an offset value. + + // Emit a test instruction to see if the dynamic input value was signed. + BuildMI(BB, X86::TEST32rr, 2).addReg(Tmp1+1).addReg(Tmp1+1); + + // If the sign bit is set, get a pointer to an offset, otherwise get a + // pointer to a zero. + MachineConstantPool *CP = F->getConstantPool(); + unsigned Zero = MakeReg(MVT::i32); + Constant *Null = Constant::getNullValue(Type::UIntTy); + addConstantPoolReference(BuildMI(BB, X86::LEA32r, 5, Zero), + CP->getConstantPoolIndex(Null)); + unsigned Offset = MakeReg(MVT::i32); + Constant *OffsetCst = ConstantUInt::get(Type::UIntTy, 0x5f800000); + + addConstantPoolReference(BuildMI(BB, X86::LEA32r, 5, Offset), + CP->getConstantPoolIndex(OffsetCst)); + unsigned Addr = MakeReg(MVT::i32); + BuildMI(BB, X86::CMOVS32rr, 2, Addr).addReg(Zero).addReg(Offset); + + // Load the constant for an add. FIXME: this could make an 'fadd' that + // reads directly from memory, but we don't support these yet. + unsigned ConstReg = MakeReg(MVT::f64); + addDirectMem(BuildMI(BB, X86::FLD32m, 4, ConstReg), Addr); + + BuildMI(BB, X86::FpADD, 2, RealDestReg).addReg(ConstReg).addReg(Result); + } + return RealDestReg; + } + case ISD::FP_TO_SINT: + case ISD::FP_TO_UINT: { + // FIXME: Most of this grunt work should be done by legalize! + Tmp1 = SelectExpr(N.getOperand(0)); // Get the operand register + + // Change the floating point control register to use "round towards zero" + // mode when truncating to an integer value. + // + MachineFunction *F = BB->getParent(); + int CWFrameIdx = F->getFrameInfo()->CreateStackObject(2, 2); + addFrameReference(BuildMI(BB, X86::FNSTCW16m, 4), CWFrameIdx); + + // Load the old value of the high byte of the control word... + unsigned HighPartOfCW = MakeReg(MVT::i8); + addFrameReference(BuildMI(BB, X86::MOV8rm, 4, HighPartOfCW), + CWFrameIdx, 1); + + // Set the high part to be round to zero... + addFrameReference(BuildMI(BB, X86::MOV8mi, 5), + CWFrameIdx, 1).addImm(12); + + // Reload the modified control word now... + addFrameReference(BuildMI(BB, X86::FLDCW16m, 4), CWFrameIdx); + + // Restore the memory image of control word to original value + addFrameReference(BuildMI(BB, X86::MOV8mr, 5), + CWFrameIdx, 1).addReg(HighPartOfCW); + + // We don't have the facilities for directly storing byte sized data to + // memory. Promote it to 16 bits. We also must promote unsigned values to + // larger classes because we only have signed FP stores. + MVT::ValueType StoreClass = Node->getValueType(0); + if (StoreClass == MVT::i8 || Node->getOpcode() == ISD::FP_TO_UINT) + switch (StoreClass) { + case MVT::i8: StoreClass = MVT::i16; break; + case MVT::i16: StoreClass = MVT::i32; break; + case MVT::i32: StoreClass = MVT::i64; break; + // The following treatment of cLong may not be perfectly right, + // but it survives chains of casts of the form + // double->ulong->double. + case MVT::i64: StoreClass = MVT::i64; break; + default: assert(0 && "Unknown store class!"); + } + + // Spill the integer to memory and reload it from there. + unsigned Size = MVT::getSizeInBits(StoreClass)/8; + int FrameIdx = F->getFrameInfo()->CreateStackObject(Size, Size); + + switch (StoreClass) { + default: assert(0 && "Unknown store class!"); + case MVT::i16: + addFrameReference(BuildMI(BB, X86::FIST16m, 5), FrameIdx).addReg(Tmp1); + break; + case MVT::i32: + addFrameReference(BuildMI(BB, X86::FIST16m, 5), FrameIdx).addReg(Tmp1); + break; + case MVT::i64: + addFrameReference(BuildMI(BB, X86::FIST16m, 5), FrameIdx).addReg(Tmp1); + break; + } + + switch (Node->getValueType(0)) { + default: + assert(0 && "Unknown integer type!"); + case MVT::i64: + // FIXME: this isn't gunna work. + addFrameReference(BuildMI(BB, X86::MOV32rm, 4, Result), FrameIdx); + addFrameReference(BuildMI(BB, X86::MOV32rm, 4, Result+1), FrameIdx, 4); + case MVT::i32: + addFrameReference(BuildMI(BB, X86::MOV32rm, 4, Result), FrameIdx); + break; + case MVT::i16: + addFrameReference(BuildMI(BB, X86::MOV16rm, 4, Result), FrameIdx); + break; + case MVT::i8: + addFrameReference(BuildMI(BB, X86::MOV8rm, 4, Result), FrameIdx); + break; + } + + // Reload the original control word now. + addFrameReference(BuildMI(BB, X86::FLDCW16m, 4), CWFrameIdx); + return Result; + } case ISD::ADD: // See if we can codegen this as an LEA to fold operations together. if (N.getValueType() == MVT::i32) { From lattner at cs.uiuc.edu Sun Jan 9 13:04:08 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 9 Jan 2005 13:04:08 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200501091904.j09J48Kf019435@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.15 -> 1.16 --- Log message: Teach legalize to deal with DYNAMIC_STACKALLOC (aka a dynamic llvm alloca) --- Diffs of the changes: (+16 -1) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.15 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.16 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.15 Sat Jan 8 14:35:13 2005 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Sun Jan 9 13:03:49 2005 @@ -229,7 +229,7 @@ if (I != LegalizedNodes.end()) return I->second; } - SDOperand Tmp1, Tmp2; + SDOperand Tmp1, Tmp2, Tmp3; SDOperand Result = Op; SDNode *Node = Op.Val; @@ -307,6 +307,21 @@ Result = DAG.getNode(Node->getOpcode(), MVT::Other, Tmp1, Node->getOperand(1)); break; + case ISD::DYNAMIC_STACKALLOC: + Tmp1 = LegalizeOp(Node->getOperand(0)); // Legalize the chain. + Tmp2 = LegalizeOp(Node->getOperand(1)); // Legalize the size. + Tmp3 = LegalizeOp(Node->getOperand(2)); // Legalize the alignment. + if (Tmp1 != Node->getOperand(0) || Tmp2 != Node->getOperand(1) || + Tmp3 != Node->getOperand(2)) + Result = DAG.getNode(ISD::DYNAMIC_STACKALLOC, Node->getValueType(0), + Tmp1, Tmp2, Tmp3); + + // Since this op produces two values, make sure to remember that we + // legalized both of them. + AddLegalizedOperand(SDOperand(Node, 0), Result); + AddLegalizedOperand(SDOperand(Node, 1), Result.getValue(1)); + return Result.getValue(Op.ResNo); + case ISD::CALL: Tmp1 = LegalizeOp(Node->getOperand(0)); // Legalize the chain. Tmp2 = LegalizeOp(Node->getOperand(1)); // Legalize the callee. From lattner at cs.uiuc.edu Sun Jan 9 13:08:10 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 9 Jan 2005 13:08:10 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200501091908.j09J8AJM019936@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.16 -> 1.17 --- Log message: Fix a minor bug legalizing dynamic_stackalloc. This allows us to compile std::__pad >::_S_pad(std::ios_base&, wchar_t, wchar_t*, wchar_t const*, int, int, bool) from libstdc++ --- Diffs of the changes: (+2 -0) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.16 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.17 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.16 Sun Jan 9 13:03:49 2005 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Sun Jan 9 13:07:54 2005 @@ -315,6 +315,8 @@ Tmp3 != Node->getOperand(2)) Result = DAG.getNode(ISD::DYNAMIC_STACKALLOC, Node->getValueType(0), Tmp1, Tmp2, Tmp3); + else + Result = Op.getValue(0); // Since this op produces two values, make sure to remember that we // legalized both of them. From lattner at cs.uiuc.edu Sun Jan 9 13:43:38 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 9 Jan 2005 13:43:38 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200501091943.j09JhceL020894@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.17 -> 1.18 --- Log message: Fix a bug legalizing call instructions (make sure to remember all result values), and eliminate some switch statements. --- Diffs of the changes: (+11 -17) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.17 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.18 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.17 Sun Jan 9 13:07:54 2005 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Sun Jan 9 13:43:23 2005 @@ -332,9 +332,15 @@ RetTyVTs.reserve(Node->getNumValues()); for (unsigned i = 0, e = Node->getNumValues(); i != e; ++i) RetTyVTs.push_back(Node->getValueType(i)); - Result = SDOperand(DAG.getCall(RetTyVTs, Tmp1, Tmp2), Op.ResNo); - } - break; + Result = SDOperand(DAG.getCall(RetTyVTs, Tmp1, Tmp2), 0); + } else { + Result = Result.getValue(0); + } + // Since calls produce multiple values, make sure to remember that we + // legalized all of them. + for (unsigned i = 0, e = Node->getNumValues(); i != e; ++i) + AddLegalizedOperand(SDOperand(Node, i), Result.getValue(i)); + return Result.getValue(Op.ResNo); case ISD::BR: Tmp1 = LegalizeOp(Node->getOperand(0)); // Legalize the chain. @@ -499,13 +505,7 @@ // FIXME: These two stores are independent of each other! Result = DAG.getNode(ISD::STORE, MVT::Other, Tmp1, Lo, Tmp2); - unsigned IncrementSize; - switch (Lo.getValueType()) { - default: assert(0 && "Unknown ValueType to expand to!"); - case MVT::i32: IncrementSize = 4; break; - case MVT::i16: IncrementSize = 2; break; - case MVT::i8: IncrementSize = 1; break; - } + unsigned IncrementSize = MVT::getSizeInBits(Lo.getValueType())/8; Tmp2 = DAG.getNode(ISD::ADD, Tmp2.getValueType(), Tmp2, getIntPtrConstant(IncrementSize)); assert(isTypeLegal(Tmp2.getValueType()) && @@ -701,13 +701,7 @@ Lo = DAG.getLoad(NVT, Ch, Ptr); // Increment the pointer to the other half. - unsigned IncrementSize; - switch (Lo.getValueType()) { - default: assert(0 && "Unknown ValueType to expand to!"); - case MVT::i32: IncrementSize = 4; break; - case MVT::i16: IncrementSize = 2; break; - case MVT::i8: IncrementSize = 1; break; - } + unsigned IncrementSize = MVT::getSizeInBits(Lo.getValueType())/8; Ptr = DAG.getNode(ISD::ADD, Ptr.getValueType(), Ptr, getIntPtrConstant(IncrementSize)); // FIXME: This load is independent of the first one. From lattner at cs.uiuc.edu Sun Jan 9 13:50:12 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 9 Jan 2005 13:50:12 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelPattern.cpp Message-ID: <200501091950.j09JoCog021717@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelPattern.cpp updated: 1.18 -> 1.19 --- Log message: Fix copy and pasto's for FP -> Int. This fixes fldry --- Diffs of the changes: (+2 -2) Index: llvm/lib/Target/X86/X86ISelPattern.cpp diff -u llvm/lib/Target/X86/X86ISelPattern.cpp:1.18 llvm/lib/Target/X86/X86ISelPattern.cpp:1.19 --- llvm/lib/Target/X86/X86ISelPattern.cpp:1.18 Sun Jan 9 12:52:44 2005 +++ llvm/lib/Target/X86/X86ISelPattern.cpp Sun Jan 9 13:49:59 2005 @@ -991,10 +991,10 @@ addFrameReference(BuildMI(BB, X86::FIST16m, 5), FrameIdx).addReg(Tmp1); break; case MVT::i32: - addFrameReference(BuildMI(BB, X86::FIST16m, 5), FrameIdx).addReg(Tmp1); + addFrameReference(BuildMI(BB, X86::FIST32m, 5), FrameIdx).addReg(Tmp1); break; case MVT::i64: - addFrameReference(BuildMI(BB, X86::FIST16m, 5), FrameIdx).addReg(Tmp1); + addFrameReference(BuildMI(BB, X86::FISTP64m, 5), FrameIdx).addReg(Tmp1); break; } From lattner at cs.uiuc.edu Sun Jan 9 14:10:11 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 9 Jan 2005 14:10:11 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200501092010.j09KABqv022606@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.15 -> 1.16 --- Log message: Add a simple transformation. This allows us to compile one of the inner loops in stepanov to this: .LBB_Z5test0PdS__2: # no_exit.1 fldl data(,%eax,8) fldl 24(%esp) faddp %st(1) fstl 24(%esp) incl %eax cmpl $2000, %eax fstpl 16(%esp) #FP_REG_KILL jl .LBB_Z5test0PdS__2 instead of this: .LBB_Z5test0PdS__2: # no_exit.1 fldl data(,%eax,8) fldl 24(%esp) faddp %st(1) fstl 24(%esp) incl %eax movl $data, %ecx movl %ecx, %edx addl $16000, %edx subl %ecx, %edx movl %edx, %ecx sarl $2, %ecx shrl $29, %ecx addl %ecx, %edx sarl $3, %edx cmpl %edx, %eax fstpl 16(%esp) #FP_REG_KILL jl .LBB_Z5test0PdS__2 The old instruction selector produced: .LBB_Z5test0PdS__2: # no_exit.1 fldl 24(%esp) faddl data(,%eax,8) fstl 24(%esp) movl %eax, %ecx incl %ecx incl %eax leal data+16000, %edx movl $data, %edi subl %edi, %edx movl %edx, %edi sarl $2, %edi shrl $29, %edi addl %edi, %edx sarl $3, %edx cmpl %edx, %ecx fstpl 16(%esp) #FP_REG_KILL jl .LBB_Z5test0PdS__2 # no_exit.1 Which is even worse! --- Diffs of the changes: (+8 -0) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.15 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.16 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.15 Sat Jan 8 02:08:56 2005 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sun Jan 9 14:09:57 2005 @@ -662,6 +662,14 @@ case ISD::XOR: if (N1 == N2) return getConstant(0, VT); // xor X, Y -> 0 break; + case ISD::SUB: + if (N1.getOpcode() == ISD::ADD) { + if (N1.Val->getOperand(0) == N2) + return N1.Val->getOperand(1); // (A+B)-A == B + if (N1.Val->getOperand(1) == N2) + return N1.Val->getOperand(0); // (A+B)-B == A + } + break; } SDNode *&N = BinaryOps[std::make_pair(Opcode, std::make_pair(N1, N2))]; From lattner at cs.uiuc.edu Sun Jan 9 14:20:44 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 9 Jan 2005 14:20:44 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelPattern.cpp Message-ID: <200501092020.j09KKij1022972@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelPattern.cpp updated: 1.19 -> 1.20 --- Log message: Codegen (Reg|imm)+&GV as an LEA, because we cannot put it into the immediate field of an ADDri (due to current restrictions on MachineOperand :( ). This allows us to generate: leal Data+16000, %edx instead of: movl $Data, %edx addl $16000, %edx --- Diffs of the changes: (+2 -2) Index: llvm/lib/Target/X86/X86ISelPattern.cpp diff -u llvm/lib/Target/X86/X86ISelPattern.cpp:1.19 llvm/lib/Target/X86/X86ISelPattern.cpp:1.20 --- llvm/lib/Target/X86/X86ISelPattern.cpp:1.19 Sun Jan 9 13:49:59 2005 +++ llvm/lib/Target/X86/X86ISelPattern.cpp Sun Jan 9 14:20:29 2005 @@ -1027,11 +1027,11 @@ if (!SelectAddress(N.getOperand(0), AM) && !SelectAddress(N.getOperand(1), AM)) { // If this is not just an add, emit the LEA. For a simple add (like - // reg+reg or reg+imm), we just emit an add. If might be a good idea to + // reg+reg or reg+imm), we just emit an add. It might be a good idea to // leave this as LEA, then peephole it to 'ADD' after two address elim // happens. if (AM.Scale != 1 || AM.BaseType == X86AddressMode::FrameIndexBase || - AM.Base.Reg && AM.IndexReg && (AM.Disp || AM.GV)) { + AM.GV || (AM.Base.Reg && AM.IndexReg && AM.Disp)) { addFullAddress(BuildMI(BB, X86::LEA32r, 4, Result), AM); return Result; } From lattner at cs.uiuc.edu Sun Jan 9 14:26:50 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 9 Jan 2005 14:26:50 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200501092026.j09KQo8q023305@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.16 -> 1.17 --- Log message: Print out nodes sorted by their address to make it easier to find them in a list. --- Diffs of the changes: (+5 -2) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.16 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.17 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.16 Sun Jan 9 14:09:57 2005 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sun Jan 9 14:26:36 2005 @@ -922,9 +922,12 @@ void SelectionDAG::dump() const { std::cerr << "SelectionDAG has " << AllNodes.size() << " nodes:"; - for (unsigned i = 0, e = AllNodes.size(); i != e; ++i) { + std::vector Nodes(AllNodes); + std::sort(Nodes.begin(), Nodes.end()); + + for (unsigned i = 0, e = Nodes.size(); i != e; ++i) { std::cerr << "\n "; - AllNodes[i]->dump(); + Nodes[i]->dump(); } std::cerr << "\n\n"; } From lattner at cs.uiuc.edu Sun Jan 9 14:38:47 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 9 Jan 2005 14:38:47 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200501092038.j09Kclwt024453@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.17 -> 1.18 --- Log message: Print the DAG out more like a DAG in nested format. --- Diffs of the changes: (+18 -2) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.17 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.18 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.17 Sun Jan 9 14:26:36 2005 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sun Jan 9 14:38:33 2005 @@ -920,15 +920,31 @@ } +static void DumpNodes(SDNode *N, unsigned indent) { + for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i) + if (N->getOperand(i).Val->hasOneUse()) + DumpNodes(N->getOperand(i).Val, indent+2); + else + std::cerr << "\n" << std::string(indent+2, ' ') + << (void*)N->getOperand(i).Val << ": "; + + + std::cerr << "\n" << std::string(indent, ' '); + N->dump(); +} + void SelectionDAG::dump() const { std::cerr << "SelectionDAG has " << AllNodes.size() << " nodes:"; std::vector Nodes(AllNodes); std::sort(Nodes.begin(), Nodes.end()); for (unsigned i = 0, e = Nodes.size(); i != e; ++i) { - std::cerr << "\n "; - Nodes[i]->dump(); + if (!Nodes[i]->hasOneUse() && Nodes[i] != getRoot().Val) + DumpNodes(Nodes[i], 2); } + + DumpNodes(getRoot().Val, 2); + std::cerr << "\n\n"; } From jeffc at jolt-lang.org Sun Jan 9 14:42:07 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Sun, 9 Jan 2005 14:42:07 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200501092042.OAA05196@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.18 -> 1.19 --- Log message: Fix VC++ compilation error --- Diffs of the changes: (+1 -0) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.18 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.19 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.18 Sun Jan 9 14:38:33 2005 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sun Jan 9 14:41:56 2005 @@ -19,6 +19,7 @@ #include #include #include +#include using namespace llvm; /// getSetCCSwappedOperands - Return the operation corresponding to (Y op X) From jeffc at jolt-lang.org Sun Jan 9 14:43:04 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Sun, 9 Jan 2005 14:43:04 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructureAA.cpp DataStructureOpt.cpp Parallelize.cpp Steensgaard.cpp Message-ID: <200501092043.OAA05223@zion.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructureAA.cpp updated: 1.21 -> 1.22 DataStructureOpt.cpp updated: 1.8 -> 1.9 Parallelize.cpp updated: 1.18 -> 1.19 Steensgaard.cpp updated: 1.43 -> 1.44 --- Log message: Add last four createXxxPass functions --- Diffs of the changes: (+12 -0) Index: llvm/lib/Analysis/DataStructure/DataStructureAA.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructureAA.cpp:1.21 llvm/lib/Analysis/DataStructure/DataStructureAA.cpp:1.22 --- llvm/lib/Analysis/DataStructure/DataStructureAA.cpp:1.21 Tue Dec 7 02:11:24 2004 +++ llvm/lib/Analysis/DataStructure/DataStructureAA.cpp Sun Jan 9 14:42:52 2005 @@ -14,6 +14,7 @@ #include "llvm/Module.h" #include "llvm/Analysis/AliasAnalysis.h" +#include "llvm/Analysis/Passes.h" #include "llvm/Analysis/DataStructure/DataStructure.h" #include "llvm/Analysis/DataStructure/DSGraph.h" using namespace llvm; @@ -71,6 +72,8 @@ RegisterAnalysisGroup Y; } +ModulePass *llvm::createDSAAPass() { return new DSAA(); } + // getGraphForValue - Return the DSGraph to use for queries about the specified // value... // Index: llvm/lib/Analysis/DataStructure/DataStructureOpt.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructureOpt.cpp:1.8 llvm/lib/Analysis/DataStructure/DataStructureOpt.cpp:1.9 --- llvm/lib/Analysis/DataStructure/DataStructureOpt.cpp:1.8 Sun Sep 19 23:45:25 2004 +++ llvm/lib/Analysis/DataStructure/DataStructureOpt.cpp Sun Jan 9 14:42:52 2005 @@ -14,6 +14,7 @@ #include "llvm/Analysis/DataStructure/DataStructure.h" #include "llvm/Analysis/DataStructure/DSGraph.h" +#include "llvm/Analysis/Passes.h" #include "llvm/Module.h" #include "llvm/Constant.h" #include "llvm/ADT/Statistic.h" @@ -48,6 +49,8 @@ RegisterOpt X("ds-opt", "DSA-based simple optimizations"); } +ModulePass *llvm::createDSOptPass() { return new DSOpt(); } + /// OptimizeGlobals - This method uses information taken from DSA to optimize /// global variables. /// Index: llvm/lib/Analysis/DataStructure/Parallelize.cpp diff -u llvm/lib/Analysis/DataStructure/Parallelize.cpp:1.18 llvm/lib/Analysis/DataStructure/Parallelize.cpp:1.19 --- llvm/lib/Analysis/DataStructure/Parallelize.cpp:1.18 Sun Sep 19 23:45:25 2004 +++ llvm/lib/Analysis/DataStructure/Parallelize.cpp Sun Jan 9 14:42:52 2005 @@ -42,6 +42,7 @@ #include "llvm/Instructions.h" #include "llvm/Module.h" #include "PgmDependenceGraph.h" +#include "llvm/Analysis/Passes.h" #include "llvm/Analysis/DataStructure/DataStructure.h" #include "llvm/Analysis/DataStructure/DSGraph.h" #include "llvm/Support/InstVisitor.h" @@ -408,6 +409,8 @@ RegisterOpt X("parallel", "Parallelize program using Cilk"); } +ModulePass *llvm::createParallelizePass() { return new Parallelize(); } + bool Parallelize::runOnModule(Module& M) { hash_set parallelFunctions; Index: llvm/lib/Analysis/DataStructure/Steensgaard.cpp diff -u llvm/lib/Analysis/DataStructure/Steensgaard.cpp:1.43 llvm/lib/Analysis/DataStructure/Steensgaard.cpp:1.44 --- llvm/lib/Analysis/DataStructure/Steensgaard.cpp:1.43 Sun Sep 19 23:45:25 2004 +++ llvm/lib/Analysis/DataStructure/Steensgaard.cpp Sun Jan 9 14:42:52 2005 @@ -17,6 +17,7 @@ #include "llvm/Analysis/DataStructure/DataStructure.h" #include "llvm/Analysis/DataStructure/DSGraph.h" #include "llvm/Analysis/AliasAnalysis.h" +#include "llvm/Analysis/Passes.h" #include "llvm/Module.h" #include "llvm/Support/Debug.h" using namespace llvm; @@ -76,6 +77,8 @@ RegisterAnalysisGroup Y; } +ModulePass *llvm::createSteensgaardPass() { return new Steens(); } + /// ResolveFunctionCall - Resolve the actual arguments of a call to function F /// with the specified call site descriptor. This function links the arguments /// and the return value for the call site context-insensitively. From jeffc at jolt-lang.org Sun Jan 9 14:43:04 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Sun, 9 Jan 2005 14:43:04 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/Passes.h Message-ID: <200501092043.OAA05226@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: Passes.h updated: 1.2 -> 1.3 --- Log message: Add last four createXxxPass functions --- Diffs of the changes: (+28 -0) Index: llvm/include/llvm/Analysis/Passes.h diff -u llvm/include/llvm/Analysis/Passes.h:1.2 llvm/include/llvm/Analysis/Passes.h:1.3 --- llvm/include/llvm/Analysis/Passes.h:1.2 Sat Jan 8 16:01:16 2005 +++ llvm/include/llvm/Analysis/Passes.h Sun Jan 9 14:42:52 2005 @@ -80,6 +80,34 @@ // createNoProfileInfoPass - This pass implements the default "no profile". // ImmutablePass *createNoProfileInfoPass(); + + //===--------------------------------------------------------------------===// + // + // createDSAAPass - This pass implements simple context sensitive alias + // analysis. + // + ModulePass *createDSAAPass(); + + //===--------------------------------------------------------------------===// + // + // createDSOptPass - This pass uses DSA to do a series of simple + // optimizations. + // + ModulePass *createDSOptPass(); + + //===--------------------------------------------------------------------===// + // + // createParallelizePass - This pass parallelizes a program using the cilk + // multi-threaded runtime system. + // + ModulePass *createParallelizePass(); + + //===--------------------------------------------------------------------===// + // + // createSteensgaardPass - This pass uses the data structure graphs to do a + // simple context insensitive alias analysis. + // + ModulePass *createSteensgaardPass(); } #endif From jeffc at jolt-lang.org Sun Jan 9 14:43:04 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Sun, 9 Jan 2005 14:43:04 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Transforms/LinkAllPasses.h Message-ID: <200501092043.OAA05229@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Transforms: LinkAllPasses.h updated: 1.12 -> 1.13 --- Log message: Add last four createXxxPass functions --- Diffs of the changes: (+4 -0) Index: llvm/include/llvm/Transforms/LinkAllPasses.h diff -u llvm/include/llvm/Transforms/LinkAllPasses.h:1.12 llvm/include/llvm/Transforms/LinkAllPasses.h:1.13 --- llvm/include/llvm/Transforms/LinkAllPasses.h:1.12 Sat Jan 8 16:01:16 2005 +++ llvm/include/llvm/Transforms/LinkAllPasses.h Sun Jan 9 14:42:52 2005 @@ -56,6 +56,8 @@ (void) llvm::createConstantMergePass(); (void) llvm::createConstantPropagationPass(); (void) llvm::createCorrelatedExpressionEliminationPass(); + (void) llvm::createDSAAPass(); + (void) llvm::createDSOptPass(); (void) llvm::createDeadArgEliminationPass(); (void) llvm::createDeadCodeEliminationPass(); (void) llvm::createDeadInstEliminationPass(); @@ -95,6 +97,7 @@ (void) llvm::createNoAAPass(); (void) llvm::createNoProfileInfoPass(); (void) llvm::createPREPass(); + (void) llvm::createParallelizePass(); (void) llvm::createProfilePathsPass(); (void) llvm::createPromoteMemoryToRegister(); (void) llvm::createPruneEHPass(); @@ -104,6 +107,7 @@ (void) llvm::createSCCPPass(); (void) llvm::createScalarReplAggregatesPass(); (void) llvm::createSingleLoopExtractorPass(); + (void) llvm::createSteensgaardPass(); (void) llvm::createStripSymbolsPass(); (void) llvm::createTailCallEliminationPass(); (void) llvm::createTailDuplicationPass(); From lattner at cs.uiuc.edu Sun Jan 9 14:53:06 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 9 Jan 2005 14:53:06 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200501092053.j09Kr62a024893@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.19 -> 1.20 --- Log message: Add some folds for == and != comparisons. This allows us to codegen this loop in stepanov: no_exit.i: ; preds = %entry, %no_exit.i, %then.i, %_Z5checkd.exit %i.0.0 = phi int [ 0, %entry ], [ %i.0.0, %no_exit.i ], [ %inc.0, %_Z5checkd.exit ], [ %inc.012, %then.i ] ; [#uses=3] %indvar = phi uint [ %indvar.next, %no_exit.i ], [ 0, %entry ], [ 0, %then.i ], [ 0, %_Z5checkd.exit ] ; [#uses=3] %result_addr.i.0 = phi double [ %tmp.4.i.i, %no_exit.i ], [ 0.000000e+00, %entry ], [ 0.000000e+00, %then.i ], [ 0.000000e+00, %_Z5checkd.exit ] ; [#uses=1] %first_addr.0.i.2.rec = cast uint %indvar to int ; [#uses=1] %first_addr.0.i.2 = getelementptr [2000 x double]* %data, int 0, uint %indvar ; [#uses=1] %inc.i.rec = add int %first_addr.0.i.2.rec, 1 ; [#uses=1] %inc.i = getelementptr [2000 x double]* %data, int 0, int %inc.i.rec ; [#uses=1] %tmp.3.i.i = load double* %first_addr.0.i.2 ; [#uses=1] %tmp.4.i.i = add double %result_addr.i.0, %tmp.3.i.i ; [#uses=2] %tmp.2.i = seteq double* %inc.i, getelementptr ([2000 x double]* %data, int 0, int 2000) ; [#uses=1] %indvar.next = add uint %indvar, 1 ; [#uses=1] br bool %tmp.2.i, label %_Z10accumulateIPddET0_T_S2_S1_.exit, label %no_exit.i To this: .LBB_Z4testIPddEvT_S1_T0__1: # no_exit.i fldl data(,%eax,8) fldl 16(%esp) faddp %st(1) fstpl 16(%esp) incl %eax movl %eax, %ecx shll $3, %ecx cmpl $16000, %ecx #FP_REG_KILL jne .LBB_Z4testIPddEvT_S1_T0__1 # no_exit.i instead of this: .LBB_Z4testIPddEvT_S1_T0__1: # no_exit.i fldl data(,%eax,8) fldl 16(%esp) faddp %st(1) fstpl 16(%esp) incl %eax leal data(,%eax,8), %ecx leal data+16000, %edx cmpl %edx, %ecx #FP_REG_KILL jne .LBB_Z4testIPddEvT_S1_T0__1 # no_exit.i --- Diffs of the changes: (+58 -41) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.19 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.20 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.19 Sun Jan 9 14:41:56 2005 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sun Jan 9 14:52:51 2005 @@ -22,6 +22,47 @@ #include using namespace llvm; +static bool isCommutativeBinOp(unsigned Opcode) { + switch (Opcode) { + case ISD::ADD: + case ISD::MUL: + case ISD::AND: + case ISD::OR: + case ISD::XOR: return true; + default: return false; // FIXME: Need commutative info for user ops! + } +} + +static bool isAssociativeBinOp(unsigned Opcode) { + switch (Opcode) { + case ISD::ADD: + case ISD::MUL: + case ISD::AND: + case ISD::OR: + case ISD::XOR: return true; + default: return false; // FIXME: Need associative info for user ops! + } +} + +static unsigned ExactLog2(uint64_t Val) { + unsigned Count = 0; + while (Val != 1) { + Val >>= 1; + ++Count; + } + return Count; +} + +// isInvertibleForFree - Return true if there is no cost to emitting the logical +// inverse of this node. +static bool isInvertibleForFree(SDOperand N) { + if (isa(N.Val)) return true; + if (isa(N.Val) && N.Val->hasOneUse()) + return true; + return false; +} + + /// getSetCCSwappedOperands - Return the operation corresponding to (Y op X) /// when given the operation for (X op Y). ISD::CondCode ISD::getSetCCSwappedOperands(ISD::CondCode Operation) { @@ -357,6 +398,23 @@ Cond = UOF == 0 ? ISD::SETUO : ISD::SETO; } + // Simplify (X+Y) == (X+Z) --> Y == Z + if ((Cond == ISD::SETEQ || Cond == ISD::SETNE) && + N1.getOpcode() == N2.getOpcode() && MVT::isInteger(N1.getValueType())) + if (N1.getOpcode() == ISD::ADD || N1.getOpcode() == ISD::SUB) { + if (N1.getOperand(0) == N2.getOperand(0)) + return getSetCC(Cond, N1.getOperand(1), N2.getOperand(1)); + if (N1.getOperand(1) == N2.getOperand(1)) + return getSetCC(Cond, N1.getOperand(0), N2.getOperand(0)); + if (isCommutativeBinOp(N1.getOpcode())) { + // If X op Y == Y op X, try other combinations. + if (N1.getOperand(0) == N2.getOperand(1)) + return getSetCC(Cond, N1.getOperand(1), N2.getOperand(0)); + if (N1.getOperand(1) == N2.getOperand(0)) + return getSetCC(Cond, N1.getOperand(1), N2.getOperand(1)); + } + } + SetCCSDNode *&N = SetCCs[std::make_pair(std::make_pair(N1, N2), Cond)]; if (N) return SDOperand(N, 0); @@ -449,47 +507,6 @@ return SDOperand(N, 0); } -static bool isCommutativeBinOp(unsigned Opcode) { - switch (Opcode) { - case ISD::ADD: - case ISD::MUL: - case ISD::AND: - case ISD::OR: - case ISD::XOR: return true; - default: return false; // FIXME: Need commutative info for user ops! - } -} - -static bool isAssociativeBinOp(unsigned Opcode) { - switch (Opcode) { - case ISD::ADD: - case ISD::MUL: - case ISD::AND: - case ISD::OR: - case ISD::XOR: return true; - default: return false; // FIXME: Need associative info for user ops! - } -} - -static unsigned ExactLog2(uint64_t Val) { - unsigned Count = 0; - while (Val != 1) { - Val >>= 1; - ++Count; - } - return Count; -} - -// isInvertibleForFree - Return true if there is no cost to emitting the logical -// inverse of this node. -static bool isInvertibleForFree(SDOperand N) { - if (isa(N.Val)) return true; - if (isa(N.Val) && N.Val->hasOneUse()) - return true; - return false; -} - - SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT, SDOperand N1, SDOperand N2) { ConstantSDNode *N1C = dyn_cast(N1.Val); From reid at x10sys.com Sun Jan 9 17:29:11 2005 From: reid at x10sys.com (Reid Spencer) Date: Sun, 9 Jan 2005 17:29:11 -0600 Subject: [llvm-commits] CVS: llvm/lib/System/DynamicLibrary.cpp MappedFile.cpp Memory.cpp Path.cpp Process.cpp Program.cpp Signals.cpp TimeValue.cpp Message-ID: <200501092329.RAA06248@zion.cs.uiuc.edu> Changes in directory llvm/lib/System: DynamicLibrary.cpp updated: 1.9 -> 1.10 MappedFile.cpp updated: 1.2 -> 1.3 Memory.cpp updated: 1.2 -> 1.3 Path.cpp updated: 1.14 -> 1.15 Process.cpp updated: 1.2 -> 1.3 Program.cpp updated: 1.2 -> 1.3 Signals.cpp updated: 1.2 -> 1.3 TimeValue.cpp updated: 1.3 -> 1.4 --- Log message: Rename Unix/*.cpp and Win32/*.cpp to have a *.inc suffix so that the silly gdb debugger doesn't get confused on which file it is reading (the one in lib/System or the one in lib/System/{Win32,Unix}) --- Diffs of the changes: (+15 -15) Index: llvm/lib/System/DynamicLibrary.cpp diff -u llvm/lib/System/DynamicLibrary.cpp:1.9 llvm/lib/System/DynamicLibrary.cpp:1.10 --- llvm/lib/System/DynamicLibrary.cpp:1.9 Sun Jan 2 03:45:04 2005 +++ llvm/lib/System/DynamicLibrary.cpp Sun Jan 9 17:29:00 2005 @@ -22,7 +22,7 @@ #ifdef LLVM_ON_WIN32 -#include "Win32/DynamicLibrary.cpp" +#include "Win32/DynamicLibrary.inc" #else Index: llvm/lib/System/MappedFile.cpp diff -u llvm/lib/System/MappedFile.cpp:1.2 llvm/lib/System/MappedFile.cpp:1.3 --- llvm/lib/System/MappedFile.cpp:1.2 Mon Dec 27 00:15:43 2004 +++ llvm/lib/System/MappedFile.cpp Sun Jan 9 17:29:00 2005 @@ -26,10 +26,10 @@ // Include the platform-specific parts of this class. #ifdef LLVM_ON_UNIX -#include "Unix/MappedFile.cpp" +#include "Unix/MappedFile.inc" #endif #ifdef LLVM_ON_WIN32 -#include "Win32/MappedFile.cpp" +#include "Win32/MappedFile.inc" #endif // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab Index: llvm/lib/System/Memory.cpp diff -u llvm/lib/System/Memory.cpp:1.2 llvm/lib/System/Memory.cpp:1.3 --- llvm/lib/System/Memory.cpp:1.2 Mon Dec 27 00:15:57 2004 +++ llvm/lib/System/Memory.cpp Sun Jan 9 17:29:00 2005 @@ -27,10 +27,10 @@ // Include the platform-specific parts of this class. #ifdef LLVM_ON_UNIX -#include "Unix/Memory.cpp" +#include "Unix/Memory.inc" #endif #ifdef LLVM_ON_WIN32 -#include "Win32/Memory.cpp" +#include "Win32/Memory.inc" #endif // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab Index: llvm/lib/System/Path.cpp diff -u llvm/lib/System/Path.cpp:1.14 llvm/lib/System/Path.cpp:1.15 --- llvm/lib/System/Path.cpp:1.14 Fri Dec 24 00:29:17 2004 +++ llvm/lib/System/Path.cpp Sun Jan 9 17:29:00 2005 @@ -101,10 +101,10 @@ // Include the truly platform-specific parts of this class. #if defined(LLVM_ON_UNIX) -#include "Unix/Path.cpp" +#include "Unix/Path.inc" #endif #if defined(LLVM_ON_WIN32) -#include "Win32/Path.cpp" +#include "Win32/Path.inc" #endif // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab Index: llvm/lib/System/Process.cpp diff -u llvm/lib/System/Process.cpp:1.2 llvm/lib/System/Process.cpp:1.3 --- llvm/lib/System/Process.cpp:1.2 Mon Dec 27 00:15:29 2004 +++ llvm/lib/System/Process.cpp Sun Jan 9 17:29:00 2005 @@ -26,10 +26,10 @@ // Include the platform-specific parts of this class. #ifdef LLVM_ON_UNIX -#include "Unix/Process.cpp" +#include "Unix/Process.inc" #endif #ifdef LLVM_ON_WIN32 -#include "Win32/Process.cpp" +#include "Win32/Process.inc" #endif // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab Index: llvm/lib/System/Program.cpp diff -u llvm/lib/System/Program.cpp:1.2 llvm/lib/System/Program.cpp:1.3 --- llvm/lib/System/Program.cpp:1.2 Mon Dec 27 00:16:24 2004 +++ llvm/lib/System/Program.cpp Sun Jan 9 17:29:00 2005 @@ -26,10 +26,10 @@ // Include the platform-specific parts of this class. #ifdef LLVM_ON_UNIX -#include "Unix/Program.cpp" +#include "Unix/Program.inc" #endif #ifdef LLVM_ON_WIN32 -#include "Win32/Program.cpp" +#include "Win32/Program.inc" #endif // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab Index: llvm/lib/System/Signals.cpp diff -u llvm/lib/System/Signals.cpp:1.2 llvm/lib/System/Signals.cpp:1.3 --- llvm/lib/System/Signals.cpp:1.2 Mon Dec 27 00:16:10 2004 +++ llvm/lib/System/Signals.cpp Sun Jan 9 17:29:00 2005 @@ -27,10 +27,10 @@ // Include the platform-specific parts of this class. #ifdef LLVM_ON_UNIX -#include "Unix/Signals.cpp" +#include "Unix/Signals.inc" #endif #ifdef LLVM_ON_WIN32 -#include "Win32/Signals.cpp" +#include "Win32/Signals.inc" #endif // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab Index: llvm/lib/System/TimeValue.cpp diff -u llvm/lib/System/TimeValue.cpp:1.3 llvm/lib/System/TimeValue.cpp:1.4 --- llvm/lib/System/TimeValue.cpp:1.3 Mon Dec 27 00:16:38 2004 +++ llvm/lib/System/TimeValue.cpp Sun Jan 9 17:29:00 2005 @@ -50,10 +50,10 @@ /// Include the platform specific portion of TimeValue class #ifdef LLVM_ON_UNIX -#include "Unix/TimeValue.cpp" +#include "Unix/TimeValue.inc" #endif #ifdef LLVM_ON_WIN32 -#include "Win32/TimeValue.cpp" +#include "Win32/TimeValue.inc" #endif // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab From llvm at cs.uiuc.edu Sun Jan 9 17:29:17 2005 From: llvm at cs.uiuc.edu (LLVM) Date: Sun, 9 Jan 2005 17:29:17 -0600 Subject: [llvm-commits] CVS: llvm/lib/System/Unix/MappedFile.cpp Memory.cpp Path.cpp Process.cpp Program.cpp Signals.cpp TimeValue.cpp Message-ID: <200501092329.RAA06262@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Unix: MappedFile.cpp (r1.9) removed Memory.cpp (r1.2) removed Path.cpp (r1.29) removed Process.cpp (r1.9) removed Program.cpp (r1.10) removed Signals.cpp (r1.5) removed TimeValue.cpp (r1.6) removed --- Log message: Rename Unix/*.cpp and Win32/*.cpp to have a *.inc suffix so that the silly gdb debugger doesn't get confused on which file it is reading (the one in lib/System or the one in lib/System/{Win32,Unix}) --- Diffs of the changes: (+0 -0) From llvm at cs.uiuc.edu Sun Jan 9 17:29:18 2005 From: llvm at cs.uiuc.edu (LLVM) Date: Sun, 9 Jan 2005 17:29:18 -0600 Subject: [llvm-commits] CVS: llvm/lib/System/Win32/DynamicLibrary.cpp MappedFile.cpp Memory.cpp Path.cpp Process.cpp Program.cpp Signals.cpp TimeValue.cpp Message-ID: <200501092329.RAA06266@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Win32: DynamicLibrary.cpp (r1.9) removed MappedFile.cpp (r1.5) removed Memory.cpp (r1.4) removed Path.cpp (r1.27) removed Process.cpp (r1.8) removed Program.cpp (r1.9) removed Signals.cpp (r1.12) removed TimeValue.cpp (r1.7) removed --- Log message: Rename Unix/*.cpp and Win32/*.cpp to have a *.inc suffix so that the silly gdb debugger doesn't get confused on which file it is reading (the one in lib/System or the one in lib/System/{Win32,Unix}) --- Diffs of the changes: (+0 -0) From lattner at cs.uiuc.edu Sun Jan 9 18:07:30 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 9 Jan 2005 18:07:30 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200501100007.j0A07UUY026347@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.20 -> 1.21 --- Log message: Constant fold shifts, turning this loop: .LBB_Z5test0PdS__3: # no_exit.1 fldl data(,%eax,8) fldl 24(%esp) faddp %st(1) fstl 24(%esp) incl %eax movl $16000, %ecx sarl $3, %ecx cmpl %eax, %ecx fstpl 16(%esp) #FP_REG_KILL jg .LBB_Z5test0PdS__3 # no_exit.1 into: .LBB_Z5test0PdS__3: # no_exit.1 fldl data(,%eax,8) fldl 24(%esp) faddp %st(1) fstl 24(%esp) incl %eax cmpl $2000, %eax fstpl 16(%esp) #FP_REG_KILL jl .LBB_Z5test0PdS__3 # no_exit.1 --- Diffs of the changes: (+3 -0) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.20 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.21 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.20 Sun Jan 9 14:52:51 2005 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sun Jan 9 18:07:15 2005 @@ -535,6 +535,9 @@ case ISD::AND : return getConstant(C1 & C2, VT); case ISD::OR : return getConstant(C1 | C2, VT); case ISD::XOR : return getConstant(C1 ^ C2, VT); + case ISD::SHL : return getConstant(C1 << (int)C2, VT); + case ISD::SRL : return getConstant(C1 >> (unsigned)C2, VT); + case ISD::SRA : return getConstant(N1C->getSignExtended() >>(int)C2, VT); default: break; } From jeffc at jolt-lang.org Sun Jan 9 18:50:24 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Sun, 9 Jan 2005 18:50:24 -0600 Subject: [llvm-commits] CVS: llvm/win32/System/System.vcproj Message-ID: <200501100050.SAA06755@zion.cs.uiuc.edu> Changes in directory llvm/win32/System: System.vcproj updated: 1.12 -> 1.13 --- Log message: Update System project in Visual Studio to reflect renamed files. --- Diffs of the changes: (+22 -134) Index: llvm/win32/System/System.vcproj diff -u llvm/win32/System/System.vcproj:1.12 llvm/win32/System/System.vcproj:1.13 --- llvm/win32/System/System.vcproj:1.12 Mon Dec 27 10:49:34 2004 +++ llvm/win32/System/System.vcproj Sun Jan 9 18:50:11 2005 @@ -165,140 +165,28 @@ Name="Win32" Filter=""> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + RelativePath="..\..\lib\System\Win32\DynamicLibrary.inc"> + + + + + + + + + + + + + + From lattner at cs.uiuc.edu Sun Jan 9 19:16:18 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 9 Jan 2005 19:16:18 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200501100116.j0A1GICk028589@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.21 -> 1.22 --- Log message: Fix incorrect constant folds, fixing Stepanov after the SHR patch. --- Diffs of the changes: (+4 -4) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.21 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.22 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.21 Sun Jan 9 18:07:15 2005 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sun Jan 9 19:16:03 2005 @@ -354,10 +354,10 @@ case ISD::SETUGT: return getConstant(C1 > C2, MVT::i1); case ISD::SETULE: return getConstant(C1 <= C2, MVT::i1); case ISD::SETUGE: return getConstant(C1 >= C2, MVT::i1); - case ISD::SETLT: return getConstant((int64_t)C1 < (int64_t)C2, MVT::i1); - case ISD::SETGT: return getConstant((int64_t)C1 < (int64_t)C2, MVT::i1); - case ISD::SETLE: return getConstant((int64_t)C1 < (int64_t)C2, MVT::i1); - case ISD::SETGE: return getConstant((int64_t)C1 < (int64_t)C2, MVT::i1); + case ISD::SETLT: return getConstant((int64_t)C1 < (int64_t)C2, MVT::i1); + case ISD::SETGT: return getConstant((int64_t)C1 > (int64_t)C2, MVT::i1); + case ISD::SETLE: return getConstant((int64_t)C1 <= (int64_t)C2, MVT::i1); + case ISD::SETGE: return getConstant((int64_t)C1 >= (int64_t)C2, MVT::i1); } } else { // Ensure that the constant occurs on the RHS. From lattner at cs.uiuc.edu Sun Jan 9 20:03:17 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 9 Jan 2005 20:03:17 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200501100203.j0A23Huu030381@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.22 -> 1.23 --- Log message: Implement a couple of more simplifications. This lets us codegen: int test2(int * P, int* Q, int A, int B) { return P+A == P; } into: test2: movl 4(%esp), %eax movl 12(%esp), %eax shll $2, %eax cmpl $0, %eax sete %al movzbl %al, %eax ret instead of: test2: movl 4(%esp), %eax movl 12(%esp), %ecx leal (%eax,%ecx,4), %ecx cmpl %eax, %ecx sete %al movzbl %al, %eax ret ICC is producing worse code: test2: movl 4(%esp), %eax #8.5 movl 12(%esp), %edx #8.5 lea (%edx,%edx), %ecx #9.9 addl %ecx, %ecx #9.9 addl %eax, %ecx #9.9 cmpl %eax, %ecx #9.16 movl $0, %eax #9.16 sete %al #9.16 ret #9.16 as is GCC (looks like our old code): test2: movl 4(%esp), %edx movl 12(%esp), %eax leal (%edx,%eax,4), %ecx cmpl %edx, %ecx sete %al movzbl %al, %eax ret --- Diffs of the changes: (+43 -12) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.22 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.23 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.22 Sun Jan 9 19:16:03 2005 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sun Jan 9 20:03:02 2005 @@ -398,23 +398,54 @@ Cond = UOF == 0 ? ISD::SETUO : ISD::SETO; } - // Simplify (X+Y) == (X+Z) --> Y == Z if ((Cond == ISD::SETEQ || Cond == ISD::SETNE) && - N1.getOpcode() == N2.getOpcode() && MVT::isInteger(N1.getValueType())) - if (N1.getOpcode() == ISD::ADD || N1.getOpcode() == ISD::SUB) { - if (N1.getOperand(0) == N2.getOperand(0)) - return getSetCC(Cond, N1.getOperand(1), N2.getOperand(1)); - if (N1.getOperand(1) == N2.getOperand(1)) - return getSetCC(Cond, N1.getOperand(0), N2.getOperand(0)); - if (isCommutativeBinOp(N1.getOpcode())) { - // If X op Y == Y op X, try other combinations. - if (N1.getOperand(0) == N2.getOperand(1)) - return getSetCC(Cond, N1.getOperand(1), N2.getOperand(0)); - if (N1.getOperand(1) == N2.getOperand(0)) + MVT::isInteger(N1.getValueType())) { + if (N1.getOpcode() == ISD::ADD || N1.getOpcode() == ISD::SUB || + N1.getOpcode() == ISD::XOR) { + // Simplify (X+Y) == (X+Z) --> Y == Z + if (N1.getOpcode() == N2.getOpcode()) { + if (N1.getOperand(0) == N2.getOperand(0)) return getSetCC(Cond, N1.getOperand(1), N2.getOperand(1)); + if (N1.getOperand(1) == N2.getOperand(1)) + return getSetCC(Cond, N1.getOperand(0), N2.getOperand(0)); + if (isCommutativeBinOp(N1.getOpcode())) { + // If X op Y == Y op X, try other combinations. + if (N1.getOperand(0) == N2.getOperand(1)) + return getSetCC(Cond, N1.getOperand(1), N2.getOperand(0)); + if (N1.getOperand(1) == N2.getOperand(0)) + return getSetCC(Cond, N1.getOperand(1), N2.getOperand(1)); + } + } + + // Simplify (X+Z) == X --> Z == 0 + if (N1.getOperand(0) == N2) + return getSetCC(Cond, N1.getOperand(1), + getConstant(0, N1.getValueType())); + if (N1.getOperand(1) == N2) { + if (isCommutativeBinOp(N1.getOpcode())) + return getSetCC(Cond, N1.getOperand(0), + getConstant(0, N1.getValueType())); + else { + assert(N1.getOpcode() == ISD::SUB && "Unexpected operation!"); + // (Z-X) == X --> Z == X<<1 + return getSetCC(Cond, N1.getOperand(0), + getNode(ISD::SHL, N2.getValueType(), + N2, getConstant(1, MVT::i8))); + } } } + if (N2.getOpcode() == ISD::ADD || N2.getOpcode() == ISD::SUB || + N2.getOpcode() == ISD::XOR) { + // Simplify X == (X+Z) --> Z == 0 + if (N2.getOperand(0) == N1) + return getSetCC(Cond, N2.getOperand(1), + getConstant(0, N2.getValueType())); + else if (N2.getOperand(1) == N1) + return getSetCC(Cond, N2.getOperand(0), + getConstant(0, N2.getValueType())); + } + } SetCCSDNode *&N = SetCCs[std::make_pair(std::make_pair(N1, N2), Cond)]; if (N) return SDOperand(N, 0); From jeffc at jolt-lang.org Sun Jan 9 21:56:38 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Sun, 9 Jan 2005 21:56:38 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Transforms/LinkAllPasses.h Message-ID: <200501100356.VAA08032@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Transforms: LinkAllPasses.h updated: 1.13 -> 1.14 --- Log message: Apply feed back from Chris: 1. Rename createLoaderPass to CreateProfileLoaderPass 2. Opt shouldn't use the pass registered in CodeGen. --- Diffs of the changes: (+1 -2) Index: llvm/include/llvm/Transforms/LinkAllPasses.h diff -u llvm/include/llvm/Transforms/LinkAllPasses.h:1.13 llvm/include/llvm/Transforms/LinkAllPasses.h:1.14 --- llvm/include/llvm/Transforms/LinkAllPasses.h:1.13 Sun Jan 9 14:42:52 2005 +++ llvm/include/llvm/Transforms/LinkAllPasses.h Sun Jan 9 21:56:27 2005 @@ -79,7 +79,6 @@ (void) llvm::createInternalizePass(); (void) llvm::createLICMPass(); (void) llvm::createLoadValueNumberingPass(); - (void) llvm::createLoaderPass(); (void) llvm::createLoopExtractorPass(); (void) llvm::createLoopInstrumentationPass(); (void) llvm::createLoopSimplifyPass(); @@ -98,6 +97,7 @@ (void) llvm::createNoProfileInfoPass(); (void) llvm::createPREPass(); (void) llvm::createParallelizePass(); + (void) llvm::createProfileLoaderPass(); (void) llvm::createProfilePathsPass(); (void) llvm::createPromoteMemoryToRegister(); (void) llvm::createPruneEHPass(); @@ -115,7 +115,6 @@ (void) llvm::createTraceValuesPassForBasicBlocks(); (void) llvm::createTraceValuesPassForFunction(); (void) llvm::createUnifyFunctionExitNodesPass(); - (void) llvm::createUnreachableBlockEliminationPass(); } } _ForcePassLinking; }; From jeffc at jolt-lang.org Sun Jan 9 21:56:38 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Sun, 9 Jan 2005 21:56:38 -0600 Subject: [llvm-commits] CVS: llvm/win32/llvm.sln Message-ID: <200501100356.VAA08023@zion.cs.uiuc.edu> Changes in directory llvm/win32: llvm.sln updated: 1.16 -> 1.17 --- Log message: Apply feed back from Chris: 1. Rename createLoaderPass to CreateProfileLoaderPass 2. Opt shouldn't use the pass registered in CodeGen. --- Diffs of the changes: (+0 -1) Index: llvm/win32/llvm.sln diff -u llvm/win32/llvm.sln:1.16 llvm/win32/llvm.sln:1.17 --- llvm/win32/llvm.sln:1.16 Sat Jan 8 12:15:23 2005 +++ llvm/win32/llvm.sln Sun Jan 9 21:56:27 2005 @@ -170,7 +170,6 @@ {19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E} {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D61} = {F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D61} {059FBAB8-C76D-48A0-AA75-3C57BD3EAFE4} = {059FBAB8-C76D-48A0-AA75-3C57BD3EAFE4} - {08CEB1BB-C2A4-4587-B9A9-AEDB8FB44897} = {08CEB1BB-C2A4-4587-B9A9-AEDB8FB44897} {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} From jeffc at jolt-lang.org Sun Jan 9 21:56:38 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Sun, 9 Jan 2005 21:56:38 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/Passes.h Message-ID: <200501100356.VAA08024@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: Passes.h updated: 1.3 -> 1.4 --- Log message: Apply feed back from Chris: 1. Rename createLoaderPass to CreateProfileLoaderPass 2. Opt shouldn't use the pass registered in CodeGen. --- Diffs of the changes: (+3 -2) Index: llvm/include/llvm/Analysis/Passes.h diff -u llvm/include/llvm/Analysis/Passes.h:1.3 llvm/include/llvm/Analysis/Passes.h:1.4 --- llvm/include/llvm/Analysis/Passes.h:1.3 Sun Jan 9 14:42:52 2005 +++ llvm/include/llvm/Analysis/Passes.h Sun Jan 9 21:56:27 2005 @@ -71,9 +71,10 @@ //===--------------------------------------------------------------------===// // - // createLoaderPass - This pass loads information from a profile dump file. + // createProfileLoaderPass - This pass loads information from a profile dump + // file. // - ModulePass *createLoaderPass(); + ModulePass *createProfileLoaderPass(); //===--------------------------------------------------------------------===// // From jeffc at jolt-lang.org Sun Jan 9 21:56:38 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Sun, 9 Jan 2005 21:56:38 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/ProfileInfoLoaderPass.cpp Message-ID: <200501100356.VAA08027@zion.cs.uiuc.edu> Changes in directory llvm/lib/Analysis: ProfileInfoLoaderPass.cpp updated: 1.9 -> 1.10 --- Log message: Apply feed back from Chris: 1. Rename createLoaderPass to CreateProfileLoaderPass 2. Opt shouldn't use the pass registered in CodeGen. --- Diffs of the changes: (+1 -1) Index: llvm/lib/Analysis/ProfileInfoLoaderPass.cpp diff -u llvm/lib/Analysis/ProfileInfoLoaderPass.cpp:1.9 llvm/lib/Analysis/ProfileInfoLoaderPass.cpp:1.10 --- llvm/lib/Analysis/ProfileInfoLoaderPass.cpp:1.9 Sat Jan 8 16:01:16 2005 +++ llvm/lib/Analysis/ProfileInfoLoaderPass.cpp Sun Jan 9 21:56:27 2005 @@ -55,7 +55,7 @@ RegisterAnalysisGroup Y; } // End of anonymous namespace -ModulePass *llvm::createLoaderPass() { return new LoaderPass(); } +ModulePass *llvm::createProfileLoaderPass() { return new LoaderPass(); } /// createProfileLoaderPass - This function returns a Pass that loads the /// profiling information for the module from the specified filename, making it From jeffc at jolt-lang.org Sun Jan 9 22:23:43 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Sun, 9 Jan 2005 22:23:43 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Transforms/IPO.h Message-ID: <200501100423.WAA08304@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Transforms: IPO.h updated: 1.40 -> 1.41 --- Log message: Apply feedback from Chris. --- Diffs of the changes: (+3 -2) Index: llvm/include/llvm/Transforms/IPO.h diff -u llvm/include/llvm/Transforms/IPO.h:1.40 llvm/include/llvm/Transforms/IPO.h:1.41 --- llvm/include/llvm/Transforms/IPO.h:1.40 Sat Jan 8 11:21:39 2005 +++ llvm/include/llvm/Transforms/IPO.h Sun Jan 9 22:23:32 2005 @@ -19,6 +19,7 @@ namespace llvm { +class FunctionPass; class ModulePass; class Function; class BasicBlock; @@ -150,12 +151,12 @@ /// createLoopExtractorPass - This pass extracts all natural loops from the /// program into a function if it can. /// -ModulePass *createLoopExtractorPass(); +FunctionPass *createLoopExtractorPass(); /// createSingleLoopExtractorPass - This pass extracts one natural loop from the /// program into a function if it can. This is used by bugpoint. /// -ModulePass *createSingleLoopExtractorPass(); +FunctionPass *createSingleLoopExtractorPass(); // createBlockExtractorPass - This pass extracts all blocks (except those // specified in the argument list) from the functions in the module. From jeffc at jolt-lang.org Sun Jan 9 22:23:42 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Sun, 9 Jan 2005 22:23:42 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/LoopExtractor.cpp Message-ID: <200501100423.WAA08301@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: LoopExtractor.cpp updated: 1.16 -> 1.17 --- Log message: Apply feedback from Chris. --- Diffs of the changes: (+2 -2) Index: llvm/lib/Transforms/IPO/LoopExtractor.cpp diff -u llvm/lib/Transforms/IPO/LoopExtractor.cpp:1.16 llvm/lib/Transforms/IPO/LoopExtractor.cpp:1.17 --- llvm/lib/Transforms/IPO/LoopExtractor.cpp:1.16 Sat Jan 8 11:21:39 2005 +++ llvm/lib/Transforms/IPO/LoopExtractor.cpp Sun Jan 9 22:23:32 2005 @@ -61,7 +61,7 @@ // createLoopExtractorPass - This pass extracts all natural loops from the // program into a function if it can. // -ModulePass *llvm::createLoopExtractorPass() { return new LoopExtractor(); } +FunctionPass *llvm::createLoopExtractorPass() { return new LoopExtractor(); } bool LoopExtractor::runOnFunction(Function &F) { LoopInfo &LI = getAnalysis(); @@ -131,7 +131,7 @@ // createSingleLoopExtractorPass - This pass extracts one natural loop from the // program into a function if it can. This is used by bugpoint. // -ModulePass *llvm::createSingleLoopExtractorPass() { +FunctionPass *llvm::createSingleLoopExtractorPass() { return new SingleLoopExtractor(); }