From reid at x10sys.com Mon Aug 23 12:47:27 2004 From: reid at x10sys.com (Reid Spencer) Date: Mon, 23 Aug 2004 12:47:27 -0500 Subject: [llvm-commits] CVS: llvm/projects/Makefile Message-ID: <200408231747.MAA05697@zion.cs.uiuc.edu> Changes in directory llvm/projects: Makefile updated: 1.6 -> 1.7 --- Log message: Change the makefile back so it descends any directory with a Makefile. --- Diffs of the changes: (+1 -1) Index: llvm/projects/Makefile diff -u llvm/projects/Makefile:1.6 llvm/projects/Makefile:1.7 --- llvm/projects/Makefile:1.6 Thu Aug 19 20:49:59 2004 +++ llvm/projects/Makefile Mon Aug 23 12:47:16 2004 @@ -10,6 +10,6 @@ include $(LEVEL)/Makefile.config -DIRS:= SmallExamples sample +DIRS:= $(patsubst %/Makefile,%,$(wildcard $(SourceDir)/*/Makefile)) include $(BUILD_SRC_ROOT)/Makefile.rules From brukman at cs.uiuc.edu Mon Aug 23 12:54:55 2004 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Mon, 23 Aug 2004 12:54:55 -0500 Subject: [llvm-commits] CVS: llvm/docs/CFEBuildInstrs.html Message-ID: <200408231754.MAA05904@zion.cs.uiuc.edu> Changes in directory llvm/docs: CFEBuildInstrs.html updated: 1.23 -> 1.24 --- Log message: Note: do not use GNU binutils under AIX, they're not stable. --- Diffs of the changes: (+15 -1) Index: llvm/docs/CFEBuildInstrs.html diff -u llvm/docs/CFEBuildInstrs.html:1.23 llvm/docs/CFEBuildInstrs.html:1.24 --- llvm/docs/CFEBuildInstrs.html:1.23 Sat Aug 14 17:13:33 2004 +++ llvm/docs/CFEBuildInstrs.html Mon Aug 23 12:54:45 2004 @@ -16,6 +16,7 @@
  • A Cautionary Note
  • Instructions
  • @@ -68,6 +69,19 @@

    + +
    + Building under AIX +
    + + +
    +

    If you are building LLVM and the C front-end under AIX, do NOT use GNU +Binutils. They are not stable under AIX and may produce incorrect and/or +invalid code. Instead, use the system assembler and linker. +

    +
    +
    Instructions @@ -300,7 +314,7 @@ Brian Gaeke
    LLVM Compiler Infrastructure
    - Last modified: $Date: 2004/08/14 22:13:33 $ + Last modified: $Date: 2004/08/23 17:54:45 $ From llvm at cs.uiuc.edu Mon Aug 23 13:03:21 2004 From: llvm at cs.uiuc.edu (LLVM) Date: Mon, 23 Aug 2004 13:03:21 -0500 Subject: [llvm-commits] CVS: llvm/examples/ Message-ID: <200408231803.NAA06051@zion.cs.uiuc.edu> Changes in directory llvm/examples: --- Log message: Directory /var/cvs/llvm/llvm/examples added to the repository --- Diffs of the changes: (+0 -0) From reid at x10sys.com Mon Aug 23 13:06:42 2004 From: reid at x10sys.com (Reid Spencer) Date: Mon, 23 Aug 2004 13:06:42 -0500 Subject: [llvm-commits] CVS: llvm/examples/Makefile Message-ID: <200408231806.NAA06080@zion.cs.uiuc.edu> Changes in directory llvm/examples: Makefile updated: 1.2 -> 1.3 --- Log message: Fix Title line Make the "DIRS" option descend any directory with a Makefile. --- Diffs of the changes: (+2 -2) Index: llvm/examples/Makefile diff -u llvm/examples/Makefile:1.2 llvm/examples/Makefile:1.3 --- llvm/examples/Makefile:1.2 Thu Aug 19 20:11:16 2004 +++ llvm/examples/Makefile Mon Aug 23 13:06:31 2004 @@ -1,4 +1,4 @@ -##===- projects/Makefile ------------------------------*- Makefile -*-===## +##===- examples/Makefile -----------------------------------*- Makefile -*-===## # # The LLVM Compiler Infrastructure # @@ -10,6 +10,6 @@ include $(LEVEL)/Makefile.config -DIRS = Fibonacci HowToUseJIT +DIRS:= $(patsubst %/Makefile,%,$(wildcard $(SourceDir)/*/Makefile)) include $(BUILD_SRC_ROOT)/Makefile.rules From llvm at cs.uiuc.edu Mon Aug 23 13:17:55 2004 From: llvm at cs.uiuc.edu (LLVM) Date: Mon, 23 Aug 2004 13:17:55 -0500 Subject: [llvm-commits] CVS: llvm/projects/Skeleton/ Message-ID: <200408231817.NAA06174@zion.cs.uiuc.edu> Changes in directory llvm/projects/Skeleton: --- Log message: Directory /var/cvs/llvm/llvm/projects/Skeleton added to the repository --- Diffs of the changes: (+0 -0) From llvm at cs.uiuc.edu Mon Aug 23 14:28:51 2004 From: llvm at cs.uiuc.edu (LLVM) Date: Mon, 23 Aug 2004 14:28:51 -0500 Subject: [llvm-commits] CVS: llvm/projects/SmallExamples/Makefile Message-ID: <200408231928.OAA06884@zion.cs.uiuc.edu> Changes in directory llvm/projects/SmallExamples: Makefile (r1.2) removed --- Log message: Moved the "SmallExamples" out of the /projects directory and into a new /examples directory. History was maintained. These programs do not need to be configured but things in /projects must be. --- Diffs of the changes: (+0 -0) From llvm at cs.uiuc.edu Mon Aug 23 14:28:51 2004 From: llvm at cs.uiuc.edu (LLVM) Date: Mon, 23 Aug 2004 14:28:51 -0500 Subject: [llvm-commits] CVS: llvm/projects/SmallExamples/ModuleMaker/tools/Makefile Message-ID: <200408231928.OAA06887@zion.cs.uiuc.edu> Changes in directory llvm/projects/SmallExamples/ModuleMaker/tools: Makefile (r1.2) removed --- Log message: Moved the "SmallExamples" out of the /projects directory and into a new /examples directory. History was maintained. These programs do not need to be configured but things in /projects must be. --- Diffs of the changes: (+0 -0) From llvm at cs.uiuc.edu Mon Aug 23 14:28:51 2004 From: llvm at cs.uiuc.edu (LLVM) Date: Mon, 23 Aug 2004 14:28:51 -0500 Subject: [llvm-commits] CVS: llvm/projects/SmallExamples/HowToUseJIT/HowToUseJIT.cpp Makefile Message-ID: <200408231928.OAA06894@zion.cs.uiuc.edu> Changes in directory llvm/projects/SmallExamples/HowToUseJIT: HowToUseJIT.cpp (r1.5) removed Makefile (r1.2) removed --- Log message: Moved the "SmallExamples" out of the /projects directory and into a new /examples directory. History was maintained. These programs do not need to be configured but things in /projects must be. --- Diffs of the changes: (+0 -0) From llvm at cs.uiuc.edu Mon Aug 23 14:28:51 2004 From: llvm at cs.uiuc.edu (LLVM) Date: Mon, 23 Aug 2004 14:28:51 -0500 Subject: [llvm-commits] CVS: llvm/projects/SmallExamples/ModuleMaker/tools/ModuleMaker/Makefile ModuleMaker.cpp Message-ID: <200408231928.OAA06893@zion.cs.uiuc.edu> Changes in directory llvm/projects/SmallExamples/ModuleMaker/tools/ModuleMaker: Makefile (r1.2) removed ModuleMaker.cpp (r1.3) removed --- Log message: Moved the "SmallExamples" out of the /projects directory and into a new /examples directory. History was maintained. These programs do not need to be configured but things in /projects must be. --- Diffs of the changes: (+0 -0) From llvm at cs.uiuc.edu Mon Aug 23 14:28:52 2004 From: llvm at cs.uiuc.edu (LLVM) Date: Mon, 23 Aug 2004 14:28:52 -0500 Subject: [llvm-commits] CVS: llvm/projects/SmallExamples/Fibonacci/Makefile fibonacci.cpp Message-ID: <200408231928.OAA06896@zion.cs.uiuc.edu> Changes in directory llvm/projects/SmallExamples/Fibonacci: Makefile (r1.1) removed fibonacci.cpp (r1.1) removed --- Log message: Moved the "SmallExamples" out of the /projects directory and into a new /examples directory. History was maintained. These programs do not need to be configured but things in /projects must be. --- Diffs of the changes: (+0 -0) From llvm at cs.uiuc.edu Mon Aug 23 14:28:53 2004 From: llvm at cs.uiuc.edu (LLVM) Date: Mon, 23 Aug 2004 14:28:53 -0500 Subject: [llvm-commits] CVS: llvm/projects/SmallExamples/ModuleMaker/Makefile Makefile.common.in README.txt configure Message-ID: <200408231928.OAA06908@zion.cs.uiuc.edu> Changes in directory llvm/projects/SmallExamples/ModuleMaker: Makefile (r1.2) removed Makefile.common.in (r1.2) removed README.txt (r1.1) removed configure (r1.1) removed --- Log message: Moved the "SmallExamples" out of the /projects directory and into a new /examples directory. History was maintained. These programs do not need to be configured but things in /projects must be. --- Diffs of the changes: (+0 -0) From llvm at cs.uiuc.edu Mon Aug 23 14:28:54 2004 From: llvm at cs.uiuc.edu (LLVM) Date: Mon, 23 Aug 2004 14:28:54 -0500 Subject: [llvm-commits] CVS: llvm/projects/SmallExamples/ModuleMaker/autoconf/LICENSE.TXT aclocal.m4 config.guess config.sub configure.ac install-sh ltmain.sh mkinstalldirs Message-ID: <200408231928.OAA06913@zion.cs.uiuc.edu> Changes in directory llvm/projects/SmallExamples/ModuleMaker/autoconf: LICENSE.TXT (r1.1) removed aclocal.m4 (r1.1) removed config.guess (r1.1) removed config.sub (r1.1) removed configure.ac (r1.1) removed install-sh (r1.1) removed ltmain.sh (r1.1) removed mkinstalldirs (r1.1) removed --- Log message: Moved the "SmallExamples" out of the /projects directory and into a new /examples directory. History was maintained. These programs do not need to be configured but things in /projects must be. --- Diffs of the changes: (+0 -0) From reid at x10sys.com Mon Aug 23 14:30:05 2004 From: reid at x10sys.com (Reid Spencer) Date: Mon, 23 Aug 2004 14:30:05 -0500 Subject: [llvm-commits] CVS: llvm/examples/ModuleMaker/Makefile Makefile.common.in configure Message-ID: <200408231930.OAA06973@zion.cs.uiuc.edu> Changes in directory llvm/examples/ModuleMaker: Makefile updated: 1.2 -> 1.3 Makefile.common.in (r1.2) removed configure (r1.1) removed --- Log message: Moved small examples from /projects/SmallExamples to /examples. Made the "ModuleMaker" into an example since its just one source file. --- Diffs of the changes: (+4 -18) Index: llvm/examples/ModuleMaker/Makefile diff -u llvm/examples/ModuleMaker/Makefile:1.2 llvm/examples/ModuleMaker/Makefile:1.3 --- llvm/examples/ModuleMaker/Makefile:1.2 Mon Oct 20 17:28:01 2003 +++ llvm/examples/ModuleMaker/Makefile Mon Aug 23 14:29:54 2004 @@ -1,4 +1,4 @@ -##===- projects/ModuleMaker/Makefile -----------------------*- Makefile -*-===## +##===- examples/ModuleMaker --------------------------------*- Makefile -*-===## # # The LLVM Compiler Infrastructure # @@ -6,22 +6,8 @@ # the University of Illinois Open Source License. See LICENSE.TXT for details. # ##===----------------------------------------------------------------------===## -# -# This is a sample Makefile for a project that uses LLVM. -# - -# -# Indicates our relative path to the top of the project's root directory. -# -LEVEL = . +LEVEL=../.. +TOOLNAME=ModuleMaker +USEDLIBS= bcwriter vmcore support.a -# -# Directories that needs to be built. -# -DIRS = tools - -# -# Include the Master Makefile that knows how to build all. -# include $(LEVEL)/Makefile.common - From llvm at cs.uiuc.edu Mon Aug 23 14:30:05 2004 From: llvm at cs.uiuc.edu (LLVM) Date: Mon, 23 Aug 2004 14:30:05 -0500 Subject: [llvm-commits] CVS: llvm/examples/ModuleMaker/tools/Makefile Message-ID: <200408231930.OAA06970@zion.cs.uiuc.edu> Changes in directory llvm/examples/ModuleMaker/tools: Makefile (r1.2) removed --- Log message: Moved small examples from /projects/SmallExamples to /examples. Made the "ModuleMaker" into an example since its just one source file. --- Diffs of the changes: (+0 -0) From reid at x10sys.com Mon Aug 23 14:30:04 2004 From: reid at x10sys.com (Reid Spencer) Date: Mon, 23 Aug 2004 14:30:04 -0500 Subject: [llvm-commits] CVS: llvm/examples/Makefile Message-ID: <200408231930.OAA06967@zion.cs.uiuc.edu> Changes in directory llvm/examples: Makefile updated: 1.3 -> 1.4 --- Log message: Moved small examples from /projects/SmallExamples to /examples. Made the "ModuleMaker" into an example since its just one source file. --- Diffs of the changes: (+4 -3) Index: llvm/examples/Makefile diff -u llvm/examples/Makefile:1.3 llvm/examples/Makefile:1.4 --- llvm/examples/Makefile:1.3 Mon Aug 23 13:06:31 2004 +++ llvm/examples/Makefile Mon Aug 23 14:29:54 2004 @@ -6,10 +6,11 @@ # the University of Illinois Open Source License. See LICENSE.TXT for details. # ##===----------------------------------------------------------------------===## -LEVEL=../.. +LEVEL=.. include $(LEVEL)/Makefile.config -DIRS:= $(patsubst %/Makefile,%,$(wildcard $(SourceDir)/*/Makefile)) +#PARALLEL_DIRS:= $(patsubst %/Makefile,%,$(wildcard $(SourceDir)/*/Makefile)) +PARALLEL_DIRS:= Fibonacci HowToUseJIT ModuleMaker -include $(BUILD_SRC_ROOT)/Makefile.rules +include $(LEVEL)/Makefile.common From reid at x10sys.com Mon Aug 23 14:30:05 2004 From: reid at x10sys.com (Reid Spencer) Date: Mon, 23 Aug 2004 14:30:05 -0500 Subject: [llvm-commits] CVS: llvm/examples/Fibonacci/Makefile Message-ID: <200408231930.OAA06978@zion.cs.uiuc.edu> Changes in directory llvm/examples/Fibonacci: Makefile updated: 1.1 -> 1.2 --- Log message: Moved small examples from /projects/SmallExamples to /examples. Made the "ModuleMaker" into an example since its just one source file. --- Diffs of the changes: (+1 -1) Index: llvm/examples/Fibonacci/Makefile diff -u llvm/examples/Fibonacci/Makefile:1.1 llvm/examples/Fibonacci/Makefile:1.2 --- llvm/examples/Fibonacci/Makefile:1.1 Thu Aug 19 15:10:04 2004 +++ llvm/examples/Fibonacci/Makefile Mon Aug 23 14:29:54 2004 @@ -6,7 +6,7 @@ # the University of Illinois Open Source License. See LICENSE.TXT for details. # ##===----------------------------------------------------------------------===## -LEVEL = ../../.. +LEVEL = ../.. TOOLNAME = Fibonacci USEDLIBS = lli-jit lli-interpreter codegen executionengine x86 selectiondag \ scalaropts analysis.a transformutils.a bcreader target.a vmcore \ From reid at x10sys.com Mon Aug 23 14:30:05 2004 From: reid at x10sys.com (Reid Spencer) Date: Mon, 23 Aug 2004 14:30:05 -0500 Subject: [llvm-commits] CVS: llvm/examples/HowToUseJIT/Makefile Message-ID: <200408231930.OAA06981@zion.cs.uiuc.edu> Changes in directory llvm/examples/HowToUseJIT: Makefile updated: 1.2 -> 1.3 --- Log message: Moved small examples from /projects/SmallExamples to /examples. Made the "ModuleMaker" into an example since its just one source file. --- Diffs of the changes: (+1 -1) Index: llvm/examples/HowToUseJIT/Makefile diff -u llvm/examples/HowToUseJIT/Makefile:1.2 llvm/examples/HowToUseJIT/Makefile:1.3 --- llvm/examples/HowToUseJIT/Makefile:1.2 Thu Aug 19 15:09:14 2004 +++ llvm/examples/HowToUseJIT/Makefile Mon Aug 23 14:29:54 2004 @@ -6,7 +6,7 @@ # the University of Illinois Open Source License. See LICENSE.TXT for details. # ##===----------------------------------------------------------------------===## -LEVEL = ../../.. +LEVEL = ../.. TOOLNAME = HowToUseJIT USEDLIBS = lli-jit lli-interpreter codegen executionengine x86 selectiondag \ scalaropts analysis.a transformutils.a bcreader target.a vmcore \ From llvm at cs.uiuc.edu Mon Aug 23 14:30:05 2004 From: llvm at cs.uiuc.edu (LLVM) Date: Mon, 23 Aug 2004 14:30:05 -0500 Subject: [llvm-commits] CVS: llvm/examples/ModuleMaker/tools/ModuleMaker/Makefile ModuleMaker.cpp Message-ID: <200408231930.OAA06984@zion.cs.uiuc.edu> Changes in directory llvm/examples/ModuleMaker/tools/ModuleMaker: Makefile (r1.2) removed ModuleMaker.cpp (r1.3) removed --- Log message: Moved small examples from /projects/SmallExamples to /examples. Made the "ModuleMaker" into an example since its just one source file. --- Diffs of the changes: (+0 -0) From llvm at cs.uiuc.edu Mon Aug 23 14:30:08 2004 From: llvm at cs.uiuc.edu (LLVM) Date: Mon, 23 Aug 2004 14:30:08 -0500 Subject: [llvm-commits] CVS: llvm/examples/ModuleMaker/autoconf/LICENSE.TXT aclocal.m4 config.guess config.sub configure.ac install-sh ltmain.sh mkinstalldirs Message-ID: <200408231930.OAA06993@zion.cs.uiuc.edu> Changes in directory llvm/examples/ModuleMaker/autoconf: LICENSE.TXT (r1.1) removed aclocal.m4 (r1.1) removed config.guess (r1.1) removed config.sub (r1.1) removed configure.ac (r1.1) removed install-sh (r1.1) removed ltmain.sh (r1.1) removed mkinstalldirs (r1.1) removed --- Log message: Moved small examples from /projects/SmallExamples to /examples. Made the "ModuleMaker" into an example since its just one source file. --- Diffs of the changes: (+0 -0) From brukman at cs.uiuc.edu Mon Aug 23 15:25:43 2004 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Mon, 23 Aug 2004 15:25:43 -0500 Subject: [llvm-commits] CVS: llvm/docs/GettingStarted.html Message-ID: <200408232025.PAA21021@zion.cs.uiuc.edu> Changes in directory llvm/docs: GettingStarted.html updated: 1.67 -> 1.68 --- Log message: Document 'gmake install' vs. 'install-bytecode' (used for bytecode libs) --- Diffs of the changes: (+7 -1) Index: llvm/docs/GettingStarted.html diff -u llvm/docs/GettingStarted.html:1.67 llvm/docs/GettingStarted.html:1.68 --- llvm/docs/GettingStarted.html:1.67 Sat Aug 21 18:40:49 2004 +++ llvm/docs/GettingStarted.html Mon Aug 23 15:25:33 2004 @@ -743,6 +743,12 @@ original state in which it was shipped.

    +

    gmake install +
    + Installs LLVM libraries and tools in a heirarchy under $PREFIX, specified with + ./configure --prefix=[dir], defaults to /usr/local. +

    +

    gmake install-bytecode
    Assuming you built LLVM into $OBJDIR, when this command is run in @@ -1279,7 +1285,7 @@ Chris Lattner
    The LLVM Compiler Infrastructure
    - Last modified: $Date: 2004/08/21 23:40:49 $ + Last modified: $Date: 2004/08/23 20:25:33 $ From gaeke at cs.uiuc.edu Mon Aug 23 15:49:46 2004 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Mon, 23 Aug 2004 15:49:46 -0500 (CDT) Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/SparcV9/2004-08-22-CallNull.llx Message-ID: <200408232049.PAA10070@seraph.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/SparcV9: 2004-08-22-CallNull.llx added (r1.1) --- Log message: A PR60: http://llvm.cs.uiuc.edu/PR60 test case --- Diffs of the changes: (+9 -0) Index: llvm/test/Regression/CodeGen/SparcV9/2004-08-22-CallNull.llx diff -c /dev/null llvm/test/Regression/CodeGen/SparcV9/2004-08-22-CallNull.llx:1.1 *** /dev/null Mon Aug 23 15:49:43 2004 --- llvm/test/Regression/CodeGen/SparcV9/2004-08-22-CallNull.llx Mon Aug 23 15:49:33 2004 *************** *** 0 **** --- 1,9 ---- + ; RUN: llvm-as < %s | llc -march=sparcv9 + + implementation ; Functions: + + void %main() { + entry: + call void null( ) + ret void + } From lattner at cs.uiuc.edu Mon Aug 23 19:26:23 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 23 Aug 2004 19:26:23 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp Message-ID: <200408240026.TAA26561@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: AsmPrinter.cpp updated: 1.9 -> 1.10 --- Log message: Do not use .xword and friends to emit zeros on V9. Apparently there are issues with emitting .xwords when not on an 8-byte boundary (.xword 0 is not the same as 8 .byte 0's). Because we do not know when or when we are not aligned, just emit bytes like the old V9 asmprinter did. --- Diffs of the changes: (+0 -6) Index: llvm/lib/CodeGen/AsmPrinter.cpp diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.9 llvm/lib/CodeGen/AsmPrinter.cpp:1.10 --- llvm/lib/CodeGen/AsmPrinter.cpp:1.9 Tue Aug 17 21:22:44 2004 +++ llvm/lib/CodeGen/AsmPrinter.cpp Mon Aug 23 19:26:11 2004 @@ -46,12 +46,6 @@ if (ZeroDirective) O << ZeroDirective << NumZeros << "\n"; else { - if (NumZeros >= 8 && Data64bitsDirective) { - for (; NumZeros >= 8; NumZeros -= 8) - O << Data64bitsDirective << "0\n"; - } - for (; NumZeros >= 4; NumZeros -= 4) - O << Data32bitsDirective << "0\n"; for (; NumZeros; --NumZeros) O << Data8bitsDirective << "0\n"; } From brukman at cs.uiuc.edu Mon Aug 23 20:57:12 2004 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Mon, 23 Aug 2004 20:57:12 -0500 Subject: [llvm-commits] CVS: llvm/docs/Lexicon.html Message-ID: <200408240157.UAA23014@zion.cs.uiuc.edu> Changes in directory llvm/docs: Lexicon.html updated: 1.1 -> 1.2 --- Log message: Added DSE, LICM, LVN, PRE, SCCP, and SSA --- Diffs of the changes: (+64 -5) Index: llvm/docs/Lexicon.html diff -u llvm/docs/Lexicon.html:1.1 llvm/docs/Lexicon.html:1.2 --- llvm/docs/Lexicon.html:1.1 Tue Aug 17 04:38:50 2004 +++ llvm/docs/Lexicon.html Mon Aug 23 20:57:02 2004 @@ -24,12 +24,36 @@
    - + + + + + + + + + + + + + + + + + + + + + + + + +
    - A -
    - A -
    ADCE
    - D -
    DSE
    - L -
    LICMLVN
    - P -
    PRE
    - S -
    SCCPSSA
    @@ -40,11 +64,46 @@
    -
    ADCE
    -
    Aggressive Dead Code Elimination
    +
    ADCE
    +
    Aggressive Dead Code Elimination
    +
    +
    + + +
    +
    +
    DSE
    +
    Dead Store Elimination
    +
    +
    + + +
    +
    +
    LICM
    +
    Loop Invariant Code Motion
    +
    LVN
    +
    Load Value Numbering
    +
    +
    + + +
    +
    +
    PRE
    +
    Partial Redundancy Elimination
    +
    +
    + + +
    +
    +
    SCCP
    +
    Sparse Conditional Constant Propagation +
    SSA
    +
    Static Single Assignment
    -
    Valid HTML 4.01!The LLVM Team
    The LLVM Compiler Infrastructure
    -Last modified: $Date: 2004/08/17 09:38:50 $ +Last modified: $Date: 2004/08/24 01:57:02 $
    From brukman at cs.uiuc.edu Mon Aug 23 21:24:08 2004 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Mon, 23 Aug 2004 21:24:08 -0500 Subject: [llvm-commits] CVS: llvm/docs/CompilerDriver.html Message-ID: <200408240224.VAA23595@zion.cs.uiuc.edu> Changes in directory llvm/docs: CompilerDriver.html updated: 1.5 -> 1.6 --- Log message: Fix some grammar. --- Diffs of the changes: (+3 -3) Index: llvm/docs/CompilerDriver.html diff -u llvm/docs/CompilerDriver.html:1.5 llvm/docs/CompilerDriver.html:1.6 --- llvm/docs/CompilerDriver.html:1.5 Sun Aug 22 13:06:59 2004 +++ llvm/docs/CompilerDriver.html Mon Aug 23 21:23:58 2004 @@ -55,8 +55,8 @@

    The llvmc tool is a configurable compiler - driver. As such, it isn't the compiler, optimizer, - or linker itself but it drives (invokes) other software that perform those + driver. As such, it isn't a compiler, optimizer, + or a linker itself but it drives (invokes) other software that perform those tasks. If you are familiar with the GNU Compiler Collection's gcc tool, llvmc is very similar.

    The following introductory sections will help you understand why this tool @@ -862,7 +862,7 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!">Reid Spencer
    The LLVM Compiler Infrastructure
    -Last modified: $Date: 2004/08/22 18:06:59 $ +Last modified: $Date: 2004/08/24 02:23:58 $ From brukman at cs.uiuc.edu Mon Aug 23 23:13:28 2004 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Mon, 23 Aug 2004 23:13:28 -0500 Subject: [llvm-commits] CVS: llvm/docs/Lexicon.html Message-ID: <200408240413.XAA24453@zion.cs.uiuc.edu> Changes in directory llvm/docs: Lexicon.html updated: 1.2 -> 1.3 --- Log message: Change LVN -> Load-VN since that's the name of the cmdline switch --- Diffs of the changes: (+3 -3) Index: llvm/docs/Lexicon.html diff -u llvm/docs/Lexicon.html:1.2 llvm/docs/Lexicon.html:1.3 --- llvm/docs/Lexicon.html:1.2 Mon Aug 23 20:57:02 2004 +++ llvm/docs/Lexicon.html Mon Aug 23 23:13:17 2004 @@ -39,7 +39,7 @@ - L - LICM - LVN + Load-VN - P - @@ -82,7 +82,7 @@

    LICM
    Loop Invariant Code Motion
    -
    LVN
    +
    Load-VN
    Load Value Numbering
    @@ -112,7 +112,7 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!">The LLVM Team
    The LLVM Compiler Infrastructure
    -Last modified: $Date: 2004/08/24 01:57:02 $ +Last modified: $Date: 2004/08/24 04:13:17 $ From reid at x10sys.com Tue Aug 24 00:21:59 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 24 Aug 2004 00:21:59 -0500 Subject: [llvm-commits] CVS: llvm/CREDITS.TXT Message-ID: <200408240521.AAA24756@zion.cs.uiuc.edu> Changes in directory llvm: CREDITS.TXT updated: 1.25 -> 1.26 --- Log message: Correct my home page. Shorten my entry. Reference home page in description. --- Diffs of the changes: (+2 -3) Index: llvm/CREDITS.TXT diff -u llvm/CREDITS.TXT:1.25 llvm/CREDITS.TXT:1.26 --- llvm/CREDITS.TXT:1.25 Thu Aug 5 14:09:47 2004 +++ llvm/CREDITS.TXT Tue Aug 24 00:21:49 2004 @@ -72,9 +72,8 @@ N: Reid Spencer E: rspencer at x10sys.com -W: http://extprosys.sourceforge.net/ -D: 'llvm' namespacification, Stacker FE, VMCore cleanup (SymbolTable, -D: Value != Type, CPR removal, bytecode improvements, llvmcs). +W: http://llvm.sourceforge.net/rspencer +D: Stacker, llvmc, bytecode, other. See web page for current notes. N: Bill Wendling E: wendling at isanbard.org From reid at x10sys.com Tue Aug 24 00:40:36 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 24 Aug 2004 00:40:36 -0500 Subject: [llvm-commits] CVS: llvm/CREDITS.TXT Message-ID: <200408240540.AAA24843@zion.cs.uiuc.edu> Changes in directory llvm: CREDITS.TXT updated: 1.26 -> 1.27 --- Log message: Actually get the URL to my notes page correct. --- Diffs of the changes: (+1 -1) Index: llvm/CREDITS.TXT diff -u llvm/CREDITS.TXT:1.26 llvm/CREDITS.TXT:1.27 --- llvm/CREDITS.TXT:1.26 Tue Aug 24 00:21:49 2004 +++ llvm/CREDITS.TXT Tue Aug 24 00:40:25 2004 @@ -72,7 +72,7 @@ N: Reid Spencer E: rspencer at x10sys.com -W: http://llvm.sourceforge.net/rspencer +W: http://llvm.x10sys.com/rspencer D: Stacker, llvmc, bytecode, other. See web page for current notes. N: Bill Wendling From gaeke at cs.uiuc.edu Tue Aug 24 01:41:52 2004 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Tue, 24 Aug 2004 01:41:52 -0500 (CDT) Subject: [llvm-commits] CVS: llvm/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp Message-ID: <200408240641.BAA11125@seraph.cs.uiuc.edu> Changes in directory llvm/lib/Target/SparcV9/RegAlloc: PhyRegAlloc.cpp updated: 1.163 -> 1.164 --- Log message: Fix bug in PhyRegAlloc::setCallInterferences() handling call through a null pointer. --- Diffs of the changes: (+3 -2) Index: llvm/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp diff -u llvm/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp:1.163 llvm/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp:1.164 --- llvm/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp:1.163 Wed Aug 18 15:04:24 2004 +++ llvm/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp Tue Aug 24 01:41:39 2004 @@ -204,8 +204,9 @@ // That has a call interference because it conflicts with outgoing args. if (const Value *AddrVal = argDesc->getIndirectFuncPtr()) { LiveRange *AddrValLR = LRI->getLiveRangeForValue( AddrVal ); - assert( AddrValLR && "No LR for indirect addr val of call"); - AddrValLR->setCallInterference(); + // LR can be null if the function pointer is a constant. + if (AddrValLR) + AddrValLR->setCallInterference(); } } From gaeke at cs.uiuc.edu Tue Aug 24 01:41:52 2004 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Tue, 24 Aug 2004 01:41:52 -0500 (CDT) Subject: [llvm-commits] CVS: llvm/lib/Target/SparcV9/MachineCodeForInstruction.cpp Message-ID: <200408240641.BAA11124@seraph.cs.uiuc.edu> Changes in directory llvm/lib/Target/SparcV9: MachineCodeForInstruction.cpp updated: 1.2 -> 1.3 --- Log message: Revise head-of-file comment. Eliminate some excess whitespace. Fix bug in CallArgsDescriptor::get() handling call through a null pointer. --- Diffs of the changes: (+28 -31) Index: llvm/lib/Target/SparcV9/MachineCodeForInstruction.cpp diff -u llvm/lib/Target/SparcV9/MachineCodeForInstruction.cpp:1.2 llvm/lib/Target/SparcV9/MachineCodeForInstruction.cpp:1.3 --- llvm/lib/Target/SparcV9/MachineCodeForInstruction.cpp:1.2 Wed Aug 18 13:13:34 2004 +++ llvm/lib/Target/SparcV9/MachineCodeForInstruction.cpp Tue Aug 24 01:41:38 2004 @@ -7,18 +7,12 @@ // //===----------------------------------------------------------------------===// // -// Representation of the sequence of machine instructions created for a single -// VM instruction. Additionally records information about hidden and implicit -// values used by the machine instructions: about hidden values used by the -// machine instructions: -// -// "Temporary values" are intermediate values used in the machine instruction -// sequence, but not in the VM instruction. Note that such values should be -// treated as pure SSA values with no interpretation of their operands (i.e., as -// a TmpInstruction object which actually represents such a value). -// -// (2) "Implicit uses" are values used in the VM instruction but not in the -// machine instruction sequence +// Container for the sequence of MachineInstrs created for a single +// LLVM Instruction. MachineCodeForInstruction also tracks temporary values +// (TmpInstruction objects) created during SparcV9 code generation, so that +// they can be deleted when they are no longer needed, and finally, it also +// holds some extra information for 'call' Instructions (using the +// CallArgsDescriptor object, which is also implemented in this file). // //===----------------------------------------------------------------------===// @@ -31,25 +25,24 @@ #include "MachineFunctionInfo.h" #include "MachineInstrAnnot.h" #include "SparcV9TmpInstr.h" +#include "SparcV9RegisterInfo.h" using namespace llvm; MachineCodeForInstruction &MachineCodeForInstruction::get(const Instruction *I){ MachineFunction &MF = MachineFunction::get(I->getParent()->getParent()); return MF.getInfo()->MCFIEntries[I]; } + void MachineCodeForInstruction::destroy(const Instruction *I) { MachineFunction &MF = MachineFunction::get(I->getParent()->getParent()); MF.getInfo()->MCFIEntries.erase(I); } -void -MachineCodeForInstruction::dropAllReferences() -{ +void MachineCodeForInstruction::dropAllReferences() { for (unsigned i=0, N=tempVec.size(); i < N; i++) cast(tempVec[i])->dropAllReferences(); } - MachineCodeForInstruction::~MachineCodeForInstruction() { // Let go of all uses in temp. instructions dropAllReferences(); @@ -65,7 +58,6 @@ delete callArgsDesc; } - CallArgsDescriptor::CallArgsDescriptor(CallInst* _callInstr, TmpInstruction* _retAddrReg, bool _isVarArgs, bool _noPrototype) @@ -91,21 +83,26 @@ return (callInstr->getType() == Type::VoidTy? NULL : callInstr); } -// Mechanism to get the descriptor for a CALL MachineInstr. -// We get the LLVM CallInstr from the ret. addr. register argument -// of the CALL MachineInstr (which is explicit operand #3 for indirect -// calls or the last implicit operand for direct calls). We then get -// the CallArgsDescriptor from the MachineCodeForInstruction object for -// the CallInstr. -// This is roundabout but avoids adding a new map or annotation just -// to keep track of CallArgsDescriptors. -// -CallArgsDescriptor *CallArgsDescriptor::get(const MachineInstr* MI) { - const TmpInstruction* retAddrReg = - cast(isa(MI->getOperand(0).getVRegValue()) - ? MI->getImplicitRef(MI->getNumImplicitRefs()-1) - : MI->getOperand(2).getVRegValue()); +/// CallArgsDescriptor::get - Mechanism to get the descriptor for a CALL +/// MachineInstr. We get the LLVM CallInst from the return-address register +/// argument of the CALL MachineInstr (which is explicit operand #2 for +/// indirect calls or the last implicit operand for direct calls). We then get +/// the CallArgsDescriptor from the MachineCodeForInstruction object for the +/// CallInstr. This is roundabout but avoids adding a new map or annotation +/// just to keep track of CallArgsDescriptors. +/// +CallArgsDescriptor *CallArgsDescriptor::get(const MachineInstr *MI) { + const Value *retAddrVal = 0; + if ((MI->getOperand (0).getType () == MachineOperand::MO_MachineRegister + && MI->getOperand (0).getReg () == SparcV9::g0) + || (MI->getOperand (0).getType () == MachineOperand::MO_VirtualRegister + && !isa (MI->getOperand (0).getVRegValue ()))) { + retAddrVal = MI->getOperand (2).getVRegValue (); + } else { + retAddrVal = MI->getImplicitRef (MI->getNumImplicitRefs () - 1); + } + const TmpInstruction* retAddrReg = cast (retAddrVal); assert(retAddrReg->getNumOperands() == 1 && isa(retAddrReg->getOperand(0)) && "Location of callInstr arg for CALL instr. changed? FIX THIS CODE!"); From gaeke at cs.uiuc.edu Tue Aug 24 01:41:52 2004 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Tue, 24 Aug 2004 01:41:52 -0500 (CDT) Subject: [llvm-commits] CVS: llvm/lib/Target/SparcV9/SparcV9RegInfo.cpp Message-ID: <200408240641.BAA11126@seraph.cs.uiuc.edu> Changes in directory llvm/lib/Target/SparcV9: SparcV9RegInfo.cpp updated: 1.137 -> 1.138 --- Log message: This code is dodgy, but the guaranteed assertion failure doesn't help anything. --- Diffs of the changes: (+1 -1) Index: llvm/lib/Target/SparcV9/SparcV9RegInfo.cpp diff -u llvm/lib/Target/SparcV9/SparcV9RegInfo.cpp:1.137 llvm/lib/Target/SparcV9/SparcV9RegInfo.cpp:1.138 --- llvm/lib/Target/SparcV9/SparcV9RegInfo.cpp:1.137 Wed Aug 18 13:13:34 2004 +++ llvm/lib/Target/SparcV9/SparcV9RegInfo.cpp Tue Aug 24 01:41:40 2004 @@ -456,7 +456,7 @@ // if( isArgInReg ) { if( regClassIDOfArgReg != RegClassID ) { - assert(0 && "This could should work but it is not tested yet"); + // NOTE: This code has not been well-tested. // It is a variable argument call: the float reg must go in a %o reg. // We have to move an int reg to a float reg via memory. From gaeke at cs.uiuc.edu Tue Aug 24 02:29:00 2004 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Tue, 24 Aug 2004 02:29:00 -0500 (CDT) Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/SparcV9/2004-08-22-CallNull.llx Message-ID: <200408240729.CAA13299@seraph.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/SparcV9: 2004-08-22-CallNull.llx updated: 1.1 -> 1.2 --- Log message: note pr# --- Diffs of the changes: (+1 -0) Index: llvm/test/Regression/CodeGen/SparcV9/2004-08-22-CallNull.llx diff -u llvm/test/Regression/CodeGen/SparcV9/2004-08-22-CallNull.llx:1.1 llvm/test/Regression/CodeGen/SparcV9/2004-08-22-CallNull.llx:1.2 --- llvm/test/Regression/CodeGen/SparcV9/2004-08-22-CallNull.llx:1.1 Mon Aug 23 15:49:33 2004 +++ llvm/test/Regression/CodeGen/SparcV9/2004-08-22-CallNull.llx Tue Aug 24 02:28:45 2004 @@ -1,4 +1,5 @@ ; RUN: llvm-as < %s | llc -march=sparcv9 +; PR428 implementation ; Functions: From gaeke at cs.uiuc.edu Tue Aug 24 02:42:21 2004 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Tue, 24 Aug 2004 02:42:21 -0500 (CDT) Subject: [llvm-commits] CVS: llvm-www/releases/1.3/docs/ReleaseNotes.html Message-ID: <200408240742.CAA13377@seraph.cs.uiuc.edu> Changes in directory llvm-www/releases/1.3/docs: ReleaseNotes.html updated: 1.4 -> 1.5 --- Log message: bug found --- Diffs of the changes: (+3 -1) Index: llvm-www/releases/1.3/docs/ReleaseNotes.html diff -u llvm-www/releases/1.3/docs/ReleaseNotes.html:1.4 llvm-www/releases/1.3/docs/ReleaseNotes.html:1.5 --- llvm-www/releases/1.3/docs/ReleaseNotes.html:1.4 Thu Aug 19 19:37:49 2004 +++ llvm-www/releases/1.3/docs/ReleaseNotes.html Tue Aug 24 02:42:08 2004 @@ -716,6 +716,8 @@
    @@ -777,7 +779,7 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!" /> The LLVM Compiler Infrastructure
    - Last modified: $Date: 2004/08/20 00:37:49 $ + Last modified: $Date: 2004/08/24 07:42:08 $ From gaeke at cs.uiuc.edu Tue Aug 24 02:44:01 2004 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Tue, 24 Aug 2004 02:44:01 -0500 (CDT) Subject: [llvm-commits] CVS: llvm/docs/ReleaseNotes.html Message-ID: <200408240744.CAA13424@seraph.cs.uiuc.edu> Changes in directory llvm/docs: ReleaseNotes.html updated: 1.233 -> 1.234 --- Log message: bug fixed --- Diffs of the changes: (+9 -1) Index: llvm/docs/ReleaseNotes.html diff -u llvm/docs/ReleaseNotes.html:1.233 llvm/docs/ReleaseNotes.html:1.234 --- llvm/docs/ReleaseNotes.html:1.233 Thu Aug 19 19:36:23 2004 +++ llvm/docs/ReleaseNotes.html Tue Aug 24 02:43:48 2004 @@ -166,6 +166,14 @@
    + +

    Bugs fixed in the Sparc V9 back-end:

    + +
      +
    1. [sparcv9] regalloc assertion + failure with certain indirect calls
    2. +
    + @@ -600,7 +608,7 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!" /> The LLVM Compiler Infrastructure
    - Last modified: $Date: 2004/08/20 00:36:23 $ + Last modified: $Date: 2004/08/24 07:43:48 $ From lattner at cs.uiuc.edu Tue Aug 24 03:18:55 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 24 Aug 2004 03:18:55 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86.h X86TargetMachine.cpp Message-ID: <200408240818.DAA12016@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86.h updated: 1.28 -> 1.29 X86TargetMachine.cpp updated: 1.65 -> 1.66 --- Log message: Add -sse[,2,3] arguments to LLC --- Diffs of the changes: (+20 -0) Index: llvm/lib/Target/X86/X86.h diff -u llvm/lib/Target/X86/X86.h:1.28 llvm/lib/Target/X86/X86.h:1.29 --- llvm/lib/Target/X86/X86.h:1.28 Sun Aug 15 18:02:17 2004 +++ llvm/lib/Target/X86/X86.h Tue Aug 24 03:18:44 2004 @@ -23,6 +23,12 @@ class FunctionPass; class IntrinsicLowering; +enum X86VectorEnum { + NoSSE, SSE, SSE2, SSE3 +}; + +extern X86VectorEnum X86Vector; + /// createX86SimpleInstructionSelector - This pass converts an LLVM function /// into a machine code representation in a very simple peep-hole fashion. The /// generated code sucks but the implementation is nice and simple. Index: llvm/lib/Target/X86/X86TargetMachine.cpp diff -u llvm/lib/Target/X86/X86TargetMachine.cpp:1.65 llvm/lib/Target/X86/X86TargetMachine.cpp:1.66 --- llvm/lib/Target/X86/X86TargetMachine.cpp:1.65 Sun Aug 15 18:02:17 2004 +++ llvm/lib/Target/X86/X86TargetMachine.cpp Tue Aug 24 03:18:44 2004 @@ -25,6 +25,8 @@ #include "Support/Statistic.h" using namespace llvm; +X86VectorEnum llvm::X86Vector = NoSSE; + namespace { cl::opt NoSSAPeephole("disable-ssa-peephole", cl::init(true), cl::desc("Disable the ssa-based peephole optimizer " @@ -33,6 +35,18 @@ cl::desc("Disable the X86 asm printer, for use " "when profiling the code generator.")); + // FIXME: This should eventually be handled with target triples and + // subtarget support! + cl::opt + SSEArg( + cl::desc("Enable SSE support in the X86 target:"), + cl::values( + clEnumValN(SSE, "sse", " Enable SSE support"), + clEnumValN(SSE2, "sse2", " Enable SSE and SSE2 support"), + clEnumValN(SSE3, "sse3", " Enable SSE, SSE2, and SSE3 support"), + clEnumValEnd), + cl::location(X86Vector), cl::init(NoSSE)); + // Register the target. RegisterTarget X("x86", " IA-32 (Pentium and above)"); } From lattner at cs.uiuc.edu Tue Aug 24 03:19:07 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 24 Aug 2004 03:19:07 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86RegisterInfo.td Message-ID: <200408240819.DAA12020@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86RegisterInfo.td updated: 1.11 -> 1.12 --- Log message: Nuke commented out stuff --- Diffs of the changes: (+0 -5) Index: llvm/lib/Target/X86/X86RegisterInfo.td diff -u llvm/lib/Target/X86/X86RegisterInfo.td:1.11 llvm/lib/Target/X86/X86RegisterInfo.td:1.12 --- llvm/lib/Target/X86/X86RegisterInfo.td:1.11 Sat Aug 21 15:14:13 2004 +++ llvm/lib/Target/X86/X86RegisterInfo.td Tue Aug 24 03:18:27 2004 @@ -48,11 +48,6 @@ def ST6 : NamedReg<"ST(6)">; def ST7 : NamedReg<"ST(7)">; // Flags, Segment registers, etc... - - // This is a slimy hack to make it possible to say that flags are clobbered... - // Ideally we'd model instructions based on which particular flag(s) they - // could clobber. - //def EFLAGS : Register; } //===----------------------------------------------------------------------===// From reid at x10sys.com Tue Aug 24 08:50:08 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 24 Aug 2004 08:50:08 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvmc/CompilerDriver.h Message-ID: <200408241350.IAA20630@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvmc: CompilerDriver.h updated: 1.7 -> 1.8 --- Log message: Remove unneeded flags. --- Diffs of the changes: (+4 -6) Index: llvm/tools/llvmc/CompilerDriver.h diff -u llvm/tools/llvmc/CompilerDriver.h:1.7 llvm/tools/llvmc/CompilerDriver.h:1.8 --- llvm/tools/llvmc/CompilerDriver.h:1.7 Sun Aug 22 13:03:25 2004 +++ llvm/tools/llvmc/CompilerDriver.h Tue Aug 24 08:49:57 2004 @@ -58,12 +58,10 @@ /// @brief Action specific flags enum ConfigurationFlags { REQUIRED_FLAG = 0x0001, ///< Should the action always be run? - GROKS_DASH_O_FLAG = 0x0002, ///< Understands the -On options? - PREPROCESSES_FLAG = 0x0004, ///< Does this action preprocess? - TRANSLATES_FLAG = 0x0008, ///< Does this action translate? - OPTIMIZES_FLAG = 0x0010, ///< Does this action optimize? - OUTPUT_IS_ASM_FLAG = 0x0020, ///< Action produces .ll files? - FLAGS_MASK = 0x003F, ///< Union of all flags + PREPROCESSES_FLAG = 0x0002, ///< Does this action preprocess? + TRANSLATES_FLAG = 0x0004, ///< Does this action translate? + OUTPUT_IS_ASM_FLAG = 0x0008, ///< Action produces .ll files? + FLAGS_MASK = 0x000F, ///< Union of all flags }; /// This type is the input list to the CompilerDriver. It provides From reid at x10sys.com Tue Aug 24 08:55:27 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 24 Aug 2004 08:55:27 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvmc/CompilerDriver.cpp Message-ID: <200408241355.IAA20669@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvmc: CompilerDriver.cpp updated: 1.8 -> 1.9 --- Log message: - Remove unused GetSuffix function - Renamed FileReadable -> FileIsReadable - Remove support for GROKS_DASH_O; deferr it to %opts% substitution - Require a -o option except in case of linking where it defaults to a.out - Fix problem processing *.o and *.bc files. - Ignore optimization phase if -emit-raw-code - Correct the assembly generation phase to support -emit-native-code - Implement dependent library lookup --- Diffs of the changes: (+118 -78) Index: llvm/tools/llvmc/CompilerDriver.cpp diff -u llvm/tools/llvmc/CompilerDriver.cpp:1.8 llvm/tools/llvmc/CompilerDriver.cpp:1.9 --- llvm/tools/llvmc/CompilerDriver.cpp:1.8 Fri Aug 20 17:53:11 2004 +++ llvm/tools/llvmc/CompilerDriver.cpp Tue Aug 24 08:55:17 2004 @@ -14,7 +14,11 @@ #include "CompilerDriver.h" #include "ConfigLexer.h" +#include "llvm/Bytecode/Reader.h" +#include "llvm/Module.h" +#include "Support/FileUtilities.h" #include "Support/SystemUtils.h" +#include "Support/StringExtras.h" #include using namespace llvm; @@ -26,12 +30,6 @@ return fullName.substr(0, dotpos); } - inline std::string GetSuffix(const std::string& fullName) { - size_t dotpos = fullName.rfind('.',fullName.size()); - if ( dotpos = std::string::npos ) return ""; - return fullName.substr(dotpos+1); - } - const char OutputSuffix[] = ".o"; void WriteAction(CompilerDriver::Action* action ) { @@ -82,12 +80,12 @@ // to be portable but we're avoiding that for now. namespace sys { - bool FileReadable(const std::string& fname) { + bool FileIsReadable(const std::string& fname) { return 0 == access(fname.c_str(), F_OK | R_OK); } void CleanupTempFile(const std::string& fname) { - if (FileReadable(fname)) + if (FileIsReadable(fname)) unlink(fname.c_str()); } @@ -227,31 +225,24 @@ // FIXME: Ignore for now } else if (*PI == "%opt%") { if (!emitRawCode) { - if (pat->isSet(GROKS_DASH_O)) { - if (optLevel != OPT_NONE) { - std::string optArg("-O"); - switch (optLevel) { - case OPT_FAST_COMPILE : optArg.append("1"); break; - case OPT_SIMPLE: optArg.append("2"); break; - case OPT_AGGRESSIVE: optArg.append("3"); break; - case OPT_LINK_TIME: optArg.append("4"); break; - case OPT_AGGRESSIVE_LINK_TIME: optArg.append("5"); break; - default : - assert(!"Invalid optimization argument!"); - optArg.append("0"); - break; - } - action->args.push_back(optArg); - } - } else { - if (cd->opts.size() > static_cast(optLevel) && - !cd->opts[optLevel].empty()) - action->args.insert(action->args.end(), cd->opts[optLevel].begin(), + if (cd->opts.size() > static_cast(optLevel) && + !cd->opts[optLevel].empty()) + action->args.insert(action->args.end(), cd->opts[optLevel].begin(), cd->opts[optLevel].end()); - } + else + error("Optimization options for level " + utostr(unsigned(optLevel)) + + " were not specified"); } + } else if (*PI == "%args%") { + if (AdditionalArgs.size() > unsigned(phase)) + if (!AdditionalArgs[phase].empty()) { + // Get specific options for each kind of action type + StringVector& addargs = AdditionalArgs[phase]; + // Add specific options for each kind of action type + action->args.insert(action->args.end(), addargs.begin(), addargs.end()); + } } else { - error("Invalid substitution name"); + error("Invalid substitution name" + *PI); } } else { // Its not a substitution, just put it in the action @@ -260,11 +251,6 @@ PI++; } - // Get specific options for each kind of action type - StringVector& args = AdditionalArgs[phase]; - - // Add specific options for each kind of action type - action->args.insert(action->args.end(), args.begin(), args.end()); // Finally, we're done return action; @@ -336,22 +322,23 @@ /// PRE-PROCESSING / TRANSLATION / OPTIMIZATION / ASSEMBLY phases // for each input item std::vector LinkageItems; + std::string OutFile(Output); InputList::const_iterator I = InpList.begin(); while ( I != InpList.end() ) { // Get the suffix of the file name - std::string suffix = GetSuffix(I->first); + const std::string& ftype = I->second; // If its a library, bytecode file, or object file, save // it for linking below and short circuit the // pre-processing/translation/assembly phases - if (I->second.empty() || suffix == "o" || suffix == "bc") { + if (ftype.empty() || ftype == "o" || ftype == "bc") { // We shouldn't get any of these types of files unless we're // later going to link. Enforce this limit now. if (finalPhase != LINKING) { error("Pre-compiled objects found but linking not requested"); } LinkageItems.push_back(I->first); - continue; // short circuit remainder of loop + ++I; continue; // short circuit remainder of loop } // At this point, we know its something we need to translate @@ -364,18 +351,6 @@ if (isDebug) DumpConfigData(cd,I->second); - // We have valid configuration data, now figure out where the output - // of compilation should end up. - std::string OutFile; - if (finalPhase != LINKING) { - if (InpList.size() == 1 && !Output.empty()) - OutFile = Output; - else - OutFile = RemoveSuffix(I->first) + OutputSuffix; - } else { - OutFile = Output; - } - // Initialize the input file std::string InFile(I->first); @@ -443,33 +418,35 @@ action = cd->Optimizer; // Get the optimization action, if needed, or error if appropriate - if (!action.program.empty() && !emitRawCode) { - if (action.isSet(REQUIRED_FLAG) || finalPhase == OPTIMIZATION) { - if (finalPhase == OPTIMIZATION) - actions.push_back(GetAction(cd,InFile,OutFile,OPTIMIZATION)); - else { - actions.push_back(GetAction(cd,InFile,TempOptimizerOut,OPTIMIZATION)); - InFile = TempOptimizerOut; - } - // ll -> bc Helper - if (action.isSet(OUTPUT_IS_ASM_FLAG)) { - /// The output of the translator is an LLVM Assembly program - /// We need to translate it to bytecode - Action* action = new Action(); - action->program = "llvm-as"; - action->args.push_back(InFile); - action->args.push_back("-f"); - action->args.push_back("-o"); - InFile += ".bc"; - action->args.push_back(InFile); - actions.push_back(action); + if (!emitRawCode) { + if (!action.program.empty()) { + if (action.isSet(REQUIRED_FLAG) || finalPhase == OPTIMIZATION) { + if (finalPhase == OPTIMIZATION) + actions.push_back(GetAction(cd,InFile,OutFile,OPTIMIZATION)); + else { + actions.push_back(GetAction(cd,InFile,TempOptimizerOut,OPTIMIZATION)); + InFile = TempOptimizerOut; + } + // ll -> bc Helper + if (action.isSet(OUTPUT_IS_ASM_FLAG)) { + /// The output of the translator is an LLVM Assembly program + /// We need to translate it to bytecode + Action* action = new Action(); + action->program = "llvm-as"; + action->args.push_back(InFile); + action->args.push_back("-f"); + action->args.push_back("-o"); + InFile += ".bc"; + action->args.push_back(InFile); + actions.push_back(action); + } } - } - } else if (finalPhase == OPTIMIZATION) { - error(cd->langName + " does not support optimization"); - } else if (action.isSet(REQUIRED_FLAG)) { - error(std::string("Don't know how to optimize ") + + } else if (finalPhase == OPTIMIZATION) { + error(cd->langName + " does not support optimization"); + } else if (action.isSet(REQUIRED_FLAG)) { + error(std::string("Don't know how to optimize ") + cd->langName + " files"); + } } // Short-circuit remaining actions if all they want is optimization @@ -478,13 +455,16 @@ /// ASSEMBLY PHASE action = cd->Assembler; - if (finalPhase == ASSEMBLY) { + if (finalPhase == ASSEMBLY || emitNativeCode) { if (emitNativeCode) { if (action.program.empty()) { error(std::string("Native Assembler not specified for ") + cd->langName + " files"); - } else { + } else if (finalPhase == ASSEMBLY) { actions.push_back(GetAction(cd,InFile,OutFile,ASSEMBLY)); + } else { + actions.push_back(GetAction(cd,InFile,TempAssemblerOut,ASSEMBLY)); + InFile = TempAssemblerOut; } } else { // Just convert back to llvm assembly with llvm-dis @@ -497,7 +477,13 @@ actions.push_back(action); } } + + // Short-circuit remaining actions if all they want is assembly output + if (finalPhase == ASSEMBLY) { ++I; continue; } + // Register the OutFile as a link candidate + LinkageItems.push_back(InFile); + // Go to next file to be processed ++I; } @@ -505,7 +491,61 @@ /// LINKING PHASE if (finalPhase == LINKING) { if (emitNativeCode) { + error("llvmc doesn't know how to link native code yet"); } else { + // First, we need to examine the files to ensure that they all contain + // bytecode files. Since the final output is bytecode, we can only + // link bytecode. + StringVector::const_iterator I = LinkageItems.begin(); + StringVector::const_iterator E = LinkageItems.end(); + StringVector lib_list; + while (I != E ) { + if (sys::FileIsReadable(*I)) { + if (CheckMagic(*I, "llvm")) { + // Examine the bytecode file for additional bytecode libraries to + // link in. + ModuleProvider* mp = getBytecodeModuleProvider(*I); + assert(mp!=0 && "Couldn't get module provider from bytecode file"); + Module* M = mp->releaseModule(); + assert(M!=0 && "Couldn't get module from module provider"); + Module::lib_iterator LI = M->lib_begin(); + Module::lib_iterator LE = M->lib_end(); + while ( LI != LE ) { + if (sys::FileIsReadable(*LI)) { + if (CheckMagic(*I,"llvm")) { + lib_list.push_back(*LI); + } else { + error(std::string("Library '") + *LI + "' required by file '" + + *I + "' is not an LLVM bytecode file"); + } + } else { + error(std::string("Library '") + *LI + "' required by file '" + + *I + "' is not readable"); + } + ++I; + } + } else { + error(std::string("File '") + *I + " is not an LLVM byte code file"); + } + } else { + error(std::string("File '") + *I + " is not readable"); + } + ++I; + } + + // We're emitting bytecode so let's build an llvm-link Action + Action* link = new Action(); + link->program = "llvm-link"; + link->args = LinkageItems; + link->args.insert(link->args.end(), lib_list.begin(), lib_list.end()); + link->args.push_back("-f"); + link->args.push_back("-o"); + link->args.push_back(OutFile); + if (timePasses) + link->args.push_back("-time-passes"); + if (showStats) + link->args.push_back("-stats"); + actions.push_back(link); } } @@ -524,7 +564,7 @@ ::sys::CleanupTempFile(TempOptimizerOut); // Cleanup temporary directory we created - if (::sys::FileReadable(TempDir)) + if (::sys::FileIsReadable(TempDir)) rmdir(TempDir.c_str()); } From reid at x10sys.com Tue Aug 24 08:58:48 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 24 Aug 2004 08:58:48 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvmc/ConfigLexer.l Message-ID: <200408241358.IAA20695@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvmc: ConfigLexer.l updated: 1.5 -> 1.6 --- Log message: - Rename and rearrange for clarity - Drop name tokens not used any more (GROKS_DASH_O) - Rename OUTPUT_IS_ASM as OUTPUT and allow "bytecode" and "assembly" as values of it. - Simplify handleContext (now handleNameContext) arguments and ensure that it returns OPTION tokens exactly as scanned. --- Diffs of the changes: (+55 -52) Index: llvm/tools/llvmc/ConfigLexer.l diff -u llvm/tools/llvmc/ConfigLexer.l:1.5 llvm/tools/llvmc/ConfigLexer.l:1.6 --- llvm/tools/llvmc/ConfigLexer.l:1.5 Sun Aug 22 13:02:13 2004 +++ llvm/tools/llvmc/ConfigLexer.l Tue Aug 24 08:58:37 2004 @@ -50,41 +50,36 @@ using namespace llvm; inline llvm::ConfigLexerTokens -handleContext(const char* tokenText, llvm::ConfigLexerTokens token) { - if (ConfigLexerState.in_value) { - ConfigLexerState.StringVal = tokenText; +handleNameContext(llvm::ConfigLexerTokens token) { + ConfigLexerState.StringVal = yytext; + if (ConfigLexerState.in_value) return OPTION; - } return token; } inline llvm::ConfigLexerTokens handleSubstitution(llvm::ConfigLexerTokens token) { - if (ConfigLexerState.in_value) + if (ConfigLexerState.in_value) { + ConfigLexerState.StringVal = yytext; return token; + } YY_FATAL_ERROR("Substitition tokens not allowed in names" ); return ERRORTOK; }; -inline llvm::ConfigLexerTokens handleBoolean(llvm::ConfigLexerTokens token) { +inline llvm::ConfigLexerTokens handleValueContext(llvm::ConfigLexerTokens token) { + ConfigLexerState.StringVal = yytext; if (ConfigLexerState.in_value) return token; - YY_FATAL_ERROR("Boolean values not allowed in names"); - return ERRORTOK; + return OPTION; } %} ASSEMBLER assembler|Assembler|ASSEMBLER -BadSubst \%[^iots][a-zA-Z]\% COMMAND command|Command|COMMAND -Comment \#[^\r\n]*\r?\n -NewLine \r?\n -Eq \= -EscNewLine \\\r?\n -GROKS_DASH_O groks_dash_O|Groks_Dash_O|GROKS_DASH_O LANG lang|Lang|LANG -LINKER linker|Linker|LINKER +LINKER linker|Linker|LINKER NAME name|Name|NAME OPT1 opt1|Opt1|OPT1 OPT2 opt2|Opt2|OPT2 @@ -92,25 +87,29 @@ OPT4 opt4|Opt4|OPT4 OPT5 opt5|Opt5|OPT5 OPTIMIZER optimizer|Optimizer|OPTIMIZER -OPTIMIZES optimizes|Optimizes|OPTIMIZES -Option [-A-Za-z0-9_:%+/\\|,][-A-Za-z0-9_:+/\\|,@]* -OUTPUT_IS_ASM output_is_asm|Output_Is_Asm|OUTPUT_IS_ASM +OUTPUT output|Output|OUTPUT PREPROCESSES preprocesses|PreProcesses|PREPROCESSES PREPROCESSOR preprocessor|PreProcessor|PREPROCESSOR REQUIRED required|Required|REQUIRED -Sep \. -String \"[^\"]*\" TRANSLATES translates|Translates|TRANSLATES TRANSLATOR translator|Translator|TRANSLATOR VERSION version|Version|VERSION + +True true|True|TRUE|on|On|ON|yes|Yes|YES +False false|False|FALSE|off|Off|OFF|no|No|NO +Bytecode bc|BC|bytecode|Bytecode|BYTECODE +Assembly asm|ASM|assembly|Assembly|ASSEMBLY + +BadSubst \%[^iots][a-zA-Z]\% +Comment \#[^\r\n]*\r?\n +NewLine \r?\n +Eq \= +EscNewLine \\\r?\n +Option [-A-Za-z0-9_:%+/\\|,][-A-Za-z0-9_:+/\\|,@]* +Sep \. +String \"[^\"]*\" White [ \t]* -True true|True|TRUE -False false|False|FALSE -On on|On|ON -Off off|Off|OFF -Yes yes|Yes|YES -No no|No|NO %% @@ -135,27 +134,32 @@ return EQUALS; } -{LANG} { return handleContext("lang",LANG); } -{PREPROCESSOR} { return handleContext("preprocessor",PREPROCESSOR); } -{TRANSLATOR} { return handleContext("translator",TRANSLATOR); } -{OPTIMIZER} { return handleContext("optimizer",OPTIMIZER); } -{ASSEMBLER} { return handleContext("assembler",ASSEMBLER); } -{LINKER} { return handleContext("linker",LINKER); } -{NAME} { return handleContext("name",NAME); } -{REQUIRED} { return handleContext("required",REQUIRED); } -{COMMAND} { return handleContext("command",COMMAND); } -{PREPROCESSES} { return handleContext("preprocesses",PREPROCESSES); } -{TRANSLATES} { return handleContext("translates",TRANSLATES); } -{OPTIMIZES} { return handleContext("optimizes",OPTIMIZES); } -{GROKS_DASH_O} { return handleContext("groks_dash_O",GROKS_DASH_O); } -{OUTPUT_IS_ASM} { return handleContext("output_ias_asm",OUTPUT_IS_ASM); } -{OPT1} { return handleContext("opt1",OPT1); } -{OPT2} { return handleContext("opt2",OPT2); } -{OPT3} { return handleContext("opt3",OPT3); } -{OPT4} { return handleContext("opt4",OPT4); } -{OPT5} { return handleContext("opt5",OPT5); } -{VERSION} { return handleContext("version",VERSION); } +{VERSION} { return handleNameContext(VERSION); } +{LANG} { return handleNameContext(LANG); } +{NAME} { return handleNameContext(NAME); } +{OPT1} { return handleNameContext(OPT1); } +{OPT2} { return handleNameContext(OPT2); } +{OPT3} { return handleNameContext(OPT3); } +{OPT4} { return handleNameContext(OPT4); } +{OPT5} { return handleNameContext(OPT5); } + +{PREPROCESSOR} { return handleNameContext(PREPROCESSOR); } +{COMMAND} { return handleNameContext(COMMAND); } +{REQUIRED} { return handleNameContext(REQUIRED); } + +{TRANSLATOR} { return handleNameContext(TRANSLATOR); } +{PREPROCESSES} { return handleNameContext(PREPROCESSES); } +{OUTPUT} { return handleNameContext(OUTPUT); } + +{OPTIMIZER} { return handleNameContext(OPTIMIZER); } +{TRANSLATES} { return handleNameContext(TRANSLATES); } + +{ASSEMBLER} { return handleNameContext(ASSEMBLER); } + +{LINKER} { return handleNameContext(LINKER); } + +%args% { return handleSubstitution(ARGS_SUBST); } %in% { return handleSubstitution(IN_SUBST); } %out% { return handleSubstitution(OUT_SUBST); } %time% { return handleSubstitution(TIME_SUBST); } @@ -163,12 +167,11 @@ %opt% { return handleSubstitution(OPT_SUBST); } %target% { return handleSubstitution(TARGET_SUBST); } {BadSubst} { YY_FATAL_ERROR("Invalid substitution token"); } -{True} { return handleBoolean(TRUETOK); } -{On} { return handleBoolean(TRUETOK); } -{Yes} { return handleBoolean(TRUETOK); } -{False} { return handleBoolean(FALSETOK); } -{Off} { return handleBoolean(FALSETOK); } -{No} { return handleBoolean(FALSETOK); } + +{Assembly} { return handleValueContext(ASSEMBLY); } +{Bytecode} { return handleValueContext(BYTECODE); } +{True} { return handleValueContext(TRUETOK); } +{False} { return handleValueContext(FALSETOK); } {Option} { ConfigLexerState.StringVal = yytext; return OPTION; } {String} { ConfigLexerState.StringVal = yytext+1; // Nuke start quote From reid at x10sys.com Tue Aug 24 08:59:45 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 24 Aug 2004 08:59:45 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvmc/ConfigLexer.h Message-ID: <200408241359.IAA20713@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvmc: ConfigLexer.h updated: 1.4 -> 1.5 --- Log message: - Alphabetize the list of token enumerators. - Drop old tokens, insert new tokens --- Diffs of the changes: (+32 -29) Index: llvm/tools/llvmc/ConfigLexer.h diff -u llvm/tools/llvmc/ConfigLexer.h:1.4 llvm/tools/llvmc/ConfigLexer.h:1.5 --- llvm/tools/llvmc/ConfigLexer.h:1.4 Sun Aug 22 13:02:41 2004 +++ llvm/tools/llvmc/ConfigLexer.h Tue Aug 24 08:59:35 2004 @@ -50,39 +50,42 @@ EOFTOK = 0, ///< Returned by Configlex when we hit end of file EOLTOK, ///< End of line ERRORTOK, ///< Error token - OPTION, ///< A command line option - SEPARATOR, ///< A configuration item separator + ARGS_SUBST, ///< THe substitution item %args% + ASSEMBLY, ///< The value "assembly" (and variants) + ASSEMBLER, ///< The name "assembler" (and variants) + BYTECODE, ///< The value "bytecode" (and variants) + COMMAND, ///< The name "command" (and variants) EQUALS, ///< The equals sign, = - TRUETOK, ///< A boolean true value (true/yes/on) FALSETOK, ///< A boolean false value (false/no/off) + IN_SUBST, ///< The substitution item %in% INTEGER, ///< An integer + LANG, ///< The name "lang" (and variants) + LIBPATHS, ///< The name "libpaths" (and variants) + LIBS, ///< The name "libs" (and variants) + LINKER, ///< The name "linker" (and variants) + NAME, ///< The name "name" (and variants) + OPT_SUBST, ///< The substitution item %opt% + OPTIMIZER, ///< The name "optimizer" (and variants) + OPTION, ///< A command line option + OPT1, ///< The name "opt1" (and variants) + OPT2, ///< The name "opt2" (and variants) + OPT3, ///< The name "opt3" (and variants) + OPT4, ///< The name "opt4" (and variants) + OPT5, ///< The name "opt5" (and variants) + OUT_SUBST, ///< The output substitution item %out% + OUTPUT, ///< The name "output" (and variants) + PREPROCESSES, ///< The name "preprocesses" (and variants) + PREPROCESSOR, ///< The name "preprocessor" (and variants) + REQUIRED, ///< The name "required" (and variants) + SEPARATOR, ///< A configuration item separator + STATS_SUBST, ///< The stats substitution item %stats% STRING, ///< A quoted string - IN_SUBST, ///< The input substitution item @in@ - OUT_SUBST, ///< The output substitution item @out@ - STATS_SUBST, ///< The stats substitution item @stats@ - TIME_SUBST, ///< The substitution item @time@ - OPT_SUBST, ///< The substitution item @opt@ - TARGET_SUBST, ///< The substitition item @target@ - LANG, ///< The item "lang" (and case variants) - PREPROCESSOR, ///< The item "preprocessor" (and case variants) - TRANSLATOR, ///< The item "translator" (and case variants) - OPTIMIZER, ///< The item "optimizer" (and case variants) - ASSEMBLER, ///< The item "assembler" (and case variants) - LINKER, ///< The item "linker" (and case variants) - NAME, ///< The item "name" (and case variants) - REQUIRED, ///< The item "required" (and case variants) - COMMAND, ///< The item "command" (and case variants) - PREPROCESSES, ///< The item "preprocesses" (and case variants) - TRANSLATES, ///< The item "translates" (and case variants) - OPTIMIZES, ///< The item "optimizes" (and case variants) - GROKS_DASH_O, ///< The item "groks_dash_O" (and case variants) - OUTPUT_IS_ASM,///< The item "outut_is_asm" (and case variants) - OPT1, ///< The item "opt1" (and case variants) - OPT2, ///< The item "opt2" (and case variants) - OPT3, ///< The item "opt3" (and case variants) - OPT4, ///< The item "opt4" (and case variants) - OPT5, ///< The item "opt5" (and case variants) - VERSION, ///< The item "version" (and case variants) + TARGET_SUBST, ///< The substitition item %target% + TIME_SUBST, ///< The substitution item %time% + TRANSLATES, ///< The name "translates" (and variants) + TRANSLATOR, ///< The name "translator" (and variants) + TRUETOK, ///< A boolean true value (true/yes/on) + VERSION, ///< The name "version" (and variants) }; extern ConfigLexerTokens Configlex(); From reid at x10sys.com Tue Aug 24 09:03:34 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 24 Aug 2004 09:03:34 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvmc/Configuration.cpp Message-ID: <200408241403.JAA20780@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvmc: Configuration.cpp updated: 1.9 -> 1.10 --- Log message: - Implement the %args% substitution - Implement parsing of the .output={bytecode|assembly} item. - Drop parsing support for translator.optimizes, translator.groks_dash_O, optimizer.groks_dash_O, translator.output_is_asm, optimizer.output_is_asm - Add parsing support for translator.output and optimizer.output - Add optimizer.required parsing support - Add linker.libs and linker.libpaths parsing support - Fix error messages to list correct set of tokens expected. - Rename FileReadable -> FileIsReadable (changed in CompilerDriver.cpp) --- Diffs of the changes: (+46 -39) Index: llvm/tools/llvmc/Configuration.cpp diff -u llvm/tools/llvmc/Configuration.cpp:1.9 llvm/tools/llvmc/Configuration.cpp:1.10 --- llvm/tools/llvmc/Configuration.cpp:1.9 Sun Aug 22 13:03:25 2004 +++ llvm/tools/llvmc/Configuration.cpp Tue Aug 24 09:03:23 2004 @@ -25,7 +25,7 @@ namespace sys { // From CompilerDriver.cpp (for now) - extern bool FileReadable(const std::string& fname); + extern bool FileIsReadable(const std::string& fname); } namespace llvm { @@ -155,6 +155,7 @@ bool parseSubstitution(CompilerDriver::StringVector& optList) { switch (token) { + case ARGS_SUBST: optList.push_back("%args%"); break; case IN_SUBST: optList.push_back("%in%"); break; case OUT_SUBST: optList.push_back("%out%"); break; case TIME_SUBST: optList.push_back("%time%"); break; @@ -256,11 +257,31 @@ confDat->PreProcessor.clear(CompilerDriver::REQUIRED_FLAG); break; default: - error("Expecting 'command' or 'required'"); + error("Expecting 'command' or 'required' but found '" + + ConfigLexerState.StringVal); break; } } + bool parseOutputFlag() { + if (next() == EQUALS) { + if (next() == ASSEMBLY) { + return true; + } else if (token == BYTECODE) { + return false; + } else { + error("Expecting output type value"); + return false; + } + if (next() != EOLTOK && token != 0) { + error("Extraneous tokens after output value"); + } + } + else + error("Expecting '='"); + return false; + } + void parseTranslator() { switch (next()) { case COMMAND: @@ -278,28 +299,17 @@ else confDat->Translator.clear(CompilerDriver::PREPROCESSES_FLAG); break; - case OPTIMIZES: - if (parseBoolean()) - confDat->Translator.set(CompilerDriver::OPTIMIZES_FLAG); - else - confDat->Translator.clear(CompilerDriver::OPTIMIZES_FLAG); - break; - case GROKS_DASH_O: - if (parseBoolean()) - confDat->Translator.set(CompilerDriver::GROKS_DASH_O_FLAG); - else - confDat->Translator.clear(CompilerDriver::GROKS_DASH_O_FLAG); - break; - case OUTPUT_IS_ASM: - if (parseBoolean()) + case OUTPUT: + if (parseOutputFlag()) confDat->Translator.set(CompilerDriver::OUTPUT_IS_ASM_FLAG); else confDat->Translator.clear(CompilerDriver::OUTPUT_IS_ASM_FLAG); break; default: - error("Expecting 'command', 'required', 'preprocesses', " - "'groks_dash_O' or 'optimizes'"); + error("Expecting 'command', 'required', 'preprocesses', or " + "'output' but found '" + ConfigLexerState.StringVal + + "' instead"); break; } } @@ -321,20 +331,22 @@ else confDat->Optimizer.clear(CompilerDriver::TRANSLATES_FLAG); break; - case GROKS_DASH_O: + case REQUIRED: if (parseBoolean()) - confDat->Optimizer.set(CompilerDriver::GROKS_DASH_O_FLAG); + confDat->Optimizer.set(CompilerDriver::REQUIRED_FLAG); else - confDat->Optimizer.clear(CompilerDriver::GROKS_DASH_O_FLAG); + confDat->Optimizer.clear(CompilerDriver::REQUIRED_FLAG); break; - case OUTPUT_IS_ASM: - if (parseBoolean()) + case OUTPUT: + if (parseOutputFlag()) confDat->Translator.set(CompilerDriver::OUTPUT_IS_ASM_FLAG); else confDat->Translator.clear(CompilerDriver::OUTPUT_IS_ASM_FLAG); break; default: - error("Expecting 'command' or 'groks_dash_O'"); + error(std::string("Expecting 'command', 'preprocesses', ") + + "'translates' or 'output' but found '" + + ConfigLexerState.StringVal + "' instead"); break; } } @@ -352,17 +364,12 @@ void parseLinker() { switch(next()) { - case COMMAND: - parseCommand(confDat->Linker); - break; - case GROKS_DASH_O: - if (parseBoolean()) - confDat->Linker.set(CompilerDriver::GROKS_DASH_O_FLAG); - else - confDat->Linker.clear(CompilerDriver::GROKS_DASH_O_FLAG); - break; + case LIBS: + break; //FIXME + case LIBPATHS: + break; //FIXME default: - error("Expecting 'command'"); + error("Expecting 'libs' or 'libpaths'"); break; } } @@ -415,7 +422,7 @@ if (conf) { dir_name = conf; dir_name += "/"; - if (!::sys::FileReadable(dir_name + ftype)) + if (!::sys::FileIsReadable(dir_name + ftype)) throw "Configuration file for '" + ftype + "' is not available."; } else { // Try the user's home directory @@ -423,14 +430,14 @@ if (home) { dir_name = home; dir_name += "/.llvm/etc/"; - if (!::sys::FileReadable(dir_name + ftype)) { + if (!::sys::FileIsReadable(dir_name + ftype)) { // Okay, try the LLVM installation directory dir_name = LLVM_ETCDIR; dir_name += "/"; - if (!::sys::FileReadable(dir_name + ftype)) { + if (!::sys::FileIsReadable(dir_name + ftype)) { // Okay, try the "standard" place dir_name = "/etc/llvm/"; - if (!::sys::FileReadable(dir_name + ftype)) { + if (!::sys::FileIsReadable(dir_name + ftype)) { throw "Configuration file for '" + ftype + "' is not available."; } } @@ -439,7 +446,7 @@ } } else { dir_name = configDir + "/"; - if (!::sys::FileReadable(dir_name + ftype)) { + if (!::sys::FileIsReadable(dir_name + ftype)) { throw "Configuration file for '" + ftype + "' is not available."; } } From reid at x10sys.com Tue Aug 24 09:04:17 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 24 Aug 2004 09:04:17 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvmc/Makefile Message-ID: <200408241404.JAA20798@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvmc: Makefile updated: 1.4 -> 1.5 --- Log message: Link with bcreader and vmcore. --- Diffs of the changes: (+1 -1) Index: llvm/tools/llvmc/Makefile diff -u llvm/tools/llvmc/Makefile:1.4 llvm/tools/llvmc/Makefile:1.5 --- llvm/tools/llvmc/Makefile:1.4 Fri Aug 20 04:21:51 2004 +++ llvm/tools/llvmc/Makefile Tue Aug 24 09:04:07 2004 @@ -8,7 +8,7 @@ ##===----------------------------------------------------------------------===## LEVEL = ../.. TOOLNAME = llvmc -USEDLIBS = support.a +USEDLIBS = bcreader vmcore support.a CONFIG_FILES = st ll include $(LEVEL)/Makefile.common From reid at x10sys.com Tue Aug 24 09:05:40 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 24 Aug 2004 09:05:40 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvmc/llvmc.cpp Message-ID: <200408241405.JAA20819@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvmc: llvmc.cpp updated: 1.7 -> 1.8 --- Log message: - Unify format of output messages - All errors throw std::string - Default output file name to a.out (if we're linking) --- Diffs of the changes: (+10 -7) Index: llvm/tools/llvmc/llvmc.cpp diff -u llvm/tools/llvmc/llvmc.cpp:1.7 llvm/tools/llvmc/llvmc.cpp:1.8 --- llvm/tools/llvmc/llvmc.cpp:1.7 Thu Aug 19 16:52:49 2004 +++ llvm/tools/llvmc/llvmc.cpp Tue Aug 24 09:05:30 2004 @@ -214,11 +214,14 @@ // Deal with unimplemented options. if (PipeCommands) - std::cerr << argv[0] << ": Not implemented yet: -pipe"; + throw "Not implemented yet: -pipe"; + + if (OutputFilename.empty()) + if (OptLevel == CompilerDriver::LINKING) + OutputFilename = "a.out"; + else + throw "An output file must be specified. Please use the -o option"; - // Default the output file, only if we're going to try to link - if (OutputFilename.empty() && OptLevel == CompilerDriver::LINKING) - OutputFilename = "a.out"; // Construct the ConfigDataProvider object LLVMC_ConfigDataProvider Provider; @@ -283,15 +286,15 @@ // Tell the driver to do its thing int result = CD.execute(InpList,OutputFilename); if (result != 0) { - std::cerr << argv[0] << ": Error executing actions. Terminated.\n"; + throw "Error executing actions. Terminated.\n"; return result; } // All is good, return success return 0; } catch (std::string& msg) { - std::cerr << msg << "\n"; + std::cerr << argv[0] << ": " << msg << "\n"; } catch (...) { - std::cerr << "Unexpected unknown exception occurred.\n"; + std::cerr << argv[0] << ": Unexpected unknown exception occurred.\n"; } } From reid at x10sys.com Tue Aug 24 09:24:24 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 24 Aug 2004 09:24:24 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvmc/ll st Message-ID: <200408241424.JAA20876@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvmc: ll updated: 1.4 -> 1.5 st updated: 1.4 -> 1.5 --- Log message: Adjustments for changes in the configuration language. --- Diffs of the changes: (+9 -19) Index: llvm/tools/llvmc/ll diff -u llvm/tools/llvmc/ll:1.4 llvm/tools/llvmc/ll:1.5 --- llvm/tools/llvmc/ll:1.4 Fri Aug 20 17:53:11 2004 +++ llvm/tools/llvmc/ll Tue Aug 24 09:24:14 2004 @@ -1,14 +1,12 @@ # LLVM Assembly Config File For llvmc + version="1.0" lang.name=LLVM Assembly preprocessor.command= preprocessor.required=false translator.command=llvm-as %in% -o %out% - translator.groks_dash_O=no translator.optimizes=no translator.preprocesses=true translator.required=TRUE - optimizer.command=opt %in% -o %out% - optimizer.groks_dash_O=no - optimizer.groks_optimization=yes + optimizer.command=opt %in% -o %out% %opt% %args% + optimizer.translates=no assembler.command=llc %in% -o %out% - linker.command=llvm-link %in% -o %out% Index: llvm/tools/llvmc/st diff -u llvm/tools/llvmc/st:1.4 llvm/tools/llvmc/st:1.5 --- llvm/tools/llvmc/st:1.4 Sun Aug 22 13:01:19 2004 +++ llvm/tools/llvmc/st Tue Aug 24 09:24:14 2004 @@ -43,11 +43,8 @@ # The translator is required to run. translator.required=true - # stkrc doesn't do any optimization, it just translates - translator.optimizes=no - # stkrc doesn't handle the -On options - translator.groks_dash_O=no + translator.output=bytecode ########################################################## # Optimizer definitions @@ -57,8 +54,7 @@ optimizer.command=opt %in% -o %out% %opt% %time% %stats% \ %args% - # opt doesn't (yet) grok -On - optimizer.groks_dash_O=no + optimizer.required = true # opt doesn't translate optimizer.translates = no @@ -66,14 +62,10 @@ # opt doesn't preprocess optimizer.preprocesses=no -########################################################## -# Assembler definitions -########################################################## - assembler.command=llc %in% -o %out% %target% \ - "-regalloc=linearscan" %time% %stats% + # opt produces bytecode + optimizer.output = bc ########################################################## -# Linker definitions +# Assembler definitions ########################################################## - linker.libs=stkr_runtime - linker.paths= + assembler.command=llc %in% -o %out% %target% %time% %stats% From reid at x10sys.com Tue Aug 24 11:31:11 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 24 Aug 2004 11:31:11 -0500 Subject: [llvm-commits] CVS: llvm/autoconf/configure.ac Message-ID: <200408241631.LAA21915@zion.cs.uiuc.edu> Changes in directory llvm/autoconf: configure.ac updated: 1.99 -> 1.100 --- Log message: Ensure that the examples get built. --- Diffs of the changes: (+1 -0) Index: llvm/autoconf/configure.ac diff -u llvm/autoconf/configure.ac:1.99 llvm/autoconf/configure.ac:1.100 --- llvm/autoconf/configure.ac:1.99 Fri Aug 20 04:08:57 2004 +++ llvm/autoconf/configure.ac Tue Aug 24 11:31:01 2004 @@ -40,6 +40,7 @@ dnl Do special configuration of Makefiles AC_CONFIG_MAKEFILE(Makefile) AC_CONFIG_MAKEFILE(Makefile.common) +AC_CONFIG_MAKEFILE(examples/Makefile) AC_CONFIG_MAKEFILE(lib/Makefile) AC_CONFIG_MAKEFILE(runtime/Makefile) AC_CONFIG_MAKEFILE(test/Makefile) From brukman at cs.uiuc.edu Tue Aug 24 11:32:32 2004 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Tue, 24 Aug 2004 11:32:32 -0500 Subject: [llvm-commits] CVS: llvm/Makefile configure Message-ID: <200408241632.LAA21940@zion.cs.uiuc.edu> Changes in directory llvm: Makefile updated: 1.27 -> 1.28 configure updated: 1.103 -> 1.104 --- Log message: Include the "examples" directory as optional. Update configure script to configure the examples/Makefile --- Diffs of the changes: (+35 -29) Index: llvm/Makefile diff -u llvm/Makefile:1.27 llvm/Makefile:1.28 --- llvm/Makefile:1.27 Thu Jun 24 13:19:42 2004 +++ llvm/Makefile Tue Aug 24 11:32:21 2004 @@ -11,7 +11,7 @@ ifneq ($(MAKECMDGOALS),tools-only) DIRS += runtime -OPTIONAL_DIRS = projects +OPTIONAL_DIRS = examples projects endif include $(LEVEL)/Makefile.common Index: llvm/configure diff -u llvm/configure:1.103 llvm/configure:1.104 --- llvm/configure:1.103 Fri Aug 20 04:10:31 2004 +++ llvm/configure Tue Aug 24 11:32:21 2004 @@ -1578,6 +1578,9 @@ ac_config_commands="$ac_config_commands Makefile.common" + ac_config_commands="$ac_config_commands examples/Makefile" + + ac_config_commands="$ac_config_commands lib/Makefile" @@ -4219,7 +4222,7 @@ ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 4222 "configure"' > conftest.$ac_ext + echo '#line 4225 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -5093,7 +5096,7 @@ # Provide some information about the compiler. -echo "$as_me:5096:" \ +echo "$as_me:5099:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -6124,11 +6127,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6127: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6130: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6131: \$? = $ac_status" >&5 + echo "$as_me:6134: \$? = $ac_status" >&5 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 @@ -6356,11 +6359,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6359: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6362: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6363: \$? = $ac_status" >&5 + echo "$as_me:6366: \$? = $ac_status" >&5 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 @@ -6423,11 +6426,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6426: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6429: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:6430: \$? = $ac_status" >&5 + echo "$as_me:6433: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -8541,7 +8544,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:10801: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:10802: \$? = $ac_status" >&5 + echo "$as_me:10805: \$? = $ac_status" >&5 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 @@ -10862,11 +10865,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:10865: $lt_compile\"" >&5) + (eval echo "\"\$as_me:10868: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:10869: \$? = $ac_status" >&5 + echo "$as_me:10872: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -12191,7 +12194,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:13117: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13118: \$? = $ac_status" >&5 + echo "$as_me:13121: \$? = $ac_status" >&5 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 @@ -13178,11 +13181,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13181: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13184: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13185: \$? = $ac_status" >&5 + echo "$as_me:13188: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -15144,11 +15147,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15147: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15150: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15151: \$? = $ac_status" >&5 + echo "$as_me:15154: \$? = $ac_status" >&5 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 @@ -15376,11 +15379,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15379: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15382: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15383: \$? = $ac_status" >&5 + echo "$as_me:15386: \$? = $ac_status" >&5 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 @@ -15443,11 +15446,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15446: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15449: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:15450: \$? = $ac_status" >&5 + echo "$as_me:15453: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -17561,7 +17564,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext < Changes in directory llvm/test/Regression/Transforms/FunctionResolve: 2003-10-21-GlobalTypeDifference.ll updated: 1.1 -> 1.2 --- Log message: Modify testcase to merit a warning, though no warning is still printed! --- Diffs of the changes: (+2 -2) Index: llvm/test/Regression/Transforms/FunctionResolve/2003-10-21-GlobalTypeDifference.ll diff -u llvm/test/Regression/Transforms/FunctionResolve/2003-10-21-GlobalTypeDifference.ll:1.1 llvm/test/Regression/Transforms/FunctionResolve/2003-10-21-GlobalTypeDifference.ll:1.2 --- llvm/test/Regression/Transforms/FunctionResolve/2003-10-21-GlobalTypeDifference.ll:1.1 Tue Oct 21 18:17:45 2003 +++ llvm/test/Regression/Transforms/FunctionResolve/2003-10-21-GlobalTypeDifference.ll Tue Aug 24 12:40:02 2004 @@ -1,7 +1,7 @@ ; RUN: llvm-as < %s | opt -funcresolve -disable-output 2>&1 | grep WARNING -%X = external global int -%Z = global int* %X +%X = external global {long, int } +%Z = global {long, int} * %X %X = global float 1.0 %Y = global float* %X From reid at x10sys.com Tue Aug 24 12:42:43 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 24 Aug 2004 12:42:43 -0500 Subject: [llvm-commits] CVS: llvm/utils/getsrcs.sh llvmgrep Message-ID: <200408241742.MAA22411@zion.cs.uiuc.edu> Changes in directory llvm/utils: getsrcs.sh updated: 1.18 -> 1.19 llvmgrep updated: 1.3 -> 1.4 --- Log message: Add the examples directory to these scripts. --- Diffs of the changes: (+2 -2) Index: llvm/utils/getsrcs.sh diff -u llvm/utils/getsrcs.sh:1.18 llvm/utils/getsrcs.sh:1.19 --- llvm/utils/getsrcs.sh:1.18 Sun Aug 15 17:54:31 2004 +++ llvm/utils/getsrcs.sh Tue Aug 24 12:42:33 2004 @@ -1,7 +1,7 @@ #!/bin/sh # This is useful because it prints out all of the source files. Useful for # greps. -find docs include lib tools utils projects -name \*.\[cdhylt\]\* | grep -v Lexer.cpp | \ +find docs include lib tools utils examples projects -name \*.\[cdhylt\]\* | grep -v Lexer.cpp | \ grep -v llvmAsmParser.cpp | grep -v llvmAsmParser.h | grep -v '~$' | \ grep -v '\.ll$' | grep -v .flc | grep -v Sparc.burm.c | grep -v '\.d$' |\ grep -v '\.dir$' | grep -v '\.la$' | \ Index: llvm/utils/llvmgrep diff -u llvm/utils/llvmgrep:1.3 llvm/utils/llvmgrep:1.4 --- llvm/utils/llvmgrep:1.3 Sun Aug 15 17:54:31 2004 +++ llvm/utils/llvmgrep Tue Aug 24 12:42:33 2004 @@ -5,7 +5,7 @@ TOPDIR=`pwd | sed -e 's#(.*/llvm).*#$1#'` if test -d "$TOPDIR" ; then cd $TOPDIR - find docs include lib tools utils projects -type f \ + find docs include lib tools utils examples projects -type f \ \( -path '*/doxygen/*' -o -path '*/Burg/*' \) -prune -o \ -name '*.[cdhylt]*' \ \! -name '*~' \ From lattner at cs.uiuc.edu Tue Aug 24 12:48:41 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 24 Aug 2004 12:48:41 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Message-ID: <200408241748.MAA13862@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: LiveIntervalAnalysis.cpp updated: 1.117 -> 1.118 --- Log message: Fix a bug in a previous checkin of mine, correcting Regression.CodeGen.Generic.2004-04-09-SameValueCoalescing.llx and the code size problem. This bug prevented us from doing most register coallesces. --- Diffs of the changes: (+1 -1) Index: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp diff -u llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.117 llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.118 --- llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.117 Sun Aug 15 17:23:09 2004 +++ llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Tue Aug 24 12:48:29 2004 @@ -661,7 +661,7 @@ if (MRegisterInfo::isVirtualRegister(RegB)) return RegClass != mf_->getSSARegMap()->getRegClass(RegB); else - return RegClass->contains(RegB); + return !RegClass->contains(RegB); } bool LiveIntervals::overlapsAliases(const LiveInterval *LHS, From reid at x10sys.com Tue Aug 24 12:52:45 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 24 Aug 2004 12:52:45 -0500 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Pass.cpp Message-ID: <200408241752.MAA22467@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Pass.cpp updated: 1.60 -> 1.61 --- Log message: Give the -time-passes tool option a global storage location so that its value can be discovered by the various LLVM tools. --- Diffs of the changes: (+4 -3) Index: llvm/lib/VMCore/Pass.cpp diff -u llvm/lib/VMCore/Pass.cpp:1.60 llvm/lib/VMCore/Pass.cpp:1.61 --- llvm/lib/VMCore/Pass.cpp:1.60 Wed Jul 7 16:22:05 2004 +++ llvm/lib/VMCore/Pass.cpp Tue Aug 24 12:52:35 2004 @@ -110,15 +110,16 @@ // amount of time each pass takes to execute. This only happens with // -time-passes is enabled on the command line. // -static cl::opt -EnableTiming("time-passes", +bool llvm::TimePassesIsEnabled = false; +static cl::opt +EnableTiming("time-passes", cl::location(TimePassesIsEnabled), cl::desc("Time each pass, printing elapsed time for each on exit")); // createTheTimeInfo - This method either initializes the TheTimeInfo pointer to // a non null value (if the -time-passes option is enabled) or it leaves it // null. It may be called multiple times. void TimingInfo::createTheTimeInfo() { - if (!EnableTiming || TheTimeInfo) return; + if (!TimePassesIsEnabled || TheTimeInfo) return; // Constructed the first time this is called, iff -time-passes is enabled. // This guarantees that the object will be constructed before static globals, From reid at x10sys.com Tue Aug 24 12:52:45 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 24 Aug 2004 12:52:45 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Pass.h Message-ID: <200408241752.MAA22470@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: Pass.h updated: 1.44 -> 1.45 --- Log message: Give the -time-passes tool option a global storage location so that its value can be discovered by the various LLVM tools. --- Diffs of the changes: (+5 -0) Index: llvm/include/llvm/Pass.h diff -u llvm/include/llvm/Pass.h:1.44 llvm/include/llvm/Pass.h:1.45 --- llvm/include/llvm/Pass.h:1.44 Tue Jun 8 12:44:21 2004 +++ llvm/include/llvm/Pass.h Tue Aug 24 12:52:35 2004 @@ -332,6 +332,11 @@ virtual void addToPassManager(PassManagerT *PM,AnalysisUsage &AU); }; +/// If the user specifies the -time-passes argument on an LLVM tool command line +/// then the value of this boolean will be true, otherwise false. +/// @brief This is the storage for the -time-passes option. +extern bool TimePassesIsEnabled; + } // End llvm namespace // Include support files that contain important APIs commonly used by Passes, From reid at x10sys.com Tue Aug 24 12:54:37 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 24 Aug 2004 12:54:37 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvmc/llvmc.cpp Message-ID: <200408241754.MAA22502@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvmc: llvmc.cpp updated: 1.8 -> 1.9 --- Log message: Get rid of error messages from CommandLine because -time-passes was defined twice. We make use of the new TimePassesIsEnabled global boolean value from Pass.h to access the value. --- Diffs of the changes: (+2 -4) Index: llvm/tools/llvmc/llvmc.cpp diff -u llvm/tools/llvmc/llvmc.cpp:1.8 llvm/tools/llvmc/llvmc.cpp:1.9 --- llvm/tools/llvmc/llvmc.cpp:1.8 Tue Aug 24 09:05:30 2004 +++ llvm/tools/llvmc/llvmc.cpp Tue Aug 24 12:54:26 2004 @@ -16,6 +16,7 @@ #include "CompilerDriver.h" #include "Configuration.h" +#include "llvm/Pass.h" #include "llvm/System/Signals.h" #include "Support/CommandLine.h" #include @@ -138,9 +139,6 @@ cl::opt TimeActions("time-actions", cl::Optional, cl::init(false), cl::desc("Print execution time for each action taken")); -cl::opt TimePasses("time-passes", cl::Optional, cl::init(false), - cl::desc("Print execution time for each optimization pass")); - cl::opt ShowStats("stats", cl::Optional, cl::init(false), cl::desc("Print statistics accumulated during optimization")); @@ -240,7 +238,7 @@ CD.setEmitNativeCode(Native); CD.setEmitRawCode(EmitRawCode); CD.setTimeActions(TimeActions); - CD.setTimePasses(TimePasses); + CD.setTimePasses(TimePassesIsEnabled); CD.setShowStats(ShowStats); CD.setKeepTemporaries(KeepTemporaries); CD.setLibraryPaths(LibPaths); From reid at x10sys.com Tue Aug 24 13:34:21 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 24 Aug 2004 13:34:21 -0500 Subject: [llvm-commits] CVS: llvm/docs/Lexicon.html Message-ID: <200408241834.NAA22756@zion.cs.uiuc.edu> Changes in directory llvm/docs: Lexicon.html updated: 1.3 -> 1.4 --- Log message: Added BURS. --- Diffs of the changes: (+15 -1) Index: llvm/docs/Lexicon.html diff -u llvm/docs/Lexicon.html:1.3 llvm/docs/Lexicon.html:1.4 --- llvm/docs/Lexicon.html:1.3 Mon Aug 23 23:13:17 2004 +++ llvm/docs/Lexicon.html Tue Aug 24 13:34:10 2004 @@ -30,6 +30,12 @@ + - B - + + BURS + + + - D - DSE @@ -69,6 +75,14 @@ + +
    +
    +
    BURS
    +
    Bottom Up Rewriting System
    +
    +
    +
    @@ -112,7 +126,7 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!">The LLVM Team
    The LLVM Compiler Infrastructure
    -Last modified: $Date: 2004/08/24 04:13:17 $ +Last modified: $Date: 2004/08/24 18:34:10 $ From lattner at cs.uiuc.edu Tue Aug 24 13:53:51 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 24 Aug 2004 13:53:51 -0500 Subject: [llvm-commits] CVS: llvm/docs/Lexicon.html Message-ID: <200408241853.NAA14023@apoc.cs.uiuc.edu> Changes in directory llvm/docs: Lexicon.html updated: 1.4 -> 1.5 --- Log message: Add some details --- Diffs of the changes: (+4 -2) Index: llvm/docs/Lexicon.html diff -u llvm/docs/Lexicon.html:1.4 llvm/docs/Lexicon.html:1.5 --- llvm/docs/Lexicon.html:1.4 Tue Aug 24 13:34:10 2004 +++ llvm/docs/Lexicon.html Tue Aug 24 13:53:39 2004 @@ -79,7 +79,9 @@
    BURS
    -
    Bottom Up Rewriting System
    +
    Bottom Up Rewriting System - A method of instruction selection for + code generation. An example is the BURG tool.
    @@ -126,7 +128,7 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!">The LLVM Team
    The LLVM Compiler Infrastructure
    -Last modified: $Date: 2004/08/24 18:34:10 $ +Last modified: $Date: 2004/08/24 18:53:39 $ From reid at x10sys.com Tue Aug 24 17:45:43 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 24 Aug 2004 17:45:43 -0500 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/Analyzer.cpp Message-ID: <200408242245.RAA24008@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Reader: Analyzer.cpp updated: 1.14 -> 1.15 --- Log message: Rearrange output a little to make it nicer. --- Diffs of the changes: (+17 -17) Index: llvm/lib/Bytecode/Reader/Analyzer.cpp diff -u llvm/lib/Bytecode/Reader/Analyzer.cpp:1.14 llvm/lib/Bytecode/Reader/Analyzer.cpp:1.15 --- llvm/lib/Bytecode/Reader/Analyzer.cpp:1.14 Sat Aug 21 15:58:19 2004 +++ llvm/lib/Bytecode/Reader/Analyzer.cpp Tue Aug 24 17:45:32 2004 @@ -341,7 +341,7 @@ if (os) *os << " } END BLOCK: Function\n"; currFunc->density = double(currFunc->byteSize) / - double(currFunc->numInstructions+currFunc->numBasicBlocks); + double(currFunc->numInstructions); if ( bca.progressiveVerify ) { try { @@ -671,14 +671,14 @@ print(Out, "Maximum Type Slot Number", bca.maxTypeSlot); print(Out, "Maximum Value Slot Number", bca.maxValueSlot); - print(Out, "File Density (bytes/def)", bca.fileDensity); - print(Out, "Globals Density (bytes/def)", bca.globalsDensity); - print(Out, "Function Density (bytes/func)", bca.functionDensity); - print(Out, "Number of VBR 32-bit Integers", bca.vbrCount32); - print(Out, "Number of VBR 64-bit Integers", bca.vbrCount64); - print(Out, "Number of VBR Compressed Bytes", bca.vbrCompBytes); - print(Out, "Number of VBR Expanded Bytes", bca.vbrExpdBytes); - print(Out, "VBR Savings", + print(Out, "Bytes Per Value ", bca.fileDensity); + print(Out, "Bytes Per Global", bca.globalsDensity); + print(Out, "Bytes Per Function", bca.functionDensity); + print(Out, "# of VBR 32-bit Integers", bca.vbrCount32); + print(Out, "# of VBR 64-bit Integers", bca.vbrCount64); + print(Out, "# of VBR Compressed Bytes", bca.vbrCompBytes); + print(Out, "# of VBR Expanded Bytes", bca.vbrExpdBytes); + print(Out, "Bytes Saved With VBR", double(bca.vbrExpdBytes)-double(bca.vbrCompBytes), double(bca.vbrExpdBytes)); @@ -695,19 +695,19 @@ Out << "\nFunction: " << I->second.name << "\n"; print(Out, "Type:", I->second.description); print(Out, "Byte Size", I->second.byteSize); + print(Out, "Basic Blocks", I->second.numBasicBlocks); print(Out, "Instructions", I->second.numInstructions); print(Out, "Long Instructions", I->second.longInstructions); + print(Out, "Operands", I->second.numOperands); print(Out, "Instruction Size", I->second.instructionSize); print(Out, "Average Instruction Size", double(I->second.instructionSize)/double(I->second.numInstructions)); - print(Out, "Basic Blocks", I->second.numBasicBlocks); - print(Out, "Operand", I->second.numOperands); - print(Out, "Function Density", I->second.density); - print(Out, "Number of VBR 32-bit Integers", I->second.vbrCount32); - print(Out, "Number of VBR 64-bit Integers", I->second.vbrCount64); - print(Out, "Number of VBR Compressed Bytes", I->second.vbrCompBytes); - print(Out, "Number of VBR Expanded Bytes", I->second.vbrExpdBytes); - print(Out, "VBR Savings", + print(Out, "Bytes Per Instruction", I->second.density); + print(Out, "# of VBR 32-bit Integers", I->second.vbrCount32); + print(Out, "# of VBR 64-bit Integers", I->second.vbrCount64); + print(Out, "# of VBR Compressed Bytes", I->second.vbrCompBytes); + print(Out, "# of VBR Expanded Bytes", I->second.vbrExpdBytes); + print(Out, "Bytes Saved With VBR", double(I->second.vbrExpdBytes)-double(I->second.vbrCompBytes), double(I->second.vbrExpdBytes)); ++I; From reid at x10sys.com Tue Aug 24 17:46:30 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 24 Aug 2004 17:46:30 -0500 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/ReaderWrappers.cpp Message-ID: <200408242246.RAA24026@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Reader: ReaderWrappers.cpp updated: 1.27 -> 1.28 --- Log message: Add a wrapper for extraction of the dependent libraries from a bytecode file. --- Diffs of the changes: (+14 -0) Index: llvm/lib/Bytecode/Reader/ReaderWrappers.cpp diff -u llvm/lib/Bytecode/Reader/ReaderWrappers.cpp:1.27 llvm/lib/Bytecode/Reader/ReaderWrappers.cpp:1.28 --- llvm/lib/Bytecode/Reader/ReaderWrappers.cpp:1.27 Sat Aug 21 15:52:03 2004 +++ llvm/lib/Bytecode/Reader/ReaderWrappers.cpp Tue Aug 24 17:46:20 2004 @@ -331,4 +331,18 @@ } } +bool llvm::GetBytecodeDependentLibraries(const std::string &fname, + std::vector& deplibs) { + try { + std::auto_ptr AMP( getBytecodeModuleProvider(fname)); + Module* M = AMP->releaseModule(); + deplibs = M->getLibraries(); + delete M; + return true; + } catch (...) { + deplibs.clear(); + return false; + } +} + // vim: sw=2 ai From reid at x10sys.com Tue Aug 24 17:47:50 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 24 Aug 2004 17:47:50 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Module.h Message-ID: <200408242247.RAA24057@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: Module.h updated: 1.48 -> 1.49 --- Log message: Provide a method for wholesale extraction of the dependent libraries. --- Diffs of the changes: (+3 -0) Index: llvm/include/llvm/Module.h diff -u llvm/include/llvm/Module.h:1.48 llvm/include/llvm/Module.h:1.49 --- llvm/include/llvm/Module.h:1.48 Sun Jul 25 16:28:19 2004 +++ llvm/include/llvm/Module.h Tue Aug 24 17:47:39 2004 @@ -243,6 +243,9 @@ /// @brief Remove a library from the list of dependent libraries inline void removeLibrary(const std::string& Lib); + /// @brief Get all the libraries + inline const LibraryListType& getLibraries() const { return LibraryList; } + void print(std::ostream &OS) const { print(OS, 0); } void print(std::ostream &OS, AssemblyAnnotationWriter *AAW) const; From reid at x10sys.com Tue Aug 24 17:49:17 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 24 Aug 2004 17:49:17 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Bytecode/Reader.h Message-ID: <200408242249.RAA24079@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Bytecode: Reader.h updated: 1.17 -> 1.18 --- Log message: Add a function that gets just the dependent libraries from a bytecode file. Doxygenify comments. --- Diffs of the changes: (+17 -7) Index: llvm/include/llvm/Bytecode/Reader.h diff -u llvm/include/llvm/Bytecode/Reader.h:1.17 llvm/include/llvm/Bytecode/Reader.h:1.18 --- llvm/include/llvm/Bytecode/Reader.h:1.17 Tue Jun 29 18:20:03 2004 +++ llvm/include/llvm/Bytecode/Reader.h Tue Aug 24 17:49:07 2004 @@ -43,21 +43,31 @@ const std::string &ModuleID="", BytecodeHandler* H = 0); -/// ParseBytecodeFile - Parse the given bytecode file -/// +/// @brief Parse the given bytecode file Module* ParseBytecodeFile(const std::string &Filename, std::string *ErrorStr = 0); -/// ParseBytecodeBuffer - Parse a given bytecode buffer -/// +/// @brief Parse a given bytecode buffer Module* ParseBytecodeBuffer(const unsigned char *Buffer, unsigned BufferSize, const std::string &ModuleID = "", std::string *ErrorStr = 0); -/// ReadArchiveFile - Read bytecode files from the specfied .a file, returning -/// true on error, or false on success. -/// +/// This function will read only the necessary parts of a bytecode file in order +/// to determine the list of dependent libraries encoded within it. The \p +/// deplibs parameter will contain a vector of strings of the bytecode module's +/// dependent libraries. +/// @returns true on success, false otherwise +/// @brief Get the list of dependent libraries from a bytecode file. +bool GetBytecodeDependentLibraries(const std::string &fileName, + std::vector& deplibs); + +/// Read bytecode files from the specfied archive (.a) file, convert them +/// to Module* and provide them in the \p Objects argument. If an error +/// occurs, ErrorStr (if non-null) will be set to a string explaining +/// the error. +/// @return true on error, false on success. +/// @brief Get a vector of Module* from a bytecode archive file bool ReadArchiveFile(const std::string &Filename, std::vector &Objects, std::string *ErrorStr = 0); From reid at x10sys.com Tue Aug 24 17:52:12 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 24 Aug 2004 17:52:12 -0500 Subject: [llvm-commits] CVS: llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp Message-ID: <200408242252.RAA24114@zion.cs.uiuc.edu> Changes in directory llvm/projects/Stacker/lib/compiler: StackerCompiler.cpp updated: 1.7 -> 1.8 --- Log message: Add dependent library support for Stacker. It now inserts "stkr_runtime" as a dependent library. --- Diffs of the changes: (+5 -1) Index: llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp diff -u llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp:1.7 llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp:1.8 --- llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp:1.7 Thu Jul 29 12:17:46 2004 +++ llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp Tue Aug 24 17:52:01 2004 @@ -114,6 +114,9 @@ // Create the module we'll return TheModule = new Module( CurFilename ); + // Tell the module about our runtime library + TheModule->addLibrary("stkr_runtime"); + // Create a type to represent the stack. This is the same as the LLVM // Assembly type [ 256 x long ] stack_type = ArrayType::get( Type::LongTy, stack_size ); @@ -245,12 +248,13 @@ TheInstance = this; // Parse the file. The parser (see StackParser.y) will call back to - // the StackCompiler via the "handle*" methods + // the StackerCompiler via the "handle*" methods Stackerparse(); // Avoid potential illegal use (TheInstance might be on the stack) TheInstance = 0; + } catch (...) { if (F != stdin) fclose(F); // Make sure to close file descriptor throw; // if an exception is thrown From reid at x10sys.com Tue Aug 24 17:53:23 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 24 Aug 2004 17:53:23 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvmc/llvmc.cpp Message-ID: <200408242253.RAA24136@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvmc: llvmc.cpp updated: 1.9 -> 1.10 --- Log message: Add the directory specified by LLVM_LIB_SEARCH_PATH to the list of directories to be searched during linking. --- Diffs of the changes: (+6 -0) Index: llvm/tools/llvmc/llvmc.cpp diff -u llvm/tools/llvmc/llvmc.cpp:1.9 llvm/tools/llvmc/llvmc.cpp:1.10 --- llvm/tools/llvmc/llvmc.cpp:1.9 Tue Aug 24 12:54:26 2004 +++ llvm/tools/llvmc/llvmc.cpp Tue Aug 24 17:53:13 2004 @@ -228,6 +228,12 @@ // Construct the CompilerDriver object CompilerDriver CD(Provider); + // If the LLVM_LIB_SEARCH_PATH environment variable is + // set, append it to the list of places to search for libraries + std::string srchPath = getenv("LLVM_LIB_SEARCH_PATH"); + if (!srchPath.empty()) + LibPaths.push_back(srchPath); + // Configure the driver based on options CD.setVerbose(Verbose); CD.setDebug(Debug); From reid at x10sys.com Tue Aug 24 17:54:43 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 24 Aug 2004 17:54:43 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvmc/CompilerDriver.cpp Message-ID: <200408242254.RAA24156@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvmc: CompilerDriver.cpp updated: 1.9 -> 1.10 --- Log message: Run the compilation actions before we attempt linking work. Correctly implement the dependent libraries feature so that linked bytecode files automatically include any dependent libraries they specify. --- Diffs of the changes: (+99 -42) Index: llvm/tools/llvmc/CompilerDriver.cpp diff -u llvm/tools/llvmc/CompilerDriver.cpp:1.9 llvm/tools/llvmc/CompilerDriver.cpp:1.10 --- llvm/tools/llvmc/CompilerDriver.cpp:1.9 Tue Aug 24 08:55:17 2004 +++ llvm/tools/llvmc/CompilerDriver.cpp Tue Aug 24 17:54:32 2004 @@ -279,6 +279,90 @@ return true; } +/// This method tries various variants of a linkage item's file +/// name to see if it can find an appropriate file to link with +/// in the directory specified. +std::string CompilerDriver::GetPathForLinkageItem(const std::string& link_item, + const std::string& dir) { + std::string fullpath(dir + "/" + link_item + ".o"); + if (::sys::FileIsReadable(fullpath)) + return fullpath; + fullpath = dir + "/" + link_item + ".bc"; + if (::sys::FileIsReadable(fullpath)) + return fullpath; + fullpath = dir + "/lib" + link_item + ".a"; + if (::sys::FileIsReadable(fullpath)) + return fullpath; + fullpath = dir + "/lib" + link_item + ".so"; + if (::sys::FileIsReadable(fullpath)) + return fullpath; + return ""; +} + +/// This method processes a linkage item. The item could be a +/// Bytecode file needing translation to native code and that is +/// dependent on other bytecode libraries, or a native code +/// library that should just be linked into the program. +bool CompilerDriver::ProcessLinkageItem(const std::string& link_item, + SetVector& set, + std::string& err) { + // First, see if the unadorned file name is not readable. If so, + // we must track down the file in the lib search path. + std::string fullpath; + if (!sys::FileIsReadable(link_item)) { + // First, look for the library using the -L arguments specified + // on the command line. + StringVector::iterator PI = LibraryPaths.begin(); + StringVector::iterator PE = LibraryPaths.end(); + while (PI != PE && fullpath.empty()) { + fullpath = GetPathForLinkageItem(link_item,*PI); + ++PI; + } + + // If we didn't find the file in any of the library search paths + // so we have to bail. No where else to look. + if (fullpath.empty()) { + err = std::string("Can't find linkage item '") + link_item + "'"; + return false; + } + } else { + fullpath = link_item; + } + + // If we got here fullpath is the path to the file, and its readable. + set.insert(fullpath); + + // If its an LLVM bytecode file ... + if (CheckMagic(fullpath, "llvm")) { + // Process the dependent libraries recursively + Module::LibraryListType modlibs; + if (GetBytecodeDependentLibraries(fullpath,modlibs)) { + // Traverse the dependent libraries list + Module::lib_iterator LI = modlibs.begin(); + Module::lib_iterator LE = modlibs.end(); + while ( LI != LE ) { + if (!ProcessLinkageItem(*LI,set,err)) { + if (err.empty()) { + err = std::string("Library '") + *LI + + "' is not valid for linking but is required by file '" + + fullpath + "'"; + } else { + err += " which is required by file '" + fullpath + "'"; + } + return false; + } + ++LI; + } + } else if (err.empty()) { + err = std::string("The dependent libraries could not be extracted from '") + + fullpath; + return false; + } + } + return true; +} + + int CompilerDriver::execute(const InputList& InpList, const std::string& Output ) { // Echo the configuration of options if we're running verbose @@ -488,6 +572,14 @@ ++I; } + /// RUN THE COMPILATION ACTIONS + std::vector::iterator aIter = actions.begin(); + while (aIter != actions.end()) { + if (!DoAction(*aIter)) + error("Action failed"); + aIter++; + } + /// LINKING PHASE if (finalPhase == LINKING) { if (emitNativeCode) { @@ -498,46 +590,19 @@ // link bytecode. StringVector::const_iterator I = LinkageItems.begin(); StringVector::const_iterator E = LinkageItems.end(); - StringVector lib_list; - while (I != E ) { - if (sys::FileIsReadable(*I)) { - if (CheckMagic(*I, "llvm")) { - // Examine the bytecode file for additional bytecode libraries to - // link in. - ModuleProvider* mp = getBytecodeModuleProvider(*I); - assert(mp!=0 && "Couldn't get module provider from bytecode file"); - Module* M = mp->releaseModule(); - assert(M!=0 && "Couldn't get module from module provider"); - Module::lib_iterator LI = M->lib_begin(); - Module::lib_iterator LE = M->lib_end(); - while ( LI != LE ) { - if (sys::FileIsReadable(*LI)) { - if (CheckMagic(*I,"llvm")) { - lib_list.push_back(*LI); - } else { - error(std::string("Library '") + *LI + "' required by file '" - + *I + "' is not an LLVM bytecode file"); - } - } else { - error(std::string("Library '") + *LI + "' required by file '" - + *I + "' is not readable"); - } - ++I; - } - } else { - error(std::string("File '") + *I + " is not an LLVM byte code file"); - } - } else { - error(std::string("File '") + *I + " is not readable"); - } + SetVector link_items; + std::string errmsg; + while (I != E && ProcessLinkageItem(*I,link_items,errmsg)) ++I; - } + + if (!errmsg.empty()) + error(errmsg); // We're emitting bytecode so let's build an llvm-link Action Action* link = new Action(); link->program = "llvm-link"; link->args = LinkageItems; - link->args.insert(link->args.end(), lib_list.begin(), lib_list.end()); + link->args.insert(link->args.end(), link_items.begin(), link_items.end()); link->args.push_back("-f"); link->args.push_back("-o"); link->args.push_back(OutFile); @@ -549,14 +614,6 @@ } } - /// RUN THE ACTIONS - std::vector::iterator aIter = actions.begin(); - while (aIter != actions.end()) { - if (!DoAction(*aIter)) - error("Action failed"); - aIter++; - } - if (!keepTemps) { // Cleanup files ::sys::CleanupTempFile(TempPreprocessorOut); From reid at x10sys.com Tue Aug 24 17:55:44 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 24 Aug 2004 17:55:44 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvmc/CompilerDriver.h Message-ID: <200408242255.RAA24175@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvmc: CompilerDriver.h updated: 1.8 -> 1.9 --- Log message: Insert declarations for two new functions that support the dependent libraries feature. --- Diffs of the changes: (+9 -0) Index: llvm/tools/llvmc/CompilerDriver.h diff -u llvm/tools/llvmc/CompilerDriver.h:1.8 llvm/tools/llvmc/CompilerDriver.h:1.9 --- llvm/tools/llvmc/CompilerDriver.h:1.8 Tue Aug 24 08:49:57 2004 +++ llvm/tools/llvmc/CompilerDriver.h Tue Aug 24 17:55:34 2004 @@ -16,6 +16,7 @@ #include #include +#include "Support/SetVector.h" namespace llvm { /// This class provides the high level interface to the LLVM Compiler Driver. @@ -194,8 +195,16 @@ private: Action* GetAction(ConfigData* cd, const std::string& input, const std::string& output, Phases phase ); + bool DoAction(Action* a); + std::string GetPathForLinkageItem(const std::string& link_item, + const std::string& dir); + + bool ProcessLinkageItem(const std::string& link_item, + SetVector& set, + std::string& err); + /// @} /// @name Data /// @{ From reid at x10sys.com Tue Aug 24 19:35:31 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 24 Aug 2004 19:35:31 -0500 Subject: [llvm-commits] CVS: llvm/docs/CommandGuide/llvm-bcanalyzer.pod Message-ID: <200408250035.TAA24948@zion.cs.uiuc.edu> Changes in directory llvm/docs/CommandGuide: llvm-bcanalyzer.pod updated: 1.3 -> 1.4 --- Log message: Document definitions and computations provided by llvm-bcanalyzer. --- Diffs of the changes: (+252 -1) Index: llvm/docs/CommandGuide/llvm-bcanalyzer.pod diff -u llvm/docs/CommandGuide/llvm-bcanalyzer.pod:1.3 llvm/docs/CommandGuide/llvm-bcanalyzer.pod:1.4 --- llvm/docs/CommandGuide/llvm-bcanalyzer.pod:1.3 Fri Jul 2 11:06:19 2004 +++ llvm/docs/CommandGuide/llvm-bcanalyzer.pod Tue Aug 24 19:35:20 2004 @@ -25,6 +25,7 @@ =head1 OPTIONS + =over =item B<-nodetails> @@ -55,12 +56,262 @@ If B succeeds, it will exit with 0. Otherwise, if an error occurs, it will exit with a non-zero value, usually 1. +=head1 SUMMARY OUTPUT DEFINITIONS + +The following items are always printed by llvm-bcanalyzer. They comprize the +summary output. + +=over + +=item B + +This just provides the name of the module for which bytecode analysis is being +generated. + +=item B + +The bytecode version (not LLVM version) of the file read by the analyzer. + +=item B + +The size, in bytes, of the entire bytecode file. + +=item B + +The size, in bytes, of the module block. Percentage is relative to File Size. + +=item B + +The size, in bytes, of all the function blocks. Percentage is relative to File +Size. + +=item B + +The size, in bytes, of the Global Types Pool. Percentage is relative to File +Size. This is the size of the definitions of all types in the bytecode file. + +=item B + +The size, in bytes, of the Constant Pool Blocks Percentage is relative to File +Size. + +=item B + +Ths size, in bytes, of the Global Variable Definitions and their initializers. +Percentage is relative to File Size. + +=item B + +The size, in bytes, of all the instruction lists in all the functions. +Percentage is relative to File Size. Note that this value is also included in +the Function Bytes. + +=item B + +The size, in bytes, of all the compaction tables in all the functions. +Percentage is relative to File Size. Note that this value is also included in +the Function Bytes. + +=item B + +The size, in bytes, of all the symbol tables in all the functions. Percentage is +relative to File Size. Note that this value is also included in the Function +Bytes. + +=item B + +The size, in bytes, of the list of dependent libraries in the module. Percentage +is relative to File Size. Note that this value is also included in the Module +Global Bytes. + +=item B + +The total number of blocks of any kind in the bytecode file. + +=item B + +The total number of function definitions in the bytecode file. + +=item B + +The total number of types defined in the Global Types Pool. + +=item B + +The total number of constants (of any type) defined in the Constant Pool. + +=item B + +The total number of basic blocks defined in all functions in the bytecode file. + +=item B + +The total number of instructions defined in all functions in the bytecode file. + +=item B + +The total number of long instructions defined in all functions in the bytecode +file. Long instructions are those taking greater than 4 bytes. Typically long +instructions are GetElementPtr with several indices, PHI nodes, and calls to +functions with large numbers of arguments. + +=item B + +The total number of operands used in all instructions in the bytecode file. + +=item B + +The total number of compaction tables in all functions in the bytecode file. + +=item B + +The total number of symbol tables in all functions in the bytecode file. + +=item B + +The total number of dependent libraries found in the bytecode file. + +=item B + +The total size of the instructions in all functions in the bytecode file. + +=item B + +The average number of bytes per instruction across all functions in the bytecode +file. This value is computed by dividing Total Instruction Size by Number Of +Instructions. + +=item B + +The maximum value used for a type's slot number. Larger slot number values take +more bytes to encode. + +=item B + +The maximum value used for a value's slot number. Larger slot number values take +more bytes to encode. + +=item B + +The average size of a Value definition (of any type). This is computed by +dividing File Size by the total number of values of any type. + +=item B + +The average size of a global definition (constants and global variables). + +=item B + +The average number of bytes per function definition. This is computed by +dividing Function Bytes by Number Of Functions. + +=item B<# of VBR 32-bit Integers> + +The total number of 32-bit integers encoded using the Variable Bit Rate +encoding scheme. + +=item B<# of VBR 64-bit Integers> + +The total number of 64-bit integers encoded using the Variable Bit Rate encoding +scheme. + +=item B<# of VBR Compressed Bytes> + +The total number of bytes consumed by the 32-bit and 64-bit integers that use +the Variable Bit Rate encoding scheme. + +=item B<# of VBR Expanded Bytes> + +The total number of bytes that would have been consumed by the 32-bit and 64-bit +integers had they not been compressed with the Variable Bit Rage encoding +scheme. + +=item B + +The total number of bytes saved by using the Variable Bit Rate encoding scheme. +The percentage is relative to # of VBR Expanded Bytes. + +=back + +=head1 DETAILED OUTPUT DEFINITIONS + +The following definitions occur only if the -nodetails option was not given. +The detailed output provides additional information on a per-function basis. + +=over + +=item B + +The type signature of the function. + +=item B + +The total number of bytes in the function's block. + +=item B + +The number of basic blocks defined by the function. + +=item B + +The number of instructions defined by the function. + +=item B + +The number of instructions using the long instruction format in the function. + +=item B + +The number of operands used by all instructions in the function. + +=item B + +The number of bytes consumed by instructions in the function. + +=item B + +The average number of bytes consumed by the instructions in the funtion. This +value is computed by dividing Instruction Size by Instructions. + +=item B + +The average number of bytes used by the function per instruction. This value is +computed by dividing Byte Size by Instructions. Note that this is not the same +as Average Instruction Size. It computes a number relative to the total function +size not just the size of the instruction list. + +=item B<# of VBR 32-bit Integers> + +The total number of 32-bit integers found in this function (for any use). + +=item B<# of VBR 64-bit Integers> + +The total number of 64-bit integers found in this function (for any use). + +=item B<# of VBR Compressed Bytes> + +The total number of bytes in this function consumed by the 32-bit and 64-bit +integers that use the Variable Bit Rate encoding scheme. + +=item B<# of VBR Expanded Bytes> + +The total number of bytes in this function that would have been consumed by +the 32-bit and 64-bit integers had they not been compressed with the Variable +Bit Rate encoding scheme. + +=item B + +The total number of bytes saved in this function by using the Variable Bit +Rate encoding scheme. The percentage is relative to # of VBR Expanded Bytes. + +=back + =head1 SEE ALSO L, L =head1 AUTHORS -Maintained by the LLVM Team (L). +Maintained by Reid Spencer (L). =cut From reid at x10sys.com Tue Aug 24 19:41:16 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 24 Aug 2004 19:41:16 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvmc/LICENSE.TXT Message-ID: <200408250041.TAA24985@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvmc: LICENSE.TXT added (r1.1) --- Log message: License file for llvmc. --- Diffs of the changes: (+6 -0) Index: llvm/tools/llvmc/LICENSE.TXT diff -c /dev/null llvm/tools/llvmc/LICENSE.TXT:1.1 *** /dev/null Tue Aug 24 19:41:16 2004 --- llvm/tools/llvmc/LICENSE.TXT Tue Aug 24 19:41:06 2004 *************** *** 0 **** --- 1,6 ---- + LLVM Compiler Driver (llvmc) + ------------------------------------------------------------------------------- + The LLVM Compiler Driver (llvmc) is licensed under the Illinois Open Source + License and has the following additional copyright: + + Copyright (C) 2004 eXtensible Systems, Inc. From reid at x10sys.com Tue Aug 24 19:45:45 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 24 Aug 2004 19:45:45 -0500 Subject: [llvm-commits] CVS: llvm/LICENSE.TXT Message-ID: <200408250045.TAA25020@zion.cs.uiuc.edu> Changes in directory llvm: LICENSE.TXT updated: 1.19 -> 1.20 --- Log message: Update to include tools/llvmc and lib/System as having additional copyright licenses. --- Diffs of the changes: (+2 -0) Index: llvm/LICENSE.TXT diff -u llvm/LICENSE.TXT:1.19 llvm/LICENSE.TXT:1.20 --- llvm/LICENSE.TXT:1.19 Thu Aug 5 15:36:00 2004 +++ llvm/LICENSE.TXT Tue Aug 24 19:45:35 2004 @@ -61,6 +61,8 @@ Program Directory ------- --------- +System Library llvm/lib/System +Compiler Driver llvm/tools/llvmc PowerPC Backend llvm/lib/Target/PowerPC Autoconf: llvm/autoconf llvm/projects/ModuleMaker/autoconf From reid at x10sys.com Tue Aug 24 19:48:12 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 24 Aug 2004 19:48:12 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/LICENSE.TXT Message-ID: <200408250048.TAA25065@zion.cs.uiuc.edu> Changes in directory llvm/lib/System: LICENSE.TXT added (r1.1) --- Log message: License for this library. --- Diffs of the changes: (+6 -0) Index: llvm/lib/System/LICENSE.TXT diff -c /dev/null llvm/lib/System/LICENSE.TXT:1.1 *** /dev/null Tue Aug 24 19:48:12 2004 --- llvm/lib/System/LICENSE.TXT Tue Aug 24 19:48:02 2004 *************** *** 0 **** --- 1,6 ---- + LLVM System Interface Library + ------------------------------------------------------------------------------- + The LLVM System Interface Library is licensed under the Illinois Open Source + License and has the following additional copyright: + + Copyright (C) 2004 eXtensible Systems, Inc. From llvm at cs.uiuc.edu Wed Aug 25 00:12:36 2004 From: llvm at cs.uiuc.edu (LLVM) Date: Wed, 25 Aug 2004 00:12:36 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/AIX/ Message-ID: <200408250512.AAA26666@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/AIX: --- Log message: Directory /var/cvs/llvm/llvm/lib/System/AIX added to the repository --- Diffs of the changes: (+0 -0) From llvm at cs.uiuc.edu Wed Aug 25 00:12:36 2004 From: llvm at cs.uiuc.edu (LLVM) Date: Wed, 25 Aug 2004 00:12:36 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Win32/ Message-ID: <200408250512.AAA26672@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Win32: --- Log message: Directory /var/cvs/llvm/llvm/lib/System/Win32 added to the repository --- Diffs of the changes: (+0 -0) From llvm at cs.uiuc.edu Wed Aug 25 00:12:36 2004 From: llvm at cs.uiuc.edu (LLVM) Date: Wed, 25 Aug 2004 00:12:36 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Unix/ Message-ID: <200408250512.AAA26669@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Unix: --- Log message: Directory /var/cvs/llvm/llvm/lib/System/Unix added to the repository --- Diffs of the changes: (+0 -0) From reid at x10sys.com Wed Aug 25 01:19:11 2004 From: reid at x10sys.com (Reid Spencer) Date: Wed, 25 Aug 2004 01:19:11 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Makefile Path.cpp Message-ID: <200408250619.BAA26945@zion.cs.uiuc.edu> Changes in directory llvm/lib/System: Makefile updated: 1.2 -> 1.3 Path.cpp updated: 1.2 -> 1.3 --- Log message: Initial implementation of the Path operating system concept. --- Diffs of the changes: (+73 -0) Index: llvm/lib/System/Makefile diff -u /dev/null llvm/lib/System/Makefile:1.3 --- /dev/null Wed Aug 25 01:19:11 2004 +++ llvm/lib/System/Makefile Wed Aug 25 01:19:01 2004 @@ -0,0 +1,13 @@ +##===- lib/Bytecode/Reader/Makefile ------------------------*- Makefile -*-===## +# +# 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. +# +##===----------------------------------------------------------------------===## +LEVEL = ../.. +LIBRARYNAME = system +BUILD_ARCHIVE = 1 + +include $(LEVEL)/Makefile.common Index: llvm/lib/System/Path.cpp diff -u /dev/null llvm/lib/System/Path.cpp:1.3 --- /dev/null Wed Aug 25 01:19:11 2004 +++ llvm/lib/System/Path.cpp Wed Aug 25 01:19:01 2004 @@ -0,0 +1,60 @@ +//===-- Path.cpp - Implement OS Path Concept --------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by Reid Spencer and is distributed under the +// University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This header file implements the operating system Path concept. +// +//===----------------------------------------------------------------------===// +#include "llvm/System/Path.h" + +namespace llvm { +namespace sys { + +//===----------------------------------------------------------------------===// +//=== WARNING: Implementation here must contain only TRULY operating system +//=== independent code. +//===----------------------------------------------------------------------===// + +bool +Path::is_valid() const { + if ( empty() ) return false; + return true; +} + +void +Path::fill( char* buffer, unsigned bufflen ) const { + unsigned pathlen = length(); + assert( bufflen > pathlen && "Insufficient buffer size" ); + unsigned copylen = pathlen copy(buffer, copylen, 0 ); + buffer[ copylen ] = 0; +} + +void +Path::make_directory() { + char end[2]; + end[0] = '/'; + end[1] = 0; + if ( empty() ) + this->assign( end ); + else if ( (*this)[length()-1] != '/') + this->append( end ); +} + +void +Path::make_file() { + if ( (*this)[length()-1] == '/') + this->erase( this->length()-1, 1 ); +} + +// Include the truly platform-specific parts of this class. +#include "platform/Path.cpp" +} +} + +// vim: sw=2 From reid at x10sys.com Wed Aug 25 01:19:12 2004 From: reid at x10sys.com (Reid Spencer) Date: Wed, 25 Aug 2004 01:19:12 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Unix/Path.cpp Unix.h Message-ID: <200408250619.BAA26953@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Unix: Path.cpp added (r1.1) Unix.h added (r1.1) --- Log message: Initial implementation of the Path operating system concept. --- Diffs of the changes: (+172 -0) Index: llvm/lib/System/Unix/Path.cpp diff -c /dev/null llvm/lib/System/Unix/Path.cpp:1.1 *** /dev/null Wed Aug 25 01:19:11 2004 --- llvm/lib/System/Unix/Path.cpp Wed Aug 25 01:19:01 2004 *************** *** 0 **** --- 1,138 ---- + //===- llvm/System/Unix/Path.cpp - Unix Path Implementation -----*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Reid Spencer and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file implements the Unix specific portion of the Path class. + // + //===----------------------------------------------------------------------===// + + //===----------------------------------------------------------------------===// + //=== WARNING: Implementation here must contain only generic UNIX code that + //=== is guaranteed to work on all UNIX variants. + //===----------------------------------------------------------------------===// + + #include "Unix.h" + #include + #include + + bool + Path::is_file() const { + if (!empty() && ((*this)[length()-1] != '/')) + return true; + return false; + } + + bool + Path::is_directory() const { + if ((!empty()) && ((*this)[length()-1] == '/')) + return true; + return false; + } + + void + Path::create( bool create_parents) { + if ( is_directory() ) { + if ( create_parents ) + this->create_directories( ); + this->create_directory( ); + } else if ( is_file() ) { + if ( create_parents ) + this->create_directories( ); + this->create_file( ); + } + } + + void + Path::remove() { + if ( is_directory() ) { + if ( exists() ) + this->remove_directory( ); + } else if ( is_file() ) + if ( exists() ) + this->remove_file( ); + } + + bool + Path::exists() { + char pathname[MAXPATHLEN]; + this->fill(pathname,MAXPATHLEN); + int lastchar = this->length() - 1 ; + if (pathname[lastchar] == '/') + pathname[lastchar] = 0; + return 0 == access(pathname, F_OK ); + } + + void + Path::create_directory( ) { + char pathname[MAXPATHLEN]; + this->fill(pathname,MAXPATHLEN); + int lastchar = this->length() - 1 ; + if (pathname[lastchar] == '/') + pathname[lastchar] = 0; + if (0 != mkdir(pathname, S_IRWXU | S_IRWXG)) + ThrowErrno(pathname); + } + + void + Path::create_directories() { + char pathname[MAXPATHLEN]; + this->fill(pathname,MAXPATHLEN); + int lastchar = this->length() - 1 ; + if (pathname[lastchar] == '/') + pathname[lastchar] = 0; + + char * next = index(pathname,'/'); + if ( pathname[0] == '/') + next = index(&pathname[1],'/'); + while ( next != 0 ) + { + *next = 0; + if (0 != access(pathname, F_OK | R_OK)) + if (0 != mkdir(pathname, S_IRWXU | S_IRWXG)) + ThrowErrno(pathname); + char* save = next; + next = index(pathname,'/'); + *save = '/'; + } + } + + void + Path::remove_directory() + { + char pathname[MAXPATHLEN]; + this->fill(pathname,MAXPATHLEN); + int lastchar = this->length() - 1 ; + if (pathname[lastchar] == '/') + pathname[lastchar] = 0; + if ( 0 != rmdir(pathname)) + ThrowErrno(pathname); + } + + void + Path::create_file() { + char pathname[MAXPATHLEN]; + this->fill(pathname,MAXPATHLEN); + int lastchar = this->length() - 1 ; + if (pathname[lastchar] == '/') + pathname[lastchar] = 0; + if (0 != creat(pathname, S_IRUSR | S_IWUSR)) + ThrowErrno(pathname); + } + + void + Path::remove_file() { + char pathname[MAXPATHLEN]; + this->fill(pathname,MAXPATHLEN); + int lastchar = this->length() - 1 ; + if (pathname[lastchar] == '/') + pathname[lastchar] = 0; + if (0 != unlink(pathname)) + ThrowErrno(pathname); + } + + // vim: sw=2 Index: llvm/lib/System/Unix/Unix.h diff -c /dev/null llvm/lib/System/Unix/Unix.h:1.1 *** /dev/null Wed Aug 25 01:19:12 2004 --- llvm/lib/System/Unix/Unix.h Wed Aug 25 01:19:01 2004 *************** *** 0 **** --- 1,34 ---- + //===- llvm/System/Unix/Unix.h - Common Unix Include File -----*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Reid Spencer and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file defines things specific to Unix implementations. + // + //===----------------------------------------------------------------------===// + + //===----------------------------------------------------------------------===// + //=== WARNING: Implementation here must contain only generic UNIX code that + //=== is guaranteed to work on all UNIX variants. + //===----------------------------------------------------------------------===// + + #include + #include + #include + #include + #include + #include + + inline void ThrowErrno(const std::string& prefix) { + #if defined __USE_XOPEN2K || defined __USE_MISC + char buffer[MAXPATHLEN]; + strerror_r(errno,buffer, MAXPATHLEN); + throw prefix + ": " + buffer; + #else + throw prefix + ": " + strerror(errno); + #endif + } From reid at x10sys.com Wed Aug 25 01:19:12 2004 From: reid at x10sys.com (Reid Spencer) Date: Wed, 25 Aug 2004 01:19:12 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Linux/Path.cpp Message-ID: <200408250619.BAA26948@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Linux: Path.cpp added (r1.1) --- Log message: Initial implementation of the Path operating system concept. --- Diffs of the changes: (+20 -0) Index: llvm/lib/System/Linux/Path.cpp diff -c /dev/null llvm/lib/System/Linux/Path.cpp:1.1 *** /dev/null Wed Aug 25 01:19:11 2004 --- llvm/lib/System/Linux/Path.cpp Wed Aug 25 01:19:01 2004 *************** *** 0 **** --- 1,20 ---- + //===- llvm/System/Linux/Path.cpp - Linux Path Implementation ---*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Reid Spencer and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file provides the Linux specific implementation of the Path class. + // + //===----------------------------------------------------------------------===// + + //===----------------------------------------------------------------------===// + //=== WARNING: Implementation here must contain only Linux specific code + //=== and must not be generic UNIX code (see ../Unix) + //===----------------------------------------------------------------------===// + + // Th..Th..Th..Tha's All Folks! + #include "../Unix/Path.cpp" From reid at x10sys.com Wed Aug 25 01:20:18 2004 From: reid at x10sys.com (Reid Spencer) Date: Wed, 25 Aug 2004 01:20:18 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/System/LICENSE.TXT Path.h Message-ID: <200408250620.BAA26978@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/System: LICENSE.TXT added (r1.1) Path.h updated: 1.2 -> 1.3 --- Log message: Initial implementation of the Path operating system concept. --- Diffs of the changes: (+166 -0) Index: llvm/include/llvm/System/LICENSE.TXT diff -c /dev/null llvm/include/llvm/System/LICENSE.TXT:1.1 *** /dev/null Wed Aug 25 01:20:17 2004 --- llvm/include/llvm/System/LICENSE.TXT Wed Aug 25 01:20:07 2004 *************** *** 0 **** --- 1,6 ---- + LLVM System Interface Library + ------------------------------------------------------------------------------- + The LLVM System Interface Library is licensed under the Illinois Open Source + License and has the following additional copyright: + + Copyright (C) 2004 eXtensible Systems, Inc. Index: llvm/include/llvm/System/Path.h diff -u /dev/null llvm/include/llvm/System/Path.h:1.3 --- /dev/null Wed Aug 25 01:20:18 2004 +++ llvm/include/llvm/System/Path.h Wed Aug 25 01:20:07 2004 @@ -0,0 +1,160 @@ +//===- llvm/System/Path.h ---------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by Reid Spencer and is distributed under the +// University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file declares the llvm::sys::Path class. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_SYSTEM_PATH_H +#define LLVM_SYSTEM_PATH_H + +#include + +namespace llvm { +namespace sys { + + /// This class provides an abstraction for the name of a path + /// to a file or directory in the filesystem and various basic operations + /// on it. + /// @since 1.4 + /// @brief An abstraction for operating system paths. + class Path : public std::string { + /// @name Constructors + /// @{ + public: + /// Creates a null (empty) path + /// @brief Default Constructor + Path () : std::string() {} + + /// Creates a path from char* + /// @brief char* converter + Path ( const char * name ) : std::string(name) { + assert(is_valid()); + } + + /// @brief std::string converter + Path ( const std::string& name ) : std::string(name){ + assert(is_valid()); + }; + + /// Copies the path with copy-on-write semantics. The \p this Path + /// will reference \p the that Path until one of them is modified + /// at which point a full copy is taken before the write. + /// @brief Copy Constructor + Path ( const Path & that ) : std::string(that) {} + + /// Releases storage associated with the Path object + /// @brief Destructor + ~Path ( void ) {}; + + /// @} + /// @name Operators + /// @{ + public: + /// Makes a copy of \p that to \p this with copy-on-write semantics. + /// @returns \p this + /// @brief Assignment Operator + Path & operator = ( const Path & that ) { + this->assign (that); + return *this; + } + + /// Comparies \p this Path with \p that Path for equality. + /// @returns true if \p this and \p that refer to the same item. + /// @brief Equality Operator + bool operator ==( const Path & that ) const { + return 0 == this->compare( that ) ; + } + + /// Comparies \p this Path with \p that Path for inequality. + /// @returns true if \p this and \p that refer to different items. + /// @brief Inequality Operator + bool operator !=( const Path & that ) const { + return 0 != this->compare( that ); + } + + /// @} + /// @name Accessors + /// @{ + public: + /// @returns true if the path is valid + /// @brief Determines if the path is valid (properly formed) or not. + bool is_valid() const; + + /// @returns true if the path could reference a file + /// @brief Determines if the path is valid for a file reference. + bool is_file() const; + + /// @returns true if the path could reference a directory + /// @brief Determines if the path is valid for a directory reference. + bool is_directory() const; + + /// @brief Fills and zero terminates a buffer with the path + void fill( char* buffer, unsigned len ) const; + + /// @} + /// @name Mutators + /// @{ + public: + /// This ensures that the pathname is terminated with a / + /// @brief Make the path reference a directory. + void make_directory(); + + /// This ensures that the pathname is not terminated with a / + /// @brief Makes the path reference a file. + void make_file(); + + /// the file system. + /// @returns true if the pathname references an existing file. + /// @brief Determines if the path is a file or directory in + bool exists(); + + /// The \p dirname is added to the end of the Path. + /// @param dirname A string providing the directory name to + /// be appended to the path. + /// @brief Appends the name of a directory. + void append_directory( const std::string& dirname ) { + this->append( dirname ); + make_directory(); + } + + /// The \p filename is added to the end of the Path. + /// @brief Appends the name of a file. + void append_file( const std::string& filename ) { + this->append( filename ); + } + + /// Directories will have no entries. Files will be zero length. If + /// the file or directory already exists, no error results. + /// @throws SystemException if any error occurs. + /// @brief Causes the file or directory to exist in the filesystem. + void create( bool create_parents = false ); + + void create_directory( void ); + void create_directories( void ); + void create_file( void ); + + /// Directories must be empty before they can be removed. If not, + /// an error will result. Files will be unlinked, even if another + /// process is using them. + /// @brief Removes the file or directory from the filesystem. + void remove( void ); + void remove_directory( void ); + void remove_file( void ); + + /// Find library. + void find_lib( const char * file ); + /// @} + }; +} +} + +// vim: sw=2 + +#endif From reid at x10sys.com Wed Aug 25 01:23:55 2004 From: reid at x10sys.com (Reid Spencer) Date: Wed, 25 Aug 2004 01:23:55 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Makefile Message-ID: <200408250623.BAA27001@zion.cs.uiuc.edu> Changes in directory llvm/lib/System: Makefile updated: 1.3 -> 1.4 --- Log message: Fix documentation. Make the library name LLVMsystem instead of just system so as to not to be confused with other "system" libraries. --- Diffs of the changes: (+4 -4) Index: llvm/lib/System/Makefile diff -u llvm/lib/System/Makefile:1.3 llvm/lib/System/Makefile:1.4 --- llvm/lib/System/Makefile:1.3 Wed Aug 25 01:19:01 2004 +++ llvm/lib/System/Makefile Wed Aug 25 01:23:45 2004 @@ -1,13 +1,13 @@ -##===- lib/Bytecode/Reader/Makefile ------------------------*- Makefile -*-===## +##===- lib/System/Makefile ---------------------------------*- Makefile -*-===## # # 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 was developed by Reid Spencer and is distributed under the +# University of Illinois Open Source License. See LICENSE.TXT for details. # ##===----------------------------------------------------------------------===## LEVEL = ../.. -LIBRARYNAME = system +LIBRARYNAME = LLVMsystem BUILD_ARCHIVE = 1 include $(LEVEL)/Makefile.common From gaeke at cs.uiuc.edu Wed Aug 25 13:43:29 2004 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Wed, 25 Aug 2004 13:43:29 -0500 Subject: [llvm-commits] CVS: reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp Message-ID: <200408251843.NAA22563@zion.cs.uiuc.edu> Changes in directory reopt/lib/LightWtProfiling: UnpackTraceFunction.cpp updated: 1.108 -> 1.109 --- Log message: do the header file shuffle --- Diffs of the changes: (+4 -4) Index: reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp diff -u reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.108 reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.109 --- reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.108 Sun Aug 22 22:10:31 2004 +++ reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp Wed Aug 25 13:43:18 2004 @@ -15,9 +15,9 @@ #include "reopt/UnpackTraceFunction.h" #include "reopt/TraceToFunction.h" -#include "reopt/MappingInfo.h" // for getBasicBlockInfo() -#include "llvm/CodeGen/MachineFunctionInfo.h" // for getStaticStackSize() -#include "llvm/CodeGen/MachineCodeForInstruction.h" +#include "reopt/MappingInfo.h" +#include "../../../../lib/Target/SparcV9/MachineFunctionInfo.h" +#include "../../../../lib/Target/SparcV9/MachineCodeForInstruction.h" #include "llvm/Support/CFG.h" #include "llvm/Module.h" #include "llvm/Instructions.h" @@ -35,7 +35,7 @@ // Ripped off from SparcV9PrologEpilogInserter static unsigned getStaticStackSize (MachineFunction &MF) { const TargetFrameInfo& frameInfo = *MF.getTarget().getFrameInfo(); - unsigned staticStackSize = MF.getInfo()->getStaticStackSize(); + unsigned staticStackSize = MF.getInfo()->getStaticStackSize(); if (staticStackSize < (unsigned)SparcV9FrameInfo::MinStackFrameSize) staticStackSize = SparcV9FrameInfo::MinStackFrameSize; if (unsigned padsz = staticStackSize % From gaeke at cs.uiuc.edu Wed Aug 25 14:00:53 2004 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Wed, 25 Aug 2004 14:00:53 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/CBackend/Writer.cpp Message-ID: <200408251900.OAA23117@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/CBackend: Writer.cpp updated: 1.193 -> 1.194 --- Log message: New version of Bill Wendling's PR33: http://llvm.cs.uiuc.edu/PR33 patch. --- Diffs of the changes: (+38 -24) Index: llvm/lib/Target/CBackend/Writer.cpp diff -u llvm/lib/Target/CBackend/Writer.cpp:1.193 llvm/lib/Target/CBackend/Writer.cpp:1.194 --- llvm/lib/Target/CBackend/Writer.cpp:1.193 Mon Aug 9 19:19:16 2004 +++ llvm/lib/Target/CBackend/Writer.cpp Wed Aug 25 14:00:42 2004 @@ -557,30 +557,40 @@ Out << "(*(" << (FPC->getType() == Type::FloatTy ? "float" : "double") << "*)&FPConstant" << I->second << ")"; } else { - std::string Num; -#if HAVE_PRINTF_A - // Print out the constant as a floating point number. - char Buffer[100]; - sprintf(Buffer, "%a", FPC->getValue()); - Num = Buffer; -#else - Num = ftostr(FPC->getValue()); -#endif - if (IsNAN(FPC->getValue())) { // The value is NaN + + // The prefix for a quiet NaN is 0x7FF8. For a signalling NaN, + // it's 0x7ff4. + const unsigned long QuietNaN = 0x7ff8UL; + const unsigned long SignalNaN = 0x7ff4UL; + + // We need to grab the first part of the FP # + union { + double d; + uint64_t ll; + } DHex; + char Buffer[100]; + + DHex.d = FPC->getValue(); + sprintf(Buffer, "0x%llx", DHex.ll); + + std::string Num(&Buffer[0], &Buffer[6]); + unsigned long Val = strtoul(Num.c_str(), 0, 16); + if (FPC->getType() == Type::FloatTy) - Out << "LLVM_NANF(\"0\") /*nan*/ "; + Out << "LLVM_NAN" << (Val == QuietNaN ? "" : "S") << "F(\"" + << Buffer << "\") /*nan*/ "; else - Out << "LLVM_NAN(\"0\") /*nan*/ "; + Out << "LLVM_NAN" << (Val == QuietNaN ? "" : "S") << "(\"" + << Buffer << "\") /*nan*/ "; } else if (IsInf(FPC->getValue())) { // The value is Inf if (FPC->getValue() < 0) Out << "-"; - if (FPC->getType() == Type::FloatTy) - Out << "LLVM_INFF /*inf*/ "; - else - Out << "LLVM_INF /*inf*/ "; + Out << "LLVM_INF" << (FPC->getType() == Type::FloatTy ? "F" : "") + << " /*inf*/ "; } else { + std::string Num = ftostr(FPC->getValue()); Out << Num; } } @@ -752,15 +762,19 @@ // // Similar to __builtin_inf, except the return type is float. Out << "#ifdef __GNUC__\n" - << "#define LLVM_NAN(NanStr) __builtin_nan(NanStr) /* Double */\n" - << "#define LLVM_NANF(NanStr) __builtin_nan(NanStr) /* Float */\n" - << "#define LLVM_INF __builtin_inf() /* Double */\n" - << "#define LLVM_INFF __builtin_inff() /* Float */\n" + << "#define LLVM_NAN(NanStr) __builtin_nan(NanStr) /* Double */\n" + << "#define LLVM_NANF(NanStr) __builtin_nanf(NanStr) /* Float */\n" + << "#define LLVM_NANS(NanStr) __builtin_nans(NanStr) /* Double */\n" + << "#define LLVM_NANSF(NanStr) __builtin_nansf(NanStr) /* Float */\n" + << "#define LLVM_INF __builtin_inf() /* Double */\n" + << "#define LLVM_INFF __builtin_inff() /* Float */\n" << "#else\n" - << "#define LLVM_NAN(NanStr) ((double)0.0) /* Double */\n" - << "#define LLVM_NANF(NanStr) 0.0F /* Float */\n" - << "#define LLVM_INF ((double)0.0) /* Double */\n" - << "#define LLVM_INFF 0.0F /* Float */\n" + << "#define LLVM_NAN(NanStr) ((double)0.0) /* Double */\n" + << "#define LLVM_NANF(NanStr) 0.0F /* Float */\n" + << "#define LLVM_NANS(NanStr) ((double)0.0) /* Double */\n" + << "#define LLVM_NANSF(NanStr) 0.0F /* Float */\n" + << "#define LLVM_INF ((double)0.0) /* Double */\n" + << "#define LLVM_INFF 0.0F /* Float */\n" << "#endif\n"; } From gaeke at cs.uiuc.edu Wed Aug 25 14:00:53 2004 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Wed, 25 Aug 2004 14:00:53 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/CBackend/2003-10-12-NANGlobalInits.ll Message-ID: <200408251900.OAA23120@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/CBackend: 2003-10-12-NANGlobalInits.ll updated: 1.1 -> 1.2 --- Log message: New version of Bill Wendling's PR33: http://llvm.cs.uiuc.edu/PR33 patch. --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/CodeGen/CBackend/2003-10-12-NANGlobalInits.ll diff -u llvm/test/Regression/CodeGen/CBackend/2003-10-12-NANGlobalInits.ll:1.1 llvm/test/Regression/CodeGen/CBackend/2003-10-12-NANGlobalInits.ll:1.2 --- llvm/test/Regression/CodeGen/CBackend/2003-10-12-NANGlobalInits.ll:1.1 Sun Oct 12 02:31:25 2003 +++ llvm/test/Regression/CodeGen/CBackend/2003-10-12-NANGlobalInits.ll Wed Aug 25 14:00:42 2004 @@ -1,3 +1,3 @@ ; This is a non-normal FP value: it's a nan. %NAN = global { float } { float 0x7FF8000000000000 } - +%NANs = global { float } { float 0x7FF4000000000000 } From gaeke at cs.uiuc.edu Wed Aug 25 14:37:36 2004 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Wed, 25 Aug 2004 14:37:36 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/CBackend/Writer.cpp Message-ID: <200408251937.OAA31996@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/CBackend: Writer.cpp updated: 1.194 -> 1.195 --- Log message: Previous checkin broke printf(%a) support for fp constants-- re-fix it. --- Diffs of the changes: (+9 -1) Index: llvm/lib/Target/CBackend/Writer.cpp diff -u llvm/lib/Target/CBackend/Writer.cpp:1.194 llvm/lib/Target/CBackend/Writer.cpp:1.195 --- llvm/lib/Target/CBackend/Writer.cpp:1.194 Wed Aug 25 14:00:42 2004 +++ llvm/lib/Target/CBackend/Writer.cpp Wed Aug 25 14:37:26 2004 @@ -590,7 +590,15 @@ Out << "LLVM_INF" << (FPC->getType() == Type::FloatTy ? "F" : "") << " /*inf*/ "; } else { - std::string Num = ftostr(FPC->getValue()); + std::string Num; +#if HAVE_PRINTF_A + // Print out the constant as a floating point number. + char Buffer[100]; + sprintf(Buffer, "%a", FPC->getValue()); + Num = Buffer; +#else + Num = ftostr(FPC->getValue()); +#endif Out << Num; } } From gaeke at cs.uiuc.edu Wed Aug 25 15:58:52 2004 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Wed, 25 Aug 2004 15:58:52 -0500 Subject: [llvm-commits] CVS: llvm-www/Developers.html Message-ID: <200408252058.PAA06913@zion.cs.uiuc.edu> Changes in directory llvm-www: Developers.html updated: 1.6 -> 1.7 --- Log message: add alkis --- Diffs of the changes: (+4 -0) Index: llvm-www/Developers.html diff -u llvm-www/Developers.html:1.6 llvm-www/Developers.html:1.7 --- llvm-www/Developers.html:1.6 Thu Aug 19 23:23:16 2004 +++ llvm-www/Developers.html Wed Aug 25 15:58:42 2004 @@ -44,6 +44,10 @@ alt="Dogbert" title="Dogbert"/> + Alkis Evlogimenos + no image yet + + Brian Gaeke Changes in directory llvm-www: Developers.html updated: 1.7 -> 1.8 --- Log message: Add photo --- Diffs of the changes: (+4 -2) Index: llvm-www/Developers.html diff -u llvm-www/Developers.html:1.7 llvm-www/Developers.html:1.8 --- llvm-www/Developers.html:1.7 Wed Aug 25 15:58:42 2004 +++ llvm-www/Developers.html Wed Aug 25 21:15:48 2004 @@ -44,8 +44,10 @@ alt="Dogbert" title="Dogbert"/> - Alkis Evlogimenos - no image yet + Alkis Evlogimenos + alkis Brian Gaeke From alkis at cs.uiuc.edu Wed Aug 25 21:18:35 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Wed, 25 Aug 2004 21:18:35 -0500 Subject: [llvm-commits] CVS: llvm-www/Developers.html Message-ID: <200408260218.VAA27864@niobe.cs.uiuc.edu> Changes in directory llvm-www: Developers.html updated: 1.8 -> 1.9 --- Log message: Fix photo url --- Diffs of the changes: (+1 -1) Index: llvm-www/Developers.html diff -u llvm-www/Developers.html:1.8 llvm-www/Developers.html:1.9 --- llvm-www/Developers.html:1.8 Wed Aug 25 21:15:48 2004 +++ llvm-www/Developers.html Wed Aug 25 21:18:25 2004 @@ -46,7 +46,7 @@ Alkis Evlogimenos alkis From alkis at cs.uiuc.edu Wed Aug 25 22:37:38 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Wed, 25 Aug 2004 22:37:38 -0500 Subject: [llvm-commits] CVS: llvm/include/Support/DenseMap.h Message-ID: <200408260337.WAA08270@zion.cs.uiuc.edu> Changes in directory llvm/include/Support: DenseMap.h updated: 1.3 -> 1.4 --- Log message: Add default index functor (an identity functor). You could use a vector directly to get the same functionality but using a DenseMap makes the code more readable IMO. --- Diffs of the changes: (+18 -12) Index: llvm/include/Support/DenseMap.h diff -u llvm/include/Support/DenseMap.h:1.3 llvm/include/Support/DenseMap.h:1.4 --- llvm/include/Support/DenseMap.h:1.3 Wed Feb 25 23:00:15 2004 +++ llvm/include/Support/DenseMap.h Wed Aug 25 22:37:28 2004 @@ -24,39 +24,45 @@ namespace llvm { -template -class DenseMap { + struct IdentityFunctor : std::unary_function { + unsigned operator()(unsigned Index) const { + return Index; + } + }; + + template + class DenseMap { typedef typename ToIndexT::argument_type IndexT; typedef std::vector StorageT; StorageT storage_; T nullVal_; ToIndexT toIndex_; -public: + public: DenseMap() : nullVal_(T()) { } explicit DenseMap(const T& val) : nullVal_(val) { } typename StorageT::reference operator[](IndexT n) { - assert(toIndex_(n) < storage_.size() && "index out of bounds!"); - return storage_[toIndex_(n)]; + assert(toIndex_(n) < storage_.size() && "index out of bounds!"); + return storage_[toIndex_(n)]; } typename StorageT::const_reference operator[](IndexT n) const { - assert(toIndex_(n) < storage_.size() && "index out of bounds!"); - return storage_[toIndex_(n)]; + assert(toIndex_(n) < storage_.size() && "index out of bounds!"); + return storage_[toIndex_(n)]; } void clear() { - storage_.clear(); + storage_.clear(); } void grow(IndexT n) { - unsigned NewSize = toIndex_(n) + 1; - if (NewSize > storage_.size()) - storage_.resize(NewSize, nullVal_); + unsigned NewSize = toIndex_(n) + 1; + if (NewSize > storage_.size()) + storage_.resize(NewSize, nullVal_); } -}; + }; } // End llvm namespace From reid at x10sys.com Thu Aug 26 00:58:30 2004 From: reid at x10sys.com (Reid Spencer) Date: Thu, 26 Aug 2004 00:58:30 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Unix/README.txt Message-ID: <200408260558.AAA08767@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Unix: README.txt added (r1.1) --- Log message: Add a README explaining the intended content of this directory. --- Diffs of the changes: (+16 -0) Index: llvm/lib/System/Unix/README.txt diff -c /dev/null llvm/lib/System/Unix/README.txt:1.1 *** /dev/null Thu Aug 26 00:58:30 2004 --- llvm/lib/System/Unix/README.txt Thu Aug 26 00:58:20 2004 *************** *** 0 **** --- 1,16 ---- + llvm/lib/System/Unix README + =========================== + + This directory provides implementations of the lib/System classes that + are common to two or more variants of UNIX. For example, the directory + structure underneath this directory could look like this: + + Unix - only code that is truly generic to all UNIX platforms + Posix - code that is specific to Posix variants of UNIX + SUS - code that is specific to the Singule Unix Specification + SysV - code that is specific to System V variants of UNIX + + As a rule, only those directories actually needing to be created should be + created. Also, further subdirectories could be created to reflect versions of + the various standards. For example, under SUS there could be v1, v2, and v3 + subdirectories to reflect the three major versions of SUS. From reid at x10sys.com Thu Aug 26 02:41:51 2004 From: reid at x10sys.com (Reid Spencer) Date: Thu, 26 Aug 2004 02:41:51 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/README.txt Message-ID: <200408260741.CAA09124@zion.cs.uiuc.edu> Changes in directory llvm/lib/System: README.txt updated: 1.2 -> 1.3 --- Log message: First cut at a README for lib/System explaining the #inclusion rules and design criteria. --- Diffs of the changes: (+96 -0) Index: llvm/lib/System/README.txt diff -u /dev/null llvm/lib/System/README.txt:1.3 --- /dev/null Thu Aug 26 02:41:51 2004 +++ llvm/lib/System/README.txt Thu Aug 26 02:41:41 2004 @@ -0,0 +1,96 @@ +Design Of lib/System +==================== + +The software in this directory is designed to completely shield LLVM from any +and all operating system specific functionality. It is not intended to be a +complete operating system wrapper (such as ACE), but only to provide the +functionality necessary to support LLVM. + +The software located here, of necessity, has very specific and stringent design +rules. Violation of these rules means that cracks in the shield could form and +the primary goal of the library is defeated. By consistently using this library, +LLVM becomes more easily ported to new platforms since (hopefully) the only thing +requiring porting is this library. + +Complete documentation for the library can be found in the file: + llvm/docs/SystemLibrary.html +or at this URL: + http://llvm.org/docs/SystemLibrary.html + +However, for the impatient, here's a high level summary of the design rules: + +1. No functions are declared with throw specifications. This is on purpose to + make sure that additional exception handling code is not introduced by the + compiler. + +2. On error only an instance of std::string that explains the error and possibly + the context of the error may be thrown. + +3. Error messages should do whatever is necessary to get a readable message from + the operating system about the error. For example, on UNIX the strerror_r + function ought to be used. + +4. Entry points into the library should be fairly high level and aimed at + completing some task needed by LLVM. There should *not* be a 1-to-1 + relationship between operating system calls and the library's interface. + Certain implementations of the + +5. The implementation of an 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. + +6. 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. + +7. 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. + +8. 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. + +9. The library does not attempt to shield LLVM from the C++ standard library or + standard template library. These libraries are considered to be platform + agnostic already. + +10. LLVM should not include *any* system headers anywhere except in lib/System. + +11. lib/System must *not* expose *any* system headers through its interface. From reid at x10sys.com Thu Aug 26 02:43:43 2004 From: reid at x10sys.com (Reid Spencer) Date: Thu, 26 Aug 2004 02:43:43 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Unix/README.txt Message-ID: <200408260743.CAA09148@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Unix: README.txt updated: 1.1 -> 1.2 --- Log message: Fix a typo. --- Diffs of the changes: (+1 -1) Index: llvm/lib/System/Unix/README.txt diff -u llvm/lib/System/Unix/README.txt:1.1 llvm/lib/System/Unix/README.txt:1.2 --- llvm/lib/System/Unix/README.txt:1.1 Thu Aug 26 00:58:20 2004 +++ llvm/lib/System/Unix/README.txt Thu Aug 26 02:43:33 2004 @@ -7,7 +7,7 @@ Unix - only code that is truly generic to all UNIX platforms Posix - code that is specific to Posix variants of UNIX - SUS - code that is specific to the Singule Unix Specification + SUS - code that is specific to the Single Unix Specification SysV - code that is specific to System V variants of UNIX As a rule, only those directories actually needing to be created should be From gaeke at cs.uiuc.edu Thu Aug 26 12:09:46 2004 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Thu, 26 Aug 2004 12:09:46 -0500 (CDT) Subject: [llvm-commits] CVS: reopt/lib/TraceToFunction/TraceToFunction.cpp Message-ID: <200408261709.MAA00374@seraph.cs.uiuc.edu> Changes in directory reopt/lib/TraceToFunction: TraceToFunction.cpp updated: 1.84 -> 1.85 --- Log message: Minor edits to comments and whitespace. --- Diffs of the changes: (+4 -4) Index: reopt/lib/TraceToFunction/TraceToFunction.cpp diff -u reopt/lib/TraceToFunction/TraceToFunction.cpp:1.84 reopt/lib/TraceToFunction/TraceToFunction.cpp:1.85 --- reopt/lib/TraceToFunction/TraceToFunction.cpp:1.84 Thu Aug 5 01:44:02 2004 +++ reopt/lib/TraceToFunction/TraceToFunction.cpp Thu Aug 26 12:09:34 2004 @@ -246,8 +246,8 @@ insert (S, LVV, Inst); } - // If there are alternate entry points into the trace, their live-INs are - // live-OUT from the main trace. + // If there are alternate entry points into the non-traced copy of the + // code, their live-INs are live-OUT from the traced copy of the code. if (!AlternateEntryPointsV.empty ()) { for (std::vector::iterator i = AlternateEntryPointsV.begin (), e = AlternateEntryPointsV.end (); i != e; ++i) { @@ -651,8 +651,8 @@ predBlock = PN->getIncomingBlock (i); break; } - assert (predBlock - && "Couldn't find phi node pred block given incoming value"); + assert (predBlock + && "Couldn't find phi node pred block given incoming value"); DEBUG (std::cerr << "hasUseDominatedByEdge: it's a phi node; pred. block is %" << predBlock->getName () << "\n"); dom = DS->dominates (&target->front(), predBlock->getTerminator()); From reid at x10sys.com Thu Aug 26 13:53:03 2004 From: reid at x10sys.com (Reid Spencer) Date: Thu, 26 Aug 2004 13:53:03 -0500 Subject: [llvm-commits] CVS: llvm/docs/SystemLibrary.html Message-ID: <200408261853.NAA17910@zion.cs.uiuc.edu> Changes in directory llvm/docs: SystemLibrary.html updated: 1.4 -> 1.5 --- Log message: Document the rational for the #include hierarchy. --- Diffs of the changes: (+113 -1) Index: llvm/docs/SystemLibrary.html diff -u llvm/docs/SystemLibrary.html:1.4 llvm/docs/SystemLibrary.html:1.5 --- llvm/docs/SystemLibrary.html:1.4 Wed Jul 21 13:04:27 2004 +++ llvm/docs/SystemLibrary.html Thu Aug 26 13:52:52 2004 @@ -175,6 +175,118 @@
    + +
    +

    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 + applicabe 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 + imlemented 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 choosen 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.
    • +
    +
    + + @@ -197,7 +309,7 @@ Reid Spencer
    LLVM Compiler Infrastructure
    - Last modified: $Date: 2004/07/21 18:04:27 $ + Last modified: $Date: 2004/08/26 18:52:52 $ From reid at x10sys.com Thu Aug 26 15:43:31 2004 From: reid at x10sys.com (Reid Spencer) Date: Thu, 26 Aug 2004 15:43:31 -0500 Subject: [llvm-commits] CVS: llvm/docs/llvm.css Message-ID: <200408262043.PAA18663@zion.cs.uiuc.edu> Changes in directory llvm/docs: llvm.css updated: 1.19 -> 1.20 --- Log message: Add the default table related styles --- Diffs of the changes: (+8 -0) Index: llvm/docs/llvm.css diff -u llvm/docs/llvm.css:1.19 llvm/docs/llvm.css:1.20 --- llvm/docs/llvm.css:1.19 Mon May 24 13:05:58 2004 +++ llvm/docs/llvm.css Thu Aug 26 15:43:21 2004 @@ -11,6 +11,11 @@ address img { float: right; width: 88px; height: 31px; } address { clear: right; } +TR, TD { border: 2px solid gray; padding: 4pt 4pt 2pt 2pt; } +TH { border: 2px solid gray; font-weight: bold; font-size: 105%; } +TABLE { text-align: center; border: 2px solid black; + border-collapse: collapse; margin-top: 1em; margin-left: 1em; + margin-right: 1em; margin-bottom: 1em; } /* * Documentation */ @@ -58,3 +63,6 @@ padding: 0 1em 0 1em; display:table; } + +/* Left align table cell */ +.td_left { border: 2px solid gray; text-align: left; } From reid at x10sys.com Thu Aug 26 15:44:11 2004 From: reid at x10sys.com (Reid Spencer) Date: Thu, 26 Aug 2004 15:44:11 -0500 Subject: [llvm-commits] CVS: llvm/docs/LangRef.html Message-ID: <200408262044.PAA18693@zion.cs.uiuc.edu> Changes in directory llvm/docs: LangRef.html updated: 1.73 -> 1.74 --- Log message: Provide some meta tags for this document. --- Diffs of the changes: (+5 -1) Index: llvm/docs/LangRef.html diff -u llvm/docs/LangRef.html:1.73 llvm/docs/LangRef.html:1.74 --- llvm/docs/LangRef.html:1.73 Thu Aug 12 15:16:08 2004 +++ llvm/docs/LangRef.html Thu Aug 26 15:44:00 2004 @@ -3,6 +3,10 @@ LLVM Assembly Language Reference Manual + + + @@ -2615,7 +2619,7 @@ Chris Lattner
    The LLVM Compiler Infrastructure
    - Last modified: $Date: 2004/08/12 20:16:08 $ + Last modified: $Date: 2004/08/26 20:44:00 $ From alkis at cs.uiuc.edu Thu Aug 26 17:21:14 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Thu, 26 Aug 2004 17:21:14 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/MRegisterInfo.h Message-ID: <200408262221.RAA19555@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: MRegisterInfo.h updated: 1.49 -> 1.50 --- Log message: Add getAllocatableSet() function. --- Diffs of the changes: (+4 -0) Index: llvm/include/llvm/Target/MRegisterInfo.h diff -u llvm/include/llvm/Target/MRegisterInfo.h:1.49 llvm/include/llvm/Target/MRegisterInfo.h:1.50 --- llvm/include/llvm/Target/MRegisterInfo.h:1.49 Sun Aug 15 20:07:53 2004 +++ llvm/include/llvm/Target/MRegisterInfo.h Thu Aug 26 17:21:04 2004 @@ -160,6 +160,10 @@ return Reg >= FirstVirtualRegister; } + /// getAllocatableSet - Returns a bitset indexed by register number + /// indicating if a register is allocatable or not. + std::vector getAllocatableSet(MachineFunction &MF) const; + const MRegisterDesc &operator[](unsigned RegNo) const { assert(RegNo < NumRegs && "Attempting to access record for invalid register number!"); From alkis at cs.uiuc.edu Thu Aug 26 17:21:14 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Thu, 26 Aug 2004 17:21:14 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/MRegisterInfo.cpp Message-ID: <200408262221.RAA19552@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target: MRegisterInfo.cpp updated: 1.5 -> 1.6 --- Log message: Add getAllocatableSet() function. --- Diffs of the changes: (+18 -4) Index: llvm/lib/Target/MRegisterInfo.cpp diff -u llvm/lib/Target/MRegisterInfo.cpp:1.5 llvm/lib/Target/MRegisterInfo.cpp:1.6 --- llvm/lib/Target/MRegisterInfo.cpp:1.5 Tue Nov 11 16:41:33 2003 +++ llvm/lib/Target/MRegisterInfo.cpp Thu Aug 26 17:21:04 2004 @@ -28,12 +28,14 @@ // Fill in the PhysRegClasses map for (MRegisterInfo::regclass_iterator I = regclass_begin(), - E = regclass_end(); I != E; ++I) - for (unsigned i = 0, e = (*I)->getNumRegs(); i != e; ++i) { - unsigned Reg = (*I)->getRegister(i); + E = regclass_end(); I != E; ++I) { + const TargetRegisterClass *RC = *I; + for (unsigned i = 0, e = RC->getNumRegs(); i != e; ++i) { + unsigned Reg = RC->getRegister(i); assert(PhysRegClasses[Reg] == 0 && "Register in more than one class?"); - PhysRegClasses[Reg] = *I; + PhysRegClasses[Reg] = RC; } + } CallFrameSetupOpcode = CFSO; CallFrameDestroyOpcode = CFDO; @@ -44,4 +46,16 @@ delete[] PhysRegClasses; } +std::vector MRegisterInfo::getAllocatableSet(MachineFunction &MF) const { + std::vector Allocatable(NumRegs); + for (MRegisterInfo::regclass_iterator I = regclass_begin(), + E = regclass_end(); I != E; ++I) { + const TargetRegisterClass *RC = *I; + for (TargetRegisterClass::iterator I = RC->allocation_order_begin(MF), + E = RC->allocation_order_end(MF); I != E; ++I) + Allocatable[*I] = true; + } + return Allocatable; +} + } // End llvm namespace From alkis at cs.uiuc.edu Thu Aug 26 17:22:48 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Thu, 26 Aug 2004 17:22:48 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveIntervalAnalysis.h LiveIntervalAnalysis.cpp Message-ID: <200408262222.RAA19615@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: LiveIntervalAnalysis.h updated: 1.40 -> 1.41 LiveIntervalAnalysis.cpp updated: 1.118 -> 1.119 --- Log message: Use newly added API in MRegisterInfo. --- Diffs of the changes: (+6 -5) Index: llvm/lib/CodeGen/LiveIntervalAnalysis.h diff -u llvm/lib/CodeGen/LiveIntervalAnalysis.h:1.40 llvm/lib/CodeGen/LiveIntervalAnalysis.h:1.41 --- llvm/lib/CodeGen/LiveIntervalAnalysis.h:1.40 Wed Aug 4 04:43:38 2004 +++ llvm/lib/CodeGen/LiveIntervalAnalysis.h Thu Aug 26 17:22:38 2004 @@ -47,6 +47,8 @@ typedef std::map Reg2RegMap; Reg2RegMap r2rMap_; + std::vector allocatableRegs_; + public: struct InstrSlots { Index: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp diff -u llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.118 llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.119 --- llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.118 Tue Aug 24 12:48:29 2004 +++ llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Thu Aug 26 17:22:38 2004 @@ -87,6 +87,7 @@ tm_ = &fn.getTarget(); mri_ = tm_->getRegisterInfo(); lv_ = &getAnalysis(); + allocatableRegs_ = mri_->getAllocatableSet(fn); // number MachineInstrs unsigned miIndex = 0; @@ -484,7 +485,7 @@ unsigned reg) { if (MRegisterInfo::isVirtualRegister(reg)) handleVirtualRegisterDef(MBB, MI, getOrCreateInterval(reg)); - else if (lv_->getAllocatablePhysicalRegisters()[reg]) { + else if (allocatableRegs_[reg]) { handlePhysicalRegisterDef(MBB, MI, getOrCreateInterval(reg)); for (const unsigned* AS = mri_->getAliasSet(reg); *AS; ++AS) handlePhysicalRegisterDef(MBB, MI, getOrCreateInterval(*AS)); @@ -541,10 +542,8 @@ // on not allocatable physical registers unsigned regA, regB; if (TII.isMoveInstr(*mi, regA, regB) && - (MRegisterInfo::isVirtualRegister(regA) || - lv_->getAllocatablePhysicalRegisters()[regA]) && - (MRegisterInfo::isVirtualRegister(regB) || - lv_->getAllocatablePhysicalRegisters()[regB])) { + (MRegisterInfo::isVirtualRegister(regA) || allocatableRegs_[regA]) && + (MRegisterInfo::isVirtualRegister(regB) || allocatableRegs_[regB])) { // Get representative registers. regA = rep(regA); From alkis at cs.uiuc.edu Thu Aug 26 17:23:43 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Thu, 26 Aug 2004 17:23:43 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/LiveVariables.h Message-ID: <200408262223.RAA19669@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: LiveVariables.h updated: 1.18 -> 1.19 --- Log message: Use newly added API in MRegisterInfo and don't expose the allocatable register set anymore. Its users now use the MRegisterInfo API. --- Diffs of the changes: (+0 -4) Index: llvm/include/llvm/CodeGen/LiveVariables.h diff -u llvm/include/llvm/CodeGen/LiveVariables.h:1.18 llvm/include/llvm/CodeGen/LiveVariables.h:1.19 --- llvm/include/llvm/CodeGen/LiveVariables.h:1.18 Mon Jul 19 02:04:48 2004 +++ llvm/include/llvm/CodeGen/LiveVariables.h Thu Aug 26 17:23:32 2004 @@ -231,10 +231,6 @@ /// register. VarInfo &getVarInfo(unsigned RegIdx); - const std::vector& getAllocatablePhysicalRegisters() const { - return AllocatablePhysicalRegisters; - } - void MarkVirtRegAliveInBlock(VarInfo &VRInfo, MachineBasicBlock *BB); void HandleVirtRegUse(VarInfo &VRInfo, MachineBasicBlock *MBB, MachineInstr *MI); From alkis at cs.uiuc.edu Thu Aug 26 17:23:43 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Thu, 26 Aug 2004 17:23:43 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveVariables.cpp Message-ID: <200408262223.RAA19672@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: LiveVariables.cpp updated: 1.40 -> 1.41 --- Log message: Use newly added API in MRegisterInfo and don't expose the allocatable register set anymore. Its users now use the MRegisterInfo API. --- Diffs of the changes: (+1 -13) Index: llvm/lib/CodeGen/LiveVariables.cpp diff -u llvm/lib/CodeGen/LiveVariables.cpp:1.40 llvm/lib/CodeGen/LiveVariables.cpp:1.41 --- llvm/lib/CodeGen/LiveVariables.cpp:1.40 Mon Jul 19 02:04:55 2004 +++ llvm/lib/CodeGen/LiveVariables.cpp Thu Aug 26 17:23:32 2004 @@ -148,19 +148,7 @@ RegInfo = MF.getTarget().getRegisterInfo(); assert(RegInfo && "Target doesn't have register information?"); - // First time though, initialize AllocatablePhysicalRegisters for the target - if (AllocatablePhysicalRegisters.empty()) { - // Make space, initializing to false... - AllocatablePhysicalRegisters.resize(RegInfo->getNumRegs()); - - // Loop over all of the register classes... - for (MRegisterInfo::regclass_iterator RCI = RegInfo->regclass_begin(), - E = RegInfo->regclass_end(); RCI != E; ++RCI) - // Loop over all of the allocatable registers in the function... - for (TargetRegisterClass::iterator I = (*RCI)->allocation_order_begin(MF), - E = (*RCI)->allocation_order_end(MF); I != E; ++I) - AllocatablePhysicalRegisters[*I] = true; // The reg is allocatable! - } + AllocatablePhysicalRegisters = RegInfo->getAllocatableSet(MF); // PhysRegInfo - Keep track of which instruction was the last use of a // physical register. This is a purely local property, because all physical From reid at x10sys.com Thu Aug 26 17:32:10 2004 From: reid at x10sys.com (Reid Spencer) Date: Thu, 26 Aug 2004 17:32:10 -0500 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Writer/SlotCalculator.h SlotCalculator.cpp Message-ID: <200408262232.RAA19763@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Writer: SlotCalculator.h updated: 1.20 -> 1.21 SlotCalculator.cpp updated: 1.61 -> 1.62 --- Log message: Add the CompactionTableIsEmpty function so that we can determine if a CompactionTable really needs to be emitted. This is not a straight forward computation, hence the need for a member function here. --- Diffs of the changes: (+29 -0) Index: llvm/lib/Bytecode/Writer/SlotCalculator.h diff -u llvm/lib/Bytecode/Writer/SlotCalculator.h:1.20 llvm/lib/Bytecode/Writer/SlotCalculator.h:1.21 --- llvm/lib/Bytecode/Writer/SlotCalculator.h:1.20 Sun Jul 4 06:42:49 2004 +++ llvm/lib/Bytecode/Writer/SlotCalculator.h Thu Aug 26 17:32:00 2004 @@ -138,6 +138,9 @@ const TypeList& getCompactionTypes() const { return CompactionTypes; } + /// @brief Determine if the compaction table (not types) is empty + bool CompactionTableIsEmpty() const; + private: // getOrCreateSlot - Values can be crammed into here at will... if // they haven't been inserted already, they get inserted, otherwise Index: llvm/lib/Bytecode/Writer/SlotCalculator.cpp diff -u llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.61 llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.62 --- llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.61 Thu Jul 29 07:17:34 2004 +++ llvm/lib/Bytecode/Writer/SlotCalculator.cpp Thu Aug 26 17:32:00 2004 @@ -622,6 +622,32 @@ } } +/// Determine if the compaction table is actually empty. Because the +/// compaction table always includes the primitive type planes, we +/// can't just check getCompactionTable().size() because it will never +/// be zero. Furthermore, the ModuleLevel factors into whether a given +/// plane is empty or not. This function does the necessary computation +/// to determine if its actually empty. +bool SlotCalculator::CompactionTableIsEmpty() const { + // Check a degenerate case, just in case. + if (CompactionTable.size() == 0) return true; + + // Check each plane + for (unsigned i = 0, e = CompactionTable.size(); i < e; ++i) { + // If the plane is not empty + if (!CompactionTable[i].empty()) { + // If the module level is non-zero then at least the + // first element of the plane is valid and therefore not empty. + unsigned End = getModuleLevel(i); + if (End != 0) + return false; + } + } + // All the compaction table planes are empty so the table is + // considered empty too. + return true; +} + int SlotCalculator::getSlot(const Value *V) const { // If there is a CompactionTable active... if (!CompactionNodeMap.empty()) { From reid at x10sys.com Thu Aug 26 19:38:55 2004 From: reid at x10sys.com (Reid Spencer) Date: Thu, 26 Aug 2004 19:38:55 -0500 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Writer/Writer.cpp Message-ID: <200408270038.TAA20338@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Writer: Writer.cpp updated: 1.76 -> 1.77 --- Log message: Prevent an empty compaction table from being written to the bytecode file. --- Diffs of the changes: (+12 -8) Index: llvm/lib/Bytecode/Writer/Writer.cpp diff -u llvm/lib/Bytecode/Writer/Writer.cpp:1.76 llvm/lib/Bytecode/Writer/Writer.cpp:1.77 --- llvm/lib/Bytecode/Writer/Writer.cpp:1.76 Fri Aug 20 01:00:57 2004 +++ llvm/lib/Bytecode/Writer/Writer.cpp Thu Aug 26 19:38:44 2004 @@ -1034,15 +1034,19 @@ } void BytecodeWriter::outputCompactionTable() { - BytecodeBlock CTB(BytecodeFormat::CompactionTableBlockID, *this, - true/*ElideIfEmpty*/); - const std::vector > &CT =Table.getCompactionTable(); - - // First thing is first, emit the type compaction table if there is one. - outputCompactionTypes(Type::FirstDerivedTyID); + // Avoid writing the compaction table at all if there is no content. + if (Table.getCompactionTypes().size() >= Type::FirstDerivedTyID || + (!Table.CompactionTableIsEmpty())) { + BytecodeBlock CTB(BytecodeFormat::CompactionTableBlockID, *this, + true/*ElideIfEmpty*/); + const std::vector > &CT =Table.getCompactionTable(); + + // First things first, emit the type compaction table if there is one. + outputCompactionTypes(Type::FirstDerivedTyID); - for (unsigned i = 0, e = CT.size(); i != e; ++i) - outputCompactionTablePlane(i, CT[i], 0); + for (unsigned i = 0, e = CT.size(); i != e; ++i) + outputCompactionTablePlane(i, CT[i], 0); + } } void BytecodeWriter::outputSymbolTable(const SymbolTable &MST) { From reid at x10sys.com Thu Aug 26 19:44:01 2004 From: reid at x10sys.com (Reid Spencer) Date: Thu, 26 Aug 2004 19:44:01 -0500 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/Analyzer.cpp Message-ID: <200408270044.TAA20379@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Reader: Analyzer.cpp updated: 1.15 -> 1.16 --- Log message: Correctly compute the number of compaction tables. --- Diffs of the changes: (+1 -1) Index: llvm/lib/Bytecode/Reader/Analyzer.cpp diff -u llvm/lib/Bytecode/Reader/Analyzer.cpp:1.15 llvm/lib/Bytecode/Reader/Analyzer.cpp:1.16 --- llvm/lib/Bytecode/Reader/Analyzer.cpp:1.15 Tue Aug 24 17:45:32 2004 +++ llvm/lib/Bytecode/Reader/Analyzer.cpp Thu Aug 26 19:43:51 2004 @@ -241,10 +241,10 @@ virtual void handleCompactionTableBegin() { if (os) *os << " BLOCK: CompactionTable {\n"; + bca.numCmpctnTables++; } virtual void handleCompactionTablePlane( unsigned Ty, unsigned NumEntries) { - bca.numCmpctnTables++; if (os) *os << " Plane: Ty=" << Ty << " Size=" << NumEntries << "\n"; } From reid at x10sys.com Thu Aug 26 19:48:36 2004 From: reid at x10sys.com (Reid Spencer) Date: Thu, 26 Aug 2004 19:48:36 -0500 Subject: [llvm-commits] CVS: llvm/docs/ReleaseNotes.html Message-ID: <200408270048.TAA20440@zion.cs.uiuc.edu> Changes in directory llvm/docs: ReleaseNotes.html updated: 1.234 -> 1.235 --- Log message: Bug 430: http://llvm.cs.uiuc.edu/PR430 Fixed. --- Diffs of the changes: (+3 -1) Index: llvm/docs/ReleaseNotes.html diff -u llvm/docs/ReleaseNotes.html:1.234 llvm/docs/ReleaseNotes.html:1.235 --- llvm/docs/ReleaseNotes.html:1.234 Tue Aug 24 02:43:48 2004 +++ llvm/docs/ReleaseNotes.html Thu Aug 26 19:48:26 2004 @@ -159,6 +159,8 @@ functions with lots of values
  • [anders-aa] Andersen's AA is completely broken in LLVM 1.3
  • +
  • [bcwriter] Empty compaction tables + defined
  • Bugs in the C/C++ front-end:

    @@ -608,7 +610,7 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!" /> The LLVM Compiler Infrastructure
    - Last modified: $Date: 2004/08/24 07:43:48 $ + Last modified: $Date: 2004/08/27 00:48:26 $ From reid at x10sys.com Thu Aug 26 21:08:14 2004 From: reid at x10sys.com (Reid Spencer) Date: Thu, 26 Aug 2004 21:08:14 -0500 Subject: [llvm-commits] CVS: llvm/docs/SystemLibrary.html Message-ID: <200408270208.VAA20763@zion.cs.uiuc.edu> Changes in directory llvm/docs: SystemLibrary.html updated: 1.5 -> 1.6 --- Log message: Add more content. This isn't in reviewable shape yet, unless you're curious. --- Diffs of the changes: (+221 -28) Index: llvm/docs/SystemLibrary.html diff -u llvm/docs/SystemLibrary.html:1.5 llvm/docs/SystemLibrary.html:1.6 --- llvm/docs/SystemLibrary.html:1.5 Thu Aug 26 13:52:52 2004 +++ llvm/docs/SystemLibrary.html Thu Aug 26 21:08:04 2004 @@ -18,14 +18,18 @@
  • System Library Requirements
    1. Hide System Header Files
    2. +
    3. Allow Standard C Header Files
    4. +
    5. Allow Standard C++ Header Files
    6. No Exposed Functions
    7. No Exposed Data
    8. -
    9. No Exceptions
    10. -
    11. Standard Error Codes
    12. -
    13. Minimize Overhead
    14. +
    15. Throw Only std::string
    16. +
    17. No throw() Specifications
    18. +
    19. No Duplicate Impementations
  • System Library Design
      +
    1. No Unused Functionality
    2. +
    3. High-Level Interface
    4. Use Opaque Classes
    5. Common Implementations
    6. Multiple Implementations
    7. @@ -54,12 +58,17 @@ 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. - The library also unclutters the rest of LLVM from #ifdef use and special - cases for specific operating systems.

      -

      The System Library was donated to LLVM by Reid Spencer who formulated the - original design as part of the eXtensible Programming System (XPS) which is - based, in part, on 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. +

      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).

      @@ -69,43 +78,113 @@

      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.

      + requirements needed to fulfill this objective. Of necessity, these requirements + must be strictly followed in order to ensure the library's goal is reached.

      -

      To be written.

      +

      The library must sheild 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. +

      +
      + + + +
      +

      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.

      +
      + + + +
      +

      The standard C++ headers from the standard C++ library and + standard template library 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 written.

      +

      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.

      -

      To be written.

      +

      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.

      - +
      -

      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 imlementation 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.

      +

      None of the lib/System interface functions may be declared with C++ + throw() specifications on them. This requirement makes sure that the + compler does not insert addtional 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.

      - +
      -

      To be written.

      +

      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.

      @@ -119,6 +198,128 @@ + +
      +

      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.

      +
      + + + +
      +

      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.

      +
      + + + +
      +

      Operating system interfaces will generally provide errors 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.

      +

      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.

      +

      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 + simply throw that error if it occurs because its a soft error. The problem + is that the interface function, OpenFileForWriting is too low level. It should + be OpenOrCreateFileForWriting. In the case of the soft "doesn't exist" error, + this function would just create it and then open it for writing.

      +

      This design principle needs to be maintained in lib/System because it + avoids the propagation of soft error handling throughout the rest of LLVM. + Hard errors will generally just cause a termination for an LLVM tool so don't + be bashful about throwing them.

      +

      Rules of thumb:

      +
        +
      1. Don't throw soft errors, only hard errors.
      2. +
      3. If you're tempted to throw a soft error, re-think the interface.
      4. +
      5. Handle internally the most common normal/good/soft error conditions + so the rest of LLVM doesn't have to.
      6. +
      + +
      
      +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

      @@ -142,14 +343,6 @@
      - -
      -

      To be written.

      -
      - -

      To be written.

      @@ -309,7 +502,7 @@ Reid Spencer
      LLVM Compiler Infrastructure
      - Last modified: $Date: 2004/08/26 18:52:52 $ + Last modified: $Date: 2004/08/27 02:08:04 $ From alkis at cs.uiuc.edu Thu Aug 26 22:58:42 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Thu, 26 Aug 2004 22:58:42 -0500 Subject: [llvm-commits] CVS: llvm/include/Support/DenseMap.h Message-ID: <200408270358.WAA21348@zion.cs.uiuc.edu> Changes in directory llvm/include/Support: DenseMap.h updated: 1.4 -> 1.5 --- Log message: Add size member function. --- Diffs of the changes: (+4 -0) Index: llvm/include/Support/DenseMap.h diff -u llvm/include/Support/DenseMap.h:1.4 llvm/include/Support/DenseMap.h:1.5 --- llvm/include/Support/DenseMap.h:1.4 Wed Aug 25 22:37:28 2004 +++ llvm/include/Support/DenseMap.h Thu Aug 26 22:58:31 2004 @@ -62,6 +62,10 @@ if (NewSize > storage_.size()) storage_.resize(NewSize, nullVal_); } + + typename StorageT::size_type size() const { + return storage_.size(); + } }; } // End llvm namespace From alkis at cs.uiuc.edu Thu Aug 26 23:00:37 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Thu, 26 Aug 2004 23:00:37 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineBasicBlock.h Message-ID: <200408270400.XAA21430@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineBasicBlock.h updated: 1.37 -> 1.38 --- Log message: Add MachineBasicBlock2IndexFunctor. This is useful for densemaps from MachineBasicBlocks to an arbitrary type. --- Diffs of the changes: (+10 -0) Index: llvm/include/llvm/CodeGen/MachineBasicBlock.h diff -u llvm/include/llvm/CodeGen/MachineBasicBlock.h:1.37 llvm/include/llvm/CodeGen/MachineBasicBlock.h:1.38 --- llvm/include/llvm/CodeGen/MachineBasicBlock.h:1.37 Sat Jul 31 04:59:04 2004 +++ llvm/include/llvm/CodeGen/MachineBasicBlock.h Thu Aug 26 23:00:26 2004 @@ -220,6 +220,16 @@ } }; +// This is useful when building DenseMaps keyed on MachineBasicBlocks +struct MachineBasicBlock2IndexFunctor + : std::unary_function { + unsigned operator()(const MachineBasicBlock* MBB) const { + assert(MBB->getNumber() != -1 && + "MachineBasicBlock does not belong to a MachineFunction"); + return MBB->getNumber(); + } +}; + //===--------------------------------------------------------------------===// // GraphTraits specializations for machine basic block graphs (machine-CFGs) From alkis at cs.uiuc.edu Thu Aug 26 23:02:45 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Thu, 26 Aug 2004 23:02:45 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineFunction.h Message-ID: <200408270402.XAA21490@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineFunction.h updated: 1.41 -> 1.42 --- Log message: Add getLastBlock member. This is useful when growing a densemap keyed on MachineBasicBlocks. --- Diffs of the changes: (+5 -0) Index: llvm/include/llvm/CodeGen/MachineFunction.h diff -u llvm/include/llvm/CodeGen/MachineFunction.h:1.41 llvm/include/llvm/CodeGen/MachineFunction.h:1.42 --- llvm/include/llvm/CodeGen/MachineFunction.h:1.41 Wed Aug 18 13:13:16 2004 +++ llvm/include/llvm/CodeGen/MachineFunction.h Thu Aug 26 23:02:35 2004 @@ -149,6 +149,11 @@ return MBBNumbering[N]; } + /// getLastBlock - Returns the MachineBasicBlock with the greatest number + MachineBasicBlock *getLastBlock() { + return MBBNumbering.back(); + } + /// print - Print out the MachineFunction in a format suitable for debugging /// to the specified stream. /// From natebegeman at mac.com Thu Aug 26 23:28:20 2004 From: natebegeman at mac.com (Nate Begeman) Date: Thu, 26 Aug 2004 23:28:20 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPC32RegisterInfo.cpp PPC64RegisterInfo.cpp Message-ID: <200408270428.XAA21671@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPC32RegisterInfo.cpp updated: 1.3 -> 1.4 PPC64RegisterInfo.cpp updated: 1.3 -> 1.4 --- Log message: Register sizes are in bits, not bytes --- Diffs of the changes: (+3 -3) Index: llvm/lib/Target/PowerPC/PPC32RegisterInfo.cpp diff -u llvm/lib/Target/PowerPC/PPC32RegisterInfo.cpp:1.3 llvm/lib/Target/PowerPC/PPC32RegisterInfo.cpp:1.4 --- llvm/lib/Target/PowerPC/PPC32RegisterInfo.cpp:1.3 Sun Aug 22 03:09:17 2004 +++ llvm/lib/Target/PowerPC/PPC32RegisterInfo.cpp Thu Aug 26 23:28:10 2004 @@ -238,7 +238,7 @@ // Add the size of R1 to NumBytes size for the store of R1 to the bottom // of the stack and round the size to a multiple of the alignment. unsigned Align = MF.getTarget().getFrameInfo()->getStackAlignment(); - unsigned GPRSize = getSpillSize(PPC::R1); + unsigned GPRSize = getSpillSize(PPC::R1)/8; unsigned Size = hasFP(MF) ? GPRSize + GPRSize : GPRSize; NumBytes = (NumBytes+Size+Align-1)/Align*Align; @@ -278,7 +278,7 @@ // Get the number of bytes allocated from the FrameInfo... unsigned NumBytes = MFI->getStackSize(); - unsigned GPRSize = getSpillSize(PPC::R31); + unsigned GPRSize = getSpillSize(PPC::R31)/8; if (NumBytes != 0) { if (hasFP(MF)) { Index: llvm/lib/Target/PowerPC/PPC64RegisterInfo.cpp diff -u llvm/lib/Target/PowerPC/PPC64RegisterInfo.cpp:1.3 llvm/lib/Target/PowerPC/PPC64RegisterInfo.cpp:1.4 --- llvm/lib/Target/PowerPC/PPC64RegisterInfo.cpp:1.3 Sat Aug 21 14:51:17 2004 +++ llvm/lib/Target/PowerPC/PPC64RegisterInfo.cpp Thu Aug 26 23:28:10 2004 @@ -240,7 +240,7 @@ // Add the size of R1 to NumBytes size for the store of R1 to the bottom // of the stack and round the size to a multiple of the alignment. unsigned Align = MF.getTarget().getFrameInfo()->getStackAlignment(); - unsigned GPRSize = getSpillSize(PPC::R1); + unsigned GPRSize = getSpillSize(PPC::R1)/8; unsigned Size = hasFP(MF) ? GPRSize + GPRSize : GPRSize; NumBytes = (NumBytes+Size+Align-1)/Align*Align; From natebegeman at mac.com Thu Aug 26 23:28:20 2004 From: natebegeman at mac.com (Nate Begeman) Date: Thu, 26 Aug 2004 23:28:20 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/PrologEpilogInserter.cpp Message-ID: <200408270428.XAA21666@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: PrologEpilogInserter.cpp updated: 1.34 -> 1.35 --- Log message: Register sizes are in bits, not bytes --- Diffs of the changes: (+2 -2) Index: llvm/lib/CodeGen/PrologEpilogInserter.cpp diff -u llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.34 llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.35 --- llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.34 Sat Aug 21 15:04:59 2004 +++ llvm/lib/CodeGen/PrologEpilogInserter.cpp Thu Aug 26 23:28:10 2004 @@ -181,11 +181,11 @@ int FrameIdx; if (FixedSlot == FixedSpillSlots+NumFixedSpillSlots) { // Nope, just spill it anywhere convenient. - FrameIdx = FFI->CreateStackObject(RegInfo->getSpillSize(Reg), + FrameIdx = FFI->CreateStackObject(RegInfo->getSpillSize(Reg)/8, RegInfo->getSpillAlignment(Reg)/8); } else { // Spill it to the stack where we must. - FrameIdx = FFI->CreateFixedObject(RegInfo->getSpillSize(Reg), + FrameIdx = FFI->CreateFixedObject(RegInfo->getSpillSize(Reg)/8, FixedSlot->second); } StackSlots.push_back(FrameIdx); From alkis at cs.uiuc.edu Thu Aug 26 23:51:24 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Thu, 26 Aug 2004 23:51:24 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/RegAllocLinearScan.cpp RegAllocIterativeScan.cpp Message-ID: <200408270451.XAA21782@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: RegAllocLinearScan.cpp updated: 1.87 -> 1.88 RegAllocIterativeScan.cpp updated: 1.11 -> 1.12 --- Log message: The linear scan variants do not require the LiveVariables analysis. --- Diffs of the changes: (+0 -4) Index: llvm/lib/CodeGen/RegAllocLinearScan.cpp diff -u llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.87 llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.88 --- llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.87 Wed Aug 4 04:46:26 2004 +++ llvm/lib/CodeGen/RegAllocLinearScan.cpp Thu Aug 26 23:51:13 2004 @@ -13,7 +13,6 @@ #define DEBUG_TYPE "regalloc" #include "llvm/Function.h" -#include "llvm/CodeGen/LiveVariables.h" #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/Passes.h" @@ -66,7 +65,6 @@ } virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.addRequired(); AU.addRequired(); MachineFunctionPass::getAnalysisUsage(AU); } Index: llvm/lib/CodeGen/RegAllocIterativeScan.cpp diff -u llvm/lib/CodeGen/RegAllocIterativeScan.cpp:1.11 llvm/lib/CodeGen/RegAllocIterativeScan.cpp:1.12 --- llvm/lib/CodeGen/RegAllocIterativeScan.cpp:1.11 Wed Aug 4 04:46:26 2004 +++ llvm/lib/CodeGen/RegAllocIterativeScan.cpp Thu Aug 26 23:51:13 2004 @@ -19,7 +19,6 @@ #define DEBUG_TYPE "regalloc" #include "llvm/Function.h" -#include "llvm/CodeGen/LiveVariables.h" #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/Passes.h" @@ -68,7 +67,6 @@ } virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.addRequired(); AU.addRequired(); MachineFunctionPass::getAnalysisUsage(AU); } From natebegeman at mac.com Fri Aug 27 02:59:47 2004 From: natebegeman at mac.com (Nate Begeman) Date: Fri, 27 Aug 2004 02:59:47 -0500 Subject: [llvm-commits] CVS: llvm/docs/BytecodeFormat.html Message-ID: <200408270759.CAA22461@zion.cs.uiuc.edu> Changes in directory llvm/docs: BytecodeFormat.html updated: 1.30 -> 1.31 --- Log message: Fix a typo in the bytecode format documentation --- Diffs of the changes: (+2 -2) Index: llvm/docs/BytecodeFormat.html diff -u llvm/docs/BytecodeFormat.html:1.30 llvm/docs/BytecodeFormat.html:1.31 --- llvm/docs/BytecodeFormat.html:1.30 Fri Aug 20 01:00:42 2004 +++ llvm/docs/BytecodeFormat.html Fri Aug 27 02:59:37 2004 @@ -1474,7 +1474,7 @@ include/llvm/Instruction.def file. You should check there for the most recent definitions. The table below provides the opcodes defined as of - the writing of this document. The table associates each opcode mneumonic with + the writing of this document. The table associates each opcode mnemonic with its enumeration value and the bytecode and LLVM version numbers in which the opcode was introduced.

      @@ -1801,7 +1801,7 @@ Reid Spencer and Chris Lattner
      The LLVM Compiler Infrastructure
      -Last modified: $Date: 2004/08/20 06:00:42 $ +Last modified: $Date: 2004/08/27 07:59:37 $ From natebegeman at mac.com Fri Aug 27 11:48:35 2004 From: natebegeman at mac.com (Nate Begeman) Date: Fri, 27 Aug 2004 11:48:35 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/PrologEpilogInserter.cpp Message-ID: <200408271648.LAA28125@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: PrologEpilogInserter.cpp updated: 1.35 -> 1.36 --- Log message: Back out change to divide getSpillSize by 8 until I figure out why it breaks x86, which has register sizes in bits. --- Diffs of the changes: (+2 -2) Index: llvm/lib/CodeGen/PrologEpilogInserter.cpp diff -u llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.35 llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.36 --- llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.35 Thu Aug 26 23:28:10 2004 +++ llvm/lib/CodeGen/PrologEpilogInserter.cpp Fri Aug 27 11:48:24 2004 @@ -181,11 +181,11 @@ int FrameIdx; if (FixedSlot == FixedSpillSlots+NumFixedSpillSlots) { // Nope, just spill it anywhere convenient. - FrameIdx = FFI->CreateStackObject(RegInfo->getSpillSize(Reg)/8, + FrameIdx = FFI->CreateStackObject(RegInfo->getSpillSize(Reg), RegInfo->getSpillAlignment(Reg)/8); } else { // Spill it to the stack where we must. - FrameIdx = FFI->CreateFixedObject(RegInfo->getSpillSize(Reg)/8, + FrameIdx = FFI->CreateFixedObject(RegInfo->getSpillSize(Reg), FixedSlot->second); } StackSlots.push_back(FrameIdx); From alkis at cs.uiuc.edu Fri Aug 27 13:01:31 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Fri, 27 Aug 2004 13:01:31 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/RegAllocLinearScan.cpp RegAllocIterativeScan.cpp Message-ID: <200408271801.NAA28423@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: RegAllocLinearScan.cpp updated: 1.88 -> 1.89 RegAllocIterativeScan.cpp updated: 1.12 -> 1.13 --- Log message: Back out this change as it broke the build last night. This should be investicated further as the linearscan variants don't really need LiveVariables... --- Diffs of the changes: (+4 -0) Index: llvm/lib/CodeGen/RegAllocLinearScan.cpp diff -u llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.88 llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.89 --- llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.88 Thu Aug 26 23:51:13 2004 +++ llvm/lib/CodeGen/RegAllocLinearScan.cpp Fri Aug 27 13:01:21 2004 @@ -13,6 +13,7 @@ #define DEBUG_TYPE "regalloc" #include "llvm/Function.h" +#include "llvm/CodeGen/LiveVariables.h" #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/Passes.h" @@ -66,6 +67,7 @@ virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired(); + AU.addRequired(); MachineFunctionPass::getAnalysisUsage(AU); } Index: llvm/lib/CodeGen/RegAllocIterativeScan.cpp diff -u llvm/lib/CodeGen/RegAllocIterativeScan.cpp:1.12 llvm/lib/CodeGen/RegAllocIterativeScan.cpp:1.13 --- llvm/lib/CodeGen/RegAllocIterativeScan.cpp:1.12 Thu Aug 26 23:51:13 2004 +++ llvm/lib/CodeGen/RegAllocIterativeScan.cpp Fri Aug 27 13:01:21 2004 @@ -19,6 +19,7 @@ #define DEBUG_TYPE "regalloc" #include "llvm/Function.h" +#include "llvm/CodeGen/LiveVariables.h" #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/Passes.h" @@ -68,6 +69,7 @@ virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired(); + AU.addRequired(); MachineFunctionPass::getAnalysisUsage(AU); } From alkis at cs.uiuc.edu Fri Aug 27 13:59:32 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Fri, 27 Aug 2004 13:59:32 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Message-ID: <200408271859.NAA28793@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: LiveIntervalAnalysis.cpp updated: 1.119 -> 1.120 --- Log message: Only update LiveVariables if it is available. addIntervalsForSpills runs after the initial run of the live interval analysis. --- Diffs of the changes: (+12 -9) Index: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp diff -u llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.119 llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.120 --- llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.119 Thu Aug 26 17:22:38 2004 +++ llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Fri Aug 27 13:59:22 2004 @@ -186,6 +186,10 @@ VirtRegMap& vrm, int slot) { + // since this is called after the analysis is done we don't know if + // LiveVariables is available + lv_ = getAnalysisToUpdate(); + std::vector added; assert(li.weight != HUGE_VAL && @@ -212,9 +216,9 @@ for (unsigned i = 0; i != mi->getNumOperands(); ++i) { MachineOperand& mop = mi->getOperand(i); if (mop.isRegister() && mop.getReg() == li.reg) { - if (MachineInstr* fmi = - mri_->foldMemoryOperand(mi, i, slot)) { - lv_->instructionChanged(mi, fmi); + if (MachineInstr* fmi = mri_->foldMemoryOperand(mi, i, slot)) { + if (lv_) + lv_->instructionChanged(mi, fmi); vrm.virtFolded(li.reg, mi, fmi); mi2iMap_.erase(mi); i2miMap_[index/InstrSlots::NUM] = fmi; @@ -244,8 +248,7 @@ getUseIndex(index)); // create a new register for this spill - unsigned nReg = - mf_->getSSARegMap()->createVirtualRegister(rc); + unsigned nReg = mf_->getSSARegMap()->createVirtualRegister(rc); mi->SetMachineOperandReg(i, nReg); vrm.grow(); vrm.assignVirt2StackSlot(nReg, slot); @@ -258,10 +261,10 @@ DEBUG(std::cerr << " +" << LR); nI.addRange(LR); added.push_back(&nI); - // update live variables - lv_->addVirtualRegisterKilled(nReg, mi); - DEBUG(std::cerr << "\t\t\t\tadded new interval: " - << nI << '\n'); + // update live variables if it is available + if (lv_) + lv_->addVirtualRegisterKilled(nReg, mi); + DEBUG(std::cerr << "\t\t\t\tadded new interval: " << nI << '\n'); } } } From alkis at cs.uiuc.edu Fri Aug 27 14:00:40 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Fri, 27 Aug 2004 14:00:40 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/RegAllocLinearScan.cpp RegAllocIterativeScan.cpp Message-ID: <200408271900.OAA28885@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: RegAllocLinearScan.cpp updated: 1.89 -> 1.90 RegAllocIterativeScan.cpp updated: 1.13 -> 1.14 --- Log message: Now that LiveIntervals::addIntervalsForSpills is fixed, do not require LiveVariables. --- Diffs of the changes: (+0 -4) Index: llvm/lib/CodeGen/RegAllocLinearScan.cpp diff -u llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.89 llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.90 --- llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.89 Fri Aug 27 13:01:21 2004 +++ llvm/lib/CodeGen/RegAllocLinearScan.cpp Fri Aug 27 14:00:29 2004 @@ -13,7 +13,6 @@ #define DEBUG_TYPE "regalloc" #include "llvm/Function.h" -#include "llvm/CodeGen/LiveVariables.h" #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/Passes.h" @@ -67,7 +66,6 @@ virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired(); - AU.addRequired(); MachineFunctionPass::getAnalysisUsage(AU); } Index: llvm/lib/CodeGen/RegAllocIterativeScan.cpp diff -u llvm/lib/CodeGen/RegAllocIterativeScan.cpp:1.13 llvm/lib/CodeGen/RegAllocIterativeScan.cpp:1.14 --- llvm/lib/CodeGen/RegAllocIterativeScan.cpp:1.13 Fri Aug 27 13:01:21 2004 +++ llvm/lib/CodeGen/RegAllocIterativeScan.cpp Fri Aug 27 14:00:29 2004 @@ -19,7 +19,6 @@ #define DEBUG_TYPE "regalloc" #include "llvm/Function.h" -#include "llvm/CodeGen/LiveVariables.h" #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/Passes.h" @@ -69,7 +68,6 @@ virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired(); - AU.addRequired(); MachineFunctionPass::getAnalysisUsage(AU); } From alkis at cs.uiuc.edu Sat Aug 28 17:43:41 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Sat, 28 Aug 2004 17:43:41 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveVariables.cpp Message-ID: <200408282243.RAA06336@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: LiveVariables.cpp updated: 1.41 -> 1.42 --- Log message: Remove dead code. --- Diffs of the changes: (+0 -1) Index: llvm/lib/CodeGen/LiveVariables.cpp diff -u llvm/lib/CodeGen/LiveVariables.cpp:1.41 llvm/lib/CodeGen/LiveVariables.cpp:1.42 --- llvm/lib/CodeGen/LiveVariables.cpp:1.41 Thu Aug 26 17:23:32 2004 +++ llvm/lib/CodeGen/LiveVariables.cpp Sat Aug 28 17:43:31 2004 @@ -102,7 +102,6 @@ VRInfo.Kills.push_back(MI); // Update all dominating blocks to mark them known live. - const BasicBlock *BB = MBB->getBasicBlock(); for (MachineBasicBlock::const_pred_iterator PI = MBB->pred_begin(), E = MBB->pred_end(); PI != E; ++PI) MarkVirtRegAliveInBlock(VRInfo, *PI); From reid at x10sys.com Sun Aug 29 00:24:12 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 00:24:12 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/AIX/Path.cpp Message-ID: <200408290524.AAA09103@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/AIX: Path.cpp added (r1.1) --- Log message: Revise the design of the Path concept per peer review. Too many changes to note individually but these essence of it is to not derive from std::string, clarify the interface, and provide better documentation. There is now also (untested) implementations for AIX, Darwin, and SunOS. --- Diffs of the changes: (+36 -0) Index: llvm/lib/System/AIX/Path.cpp diff -c /dev/null llvm/lib/System/AIX/Path.cpp:1.1 *** /dev/null Sun Aug 29 00:24:11 2004 --- llvm/lib/System/AIX/Path.cpp Sun Aug 29 00:24:00 2004 *************** *** 0 **** --- 1,36 ---- + //===- llvm/System/AIX/Path.cpp - AIX Path Implementation -------*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Reid Spencer and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file provides the AIX specific implementation of the Path class. + // + //===----------------------------------------------------------------------===// + + //===----------------------------------------------------------------------===// + //=== WARNING: Implementation here must contain only AIX specific code + //=== and must not be generic UNIX code (see ../Unix/Path.cpp) + //===----------------------------------------------------------------------===// + + // Include the generic unix implementation + #include "../Unix/Path.cpp" + + namespace llvm { + using namespace sys; + + bool + Path::is_valid() const { + if (path.empty()) + return false; + if (path.length() >= MAXPATHLEN) + return false; + return true; + } + + } + + // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab From reid at x10sys.com Sun Aug 29 00:24:12 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 00:24:12 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/System/Path.h Message-ID: <200408290524.AAA09106@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/System: Path.h updated: 1.3 -> 1.4 --- Log message: Revise the design of the Path concept per peer review. Too many changes to note individually but these essence of it is to not derive from std::string, clarify the interface, and provide better documentation. There is now also (untested) implementations for AIX, Darwin, and SunOS. --- Diffs of the changes: (+376 -122) Index: llvm/include/llvm/System/Path.h diff -u llvm/include/llvm/System/Path.h:1.3 llvm/include/llvm/System/Path.h:1.4 --- llvm/include/llvm/System/Path.h:1.3 Wed Aug 25 01:20:07 2004 +++ llvm/include/llvm/System/Path.h Sun Aug 29 00:24:00 2004 @@ -19,138 +19,392 @@ namespace llvm { namespace sys { - /// This class provides an abstraction for the name of a path - /// to a file or directory in the filesystem and various basic operations - /// on it. + /// This class provides an abstraction for the path to a file or directory + /// in the operating system's filesystem and provides various basic operations + /// on it. Note that this class only represents the name of a path to a file + /// or directory which may or may not be valid for a given machine's file + /// system. A Path ensures that the name it encapsulates is syntactical valid + /// for the operating system it is running on but does not ensure correctness + /// for any particular file system. A Path either references a file or a + /// directory and the distinction is consistently maintained. Most operations + /// on the class have invariants that require the Path object to be either a + /// file path or a directory path, but not both. Those operations will also + /// leave the object as either a file path or object path. There is exactly + /// one invalid Path which is the empty path. The class should never allow any + /// other syntactically invalid non-empty path name to be assigned. Empty + /// paths are required in order to indicate an error result. If the path is + /// empty, the is_valid operation will return false. All operations will fail + /// if is_valid is false. Operations that change the path will either return + /// false if it would cause a syntactically invalid path name (in which case + /// the Path object is left unchanged) or throw an std::string exception + /// indicating the error. /// @since 1.4 /// @brief An abstraction for operating system paths. - class Path : public std::string { - /// @name Constructors - /// @{ - public: - /// Creates a null (empty) path - /// @brief Default Constructor - Path () : std::string() {} - - /// Creates a path from char* - /// @brief char* converter - Path ( const char * name ) : std::string(name) { - assert(is_valid()); - } - - /// @brief std::string converter - Path ( const std::string& name ) : std::string(name){ - assert(is_valid()); - }; - - /// Copies the path with copy-on-write semantics. The \p this Path - /// will reference \p the that Path until one of them is modified - /// at which point a full copy is taken before the write. - /// @brief Copy Constructor - Path ( const Path & that ) : std::string(that) {} - - /// Releases storage associated with the Path object - /// @brief Destructor - ~Path ( void ) {}; - - /// @} - /// @name Operators - /// @{ - public: - /// Makes a copy of \p that to \p this with copy-on-write semantics. - /// @returns \p this - /// @brief Assignment Operator - Path & operator = ( const Path & that ) { - this->assign (that); - return *this; - } - - /// Comparies \p this Path with \p that Path for equality. - /// @returns true if \p this and \p that refer to the same item. - /// @brief Equality Operator - bool operator ==( const Path & that ) const { - return 0 == this->compare( that ) ; - } - - /// Comparies \p this Path with \p that Path for inequality. - /// @returns true if \p this and \p that refer to different items. - /// @brief Inequality Operator - bool operator !=( const Path & that ) const { - return 0 != this->compare( that ); - } - - /// @} - /// @name Accessors - /// @{ - public: - /// @returns true if the path is valid - /// @brief Determines if the path is valid (properly formed) or not. - bool is_valid() const; - - /// @returns true if the path could reference a file - /// @brief Determines if the path is valid for a file reference. - bool is_file() const; - - /// @returns true if the path could reference a directory - /// @brief Determines if the path is valid for a directory reference. - bool is_directory() const; - - /// @brief Fills and zero terminates a buffer with the path - void fill( char* buffer, unsigned len ) const; - - /// @} - /// @name Mutators - /// @{ - public: - /// This ensures that the pathname is terminated with a / - /// @brief Make the path reference a directory. - void make_directory(); - - /// This ensures that the pathname is not terminated with a / - /// @brief Makes the path reference a file. - void make_file(); + class Path { + /// @name Constructors + /// @{ + public: + /// Construct a path to the root directory of the file system. The root + /// directory is a top level directory above which there are no more + /// directories. For example, on UNIX, the root directory is /. On Windows + /// it is C:\. Other operating systems may have different notions of + /// what the root directory is. + /// @throws nothing + static Path GetRootDirectory(); + + /// Construct a path to a unique temporary directory that is created in + /// a "standard" place for the operating system. The directory is + /// guaranteed to be created on exit from this function. If the directory + /// cannot be created, the function will throw an exception. + /// @throws std::string indicating why the directory could not be created. + /// @brief Constrct a path to an new, unique, existing temporary + /// directory. + static Path GetTemporaryDirectory(); + + /// Construct a path to the first system library directory. The + /// implementation of Path on a given platform must ensure that this + /// directory both exists and also contains standard system libraries + /// suitable for linking into programs. + /// @throws nothing + /// @brief Construct a path to the first system library directory + static Path GetSystemLibraryPath1(); + + /// Construct a path to the second system library directory. The + /// implementation of Path on a given platform must ensure that this + /// directory both exists and also contains standard system libraries + /// suitable for linking into programs. Note that the "second" system + /// library directory may or may not be different from the first. + /// @throws nothing + /// @brief Construct a path to the second system library directory + static Path GetSystemLibraryPath2(); + + /// Construct a path to the default LLVM configuration directory. The + /// implementation must ensure that this is a well-known (same on many + /// systems) directory in which llvm configuration files exist. For + /// example, on Unix, the /etc/llvm directory has been selected. + /// @throws nothing + /// @brief Construct a path to the default LLVM configuration directory + static Path GetLLVMDefaultConfigDir(); + + /// Construct a path to the LLVM installed configuration directory. The + /// implementation must ensure that this refers to the "etc" directory of + /// the LLVM installation. This is the location where configuration files + /// will be located for a particular installation of LLVM on a machine. + /// @throws nothing + /// @brief Construct a path to the LLVM installed configuration directory + static Path GetLLVMConfigDir(); + + /// Construct a path to the current user's home directory. The + /// implementation must use an operating system specific mechanism for + /// determining the user's home directory. For example, the environment + /// variable "HOME" could be used on Unix. If a given operating system + /// does not have the concept of a user's home directory, this static + /// constructor must provide the same result as GetRootDirectory. + /// @throws nothing + /// @brief Construct a path to the current user's "home" directory + static Path GetUserHomeDirectory(); + + /// This is one of the very few ways in which a path can be constructed + /// with a syntactically invalid name. The only *legal* invalid name is an + /// empty one. Other invalid names are not permitted. Empty paths are + /// provided so that they can be used to indicate null or error results in + /// other lib/System functionality. + /// @throws nothing + /// @brief Construct an empty (and invalid) path. + Path() : path() {} + + /// This constructor will accept a std::string as a path but if verifies + /// that the path string has a legal syntax for the operating system on + /// which it is running. This allows a path to be taken in from outside + /// the program. However, if the path is not valid, the Path object will + /// be set to an empty string and an exception will be thrown. + /// @throws std::string if the path string is not legal. + /// @param unvalidated_path The path to verify and assign. + /// @brief Construct a Path from a string. + explicit Path(std::string unverified_path); + + /// @} + /// @name Operators + /// @{ + public: + /// Makes a copy of \p that to \p this. + /// @returns \p this + /// @throws nothing + /// @brief Assignment Operator + Path & operator = ( const Path & that ) { + path = that.path; + return *this; + } - /// the file system. + /// Compares \p this Path with \p that Path for equality. + /// @returns true if \p this and \p that refer to the same thing. + /// @throws nothing + /// @brief Equality Operator + bool operator == (const Path& that) const { + return 0 == path.compare(that.path) ; + } + + /// Compares \p this Path with \p that Path for inequality. + /// @returns true if \p this and \p that refer to different things. + /// @throws nothing + /// @brief Inequality Operator + bool operator !=( const Path & that ) const { + return 0 != path.compare( that.path ); + } + + /// Determines if \p this Path is less than \p that Path. This is required + /// so that Path objects can be placed into ordered collections (e.g. + /// std::map). The comparison is done lexicographically as defined by + /// the std::string::compare method. + /// @returns true if \p this path is lexicographically less than \p that. + /// @throws nothing + /// @brief Less Than Operator + bool operator< (const Path& that) const { + return 0 > path.compare( that.path ); + } + + /// @} + /// @name Accessors + /// @{ + public: + /// This function will use an operating system specific algorithm to + /// determine if the current value of \p this is a syntactically valid + /// path name for the operating system. The path name does not need to + /// exist, validity is simply syntactical. Empty paths are always invalid. + /// @returns true iff the path name is syntactically legal for the + /// host operating system. + /// @brief Determine if a path is syntactically valid or not. + bool is_valid() const; + + /// This function determines if the contents of the path name are + /// empty. That is, the path has a zero length. + /// @returns true iff the path is empty. + /// @brief Determines if the path name is empty (invalid). + bool is_empty() const { return path.empty(); } + + /// This function determines if the path name in this object is intended + /// to reference a legal file name (as opposed to a directory name). This + /// function does not verify anything with the file system, it merely + /// determines if the syntax of the path represents a file name or not. + /// @returns true if this path name references a file. + /// @brief Determines if the path name references a file. + bool is_file() const; + + /// This function determines if the path name in this object is intended + /// to reference a legal directory name (as opposed to a file name). This + /// function does not verify anything with the file system, it merely + /// determines if the syntax of the path represents a directory name or + /// not. + /// @returns true if the path name references a directory + /// @brief Determines if the path name references a directory. + bool is_directory() const; + + /// This function determines if the path name in this object references + /// the root (top level directory) of the file system. The details of what + /// is considered the "root" may vary from system to system so this method + /// will do the necessary checking. + /// @returns true iff the path name references the root directory. + /// @brief Determines if the path references the root directory. + bool is_root_directory() const; + + /// This function determines if the path name references an existing file + /// or directory in the file system. Unlike is_file and is_directory, this + /// function actually checks for the existence of the file or directory. /// @returns true if the pathname references an existing file. /// @brief Determines if the path is a file or directory in - bool exists(); + /// the file system. + bool exists() const; - /// The \p dirname is added to the end of the Path. + /// This function determines if the path name references a readable file + /// or directory in the file system. Unlike is_file and is_directory, this + /// function actually checks for the existence and readability (by the + /// current program) of the file or directory. + /// @returns true if the pathname references a readable file. + /// @brief Determines if the path is a readable file or directory + /// in the file system. + bool readable() const; + + /// This function determines if the path name references a writable file + /// or directory in the file system. Unlike is_file and is_directory, this + /// function actually checks for the existence and writability (by the + /// current program) of the file or directory. + /// @returns true if the pathname references a writable file. + /// @brief Determines if the path is a writable file or directory + /// in the file system. + bool writable() const; + + /// This function determines if the path name references an executable + /// file in the file system. Unlike is_file and is_directory, this + /// function actually checks for the existence and executability (by + /// the current program) of the file. + /// @returns true if the pathname references an executable file. + /// @brief Determines if the path is an executable file in the file + /// system. + bool executable() const; + + /// This function returns the current contents of the path as a + /// std::string. This allows the underlying path string to be manipulated + /// by other software. + /// @returns std::string containing the path name. + /// @brief Returns the path as a std::string. + std::string get() const { return path; } + + /// This function returns the last component of the path name. If the + /// is_directory() function would return true then this returns the name + /// of the last directory in the path. If the is_file() function would + /// return true then this function returns the name of the file without + /// any of the preceding directories. + /// @returns std::string containing the last component of the path name. + /// @brief Returns the last component of the path name. + std::string getLast() const; + + /// @returns a c string containing the path name. + /// @brief Returns the path as a C string. + const char* const c_str() const { return path.c_str(); } + + /// @} + /// @name Mutators + /// @{ + public: + /// The path name is cleared and becomes empty. This is an invalid + /// path name but is the *only* invalid path name. This is provided + /// so that path objects can be used to indicate the lack of a + /// valid path being found. + void clear() { path.clear(); } + + /// This method attempts to set the Path object to \p unverified_path + /// and interpret the name as a directory name. The \p unverified_path + /// is verified. If verification succeeds then \p unverified_path + /// is accepted as a directory and true is returned. Otherwise, + /// the Path object remains unchanged and false is returned. + /// @returns true if the path was set, false otherwise. + /// @param unverified_path The path to be set in Path object. + /// @throws nothing + /// @brief Set a full path from a std::string + bool set_directory(const std::string& unverified_path); + + /// This method attempts to set the Path object to \p unverified_path + /// and interpret the name as a file name. The \p unverified_path + /// is verified. If verification succeeds then \p unverified_path + /// is accepted as a file name and true is returned. Otherwise, + /// the Path object remains unchanged and false is returned. + /// @returns true if the path was set, false otherwise. + /// @param unverified_path The path to be set in Path object. + /// @throws nothing + /// @brief Set a full path from a std::string + bool set_file(const std::string& unverified_path); + + /// The \p dirname is added to the end of the Path if it is a legal + /// directory name for the operating system. The precondition for this + /// function is that the Path must reference a directory name (i.e. + /// is_directory() returns true). /// @param dirname A string providing the directory name to - /// be appended to the path. - /// @brief Appends the name of a directory. - void append_directory( const std::string& dirname ) { - this->append( dirname ); - make_directory(); - } - - /// The \p filename is added to the end of the Path. + /// be added to the end of the path. + /// @returns false if the directory name could not be added + /// @throws nothing + /// @brief Adds the name of a directory to a Path. + bool append_directory( const std::string& dirname ); + + /// One directory component is removed from the Path name. The Path must + /// refer to a non-root directory name (i.e. is_directory() returns true + /// but is_root_directory() returns false). Upon exit, the Path will + /// refer to the directory above it. + /// @throws nothing + /// @returns false if the directory name could not be removed. + /// @brief Removes the last directory component of the Path. + bool elide_directory(); + + /// The \p filename is added to the end of the Path if it is a legal + /// directory name for the operating system. The precondition for this + /// function is that the Path reference a directory name (i.e. + /// is_directory() returns true). + /// @throws nothing + /// @returns false if the file name could not be added. /// @brief Appends the name of a file. - void append_file( const std::string& filename ) { - this->append( filename ); - } + bool append_file( const std::string& filename ); - /// Directories will have no entries. Files will be zero length. If - /// the file or directory already exists, no error results. - /// @throws SystemException if any error occurs. - /// @brief Causes the file or directory to exist in the filesystem. - void create( bool create_parents = false ); - - void create_directory( void ); - void create_directories( void ); - void create_file( void ); - - /// Directories must be empty before they can be removed. If not, - /// an error will result. Files will be unlinked, even if another - /// process is using them. + /// One file component is removed from the Path name. The Path must + /// refer to a file (i.e. is_file() returns true). Upon exit, + /// the Path will refer to the directory above it. + /// @throws nothing + /// @returns false if the file name could not be removed + /// @brief Removes the last file component of the path. + bool elide_file(); + + /// A period and the \p suffix are appended to the end of the pathname. + /// The precondition for this function is that the Path reference a file + /// name (i.e. is_file() returns true). If the Path is not a file, no + /// action is taken and the function returns false. If the path would + /// become invalid for the host operating system, false is returned. + /// @returns false if the suffix could not be added, true if it was. + /// @throws nothing + /// @brief Adds a period and the \p suffix to the end of the pathname. + bool append_suffix(const std::string& suffix); + + /// The suffix of the filename is removed. The suffix begins with and + /// includes the last . character in the filename after the last directory + /// separator and extends until the end of the name. If no . character is + /// after the last directory separator, then the file name is left + /// unchanged (i.e. it was already without a suffix) but the function return + /// false. + /// @returns false if there was no suffix to remove, true otherwise. + /// @throws nothing + /// @brief Remove the suffix from a path name. + bool elide_suffix(); + + /// This method attempts to create a directory in the file system with the + /// same name as the Path object. The \p create_parents parameter controls + /// whether intermediate directories are created or not. if \p + /// create_parents is true, then an attempt will be made to create all + /// intermediate directories. If \p create_parents is false, then only the + /// final directory component of the Path name will be created. The + /// created directory will have no entries. + /// @returns false if the Path does not reference a directory, true + /// otherwise. + /// @param create_parents Determines whether non-existent directory + /// components other than the last one (the "parents") are created or not. + /// @throws std::string if an error occurs. + /// @brief Create the directory this Path refers to. + bool create_directory( bool create_parents = false ); + + /// This method attempts to create a file in the file system with the same + /// name as the Path object. The intermediate directories must all exist + /// at the time this method is called. Use create_directories to + /// accomplish that. The created file will be empty upon return from this + /// function. + /// @returns false if the Path does not reference a file, true otherwise. + /// @throws std::string if an error occurs. + /// @brief Create the file this Path refers to. + bool create_file(); + + /// This method attempts to destroy the directory named by the last in + /// the Path name. If \p remove_contents is false, an attempt will be + /// made to remove just the directory that this Path object refers to + /// (the final Path component). If \p remove_contents is true, an attempt + /// will be made to remove the entire contents of the directory, + /// recursively. + /// @param destroy_contents Indicates whether the contents of a destroyed + /// directory should also be destroyed (recursively). + /// @returns false if the Path does not refer to a directory, true + /// otherwise. + /// @throws std::string if there is an error. /// @brief Removes the file or directory from the filesystem. - void remove( void ); - void remove_directory( void ); - void remove_file( void ); - - /// Find library. - void find_lib( const char * file ); - /// @} + bool destroy_directory( bool destroy_contents = false ); + + /// This method attempts to destroy the file named by the last item in the + /// Path name. + /// @returns false if the Path does not refer to a file, true otherwise. + /// @throws std::string if there is an error. + /// @brief Destroy the file this Path refers to. + bool destroy_file(); + + /// @} + /// @name Data + /// @{ + private: + std::string path; ///< Platform agnostic storage for the path name. + + /// @} }; } } From reid at x10sys.com Sun Aug 29 00:24:12 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 00:24:12 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Unix/Path.cpp Message-ID: <200408290524.AAA09114@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Unix: Path.cpp updated: 1.1 -> 1.2 --- Log message: Revise the design of the Path concept per peer review. Too many changes to note individually but these essence of it is to not derive from std::string, clarify the interface, and provide better documentation. There is now also (untested) implementations for AIX, Darwin, and SunOS. --- Diffs of the changes: (+281 -86) Index: llvm/lib/System/Unix/Path.cpp diff -u llvm/lib/System/Unix/Path.cpp:1.1 llvm/lib/System/Unix/Path.cpp:1.2 --- llvm/lib/System/Unix/Path.cpp:1.1 Wed Aug 25 01:19:01 2004 +++ llvm/lib/System/Unix/Path.cpp Sun Aug 29 00:24:01 2004 @@ -13,126 +13,321 @@ //===----------------------------------------------------------------------===// //=== WARNING: Implementation here must contain only generic UNIX code that -//=== is guaranteed to work on all UNIX variants. +//=== is guaranteed to work on *all* UNIX variants. //===----------------------------------------------------------------------===// #include "Unix.h" #include #include +#include + +namespace llvm { +using namespace sys; + +Path::Path(std::string unverified_path) + : path(unverified_path) +{ + if (unverified_path.empty()) + return; + if (this->is_valid()) + return; + // oops, not valid. + path.clear(); + ThrowErrno(unverified_path + ": path is not valid"); +} + +Path +Path::GetRootDirectory() { + Path result; + result.set_directory("/"); + return result; +} + +Path +Path::GetTemporaryDirectory() { + char pathname[MAXPATHLEN]; + strcpy(pathname,"/tmp/llvm_XXXXXX"); + if (0 == mkdtemp(pathname)) + ThrowErrno(std::string(pathname) + ": Can't create temporary directory"); + Path result; + result.set_directory(pathname); + assert(result.is_valid() && "mkdtemp didn't create a valid pathname!"); + return result; +} + +Path +Path::GetSystemLibraryPath1() { + return Path("/lib/"); +} + +Path +Path::GetSystemLibraryPath2() { + return Path("/usr/lib/"); +} + +Path +Path::GetLLVMDefaultConfigDir() { + return Path("/etc/llvm/"); +} + +Path +Path::GetLLVMConfigDir() { + Path result; + if (result.set_directory(LLVM_ETCDIR)) + return result; + return GetLLVMDefaultConfigDir(); +} + +Path +Path::GetUserHomeDirectory() { + const char* home = getenv("HOME"); + if (home) { + Path result; + if (result.set_directory(home)) + return result; + } + return GetRootDirectory(); +} bool -Path::is_file() const { - if (!empty() && ((*this)[length()-1] != '/')) - return true; - return false; +Path::exists() const { + return 0 == access(path.c_str(), F_OK ); } bool -Path::is_directory() const { - if ((!empty()) && ((*this)[length()-1] == '/')) - return true; - return false; +Path::readable() const { + return 0 == access(path.c_str(), F_OK | R_OK ); +} + +bool +Path::writable() const { + return 0 == access(path.c_str(), F_OK | W_OK ); } -void -Path::create( bool create_parents) { - if ( is_directory() ) { - if ( create_parents ) - this->create_directories( ); - this->create_directory( ); - } else if ( is_file() ) { - if ( create_parents ) - this->create_directories( ); - this->create_file( ); +bool +Path::executable() const { + return 0 == access(path.c_str(), R_OK | X_OK ); +} + +std::string +Path::getLast() const { + // Find the last slash + size_t pos = path.rfind('/'); + + // Handle the corner cases + if (pos == std::string::npos) + return path; + + // If the last character is a slash + if (pos == path.length()-1) { + // Find the second to last slash + size_t pos2 = path.rfind('/', pos-1); + if (pos2 == std::string::npos) + return path.substr(0,pos); + else + return path.substr(pos2+1,pos-pos2-1); } + // Return everything after the last slash + return path.substr(pos+1); } -void -Path::remove() { - if ( is_directory() ) { - if ( exists() ) - this->remove_directory( ); - } else if ( is_file() ) - if ( exists() ) - this->remove_file( ); +bool +Path::set_directory(const std::string& a_path) { + if (a_path.size() == 0) + return false; + Path save(*this); + path = a_path; + size_t last = a_path.size() -1; + if (last != 0 && a_path[last] != '/') + path += '/'; + if (!is_valid()) { + path = save.path; + return false; + } + return true; } bool -Path::exists() { - char pathname[MAXPATHLEN]; - this->fill(pathname,MAXPATHLEN); - int lastchar = this->length() - 1 ; - if (pathname[lastchar] == '/') - pathname[lastchar] = 0; - return 0 == access(pathname, F_OK ); +Path::set_file(const std::string& a_path) { + if (a_path.size() == 0) + return false; + Path save(*this); + path = a_path; + size_t last = a_path.size() - 1; + while (last > 0 && a_path[last] == '/') + last--; + path.erase(last+1); + if (!is_valid()) { + path = save.path; + return false; + } + return true; } -void -Path::create_directory( ) { - char pathname[MAXPATHLEN]; - this->fill(pathname,MAXPATHLEN); - int lastchar = this->length() - 1 ; - if (pathname[lastchar] == '/') - pathname[lastchar] = 0; - if (0 != mkdir(pathname, S_IRWXU | S_IRWXG)) - ThrowErrno(pathname); +bool +Path::append_directory(const std::string& dir) { + if (is_file()) + return false; + Path save(*this); + path += dir; + path += "/"; + if (!is_valid()) { + path = save.path; + return false; + } + return true; } -void -Path::create_directories() { - char pathname[MAXPATHLEN]; - this->fill(pathname,MAXPATHLEN); - int lastchar = this->length() - 1 ; - if (pathname[lastchar] == '/') - pathname[lastchar] = 0; +bool +Path::elide_directory() { + if (is_file()) + return false; + size_t slashpos = path.rfind('/',path.size()); + if (slashpos == 0 || slashpos == std::string::npos) + return false; + if (slashpos == path.size() - 1) + slashpos = path.rfind('/',slashpos-1); + if (slashpos == std::string::npos) + return false; + path.erase(slashpos); + return true; +} - char * next = index(pathname,'/'); - if ( pathname[0] == '/') - next = index(&pathname[1],'/'); - while ( next != 0 ) - { - *next = 0; - if (0 != access(pathname, F_OK | R_OK)) - if (0 != mkdir(pathname, S_IRWXU | S_IRWXG)) - ThrowErrno(pathname); - char* save = next; - next = index(pathname,'/'); - *save = '/'; +bool +Path::append_file(const std::string& file) { + if (!is_directory()) + return false; + Path save(*this); + path += file; + if (!is_valid()) { + path = save.path; + return false; } + return true; } -void -Path::remove_directory() -{ +bool +Path::elide_file() { + if (is_directory()) + return false; + size_t slashpos = path.rfind('/',path.size()); + if (slashpos == std::string::npos) + return false; + path.erase(slashpos+1); + return true; +} + +bool +Path::append_suffix(const std::string& suffix) { + if (is_directory()) + return false; + Path save(*this); + path.append("."); + path.append(suffix); + if (!is_valid()) { + path = save.path; + return false; + } + return true; +} + +bool +Path::elide_suffix() { + if (is_directory()) return false; + size_t dotpos = path.rfind('.',path.size()); + size_t slashpos = path.rfind('/',path.size()); + if (slashpos != std::string::npos && dotpos != std::string::npos && + dotpos > slashpos) { + path.erase(dotpos, path.size()-dotpos); + return true; + } + return false; +} + + +bool +Path::create_directory( bool create_parents) { + // Make sure we're dealing with a directory + if (!is_directory()) return false; + + // Get a writeable copy of the path name char pathname[MAXPATHLEN]; - this->fill(pathname,MAXPATHLEN); - int lastchar = this->length() - 1 ; + path.copy(pathname,MAXPATHLEN); + + // Null-terminate the last component + int lastchar = path.length() - 1 ; if (pathname[lastchar] == '/') pathname[lastchar] = 0; - if ( 0 != rmdir(pathname)) - ThrowErrno(pathname); + + // If we're supposed to create intermediate directories + if ( create_parents ) { + // Find the end of the initial name component + char * next = strchr(pathname,'/'); + if ( pathname[0] == '/') + next = strchr(&pathname[1],'/'); + + // Loop through the directory components until we're done + while ( next != 0 ) { + *next = 0; + if (0 != access(pathname, F_OK | R_OK | W_OK)) + if (0 != mkdir(pathname, S_IRWXU | S_IRWXG)) + ThrowErrno(std::string(pathname) + ": Can't create directory"); + char* save = next; + next = strchr(pathname,'/'); + *save = '/'; + } + } else if (0 != mkdir(pathname, S_IRWXU | S_IRWXG)) { + ThrowErrno(std::string(pathname) + ": Can't create directory"); + } + return true; } -void +bool Path::create_file() { - char pathname[MAXPATHLEN]; - this->fill(pathname,MAXPATHLEN); - int lastchar = this->length() - 1 ; - if (pathname[lastchar] == '/') - pathname[lastchar] = 0; - if (0 != creat(pathname, S_IRUSR | S_IWUSR)) - ThrowErrno(pathname); + // Make sure we're dealing with a file + if (!is_file()) return false; + + // Create the file + if (0 != creat(path.c_str(), S_IRUSR | S_IWUSR)) + ThrowErrno(std::string(path.c_str()) + ": Can't create file"); + + return true; +} + +bool +Path::destroy_directory(bool remove_contents) { + // Make sure we're dealing with a directory + if (!is_directory()) return false; + + // If it doesn't exist, we're done. + if (!exists()) return true; + + if (remove_contents) { + // Recursively descend the directory to remove its content + std::string cmd("/bin/rm -rf "); + cmd += path; + system(cmd.c_str()); + } else { + // Otherwise, try to just remove the one directory + char pathname[MAXPATHLEN]; + path.copy(pathname,MAXPATHLEN); + int lastchar = path.length() - 1 ; + if (pathname[lastchar] == '/') + pathname[lastchar] = 0; + if ( 0 != rmdir(pathname)) + ThrowErrno(std::string(pathname) + ": Can't destroy directory"); + } + return true; +} + +bool +Path::destroy_file() { + if (!is_file()) return false; + if (0 != unlink(path.c_str())) + ThrowErrno(std::string(path.c_str()) + ": Can't destroy file"); + return true; } -void -Path::remove_file() { - char pathname[MAXPATHLEN]; - this->fill(pathname,MAXPATHLEN); - int lastchar = this->length() - 1 ; - if (pathname[lastchar] == '/') - pathname[lastchar] = 0; - if (0 != unlink(pathname)) - ThrowErrno(pathname); } // vim: sw=2 From reid at x10sys.com Sun Aug 29 00:24:12 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 00:24:12 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/SunOS/Path.cpp Message-ID: <200408290524.AAA09121@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/SunOS: Path.cpp added (r1.1) --- Log message: Revise the design of the Path concept per peer review. Too many changes to note individually but these essence of it is to not derive from std::string, clarify the interface, and provide better documentation. There is now also (untested) implementations for AIX, Darwin, and SunOS. --- Diffs of the changes: (+38 -0) Index: llvm/lib/System/SunOS/Path.cpp diff -c /dev/null llvm/lib/System/SunOS/Path.cpp:1.1 *** /dev/null Sun Aug 29 00:24:11 2004 --- llvm/lib/System/SunOS/Path.cpp Sun Aug 29 00:24:01 2004 *************** *** 0 **** --- 1,38 ---- + //===- llvm/System/SunOS/Path.cpp - SunOS Path Implementation ---*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Reid Spencer and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file provides the SunOS specific implementation of the Path class. + // + //===----------------------------------------------------------------------===// + + //===----------------------------------------------------------------------===// + //=== WARNING: Implementation here must contain only SunOS specific code + //=== and must not be generic UNIX code (see ../Unix/Path.cpp) + //===----------------------------------------------------------------------===// + + // Include the generic Unix implementation + #include "../Unix/Path.cpp" + + namespace llvm { + using namespace sys; + + bool + Path::is_valid() const { + if (path.empty()) + return false; + char pathname[MAXPATHLEN]; + if (0 == realpath(path.c_str(), pathname)) + if (errno != EACCES && errno != EIO && errno != ENOENT && errno != ENOTDIR) + return false; + return true; + } + + } + + // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab From reid at x10sys.com Sun Aug 29 00:24:12 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 00:24:12 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Path.cpp Message-ID: <200408290524.AAA09112@zion.cs.uiuc.edu> Changes in directory llvm/lib/System: Path.cpp updated: 1.3 -> 1.4 --- Log message: Revise the design of the Path concept per peer review. Too many changes to note individually but these essence of it is to not derive from std::string, clarify the interface, and provide better documentation. There is now also (untested) implementations for AIX, Darwin, and SunOS. --- Diffs of the changes: (+7 -28) Index: llvm/lib/System/Path.cpp diff -u llvm/lib/System/Path.cpp:1.3 llvm/lib/System/Path.cpp:1.4 --- llvm/lib/System/Path.cpp:1.3 Wed Aug 25 01:19:01 2004 +++ llvm/lib/System/Path.cpp Sun Aug 29 00:24:00 2004 @@ -10,10 +10,11 @@ // This header file implements the operating system Path concept. // //===----------------------------------------------------------------------===// + #include "llvm/System/Path.h" namespace llvm { -namespace sys { +using namespace sys; //===----------------------------------------------------------------------===// //=== WARNING: Implementation here must contain only TRULY operating system @@ -21,40 +22,18 @@ //===----------------------------------------------------------------------===// bool -Path::is_valid() const { - if ( empty() ) return false; - return true; -} - -void -Path::fill( char* buffer, unsigned bufflen ) const { - unsigned pathlen = length(); - assert( bufflen > pathlen && "Insufficient buffer size" ); - unsigned copylen = pathlen copy(buffer, copylen, 0 ); - buffer[ copylen ] = 0; +Path::is_file() const { + return (is_valid() && path[path.length()-1] != '/'); } -void -Path::make_directory() { - char end[2]; - end[0] = '/'; - end[1] = 0; - if ( empty() ) - this->assign( end ); - else if ( (*this)[length()-1] != '/') - this->append( end ); +bool +Path::is_directory() const { + return (is_valid() && path[path.length()-1] == '/'); } -void -Path::make_file() { - if ( (*this)[length()-1] == '/') - this->erase( this->length()-1, 1 ); } // Include the truly platform-specific parts of this class. #include "platform/Path.cpp" -} -} // vim: sw=2 From reid at x10sys.com Sun Aug 29 00:24:12 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 00:24:12 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Darwin/Path.cpp Message-ID: <200408290524.AAA09107@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Darwin: Path.cpp added (r1.1) --- Log message: Revise the design of the Path concept per peer review. Too many changes to note individually but these essence of it is to not derive from std::string, clarify the interface, and provide better documentation. There is now also (untested) implementations for AIX, Darwin, and SunOS. --- Diffs of the changes: (+36 -0) Index: llvm/lib/System/Darwin/Path.cpp diff -c /dev/null llvm/lib/System/Darwin/Path.cpp:1.1 *** /dev/null Sun Aug 29 00:24:11 2004 --- llvm/lib/System/Darwin/Path.cpp Sun Aug 29 00:24:01 2004 *************** *** 0 **** --- 1,36 ---- + //===- llvm/System/Darwin/Path.cpp - Linux Path Implementation --*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Reid Spencer and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file provides the Darwin specific implementation of the Path class. + // + //===----------------------------------------------------------------------===// + + //===----------------------------------------------------------------------===// + //=== WARNING: Implementation here must contain only Darwin specific code + //=== and must not be generic UNIX code (see ../Unix/Path.cpp) + //===----------------------------------------------------------------------===// + + // Include the generic unix implementation + #include "../Unix/Path.cpp" + + namespace llvm { + using namespace sys; + + bool + Path::is_valid() const { + if (path.empty()) + return false; + if (path.length() >= MAXPATHLEN) + return false; + return true; + } + + } + + // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab From reid at x10sys.com Sun Aug 29 00:24:12 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 00:24:12 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Linux/Path.cpp Message-ID: <200408290524.AAA09113@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Linux: Path.cpp updated: 1.1 -> 1.2 --- Log message: Revise the design of the Path concept per peer review. Too many changes to note individually but these essence of it is to not derive from std::string, clarify the interface, and provide better documentation. There is now also (untested) implementations for AIX, Darwin, and SunOS. --- Diffs of the changes: (+20 -2) Index: llvm/lib/System/Linux/Path.cpp diff -u llvm/lib/System/Linux/Path.cpp:1.1 llvm/lib/System/Linux/Path.cpp:1.2 --- llvm/lib/System/Linux/Path.cpp:1.1 Wed Aug 25 01:19:01 2004 +++ llvm/lib/System/Linux/Path.cpp Sun Aug 29 00:24:01 2004 @@ -13,8 +13,26 @@ //===----------------------------------------------------------------------===// //=== WARNING: Implementation here must contain only Linux specific code -//=== and must not be generic UNIX code (see ../Unix) +//=== and must not be generic UNIX code (see ../Unix/Path.cpp) //===----------------------------------------------------------------------===// -// Th..Th..Th..Tha's All Folks! +// Include the generic Unix implementation #include "../Unix/Path.cpp" + +namespace llvm { +using namespace sys; + +bool +Path::is_valid() const { + if (path.empty()) + return false; + char pathname[MAXPATHLEN]; + if (0 == realpath(path.c_str(), pathname)) + if (errno != EACCES && errno != EIO && errno != ENOENT && errno != ENOTDIR) + return false; + return true; +} + +} + +// vim: sw=2 smartindent smarttab tw=80 autoindent expandtab From reid at x10sys.com Sun Aug 29 00:27:26 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 00:27:26 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/System/Signals.h Message-ID: <200408290527.AAA09147@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/System: Signals.h updated: 1.10 -> 1.11 --- Log message: Add a function to remove whole directorys on fatal signal. Doxygenify function comments. --- Diffs of the changes: (+14 -6) Index: llvm/include/llvm/System/Signals.h diff -u llvm/include/llvm/System/Signals.h:1.10 llvm/include/llvm/System/Signals.h:1.11 --- llvm/include/llvm/System/Signals.h:1.10 Thu May 27 00:30:18 2004 +++ llvm/include/llvm/System/Signals.h Sun Aug 29 00:27:15 2004 @@ -15,18 +15,26 @@ #ifndef LLVM_SYSTEM_SIGNALS_H #define LLVM_SYSTEM_SIGNALS_H -#include +#include "llvm/System/Path.h" namespace llvm { - /// RemoveFileOnSignal - This function registers signal handlers to ensure - /// that if a signal gets delivered that the named file is removed. - /// + /// This function registers signal handlers to ensure that if a signal gets + /// delivered that the named file is removed. + /// @brief Remove a file if a fatal signal occurs. void RemoveFileOnSignal(const std::string &Filename); - /// PrintStackTraceOnErrorSignal - When an error signal (such as SIBABRT or - /// SIGSEGV) is delivered to the process, print a stack trace and then exit. + /// This function registers a signal handler to ensure that if a fatal signal + /// gets delivered to the process that the named directory and all its + /// contents are removed. + /// @brief Remove a directory if a fatal signal occurs. + void RemoveDirectoryOnSignal(const llvm::sys::Path& path); + + /// When an error signal (such as SIBABRT or SIGSEGV) is delivered to the + /// process, print a stack trace and then exit. + /// @brief Print a stack trace if a fatal signal occurs. void PrintStackTraceOnErrorSignal(); + } // End llvm namespace #endif From reid at x10sys.com Sun Aug 29 00:29:45 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 00:29:45 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/System/Program.h Message-ID: <200408290529.AAA09176@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/System: Program.h added (r1.1) --- Log message: Initial commit of the platform agnostic interface to finding and executing programs. --- Diffs of the changes: (+77 -0) Index: llvm/include/llvm/System/Program.h diff -c /dev/null llvm/include/llvm/System/Program.h:1.1 *** /dev/null Sun Aug 29 00:29:45 2004 --- llvm/include/llvm/System/Program.h Sun Aug 29 00:29:35 2004 *************** *** 0 **** --- 1,77 ---- + //===- llvm/System/Program.h ------------------------------------*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Reid Spencer and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file declares the llvm::sys::Program class. + // + //===----------------------------------------------------------------------===// + + #ifndef LLVM_SYSTEM_PROGRAM_H + #define LLVM_SYSTEM_PROGRAM_H + + #include "llvm/System/Path.h" + #include + + namespace llvm { + namespace sys { + + /// This class provides an abstraction for programs that are executable by the + /// operating system. It derives from Path because every executable on all + /// known operating systems has a pathname that is needed in order to execute + /// the program. This class provides an operating system agnostic interface + /// for the procedure of finding and executing programs in a variety of ways. + /// @since 1.4 + /// @brief An abstraction for operating system programs. + class Program : public Path { + /// @name Constructors + /// @{ + public: + /// This static constructor (factory) will attempt to locate a program in + /// the operating system's file system using some pre-determined set of + /// locations to search (e.g. the PATH on Unix). + /// @returns A Path object initialized to the path of the program or a + /// Path object that is empty (invalid) if the program could not be found. + /// @throws nothing + /// @brief Construct a Program by finding it by name. + static Program FindProgramByName(const std::string& name); + + /// This static constructor (factory) constructs a Program object that + /// refers to the currently executing program. + /// @brief Constructs a Program object for the currently executing + /// program. + // static Program This(); + /// FIXME: Not sure if this is currently doable. + + + /// @} + /// @name Methods + /// @{ + public: + /// This function executes the program using the \p arguments provided and + /// waits for the program to exit. This function will block the current + /// program until the invoked program exits. The invoked program will + /// inherit the stdin, stdout, and stderr file descriptors, the + /// environment and other configuration settings of the inoking program. + /// If Path::executable() does not return true when this function is + /// called then a std::string is thrown. + /// Path::executable() returns true. + /// @param arguments A vector of strings that are passed to the program. + /// The first element should *not* be the name of the program. + /// @returns an integer result code indicating the status of the program. + /// @throws std::string on a variety of error conditions or if the invoked + /// program aborted abnormally. + /// @brief Executes the program with the given set of \p arguments. + int ExecuteAndWait(const std::vector& arguments) const; + /// @} + }; + } + } + + // vim: sw=2 + + #endif From natebegeman at mac.com Sun Aug 29 03:19:43 2004 From: natebegeman at mac.com (Nate Begeman) Date: Sun, 29 Aug 2004 03:19:43 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp PowerPCInstrInfo.td README.txt Message-ID: <200408290819.DAA05684@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPC32ISelSimple.cpp updated: 1.74 -> 1.75 PowerPCInstrInfo.td updated: 1.27 -> 1.28 README.txt updated: 1.16 -> 1.17 --- Log message: Implement the following missing functionality in the PPC backend: cast fp->bool cast ulong->fp algebraic right shift long by non-constant value These changes tested across most of the test suite. Fixes Regression/casts --- Diffs of the changes: (+137 -66) Index: llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp diff -u llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.74 llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.75 --- llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.74 Sun Aug 22 03:10:15 2004 +++ llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp Sun Aug 29 03:19:32 2004 @@ -2324,12 +2324,43 @@ BuildMI(*MBB, IP, PPC::SLW, 2, DestReg+1).addReg(SrcReg+1) .addReg(ShiftAmountReg); } else { - if (isSigned) { - // FIXME: Unimplemented - // Page C-3 of the PowerPC 32bit Programming Environments Manual - std::cerr << "ERROR: Unimplemented: signed right shift of long\n"; - abort(); - } else { + if (isSigned) { // shift right algebraic + MachineBasicBlock *TmpMBB =new MachineBasicBlock(BB->getBasicBlock()); + MachineBasicBlock *PhiMBB =new MachineBasicBlock(BB->getBasicBlock()); + MachineBasicBlock *OldMBB = BB; + ilist::iterator It = BB; ++It; + F->getBasicBlockList().insert(It, TmpMBB); + F->getBasicBlockList().insert(It, PhiMBB); + BB->addSuccessor(TmpMBB); + BB->addSuccessor(PhiMBB); + + BuildMI(*MBB, IP, PPC::SUBFIC, 2, TmpReg1).addReg(ShiftAmountReg) + .addSImm(32); + BuildMI(*MBB, IP, PPC::SRW, 2, TmpReg2).addReg(SrcReg+1) + .addReg(ShiftAmountReg); + BuildMI(*MBB, IP, PPC::SLW, 2, TmpReg3).addReg(SrcReg) + .addReg(TmpReg1); + BuildMI(*MBB, IP, PPC::OR, 2, TmpReg4).addReg(TmpReg2) + .addReg(TmpReg3); + BuildMI(*MBB, IP, PPC::ADDICo, 2, TmpReg5).addReg(ShiftAmountReg) + .addSImm(-32); + BuildMI(*MBB, IP, PPC::SRAW, 2, TmpReg6).addReg(SrcReg) + .addReg(TmpReg5); + BuildMI(*MBB, IP, PPC::SRAW, 2, DestReg).addReg(SrcReg) + .addReg(ShiftAmountReg); + BuildMI(*MBB, IP, PPC::BLE, 2).addReg(PPC::CR0).addMBB(PhiMBB); + + // OrMBB: + // Select correct least significant half if the shift amount > 32 + BB = TmpMBB; + unsigned OrReg = makeAnotherReg(Type::IntTy); + BuildMI(BB, PPC::OR, 2, OrReg).addReg(TmpReg6).addImm(TmpReg6); + TmpMBB->addSuccessor(PhiMBB); + + BB = PhiMBB; + BuildMI(BB, PPC::PHI, 4, DestReg+1).addReg(TmpReg4).addMBB(OldMBB) + .addReg(OrReg).addMBB(TmpMBB); + } else { // shift right logical BuildMI(*MBB, IP, PPC::SUBFIC, 2, TmpReg1).addReg(ShiftAmountReg) .addSImm(32); BuildMI(*MBB, IP, PPC::SRW, 2, TmpReg2).addReg(SrcReg+1) @@ -2654,9 +2685,12 @@ } case cFP32: case cFP64: - // FSEL perhaps? - std::cerr << "ERROR: Cast fp-to-bool not implemented!\n"; - abort(); + unsigned TmpReg = makeAnotherReg(Type::IntTy); + unsigned ConstZero = getReg(ConstantFP::get(Type::DoubleTy, 0.0), BB, IP); + BuildMI(*MBB, IP, PPC::FCMPU, PPC::CR7).addReg(SrcReg).addReg(ConstZero); + BuildMI(*MBB, IP, PPC::MFCR, TmpReg); + BuildMI(*MBB, IP, PPC::RLWINM, DestReg).addReg(TmpReg).addImm(31) + .addImm(31).addImm(31); } return; } @@ -2678,13 +2712,70 @@ // Emit a library call for long to float conversion if (SrcClass == cLong) { - std::vector Args; - Args.push_back(ValueRecord(SrcReg, SrcTy)); Function *floatFn = (DestClass == cFP32) ? __floatdisfFn : __floatdidfFn; - MachineInstr *TheCall = - BuildMI(PPC::CALLpcrel, 1).addGlobalAddress(floatFn, true); - doCall(ValueRecord(DestReg, DestTy), TheCall, Args, false); - TM.CalledFunctions.insert(floatFn); + if (SrcTy->isSigned()) { + std::vector Args; + Args.push_back(ValueRecord(SrcReg, SrcTy)); + MachineInstr *TheCall = + BuildMI(PPC::CALLpcrel, 1).addGlobalAddress(floatFn, true); + doCall(ValueRecord(DestReg, DestTy), TheCall, Args, false); + TM.CalledFunctions.insert(floatFn); + } else { + std::vector CmpArgs, ClrArgs, SetArgs; + unsigned ZeroLong = getReg(ConstantUInt::get(SrcTy, 0)); + unsigned CondReg = makeAnotherReg(Type::IntTy); + + // Update machine-CFG edges + MachineBasicBlock *ClrMBB = new MachineBasicBlock(BB->getBasicBlock()); + MachineBasicBlock *SetMBB = new MachineBasicBlock(BB->getBasicBlock()); + MachineBasicBlock *PhiMBB = new MachineBasicBlock(BB->getBasicBlock()); + MachineBasicBlock *OldMBB = BB; + ilist::iterator It = BB; ++It; + F->getBasicBlockList().insert(It, ClrMBB); + F->getBasicBlockList().insert(It, SetMBB); + F->getBasicBlockList().insert(It, PhiMBB); + BB->addSuccessor(ClrMBB); + BB->addSuccessor(SetMBB); + + CmpArgs.push_back(ValueRecord(SrcReg, SrcTy)); + CmpArgs.push_back(ValueRecord(ZeroLong, SrcTy)); + MachineInstr *TheCall = + BuildMI(PPC::CALLpcrel, 1).addGlobalAddress(__cmpdi2Fn, true); + doCall(ValueRecord(CondReg, Type::IntTy), TheCall, CmpArgs, false); + TM.CalledFunctions.insert(__cmpdi2Fn); + BuildMI(*MBB, IP, PPC::CMPWI, 2, PPC::CR0).addReg(CondReg).addSImm(0); + BuildMI(*MBB, IP, PPC::BLE, 2).addReg(PPC::CR0).addMBB(SetMBB); + + // ClrMBB + BB = ClrMBB; + unsigned ClrReg = makeAnotherReg(DestTy); + ClrArgs.push_back(ValueRecord(SrcReg, SrcTy)); + TheCall = BuildMI(PPC::CALLpcrel, 1).addGlobalAddress(floatFn, true); + doCall(ValueRecord(ClrReg, DestTy), TheCall, ClrArgs, false); + TM.CalledFunctions.insert(floatFn); + BuildMI(BB, PPC::B, 1).addMBB(PhiMBB); + BB->addSuccessor(PhiMBB); + + // SetMBB + BB = SetMBB; + unsigned SetReg = makeAnotherReg(DestTy); + unsigned CallReg = makeAnotherReg(DestTy); + unsigned ShiftedReg = makeAnotherReg(SrcTy); + ConstantSInt *Const1 = ConstantSInt::get(Type::IntTy, 1); + emitShiftOperation(BB, BB->end(), Src, Const1, false, SrcTy, ShiftedReg); + SetArgs.push_back(ValueRecord(ShiftedReg, SrcTy)); + TheCall = BuildMI(PPC::CALLpcrel, 1).addGlobalAddress(floatFn, true); + doCall(ValueRecord(CallReg, DestTy), TheCall, SetArgs, false); + TM.CalledFunctions.insert(floatFn); + unsigned SetOpcode = (DestClass == cFP32) ? PPC::FADDS : PPC::FADD; + BuildMI(BB, SetOpcode, 2, SetReg).addReg(CallReg).addReg(CallReg); + BB->addSuccessor(PhiMBB); + + // PhiMBB + BB = PhiMBB; + BuildMI(BB, PPC::PHI, 4, DestReg).addReg(ClrReg).addMBB(ClrMBB) + .addReg(SetReg).addMBB(SetMBB); + } return; } @@ -2706,25 +2797,25 @@ if (!SrcTy->isSigned()) { ConstantFP *CFP = ConstantFP::get(Type::DoubleTy, 0x1.000000p52); unsigned ConstF = getReg(CFP, BB, IP); - BuildMI(*BB, IP, PPC::LIS, 1, constantHi).addSImm(0x4330); - addFrameReference(BuildMI(*BB, IP, PPC::STW, 3).addReg(constantHi), + BuildMI(*MBB, IP, PPC::LIS, 1, constantHi).addSImm(0x4330); + addFrameReference(BuildMI(*MBB, IP, PPC::STW, 3).addReg(constantHi), ValueFrameIdx); - addFrameReference(BuildMI(*BB, IP, PPC::STW, 3).addReg(SrcReg), + addFrameReference(BuildMI(*MBB, IP, PPC::STW, 3).addReg(SrcReg), ValueFrameIdx, 4); - addFrameReference(BuildMI(*BB, IP, PPC::LFD, 2, TempF), ValueFrameIdx); - BuildMI(*BB, IP, PPC::FSUB, 2, DestReg).addReg(TempF).addReg(ConstF); + addFrameReference(BuildMI(*MBB, IP, PPC::LFD, 2, TempF), ValueFrameIdx); + BuildMI(*MBB, IP, PPC::FSUB, 2, DestReg).addReg(TempF).addReg(ConstF); } else { ConstantFP *CFP = ConstantFP::get(Type::DoubleTy, 0x1.000008p52); unsigned ConstF = getReg(CFP, BB, IP); unsigned TempLo = makeAnotherReg(Type::IntTy); - BuildMI(*BB, IP, PPC::LIS, 1, constantHi).addSImm(0x4330); - addFrameReference(BuildMI(*BB, IP, PPC::STW, 3).addReg(constantHi), + BuildMI(*MBB, IP, PPC::LIS, 1, constantHi).addSImm(0x4330); + addFrameReference(BuildMI(*MBB, IP, PPC::STW, 3).addReg(constantHi), ValueFrameIdx); - BuildMI(*BB, IP, PPC::XORIS, 2, TempLo).addReg(SrcReg).addImm(0x8000); - addFrameReference(BuildMI(*BB, IP, PPC::STW, 3).addReg(TempLo), + BuildMI(*MBB, IP, PPC::XORIS, 2, TempLo).addReg(SrcReg).addImm(0x8000); + addFrameReference(BuildMI(*MBB, IP, PPC::STW, 3).addReg(TempLo), ValueFrameIdx, 4); - addFrameReference(BuildMI(*BB, IP, PPC::LFD, 2, TempF), ValueFrameIdx); - BuildMI(*BB, IP, PPC::FSUB, 2, DestReg).addReg(TempF).addReg(ConstF); + addFrameReference(BuildMI(*MBB, IP, PPC::LFD, 2, TempF), ValueFrameIdx); + BuildMI(*MBB, IP, PPC::FSUB, 2, DestReg).addReg(TempF).addReg(ConstF); } return; } @@ -2754,8 +2845,8 @@ unsigned TempReg = makeAnotherReg(Type::DoubleTy); // Convert to integer in the FP reg and store it to a stack slot - BuildMI(*BB, IP, PPC::FCTIWZ, 1, TempReg).addReg(SrcReg); - addFrameReference(BuildMI(*BB, IP, PPC::STFD, 3) + BuildMI(*MBB, IP, PPC::FCTIWZ, 1, TempReg).addReg(SrcReg); + addFrameReference(BuildMI(*MBB, IP, PPC::STFD, 3) .addReg(TempReg), ValueFrameIdx); // There is no load signed byte opcode, so we must emit a sign extend for @@ -2763,13 +2854,13 @@ // correct offset. if (DestClass == cByte) { unsigned TempReg2 = makeAnotherReg(DestTy); - addFrameReference(BuildMI(*BB, IP, PPC::LBZ, 2, TempReg2), + addFrameReference(BuildMI(*MBB, IP, PPC::LBZ, 2, TempReg2), ValueFrameIdx, 7); - BuildMI(*BB, IP, PPC::EXTSB, 1, DestReg).addReg(TempReg2); + BuildMI(*MBB, IP, PPC::EXTSB, 1, DestReg).addReg(TempReg2); } else { int offset = (DestClass == cShort) ? 6 : 4; unsigned LoadOp = (DestClass == cShort) ? PPC::LHA : PPC::LWZ; - addFrameReference(BuildMI(*BB, IP, LoadOp, 2, DestReg), + addFrameReference(BuildMI(*MBB, IP, LoadOp, 2, DestReg), ValueFrameIdx, offset); } } else { @@ -2800,34 +2891,34 @@ // Convert from floating point to unsigned 32-bit value // Use 0 if incoming value is < 0.0 - BuildMI(*BB, IP, PPC::FSEL, 3, UseZero).addReg(SrcReg).addReg(SrcReg) + BuildMI(*MBB, IP, PPC::FSEL, 3, UseZero).addReg(SrcReg).addReg(SrcReg) .addReg(Zero); // Use 2**32 - 1 if incoming value is >= 2**32 - BuildMI(*BB, IP, PPC::FSUB, 2, UseMaxInt).addReg(MaxInt).addReg(SrcReg); - BuildMI(*BB, IP, PPC::FSEL, 3, UseChoice).addReg(UseMaxInt) + BuildMI(*MBB, IP, PPC::FSUB, 2, UseMaxInt).addReg(MaxInt).addReg(SrcReg); + BuildMI(*MBB, IP, PPC::FSEL, 3, UseChoice).addReg(UseMaxInt) .addReg(UseZero).addReg(MaxInt); // Subtract 2**31 - BuildMI(*BB, IP, PPC::FSUB, 2, TmpReg).addReg(UseChoice).addReg(Border); + BuildMI(*MBB, IP, PPC::FSUB, 2, TmpReg).addReg(UseChoice).addReg(Border); // Use difference if >= 2**31 - BuildMI(*BB, IP, PPC::FCMPU, 2, PPC::CR0).addReg(UseChoice) + BuildMI(*MBB, IP, PPC::FCMPU, 2, PPC::CR0).addReg(UseChoice) .addReg(Border); - BuildMI(*BB, IP, PPC::FSEL, 3, TmpReg2).addReg(TmpReg).addReg(TmpReg) + BuildMI(*MBB, IP, PPC::FSEL, 3, TmpReg2).addReg(TmpReg).addReg(TmpReg) .addReg(UseChoice); // Convert to integer - BuildMI(*BB, IP, PPC::FCTIWZ, 1, ConvReg).addReg(TmpReg2); - addFrameReference(BuildMI(*BB, IP, PPC::STFD, 3).addReg(ConvReg), + BuildMI(*MBB, IP, PPC::FCTIWZ, 1, ConvReg).addReg(TmpReg2); + addFrameReference(BuildMI(*MBB, IP, PPC::STFD, 3).addReg(ConvReg), FrameIdx); if (DestClass == cByte) { - addFrameReference(BuildMI(*BB, IP, PPC::LBZ, 2, DestReg), + addFrameReference(BuildMI(*MBB, IP, PPC::LBZ, 2, DestReg), FrameIdx, 7); } else if (DestClass == cShort) { - addFrameReference(BuildMI(*BB, IP, PPC::LHZ, 2, DestReg), + addFrameReference(BuildMI(*MBB, IP, PPC::LHZ, 2, DestReg), FrameIdx, 6); } if (DestClass == cInt) { - addFrameReference(BuildMI(*BB, IP, PPC::LWZ, 2, IntTmp), + addFrameReference(BuildMI(*MBB, IP, PPC::LWZ, 2, IntTmp), FrameIdx, 4); - BuildMI(*BB, IP, PPC::BLT, 2).addReg(PPC::CR0).addMBB(PhiMBB); - BuildMI(*BB, IP, PPC::B, 1).addMBB(XorMBB); + BuildMI(*MBB, IP, PPC::BLT, 2).addReg(PPC::CR0).addMBB(PhiMBB); + BuildMI(*MBB, IP, PPC::B, 1).addMBB(XorMBB); // XorMBB: // add 2**31 if input was >= 2**31 Index: llvm/lib/Target/PowerPC/PowerPCInstrInfo.td diff -u llvm/lib/Target/PowerPC/PowerPCInstrInfo.td:1.27 llvm/lib/Target/PowerPC/PowerPCInstrInfo.td:1.28 --- llvm/lib/Target/PowerPC/PowerPCInstrInfo.td:1.27 Sat Aug 21 00:56:39 2004 +++ llvm/lib/Target/PowerPC/PowerPCInstrInfo.td Sun Aug 29 03:19:32 2004 @@ -47,6 +47,7 @@ def LI : DForm_2_r0<"li", 14, 0, 0>; def LIS : DForm_2_r0<"lis", 15, 0, 0>; def ADDIC : DForm_2<"addic", 12, 0, 0>; +def ADDICo : DForm_2<"addic.", 13, 0, 0>; def ADD : XOForm_1<"add", 31, 266, 0, 0, 0, 0>; def ADDC : XOForm_1<"addc", 31, 10, 0, 0, 0, 0>; def ADDE : XOForm_1<"adde", 31, 138, 0, 0, 0, 0>; Index: llvm/lib/Target/PowerPC/README.txt diff -u llvm/lib/Target/PowerPC/README.txt:1.16 llvm/lib/Target/PowerPC/README.txt:1.17 --- llvm/lib/Target/PowerPC/README.txt:1.16 Fri Aug 20 13:46:54 2004 +++ llvm/lib/Target/PowerPC/README.txt Sun Aug 29 03:19:32 2004 @@ -1,28 +1,10 @@ TODO: +* switch to auto-generated asm writer * use stfiwx in float->int -* implement cast fp to bool -* implement algebraic shift right long by reg * implement scheduling info * implement powerpc-64 for darwin * implement powerpc-64 for aix * fix rlwimi generation to be use-and-def -* fix ulong to double: - floatdidf assumes signed longs. so if the high but of a ulong - just happens to be set, you get the wrong sign. The fix for this - is to call cmpdi2 to compare against zero, if so shift right by one, - convert to fp, and multiply by (add to itself). the sequence would - look like: - {r3:r4} holds ulong a; - li r5, 0 - li r6, 0 (set r5:r6 to ulong 0) - call cmpdi2 ==> sets r3 <, =, > 0 - if r3 > 0 - call floatdidf as usual - else - shift right ulong a, 1 (we could use emitShift) - call floatdidf - fadd f1, f1, f1 (fp left shift by 1) -* cast elimination pass (uint -> sbyte -> short, kill the byte -> short) * should hint to the branch select pass that it doesn't need to print the second unconditional branch, so we don't end up with things like: b .LBBl42__2E_expand_function_8_674 ; loopentry.24 @@ -30,9 +12,6 @@ b .LBBl42__2E_expand_function_8_42 ; NewDefault Currently failing tests that should pass: -* SingleSource - `- Regression - | `- casts (ulong to fp failure) * MultiSource |- Applications | `- hbd: miscompilation From reid at x10sys.com Sun Aug 29 14:18:16 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:18:16 -0500 Subject: [llvm-commits] CVS: llvm/autoconf/configure.ac Message-ID: <200408291918.OAA25586@zion.cs.uiuc.edu> Changes in directory llvm/autoconf: configure.ac updated: 1.100 -> 1.101 --- Log message: Create a link from $BUILD_OBJ_ROOT/lib/System/platform to $BUILD_SRC_ROOT/lib/System/$build which gives us the ability to configure the lib/System for the current type of operating system. Also cleaned up some indentation. --- Diffs of the changes: (+31 -15) Index: llvm/autoconf/configure.ac diff -u llvm/autoconf/configure.ac:1.100 llvm/autoconf/configure.ac:1.101 --- llvm/autoconf/configure.ac:1.100 Tue Aug 24 11:31:01 2004 +++ llvm/autoconf/configure.ac Sun Aug 29 14:18:05 2004 @@ -102,31 +102,47 @@ case $build in *-*-linux*) AC_SUBST(OS,[Linux]) - if test -d /home/vadve/lattner/local/x86/llvm-gcc - then - AC_SUBST(LLVMGCCDIR,[/home/vadve/lattner/local/x86/llvm-gcc/]) - fi - ;; + platform_type="Linux" + if test -d /home/vadve/lattner/local/x86/llvm-gcc + then + AC_SUBST(LLVMGCCDIR,[/home/vadve/lattner/local/x86/llvm-gcc/]) + fi + ;; *-*-solaris*) AC_SUBST(OS,[SunOS]) - if test -d /home/vadve/lattner/local/sparc/llvm-gcc - then - AC_SUBST(LLVMGCCDIR,[/home/vadve/lattner/local/sparc/llvm-gcc/]) - fi - ;; + platform_type="SunOS" + if test -d /home/vadve/lattner/local/sparc/llvm-gcc + then + AC_SUBST(LLVMGCCDIR,[/home/vadve/lattner/local/sparc/llvm-gcc/]) + fi + ;; *-*-cygwin*) AC_SUBST(OS,[Cygwin]) - ;; + platform_type="Cygwin" + ;; *-*-darwin*) AC_SUBST(OS,[Darwin]) - ;; + platform_type="Darwin" + ;; *-*-aix*) AC_SUBST(OS,[AIX]) - ;; - *) AC_SUBST(OS,[Unknown]) - ;; + platform_type="AIX" + ;; + *-*-win32*) + AC_SUBST(OS,[Win32]) + platform_type="Win32" + ;; + *) + AC_SUBST(OS,[Unknown]) + platform_type="Unknown" + ;; esac +dnl Make a link from lib/System/platform to lib/System/$platform_type +dnl This helps the #inclusion of the system specific include files +dnl for the operating system abstraction library +AC_CONFIG_LINKS(lib/System/platform:lib/System/$platform_type) + dnl If we are targetting a Sparc machine running Solaris, pretend that it is dnl V9, since that is all that we support at the moment, and autoconf will only dnl tell us we're a sparc. From reid at x10sys.com Sun Aug 29 14:19:18 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:19:18 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/System/Signals.h Message-ID: <200408291919.OAA25634@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/System: Signals.h updated: 1.11 -> 1.12 --- Log message: Put the lib/System interface functions in llvm::sys namespace. --- Diffs of the changes: (+2 -0) Index: llvm/include/llvm/System/Signals.h diff -u llvm/include/llvm/System/Signals.h:1.11 llvm/include/llvm/System/Signals.h:1.12 --- llvm/include/llvm/System/Signals.h:1.11 Sun Aug 29 00:27:15 2004 +++ llvm/include/llvm/System/Signals.h Sun Aug 29 14:19:07 2004 @@ -18,6 +18,7 @@ #include "llvm/System/Path.h" namespace llvm { +namespace sys { /// This function registers signal handlers to ensure that if a signal gets /// delivered that the named file is removed. @@ -35,6 +36,7 @@ /// @brief Print a stack trace if a fatal signal occurs. void PrintStackTraceOnErrorSignal(); +} // End sys namespace } // End llvm namespace #endif From reid at x10sys.com Sun Aug 29 14:20:52 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:20:52 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Win32/Program.cpp Message-ID: <200408291920.OAA25714@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Win32: Program.cpp added (r1.1) --- Log message: Initial commit of an platform-indepdendent implementation for the "Program" operating system concept (find and execute programs). --- Diffs of the changes: (+19 -0) Index: llvm/lib/System/Win32/Program.cpp diff -c /dev/null llvm/lib/System/Win32/Program.cpp:1.1 *** /dev/null Sun Aug 29 14:20:51 2004 --- llvm/lib/System/Win32/Program.cpp Sun Aug 29 14:20:41 2004 *************** *** 0 **** --- 1,19 ---- + //===- Win32/Program.cpp - Win32 Program Implelementation ----- -*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Reid Spencer and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file provides the Win32 specific implementation of the Program class. + // + //===----------------------------------------------------------------------===// + + //===----------------------------------------------------------------------===// + //=== WARNING: Implementation here must contain only generic Win32 code that + //=== is guaranteed to work on *all* Win32 variants. + //===----------------------------------------------------------------------===// + + // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab From reid at x10sys.com Sun Aug 29 14:20:52 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:20:52 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Program.cpp Message-ID: <200408291920.OAA25713@zion.cs.uiuc.edu> Changes in directory llvm/lib/System: Program.cpp added (r1.1) --- Log message: Initial commit of an platform-indepdendent implementation for the "Program" operating system concept (find and execute programs). --- Diffs of the changes: (+29 -0) Index: llvm/lib/System/Program.cpp diff -c /dev/null llvm/lib/System/Program.cpp:1.1 *** /dev/null Sun Aug 29 14:20:51 2004 --- llvm/lib/System/Program.cpp Sun Aug 29 14:20:41 2004 *************** *** 0 **** --- 1,29 ---- + //===-- Program.cpp - Implement OS Program Concept --------------*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Reid Spencer and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This header file implements the operating system Program concept. + // + //===----------------------------------------------------------------------===// + + #include "llvm/System/Program.h" + + namespace llvm { + using namespace sys; + + //===----------------------------------------------------------------------===// + //=== WARNING: Implementation here must contain only TRULY operating system + //=== independent code. + //===----------------------------------------------------------------------===// + + } + + // Include the platform-specific parts of this class. + #include "platform/Program.cpp" + + // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab From reid at x10sys.com Sun Aug 29 14:20:52 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:20:52 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Darwin/Program.cpp Message-ID: <200408291920.OAA25715@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Darwin: Program.cpp added (r1.1) --- Log message: Initial commit of an platform-indepdendent implementation for the "Program" operating system concept (find and execute programs). --- Diffs of the changes: (+22 -0) Index: llvm/lib/System/Darwin/Program.cpp diff -c /dev/null llvm/lib/System/Darwin/Program.cpp:1.1 *** /dev/null Sun Aug 29 14:20:51 2004 --- llvm/lib/System/Darwin/Program.cpp Sun Aug 29 14:20:41 2004 *************** *** 0 **** --- 1,22 ---- + //===- Darwin/Program.cpp - Darwin Program Implementatino. ---- -*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Reid Spencer and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file provides the Darwin specific implementation of the Program class. + // + //===----------------------------------------------------------------------===// + + // Include the generic Unix implementation + #include "../Unix/Program.cpp" + + //===----------------------------------------------------------------------===// + //=== WARNING: Implementation here must contain only Darwin specific code + //=== and must not be generic UNIX code (see ../Unix/Program.cpp) + //===----------------------------------------------------------------------===// + + // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab From reid at x10sys.com Sun Aug 29 14:20:52 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:20:52 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Linux/Program.cpp Message-ID: <200408291920.OAA25723@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Linux: Program.cpp added (r1.1) --- Log message: Initial commit of an platform-indepdendent implementation for the "Program" operating system concept (find and execute programs). --- Diffs of the changes: (+22 -0) Index: llvm/lib/System/Linux/Program.cpp diff -c /dev/null llvm/lib/System/Linux/Program.cpp:1.1 *** /dev/null Sun Aug 29 14:20:51 2004 --- llvm/lib/System/Linux/Program.cpp Sun Aug 29 14:20:41 2004 *************** *** 0 **** --- 1,22 ---- + //===- Linux/Program.cpp - Linux Program Implementation ------- -*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Reid Spencer and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file provides the Linux specific implementation of the Program class. + // + //===----------------------------------------------------------------------===// + + // Include the generic Unix implementation + #include "../Unix/Program.cpp" + + //===----------------------------------------------------------------------===// + //=== WARNING: Implementation here must contain only Linux specific code + //=== and must not be generic UNIX code (see ../Unix/Program.cpp) + //===----------------------------------------------------------------------===// + + // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab From reid at x10sys.com Sun Aug 29 14:20:52 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:20:52 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/SunOS/Program.cpp Message-ID: <200408291920.OAA25728@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/SunOS: Program.cpp added (r1.1) --- Log message: Initial commit of an platform-indepdendent implementation for the "Program" operating system concept (find and execute programs). --- Diffs of the changes: (+22 -0) Index: llvm/lib/System/SunOS/Program.cpp diff -c /dev/null llvm/lib/System/SunOS/Program.cpp:1.1 *** /dev/null Sun Aug 29 14:20:51 2004 --- llvm/lib/System/SunOS/Program.cpp Sun Aug 29 14:20:41 2004 *************** *** 0 **** --- 1,22 ---- + //===- SunOS/Program.cpp - SunOS Program Implementation ------- -*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Reid Spencer and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file provides the SunOS specific implementation of the Program class. + // + //===----------------------------------------------------------------------===// + + // Include the generic Unix implementation + #include "../Unix/Program.cpp" + + //===----------------------------------------------------------------------===// + //=== WARNING: Implementation here must contain only SunOS specific code + //=== and must not be generic UNIX code (see ../Unix/Program.cpp) + //===----------------------------------------------------------------------===// + + // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab From reid at x10sys.com Sun Aug 29 14:20:52 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:20:52 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/AIX/Program.cpp Message-ID: <200408291920.OAA25731@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/AIX: Program.cpp added (r1.1) --- Log message: Initial commit of an platform-indepdendent implementation for the "Program" operating system concept (find and execute programs). --- Diffs of the changes: (+22 -0) Index: llvm/lib/System/AIX/Program.cpp diff -c /dev/null llvm/lib/System/AIX/Program.cpp:1.1 *** /dev/null Sun Aug 29 14:20:51 2004 --- llvm/lib/System/AIX/Program.cpp Sun Aug 29 14:20:41 2004 *************** *** 0 **** --- 1,22 ---- + //===- AIX/Program.cpp - AIX Program Implementation ----------- -*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Reid Spencer and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file provides the AIX specific implementation of the Program class. + // + //===----------------------------------------------------------------------===// + + // Include the generic Unix implementation + #include "../Unix/Program.cpp" + + //===----------------------------------------------------------------------===// + //=== WARNING: Implementation here must contain only AIX specific code + //=== and must not be generic UNIX code (see ../Unix/Program.cpp) + //===----------------------------------------------------------------------===// + + // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab From reid at x10sys.com Sun Aug 29 14:20:52 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:20:52 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Unix/Program.cpp Message-ID: <200408291920.OAA25734@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Unix: Program.cpp added (r1.1) --- Log message: Initial commit of an platform-indepdendent implementation for the "Program" operating system concept (find and execute programs). --- Diffs of the changes: (+133 -0) Index: llvm/lib/System/Unix/Program.cpp diff -c /dev/null llvm/lib/System/Unix/Program.cpp:1.1 *** /dev/null Sun Aug 29 14:20:51 2004 --- llvm/lib/System/Unix/Program.cpp Sun Aug 29 14:20:41 2004 *************** *** 0 **** --- 1,133 ---- + //===- llvm/System/Unix/Program.cpp -----------------------------*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Reid Spencer and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file implements the Unix specific portion of the Program class. + // + //===----------------------------------------------------------------------===// + + //===----------------------------------------------------------------------===// + //=== WARNING: Implementation here must contain only generic UNIX code that + //=== is guaranteed to work on *all* UNIX variants. + //===----------------------------------------------------------------------===// + + #include "Unix.h" + #include + #include + #include + #ifdef HAVE_SYS_WAIT_H + #include + #endif + + namespace llvm { + using namespace sys; + + // This function just uses the PATH environment variable to find the program. + Program + Program::FindProgramByName(const std::string& progName) { + + // Check some degenerate cases + if (progName.length() == 0) // no program + return Program(); + Program temp; + if (!temp.set_file(progName)) // invalid name + return Program(); + if (temp.executable()) // already executable as is + return temp; + + // At this point, the file name is valid and its not executable + + // Get the path. If its empty, we can't do anything to find it. + const char *PathStr = getenv("PATH"); + if (PathStr == 0) + return Program(); + + // Now we have a colon separated list of directories to search; try them. + unsigned PathLen = strlen(PathStr); + while (PathLen) { + // Find the first colon... + const char *Colon = std::find(PathStr, PathStr+PathLen, ':'); + + // Check to see if this first directory contains the executable... + Program FilePath; + if (FilePath.set_directory(std::string(PathStr,Colon))) { + FilePath.append_file(progName); + if (FilePath.executable()) + return FilePath; // Found the executable! + } + + // Nope it wasn't in this directory, check the next path in the list! + PathLen -= Colon-PathStr; + PathStr = Colon; + + // Advance past duplicate colons + while (*PathStr == ':') { + PathStr++; + PathLen--; + } + } + return Program(); + } + + // + int + Program::ExecuteAndWait(const std::vector& args) const { + if (!executable()) + throw get() + " is not executable"; + + #ifdef HAVE_SYS_WAIT_H + // Create local versions of the parameters that can be passed into execve() + // without creating const problems. + const char* argv[ args.size() + 2 ]; + unsigned index = 0; + std::string progname(this->getLast()); + argv[index++] = progname.c_str(); + for (unsigned i = 0; i < args.size(); i++) + argv[index++] = args[i].c_str(); + argv[index] = 0; + + // Create a child process. + switch (fork()) { + // An error occured: Return to the caller. + case -1: + ThrowErrno(std::string("Couldn't execute program '") + get() + "'"); + break; + + // Child process: Execute the program. + case 0: + execve (get().c_str(), (char** const)argv, environ); + // If the execve() failed, we should exit and let the parent pick up + // our non-zero exit status. + exit (errno); + + // Parent process: Break out of the switch to do our processing. + default: + break; + } + + // Parent process: Wait for the child process to terminate. + int status; + if ((::wait (&status)) == -1) + ThrowErrno(std::string("Failed waiting for program '") + get() + "'"); + + // If the program exited normally with a zero exit status, return success! + if (WIFEXITED (status)) + return WEXITSTATUS(status); + else if (WIFSIGNALED(status)) + throw std::string("Program '") + get() + "' received terminating signal."; + else + return 0; + + #else + throw std::string("Program::ExecuteAndWait not implemented on this platform!\n"); + #endif + + } + + } + // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab From reid at x10sys.com Sun Aug 29 14:20:52 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:20:52 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Cygwin/Program.cpp Message-ID: <200408291920.OAA25722@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Cygwin: Program.cpp added (r1.1) --- Log message: Initial commit of an platform-indepdendent implementation for the "Program" operating system concept (find and execute programs). --- Diffs of the changes: (+22 -0) Index: llvm/lib/System/Cygwin/Program.cpp diff -c /dev/null llvm/lib/System/Cygwin/Program.cpp:1.1 *** /dev/null Sun Aug 29 14:20:51 2004 --- llvm/lib/System/Cygwin/Program.cpp Sun Aug 29 14:20:41 2004 *************** *** 0 **** --- 1,22 ---- + //===- Cygwin/Program.cpp - Cygwin Program Implementation ----- -*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Reid Spencer and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file provides the Cygwin specific implementation of the Program class. + // + //===----------------------------------------------------------------------===// + + // Include the generic Unix implementation + #include "../Unix/Program.cpp" + + //===----------------------------------------------------------------------===// + //=== WARNING: Implementation here must contain only Cygwin specific code + //=== and must not be generic UNIX code (see ../Unix/Program.cpp) + //===----------------------------------------------------------------------===// + + // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab From reid at x10sys.com Sun Aug 29 14:22:59 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:22:59 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/SunOS/Signals.cpp Message-ID: <200408291922.OAA25790@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/SunOS: Signals.cpp added (r1.1) --- Log message: Initial platform independent implementation of operating system concept of "Signals" (cleanup after fatal errors). --- Diffs of the changes: (+27 -0) Index: llvm/lib/System/SunOS/Signals.cpp diff -c /dev/null llvm/lib/System/SunOS/Signals.cpp:1.1 *** /dev/null Sun Aug 29 14:22:58 2004 --- llvm/lib/System/SunOS/Signals.cpp Sun Aug 29 14:22:48 2004 *************** *** 0 **** --- 1,27 ---- + //===- SunOS/Signals.cpp - SunOS Signals Implementation ---------*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Reid Spencer and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file provides the SunOS specific implementation of the Signals class. + // + //===----------------------------------------------------------------------===// + + // Include the generic unix implementation + #include "../Unix/Signals.cpp" + + namespace llvm { + using namespace sys; + + //===----------------------------------------------------------------------===// + //=== WARNING: Implementation here must contain only SunOS specific code + //=== and must not be generic UNIX code (see ../Unix/Signals.cpp) + //===----------------------------------------------------------------------===// + + } + + // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab From reid at x10sys.com Sun Aug 29 14:22:59 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:22:59 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Win32/Signals.cpp Message-ID: <200408291922.OAA25791@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Win32: Signals.cpp added (r1.1) --- Log message: Initial platform independent implementation of operating system concept of "Signals" (cleanup after fatal errors). --- Diffs of the changes: (+37 -0) Index: llvm/lib/System/Win32/Signals.cpp diff -c /dev/null llvm/lib/System/Win32/Signals.cpp:1.1 *** /dev/null Sun Aug 29 14:22:58 2004 --- llvm/lib/System/Win32/Signals.cpp Sun Aug 29 14:22:48 2004 *************** *** 0 **** --- 1,37 ---- + //===- Win32/Signals.cpp - Win32 Signals Implementation ---------*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Reid Spencer and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file provides the Win32 specific implementation of the Signals class. + // + //===----------------------------------------------------------------------===// + + namespace llvm { + using namespace sys; + + //===----------------------------------------------------------------------===// + //=== WARNING: Implementation here must contain only Win32 specific code + //=== and must not be generic UNIX code (see ../Unix/Signals.cpp) + //===----------------------------------------------------------------------===// + + // RemoveFileOnSignal - The public API + void llvm::RemoveFileOnSignal(const std::string &Filename) { + } + + // RemoveDirectoryOnSignal - The public API + void llvm::RemoveDirectoryOnSignal(const llvm::sys::Path& path) { + } + + /// PrintStackTraceOnErrorSignal - When an error signal (such as SIBABRT or + /// SIGSEGV) is delivered to the process, print a stack trace and then exit. + void llvm::PrintStackTraceOnErrorSignal() { + } + + } + + // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab From reid at x10sys.com Sun Aug 29 14:22:59 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:22:59 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Cygwin/Signals.cpp Message-ID: <200408291922.OAA25792@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Cygwin: Signals.cpp added (r1.1) --- Log message: Initial platform independent implementation of operating system concept of "Signals" (cleanup after fatal errors). --- Diffs of the changes: (+27 -0) Index: llvm/lib/System/Cygwin/Signals.cpp diff -c /dev/null llvm/lib/System/Cygwin/Signals.cpp:1.1 *** /dev/null Sun Aug 29 14:22:58 2004 --- llvm/lib/System/Cygwin/Signals.cpp Sun Aug 29 14:22:48 2004 *************** *** 0 **** --- 1,27 ---- + //===- Cygwin/Signals.cpp - Cygwin Signals Implementation -------*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Reid Spencer and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file provides the Cygwin specific implementation of the Signals class. + // + //===----------------------------------------------------------------------===// + + // Include the generic unix implementation + #include "../Unix/Signals.cpp" + + namespace llvm { + using namespace sys; + + //===----------------------------------------------------------------------===// + //=== WARNING: Implementation here must contain only Cygwin specific code + //=== and must not be generic UNIX code (see ../Unix/Signals.cpp) + //===----------------------------------------------------------------------===// + + } + + // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab From reid at x10sys.com Sun Aug 29 14:22:59 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:22:59 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Signals.cpp Message-ID: <200408291922.OAA25789@zion.cs.uiuc.edu> Changes in directory llvm/lib/System: Signals.cpp added (r1.1) --- Log message: Initial platform independent implementation of operating system concept of "Signals" (cleanup after fatal errors). --- Diffs of the changes: (+30 -0) Index: llvm/lib/System/Signals.cpp diff -c /dev/null llvm/lib/System/Signals.cpp:1.1 *** /dev/null Sun Aug 29 14:22:58 2004 --- llvm/lib/System/Signals.cpp Sun Aug 29 14:22:48 2004 *************** *** 0 **** --- 1,30 ---- + //===- Signals.cpp - Signal Handling support --------------------*- 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 defines some helpful functions for dealing with the possibility of + // Unix signals occuring while your program is running. + // + //===----------------------------------------------------------------------===// + + #include "llvm/System/Signals.h" + + namespace llvm { + using namespace sys; + + //===----------------------------------------------------------------------===// + //=== WARNING: Implementation here must contain only TRULY operating system + //=== independent code. + //===----------------------------------------------------------------------===// + + } + + // Include the platform-specific parts of this class. + #include "platform/Signals.cpp" + + // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab From reid at x10sys.com Sun Aug 29 14:22:59 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:22:59 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Unix/Signals.cpp Message-ID: <200408291922.OAA25793@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Unix: Signals.cpp added (r1.1) --- Log message: Initial platform independent implementation of operating system concept of "Signals" (cleanup after fatal errors). --- Diffs of the changes: (+169 -0) Index: llvm/lib/System/Unix/Signals.cpp diff -c /dev/null llvm/lib/System/Unix/Signals.cpp:1.1 *** /dev/null Sun Aug 29 14:22:58 2004 --- llvm/lib/System/Unix/Signals.cpp Sun Aug 29 14:22:48 2004 *************** *** 0 **** --- 1,169 ---- + //===- Signals.cpp - Generic Unix Signals Implementation -----*- 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 defines some helpful functions for dealing with the possibility of + // Unix signals occuring while your program is running. + // + //===----------------------------------------------------------------------===// + + #include "Unix.h" + #include + #include + #ifdef HAVE_EXECINFO_H + # include // For backtrace(). + #endif + #include + #include + + namespace { + + std::vector *FilesToRemove = 0 ; + std::vector *DirectoriesToRemove = 0; + + // IntSigs - Signals that may interrupt the program at any time. + const int IntSigs[] = { + SIGHUP, SIGINT, SIGQUIT, SIGPIPE, SIGTERM, SIGUSR1, SIGUSR2 + }; + const int *IntSigsEnd = IntSigs + sizeof(IntSigs)/sizeof(IntSigs[0]); + + // KillSigs - Signals that are synchronous with the program that will cause it + // to die. + const int KillSigs[] = { + SIGILL, SIGTRAP, SIGABRT, SIGFPE, SIGBUS, SIGSEGV, SIGSYS, SIGXCPU, SIGXFSZ + #ifdef SIGEMT + , SIGEMT + #endif + }; + const int *KillSigsEnd = KillSigs + sizeof(KillSigs)/sizeof(KillSigs[0]); + + #ifdef HAVE_BACKTRACE + void* StackTrace[256]; + #endif + + // PrintStackTrace - In the case of a program crash or fault, print out a stack + // trace so that the user has an indication of why and where we died. + // + // On glibc systems we have the 'backtrace' function, which works nicely, but + // doesn't demangle symbols. In order to backtrace symbols, we fork and exec a + // 'c++filt' process to do the demangling. This seems like the simplest and + // most robust solution when we can't allocate memory (such as in a signal + // handler). If we can't find 'c++filt', we fallback to printing mangled names. + // + void PrintStackTrace() { + #ifdef HAVE_BACKTRACE + // Use backtrace() to output a backtrace on Linux systems with glibc. + int depth = backtrace(StackTrace, sizeof(StackTrace)/sizeof(StackTrace[0])); + + // Create a one-way unix pipe. The backtracing process writes to PipeFDs[1], + // the c++filt process reads from PipeFDs[0]. + int PipeFDs[2]; + if (pipe(PipeFDs)) { + backtrace_symbols_fd(StackTrace, depth, STDERR_FILENO); + return; + } + + switch (pid_t ChildPID = fork()) { + case -1: // Error forking, print mangled stack trace + close(PipeFDs[0]); + close(PipeFDs[1]); + backtrace_symbols_fd(StackTrace, depth, STDERR_FILENO); + return; + default: // backtracing process + close(PipeFDs[0]); // Close the reader side. + + // Print the mangled backtrace into the pipe. + backtrace_symbols_fd(StackTrace, depth, PipeFDs[1]); + close(PipeFDs[1]); // We are done writing. + while (waitpid(ChildPID, 0, 0) == -1) + if (errno != EINTR) break; + return; + + case 0: // c++filt process + close(PipeFDs[1]); // Close the writer side. + dup2(PipeFDs[0], 0); // Read from standard input + close(PipeFDs[0]); // Close the old descriptor + dup2(2, 1); // Revector stdout -> stderr + + // Try to run c++filt or gc++filt. If neither is found, call back on 'cat' + // to print the mangled stack trace. If we can't find cat, just exit. + execlp("c++filt", "c++filt", 0); + execlp("gc++filt", "gc++filt", 0); + execlp("cat", "cat", 0); + execlp("/bin/cat", "cat", 0); + exit(0); + } + #endif + } + + // SignalHandler - The signal handler that runs... + RETSIGTYPE SignalHandler(int Sig) { + if (FilesToRemove != 0) + while (!FilesToRemove->empty()) { + std::remove(FilesToRemove->back().c_str()); + FilesToRemove->pop_back(); + } + + if (DirectoriesToRemove != 0) + while (!DirectoriesToRemove->empty()) { + DirectoriesToRemove->back().destroy_directory(true); + DirectoriesToRemove->pop_back(); + } + + if (std::find(IntSigs, IntSigsEnd, Sig) != IntSigsEnd) + exit(1); // If this is an interrupt signal, exit the program + + // Otherwise if it is a fault (like SEGV) output the stacktrace to + // STDERR (if we can) and reissue the signal to die... + PrintStackTrace(); + signal(Sig, SIG_DFL); + } + + // Just call signal + void RegisterHandler(int Signal) { + signal(Signal, SignalHandler); + } + + } + + namespace llvm { + + // RemoveFileOnSignal - The public API + void sys::RemoveFileOnSignal(const std::string &Filename) { + if (FilesToRemove == 0) + FilesToRemove = new std::vector; + + FilesToRemove->push_back(Filename); + + std::for_each(IntSigs, IntSigsEnd, RegisterHandler); + std::for_each(KillSigs, KillSigsEnd, RegisterHandler); + } + + // RemoveDirectoryOnSignal - The public API + void sys::RemoveDirectoryOnSignal(const llvm::sys::Path& path) { + if (!path.is_directory()) + return; + + if (DirectoriesToRemove == 0) + DirectoriesToRemove = new std::vector; + + DirectoriesToRemove->push_back(path); + + std::for_each(IntSigs, IntSigsEnd, RegisterHandler); + std::for_each(KillSigs, KillSigsEnd, RegisterHandler); + } + + /// PrintStackTraceOnErrorSignal - When an error signal (such as SIBABRT or + /// SIGSEGV) is delivered to the process, print a stack trace and then exit. + void sys::PrintStackTraceOnErrorSignal() { + std::for_each(KillSigs, KillSigsEnd, RegisterHandler); + } + + } + + // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab From reid at x10sys.com Sun Aug 29 14:22:59 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:22:59 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Linux/Signals.cpp Message-ID: <200408291922.OAA25802@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Linux: Signals.cpp added (r1.1) --- Log message: Initial platform independent implementation of operating system concept of "Signals" (cleanup after fatal errors). --- Diffs of the changes: (+27 -0) Index: llvm/lib/System/Linux/Signals.cpp diff -c /dev/null llvm/lib/System/Linux/Signals.cpp:1.1 *** /dev/null Sun Aug 29 14:22:58 2004 --- llvm/lib/System/Linux/Signals.cpp Sun Aug 29 14:22:48 2004 *************** *** 0 **** --- 1,27 ---- + //===- Linux/Signals.cpp - Linux Signals Implementation ---------*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Reid Spencer and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file provides the Linux specific implementation of the Signals class. + // + //===----------------------------------------------------------------------===// + + // Include the generic unix implementation + #include "../Unix/Signals.cpp" + + namespace llvm { + using namespace sys; + + //===----------------------------------------------------------------------===// + //=== WARNING: Implementation here must contain only Linux specific code + //=== and must not be generic UNIX code (see ../Unix/Signals.cpp) + //===----------------------------------------------------------------------===// + + } + + // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab From reid at x10sys.com Sun Aug 29 14:22:59 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:22:59 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Darwin/Signals.cpp Message-ID: <200408291922.OAA25805@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Darwin: Signals.cpp added (r1.1) --- Log message: Initial platform independent implementation of operating system concept of "Signals" (cleanup after fatal errors). --- Diffs of the changes: (+27 -0) Index: llvm/lib/System/Darwin/Signals.cpp diff -c /dev/null llvm/lib/System/Darwin/Signals.cpp:1.1 *** /dev/null Sun Aug 29 14:22:58 2004 --- llvm/lib/System/Darwin/Signals.cpp Sun Aug 29 14:22:48 2004 *************** *** 0 **** --- 1,27 ---- + //===- Darwin/Signals.cpp - Darwin Signals Implementation -------*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Reid Spencer and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file provides the Darwin specific implementation of the Signals class. + // + //===----------------------------------------------------------------------===// + + // Include the generic unix implementation + #include "../Unix/Signals.cpp" + + namespace llvm { + using namespace sys; + + //===----------------------------------------------------------------------===// + //=== WARNING: Implementation here must contain only Darwin specific code + //=== and must not be generic UNIX code (see ../Unix/Signals.cpp) + //===----------------------------------------------------------------------===// + + } + + // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab From reid at x10sys.com Sun Aug 29 14:22:59 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:22:59 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/AIX/Signals.cpp Message-ID: <200408291922.OAA25806@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/AIX: Signals.cpp added (r1.1) --- Log message: Initial platform independent implementation of operating system concept of "Signals" (cleanup after fatal errors). --- Diffs of the changes: (+27 -0) Index: llvm/lib/System/AIX/Signals.cpp diff -c /dev/null llvm/lib/System/AIX/Signals.cpp:1.1 *** /dev/null Sun Aug 29 14:22:58 2004 --- llvm/lib/System/AIX/Signals.cpp Sun Aug 29 14:22:48 2004 *************** *** 0 **** --- 1,27 ---- + //===- AIX/Signals.cpp - AIX Signals Implementation -------------*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Reid Spencer and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file provides the AIX specific implementation of the Signals class. + // + //===----------------------------------------------------------------------===// + + // Include the generic unix implementation + #include "../Unix/Signals.cpp" + + namespace llvm { + using namespace sys; + + //===----------------------------------------------------------------------===// + //=== WARNING: Implementation here must contain only AIX specific code + //=== and must not be generic UNIX code (see ../Unix/Signals.cpp) + //===----------------------------------------------------------------------===// + + } + + // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab From reid at x10sys.com Sun Aug 29 14:24:30 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:24:30 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Unix/Unix.h Message-ID: <200408291924.OAA25840@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Unix: Unix.h updated: 1.1 -> 1.2 --- Log message: Include some additional header files. Fix the banner length. --- Diffs of the changes: (+6 -4) Index: llvm/lib/System/Unix/Unix.h diff -u llvm/lib/System/Unix/Unix.h:1.1 llvm/lib/System/Unix/Unix.h:1.2 --- llvm/lib/System/Unix/Unix.h:1.1 Wed Aug 25 01:19:01 2004 +++ llvm/lib/System/Unix/Unix.h Sun Aug 29 14:24:20 2004 @@ -1,4 +1,4 @@ -//===- llvm/System/Unix/Unix.h - Common Unix Include File -----*- C++ -*-===// +//===- llvm/System/Unix/Unix.h - Common Unix Include File -------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -16,10 +16,12 @@ //=== is guaranteed to work on all UNIX variants. //===----------------------------------------------------------------------===// +#include "Config/config.h" // Get autoconf configuration settings #include -#include -#include -#include +#include +#include +#include +#include #include #include From reid at x10sys.com Sun Aug 29 14:25:03 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:25:03 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Path.cpp Message-ID: <200408291925.OAA25857@zion.cs.uiuc.edu> Changes in directory llvm/lib/System: Path.cpp updated: 1.4 -> 1.5 --- Log message: Correct the vim: specification --- Diffs of the changes: (+1 -1) Index: llvm/lib/System/Path.cpp diff -u llvm/lib/System/Path.cpp:1.4 llvm/lib/System/Path.cpp:1.5 --- llvm/lib/System/Path.cpp:1.4 Sun Aug 29 00:24:00 2004 +++ llvm/lib/System/Path.cpp Sun Aug 29 14:24:53 2004 @@ -36,4 +36,4 @@ // Include the truly platform-specific parts of this class. #include "platform/Path.cpp" -// vim: sw=2 +// vim: sw=2 smartindent smarttab tw=80 autoindent expandtab From reid at x10sys.com Sun Aug 29 14:26:04 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:26:04 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/AIX/Path.cpp Message-ID: <200408291926.OAA25876@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/AIX: Path.cpp updated: 1.1 -> 1.2 --- Log message: Move a warning comment to where it should have been in the first place. --- Diffs of the changes: (+5 -5) Index: llvm/lib/System/AIX/Path.cpp diff -u llvm/lib/System/AIX/Path.cpp:1.1 llvm/lib/System/AIX/Path.cpp:1.2 --- llvm/lib/System/AIX/Path.cpp:1.1 Sun Aug 29 00:24:00 2004 +++ llvm/lib/System/AIX/Path.cpp Sun Aug 29 14:25:54 2004 @@ -11,17 +11,17 @@ // //===----------------------------------------------------------------------===// -//===----------------------------------------------------------------------===// -//=== WARNING: Implementation here must contain only AIX specific code -//=== and must not be generic UNIX code (see ../Unix/Path.cpp) -//===----------------------------------------------------------------------===// - // Include the generic unix implementation #include "../Unix/Path.cpp" namespace llvm { using namespace sys; +//===----------------------------------------------------------------------===// +//=== WARNING: Implementation here must contain only AIX specific code +//=== and must not be generic UNIX code (see ../Unix/Path.cpp) +//===----------------------------------------------------------------------===// + bool Path::is_valid() const { if (path.empty()) From reid at x10sys.com Sun Aug 29 14:27:07 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:27:07 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvmc/CompilerDriver.cpp CompilerDriver.h ConfigLexer.h ConfigLexer.l Configuration.cpp Configuration.h Makefile llvmc.cpp st Message-ID: <200408291927.OAA25908@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvmc: CompilerDriver.cpp updated: 1.10 -> 1.11 CompilerDriver.h updated: 1.9 -> 1.10 ConfigLexer.h updated: 1.5 -> 1.6 ConfigLexer.l updated: 1.6 -> 1.7 Configuration.cpp updated: 1.10 -> 1.11 Configuration.h updated: 1.3 -> 1.4 Makefile updated: 1.5 -> 1.6 llvmc.cpp updated: 1.10 -> 1.11 st updated: 1.5 -> 1.6 --- Log message: Convert llvmc to use the lib/System interface instead of directly using Unix operating system calls. --- Diffs of the changes: (+683 -684) Index: llvm/tools/llvmc/CompilerDriver.cpp diff -u llvm/tools/llvmc/CompilerDriver.cpp:1.10 llvm/tools/llvmc/CompilerDriver.cpp:1.11 --- llvm/tools/llvmc/CompilerDriver.cpp:1.10 Tue Aug 24 17:54:32 2004 +++ llvm/tools/llvmc/CompilerDriver.cpp Sun Aug 29 14:26:56 2004 @@ -14,26 +14,19 @@ #include "CompilerDriver.h" #include "ConfigLexer.h" -#include "llvm/Bytecode/Reader.h" #include "llvm/Module.h" +#include "llvm/Bytecode/Reader.h" #include "Support/FileUtilities.h" -#include "Support/SystemUtils.h" +#include "Support/SetVector.h" #include "Support/StringExtras.h" #include using namespace llvm; namespace { - inline std::string RemoveSuffix(const std::string& fullName) { - size_t dotpos = fullName.rfind('.',fullName.size()); - if ( dotpos == std::string::npos ) return fullName; - return fullName.substr(0, dotpos); - } - - const char OutputSuffix[] = ".o"; void WriteAction(CompilerDriver::Action* action ) { - std::cerr << action->program; + std::cerr << action->program.c_str(); std::vector::iterator I = action->args.begin(); while (I != action->args.end()) { std::cerr << " " + *I; @@ -43,7 +36,7 @@ } void DumpAction(CompilerDriver::Action* action) { - std::cerr << "command = " << action->program; + std::cerr << "command = " << action->program.c_str(); std::vector::iterator I = action->args.begin(); while (I != action->args.end()) { std::cerr << " " + *I; @@ -74,558 +67,610 @@ static const char* DefaultFastCompileOptimizations[] = { "-simplifycfg", "-mem2reg", "-instcombine" }; -} - -// Stuff in this namespace properly belongs in lib/System and needs -// to be portable but we're avoiding that for now. -namespace sys { - - bool FileIsReadable(const std::string& fname) { - return 0 == access(fname.c_str(), F_OK | R_OK); - } - void CleanupTempFile(const std::string& fname) { - if (FileIsReadable(fname)) - unlink(fname.c_str()); - } - - std::string MakeTemporaryDirectory() { - char temp_name[64]; - strcpy(temp_name,"/tmp/llvm_XXXXXX"); - if (0 == mkdtemp(temp_name)) - throw std::string("Can't create temporary directory"); - return temp_name; - } - - std::string FindExecutableInPath(const std::string& program) { - // First, just see if the program is already executable - if (isExecutableFile(program)) return program; - - // Get the path. If its empty, we can't do anything - const char *PathStr = getenv("PATH"); - if (PathStr == 0) return ""; - - // Now we have a colon separated list of directories to search; try them. - unsigned PathLen = strlen(PathStr); - while (PathLen) { - // Find the first colon... - const char *Colon = std::find(PathStr, PathStr+PathLen, ':'); - - // Check to see if this first directory contains the executable... - std::string FilePath = std::string(PathStr, Colon) + '/' + program; - if (isExecutableFile(FilePath)) - return FilePath; // Found the executable! - - // Nope it wasn't in this directory, check the next range! - PathLen -= Colon-PathStr; - PathStr = Colon; - - // Advance past duplicate coons - while (*PathStr == ':') { - PathStr++; - PathLen--; + class CompilerDriverImpl : public CompilerDriver { + /// @name Constructors + /// @{ + public: + CompilerDriverImpl(ConfigDataProvider& confDatProv ) + : cdp(&confDatProv) + , finalPhase(LINKING) + , optLevel(OPT_FAST_COMPILE) + , Flags(0) + , machine() + , LibraryPaths() + , TempDir() + , AdditionalArgs() + { + TempDir = sys::Path::GetTemporaryDirectory(); + sys::RemoveDirectoryOnSignal(TempDir); + AdditionalArgs.reserve(NUM_PHASES); + StringVector emptyVec; + for (unsigned i = 0; i < NUM_PHASES; ++i) + AdditionalArgs.push_back(emptyVec); } - } - // If we fell out, we ran out of directories in PATH to search, return failure - return ""; - } -} - -CompilerDriver::CompilerDriver(ConfigDataProvider& confDatProv ) - : cdp(&confDatProv) - , finalPhase(LINKING) - , optLevel(OPT_FAST_COMPILE) - , isDryRun(false) - , isVerbose(false) - , isDebug(false) - , timeActions(false) - , emitRawCode(false) - , emitNativeCode(false) - , keepTemps(false) - , machine() - , LibraryPaths() - , AdditionalArgs() - , TempDir() -{ - // FIXME: These libraries are platform specific - LibraryPaths.push_back("/lib"); - LibraryPaths.push_back("/usr/lib"); - AdditionalArgs.reserve(NUM_PHASES); - StringVector emptyVec; - for (unsigned i = 0; i < NUM_PHASES; ++i) - AdditionalArgs.push_back(emptyVec); -} + virtual ~CompilerDriverImpl() { + cleanup(); + cdp = 0; + LibraryPaths.clear(); + AdditionalArgs.clear(); + } -CompilerDriver::~CompilerDriver() { - cdp = 0; - LibraryPaths.clear(); - AdditionalArgs.clear(); -} + /// @} + /// @name Methods + /// @{ + public: + virtual void setFinalPhase( Phases phase ) { + finalPhase = phase; + } -CompilerDriver::ConfigData::ConfigData() - : langName() - , PreProcessor() - , Translator() - , Optimizer() - , Assembler() - , Linker() -{ - StringVector emptyVec; - for (unsigned i = 0; i < NUM_PHASES; ++i) - opts.push_back(emptyVec); -} + virtual void setOptimization( OptimizationLevels level ) { + optLevel = level; + } -void CompilerDriver::error( const std::string& errmsg ) { - std::cerr << "llvmc: Error: " << errmsg << ".\n"; - exit(1); -} + virtual void setDriverFlags( unsigned flags ) { + Flags = flags & DRIVER_FLAGS_MASK; + } -CompilerDriver::Action* CompilerDriver::GetAction(ConfigData* cd, - const std::string& input, - const std::string& output, - Phases phase) -{ - Action* pat = 0; ///< The pattern/template for the action - Action* action = new Action; ///< The actual action to execute + virtual void setOutputMachine( const std::string& machineName ) { + machine = machineName; + } - // Get the action pattern - switch (phase) { - case PREPROCESSING: pat = &cd->PreProcessor; break; - case TRANSLATION: pat = &cd->Translator; break; - case OPTIMIZATION: pat = &cd->Optimizer; break; - case ASSEMBLY: pat = &cd->Assembler; break; - case LINKING: pat = &cd->Linker; break; - default: - assert(!"Invalid driver phase!"); - break; - } - assert(pat != 0 && "Invalid command pattern"); + virtual void setPhaseArgs(Phases phase, const StringVector& opts) { + assert(phase <= LINKING && phase >= PREPROCESSING); + AdditionalArgs[phase] = opts; + } - // Copy over some pattern things that don't need to change - action->program = pat->program; - action->flags = pat->flags; - - // Do the substitutions from the pattern to the actual - StringVector::iterator PI = pat->args.begin(); - StringVector::iterator PE = pat->args.end(); - while (PI != PE) { - if ((*PI)[0] == '%') { - if (*PI == "%in%") { - action->args.push_back(input); - } else if (*PI == "%out%") { - action->args.push_back(output); - } else if (*PI == "%time%") { - if (timePasses) - action->args.push_back("-time-passes"); - } else if (*PI == "%stats%") { - if (showStats) - action->args.push_back("-stats"); - } else if (*PI == "%target%") { - // FIXME: Ignore for now - } else if (*PI == "%opt%") { - if (!emitRawCode) { - if (cd->opts.size() > static_cast(optLevel) && - !cd->opts[optLevel].empty()) - action->args.insert(action->args.end(), cd->opts[optLevel].begin(), - cd->opts[optLevel].end()); - else - error("Optimization options for level " + utostr(unsigned(optLevel)) + - " were not specified"); + virtual void setLibraryPaths(const StringVector& paths) { + StringVector::const_iterator I = paths.begin(); + StringVector::const_iterator E = paths.end(); + while (I != E) { + sys::Path tmp; + tmp.set_directory(*I); + LibraryPaths.push_back(tmp); + ++I; } - } else if (*PI == "%args%") { - if (AdditionalArgs.size() > unsigned(phase)) - if (!AdditionalArgs[phase].empty()) { - // Get specific options for each kind of action type - StringVector& addargs = AdditionalArgs[phase]; - // Add specific options for each kind of action type - action->args.insert(action->args.end(), addargs.begin(), addargs.end()); - } - } else { - error("Invalid substitution name" + *PI); } - } else { - // Its not a substitution, just put it in the action - action->args.push_back(*PI); - } - PI++; - } - - - // Finally, we're done - return action; -} - -bool CompilerDriver::DoAction(Action*action) { - assert(action != 0 && "Invalid Action!"); - if (isVerbose) - WriteAction(action); - if (!isDryRun) { - std::string prog(sys::FindExecutableInPath(action->program)); - if (prog.empty()) - error("Can't find program '" + action->program + "'"); - - // Get the program's arguments - const char* argv[action->args.size() + 1]; - argv[0] = prog.c_str(); - unsigned i = 1; - for (; i <= action->args.size(); ++i) - argv[i] = action->args[i-1].c_str(); - argv[i] = 0; - // Invoke the program - return !ExecWait(argv, environ); - } - return true; -} + virtual void addLibraryPath( const sys::Path& libPath ) { + LibraryPaths.push_back(libPath); + } -/// This method tries various variants of a linkage item's file -/// name to see if it can find an appropriate file to link with -/// in the directory specified. -std::string CompilerDriver::GetPathForLinkageItem(const std::string& link_item, - const std::string& dir) { - std::string fullpath(dir + "/" + link_item + ".o"); - if (::sys::FileIsReadable(fullpath)) - return fullpath; - fullpath = dir + "/" + link_item + ".bc"; - if (::sys::FileIsReadable(fullpath)) - return fullpath; - fullpath = dir + "/lib" + link_item + ".a"; - if (::sys::FileIsReadable(fullpath)) - return fullpath; - fullpath = dir + "/lib" + link_item + ".so"; - if (::sys::FileIsReadable(fullpath)) - return fullpath; - return ""; -} + /// @} + /// @name Functions + /// @{ + private: + bool isSet(DriverFlags flag) { + return 0 != ((flag & DRIVER_FLAGS_MASK) & Flags); + } -/// This method processes a linkage item. The item could be a -/// Bytecode file needing translation to native code and that is -/// dependent on other bytecode libraries, or a native code -/// library that should just be linked into the program. -bool CompilerDriver::ProcessLinkageItem(const std::string& link_item, - SetVector& set, - std::string& err) { - // First, see if the unadorned file name is not readable. If so, - // we must track down the file in the lib search path. - std::string fullpath; - if (!sys::FileIsReadable(link_item)) { - // First, look for the library using the -L arguments specified - // on the command line. - StringVector::iterator PI = LibraryPaths.begin(); - StringVector::iterator PE = LibraryPaths.end(); - while (PI != PE && fullpath.empty()) { - fullpath = GetPathForLinkageItem(link_item,*PI); - ++PI; - } + void cleanup() { + if (!isSet(KEEP_TEMPS_FLAG)) { + if (TempDir.is_directory() && TempDir.writable()) + TempDir.destroy_directory(/*remove_contents=*/true); + } else { + std::cout << "Temporary files are in " << TempDir.get() << "\n"; + } + } - // If we didn't find the file in any of the library search paths - // so we have to bail. No where else to look. - if (fullpath.empty()) { - err = std::string("Can't find linkage item '") + link_item + "'"; - return false; - } - } else { - fullpath = link_item; - } + sys::Path MakeTempFile(const std::string& basename, const std::string& suffix ) { + sys::Path result(TempDir); + if (!result.append_file(basename)) + throw basename + ": can't use this file name"; + if (!result.append_suffix(suffix)) + throw suffix + ": can't use this file suffix"; + return result; + } - // If we got here fullpath is the path to the file, and its readable. - set.insert(fullpath); + Action* GetAction(ConfigData* cd, + const sys::Path& input, + const sys::Path& output, + Phases phase) + { + Action* pat = 0; ///< The pattern/template for the action + Action* action = new Action; ///< The actual action to execute + + // Get the action pattern + switch (phase) { + case PREPROCESSING: pat = &cd->PreProcessor; break; + case TRANSLATION: pat = &cd->Translator; break; + case OPTIMIZATION: pat = &cd->Optimizer; break; + case ASSEMBLY: pat = &cd->Assembler; break; + case LINKING: pat = &cd->Linker; break; + default: + assert(!"Invalid driver phase!"); + break; + } + assert(pat != 0 && "Invalid command pattern"); - // If its an LLVM bytecode file ... - if (CheckMagic(fullpath, "llvm")) { - // Process the dependent libraries recursively - Module::LibraryListType modlibs; - if (GetBytecodeDependentLibraries(fullpath,modlibs)) { - // Traverse the dependent libraries list - Module::lib_iterator LI = modlibs.begin(); - Module::lib_iterator LE = modlibs.end(); - while ( LI != LE ) { - if (!ProcessLinkageItem(*LI,set,err)) { - if (err.empty()) { - err = std::string("Library '") + *LI + - "' is not valid for linking but is required by file '" + - fullpath + "'"; + // Copy over some pattern things that don't need to change + action->program = pat->program; + action->flags = pat->flags; + + // Do the substitutions from the pattern to the actual + StringVector::iterator PI = pat->args.begin(); + StringVector::iterator PE = pat->args.end(); + while (PI != PE) { + if ((*PI)[0] == '%') { + if (*PI == "%in%") { + action->args.push_back(input.get()); + } else if (*PI == "%out%") { + action->args.push_back(output.get()); + } else if (*PI == "%time%") { + if (isSet(TIME_PASSES_FLAG)) + action->args.push_back("-time-passes"); + } else if (*PI == "%stats%") { + if (isSet(SHOW_STATS_FLAG)) + action->args.push_back("-stats"); + } else if (*PI == "%force%") { + if (isSet(FORCE_FLAG)) + action->args.push_back("-f"); + } else if (*PI == "%verbose%") { + if (isSet(VERBOSE_FLAG)) + action->args.push_back("-v"); + } else if (*PI == "%target%") { + // FIXME: Ignore for now + } else if (*PI == "%opt%") { + if (!isSet(EMIT_RAW_FLAG)) { + if (cd->opts.size() > static_cast(optLevel) && + !cd->opts[optLevel].empty()) + action->args.insert(action->args.end(), cd->opts[optLevel].begin(), + cd->opts[optLevel].end()); + else + throw std::string("Optimization options for level ") + + utostr(unsigned(optLevel)) + " were not specified"; + } + } else if (*PI == "%args%") { + if (AdditionalArgs.size() > unsigned(phase)) + if (!AdditionalArgs[phase].empty()) { + // Get specific options for each kind of action type + StringVector& addargs = AdditionalArgs[phase]; + // Add specific options for each kind of action type + action->args.insert(action->args.end(), addargs.begin(), addargs.end()); + } + } else { + throw "Invalid substitution name" + *PI; + } } else { - err += " which is required by file '" + fullpath + "'"; + // Its not a substitution, just put it in the action + action->args.push_back(*PI); } - return false; + PI++; } - ++LI; - } - } else if (err.empty()) { - err = std::string("The dependent libraries could not be extracted from '") - + fullpath; - return false; - } - } - return true; -} - -int CompilerDriver::execute(const InputList& InpList, - const std::string& Output ) { - // Echo the configuration of options if we're running verbose - if (isDebug) - { - std::cerr << "Compiler Driver Options:\n"; - std::cerr << "DryRun = " << isDryRun << "\n"; - std::cerr << "Verbose = " << isVerbose << " \n"; - std::cerr << "TimeActions = " << timeActions << "\n"; - std::cerr << "EmitRawCode = " << emitRawCode << "\n"; - std::cerr << "OutputMachine = " << machine << "\n"; - std::cerr << "EmitNativeCode = " << emitNativeCode << "\n"; - InputList::const_iterator I = InpList.begin(); - while ( I != InpList.end() ) { - std::cerr << "Input: " << I->first << "(" << I->second << ")\n"; - ++I; - } - std::cerr << "Output: " << Output << "\n"; - } - // If there's no input, we're done. - if (InpList.empty()) - error("Nothing to compile."); - - // If they are asking for linking and didn't provide an output - // file then its an error (no way for us to "make up" a meaningful - // file name based on the various linker input files). - if (finalPhase == LINKING && Output.empty()) - error("An output file name must be specified for linker output"); - - // This vector holds all the resulting actions of the following loop. - std::vector actions; - - // Create a temporary directory for our temporary files - std::string TempDir(sys::MakeTemporaryDirectory()); - std::string TempPreprocessorOut(TempDir + "/preproc.o"); - std::string TempTranslatorOut(TempDir + "/trans.o"); - std::string TempOptimizerOut(TempDir + "/opt.o"); - std::string TempAssemblerOut(TempDir + "/asm.o"); - - /// PRE-PROCESSING / TRANSLATION / OPTIMIZATION / ASSEMBLY phases - // for each input item - std::vector LinkageItems; - std::string OutFile(Output); - InputList::const_iterator I = InpList.begin(); - while ( I != InpList.end() ) { - // Get the suffix of the file name - const std::string& ftype = I->second; - - // If its a library, bytecode file, or object file, save - // it for linking below and short circuit the - // pre-processing/translation/assembly phases - if (ftype.empty() || ftype == "o" || ftype == "bc") { - // We shouldn't get any of these types of files unless we're - // later going to link. Enforce this limit now. - if (finalPhase != LINKING) { - error("Pre-compiled objects found but linking not requested"); + // Finally, we're done + return action; } - LinkageItems.push_back(I->first); - ++I; continue; // short circuit remainder of loop - } - // At this point, we know its something we need to translate - // and/or optimize. See if we can get the configuration data - // for this kind of file. - ConfigData* cd = cdp->ProvideConfigData(I->second); - if (cd == 0) - error(std::string("Files of type '") + I->second + - "' are not recognized." ); - if (isDebug) - DumpConfigData(cd,I->second); - - // Initialize the input file - std::string InFile(I->first); - - // PRE-PROCESSING PHASE - Action& action = cd->PreProcessor; - - // Get the preprocessing action, if needed, or error if appropriate - if (!action.program.empty()) { - if (action.isSet(REQUIRED_FLAG) || finalPhase == PREPROCESSING) { - if (finalPhase == PREPROCESSING) - actions.push_back(GetAction(cd,InFile,OutFile,PREPROCESSING)); - else { - actions.push_back(GetAction(cd,InFile,TempPreprocessorOut, - PREPROCESSING)); - InFile = TempPreprocessorOut; + bool DoAction(Action*action) { + assert(action != 0 && "Invalid Action!"); + if (isSet(VERBOSE_FLAG)) + WriteAction(action); + if (!isSet(DRY_RUN_FLAG)) { + action->program = sys::Program::FindProgramByName(action->program.get()); + if (action->program.is_empty()) + throw "Can't find program '" + action->program.get() + "'"; + + // Invoke the program + return 0 == action->program.ExecuteAndWait(action->args); } + return true; } - } else if (finalPhase == PREPROCESSING) { - error(cd->langName + " does not support pre-processing"); - } else if (action.isSet(REQUIRED_FLAG)) { - error(std::string("Don't know how to pre-process ") + - cd->langName + " files"); - } - // Short-circuit remaining actions if all they want is pre-processing - if (finalPhase == PREPROCESSING) { ++I; continue; }; + /// This method tries various variants of a linkage item's file + /// name to see if it can find an appropriate file to link with + /// in the directory specified. + llvm::sys::Path GetPathForLinkageItem(const std::string& link_item, + const sys::Path& dir) { + sys::Path fullpath(dir); + fullpath.append_file(link_item); + fullpath.append_suffix("bc"); + if (fullpath.readable()) + return fullpath; + fullpath.elide_suffix(); + fullpath.append_suffix("o"); + if (fullpath.readable()) + return fullpath; + fullpath = dir; + fullpath.append_file(std::string("lib") + link_item); + fullpath.append_suffix("a"); + if (fullpath.readable()) + return fullpath; + fullpath.elide_suffix(); + fullpath.append_suffix("so"); + if (fullpath.readable()) + return fullpath; + + // Didn't find one. + fullpath.clear(); + return fullpath; + } - /// TRANSLATION PHASE - action = cd->Translator; + /// This method processes a linkage item. The item could be a + /// Bytecode file needing translation to native code and that is + /// dependent on other bytecode libraries, or a native code + /// library that should just be linked into the program. + bool ProcessLinkageItem(const llvm::sys::Path& link_item, + SetVector& set, + std::string& err) { + // First, see if the unadorned file name is not readable. If so, + // we must track down the file in the lib search path. + sys::Path fullpath; + if (!link_item.readable()) { + // First, look for the library using the -L arguments specified + // on the command line. + PathVector::iterator PI = LibraryPaths.begin(); + PathVector::iterator PE = LibraryPaths.end(); + while (PI != PE && fullpath.is_empty()) { + fullpath = GetPathForLinkageItem(link_item.get(),*PI); + ++PI; + } - // Get the translation action, if needed, or error if appropriate - if (!action.program.empty()) { - if (action.isSet(REQUIRED_FLAG) || finalPhase == TRANSLATION) { - if (finalPhase == TRANSLATION) - actions.push_back(GetAction(cd,InFile,OutFile,TRANSLATION)); - else { - actions.push_back(GetAction(cd,InFile,TempTranslatorOut,TRANSLATION)); - InFile = TempTranslatorOut; + // If we didn't find the file in any of the library search paths + // so we have to bail. No where else to look. + if (fullpath.is_empty()) { + err = std::string("Can't find linkage item '") + link_item.get() + "'"; + return false; + } + } else { + fullpath = link_item; } - // ll -> bc Helper - if (action.isSet(OUTPUT_IS_ASM_FLAG)) { - /// The output of the translator is an LLVM Assembly program - /// We need to translate it to bytecode - Action* action = new Action(); - action->program = "llvm-as"; - action->args.push_back(InFile); - action->args.push_back("-o"); - InFile += ".bc"; - action->args.push_back(InFile); - actions.push_back(action); + // If we got here fullpath is the path to the file, and its readable. + set.insert(fullpath); + + // If its an LLVM bytecode file ... + if (CheckMagic(fullpath.get(), "llvm")) { + // Process the dependent libraries recursively + Module::LibraryListType modlibs; + if (GetBytecodeDependentLibraries(fullpath.get(),modlibs)) { + // Traverse the dependent libraries list + Module::lib_iterator LI = modlibs.begin(); + Module::lib_iterator LE = modlibs.end(); + while ( LI != LE ) { + if (!ProcessLinkageItem(sys::Path(*LI),set,err)) { + if (err.empty()) { + err = std::string("Library '") + *LI + + "' is not valid for linking but is required by file '" + + fullpath.get() + "'"; + } else { + err += " which is required by file '" + fullpath.get() + "'"; + } + return false; + } + ++LI; + } + } else if (err.empty()) { + err = std::string("The dependent libraries could not be extracted from '") + + fullpath.get(); + return false; + } } + return true; } - } else if (finalPhase == TRANSLATION) { - error(cd->langName + " does not support translation"); - } else if (action.isSet(REQUIRED_FLAG)) { - error(std::string("Don't know how to translate ") + - cd->langName + " files"); - } - // Short-circuit remaining actions if all they want is translation - if (finalPhase == TRANSLATION) { ++I; continue; } + /// @} + /// @name Methods + /// @{ + public: + virtual int execute(const InputList& InpList, const sys::Path& Output ) { + try { + // Echo the configuration of options if we're running verbose + if (isSet(DEBUG_FLAG)) { + std::cerr << "Compiler Driver Options:\n"; + std::cerr << "DryRun = " << isSet(DRY_RUN_FLAG) << "\n"; + std::cerr << "Verbose = " << isSet(VERBOSE_FLAG) << " \n"; + std::cerr << "TimeActions = " << isSet(TIME_ACTIONS_FLAG) << "\n"; + std::cerr << "TimePasses = " << isSet(TIME_PASSES_FLAG) << "\n"; + std::cerr << "ShowStats = " << isSet(SHOW_STATS_FLAG) << "\n"; + std::cerr << "EmitRawCode = " << isSet(EMIT_RAW_FLAG) << "\n"; + std::cerr << "EmitNativeCode = " << isSet(EMIT_NATIVE_FLAG) << "\n"; + std::cerr << "ForceOutput = " << isSet(FORCE_FLAG) << "\n"; + std::cerr << "KeepTemps = " << isSet(KEEP_TEMPS_FLAG) << "\n"; + std::cerr << "OutputMachine = " << machine << "\n"; + InputList::const_iterator I = InpList.begin(); + while ( I != InpList.end() ) { + std::cerr << "Input: " << I->first.get() << "(" << I->second << ")\n"; + ++I; + } + std::cerr << "Output: " << Output.get() << "\n"; + } - /// OPTIMIZATION PHASE - action = cd->Optimizer; + // If there's no input, we're done. + if (InpList.empty()) + throw std::string("Nothing to compile."); + + // If they are asking for linking and didn't provide an output + // file then its an error (no way for us to "make up" a meaningful + // file name based on the various linker input files). + if (finalPhase == LINKING && Output.is_empty()) + throw std::string( + "An output file name must be specified for linker output"); + + // This vector holds all the resulting actions of the following loop. + std::vector actions; + + /// PRE-PROCESSING / TRANSLATION / OPTIMIZATION / ASSEMBLY phases + // for each input item + SetVector LinkageItems; + sys::Path OutFile(Output); + InputList::const_iterator I = InpList.begin(); + while ( I != InpList.end() ) { + // Get the suffix of the file name + const std::string& ftype = I->second; + + // If its a library, bytecode file, or object file, save + // it for linking below and short circuit the + // pre-processing/translation/assembly phases + if (ftype.empty() || ftype == "o" || ftype == "bc") { + // We shouldn't get any of these types of files unless we're + // later going to link. Enforce this limit now. + if (finalPhase != LINKING) { + throw std::string( + "Pre-compiled objects found but linking not requested"); + } + LinkageItems.insert(I->first); + ++I; continue; // short circuit remainder of loop + } + + // At this point, we know its something we need to translate + // and/or optimize. See if we can get the configuration data + // for this kind of file. + ConfigData* cd = cdp->ProvideConfigData(I->second); + if (cd == 0) + throw std::string("Files of type '") + I->second + + "' are not recognized."; + if (isSet(DEBUG_FLAG)) + DumpConfigData(cd,I->second); + + // Initialize the input file + sys::Path InFile(I->first); + + // PRE-PROCESSING PHASE + Action& action = cd->PreProcessor; + + // Get the preprocessing action, if needed, or error if appropriate + if (!action.program.is_empty()) { + if (action.isSet(REQUIRED_FLAG) || finalPhase == PREPROCESSING) { + if (finalPhase == PREPROCESSING) + actions.push_back(GetAction(cd,InFile,OutFile,PREPROCESSING)); + else { + sys::Path TempFile(MakeTempFile(I->first.get(),"E")); + actions.push_back(GetAction(cd,InFile,TempFile,PREPROCESSING)); + InFile = TempFile; + } + } + } else if (finalPhase == PREPROCESSING) { + throw cd->langName + " does not support pre-processing"; + } else if (action.isSet(REQUIRED_FLAG)) { + throw std::string("Don't know how to pre-process ") + + cd->langName + " files"; + } + + // Short-circuit remaining actions if all they want is pre-processing + if (finalPhase == PREPROCESSING) { ++I; continue; }; + + /// TRANSLATION PHASE + action = cd->Translator; + + // Get the translation action, if needed, or error if appropriate + if (!action.program.is_empty()) { + if (action.isSet(REQUIRED_FLAG) || finalPhase == TRANSLATION) { + if (finalPhase == TRANSLATION) + actions.push_back(GetAction(cd,InFile,OutFile,TRANSLATION)); + else { + sys::Path TempFile(MakeTempFile(I->first.get(),"trans")); + actions.push_back(GetAction(cd,InFile,TempFile,TRANSLATION)); + InFile = TempFile; + } + + // ll -> bc Helper + if (action.isSet(OUTPUT_IS_ASM_FLAG)) { + /// The output of the translator is an LLVM Assembly program + /// We need to translate it to bytecode + Action* action = new Action(); + action->program.set_file("llvm-as"); + action->args.push_back(InFile.get()); + action->args.push_back("-o"); + InFile.append_suffix("bc"); + action->args.push_back(InFile.get()); + actions.push_back(action); + } + } + } else if (finalPhase == TRANSLATION) { + throw cd->langName + " does not support translation"; + } else if (action.isSet(REQUIRED_FLAG)) { + throw std::string("Don't know how to translate ") + + cd->langName + " files"; + } + + // Short-circuit remaining actions if all they want is translation + if (finalPhase == TRANSLATION) { ++I; continue; } + + /// OPTIMIZATION PHASE + action = cd->Optimizer; + + // Get the optimization action, if needed, or error if appropriate + if (!isSet(EMIT_RAW_FLAG)) { + if (!action.program.is_empty()) { + if (action.isSet(REQUIRED_FLAG) || finalPhase == OPTIMIZATION) { + if (finalPhase == OPTIMIZATION) + actions.push_back(GetAction(cd,InFile,OutFile,OPTIMIZATION)); + else { + sys::Path TempFile(MakeTempFile(I->first.get(),"opt")); + actions.push_back(GetAction(cd,InFile,TempFile,OPTIMIZATION)); + InFile = TempFile; + } + // ll -> bc Helper + if (action.isSet(OUTPUT_IS_ASM_FLAG)) { + /// The output of the translator is an LLVM Assembly program + /// We need to translate it to bytecode + Action* action = new Action(); + action->program.set_file("llvm-as"); + action->args.push_back(InFile.get()); + action->args.push_back("-f"); + action->args.push_back("-o"); + InFile.append_suffix("bc"); + action->args.push_back(InFile.get()); + actions.push_back(action); + } + } + } else if (finalPhase == OPTIMIZATION) { + throw cd->langName + " does not support optimization"; + } else if (action.isSet(REQUIRED_FLAG)) { + throw std::string("Don't know how to optimize ") + + cd->langName + " files"; + } + } + + // Short-circuit remaining actions if all they want is optimization + if (finalPhase == OPTIMIZATION) { ++I; continue; } + + /// ASSEMBLY PHASE + action = cd->Assembler; + + if (finalPhase == ASSEMBLY || isSet(EMIT_NATIVE_FLAG)) { + if (isSet(EMIT_NATIVE_FLAG)) { + if (action.program.is_empty()) { + throw std::string("Native Assembler not specified for ") + + cd->langName + " files"; + } else if (finalPhase == ASSEMBLY) { + actions.push_back(GetAction(cd,InFile,OutFile,ASSEMBLY)); + } else { + sys::Path TempFile(MakeTempFile(I->first.get(),"S")); + actions.push_back(GetAction(cd,InFile,TempFile,ASSEMBLY)); + InFile = TempFile; + } + } else { + // Just convert back to llvm assembly with llvm-dis + Action* action = new Action(); + action->program.set_file("llvm-dis"); + action->args.push_back(InFile.get()); + action->args.push_back("-f"); + action->args.push_back("-o"); + action->args.push_back(OutFile.get()); + actions.push_back(action); + } + } + + // Short-circuit remaining actions if all they want is assembly output + if (finalPhase == ASSEMBLY) { ++I; continue; } + + // Register the OutFile as a link candidate + LinkageItems.insert(InFile); - // Get the optimization action, if needed, or error if appropriate - if (!emitRawCode) { - if (!action.program.empty()) { - if (action.isSet(REQUIRED_FLAG) || finalPhase == OPTIMIZATION) { - if (finalPhase == OPTIMIZATION) - actions.push_back(GetAction(cd,InFile,OutFile,OPTIMIZATION)); - else { - actions.push_back(GetAction(cd,InFile,TempOptimizerOut,OPTIMIZATION)); - InFile = TempOptimizerOut; + // Go to next file to be processed + ++I; } - // ll -> bc Helper - if (action.isSet(OUTPUT_IS_ASM_FLAG)) { - /// The output of the translator is an LLVM Assembly program - /// We need to translate it to bytecode - Action* action = new Action(); - action->program = "llvm-as"; - action->args.push_back(InFile); - action->args.push_back("-f"); - action->args.push_back("-o"); - InFile += ".bc"; - action->args.push_back(InFile); - actions.push_back(action); - } - } - } else if (finalPhase == OPTIMIZATION) { - error(cd->langName + " does not support optimization"); - } else if (action.isSet(REQUIRED_FLAG)) { - error(std::string("Don't know how to optimize ") + - cd->langName + " files"); - } - } - // Short-circuit remaining actions if all they want is optimization - if (finalPhase == OPTIMIZATION) { ++I; continue; } + /// RUN THE COMPILATION ACTIONS + std::vector::iterator AI = actions.begin(); + std::vector::iterator AE = actions.end(); + while (AI != AE) { + if (!DoAction(*AI)) + throw "Action failed"; + AI++; + } - /// ASSEMBLY PHASE - action = cd->Assembler; + /// LINKING PHASE + actions.clear(); + if (finalPhase == LINKING) { + if (isSet(EMIT_NATIVE_FLAG)) { + throw "llvmc doesn't know how to link native code yet"; + } else { + // First, we need to examine the files to ensure that they all contain + // bytecode files. Since the final output is bytecode, we can only + // link bytecode. + SetVector::const_iterator I = LinkageItems.begin(); + SetVector::const_iterator E = LinkageItems.end(); + std::string errmsg; + + while (I != E && ProcessLinkageItem(*I,LinkageItems,errmsg)) + ++I; + + if (!errmsg.empty()) + throw errmsg; + + // Insert the system libraries. + LibraryPaths.push_back(sys::Path::GetSystemLibraryPath1()); + LibraryPaths.push_back(sys::Path::GetSystemLibraryPath2()); + + // We're emitting bytecode so let's build an llvm-link Action + Action* link = new Action(); + link->program.set_file("llvm-link"); + for (PathVector::const_iterator I=LinkageItems.begin(), + E=LinkageItems.end(); I != E; ++I ) + link->args.push_back(I->get()); + if (isSet(VERBOSE_FLAG)) + link->args.push_back("-v"); + link->args.push_back("-f"); + link->args.push_back("-o"); + link->args.push_back(OutFile.get()); + if (isSet(TIME_PASSES_FLAG)) + link->args.push_back("-time-passes"); + if (isSet(SHOW_STATS_FLAG)) + link->args.push_back("-stats"); + actions.push_back(link); + } + } - if (finalPhase == ASSEMBLY || emitNativeCode) { - if (emitNativeCode) { - if (action.program.empty()) { - error(std::string("Native Assembler not specified for ") + - cd->langName + " files"); - } else if (finalPhase == ASSEMBLY) { - actions.push_back(GetAction(cd,InFile,OutFile,ASSEMBLY)); - } else { - actions.push_back(GetAction(cd,InFile,TempAssemblerOut,ASSEMBLY)); - InFile = TempAssemblerOut; + /// RUN THE LINKING ACTIONS + AI = actions.begin(); + AE = actions.end(); + while (AI != AE) { + if (!DoAction(*AI)) + throw std::string("Action failed"); + AI++; + } + } catch (std::string& msg) { + cleanup(); + throw; + } catch (...) { + cleanup(); + throw std::string("Unspecified error"); } - } else { - // Just convert back to llvm assembly with llvm-dis - Action* action = new Action(); - action->program = "llvm-dis"; - action->args.push_back(InFile); - action->args.push_back("-f"); - action->args.push_back("-o"); - action->args.push_back(OutFile); - actions.push_back(action); + cleanup(); + return 0; } - } - - // Short-circuit remaining actions if all they want is assembly output - if (finalPhase == ASSEMBLY) { ++I; continue; } - - // Register the OutFile as a link candidate - LinkageItems.push_back(InFile); - // Go to next file to be processed - ++I; - } + /// @} + /// @name Data + /// @{ + private: + ConfigDataProvider* cdp; ///< Where we get configuration data from + Phases finalPhase; ///< The final phase of compilation + OptimizationLevels optLevel; ///< The optimization level to apply + unsigned Flags; ///< The driver flags + std::string machine; ///< Target machine name + PathVector LibraryPaths; ///< -L options + sys::Path TempDir; ///< Name of the temporary directory. + StringTable AdditionalArgs; ///< The -Txyz options - /// RUN THE COMPILATION ACTIONS - std::vector::iterator aIter = actions.begin(); - while (aIter != actions.end()) { - if (!DoAction(*aIter)) - error("Action failed"); - aIter++; - } + /// @} + }; +} - /// LINKING PHASE - if (finalPhase == LINKING) { - if (emitNativeCode) { - error("llvmc doesn't know how to link native code yet"); - } else { - // First, we need to examine the files to ensure that they all contain - // bytecode files. Since the final output is bytecode, we can only - // link bytecode. - StringVector::const_iterator I = LinkageItems.begin(); - StringVector::const_iterator E = LinkageItems.end(); - SetVector link_items; - std::string errmsg; - while (I != E && ProcessLinkageItem(*I,link_items,errmsg)) - ++I; - - if (!errmsg.empty()) - error(errmsg); - - // We're emitting bytecode so let's build an llvm-link Action - Action* link = new Action(); - link->program = "llvm-link"; - link->args = LinkageItems; - link->args.insert(link->args.end(), link_items.begin(), link_items.end()); - link->args.push_back("-f"); - link->args.push_back("-o"); - link->args.push_back(OutFile); - if (timePasses) - link->args.push_back("-time-passes"); - if (showStats) - link->args.push_back("-stats"); - actions.push_back(link); - } - } +CompilerDriver::~CompilerDriver() { +} - if (!keepTemps) { - // Cleanup files - ::sys::CleanupTempFile(TempPreprocessorOut); - ::sys::CleanupTempFile(TempTranslatorOut); - ::sys::CleanupTempFile(TempOptimizerOut); - - // Cleanup temporary directory we created - if (::sys::FileIsReadable(TempDir)) - rmdir(TempDir.c_str()); - } +CompilerDriver* +CompilerDriver::Get(ConfigDataProvider& CDP) { + return new CompilerDriverImpl(CDP); +} - return 0; +CompilerDriver::ConfigData::ConfigData() + : langName() + , PreProcessor() + , Translator() + , Optimizer() + , Assembler() + , Linker() +{ + StringVector emptyVec; + for (unsigned i = 0; i < NUM_PHASES; ++i) + opts.push_back(emptyVec); } // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab Index: llvm/tools/llvmc/CompilerDriver.h diff -u llvm/tools/llvmc/CompilerDriver.h:1.9 llvm/tools/llvmc/CompilerDriver.h:1.10 --- llvm/tools/llvmc/CompilerDriver.h:1.9 Tue Aug 24 17:55:34 2004 +++ llvm/tools/llvmc/CompilerDriver.h Sun Aug 29 14:26:56 2004 @@ -16,7 +16,7 @@ #include #include -#include "Support/SetVector.h" +#include "llvm/System/Program.h" namespace llvm { /// This class provides the high level interface to the LLVM Compiler Driver. @@ -30,9 +30,12 @@ /// @name Types /// @{ public: - /// @brief A vector of strings, commonly used + /// @brief A vector of strings, used for argument lists typedef std::vector StringVector; + /// @brief A vector of sys::Path, used for path lists + typedef std::vector PathVector; + /// @brief A table of strings, indexed typically by Phases typedef std::vector StringTable; @@ -65,11 +68,26 @@ FLAGS_MASK = 0x000F, ///< Union of all flags }; + /// @brief Driver specific flags + enum DriverFlags { + DRY_RUN_FLAG = 0x0001, ///< Do everything but execute actions + FORCE_FLAG = 0x0002, ///< Force overwrite of output files + VERBOSE_FLAG = 0x0004, ///< Print each action + DEBUG_FLAG = 0x0008, ///< Print debug information + TIME_PASSES_FLAG = 0x0010, ///< Time the passes as they execute + TIME_ACTIONS_FLAG = 0x0020, ///< Time the actions as they execute + SHOW_STATS_FLAG = 0x0040, ///< Show pass statistics + EMIT_NATIVE_FLAG = 0x0080, ///< Emit native code instead of bc + EMIT_RAW_FLAG = 0x0100, ///< Emit raw, unoptimized bytecode + KEEP_TEMPS_FLAG = 0x0200, ///< Don't delete temporary files + DRIVER_FLAGS_MASK = 0x02FF, ///< Union of the above flags + }; + /// This type is the input list to the CompilerDriver. It provides - /// a vector of filename/filetype pairs. The filetype is used to look up + /// a vector of pathname/filetype pairs. The filetype is used to look up /// the configuration of the actions to be taken by the driver. /// @brief The Input Data to the execute method - typedef std::vector > InputList; + typedef std::vector > InputList; /// This type is read from configuration files or otherwise provided to /// the CompilerDriver through a "ConfigDataProvider". It serves as both @@ -78,7 +96,7 @@ /// language. struct Action { Action() : flags(0) {} - std::string program; ///< The program to execve + sys::Program program; ///< The program to execve StringVector args; ///< Arguments to the program unsigned flags; ///< Action specific flags void set(unsigned fl ) { flags |= fl; } @@ -107,127 +125,49 @@ class ConfigDataProvider { public: virtual ConfigData* ProvideConfigData(const std::string& filetype) = 0; - virtual void setConfigDir(const std::string& dirName) = 0; + virtual void setConfigDir(const sys::Path& dirName) = 0; }; /// @} /// @name Constructors /// @{ public: - CompilerDriver(ConfigDataProvider& cdp ); + /// @brief Static Constructor + static CompilerDriver* Get(ConfigDataProvider& CDP); + + /// @brief Virtual destructor virtual ~CompilerDriver(); /// @} /// @name Methods /// @{ public: - /// @brief Handle an error - virtual void error(const std::string& errmsg); - /// @brief Execute the actions requested for the given input list. - virtual int execute(const InputList& list, const std::string& output); + virtual int execute(const InputList& list, const sys::Path& output) = 0; - /// @} - /// @name Mutators - /// @{ - public: /// @brief Set the final phase at which compilation terminates - void setFinalPhase( Phases phase ) { finalPhase = phase; } + virtual void setFinalPhase(Phases phase) = 0; /// @brief Set the optimization level for the compilation - void setOptimization( OptimizationLevels level ) { optLevel = level; } - - /// @brief Prevent the CompilerDriver from taking any actions - void setDryRun( bool TF ) { isDryRun = TF; } - - /// @brief Cause the CompilerDriver to print to stderr all the - /// actions it is taking. - void setVerbose( bool TF ) { isVerbose = TF; } - - /// @brief Cause the CompilerDriver to print to stderr very verbose - /// information that might be useful in debugging the driver's actions - void setDebug( bool TF ) { isDebug = TF; } - - /// @brief Cause the CompilerDriver to print to stderr the - /// execution time of each action taken. - void setTimeActions( bool TF ) { timeActions = TF; } + virtual void setOptimization(OptimizationLevels level) = 0; - /// @brief Cause the CompilerDriver to print timings for each pass. - void setTimePasses( bool TF ) { timePasses = TF; } - - /// @brief Cause the CompilerDriver to show statistics gathered - void setShowStats( bool TF ) { showStats = TF; } - - /// @brief Indicate that native code is to be generated instead - /// of LLVM bytecode. - void setEmitNativeCode( bool TF ) { emitNativeCode = TF; } - - /// @brief Indicate that raw, unoptimized code is to be generated. - void setEmitRawCode(bool TF ) { emitRawCode = TF; } - - void setKeepTemporaries(bool TF) { keepTemps = TF; } + /// @brief Set the driver flags. + virtual void setDriverFlags(unsigned flags) = 0; /// @brief Set the output machine name. - void setOutputMachine( const std::string& machineName ) { - machine = machineName; - } + virtual void setOutputMachine(const std::string& machineName) = 0; /// @brief Set Preprocessor specific options - void setPhaseArgs(Phases phase, const std::vector& opts) { - assert(phase <= LINKING && phase >= PREPROCESSING); - AdditionalArgs[phase] = opts; - } + virtual void setPhaseArgs(Phases phase, const StringVector& opts) = 0; /// @brief Set Library Paths - void setLibraryPaths(const std::vector& paths) { - LibraryPaths = paths; - } + virtual void setLibraryPaths(const StringVector& paths) = 0; /// @brief Set the list of library paths to be searched for /// libraries. - void addLibraryPath( const std::string& libPath ) { - LibraryPaths.push_back(libPath); - } + virtual void addLibraryPath( const sys::Path& libPath ) = 0; /// @} - /// @name Functions - /// @{ - private: - Action* GetAction(ConfigData* cd, const std::string& input, - const std::string& output, Phases phase ); - - bool DoAction(Action* a); - - std::string GetPathForLinkageItem(const std::string& link_item, - const std::string& dir); - - bool ProcessLinkageItem(const std::string& link_item, - SetVector& set, - std::string& err); - - /// @} - /// @name Data - /// @{ - private: - ConfigDataProvider* cdp; ///< Where we get configuration data from - Phases finalPhase; ///< The final phase of compilation - OptimizationLevels optLevel; ///< The optimization level to apply - bool isDryRun; ///< Prevent actions ? - bool isVerbose; ///< Print actions? - bool isDebug; ///< Print lotsa debug info? - bool timeActions; ///< Time the actions executed ? - bool timePasses; ///< Time each pass and print timing ? - bool showStats; ///< Show gathered statistics ? - bool emitRawCode; ///< Emit Raw (unoptimized) code? - bool emitNativeCode; ///< Emit native code instead of bytecode? - bool keepTemps; ///< Keep temporary files? - std::string machine; ///< Target machine name - StringVector LibraryPaths; ///< -L options - StringTable AdditionalArgs; ///< The -Txyz options - std::string TempDir; ///< Name of the temporary directory. - - /// @} - }; } Index: llvm/tools/llvmc/ConfigLexer.h diff -u llvm/tools/llvmc/ConfigLexer.h:1.5 llvm/tools/llvmc/ConfigLexer.h:1.6 --- llvm/tools/llvmc/ConfigLexer.h:1.5 Tue Aug 24 08:59:35 2004 +++ llvm/tools/llvmc/ConfigLexer.h Sun Aug 29 14:26:56 2004 @@ -57,6 +57,7 @@ COMMAND, ///< The name "command" (and variants) EQUALS, ///< The equals sign, = FALSETOK, ///< A boolean false value (false/no/off) + FORCE_SUBST, ///< The substitution item %force% IN_SUBST, ///< The substitution item %in% INTEGER, ///< An integer LANG, ///< The name "lang" (and variants) @@ -85,6 +86,7 @@ TRANSLATES, ///< The name "translates" (and variants) TRANSLATOR, ///< The name "translator" (and variants) TRUETOK, ///< A boolean true value (true/yes/on) + VERBOSE_SUBST,///< The substitution item %verbose% VERSION, ///< The name "version" (and variants) }; Index: llvm/tools/llvmc/ConfigLexer.l diff -u llvm/tools/llvmc/ConfigLexer.l:1.6 llvm/tools/llvmc/ConfigLexer.l:1.7 --- llvm/tools/llvmc/ConfigLexer.l:1.6 Tue Aug 24 08:58:37 2004 +++ llvm/tools/llvmc/ConfigLexer.l Sun Aug 29 14:26:56 2004 @@ -160,12 +160,14 @@ {LINKER} { return handleNameContext(LINKER); } %args% { return handleSubstitution(ARGS_SUBST); } +%force% { return handleSubstitution(FORCE_SUBST); } %in% { return handleSubstitution(IN_SUBST); } +%opt% { return handleSubstitution(OPT_SUBST); } %out% { return handleSubstitution(OUT_SUBST); } -%time% { return handleSubstitution(TIME_SUBST); } %stats% { return handleSubstitution(STATS_SUBST); } -%opt% { return handleSubstitution(OPT_SUBST); } %target% { return handleSubstitution(TARGET_SUBST); } +%time% { return handleSubstitution(TIME_SUBST); } +%verbose% { return handleSubstitution(VERBOSE_SUBST); } {BadSubst} { YY_FATAL_ERROR("Invalid substitution token"); } {Assembly} { return handleValueContext(ASSEMBLY); } Index: llvm/tools/llvmc/Configuration.cpp diff -u llvm/tools/llvmc/Configuration.cpp:1.10 llvm/tools/llvmc/Configuration.cpp:1.11 --- llvm/tools/llvmc/Configuration.cpp:1.10 Tue Aug 24 09:03:23 2004 +++ llvm/tools/llvmc/Configuration.cpp Sun Aug 29 14:26:56 2004 @@ -90,19 +90,19 @@ InputProvider* provider; CompilerDriver::ConfigData* confDat; - int next() { + inline int next() { token = Configlex(); if (DumpTokens) std::cerr << token << "\n"; return token; } - bool next_is_real() { + inline bool next_is_real() { next(); return (token != EOLTOK) && (token != ERRORTOK) && (token != 0); } - void eatLineRemnant() { + inline void eatLineRemnant() { while (next_is_real()) ; } @@ -162,6 +162,8 @@ case STATS_SUBST: optList.push_back("%stats%"); break; case OPT_SUBST: optList.push_back("%opt%"); break; case TARGET_SUBST: optList.push_back("%target%"); break; + case FORCE_SUBST: optList.push_back("%force%"); break; + case VERBOSE_SUBST: optList.push_back("%verbose%"); break; default: return false; } @@ -229,7 +231,7 @@ action.args.clear(); } else { if (token == STRING || token == OPTION) { - action.program = ConfigLexerState.StringVal; + action.program.set_file(ConfigLexerState.StringVal); } else { error("Expecting a program name"); } @@ -415,42 +417,46 @@ CompilerDriver::ConfigData* LLVMC_ConfigDataProvider::ReadConfigData(const std::string& ftype) { CompilerDriver::ConfigData* result = 0; - std::string dir_name; - if (configDir.empty()) { + sys::Path confFile; + if (configDir.is_empty()) { // Try the environment variable const char* conf = getenv("LLVM_CONFIG_DIR"); if (conf) { - dir_name = conf; - dir_name += "/"; - if (!::sys::FileIsReadable(dir_name + ftype)) + confFile.set_directory(conf); + confFile.append_file(ftype); + if (!confFile.readable()) throw "Configuration file for '" + ftype + "' is not available."; } else { // Try the user's home directory - const char* home = getenv("HOME"); - if (home) { - dir_name = home; - dir_name += "/.llvm/etc/"; - if (!::sys::FileIsReadable(dir_name + ftype)) { - // Okay, try the LLVM installation directory - dir_name = LLVM_ETCDIR; - dir_name += "/"; - if (!::sys::FileIsReadable(dir_name + ftype)) { - // Okay, try the "standard" place - dir_name = "/etc/llvm/"; - if (!::sys::FileIsReadable(dir_name + ftype)) { - throw "Configuration file for '" + ftype + "' is not available."; - } + confFile = sys::Path::GetUserHomeDirectory(); + if (!confFile.is_empty()) { + confFile.append_directory(".llvm"); + confFile.append_directory("etc"); + confFile.append_file(ftype); + if (!confFile.readable()) + confFile.clear(); + } + if (!confFile.is_empty()) { + // Okay, try the LLVM installation directory + confFile = sys::Path::GetLLVMConfigDir(); + confFile.append_file(ftype); + if (!confFile.readable()) { + // Okay, try the "standard" place + confFile = sys::Path::GetLLVMDefaultConfigDir(); + confFile.append_file(ftype); + if (!confFile.readable()) { + throw "Configuration file for '" + ftype + "' is not available."; } } } } } else { - dir_name = configDir + "/"; - if (!::sys::FileIsReadable(dir_name + ftype)) { + confFile = configDir; + confFile.append_file(ftype); + if (!confFile.readable()) throw "Configuration file for '" + ftype + "' is not available."; - } } - FileInputProvider fip( dir_name + ftype ); + FileInputProvider fip( confFile.get() ); if (!fip.okay()) { throw "Configuration file for '" + ftype + "' is not available."; } @@ -459,13 +465,6 @@ return result; } -LLVMC_ConfigDataProvider::LLVMC_ConfigDataProvider() - : Configurations() - , configDir() -{ - Configurations.clear(); -} - LLVMC_ConfigDataProvider::~LLVMC_ConfigDataProvider() { ConfigDataMap::iterator cIt = Configurations.begin(); @@ -491,7 +490,7 @@ // The configuration data doesn't exist, we have to go read it. result = ReadConfigData(filetype); // If we got one, cache it - if ( result != 0 ) + if (result != 0) Configurations.insert(std::make_pair(filetype,result)); } return result; // Might return 0 Index: llvm/tools/llvmc/Configuration.h diff -u llvm/tools/llvmc/Configuration.h:1.3 llvm/tools/llvmc/Configuration.h:1.4 --- llvm/tools/llvmc/Configuration.h:1.3 Thu Aug 19 16:17:53 2004 +++ llvm/tools/llvmc/Configuration.h Sun Aug 29 14:26:56 2004 @@ -29,7 +29,6 @@ /// @name Constructor /// @{ public: - LLVMC_ConfigDataProvider(); virtual ~LLVMC_ConfigDataProvider(); /// @name Methods @@ -40,7 +39,9 @@ ProvideConfigData(const std::string& filetype); /// @brief Allow the configuration directory to be set - virtual void setConfigDir(const std::string& dirName) { configDir = dirName; } + virtual void setConfigDir(const sys::Path& dirName) { + configDir = dirName; + } private: CompilerDriver::ConfigData* ReadConfigData(const std::string& ftype); @@ -53,7 +54,7 @@ typedef hash_map,std::equal_to > ConfigDataMap; ConfigDataMap Configurations; ///< The cache of configurations - std::string configDir; + sys::Path configDir; /// @} }; } Index: llvm/tools/llvmc/Makefile diff -u llvm/tools/llvmc/Makefile:1.5 llvm/tools/llvmc/Makefile:1.6 --- llvm/tools/llvmc/Makefile:1.5 Tue Aug 24 09:04:07 2004 +++ llvm/tools/llvmc/Makefile Sun Aug 29 14:26:56 2004 @@ -8,7 +8,7 @@ ##===----------------------------------------------------------------------===## LEVEL = ../.. TOOLNAME = llvmc -USEDLIBS = bcreader vmcore support.a +USEDLIBS = bcreader vmcore support.a LLVMsystem.a CONFIG_FILES = st ll include $(LEVEL)/Makefile.common Index: llvm/tools/llvmc/llvmc.cpp diff -u llvm/tools/llvmc/llvmc.cpp:1.10 llvm/tools/llvmc/llvmc.cpp:1.11 --- llvm/tools/llvmc/llvmc.cpp:1.10 Tue Aug 24 17:53:13 2004 +++ llvm/tools/llvmc/llvmc.cpp Sun Aug 29 14:26:56 2004 @@ -108,6 +108,9 @@ cl::opt OutputFilename("o", cl::desc("Override output filename"), cl::value_desc("filename")); +cl::opt ForceOutput("f", cl::Optional, cl::init(false), + cl::desc("Force output files to be overridden")); + cl::opt OutputMachine("m", cl::Prefix, cl::desc("Specify a target machine"), cl::value_desc("machine")); @@ -156,7 +159,7 @@ static cl::opt PipeCommands("pipe", cl::Optional, cl::desc("Invoke sub-commands by linking input/output with pipes")); -static cl::opt KeepTemporaries("keep-temps", cl::Optional, +static cl::opt KeepTemps("keep-temps", cl::Optional, cl::desc("Don't delete the temporary files created during compilation")); //===------------------------------------------------------------------------=== @@ -199,15 +202,16 @@ /// @brief The main program for llvmc int main(int argc, char **argv) { + // Make sure we print stack trace if we get bad signals + sys::PrintStackTraceOnErrorSignal(); + try { - // Make sure we print stack trace if we get bad signals - PrintStackTraceOnErrorSignal(); // Parse the command line options cl::ParseCommandLineOptions(argc, argv, - " LLVM Compilation Driver (llvmc)\n\n" + " LLVM Compiler Driver (llvmc)\n\n" " This program provides easy invocation of the LLVM tool set\n" - " and source language compiler tools.\n" + " and other compiler tools.\n" ); // Deal with unimplemented options. @@ -220,13 +224,12 @@ else throw "An output file must be specified. Please use the -o option"; - // Construct the ConfigDataProvider object LLVMC_ConfigDataProvider Provider; - Provider.setConfigDir(ConfigDir); + Provider.setConfigDir(sys::Path(ConfigDir)); // Construct the CompilerDriver object - CompilerDriver CD(Provider); + CompilerDriver* CD = CompilerDriver::Get(Provider); // If the LLVM_LIB_SEARCH_PATH environment variable is // set, append it to the list of places to search for libraries @@ -234,30 +237,37 @@ if (!srchPath.empty()) LibPaths.push_back(srchPath); - // Configure the driver based on options - CD.setVerbose(Verbose); - CD.setDebug(Debug); - CD.setDryRun(DryRun); - CD.setFinalPhase(FinalPhase); - CD.setOptimization(OptLevel); - CD.setOutputMachine(OutputMachine); - CD.setEmitNativeCode(Native); - CD.setEmitRawCode(EmitRawCode); - CD.setTimeActions(TimeActions); - CD.setTimePasses(TimePassesIsEnabled); - CD.setShowStats(ShowStats); - CD.setKeepTemporaries(KeepTemporaries); - CD.setLibraryPaths(LibPaths); + // Set the driver flags based on command line options + unsigned flags = 0; + if (Verbose) flags |= CompilerDriver::VERBOSE_FLAG; + if (Debug) flags |= CompilerDriver::DEBUG_FLAG; + if (DryRun) flags |= CompilerDriver::DRY_RUN_FLAG; + if (ForceOutput) flags |= CompilerDriver::FORCE_FLAG; + if (Native) flags |= CompilerDriver::EMIT_NATIVE_FLAG; + if (EmitRawCode) flags |= CompilerDriver::EMIT_RAW_FLAG; + if (KeepTemps) flags |= CompilerDriver::KEEP_TEMPS_FLAG; + if (ShowStats) flags |= CompilerDriver::SHOW_STATS_FLAG; + if (TimeActions) flags |= CompilerDriver::TIME_ACTIONS_FLAG; + if (TimePassesIsEnabled) flags |= CompilerDriver::TIME_PASSES_FLAG; + CD->setDriverFlags(flags); + + // Specify requred parameters + CD->setFinalPhase(FinalPhase); + CD->setOptimization(OptLevel); + CD->setOutputMachine(OutputMachine); + CD->setLibraryPaths(LibPaths); + + // Provide additional tool arguments if (!PreprocessorToolOpts.empty()) - CD.setPhaseArgs(CompilerDriver::PREPROCESSING, PreprocessorToolOpts); + CD->setPhaseArgs(CompilerDriver::PREPROCESSING, PreprocessorToolOpts); if (!TranslatorToolOpts.empty()) - CD.setPhaseArgs(CompilerDriver::TRANSLATION, TranslatorToolOpts); + CD->setPhaseArgs(CompilerDriver::TRANSLATION, TranslatorToolOpts); if (!OptimizerToolOpts.empty()) - CD.setPhaseArgs(CompilerDriver::OPTIMIZATION, OptimizerToolOpts); + CD->setPhaseArgs(CompilerDriver::OPTIMIZATION, OptimizerToolOpts); if (!AssemblerToolOpts.empty()) - CD.setPhaseArgs(CompilerDriver::ASSEMBLY,AssemblerToolOpts); + CD->setPhaseArgs(CompilerDriver::ASSEMBLY,AssemblerToolOpts); if (!LinkerToolOpts.empty()) - CD.setPhaseArgs(CompilerDriver::LINKING, LinkerToolOpts); + CD->setPhaseArgs(CompilerDriver::LINKING, LinkerToolOpts); // Prepare the list of files to be compiled by the CompilerDriver. CompilerDriver::InputList InpList; @@ -288,7 +298,7 @@ } // Tell the driver to do its thing - int result = CD.execute(InpList,OutputFilename); + int result = CD->execute(InpList,sys::Path(OutputFilename)); if (result != 0) { throw "Error executing actions. Terminated.\n"; return result; Index: llvm/tools/llvmc/st diff -u llvm/tools/llvmc/st:1.5 llvm/tools/llvmc/st:1.6 --- llvm/tools/llvmc/st:1.5 Tue Aug 24 09:24:14 2004 +++ llvm/tools/llvmc/st Sun Aug 29 14:26:56 2004 @@ -34,7 +34,7 @@ # To compile stacker source, we just run the stacker # compiler with a default stack size of 2048 entries. translator.command=stkrc -s 2048 %in% -o %out% %time% \ - %stats% %args% + %stats% %force% %args% # stkrc doesn't preprocess but we set this to true so # that we don't run the cp command by default. @@ -52,7 +52,7 @@ # For optimization, we use the LLVM "opt" program optimizer.command=opt %in% -o %out% %opt% %time% %stats% \ - %args% + %force% %args% optimizer.required = true From reid at x10sys.com Sun Aug 29 14:27:45 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:27:45 -0500 Subject: [llvm-commits] CVS: llvm/tools/Makefile Message-ID: <200408291927.OAA25922@zion.cs.uiuc.edu> Changes in directory llvm/tools: Makefile updated: 1.30 -> 1.31 --- Log message: add llvmc --- Diffs of the changes: (+3 -3) Index: llvm/tools/Makefile diff -u llvm/tools/Makefile:1.30 llvm/tools/Makefile:1.31 --- llvm/tools/Makefile:1.30 Fri Jul 2 00:59:20 2004 +++ llvm/tools/Makefile Sun Aug 29 14:27:34 2004 @@ -8,9 +8,9 @@ ##===----------------------------------------------------------------------===## LEVEL := .. -PARALLEL_DIRS := llvm-as llvm-dis opt gccas llc llvm-link lli gccld llvm-stub \ - analyze extract bugpoint llvm-nm llvm-prof llvm-db llvm-ar \ - llvm-bcanalyzer +PARALLEL_DIRS := llvmc llvm-as llvm-dis opt gccas llc llvm-link lli gccld \ + llvm-stub analyze extract bugpoint llvm-nm llvm-prof llvm-db \ + llvm-ar llvm-bcanalyzer include $(LEVEL)/Makefile.common From reid at x10sys.com Sun Aug 29 14:29:07 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:29:07 -0500 Subject: [llvm-commits] CVS: llvm/tools/llc/llc.cpp Message-ID: <200408291929.OAA26024@zion.cs.uiuc.edu> Changes in directory llvm/tools/llc: llc.cpp updated: 1.100 -> 1.101 --- Log message: The functions in Signal.h are now in the llvm::sys namespace - adjust --- Diffs of the changes: (+3 -3) Index: llvm/tools/llc/llc.cpp diff -u llvm/tools/llc/llc.cpp:1.100 llvm/tools/llc/llc.cpp:1.101 --- llvm/tools/llc/llc.cpp:1.100 Mon Jul 12 17:58:07 2004 +++ llvm/tools/llc/llc.cpp Sun Aug 29 14:28:55 2004 @@ -64,7 +64,7 @@ // int main(int argc, char **argv) { cl::ParseCommandLineOptions(argc, argv, " llvm system compiler\n"); - PrintStackTraceOnErrorSignal(); + sys::PrintStackTraceOnErrorSignal(); // Load the module to be compiled... std::auto_ptr M(ParseBytecodeFile(InputFilename)); @@ -115,7 +115,7 @@ // Make sure that the Out file gets unlinked from the disk if we get a // SIGINT - RemoveFileOnSignal(OutputFilename); + sys::RemoveFileOnSignal(OutputFilename); } else { Out = &std::cout; } @@ -148,7 +148,7 @@ // Make sure that the Out file gets unlinked from the disk if we get a // SIGINT - RemoveFileOnSignal(OutputFilename); + sys::RemoveFileOnSignal(OutputFilename); } } From reid at x10sys.com Sun Aug 29 14:29:07 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:29:07 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvm-dis/llvm-dis.cpp Message-ID: <200408291929.OAA26023@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-dis: llvm-dis.cpp updated: 1.44 -> 1.45 --- Log message: The functions in Signal.h are now in the llvm::sys namespace - adjust --- Diffs of the changes: (+2 -2) Index: llvm/tools/llvm-dis/llvm-dis.cpp diff -u llvm/tools/llvm-dis/llvm-dis.cpp:1.44 llvm/tools/llvm-dis/llvm-dis.cpp:1.45 --- llvm/tools/llvm-dis/llvm-dis.cpp:1.44 Mon Jun 7 13:10:01 2004 +++ llvm/tools/llvm-dis/llvm-dis.cpp Sun Aug 29 14:28:55 2004 @@ -42,7 +42,7 @@ int main(int argc, char **argv) { cl::ParseCommandLineOptions(argc, argv, " llvm .bc -> .ll disassembler\n"); - PrintStackTraceOnErrorSignal(); + sys::PrintStackTraceOnErrorSignal(); std::ostream *Out = &std::cout; // Default to printing to stdout... std::string ErrorMessage; @@ -95,7 +95,7 @@ // Make sure that the Out file gets unlinked from the disk if we get a // SIGINT - RemoveFileOnSignal(OutputFilename); + sys::RemoveFileOnSignal(OutputFilename); } } } From reid at x10sys.com Sun Aug 29 14:29:07 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:29:07 -0500 Subject: [llvm-commits] CVS: llvm/tools/gccas/gccas.cpp Message-ID: <200408291929.OAA26026@zion.cs.uiuc.edu> Changes in directory llvm/tools/gccas: gccas.cpp updated: 1.98 -> 1.99 --- Log message: The functions in Signal.h are now in the llvm::sys namespace - adjust --- Diffs of the changes: (+2 -2) Index: llvm/tools/gccas/gccas.cpp diff -u llvm/tools/gccas/gccas.cpp:1.98 llvm/tools/gccas/gccas.cpp:1.99 --- llvm/tools/gccas/gccas.cpp:1.98 Thu Jul 22 03:34:33 2004 +++ llvm/tools/gccas/gccas.cpp Sun Aug 29 14:28:55 2004 @@ -117,7 +117,7 @@ int main(int argc, char **argv) { cl::ParseCommandLineOptions(argc, argv, " llvm .s -> .o assembler for GCC\n"); - PrintStackTraceOnErrorSignal(); + sys::PrintStackTraceOnErrorSignal(); std::auto_ptr M; try { @@ -156,7 +156,7 @@ // Make sure that the Out file gets unlinked from the disk if we get a // signal - RemoveFileOnSignal(OutputFilename); + sys::RemoveFileOnSignal(OutputFilename); } From reid at x10sys.com Sun Aug 29 14:29:07 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:29:07 -0500 Subject: [llvm-commits] CVS: llvm/tools/bugpoint/bugpoint.cpp Message-ID: <200408291929.OAA26029@zion.cs.uiuc.edu> Changes in directory llvm/tools/bugpoint: bugpoint.cpp updated: 1.18 -> 1.19 --- Log message: The functions in Signal.h are now in the llvm::sys namespace - adjust --- Diffs of the changes: (+1 -1) Index: llvm/tools/bugpoint/bugpoint.cpp diff -u llvm/tools/bugpoint/bugpoint.cpp:1.18 llvm/tools/bugpoint/bugpoint.cpp:1.19 --- llvm/tools/bugpoint/bugpoint.cpp:1.18 Thu Jul 22 20:30:49 2004 +++ llvm/tools/bugpoint/bugpoint.cpp Sun Aug 29 14:28:55 2004 @@ -38,7 +38,7 @@ " LLVM automatic testcase reducer. See\nhttp://" "llvm.cs.uiuc.edu/docs/CommandGuide/bugpoint.html" " for more information.\n"); - PrintStackTraceOnErrorSignal(); + sys::PrintStackTraceOnErrorSignal(); BugDriver D(argv[0]); if (D.addSources(InputFilenames)) return 1; From reid at x10sys.com Sun Aug 29 14:29:07 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:29:07 -0500 Subject: [llvm-commits] CVS: llvm/tools/lli/lli.cpp Message-ID: <200408291929.OAA26027@zion.cs.uiuc.edu> Changes in directory llvm/tools/lli: lli.cpp updated: 1.45 -> 1.46 --- Log message: The functions in Signal.h are now in the llvm::sys namespace - adjust --- Diffs of the changes: (+1 -1) Index: llvm/tools/lli/lli.cpp diff -u llvm/tools/lli/lli.cpp:1.45 llvm/tools/lli/lli.cpp:1.46 --- llvm/tools/lli/lli.cpp:1.45 Sat Jul 10 20:06:59 2004 +++ llvm/tools/lli/lli.cpp Sun Aug 29 14:28:55 2004 @@ -49,7 +49,7 @@ int main(int argc, char **argv, char * const *envp) { cl::ParseCommandLineOptions(argc, argv, " llvm interpreter & dynamic compiler\n"); - PrintStackTraceOnErrorSignal(); + sys::PrintStackTraceOnErrorSignal(); // Load the bytecode... std::string ErrorMsg; From reid at x10sys.com Sun Aug 29 14:29:08 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:29:08 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvm-nm/llvm-nm.cpp Message-ID: <200408291929.OAA26035@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-nm: llvm-nm.cpp updated: 1.16 -> 1.17 --- Log message: The functions in Signal.h are now in the llvm::sys namespace - adjust --- Diffs of the changes: (+1 -1) Index: llvm/tools/llvm-nm/llvm-nm.cpp diff -u llvm/tools/llvm-nm/llvm-nm.cpp:1.16 llvm/tools/llvm-nm/llvm-nm.cpp:1.17 --- llvm/tools/llvm-nm/llvm-nm.cpp:1.16 Thu Jul 15 19:08:28 2004 +++ llvm/tools/llvm-nm/llvm-nm.cpp Sun Aug 29 14:28:55 2004 @@ -150,7 +150,7 @@ int main(int argc, char **argv) { cl::ParseCommandLineOptions(argc, argv, " llvm symbol table dumper\n"); - PrintStackTraceOnErrorSignal(); + sys::PrintStackTraceOnErrorSignal(); ToolName = argv[0]; if (BSDFormat) OutputFormat = bsd; From reid at x10sys.com Sun Aug 29 14:29:08 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:29:08 -0500 Subject: [llvm-commits] CVS: llvm/tools/analyze/analyze.cpp Message-ID: <200408291929.OAA26034@zion.cs.uiuc.edu> Changes in directory llvm/tools/analyze: analyze.cpp updated: 1.59 -> 1.60 --- Log message: The functions in Signal.h are now in the llvm::sys namespace - adjust --- Diffs of the changes: (+1 -1) Index: llvm/tools/analyze/analyze.cpp diff -u llvm/tools/analyze/analyze.cpp:1.59 llvm/tools/analyze/analyze.cpp:1.60 --- llvm/tools/analyze/analyze.cpp:1.59 Sat Jul 10 20:05:48 2004 +++ llvm/tools/analyze/analyze.cpp Sun Aug 29 14:28:55 2004 @@ -117,7 +117,7 @@ int main(int argc, char **argv) { cl::ParseCommandLineOptions(argc, argv, " llvm analysis printer tool\n"); - PrintStackTraceOnErrorSignal(); + sys::PrintStackTraceOnErrorSignal(); Module *CurMod = 0; try { From reid at x10sys.com Sun Aug 29 14:29:07 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:29:07 -0500 Subject: [llvm-commits] CVS: llvm/tools/extract/extract.cpp Message-ID: <200408291929.OAA26025@zion.cs.uiuc.edu> Changes in directory llvm/tools/extract: extract.cpp updated: 1.23 -> 1.24 --- Log message: The functions in Signal.h are now in the llvm::sys namespace - adjust --- Diffs of the changes: (+1 -1) Index: llvm/tools/extract/extract.cpp diff -u llvm/tools/extract/extract.cpp:1.23 llvm/tools/extract/extract.cpp:1.24 --- llvm/tools/extract/extract.cpp:1.23 Thu May 27 00:39:58 2004 +++ llvm/tools/extract/extract.cpp Sun Aug 29 14:28:55 2004 @@ -46,7 +46,7 @@ int main(int argc, char **argv) { cl::ParseCommandLineOptions(argc, argv, " llvm extractor\n"); - PrintStackTraceOnErrorSignal(); + sys::PrintStackTraceOnErrorSignal(); std::auto_ptr M(ParseBytecodeFile(InputFilename)); if (M.get() == 0) { From reid at x10sys.com Sun Aug 29 14:29:07 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:29:07 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvm-db/llvm-db.cpp Message-ID: <200408291929.OAA26030@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-db: llvm-db.cpp updated: 1.4 -> 1.5 --- Log message: The functions in Signal.h are now in the llvm::sys namespace - adjust --- Diffs of the changes: (+1 -1) Index: llvm/tools/llvm-db/llvm-db.cpp diff -u llvm/tools/llvm-db/llvm-db.cpp:1.4 llvm/tools/llvm-db/llvm-db.cpp:1.5 --- llvm/tools/llvm-db/llvm-db.cpp:1.4 Sat Jul 10 20:08:19 2004 +++ llvm/tools/llvm-db/llvm-db.cpp Sun Aug 29 14:28:55 2004 @@ -53,7 +53,7 @@ int main(int argc, char **argv, char * const *envp) { cl::ParseCommandLineOptions(argc, argv, " llvm source-level debugger\n"); - PrintStackTraceOnErrorSignal(); + sys::PrintStackTraceOnErrorSignal(); if (Version || !Quiet) { std::cout << "llvm-db: The LLVM source-level debugger\n"; From reid at x10sys.com Sun Aug 29 14:29:08 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:29:08 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvm-link/llvm-link.cpp Message-ID: <200408291929.OAA26032@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-link: llvm-link.cpp updated: 1.38 -> 1.39 --- Log message: The functions in Signal.h are now in the llvm::sys namespace - adjust --- Diffs of the changes: (+2 -2) Index: llvm/tools/llvm-link/llvm-link.cpp diff -u llvm/tools/llvm-link/llvm-link.cpp:1.38 llvm/tools/llvm-link/llvm-link.cpp:1.39 --- llvm/tools/llvm-link/llvm-link.cpp:1.38 Sun Jul 4 07:20:55 2004 +++ llvm/tools/llvm-link/llvm-link.cpp Sun Aug 29 14:28:55 2004 @@ -85,7 +85,7 @@ int main(int argc, char **argv) { cl::ParseCommandLineOptions(argc, argv, " llvm linker\n"); - PrintStackTraceOnErrorSignal(); + sys::PrintStackTraceOnErrorSignal(); assert(InputFilenames.size() > 0 && "OneOrMore is not working"); unsigned BaseArg = 0; @@ -126,7 +126,7 @@ // Make sure that the Out file gets unlinked from the disk if we get a // SIGINT - RemoveFileOnSignal(OutputFilename); + sys::RemoveFileOnSignal(OutputFilename); } if (verifyModule(*Composite.get())) { From reid at x10sys.com Sun Aug 29 14:29:08 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:29:08 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp Message-ID: <200408291929.OAA26036@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-bcanalyzer: llvm-bcanalyzer.cpp updated: 1.2 -> 1.3 --- Log message: The functions in Signal.h are now in the llvm::sys namespace - adjust --- Diffs of the changes: (+1 -1) Index: llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp diff -u llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp:1.2 llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp:1.3 --- llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp:1.2 Sat Aug 21 16:00:24 2004 +++ llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp Sun Aug 29 14:28:55 2004 @@ -54,7 +54,7 @@ cl::ParseCommandLineOptions(argc, argv, " llvm-bcanalyzer Analysis of ByteCode Dumper\n"); - PrintStackTraceOnErrorSignal(); + sys::PrintStackTraceOnErrorSignal(); std::ostream* Out = &std::cout; // Default to printing to stdout... std::istream* In = &std::cin; // Default to reading stdin From reid at x10sys.com Sun Aug 29 14:29:08 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:29:08 -0500 Subject: [llvm-commits] CVS: llvm/tools/opt/opt.cpp Message-ID: <200408291929.OAA26037@zion.cs.uiuc.edu> Changes in directory llvm/tools/opt: opt.cpp updated: 1.95 -> 1.96 --- Log message: The functions in Signal.h are now in the llvm::sys namespace - adjust --- Diffs of the changes: (+2 -2) Index: llvm/tools/opt/opt.cpp diff -u llvm/tools/opt/opt.cpp:1.95 llvm/tools/opt/opt.cpp:1.96 --- llvm/tools/opt/opt.cpp:1.95 Sat Jul 10 23:05:32 2004 +++ llvm/tools/opt/opt.cpp Sun Aug 29 14:28:55 2004 @@ -72,7 +72,7 @@ int main(int argc, char **argv) { cl::ParseCommandLineOptions(argc, argv, " llvm .bc -> .bc modular optimizer\n"); - PrintStackTraceOnErrorSignal(); + sys::PrintStackTraceOnErrorSignal(); // Allocate a full target machine description only if necessary... // FIXME: The choice of target should be controllable on the command line. @@ -111,7 +111,7 @@ // Make sure that the Output file gets unlinked from the disk if we get a // SIGINT - RemoveFileOnSignal(OutputFilename); + sys::RemoveFileOnSignal(OutputFilename); } // If the output is set to be emitted to standard out, and standard out is a From reid at x10sys.com Sun Aug 29 14:29:08 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:29:08 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvm-as/llvm-as.cpp Message-ID: <200408291929.OAA26064@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-as: llvm-as.cpp updated: 1.32 -> 1.33 --- Log message: The functions in Signal.h are now in the llvm::sys namespace - adjust --- Diffs of the changes: (+2 -2) Index: llvm/tools/llvm-as/llvm-as.cpp diff -u llvm/tools/llvm-as/llvm-as.cpp:1.32 llvm/tools/llvm-as/llvm-as.cpp:1.33 --- llvm/tools/llvm-as/llvm-as.cpp:1.32 Tue Jul 13 03:48:04 2004 +++ llvm/tools/llvm-as/llvm-as.cpp Sun Aug 29 14:28:55 2004 @@ -46,7 +46,7 @@ int main(int argc, char **argv) { cl::ParseCommandLineOptions(argc, argv, " llvm .ll -> .bc assembler\n"); - PrintStackTraceOnErrorSignal(); + sys::PrintStackTraceOnErrorSignal(); std::ostream *Out = 0; try { @@ -110,7 +110,7 @@ std::ios_base::trunc | std::ios_base::binary); // Make sure that the Out file gets unlinked from the disk if we get a // SIGINT - RemoveFileOnSignal(OutputFilename); + sys::RemoveFileOnSignal(OutputFilename); } } From reid at x10sys.com Sun Aug 29 14:29:08 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:29:08 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvm-prof/llvm-prof.cpp Message-ID: <200408291929.OAA26033@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-prof: llvm-prof.cpp updated: 1.21 -> 1.22 --- Log message: The functions in Signal.h are now in the llvm::sys namespace - adjust --- Diffs of the changes: (+1 -1) Index: llvm/tools/llvm-prof/llvm-prof.cpp diff -u llvm/tools/llvm-prof/llvm-prof.cpp:1.21 llvm/tools/llvm-prof/llvm-prof.cpp:1.22 --- llvm/tools/llvm-prof/llvm-prof.cpp:1.21 Sun Jul 4 07:20:55 2004 +++ llvm/tools/llvm-prof/llvm-prof.cpp Sun Aug 29 14:28:55 2004 @@ -108,7 +108,7 @@ int main(int argc, char **argv) { cl::ParseCommandLineOptions(argc, argv, " llvm profile dump decoder\n"); - PrintStackTraceOnErrorSignal(); + sys::PrintStackTraceOnErrorSignal(); // Read in the bytecode file... std::string ErrorMessage; From reid at x10sys.com Sun Aug 29 14:29:08 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:29:08 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvm-ar/llvm-ar.cpp Message-ID: <200408291929.OAA26031@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-ar: llvm-ar.cpp updated: 1.13 -> 1.14 --- Log message: The functions in Signal.h are now in the llvm::sys namespace - adjust --- Diffs of the changes: (+1 -1) Index: llvm/tools/llvm-ar/llvm-ar.cpp diff -u llvm/tools/llvm-ar/llvm-ar.cpp:1.13 llvm/tools/llvm-ar/llvm-ar.cpp:1.14 --- llvm/tools/llvm-ar/llvm-ar.cpp:1.13 Sun Jul 4 07:20:55 2004 +++ llvm/tools/llvm-ar/llvm-ar.cpp Sun Aug 29 14:28:55 2004 @@ -547,7 +547,7 @@ int main(int argc, char **argv) { cl::ParseCommandLineOptions(argc, argv); - PrintStackTraceOnErrorSignal(); + sys::PrintStackTraceOnErrorSignal(); parseCL(); From reid at x10sys.com Sun Aug 29 14:29:07 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:29:07 -0500 Subject: [llvm-commits] CVS: llvm/tools/gccld/gccld.cpp Message-ID: <200408291929.OAA26028@zion.cs.uiuc.edu> Changes in directory llvm/tools/gccld: gccld.cpp updated: 1.76 -> 1.77 --- Log message: The functions in Signal.h are now in the llvm::sys namespace - adjust --- Diffs of the changes: (+6 -6) Index: llvm/tools/gccld/gccld.cpp diff -u llvm/tools/gccld/gccld.cpp:1.76 llvm/tools/gccld/gccld.cpp:1.77 --- llvm/tools/gccld/gccld.cpp:1.76 Wed Jun 23 12:32:09 2004 +++ llvm/tools/gccld/gccld.cpp Sun Aug 29 14:28:55 2004 @@ -155,7 +155,7 @@ int main(int argc, char **argv, char **envp) { cl::ParseCommandLineOptions(argc, argv, " llvm linker for GCC\n"); - PrintStackTraceOnErrorSignal(); + sys::PrintStackTraceOnErrorSignal(); std::string ModuleID("gccld-output"); std::auto_ptr Composite(new Module(ModuleID)); @@ -192,7 +192,7 @@ // Ensure that the bytecode file gets removed from the disk if we get a // SIGINT signal. - RemoveFileOnSignal(RealBytecodeOutput); + sys::RemoveFileOnSignal(RealBytecodeOutput); // Generate the bytecode file. if (GenerateBytecode(Composite.get(), Strip, !NoInternalize, &Out)) { @@ -215,8 +215,8 @@ std::string AssemblyFile = OutputFilename + ".s"; // Mark the output files for removal if we get an interrupt. - RemoveFileOnSignal(AssemblyFile); - RemoveFileOnSignal(OutputFilename); + sys::RemoveFileOnSignal(AssemblyFile); + sys::RemoveFileOnSignal(OutputFilename); // Determine the locations of the llc and gcc programs. std::string llc = FindExecutable("llc", argv[0]); @@ -240,8 +240,8 @@ std::string CFile = OutputFilename + ".cbe.c"; // Mark the output files for removal if we get an interrupt. - RemoveFileOnSignal(CFile); - RemoveFileOnSignal(OutputFilename); + sys::RemoveFileOnSignal(CFile); + sys::RemoveFileOnSignal(OutputFilename); // Determine the locations of the llc and gcc programs. std::string llc = FindExecutable("llc", argv[0]); From reid at x10sys.com Sun Aug 29 14:29:51 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:29:51 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvm-nm/Makefile Message-ID: <200408291929.OAA26159@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-nm: Makefile updated: 1.2 -> 1.3 --- Log message: Add the LLVMsystem.a library as it is now used for operating system independence of the tool. --- Diffs of the changes: (+1 -1) Index: llvm/tools/llvm-nm/Makefile diff -u llvm/tools/llvm-nm/Makefile:1.2 llvm/tools/llvm-nm/Makefile:1.3 --- llvm/tools/llvm-nm/Makefile:1.2 Mon Oct 20 17:27:27 2003 +++ llvm/tools/llvm-nm/Makefile Sun Aug 29 14:29:38 2004 @@ -9,5 +9,5 @@ LEVEL = ../.. TOOLNAME = llvm-nm -USEDLIBS = bcreader vmcore support.a +USEDLIBS = bcreader vmcore support.a LLVMsystem.a include $(LEVEL)/Makefile.common From reid at x10sys.com Sun Aug 29 14:29:51 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:29:51 -0500 Subject: [llvm-commits] CVS: llvm/tools/llc/Makefile Message-ID: <200408291929.OAA26162@zion.cs.uiuc.edu> Changes in directory llvm/tools/llc: Makefile updated: 1.57 -> 1.58 --- Log message: Add the LLVMsystem.a library as it is now used for operating system independence of the tool. --- Diffs of the changes: (+2 -1) Index: llvm/tools/llc/Makefile diff -u llvm/tools/llc/Makefile:1.57 llvm/tools/llc/Makefile:1.58 --- llvm/tools/llc/Makefile:1.57 Thu Aug 5 13:32:57 2004 +++ llvm/tools/llc/Makefile Sun Aug 29 14:29:38 2004 @@ -29,7 +29,8 @@ bcreader \ bcwriter \ vmcore \ - support.a + support.a \ + LLVMsystem.a TOOLLINKOPTS = $(PLATFORMLIBDL) include $(LEVEL)/Makefile.common From reid at x10sys.com Sun Aug 29 14:29:51 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:29:51 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvm-link/Makefile Message-ID: <200408291929.OAA26166@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-link: Makefile updated: 1.8 -> 1.9 --- Log message: Add the LLVMsystem.a library as it is now used for operating system independence of the tool. --- Diffs of the changes: (+1 -1) Index: llvm/tools/llvm-link/Makefile diff -u llvm/tools/llvm-link/Makefile:1.8 llvm/tools/llvm-link/Makefile:1.9 --- llvm/tools/llvm-link/Makefile:1.8 Wed Jun 23 12:36:17 2004 +++ llvm/tools/llvm-link/Makefile Sun Aug 29 14:29:38 2004 @@ -9,6 +9,6 @@ LEVEL = ../.. TOOLNAME = llvm-link -USEDLIBS = bcreader bcwriter vmcore support.a +USEDLIBS = bcreader bcwriter vmcore support.a LLVMsystem.a include $(LEVEL)/Makefile.common From reid at x10sys.com Sun Aug 29 14:29:50 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:29:50 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvm-db/Makefile Message-ID: <200408291929.OAA26158@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-db: Makefile updated: 1.3 -> 1.4 --- Log message: Add the LLVMsystem.a library as it is now used for operating system independence of the tool. --- Diffs of the changes: (+1 -1) Index: llvm/tools/llvm-db/Makefile diff -u llvm/tools/llvm-db/Makefile:1.3 llvm/tools/llvm-db/Makefile:1.4 --- llvm/tools/llvm-db/Makefile:1.3 Thu Aug 5 00:17:19 2004 +++ llvm/tools/llvm-db/Makefile Sun Aug 29 14:29:38 2004 @@ -48,7 +48,7 @@ endif USEDLIBS = lli-interpreter $(JITLIBS) $(ARCHLIBS) scalaropts analysis.a \ - transformutils.a debugger bcreader vmcore support target.a + transformutils.a debugger bcreader vmcore support target.a LLVMsystem.a # Have gcc tell the linker to export symbols from the program so that From reid at x10sys.com Sun Aug 29 14:29:51 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:29:51 -0500 Subject: [llvm-commits] CVS: llvm/tools/opt/Makefile Message-ID: <200408291929.OAA26167@zion.cs.uiuc.edu> Changes in directory llvm/tools/opt: Makefile updated: 1.45 -> 1.46 --- Log message: Add the LLVMsystem.a library as it is now used for operating system independence of the tool. --- Diffs of the changes: (+1 -1) Index: llvm/tools/opt/Makefile diff -u llvm/tools/opt/Makefile:1.45 llvm/tools/opt/Makefile:1.46 --- llvm/tools/opt/Makefile:1.45 Fri Jun 25 00:19:17 2004 +++ llvm/tools/opt/Makefile Sun Aug 29 14:29:38 2004 @@ -12,7 +12,7 @@ USEDLIBS = bcreader bcwriter \ instrument profpaths scalaropts \ ipo ipa datastructure transforms target.a analysis \ - transformutils vmcore support + transformutils vmcore support LLVMsystem.a TOOLLINKOPTS = $(PLATFORMLIBDL) include $(LEVEL)/Makefile.common From reid at x10sys.com Sun Aug 29 14:29:51 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:29:51 -0500 Subject: [llvm-commits] CVS: llvm/tools/gccas/Makefile Message-ID: <200408291929.OAA26161@zion.cs.uiuc.edu> Changes in directory llvm/tools/gccas: Makefile updated: 1.16 -> 1.17 --- Log message: Add the LLVMsystem.a library as it is now used for operating system independence of the tool. --- Diffs of the changes: (+1 -1) Index: llvm/tools/gccas/Makefile diff -u llvm/tools/gccas/Makefile:1.16 llvm/tools/gccas/Makefile:1.17 --- llvm/tools/gccas/Makefile:1.16 Mon Oct 20 17:27:26 2003 +++ llvm/tools/gccas/Makefile Sun Aug 29 14:29:38 2004 @@ -10,6 +10,6 @@ TOOLNAME = gccas USEDLIBS = asmparser bcwriter transforms ipo.a ipa.a scalaropts analysis.a \ - target.a transformutils vmcore support.a + target.a transformutils vmcore support.a LLVMsystem.a include $(LEVEL)/Makefile.common From reid at x10sys.com Sun Aug 29 14:29:51 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:29:51 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvm-as/Makefile Message-ID: <200408291929.OAA26160@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-as: Makefile updated: 1.12 -> 1.13 --- Log message: Add the LLVMsystem.a library as it is now used for operating system independence of the tool. --- Diffs of the changes: (+1 -1) Index: llvm/tools/llvm-as/Makefile diff -u llvm/tools/llvm-as/Makefile:1.12 llvm/tools/llvm-as/Makefile:1.13 --- llvm/tools/llvm-as/Makefile:1.12 Mon Oct 20 17:27:27 2003 +++ llvm/tools/llvm-as/Makefile Sun Aug 29 14:29:38 2004 @@ -8,6 +8,6 @@ ##===----------------------------------------------------------------------===## LEVEL = ../.. TOOLNAME = llvm-as -USEDLIBS = asmparser bcwriter vmcore support.a +USEDLIBS = asmparser bcwriter vmcore support.a LLVMsystem.a include $(LEVEL)/Makefile.common From reid at x10sys.com Sun Aug 29 14:29:51 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:29:51 -0500 Subject: [llvm-commits] CVS: llvm/tools/extract/Makefile Message-ID: <200408291929.OAA26170@zion.cs.uiuc.edu> Changes in directory llvm/tools/extract: Makefile updated: 1.4 -> 1.5 --- Log message: Add the LLVMsystem.a library as it is now used for operating system independence of the tool. --- Diffs of the changes: (+1 -1) Index: llvm/tools/extract/Makefile diff -u llvm/tools/extract/Makefile:1.4 llvm/tools/extract/Makefile:1.5 --- llvm/tools/extract/Makefile:1.4 Tue Oct 21 22:40:33 2003 +++ llvm/tools/extract/Makefile Sun Aug 29 14:29:38 2004 @@ -10,6 +10,6 @@ TOOLNAME = extract USEDLIBS = bcreader bcwriter transforms.a ipo.a target.a analysis.a \ - transformutils.a ipa.a vmcore support.a + transformutils.a ipa.a vmcore support.a LLVMsystem.a include $(LEVEL)/Makefile.common From reid at x10sys.com Sun Aug 29 14:29:51 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:29:51 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvm-prof/Makefile Message-ID: <200408291929.OAA26181@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-prof: Makefile updated: 1.2 -> 1.3 --- Log message: Add the LLVMsystem.a library as it is now used for operating system independence of the tool. --- Diffs of the changes: (+1 -1) Index: llvm/tools/llvm-prof/Makefile diff -u llvm/tools/llvm-prof/Makefile:1.2 llvm/tools/llvm-prof/Makefile:1.3 --- llvm/tools/llvm-prof/Makefile:1.2 Tue Feb 10 23:56:07 2004 +++ llvm/tools/llvm-prof/Makefile Sun Aug 29 14:29:38 2004 @@ -9,5 +9,5 @@ LEVEL = ../.. TOOLNAME = llvm-prof -USEDLIBS = analysis.a bcreader vmcore support.a +USEDLIBS = analysis.a bcreader vmcore support.a LLVMsystem.a include $(LEVEL)/Makefile.common From reid at x10sys.com Sun Aug 29 14:29:51 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:29:51 -0500 Subject: [llvm-commits] CVS: llvm/tools/lli/Makefile Message-ID: <200408291929.OAA26201@zion.cs.uiuc.edu> Changes in directory llvm/tools/lli: Makefile updated: 1.43 -> 1.44 --- Log message: Add the LLVMsystem.a library as it is now used for operating system independence of the tool. --- Diffs of the changes: (+1 -1) Index: llvm/tools/lli/Makefile diff -u llvm/tools/lli/Makefile:1.43 llvm/tools/lli/Makefile:1.44 --- llvm/tools/lli/Makefile:1.43 Wed Aug 4 02:39:21 2004 +++ llvm/tools/lli/Makefile Sun Aug 29 14:29:38 2004 @@ -47,7 +47,7 @@ endif USEDLIBS = lli-interpreter $(JITLIBS) $(ARCHLIBS) scalaropts analysis.a \ - transformutils.a bcreader vmcore support target.a + transformutils.a bcreader vmcore support target.a LLVMsystem.a # Have gcc tell the linker to export symbols from the program so that # dynamically loaded modules can be linked against them. From reid at x10sys.com Sun Aug 29 14:29:51 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:29:51 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvm-ar/Makefile Message-ID: <200408291929.OAA26165@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-ar: Makefile updated: 1.2 -> 1.3 --- Log message: Add the LLVMsystem.a library as it is now used for operating system independence of the tool. --- Diffs of the changes: (+1 -1) Index: llvm/tools/llvm-ar/Makefile diff -u llvm/tools/llvm-ar/Makefile:1.2 llvm/tools/llvm-ar/Makefile:1.3 --- llvm/tools/llvm-ar/Makefile:1.2 Mon Oct 20 17:27:26 2003 +++ llvm/tools/llvm-ar/Makefile Sun Aug 29 14:29:38 2004 @@ -9,6 +9,6 @@ LEVEL = ../.. TOOLNAME = llvm-ar -USEDLIBS = bcreader vmcore support.a +USEDLIBS = bcreader vmcore support.a LLVMsystem.a include $(LEVEL)/Makefile.common From reid at x10sys.com Sun Aug 29 14:29:51 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:29:51 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvm-dis/Makefile Message-ID: <200408291929.OAA26164@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-dis: Makefile updated: 1.14 -> 1.15 --- Log message: Add the LLVMsystem.a library as it is now used for operating system independence of the tool. --- Diffs of the changes: (+1 -1) Index: llvm/tools/llvm-dis/Makefile diff -u llvm/tools/llvm-dis/Makefile:1.14 llvm/tools/llvm-dis/Makefile:1.15 --- llvm/tools/llvm-dis/Makefile:1.14 Fri Feb 13 17:22:40 2004 +++ llvm/tools/llvm-dis/Makefile Sun Aug 29 14:29:38 2004 @@ -9,5 +9,5 @@ LEVEL = ../.. TOOLNAME = llvm-dis -USEDLIBS = bcreader vmcore support.a +USEDLIBS = bcreader vmcore support.a LLVMsystem.a include $(LEVEL)/Makefile.common From reid at x10sys.com Sun Aug 29 14:29:51 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:29:51 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvm-bcanalyzer/Makefile Message-ID: <200408291929.OAA26168@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-bcanalyzer: Makefile updated: 1.1 -> 1.2 --- Log message: Add the LLVMsystem.a library as it is now used for operating system independence of the tool. --- Diffs of the changes: (+1 -1) Index: llvm/tools/llvm-bcanalyzer/Makefile diff -u llvm/tools/llvm-bcanalyzer/Makefile:1.1 llvm/tools/llvm-bcanalyzer/Makefile:1.2 --- llvm/tools/llvm-bcanalyzer/Makefile:1.1 Thu Jul 1 22:22:53 2004 +++ llvm/tools/llvm-bcanalyzer/Makefile Sun Aug 29 14:29:38 2004 @@ -9,5 +9,5 @@ LEVEL = ../.. TOOLNAME = llvm-bcanalyzer -USEDLIBS = bcreader vmcore support.a +USEDLIBS = bcreader vmcore support.a LLVMsystem.a include $(LEVEL)/Makefile.common From reid at x10sys.com Sun Aug 29 14:29:51 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:29:51 -0500 Subject: [llvm-commits] CVS: llvm/tools/gccld/Makefile Message-ID: <200408291929.OAA26200@zion.cs.uiuc.edu> Changes in directory llvm/tools/gccld: Makefile updated: 1.7 -> 1.8 --- Log message: Add the LLVMsystem.a library as it is now used for operating system independence of the tool. --- Diffs of the changes: (+1 -1) Index: llvm/tools/gccld/Makefile diff -u llvm/tools/gccld/Makefile:1.7 llvm/tools/gccld/Makefile:1.8 --- llvm/tools/gccld/Makefile:1.7 Sun Nov 9 13:55:09 2003 +++ llvm/tools/gccld/Makefile Sun Aug 29 14:29:38 2004 @@ -11,6 +11,6 @@ TOOLNAME = gccld USEDLIBS = ipo.a transforms.a scalaropts.a analysis.a ipa.a transformutils.a \ - target.a bcreader bcwriter vmcore support.a + target.a bcreader bcwriter vmcore support.a LLVMsystem.a include $(LEVEL)/Makefile.common From reid at x10sys.com Sun Aug 29 14:29:51 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:29:51 -0500 Subject: [llvm-commits] CVS: llvm/tools/bugpoint/Makefile Message-ID: <200408291929.OAA26169@zion.cs.uiuc.edu> Changes in directory llvm/tools/bugpoint: Makefile updated: 1.5 -> 1.6 --- Log message: Add the LLVMsystem.a library as it is now used for operating system independence of the tool. --- Diffs of the changes: (+1 -1) Index: llvm/tools/bugpoint/Makefile diff -u llvm/tools/bugpoint/Makefile:1.5 llvm/tools/bugpoint/Makefile:1.6 --- llvm/tools/bugpoint/Makefile:1.5 Mon Oct 20 17:27:26 2003 +++ llvm/tools/bugpoint/Makefile Sun Aug 29 14:29:38 2004 @@ -14,7 +14,7 @@ ANALIBS = datastructure ipa target.a USEDLIBS = ipo scalaropts analysis $(OPTLIBS) $(ANALIBS) \ - transformutils asmparser bcreader bcwriter vmcore support + transformutils asmparser bcreader bcwriter vmcore support LLVMsystem.a TOOLLINKOPTS = $(PLATFORMLIBDL) From reid at x10sys.com Sun Aug 29 14:29:51 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:29:51 -0500 Subject: [llvm-commits] CVS: llvm/tools/analyze/Makefile Message-ID: <200408291929.OAA26163@zion.cs.uiuc.edu> Changes in directory llvm/tools/analyze: Makefile updated: 1.21 -> 1.22 --- Log message: Add the LLVMsystem.a library as it is now used for operating system independence of the tool. --- Diffs of the changes: (+1 -1) Index: llvm/tools/analyze/Makefile diff -u llvm/tools/analyze/Makefile:1.21 llvm/tools/analyze/Makefile:1.22 --- llvm/tools/analyze/Makefile:1.21 Fri Apr 2 14:32:46 2004 +++ llvm/tools/analyze/Makefile Sun Aug 29 14:29:38 2004 @@ -9,7 +9,7 @@ LEVEL = ../.. TOOLNAME = analyze USEDLIBS = asmparser bcreader analysis ipa datastructure scalaropts.a transforms.a \ - target.a scalaropts.a transformutils.a vmcore support + target.a scalaropts.a transformutils.a vmcore support LLVMsystem.a TOOLLINKOPTS = $(PLATFORMLIBDL) include $(LEVEL)/Makefile.common From reid at x10sys.com Sun Aug 29 14:31:30 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:31:30 -0500 Subject: [llvm-commits] CVS: llvm/utils/TableGen/Makefile Message-ID: <200408291931.OAA26254@zion.cs.uiuc.edu> Changes in directory llvm/utils/TableGen: Makefile updated: 1.11 -> 1.12 --- Log message: Link with LLVMsystem.a for operating system independence. --- Diffs of the changes: (+1 -1) Index: llvm/utils/TableGen/Makefile diff -u llvm/utils/TableGen/Makefile:1.11 llvm/utils/TableGen/Makefile:1.12 --- llvm/utils/TableGen/Makefile:1.11 Thu Jun 17 10:49:36 2004 +++ llvm/utils/TableGen/Makefile Sun Aug 29 14:31:19 2004 @@ -8,7 +8,7 @@ ##===----------------------------------------------------------------------===## LEVEL = ../.. TOOLNAME = tblgen -USEDLIBS = support.a +USEDLIBS = support.a LLVMsystem.a include $(LEVEL)/Makefile.common From criswell at cs.uiuc.edu Sun Aug 29 14:33:31 2004 From: criswell at cs.uiuc.edu (John Criswell) Date: Sun, 29 Aug 2004 14:33:31 -0500 Subject: [llvm-commits] CVS: llvm/Makefile Message-ID: <200408291933.OAA26287@zion.cs.uiuc.edu> Changes in directory llvm: Makefile updated: 1.28 -> 1.29 --- Log message: Add lib/System ahead of lib/Support in case there are operating system issues. --- Diffs of the changes: (+1 -1) Index: llvm/Makefile diff -u llvm/Makefile:1.28 llvm/Makefile:1.29 --- llvm/Makefile:1.28 Tue Aug 24 11:32:21 2004 +++ llvm/Makefile Sun Aug 29 14:33:21 2004 @@ -7,7 +7,7 @@ # #===------------------------------------------------------------------------===# LEVEL = . -DIRS = lib/Support utils lib tools +DIRS = lib/System lib/Support utils lib tools ifneq ($(MAKECMDGOALS),tools-only) DIRS += runtime From reid at x10sys.com Sun Aug 29 14:30:51 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:30:51 -0500 Subject: [llvm-commits] CVS: llvm/utils/TableGen/TableGen.cpp Message-ID: <200408291930.OAA26241@zion.cs.uiuc.edu> Changes in directory llvm/utils/TableGen: TableGen.cpp updated: 1.32 -> 1.33 --- Log message: RemoveFileOnErrorSignal is now in the llvm::sys namespace. Adjust accordingly. --- Diffs of the changes: (+1 -1) Index: llvm/utils/TableGen/TableGen.cpp diff -u llvm/utils/TableGen/TableGen.cpp:1.32 llvm/utils/TableGen/TableGen.cpp:1.33 --- llvm/utils/TableGen/TableGen.cpp:1.32 Sun Aug 1 00:59:33 2004 +++ llvm/utils/TableGen/TableGen.cpp Sun Aug 29 14:30:41 2004 @@ -426,7 +426,7 @@ } // Make sure the file gets removed if *gasp* tablegen crashes... - RemoveFileOnSignal(OutputFilename); + sys::RemoveFileOnSignal(OutputFilename); } try { From reid at x10sys.com Sun Aug 29 14:35:39 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:35:39 -0500 Subject: [llvm-commits] CVS: llvm/configure Message-ID: <200408291935.OAA26316@zion.cs.uiuc.edu> Changes in directory llvm: configure updated: 1.104 -> 1.105 --- Log message: Updated to create a link needed for correct lib/System compilation. --- Diffs of the changes: (+201 -43) Index: llvm/configure diff -u llvm/configure:1.104 llvm/configure:1.105 --- llvm/configure:1.104 Tue Aug 24 11:32:21 2004 +++ llvm/configure Sun Aug 29 14:35:28 2004 @@ -1893,38 +1893,53 @@ *-*-linux*) OS=Linux - if test -d /home/vadve/lattner/local/x86/llvm-gcc - then - LLVMGCCDIR=/home/vadve/lattner/local/x86/llvm-gcc/ + platform_type="Linux" + if test -d /home/vadve/lattner/local/x86/llvm-gcc + then + LLVMGCCDIR=/home/vadve/lattner/local/x86/llvm-gcc/ - fi - ;; + fi + ;; *-*-solaris*) OS=SunOS - if test -d /home/vadve/lattner/local/sparc/llvm-gcc - then - LLVMGCCDIR=/home/vadve/lattner/local/sparc/llvm-gcc/ + platform_type="SunOS" + if test -d /home/vadve/lattner/local/sparc/llvm-gcc + then + LLVMGCCDIR=/home/vadve/lattner/local/sparc/llvm-gcc/ - fi - ;; + fi + ;; *-*-cygwin*) OS=Cygwin - ;; + platform_type="Cygwin" + ;; *-*-darwin*) OS=Darwin - ;; + platform_type="Darwin" + ;; *-*-aix*) OS=AIX - ;; - *) OS=Unknown + platform_type="AIX" + ;; + *-*-win32*) + OS=Win32 - ;; + platform_type="Win32" + ;; + *) + OS=Unknown + + platform_type="Unknown" + ;; esac + ac_config_links="$ac_config_links lib/System/platform:lib/System/$platform_type" + + case $target in sparc*-*-solaris*) target=sparcv9-sun-solaris2.8 @@ -4222,7 +4237,7 @@ ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 4225 "configure"' > conftest.$ac_ext + echo '#line 4240 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -5096,7 +5111,7 @@ # Provide some information about the compiler. -echo "$as_me:5099:" \ +echo "$as_me:5114:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -6127,11 +6142,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6130: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6145: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6134: \$? = $ac_status" >&5 + echo "$as_me:6149: \$? = $ac_status" >&5 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 @@ -6359,11 +6374,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6362: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6377: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6366: \$? = $ac_status" >&5 + echo "$as_me:6381: \$? = $ac_status" >&5 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 @@ -6426,11 +6441,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6429: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6444: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:6433: \$? = $ac_status" >&5 + echo "$as_me:6448: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -8544,7 +8559,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:10816: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:10805: \$? = $ac_status" >&5 + echo "$as_me:10820: \$? = $ac_status" >&5 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 @@ -10865,11 +10880,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:10868: $lt_compile\"" >&5) + (eval echo "\"\$as_me:10883: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:10872: \$? = $ac_status" >&5 + echo "$as_me:10887: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -12194,7 +12209,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:13132: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13121: \$? = $ac_status" >&5 + echo "$as_me:13136: \$? = $ac_status" >&5 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 @@ -13181,11 +13196,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13184: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13199: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13188: \$? = $ac_status" >&5 + echo "$as_me:13203: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -15147,11 +15162,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15150: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15165: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15154: \$? = $ac_status" >&5 + echo "$as_me:15169: \$? = $ac_status" >&5 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 @@ -15379,11 +15394,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15382: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15397: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15386: \$? = $ac_status" >&5 + echo "$as_me:15401: \$? = $ac_status" >&5 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 @@ -15446,11 +15461,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15449: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15464: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:15453: \$? = $ac_status" >&5 + echo "$as_me:15468: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -17564,7 +17579,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <>$CONFIG_STATUS <<\_ACEOF # +# CONFIG_LINKS section. +# + +for ac_file in : $CONFIG_LINKS; do test "x$ac_file" = x: && continue + ac_dest=`echo "$ac_file" | sed 's,:.*,,'` + ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` + + { echo "$as_me:$LINENO: linking $srcdir/$ac_source to $ac_dest" >&5 +echo "$as_me: linking $srcdir/$ac_source to $ac_dest" >&6;} + + if test ! -r $srcdir/$ac_source; then + { { echo "$as_me:$LINENO: error: $srcdir/$ac_source: file not found" >&5 +echo "$as_me: error: $srcdir/$ac_source: file not found" >&2;} + { (exit 1); exit 1; }; } + fi + rm -f $ac_dest + + # Make relative symlinks. + ac_dest_dir=`(dirname "$ac_dest") 2>/dev/null || +$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_dest" : 'X\(//\)[^/]' \| \ + X"$ac_dest" : 'X\(//\)$' \| \ + X"$ac_dest" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_dest" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dest_dir" + else + as_dir="$ac_dest_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dest_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dest_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dest_dir" != .; then + ac_dir_suffix=/`echo "$ac_dest_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dest_dir";; +*) + case "$ac_dest_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dest_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dest_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + + case $srcdir in + [\\/$]* | ?:[\\/]* ) ac_rel_source=$srcdir/$ac_source ;; + *) ac_rel_source=$ac_top_builddir$srcdir/$ac_source ;; + esac + + # Try a symlink, then a hard link, then a copy. + ln -s $ac_rel_source $ac_dest 2>/dev/null || + ln $srcdir/$ac_source $ac_dest 2>/dev/null || + cp -p $srcdir/$ac_source $ac_dest || + { { echo "$as_me:$LINENO: error: cannot link or copy $srcdir/$ac_source to $ac_dest" >&5 +echo "$as_me: error: cannot link or copy $srcdir/$ac_source to $ac_dest" >&2;} + { (exit 1); exit 1; }; } +done +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + +# # CONFIG_COMMANDS section. # for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue From llvm at cs.uiuc.edu Sun Aug 29 14:36:45 2004 From: llvm at cs.uiuc.edu (LLVM) Date: Sun, 29 Aug 2004 14:36:45 -0500 Subject: [llvm-commits] CVS: llvm/lib/Support/Signals.cpp Message-ID: <200408291936.OAA26340@zion.cs.uiuc.edu> Changes in directory llvm/lib/Support: Signals.cpp (r1.19) removed --- Log message: Signals support has been moved to lib/System --- Diffs of the changes: (+0 -0) From reid at x10sys.com Sun Aug 29 14:38:10 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 14:38:10 -0500 Subject: [llvm-commits] CVS: llvm/lib/VMCore/AsmWriter.cpp Message-ID: <200408291938.OAA26362@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: AsmWriter.cpp updated: 1.156 -> 1.157 --- Log message: Add an assert to cature null Operands. It is better to catch it here than to SIGSEGV in the bowels of isa<...> later. --- Diffs of the changes: (+1 -0) Index: llvm/lib/VMCore/AsmWriter.cpp diff -u llvm/lib/VMCore/AsmWriter.cpp:1.156 llvm/lib/VMCore/AsmWriter.cpp:1.157 --- llvm/lib/VMCore/AsmWriter.cpp:1.156 Fri Aug 20 10:37:30 2004 +++ llvm/lib/VMCore/AsmWriter.cpp Sun Aug 29 14:37:59 2004 @@ -744,6 +744,7 @@ void AssemblyWriter::writeOperand(const Value *Operand, bool PrintType, bool PrintName) { + assert(Operand != 0 && "Illegal Operand"); if (PrintType) { Out << ' '; printType(Operand->getType()); } WriteAsOperandInternal(Out, Operand, PrintName, TypeNames, &Machine); } From reid at x10sys.com Sun Aug 29 15:02:38 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 15:02:38 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvmc/CompilerDriver.cpp Message-ID: <200408292002.PAA26690@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvmc: CompilerDriver.cpp updated: 1.11 -> 1.12 --- Log message: Add a missing header file --- Diffs of the changes: (+1 -0) Index: llvm/tools/llvmc/CompilerDriver.cpp diff -u llvm/tools/llvmc/CompilerDriver.cpp:1.11 llvm/tools/llvmc/CompilerDriver.cpp:1.12 --- llvm/tools/llvmc/CompilerDriver.cpp:1.11 Sun Aug 29 14:26:56 2004 +++ llvm/tools/llvmc/CompilerDriver.cpp Sun Aug 29 15:02:28 2004 @@ -16,6 +16,7 @@ #include "ConfigLexer.h" #include "llvm/Module.h" #include "llvm/Bytecode/Reader.h" +#include "llvm/System/Signals.h" #include "Support/FileUtilities.h" #include "Support/SetVector.h" #include "Support/StringExtras.h" From reid at x10sys.com Sun Aug 29 15:10:17 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 15:10:17 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Unix/Program.cpp Message-ID: <200408292010.PAA26877@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Unix: Program.cpp updated: 1.1 -> 1.2 --- Log message: Add a declaration of environ global for Darwin --- Diffs of the changes: (+2 -0) Index: llvm/lib/System/Unix/Program.cpp diff -u llvm/lib/System/Unix/Program.cpp:1.1 llvm/lib/System/Unix/Program.cpp:1.2 --- llvm/lib/System/Unix/Program.cpp:1.1 Sun Aug 29 14:20:41 2004 +++ llvm/lib/System/Unix/Program.cpp Sun Aug 29 15:10:07 2004 @@ -24,6 +24,8 @@ #include #endif +extern char** environ; + namespace llvm { using namespace sys; From natebegeman at mac.com Sun Aug 29 16:59:36 2004 From: natebegeman at mac.com (Nate Begeman) Date: Sun, 29 Aug 2004 16:59:36 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/MRegisterInfo.h Message-ID: <200408292159.QAA28647@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: MRegisterInfo.h updated: 1.50 -> 1.51 --- Log message: Update doxygen comment now that getSpillSize is supposed to return value in bits --- Diffs of the changes: (+2 -2) Index: llvm/include/llvm/Target/MRegisterInfo.h diff -u llvm/include/llvm/Target/MRegisterInfo.h:1.50 llvm/include/llvm/Target/MRegisterInfo.h:1.51 --- llvm/include/llvm/Target/MRegisterInfo.h:1.50 Thu Aug 26 17:21:04 2004 +++ llvm/include/llvm/Target/MRegisterInfo.h Sun Aug 29 16:59:26 2004 @@ -198,8 +198,8 @@ return get(RegNo).Name; } - /// getSpillSize - Return the size required of a stack slot used to spill - /// register into. + /// getSpillSize - Return the size in bits required of a stack slot used to + /// spill register into. unsigned getSpillSize(unsigned RegNo) const { return get(RegNo).SpillSize; } From natebegeman at mac.com Sun Aug 29 17:00:34 2004 From: natebegeman at mac.com (Nate Begeman) Date: Sun, 29 Aug 2004 17:00:34 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/PrologEpilogInserter.cpp Message-ID: <200408292200.RAA28695@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: PrologEpilogInserter.cpp updated: 1.36 -> 1.37 --- Log message: Put this change back in after testing from Reid proved its innocence. getSpillSize now returns value in bits --- Diffs of the changes: (+2 -2) Index: llvm/lib/CodeGen/PrologEpilogInserter.cpp diff -u llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.36 llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.37 --- llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.36 Fri Aug 27 11:48:24 2004 +++ llvm/lib/CodeGen/PrologEpilogInserter.cpp Sun Aug 29 17:00:24 2004 @@ -181,11 +181,11 @@ int FrameIdx; if (FixedSlot == FixedSpillSlots+NumFixedSpillSlots) { // Nope, just spill it anywhere convenient. - FrameIdx = FFI->CreateStackObject(RegInfo->getSpillSize(Reg), + FrameIdx = FFI->CreateStackObject(RegInfo->getSpillSize(Reg)/8, RegInfo->getSpillAlignment(Reg)/8); } else { // Spill it to the stack where we must. - FrameIdx = FFI->CreateFixedObject(RegInfo->getSpillSize(Reg), + FrameIdx = FFI->CreateFixedObject(RegInfo->getSpillSize(Reg)/8, FixedSlot->second); } StackSlots.push_back(FrameIdx); From natebegeman at mac.com Sun Aug 29 17:01:28 2004 From: natebegeman at mac.com (Nate Begeman) Date: Sun, 29 Aug 2004 17:01:28 -0500 Subject: [llvm-commits] CVS: llvm/projects/Stacker/tools/stkrc/stkrc.cpp Message-ID: <200408292201.RAA28717@zion.cs.uiuc.edu> Changes in directory llvm/projects/Stacker/tools/stkrc: stkrc.cpp updated: 1.4 -> 1.5 --- Log message: RemoveFileOnSignal is now in sys:: namespace --- Diffs of the changes: (+1 -1) Index: llvm/projects/Stacker/tools/stkrc/stkrc.cpp diff -u llvm/projects/Stacker/tools/stkrc/stkrc.cpp:1.4 llvm/projects/Stacker/tools/stkrc/stkrc.cpp:1.5 --- llvm/projects/Stacker/tools/stkrc/stkrc.cpp:1.4 Sat Jul 10 18:35:46 2004 +++ llvm/projects/Stacker/tools/stkrc/stkrc.cpp Sun Aug 29 17:01:17 2004 @@ -135,7 +135,7 @@ Out = new std::ofstream(OutputFilename.c_str()); // Make sure that the Out file gets unlinked from the disk if we get a // SIGINT - RemoveFileOnSignal(OutputFilename); + sys::RemoveFileOnSignal(OutputFilename); } } From natebegeman at mac.com Sun Aug 29 17:01:54 2004 From: natebegeman at mac.com (Nate Begeman) Date: Sun, 29 Aug 2004 17:01:54 -0500 Subject: [llvm-commits] CVS: llvm/projects/Stacker/tools/stkrc/Makefile Message-ID: <200408292201.RAA28728@zion.cs.uiuc.edu> Changes in directory llvm/projects/Stacker/tools/stkrc: Makefile updated: 1.1 -> 1.2 --- Log message: Must link against new LLVMsystem library --- Diffs of the changes: (+1 -1) Index: llvm/projects/Stacker/tools/stkrc/Makefile diff -u llvm/projects/Stacker/tools/stkrc/Makefile:1.1 llvm/projects/Stacker/tools/stkrc/Makefile:1.2 --- llvm/projects/Stacker/tools/stkrc/Makefile:1.1 Sun Nov 23 12:01:26 2003 +++ llvm/projects/Stacker/tools/stkrc/Makefile Sun Aug 29 17:01:44 2004 @@ -9,7 +9,7 @@ # Give the name of a library. This will build a dynamic version. # TOOLNAME=stkrc -USEDLIBS=stkr_compiler asmparser bcwriter vmcore support.a +USEDLIBS=stkr_compiler asmparser bcwriter vmcore support.a LLVMsystem.a ifdef PARSE_DEBUG CPPFLAGS = -DPARSE_DEBUG=1 From natebegeman at mac.com Sun Aug 29 17:02:53 2004 From: natebegeman at mac.com (Nate Begeman) Date: Sun, 29 Aug 2004 17:02:53 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPC64ISelSimple.cpp PowerPCInstrInfo.td README.txt Message-ID: <200408292202.RAA28759@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPC64ISelSimple.cpp updated: 1.11 -> 1.12 PowerPCInstrInfo.td updated: 1.28 -> 1.29 README.txt updated: 1.17 -> 1.18 --- Log message: Improvements to int->float cast code for PPC-64 --- Diffs of the changes: (+60 -61) Index: llvm/lib/Target/PowerPC/PPC64ISelSimple.cpp diff -u llvm/lib/Target/PowerPC/PPC64ISelSimple.cpp:1.11 llvm/lib/Target/PowerPC/PPC64ISelSimple.cpp:1.12 --- llvm/lib/Target/PowerPC/PPC64ISelSimple.cpp:1.11 Thu Aug 19 16:51:19 2004 +++ llvm/lib/Target/PowerPC/PPC64ISelSimple.cpp Sun Aug 29 17:02:43 2004 @@ -2315,68 +2315,60 @@ // Handle casts from integer to floating point now... if (DestClass == cFP32 || DestClass == cFP64) { - // Emit a library call for long to float conversion - if (SrcClass == cLong) { - std::vector Args; - Args.push_back(ValueRecord(SrcReg, SrcTy)); - Function *floatFn = (DestClass == cFP32) ? __floatdisfFn : __floatdidfFn; - MachineInstr *TheCall = - BuildMI(PPC::CALLpcrel, 1).addGlobalAddress(floatFn, true); - doCall(ValueRecord(DestReg, DestTy), TheCall, Args, false); - return; - } - - // Make sure we're dealing with a full 32 bits - unsigned TmpReg = makeAnotherReg(Type::IntTy); - promote32(TmpReg, ValueRecord(SrcReg, SrcTy)); - - SrcReg = TmpReg; - // Spill the integer to memory and reload it from there. - // Also spill room for a special conversion constant - int ConstantFrameIndex = - F->getFrameInfo()->CreateStackObject(Type::DoubleTy, TM.getTargetData()); + unsigned TmpReg = makeAnotherReg(Type::DoubleTy); int ValueFrameIdx = F->getFrameInfo()->CreateStackObject(Type::DoubleTy, TM.getTargetData()); - unsigned constantHi = makeAnotherReg(Type::IntTy); - unsigned constantLo = makeAnotherReg(Type::IntTy); - unsigned ConstF = makeAnotherReg(Type::DoubleTy); - unsigned TempF = makeAnotherReg(Type::DoubleTy); - - if (!SrcTy->isSigned()) { - BuildMI(*BB, IP, PPC::LIS, 1, constantHi).addSImm(0x4330); - BuildMI(*BB, IP, PPC::LI, 1, constantLo).addSImm(0); - addFrameReference(BuildMI(*BB, IP, PPC::STW, 3).addReg(constantHi), - ConstantFrameIndex); - addFrameReference(BuildMI(*BB, IP, PPC::STW, 3).addReg(constantLo), - ConstantFrameIndex, 4); - addFrameReference(BuildMI(*BB, IP, PPC::STW, 3).addReg(constantHi), - ValueFrameIdx); - addFrameReference(BuildMI(*BB, IP, PPC::STW, 3).addReg(SrcReg), - ValueFrameIdx, 4); - addFrameReference(BuildMI(*BB, IP, PPC::LFD, 2, ConstF), - ConstantFrameIndex); - addFrameReference(BuildMI(*BB, IP, PPC::LFD, 2, TempF), ValueFrameIdx); - BuildMI(*BB, IP, PPC::FSUB, 2, DestReg).addReg(TempF).addReg(ConstF); - } else { - unsigned TempLo = makeAnotherReg(Type::IntTy); - BuildMI(*BB, IP, PPC::LIS, 1, constantHi).addSImm(0x4330); - BuildMI(*BB, IP, PPC::LIS, 1, constantLo).addSImm(0x8000); - addFrameReference(BuildMI(*BB, IP, PPC::STW, 3).addReg(constantHi), - ConstantFrameIndex); - addFrameReference(BuildMI(*BB, IP, PPC::STW, 3).addReg(constantLo), - ConstantFrameIndex, 4); - addFrameReference(BuildMI(*BB, IP, PPC::STW, 3).addReg(constantHi), - ValueFrameIdx); - BuildMI(*BB, IP, PPC::XORIS, 2, TempLo).addReg(SrcReg).addImm(0x8000); - addFrameReference(BuildMI(*BB, IP, PPC::STW, 3).addReg(TempLo), - ValueFrameIdx, 4); - addFrameReference(BuildMI(*BB, IP, PPC::LFD, 2, ConstF), - ConstantFrameIndex); - addFrameReference(BuildMI(*BB, IP, PPC::LFD, 2, TempF), ValueFrameIdx); - BuildMI(*BB, IP, PPC::FSUB, 2, DestReg).addReg(TempF).addReg(ConstF); + if (SrcClass == cLong) { + if (SrcTy->isSigned()) { + addFrameReference(BuildMI(*MBB, IP, PPC::STD, 3).addReg(SrcReg), + ValueFrameIdx); + addFrameReference(BuildMI(*MBB, IP, PPC::LFD, 2, TmpReg), + ValueFrameIdx); + BuildMI(*MBB, IP, PPC::FCFID, 1, DestReg).addReg(TmpReg); + } else { + unsigned Scale = getReg(ConstantFP::get(Type::DoubleTy, 0x1p32)); + unsigned TmpHi = makeAnotherReg(Type::IntTy); + unsigned TmpLo = makeAnotherReg(Type::IntTy); + unsigned FPLow = makeAnotherReg(Type::DoubleTy); + unsigned FPTmpHi = makeAnotherReg(Type::DoubleTy); + unsigned FPTmpLo = makeAnotherReg(Type::DoubleTy); + int OtherFrameIdx = F->getFrameInfo()->CreateStackObject(Type::DoubleTy, + TM.getTargetData()); + BuildMI(*MBB, IP, PPC::RLDICL, 3, TmpHi).addReg(SrcReg).addImm(32) + .addImm(32); + BuildMI(*MBB, IP, PPC::RLDICL, 3, TmpLo).addReg(SrcReg).addImm(0) + .addImm(32); + addFrameReference(BuildMI(*MBB, IP, PPC::STD, 3).addReg(TmpHi), + ValueFrameIdx); + addFrameReference(BuildMI(*MBB, IP, PPC::STD, 3).addReg(TmpLo), + OtherFrameIdx); + addFrameReference(BuildMI(*MBB, IP, PPC::LFD, 2, TmpReg), + ValueFrameIdx); + addFrameReference(BuildMI(*MBB, IP, PPC::LFD, 2, FPLow), + OtherFrameIdx); + BuildMI(*MBB, IP, PPC::FCFID, 1, FPTmpHi).addReg(TmpReg); + BuildMI(*MBB, IP, PPC::FCFID, 1, FPTmpLo).addReg(FPLow); + BuildMI(*MBB, IP, PPC::FMADD, 3, DestReg).addReg(Scale).addReg(FPTmpHi) + .addReg(FPTmpLo); + } + return; } + + // FIXME: really want a promote64 + unsigned IntTmp = makeAnotherReg(Type::IntTy); + + if (SrcTy->isSigned()) + BuildMI(*MBB, IP, PPC::EXTSW, 1, IntTmp).addReg(SrcReg); + else + BuildMI(*MBB, IP, PPC::RLDICL, 3, IntTmp).addReg(SrcReg).addImm(0) + .addImm(32); + addFrameReference(BuildMI(*MBB, IP, PPC::STD, 3).addReg(IntTmp), + ValueFrameIdx); + addFrameReference(BuildMI(*MBB, IP, PPC::LFD, 2, TmpReg), + ValueFrameIdx); + BuildMI(*MBB, IP, PPC::FCFID, 1, DestReg).addReg(TmpReg); return; } Index: llvm/lib/Target/PowerPC/PowerPCInstrInfo.td diff -u llvm/lib/Target/PowerPC/PowerPCInstrInfo.td:1.28 llvm/lib/Target/PowerPC/PowerPCInstrInfo.td:1.29 --- llvm/lib/Target/PowerPC/PowerPCInstrInfo.td:1.28 Sun Aug 29 03:19:32 2004 +++ llvm/lib/Target/PowerPC/PowerPCInstrInfo.td Sun Aug 29 17:02:43 2004 @@ -104,6 +104,7 @@ def FADDS : AForm_2<"fadds", 59, 21, 0, 0, 0>; def FSUB : AForm_2<"fsub", 63, 20, 0, 0, 0>; def FSUBS : AForm_2<"fsubs", 59, 20, 0, 0, 0>; +def FMADD : AForm_2<"fmul", 63, 29, 0, 0, 0>; def FMUL : AForm_3<"fmul", 63, 25, 0, 0, 0>; def FMULS : AForm_3<"fmuls", 59, 25, 0, 0, 0>; def FDIV : AForm_2<"fdiv", 63, 18, 0, 0, 0>; @@ -232,18 +233,24 @@ "extsb $rA, $rS">; def EXTSH : XForm_11<31, 922, 0, 0, 0, (ops GPRC:$rA, GPRC:$rS), "extsh $rA, $rS">; +def EXTSW : XForm_11<31, 986, 0, 1, 0, (ops GPRC:$rA, GPRC:$rS), + "extsw $rA, $rS">; def LFSX : XForm_25<31, 535, 0, 0, (ops FPRC:$dst, GPRC:$base, GPRC:$index), "lfsx $dst, $base, $index">; def LFDX : XForm_25<31, 599, 0, 0, (ops FPRC:$dst, GPRC:$base, GPRC:$index), "lfdx $dst, $base, $index">; +def FCFID : XForm_26<63, 846, 0, 1, 0, (ops FPRC:$frD, FPRC:$frB), + "fcfid $frD, $frB">; +def FCTIDZ : XForm_26<63, 815, 0, 1, 0, (ops FPRC:$frD, FPRC:$frB), + "fctidz $frD, $frB">; +def FCTIWZ : XForm_26<63, 15, 0, 0, 0, (ops FPRC:$frD, FPRC:$frB), + "fctiwz $frD, $frB">; def FMR : XForm_26<63, 72, 0, 0, 0, (ops FPRC:$frD, FPRC:$frB), "fmr $frD, $frB">; def FNEG : XForm_26<63, 80, 0, 0, 0, (ops FPRC:$frD, FPRC:$frB), "fneg $frD, $frB">; def FRSP : XForm_26<63, 12, 0, 0, 0, (ops FPRC:$frD, FPRC:$frB), "frsp $frD, $frB">; -def FCTIWZ : XForm_26<63, 15, 0, 0, 0, (ops FPRC:$frD, FPRC:$frB), - "fctiwz $frD, $frB">; def STFSX : XForm_28<31, 663, 0, 0, (ops FPRC:$frS, GPRC:$rA, GPRC:$rB), "stfsx $frS, $rA, $rB">; def STFDX : XForm_28<31, 727, 0, 0, (ops FPRC:$frS, GPRC:$rA, GPRC:$rB), Index: llvm/lib/Target/PowerPC/README.txt diff -u llvm/lib/Target/PowerPC/README.txt:1.17 llvm/lib/Target/PowerPC/README.txt:1.18 --- llvm/lib/Target/PowerPC/README.txt:1.17 Sun Aug 29 03:19:32 2004 +++ llvm/lib/Target/PowerPC/README.txt Sun Aug 29 17:02:43 2004 @@ -1,10 +1,10 @@ TODO: * switch to auto-generated asm writer -* use stfiwx in float->int +* fix rlwimi generation to be use-and-def * implement scheduling info * implement powerpc-64 for darwin * implement powerpc-64 for aix -* fix rlwimi generation to be use-and-def +* use stfiwx in float->int * should hint to the branch select pass that it doesn't need to print the second unconditional branch, so we don't end up with things like: b .LBBl42__2E_expand_function_8_674 ; loopentry.24 From natebegeman at mac.com Sun Aug 29 17:03:51 2004 From: natebegeman at mac.com (Nate Begeman) Date: Sun, 29 Aug 2004 17:03:51 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/Skeleton/SkeletonRegisterInfo.td Message-ID: <200408292203.RAA28783@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/Skeleton: SkeletonRegisterInfo.td updated: 1.1 -> 1.2 --- Log message: Register sizes should be specified in bits --- Diffs of the changes: (+2 -2) Index: llvm/lib/Target/Skeleton/SkeletonRegisterInfo.td diff -u llvm/lib/Target/Skeleton/SkeletonRegisterInfo.td:1.1 llvm/lib/Target/Skeleton/SkeletonRegisterInfo.td:1.2 --- llvm/lib/Target/Skeleton/SkeletonRegisterInfo.td:1.1 Fri Jul 16 01:29:19 2004 +++ llvm/lib/Target/Skeleton/SkeletonRegisterInfo.td Sun Aug 29 17:03:40 2004 @@ -77,10 +77,10 @@ /// Register classes: one for floats and another for non-floats. /// -def GPRC : RegisterClass; -def FPRC : RegisterClass; From natebegeman at mac.com Sun Aug 29 17:45:23 2004 From: natebegeman at mac.com (Nate Begeman) Date: Sun, 29 Aug 2004 17:45:23 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PowerPCInstrFormats.td PowerPCInstrInfo.td Message-ID: <200408292245.RAA29278@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PowerPCInstrFormats.td updated: 1.15 -> 1.16 PowerPCInstrInfo.td updated: 1.29 -> 1.30 --- Log message: Convert A-Form instructions to auto-generated asm writer --- Diffs of the changes: (+62 -45) Index: llvm/lib/Target/PowerPC/PowerPCInstrFormats.td diff -u llvm/lib/Target/PowerPC/PowerPCInstrFormats.td:1.15 llvm/lib/Target/PowerPC/PowerPCInstrFormats.td:1.16 --- llvm/lib/Target/PowerPC/PowerPCInstrFormats.td:1.15 Sat Aug 21 00:56:39 2004 +++ llvm/lib/Target/PowerPC/PowerPCInstrFormats.td Sun Aug 29 17:45:13 2004 @@ -527,8 +527,8 @@ } // 1.7.12 A-Form -class AForm_1 opcode, bits<5> xo, bit rc, bit ppc64, - bit vmx> : I { +class AForm_1 opcode, bits<5> xo, bit rc, bit ppc64, + bit vmx, dag OL, string asmstr> : I<"", opcode, ppc64, vmx> { let ArgCount = 4; field bits<5> FRT; field bits<5> FRA; @@ -547,31 +547,26 @@ let Inst{21-25} = FRC; let Inst{26-30} = xo; let Inst{31} = rc; + let OperandList = OL; + let AsmString = asmstr; } -class AForm_2 opcode, bits<5> xo, bit rc, bit ppc64, - bit vmx> : AForm_1 { +class AForm_2 opcode, bits<5> xo, bit rc, bit ppc64, bit vmx, dag OL, + string asmstr> + : AForm_1 { let ArgCount = 3; let Arg3Type = 0; let FRC = 0; } -class AForm_3 opcode, bits<5> xo, bit rc, bit ppc64, - bit vmx> : AForm_1 { +class AForm_3 opcode, bits<5> xo, bit rc, bit ppc64, bit vmx, dag OL, + string asmstr> + : AForm_1 { let ArgCount = 3; let Arg3Type = 0; let FRB = 0; } -class AForm_4 opcode, bits<5> xo, bit rc, bit ppc64, - bit vmx> : AForm_1 { - let ArgCount = 2; - let Arg2Type = 0; - let Arg3Type = 0; - let FRA = 0; - let FRC = 0; -} - // 1.7.13 M-Form class MForm_1 opcode, bit rc, bit ppc64, bit vmx> : I { Index: llvm/lib/Target/PowerPC/PowerPCInstrInfo.td diff -u llvm/lib/Target/PowerPC/PowerPCInstrInfo.td:1.29 llvm/lib/Target/PowerPC/PowerPCInstrInfo.td:1.30 --- llvm/lib/Target/PowerPC/PowerPCInstrInfo.td:1.29 Sun Aug 29 17:02:43 2004 +++ llvm/lib/Target/PowerPC/PowerPCInstrInfo.td Sun Aug 29 17:45:13 2004 @@ -52,9 +52,6 @@ def ADDC : XOForm_1<"addc", 31, 10, 0, 0, 0, 0>; def ADDE : XOForm_1<"adde", 31, 138, 0, 0, 0, 0>; def ADDZE : XOForm_3<"addze", 31, 202, 0, 0, 0, 0>; -def ANDIo : DForm_4<28, 0, 0, - (ops GPRC:$dst, GPRC:$src1, u16imm:$src2), - "andi. $dst, $src1, $src2">; let isBranch = 1, isTerminator = 1 in { def COND_BRANCH : Pseudo<"COND_BRANCH">; @@ -86,30 +83,11 @@ def CMP : XForm_16<"cmp", 31, 0, 0, 0>; def CMPW : XForm_16_ext<"cmpw", 31, 0, 0, 0>; def CMPD : XForm_16_ext<"cmpd", 31, 0, 1, 0>; -def CMPLI : DForm_6<10, 0, 0, - (ops CRRC:$dst, i1imm:$size, GPRC:$src1, u16imm:$src2), - "cmpli $dst, $size, $src1, $src2">; -def CMPLWI : DForm_6_ext<10, 0, 0, - (ops CRRC:$dst, GPRC:$src1, u16imm:$src2), - "cmplwi $dst, $src1, $src2">; -def CMPLDI : DForm_6_ext<10, 1, 0, - (ops CRRC:$dst, GPRC:$src1, u16imm:$src2), - "cmpldi $dst, $src1, $src2">; def CMPL : XForm_16<"cmpl", 31, 32, 0, 0>; def CMPLW : XForm_16_ext<"cmplw", 31, 32, 0, 0>; def CMPLD : XForm_16_ext<"cmpld", 31, 32, 1, 0>; def DIVW : XOForm_1<"divw", 31, 491, 0, 0, 0, 0>; def DIVWU : XOForm_1<"divwu", 31, 459, 0, 0, 0, 0>; -def FADD : AForm_2<"fadd", 63, 21, 0, 0, 0>; -def FADDS : AForm_2<"fadds", 59, 21, 0, 0, 0>; -def FSUB : AForm_2<"fsub", 63, 20, 0, 0, 0>; -def FSUBS : AForm_2<"fsubs", 59, 20, 0, 0, 0>; -def FMADD : AForm_2<"fmul", 63, 29, 0, 0, 0>; -def FMUL : AForm_3<"fmul", 63, 25, 0, 0, 0>; -def FMULS : AForm_3<"fmuls", 59, 25, 0, 0, 0>; -def FDIV : AForm_2<"fdiv", 63, 18, 0, 0, 0>; -def FDIVS : AForm_2<"fdivs", 59, 18, 0, 0, 0>; -def FSEL : AForm_1<"fsel", 63, 23, 0, 0, 0>; def FCMPU : XForm_17<"fcmpu", 63, 0, 0, 0>; def LBZ : DForm_1<"lbz", 35, 0, 0>; def LHA : DForm_1<"lha", 42, 0, 0>; @@ -127,16 +105,11 @@ def MTLR : XFXForm_7_ext<"mtlr", 31, 467, 8, 0, 0>; def MTCTR : XFXForm_7_ext<"mtctr", 31, 467, 9, 0, 0>; def MULLD : XOForm_1<"mulld", 31, 233, 0, 0, 1, 0>; +def MULLI : DForm_2<"mulli", 7, 0, 0>; def MULLW : XOForm_1<"mullw", 31, 235, 0, 0, 0, 0>; def MULHWU : XOForm_2<"mulhwu", 31, 11, 0, 0, 0>; def NEG : XOForm_3<"neg", 31, 104, 0, 0, 0, 0>; def NOP : DForm_4_zero<"nop", 24, 0, 0, (ops), "nop">; -def ORI : DForm_4<24, 0, 0, - (ops GPRC:$dst, GPRC:$src1, u16imm:$src2), - "ori $dst, $src1, $src2">; -def ORIS : DForm_4<25, 0, 0, - (ops GPRC:$dst, GPRC:$src1, u16imm:$src2), - "oris $dst, $src1, $src2">; def RLDICL : MDForm_1<"rldicl", 30, 0, 0, 1, 0>; def RLDICR : MDForm_1<"rldicr", 30, 1, 0, 1, 0>; def RLWINM : MForm_2<"rlwinm", 21, 0, 0, 0>; @@ -161,14 +134,62 @@ def SUBFC : XOForm_1<"subfc", 31, 8, 0, 0, 0, 0>; def SUBFE : XOForm_1<"subfe", 31, 136, 0, 0, 0, 0>; def SUBFZE : XOForm_3<"subfze", 31, 200, 0, 0, 0, 0>; + +def FMADD : AForm_1<63, 29, 0, 0, 0, + (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRC, FPRC:$FRB), + "fmadd $FRT, $FRA, $FRC, $FRB">; +def FSEL : AForm_1<63, 23, 0, 0, 0, + (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRC, FPRC:$FRB), + "fsel $FRT, $FRA, $FRC, $FRB">; +def FADD : AForm_2<63, 21, 0, 0, 0, + (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRB), + "fadd $FRT, $FRA, $FRB">; +def FADDS : AForm_2<59, 21, 0, 0, 0, + (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRB), + "fadds $FRT, $FRA, $FRB">; +def FDIV : AForm_2<63, 18, 0, 0, 0, + (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRB), + "fdiv $FRT, $FRA, $FRB">; +def FDIVS : AForm_2<59, 18, 0, 0, 0, + (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRB), + "fdivs $FRT, $FRA, $FRB">; +def FMUL : AForm_3<63, 25, 0, 0, 0, + (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRB), + "fmul $FRT, $FRA, $FRB">; +def FMULS : AForm_3<59, 25, 0, 0, 0, + (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRB), + "fmuls $FRT, $FRA, $FRB">; +def FSUB : AForm_2<63, 20, 0, 0, 0, + (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRB), + "fsub $FRT, $FRA, $FRB">; +def FSUBS : AForm_2<59, 20, 0, 0, 0, + (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRB), + "fsubs $FRT, $FRA, $FRB">; + +def ANDIo : DForm_4<28, 0, 0, + (ops GPRC:$dst, GPRC:$src1, u16imm:$src2), + "andi. $dst, $src1, $src2">; +def ORI : DForm_4<24, 0, 0, + (ops GPRC:$dst, GPRC:$src1, u16imm:$src2), + "ori $dst, $src1, $src2">; +def ORIS : DForm_4<25, 0, 0, + (ops GPRC:$dst, GPRC:$src1, u16imm:$src2), + "oris $dst, $src1, $src2">; def XORI : DForm_4<26, 0, 0, (ops GPRC:$dst, GPRC:$src1, u16imm:$src2), "xori $dst, $src1, $src2">; def XORIS : DForm_4<27, 0, 0, (ops GPRC:$dst, GPRC:$src1, u16imm:$src2), "xoris $dst, $src1, $src2">; -def MULLI : DForm_2<"mulli", 7, 0, 0>; - +def CMPLI : DForm_6<10, 0, 0, + (ops CRRC:$dst, i1imm:$size, GPRC:$src1, u16imm:$src2), + "cmpli $dst, $size, $src1, $src2">; +def CMPLWI : DForm_6_ext<10, 0, 0, + (ops CRRC:$dst, GPRC:$src1, u16imm:$src2), + "cmplwi $dst, $src1, $src2">; +def CMPLDI : DForm_6_ext<10, 1, 0, + (ops CRRC:$dst, GPRC:$src1, u16imm:$src2), + "cmpldi $dst, $src1, $src2">; def LBZX : XForm_1<31, 87, 0, 0, (ops GPRC:$dst, GPRC:$base, GPRC:$index), "lbzx $dst, $base, $index">; @@ -255,6 +276,7 @@ "stfsx $frS, $rA, $rB">; def STFDX : XForm_28<31, 727, 0, 0, (ops FPRC:$frS, GPRC:$rA, GPRC:$rB), "stfdx $frS, $rA, $rB">; + def CRAND : XLForm_1<19, 257, 0, 0, (ops u5imm:$D, u5imm:$A, u5imm:$B), "crand $D, $A, $B">; def CRANDC : XLForm_1<19, 129, 0, 0, (ops u5imm:$D, u5imm:$A, u5imm:$B), From reid at x10sys.com Sun Aug 29 18:20:52 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 18:20:52 -0500 Subject: [llvm-commits] CVS: llvm/docs/CompilerDriver.html Message-ID: <200408292320.SAA29541@zion.cs.uiuc.edu> Changes in directory llvm/docs: CompilerDriver.html updated: 1.6 -> 1.7 --- Log message: Synchronize documentation of configuration items and substitutions with current reality of llvmc implementation. --- Diffs of the changes: (+32 -81) Index: llvm/docs/CompilerDriver.html diff -u llvm/docs/CompilerDriver.html:1.6 llvm/docs/CompilerDriver.html:1.7 --- llvm/docs/CompilerDriver.html:1.6 Mon Aug 23 21:23:58 2004 +++ llvm/docs/CompilerDriver.html Sun Aug 29 18:20:42 2004 @@ -138,9 +138,9 @@ llvmc -O2 x.c y.c z.c -o xyz

      must produce exactly the same results as:

      
      -    llvmc -O2 x.c
      -    llvmc -O2 y.c
      -    llvmc -O2 z.c
      +    llvmc -O2 x.c -o x.o
      +    llvmc -O2 y.c -o y.o
      +    llvmc -O2 z.c -o z.o
           llvmc -O2 x.o y.o z.o -o xyz

      To accomplish this, llvmc uses a very simple goal oriented procedure to do its work. The overall goal is to produce a functioning @@ -446,6 +446,16 @@

      + + + + + + + @@ -520,7 +530,7 @@ - + @@ -533,24 +543,6 @@ whenever the final phase is not pre-processing. - - - - - - - - - - - - @@ -562,9 +554,9 @@ - + + optimizer generates. Valid values are "assembly" and "bytecode" @@ -583,16 +575,6 @@ whenever the final phase is optimization or later. - - - - - - @@ -602,36 +584,6 @@ input file and %out% for the output file. - - - - - - - - - - - - - - - - - - -
      Description Default

      LLVMC ITEMS

      versionstringProvides the version string for the contents of this + configuration file. What is accepted as a legal configuration file + will change over time and this item tells llvmc which version + should be expected.b

      LANG ITEMS

      lang.name
      translator.outputnative, bytecode or assemblybytecode or assembly This item specifies the kind of output the language's translator generates. bytecode false
      translator.optimizesbooleanIndicates that the translator also optimizes. If - this is true, then llvmc will skip the optimization phase - whenever the final phase is optimization or later.false
      translator.groks_dash_obooleanIndicates that the translator understands the - intent of the various -On options to - llvmc. This will cause the -On option to be - given to the translator instead of the equivalent options provided by - lang.optn.false

      OPTIMIZER ITEMS

      optimizer.command
      optimizer.outputnative, bytecode or assemblybytecode or assembly This item specifies the kind of output the language's - optimizer generates. bytecode
      false
      optimizer.groks_dash_obooleanIndicates that the translator understands the - intent of the various -On options to - llvmc. This will cause the -On option to be - given to the translator instead of the equivalent options provided by - lang.optn.false

      ASSEMBLER ITEMS

      assembler.command <blank>

      LINKER ITEMS

      linker.libslibrary namesThis provides the list of runtime libraries that the - source language could link with. In general, the libraries - needed will be encoded into the LLVM Assembly or bytecode file. - However, this list tells llvmc the names of the ones that - apply to this source language. The names provided here should be - unadorned with no suffix and no "lib" prefix. - <blank>
      linker.lib_pathsFully qualifed local path namesThis item provides a list of potential directories - in which the source language's runtime libraries might be located. If - a given object file compiled with this language's translator is linked - then those libraries will be given as -L options to the - linker.<blank>
      linker.outputnative, bytecode or assemblyThis item specifies the kind of output the language's - translator generates.bytecode
      @@ -662,6 +614,13 @@ tool. + %force% + Replaced with the -f option if it was + specified on the llvmc command line. This is intended to tell + the compiler tool to force the overwrite of output files. + + + %in% Replaced with the full path of the input file. You needn't worry about the cascading of file names. llvmc will @@ -753,7 +712,7 @@ # To compile stacker source, we just run the stacker # compiler with a default stack size of 2048 entries. translator.command=stkrc -s 2048 %in% -o %out% %time% \ - %stats% %args% + %stats% %force% %args% # stkrc doesn't preprocess but we set this to true so # that we don't run the cp command by default. @@ -762,11 +721,8 @@ # The translator is required to run. translator.required=true - # stkrc doesn't do any optimization, it just translates - translator.optimizes=no - # stkrc doesn't handle the -On options - translator.groks_dash_O=no + translator.output=bytecode ########################################################## # Optimizer definitions @@ -774,10 +730,9 @@ # For optimization, we use the LLVM "opt" program optimizer.command=opt %in% -o %out% %opt% %time% %stats% \ - %args% + %force% %args% - # opt doesn't (yet) grok -On - optimizer.groks_dash_O=no + optimizer.required = true # opt doesn't translate optimizer.translates = no @@ -785,17 +740,13 @@ # opt doesn't preprocess optimizer.preprocesses=no -########################################################## -# Assembler definitions -########################################################## - assembler.command=llc %in% -o %out% %target% \ - "-regalloc=linearscan" %time% %stats% + # opt produces bytecode + optimizer.output = bc ########################################################## -# Linker definitions +# Assembler definitions ########################################################## - linker.libs=stkr_runtime - linker.paths= + assembler.command=llc %in% -o %out% %target% %time% %stats% @@ -862,7 +813,7 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!">Reid Spencer
      The LLVM Compiler Infrastructure
      -Last modified: $Date: 2004/08/24 02:23:58 $ +Last modified: $Date: 2004/08/29 23:20:42 $ From reid at x10sys.com Sun Aug 29 19:07:03 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 19:07:03 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvmc/llvmc.cpp Message-ID: <200408300007.TAA29926@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvmc: llvmc.cpp updated: 1.11 -> 1.12 --- Log message: Need to throw std::string not const char* if we want error messages to be caught. --- Diffs of the changes: (+3 -3) Index: llvm/tools/llvmc/llvmc.cpp diff -u llvm/tools/llvmc/llvmc.cpp:1.11 llvm/tools/llvmc/llvmc.cpp:1.12 --- llvm/tools/llvmc/llvmc.cpp:1.11 Sun Aug 29 14:26:56 2004 +++ llvm/tools/llvmc/llvmc.cpp Sun Aug 29 19:06:52 2004 @@ -216,13 +216,13 @@ // Deal with unimplemented options. if (PipeCommands) - throw "Not implemented yet: -pipe"; + throw std::string("Not implemented yet: -pipe"); if (OutputFilename.empty()) if (OptLevel == CompilerDriver::LINKING) OutputFilename = "a.out"; else - throw "An output file must be specified. Please use the -o option"; + throw std::string("An output file must be specified. Please use the -o option"); // Construct the ConfigDataProvider object LLVMC_ConfigDataProvider Provider; @@ -300,7 +300,7 @@ // Tell the driver to do its thing int result = CD->execute(InpList,sys::Path(OutputFilename)); if (result != 0) { - throw "Error executing actions. Terminated.\n"; + throw std::string("Error executing actions. Terminated."); return result; } From reid at x10sys.com Sun Aug 29 19:13:36 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 19:13:36 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelSimple.cpp X86InstrBuilder.h Message-ID: <200408300013.TAA30036@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelSimple.cpp updated: 1.276 -> 1.277 X86InstrBuilder.h updated: 1.11 -> 1.12 --- Log message: Reduce the number of arguments in the instruction builder and make some improvements on instruction selection that account for register and frame index bases. Patch contributed by Jeff Cohen. Thanks Jeff! --- Diffs of the changes: (+137 -160) Index: llvm/lib/Target/X86/X86ISelSimple.cpp diff -u llvm/lib/Target/X86/X86ISelSimple.cpp:1.276 llvm/lib/Target/X86/X86ISelSimple.cpp:1.277 --- llvm/lib/Target/X86/X86ISelSimple.cpp:1.276 Mon Jul 26 13:45:48 2004 +++ llvm/lib/Target/X86/X86ISelSimple.cpp Sun Aug 29 19:13:26 2004 @@ -237,23 +237,21 @@ /// getAddressingMode - Get the addressing mode to use to address the /// specified value. The returned value should be used with addFullAddress. - void getAddressingMode(Value *Addr, unsigned &BaseReg, unsigned &Scale, - unsigned &IndexReg, unsigned &Disp); + void getAddressingMode(Value *Addr, X86AddressMode &AM); /// getGEPIndex - This is used to fold GEP instructions into X86 addressing /// expressions. void getGEPIndex(MachineBasicBlock *MBB, MachineBasicBlock::iterator IP, std::vector &GEPOps, - std::vector &GEPTypes, unsigned &BaseReg, - unsigned &Scale, unsigned &IndexReg, unsigned &Disp); + std::vector &GEPTypes, + X86AddressMode &AM); /// isGEPFoldable - Return true if the specified GEP can be completely /// folded into the addressing mode of a load/store or lea instruction. bool isGEPFoldable(MachineBasicBlock *MBB, Value *Src, User::op_iterator IdxBegin, - User::op_iterator IdxEnd, unsigned &BaseReg, - unsigned &Scale, unsigned &IndexReg, unsigned &Disp); + User::op_iterator IdxEnd, X86AddressMode &AM); /// emitGEPOperation - Common code shared between visitGetElementPtrInst and /// constant expression GEP support. @@ -812,23 +810,28 @@ } -void ISel::getAddressingMode(Value *Addr, unsigned &BaseReg, unsigned &Scale, - unsigned &IndexReg, unsigned &Disp) { - BaseReg = 0; Scale = 1; IndexReg = 0; Disp = 0; +void ISel::getAddressingMode(Value *Addr, X86AddressMode &AM) { + AM.BaseType = X86AddressMode::RegBase; + AM.Base.Reg = 0; AM.Scale = 1; AM.IndexReg = 0; AM.Disp = 0; if (GetElementPtrInst *GEP = dyn_cast(Addr)) { if (isGEPFoldable(BB, GEP->getOperand(0), GEP->op_begin()+1, GEP->op_end(), - BaseReg, Scale, IndexReg, Disp)) + AM)) return; } else if (ConstantExpr *CE = dyn_cast(Addr)) { if (CE->getOpcode() == Instruction::GetElementPtr) if (isGEPFoldable(BB, CE->getOperand(0), CE->op_begin()+1, CE->op_end(), - BaseReg, Scale, IndexReg, Disp)) + AM)) return; + } else if (AllocaInst *AI = dyn_castFixedAlloca(Addr)) { + AM.BaseType = X86AddressMode::FrameIndexBase; + AM.Base.FrameIndex = getFixedSizedAllocaFI(AI); + return; } // If it's not foldable, reset addr mode. - BaseReg = getReg(Addr); - Scale = 1; IndexReg = 0; Disp = 0; + AM.BaseType = X86AddressMode::RegBase; + AM.Base.Reg = getReg(Addr); + AM.Scale = 1; AM.IndexReg = 0; AM.Disp = 0; } // canFoldSetCCIntoBranchOrSelect - Return the setcc instruction if we can fold @@ -1995,12 +1998,10 @@ addFrameReference(BuildMI(BB, Opcode, 5, DestReg).addReg(Op0r), FI); } else { - unsigned BaseReg, Scale, IndexReg, Disp; - getAddressingMode(cast(Op1)->getOperand(0), BaseReg, - Scale, IndexReg, Disp); + X86AddressMode AM; + getAddressingMode(cast(Op1)->getOperand(0), AM); - addFullAddress(BuildMI(BB, Opcode, 5, DestReg).addReg(Op0r), - BaseReg, Scale, IndexReg, Disp); + addFullAddress(BuildMI(BB, Opcode, 5, DestReg).addReg(Op0r), AM); } return; } @@ -2020,12 +2021,10 @@ unsigned FI = getFixedSizedAllocaFI(AI); addFrameReference(BuildMI(BB, Opcode, 5, DestReg).addReg(Op1r), FI); } else { - unsigned BaseReg, Scale, IndexReg, Disp; - getAddressingMode(cast(Op0)->getOperand(0), BaseReg, - Scale, IndexReg, Disp); + X86AddressMode AM; + getAddressingMode(cast(Op0)->getOperand(0), AM); - addFullAddress(BuildMI(BB, Opcode, 5, DestReg).addReg(Op1r), - BaseReg, Scale, IndexReg, Disp); + addFullAddress(BuildMI(BB, Opcode, 5, DestReg).addReg(Op1r), AM); } return; } @@ -2352,8 +2351,13 @@ case 5: case 9: if (Class == cInt) { - addFullAddress(BuildMI(*MBB, IP, X86::LEA32r, 5, DestReg), - op0Reg, ConstRHS-1, op0Reg, 0); + X86AddressMode AM; + AM.BaseType = X86AddressMode::RegBase; + AM.Base.Reg = op0Reg; + AM.Scale = ConstRHS-1; + AM.IndexReg = op0Reg; + AM.Disp = 0; + addFullAddress(BuildMI(*MBB, IP, X86::LEA32r, 5, DestReg), AM); return; } case -3: @@ -2361,8 +2365,13 @@ case -9: if (Class == cInt) { TmpReg = makeAnotherReg(DestTy); - addFullAddress(BuildMI(*MBB, IP, X86::LEA32r, 5, TmpReg), - op0Reg, -ConstRHS-1, op0Reg, 0); + X86AddressMode AM; + AM.BaseType = X86AddressMode::RegBase; + AM.Base.Reg = op0Reg; + AM.Scale = -ConstRHS-1; + AM.IndexReg = op0Reg; + AM.Disp = 0; + addFullAddress(BuildMI(*MBB, IP, X86::LEA32r, 5, TmpReg), AM); BuildMI(*MBB, IP, NEGrTab[Class], 1, DestReg).addReg(TmpReg); return; } @@ -2444,12 +2453,10 @@ unsigned FI = getFixedSizedAllocaFI(AI); addFrameReference(BuildMI(BB, Opcode, 5, ResultReg).addReg(Op0r), FI); } else { - unsigned BaseReg, Scale, IndexReg, Disp; - getAddressingMode(LI->getOperand(0), BaseReg, - Scale, IndexReg, Disp); + X86AddressMode AM; + getAddressingMode(LI->getOperand(0), AM); - addFullAddress(BuildMI(BB, Opcode, 5, ResultReg).addReg(Op0r), - BaseReg, Scale, IndexReg, Disp); + addFullAddress(BuildMI(BB, Opcode, 5, ResultReg).addReg(Op0r), AM); } return; } @@ -2588,12 +2595,10 @@ unsigned FI = getFixedSizedAllocaFI(AI); addFrameReference(BuildMI(BB, Opcode, 5, ResultReg).addReg(Op0r), FI); } else { - unsigned BaseReg, Scale, IndexReg, Disp; - getAddressingMode(LI->getOperand(0), BaseReg, - Scale, IndexReg, Disp); + X86AddressMode AM; + getAddressingMode(LI->getOperand(0), AM); - addFullAddress(BuildMI(BB, Opcode, 5, ResultReg).addReg(Op0r), - BaseReg, Scale, IndexReg, Disp); + addFullAddress(BuildMI(BB, Opcode, 5, ResultReg).addReg(Op0r), AM); } return; } @@ -2609,10 +2614,9 @@ unsigned FI = getFixedSizedAllocaFI(AI); addFrameReference(BuildMI(BB, Opcode, 5, ResultReg).addReg(Op1r), FI); } else { - unsigned BaseReg, Scale, IndexReg, Disp; - getAddressingMode(LI->getOperand(0), BaseReg, Scale, IndexReg, Disp); - addFullAddress(BuildMI(BB, Opcode, 5, ResultReg).addReg(Op1r), - BaseReg, Scale, IndexReg, Disp); + X86AddressMode AM; + getAddressingMode(LI->getOperand(0), AM); + addFullAddress(BuildMI(BB, Opcode, 5, ResultReg).addReg(Op1r), AM); } return; } @@ -2938,10 +2942,9 @@ unsigned FI = getFixedSizedAllocaFI(AI); addFrameReference(BuildMI(BB, Opcode[Class], 4, DestReg), FI); } else { - unsigned BaseReg = 0, Scale = 1, IndexReg = 0, Disp = 0; - getAddressingMode(I.getOperand(0), BaseReg, Scale, IndexReg, Disp); - addFullAddress(BuildMI(BB, Opcode[Class], 4, DestReg), - BaseReg, Scale, IndexReg, Disp); + X86AddressMode AM; + getAddressingMode(I.getOperand(0), AM); + addFullAddress(BuildMI(BB, Opcode[Class], 4, DestReg), AM); } return; } else { @@ -3011,17 +3014,15 @@ addFrameReference(BuildMI(BB, Opcode, 4, DestReg), FI); } } else { - unsigned BaseReg = 0, Scale = 1, IndexReg = 0, Disp = 0; - getAddressingMode(I.getOperand(0), BaseReg, Scale, IndexReg, Disp); + X86AddressMode AM; + getAddressingMode(I.getOperand(0), AM); if (Class == cLong) { - addFullAddress(BuildMI(BB, X86::MOV32rm, 4, DestReg), - BaseReg, Scale, IndexReg, Disp); - addFullAddress(BuildMI(BB, X86::MOV32rm, 4, DestReg+1), - BaseReg, Scale, IndexReg, Disp+4); + addFullAddress(BuildMI(BB, X86::MOV32rm, 4, DestReg), AM); + AM.Disp += 4; + addFullAddress(BuildMI(BB, X86::MOV32rm, 4, DestReg+1), AM); } else { - addFullAddress(BuildMI(BB, Opcode, 4, DestReg), - BaseReg, Scale, IndexReg, Disp); + addFullAddress(BuildMI(BB, Opcode, 4, DestReg), AM); } } } @@ -3030,13 +3031,8 @@ /// instruction. /// void ISel::visitStoreInst(StoreInst &I) { - unsigned BaseReg = ~0U, Scale = ~0U, IndexReg = ~0U, Disp = ~0U; - unsigned AllocaFrameIdx = ~0U; - - if (AllocaInst *AI = dyn_castFixedAlloca(I.getOperand(1))) - AllocaFrameIdx = getFixedSizedAllocaFI(AI); - else - getAddressingMode(I.getOperand(1), BaseReg, Scale, IndexReg, Disp); + X86AddressMode AM; + getAddressingMode(I.getOperand(1), AM); const Type *ValTy = I.getOperand(0)->getType(); unsigned Class = getClassB(ValTy); @@ -3044,42 +3040,20 @@ if (ConstantInt *CI = dyn_cast(I.getOperand(0))) { uint64_t Val = CI->getRawValue(); if (Class == cLong) { - if (AllocaFrameIdx != ~0U) { - addFrameReference(BuildMI(BB, X86::MOV32mi, 5), - AllocaFrameIdx).addImm(Val & ~0U); - addFrameReference(BuildMI(BB, X86::MOV32mi, 5), - AllocaFrameIdx, 4).addImm(Val>>32); - } else { - addFullAddress(BuildMI(BB, X86::MOV32mi, 5), - BaseReg, Scale, IndexReg, Disp).addImm(Val & ~0U); - addFullAddress(BuildMI(BB, X86::MOV32mi, 5), - BaseReg, Scale, IndexReg, Disp+4).addImm(Val>>32); - } + addFullAddress(BuildMI(BB, X86::MOV32mi, 5), AM).addImm(Val & ~0U); + AM.Disp += 4; + addFullAddress(BuildMI(BB, X86::MOV32mi, 5), AM).addImm(Val>>32); } else { static const unsigned Opcodes[] = { X86::MOV8mi, X86::MOV16mi, X86::MOV32mi }; unsigned Opcode = Opcodes[Class]; - if (AllocaFrameIdx != ~0U) - addFrameReference(BuildMI(BB, Opcode, 5), AllocaFrameIdx).addImm(Val); - else - addFullAddress(BuildMI(BB, Opcode, 5), - BaseReg, Scale, IndexReg, Disp).addImm(Val); + addFullAddress(BuildMI(BB, Opcode, 5), AM).addImm(Val); } } else if (isa(I.getOperand(0))) { - if (AllocaFrameIdx != ~0U) - addFrameReference(BuildMI(BB, X86::MOV32mi, 5), AllocaFrameIdx).addImm(0); - else - addFullAddress(BuildMI(BB, X86::MOV32mi, 5), - BaseReg, Scale, IndexReg, Disp).addImm(0); - + addFullAddress(BuildMI(BB, X86::MOV32mi, 5), AM).addImm(0); } else if (ConstantBool *CB = dyn_cast(I.getOperand(0))) { - if (AllocaFrameIdx != ~0U) - addFrameReference(BuildMI(BB, X86::MOV8mi, 5), - AllocaFrameIdx).addImm(CB->getValue()); - else - addFullAddress(BuildMI(BB, X86::MOV8mi, 5), - BaseReg, Scale, IndexReg, Disp).addImm(CB->getValue()); + addFullAddress(BuildMI(BB, X86::MOV8mi, 5), AM).addImm(CB->getValue()); } else if (ConstantFP *CFP = dyn_cast(I.getOperand(0))) { // Store constant FP values with integer instructions to avoid having to // load the constants from the constant pool then do a store. @@ -3089,45 +3063,24 @@ float F; } V; V.F = CFP->getValue(); - if (AllocaFrameIdx != ~0U) - addFrameReference(BuildMI(BB, X86::MOV32mi, 5), - AllocaFrameIdx).addImm(V.I); - else - addFullAddress(BuildMI(BB, X86::MOV32mi, 5), - BaseReg, Scale, IndexReg, Disp).addImm(V.I); + addFullAddress(BuildMI(BB, X86::MOV32mi, 5), AM).addImm(V.I); } else { union { uint64_t I; double F; } V; V.F = CFP->getValue(); - if (AllocaFrameIdx != ~0U) { - addFrameReference(BuildMI(BB, X86::MOV32mi, 5), - AllocaFrameIdx).addImm((unsigned)V.I); - addFrameReference(BuildMI(BB, X86::MOV32mi, 5), - AllocaFrameIdx, 4).addImm(unsigned(V.I >> 32)); - } else { - addFullAddress(BuildMI(BB, X86::MOV32mi, 5), - BaseReg, Scale, IndexReg, Disp).addImm((unsigned)V.I); - addFullAddress(BuildMI(BB, X86::MOV32mi, 5), - BaseReg, Scale, IndexReg, Disp+4).addImm( + addFullAddress(BuildMI(BB, X86::MOV32mi, 5), AM).addImm((unsigned)V.I); + AM.Disp += 4; + addFullAddress(BuildMI(BB, X86::MOV32mi, 5), AM).addImm( unsigned(V.I >> 32)); - } } } else if (Class == cLong) { unsigned ValReg = getReg(I.getOperand(0)); - if (AllocaFrameIdx != ~0U) { - addFrameReference(BuildMI(BB, X86::MOV32mr, 5), - AllocaFrameIdx).addReg(ValReg); - addFrameReference(BuildMI(BB, X86::MOV32mr, 5), - AllocaFrameIdx, 4).addReg(ValReg+1); - } else { - addFullAddress(BuildMI(BB, X86::MOV32mr, 5), - BaseReg, Scale, IndexReg, Disp).addReg(ValReg); - addFullAddress(BuildMI(BB, X86::MOV32mr, 5), - BaseReg, Scale, IndexReg, Disp+4).addReg(ValReg+1); - } + addFullAddress(BuildMI(BB, X86::MOV32mr, 5), AM).addReg(ValReg); + AM.Disp += 4; + addFullAddress(BuildMI(BB, X86::MOV32mr, 5), AM).addReg(ValReg+1); } else { unsigned ValReg = getReg(I.getOperand(0)); static const unsigned Opcodes[] = { @@ -3136,11 +3089,7 @@ unsigned Opcode = Opcodes[Class]; if (ValTy == Type::DoubleTy) Opcode = X86::FST64m; - if (AllocaFrameIdx != ~0U) - addFrameReference(BuildMI(BB, Opcode, 5), AllocaFrameIdx).addReg(ValReg); - else - addFullAddress(BuildMI(BB, Opcode, 1+4), - BaseReg, Scale, IndexReg, Disp).addReg(ValReg); + addFullAddress(BuildMI(BB, Opcode, 1+4), AM).addReg(ValReg); } } @@ -3539,8 +3488,8 @@ void ISel::visitGetElementPtrInst(GetElementPtrInst &I) { // If this GEP instruction will be folded into all of its users, we don't need // to explicitly calculate it! - unsigned A, B, C, D; - if (isGEPFoldable(0, I.getOperand(0), I.op_begin()+1, I.op_end(), A,B,C,D)) { + X86AddressMode AM; + if (isGEPFoldable(0, I.getOperand(0), I.op_begin()+1, I.op_end(), AM)) { // Check all of the users of the instruction to see if they are loads and // stores. bool AllWillFold = true; @@ -3575,15 +3524,16 @@ /// void ISel::getGEPIndex(MachineBasicBlock *MBB, MachineBasicBlock::iterator IP, std::vector &GEPOps, - std::vector &GEPTypes, unsigned &BaseReg, - unsigned &Scale, unsigned &IndexReg, unsigned &Disp) { + std::vector &GEPTypes, + X86AddressMode &AM) { const TargetData &TD = TM.getTargetData(); // Clear out the state we are working with... - BaseReg = 0; // No base register - Scale = 1; // Unit scale - IndexReg = 0; // No index register - Disp = 0; // No displacement + AM.BaseType = X86AddressMode::RegBase; + AM.Base.Reg = 0; // No base register + AM.Scale = 1; // Unit scale + AM.IndexReg = 0; // No index register + AM.Disp = 0; // No displacement // While there are GEP indexes that can be folded into the current address, // keep processing them. @@ -3597,7 +3547,7 @@ // structure is in memory. Since the structure index must be constant, we // can get its value and use it to find the right byte offset from the // StructLayout class's list of structure member offsets. - Disp += TD.getStructLayout(StTy)->MemberOffsets[CUI->getValue()]; + AM.Disp += TD.getStructLayout(StTy)->MemberOffsets[CUI->getValue()]; GEPOps.pop_back(); // Consume a GEP operand GEPTypes.pop_back(); } else { @@ -3612,18 +3562,18 @@ // If idx is a constant, fold it into the offset. unsigned TypeSize = TD.getTypeSize(SqTy->getElementType()); if (ConstantSInt *CSI = dyn_cast(idx)) { - Disp += TypeSize*CSI->getValue(); + AM.Disp += TypeSize*CSI->getValue(); } else if (ConstantUInt *CUI = dyn_cast(idx)) { - Disp += TypeSize*CUI->getValue(); + AM.Disp += TypeSize*CUI->getValue(); } else { // If the index reg is already taken, we can't handle this index. - if (IndexReg) return; + if (AM.IndexReg) return; // If this is a size that we can handle, then add the index as switch (TypeSize) { case 1: case 2: case 4: case 8: // These are all acceptable scales on X86. - Scale = TypeSize; + AM.Scale = TypeSize; break; default: // Otherwise, we can't handle this scale @@ -3635,7 +3585,7 @@ CI->getOperand(0)->getType() == Type::UIntTy) idx = CI->getOperand(0); - IndexReg = MBB ? getReg(idx, MBB, IP) : 1; + AM.IndexReg = MBB ? getReg(idx, MBB, IP) : 1; } GEPOps.pop_back(); // Consume a GEP operand @@ -3646,22 +3596,23 @@ // GEPTypes is empty, which means we have a single operand left. Set it as // the base register. // - assert(BaseReg == 0); + assert(AM.Base.Reg == 0); -#if 0 // FIXME: TODO! - if (AllocaInst *AI = dyn_castFixedAlloca(V)) { - // FIXME: When we can add FrameIndex values as the first operand, we can - // make GEP's of allocas MUCH more efficient! - unsigned FI = getFixedSizedAllocaFI(AI); + if (AllocaInst *AI = dyn_castFixedAlloca(GEPOps.back())) { + AM.BaseType = X86AddressMode::FrameIndexBase; + AM.Base.FrameIndex = getFixedSizedAllocaFI(AI); GEPOps.pop_back(); return; - } else if (GlobalValue *GV = dyn_cast(V)) { + } + +#if 0 // FIXME: TODO! + if (GlobalValue *GV = dyn_cast(V)) { // FIXME: When addressing modes are more powerful/correct, we could load // global addresses directly as 32-bit immediates. } #endif - BaseReg = MBB ? getReg(GEPOps[0], MBB, IP) : 1; + AM.Base.Reg = MBB ? getReg(GEPOps[0], MBB, IP) : 1; GEPOps.pop_back(); // Consume the last GEP operand } @@ -3670,8 +3621,7 @@ /// folded into the addressing mode of a load/store or lea instruction. bool ISel::isGEPFoldable(MachineBasicBlock *MBB, Value *Src, User::op_iterator IdxBegin, - User::op_iterator IdxEnd, unsigned &BaseReg, - unsigned &Scale, unsigned &IndexReg, unsigned &Disp) { + User::op_iterator IdxEnd, X86AddressMode &AM) { std::vector GEPOps; GEPOps.resize(IdxEnd-IdxBegin+1); @@ -3684,7 +3634,7 @@ MachineBasicBlock::iterator IP; if (MBB) IP = MBB->end(); - getGEPIndex(MBB, IP, GEPOps, GEPTypes, BaseReg, Scale, IndexReg, Disp); + getGEPIndex(MBB, IP, GEPOps, GEPTypes, AM); // We can fold it away iff the getGEPIndex call eliminated all operands. return GEPOps.empty(); @@ -3723,23 +3673,23 @@ // Keep emitting instructions until we consume the entire GEP instruction. while (!GEPOps.empty()) { unsigned OldSize = GEPOps.size(); - unsigned BaseReg, Scale, IndexReg, Disp; - getGEPIndex(MBB, IP, GEPOps, GEPTypes, BaseReg, Scale, IndexReg, Disp); + X86AddressMode AM; + getGEPIndex(MBB, IP, GEPOps, GEPTypes, AM); if (GEPOps.size() != OldSize) { // getGEPIndex consumed some of the input. Build an LEA instruction here. unsigned NextTarget = 0; if (!GEPOps.empty()) { - assert(BaseReg == 0 && + assert(AM.Base.Reg == 0 && "getGEPIndex should have left the base register open for chaining!"); - NextTarget = BaseReg = makeAnotherReg(Type::UIntTy); + NextTarget = AM.Base.Reg = makeAnotherReg(Type::UIntTy); } - if (IndexReg == 0 && Disp == 0) - BuildMI(*MBB, IP, X86::MOV32rr, 1, TargetReg).addReg(BaseReg); + if (AM.BaseType == X86AddressMode::RegBase && + AM.IndexReg == 0 && AM.Disp == 0) + BuildMI(*MBB, IP, X86::MOV32rr, 1, TargetReg).addReg(AM.Base.Reg); else - addFullAddress(BuildMI(*MBB, IP, X86::LEA32r, 5, TargetReg), - BaseReg, Scale, IndexReg, Disp); + addFullAddress(BuildMI(*MBB, IP, X86::LEA32r, 5, TargetReg), AM); --IP; TargetReg = NextTarget; } else if (GEPTypes.empty()) { Index: llvm/lib/Target/X86/X86InstrBuilder.h diff -u llvm/lib/Target/X86/X86InstrBuilder.h:1.11 llvm/lib/Target/X86/X86InstrBuilder.h:1.12 --- llvm/lib/Target/X86/X86InstrBuilder.h:1.11 Thu Mar 4 12:05:02 2004 +++ llvm/lib/Target/X86/X86InstrBuilder.h Sun Aug 29 19:13:26 2004 @@ -28,6 +28,29 @@ namespace llvm { +/// X86AddressMode - This struct holds a generalized full x86 address mode. +/// The base register can be a frame index, which will eventually be replaced +/// with BP or SP and Disp being offsetted accordingly. +/// FIXME: add support for globals as a new base type. +struct X86AddressMode { + enum { + UnknownBase, + RegBase, + FrameIndexBase + } BaseType; + + union { + unsigned Reg; + int FrameIndex; + } Base; + + unsigned Scale; + unsigned IndexReg; + unsigned Disp; + + X86AddressMode() : BaseType(UnknownBase) {} +}; + /// addDirectMem - This function is used to add a direct memory reference to the /// current instruction -- that is, a dereference of an address in a register, /// with no scale, index or displacement. An example is: DWORD PTR [EAX]. @@ -50,12 +73,16 @@ } inline const MachineInstrBuilder &addFullAddress(const MachineInstrBuilder &MIB, - unsigned BaseReg, - unsigned Scale, - unsigned IndexReg, - unsigned Disp) { - assert (Scale == 1 || Scale == 2 || Scale == 4 || Scale == 8); - return MIB.addReg(BaseReg).addZImm(Scale).addReg(IndexReg).addSImm(Disp); + const X86AddressMode &AM) { + assert (AM.Scale == 1 || AM.Scale == 2 || AM.Scale == 4 || AM.Scale == 8); + + if (AM.BaseType == X86AddressMode::RegBase) + MIB.addReg(AM.Base.Reg); + else if (AM.BaseType == X86AddressMode::FrameIndexBase) + MIB.addFrameIndex(AM.Base.FrameIndex); + else + assert (0); + return MIB.addZImm(AM.Scale).addReg(AM.IndexReg).addSImm(AM.Disp); } /// addFrameReference - This function is used to add a reference to the base of From reid at x10sys.com Sun Aug 29 21:04:01 2004 From: reid at x10sys.com (Reid Spencer) Date: Sun, 29 Aug 2004 21:04:01 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/README.txt Message-ID: <200408300204.VAA31408@zion.cs.uiuc.edu> Changes in directory llvm/lib/System: README.txt updated: 1.3 -> 1.4 --- Log message: Abbreviate the long descriptions which are now in docs/SystemLibrary.html. --- Diffs of the changes: (+25 -78) Index: llvm/lib/System/README.txt diff -u llvm/lib/System/README.txt:1.3 llvm/lib/System/README.txt:1.4 --- llvm/lib/System/README.txt:1.3 Thu Aug 26 02:41:41 2004 +++ llvm/lib/System/README.txt Sun Aug 29 21:03:51 2004 @@ -9,88 +9,35 @@ The software located here, of necessity, has very specific and stringent design rules. Violation of these rules means that cracks in the shield could form and the primary goal of the library is defeated. By consistently using this library, -LLVM becomes more easily ported to new platforms since (hopefully) the only thing -requiring porting is this library. +LLVM becomes more easily ported to new platforms since the only thing requiring +porting is this library. Complete documentation for the library can be found in the file: llvm/docs/SystemLibrary.html or at this URL: http://llvm.org/docs/SystemLibrary.html -However, for the impatient, here's a high level summary of the design rules: +While we recommend that you read the more detailed documentation, for the +impatient, here's a high level summary of the library's requirements. -1. No functions are declared with throw specifications. This is on purpose to - make sure that additional exception handling code is not introduced by the - compiler. - -2. On error only an instance of std::string that explains the error and possibly - the context of the error may be thrown. - -3. Error messages should do whatever is necessary to get a readable message from - the operating system about the error. For example, on UNIX the strerror_r - function ought to be used. - -4. Entry points into the library should be fairly high level and aimed at - completing some task needed by LLVM. There should *not* be a 1-to-1 - relationship between operating system calls and the library's interface. - Certain implementations of the - -5. The implementation of an 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. - -6. 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. - -7. 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. - -8. 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. - -9. The library does not attempt to shield LLVM from the C++ standard library or - standard template library. These libraries are considered to be platform - agnostic already. - -10. LLVM should not include *any* system headers anywhere except in lib/System. - -11. lib/System must *not* expose *any* system headers through its interface. + 1. No system header files are to be exposed through the interface. + 2. Std C++ and Std C header files are okay to be exposed through the interface. + 3. No exposed system-specific functions. + 4. No exposed system-specific data. + 5. Data in lib/System classes must use only simple C++ intrinsic types. + 6. Errors are handled by throwing std::string *only*. + 7. Library must not throw any exceptions except std::string. + 8. Interface functions must not have throw() specifications. + 9. No duplicate function impementations are permitted within an operating + system class. + +To accomplish these requirements, the library has numerous design criteria that +must be satisfied. Here's a high level summary of the library's design criteria: + + 1. No unused functionality (only what LLVM needs) + 2. High-Level Interfaces + 3. Use Opaque Classes + 4. Common Implementations + 5. Multiple Implementations + 6. Minimize Memory Allocation + 7. No Virtual Methods From natebegeman at mac.com Sun Aug 29 21:28:16 2004 From: natebegeman at mac.com (Nate Begeman) Date: Sun, 29 Aug 2004 21:28:16 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPC32AsmPrinter.cpp PowerPCInstrFormats.td PowerPCInstrInfo.td Message-ID: <200408300228.VAA31814@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPC32AsmPrinter.cpp updated: 1.55 -> 1.56 PowerPCInstrFormats.td updated: 1.16 -> 1.17 PowerPCInstrInfo.td updated: 1.30 -> 1.31 --- Log message: Move yet more instructions over to being printed by the generated asm writer --- Diffs of the changes: (+183 -135) Index: llvm/lib/Target/PowerPC/PPC32AsmPrinter.cpp diff -u llvm/lib/Target/PowerPC/PPC32AsmPrinter.cpp:1.55 llvm/lib/Target/PowerPC/PPC32AsmPrinter.cpp:1.56 --- llvm/lib/Target/PowerPC/PPC32AsmPrinter.cpp:1.55 Sat Aug 21 14:11:03 2004 +++ llvm/lib/Target/PowerPC/PPC32AsmPrinter.cpp Sun Aug 29 21:28:06 2004 @@ -92,6 +92,12 @@ assert(value <= 31 && "Invalid u5imm argument!"); O << (unsigned int)value; } + void printU6ImmOperand(const MachineInstr *MI, unsigned OpNo, + MVT::ValueType VT) { + unsigned char value = MI->getOperand(OpNo).getImmedValue(); + assert(value <= 63 && "Invalid u6imm argument!"); + O << (unsigned int)value; + } void printU16ImmOperand(const MachineInstr *MI, unsigned OpNo, MVT::ValueType VT) { O << (unsigned short)MI->getOperand(OpNo).getImmedValue(); Index: llvm/lib/Target/PowerPC/PowerPCInstrFormats.td diff -u llvm/lib/Target/PowerPC/PowerPCInstrFormats.td:1.16 llvm/lib/Target/PowerPC/PowerPCInstrFormats.td:1.17 --- llvm/lib/Target/PowerPC/PowerPCInstrFormats.td:1.16 Sun Aug 29 17:45:13 2004 +++ llvm/lib/Target/PowerPC/PowerPCInstrFormats.td Sun Aug 29 21:28:06 2004 @@ -427,8 +427,8 @@ } // 1.7.8 XFX-Form -class XFXForm_1 opcode, bits<10> xo, bit ppc64, bit vmx> - : I { +class XFXForm_1 opcode, bits<10> xo, bit ppc64, bit vmx, + dag OL, string asmstr> : I<"", opcode, ppc64, vmx> { field bits<5> ST; field bits<10> SPR; @@ -443,21 +443,26 @@ let Inst{11-20} = SPR; let Inst{21-30} = xo; let Inst{31} = 0; + let OperandList = OL; + let AsmString = asmstr; } -class XFXForm_1_ext opcode, bits<10> xo, bits<10> spr, - bit ppc64, bit vmx> : XFXForm_1 { +class XFXForm_1_ext opcode, bits<10> xo, bits<10> spr, bit ppc64, + bit vmx, dag OL, string asmstr> + : XFXForm_1 { let ArgCount = 1; let Arg0Type = Gpr.Value; let Arg1Type = 0; let SPR = spr; } -class XFXForm_7 opcode, bits<10> xo, bit ppc64, bit vmx> - : XFXForm_1; - -class XFXForm_7_ext opcode, bits<10> xo, bits<10> spr, - bit ppc64, bit vmx> : XFXForm_7 { +class XFXForm_7 opcode, bits<10> xo, bit ppc64, bit vmx, + dag OL, string asmstr> + : XFXForm_1; + +class XFXForm_7_ext opcode, bits<10> xo, bits<10> spr, + bit ppc64, bit vmx, dag OL, string asmstr> + : XFXForm_7 { let ArgCount = 1; let Arg0Type = Gpr.Value; let Arg1Type = 0; @@ -465,8 +470,8 @@ } // 1.7.10 XS-Form -class XSForm_1 opcode, bits<9> xo, bit rc, - bit ppc64, bit vmx> : I { +class XSForm_1 opcode, bits<9> xo, bit rc, bit ppc64, bit vmx, + dag OL, string asmstr> : I<"", opcode, ppc64, vmx> { field bits<5> RS; field bits<5> A; field bits<6> SH; @@ -484,11 +489,13 @@ let Inst{21-29} = xo; let Inst{30} = SH{0}; let Inst{31} = rc; + let OperandList = OL; + let AsmString = asmstr; } // 1.7.11 XO-Form -class XOForm_1 opcode, bits<9> xo, bit oe, bit rc, - bit ppc64, bit vmx> : I { +class XOForm_1 opcode, bits<9> xo, bit oe, bit rc, bit ppc64, bit vmx, + dag OL, string asmstr> : I<"", opcode, ppc64, vmx> { field bits<5> RT; field bits<5> RA; field bits<5> RB; @@ -506,29 +513,27 @@ let Inst{21} = oe; let Inst{22-30} = xo; let Inst{31} = rc; + let OperandList = OL; + let AsmString = asmstr; } -// This is a reversal of the two operands, used notably by extended ops SUB*: -// sub x, y, z == subf x, z, y -// subc x, y, z == subfc x, z, y -class XOForm_1_rev opcode, bits<9> xo, bit oe, bit rc, - bit ppc64, bit vmx> - : XOForm_1 { +class XOForm_1r opcode, bits<9> xo, bit oe, bit rc, bit ppc64, bit vmx, + dag OL, string asmstr> + : XOForm_1 { let Inst{11-15} = RB; let Inst{16-20} = RA; } -class XOForm_2 opcode, bits<9> xo, bit rc, bit ppc64, - bit vmx> : XOForm_1; - -class XOForm_3 opcode, bits<9> xo, bit oe, bit rc, - bit ppc64, bit vmx> : XOForm_1 { +class XOForm_3 opcode, bits<9> xo, bit oe, bit rc, bit ppc64, bit vmx, + dag OL, string asmstr> + : XOForm_1 { + let ArgCount = 2; let RB = 0; } // 1.7.12 A-Form -class AForm_1 opcode, bits<5> xo, bit rc, bit ppc64, - bit vmx, dag OL, string asmstr> : I<"", opcode, ppc64, vmx> { +class AForm_1 opcode, bits<5> xo, bit rc, bit ppc64, bit vmx, + dag OL, string asmstr> : I<"", opcode, ppc64, vmx> { let ArgCount = 4; field bits<5> FRT; field bits<5> FRA; Index: llvm/lib/Target/PowerPC/PowerPCInstrInfo.td diff -u llvm/lib/Target/PowerPC/PowerPCInstrInfo.td:1.30 llvm/lib/Target/PowerPC/PowerPCInstrInfo.td:1.31 --- llvm/lib/Target/PowerPC/PowerPCInstrInfo.td:1.30 Sun Aug 29 17:45:13 2004 +++ llvm/lib/Target/PowerPC/PowerPCInstrInfo.td Sun Aug 29 21:28:06 2004 @@ -17,42 +17,24 @@ let isTerminator = 1, isReturn = 1 in def BLR : XLForm_2_ext<"blr", 19, 16, 20, 31, 1, 0, 0>; -class II { - dag OperandList = OL; - string AsmString = asmstr; -} - def u5imm : Operand { let PrintMethod = "printU5ImmOperand"; } +def u6imm : Operand { + let PrintMethod = "printU6ImmOperand"; +} def u16imm : Operand { let PrintMethod = "printU16ImmOperand"; } - // Pseudo-instructions: -def PHI : Pseudo<"PHI">; // PHI node... +def PHI : Pseudo<"PHI">; def ADJCALLSTACKDOWN : Pseudo<"ADJCALLSTACKDOWN">; def ADJCALLSTACKUP : Pseudo<"ADJCALLSTACKUP">; let Defs = [LR] in def MovePCtoLR : Pseudo<"MovePCtoLR">; def IMPLICIT_DEF : Pseudo<"IMPLICIT_DEF">; -def LA : DForm_2<"la", 14, 0, 0>; -def LOADHiAddr : DForm_2_r0<"addis", 15, 0, 0>; - -def ADDI : DForm_2<"addi", 14, 0, 0>; -def ADDIS : DForm_2<"addis", 15, 0, 0>; -def SUBI : DForm_2<"subi", 14, 0, 0>; -def LI : DForm_2_r0<"li", 14, 0, 0>; -def LIS : DForm_2_r0<"lis", 15, 0, 0>; -def ADDIC : DForm_2<"addic", 12, 0, 0>; -def ADDICo : DForm_2<"addic.", 13, 0, 0>; -def ADD : XOForm_1<"add", 31, 266, 0, 0, 0, 0>; -def ADDC : XOForm_1<"addc", 31, 10, 0, 0, 0, 0>; -def ADDE : XOForm_1<"adde", 31, 138, 0, 0, 0, 0>; -def ADDZE : XOForm_3<"addze", 31, 202, 0, 0, 0, 0>; - let isBranch = 1, isTerminator = 1 in { def COND_BRANCH : Pseudo<"COND_BRANCH">; def B : IForm<"b", 18, 0, 0, 0, 0>; @@ -77,111 +59,78 @@ def CALLindirect : XLForm_2_ext<"bctrl", 19, 528, 20, 31, 1, 0, 0>; } -def CMPI : DForm_5<"cmpi", 11, 0, 0>; -def CMPWI : DForm_5_ext<"cmpwi", 11, 0, 0>; -def CMPDI : DForm_5_ext<"cmpdi", 11, 1, 0>; -def CMP : XForm_16<"cmp", 31, 0, 0, 0>; -def CMPW : XForm_16_ext<"cmpw", 31, 0, 0, 0>; -def CMPD : XForm_16_ext<"cmpd", 31, 0, 1, 0>; -def CMPL : XForm_16<"cmpl", 31, 32, 0, 0>; -def CMPLW : XForm_16_ext<"cmplw", 31, 32, 0, 0>; -def CMPLD : XForm_16_ext<"cmpld", 31, 32, 1, 0>; -def DIVW : XOForm_1<"divw", 31, 491, 0, 0, 0, 0>; -def DIVWU : XOForm_1<"divwu", 31, 459, 0, 0, 0, 0>; -def FCMPU : XForm_17<"fcmpu", 63, 0, 0, 0>; +def LA : DForm_2<"la", 14, 0, 0>; +def LOADHiAddr : DForm_2_r0<"addis", 15, 0, 0>; + def LBZ : DForm_1<"lbz", 35, 0, 0>; def LHA : DForm_1<"lha", 42, 0, 0>; def LHZ : DForm_1<"lhz", 40, 0, 0>; -def LWZ : DForm_1<"lwz", 32, 0, 0>; -def LWA : DSForm_1<"lwa", 58, 2, 1, 0>; -def LD : DSForm_2<"ld", 58, 0, 1, 0>; def LMW : DForm_1<"lmw", 46, 0, 0>; -def STMW : DForm_3<"stmw", 47, 0, 0>; -def LFS : DForm_8<"lfs", 48, 0, 0>; -def LFD : DForm_8<"lfd", 50, 0, 0>; -def MFLR : XFXForm_1_ext<"", 31, 399, 8, 0, 0>, - II<(ops GPRC:$reg), "mflr $reg">; -def MFCTR : XFXForm_1_ext<"mfctr", 31, 399, 9, 0, 0>; -def MTLR : XFXForm_7_ext<"mtlr", 31, 467, 8, 0, 0>; -def MTCTR : XFXForm_7_ext<"mtctr", 31, 467, 9, 0, 0>; -def MULLD : XOForm_1<"mulld", 31, 233, 0, 0, 1, 0>; +def LWZ : DForm_1<"lwz", 32, 0, 0>; +def ADDI : DForm_2<"addi", 14, 0, 0>; +def ADDIC : DForm_2<"addic", 12, 0, 0>; +def ADDICo : DForm_2<"addic.", 13, 0, 0>; +def ADDIS : DForm_2<"addis", 15, 0, 0>; def MULLI : DForm_2<"mulli", 7, 0, 0>; -def MULLW : XOForm_1<"mullw", 31, 235, 0, 0, 0, 0>; -def MULHWU : XOForm_2<"mulhwu", 31, 11, 0, 0, 0>; -def NEG : XOForm_3<"neg", 31, 104, 0, 0, 0, 0>; -def NOP : DForm_4_zero<"nop", 24, 0, 0, (ops), "nop">; -def RLDICL : MDForm_1<"rldicl", 30, 0, 0, 1, 0>; -def RLDICR : MDForm_1<"rldicr", 30, 1, 0, 1, 0>; -def RLWINM : MForm_2<"rlwinm", 21, 0, 0, 0>; -def RLWNM : MForm_1<"rlwnm", 23, 0, 0, 0>; -def RLWIMI : MForm_2<"rlwimi", 20, 0, 0, 0>; -def SRADI : XSForm_1<"sradi", 31, 413, 0, 1, 0>; -def SRWI : MForm_2<"srwi", 21, 0, 0, 0>; +def SUBFIC : DForm_2<"subfic", 8, 0, 0>; +def SUBI : DForm_2<"subi", 14, 0, 0>; +def LI : DForm_2_r0<"li", 14, 0, 0>; +def LIS : DForm_2_r0<"lis", 15, 0, 0>; +def STMW : DForm_3<"stmw", 47, 0, 0>; def STB : DForm_3<"stb", 38, 0, 0>; def STBU : DForm_3<"stbu", 39, 0, 0>; def STH : DForm_3<"sth", 44, 0, 0>; def STHU : DForm_3<"sthu", 45, 0, 0>; def STW : DForm_3<"stw", 36, 0, 0>; def STWU : DForm_3<"stwu", 37, 0, 0>; -def STD : DSForm_2<"std", 62, 0, 1, 0>; -def STDU : DSForm_2<"stdu", 62, 1, 1, 0>; +def CMPI : DForm_5<"cmpi", 11, 0, 0>; +def CMPWI : DForm_5_ext<"cmpwi", 11, 0, 0>; +def CMPDI : DForm_5_ext<"cmpdi", 11, 1, 0>; +def LFS : DForm_8<"lfs", 48, 0, 0>; +def LFD : DForm_8<"lfd", 50, 0, 0>; def STFS : DForm_9<"stfs", 52, 0, 0>; def STFD : DForm_9<"stfd", 54, 0, 0>; -def SUBFIC : DForm_2<"subfic", 8, 0, 0>; -def SUB : XOForm_1_rev<"sub", 31, 40, 0, 0, 0, 0>; -def SUBF : XOForm_1<"subf", 31, 40, 0, 0, 0, 0>; -def SUBC : XOForm_1_rev<"subc", 31, 8, 0, 0, 0, 0>; -def SUBFC : XOForm_1<"subfc", 31, 8, 0, 0, 0, 0>; -def SUBFE : XOForm_1<"subfe", 31, 136, 0, 0, 0, 0>; -def SUBFZE : XOForm_3<"subfze", 31, 200, 0, 0, 0, 0>; -def FMADD : AForm_1<63, 29, 0, 0, 0, - (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRC, FPRC:$FRB), - "fmadd $FRT, $FRA, $FRC, $FRB">; -def FSEL : AForm_1<63, 23, 0, 0, 0, - (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRC, FPRC:$FRB), - "fsel $FRT, $FRA, $FRC, $FRB">; -def FADD : AForm_2<63, 21, 0, 0, 0, - (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRB), - "fadd $FRT, $FRA, $FRB">; -def FADDS : AForm_2<59, 21, 0, 0, 0, - (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRB), - "fadds $FRT, $FRA, $FRB">; -def FDIV : AForm_2<63, 18, 0, 0, 0, - (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRB), - "fdiv $FRT, $FRA, $FRB">; -def FDIVS : AForm_2<59, 18, 0, 0, 0, - (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRB), - "fdivs $FRT, $FRA, $FRB">; -def FMUL : AForm_3<63, 25, 0, 0, 0, - (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRB), - "fmul $FRT, $FRA, $FRB">; -def FMULS : AForm_3<59, 25, 0, 0, 0, - (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRB), - "fmuls $FRT, $FRA, $FRB">; -def FSUB : AForm_2<63, 20, 0, 0, 0, - (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRB), - "fsub $FRT, $FRA, $FRB">; -def FSUBS : AForm_2<59, 20, 0, 0, 0, - (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRB), - "fsubs $FRT, $FRA, $FRB">; +def LWA : DSForm_1<"lwa", 58, 2, 1, 0>; +def LD : DSForm_2<"ld", 58, 0, 1, 0>; +def STD : DSForm_2<"std", 62, 0, 1, 0>; +def STDU : DSForm_2<"stdu", 62, 1, 1, 0>; +def RLWNM : MForm_1<"rlwnm", 23, 0, 0, 0>; +def RLWIMI : MForm_2<"rlwimi", 20, 0, 0, 0>; +def RLWINM : MForm_2<"rlwinm", 21, 0, 0, 0>; +def SRWI : MForm_2<"srwi", 21, 0, 0, 0>; +def RLDICL : MDForm_1<"rldicl", 30, 0, 0, 1, 0>; +def RLDICR : MDForm_1<"rldicr", 30, 1, 0, 1, 0>; + +def CMP : XForm_16<"cmp", 31, 0, 0, 0>; +def CMPL : XForm_16<"cmpl", 31, 32, 0, 0>; +def CMPW : XForm_16_ext<"cmpw", 31, 0, 0, 0>; +def CMPD : XForm_16_ext<"cmpd", 31, 0, 1, 0>; +def CMPLW : XForm_16_ext<"cmplw", 31, 32, 0, 0>; +def CMPLD : XForm_16_ext<"cmpld", 31, 32, 1, 0>; +def FCMPU : XForm_17<"fcmpu", 63, 0, 0, 0>; + +// D-Form instructions. Most instructions that perform an operation on a +// register and an immediate are of this type. +// def ANDIo : DForm_4<28, 0, 0, - (ops GPRC:$dst, GPRC:$src1, u16imm:$src2), - "andi. $dst, $src1, $src2">; -def ORI : DForm_4<24, 0, 0, - (ops GPRC:$dst, GPRC:$src1, u16imm:$src2), - "ori $dst, $src1, $src2">; -def ORIS : DForm_4<25, 0, 0, - (ops GPRC:$dst, GPRC:$src1, u16imm:$src2), - "oris $dst, $src1, $src2">; + (ops GPRC:$dst, GPRC:$src1, u16imm:$src2), + "andi. $dst, $src1, $src2">; +def ORI : DForm_4<24, 0, 0, + (ops GPRC:$dst, GPRC:$src1, u16imm:$src2), + "ori $dst, $src1, $src2">; +def ORIS : DForm_4<25, 0, 0, + (ops GPRC:$dst, GPRC:$src1, u16imm:$src2), + "oris $dst, $src1, $src2">; def XORI : DForm_4<26, 0, 0, - (ops GPRC:$dst, GPRC:$src1, u16imm:$src2), - "xori $dst, $src1, $src2">; + (ops GPRC:$dst, GPRC:$src1, u16imm:$src2), + "xori $dst, $src1, $src2">; def XORIS : DForm_4<27, 0, 0, - (ops GPRC:$dst, GPRC:$src1, u16imm:$src2), - "xoris $dst, $src1, $src2">; -def CMPLI : DForm_6<10, 0, 0, + (ops GPRC:$dst, GPRC:$src1, u16imm:$src2), + "xoris $dst, $src1, $src2">; +def NOP : DForm_4_zero<"nop", 24, 0, 0, (ops), "nop">; +def CMPLI : DForm_6<10, 0, 0, (ops CRRC:$dst, i1imm:$size, GPRC:$src1, u16imm:$src2), "cmpli $dst, $size, $src1, $src2">; def CMPLWI : DForm_6_ext<10, 0, 0, @@ -191,6 +140,9 @@ (ops CRRC:$dst, GPRC:$src1, u16imm:$src2), "cmpldi $dst, $src1, $src2">; +// X-Form instructions. Most instructions that perform an operation on a +// register and another register are of this type. +// def LBZX : XForm_1<31, 87, 0, 0, (ops GPRC:$dst, GPRC:$base, GPRC:$index), "lbzx $dst, $base, $index">; def LHAX : XForm_1<31, 343, 0, 0, (ops GPRC:$dst, GPRC:$base, GPRC:$index), @@ -277,6 +229,8 @@ def STFDX : XForm_28<31, 727, 0, 0, (ops FPRC:$frS, GPRC:$rA, GPRC:$rB), "stfdx $frS, $rA, $rB">; +// XL-Form instructions. condition register logical ops. +// def CRAND : XLForm_1<19, 257, 0, 0, (ops u5imm:$D, u5imm:$A, u5imm:$B), "crand $D, $A, $B">; def CRANDC : XLForm_1<19, 129, 0, 0, (ops u5imm:$D, u5imm:$A, u5imm:$B), @@ -285,3 +239,86 @@ "crnor $D, $A, $B">; def CROR : XLForm_1<19, 449, 0, 0, (ops u5imm:$D, u5imm:$A, u5imm:$B), "cror $D, $A, $B">; + +// XFX-Form instructions. Instructions that deal with SPRs +// +def MFCTR : XFXForm_1_ext<31, 399, 9, 0, 0, (ops GPRC:$rT), "mfctr $rT">; +def MFLR : XFXForm_1_ext<31, 399, 8, 0, 0, (ops GPRC:$rT), "mflr $rT">; +def MTCTR : XFXForm_7_ext<31, 467, 9, 0, 0, (ops GPRC:$rS), "mtctr $rS">; +def MTLR : XFXForm_7_ext<31, 467, 8, 0, 0, (ops GPRC:$rS), "mtlr $rS">; + + +// XS-Form instructions. Just 'sradi' +// +def SRADI : XSForm_1<31, 413, 0, 1, 0, (ops GPRC:$rA, GPRC:$rS, u6imm:$SH), + "sradi $rA, $rS, $SH">; + +// XO-Form instructions. Arithmetic instructions that can set overflow bit +// +def ADD : XOForm_1<31, 266, 0, 0, 0, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB), + "add $rT, $rA, $rB">; +def ADDC : XOForm_1<31, 10, 0, 0, 0, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB), + "addc $rT, $rA, $rB">; +def ADDE : XOForm_1<31, 138, 0, 0, 0, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB), + "adde $rT, $rA, $rB">; +def DIVW : XOForm_1<31, 491, 0, 0, 0, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB), + "divw $rT, $rA, $rB">; +def DIVWU : XOForm_1<31, 459, 0, 0, 0, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB), + "divwu $rT, $rA, $rB">; +def MULHWU : XOForm_1<31, 11, 0, 0, 0, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB), + "mulhwu $rT, $rA, $rB">; +def MULLD : XOForm_1<31, 233, 0, 0, 1, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB), + "mulld $rT, $rA, $rB">; +def MULLW : XOForm_1<31, 235, 0, 0, 0, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB), + "mullw $rT, $rA, $rB">; +def SUBF : XOForm_1<31, 40, 0, 0, 0, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB), + "subf $rT, $rA, $rB">; +def SUBFC : XOForm_1<31, 8, 0, 0, 0, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB), + "subfc $rT, $rA, $rB">; +def SUBFE : XOForm_1<31, 136, 0, 0, 0, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB), + "subfe $rT, $rA, $rB">; +def SUB : XOForm_1r<31, 40, 0, 0, 0, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB), + "sub $rT, $rA, $rB">; +def SUBC : XOForm_1r<31, 8, 0, 0, 0, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB), + "subc $rT, $rA, $rB">; +def ADDZE : XOForm_3<31, 202, 0, 0, 0, 0, (ops GPRC:$rT, GPRC:$rA), + "addze $rT, $rA">; +def NEG : XOForm_3<31, 104, 0, 0, 0, 0, (ops GPRC:$rT, GPRC:$rA), + "neg $rT, $rA">; +def SUBFZE : XOForm_3<31, 200, 0, 0, 0, 0, (ops GPRC:$rT, GPRC:$rA), + "subfze $rT, $rA">; + +// A-Form instructions. Most of the instructions executed in the FPU are of +// this type. +// +def FMADD : AForm_1<63, 29, 0, 0, 0, + (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRC, FPRC:$FRB), + "fmadd $FRT, $FRA, $FRC, $FRB">; +def FSEL : AForm_1<63, 23, 0, 0, 0, + (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRC, FPRC:$FRB), + "fsel $FRT, $FRA, $FRC, $FRB">; +def FADD : AForm_2<63, 21, 0, 0, 0, + (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRB), + "fadd $FRT, $FRA, $FRB">; +def FADDS : AForm_2<59, 21, 0, 0, 0, + (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRB), + "fadds $FRT, $FRA, $FRB">; +def FDIV : AForm_2<63, 18, 0, 0, 0, + (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRB), + "fdiv $FRT, $FRA, $FRB">; +def FDIVS : AForm_2<59, 18, 0, 0, 0, + (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRB), + "fdivs $FRT, $FRA, $FRB">; +def FMUL : AForm_3<63, 25, 0, 0, 0, + (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRB), + "fmul $FRT, $FRA, $FRB">; +def FMULS : AForm_3<59, 25, 0, 0, 0, + (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRB), + "fmuls $FRT, $FRA, $FRB">; +def FSUB : AForm_2<63, 20, 0, 0, 0, + (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRB), + "fsub $FRT, $FRA, $FRB">; +def FSUBS : AForm_2<59, 20, 0, 0, 0, + (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRB), + "fsubs $FRT, $FRA, $FRB">; + From alkis at cs.uiuc.edu Sun Aug 29 23:08:59 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Sun, 29 Aug 2004 23:08:59 -0500 Subject: [llvm-commits] CVS: llvm-java/tools/class2llvm/class2llvm.cpp Makefile Message-ID: <200408300408.XAA00934@zion.cs.uiuc.edu> Changes in directory llvm-java/tools/class2llvm: class2llvm.cpp updated: 1.13 -> 1.14 Makefile updated: 1.2 -> 1.3 --- Log message: Make things compile again after the addition of LLVMsystem.a. --- Diffs of the changes: (+2 -2) Index: llvm-java/tools/class2llvm/class2llvm.cpp diff -u llvm-java/tools/class2llvm/class2llvm.cpp:1.13 llvm-java/tools/class2llvm/class2llvm.cpp:1.14 --- llvm-java/tools/class2llvm/class2llvm.cpp:1.13 Wed Aug 4 05:02:03 2004 +++ llvm-java/tools/class2llvm/class2llvm.cpp Sun Aug 29 23:08:49 2004 @@ -30,7 +30,7 @@ int main(int argc, char* argv[]) { - PrintStackTraceOnErrorSignal(); + sys::PrintStackTraceOnErrorSignal(); cl::ParseCommandLineOptions(argc, argv, "classfile to llvm utility"); Index: llvm-java/tools/class2llvm/Makefile diff -u llvm-java/tools/class2llvm/Makefile:1.2 llvm-java/tools/class2llvm/Makefile:1.3 --- llvm-java/tools/class2llvm/Makefile:1.2 Tue Jul 13 18:21:34 2004 +++ llvm-java/tools/class2llvm/Makefile Sun Aug 29 23:08:49 2004 @@ -11,6 +11,6 @@ TOOLNAME := class2llvm USEDLIBS := classfile compiler -LLVMLIBS := support vmcore bcwriter +LLVMLIBS := support vmcore bcwriter LLVMsystem include $(LEVEL)/Makefile.common From alkis at cs.uiuc.edu Sun Aug 29 23:08:59 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Sun, 29 Aug 2004 23:08:59 -0500 Subject: [llvm-commits] CVS: llvm-java/tools/classdump/classdump.cpp Makefile Message-ID: <200408300408.XAA00939@zion.cs.uiuc.edu> Changes in directory llvm-java/tools/classdump: classdump.cpp updated: 1.12 -> 1.13 Makefile updated: 1.3 -> 1.4 --- Log message: Make things compile again after the addition of LLVMsystem.a. --- Diffs of the changes: (+2 -2) Index: llvm-java/tools/classdump/classdump.cpp diff -u llvm-java/tools/classdump/classdump.cpp:1.12 llvm-java/tools/classdump/classdump.cpp:1.13 --- llvm-java/tools/classdump/classdump.cpp:1.12 Wed Aug 4 05:02:03 2004 +++ llvm-java/tools/classdump/classdump.cpp Sun Aug 29 23:08:49 2004 @@ -26,7 +26,7 @@ int main(int argc, char* argv[]) { - PrintStackTraceOnErrorSignal(); + sys::PrintStackTraceOnErrorSignal(); cl::ParseCommandLineOptions(argc, argv, "class dump utility"); Index: llvm-java/tools/classdump/Makefile diff -u llvm-java/tools/classdump/Makefile:1.3 llvm-java/tools/classdump/Makefile:1.4 --- llvm-java/tools/classdump/Makefile:1.3 Sat May 22 01:48:35 2004 +++ llvm-java/tools/classdump/Makefile Sun Aug 29 23:08:49 2004 @@ -11,6 +11,6 @@ TOOLNAME := classdump USEDLIBS := classfile -LLVMLIBS := support vmcore +LLVMLIBS := support vmcore LLVMsystem include $(LEVEL)/Makefile.common