From d000e1dc2f08892aaa8c1bfd96f85f24b9d66cbb Mon Sep 17 00:00:00 2001 From: John Criswell Date: Thu, 18 Dec 2003 16:43:17 +0000 Subject: [PATCH] Merged in RELEASE_11. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10516 91177308-0d34-0410-b5e6-96231b3b80d8 --- autoconf/configure.ac | 2 +- configure | 18 +-- docs/CFEBuildInstrs.html | 61 ++++++++++- docs/GettingStarted.html | 109 ++++++++++++++----- docs/ReleaseNotes.html | 86 +++++++++++---- docs/Stacker.html | 133 ++++++++++++----------- lib/Transforms/Scalar/IndVarSimplify.cpp | 23 ++-- runtime/GCCLibraries/crtend/listend.ll | 3 - 8 files changed, 290 insertions(+), 145 deletions(-) diff --git a/autoconf/configure.ac b/autoconf/configure.ac index 6534ae7c0d4..a5f85b4835d 100644 --- a/autoconf/configure.ac +++ b/autoconf/configure.ac @@ -15,7 +15,7 @@ dnl AC_OUTPUT dnl ************************************************************************** dnl * Initialize dnl ************************************************************************** -AC_INIT([[[LLVM]]],[[[1.0]]],[llvmbugs@cs.uiuc.edu]) +AC_INIT([[[LLVM]]],[[[1.1]]],[llvmbugs@cs.uiuc.edu]) dnl Place all of the extra autoconf files into the config subdirectory AC_CONFIG_AUX_DIR([autoconf]) diff --git a/configure b/configure index 6322b518cbe..a03da77961d 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.57 for [LLVM] [1.0]. +# Generated by GNU Autoconf 2.57 for [LLVM] [1.1]. # # Report bugs to . # @@ -422,8 +422,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='[LLVM]' PACKAGE_TARNAME='--llvm--' -PACKAGE_VERSION='[1.0]' -PACKAGE_STRING='[LLVM] [1.0]' +PACKAGE_VERSION='[1.1]' +PACKAGE_STRING='[LLVM] [1.1]' PACKAGE_BUGREPORT='llvmbugs@cs.uiuc.edu' ac_subdirs_all="$ac_subdirs_all projects/${i}" @@ -954,7 +954,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures [LLVM] [1.0] to adapt to many kinds of systems. +\`configure' configures [LLVM] [1.1] to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1016,7 +1016,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of [LLVM] [1.0]:";; + short | recursive ) echo "Configuration of [LLVM] [1.1]:";; esac cat <<\_ACEOF @@ -1131,7 +1131,7 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -[LLVM] configure [1.0] +[LLVM] configure [1.1] generated by GNU Autoconf 2.57 Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 @@ -1146,7 +1146,7 @@ cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by [LLVM] $as_me [1.0], which was +It was created by [LLVM] $as_me [1.1], which was generated by GNU Autoconf 2.57. Invocation command line was $ $0 $@ @@ -23279,7 +23279,7 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by [LLVM] $as_me [1.0], which was +This file was extended by [LLVM] $as_me [1.1], which was generated by GNU Autoconf 2.57. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -23342,7 +23342,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -[LLVM] config.status [1.0] +[LLVM] config.status [1.1] configured by $0, generated by GNU Autoconf 2.57, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" diff --git a/docs/CFEBuildInstrs.html b/docs/CFEBuildInstrs.html index be844b9da89..d5d4eac0480 100644 --- a/docs/CFEBuildInstrs.html +++ b/docs/CFEBuildInstrs.html @@ -14,6 +14,7 @@
  1. A Cautionary Note
  2. Instructions +
  3. License Information
@@ -114,7 +115,23 @@ command line should like something like this: --enable-languages=c,c++ --host=sparcv9-sun-solaris2.8 % gmake all-gcc % setenv LLVM_LIB_SEARCH_PATH `pwd`/gcc - % gmake all; gmake install + % gmake all + + +

+At this point, libstdc++ may fail to build because of wchar errors (look for +errors that reference vfwscanf or wcstof). If that happens, +edit sparcv9-sun-solaris2.8/libstdc++-v3/config.h and comment out the +line that defines _GLIBCXX_USE_WCHAR_T. +

+ +

+Then, continue as below: +

+ +
+ % gmake all
+ % gmake install
 

Common Problem: You may get error messages regarding the fact @@ -196,6 +213,48 @@ following means:

+ + + +
+

+The LLVM GCC frontend is licensed to you under the GNU General Public License +and the GNU Lesser General Public License. Please see the files COPYING and +COPYING.LIB for more details. +

+ +

+The software also has the following additional copyrights: +

