From lattner at cs.uiuc.edu Mon Sep 20 00:01:17 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 20 Sep 2004 00:01:17 -0500 Subject: [llvm-commits] CVS: llvm/utils/countloc.sh Message-ID: <200409200501.AAA15672@apoc.cs.uiuc.edu> Changes in directory llvm/utils: countloc.sh updated: 1.1 -> 1.2 --- Log message: Don't count .lo files :) --- Diffs of the changes: (+1 -0) Index: llvm/utils/countloc.sh diff -u llvm/utils/countloc.sh:1.1 llvm/utils/countloc.sh:1.2 --- llvm/utils/countloc.sh:1.1 Mon Sep 6 14:06:27 2004 +++ llvm/utils/countloc.sh Mon Sep 20 00:01:04 2004 @@ -22,6 +22,7 @@ \! -name '*~' \ \! -name '#*' \ \! -name '*.ll' \ + \! -name '*.lo' \ \! -name '*.d' \ \! -name '*.dir' \ \! -name 'Sparc.burm.c' \ From alkis at cs.uiuc.edu Mon Sep 20 01:43:09 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Mon, 20 Sep 2004 01:43:09 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200409200643.BAA24618@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.242 -> 1.243 --- Log message: Fix loop condition so that we don't decrement off the beginning of the list. --- Diffs of the changes: (+5 -5) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.242 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.243 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.242 Sun Sep 19 14:18:10 2004 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Mon Sep 20 01:42:58 2004 @@ -3002,12 +3002,12 @@ // Otherwise, be a little bit agressive by scanning the local block where we // want to check to see if the pointer is already being loaded or stored - // from/to. If so, the previous load or store would hav already trapped, so - // there is no harm doing an extra load (also, CSE will later eliminate the - // load entirely). + // from/to. If so, the previous load or store would have already trapped, + // so there is no harm doing an extra load (also, CSE will later eliminate + // the load entirely). BasicBlock::iterator BBI = ScanFrom, E = ScanFrom->getParent()->begin(); - do { + while (BBI != E) { --BBI; if (LoadInst *LI = dyn_cast(BBI)) { @@ -3015,7 +3015,7 @@ } else if (StoreInst *SI = dyn_cast(BBI)) if (SI->getOperand(1) == V) return true; - } while (BBI != E); + } return false; } From reid at x10sys.com Mon Sep 20 02:21:29 2004 From: reid at x10sys.com (Reid Spencer) Date: Mon, 20 Sep 2004 02:21:29 -0500 Subject: [llvm-commits] CVS: llvm/utils/llvmdo Message-ID: <200409200721.CAA25412@zion.cs.uiuc.edu> Changes in directory llvm/utils: llvmdo updated: 1.2 -> 1.3 --- Log message: Fixed to actually work correctly and be the basis for other tools by allowing the set of directories searched to be specified either by the LLVMDO_DIRS env var or by the -dirs "dirs..." command line option. --- Diffs of the changes: (+39 -9) Index: llvm/utils/llvmdo diff -u llvm/utils/llvmdo:1.2 llvm/utils/llvmdo:1.3 --- llvm/utils/llvmdo:1.2 Fri Sep 17 23:40:46 2004 +++ llvm/utils/llvmdo Mon Sep 20 02:21:19 2004 @@ -1,32 +1,62 @@ #!/bin/sh # This is useful because it prints out all of the source files. Useful for # greps. + +if test $# -lt 1 ; then + echo "Usage: llvmdo [-dirs "DIRNAMES..."] PROGRAM ARGS..."; + exit 1; +fi + +if test "$1" = "-dirs" ; then + LLVMDO_DIRS="$2"; + shift ; shift +elif test -z "$LLVMDO_DIRS" ; then + LLVMDO_DIRS="include lib tools test utils docs examples projects" +fi PROGRAM=`which $1` -if [ ! -x "$PROGRAM" ]; then +if test ! -x "$PROGRAM" ; then echo "Can't execute $1" exit 1 fi shift; ARGS="$*" -TOPDIR=`pwd | sed -e 's#(.*/llvm).*#$1#'` +TOPDIR=`pwd | sed -e 's#\(.*/llvm\).*#\1#'` if test -d "$TOPDIR" ; then cd $TOPDIR - echo $TOPDIR - find docs include lib tools utils projects -type f \ - \( -path '*/doxygen/*' -o -path '*/Burg/*' \) -prune -o \ - -name '*.[cdhyl]*' \ + find $LLVMDO_DIRS -type f \ + \( \ + -path 'docs/doxygen/*' -o \ + -path 'docs/CommandGuide/html/*' -o \ + -path 'docs/CommandGuide/man/*' -o \ + -path 'docs/CommandGuide/ps/*' -o \ + -path 'docs/CommandGuide/man/*' -o \ + -path 'docs/HistoricalNotes/*' -o \ + -path 'utils/Burg/*' -o \ + -path 'docs/img/*' -o \ + -path '*/.libs/*' \ + \) -prune -o \( \ + -name '*.[cdhyltp]*' \ + \! -name '.*' \ \! -name '*~' \ \! -name '#*' \ - \! -name '*.ll' \ - \! -name '*.lo' \ \! -name '*.d' \ \! -name '*.dir' \ + \! -name '*.flc' \ + \! -name '*.inc' \ + \! -name '*.ll' \ + \! -name '*.llx' \ + \! -name '*.la' \ + \! -name '*.lo' \ \! -name 'Sparc.burm.c' \ \! -name 'llvmAsmParser.cpp' \ \! -name 'llvmAsmParser.h' \ \! -name 'FileParser.cpp' \ \! -name 'FileParser.h' \ - -exec $PROGRAM $ARGS {} \; + \! -name 'StackerParser.h' \ + \! -name 'StackerParser.cpp' \ + -exec $PROGRAM $ARGS {} \; \ + \) else echo "Can't find LLVM top directory in $TOPDIR" fi + From reid at x10sys.com Mon Sep 20 02:22:34 2004 From: reid at x10sys.com (Reid Spencer) Date: Mon, 20 Sep 2004 02:22:34 -0500 Subject: [llvm-commits] CVS: llvm/utils/countloc.sh llvmgrep getsrcs.sh Message-ID: <200409200722.CAA25468@zion.cs.uiuc.edu> Changes in directory llvm/utils: countloc.sh updated: 1.2 -> 1.3 llvmgrep updated: 1.5 -> 1.6 getsrcs.sh updated: 1.19 -> 1.20 --- Log message: Base the implementation on the llvmdo script so that we only have to maintain the logic for "what counts as a source file" in one place. --- Diffs of the changes: (+11 -38) Index: llvm/utils/countloc.sh diff -u llvm/utils/countloc.sh:1.2 llvm/utils/countloc.sh:1.3 --- llvm/utils/countloc.sh:1.2 Mon Sep 20 00:01:04 2004 +++ llvm/utils/countloc.sh Mon Sep 20 02:22:23 2004 @@ -15,22 +15,10 @@ # The script takes no arguments but does expect to be run from the top llvm # source directory. # -TOPDIR=`pwd | sed -e 's#(.*/llvm).*#$1#'` +TOPDIR=`pwd | sed -e 's#\(.*/llvm\).*#\1#'` if test -d "$TOPDIR" ; then cd $TOPDIR - find include lib tools utils examples -type f -name '*.[cdhyltp]*' \ - \! -name '*~' \ - \! -name '#*' \ - \! -name '*.ll' \ - \! -name '*.lo' \ - \! -name '*.d' \ - \! -name '*.dir' \ - \! -name 'Sparc.burm.c' \ - \! -name 'llvmAsmParser.cpp' \ - \! -name 'llvmAsmParser.h' \ - \! -name 'FileParser.cpp' \ - \! -name 'FileParser.h' \ - -exec wc -l {} \; | awk '\ + ./utils/llvmdo -dirs "include lib tools test utils examples" wc -l | awk '\ BEGIN { loc=0; } \ { loc += $1; } \ END { print loc; }' Index: llvm/utils/llvmgrep diff -u llvm/utils/llvmgrep:1.5 llvm/utils/llvmgrep:1.6 --- llvm/utils/llvmgrep:1.5 Fri Sep 17 23:40:46 2004 +++ llvm/utils/llvmgrep Mon Sep 20 02:22:23 2004 @@ -1,25 +1,10 @@ #!/bin/sh # This is useful because it prints out all of the source files. Useful for # greps. -PATTERN="$*" -TOPDIR=`pwd | sed -e 's#(.*/llvm).*#$1#'` +TOPDIR=`pwd | sed -e 's#\(.*/llvm\).*#\1#'` if test -d "$TOPDIR" ; then cd $TOPDIR - find docs include lib tools utils examples projects -type f \ - \( -path '*/doxygen/*' -o -path '*/Burg/*' \) -prune -o \ - -name '*.[cdhylt]*' \ - \! -name '*~' \ - \! -name '#*' \ - \! -name '*.ll' \ - \! -name '*.lo' \ - \! -name '*.d' \ - \! -name '*.dir' \ - \! -name 'Sparc.burm.c' \ - \! -name 'llvmAsmParser.cpp' \ - \! -name 'llvmAsmParser.h' \ - \! -name 'FileParser.cpp' \ - \! -name 'FileParser.h' \ - -exec egrep -H -n "$PATTERN" {} \; + ./utils/llvmdo -dirs "include lib tools utils docs examples test projects" egrep -H -n "$*" else echo "Can't find LLVM top directory in $TOPDIR" fi Index: llvm/utils/getsrcs.sh diff -u llvm/utils/getsrcs.sh:1.19 llvm/utils/getsrcs.sh:1.20 --- llvm/utils/getsrcs.sh:1.19 Tue Aug 24 12:42:33 2004 +++ llvm/utils/getsrcs.sh Mon Sep 20 02:22:23 2004 @@ -1,10 +1,10 @@ #!/bin/sh # This is useful because it prints out all of the source files. Useful for # greps. -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$' | \ - grep -v /Burg/ | grep -v '\.lo' | grep -v '\.inc$' | grep -v '\.libs' | \ - grep -v TableGen/FileParser.cpp | grep -v TableGen/FileParser.h - +TOPDIR=`pwd | sed -e 's#\(.*/llvm\).*#\1#'` +if test -d "$TOPDIR" ; then + cd $TOPDIR + ./utils/llvmdo -dirs "include lib tools utils examples projects" echo +else + echo "Can't find LLVM top directory in $TOPDIR" +fi From reid at x10sys.com Mon Sep 20 03:00:20 2004 From: reid at x10sys.com (Reid Spencer) Date: Mon, 20 Sep 2004 03:00:20 -0500 Subject: [llvm-commits] CVS: llvm/utils/llvmdo Message-ID: <200409200800.DAA26120@zion.cs.uiuc.edu> Changes in directory llvm/utils: llvmdo updated: 1.3 -> 1.4 --- Log message: Tighten up the specification of what counts as a code file. The previous specification was too liberal in some areas and missing things in others. This specification is based on the actual extensions found in the source tree. --- Diffs of the changes: (+60 -11) Index: llvm/utils/llvmdo diff -u llvm/utils/llvmdo:1.3 llvm/utils/llvmdo:1.4 --- llvm/utils/llvmdo:1.3 Mon Sep 20 02:21:19 2004 +++ llvm/utils/llvmdo Mon Sep 20 03:00:09 2004 @@ -1,5 +1,33 @@ #!/bin/sh -# This is useful because it prints out all of the source files. Useful for +##===- utils/llvmdo - Counts Lines Of Code -------------------*- Script -*-===## +# +# 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 script is a general purpose "apply" function for the source files in LLVM +# It uses "find" to locate all the source files and then applies the user's +# command to them. As such, this command is often not used by itself much but +# the other find related tools (countloc.sh,llvmgrep,getsrcs.sh) are all based +# on the implementation. This script defines "what is a source file" in LLVM and +# so should be maintained if new directories, new file extensions, etc. are +# used in LLVM as it progresses. +# +# Usage: +# llvmdo [-dirs "DIRNAMES..." PROGRAM ARGS... +# +# The -dirs argument allows you to specify the set of directories that are +# searched. By default, everything is searched +# (excluding certain things), runs "wc -l" on them to get the number of lines in +# each file and then sums up and prints the total with awk. +# +# The script takes no arguments but does expect to be run from the top llvm +# source directory. +# +# This script is # greps. if test $# -lt 1 ; then @@ -11,7 +39,7 @@ LLVMDO_DIRS="$2"; shift ; shift elif test -z "$LLVMDO_DIRS" ; then - LLVMDO_DIRS="include lib tools test utils docs examples projects" + LLVMDO_DIRS="include lib tools utils runtime autoconf docs test examples projects" fi PROGRAM=`which $1` if test ! -x "$PROGRAM" ; then @@ -35,18 +63,39 @@ -path 'docs/img/*' -o \ -path '*/.libs/*' \ \) -prune -o \( \ - -name '*.[cdhyltp]*' \ + \( \ + -name '*.cpp' -o \ + -name '*.h' -o \ + -name '*.def' -o \ + -name '*.c' -o \ + -name '*.l' -o \ + -name '*.y' -o \ + -name '*.td' -o \ + -name '*.py' -o \ + -name '*.pl' -o \ + -name '*.sh' -o \ + -name '*.lst' -o \ + -name '*.pod' -o \ + -name '*.html' -o \ + -name '*.css' -o \ + -name '*.cfg' -o \ + -name '*.cc' -o \ + -name '*.txt' -o \ + -name '*.TXT' -o \ + -name '*.el' -o \ + -name '*.m4' -o \ + -name '*.in' -o \ + -name '*.ac' -o \ + -name '*.tr' -o \ + -name '*.vim' -o \ + -name '*.gnuplot' -o \ + -name 'Make*' -o \ + -path 'test/*.ll' -o \ + -path 'runtime/*.ll' \ + \) \ \! -name '.*' \ \! -name '*~' \ \! -name '#*' \ - \! -name '*.d' \ - \! -name '*.dir' \ - \! -name '*.flc' \ - \! -name '*.inc' \ - \! -name '*.ll' \ - \! -name '*.llx' \ - \! -name '*.la' \ - \! -name '*.lo' \ \! -name 'Sparc.burm.c' \ \! -name 'llvmAsmParser.cpp' \ \! -name 'llvmAsmParser.h' \ From reid at x10sys.com Mon Sep 20 03:04:23 2004 From: reid at x10sys.com (Reid Spencer) Date: Mon, 20 Sep 2004 03:04:23 -0500 Subject: [llvm-commits] CVS: llvm/utils/llvmdo Message-ID: <200409200804.DAA26194@zion.cs.uiuc.edu> Changes in directory llvm/utils: llvmdo updated: 1.4 -> 1.5 --- Log message: Finish the documentation. --- Diffs of the changes: (+5 -9) Index: llvm/utils/llvmdo diff -u llvm/utils/llvmdo:1.4 llvm/utils/llvmdo:1.5 --- llvm/utils/llvmdo:1.4 Mon Sep 20 03:00:09 2004 +++ llvm/utils/llvmdo Mon Sep 20 03:04:13 2004 @@ -20,15 +20,11 @@ # llvmdo [-dirs "DIRNAMES..." PROGRAM ARGS... # # The -dirs argument allows you to specify the set of directories that are -# searched. By default, everything is searched -# (excluding certain things), runs "wc -l" on them to get the number of lines in -# each file and then sums up and prints the total with awk. -# -# The script takes no arguments but does expect to be run from the top llvm -# source directory. -# -# This script is -# greps. +# searched. By default, everything is searched. Note that you must use quotes +# around the list of directory names. After that you simply specify whatever +# program you want to run against each file and the arguments to give it. The +# PROGRAM will be given the file name as its last argument. +##===----------------------------------------------------------------------===## if test $# -lt 1 ; then echo "Usage: llvmdo [-dirs "DIRNAMES..."] PROGRAM ARGS..."; From reid at x10sys.com Mon Sep 20 03:09:47 2004 From: reid at x10sys.com (Reid Spencer) Date: Mon, 20 Sep 2004 03:09:47 -0500 Subject: [llvm-commits] CVS: llvm/utils/countloc.sh getsrcs.sh llvmgrep Message-ID: <200409200809.DAA23347@zion.cs.uiuc.edu> Changes in directory llvm/utils: countloc.sh updated: 1.3 -> 1.4 getsrcs.sh updated: 1.20 -> 1.21 llvmgrep updated: 1.6 -> 1.7 --- Log message: Documentation upgrade. --- Diffs of the changes: (+41 -6) Index: llvm/utils/countloc.sh diff -u llvm/utils/countloc.sh:1.3 llvm/utils/countloc.sh:1.4 --- llvm/utils/countloc.sh:1.3 Mon Sep 20 02:22:23 2004 +++ llvm/utils/countloc.sh Mon Sep 20 03:09:36 2004 @@ -12,9 +12,13 @@ # (excluding certain things), runs "wc -l" on them to get the number of lines in # each file and then sums up and prints the total with awk. # -# The script takes no arguments but does expect to be run from the top llvm -# source directory. +# The script takes no arguments but does expect to be run from somewhere in +# the top llvm source directory. # +# Note that the implementation is based on llvmdo. See that script for more +# details. +##===----------------------------------------------------------------------===## + TOPDIR=`pwd | sed -e 's#\(.*/llvm\).*#\1#'` if test -d "$TOPDIR" ; then cd $TOPDIR Index: llvm/utils/getsrcs.sh diff -u llvm/utils/getsrcs.sh:1.20 llvm/utils/getsrcs.sh:1.21 --- llvm/utils/getsrcs.sh:1.20 Mon Sep 20 02:22:23 2004 +++ llvm/utils/getsrcs.sh Mon Sep 20 03:09:36 2004 @@ -1,6 +1,20 @@ #!/bin/sh -# This is useful because it prints out all of the source files. Useful for -# greps. +##===- utils/getsrcs.sh - Counts Lines Of Code ---------------*- Script -*-===## +# +# The LLVM Compiler Infrastructure +# +# This file was developed by Chris Lattner and Reid Spencer and is distributed +# under the # University of Illinois Open Source License. See LICENSE.TXT for +# details. +# +##===----------------------------------------------------------------------===## +# +# This script just prints out the path names for all the source files in LLVM. +# +# Note that the implementation is based on llvmdo. See that script for more +# details. +##===----------------------------------------------------------------------===## + TOPDIR=`pwd | sed -e 's#\(.*/llvm\).*#\1#'` if test -d "$TOPDIR" ; then cd $TOPDIR Index: llvm/utils/llvmgrep diff -u llvm/utils/llvmgrep:1.6 llvm/utils/llvmgrep:1.7 --- llvm/utils/llvmgrep:1.6 Mon Sep 20 02:22:23 2004 +++ llvm/utils/llvmgrep Mon Sep 20 03:09:36 2004 @@ -1,6 +1,23 @@ #!/bin/sh -# This is useful because it prints out all of the source files. Useful for -# greps. +##===- utils/llvmgrep - Counts Lines Of Code -----------------*- Script -*-===## +# +# 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 script searches your srcdir for an egrep style pattern. This can quickly +# help you build a list of the places you need to modify when changing a header +# or other "global" name. The only argument is the pattern you want to search +# for. It should be quoted to escape shell interpretation of the pattern's +# special characters. +# +# Note that the implementation is based on llvmdo. See that script for more +# details. +##===----------------------------------------------------------------------===## + TOPDIR=`pwd | sed -e 's#\(.*/llvm\).*#\1#'` if test -d "$TOPDIR" ; then cd $TOPDIR From lattner at cs.uiuc.edu Mon Sep 20 05:14:41 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 20 Sep 2004 05:14:41 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/InstCombine/2004-09-20-BadLoadCombine.llx 2004-09-20-BadLoadCombine2.llx Message-ID: <200409201014.FAA18442@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/InstCombine: 2004-09-20-BadLoadCombine.llx added (r1.1) 2004-09-20-BadLoadCombine2.llx added (r1.1) --- Log message: Two testcases for invalid transformations that instcombine is doing --- Diffs of the changes: (+44 -0) Index: llvm/test/Regression/Transforms/InstCombine/2004-09-20-BadLoadCombine.llx diff -c /dev/null llvm/test/Regression/Transforms/InstCombine/2004-09-20-BadLoadCombine.llx:1.1 *** /dev/null Mon Sep 20 05:14:38 2004 --- llvm/test/Regression/Transforms/InstCombine/2004-09-20-BadLoadCombine.llx Mon Sep 20 05:14:27 2004 *************** *** 0 **** --- 1,20 ---- + ; RUN: llvm-as < %s | opt -instcombine -mem2reg | llvm-dis | not grep 'int 1' + + ; When propagating the load through the select, make sure that the load is + ; inserted where the original load was, not where the select is. Not doing + ; so could produce incorrect results! + + implementation + + int %test(bool %C) { + %X = alloca int + %X2 = alloca int + store int 1, int* %X + store int 2, int* %X2 + + %Y = select bool %C, int* %X, int* %X2 + store int 3, int* %X + %Z = load int* %Y + ret int %Z + } + Index: llvm/test/Regression/Transforms/InstCombine/2004-09-20-BadLoadCombine2.llx diff -c /dev/null llvm/test/Regression/Transforms/InstCombine/2004-09-20-BadLoadCombine2.llx:1.1 *** /dev/null Mon Sep 20 05:14:41 2004 --- llvm/test/Regression/Transforms/InstCombine/2004-09-20-BadLoadCombine2.llx Mon Sep 20 05:14:27 2004 *************** *** 0 **** --- 1,24 ---- + ; RUN: llvm-as < %s | opt -instcombine -mem2reg -simplifycfg | llvm-dis | \ + ; RUN: grep -v store | not grep 'int 1' + + ; Test to make sure that instcombine does not accidentally propagate the load + ; into the PHI, which would break the program. + + int %test(bool %C) { + entry: + %X = alloca int + %X2 = alloca int + store int 1, int* %X + store int 2, int* %X2 + br bool %C, label %cond_true.i, label %cond_continue.i + + cond_true.i: + br label %cond_continue.i + + cond_continue.i: + %mem_tmp.i.0 = phi int* [ %X, %cond_true.i ], [ %X2, %entry ] + store int 3, int* %X + %tmp.3 = load int* %mem_tmp.i.0 + ret int %tmp.3 + } + From lattner at cs.uiuc.edu Mon Sep 20 05:15:21 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 20 Sep 2004 05:15:21 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200409201015.FAA18455@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.243 -> 1.244 --- Log message: Fix potential miscompilations: InstCombine/2004-09-20-BadLoadCombine*.llx --- Diffs of the changes: (+19 -7) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.243 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.244 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.243 Mon Sep 20 01:42:58 2004 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Mon Sep 20 05:15:10 2004 @@ -3064,21 +3064,33 @@ if (isSafeToLoadUnconditionally(SI->getOperand(1), SI) && isSafeToLoadUnconditionally(SI->getOperand(2), SI)) { Value *V1 = InsertNewInstBefore(new LoadInst(SI->getOperand(1), - SI->getOperand(1)->getName()+".val"), *SI); + SI->getOperand(1)->getName()+".val"), LI); Value *V2 = InsertNewInstBefore(new LoadInst(SI->getOperand(2), - SI->getOperand(2)->getName()+".val"), *SI); + SI->getOperand(2)->getName()+".val"), LI); return new SelectInst(SI->getCondition(), V1, V2); } } else if (PHINode *PN = dyn_cast(Op)) { // load (phi (&V1, &V2, &V3)) --> phi(load &V1, load &V2, load &V3) - bool Safe = true; - for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) + bool Safe = PN->getParent() == LI.getParent(); + + // Scan all of the instructions between the PHI and the load to make + // sure there are no instructions that might possibly alter the value + // loaded from the PHI. + if (Safe) { + BasicBlock::iterator I = &LI; + for (--I; !isa(I); --I) + if (isa(I) || isa(I)) { + Safe = false; + break; + } + } + + for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e && Safe; ++i) if (!isSafeToLoadUnconditionally(PN->getIncomingValue(i), - PN->getIncomingBlock(i)->getTerminator())) { + PN->getIncomingBlock(i)->getTerminator())) Safe = false; - break; - } + if (Safe) { // Create the PHI. PHINode *NewPN = new PHINode(LI.getType(), PN->getName()); From alkis at cs.uiuc.edu Mon Sep 20 10:45:46 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Mon, 20 Sep 2004 10:45:46 -0500 Subject: [llvm-commits] CVS: llvm/autoconf/configure.ac Message-ID: <200409201545.KAA13814@zion.cs.uiuc.edu> Changes in directory llvm/autoconf: configure.ac updated: 1.113 -> 1.114 --- Log message: Use the right directory for the Java frontend --- Diffs of the changes: (+1 -1) Index: llvm/autoconf/configure.ac diff -u llvm/autoconf/configure.ac:1.113 llvm/autoconf/configure.ac:1.114 --- llvm/autoconf/configure.ac:1.113 Sun Sep 19 22:05:46 2004 +++ llvm/autoconf/configure.ac Mon Sep 20 10:45:36 2004 @@ -28,7 +28,7 @@ "llvm-test") AC_CONFIG_SUBDIRS([projects/llvm-test]) ;; "llvm-reopt") AC_CONFIG_SUBDIRS([projects/llvm-reopt]);; "llvm-gcc") AC_CONFIG_SUBDIRS([projects/llvm-gcc]) ;; - "llvm-java") AC_CONFIG_SUBDIRS([projects/llvm-java]) ;; + "Java") AC_CONFIG_SUBDIRS([projects/Java]) ;; "llvm-tv") AC_CONFIG_SUBDIRS([projects/llvm-tv]) ;; "llvm-fefw") AC_CONFIG_SUBDIRS([projects/llvm-fefw]) ;; *) AC_CONFIG_SUBDIRS(${i}) ;; From brukman at cs.uiuc.edu Mon Sep 20 13:39:42 2004 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Mon, 20 Sep 2004 13:39:42 -0500 Subject: [llvm-commits] CVS: llvm-test/Makefile.dummylib Makefile.programs Message-ID: <200409201839.NAA31521@zion.cs.uiuc.edu> Changes in directory llvm-test: Makefile.dummylib updated: 1.5 -> 1.6 Makefile.programs updated: 1.136 -> 1.137 --- Log message: Instead of $(LEVEL), refer to $(LLVM_{SRC,OBJ}_ROOT) to be consistent $(LEVEL) in llvm-test refers to top of llvm-test tree --- Diffs of the changes: (+4 -4) Index: llvm-test/Makefile.dummylib diff -u llvm-test/Makefile.dummylib:1.5 llvm-test/Makefile.dummylib:1.6 --- llvm-test/Makefile.dummylib:1.5 Sun Sep 5 02:56:51 2004 +++ llvm-test/Makefile.dummylib Mon Sep 20 13:39:32 2004 @@ -10,7 +10,7 @@ # external functions for dsanalysis. # DUMMYLIB := $(DESTLIBBYTECODE)/libdummy.bc -DUMMYSRC := $(LEVEL)/runtime/libdummy +DUMMYSRC := $(LLVM_SRC_ROOT)/runtime/libdummy # Rebuild dummylib if necessary... $(DUMMYLIB) : $(wildcard $(DUMMYSRC)/*.c) Index: llvm-test/Makefile.programs diff -u llvm-test/Makefile.programs:1.136 llvm-test/Makefile.programs:1.137 --- llvm-test/Makefile.programs:1.136 Sun Sep 5 02:56:51 2004 +++ llvm-test/Makefile.programs Mon Sep 20 13:39:32 2004 @@ -401,7 +401,7 @@ $(LBUGPOINT) $< -run-jit $(BUGPOINT_OPTIONS) $(BUGPOINT_ARGS) -LIBPROFILESO = $(LEVEL)/lib/Debug/libprofile_rt.so +LIBPROFILESO = $(LLVM_OBJ_ROOT)/lib/Debug/libprofile_rt.so $(PROGRAMS_TO_TEST:%=Output/%.prof): \ Output/%.prof: Output/%.llvm-prof.bc Output/%.out-nat $(LIBPROFILESO) @@ -529,7 +529,7 @@ # AVAILABLE_TESTS - Compute the set of tests available for user help # TEST_FILES = $(wildcard $(PROGDIR)/TEST.*.Makefile) \ - $(wildcard $(LEVEL)/projects/*/test/TEST.*.Makefile) + $(wildcard $(LLVM_SRC_ROOT)/projects/*/test/TEST.*.Makefile) AVAILABLE_TESTS = $(patsubst TEST.%.Makefile,%,$(notdir $(TEST_FILES))) # If they just say 'make test' then we print out an error telling the user to @@ -551,7 +551,7 @@ # ifdef TEST TestMakefile := $(wildcard $(PROGDIR)/TEST.$(TEST).Makefile) \ - $(wildcard $(LEVEL)/projects/*/test/TEST.$(TEST).Makefile) + $(wildcard $(LLVM_SRC_ROOT)/projects/*/test/TEST.$(TEST).Makefile) TestReport := $(wildcard $(PROGDIR)/TEST.$(TEST).report) \ $(wildcard $(BUILD_SRC_ROOT)/projects/*/test/TEST.$(TEST).report) TestGnuPlot := $(wildcard $(PROGDIR)/TEST.$(TEST).gnuplot) \ From brukman at cs.uiuc.edu Mon Sep 20 13:40:55 2004 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Mon, 20 Sep 2004 13:40:55 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/Makefile.spec Message-ID: <200409201840.NAA31559@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC: Makefile.spec updated: 1.40 -> 1.41 --- Log message: Instead of $(LEVEL), refer to $(LLVM_OBJ_ROOT) as that is where libs are built --- Diffs of the changes: (+1 -1) Index: llvm-test/External/SPEC/Makefile.spec diff -u llvm-test/External/SPEC/Makefile.spec:1.40 llvm-test/External/SPEC/Makefile.spec:1.41 --- llvm-test/External/SPEC/Makefile.spec:1.40 Mon Sep 6 22:36:04 2004 +++ llvm-test/External/SPEC/Makefile.spec Mon Sep 20 13:40:45 2004 @@ -180,7 +180,7 @@ -LIBPROFILESO = $(LEVEL)/lib/Debug/libprofile_rt.so +LIBPROFILESO = $(LLVM_OBJ_ROOT)/lib/Debug/libprofile_rt.so $(PROGRAMS_TO_TEST:%=Output/%.prof): \ Output/%.prof: Output/%.llvm-prof.bc Output/%.out-nat $(LIBPROFILESO) From brukman at cs.uiuc.edu Mon Sep 20 13:42:34 2004 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Mon, 20 Sep 2004 13:42:34 -0500 Subject: [llvm-commits] CVS: llvm-test/External/Makefile Message-ID: <200409201842.NAA31613@zion.cs.uiuc.edu> Changes in directory llvm-test/External: Makefile updated: 1.14 -> 1.15 --- Log message: include Makefile.external instead of Makefile.programs to allow local customizations --- Diffs of the changes: (+1 -1) Index: llvm-test/External/Makefile diff -u llvm-test/External/Makefile:1.14 llvm-test/External/Makefile:1.15 --- llvm-test/External/Makefile:1.14 Mon Sep 6 22:34:00 2004 +++ llvm-test/External/Makefile Mon Sep 20 13:42:24 2004 @@ -14,4 +14,4 @@ PARALLEL_DIRS := $(filter-out Povray/, $(PARALLEL_DIRS)) endif -include $(LEVEL)/Makefile.programs +include Makefile.external From gaeke at persephone.cs.uiuc.edu Mon Sep 20 13:55:27 2004 From: gaeke at persephone.cs.uiuc.edu (Brian Gaeke) Date: Mon, 20 Sep 2004 13:55:27 -0500 (CDT) Subject: [llvm-commits] CVS: llvm-test/SingleSource/Benchmarks/Shootout/ackermann.c Message-ID: <20040920185527.536F04ACF40@persephone.cs.uiuc.edu> Changes in directory llvm-test/SingleSource/Benchmarks/Shootout: ackermann.c updated: 1.3 -> 1.4 --- Log message: ack(3,12) takes more than 5 minutes on the sparcs... --- Diffs of the changes: (+2 -2) Index: llvm-test/SingleSource/Benchmarks/Shootout/ackermann.c diff -u llvm-test/SingleSource/Benchmarks/Shootout/ackermann.c:1.3 llvm-test/SingleSource/Benchmarks/Shootout/ackermann.c:1.4 --- llvm-test/SingleSource/Benchmarks/Shootout/ackermann.c:1.3 Tue Jun 8 12:21:42 2004 +++ llvm-test/SingleSource/Benchmarks/Shootout/ackermann.c Mon Sep 20 13:55:11 2004 @@ -1,5 +1,5 @@ /* -*- mode: c -*- - * $Id: ackermann.c,v 1.3 2004/06/08 17:21:42 lattner Exp $ + * $Id: ackermann.c,v 1.4 2004/09/20 18:55:11 gaeke Exp $ * http://www.bagley.org/~doug/shootout/ */ @@ -15,7 +15,7 @@ int main(int argc, char *argv[]) { - int n = ((argc == 2) ? atoi(argv[1]) : 12); + int n = ((argc == 2) ? atoi(argv[1]) : 8); printf("Ack(3,%d): %d\n", n, Ack(3, n)); return(0); From reid at x10sys.com Mon Sep 20 17:15:08 2004 From: reid at x10sys.com (Reid Spencer) Date: Mon, 20 Sep 2004 17:15:08 -0500 Subject: [llvm-commits] CVS: llvm/configure Message-ID: <200409202215.RAA32103@zion.cs.uiuc.edu> Changes in directory llvm: configure updated: 1.119 -> 1.120 --- Log message: Change the name of the "known" module for Java from llvm-java to Java. --- Diffs of the changes: (+4 -4) Index: llvm/configure diff -u llvm/configure:1.119 llvm/configure:1.120 --- llvm/configure:1.119 Sun Sep 19 23:09:56 2004 +++ llvm/configure Mon Sep 20 17:14:56 2004 @@ -433,7 +433,7 @@ ac_subdirs_all="$ac_subdirs_all projects/llvm-test" ac_subdirs_all="$ac_subdirs_all projects/llvm-reopt" ac_subdirs_all="$ac_subdirs_all projects/llvm-gcc" -ac_subdirs_all="$ac_subdirs_all projects/llvm-java" +ac_subdirs_all="$ac_subdirs_all projects/Java" ac_subdirs_all="$ac_subdirs_all projects/llvm-tv" ac_subdirs_all="$ac_subdirs_all projects/llvm-fefw" ac_subdirs_all="$ac_subdirs_all ${i}" @@ -1576,10 +1576,10 @@ subdirs="$subdirs projects/llvm-gcc" ;; - "llvm-java") + "Java") -subdirs="$subdirs projects/llvm-java" - ;; +subdirs="$subdirs projects/Java" + ;; "llvm-tv") subdirs="$subdirs projects/llvm-tv" From gaeke at cs.uiuc.edu Mon Sep 20 17:49:06 2004 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Mon, 20 Sep 2004 17:49:06 -0500 (CDT) Subject: [llvm-commits] CVS: reopt/lib/Inst/lib/Phase1/Makefile Message-ID: <200409202249.RAA00942@kain.cs.uiuc.edu> Changes in directory reopt/lib/Inst/lib/Phase1: Makefile updated: 1.3 -> 1.4 --- Log message: Disable building the shlib...the libtool-on-solaris shared library building bug is really cramping our style! I just wish I knew where to start to fix it... --- Diffs of the changes: (+0 -1) Index: reopt/lib/Inst/lib/Phase1/Makefile diff -u reopt/lib/Inst/lib/Phase1/Makefile:1.3 reopt/lib/Inst/lib/Phase1/Makefile:1.4 --- reopt/lib/Inst/lib/Phase1/Makefile:1.3 Thu Aug 21 14:40:59 2003 +++ reopt/lib/Inst/lib/Phase1/Makefile Mon Sep 20 17:48:55 2004 @@ -1,5 +1,4 @@ LEVEL = ../../../.. LIBRARYNAME = perf -SHARED_LIBRARY = 1 include $(LEVEL)/Makefile.common From gaeke at cs.uiuc.edu Mon Sep 20 17:49:06 2004 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Mon, 20 Sep 2004 17:49:06 -0500 (CDT) Subject: [llvm-commits] CVS: reopt/lib/Inst/lib/Phase1/Phase1.cpp Message-ID: <200409202249.RAA00946@kain.cs.uiuc.edu> Changes in directory reopt/lib/Inst/lib/Phase1: Phase1.cpp updated: 1.34 -> 1.35 --- Log message: Update Joel's code to work after pass manager changes. --- Diffs of the changes: (+3 -3) Index: reopt/lib/Inst/lib/Phase1/Phase1.cpp diff -u reopt/lib/Inst/lib/Phase1/Phase1.cpp:1.34 reopt/lib/Inst/lib/Phase1/Phase1.cpp:1.35 --- reopt/lib/Inst/lib/Phase1/Phase1.cpp:1.34 Thu Sep 2 11:55:43 2004 +++ reopt/lib/Inst/lib/Phase1/Phase1.cpp Mon Sep 20 17:48:56 2004 @@ -45,12 +45,12 @@ inst->getParent()->getInstList().erase(inst); } -class Phase1 : public Pass +class Phase1 : public ModulePass { public: Phase1(); void doInitialization(Module& m); - bool run(Module& m); + bool runOnModule(Module& m); private: // placeholder pairs holds: glob volatile ptr, glob temporary variable ptr @@ -443,7 +443,7 @@ new StoreInst(toTmpType, newTmp, ci); } -bool Phase1::run(Module& m) +bool Phase1::runOnModule(Module& m) { doInitialization(m); From gaeke at cs.uiuc.edu Mon Sep 20 17:49:07 2004 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Mon, 20 Sep 2004 17:49:07 -0500 (CDT) Subject: [llvm-commits] CVS: reopt/tools/dumptrace/Makefile Message-ID: <200409202249.RAA00954@kain.cs.uiuc.edu> Changes in directory reopt/tools/dumptrace: Makefile updated: 1.2 -> 1.3 --- Log message: We have to link these tools with libLLVMsystem. --- Diffs of the changes: (+1 -1) Index: reopt/tools/dumptrace/Makefile diff -u reopt/tools/dumptrace/Makefile:1.2 reopt/tools/dumptrace/Makefile:1.3 --- reopt/tools/dumptrace/Makefile:1.2 Wed Jun 30 01:33:14 2004 +++ reopt/tools/dumptrace/Makefile Mon Sep 20 17:48:57 2004 @@ -1,7 +1,7 @@ LEVEL = ../.. TOOLNAME = dumptrace USEDLIBS = traceio -LLVMLIBS = vmcore bcreader bcwriter analysis.a transformutils.a support.a +LLVMLIBS = vmcore bcreader bcwriter analysis.a transformutils.a support.a LLVMsystem.a TOOLLINKOPTS = $(PLATFORMLIBDL) From gaeke at cs.uiuc.edu Mon Sep 20 17:49:08 2004 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Mon, 20 Sep 2004 17:49:08 -0500 (CDT) Subject: [llvm-commits] CVS: reopt/tools/ttftest/Makefile Message-ID: <200409202249.RAA00958@kain.cs.uiuc.edu> Changes in directory reopt/tools/ttftest: Makefile updated: 1.2 -> 1.3 --- Log message: We have to link these tools with libLLVMsystem. --- Diffs of the changes: (+1 -1) Index: reopt/tools/ttftest/Makefile diff -u reopt/tools/ttftest/Makefile:1.2 reopt/tools/ttftest/Makefile:1.3 --- reopt/tools/ttftest/Makefile:1.2 Wed Jun 30 01:33:14 2004 +++ reopt/tools/ttftest/Makefile Mon Sep 20 17:48:57 2004 @@ -1,7 +1,7 @@ LEVEL = ../.. TOOLNAME = ttftest USEDLIBS = tracetofunction traceio -LLVMLIBS = vmcore bcreader bcwriter analysis.a transformutils.a support.a +LLVMLIBS = vmcore bcreader bcwriter analysis.a transformutils.a support.a LLVMsystem.a TOOLLINKOPTS = $(PLATFORMLIBDL) From alkis at cs.uiuc.edu Mon Sep 20 19:08:15 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Mon, 20 Sep 2004 19:08:15 -0500 Subject: [llvm-commits] CVS: llvm-java/lib/Compiler/Compiler.cpp Message-ID: <200409210008.TAA15009@zion.cs.uiuc.edu> Changes in directory llvm-java/lib/Compiler: Compiler.cpp updated: 1.106 -> 1.107 --- Log message: Initialize locals with the function arguments. This makes function calls complete. --- Diffs of the changes: (+25 -11) Index: llvm-java/lib/Compiler/Compiler.cpp diff -u llvm-java/lib/Compiler/Compiler.cpp:1.106 llvm-java/lib/Compiler/Compiler.cpp:1.107 --- llvm-java/lib/Compiler/Compiler.cpp:1.106 Sun Sep 19 17:38:00 2004 +++ llvm-java/lib/Compiler/Compiler.cpp Mon Sep 20 19:08:05 2004 @@ -51,12 +51,20 @@ typedef std::stack > OperandStack; typedef std::vector Locals; + inline bool isTwoSlotType(const Type* t) { + return t == Type::LongTy | t == Type::DoubleTy; + } + inline bool isTwoSlotValue(const Value* v) { - return v->getType() == Type::LongTy | v->getType() == Type::DoubleTy; + return isTwoSlotType(v->getType()); + } + + inline bool isOneSlotType(const Type* t) { + return !isTwoSlotType(t); } inline bool isOneSlotValue(const Value* v) { - return !isTwoSlotValue(v); + return isOneSlotType(v->getType()); } class Bytecode2BasicBlockMapper @@ -770,17 +778,23 @@ mapper.compute(); prologue_ = new BasicBlock("prologue"); + unsigned index = 0; + for (Function::aiterator + a = function->abegin(), ae = function->aend(); a != ae; ++a) { + // create a new local + locals_[index] = new AllocaInst( + a->getType(), NULL, "arg" + utostr(index), prologue_); + // initialize the local with the contents of this argument + new StoreInst(a, locals_[index], prologue_); + index += isTwoSlotType(a->getType()) ? 2 : 1; + } parse(codeAttr->getCode(), codeAttr->getCodeSize()); - // if the prologue is not empty, make it the entry block - // of the function with entry as its only successor - if (prologue_->empty()) - delete prologue_; - else { - function->getBasicBlockList().push_front(prologue_); - new BranchInst(prologue_->getNext(), prologue_); - } + // makethe prologue the entry block of the function with a + // fallthrough branch to the original entry block + function->getBasicBlockList().push_front(prologue_); + new BranchInst(prologue_->getNext(), prologue_); // now insert fall through branches to all basic blocks that // don't have a terminator @@ -874,7 +888,7 @@ // compile all other methods called by this method recursively for (unsigned i = 0; i != toCompileFunctions_.size(); ++i) { Function* f = toCompileFunctions_[i]; - compileMethodOnly(f->getName()); +// compileMethodOnly(f->getName()); } return function; From reid at x10sys.com Mon Sep 20 19:58:11 2004 From: reid at x10sys.com (Reid Spencer) Date: Mon, 20 Sep 2004 19:58:11 -0500 Subject: [llvm-commits] CVS: llvm-java/autoconf/AutoRegen.sh Message-ID: <200409210058.TAA15272@zion.cs.uiuc.edu> Changes in directory llvm-java/autoconf: AutoRegen.sh added (r1.1) --- Log message: A script for regenerating the configure script properly and easily. --- Diffs of the changes: (+41 -0) Index: llvm-java/autoconf/AutoRegen.sh diff -c /dev/null llvm-java/autoconf/AutoRegen.sh:1.1 *** /dev/null Mon Sep 20 19:58:10 2004 --- llvm-java/autoconf/AutoRegen.sh Mon Sep 20 19:58:00 2004 *************** *** 0 **** --- 1,41 ---- + #!/bin/sh + die () { + echo "$@" 1>&2 + exit 1 + } + test -d autoconf && test -f autoconf/configure.ac && cd autoconf + test -f configure.ac || die "Can't find 'autoconf' dir; please cd into it first" + autoconf --version | egrep '2\.59' > /dev/null + if test $? -ne 0 ; then + die "Your autoconf was not detected as being 2.59" + fi + aclocal --version | egrep '1\.9\.1' > /dev/null + if test $? -ne 0 ; then + die "Your aclocal was not detected as being 1.9.1" + fi + autoheader --version | egrep '2\.59' > /dev/null + if test $? -ne 0 ; then + die "Your autoheader was not detected as being 2.59" + fi + libtool --version | grep '1.5.10' > /dev/null + if test $? -ne 0 ; then + die "Your libtool was not detected as being 1.5.10" + fi + echo "" + echo "### NOTE: ############################################################" + echo "### If you get *any* warnings from autoconf below other than warnings" + echo "### about 'AC_CONFIG_SUBDIRS: you should use literals', you MUST fix" + echo "### the scripts in the m4 directory because there are future forward" + echo "### compatibility or platform support issues at risk. Please do NOT" + echo "### commit any configure.ac or configure script that was generated " + echo "### with warnings present." + echo "######################################################################" + echo "" + echo "Regenerating aclocal.m4 with aclocal" + save=`pwd` + cd ../../.. + m4dir=`pwd`/autoconf/m4 + cd $save + aclocal --force -I $m4dir || die "aclocal failed" + echo "Regenerating configure with autoconf 2.5x" + autoconf --force --warnings=all -o ../configure configure.ac || die "autoconf failed" From reid at x10sys.com Mon Sep 20 20:00:52 2004 From: reid at x10sys.com (Reid Spencer) Date: Mon, 20 Sep 2004 20:00:52 -0500 Subject: [llvm-commits] CVS: llvm-java/autoconf/configure.ac Message-ID: <200409210100.UAA15332@zion.cs.uiuc.edu> Changes in directory llvm-java/autoconf: configure.ac updated: 1.6 -> 1.7 --- Log message: Re-introduce required quoting to fix PR442: http://llvm.cs.uiuc.edu/PR442 . --- Diffs of the changes: (+9 -7) Index: llvm-java/autoconf/configure.ac diff -u llvm-java/autoconf/configure.ac:1.6 llvm-java/autoconf/configure.ac:1.7 --- llvm-java/autoconf/configure.ac:1.6 Tue May 18 14:23:31 2004 +++ llvm-java/autoconf/configure.ac Mon Sep 20 20:00:41 2004 @@ -1,10 +1,10 @@ dnl ************************************************************************** dnl * Initialize dnl ************************************************************************** -AC_INIT(Java, 0.0, llvmbugs at cs.uiuc.edu) +AC_INIT([[Java]], [[0.0]], [llvmbugs at cs.uiuc.edu]) dnl Place all of the extra autoconf files into the config subdirectory -AC_CONFIG_AUX_DIR(autoconf) +AC_CONFIG_AUX_DIR([autoconf]) dnl Configure a header file @@ -17,6 +17,8 @@ AC_CONFIG_MAKEFILE(tools/Makefile) AC_CONFIG_MAKEFILE(tools/classdump/Makefile) +AC_CONFIG_FILES(Makefile.common) + dnl ************************************************************************** dnl * Determine which system we are building on dnl ************************************************************************** @@ -57,19 +59,19 @@ dnl Location of LLVM source code AC_ARG_WITH([llvmsrc], - AC_HELP_STRING([--with-llvmsrc], + AS_HELP_STRING([--with-llvmsrc], [Location of LLVM Source Code]), AC_SUBST(LLVM_SRC,$withval), - AC_SUBST(LLVM_SRC,`cd ${srcdir}/../..; pwd`)) + AC_SUBST(LLVM_SRC,[`cd ${srcdir}/../..; pwd`])) dnl Location of LLVM object code AC_ARG_WITH([llvmobj], - AC_HELP_STRING([--with-llvmobj], + AS_HELP_STRING([--with-llvmobj], [Location of LLVM Object Code]), AC_SUBST(LLVM_OBJ,$withval), - AC_SUBST(LLVM_OBJ,`cd ../..; pwd`)) + AC_SUBST(LLVM_OBJ,[`cd ../..; pwd`])) dnl ************************************************************************** dnl * Create the output files dnl ************************************************************************** -AC_OUTPUT(Makefile.common) +AC_OUTPUT From reid at x10sys.com Mon Sep 20 20:23:51 2004 From: reid at x10sys.com (Reid Spencer) Date: Mon, 20 Sep 2004 20:23:51 -0500 Subject: [llvm-commits] CVS: llvm-java/configure Message-ID: <200409210123.UAA15483@zion.cs.uiuc.edu> Changes in directory llvm-java: configure updated: 1.5 -> 1.6 --- Log message: Fix for PR442: http://llvm.cs.uiuc.edu/PR442 --- Diffs of the changes: (+63 -52) Index: llvm-java/configure diff -u llvm-java/configure:1.5 llvm-java/configure:1.6 --- llvm-java/configure:1.5 Tue May 18 14:23:31 2004 +++ llvm-java/configure Mon Sep 20 20:23:40 2004 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.58 for Java 0.0. +# Generated by GNU Autoconf 2.59 for Java 0.0. # # Report bugs to . # @@ -268,7 +268,7 @@ # Identity of this package. PACKAGE_NAME='Java' -PACKAGE_TARNAME='java' +PACKAGE_TARNAME='-java-' PACKAGE_VERSION='0.0' PACKAGE_STRING='Java 0.0' PACKAGE_BUGREPORT='llvmbugs at cs.uiuc.edu' @@ -824,40 +824,43 @@ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac -case "$ac_dir" in -.) ac_abs_builddir=$ac_builddir;; + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; *) - case $ac_builddir in - .) ac_abs_builddir="$ac_dir";; - [\\/]* | ?:[\\/]* ) ac_abs_builddir=$ac_builddir;; - *) ac_abs_builddir="$ac_dir"/$ac_builddir;; + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac -case "$ac_dir" in +case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in - .) ac_abs_top_builddir="$ac_dir";; + .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir="$ac_dir"/${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac -case "$ac_dir" in +case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in - .) ac_abs_srcdir="$ac_dir";; + .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir="$ac_dir"/$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac -case "$ac_dir" in +case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in - .) ac_abs_top_srcdir="$ac_dir";; + .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir="$ac_dir"/$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac @@ -884,7 +887,7 @@ if $ac_init_version; then cat <<\_ACEOF Java configure 0.0 -generated by GNU Autoconf 2.58 +generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation @@ -898,7 +901,7 @@ running configure, to aid debugging if configure makes a mistake. It was created by Java $as_me 0.0, which was -generated by GNU Autoconf 2.58. Invocation command line was +generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -1278,6 +1281,9 @@ + ac_config_files="$ac_config_files Makefile.common" + + # Extract the first word of "jikes", so it can be a program name with args. set dummy jikes; ac_word=$2 @@ -1415,7 +1421,6 @@ fi; - ac_config_files="$ac_config_files Makefile.common" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure @@ -1810,7 +1815,7 @@ cat >&5 <<_CSEOF This file was extended by Java $as_me 0.0, which was -generated by GNU Autoconf 2.58. Invocation command line was +generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -1868,7 +1873,7 @@ cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ Java config.status 0.0 -configured by $0, generated by GNU Autoconf 2.58, +configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2003 Free Software Foundation, Inc. @@ -2197,40 +2202,43 @@ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac -case "$ac_dir" in -.) ac_abs_builddir=$ac_builddir;; + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; *) - case $ac_builddir in - .) ac_abs_builddir="$ac_dir";; - [\\/]* | ?:[\\/]* ) ac_abs_builddir=$ac_builddir;; - *) ac_abs_builddir="$ac_dir"/$ac_builddir;; + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac -case "$ac_dir" in +case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in - .) ac_abs_top_builddir="$ac_dir";; + .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir="$ac_dir"/${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac -case "$ac_dir" in +case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in - .) ac_abs_srcdir="$ac_dir";; + .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir="$ac_dir"/$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac -case "$ac_dir" in +case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in - .) ac_abs_top_srcdir="$ac_dir";; + .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir="$ac_dir"/$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac @@ -2377,40 +2385,43 @@ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac -case "$ac_dir" in -.) ac_abs_builddir=$ac_builddir;; + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; *) - case $ac_builddir in - .) ac_abs_builddir="$ac_dir";; - [\\/]* | ?:[\\/]* ) ac_abs_builddir=$ac_builddir;; - *) ac_abs_builddir="$ac_dir"/$ac_builddir;; + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac -case "$ac_dir" in +case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in - .) ac_abs_top_builddir="$ac_dir";; + .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir="$ac_dir"/${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac -case "$ac_dir" in +case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in - .) ac_abs_srcdir="$ac_dir";; + .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir="$ac_dir"/$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac -case "$ac_dir" in +case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in - .) ac_abs_top_srcdir="$ac_dir";; + .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir="$ac_dir"/$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac From lattner at cs.uiuc.edu Tue Sep 21 11:25:51 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 21 Sep 2004 11:25:51 -0500 Subject: [llvm-commits] CVS: llvm/include/Support/.cvsignore Message-ID: <200409211625.LAA16968@apoc.cs.uiuc.edu> Changes in directory llvm/include/Support: .cvsignore (r1.1) removed --- Log message: This is a dead directory now --- Diffs of the changes: (+0 -0) From lattner at cs.uiuc.edu Tue Sep 21 11:26:23 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 21 Sep 2004 11:26:23 -0500 Subject: [llvm-commits] CVS: llvm/include/Config/.cvsignore Message-ID: <200409211626.LAA16981@apoc.cs.uiuc.edu> Changes in directory llvm/include/Config: .cvsignore (r1.1) removed --- Log message: This is an empty directory --- Diffs of the changes: (+0 -0) From brukman at cs.uiuc.edu Tue Sep 21 11:53:39 2004 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Tue, 21 Sep 2004 11:53:39 -0500 Subject: [llvm-commits] CVS: llvm/docs/ExtendingLLVM.html Message-ID: <200409211653.LAA01487@zion.cs.uiuc.edu> Changes in directory llvm/docs: ExtendingLLVM.html updated: 1.12 -> 1.13 --- Log message: Thanks to Brad for documentation on adding a DerivedType --- Diffs of the changes: (+3 -2) Index: llvm/docs/ExtendingLLVM.html diff -u llvm/docs/ExtendingLLVM.html:1.12 llvm/docs/ExtendingLLVM.html:1.13 --- llvm/docs/ExtendingLLVM.html:1.12 Sat Sep 4 22:24:34 2004 +++ llvm/docs/ExtendingLLVM.html Tue Sep 21 11:53:29 2004 @@ -24,7 +24,8 @@
-

Written by Misha Brukman

+

Written by Misha Brukman and + Brad Jones

@@ -275,7 +276,7 @@ Misha Brukman
The LLVM Compiler Infrastructure
- Last modified: $Date: 2004/09/05 03:24:34 $ + Last modified: $Date: 2004/09/21 16:53:29 $ From brukman at cs.uiuc.edu Tue Sep 21 11:54:48 2004 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Tue, 21 Sep 2004 11:54:48 -0500 Subject: [llvm-commits] CVS: llvm/CREDITS.TXT Message-ID: <200409211654.LAA01515@zion.cs.uiuc.edu> Changes in directory llvm: CREDITS.TXT updated: 1.27 -> 1.28 --- Log message: Thanks to Brad Jones for packed type support! --- Diffs of the changes: (+5 -1) Index: llvm/CREDITS.TXT diff -u llvm/CREDITS.TXT:1.27 llvm/CREDITS.TXT:1.28 --- llvm/CREDITS.TXT:1.27 Tue Aug 24 00:40:25 2004 +++ llvm/CREDITS.TXT Tue Sep 21 11:54:37 2004 @@ -49,6 +49,10 @@ N: Louis Gerbarg D: Portions of the PowerPC backend +N: Brad Jones +E: kungfoomaster at nondot.org +D: Support for packed types + N: Chris Lattner E: sabre at nondot.org W: http://nondot.org/~sabre/ @@ -56,7 +60,7 @@ N: Vladimir Merzliakov E: wanderer at rsu.ru -D: Test suite fixes for FreeBSD. +D: Test suite fixes for FreeBSD N: Vladimir Prus E: ghost at cs.msu.su From reid at x10sys.com Tue Sep 21 12:11:03 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 21 Sep 2004 12:11:03 -0500 Subject: [llvm-commits] CVS: llvm/autoconf/m4/func_mmap_file.m4 Message-ID: <200409211711.MAA01853@zion.cs.uiuc.edu> Changes in directory llvm/autoconf/m4: func_mmap_file.m4 updated: 1.3 -> 1.4 --- Log message: Fix the program passed to AC_LANG_PROGRAM to be only the BODY of the main function, not the whole main function. This problem resulted during conversion of scripts to the new autoconf standard. The effect was that the mmap_file test would fail and if it does there is currently an #ifdef'd #error that causes compilation to fail. Bad, bad, bad. --- Diffs of the changes: (+2 -3) Index: llvm/autoconf/m4/func_mmap_file.m4 diff -u llvm/autoconf/m4/func_mmap_file.m4:1.3 llvm/autoconf/m4/func_mmap_file.m4:1.4 --- llvm/autoconf/m4/func_mmap_file.m4:1.3 Sun Sep 19 23:08:22 2004 +++ llvm/autoconf/m4/func_mmap_file.m4 Tue Sep 21 12:10:52 2004 @@ -12,12 +12,11 @@ #include ]],[[ int fd; - int main () { fd = creat ("foo",0777); fd = (int) mmap (0, 1, PROT_READ, MAP_SHARED, fd, 0); unlink ("foo"); - return (fd != (int) MAP_FAILED);}]])], - [ac_cv_func_mmap_file=yes], [ac_cv_func_mmap_file=no],[]) + return (fd != (int) MAP_FAILED);]])], + [ac_cv_func_mmap_file=yes],[ac_cv_func_mmap_file=no],[ac_cv_func_mmap_file=no]) AC_LANG_POP([C]) ]) if test "$ac_cv_func_mmap_file" = yes; then From reid at x10sys.com Tue Sep 21 12:12:45 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 21 Sep 2004 12:12:45 -0500 Subject: [llvm-commits] CVS: llvm/autoconf/configure.ac Message-ID: <200409211712.MAA01910@zion.cs.uiuc.edu> Changes in directory llvm/autoconf: configure.ac updated: 1.114 -> 1.115 --- Log message: Don't attempt to (illegally) configure a subdir if we don't recognize it. Instead just create a warning message that says the directory cannot be configured because it isn't recognized. This also gets rid of a bunch of warning messages from the auto* tools. --- Diffs of the changes: (+3 -1) Index: llvm/autoconf/configure.ac diff -u llvm/autoconf/configure.ac:1.114 llvm/autoconf/configure.ac:1.115 --- llvm/autoconf/configure.ac:1.114 Mon Sep 20 10:45:36 2004 +++ llvm/autoconf/configure.ac Tue Sep 21 12:12:35 2004 @@ -31,7 +31,9 @@ "Java") AC_CONFIG_SUBDIRS([projects/Java]) ;; "llvm-tv") AC_CONFIG_SUBDIRS([projects/llvm-tv]) ;; "llvm-fefw") AC_CONFIG_SUBDIRS([projects/llvm-fefw]) ;; - *) AC_CONFIG_SUBDIRS(${i}) ;; + *) + AC_MSG_WARN([Unknown projects (${i})won't be configured automatically]) + ;; esac fi done From reid at x10sys.com Tue Sep 21 12:13:34 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 21 Sep 2004 12:13:34 -0500 Subject: [llvm-commits] CVS: llvm/autoconf/AutoRegen.sh Message-ID: <200409211713.MAA01930@zion.cs.uiuc.edu> Changes in directory llvm/autoconf: AutoRegen.sh updated: 1.5 -> 1.6 --- Log message: Change the warning text so that NO warnings are permitted. This is now the case since the AC_CONFIG_SUBDIRS problem has been fixed. --- Diffs of the changes: (+4 -4) Index: llvm/autoconf/AutoRegen.sh diff -u llvm/autoconf/AutoRegen.sh:1.5 llvm/autoconf/AutoRegen.sh:1.6 --- llvm/autoconf/AutoRegen.sh:1.5 Sun Sep 19 17:30:53 2004 +++ llvm/autoconf/AutoRegen.sh Tue Sep 21 12:13:23 2004 @@ -23,12 +23,12 @@ fi echo "" echo "### NOTE: ############################################################" -echo "### If you get *any* warnings from autoconf below other than warnings" -echo "### about 'AC_CONFIG_SUBDIRS: you should use literals', you MUST fix" -echo "### the scripts in the m4 directory because there are future forward" +echo "### If you get *any* warnings from autoconf below you MUST fix the" +echo "### scripts in the m4 directory because there are future forward" echo "### compatibility or platform support issues at risk. Please do NOT" echo "### commit any configure.ac or configure script that was generated " -echo "### with warnings present." +echo "### with warnings present. You should get just three 'Regenerating..'" +echo "### lines." echo "######################################################################" echo "" echo "Regenerating aclocal.m4 with aclocal" From reid at x10sys.com Tue Sep 21 12:14:55 2004 From: reid at x10sys.com (Reid Spencer) Date: Tue, 21 Sep 2004 12:14:55 -0500 Subject: [llvm-commits] CVS: llvm/configure Message-ID: <200409211714.MAA01983@zion.cs.uiuc.edu> Changes in directory llvm: configure updated: 1.120 -> 1.121 --- Log message: Fix a problem where the mmap_file test was generating an incorrect test program that always failed (wouldn't compile). --- Diffs of the changes: (+33 -39) Index: llvm/configure diff -u llvm/configure:1.120 llvm/configure:1.121 --- llvm/configure:1.120 Mon Sep 20 17:14:56 2004 +++ llvm/configure Tue Sep 21 12:14:44 2004 @@ -436,7 +436,6 @@ ac_subdirs_all="$ac_subdirs_all projects/Java" ac_subdirs_all="$ac_subdirs_all projects/llvm-tv" ac_subdirs_all="$ac_subdirs_all projects/llvm-fefw" -ac_subdirs_all="$ac_subdirs_all ${i}" # Factoring default headers for most tests. ac_includes_default="\ #include @@ -1589,9 +1588,9 @@ subdirs="$subdirs projects/llvm-fefw" ;; *) - -subdirs="$subdirs ${i}" - ;; + { echo "$as_me:$LINENO: WARNING: Unknown projects (${i})won't be configured automatically" >&5 +echo "$as_me: WARNING: Unknown projects (${i})won't be configured automatically" >&2;} + ;; esac fi done @@ -4171,7 +4170,7 @@ ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 4174 "configure"' > conftest.$ac_ext + echo '#line 4173 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -5052,7 +5051,7 @@ # Provide some information about the compiler. -echo "$as_me:5055:" \ +echo "$as_me:5054:" \ "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 @@ -6109,11 +6108,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6112: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6111: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6116: \$? = $ac_status" >&5 + echo "$as_me:6115: \$? = $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 @@ -6352,11 +6351,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6355: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6354: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6359: \$? = $ac_status" >&5 + echo "$as_me:6358: \$? = $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 @@ -6412,11 +6411,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6415: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6414: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:6419: \$? = $ac_status" >&5 + echo "$as_me:6418: \$? = $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 @@ -8589,7 +8588,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:10875: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:10880: \$? = $ac_status" >&5 + echo "$as_me:10879: \$? = $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 @@ -10933,11 +10932,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:10936: $lt_compile\"" >&5) + (eval echo "\"\$as_me:10935: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:10940: \$? = $ac_status" >&5 + echo "$as_me:10939: \$? = $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 @@ -12294,7 +12293,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:13231: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13236: \$? = $ac_status" >&5 + echo "$as_me:13235: \$? = $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 @@ -13289,11 +13288,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13292: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13291: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13296: \$? = $ac_status" >&5 + echo "$as_me:13295: \$? = $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 @@ -15320,11 +15319,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15323: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15322: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15327: \$? = $ac_status" >&5 + echo "$as_me:15326: \$? = $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 @@ -15563,11 +15562,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15566: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15565: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15570: \$? = $ac_status" >&5 + echo "$as_me:15569: \$? = $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 @@ -15623,11 +15622,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15626: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15625: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:15630: \$? = $ac_status" >&5 + echo "$as_me:15629: \$? = $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 @@ -17800,7 +17799,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5 -echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } + ac_cv_func_mmap_file=no else cat >conftest.$ac_ext <<_ACEOF @@ -23244,11 +23239,10 @@ { int fd; - int main () { fd = creat ("foo",0777); fd = (int) mmap (0, 1, PROT_READ, MAP_SHARED, fd, 0); unlink ("foo"); - return (fd != (int) MAP_FAILED);} + return (fd != (int) MAP_FAILED); ; return 0; } From lattner at cs.uiuc.edu Tue Sep 21 12:31:08 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 21 Sep 2004 12:31:08 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/Skeleton/SkeletonInstrInfo.td Message-ID: <200409211731.MAA20998@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/Skeleton: SkeletonInstrInfo.td updated: 1.2 -> 1.3 --- Log message: Make sure to set the operand list --- Diffs of the changes: (+6 -5) Index: llvm/lib/Target/Skeleton/SkeletonInstrInfo.td diff -u llvm/lib/Target/Skeleton/SkeletonInstrInfo.td:1.2 llvm/lib/Target/Skeleton/SkeletonInstrInfo.td:1.3 --- llvm/lib/Target/Skeleton/SkeletonInstrInfo.td:1.2 Fri Jul 16 02:11:10 2004 +++ llvm/lib/Target/Skeleton/SkeletonInstrInfo.td Tue Sep 21 12:30:54 2004 @@ -21,19 +21,20 @@ def BForm : Format<2>; // Look at how other targets factor commonality between instructions. -class SkelInst opcd, Format f> : Instruction { +class SkelInst opcd, dag ops, Format f> : Instruction { let Namespace = "Skeleton"; let Name = nm; + let OperandList = ops; bits<6> Opcode = opcd; Format Form = f; bits<4> FormBits = Form.Value; } // Pseudo-instructions: -def PHI : SkelInst<"PHI", 0, Pseudo>; // PHI node... -def NOP : SkelInst<"NOP", 0, Pseudo>; // No-op -def ADJCALLSTACKDOWN : SkelInst<"ADJCALLSTACKDOWN", 0, Pseudo>; -def ADJCALLSTACKUP : SkelInst<"ADJCALLSTACKUP", 0, Pseudo>; +def PHI : SkelInst<"PHI", 0, (ops), Pseudo>; // PHI node... +def NOP : SkelInst<"NOP", 0, (ops), Pseudo>; // No-op +def ADJCALLSTACKDOWN : SkelInst<"ADJCALLSTACKDOWN", 0, (ops), Pseudo>; +def ADJCALLSTACKUP : SkelInst<"ADJCALLSTACKUP", 0, (ops), Pseudo>; From alkis at cs.uiuc.edu Tue Sep 21 13:08:43 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Tue, 21 Sep 2004 13:08:43 -0500 Subject: [llvm-commits] CVS: llvm-java/runtime/runtime.c Message-ID: <200409211808.NAA02603@zion.cs.uiuc.edu> Changes in directory llvm-java/runtime: runtime.c updated: 1.2 -> 1.3 --- Log message: Use C style comments. --- Diffs of the changes: (+3 -3) Index: llvm-java/runtime/runtime.c diff -u llvm-java/runtime/runtime.c:1.2 llvm-java/runtime/runtime.c:1.3 --- llvm-java/runtime/runtime.c:1.2 Wed Sep 15 13:06:47 2004 +++ llvm-java/runtime/runtime.c Tue Sep 21 13:08:33 2004 @@ -4,7 +4,7 @@ struct llvm_java_object_typeinfo; struct llvm_java_object_header { - // gc info, hash info, locking + /* gc info, hash info, locking */ }; struct llvm_java_object_base { @@ -36,11 +36,11 @@ struct llvm_java_object_vtable* objClazz = obj->vtable; if (objClazz == clazz) return 1; - // we are checking against a class' typeinfo + /* we are checking against a class' typeinfo */ if (clazz->typeinfo.interfaceFlag != (unsigned)-1) return objClazz->typeinfo.depth > clazz->typeinfo.depth && objClazz->typeinfo.vtables[objClazz->typeinfo.depth - clazz->typeinfo.depth - 1] == clazz; - // otherwise we are checking against an interface's typeinfo + /* otherwise we are checking against an interface's typeinfo */ else return objClazz->typeinfo.lastIface >= clazz->typeinfo.lastIface && objClazz->typeinfo.interfaces[clazz->typeinfo.lastIface]; From alkis at cs.uiuc.edu Tue Sep 21 13:12:55 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Tue, 21 Sep 2004 13:12:55 -0500 Subject: [llvm-commits] CVS: llvm-java/runtime/runtime.c Message-ID: <200409211812.NAA02655@zion.cs.uiuc.edu> Changes in directory llvm-java/runtime: runtime.c updated: 1.3 -> 1.4 --- Log message: Define VM internal types. --- Diffs of the changes: (+8 -2) Index: llvm-java/runtime/runtime.c diff -u llvm-java/runtime/runtime.c:1.3 llvm-java/runtime/runtime.c:1.4 --- llvm-java/runtime/runtime.c:1.3 Tue Sep 21 13:08:33 2004 +++ llvm-java/runtime/runtime.c Tue Sep 21 13:12:44 2004 @@ -3,6 +3,12 @@ struct llvm_java_object_vtable; struct llvm_java_object_typeinfo; +/* Define VM internal types */ +typedef struct llvm_java_object_base* jobject; +typedef unsigned jfieldID; +typedef unsigned jmethodID; +#define _JNI_VM_INTERNAL_TYPES_DEFINED + struct llvm_java_object_header { /* gc info, hash info, locking */ }; @@ -27,11 +33,11 @@ }; struct llvm_java_object_vtable* -llvm_java_GetObjectClass(struct llvm_java_object_base* obj) { +llvm_java_GetObjectClass(jobject obj) { return obj->vtable; } -int llvm_java_IsInstanceOf(struct llvm_java_object_base* obj, +int llvm_java_IsInstanceOf(jobject obj, struct llvm_java_object_vtable* clazz) { struct llvm_java_object_vtable* objClazz = obj->vtable; if (objClazz == clazz) From brukman at cs.uiuc.edu Tue Sep 21 13:21:32 2004 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Tue, 21 Sep 2004 13:21:32 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelSimple.cpp Message-ID: <200409211821.NAA04157@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelSimple.cpp updated: 1.279 -> 1.280 --- Log message: s/ISel/X86ISel/ to have unique class names for debugging via gdb because the C++ front-end in gcc does not mangle classes in anonymous namespaces correctly. --- Diffs of the changes: (+94 -91) Index: llvm/lib/Target/X86/X86ISelSimple.cpp diff -u llvm/lib/Target/X86/X86ISelSimple.cpp:1.279 llvm/lib/Target/X86/X86ISelSimple.cpp:1.280 --- llvm/lib/Target/X86/X86ISelSimple.cpp:1.279 Wed Sep 15 12:06:41 2004 +++ llvm/lib/Target/X86/X86ISelSimple.cpp Tue Sep 21 13:21:21 2004 @@ -74,7 +74,7 @@ } namespace { - struct ISel : public FunctionPass, InstVisitor { + struct X86ISel : public FunctionPass, InstVisitor { TargetMachine &TM; MachineFunction *F; // The function we are compiling into MachineBasicBlock *BB; // The current MBB we are compiling @@ -90,7 +90,7 @@ // FrameIndex for the alloca. std::map AllocaMap; - ISel(TargetMachine &tm) : TM(tm), F(0), BB(0) {} + X86ISel(TargetMachine &tm) : TM(tm), F(0), BB(0) {} /// runOnFunction - Top level implementation of instruction selection for /// the entire function. @@ -388,8 +388,8 @@ /// getReg - This method turns an LLVM value into a register number. /// -unsigned ISel::getReg(Value *V, MachineBasicBlock *MBB, - MachineBasicBlock::iterator IPt) { +unsigned X86ISel::getReg(Value *V, MachineBasicBlock *MBB, + MachineBasicBlock::iterator IPt) { // If this operand is a constant, emit the code to copy the constant into // the register here... if (Constant *C = dyn_cast(V)) { @@ -423,7 +423,7 @@ /// getFixedSizedAllocaFI - Return the frame index for a fixed sized alloca /// that is to be statically allocated with the initial stack frame /// adjustment. -unsigned ISel::getFixedSizedAllocaFI(AllocaInst *AI) { +unsigned X86ISel::getFixedSizedAllocaFI(AllocaInst *AI) { // Already computed this? std::map::iterator I = AllocaMap.lower_bound(AI); if (I != AllocaMap.end() && I->first == AI) return I->second; @@ -444,9 +444,9 @@ /// copyConstantToRegister - Output the instructions required to put the /// specified constant into the specified register. /// -void ISel::copyConstantToRegister(MachineBasicBlock *MBB, - MachineBasicBlock::iterator IP, - Constant *C, unsigned R) { +void X86ISel::copyConstantToRegister(MachineBasicBlock *MBB, + MachineBasicBlock::iterator IP, + Constant *C, unsigned R) { if (ConstantExpr *CE = dyn_cast(C)) { unsigned Class = 0; switch (CE->getOpcode()) { @@ -557,7 +557,7 @@ /// LoadArgumentsToVirtualRegs - Load all of the arguments to this function from /// the stack into virtual registers. /// -void ISel::LoadArgumentsToVirtualRegs(Function &Fn) { +void X86ISel::LoadArgumentsToVirtualRegs(Function &Fn) { // Emit instructions to load the arguments... On entry to a function on the // X86, the stack frame looks like this: // @@ -634,7 +634,7 @@ /// because we have to generate our sources into the source basic blocks, not /// the current one. /// -void ISel::SelectPHINodes() { +void X86ISel::SelectPHINodes() { const TargetInstrInfo &TII = *TM.getInstrInfo(); const Function &LF = *F->getFunction(); // The LLVM function... for (Function::const_iterator I = LF.begin(), E = LF.end(); I != E; ++I) { @@ -772,7 +772,7 @@ // break critical edges as needed (to make a place to put compensation code), // but this will require some infrastructure improvements as well. // -void ISel::InsertFPRegKills() { +void X86ISel::InsertFPRegKills() { SSARegMap &RegMap = *F->getSSARegMap(); for (MachineFunction::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) { @@ -810,7 +810,7 @@ } -void ISel::getAddressingMode(Value *Addr, X86AddressMode &AM) { +void X86ISel::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)) { @@ -888,8 +888,8 @@ /// emitUCOMr - In the future when we support processors before the P6, this /// wraps the logic for emitting an FUCOMr vs FUCOMIr. -void ISel::emitUCOMr(MachineBasicBlock *MBB, MachineBasicBlock::iterator IP, - unsigned LHS, unsigned RHS) { +void X86ISel::emitUCOMr(MachineBasicBlock *MBB, MachineBasicBlock::iterator IP, + unsigned LHS, unsigned RHS) { if (0) { // for processors prior to the P6 BuildMI(*MBB, IP, X86::FUCOMr, 2).addReg(LHS).addReg(RHS); BuildMI(*MBB, IP, X86::FNSTSW8r, 0); @@ -901,9 +901,9 @@ // EmitComparison - This function emits a comparison of the two operands, // returning the extended setcc code to use. -unsigned ISel::EmitComparison(unsigned OpNum, Value *Op0, Value *Op1, - MachineBasicBlock *MBB, - MachineBasicBlock::iterator IP) { +unsigned X86ISel::EmitComparison(unsigned OpNum, Value *Op0, Value *Op1, + MachineBasicBlock *MBB, + MachineBasicBlock::iterator IP) { // The arguments are already supposed to be of the same type. const Type *CompTy = Op0->getType(); unsigned Class = getClassB(CompTy); @@ -1061,7 +1061,7 @@ /// SetCC instructions - Here we just emit boilerplate code to set a byte-sized /// register, then move it to wherever the result should be. /// -void ISel::visitSetCondInst(SetCondInst &I) { +void X86ISel::visitSetCondInst(SetCondInst &I) { if (canFoldSetCCIntoBranchOrSelect(&I)) return; // Fold this into a branch or select. @@ -1074,10 +1074,10 @@ /// emitSetCCOperation - Common code shared between visitSetCondInst and /// constant expression support. /// -void ISel::emitSetCCOperation(MachineBasicBlock *MBB, - MachineBasicBlock::iterator IP, - Value *Op0, Value *Op1, unsigned Opcode, - unsigned TargetReg) { +void X86ISel::emitSetCCOperation(MachineBasicBlock *MBB, + MachineBasicBlock::iterator IP, + Value *Op0, Value *Op1, unsigned Opcode, + unsigned TargetReg) { unsigned OpNum = getSetCCNumber(Opcode); OpNum = EmitComparison(OpNum, Op0, Op1, MBB, IP); @@ -1095,7 +1095,7 @@ } } -void ISel::visitSelectInst(SelectInst &SI) { +void X86ISel::visitSelectInst(SelectInst &SI) { unsigned DestReg = getReg(SI); MachineBasicBlock::iterator MII = BB->end(); emitSelectOperation(BB, MII, SI.getCondition(), SI.getTrueValue(), @@ -1104,10 +1104,10 @@ /// emitSelect - Common code shared between visitSelectInst and the constant /// expression support. -void ISel::emitSelectOperation(MachineBasicBlock *MBB, - MachineBasicBlock::iterator IP, - Value *Cond, Value *TrueVal, Value *FalseVal, - unsigned DestReg) { +void X86ISel::emitSelectOperation(MachineBasicBlock *MBB, + MachineBasicBlock::iterator IP, + Value *Cond, Value *TrueVal, Value *FalseVal, + unsigned DestReg) { unsigned SelectClass = getClassB(TrueVal->getType()); // We don't support 8-bit conditional moves. If we have incoming constants, @@ -1267,7 +1267,7 @@ /// promote32 - Emit instructions to turn a narrow operand into a 32-bit-wide /// operand, in the specified target register. /// -void ISel::promote32(unsigned targetReg, const ValueRecord &VR) { +void X86ISel::promote32(unsigned targetReg, const ValueRecord &VR) { bool isUnsigned = VR.Ty->isUnsigned() || VR.Ty == Type::BoolTy; Value *Val = VR.Val; @@ -1325,7 +1325,7 @@ /// ret long, ulong : Move value into EAX/EDX and return /// ret float/double : Top of FP stack /// -void ISel::visitReturnInst(ReturnInst &I) { +void X86ISel::visitReturnInst(ReturnInst &I) { if (I.getNumOperands() == 0) { BuildMI(BB, X86::RET, 0); // Just emit a 'ret' instruction return; @@ -1375,7 +1375,7 @@ /// jump to a block that is the immediate successor of the current block, we can /// just make a fall-through (but we don't currently). /// -void ISel::visitBranchInst(BranchInst &BI) { +void X86ISel::visitBranchInst(BranchInst &BI) { // Update machine-CFG edges BB->addSuccessor (MBBMap[BI.getSuccessor(0)]); if (BI.isConditional()) @@ -1454,9 +1454,8 @@ /// and the return value as appropriate. For the actual function call itself, /// it inserts the specified CallMI instruction into the stream. /// -void ISel::doCall(const ValueRecord &Ret, MachineInstr *CallMI, - const std::vector &Args) { - +void X86ISel::doCall(const ValueRecord &Ret, MachineInstr *CallMI, + const std::vector &Args) { // Count how many bytes are to be pushed on the stack... unsigned NumBytes = 0; @@ -1591,7 +1590,7 @@ /// visitCallInst - Push args on stack and do a procedure call instruction. -void ISel::visitCallInst(CallInst &CI) { +void X86ISel::visitCallInst(CallInst &CI) { MachineInstr *TheCall; if (Function *F = CI.getCalledFunction()) { // Is it an intrinsic function call? @@ -1619,7 +1618,7 @@ /// function, lowering any calls to unknown intrinsic functions into the /// equivalent LLVM code. /// -void ISel::LowerUnknownIntrinsicFunctionCalls(Function &F) { +void X86ISel::LowerUnknownIntrinsicFunctionCalls(Function &F) { for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ) if (CallInst *CI = dyn_cast(I++)) @@ -1669,7 +1668,7 @@ } } -void ISel::visitIntrinsicCall(Intrinsic::ID ID, CallInst &CI) { +void X86ISel::visitIntrinsicCall(Intrinsic::ID ID, CallInst &CI) { unsigned TmpReg1, TmpReg2; switch (ID) { case Intrinsic::vastart: @@ -1952,7 +1951,7 @@ /// OperatorClass is one of: 0 for Add, 1 for Sub, 2 for And, 3 for Or, 4 for /// Xor. /// -void ISel::visitSimpleBinary(BinaryOperator &B, unsigned OperatorClass) { +void X86ISel::visitSimpleBinary(BinaryOperator &B, unsigned OperatorClass) { unsigned DestReg = getReg(B); MachineBasicBlock::iterator MI = BB->end(); Value *Op0 = B.getOperand(0), *Op1 = B.getOperand(1); @@ -2035,11 +2034,10 @@ /// emitBinaryFPOperation - This method handles emission of floating point /// Add (0), Sub (1), Mul (2), and Div (3) operations. -void ISel::emitBinaryFPOperation(MachineBasicBlock *BB, - MachineBasicBlock::iterator IP, - Value *Op0, Value *Op1, - unsigned OperatorClass, unsigned DestReg) { - +void X86ISel::emitBinaryFPOperation(MachineBasicBlock *BB, + MachineBasicBlock::iterator IP, + Value *Op0, Value *Op1, + unsigned OperatorClass, unsigned DestReg) { // Special case: op Reg, if (ConstantFP *Op1C = dyn_cast(Op1)) if (!Op1C->isExactlyValue(+0.0) && !Op1C->isExactlyValue(+1.0)) { @@ -2107,10 +2105,11 @@ /// emitSimpleBinaryOperation - Common code shared between visitSimpleBinary /// and constant expression support. /// -void ISel::emitSimpleBinaryOperation(MachineBasicBlock *MBB, - MachineBasicBlock::iterator IP, - Value *Op0, Value *Op1, - unsigned OperatorClass, unsigned DestReg) { +void X86ISel::emitSimpleBinaryOperation(MachineBasicBlock *MBB, + MachineBasicBlock::iterator IP, + Value *Op0, Value *Op1, + unsigned OperatorClass, + unsigned DestReg) { unsigned Class = getClassB(Op0->getType()); if (Class == cFP) { @@ -2280,9 +2279,10 @@ /// registers op0Reg and op1Reg, and put the result in DestReg. The type of the /// result should be given as DestTy. /// -void ISel::doMultiply(MachineBasicBlock *MBB, MachineBasicBlock::iterator MBBI, - unsigned DestReg, const Type *DestTy, - unsigned op0Reg, unsigned op1Reg) { +void X86ISel::doMultiply(MachineBasicBlock *MBB, + MachineBasicBlock::iterator MBBI, + unsigned DestReg, const Type *DestTy, + unsigned op0Reg, unsigned op1Reg) { unsigned Class = getClass(DestTy); switch (Class) { case cInt: @@ -2316,10 +2316,10 @@ /// doMultiplyConst - This function is specialized to efficiently codegen an 8, /// 16, or 32-bit integer multiply by a constant. -void ISel::doMultiplyConst(MachineBasicBlock *MBB, - MachineBasicBlock::iterator IP, - unsigned DestReg, const Type *DestTy, - unsigned op0Reg, unsigned ConstRHS) { +void X86ISel::doMultiplyConst(MachineBasicBlock *MBB, + MachineBasicBlock::iterator IP, + unsigned DestReg, const Type *DestTy, + unsigned op0Reg, unsigned ConstRHS) { static const unsigned MOVrrTab[] = {X86::MOV8rr, X86::MOV16rr, X86::MOV32rr}; static const unsigned MOVriTab[] = {X86::MOV8ri, X86::MOV16ri, X86::MOV32ri}; static const unsigned ADDrrTab[] = {X86::ADD8rr, X86::ADD16rr, X86::ADD32rr}; @@ -2431,7 +2431,7 @@ /// visitMul - Multiplies are not simple binary operators because they must deal /// with the EAX register explicitly. /// -void ISel::visitMul(BinaryOperator &I) { +void X86ISel::visitMul(BinaryOperator &I) { unsigned ResultReg = getReg(I); Value *Op0 = I.getOperand(0); @@ -2466,8 +2466,9 @@ emitMultiply(BB, IP, Op0, Op1, ResultReg); } -void ISel::emitMultiply(MachineBasicBlock *MBB, MachineBasicBlock::iterator IP, - Value *Op0, Value *Op1, unsigned DestReg) { +void X86ISel::emitMultiply(MachineBasicBlock *MBB, + MachineBasicBlock::iterator IP, + Value *Op0, Value *Op1, unsigned DestReg) { MachineBasicBlock &BB = *MBB; TypeClass Class = getClass(Op0->getType()); @@ -2578,7 +2579,7 @@ /// select the result from a different register. Note that both of these /// instructions work differently for signed and unsigned operands. /// -void ISel::visitDivRem(BinaryOperator &I) { +void X86ISel::visitDivRem(BinaryOperator &I) { unsigned ResultReg = getReg(I); Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1); @@ -2628,10 +2629,10 @@ I.getOpcode() == Instruction::Div, ResultReg); } -void ISel::emitDivRemOperation(MachineBasicBlock *BB, - MachineBasicBlock::iterator IP, - Value *Op0, Value *Op1, bool isDiv, - unsigned ResultReg) { +void X86ISel::emitDivRemOperation(MachineBasicBlock *BB, + MachineBasicBlock::iterator IP, + Value *Op0, Value *Op1, bool isDiv, + unsigned ResultReg) { const Type *Ty = Op0->getType(); unsigned Class = getClass(Ty); switch (Class) { @@ -2770,7 +2771,7 @@ /// shift values equal to 1. Even the general case is sort of special, /// because the shift amount has to be in CL, not just any old register. /// -void ISel::visitShiftInst(ShiftInst &I) { +void X86ISel::visitShiftInst(ShiftInst &I) { MachineBasicBlock::iterator IP = BB->end (); emitShiftOperation (BB, IP, I.getOperand (0), I.getOperand (1), I.getOpcode () == Instruction::Shl, I.getType (), @@ -2779,10 +2780,11 @@ /// emitShiftOperation - Common code shared between visitShiftInst and /// constant expression support. -void ISel::emitShiftOperation(MachineBasicBlock *MBB, - MachineBasicBlock::iterator IP, - Value *Op, Value *ShiftAmount, bool isLeftShift, - const Type *ResultTy, unsigned DestReg) { +void X86ISel::emitShiftOperation(MachineBasicBlock *MBB, + MachineBasicBlock::iterator IP, + Value *Op, Value *ShiftAmount, + bool isLeftShift, const Type *ResultTy, + unsigned DestReg) { unsigned SrcReg = getReg (Op, MBB, IP); bool isSigned = ResultTy->isSigned (); unsigned Class = getClass (ResultTy); @@ -2919,7 +2921,7 @@ /// instruction. The load and store instructions are the only place where we /// need to worry about the memory layout of the target machine. /// -void ISel::visitLoadInst(LoadInst &I) { +void X86ISel::visitLoadInst(LoadInst &I) { // Check to see if this load instruction is going to be folded into a binary // instruction, like add. If so, we don't want to emit it. Wouldn't a real // pattern matching instruction selector be nice? @@ -3030,7 +3032,7 @@ /// visitStoreInst - Implement LLVM store instructions in terms of the x86 'mov' /// instruction. /// -void ISel::visitStoreInst(StoreInst &I) { +void X86ISel::visitStoreInst(StoreInst &I) { X86AddressMode AM; getAddressingMode(I.getOperand(1), AM); @@ -3097,7 +3099,7 @@ /// visitCastInst - Here we have various kinds of copying with or without sign /// extension going on. /// -void ISel::visitCastInst(CastInst &CI) { +void X86ISel::visitCastInst(CastInst &CI) { Value *Op = CI.getOperand(0); unsigned SrcClass = getClassB(Op->getType()); @@ -3143,10 +3145,10 @@ /// emitCastOperation - Common code shared between visitCastInst and constant /// expression cast support. /// -void ISel::emitCastOperation(MachineBasicBlock *BB, - MachineBasicBlock::iterator IP, - Value *Src, const Type *DestTy, - unsigned DestReg) { +void X86ISel::emitCastOperation(MachineBasicBlock *BB, + MachineBasicBlock::iterator IP, + Value *Src, const Type *DestTy, + unsigned DestReg) { const Type *SrcTy = Src->getType(); unsigned SrcClass = getClassB(SrcTy); unsigned DestClass = getClassB(DestTy); @@ -3432,7 +3434,7 @@ /// visitVANextInst - Implement the va_next instruction... /// -void ISel::visitVANextInst(VANextInst &I) { +void X86ISel::visitVANextInst(VANextInst &I) { unsigned VAList = getReg(I.getOperand(0)); unsigned DestReg = getReg(I); @@ -3458,7 +3460,7 @@ BuildMI(BB, X86::ADD32ri, 2, DestReg).addReg(VAList).addImm(Size); } -void ISel::visitVAArgInst(VAArgInst &I) { +void X86ISel::visitVAArgInst(VAArgInst &I) { unsigned VAList = getReg(I.getOperand(0)); unsigned DestReg = getReg(I); @@ -3485,7 +3487,7 @@ /// visitGetElementPtrInst - instruction-select GEP instructions /// -void ISel::visitGetElementPtrInst(GetElementPtrInst &I) { +void X86ISel::visitGetElementPtrInst(GetElementPtrInst &I) { // If this GEP instruction will be folded into all of its users, we don't need // to explicitly calculate it! X86AddressMode AM; @@ -3522,10 +3524,11 @@ /// /// Note that there is one fewer entry in GEPTypes than there is in GEPOps. /// -void ISel::getGEPIndex(MachineBasicBlock *MBB, MachineBasicBlock::iterator IP, - std::vector &GEPOps, - std::vector &GEPTypes, - X86AddressMode &AM) { +void X86ISel::getGEPIndex(MachineBasicBlock *MBB, + MachineBasicBlock::iterator IP, + std::vector &GEPOps, + std::vector &GEPTypes, + X86AddressMode &AM) { const TargetData &TD = TM.getTargetData(); // Clear out the state we are working with... @@ -3619,9 +3622,9 @@ /// isGEPFoldable - Return true if the specified GEP can be completely /// 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, X86AddressMode &AM) { +bool X86ISel::isGEPFoldable(MachineBasicBlock *MBB, + Value *Src, User::op_iterator IdxBegin, + User::op_iterator IdxEnd, X86AddressMode &AM) { std::vector GEPOps; GEPOps.resize(IdxEnd-IdxBegin+1); @@ -3640,10 +3643,10 @@ return GEPOps.empty(); } -void ISel::emitGEPOperation(MachineBasicBlock *MBB, - MachineBasicBlock::iterator IP, - Value *Src, User::op_iterator IdxBegin, - User::op_iterator IdxEnd, unsigned TargetReg) { +void X86ISel::emitGEPOperation(MachineBasicBlock *MBB, + MachineBasicBlock::iterator IP, + Value *Src, User::op_iterator IdxBegin, + User::op_iterator IdxEnd, unsigned TargetReg) { const TargetData &TD = TM.getTargetData(); // If this is a getelementptr null, with all constant integer indices, just @@ -3774,7 +3777,7 @@ /// visitAllocaInst - If this is a fixed size alloca, allocate space from the /// frame manager, otherwise do it the hard way. /// -void ISel::visitAllocaInst(AllocaInst &I) { +void X86ISel::visitAllocaInst(AllocaInst &I) { // If this is a fixed size alloca in the entry block for the function, we // statically stack allocate the space, so we don't need to do anything here. // @@ -3816,7 +3819,7 @@ /// visitMallocInst - Malloc instructions are code generated into direct calls /// to the library malloc. /// -void ISel::visitMallocInst(MallocInst &I) { +void X86ISel::visitMallocInst(MallocInst &I) { unsigned AllocSize = TM.getTargetData().getTypeSize(I.getAllocatedType()); unsigned Arg; @@ -3840,7 +3843,7 @@ /// visitFreeInst - Free instructions are code gen'd to call the free libc /// function. /// -void ISel::visitFreeInst(FreeInst &I) { +void X86ISel::visitFreeInst(FreeInst &I) { std::vector Args; Args.push_back(ValueRecord(I.getOperand(0))); MachineInstr *TheCall = BuildMI(X86::CALLpcrel32, @@ -3853,5 +3856,5 @@ /// generated code sucks but the implementation is nice and simple. /// FunctionPass *llvm::createX86SimpleInstructionSelector(TargetMachine &TM) { - return new ISel(TM); + return new X86ISel(TM); } From brukman at cs.uiuc.edu Tue Sep 21 13:22:44 2004 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Tue, 21 Sep 2004 13:22:44 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPC64ISelSimple.cpp Message-ID: <200409211822.NAA04191@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPC64ISelSimple.cpp updated: 1.14 -> 1.15 --- Log message: s/ISel/PPC64ISel/ to have unique class names for debugging via gdb because the C++ front-end in gcc does not mangle classes in anonymous namespaces correctly. --- Diffs of the changes: (+81 -78) Index: llvm/lib/Target/PowerPC/PPC64ISelSimple.cpp diff -u llvm/lib/Target/PowerPC/PPC64ISelSimple.cpp:1.14 llvm/lib/Target/PowerPC/PPC64ISelSimple.cpp:1.15 --- llvm/lib/Target/PowerPC/PPC64ISelSimple.cpp:1.14 Mon Sep 6 13:46:59 2004 +++ llvm/lib/Target/PowerPC/PPC64ISelSimple.cpp Tue Sep 21 13:22:33 2004 @@ -73,7 +73,7 @@ } namespace { - struct ISel : public FunctionPass, InstVisitor { + struct PPC64ISel : public FunctionPass, InstVisitor { PPC64TargetMachine &TM; MachineFunction *F; // The function we are compiling into MachineBasicBlock *BB; // The current MBB we are compiling @@ -95,7 +95,7 @@ // Target configuration data const unsigned ParameterSaveAreaOffset, MaxArgumentStackSpace; - ISel(TargetMachine &tm) : TM(reinterpret_cast(tm)), + PPC64ISel(TargetMachine &tm):TM(reinterpret_cast(tm)), F(0), BB(0), ParameterSaveAreaOffset(24), MaxArgumentStackSpace(32) {} bool doInitialization(Module &M) { @@ -397,8 +397,8 @@ /// getReg - This method turns an LLVM value into a register number. /// -unsigned ISel::getReg(Value *V, MachineBasicBlock *MBB, - MachineBasicBlock::iterator IPt) { +unsigned PPC64ISel::getReg(Value *V, MachineBasicBlock *MBB, + MachineBasicBlock::iterator IPt) { if (Constant *C = dyn_cast(V)) { unsigned Reg = makeAnotherReg(V->getType()); copyConstantToRegister(MBB, IPt, C, Reg); @@ -423,7 +423,7 @@ /// is okay to use as an immediate argument to a certain binary operator. /// /// Operator is one of: 0 for Add, 1 for Sub, 2 for And, 3 for Or, 4 for Xor. -bool ISel::canUseAsImmediateForOpcode(ConstantInt *CI, unsigned Operator) { +bool PPC64ISel::canUseAsImmediateForOpcode(ConstantInt *CI, unsigned Operator) { ConstantSInt *Op1Cs; ConstantUInt *Op1Cu; @@ -464,7 +464,7 @@ /// getFixedSizedAllocaFI - Return the frame index for a fixed sized alloca /// that is to be statically allocated with the initial stack frame /// adjustment. -unsigned ISel::getFixedSizedAllocaFI(AllocaInst *AI) { +unsigned PPC64ISel::getFixedSizedAllocaFI(AllocaInst *AI) { // Already computed this? std::map::iterator I = AllocaMap.lower_bound(AI); if (I != AllocaMap.end() && I->first == AI) return I->second; @@ -485,9 +485,9 @@ /// copyConstantToRegister - Output the instructions required to put the /// specified constant into the specified register. /// -void ISel::copyConstantToRegister(MachineBasicBlock *MBB, - MachineBasicBlock::iterator IP, - Constant *C, unsigned R) { +void PPC64ISel::copyConstantToRegister(MachineBasicBlock *MBB, + MachineBasicBlock::iterator IP, + Constant *C, unsigned R) { if (C->getType()->isIntegral()) { unsigned Class = getClassB(C->getType()); @@ -574,7 +574,7 @@ /// LoadArgumentsToVirtualRegs - Load all of the arguments to this function from /// the stack into virtual registers. -void ISel::LoadArgumentsToVirtualRegs(Function &Fn) { +void PPC64ISel::LoadArgumentsToVirtualRegs(Function &Fn) { unsigned ArgOffset = ParameterSaveAreaOffset; unsigned GPR_remaining = 8; unsigned FPR_remaining = 13; @@ -703,7 +703,7 @@ /// because we have to generate our sources into the source basic blocks, not /// the current one. /// -void ISel::SelectPHINodes() { +void PPC64ISel::SelectPHINodes() { const TargetInstrInfo &TII = *TM.getInstrInfo(); const Function &LF = *F->getFunction(); // The LLVM function... for (Function::const_iterator I = LF.begin(), E = LF.end(); I != E; ++I) { @@ -861,17 +861,17 @@ } /// emitUCOM - emits an unordered FP compare. -void ISel::emitUCOM(MachineBasicBlock *MBB, MachineBasicBlock::iterator IP, - unsigned LHS, unsigned RHS) { +void PPC64ISel::emitUCOM(MachineBasicBlock *MBB, MachineBasicBlock::iterator IP, + unsigned LHS, unsigned RHS) { BuildMI(*MBB, IP, PPC::FCMPU, 2, PPC::CR0).addReg(LHS).addReg(RHS); } /// EmitComparison - emits a comparison of the two operands, returning the /// extended setcc code to use. The result is in CR0. /// -unsigned ISel::EmitComparison(unsigned OpNum, Value *Op0, Value *Op1, - MachineBasicBlock *MBB, - MachineBasicBlock::iterator IP) { +unsigned PPC64ISel::EmitComparison(unsigned OpNum, Value *Op0, Value *Op1, + MachineBasicBlock *MBB, + MachineBasicBlock::iterator IP) { // The arguments are already supposed to be of the same type. const Type *CompTy = Op0->getType(); unsigned Class = getClassB(CompTy); @@ -943,7 +943,7 @@ /// visitSetCondInst - emit code to calculate the condition via /// EmitComparison(), and possibly store a 0 or 1 to a register as a result /// -void ISel::visitSetCondInst(SetCondInst &I) { +void PPC64ISel::visitSetCondInst(SetCondInst &I) { if (canFoldSetCCIntoBranchOrSelect(&I)) return; @@ -1007,7 +1007,7 @@ .addMBB(copy0MBB).addReg(TrueValue).addMBB(copy1MBB); } -void ISel::visitSelectInst(SelectInst &SI) { +void PPC64ISel::visitSelectInst(SelectInst &SI) { unsigned DestReg = getReg(SI); MachineBasicBlock::iterator MII = BB->end(); emitSelectOperation(BB, MII, SI.getCondition(), SI.getTrueValue(), @@ -1018,10 +1018,10 @@ /// expression support. /// FIXME: this is most likely broken in one or more ways. Namely, PowerPC has /// no select instruction. FSEL only works for comparisons against zero. -void ISel::emitSelectOperation(MachineBasicBlock *MBB, - MachineBasicBlock::iterator IP, - Value *Cond, Value *TrueVal, Value *FalseVal, - unsigned DestReg) { +void PPC64ISel::emitSelectOperation(MachineBasicBlock *MBB, + MachineBasicBlock::iterator IP, + Value *Cond, Value *TrueVal, + Value *FalseVal, unsigned DestReg) { unsigned SelectClass = getClassB(TrueVal->getType()); unsigned Opcode; @@ -1095,7 +1095,7 @@ /// promote32 - Emit instructions to turn a narrow operand into a 32-bit-wide /// operand, in the specified target register. /// -void ISel::promote32(unsigned targetReg, const ValueRecord &VR) { +void PPC64ISel::promote32(unsigned targetReg, const ValueRecord &VR) { bool isUnsigned = VR.Ty->isUnsigned() || VR.Ty == Type::BoolTy; Value *Val = VR.Val; @@ -1156,7 +1156,7 @@ /// visitReturnInst - implemented with BLR /// -void ISel::visitReturnInst(ReturnInst &I) { +void PPC64ISel::visitReturnInst(ReturnInst &I) { // Only do the processing if this is a non-void return if (I.getNumOperands() > 0) { Value *RetVal = I.getOperand(0); @@ -1192,7 +1192,7 @@ /// jump to a block that is the immediate successor of the current block, we can /// just make a fall-through (but we don't currently). /// -void ISel::visitBranchInst(BranchInst &BI) { +void PPC64ISel::visitBranchInst(BranchInst &BI) { // Update machine-CFG edges BB->addSuccessor(MBBMap[BI.getSuccessor(0)]); if (BI.isConditional()) @@ -1255,8 +1255,8 @@ /// and the return value as appropriate. For the actual function call itself, /// it inserts the specified CallMI instruction into the stream. /// -void ISel::doCall(const ValueRecord &Ret, MachineInstr *CallMI, - const std::vector &Args, bool isVarArg) { +void PPC64ISel::doCall(const ValueRecord &Ret, MachineInstr *CallMI, + const std::vector &Args, bool isVarArg) { // Count how many bytes are to be pushed on the stack, including the linkage // area, and parameter passing area. unsigned NumBytes = ParameterSaveAreaOffset; @@ -1441,7 +1441,7 @@ /// visitCallInst - Push args on stack and do a procedure call instruction. -void ISel::visitCallInst(CallInst &CI) { +void PPC64ISel::visitCallInst(CallInst &CI) { MachineInstr *TheCall; Function *F = CI.getCalledFunction(); if (F) { @@ -1498,7 +1498,7 @@ /// function, lowering any calls to unknown intrinsic functions into the /// equivalent LLVM code. /// -void ISel::LowerUnknownIntrinsicFunctionCalls(Function &F) { +void PPC64ISel::LowerUnknownIntrinsicFunctionCalls(Function &F) { for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ) if (CallInst *CI = dyn_cast(I++)) @@ -1547,7 +1547,7 @@ } } -void ISel::visitIntrinsicCall(Intrinsic::ID ID, CallInst &CI) { +void PPC64ISel::visitIntrinsicCall(Intrinsic::ID ID, CallInst &CI) { unsigned TmpReg1, TmpReg2, TmpReg3; switch (ID) { case Intrinsic::vastart: @@ -1610,7 +1610,7 @@ /// OperatorClass is one of: 0 for Add, 1 for Sub, 2 for And, 3 for Or, 4 for /// Xor. /// -void ISel::visitSimpleBinary(BinaryOperator &B, unsigned OperatorClass) { +void PPC64ISel::visitSimpleBinary(BinaryOperator &B, unsigned OperatorClass) { unsigned DestReg = getReg(B); MachineBasicBlock::iterator MI = BB->end(); Value *Op0 = B.getOperand(0), *Op1 = B.getOperand(1); @@ -1621,10 +1621,10 @@ /// emitBinaryFPOperation - This method handles emission of floating point /// Add (0), Sub (1), Mul (2), and Div (3) operations. -void ISel::emitBinaryFPOperation(MachineBasicBlock *BB, - MachineBasicBlock::iterator IP, - Value *Op0, Value *Op1, - unsigned OperatorClass, unsigned DestReg) { +void PPC64ISel::emitBinaryFPOperation(MachineBasicBlock *BB, + MachineBasicBlock::iterator IP, + Value *Op0, Value *Op1, + unsigned OperatorClass, unsigned DestReg){ static const unsigned OpcodeTab[][4] = { { PPC::FADDS, PPC::FSUBS, PPC::FMULS, PPC::FDIVS }, // Float @@ -1653,10 +1653,11 @@ /// emitSimpleBinaryOperation - Common code shared between visitSimpleBinary /// and constant expression support. /// -void ISel::emitSimpleBinaryOperation(MachineBasicBlock *MBB, - MachineBasicBlock::iterator IP, - Value *Op0, Value *Op1, - unsigned OperatorClass, unsigned DestReg) { +void PPC64ISel::emitSimpleBinaryOperation(MachineBasicBlock *MBB, + MachineBasicBlock::iterator IP, + Value *Op0, Value *Op1, + unsigned OperatorClass, + unsigned DestReg) { unsigned Class = getClassB(Op0->getType()); // Arithmetic and Bitwise operators @@ -1768,9 +1769,9 @@ /// doMultiply - Emit appropriate instructions to multiply together the /// Values Op0 and Op1, and put the result in DestReg. /// -void ISel::doMultiply(MachineBasicBlock *MBB, - MachineBasicBlock::iterator IP, - unsigned DestReg, Value *Op0, Value *Op1) { +void PPC64ISel::doMultiply(MachineBasicBlock *MBB, + MachineBasicBlock::iterator IP, + unsigned DestReg, Value *Op0, Value *Op1) { unsigned Class0 = getClass(Op0->getType()); unsigned Class1 = getClass(Op1->getType()); @@ -1801,9 +1802,9 @@ /// doMultiplyConst - This method will multiply the value in Op0 by the /// value of the ContantInt *CI -void ISel::doMultiplyConst(MachineBasicBlock *MBB, - MachineBasicBlock::iterator IP, - unsigned DestReg, Value *Op0, ConstantInt *CI) { +void PPC64ISel::doMultiplyConst(MachineBasicBlock *MBB, + MachineBasicBlock::iterator IP, + unsigned DestReg, Value *Op0, ConstantInt *CI) { unsigned Class = getClass(Op0->getType()); // Mul op0, 0 ==> 0 @@ -1839,7 +1840,7 @@ doMultiply(MBB, IP, DestReg, Op0, CI); } -void ISel::visitMul(BinaryOperator &I) { +void PPC64ISel::visitMul(BinaryOperator &I) { unsigned ResultReg = getReg(I); Value *Op0 = I.getOperand(0); @@ -1849,8 +1850,9 @@ emitMultiply(BB, IP, Op0, Op1, ResultReg); } -void ISel::emitMultiply(MachineBasicBlock *MBB, MachineBasicBlock::iterator IP, - Value *Op0, Value *Op1, unsigned DestReg) { +void PPC64ISel::emitMultiply(MachineBasicBlock *MBB, + MachineBasicBlock::iterator IP, + Value *Op0, Value *Op1, unsigned DestReg) { TypeClass Class = getClass(Op0->getType()); switch (Class) { @@ -1878,7 +1880,7 @@ /// select the result from a different register. Note that both of these /// instructions work differently for signed and unsigned operands. /// -void ISel::visitDivRem(BinaryOperator &I) { +void PPC64ISel::visitDivRem(BinaryOperator &I) { unsigned ResultReg = getReg(I); Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1); @@ -1887,10 +1889,10 @@ ResultReg); } -void ISel::emitDivRemOperation(MachineBasicBlock *BB, - MachineBasicBlock::iterator IP, - Value *Op0, Value *Op1, bool isDiv, - unsigned ResultReg) { +void PPC64ISel::emitDivRemOperation(MachineBasicBlock *BB, + MachineBasicBlock::iterator IP, + Value *Op0, Value *Op1, bool isDiv, + unsigned ResultReg) { const Type *Ty = Op0->getType(); unsigned Class = getClass(Ty); switch (Class) { @@ -1989,7 +1991,7 @@ /// shift values equal to 1. Even the general case is sort of special, /// because the shift amount has to be in CL, not just any old register. /// -void ISel::visitShiftInst(ShiftInst &I) { +void PPC64ISel::visitShiftInst(ShiftInst &I) { MachineBasicBlock::iterator IP = BB->end(); emitShiftOperation(BB, IP, I.getOperand(0), I.getOperand(1), I.getOpcode() == Instruction::Shl, I.getType(), @@ -1999,10 +2001,11 @@ /// emitShiftOperation - Common code shared between visitShiftInst and /// constant expression support. /// -void ISel::emitShiftOperation(MachineBasicBlock *MBB, - MachineBasicBlock::iterator IP, - Value *Op, Value *ShiftAmount, bool isLeftShift, - const Type *ResultTy, unsigned DestReg) { +void PPC64ISel::emitShiftOperation(MachineBasicBlock *MBB, + MachineBasicBlock::iterator IP, + Value *Op, Value *ShiftAmount, + bool isLeftShift, const Type *ResultTy, + unsigned DestReg) { unsigned SrcReg = getReg (Op, MBB, IP); bool isSigned = ResultTy->isSigned (); unsigned Class = getClass (ResultTy); @@ -2074,7 +2077,7 @@ /// mapping of LLVM classes to PPC load instructions, with the exception of /// signed byte loads, which need a sign extension following them. /// -void ISel::visitLoadInst(LoadInst &I) { +void PPC64ISel::visitLoadInst(LoadInst &I) { // Immediate opcodes, for reg+imm addressing static const unsigned ImmOpcodes[] = { PPC::LBZ, PPC::LHZ, PPC::LWZ, @@ -2162,7 +2165,7 @@ /// visitStoreInst - Implement LLVM store instructions /// -void ISel::visitStoreInst(StoreInst &I) { +void PPC64ISel::visitStoreInst(StoreInst &I) { // Immediate opcodes, for reg+imm addressing static const unsigned ImmOpcodes[] = { PPC::STB, PPC::STH, PPC::STW, @@ -2217,7 +2220,7 @@ /// visitCastInst - Here we have various kinds of copying with or without sign /// extension going on. /// -void ISel::visitCastInst(CastInst &CI) { +void PPC64ISel::visitCastInst(CastInst &CI) { Value *Op = CI.getOperand(0); unsigned SrcClass = getClassB(Op->getType()); @@ -2246,10 +2249,10 @@ /// emitCastOperation - Common code shared between visitCastInst and constant /// expression cast support. /// -void ISel::emitCastOperation(MachineBasicBlock *MBB, - MachineBasicBlock::iterator IP, - Value *Src, const Type *DestTy, - unsigned DestReg) { +void PPC64ISel::emitCastOperation(MachineBasicBlock *MBB, + MachineBasicBlock::iterator IP, + Value *Src, const Type *DestTy, + unsigned DestReg) { const Type *SrcTy = Src->getType(); unsigned SrcClass = getClassB(SrcTy); unsigned DestClass = getClassB(DestTy); @@ -2623,7 +2626,7 @@ /// visitVANextInst - Implement the va_next instruction... /// -void ISel::visitVANextInst(VANextInst &I) { +void PPC64ISel::visitVANextInst(VANextInst &I) { unsigned VAList = getReg(I.getOperand(0)); unsigned DestReg = getReg(I); @@ -2649,7 +2652,7 @@ BuildMI(BB, PPC::ADDI, 2, DestReg).addReg(VAList).addSImm(Size); } -void ISel::visitVAArgInst(VAArgInst &I) { +void PPC64ISel::visitVAArgInst(VAArgInst &I) { unsigned VAList = getReg(I.getOperand(0)); unsigned DestReg = getReg(I); @@ -2678,7 +2681,7 @@ /// visitGetElementPtrInst - instruction-select GEP instructions /// -void ISel::visitGetElementPtrInst(GetElementPtrInst &I) { +void PPC64ISel::visitGetElementPtrInst(GetElementPtrInst &I) { if (canFoldGEPIntoLoadOrStore(&I)) return; @@ -2690,12 +2693,12 @@ /// emitGEPOperation - Common code shared between visitGetElementPtrInst and /// constant expression GEP support. /// -void ISel::emitGEPOperation(MachineBasicBlock *MBB, - MachineBasicBlock::iterator IP, - Value *Src, User::op_iterator IdxBegin, - User::op_iterator IdxEnd, unsigned TargetReg, - bool GEPIsFolded, ConstantSInt **RemainderPtr, - unsigned *PendingAddReg) { +void PPC64ISel::emitGEPOperation(MachineBasicBlock *MBB, + MachineBasicBlock::iterator IP, + Value *Src, User::op_iterator IdxBegin, + User::op_iterator IdxEnd, unsigned TargetReg, + bool GEPIsFolded, ConstantSInt **RemainderPtr, + unsigned *PendingAddReg) { const TargetData &TD = TM.getTargetData(); const Type *Ty = Src->getType(); unsigned basePtrReg = getReg(Src, MBB, IP); @@ -2861,7 +2864,7 @@ /// visitAllocaInst - If this is a fixed size alloca, allocate space from the /// frame manager, otherwise do it the hard way. /// -void ISel::visitAllocaInst(AllocaInst &I) { +void PPC64ISel::visitAllocaInst(AllocaInst &I) { // If this is a fixed size alloca in the entry block for the function, we // statically stack allocate the space, so we don't need to do anything here. // @@ -2904,7 +2907,7 @@ /// visitMallocInst - Malloc instructions are code generated into direct calls /// to the library malloc. /// -void ISel::visitMallocInst(MallocInst &I) { +void PPC64ISel::visitMallocInst(MallocInst &I) { unsigned AllocSize = TM.getTargetData().getTypeSize(I.getAllocatedType()); unsigned Arg; @@ -2928,7 +2931,7 @@ /// visitFreeInst - Free instructions are code gen'd to call the free libc /// function. /// -void ISel::visitFreeInst(FreeInst &I) { +void PPC64ISel::visitFreeInst(FreeInst &I) { std::vector Args; Args.push_back(ValueRecord(I.getOperand(0))); MachineInstr *TheCall = @@ -2940,5 +2943,5 @@ /// code representation is a very simple peep-hole fashion. /// FunctionPass *llvm::createPPC64ISelSimple(TargetMachine &TM) { - return new ISel(TM); + return new PPC64ISel(TM); } From brukman at cs.uiuc.edu Tue Sep 21 13:23:00 2004 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Tue, 21 Sep 2004 13:23:00 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp Message-ID: <200409211823.NAA04200@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPC32ISelSimple.cpp updated: 1.78 -> 1.79 --- Log message: s/ISel/PPC32ISel/ to have unique class names for debugging via gdb because the C++ front-end in gcc does not mangle classes in anonymous namespaces correctly. --- Diffs of the changes: (+90 -87) Index: llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp diff -u llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.78 llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.79 --- llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.78 Sat Sep 4 00:00:00 2004 +++ llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp Tue Sep 21 13:22:19 2004 @@ -71,7 +71,7 @@ } namespace { - struct ISel : public FunctionPass, InstVisitor { + struct PPC32ISel : public FunctionPass, InstVisitor { PPC32TargetMachine &TM; MachineFunction *F; // The function we are compiling into MachineBasicBlock *BB; // The current MBB we are compiling @@ -96,7 +96,7 @@ unsigned GlobalBaseReg; bool GlobalBaseInitialized; - ISel(TargetMachine &tm) : TM(reinterpret_cast(tm)), + PPC32ISel(TargetMachine &tm):TM(reinterpret_cast(tm)), F(0), BB(0) {} bool doInitialization(Module &M) { @@ -361,9 +361,9 @@ /// copyGlobalBaseToRegister - Output the instructions required to put the /// base address to use for accessing globals into a register. /// - void ISel::copyGlobalBaseToRegister(MachineBasicBlock *MBB, - MachineBasicBlock::iterator IP, - unsigned R); + void copyGlobalBaseToRegister(MachineBasicBlock *MBB, + MachineBasicBlock::iterator IP, + unsigned R); /// copyConstantToRegister - Output the instructions required to put the /// specified constant into the specified register. @@ -436,8 +436,8 @@ /// getReg - This method turns an LLVM value into a register number. /// -unsigned ISel::getReg(Value *V, MachineBasicBlock *MBB, - MachineBasicBlock::iterator IPt) { +unsigned PPC32ISel::getReg(Value *V, MachineBasicBlock *MBB, + MachineBasicBlock::iterator IPt) { if (Constant *C = dyn_cast(V)) { unsigned Reg = makeAnotherReg(V->getType()); copyConstantToRegister(MBB, IPt, C, Reg); @@ -462,7 +462,7 @@ /// is okay to use as an immediate argument to a certain binary operator. /// /// Operator is one of: 0 for Add, 1 for Sub, 2 for And, 3 for Or, 4 for Xor. -bool ISel::canUseAsImmediateForOpcode(ConstantInt *CI, unsigned Operator) { +bool PPC32ISel::canUseAsImmediateForOpcode(ConstantInt *CI, unsigned Operator) { ConstantSInt *Op1Cs; ConstantUInt *Op1Cu; @@ -503,7 +503,7 @@ /// getFixedSizedAllocaFI - Return the frame index for a fixed sized alloca /// that is to be statically allocated with the initial stack frame /// adjustment. -unsigned ISel::getFixedSizedAllocaFI(AllocaInst *AI) { +unsigned PPC32ISel::getFixedSizedAllocaFI(AllocaInst *AI) { // Already computed this? std::map::iterator I = AllocaMap.lower_bound(AI); if (I != AllocaMap.end() && I->first == AI) return I->second; @@ -524,9 +524,9 @@ /// copyGlobalBaseToRegister - Output the instructions required to put the /// base address to use for accessing globals into a register. /// -void ISel::copyGlobalBaseToRegister(MachineBasicBlock *MBB, - MachineBasicBlock::iterator IP, - unsigned R) { +void PPC32ISel::copyGlobalBaseToRegister(MachineBasicBlock *MBB, + MachineBasicBlock::iterator IP, + unsigned R) { if (!GlobalBaseInitialized) { // Insert the set of GlobalBaseReg into the first MBB of the function MachineBasicBlock &FirstMBB = F->front(); @@ -545,9 +545,9 @@ /// copyConstantToRegister - Output the instructions required to put the /// specified constant into the specified register. /// -void ISel::copyConstantToRegister(MachineBasicBlock *MBB, - MachineBasicBlock::iterator IP, - Constant *C, unsigned R) { +void PPC32ISel::copyConstantToRegister(MachineBasicBlock *MBB, + MachineBasicBlock::iterator IP, + Constant *C, unsigned R) { if (C->getType()->isIntegral()) { unsigned Class = getClassB(C->getType()); @@ -653,7 +653,7 @@ /// LoadArgumentsToVirtualRegs - Load all of the arguments to this function from /// the stack into virtual registers. -void ISel::LoadArgumentsToVirtualRegs(Function &Fn) { +void PPC32ISel::LoadArgumentsToVirtualRegs(Function &Fn) { unsigned ArgOffset = 24; unsigned GPR_remaining = 8; unsigned FPR_remaining = 13; @@ -790,7 +790,7 @@ /// because we have to generate our sources into the source basic blocks, not /// the current one. /// -void ISel::SelectPHINodes() { +void PPC32ISel::SelectPHINodes() { const TargetInstrInfo &TII = *TM.getInstrInfo(); const Function &LF = *F->getFunction(); // The LLVM function... for (Function::const_iterator I = LF.begin(), E = LF.end(); I != E; ++I) { @@ -955,14 +955,14 @@ } /// emitUCOM - emits an unordered FP compare. -void ISel::emitUCOM(MachineBasicBlock *MBB, MachineBasicBlock::iterator IP, - unsigned LHS, unsigned RHS) { +void PPC32ISel::emitUCOM(MachineBasicBlock *MBB, MachineBasicBlock::iterator IP, + unsigned LHS, unsigned RHS) { BuildMI(*MBB, IP, PPC::FCMPU, 2, PPC::CR0).addReg(LHS).addReg(RHS); } -unsigned ISel::ExtendOrClear(MachineBasicBlock *MBB, - MachineBasicBlock::iterator IP, - Value *Op0, Value *Op1) { +unsigned PPC32ISel::ExtendOrClear(MachineBasicBlock *MBB, + MachineBasicBlock::iterator IP, + Value *Op0, Value *Op1) { const Type *CompTy = Op0->getType(); unsigned Reg = getReg(Op0, MBB, IP); unsigned Class = getClassB(CompTy); @@ -992,9 +992,9 @@ /// EmitComparison - emits a comparison of the two operands, returning the /// extended setcc code to use. The result is in CR0. /// -unsigned ISel::EmitComparison(unsigned OpNum, Value *Op0, Value *Op1, - MachineBasicBlock *MBB, - MachineBasicBlock::iterator IP) { +unsigned PPC32ISel::EmitComparison(unsigned OpNum, Value *Op0, Value *Op1, + MachineBasicBlock *MBB, + MachineBasicBlock::iterator IP) { // The arguments are already supposed to be of the same type. const Type *CompTy = Op0->getType(); unsigned Class = getClassB(CompTy); @@ -1104,7 +1104,7 @@ /// visitSetCondInst - emit code to calculate the condition via /// EmitComparison(), and possibly store a 0 or 1 to a register as a result /// -void ISel::visitSetCondInst(SetCondInst &I) { +void PPC32ISel::visitSetCondInst(SetCondInst &I) { if (canFoldSetCCIntoBranchOrSelect(&I)) return; @@ -1153,7 +1153,7 @@ .addMBB(copy0MBB).addReg(TrueValue).addMBB(thisMBB); } -void ISel::visitSelectInst(SelectInst &SI) { +void PPC32ISel::visitSelectInst(SelectInst &SI) { unsigned DestReg = getReg(SI); MachineBasicBlock::iterator MII = BB->end(); emitSelectOperation(BB, MII, SI.getCondition(), SI.getTrueValue(), @@ -1164,10 +1164,10 @@ /// expression support. /// FIXME: this is most likely broken in one or more ways. Namely, PowerPC has /// no select instruction. FSEL only works for comparisons against zero. -void ISel::emitSelectOperation(MachineBasicBlock *MBB, - MachineBasicBlock::iterator IP, - Value *Cond, Value *TrueVal, Value *FalseVal, - unsigned DestReg) { +void PPC32ISel::emitSelectOperation(MachineBasicBlock *MBB, + MachineBasicBlock::iterator IP, + Value *Cond, Value *TrueVal, + Value *FalseVal, unsigned DestReg) { unsigned SelectClass = getClassB(TrueVal->getType()); unsigned Opcode; @@ -1231,7 +1231,7 @@ /// promote32 - Emit instructions to turn a narrow operand into a 32-bit-wide /// operand, in the specified target register. /// -void ISel::promote32(unsigned targetReg, const ValueRecord &VR) { +void PPC32ISel::promote32(unsigned targetReg, const ValueRecord &VR) { bool isUnsigned = VR.Ty->isUnsigned() || VR.Ty == Type::BoolTy; Value *Val = VR.Val; @@ -1291,7 +1291,7 @@ /// visitReturnInst - implemented with BLR /// -void ISel::visitReturnInst(ReturnInst &I) { +void PPC32ISel::visitReturnInst(ReturnInst &I) { // Only do the processing if this is a non-void return if (I.getNumOperands() > 0) { Value *RetVal = I.getOperand(0); @@ -1332,7 +1332,7 @@ /// jump to a block that is the immediate successor of the current block, we can /// just make a fall-through (but we don't currently). /// -void ISel::visitBranchInst(BranchInst &BI) { +void PPC32ISel::visitBranchInst(BranchInst &BI) { // Update machine-CFG edges BB->addSuccessor(MBBMap[BI.getSuccessor(0)]); if (BI.isConditional()) @@ -1397,8 +1397,8 @@ /// /// FIXME: See Documentation at the following URL for "correct" behavior /// -void ISel::doCall(const ValueRecord &Ret, MachineInstr *CallMI, - const std::vector &Args, bool isVarArg) { +void PPC32ISel::doCall(const ValueRecord &Ret, MachineInstr *CallMI, + const std::vector &Args, bool isVarArg) { // Count how many bytes are to be pushed on the stack, including the linkage // area, and parameter passing area. unsigned NumBytes = 24; @@ -1602,7 +1602,7 @@ /// visitCallInst - Push args on stack and do a procedure call instruction. -void ISel::visitCallInst(CallInst &CI) { +void PPC32ISel::visitCallInst(CallInst &CI) { MachineInstr *TheCall; Function *F = CI.getCalledFunction(); if (F) { @@ -1663,7 +1663,7 @@ /// function, lowering any calls to unknown intrinsic functions into the /// equivalent LLVM code. /// -void ISel::LowerUnknownIntrinsicFunctionCalls(Function &F) { +void PPC32ISel::LowerUnknownIntrinsicFunctionCalls(Function &F) { for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ) if (CallInst *CI = dyn_cast(I++)) @@ -1712,7 +1712,7 @@ } } -void ISel::visitIntrinsicCall(Intrinsic::ID ID, CallInst &CI) { +void PPC32ISel::visitIntrinsicCall(Intrinsic::ID ID, CallInst &CI) { unsigned TmpReg1, TmpReg2, TmpReg3; switch (ID) { case Intrinsic::vastart: @@ -1775,7 +1775,7 @@ /// OperatorClass is one of: 0 for Add, 1 for Sub, 2 for And, 3 for Or, 4 for /// Xor. /// -void ISel::visitSimpleBinary(BinaryOperator &B, unsigned OperatorClass) { +void PPC32ISel::visitSimpleBinary(BinaryOperator &B, unsigned OperatorClass) { unsigned DestReg = getReg(B); MachineBasicBlock::iterator MI = BB->end(); Value *Op0 = B.getOperand(0), *Op1 = B.getOperand(1); @@ -1786,10 +1786,10 @@ /// emitBinaryFPOperation - This method handles emission of floating point /// Add (0), Sub (1), Mul (2), and Div (3) operations. -void ISel::emitBinaryFPOperation(MachineBasicBlock *BB, - MachineBasicBlock::iterator IP, - Value *Op0, Value *Op1, - unsigned OperatorClass, unsigned DestReg) { +void PPC32ISel::emitBinaryFPOperation(MachineBasicBlock *BB, + MachineBasicBlock::iterator IP, + Value *Op0, Value *Op1, + unsigned OperatorClass, unsigned DestReg){ static const unsigned OpcodeTab[][4] = { { PPC::FADDS, PPC::FSUBS, PPC::FMULS, PPC::FDIVS }, // Float @@ -1818,10 +1818,11 @@ /// emitSimpleBinaryOperation - Common code shared between visitSimpleBinary /// and constant expression support. /// -void ISel::emitSimpleBinaryOperation(MachineBasicBlock *MBB, - MachineBasicBlock::iterator IP, - Value *Op0, Value *Op1, - unsigned OperatorClass, unsigned DestReg) { +void PPC32ISel::emitSimpleBinaryOperation(MachineBasicBlock *MBB, + MachineBasicBlock::iterator IP, + Value *Op0, Value *Op1, + unsigned OperatorClass, + unsigned DestReg) { unsigned Class = getClassB(Op0->getType()); // Arithmetic and Bitwise operators @@ -1970,9 +1971,9 @@ /// doMultiply - Emit appropriate instructions to multiply together the /// Values Op0 and Op1, and put the result in DestReg. /// -void ISel::doMultiply(MachineBasicBlock *MBB, - MachineBasicBlock::iterator IP, - unsigned DestReg, Value *Op0, Value *Op1) { +void PPC32ISel::doMultiply(MachineBasicBlock *MBB, + MachineBasicBlock::iterator IP, + unsigned DestReg, Value *Op0, Value *Op1) { unsigned Class0 = getClass(Op0->getType()); unsigned Class1 = getClass(Op1->getType()); @@ -2025,9 +2026,9 @@ /// doMultiplyConst - This method will multiply the value in Op0 by the /// value of the ContantInt *CI -void ISel::doMultiplyConst(MachineBasicBlock *MBB, - MachineBasicBlock::iterator IP, - unsigned DestReg, Value *Op0, ConstantInt *CI) { +void PPC32ISel::doMultiplyConst(MachineBasicBlock *MBB, + MachineBasicBlock::iterator IP, + unsigned DestReg, Value *Op0, ConstantInt *CI) { unsigned Class = getClass(Op0->getType()); // Mul op0, 0 ==> 0 @@ -2067,7 +2068,7 @@ doMultiply(MBB, IP, DestReg, Op0, CI); } -void ISel::visitMul(BinaryOperator &I) { +void PPC32ISel::visitMul(BinaryOperator &I) { unsigned ResultReg = getReg(I); Value *Op0 = I.getOperand(0); @@ -2077,8 +2078,9 @@ emitMultiply(BB, IP, Op0, Op1, ResultReg); } -void ISel::emitMultiply(MachineBasicBlock *MBB, MachineBasicBlock::iterator IP, - Value *Op0, Value *Op1, unsigned DestReg) { +void PPC32ISel::emitMultiply(MachineBasicBlock *MBB, + MachineBasicBlock::iterator IP, + Value *Op0, Value *Op1, unsigned DestReg) { TypeClass Class = getClass(Op0->getType()); switch (Class) { @@ -2106,7 +2108,7 @@ /// select the result from a different register. Note that both of these /// instructions work differently for signed and unsigned operands. /// -void ISel::visitDivRem(BinaryOperator &I) { +void PPC32ISel::visitDivRem(BinaryOperator &I) { unsigned ResultReg = getReg(I); Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1); @@ -2115,10 +2117,10 @@ ResultReg); } -void ISel::emitDivRemOperation(MachineBasicBlock *BB, - MachineBasicBlock::iterator IP, - Value *Op0, Value *Op1, bool isDiv, - unsigned ResultReg) { +void PPC32ISel::emitDivRemOperation(MachineBasicBlock *BB, + MachineBasicBlock::iterator IP, + Value *Op0, Value *Op1, bool isDiv, + unsigned ResultReg) { const Type *Ty = Op0->getType(); unsigned Class = getClass(Ty); switch (Class) { @@ -2230,7 +2232,7 @@ /// shift values equal to 1. Even the general case is sort of special, /// because the shift amount has to be in CL, not just any old register. /// -void ISel::visitShiftInst(ShiftInst &I) { +void PPC32ISel::visitShiftInst(ShiftInst &I) { MachineBasicBlock::iterator IP = BB->end(); emitShiftOperation(BB, IP, I.getOperand(0), I.getOperand(1), I.getOpcode() == Instruction::Shl, I.getType(), @@ -2240,10 +2242,11 @@ /// emitShiftOperation - Common code shared between visitShiftInst and /// constant expression support. /// -void ISel::emitShiftOperation(MachineBasicBlock *MBB, - MachineBasicBlock::iterator IP, - Value *Op, Value *ShiftAmount, bool isLeftShift, - const Type *ResultTy, unsigned DestReg) { +void PPC32ISel::emitShiftOperation(MachineBasicBlock *MBB, + MachineBasicBlock::iterator IP, + Value *Op, Value *ShiftAmount, + bool isLeftShift, const Type *ResultTy, + unsigned DestReg) { unsigned SrcReg = getReg (Op, MBB, IP); bool isSigned = ResultTy->isSigned (); unsigned Class = getClass (ResultTy); @@ -2439,7 +2442,7 @@ /// mapping of LLVM classes to PPC load instructions, with the exception of /// signed byte loads, which need a sign extension following them. /// -void ISel::visitLoadInst(LoadInst &I) { +void PPC32ISel::visitLoadInst(LoadInst &I) { // Immediate opcodes, for reg+imm addressing static const unsigned ImmOpcodes[] = { PPC::LBZ, PPC::LHZ, PPC::LWZ, @@ -2538,7 +2541,7 @@ /// visitStoreInst - Implement LLVM store instructions /// -void ISel::visitStoreInst(StoreInst &I) { +void PPC32ISel::visitStoreInst(StoreInst &I) { // Immediate opcodes, for reg+imm addressing static const unsigned ImmOpcodes[] = { PPC::STB, PPC::STH, PPC::STW, @@ -2607,7 +2610,7 @@ /// visitCastInst - Here we have various kinds of copying with or without sign /// extension going on. /// -void ISel::visitCastInst(CastInst &CI) { +void PPC32ISel::visitCastInst(CastInst &CI) { Value *Op = CI.getOperand(0); unsigned SrcClass = getClassB(Op->getType()); @@ -2654,10 +2657,10 @@ /// emitCastOperation - Common code shared between visitCastInst and constant /// expression cast support. /// -void ISel::emitCastOperation(MachineBasicBlock *MBB, - MachineBasicBlock::iterator IP, - Value *Src, const Type *DestTy, - unsigned DestReg) { +void PPC32ISel::emitCastOperation(MachineBasicBlock *MBB, + MachineBasicBlock::iterator IP, + Value *Src, const Type *DestTy, + unsigned DestReg) { const Type *SrcTy = Src->getType(); unsigned SrcClass = getClassB(SrcTy); unsigned DestClass = getClassB(DestTy); @@ -3136,7 +3139,7 @@ /// visitVANextInst - Implement the va_next instruction... /// -void ISel::visitVANextInst(VANextInst &I) { +void PPC32ISel::visitVANextInst(VANextInst &I) { unsigned VAList = getReg(I.getOperand(0)); unsigned DestReg = getReg(I); @@ -3162,7 +3165,7 @@ BuildMI(BB, PPC::ADDI, 2, DestReg).addReg(VAList).addSImm(Size); } -void ISel::visitVAArgInst(VAArgInst &I) { +void PPC32ISel::visitVAArgInst(VAArgInst &I) { unsigned VAList = getReg(I.getOperand(0)); unsigned DestReg = getReg(I); @@ -3192,7 +3195,7 @@ /// visitGetElementPtrInst - instruction-select GEP instructions /// -void ISel::visitGetElementPtrInst(GetElementPtrInst &I) { +void PPC32ISel::visitGetElementPtrInst(GetElementPtrInst &I) { if (canFoldGEPIntoLoadOrStore(&I)) return; @@ -3204,12 +3207,12 @@ /// emitGEPOperation - Common code shared between visitGetElementPtrInst and /// constant expression GEP support. /// -void ISel::emitGEPOperation(MachineBasicBlock *MBB, - MachineBasicBlock::iterator IP, - Value *Src, User::op_iterator IdxBegin, - User::op_iterator IdxEnd, unsigned TargetReg, - bool GEPIsFolded, ConstantSInt **RemainderPtr, - unsigned *PendingAddReg) { +void PPC32ISel::emitGEPOperation(MachineBasicBlock *MBB, + MachineBasicBlock::iterator IP, + Value *Src, User::op_iterator IdxBegin, + User::op_iterator IdxEnd, unsigned TargetReg, + bool GEPIsFolded, ConstantSInt **RemainderPtr, + unsigned *PendingAddReg) { const TargetData &TD = TM.getTargetData(); const Type *Ty = Src->getType(); unsigned basePtrReg = getReg(Src, MBB, IP); @@ -3375,7 +3378,7 @@ /// visitAllocaInst - If this is a fixed size alloca, allocate space from the /// frame manager, otherwise do it the hard way. /// -void ISel::visitAllocaInst(AllocaInst &I) { +void PPC32ISel::visitAllocaInst(AllocaInst &I) { // If this is a fixed size alloca in the entry block for the function, we // statically stack allocate the space, so we don't need to do anything here. // @@ -3418,7 +3421,7 @@ /// visitMallocInst - Malloc instructions are code generated into direct calls /// to the library malloc. /// -void ISel::visitMallocInst(MallocInst &I) { +void PPC32ISel::visitMallocInst(MallocInst &I) { unsigned AllocSize = TM.getTargetData().getTypeSize(I.getAllocatedType()); unsigned Arg; @@ -3443,7 +3446,7 @@ /// visitFreeInst - Free instructions are code gen'd to call the free libc /// function. /// -void ISel::visitFreeInst(FreeInst &I) { +void PPC32ISel::visitFreeInst(FreeInst &I) { std::vector Args; Args.push_back(ValueRecord(I.getOperand(0))); MachineInstr *TheCall = @@ -3456,5 +3459,5 @@ /// code representation is a very simple peep-hole fashion. /// FunctionPass *llvm::createPPC32ISelSimple(TargetMachine &TM) { - return new ISel(TM); + return new PPC32ISel(TM); } From alkis at cs.uiuc.edu Tue Sep 21 16:22:22 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Tue, 21 Sep 2004 16:22:22 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86RegisterInfo.td Message-ID: <200409212122.QAA06188@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86RegisterInfo.td updated: 1.14 -> 1.15 --- Log message: The real x87 floating point registers should not be allocatable. They are only used by the stackifier when transforming FPn register allocations to the real stack file x87 registers. --- Diffs of the changes: (+10 -2) Index: llvm/lib/Target/X86/X86RegisterInfo.td diff -u llvm/lib/Target/X86/X86RegisterInfo.td:1.14 llvm/lib/Target/X86/X86RegisterInfo.td:1.15 --- llvm/lib/Target/X86/X86RegisterInfo.td:1.14 Tue Sep 14 20:40:18 2004 +++ llvm/lib/Target/X86/X86RegisterInfo.td Tue Sep 21 16:22:11 2004 @@ -86,5 +86,13 @@ def RFP : RegisterClass; -// Floating point stack registers. -def RST : RegisterClass; +// Floating point stack registers (these are not allocatable by the +// register allocator - the floating point stackifier is responsible +// for transforming FPn allocations to STn registers) +def RST : RegisterClass { + let Methods = [{ + iterator allocation_order_end(MachineFunction &MF) const { + return begin(); + } + }]; +} From lattner at cs.uiuc.edu Tue Sep 21 16:35:41 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 21 Sep 2004 16:35:41 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200409212135.QAA32444@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.244 -> 1.245 --- Log message: Do not fold (X + C1 != C2) if there are other users of the add. Doing this transformation used to take a loop like this: int Array[1000]; void test(int X) { int i; for (i = 0; i < 1000; ++i) Array[i] += X; } Compiled to LLVM is: no_exit: ; preds = %entry, %no_exit %indvar = phi uint [ 0, %entry ], [ %indvar.next, %no_exit ] ; [#uses=2] %tmp.4 = getelementptr [1000 x int]* %Array, int 0, uint %indvar ; [#uses=2] %tmp.7 = load int* %tmp.4 ; [#uses=1] %tmp.9 = add int %tmp.7, %X ; [#uses=1] store int %tmp.9, int* %tmp.4 *** %indvar.next = add uint %indvar, 1 ; [#uses=2] *** %exitcond = seteq uint %indvar.next, 1000 ; [#uses=1] br bool %exitcond, label %return, label %no_exit and turn it into a loop like this: no_exit: ; preds = %entry, %no_exit %indvar = phi uint [ 0, %entry ], [ %indvar.next, %no_exit ] ; [#uses=3] %tmp.4 = getelementptr [1000 x int]* %Array, int 0, uint %indvar ; [#uses=2] %tmp.7 = load int* %tmp.4 ; [#uses=1] %tmp.9 = add int %tmp.7, %X ; [#uses=1] store int %tmp.9, int* %tmp.4 *** %indvar.next = add uint %indvar, 1 ; [#uses=1] *** %exitcond = seteq uint %indvar, 999 ; [#uses=1] br bool %exitcond, label %return, label %no_exit Note that indvar.next and indvar can no longer be coallesced. In machine code terms, this patch changes this code: .LBBtest_1: # no_exit mov %EDX, OFFSET Array mov %ESI, %EAX add %ESI, DWORD PTR [%EDX + 4*%ECX] mov %EDX, OFFSET Array mov DWORD PTR [%EDX + 4*%ECX], %ESI mov %EDX, %ECX inc %EDX cmp %ECX, 999 mov %ECX, %EDX jne .LBBtest_1 # no_exit into this: .LBBtest_1: # no_exit mov %EDX, OFFSET Array mov %ESI, %EAX add %ESI, DWORD PTR [%EDX + 4*%ECX] mov %EDX, OFFSET Array mov DWORD PTR [%EDX + 4*%ECX], %ESI inc %ECX cmp %ECX, 1000 jne .LBBtest_1 # no_exit We need better instruction selection to get this: .LBBtest_1: # no_exit add DWORD PTR [Array + 4*%ECX], EAX inc %ECX cmp %ECX, 1000 jne .LBBtest_1 # no_exit ... but at least there is less register juggling --- Diffs of the changes: (+3 -2) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.244 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.245 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.244 Mon Sep 20 05:15:10 2004 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Tue Sep 21 16:35:23 2004 @@ -1546,8 +1546,9 @@ case Instruction::Add: // Replace ((add A, B) != C) with (A != C-B) if B & C are constants. if (ConstantInt *BOp1C = dyn_cast(BO->getOperand(1))) { - return new SetCondInst(I.getOpcode(), BO->getOperand(0), - ConstantExpr::getSub(CI, BOp1C)); + if (BO->hasOneUse()) + return new SetCondInst(I.getOpcode(), BO->getOperand(0), + ConstantExpr::getSub(CI, BOp1C)); } else if (CI->isNullValue()) { // Replace ((add A, B) != 0) with (A != -B) if A or B is // efficiently invertible, or if the add has just this one use. From alkis at cs.uiuc.edu Tue Sep 21 17:06:15 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Tue, 21 Sep 2004 17:06:15 -0500 Subject: [llvm-commits] CVS: llvm-java/runtime/runtime.c Message-ID: <200409212206.RAA06851@zion.cs.uiuc.edu> Changes in directory llvm-java/runtime: runtime.c updated: 1.4 -> 1.5 --- Log message: Add typedefs for primitive java types. --- Diffs of the changes: (+14 -2) Index: llvm-java/runtime/runtime.c diff -u llvm-java/runtime/runtime.c:1.4 llvm-java/runtime/runtime.c:1.5 --- llvm-java/runtime/runtime.c:1.4 Tue Sep 21 13:12:44 2004 +++ llvm-java/runtime/runtime.c Tue Sep 21 17:06:05 2004 @@ -9,6 +9,17 @@ typedef unsigned jmethodID; #define _JNI_VM_INTERNAL_TYPES_DEFINED +/* Define some types*/ +/* FIXME: this should really be picked up from jni_md.h */ +typedef unsigned char jboolean; +typedef signed char jbyte; +typedef unsigned short jchar; +typedef short jshort; +typedef int jint; +typedef long long jlong; +typedef float jfloat; +typedef double jdouble; + struct llvm_java_object_header { /* gc info, hash info, locking */ }; @@ -37,8 +48,8 @@ return obj->vtable; } -int llvm_java_IsInstanceOf(jobject obj, - struct llvm_java_object_vtable* clazz) { +jint llvm_java_IsInstanceOf(jobject obj, + struct llvm_java_object_vtable* clazz) { struct llvm_java_object_vtable* objClazz = obj->vtable; if (objClazz == clazz) return 1; @@ -52,6 +63,7 @@ objClazz->typeinfo.interfaces[clazz->typeinfo.lastIface]; } + extern void llvm_java_static_init(void); extern void llvm_java_main(int, char**); From alkis at cs.uiuc.edu Tue Sep 21 17:13:48 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Tue, 21 Sep 2004 17:13:48 -0500 Subject: [llvm-commits] CVS: llvm-java/runtime/runtime.c Message-ID: <200409212213.RAA06964@zion.cs.uiuc.edu> Changes in directory llvm-java/runtime: runtime.c updated: 1.5 -> 1.6 --- Log message: Add some more defines from jni.h. --- Diffs of the changes: (+12 -1) Index: llvm-java/runtime/runtime.c diff -u llvm-java/runtime/runtime.c:1.5 llvm-java/runtime/runtime.c:1.6 --- llvm-java/runtime/runtime.c:1.5 Tue Sep 21 17:06:05 2004 +++ llvm-java/runtime/runtime.c Tue Sep 21 17:13:37 2004 @@ -20,6 +20,11 @@ typedef float jfloat; typedef double jdouble; +/* Used for jboolean type */ +/* FIXME: this should really be picked up from jni.h */ +#define JNI_TRUE 1 +#define JNI_FALSE 0 + struct llvm_java_object_header { /* gc info, hash info, locking */ }; @@ -50,9 +55,15 @@ jint llvm_java_IsInstanceOf(jobject obj, struct llvm_java_object_vtable* clazz) { + /* trivial case 1: a null object can be cast to any type */ + if (!obj) + return JNI_TRUE; + struct llvm_java_object_vtable* objClazz = obj->vtable; + /* trivial case 2: this object is of class clazz */ if (objClazz == clazz) - return 1; + return JNI_TRUE; + /* we are checking against a class' typeinfo */ if (clazz->typeinfo.interfaceFlag != (unsigned)-1) return objClazz->typeinfo.depth > clazz->typeinfo.depth && From alkis at cs.uiuc.edu Tue Sep 21 17:23:11 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Tue, 21 Sep 2004 17:23:11 -0500 Subject: [llvm-commits] CVS: llvm-java/runtime/runtime.c Message-ID: <200409212223.RAA07219@zion.cs.uiuc.edu> Changes in directory llvm-java/runtime: runtime.c updated: 1.6 -> 1.7 --- Log message: Change typeinfo struct and make instanceOf method a bit more readable. --- Diffs of the changes: (+14 -9) Index: llvm-java/runtime/runtime.c diff -u llvm-java/runtime/runtime.c:1.6 llvm-java/runtime/runtime.c:1.7 --- llvm-java/runtime/runtime.c:1.6 Tue Sep 21 17:13:37 2004 +++ llvm-java/runtime/runtime.c Tue Sep 21 17:23:00 2004 @@ -35,11 +35,11 @@ }; struct llvm_java_object_typeinfo { - unsigned depth; + int depth; struct llvm_java_object_vtable** vtables; - unsigned lastIface; + int lastIface; union { - unsigned interfaceFlag; + int interfaceFlag; struct llvm_java_object_vtable** interfaces; }; }; @@ -65,13 +65,18 @@ return JNI_TRUE; /* we are checking against a class' typeinfo */ - if (clazz->typeinfo.interfaceFlag != (unsigned)-1) - return objClazz->typeinfo.depth > clazz->typeinfo.depth && - objClazz->typeinfo.vtables[objClazz->typeinfo.depth - clazz->typeinfo.depth - 1] == clazz; + if (clazz->typeinfo.interfaceFlag != -1) { + /* this class' vtable can only be found at this index */ + int index = objClazz->typeinfo.depth - clazz->typeinfo.depth - 1; + return index >= 0 && objClazz->typeinfo.vtables[index] == clazz; + } /* otherwise we are checking against an interface's typeinfo */ - else - return objClazz->typeinfo.lastIface >= clazz->typeinfo.lastIface && - objClazz->typeinfo.interfaces[clazz->typeinfo.lastIface]; + else { + /* this interface's vtable can only be found at this index */ + int index = clazz->typeinfo.lastIface; + return objClazz->typeinfo.lastIface >= index && + objClazz->typeinfo.interfaces[index]; + } } From alkis at cs.uiuc.edu Tue Sep 21 17:23:11 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Tue, 21 Sep 2004 17:23:11 -0500 Subject: [llvm-commits] CVS: llvm-java/lib/Compiler/Compiler.cpp Message-ID: <200409212223.RAA07222@zion.cs.uiuc.edu> Changes in directory llvm-java/lib/Compiler: Compiler.cpp updated: 1.107 -> 1.108 --- Log message: Change typeinfo struct and make instanceOf method a bit more readable. --- Diffs of the changes: (+3 -3) Index: llvm-java/lib/Compiler/Compiler.cpp diff -u llvm-java/lib/Compiler/Compiler.cpp:1.107 llvm-java/lib/Compiler/Compiler.cpp:1.108 --- llvm-java/lib/Compiler/Compiler.cpp:1.107 Mon Sep 20 19:08:05 2004 +++ llvm-java/lib/Compiler/Compiler.cpp Tue Sep 21 17:23:00 2004 @@ -329,8 +329,8 @@ // llvm_java_object_typeinfo struct first // depth - elements.push_back(Type::UIntTy); - init.push_back(llvm::ConstantUInt::get(elements[0], 0)); + elements.push_back(Type::IntTy); + init.push_back(llvm::ConstantSInt::get(elements[0], 0)); // superclasses vtable pointers elements.push_back(PointerType::get(PointerType::get(VTtype))); init.push_back(llvm::Constant::getNullValue(elements[1])); @@ -566,7 +566,7 @@ tie(depth, superClassesVTables) = buildSuperClassesVTables(cf, vi); // the depth (java/lang/Object has depth 0) - typeInfoInit.push_back(ConstantUInt::get(Type::UIntTy, depth)); + typeInfoInit.push_back(ConstantSInt::get(Type::IntTy, depth)); // the super classes' vtables typeInfoInit.push_back(superClassesVTables); From alkis at cs.uiuc.edu Tue Sep 21 17:49:21 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Tue, 21 Sep 2004 17:49:21 -0500 Subject: [llvm-commits] CVS: llvm-java/lib/Compiler/Compiler.cpp Message-ID: <200409212249.RAA26380@zion.cs.uiuc.edu> Changes in directory llvm-java/lib/Compiler: Compiler.cpp updated: 1.108 -> 1.109 --- Log message: In the case of an interface, build the typeinfo right: the pointer to the implemented interfaces array should be set to ((void*)-1). --- Diffs of the changes: (+10 -0) Index: llvm-java/lib/Compiler/Compiler.cpp diff -u llvm-java/lib/Compiler/Compiler.cpp:1.108 llvm-java/lib/Compiler/Compiler.cpp:1.109 --- llvm-java/lib/Compiler/Compiler.cpp:1.108 Tue Sep 21 17:23:00 2004 +++ llvm-java/lib/Compiler/Compiler.cpp Tue Sep 21 17:49:11 2004 @@ -520,6 +520,16 @@ std::pair buildInterfacesVTables(ClassFile* cf, const VTableInfo& vi) { + // if this is an interface then we are not implementing any + // interfaces so the lastInterface field is our index and the + // pointer to the array of interface vtables is an all-ones + // value + if (cf->isInterface()) + return std::make_pair( + getClassInfo(cf).interfaceIdx, + ConstantExpr::getCast( + ConstantIntegral::getAllOnesValue(Type::LongTy), + PointerType::get(PointerType::get(VTableInfo::VTableTy)))); std::vector vtables; const Classes& interfaces = cf->getInterfaces(); From natebegeman at mac.com Tue Sep 21 23:40:36 2004 From: natebegeman at mac.com (Nate Begeman) Date: Tue, 21 Sep 2004 23:40:36 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp PowerPCAsmPrinter.cpp PowerPCInstrInfo.td Message-ID: <200409220440.XAA31862@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPC32ISelSimple.cpp updated: 1.79 -> 1.80 PowerPCAsmPrinter.cpp updated: 1.61 -> 1.62 PowerPCInstrInfo.td updated: 1.35 -> 1.36 --- Log message: add optimized code sequences for setcc x, 0 --- Diffs of the changes: (+96 -7) Index: llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp diff -u llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.79 llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.80 --- llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.79 Tue Sep 21 13:22:19 2004 +++ llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp Tue Sep 21 23:40:25 2004 @@ -32,6 +32,8 @@ using namespace llvm; namespace { + Statistic<> NumSetCC("ppc-codegen", "Number of SetCC straight-lined"); + /// TypeClass - Used by the PowerPC backend to group LLVM types by their basic /// PPC Representation. /// @@ -280,7 +282,7 @@ unsigned ExtendOrClear(MachineBasicBlock *MBB, MachineBasicBlock::iterator IP, - Value *Op0, Value *Op1); + Value *Op0); /// promote32 - Make a value 32-bits wide, and put it somewhere. /// @@ -962,7 +964,7 @@ unsigned PPC32ISel::ExtendOrClear(MachineBasicBlock *MBB, MachineBasicBlock::iterator IP, - Value *Op0, Value *Op1) { + Value *Op0) { const Type *CompTy = Op0->getType(); unsigned Reg = getReg(Op0, MBB, IP); unsigned Class = getClassB(CompTy); @@ -998,7 +1000,7 @@ // The arguments are already supposed to be of the same type. const Type *CompTy = Op0->getType(); unsigned Class = getClassB(CompTy); - unsigned Op0r = ExtendOrClear(MBB, IP, Op0, Op1); + unsigned Op0r = ExtendOrClear(MBB, IP, Op0); // Use crand for lt, gt and crandc for le, ge unsigned CROpcode = (OpNum == 2 || OpNum == 4) ? PPC::CRAND : PPC::CRANDC; @@ -1108,8 +1110,93 @@ if (canFoldSetCCIntoBranchOrSelect(&I)) return; - unsigned DestReg = getReg(I); + MachineBasicBlock::iterator MI = BB->end(); + Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1); + const Type *Ty = Op0->getType(); + unsigned Class = getClassB(Ty); unsigned Opcode = I.getOpcode(); + unsigned OpNum = getSetCCNumber(Opcode); + unsigned DestReg = getReg(I); + + // If the comparison type is byte, short, or int, then we can emit a + // branchless version of the SetCC that puts 0 (false) or 1 (true) in the + // destination register. + if (Class <= cInt) { + ConstantInt *CI = dyn_cast(Op1); + + if (CI && CI->getRawValue() == 0) { + ++NumSetCC; + unsigned Op0Reg = ExtendOrClear(BB, MI, Op0); + + // comparisons against constant zero and negative one often have shorter + // and/or faster sequences than the set-and-branch general case, handled + // below. + switch(OpNum) { + case 0: { // eq0 + unsigned TempReg = makeAnotherReg(Type::IntTy); + BuildMI(*BB, MI, PPC::CNTLZW, 1, TempReg).addReg(Op0Reg); + BuildMI(*BB, MI, PPC::RLWINM, 4, DestReg).addReg(TempReg).addImm(27) + .addImm(5).addImm(31); + break; + } + case 1: { // ne0 + unsigned TempReg = makeAnotherReg(Type::IntTy); + BuildMI(*BB, MI, PPC::ADDIC, 2, TempReg).addReg(Op0Reg).addSImm(-1); + BuildMI(*BB, MI, PPC::SUBFE, 2, DestReg).addReg(TempReg).addReg(Op0Reg); + break; + } + case 2: { // lt0, always false if unsigned + if (Ty->isSigned()) + BuildMI(*BB, MI, PPC::RLWINM, 4, DestReg).addReg(Op0Reg).addImm(1) + .addImm(31).addImm(31); + else + BuildMI(*BB, MI, PPC::LI, 1, DestReg).addSImm(0); + break; + } + case 3: { // ge0, always true if unsigned + if (Ty->isSigned()) { + unsigned TempReg = makeAnotherReg(Type::IntTy); + BuildMI(*BB, MI, PPC::RLWINM, 4, TempReg).addReg(Op0Reg).addImm(1) + .addImm(31).addImm(31); + BuildMI(*BB, MI, PPC::XORI, 2, DestReg).addReg(TempReg).addImm(1); + } else { + BuildMI(*BB, MI, PPC::LI, 1, DestReg).addSImm(1); + } + break; + } + case 4: { // gt0, equivalent to ne0 if unsigned + unsigned Temp1 = makeAnotherReg(Type::IntTy); + unsigned Temp2 = makeAnotherReg(Type::IntTy); + if (Ty->isSigned()) { + BuildMI(*BB, MI, PPC::NEG, 2, Temp1).addReg(Op0Reg); + BuildMI(*BB, MI, PPC::ANDC, 2, Temp2).addReg(Temp1).addReg(Op0Reg); + BuildMI(*BB, MI, PPC::RLWINM, 4, DestReg).addReg(Temp2).addImm(1) + .addImm(31).addImm(31); + } else { + BuildMI(*BB, MI, PPC::ADDIC, 2, Temp1).addReg(Op0Reg).addSImm(-1); + BuildMI(*BB, MI, PPC::SUBFE, 2, DestReg).addReg(Temp1).addReg(Op0Reg); + } + break; + } + case 5: { // le0, equivalent to eq0 if unsigned + unsigned Temp1 = makeAnotherReg(Type::IntTy); + unsigned Temp2 = makeAnotherReg(Type::IntTy); + if (Ty->isSigned()) { + BuildMI(*BB, MI, PPC::NEG, 2, Temp1).addReg(Op0Reg); + BuildMI(*BB, MI, PPC::ORC, 2, Temp2).addReg(Op0Reg).addReg(Temp1); + BuildMI(*BB, MI, PPC::RLWINM, 4, DestReg).addReg(Temp2).addImm(1) + .addImm(31).addImm(31); + } else { + BuildMI(*BB, MI, PPC::CNTLZW, 1, Temp1).addReg(Op0Reg); + BuildMI(*BB, MI, PPC::RLWINM, 4, DestReg).addReg(Temp1).addImm(27) + .addImm(5).addImm(31); + } + break; + } + } // switch + return; + } + } unsigned PPCOpcode = getPPCOpcodeForSetCCNumber(Opcode); // Create an iterator with which to insert the MBB for copying the false value @@ -1124,7 +1211,7 @@ // cmpTY cr0, r1, r2 // %TrueValue = li 1 // bCC sinkMBB - EmitComparison(Opcode, I.getOperand(0), I.getOperand(1), BB, BB->end()); + EmitComparison(Opcode, Op0, Op1, BB, BB->end()); unsigned TrueValue = makeAnotherReg(I.getType()); BuildMI(BB, PPC::LI, 1, TrueValue).addSImm(1); MachineBasicBlock *copy0MBB = new MachineBasicBlock(LLVM_BB); Index: llvm/lib/Target/PowerPC/PowerPCAsmPrinter.cpp diff -u llvm/lib/Target/PowerPC/PowerPCAsmPrinter.cpp:1.61 llvm/lib/Target/PowerPC/PowerPCAsmPrinter.cpp:1.62 --- llvm/lib/Target/PowerPC/PowerPCAsmPrinter.cpp:1.61 Sat Sep 4 21:42:44 2004 +++ llvm/lib/Target/PowerPC/PowerPCAsmPrinter.cpp Tue Sep 21 23:40:25 2004 @@ -464,7 +464,7 @@ // Print out module-level global variables here. for (Module::const_giterator I = M.gbegin(), E = M.gend(); I != E; ++I) if (I->hasInitializer()) { // External global require no code - O << "\n\n"; + O << '\n'; std::string name = Mang->getValueName(I); Constant *C = I->getInitializer(); unsigned Size = TD.getTypeSize(C->getType()); @@ -480,7 +480,7 @@ O << ".comm " << name << "," << TD.getTypeSize(C->getType()); O << "\t\t; "; WriteAsOperand(O, I, true, true, &M); - O << "\n"; + O << '\n'; } else { switch (I->getLinkage()) { case GlobalValue::LinkOnceLinkage: Index: llvm/lib/Target/PowerPC/PowerPCInstrInfo.td diff -u llvm/lib/Target/PowerPC/PowerPCInstrInfo.td:1.35 llvm/lib/Target/PowerPC/PowerPCInstrInfo.td:1.36 --- llvm/lib/Target/PowerPC/PowerPCInstrInfo.td:1.35 Mon Sep 6 13:46:59 2004 +++ llvm/lib/Target/PowerPC/PowerPCInstrInfo.td Tue Sep 21 23:40:25 2004 @@ -345,6 +345,8 @@ "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 ADDME : XOForm_3<31, 234, 0, 0, 0, 0, (ops GPRC:$rT, GPRC:$rA), + "addme $rT, $rA">; 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), From lattner at cs.uiuc.edu Wed Sep 22 00:30:37 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 22 Sep 2004 00:30:37 -0500 Subject: [llvm-commits] CVS: llvm-www/pubs/2004-09-22-LCPCLLVMTutorial-Handout.pdf 2004-09-22-LCPCLLVMTutorial-Handout.txt 2004-09-22-LCPCLLVMTutorial.html 2004-09-22-LCPCLLVMTutorial.pdf 2004-09-22-LCPCLLVMTutorial.ppt Message-ID: <200409220530.AAA00948@apoc.cs.uiuc.edu> Changes in directory llvm-www/pubs: 2004-09-22-LCPCLLVMTutorial-Handout.pdf added (r1.1) 2004-09-22-LCPCLLVMTutorial-Handout.txt added (r1.1) 2004-09-22-LCPCLLVMTutorial.html added (r1.1) 2004-09-22-LCPCLLVMTutorial.pdf added (r1.1) 2004-09-22-LCPCLLVMTutorial.ppt added (r1.1) --- Log message: Initial checkin of the LLVM tutorial I'm presenting tommorow. This is intentionally not linked into the LLVM web pages until tommorow. --- Diffs of the changes: (+476 -0) Index: llvm-www/pubs/2004-09-22-LCPCLLVMTutorial-Handout.pdf Index: llvm-www/pubs/2004-09-22-LCPCLLVMTutorial-Handout.txt diff -c /dev/null llvm-www/pubs/2004-09-22-LCPCLLVMTutorial-Handout.txt:1.1 *** /dev/null Wed Sep 22 00:30:37 2004 --- llvm-www/pubs/2004-09-22-LCPCLLVMTutorial-Handout.txt Wed Sep 22 00:30:25 2004 *************** *** 0 **** --- 1,425 ---- + //===-- SimpleArgumentPromotion.cpp - Promote by-reference arguments ------===// + // + // 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 pass promotes "by reference" arguments to be "by value" arguments. In + // practice, this means looking for internal functions that have pointer + // arguments. If we can prove, through the use of alias analysis, that an + // argument is *only* loaded, then we can pass the value into the function + // instead of the address of the value. This can cause recursive simplification + // of code and lead to the elimination of allocas (especially in C++ template + // code like the STL). + // + // This pass is a simplified version of the LLVM argpromotion pass (it + // invalidates alias analysis instead of updating it, and can not promote + // pointers to aggregates). + // + //===----------------------------------------------------------------------===// + + #include "llvm/CallGraphSCCPass.h" + #include "llvm/DerivedTypes.h" + #include "llvm/Instructions.h" + #include "llvm/Module.h" + #include "llvm/Analysis/AliasAnalysis.h" + #include "llvm/Analysis/CallGraph.h" + #include "llvm/Target/TargetData.h" + #include "llvm/Support/CallSite.h" + #include "llvm/Support/CFG.h" + #include "llvm/Support/Debug.h" + #include "llvm/ADT/DepthFirstIterator.h" + #include "llvm/ADT/Statistic.h" + #include + using namespace llvm; + + namespace { + Statistic<> NumArgumentsPromoted("simpleargpromotion", + "Number of pointer arguments promoted"); + Statistic<> NumArgumentsDead("simpleargpromotion", + "Number of dead pointer args eliminated"); + + /// SimpleArgPromotion - Convert 'by reference' arguments to 'by value'. + /// + struct SimpleArgPromotion : public CallGraphSCCPass { + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.addRequired(); + AU.addRequired(); + CallGraphSCCPass::getAnalysisUsage(AU); + } + + virtual bool runOnSCC(const std::vector &SCC); + private: + bool PromoteArguments(CallGraphNode *CGN); + bool isSafeToPromoteArgument(Argument *Arg) const; + Function *DoPromotion(Function *F, std::vector &ArgsToPromote); + }; + + RegisterOpt X("simpleargpromotion", + "Promote 'by reference' arguments to 'by value'"); + } + + bool SimpleArgPromotion::runOnSCC(const std::vector &SCC) { + bool Changed = false, LocalChange; + + do { // Iterate until we stop promoting from this SCC. + LocalChange = false; + // Attempt to promote arguments from all functions in this SCC. + for (unsigned i = 0, e = SCC.size(); i != e; ++i) + LocalChange |= PromoteArguments(SCC[i]); + Changed |= LocalChange; // Remember that we changed something. + } while (LocalChange); + + return Changed; + } + + /// PromoteArguments - This method checks the specified function to see if there + /// are any promotable arguments and if it is safe to promote the function (for + /// example, all callers are direct). If safe to promote some arguments, it + /// calls the DoPromotion method. + /// + bool SimpleArgPromotion::PromoteArguments(CallGraphNode *CGN) { + Function *F = CGN->getFunction(); + + // Make sure that it is local to this module. + if (!F || !F->hasInternalLinkage()) return false; + + // First check: see if there are any pointer arguments! If not, quick exit. + std::vector PointerArgs; + for (Function::aiterator I = F->abegin(), E = F->aend(); I != E; ++I) + if (isa(I->getType())) + PointerArgs.push_back(I); + if (PointerArgs.empty()) return false; + + // Second check: make sure that all callers are direct callers. We can't + // transform functions that have indirect callers. + for (Value::use_iterator UI = F->use_begin(), E = F->use_end(); + UI != E; ++UI) { + CallSite CS = CallSite::get(*UI); + if (!CS.getInstruction()) // "Taking the address" of the function + return false; + + // Ensure that this call site is CALLING the function, not passing it as + // an argument. + for (CallSite::arg_iterator AI = CS.arg_begin(), E = CS.arg_end(); + AI != E; ++AI) + if (*AI == F) return false; // Passing the function address in! + } + + // Check to see which arguments are promotable. If an argument is not + // promotable, remove it from the PointerArgs vector. + for (unsigned i = 0; i != PointerArgs.size(); ++i) + if (!isSafeToPromoteArgument(PointerArgs[i])) { + std::swap(PointerArgs[i--], PointerArgs.back()); + PointerArgs.pop_back(); + } + + // No promotable pointer arguments. + if (PointerArgs.empty()) return false; + + // Okay, promote all of the arguments are rewrite the callees! + Function *NewF = DoPromotion(F, PointerArgs); + + // Update the call graph to know that the old function is gone. + getAnalysis().changeFunction(F, NewF); + return true; + } + + + /// isSafeToPromoteArgument - As you might guess from the name of this method, + /// it checks to see if it is both safe and useful to promote the argument. + bool SimpleArgPromotion::isSafeToPromoteArgument(Argument *Arg) const { + // We can only promote this argument if all of the uses are loads. + std::vector Loads; + + for (Value::use_iterator UI = Arg->use_begin(), E = Arg->use_end(); + UI != E; ++UI) + if (LoadInst *LI = dyn_cast(*UI)) { + if (LI->isVolatile()) return false; // Don't modify volatile loads. + Loads.push_back(LI); + } else { + return false; // Not a load. + } + + // Okay, now we know that the argument is only used by load instructions. Use + // alias analysis to check to see if the pointer is guaranteed to not be + // modified from entry of the function to each of the load instructions. + Function &F = *Arg->getParent(); + + // Because there could be several/many load instructions, remember which + // blocks we know to be transparent to the load. + std::set TranspBlocks; + + AliasAnalysis &AA = getAnalysis(); + TargetData &TD = getAnalysis(); + + for (unsigned i = 0, e = Loads.size(); i != e; ++i) { + // Check to see if the load is invalidated from the start of the block to + // the load itself. + LoadInst *Load = Loads[i]; + BasicBlock *BB = Load->getParent(); + + const PointerType *LoadTy = + cast(Load->getOperand(0)->getType()); + unsigned LoadSize = TD.getTypeSize(LoadTy->getElementType()); + + if (AA.canInstructionRangeModify(BB->front(), *Load, Arg, LoadSize)) + return false; // Pointer is invalidated! + + // Now check every path from the entry block to the load for transparency. + // To do this, we perform a depth first search on the inverse CFG from the + // loading block. + for (pred_iterator PI = pred_begin(BB), E = pred_end(BB); PI != E; ++PI) + for (idf_ext_iterator I = idf_ext_begin(*PI, TranspBlocks), + E = idf_ext_end(*PI, TranspBlocks); I != E; ++I) + if (AA.canBasicBlockModify(**I, Arg, LoadSize)) + return false; + } + + // If the path from the entry of the function to each load is free of + // instructions that potentially invalidate the load, we can make the + // transformation! + return true; + } + + /// DoPromotion - This method actually performs the promotion of the specified + /// arguments, and returns the new function. At this point, we know that it's + /// safe to do so. + Function *SimpleArgPromotion::DoPromotion(Function *F, + std::vector &Args2Prom) { + std::set ArgsToPromote(Args2Prom.begin(), Args2Prom.end()); + + // Start by computing a new prototype for the function, which is the same as + // the old function, but has modified arguments. + const FunctionType *FTy = F->getFunctionType(); + std::vector Params; + + for (Function::aiterator I = F->abegin(), E = F->aend(); I != E; ++I) + if (!ArgsToPromote.count(I)) { + Params.push_back(I->getType()); + } else if (I->use_empty()) { + ++NumArgumentsDead; + } else { + // Add a parameter to the function for each element passed in. + Params.push_back(cast(I->getType())->getElementType()); + ++NumArgumentsPromoted; + } + + // Create the new function body and insert it into the module. + FunctionType *NFTy = FunctionType::get(FTy->getReturnType(), Params, + FTy->isVarArg()); + Function *NF = new Function(NFTy, F->getLinkage(), F->getName()); + F->getParent()->getFunctionList().insert(F, NF); + + // Loop over all of the callers of the function, transforming the call sites + // to pass in the loaded pointers. + // + std::vector Args; + while (!F->use_empty()) { + CallSite CS = CallSite::get(F->use_back()); + Instruction *Call = CS.getInstruction(); + + // Loop over the operands, inserting the loads in the caller as needed. + CallSite::arg_iterator AI = CS.arg_begin(); + for (Function::aiterator I = F->abegin(), E = F->aend(); I != E; ++I, ++AI) + if (!ArgsToPromote.count(I)) // Unmodified argument. + Args.push_back(*AI); + else if (!I->use_empty()) // Non-dead argument: insert the load. + Args.push_back(new LoadInst(*AI, (*AI)->getName()+".val", Call)); + + // Push any varargs arguments on the list + for (; AI != CS.arg_end(); ++AI) + Args.push_back(*AI); + + Instruction *New; // Create the new call or invoke instruction. + if (InvokeInst *II = dyn_cast(Call)) { + New = new InvokeInst(NF, II->getNormalDest(), II->getUnwindDest(), + Args, "", Call); + } else { + New = new CallInst(NF, Args, "", Call); + } + Args.clear(); + + if (!Call->use_empty()) { + Call->replaceAllUsesWith(New); + New->setName(Call->getName()); + } + + // Finally, remove the old call from the program, reducing the use-count of + // F. + Call->getParent()->getInstList().erase(Call); + } + + // Since we have now created the new function, splice the body of the old + // function right into the new function, leaving the old rotting hulk of the + // function empty. + NF->getBasicBlockList().splice(NF->begin(), F->getBasicBlockList()); + + // Loop over the argument list, transfering uses of the old arguments over to + // the new arguments, also transfering over the names as well. + // + for (Function::aiterator I = F->abegin(), E = F->aend(), I2 = NF->abegin(); + I != E; ++I, ++I2) + if (!ArgsToPromote.count(I)) { + // If this is an unmodified argument, move the name and users over to the + // new version. + I->replaceAllUsesWith(I2); + I2->setName(I->getName()); + } else if (!I->use_empty()) { + // Otherwise, if we promoted this argument, then all users are load + // instructions, and all loads should be using the new argument that we + // added. + while (!I->use_empty()) { + LoadInst *LI = cast(I->use_back()); + I2->setName(I->getName()+".val"); + LI->replaceAllUsesWith(I2); + LI->getParent()->getInstList().erase(LI); + DEBUG(std::cerr << "*** Promoted load of argument '" << I->getName() + << "' in function '" << F->getName() << "'\n"); + } + } + + // Now that the old function is dead, delete it. + F->getParent()->getFunctionList().erase(F); + return NF; + } + + + + + /************************ Loading the pass into 'opt' ************************** + + $ opt -load ~/llvm/lib/Debug/libsimpleargpromote.so -help + OVERVIEW: llvm .bc -> .bc modular optimizer + + USAGE: opt [options] + + OPTIONS: + Optimizations available: + ... + -sccp - Sparse Conditional Constant Propagation + -simpleargpromotion - Promote 'by reference' arguments to 'by value' + -simplifycfg - Simplify the CFG + ... + -load= - Load the specified plugin + ... + -stats - Enable statistics output from program + ... + + + ************************ Simple LLVM Example *********************************** + + --------- basictest.ll --------- + internal int %test(int *%X, int* %Y) { + %A = load int* %X + %B = load int* %Y + %C = add int %A, %B + ret int %C + } + + internal int %caller(int* %B) { + %A = alloca int + store int 1, int* %A + %C = call int %test(int* %A, int* %B) + ret int %C + } + + int %callercaller() { + %B = alloca int + store int 2, int* %B + %X = call int %caller(int* %B) + ret int %X + } + --------- basictest.ll --------- + + *********************** Run with simpleargpromotion **************************** + + $ llvm-as < basictest.ll | opt -load ~/llvm/lib/Debug/libsimpleargpromote.so \ + -simpleargpromotion -stats | llvm-dis + + ===-------------------------------------------------------------------------=== + ... Statistics Collected ... + ===-------------------------------------------------------------------------=== + + 248 bytecodewriter - Number of bytecode bytes written + 3 simpleargpromotion - Number of pointer arguments promoted + + + internal int %test(int %X.val, int %Y.val) { + %C = add int %X.val, %Y.val + ret int %C + } + + internal int %caller(int %B.val) { + %A = alloca int + store int 1, int* %A + %A.val = load int* %A + %C1 = call int %test( int %A.val, int %B.val ) + ret int %C1 + } + + int %callercaller() { + %B = alloca int + store int 2, int* %B + %B.val = load int* %B + %X1 = call int %caller( int %B.val ) + ret int %X1 + } + + *********************** Run with simpleargpromotion & mem2reg ****************** + + $ llvm-as < basictest.ll | opt -load ~/llvm/lib/Debug/libsimpleargpromote.so \ + -simpleargpromotion -mem2reg -stats | llvm-dis + + ===-------------------------------------------------------------------------=== + ... Statistics Collected ... + ===-------------------------------------------------------------------------=== + + 194 bytecodewriter - Number of bytecode bytes written + 2 mem2reg - Number of alloca's promoted + 3 simpleargpromotion - Number of pointer arguments promoted + + internal int %test(int %X.val, int %Y.val) { + %C = add int %X.val, %Y.val + ret int %C + } + + internal int %caller(int %B.val) { + %C1 = call int %test( int 1, int %B.val ) + ret int %C1 + } + + int %callercaller() { + %X1 = call int %caller( int 2 ) + ret int %X1 + } + + ****************************** Simple C++ Example ****************************** + + void test(std::vector &V) { + V.push_back(7); + } + + ... compiles to this LLVM code: + + void %_Z4testRSt6vectorIiSaIiEE("std::vector"* %V) { + %mem_tmp = alloca int + store int 7, int* %mem_tmp + call void %_ZNSt6vectorIiSaIiEE9push_backERKi("std::vector"* %V, + int* %mem_tmp) + ret void + } + + ... arg promotion and mem2reg result in this, eliminating the stack allocation + and simplifying the code. + + void %_Z4testRSt6vectorIiSaIiEE("std::vector"* %V) { + call void %_ZNSt6vectorIiSaIiEE9push_backERKi("std::vector"* %V, + int 7) + ret void + } + + */ Index: llvm-www/pubs/2004-09-22-LCPCLLVMTutorial.html diff -c /dev/null llvm-www/pubs/2004-09-22-LCPCLLVMTutorial.html:1.1 *** /dev/null Wed Sep 22 00:30:37 2004 --- llvm-www/pubs/2004-09-22-LCPCLLVMTutorial.html Wed Sep 22 00:30:25 2004 *************** *** 0 **** --- 1,51 ---- + + + + + + The LLVM Compiler Framework and Infrastructure Tutorial + + + +
+ The LLVM Compiler Framework and Infrastructure Tutorial +
+ + +

Abstract:

+
+ +

The Low-Level Virtual Machine (LLVM) is a collection of libraries and tools that make it easy to build compilers, optimizers, Just-In-Time code generators, and many other compiler-related programs. LLVM uses a single, language-independent virtual instruction set both as an offline code representation (to communicate code between compiler phases and to run-time systems) and as the compiler internal representation (to analyze and transform programs). This persistent code representation allows a common set of sophisticated compiler techniques to be applied at compile-time, link-time, install-time, run-time, or "idle-time" (between program runs).

+

The strengths of the LLVM infrastructure are its extremely simple design (which makes it easy to understand and use), source-language independence, powerful mid-level optimizer, automated compiler debugging support, extensibility, and its stability and reliability. LLVM is currently being used to host a wide variety of academic research projects and commercial projects. LLVM includes C and C++ front-ends (based on GCC 3.4), a front-end for a Forth-like language (Stacker), a young scheme front-end, and Java support is in development. LLVM can generate code for X86, SparcV9, PowerPC, or it can emit C code.

+

This tutorial describes the LLVM virtual instruction set and the high-level design of the LLVM compiler system. To illustrate the ideas in the LLVM IR, we use a running example (by-reference to by-value argument promotion) to illustrate several important API's in the LLVM system. Next, we describe some of the key tools provided by LLVM, and mention several projects that are natural targets for the LLVM system.

+
+ +

Presented:

+
+ "The LLVM Compiler Framework and Infrastructure Tutorial", Chris Lattner and Vikram Adve.
+ LCPC'04 Mini Workshop on Compiler Research + Infrastructures, West Lafayette, Indiana, Sep. 2004. +
+ +

Download:

+ + Slides: + + + Handout: + + + + Index: llvm-www/pubs/2004-09-22-LCPCLLVMTutorial.pdf Index: llvm-www/pubs/2004-09-22-LCPCLLVMTutorial.ppt From reid at x10sys.com Wed Sep 22 10:28:42 2004 From: reid at x10sys.com (Reid Spencer) Date: Wed, 22 Sep 2004 10:28:42 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Config/alloca.h Message-ID: <200409221528.KAA17102@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Config: alloca.h updated: 1.5 -> 1.6 --- Log message: The alloca function, strangely enough, is found in the malloc.h header file on MINGW platform. Provide an #elseif case to #include malloc.h for this platform if malloc.h is found. Patch provided by Henrik Bach. Thanks Henrik! --- Diffs of the changes: (+2 -0) Index: llvm/include/llvm/Config/alloca.h diff -u llvm/include/llvm/Config/alloca.h:1.5 llvm/include/llvm/Config/alloca.h:1.6 --- llvm/include/llvm/Config/alloca.h:1.5 Wed Sep 1 17:55:34 2004 +++ llvm/include/llvm/Config/alloca.h Wed Sep 22 10:28:32 2004 @@ -27,6 +27,8 @@ /* noop on Visual C++ */ #elif defined(HAVE_ALLOCA_H) #include +#elif defined(__MINGW_H) && defined(HAVE_MALLOC_H) +#include #elif !defined(__GNUC__) # ifdef _AIX # pragma alloca From reid at x10sys.com Wed Sep 22 10:32:18 2004 From: reid at x10sys.com (Reid Spencer) Date: Wed, 22 Sep 2004 10:32:18 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Config/config.h.in Message-ID: <200409221532.KAA17185@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Config: config.h.in updated: 1.28 -> 1.29 --- Log message: Update to add the HAVE_UINT64_T test and the STACK_DIRECTION indicator. --- Diffs of the changes: (+4 -7) Index: llvm/include/llvm/Config/config.h.in diff -u llvm/include/llvm/Config/config.h.in:1.28 llvm/include/llvm/Config/config.h.in:1.29 --- llvm/include/llvm/Config/config.h.in:1.28 Sun Sep 12 17:40:40 2004 +++ llvm/include/llvm/Config/config.h.in Wed Sep 22 10:32:08 2004 @@ -158,9 +158,6 @@ /* Define to 1 if the system has the type `uint64_t'. */ #undef HAVE_UINT64_T -/* Define to 1 if the system has the type `u_int64_t'. */ -#undef HAVE_U_INT64_T - /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H @@ -219,11 +216,11 @@ #undef SHLIBEXT /* If using the C implementation of alloca, define if you know the - direction of stack growth for your system; otherwise, it will be + direction of stack growth for your system; otherwise it will be automatically deduced at run-time. - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown */ + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ #undef STACK_DIRECTION /* Define to 1 if you have the ANSI C header files. */ From brukman at cs.uiuc.edu Wed Sep 22 17:38:45 2004 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Wed, 22 Sep 2004 17:38:45 -0500 Subject: [llvm-commits] CVS: llvm-www/www-index.html Message-ID: <200409222238.RAA08981@zion.cs.uiuc.edu> Changes in directory llvm-www: www-index.html updated: 1.113 -> 1.114 --- Log message: Mention that we have a static PowerPC backend --- Diffs of the changes: (+5 -5) Index: llvm-www/www-index.html diff -u llvm-www/www-index.html:1.113 llvm-www/www-index.html:1.114 --- llvm-www/www-index.html:1.113 Tue Sep 7 00:07:52 2004 +++ llvm-www/www-index.html Wed Sep 22 17:38:34 2004 @@ -32,11 +32,11 @@
  • A compiler infrastructure - LLVM is also a collection of source code that implements the language and compilation strategy. The primary components of the LLVM infrastructure are a -GCC-based C & C++ front-end, a -link-time optimization framework with a growing set of global and -interprocedural analyses and transformations, static back-ends for the SPARC v9 -and X86 architectures, a back-end which emits portable C code, and a -Just-In-Time compiler for X86 and SPARC v9 processors. See "C & C++ +front-end, a link-time optimization framework with a growing set of global +and interprocedural analyses and transformations, static back-ends for the X86, +PowerPC, and SPARC V9 architectures, a back-end which emits portable C code, and +a Just-In-Time compiler for X86 and SPARC V9 processors. See "Current Projects" for information about other components under development.

  • From alkis at cs.uiuc.edu Wed Sep 22 17:48:12 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Wed, 22 Sep 2004 17:48:12 -0500 Subject: [llvm-commits] CVS: llvm-java/lib/Compiler/Compiler.cpp Message-ID: <200409222248.RAA09223@zion.cs.uiuc.edu> Changes in directory llvm-java/lib/Compiler: Compiler.cpp updated: 1.109 -> 1.110 --- Log message: Add static ObjectBaseTy field in ClassInfo. --- Diffs of the changes: (+5 -3) Index: llvm-java/lib/Compiler/Compiler.cpp diff -u llvm-java/lib/Compiler/Compiler.cpp:1.109 llvm-java/lib/Compiler/Compiler.cpp:1.110 --- llvm-java/lib/Compiler/Compiler.cpp:1.109 Tue Sep 21 17:49:11 2004 +++ llvm-java/lib/Compiler/Compiler.cpp Wed Sep 22 17:48:02 2004 @@ -158,6 +158,7 @@ Field2IndexMap f2iMap; static unsigned InterfaceCount; + static Type* ObjectBaseTy; }; typedef std::map Class2ClassInfoMap; Class2ClassInfoMap c2ciMap_; @@ -286,10 +287,10 @@ // because this is java/lang/Object, we add the opaque // llvm_java_object_base type first - Type* base = OpaqueType::get(); - module_->addTypeName(LLVM_JAVA_OBJECT_BASE, base); + ClassInfo::ObjectBaseTy = OpaqueType::get(); + module_->addTypeName(LLVM_JAVA_OBJECT_BASE, ClassInfo::ObjectBaseTy); ci.f2iMap.insert(std::make_pair(LLVM_JAVA_OBJECT_BASE, elements.size())); - elements.push_back(base); + elements.push_back(ClassInfo::ObjectBaseTy); const Fields& fields = cf->getFields(); for (unsigned i = 0, e = fields.size(); i != e; ++i) { @@ -1515,6 +1516,7 @@ }; unsigned CompilerImpl::ClassInfo::InterfaceCount = 0; + Type* CompilerImpl::ClassInfo::ObjectBaseTy; StructType* CompilerImpl::VTableInfo::VTableTy; StructType* CompilerImpl::VTableInfo::TypeInfoTy; From alkis at cs.uiuc.edu Wed Sep 22 18:15:42 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Wed, 22 Sep 2004 18:15:42 -0500 Subject: [llvm-commits] CVS: llvm-java/lib/Compiler/Compiler.cpp Message-ID: <200409222315.SAA20223@zion.cs.uiuc.edu> Changes in directory llvm-java/lib/Compiler: Compiler.cpp updated: 1.110 -> 1.111 --- Log message: Ignore abstract methods as well, since they are not defined. --- Diffs of the changes: (+5 -0) Index: llvm-java/lib/Compiler/Compiler.cpp diff -u llvm-java/lib/Compiler/Compiler.cpp:1.110 llvm-java/lib/Compiler/Compiler.cpp:1.111 --- llvm-java/lib/Compiler/Compiler.cpp:1.110 Wed Sep 22 17:48:02 2004 +++ llvm-java/lib/Compiler/Compiler.cpp Wed Sep 22 18:15:31 2004 @@ -774,6 +774,11 @@ std::cerr << classMethodDesc << '\n'); return function; } + else if (method->isAbstract()) { + DEBUG(std::cerr << "Ignoring abstract method: "; + std::cerr << classMethodDesc << '\n'); + return function; + } DEBUG(std::cerr << "Compiling method: " << classMethodDesc << '\n'); From alkis at cs.uiuc.edu Wed Sep 22 18:49:58 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Wed, 22 Sep 2004 18:49:58 -0500 Subject: [llvm-commits] CVS: llvm-java/runtime/runtime.c Message-ID: <200409222349.SAA32278@zion.cs.uiuc.edu> Changes in directory llvm-java/runtime: runtime.c updated: 1.7 -> 1.8 --- Log message: Add stub for throwing an exception. This just calls abort. --- Diffs of the changes: (+5 -0) Index: llvm-java/runtime/runtime.c diff -u llvm-java/runtime/runtime.c:1.7 llvm-java/runtime/runtime.c:1.8 --- llvm-java/runtime/runtime.c:1.7 Tue Sep 21 17:23:00 2004 +++ llvm-java/runtime/runtime.c Wed Sep 22 18:49:47 2004 @@ -1,3 +1,5 @@ +#include + struct llvm_java_object_base; struct llvm_java_object_header; struct llvm_java_object_vtable; @@ -79,6 +81,9 @@ } } +jint llvm_java_Throw(jobject obj) { + abort(); +} extern void llvm_java_static_init(void); extern void llvm_java_main(int, char**); From alkis at cs.uiuc.edu Wed Sep 22 18:49:58 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Wed, 22 Sep 2004 18:49:58 -0500 Subject: [llvm-commits] CVS: llvm-java/lib/Compiler/Compiler.cpp Message-ID: <200409222349.SAA32281@zion.cs.uiuc.edu> Changes in directory llvm-java/lib/Compiler: Compiler.cpp updated: 1.111 -> 1.112 --- Log message: Add stub for throwing an exception. This just calls abort. --- Diffs of the changes: (+7 -1) Index: llvm-java/lib/Compiler/Compiler.cpp diff -u llvm-java/lib/Compiler/Compiler.cpp:1.111 llvm-java/lib/Compiler/Compiler.cpp:1.112 --- llvm-java/lib/Compiler/Compiler.cpp:1.111 Wed Sep 22 18:15:31 2004 +++ llvm-java/lib/Compiler/Compiler.cpp Wed Sep 22 18:49:47 2004 @@ -39,6 +39,7 @@ #define LLVM_JAVA_ISINSTANCEOF "llvm_java_IsInstanceOf" #define LLVM_JAVA_GETOBJECTCLASS "llvm_java_GetObjectClass" +#define LLVM_JAVA_THROW "llvm_java_Throw" using namespace llvm; using namespace llvm::Java; @@ -1477,7 +1478,12 @@ } void do_athrow(unsigned bcI) { - assert(0 && "not implemented"); + Value* objRef = opStack_.top(); opStack_.pop(); + objRef = new CastInst(objRef, PointerType::get(ClassInfo::ObjectBaseTy), + TMP, getBBAt(bcI)); + Function* f = module_->getOrInsertFunction( + LLVM_JAVA_THROW, Type::IntTy, objRef->getType(), NULL); + new CallInst(f, objRef, TMP, getBBAt(bcI)); } void do_checkcast(unsigned bcI, unsigned index) { From reid at x10sys.com Wed Sep 22 19:58:17 2004 From: reid at x10sys.com (Reid Spencer) Date: Wed, 22 Sep 2004 19:58:17 -0500 Subject: [llvm-commits] CVS: llvm/Makefile.rules Message-ID: <200409230058.TAA32562@zion.cs.uiuc.edu> Changes in directory llvm: Makefile.rules updated: 1.196 -> 1.197 --- Log message: Correct the rules for making shared libraries per libtool 1.5.10 --- Diffs of the changes: (+10 -9) Index: llvm/Makefile.rules diff -u llvm/Makefile.rules:1.196 llvm/Makefile.rules:1.197 --- llvm/Makefile.rules:1.196 Sun Sep 19 20:43:00 2004 +++ llvm/Makefile.rules Wed Sep 22 19:58:06 2004 @@ -500,10 +500,10 @@ # Make sure there isn't any extranous whitespace on the LIBRARYNAME option LIBRARYNAME := $(strip $(LIBRARYNAME)) -LIBNAME_O := $(DESTLIBRELEASE)/lib$(LIBRARYNAME)$(SHLIBEXT) -LIBNAME_P := $(DESTLIBPROFILE)/lib$(LIBRARYNAME)$(SHLIBEXT) -LIBNAME_G := $(DESTLIBDEBUG)/lib$(LIBRARYNAME)$(SHLIBEXT) -LIBNAME_CUR := $(DESTLIBCURRENT)/lib$(LIBRARYNAME)$(SHLIBEXT) +LIBNAME_O := $(DESTLIBRELEASE)/lib$(LIBRARYNAME).la +LIBNAME_P := $(DESTLIBPROFILE)/lib$(LIBRARYNAME).la +LIBNAME_G := $(DESTLIBDEBUG)/lib$(LIBRARYNAME).la +LIBNAME_CUR := $(DESTLIBCURRENT)/lib$(LIBRARYNAME).la LIBNAME_AO := $(DESTLIBRELEASE)/lib$(LIBRARYNAME).a LIBNAME_AP := $(DESTLIBPROFILE)/lib$(LIBRARYNAME).a LIBNAME_AG := $(DESTLIBDEBUG)/lib$(LIBRARYNAME).a @@ -567,25 +567,26 @@ # $(LIBNAME_O): $(ObjectsO) $(LibSubDirs) $(DESTLIBRELEASE)/.dir @${ECHO} Linking $(LIBRARYNAME) dynamic release library - $(VERB) $(Link) -o $*.la $(ObjectsO) $(LibSubDirs) $(LibLinkOpts) + $(VERB) $(Link) -o $@ $(ObjectsO) $(LibSubDirs) $(LibLinkOpts) $(VERB) $(LIBTOOL) --mode=install $(INSTALL) $*.la $(DESTLIBCURRENT) @${ECHO} ======= Finished building $(LIBRARYNAME) dynamic release library ======= $(LIBNAME_P): $(ObjectsP) $(LibSubDirs) $(DESTLIBPROFILE)/.dir @${ECHO} Linking $(LIBRARYNAME) dynamic profile library - $(VERB) $(Link) -o $*.la $(ObjectsP) $(LibSubDirs) $(LibLinkOpts) - $(VERB) $(LIBTOOL) --mode=install $(INSTALL) $*.la $(DESTLIBCURRENT) + $(VERB) $(Link) -o $@ $(ObjectsP) $(LibSubDirs) $(LibLinkOpts) + $(VERB) $(LIBTOOL) --mode=install $(INSTALL) $@ $(DESTLIBCURRENT) @${ECHO} ======= Finished building $(LIBRARYNAME) dynamic profile library ======= $(LIBNAME_G): $(ObjectsG) $(LibSubDirs) $(DESTLIBDEBUG)/.dir @${ECHO} Linking $(LIBRARYNAME) dynamic debug library - $(VERB) $(Link) -o $*.la $(ObjectsG) $(LibSubDirs) $(LibLinkOpts) - $(VERB) $(LIBTOOL) --mode=install $(INSTALL) $*.la $(DESTLIBCURRENT) + $(VERB) $(Link) -o $@ $(ObjectsG) $(LibSubDirs) $(LibLinkOpts) + $(VERB) $(LIBTOOL) --mode=install $(INSTALL) $@ $(DESTLIBCURRENT) @${ECHO} ======= Finished building $(LIBRARYNAME) dynamic debug library ======= install-dynamic-library: $(LIBNAME_CUR) $(MKDIR) $(DESTDIR)$(libdir) $(VERB) $(LIBTOOL) --mode=install $(INSTALL) $(LIBNAME_CUR) $(DESTDIR)$(libdir)/lib$(LIBRARYNAME)$(SHLIBEXT) + $(VERB) $(LIBTOOL) --finish $(DESTDIR)$(libdir) # # Rules for building static archive libraries. From lattner at cs.uiuc.edu Wed Sep 22 20:59:17 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 22 Sep 2004 20:59:17 -0500 Subject: [llvm-commits] CVS: llvm-www/pubs/index.html Message-ID: <200409230159.UAA03451@apoc.cs.uiuc.edu> Changes in directory llvm-www/pubs: index.html updated: 1.6 -> 1.7 --- Log message: Add tutorial --- Diffs of the changes: (+8 -0) Index: llvm-www/pubs/index.html diff -u llvm-www/pubs/index.html:1.6 llvm-www/pubs/index.html:1.7 --- llvm-www/pubs/index.html:1.6 Mon Feb 23 14:58:11 2004 +++ llvm-www/pubs/index.html Wed Sep 22 20:59:05 2004 @@ -2,6 +2,14 @@
    LLVM Related Publications
      +
    1. " + The LLVM Compiler Framework and Infrastructure Tutorial"
      + Chris Lattner and Vikram Adve. LCPC'04 Mini Workshop on + Compiler Research Infrastructures, West Lafayette, + Indiana, Sep. 2004. +
    2. " LLVM: A Compilation Framework for Lifelong Program Analysis & Transformation"
      From lattner at cs.uiuc.edu Wed Sep 22 22:25:27 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 22 Sep 2004 22:25:27 -0500 Subject: [llvm-commits] CVS: llvm-www/www-index.html Message-ID: <200409230325.WAA03626@apoc.cs.uiuc.edu> Changes in directory llvm-www: www-index.html updated: 1.114 -> 1.115 --- Log message: add link to tutorial --- Diffs of the changes: (+2 -1) Index: llvm-www/www-index.html diff -u llvm-www/www-index.html:1.114 llvm-www/www-index.html:1.115 --- llvm-www/www-index.html:1.114 Wed Sep 22 17:38:34 2004 +++ llvm-www/www-index.html Wed Sep 22 22:25:17 2004 @@ -77,7 +77,8 @@
      Want to learn more?
      -

      If you'd like to learn more about LLVM, please take a look at the extensive +

      If you'd like to learn more about LLVM, take a look at LLVM Tutorial and the extensive documentation for LLVM. In particular, all of the tools distributed with LLVM are described in the LLVM Command Guide. If you're interested in what From lattner at cs.uiuc.edu Wed Sep 22 22:38:51 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 22 Sep 2004 22:38:51 -0500 Subject: [llvm-commits] CVS: llvm-www/ProjectsWithLLVM/2004-Spring-RubyComp.pdf index.html Message-ID: <200409230338.WAA03713@apoc.cs.uiuc.edu> Changes in directory llvm-www/ProjectsWithLLVM: 2004-Spring-RubyComp.pdf added (r1.1) index.html updated: 1.18 -> 1.19 --- Log message: Add RubyComp (with anders' permission) --- Diffs of the changes: (+39 -0) Index: llvm-www/ProjectsWithLLVM/2004-Spring-RubyComp.pdf Index: llvm-www/ProjectsWithLLVM/index.html diff -u llvm-www/ProjectsWithLLVM/index.html:1.18 llvm-www/ProjectsWithLLVM/index.html:1.19 --- llvm-www/ProjectsWithLLVM/index.html:1.18 Tue Sep 7 00:17:27 2004 +++ llvm-www/ProjectsWithLLVM/index.html Wed Sep 22 22:38:41 2004 @@ -33,6 +33,7 @@

      + + + + + +
      By Anders Alexandersson
      + +
      + +

      Dynamic programming languages are not generally precompiled, +but are interpreted at run-time. This approach +has some serious drawbacks, e.g. complex deployment, human +readable source code not preserving the intellectual +properties of the developers and no ability to do optimizations +at compile-time or run-time.

      + +

      In this paper we study the possibility to precompile the +Ruby language, a dynamic object-oriented language, into +Low Level Virtual Machine (LLVM) code for execution by +the LLVM run-time, a compiler framework for lifelong optimization +of an application. The result of the project is a +Ruby compiler prototype, describing the infrastructure and +overall design principles to map the highly dynamic properties +of the Ruby language into low-level static constructs +of the LLVM language.

      + +

      The LLVM framework supports different hardware platforms, +and by using LLVM as the target of compilation the +benefits of that portability are gained. +

      + +

      Thesis: PDF

      +
      + + +
      Scheme to LLVM Translator
      From lattner at cs.uiuc.edu Wed Sep 22 22:58:08 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 22 Sep 2004 22:58:08 -0500 Subject: [llvm-commits] CVS: llvm-www/www-index.html Message-ID: <200409230358.WAA03774@apoc.cs.uiuc.edu> Changes in directory llvm-www: www-index.html updated: 1.115 -> 1.116 --- Log message: Update funding information --- Diffs of the changes: (+4 -3) Index: llvm-www/www-index.html diff -u llvm-www/www-index.html:1.115 llvm-www/www-index.html:1.116 --- llvm-www/www-index.html:1.115 Wed Sep 22 22:25:17 2004 +++ llvm-www/www-index.html Wed Sep 22 22:57:58 2004 @@ -140,10 +140,11 @@ href="http://www.cise.nsf.gov/fndg/pubs/display2.cfm?pgm_pims_id=5160&pgm_supp_id=10070&loc=acir&pub_id=5372&div=acir">NSF Next Generation Software program through grants EIA-0093426 (an NSF CAREER award) and EIA-0103756. It is also supported in part by the NSF - Operating Systems and Compilers program (grant #CCR-9988482), by the - NSF Embedded Systems program (grant #CCR-0209202), and by the + Operating Systems and Compilers program (grant #CCR-9988482), the + NSF Embedded Systems program (grant #CCR-0209202), the MARCO/DARPA Gigascale Systems Research - Center (GSRC).

      + Center (GSRC), IBM through the DARPA-funded PERCS project, and the Motorola University +Partnerships in Research program.

      From lattner at cs.uiuc.edu Wed Sep 22 23:30:18 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 22 Sep 2004 23:30:18 -0500 Subject: [llvm-commits] CVS: llvm/CREDITS.TXT Message-ID: <200409230430.XAA03862@apoc.cs.uiuc.edu> Changes in directory llvm: CREDITS.TXT updated: 1.28 -> 1.29 --- Log message: Update credits --- Diffs of the changes: (+9 -0) Index: llvm/CREDITS.TXT diff -u llvm/CREDITS.TXT:1.28 llvm/CREDITS.TXT:1.29 --- llvm/CREDITS.TXT:1.28 Tue Sep 21 11:54:37 2004 +++ llvm/CREDITS.TXT Wed Sep 22 23:30:05 2004 @@ -12,6 +12,9 @@ W: http://www.cs.uiuc.edu/~vadve/ D: The Sparc64 backend, provider of much wisdom, and motivator for LLVM +N: Henrik Bach +D: MingW Win32 API portability layer + N: Nate Begeman E: natebegeman at mac.com D: Portions of the PowerPC backend @@ -35,6 +38,9 @@ E: ccarter at uiuc.edu D: Fixes to the Reassociation pass, various improvement patches +N: Jeff Cohen +D: Native Win32 API portability layer + N: John T. Criswell E: criswell at uiuc.edu D: Autoconf support, QMTest database, documentation improvements @@ -49,6 +55,9 @@ N: Louis Gerbarg D: Portions of the PowerPC backend +N: Paolo Invernizzi +D: Visual C++ compatibility fixes + N: Brad Jones E: kungfoomaster at nondot.org D: Support for packed types From lattner at cs.uiuc.edu Wed Sep 22 23:36:14 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 22 Sep 2004 23:36:14 -0500 Subject: [llvm-commits] CVS: llvm/CREDITS.TXT Message-ID: <200409230436.XAA03893@apoc.cs.uiuc.edu> Changes in directory llvm: CREDITS.TXT updated: 1.29 -> 1.30 --- Log message: Grrr... I shouldn't have to do this one :) --- Diffs of the changes: (+3 -0) Index: llvm/CREDITS.TXT diff -u llvm/CREDITS.TXT:1.29 llvm/CREDITS.TXT:1.30 --- llvm/CREDITS.TXT:1.29 Wed Sep 22 23:30:05 2004 +++ llvm/CREDITS.TXT Wed Sep 22 23:36:01 2004 @@ -45,6 +45,9 @@ E: criswell at uiuc.edu D: Autoconf support, QMTest database, documentation improvements +N: Alkis Evlogimenos +D: Linear scan register allocator, many codegen improvements, Java frontend + N: Brian Gaeke E: gaeke at uiuc.edu W: http://www.students.uiuc.edu/~gaeke/ From lattner at cs.uiuc.edu Wed Sep 22 23:38:52 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 22 Sep 2004 23:38:52 -0500 Subject: [llvm-commits] CVS: llvm-www/pubs/2004-09-22-LCPCLLVMTutorial.pdf 2004-09-22-LCPCLLVMTutorial.ppt Message-ID: <200409230438.XAA03931@apoc.cs.uiuc.edu> Changes in directory llvm-www/pubs: 2004-09-22-LCPCLLVMTutorial.pdf updated: 1.1 -> 1.2 2004-09-22-LCPCLLVMTutorial.ppt updated: 1.1 -> 1.2 --- Log message: New, updated, with funding and contributor/acknowledgements slide (#2) --- Diffs of the changes: (+0 -0) Index: llvm-www/pubs/2004-09-22-LCPCLLVMTutorial.pdf Index: llvm-www/pubs/2004-09-22-LCPCLLVMTutorial.ppt From alkis at cs.uiuc.edu Wed Sep 22 23:39:41 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Wed, 22 Sep 2004 23:39:41 -0500 Subject: [llvm-commits] CVS: llvm/CREDITS.TXT Message-ID: <200409230439.XAA01619@zion.cs.uiuc.edu> Changes in directory llvm: CREDITS.TXT updated: 1.30 -> 1.31 --- Log message: Update email address --- Diffs of the changes: (+1 -0) Index: llvm/CREDITS.TXT diff -u llvm/CREDITS.TXT:1.30 llvm/CREDITS.TXT:1.31 --- llvm/CREDITS.TXT:1.30 Wed Sep 22 23:36:01 2004 +++ llvm/CREDITS.TXT Wed Sep 22 23:39:30 2004 @@ -46,6 +46,7 @@ D: Autoconf support, QMTest database, documentation improvements N: Alkis Evlogimenos +E: alkis at evlogimenos.com D: Linear scan register allocator, many codegen improvements, Java frontend N: Brian Gaeke From natebegeman at mac.com Thu Sep 23 00:31:43 2004 From: natebegeman at mac.com (Nate Begeman) Date: Thu, 23 Sep 2004 00:31:43 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp Message-ID: <200409230531.AAA03162@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPC32ISelSimple.cpp updated: 1.80 -> 1.81 --- Log message: Fix the last of the major PPC GEP folding deficiencies. This will allow the ISel to use indexed and non-zero immediate offsets for GEPs that have more than one use. This is common for instruction sequences such as a load followed by a modify and store to the same address. --- Diffs of the changes: (+163 -178) Index: llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp diff -u llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.80 llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.81 --- llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.80 Tue Sep 21 23:40:25 2004 +++ llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp Thu Sep 23 00:31:33 2004 @@ -32,8 +32,9 @@ using namespace llvm; namespace { - Statistic<> NumSetCC("ppc-codegen", "Number of SetCC straight-lined"); - + Statistic<> + MultiUseGEP("ppc-codegen", "Number of GEPs folded with more than one use"); + /// TypeClass - Used by the PowerPC backend to group LLVM types by their basic /// PPC Representation. /// @@ -79,13 +80,35 @@ MachineBasicBlock *BB; // The current MBB we are compiling int VarArgsFrameIndex; // FrameIndex for start of varargs area - std::map RegMap; // Mapping between Values and SSA Regs + /// CollapsedGepOp - This struct is for recording the intermediate results + /// used to calculate the base, index, and offset of a GEP instruction. + struct CollapsedGepOp { + ConstantSInt *offset; // the current offset into the struct/array + Value *index; // the index of the array element + ConstantUInt *size; // the size of each array element + CollapsedGepOp(ConstantSInt *o, Value *i, ConstantUInt *s) : + offset(o), index(i), size(s) {} + }; + + /// FoldedGEP - This struct is for recording the necessary information to + /// emit the GEP in a load or store instruction, used by emitGEPOperation. + struct FoldedGEP { + unsigned base; + unsigned index; + ConstantSInt *offset; + FoldedGEP() : base(0), index(0), offset(0) {} + FoldedGEP(unsigned b, unsigned i, ConstantSInt *o) : + base(b), index(i), offset(o) {} + }; // External functions used in the Module Function *fmodfFn, *fmodFn, *__cmpdi2Fn, *__moddi3Fn, *__divdi3Fn, *__umoddi3Fn, *__udivdi3Fn, *__fixsfdiFn, *__fixdfdiFn, *__fixunssfdiFn, *__fixunsdfdiFn, *__floatdisfFn, *__floatdidfFn, *mallocFn, *freeFn; + // Mapping between Values and SSA Regs + std::map RegMap; + // MBBMap - Mapping between LLVM BB -> Machine BB std::map MBBMap; @@ -93,6 +116,9 @@ // FrameIndex for the alloca. std::map AllocaMap; + // GEPMap - Mapping between basic blocks and GEP definitions + std::map GEPMap; + // A Reg to hold the base address used for global loads and stores, and a // flag to set whether or not we need to emit it for this function. unsigned GlobalBaseReg; @@ -170,6 +196,7 @@ // Select the PHI nodes SelectPHINodes(); + GEPMap.clear(); RegMap.clear(); MBBMap.clear(); AllocaMap.clear(); @@ -222,15 +249,6 @@ ValueRecord(unsigned R, const Type *T) : Val(0), Reg(R), Ty(T) {} ValueRecord(Value *V) : Val(V), Reg(0), Ty(V->getType()) {} }; - - // This struct is for recording the necessary operations to emit the GEP - struct CollapsedGepOp { - bool isMul; - Value *index; - ConstantSInt *size; - CollapsedGepOp(bool mul, Value *i, ConstantSInt *s) : - isMul(mul), index(i), size(s) {} - }; void doCall(const ValueRecord &Ret, MachineInstr *CallMI, const std::vector &Args, bool isVarArg); @@ -292,10 +310,7 @@ /// constant expression GEP support. /// void emitGEPOperation(MachineBasicBlock *BB, MachineBasicBlock::iterator IP, - Value *Src, User::op_iterator IdxBegin, - User::op_iterator IdxEnd, unsigned TargetReg, - bool CollapseRemainder, ConstantSInt **Remainder, - unsigned *PendingAddReg); + GetElementPtrInst *GEPI, bool foldGEP); /// emitCastOperation - Common code shared between visitCastInst and /// constant expression cast support. @@ -377,6 +392,13 @@ void emitUCOM(MachineBasicBlock *MBB, MachineBasicBlock::iterator MBBI, unsigned LHS, unsigned RHS); + /// emitAdd - A convenience function to emit the necessary code to add a + /// constant signed value to a register. + /// + void emitAdd(MachineBasicBlock *MBB, + MachineBasicBlock::iterator IP, + unsigned Op0Reg, ConstantSInt *Op1, unsigned DestReg); + /// makeAnotherReg - This method returns the next register number we haven't /// yet used. /// @@ -905,26 +927,38 @@ return 0; } - // canFoldGEPIntoLoadOrStore - Return the GEP instruction if we can fold it into // the load or store instruction that is the only user of the GEP. // static GetElementPtrInst *canFoldGEPIntoLoadOrStore(Value *V) { - if (GetElementPtrInst *GEPI = dyn_cast(V)) - if (GEPI->hasOneUse()) { - Instruction *User = cast(GEPI->use_back()); + if (GetElementPtrInst *GEPI = dyn_cast(V)) { + bool AllUsesAreMem = true; + for (Value::use_iterator I = GEPI->use_begin(), E = GEPI->use_end(); + I != E; ++I) { + Instruction *User = cast(*I); + + // If the GEP is the target of a store, but not the source, then we are ok + // to fold it. if (isa(User) && GEPI->getParent() == User->getParent() && User->getOperand(0) != GEPI && - User->getOperand(1) == GEPI) { - return GEPI; - } + User->getOperand(1) == GEPI) + continue; + + // If the GEP is the source of a load, then we're always ok to fold it if (isa(User) && GEPI->getParent() == User->getParent() && - User->getOperand(0) == GEPI) { - return GEPI; - } + User->getOperand(0) == GEPI) + continue; + + // if we got to this point, than the instruction was not a load or store + // that we are capable of folding the GEP into. + AllUsesAreMem = false; + break; } + if (AllUsesAreMem) + return GEPI; + } return 0; } @@ -1125,7 +1159,6 @@ ConstantInt *CI = dyn_cast(Op1); if (CI && CI->getRawValue() == 0) { - ++NumSetCC; unsigned Op0Reg = ExtendOrClear(BB, MI, Op0); // comparisons against constant zero and negative one often have shorter @@ -1249,8 +1282,6 @@ /// emitSelect - Common code shared between visitSelectInst and the constant /// expression support. -/// FIXME: this is most likely broken in one or more ways. Namely, PowerPC has -/// no select instruction. FSEL only works for comparisons against zero. void PPC32ISel::emitSelectOperation(MachineBasicBlock *MBB, MachineBasicBlock::iterator IP, Value *Cond, Value *TrueVal, @@ -2565,47 +2596,33 @@ return; } - // If this load is the only use of the GEP instruction that is its address, - // then we can fold the GEP directly into the load instruction. - // emitGEPOperation with a second to last arg of 'true' will place the - // base register for the GEP into baseReg, and the constant offset from that - // into offset. If the offset fits in 16 bits, we can emit a reg+imm store - // otherwise, we copy the offset into another reg, and use reg+reg addressing. + // If the offset fits in 16 bits, we can emit a reg+imm load, otherwise, we + // use the index from the FoldedGEP struct and use reg+reg addressing. if (GetElementPtrInst *GEPI = canFoldGEPIntoLoadOrStore(SourceAddr)) { - unsigned baseReg = getReg(GEPI); - unsigned pendingAdd; - ConstantSInt *offset; - - emitGEPOperation(BB, BB->end(), GEPI->getOperand(0), GEPI->op_begin()+1, - GEPI->op_end(), baseReg, true, &offset, &pendingAdd); - - if (pendingAdd == 0 && Class != cLong && - canUseAsImmediateForOpcode(offset, 0)) { - if (LoadNeedsSignExtend(I)) { - unsigned TmpReg = makeAnotherReg(I.getType()); + + // Generate the code for the GEP and get the components of the folded GEP + emitGEPOperation(BB, BB->end(), GEPI, true); + unsigned baseReg = GEPMap[GEPI].base; + unsigned indexReg = GEPMap[GEPI].index; + ConstantSInt *offset = GEPMap[GEPI].offset; + + if (Class != cLong) { + unsigned TmpReg = makeAnotherReg(I.getType()); + if (indexReg == 0) BuildMI(BB, ImmOpcode, 2, TmpReg).addSImm(offset->getValue()) .addReg(baseReg); + else + BuildMI(BB, IdxOpcode, 2, TmpReg).addReg(indexReg).addReg(baseReg); + if (LoadNeedsSignExtend(I)) BuildMI(BB, PPC::EXTSB, 1, DestReg).addReg(TmpReg); - } else { - BuildMI(BB, ImmOpcode, 2, DestReg).addSImm(offset->getValue()) - .addReg(baseReg); - } - return; - } - - unsigned indexReg = (pendingAdd != 0) ? pendingAdd : getReg(offset); - - if (Class == cLong) { + else + BuildMI(BB, PPC::OR, 2, DestReg).addReg(TmpReg).addReg(TmpReg); + } else { + indexReg = (indexReg != 0) ? indexReg : getReg(offset); unsigned indexPlus4 = makeAnotherReg(Type::IntTy); BuildMI(BB, PPC::ADDI, 2, indexPlus4).addReg(indexReg).addSImm(4); BuildMI(BB, IdxOpcode, 2, DestReg).addReg(indexReg).addReg(baseReg); BuildMI(BB, IdxOpcode, 2, DestReg+1).addReg(indexPlus4).addReg(baseReg); - } else if (LoadNeedsSignExtend(I)) { - unsigned TmpReg = makeAnotherReg(I.getType()); - BuildMI(BB, IdxOpcode, 2, TmpReg).addReg(indexReg).addReg(baseReg); - BuildMI(BB, PPC::EXTSB, 1, DestReg).addReg(TmpReg); - } else { - BuildMI(BB, IdxOpcode, 2, DestReg).addReg(indexReg).addReg(baseReg); } return; } @@ -2647,38 +2664,30 @@ unsigned IdxOpcode = IdxOpcodes[Class]; unsigned ValReg = getReg(I.getOperand(0)); - // If this store is the only use of the GEP instruction that is its address, - // then we can fold the GEP directly into the store instruction. - // emitGEPOperation with a second to last arg of 'true' will place the - // base register for the GEP into baseReg, and the constant offset from that - // into offset. If the offset fits in 16 bits, we can emit a reg+imm store - // otherwise, we copy the offset into another reg, and use reg+reg addressing. + // If the offset fits in 16 bits, we can emit a reg+imm store, otherwise, we + // use the index from the FoldedGEP struct and use reg+reg addressing. if (GetElementPtrInst *GEPI = canFoldGEPIntoLoadOrStore(SourceAddr)) { - unsigned baseReg = getReg(GEPI); - unsigned pendingAdd; - ConstantSInt *offset; - - emitGEPOperation(BB, BB->end(), GEPI->getOperand(0), GEPI->op_begin()+1, - GEPI->op_end(), baseReg, true, &offset, &pendingAdd); - - if (0 == pendingAdd && Class != cLong && - canUseAsImmediateForOpcode(offset, 0)) { - BuildMI(BB, ImmOpcode, 3).addReg(ValReg).addSImm(offset->getValue()) - .addReg(baseReg); - return; - } + // Generate the code for the GEP and get the components of the folded GEP + emitGEPOperation(BB, BB->end(), GEPI, true); + unsigned baseReg = GEPMap[GEPI].base; + unsigned indexReg = GEPMap[GEPI].index; + ConstantSInt *offset = GEPMap[GEPI].offset; - unsigned indexReg = (pendingAdd != 0) ? pendingAdd : getReg(offset); - - if (Class == cLong) { + if (Class != cLong) { + if (indexReg == 0) + BuildMI(BB, ImmOpcode, 3).addReg(ValReg).addSImm(offset->getValue()) + .addReg(baseReg); + else + BuildMI(BB, IdxOpcode, 3).addReg(ValReg).addReg(indexReg) + .addReg(baseReg); + } else { + indexReg = (indexReg != 0) ? indexReg : getReg(offset); unsigned indexPlus4 = makeAnotherReg(Type::IntTy); BuildMI(BB, PPC::ADDI, 2, indexPlus4).addReg(indexReg).addSImm(4); BuildMI(BB, IdxOpcode, 3).addReg(ValReg).addReg(indexReg).addReg(baseReg); BuildMI(BB, IdxOpcode, 3).addReg(ValReg+1).addReg(indexPlus4) .addReg(baseReg); - return; } - BuildMI(BB, IdxOpcode, 3).addReg(ValReg).addReg(indexReg).addReg(baseReg); return; } @@ -3286,9 +3295,22 @@ if (canFoldGEPIntoLoadOrStore(&I)) return; - unsigned outputReg = getReg(I); - emitGEPOperation(BB, BB->end(), I.getOperand(0), I.op_begin()+1, I.op_end(), - outputReg, false, 0, 0); + emitGEPOperation(BB, BB->end(), &I, false); +} + +/// emitAdd - A convenience function to emit the necessary code to add a +/// constant signed value to a register. +/// +void PPC32ISel::emitAdd(MachineBasicBlock *MBB, + MachineBasicBlock::iterator IP, + unsigned Op0Reg, ConstantSInt *Op1, unsigned DestReg) { + if (canUseAsImmediateForOpcode(Op1, 0)) { + BuildMI(*MBB, IP, PPC::ADDI, 2, DestReg).addReg(Op0Reg) + .addSImm(Op1->getValue()); + } else { + unsigned Op1Reg = getReg(Op1, MBB, IP); + BuildMI(*MBB, IP, PPC::ADD, 2, DestReg).addReg(Op0Reg).addReg(Op1Reg); + } } /// emitGEPOperation - Common code shared between visitGetElementPtrInst and @@ -3296,13 +3318,19 @@ /// void PPC32ISel::emitGEPOperation(MachineBasicBlock *MBB, MachineBasicBlock::iterator IP, - Value *Src, User::op_iterator IdxBegin, - User::op_iterator IdxEnd, unsigned TargetReg, - bool GEPIsFolded, ConstantSInt **RemainderPtr, - unsigned *PendingAddReg) { + GetElementPtrInst *GEPI, bool GEPIsFolded) { + // If we've already emitted this particular GEP, just return to avoid + // multiple definitions of the base register. + if (GEPIsFolded && (GEPMap[GEPI].base != 0)) { + MultiUseGEP++; + return; + } + + Value *Src = GEPI->getOperand(0); + User::op_iterator IdxBegin = GEPI->op_begin()+1; + User::op_iterator IdxEnd = GEPI->op_end(); const TargetData &TD = TM.getTargetData(); const Type *Ty = Src->getType(); - unsigned basePtrReg = getReg(Src, MBB, IP); int64_t constValue = 0; // Record the operations to emit the GEP in a vector so that we can emit them @@ -3322,17 +3350,14 @@ // right byte offset from the StructLayout class's list of // structure member offsets. unsigned fieldIndex = cast(idx)->getValue(); - unsigned memberOffset = - TD.getStructLayout(StTy)->MemberOffsets[fieldIndex]; // StructType member offsets are always constant values. Add it to the // running total. - constValue += memberOffset; + constValue += TD.getStructLayout(StTy)->MemberOffsets[fieldIndex]; - // The next type is the member of the structure selected by the - // index. + // The next type is the member of the structure selected by the index. Ty = StTy->getElementType (fieldIndex); - } else if (const SequentialType *SqTy = dyn_cast (Ty)) { + } else if (const SequentialType *SqTy = dyn_cast(Ty)) { // Many GEP instructions use a [cast (int/uint) to LongTy] as their // operand. Handle this case directly now... if (CastInst *CI = dyn_cast(idx)) @@ -3355,111 +3380,71 @@ else assert(0 && "Invalid ConstantInt GEP index type!"); } else { - // Push current gep state to this point as an add - ops.push_back(CollapsedGepOp(false, 0, - ConstantSInt::get(Type::IntTy,constValue))); - - // Push multiply gep op and reset constant value - ops.push_back(CollapsedGepOp(true, idx, - ConstantSInt::get(Type::IntTy, elementSize))); - + // Push current gep state to this point as an add and multiply + ops.push_back(CollapsedGepOp( + ConstantSInt::get(Type::IntTy, constValue), + idx, ConstantUInt::get(Type::UIntTy, elementSize))); + constValue = 0; } } } // Emit instructions for all the collapsed ops - bool pendingAdd = false; - unsigned pendingAddReg = 0; - + unsigned indexReg = 0; for(std::vector::iterator cgo_i = ops.begin(), cgo_e = ops.end(); cgo_i != cgo_e; ++cgo_i) { CollapsedGepOp& cgo = *cgo_i; - unsigned nextBasePtrReg = makeAnotherReg(Type::IntTy); - - // If we didn't emit an add last time through the loop, we need to now so - // that the base reg is updated appropriately. - if (pendingAdd) { - assert(pendingAddReg != 0 && "Uninitialized register in pending add!"); - BuildMI(*MBB, IP, PPC::ADD, 2, nextBasePtrReg).addReg(basePtrReg) - .addReg(pendingAddReg); - basePtrReg = nextBasePtrReg; - nextBasePtrReg = makeAnotherReg(Type::IntTy); - pendingAddReg = 0; - pendingAdd = false; - } - if (cgo.isMul) { - // We know the elementSize is a constant, so we can emit a constant mul - unsigned TmpReg = makeAnotherReg(Type::IntTy); - doMultiplyConst(MBB, IP, nextBasePtrReg, cgo.index, cgo.size); - pendingAddReg = basePtrReg; - pendingAdd = true; - } else { - // Try and generate an immediate addition if possible - if (cgo.size->isNullValue()) { - BuildMI(*MBB, IP, PPC::OR, 2, nextBasePtrReg).addReg(basePtrReg) - .addReg(basePtrReg); - } else if (canUseAsImmediateForOpcode(cgo.size, 0)) { - BuildMI(*MBB, IP, PPC::ADDI, 2, nextBasePtrReg).addReg(basePtrReg) - .addSImm(cgo.size->getValue()); - } else { - unsigned Op1r = getReg(cgo.size, MBB, IP); - BuildMI(*MBB, IP, PPC::ADD, 2, nextBasePtrReg).addReg(basePtrReg) - .addReg(Op1r); - } + unsigned TmpReg1 = makeAnotherReg(Type::IntTy); + unsigned TmpReg2 = makeAnotherReg(Type::IntTy); + doMultiplyConst(MBB, IP, TmpReg1, cgo.index, cgo.size); + emitAdd(MBB, IP, TmpReg1, cgo.offset, TmpReg2); + + if (indexReg == 0) + indexReg = TmpReg2; + else { + unsigned TmpReg3 = makeAnotherReg(Type::IntTy); + BuildMI(*MBB, IP, PPC::ADD, 2, TmpReg3).addReg(indexReg).addReg(TmpReg2); + indexReg = TmpReg3; } - - basePtrReg = nextBasePtrReg; } - // Add the current base register plus any accumulated constant value + + // We now have a base register, an index register, and possibly a constant + // remainder. If the GEP is going to be folded, we try to generate the + // optimal addressing mode. + unsigned TargetReg = getReg(GEPI, MBB, IP); + unsigned basePtrReg = getReg(Src, MBB, IP); ConstantSInt *remainder = ConstantSInt::get(Type::IntTy, constValue); // If we are emitting this during a fold, copy the current base register to // the target, and save the current constant offset so the folding load or // store can try and use it as an immediate. if (GEPIsFolded) { - // If this is a folded GEP and the last element was an index, then we need - // to do some extra work to turn a shift/add/stw into a shift/stwx - if (pendingAdd && 0 == remainder->getValue()) { - assert(pendingAddReg != 0 && "Uninitialized register in pending add!"); - *PendingAddReg = pendingAddReg; - } else { - *PendingAddReg = 0; - if (pendingAdd) { - unsigned nextBasePtrReg = makeAnotherReg(Type::IntTy); - assert(pendingAddReg != 0 && "Uninitialized register in pending add!"); - BuildMI(*MBB, IP, PPC::ADD, 2, nextBasePtrReg).addReg(basePtrReg) - .addReg(pendingAddReg); - basePtrReg = nextBasePtrReg; + if (indexReg == 0) { + if (!canUseAsImmediateForOpcode(remainder, 0)) { + indexReg = getReg(remainder, MBB, IP); + remainder = 0; } + } else { + unsigned TmpReg = makeAnotherReg(Type::IntTy); + emitAdd(MBB, IP, indexReg, remainder, TmpReg); + indexReg = TmpReg; + remainder = 0; } BuildMI (*MBB, IP, PPC::OR, 2, TargetReg).addReg(basePtrReg) .addReg(basePtrReg); - *RemainderPtr = remainder; + GEPMap[GEPI] = FoldedGEP(TargetReg, indexReg, remainder); return; } - // If we still have a pending add at this point, emit it now - if (pendingAdd) { + // We're not folding, so collapse the base, index, and any remainder into the + // destination register. + if (indexReg != 0) { unsigned TmpReg = makeAnotherReg(Type::IntTy); - BuildMI(*MBB, IP, PPC::ADD, 2, TmpReg).addReg(pendingAddReg) - .addReg(basePtrReg); + BuildMI(*MBB, IP, PPC::ADD, 2, TmpReg).addReg(indexReg).addReg(basePtrReg); basePtrReg = TmpReg; } - - // After we have processed all the indices, the result is left in - // basePtrReg. Move it to the register where we were expected to - // put the answer. - if (remainder->isNullValue()) { - BuildMI (*MBB, IP, PPC::OR, 2, TargetReg).addReg(basePtrReg) - .addReg(basePtrReg); - } else if (canUseAsImmediateForOpcode(remainder, 0)) { - BuildMI(*MBB, IP, PPC::ADDI, 2, TargetReg).addReg(basePtrReg) - .addSImm(remainder->getValue()); - } else { - unsigned Op1r = getReg(remainder, MBB, IP); - BuildMI(*MBB, IP, PPC::ADD, 2, TargetReg).addReg(basePtrReg).addReg(Op1r); - } + emitAdd(MBB, IP, basePtrReg, remainder, TargetReg); } /// visitAllocaInst - If this is a fixed size alloca, allocate space from the From reid at x10sys.com Thu Sep 23 01:07:35 2004 From: reid at x10sys.com (Reid Spencer) Date: Thu, 23 Sep 2004 01:07:35 -0500 Subject: [llvm-commits] CVS: llvm/Makefile.rules Message-ID: <200409230607.BAA03288@zion.cs.uiuc.edu> Changes in directory llvm: Makefile.rules updated: 1.197 -> 1.198 --- Log message: Missed one $*.a -> $@ conversion for the Release build. --- Diffs of the changes: (+1 -1) Index: llvm/Makefile.rules diff -u llvm/Makefile.rules:1.197 llvm/Makefile.rules:1.198 --- llvm/Makefile.rules:1.197 Wed Sep 22 19:58:06 2004 +++ llvm/Makefile.rules Thu Sep 23 01:07:24 2004 @@ -568,7 +568,7 @@ $(LIBNAME_O): $(ObjectsO) $(LibSubDirs) $(DESTLIBRELEASE)/.dir @${ECHO} Linking $(LIBRARYNAME) dynamic release library $(VERB) $(Link) -o $@ $(ObjectsO) $(LibSubDirs) $(LibLinkOpts) - $(VERB) $(LIBTOOL) --mode=install $(INSTALL) $*.la $(DESTLIBCURRENT) + $(VERB) $(LIBTOOL) --mode=install $(INSTALL) $@ $(DESTLIBCURRENT) @${ECHO} ======= Finished building $(LIBRARYNAME) dynamic release library ======= $(LIBNAME_P): $(ObjectsP) $(LibSubDirs) $(DESTLIBPROFILE)/.dir From lattner at cs.uiuc.edu Thu Sep 23 07:38:28 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 23 Sep 2004 07:38:28 -0500 Subject: [llvm-commits] CVS: llvm-www/Features.html Message-ID: <200409231238.HAA11338@apoc.cs.uiuc.edu> Changes in directory llvm-www: Features.html updated: 1.12 -> 1.13 --- Log message: Update update! PPC exists! --- Diffs of the changes: (+8 -7) Index: llvm-www/Features.html diff -u llvm-www/Features.html:1.12 llvm-www/Features.html:1.13 --- llvm-www/Features.html:1.12 Mon Aug 2 16:35:04 2004 +++ llvm-www/Features.html Thu Sep 23 07:38:16 2004 @@ -26,12 +26,12 @@ analysis, call graph construction, and support for profile-guided optimizations.
    3. -
    4. Native code generators for x86 and Sparc.
    5. +
    6. Native code generators for x86, Sparc, and PowerPC.
    7. A Just-In-Time (JIT) code generation system for x86 and Sparc.
    8. -
    9. A C back-end useful for testing, for supporting targets other than X86 - and Sparc, and allowing LLVM to use a native code generator.
    10. +
    11. A C back-end useful for testing, for supporting targets other than + X86/Sparc/PowerPC Sparc, and allowing LLVM to use a native code generator.
    12. A profiling system similar to gprof.
    13. @@ -52,7 +52,7 @@
    14. It includes front-ends for C, C++, and Stacker (a forth-like language). Front-ends for - Java, Microsoft CLI, and O-Caml are in early development.
    15. + Java, Scheme, and other languages are in development.
    16. It includes an aggressive optimizer, including scalar, interprocedural, profile-driven, and some simple loop optimizations.
    17. @@ -65,9 +65,10 @@
    18. LLVM has full support for accurate garbage collection.
    19. -
    20. It includes native code generators for X86 and Sparc (both of which work - as JIT or static compilers). LLVM can also compile to C code, for - portability. Other native backends are in development.
    21. +
    22. It includes native code generators for X86, Sparc, and PowerPC (the X86 and + Sparc works as JIT or static compilers, PowerPC just provides a static compiler + so far). LLVM can also compile to C code, for portability. Other native + backends are in development.
    23. LLVM has extensive documentation and has hosted many projects of various sorts.
    24. From reid at x10sys.com Thu Sep 23 09:47:30 2004 From: reid at x10sys.com (Reid Spencer) Date: Thu, 23 Sep 2004 09:47:30 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Win32/Signals.cpp Message-ID: <200409231447.JAA17804@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Win32: Signals.cpp updated: 1.4 -> 1.5 --- Log message: Patch for MINGW. Patch provided by Henrik Bach. --- Diffs of the changes: (+6 -2) Index: llvm/lib/System/Win32/Signals.cpp diff -u llvm/lib/System/Win32/Signals.cpp:1.4 llvm/lib/System/Win32/Signals.cpp:1.5 --- llvm/lib/System/Win32/Signals.cpp:1.4 Sun Sep 19 00:37:39 2004 +++ llvm/lib/System/Win32/Signals.cpp Thu Sep 23 09:47:10 2004 @@ -15,8 +15,12 @@ #include #include -#include "dbghelp.h" -#include "psapi.h" +#ifdef __MINGW_H +#include +#else +#include +#endif +#include #pragma comment(lib, "psapi.lib") #pragma comment(lib, "dbghelp.lib") From reid at x10sys.com Thu Sep 23 09:49:55 2004 From: reid at x10sys.com (Reid Spencer) Date: Thu, 23 Sep 2004 09:49:55 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Value.h Message-ID: <200409231449.JAA18564@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: Value.h updated: 1.63 -> 1.64 --- Log message: Change Value from a "struct" to a "class" so that VC 7.1 doesn't generate missing symbols when its referenced as a class. --- Diffs of the changes: (+1 -1) Index: llvm/include/llvm/Value.h diff -u llvm/include/llvm/Value.h:1.63 llvm/include/llvm/Value.h:1.64 --- llvm/include/llvm/Value.h:1.63 Wed Sep 1 17:55:34 2004 +++ llvm/include/llvm/Value.h Thu Sep 23 09:49:45 2004 @@ -40,7 +40,7 @@ /// Value - The base class of all values computed by a program that may be used /// as operands to other values. /// -struct Value { +class Value { private: unsigned SubclassID; // Subclass identifier (for isa/dyn_cast) PATypeHolder Ty; From lattner at cs.uiuc.edu Thu Sep 23 10:45:36 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 23 Sep 2004 10:45:36 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/InstCombine/select.ll Message-ID: <200409231545.KAA13499@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/InstCombine: select.ll updated: 1.8 -> 1.9 --- Log message: load null is undefined behavior, this should fold --- Diffs of the changes: (+6 -0) Index: llvm/test/Regression/Transforms/InstCombine/select.ll diff -u llvm/test/Regression/Transforms/InstCombine/select.ll:1.8 llvm/test/Regression/Transforms/InstCombine/select.ll:1.9 --- llvm/test/Regression/Transforms/InstCombine/select.ll:1.8 Wed Jun 9 02:59:40 2004 +++ llvm/test/Regression/Transforms/InstCombine/select.ll Thu Sep 23 10:45:20 2004 @@ -136,3 +136,9 @@ %t3 = select bool %t2, int 16, int 0 ;; X & 16 ret int %t3 } + +int %test16(bool %C, int* %P) { + %P2 = select bool %C, int* %P, int* null + %V = load int* %P2 + ret int %V +} From lattner at cs.uiuc.edu Thu Sep 23 10:46:11 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 23 Sep 2004 10:46:11 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200409231546.KAA13510@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.245 -> 1.246 --- Log message: Implement select.ll:test16: fold load (select C, X, null) -> load X --- Diffs of the changes: (+14 -0) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.245 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.246 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.245 Tue Sep 21 16:35:23 2004 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Thu Sep 23 10:46:00 2004 @@ -3071,6 +3071,20 @@ return new SelectInst(SI->getCondition(), V1, V2); } + // load (select (cond, null, P)) -> load P + if (Constant *C = dyn_cast(SI->getOperand(1))) + if (C->isNullValue()) { + LI.setOperand(0, SI->getOperand(2)); + return &LI; + } + + // load (select (cond, P, null)) -> load P + if (Constant *C = dyn_cast(SI->getOperand(2))) + if (C->isNullValue()) { + LI.setOperand(0, SI->getOperand(1)); + return &LI; + } + } else if (PHINode *PN = dyn_cast(Op)) { // load (phi (&V1, &V2, &V3)) --> phi(load &V1, load &V2, load &V3) bool Safe = PN->getParent() == LI.getParent(); From alkis at cs.uiuc.edu Thu Sep 23 10:10:13 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Thu, 23 Sep 2004 10:10:13 -0500 Subject: [llvm-commits] CVS: llvm-java/include/llvm/Java/BytecodeParser.h Message-ID: <200409231510.KAA19643@zion.cs.uiuc.edu> Changes in directory llvm-java/include/llvm/Java: BytecodeParser.h updated: 1.6 -> 1.7 --- Log message: Add default case. --- Diffs of the changes: (+3 -0) Index: llvm-java/include/llvm/Java/BytecodeParser.h diff -u llvm-java/include/llvm/Java/BytecodeParser.h:1.6 llvm-java/include/llvm/Java/BytecodeParser.h:1.7 --- llvm-java/include/llvm/Java/BytecodeParser.h:1.6 Wed Aug 4 05:02:03 2004 +++ llvm-java/include/llvm/Java/BytecodeParser.h Thu Sep 23 10:10:03 2004 @@ -614,6 +614,9 @@ case IMPDEP2: case NOP: break; + default: + // FIXME: must throw something + break; } } } From reid at x10sys.com Thu Sep 23 11:03:59 2004 From: reid at x10sys.com (Reid Spencer) Date: Thu, 23 Sep 2004 11:03:59 -0500 Subject: [llvm-commits] CVS: llvm/docs/CodingStandards.html Message-ID: <200409231603.LAA19892@zion.cs.uiuc.edu> Changes in directory llvm/docs: CodingStandards.html updated: 1.20 -> 1.21 --- Log message: Add a blurb about the use of class vs. struct keyword in class decls. --- Diffs of the changes: (+19 -1) Index: llvm/docs/CodingStandards.html diff -u llvm/docs/CodingStandards.html:1.20 llvm/docs/CodingStandards.html:1.21 --- llvm/docs/CodingStandards.html:1.20 Wed Jul 28 17:37:57 2004 +++ llvm/docs/CodingStandards.html Thu Sep 23 11:03:48 2004 @@ -29,6 +29,7 @@
    25. Treat Compiler Warnings Like Errors
    26. Write Portable Code
    27. +
    28. Use of class/struct Keywords
  • Style Issues @@ -366,6 +367,23 @@ + + +
    +

    In C++ the class and struct keywoards can be used almost + interchangeably. The only difference is when they are used to declare a class: + class makes all members private by default while struct + makes all members public by defaut.

    +

    Unfortunately, not all compilers follow the rules and some will generate + different symbols based on whether class or struct was used + to declare the symbol. This can lead to problems at link time.

    +

    So, the rule for LLVM is this: "always use the class keyword, + unless all members are public in which case struct is + allowed.

    +
    +
    Style Issues @@ -617,7 +635,7 @@ Chris Lattner
    LLVM Compiler Infrastructure
    - Last modified: $Date: 2004/07/28 22:37:57 $ + Last modified: $Date: 2004/09/23 16:03:48 $ From alkis at cs.uiuc.edu Thu Sep 23 11:26:07 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Thu, 23 Sep 2004 11:26:07 -0500 Subject: [llvm-commits] CVS: llvm-java/include/llvm/Java/BytecodeParser.h Message-ID: <200409231626.LAA20224@zion.cs.uiuc.edu> Changes in directory llvm-java/include/llvm/Java: BytecodeParser.h updated: 1.7 -> 1.8 --- Log message: Change the BytecodeParser interface to not pass the bytecode index of the current instruction to each method. Instead pass it to pre_inst once before every bytecode. Modify the compiler to use this new interface. This simplifies the code and eliminates a bunch of map lookups for the current basic block. --- Diffs of the changes: (+196 -212) Index: llvm-java/include/llvm/Java/BytecodeParser.h diff -u llvm-java/include/llvm/Java/BytecodeParser.h:1.7 llvm-java/include/llvm/Java/BytecodeParser.h:1.8 --- llvm-java/include/llvm/Java/BytecodeParser.h:1.7 Thu Sep 23 10:10:03 2004 +++ llvm-java/include/llvm/Java/BytecodeParser.h Thu Sep 23 11:25:56 2004 @@ -62,9 +62,10 @@ unsigned curBC = i; bool wide = code[i] == WIDE; i += wide; + THIS->pre_inst(curBC); switch (code[i]) { case ACONST_NULL: - THIS->do_aconst_null(curBC); + THIS->do_aconst_null(); break; case ICONST_M1: case ICONST_0: @@ -73,423 +74,412 @@ case ICONST_3: case ICONST_4: case ICONST_5: - THIS->do_iconst(curBC, code[i]-ICONST_0); + THIS->do_iconst(code[i]-ICONST_0); break; case LCONST_0: case LCONST_1: - THIS->do_lconst(curBC, code[i]-LCONST_0); + THIS->do_lconst(code[i]-LCONST_0); break; case FCONST_0: case FCONST_1: case FCONST_2: - THIS->do_fconst(curBC, code[i]-FCONST_0); + THIS->do_fconst(code[i]-FCONST_0); break; case DCONST_0: case DCONST_1: - THIS->do_dconst(curBC, code[i]-DCONST_0); + THIS->do_dconst(code[i]-DCONST_0); break; case BIPUSH: - THIS->do_iconst(curBC, readSByte(code, i)); + THIS->do_iconst(readSByte(code, i)); break; case SIPUSH: - THIS->do_iconst(curBC, readSShort(code, i)); + THIS->do_iconst(readSShort(code, i)); break; case LDC: - THIS->do_ldc(curBC, readUByte(code, i)); + THIS->do_ldc(readUByte(code, i)); break; case LDC_W: - THIS->do_ldc(curBC, readUShort(code, i)); + THIS->do_ldc(readUShort(code, i)); break; case LDC2_W: - THIS->do_ldc(curBC, readUShort(code, i)); + THIS->do_ldc(readUShort(code, i)); break; case ILOAD: THIS->do_load( - curBC, INT, - wide ? readUShort(code, i) : readUByte(code, i)); + INT, wide ? readUShort(code, i) : readUByte(code, i)); break; case LLOAD: THIS->do_load( - curBC, LONG, - wide ? readUShort(code, i) : readUByte(code, i)); + LONG, wide ? readUShort(code, i) : readUByte(code, i)); break; case FLOAD: THIS->do_load( - curBC, FLOAT, - wide ? readUShort(code, i) : readUByte(code, i)); + FLOAT, wide ? readUShort(code, i) : readUByte(code, i)); break; case DLOAD: THIS->do_load( - curBC, DOUBLE, - wide ? readUShort(code, i) : readUByte(code, i)); + DOUBLE, wide ? readUShort(code, i) : readUByte(code, i)); break; case ALOAD: THIS->do_load( - curBC, REFERENCE, - wide ? readUShort(code, i) : readUByte(code, i)); + REFERENCE, wide ? readUShort(code, i) : readUByte(code, i)); break; case ILOAD_0: case ILOAD_1: case ILOAD_2: case ILOAD_3: - THIS->do_load(curBC, INT, code[i]-ILOAD_0); + THIS->do_load(INT, code[i]-ILOAD_0); break; case LLOAD_0: case LLOAD_1: case LLOAD_2: case LLOAD_3: - THIS->do_load(curBC, LONG, code[i]-LLOAD_0); + THIS->do_load(LONG, code[i]-LLOAD_0); break; case FLOAD_0: case FLOAD_1: case FLOAD_2: case FLOAD_3: - THIS->do_load(curBC, FLOAT, code[i]-FLOAD_0); + THIS->do_load(FLOAT, code[i]-FLOAD_0); break; case DLOAD_0: case DLOAD_1: case DLOAD_2: case DLOAD_3: - THIS->do_load(curBC, DOUBLE, code[i]-DLOAD_0); + THIS->do_load(DOUBLE, code[i]-DLOAD_0); break; case ALOAD_0: case ALOAD_1: case ALOAD_2: case ALOAD_3: - THIS->do_load(curBC, REFERENCE, code[i]-ALOAD_0); + THIS->do_load(REFERENCE, code[i]-ALOAD_0); break; case IALOAD: - THIS->do_aload(curBC, INT); + THIS->do_aload(INT); break; case LALOAD: - THIS->do_aload(curBC, LONG); + THIS->do_aload(LONG); break; case FALOAD: - THIS->do_aload(curBC, FLOAT); + THIS->do_aload(FLOAT); break; case DALOAD: - THIS->do_aload(curBC, DOUBLE); + THIS->do_aload(DOUBLE); break; case AALOAD: - THIS->do_aload(curBC, REFERENCE); + THIS->do_aload(REFERENCE); break; case BALOAD: - THIS->do_aload(curBC, BYTE); + THIS->do_aload(BYTE); break; case CALOAD: - THIS->do_aload(curBC, CHAR); + THIS->do_aload(CHAR); break; case SALOAD: - THIS->do_aload(curBC, SHORT); + THIS->do_aload(SHORT); break; case ISTORE: THIS->do_store( - curBC, INT, - wide ? readUShort(code, i) : readUByte(code, i)); + INT, wide ? readUShort(code, i) : readUByte(code, i)); break; case LSTORE: THIS->do_store( - curBC, LONG, - wide ? readUShort(code, i) : readUByte(code, i)); + LONG, wide ? readUShort(code, i) : readUByte(code, i)); break; case FSTORE: THIS->do_store( - curBC, FLOAT, - wide ? readUShort(code, i) : readUByte(code, i)); + FLOAT, wide ? readUShort(code, i) : readUByte(code, i)); break; case DSTORE: THIS->do_store( - curBC, DOUBLE, - wide ? readUShort(code, i) : readUByte(code, i)); + DOUBLE, wide ? readUShort(code, i) : readUByte(code, i)); break; case ASTORE: THIS->do_store( - curBC, REFERENCE, - wide ? readUShort(code, i) : readUByte(code, i)); + REFERENCE, wide ? readUShort(code, i) : readUByte(code, i)); break; case ISTORE_0: case ISTORE_1: case ISTORE_2: case ISTORE_3: - THIS->do_store(curBC, INT, code[i]-ISTORE_0); + THIS->do_store(INT, code[i]-ISTORE_0); break; case LSTORE_0: case LSTORE_1: case LSTORE_2: case LSTORE_3: - THIS->do_store(curBC, LONG, code[i]-LSTORE_0); + THIS->do_store(LONG, code[i]-LSTORE_0); break; case FSTORE_0: case FSTORE_1: case FSTORE_2: case FSTORE_3: - THIS->do_store(curBC, FLOAT, code[i]-FSTORE_0); + THIS->do_store(FLOAT, code[i]-FSTORE_0); break; case DSTORE_0: case DSTORE_1: case DSTORE_2: case DSTORE_3: - THIS->do_store(curBC, DOUBLE, code[i]-DSTORE_0); + THIS->do_store(DOUBLE, code[i]-DSTORE_0); break; case ASTORE_0: case ASTORE_1: case ASTORE_2: case ASTORE_3: - THIS->do_store(curBC, REFERENCE, code[i]-ASTORE_0); + THIS->do_store(REFERENCE, code[i]-ASTORE_0); break; case IASTORE: - THIS->do_astore(curBC, INT); + THIS->do_astore(INT); break; case LASTORE: - THIS->do_astore(curBC, LONG); + THIS->do_astore(LONG); break; case FASTORE: - THIS->do_astore(curBC, FLOAT); + THIS->do_astore(FLOAT); break; case DASTORE: - THIS->do_astore(curBC, DOUBLE); + THIS->do_astore(DOUBLE); break; case AASTORE: - THIS->do_astore(curBC, REFERENCE); + THIS->do_astore(REFERENCE); break; case BASTORE: - THIS->do_astore(curBC, BYTE); + THIS->do_astore(BYTE); break; case CASTORE: - THIS->do_astore(curBC, CHAR); + THIS->do_astore(CHAR); break; case SASTORE: - THIS->do_astore(curBC, SHORT); + THIS->do_astore(SHORT); break; case POP: - THIS->do_pop(curBC); + THIS->do_pop(); break; case POP2: - THIS->do_pop2(curBC); + THIS->do_pop2(); break; case DUP: - THIS->do_dup(curBC); + THIS->do_dup(); break; case DUP_X1: - THIS->do_dup_x1(curBC); + THIS->do_dup_x1(); break; case DUP_X2: - THIS->do_dup_x2(curBC); + THIS->do_dup_x2(); break; case DUP2: - THIS->do_dup2(curBC); + THIS->do_dup2(); break; case DUP2_X1: - THIS->do_dup2_x1(curBC); + THIS->do_dup2_x1(); break; case DUP2_X2: - THIS->do_dup2_x2(curBC); + THIS->do_dup2_x2(); break; case SWAP: - THIS->do_swap(curBC); + THIS->do_swap(); break; case IADD: case LADD: case FADD: case DADD: - THIS->do_add(curBC); + THIS->do_add(); break; case ISUB: case LSUB: case FSUB: case DSUB: - THIS->do_sub(curBC); + THIS->do_sub(); break; case IMUL: case LMUL: case FMUL: case DMUL: - THIS->do_mul(curBC); + THIS->do_mul(); break; case IDIV: case LDIV: case FDIV: case DDIV: - THIS->do_div(curBC); + THIS->do_div(); break; case IREM: case LREM: case FREM: case DREM: - THIS->do_rem(curBC); + THIS->do_rem(); break; case INEG: case LNEG: case FNEG: case DNEG: - THIS->do_neg(curBC); + THIS->do_neg(); break; case ISHL: case LSHL: - THIS->do_shl(curBC); + THIS->do_shl(); break; case ISHR: case LSHR: - THIS->do_shr(curBC); + THIS->do_shr(); break; case IUSHR: case LUSHR: - THIS->do_ushr(curBC); + THIS->do_ushr(); break; case IAND: case LAND: - THIS->do_and(curBC); + THIS->do_and(); break; case IOR: case LOR: - THIS->do_or(curBC); + THIS->do_or(); break; case IXOR: case LXOR: - THIS->do_xor(curBC); + THIS->do_xor(); break; case IINC: - THIS->do_iinc( - curBC, readUByte(code, i), readSByte(code, i)); + THIS->do_iinc(readUByte(code, i), readSByte(code, i)); break; case I2L: - THIS->do_convert(curBC, LONG); + THIS->do_convert(LONG); break; case I2F: - THIS->do_convert(curBC, FLOAT); + THIS->do_convert(FLOAT); break; case I2D: - THIS->do_convert(curBC, DOUBLE); + THIS->do_convert(DOUBLE); break; case L2I: - THIS->do_convert(curBC, INT); + THIS->do_convert(INT); break; case L2F: - THIS->do_convert(curBC, FLOAT); + THIS->do_convert(FLOAT); break; case L2D: - THIS->do_convert(curBC, DOUBLE); + THIS->do_convert(DOUBLE); break; case F2I: - THIS->do_convert(curBC, INT); + THIS->do_convert(INT); break; case F2L: - THIS->do_convert(curBC, LONG); + THIS->do_convert(LONG); break; case F2D: - THIS->do_convert(curBC, DOUBLE); + THIS->do_convert(DOUBLE); break; case D2I: - THIS->do_convert(curBC, INT); + THIS->do_convert(INT); break; case D2L: - THIS->do_convert(curBC, LONG); + THIS->do_convert(LONG); break; case D2F: - THIS->do_convert(curBC, FLOAT); + THIS->do_convert(FLOAT); break; case I2B: - THIS->do_convert(curBC, BYTE); + THIS->do_convert(BYTE); break; case I2C: - THIS->do_convert(curBC, CHAR); + THIS->do_convert(CHAR); break; case I2S: - THIS->do_convert(curBC, SHORT); + THIS->do_convert(SHORT); break; case LCMP: - THIS->do_lcmp(curBC); + THIS->do_lcmp(); break; case FCMPL: - THIS->do_cmpl(curBC); + THIS->do_cmpl(); break; case FCMPG: - THIS->do_cmpg(curBC); + THIS->do_cmpg(); break; case DCMPL: - THIS->do_cmpl(curBC); + THIS->do_cmpl(); break; case DCMPG: - THIS->do_cmpg(curBC); + THIS->do_cmpg(); break; case IFEQ: { unsigned t = curBC + readSShort(code, i); - THIS->do_if(curBC, EQ, INT, t, i + 1); + THIS->do_if(EQ, INT, t, i + 1); break; } case IFNE: { unsigned t = curBC + readSShort(code, i); - THIS->do_if(curBC, NE, INT, t, i + 1); + THIS->do_if(NE, INT, t, i + 1); break; } case IFLT: { unsigned t = curBC + readSShort(code, i); - THIS->do_if(curBC, LT, INT, t, i + 1); + THIS->do_if(LT, INT, t, i + 1); break; } case IFGE: { unsigned t = curBC + readSShort(code, i); - THIS->do_if(curBC, GE, INT, t, i + 1); + THIS->do_if(GE, INT, t, i + 1); break; } case IFGT: { unsigned t = curBC + readSShort(code, i); - THIS->do_if(curBC, GT, INT, t, i + 1); + THIS->do_if(GT, INT, t, i + 1); break; } case IFLE: { unsigned t = curBC + readSShort(code, i); - THIS->do_if(curBC, LE, INT, t, i + 1); + THIS->do_if(LE, INT, t, i + 1); break; } case IF_ICMPEQ: { unsigned t = curBC + readSShort(code, i); - THIS->do_ifcmp(curBC, EQ, t, i + 1); + THIS->do_ifcmp(EQ, t, i + 1); break; } case IF_ICMPNE: { unsigned t = curBC + readSShort(code, i); - THIS->do_ifcmp(curBC, NE, t, i + 1); + THIS->do_ifcmp(NE, t, i + 1); break; } case IF_ICMPLT: { unsigned t = curBC + readSShort(code, i); - THIS->do_ifcmp(curBC, LT, t, i + 1); + THIS->do_ifcmp(LT, t, i + 1); break; } case IF_ICMPGE: { unsigned t = curBC + readSShort(code, i); - THIS->do_ifcmp(curBC, GE, t, i + 1); + THIS->do_ifcmp(GE, t, i + 1); break; } case IF_ICMPGT: { unsigned t = curBC + readSShort(code, i); - THIS->do_ifcmp(curBC, GT, t, i + 1); + THIS->do_ifcmp(GT, t, i + 1); break; } case IF_ICMPLE: { unsigned t = curBC + readSShort(code, i); - THIS->do_ifcmp(curBC, LE, t, i + 1); + THIS->do_ifcmp(LE, t, i + 1); break; } case IF_IACMPEQ: { unsigned t = curBC + readSShort(code, i); - THIS->do_ifcmp(curBC, EQ, t, i + 1); + THIS->do_ifcmp(EQ, t, i + 1); break; } case IF_IACMPNE: { unsigned t = curBC + readSShort(code, i); - THIS->do_ifcmp(curBC, NE, t, i + 1); + THIS->do_ifcmp(NE, t, i + 1); break; } case GOTO: - THIS->do_goto(curBC, curBC + readSShort(code, i)); + THIS->do_goto(curBC + readSShort(code, i)); break; case JSR: - THIS->do_jsr(curBC, curBC + readSShort(code, i)); + THIS->do_jsr(curBC + readSShort(code, i)); break; case RET: - THIS->do_ret(curBC, readUByte(code, i)); + THIS->do_ret(readUByte(code, i)); break; case TABLESWITCH: { switchCases_.clear(); @@ -501,7 +491,7 @@ while (low <= high) switchCases_.push_back( std::make_pair(low++, curBC + readSInt(code, i))); - THIS->do_switch(curBC, curBC + def, switchCases_); + THIS->do_switch(curBC + def, switchCases_); break; } case LOOKUPSWITCH: { @@ -515,7 +505,7 @@ switchCases_.push_back( std::make_pair(value, curBC + readSInt(code, i))); } - THIS->do_switch(curBC, curBC + def, switchCases_); + THIS->do_switch(curBC + def, switchCases_); break; } case IRETURN: @@ -523,34 +513,34 @@ case FRETURN: case DRETURN: case ARETURN: - THIS->do_return(curBC); + THIS->do_return(); break; case RETURN: - THIS->do_return_void(curBC); + THIS->do_return_void(); break; case GETSTATIC: - THIS->do_getstatic(curBC, readUShort(code, i)); + THIS->do_getstatic(readUShort(code, i)); break; case PUTSTATIC: - THIS->do_putstatic(curBC, readUShort(code, i)); + THIS->do_putstatic(readUShort(code, i)); break; case GETFIELD: - THIS->do_getfield(curBC, readUShort(code, i)); + THIS->do_getfield(readUShort(code, i)); break; case PUTFIELD: - THIS->do_putfield(curBC, readUShort(code, i)); + THIS->do_putfield(readUShort(code, i)); break; case INVOKEVIRTUAL: - THIS->do_invokevirtual(curBC, readUShort(code, i)); + THIS->do_invokevirtual(readUShort(code, i)); break; case INVOKESPECIAL: - THIS->do_invokespecial(curBC, readUShort(code, i)); + THIS->do_invokespecial(readUShort(code, i)); break; case INVOKESTATIC: - THIS->do_invokestatic(curBC, readUShort(code, i)); + THIS->do_invokestatic(readUShort(code, i)); break; case INVOKEINTERFACE: { - THIS->do_invokeinterface(curBC, readUShort(code, i)); + THIS->do_invokeinterface(readUShort(code, i)); unsigned count = readUByte(code, i); unsigned zero = readUByte(code, i); break; @@ -559,55 +549,53 @@ // FIXME: must throw something break; case NEW: - THIS->do_new(curBC, readUShort(code, i)); + THIS->do_new(readUShort(code, i)); break; case NEWARRAY: - THIS->do_newarray(curBC, - static_cast(readUByte(code, i))); + THIS->do_newarray(static_cast(readUByte(code, i))); break; case ANEWARRAY: - THIS->do_anewarray(curBC, readUShort(code, i)); + THIS->do_anewarray(readUShort(code, i)); break; case ARRAYLENGTH: - THIS->do_arraylength(curBC); + THIS->do_arraylength(); break; case ATHROW: - THIS->do_athrow(curBC); + THIS->do_athrow(); break; case CHECKCAST: - THIS->do_checkcast(curBC, readUShort(code, i)); + THIS->do_checkcast(readUShort(code, i)); break; case INSTANCEOF: - THIS->do_instanceof(curBC, readUShort(code, i)); + THIS->do_instanceof(readUShort(code, i)); break; case MONITORENTER: - THIS->do_monitorenter(curBC); + THIS->do_monitorenter(); break; case MONITOREXIT: - THIS->do_monitorexit(curBC); + THIS->do_monitorexit(); break; case WIDE: // FIXME: must throw something break; case MULTIANEWARRAY: - THIS->do_multianewarray( - curBC, readUShort(code, i), readUByte(code, i)); + THIS->do_multianewarray(readUShort(code, i), readUByte(code, i)); break; case IFNULL: { unsigned t = curBC + readUShort(code, i); - THIS->do_if(curBC, EQ, REFERENCE, t, i + 1); + THIS->do_if(EQ, REFERENCE, t, i + 1); break; } case IFNONNULL: { unsigned t = curBC + readUShort(code, i); - THIS->do_if(curBC, NE, REFERENCE, t, i + 1); + THIS->do_if(NE, REFERENCE, t, i + 1); break; } case GOTO_W: - THIS->do_goto(curBC, curBC + readSInt(code, i)); + THIS->do_goto(curBC + readSInt(code, i)); break; case JSR_W: - THIS->do_jsr(curBC, curBC + readSInt(code, i)); + THIS->do_jsr(curBC + readSInt(code, i)); break; case BREAKPOINT: case IMPDEP1: @@ -623,143 +611,139 @@ #undef THIS + /// @brief called before every bytecode + void pre_inst(unsigned bcI) { } /// @brief called on ACONST_NULL - void do_aconst_null(unsigned bcI) { } + void do_aconst_null() { } /// @brief called on ICONST_, SIPUSH and BIPUSH - void do_iconst(unsigned bcI, int value) { } + void do_iconst(int value) { } /// @brief called on LCONST_ - void do_lconst(unsigned bcI, long long value) { } + void do_lconst(long long value) { } /// @brief called on FCONST_ - void do_fconst(unsigned bcI, float value) { } + void do_fconst(float value) { } /// @brief called on DCONST_ - void do_dconst(unsigned bcI, double value) { } + void do_dconst(double value) { } /// @brief called on LDC, LDC_W and LDC2_W - void do_ldc(unsigned bcI, unsigned index) { } + void do_ldc(unsigned index) { } /// @brief called on ILOAD, LLOAD, FLOAD, DLOAD, ALOAD, /// ILOAD_, LLOAD_, FLOAD_, DLOAD_, and ALOAD_ - void do_load(unsigned bcI, JType type, unsigned index) { } + void do_load(JType type, unsigned index) { } /// @brief called on IALOAD, LALOAD, FALOAD, DALOAD, AALOAD, /// BALOAD, CALOAD, and SALOAD - void do_aload(unsigned bcI, JType type) { } + void do_aload(JType type) { } /// @brief called on ISTORE, LSTORE, FSTORE, DSTORE, ASTORE, /// ISTORE_, LSTORE_, FSTORE_, DSTORE_, and /// ASTORE_ - void do_store(unsigned bcI, JType type, unsigned index) { } + void do_store(JType type, unsigned index) { } /// @brief called on IASTORE, LASTORE, FASTORE, DASTORE, AASTORE, /// BASTORE, CASTORE, and SASTORE - void do_astore(unsigned bcI, JType type) { } + void do_astore(JType type) { } /// @brief called on POP - void do_pop(unsigned bcI) { } + void do_pop() { } /// @brief called on POP2 - void do_pop2(unsigned bcI) { } + void do_pop2() { } /// @brief called on DUP - void do_dup(unsigned bcI) { } + void do_dup() { } /// @brief called on DUP_X1 - void do_dup_x1(unsigned bcI) { } + void do_dup_x1() { } /// @brief called on DUP_X2 - void do_dup_x2(unsigned bcI) { } + void do_dup_x2() { } /// @brief called on DUP2 - void do_dup2(unsigned bcI) { } + void do_dup2() { } /// @brief called on DUP2_X1 - void do_dup2_x1(unsigned bcI) { } + void do_dup2_x1() { } /// @brief called on DUP2_X2 - void do_dup2_x2(unsigned bcI) { } + void do_dup2_x2() { } /// @brief called on SWAP - void do_swap(unsigned bcI) { } + void do_swap() { } /// @brief called on IADD, LADD, FADD, and DADD - void do_add(unsigned bcI) { } + void do_add() { } /// @brief called on ISUB, LSUB, FSUB, and DSUB - void do_sub(unsigned bcI) { } + void do_sub() { } /// @brief called on IMUL, LMUL, FMUL, and DMUL - void do_mul(unsigned bcI) { } + void do_mul() { } /// @brief called on IDIV, LDIV, FDIV, and DDIV - void do_div(unsigned bcI) { } + void do_div() { } /// @brief called on IREM, LREM, FREM, and DREM - void do_rem(unsigned bcI) { } + void do_rem() { } /// @brief called on INEG, LNEG, FNEG, and DNEG - void do_neg(unsigned bcI) { } + void do_neg() { } /// @brief called on ISHL and LSHL - void do_shl(unsigned bcI) { } + void do_shl() { } /// @brief called on ISHR and LSHR - void do_shr(unsigned bcI) { } + void do_shr() { } /// @brief called on IUSHR and LUSHR - void do_ushr(unsigned bcI) { } + void do_ushr() { } /// @brief called on IAND and LAND - void do_and(unsigned bcI) { } + void do_and() { } /// @brief called on IOR or LOR - void do_or(unsigned bcI) { } + void do_or() { } /// @brief called on IXOR and LXOR - void do_xor(unsigned bcI) { } + void do_xor() { } /// @brief called on IINC - void do_iinc(unsigned bcI, unsigned index, int amount) { } + void do_iinc(unsigned index, int amount) { } /// @brief called on I2L, I2F, I2D, L2I, L2F, L2D, F2I, F2L, /// F2D, D2I, D2L, D2F, I2B, I2C, and I2S - void do_convert(unsigned bcI, JType to) { } + void do_convert(JType to) { } /// @brief called on LCMP - void do_lcmp(unsigned bcI) { } + void do_lcmp() { } /// @brief called on FCMPL and DCMPL - void do_cmpl(unsigned bcI) { } + void do_cmpl() { } /// @brief called on FCMPG and DCMPG - void do_cmpg(unsigned bcI) { } + void do_cmpg() { } /// @brief called on IF, IFNULL, and IFNONNULL - void do_if(unsigned bcI, JSetCC cc, JType type, - unsigned t, unsigned f) { } + void do_if(JSetCC cc, JType type, unsigned t, unsigned f) { } /// @brief called on IFCMP and IFACMP - void do_ifcmp(unsigned bcI, JSetCC cc, - unsigned t, unsigned f) { } + void do_ifcmp(JSetCC cc, unsigned t, unsigned f) { } /// @brief called on GOTO and GOTO_W - void do_goto(unsigned bcI, unsigned target) { } + void do_goto(unsigned target) { } /// @brief called on JSR and JSR_W - void do_jsr(unsigned bcI, unsigned target) { } + void do_jsr(unsigned target) { } /// @brief called on RET - void do_ret(unsigned bcI, unsigned index) { } + void do_ret(unsigned index) { } /// @brief called on TABLESWITCH and LOOKUPSWITCH - void do_switch(unsigned bcI, - unsigned defTarget, - const SwitchCases& sw) { } + void do_switch(unsigned defTarget, const SwitchCases& sw) { } /// @brief called on IRETURN, LRETURN, FRETURN, DRETURN and /// ARETURN - void do_return(unsigned bcI) { } + void do_return() { } /// @brief called on RETURN - void do_return_void(unsigned bcI) { } + void do_return_void() { } /// @brief called on GETSTATIC - void do_getstatic(unsigned bcI, unsigned index) { } + void do_getstatic(unsigned index) { } /// @brief called on PUTSTATIC - void do_putstatic(unsigned bcI, unsigned index) { } + void do_putstatic(unsigned index) { } /// @brief called on GETFIELD - void do_getfield(unsigned bcI, unsigned index) { } + void do_getfield(unsigned index) { } /// @brief called on PUTFIELD - void do_putfield(unsigned bcI, unsigned index) { } + void do_putfield(unsigned index) { } /// @brief called on INVOKEVIRTUAL - void do_invokevirtual(unsigned bcI, unsigned index) { } + void do_invokevirtual(unsigned index) { } /// @brief called on INVOKESPECIAL - void do_invokespecial(unsigned bcI, unsigned index) { } + void do_invokespecial(unsigned index) { } /// @brief called on INVOKESTATIC - void do_invokestatic(unsigned bcI, unsigned index) { } + void do_invokestatic(unsigned index) { } /// @brief called on INVOKEINTERFACE - void do_invokeinterface(unsigned bcI, unsigned index) { } + void do_invokeinterface(unsigned index) { } /// @brief called on NEW - void do_new(unsigned bcI, unsigned index) { } + void do_new(unsigned index) { } /// @brief called on NEWARRAY - void do_newarray(unsigned bcI, JType type) { } + void do_newarray(JType type) { } /// @brief called on ANEWARRAY - void do_anewarray(unsigned bcI, unsigned index) { } + void do_anewarray(unsigned index) { } /// @brief called on ARRAYLENGTH - void do_arraylength(unsigned bcI) { } + void do_arraylength() { } /// @brief called on ATHROW - void do_athrow(unsigned bcI) { } + void do_athrow() { } /// @brief called on CHECKCAST - void do_checkcast(unsigned bcI, unsigned index) { } + void do_checkcast(unsigned index) { } /// @brief called on INSTANCEOF - void do_instanceof(unsigned bcI, unsigned index) { } + void do_instanceof(unsigned index) { } /// @brief called on MONITORENTER - void do_monitorenter(unsigned bcI) { } + void do_monitorenter() { } /// @brief called on MONITOREXIT - void do_monitorexit(unsigned bcI) { } + void do_monitorexit() { } /// @brief called on MULTIANEWARRAY - void do_multianewarray(unsigned bcI, - unsigned index, - unsigned dims) { } + void do_multianewarray(unsigned index, unsigned dims) { } }; } } // namespace llvm::Java From alkis at cs.uiuc.edu Thu Sep 23 11:26:07 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Thu, 23 Sep 2004 11:26:07 -0500 Subject: [llvm-commits] CVS: llvm-java/lib/Compiler/Compiler.cpp Message-ID: <200409231626.LAA20223@zion.cs.uiuc.edu> Changes in directory llvm-java/lib/Compiler: Compiler.cpp updated: 1.112 -> 1.113 --- Log message: Change the BytecodeParser interface to not pass the bytecode index of the current instruction to each method. Instead pass it to pre_inst once before every bytecode. Modify the compiler to use this new interface. This simplifies the code and eliminates a bunch of map lookups for the current basic block. --- Diffs of the changes: (+174 -185) Index: llvm-java/lib/Compiler/Compiler.cpp diff -u llvm-java/lib/Compiler/Compiler.cpp:1.112 llvm-java/lib/Compiler/Compiler.cpp:1.113 --- llvm-java/lib/Compiler/Compiler.cpp:1.112 Wed Sep 22 18:49:47 2004 +++ llvm-java/lib/Compiler/Compiler.cpp Thu Sep 23 11:25:56 2004 @@ -108,25 +108,21 @@ new BranchInst(i->second, i->first); } - void do_if(unsigned bcI, JSetCC cc, JType type, - unsigned t, unsigned f) { + void do_if(JSetCC cc, JType type, unsigned t, unsigned f) { if (!bc2bbMap_[t]) bc2bbMap_[t] = new BasicBlock("bc" + utostr(t), &function_); if (!bc2bbMap_[f]) bc2bbMap_[f] = new BasicBlock("bc" + utostr(f), &function_); } - void do_ifcmp(unsigned bcI, JSetCC cc, - unsigned t, unsigned f) { + void do_ifcmp(JSetCC cc, unsigned t, unsigned f) { if (!bc2bbMap_[t]) bc2bbMap_[t] = new BasicBlock("bc" + utostr(t), &function_); if (!bc2bbMap_[f]) bc2bbMap_[f] = new BasicBlock("bc" + utostr(f), &function_); } - void do_switch(unsigned bcI, - unsigned defTarget, - const SwitchCases& sw) { + void do_switch(unsigned defTarget, const SwitchCases& sw) { for (unsigned i = 0; i < sw.size(); ++i) { unsigned target = sw[i].second; if (!bc2bbMap_[target]) @@ -147,6 +143,7 @@ Locals locals_; BC2BBMap bc2bbMap_; BasicBlock* prologue_; + BasicBlock* current_; typedef SetVector FunctionSet; FunctionSet toCompileFunctions_; @@ -715,23 +712,17 @@ return global; } - Value* getField(unsigned bcI, unsigned index, Value* ptr) { + Value* getField(unsigned index, Value* ptr) { ConstantFieldRef* fieldRef = cf_->getConstantFieldRef(index); ConstantNameAndType* nameAndType = fieldRef->getNameAndType(); ClassFile* cf = ClassFile::get(fieldRef->getClass()->getName()->str()); - return getField(bcI, - cf, - nameAndType->getName()->str(), - ptr); + return getField(cf, nameAndType->getName()->str(), ptr); } - Value* getField(unsigned bcI, - ClassFile* cf, - const std::string& fieldName, - Value* ptr) { + Value* getField(ClassFile* cf, const std::string& fieldName, Value* ptr) { // Cast ptr to correct type ptr = new CastInst(ptr, PointerType::get(getClassInfo(cf).type), - TMP, getBBAt(bcI)); + TMP, current_); // deref pointer std::vector indices(1, ConstantUInt::get(Type::UIntTy, 0)); @@ -749,7 +740,7 @@ } } - return new GetElementPtrInst(ptr, indices, TMP, getBBAt(bcI)); + return new GetElementPtrInst(ptr, indices, TMP, current_); } Function* compileMethodOnly(const std::string& classMethodDesc) { @@ -817,6 +808,8 @@ // don't have a terminator mapper.insertFallThroughBranches(); + function->dump(); + return function; } @@ -905,76 +898,80 @@ // compile all other methods called by this method recursively for (unsigned i = 0; i != toCompileFunctions_.size(); ++i) { Function* f = toCompileFunctions_[i]; -// compileMethodOnly(f->getName()); + compileMethodOnly(f->getName()); } return function; } - void do_aconst_null(unsigned bcI) { + void pre_inst(unsigned bcI) { + current_ = getBBAt(bcI); + } + + void do_aconst_null() { opStack_.push(llvm::Constant::getNullValue(getType(REFERENCE))); } - void do_iconst(unsigned bcI, int value) { + void do_iconst(int value) { opStack_.push(ConstantSInt::get(Type::IntTy, value)); } - void do_lconst(unsigned bcI, long long value) { + void do_lconst(long long value) { opStack_.push(ConstantSInt::get(Type::LongTy, value)); } - void do_fconst(unsigned bcI, float value) { + void do_fconst(float value) { opStack_.push(ConstantFP::get(Type::FloatTy, value)); } - void do_dconst(unsigned bcI, double value) { + void do_dconst(double value) { opStack_.push(ConstantFP::get(Type::DoubleTy, value)); } - void do_ldc(unsigned bcI, unsigned index) { + void do_ldc(unsigned index) { Constant* c = cf_->getConstant(index); assert(getConstant(c) && "Java constant not handled!"); opStack_.push(getConstant(c)); } - void do_load(unsigned bcI, JType type, unsigned index) { + void do_load(JType type, unsigned index) { opStack_.push(new LoadInst(getOrCreateLocal(index, getType(type)), - TMP, getBBAt(bcI))); + TMP, current_)); } - void do_aload(unsigned bcI, JType type) { + void do_aload(JType type) { assert(0 && "not implemented"); } - void do_store(unsigned bcI, JType type, unsigned index) { + void do_store(JType type, unsigned index) { Value* val = opStack_.top(); opStack_.pop(); const Type* valTy = val->getType(); Value* ptr = getOrCreateLocal(index, getType(type)); if (!valTy->isPrimitiveType() && valTy != cast(ptr->getType())->getElementType()) - ptr = new CastInst(ptr, PointerType::get(valTy), TMP, getBBAt(bcI)); - opStack_.push(new StoreInst(val, ptr, getBBAt(bcI))); + ptr = new CastInst(ptr, PointerType::get(valTy), TMP, current_); + opStack_.push(new StoreInst(val, ptr, current_)); } - void do_astore(unsigned bcI, JType type) { + void do_astore(JType type) { assert(0 && "not implemented"); } - void do_pop(unsigned bcI) { + void do_pop() { opStack_.pop(); } - void do_pop2(unsigned bcI) { + void do_pop2() { Value* v1 = opStack_.top(); opStack_.pop(); if (isOneSlotValue(v1)) opStack_.pop(); } - void do_dup(unsigned bcI) { + void do_dup() { opStack_.push(opStack_.top()); } - void do_dup_x1(unsigned bcI) { + void do_dup_x1() { Value* v1 = opStack_.top(); opStack_.pop(); Value* v2 = opStack_.top(); opStack_.pop(); opStack_.push(v1); @@ -982,7 +979,7 @@ opStack_.push(v1); } - void do_dup_x2(unsigned bcI) { + void do_dup_x2() { Value* v1 = opStack_.top(); opStack_.pop(); Value* v2 = opStack_.top(); opStack_.pop(); if (isOneSlotValue(v2)) { @@ -999,7 +996,7 @@ } } - void do_dup2(unsigned bcI) { + void do_dup2() { Value* v1 = opStack_.top(); opStack_.pop(); if (isOneSlotValue(v1)) { Value* v2 = opStack_.top(); opStack_.pop(); @@ -1014,7 +1011,7 @@ } } - void do_dup2_x1(unsigned bcI) { + void do_dup2_x1() { Value* v1 = opStack_.top(); opStack_.pop(); Value* v2 = opStack_.top(); opStack_.pop(); if (isOneSlotValue(v1)) { @@ -1032,7 +1029,7 @@ } } - void do_dup2_x2(unsigned bcI) { + void do_dup2_x2() { Value* v1 = opStack_.top(); opStack_.pop(); Value* v2 = opStack_.top(); opStack_.pop(); if (isOneSlotValue(v1)) { @@ -1070,231 +1067,227 @@ } } - void do_swap(unsigned bcI) { + void do_swap() { Value* v1 = opStack_.top(); opStack_.pop(); Value* v2 = opStack_.top(); opStack_.pop(); opStack_.push(v1); opStack_.push(v2); } - void do_add(unsigned bcI) { - do_binary_op_common(bcI, Instruction::Add); + void do_add() { + do_binary_op_common(Instruction::Add); } - void do_sub(unsigned bcI) { - do_binary_op_common(bcI, Instruction::Sub); + void do_sub() { + do_binary_op_common(Instruction::Sub); } - void do_mul(unsigned bcI) { - do_binary_op_common(bcI, Instruction::Mul); + void do_mul() { + do_binary_op_common(Instruction::Mul); } - void do_div(unsigned bcI) { - do_binary_op_common(bcI, Instruction::Div); + void do_div() { + do_binary_op_common(Instruction::Div); } - void do_rem(unsigned bcI) { - do_binary_op_common(bcI, Instruction::Rem); + void do_rem() { + do_binary_op_common(Instruction::Rem); } - void do_neg(unsigned bcI) { + void do_neg() { Value* v1 = opStack_.top(); opStack_.pop(); - opStack_.push(BinaryOperator::createNeg(v1, TMP, getBBAt(bcI))); + opStack_.push(BinaryOperator::createNeg(v1, TMP, current_)); } - void do_shl(unsigned bcI) { - do_shift_common(bcI, Instruction::Shl); + void do_shl() { + do_shift_common(Instruction::Shl); } - void do_shr(unsigned bcI) { - do_shift_common(bcI, Instruction::Shr); + void do_shr() { + do_shift_common(Instruction::Shr); } - void do_ushr(unsigned bcI) { + void do_ushr() { // cast value to be shifted into its unsigned version - do_swap(bcI); + do_swap(); Value* value = opStack_.top(); opStack_.pop(); value = new CastInst(value, value->getType()->getUnsignedVersion(), - TMP, getBBAt(bcI)); + TMP, current_); opStack_.push(value); - do_swap(bcI); + do_swap(); - do_shift_common(bcI, Instruction::Shr); + do_shift_common(Instruction::Shr); value = opStack_.top(); opStack_.pop(); // cast shifted value back to its original signed version opStack_.push(new CastInst(value, value->getType()->getSignedVersion(), - TMP, getBBAt(bcI))); + TMP, current_)); } - void do_shift_common(unsigned bcI, Instruction::OtherOps op) { + void do_shift_common(Instruction::OtherOps op) { Value* amount = opStack_.top(); opStack_.pop(); Value* value = opStack_.top(); opStack_.pop(); - amount = new CastInst(amount, Type::UByteTy, TMP, getBBAt(bcI)); - opStack_.push(new ShiftInst(op, value, amount, TMP, getBBAt(bcI))); + amount = new CastInst(amount, Type::UByteTy, TMP, current_); + opStack_.push(new ShiftInst(op, value, amount, TMP, current_)); } - void do_and(unsigned bcI) { - do_binary_op_common(bcI, Instruction::And); + void do_and() { + do_binary_op_common(Instruction::And); } - void do_or(unsigned bcI) { - do_binary_op_common(bcI, Instruction::Or); + void do_or() { + do_binary_op_common(Instruction::Or); } - void do_xor(unsigned bcI) { - do_binary_op_common(bcI, Instruction::Xor); + void do_xor() { + do_binary_op_common(Instruction::Xor); } - void do_binary_op_common(unsigned bcI, Instruction::BinaryOps op) { + void do_binary_op_common(Instruction::BinaryOps op) { Value* v2 = opStack_.top(); opStack_.pop(); Value* v1 = opStack_.top(); opStack_.pop(); - opStack_.push(BinaryOperator::create(op, v1, v2, TMP,getBBAt(bcI))); + opStack_.push(BinaryOperator::create(op, v1, v2, TMP,current_)); } - void do_iinc(unsigned bcI, unsigned index, int amount) { + void do_iinc(unsigned index, int amount) { Value* v = new LoadInst(getOrCreateLocal(index, Type::IntTy), - TMP, getBBAt(bcI)); + TMP, current_); BinaryOperator::createAdd(v, ConstantSInt::get(Type::IntTy, amount), - TMP, getBBAt(bcI)); - new StoreInst(v, getOrCreateLocal(index, Type::IntTy), getBBAt(bcI)); + TMP, current_); + new StoreInst(v, getOrCreateLocal(index, Type::IntTy), current_); } - void do_convert(unsigned bcI, JType to) { + void do_convert(JType to) { Value* v1 = opStack_.top(); opStack_.pop(); - opStack_.push(new CastInst(v1, getType(to), TMP, getBBAt(bcI))); + opStack_.push(new CastInst(v1, getType(to), TMP, current_)); } - void do_lcmp(unsigned bcI) { + void do_lcmp() { Value* v2 = opStack_.top(); opStack_.pop(); Value* v1 = opStack_.top(); opStack_.pop(); - Value* c = BinaryOperator::createSetGT(v1, v2, TMP, getBBAt(bcI)); + Value* c = BinaryOperator::createSetGT(v1, v2, TMP, current_); Value* r = new SelectInst(c, ConstantSInt::get(Type::IntTy, 1), ConstantSInt::get(Type::IntTy, 0), TMP, - getBBAt(bcI)); - c = BinaryOperator::createSetLT(v1, v2, TMP, getBBAt(bcI)); + current_); + c = BinaryOperator::createSetLT(v1, v2, TMP, current_); r = new SelectInst(c, ConstantSInt::get(Type::IntTy, -1), r, TMP, - getBBAt(bcI)); + current_); opStack_.push(r); } - void do_cmpl(unsigned bcI) { - do_cmp_common(bcI, -1); + void do_cmpl() { + do_cmp_common(-1); } - void do_cmpg(unsigned bcI) { - do_cmp_common(bcI, 1); + void do_cmpg() { + do_cmp_common(1); } - void do_cmp_common(unsigned bcI, int valueIfUnordered) { + void do_cmp_common(int valueIfUnordered) { Value* v2 = opStack_.top(); opStack_.pop(); Value* v1 = opStack_.top(); opStack_.pop(); - Value* c = BinaryOperator::createSetGT(v1, v2, TMP, getBBAt(bcI)); + Value* c = BinaryOperator::createSetGT(v1, v2, TMP, current_); Value* r = new SelectInst(c, ConstantSInt::get(Type::IntTy, 1), ConstantSInt::get(Type::IntTy, 0), TMP, - getBBAt(bcI)); - c = BinaryOperator::createSetLT(v1, v2, TMP, getBBAt(bcI)); + current_); + c = BinaryOperator::createSetLT(v1, v2, TMP, current_); r = new SelectInst(c, ConstantSInt::get(Type::IntTy, -1), r, TMP, - getBBAt(bcI)); + current_); c = new CallInst(module_->getOrInsertFunction ("llvm.isunordered", Type::BoolTy, v1->getType(), v2->getType(), 0), - v1, v2, TMP, getBBAt(bcI)); + v1, v2, TMP, current_); r = new SelectInst(c, ConstantSInt::get(Type::IntTy, valueIfUnordered), - r, TMP, getBBAt(bcI)); + r, TMP, current_); opStack_.push(r); } - void do_if(unsigned bcI, JSetCC cc, JType type, + void do_if(JSetCC cc, JType type, unsigned t, unsigned f) { Value* v1 = opStack_.top(); opStack_.pop(); Value* v2 = llvm::Constant::getNullValue(v1->getType()); - Value* c = new SetCondInst(getSetCC(cc), v1, v2, TMP, getBBAt(bcI)); - new BranchInst(getBBAt(t), getBBAt(f), c, getBBAt(bcI)); + Value* c = new SetCondInst(getSetCC(cc), v1, v2, TMP, current_); + new BranchInst(getBBAt(t), getBBAt(f), c, current_); } - void do_ifcmp(unsigned bcI, JSetCC cc, + void do_ifcmp(JSetCC cc, unsigned t, unsigned f) { Value* v2 = opStack_.top(); opStack_.pop(); Value* v1 = opStack_.top(); opStack_.pop(); - Value* c = new SetCondInst(getSetCC(cc), v1, v2, TMP, getBBAt(bcI)); - new BranchInst(getBBAt(t), getBBAt(f), c, getBBAt(bcI)); + Value* c = new SetCondInst(getSetCC(cc), v1, v2, TMP, current_); + new BranchInst(getBBAt(t), getBBAt(f), c, current_); } - void do_goto(unsigned bcI, unsigned target) { - new BranchInst(getBBAt(target), getBBAt(bcI)); + void do_goto(unsigned target) { + new BranchInst(getBBAt(target), current_); } - void do_jsr(unsigned bcI, unsigned target) { + void do_jsr(unsigned target) { assert(0 && "not implemented"); } - void do_ret(unsigned bcI, unsigned index) { + void do_ret(unsigned index) { assert(0 && "not implemented"); } - void do_switch(unsigned bcI, - unsigned defTarget, - const SwitchCases& sw) { + void do_switch(unsigned defTarget, const SwitchCases& sw) { Value* v1 = opStack_.top(); opStack_.pop(); - SwitchInst* in = new SwitchInst(v1, getBBAt(defTarget), getBBAt(bcI)); + SwitchInst* in = new SwitchInst(v1, getBBAt(defTarget), current_); for (unsigned i = 0; i < sw.size(); ++i) in->addCase(ConstantSInt::get(Type::IntTy, sw[i].first), getBBAt(sw[i].second)); } - void do_return(unsigned bcI) { + void do_return() { Value* v1 = opStack_.top(); opStack_.pop(); - new ReturnInst(v1, getBBAt(bcI)); + new ReturnInst(v1, current_); } - void do_return_void(unsigned bcI) { - new ReturnInst(NULL, getBBAt(bcI)); + void do_return_void() { + new ReturnInst(NULL, current_); } - void do_getstatic(unsigned bcI, unsigned index) { - Value* v = new LoadInst(getStaticField(index), TMP, getBBAt(bcI)); + void do_getstatic(unsigned index) { + Value* v = new LoadInst(getStaticField(index), TMP, current_); opStack_.push(v); } - void do_putstatic(unsigned bcI, unsigned index) { + void do_putstatic(unsigned index) { Value* v = opStack_.top(); opStack_.pop(); Value* ptr = getStaticField(index); const Type* fieldTy = cast(ptr->getType())->getElementType(); if (v->getType() != fieldTy) - v = new CastInst(v, fieldTy, TMP, getBBAt(bcI)); - new StoreInst(v, ptr, getBBAt(bcI)); + v = new CastInst(v, fieldTy, TMP, current_); + new StoreInst(v, ptr, current_); } - void do_getfield(unsigned bcI, unsigned index) { + void do_getfield(unsigned index) { Value* p = opStack_.top(); opStack_.pop(); - Value* v = new LoadInst(getField(bcI, index, p), TMP, getBBAt(bcI)); + Value* v = new LoadInst(getField(index, p), TMP, current_); opStack_.push(v); } - void do_putfield(unsigned bcI, unsigned index) { + void do_putfield(unsigned index) { Value* v = opStack_.top(); opStack_.pop(); Value* p = opStack_.top(); opStack_.pop(); - new StoreInst(v, getField(bcI, index, p), getBBAt(bcI)); + new StoreInst(v, getField(index, p), current_); } - void makeCall(Value* fun, - const std::vector params, - BasicBlock* bb) { + void makeCall(Value* fun, const std::vector params) { const PointerType* funPtrTy = cast(fun->getType()); const FunctionType* funTy = cast(funPtrTy->getElementType()); if (funTy->getReturnType() == Type::VoidTy) - new CallInst(fun, params, "", bb); + new CallInst(fun, params, "", current_); else { - Value* r = new CallInst(fun, params, TMP, bb); + Value* r = new CallInst(fun, params, TMP, current_); opStack_.push(r); } } - std::vector getParams(FunctionType* funTy, BasicBlock* bb) { + std::vector getParams(FunctionType* funTy) { unsigned numParams = funTy->getNumParams(); std::vector params(numParams); while (numParams--) { @@ -1302,13 +1295,13 @@ params[numParams] = p->getType() == funTy->getParamType(numParams) ? p : - new CastInst(p, funTy->getParamType(numParams), TMP, bb); + new CastInst(p, funTy->getParamType(numParams), TMP, current_); } return params; } - void do_invokevirtual(unsigned bcI, unsigned index) { + void do_invokevirtual(unsigned index) { ConstantMethodRef* methodRef = cf_->getConstantMethodRef(index); ConstantNameAndType* nameAndType = methodRef->getNameAndType(); @@ -1324,33 +1317,32 @@ FunctionType* funTy = cast(getType(nameAndType->getDescriptor(), ci.type)); - BasicBlock* BB = getBBAt(bcI); - std::vector params(getParams(funTy, BB)); + std::vector params(getParams(funTy)); Value* objRef = params.front(); objRef = new CastInst(objRef, PointerType::get(ci.type), - "this", BB); - Value* objBase = getField(bcI, cf, LLVM_JAVA_OBJECT_BASE, objRef); + "this", current_); + Value* objBase = getField(cf, LLVM_JAVA_OBJECT_BASE, objRef); Function* f = module_->getOrInsertFunction( LLVM_JAVA_GETOBJECTCLASS, PointerType::get(VTableInfo::VTableTy), objBase->getType(), NULL); - Value* vtable = new CallInst(f, objBase, TMP, BB); + Value* vtable = new CallInst(f, objBase, TMP, current_); vtable = new CastInst(vtable, PointerType::get(vi.vtable->getType()), - TMP, BB); - vtable = new LoadInst(vtable, className + "", BB); + TMP, current_); + vtable = new LoadInst(vtable, className + "", current_); std::vector indices(1, ConstantUInt::get(Type::UIntTy, 0)); assert(vi.m2iMap.find(methodDescr) != vi.m2iMap.end() && "could not find slot for virtual function!"); unsigned vSlot = vi.m2iMap.find(methodDescr)->second; indices.push_back(ConstantUInt::get(Type::UIntTy, vSlot)); Value* vfunPtr = - new GetElementPtrInst(vtable, indices, TMP, BB); - Value* vfun = new LoadInst(vfunPtr, methodDescr, BB); + new GetElementPtrInst(vtable, indices, TMP, current_); + Value* vfun = new LoadInst(vfunPtr, methodDescr, current_); - makeCall(vfun, params, BB); + makeCall(vfun, params); } - void do_invokespecial(unsigned bcI, unsigned index) { + void do_invokespecial(unsigned index) { ConstantMethodRef* methodRef = cf_->getConstantMethodRef(index); ConstantNameAndType* nameAndType = methodRef->getNameAndType(); @@ -1362,13 +1354,12 @@ const ClassInfo& ci = getClassInfo(ClassFile::get(className)); // constructor calls are statically bound - BasicBlock* BB = getBBAt(bcI); if (methodName == "") { FunctionType* funcTy = cast(getType(nameAndType->getDescriptor(), ci.type)); Function* function = module_->getOrInsertFunction(funcName, funcTy); toCompileFunctions_.insert(function); - makeCall(function, getParams(funcTy, BB), BB); + makeCall(function, getParams(funcTy)); } // otherwise we call the superclass' implementation of the method else { @@ -1376,7 +1367,7 @@ } } - void do_invokestatic(unsigned bcI, unsigned index) { + void do_invokestatic(unsigned index) { ConstantMethodRef* methodRef = cf_->getConstantMethodRef(index); ConstantNameAndType* nameAndType = methodRef->getNameAndType(); @@ -1389,11 +1380,10 @@ cast(getType(nameAndType->getDescriptor())); Function* function = module_->getOrInsertFunction(funcName, funcTy); toCompileFunctions_.insert(function); - BasicBlock* BB = getBBAt(bcI); - makeCall(function, getParams(funcTy, BB), BB); + makeCall(function, getParams(funcTy)); } - void do_invokeinterface(unsigned bcI, unsigned index) { + void do_invokeinterface(unsigned index) { ConstantInterfaceMethodRef* methodRef = cf_->getConstantInterfaceMethodRef(index); ConstantNameAndType* nameAndType = methodRef->getNameAndType(); @@ -1410,32 +1400,31 @@ FunctionType* funTy = cast(getType(nameAndType->getDescriptor(), ci.type)); - BasicBlock* BB = getBBAt(bcI); - std::vector params(getParams(funTy, BB)); + std::vector params(getParams(funTy)); Value* objRef = params.front(); objRef = new CastInst(objRef, PointerType::get(ci.type), - "this", BB); - Value* objBase = getField(bcI, cf, LLVM_JAVA_OBJECT_BASE, objRef); + "this", current_); + Value* objBase = getField(cf, LLVM_JAVA_OBJECT_BASE, objRef); Function* f = module_->getOrInsertFunction( LLVM_JAVA_GETOBJECTCLASS, PointerType::get(VTableInfo::VTableTy), objBase->getType(), NULL); - Value* vtable = new CallInst(f, objBase, TMP, BB); + Value* vtable = new CallInst(f, objBase, TMP, current_); // get the interfaces array of vtables std::vector indices(2, ConstantUInt::get(Type::UIntTy, 0)); indices.push_back(ConstantUInt::get(Type::UIntTy, 3)); Value* interfaceVTables = - new GetElementPtrInst(vtable, indices, TMP, BB); - interfaceVTables = new LoadInst(interfaceVTables, TMP, BB); + new GetElementPtrInst(vtable, indices, TMP, current_); + interfaceVTables = new LoadInst(interfaceVTables, TMP, current_); // get the actual interface vtable indices.clear(); indices.push_back(ConstantUInt::get(Type::UIntTy, ci.interfaceIdx)); Value* interfaceVTable = - new GetElementPtrInst(interfaceVTables, indices, TMP, BB); + new GetElementPtrInst(interfaceVTables, indices, TMP, current_); interfaceVTable = - new LoadInst(interfaceVTable, className + "", BB); + new LoadInst(interfaceVTable, className + "", current_); interfaceVTable = - new CastInst(interfaceVTable, vi.vtable->getType(), TMP, BB); + new CastInst(interfaceVTable, vi.vtable->getType(), TMP, current_); // get the function pointer indices.resize(1); assert(vi.m2iMap.find(methodDescr) != vi.m2iMap.end() && @@ -1443,13 +1432,13 @@ unsigned vSlot = vi.m2iMap.find(methodDescr)->second; indices.push_back(ConstantUInt::get(Type::UIntTy, vSlot)); Value* vfunPtr = - new GetElementPtrInst(interfaceVTable, indices, TMP, BB); - Value* vfun = new LoadInst(vfunPtr, methodDescr, BB); + new GetElementPtrInst(interfaceVTable, indices, TMP, current_); + Value* vfun = new LoadInst(vfunPtr, methodDescr, current_); - makeCall(vfun, params, BB); + makeCall(vfun, params); } - void do_new(unsigned bcI, unsigned index) { + void do_new(unsigned index) { ConstantClass* classRef = cf_->getConstantClass(index); ClassFile* cf = ClassFile::get(classRef->getName()->str()); const ClassInfo& ci = getClassInfo(cf); @@ -1457,71 +1446,71 @@ Value* objRef = new MallocInst(ci.type, ConstantUInt::get(Type::UIntTy, 0), - TMP, getBBAt(bcI)); - Value* vtable = getField(bcI, cf, LLVM_JAVA_OBJECT_BASE, objRef); + TMP, current_); + Value* vtable = getField(cf, LLVM_JAVA_OBJECT_BASE, objRef); vtable = new CastInst(vtable, PointerType::get(vi.vtable->getType()), - TMP, getBBAt(bcI)); - vtable = new StoreInst(vi.vtable, vtable, getBBAt(bcI)); + TMP, current_); + vtable = new StoreInst(vi.vtable, vtable, current_); opStack_.push(objRef); } - void do_newarray(unsigned bcI, JType type) { + void do_newarray(JType type) { assert(0 && "not implemented"); } - void do_anewarray(unsigned bcI, unsigned index) { + void do_anewarray(unsigned index) { assert(0 && "not implemented"); } - void do_arraylength(unsigned bcI) { + void do_arraylength() { assert(0 && "not implemented"); } - void do_athrow(unsigned bcI) { + void do_athrow() { Value* objRef = opStack_.top(); opStack_.pop(); objRef = new CastInst(objRef, PointerType::get(ClassInfo::ObjectBaseTy), - TMP, getBBAt(bcI)); + TMP, current_); Function* f = module_->getOrInsertFunction( LLVM_JAVA_THROW, Type::IntTy, objRef->getType(), NULL); - new CallInst(f, objRef, TMP, getBBAt(bcI)); + new CallInst(f, objRef, TMP, current_); } - void do_checkcast(unsigned bcI, unsigned index) { - do_dup(bcI); - do_instanceof(bcI, index); + void do_checkcast(unsigned index) { + do_dup(); + do_instanceof(index); Value* r = opStack_.top(); opStack_.pop(); Value* b = new SetCondInst(Instruction::SetEQ, r, ConstantSInt::get(Type::IntTy, 1), - TMP, getBBAt(bcI)); + TMP, current_); // FIXME: if b is false we must throw a ClassCast exception } - void do_instanceof(unsigned bcI, unsigned index) { + void do_instanceof(unsigned index) { ConstantClass* classRef = cf_->getConstantClass(index); ClassFile* cf = ClassFile::get(classRef->getName()->str()); const VTableInfo& vi = getVTableInfo(cf); Value* objRef = opStack_.top(); opStack_.pop(); - Value* objBase = getField(bcI, cf, LLVM_JAVA_OBJECT_BASE, objRef); + Value* objBase = getField(cf, LLVM_JAVA_OBJECT_BASE, objRef); Function* f = module_->getOrInsertFunction( LLVM_JAVA_ISINSTANCEOF, Type::IntTy, objBase->getType(), PointerType::get(VTableInfo::VTableTy), NULL); - Value* vtable = new CastInst(vi.vtable, PointerType::get(VTableInfo::VTableTy), TMP, getBBAt(bcI)); - Value* r = new CallInst(f, objBase, vtable, TMP, getBBAt(bcI)); + Value* vtable = new CastInst(vi.vtable, + PointerType::get(VTableInfo::VTableTy), + TMP, current_); + Value* r = new CallInst(f, objBase, vtable, TMP, current_); opStack_.push(r); } - void do_monitorenter(unsigned bcI) { + void do_monitorenter() { assert(0 && "not implemented"); } - void do_monitorexit(unsigned bcI) { + void do_monitorexit() { assert(0 && "not implemented"); } - void do_multianewarray(unsigned bcI, - unsigned index, - unsigned dims) { + void do_multianewarray(unsigned index, unsigned dims) { assert(0 && "not implemented"); } }; From alkis at cs.uiuc.edu Thu Sep 23 14:00:46 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Thu, 23 Sep 2004 14:00:46 -0500 Subject: [llvm-commits] CVS: llvm-java/lib/Compiler/Compiler.cpp Message-ID: <200409231900.OAA28491@zion.cs.uiuc.edu> Changes in directory llvm-java/lib/Compiler: Compiler.cpp updated: 1.113 -> 1.114 --- Log message: Stop exposing Bytecode2BasicBlockMapper internals to the compiler. --- Diffs of the changes: (+42 -50) Index: llvm-java/lib/Compiler/Compiler.cpp diff -u llvm-java/lib/Compiler/Compiler.cpp:1.113 llvm-java/lib/Compiler/Compiler.cpp:1.114 --- llvm-java/lib/Compiler/Compiler.cpp:1.113 Thu Sep 23 11:25:56 2004 +++ llvm-java/lib/Compiler/Compiler.cpp Thu Sep 23 14:00:35 2004 @@ -48,7 +48,6 @@ const std::string TMP("tmp"); - typedef std::vector BC2BBMap; typedef std::stack > OperandStack; typedef std::vector Locals; @@ -70,25 +69,18 @@ class Bytecode2BasicBlockMapper : public BytecodeParser { - Function& function_; - BC2BBMap& bc2bbMap_; + Function* function_; + typedef std::vector BC2BBMap; + BC2BBMap bc2bbMap_; typedef std::map FallThroughMap; FallThroughMap ftMap_; - const CodeAttribute& codeAttr_; public: - Bytecode2BasicBlockMapper(Function& f, - BC2BBMap& m, - CodeAttribute& c) - : function_(f), bc2bbMap_(m), codeAttr_(c) { } - - void compute() { - bc2bbMap_.clear(); - bc2bbMap_.assign(codeAttr_.getCodeSize(), NULL); - - BasicBlock* bb = new BasicBlock("entry", &function_); + Bytecode2BasicBlockMapper(Function* f, CodeAttribute* c) + : function_(f), bc2bbMap_(c->getCodeSize()) { + BasicBlock* bb = new BasicBlock("entry", function_); - parse(codeAttr_.getCode(), codeAttr_.getCodeSize()); + parse(c->getCode(), c->getCodeSize()); for (unsigned i = 0, e = bc2bbMap_.size(); i != e; ++i) if (BasicBlock* next = bc2bbMap_[i]) { @@ -98,39 +90,43 @@ else bc2bbMap_[i] = bb; - assert(function_.getEntryBlock().getName() == "entry"); + assert(function_->getEntryBlock().getName() == "entry"); + } + + BasicBlock* getBBAt(unsigned bcI) { + assert(bc2bbMap_.size() > bcI && "Invalid bytecode index!"); + return bc2bbMap_[bcI]; } - void insertFallThroughBranches() { - for (FallThroughMap::const_iterator i = ftMap_.begin(), e = ftMap_.end(); - i != e; ++i) - if (!i->first->getTerminator()) - new BranchInst(i->second, i->first); + BasicBlock* getFallThroughBranch(BasicBlock* bb) { + assert(ftMap_.find(bb) != ftMap_.end() && + "Basic block is not in this mapper!"); + return ftMap_.find(bb)->second; } - + void do_if(JSetCC cc, JType type, unsigned t, unsigned f) { if (!bc2bbMap_[t]) - bc2bbMap_[t] = new BasicBlock("bc" + utostr(t), &function_); + bc2bbMap_[t] = new BasicBlock("bc" + utostr(t), function_); if (!bc2bbMap_[f]) - bc2bbMap_[f] = new BasicBlock("bc" + utostr(f), &function_); + bc2bbMap_[f] = new BasicBlock("bc" + utostr(f), function_); } void do_ifcmp(JSetCC cc, unsigned t, unsigned f) { if (!bc2bbMap_[t]) - bc2bbMap_[t] = new BasicBlock("bc" + utostr(t), &function_); + bc2bbMap_[t] = new BasicBlock("bc" + utostr(t), function_); if (!bc2bbMap_[f]) - bc2bbMap_[f] = new BasicBlock("bc" + utostr(f), &function_); + bc2bbMap_[f] = new BasicBlock("bc" + utostr(f), function_); } void do_switch(unsigned defTarget, const SwitchCases& sw) { - for (unsigned i = 0; i < sw.size(); ++i) { + for (unsigned i = 0, e = sw.size(); i != e; ++i) { unsigned target = sw[i].second; if (!bc2bbMap_[target]) - bc2bbMap_[target] = new BasicBlock("bc" + utostr(target), &function_); + bc2bbMap_[target] = new BasicBlock("bc" + utostr(target), function_); } if (!bc2bbMap_[defTarget]) bc2bbMap_[defTarget] = - new BasicBlock("bc" + utostr(defTarget), &function_); + new BasicBlock("bc" + utostr(defTarget), function_); } }; @@ -141,7 +137,7 @@ ClassFile* cf_; OperandStack opStack_; Locals locals_; - BC2BBMap bc2bbMap_; + std::auto_ptr mapper_; BasicBlock* prologue_; BasicBlock* current_; @@ -175,9 +171,6 @@ Class2VTableInfoMap c2viMap_; private: - BasicBlock* getBBAt(unsigned bcI) { return bc2bbMap_[bcI]; } - - private: llvm::Constant* getConstant(Constant* c) { if (dynamic_cast(c)) // FIXME: should return a String object represeting this ConstantString @@ -782,8 +775,7 @@ locals_.clear(); locals_.assign(codeAttr->getMaxLocals(), NULL); - Bytecode2BasicBlockMapper mapper(*function, bc2bbMap_, *codeAttr); - mapper.compute(); + mapper_.reset(new Bytecode2BasicBlockMapper(function, codeAttr)); prologue_ = new BasicBlock("prologue"); unsigned index = 0; @@ -797,16 +789,13 @@ index += isTwoSlotType(a->getType()) ? 2 : 1; } - parse(codeAttr->getCode(), codeAttr->getCodeSize()); - - // makethe prologue the entry block of the function with a + // make the prologue the entry block of the function with a // fallthrough branch to the original entry block function->getBasicBlockList().push_front(prologue_); - new BranchInst(prologue_->getNext(), prologue_); + current_ = prologue_->getNext(); + new BranchInst(current_, prologue_); - // now insert fall through branches to all basic blocks that - // don't have a terminator - mapper.insertFallThroughBranches(); + parse(codeAttr->getCode(), codeAttr->getCodeSize()); function->dump(); @@ -905,7 +894,10 @@ } void pre_inst(unsigned bcI) { - current_ = getBBAt(bcI); + BasicBlock* previous = current_; + current_ = mapper_->getBBAt(bcI); + if (previous != current_ && !previous->getTerminator()) + new BranchInst(mapper_->getFallThroughBranch(previous), previous); } void do_aconst_null() { @@ -1208,7 +1200,7 @@ Value* v1 = opStack_.top(); opStack_.pop(); Value* v2 = llvm::Constant::getNullValue(v1->getType()); Value* c = new SetCondInst(getSetCC(cc), v1, v2, TMP, current_); - new BranchInst(getBBAt(t), getBBAt(f), c, current_); + new BranchInst(mapper_->getBBAt(t), mapper_->getBBAt(f), c, current_); } void do_ifcmp(JSetCC cc, @@ -1216,11 +1208,11 @@ Value* v2 = opStack_.top(); opStack_.pop(); Value* v1 = opStack_.top(); opStack_.pop(); Value* c = new SetCondInst(getSetCC(cc), v1, v2, TMP, current_); - new BranchInst(getBBAt(t), getBBAt(f), c, current_); + new BranchInst(mapper_->getBBAt(t), mapper_->getBBAt(f), c, current_); } void do_goto(unsigned target) { - new BranchInst(getBBAt(target), current_); + new BranchInst(mapper_->getBBAt(target), current_); } void do_jsr(unsigned target) { @@ -1232,11 +1224,11 @@ } void do_switch(unsigned defTarget, const SwitchCases& sw) { - Value* v1 = opStack_.top(); opStack_.pop(); - SwitchInst* in = new SwitchInst(v1, getBBAt(defTarget), current_); - for (unsigned i = 0; i < sw.size(); ++i) + Value* v = opStack_.top(); opStack_.pop(); + SwitchInst* in = new SwitchInst(v, mapper_->getBBAt(defTarget), current_); + for (unsigned i = 0, e = sw.size(); i != e; ++i) in->addCase(ConstantSInt::get(Type::IntTy, sw[i].first), - getBBAt(sw[i].second)); + mapper_->getBBAt(sw[i].second)); } void do_return() { From gaeke at cs.uiuc.edu Thu Sep 23 14:48:45 2004 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Thu, 23 Sep 2004 14:48:45 -0500 (CDT) Subject: [llvm-commits] CVS: reopt/lib/LightWtProfiling/RuntimeOptimizations.cpp Message-ID: <200409231948.OAA11440@seraph.cs.uiuc.edu> Changes in directory reopt/lib/LightWtProfiling: RuntimeOptimizations.cpp updated: 1.50 -> 1.51 --- Log message: Always skip traces containing calls (regardless of DEBUG setting). --- Diffs of the changes: (+7 -5) Index: reopt/lib/LightWtProfiling/RuntimeOptimizations.cpp diff -u reopt/lib/LightWtProfiling/RuntimeOptimizations.cpp:1.50 reopt/lib/LightWtProfiling/RuntimeOptimizations.cpp:1.51 --- reopt/lib/LightWtProfiling/RuntimeOptimizations.cpp:1.50 Thu Sep 2 11:55:43 2004 +++ reopt/lib/LightWtProfiling/RuntimeOptimizations.cpp Thu Sep 23 14:48:33 2004 @@ -84,12 +84,14 @@ // Turn the vector of basic blocks into a Trace. Trace T (vBB); + if (TraceContainsCall (T)) + return false; + DEBUG(++TraceCount; - if ((!AllowCalls && TraceContainsCall (T)) - || (skipTrace.find (TraceCount) != skipTrace.end ())) { - std::cerr << "optimizeTrace: skipping trace " << TraceCount << "\n"; - return false; - }); + if ((skipTrace.find (TraceCount) != skipTrace.end ())) { + std::cerr << "optimizeTrace: skipping trace " << TraceCount << "\n"; + return false; + }); // Initialization stuff: ensure module has been read in, and allocate a // target machine, if there isn't one already. From gaeke at cs.uiuc.edu Thu Sep 23 14:48:46 2004 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Thu, 23 Sep 2004 14:48:46 -0500 (CDT) Subject: [llvm-commits] CVS: reopt/test/TEST.reopt.Makefile Message-ID: <200409231948.OAA11456@seraph.cs.uiuc.edu> Changes in directory reopt/test: TEST.reopt.Makefile updated: 1.22 -> 1.23 --- Log message: Use LLVMLIBCURRENTSOURCE instead of DESTLIBCURRENT. Don't call llc with -debug. --- Diffs of the changes: (+14 -11) Index: reopt/test/TEST.reopt.Makefile diff -u reopt/test/TEST.reopt.Makefile:1.22 reopt/test/TEST.reopt.Makefile:1.23 --- reopt/test/TEST.reopt.Makefile:1.22 Sun Aug 22 22:10:32 2004 +++ reopt/test/TEST.reopt.Makefile Thu Sep 23 14:48:36 2004 @@ -26,24 +26,26 @@ REOPTLIBDIR = $(PROJECT_DIR)/lib/$(CONFIGURATION) # Libraries that contain the Reoptimizer itself +#REOPTIMIZER_OBJS = $(PROJECT_DIR)/lib/Debug/firstTrigger.o + REOPTIMIZER_OBJS = $(REOPTLIBDIR)/firstTrigger.o \ $(REOPTLIBDIR)/tracecache.o $(REOPTLIBDIR)/mapinfo.o \ $(REOPTLIBDIR)/scratchmemory.o $(REOPTLIBDIR)/tracetofunction.o \ $(REOPTLIBDIR)/tracejit.o $(REOPTLIBDIR)/traceio.o # Object files that contain common LLVM code the Reoptimizer depends on -REOPTIMIZER_LLVMOBJS = $(DESTLIBCURRENT)/vmcore.o \ - $(DESTLIBCURRENT)/bcreader.o $(DESTLIBCURRENT)/bcwriter.o \ - $(DESTLIBCURRENT)/sparcv9.o \ - $(DESTLIBCURRENT)/sparcv9livevar.o $(DESTLIBCURRENT)/sched.o \ - $(DESTLIBCURRENT)/codegen.o $(DESTLIBCURRENT)/executionengine.o \ - $(DESTLIBCURRENT)/lli-jit.o $(DESTLIBCURRENT)/lli-interpreter.o +REOPTIMIZER_LLVMOBJS = $(LLVMLIBCURRENTSOURCE)/vmcore.o \ + $(LLVMLIBCURRENTSOURCE)/bcreader.o $(LLVMLIBCURRENTSOURCE)/bcwriter.o \ + $(LLVMLIBCURRENTSOURCE)/sparcv9.o \ + $(LLVMLIBCURRENTSOURCE)/sparcv9livevar.o $(LLVMLIBCURRENTSOURCE)/sched.o \ + $(LLVMLIBCURRENTSOURCE)/codegen.o $(LLVMLIBCURRENTSOURCE)/executionengine.o \ + $(LLVMLIBCURRENTSOURCE)/lli-jit.o $(LLVMLIBCURRENTSOURCE)/lli-interpreter.o # Library archive files that contain common LLVM code the Reoptimizer depends on -REOPTIMIZER_LLVMLIBS = $(DESTLIBCURRENT)/libsparcv9regalloc.a \ - $(DESTLIBCURRENT)/libtarget.a \ - $(DESTLIBCURRENT)/libscalaropts.a $(DESTLIBCURRENT)/libtransformutils.a \ - $(DESTLIBCURRENT)/libanalysis.a $(DESTLIBCURRENT)/libsupport.a +REOPTIMIZER_LLVMLIBS = $(LLVMLIBCURRENTSOURCE)/libsparcv9regalloc.a \ + $(LLVMLIBCURRENTSOURCE)/libtarget.a \ + $(LLVMLIBCURRENTSOURCE)/libscalaropts.a $(LLVMLIBCURRENTSOURCE)/libtransformutils.a \ + $(LLVMLIBCURRENTSOURCE)/libanalysis.a $(LLVMLIBCURRENTSOURCE)/libsupport.a # Solaris libraries that the Reoptimizer depends on REOPTIMIZER_SOLARISLIBS = -lcpc -lm -lrt -lmalloc -ldl @@ -77,7 +79,7 @@ @echo "===== Building Reoptimizer version of $(TESTNAME) =====" $(LOPT) -q -inline -lowerswitch -enable-correct-eh-support \ -lowerinvoke -branch-combine -emitfuncs -instloops $< | $(LLC) \ - $(LLCFLAGS) -debug -dregalloc=y -print-machineinstrs -disable-sched \ + $(LLCFLAGS) -dregalloc=y -print-machineinstrs -disable-sched \ -disable-strip -f -enable-maps -save-ra-state -o $@ 2>$@.log # 2. Link the instrumented binary with the necessary parts of the @@ -100,6 +102,7 @@ $(PROGRAMS_TO_TEST:%=Output/%.out-reopt-llc): \ Output/%.out-reopt-llc: Output/%.reopt-llc @echo "===== Running Reoptimizer version of $(TESTNAME) =====" +# $< $(RUN_OPTIONS) < $(STDIN_FILENAME) > $@ -$(RUNSAFELY) $(STDIN_FILENAME) $@ $< $(RUN_OPTIONS) endif From gaeke at cs.uiuc.edu Thu Sep 23 14:48:45 2004 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Thu, 23 Sep 2004 14:48:45 -0500 (CDT) Subject: [llvm-commits] CVS: reopt/test/Makefile Message-ID: <200409231948.OAA11445@seraph.cs.uiuc.edu> Changes in directory reopt/test: Makefile updated: 1.7 -> 1.8 --- Log message: Fix location of test/Programs, now called llvm-test. --- Diffs of the changes: (+2 -1) Index: reopt/test/Makefile diff -u reopt/test/Makefile:1.7 reopt/test/Makefile:1.8 --- reopt/test/Makefile:1.7 Fri Jul 23 00:00:04 2004 +++ reopt/test/Makefile Thu Sep 23 14:48:35 2004 @@ -9,11 +9,12 @@ test:: LEVEL = .. + include $(LEVEL)/Makefile.common # test target - Descend into test/Programs and run the TEST.reopt.Makefile # tests... test:: - (cd $(LLVM_OBJ_ROOT)/test/Programs/$(SUBDIR); \ + (cd $(LLVM_OBJ_ROOT)/projects/llvm-test/$(SUBDIR); \ PROJECT_DIR=$(BUILD_OBJ_ROOT) $(MAKE) TEST=reopt \ test ) From gaeke at cs.uiuc.edu Thu Sep 23 14:48:45 2004 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Thu, 23 Sep 2004 14:48:45 -0500 (CDT) Subject: [llvm-commits] CVS: reopt/lib/LightWtProfiling/SLI.cpp SecondTrigger.cpp Message-ID: <200409231948.OAA11444@seraph.cs.uiuc.edu> Changes in directory reopt/lib/LightWtProfiling: SLI.cpp updated: 1.22 -> 1.23 SecondTrigger.cpp updated: 1.34 -> 1.35 --- Log message: Fix assertions with important side-effects. --- Diffs of the changes: (+8 -6) Index: reopt/lib/LightWtProfiling/SLI.cpp diff -u reopt/lib/LightWtProfiling/SLI.cpp:1.22 reopt/lib/LightWtProfiling/SLI.cpp:1.23 --- reopt/lib/LightWtProfiling/SLI.cpp:1.22 Thu Sep 2 11:55:44 2004 +++ reopt/lib/LightWtProfiling/SLI.cpp Thu Sep 23 14:48:34 2004 @@ -213,8 +213,8 @@ // a BasicBlock, but since branchAddr ends a basic block, we must scan // backwards hoping to find the beginning of its basic block. BasicBlock *root = 0, *end = 0; - assert(getReverseBBMap(brTarget, M, root) - && "Branch target's BasicBlock not found in map!"); + bool foundBB = getReverseBBMap(brTarget, M, root); + assert(foundBB && "Branch target's BasicBlock not found in map!"); assert(root && "Branch target mapped to NULL BasicBlock?"); while(!getReverseBBMap(branchAddr, M, end)) branchAddr -= 4; // Scan backwards until we find it. @@ -372,7 +372,8 @@ } else{ BasicBlock *targetBB=NULL; - assert(getReverseBBMap(getBranchTarget(instr, addr), M, targetBB)); + bool found = getReverseBBMap(getBranchTarget(instr, addr), M, targetBB); + assert(found); branchStub[index] = targetBB; } index += 2; @@ -569,7 +570,8 @@ trace.push_back(vm->readInstrFrmVm(addr+4, tr, tr2)); if (isBranchAlways(instr)) { BasicBlock *targetBB = NULL; - assert(getReverseBBMap(getBranchTarget(instr, addr), M, targetBB)); + bool found = getReverseBBMap(getBranchTarget(instr, addr), M, targetBB); + assert(found); branchStub[index] = targetBB; index += 2; } else if (isCondBranch) { Index: reopt/lib/LightWtProfiling/SecondTrigger.cpp diff -u reopt/lib/LightWtProfiling/SecondTrigger.cpp:1.34 reopt/lib/LightWtProfiling/SecondTrigger.cpp:1.35 --- reopt/lib/LightWtProfiling/SecondTrigger.cpp:1.34 Thu Sep 2 11:55:44 2004 +++ reopt/lib/LightWtProfiling/SecondTrigger.cpp Thu Sep 23 14:48:34 2004 @@ -438,8 +438,8 @@ BasicBlock *bb; BasicBlock *startBB = 0; // Get the first basic block by querying the mapping information. - assert (getReverseBBMap (start, M, startBB) && - "Couldn't find starting BasicBlock for trace start addr"); + bool foundBB = getReverseBBMap (start, M, startBB); + assert (foundBB && "Couldn't find starting BasicBlock for trace start addr"); bb = startBB; do { // Add basic block to trace. From gaeke at cs.uiuc.edu Thu Sep 23 14:48:48 2004 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Thu, 23 Sep 2004 14:48:48 -0500 (CDT) Subject: [llvm-commits] CVS: reopt/test/run-tests Message-ID: <200409231948.OAA11462@seraph.cs.uiuc.edu> Changes in directory reopt/test: run-tests updated: 1.20 -> 1.21 --- Log message: Add -release, -lps options. Fix location of test/Programs, now called llvm-test. --- Diffs of the changes: (+9 -6) Index: reopt/test/run-tests diff -u reopt/test/run-tests:1.20 reopt/test/run-tests:1.21 --- reopt/test/run-tests:1.20 Mon Aug 30 14:56:44 2004 +++ reopt/test/run-tests Thu Sep 23 14:48:38 2004 @@ -18,10 +18,13 @@ # parse arguments skiptrace=0 outputonly=0 +MKOPTS='' action=test for arg in $@; do case $arg in -output) outputonly=1 ;; + -release) MKOPTS="$MKOPTS ENABLE_OPTIMIZED=1" ;; + -lps) MKOPTS="$MKOPTS LARGE_PROBLEM_SIZE=1" ;; -clean) action=clean ;; -debug) action=debug ;; -test) action=test ;; @@ -31,11 +34,11 @@ esac done -# get full path to test/Programs subdirectory +# get full path to projects/llvm-test subdirectory objroot=`gmake prdirs | egrep 'LLVM.*Object Root' |cut -d: -f2-` EXTRATESTSUBDIR=SingleSource/Reoptimizer -EXTRATESTDIR=${objroot}/test/Programs/$EXTRATESTSUBDIR +EXTRATESTDIR=${objroot}/projects/llvm-test/$EXTRATESTSUBDIR # sanity check arguments if [ "$action" = "list" ]; then echo "" @@ -101,14 +104,14 @@ *) ucname=`echo $benchmk | perl -pe '$_ = ucfirst lc $_;'` SUBDIR=$EXTRATESTSUBDIR/$ucname - if [ ! -d $objroot/test/Programs/$SUBDIR ] + if [ ! -d $objroot/projects/llvm-test/$SUBDIR ] then die "Error: Unknown benchmark $benchmk" fi ;; esac echo "Starting ${action} on $benchmk" -fullsubdirpath="${objroot}/test/Programs/${SUBDIR}" +fullsubdirpath="${objroot}/projects/llvm-test/${SUBDIR}" do_debug () { cd $fullsubdirpath @@ -144,9 +147,9 @@ # note: SPEC Sandbox.sh does NOT play nice with our debug output! LLVM_REOPT='--enable-trace-opt' export LLVM_REOPT - exec gmake SUBDIR=$SUBDIR SPECTEST=1 RUNTIMELIMIT=900 + exec gmake SUBDIR=$SUBDIR SPECTEST=1 RUNTIMELIMIT=900 $MKOPTS else - exec gmake SUBDIR=$SUBDIR RUNTIMELIMIT=900 + exec gmake SUBDIR=$SUBDIR RUNTIMELIMIT=900 $MKOPTS fi } From lattner at cs.uiuc.edu Thu Sep 23 16:43:02 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 23 Sep 2004 16:43:02 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/InstCombine/and.ll Message-ID: <200409232143.QAA19516@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/InstCombine: and.ll updated: 1.19 -> 1.20 --- Log message: New testcase for a pattern that occurs 20 times in perlbmk --- Diffs of the changes: (+6 -0) Index: llvm/test/Regression/Transforms/InstCombine/and.ll diff -u llvm/test/Regression/Transforms/InstCombine/and.ll:1.19 llvm/test/Regression/Transforms/InstCombine/and.ll:1.20 --- llvm/test/Regression/Transforms/InstCombine/and.ll:1.19 Fri Jun 18 01:07:17 2004 +++ llvm/test/Regression/Transforms/InstCombine/and.ll Thu Sep 23 16:42:49 2004 @@ -113,3 +113,9 @@ ret sbyte %D } +bool %test18(int %A) { + %B = and int %A, -128 + %C = setne int %B, 0 ;; C >= 128 + ret bool %C +} + From lattner at cs.uiuc.edu Thu Sep 23 16:46:51 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 23 Sep 2004 16:46:51 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200409232146.QAA19772@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.246 -> 1.247 --- Log message: Implement Transforms/InstCombine/and.ll:test18, a case that occurs 20 times in perlbmk --- Diffs of the changes: (+45 -0) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.246 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.247 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.246 Thu Sep 23 10:46:00 2004 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Thu Sep 23 16:46:38 2004 @@ -897,6 +897,32 @@ return V && (V & (V-1)) == 0; } +#if 0 // Currently unused +// isLowOnes - Return true if the constant is of the form 0+1+. +static bool isLowOnes(const ConstantInt *CI) { + uint64_t V = CI->getRawValue(); + + // There won't be bits set in parts that the type doesn't contain. + V &= ConstantInt::getAllOnesValue(CI->getType())->getRawValue(); + + uint64_t U = V+1; // If it is low ones, this should be a power of two. + return U && V && (U & V) == 0; +} +#endif + +// isHighOnes - Return true if the constant is of the form 1+0+. +// This is the same as lowones(~X). +static bool isHighOnes(const ConstantInt *CI) { + uint64_t V = ~CI->getRawValue(); + + // There won't be bits set in parts that the type doesn't contain. + V &= ConstantInt::getAllOnesValue(CI->getType())->getRawValue(); + + uint64_t U = V+1; // If it is low ones, this should be a power of two. + return U && V && (U & V) == 0; +} + + /// getSetCondCode - Encode a setcc opcode into a three bit mask. These bits /// are carefully arranged to allow folding of expressions such as: /// @@ -1620,6 +1646,25 @@ Instruction::SetGE, X, Constant::getNullValue(X->getType())); } + + // ((X & ~7) == 0) --> X < 7 + if (CI->isNullValue() && isHighOnes(BOC)) { + Value *X = BO->getOperand(0); + Constant *NotX = ConstantExpr::getNot(BOC); + + // If 'X' is signed, insert a cast now. + if (!NotX->getType()->isSigned()) { + const Type *DestTy = NotX->getType()->getUnsignedVersion(); + CastInst *NewCI = new CastInst(X, DestTy, X->getName()+".uns"); + InsertNewInstBefore(NewCI, I); + X = NewCI; + NotX = ConstantExpr::getCast(NotX, DestTy); + } + + return new SetCondInst(isSetNE ? Instruction::SetGE : + Instruction::SetLT, X, NotX); + } + } default: break; } From lattner at cs.uiuc.edu Thu Sep 23 16:53:04 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 23 Sep 2004 16:53:04 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200409232153.QAA19899@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.247 -> 1.248 --- Log message: Move LHSI->hasOneUse() into the arms of the conditional, reindenting code. No functionality changes here. --- Diffs of the changes: (+72 -71) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.247 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.248 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.247 Thu Sep 23 16:46:38 2004 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Thu Sep 23 16:52:49 2004 @@ -1451,76 +1451,76 @@ // can be folded into the comparison. if (ConstantInt *CI = dyn_cast(Op1)) { if (Instruction *LHSI = dyn_cast(Op0)) - if (LHSI->hasOneUse()) - switch (LHSI->getOpcode()) { - case Instruction::And: - if (isa(LHSI->getOperand(1)) && - LHSI->getOperand(0)->hasOneUse()) { - // If this is: (X >> C1) & C2 != C3 (where any shift and any compare - // could exist), turn it into (X & (C2 << C1)) != (C3 << C1). This - // happens a LOT in code produced by the C front-end, for bitfield - // access. - ShiftInst *Shift = dyn_cast(LHSI->getOperand(0)); - ConstantUInt *ShAmt; - ShAmt = Shift ? dyn_cast(Shift->getOperand(1)) : 0; - ConstantInt *AndCST = cast(LHSI->getOperand(1)); - const Type *Ty = LHSI->getType(); - - // We can fold this as long as we can't shift unknown bits - // into the mask. This can only happen with signed shift - // rights, as they sign-extend. - if (ShAmt) { - bool CanFold = Shift->getOpcode() != Instruction::Shr || - Shift->getType()->isUnsigned(); - if (!CanFold) { - // To test for the bad case of the signed shr, see if any - // of the bits shifted in could be tested after the mask. - Constant *OShAmt = ConstantUInt::get(Type::UByteTy, + switch (LHSI->getOpcode()) { + case Instruction::And: + if (LHSI->hasOneUse() && isa(LHSI->getOperand(1)) && + LHSI->getOperand(0)->hasOneUse()) { + // If this is: (X >> C1) & C2 != C3 (where any shift and any compare + // could exist), turn it into (X & (C2 << C1)) != (C3 << C1). This + // happens a LOT in code produced by the C front-end, for bitfield + // access. + ShiftInst *Shift = dyn_cast(LHSI->getOperand(0)); + ConstantUInt *ShAmt; + ShAmt = Shift ? dyn_cast(Shift->getOperand(1)) : 0; + ConstantInt *AndCST = cast(LHSI->getOperand(1)); + const Type *Ty = LHSI->getType(); + + // We can fold this as long as we can't shift unknown bits + // into the mask. This can only happen with signed shift + // rights, as they sign-extend. + if (ShAmt) { + bool CanFold = Shift->getOpcode() != Instruction::Shr || + Shift->getType()->isUnsigned(); + if (!CanFold) { + // To test for the bad case of the signed shr, see if any + // of the bits shifted in could be tested after the mask. + Constant *OShAmt = ConstantUInt::get(Type::UByteTy, Ty->getPrimitiveSize()*8-ShAmt->getValue()); - Constant *ShVal = - ConstantExpr::getShl(ConstantInt::getAllOnesValue(Ty), OShAmt); - if (ConstantExpr::getAnd(ShVal, AndCST)->isNullValue()) - CanFold = true; - } - - if (CanFold) { - unsigned ShiftOp = Shift->getOpcode() == Instruction::Shl - ? Instruction::Shr : Instruction::Shl; - Constant *NewCst = ConstantExpr::get(ShiftOp, CI, ShAmt); - - // Check to see if we are shifting out any of the bits being - // compared. - if (ConstantExpr::get(Shift->getOpcode(), NewCst, ShAmt) != CI){ - // If we shifted bits out, the fold is not going to work out. - // As a special case, check to see if this means that the - // result is always true or false now. - if (I.getOpcode() == Instruction::SetEQ) - return ReplaceInstUsesWith(I, ConstantBool::False); - if (I.getOpcode() == Instruction::SetNE) - return ReplaceInstUsesWith(I, ConstantBool::True); - } else { - I.setOperand(1, NewCst); - LHSI->setOperand(1, ConstantExpr::get(ShiftOp, AndCST,ShAmt)); - LHSI->setOperand(0, Shift->getOperand(0)); - WorkList.push_back(Shift); // Shift is dead. - AddUsesToWorkList(I); - return &I; - } + Constant *ShVal = + ConstantExpr::getShl(ConstantInt::getAllOnesValue(Ty), OShAmt); + if (ConstantExpr::getAnd(ShVal, AndCST)->isNullValue()) + CanFold = true; + } + + if (CanFold) { + unsigned ShiftOp = Shift->getOpcode() == Instruction::Shl + ? Instruction::Shr : Instruction::Shl; + Constant *NewCst = ConstantExpr::get(ShiftOp, CI, ShAmt); + + // Check to see if we are shifting out any of the bits being + // compared. + if (ConstantExpr::get(Shift->getOpcode(), NewCst, ShAmt) != CI){ + // If we shifted bits out, the fold is not going to work out. + // As a special case, check to see if this means that the + // result is always true or false now. + if (I.getOpcode() == Instruction::SetEQ) + return ReplaceInstUsesWith(I, ConstantBool::False); + if (I.getOpcode() == Instruction::SetNE) + return ReplaceInstUsesWith(I, ConstantBool::True); + } else { + I.setOperand(1, NewCst); + LHSI->setOperand(1, ConstantExpr::get(ShiftOp, AndCST,ShAmt)); + LHSI->setOperand(0, Shift->getOperand(0)); + WorkList.push_back(Shift); // Shift is dead. + AddUsesToWorkList(I); + return &I; } } } - break; - case Instruction::Div: - if (0 && isa(LHSI->getOperand(1))) { - std::cerr << "COULD FOLD: " << *LHSI; - std::cerr << "COULD FOLD: " << I << "\n"; - } - break; - case Instruction::Select: - // If either operand of the select is a constant, we can fold the - // comparison into the select arms, which will cause one to be - // constant folded and the select turned into a bitwise or. - Value *Op1 = 0, *Op2 = 0; + } + break; + case Instruction::Div: + if (0 && isa(LHSI->getOperand(1))) { + std::cerr << "COULD FOLD: " << *LHSI; + std::cerr << "COULD FOLD: " << I << "\n"; + } + break; + case Instruction::Select: + // If either operand of the select is a constant, we can fold the + // comparison into the select arms, which will cause one to be + // constant folded and the select turned into a bitwise or. + Value *Op1 = 0, *Op2 = 0; + if (LHSI->hasOneUse()) { if (Constant *C = dyn_cast(LHSI->getOperand(1))) { // Fold the known value into the constant operand. Op1 = ConstantExpr::get(I.getOpcode(), C, CI); @@ -1536,12 +1536,13 @@ LHSI->getOperand(1), CI, I.getName()), I); } - - if (Op1) - return new SelectInst(LHSI->getOperand(0), Op1, Op2); - break; } - + + if (Op1) + return new SelectInst(LHSI->getOperand(0), Op1, Op2); + break; + } + // Simplify seteq and setne instructions... if (I.getOpcode() == Instruction::SetEQ || I.getOpcode() == Instruction::SetNE) { From criswell at cs.uiuc.edu Fri Sep 24 08:29:08 2004 From: criswell at cs.uiuc.edu (John Criswell) Date: Fri, 24 Sep 2004 08:29:08 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Support/DataTypes.h.in Message-ID: <200409241329.IAA25913@choi.cs.uiuc.edu> Changes in directory llvm/include/llvm/Support: DataTypes.h.in updated: 1.9 -> 1.10 --- Log message: Configure Datatypes.h.in with AC_CONFIG_HEADERS. This should prevent it from being re-generated if the new version is identical to the old version. Hence, it should save us some recompiling after re-configures. --- Diffs of the changes: (+15 -3) Index: llvm/include/llvm/Support/DataTypes.h.in diff -u llvm/include/llvm/Support/DataTypes.h.in:1.9 llvm/include/llvm/Support/DataTypes.h.in:1.10 --- llvm/include/llvm/Support/DataTypes.h.in:1.9 Fri Sep 3 14:46:43 2004 +++ llvm/include/llvm/Support/DataTypes.h.in Fri Sep 24 08:28:49 2004 @@ -31,11 +31,23 @@ # error "Must #define __STDC_LIMIT_MACROS before #including Support/DataTypes.h" #endif +#undef HAVE_SYS_TYPES_H +#undef HAVE_INTTYPES_H +#undef HAVE_STDINT_H + #ifndef _MSC_VER // Note that includes , if this is a C99 system. - at INCLUDE_INTTYPES_H@ - at INCLUDE_SYS_TYPES_H@ - at INCLUDE_STDINT_H@ +#ifdef HAVE_SYS_TYPES_H +#include +#endif + +#ifdef HAVE_INTTYPES_H +#include +#endif + +#ifdef HAVE_STDINT_H +#include +#endif // Handle incorrect definition of uint64_t as u_int64_t #ifndef HAVE_UINT64_T From criswell at cs.uiuc.edu Fri Sep 24 08:29:08 2004 From: criswell at cs.uiuc.edu (John Criswell) Date: Fri, 24 Sep 2004 08:29:08 -0500 Subject: [llvm-commits] CVS: llvm/autoconf/configure.ac Message-ID: <200409241329.IAA25911@choi.cs.uiuc.edu> Changes in directory llvm/autoconf: configure.ac updated: 1.115 -> 1.116 --- Log message: Configure Datatypes.h.in with AC_CONFIG_HEADERS. This should prevent it from being re-generated if the new version is identical to the old version. Hence, it should save us some recompiling after re-configures. --- Diffs of the changes: (+4 -14) Index: llvm/autoconf/configure.ac diff -u llvm/autoconf/configure.ac:1.115 llvm/autoconf/configure.ac:1.116 --- llvm/autoconf/configure.ac:1.115 Tue Sep 21 12:12:35 2004 +++ llvm/autoconf/configure.ac Fri Sep 24 08:28:51 2004 @@ -43,11 +43,11 @@ dnl Configure other output file AC_CONFIG_FILES(Makefile.config - include/llvm/Support/DataTypes.h include/llvm/Support/ThreadSupport.h include/llvm/ADT/hash_map include/llvm/ADT/hash_set include/llvm/ADT/iterator) +AC_CONFIG_HEADERS([include/llvm/Support/DataTypes.h]) dnl Do special configuration of Makefiles AC_CONFIG_MAKEFILE(Makefile) @@ -270,19 +270,9 @@ dnl Check for things that need to be included in public headers, and so dnl for which we may not have access to a HAVE_* preprocessor #define. dnl (primarily used in DataTypes.h) -AC_CHECK_HEADER([sys/types.h], - [INCLUDE_SYS_TYPES_H='#include '], - [INCLUDE_SYS_TYPES_H='']) -AC_SUBST(INCLUDE_SYS_TYPES_H) -AC_CHECK_HEADER([inttypes.h], - [INCLUDE_INTTYPES_H='#include '], - [INCLUDE_INTTYPES_H='']) -AC_SUBST(INCLUDE_INTTYPES_H) -AC_CHECK_HEADER([stdint.h], - [INCLUDE_STDINT_H='#include '], - [INCLUDE_STDINT_H='']) -AC_SUBST(INCLUDE_STDINT_H) - +AC_CHECK_HEADER([sys/types.h]) +AC_CHECK_HEADER([inttypes.h]) +AC_CHECK_HEADER([stdint.h]) dnl Check for types AC_TYPE_PID_T From criswell at cs.uiuc.edu Fri Sep 24 08:29:08 2004 From: criswell at cs.uiuc.edu (John Criswell) Date: Fri, 24 Sep 2004 08:29:08 -0500 Subject: [llvm-commits] CVS: llvm/configure Message-ID: <200409241329.IAA25912@choi.cs.uiuc.edu> Changes in directory llvm: configure updated: 1.121 -> 1.122 --- Log message: Configure Datatypes.h.in with AC_CONFIG_HEADERS. This should prevent it from being re-generated if the new version is identical to the old version. Hence, it should save us some recompiling after re-configures. --- Diffs of the changes: (+33 -53) Index: llvm/configure diff -u llvm/configure:1.121 llvm/configure:1.122 --- llvm/configure:1.121 Tue Sep 21 12:14:44 2004 +++ llvm/configure Fri Sep 24 08:28:46 2004 @@ -473,7 +473,7 @@ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS subdirs INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os OS LLVMGCCDIR ARCH CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT CC CFLAGS ac_ct_CC CPP ifGNUmake LEX LEXLIB LEX_OUTPUT_ROOT FLEX YACC BISON EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL DOT ETAGS ETAGSFLAGS PYTHON QMTEST HAVE_PTHREAD_MUTEX_LOCK INCLUDE_SYS_TYPES_H INCLUDE_INTTYPES_H INCLUDE_STDINT_H ENDIAN HAVE_STD_EXT_HASH_MAP HAVE_GNU_EXT_HASH_MAP HAVE_GLOBAL_HASH_MAP HAVE_STD_EXT_HASH_SET HAVE_GNU_EXT_HASH_! SET HAVE_GLOBAL_HASH_SET HAVE_STD_ITERATOR HAVE_BI_ITERATOR HAVE_FWD_ITERATOR ALLOCA MMAP_FILE ENABLE_OPTIMIZED JIT LLVMCC1 LLVMCC1PLUS SHLIBEXT LLVM_PREFIX LLVM_BINDIR LLVM_LIBDIR LLVM_DATADIR LLVM_DOCSDIR LLVM_ETCDIR LLVM_INCLUDEDIR LLVM_INFODIR LLVM_MANDIR LLVM_CONFIGTIME LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS subdirs INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os OS LLVMGCCDIR ARCH CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT CC CFLAGS ac_ct_CC CPP ifGNUmake LEX LEXLIB LEX_OUTPUT_ROOT FLEX YACC BISON EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL DOT ETAGS ETAGSFLAGS PYTHON QMTEST HAVE_PTHREAD_MUTEX_LOCK ENDIAN HAVE_STD_EXT_HASH_MAP HAVE_GNU_EXT_HASH_MAP HAVE_GLOBAL_HASH_MAP HAVE_STD_EXT_HASH_SET HAVE_GNU_EXT_HASH_SET HAVE_GLOBAL_HASH_SET HAVE_STD_ITERATOR HAVE_BI_ITERA! TOR HAVE_FWD_ITERATOR ALLOCA MMAP_FILE ENABLE_OPTIMIZED JIT LLVMCC1 LLVMCC1PLUS SHLIBEXT LLVM_PREFIX LLVM_BINDIR LLVM_LIBDIR LLVM_DATADIR LLVM_DOCSDIR LLVM_ETCDIR LLVM_INCLUDEDIR LLVM_INFODIR LLVM_MANDIR LLVM_CONFIGTIME LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -1598,7 +1598,9 @@ ac_config_headers="$ac_config_headers include/llvm/Config/config.h" - ac_config_files="$ac_config_files Makefile.config include/llvm/Support/DataTypes.h include/llvm/Support/ThreadSupport.h include/llvm/ADT/hash_map include/llvm/ADT/hash_set include/llvm/ADT/iterator" + ac_config_files="$ac_config_files Makefile.config include/llvm/Support/ThreadSupport.h include/llvm/ADT/hash_map include/llvm/ADT/hash_set include/llvm/ADT/iterator" + + ac_config_headers="$ac_config_headers include/llvm/Support/DataTypes.h" ac_config_commands="$ac_config_commands Makefile" @@ -4170,7 +4172,7 @@ ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 4173 "configure"' > conftest.$ac_ext + echo '#line 4175 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -5051,7 +5053,7 @@ # Provide some information about the compiler. -echo "$as_me:5054:" \ +echo "$as_me:5056:" \ "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 @@ -6108,11 +6110,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6111: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6113: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6115: \$? = $ac_status" >&5 + echo "$as_me:6117: \$? = $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 @@ -6351,11 +6353,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6354: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6356: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6358: \$? = $ac_status" >&5 + echo "$as_me:6360: \$? = $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 @@ -6411,11 +6413,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6414: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6416: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:6418: \$? = $ac_status" >&5 + echo "$as_me:6420: \$? = $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 @@ -8588,7 +8590,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:10877: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:10879: \$? = $ac_status" >&5 + echo "$as_me:10881: \$? = $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 @@ -10932,11 +10934,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:10935: $lt_compile\"" >&5) + (eval echo "\"\$as_me:10937: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:10939: \$? = $ac_status" >&5 + echo "$as_me:10941: \$? = $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 @@ -12293,7 +12295,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:13233: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13235: \$? = $ac_status" >&5 + echo "$as_me:13237: \$? = $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 @@ -13288,11 +13290,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13291: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13293: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13295: \$? = $ac_status" >&5 + echo "$as_me:13297: \$? = $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 @@ -15319,11 +15321,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15322: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15324: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15326: \$? = $ac_status" >&5 + echo "$as_me:15328: \$? = $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 @@ -15562,11 +15564,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15565: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15567: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15569: \$? = $ac_status" >&5 + echo "$as_me:15571: \$? = $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 @@ -15622,11 +15624,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15625: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15627: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:15629: \$? = $ac_status" >&5 + echo "$as_me:15631: \$? = $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 @@ -17799,7 +17801,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&6 fi -if test $ac_cv_header_sys_types_h = yes; then - INCLUDE_SYS_TYPES_H='#include ' -else - INCLUDE_SYS_TYPES_H='' -fi - if test "${ac_cv_header_inttypes_h+set}" = set; then @@ -20265,12 +20261,6 @@ echo "${ECHO_T}$ac_cv_header_inttypes_h" >&6 fi -if test $ac_cv_header_inttypes_h = yes; then - INCLUDE_INTTYPES_H='#include ' -else - INCLUDE_INTTYPES_H='' -fi - if test "${ac_cv_header_stdint_h+set}" = set; then @@ -20410,13 +20400,6 @@ echo "${ECHO_T}$ac_cv_header_stdint_h" >&6 fi -if test $ac_cv_header_stdint_h = yes; then - INCLUDE_STDINT_H='#include ' -else - INCLUDE_STDINT_H='' -fi - - @@ -24455,7 +24438,6 @@ case "$ac_config_target" in # Handling of arguments. "Makefile.config" ) CONFIG_FILES="$CONFIG_FILES Makefile.config" ;; - "include/llvm/Support/DataTypes.h" ) CONFIG_FILES="$CONFIG_FILES include/llvm/Support/DataTypes.h" ;; "include/llvm/Support/ThreadSupport.h" ) CONFIG_FILES="$CONFIG_FILES include/llvm/Support/ThreadSupport.h" ;; "include/llvm/ADT/hash_map" ) CONFIG_FILES="$CONFIG_FILES include/llvm/ADT/hash_map" ;; "include/llvm/ADT/hash_set" ) CONFIG_FILES="$CONFIG_FILES include/llvm/ADT/hash_set" ;; @@ -24474,6 +24456,7 @@ "utils/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS utils/Makefile" ;; "projects/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS projects/Makefile" ;; "include/llvm/Config/config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS include/llvm/Config/config.h" ;; + "include/llvm/Support/DataTypes.h" ) CONFIG_HEADERS="$CONFIG_HEADERS include/llvm/Support/DataTypes.h" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; @@ -24617,9 +24600,6 @@ s, at PYTHON@,$PYTHON,;t t s, at QMTEST@,$QMTEST,;t t s, at HAVE_PTHREAD_MUTEX_LOCK@,$HAVE_PTHREAD_MUTEX_LOCK,;t t -s, at INCLUDE_SYS_TYPES_H@,$INCLUDE_SYS_TYPES_H,;t t -s, at INCLUDE_INTTYPES_H@,$INCLUDE_INTTYPES_H,;t t -s, at INCLUDE_STDINT_H@,$INCLUDE_STDINT_H,;t t s, at ENDIAN@,$ENDIAN,;t t s, at HAVE_STD_EXT_HASH_MAP@,$HAVE_STD_EXT_HASH_MAP,;t t s, at HAVE_GNU_EXT_HASH_MAP@,$HAVE_GNU_EXT_HASH_MAP,;t t From lattner at cs.uiuc.edu Fri Sep 24 10:18:56 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 24 Sep 2004 10:18:56 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/InstCombine/and.ll Message-ID: <200409241518.KAA28307@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/InstCombine: and.ll updated: 1.20 -> 1.21 --- Log message: Add some tests for shr-and folding --- Diffs of the changes: (+17 -0) Index: llvm/test/Regression/Transforms/InstCombine/and.ll diff -u llvm/test/Regression/Transforms/InstCombine/and.ll:1.20 llvm/test/Regression/Transforms/InstCombine/and.ll:1.21 --- llvm/test/Regression/Transforms/InstCombine/and.ll:1.20 Thu Sep 23 16:42:49 2004 +++ llvm/test/Regression/Transforms/InstCombine/and.ll Fri Sep 24 10:18:43 2004 @@ -119,3 +119,20 @@ ret bool %C } +int %test19(int %A) { + %B = shl int %A, ubyte 3 + %C = and int %B, -2 ;; Clearing a zero bit + ret int %C +} + +ubyte %test20(ubyte %A) { + %C = shr ubyte %A, ubyte 7 + %D = and ubyte %C, 1 ;; Unneeded + ret ubyte %D +} + +sbyte %test21(sbyte %A) { + %C = shr sbyte %A, ubyte 7 ;; sign extend + %D = and sbyte %C, 1 ;; chop off sign + ret sbyte %D +} From lattner at cs.uiuc.edu Fri Sep 24 10:21:47 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 24 Sep 2004 10:21:47 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200409241521.KAA28836@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.248 -> 1.249 --- Log message: Implement shift-and combinations, implementing InstCombine/and.ll:test19-21 These combinations trigger 4 times in povray, 7x in gcc, 4x in gap, and 2x in bzip2. --- Diffs of the changes: (+44 -7) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.248 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.249 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.248 Thu Sep 23 16:52:49 2004 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Fri Sep 24 10:21:34 2004 @@ -146,6 +146,17 @@ return New; } + /// InsertCastBefore - Insert a cast of V to TY before the instruction POS. + /// This also adds the cast to the worklist. Finally, this returns the + /// cast. + Value *InsertCastBefore(Value *V, const Type *Ty, Instruction &Pos) { + if (V->getType() == Ty) return V; + + Instruction *C = new CastInst(V, Ty, V->getName(), &Pos); + WorkList.push_back(C); + return C; + } + // ReplaceInstUsesWith - This method is to be used when an instruction is // found to be dead, replacable with another preexisting expression. Here // we add all uses of I to the worklist, replace all uses of I with the new @@ -1088,9 +1099,12 @@ // the anded constant includes them, clear them now! // Constant *AllOne = ConstantIntegral::getAllOnesValue(AndRHS->getType()); - Constant *CI = ConstantExpr::getAnd(AndRHS, - ConstantExpr::getShl(AllOne, OpRHS)); - if (CI != AndRHS) { + Constant *ShlMask = ConstantExpr::getShl(AllOne, OpRHS); + Constant *CI = ConstantExpr::getAnd(AndRHS, ShlMask); + + if (CI == ShlMask) { // Masking out bits that the shift already masks + return ReplaceInstUsesWith(TheAnd, Op); // No need for the and. + } else if (CI != AndRHS) { // Reducing bits set in and. TheAnd.setOperand(1, CI); return &TheAnd; } @@ -1103,12 +1117,34 @@ // if (AndRHS->getType()->isUnsigned()) { Constant *AllOne = ConstantIntegral::getAllOnesValue(AndRHS->getType()); - Constant *CI = ConstantExpr::getAnd(AndRHS, - ConstantExpr::getShr(AllOne, OpRHS)); - if (CI != AndRHS) { - TheAnd.setOperand(1, CI); + Constant *ShrMask = ConstantExpr::getShr(AllOne, OpRHS); + Constant *CI = ConstantExpr::getAnd(AndRHS, ShrMask); + + if (CI == ShrMask) { // Masking out bits that the shift already masks. + return ReplaceInstUsesWith(TheAnd, Op); + } else if (CI != AndRHS) { + TheAnd.setOperand(1, CI); // Reduce bits set in and cst. return &TheAnd; } + } else { // Signed shr. + // See if this is shifting in some sign extension, then masking it out + // with an and. + if (Op->hasOneUse()) { + Constant *AllOne = ConstantIntegral::getAllOnesValue(AndRHS->getType()); + Constant *ShrMask = ConstantExpr::getUShr(AllOne, OpRHS); + Constant *CI = ConstantExpr::getAnd(AndRHS, ShrMask); + if (CI == ShrMask) { // Masking out bits shifted in. + // Make the argument unsigned. + Value *ShVal = Op->getOperand(0); + ShVal = InsertCastBefore(ShVal, + ShVal->getType()->getUnsignedVersion(), + TheAnd); + ShVal = InsertNewInstBefore(new ShiftInst(Instruction::Shr, ShVal, + OpRHS, Op->getName()), + TheAnd); + return new CastInst(ShVal, Op->getType()); + } + } } break; } @@ -1509,6 +1545,7 @@ } } break; + case Instruction::Div: if (0 && isa(LHSI->getOperand(1))) { std::cerr << "COULD FOLD: " << *LHSI; From criswell at cs.uiuc.edu Fri Sep 24 13:28:08 2004 From: criswell at cs.uiuc.edu (John Criswell) Date: Fri, 24 Sep 2004 13:28:08 -0500 Subject: [llvm-commits] CVS: llvm/configure Message-ID: <200409241828.NAA29554@choi.cs.uiuc.edu> Changes in directory llvm: configure updated: 1.122 -> 1.123 --- Log message: Modified hash_map and hash_set configuration so that they are not regenerated on every run of configure. --- Diffs of the changes: (+102 -50) Index: llvm/configure diff -u llvm/configure:1.122 llvm/configure:1.123 --- llvm/configure:1.122 Fri Sep 24 08:28:46 2004 +++ llvm/configure Fri Sep 24 13:27:54 2004 @@ -473,7 +473,7 @@ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS subdirs INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os OS LLVMGCCDIR ARCH CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT CC CFLAGS ac_ct_CC CPP ifGNUmake LEX LEXLIB LEX_OUTPUT_ROOT FLEX YACC BISON EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL DOT ETAGS ETAGSFLAGS PYTHON QMTEST HAVE_PTHREAD_MUTEX_LOCK ENDIAN HAVE_STD_EXT_HASH_MAP HAVE_GNU_EXT_HASH_MAP HAVE_GLOBAL_HASH_MAP HAVE_STD_EXT_HASH_SET HAVE_GNU_EXT_HASH_SET HAVE_GLOBAL_HASH_SET HAVE_STD_ITERATOR HAVE_BI_ITERA! TOR HAVE_FWD_ITERATOR ALLOCA MMAP_FILE ENABLE_OPTIMIZED JIT LLVMCC1 LLVMCC1PLUS SHLIBEXT LLVM_PREFIX LLVM_BINDIR LLVM_LIBDIR LLVM_DATADIR LLVM_DOCSDIR LLVM_ETCDIR LLVM_INCLUDEDIR LLVM_INFODIR LLVM_MANDIR LLVM_CONFIGTIME LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS subdirs INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os OS LLVMGCCDIR ARCH CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT CC CFLAGS ac_ct_CC CPP ifGNUmake LEX LEXLIB LEX_OUTPUT_ROOT FLEX YACC BISON EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL DOT ETAGS ETAGSFLAGS PYTHON QMTEST HAVE_PTHREAD_MUTEX_LOCK ENDIAN HAVE_STD_ITERATOR HAVE_BI_ITERATOR HAVE_FWD_ITERATOR ALLOCA MMAP_FILE ENABLE_OPTIMIZED JIT LLVMCC1 LLVMCC1PLUS SHLIBEXT LLVM_PREFIX LLVM_BINDIR LLVM_LIBDIR LLVM_! DATADIR LLVM_DOCSDIR LLVM_ETCDIR LLVM_INCLUDEDIR LLVM_INFODIR LLVM_MANDIR LLVM_CONFIGTIME LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -1598,10 +1598,14 @@ ac_config_headers="$ac_config_headers include/llvm/Config/config.h" - ac_config_files="$ac_config_files Makefile.config include/llvm/Support/ThreadSupport.h include/llvm/ADT/hash_map include/llvm/ADT/hash_set include/llvm/ADT/iterator" + ac_config_files="$ac_config_files Makefile.config include/llvm/Support/ThreadSupport.h include/llvm/ADT/iterator" ac_config_headers="$ac_config_headers include/llvm/Support/DataTypes.h" + ac_config_headers="$ac_config_headers include/llvm/ADT/hash_map" + + ac_config_headers="$ac_config_headers include/llvm/ADT/hash_set" + ac_config_commands="$ac_config_commands Makefile" @@ -4172,7 +4176,7 @@ ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 4175 "configure"' > conftest.$ac_ext + echo '#line 4179 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -5053,7 +5057,7 @@ # Provide some information about the compiler. -echo "$as_me:5056:" \ +echo "$as_me:5060:" \ "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 @@ -6110,11 +6114,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6113: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6117: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6117: \$? = $ac_status" >&5 + echo "$as_me:6121: \$? = $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 @@ -6353,11 +6357,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6356: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6360: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6360: \$? = $ac_status" >&5 + echo "$as_me:6364: \$? = $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 @@ -6413,11 +6417,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6416: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6420: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:6420: \$? = $ac_status" >&5 + echo "$as_me:6424: \$? = $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 @@ -8590,7 +8594,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:10881: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:10881: \$? = $ac_status" >&5 + echo "$as_me:10885: \$? = $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 @@ -10934,11 +10938,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:10937: $lt_compile\"" >&5) + (eval echo "\"\$as_me:10941: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:10941: \$? = $ac_status" >&5 + echo "$as_me:10945: \$? = $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 @@ -12295,7 +12299,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:13237: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13237: \$? = $ac_status" >&5 + echo "$as_me:13241: \$? = $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 @@ -13290,11 +13294,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13293: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13297: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13297: \$? = $ac_status" >&5 + echo "$as_me:13301: \$? = $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 @@ -15321,11 +15325,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15324: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15328: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15328: \$? = $ac_status" >&5 + echo "$as_me:15332: \$? = $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 @@ -15564,11 +15568,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15567: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15571: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15571: \$? = $ac_status" >&5 + echo "$as_me:15575: \$? = $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 @@ -15624,11 +15628,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15627: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15631: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:15631: \$? = $ac_status" >&5 + echo "$as_me:15635: \$? = $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 @@ -17801,7 +17805,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5 echo "${ECHO_T}$ac_cv_cxx_have_std_ext_hash_map" >&6 - HAVE_STD_EXT_HASH_MAP=0 if test "$ac_cv_cxx_have_std_ext_hash_map" = yes then - HAVE_STD_EXT_HASH_MAP=1 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_STD_EXT_HASH_MAP 1 +_ACEOF + + else + +cat >>confdefs.h <<\_ACEOF +#define HAVE_STD_EXT_HASH_MAP 0 +_ACEOF + fi echo "$as_me:$LINENO: checking whether the compiler has defining template class __gnu_cxx::hash_map" >&5 @@ -21396,10 +21409,19 @@ fi echo "$as_me:$LINENO: result: $ac_cv_cxx_have_gnu_ext_hash_map" >&5 echo "${ECHO_T}$ac_cv_cxx_have_gnu_ext_hash_map" >&6 - HAVE_GNU_EXT_HASH_MAP=0 if test "$ac_cv_cxx_have_gnu_ext_hash_map" = yes then - HAVE_GNU_EXT_HASH_MAP=1 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_GNU_EXT_HASH_MAP 1 +_ACEOF + + else + +cat >>confdefs.h <<\_ACEOF +#define HAVE_GNU_EXT_HASH_MAP 0 +_ACEOF + fi echo "$as_me:$LINENO: checking whether the compiler has defining template class ::hash_map" >&5 @@ -21468,10 +21490,19 @@ fi echo "$as_me:$LINENO: result: $ac_cv_cxx_have_global_hash_map" >&5 echo "${ECHO_T}$ac_cv_cxx_have_global_hash_map" >&6 - HAVE_GLOBAL_HASH_MAP=0 if test "$ac_cv_cxx_have_global_hash_map" = yes then - HAVE_GLOBAL_HASH_MAP=1 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_GLOBAL_HASH_MAP 1 +_ACEOF + + else + +cat >>confdefs.h <<\_ACEOF +#define HAVE_GLOBAL_HASH_MAP 0 +_ACEOF + fi echo "$as_me:$LINENO: checking whether the compiler has defining template class std::hash_set" >&5 @@ -21543,10 +21574,19 @@ fi echo "$as_me:$LINENO: result: $ac_cv_cxx_have_std_ext_hash_set" >&5 echo "${ECHO_T}$ac_cv_cxx_have_std_ext_hash_set" >&6 - HAVE_STD_EXT_HASH_SET=0 if test "$ac_cv_cxx_have_std_ext_hash_set" = yes then - HAVE_STD_EXT_HASH_SET=1 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_STD_EXT_HASH_SET 1 +_ACEOF + + else + +cat >>confdefs.h <<\_ACEOF +#define HAVE_STD_EXT_HASH_SET 0 +_ACEOF + fi echo "$as_me:$LINENO: checking whether the compiler has defining template class __gnu_cxx::hash_set" >&5 @@ -21618,10 +21658,19 @@ fi echo "$as_me:$LINENO: result: $ac_cv_cxx_have_gnu_ext_hash_set" >&5 echo "${ECHO_T}$ac_cv_cxx_have_gnu_ext_hash_set" >&6 - HAVE_GNU_EXT_HASH_SET=0 if test "$ac_cv_cxx_have_gnu_ext_hash_set" = yes then - HAVE_GNU_EXT_HASH_SET=1 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_GNU_EXT_HASH_SET 1 +_ACEOF + + else + +cat >>confdefs.h <<\_ACEOF +#define HAVE_GNU_EXT_HASH_SET 0 +_ACEOF + fi echo "$as_me:$LINENO: checking whether the compiler has defining template class ::hash_set" >&5 @@ -21690,10 +21739,19 @@ fi echo "$as_me:$LINENO: result: $ac_cv_cxx_have_global_hash_set" >&5 echo "${ECHO_T}$ac_cv_cxx_have_global_hash_set" >&6 - HAVE_GLOBAL_HASH_SET=0 if test "$ac_cv_cxx_have_global_hash_set" = yes then - HAVE_GLOBAL_HASH_SET=1 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_GLOBAL_HASH_SET 1 +_ACEOF + + else + +cat >>confdefs.h <<\_ACEOF +#define HAVE_GLOBAL_HASH_SET 0 +_ACEOF + fi echo "$as_me:$LINENO: checking whether the compiler has the standard iterator" >&5 @@ -24439,8 +24497,6 @@ # Handling of arguments. "Makefile.config" ) CONFIG_FILES="$CONFIG_FILES Makefile.config" ;; "include/llvm/Support/ThreadSupport.h" ) CONFIG_FILES="$CONFIG_FILES include/llvm/Support/ThreadSupport.h" ;; - "include/llvm/ADT/hash_map" ) CONFIG_FILES="$CONFIG_FILES include/llvm/ADT/hash_map" ;; - "include/llvm/ADT/hash_set" ) CONFIG_FILES="$CONFIG_FILES include/llvm/ADT/hash_set" ;; "include/llvm/ADT/iterator" ) CONFIG_FILES="$CONFIG_FILES include/llvm/ADT/iterator" ;; "lib/System/platform" ) CONFIG_LINKS="$CONFIG_LINKS lib/System/platform:lib/System/$platform_type" ;; "Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS Makefile" ;; @@ -24457,6 +24513,8 @@ "projects/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS projects/Makefile" ;; "include/llvm/Config/config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS include/llvm/Config/config.h" ;; "include/llvm/Support/DataTypes.h" ) CONFIG_HEADERS="$CONFIG_HEADERS include/llvm/Support/DataTypes.h" ;; + "include/llvm/ADT/hash_map" ) CONFIG_HEADERS="$CONFIG_HEADERS include/llvm/ADT/hash_map" ;; + "include/llvm/ADT/hash_set" ) CONFIG_HEADERS="$CONFIG_HEADERS include/llvm/ADT/hash_set" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; @@ -24601,12 +24659,6 @@ s, at QMTEST@,$QMTEST,;t t s, at HAVE_PTHREAD_MUTEX_LOCK@,$HAVE_PTHREAD_MUTEX_LOCK,;t t s, at ENDIAN@,$ENDIAN,;t t -s, at HAVE_STD_EXT_HASH_MAP@,$HAVE_STD_EXT_HASH_MAP,;t t -s, at HAVE_GNU_EXT_HASH_MAP@,$HAVE_GNU_EXT_HASH_MAP,;t t -s, at HAVE_GLOBAL_HASH_MAP@,$HAVE_GLOBAL_HASH_MAP,;t t -s, at HAVE_STD_EXT_HASH_SET@,$HAVE_STD_EXT_HASH_SET,;t t -s, at HAVE_GNU_EXT_HASH_SET@,$HAVE_GNU_EXT_HASH_SET,;t t -s, at HAVE_GLOBAL_HASH_SET@,$HAVE_GLOBAL_HASH_SET,;t t s, at HAVE_STD_ITERATOR@,$HAVE_STD_ITERATOR,;t t s, at HAVE_BI_ITERATOR@,$HAVE_BI_ITERATOR,;t t s, at HAVE_FWD_ITERATOR@,$HAVE_FWD_ITERATOR,;t t From criswell at cs.uiuc.edu Fri Sep 24 13:28:09 2004 From: criswell at cs.uiuc.edu (John Criswell) Date: Fri, 24 Sep 2004 13:28:09 -0500 Subject: [llvm-commits] CVS: llvm/autoconf/configure.ac Message-ID: <200409241828.NAA29558@choi.cs.uiuc.edu> Changes in directory llvm/autoconf: configure.ac updated: 1.116 -> 1.117 --- Log message: Modified hash_map and hash_set configuration so that they are not regenerated on every run of configure. --- Diffs of the changes: (+2 -2) Index: llvm/autoconf/configure.ac diff -u llvm/autoconf/configure.ac:1.116 llvm/autoconf/configure.ac:1.117 --- llvm/autoconf/configure.ac:1.116 Fri Sep 24 08:28:51 2004 +++ llvm/autoconf/configure.ac Fri Sep 24 13:27:56 2004 @@ -44,10 +44,10 @@ dnl Configure other output file AC_CONFIG_FILES(Makefile.config include/llvm/Support/ThreadSupport.h - include/llvm/ADT/hash_map - include/llvm/ADT/hash_set include/llvm/ADT/iterator) AC_CONFIG_HEADERS([include/llvm/Support/DataTypes.h]) +AC_CONFIG_HEADERS([include/llvm/ADT/hash_map]) +AC_CONFIG_HEADERS([include/llvm/ADT/hash_set]) dnl Do special configuration of Makefiles AC_CONFIG_MAKEFILE(Makefile) From criswell at cs.uiuc.edu Fri Sep 24 13:28:10 2004 From: criswell at cs.uiuc.edu (John Criswell) Date: Fri, 24 Sep 2004 13:28:10 -0500 Subject: [llvm-commits] CVS: llvm/autoconf/m4/cxx_hash_map.m4 cxx_hash_set.m4 Message-ID: <200409241828.NAA29565@choi.cs.uiuc.edu> Changes in directory llvm/autoconf/m4: cxx_hash_map.m4 updated: 1.2 -> 1.3 cxx_hash_set.m4 updated: 1.2 -> 1.3 --- Log message: Modified hash_map and hash_set configuration so that they are not regenerated on every run of configure. --- Diffs of the changes: (+24 -18) Index: llvm/autoconf/m4/cxx_hash_map.m4 diff -u llvm/autoconf/m4/cxx_hash_map.m4:1.2 llvm/autoconf/m4/cxx_hash_map.m4:1.3 --- llvm/autoconf/m4/cxx_hash_map.m4:1.2 Sun Sep 19 17:31:49 2004 +++ llvm/autoconf/m4/cxx_hash_map.m4 Fri Sep 24 13:27:58 2004 @@ -10,12 +10,13 @@ using namespace std; #endif]], [[hash_map t;]])],[ac_cv_cxx_have_std_ext_hash_map=yes],[ac_cv_cxx_have_std_ext_hash_map=no]) AC_LANG_POP([C++])]) - HAVE_STD_EXT_HASH_MAP=0 if test "$ac_cv_cxx_have_std_ext_hash_map" = yes then - HAVE_STD_EXT_HASH_MAP=1 + AC_DEFINE(HAVE_STD_EXT_HASH_MAP,1,[Have ext/hash_map>]) + else + AC_DEFINE(HAVE_STD_EXT_HASH_MAP,0,[Does not have ext/hash_map>]) fi - AC_SUBST(HAVE_STD_EXT_HASH_MAP)]) + ]) AC_DEFUN([AC_CXX_HAVE_GNU_EXT_HASH_MAP], [AC_CACHE_CHECK([whether the compiler has defining template class __gnu_cxx::hash_map], @@ -27,12 +28,13 @@ using namespace __gnu_cxx; #endif]], [[hash_map t; ]])],[ac_cv_cxx_have_gnu_ext_hash_map=yes],[ac_cv_cxx_have_gnu_ext_hash_map=no]) AC_LANG_POP([C++])]) - HAVE_GNU_EXT_HASH_MAP=0 if test "$ac_cv_cxx_have_gnu_ext_hash_map" = yes then - HAVE_GNU_EXT_HASH_MAP=1 + AC_DEFINE(HAVE_GNU_EXT_HASH_MAP,1,[Have ext/hash_map]) + else + AC_DEFINE(HAVE_GNU_EXT_HASH_MAP,0,[Does not have ext/hash_map]) fi - AC_SUBST(HAVE_GNU_EXT_HASH_MAP)]) + ]) AC_DEFUN([AC_CXX_HAVE_GLOBAL_HASH_MAP], [AC_CACHE_CHECK([whether the compiler has defining template class ::hash_map], @@ -41,12 +43,13 @@ AC_LANG_PUSH([C++]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[hash_map t; ]])],[ac_cv_cxx_have_global_hash_map=yes],[ac_cv_cxx_have_global_hash_map=no]) AC_LANG_POP([C++])]) - HAVE_GLOBAL_HASH_MAP=0 if test "$ac_cv_cxx_have_global_hash_map" = yes then - HAVE_GLOBAL_HASH_MAP=1 + AC_DEFINE(HAVE_GLOBAL_HASH_MAP,1,[Have ]) + else + AC_DEFINE(HAVE_GLOBAL_HASH_MAP,0,[Does not have ]) fi - AC_SUBST(HAVE_GLOBAL_HASH_MAP)]) + ]) AC_DEFUN([AC_CXX_HAVE_HASH_MAP], [AC_CXX_HAVE_STD_EXT_HASH_MAP Index: llvm/autoconf/m4/cxx_hash_set.m4 diff -u llvm/autoconf/m4/cxx_hash_set.m4:1.2 llvm/autoconf/m4/cxx_hash_set.m4:1.3 --- llvm/autoconf/m4/cxx_hash_set.m4:1.2 Sun Sep 19 17:31:49 2004 +++ llvm/autoconf/m4/cxx_hash_set.m4 Fri Sep 24 13:27:58 2004 @@ -10,12 +10,13 @@ using namespace std; #endif]], [[hash_set t; ]])],[ac_cv_cxx_have_std_ext_hash_set=yes],[ac_cv_cxx_have_std_ext_hash_set=no]) AC_LANG_POP([C++])]) - HAVE_STD_EXT_HASH_SET=0 if test "$ac_cv_cxx_have_std_ext_hash_set" = yes then - HAVE_STD_EXT_HASH_SET=1 + AC_DEFINE(HAVE_STD_EXT_HASH_SET,1,[Have hash_set in std namespace]) + else + AC_DEFINE(HAVE_STD_EXT_HASH_SET,0,[Does not have hash_set in std namespace]) fi - AC_SUBST(HAVE_STD_EXT_HASH_SET)]) + ]) AC_DEFUN([AC_CXX_HAVE_GNU_EXT_HASH_SET], [AC_CACHE_CHECK( @@ -28,12 +29,13 @@ using namespace __gnu_cxx; #endif]], [[hash_set t; ]])],[ac_cv_cxx_have_gnu_ext_hash_set=yes],[ac_cv_cxx_have_gnu_ext_hash_set=no]) AC_LANG_POP([C++])]) - HAVE_GNU_EXT_HASH_SET=0 if test "$ac_cv_cxx_have_gnu_ext_hash_set" = yes then - HAVE_GNU_EXT_HASH_SET=1 + AC_DEFINE(HAVE_GNU_EXT_HASH_SET,1,[Have hash_set in gnu namespace]) + else + AC_DEFINE(HAVE_GNU_EXT_HASH_SET,0,[Does not have hash_set in gnu namespace]) fi - AC_SUBST(HAVE_GNU_EXT_HASH_SET)]) + ]) AC_DEFUN([AC_CXX_HAVE_GLOBAL_HASH_SET], [AC_CACHE_CHECK([whether the compiler has defining template class ::hash_set], @@ -42,12 +44,13 @@ AC_LANG_PUSH([C++]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[hash_set t; return 0;]])],[ac_cv_cxx_have_global_hash_set=yes],[ac_cv_cxx_have_global_hash_set=no]) AC_LANG_POP([C++])]) - HAVE_GLOBAL_HASH_SET=0 if test "$ac_cv_cxx_have_global_hash_set" = yes then - HAVE_GLOBAL_HASH_SET=1 + AC_DEFINE(HAVE_GLOBAL_HASH_SET,1,[Have hash_set in global namespace]) + else + AC_DEFINE(HAVE_GLOBAL_HASH_SET,0,[Does not have hash_set in global namespace]) fi - AC_SUBST(HAVE_GLOBAL_HASH_SET)]) + ]) AC_DEFUN([AC_CXX_HAVE_HASH_SET], [AC_CXX_HAVE_STD_EXT_HASH_SET From criswell at cs.uiuc.edu Fri Sep 24 13:28:12 2004 From: criswell at cs.uiuc.edu (John Criswell) Date: Fri, 24 Sep 2004 13:28:12 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/ADT/hash_map.in hash_set.in Message-ID: <200409241828.NAA29573@choi.cs.uiuc.edu> Changes in directory llvm/include/llvm/ADT: hash_map.in updated: 1.2 -> 1.3 hash_set.in updated: 1.2 -> 1.3 --- Log message: Modified hash_map and hash_set configuration so that they are not regenerated on every run of configure. --- Diffs of the changes: (+14 -6) Index: llvm/include/llvm/ADT/hash_map.in diff -u llvm/include/llvm/ADT/hash_map.in:1.2 llvm/include/llvm/ADT/hash_map.in:1.3 --- llvm/include/llvm/ADT/hash_map.in:1.2 Wed Sep 1 17:55:34 2004 +++ llvm/include/llvm/ADT/hash_map.in Fri Sep 24 13:28:00 2004 @@ -25,7 +25,11 @@ // 3.1 __gnu_cxx ext/hash_map // -#if @HAVE_GNU_EXT_HASH_MAP@ +#undef HAVE_GNU_EXT_HASH_MAP +#undef HAVE_STD_EXT_HASH_MAP +#undef HAVE_GLOBAL_HASH_MAP + +#if HAVE_GNU_EXT_HASH_MAP // This is for GCC-3.1+ which puts hash in ext/hash_map # include # ifndef HASH_NAMESPACE @@ -33,7 +37,7 @@ # endif // GCC 3.0.x puts hash_map in and in the std namespace. -#elif @HAVE_STD_EXT_HASH_MAP@ +#elif HAVE_STD_EXT_HASH_MAP # include # ifndef HASH_NAMESPACE # define HASH_NAMESPACE std @@ -41,7 +45,7 @@ // Older compilers such as GCC before version 3.0 do not keep // extensions in the `ext' directory, and ignore the `std' namespace. -#elif @HAVE_GLOBAL_HASH_MAP@ +#elif HAVE_GLOBAL_HASH_MAP # include # ifndef HASH_NAMESPACE # define HASH_NAMESPACE std Index: llvm/include/llvm/ADT/hash_set.in diff -u llvm/include/llvm/ADT/hash_set.in:1.2 llvm/include/llvm/ADT/hash_set.in:1.3 --- llvm/include/llvm/ADT/hash_set.in:1.2 Wed Sep 1 17:55:34 2004 +++ llvm/include/llvm/ADT/hash_set.in Fri Sep 24 13:28:00 2004 @@ -26,16 +26,20 @@ // 3.1 __gnu_cxx ext/hash_set // +#undef HAVE_GNU_EXT_HASH_SET +#undef HAVE_STD_EXT_HASH_SET +#undef HAVE_GLOBAL_HASH_SET + // GCC versions 3.1 and later put hash_set in and in // the __gnu_cxx namespace. -#if @HAVE_GNU_EXT_HASH_SET@ +#if HAVE_GNU_EXT_HASH_SET # include # ifndef HASH_NAMESPACE # define HASH_NAMESPACE __gnu_cxx # endif // GCC 3.0.x puts hash_set in and in the std namespace. -#elif @HAVE_STD_EXT_HASH_SET@ +#elif HAVE_STD_EXT_HASH_SET # include # ifndef HASH_NAMESPACE # define HASH_NAMESPACE std @@ -43,7 +47,7 @@ // Older compilers such as GCC before version 3.0 do not keep // extensions in the `ext' directory, and ignore the `std' namespace. -#elif @HAVE_GLOBAL_HASH_SET@ +#elif HAVE_GLOBAL_HASH_SET # include # ifndef HASH_NAMESPACE # define HASH_NAMESPACE std From criswell at cs.uiuc.edu Fri Sep 24 16:19:14 2004 From: criswell at cs.uiuc.edu (John Criswell) Date: Fri, 24 Sep 2004 16:19:14 -0500 Subject: [llvm-commits] CVS: llvm/configure Message-ID: <200409242119.QAA15261@choi.cs.uiuc.edu> Changes in directory llvm: configure updated: 1.123 -> 1.124 --- Log message: Updated the last two header files so that they are configured with AC_CONFIG_HEADERS. This should prevent LLVM from needlessly re-compiling on a re-configure. --- Diffs of the changes: (+74 -46) Index: llvm/configure diff -u llvm/configure:1.123 llvm/configure:1.124 --- llvm/configure:1.123 Fri Sep 24 13:27:54 2004 +++ llvm/configure Fri Sep 24 16:18:59 2004 @@ -473,7 +473,7 @@ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS subdirs INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os OS LLVMGCCDIR ARCH CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT CC CFLAGS ac_ct_CC CPP ifGNUmake LEX LEXLIB LEX_OUTPUT_ROOT FLEX YACC BISON EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL DOT ETAGS ETAGSFLAGS PYTHON QMTEST HAVE_PTHREAD_MUTEX_LOCK ENDIAN HAVE_STD_ITERATOR HAVE_BI_ITERATOR HAVE_FWD_ITERATOR ALLOCA MMAP_FILE ENABLE_OPTIMIZED JIT LLVMCC1 LLVMCC1PLUS SHLIBEXT LLVM_PREFIX LLVM_BINDIR LLVM_LIBDIR LLVM_! DATADIR LLVM_DOCSDIR LLVM_ETCDIR LLVM_INCLUDEDIR LLVM_INFODIR LLVM_MANDIR LLVM_CONFIGTIME LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS subdirs INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os OS LLVMGCCDIR ARCH CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT CC CFLAGS ac_ct_CC CPP ifGNUmake LEX LEXLIB LEX_OUTPUT_ROOT FLEX YACC BISON EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL DOT ETAGS ETAGSFLAGS PYTHON QMTEST ENDIAN ALLOCA MMAP_FILE ENABLE_OPTIMIZED JIT LLVMCC1 LLVMCC1PLUS SHLIBEXT LLVM_PREFIX LLVM_BINDIR LLVM_LIBDIR LLVM_DATADIR LLVM_DOCSDIR LLVM_ETCDIR LLVM_INCLUDEDIR LLVM_INFODIR LLVM_MANDIR LLV! M_CONFIGTIME LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -1598,7 +1598,7 @@ ac_config_headers="$ac_config_headers include/llvm/Config/config.h" - ac_config_files="$ac_config_files Makefile.config include/llvm/Support/ThreadSupport.h include/llvm/ADT/iterator" + ac_config_files="$ac_config_files Makefile.config" ac_config_headers="$ac_config_headers include/llvm/Support/DataTypes.h" @@ -1606,6 +1606,10 @@ ac_config_headers="$ac_config_headers include/llvm/ADT/hash_set" + ac_config_headers="$ac_config_headers include/llvm/Support/ThreadSupport.h" + + ac_config_headers="$ac_config_headers include/llvm/ADT/iterator" + ac_config_commands="$ac_config_commands Makefile" @@ -4176,7 +4180,7 @@ ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 4179 "configure"' > conftest.$ac_ext + echo '#line 4183 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -5057,7 +5061,7 @@ # Provide some information about the compiler. -echo "$as_me:5060:" \ +echo "$as_me:5064:" \ "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 @@ -6114,11 +6118,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6117: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6121: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6121: \$? = $ac_status" >&5 + echo "$as_me:6125: \$? = $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 @@ -6357,11 +6361,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6360: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6364: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6364: \$? = $ac_status" >&5 + echo "$as_me:6368: \$? = $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 @@ -6417,11 +6421,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6420: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6424: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:6424: \$? = $ac_status" >&5 + echo "$as_me:6428: \$? = $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 @@ -8594,7 +8598,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:10885: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:10885: \$? = $ac_status" >&5 + echo "$as_me:10889: \$? = $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 @@ -10938,11 +10942,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:10941: $lt_compile\"" >&5) + (eval echo "\"\$as_me:10945: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:10945: \$? = $ac_status" >&5 + echo "$as_me:10949: \$? = $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 @@ -12299,7 +12303,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:13241: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13241: \$? = $ac_status" >&5 + echo "$as_me:13245: \$? = $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 @@ -13294,11 +13298,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13297: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13301: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13301: \$? = $ac_status" >&5 + echo "$as_me:13305: \$? = $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 @@ -15325,11 +15329,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15328: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15332: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15332: \$? = $ac_status" >&5 + echo "$as_me:15336: \$? = $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 @@ -15568,11 +15572,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15571: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15575: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15575: \$? = $ac_status" >&5 + echo "$as_me:15579: \$? = $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 @@ -15628,11 +15632,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15631: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15635: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:15635: \$? = $ac_status" >&5 + echo "$as_me:15639: \$? = $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 @@ -17805,7 +17809,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&6 if test "$ac_cv_search_pthread_mutex_lock" != no; then test "$ac_cv_search_pthread_mutex_lock" = "none required" || LIBS="$ac_cv_search_pthread_mutex_lock $LIBS" - HAVE_PTHREAD_MUTEX_LOCK=1 -else - HAVE_PTHREAD_MUTEX_LOCK=0 -fi +cat >>confdefs.h <<\_ACEOF +#define HAVE_PTHREAD_MUTEX_LOCK 1 +_ACEOF + +fi echo "$as_me:$LINENO: checking for ANSI C header files" >&5 @@ -21824,10 +21829,19 @@ fi echo "$as_me:$LINENO: result: $ac_cv_cxx_have_std_iterator" >&5 echo "${ECHO_T}$ac_cv_cxx_have_std_iterator" >&6 -HAVE_STD_ITERATOR=0 if test "$ac_cv_cxx_have_std_iterator" = yes then - HAVE_STD_ITERATOR=1 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_STD_ITERATOR 1 +_ACEOF + +else + +cat >>confdefs.h <<\_ACEOF +#define HAVE_STD_ITERATOR 0 +_ACEOF + fi echo "$as_me:$LINENO: checking whether the compiler has the bidirectional iterator" >&5 @@ -21900,10 +21914,19 @@ fi echo "$as_me:$LINENO: result: $ac_cv_cxx_have_bi_iterator" >&5 echo "${ECHO_T}$ac_cv_cxx_have_bi_iterator" >&6 -HAVE_BI_ITERATOR=0 if test "$ac_cv_cxx_have_bi_iterator" = yes then - HAVE_BI_ITERATOR=1 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_BI_ITERATOR 1 +_ACEOF + +else + +cat >>confdefs.h <<\_ACEOF +#define HAVE_BI_ITERATOR 0 +_ACEOF + fi echo "$as_me:$LINENO: checking whether the compiler has forward iterators" >&5 @@ -21976,10 +21999,19 @@ fi echo "$as_me:$LINENO: result: $ac_cv_cxx_have_fwd_iterator" >&5 echo "${ECHO_T}$ac_cv_cxx_have_fwd_iterator" >&6 -HAVE_FWD_ITERATOR=0 if test "$ac_cv_cxx_have_fwd_iterator" = yes then - HAVE_FWD_ITERATOR=1 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_FWD_ITERATOR 1 +_ACEOF + +else + +cat >>confdefs.h <<\_ACEOF +#define HAVE_FWD_ITERATOR 0 +_ACEOF + fi @@ -24496,8 +24528,6 @@ case "$ac_config_target" in # Handling of arguments. "Makefile.config" ) CONFIG_FILES="$CONFIG_FILES Makefile.config" ;; - "include/llvm/Support/ThreadSupport.h" ) CONFIG_FILES="$CONFIG_FILES include/llvm/Support/ThreadSupport.h" ;; - "include/llvm/ADT/iterator" ) CONFIG_FILES="$CONFIG_FILES include/llvm/ADT/iterator" ;; "lib/System/platform" ) CONFIG_LINKS="$CONFIG_LINKS lib/System/platform:lib/System/$platform_type" ;; "Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS Makefile" ;; "Makefile.common" ) CONFIG_COMMANDS="$CONFIG_COMMANDS Makefile.common" ;; @@ -24515,6 +24545,8 @@ "include/llvm/Support/DataTypes.h" ) CONFIG_HEADERS="$CONFIG_HEADERS include/llvm/Support/DataTypes.h" ;; "include/llvm/ADT/hash_map" ) CONFIG_HEADERS="$CONFIG_HEADERS include/llvm/ADT/hash_map" ;; "include/llvm/ADT/hash_set" ) CONFIG_HEADERS="$CONFIG_HEADERS include/llvm/ADT/hash_set" ;; + "include/llvm/Support/ThreadSupport.h" ) CONFIG_HEADERS="$CONFIG_HEADERS include/llvm/Support/ThreadSupport.h" ;; + "include/llvm/ADT/iterator" ) CONFIG_HEADERS="$CONFIG_HEADERS include/llvm/ADT/iterator" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; @@ -24657,11 +24689,7 @@ s, at ETAGSFLAGS@,$ETAGSFLAGS,;t t s, at PYTHON@,$PYTHON,;t t s, at QMTEST@,$QMTEST,;t t -s, at HAVE_PTHREAD_MUTEX_LOCK@,$HAVE_PTHREAD_MUTEX_LOCK,;t t s, at ENDIAN@,$ENDIAN,;t t -s, at HAVE_STD_ITERATOR@,$HAVE_STD_ITERATOR,;t t -s, at HAVE_BI_ITERATOR@,$HAVE_BI_ITERATOR,;t t -s, at HAVE_FWD_ITERATOR@,$HAVE_FWD_ITERATOR,;t t s, at ALLOCA@,$ALLOCA,;t t s, at MMAP_FILE@,$MMAP_FILE,;t t s, at ENABLE_OPTIMIZED@,$ENABLE_OPTIMIZED,;t t From criswell at cs.uiuc.edu Fri Sep 24 16:19:19 2004 From: criswell at cs.uiuc.edu (John Criswell) Date: Fri, 24 Sep 2004 16:19:19 -0500 Subject: [llvm-commits] CVS: llvm/autoconf/configure.ac Message-ID: <200409242119.QAA15279@choi.cs.uiuc.edu> Changes in directory llvm/autoconf: configure.ac updated: 1.117 -> 1.118 --- Log message: Updated the last two header files so that they are configured with AC_CONFIG_HEADERS. This should prevent LLVM from needlessly re-compiling on a re-configure. --- Diffs of the changes: (+5 -5) Index: llvm/autoconf/configure.ac diff -u llvm/autoconf/configure.ac:1.117 llvm/autoconf/configure.ac:1.118 --- llvm/autoconf/configure.ac:1.117 Fri Sep 24 13:27:56 2004 +++ llvm/autoconf/configure.ac Fri Sep 24 16:19:04 2004 @@ -42,12 +42,12 @@ AC_CONFIG_HEADERS(include/llvm/Config/config.h) dnl Configure other output file -AC_CONFIG_FILES(Makefile.config - include/llvm/Support/ThreadSupport.h - include/llvm/ADT/iterator) +AC_CONFIG_FILES(Makefile.config) AC_CONFIG_HEADERS([include/llvm/Support/DataTypes.h]) AC_CONFIG_HEADERS([include/llvm/ADT/hash_map]) AC_CONFIG_HEADERS([include/llvm/ADT/hash_set]) +AC_CONFIG_HEADERS([include/llvm/Support/ThreadSupport.h]) +AC_CONFIG_HEADERS([include/llvm/ADT/iterator]) dnl Do special configuration of Makefiles AC_CONFIG_MAKEFILE(Makefile) @@ -255,8 +255,8 @@ dnl pthread locking functions are optional - but llvm will not be thread-safe dnl without locks. -AC_SEARCH_LIBS(pthread_mutex_lock,pthread,HAVE_PTHREAD_MUTEX_LOCK=1,HAVE_PTHREAD_MUTEX_LOCK=0) -AC_SUBST(HAVE_PTHREAD_MUTEX_LOCK) +AC_SEARCH_LIBS(pthread_mutex_lock,pthread,AC_DEFINE([HAVE_PTHREAD_MUTEX_LOCK],[1],[Have pthread_mutex_lock])) +dnl AC_SUBST(HAVE_PTHREAD_MUTEX_LOCK) dnl Checks for header files. dnl We don't check for ancient stuff or things that are guaranteed to be there From criswell at cs.uiuc.edu Fri Sep 24 16:19:21 2004 From: criswell at cs.uiuc.edu (John Criswell) Date: Fri, 24 Sep 2004 16:19:21 -0500 Subject: [llvm-commits] CVS: llvm/autoconf/m4/cxx_bidi_iterator.m4 cxx_fwd_iterator.m4 cxx_std_iterator.m4 Message-ID: <200409242119.QAA15293@choi.cs.uiuc.edu> Changes in directory llvm/autoconf/m4: cxx_bidi_iterator.m4 updated: 1.2 -> 1.3 cxx_fwd_iterator.m4 updated: 1.2 -> 1.3 cxx_std_iterator.m4 updated: 1.2 -> 1.3 --- Log message: Updated the last two header files so that they are configured with AC_CONFIG_HEADERS. This should prevent LLVM from needlessly re-compiling on a re-configure. --- Diffs of the changes: (+12 -9) Index: llvm/autoconf/m4/cxx_bidi_iterator.m4 diff -u llvm/autoconf/m4/cxx_bidi_iterator.m4:1.2 llvm/autoconf/m4/cxx_bidi_iterator.m4:1.3 --- llvm/autoconf/m4/cxx_bidi_iterator.m4:1.2 Sun Sep 19 17:31:49 2004 +++ llvm/autoconf/m4/cxx_bidi_iterator.m4 Fri Sep 24 16:19:05 2004 @@ -13,9 +13,10 @@ #endif]], [[bidirectional_iterator t; return 0;]])],[ac_cv_cxx_have_bi_iterator=yes],[ac_cv_cxx_have_bi_iterator=no]) AC_LANG_POP([C++]) ]) -HAVE_BI_ITERATOR=0 if test "$ac_cv_cxx_have_bi_iterator" = yes then - HAVE_BI_ITERATOR=1 + AC_DEFINE(HAVE_BI_ITERATOR,1,[Have bi-directional iterator]) +else + AC_DEFINE(HAVE_BI_ITERATOR,0,[Does not have bi-directional iterator]) fi -AC_SUBST(HAVE_BI_ITERATOR)]) +]) Index: llvm/autoconf/m4/cxx_fwd_iterator.m4 diff -u llvm/autoconf/m4/cxx_fwd_iterator.m4:1.2 llvm/autoconf/m4/cxx_fwd_iterator.m4:1.3 --- llvm/autoconf/m4/cxx_fwd_iterator.m4:1.2 Sun Sep 19 17:31:49 2004 +++ llvm/autoconf/m4/cxx_fwd_iterator.m4 Fri Sep 24 16:19:05 2004 @@ -11,11 +11,12 @@ #endif]], [[forward_iterator t; return 0;]])],[ac_cv_cxx_have_fwd_iterator=yes],[ac_cv_cxx_have_fwd_iterator=no]) AC_LANG_POP([C++]) ]) -HAVE_FWD_ITERATOR=0 if test "$ac_cv_cxx_have_fwd_iterator" = yes then - HAVE_FWD_ITERATOR=1 + AC_DEFINE(HAVE_FWD_ITERATOR,1,[Have forward iterator]) +else + AC_DEFINE(HAVE_FWD_ITERATOR,0,[Does not have forward iterator]) fi -AC_SUBST(HAVE_FWD_ITERATOR)]) +]) Index: llvm/autoconf/m4/cxx_std_iterator.m4 diff -u llvm/autoconf/m4/cxx_std_iterator.m4:1.2 llvm/autoconf/m4/cxx_std_iterator.m4:1.3 --- llvm/autoconf/m4/cxx_std_iterator.m4:1.2 Sun Sep 19 17:31:49 2004 +++ llvm/autoconf/m4/cxx_std_iterator.m4 Fri Sep 24 16:19:05 2004 @@ -15,11 +15,12 @@ ac_cv_cxx_have_std_iterator=no) AC_LANG_POP([C++]) ]) -HAVE_STD_ITERATOR=0 if test "$ac_cv_cxx_have_std_iterator" = yes then - HAVE_STD_ITERATOR=1 + AC_DEFINE(HAVE_STD_ITERATOR,1,[Have std namespace iterator]) +else + AC_DEFINE(HAVE_STD_ITERATOR,0,[Does not have std namespace iterator]) fi -AC_SUBST(HAVE_STD_ITERATOR)]) +]) From criswell at cs.uiuc.edu Fri Sep 24 16:19:19 2004 From: criswell at cs.uiuc.edu (John Criswell) Date: Fri, 24 Sep 2004 16:19:19 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/ADT/iterator.in Message-ID: <200409242119.QAA15280@choi.cs.uiuc.edu> Changes in directory llvm/include/llvm/ADT: iterator.in updated: 1.2 -> 1.3 --- Log message: Updated the last two header files so that they are configured with AC_CONFIG_HEADERS. This should prevent LLVM from needlessly re-compiling on a re-configure. --- Diffs of the changes: (+8 -4) Index: llvm/include/llvm/ADT/iterator.in diff -u llvm/include/llvm/ADT/iterator.in:1.2 llvm/include/llvm/ADT/iterator.in:1.3 --- llvm/include/llvm/ADT/iterator.in:1.2 Wed Sep 1 17:55:34 2004 +++ llvm/include/llvm/ADT/iterator.in Fri Sep 24 16:19:05 2004 @@ -30,8 +30,12 @@ #include -#if !@HAVE_BI_ITERATOR@ -# if @HAVE_STD_ITERATOR@ +#undef HAVE_BI_ITERATOR +#undef HAVE_STD_ITERATOR +#undef HAVE_FWD_ITERATOR + +#if !HAVE_BI_ITERATOR +# if HAVE_STD_ITERATOR /// If the bidirectional iterator is not defined, we attempt to define it in /// terms of the C++ standard iterator. Otherwise, we import it with a "using" /// statement. @@ -47,8 +51,8 @@ using std::bidirectional_iterator; #endif -#if !@HAVE_FWD_ITERATOR@ -# if @HAVE_STD_ITERATOR@ +#if !HAVE_FWD_ITERATOR +# if HAVE_STD_ITERATOR /// If the forward iterator is not defined, attempt to define it in terms of /// the C++ standard iterator. Otherwise, we import it with a "using" statement. /// From criswell at cs.uiuc.edu Fri Sep 24 16:19:21 2004 From: criswell at cs.uiuc.edu (John Criswell) Date: Fri, 24 Sep 2004 16:19:21 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Support/ThreadSupport.h.in Message-ID: <200409242119.QAA15287@choi.cs.uiuc.edu> Changes in directory llvm/include/llvm/Support: ThreadSupport.h.in updated: 1.2 -> 1.3 --- Log message: Updated the last two header files so that they are configured with AC_CONFIG_HEADERS. This should prevent LLVM from needlessly re-compiling on a re-configure. --- Diffs of the changes: (+3 -1) Index: llvm/include/llvm/Support/ThreadSupport.h.in diff -u llvm/include/llvm/Support/ThreadSupport.h.in:1.2 llvm/include/llvm/Support/ThreadSupport.h.in:1.3 --- llvm/include/llvm/Support/ThreadSupport.h.in:1.2 Wed Sep 1 17:55:35 2004 +++ llvm/include/llvm/Support/ThreadSupport.h.in Fri Sep 24 16:19:06 2004 @@ -17,7 +17,9 @@ #ifndef SUPPORT_THREADSUPPORT_H #define SUPPORT_THREADSUPPORT_H -#if @HAVE_PTHREAD_MUTEX_LOCK@ +#undef HAVE_PTHREAD_MUTEX_LOCK + +#ifdef HAVE_PTHREAD_MUTEX_LOCK #include "llvm/Support/ThreadSupport-PThreads.h" #else #include "llvm/Support/ThreadSupport-NoSupport.h" From criswell at cs.uiuc.edu Fri Sep 24 16:19:21 2004 From: criswell at cs.uiuc.edu (John Criswell) Date: Fri, 24 Sep 2004 16:19:21 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Config/config.h.in Message-ID: <200409242119.QAA15288@choi.cs.uiuc.edu> Changes in directory llvm/include/llvm/Config: config.h.in updated: 1.29 -> 1.30 --- Log message: Updated the last two header files so that they are configured with AC_CONFIG_HEADERS. This should prevent LLVM from needlessly re-compiling on a re-configure. --- Diffs of the changes: (+30 -0) Index: llvm/include/llvm/Config/config.h.in diff -u llvm/include/llvm/Config/config.h.in:1.29 llvm/include/llvm/Config/config.h.in:1.30 --- llvm/include/llvm/Config/config.h.in:1.29 Wed Sep 22 10:32:08 2004 +++ llvm/include/llvm/Config/config.h.in Fri Sep 24 16:19:06 2004 @@ -18,6 +18,9 @@ /* Define to 1 if you have the `backtrace' function. */ #undef HAVE_BACKTRACE +/* Does not have bi-directional iterator */ +#undef HAVE_BI_ITERATOR + /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H @@ -34,6 +37,9 @@ */ #undef HAVE_FINITE_IN_IEEEFP_H +/* Does not have forward iterator */ +#undef HAVE_FWD_ITERATOR + /* Define to 1 if you have the `getcwd' function. */ #undef HAVE_GETCWD @@ -46,6 +52,18 @@ /* Define to 1 if you have the `gettimeofday' function. */ #undef HAVE_GETTIMEOFDAY +/* Does not have */ +#undef HAVE_GLOBAL_HASH_MAP + +/* Does not have hash_set in global namespace */ +#undef HAVE_GLOBAL_HASH_SET + +/* Does not have ext/hash_map */ +#undef HAVE_GNU_EXT_HASH_MAP + +/* Does not have hash_set in gnu namespace */ +#undef HAVE_GNU_EXT_HASH_SET + /* Define to 1 if the system has the type `int64_t'. */ #undef HAVE_INT64_T @@ -108,12 +126,21 @@ /* Define to have the %a format string */ #undef HAVE_PRINTF_A +/* Have pthread_mutex_lock */ +#undef HAVE_PTHREAD_MUTEX_LOCK + /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H +/* Does not have ext/hash_map> */ +#undef HAVE_STD_EXT_HASH_MAP + +/* Does not have hash_set in std namespace */ +#undef HAVE_STD_EXT_HASH_SET + /* Define to 1 if your compiler defines std::isinf in the header file. */ #undef HAVE_STD_ISINF_IN_CMATH @@ -122,6 +149,9 @@ */ #undef HAVE_STD_ISNAN_IN_CMATH +/* Does not have std namespace iterator */ +#undef HAVE_STD_ITERATOR + /* Define to 1 if you have the `strdup' function. */ #undef HAVE_STRDUP From gaeke at cs.uiuc.edu Fri Sep 24 16:22:48 2004 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Fri, 24 Sep 2004 16:22:48 -0500 (CDT) Subject: [llvm-commits] CVS: reopt/Makefile.config.in Message-ID: <200409242122.QAA24013@seraph.cs.uiuc.edu> Changes in directory reopt: Makefile.config.in updated: 1.4 -> 1.5 --- Log message: Makefile.config goes in the OBJ_ROOT, not SRC_ROOT. --- Diffs of the changes: (+2 -2) Index: reopt/Makefile.config.in diff -u reopt/Makefile.config.in:1.4 reopt/Makefile.config.in:1.5 --- reopt/Makefile.config.in:1.4 Tue Sep 7 12:33:09 2004 +++ reopt/Makefile.config.in Fri Sep 24 16:22:36 2004 @@ -10,9 +10,9 @@ LLVM_OBJ_ROOT = @LLVM_OBJ@ # -# Include LLVM's Makefile Makefile. +# Include LLVM's Master Makefile. # -include $(LLVM_SRC_ROOT)/Makefile.config +include $(LLVM_OBJ_ROOT)/Makefile.config # Path to the PAPI code. This is used by the reoptimizer only. # e.g.: From gaeke at cs.uiuc.edu Fri Sep 24 16:22:52 2004 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Fri, 24 Sep 2004 16:22:52 -0500 (CDT) Subject: [llvm-commits] CVS: reopt/include/reopt/InstrUtils.h MappingInfo.h MemoryManager.h TraceCache.h TraceJIT.h UnpackTraceFunction.h Message-ID: <200409242122.QAA24060@seraph.cs.uiuc.edu> Changes in directory reopt/include/reopt: InstrUtils.h updated: 1.10 -> 1.11 MappingInfo.h updated: 1.11 -> 1.12 MemoryManager.h updated: 1.7 -> 1.8 TraceCache.h updated: 1.20 -> 1.21 TraceJIT.h updated: 1.2 -> 1.3 UnpackTraceFunction.h updated: 1.17 -> 1.18 --- Log message: Renamed Support/DataTypes.h --> llvm/Support/DataTypes.h. The stale copy of the former has been in my tree for so long, I never noticed... --- Diffs of the changes: (+6 -6) Index: reopt/include/reopt/InstrUtils.h diff -u reopt/include/reopt/InstrUtils.h:1.10 reopt/include/reopt/InstrUtils.h:1.11 --- reopt/include/reopt/InstrUtils.h:1.10 Wed Nov 19 16:51:41 2003 +++ reopt/include/reopt/InstrUtils.h Fri Sep 24 16:22:38 2004 @@ -9,7 +9,7 @@ #ifndef REOPT_INSTRUTILS_H #define REOPT_INSTRUTILS_H -#include "Support/DataTypes.h" +#include "llvm/Support/DataTypes.h" #include namespace llvm { Index: reopt/include/reopt/MappingInfo.h diff -u reopt/include/reopt/MappingInfo.h:1.11 reopt/include/reopt/MappingInfo.h:1.12 --- reopt/include/reopt/MappingInfo.h:1.11 Wed Nov 19 16:51:42 2003 +++ reopt/include/reopt/MappingInfo.h Fri Sep 24 16:22:38 2004 @@ -10,7 +10,7 @@ #ifndef REOPT_MAPPINGINFO_H #define REOPT_MAPPINGINFO_H -#include "Support/DataTypes.h" +#include "llvm/Support/DataTypes.h" #include namespace llvm { Index: reopt/include/reopt/MemoryManager.h diff -u reopt/include/reopt/MemoryManager.h:1.7 reopt/include/reopt/MemoryManager.h:1.8 --- reopt/include/reopt/MemoryManager.h:1.7 Fri Apr 23 15:35:52 2004 +++ reopt/include/reopt/MemoryManager.h Fri Sep 24 16:22:38 2004 @@ -26,7 +26,7 @@ #ifndef REOPT_MEMORYMANAGER_H #define REOPT_MEMORYMANAGER_H -#include "Support/DataTypes.h" +#include "llvm/Support/DataTypes.h" #include namespace llvm { Index: reopt/include/reopt/TraceCache.h diff -u reopt/include/reopt/TraceCache.h:1.20 reopt/include/reopt/TraceCache.h:1.21 --- reopt/include/reopt/TraceCache.h:1.20 Thu Jul 8 03:26:35 2004 +++ reopt/include/reopt/TraceCache.h Fri Sep 24 16:22:38 2004 @@ -7,7 +7,7 @@ #ifndef REOPT_TRACECACHE_H #define REOPT_TRACECACHE_H -#include "Support/DataTypes.h" +#include "llvm/Support/DataTypes.h" #include #include #include Index: reopt/include/reopt/TraceJIT.h diff -u reopt/include/reopt/TraceJIT.h:1.2 reopt/include/reopt/TraceJIT.h:1.3 --- reopt/include/reopt/TraceJIT.h:1.2 Tue Jul 20 17:41:41 2004 +++ reopt/include/reopt/TraceJIT.h Fri Sep 24 16:22:39 2004 @@ -16,7 +16,7 @@ #include "llvm/ExecutionEngine/ExecutionEngine.h" #include "llvm/PassManager.h" -#include "Support/DataTypes.h" +#include "llvm/Support/DataTypes.h" #include namespace llvm { Index: reopt/include/reopt/UnpackTraceFunction.h diff -u reopt/include/reopt/UnpackTraceFunction.h:1.17 reopt/include/reopt/UnpackTraceFunction.h:1.18 --- reopt/include/reopt/UnpackTraceFunction.h:1.17 Mon Aug 30 14:56:40 2004 +++ reopt/include/reopt/UnpackTraceFunction.h Fri Sep 24 16:22:40 2004 @@ -9,7 +9,7 @@ #include "../../../../lib/Target/SparcV9/RegAlloc/AllocInfo.h" #include "llvm/CodeGen/MachineFunctionPass.h" -#include "Support/DataTypes.h" +#include "llvm/Support/DataTypes.h" #include namespace llvm { From gaeke at cs.uiuc.edu Fri Sep 24 16:22:52 2004 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Fri, 24 Sep 2004 16:22:52 -0500 (CDT) Subject: [llvm-commits] CVS: reopt/include/reopt/BinInterface/bitmath.h Message-ID: <200409242122.QAA24068@seraph.cs.uiuc.edu> Changes in directory reopt/include/reopt/BinInterface: bitmath.h updated: 1.13 -> 1.14 --- Log message: Renamed Support/DataTypes.h --> llvm/Support/DataTypes.h. The stale copy of the former has been in my tree for so long, I never noticed... --- Diffs of the changes: (+1 -1) Index: reopt/include/reopt/BinInterface/bitmath.h diff -u reopt/include/reopt/BinInterface/bitmath.h:1.13 reopt/include/reopt/BinInterface/bitmath.h:1.14 --- reopt/include/reopt/BinInterface/bitmath.h:1.13 Wed Nov 19 16:51:43 2003 +++ reopt/include/reopt/BinInterface/bitmath.h Fri Sep 24 16:22:41 2004 @@ -16,7 +16,7 @@ #ifndef REOPT_BININTERFACE_BITMATH_H #define REOPT_BININTERFACE_BITMATH_H -#include "Support/DataTypes.h" +#include "llvm/Support/DataTypes.h" namespace llvm { From gaeke at cs.uiuc.edu Fri Sep 24 16:22:53 2004 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Fri, 24 Sep 2004 16:22:53 -0500 (CDT) Subject: [llvm-commits] CVS: reopt/include/reopt/Inst/ElfReader.h Message-ID: <200409242122.QAA24075@seraph.cs.uiuc.edu> Changes in directory reopt/include/reopt/Inst: ElfReader.h updated: 1.10 -> 1.11 --- Log message: Renamed Support/DataTypes.h --> llvm/Support/DataTypes.h. The stale copy of the former has been in my tree for so long, I never noticed... --- Diffs of the changes: (+1 -1) Index: reopt/include/reopt/Inst/ElfReader.h diff -u reopt/include/reopt/Inst/ElfReader.h:1.10 reopt/include/reopt/Inst/ElfReader.h:1.11 --- reopt/include/reopt/Inst/ElfReader.h:1.10 Wed Nov 19 16:51:45 2003 +++ reopt/include/reopt/Inst/ElfReader.h Fri Sep 24 16:22:42 2004 @@ -18,7 +18,7 @@ #ifndef ELFREADER_H #define ELFREADER_H -#include "Support/DataTypes.h" +#include "llvm/Support/DataTypes.h" #include #include #include From gaeke at cs.uiuc.edu Fri Sep 24 16:22:54 2004 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Fri, 24 Sep 2004 16:22:54 -0500 (CDT) Subject: [llvm-commits] CVS: reopt/lib/Inst/lib/InstManip.h Message-ID: <200409242122.QAA24083@seraph.cs.uiuc.edu> Changes in directory reopt/lib/Inst/lib: InstManip.h updated: 1.20 -> 1.21 --- Log message: Renamed Support/DataTypes.h --> llvm/Support/DataTypes.h. The stale copy of the former has been in my tree for so long, I never noticed... --- Diffs of the changes: (+1 -1) Index: reopt/lib/Inst/lib/InstManip.h diff -u reopt/lib/Inst/lib/InstManip.h:1.20 reopt/lib/Inst/lib/InstManip.h:1.21 --- reopt/lib/Inst/lib/InstManip.h:1.20 Wed Apr 28 12:23:32 2004 +++ reopt/lib/Inst/lib/InstManip.h Fri Sep 24 16:22:43 2004 @@ -33,7 +33,7 @@ #define INSTMANIP_H #include "Phase1/Intraphase.h" -#include "Support/DataTypes.h" +#include "llvm/Support/DataTypes.h" #include #include #include From gaeke at cs.uiuc.edu Fri Sep 24 16:22:55 2004 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Fri, 24 Sep 2004 16:22:55 -0500 (CDT) Subject: [llvm-commits] CVS: reopt/lib/LightWtProfiling/ReoptimizerInternal.h Message-ID: <200409242122.QAA24104@seraph.cs.uiuc.edu> Changes in directory reopt/lib/LightWtProfiling: ReoptimizerInternal.h updated: 1.7 -> 1.8 --- Log message: Renamed Support/DataTypes.h --> llvm/Support/DataTypes.h. The stale copy of the former has been in my tree for so long, I never noticed... --- Diffs of the changes: (+1 -1) Index: reopt/lib/LightWtProfiling/ReoptimizerInternal.h diff -u reopt/lib/LightWtProfiling/ReoptimizerInternal.h:1.7 reopt/lib/LightWtProfiling/ReoptimizerInternal.h:1.8 --- reopt/lib/LightWtProfiling/ReoptimizerInternal.h:1.7 Wed Jun 30 01:33:10 2004 +++ reopt/lib/LightWtProfiling/ReoptimizerInternal.h Fri Sep 24 16:22:44 2004 @@ -18,7 +18,7 @@ #ifndef REOPTIMIZERINTERNAL_H #define REOPTIMIZERINTERNAL_H -#include "Support/DataTypes.h" +#include "llvm/Support/DataTypes.h" #include "llvm/CodeGen/MachineCodeEmitter.h" #include "llvm/Target/TargetData.h" #include From brukman at cs.uiuc.edu Fri Sep 24 16:40:44 2004 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri, 24 Sep 2004 16:40:44 -0500 Subject: [llvm-commits] CVS: llvm-www/releases/1.3/cfrontend-1.3.i386-unknown-freebsd5.2.1.tar.gz Message-ID: <200409242140.QAA05414@zion.cs.uiuc.edu> Changes in directory llvm-www/releases/1.3: cfrontend-1.3.i386-unknown-freebsd5.2.1.tar.gz added (r1.1) --- Log message: Added Jeff Cohen's llvm-gcc 1.3 for FreeBSD 5.2.1 --- Diffs of the changes: (+0 -0) Index: llvm-www/releases/1.3/cfrontend-1.3.i386-unknown-freebsd5.2.1.tar.gz From brukman at cs.uiuc.edu Fri Sep 24 16:41:43 2004 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri, 24 Sep 2004 16:41:43 -0500 Subject: [llvm-commits] CVS: llvm-www/releases/download.html Message-ID: <200409242141.QAA05557@zion.cs.uiuc.edu> Changes in directory llvm-www/releases: download.html updated: 1.17 -> 1.18 --- Log message: * Mention Jeff Cohen's llvm-gcc 1.3 binary for FreeBSD 5.2.1 * Delete commented out downloads that are not provided * Wrap long lines --- Diffs of the changes: (+43 -38) Index: llvm-www/releases/download.html diff -u llvm-www/releases/download.html:1.17 llvm-www/releases/download.html:1.18 --- llvm-www/releases/download.html:1.17 Fri Aug 13 17:23:29 2004 +++ llvm-www/releases/download.html Fri Sep 24 16:41:33 2004 @@ -13,10 +13,9 @@
    If you signed up for the LLVM Announcements list, you should receive a -confirmation email. If you didn't, you can register for the mailing list at - -http://mail.cs.uiuc.edu/mailman/listinfo/llvm-announce -. +confirmation email. If you didn't, you can +subscribe to +llvm-announce directly.
    @@ -41,8 +40,9 @@
    -Please read the Release Notes before -downloading: + +

    Please read the Release Notes before +downloading:

    -
  • GCC Front End Binaries - for MacOS X/PowerPC (11.6M)
  • +

    Contributed by users:

    -
  • GCC Front End Source Code (32.4M)
  • + -
    Download LLVM 1.2
    @@ -100,8 +101,9 @@ @@ -128,8 +131,9 @@
    -Please read the Release Notes before -downloading: + +

    Please read the Release Notes before +downloading:

    From brukman at cs.uiuc.edu Fri Sep 24 16:57:36 2004 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri, 24 Sep 2004 16:57:36 -0500 Subject: [llvm-commits] CVS: llvm-www/releases/download.html Message-ID: <200409242157.QAA05835@zion.cs.uiuc.edu> Changes in directory llvm-www/releases: download.html updated: 1.18 -> 1.19 --- Log message: Add link to SourceForge.net mirror of LLVM 1.3 release --- Diffs of the changes: (+7 -0) Index: llvm-www/releases/download.html diff -u llvm-www/releases/download.html:1.18 llvm-www/releases/download.html:1.19 --- llvm-www/releases/download.html:1.18 Fri Sep 24 16:41:33 2004 +++ llvm-www/releases/download.html Fri Sep 24 16:57:26 2004 @@ -67,6 +67,13 @@ Binaries for FreeBSD/x86 (13M) +

    Mirrors:

    + + + From reid at x10sys.com Fri Sep 24 18:25:30 2004 From: reid at x10sys.com (Reid Spencer) Date: Fri, 24 Sep 2004 18:25:30 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Linux/TimeValue.cpp Message-ID: <200409242325.SAA07086@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Linux: TimeValue.cpp added (r1.1) --- Log message: Initial implementation of the TimeValue abstraction. --- Diffs of the changes: (+37 -0) Index: llvm/lib/System/Linux/TimeValue.cpp diff -c /dev/null llvm/lib/System/Linux/TimeValue.cpp:1.1 *** /dev/null Fri Sep 24 18:25:29 2004 --- llvm/lib/System/Linux/TimeValue.cpp Fri Sep 24 18:25:19 2004 *************** *** 0 **** --- 1,37 ---- + //===- Linux/TimeValue.cpp - Linux TimeValue 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 TimeValue class. + // + //===----------------------------------------------------------------------===// + + // Include the generic Unix implementation + #include "../Unix/Unix.h" + #include + + namespace llvm { + using namespace sys; + + //===----------------------------------------------------------------------===// + //=== WARNING: Implementation here must contain only Linux specific code + //=== and must not be generic UNIX code (see ../Unix/TimeValue.cpp) + //===----------------------------------------------------------------------===// + + void TimeValue::now() { + struct timeval the_time; + timerclear(&the_time); + if (0 != ::gettimeofday(&the_time,0)) + ThrowErrno("Couldn't obtain time of day"); + + this->set( static_cast( the_time.tv_sec ), + static_cast( the_time.tv_usec * NANOSECONDS_PER_MICROSECOND ) ); + } + // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab + + } From reid at x10sys.com Fri Sep 24 18:25:30 2004 From: reid at x10sys.com (Reid Spencer) Date: Fri, 24 Sep 2004 18:25:30 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/TimeValue.cpp Message-ID: <200409242325.SAA07092@zion.cs.uiuc.edu> Changes in directory llvm/lib/System: TimeValue.cpp added (r1.1) --- Log message: Initial implementation of the TimeValue abstraction. --- Diffs of the changes: (+53 -0) Index: llvm/lib/System/TimeValue.cpp diff -c /dev/null llvm/lib/System/TimeValue.cpp:1.1 *** /dev/null Fri Sep 24 18:25:29 2004 --- llvm/lib/System/TimeValue.cpp Fri Sep 24 18:25:19 2004 *************** *** 0 **** --- 1,53 ---- + //===-- TimeValue.cpp - Implement OS TimeValue 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 file implements the operating system TimeValue concept. + // + //===----------------------------------------------------------------------===// + + #include + + namespace llvm { + using namespace sys; + + const TimeValue TimeValue::MinTime = TimeValue ( INT64_MIN,0 ); + const TimeValue TimeValue::MaxTime = TimeValue ( INT64_MAX,0 ); + const TimeValue TimeValue::ZeroTime = TimeValue ( 0,0 ); + const TimeValue TimeValue::PosixZeroTime = TimeValue ( -946684800,0 ); + const TimeValue TimeValue::Win32ZeroTime = TimeValue ( -12591158400ULL,0 ); + + void + TimeValue::normalize( void ) { + if ( nanos_ >= NANOSECONDS_PER_SECOND ) { + do { + seconds_++; + nanos_ -= NANOSECONDS_PER_SECOND; + } while ( nanos_ >= NANOSECONDS_PER_SECOND ); + } else if (nanos_ <= -NANOSECONDS_PER_SECOND ) { + do { + seconds_--; + nanos_ += NANOSECONDS_PER_SECOND; + } while (nanos_ <= -NANOSECONDS_PER_SECOND); + } + + if (seconds_ >= 1 && nanos_ < 0) { + seconds_--; + nanos_ += NANOSECONDS_PER_SECOND; + } else if (seconds_ < 0 && nanos_ > 0) { + seconds_++; + nanos_ -= NANOSECONDS_PER_SECOND; + } + } + + } + + /// Include the platform specific portion of TimeValue class + #include "platform/TimeValue.cpp" + + // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab From reid at x10sys.com Fri Sep 24 18:25:30 2004 From: reid at x10sys.com (Reid Spencer) Date: Fri, 24 Sep 2004 18:25:30 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/System/TimeValue.h Message-ID: <200409242325.SAA07089@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/System: TimeValue.h added (r1.1) --- Log message: Initial implementation of the TimeValue abstraction. --- Diffs of the changes: (+391 -0) Index: llvm/include/llvm/System/TimeValue.h diff -c /dev/null llvm/include/llvm/System/TimeValue.h:1.1 *** /dev/null Fri Sep 24 18:25:29 2004 --- llvm/include/llvm/System/TimeValue.h Fri Sep 24 18:25:19 2004 *************** *** 0 **** --- 1,391 ---- + //===-- TimeValue.h - Declare OS TimeValue 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 declares the operating system TimeValue concept. + // + //===----------------------------------------------------------------------===// + + #include + + #ifndef LLVM_SYSTEM_TIMEVALUE_H + #define LLVM_SYSTEM_TIMEVALUE_H + + namespace llvm { + namespace sys { + /// This class is used where a precise fixed point in time is required. The + /// range of TimeValue spans many hundreds of billions of years both past and + /// present. The precision of TimeValue is to the nanosecond. However, actual + /// precision of values will be determined by the resolution of the system clock. + /// The TimeValue class is used in conjunction with several other lib/System + /// interfaces to specify the time at which a call should timeout, etc. + /// @since 1.4 + /// @brief Provides an abstraction for a fixed point in time. + class TimeValue { + /// @name Constants + /// @{ + public: + + /// A constant TimeValue representing the smallest time + /// value permissable by the class. min_time is some point + /// in the distant past, about 300 billion years BC. + /// @brief The smallest possible time value. + static const TimeValue MinTime; + + /// A constant TimeValue representing the largest time + /// value permissable by the class. max_time is some point + /// in the distant future, about 300 billion years AD. + /// @brief The largest possible time value. + static const TimeValue MaxTime; + + /// A constant TimeValue representing the base time, + /// or zero time of 00:00:00 (midnight) January 1st, 2000. + /// @brief 00:00:00 Jan 1, 2000 UTC. + static const TimeValue ZeroTime; + + /// A constant TimeValue for the posix base time which is + /// 00:00:00 (midnight) January 1st, 1970. + /// @brief 00:00:00 Jan 1, 1970 UTC. + static const TimeValue PosixZeroTime; + + /// A constant TimeValue for the win32 base time which is + /// 00:00:00 (midnight) January 1st, 1601. + /// @brief 00:00:00 Jan 1, 1601 UTC. + static const TimeValue Win32ZeroTime; + + /// @} + /// @name Types + /// @{ + public: + typedef int64_t SecondsType; ///< Type used for representing seconds. + typedef int32_t NanoSecondsType; ///< Type used for representing nanoseconds. + + enum TimeConversions { + NANOSECONDS_PER_SECOND = 1000000000, + MICROSECONDS_PER_SECOND = 1000000, + MILLISECONDS_PER_SECOND = 1000, + NANOSECONDS_PER_MICROSECOND = 1000, + NANOSECONDS_PER_MILLISECOND = 1000000, + NANOSECONDS_PER_POSIX_TICK = 100, + NANOSECONDS_PER_WIN32_TICK = 100, + }; + + /// @} + /// @name Constructors + /// @{ + public: + /// Value is initialized to zero_time. + /// @brief Default Constructor + TimeValue () + : seconds_(0), nanos_(0) {} + + /// Caller provides the exact value in seconds and + /// nano-seconds. The \p nsec argument defaults to + /// zero for convenience. + /// @brief Explicit Constructor. + TimeValue (SecondsType seconds, NanoSecondsType nanos = 0) + : seconds_( seconds ) + , nanos_( nanos ) + { + this->normalize(); + } + + /// Caller provides the exact value in in seconds with the + /// fractional part represengin nanoseconds. + /// @brief Double Constructor. + TimeValue( double time ) + : seconds_( 0 ) , nanos_ ( 0 ) + { + this->set( time ); + } + + /// Copies one TimeValue to another. + /// @brief Copy Constructor. + TimeValue( const TimeValue & that ) + : seconds_( that.seconds_ ) , nanos_( that.nanos_ ) { } + + // + /// @} + /// @name Operators + /// @{ + public: + /// Assigns the value of \p that TimeValue to \p this + /// @brief Assignment operator. + TimeValue& operator = ( const TimeValue& that ) { + this->set( that ); + return *this; + } + + /// Assigns the value of \p that floating point value to \p this. + /// The \p that vlue is assumed to be in seconds format with + /// the fraction indicating the number of nanoseconds. + /// @brief Assignment operator. + TimeValue& operator = ( double that ) { + this->set( that ); + return *this; + } + + /// Add \p that to \p this. + /// @returns this + /// @brief Incrementing assignment operator. + TimeValue& operator += (const TimeValue& that ) { + this->seconds_ += that.seconds_ ; + this->nanos_ += that.nanos_ ; + this->normalize(); + return *this; + } + + /// Add \p addend to \p this. \p addend is assumed to be in seconds + /// format with the fraction providing nanoseconds. + /// @returns this + /// @brief Incrementing assignment operator. + TimeValue& operator += ( double addend ) { + SecondsType seconds_part = static_cast( addend ); + NanoSecondsType nanos_part = static_cast( + (addend - static_cast(seconds_part)) * NANOSECONDS_PER_SECOND ); + this->seconds_ += seconds_part; + this->nanos_ += nanos_part; + this->normalize(); + return *this; + } + + /// Subtract \p that from \p this. + /// @returns this + /// @brief Decrementing assignment operator. + TimeValue& operator -= (const TimeValue &that ) { + this->seconds_ -= that.seconds_ ; + this->nanos_ -= that.nanos_ ; + this->normalize(); + return *this; + } + + /// Add \p that to \p this. \p that is assumed to be in seconds + /// format with the fraction providing nanoseconds. + /// @returns this + /// @brief Decrementing assignment operator. + TimeValue& operator -= ( double subtrahend ) { + SecondsType seconds_part = static_cast( subtrahend ); + NanoSecondsType nanos_part = static_cast( + (subtrahend - static_cast(seconds_part)) * NANOSECONDS_PER_SECOND ); + this->seconds_ -= seconds_part; + this->nanos_ -= nanos_part; + this->normalize(); + return *this; + } + + /// @brief True if this < that. + int operator < (const TimeValue &that) const { return that > *this; } + + /// @brief True if this > that. + int operator > (const TimeValue &that) const { + if ( this->seconds_ > that.seconds_ ) + { + return 1; + } + else if ( this->seconds_ == that.seconds_ ) + { + if ( this->nanos_ > that.nanos_ ) return 1; + } + return 0; + } + + /// @brief True if this <= that. + int operator <= (const TimeValue &that) const { return that >= *this; } + + /// @brief True if this >= that. + int operator >= (const TimeValue &that) const { + if ( this->seconds_ > that.seconds_ ) + { + return 1; + } + else if ( this->seconds_ == that.seconds_ ) + { + if ( this->nanos_ >= that.nanos_ ) return 1; + } + return 0; + } + + /// @brief True if this == that. + int operator == (const TimeValue &that) const { + return (this->seconds_ == that.seconds_) && + (this->nanos_ == that.nanos_); + } + + /// @brief True if this != that. + int operator != (const TimeValue &that) const { return !(*this == that); } + + /// Adds two TimeValue objects together. + /// @returns The sum of the two operands as a new TimeValue + /// @brief Addition operator. + friend TimeValue operator + (const TimeValue &tv1, const TimeValue &tv2); + + /// Subtracts two TimeValue objects. + /// @returns The difference of the two operands as a new TimeValue + /// @brief Subtraction operator. + friend TimeValue operator - (const TimeValue &tv1, const TimeValue &tv2); + + /// @} + /// @name Accessors + /// @{ + public: + + /// @brief Retrieve the seconds component + SecondsType seconds( void ) const { return seconds_; } + + /// @brief Retrieve the nanoseconds component. + NanoSecondsType nanoseconds( void ) const { return nanos_; } + + /// @brief Retrieve the fractional part as microseconds; + uint32_t microseconds( void ) const { + return nanos_ / NANOSECONDS_PER_MICROSECOND; + } + + /// @brief Retrieve the fractional part as milliseconds; + uint32_t milliseconds( void ) const { + return nanos_ / NANOSECONDS_PER_MILLISECOND; + } + + /// @brief Convert to a number of microseconds (can overflow) + uint64_t usec( void ) const { + return seconds_ * MICROSECONDS_PER_SECOND + + ( nanos_ / NANOSECONDS_PER_MICROSECOND ); + } + + /// @brief Convert to a number of milliseconds (can overflow) + uint64_t msec( void ) const { + return seconds_ * MILLISECONDS_PER_SECOND + ( nanos_ / NANOSECONDS_PER_MILLISECOND ); + } + + /// @brief Convert to unix time (100 nanoseconds since 12:00:00a Jan 1, 1970) + uint64_t posix_time( void ) const { + uint64_t result = seconds_ - PosixZeroTime.seconds_; + result += nanos_ / NANOSECONDS_PER_POSIX_TICK; + return result; + } + + /// @brief Convert to windows time (seconds since 12:00:00a Jan 1, 1601) + uint64_t win32_time( void ) const { + uint64_t result = seconds_ - Win32ZeroTime.seconds_; + result += nanos_ / NANOSECONDS_PER_WIN32_TICK; + return result; + } + + /// @brief Convert to timespec time (ala POSIX.1b) + void timespecTime( uint64_t& seconds, uint32_t& nanos ) const { + nanos = nanos_; + seconds = seconds_ - PosixZeroTime.seconds_; + } + + /// @} + /// @name Mutators + /// @{ + /// @brief Set a TimeValue from the two component values. + void set (SecondsType secs, NanoSecondsType nanos) { + this->seconds_ = secs; + this->nanos_ = nanos; + this->normalize(); + } + + /// @brief Set a TimeValue from another + void set ( const TimeValue & that ) { + this->seconds_ = that.seconds_; + this->nanos_ = that.nanos_; + } + + /// The double value is assumed to be in seconds format, with any + /// remainder treated as nanoseconds. + /// @brief Set a TimeValue from a double. + void set (double new_time) { + SecondsType integer_part = static_cast( new_time ); + seconds_ = integer_part; + nanos_ = static_cast( (new_time - static_cast(integer_part)) * NANOSECONDS_PER_SECOND ); + this->normalize(); + } + + /// The seconds component of the timevalue is set to \p sec without + /// modifying the nanoseconds part. This is useful for whole second arithmetic. + /// @brief Set the seconds component. + void seconds (SecondsType sec ) { + this->seconds_ = sec; + this->normalize(); + } + + /// The seconds component remains unchanged. + /// @brief Set the nanoseconds component using a number of nanoseconds. + void nanoseconds ( NanoSecondsType nanos ) { + this->nanos_ = nanos; + this->normalize(); + } + + /// The seconds component remains unchanged. + /// @brief Set the nanoseconds component using a number of microseconds. + void microseconds ( int32_t micros ) { + this->nanos_ = micros * NANOSECONDS_PER_MICROSECOND; + this->normalize(); + }; + + /// The seconds component remains unchanged. + /// @brief Set the nanoseconds component using a number of milliseconds. + void milliseconds ( int32_t millis ) { + this->nanos_ = millis * NANOSECONDS_PER_MILLISECOND; + this->normalize(); + }; + + /// @brief Converts from microsecond format to TimeValue format + void usec( int64_t microseconds ) { + this->seconds_ = microseconds / MICROSECONDS_PER_SECOND; + this->nanos_ = (microseconds % MICROSECONDS_PER_SECOND) * + NANOSECONDS_PER_MICROSECOND; + this->normalize(); + } + + /// @brief Converts from millisecond format to TimeValue format + void msec( int64_t milliseconds ) { + this->seconds_ = milliseconds / MILLISECONDS_PER_SECOND; + this->nanos_ = (milliseconds % MILLISECONDS_PER_SECOND) * + NANOSECONDS_PER_MILLISECOND; + this->normalize(); + } + + /// This causes the values to be represented so that the fractional + /// part is minimized, possibly incrementing the seconds part. + /// @brief Normalize to canonical form. + void normalize (void); + + /// @brief Sets \p this to the current time (UTC). + void now( void ); + + /// @} + /// @name Data + /// @{ + private: + /// Store the values as a . + SecondsType seconds_; ///< Stores the seconds component of the TimeVal + NanoSecondsType nanos_; ///< Stores the nanoseconds component of the TimeVal + + /// @} + + }; + + inline TimeValue operator + (const TimeValue &tv1, const TimeValue &tv2) { + TimeValue sum (tv1.seconds_ + tv2.seconds_, tv1.nanos_ + tv2.nanos_); + sum.normalize (); + return sum; + } + + inline TimeValue operator - (const TimeValue &tv1, const TimeValue &tv2) { + TimeValue difference (tv1.seconds_ - tv2.seconds_, tv1.nanos_ - tv2.nanos_ ); + difference.normalize (); + return difference; + } + + } + } + + // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab + #endif From reid at x10sys.com Sat Sep 25 00:03:33 2004 From: reid at x10sys.com (Reid Spencer) Date: Sat, 25 Sep 2004 00:03:33 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Linux/TimeValue.cpp Message-ID: <200409250503.AAA10677@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Linux: TimeValue.cpp updated: 1.1 -> 1.2 --- Log message: Wrap to 80 cols. --- Diffs of the changes: (+2 -1) Index: llvm/lib/System/Linux/TimeValue.cpp diff -u llvm/lib/System/Linux/TimeValue.cpp:1.1 llvm/lib/System/Linux/TimeValue.cpp:1.2 --- llvm/lib/System/Linux/TimeValue.cpp:1.1 Fri Sep 24 18:25:19 2004 +++ llvm/lib/System/Linux/TimeValue.cpp Sat Sep 25 00:03:22 2004 @@ -30,7 +30,8 @@ ThrowErrno("Couldn't obtain time of day"); this->set( static_cast( the_time.tv_sec ), - static_cast( the_time.tv_usec * NANOSECONDS_PER_MICROSECOND ) ); + static_cast( the_time.tv_usec * + NANOSECONDS_PER_MICROSECOND ) ); } // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab From reid at x10sys.com Sat Sep 25 00:04:05 2004 From: reid at x10sys.com (Reid Spencer) Date: Sat, 25 Sep 2004 00:04:05 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/SunOS/TimeValue.cpp Message-ID: <200409250504.AAA10726@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/SunOS: TimeValue.cpp added (r1.1) --- Log message: Added stub implementations of TimeValue concept for remaining platforms. --- Diffs of the changes: (+39 -0) Index: llvm/lib/System/SunOS/TimeValue.cpp diff -c /dev/null llvm/lib/System/SunOS/TimeValue.cpp:1.1 *** /dev/null Sat Sep 25 00:04:04 2004 --- llvm/lib/System/SunOS/TimeValue.cpp Sat Sep 25 00:03:54 2004 *************** *** 0 **** --- 1,39 ---- + //===- SunOS/TimeValue.cpp - SunOS TimeValue 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 TimeValue class. + // + //===----------------------------------------------------------------------===// + + // Include the generic Unix implementation + #include "../Unix/Unix.h" + #include + + namespace llvm { + using namespace sys; + + //===----------------------------------------------------------------------===// + //=== WARNING: Implementation here must contain only SunOS specific code + //=== and must not be generic UNIX code (see ../Unix/TimeValue.cpp) + //===----------------------------------------------------------------------===// + + void TimeValue::now() { + struct timeval the_time; + timerclear(&the_time); + if (0 != ::gettimeofday(&the_time,0)) + ThrowErrno("Couldn't obtain time of day"); + + this->set( static_cast( the_time.tv_sec ), + static_cast( the_time.tv_usec * + NANOSECONDS_PER_MICROSECOND ) ); + } + + // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab + + } From reid at x10sys.com Sat Sep 25 00:04:05 2004 From: reid at x10sys.com (Reid Spencer) Date: Sat, 25 Sep 2004 00:04:05 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/AIX/TimeValue.cpp Message-ID: <200409250504.AAA10723@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/AIX: TimeValue.cpp added (r1.1) --- Log message: Added stub implementations of TimeValue concept for remaining platforms. --- Diffs of the changes: (+29 -0) Index: llvm/lib/System/AIX/TimeValue.cpp diff -c /dev/null llvm/lib/System/AIX/TimeValue.cpp:1.1 *** /dev/null Sat Sep 25 00:04:04 2004 --- llvm/lib/System/AIX/TimeValue.cpp Sat Sep 25 00:03:53 2004 *************** *** 0 **** --- 1,29 ---- + //===- AIX/TimeValue.cpp - AIX TimeValue 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 TimeValue class. + // + //===----------------------------------------------------------------------===// + + // Include the generic Unix implementation + #include "../Unix/Unix.h" + + namespace llvm { + using namespace sys; + + //===----------------------------------------------------------------------===// + //=== WARNING: Implementation here must contain only AIX specific code + //=== and must not be generic UNIX code (see ../Unix/TimeValue.cpp) + //===----------------------------------------------------------------------===// + + // FIXME: Need TimeValue::now() + + // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab + + } From reid at x10sys.com Sat Sep 25 00:04:05 2004 From: reid at x10sys.com (Reid Spencer) Date: Sat, 25 Sep 2004 00:04:05 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Unix/TimeValue.cpp Message-ID: <200409250504.AAA10724@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Unix: TimeValue.cpp added (r1.1) --- Log message: Added stub implementations of TimeValue concept for remaining platforms. --- Diffs of the changes: (+22 -0) Index: llvm/lib/System/Unix/TimeValue.cpp diff -c /dev/null llvm/lib/System/Unix/TimeValue.cpp:1.1 *** /dev/null Sat Sep 25 00:04:04 2004 --- llvm/lib/System/Unix/TimeValue.cpp Sat Sep 25 00:03:54 2004 *************** *** 0 **** --- 1,22 ---- + //===- Unix/TimeValue.cpp - Unix TimeValue 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 TimeValue class. + // + //===----------------------------------------------------------------------===// + + //===----------------------------------------------------------------------===// + //=== WARNING: Implementation here must contain only generic UNIX code that + //=== is guaranteed to work on *all* UNIX variants. + //===----------------------------------------------------------------------===// + + #include "Unix.h" + + } + // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab From reid at x10sys.com Sat Sep 25 00:04:05 2004 From: reid at x10sys.com (Reid Spencer) Date: Sat, 25 Sep 2004 00:04:05 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/FreeBSD/TimeValue.cpp Message-ID: <200409250504.AAA10725@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/FreeBSD: TimeValue.cpp added (r1.1) --- Log message: Added stub implementations of TimeValue concept for remaining platforms. --- Diffs of the changes: (+29 -0) Index: llvm/lib/System/FreeBSD/TimeValue.cpp diff -c /dev/null llvm/lib/System/FreeBSD/TimeValue.cpp:1.1 *** /dev/null Sat Sep 25 00:04:04 2004 --- llvm/lib/System/FreeBSD/TimeValue.cpp Sat Sep 25 00:03:54 2004 *************** *** 0 **** --- 1,29 ---- + //===- FreeBSD/TimeValue.cpp - FreeBSD TimeValue 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 FreeBSD implementation of the TimeValue class. + // + //===----------------------------------------------------------------------===// + + // Include the generic Unix implementation + #include "../Unix/Unix.h" + + namespace llvm { + using namespace sys; + + //===----------------------------------------------------------------------===// + //=== WARNING: Implementation here must contain only FreeBSD specific code + //=== and must not be generic UNIX code (see ../Unix/TimeValue.cpp) + //===----------------------------------------------------------------------===// + + // FIXME: Need TimeValue::now() + + // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab + + } From reid at x10sys.com Sat Sep 25 00:04:05 2004 From: reid at x10sys.com (Reid Spencer) Date: Sat, 25 Sep 2004 00:04:05 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Interix/TimeValue.cpp Message-ID: <200409250504.AAA10733@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Interix: TimeValue.cpp added (r1.1) --- Log message: Added stub implementations of TimeValue concept for remaining platforms. --- Diffs of the changes: (+29 -0) Index: llvm/lib/System/Interix/TimeValue.cpp diff -c /dev/null llvm/lib/System/Interix/TimeValue.cpp:1.1 *** /dev/null Sat Sep 25 00:04:04 2004 --- llvm/lib/System/Interix/TimeValue.cpp Sat Sep 25 00:03:54 2004 *************** *** 0 **** --- 1,29 ---- + //===- Interix/TimeValue.cpp - Interix TimeValue 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 Interix implementation of the TimeValue class. + // + //===----------------------------------------------------------------------===// + + // Include the generic Unix implementation + #include "../Unix/Unix.h" + + namespace llvm { + using namespace sys; + + //===----------------------------------------------------------------------===// + //=== WARNING: Implementation here must contain only Interix specific code + //=== and must not be generic UNIX code (see ../Unix/TimeValue.cpp) + //===----------------------------------------------------------------------===// + + // FIXME: Need TimeValue::now() + + // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab + + } From reid at x10sys.com Sat Sep 25 00:04:05 2004 From: reid at x10sys.com (Reid Spencer) Date: Sat, 25 Sep 2004 00:04:05 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Darwin/TimeValue.cpp Message-ID: <200409250504.AAA10736@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Darwin: TimeValue.cpp added (r1.1) --- Log message: Added stub implementations of TimeValue concept for remaining platforms. --- Diffs of the changes: (+29 -0) Index: llvm/lib/System/Darwin/TimeValue.cpp diff -c /dev/null llvm/lib/System/Darwin/TimeValue.cpp:1.1 *** /dev/null Sat Sep 25 00:04:04 2004 --- llvm/lib/System/Darwin/TimeValue.cpp Sat Sep 25 00:03:54 2004 *************** *** 0 **** --- 1,29 ---- + //===- Darwin/TimeValue.cpp - Darwin TimeValue 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 TimeValue class. + // + //===----------------------------------------------------------------------===// + + // Include the generic Unix implementation + #include "../Unix/Unix.h" + + namespace llvm { + using namespace sys; + + //===----------------------------------------------------------------------===// + //=== WARNING: Implementation here must contain only Darwin specific code + //=== and must not be generic UNIX code (see ../Unix/TimeValue.cpp) + //===----------------------------------------------------------------------===// + + // FIXME: Need TimeValue::now() + + // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab + + } From reid at x10sys.com Sat Sep 25 00:04:05 2004 From: reid at x10sys.com (Reid Spencer) Date: Sat, 25 Sep 2004 00:04:05 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Cygwin/TimeValue.cpp Message-ID: <200409250504.AAA10737@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Cygwin: TimeValue.cpp added (r1.1) --- Log message: Added stub implementations of TimeValue concept for remaining platforms. --- Diffs of the changes: (+29 -0) Index: llvm/lib/System/Cygwin/TimeValue.cpp diff -c /dev/null llvm/lib/System/Cygwin/TimeValue.cpp:1.1 *** /dev/null Sat Sep 25 00:04:04 2004 --- llvm/lib/System/Cygwin/TimeValue.cpp Sat Sep 25 00:03:54 2004 *************** *** 0 **** --- 1,29 ---- + //===- Cygwin/TimeValue.cpp - Cygwin TimeValue 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 TimeValue class. + // + //===----------------------------------------------------------------------===// + + // Include the generic Unix implementation + #include "../Unix/Unix.h" + + namespace llvm { + using namespace sys; + + //===----------------------------------------------------------------------===// + //=== WARNING: Implementation here must contain only Cygwin specific code + //=== and must not be generic UNIX code (see ../Unix/TimeValue.cpp) + //===----------------------------------------------------------------------===// + + // FIXME: Need TimeValue::now() + + // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab + + } From reid at x10sys.com Sat Sep 25 00:04:05 2004 From: reid at x10sys.com (Reid Spencer) Date: Sat, 25 Sep 2004 00:04:05 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Win32/TimeValue.cpp Message-ID: <200409250504.AAA10738@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Win32: TimeValue.cpp added (r1.1) --- Log message: Added stub implementations of TimeValue concept for remaining platforms. --- Diffs of the changes: (+29 -0) Index: llvm/lib/System/Win32/TimeValue.cpp diff -c /dev/null llvm/lib/System/Win32/TimeValue.cpp:1.1 *** /dev/null Sat Sep 25 00:04:04 2004 --- llvm/lib/System/Win32/TimeValue.cpp Sat Sep 25 00:03:54 2004 *************** *** 0 **** --- 1,29 ---- + //===- Win32/TimeValue.cpp - Win32 TimeValue 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 TimeValue class. + // + //===----------------------------------------------------------------------===// + + // Include the generic Unix implementation + #include "../Unix/Unix.h" + + namespace llvm { + using namespace sys; + + //===----------------------------------------------------------------------===// + //=== WARNING: Implementation here must contain only Win32 specific code + //=== and must not be generic UNIX code (see ../Unix/TimeValue.cpp) + //===----------------------------------------------------------------------===// + + // FIXME: Need TimeValue::now() + + // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab + + } From reid at x10sys.com Sat Sep 25 03:30:08 2004 From: reid at x10sys.com (Reid Spencer) Date: Sat, 25 Sep 2004 03:30:08 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/System/TimeValue.h Message-ID: <200409250830.DAA25699@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/System: TimeValue.h updated: 1.1 -> 1.2 --- Log message: Clean up the interface of TimeValue: - get rid of unneeded constructors - get rid of duplicate methods/constructors/operators - normalize to LLVM coding standards - wrap to 80 columns. Many thanks to Alkis Evlogimenos for his suggestions. --- Diffs of the changes: (+177 -213) Index: llvm/include/llvm/System/TimeValue.h diff -u llvm/include/llvm/System/TimeValue.h:1.1 llvm/include/llvm/System/TimeValue.h:1.2 --- llvm/include/llvm/System/TimeValue.h:1.1 Fri Sep 24 18:25:19 2004 +++ llvm/include/llvm/System/TimeValue.h Sat Sep 25 03:29:54 2004 @@ -20,25 +20,27 @@ namespace sys { /// This class is used where a precise fixed point in time is required. The /// range of TimeValue spans many hundreds of billions of years both past and - /// present. The precision of TimeValue is to the nanosecond. However, actual - /// precision of values will be determined by the resolution of the system clock. - /// The TimeValue class is used in conjunction with several other lib/System - /// interfaces to specify the time at which a call should timeout, etc. + /// present. The precision of TimeValue is to the nanosecond. However, the + /// actual precision of its values will be determined by the resolution of + /// the system clock. The TimeValue class is used in conjunction with several + /// other lib/System interfaces to specify the time at which a call should + /// timeout, etc. /// @since 1.4 /// @brief Provides an abstraction for a fixed point in time. class TimeValue { + /// @name Constants /// @{ public: /// A constant TimeValue representing the smallest time - /// value permissable by the class. min_time is some point - /// in the distant past, about 300 billion years BC. + /// value permissable by the class. MinTime is some point + /// in the distant past, about 300 billion years BCE. /// @brief The smallest possible time value. static const TimeValue MinTime; /// A constant TimeValue representing the largest time - /// value permissable by the class. max_time is some point + /// value permissable by the class. MaxTime is some point /// in the distant future, about 300 billion years AD. /// @brief The largest possible time value. static const TimeValue MaxTime; @@ -48,12 +50,12 @@ /// @brief 00:00:00 Jan 1, 2000 UTC. static const TimeValue ZeroTime; - /// A constant TimeValue for the posix base time which is + /// A constant TimeValue for the Posix base time which is /// 00:00:00 (midnight) January 1st, 1970. /// @brief 00:00:00 Jan 1, 1970 UTC. static const TimeValue PosixZeroTime; - /// A constant TimeValue for the win32 base time which is + /// A constant TimeValue for the Win32 base time which is /// 00:00:00 (midnight) January 1st, 1601. /// @brief 00:00:00 Jan 1, 1601 UTC. static const TimeValue Win32ZeroTime; @@ -66,70 +68,47 @@ typedef int32_t NanoSecondsType; ///< Type used for representing nanoseconds. enum TimeConversions { - NANOSECONDS_PER_SECOND = 1000000000, - MICROSECONDS_PER_SECOND = 1000000, - MILLISECONDS_PER_SECOND = 1000, - NANOSECONDS_PER_MICROSECOND = 1000, - NANOSECONDS_PER_MILLISECOND = 1000000, - NANOSECONDS_PER_POSIX_TICK = 100, - NANOSECONDS_PER_WIN32_TICK = 100, + NANOSECONDS_PER_SECOND = 1000000000, ///< One Billion + MICROSECONDS_PER_SECOND = 1000000, ///< One Million + MILLISECONDS_PER_SECOND = 1000, ///< One Thousand + NANOSECONDS_PER_MICROSECOND = 1000, ///< One Thousand + NANOSECONDS_PER_MILLISECOND = 1000000,///< One Million + NANOSECONDS_PER_POSIX_TICK = 100, ///< Posix tick is 100 Hz (10ms) + NANOSECONDS_PER_WIN32_TICK = 100, ///< Win32 tick is 100 Hz (10ms) }; /// @} /// @name Constructors /// @{ public: - /// Value is initialized to zero_time. - /// @brief Default Constructor - TimeValue () - : seconds_(0), nanos_(0) {} - - /// Caller provides the exact value in seconds and - /// nano-seconds. The \p nsec argument defaults to - /// zero for convenience. - /// @brief Explicit Constructor. - TimeValue (SecondsType seconds, NanoSecondsType nanos = 0) + /// Caller provides the exact value in seconds and nanoseconds. The + /// \p nanos argument defaults to zero for convenience. + /// @brief Explicit constructor + explicit TimeValue (SecondsType seconds, NanoSecondsType nanos = 0) : seconds_( seconds ) - , nanos_( nanos ) - { - this->normalize(); - } + , nanos_( nanos ) { this->normalize(); } - /// Caller provides the exact value in in seconds with the - /// fractional part represengin nanoseconds. + /// Caller provides the exact value as a double in seconds with the + /// fractional part representing nanoseconds. /// @brief Double Constructor. - TimeValue( double time ) - : seconds_( 0 ) , nanos_ ( 0 ) - { - this->set( time ); + explicit TimeValue( double new_time ) + : seconds_( 0 ) , nanos_ ( 0 ) { + SecondsType integer_part = static_cast( new_time ); + seconds_ = integer_part; + nanos_ = static_cast( (new_time - + static_cast(integer_part)) * NANOSECONDS_PER_SECOND ); + this->normalize(); } - /// Copies one TimeValue to another. - /// @brief Copy Constructor. - TimeValue( const TimeValue & that ) - : seconds_( that.seconds_ ) , nanos_( that.nanos_ ) { } + /// This is a static constructor that returns a TimeValue that represents + /// the current time. + /// @brief Creates a TimeValue with the current time (UTC). + static TimeValue now(); - // /// @} /// @name Operators /// @{ public: - /// Assigns the value of \p that TimeValue to \p this - /// @brief Assignment operator. - TimeValue& operator = ( const TimeValue& that ) { - this->set( that ); - return *this; - } - - /// Assigns the value of \p that floating point value to \p this. - /// The \p that vlue is assumed to be in seconds format with - /// the fraction indicating the number of nanoseconds. - /// @brief Assignment operator. - TimeValue& operator = ( double that ) { - this->set( that ); - return *this; - } - /// Add \p that to \p this. /// @returns this /// @brief Incrementing assignment operator. @@ -140,20 +119,6 @@ return *this; } - /// Add \p addend to \p this. \p addend is assumed to be in seconds - /// format with the fraction providing nanoseconds. - /// @returns this - /// @brief Incrementing assignment operator. - TimeValue& operator += ( double addend ) { - SecondsType seconds_part = static_cast( addend ); - NanoSecondsType nanos_part = static_cast( - (addend - static_cast(seconds_part)) * NANOSECONDS_PER_SECOND ); - this->seconds_ += seconds_part; - this->nanos_ += nanos_part; - this->normalize(); - return *this; - } - /// Subtract \p that from \p this. /// @returns this /// @brief Decrementing assignment operator. @@ -164,58 +129,51 @@ return *this; } - /// Add \p that to \p this. \p that is assumed to be in seconds - /// format with the fraction providing nanoseconds. - /// @returns this - /// @brief Decrementing assignment operator. - TimeValue& operator -= ( double subtrahend ) { - SecondsType seconds_part = static_cast( subtrahend ); - NanoSecondsType nanos_part = static_cast( - (subtrahend - static_cast(seconds_part)) * NANOSECONDS_PER_SECOND ); - this->seconds_ -= seconds_part; - this->nanos_ -= nanos_part; - this->normalize(); - return *this; - } - + /// Determine if \p this is less than \p that. + /// @returns True iff *this < that. /// @brief True if this < that. int operator < (const TimeValue &that) const { return that > *this; } + /// Determine if \p this is greather than \p that. + /// @returns True iff *this > that. /// @brief True if this > that. int operator > (const TimeValue &that) const { - if ( this->seconds_ > that.seconds_ ) - { + if ( this->seconds_ > that.seconds_ ) { return 1; - } - else if ( this->seconds_ == that.seconds_ ) - { + } else if ( this->seconds_ == that.seconds_ ) { if ( this->nanos_ > that.nanos_ ) return 1; } return 0; } + /// Determine if \p this is less than or equal to \p that. + /// @returns True iff *this <= that. /// @brief True if this <= that. int operator <= (const TimeValue &that) const { return that >= *this; } + /// Determine if \p this is greater than or equal to \p that. + /// @returns True iff *this >= that. /// @brief True if this >= that. int operator >= (const TimeValue &that) const { - if ( this->seconds_ > that.seconds_ ) - { + if ( this->seconds_ > that.seconds_ ) { return 1; - } - else if ( this->seconds_ == that.seconds_ ) - { + } else if ( this->seconds_ == that.seconds_ ) { if ( this->nanos_ >= that.nanos_ ) return 1; } return 0; } + /// Determines if two TimeValue objects represent the same moment in time. + /// @brief True iff *this == that. /// @brief True if this == that. int operator == (const TimeValue &that) const { return (this->seconds_ == that.seconds_) && (this->nanos_ == that.nanos_); } + /// Determines if two TimeValue objects represent times that are not the + /// same. + /// @return True iff *this != that. /// @brief True if this != that. int operator != (const TimeValue &that) const { return !(*this == that); } @@ -234,139 +192,145 @@ /// @{ public: - /// @brief Retrieve the seconds component - SecondsType seconds( void ) const { return seconds_; } - - /// @brief Retrieve the nanoseconds component. - NanoSecondsType nanoseconds( void ) const { return nanos_; } - - /// @brief Retrieve the fractional part as microseconds; - uint32_t microseconds( void ) const { - return nanos_ / NANOSECONDS_PER_MICROSECOND; - } - - /// @brief Retrieve the fractional part as milliseconds; - uint32_t milliseconds( void ) const { - return nanos_ / NANOSECONDS_PER_MILLISECOND; - } - - /// @brief Convert to a number of microseconds (can overflow) - uint64_t usec( void ) const { - return seconds_ * MICROSECONDS_PER_SECOND + - ( nanos_ / NANOSECONDS_PER_MICROSECOND ); - } - - /// @brief Convert to a number of milliseconds (can overflow) - uint64_t msec( void ) const { - return seconds_ * MILLISECONDS_PER_SECOND + ( nanos_ / NANOSECONDS_PER_MILLISECOND ); - } - - /// @brief Convert to unix time (100 nanoseconds since 12:00:00a Jan 1, 1970) - uint64_t posix_time( void ) const { - uint64_t result = seconds_ - PosixZeroTime.seconds_; - result += nanos_ / NANOSECONDS_PER_POSIX_TICK; - return result; - } - - /// @brief Convert to windows time (seconds since 12:00:00a Jan 1, 1601) - uint64_t win32_time( void ) const { - uint64_t result = seconds_ - Win32ZeroTime.seconds_; - result += nanos_ / NANOSECONDS_PER_WIN32_TICK; - return result; - } - - /// @brief Convert to timespec time (ala POSIX.1b) - void timespecTime( uint64_t& seconds, uint32_t& nanos ) const { - nanos = nanos_; - seconds = seconds_ - PosixZeroTime.seconds_; - } + /// Returns only the seconds component of the TimeValue. The nanoseconds + /// portion is ignored. No rounding is performed. + /// @brief Retrieve the seconds component + SecondsType seconds( void ) const { return seconds_; } + + /// Returns only the nanoseconds component of the TimeValue. The seconds + /// portion is ignored. + /// @brief Retrieve the nanoseconds component. + NanoSecondsType nanoseconds( void ) const { return nanos_; } + + /// Returns only the fractional portion of the TimeValue rounded down to the + /// nearest microsecond (divide by one thousand). + /// @brief Retrieve the fractional part as microseconds; + uint32_t microseconds( void ) const { + return nanos_ / NANOSECONDS_PER_MICROSECOND; + } + + /// Returns only the fractional portion of the TimeValue rounded down to the + /// nearest millisecond (divide by one million). + /// @brief Retrieve the fractional part as milliseconds; + uint32_t milliseconds( void ) const { + return nanos_ / NANOSECONDS_PER_MILLISECOND; + } + + /// Returns the TimeValue as a number of microseconds. Note that the value + /// returned can overflow because the range of a uint64_t is smaller than + /// the range of a TimeValue. Nevertheless, this is useful on some operating + /// systems and is therefore provided. + /// @brief Convert to a number of microseconds (can overflow) + uint64_t usec( void ) const { + return seconds_ * MICROSECONDS_PER_SECOND + + ( nanos_ / NANOSECONDS_PER_MICROSECOND ); + } + + /// Returns the TimeValue as a number of milliseconds. Note that the value + /// returned can overflow because the range of a uint64_t is smaller than + /// the range of a TimeValue. Nevertheless, this is useful on some operating + /// systems and is therefore provided. + /// @brief Convert to a number of milliseconds (can overflow) + uint64_t msec( void ) const { + return seconds_ * MILLISECONDS_PER_SECOND + + ( nanos_ / NANOSECONDS_PER_MILLISECOND ); + } + + /// Converts the TimeValue into the corresponding number of "ticks" for + /// Posix, correcting for the difference in Posix zero time. + /// @brief Convert to unix time (100 nanoseconds since 12:00:00a Jan 1,1970) + uint64_t ToPosixTime( void ) const { + uint64_t result = seconds_ - PosixZeroTime.seconds_; + result += nanos_ / NANOSECONDS_PER_POSIX_TICK; + return result; + } + + /// Converts the TiemValue into the correspodning number of "ticks" for + /// Win32 platforms, correcting for the difference in Win32 zero time. + /// @brief Convert to windows time (seconds since 12:00:00a Jan 1, 1601) + uint64_t ToWin32Time( void ) const { + uint64_t result = seconds_ - Win32ZeroTime.seconds_; + result += nanos_ / NANOSECONDS_PER_WIN32_TICK; + return result; + } + + /// Provides the seconds and nanoseconds as results in its arguments after + /// correction for the Posix zero time. + /// @brief Convert to timespec time (ala POSIX.1b) + void GetTimespecTime( uint64_t& seconds, uint32_t& nanos ) const { + seconds = seconds_ - PosixZeroTime.seconds_; + nanos = nanos_; + } /// @} /// @name Mutators /// @{ - /// @brief Set a TimeValue from the two component values. - void set (SecondsType secs, NanoSecondsType nanos) { - this->seconds_ = secs; - this->nanos_ = nanos; - this->normalize(); - } - - /// @brief Set a TimeValue from another - void set ( const TimeValue & that ) { - this->seconds_ = that.seconds_; - this->nanos_ = that.nanos_; - } - - /// The double value is assumed to be in seconds format, with any - /// remainder treated as nanoseconds. - /// @brief Set a TimeValue from a double. - void set (double new_time) { - SecondsType integer_part = static_cast( new_time ); - seconds_ = integer_part; - nanos_ = static_cast( (new_time - static_cast(integer_part)) * NANOSECONDS_PER_SECOND ); - this->normalize(); - } - - /// The seconds component of the timevalue is set to \p sec without - /// modifying the nanoseconds part. This is useful for whole second arithmetic. - /// @brief Set the seconds component. - void seconds (SecondsType sec ) { - this->seconds_ = sec; - this->normalize(); - } + public: + /// The seconds component of the TimeValue is set to \p sec without + /// modifying the nanoseconds part. This is useful for whole second arithmetic. + /// @brief Set the seconds component. + void seconds (SecondsType sec ) { + this->seconds_ = sec; + this->normalize(); + } - /// The seconds component remains unchanged. - /// @brief Set the nanoseconds component using a number of nanoseconds. - void nanoseconds ( NanoSecondsType nanos ) { - this->nanos_ = nanos; - this->normalize(); - } + /// The nanoseconds component of the TimeValue is set to \p nanos without + /// modifying the seconds part. This is useful for basic computations + /// involving just the nanoseconds portion. Note that the TimeValue will be + /// normalized after this call so that the fractional (nanoseconds) portion + /// will have the smallest equivalent value. + /// @brief Set the nanoseconds component using a number of nanoseconds. + void nanoseconds ( NanoSecondsType nanos ) { + this->nanos_ = nanos; + this->normalize(); + } - /// The seconds component remains unchanged. - /// @brief Set the nanoseconds component using a number of microseconds. - void microseconds ( int32_t micros ) { - this->nanos_ = micros * NANOSECONDS_PER_MICROSECOND; - this->normalize(); - }; - - /// The seconds component remains unchanged. - /// @brief Set the nanoseconds component using a number of milliseconds. - void milliseconds ( int32_t millis ) { - this->nanos_ = millis * NANOSECONDS_PER_MILLISECOND; - this->normalize(); - }; - - /// @brief Converts from microsecond format to TimeValue format - void usec( int64_t microseconds ) { - this->seconds_ = microseconds / MICROSECONDS_PER_SECOND; - this->nanos_ = (microseconds % MICROSECONDS_PER_SECOND) * - NANOSECONDS_PER_MICROSECOND; - this->normalize(); - } + /// The seconds component remains unchanged. + /// @brief Set the nanoseconds component using a number of microseconds. + void microseconds ( int32_t micros ) { + this->nanos_ = micros * NANOSECONDS_PER_MICROSECOND; + this->normalize(); + }; - /// @brief Converts from millisecond format to TimeValue format - void msec( int64_t milliseconds ) { - this->seconds_ = milliseconds / MILLISECONDS_PER_SECOND; - this->nanos_ = (milliseconds % MILLISECONDS_PER_SECOND) * - NANOSECONDS_PER_MILLISECOND; - this->normalize(); - } + /// The seconds component remains unchanged. + /// @brief Set the nanoseconds component using a number of milliseconds. + void milliseconds ( int32_t millis ) { + this->nanos_ = millis * NANOSECONDS_PER_MILLISECOND; + this->normalize(); + }; - /// This causes the values to be represented so that the fractional - /// part is minimized, possibly incrementing the seconds part. - /// @brief Normalize to canonical form. - void normalize (void); + /// @brief Converts from microsecond format to TimeValue format + void usec( int64_t microseconds ) { + this->seconds_ = microseconds / MICROSECONDS_PER_SECOND; + this->nanos_ = (microseconds % MICROSECONDS_PER_SECOND) * + NANOSECONDS_PER_MICROSECOND; + this->normalize(); + } - /// @brief Sets \p this to the current time (UTC). - void now( void ); + /// @brief Converts from millisecond format to TimeValue format + void msec( int64_t milliseconds ) { + this->seconds_ = milliseconds / MILLISECONDS_PER_SECOND; + this->nanos_ = (milliseconds % MILLISECONDS_PER_SECOND) * + NANOSECONDS_PER_MILLISECOND; + this->normalize(); + } /// @} + /// @name Implementation + /// @{ + private: + /// This causes the values to be represented so that the fractional + /// part is minimized, possibly incrementing the seconds part. + /// @brief Normalize to canonical form. + void normalize (void); + +/// @} /// @name Data /// @{ private: /// Store the values as a . - SecondsType seconds_; ///< Stores the seconds component of the TimeVal - NanoSecondsType nanos_; ///< Stores the nanoseconds component of the TimeVal + SecondsType seconds_;///< Stores the seconds part of the TimeVal + NanoSecondsType nanos_; ///< Stores the nanoseconds part of the TimeVal /// @} From reid at x10sys.com Sat Sep 25 03:32:48 2004 From: reid at x10sys.com (Reid Spencer) Date: Sat, 25 Sep 2004 03:32:48 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Linux/TimeValue.cpp Message-ID: <200409250832.DAA26221@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Linux: TimeValue.cpp updated: 1.2 -> 1.3 --- Log message: Updated to reflect changes in the interface of TimeValue::now(). --- Diffs of the changes: (+5 -4) Index: llvm/lib/System/Linux/TimeValue.cpp diff -u llvm/lib/System/Linux/TimeValue.cpp:1.2 llvm/lib/System/Linux/TimeValue.cpp:1.3 --- llvm/lib/System/Linux/TimeValue.cpp:1.2 Sat Sep 25 00:03:22 2004 +++ llvm/lib/System/Linux/TimeValue.cpp Sat Sep 25 03:32:37 2004 @@ -23,15 +23,16 @@ //=== and must not be generic UNIX code (see ../Unix/TimeValue.cpp) //===----------------------------------------------------------------------===// -void TimeValue::now() { +TimeValue TimeValue::now() { struct timeval the_time; timerclear(&the_time); if (0 != ::gettimeofday(&the_time,0)) ThrowErrno("Couldn't obtain time of day"); - this->set( static_cast( the_time.tv_sec ), - static_cast( the_time.tv_usec * - NANOSECONDS_PER_MICROSECOND ) ); + return TimeValue( + static_cast( the_time.tv_sec ), + static_cast( the_time.tv_usec * + NANOSECONDS_PER_MICROSECOND ) ); } // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab From reid at x10sys.com Sat Sep 25 03:32:48 2004 From: reid at x10sys.com (Reid Spencer) Date: Sat, 25 Sep 2004 03:32:48 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/SunOS/TimeValue.cpp Message-ID: <200409250832.DAA26220@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/SunOS: TimeValue.cpp updated: 1.1 -> 1.2 --- Log message: Updated to reflect changes in the interface of TimeValue::now(). --- Diffs of the changes: (+5 -4) Index: llvm/lib/System/SunOS/TimeValue.cpp diff -u llvm/lib/System/SunOS/TimeValue.cpp:1.1 llvm/lib/System/SunOS/TimeValue.cpp:1.2 --- llvm/lib/System/SunOS/TimeValue.cpp:1.1 Sat Sep 25 00:03:54 2004 +++ llvm/lib/System/SunOS/TimeValue.cpp Sat Sep 25 03:32:37 2004 @@ -23,15 +23,16 @@ //=== and must not be generic UNIX code (see ../Unix/TimeValue.cpp) //===----------------------------------------------------------------------===// -void TimeValue::now() { +TimeValue TimeValue::now() { struct timeval the_time; timerclear(&the_time); if (0 != ::gettimeofday(&the_time,0)) ThrowErrno("Couldn't obtain time of day"); - this->set( static_cast( the_time.tv_sec ), - static_cast( the_time.tv_usec * - NANOSECONDS_PER_MICROSECOND ) ); + return TimeValue( + static_cast( the_time.tv_sec ), + static_cast( the_time.tv_usec * + NANOSECONDS_PER_MICROSECOND ) ); } // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab From reid at x10sys.com Sat Sep 25 10:59:52 2004 From: reid at x10sys.com (Reid Spencer) Date: Sat, 25 Sep 2004 10:59:52 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvm-ld/Linker.cpp Message-ID: <200409251559.KAA29845@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-ld: Linker.cpp updated: 1.1 -> 1.2 --- Log message: Qualify Path with sys:: namespace so this file compiles. --- Diffs of the changes: (+7 -28) Index: llvm/tools/llvm-ld/Linker.cpp diff -u llvm/tools/llvm-ld/Linker.cpp:1.1 llvm/tools/llvm-ld/Linker.cpp:1.2 --- llvm/tools/llvm-ld/Linker.cpp:1.1 Sun Sep 12 20:27:53 2004 +++ llvm/tools/llvm-ld/Linker.cpp Sat Sep 25 10:59:41 2004 @@ -25,6 +25,7 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/FileUtilities.h" #include "llvm/System/Signals.h" +#include "llvm/System/Path.h" #include "llvm/Support/SystemUtils.h" #include #include @@ -43,37 +44,15 @@ const std::vector &Paths, bool SharedObjectOnly) { // Determine if the pathname can be found as it stands. - if (FileOpenable(Filename)) + sys::Path FilePath; + if (FilePath.set_file(Filename) && FilePath.readable()) return Filename; - // If that doesn't work, convert the name into a library name. - std::string LibName = "lib" + Filename; + // Ask the System Path object to locate the library. This ensures that + // the library search is done correctly for a given platform. + sys::Path LibPath = sys::Path::GetLibraryPath(Filename,Paths); - // Iterate over the directories in Paths to see if we can find the library - // there. - for (unsigned Index = 0; Index != Paths.size(); ++Index) { - std::string Directory = Paths[Index] + "/"; - - if (!SharedObjectOnly && FileOpenable(Directory + LibName + ".bc")) - return Directory + LibName + ".bc"; - - if (FileOpenable(Directory + LibName + SHLIBEXT)) - return Directory + LibName + SHLIBEXT; - - if (!SharedObjectOnly && FileOpenable(Directory + LibName + ".a")) - return Directory + LibName + ".a"; - } - - // One last hope: Check LLVM_LIB_SEARCH_PATH. - char *SearchPath = getenv("LLVM_LIB_SEARCH_PATH"); - if (SearchPath == NULL) - return std::string(); - - LibName = std::string(SearchPath) + "/" + LibName; - if (FileOpenable(LibName)) - return LibName; - - return std::string(); + return LibPath.get(); } /// GetAllDefinedSymbols - Modifies its parameter DefinedSymbols to contain the From reid at x10sys.com Sat Sep 25 11:00:17 2004 From: reid at x10sys.com (Reid Spencer) Date: Sat, 25 Sep 2004 11:00:17 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvm-ld/llvm-ld.cpp Message-ID: <200409251600.LAA29892@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-ld: llvm-ld.cpp updated: 1.1 -> 1.2 --- Log message: Add some missing #includes --- Diffs of the changes: (+8 -4) Index: llvm/tools/llvm-ld/llvm-ld.cpp diff -u llvm/tools/llvm-ld/llvm-ld.cpp:1.1 llvm/tools/llvm-ld/llvm-ld.cpp:1.2 --- llvm/tools/llvm-ld/llvm-ld.cpp:1.1 Sun Sep 12 20:27:53 2004 +++ llvm/tools/llvm-ld/llvm-ld.cpp Sat Sep 25 11:00:07 2004 @@ -26,6 +26,8 @@ #include "llvm/Bytecode/Reader.h" #include "llvm/Bytecode/WriteBytecodePass.h" #include "llvm/Target/TargetData.h" +#include "llvm/Target/TargetMachine.h" +#include "llvm/Target/TargetMachineRegistry.h" #include "llvm/Transforms/IPO.h" #include "llvm/Transforms/Scalar.h" #include "llvm/Support/Linker.h" @@ -82,6 +84,9 @@ Relink("r", cl::desc("Alias for -link-as-library"), cl::aliasopt(LinkAsLibrary)); + cl::opt + MachineArch("march", cl::desc("Architecture to generate assembly for:")); + cl::opt Native("native", cl::desc("Generate a native binary instead of a shell script")); @@ -184,7 +189,7 @@ cl::ParseCommandLineOptions(argc, argv, " llvm linker for GCC\n"); sys::PrintStackTraceOnErrorSignal(); - std::string ModuleID("gccld-output"); + std::string ModuleID("llvm-ld-output"); std::auto_ptr Composite(new Module(ModuleID)); // We always look first in the current directory when searching for libraries. @@ -203,12 +208,11 @@ if (LinkFiles(argv[0], Composite.get(), InputFilenames, Verbose)) return 1; // Error already printed + // Link in all of the libraries next... if (!LinkAsLibrary) LinkLibraries(argv[0], Composite.get(), Libraries, LibPaths, Verbose, Native); - // Link in all of the libraries next... - // Create the output file. std::string RealBytecodeOutput = OutputFilename; if (!LinkAsLibrary) RealBytecodeOutput += ".bc"; @@ -218,7 +222,7 @@ "' for writing!"); // Ensure that the bytecode file gets removed from the disk if we get a - // SIGINT signal. + // terminating signal. sys::RemoveFileOnSignal(RealBytecodeOutput); // Generate the bytecode file.