From brukman at cs.uiuc.edu Mon Jan 19 18:21:01 2004 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Mon Jan 19 18:21:01 2004 Subject: [llvm-commits] CVS: llvm/docs/GettingStarted.html Message-ID: <200401200020.SAA05330@zion.cs.uiuc.edu> Changes in directory llvm/docs: GettingStarted.html updated: 1.47 -> 1.48 --- Log message: Now with HTML 4.01 comliance flavor. --- Diffs of the changes: (+47 -49) Index: llvm/docs/GettingStarted.html diff -u llvm/docs/GettingStarted.html:1.47 llvm/docs/GettingStarted.html:1.48 --- llvm/docs/GettingStarted.html:1.47 Thu Dec 18 10:43:11 2003 +++ llvm/docs/GettingStarted.html Mon Jan 19 18:20:17 2004 @@ -191,8 +191,6 @@ -

-
  • Solaris on SparcV9 (Ultrasparc)
  • -

    -
  • FreeBSD on x86 (Pentium and above)
  • -

    -
  • MacOS X on PowerPC @@ -758,7 +760,7 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!" /> The LLVM Compiler Infrastructure
    - Last modified: $Date: 2004/01/20 17:45:47 $ + Last modified: $Date: 2004/01/20 19:17:48 $ From lattner at cs.uiuc.edu Tue Jan 20 13:51:01 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Jan 20 13:51:01 2004 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Writer/WriterInternals.h Message-ID: <200401201950.NAA25125@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Writer: WriterInternals.h updated: 1.19 -> 1.20 --- Log message: SlotCalculator.h moved --- Diffs of the changes: (+1 -1) Index: llvm/lib/Bytecode/Writer/WriterInternals.h diff -u llvm/lib/Bytecode/Writer/WriterInternals.h:1.19 llvm/lib/Bytecode/Writer/WriterInternals.h:1.20 --- llvm/lib/Bytecode/Writer/WriterInternals.h:1.19 Sun Jan 18 15:08:52 2004 +++ llvm/lib/Bytecode/Writer/WriterInternals.h Tue Jan 20 13:50:34 2004 @@ -22,7 +22,7 @@ #include "llvm/Bytecode/Writer.h" #include "WriterPrimitives.h" #include "llvm/Bytecode/Format.h" -#include "llvm/SlotCalculator.h" +#include "llvm/Analysis/SlotCalculator.h" #include "llvm/Instruction.h" namespace llvm { From lattner at cs.uiuc.edu Tue Jan 20 13:51:04 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Jan 20 13:51:04 2004 Subject: [llvm-commits] CVS: llvm/lib/VMCore/AsmWriter.cpp SlotCalculator.cpp Message-ID: <200401201950.NAA25107@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: AsmWriter.cpp updated: 1.115 -> 1.116 SlotCalculator.cpp updated: 1.49 -> 1.50 --- Log message: SlotCalculator.h moved --- Diffs of the changes: (+5 -5) Index: llvm/lib/VMCore/AsmWriter.cpp diff -u llvm/lib/VMCore/AsmWriter.cpp:1.115 llvm/lib/VMCore/AsmWriter.cpp:1.116 --- llvm/lib/VMCore/AsmWriter.cpp:1.115 Sun Jan 18 15:03:06 2004 +++ llvm/lib/VMCore/AsmWriter.cpp Tue Jan 20 13:50:22 2004 @@ -18,15 +18,15 @@ #include "llvm/Assembly/Writer.h" #include "llvm/Assembly/PrintModulePass.h" #include "llvm/Assembly/AsmAnnotationWriter.h" -#include "llvm/SlotCalculator.h" +#include "llvm/Constants.h" #include "llvm/DerivedTypes.h" #include "llvm/Instruction.h" -#include "llvm/Module.h" -#include "llvm/Constants.h" #include "llvm/iMemory.h" #include "llvm/iTerminators.h" #include "llvm/iPHINode.h" #include "llvm/iOther.h" +#include "llvm/Module.h" +#include "llvm/Analysis/SlotCalculator.h" #include "llvm/SymbolTable.h" #include "llvm/Support/CFG.h" #include "Support/StringExtras.h" Index: llvm/lib/VMCore/SlotCalculator.cpp diff -u llvm/lib/VMCore/SlotCalculator.cpp:1.49 llvm/lib/VMCore/SlotCalculator.cpp:1.50 --- llvm/lib/VMCore/SlotCalculator.cpp:1.49 Mon Jan 19 18:57:32 2004 +++ llvm/lib/VMCore/SlotCalculator.cpp Tue Jan 20 13:50:23 2004 @@ -14,13 +14,13 @@ // //===----------------------------------------------------------------------===// -#include "llvm/SlotCalculator.h" -#include "llvm/Analysis/ConstantsScanner.h" +#include "llvm/Analysis/SlotCalculator.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" #include "llvm/iOther.h" #include "llvm/Module.h" #include "llvm/SymbolTable.h" +#include "llvm/Analysis/ConstantsScanner.h" #include "Support/PostOrderIterator.h" #include "Support/STLExtras.h" #include From lattner at cs.uiuc.edu Tue Jan 20 13:51:06 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Jan 20 13:51:06 2004 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/SlotCalculator.h Message-ID: <200401201950.NAA25094@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: SlotCalculator.h updated: 1.17 -> 1.18 --- Log message: Move SlotCalculator.h from include/llvm to include/llvm/Analysis --- Diffs of the changes: (+3 -4) Index: llvm/include/llvm/Analysis/SlotCalculator.h diff -u llvm/include/llvm/Analysis/SlotCalculator.h:1.17 llvm/include/llvm/Analysis/SlotCalculator.h:1.18 --- llvm/include/llvm/Analysis/SlotCalculator.h:1.17 Mon Jan 19 18:54:47 2004 +++ llvm/include/llvm/Analysis/SlotCalculator.h Tue Jan 20 13:50:12 2004 @@ -1,4 +1,4 @@ -//===-- llvm/SlotCalculator.h - Calculate value slots -----------*- C++ -*-===// +//===-- Analysis/SlotCalculator.h - Calculate value slots -------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -17,12 +17,11 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_SLOTCALCULATOR_H -#define LLVM_SLOTCALCULATOR_H +#ifndef LLVM_ANALYSIS_SLOTCALCULATOR_H +#define LLVM_ANALYSIS_SLOTCALCULATOR_H #include #include -#include namespace llvm { From lattner at cs.uiuc.edu Tue Jan 20 13:51:07 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Jan 20 13:51:07 2004 Subject: [llvm-commits] CVS: llvm/include/llvm/SlotCalculator.h Message-ID: <200401201950.NAA25087@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: SlotCalculator.h (r1.17) removed --- Log message: Move SlotCalculator.h from include/llvm to include/llvm/Analysis --- Diffs of the changes: (+0 -0) From gaeke at cs.uiuc.edu Wed Jan 21 13:40:02 2004 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Wed Jan 21 13:40:02 2004 Subject: [llvm-commits] CVS: llvm/configure Message-ID: <200401211939.NAA00933@zion.cs.uiuc.edu> Changes in directory llvm: configure updated: 1.69 -> 1.70 --- Log message: Regenerated using autoconf-2.57 and autoheader-2.57. --- Diffs of the changes: (+18 -3) Index: llvm/configure diff -u llvm/configure:1.69 llvm/configure:1.70 --- llvm/configure:1.69 Fri Jan 16 15:31:21 2004 +++ llvm/configure Wed Jan 21 13:39:29 2004 @@ -465,7 +465,7 @@ #endif" ac_unique_file=""Makefile.config.in"" -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 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 PYTHON QMTEST ALLOCA MMAP_FILE ENABLE_OPTIMIZED SPEC_ROOT USE_SPEC UPB DISABLE_LLC_DIFFS JIT LLVMCC1 LLVMCC1PLUS BCR PAPIDIR 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 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 PYTHON QMTEST ALLOCA MMAP_FILE ENABLE_OPTIMIZED SPEC_ROOT USE_SPEC UPB DISABLE_LLC_DIFFS JIT LLVMCC1 LLVMCC1PLUS BCR PAPIDIR SHLIBEXT LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -21595,10 +21595,10 @@ fi rm conftest.c llvmcc1path=`"$LLVM_GCC_CHECK" --print-prog-name=cc1` - LLVMCC1=$llvmcc1path + LLVMCC1=$llvmcc1path llvmcc1pluspath=`"$LLVM_GCC_CHECK" --print-prog-name=cc1plus` - LLVMCC1PLUS=$llvmcc1pluspath + LLVMCC1PLUS=$llvmcc1pluspath fi echo "$as_me:$LINENO: result: $LLVM_GCC_SANE" >&5 @@ -21630,6 +21630,19 @@ fi; +echo "$as_me:$LINENO: checking for shared library suffix" >&5 +echo $ECHO_N "checking for shared library suffix... $ECHO_C" >&6 +eval "SHLIBEXT=$shrext" +echo "$as_me:$LINENO: result: $SHLIBEXT" >&5 +echo "${ECHO_T}$SHLIBEXT" >&6 +SHLIBEXT=$SHLIBEXT + + +cat >>confdefs.h <<_ACEOF +#define SHLIBEXT "$SHLIBEXT" +_ACEOF + + ac_config_files="$ac_config_files Makefile.config" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -22411,6 +22424,7 @@ s, at LLVMCC1PLUS@,$LLVMCC1PLUS,;t t s, at BCR@,$BCR,;t t s, at PAPIDIR@,$PAPIDIR,;t t +s, at SHLIBEXT@,$SHLIBEXT,;t t s, at LIBOBJS@,$LIBOBJS,;t t s, at LTLIBOBJS@,$LTLIBOBJS,;t t CEOF @@ -23136,3 +23150,4 @@ { echo "$as_me:$LINENO: WARNING: ***** but you should be able to build the llvm tools." >&5 echo "$as_me: WARNING: ***** but you should be able to build the llvm tools." >&2;} fi + From gaeke at cs.uiuc.edu Wed Jan 21 13:40:05 2004 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Wed Jan 21 13:40:05 2004 Subject: [llvm-commits] CVS: llvm/include/Config/config.h.in Message-ID: <200401211939.NAA00928@zion.cs.uiuc.edu> Changes in directory llvm/include/Config: config.h.in updated: 1.10 -> 1.11 --- Log message: Regenerated using autoconf-2.57 and autoheader-2.57. --- Diffs of the changes: (+3 -0) Index: llvm/include/Config/config.h.in diff -u llvm/include/Config/config.h.in:1.10 llvm/include/Config/config.h.in:1.11 --- llvm/include/Config/config.h.in:1.10 Thu Jan 15 00:22:32 2004 +++ llvm/include/Config/config.h.in Wed Jan 21 13:39:29 2004 @@ -180,6 +180,9 @@ /* Define as the return type of signal handlers (`int' or `void'). */ #undef RETSIGTYPE +/* Extension that shared libraries have, e.g., ".so". */ +#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 automatically deduced at run-time. From gaeke at cs.uiuc.edu Wed Jan 21 13:40:07 2004 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Wed Jan 21 13:40:07 2004 Subject: [llvm-commits] CVS: llvm/Makefile.config.in Message-ID: <200401211939.NAA00878@zion.cs.uiuc.edu> Changes in directory llvm: Makefile.config.in updated: 1.16 -> 1.17 --- Log message: Get SHLIBEXT variable from configure script. --- Diffs of the changes: (+3 -0) Index: llvm/Makefile.config.in diff -u llvm/Makefile.config.in:1.16 llvm/Makefile.config.in:1.17 --- llvm/Makefile.config.in:1.16 Fri Jan 16 15:31:34 2004 +++ llvm/Makefile.config.in Wed Jan 21 13:39:07 2004 @@ -115,6 +115,9 @@ # Disable LLC diffs for testing. @DISABLE_LLC_DIFFS@ +# Shared library extension for this platform. +SHLIBEXT = @SHLIBEXT@ + ########################################################################### # Directory Configuration # This section of the Makefile determines what is where. To be From gaeke at cs.uiuc.edu Wed Jan 21 13:40:09 2004 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Wed Jan 21 13:40:09 2004 Subject: [llvm-commits] CVS: llvm/autoconf/configure.ac Message-ID: <200401211939.NAA00834@zion.cs.uiuc.edu> Changes in directory llvm/autoconf: configure.ac updated: 1.66 -> 1.67 --- Log message: Get the shlib suffix from Libtool, and define it both in config.h and Makefile.config as SHLIBEXT. --- Diffs of the changes: (+11 -0) Index: llvm/autoconf/configure.ac diff -u llvm/autoconf/configure.ac:1.66 llvm/autoconf/configure.ac:1.67 --- llvm/autoconf/configure.ac:1.66 Fri Jan 16 15:31:22 2004 +++ llvm/autoconf/configure.ac Wed Jan 21 13:38:56 2004 @@ -377,6 +377,16 @@ dnl Location of PAPI AC_ARG_WITH(papi,AC_HELP_STRING([--with-papi],[Location of PAPI]),AC_SUBST(PAPIDIR,[$withval]),AC_SUBST(PAPIDIR,[/home/vadve/shared/Sparc/papi-2.3.4.1])) +dnl Get libtool's idea of what the shared library suffix is. +dnl (This is a hack; it relies on undocumented behavior.) +AC_MSG_CHECKING([for shared library suffix]) +eval "SHLIBEXT=$shrext" +AC_MSG_RESULT($SHLIBEXT) +dnl Propagate it to the Makefiles and config.h (for gccld & bugpoint). +AC_SUBST(SHLIBEXT,$SHLIBEXT) +AC_DEFINE_UNQUOTED(SHLIBEXT,"$SHLIBEXT", + [Extension that shared libraries have, e.g., ".so".]) + dnl Create the output files AC_OUTPUT(Makefile.config) @@ -390,3 +400,4 @@ AC_MSG_WARN([***** Runtime libraries (in llvm/runtime) will not be built,]) AC_MSG_WARN([***** but you should be able to build the llvm tools.]) fi + From gaeke at cs.uiuc.edu Wed Jan 21 13:54:02 2004 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Wed Jan 21 13:54:02 2004 Subject: [llvm-commits] CVS: llvm/Makefile.rules Message-ID: <200401211953.NAA01245@zion.cs.uiuc.edu> Changes in directory llvm: Makefile.rules updated: 1.169 -> 1.170 --- Log message: Modified version of patch from mkahl at apple.com to stop hardcoding ".so". --- Diffs of the changes: (+10 -7) Index: llvm/Makefile.rules diff -u llvm/Makefile.rules:1.169 llvm/Makefile.rules:1.170 --- llvm/Makefile.rules:1.169 Fri Jan 16 15:31:20 2004 +++ llvm/Makefile.rules Wed Jan 21 13:53:11 2004 @@ -109,7 +109,7 @@ ########################################################################### .SUFFIXES: .SUFFIXES: .c .cpp .h .hpp .y .l -.SUFFIXES: .lo .o .a .so .bc .td +.SUFFIXES: .lo .o .a .$(SHLIBEXT) .bc .td .SUFFIXES: .ps .dot .d # @@ -459,10 +459,10 @@ # Make sure there isn't any extranous whitespace on the LIBRARYNAME option LIBRARYNAME := $(strip $(LIBRARYNAME)) -LIBNAME_O := $(DESTLIBRELEASE)/lib$(LIBRARYNAME).so -LIBNAME_P := $(DESTLIBPROFILE)/lib$(LIBRARYNAME).so -LIBNAME_G := $(DESTLIBDEBUG)/lib$(LIBRARYNAME).so -LIBNAME_CUR := $(DESTLIBCURRENT)/lib$(LIBRARYNAME).so +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_AO := $(DESTLIBRELEASE)/lib$(LIBRARYNAME).a LIBNAME_AP := $(DESTLIBPROFILE)/lib$(LIBRARYNAME).a LIBNAME_AG := $(DESTLIBDEBUG)/lib$(LIBRARYNAME).a @@ -544,7 +544,7 @@ install-dynamic-library: $(LIBNAME_CUR) $(MKDIR) $(libdir) - $(VERB) $(LIBTOOL) --mode=install $(INSTALL) $(LIBNAME_CUR) $(libdir)/lib$(LIBRARYNAME).so + $(VERB) $(LIBTOOL) --mode=install $(INSTALL) $(LIBNAME_CUR) $(libdir)/lib$(LIBRARYNAME).$(SHLIBEXT) # # Rules for building static archive libraries. @@ -813,7 +813,10 @@ $(VERB) $(RM) -rf $(BUILD_OBJ_DIR)/Debug $(BUILD_OBJ_DIR)/Release $(VERB) $(RM) -rf $(BUILD_OBJ_DIR)/Profile $(BUILD_OBJ_DIR)/Depend $(VERB) $(RM) -rf $(BUILD_OBJ_DIR)/BytecodeObj - $(VERB) $(RM) -f core core.[0-9][0-9]* *.o *.d *.so *~ *.flc + $(VERB) $(RM) -f core core.[0-9][0-9]* *.o *.d *~ *.flc +ifneq ($(strip $(SHLIBEXT)),) # Extra paranoia - make real sure SHLIBEXT is set + $(VERB) $(RM) -f *$(SHLIBEXT) +endif $(VERB) $(RM) -f $(LEX_OUTPUT) $(YACC_OUTPUT) ########################################################################### From gaeke at gally.cs.uiuc.edu Wed Jan 21 14:00:02 2004 From: gaeke at gally.cs.uiuc.edu (Brian Gaeke) Date: Wed Jan 21 14:00:02 2004 Subject: [llvm-commits] CVS: llvm/Makefile.rules Message-ID: <200401211959.i0LJxTS27444@gally.cs.uiuc.edu> Changes in directory llvm: Makefile.rules updated: 1.170 -> 1.171 --- Log message: Remember, SHLIBEXT begins with a period. --- Diffs of the changes: (+1 -1) Index: llvm/Makefile.rules diff -u llvm/Makefile.rules:1.170 llvm/Makefile.rules:1.171 --- llvm/Makefile.rules:1.170 Wed Jan 21 13:53:11 2004 +++ llvm/Makefile.rules Wed Jan 21 13:59:19 2004 @@ -109,7 +109,7 @@ ########################################################################### .SUFFIXES: .SUFFIXES: .c .cpp .h .hpp .y .l -.SUFFIXES: .lo .o .a .$(SHLIBEXT) .bc .td +.SUFFIXES: .lo .o .a $(SHLIBEXT) .bc .td .SUFFIXES: .ps .dot .d # From gaeke at cs.uiuc.edu Wed Jan 21 15:13:02 2004 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Wed Jan 21 15:13:02 2004 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/ Message-ID: <200401212112.PAA08186@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: --- Log message: Directory /home/vadve/shared/PublicCVS/llvm/lib/Target/PowerPC added to the repository --- Diffs of the changes: (+0 -0) From gaeke at cs.uiuc.edu Wed Jan 21 15:14:02 2004 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Wed Jan 21 15:14:02 2004 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/Makefile PowerPC.h PowerPC.td PowerPCInstrInfo.cpp PowerPCInstrInfo.h PowerPCInstrs.td PowerPCReg.td PowerPCRegisterInfo.cpp PowerPCRegisterInfo.h PowerPCTargetMachine.cpp PowerPCTargetMachine.h Message-ID: <200401212113.PAA08217@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: Makefile added (r1.1) PowerPC.h added (r1.1) PowerPC.td added (r1.1) PowerPCInstrInfo.cpp added (r1.1) PowerPCInstrInfo.h added (r1.1) PowerPCInstrs.td added (r1.1) PowerPCReg.td added (r1.1) PowerPCRegisterInfo.cpp added (r1.1) PowerPCRegisterInfo.h added (r1.1) PowerPCTargetMachine.cpp added (r1.1) PowerPCTargetMachine.h added (r1.1) --- Log message: Import of skeletal PowerPC backend I have had laying around for months... --- Diffs of the changes: (+618 -0) Index: llvm/lib/Target/PowerPC/Makefile diff -c /dev/null llvm/lib/Target/PowerPC/Makefile:1.1 *** /dev/null Wed Jan 21 15:13:29 2004 --- llvm/lib/Target/PowerPC/Makefile Wed Jan 21 15:13:19 2004 *************** *** 0 **** --- 1,55 ---- + ##===- lib/Target/PowerPC/Makefile -------------------------*- Makefile -*-===## + # + # The LLVM Compiler Infrastructure + # + # This file was developed by the LLVM research group and is distributed under + # the University of Illinois Open Source License. See LICENSE.TXT for details. + # + ##===----------------------------------------------------------------------===## + LEVEL = ../../.. + LIBRARYNAME = powerpc + include $(LEVEL)/Makefile.common + + # Make sure that tblgen is run, first thing. + $(SourceDepend): PowerPCGenRegisterInfo.h.inc PowerPCGenRegisterNames.inc \ + PowerPCGenRegisterInfo.inc PowerPCGenInstrNames.inc \ + PowerPCGenInstrInfo.inc PowerPCGenInstrSelector.inc + + PowerPCGenRegisterNames.inc:: $(SourceDir)/PowerPC.td \ + $(SourceDir)/PowerPCReg.td \ + $(SourceDir)/../Target.td $(TBLGEN) + @echo "Building PowerPC.td register names with tblgen" + $(VERB) $(TBLGEN) -I $(BUILD_SRC_DIR) $< -gen-register-enums -o $@ + + PowerPCGenRegisterInfo.h.inc:: $(SourceDir)/PowerPC.td \ + $(SourceDir)/PowerPCReg.td \ + $(SourceDir)/../Target.td $(TBLGEN) + @echo "Building PowerPC.td register information header with tblgen" + $(VERB) $(TBLGEN) -I $(BUILD_SRC_DIR) $< -gen-register-desc-header -o $@ + + PowerPCGenRegisterInfo.inc:: $(SourceDir)/PowerPC.td \ + $(SourceDir)/PowerPCReg.td \ + $(SourceDir)/../Target.td $(TBLGEN) + @echo "Building PowerPC.td register information implementation with tblgen" + $(VERB) $(TBLGEN) -I $(BUILD_SRC_DIR) $< -gen-register-desc -o $@ + + PowerPCGenInstrNames.inc:: $(SourceDir)/PowerPC.td \ + $(SourceDir)/PowerPCInstrs.td \ + $(SourceDir)/../Target.td $(TBLGEN) + @echo "Building PowerPC.td instruction names with tblgen" + $(VERB) $(TBLGEN) -I $(BUILD_SRC_DIR) $< -gen-instr-enums -o $@ + + PowerPCGenInstrInfo.inc:: $(SourceDir)/PowerPC.td \ + $(SourceDir)/PowerPCInstrs.td \ + $(SourceDir)/../Target.td $(TBLGEN) + @echo "Building PowerPC.td instruction information with tblgen" + $(VERB) $(TBLGEN) -I $(BUILD_SRC_DIR) $< -gen-instr-desc -o $@ + + PowerPCGenInstrSelector.inc:: $(SourceDir)/PowerPC.td \ + $(SourceDir)/PowerPCInstrs.td \ + $(SourceDir)/../Target.td $(TBLGEN) + @echo "Building PowerPC.td instruction selector with tblgen" + $(VERB) $(TBLGEN) -I $(BUILD_SRC_DIR) $< -gen-instr-selector -o $@ + + clean:: + $(VERB) rm -f *.inc Index: llvm/lib/Target/PowerPC/PowerPC.h diff -c /dev/null llvm/lib/Target/PowerPC/PowerPC.h:1.1 *** /dev/null Wed Jan 21 15:13:29 2004 --- llvm/lib/Target/PowerPC/PowerPC.h Wed Jan 21 15:13:19 2004 *************** *** 0 **** --- 1,27 ---- + //===-- PowerPC.h - Top-level interface for PowerPC representation -*- C++ -*-// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by the LLVM research group and is distributed under + // the University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file contains the entry points for global functions defined in the LLVM + // PowerPC back-end. + // + //===----------------------------------------------------------------------===// + + #ifndef TARGET_POWERPC_H + #define TARGET_POWERPC_H + + // Defines symbolic names for PowerPC registers. This defines a mapping from + // register name to register number. + // + #include "PowerPCGenRegisterNames.inc" + + // Defines symbolic names for the PowerPC instructions. + // + #include "PowerPCGenInstrNames.inc" + + #endif Index: llvm/lib/Target/PowerPC/PowerPC.td diff -c /dev/null llvm/lib/Target/PowerPC/PowerPC.td:1.1 *** /dev/null Wed Jan 21 15:13:29 2004 --- llvm/lib/Target/PowerPC/PowerPC.td Wed Jan 21 15:13:19 2004 *************** *** 0 **** --- 1,41 ---- + //===- PowerPC.td - Describe the PowerPC Target Machine ---------*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by the LLVM research group and is distributed under + // the University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // + //===----------------------------------------------------------------------===// + + // Get the target-independent interfaces which we are implementing... + // + include "../Target.td" + + //===----------------------------------------------------------------------===// + // Register File Description + //===----------------------------------------------------------------------===// + + include "PowerPCReg.td" + include "PowerPCInstrs.td" + + def PowerPCInstrInfo : InstrInfo { + let PHIInst = PHI; + } + + def PowerPC : Target { + // Pointers are 32-bits in size. + let PointerType = i32; + + // According to the Mach-O Runtime ABI, these regs are nonvolatile across + // calls: + let CalleeSavedRegisters = [R1, R13, R14, R15, R16, R17, R18, R19, + R20, R21, R22, R23, R24, R25, R26, R27, R28, R29, R30, R31, F14, F15, + F16, F17, F18, F19, F20, F21, F22, F23, F24, F25, F26, F27, F28, F29, + F30, F31, CR2, CR3, CR4]; + + // Pull in Instruction Info: + let InstructionSet = PowerPCInstrInfo; + } Index: llvm/lib/Target/PowerPC/PowerPCInstrInfo.cpp diff -c /dev/null llvm/lib/Target/PowerPC/PowerPCInstrInfo.cpp:1.1 *** /dev/null Wed Jan 21 15:13:29 2004 --- llvm/lib/Target/PowerPC/PowerPCInstrInfo.cpp Wed Jan 21 15:13:19 2004 *************** *** 0 **** --- 1,42 ---- + //===- PowerPCInstrInfo.cpp - PowerPC Instruction Information ---*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by the LLVM research group and is distributed under + // the University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file contains the PowerPC implementation of the TargetInstrInfo class. + // + //===----------------------------------------------------------------------===// + + #include "PowerPCInstrInfo.h" + #include "llvm/CodeGen/MachineInstrBuilder.h" + #include "PowerPCGenInstrInfo.inc" + + namespace llvm { + + PowerPCInstrInfo::PowerPCInstrInfo() + : TargetInstrInfo(PowerPCInsts, + sizeof(PowerPCInsts)/sizeof(PowerPCInsts[0]), 0) { + } + + // createNOPinstr - returns the target's implementation of NOP, which is + // usually a pseudo-instruction, implemented by a degenerate version of + // another instruction. + // + MachineInstr* PowerPCInstrInfo::createNOPinstr() const { + return 0; + } + + /// isNOPinstr - not having a special NOP opcode, we need to know if a given + /// instruction is interpreted as an `official' NOP instr, i.e., there may be + /// more than one way to `do nothing' but only one canonical way to slack off. + // + bool PowerPCInstrInfo::isNOPinstr(const MachineInstr &MI) const { + return false; + } + + } // end namespace llvm + Index: llvm/lib/Target/PowerPC/PowerPCInstrInfo.h diff -c /dev/null llvm/lib/Target/PowerPC/PowerPCInstrInfo.h:1.1 *** /dev/null Wed Jan 21 15:13:29 2004 --- llvm/lib/Target/PowerPC/PowerPCInstrInfo.h Wed Jan 21 15:13:19 2004 *************** *** 0 **** --- 1,48 ---- + //===- PowerPCInstrInfo.h - PowerPC Instruction Information -----*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by the LLVM research group and is distributed under + // the University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file contains the PowerPC implementation of the TargetInstrInfo class. + // + //===----------------------------------------------------------------------===// + + #ifndef POWERPCINSTRUCTIONINFO_H + #define POWERPCINSTRUCTIONINFO_H + + #include "llvm/Target/TargetInstrInfo.h" + #include "PowerPCRegisterInfo.h" + + namespace llvm { + + class PowerPCInstrInfo : public TargetInstrInfo { + const PowerPCRegisterInfo RI; + public: + PowerPCInstrInfo(); + + /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As + /// such, whenever a client has an instance of instruction info, it should + /// always be able to get register info as well (through this method). + /// + virtual const MRegisterInfo &getRegisterInfo() const { return RI; } + + /// createNOPinstr - returns the target's implementation of NOP, which is + /// usually a pseudo-instruction, implemented by a degenerate version of + /// another instruction. + /// + MachineInstr* createNOPinstr() const; + + /// isNOPinstr - not having a special NOP opcode, we need to know if a given + /// instruction is interpreted as an `official' NOP instr, i.e., there may be + /// more than one way to `do nothing' but only one canonical way to slack off. + /// + bool isNOPinstr(const MachineInstr &MI) const; + }; + + } + + #endif Index: llvm/lib/Target/PowerPC/PowerPCInstrs.td diff -c /dev/null llvm/lib/Target/PowerPC/PowerPCInstrs.td:1.1 *** /dev/null Wed Jan 21 15:13:29 2004 --- llvm/lib/Target/PowerPC/PowerPCInstrs.td Wed Jan 21 15:13:19 2004 *************** *** 0 **** --- 1,46 ---- + //===- PowerPCInstrInfo.td - Describe the PowerPC Instruction Set -*- C++ -*-=// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by the LLVM research group and is distributed under + // the University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // + //===----------------------------------------------------------------------===// + + class Format val> { + bits<4> Value = val; + } + + // All of the PowerPC instruction formats, plus a pseudo-instruction format: + def Pseudo : Format<0>; + def IForm : Format<1>; + def BForm : Format<2>; + def SCForm : Format<3>; + def DForm : Format<4>; + def XForm : Format<5>; + def XLForm : Format<6>; + def XFXForm : Format<7>; + def XFLForm : Format<8>; + def XOForm : Format<9>; + def AForm : Format<10>; + def MForm : Format<11>; + + class PPCInst opcd, Format f> : Instruction { + let Namespace = "PowerPC"; + + let Name = nm; + bits<6> Opcode = opcd; + Format Form = f; + bits<4> FormBits = Form.Value; + } + + // Pseudo-instructions: + def PHI : PPCInst<"PHI", 0, Pseudo>; // PHI node... + def NOP : PPCInst<"NOP", 0, Pseudo>; // No-op + def ADJCALLSTACKDOWN : PPCInst<"ADJCALLSTACKDOWN", 0, Pseudo>; + def ADJCALLSTACKUP : PPCInst<"ADJCALLSTACKUP", 0, Pseudo>; + + Index: llvm/lib/Target/PowerPC/PowerPCReg.td diff -c /dev/null llvm/lib/Target/PowerPC/PowerPCReg.td:1.1 *** /dev/null Wed Jan 21 15:13:29 2004 --- llvm/lib/Target/PowerPC/PowerPCReg.td Wed Jan 21 15:13:19 2004 *************** *** 0 **** --- 1,82 ---- + //===- PowerPCReg.td - Describe the PowerPC Register File -------*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by the LLVM research group and is distributed under + // the University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // + //===----------------------------------------------------------------------===// + + class PPCReg : Register { + let Namespace = "PowerPC"; + } + + // We identify all our registers with a 5-bit ID, for consistency's sake. + + // GPR - One of the 32 32-bit general-purpose registers + class GPR num> : PPCReg { + field bits<5> Num = num; + } + + // SPR - One of the 32-bit special-purpose registers + class SPR num> : PPCReg { + field bits<5> Num = num; + } + + // FPR - One of the 32 64-bit floating-point registers + class FPR num> : PPCReg { + field bits<5> Num = num; + } + + // CR - One of the 8 4-bit condition registers + class CR num> : PPCReg { + field bits<5> Num = num; + } + + // General-purpose registers + def R0 : GPR< 0>; def R1 : GPR< 1>; def R2 : GPR< 2>; def R3 : GPR< 3>; + def R4 : GPR< 4>; def R5 : GPR< 5>; def R6 : GPR< 6>; def R7 : GPR< 7>; + def R8 : GPR< 8>; def R9 : GPR< 9>; def R10 : GPR<10>; def R11 : GPR<11>; + def R12 : GPR<12>; def R13 : GPR<13>; def R14 : GPR<14>; def R15 : GPR<15>; + def R16 : GPR<16>; def R17 : GPR<17>; def R18 : GPR<18>; def R19 : GPR<19>; + def R20 : GPR<20>; def R21 : GPR<21>; def R22 : GPR<22>; def R23 : GPR<23>; + def R24 : GPR<24>; def R25 : GPR<25>; def R26 : GPR<26>; def R27 : GPR<27>; + def R28 : GPR<28>; def R29 : GPR<29>; def R30 : GPR<30>; def R31 : GPR<31>; + + // Floating-point registers + def F0 : FPR< 0>; def F1 : FPR< 1>; def F2 : FPR< 2>; def F3 : FPR< 3>; + def F4 : FPR< 4>; def F5 : FPR< 5>; def F6 : FPR< 6>; def F7 : FPR< 7>; + def F8 : FPR< 8>; def F9 : FPR< 9>; def F10 : FPR<10>; def F11 : FPR<11>; + def F12 : FPR<12>; def F13 : FPR<13>; def F14 : FPR<14>; def F15 : FPR<15>; + def F16 : FPR<16>; def F17 : FPR<17>; def F18 : FPR<18>; def F19 : FPR<19>; + def F20 : FPR<20>; def F21 : FPR<21>; def F22 : FPR<22>; def F23 : FPR<23>; + def F24 : FPR<24>; def F25 : FPR<25>; def F26 : FPR<26>; def F27 : FPR<27>; + def F28 : FPR<28>; def F29 : FPR<29>; def F30 : FPR<30>; def F31 : FPR<31>; + + // Condition registers + def CR0 : CR<0>; def CR1 : CR<1>; def CR2 : CR<2>; def CR3 : CR<3>; + def CR4 : CR<4>; def CR5 : CR<5>; def CR6 : CR<6>; def CR7 : CR<7>; + + // Floating-point status and control register + def FPSCR : SPR<0>; + // fiXed-point Exception Register? :-) + def XER : SPR<1>; + // Link register + def LR : SPR<2>; + // Count register + def CTR : SPR<3>; + // These are the "time base" registers which are read-only in user mode. + def TBL : SPR<4>; + def TBU : SPR<5>; + + /// Register classes: one for floats and another for non-floats. + def GPRC : RegisterClass; + def FPRC : RegisterClass; + Index: llvm/lib/Target/PowerPC/PowerPCRegisterInfo.cpp diff -c /dev/null llvm/lib/Target/PowerPC/PowerPCRegisterInfo.cpp:1.1 *** /dev/null Wed Jan 21 15:13:29 2004 --- llvm/lib/Target/PowerPC/PowerPCRegisterInfo.cpp Wed Jan 21 15:13:19 2004 *************** *** 0 **** --- 1,104 ---- + //===- PowerPCRegisterInfo.cpp - PowerPC Register Information ---*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by the LLVM research group and is distributed under + // the University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file contains the PowerPC implementation of the MRegisterInfo class. + // + //===----------------------------------------------------------------------===// + + #include "PowerPC.h" + #include "PowerPCRegisterInfo.h" + #include "llvm/Type.h" + + namespace llvm { + + PowerPCRegisterInfo::PowerPCRegisterInfo() + : PowerPCGenRegisterInfo(PowerPC::ADJCALLSTACKDOWN, + PowerPC::ADJCALLSTACKUP) {} + + int PowerPCRegisterInfo::storeRegToStackSlot(MachineBasicBlock &MBB, + MachineBasicBlock::iterator &MBBI, + unsigned SrcReg, int FrameIdx, + const TargetRegisterClass *RC) const { + abort(); + return -1; + } + + int PowerPCRegisterInfo::loadRegFromStackSlot(MachineBasicBlock &MBB, + MachineBasicBlock::iterator &MBBI, + unsigned DestReg, int FrameIdx, + const TargetRegisterClass *RC) const{ + abort(); + return -1; + } + + int PowerPCRegisterInfo::copyRegToReg(MachineBasicBlock &MBB, + MachineBasicBlock::iterator &MBBI, + unsigned DestReg, unsigned SrcReg, + const TargetRegisterClass *RC) const { + abort(); + return -1; + } + + int PowerPCRegisterInfo::eliminateCallFramePseudoInstr(MachineFunction &MF, + MachineBasicBlock &MBB, + MachineBasicBlock::iterator &I) const { + abort(); + return -1; + } + + int PowerPCRegisterInfo::eliminateFrameIndex(MachineFunction &MF, + MachineBasicBlock::iterator &II) const { + abort(); + return -1; + } + + int PowerPCRegisterInfo::processFunctionBeforeFrameFinalized(MachineFunction &MF) + const { + abort(); + return -1; + } + + int PowerPCRegisterInfo::emitPrologue(MachineFunction &MF) const { + abort(); + return -1; + } + + int PowerPCRegisterInfo::emitEpilogue(MachineFunction &MF, + MachineBasicBlock &MBB) const { + abort(); + return -1; + } + + } // end namespace llvm + + #include "PowerPCGenRegisterInfo.inc" + + namespace llvm { + + const TargetRegisterClass* + PowerPCRegisterInfo::getRegClassForType(const Type* Ty) const { + switch (Ty->getPrimitiveID()) { + case Type::LongTyID: + case Type::ULongTyID: assert(0 && "Long values can't fit in registers!"); + default: assert(0 && "Invalid type to getClass!"); + case Type::BoolTyID: + case Type::SByteTyID: + case Type::UByteTyID: + case Type::ShortTyID: + case Type::UShortTyID: + case Type::IntTyID: + case Type::UIntTyID: + case Type::PointerTyID: return &GPRCInstance; + + case Type::FloatTyID: + case Type::DoubleTyID: return &FPRCInstance; + } + } + + } // end namespace llvm Index: llvm/lib/Target/PowerPC/PowerPCRegisterInfo.h diff -c /dev/null llvm/lib/Target/PowerPC/PowerPCRegisterInfo.h:1.1 *** /dev/null Wed Jan 21 15:13:29 2004 --- llvm/lib/Target/PowerPC/PowerPCRegisterInfo.h Wed Jan 21 15:13:19 2004 *************** *** 0 **** --- 1,58 ---- + //===- PowerPCRegisterInfo.h - PowerPC Register Information Impl -*- C++ -*-==// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by the LLVM research group and is distributed under + // the University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file contains the PowerPC implementation of the MRegisterInfo class. + // + //===----------------------------------------------------------------------===// + + #ifndef POWERPCREGISTERINFO_H + #define POWERPCREGISTERINFO_H + + #include "llvm/Target/MRegisterInfo.h" + #include "PowerPCGenRegisterInfo.h.inc" + + namespace llvm { + + class Type; + + struct PowerPCRegisterInfo : public PowerPCGenRegisterInfo { + PowerPCRegisterInfo(); + const TargetRegisterClass* getRegClassForType(const Type* Ty) const; + + /// Code Generation virtual methods... + int storeRegToStackSlot(MachineBasicBlock &MBB, + MachineBasicBlock::iterator &MBBI, + unsigned SrcReg, int FrameIndex, + const TargetRegisterClass *RC) const; + + int loadRegFromStackSlot(MachineBasicBlock &MBB, + MachineBasicBlock::iterator &MBBI, + unsigned DestReg, int FrameIndex, + const TargetRegisterClass *RC) const; + + int copyRegToReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator &MBBI, + unsigned DestReg, unsigned SrcReg, + const TargetRegisterClass *RC) const; + + int eliminateCallFramePseudoInstr(MachineFunction &MF, + MachineBasicBlock &MBB, + MachineBasicBlock::iterator &I) const; + + int eliminateFrameIndex(MachineFunction &MF, + MachineBasicBlock::iterator &II) const; + + int processFunctionBeforeFrameFinalized(MachineFunction &MF) const; + + int emitPrologue(MachineFunction &MF) const; + int emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const; + }; + + } // end namespace llvm + + #endif Index: llvm/lib/Target/PowerPC/PowerPCTargetMachine.cpp diff -c /dev/null llvm/lib/Target/PowerPC/PowerPCTargetMachine.cpp:1.1 *** /dev/null Wed Jan 21 15:13:29 2004 --- llvm/lib/Target/PowerPC/PowerPCTargetMachine.cpp Wed Jan 21 15:13:19 2004 *************** *** 0 **** --- 1,53 ---- + //===-- PowerPCTargetMachine.cpp - Define TargetMachine for PowerPC -------===// + // + // 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. + // + //===----------------------------------------------------------------------===// + // + // + //===----------------------------------------------------------------------===// + + #include "PowerPCTargetMachine.h" + #include "llvm/Module.h" + #include "llvm/PassManager.h" + #include "llvm/Target/TargetMachineImpls.h" + #include "llvm/CodeGen/MachineFunction.h" + #include "llvm/CodeGen/Passes.h" + + namespace llvm { + + // allocatePowerPCTargetMachine - Allocate and return a subclass of + // TargetMachine that implements the PowerPC backend. + // + TargetMachine *allocatePowerPCTargetMachine(const Module &M, + IntrinsicLowering *IL) { + return new PowerPCTargetMachine(M, IL); + } + + /// PowerPCTargetMachine ctor - Create an ILP32 architecture model + /// + PowerPCTargetMachine::PowerPCTargetMachine(const Module &M, + IntrinsicLowering *IL) + : TargetMachine("PowerPC", IL, true, 4, 4, 4, 4, 4), + FrameInfo(TargetFrameInfo::StackGrowsDown, 8, 4) { + } + + // addPassesToEmitAssembly - We currently use all of the same passes as the JIT + // does to emit statically compiled machine code. + bool PowerPCTargetMachine::addPassesToEmitAssembly(PassManager &PM, + std::ostream &Out) { + return true; + } + + /// addPassesToJITCompile - Add passes to the specified pass manager to + /// implement a fast dynamic compiler for this target. Return true if this is + /// not supported for this target. + /// + bool PowerPCTargetMachine::addPassesToJITCompile(FunctionPassManager &PM) { + return true; + } + + } // end namespace llvm Index: llvm/lib/Target/PowerPC/PowerPCTargetMachine.h diff -c /dev/null llvm/lib/Target/PowerPC/PowerPCTargetMachine.h:1.1 *** /dev/null Wed Jan 21 15:13:29 2004 --- llvm/lib/Target/PowerPC/PowerPCTargetMachine.h Wed Jan 21 15:13:19 2004 *************** *** 0 **** --- 1,62 ---- + //===-- PowerPCTargetMachine.h - Define TargetMachine for PowerPC -*- C++ -*-=// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by the LLVM research group and is distributed under + // the University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file declares the PowerPC specific subclass of TargetMachine. + // + //===----------------------------------------------------------------------===// + + #ifndef POWERPCTARGETMACHINE_H + #define POWERPCTARGETMACHINE_H + + #include "llvm/Target/TargetMachine.h" + #include "llvm/Target/TargetFrameInfo.h" + #include "llvm/PassManager.h" + #include "PowerPCInstrInfo.h" + + namespace llvm { + + class IntrinsicLowering; + + class PowerPCTargetMachine : public TargetMachine { + PowerPCInstrInfo InstrInfo; + TargetFrameInfo FrameInfo; + public: + PowerPCTargetMachine(const Module &M, IntrinsicLowering *IL); + + virtual const PowerPCInstrInfo &getInstrInfo() const { return InstrInfo; } + virtual const TargetFrameInfo &getFrameInfo() const { return FrameInfo; } + virtual const MRegisterInfo *getRegisterInfo() const { + return &InstrInfo.getRegisterInfo(); + } + + virtual const TargetSchedInfo &getSchedInfo() const { abort(); } + virtual const TargetRegInfo &getRegInfo() const { abort(); } + virtual const TargetCacheInfo &getCacheInfo() const { abort(); } + + /// addPassesToJITCompile - Add passes to the specified pass manager to + /// implement a fast dynamic compiler for this target. Return true if this is + /// not supported for this target. + /// + virtual bool addPassesToJITCompile(FunctionPassManager &PM); + + /// addPassesToEmitMachineCode - Add passes to the specified pass manager to + /// get machine code emitted. This uses a MachineCodeEmitter object to handle + /// actually outputting the machine code and resolving things like the address + /// of functions. This method should returns true if machine code emission is + /// not supported. + /// + virtual bool addPassesToEmitMachineCode(FunctionPassManager &PM, + MachineCodeEmitter &MCE); + + virtual bool addPassesToEmitAssembly(PassManager &PM, std::ostream &Out); + }; + + } // end namespace llvm + + #endif From gaeke at cs.uiuc.edu Wed Jan 21 15:17:01 2004 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Wed Jan 21 15:17:01 2004 Subject: [llvm-commits] CVS: llvm/lib/Target/Makefile Message-ID: <200401212116.PAA13664@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target: Makefile updated: 1.9 -> 1.10 --- Log message: Build the PowerPC directory, so it is less likely to bit-rot (again) --- Diffs of the changes: (+1 -1) Index: llvm/lib/Target/Makefile diff -u llvm/lib/Target/Makefile:1.9 llvm/lib/Target/Makefile:1.10 --- llvm/lib/Target/Makefile:1.9 Mon Oct 20 17:26:56 2003 +++ llvm/lib/Target/Makefile Wed Jan 21 15:16:10 2004 @@ -7,7 +7,7 @@ # ##===----------------------------------------------------------------------===## LEVEL = ../.. -DIRS = Sparc X86 +DIRS = Sparc X86 PowerPC LIBRARYNAME = target BUILD_ARCHIVE = 1 From gaeke at cs.uiuc.edu Wed Jan 21 15:18:00 2004 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Wed Jan 21 15:18:00 2004 Subject: [llvm-commits] CVS: llvm/Makefile.rules Message-ID: <200401212117.PAA13684@zion.cs.uiuc.edu> Changes in directory llvm: Makefile.rules updated: 1.171 -> 1.172 --- Log message: Maybe Misha isn't so buggy after all. He caught the rest of my huge thinko w.r.t. SHLIBEXT starting with a dot. :-) --- Diffs of the changes: (+5 -5) Index: llvm/Makefile.rules diff -u llvm/Makefile.rules:1.171 llvm/Makefile.rules:1.172 --- llvm/Makefile.rules:1.171 Wed Jan 21 13:59:19 2004 +++ llvm/Makefile.rules Wed Jan 21 15:17:37 2004 @@ -459,10 +459,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)$(SHLIBEXT) +LIBNAME_P := $(DESTLIBPROFILE)/lib$(LIBRARYNAME)$(SHLIBEXT) +LIBNAME_G := $(DESTLIBDEBUG)/lib$(LIBRARYNAME)$(SHLIBEXT) +LIBNAME_CUR := $(DESTLIBCURRENT)/lib$(LIBRARYNAME)$(SHLIBEXT) LIBNAME_AO := $(DESTLIBRELEASE)/lib$(LIBRARYNAME).a LIBNAME_AP := $(DESTLIBPROFILE)/lib$(LIBRARYNAME).a LIBNAME_AG := $(DESTLIBDEBUG)/lib$(LIBRARYNAME).a @@ -544,7 +544,7 @@ install-dynamic-library: $(LIBNAME_CUR) $(MKDIR) $(libdir) - $(VERB) $(LIBTOOL) --mode=install $(INSTALL) $(LIBNAME_CUR) $(libdir)/lib$(LIBRARYNAME).$(SHLIBEXT) + $(VERB) $(LIBTOOL) --mode=install $(INSTALL) $(LIBNAME_CUR) $(libdir)/lib$(LIBRARYNAME)$(SHLIBEXT) # # Rules for building static archive libraries. From gaeke at cs.uiuc.edu Wed Jan 21 15:21:01 2004 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Wed Jan 21 15:21:01 2004 Subject: [llvm-commits] CVS: llvm/Makefile.rules Message-ID: <200401212120.PAA13766@zion.cs.uiuc.edu> Changes in directory llvm: Makefile.rules updated: 1.172 -> 1.173 --- Log message: Add DESTDIR support for installation, to support RPM etc. --- Diffs of the changes: (+6 -6) Index: llvm/Makefile.rules diff -u llvm/Makefile.rules:1.172 llvm/Makefile.rules:1.173 --- llvm/Makefile.rules:1.172 Wed Jan 21 15:17:37 2004 +++ llvm/Makefile.rules Wed Jan 21 15:20:44 2004 @@ -482,9 +482,9 @@ # dynamic target builds a shared object version of the library... dynamic:: $(LIBNAME_CUR) bytecodelib:: $(LIBNAME_BC) -install-bytecode-library:: $(LLVMGCCDIR)/bytecode-libs/lib$(LIBRARYNAME).bc +install-bytecode-library:: $(DESTDIR)$(LLVMGCCDIR)/bytecode-libs/lib$(LIBRARYNAME).bc -$(LLVMGCCDIR)/bytecode-libs/lib$(LIBRARYNAME).bc: $(LIBNAME_BC) +$(DESTDIR)$(LLVMGCCDIR)/bytecode-libs/lib$(LIBRARYNAME).bc: $(LIBNAME_BC) @${ECHO} ======= Installing $(LIBRARYNAME) bytecode library ======= cp $< $@ @@ -544,7 +544,7 @@ install-dynamic-library: $(LIBNAME_CUR) $(MKDIR) $(libdir) - $(VERB) $(LIBTOOL) --mode=install $(INSTALL) $(LIBNAME_CUR) $(libdir)/lib$(LIBRARYNAME)$(SHLIBEXT) + $(VERB) $(LIBTOOL) --mode=install $(INSTALL) $(LIBNAME_CUR) $(DESTDIR)$(libdir)/lib$(LIBRARYNAME)$(SHLIBEXT) # # Rules for building static archive libraries. @@ -569,7 +569,7 @@ install-archive-library: $(LIBNAME_ACUR) $(MKDIR) $(libdir) - $(VERB) $(LIBTOOL) --mode=install $(INSTALL) $(LIBNAME_ACUR) $(libdir)/lib$(LIBRARYNAME).a + $(VERB) $(LIBTOOL) --mode=install $(INSTALL) $(LIBNAME_ACUR) $(DESTDIR)$(libdir)/lib$(LIBRARYNAME).a # # Rules for building .o libraries. @@ -599,7 +599,7 @@ install-single-object-library: $(LIBNAME_OBJCUR) $(MKDIR) $(libdir) - $(VERB) $(LIBTOOL) --mode=install $(INSTALL) $(LIBNAME_OBJCUR) $(libdir)/$(LIBRARYNAME).o + $(VERB) $(LIBTOOL) --mode=install $(INSTALL) $(LIBNAME_OBJCUR) $(DESTDIR)$(libdir)/$(LIBRARYNAME).o endif @@ -699,7 +699,7 @@ install:: $(TOOLEXENAMES) $(MKDIR) $(bindir) - $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) -c -m 0755 $(TOOLEXENAMES) $(bindir)/$(TOOLNAME) + $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) -c -m 0755 $(TOOLEXENAMES) $(DESTDIR)$(bindir)/$(TOOLNAME) endif From brukman at cs.uiuc.edu Wed Jan 21 16:51:02 2004 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Wed Jan 21 16:51:02 2004 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/TargetFrameInfo.h Message-ID: <200401212250.QAA14955@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: TargetFrameInfo.h updated: 1.9 -> 1.10 --- Log message: If you call abort(), #include --- Diffs of the changes: (+2 -0) Index: llvm/include/llvm/Target/TargetFrameInfo.h diff -u llvm/include/llvm/Target/TargetFrameInfo.h:1.9 llvm/include/llvm/Target/TargetFrameInfo.h:1.10 --- llvm/include/llvm/Target/TargetFrameInfo.h:1.9 Tue Nov 11 16:41:31 2003 +++ llvm/include/llvm/Target/TargetFrameInfo.h Wed Jan 21 16:50:12 2004 @@ -14,6 +14,8 @@ #ifndef LLVM_TARGET_TARGETFRAMEINFO_H #define LLVM_TARGET_TARGETFRAMEINFO_H +#include + namespace llvm { class MachineFunction; From brukman at cs.uiuc.edu Wed Jan 21 16:55:01 2004 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Wed Jan 21 16:55:01 2004 Subject: [llvm-commits] CVS: llvm/include/llvm/ModuleProvider.h Message-ID: <200401212254.QAA15074@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: ModuleProvider.h updated: 1.8 -> 1.9 --- Log message: To materialize a module, you need to know what functions NEED to be read and which ones don't, which is state that the parent class doesn't know without knowing the implementation. Let the children classes implement materializeModule(). --- Diffs of the changes: (+2 -1) Index: llvm/include/llvm/ModuleProvider.h diff -u llvm/include/llvm/ModuleProvider.h:1.8 llvm/include/llvm/ModuleProvider.h:1.9 --- llvm/include/llvm/ModuleProvider.h:1.8 Mon Dec 29 20:44:04 2003 +++ llvm/include/llvm/ModuleProvider.h Wed Jan 21 16:54:10 2004 @@ -41,7 +41,7 @@ /// materializeModule - make sure the entire Module has been completely read. /// - Module* materializeModule(); + virtual Module* materializeModule() = 0; /// releaseModule - no longer delete the Module* when provider is destroyed. /// @@ -64,6 +64,7 @@ TheModule = M; } void materializeFunction(Function *F) {} + Module* materializeModule() { return TheModule; } }; } // End llvm namespace From brukman at cs.uiuc.edu Wed Jan 21 16:56:01 2004 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Wed Jan 21 16:56:01 2004 Subject: [llvm-commits] CVS: llvm/lib/VMCore/ModuleProvider.cpp Message-ID: <200401212255.QAA15089@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: ModuleProvider.cpp updated: 1.8 -> 1.9 --- Log message: Let subclasses implement ModuleProvider::materializeModule() which is based on their implementation of book-keeping for which functions need to be materialized and which don't. --- Diffs of the changes: (+0 -12) Index: llvm/lib/VMCore/ModuleProvider.cpp diff -u llvm/lib/VMCore/ModuleProvider.cpp:1.8 llvm/lib/VMCore/ModuleProvider.cpp:1.9 --- llvm/lib/VMCore/ModuleProvider.cpp:1.8 Fri Nov 21 14:23:48 2003 +++ llvm/lib/VMCore/ModuleProvider.cpp Wed Jan 21 16:54:50 2004 @@ -24,15 +24,3 @@ ModuleProvider::~ModuleProvider() { delete TheModule; } - -/// materializeFunction - make sure the given function is fully read. -/// -Module* ModuleProvider::materializeModule() { - assert(TheModule && "Attempting to materialize an invalid module!"); - - for (Module::iterator i = TheModule->begin(), e = TheModule->end(); - i != e; ++i) - materializeFunction(i); - - return TheModule; -} From brukman at cs.uiuc.edu Wed Jan 21 16:56:03 2004 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Wed Jan 21 16:56:03 2004 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/ReaderInternals.h Message-ID: <200401212255.QAA15112@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Reader: ReaderInternals.h updated: 1.76 -> 1.77 --- Log message: Implement ModuleProvider::materializeModule() by only materializing functions that are still left in the lazy reader map. --- Diffs of the changes: (+10 -0) Index: llvm/lib/Bytecode/Reader/ReaderInternals.h diff -u llvm/lib/Bytecode/Reader/ReaderInternals.h:1.76 llvm/lib/Bytecode/Reader/ReaderInternals.h:1.77 --- llvm/lib/Bytecode/Reader/ReaderInternals.h:1.76 Sun Jan 18 15:08:15 2004 +++ llvm/lib/Bytecode/Reader/ReaderInternals.h Wed Jan 21 16:55:34 2004 @@ -55,6 +55,16 @@ freeTable(ModuleValues); } + Module* materializeModule() { + while (! LazyFunctionLoadMap.empty()) { + std::map::iterator i = + LazyFunctionLoadMap.begin(); + materializeFunction((*i).first); + } + + return TheModule; + } + Module* releaseModule() { // Since we're losing control of this Module, we must hand it back complete Module *M = ModuleProvider::releaseModule(); From gaeke at cs.uiuc.edu Wed Jan 21 17:29:05 2004 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Wed Jan 21 17:29:05 2004 Subject: [llvm-commits] CVS: llvm/Makefile Message-ID: <200401212328.RAA15386@zion.cs.uiuc.edu> Changes in directory llvm: Makefile updated: 1.15 -> 1.16 --- Log message: Part 2 of DESTDIR support --- Diffs of the changes: (+1 -1) Index: llvm/Makefile diff -u llvm/Makefile:1.15 llvm/Makefile:1.16 --- llvm/Makefile:1.15 Tue Jan 13 01:09:56 2004 +++ llvm/Makefile Wed Jan 21 17:28:03 2004 @@ -37,7 +37,7 @@ install-includes: $(MKDIR) $(includedir)/llvm - cd include && find * '!' '(' -name '*~' -o -name .cvsignore ')' -print | grep -v CVS | pax -rwdvpe $(includedir)/llvm + cd include && find * '!' '(' -name '*~' -o -name .cvsignore ')' -print | grep -v CVS | pax -rwdvpe $(DESTDIR)$(includedir)/llvm install:: install-includes From gaeke at cs.uiuc.edu Wed Jan 21 17:58:01 2004 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Wed Jan 21 17:58:01 2004 Subject: [llvm-commits] CVS: llvm/runtime/GCCLibraries/crtend/Makefile Message-ID: <200401212357.RAA16252@zion.cs.uiuc.edu> Changes in directory llvm/runtime/GCCLibraries/crtend: Makefile updated: 1.12 -> 1.13 --- Log message: Add DESTDIR support for installing. Use (and depend on) $(bytecode_libdir). --- Diffs of the changes: (+2 -2) Index: llvm/runtime/GCCLibraries/crtend/Makefile diff -u llvm/runtime/GCCLibraries/crtend/Makefile:1.12 llvm/runtime/GCCLibraries/crtend/Makefile:1.13 --- llvm/runtime/GCCLibraries/crtend/Makefile:1.12 Sun Nov 30 03:22:42 2003 +++ llvm/runtime/GCCLibraries/crtend/Makefile Wed Jan 21 17:57:46 2004 @@ -31,10 +31,10 @@ all:: $(CRTEND_A) # Installation simply requires copying the archive to it's new home. -$(LLVMGCCDIR)/bytecode-libs/libcrtend.a: $(CRTEND_A) +$(DESTDIR)$(bytecode_libdir)/libcrtend.a: $(CRTEND_A) $(DESTDIR)$(bytecode_libdir) cp $< $@ -install:: $(LLVMGCCDIR)/bytecode-libs/libcrtend.a +install:: $(DESTDIR)$(bytecode_libdir)/libcrtend.a # The four components described in the README From gaeke at cs.uiuc.edu Wed Jan 21 17:58:04 2004 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Wed Jan 21 17:58:04 2004 Subject: [llvm-commits] CVS: llvm/Makefile.rules Message-ID: <200401212357.RAA16209@zion.cs.uiuc.edu> Changes in directory llvm: Makefile.rules updated: 1.173 -> 1.174 --- Log message: Give the ".../llvm-gcc/bytecode-libs" directory a variable of its own, called bytecode_libdir. Make install-bytecode-library depend on the existence of that directory, and add a rule for creating it if it does not exist by calling mkinstalldirs. --- Diffs of the changes: (+6 -2) Index: llvm/Makefile.rules diff -u llvm/Makefile.rules:1.173 llvm/Makefile.rules:1.174 --- llvm/Makefile.rules:1.173 Wed Jan 21 15:20:44 2004 +++ llvm/Makefile.rules Wed Jan 21 17:57:21 2004 @@ -482,9 +482,13 @@ # dynamic target builds a shared object version of the library... dynamic:: $(LIBNAME_CUR) bytecodelib:: $(LIBNAME_BC) -install-bytecode-library:: $(DESTDIR)$(LLVMGCCDIR)/bytecode-libs/lib$(LIBRARYNAME).bc +bytecode_libdir = $(LLVMGCCDIR)/bytecode-libs +install-bytecode-library:: $(DESTDIR)$(bytecode_libdir)/lib$(LIBRARYNAME).bc -$(DESTDIR)$(LLVMGCCDIR)/bytecode-libs/lib$(LIBRARYNAME).bc: $(LIBNAME_BC) +$(DESTDIR)$(bytecode_libdir): + $(MKDIR) $@ + +$(DESTDIR)$(bytecode_libdir)/lib$(LIBRARYNAME).bc: $(LIBNAME_BC) $(DESTDIR)$(bytecode_libdir) @${ECHO} ======= Installing $(LIBRARYNAME) bytecode library ======= cp $< $@ From lattner at cs.uiuc.edu Thu Jan 22 07:43:01 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Jan 22 07:43:01 2004 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/Printer.cpp Message-ID: <200401221342.HAA09566@zion.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: Printer.cpp updated: 1.62 -> 1.63 --- Log message: Allow disabling of ALL printing overhead when performing timings --- Diffs of the changes: (+5 -0) Index: llvm/lib/Analysis/DataStructure/Printer.cpp diff -u llvm/lib/Analysis/DataStructure/Printer.cpp:1.62 llvm/lib/Analysis/DataStructure/Printer.cpp:1.63 --- llvm/lib/Analysis/DataStructure/Printer.cpp:1.62 Wed Nov 12 23:05:41 2003 +++ llvm/lib/Analysis/DataStructure/Printer.cpp Thu Jan 22 07:42:43 2004 @@ -29,6 +29,7 @@ // namespace { cl::opt OnlyPrintMain("only-print-main-ds", cl::ReallyHidden); + cl::opt DontPrintAnything("dont-print-ds", cl::ReallyHidden); Statistic<> MaxGraphSize ("dsnode", "Maximum graph size"); Statistic<> NumFoldedNodes ("dsnode", "Number of folded nodes (in final graph)"); } @@ -272,18 +273,22 @@ // print - Print out the analysis results... void LocalDataStructures::print(std::ostream &O, const Module *M) const { + if (DontPrintAnything) return; printCollection(*this, O, M, "ds."); } void BUDataStructures::print(std::ostream &O, const Module *M) const { + if (DontPrintAnything) return; printCollection(*this, O, M, "bu."); } void TDDataStructures::print(std::ostream &O, const Module *M) const { + if (DontPrintAnything) return; printCollection(*this, O, M, "td."); } void CompleteBUDataStructures::print(std::ostream &O, const Module *M) const { + if (DontPrintAnything) return; printCollection(*this, O, M, "cbu."); } From lattner at cs.uiuc.edu Thu Jan 22 09:27:01 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Jan 22 09:27:01 2004 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DSSupport.h Message-ID: <200401221526.JAA25415@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: DSSupport.h updated: 1.26 -> 1.27 --- Log message: Specialize std::swap correctly --- Diffs of the changes: (+5 -2) Index: llvm/include/llvm/Analysis/DSSupport.h diff -u llvm/include/llvm/Analysis/DSSupport.h:1.26 llvm/include/llvm/Analysis/DSSupport.h:1.27 --- llvm/include/llvm/Analysis/DSSupport.h:1.26 Tue Nov 11 16:41:31 2003 +++ llvm/include/llvm/Analysis/DSSupport.h Thu Jan 22 09:26:15 2004 @@ -127,7 +127,8 @@ } // End llvm namespace namespace std { - inline void swap(llvm::DSNodeHandle &NH1, llvm::DSNodeHandle &NH2) { NH1.swap(NH2); } + template<> + inline void swap(llvm::DSNodeHandle &NH1, llvm::DSNodeHandle &NH2) { NH1.swap(NH2); } } namespace llvm { @@ -296,6 +297,8 @@ } // End llvm namespace namespace std { - inline void swap(llvm::DSCallSite &CS1, llvm::DSCallSite &CS2) { CS1.swap(CS2); } + template<> + inline void swap(llvm::DSCallSite &CS1, + llvm::DSCallSite &CS2) { CS1.swap(CS2); } } #endif From lattner at cs.uiuc.edu Thu Jan 22 09:28:02 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Jan 22 09:28:02 2004 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DSGraph.h Message-ID: <200401221527.JAA25919@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: DSGraph.h updated: 1.64 -> 1.65 --- Log message: Remove const qualifier (all Value*'s are nonconst in DSA, so it's not clear why this one was) Add new method proto --- Diffs of the changes: (+20 -1) Index: llvm/include/llvm/Analysis/DSGraph.h diff -u llvm/include/llvm/Analysis/DSGraph.h:1.64 llvm/include/llvm/Analysis/DSGraph.h:1.65 --- llvm/include/llvm/Analysis/DSGraph.h:1.64 Wed Nov 12 11:58:09 2003 +++ llvm/include/llvm/Analysis/DSGraph.h Thu Jan 22 09:26:52 2004 @@ -27,7 +27,7 @@ // Public data-type declarations... typedef hash_map ScalarMapTy; typedef hash_map ReturnNodesTy; - typedef hash_set GlobalSetTy; + typedef hash_set GlobalSetTy; /// NodeMapTy - This data type is used when cloning one graph into another to /// keep track of the correspondence between the nodes in the old and new @@ -270,12 +270,31 @@ /// cloneInto - Clone the specified DSGraph into the current graph. The /// translated ScalarMap for the old function is filled into the OldValMap /// member, and the translated ReturnNodes map is returned into ReturnNodes. + /// OldNodeMap contains a mapping from the original nodes to the newly cloned + /// nodes. /// /// The CloneFlags member controls various aspects of the cloning process. /// void cloneInto(const DSGraph &G, ScalarMapTy &OldValMap, ReturnNodesTy &OldReturnNodes, NodeMapTy &OldNodeMap, unsigned CloneFlags = 0); + + /// clonePartiallyInto - Clone the reachable subset of the specified DSGraph + /// into the current graph, for the specified function. + /// + /// This differs from cloneInto in that it only clones nodes reachable from + /// globals, call nodes, the scalars specified in ValBindings, and the return + /// value of the specified function. This method merges the the cloned + /// version of the scalars and return value with the specified DSNodeHandles. + /// + /// On return, OldNodeMap contains a mapping from the original nodes to the + /// newly cloned nodes, for the subset of nodes that were actually cloned. + /// + /// The CloneFlags member controls various aspects of the cloning process. + /// + void clonePartiallyInto(const DSGraph &G, Function &F, const DSNodeHandle &RetVal, + const ScalarMapTy &ValBindings, NodeMapTy &OldNodeMap, + unsigned CloneFlags = 0); /// mergeInGraph - The method is used for merging graphs together. If the /// argument graph is not *this, it makes a clone of the specified graph, then From lattner at cs.uiuc.edu Thu Jan 22 09:32:01 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Jan 22 09:32:01 2004 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp Message-ID: <200401221531.JAA31668@zion.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructure.cpp updated: 1.131 -> 1.132 --- Log message: Start implementing DSGraph::clonePartiallyInto and implement mergeInGraph in terms of it. Though clonePartiallyInto is not cloning partial graphs yet, this change dramatically speeds up inlining of graphs with many scalars. For example, this change speeds up the BU pass on 253.perlbmk from 69s to 36s, because it avoids iteration over the scalar map, which can get pretty large. --- Diffs of the changes: (+176 -66) Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.131 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.132 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.131 Wed Nov 12 17:11:14 2003 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Thu Jan 22 09:30:58 2004 @@ -941,7 +941,6 @@ New->maskNodeTypes(~BitsToClear); OldNodeMap[Old] = New; } - #ifndef NDEBUG Timer::addPeakMemoryMeasurement(); #endif @@ -992,6 +991,112 @@ } } +/// clonePartiallyInto - Clone the reachable subset of the specified DSGraph +/// into the current graph, for the specified function. +/// +/// This differs from cloneInto in that it only clones nodes reachable from +/// globals, call nodes, the scalars specified in ValBindings, and the return +/// value of the specified function. This method merges the the cloned +/// version of the scalars and return value with the specified DSNodeHandles. +/// +/// On return, OldNodeMap contains a mapping from the original nodes to the +/// newly cloned nodes, for the subset of nodes that were actually cloned. +/// +/// The CloneFlags member controls various aspects of the cloning process. +/// +void DSGraph::clonePartiallyInto(const DSGraph &G, Function &F, + const DSNodeHandle &RetVal, + const ScalarMapTy &ValBindings, + NodeMapTy &OldNodeMap, + unsigned CloneFlags) { + + assert(OldNodeMap.empty() && "Returned OldNodeMap should be empty!"); + assert(&G != this && "Cannot clone graph into itself!"); + + unsigned FN = Nodes.size(); // First new node... + + /// FIXME: This currently clones the whole graph over, instead of doing it + /// incrementally. This could be sped up quite a bit further! + + // Duplicate all of the nodes, populating the node map... + Nodes.reserve(FN+G.Nodes.size()); + + // Remove alloca or mod/ref bits as specified... + unsigned BitsToClear = ((CloneFlags & StripAllocaBit)? DSNode::AllocaNode : 0) + | ((CloneFlags & StripModRefBits)? (DSNode::Modified | DSNode::Read) : 0) + | ((CloneFlags & StripIncompleteBit)? DSNode::Incomplete : 0); + BitsToClear |= DSNode::DEAD; // Clear dead flag... + + GlobalSetTy ClonedGlobals; + for (unsigned i = 0, e = G.Nodes.size(); i != e; ++i) { + DSNode *Old = G.Nodes[i]; + DSNode *New = new DSNode(*Old, this); + New->maskNodeTypes(~BitsToClear); + OldNodeMap[Old] = New; + + ClonedGlobals.insert(New->getGlobals().begin(), New->getGlobals().end()); + } +#ifndef NDEBUG + Timer::addPeakMemoryMeasurement(); +#endif + + // Rewrite the links in the new nodes to point into the current graph now. + for (unsigned i = FN, e = Nodes.size(); i != e; ++i) + Nodes[i]->remapLinks(OldNodeMap); + + // Ensure that all global nodes end up in the scalar map, as appropriate. + for (GlobalSetTy::iterator CI = ClonedGlobals.begin(), + E = ClonedGlobals.end(); CI != E; ++CI) { + const DSNodeHandle &NGH = G.ScalarMap.find(*CI)->second; + + DSNodeHandle &MappedNode = OldNodeMap[NGH.getNode()]; + DSNodeHandle H(MappedNode.getNode(),NGH.getOffset()+MappedNode.getOffset()); + ScalarMap[*CI].mergeWith(H); + InlinedGlobals.insert(*CI); + } + + // Merge the requested portion of the scalar map with the values specified. + for (ScalarMapTy::const_iterator I = ValBindings.begin(), + E = ValBindings.end(); I != E; ++I) { + ScalarMapTy::const_iterator SMI = G.ScalarMap.find(I->first); + assert(SMI != G.ScalarMap.end() && "Cannot map non-existant scalar!"); + + DSNodeHandle &MappedNode = OldNodeMap[SMI->second.getNode()]; + DSNodeHandle H(MappedNode.getNode(), + SMI->second.getOffset()+MappedNode.getOffset()); + H.mergeWith(I->second); + } + + // Map the return node pointer over. + if (RetVal.getNode()) { + const DSNodeHandle &Ret = G.getReturnNodeFor(F); + DSNodeHandle &MappedRet = OldNodeMap[Ret.getNode()]; + DSNodeHandle H(MappedRet.getNode(), + MappedRet.getOffset()+Ret.getOffset()); + H.mergeWith(RetVal); + } + + // If requested, copy the calls or aux-calls lists. + if (!(CloneFlags & DontCloneCallNodes)) { + // Copy the function calls list... + unsigned FC = FunctionCalls.size(); // FirstCall + FunctionCalls.reserve(FC+G.FunctionCalls.size()); + for (unsigned i = 0, ei = G.FunctionCalls.size(); i != ei; ++i) + FunctionCalls.push_back(DSCallSite(G.FunctionCalls[i], OldNodeMap)); + } + + if (!(CloneFlags & DontCloneAuxCallNodes)) { + // Copy the auxiliary function calls list... + unsigned FC = AuxFunctionCalls.size(); // FirstCall + AuxFunctionCalls.reserve(FC+G.AuxFunctionCalls.size()); + for (unsigned i = 0, ei = G.AuxFunctionCalls.size(); i != ei; ++i) + AuxFunctionCalls.push_back(DSCallSite(G.AuxFunctionCalls[i], OldNodeMap)); + } +} + + + + /// mergeInGraph - The method is used for merging graphs together. If the /// argument graph is not *this, it makes a clone of the specified graph, then /// merges the nodes specified in the call site with the formal arguments in the @@ -999,52 +1104,61 @@ /// void DSGraph::mergeInGraph(const DSCallSite &CS, Function &F, const DSGraph &Graph, unsigned CloneFlags) { - ScalarMapTy OldValMap, *ScalarMap; - DSNodeHandle RetVal; - // If this is not a recursive call, clone the graph into this graph... if (&Graph != this) { // Clone the callee's graph into the current graph, keeping // track of where scalars in the old graph _used_ to point, // and of the new nodes matching nodes of the old graph. - NodeMapTy OldNodeMap; - - // The clone call may invalidate any of the vectors in the data - // structure graph. Strip locals and don't copy the list of callers - ReturnNodesTy OldRetNodes; - cloneInto(Graph, OldValMap, OldRetNodes, OldNodeMap, CloneFlags); - - // We need to map the arguments for the function to the cloned nodes old - // argument values. Do this now. - RetVal = OldRetNodes[&F]; - ScalarMap = &OldValMap; - } else { - RetVal = getReturnNodeFor(F); - ScalarMap = &getScalarMap(); - } + ScalarMapTy ValueBindings; - // Merge the return value with the return value of the context... - RetVal.mergeWith(CS.getRetVal()); + // Set up argument bindings + Function::aiterator AI = F.abegin(); + for (unsigned i = 0, e = CS.getNumPtrArgs(); i != e; ++i, ++AI) { + // Advance the argument iterator to the first pointer argument... + while (AI != F.aend() && !isPointerType(AI->getType())) { + ++AI; +#ifndef NDEBUG + if (AI == F.aend()) + std::cerr << "Bad call to Function: " << F.getName() << "\n"; +#endif + } + if (AI == F.aend()) break; + + // Add the link from the argument scalar to the provided value. + ValueBindings[AI] = CS.getPtrArg(i); + } + + NodeMapTy OldNodeMap; + clonePartiallyInto(Graph, F, CS.getRetVal(), ValueBindings, OldNodeMap, + CloneFlags); - // Resolve all of the function arguments... - Function::aiterator AI = F.abegin(); + } else { + DSNodeHandle RetVal = getReturnNodeFor(F); + ScalarMapTy &ScalarMap = getScalarMap(); - for (unsigned i = 0, e = CS.getNumPtrArgs(); i != e; ++i, ++AI) { - // Advance the argument iterator to the first pointer argument... - while (AI != F.aend() && !isPointerType(AI->getType())) { - ++AI; + // Merge the return value with the return value of the context... + RetVal.mergeWith(CS.getRetVal()); + + // Resolve all of the function arguments... + Function::aiterator AI = F.abegin(); + + for (unsigned i = 0, e = CS.getNumPtrArgs(); i != e; ++i, ++AI) { + // Advance the argument iterator to the first pointer argument... + while (AI != F.aend() && !isPointerType(AI->getType())) { + ++AI; #ifndef NDEBUG - if (AI == F.aend()) - std::cerr << "Bad call to Function: " << F.getName() << "\n"; + if (AI == F.aend()) + std::cerr << "Bad call to Function: " << F.getName() << "\n"; #endif + } + if (AI == F.aend()) break; + + // Add the link from the argument scalar to the provided value + assert(ScalarMap.count(AI) && "Argument not in scalar map?"); + DSNodeHandle &NH = ScalarMap[AI]; + assert(NH.getNode() && "Pointer argument without scalarmap entry?"); + NH.mergeWith(CS.getPtrArg(i)); } - if (AI == F.aend()) break; - - // Add the link from the argument scalar to the provided value - assert(ScalarMap->count(AI) && "Argument not in scalar map?"); - DSNodeHandle &NH = (*ScalarMap)[AI]; - assert(NH.getNode() && "Pointer argument without scalarmap entry?"); - NH.mergeWith(CS.getPtrArg(i)); } } @@ -1222,8 +1336,7 @@ } } - Calls.erase(std::unique(Calls.begin(), Calls.end()), - Calls.end()); + Calls.erase(std::unique(Calls.begin(), Calls.end()), Calls.end()); // Track the number of call nodes merged away... NumCallNodesMerged += NumFns-Calls.size(); @@ -1251,10 +1364,25 @@ N->getLink(l*N->getPointerSize()).getNode(); } - // Likewise, forward any edges from the scalar nodes... - for (ScalarMapTy::iterator I = ScalarMap.begin(), E = ScalarMap.end(); - I != E; ++I) - I->second.getNode(); + // Likewise, forward any edges from the scalar nodes. While we are at it, + // clean house a bit. + for (ScalarMapTy::iterator I = ScalarMap.begin(),E = ScalarMap.end();I != E;){ + // Check to see if this is a worthless node generated for non-pointer + // values, such as integers. Consider an addition of long types: A+B. + // Assuming we can track all uses of the value in this context, and it is + // NOT used as a pointer, we can delete the node. We will be able to detect + // this situation if the node pointed to ONLY has Unknown bit set in the + // node. In this case, the node is not incomplete, does not point to any + // other nodes (no mod/ref bits set), and is therefore uninteresting for + // data structure analysis. If we run across one of these, prune the scalar + // pointing to it. + // + DSNode *N = I->second.getNode(); + if (N->getNodeFlags() == DSNode::UnknownNode && !isa(I->first)) + ScalarMap.erase(I++); + else + ++I; + } bool isGlobalsGraph = !GlobalsGraph; @@ -1335,11 +1463,9 @@ void DSNode::markReachableNodes(hash_set &ReachableNodes) { if (this == 0) return; assert(getForwardNode() == 0 && "Cannot mark a forwarded node!"); - if (ReachableNodes.count(this)) return; // Already marked reachable - ReachableNodes.insert(this); // Is reachable now - - for (unsigned i = 0, e = getSize(); i < e; i += DS::PointerSize) - getLink(i).getNode()->markReachableNodes(ReachableNodes); + if (ReachableNodes.insert(this).second) // Is newly reachable? + for (unsigned i = 0, e = getSize(); i < e; i += DS::PointerSize) + getLink(i).getNode()->markReachableNodes(ReachableNodes); } void DSCallSite::markReachableNodes(hash_set &Nodes) { @@ -1421,30 +1547,14 @@ std::vector > GlobalNodes; // Mark all nodes reachable by (non-global) scalar nodes as alive... - for (ScalarMapTy::iterator I = ScalarMap.begin(), E = ScalarMap.end(); I !=E;) + for (ScalarMapTy::iterator I = ScalarMap.begin(), E = ScalarMap.end(); I != E; + ++I) if (isa(I->first)) { // Keep track of global nodes assert(I->second.getNode() && "Null global node?"); assert(I->second.getNode()->isGlobalNode() && "Should be a global node!"); GlobalNodes.push_back(std::make_pair(I->first, I->second.getNode())); - ++I; } else { - // Check to see if this is a worthless node generated for non-pointer - // values, such as integers. Consider an addition of long types: A+B. - // Assuming we can track all uses of the value in this context, and it is - // NOT used as a pointer, we can delete the node. We will be able to - // detect this situation if the node pointed to ONLY has Unknown bit set - // in the node. In this case, the node is not incomplete, does not point - // to any other nodes (no mod/ref bits set), and is therefore - // uninteresting for data structure analysis. If we run across one of - // these, prune the scalar pointing to it. - // - DSNode *N = I->second.getNode(); - if (N->getNodeFlags() == DSNode::UnknownNode && !isa(I->first)){ - ScalarMap.erase(I++); - } else { - I->second.getNode()->markReachableNodes(Alive); - ++I; - } + I->second.getNode()->markReachableNodes(Alive); } // The return value is alive as well... From criswell at cs.uiuc.edu Thu Jan 22 09:47:01 2004 From: criswell at cs.uiuc.edu (John Criswell) Date: Thu Jan 22 09:47:01 2004 Subject: [llvm-commits] [GNU_GCC] CVS: gcc-3.4/gcc/cgraphunit.c Message-ID: <200401221546.JAA11222@choi.cs.uiuc.edu> Changes in directory gcc-3.4/gcc: cgraphunit.c updated: 1.1.1.2 -> 1.1.1.3 --- Log message: Updating to revision 1.36 of cgraphunit.c. This should fix some inlining issues (I hope). --- Diffs of the changes: (+141 -45) Index: gcc-3.4/gcc/cgraphunit.c diff -u gcc-3.4/gcc/cgraphunit.c:1.1.1.2 gcc-3.4/gcc/cgraphunit.c:1.1.1.3 --- gcc-3.4/gcc/cgraphunit.c:1.1.1.2 Tue Jan 13 10:49:00 2004 +++ gcc-3.4/gcc/cgraphunit.c Thu Jan 22 09:46:30 2004 @@ -49,6 +49,7 @@ static void cgraph_optimize_function (struct cgraph_node *); static bool cgraph_default_inline_p (struct cgraph_node *n); static void cgraph_analyze_function (struct cgraph_node *node); +static void cgraph_decide_inlining_incrementally (struct cgraph_node *); /* Statistics we collect about inlining algorithm. */ static int ncalls_inlined; @@ -106,15 +107,15 @@ /* "extern inline" functions are never output locally. */ if (DECL_EXTERNAL (decl)) return false; - /* We want to emit COMDAT functions only when absolutely neccesary. */ + /* We want to emit COMDAT functions only when absolutely necessary. */ if (DECL_COMDAT (decl)) return false; if (!DECL_INLINE (decl) || (!node->local.disregard_inline_limits /* When declared inline, defer even the uninlinable functions. - This allows them to be elliminated when unused. */ + This allows them to be eliminated when unused. */ && !DECL_DECLARED_INLINE_P (decl) - && (node->local.inlinable || !cgraph_default_inline_p (node)))) + && (!node->local.inlinable || !cgraph_default_inline_p (node)))) return true; return false; @@ -166,7 +167,7 @@ inlined in others. ??? It may make more sense to use one body for inlining and other - body for expanding the function but this is dificult to do. */ + body for expanding the function but this is difficult to do. */ /* If node->output is set, then this is a unit-at-a-time compilation and we have already begun whole-unit analysis. This is *not* @@ -183,7 +184,7 @@ memset (&node->rtl, 0, sizeof (node->rtl)); node->analyzed = false; while (node->callees) - cgraph_remove_call (node->decl, node->callees->callee->decl); + cgraph_remove_edge (node, node->callees->callee); /* We may need to re-queue the node for assembling in case we already proceeded it and ignored as not needed. */ @@ -206,7 +207,10 @@ /* If not unit at a time, then we need to create the call graph now, so that called functions can be queued and emitted now. */ if (!flag_unit_at_a_time) - cgraph_analyze_function (node); + { + cgraph_analyze_function (node); + cgraph_decide_inlining_incrementally (node); + } if (decide_is_function_needed (node, decl)) cgraph_mark_needed_node (node); @@ -354,7 +358,7 @@ timevar_push (TV_CGRAPH); if (cgraph_dump_file) { - fprintf (cgraph_dump_file, "\nInitial entry points:"); + fprintf (cgraph_dump_file, "Initial entry points:"); for (node = cgraph_nodes; node; node = node->next) if (node->needed && DECL_SAVED_TREE (node->decl)) fprintf (cgraph_dump_file, " %s", cgraph_node_name (node)); @@ -395,11 +399,11 @@ if (cgraph_dump_file) { - fprintf (cgraph_dump_file, "\nUnit entry points:"); + fprintf (cgraph_dump_file, "Unit entry points:"); for (node = cgraph_nodes; node; node = node->next) if (node->needed && DECL_SAVED_TREE (node->decl)) fprintf (cgraph_dump_file, " %s", cgraph_node_name (node)); - fprintf (cgraph_dump_file, "\n"); + fprintf (cgraph_dump_file, "\n\nInitial "); dump_cgraph (cgraph_dump_file); } @@ -418,7 +422,10 @@ } } if (cgraph_dump_file) - fprintf (cgraph_dump_file, "\n"); + { + fprintf (cgraph_dump_file, "\n\nReclaimed "); + dump_cgraph (cgraph_dump_file); + } ggc_collect (); timevar_pop (TV_CGRAPH); } @@ -657,7 +664,7 @@ if (cgraph_dump_file) { - fprintf (cgraph_dump_file, "Found inline predecesors of %s:", + fprintf (cgraph_dump_file, " Found inline predecesors of %s:", cgraph_node_name (node)); for (i = 0; i < nfound; i++) { @@ -754,7 +761,7 @@ if (cgraph_dump_file) { - fprintf (cgraph_dump_file, "Found inline successors of %s:", + fprintf (cgraph_dump_file, " Found inline successors of %s:", cgraph_node_name (node)); for (i = 0; i < nfound; i++) { @@ -775,7 +782,7 @@ cgraph_estimate_size_after_inlining (int times, struct cgraph_node *to, struct cgraph_node *what) { - return (what->global.insns - INSNS_PER_CALL) *times + to->global.insns; + return (what->global.insns - INSNS_PER_CALL) * times + to->global.insns; } /* Estimate the growth caused by inlining NODE into all callees. */ @@ -849,6 +856,7 @@ to->global.insns = new_insns; if (!called && !what->needed && !what->origin + && flag_unit_at_a_time && !DECL_EXTERNAL (what->decl)) { if (!what->global.will_be_output) @@ -919,7 +927,7 @@ return true; } -/* Return true when function N is small enought to be inlined. */ +/* Return true when function N is small enough to be inlined. */ static bool cgraph_default_inline_p (struct cgraph_node *n) @@ -973,7 +981,7 @@ } if (cgraph_dump_file) - fprintf (cgraph_dump_file, "\n\nDeciding on inlining: "); + fprintf (cgraph_dump_file, "\nDeciding on smaller functions:\n"); while ((node = fibheap_extract_min (heap)) && overall_insns <= max_insns) { struct cgraph_edge *e; @@ -981,13 +989,15 @@ heap_node[node->uid] = NULL; if (cgraph_dump_file) - fprintf (cgraph_dump_file, "Considering %s %i insns, growth %i.\n", + fprintf (cgraph_dump_file, + "\nConsidering %s with %i insns\n" + " Estimated growth is %+i insns.\n", cgraph_node_name (node), node->global.insns, cgraph_estimate_growth (node)); if (!cgraph_default_inline_p (node)) { if (cgraph_dump_file) - fprintf (cgraph_dump_file, "Function too large.\n"); + fprintf (cgraph_dump_file, " Function too large.\n"); continue; } ninlined_callees = cgraph_inlined_callees (node, inlined_callees); @@ -1002,7 +1012,7 @@ for (i = 0; i < ninlined; i++) inlined[i]->output = 0, node->aux = 0; if (cgraph_dump_file) - fprintf (cgraph_dump_file, "Not inlining into %s\n", + fprintf (cgraph_dump_file, " Not inlining into %s.\n", cgraph_node_name (e->caller)); continue; } @@ -1021,9 +1031,15 @@ fibheap_replace_key (heap, heap_node[inlined[i]->uid], cgraph_estimate_growth (inlined[i])); } + if (cgraph_dump_file) + fprintf (cgraph_dump_file, + " Inlined into %s which now has %i insns.\n", + cgraph_node_name (e->caller), + e->caller->global.insns); + } - /* Similarly all functions called by function we just inlined + /* Similarly all functions called by the function we just inlined are now called more times; update keys. */ for (e = node->callees; e; e = e->next_callee) @@ -1043,14 +1059,12 @@ inlined_callees[i]->output = 0, node->aux = 0; } if (cgraph_dump_file) - fprintf (cgraph_dump_file, - "Created %i clones, Num insns:%i (%+i), %.2f%%.\n\n", - node->global.cloned_times - 1, - overall_insns, overall_insns - old_insns, - overall_insns * 100.0 / initial_insns); + fprintf (cgraph_dump_file, + " Inlined %i times for a net change of %+i insns.\n", + node->global.cloned_times, overall_insns - old_insns); } if (cgraph_dump_file && !fibheap_empty (heap)) - fprintf (cgraph_dump_file, "inline-unit-growth limit reached.\n"); + fprintf (cgraph_dump_file, "\nReached the inline-unit-growth limit.\n"); fibheap_delete (heap); free (heap_node); } @@ -1071,6 +1085,7 @@ xcalloc (cgraph_n_nodes, sizeof (struct cgraph_node *)); int ninlined; int ninlined_callees; + int old_insns = 0; int i, y; for (node = cgraph_nodes; node; node = node->next) @@ -1079,14 +1094,19 @@ nnodes = cgraph_postorder (order); + if (cgraph_dump_file) + fprintf (cgraph_dump_file, + "\nDeciding on inlining. Starting with %i insns.\n", + initial_insns); + for (node = cgraph_nodes; node; node = node->next) node->aux = 0; if (cgraph_dump_file) - fprintf (cgraph_dump_file, "\n\nDeciding on always_inline functions:\n"); + fprintf (cgraph_dump_file, "\nInlining always_inline functions:\n"); /* In the first pass mark all always_inline edges. Do this with a priority - so no our decisions makes this impossible. */ + so none of our later choices will make this impossible. */ for (i = nnodes - 1; i >= 0; i--) { struct cgraph_edge *e; @@ -1100,11 +1120,12 @@ continue; if (cgraph_dump_file) fprintf (cgraph_dump_file, - "Considering %s %i insns (always inline)\n", - cgraph_node_name (node), node->global.insns); + "\nConsidering %s %i insns (always inline)\n", + cgraph_node_name (e->callee), e->callee->global.insns); ninlined = cgraph_inlined_into (order[i], inlined); for (; e; e = e->next_callee) { + old_insns = overall_insns; if (e->inline_call || !e->callee->local.disregard_inline_limits) continue; if (e->callee->output || e->callee == node) @@ -1116,9 +1137,15 @@ for (y = 0; y < ninlined_callees; y++) inlined_callees[y]->output = 0, node->aux = 0; if (cgraph_dump_file) - fprintf (cgraph_dump_file, "Inlined %i times. Now %i insns\n\n", - node->global.cloned_times, overall_insns); + fprintf (cgraph_dump_file, + " Inlined into %s which now has %i insns.\n", + cgraph_node_name (node->callees->caller), + node->callees->caller->global.insns); } + if (cgraph_dump_file && node->global.cloned_times > 0) + fprintf (cgraph_dump_file, + " Inlined %i times for a net change of %+i insns.\n", + node->global.cloned_times, overall_insns - old_insns); for (y = 0; y < ninlined; y++) inlined[y]->output = 0, node->aux = 0; } @@ -1126,7 +1153,7 @@ cgraph_decide_inlining_of_small_functions (inlined, inlined_callees); if (cgraph_dump_file) - fprintf (cgraph_dump_file, "\n\nFunctions to inline once:\n"); + fprintf (cgraph_dump_file, "\nDeciding on functions called once:\n"); /* And finally decide what functions are called once. */ @@ -1151,9 +1178,13 @@ { if (cgraph_dump_file) fprintf (cgraph_dump_file, - "Considering %s %i insns (called once)\n", - cgraph_node_name (node), node->global.insns); + "\nConsidering %s %i insns.\n" + " Called once from %s %i insns.\n", + cgraph_node_name (node), node->global.insns, + cgraph_node_name (node->callers->caller), + node->callers->caller->global.insns); ninlined = cgraph_inlined_into (node->callers->caller, inlined); + old_insns = overall_insns; if (cgraph_check_inline_limits (node->callers->caller, node, inlined, ninlined)) { @@ -1165,8 +1196,19 @@ for (y = 0; y < ninlined_callees; y++) inlined_callees[y]->output = 0, node->aux = 0; if (cgraph_dump_file) - fprintf (cgraph_dump_file, "Inlined. Now %i insns\n\n", overall_insns); + fprintf (cgraph_dump_file, + " Inlined into %s which now has %i insns" + " for a net change of %+i insns.\n", + cgraph_node_name (node->callers->caller), + node->callers->caller->global.insns, + overall_insns - old_insns); } + else + { + if (cgraph_dump_file) + fprintf (cgraph_dump_file, + " Inline limit reached, not inlined.\n"); + } for (y = 0; y < ninlined; y++) inlined[y]->output = 0, node->aux = 0; } @@ -1175,7 +1217,8 @@ if (cgraph_dump_file) fprintf (cgraph_dump_file, - "\nInlined %i calls, elliminated %i functions, %i insns turned to %i insns.\n", + "\nInlined %i calls, eliminated %i functions, " + "%i insns turned to %i insns.\n\n", ncalls_inlined, nfunctions_inlined, initial_insns, overall_insns); free (order); @@ -1183,6 +1226,59 @@ free (inlined_callees); } +/* Decide on the inlining. We do so in the topological order to avoid + expenses on updating datastructures. */ + +static void +cgraph_decide_inlining_incrementally (struct cgraph_node *node) +{ + struct cgraph_edge *e; + struct cgraph_node **inlined = + xmalloc (sizeof (struct cgraph_node *) * cgraph_n_nodes); + struct cgraph_node **inlined_callees = + xmalloc (sizeof (struct cgraph_node *) * cgraph_n_nodes); + int ninlined; + int ninlined_callees; + int y; + + ninlined = cgraph_inlined_into (node, inlined); + + /* First of all look for always inline functions. */ + for (e = node->callees; e; e = e->next_callee) + if (e->callee->local.disregard_inline_limits && !e->callee->output + && e->callee != node && !e->inline_call) + { + ninlined_callees = cgraph_inlined_callees (e->callee, inlined_callees); + cgraph_mark_inline (node, e->callee, inlined, ninlined, + inlined_callees, ninlined_callees); + for (y = 0; y < ninlined_callees; y++) + inlined_callees[y]->output = 0, node->aux = 0; + } + + /* Now do the automatic inlining. */ + for (e = node->callees; e; e = e->next_callee) + if (e->callee->local.inlinable && !e->callee->output + && e->callee != node && !e->inline_call + && cgraph_default_inline_p (e->callee) + && cgraph_check_inline_limits (node, e->callee, inlined, + ninlined)) + { + ninlined_callees = cgraph_inlined_callees (e->callee, inlined_callees); + cgraph_mark_inline (node, e->callee, inlined, ninlined, + inlined_callees, ninlined_callees); + for (y = 0; y < ninlined_callees; y++) + inlined_callees[y]->output = 0, node->aux = 0; + } + + /* Clear the flags set by cgraph_inlined_into. */ + for (y = 0; y < ninlined; y++) + inlined[y]->output = 0, node->aux = 0; + + free (inlined); + free (inlined_callees); +} + + /* Return true when CALLER_DECL should be inlined into CALLEE_DECL. */ bool @@ -1250,7 +1346,7 @@ struct cgraph_node *node; if (cgraph_dump_file) - fprintf (cgraph_dump_file, "Marking local functions:"); + fprintf (cgraph_dump_file, "\nMarking local functions:"); /* Figure out functions we want to assemble. */ for (node = cgraph_nodes; node; node = node->next) @@ -1262,7 +1358,7 @@ fprintf (cgraph_dump_file, " %s", cgraph_node_name (node)); } if (cgraph_dump_file) - fprintf (cgraph_dump_file, "\n"); + fprintf (cgraph_dump_file, "\n\n"); } /* Perform simple optimizations based on callgraph. */ @@ -1275,30 +1371,30 @@ timevar_push (TV_CGRAPHOPT); if (!quiet_flag) fprintf (stderr, "Performing intraprocedural optimizations\n"); + + cgraph_mark_local_functions (); if (cgraph_dump_file) { - fprintf (cgraph_dump_file, "Initial callgraph:"); + fprintf (cgraph_dump_file, "Marked "); dump_cgraph (cgraph_dump_file); } - cgraph_mark_local_functions (); cgraph_decide_inlining (); - cgraph_global_info_ready = true; if (cgraph_dump_file) { - fprintf (cgraph_dump_file, "Optimized callgraph:"); + fprintf (cgraph_dump_file, "Optimized "); dump_cgraph (cgraph_dump_file); } timevar_pop (TV_CGRAPHOPT); - if (!quiet_flag) - fprintf (stderr, "Assembling functions:"); /* Output everything. */ + if (!quiet_flag) + fprintf (stderr, "Assembling functions:\n"); cgraph_expand_all_functions (); if (cgraph_dump_file) { - fprintf (cgraph_dump_file, "Final callgraph:"); + fprintf (cgraph_dump_file, "\nFinal "); dump_cgraph (cgraph_dump_file); } } From criswell at cs.uiuc.edu Thu Jan 22 10:02:01 2004 From: criswell at cs.uiuc.edu (John Criswell) Date: Thu Jan 22 10:02:01 2004 Subject: [llvm-commits] [GNU_GCC] CVS: gcc-3.4/gcc/cgraph.h cgraph.c Message-ID: <200401221601.KAA11429@choi.cs.uiuc.edu> Changes in directory gcc-3.4/gcc: cgraph.h updated: 1.1.1.2 -> 1.1.1.3 cgraph.c updated: 1.1.1.2 -> 1.1.1.3 --- Log message: Added a needed function for the additions to cgraphunit.c. --- Diffs of the changes: (+2 -2) Index: gcc-3.4/gcc/cgraph.h diff -u gcc-3.4/gcc/cgraph.h:1.1.1.2 gcc-3.4/gcc/cgraph.h:1.1.1.3 --- gcc-3.4/gcc/cgraph.h:1.1.1.2 Tue Jan 13 10:49:00 2004 +++ gcc-3.4/gcc/cgraph.h Thu Jan 22 10:01:21 2004 @@ -150,6 +150,7 @@ /* In cgraph.c */ void dump_cgraph (FILE *); +void cgraph_remove_edge (struct cgraph_node *, struct cgraph_node *); void cgraph_remove_call (tree, tree); void cgraph_remove_node (struct cgraph_node *); struct cgraph_edge *cgraph_record_call (tree, tree); Index: gcc-3.4/gcc/cgraph.c diff -u gcc-3.4/gcc/cgraph.c:1.1.1.2 gcc-3.4/gcc/cgraph.c:1.1.1.3 --- gcc-3.4/gcc/cgraph.c:1.1.1.2 Tue Jan 13 10:49:00 2004 +++ gcc-3.4/gcc/cgraph.c Thu Jan 22 10:01:21 2004 @@ -68,7 +68,6 @@ static struct cgraph_edge *create_edge (struct cgraph_node *, struct cgraph_node *); -static void cgraph_remove_edge (struct cgraph_node *, struct cgraph_node *); static hashval_t hash_node (const void *); static int eq_node (const void *, const void *); @@ -180,7 +179,7 @@ /* Remove the edge from CALLER to CALLEE in the cgraph. */ -static void +void cgraph_remove_edge (struct cgraph_node *caller, struct cgraph_node *callee) { struct cgraph_edge **edge, **edge2; From lattner at cs.uiuc.edu Thu Jan 22 10:09:05 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Jan 22 10:09:05 2004 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DSNode.h DSSupport.h Message-ID: <200401221609.KAA09831@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: DSNode.h updated: 1.33 -> 1.34 DSSupport.h updated: 1.27 -> 1.28 --- Log message: It doesn't make sense for one side to be const, but not the other. --- Diffs of the changes: (+10 -7) Index: llvm/include/llvm/Analysis/DSNode.h diff -u llvm/include/llvm/Analysis/DSNode.h:1.33 llvm/include/llvm/Analysis/DSNode.h:1.34 --- llvm/include/llvm/Analysis/DSNode.h:1.33 Tue Nov 11 16:41:30 2003 +++ llvm/include/llvm/Analysis/DSNode.h Thu Jan 22 10:08:51 2004 @@ -326,7 +326,7 @@ return HandleForwarding(); } -inline void DSNodeHandle::setNode(DSNode *n) { +inline void DSNodeHandle::setNode(DSNode *n) const { assert(!n || !n->getForwardNode() && "Cannot set node to a forwarded node!"); if (N) N->NumReferrers--; N = n; @@ -377,11 +377,14 @@ /// mergeWith - Merge the logical node pointed to by 'this' with the node /// pointed to by 'N'. /// -inline void DSNodeHandle::mergeWith(const DSNodeHandle &Node) { - if (N != 0) +inline void DSNodeHandle::mergeWith(const DSNodeHandle &Node) const { + if (!isNull()) getNode()->mergeWith(Node, Offset); - else // No node to merge with, so just point to Node - *this = Node; + else { // No node to merge with, so just point to Node + Offset = 0; + setNode(Node.getNode()); + Offset = Node.getOffset(); + } } } // End llvm namespace Index: llvm/include/llvm/Analysis/DSSupport.h diff -u llvm/include/llvm/Analysis/DSSupport.h:1.27 llvm/include/llvm/Analysis/DSSupport.h:1.28 --- llvm/include/llvm/Analysis/DSSupport.h:1.27 Thu Jan 22 09:26:15 2004 +++ llvm/include/llvm/Analysis/DSSupport.h Thu Jan 22 10:08:51 2004 @@ -93,7 +93,7 @@ inline DSNode *getNode() const; // Defined inline in DSNode.h unsigned getOffset() const { return Offset; } - inline void setNode(DSNode *N); // Defined inline in DSNode.h + inline void setNode(DSNode *N) const; // Defined inline in DSNode.h void setOffset(unsigned O) { //assert((!N || Offset < N->Size || (N->Size == 0 && Offset == 0) || // !N->ForwardNH.isNull()) && "Node handle offset out of range!"); @@ -108,7 +108,7 @@ /// mergeWith - Merge the logical node pointed to by 'this' with the node /// pointed to by 'N'. /// - void mergeWith(const DSNodeHandle &N); + void mergeWith(const DSNodeHandle &N) const; // hasLink - Return true if there is a link at the specified offset... inline bool hasLink(unsigned Num) const; From lattner at cs.uiuc.edu Thu Jan 22 10:32:02 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Jan 22 10:32:02 2004 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp Message-ID: <200401221631.KAA13969@zion.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructure.cpp updated: 1.132 -> 1.133 --- Log message: Bug fix: X.mergeWith(Y) was not updating Y if Y was a null node handle! --- Diffs of the changes: (+9 -2) Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.132 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.133 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.132 Thu Jan 22 09:30:58 2004 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Thu Jan 22 10:31:08 2004 @@ -679,12 +679,19 @@ // Offset indicates what offset the specified node is to be merged into the // current node. // -// The specified node may be a null pointer (in which case, nothing happens). +// The specified node may be a null pointer (in which case, we update it to +// point to this node). // void DSNode::mergeWith(const DSNodeHandle &NH, unsigned Offset) { DSNode *N = NH.getNode(); - if (N == 0 || (N == this && NH.getOffset() == Offset)) + if (N == this && NH.getOffset() == Offset) return; // Noop + + // If the RHS is a null node, make it point to this node! + if (N == 0) { + NH.mergeWith(DSNodeHandle(this, Offset)); + return; + } assert(!N->isDeadNode() && !isDeadNode()); assert(!hasNoReferrers() && "Should not try to fold a useless node!"); From lattner at cs.uiuc.edu Thu Jan 22 10:37:06 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Jan 22 10:37:06 2004 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp Message-ID: <200401221636.KAA14563@zion.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructure.cpp updated: 1.133 -> 1.134 --- Log message: Ok, I'm tired of pulling out all my timers to check stuff in, just do it. --- Diffs of the changes: (+18 -0) Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.133 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.134 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.133 Thu Jan 22 10:31:08 2004 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Thu Jan 22 10:36:28 2004 @@ -29,6 +29,15 @@ Statistic<> NumCallNodesMerged("dsnode", "Number of call nodes merged"); }; +#if 0 +#define TIME_REGION(VARNAME, DESC) \ + NamedRegionTimer VARNAME(DESC) +#else +#define TIME_REGION(VARNAME, DESC) +#endif + + + using namespace DS; DSNode *DSNodeHandle::HandleForwarding() const { @@ -929,6 +938,7 @@ void DSGraph::cloneInto(const DSGraph &G, ScalarMapTy &OldValMap, ReturnNodesTy &OldReturnNodes, NodeMapTy &OldNodeMap, unsigned CloneFlags) { + TIME_REGION(X, "cloneInto"); assert(OldNodeMap.empty() && "Returned OldNodeMap should be empty!"); assert(&G != this && "Cannot clone graph into itself!"); @@ -956,6 +966,8 @@ for (unsigned i = FN, e = Nodes.size(); i != e; ++i) Nodes[i]->remapLinks(OldNodeMap); + { TIME_REGION(X, "cloneInto:scalars"); + // Copy the scalar map... merging all of the global nodes... for (ScalarMapTy::const_iterator I = G.ScalarMap.begin(), E = G.ScalarMap.end(); I != E; ++I) { @@ -970,6 +982,7 @@ InlinedGlobals.insert(GV); } } + } if (!(CloneFlags & DontCloneCallNodes)) { // Copy the function calls list... @@ -1017,6 +1030,7 @@ NodeMapTy &OldNodeMap, unsigned CloneFlags) { + TIME_REGION(X, "clonePartiallyInto"); assert(OldNodeMap.empty() && "Returned OldNodeMap should be empty!"); assert(&G != this && "Cannot clone graph into itself!"); @@ -1359,6 +1373,8 @@ // we don't have to perform any non-trivial analysis here. // void DSGraph::removeTriviallyDeadNodes() { + TIME_REGION(X, "removeTriviallyDeadNodes"); + removeIdenticalCalls(FunctionCalls); removeIdenticalCalls(AuxFunctionCalls); @@ -1546,6 +1562,8 @@ // Reduce the amount of work we have to do... remove dummy nodes left over by // merging... removeTriviallyDeadNodes(); + + TIME_REGION(X, "removeDeadNodes"); // FIXME: Merge non-trivially identical call nodes... From lattner at cs.uiuc.edu Thu Jan 22 10:57:01 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Jan 22 10:57:01 2004 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DSGraph.h Message-ID: <200401221656.KAA19997@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: DSGraph.h updated: 1.65 -> 1.66 --- Log message: Eliminated the CompletedNodes argument to the cloneReachable* methods. This map was only used to implement a marginal GlobalsGraph optimization, and it actually slows the analysis down (due to the overhead of keeping it), so just eliminate it entirely. --- Diffs of the changes: (+2 -5) Index: llvm/include/llvm/Analysis/DSGraph.h diff -u llvm/include/llvm/Analysis/DSGraph.h:1.65 llvm/include/llvm/Analysis/DSGraph.h:1.66 --- llvm/include/llvm/Analysis/DSGraph.h:1.65 Thu Jan 22 09:26:52 2004 +++ llvm/include/llvm/Analysis/DSGraph.h Thu Jan 22 10:56:13 2004 @@ -243,10 +243,8 @@ }; private: - void cloneReachableNodes(const DSNode* Node, - unsigned BitsToClear, - NodeMapTy& OldNodeMap, - NodeMapTy& CompletedNodeMap); + void cloneReachableNodes(const DSNode* Node, unsigned BitsToClear, + NodeMapTy& OldNodeMap); public: void updateFromGlobalGraph(); @@ -254,7 +252,6 @@ void cloneReachableSubgraph(const DSGraph& G, const hash_set& RootNodes, NodeMapTy& OldNodeMap, - NodeMapTy& CompletedNodeMap, unsigned CloneFlags = 0); From lattner at cs.uiuc.edu Thu Jan 22 10:57:05 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Jan 22 10:57:05 2004 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp TopDownClosure.cpp Message-ID: <200401221656.KAA19742@zion.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructure.cpp updated: 1.134 -> 1.135 TopDownClosure.cpp updated: 1.60 -> 1.61 --- Log message: Eliminated the CompletedNodes argument to the cloneReachable* methods. This map was only used to implement a marginal GlobalsGraph optimization, and it actually slows the analysis down (due to the overhead of keeping it), so just eliminate it entirely. --- Diffs of the changes: (+21 -43) Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.134 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.135 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.134 Thu Jan 22 10:36:28 2004 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Thu Jan 22 10:56:04 2004 @@ -801,11 +801,12 @@ /// specified mapping. /// void DSNode::remapLinks(DSGraph::NodeMapTy &OldNodeMap) { - for (unsigned i = 0, e = Links.size(); i != e; ++i) { - DSNodeHandle &H = OldNodeMap[Links[i].getNode()]; - Links[i].setNode(H.getNode()); - Links[i].setOffset(Links[i].getOffset()+H.getOffset()); - } + for (unsigned i = 0, e = Links.size(); i != e; ++i) + if (DSNode *N = Links[i].getNode()) { + DSNodeHandle &H = OldNodeMap[N]; + Links[i].setNode(H.getNode()); + Links[i].setOffset(Links[i].getOffset()+H.getOffset()); + } } @@ -813,13 +814,8 @@ /// current graph. This is a recursive function. The map OldNodeMap is a /// map from the original nodes to their clones. /// -void DSGraph::cloneReachableNodes(const DSNode* Node, - unsigned BitsToClear, - NodeMapTy& OldNodeMap, - NodeMapTy& CompletedNodeMap) { - if (CompletedNodeMap.find(Node) != CompletedNodeMap.end()) - return; - +void DSGraph::cloneReachableNodes(const DSNode* Node, unsigned BitsToClear, + NodeMapTy& OldNodeMap) { DSNodeHandle& NH = OldNodeMap[Node]; if (NH.getNode() != NULL) return; @@ -832,14 +828,13 @@ for (unsigned i = 0, e = Node->getNumLinks(); i != e; ++i) { const DSNodeHandle &Link = Node->getLink(i << DS::PointerShift); if (const DSNode* nextNode = Link.getNode()) - cloneReachableNodes(nextNode, BitsToClear, OldNodeMap, CompletedNodeMap); + cloneReachableNodes(nextNode, BitsToClear, OldNodeMap); } } void DSGraph::cloneReachableSubgraph(const DSGraph& G, const hash_set& RootNodes, NodeMapTy& OldNodeMap, - NodeMapTy& CompletedNodeMap, unsigned CloneFlags) { if (RootNodes.empty()) return; @@ -858,16 +853,14 @@ // Clone all nodes reachable from each root node, using a recursive helper for (hash_set::const_iterator I = RootNodes.begin(), E = RootNodes.end(); I != E; ++I) - cloneReachableNodes(*I, BitsToClear, OldNodeMap, CompletedNodeMap); - - // Merge the map entries in OldNodeMap and CompletedNodeMap to remap links - NodeMapTy MergedMap(OldNodeMap); - MergedMap.insert(CompletedNodeMap.begin(), CompletedNodeMap.end()); + cloneReachableNodes(*I, BitsToClear, OldNodeMap); // Rewrite the links in the newly created nodes (the nodes in OldNodeMap) - // to point into the current graph. MergedMap gives the full mapping. - for (NodeMapTy::iterator I=OldNodeMap.begin(), E=OldNodeMap.end(); I!= E; ++I) - I->second.getNode()->remapLinks(MergedMap); + // to point into the current graph. + for (NodeMapTy::iterator I=OldNodeMap.begin(), E=OldNodeMap.end(); I!= E; ++I) { + assert(I->first && "Null node pointer?"); + I->second.getNode()->remapLinks(OldNodeMap); + } // Now merge cloned global nodes with their copies in the current graph // Just look through OldNodeMap to find such nodes! @@ -894,11 +887,6 @@ /// have been brought up-to-date in at _some_ caller or callee). /// void DSGraph::updateFromGlobalGraph() { - - // Use a map to keep track of the mapping between nodes in the globals graph - // and this graph for up-to-date global nodes, which do not need to be cloned. - NodeMapTy CompletedMap; - // Put the live, non-up-to-date global nodes into a set and the up-to-date // ones in the map above, mapping node in GlobalsGraph to the up-to-date node. hash_set GlobalNodeSet; @@ -910,22 +898,16 @@ if (const DSNode* GGNode = GlobalsGraph->ScalarMap[GV].getNode()) if (InlinedGlobals.count(GV) == 0) // GNode is not up-to-date GlobalNodeSet.insert(GGNode); - else { // GNode is up-to-date - CompletedMap[GGNode] = I->second; - assert(GGNode->getNumLinks() == GNode->getNumLinks() && - "Links dont match in a node that is supposed to be up-to-date?" - "\nremapLinks() will not work if the links don't match!"); - } } // Clone the subgraph reachable from the vector of nodes in GlobalNodes // and merge the cloned global nodes with the corresponding ones, if any. - NodeMapTy OldNodeMap; - cloneReachableSubgraph(*GlobalsGraph, GlobalNodeSet, OldNodeMap,CompletedMap); + { + NodeMapTy OldNodeMap; // Scope ensures these is deleted promptly + cloneReachableSubgraph(*GlobalsGraph, GlobalNodeSet, OldNodeMap); + } // Merging global nodes leaves behind unused nodes: get rid of them now. - OldNodeMap.clear(); // remove references before dead node cleanup - CompletedMap.clear(); // remove references before dead node cleanup removeTriviallyDeadNodes(); } @@ -1662,14 +1644,11 @@ GlobalNodeSet.insert(AuxFunctionCalls[i].getCalleeNode()); } - // There are no "pre-completed" nodes so use any empty map for those. // Strip all alloca bits since the current function is only for the BU pass. // Strip all incomplete bits since they are short-lived properties and they // will be correctly computed when rematerializing nodes into the functions. // - NodeMapTy CompletedMap; - GlobalsGraph->cloneReachableSubgraph(*this, GlobalNodeSet, - GlobalNodeMap, CompletedMap, + GlobalsGraph->cloneReachableSubgraph(*this, GlobalNodeSet, GlobalNodeMap, (DSGraph::StripAllocaBit | DSGraph::StripIncompleteBit)); } Index: llvm/lib/Analysis/DataStructure/TopDownClosure.cpp diff -u llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.60 llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.61 --- llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.60 Wed Nov 12 17:11:14 2003 +++ llvm/lib/Analysis/DataStructure/TopDownClosure.cpp Thu Jan 22 10:56:04 2004 @@ -288,9 +288,8 @@ << &FunctionCalls[i] << "\n"); DSGraph::NodeMapTy NodeMapInCallee; // map from nodes to clones in callee - DSGraph::NodeMapTy CompletedMap; // unused map for nodes not to do CalleeGraph.cloneReachableSubgraph(Graph, RootNodeSet, - NodeMapInCallee, CompletedMap, + NodeMapInCallee, DSGraph::StripModRefBits | DSGraph::KeepAllocaBit); From alkis at cs.uiuc.edu Thu Jan 22 12:35:02 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Thu Jan 22 12:35:02 2004 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveIntervals.cpp Message-ID: <200401221834.MAA03759@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: LiveIntervals.cpp updated: 1.28 -> 1.29 --- Log message: Fix incorrect negatives in LiveIntervals::Interval::liveAt(). --- Diffs of the changes: (+1 -1) Index: llvm/lib/CodeGen/LiveIntervals.cpp diff -u llvm/lib/CodeGen/LiveIntervals.cpp:1.28 llvm/lib/CodeGen/LiveIntervals.cpp:1.29 --- llvm/lib/CodeGen/LiveIntervals.cpp:1.28 Fri Jan 16 10:23:23 2004 +++ llvm/lib/CodeGen/LiveIntervals.cpp Thu Jan 22 12:33:50 2004 @@ -371,7 +371,7 @@ bool LiveIntervals::Interval::liveAt(unsigned index) const { Ranges::const_iterator r = ranges.begin(); - while (r != ranges.end() && index < (r->second - 1)) { + while (r != ranges.end() && index < r->second) { if (index >= r->first) return true; ++r; From alkis at cs.uiuc.edu Thu Jan 22 13:19:03 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Thu Jan 22 13:19:03 2004 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveIntervals.cpp Message-ID: <200401221918.NAA14406@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: LiveIntervals.cpp updated: 1.29 -> 1.30 --- Log message: Revert previous change. The code was correct... --- Diffs of the changes: (+1 -1) Index: llvm/lib/CodeGen/LiveIntervals.cpp diff -u llvm/lib/CodeGen/LiveIntervals.cpp:1.29 llvm/lib/CodeGen/LiveIntervals.cpp:1.30 --- llvm/lib/CodeGen/LiveIntervals.cpp:1.29 Thu Jan 22 12:33:50 2004 +++ llvm/lib/CodeGen/LiveIntervals.cpp Thu Jan 22 13:17:52 2004 @@ -371,7 +371,7 @@ bool LiveIntervals::Interval::liveAt(unsigned index) const { Ranges::const_iterator r = ranges.begin(); - while (r != ranges.end() && index < r->second) { + while (r != ranges.end() && index < (r->second - 1)) { if (index >= r->first) return true; ++r; From alkis at cs.uiuc.edu Thu Jan 22 13:25:01 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Thu Jan 22 13:25:01 2004 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/RegAllocLinearScan.cpp Message-ID: <200401221924.NAA16191@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: RegAllocLinearScan.cpp updated: 1.31 -> 1.32 --- Log message: Improve debugging output. Remove unneeded virtReg->0 mapping when virtReg lives on the stack. Now a virtual register has an entry in the virtual->physical map or the virtual->stack slot map but never in both. --- Diffs of the changes: (+31 -20) Index: llvm/lib/CodeGen/RegAllocLinearScan.cpp diff -u llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.31 llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.32 --- llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.31 Fri Jan 16 14:33:13 2004 +++ llvm/lib/CodeGen/RegAllocLinearScan.cpp Thu Jan 22 13:24:43 2004 @@ -152,13 +152,18 @@ memcpy(regUse_, regUseBackup_, sizeof(regUseBackup_)); } - void printVirt2PhysMap() const { - std::cerr << "allocated registers:\n"; + void printVirtRegAssignment() const { + std::cerr << "register assignment:\n"; for (Virt2PhysMap::const_iterator i = v2pMap_.begin(), e = v2pMap_.end(); i != e; ++i) { + assert(i->second != 0); std::cerr << '[' << i->first << ',' << mri_->getName(i->second) << "]\n"; } + for (Virt2StackSlotMap::const_iterator + i = v2ssMap_.begin(), e = v2ssMap_.end(); i != e; ++i) { + std::cerr << '[' << i->first << ",ss#" << i->second << "]\n"; + } std::cerr << '\n'; } @@ -320,7 +325,7 @@ inactive_.clear(); DEBUG(std::cerr << "finished register allocation\n"); - DEBUG(printVirt2PhysMap()); + DEBUG(printVirtRegAssignment()); DEBUG(std::cerr << "Rewrite machine code:\n"); for (currentMbb_ = mf_->begin(); currentMbb_ != mf_->end(); ++currentMbb_) { @@ -341,11 +346,11 @@ MachineOperand& op = (*currentInstr_)->getOperand(i); if (op.isVirtualRegister()) { unsigned virtReg = op.getAllocatedRegNum(); - unsigned physReg = v2pMap_[virtReg]; - if (physReg) { - DEBUG(std::cerr << "\t\t\t%reg" << virtReg - << " -> " << mri_->getName(physReg) << '\n'); - (*currentInstr_)->SetMachineOperandReg(i, physReg); + Virt2PhysMap::const_iterator it = v2pMap_.find(virtReg); + if (it != v2pMap_.end()) { + DEBUG(std::cerr << "\t\t\t%reg" << it->second + << " -> " << mri_->getName(it->second) << '\n'); + (*currentInstr_)->SetMachineOperandReg(i, it->second); } } } @@ -357,8 +362,12 @@ MachineOperand& op = (*currentInstr_)->getOperand(i); if (op.isVirtualRegister() && op.isUse() && !op.isDef()) { unsigned virtReg = op.getAllocatedRegNum(); - unsigned physReg = v2pMap_[virtReg]; - if (!physReg) { + unsigned physReg = 0; + Virt2PhysMap::const_iterator it = v2pMap_.find(virtReg); + if (it != v2pMap_.end()) { + physReg = it->second; + } + else { physReg = getFreeTempPhysReg(virtReg); loadVirt2PhysReg(virtReg, physReg); tempUseOperands_.push_back(virtReg); @@ -380,8 +389,12 @@ MachineOperand& op = (*currentInstr_)->getOperand(i); if (op.isVirtualRegister() && op.isDef()) { unsigned virtReg = op.getAllocatedRegNum(); - unsigned physReg = v2pMap_[virtReg]; - if (!physReg) { + unsigned physReg = 0; + Virt2PhysMap::const_iterator it = v2pMap_.find(virtReg); + if (it != v2pMap_.end()) { + physReg = it->second; + } + else { physReg = getFreeTempPhysReg(virtReg); } if (op.isUse()) { // def and use @@ -563,6 +576,8 @@ minReg = reg; } } + DEBUG(std::cerr << "\t\t\tregister with min weight: " + << mri_->getName(minReg) << " (" << minWeight << ")\n"); if (cur->weight < minWeight) { restoreRegUse(); @@ -570,7 +585,6 @@ assignVirt2StackSlot(cur->reg); } else { - DEBUG(std::cerr << "\t\t\t\tfreeing: " << mri_->getName(minReg) << '\n'); std::set toSpill; toSpill.insert(minReg); for (const unsigned* as = mri_->getAliasSet(minReg); *as; ++as) @@ -674,7 +688,9 @@ void RA::assignVirt2PhysReg(unsigned virtReg, unsigned physReg) { - v2pMap_[virtReg] = physReg; + bool inserted = v2pMap_.insert(std::make_pair(virtReg, physReg)).second; + assert(inserted && "attempting to assign a virt->phys mapping to an " + "already mapped register"); markPhysRegNotFree(physReg); } @@ -685,8 +701,7 @@ "attempting to clear a not allocated virtual register"); unsigned physReg = it->second; markPhysRegFree(physReg); - v2pMap_[virtReg] = 0; // this marks that this virtual register - // lives on the stack + v2pMap_.erase(it); DEBUG(std::cerr << "\t\t\tcleared register " << mri_->getName(physReg) << "\n"); } @@ -703,10 +718,6 @@ // and free the virtual register if (v2pMap_.find(virtReg) != v2pMap_.end()) { clearVirtReg(virtReg); - } - else { - v2pMap_[virtReg] = 0; // this marks that this virtual register - // lives on the stack } } From alkis at cs.uiuc.edu Thu Jan 22 14:08:04 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Thu Jan 22 14:08:04 2004 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/RegAllocLinearScan.cpp Message-ID: <200401222007.OAA07285@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: RegAllocLinearScan.cpp updated: 1.32 -> 1.33 --- Log message: Remove unneeded check. An interval in active, by definition overlaps with the current one. --- Diffs of the changes: (+1 -4) Index: llvm/lib/CodeGen/RegAllocLinearScan.cpp diff -u llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.32 llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.33 --- llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.32 Thu Jan 22 13:24:43 2004 +++ llvm/lib/CodeGen/RegAllocLinearScan.cpp Thu Jan 22 14:07:18 2004 @@ -522,12 +522,9 @@ for (unsigned i = 0; i < MRegisterInfo::FirstVirtualRegister; ++i) regWeight[i] = 0.0F; - // for each interval in active that overlaps + // for each interval in active for (IntervalPtrs::const_iterator i = active_.begin(), e = active_.end(); i != e; ++i) { - if (!cur->overlaps(**i)) - continue; - unsigned reg = (*i)->reg; if (reg >= MRegisterInfo::FirstVirtualRegister) { reg = v2pMap_[reg]; From gaeke at cs.uiuc.edu Thu Jan 22 15:56:01 2004 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Thu Jan 22 15:56:01 2004 Subject: [llvm-commits] CVS: llvm/autoconf/configure.ac Message-ID: <200401222155.PAA05797@zion.cs.uiuc.edu> Changes in directory llvm/autoconf: configure.ac updated: 1.67 -> 1.68 --- Log message: Add autoconf check for the version of etags we have detected, and select appropriate "force C++" command-line option. --- Diffs of the changes: (+8 -0) Index: llvm/autoconf/configure.ac diff -u llvm/autoconf/configure.ac:1.67 llvm/autoconf/configure.ac:1.68 --- llvm/autoconf/configure.ac:1.67 Wed Jan 21 13:38:56 2004 +++ llvm/autoconf/configure.ac Thu Jan 22 15:55:15 2004 @@ -169,6 +169,14 @@ dnl Checks for tools we can get away with not having: AC_PATH_PROG(DOT,[dot],[true dot]) AC_PATH_PROG(ETAGS,[etags],[true etags]) +dnl Check if we know how to tell etags we are using C++: +etags_version=`$ETAGS --version 2>&1` +case "$etags_version" in + *[Ee]xuberant*) ETAGSFLAGS="--language-force=c++" ;; + *GNU\ Emacs*) ETAGSFLAGS="-l c++" ;; + *) ETAGSFLAGS="" ;; +esac +AC_SUBST(ETAGSFLAGS,$ETAGSFLAGS) AC_PATH_PROG(PYTHON,[python],[true python]) if test "$PYTHON" = "false" then From gaeke at cs.uiuc.edu Thu Jan 22 15:56:05 2004 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Thu Jan 22 15:56:05 2004 Subject: [llvm-commits] CVS: llvm/configure Message-ID: <200401222155.PAA05788@zion.cs.uiuc.edu> Changes in directory llvm: configure updated: 1.70 -> 1.71 --- Log message: Regenerated using autoconf-2.57. --- Diffs of the changes: (+10 -1) Index: llvm/configure diff -u llvm/configure:1.70 llvm/configure:1.71 --- llvm/configure:1.70 Wed Jan 21 13:39:29 2004 +++ llvm/configure Thu Jan 22 15:55:02 2004 @@ -465,7 +465,7 @@ #endif" ac_unique_file=""Makefile.config.in"" -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 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 PYTHON QMTEST ALLOCA MMAP_FILE ENABLE_OPTIMIZED SPEC_ROOT USE_SPEC UPB DISABLE_LLC_DIFFS JIT LLVMCC1 LLVMCC1PLUS BCR PAPIDIR SHLIBEXT 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 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 ALLOCA MMAP_FILE ENABLE_OPTIMIZED SPEC_ROOT USE_SPEC UPB DISABLE_LLC_DIFFS JIT LLVMCC1 LLVMCC1PLUS BCR PAPIDIR SHLIBEXT LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -18156,6 +18156,14 @@ echo "${ECHO_T}no" >&6 fi +etags_version=`$ETAGS --version 2>&1` +case "$etags_version" in + *Eexuberant*) ETAGSFLAGS="--language-force=c++" ;; + *GNU\ Emacs*) ETAGSFLAGS="-l c++" ;; + *) ETAGSFLAGS="" ;; +esac +ETAGSFLAGS=$ETAGSFLAGS + # Extract the first word of "python", so it can be a program name with args. set dummy python; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 @@ -22410,6 +22418,7 @@ s, at LIBTOOL@,$LIBTOOL,;t t s, at DOT@,$DOT,;t t s, at ETAGS@,$ETAGS,;t t +s, at ETAGSFLAGS@,$ETAGSFLAGS,;t t s, at PYTHON@,$PYTHON,;t t s, at QMTEST@,$QMTEST,;t t s, at ALLOCA@,$ALLOCA,;t t From gaeke at cs.uiuc.edu Thu Jan 22 15:56:08 2004 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Thu Jan 22 15:56:08 2004 Subject: [llvm-commits] CVS: llvm/Makefile.config.in Message-ID: <200401222155.PAA05781@zion.cs.uiuc.edu> Changes in directory llvm: Makefile.config.in updated: 1.17 -> 1.18 --- Log message: Get autoconf'd ETAGSFLAGS value from configure. --- Diffs of the changes: (+1 -0) Index: llvm/Makefile.config.in diff -u llvm/Makefile.config.in:1.17 llvm/Makefile.config.in:1.18 --- llvm/Makefile.config.in:1.17 Wed Jan 21 13:39:07 2004 +++ llvm/Makefile.config.in Thu Jan 22 15:55:01 2004 @@ -48,6 +48,7 @@ INSTALL = @INSTALL@ DOT = @DOT@ ETAGS = @ETAGS@ +ETAGSFLAGS = @ETAGSFLAGS@ # Determine the target for which LLVM should generate code. LLVMGCCARCH := @target@/3.4-llvm From gaeke at cs.uiuc.edu Thu Jan 22 15:56:11 2004 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Thu Jan 22 15:56:11 2004 Subject: [llvm-commits] CVS: llvm/Makefile Makefile.rules Message-ID: <200401222155.PAA05767@zion.cs.uiuc.edu> Changes in directory llvm: Makefile updated: 1.16 -> 1.17 Makefile.rules updated: 1.174 -> 1.175 --- Log message: Move support for building tags database from Makefile.rules to Makefile, because it's only used in the top-level directory. --- Diffs of the changes: (+11 -19) Index: llvm/Makefile diff -u llvm/Makefile:1.16 llvm/Makefile:1.17 --- llvm/Makefile:1.16 Wed Jan 21 17:28:03 2004 +++ llvm/Makefile Thu Jan 22 15:54:51 2004 @@ -31,8 +31,7 @@ include/Config/config.h.in: autoconf/configure.ac autoconf/aclocal.m4 autoheader -I autoconf autoconf/configure.ac -# Install support for llvm include files. - +# Install support for llvm include files: .PHONY: install-includes install-includes: @@ -40,4 +39,14 @@ cd include && find * '!' '(' -name '*~' -o -name .cvsignore ')' -print | grep -v CVS | pax -rwdvpe $(DESTDIR)$(includedir)/llvm install:: install-includes + +# Build tags database for Emacs/Xemacs: +.PHONY: tags + +TAGS: tags + +all:: tags + +tags: + $(ETAGS) $(ETAGSFLAGS) `find $(wildcard $(SourceDir)/include $(SourceDir)/lib $(SourceDir)/tools) -name '*.cpp' -o -name '*.h'` Index: llvm/Makefile.rules diff -u llvm/Makefile.rules:1.174 llvm/Makefile.rules:1.175 --- llvm/Makefile.rules:1.174 Wed Jan 21 17:57:21 2004 +++ llvm/Makefile.rules Thu Jan 22 15:54:51 2004 @@ -608,23 +608,6 @@ endif #------------------------------------------------------------------------ -# Create a TAGS database for emacs -#------------------------------------------------------------------------ - -ifneq ($(ETAGS),false) -ifeq ($(LEVEL), .) -SRCDIRS := $(wildcard $(SourceDir)/include $(SourceDir)/lib $(SourceDir)/tools) - -tags: - $(ETAGS) -l c++ `find $(SRCDIRS) -name '*.cpp' -o -name '*.h'` -all:: tags -endif -else -tags: - ${ECHO} "Cannot build $@: The program etags is not installed" -endif - -#------------------------------------------------------------------------ # Handle the TOOLNAME option - used when building tool executables... #------------------------------------------------------------------------ # From gaeke at cs.uiuc.edu Thu Jan 22 16:54:01 2004 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Thu Jan 22 16:54:01 2004 Subject: [llvm-commits] CVS: llvm/Makefile.config.in Makefile.rules Message-ID: <200401222253.QAA10342@seraph.cs.uiuc.edu> Changes in directory llvm: Makefile.config.in updated: 1.18 -> 1.19 Makefile.rules updated: 1.175 -> 1.176 --- Log message: Move bytecode_libdir def'n to Makefile.config.in from Makefile.rules, so it lives near the other installation dirs (like libdir, bindir, etc.). Move the rule for making bytecode_libdir out of the ifdef LIBRARYNAME...endif. --- Diffs of the changes: (+6 -4) Index: llvm/Makefile.config.in diff -u llvm/Makefile.config.in:1.18 llvm/Makefile.config.in:1.19 --- llvm/Makefile.config.in:1.18 Thu Jan 22 15:55:01 2004 +++ llvm/Makefile.config.in Thu Jan 22 16:53:48 2004 @@ -187,6 +187,7 @@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ +bytecode_libdir = $(LLVMGCCDIR)/bytecode-libs includedir = @includedir@ infodir = @infodir@ mandir = @mandir@ Index: llvm/Makefile.rules diff -u llvm/Makefile.rules:1.175 llvm/Makefile.rules:1.176 --- llvm/Makefile.rules:1.175 Thu Jan 22 15:54:51 2004 +++ llvm/Makefile.rules Thu Jan 22 16:53:48 2004 @@ -454,6 +454,11 @@ # of it. For this reason, sometimes it's useful to use libraries as .a files. ########################################################################### +# Install rule for making bytecode library directory if it does not exist. +# Trigger this by making libraries that need to be installed here depend on it. +$(DESTDIR)$(bytecode_libdir): + $(MKDIR) $@ + ifdef LIBRARYNAME # Make sure there isn't any extranous whitespace on the LIBRARYNAME option @@ -482,11 +487,7 @@ # dynamic target builds a shared object version of the library... dynamic:: $(LIBNAME_CUR) bytecodelib:: $(LIBNAME_BC) -bytecode_libdir = $(LLVMGCCDIR)/bytecode-libs install-bytecode-library:: $(DESTDIR)$(bytecode_libdir)/lib$(LIBRARYNAME).bc - -$(DESTDIR)$(bytecode_libdir): - $(MKDIR) $@ $(DESTDIR)$(bytecode_libdir)/lib$(LIBRARYNAME).bc: $(LIBNAME_BC) $(DESTDIR)$(bytecode_libdir) @${ECHO} ======= Installing $(LIBRARYNAME) bytecode library ======= From gaeke at cs.uiuc.edu Thu Jan 22 16:55:04 2004 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Thu Jan 22 16:55:04 2004 Subject: [llvm-commits] CVS: reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp Message-ID: <200401222254.QAA10353@seraph.cs.uiuc.edu> Changes in directory reopt/lib/LightWtProfiling: UnpackTraceFunction.cpp updated: 1.31 -> 1.32 --- Log message: Tweak DEBUG output. --- Diffs of the changes: (+7 -1) Index: reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp diff -u reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.31 reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.32 --- reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.31 Fri Jan 16 13:17:16 2004 +++ reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp Thu Jan 22 16:54:06 2004 @@ -143,8 +143,10 @@ static unsigned getSavedStateIndexOfInstruction (const Function *F, const Instruction *I) { unsigned Key = 0; + DEBUG(std::cerr << "getSavedStateIndexOfInstruction(F = " << F->getName() + << "(), I = " << *I << ")\n"); for (const_inst_iterator II=inst_begin (F), IE=inst_end (F); II!=IE; ++II) { - if (*II == I) return Key; + if (*II == I) { DEBUG(std::cerr << "--> returns " << Key << "\n"); return Key;} ++Key; } // By this time we had better have found it, otherwise we are about to do bad @@ -158,6 +160,10 @@ static unsigned getSavedStateIndexOfOperandInInstruction (Function *F, Value *V, unsigned VI) { // FIXME; not yet implemented + DEBUG(std::cerr << "getSavedStateIndexOfOperandInInstruction(F = " + << F->getName() << "(), V = " << *V <<", VI = " << VI << ")\n"); + std::cerr + << "** getSavedStateIndexOfOperandInInstruction() NOT YET IMPLEMENTED **\n"; abort (); } From alkis at cs.uiuc.edu Thu Jan 22 17:09:04 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Thu Jan 22 17:09:04 2004 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/LiveIntervals.h Message-ID: <200401222308.RAA24577@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: LiveIntervals.h updated: 1.11 -> 1.12 --- Log message: Add option to join live intervals. Two intervals are joined if there is a move between two registers, at least one of the registers is virtual and the two live intervals do not overlap. This results in about 40% reduction in intervals, 30% decrease in the register allocators running time and a 20% increase in peephole optimizations (mainly move eliminations). The option can be enabled by passing -join-liveintervals where appropriate. --- Diffs of the changes: (+20 -4) Index: llvm/include/llvm/CodeGen/LiveIntervals.h diff -u llvm/include/llvm/CodeGen/LiveIntervals.h:1.11 llvm/include/llvm/CodeGen/LiveIntervals.h:1.12 --- llvm/include/llvm/CodeGen/LiveIntervals.h:1.11 Fri Jan 16 14:17:05 2004 +++ llvm/include/llvm/CodeGen/LiveIntervals.h Thu Jan 22 17:08:45 2004 @@ -26,6 +26,7 @@ #include #include #include +#include namespace llvm { @@ -39,10 +40,9 @@ typedef std::pair Range; typedef std::vector Ranges; unsigned reg; // the register of this interval - unsigned hint; float weight; // weight of this interval (number of uses // * 10^loopDepth) - Ranges ranges; // the ranges this register is valid + Ranges ranges; // the ranges in which this register is live Interval(unsigned r); @@ -66,10 +66,12 @@ void addRange(unsigned start, unsigned end); + void join(const Interval& other); + private: - void mergeRangesForward(Ranges::iterator it); + Ranges::iterator mergeRangesForward(Ranges::iterator it); - void mergeRangesBackward(Ranges::iterator it); + Ranges::iterator mergeRangesBackward(Ranges::iterator it); }; struct StartPointComp { @@ -85,6 +87,7 @@ }; typedef std::list Intervals; + typedef std::map Reg2RegMap; typedef std::vector MachineBasicBlockPtrs; private: @@ -104,11 +107,15 @@ typedef std::map Reg2IntervalMap; Reg2IntervalMap r2iMap_; + Reg2RegMap r2rMap_; + Intervals intervals_; public: virtual void getAnalysisUsage(AnalysisUsage &AU) const; + Intervals& getIntervals() { return intervals_; } + MachineBasicBlockPtrs getOrderedMachineBasicBlockPtrs() const { MachineBasicBlockPtrs result; for (MbbIndex2MbbMap::const_iterator @@ -119,6 +126,13 @@ return result; } + const Reg2RegMap& getJoinedRegMap() const { + return r2rMap_; + } + + /// rep - returns the representative of this register + unsigned rep(unsigned reg); + private: /// runOnMachineFunction - pass entry point bool runOnMachineFunction(MachineFunction&); @@ -126,6 +140,8 @@ /// computeIntervals - compute live intervals void computeIntervals(); + /// joinIntervals - join compatible live intervals + void joinIntervals(); /// handleRegisterDef - update intervals for a register def /// (calls handlePhysicalRegisterDef and From alkis at cs.uiuc.edu Thu Jan 22 17:10:04 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Thu Jan 22 17:10:04 2004 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/RegAllocLinearScan.cpp LiveIntervals.cpp Message-ID: <200401222308.RAA24578@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: RegAllocLinearScan.cpp updated: 1.33 -> 1.34 LiveIntervals.cpp updated: 1.30 -> 1.31 --- Log message: Add option to join live intervals. Two intervals are joined if there is a move between two registers, at least one of the registers is virtual and the two live intervals do not overlap. This results in about 40% reduction in intervals, 30% decrease in the register allocators running time and a 20% increase in peephole optimizations (mainly move eliminations). The option can be enabled by passing -join-liveintervals where appropriate. --- Diffs of the changes: (+232 -44) Index: llvm/lib/CodeGen/RegAllocLinearScan.cpp diff -u llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.33 llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.34 --- llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.33 Thu Jan 22 14:07:18 2004 +++ llvm/lib/CodeGen/RegAllocLinearScan.cpp Thu Jan 22 17:08:44 2004 @@ -32,12 +32,15 @@ namespace { Statistic<> numSpilled ("ra-linearscan", "Number of registers spilled"); Statistic<> numReloaded("ra-linearscan", "Number of registers reloaded"); + Statistic<> numPeep ("ra-linearscan", + "Number of identity moves eliminated"); class RA : public MachineFunctionPass { private: MachineFunction* mf_; const TargetMachine* tm_; const MRegisterInfo* mri_; + LiveIntervals* li_; MachineFunction::iterator currentMbb_; MachineBasicBlock::iterator currentInstr_; typedef std::vector IntervalPtrs; @@ -203,8 +206,8 @@ mf_ = &fn; tm_ = &fn.getTarget(); mri_ = tm_->getRegisterInfo(); - - initIntervalSets(getAnalysis().getIntervals()); + li_ = &getAnalysis(); + initIntervalSets(li_->getIntervals()); v2pMap_.clear(); v2ssMap_.clear(); @@ -231,6 +234,7 @@ reserved_[29] = true; /* FP6 */ // linear scan algorithm + DEBUG(std::cerr << "Machine Function\n"); DEBUG(printIntervals("\tunhandled", unhandled_.begin(), unhandled_.end())); DEBUG(printIntervals("\tfixed", fixed_.begin(), fixed_.end())); @@ -324,15 +328,54 @@ active_.clear(); inactive_.clear(); - DEBUG(std::cerr << "finished register allocation\n"); + typedef LiveIntervals::Reg2RegMap Reg2RegMap; + const Reg2RegMap& r2rMap = li_->getJoinedRegMap(); + + DEBUG(printVirtRegAssignment()); + DEBUG(std::cerr << "Performing coalescing on joined intervals\n"); + // perform coalescing if we were passed joined intervals + for(Reg2RegMap::const_iterator i = r2rMap.begin(), e = r2rMap.end(); + i != e; ++i) { + unsigned reg = i->first; + unsigned rep = li_->rep(reg); + + assert((rep < MRegisterInfo::FirstVirtualRegister || + v2pMap_.find(rep) != v2pMap_.end() || + v2ssMap_.find(rep) != v2ssMap_.end()) && + "representative register is not allocated!"); + + assert(reg >= MRegisterInfo::FirstVirtualRegister && + v2pMap_.find(reg) == v2pMap_.end() && + v2ssMap_.find(reg) == v2ssMap_.end() && + "coalesced register is already allocated!"); + + if (rep < MRegisterInfo::FirstVirtualRegister) { + v2pMap_.insert(std::make_pair(reg, rep)); + } + else { + Virt2PhysMap::const_iterator pr = v2pMap_.find(rep); + if (pr != v2pMap_.end()) { + v2pMap_.insert(std::make_pair(reg, pr->second)); + } + else { + Virt2StackSlotMap::const_iterator ss = v2ssMap_.find(rep); + assert(ss != v2ssMap_.end()); + v2ssMap_.insert(std::make_pair(reg, ss->second)); + } + } + } + DEBUG(printVirtRegAssignment()); + DEBUG(std::cerr << "finished register allocation\n"); + + const TargetInstrInfo& tii = tm_->getInstrInfo(); DEBUG(std::cerr << "Rewrite machine code:\n"); for (currentMbb_ = mf_->begin(); currentMbb_ != mf_->end(); ++currentMbb_) { instrAdded_ = 0; for (currentInstr_ = currentMbb_->begin(); - currentInstr_ != currentMbb_->end(); ++currentInstr_) { + currentInstr_ != currentMbb_->end(); ) { DEBUG(std::cerr << "\tinstruction: "; (*currentInstr_)->print(std::cerr, *tm_);); @@ -355,6 +398,21 @@ } } + unsigned srcReg, dstReg; + if (tii.isMoveInstr(**currentInstr_, srcReg, dstReg) && + ((srcReg < MRegisterInfo::FirstVirtualRegister && + dstReg < MRegisterInfo::FirstVirtualRegister && + srcReg == dstReg) || + (srcReg >= MRegisterInfo::FirstVirtualRegister && + dstReg >= MRegisterInfo::FirstVirtualRegister && + v2ssMap_[srcReg] == v2ssMap_[dstReg]))) { + delete *currentInstr_; + currentInstr_ = currentMbb_->erase(currentInstr_); + ++numPeep; + DEBUG(std::cerr << "\t\tdeleting instruction\n"); + continue; + } + DEBUG(std::cerr << "\t\tloading temporarily used operands to " "registers:\n"); for (unsigned i = 0, e = (*currentInstr_)->getNumOperands(); @@ -416,6 +474,7 @@ } --currentInstr_; // restore currentInstr_ iterator tempDefOperands_.clear(); + ++currentInstr_; } } Index: llvm/lib/CodeGen/LiveIntervals.cpp diff -u llvm/lib/CodeGen/LiveIntervals.cpp:1.30 llvm/lib/CodeGen/LiveIntervals.cpp:1.31 --- llvm/lib/CodeGen/LiveIntervals.cpp:1.30 Thu Jan 22 13:17:52 2004 +++ llvm/lib/CodeGen/LiveIntervals.cpp Thu Jan 22 17:08:44 2004 @@ -30,6 +30,7 @@ #include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetRegInfo.h" #include "llvm/Support/CFG.h" +#include "Support/CommandLine.h" #include "Support/Debug.h" #include "Support/DepthFirstIterator.h" #include "Support/Statistic.h" @@ -44,6 +45,11 @@ "Live Interval Analysis"); Statistic<> numIntervals("liveintervals", "Number of intervals"); + + cl::opt + join("join-liveintervals", + cl::desc("Join compatible live intervals"), + cl::init(false)); }; void LiveIntervals::getAnalysisUsage(AnalysisUsage &AU) const @@ -69,6 +75,7 @@ mi2iMap_.clear(); r2iMap_.clear(); r2iMap_.clear(); + r2rMap_.clear(); intervals_.clear(); // number MachineInstrs @@ -95,18 +102,17 @@ const LoopInfo& loopInfo = getAnalysis(); const TargetInstrInfo& tii = tm_->getInstrInfo(); - for (MbbIndex2MbbMap::iterator - it = mbbi2mbbMap_.begin(), itEnd = mbbi2mbbMap_.end(); - it != itEnd; ++it) { - MachineBasicBlock* mbb = it->second; - + for (MachineFunction::const_iterator mbbi = mf_->begin(), + mbbe = mf_->end(); mbbi != mbbe; ++mbbi) { + const MachineBasicBlock* mbb = mbbi; unsigned loopDepth = loopInfo.getLoopDepth(mbb->getBasicBlock()); - for (MachineBasicBlock::iterator mi = mbb->begin(), miEnd = mbb->end(); - mi != miEnd; ++mi) { - MachineInstr* instr = *mi; - for (int i = instr->getNumOperands() - 1; i >= 0; --i) { - MachineOperand& mop = instr->getOperand(i); + for (MachineBasicBlock::const_iterator mii = mbb->begin(), + mie = mbb->end(); mii != mie; ++mii) { + MachineInstr* mi = *mii; + + for (int i = mi->getNumOperands() - 1; i >= 0; --i) { + MachineOperand& mop = mi->getOperand(i); if (!mop.isVirtualRegister()) continue; @@ -119,6 +125,9 @@ } } + // join intervals if requested + if (join) joinIntervals(); + numIntervals += intervals_.size(); return true; @@ -326,46 +335,109 @@ std::ostream_iterator(std::cerr, "\n"))); } -LiveIntervals::Interval::Interval(unsigned r) - : reg(r), hint(0), - weight((r < MRegisterInfo::FirstVirtualRegister ? - std::numeric_limits::max() : 0.0F)) +unsigned LiveIntervals::rep(unsigned reg) { - + Reg2RegMap::iterator it = r2rMap_.find(reg); + if (it != r2rMap_.end()) + return it->second = rep(it->second); + return reg; } -void LiveIntervals::Interval::addRange(unsigned start, unsigned end) +void LiveIntervals::joinIntervals() { - DEBUG(std::cerr << "\t\t\tadding range: [" << start <<','<< end << ") -> "); - //assert(start < end && "invalid range?"); - Range range = std::make_pair(start, end); - Ranges::iterator it = - ranges.insert(std::upper_bound(ranges.begin(), ranges.end(), range), - range); + DEBUG(std::cerr << "joining compatible intervals:\n"); - mergeRangesForward(it); - mergeRangesBackward(it); - DEBUG(std::cerr << *this << '\n'); -} + const TargetInstrInfo& tii = tm_->getInstrInfo(); -void LiveIntervals::Interval::mergeRangesForward(Ranges::iterator it) -{ - for (Ranges::iterator next = it + 1; - next != ranges.end() && it->second >= next->first; ) { - it->second = std::max(it->second, next->second); - next = ranges.erase(next); + for (MachineFunction::const_iterator mbbi = mf_->begin(), + mbbe = mf_->end(); mbbi != mbbe; ++mbbi) { + const MachineBasicBlock* mbb = mbbi; + DEBUG(std::cerr << "machine basic block: " + << mbb->getBasicBlock()->getName() << "\n"); + + for (MachineBasicBlock::const_iterator mii = mbb->begin(), + mie = mbb->end(); mii != mie; ++mii) { + MachineInstr* mi = *mii; + const TargetInstrDescriptor& tid = + tm_->getInstrInfo().get(mi->getOpcode()); + DEBUG(std::cerr << "\t\tinstruction[" + << getInstructionIndex(mi) << "]: "; + mi->print(std::cerr, *tm_);); + + unsigned srcReg, dstReg; + if (tii.isMoveInstr(*mi, srcReg, dstReg) && + (srcReg >= MRegisterInfo::FirstVirtualRegister || + lv_->getAllocatablePhysicalRegisters()[srcReg]) && + (dstReg >= MRegisterInfo::FirstVirtualRegister || + lv_->getAllocatablePhysicalRegisters()[dstReg])) { + + // get representative registers + srcReg = rep(srcReg); + dstReg = rep(dstReg); + + // if they are already joined we continue + if (srcReg == dstReg) + continue; + + Reg2IntervalMap::iterator r2iSrc = r2iMap_.find(srcReg); + assert(r2iSrc != r2iMap_.end()); + Reg2IntervalMap::iterator r2iDst = r2iMap_.find(dstReg); + assert(r2iDst != r2iMap_.end()); + + Intervals::iterator srcInt = r2iSrc->second; + Intervals::iterator dstInt = r2iDst->second; + + if (srcInt->reg < MRegisterInfo::FirstVirtualRegister) { + if (dstInt->reg == srcInt->reg || + (dstInt->reg >= MRegisterInfo::FirstVirtualRegister && + !dstInt->overlaps(*srcInt))) { + srcInt->join(*dstInt); + r2iDst->second = r2iSrc->second; + r2rMap_.insert(std::make_pair(dstInt->reg, srcInt->reg)); + intervals_.erase(dstInt); + } + } + else if (dstInt->reg < MRegisterInfo::FirstVirtualRegister) { + if (srcInt->reg == dstInt->reg || + (srcInt->reg >= MRegisterInfo::FirstVirtualRegister && + !srcInt->overlaps(*dstInt))) { + dstInt->join(*srcInt); + r2iSrc->second = r2iDst->second; + r2rMap_.insert(std::make_pair(srcInt->reg, dstInt->reg)); + intervals_.erase(srcInt); + } + } + else { + const TargetRegisterClass *srcRc, *dstRc; + srcRc = mf_->getSSARegMap()->getRegClass(srcInt->reg); + dstRc = mf_->getSSARegMap()->getRegClass(dstInt->reg); + + if (srcRc == dstRc && !dstInt->overlaps(*srcInt)) { + srcInt->join(*dstInt); + r2iDst->second = r2iSrc->second; + r2rMap_.insert(std::make_pair(dstInt->reg, srcInt->reg)); + intervals_.erase(dstInt); + } + } + } + } } + + intervals_.sort(StartPointComp()); + DEBUG(std::copy(intervals_.begin(), intervals_.end(), + std::ostream_iterator(std::cerr, "\n"))); + DEBUG(for (Reg2RegMap::const_iterator i = r2rMap_.begin(), + e = r2rMap_.end(); i != e; ++i) + std::cerr << i->first << " -> " << i->second << '\n';); + } -void LiveIntervals::Interval::mergeRangesBackward(Ranges::iterator it) +LiveIntervals::Interval::Interval(unsigned r) + : reg(r), + weight((r < MRegisterInfo::FirstVirtualRegister ? + std::numeric_limits::max() : 0.0F)) { - for (Ranges::iterator prev = it - 1; - it != ranges.begin() && it->first <= prev->second; ) { - it->first = std::min(it->first, prev->first); - it->second = std::max(it->second, prev->second); - it = ranges.erase(prev); - prev = it - 1; - } + } bool LiveIntervals::Interval::liveAt(unsigned index) const @@ -407,6 +479,63 @@ } return false; +} + +void LiveIntervals::Interval::addRange(unsigned start, unsigned end) +{ + DEBUG(std::cerr << "\t\t\tadding range: [" << start <<','<< end << ") -> "); + //assert(start < end && "invalid range?"); + Range range = std::make_pair(start, end); + Ranges::iterator it = + ranges.insert(std::upper_bound(ranges.begin(), ranges.end(), range), + range); + + it = mergeRangesForward(it); + it = mergeRangesBackward(it); + DEBUG(std::cerr << "\t\t\t\tafter merging: " << *this << '\n'); +} + +void LiveIntervals::Interval::join(const LiveIntervals::Interval& other) +{ + DEBUG(std::cerr << "\t\t\t\tjoining intervals: " + << other << " and " << *this << '\n'); + Ranges::iterator cur = ranges.begin(); + + for (Ranges::const_iterator i = other.ranges.begin(), + e = other.ranges.end(); i != e; ++i) { + cur = ranges.insert(std::upper_bound(cur, ranges.end(), *i), *i); + cur = mergeRangesForward(cur); + cur = mergeRangesBackward(cur); + } + if (reg >= MRegisterInfo::FirstVirtualRegister) + weight += other.weight; + + DEBUG(std::cerr << "\t\t\t\tafter merging: " << *this << '\n'); +} + +LiveIntervals::Interval::Ranges::iterator +LiveIntervals::Interval::mergeRangesForward(Ranges::iterator it) +{ + for (Ranges::iterator next = it + 1; + next != ranges.end() && it->second >= next->first; ) { + it->second = std::max(it->second, next->second); + next = ranges.erase(next); + } + return it; +} + +LiveIntervals::Interval::Ranges::iterator +LiveIntervals::Interval::mergeRangesBackward(Ranges::iterator it) +{ + for (Ranges::iterator prev = it - 1; + it != ranges.begin() && it->first <= prev->second; ) { + it->first = std::min(it->first, prev->first); + it->second = std::max(it->second, prev->second); + it = ranges.erase(prev); + prev = it - 1; + } + + return it; } std::ostream& llvm::operator<<(std::ostream& os, From lattner at cs.uiuc.edu Thu Jan 22 18:55:01 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Jan 22 18:55:01 2004 Subject: [llvm-commits] CVS: llvm/test/Regression/Assembler/2004-01-22-FloatNormalization.ll Message-ID: <200401230054.SAA29027@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Assembler: 2004-01-22-FloatNormalization.ll added (r1.1) --- Log message: New testcase for problem brian ran into --- Diffs of the changes: (+3 -0) Index: llvm/test/Regression/Assembler/2004-01-22-FloatNormalization.ll diff -c /dev/null llvm/test/Regression/Assembler/2004-01-22-FloatNormalization.ll:1.1 *** /dev/null Thu Jan 22 18:54:36 2004 --- llvm/test/Regression/Assembler/2004-01-22-FloatNormalization.ll Thu Jan 22 18:54:26 2004 *************** *** 0 **** --- 1,3 ---- + ; make sure that 'float' values have their value properly truncated. + + global float 0x1 From lattner at cs.uiuc.edu Thu Jan 22 18:56:01 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Jan 22 18:56:01 2004 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Constants.cpp Message-ID: <200401230055.SAA29045@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Constants.cpp updated: 1.71 -> 1.72 --- Log message: Fix a problem brian ran into with the bytecode reader asserting. It turns out that the problem was actually the writer writing out a 'null' value because it didn't normalize it. This fixes: test/Regression/Assembler/2004-01-22-FloatNormalization.ll --- Diffs of the changes: (+5 -0) Index: llvm/lib/VMCore/Constants.cpp diff -u llvm/lib/VMCore/Constants.cpp:1.71 llvm/lib/VMCore/Constants.cpp:1.72 --- llvm/lib/VMCore/Constants.cpp:1.71 Wed Jan 14 11:51:53 2004 +++ llvm/lib/VMCore/Constants.cpp Thu Jan 22 18:55:21 2004 @@ -701,6 +701,11 @@ static ValueMap FPConstants; ConstantFP *ConstantFP::get(const Type *Ty, double V) { + if (Ty == Type::FloatTy) { + // Force the value through memory to normalize it. + volatile float Tmp = V; + V = Tmp; + } return FPConstants.getOrCreate(Ty, V); } From lattner at cs.uiuc.edu Thu Jan 22 19:43:00 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Jan 22 19:43:00 2004 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DSSupport.h Message-ID: <200401230142.TAA04539@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: DSSupport.h updated: 1.28 -> 1.29 --- Log message: Fix grammar --- Diffs of the changes: (+2 -2) Index: llvm/include/llvm/Analysis/DSSupport.h diff -u llvm/include/llvm/Analysis/DSSupport.h:1.28 llvm/include/llvm/Analysis/DSSupport.h:1.29 --- llvm/include/llvm/Analysis/DSSupport.h:1.28 Thu Jan 22 10:08:51 2004 +++ llvm/include/llvm/Analysis/DSSupport.h Thu Jan 22 19:42:16 2004 @@ -149,7 +149,7 @@ const hash_map &NodeMap) { if (DSNode *N = Src.getNode()) { hash_map::const_iterator I = NodeMap.find(N); - assert(I != NodeMap.end() && "Not not in mapping!"); + assert(I != NodeMap.end() && "Node not in mapping!"); NH.setOffset(Src.getOffset()); NH.setNode(I->second); @@ -160,7 +160,7 @@ const hash_map &NodeMap) { if (DSNode *N = Src.getNode()) { hash_map::const_iterator I = NodeMap.find(N); - assert(I != NodeMap.end() && "Not not in mapping!"); + assert(I != NodeMap.end() && "Node not in mapping!"); NH.setOffset(Src.getOffset()+I->second.getOffset()); NH.setNode(I->second.getNode()); From lattner at cs.uiuc.edu Thu Jan 22 19:43:04 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Jan 22 19:43:04 2004 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DSGraph.h Message-ID: <200401230142.TAA04530@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: DSGraph.h updated: 1.66 -> 1.67 --- Log message: Add new flag, other minor modifications --- Diffs of the changes: (+7 -5) Index: llvm/include/llvm/Analysis/DSGraph.h diff -u llvm/include/llvm/Analysis/DSGraph.h:1.66 llvm/include/llvm/Analysis/DSGraph.h:1.67 --- llvm/include/llvm/Analysis/DSGraph.h:1.66 Thu Jan 22 10:56:13 2004 +++ llvm/include/llvm/Analysis/DSGraph.h Thu Jan 22 19:42:32 2004 @@ -240,18 +240,19 @@ DontCloneAuxCallNodes = 1 << 2, CloneAuxCallNodes = 0, StripModRefBits = 1 << 3, KeepModRefBits = 0, StripIncompleteBit = 1 << 4, KeepIncompleteBit = 0, + UpdateInlinedGlobals = 1 << 5, DontUpdateInlinedGlobals = 0, }; private: void cloneReachableNodes(const DSNode* Node, unsigned BitsToClear, - NodeMapTy& OldNodeMap); + NodeMapTy& OldNodeMap, GlobalSetTy &Globals); public: void updateFromGlobalGraph(); - void cloneReachableSubgraph(const DSGraph& G, - const hash_set& RootNodes, - NodeMapTy& OldNodeMap, + void cloneReachableSubgraph(const DSGraph &G, + hash_set &RootNodes, + NodeMapTy &OldNodeMap, unsigned CloneFlags = 0); @@ -289,7 +290,8 @@ /// /// The CloneFlags member controls various aspects of the cloning process. /// - void clonePartiallyInto(const DSGraph &G, Function &F, const DSNodeHandle &RetVal, + void clonePartiallyInto(const DSGraph &G, Function &F, + const DSNodeHandle &RetVal, const ScalarMapTy &ValBindings, NodeMapTy &OldNodeMap, unsigned CloneFlags = 0); From lattner at cs.uiuc.edu Thu Jan 22 19:46:03 2004 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Jan 22 19:46:03 2004 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp CompleteBottomUp.cpp DataStructure.cpp Steensgaard.cpp Message-ID: <200401230145.TAA04562@zion.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: BottomUpClosure.cpp updated: 1.70 -> 1.71 CompleteBottomUp.cpp updated: 1.3 -> 1.4 DataStructure.cpp updated: 1.135 -> 1.136 Steensgaard.cpp updated: 1.35 -> 1.36 --- Log message: Initial support for implementing clonePartiallyInto in terms of cloneReachableSubgraph, though this support is currently disabled. --- Diffs of the changes: (+128 -60) Index: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp diff -u llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.70 llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.71 --- llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.70 Wed Nov 12 23:04:19 2003 +++ llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp Thu Jan 22 19:44:52 2004 @@ -187,7 +187,8 @@ if (&G != SCCGraph) { DSGraph::NodeMapTy NodeMap; SCCGraph->cloneInto(G, SCCGraph->getScalarMap(), - SCCGraph->getReturnNodes(), NodeMap, 0); + SCCGraph->getReturnNodes(), NodeMap, + DSGraph::UpdateInlinedGlobals); // Update the DSInfo map and delete the old graph... DSInfo[*I] = SCCGraph; delete &G; Index: llvm/lib/Analysis/DataStructure/CompleteBottomUp.cpp diff -u llvm/lib/Analysis/DataStructure/CompleteBottomUp.cpp:1.3 llvm/lib/Analysis/DataStructure/CompleteBottomUp.cpp:1.4 --- llvm/lib/Analysis/DataStructure/CompleteBottomUp.cpp:1.3 Thu Nov 13 12:48:11 2003 +++ llvm/lib/Analysis/DataStructure/CompleteBottomUp.cpp Thu Jan 22 19:44:53 2004 @@ -141,7 +141,8 @@ ValMap[NG] = ~0U; DSGraph::NodeMapTy NodeMap; - FG.cloneInto(*NG, FG.getScalarMap(), FG.getReturnNodes(), NodeMap, 0); + FG.cloneInto(*NG, FG.getScalarMap(), FG.getReturnNodes(), NodeMap, + DSGraph::UpdateInlinedGlobals); // Update the DSInfo map and delete the old graph... for (DSGraph::ReturnNodesTy::iterator I = NG->getReturnNodes().begin(); Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.135 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.136 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.135 Thu Jan 22 10:56:04 2004 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Thu Jan 22 19:44:53 2004 @@ -36,8 +36,6 @@ #define TIME_REGION(VARNAME, DESC) #endif - - using namespace DS; DSNode *DSNodeHandle::HandleForwarding() const { @@ -768,14 +766,12 @@ PrintAuxCalls = false; NodeMapTy NodeMap; cloneInto(G, ScalarMap, ReturnNodes, NodeMap); - InlinedGlobals.clear(); // clear set of "up-to-date" globals } DSGraph::DSGraph(const DSGraph &G, NodeMapTy &NodeMap) : GlobalsGraph(0), TD(G.TD) { PrintAuxCalls = false; cloneInto(G, ScalarMap, ReturnNodes, NodeMap); - InlinedGlobals.clear(); // clear set of "up-to-date" globals } DSGraph::~DSGraph() { @@ -803,41 +799,46 @@ void DSNode::remapLinks(DSGraph::NodeMapTy &OldNodeMap) { for (unsigned i = 0, e = Links.size(); i != e; ++i) if (DSNode *N = Links[i].getNode()) { - DSNodeHandle &H = OldNodeMap[N]; - Links[i].setNode(H.getNode()); - Links[i].setOffset(Links[i].getOffset()+H.getOffset()); + DSGraph::NodeMapTy::const_iterator ONMI = OldNodeMap.find(N); + if (ONMI != OldNodeMap.end()) { + Links[i].setNode(ONMI->second.getNode()); + Links[i].setOffset(Links[i].getOffset()+ONMI->second.getOffset()); + } } } -/// cloneReachableNodes - Clone all reachable nodes from *Node into the -/// current graph. This is a recursive function. The map OldNodeMap is a -/// map from the original nodes to their clones. +/// cloneReachableNodes - Clone all reachable nodes from *Node into the current +/// graph. This is a recursive function. The map OldNodeMap is a map from the +/// original nodes to their clones. This populates the Globals set with all of +/// the global values that are cloned in. /// -void DSGraph::cloneReachableNodes(const DSNode* Node, unsigned BitsToClear, - NodeMapTy& OldNodeMap) { - DSNodeHandle& NH = OldNodeMap[Node]; - if (NH.getNode() != NULL) - return; +void DSGraph::cloneReachableNodes(const DSNode *Node, unsigned BitsToClear, + NodeMapTy &OldNodeMap, GlobalSetTy &Globals) { + DSNodeHandle &NH = OldNodeMap[Node]; + if (NH.getNode()) return; // Already cloned this node? + + // FIXME: eliminate eventually! + Globals.insert(Node->getGlobals().begin(), Node->getGlobals().end()); // else Node has not yet been cloned: clone it and clear the specified bits - NH = new DSNode(*Node, this); // enters in OldNodeMap - NH.getNode()->maskNodeTypes(~BitsToClear); + DSNode *New = new DSNode(*Node, this); + New->maskNodeTypes(~BitsToClear); + NH = New; // enters in OldNodeMap // now recursively clone nodes pointed to by this node - for (unsigned i = 0, e = Node->getNumLinks(); i != e; ++i) { - const DSNodeHandle &Link = Node->getLink(i << DS::PointerShift); - if (const DSNode* nextNode = Link.getNode()) - cloneReachableNodes(nextNode, BitsToClear, OldNodeMap); - } + for (unsigned i = 0, e = Node->getNumLinks(); i != e; ++i) + if (const DSNode *N = Node->getLink(i << DS::PointerShift).getNode()) + cloneReachableNodes(N, BitsToClear, OldNodeMap, Globals); } -void DSGraph::cloneReachableSubgraph(const DSGraph& G, - const hash_set& RootNodes, - NodeMapTy& OldNodeMap, +void DSGraph::cloneReachableSubgraph(const DSGraph &G, + hash_set &RootNodes, + NodeMapTy &OldNodeMap, unsigned CloneFlags) { - if (RootNodes.empty()) - return; + RootNodes.erase(0); // Null is not a root node + if (RootNodes.empty()) return; + TIME_REGION(X, "cloneReachableSubgraph"); assert(OldNodeMap.empty() && "Returned OldNodeMap should be empty!"); assert(&G != this && "Cannot clone graph into itself!"); @@ -850,30 +851,31 @@ | ((CloneFlags & StripIncompleteBit)? DSNode::Incomplete : 0); BitsToClear |= DSNode::DEAD; // Clear dead flag... - // Clone all nodes reachable from each root node, using a recursive helper + GlobalSetTy Globals; + + // Clone all nodes reachable from each root node, using a recursive helper. for (hash_set::const_iterator I = RootNodes.begin(), E = RootNodes.end(); I != E; ++I) - cloneReachableNodes(*I, BitsToClear, OldNodeMap); + cloneReachableNodes(*I, BitsToClear, OldNodeMap, Globals); // Rewrite the links in the newly created nodes (the nodes in OldNodeMap) // to point into the current graph. - for (NodeMapTy::iterator I=OldNodeMap.begin(), E=OldNodeMap.end(); I!= E; ++I) { - assert(I->first && "Null node pointer?"); + for (NodeMapTy::iterator I=OldNodeMap.begin(), E=OldNodeMap.end(); I!= E; ++I) I->second.getNode()->remapLinks(OldNodeMap); - } - // Now merge cloned global nodes with their copies in the current graph - // Just look through OldNodeMap to find such nodes! - for (NodeMapTy::iterator I=OldNodeMap.begin(), E=OldNodeMap.end(); I!= E; ++I) - if (I->first->isGlobalNode()) { - DSNodeHandle &GClone = I->second; - assert(GClone.getNode() != NULL && "NULL node in OldNodeMap?"); - const std::vector &Globals = I->first->getGlobals(); - for (unsigned gi = 0, ge = Globals.size(); gi != ge; ++gi) { - DSNodeHandle &GH = ScalarMap[Globals[gi]]; - GH.mergeWith(GClone); - } - } + if (CloneFlags & DSGraph::UpdateInlinedGlobals) + InlinedGlobals.insert(Globals.begin(), Globals.end()); + + // Make sure to set up the scalar map entries for all of the globals. + // + // FIXME: when cloneReachableNodes is improved to not require 'remapLinks', + // this should not be needed! + for (GlobalSetTy::iterator I = Globals.begin(), E = Globals.end(); I!=E; ++I){ + const DSNodeHandle &GOrig = G.getNodeForValue(*I); + DSNodeHandle &GClone = OldNodeMap[GOrig.getNode()]; + GClone.setOffset(GClone.getOffset()+GOrig.getOffset()); + ScalarMap[*I].mergeWith(GClone); + } } @@ -961,7 +963,8 @@ // If this is a global, add the global to this fn or merge if already exists if (GlobalValue* GV = dyn_cast(I->first)) { ScalarMap[GV].mergeWith(H); - InlinedGlobals.insert(GV); + if (CloneFlags & DSGraph::UpdateInlinedGlobals) + InlinedGlobals.insert(GV); } } } @@ -1016,6 +1019,66 @@ assert(OldNodeMap.empty() && "Returned OldNodeMap should be empty!"); assert(&G != this && "Cannot clone graph into itself!"); +#if 0 // ENABLE THIS to get the cloneReachableSubGraph code path + hash_set RootNodes; + +#if 0 + // THIS IS A HACK that sanity checks the cloner. This is inefficient, and + // causes all nodes to be cloned. + + // Add the nodes that we need to clone to the RootNodes set. + for (unsigned i = 0, e = G.Nodes.size(); i != e; ++i) + RootNodes.insert(G.Nodes[i]); + +#else + // We need the return value nodes... + if (RetVal.getNode()) + RootNodes.insert(G.getReturnNodeFor(F).getNode()); + + // We need the nodes whose bindings are specified by the ValBindings map. + for (ScalarMapTy::const_iterator I = ValBindings.begin(), + E = ValBindings.end(); I != E; ++I) + RootNodes.insert(G.getNodeForValue(I->first).getNode()); + + // If requested, we need the nodes from the calls list... + if (!(CloneFlags & DontCloneCallNodes)) { + for (unsigned i = 0, e = G.FunctionCalls.size(); i != e; ++i) { + const DSCallSite &CS = G.FunctionCalls[i]; + RootNodes.insert(CS.getRetVal().getNode()); + if (CS.isIndirectCall()) + RootNodes.insert(CS.getCalleeNode()); + for (unsigned a = 0, e = CS.getNumPtrArgs(); a != e; ++a) + RootNodes.insert(CS.getPtrArg(a).getNode()); + } + } + + // If requested, we need the nodes from the aux calls list... + if (!(CloneFlags & DontCloneAuxCallNodes)) { + for (unsigned i = 0, e = G.AuxFunctionCalls.size(); i != e; ++i) { + const DSCallSite &CS = G.AuxFunctionCalls[i]; + RootNodes.insert(CS.getRetVal().getNode()); + if (CS.isIndirectCall()) + RootNodes.insert(CS.getCalleeNode()); + for (unsigned a = 0, e = CS.getNumPtrArgs(); a != e; ++a) + RootNodes.insert(CS.getPtrArg(a).getNode()); + } + } + + + /// FIXME: This is another hack, which adds all global nodes to the roots, + /// this is necessary for correctness for some reason??? + + // Add the nodes that we need to clone to the RootNodes set. + for (unsigned i = 0, e = G.Nodes.size(); i != e; ++i) + if (!G.Nodes[i]->getGlobals().empty()) + RootNodes.insert(G.Nodes[i]); + + +#endif + + // Finally, clone the subgraph reachable from these roots. + cloneReachableSubgraph(G, RootNodes, OldNodeMap, CloneFlags); +#else unsigned FN = Nodes.size(); // First new node... /// FIXME: This currently clones the whole graph over, instead of doing it @@ -1039,9 +1102,6 @@ ClonedGlobals.insert(New->getGlobals().begin(), New->getGlobals().end()); } -#ifndef NDEBUG - Timer::addPeakMemoryMeasurement(); -#endif // Rewrite the links in the new nodes to point into the current graph now. for (unsigned i = FN, e = Nodes.size(); i != e; ++i) @@ -1050,23 +1110,28 @@ // Ensure that all global nodes end up in the scalar map, as appropriate. for (GlobalSetTy::iterator CI = ClonedGlobals.begin(), E = ClonedGlobals.end(); CI != E; ++CI) { - const DSNodeHandle &NGH = G.ScalarMap.find(*CI)->second; + const DSNodeHandle &NGH = G.getNodeForValue(*CI); DSNodeHandle &MappedNode = OldNodeMap[NGH.getNode()]; DSNodeHandle H(MappedNode.getNode(),NGH.getOffset()+MappedNode.getOffset()); ScalarMap[*CI].mergeWith(H); - InlinedGlobals.insert(*CI); + + if (CloneFlags & DSGraph::UpdateInlinedGlobals) + InlinedGlobals.insert(*CI); } +#endif + +#ifndef NDEBUG + Timer::addPeakMemoryMeasurement(); +#endif // Merge the requested portion of the scalar map with the values specified. for (ScalarMapTy::const_iterator I = ValBindings.begin(), E = ValBindings.end(); I != E; ++I) { - ScalarMapTy::const_iterator SMI = G.ScalarMap.find(I->first); - assert(SMI != G.ScalarMap.end() && "Cannot map non-existant scalar!"); + const DSNodeHandle &SNH = G.getNodeForValue(I->first); - DSNodeHandle &MappedNode = OldNodeMap[SMI->second.getNode()]; - DSNodeHandle H(MappedNode.getNode(), - SMI->second.getOffset()+MappedNode.getOffset()); + DSNodeHandle &MappedNode = OldNodeMap[SNH.getNode()]; + DSNodeHandle H(MappedNode.getNode(),SNH.getOffset()+MappedNode.getOffset()); H.mergeWith(I->second); } @@ -1133,7 +1198,7 @@ NodeMapTy OldNodeMap; clonePartiallyInto(Graph, F, CS.getRetVal(), ValueBindings, OldNodeMap, - CloneFlags); + CloneFlags | DSGraph::UpdateInlinedGlobals); } else { DSNodeHandle RetVal = getReturnNodeFor(F); @@ -1735,7 +1800,7 @@ ReturnNodesTy OldRetNodes; cloneInto(*GlobalsGraph, OldValMap, OldRetNodes, GlobalNodeMap, DSGraph::KeepAllocaBit | DSGraph::DontCloneCallNodes | - DSGraph::DontCloneAuxCallNodes); + DSGraph::DontCloneAuxCallNodes | DSGraph::UpdateInlinedGlobals); // Now merge existing global nodes in the GlobalsGraph with their copies for (ScalarMapTy::iterator I = ScalarMap.begin(), E = ScalarMap.end(); Index: llvm/lib/Analysis/DataStructure/Steensgaard.cpp diff -u llvm/lib/Analysis/DataStructure/Steensgaard.cpp:1.35 llvm/lib/Analysis/DataStructure/Steensgaard.cpp:1.36 --- llvm/lib/Analysis/DataStructure/Steensgaard.cpp:1.35 Wed Nov 12 17:11:14 2003 +++ llvm/lib/Analysis/DataStructure/Steensgaard.cpp Thu Jan 22 19:44:53 2004 @@ -130,7 +130,8 @@ { // Scope to free NodeMap memory ASAP DSGraph::NodeMapTy NodeMap; const DSGraph &FDSG = LDS.getDSGraph(*I); - ResultGraph->cloneInto(FDSG, ValMap, RetValMap, NodeMap); + ResultGraph->cloneInto(FDSG, ValMap, RetValMap, NodeMap, + DSGraph::UpdateInlinedGlobals); } // Incorporate the inlined Function's ScalarMap into the global From gaeke at cs.uiuc.edu Fri Jan 23 00:36:02 2004 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Fri Jan 23 00:36:02 2004 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PowerPCCodeEmitter.cpp PowerPCJITInfo.h PowerPCTargetMachine.cpp PowerPCTargetMachine.h Message-ID: <200401230635.AAA06327@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PowerPCCodeEmitter.cpp added (r1.1) PowerPCJITInfo.h added (r1.1) PowerPCTargetMachine.cpp updated: 1.1 -> 1.2 PowerPCTargetMachine.h updated: 1.1 -> 1.2 --- Log message: Add CodeEmitter and JITInfo stubs. Dump the old PowerPCTargetMachine::addPassesToJITCompile() method, in favor of the TargetJITInfo interface. --- Diffs of the changes: (+95 -10) Index: llvm/lib/Target/PowerPC/PowerPCCodeEmitter.cpp diff -c /dev/null llvm/lib/Target/PowerPC/PowerPCCodeEmitter.cpp:1.1 *** /dev/null Fri Jan 23 00:35:53 2004 --- llvm/lib/Target/PowerPC/PowerPCCodeEmitter.cpp Fri Jan 23 00:35:43 2004 *************** *** 0 **** --- 1,43 ---- + //===-- PowerPCCodeEmitter.cpp - JIT Code Emitter for PowerPC -----*- C++ -*-=// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by the LLVM research group and is distributed under + // the University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // + //===----------------------------------------------------------------------===// + + #include "PowerPCTargetMachine.h" + + namespace llvm { + + /// addPassesToEmitMachineCode - Add passes to the specified pass manager to get + /// machine code emitted. This uses a MachineCodeEmitter object to handle + /// actually outputting the machine code and resolving things like the address + /// of functions. This method should returns true if machine code emission is + /// not supported. + /// + bool PowerPCTargetMachine::addPassesToEmitMachineCode(FunctionPassManager &PM, + MachineCodeEmitter &MCE) { + return true; + // It should go something like this: + // PM.add(new Emitter(MCE)); // Machine code emitter pass for PowerPC + // Delete machine code for this function after emitting it: + // PM.add(createMachineCodeDeleter()); + } + + void *PowerPCJITInfo::getJITStubForFunction(Function *F, + MachineCodeEmitter &MCE) { + assert (0 && "PowerPCJITInfo::getJITStubForFunction not implemented"); + return 0; + } + + void PowerPCJITInfo::replaceMachineCodeForFunction (void *Old, void *New) { + assert (0 && "PowerPCJITInfo::replaceMachineCodeForFunction not implemented"); + } + + } // end llvm namespace + Index: llvm/lib/Target/PowerPC/PowerPCJITInfo.h diff -c /dev/null llvm/lib/Target/PowerPC/PowerPCJITInfo.h:1.1 *** /dev/null Fri Jan 23 00:35:53 2004 --- llvm/lib/Target/PowerPC/PowerPCJITInfo.h Fri Jan 23 00:35:43 2004 *************** *** 0 **** --- 1,49 ---- + //===- PowerPCJITInfo.h - PowerPC impl. of the JIT interface ----*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by the LLVM research group and is distributed under + // the University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file contains the PowerPC implementation of the TargetJITInfo class. + // + //===----------------------------------------------------------------------===// + + #ifndef POWERPCJITINFO_H + #define POWERPCJITINFO_H + + #include "llvm/Target/TargetJITInfo.h" + + namespace llvm { + class TargetMachine; + class IntrinsicLowering; + + class PowerPCJITInfo : public TargetJITInfo { + TargetMachine &TM; + public: + PowerPCJITInfo(TargetMachine &tm) : TM(tm) {} + + /// addPassesToJITCompile - Add passes to the specified pass manager to + /// implement a fast dynamic compiler for this target. Return true if this + /// is not supported for this target. + /// + virtual void addPassesToJITCompile(FunctionPassManager &PM); + + /// replaceMachineCodeForFunction - Make it so that calling the function + /// whose machine code is at OLD turns into a call to NEW, perhaps by + /// overwriting OLD with a branch to NEW. This is used for self-modifying + /// code. + /// + virtual void replaceMachineCodeForFunction(void *Old, void *New); + + /// getJITStubForFunction - Create or return a stub for the specified + /// function. This stub acts just like the specified function, except that + /// it allows the "address" of the function to be taken without having to + /// generate code for it. + virtual void *getJITStubForFunction(Function *F, MachineCodeEmitter &MCE); + }; + } + + #endif Index: llvm/lib/Target/PowerPC/PowerPCTargetMachine.cpp diff -u llvm/lib/Target/PowerPC/PowerPCTargetMachine.cpp:1.1 llvm/lib/Target/PowerPC/PowerPCTargetMachine.cpp:1.2 --- llvm/lib/Target/PowerPC/PowerPCTargetMachine.cpp:1.1 Wed Jan 21 15:13:19 2004 +++ llvm/lib/Target/PowerPC/PowerPCTargetMachine.cpp Fri Jan 23 00:35:43 2004 @@ -43,11 +43,9 @@ } /// addPassesToJITCompile - Add passes to the specified pass manager to -/// implement a fast dynamic compiler for this target. Return true if this is -/// not supported for this target. +/// implement a fast dynamic compiler for this target. /// -bool PowerPCTargetMachine::addPassesToJITCompile(FunctionPassManager &PM) { - return true; +void PowerPCJITInfo::addPassesToJITCompile(FunctionPassManager &PM) { } } // end namespace llvm Index: llvm/lib/Target/PowerPC/PowerPCTargetMachine.h diff -u llvm/lib/Target/PowerPC/PowerPCTargetMachine.h:1.1 llvm/lib/Target/PowerPC/PowerPCTargetMachine.h:1.2 --- llvm/lib/Target/PowerPC/PowerPCTargetMachine.h:1.1 Wed Jan 21 15:13:19 2004 +++ llvm/lib/Target/PowerPC/PowerPCTargetMachine.h Fri Jan 23 00:35:43 2004 @@ -18,6 +18,7 @@ #include "llvm/Target/TargetFrameInfo.h" #include "llvm/PassManager.h" #include "PowerPCInstrInfo.h" +#include "PowerPCJITInfo.h" namespace llvm { @@ -38,12 +39,6 @@ virtual const TargetSchedInfo &getSchedInfo() const { abort(); } virtual const TargetRegInfo &getRegInfo() const { abort(); } virtual const TargetCacheInfo &getCacheInfo() const { abort(); } - - /// addPassesToJITCompile - Add passes to the specified pass manager to - /// implement a fast dynamic compiler for this target. Return true if this is - /// not supported for this target. - /// - virtual bool addPassesToJITCompile(FunctionPassManager &PM); /// addPassesToEmitMachineCode - Add passes to the specified pass manager to /// get machine code emitted. This uses a MachineCodeEmitter object to handle From gaeke at cs.uiuc.edu Fri Jan 23 00:40:02 2004 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Fri Jan 23 00:40:02 2004 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PowerPCTargetMachine.cpp PowerPCTargetMachine.h Message-ID: <200401230639.AAA06476@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PowerPCTargetMachine.cpp updated: 1.2 -> 1.3 PowerPCTargetMachine.h updated: 1.2 -> 1.3 --- Log message: Add the JITInfo object, accessor & initializer. --- Diffs of the changes: (+5 -1) Index: llvm/lib/Target/PowerPC/PowerPCTargetMachine.cpp diff -u llvm/lib/Target/PowerPC/PowerPCTargetMachine.cpp:1.2 llvm/lib/Target/PowerPC/PowerPCTargetMachine.cpp:1.3 --- llvm/lib/Target/PowerPC/PowerPCTargetMachine.cpp:1.2 Fri Jan 23 00:35:43 2004 +++ llvm/lib/Target/PowerPC/PowerPCTargetMachine.cpp Fri Jan 23 00:39:30 2004 @@ -32,7 +32,7 @@ PowerPCTargetMachine::PowerPCTargetMachine(const Module &M, IntrinsicLowering *IL) : TargetMachine("PowerPC", IL, true, 4, 4, 4, 4, 4), - FrameInfo(TargetFrameInfo::StackGrowsDown, 8, 4) { + FrameInfo(TargetFrameInfo::StackGrowsDown, 8, 4), JITInfo(*this) { } // addPassesToEmitAssembly - We currently use all of the same passes as the JIT Index: llvm/lib/Target/PowerPC/PowerPCTargetMachine.h diff -u llvm/lib/Target/PowerPC/PowerPCTargetMachine.h:1.2 llvm/lib/Target/PowerPC/PowerPCTargetMachine.h:1.3 --- llvm/lib/Target/PowerPC/PowerPCTargetMachine.h:1.2 Fri Jan 23 00:35:43 2004 +++ llvm/lib/Target/PowerPC/PowerPCTargetMachine.h Fri Jan 23 00:39:30 2004 @@ -27,6 +27,7 @@ class PowerPCTargetMachine : public TargetMachine { PowerPCInstrInfo InstrInfo; TargetFrameInfo FrameInfo; + PowerPCJITInfo JITInfo; public: PowerPCTargetMachine(const Module &M, IntrinsicLowering *IL); @@ -34,6 +35,9 @@ virtual const TargetFrameInfo &getFrameInfo() const { return FrameInfo; } virtual const MRegisterInfo *getRegisterInfo() const { return &InstrInfo.getRegisterInfo(); + } + virtual TargetJITInfo *getJITInfo() { + return &JITInfo; } virtual const TargetSchedInfo &getSchedInfo() const { abort(); } From gaeke at cs.uiuc.edu Fri Jan 23 00:49:02 2004 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Fri Jan 23 00:49:02 2004 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/README.txt Message-ID: <200401230648.AAA06624@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: README.txt added (r1.1) --- Log message: Ward off unsuspecting persons from this directory, until it contains more Good Bits. --- Diffs of the changes: (+26 -0) Index: llvm/lib/Target/PowerPC/README.txt diff -c /dev/null llvm/lib/Target/PowerPC/README.txt:1.1 *** /dev/null Fri Jan 23 00:48:23 2004 --- llvm/lib/Target/PowerPC/README.txt Fri Jan 23 00:48:12 2004 *************** *** 0 **** --- 1,26 ---- + + PowerPC backend skeleton + ------------------------ + + Someday we'd like to have a PowerPC backend. Unfortunately, this + is not yet that day. + + This directory contains mainly stubs and placeholders; there is no + binary machine code emitter, no assembly writer, and no instruction + selector here. Most of the functions in these files call abort() + or fail assertions on purpose, just to reinforce the fact that they + don't work. + + If you want to use LLVM on the PowerPC *today*, use the C Backend + (llvm-dis -c). It generates C code that you can compile with the + native GCC compiler and run. A distant second choice would be the + Interpreter (lli --force-interpreter=true). + + A few things *are* really here, including: + * PowerPC register file definition in TableGen format + * PowerPC definitions of TargetMachine and other target-specific classes + + "Patches," as they say, "are accepted." + + $Date: 2004/01/23 06:48:12 $ + From alkis at cs.uiuc.edu Fri Jan 23 07:39:02 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Fri Jan 23 07:39:02 2004 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveIntervals.cpp Message-ID: <200401231338.HAA05821@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: LiveIntervals.cpp updated: 1.31 -> 1.32 --- Log message: Fix failing test cases with joined live intervals. It turns out that when joining we need to check if we overlap with the second interval or any of its aliases. Also make joining intervals the default. --- Diffs of the changes: (+24 -3) Index: llvm/lib/CodeGen/LiveIntervals.cpp diff -u llvm/lib/CodeGen/LiveIntervals.cpp:1.31 llvm/lib/CodeGen/LiveIntervals.cpp:1.32 --- llvm/lib/CodeGen/LiveIntervals.cpp:1.31 Thu Jan 22 17:08:44 2004 +++ llvm/lib/CodeGen/LiveIntervals.cpp Fri Jan 23 07:37:51 2004 @@ -49,7 +49,7 @@ cl::opt join("join-liveintervals", cl::desc("Join compatible live intervals"), - cl::init(false)); + cl::init(true)); }; void LiveIntervals::getAnalysisUsage(AnalysisUsage &AU) const @@ -387,26 +387,31 @@ Intervals::iterator srcInt = r2iSrc->second; Intervals::iterator dstInt = r2iDst->second; + // src is a physical register if (srcInt->reg < MRegisterInfo::FirstVirtualRegister) { if (dstInt->reg == srcInt->reg || (dstInt->reg >= MRegisterInfo::FirstVirtualRegister && - !dstInt->overlaps(*srcInt))) { + !srcInt->overlaps(*dstInt) && + !overlapsAliases(*srcInt, *dstInt))) { srcInt->join(*dstInt); r2iDst->second = r2iSrc->second; r2rMap_.insert(std::make_pair(dstInt->reg, srcInt->reg)); intervals_.erase(dstInt); } } + // dst is a physical register else if (dstInt->reg < MRegisterInfo::FirstVirtualRegister) { if (srcInt->reg == dstInt->reg || (srcInt->reg >= MRegisterInfo::FirstVirtualRegister && - !srcInt->overlaps(*dstInt))) { + !dstInt->overlaps(*srcInt) && + !overlapsAliases(*dstInt, *srcInt))) { dstInt->join(*srcInt); r2iSrc->second = r2iDst->second; r2rMap_.insert(std::make_pair(srcInt->reg, dstInt->reg)); intervals_.erase(srcInt); } } + // neither src nor dst are physical registers else { const TargetRegisterClass *srcRc, *dstRc; srcRc = mf_->getSSARegMap()->getRegClass(srcInt->reg); @@ -430,6 +435,22 @@ e = r2rMap_.end(); i != e; ++i) std::cerr << i->first << " -> " << i->second << '\n';); +} + +bool LiveIntervals::overlapsAliases(const Interval& lhs, + const Interval& rhs) const +{ + assert(lhs.reg < MRegisterInfo::FirstVirtualRegister && + "first interval must describe a physical register"); + + for (const unsigned* as = mri_->getAliasSet(lhs.reg); *as; ++as) { + Reg2IntervalMap::const_iterator r2i = r2iMap_.find(*as); + assert(r2i != r2iMap_.end() && "alias does not have interval?"); + if (rhs.overlaps(*r2i->second)) + return true; + } + + return false; } LiveIntervals::Interval::Interval(unsigned r) From alkis at cs.uiuc.edu Fri Jan 23 07:39:07 2004 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Fri Jan 23 07:39:07 2004 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/LiveIntervals.h Message-ID: <200401231338.HAA05820@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: LiveIntervals.h updated: 1.12 -> 1.13 --- Log message: Fix failing test cases with joined live intervals. It turns out that when joining we need to check if we overlap with the second interval or any of its aliases. Also make joining intervals the default. --- Diffs of the changes: (+2 -0) Index: llvm/include/llvm/CodeGen/LiveIntervals.h diff -u llvm/include/llvm/CodeGen/LiveIntervals.h:1.12 llvm/include/llvm/CodeGen/LiveIntervals.h:1.13 --- llvm/include/llvm/CodeGen/LiveIntervals.h:1.12 Thu Jan 22 17:08:45 2004 +++ llvm/include/llvm/CodeGen/LiveIntervals.h Fri Jan 23 07:37:51 2004 @@ -162,6 +162,8 @@ MachineBasicBlock::iterator mi, unsigned reg); + bool overlapsAliases(const Interval& lhs, const Interval& rhs) const; + unsigned getInstructionIndex(MachineInstr* instr) const; void printRegName(unsigned reg) const; From gaeke at cs.uiuc.edu Sat Jan 24 03:25:07 2004 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Sat Jan 24 03:25:07 2004 Subject: [llvm-commits] CVS: llvm/utils/TableGen/InstrSelectorEmitter.cpp Message-ID: <200401240923.DAA00886@zion.cs.uiuc.edu> Changes in directory llvm/utils/TableGen: InstrSelectorEmitter.cpp updated: 1.37 -> 1.38 --- Log message: Fix a couple of places I noticed where "X86" was hard-coded. --- Diffs of the changes: (+2 -2) Index: llvm/utils/TableGen/InstrSelectorEmitter.cpp diff -u llvm/utils/TableGen/InstrSelectorEmitter.cpp:1.37 llvm/utils/TableGen/InstrSelectorEmitter.cpp:1.38 --- llvm/utils/TableGen/InstrSelectorEmitter.cpp:1.37 Wed Dec 10 18:58:34 2003 +++ llvm/utils/TableGen/InstrSelectorEmitter.cpp Sat Jan 24 03:23:46 2004 @@ -1023,7 +1023,7 @@ << " class " << Target.getName() << "ISel {\n" << " SelectionDAG &DAG;\n" << " public:\n" - << " X86ISel(SelectionDAG &D) : DAG(D) {}\n" + << " " << Target.getName () << "ISel(SelectionDAG &D) : DAG(D) {}\n" << " void generateCode();\n" << " private:\n" << " unsigned makeAnotherReg(const TargetRegisterClass *RC) {\n" @@ -1060,7 +1060,7 @@ OS << " };\n}\n\n"; // Emit the generateCode entry-point... - OS << "void X86ISel::generateCode() {\n" + OS << "void " << Target.getName () << "ISel::generateCode() {\n" << " SelectionDAGNode *Root = DAG.getRoot();\n" << " assert(Root->getValueType() == MVT::isVoid && " "\"Root of DAG produces value??\");\n\n"