+ +
+Copyright (c) 1994
+Hewlett-Packard Company
+
+Permission to use, copy, modify, distribute and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and
+that both that copyright notice and this permission notice appear
+in supporting documentation.  Hewlett-Packard Company makes no
+representations about the suitability of this software for any
+purpose.  It is provided "as is" without express or implied warranty.
+
+Copyright (c) 1996, 1997, 1998, 1999
+Silicon Graphics Computer Systems, Inc.
+
+Permission to use, copy, modify, distribute and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and
+that both that copyright notice and this permission notice appear
+in supporting documentation.  Silicon Graphics makes no
+representations about the suitability of this software for any
+purpose.  It is provided "as is" without express or implied warranty.
+
+
+ +
diff --git a/docs/GettingStarted.html b/docs/GettingStarted.html index 82860967133..849aa973582 100644 --- a/docs/GettingStarted.html +++ b/docs/GettingStarted.html @@ -129,7 +129,8 @@ from the LLVM suite.

header files for the default platform. Useful options include: + + +

  • Solaris on SparcV9 (Ultrasparc)
      -
    • Approximately 1.24 GB of Free Disk Space +
    • Approximately 1.52 GB of Free Disk Space
        -
      • Source code: 30 MB
      • -
      • Object code: 1000 MB
      • -
      • GCC front end: 210 MB
      • +
      • Source code: 28 MB
      • +
      • Object code: 1470 MB
      • +
      • GCC front end: 50 MB
    • -
  • + + + +

    + +
  • FreeBSD on x86 (Pentium and above) +
      +
    • Approximately 918 MB of Free Disk Space +
        +
      • Source code: 28 MB
      • +
      • Object code: 850 MB
      • +
      • GCC front end: 40 MB
      • +
    • +
    +
  • + +

    + +
  • MacOS X on PowerPC +
      +
    • No native code generation +
    • Approximately 1.20 GB of Free Disk Space +
        +
      • Source code: 28 MB
      • +
      • Object code: 1160 MB
      • +
      • GCC front end: 40 MB
      • +
    • +
    +
  • The LLVM suite may compile on other platforms, but it is not @@ -252,7 +284,6 @@ LLVM:

    -

    The remainder of this guide is meant to get you up and running with LLVM and to give you some basic information about the LLVM environment. A complete guide to installation is provided in the @@ -347,22 +378,31 @@ You can set these on the command line, or better yet, set them in your

    If you have the LLVM distribution, you will need to unpack it before you -can begin to compile it. LLVM is distributed as a set of three files. Each +can begin to compile it. LLVM is distributed as a set of two files: the LLVM +suite and the LLVM GCC front end compiled for your platform. Each file is a TAR archive that is compressed with the gzip program.

    -

    The three files are as follows: +

    The files are as follows:

    -
    llvm.tar.gz +
    llvm-1.1.tar.gz
    This is the source code to the LLVM suite.

    -

    cfrontend.sparc.tar.gz +
    cfrontend-1.1.sparc-sun-solaris2.8.tar.gz
    This is the binary release of the GCC front end for Solaris/Sparc.

    -

    cfrontend.x86.tar.gz +
    cfrontend-1.1.i686-redhat-linux-gnu.tar.gz
    This is the binary release of the GCC front end for Linux/x86. +

    + +

    cfrontend-1.1.i386-unknown-freebsd5.1.tar.gz +
    This is the binary release of the GCC front end for FreeBSD/x86. +

    + +

    cfrontend-1.1.powerpc-apple-darwin7.0.0.tar.gz +
    This is the binary release of the GCC front end for MacOS X/PPC.
    @@ -390,6 +430,20 @@ follows:

    directory and fully populate it with the LLVM source code, Makefiles, test directories, and local copies of documentation files.

    +

    +If you want to get a specific release (as opposed to the most recent revision), +you can specify a label. The following releases have the following label: +

    +

    +

    Note that the GCC front end is not included in the CVS repository. You should have downloaded the binary distribution for your platform.

    @@ -411,12 +465,12 @@ location must be specified when the LLVM suite is configured.

    1. cd where-you-want-the-front-end-to-live
    2. -
    3. gunzip --stdout cfrontend.platform.tar.gz | tar -xvf +
    4. gunzip --stdout cfrontend-version.platform.tar.gz | tar -xvf -
    -

    If you are on a Sparc/Solaris machine, you will need to fix the header -files:

    +

    If you are using Solaris/Sparc or MacOS X/PPC, you will need to fix the +header files:

    cd cfrontend/sparc
    ./fixheaders

    @@ -442,7 +496,8 @@ not for the faint of heart, so be forewarned.

    Once checked out from the CVS repository, the LLVM suite source code must be configured via the configure script. This script sets variables in llvm/Makefile.config and llvm/include/Config/config.h. It -also populates OBJ_ROOT with the Makefiles needed to build LLVM.

    +also populates OBJ_ROOT with the Makefiles needed to begin building +LLVM.

    The following environment variables are used by the configure script to configure the build system:

    @@ -476,7 +531,8 @@ script to configure the build system:

    --with-llvmgccdir=LLVMGCCDIR
    Path to the location where the LLVM C front end binaries and - associated libraries will be installed. + associated libraries were installed. This must be specified as an + absolute pathname.

    --enable-optimized
    @@ -486,7 +542,8 @@ script to configure the build system:

    --enable-jit
    - Compile the Just In Time (JIT) functionality. This is not available + Compile the Just In Time (JIT) compiler functionality. This is not + available on all platforms. The default is dependent on platform, so it is best to explicitly enable it if you want it.

    @@ -519,10 +576,10 @@ script to configure the build system:

    LLVM_LIB_SEARCH_PATH environment variable in your startup scripts. This environment variable is used to locate "system" libraries like "-lc" and "-lm" when linking. This variable should be set to -the absolute path for the bytecode-libs subdirectory of the GCC front end -install, or LLVMGCCDIR/bytecode-libs. For example, one might set +the absolute path of the bytecode-libs subdirectory of the GCC front +end, or LLVMGCCDIR/bytecode-libs. For example, one might set LLVM_LIB_SEARCH_PATH to -/home/vadve/lattner/local/x86/llvm-gcc/bytecode-libs for the X86 +/home/vadve/lattner/local/x86/llvm-gcc/bytecode-libs for the x86 version of the GCC front end on our research machines.

    diff --git a/docs/ReleaseNotes.html b/docs/ReleaseNotes.html index a19c05f54ea..b5cd8f2f4a8 100644 --- a/docs/ReleaseNotes.html +++ b/docs/ReleaseNotes.html @@ -18,7 +18,6 @@
  • Installation Instructions
  • Known Problems
      -
    • Known problems with the LLVM Core
    • Known problems with the C Front-end
    • Known problems with the C++ Front-end @@ -30,7 +29,7 @@
      -

      Written by Chris Lattner

      +

      Written by the LLVM team

      @@ -43,10 +42,10 @@

      This document contains the release notes for the LLVM compiler infrastructure, release 1.2. Here we describe the status of LLVM, including any -known problems, and bug fixes from the previous release. The most up-to-date +known problems and bug fixes from the previous release. The most up-to-date version of this document can be found on the LLVM 1.2 web site. If you are -not reading this on the LLVM web pages, you should probably go there, because +not reading this on the LLVM web pages, you should probably go there because this document may be updated after the release.

      For more information about LLVM, including information about potentially more @@ -70,8 +69,7 @@ href="http://llvm.cs.uiuc.edu/releases/">releases page.

      -

      This is the third public release of the LLVM compiler infrastructure. OTHER -OVERVIEW STUFF HERE. +

      This is the third public release of the LLVM compiler infrastructure.

      At this time, LLVM is known to correctly compile and run all non-unwinding C @@ -82,10 +80,10 @@ received much less testing than the C front-end.

      -The LLVM native code generators are very stable, but do not currently support +The LLVM native code generators are very stable but do not currently support unwinding (exception throwing or longjmping), which prevent them from working with programs like the 253.perlbmk in SPEC CPU2000. The C -backend and the rest of LLVM does support these programs however, so you can +backend and the rest of LLVM supports these programs, so you can still use LLVM with them. Support for unwinding will be added in a future release.

      @@ -164,11 +162,11 @@ management functions in libc runtime to allow them to be overriden
    • LLVM has been extensively tested on Intel and AMD machines running Red Hat Linux and FreeBSD. It has also been tested on Sun UltraSPARC workstations running Solaris 8. Additionally, -LLVM works on Mac OS/X 10.3 and above, but only with the C backend or +LLVM works on Mac OS X 10.3 and above, but only with the C backend or interpreter (no native backend for the PowerPC is available yet). The core LLVM infrastructure uses "autoconf" for portability, so hopefully we work on more platforms than that. However, it is likely that we -missed something, and that minor porting is required to get LLVM to work on +missed something and that minor porting is required to get LLVM to work on new platforms. We welcome portability patches and error messages.

      @@ -184,7 +182,7 @@ new platforms. We welcome portability patches and error messages.

      This section contains all known problems with the LLVM system, listed by component. As new problems are discovered, they will be added to these sections. If you run into a problem, please check the LLVM bug database, and submit a bug if +href="http://llvm.cs.uiuc.edu/bugs/">LLVM bug database and submit a bug if there isn't already one.

      @@ -219,6 +217,18 @@ table in the archive).
    • LLVM cannot handle structures with more than 256 elements.
    • +
    • +The gccld program + +does not link objects/archives in the order specified on the command line. + +
    • + +
    • + +Tail duplication does not update SSA form correctly. + +
    @@ -232,9 +242,7 @@ more than 256 elements.
  • Bugs
    - -
    @@ -277,11 +304,11 @@ work: the following extensions are known to not be supported:
    1. Local Labels: Labels local to a block.
    2. -
    3. Labels as Values: Getting pointers to labels, and computed gotos.
    4. +
    5. Labels as Values: Getting pointers to labels and computed gotos.
    6. Nested Functions: As in Algol and Pascal, lexical scoping of functions.
    7. Constructing Calls: Dispatching a call to another function.
    8. Extended Asm: Assembler instructions with C expressions as operands.
    9. -
    10. Constraints: Constraints for asm operands
    11. +
    12. Constraints: Constraints for asm operands.
    13. Asm Labels: Specifying the assembler name to use for a C symbol.
    14. Explicit Reg Vars: Defining variables residing in specified registers.
    15. Return Address: Getting the return or frame address of a function.
    16. @@ -294,7 +321,7 @@ work:

      The following GCC extensions are partially supported. An ignored attribute means that the LLVM compiler ignores the presence of the attribute, but the code should still work. An unsupported attribute is one which is - ignored by the LLVM compiler, which will cause a different interpretation of + ignored by the LLVM compiler and will cause a different interpretation of the program.

        @@ -304,7 +331,7 @@ work:
      1. Function Attributes: - Declaring that functions have no side effects, or that they can never + Declaring that functions have no side effects or that they can never return.
        Supported: format, format_arg, non_null, @@ -363,7 +390,8 @@ work:
      2. Subscripting: Any array can be subscripted, even if not an lvalue.
      3. Pointer Arith: Arithmetic on void-pointers and function pointers.
      4. Initializers: Non-constant initializers.
      5. -
      6. Compound Literals: Compound literals give structures, unions or arrays as values.
      7. +
      8. Compound Literals: Compound literals give structures, unions, +or arrays as values.
      9. Designated Inits: Labeling elements of initializers.
      10. Cast to Union: Casting to union type from any member of the union.
      11. Case Ranges: `case 1 ... 9' and such.
      12. @@ -395,7 +423,7 @@ lists, please let us know (also including whether or not they work).

        -

        For this release, the C++ front-end is considered to be fully functional, but +

        For this release, the C++ front-end is considered to be fully functional but has not been tested as thoroughly as the C front-end. It has been tested and works for a number of non-trivial programs, but there may be lurking bugs. Please report any bugs or problems.

        @@ -411,9 +439,14 @@ Please report any bugs or problems.

        • The C++ front-end inherits all problems afflicting the C - front-end
        • -
        + front-end. +
      13. + +Code is generated for empty classes. + +
      14. +
        @@ -433,7 +466,7 @@ href="http://gcc.gnu.org/gcc-3.4/changes.html">GCC 3.4 release notes.
      15. Destructors for local objects are not always run when a longjmp is performed. In particular, destructors for objects in the longjmping function and in the setjmp receiver function may not be run. - Objects in intervening stack frames will be destroyed however (which is + Objects in intervening stack frames will be destroyed, however (which is better than most compilers).
      16. The LLVM C++ front-end follows the does not currently support the unwind instruction, so code that throws a C++ exception or calls the C longjmp function will abort.
      17. +
      18. + +The llc program can crash on legal code. + +
      19. @@ -522,7 +560,7 @@ frontends.

        A wide variety of additional information is available on the LLVM web page, -including mailing lists publications describing algorithms and components +including mailing lists and publications describing algorithms and components implemented in LLVM. The web page also contains versions of the API documentation which is up-to-date with the CVS version of the source code. You can access versions of these documents specific to this release by going into diff --git a/docs/Stacker.html b/docs/Stacker.html index df6aedfceab..835c8380b8b 100644 --- a/docs/Stacker.html +++ b/docs/Stacker.html @@ -61,7 +61,7 @@ about LLVM through the experience of creating a simple programming language named Stacker. Stacker was invented specifically as a demonstration of LLVM. The emphasis in this document is not on describing the -intricacies of LLVM itself, but on how to use it to build your own +intricacies of LLVM itself but on how to use it to build your own compiler system.

        @@ -77,11 +77,11 @@ language running when using LLVM. Furthermore, this was the first language the author ever created using LLVM. The learning curve is included in that four days.

        The language described here, Stacker, is Forth-like. Programs -are simple collections of word definitions and the only thing definitions +are simple collections of word definitions, and the only thing definitions can do is manipulate a stack or generate I/O. Stacker is not a "real" -programming language; its very simple. Although it is computationally +programming language; it's very simple. Although it is computationally complete, you wouldn't use it for your next big project. However, -the fact that it is complete, its simple, and it doesn't have +the fact that it is complete, it's simple, and it doesn't have a C-like syntax make it useful for demonstration purposes. It shows that LLVM could be applied to a wide variety of languages.

        The basic notions behind stacker is very simple. There's a stack of @@ -95,11 +95,11 @@ program in Stacker:

        : MAIN hello_world ;

        This has two "definitions" (Stacker manipulates words, not functions and words have definitions): MAIN and -hello_world. The MAIN definition is standard, it +hello_world. The MAIN definition is standard; it tells Stacker where to start. Here, MAIN is defined to simply invoke the word hello_world. The hello_world definition tells stacker to push the -"Hello, World!" string onto the stack, print it out +"Hello, World!" string on to the stack, print it out (>s), pop it off the stack (DROP), and finally print a carriage return (CR). Although hello_world uses the stack, its net effect is null. Well @@ -123,7 +123,7 @@ learned. Those lessons are described in the following subsections.

        Although I knew that LLVM uses a Single Static Assignment (SSA) format, it wasn't obvious to me how prevalent this idea was in LLVM until I really started using it. Reading the -Programmer's Manual and Language Reference +Programmer's Manual and Language Reference, I noted that most of the important LLVM IR (Intermediate Representation) C++ classes were derived from the Value class. The full power of that simple design only became fully understood once I started constructing executable @@ -201,7 +201,7 @@ should be constructed. In general, here's what I learned:

        1. Create your blocks early. While writing your compiler, you will encounter several situations where you know apriori that you will - need several blocks. For example, if-then-else, switch, while and for + need several blocks. For example, if-then-else, switch, while, and for statements in C/C++ all need multiple blocks for expression in LVVM. The rule is, create them early.
        2. Terminate your blocks early. This just reduces the chances @@ -262,7 +262,7 @@ MyCompiler::handle_if( BasicBlock* bb, SetCondInst* condition ) the instructions for the "then" and "else" parts. They would use the third part of the idiom almost exclusively (inserting new instructions before the terminator). Furthermore, they could even recurse back to handle_if -should they encounter another if/then/else statement and it will just work.

          +should they encounter another if/then/else statement, and it will just work.

          Note how cleanly this all works out. In particular, the push_back methods on the BasicBlock's instruction list. These are lists of type Instruction (which is also of type Value). To create @@ -271,7 +271,8 @@ arguments the blocks to branch to and the condition to branch on. The BasicBlock objects act like branch labels! This new BranchInst terminates the BasicBlock provided as an argument. To give the caller a way to keep inserting after calling -handle_if we create an exit_bb block which is returned +handle_if, we create an exit_bb block which is +returned to the caller. Note that the exit_bb block is used as the terminator for both the then_bb and the else_bb blocks. This guarantees that no matter what else handle_if @@ -286,7 +287,7 @@ One of the first things I noticed is the frequent use of the "push_back" method on the various lists. This is so common that it is worth mentioning. The "push_back" inserts a value into an STL list, vector, array, etc. at the end. The method might have also been named "insert_tail" or "append". -Althought I've used STL quite frequently, my use of push_back wasn't very +Although I've used STL quite frequently, my use of push_back wasn't very high in other programs. In LLVM, you'll use it all the time.

          @@ -295,17 +296,17 @@ high in other programs. In LLVM, you'll use it all the time.

          It took a little getting used to and several rounds of postings to the LLVM -mail list to wrap my head around this instruction correctly. Even though I had +mailing list to wrap my head around this instruction correctly. Even though I had read the Language Reference and Programmer's Manual a couple times each, I still missed a few very key points:

            -
          • GetElementPtrInst gives you back a Value for the last thing indexed +
          • GetElementPtrInst gives you back a Value for the last thing indexed.
          • All global variables in LLVM are pointers.
          • Pointers must also be dereferenced with the GetElementPtrInst instruction.

          This means that when you look up an element in the global variable (assuming -its a struct or array), you must deference the pointer first! For many +it's a struct or array), you must deference the pointer first! For many things, this leads to the idiom:

          
          @@ -322,13 +323,13 @@ will run against your grain because you'll naturally think of the global array
           variable and the address of its first element as the same. That tripped me up
           for a while until I realized that they really do differ .. by type.
           Remember that LLVM is strongly typed. Everything has a type.  
          -The "type" of the global variable is [24 x int]*. That is, its
          +The "type" of the global variable is [24 x int]*. That is, it's
           a pointer to an array of 24 ints.  When you dereference that global variable with
           a single (0) index, you now have a "[24 x int]" type.  Although
           the pointer value of the dereferenced global and the address of the zero'th element
           in the array will be the same, they differ in their type. The zero'th element has
           type "int" while the pointer value has type "[24 x int]".

          -

          Get this one aspect of LLVM right in your head and you'll save yourself +

          Get this one aspect of LLVM right in your head, and you'll save yourself a lot of compiler writing headaches down the road.

          @@ -337,7 +338,7 @@ a lot of compiler writing headaches down the road.

          Linkage types in LLVM can be a little confusing, especially if your compiler writing mind has affixed firm concepts to particular words like "weak", "external", "global", "linkonce", etc. LLVM does not use the precise -definitions of say ELF or GCC even though they share common terms. To be fair, +definitions of, say, ELF or GCC, even though they share common terms. To be fair, the concepts are related and similar but not precisely the same. This can lead you to think you know what a linkage type represents but in fact it is slightly different. I recommend you read the @@ -346,10 +347,10 @@ carefully. Then, read it again.

          Here are some handy tips that I discovered along the way:

          • Unitialized means external. That is, the symbol is declared in the current - module and can be used by that module but it is not defined by that module.
          • + module and can be used by that module, but it is not defined by that module.
          • Setting an initializer changes a global' linkage type. Setting an initializer changes a global's linkage type from whatever it was to a normal, - defind global (not external). You'll need to call the setLinkage() method to + defined global (not external). You'll need to call the setLinkage() method to reset it if you specify the initializer after the GlobalValue has been constructed. This is important for LinkOnce and Weak linkage types.
          • Appending linkage can keep track of things. Appending linkage can @@ -368,7 +369,7 @@ Constants in LLVM took a little getting used to until I discovered a few utility functions in the LLVM IR that make things easier. Here's what I learned:

            • Constants are Values like anything else and can be operands of instructions
            • -
            • Integer constants, frequently needed can be created using the static "get" +
            • Integer constants, frequently needed, can be created using the static "get" methods of the ConstantInt, ConstantSInt, and ConstantUInt classes. The nice thing about these is that you can "get" any kind of integer quickly.
            • There's a special method on Constant class which allows you to get the null @@ -385,14 +386,14 @@ functions in the LLVM IR that make things easier. Here's what I learned:

              proceeding, a few words about the stack are in order. The stack is simply a global array of 32-bit integers or pointers. A global index keeps track of the location of the top of the stack. All of this is hidden from the -programmer but it needs to be noted because it is the foundation of the +programmer, but it needs to be noted because it is the foundation of the conceptual programming model for Stacker. When you write a definition, you are, essentially, saying how you want that definition to manipulate the global stack.

              Manipulating the stack can be quite hazardous. There is no distinction given and no checking for the various types of values that can be placed on the stack. Automatic coercion between types is performed. In many -cases this is useful. For example, a boolean value placed on the stack +cases, this is useful. For example, a boolean value placed on the stack can be interpreted as an integer with good results. However, using a word that interprets that boolean value as a pointer to a string to print out will almost always yield a crash. Stacker simply leaves it @@ -412,9 +413,9 @@ is terminated by a semi-colon.

              So, your typical definition will have the form:

              : name ... ;

              The name is up to you but it must start with a letter and contain -only letters numbers and underscore. Names are case sensitive and must not be +only letters, numbers, and underscore. Names are case sensitive and must not be the same as the name of a built-in word. The ... is replaced by -the stack manipulting words that you wish define name as.

              +the stack manipulating words that you wish to define name as.

              Comments
              @@ -435,12 +436,12 @@ a real program.

              Literals
              -

              There are three kinds of literal values in Stacker. Integer, Strings, +

              There are three kinds of literal values in Stacker: Integers, Strings, and Booleans. In each case, the stack operation is to simply push the - value onto the stack. So, for example:
              + value on to the stack. So, for example:
              42 " is the answer." TRUE
              - will push three values onto the stack: the integer 42, the - string " is the answer." and the boolean TRUE.

              + will push three values on to the stack: the integer 42, the + string " is the answer.", and the boolean TRUE.

              Words
              @@ -470,21 +471,21 @@ linking.

              The built-in words of the Stacker language are put in several groups depending on what they do. The groups are as follows:

                -
              1. LogicalThese words provide the logical operations for +
              2. Logical: These words provide the logical operations for comparing stack operands.
                The words are: < > <= >= = <> true false.
              3. -
              4. BitwiseThese words perform bitwise computations on +
              5. Bitwise: These words perform bitwise computations on their operands.
                The words are: << >> XOR AND NOT
              6. -
              7. ArithmeticThese words perform arithmetic computations on +
              8. Arithmetic: These words perform arithmetic computations on their operands.
                The words are: ABS NEG + - * / MOD */ ++ -- MIN MAX
              9. StackThese words manipulate the stack directly by moving its elements around.
                The words are: DROP DROP2 NIP NIP2 DUP DUP2 SWAP SWAP2 OVER OVER2 ROT ROT2 RROT RROT2 TUCK TUCK2 PICK SELECT ROLL
              10. -
              11. MemoryThese words allocate, free and manipulate memory +
              12. MemoryThese words allocate, free, and manipulate memory areas outside the stack.
                The words are: MALLOC FREE GET PUT
              13. -
              14. ControlThese words alter the normal left to right flow +
              15. Control: These words alter the normal left to right flow of execution.
                The words are: IF ELSE ENDIF WHILE END RETURN EXIT RECURSE
              16. -
              17. I/O These words perform output on the standard output +
              18. I/O: These words perform output on the standard output and input on the standard input. No other I/O is possible in Stacker.
                The words are: SPACE TAB CR >s >d >c <s <d <c.
              @@ -566,12 +567,12 @@ using the following construction:

              FALSE FALSE -- b - The boolean value FALSE (0) is pushed onto the stack. + The boolean value FALSE (0) is pushed on to the stack. TRUE TRUE -- b - The boolean value TRUE (-1) is pushed onto the stack. + The boolean value TRUE (-1) is pushed on to the stack. BITWISE OPERATORS @@ -626,75 +627,75 @@ using the following construction:

              ABS w -- |w| One value s popped off the stack; its absolute value is computed - and then pushed onto the stack. If w1 is -1 then w2 is 1. If w1 is + and then pushed on to the stack. If w1 is -1 then w2 is 1. If w1 is 1 then w2 is also 1. NEG NEG w -- -w One value is popped off the stack which is negated and then - pushed back onto the stack. If w1 is -1 then w2 is 1. If w1 is + pushed back on to the stack. If w1 is -1 then w2 is 1. If w1 is 1 then w2 is -1. + ADD w1 w2 -- w2+w1 Two values are popped off the stack. Their sum is pushed back - onto the stack + on to the stack - SUB w1 w2 -- w2-w1 Two values are popped off the stack. Their difference is pushed back - onto the stack + on to the stack * MUL w1 w2 -- w2*w1 Two values are popped off the stack. Their product is pushed back - onto the stack + on to the stack / DIV w1 w2 -- w2/w1 Two values are popped off the stack. Their quotient is pushed back - onto the stack + on to the stack MOD MOD w1 w2 -- w2%w1 Two values are popped off the stack. Their remainder after division - of w1 by w2 is pushed back onto the stack + of w1 by w2 is pushed back on to the stack */ STAR_SLAH w1 w2 w3 -- (w3*w2)/w1 Three values are popped off the stack. The product of w1 and w2 is - divided by w3. The result is pushed back onto the stack. + divided by w3. The result is pushed back on to the stack. ++ INCR w -- w+1 One value is popped off the stack. It is incremented by one and then - pushed back onto the stack. + pushed back on to the stack. -- DECR w -- w-1 One value is popped off the stack. It is decremented by one and then - pushed back onto the stack. + pushed back on to the stack. MIN MIN w1 w2 -- (w2<w1?w2:w1) Two values are popped off the stack. The larger one is pushed back - onto the stack. + on to the stack. MAX MAX w1 w2 -- (w2>w1?w2:w1) Two values are popped off the stack. The larger value is pushed back - onto the stack. + on to the stack. STACK MANIPULATION OPERATORS @@ -730,7 +731,7 @@ using the following construction:

              DUP DUP w1 -- w1 w1 - One value is popped off the stack. That value is then pushed onto + One value is popped off the stack. That value is then pushed on to the stack twice to duplicate the top stack vaue. DUP2 @@ -744,7 +745,7 @@ using the following construction:

              SWAP w1 w2 -- w2 w1 The top two stack items are reversed in their order. That is, two - values are popped off the stack and pushed back onto the stack in + values are popped off the stack and pushed back on to the stack in the opposite order they were popped. SWAP2 @@ -752,27 +753,27 @@ using the following construction:

              w1 w2 w3 w4 -- w3 w4 w2 w1 The top four stack items are swapped in pairs. That is, two values are popped and retained. Then, two more values are popped and retained. - The values are pushed back onto the stack in the reverse order but + The values are pushed back on to the stack in the reverse order but in pairs.

              OVER OVER w1 w2-- w1 w2 w1 Two values are popped from the stack. They are pushed back - onto the stack in the order w1 w2 w1. This seems to cause the + on to the stack in the order w1 w2 w1. This seems to cause the top stack element to be duplicated "over" the next value. OVER2 OVER2 w1 w2 w3 w4 -- w1 w2 w3 w4 w1 w2 - The third and fourth values on the stack are replicated onto the + The third and fourth values on the stack are replicated on to the top of the stack ROT ROT w1 w2 w3 -- w2 w3 w1 The top three values are rotated. That is, three value are popped - off the stack. They are pushed back onto the stack in the order + off the stack. They are pushed back on to the stack in the order w1 w3 w2. ROT2 @@ -854,7 +855,7 @@ using the following construction:

              One value is popped off the stack. The value is used as the size of a memory block to allocate. The size is in bytes, not words. The memory allocation is completed and the address of the memory - block is pushed onto the stack. + block is pushed on to the stack. FREE FREE @@ -948,7 +949,7 @@ using the following construction:

              The boolean value on the top of the stack is examined. If it is non-zero then the "words..." between WHILE and END are executed. Execution then begins again at the WHILE where another boolean is popped off the stack. To prevent this operation from eating up the entire - stack, you should push onto the stack (just before the END) a boolean value that indicates + stack, you should push on to the stack (just before the END) a boolean value that indicates whether to terminate. Note that since booleans and integers can be coerced you can use the following "for loop" idiom:
              (push count) WHILE (words...) -- END
              @@ -1002,19 +1003,19 @@ using the following construction:

              IN_STR -- s A string is read from the input via the scanf(3) format string " %as". The - resulting string is pushed onto the stack. + resulting string is pushed on to the stack. <d IN_STR -- w An integer is read from the input via the scanf(3) format string " %d". The - resulting value is pushed onto the stack + resulting value is pushed on to the stack <c IN_CHR -- w A single character is read from the input via the scanf(3) format string - " %c". The value is converted to an integer and pushed onto the stack. + " %c". The value is converted to an integer and pushed on to the stack. DUMP DUMP @@ -1030,9 +1031,9 @@ using the following construction:

              The following fully documented program highlights many features of both the Stacker language and what is possible with LLVM. The program has two modes -of operations. If you provide numeric arguments to the program, it checks to see +of operation. If you provide numeric arguments to the program, it checks to see if those arguments are prime numbers and prints out the results. Without any -aruments, the program prints out any prime numbers it finds between 1 and one +arguments, the program prints out any prime numbers it finds between 1 and one million (there's a lot of them!). The source code comments below tell the remainder of the story.

              @@ -1057,7 +1058,7 @@ remainder of the story. : exit_loop FALSE; ################################################################################ -# This definition tryies an actual division of a candidate prime number. It +# This definition tries an actual division of a candidate prime number. It # determines whether the division loop on this candidate should continue or # not. # STACK<: @@ -1117,7 +1118,7 @@ remainder of the story. # STACK<: # p - the prime number to check # STACK>: -# yn - boolean indiating if its a prime or not +# yn - boolean indicating if its a prime or not # p - the prime number checked ################################################################################ : try_harder @@ -1290,7 +1291,7 @@ remainder of the story. under the LLVM "projects" directory. You will need to obtain the LLVM sources to find it (either via anonymous CVS or a tarball. See the Getting Started document).

              -

              Under the "projects" directory there is a directory named "stacker". That +

              Under the "projects" directory there is a directory named "Stacker". That directory contains everything, as follows:

              • lib - contains most of the source code @@ -1343,7 +1344,7 @@ directory contains everything, as follows:

                definitions, the ROLL word is not implemented. This word was left out of Stacker on purpose so that it can be an exercise for the student. The exercise is to implement the ROLL functionality (in your own workspace) and build a test -program for it. If you can implement ROLL you understand Stacker and probably +program for it. If you can implement ROLL, you understand Stacker and probably a fair amount about LLVM since this is one of the more complicated Stacker operations. The work will almost be completely limited to the compiler. @@ -1374,7 +1375,7 @@ interested, here are some things that could be implemented better:

                emitted currently is somewhat wasteful. It gets cleaned up a lot by existing passes but more could be done.
              • Add -O -O1 -O2 and -O3 optimization switches to the compiler driver to - allow LLVM optimization without using "opt"
              • + allow LLVM optimization without using "opt."
              • Make the compiler driver use the LLVM linking facilities (with IPO) before depending on GCC to do the final link.
              • Clean up parsing. It doesn't handle errors very well.
              • diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp index 763854ee0b1..0cc408c61b7 100644 --- a/lib/Transforms/Scalar/IndVarSimplify.cpp +++ b/lib/Transforms/Scalar/IndVarSimplify.cpp @@ -15,19 +15,19 @@ //===----------------------------------------------------------------------===// #include "llvm/Transforms/Scalar.h" -#include "llvm/Constants.h" -#include "llvm/Type.h" -#include "llvm/iPHINode.h" -#include "llvm/iOther.h" #include "llvm/Analysis/InductionVariable.h" #include "llvm/Analysis/LoopInfo.h" +#include "llvm/iPHINode.h" +#include "llvm/iOther.h" +#include "llvm/Type.h" +#include "llvm/Constants.h" #include "llvm/Support/CFG.h" -#include "llvm/Transforms/Utils/Local.h" #include "Support/Debug.h" #include "Support/Statistic.h" #include "Support/STLExtras.h" #include -using namespace llvm; + +namespace llvm { namespace { Statistic<> NumRemoved ("indvars", "Number of aux indvars removed"); @@ -141,8 +141,6 @@ static bool TransformLoop(LoopInfo *Loops, Loop *Loop) { DEBUG(IV->print(std::cerr)); - while (isa(AfterPHIIt)) ++AfterPHIIt; - // Don't do math with pointers... const Type *IVTy = IV->Phi->getType(); if (isa(IVTy)) IVTy = Type::ULongTy; @@ -188,12 +186,6 @@ static bool TransformLoop(LoopInfo *Loops, Loop *Loop) { IV->Phi->setName(""); Val->setName(OldName); - // Get the incoming values used by the PHI node - std::vector PHIOps; - PHIOps.reserve(IV->Phi->getNumIncomingValues()); - for (unsigned i = 0, e = IV->Phi->getNumIncomingValues(); i != e; ++i) - PHIOps.push_back(IV->Phi->getIncomingValue(i)); - // Delete the old, now unused, phi node... Header->getInstList().erase(IV->Phi); @@ -250,7 +242,8 @@ namespace { "Canonicalize Induction Variables"); } -Pass *llvm::createIndVarSimplifyPass() { +Pass *createIndVarSimplifyPass() { return new InductionVariableSimplify(); } +} // End llvm namespace diff --git a/runtime/GCCLibraries/crtend/listend.ll b/runtime/GCCLibraries/crtend/listend.ll index 5ad8a6379a4..a8cee070c9f 100644 --- a/runtime/GCCLibraries/crtend/listend.ll +++ b/runtime/GCCLibraries/crtend/listend.ll @@ -1,9 +1,6 @@ ; global_ctors/global_dtors terminator: this is used to add a terminating null ; value to the initialization list. -target endian = little -target pointersize = 32 - %struct..TorRec = type { int, void ()* } %llvm.global_ctors = appending global [1 x %struct..TorRec] [ -- 2.34.1