From lattner at cs.uiuc.edu Mon Oct 20 00:46:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 20 00:46:02 2003 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/JIT/Emitter.cpp Message-ID: <200310200545.AAA04139@zion.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine/JIT: Emitter.cpp updated: 1.29 -> 1.30 --- Log message: Hrm, a relic from the past. How cute :) --- Diffs of the changes: (+1 -1) Index: llvm/lib/ExecutionEngine/JIT/Emitter.cpp diff -u llvm/lib/ExecutionEngine/JIT/Emitter.cpp:1.29 llvm/lib/ExecutionEngine/JIT/Emitter.cpp:1.30 --- llvm/lib/ExecutionEngine/JIT/Emitter.cpp:1.29 Thu Oct 16 18:33:38 2003 +++ llvm/lib/ExecutionEngine/JIT/Emitter.cpp Mon Oct 20 00:45:49 2003 @@ -21,7 +21,7 @@ #include "Config/sys/mman.h" namespace { - Statistic<> NumBytes("jello", "Number of bytes of machine code compiled"); + Statistic<> NumBytes("jit", "Number of bytes of machine code compiled"); VM *TheVM = 0; /// JITMemoryManager - Manage memory for the JIT code generation in a logical, From lattner at cs.uiuc.edu Mon Oct 20 00:54:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 20 00:54:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/PeepholeOptimizer.cpp X86InstrInfo.td Message-ID: <200310200553.AAA04167@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: PeepholeOptimizer.cpp updated: 1.3 -> 1.4 X86InstrInfo.td updated: 1.12 -> 1.13 --- Log message: Emit x86 instructions for: A = B op C, where A and B are 16-bit registers, C is a constant which can be sign-extended from 8 bits without value loss, and op is one of: add, sub, imul, and, or, xor. This allows the JIT to emit the one byte version of the constant instead of the two or 4 byte version. Because these instructions are very common, this can save a LOT of code space. For example, I sampled two benchmarks, 176.gcc and 254.gap. BM Old New Reduction 176.gcc 2673621 2548962 4.89% 254.gap 498261 475104 4.87% Note that while the percentage is not spectacular, this did eliminate 124.6 _KILOBYTES_ of codespace from gcc. Not bad. Note that this doesn't effect the llc version at all, because the assembler already does this optimization. --- Diffs of the changes: (+54 -0) Index: llvm/lib/Target/X86/PeepholeOptimizer.cpp diff -u llvm/lib/Target/X86/PeepholeOptimizer.cpp:1.3 llvm/lib/Target/X86/PeepholeOptimizer.cpp:1.4 --- llvm/lib/Target/X86/PeepholeOptimizer.cpp:1.3 Wed Aug 13 13:18:14 2003 +++ llvm/lib/Target/X86/PeepholeOptimizer.cpp Mon Oct 20 00:53:31 2003 @@ -51,6 +51,46 @@ } return false; + // A large number of X86 instructions have forms which take an 8-bit + // immediate despite the fact that the operands are 16 or 32 bits. Because + // this can save three bytes of code size (and icache space), we want to + // shrink them if possible. + case X86::ADDri16: case X86::ADDri32: + case X86::SUBri16: case X86::SUBri32: + case X86::IMULri16: case X86::IMULri32: + case X86::ANDri16: case X86::ANDri32: + case X86::ORri16: case X86::ORri32: + case X86::XORri16: case X86::XORri32: + assert(MI->getNumOperands() == 3 && "These should all have 3 operands!"); + if (MI->getOperand(2).isImmediate()) { + int Val = MI->getOperand(2).getImmedValue(); + // If the value is the same when signed extended from 8 bits... + if (Val == (signed int)(signed char)Val) { + unsigned Opcode; + switch (MI->getOpcode()) { + default: assert(0 && "Unknown opcode value!"); + case X86::ADDri16: Opcode = X86::ADDri16b; break; + case X86::ADDri32: Opcode = X86::ADDri32b; break; + case X86::SUBri16: Opcode = X86::SUBri16b; break; + case X86::SUBri32: Opcode = X86::SUBri32b; break; + case X86::IMULri16: Opcode = X86::IMULri16b; break; + case X86::IMULri32: Opcode = X86::IMULri32b; break; + case X86::ANDri16: Opcode = X86::ANDri16b; break; + case X86::ANDri32: Opcode = X86::ANDri32b; break; + case X86::ORri16: Opcode = X86::ORri16b; break; + case X86::ORri32: Opcode = X86::ORri32b; break; + case X86::XORri16: Opcode = X86::XORri16b; break; + case X86::XORri32: Opcode = X86::XORri32b; break; + } + unsigned R0 = MI->getOperand(0).getReg(); + unsigned R1 = MI->getOperand(1).getReg(); + *I = BuildMI(Opcode, 2, R0).addReg(R1).addZImm((char)Val); + delete MI; + return true; + } + } + return false; + #if 0 case X86::MOVir32: Size++; case X86::MOVir16: Size++; Index: llvm/lib/Target/X86/X86InstrInfo.td diff -u llvm/lib/Target/X86/X86InstrInfo.td:1.12 llvm/lib/Target/X86/X86InstrInfo.td:1.13 --- llvm/lib/Target/X86/X86InstrInfo.td:1.12 Sun Oct 19 22:42:58 2003 +++ llvm/lib/Target/X86/X86InstrInfo.td Mon Oct 20 00:53:31 2003 @@ -243,6 +243,8 @@ def ADDri8 : I2A8 <"add", 0x80, MRMS0r >, Pattern<(set R8 , (plus R8 , imm))>; def ADDri16 : I2A16<"add", 0x81, MRMS0r >, OpSize, Pattern<(set R16, (plus R16, imm))>; def ADDri32 : I2A32<"add", 0x81, MRMS0r >, Pattern<(set R32, (plus R32, imm))>; +def ADDri16b : I2A8 <"add", 0x83, MRMS0r >, OpSize; // ADDri with sign extended 8 bit imm +def ADDri32b : I2A8 <"add", 0x83, MRMS0r >; def ADCrr32 : I2A32<"adc", 0x11, MRMDestReg>; // R32 += imm32+Carry @@ -252,6 +254,8 @@ def SUBri8 : I2A8 <"sub", 0x80, MRMS5r >, Pattern<(set R8 , (minus R8 , imm))>; def SUBri16 : I2A16<"sub", 0x81, MRMS5r >, OpSize, Pattern<(set R16, (minus R16, imm))>; def SUBri32 : I2A32<"sub", 0x81, MRMS5r >, Pattern<(set R32, (minus R32, imm))>; +def SUBri16b : I2A8 <"sub", 0x83, MRMS5r >, OpSize; +def SUBri32b : I2A8 <"sub", 0x83, MRMS5r >; def SBBrr32 : I2A32<"sbb", 0x19, MRMDestReg>; // R32 -= R32+Carry @@ -259,6 +263,9 @@ def IMULrr32 : I2A32<"imul", 0xAF, MRMSrcReg>, TB , Pattern<(set R32, (times R32, R32))>; def IMULri16 : I2A16<"imul", 0x69, MRMSrcReg>, OpSize; def IMULri32 : I2A32<"imul", 0x69, MRMSrcReg>; +def IMULri16b : I2A8<"imul", 0x6B, MRMSrcReg>, OpSize; +def IMULri32b : I2A8<"imul", 0x6B, MRMSrcReg>; + // Logical operators... def ANDrr8 : I2A8 <"and", 0x20, MRMDestReg>, Pattern<(set R8 , (and R8 , R8 ))>; @@ -267,6 +274,8 @@ def ANDri8 : I2A8 <"and", 0x80, MRMS4r >, Pattern<(set R8 , (and R8 , imm))>; def ANDri16 : I2A16<"and", 0x81, MRMS4r >, OpSize, Pattern<(set R16, (and R16, imm))>; def ANDri32 : I2A32<"and", 0x81, MRMS4r >, Pattern<(set R32, (and R32, imm))>; +def ANDri16b : I2A8 <"and", 0x83, MRMS4r >, OpSize; +def ANDri32b : I2A8 <"and", 0x83, MRMS4r >; def ORrr8 : I2A8 <"or" , 0x08, MRMDestReg>, Pattern<(set R8 , (or R8 , R8 ))>; def ORrr16 : I2A16<"or" , 0x09, MRMDestReg>, OpSize, Pattern<(set R16, (or R16, R16))>; @@ -274,6 +283,9 @@ def ORri8 : I2A8 <"or" , 0x80, MRMS1r >, Pattern<(set R8 , (or R8 , imm))>; def ORri16 : I2A16<"or" , 0x81, MRMS1r >, OpSize, Pattern<(set R16, (or R16, imm))>; def ORri32 : I2A32<"or" , 0x81, MRMS1r >, Pattern<(set R32, (or R32, imm))>; +def ORri16b : I2A8 <"or" , 0x83, MRMS1r >, OpSize; +def ORri32b : I2A8 <"or" , 0x83, MRMS1r >; + def XORrr8 : I2A8 <"xor", 0x30, MRMDestReg>, Pattern<(set R8 , (xor R8 , R8 ))>; def XORrr16 : I2A16<"xor", 0x31, MRMDestReg>, OpSize, Pattern<(set R16, (xor R16, R16))>; @@ -281,6 +293,8 @@ def XORri8 : I2A8 <"xor", 0x80, MRMS6r >, Pattern<(set R8 , (xor R8 , imm))>; def XORri16 : I2A16<"xor", 0x81, MRMS6r >, OpSize, Pattern<(set R16, (xor R16, imm))>; def XORri32 : I2A32<"xor", 0x81, MRMS6r >, Pattern<(set R32, (xor R32, imm))>; +def XORri16b : I2A8 <"xor", 0x83, MRMS6r >, OpSize; +def XORri32b : I2A8 <"xor", 0x83, MRMS6r >; // Test instructions are just like AND, except they don't generate a result. def TESTrr8 : X86Inst<"test", 0x84, MRMDestReg, Arg8 >; // flags = R8 & R8 From lattner at cs.uiuc.edu Mon Oct 20 00:55:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 20 00:55:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/InlineSimple.cpp Message-ID: <200310200554.AAA04181@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: InlineSimple.cpp updated: 1.54 -> 1.55 --- Log message: Reorder for minor efficiency gain --- Diffs of the changes: (+1 -1) Index: llvm/lib/Transforms/IPO/InlineSimple.cpp diff -u llvm/lib/Transforms/IPO/InlineSimple.cpp:1.54 llvm/lib/Transforms/IPO/InlineSimple.cpp:1.55 --- llvm/lib/Transforms/IPO/InlineSimple.cpp:1.54 Wed Oct 15 11:48:29 2003 +++ llvm/lib/Transforms/IPO/InlineSimple.cpp Mon Oct 20 00:54:26 2003 @@ -49,7 +49,7 @@ // If there is only one call of the function, and it has internal linkage, // make it almost guaranteed to be inlined. // - if (Callee->hasOneUse() && Callee->hasInternalLinkage()) + if (Callee->hasInternalLinkage() && Callee->hasOneUse()) InlineCost -= 30000; // Add to the inline quality for properties that make the call valuable to From lattner at cs.uiuc.edu Mon Oct 20 09:14:03 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 20 09:14:03 2003 Subject: [llvm-commits] CVS: llvm/lib/Target/Sparc/Sparc.burg.in Message-ID: <200310201413.JAA16864@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/Sparc: Sparc.burg.in updated: 1.8 -> 1.9 --- Log message: Apparently the dependencies are wrong for this file, so it didn't rebuild it when changing Instruction.def. :( --- Diffs of the changes: (+1 -1) Index: llvm/lib/Target/Sparc/Sparc.burg.in diff -u llvm/lib/Target/Sparc/Sparc.burg.in:1.8 llvm/lib/Target/Sparc/Sparc.burg.in:1.9 --- llvm/lib/Target/Sparc/Sparc.burg.in:1.8 Sat Oct 18 00:55:58 2003 +++ llvm/lib/Target/Sparc/Sparc.burg.in Mon Oct 20 09:12:52 2003 @@ -67,7 +67,7 @@ %term GetElemPtr=GetElementPtrOPCODE %term GetElemPtrIdx=125 /* getElemPtr with index vector */ -%term Phi=PHINodeOPCODE +%term Phi=PHIOPCODE %term Cast=CastOPCODE /* cast that will be ignored. others are made explicit */ %term ToBoolTy=127 From gaeke at cs.uiuc.edu Mon Oct 20 10:15:03 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Mon Oct 20 10:15:03 2003 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/TargetMachine.h Message-ID: <200310201514.KAA18692@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: TargetMachine.h updated: 1.36 -> 1.37 --- Log message: Make replaceMachineCodeForFunction return void. Make it assert by default. --- Diffs of the changes: (+6 -4) Index: llvm/include/llvm/Target/TargetMachine.h diff -u llvm/include/llvm/Target/TargetMachine.h:1.36 llvm/include/llvm/Target/TargetMachine.h:1.37 --- llvm/include/llvm/Target/TargetMachine.h:1.36 Fri Oct 17 13:26:45 2003 +++ llvm/include/llvm/Target/TargetMachine.h Mon Oct 20 10:14:33 2003 @@ -8,6 +8,7 @@ #define LLVM_TARGET_TARGETMACHINE_H #include "llvm/Target/TargetData.h" +#include class TargetInstrInfo; class TargetInstrDescriptor; @@ -100,11 +101,12 @@ } /// replaceMachineCodeForFunction - Make it so that calling the - /// function whose machine code is at OLD turns into a call to NEW. Returns - /// true iff an error occurred. FIXME: this is JIT-specific. + /// function whose machine code is at OLD turns into a call to NEW, + /// perhaps by overwriting OLD with a branch to NEW. FIXME: this is + /// JIT-specific. /// - virtual bool replaceMachineCodeForFunction (void *Old, void *New) { - return true; + virtual void replaceMachineCodeForFunction (void *Old, void *New) { + assert (0 && "Current target cannot replace machine code for functions"); } }; From gaeke at cs.uiuc.edu Mon Oct 20 10:16:04 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Mon Oct 20 10:16:04 2003 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86TargetMachine.cpp Message-ID: <200310201515.KAA18716@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86TargetMachine.cpp updated: 1.33 -> 1.34 --- Log message: Make replaceMachineCodeForFunction return void. --- Diffs of the changes: (+1 -2) Index: llvm/lib/Target/X86/X86TargetMachine.cpp diff -u llvm/lib/Target/X86/X86TargetMachine.cpp:1.33 llvm/lib/Target/X86/X86TargetMachine.cpp:1.34 --- llvm/lib/Target/X86/X86TargetMachine.cpp:1.33 Sun Oct 19 23:11:23 2003 +++ llvm/lib/Target/X86/X86TargetMachine.cpp Mon Oct 20 10:15:17 2003 @@ -137,7 +137,7 @@ return false; // success! } -bool X86TargetMachine::replaceMachineCodeForFunction (void *Old, void *New) { +void X86TargetMachine::replaceMachineCodeForFunction (void *Old, void *New) { // FIXME: This code could perhaps live in a more appropriate place. char *OldByte = (char *) Old; *OldByte++ = 0xE9; // Emit JMP opcode. @@ -145,5 +145,4 @@ int32_t NewAddr = (int32_t) New; int32_t OldAddr = (int32_t) OldWord; *OldWord = NewAddr - OldAddr - 4; // Emit PC-relative addr of New code. - return false; // success! } From gaeke at cs.uiuc.edu Mon Oct 20 10:16:07 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Mon Oct 20 10:16:07 2003 Subject: [llvm-commits] CVS: llvm/lib/Target/Sparc/SparcV9CodeEmitter.cpp Message-ID: <200310201515.KAA18708@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/Sparc: SparcV9CodeEmitter.cpp updated: 1.36 -> 1.37 --- Log message: Make replaceMachineCodeForFunction return void. --- Diffs of the changes: (+1 -2) Index: llvm/lib/Target/Sparc/SparcV9CodeEmitter.cpp diff -u llvm/lib/Target/Sparc/SparcV9CodeEmitter.cpp:1.36 llvm/lib/Target/Sparc/SparcV9CodeEmitter.cpp:1.37 --- llvm/lib/Target/Sparc/SparcV9CodeEmitter.cpp:1.36 Fri Oct 17 13:27:37 2003 +++ llvm/lib/Target/Sparc/SparcV9CodeEmitter.cpp Mon Oct 20 10:15:16 2003 @@ -562,12 +562,11 @@ } } -bool UltraSparc::replaceMachineCodeForFunction (void *Old, void *New) { +void UltraSparc::replaceMachineCodeForFunction (void *Old, void *New) { if (!TheJITResolver) return true; // fail if not in JIT. uint64_t Target = (uint64_t)(intptr_t)New; uint64_t CodeBegin = (uint64_t)(intptr_t)Old; TheJITResolver->insertJumpAtAddr(Target, CodeBegin); - return false; } int64_t SparcV9CodeEmitter::getMachineOpValue(MachineInstr &MI, From gaeke at cs.uiuc.edu Mon Oct 20 10:18:06 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Mon Oct 20 10:18:06 2003 Subject: [llvm-commits] CVS: llvm/lib/Target/Sparc/SparcInternals.h Message-ID: <200310201517.KAA22033@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/Sparc: SparcInternals.h updated: 1.102 -> 1.103 --- Log message: Make replaceMachineCodeForFunction() return void. --- Diffs of the changes: (+1 -1) Index: llvm/lib/Target/Sparc/SparcInternals.h diff -u llvm/lib/Target/Sparc/SparcInternals.h:1.102 llvm/lib/Target/Sparc/SparcInternals.h:1.103 --- llvm/lib/Target/Sparc/SparcInternals.h:1.102 Fri Oct 17 13:27:24 2003 +++ llvm/lib/Target/Sparc/SparcInternals.h Mon Oct 20 10:17:12 2003 @@ -677,7 +677,7 @@ virtual bool addPassesToJITCompile(FunctionPassManager &PM); virtual bool addPassesToEmitMachineCode(FunctionPassManager &PM, MachineCodeEmitter &MCE); - virtual bool replaceMachineCodeForFunction(void *Old, void *New); + virtual void replaceMachineCodeForFunction(void *Old, void *New); // getPrologEpilogInsertionPass - Inserts prolog/epilog code. FunctionPass* getPrologEpilogInsertionPass(); From criswell at cs.uiuc.edu Mon Oct 20 11:41:02 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Mon Oct 20 11:41:02 2003 Subject: [llvm-commits] CVS: llvm/docs/GettingStarted.html Message-ID: <200310201640.LAA21810@choi.cs.uiuc.edu> Changes in directory llvm/docs: GettingStarted.html updated: 1.39 -> 1.40 --- Log message: Made the Requirements information its own major section and moved it between the "Getting Started Quickly" and "Getting Started Slowly" sections. :) Removed some of the nit-picky requirements information (i.e. GNU tar and GNU zip). Attempted to compact the requirements information so that it is less scary. --- Diffs of the changes: (+119 -140) Index: llvm/docs/GettingStarted.html diff -u llvm/docs/GettingStarted.html:1.39 llvm/docs/GettingStarted.html:1.40 --- llvm/docs/GettingStarted.html:1.39 Mon Oct 13 11:19:30 2003 +++ llvm/docs/GettingStarted.html Mon Oct 20 11:39:52 2003 @@ -19,14 +19,13 @@


Known problems with the C front-end


Known problems with the Sparc back-end

Programming Documentation: @@ -332,14 +345,32 @@ LLVM Coding standards - Details the LLVM coding standards and provides useful information on writing efficient C++ code. -
  • Open Projects in - the LLVM system. Look here if you are interested in - doing something with LLVM, but aren't sure what needs - to be done.
  • + +
  • Open Projects + - Look here if you are interested in doing something with + LLVM but aren't sure what needs to be done.
  • + +
  • Doxygen generated documentation + (classes) +
  • + - Other Useful Information: +

    + Support +

    +

    From lattner at cs.uiuc.edu Tue Oct 21 15:29:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 21 15:29:01 2003 Subject: [llvm-commits] CVS: llvm-www/www-index.html Message-ID: <200310212028.PAA26238@zion.cs.uiuc.edu> Changes in directory llvm-www: www-index.html updated: 1.62 -> 1.63 --- Log message: No really, don't list the LangRef twice Also, make the support section consistent --- Diffs of the changes: (+1 -14) Index: llvm-www/www-index.html diff -u llvm-www/www-index.html:1.62 llvm-www/www-index.html:1.63 --- llvm-www/www-index.html:1.62 Tue Oct 21 15:21:13 2003 +++ llvm-www/www-index.html Tue Oct 21 15:28:17 2003 @@ -307,16 +307,6 @@

  • LLVM Test Suite Guide - A reference manual for using the LLVM test suite. - -
  • - - LLVM Reference Manual - - - Defines the LLVM - intermediate representation, the assembly - form of the different nodes, and provides - reference information about the different - tools in LLVM.
  • Programming Documentation: @@ -356,10 +346,7 @@ -

    - Support -

    - + Support: @@ -280,13 +280,6 @@ each of these names with the appropriate pathname on your local system. All these paths are absolute:

    -
    CVSROOTDIR -
    - This is the path for the CVS repository containing the LLVM source - code. Ask the person responsible for your local LLVM installation to - give you this path. -

    -

    SRC_ROOT
    This is the top level directory of the LLVM source tree. @@ -364,7 +357,9 @@ follows:
    • cd where-you-want-llvm-to-live -
    • cvs -d CVSROOTDIR checkout llvm

      +
    • cvs -d :pserver:anon at llvm-cvs.cs.uiuc.edu:/var/cvs/llvm login +
    • Hit the return key when prompted for the password. +
    • cvs -d :pserver:anon at llvm-cvs.cs.uiuc.edu:/var/cvs/llvm co llvm

    This will create an 'llvm' directory in the current @@ -402,8 +397,8 @@

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

    The following environment variables are used by the configure From lattner at cs.uiuc.edu Tue Oct 21 16:34:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 21 16:34:01 2003 Subject: [llvm-commits] CVS: llvm/test/Regression/C++Frontend/2003-10-21-InnerClass.cpp.tr Message-ID: <200310212133.QAA03273@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/C++Frontend: 2003-10-21-InnerClass.cpp.tr added (r1.1) --- Log message: New testcase, fixed in the C++ frontend --- Diffs of the changes: (+12 -0) Index: llvm/test/Regression/C++Frontend/2003-10-21-InnerClass.cpp.tr diff -c /dev/null llvm/test/Regression/C++Frontend/2003-10-21-InnerClass.cpp.tr:1.1 *** /dev/null Tue Oct 21 16:33:28 2003 --- llvm/test/Regression/C++Frontend/2003-10-21-InnerClass.cpp.tr Tue Oct 21 16:33:18 2003 *************** *** 0 **** --- 1,12 ---- + // RUN: %llvmgcc -xc++ -S -o - %s | grep '"struct.X::Y"' + struct X { + + struct Y { + Y(); + }; + + }; + + X::Y::Y() { + + } From lattner at cs.uiuc.edu Tue Oct 21 16:53:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 21 16:53:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Utils/Linker.cpp Message-ID: <200310212152.QAA22839@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Utils: Linker.cpp updated: 1.57 -> 1.58 --- Log message: Fix message to make more sense and confuse Chris less --- Diffs of the changes: (+7 -2) Index: llvm/lib/Transforms/Utils/Linker.cpp diff -u llvm/lib/Transforms/Utils/Linker.cpp:1.57 llvm/lib/Transforms/Utils/Linker.cpp:1.58 --- llvm/lib/Transforms/Utils/Linker.cpp:1.57 Mon Oct 20 14:43:20 2003 +++ llvm/lib/Transforms/Utils/Linker.cpp Tue Oct 21 16:52:20 2003 @@ -463,11 +463,16 @@ "' have different linkage specifiers!"); } else if (SGV->hasExternalLinkage()) { // Allow linking two exactly identical external global variables... - if (SGV->isConstant() != DGV->isConstant() || - SGV->getInitializer() != DGV->getInitializer()) + if (SGV->isConstant() != DGV->isConstant()) return Error(Err, "Global Variable Collision on '" + SGV->getType()->getDescription() + " %" + SGV->getName() + "' - Global variables differ in const'ness"); + + if (SGV->getInitializer() != DGV->getInitializer()) + return Error(Err, "Global Variable Collision on '" + + SGV->getType()->getDescription() + " %" + SGV->getName() + + "' - External linkage globals have different initializers"); + ValueMap.insert(std::make_pair(SGV, DGV)); } else if (SGV->hasLinkOnceLinkage()) { // If the global variable has a name, and that name is already in use in From gaeke at cs.uiuc.edu Tue Oct 21 16:59:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Tue Oct 21 16:59:01 2003 Subject: [llvm-commits] CVS: llvm/docs/CFEBuildInstrs.html Message-ID: <200310212158.QAA18564@gally.cs.uiuc.edu> Changes in directory llvm/docs: CFEBuildInstrs.html added (r1.1) --- Log message: Add C/C++ build instructions, first draft. --- Diffs of the changes: (+140 -0) Index: llvm/docs/CFEBuildInstrs.html diff -c /dev/null llvm/docs/CFEBuildInstrs.html:1.1 *** /dev/null Tue Oct 21 16:58:48 2003 --- llvm/docs/CFEBuildInstrs.html Tue Oct 21 16:58:38 2003 *************** *** 0 **** --- 1,140 ---- + + Bootstrapping the C/C++ Front-End + + +

    Bootstrapping the C/C++ Front-End

    + +

    + + + +
    + Instructions +
      + + +

      This document is intended to explain the process of building the LLVM + C/C++ front-end, based on GCC 3.4, from source.

      + +

      NOTE: This is currently a somewhat fragile, error-prone + process, and you should only try to do it if (A) you really, really, + really can't use the binaries we distribute, and (B) you are a wicked + good GCC hacker.

      + +

      We welcome patches to help make this process simpler.

      + +
        +
      1. Configure and build the LLVM libraries and tools using:

        +
        +  % cd llvm
        +  % ./configure [options...]
        +  % gmake tools-only
        + 
        +

        The use of the non-default target "tools-only" means that the + LLVM tools and libraries will build, and the binaries will be + deposited in llvm/tools/Debug, but the runtime (bytecode) + libraries will not build.

        + +
      2. Add the directory containing the tools to your PATH.

        +
        +  % set path = ( `cd llvm/tools/Debug && pwd` $path )
        + 
        + +
      3. Unpack the C/C++ front-end source into cfrontend/src.

        + +
      4. Edit src/configure. Change the first line (starting w/ #!) to + contain the correct full pathname of sh.

        + +
      5. Make "build" and "install" directories as siblings of the "src" + tree.

        +
        +  % pwd
        +  /usr/local/example/cfrontend/src
        +  % cd ..
        +  % mkdir build install
        +  % set CFEINSTALL = `pwd`/install
        + 
        + +
      6. Configure, build and install the C front-end:

        +
        +  % cd build
        +  % ../src/configure --prefix=$CFEINSTALL --disable-nls --disable-shared \
        +    --enable-languages=c,c++
        +  % gmake all-gcc
        +  % setenv LLVM_LIB_SEARCH_PATH `pwd`/gcc 
        +  % gmake all; gmake install
        + 
        + +

        Common Problem 1: You may get error messages regarding the fact + that LLVM does not support inline assembly. Here are two common + fixes:

        + +
          +
        • Fix 1: If you have system header files that include + inline assembly, you may have to modify them to remove the inline + assembly, and install the modified versions in + $CFEINSTALL/target-triplet/sys-include.

          + +
        • Fix 2: If you are building the C++ front-end on a CPU we + haven't tried yet, you will probably have to edit the appropriate + version of atomicity.h under + src/libstdc++-v3/config/cpu/name-of-cpu/atomicity.h + and apply a patch so that it does not use inline assembly.

          +
        + +

        Common Problem 2: FIXME: Chris should add a section about + common problems porting to a new architecture, including changes you + might have to make to the gcc/gcc/config/name-of-cpu + directory. For example (expand these):

        + +
          +
        • Munge linker flags so they are compatible with gccld. +
        • Change the target so it doesn't have long double; just use double + instead. +
        • No inline assembly for position independent code. +
        • We handle init and fini differently. +
        • Do not include inline assembly map things for SPARC, or profile things. +
        + +
      7. Go back into the LLVM source tree proper. Edit Makefile.config + to redefine LLVMGCCDIR to the full pathname of the + $CFEINSTALL directory, which is the directory you just + installed the C front-end into. (The ./configure script is likely to + have set this to a directory which does not exist on your system.)

        + +
      8. If you edited header files during the C/C++ front-end build as + described in "Fix 1" above, you must now copy those header files from + $CFEINSTALL/target-triplet/sys-include to + $CFEINSTALL/lib/gcc/target-triplet/3.4-llvm/include. + (This should be the "include" directory in the same directory as the + libgcc.a library, which you can find by running + $CFEINSTALL/bin/gcc --print-libgcc-file-name.)

        + +
      9. Build and install the runtime (bytecode) libraries by running:

        +
        +  % gmake -C runtime
        +  % mkdir $CFEINSTALL/bytecode-libs
        +  % gmake -C runtime install
        +  % setenv LLVM_LIB_SEARCH_PATH $CFEINSTALL/bytecode-libs
        + 
        + +
      10. Test the newly-installed C frontend by one or more of the + following means:

        +
          +
        • compiling and running a "hello, world" program in C or C++. +
        • running the tests under test/Programs using gmake -C + test/Programs; +
        + +

        +
      + + +
    + + +
    +
    Brian Gaeke
    + Last modified: $Date: 2003/10/21 21:58:38 $ +
    + From brukman at cs.uiuc.edu Tue Oct 21 17:17:00 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Tue Oct 21 17:17:00 2003 Subject: [llvm-commits] CVS: llvm-www/pubs/2002-08-08-CASES02-ControlC.html Message-ID: <200310212216.RAA03790@zion.cs.uiuc.edu> Changes in directory llvm-www/pubs: 2002-08-08-CASES02-ControlC.html updated: 1.5 -> 1.6 --- Log message: Fix author initials and alignment of `='. --- Diffs of the changes: (+7 -7) Index: llvm-www/pubs/2002-08-08-CASES02-ControlC.html diff -u llvm-www/pubs/2002-08-08-CASES02-ControlC.html:1.5 llvm-www/pubs/2002-08-08-CASES02-ControlC.html:1.6 --- llvm-www/pubs/2002-08-08-CASES02-ControlC.html:1.5 Wed May 21 12:09:18 2003 +++ llvm-www/pubs/2002-08-08-CASES02-ControlC.html Tue Oct 21 17:16:16 2003 @@ -56,14 +56,14 @@

    Bibtex Entry:

    -  @inproceedings{DKAL:LCTES03,
    -    Author = {Sumant Kowshik, Dinakar Dhurjati and Vikram Adve},
    -    Title = {{E}nsuring {C}ode {S}afety {W}ithout {R}untime {C}hecks for {R}eal-{T}ime {C}ontrol {S}ystems},
    +  @inproceedings{KDA:LCTES03,
    +    Author    = {Sumant Kowshik, Dinakar Dhurjati and Vikram Adve},
    +    Title     = {{E}nsuring {C}ode {S}afety {W}ithout {R}untime {C}hecks for {R}eal-{T}ime {C}ontrol {S}ystems},
         Booktitle = {Proc. Int'l Conf. on Compilers Architecture and Synthesis for Embedded Systems, 2002},
    -    Address = {Grenoble, France},
    -    Month = {Oct},
    -    Year = {2002},
    -    URL = {http://llvm.cs.uiuc.edu/pubs/2003-08-08-CASES02-ControlC.html}
    +    Address   = {Grenoble, France},
    +    Month     = {Oct},
    +    Year      = {2002},
    +    URL       = {http://llvm.cs.uiuc.edu/pubs/2003-08-08-CASES02-ControlC.html}
       }
     
    From brukman at cs.uiuc.edu Tue Oct 21 17:31:02 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Tue Oct 21 17:31:02 2003 Subject: [llvm-commits] CVS: llvm-www/llvm.css Message-ID: <200310212230.RAA09254@zion.cs.uiuc.edu> Changes in directory llvm-www: llvm.css added (r1.1) --- Log message: It's about time we use stylesheets, I hate duplicated formatting HTML code. --- Diffs of the changes: (+10 -0) Index: llvm-www/llvm.css diff -c /dev/null llvm-www/llvm.css:1.1 *** /dev/null Tue Oct 21 17:30:10 2003 --- llvm-www/llvm.css Tue Oct 21 17:30:00 2003 *************** *** 0 **** --- 1,10 ---- + /* + * LLVM website style sheet + */ + + .body { text: black; background: white } + + /* Publications */ + .pub_title { font-family: "Georgia,Palatino,Times,Roman"; font-size: 24pt; + text-align: center } + .pub_author { font-size: 14pt; text-align: center } From brukman at cs.uiuc.edu Tue Oct 21 17:32:01 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Tue Oct 21 17:32:01 2003 Subject: [llvm-commits] CVS: llvm-www/pubs/2002-08-08-CASES02-ControlC.html Message-ID: <200310212231.RAA13979@zion.cs.uiuc.edu> Changes in directory llvm-www/pubs: 2002-08-08-CASES02-ControlC.html updated: 1.6 -> 1.7 --- Log message: * Use a stylesheet => use
    instead of tags * Use UTF-8 instead of iso-8859-1, not only does it save a few bytes, it's international * Wrap lines (that we can) at 80 chars * Using
      for indentation is a hack at best --- Diffs of the changes: (+27 -19) Index: llvm-www/pubs/2002-08-08-CASES02-ControlC.html diff -u llvm-www/pubs/2002-08-08-CASES02-ControlC.html:1.6 llvm-www/pubs/2002-08-08-CASES02-ControlC.html:1.7 --- llvm-www/pubs/2002-08-08-CASES02-ControlC.html:1.6 Tue Oct 21 17:16:16 2003 +++ llvm-www/pubs/2002-08-08-CASES02-ControlC.html Tue Oct 21 17:31:42 2003 @@ -1,16 +1,20 @@ - - -Ensuring Code Safety Without Runtime Checks for Real-Time Control Systems + + + + + Ensuring Code Safety Without Runtime Checks for Real-Time Control Systems - + -


      Ensuring Code Safety Without Runtime Checks for Real-Time Control Systems
      - Sumant Kowshik, Dinakar Dhurjati and - Vikram Adve -

      +
      +Ensuring Code Safety Without Runtime Checks for Real-Time Control Systems +
      +
      +Sumant Kowshik, Dinakar Dhurjati and +Vikram Adve +

      Abstract:

      @@ -40,18 +44,21 @@

      Published:

      -
        - "Ensuring Code Safety Without Runtime Checks for Real-Time Control Systems", Sumant Kowshik, Dinakar Dhurjati & - Vikram Adve,
        - CASES 2002 - , Grenoble, France, Oct 2002.
        -
      +
      + "Ensuring Code Safety Without Runtime Checks for Real-Time Control Systems", + Sumant Kowshik, Dinakar Dhurjati & Vikram Adve,
      + CASES + 2002, Grenoble, France, Oct 2002.
      +

      Download:

      Bibtex Entry:

      @@ -67,4 +74,5 @@ } - + + From brukman at cs.uiuc.edu Tue Oct 21 17:44:01 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Tue Oct 21 17:44:01 2003 Subject: [llvm-commits] CVS: llvm-www/pubs/2002-06-AutomaticPoolAllocation.html 2002-08-09-LLVMCompilationStrategy.html 2002-12-LattnerMSThesis.html 2003-04-29-DataStructureAnalysisTR.html 2003-05-01-GCCSummit2003.html 2003-05-05-LCTES03-CodeSafety.html 2003-09-30-LifelongOptimizationTR.html 2003-10-01-LLVA.html Message-ID: <200310212243.RAA19590@zion.cs.uiuc.edu> Changes in directory llvm-www/pubs: 2002-06-AutomaticPoolAllocation.html updated: 1.3 -> 1.4 2002-08-09-LLVMCompilationStrategy.html updated: 1.4 -> 1.5 2002-12-LattnerMSThesis.html updated: 1.2 -> 1.3 2003-04-29-DataStructureAnalysisTR.html updated: 1.2 -> 1.3 2003-05-01-GCCSummit2003.html updated: 1.6 -> 1.7 2003-05-05-LCTES03-CodeSafety.html updated: 1.3 -> 1.4 2003-09-30-LifelongOptimizationTR.html updated: 1.1 -> 1.2 2003-10-01-LLVA.html updated: 1.2 -> 1.3 --- Log message: * Line up , , tags * Use a style sheet, this cleans up the <body> tag * Use UTF-8 instead of ISO-8859-1 charset --- Diffs of the changes: (+52 -35) Index: llvm-www/pubs/2002-06-AutomaticPoolAllocation.html diff -u llvm-www/pubs/2002-06-AutomaticPoolAllocation.html:1.3 llvm-www/pubs/2002-06-AutomaticPoolAllocation.html:1.4 --- llvm-www/pubs/2002-06-AutomaticPoolAllocation.html:1.3 Tue May 20 15:00:53 2003 +++ llvm-www/pubs/2002-06-AutomaticPoolAllocation.html Tue Oct 21 17:43:15 2003 @@ -1,10 +1,12 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> -<html><head> -<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -<title>Automatic Pool Allocation for Disjoint Data Structures + + + + + Automatic Pool Allocation for Disjoint Data Structures - +


      Automatic Pool Allocation for Disjoint Data @@ -60,4 +62,5 @@ } - + + Index: llvm-www/pubs/2002-08-09-LLVMCompilationStrategy.html diff -u llvm-www/pubs/2002-08-09-LLVMCompilationStrategy.html:1.4 llvm-www/pubs/2002-08-09-LLVMCompilationStrategy.html:1.5 --- llvm-www/pubs/2002-08-09-LLVMCompilationStrategy.html:1.4 Thu Sep 11 15:44:40 2003 +++ llvm-www/pubs/2002-08-09-LLVMCompilationStrategy.html Tue Oct 21 17:43:15 2003 @@ -1,9 +1,11 @@ - - -The LLVM Instruction Set and Compilation Strategy + + + + + The LLVM Instruction Set and Compilation Strategy - +


      Index: llvm-www/pubs/2002-12-LattnerMSThesis.html diff -u llvm-www/pubs/2002-12-LattnerMSThesis.html:1.2 llvm-www/pubs/2002-12-LattnerMSThesis.html:1.3 --- llvm-www/pubs/2002-12-LattnerMSThesis.html:1.2 Fri May 9 13:25:21 2003 +++ llvm-www/pubs/2002-12-LattnerMSThesis.html Tue Oct 21 17:43:15 2003 @@ -1,9 +1,11 @@ - - -LLVM: An Infrastructure for Multi-Stage Optimization + + + + + LLVM: An Infrastructure for Multi-Stage Optimization - +


      Index: llvm-www/pubs/2003-04-29-DataStructureAnalysisTR.html diff -u llvm-www/pubs/2003-04-29-DataStructureAnalysisTR.html:1.2 llvm-www/pubs/2003-04-29-DataStructureAnalysisTR.html:1.3 --- llvm-www/pubs/2003-04-29-DataStructureAnalysisTR.html:1.2 Mon Sep 15 17:20:56 2003 +++ llvm-www/pubs/2003-04-29-DataStructureAnalysisTR.html Tue Oct 21 17:43:15 2003 @@ -1,9 +1,12 @@ - - -Data Structure Analysis: An Efficient Context-Sensitive Heap Analysis + + + + + Data Structure Analysis: An Efficient Context-Sensitive Heap + Analysis - +


      Index: llvm-www/pubs/2003-05-01-GCCSummit2003.html diff -u llvm-www/pubs/2003-05-01-GCCSummit2003.html:1.6 llvm-www/pubs/2003-05-01-GCCSummit2003.html:1.7 --- llvm-www/pubs/2003-05-01-GCCSummit2003.html:1.6 Mon May 26 13:39:42 2003 +++ llvm-www/pubs/2003-05-01-GCCSummit2003.html Tue Oct 21 17:43:15 2003 @@ -1,10 +1,11 @@ - - -Architecture for a Next-Generation GCC + + + + + Architecture for a Next-Generation GCC - - +


      Architecture for a Next-Generation Index: llvm-www/pubs/2003-05-05-LCTES03-CodeSafety.html diff -u llvm-www/pubs/2003-05-05-LCTES03-CodeSafety.html:1.3 llvm-www/pubs/2003-05-05-LCTES03-CodeSafety.html:1.4 --- llvm-www/pubs/2003-05-05-LCTES03-CodeSafety.html:1.3 Mon Jun 23 07:13:36 2003 +++ llvm-www/pubs/2003-05-05-LCTES03-CodeSafety.html Tue Oct 21 17:43:15 2003 @@ -1,10 +1,11 @@ - - -Memory Safety Without Runtime Checks or Garbage Collection + + + + + Memory Safety Without Runtime Checks or Garbage Collection - - +


      Memory Safety Without Runtime Checks or Garbage Collection
      Index: llvm-www/pubs/2003-09-30-LifelongOptimizationTR.html diff -u llvm-www/pubs/2003-09-30-LifelongOptimizationTR.html:1.1 llvm-www/pubs/2003-09-30-LifelongOptimizationTR.html:1.2 --- llvm-www/pubs/2003-09-30-LifelongOptimizationTR.html:1.1 Wed Oct 1 15:46:36 2003 +++ llvm-www/pubs/2003-09-30-LifelongOptimizationTR.html Tue Oct 21 17:43:15 2003 @@ -1,9 +1,12 @@ - - -LLVM: A Compilation Framework for Lifelong Program Analysis & Transformation + + + + + LLVM: A Compilation Framework for Lifelong Program Analysis & + Transformation - +


      Index: llvm-www/pubs/2003-10-01-LLVA.html diff -u llvm-www/pubs/2003-10-01-LLVA.html:1.2 llvm-www/pubs/2003-10-01-LLVA.html:1.3 --- llvm-www/pubs/2003-10-01-LLVA.html:1.2 Wed Oct 1 15:57:28 2003 +++ llvm-www/pubs/2003-10-01-LLVA.html Tue Oct 21 17:43:15 2003 @@ -1,9 +1,11 @@ - - -LLVA: A Low-level Virtual Instruction Set Architecture + + + + + LLVA: A Low-level Virtual Instruction Set Architecture - +


      From lattner at cs.uiuc.edu Tue Oct 21 17:47:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 21 17:47:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Utils/Linker.cpp Message-ID: <200310212246.RAA20248@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Utils: Linker.cpp updated: 1.58 -> 1.59 --- Log message: Fix bug: Linker/2003-10-21-ConflictingTypesTolerance.ll --- Diffs of the changes: (+10 -13) Index: llvm/lib/Transforms/Utils/Linker.cpp diff -u llvm/lib/Transforms/Utils/Linker.cpp:1.58 llvm/lib/Transforms/Utils/Linker.cpp:1.59 --- llvm/lib/Transforms/Utils/Linker.cpp:1.58 Tue Oct 21 16:52:20 2003 +++ llvm/lib/Transforms/Utils/Linker.cpp Tue Oct 21 17:46:38 2003 @@ -215,20 +215,17 @@ } // If we STILL cannot resolve the types, then there is something wrong. - // Report the error. + // Report the warning and delete one of the names. if (DelayedTypesToResolve.size() == OldSize) { - // Build up an error message of all of the mismatched types. - std::string ErrorMessage; - for (unsigned i = 0, e = DelayedTypesToResolve.size(); i != e; ++i) { - const std::string &Name = DelayedTypesToResolve[i]; - const Type *T1 = cast(VM.find(Name)->second); - const Type *T2 = cast(DestST->lookup(Type::TypeTy, Name)); - ErrorMessage += " Type named '" + Name + - "' conflicts.\n Src='" + T1->getDescription() + - "'.\n Dest='" + T2->getDescription() + "'\n"; - } - return Error(Err, "Type conflict between types in modules:\n" + - ErrorMessage); + const std::string &Name = DelayedTypesToResolve.back(); + + const Type *T1 = cast(VM.find(Name)->second); + const Type *T2 = cast(DestST->lookup(Type::TypeTy, Name)); + std::cerr << "WARNING: Type conflict between types named '" << Name + << "'.\n Src='" << *T1 << "'.\n Dest='" << *T2 << "'\n"; + + // Remove the symbol name from the destination. + DelayedTypesToResolve.pop_back(); } } } From lattner at cs.uiuc.edu Tue Oct 21 17:47:10 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 21 17:47:10 2003 Subject: [llvm-commits] CVS: llvm/test/Regression/Linker/2003-10-21-ConflictingTypesTolerance.ll Message-ID: <200310212246.RAA20053@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Linker: 2003-10-21-ConflictingTypesTolerance.ll added (r1.1) --- Log message: New testcase. The linker should not consider it an error if two types disagree. It should grumble, then go ahead and do it. --- Diffs of the changes: (+7 -0) Index: llvm/test/Regression/Linker/2003-10-21-ConflictingTypesTolerance.ll diff -c /dev/null llvm/test/Regression/Linker/2003-10-21-ConflictingTypesTolerance.ll:1.1 *** /dev/null Tue Oct 21 17:46:32 2003 --- llvm/test/Regression/Linker/2003-10-21-ConflictingTypesTolerance.ll Tue Oct 21 17:46:22 2003 *************** *** 0 **** --- 1,7 ---- + ; RUN: llvm-as < %s > %t.out1.bc + ; RUN: echo "%S = type [8 x int] external global %S " | llvm-as > %t.out2.bc + ; RUN: llvm-link %t.out[12].bc | llvm-dis | grep %S | grep '{' + + %S = type { int } + + From criswell at cs.uiuc.edu Tue Oct 21 17:57:01 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Tue Oct 21 17:57:01 2003 Subject: [llvm-commits] CVS: llvm/test/QMTest/expectations.qmr llvm.py Message-ID: <200310212256.RAA12487@choi.cs.uiuc.edu> Changes in directory llvm/test/QMTest: expectations.qmr updated: 1.1 -> 1.2 llvm.py updated: 1.20 -> 1.21 --- Log message: Updated the expectations to better match the results on Solaris. Modified the LLI Tests so that they use distinct output filenames. --- Diffs of the changes: (+2 -2) Index: llvm/test/QMTest/expectations.qmr diff -u llvm/test/QMTest/expectations.qmr:1.1 llvm/test/QMTest/expectations.qmr:1.2 --- llvm/test/QMTest/expectations.qmr:1.1 Tue Oct 7 16:30:22 2003 +++ llvm/test/QMTest/expectations.qmr Tue Oct 21 17:56:07 2003 @@ -3,13 +3,13 @@ qoq}q(U _Result__kindqUtestqU_Result__outcomeqUPASSqU_Result__annotationsq}U _Result__idq U0Regression.Assembler.2002-08-16-ConstExprInlinedq U_Result__contextq (cqm.test.context Context -q o}q (U_Context__propertiesq}U_Context__temporariesq}ubub.(hoq}q(hhhhh}h U%Regression.Transforms.InstCombine.addqh (h o}q(h}h}ubub.(hoq}q(hhhhh}h U/Regression.CBackend.2002-08-19-HardConstantExprqh (h o}q(h}h}ubub.(hoq}q(hhhhh}h URegression.Jello.test-shiftqh (h o}q(h}h}ubub.(hoq}q(hhhUFAILqh}h U.Regression.Transforms.CorrelatedExprs.looptestqh (h o}q (h}h}ubub.(hoq!}q"(hhhhh}h U-Regression.Linker.2003-08-23-GlobalVarLinkingq#h (h o}q$(h}h}ubub.(hoq%}q&(hhhhh}h U?Regression.Transforms.Inline.2003-09-22-PHINodesInExceptionDestq'h (h o}q((h}h}ubub.(hoq)}q*(hhhhh}h U,Regression.CFrontend.2003-02-12-NonlocalGotoq+h (h o}q,(h}h}ubub.(hoq-}q.(hhhhh}h U2Regression.Transforms.FunctionResolve.retmismatch1q/h (h o}q0(h}h}ubub.(hoq1}q2(hhhhh}h U>Regression.Transforms.LevelRaise.2002-05-02-BadCastEliminationq3h (h o}q4(h}h}ubub.(hoq5}q6(hhhhh}h U8Regression.Transforms.ADCE.2003-01-22-Pre! decessorProblemq7h (h o}q8(h}h}ubub.(hoq9}q:(hhhhh}h U=Regression.Transforms.LevelRaise.2002-10-08-VarArgCallInfLoopq;h (h o}q<(h}h}ubub.(hoq=}q>(hhhhh}h U5Regression.CFrontend.2003-07-22-ArrayAccessTypeSafetyq?h (h o}q@(h}h}ubub.(hoqA}qB(hhhhh}h U8Regression.C++Frontend.2003-09-29-ArgumentNumberMismatchqCh (h o}qD(h}h}ubub.(hoqE}qF(hhhhh}h U+Regression.CFrontend.2002-09-19-StarInLabelqGh (h o}qH(h}h}ubub.(hoqI}qJ(hhhhh}h U.Regression.CFrontend.2003-08-23-LocalUnionTestqKh (h o}qL(h}h}ubub.(hoqM}qN(hhhhh}h U/Regression.Linker.2003-04-26-NullPtrLinkProblemqOh (h o}qP(h}h}ubub.(hoqQ}qR(hhhhh}h U)Regression.Transforms.Reassociate.subtestqSh (h o}qT(h}h}ubub.(hoqU}qV(hhhhh}h U)Regression.Linker.2002-08-20-ConstantExprqWh (h o}qX(h}h}ubub.(hoqY}qZ(hhhhh}h U=Regression.Transforms.Reassociate.2002-05-15-AgressiveSubMoveq[h (h o}q\(h}h}ubub.(hoq]}q^(hhhhh}h UARegression.Transforms.CorrelatedExprs.2002-1! 0-07-DominatorProblemq_h (h o}q`(h}h}ubub.(hoqa}qb(hhhhh}h U3R egression.Transforms.PiNodeInserter.substitutetestqch (h o}qd(h}h}ubub.(hoqe}qf(hhhhh}h U%Regression.Transforms.InstCombine.andqgh (h o}qh(h}h}ubub.(hoqi}qj(hhhhh}h U-Regression.CFrontend.2002-02-18-64bitConstantqkh (h o}ql(h}h}ubub.(hoqm}qn(hhhhh}h U1Regression.Assembler.2002-04-04-PureVirtMethCall2qoh (h o}qp(h}h}ubub.(hoqq}qr(hhhhh}h U(Regression.Reoptimizer.BinInterface.testqsh (h o}qt(h}h}ubub.(hoqu}qv(hhhhh}h URegression.Transforms.CorrelatedExprs.2002-10-08-DominatorTestq?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h URegression.Linker.testlink2q?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h URegression.Linker.testlink1q?h (h o}q?(h}h}ubub.(hoq! ?}q?(hhhhh}h U4Regression.C++Frontend.2003-09-30-NestedFunctionDeclq?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U=Regression.Transforms.CorrelatedExprs.2002-09-23-PHIUpdateBugq?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U7Regression.Transforms.LowerSwitch.2003-05-01-PHIProblemq?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U2Regression.Transforms.ADCE.2003-09-15-InfLoopCrashq?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U4Regression.Transforms.SimplifyCFG.2002-06-24-PHINodeq?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U*Regression.Transforms.DSAnalysis.recursionq?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U)Regression.Jello.2003-01-15-AlignmentTestq?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U*Regression.CFrontend.2002-04-07-SwitchStmtq?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U!Regression.Jello.2003-01-10-FUCOMq?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U(Regression.CFrontend.2003-08-21-StmtExprq?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h URegression.LLC.badCa! llArgLRLLVMq?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U6Regression. Transforms.LevelRaise.2002-02-11-ArrayShapeq?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U1Regression.Assembler.2003-03-03-DuplicateConstantq?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U.Regression.Transforms.ModuloSched.arith-simpleq?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U/Regression.CBackend.2002-09-20-VarArgPrototypesq?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U)Regression.Other.2002-08-02-DomSetProblemq?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U6Regression.Assembler.2002-07-25-ParserAssertionFailureq?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U6Regression.Transforms.LevelRaise.2002-03-20-BadCodegenq?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U%Regression.Transforms.ADCE.basictest1q?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U$Regression.Transforms.InstCombine.orq?h (h o}q?(h}h}ubub.(hoq?}q?(hhhUPASSq?h}h U'Regression.Transforms.TailDup.basictestq?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U'Regression.Analysis.DSGraph.constantizeq?h (h o}q?(h}h}! ubub.(hoq?}q?(hhhhh}h U6Regression.Transforms.GlobalDCE.2002-08-17-FunctionDGEq?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U:Regression.Transforms.LICM.2003-02-26-LoopExitNotDominatedq?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U(Regression.Linker.2003-05-15-TypeProblemq?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U#Regression.Transforms.SCCP.sccptestq?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U2Regression.Transforms.FunctionResolve.retmismatch3q?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U=Regression.Transforms.CorrelatedExprs.2002-10-03-PHIPropogateq?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U(Regression.Transforms.PruneEH.simpletestr--------- \ No newline at end of file +q o}q (U_Context__propertiesq}U_Context__temporariesq}ubub.(hoq}q(hhhhh}h U(Regression.Transforms.PruneEH.simpletestqh (h o}q(h}h}ubub.(hoq}q(hhhhh}h U/Regression.CBackend.2002-08-19-HardConstantExprqh (h o}q(h}h}ubub.(hoq}q(hhhhh}h URegression.Jello.test-shiftqh (h o}q(h}h}ubub.(hoq}q(hhhUFAILqh}h U.Regression.Transforms.CorrelatedExprs.looptestqh (h o}q (h}h}ubub.(hoq!}q"(hhhhh}h U-Regression.Linker.2003-08-23-GlobalVarLinkingq#h (h o}q$(h}h}ubub.(hoq%}q&(hhhhh}h U?Regression.Transforms.Inline.2003-09-22-PHINodesInExceptionDestq'h (h o}q((h}h}ubub.(hoq)}q*(hhhhh}h U,Regression.CFrontend.2003-02-12-NonlocalGotoq+h (h o}q,(h}h}ubub.(hoq-}q.(hhhhh}h U2Regression.Transforms.FunctionResolve.retmismatch1q/h (h o}q0(h}h}ubub.(hoq1}q2(hhhhh}h U8Regression.Transforms.ADCE.2003-01-22-PredecessorProblemq3h (h o}q4(h}h}ubub.(hoq5}q6(hhhhh}h U=Regression.Transforms.LevelRaise.2002-10-08-! VarArgCallInfLoopq7h (h o}q8(h}h}ubub.(hoq9}q:(hhhhh}h U5Regression.CFrontend.2003-07-22-ArrayAccessTypeSafetyq;h (h o}q<(h}h}ubub.(hoq=}q>(hhhhh}h U8Regression.C++Frontend.2003-09-29-ArgumentNumberMismatchq?h (h o}q@(h}h}ubub.(hoqA}qB(hhhhh}h U+Regression.CFrontend.2002-09-19-StarInLabelqCh (h o}qD(h}h}ubub.(hoqE}qF(hhhhh}h U.Regression.CFrontend.2003-08-23-LocalUnionTestqGh (h o}qH(h}h}ubub.(hoqI}qJ(hhhhh}h U"Regression.Jello.2003-06-05-PHIBugqKh (h o}qL(h}h}ubub.(hoqM}qN(hhhhh}h U/Regression.Linker.2003-04-26-NullPtrLinkProblemqOh (h o}qP(h}h}ubub.(hoqQ}qR(hhhhh}h U)Regression.Transforms.Reassociate.subtestqSh (h o}qT(h}h}ubub.(hoqU}qV(hhhhh}h U)Regression.Linker.2002-08-20-ConstantExprqWh (h o}qX(h}h}ubub.(hoqY}qZ(hhhhh}h U=Regression.Transforms.Reassociate.2002-05-15-AgressiveSubMoveq[h (h o}q\(h}h}ubub.(hoq]}q^(hhhhh}h UARegression.Transforms.CorrelatedExprs.2002-10-07-DominatorProblemq_h ! (h o}q`(h}h}ubub.(hoqa}qb(hhhhh}h U3Regression.Transforms.PiNo deInserter.substitutetestqch (h o}qd(h}h}ubub.(hoqe}qf(hhhhh}h U4Regression.Transforms.SCCP.2003-08-26-InvokeHandlingqgh (h o}qh(h}h}ubub.(hoqi}qj(hhhhh}h U$Regression.Jello.2003-01-04-LoopTestqkh (h o}ql(h}h}ubub.(hoqm}qn(hhhhh}h U1Regression.Assembler.2002-04-04-PureVirtMethCall2qoh (h o}qp(h}h}ubub.(hoqq}qr(hhhhh}h U)Regression.CFrontend.2002-07-14-MiscTestsqsh (h o}qt(h}h}ubub.(hoqu}qv(hhhhh}h U Changes in directory llvm/test/Regression/Transforms/FunctionResolve: 2003-10-21-GlobalTypeDifference.ll added (r1.1) --- Log message: New testcase: globals should be linked if they are the wrong type. We should just moan loudly. --- Diffs of the changes: (+10 -0) Index: llvm/test/Regression/Transforms/FunctionResolve/2003-10-21-GlobalTypeDifference.ll diff -c /dev/null llvm/test/Regression/Transforms/FunctionResolve/2003-10-21-GlobalTypeDifference.ll:1.1 *** /dev/null Tue Oct 21 18:17:56 2003 --- llvm/test/Regression/Transforms/FunctionResolve/2003-10-21-GlobalTypeDifference.ll Tue Oct 21 18:17:45 2003 *************** *** 0 **** --- 1,10 ---- + ; RUN: llvm-as < %s | opt -funcresolve -disable-output 2>&1 | grep WARNING + + %X = external global int + %Z = global int* %X + + %X = global float 1.0 + %Y = global float* %X + + implementation + From lattner at cs.uiuc.edu Tue Oct 21 18:19:03 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 21 18:19:03 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/FunctionResolution.cpp Message-ID: <200310212318.SAA26064@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: FunctionResolution.cpp updated: 1.37 -> 1.38 --- Log message: Fix bug: FunctionResolve/2003-10-21-GlobalTypeDifference.ll --- Diffs of the changes: (+19 -55) Index: llvm/lib/Transforms/IPO/FunctionResolution.cpp diff -u llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.37 llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.38 --- llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.37 Mon Oct 20 14:43:18 2003 +++ llvm/lib/Transforms/IPO/FunctionResolution.cpp Tue Oct 21 18:17:56 2003 @@ -109,29 +109,15 @@ std::vector &Globals, GlobalVariable *Concrete) { bool Changed = false; - assert(isa(Concrete->getType()->getElementType()) && - "Concrete version should be an array type!"); - - // Get the type of the things that may be resolved to us... - const ArrayType *CATy =cast(Concrete->getType()->getElementType()); - const Type *AETy = CATy->getElementType(); - Constant *CCPR = ConstantPointerRef::get(Concrete); for (unsigned i = 0; i != Globals.size(); ++i) if (Globals[i] != Concrete) { - GlobalVariable *Old = cast(Globals[i]); - const ArrayType *OATy = cast(Old->getType()->getElementType()); - if (OATy->getElementType() != AETy || OATy->getNumElements() != 0) { - std::cerr << "WARNING: Two global variables exist with the same name " - << "that cannot be resolved!\n"; - return false; - } - - Old->replaceAllUsesWith(ConstantExpr::getCast(CCPR, Old->getType())); + Constant *Cast = ConstantExpr::getCast(CCPR, Globals[i]->getType()); + Globals[i]->replaceAllUsesWith(Cast); // Since there are no uses of Old anymore, remove it from the module. - M.getGlobalList().erase(Old); + M.getGlobalList().erase(cast(Globals[i])); ++NumGlobals; Changed = true; @@ -176,32 +162,15 @@ Concrete = F; } } else { - // For global variables, we have to merge C definitions int A[][4] with - // int[6][4]. A[][4] is represented as A[0][4] by the CFE. GlobalVariable *GV = cast(Globals[i]); - if (!isa(GV->getType()->getElementType())) { - Concrete = 0; - break; // Non array's cannot be compatible with other types. - } else if (Concrete == 0) { - Concrete = GV; - } else { - // Must have different types... allow merging A[0][4] w/ A[6][4] if - // A[0][4] is external. - const ArrayType *NAT = cast(GV->getType()->getElementType()); - const ArrayType *CAT = - cast(Concrete->getType()->getElementType()); - - if (NAT->getElementType() != CAT->getElementType()) { - Concrete = 0; // Non-compatible types - break; - } else if (NAT->getNumElements() == 0 && GV->isExternal()) { - // Concrete remains the same - } else if (CAT->getNumElements() == 0 && Concrete->isExternal()) { - Concrete = GV; // Concrete becomes GV - } else { - Concrete = 0; // Cannot merge these types... - break; + if (!GV->isExternal()) { + if (Concrete) { + std::cerr << "WARNING: Two global variables with external linkage" + << " exist with the same name: '" << GV->getName() + << "'!\n"; + return false; } + Concrete = GV; } } ++i; @@ -225,21 +194,15 @@ return false; // Nothing to do? Must have multiple internal definitions. - // We should find exactly one concrete function definition, which is - // probably the implementation. Change all of the function definitions and - // uses to use it instead. - // - if (!Concrete) { - std::cerr << "WARNING: Found global types that are not compatible:\n"; - for (unsigned i = 0; i < Globals.size(); ++i) { - std::cerr << "\t" << Globals[i]->getType()->getDescription() << " %" - << Globals[i]->getName() << "\n"; - } - std::cerr << " No linkage of globals named '" << Globals[0]->getName() - << "' performed!\n"; - return false; + std::cerr << "WARNING: Found global types that are not compatible:\n"; + for (unsigned i = 0; i < Globals.size(); ++i) { + std::cerr << "\t" << *Globals[i]->getType() << " %" + << Globals[i]->getName() << "\n"; } + if (!Concrete) + Concrete = Globals[0]; + if (isFunction) return ResolveFunctions(M, Globals, cast(Concrete)); else @@ -266,7 +229,8 @@ GlobalValue *GV = cast(PI->second); assert(PI->first == GV->getName() && "Global name and symbol table do not agree!"); - Globals[PI->first].push_back(GV); + if (!GV->hasInternalLinkage()) + Globals[PI->first].push_back(GV); } } From brukman at cs.uiuc.edu Tue Oct 21 19:27:02 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Tue Oct 21 19:27:02 2003 Subject: [llvm-commits] CVS: llvm-www/pubs/2002-06-AutomaticPoolAllocation.html 2002-08-08-CASES02-ControlC.html 2002-08-09-LLVMCompilationStrategy.html 2002-12-LattnerMSThesis.html 2003-04-29-DataStructureAnalysisTR.html 2003-05-01-GCCSummit2003.html 2003-05-05-LCTES03-CodeSafety.html 2003-09-30-LifelongOptimizationTR.html 2003-10-01-LLVA.html Message-ID: <200310220026.TAA00523@zion.cs.uiuc.edu> Changes in directory llvm-www/pubs: 2002-06-AutomaticPoolAllocation.html updated: 1.4 -> 1.5 2002-08-08-CASES02-ControlC.html updated: 1.7 -> 1.8 2002-08-09-LLVMCompilationStrategy.html updated: 1.5 -> 1.6 2002-12-LattnerMSThesis.html updated: 1.3 -> 1.4 2003-04-29-DataStructureAnalysisTR.html updated: 1.3 -> 1.4 2003-05-01-GCCSummit2003.html updated: 1.7 -> 1.8 2003-05-05-LCTES03-CodeSafety.html updated: 1.4 -> 1.5 2003-09-30-LifelongOptimizationTR.html updated: 1.2 -> 1.3 2003-10-01-LLVA.html updated: 1.3 -> 1.4 --- Log message: * Use

      s instead of explicit tags * Favor
      over
        for indent * Indent
      • within
          * Delete unnecessary space and {} within BibTeX entry --- Diffs of the changes: (+253 -243) Index: llvm-www/pubs/2002-06-AutomaticPoolAllocation.html diff -u llvm-www/pubs/2002-06-AutomaticPoolAllocation.html:1.4 llvm-www/pubs/2002-06-AutomaticPoolAllocation.html:1.5 --- llvm-www/pubs/2002-06-AutomaticPoolAllocation.html:1.4 Tue Oct 21 17:43:15 2003 +++ llvm-www/pubs/2002-06-AutomaticPoolAllocation.html Tue Oct 21 19:26:00 2003 @@ -8,14 +8,13 @@ -


          Automatic Pool Allocation for Disjoint Data -Structures
          - Chris Lattner and - Vikram Adve - -

          - +
          +Automatic Pool Allocation for Disjoint Data Structures +
          +

          Abstract:

          @@ -36,29 +35,33 @@

          Published:

          - + Chris Lattner & Vikram Adve,
          + ACM SIGPLAN Workshop on Memory + System Performance (MSP), Berlin, Germany, June 2002.
          +

      Download:

      -

      Bibtex Entry:

      +

      BibTeX Entry:

       @InProceedings{LattnerAdve:MSP02,
      -    Author      = {Chris Lattner and Vikram Adve},
      -    Title       = {{A}utomatic {P}ool {A}llocation for {D}isjoint {D}ata {S}tructures},
      -    Booktitle   = {Proc. ACM SIGPLAN Workshop on Memory System Performance},
      -    Address     = {Berlin, Germany},
      -    Month       = {Jun},
      -    Year        = {2002}
      +  Author    = "{Chris Lattner and Vikram Adve}",
      +  Title     = "{Automatic Pool Allocation for Disjoint Data Structures}",
      +  Booktitle = "{Proc. ACM SIGPLAN Workshop on Memory System Performance}",
      +  Address   = "{Berlin, Germany}",
      +  Month     = {Jun},
      +  Year      = {2002}
       }
       
      Index: llvm-www/pubs/2002-08-08-CASES02-ControlC.html diff -u llvm-www/pubs/2002-08-08-CASES02-ControlC.html:1.7 llvm-www/pubs/2002-08-08-CASES02-ControlC.html:1.8 --- llvm-www/pubs/2002-08-08-CASES02-ControlC.html:1.7 Tue Oct 21 17:31:42 2003 +++ llvm-www/pubs/2002-08-08-CASES02-ControlC.html Tue Oct 21 19:26:00 2003 @@ -3,9 +3,9 @@ - Ensuring Code Safety Without Runtime Checks for Real-Time Control Systems + Ensuring Code Safety Without Runtime Checks for Real-Time Control + Systems -
      @@ -61,12 +61,12 @@ Runtime Checks for Real-Time Control Systems - Presentation (PPT)
    -

    Bibtex Entry:

    +

    BibTeX Entry:

       @inproceedings{KDA:LCTES03,
         Author    = {Sumant Kowshik, Dinakar Dhurjati and Vikram Adve},
    -    Title     = {{E}nsuring {C}ode {S}afety {W}ithout {R}untime {C}hecks for {R}eal-{T}ime {C}ontrol {S}ystems},
    -    Booktitle = {Proc. Int'l Conf. on Compilers Architecture and Synthesis for Embedded Systems, 2002},
    +    Title     = "{Ensuring Code Safety Without Runtime Checks for Real-Time Control Systems}",
    +    Booktitle = "{Proc. Int'l Conf. on Compilers Architecture and Synthesis for Embedded Systems, 2002}",
         Address   = {Grenoble, France},
         Month     = {Oct},
         Year      = {2002},
    
    
    Index: llvm-www/pubs/2002-08-09-LLVMCompilationStrategy.html
    diff -u llvm-www/pubs/2002-08-09-LLVMCompilationStrategy.html:1.5 llvm-www/pubs/2002-08-09-LLVMCompilationStrategy.html:1.6
    --- llvm-www/pubs/2002-08-09-LLVMCompilationStrategy.html:1.5	Tue Oct 21 17:43:15 2003
    +++ llvm-www/pubs/2002-08-09-LLVMCompilationStrategy.html	Tue Oct 21 19:26:00 2003
    @@ -7,17 +7,13 @@
     
     
     
    -


    - - +

    The LLVM Instruction Set and Compilation Strategy -
    - - - Chris Lattner and - Vikram Adve -

    - +
    +

    Abstract:

    @@ -31,50 +27,55 @@

    Published:

    -
      +
      "The LLVM Instruction Set and Compilation Strategy", - Chris Lattner & Vikram Adve
      - Technical Report #UIUCDCS-R-2002-2292, Computer Science Dept., Univ. of Illinois, Aug. 2002. -
    + Chris Lattner & Vikram Adve
    + Technical Report #UIUCDCS-R-2002-2292, Computer Science Dept., Univ. of + Illinois, Aug. 2002. +

    Update:

    -
      - Since this document was published, one significant change has been made - to LLVM: the GCC C front-end described in the document has been completely - rewritten from scratch. The new C front-end is based on the mainline GCC CVS - tree (what will become GCC 3.4), and expands type-safe LLVM code from the GCC - AST representation, instead of from the untyped GCC RTL representation.

      - - This change dramatically improved the quality of code generated and the - stability of the system as a whole.

      -

    - - +
    +

    + Since this document was published, one significant change has been + made to LLVM: the GCC C front-end described in the document has been + completely rewritten from scratch. The new C front-end is based on the + mainline GCC CVS tree (what will become GCC 3.4), and expands type-safe LLVM + code from the GCC AST representation, instead of from the untyped GCC RTL + representation. +

    +

    + This change dramatically improved the quality of code generated and the + stability of the system as a whole. +

    +

    Download:

    -

    Bibtex Entry:

    +

    BibTeX Entry:

    NOTE: This document has been superseded by LLVM: An Infrastructure for Multi-Stage -Optimization. If you want to cite a paper about LLVM, please cite it -instead.

    +Optimization. If you want to cite a paper about LLVM, please cite it +instead.

    -  @TechReport{LattnerAdve:LLVM:ISCS,
    -    Author      = {Chris Lattner and Vikram Adve},
    -    Title       = {The {LLVM} Instruction Set and Compilation Strategy},
    -    Institution = {Computer Science Dept.,
    -                   Univ. of Illinois at Urbana-Champaign},
    -    Number      = {UIUCDCS-R-2002-2292},
    -    Type        = {Tech. Report},
    -    Month       = {Aug},
    -    Year        = {2002}
    -  }
    + at TechReport{LattnerAdve:LLVM:ISCS,
    +  Author      = "{Chris Lattner and Vikram Adve}",
    +  Title       = "{The LLVM Instruction Set and Compilation Strategy}",
    +  Institution = "{CS Dept., Univ. of Illinois at Urbana-Champaign}",
    +  Number      = {UIUCDCS-R-2002-2292},
    +  Type        = {Tech. Report},
    +  Month       = {Aug},
    +  Year        = {2002}
    +}
     
    - + + Index: llvm-www/pubs/2002-12-LattnerMSThesis.html diff -u llvm-www/pubs/2002-12-LattnerMSThesis.html:1.3 llvm-www/pubs/2002-12-LattnerMSThesis.html:1.4 --- llvm-www/pubs/2002-12-LattnerMSThesis.html:1.3 Tue Oct 21 17:43:15 2003 +++ llvm-www/pubs/2002-12-LattnerMSThesis.html Tue Oct 21 19:26:00 2003 @@ -7,32 +7,33 @@ -


    - - +

    LLVM: An Infrastructure for Multi-Stage Optimization -
    - - Chris Lattner, M.S. Thesis -

    +
    +
    + Chris Lattner, M.S. Thesis +

    Abstract:

    +

    Modern programming languages and software engineering principles are causing increasing problems for compiler systems. Traditional approaches, which use a simple compile-link-execute model, are unable to provide adequate application performance under the demands of the new conditions. Traditional approaches to interprocedural and profile-driven compilation can provide the application performance needed, but require infeasible amounts of compilation time to build -the application.

    +the application.

    +

    This thesis presents LLVM, a design and implementation of a compiler infrastructure which supports a unique multi-stage optimization system. This system is designed to support extensive interprocedural and profile-driven optimizations, while being efficient enough for use in -commercial compiler systems.

    +commercial compiler systems.

    +

    The LLVM virtual instruction set is the glue that holds the system together. It is a low-level representation, but with high-level type information. This provides the benefits of a low-level representation (compact @@ -40,34 +41,38 @@ providing high-level information to support aggressive interprocedural optimizations at link- and post-link time. In particular, this system is designed to support optimization in the field, both at run-time and during -otherwise unused idle time on the machine.

    +otherwise unused idle time on the machine.

    +

    This thesis also describes an implementation of this compiler design, the LLVM compiler infrastructure, proving that the design is feasible. The LLVM compiler infrastructure is a maturing and efficient system, which we show is a good host for a variety of research. More information about LLVM can be found -on its web site at: http://llvm.cs.uiuc.edu/ +on its web site at: http://llvm.cs.uiuc.edu/

    Published:

    -
      - "LLVM: An Infrastructure for Multi-Stage Optimization", Chris Lattner.
      - Masters Thesis, Computer Science Dept., University of Illinois at - Urbana-Champaign, Dec. 2002. -
    +
    + "LLVM: An Infrastructure for Multi-Stage Optimization", Chris Lattner.
    + Masters Thesis, Computer Science Dept., University of Illinois at + Urbana-Champaign, Dec. 2002. +

    Download:

    -

    Bibtex Entry:

    +

    BibTeX Entry:

       @MastersThesis{Lattner:MSThesis02,
         author  = {Chris Lattner},
    -    title   = {{LLVM}: An Infrastructure for Multi-Stage Optimization},
    -    school  = {Computer Science Dept., University of Illinois at Urbana-Champaign},
    +    title   = "{LLVM: An Infrastructure for Multi-Stage Optimization}",
    +    school  = "{Computer Science Dept., University of Illinois at Urbana-Champaign}",
         year    = {2002},
         address = {Urbana, IL},
         month   = {Dec},
    @@ -75,4 +80,5 @@
       }
     
    - + + Index: llvm-www/pubs/2003-04-29-DataStructureAnalysisTR.html diff -u llvm-www/pubs/2003-04-29-DataStructureAnalysisTR.html:1.3 llvm-www/pubs/2003-04-29-DataStructureAnalysisTR.html:1.4 --- llvm-www/pubs/2003-04-29-DataStructureAnalysisTR.html:1.3 Tue Oct 21 17:43:15 2003 +++ llvm-www/pubs/2003-04-29-DataStructureAnalysisTR.html Tue Oct 21 19:26:00 2003 @@ -8,17 +8,13 @@ -


    - - - Data Structure Analysis:
    An Efficient Context-Sensitive Heap Analysis -

    - - +

    + Data Structure Analysis:
    An Efficient Context-Sensitive Heap Analysis +
    +

    Abstract:

    @@ -33,34 +29,35 @@ efficient and scalable enough for large programs. Measurements for 29 programs show that the algorithm is extremely fast, space-efficient, and scales almost linearly across 3 orders-of-magnitude of code size. -

    Published:

    -
      +
      "Data Structure Analysis: An Efficient Context-Sensitive Heap Analysis", - Chris Lattner & Vikram Adve
      - Technical Report #UIUCDCS-R-2003-2340, Computer Science Dept., Univ. of Illinois, Apr. 2003. -
    + Chris Lattner & Vikram Adve
    + Technical Report #UIUCDCS-R-2003-2340, Computer Science Dept., Univ. of + Illinois, Apr. 2003. +

    Update:

    -
      +
      This document was updated on September 15, 2003 to be more clear and precise. -
    +

    Download:

    -

    Bibtex Entry:

    +

    BibTeX Entry:

       @TechReport{LattnerAdve:DSA,
         Author      = {Chris Lattner and Vikram Adve},
    -    Title       = {Data Structure Analysis: An Efficient Context-Sensitive Heap Analysis},
    -    Institution = {Computer Science Dept.,
    -                   Univ. of Illinois at Urbana-Champaign},
    +    Title       = "{Data Structure Analysis: An Efficient Context-Sensitive Heap Analysis}",
    +    Institution = "{Computer Science Dept., Univ. of Illinois at Urbana-Champaign}",
         Number      = {UIUCDCS-R-2003-2340},
         Type        = {Tech. Report},
         Month       = {Apr},
    @@ -68,4 +65,5 @@
       }
     
    - + + Index: llvm-www/pubs/2003-05-01-GCCSummit2003.html diff -u llvm-www/pubs/2003-05-01-GCCSummit2003.html:1.7 llvm-www/pubs/2003-05-01-GCCSummit2003.html:1.8 --- llvm-www/pubs/2003-05-01-GCCSummit2003.html:1.7 Tue Oct 21 17:43:15 2003 +++ llvm-www/pubs/2003-05-01-GCCSummit2003.html Tue Oct 21 19:26:00 2003 @@ -7,14 +7,13 @@ -


    Architecture for a Next-Generation - GCC
    - Chris Lattner and - Vikram Adve - -

    - +
    + Architecture for a Next-Generation GCC +
    +

    Abstract:

    @@ -34,36 +33,42 @@

    Published:

    - +
    + "Architecture For a Next-Generation GCC", Chris Lattner & + Vikram Adve,
    + First Annual GCC Developers' + Summit, Ottawa, Canada, May 2003.
    +

    Download:

    Presentation: -

    Bibtex Entry:

    +

    BibTeX Entry:

    -  @inproceedings{LattnerAdve:GCCSummit03,
    -    Author = {Chris Lattner and Vikram Adve},
    -    Title = {{A}rchitecture for a {N}ext-{G}eneration {GCC}},
    -    Booktitle = {Proc. First Annual GCC Developers' Summit},
    -    Address = {Ottawa, Canada},
    -    Month = {May},
    -    Year = {2003},
    -    URL = {http://llvm.cs.uiuc.edu/pubs/2003-05-01-GCCSummit2003.html}
    +  @InProceedings{LattnerAdve:GCCSummit03,
    +    Author    = {Chris Lattner and Vikram Adve},
    +    Title     = "{Architecture for a Next-Generation GCC}",
    +    Booktitle = "{Proc. First Annual GCC Developers' Summit}",
    +    Address   = {Ottawa, Canada},
    +    Month     = {May},
    +    Year      = {2003},
    +    URL       = {http://llvm.cs.uiuc.edu/pubs/2003-05-01-GCCSummit2003.html}
       }
     
    - + + Index: llvm-www/pubs/2003-05-05-LCTES03-CodeSafety.html diff -u llvm-www/pubs/2003-05-05-LCTES03-CodeSafety.html:1.4 llvm-www/pubs/2003-05-05-LCTES03-CodeSafety.html:1.5 --- llvm-www/pubs/2003-05-05-LCTES03-CodeSafety.html:1.4 Tue Oct 21 17:43:15 2003 +++ llvm-www/pubs/2003-05-05-LCTES03-CodeSafety.html Tue Oct 21 19:26:00 2003 @@ -7,76 +7,71 @@ -


    Memory Safety Without Runtime Checks or Garbage Collection
    - Dinakar Dhurjati, Sumant Kowshik, - Vikram Adve and - Chris Lattner -

    - +
    + Memory Safety Without Runtime Checks or Garbage Collection +
    +
    + Dinakar Dhurjati, Sumant Kowshik, + Vikram Adve and + Chris Lattner +

    Abstract:

    Traditional approaches to enforcing memory safety of programs rely heavily on -runtime checks of memory accesses and on garbage collection, both of which -are unattractive for embedded applications. -The long-term goal of our work is to -enable 100% static enforcement of memory safety for embedded programs -through advanced compiler techniques and minimal semantic -restrictions on programs. -The key result of this paper is a compiler technique that ensures -memory safety of -dynamically allocated memory without programmer annotations, runtime -checks, or garbage collection, and works for a large subclass of type-safe -C programs. -The technique is based on a fully automatic pool allocation -(i.e., region-inference) -algorithm for C programs we developed previously, and it ensures safety of -dynamically allocated memory while retaining explicit deallocation of -individual objects within regions (to avoid garbage collection). -For a diverse set of embedded C programs -(and using a previous technique to avoid null pointer checks), -we show that we are able to -statically ensure the safety of pointer and dynamic memory usage -in all these programs. -We also describe some improvements over our previous work in static checking -of array accesses. -Overall, we achieve 100% static enforcement of memory safety -without new language syntax for a significant subclass of embedded C -programs, and the subclass is much broader if array bounds checks are ignored. - +runtime checks of memory accesses and on garbage collection, both of which are +unattractive for embedded applications. The long-term goal of our work is to +enable 100% static enforcement of memory safety for embedded programs through +advanced compiler techniques and minimal semantic restrictions on programs. The +key result of this paper is a compiler technique that ensures memory safety of +dynamically allocated memory without programmer annotations, runtime checks, +or garbage collection, and works for a large subclass of type-safe C +programs. The technique is based on a fully automatic pool allocation (i.e., +region-inference) algorithm for C programs we developed previously, and it +ensures safety of dynamically allocated memory while retaining explicit +deallocation of individual objects within regions (to avoid garbage collection). +For a diverse set of embedded C programs (and using a previous technique to +avoid null pointer checks), we show that we are able to statically ensure the +safety of pointer and dynamic memory usage in all these programs. We +also describe some improvements over our previous work in static checking of +array accesses. Overall, we achieve 100% static enforcement of memory safety +without new language syntax for a significant subclass of embedded C programs, +and the subclass is much broader if array bounds checks are ignored.

    Published:

    -
      - "Memory Safety Without Runtime Checks or Garbage Collection", Dinakar Dhurjati, Sumant Kowshik, Vikram Adve & - Chris Lattner,
      - LCTES 2003 - , San Diego, CA, June 2003.
      -
    +
    + "Memory Safety Without Runtime Checks or Garbage Collection", Dinakar + Dhurjati, Sumant Kowshik, Vikram Adve & Chris Lattner,
    + LCTES 2003, San + Diego, CA, June 2003.
    +

    Download:

    -

    Bibtex Entry:

    +

    BibTeX Entry:

    -  @inproceedings{DKAL:LCTES03,
    -    Author = {Dinakar Dhurjati, Sumant Kowshik, Vikram Adve and Chris Lattner},
    -    Title = {{M}emory {S}afety {W}ithout {R}untime {C}hecks or {G}arbage {C}ollection},
    -    Booktitle = {Proc. Languages Compilers and Tools for Embedded Systems 2003},
    -    Address = {San Diego, CA},
    -    Month = {June},
    -    Year = {2003},
    -    URL = {http://llvm.cs.uiuc.edu/pubs/2003-05-05-LCTES03-CodeSafety.html}
    +  @InProceedings{DKAL:LCTES03,
    +    Author    = {Dinakar Dhurjati, Sumant Kowshik, Vikram Adve and Chris Lattner},
    +    Title     = "{Memory Safety Without Runtime Checks or Garbage Collection}",
    +    Booktitle = "{Proc. Languages Compilers and Tools for Embedded Systems 2003}",
    +    Address   = {San Diego, CA},
    +    Month     = {June},
    +    Year      = {2003},
    +    URL       = {http://llvm.cs.uiuc.edu/pubs/2003-05-05-LCTES03-CodeSafety.html}
       }
     
    -

    Links:

    - +

    Links:

    SAFECode project - + + Index: llvm-www/pubs/2003-09-30-LifelongOptimizationTR.html diff -u llvm-www/pubs/2003-09-30-LifelongOptimizationTR.html:1.2 llvm-www/pubs/2003-09-30-LifelongOptimizationTR.html:1.3 --- llvm-www/pubs/2003-09-30-LifelongOptimizationTR.html:1.2 Tue Oct 21 17:43:15 2003 +++ llvm-www/pubs/2003-09-30-LifelongOptimizationTR.html Tue Oct 21 19:26:00 2003 @@ -8,25 +8,22 @@ -


    - - +

    LLVM: A Compilation Framework for
    - Lifelong Program Analysis & Transformation -

    - - - Chris Lattner and - Vikram Adve -

    + Lifelong Program Analysis & Transformation +
    +

    Abstract:

    This paper describes LLVM (Low Level Virtual Machine), a compiler framework designed to support transparent, lifelong program analysis and -transformation for arbitrary programs, by providing high-level information to -compiler transformations at compile-time, link-time, run-time, and offline. +transformation for arbitrary programs, by providing high-level information +to compiler transformations at compile-time, link-time, run-time, and offline. LLVM defines a common, low-level code representation in Static Single Assignment (SSA) form, with several novel features: a simple, language-independent type-system that exposes the primitives commonly used to implement high-level @@ -45,25 +42,28 @@

    Published:

    -
      - "LLVM: A Compilation Framework for Lifelong Program Analysis & Transformation", - Chris Lattner & Vikram Adve
      - Technical Report #UIUCDCS-R-2003-2380, Computer Science Dept., Univ. of Illinois, Sep. 2003. -
    +
    + "LLVM: A Compilation Framework for Lifelong Program Analysis & + Transformation", Chris Lattner & Vikram Adve
    + Technical Report #UIUCDCS-R-2003-2380, Computer Science Dept., Univ. of + Illinois, Sep. 2003. +

    Download:

    -

    Bibtex Entry:

    +

    BibTeX Entry:

       @TechReport{LattnerAdve:LifeLong,
         Author      = {Chris Lattner and Vikram Adve},
    -    Title       = {LLVM: A Compilation Framework for Lifelong Program Analysis & Transformation},
    -    Institution = {Computer Science Dept.,
    -                   Univ. of Illinois at Urbana-Champaign},
    +    Title       = "{LLVM: A Compilation Framework for Lifelong Program Analysis & Transformation}",
    +    Institution = "{Computer Science Dept., Univ. of Illinois at Urbana-Champaign}",
         Number      = {UIUCDCS-R-2003-2380},
         Type        = {Tech. Report},
         Month       = {Sep},
    @@ -71,4 +71,5 @@
       }
     
    - + + Index: llvm-www/pubs/2003-10-01-LLVA.html diff -u llvm-www/pubs/2003-10-01-LLVA.html:1.3 llvm-www/pubs/2003-10-01-LLVA.html:1.4 --- llvm-www/pubs/2003-10-01-LLVA.html:1.3 Tue Oct 21 17:43:15 2003 +++ llvm-www/pubs/2003-10-01-LLVA.html Tue Oct 21 19:26:00 2003 @@ -7,20 +7,16 @@ -


    - - +

    LLVA: A Low-level Virtual Instruction Set Architecture -
    - - +
    +

    Abstract:

    @@ -47,27 +43,32 @@

    Published:

    -
      - "LLVA: A Low-level Virtual Instruction Set Architecture", Vikram Adve, Chris Lattner, Michael Brukman, Anand Shukla, and Brian Gaeke.
      -Proceedings of the 36th annual ACM/IEEE international symposium on Microarchitecture (MICRO-36), San Diego, California, Dec. 2003. -
    +
    + "LLVA: A Low-level Virtual Instruction Set Architecture", Vikram Adve, Chris + Lattner, Michael Brukman, Anand Shukla, and Brian Gaeke.
    + Proceedings of the 36th annual ACM/IEEE international symposium on + Microarchitecture (MICRO-36), San Diego, California, Dec. 2003. +

    Download:

    -

    Bibtex Entry:

    +

    BibTeX Entry:

       @InProceedings{ALBSG:MICRO36,
         author    = {Vikram Adve and Chris Lattner and Michael Brukman and Anand Shukla and Brian Gaeke},
    -    title     = {{LLVA: A Low-level Virtual Instruction Set Architecture}},
    -    booktitle = {Proceedings of the 36th annual ACM/IEEE international symposium on Microarchitecture (MICRO-36)},
    -    address = {San Diego, California},
    -    month   = {Dec},
    -    year    = {2003}
    +    title     = "{LLVA: A Low-level Virtual Instruction Set Architecture}",
    +    booktitle = "{Proceedings of the 36th annual ACM/IEEE international symposium on Microarchitecture (MICRO-36)}",
    +    address   = {San Diego, California},
    +    month     = {Dec},
    +    year      = {2003}
       }
     
    - + + From brukman at cs.uiuc.edu Tue Oct 21 22:11:01 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Tue Oct 21 22:11:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86InstrBuilder.h Message-ID: <200310220310.WAA02362@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86InstrBuilder.h updated: 1.7 -> 1.8 --- Log message: Converted tabs to spaces. --- Diffs of the changes: (+1 -1) Index: llvm/lib/Target/X86/X86InstrBuilder.h diff -u llvm/lib/Target/X86/X86InstrBuilder.h:1.7 llvm/lib/Target/X86/X86InstrBuilder.h:1.8 --- llvm/lib/Target/X86/X86InstrBuilder.h:1.7 Tue Oct 21 10:17:13 2003 +++ llvm/lib/Target/X86/X86InstrBuilder.h Tue Oct 21 22:10:26 2003 @@ -65,7 +65,7 @@ /// inline const MachineInstrBuilder & addConstantPoolReference(const MachineInstrBuilder &MIB, unsigned CPI, - int Offset = 0) { + int Offset = 0) { return MIB.addConstantPoolIndex(CPI).addZImm(1).addReg(0).addSImm(Offset); } From brukman at cs.uiuc.edu Tue Oct 21 22:28:01 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Tue Oct 21 22:28:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Target/Sparc/PreSelection.cpp Message-ID: <200310220327.WAA04805@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/Sparc: PreSelection.cpp updated: 1.22 -> 1.23 --- Log message: * Fix order of #includes to follow style guide * It's no longer a BasicBlock pass: update comment on run() method * Fix placement of braces to be consistent * Delete extraneous whitespace --- Diffs of the changes: (+27 -39) Index: llvm/lib/Target/Sparc/PreSelection.cpp diff -u llvm/lib/Target/Sparc/PreSelection.cpp:1.22 llvm/lib/Target/Sparc/PreSelection.cpp:1.23 --- llvm/lib/Target/Sparc/PreSelection.cpp:1.22 Tue Oct 21 12:22:23 2003 +++ llvm/lib/Target/Sparc/PreSelection.cpp Tue Oct 21 22:27:45 2003 @@ -16,17 +16,17 @@ //===----------------------------------------------------------------------===// #include "SparcInternals.h" -#include "llvm/Target/TargetMachine.h" -#include "llvm/Target/TargetInstrInfo.h" -#include "llvm/Transforms/Scalar.h" -#include "llvm/Support/InstVisitor.h" -#include "llvm/Module.h" #include "llvm/Constants.h" #include "llvm/iMemory.h" #include "llvm/iPHINode.h" #include "llvm/iOther.h" #include "llvm/DerivedTypes.h" +#include "llvm/Module.h" #include "llvm/Pass.h" +#include "llvm/Support/InstVisitor.h" +#include "llvm/Target/TargetInstrInfo.h" +#include "llvm/Target/TargetMachine.h" +#include "llvm/Transforms/Scalar.h" #include namespace { @@ -53,7 +53,7 @@ PreSelection(const TargetMachine &T) : instrInfo(T.getInstrInfo()), TheModule(0) {} - // runOnBasicBlock - apply this pass to each BB + // run - apply this pass to the entire Module bool run(Module &M) { TheModule = &M; @@ -100,8 +100,7 @@ // getGlobalAddr(): Put address of a global into a v. register. -static GetElementPtrInst* getGlobalAddr(Value* ptr, Instruction& insertBefore) -{ +static GetElementPtrInst* getGlobalAddr(Value* ptr, Instruction& insertBefore) { if (isa(ptr)) ptr = cast(ptr)->getValue(); @@ -114,8 +113,7 @@ // Wrapper on Constant::classof to use in find_if :-( -inline static bool nonConstant(const Use& U) -{ +inline static bool nonConstant(const Use& U) { return ! isa(U); } @@ -180,24 +178,22 @@ if (CV == NULL) return; - if (ConstantExpr* CE = dyn_cast(CV)) - { // load-time constant: factor it out so we optimize as best we can - Instruction* computeConst = DecomposeConstantExpr(CE, insertBefore); - I.setOperand(opNum, computeConst); // replace expr operand with result - } - else if (instrInfo.ConstantTypeMustBeLoaded(CV)) - { // load address of constant into a register, then load the constant - GetElementPtrInst* gep = getGlobalAddr(getGlobalForConstant(CV), - insertBefore); - LoadInst* ldI = new LoadInst(gep, "loadConst", &insertBefore); - I.setOperand(opNum, ldI); // replace operand with copy in v.reg. - } - else if (instrInfo.ConstantMayNotFitInImmedField(CV, &I)) - { // put the constant into a virtual register using a cast - CastInst* castI = new CastInst(CV, CV->getType(), "copyConst", - &insertBefore); - I.setOperand(opNum, castI); // replace operand with copy in v.reg. - } + if (ConstantExpr* CE = dyn_cast(CV)) { + // load-time constant: factor it out so we optimize as best we can + Instruction* computeConst = DecomposeConstantExpr(CE, insertBefore); + I.setOperand(opNum, computeConst); // replace expr operand with result + } else if (instrInfo.ConstantTypeMustBeLoaded(CV)) { + // load address of constant into a register, then load the constant + GetElementPtrInst* gep = getGlobalAddr(getGlobalForConstant(CV), + insertBefore); + LoadInst* ldI = new LoadInst(gep, "loadConst", &insertBefore); + I.setOperand(opNum, ldI); // replace operand with copy in v.reg. + } else if (instrInfo.ConstantMayNotFitInImmedField(CV, &I)) { + // put the constant into a virtual register using a cast + CastInst* castI = new CastInst(CV, CV->getType(), "copyConst", + &insertBefore); + I.setOperand(opNum, castI); // replace operand with copy in v.reg. + } } // visitOperands() transforms individual operands of all instructions: @@ -232,17 +228,13 @@ // Common work for *all* instructions. This needs to be called explicitly // by other visit functions. -inline void -PreSelection::visitInstruction(Instruction &I) -{ +inline void PreSelection::visitInstruction(Instruction &I) { visitOperands(I); // Perform operand transformations } // GetElementPtr instructions: check if pointer is a global -void -PreSelection::visitGetElementPtrInst(GetElementPtrInst &I) -{ +void PreSelection::visitGetElementPtrInst(GetElementPtrInst &I) { Instruction* curI = &I; // Decompose multidimensional array references @@ -261,10 +253,7 @@ visitInstruction(*curI); } - -void -PreSelection::visitCallInst(CallInst &I) -{ +void PreSelection::visitCallInst(CallInst &I) { // Tell visitOperands to ignore the function name if this is a direct call. visitOperands(I, (/*firstOp=*/ I.getCalledFunction()? 1 : 0)); } @@ -277,4 +266,3 @@ Pass* createPreSelectionPass(TargetMachine &T) { return new PreSelection(T); } - From lattner at cs.uiuc.edu Tue Oct 21 22:36:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 21 22:36:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/FunctionResolution.cpp Message-ID: <200310220335.WAA09329@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: FunctionResolution.cpp updated: 1.38 -> 1.39 --- Log message: Implement FunctionResolve/2003-10-21-GlobalResolveHack.ll --- Diffs of the changes: (+34 -2) Index: llvm/lib/Transforms/IPO/FunctionResolution.cpp diff -u llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.38 llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.39 --- llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.38 Tue Oct 21 18:17:56 2003 +++ llvm/lib/Transforms/IPO/FunctionResolution.cpp Tue Oct 21 22:35:34 2003 @@ -25,6 +25,7 @@ #include "llvm/Pass.h" #include "llvm/iOther.h" #include "llvm/Constants.h" +#include "llvm/Target/TargetData.h" #include "llvm/Assembly/Writer.h" #include "Support/Statistic.h" #include @@ -34,6 +35,10 @@ Statistic<> NumGlobals("funcresolve", "Number of global variables resolved"); struct FunctionResolvingPass : public Pass { + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.addRequired(); + } + bool run(Module &M); }; RegisterOpt X("funcresolve", "Resolve Functions"); @@ -125,7 +130,7 @@ return Changed; } -static bool ProcessGlobalsWithSameName(Module &M, +static bool ProcessGlobalsWithSameName(Module &M, TargetData &TD, std::vector &Globals) { assert(!Globals.empty() && "Globals list shouldn't be empty here!"); @@ -202,6 +207,31 @@ if (!Concrete) Concrete = Globals[0]; + else if (GlobalVariable *GV = dyn_cast(Concrete)) { + // Handle special case hack to change globals if it will make their types + // happier in the long run. The situation we do this is intentionally + // extremely limited. + if (GV->use_empty() && GV->hasInitializer() && + GV->getInitializer()->isNullValue()) { + // Check to see if there is another (external) global with the same size + // and a non-empty use-list. If so, we will make IT be the real + // implementation. + unsigned TS = TD.getTypeSize(Concrete->getType()->getElementType()); + for (unsigned i = 0, e = Globals.size(); i != e; ++i) + if (Globals[i] != Concrete && !Globals[i]->use_empty() && + isa(Globals[i]) && + TD.getTypeSize(Globals[i]->getType()->getElementType()) == TS) { + // At this point we want to replace Concrete with Globals[i]. Make + // concrete external, and Globals[i] have an initializer. + GlobalVariable *NGV = cast(Globals[i]); + const Type *ElTy = NGV->getType()->getElementType(); + NGV->setInitializer(Constant::getNullValue(ElTy)); + cast(Concrete)->setInitializer(0); + Concrete = NGV; + break; + } + } + } if (isFunction) return ResolveFunctions(M, Globals, cast(Concrete)); @@ -236,12 +266,14 @@ bool Changed = false; + TargetData &TD = getAnalysis(); + // Now we have a list of all functions with a particular name. If there is // more than one entry in a list, merge the functions together. // for (std::map >::iterator I = Globals.begin(), E = Globals.end(); I != E; ++I) - Changed |= ProcessGlobalsWithSameName(M, I->second); + Changed |= ProcessGlobalsWithSameName(M, TD, I->second); // Now loop over all of the globals, checking to see if any are trivially // dead. If so, remove them now. From lattner at cs.uiuc.edu Tue Oct 21 22:36:11 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 21 22:36:11 2003 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/FunctionResolve/2003-10-21-GlobalResolveHack.ll Message-ID: <200310220335.WAA09273@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/FunctionResolve: 2003-10-21-GlobalResolveHack.ll added (r1.1) --- Log message: New testcase for fun hack that is absolutely necessary for the C++ stdlib. --- Diffs of the changes: (+14 -0) Index: llvm/test/Regression/Transforms/FunctionResolve/2003-10-21-GlobalResolveHack.ll diff -c /dev/null llvm/test/Regression/Transforms/FunctionResolve/2003-10-21-GlobalResolveHack.ll:1.1 *** /dev/null Tue Oct 21 22:35:28 2003 --- llvm/test/Regression/Transforms/FunctionResolve/2003-10-21-GlobalResolveHack.ll Tue Oct 21 22:35:18 2003 *************** *** 0 **** --- 1,14 ---- + ; This tests a hack put into place specifically for the C++ libstdc++ library. + ; It uses an ugly hack which is cleaned up by the funcresolve pass. + + ; RUN: llvm-as < %s | opt -funcresolve | llvm-dis | grep %X | grep '{' + + %X = external global { int } + %X = global [ 4 x sbyte ] zeroinitializer + + implementation + + int* %test() { + %P = getelementptr {int}* %X, long 0, ubyte 0 + ret int* %P + } From lattner at cs.uiuc.edu Tue Oct 21 22:41:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 21 22:41:02 2003 Subject: [llvm-commits] CVS: llvm/tools/extract/Makefile Message-ID: <200310220340.WAA10554@zion.cs.uiuc.edu> Changes in directory llvm/tools/extract: Makefile updated: 1.3 -> 1.4 --- Log message: New library needed --- Diffs of the changes: (+2 -2) Index: llvm/tools/extract/Makefile diff -u llvm/tools/extract/Makefile:1.3 llvm/tools/extract/Makefile:1.4 --- llvm/tools/extract/Makefile:1.3 Mon Oct 20 17:27:26 2003 +++ llvm/tools/extract/Makefile Tue Oct 21 22:40:33 2003 @@ -9,7 +9,7 @@ LEVEL = ../.. TOOLNAME = extract -USEDLIBS = bcreader bcwriter transforms.a ipo.a analysis.a transformutils.a \ - ipa.a vmcore support.a +USEDLIBS = bcreader bcwriter transforms.a ipo.a target.a analysis.a \ + transformutils.a ipa.a vmcore support.a include $(LEVEL)/Makefile.common From lattner at cs.uiuc.edu Tue Oct 21 23:43:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 21 23:43:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/FunctionResolution.cpp Message-ID: <200310220442.XAA23264@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: FunctionResolution.cpp updated: 1.39 -> 1.40 --- Log message: Loop over the module, not the symbol table. This makes the code handle unused external functions again --- Diffs of the changes: (+18 -21) Index: llvm/lib/Transforms/IPO/FunctionResolution.cpp diff -u llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.39 llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.40 --- llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.39 Tue Oct 21 22:35:34 2003 +++ llvm/lib/Transforms/IPO/FunctionResolution.cpp Tue Oct 21 23:42:20 2003 @@ -20,7 +20,6 @@ #include "llvm/Transforms/IPO.h" #include "llvm/Module.h" -#include "llvm/SymbolTable.h" #include "llvm/DerivedTypes.h" #include "llvm/Pass.h" #include "llvm/iOther.h" @@ -137,9 +136,6 @@ bool isFunction = isa(Globals[0]); // Is this group all functions? GlobalValue *Concrete = 0; // The most concrete implementation to resolve to - assert((isFunction ^ isa(Globals[0])) && - "Should either be function or gvar!"); - for (unsigned i = 0; i != Globals.size(); ) { if (isa(Globals[i]) != isFunction) { std::cerr << "WARNING: Found function and global variable with the " @@ -243,26 +239,27 @@ } bool FunctionResolvingPass::run(Module &M) { - SymbolTable &ST = M.getSymbolTable(); - std::map > Globals; - // Loop over the entries in the symbol table. If an entry is a func pointer, - // then add it to the Functions map. We do a two pass algorithm here to avoid - // problems with iterators getting invalidated if we did a one pass scheme. + // Loop over the globals, adding them to the Globals map. We use a two pass + // algorithm here to avoid problems with iterators getting invalidated if we + // did a one pass scheme. // - for (SymbolTable::iterator I = ST.begin(), E = ST.end(); I != E; ++I) - if (const PointerType *PT = dyn_cast(I->first)) { - SymbolTable::VarMap &Plane = I->second; - for (SymbolTable::type_iterator PI = Plane.begin(), PE = Plane.end(); - PI != PE; ++PI) { - GlobalValue *GV = cast(PI->second); - assert(PI->first == GV->getName() && - "Global name and symbol table do not agree!"); - if (!GV->hasInternalLinkage()) - Globals[PI->first].push_back(GV); - } - } + for (Module::iterator I = M.begin(), E = M.end(); I != E; ) { + Function *F = I++; + if (F->use_empty() && F->isExternal()) + M.getFunctionList().erase(F); + else if (!F->hasInternalLinkage() && !F->getName().empty()) + Globals[F->getName()].push_back(F); + } + + for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ) { + GlobalVariable *GV = I++; + if (GV->use_empty() && GV->isExternal()) + M.getGlobalList().erase(GV); + else if (!GV->hasInternalLinkage() && !GV->getName().empty()) + Globals[GV->getName()].push_back(GV); + } bool Changed = false; From lattner at cs.uiuc.edu Tue Oct 21 23:44:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 21 23:44:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/FunctionResolution.cpp Message-ID: <200310220443.XAA26967@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: FunctionResolution.cpp updated: 1.40 -> 1.41 --- Log message: Update the 'used' flag correctly --- Diffs of the changes: (+7 -6) Index: llvm/lib/Transforms/IPO/FunctionResolution.cpp diff -u llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.40 llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.41 --- llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.40 Tue Oct 21 23:42:20 2003 +++ llvm/lib/Transforms/IPO/FunctionResolution.cpp Tue Oct 21 23:43:18 2003 @@ -245,23 +245,24 @@ // algorithm here to avoid problems with iterators getting invalidated if we // did a one pass scheme. // + bool Changed = false; for (Module::iterator I = M.begin(), E = M.end(); I != E; ) { Function *F = I++; - if (F->use_empty() && F->isExternal()) + if (F->use_empty() && F->isExternal()) { M.getFunctionList().erase(F); - else if (!F->hasInternalLinkage() && !F->getName().empty()) + Changed = true; + } else if (!F->hasInternalLinkage() && !F->getName().empty()) Globals[F->getName()].push_back(F); } for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ) { GlobalVariable *GV = I++; - if (GV->use_empty() && GV->isExternal()) + if (GV->use_empty() && GV->isExternal()) { M.getGlobalList().erase(GV); - else if (!GV->hasInternalLinkage() && !GV->getName().empty()) + Changed = true; + } else if (!GV->hasInternalLinkage() && !GV->getName().empty()) Globals[GV->getName()].push_back(GV); } - - bool Changed = false; TargetData &TD = getAnalysis(); From brukman at cs.uiuc.edu Tue Oct 21 23:52:00 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Tue Oct 21 23:52:00 2003 Subject: [llvm-commits] CVS: llvm/lib/Target/Sparc/PreSelection.cpp Message-ID: <200310220451.XAA06827@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/Sparc: PreSelection.cpp updated: 1.23 -> 1.24 --- Log message: No, really, order the #includes correctly. --- Diffs of the changes: (+1 -1) Index: llvm/lib/Target/Sparc/PreSelection.cpp diff -u llvm/lib/Target/Sparc/PreSelection.cpp:1.23 llvm/lib/Target/Sparc/PreSelection.cpp:1.24 --- llvm/lib/Target/Sparc/PreSelection.cpp:1.23 Tue Oct 21 22:27:45 2003 +++ llvm/lib/Target/Sparc/PreSelection.cpp Tue Oct 21 23:51:36 2003 @@ -17,10 +17,10 @@ #include "SparcInternals.h" #include "llvm/Constants.h" +#include "llvm/DerivedTypes.h" #include "llvm/iMemory.h" #include "llvm/iPHINode.h" #include "llvm/iOther.h" -#include "llvm/DerivedTypes.h" #include "llvm/Module.h" #include "llvm/Pass.h" #include "llvm/Support/InstVisitor.h" From brukman at cs.uiuc.edu Tue Oct 21 23:56:00 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Tue Oct 21 23:56:00 2003 Subject: [llvm-commits] CVS: llvm/lib/Target/Sparc/SparcInstrSelection.cpp Message-ID: <200310220455.XAA08238@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/Sparc: SparcInstrSelection.cpp updated: 1.123 -> 1.124 --- Log message: Removed completely duplicated function comment (an identical one appears later). --- Diffs of the changes: (+0 -19) Index: llvm/lib/Target/Sparc/SparcInstrSelection.cpp diff -u llvm/lib/Target/Sparc/SparcInstrSelection.cpp:1.123 llvm/lib/Target/Sparc/SparcInstrSelection.cpp:1.124 --- llvm/lib/Target/Sparc/SparcInstrSelection.cpp:1.123 Tue Oct 21 07:28:27 2003 +++ llvm/lib/Target/Sparc/SparcInstrSelection.cpp Tue Oct 21 23:55:09 2003 @@ -40,25 +40,6 @@ } - -//--------------------------------------------------------------------------- -// Function: GetMemInstArgs -// -// Purpose: -// Get the pointer value and the index vector for a memory operation -// (GetElementPtr, Load, or Store). If all indices of the given memory -// operation are constant, fold in constant indices in a chain of -// preceding GetElementPtr instructions (if any), and return the -// pointer value of the first instruction in the chain. -// All folded instructions are marked so no code is generated for them. -// -// Return values: -// Returns the pointer Value to use. -// Returns the resulting IndexVector in idxVec. -// Returns true/false in allConstantIndices if all indices are/aren't const. -//--------------------------------------------------------------------------- - - //--------------------------------------------------------------------------- // Function: FoldGetElemChain // From brukman at cs.uiuc.edu Wed Oct 22 00:11:08 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Wed Oct 22 00:11:08 2003 Subject: [llvm-commits] CVS: llvm/lib/Target/Sparc/SparcInstrSelection.cpp Message-ID: <200310220510.AAA14870@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/Sparc: SparcInstrSelection.cpp updated: 1.124 -> 1.125 --- Log message: * Use instead of * Order #includes according to LLVM coding standards --- Diffs of the changes: (+12 -12) Index: llvm/lib/Target/Sparc/SparcInstrSelection.cpp diff -u llvm/lib/Target/Sparc/SparcInstrSelection.cpp:1.124 llvm/lib/Target/Sparc/SparcInstrSelection.cpp:1.125 --- llvm/lib/Target/Sparc/SparcInstrSelection.cpp:1.124 Tue Oct 21 23:55:09 2003 +++ llvm/lib/Target/Sparc/SparcInstrSelection.cpp Wed Oct 22 00:09:56 2003 @@ -11,26 +11,26 @@ // //===----------------------------------------------------------------------===// -#include "SparcInternals.h" #include "SparcInstrSelectionSupport.h" +#include "SparcInternals.h" #include "SparcRegClassInfo.h" -#include "llvm/CodeGen/InstrSelectionSupport.h" -#include "llvm/CodeGen/MachineInstrBuilder.h" -#include "llvm/CodeGen/MachineInstrAnnot.h" +#include "llvm/Constants.h" +#include "llvm/ConstantHandling.h" +#include "llvm/DerivedTypes.h" +#include "llvm/Instructions.h" +#include "llvm/Intrinsics.h" +#include "llvm/Module.h" #include "llvm/CodeGen/InstrForest.h" #include "llvm/CodeGen/InstrSelection.h" +#include "llvm/CodeGen/InstrSelectionSupport.h" +#include "llvm/CodeGen/MachineCodeForInstruction.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineFunctionInfo.h" -#include "llvm/CodeGen/MachineCodeForInstruction.h" -#include "llvm/DerivedTypes.h" -#include "llvm/Instructions.h" -#include "llvm/Module.h" -#include "llvm/Constants.h" -#include "llvm/ConstantHandling.h" -#include "llvm/Intrinsics.h" +#include "llvm/CodeGen/MachineInstrBuilder.h" +#include "llvm/CodeGen/MachineInstrAnnot.h" #include "Support/MathExtras.h" -#include #include +#include static inline void Add3OperandInstr(unsigned Opcode, InstructionNode* Node, std::vector& mvec) { From brukman at cs.uiuc.edu Wed Oct 22 00:51:01 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Wed Oct 22 00:51:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Target/Sparc/SparcInstrSelectionSupport.h Message-ID: <200310220550.AAA23698@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/Sparc: SparcInstrSelectionSupport.h updated: 1.11 -> 1.12 --- Log message: Add comments to describe what these functions actually do. --- Diffs of the changes: (+7 -0) Index: llvm/lib/Target/Sparc/SparcInstrSelectionSupport.h diff -u llvm/lib/Target/Sparc/SparcInstrSelectionSupport.h:1.11 llvm/lib/Target/Sparc/SparcInstrSelectionSupport.h:1.12 --- llvm/lib/Target/Sparc/SparcInstrSelectionSupport.h:1.11 Tue Oct 21 10:17:13 2003 +++ llvm/lib/Target/Sparc/SparcInstrSelectionSupport.h Wed Oct 22 00:50:40 2003 @@ -17,6 +17,7 @@ #include "llvm/DerivedTypes.h" #include "SparcInternals.h" +// Choose load instruction opcode based on type of value inline MachineOpCode ChooseLoadInstruction(const Type *DestTy) { @@ -39,6 +40,7 @@ return 0; } +// Choose store instruction opcode based on type of value inline MachineOpCode ChooseStoreInstruction(const Type *DestTy) { @@ -86,6 +88,11 @@ } +// Because the Sparc instruction selector likes to re-write operands to +// instructions, making them change from a Value* (virtual register) to a +// Constant* (making an immediate field), we need to change the opcode from a +// register-based instruction to an immediate-based instruction, hence this +// mapping. static unsigned convertOpcodeFromRegToImm(unsigned Opcode) { switch (Opcode) { From criswell at cs.uiuc.edu Wed Oct 22 10:07:05 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed Oct 22 10:07:05 2003 Subject: [llvm-commits] CVS: llvm/docs/HowToSubmitABug.html Message-ID: <200310221506.KAA09379@choi.cs.uiuc.edu> Changes in directory llvm/docs: HowToSubmitABug.html updated: 1.6 -> 1.7 --- Log message: Added information on using Bugzilla. Removed information on using llvm-bugs to report bugs. --- Diffs of the changes: (+18 -4) Index: llvm/docs/HowToSubmitABug.html diff -u llvm/docs/HowToSubmitABug.html:1.6 llvm/docs/HowToSubmitABug.html:1.7 --- llvm/docs/HowToSubmitABug.html:1.6 Tue Oct 14 15:58:07 2003 +++ llvm/docs/HowToSubmitABug.html Wed Oct 22 10:06:11 2003 @@ -49,11 +49,25 @@ down the bug so that the person who fixes it will be able to find the problem more easily.

    -Once you have a reduced test-case, email information about the bug to: llvmbugs at cs.uiuc.edu. This should -include all of the information necessary to reproduce the problem, including -where you got the LLVM tree from (if you're not working out of CVS).

    +Once you have a reduced test-case, go to + +the LLVM Bug Tracking System, + +select the catagory in which the bug falls, and fill out the form with the +necessary details. The bug description should contain the following +information: +

      +
    • + All information necessary to reproduce the problem. +
    • + The reduced test-case that triggers the bug. + +
    • + The location where you obtained LLVM (if not from our CVS repository). +
    + +

    Thanks for helping us make LLVM better!

    From lattner at cs.uiuc.edu Wed Oct 22 11:04:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Oct 22 11:04:01 2003 Subject: [llvm-commits] CVS: llvm/include/llvm/Function.h Message-ID: <200310221603.LAA17837@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: Function.h updated: 1.46 -> 1.47 --- Log message: Add two new function stubs for viewing the CFG of a function inside of the debugger --- Diffs of the changes: (+15 -0) Index: llvm/include/llvm/Function.h diff -u llvm/include/llvm/Function.h:1.46 llvm/include/llvm/Function.h:1.47 --- llvm/include/llvm/Function.h:1.46 Mon Oct 20 15:19:14 2003 +++ llvm/include/llvm/Function.h Wed Oct 22 11:03:20 2003 @@ -183,6 +183,21 @@ virtual void print(std::ostream &OS) const; + /// viewCFG - This function is meant for use from the debugger. You can just + /// say 'call F->viewCFG()' and a ghostview window should pop up from the + /// program, displaying the CFG of the current function with the code for each + /// basic block inside. This depends on there being a 'dot' and 'gv' program + /// in your path. + /// + void viewCFG() const; + + /// viewCFGOnly - This function is meant for use from the debugger. It works + /// just like viewCFG, but it does not include the contents of basic blocks + /// into the nodes, just the label. If you are only interested in the CFG t + /// his can make the graph smaller. + /// + void viewCFGOnly() const; + /// Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const Function *) { return true; } static inline bool classof(const Value *V) { From lattner at cs.uiuc.edu Wed Oct 22 11:04:14 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Oct 22 11:04:14 2003 Subject: [llvm-commits] CVS: llvm/tools/analyze/GraphPrinters.cpp Message-ID: <200310221603.LAA17609@zion.cs.uiuc.edu> Changes in directory llvm/tools/analyze: GraphPrinters.cpp updated: 1.4 -> 1.5 --- Log message: Delete the -print-cfg pass from this file --- Diffs of the changes: (+2 -67) Index: llvm/tools/analyze/GraphPrinters.cpp diff -u llvm/tools/analyze/GraphPrinters.cpp:1.4 llvm/tools/analyze/GraphPrinters.cpp:1.5 --- llvm/tools/analyze/GraphPrinters.cpp:1.4 Mon Oct 20 12:55:44 2003 +++ llvm/tools/analyze/GraphPrinters.cpp Wed Oct 22 11:02:58 2003 @@ -16,55 +16,10 @@ #include "Support/GraphWriter.h" #include "llvm/Pass.h" -#include "llvm/iTerminators.h" +#include "llvm/Value.h" #include "llvm/Analysis/CallGraph.h" -#include "llvm/Support/CFG.h" -#include #include -//===----------------------------------------------------------------------===// -// Control Flow Graph Printer -//===----------------------------------------------------------------------===// - -template<> -struct DOTGraphTraits : public DefaultDOTGraphTraits { - static std::string getGraphName(Function *F) { - return "CFG for '" + F->getName() + "' function"; - } - - static std::string getNodeLabel(BasicBlock *Node, Function *Graph) { - std::ostringstream Out; - Out << Node; - std::string OutStr = Out.str(); - if (OutStr[0] == '\n') OutStr.erase(OutStr.begin()); - - // Process string output to make it nicer... - for (unsigned i = 0; i != OutStr.length(); ++i) - if (OutStr[i] == '\n') { // Left justify - OutStr[i] = '\\'; - OutStr.insert(OutStr.begin()+i+1, 'l'); - } else if (OutStr[i] == ';') { // Delete comments! - unsigned Idx = OutStr.find('\n', i+1); // Find end of line - OutStr.erase(OutStr.begin()+i, OutStr.begin()+Idx); - --i; - } - - return OutStr; - } - - static std::string getNodeAttributes(BasicBlock *N) { - return "fontname=Courier"; - } - - static std::string getEdgeSourceLabel(BasicBlock *Node, succ_iterator I) { - // Label source of conditional branches with "T" or "F" - if (BranchInst *BI = dyn_cast(Node->getTerminator())) - if (BI->isConditional()) - return (I == succ_begin(Node)) ? "T" : "F"; - return ""; - } -}; - template static void WriteGraphToFile(std::ostream &O, const std::string &GraphName, const GraphType >) { @@ -80,26 +35,6 @@ } -namespace { - struct CFGPrinter : public FunctionPass { - virtual bool runOnFunction(Function &Func) { - WriteGraphToFile(std::cerr, "cfg."+Func.getName(), &Func); - return false; - } - - void print(std::ostream &OS) const {} - - virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.setPreservesAll(); - } - }; - - RegisterAnalysis P1("print-cfg", - "Print CFG of function to 'dot' file"); -}; - - - //===----------------------------------------------------------------------===// // Call Graph Printer //===----------------------------------------------------------------------===// @@ -112,7 +47,7 @@ static std::string getNodeLabel(CallGraphNode *Node, CallGraph *Graph) { if (Node->getFunction()) - return Node->getFunction()->getName(); + return ((Value*)Node->getFunction())->getName(); else return "Indirect call node"; } From lattner at cs.uiuc.edu Wed Oct 22 11:05:06 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Oct 22 11:05:06 2003 Subject: [llvm-commits] CVS: llvm/lib/Analysis/CFGPrinter.cpp Message-ID: <200310221603.LAA18434@zion.cs.uiuc.edu> Changes in directory llvm/lib/Analysis: CFGPrinter.cpp added (r1.1) --- Log message: Implement the Function::viewCFG* methods, for use in a debugger. Also, the -print-cfg pass now lives here. --- Diffs of the changes: (+144 -0) Index: llvm/lib/Analysis/CFGPrinter.cpp diff -c /dev/null llvm/lib/Analysis/CFGPrinter.cpp:1.1 *** /dev/null Wed Oct 22 11:03:59 2003 --- llvm/lib/Analysis/CFGPrinter.cpp Wed Oct 22 11:03:49 2003 *************** *** 0 **** --- 1,144 ---- + //===- CFGPrinter.cpp - DOT printer for the control flow graph ------------===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by the LLVM research group and is distributed under + // the University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file defines a '-print-cfg' analysis pass, which emits the + // cfg..dot file for each function in the program, with a graph of the + // CFG for that function. + // + // The other main feature of this file is that it implements the + // Function::viewCFG method, which is useful for debugging passes which operate + // on the CFG. + // + //===----------------------------------------------------------------------===// + + #include "Support/GraphWriter.h" + #include "llvm/Pass.h" + #include "llvm/Function.h" + #include "llvm/iTerminators.h" + #include "llvm/Support/CFG.h" + #include + #include + + /// CFGOnly flag - This is used to control whether or not the CFG graph printer + /// prints out the contents of basic blocks or not. This is acceptable because + /// this code is only really used for debugging purposes. + /// + static bool CFGOnly = false; + + template<> + struct DOTGraphTraits : public DefaultDOTGraphTraits { + static std::string getGraphName(const Function *F) { + return "CFG for '" + F->getName() + "' function"; + } + + static std::string getNodeLabel(const BasicBlock *Node, + const Function *Graph) { + if (CFGOnly) return Node->getName() + ":"; + + std::ostringstream Out; + Out << *Node; + std::string OutStr = Out.str(); + if (OutStr[0] == '\n') OutStr.erase(OutStr.begin()); + + // Process string output to make it nicer... + for (unsigned i = 0; i != OutStr.length(); ++i) + if (OutStr[i] == '\n') { // Left justify + OutStr[i] = '\\'; + OutStr.insert(OutStr.begin()+i+1, 'l'); + } else if (OutStr[i] == ';') { // Delete comments! + unsigned Idx = OutStr.find('\n', i+1); // Find end of line + OutStr.erase(OutStr.begin()+i, OutStr.begin()+Idx); + --i; + } + + return OutStr; + } + + static std::string getNodeAttributes(const BasicBlock *N) { + return "fontname=Courier"; + } + + static std::string getEdgeSourceLabel(const BasicBlock *Node, + succ_const_iterator I) { + // Label source of conditional branches with "T" or "F" + if (const BranchInst *BI = dyn_cast(Node->getTerminator())) + if (BI->isConditional()) + return (I == succ_begin(Node)) ? "T" : "F"; + return ""; + } + }; + + namespace { + struct CFGPrinter : public FunctionPass { + virtual bool runOnFunction(Function &F) { + std::string Filename = "cfg." + F.getName() + ".dot"; + std::cerr << "Writing '" << Filename << "'..."; + std::ofstream File(Filename.c_str()); + + if (File.good()) + WriteGraph(File, (const Function*)&F); + else + std::cerr << " error opening file for writing!"; + std::cerr << "\n"; + return false; + } + + void print(std::ostream &OS) const {} + + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.setPreservesAll(); + } + }; + + RegisterAnalysis P1("print-cfg", + "Print CFG of function to 'dot' file"); + }; + + + + + /// viewCFG - This function is meant for use from the debugger. You can just + /// say 'call F->viewCFG()' and a ghostview window should pop up from the + /// program, displaying the CFG of the current function. This depends on there + /// being a 'dot' and 'gv' program in your path. + /// + void Function::viewCFG() const { + std::string Filename = "/tmp/cfg." + getName() + ".dot"; + std::cerr << "Writing '" << Filename << "'... "; + std::ofstream F(Filename.c_str()); + + if (!F.good()) { + std::cerr << " error opening file for writing!\n"; + return; + } + + WriteGraph(F, this); + F.close(); + std::cerr << "\n"; + + std::cerr << "Running 'dot' program... " << std::flush; + if (system(("dot -Tps " + Filename + " > /tmp/cfg.tempgraph.ps").c_str())) { + std::cerr << "Error running dot: 'dot' not in path?\n"; + } else { + std::cerr << "\n"; + system("gv /tmp/cfg.tempgraph.ps"); + } + system(("rm " + Filename + " /tmp/cfg.tempgraph.ps").c_str()); + } + + /// viewCFGOnly - This function is meant for use from the debugger. It works + /// just like viewCFG, but it does not include the contents of basic blocks + /// into the nodes, just the label. If you are only interested in the CFG t + /// his can make the graph smaller. + /// + void Function::viewCFGOnly() const { + CFGOnly = true; + viewCFG(); + CFGOnly = false; + } From lattner at cs.uiuc.edu Wed Oct 22 11:23:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Oct 22 11:23:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Analysis/CFGPrinter.cpp Message-ID: <200310221622.LAA19942@zion.cs.uiuc.edu> Changes in directory llvm/lib/Analysis: CFGPrinter.cpp updated: 1.1 -> 1.2 --- Log message: If the basic block has no name, make sure to print the % number of it --- Diffs of the changes: (+7 -1) Index: llvm/lib/Analysis/CFGPrinter.cpp diff -u llvm/lib/Analysis/CFGPrinter.cpp:1.1 llvm/lib/Analysis/CFGPrinter.cpp:1.2 --- llvm/lib/Analysis/CFGPrinter.cpp:1.1 Wed Oct 22 11:03:49 2003 +++ llvm/lib/Analysis/CFGPrinter.cpp Wed Oct 22 11:22:42 2003 @@ -21,6 +21,7 @@ #include "llvm/Pass.h" #include "llvm/Function.h" #include "llvm/iTerminators.h" +#include "llvm/Assembly/Writer.h" #include "llvm/Support/CFG.h" #include #include @@ -39,9 +40,14 @@ static std::string getNodeLabel(const BasicBlock *Node, const Function *Graph) { - if (CFGOnly) return Node->getName() + ":"; + if (CFGOnly && !Node->getName().empty()) return Node->getName() + ":"; std::ostringstream Out; + if (CFGOnly) { + WriteAsOperand(Out, Node, false, true); + return Out.str(); + } + Out << *Node; std::string OutStr = Out.str(); if (OutStr[0] == '\n') OutStr.erase(OutStr.begin()); From lattner at cs.uiuc.edu Wed Oct 22 11:32:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Oct 22 11:32:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Analysis/CFGPrinter.cpp Message-ID: <200310221631.LAA20832@zion.cs.uiuc.edu> Changes in directory llvm/lib/Analysis: CFGPrinter.cpp updated: 1.2 -> 1.3 --- Log message: Make sure to print labels on nodes without names --- Diffs of the changes: (+7 -1) Index: llvm/lib/Analysis/CFGPrinter.cpp diff -u llvm/lib/Analysis/CFGPrinter.cpp:1.2 llvm/lib/Analysis/CFGPrinter.cpp:1.3 --- llvm/lib/Analysis/CFGPrinter.cpp:1.2 Wed Oct 22 11:22:42 2003 +++ llvm/lib/Analysis/CFGPrinter.cpp Wed Oct 22 11:30:58 2003 @@ -40,12 +40,18 @@ static std::string getNodeLabel(const BasicBlock *Node, const Function *Graph) { - if (CFGOnly && !Node->getName().empty()) return Node->getName() + ":"; + if (CFGOnly && !Node->getName().empty()) + return Node->getName() + ":"; std::ostringstream Out; if (CFGOnly) { WriteAsOperand(Out, Node, false, true); return Out.str(); + } + + if (Node->getName().empty()) { + WriteAsOperand(Out, Node, false, true); + Out << ":"; } Out << *Node; From lattner at cs.uiuc.edu Wed Oct 22 11:42:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Oct 22 11:42:02 2003 Subject: [llvm-commits] CVS: llvm/lib/Analysis/LoopInfo.cpp Message-ID: <200310221641.LAA22008@zion.cs.uiuc.edu> Changes in directory llvm/lib/Analysis: LoopInfo.cpp updated: 1.43 -> 1.44 --- Log message: Do not add unreachable code to a natural loop! --- Diffs of the changes: (+4 -1) Index: llvm/lib/Analysis/LoopInfo.cpp diff -u llvm/lib/Analysis/LoopInfo.cpp:1.43 llvm/lib/Analysis/LoopInfo.cpp:1.44 --- llvm/lib/Analysis/LoopInfo.cpp:1.43 Mon Oct 20 14:43:04 2003 +++ llvm/lib/Analysis/LoopInfo.cpp Wed Oct 22 11:41:21 2003 @@ -151,11 +151,14 @@ Loop *L = new Loop(BB); BBMap[BB] = L; + BasicBlock *EntryBlock = &BB->getParent()->getEntryBlock(); + while (!TodoStack.empty()) { // Process all the nodes in the loop BasicBlock *X = TodoStack.back(); TodoStack.pop_back(); - if (!L->contains(X)) { // As of yet unprocessed?? + if (!L->contains(X) && // As of yet unprocessed?? + DS.dominates(EntryBlock, X)) { // X is reachable from entry block? // Check to see if this block already belongs to a loop. If this occurs // then we have a case where a loop that is supposed to be a child of the // current loop was processed before the current loop. When this occurs, From brukman at cs.uiuc.edu Wed Oct 22 12:02:02 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Wed Oct 22 12:02:02 2003 Subject: [llvm-commits] CVS: llvm/docs/HowToSubmitABug.html Message-ID: <200310221701.MAA28399@zion.cs.uiuc.edu> Changes in directory llvm/docs: HowToSubmitABug.html updated: 1.7 -> 1.8 --- Log message: * Changed URL referring to zion to use llvm instead * Close

  • tags --- Diffs of the changes: (+5 -9) Index: llvm/docs/HowToSubmitABug.html diff -u llvm/docs/HowToSubmitABug.html:1.7 llvm/docs/HowToSubmitABug.html:1.8 --- llvm/docs/HowToSubmitABug.html:1.7 Wed Oct 22 10:06:11 2003 +++ llvm/docs/HowToSubmitABug.html Wed Oct 22 12:01:44 2003 @@ -50,21 +50,17 @@ more easily.

    Once you have a reduced test-case, go to - + the LLVM Bug Tracking System, select the catagory in which the bug falls, and fill out the form with the necessary details. The bug description should contain the following information:

      -
    • - All information necessary to reproduce the problem. - -
    • - The reduced test-case that triggers the bug. - -
    • - The location where you obtained LLVM (if not from our CVS repository). +
    • All information necessary to reproduce the problem.
    • +
    • The reduced test-case that triggers the bug.
    • +
    • The location where you obtained LLVM (if not from our CVS + repository).

    From gaeke at cs.uiuc.edu Wed Oct 22 12:27:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Wed Oct 22 12:27:01 2003 Subject: [llvm-commits] CVS: reopt/test/Regression/README.txt Message-ID: <200310221726.MAA21426@gally.cs.uiuc.edu> Changes in directory reopt/test/Regression: README.txt added (r1.1) --- Log message: Add plaintive cry for help :-) --- Diffs of the changes: (+8 -0) Index: reopt/test/Regression/README.txt diff -c /dev/null reopt/test/Regression/README.txt:1.1 *** /dev/null Wed Oct 22 12:26:33 2003 --- reopt/test/Regression/README.txt Wed Oct 22 12:26:22 2003 *************** *** 0 **** --- 1,8 ---- + + Wed Oct 22 12:24:41 CDT 2003 + + This directory contains a bunch of old programs that apparently had something + to do with testing various components of the Reoptimizer. They do not currently + get run or tested by any automated procedure. If you have any idea + what this stuff does, or how to use it, feel free to document it here. + From lattner at cs.uiuc.edu Wed Oct 22 12:28:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Oct 22 12:28:02 2003 Subject: [llvm-commits] CVS: llvm/test/QMTest/llvmdb.py Message-ID: <200310221727.MAA09791@neo.cs.uiuc.edu> Changes in directory llvm/test/QMTest: llvmdb.py updated: 1.8 -> 1.9 --- Log message: Reoptimizer tests are no more --- Diffs of the changes: (+0 -1) Index: llvm/test/QMTest/llvmdb.py diff -u llvm/test/QMTest/llvmdb.py:1.8 llvm/test/QMTest/llvmdb.py:1.9 --- llvm/test/QMTest/llvmdb.py:1.8 Tue Oct 21 09:36:46 2003 +++ llvm/test/QMTest/llvmdb.py Wed Oct 22 12:27:40 2003 @@ -43,7 +43,6 @@ 'Other':'llvm.TestRunner', 'TableGen':'llvm.TestRunner', 'Transforms':'llvm.TestRunner', - 'Reoptimizer':'llvm.TestRunner', 'Verifier':'llvm.VerifierTest'} class llvmdb (qm.test.database.Database): From lattner at cs.uiuc.edu Wed Oct 22 12:34:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Oct 22 12:34:01 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/SingleSource/UnitTests/2003-10-13-SwitchTest.c Message-ID: <200310221733.MAA31050@zion.cs.uiuc.edu> Changes in directory llvm/test/Programs/SingleSource/UnitTests: 2003-10-13-SwitchTest.c updated: 1.1 -> 1.2 --- Log message: Fix a stupid warning --- Diffs of the changes: (+1 -1) Index: llvm/test/Programs/SingleSource/UnitTests/2003-10-13-SwitchTest.c diff -u llvm/test/Programs/SingleSource/UnitTests/2003-10-13-SwitchTest.c:1.1 llvm/test/Programs/SingleSource/UnitTests/2003-10-13-SwitchTest.c:1.2 --- llvm/test/Programs/SingleSource/UnitTests/2003-10-13-SwitchTest.c:1.1 Mon Oct 13 15:31:28 2003 +++ llvm/test/Programs/SingleSource/UnitTests/2003-10-13-SwitchTest.c Wed Oct 22 12:33:41 2003 @@ -1,6 +1,6 @@ #include -int main(int argc) { +int main(int argc, const char **argv) { switch (argc) { default: printf("GOOD\n"); From gaeke at cs.uiuc.edu Wed Oct 22 12:52:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Wed Oct 22 12:52:01 2003 Subject: [llvm-commits] CVS: llvm/include/Config/strings.h Message-ID: <200310221751.MAA06627@zion.cs.uiuc.edu> Changes in directory llvm/include/Config: strings.h (r1.3) removed --- Log message: I think this file is not included by anything. --- Diffs of the changes: (+0 -0) From gaeke at cs.uiuc.edu Wed Oct 22 12:54:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Wed Oct 22 12:54:01 2003 Subject: [llvm-commits] CVS: llvm/autoconf/configure.ac Message-ID: <200310221753.MAA06651@zion.cs.uiuc.edu> Changes in directory llvm/autoconf: configure.ac updated: 1.44 -> 1.45 --- Log message: Do not check for strings.h. This is an old, old, old pre-C89 header that absolutely nothing should be using (and it looks like nothing IS using it). --- Diffs of the changes: (+1 -1) Index: llvm/autoconf/configure.ac diff -u llvm/autoconf/configure.ac:1.44 llvm/autoconf/configure.ac:1.45 --- llvm/autoconf/configure.ac:1.44 Thu Oct 16 11:12:04 2003 +++ llvm/autoconf/configure.ac Wed Oct 22 12:52:56 2003 @@ -430,7 +430,7 @@ AC_CHECK_HEADERS(assert.h fcntl.h limits.h sys/time.h unistd.h errno.h signal.h math.h) dnl Check for system specific header files -AC_CHECK_HEADERS(malloc.h strings.h sys/mman.h sys/resource.h) +AC_CHECK_HEADERS(malloc.h sys/mman.h sys/resource.h) dnl Check for header files associated with dlopen and friends AC_CHECK_HEADERS(dlfcn.h link.h) From lattner at cs.uiuc.edu Wed Oct 22 13:10:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Oct 22 13:10:02 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/SingleSource/UnitTests/2003-05-26-Shorts.c Message-ID: <200310221809.NAA06531@zion.cs.uiuc.edu> Changes in directory llvm/test/Programs/SingleSource/UnitTests: 2003-05-26-Shorts.c updated: 1.4 -> 1.5 --- Log message: Make code fit in 80 columns --- Diffs of the changes: (+6 -6) Index: llvm/test/Programs/SingleSource/UnitTests/2003-05-26-Shorts.c diff -u llvm/test/Programs/SingleSource/UnitTests/2003-05-26-Shorts.c:1.4 llvm/test/Programs/SingleSource/UnitTests/2003-05-26-Shorts.c:1.5 --- llvm/test/Programs/SingleSource/UnitTests/2003-05-26-Shorts.c:1.4 Thu Jul 10 14:08:43 2003 +++ llvm/test/Programs/SingleSource/UnitTests/2003-05-26-Shorts.c Wed Oct 22 13:09:26 2003 @@ -27,10 +27,10 @@ unsigned short us = (unsigned short) UL; /* 0xb8a3 = 47267 */ short s = (short) UL; /* 0xb8a3 = -18269 */ - unsigned char ub = (unsigned char) UL; /* 0xa3 = 163 */ - signed char b = ( signed char) UL; /* 0xa3 = -93 */ + unsigned char ub = (unsigned char) UL; /* 0xa3 = 163 */ + signed char b = ( signed char) UL; /* 0xa3 = -93 */ - printf(" ui = %u (0x%x)\t\tUL-ui = %lld (0x%llx)\n", ui, ui, UL-ui, UL-ui); + printf(" ui = %u (0x%x)\t\tUL-ui = %lld (0x%llx)\n", ui, ui, UL-ui, UL-ui); printf("ui*ui = %u (0x%x)\t UL/ui = %lld (0x%llx)\n\n", (unsigned int) ui*ui, (unsigned int) ui*ui, UL/ui, UL/ui); @@ -38,7 +38,7 @@ printf(" i* i = %d (0x%x)\tL/ i = %lld (0x%llx)\n\n", (int) i*i, (int) i*i, L/i, L/i); - printf("us = %u (0x%x)\t\tUL-us = %lld (0x%llx)\n", us, us, UL-us, UL-us); + printf("us = %u (0x%x)\t\tUL-us = %lld (0x%llx)\n", us, us, UL-us, UL-us); printf("us*us = %u (0x%x)\t UL/us = %lld (0x%llx)\n\n", (unsigned short) us*us, (unsigned short) us*us, UL/us, UL/us); @@ -46,11 +46,11 @@ printf(" s* s = %d (0x%x)\tL/ s = %lld (0x%llx)\n\n", (short) s*s, (short) s*s, L/s, L/s); - printf("ub = %u (0x%x)\t\tUL-ub = %lld (0x%llx)\n", ub, ub, UL-ub, UL-ub); + printf("ub = %u (0x%x)\t\tUL-ub = %lld (0x%llx)\n", ub, ub, UL-ub, UL-ub); printf("ub*ub = %u (0x%x)\t\tUL/ub = %lld (0x%llx)\n\n", (unsigned char) ub*ub, (unsigned char) ub*ub, UL/ub, UL/ub); - printf(" b = %d (0x%x)\t\tL-b = %lld (0x%llx)\n", b, b, L-b, L-b); + printf(" b = %d (0x%x)\t\tL-b = %lld (0x%llx)\n", b, b, L-b, L-b); printf(" b* b = %d (0x%x)\t\t\tL/b = %lld (0x%llx)\n\n", (signed char) b*b, (signed char) b*b, L/b, L/b); From gaeke at cs.uiuc.edu Wed Oct 22 13:20:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Wed Oct 22 13:20:01 2003 Subject: [llvm-commits] CVS: llvm/docs/ReleaseNotes.html Message-ID: <200310221819.NAA11314@zion.cs.uiuc.edu> Changes in directory llvm/docs: ReleaseNotes.html updated: 1.10 -> 1.11 --- Log message: Clarify our testing experience. --- Diffs of the changes: (+2 -1) Index: llvm/docs/ReleaseNotes.html diff -u llvm/docs/ReleaseNotes.html:1.10 llvm/docs/ReleaseNotes.html:1.11 --- llvm/docs/ReleaseNotes.html:1.10 Mon Oct 20 14:05:03 2003 +++ llvm/docs/ReleaseNotes.html Wed Oct 22 13:19:08 2003 @@ -113,7 +113,8 @@

      -LLVM has only been extensively tested on ia32-linux and sparc-solaris machines. +LLVM has only been extensively tested on Intel and AMD machines running Red +Hat Linux, and Sun UltraSPARC workstations running Solaris 8. The core LLVM infrastructure uses "autoconf" for portability, so hopefully we work on more platforms than that. However, it is extremely likely that we missed something. We welcome portability patches and error messages.

      From lattner at cs.uiuc.edu Wed Oct 22 13:54:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Oct 22 13:54:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Analysis/IPA/CallGraph.cpp Message-ID: <200310221853.NAA02662@zion.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/IPA: CallGraph.cpp updated: 1.27 -> 1.28 --- Log message: This is a disgusting hack that improves code substantially, by making callgraphSCC passes more effective. --- Diffs of the changes: (+122 -2) Index: llvm/lib/Analysis/IPA/CallGraph.cpp diff -u llvm/lib/Analysis/IPA/CallGraph.cpp:1.27 llvm/lib/Analysis/IPA/CallGraph.cpp:1.28 --- llvm/lib/Analysis/IPA/CallGraph.cpp:1.27 Mon Oct 20 14:43:07 2003 +++ llvm/lib/Analysis/IPA/CallGraph.cpp Wed Oct 22 13:53:31 2003 @@ -50,10 +50,129 @@ #include "llvm/iOther.h" #include "llvm/iTerminators.h" #include "Support/STLExtras.h" -#include static RegisterAnalysis X("callgraph", "Call Graph Construction"); +static const char * const KnownExternalFunctions[] = { + // Low-level system calls + "open", + "read", + "write", + "writev", + "lseek", + "poll", + "ioctl", + + // Low-level stdc library functions + "abort", + "getenv", + "putenv", + + // Standard IO functions + "printf", + "sprintf", + "fopen", + "freopen", + "fclose", + "fwrite", + "puts", + "fputs", + "getc", + "ungetc", + "putc", + "putchar", + "fread", + "fileno", + "ftell", + "fflush", + "fseek", + "fileno", + "ferror", + "feof", + "fdopen", + "__fxstat", + "setbuf", + "setbuffer", + "etlinebuf", + "setvbuf", + + // Memory functions + "malloc", + "free", + "realloc", + "calloc", + "memalign", + + // String functions + "atoi", + "memmove", + "memset", + "memchr", + "memcmp", + "strchr", + "strncpy", + "strncmp", + "strcmp", + "__strcoll_l", + "__strxfrm_l", + "__strftime_l", + "__strtol_l", + "__strtoul_l", + "__strtoll_l", + "__strtoull_l", + "__strtof_l", + "__strtod_l", + "__strtold_l", + + // Locale functions + "__uselocale", + "__newlocale", + "__freelocale", + "__duplocale", + "__nl_langinfo_l", + + // gettext functions used by libstdc++ + "gettext", + "dgettext", + "dcgettext", + "textdomain", + "bindtextdomain", + + // Random stuff + "__assert_fail", + "__errno_location", +}; + + +/// ExternalFunctionDoesntCallIntoProgram - This hack is used to indicate to the +/// call graph that the specified external function is _KNOWN_ to not call back +/// into the program. This is important, because otherwise functions which call +/// "printf" for example, end up in a great big SCC that goes from the function +/// through main. +/// +static bool ExternalFunctionDoesntCallIntoProgram(const std::string &Name) { + static std::vector Funcs; + + // First time this is called? + if (Funcs.empty()) { + // Add a whole bunch of functions which are often used... + Funcs.insert(Funcs.end(), KnownExternalFunctions, + KnownExternalFunctions+ + sizeof(KnownExternalFunctions)/sizeof(KnownExternalFunctions[0])); + // Sort the list for efficient access + std::sort(Funcs.begin(), Funcs.end()); + } + + // Binary search for the function name... + std::vector::iterator I = + std::lower_bound(Funcs.begin(), Funcs.end(), Name); + + // Found it? + return I != Funcs.end() && *I == Name; +} + + + // getNodeFor - Return the node for the specified function or create one if it // does not already exist. // @@ -86,7 +205,8 @@ // If this function is not defined in this translation unit, it could call // anything. - if (F->isExternal()) + if (F->isExternal() && !F->getIntrinsicID() && + !ExternalFunctionDoesntCallIntoProgram(F->getName())) Node->addCalledFunction(ExternalNode); // Loop over all of the users of the function... looking for callers... From gaeke at cs.uiuc.edu Wed Oct 22 15:24:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Wed Oct 22 15:24:01 2003 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp Message-ID: <200310222023.PAA32416@gally.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/RegAlloc: PhyRegAlloc.cpp updated: 1.119 -> 1.120 --- Log message: Doxygenify method comments. Try to improve method comments a little. Get rid of some excess whitespace; put braces on previous line when possible. Add stub for method to verify the work of saveState(). --- Diffs of the changes: (+154 -207) Index: llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp diff -u llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp:1.119 llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp:1.120 --- llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp:1.119 Mon Oct 20 14:43:16 2003 +++ llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp Wed Oct 22 15:22:53 2003 @@ -73,18 +73,13 @@ } - -//---------------------------------------------------------------------------- -// This method initially creates interference graphs (one in each reg class) -// and IGNodeList (one in each IG). The actual nodes will be pushed later. -//---------------------------------------------------------------------------- +/// Initialize interference graphs (one in each reg class) and IGNodeLists +/// (one in each IG). The actual nodes will be pushed later. +/// void PhyRegAlloc::createIGNodeListsAndIGs() { if (DEBUG_RA >= RA_DEBUG_LiveRanges) std::cerr << "Creating LR lists ...\n"; - // hash map iterator LiveRangeMapType::const_iterator HMI = LRI->getLiveRangeMap()->begin(); - - // hash map end LiveRangeMapType::const_iterator HMIEnd = LRI->getLiveRangeMap()->end(); for (; HMI != HMIEnd ; ++HMI ) { @@ -114,15 +109,12 @@ } -//---------------------------------------------------------------------------- -// This method will add all interferences at for a given instruction. -// Interference occurs only if the LR of Def (Inst or Arg) is of the same reg -// class as that of live var. The live var passed to this function is the -// LVset AFTER the instruction -//---------------------------------------------------------------------------- - -void PhyRegAlloc::addInterference(const Value *Def, - const ValueSet *LVSet, +/// Add all interferences for a given instruction. Interference occurs only +/// if the LR of Def (Inst or Arg) is of the same reg class as that of live +/// var. The live var passed to this function is the LVset AFTER the +/// instruction. +/// +void PhyRegAlloc::addInterference(const Value *Def, const ValueSet *LVSet, bool isCallInst) { ValueSet::const_iterator LIt = LVSet->begin(); @@ -153,13 +145,11 @@ } -//---------------------------------------------------------------------------- -// For a call instruction, this method sets the CallInterference flag in -// the LR of each variable live int the Live Variable Set live after the -// call instruction (except the return value of the call instruction - since -// the return value does not interfere with that call itself). -//---------------------------------------------------------------------------- - +/// For a call instruction, this method sets the CallInterference flag in +/// the LR of each variable live in the Live Variable Set live after the +/// call instruction (except the return value of the call instruction - since +/// the return value does not interfere with that call itself). +/// void PhyRegAlloc::setCallInterferences(const MachineInstr *MInst, const ValueSet *LVSetAft) { if (DEBUG_RA >= RA_DEBUG_Interference) @@ -211,14 +201,11 @@ } -//---------------------------------------------------------------------------- -// This method will walk thru code and create interferences in the IG of -// each RegClass. Also, this method calculates the spill cost of each -// Live Range (it is done in this method to save another pass over the code). -//---------------------------------------------------------------------------- - -void PhyRegAlloc::buildInterferenceGraphs() -{ +/// Create interferences in the IG of each RegClass, and calculate the spill +/// cost of each Live Range (it is done in this method to save another pass +/// over the code). +/// +void PhyRegAlloc::buildInterferenceGraphs() { if (DEBUG_RA >= RA_DEBUG_Interference) std::cerr << "Creating interference graphs ...\n"; @@ -242,7 +229,7 @@ const ValueSet &LVSetAI = LVI->getLiveVarSetAfterMInst(MInst, BB); bool isCallInst = TM.getInstrInfo().isCall(MInst->getOpCode()); - if (isCallInst ) { + if (isCallInst) { // set the isCallInterference flag of each live range which extends // across this call instruction. This information is used by graph // coloring algorithm to avoid allocating volatile colors to live ranges @@ -261,7 +248,10 @@ if (LR) LR->addSpillCost(BBLoopDepthCost); } - // if there are multiple defs in this instruction e.g. in SETX + // Mark all operands of pseudo-instructions as interfering with one + // another. This must be done because pseudo-instructions may be + // expanded to multiple instructions by the assembler, so all the + // operands must get distinct registers. if (TM.getInstrInfo().isPseudoInstr(MInst->getOpCode())) addInterf4PseudoInstr(MInst); @@ -285,13 +275,9 @@ } -//-------------------------------------------------------------------------- -// Pseudo-instructions may be expanded to multiple instructions by the -// assembler. Consequently, all the operands must get distinct registers. -// Therefore, we mark all operands of a pseudo-instruction as interfering -// with one another. -//-------------------------------------------------------------------------- - +/// Mark all operands of the given MachineInstr as interfering with one +/// another. +/// void PhyRegAlloc::addInterf4PseudoInstr(const MachineInstr *MInst) { bool setInterf = false; @@ -325,10 +311,8 @@ } -//---------------------------------------------------------------------------- -// This method adds interferences for incoming arguments to a function. -//---------------------------------------------------------------------------- - +/// Add interferences for incoming arguments to a function. +/// void PhyRegAlloc::addInterferencesForArgs() { // get the InSet of root BB const ValueSet &InSet = LVI->getInSetOfBB(&Fn->front()); @@ -338,68 +322,51 @@ addInterference(AI, &InSet, false); if (DEBUG_RA >= RA_DEBUG_Interference) - std::cerr << " - %% adding interference for argument " << RAV(AI) << "\n"; + std::cerr << " - %% adding interference for argument " << RAV(AI) << "\n"; } } -//---------------------------------------------------------------------------- -// This method is called after register allocation is complete to set the -// allocated registers in the machine code. This code will add register numbers -// to MachineOperands that contain a Value. Also it calls target specific -// methods to produce caller saving instructions. At the end, it adds all -// additional instructions produced by the register allocator to the -// instruction stream. -//---------------------------------------------------------------------------- - -//----------------------------- -// Utility functions used below -//----------------------------- -inline void -InsertBefore(MachineInstr* newMI, - MachineBasicBlock& MBB, - MachineBasicBlock::iterator& MII) -{ +/// The following are utility functions used solely by updateMachineCode and +/// the functions that it calls. They should probably be folded back into +/// updateMachineCode at some point. +/// + +// used by: updateMachineCode (1 time), PrependInstructions (1 time) +inline void InsertBefore(MachineInstr* newMI, MachineBasicBlock& MBB, + MachineBasicBlock::iterator& MII) { MII = MBB.insert(MII, newMI); ++MII; } -inline void -InsertAfter(MachineInstr* newMI, - MachineBasicBlock& MBB, - MachineBasicBlock::iterator& MII) -{ +// used by: AppendInstructions (1 time) +inline void InsertAfter(MachineInstr* newMI, MachineBasicBlock& MBB, + MachineBasicBlock::iterator& MII) { ++MII; // insert before the next instruction MII = MBB.insert(MII, newMI); } -inline void -DeleteInstruction(MachineBasicBlock& MBB, - MachineBasicBlock::iterator& MII) -{ +// used by: updateMachineCode (1 time) +inline void DeleteInstruction(MachineBasicBlock& MBB, + MachineBasicBlock::iterator& MII) { MII = MBB.erase(MII); } -inline void -SubstituteInPlace(MachineInstr* newMI, - MachineBasicBlock& MBB, - MachineBasicBlock::iterator MII) -{ +// used by: updateMachineCode (1 time) +inline void SubstituteInPlace(MachineInstr* newMI, MachineBasicBlock& MBB, + MachineBasicBlock::iterator MII) { *MII = newMI; } -inline void -PrependInstructions(std::vector &IBef, - MachineBasicBlock& MBB, - MachineBasicBlock::iterator& MII, - const std::string& msg) -{ - if (!IBef.empty()) - { +// used by: updateMachineCode (2 times) +inline void PrependInstructions(std::vector &IBef, + MachineBasicBlock& MBB, + MachineBasicBlock::iterator& MII, + const std::string& msg) { + if (!IBef.empty()) { MachineInstr* OrigMI = *MII; std::vector::iterator AdIt; - for (AdIt = IBef.begin(); AdIt != IBef.end() ; ++AdIt) - { + for (AdIt = IBef.begin(); AdIt != IBef.end() ; ++AdIt) { if (DEBUG_RA) { if (OrigMI) std::cerr << "For MInst:\n " << *OrigMI; std::cerr << msg << "PREPENDed instr:\n " << **AdIt << "\n"; @@ -409,18 +376,15 @@ } } -inline void -AppendInstructions(std::vector &IAft, - MachineBasicBlock& MBB, - MachineBasicBlock::iterator& MII, - const std::string& msg) -{ - if (!IAft.empty()) - { +// used by: updateMachineCode (1 time) +inline void AppendInstructions(std::vector &IAft, + MachineBasicBlock& MBB, + MachineBasicBlock::iterator& MII, + const std::string& msg) { + if (!IAft.empty()) { MachineInstr* OrigMI = *MII; std::vector::iterator AdIt; - for ( AdIt = IAft.begin(); AdIt != IAft.end() ; ++AdIt ) - { + for ( AdIt = IAft.begin(); AdIt != IAft.end() ; ++AdIt ) { if (DEBUG_RA) { if (OrigMI) std::cerr << "For MInst:\n " << *OrigMI; std::cerr << msg << "APPENDed instr:\n " << **AdIt << "\n"; @@ -430,6 +394,10 @@ } } +/// Set the registers for operands in the given MachineInstr, if a register was +/// successfully allocated. Return true if any of its operands has been marked +/// for spill. +/// bool PhyRegAlloc::markAllocatedRegs(MachineInstr* MInst) { bool instrNeedsSpills = false; @@ -437,12 +405,10 @@ // First, set the registers for operands in the machine instruction // if a register was successfully allocated. Do this first because we // will need to know which registers are already used by this instr'n. - for (unsigned OpNum=0; OpNum < MInst->getNumOperands(); ++OpNum) - { + for (unsigned OpNum=0; OpNum < MInst->getNumOperands(); ++OpNum) { MachineOperand& Op = MInst->getOperand(OpNum); if (Op.getType() == MachineOperand::MO_VirtualRegister || - Op.getType() == MachineOperand::MO_CCRegister) - { + Op.getType() == MachineOperand::MO_CCRegister) { const Value *const Val = Op.getVRegValue(); if (const LiveRange* LR = LRI->getLiveRangeForValue(Val)) { // Remember if any operand needs spilling @@ -460,9 +426,13 @@ return instrNeedsSpills; } +/// Mark allocated registers (using markAllocatedRegs()) on the instruction +/// that MII points to. Then, if it's a call instruction, insert caller-saving +/// code before and after it. Finally, insert spill code before and after it, +/// using insertCode4SpilledLR(). +/// void PhyRegAlloc::updateInstruction(MachineBasicBlock::iterator& MII, - MachineBasicBlock &MBB) -{ + MachineBasicBlock &MBB) { MachineInstr* MInst = *MII; unsigned Opcode = MInst->getOpCode(); @@ -493,12 +463,10 @@ // registers. This must be done even for call return instructions // since those are not handled by the special code above. if (instrNeedsSpills) - for (unsigned OpNum=0; OpNum < MInst->getNumOperands(); ++OpNum) - { + for (unsigned OpNum=0; OpNum < MInst->getNumOperands(); ++OpNum) { MachineOperand& Op = MInst->getOperand(OpNum); if (Op.getType() == MachineOperand::MO_VirtualRegister || - Op.getType() == MachineOperand::MO_CCRegister) - { + Op.getType() == MachineOperand::MO_CCRegister) { const Value* Val = Op.getVRegValue(); if (const LiveRange *LR = LRI->getLiveRangeForValue(Val)) if (LR->isMarkedForSpill()) @@ -507,6 +475,10 @@ } // for each operand } +/// Iterate over all the MachineBasicBlocks in the current function and set +/// the allocated registers for each instruction (using updateInstruction()), +/// after register allocation is complete. Then move code out of delay slots. +/// void PhyRegAlloc::updateMachineCode() { // Insert any instructions needed at method entry @@ -519,7 +491,6 @@ for (MachineFunction::iterator BBI = MF->begin(), BBE = MF->end(); BBI != BBE; ++BBI) { - MachineBasicBlock &MBB = *BBI; // Iterate over all machine instructions in BB and mark operands with @@ -546,8 +517,7 @@ for (MachineBasicBlock::iterator MII = MBB.begin(); MII != MBB.end(); ++MII) if (unsigned delaySlots = - TM.getInstrInfo().getNumDelaySlots((*MII)->getOpCode())) - { + TM.getInstrInfo().getNumDelaySlots((*MII)->getOpCode())) { MachineInstr *MInst = *MII, *DelaySlotMI = *(MII+1); // Check the 2 conditions above: @@ -562,8 +532,7 @@ (AddedInstrMap[DelaySlotMI].InstrnsBefore.size() > 0 || AddedInstrMap[DelaySlotMI].InstrnsAfter.size() > 0)); - if (cond1 || cond2) - { + if (cond1 || cond2) { assert((MInst->getOpCodeFlags() & AnnulFlag) == 0 && "FIXME: Moving an annulled delay slot instruction!"); assert(delaySlots==1 && @@ -646,15 +615,13 @@ } -//---------------------------------------------------------------------------- -// This method inserts spill code for AN operand whose LR was spilled. -// This method may be called several times for a single machine instruction -// if it contains many spilled operands. Each time it is called, it finds -// a register which is not live at that instruction and also which is not -// used by other spilled operands of the same instruction. Then it uses -// this register temporarily to accommodate the spilled value. -//---------------------------------------------------------------------------- - +/// Insert spill code for AN operand whose LR was spilled. May be called +/// repeatedly for a single MachineInstr if it has many spilled operands. On +/// each call, it finds a register which is not live at that instruction and +/// also which is not used by other spilled operands of the same +/// instruction. Then it uses this register temporarily to accommodate the +/// spilled value. +/// void PhyRegAlloc::insertCode4SpilledLR(const LiveRange *LR, MachineBasicBlock::iterator& MII, MachineBasicBlock &MBB, @@ -690,7 +657,7 @@ } #endif - MF->getInfo()->pushTempValue(MRI.getSpilledRegSize(RegType) ); + MF->getInfo()->pushTempValue(MRI.getSpilledRegSize(RegType)); std::vector MIBef, MIAft; std::vector AdIMid; @@ -716,8 +683,7 @@ // for the copy and not used across MInst. int scratchRegType = -1; int scratchReg = -1; - if (MRI.regTypeNeedsScratchReg(RegType, scratchRegType)) - { + if (MRI.regTypeNeedsScratchReg(RegType, scratchRegType)) { scratchReg = getUsableUniRegAtMI(scratchRegType, &LVSetBef, MInst, MIBef, MIAft); assert(scratchReg != MRI.getInvalidRegNum()); @@ -761,23 +727,15 @@ } -//---------------------------------------------------------------------------- -// This method inserts caller saving/restoring instructions before/after -// a call machine instruction. The caller saving/restoring instructions are -// inserted like: -// ** caller saving instructions -// other instructions inserted for the call by ColorCallArg -// CALL instruction -// other instructions inserted for the call ColorCallArg -// ** caller restoring instructions -//---------------------------------------------------------------------------- - +/// Insert caller saving/restoring instructions before/after a call machine +/// instruction (before or after any other instructions that were inserted for +/// the call). +/// void PhyRegAlloc::insertCallerSavingCode(std::vector &instrnsBefore, std::vector &instrnsAfter, MachineInstr *CallMI, - const BasicBlock *BB) -{ + const BasicBlock *BB) { assert(TM.getInstrInfo().isCall(CallMI->getOpCode())); // hash set to record which registers were saved/restored @@ -827,8 +785,8 @@ // LR can be null if it is a const since a const // doesn't have a dominating def - see Assumptions above - if( LR ) { - if(! LR->isMarkedForSpill()) { + if (LR) { + if (! LR->isMarkedForSpill()) { assert(LR->hasColor() && "LR is neither spilled nor colored?"); unsigned RCID = LR->getRegClassID(); unsigned Color = LR->getColor(); @@ -933,15 +891,11 @@ } -//---------------------------------------------------------------------------- -// We can use the following method to get a temporary register to be used -// BEFORE any given machine instruction. If there is a register available, -// this method will simply return that register and set MIBef = MIAft = NULL. -// Otherwise, it will return a register and MIAft and MIBef will contain -// two instructions used to free up this returned register. -// Returned register number is the UNIFIED register number -//---------------------------------------------------------------------------- - +/// Returns the unified register number of a temporary register to be used +/// BEFORE MInst. If no register is available, it will pick one and modify +/// MIBef and MIAft to contain instructions used to free up this returned +/// register. +/// int PhyRegAlloc::getUsableUniRegAtMI(const int RegType, const ValueSet *LVSetBef, MachineInstr *MInst, @@ -949,7 +903,7 @@ std::vector& MIAft) { RegClass* RC = getRegClassByID(MRI.getRegClassIDOfRegType(RegType)); - int RegU = getUnusedUniRegAtMI(RC, RegType, MInst, LVSetBef); + int RegU = getUnusedUniRegAtMI(RC, RegType, MInst, LVSetBef); if (RegU == -1) { // we couldn't find an unused register. Generate code to free up a reg by @@ -961,8 +915,7 @@ // Check if we need a scratch register to copy this register to memory. int scratchRegType = -1; - if (MRI.regTypeNeedsScratchReg(RegType, scratchRegType)) - { + if (MRI.regTypeNeedsScratchReg(RegType, scratchRegType)) { int scratchReg = getUsableUniRegAtMI(scratchRegType, LVSetBef, MInst, MIBef, MIAft); assert(scratchReg != MRI.getInvalidRegNum()); @@ -974,29 +927,23 @@ ScratchRegsUsed.insert(std::make_pair(MInst, scratchReg)); MRI.cpReg2RegMI(MIBef, RegU, scratchReg, RegType); MRI.cpReg2RegMI(MIAft, scratchReg, RegU, RegType); - } - else - { // the register can be copied directly to/from memory so do it. + } else { // the register can be copied directly to/from memory so do it. MRI.cpReg2MemMI(MIBef, RegU, MRI.getFramePointer(), TmpOff, RegType); MRI.cpMem2RegMI(MIAft, MRI.getFramePointer(), TmpOff, RegU, RegType); - } + } } return RegU; } -//---------------------------------------------------------------------------- -// This method is called to get a new unused register that can be used -// to accommodate a temporary value. This method may be called several times -// for a single machine instruction. Each time it is called, it finds a -// register which is not live at that instruction and also which is not used -// by other spilled operands of the same instruction. Return register number -// is relative to the register class, NOT the unified number. -//---------------------------------------------------------------------------- - -int PhyRegAlloc::getUnusedUniRegAtMI(RegClass *RC, - const int RegType, +/// Returns the register-class register number of a new unused register that +/// can be used to accommodate a temporary value. May be called repeatedly +/// for a single MachineInstr. On each call, it finds a register which is not +/// live at that instruction and which is not used by any spilled operands of +/// that instruction. +/// +int PhyRegAlloc::getUnusedUniRegAtMI(RegClass *RC, const int RegType, const MachineInstr *MInst, const ValueSet* LVSetBef) { RC->clearColorsUsed(); // Reset array @@ -1033,11 +980,9 @@ } -//---------------------------------------------------------------------------- -// Get any other register in a register class, other than what is used -// by operands of a machine instruction. Returns the unified reg number. -//---------------------------------------------------------------------------- - +/// Return the unified register number of a register in class RC which is not +/// used by any operands of MInst. +/// int PhyRegAlloc::getUniRegNotUsedByThisInst(RegClass *RC, const int RegType, const MachineInstr *MInst) { @@ -1054,12 +999,10 @@ } -//---------------------------------------------------------------------------- -// This method modifies the IsColorUsedArr of the register class passed to it. -// It sets the bits corresponding to the registers used by this machine -// instructions. Both explicit and implicit operands are set. -//---------------------------------------------------------------------------- - +/// Modify the IsColorUsedArr of register class RC, by setting the bits +/// corresponding to register RegNo. This is a helper method of +/// setRelRegsUsedByThisInst(). +/// static void markRegisterUsed(int RegNo, RegClass *RC, int RegType, const TargetRegInfo &TRI) { unsigned classId = 0; @@ -1069,13 +1012,13 @@ } void PhyRegAlloc::setRelRegsUsedByThisInst(RegClass *RC, int RegType, - const MachineInstr *MI) -{ + const MachineInstr *MI) { assert(OperandsColoredMap[MI] == true && "Illegal to call setRelRegsUsedByThisInst() until colored operands " "are marked for an instruction."); - // Add the registers already marked as used by the instruction. + // Add the registers already marked as used by the instruction. Both + // explicit and implicit operands are set. for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) if (MI->getOperand(i).hasAllocatedReg()) markRegisterUsed(MI->getOperand(i).getAllocatedRegNum(), RC, RegType,MRI); @@ -1103,13 +1046,11 @@ } -//---------------------------------------------------------------------------- -// If there are delay slots for an instruction, the instructions -// added after it must really go after the delayed instruction(s). -// So, we move the InstrAfter of that instruction to the -// corresponding delayed instruction using the following method. -//---------------------------------------------------------------------------- - +/// If there are delay slots for an instruction, the instructions added after +/// it must really go after the delayed instruction(s). So, we Move the +/// InstrAfter of that instruction to the corresponding delayed instruction +/// using the following method. +/// void PhyRegAlloc::move2DelayedInstr(const MachineInstr *OrigMI, const MachineInstr *DelayedMI) { @@ -1141,13 +1082,11 @@ } -//---------------------------------------------------------------------------- -// This method determines whether the suggested color of each live range -// is really usable, and then calls its setSuggestedColorUsable() method to -// record the answer. A suggested color is NOT usable when the suggested color -// is volatile AND when there are call interferences. -//---------------------------------------------------------------------------- - +/// Determine whether the suggested color of each live range is really usable, +/// and then call its setSuggestedColorUsable() method to record the answer. A +/// suggested color is NOT usable when the suggested color is volatile AND +/// when there are call interferences. +/// void PhyRegAlloc::markUnusableSugColors() { LiveRangeMapType::const_iterator HMI = (LRI->getLiveRangeMap())->begin(); @@ -1165,13 +1104,10 @@ } -//---------------------------------------------------------------------------- -// The following method will set the stack offsets of the live ranges that -// are decided to be spilled. This must be called just after coloring the -// LRs using the graph coloring algo. For each live range that is spilled, -// this method allocate a new spill position on the stack. -//---------------------------------------------------------------------------- - +/// For each live range that is spilled, allocates a new spill position on the +/// stack, and set the stack offsets of the live range that will be spilled to +/// that position. This must be called just after coloring the LRs. +/// void PhyRegAlloc::allocateStackSpace4SpilledLRs() { if (DEBUG_RA) std::cerr << "\nSetting LR stack offsets for spills...\n"; @@ -1235,8 +1171,11 @@ }; } -void PhyRegAlloc::saveState () -{ +/// Save the global register allocation decisions made by the register +/// allocator so that they can be accessed later (sort of like "poor man's +/// debug info"). +/// +void PhyRegAlloc::saveState () { std::vector state; unsigned Insn = 0; LiveRangeMapType::const_iterator HMIEnd = LRI->getLiveRangeMap ()->end (); @@ -1284,6 +1223,12 @@ FnAllocState[Fn] = S; } +/// Check the saved state filled in by saveState(), and abort if it looks +/// wrong. Only used when debugging. +/// +void PhyRegAlloc::verifySavedState () { + /// not yet implemented +} bool PhyRegAlloc::doFinalization (Module &M) { if (!SaveRegAllocState) @@ -1332,10 +1277,9 @@ } -//---------------------------------------------------------------------------- -// The entry point to Register Allocation -//---------------------------------------------------------------------------- - +/// Allocate registers for the machine code previously generated for F using +/// the graph-coloring algorithm. +/// bool PhyRegAlloc::runOnFunction (Function &F) { if (DEBUG_RA) std::cerr << "\n********* Function "<< F.getName () << " ***********\n"; @@ -1406,6 +1350,9 @@ // Save register allocation state for this function in a Constant. if (SaveRegAllocState) saveState(); + if (DEBUG_RA) { // Check our work. + verifySavedState (); + } // Now update the machine code with register names and add any // additional code inserted by the register allocator to the instruction From gaeke at cs.uiuc.edu Wed Oct 22 15:24:13 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Wed Oct 22 15:24:13 2003 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.h Message-ID: <200310222023.PAA32399@gally.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/RegAlloc: PhyRegAlloc.h updated: 1.55 -> 1.56 --- Log message: Add prototype for verifySavedState(). --- Diffs of the changes: (+1 -0) Index: llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.h diff -u llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.h:1.55 llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.h:1.56 --- llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.h:1.55 Tue Oct 21 10:17:13 2003 +++ llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.h Wed Oct 22 15:23:13 2003 @@ -121,6 +121,7 @@ void createIGNodeListsAndIGs(); void buildInterferenceGraphs(); void saveState(); + void verifySavedState(); void setCallInterferences(const MachineInstr *MI, const ValueSet *LVSetAft); From gaeke at cs.uiuc.edu Wed Oct 22 15:45:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Wed Oct 22 15:45:01 2003 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.h Message-ID: <200310222044.PAA26504@trinity.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/RegAlloc: PhyRegAlloc.h updated: 1.56 -> 1.57 --- Log message: Change the type of FnAllocState. --- Diffs of the changes: (+1 -1) Index: llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.h diff -u llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.h:1.56 llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.h:1.57 --- llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.h:1.56 Wed Oct 22 15:23:13 2003 +++ llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.h Wed Oct 22 15:44:29 2003 @@ -85,7 +85,7 @@ AddedInstrns AddedInstrAtEntry; // to store instrns added at entry const LoopInfo *LoopDepthCalc; // to calculate loop depths - std::map FnAllocState; + std::map > FnAllocState; PhyRegAlloc(const PhyRegAlloc&); // DO NOT IMPLEMENT void operator=(const PhyRegAlloc&); // DO NOT IMPLEMENT From gaeke at cs.uiuc.edu Wed Oct 22 15:45:12 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Wed Oct 22 15:45:12 2003 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp Message-ID: <200310222044.PAA26488@trinity.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/RegAlloc: PhyRegAlloc.cpp updated: 1.120 -> 1.121 --- Log message: Don't worry about converting each function's reg. alloc. state into One Big Constant early on, because we can do it in doFinalization. Tighten up a comment. --- Diffs of the changes: (+21 -20) Index: llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp diff -u llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp:1.120 llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp:1.121 --- llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp:1.120 Wed Oct 22 15:22:53 2003 +++ llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp Wed Oct 22 15:44:23 2003 @@ -1176,7 +1176,7 @@ /// debug info"). /// void PhyRegAlloc::saveState () { - std::vector state; + std::vector &state = FnAllocState[Fn]; unsigned Insn = 0; LiveRangeMapType::const_iterator HMIEnd = LRI->getLiveRangeMap ()->end (); for (const_inst_iterator II=inst_begin (Fn), IE=inst_end (Fn); II != IE; ++II) @@ -1207,20 +1207,6 @@ state.push_back (AllocInfo (Insn, i, AllocState, Placement).toConstant ()); } - // Convert state into an LLVM ConstantArray, and put it in a - // ConstantStruct (named S) along with its size. - unsigned Size = state.size (); - ArrayType *AT = ArrayType::get (AllocInfo::getConstantType (), Size); - std::vector TV; - TV.push_back (Type::UIntTy); - TV.push_back (AT); - StructType *ST = StructType::get (TV); - std::vector CV; - CV.push_back (ConstantUInt::get (Type::UIntTy, Size)); - CV.push_back (ConstantArray::get (AT, state)); - Constant *S = ConstantStruct::get (ST, CV); - // Save S in the map containing register allocator state for this module. - FnAllocState[Fn] = S; } /// Check the saved state filled in by saveState(), and abort if it looks @@ -1248,10 +1234,26 @@ if (FnAllocState.find (F) == FnAllocState.end ()) { allstate.push_back (ConstantPointerNull::get (PT)); } else { + std::vector &state = FnAllocState[F]; + + // Convert state into an LLVM ConstantArray, and put it in a + // ConstantStruct (named S) along with its size. + unsigned Size = state.size (); + ArrayType *AT = ArrayType::get (AllocInfo::getConstantType (), Size); + std::vector TV; + TV.push_back (Type::UIntTy); + TV.push_back (AT); + StructType *ST = StructType::get (TV); + std::vector CV; + CV.push_back (ConstantUInt::get (Type::UIntTy, Size)); + CV.push_back (ConstantArray::get (AT, state)); + Constant *S = ConstantStruct::get (ST, CV); + GlobalVariable *GV = - new GlobalVariable (FnAllocState[F]->getType (), true, - GlobalValue::InternalLinkage, FnAllocState[F], + new GlobalVariable (ST, true, + GlobalValue::InternalLinkage, S, F->getName () + ".regAllocState", &M); + // Have: { uint, [Size x { uint, uint, uint, int }] } * // Cast it to: { uint, [0 x { uint, uint, uint, int }] } * Constant *CE = ConstantExpr::getCast (ConstantPointerRef::get (GV), PT); @@ -1354,9 +1356,8 @@ verifySavedState (); } - // Now update the machine code with register names and add any - // additional code inserted by the register allocator to the instruction - // stream + // Now update the machine code with register names and add any additional + // code inserted by the register allocator to the instruction stream. updateMachineCode(); if (DEBUG_RA) { From criswell at cs.uiuc.edu Wed Oct 22 16:53:01 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed Oct 22 16:53:01 2003 Subject: [llvm-commits] CVS: llvm/test/QMTest/expectations.qmr Message-ID: <200310222152.QAA26150@choi.cs.uiuc.edu> Changes in directory llvm/test/QMTest: expectations.qmr updated: 1.2 -> 1.3 --- Log message: Updated for current list of QMTest failures on x86 and Sparc. --- Diffs of the changes: (+1 -1) Index: llvm/test/QMTest/expectations.qmr diff -u llvm/test/QMTest/expectations.qmr:1.2 llvm/test/QMTest/expectations.qmr:1.3 --- llvm/test/QMTest/expectations.qmr:1.2 Tue Oct 21 17:56:07 2003 +++ llvm/test/QMTest/expectations.qmr Wed Oct 22 16:52:03 2003 @@ -3,13 +3,13 @@ qoq}q(U _Result__kindqUtestqU_Result__outcomeqUPASSqU_Result__annotationsq}U _Result__idq U0Regression.Assembler.2002-08-16-ConstExprInlinedq U_Result__contextq (cqm.test.context Context -q o}q (U_Context__propertiesq}U_Context__temporariesq}ubub.(hoq}q(hhhhh}h U(Regression.Transforms.PruneEH.simpletestqh (h o}q(h}h}ubub.(hoq}q(hhhhh}h U/Regression.CBackend.2002-08-19-HardConstantExprqh (h o}q(h}h}ubub.(hoq}q(hhhhh}h URegression.Jello.test-shiftqh (h o}q(h}h}ubub.(hoq}q(hhhUFAILqh}h U.Regression.Transforms.CorrelatedExprs.looptestqh (h o}q (h}h}ubub.(hoq!}q"(hhhhh}h U-Regression.Linker.2003-08-23-GlobalVarLinkingq#h (h o}q$(h}h}ubub.(hoq%}q&(hhhhh}h U?Regression.Transforms.Inline.2003-09-22-PHINodesInExceptionDestq'h (h o}q((h}h}ubub.(hoq)}q*(hhhhh}h U,Regression.CFrontend.2003-02-12-NonlocalGotoq+h (h o}q,(h}h}ubub.(hoq-}q.(hhhhh}h U2Regression.Transforms.FunctionResolve.retmismatch1q/h (h o}q0(h}h}ubub.(hoq1}q2(hhhhh}h U8Regression.Transforms.ADCE.2003-01-22-PredecessorProblemq3h (h o}q4(h}h}ubub.(hoq5}q6(hhhhh}h U=Regression.Transforms.LevelRaise.2002-10-08-! VarArgCallInfLoopq7h (h o}q8(h}h}ubub.(hoq9}q:(hhhhh}h U5Regression.CFrontend.2003-07-22-ArrayAccessTypeSafetyq;h (h o}q<(h}h}ubub.(hoq=}q>(hhhhh}h U8Regression.C++Frontend.2003-09-29-ArgumentNumberMismatchq?h (h o}q@(h}h}ubub.(hoqA}qB(hhhhh}h U+Regression.CFrontend.2002-09-19-StarInLabelqCh (h o}qD(h}h}ubub.(hoqE}qF(hhhhh}h U.Regression.CFrontend.2003-08-23-LocalUnionTestqGh (h o}qH(h}h}ubub.(hoqI}qJ(hhhhh}h U"Regression.Jello.2003-06-05-PHIBugqKh (h o}qL(h}h}ubub.(hoqM}qN(hhhhh}h U/Regression.Linker.2003-04-26-NullPtrLinkProblemqOh (h o}qP(h}h}ubub.(hoqQ}qR(hhhhh}h U)Regression.Transforms.Reassociate.subtestqSh (h o}qT(h}h}ubub.(hoqU}qV(hhhhh}h U)Regression.Linker.2002-08-20-ConstantExprqWh (h o}qX(h}h}ubub.(hoqY}qZ(hhhhh}h U=Regression.Transforms.Reassociate.2002-05-15-AgressiveSubMoveq[h (h o}q\(h}h}ubub.(hoq]}q^(hhhhh}h UARegression.Transforms.CorrelatedExprs.2002-10-07-DominatorProblemq_h ! (h o}q`(h}h}ubub.(hoqa}qb(hhhhh}h U3Regression.Transforms.PiNo deInserter.substitutetestqch (h o}qd(h}h}ubub.(hoqe}qf(hhhhh}h U4Regression.Transforms.SCCP.2003-08-26-InvokeHandlingqgh (h o}qh(h}h}ubub.(hoqi}qj(hhhhh}h U$Regression.Jello.2003-01-04-LoopTestqkh (h o}ql(h}h}ubub.(hoqm}qn(hhhhh}h U1Regression.Assembler.2002-04-04-PureVirtMethCall2qoh (h o}qp(h}h}ubub.(hoqq}qr(hhhhh}h U)Regression.CFrontend.2002-07-14-MiscTestsqsh (h o}qt(h}h}ubub.(hoqu}qv(hhhhh}h U(hhhhh}h U=Regression.Transforms.LevelRaise.2002-10-08-VarArgCallInfLoopq?h (h o}q@(h}h}ubub.(hoqA}qB(hhhhh}h U Regression.Reoptimizer.ticm.ticmqCh (h o}qD(h}h}ubub.(hoqE}qF(hhhhh}h U8Regression.C++Frontend.2003-09-29-ArgumentNumberMismatchqGh (h o}qH(h}h}ubub.(hoqI}qJ(hhhhh}h U+Regression.CFrontend.2002-09-19-StarInLabelqKh (h o}qL(h}h}ubub.(hoqM}qN(hhhhh}h U.Regression.CFrontend.2003-08-23-LocalUnionTestqOh (h o}qP(h}h}ubub.(hoqQ}qR(hhhhh}h U/Regression.Linker.2003-04-26-NullPtrLinkProblemqSh (h o}qT(h}h}ubub.(hoqU}qV(hhhhh}h U)Regression.Transforms.Reassociate.subtestqWh (h o}qX(h}h}ubub.(hoqY}qZ(hhhhh}h U)Regression.Linker.2002-08-20-ConstantExprq[h (h o}q\(h}h}ubub.(hoq]}q^(hhhhh}h U=Regression.Transforms.Reassociate.2002-05-15-AgressiveSubMoveq_h (h o}q`(h}h}ubub.! (hoqa}qb(hhhhh}h UARegression.Transforms.CorrelatedExprs.2002-10 -07-DominatorProblemqch (h o}qd(h}h}ubub.(hoqe}qf(hhhhh}h U3Regression.Transforms.PiNodeInserter.substitutetestqgh (h o}qh(h}h}ubub.(hoqi}qj(hhhhh}h U4Regression.Transforms.SCCP.2003-08-26-InvokeHandlingqkh (h o}ql(h}h}ubub.(hoqm}qn(hhhhh}h U-Regression.CFrontend.2002-02-18-64bitConstantqoh (h o}qp(h}h}ubub.(hoqq}qr(hhhhh}h U1Regression.Assembler.2002-04-04-PureVirtMethCall2qsh (h o}qt(h}h}ubub.(hoqu}qv(hhhhh}h U(Regression.Reoptimizer.BinInterface.testqwh (h o}qx(h}h}ubub.(hoqy}qz(hhhhh}h U Changes in directory llvm/test/Regression/Transforms/DeadArgElim: deadretval.ll added (r1.1) deadretval2.ll added (r1.1) --- Log message: New testcase for the deadreturnvalue deletion extension to -deadargelim --- Diffs of the changes: (+55 -0) Index: llvm/test/Regression/Transforms/DeadArgElim/deadretval.ll diff -c /dev/null llvm/test/Regression/Transforms/DeadArgElim/deadretval.ll:1.1 *** /dev/null Wed Oct 22 17:34:10 2003 --- llvm/test/Regression/Transforms/DeadArgElim/deadretval.ll Wed Oct 22 17:33:59 2003 *************** *** 0 **** --- 1,19 ---- + ; RUN: llvm-as < %s | opt -deadargelim | llvm-dis | not grep DEAD + + implementation + + internal int %test(int %DEADARG) { ; Dead arg only used by dead retval + ret int %DEADARG + } + + int %test2(int %A) { + %DEAD = call int %test(int %A) + ret int 123 + } + + int %test3() { + %X = call int %test2(int 3232) + %Y = add int %X, -123 + ret int %Y + } + Index: llvm/test/Regression/Transforms/DeadArgElim/deadretval2.ll diff -c /dev/null llvm/test/Regression/Transforms/DeadArgElim/deadretval2.ll:1.1 *** /dev/null Wed Oct 22 17:34:10 2003 --- llvm/test/Regression/Transforms/DeadArgElim/deadretval2.ll Wed Oct 22 17:33:59 2003 *************** *** 0 **** --- 1,36 ---- + ; RUN: llvm-as < %s | opt -deadargelim -die | llvm-dis | not grep DEAD + + %P = external global int + + implementation + + + internal int %test(int %DEADARG) { ; Dead arg only used by dead retval + ret int %DEADARG + } + + internal int %test2(int %DEADARG) { + %DEADRETVAL = call int %test(int %DEADARG) + ret int %DEADRETVAL + } + + void %test3(int %X) { + %DEADRETVAL = call int %test2(int %X) + ret void + } + + internal int %foo() { + %DEAD = load int* %P + ret int %DEAD + } + + internal int %id(int %X) { + ret int %X + } + + void %test4() { + %DEAD = call int %foo() + %DEAD2 = call int %id(int %DEAD) + ret void + } + From lattner at cs.uiuc.edu Wed Oct 22 18:04:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Oct 22 18:04:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/FunctionResolution.cpp Message-ID: <200310222303.SAA06849@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: FunctionResolution.cpp updated: 1.41 -> 1.42 --- Log message: This important patch fixes two warnings in the linker which can occur from linking valid pieces of code --- Diffs of the changes: (+33 -4) Index: llvm/lib/Transforms/IPO/FunctionResolution.cpp diff -u llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.41 llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.42 --- llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.41 Tue Oct 21 23:43:18 2003 +++ llvm/lib/Transforms/IPO/FunctionResolution.cpp Wed Oct 22 18:03:38 2003 @@ -194,11 +194,40 @@ if (!HasExternal && NumInstancesWithExternalLinkage <= 1) return false; // Nothing to do? Must have multiple internal definitions. + // There are a couple of special cases we don't want to print the warning + // for, check them now. + bool DontPrintWarning = false; + if (Concrete && Globals.size() == 2) { + GlobalValue *Other = Globals[Globals[0] == Concrete]; + // If the non-concrete global is a function which takes (...) arguments, + // and the return values match, do not warn. + if (Function *ConcreteF = dyn_cast(Concrete)) + if (Function *OtherF = dyn_cast(Other)) + if (ConcreteF->getReturnType() == OtherF->getReturnType() && + OtherF->getFunctionType()->isVarArg() && + OtherF->getFunctionType()->getParamTypes().empty()) + DontPrintWarning = true; + + // Otherwise, if the non-concrete global is a global array variable with a + // size of 0, and the concrete global is an array with a real size, don't + // warn. This occurs due to declaring 'extern int A[];'. + if (GlobalVariable *ConcreteGV = dyn_cast(Concrete)) + if (GlobalVariable *OtherGV = dyn_cast(Other)) + if (const ArrayType *OtherAT = + dyn_cast(OtherGV->getType()->getElementType())) + if (const ArrayType *ConcreteAT = + dyn_cast(ConcreteGV->getType()->getElementType())) + if (OtherAT->getElementType() == ConcreteAT->getElementType() && + OtherAT->getNumElements() == 0) + DontPrintWarning = true; + } - std::cerr << "WARNING: Found global types that are not compatible:\n"; - for (unsigned i = 0; i < Globals.size(); ++i) { - std::cerr << "\t" << *Globals[i]->getType() << " %" - << Globals[i]->getName() << "\n"; + if (!DontPrintWarning) { + std::cerr << "WARNING: Found global types that are not compatible:\n"; + for (unsigned i = 0; i < Globals.size(); ++i) { + std::cerr << "\t" << *Globals[i]->getType() << " %" + << Globals[i]->getName() << "\n"; + } } if (!Concrete) From brukman at cs.uiuc.edu Wed Oct 22 18:24:01 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Wed Oct 22 18:24:01 2003 Subject: [llvm-commits] CVS: llvm/docs/llvm.css Message-ID: <200310222323.SAA17681@zion.cs.uiuc.edu> Changes in directory llvm/docs: llvm.css added (r1.1) --- Log message: We will distributed this stylesheet with the documentation, as well as use it (via import) in the online version. * Added styles for documentation headers, sections, etc. --- Diffs of the changes: (+27 -0) Index: llvm/docs/llvm.css diff -c /dev/null llvm/docs/llvm.css:1.1 *** /dev/null Wed Oct 22 18:23:59 2003 --- llvm/docs/llvm.css Wed Oct 22 18:23:49 2003 *************** *** 0 **** --- 1,27 ---- + /* + * LLVM website style sheet + */ + + /* Common styles */ + .body { text: black; background: white; margin: 0 0 0 0 } + + /* + * Documentation + */ + /* Common for title and header */ + .doc_title, .doc_section, .doc_subsection { + color: #eeeeff; background: #330077; + font-family: "Georgia,Palatino,Times,Roman"; font-weight: bold; + padding-left: 8pt + } + + .doc_title { text-align: left; font-size: 25pt } + .doc_section { text-align: center; font-size: 22pt } + .doc_subsection { background: #441188; width: 50%; + text-align: left; font-size: 12pt; padding: 4 4 4 22 } + .doc_text { text-align: left; padding-left: 20pt } + + /* Publications */ + .pub_title { font-family: "Georgia,Palatino,Times,Roman"; font-size: 24pt; + text-align: center } + .pub_author { font-size: 14pt; text-align: center } From brukman at cs.uiuc.edu Wed Oct 22 18:25:01 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Wed Oct 22 18:25:01 2003 Subject: [llvm-commits] CVS: llvm-www/llvm.css Message-ID: <200310222324.SAA22393@zion.cs.uiuc.edu> Changes in directory llvm-www: llvm.css updated: 1.1 -> 1.2 --- Log message: Import the styles from docs/llvm.css so we don't maintain 2 versions. --- Diffs of the changes: (+9 -7) Index: llvm-www/llvm.css diff -u llvm-www/llvm.css:1.1 llvm-www/llvm.css:1.2 --- llvm-www/llvm.css:1.1 Tue Oct 21 17:30:00 2003 +++ llvm-www/llvm.css Wed Oct 22 18:24:28 2003 @@ -1,10 +1,12 @@ /* - * LLVM website style sheet + * WHEREAS, we ship source code with the docs/ directory, we need to provide + * users with a style sheet in that directory so that the files they download + * look like the ones they see online; + * + * WHEREAS, it is quite silly to maintain two identical stylesheets in CVS; + * + * BE IT RESOLVED THAT we shall maintain one, and the other one will slurp the + * content. */ -.body { text: black; background: white } - -/* Publications */ -.pub_title { font-family: "Georgia,Palatino,Times,Roman"; font-size: 24pt; - text-align: center } -.pub_author { font-size: 14pt; text-align: center } + at import url("docs/llvm.css"); From brukman at cs.uiuc.edu Wed Oct 22 18:28:01 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Wed Oct 22 18:28:01 2003 Subject: [llvm-commits] CVS: llvm/docs/AliasAnalysis.html Message-ID: <200310222327.SAA27126@zion.cs.uiuc.edu> Changes in directory llvm/docs: AliasAnalysis.html updated: 1.3 -> 1.4 --- Log message: * Use UTF-8 instead of soon-to-be-extinct ISO-8859-1 ;) * Use stylesheets instead of explicit tags * Stop using

        for spacing layout * Close and

        tags --- Diffs of the changes: (+234 -179) Index: llvm/docs/AliasAnalysis.html diff -u llvm/docs/AliasAnalysis.html:1.3 llvm/docs/AliasAnalysis.html:1.4 --- llvm/docs/AliasAnalysis.html:1.3 Mon Aug 18 09:41:19 2003 +++ llvm/docs/AliasAnalysis.html Wed Oct 22 18:27:16 2003 @@ -1,11 +1,16 @@ -Alias Analysis Infrastructure in LLVM - - - - - -
          Alias Analysis Infrastructure in LLVM
        + + + + + Alias Analysis Infrastructure in LLVM + + + + +

        + Alias Analysis Infrastructure in LLVM +
        1. Introduction @@ -45,70 +50,80 @@

        - - -
        -Introduction -

          + +
          +

          Alias Analysis (or Pointer Analysis) is a technique which attempts to determine whether or not two pointers ever can point to the same object in memory. Traditionally, Alias Analyses respond to a query with either a Must, May, or No alias response, indicating that two pointers do point to the same object, might point to the same object, or are -known not to point to the same object.

          - +known not to point to the same object. +

          +

          The AliasAnalysis class is the centerpiece of the LLVM Alias Analysis related infrastructure. This class is the common interface between clients of alias analysis information and the implementations providing it. In addition to simple alias analysis information, this class exposes Mod/Ref information from those implementations which can provide it, allowing for powerful analyses and transformations to work well -together.

          - +together. +

          +

          This document contains information necessary to successfully implement this interface, use it, and to test both sides. It also explains some of the finer points about what exactly results mean. If you feel that something is unclear -or should be added, please let me know.

          - +or should be added, please let me +know. +

          +
          -
        -
        -AliasAnalysis Overview -
          + +
          +

          The AliasAnalysis class defines the interface that Alias Analysis implementations should support. This class exports two important enums: AliasResult and ModRefResult which represent the result of an alias query or a mod/ref query, -respectively.

          - +respectively. +

          +

          The AliasAnalysis interface exposes information about memory, represented in several different ways. In particular, memory objects are represented as a starting address and size, and function calls are represented as the actual call or invoke instructions that performs the call. The AliasAnalysis interface also exposes some helper methods which allow you to get -mod/ref information for arbitrary instructions.

          +mod/ref information for arbitrary instructions. +

          +
          -
        -
           - -Representation of Pointers -
          + +
          +

          Most importantly, the AliasAnalysis class provides several methods which are used to query whether or not pointers alias, whether function calls can modify -or read memory, etc.

          - +or read memory, etc. +

          +

          Representing memory objects as a starting address and a size is critically important for precise Alias Analyses. For example, consider this (silly) C -code:

          - +code: +

          +

             int i;
             char C[2];
          @@ -119,13 +134,15 @@
               C[1] = A[9-i];        /* One byte store */
             }
           
          - +

          +

          In this case, the basicaa pass will disambiguate the stores to C[0] and C[1] because they are accesses to two distinct locations one byte apart, and the accesses are each one byte. In this case, the LICM pass can use store motion to remove the stores from the loop. In -constrast, the following code:

          - +constrast, the following code: +

          +

             int i;
             char C[2];
          @@ -136,113 +153,126 @@
               C[1] = A[9-i];          /* One byte store */
             }
           
          - +

          +

          In this case, the two stores to C do alias each other, because the access to the &C[0] element is a two byte access. If size information wasn't available in the query, even the first case would have to conservatively assume -that the accesses alias.

          - +that the accesses alias. +

          +
          -
        -
           - -Must, May, and No Alias Responses -
          + +
          +

          An Alias Analysis implementation can return one of three responses: MustAlias, MayAlias, and NoAlias. The No and May alias results are obvious: if the two pointers may never equal each other, return NoAlias, if they might, return -MayAlias.

          - +MayAlias. +

          +

          The Must Alias response is trickier though. In LLVM, the Must Alias response may only be returned if the two memory objects are guaranteed to always start at exactly the same location. If two memory objects overlap, but do not start at -the same location, MayAlias must be returned.

          - +the same location, MayAlias must be returned. +

          +
          -
        -
           - -The getModRefInfo methods -
          + +
          +

          The getModRefInfo methods return information about whether the execution of an instruction can read or modify a memory location. Mod/Ref information is always conservative: if an action may read a location, Ref -is returned.

          - - +is returned. +

          +
          -
        -
        -Writing a new AliasAnalysis Implementation -
          + +
          +

          Writing a new alias analysis implementation for LLVM is quite straight-forward. There are already several implementations that you can use for examples, and the following information should help fill in any details. For a minimal example, take a look at the no-aa -implementation.

          - +implementation. +

          +
          -
        -
           - -Different Pass styles -
          + +
          +

          The first step to determining what type of LLVM pass you need to use for your Alias Analysis. As is the case with most other analyses and transformations, the answer should be fairly obvious from -what type of problem you are trying to solve:

          - +what type of problem you are trying to solve: +

          +

            -
          1. If you require interprocedural analysis, it should be a Pass. -
          2. If you are a global analysis, subclass FunctionPass. -
          3. If you are a local pass, subclass BasicBlockPass. -
          4. If you don't need to look at the program at all, subclass - ImmutablePass. -

          - +

        • If you require interprocedural analysis, it should be a + Pass.
        • +
        • If you are a global analysis, subclass FunctionPass.
        • +
        • If you are a local pass, subclass BasicBlockPass.
        • +
        • If you don't need to look at the program at all, subclass + ImmutablePass.
        • + +

          +

          In addition to the pass that you subclass, you should also inherit from the AliasAnalysis interface, of course, and use the RegisterAnalysisGroup template to register as an implementation of -AliasAnalysis.

          - +AliasAnalysis. +

          +
          -
        -
           - -Required initialization calls -
          + +
          +

          Your subclass of AliasAnalysis is required to invoke two methods on the AliasAnalysis base class: getAnalysisUsage and InitializeAliasAnalysis. In particular, your implementation of getAnalysisUsage should explicitly call into the AliasAnalysis::getAnalysisUsage method in addition to doing any declaring any pass dependencies your pass has. Thus you should have something -like this:

          - +like this: +

          +

               void getAnalysisUsage(AnalysisUsage &AU) const {
                 AliasAnalysis::getAnalysisUsage(AU);
                 // declare your dependencies here.
               }
           
          - +

          +

          Additionally, your must invoke the InitializeAliasAnalysis method from your analysis run method (run for a Pass, runOnFunction for a FunctionPass, runOnBasicBlock for a BasicBlockPass, or InitializeAliasAnalysis for an -ImmutablePass). For example (as part of a Pass):

          - +ImmutablePass). For example (as part of a Pass): +

          +

               bool run(Module &M) {
                 InitializeAliasAnalysis(this);
          @@ -250,197 +280,219 @@
                 return false;
               }
           
          - +

          +
          -
        -
           - -Interfaces which may be specified -
          + +
          +

          All of the AliasAnalysis virtual methods default to providing conservatively correct information (returning "May" Alias and "Mod/Ref" for alias and mod/ref queries respectively). Depending on the capabilities of the analysis you are implementing, you just override the interfaces you can improve. - +

          +
          -
        -
           - -The AliasAnalysis chaining behavior -
          + +
          +

          With only two special exceptions (the basicaa and no-aa passes) every alias analysis pass should chain to another alias analysis implementation (for example, you could specify "-basic-aa -ds-aa -andersens-aa -licm" to get the maximum benefit from the three alias analyses). To do this, simply "Require" AliasAnalysis in your getAnalysisUsage method, and if you need to return a conservative -MayAlias or Mod/Ref result, simply chain to a lower analysis.

          - +MayAlias or Mod/Ref result, simply chain to a lower analysis. +

          +
          -
        -
           - -Efficiency Issues -
          + +
          +

          From the LLVM perspective, the only thing you need to do to provide an efficient alias analysis is to make sure that alias analysis queries are serviced quickly. The actual calculation of the alias analysis results (the "run" method) is only performed once, but many (perhaps duplicate) queries may be performed. Because of this, try to move as much computation to the run method -as possible (within reason).

          - +as possible (within reason). +

          +
          -
        -
        -Using AliasAnalysis results -
          + +
          +

          There are several different ways to use alias analysis results. In order of -preference, these are...

          +preference, these are... +

          +
          -
        -
           - -Using the -load-vn Pass -
          + +
          +

          The load-vn pass uses alias analysis to provide value numbering information for load instructions. If your analysis or transformation can be modelled in a form that uses value numbering information, you don't have to do anything special to handle load instructions: just use the -load-vn pass, which uses alias analysis.

          - +load-vn pass, which uses alias analysis. +

          +
          -
        -
           - -Using the AliasSetTracker class -
          + +
          +

          Many transformations need information about alias sets that are active in some scope, rather than information about pairwise aliasing. The AliasSetTracker class is used to efficiently build these Alias Sets from the pairwise alias analysis -information provided by the AliasAnalysis interface.

          - +information provided by the AliasAnalysis interface. +

          +

          First you initialize the AliasSetTracker by use the "add" methods to add information about various potentially aliasing instructions in the scope you are interested in. Once all of the alias sets are completed, your pass should simply iterate through the constructed alias sets, using the AliasSetTracker -begin()/end() methods.

          - +begin()/end() methods. +

          +

          The AliasSets formed by the AliasSetTracker are guaranteed to be disjoint, calculate mod/ref information for the set, and keep track of whether or not all of the pointers in the set are Must aliases. The AliasSetTracker also makes sure that sets are properly folded due to call -instructions, and can provide a list of pointers in each set.

          - +instructions, and can provide a list of pointers in each set. +

          +

          As an example user of this, the Loop Invariant Code Motion pass uses AliasSetTrackers to build alias information about each loop nest. If an AliasSet in a loop is not modified, then all load instructions from that set may be hoisted out of the loop. If any alias sets are stored and are must alias sets, then the stores may be sunk to outside of the loop. Both of these transformations obviously only apply if the -pointer argument is loop-invariant.

          - +pointer argument is loop-invariant. +

          +
          -
        -
           - -Using the AliasAnalysis interface directly -
          + +
          +

          As a last resort, your pass could use the AliasAnalysis interface directly to service your pass. If you find the need to do this, please let me know so I can see if something new -needs to be added to LLVM.

          - +needs to be added to LLVM. +

          +
          -
        -
        -Helpful alias analysis related tools -
          + +
          +

          If you're going to be working with the AliasAnalysis infrastructure, there are -several nice tools that may be useful for you and are worth knowing about...

          +several nice tools that may be useful for you and are worth knowing about... +

          +
          -
        -
           - -The -no-aa pass -
          + +
          +

          The -no-aa analysis is just like what it sounds: an alias analysis that never returns any useful information. This pass can be useful if you think that alias analysis is doing something wrong and are trying to narrow down a problem. If you don't specify an alias analysis, the default will be to use the -basicaa pass which does quite a bit of disambiguation on its own.

          +basicaa pass which does quite a bit of disambiguation on its own. +

          +
          -
        -
           - -The -print-alias-sets pass -
          + +
          +

          The -print-alias-sets pass is exposed as part of the analyze tool to print out the Alias Sets formed by the AliasSetTracker class. This is useful if you're using -the AliasSetTracker.

          - +the AliasSetTracker. +

          +
          -
        -
           - -The -count-aa pass -
          + +
          +

          The -count-aa pass is useful to see how many queries a particular pass is making and what kinds of responses are returned by the alias analysis. An -example usage is:

          - +example usage is: +

          +

             $ opt -basicaa -count-aa -ds-aa -count-aa -licm
           
          - +

          +

          Which will print out how many queries (and what responses are returned) by the -licm pass (of the -ds-aa pass) and how many queries are made of the -basicaa pass by the -ds-aa pass. This can be useful -when evaluating an alias analysis for precision.

          +when evaluating an alias analysis for precision. +

          +
          -
        -
           - -The -aa-eval pass -
          + +
          +

          The -aa-eval pass simply iterates through all pairs of pointers in a function and asks an alias analysis whether or not the pointers alias. This gives an indication of the precision of the alias analysis. Statistics are -printed.

          - +printed. +

          +
          -
        -
        Chris Lattner
        @@ -448,4 +500,7 @@ Last modified: Tue Mar 4 13:36:53 CST 2003 -
        +
        + + + From brukman at cs.uiuc.edu Wed Oct 22 20:49:01 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Wed Oct 22 20:49:01 2003 Subject: [llvm-commits] CVS: llvm/docs/CFEBuildInstrs.html Message-ID: <200310230148.UAA15892@zion.cs.uiuc.edu> Changes in directory llvm/docs: CFEBuildInstrs.html updated: 1.1 -> 1.2 --- Log message: * Use UTF-8 instead of ISO-8859-1 * Use stylesheet instead of explicit formatting * Stop using
          for layout * Close
        • tags --- Diffs of the changes: (+48 -39) Index: llvm/docs/CFEBuildInstrs.html diff -u llvm/docs/CFEBuildInstrs.html:1.1 llvm/docs/CFEBuildInstrs.html:1.2 --- llvm/docs/CFEBuildInstrs.html:1.1 Tue Oct 21 16:58:38 2003 +++ llvm/docs/CFEBuildInstrs.html Wed Oct 22 20:48:33 2003 @@ -1,17 +1,15 @@ -Bootstrapping the C/C++ Front-End - - -

          Bootstrapping the C/C++ Front-End

          - -

          - - - -
          -Instructions -
            - + + + + + Bootstrapping the C/C++ Front-End + + + +
            + Bootstrapping the C/C++ Front-End +

            This document is intended to explain the process of building the LLVM C/C++ front-end, based on GCC 3.4, from source.

            @@ -23,6 +21,14 @@

            We welcome patches to help make this process simpler.

            + + + + +
            +

            1. Configure and build the LLVM libraries and tools using:

              @@ -33,17 +39,17 @@
                   

              The use of the non-default target "tools-only" means that the LLVM tools and libraries will build, and the binaries will be deposited in llvm/tools/Debug, but the runtime (bytecode) - libraries will not build.

              + libraries will not build.

            2. Add the directory containing the tools to your PATH.

              - % set path = ( `cd llvm/tools/Debug && pwd` $path )
              -
              + % set path = ( `cd llvm/tools/Debug && pwd` $path ) +
  • -
  • Unpack the C/C++ front-end source into cfrontend/src.

    +
  • Unpack the C/C++ front-end source into cfrontend/src.

  • Edit src/configure. Change the first line (starting w/ #!) to - contain the correct full pathname of sh.

    + contain the correct full pathname of sh.

  • Make "build" and "install" directories as siblings of the "src" tree.

    @@ -53,7 +59,7 @@ % cd .. % mkdir build install % set CFEINSTALL = `pwd`/install - +
  • Configure, build and install the C front-end:

    @@ -73,34 +79,36 @@
       
  • Fix 1: If you have system header files that include inline assembly, you may have to modify them to remove the inline assembly, and install the modified versions in - $CFEINSTALL/target-triplet/sys-include.

    + $CFEINSTALL/target-triplet/sys-include.

  • Fix 2: If you are building the C++ front-end on a CPU we haven't tried yet, you will probably have to edit the appropriate version of atomicity.h under src/libstdc++-v3/config/cpu/name-of-cpu/atomicity.h - and apply a patch so that it does not use inline assembly.

    + and apply a patch so that it does not use inline assembly.

  • Common Problem 2: FIXME: Chris should add a section about common problems porting to a new architecture, including changes you - might have to make to the gcc/gcc/config/name-of-cpu + might have to make to the gcc/gcc/config/name-of-cpu directory. For example (expand these):

      -
    • Munge linker flags so they are compatible with gccld. +
    • Munge linker flags so they are compatible with gccld.
    • Change the target so it doesn't have long double; just use double - instead. -
    • No inline assembly for position independent code. -
    • We handle init and fini differently. -
    • Do not include inline assembly map things for SPARC, or profile things. + instead.
    • +
    • No inline assembly for position independent code.
    • +
    • We handle init and fini differently.
    • +
    • Do not include inline assembly map things for SPARC, or profile + things.
    +
  • Go back into the LLVM source tree proper. Edit Makefile.config to redefine LLVMGCCDIR to the full pathname of the $CFEINSTALL directory, which is the directory you just installed the C front-end into. (The ./configure script is likely to -have set this to a directory which does not exist on your system.)

    +have set this to a directory which does not exist on your system.)

  • If you edited header files during the C/C++ front-end build as described in "Fix 1" above, you must now copy those header files from @@ -108,7 +116,7 @@ $CFEINSTALL/lib/gcc/target-triplet/3.4-llvm/include. (This should be the "include" directory in the same directory as the libgcc.a library, which you can find by running -$CFEINSTALL/bin/gcc --print-libgcc-file-name.)

    +$CFEINSTALL/bin/gcc --print-libgcc-file-name.)

  • Build and install the runtime (bytecode) libraries by running:

    @@ -116,25 +124,26 @@
      % mkdir $CFEINSTALL/bytecode-libs
      % gmake -C runtime install
      % setenv LLVM_LIB_SEARCH_PATH $CFEINSTALL/bytecode-libs
    -
    +
  • Test the newly-installed C frontend by one or more of the following means:

      -
    • compiling and running a "hello, world" program in C or C++. +
    • compiling and running a "hello, world" program in C or C++.
    • running the tests under test/Programs using gmake -C - test/Programs; + test/Programs
    - -

    +

    +
  • +
    - - -
    +
    Brian Gaeke
    -Last modified: $Date: 2003/10/21 21:58:38 $ -
    +Last modified: $Date: 2003/10/23 01:48:33 $ +
    + + From brukman at cs.uiuc.edu Wed Oct 22 20:50:01 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Wed Oct 22 20:50:01 2003 Subject: [llvm-commits] CVS: llvm/docs/AliasAnalysis.html Message-ID: <200310230149.UAA20609@zion.cs.uiuc.edu> Changes in directory llvm/docs: AliasAnalysis.html updated: 1.4 -> 1.5 --- Log message: * Quote a value in tag. * Let CVS figure out the last-modified-date for us --- Diffs of the changes: (+2 -2) Index: llvm/docs/AliasAnalysis.html diff -u llvm/docs/AliasAnalysis.html:1.4 llvm/docs/AliasAnalysis.html:1.5 --- llvm/docs/AliasAnalysis.html:1.4 Wed Oct 22 18:27:16 2003 +++ llvm/docs/AliasAnalysis.html Wed Oct 22 20:49:47 2003 @@ -494,11 +494,11 @@ -
    +
    Chris Lattner
    -Last modified: Tue Mar 4 13:36:53 CST 2003 +Last modified: $Date: 2003/10/23 01:49:47 $
    From brukman at cs.uiuc.edu Wed Oct 22 20:51:01 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Wed Oct 22 20:51:01 2003 Subject: [llvm-commits] CVS: llvm/docs/AliasAnalysis.html Message-ID: <200310230150.UAA25330@zion.cs.uiuc.edu> Changes in directory llvm/docs: AliasAnalysis.html updated: 1.5 -> 1.6 --- Log message: Remove extraneous comments. --- Diffs of the changes: (+1 -4) Index: llvm/docs/AliasAnalysis.html diff -u llvm/docs/AliasAnalysis.html:1.5 llvm/docs/AliasAnalysis.html:1.6 --- llvm/docs/AliasAnalysis.html:1.5 Wed Oct 22 20:49:47 2003 +++ llvm/docs/AliasAnalysis.html Wed Oct 22 20:50:39 2003 @@ -496,10 +496,7 @@
    Chris Lattner
    - - -Last modified: $Date: 2003/10/23 01:49:47 $ - +Last modified: $Date: 2003/10/23 01:50:39 $
    From brukman at cs.uiuc.edu Wed Oct 22 21:30:01 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Wed Oct 22 21:30:01 2003 Subject: [llvm-commits] CVS: llvm/docs/AliasAnalysis.html Message-ID: <200310230229.VAA30158@zion.cs.uiuc.edu> Changes in directory llvm/docs: AliasAnalysis.html updated: 1.6 -> 1.7 --- Log message: Really close the
  • tags. --- Diffs of the changes: (+23 -23) Index: llvm/docs/AliasAnalysis.html diff -u llvm/docs/AliasAnalysis.html:1.6 llvm/docs/AliasAnalysis.html:1.7 --- llvm/docs/AliasAnalysis.html:1.6 Wed Oct 22 20:50:39 2003 +++ llvm/docs/AliasAnalysis.html Wed Oct 22 21:29:42 2003 @@ -13,41 +13,41 @@
      -
    1. Introduction +
    2. Introduction
    3. -
    4. AliasAnalysis Overview +
    5. AliasAnalysis Overview
    6. -
    7. Writing a new AliasAnalysis Implementation +
    8. Writing a new AliasAnalysis Implementation
    9. -
    10. Using AliasAnalysis results +
    11. Using AliasAnalysis results
    12. -
    13. Helpful alias analysis related tools +
    14. Helpful alias analysis related tools
    15. -

      Written by Chris Lattner

      -

    +

    Written by Chris Lattner

    + @@ -496,7 +496,7 @@
    Chris Lattner
    -Last modified: $Date: 2003/10/23 01:50:39 $ +Last modified: $Date: 2003/10/23 02:29:42 $
    From lattner at cs.uiuc.edu Wed Oct 22 22:32:50 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Oct 22 22:32:50 2003 Subject: [llvm-commits] CVS: llvm/docs/ChrisNotes.txt Message-ID: <200310230331.WAA32016@zion.cs.uiuc.edu> Changes in directory llvm/docs: ChrisNotes.txt (r1.29) removed --- Log message: To say this file is obsolete to understate the obvious --- Diffs of the changes: (+0 -0) From lattner at cs.uiuc.edu Wed Oct 22 22:49:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Oct 22 22:49:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp Message-ID: <200310230348.WAA00607@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: DeadArgumentElimination.cpp updated: 1.7 -> 1.8 --- Log message: Make this pass substantially stronger by having it delete dead return values as well as arguments. Now it can delete arguments and return values which are only passed into other arguments or are returned, if they are dead. This causes it to delete several hundred extra args/retvals from the C++ hello world program, shrinking it by about 2K. --- Diffs of the changes: (+353 -126) Index: llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp diff -u llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp:1.7 llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp:1.8 --- llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp:1.7 Mon Oct 20 14:43:18 2003 +++ llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp Wed Oct 22 22:48:17 2003 @@ -9,7 +9,8 @@ // // This pass deletes dead arguments from internal functions. Dead argument // elimination removes arguments which are directly dead, as well as arguments -// only passed into function calls as dead arguments of other functions. +// only passed into function calls as dead arguments of other functions. This +// pass also deletes dead arguments in a similar way. // // This pass is often useful as a cleanup pass to run after aggressive // interprocedural passes, which add possibly-dead arguments. @@ -30,17 +31,68 @@ #include namespace { - Statistic<> NumArgumentsEliminated("deadargelim", "Number of args removed"); + Statistic<> NumArgumentsEliminated("deadargelim", + "Number of unread args removed"); + Statistic<> NumRetValsEliminated("deadargelim", + "Number of unused return values removed"); + + /// DAE - The dead argument elimination pass. + /// + class DAE : public Pass { + /// DeleteFromExternalFunctions - Bugpoint sets this flag to indicate that + /// it is safe to hack apart functions without internal linkage. + bool DeleteFromExternalFunctions; + + /// Liveness enum - During our initial pass over the program, we determine + /// that things are either definately alive, definately dead, or in need of + /// interprocedural analysis (MaybeLive). + /// + enum Liveness { Live, MaybeLive, Dead }; + + /// LiveArguments, MaybeLiveArguments, DeadArguments - These sets contain + /// all of the arguments in the program. The Dead set contains arguments + /// which are completely dead (never used in the function). The MaybeLive + /// set contains arguments which are only passed into other function calls, + /// thus may be live and may be dead. The Live set contains arguments which + /// are known to be alive. + /// + std::set DeadArguments, MaybeLiveArguments, LiveArguments; + + /// DeadRetVal, MaybeLiveRetVal, LifeRetVal - These sets contain all of the + /// functions in the program. The Dead set contains functions whose return + /// value is known to be dead. The MaybeLive set contains functions whose + /// return values are only used by return instructions, and the Live set + /// contains functions whose return values are used, functions that are + /// external, and functions that already return void. + /// + std::set DeadRetVal, MaybeLiveRetVal, LiveRetVal; + + /// InstructionsToInspect - As we mark arguments and return values + /// MaybeLive, we keep track of which instructions could make the values + /// live here. Once the entire program has had the return value and + /// arguments analyzed, this set is scanned to promote the MaybeLive objects + /// to be Live if they really are used. + std::vector InstructionsToInspect; + + /// CallSites - Keep track of the call sites of functions that have + /// MaybeLive arguments or return values. + std::multimap CallSites; - struct DAE : public Pass { + public: DAE(bool DFEF = false) : DeleteFromExternalFunctions(DFEF) {} bool run(Module &M); private: - bool DeleteFromExternalFunctions; - bool FunctionArgumentsIntrinsicallyAlive(const Function &F); - void RemoveDeadArgumentsFromFunction(Function *F, - std::set &DeadArguments); + Liveness getArgumentLiveness(const Argument &A); + bool isMaybeLiveArgumentNowLive(Argument *Arg); + + void SurveyFunction(Function &Fn); + + void MarkArgumentLive(Argument *Arg); + void MarkRetValLive(Function *F); + void MarkReturnInstArgumentLive(ReturnInst *RI); + + void RemoveDeadArgumentsFromFunction(Function *F); }; RegisterOpt X("deadargelim", "Dead Argument Elimination"); } @@ -55,70 +107,172 @@ return new DAE(DeleteFromExternalFunctions); } - -// FunctionArgumentsIntrinsicallyAlive - Return true if the arguments of the -// specified function are intrinsically alive. -// -// We consider arguments of non-internal functions to be intrinsically alive as -// well as arguments to functions which have their "address taken". -// -bool DAE::FunctionArgumentsIntrinsicallyAlive(const Function &F) { - if (!F.hasInternalLinkage() && !DeleteFromExternalFunctions) return true; - - for (Value::use_const_iterator I = F.use_begin(), E = F.use_end(); I!=E; ++I){ - // If this use is anything other than a call site, the function is alive. - CallSite CS = CallSite::get(const_cast(*I)); - if (!CS.getInstruction()) return true; // Not a valid call site? - - // If the function is PASSED IN as an argument, its address has been taken - for (CallSite::arg_iterator AI = CS.arg_begin(), E = CS.arg_end(); AI != E; - ++AI) - if (AI->get() == &F) return true; - } +static inline bool CallPassesValueThoughVararg(Instruction *Call, + const Value *Arg) { + CallSite CS = CallSite::get(Call); + const Type *CalledValueTy = CS.getCalledValue()->getType(); + const Type *FTy = cast(CalledValueTy)->getElementType(); + unsigned NumFixedArgs = cast(FTy)->getNumParams(); + for (CallSite::arg_iterator AI = CS.arg_begin()+NumFixedArgs; + AI != CS.arg_end(); ++AI) + if (AI->get() == Arg) + return true; return false; } -namespace { - enum ArgumentLiveness { Alive, MaybeLive, Dead }; -} - -// getArgumentLiveness - Inspect an argument, determining if is known Alive +// getArgumentLiveness - Inspect an argument, determining if is known Live // (used in a computation), MaybeLive (only passed as an argument to a call), or // Dead (not used). -static ArgumentLiveness getArgumentLiveness(const Argument &A) { +DAE::Liveness DAE::getArgumentLiveness(const Argument &A) { if (A.use_empty()) return Dead; // First check, directly dead? // Scan through all of the uses, looking for non-argument passing uses. for (Value::use_const_iterator I = A.use_begin(), E = A.use_end(); I!=E;++I) { + // Return instructions do not immediately effect liveness. + if (isa(*I)) + continue; + CallSite CS = CallSite::get(const_cast(*I)); if (!CS.getInstruction()) { // If its used by something that is not a call or invoke, it's alive! - return Alive; + return Live; } // If it's an indirect call, mark it alive... Function *Callee = CS.getCalledFunction(); - if (!Callee) return Alive; + if (!Callee) return Live; // Check to see if it's passed through a va_arg area: if so, we cannot // remove it. - unsigned NumFixedArgs = Callee->getFunctionType()->getNumParams(); - for (CallSite::arg_iterator AI = CS.arg_begin()+NumFixedArgs; - AI != CS.arg_end(); ++AI) - if (AI->get() == &A) // If passed through va_arg area, we cannot remove it - return Alive; + if (CallPassesValueThoughVararg(CS.getInstruction(), &A)) + return Live; // If passed through va_arg area, we cannot remove it } return MaybeLive; // It must be used, but only as argument to a function } -// isMaybeLiveArgumentNowAlive - Check to see if Arg is alive. At this point, -// we know that the only uses of Arg are to be passed in as an argument to a -// function call. Check to see if the formal argument passed in is in the -// LiveArguments set. If so, return true. + +// SurveyFunction - This performs the initial survey of the specified function, +// checking out whether or not it uses any of its incoming arguments or whether +// any callers use the return value. This fills in the +// (Dead|MaybeLive|Live)(Arguments|RetVal) sets. +// +// We consider arguments of non-internal functions to be intrinsically alive as +// well as arguments to functions which have their "address taken". +// +void DAE::SurveyFunction(Function &F) { + bool FunctionIntrinsicallyLive = false; + Liveness RetValLiveness = F.getReturnType() == Type::VoidTy ? Live : Dead; + + if (!F.hasInternalLinkage() && !DeleteFromExternalFunctions) + FunctionIntrinsicallyLive = true; + else + for (Value::use_iterator I = F.use_begin(), E = F.use_end(); I != E; ++I) { + // If this use is anything other than a call site, the function is alive. + CallSite CS = CallSite::get(*I); + Instruction *TheCall = CS.getInstruction(); + if (!TheCall) { // Not a direct call site? + FunctionIntrinsicallyLive = true; + break; + } + + // Check to see if the return value is used... + if (RetValLiveness != Live) + for (Value::use_iterator I = TheCall->use_begin(), + E = TheCall->use_end(); I != E; ++I) + if (isa(cast(*I))) { + RetValLiveness = MaybeLive; + } else if (isa(cast(*I)) || + isa(cast(*I))) { + if (CallPassesValueThoughVararg(cast(*I), TheCall) || + !CallSite::get(cast(*I)).getCalledFunction()) { + RetValLiveness = Live; + break; + } else { + RetValLiveness = MaybeLive; + } + } else { + RetValLiveness = Live; + break; + } + + // If the function is PASSED IN as an argument, its address has been taken + for (CallSite::arg_iterator AI = CS.arg_begin(), E = CS.arg_end(); + AI != E; ++AI) + if (AI->get() == &F) { + FunctionIntrinsicallyLive = true; + break; + } + if (FunctionIntrinsicallyLive) break; + } + + if (FunctionIntrinsicallyLive) { + DEBUG(std::cerr << " Intrinsically live fn: " << F.getName() << "\n"); + for (Function::aiterator AI = F.abegin(), E = F.aend(); AI != E; ++AI) + LiveArguments.insert(AI); + LiveRetVal.insert(&F); + return; + } + + switch (RetValLiveness) { + case Live: LiveRetVal.insert(&F); break; + case MaybeLive: MaybeLiveRetVal.insert(&F); break; + case Dead: DeadRetVal.insert(&F); break; + } + + DEBUG(std::cerr << " Inspecting args for fn: " << F.getName() << "\n"); + + // If it is not intrinsically alive, we know that all users of the + // function are call sites. Mark all of the arguments live which are + // directly used, and keep track of all of the call sites of this function + // if there are any arguments we assume that are dead. + // + bool AnyMaybeLiveArgs = false; + for (Function::aiterator AI = F.abegin(), E = F.aend(); AI != E; ++AI) + switch (getArgumentLiveness(*AI)) { + case Live: + DEBUG(std::cerr << " Arg live by use: " << AI->getName() << "\n"); + LiveArguments.insert(AI); + break; + case Dead: + DEBUG(std::cerr << " Arg definitely dead: " <getName()<<"\n"); + DeadArguments.insert(AI); + break; + case MaybeLive: + DEBUG(std::cerr << " Arg only passed to calls: " + << AI->getName() << "\n"); + AnyMaybeLiveArgs = true; + MaybeLiveArguments.insert(AI); + break; + } + + // If there are any "MaybeLive" arguments, we need to check callees of + // this function when/if they become alive. Record which functions are + // callees... + if (AnyMaybeLiveArgs || RetValLiveness == MaybeLive) + for (Value::use_iterator I = F.use_begin(), E = F.use_end(); + I != E; ++I) { + if (AnyMaybeLiveArgs) + CallSites.insert(std::make_pair(&F, CallSite::get(*I))); + + if (RetValLiveness == MaybeLive) + for (Value::use_iterator UI = I->use_begin(), E = I->use_end(); + UI != E; ++UI) + InstructionsToInspect.push_back(cast(*UI)); + } +} + +// isMaybeLiveArgumentNowLive - Check to see if Arg is alive. At this point, we +// know that the only uses of Arg are to be passed in as an argument to a +// function call or return. Check to see if the formal argument passed in is in +// the LiveArguments set. If so, return true. // -static bool isMaybeLiveArgumentNowAlive(Argument *Arg, - const std::set &LiveArguments) { +bool DAE::isMaybeLiveArgumentNowLive(Argument *Arg) { for (Value::use_iterator I = Arg->use_begin(), E = Arg->use_end(); I!=E; ++I){ + if (isa(*I)) { + if (LiveRetVal.count(Arg->getParent())) return true; + continue; + } + CallSite CS = CallSite::get(*I); // We know that this can only be used for direct calls... @@ -136,18 +290,16 @@ return false; } -// MarkArgumentLive - The MaybeLive argument 'Arg' is now known to be alive. -// Mark it live in the specified sets and recursively mark arguments in callers -// live that are needed to pass in a value. -// -static void MarkArgumentLive(Argument *Arg, - std::set &MaybeLiveArguments, - std::set &LiveArguments, - const std::multimap &CallSites) { +/// MarkArgumentLive - The MaybeLive argument 'Arg' is now known to be alive. +/// Mark it live in the specified sets and recursively mark arguments in callers +/// live that are needed to pass in a value. +/// +void DAE::MarkArgumentLive(Argument *Arg) { + std::set::iterator It = MaybeLiveArguments.lower_bound(Arg); + if (It == MaybeLiveArguments.end() || *It != Arg) return; + DEBUG(std::cerr << " MaybeLive argument now live: " << Arg->getName()<<"\n"); - assert(MaybeLiveArguments.count(Arg) && !LiveArguments.count(Arg) && - "Arg not MaybeLive?"); - MaybeLiveArguments.erase(Arg); + MaybeLiveArguments.erase(It); LiveArguments.insert(Arg); // Loop over all of the call sites of the function, making any arguments @@ -156,14 +308,55 @@ Function *Fn = Arg->getParent(); unsigned ArgNo = std::distance(Fn->abegin(), Function::aiterator(Arg)); - std::multimap::const_iterator I = - CallSites.lower_bound(Fn); + std::multimap::iterator I = CallSites.lower_bound(Fn); for (; I != CallSites.end() && I->first == Fn; ++I) { - const CallSite &CS = I->second; - if (Argument *ActualArg = dyn_cast(*(CS.arg_begin()+ArgNo))) - if (MaybeLiveArguments.count(ActualArg)) - MarkArgumentLive(ActualArg, MaybeLiveArguments, LiveArguments, - CallSites); + CallSite CS = I->second; + Value *ArgVal = *(CS.arg_begin()+ArgNo); + if (Argument *ActualArg = dyn_cast(ArgVal)) { + MarkArgumentLive(ActualArg); + } else { + // If the value passed in at this call site is a return value computed by + // some other call site, make sure to mark the return value at the other + // call site as being needed. + CallSite ArgCS = CallSite::get(ArgVal); + if (ArgCS.getInstruction()) + if (Function *Fn = ArgCS.getCalledFunction()) + MarkRetValLive(Fn); + } + } +} + +/// MarkArgumentLive - The MaybeLive return value for the specified function is +/// now known to be alive. Propagate this fact to the return instructions which +/// produce it. +void DAE::MarkRetValLive(Function *F) { + assert(F && "Shame shame, we can't have null pointers here!"); + + // Check to see if we already knew it was live + std::set::iterator I = MaybeLiveRetVal.lower_bound(F); + if (I == MaybeLiveRetVal.end() || *I != F) return; // It's already alive! + + DEBUG(std::cerr << " MaybeLive retval now live: " << F->getName() << "\n"); + + MaybeLiveRetVal.erase(I); + LiveRetVal.insert(F); // It is now known to be live! + + // Loop over all of the functions, noticing that the return value is now live. + for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) + if (ReturnInst *RI = dyn_cast(BB->getTerminator())) + MarkReturnInstArgumentLive(RI); +} + +void DAE::MarkReturnInstArgumentLive(ReturnInst *RI) { + Value *Op = RI->getOperand(0); + if (Argument *A = dyn_cast(Op)) { + MarkArgumentLive(A); + } else if (CallInst *CI = dyn_cast(Op)) { + if (Function *F = CI->getCalledFunction()) + MarkRetValLive(F); + } else if (InvokeInst *II = dyn_cast(Op)) { + if (Function *F = II->getCalledFunction()) + MarkRetValLive(F); } } @@ -171,8 +364,7 @@ // specified by the DeadArguments list. Transform the function and all of the // callees of the function to not have these arguments. // -void DAE::RemoveDeadArgumentsFromFunction(Function *F, - std::set &DeadArguments){ +void DAE::RemoveDeadArgumentsFromFunction(Function *F) { // Start by computing a new prototype for the function, which is the same as // the old function, but has fewer arguments. const FunctionType *FTy = F->getFunctionType(); @@ -182,9 +374,14 @@ if (!DeadArguments.count(I)) Params.push_back(I->getType()); - FunctionType *NFTy = FunctionType::get(FTy->getReturnType(), Params, - FTy->isVarArg()); - + const Type *RetTy = FTy->getReturnType(); + if (DeadRetVal.count(F)) { + RetTy = Type::VoidTy; + DeadRetVal.erase(F); + } + + FunctionType *NFTy = FunctionType::get(RetTy, Params, FTy->isVarArg()); + // Create the new function body and insert it into the module... Function *NF = new Function(NFTy, F->getLinkage(), F->getName()); F->getParent()->getFunctionList().insert(F, NF); @@ -192,19 +389,40 @@ // Loop over all of the callers of the function, transforming the call sites // to pass in a smaller number of arguments into the new function. // + std::vector Args; while (!F->use_empty()) { CallSite CS = CallSite::get(F->use_back()); Instruction *Call = CS.getInstruction(); - CS.setCalledFunction(NF); // Reduce the uses count of F - + // Loop over the operands, deleting dead ones... CallSite::arg_iterator AI = CS.arg_begin(); - for (Function::aiterator I = F->abegin(), E = F->aend(); I != E; ++I) - if (DeadArguments.count(I)) { // Remove operands for dead arguments - AI = Call->op_erase(AI); - } else { - ++AI; // Leave live operands alone... + for (Function::aiterator I = F->abegin(), E = F->aend(); I != E; ++I, ++AI) + if (!DeadArguments.count(I)) // Remove operands for dead arguments + Args.push_back(*AI); + + Instruction *New; + if (InvokeInst *II = dyn_cast(Call)) { + New = new InvokeInst(NF, II->getNormalDest(), II->getExceptionalDest(), + Args, "", Call); + } else { + New = new CallInst(NF, Args, "", Call); + } + Args.clear(); + + if (!Call->use_empty()) { + if (New->getType() == Type::VoidTy) + Call->replaceAllUsesWith(Constant::getNullValue(Call->getType())); + else { + Call->replaceAllUsesWith(New); + std::string Name = Call->getName(); + Call->setName(""); + New->setName(Name); } + } + + // Finally, remove the old call from the program, reducing the use-count of + // F. + Call->getParent()->getInstList().erase(Call); } // Since we have now created the new function, splice the body of the old @@ -232,6 +450,15 @@ DeadArguments.erase(I); } + // If we change the return value of the function we must rewrite any return + // instructions. Check this now. + if (F->getReturnType() != NF->getReturnType()) + for (Function::iterator BB = NF->begin(), E = NF->end(); BB != E; ++BB) + if (ReturnInst *RI = dyn_cast(BB->getTerminator())) { + new ReturnInst(0, RI); + BB->getInstList().erase(RI); + } + // Now that the old function is dead, delete it. F->getParent()->getFunctionList().erase(F); } @@ -241,52 +468,44 @@ // We assume all arguments are dead unless proven otherwise (allowing us to // determine that dead arguments passed into recursive functions are dead). // - std::set LiveArguments, MaybeLiveArguments, DeadArguments; - std::multimap CallSites; - DEBUG(std::cerr << "DAE - Determining liveness\n"); - for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) { - Function &Fn = *I; - // If the function is intrinsically alive, just mark the arguments alive. - if (FunctionArgumentsIntrinsicallyAlive(Fn)) { - for (Function::aiterator AI = Fn.abegin(), E = Fn.aend(); AI != E; ++AI) - LiveArguments.insert(AI); - DEBUG(std::cerr << " Args intrinsically live for fn: " << Fn.getName() - << "\n"); + for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) + SurveyFunction(*I); + + // Loop over the instructions to inspect, propagating liveness among arguments + // and return values which are MaybeLive. + + while (!InstructionsToInspect.empty()) { + Instruction *I = InstructionsToInspect.back(); + InstructionsToInspect.pop_back(); + + if (ReturnInst *RI = dyn_cast(I)) { + // For return instructions, we just have to check to see if the return + // value for the current function is known now to be alive. If so, any + // arguments used by it are now alive, and any call instruction return + // value is alive as well. + if (LiveRetVal.count(RI->getParent()->getParent())) + MarkReturnInstArgumentLive(RI); + } else { - DEBUG(std::cerr << " Inspecting args for fn: " << Fn.getName() << "\n"); + CallSite CS = CallSite::get(I); + assert(CS.getInstruction() && "Unknown instruction for the I2I list!"); - // If it is not intrinsically alive, we know that all users of the - // function are call sites. Mark all of the arguments live which are - // directly used, and keep track of all of the call sites of this function - // if there are any arguments we assume that are dead. + Function *Callee = CS.getCalledFunction(); + + // If we found a call or invoke instruction on this list, that means that + // an argument of the function is a call instruction. If the argument is + // live, then the return value of the called instruction is now live. // - bool AnyMaybeLiveArgs = false; - for (Function::aiterator AI = Fn.abegin(), E = Fn.aend(); AI != E; ++AI) - switch (getArgumentLiveness(*AI)) { - case Alive: - DEBUG(std::cerr << " Arg live by use: " << AI->getName() << "\n"); - LiveArguments.insert(AI); - break; - case Dead: - DEBUG(std::cerr << " Arg definitely dead: " <getName()<<"\n"); - DeadArguments.insert(AI); - break; - case MaybeLive: - DEBUG(std::cerr << " Arg only passed to calls: " - << AI->getName() << "\n"); - AnyMaybeLiveArgs = true; - MaybeLiveArguments.insert(AI); - break; - } - - // If there are any "MaybeLive" arguments, we need to check callees of - // this function when/if they become alive. Record which functions are - // callees... - if (AnyMaybeLiveArgs) - for (Value::use_iterator I = Fn.use_begin(), E = Fn.use_end(); - I != E; ++I) - CallSites.insert(std::make_pair(&Fn, CallSite::get(*I))); + CallSite::arg_iterator AI = CS.arg_begin(); // ActualIterator + for (Function::aiterator FI = Callee->abegin(), E = Callee->aend(); + FI != E; ++AI, ++FI) { + // If this argument is another call... + CallSite ArgCS = CallSite::get(*AI); + if (ArgCS.getInstruction() && LiveArguments.count(FI)) + if (Function *Callee = ArgCS.getCalledFunction()) + MarkRetValLive(Callee); + } } } @@ -295,17 +514,16 @@ // passed into requires them to be live. Of course this could make other // arguments live, so process callers recursively. // - // Because elements can be removed from the MaybeLiveArguments list, copy it - // to a temporary vector. + // Because elements can be removed from the MaybeLiveArguments set, copy it to + // a temporary vector. // std::vector TmpArgList(MaybeLiveArguments.begin(), MaybeLiveArguments.end()); for (unsigned i = 0, e = TmpArgList.size(); i != e; ++i) { Argument *MLA = TmpArgList[i]; if (MaybeLiveArguments.count(MLA) && - isMaybeLiveArgumentNowAlive(MLA, LiveArguments)) { - MarkArgumentLive(MLA, MaybeLiveArguments, LiveArguments, CallSites); - } + isMaybeLiveArgumentNowLive(MLA)) + MarkArgumentLive(MLA); } // Recover memory early... @@ -314,17 +532,26 @@ // At this point, we know that all arguments in DeadArguments and // MaybeLiveArguments are dead. If the two sets are empty, there is nothing // to do. - if (MaybeLiveArguments.empty() && DeadArguments.empty()) + if (MaybeLiveArguments.empty() && DeadArguments.empty() && + MaybeLiveRetVal.empty() && DeadRetVal.empty()) return false; // Otherwise, compact into one set, and start eliminating the arguments from // the functions. DeadArguments.insert(MaybeLiveArguments.begin(), MaybeLiveArguments.end()); MaybeLiveArguments.clear(); + DeadRetVal.insert(MaybeLiveRetVal.begin(), MaybeLiveRetVal.end()); + MaybeLiveRetVal.clear(); + + LiveArguments.clear(); + LiveRetVal.clear(); NumArgumentsEliminated += DeadArguments.size(); + NumRetValsEliminated += DeadRetVal.size(); while (!DeadArguments.empty()) - RemoveDeadArgumentsFromFunction((*DeadArguments.begin())->getParent(), - DeadArguments); + RemoveDeadArgumentsFromFunction((*DeadArguments.begin())->getParent()); + + while (!DeadRetVal.empty()) + RemoveDeadArgumentsFromFunction(*DeadRetVal.begin()); return true; } From lattner at cs.uiuc.edu Wed Oct 22 22:56:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Oct 22 22:56:01 2003 Subject: [llvm-commits] CVS: llvm/docs/CFEBuildInstrs.html Message-ID: <200310230355.WAA00676@zion.cs.uiuc.edu> Changes in directory llvm/docs: CFEBuildInstrs.html updated: 1.2 -> 1.3 --- Log message: Minor edits --- Diffs of the changes: (+22 -15) Index: llvm/docs/CFEBuildInstrs.html diff -u llvm/docs/CFEBuildInstrs.html:1.2 llvm/docs/CFEBuildInstrs.html:1.3 --- llvm/docs/CFEBuildInstrs.html:1.2 Wed Oct 22 20:48:33 2003 +++ llvm/docs/CFEBuildInstrs.html Wed Oct 22 22:55:23 2003 @@ -71,7 +71,7 @@ % gmake all; gmake install -

    Common Problem 1: You may get error messages regarding the fact +

    Common Problem: You may get error messages regarding the fact that LLVM does not support inline assembly. Here are two common fixes:

    @@ -88,19 +88,26 @@ and apply a patch so that it does not use inline assembly.

  • -

    Common Problem 2: FIXME: Chris should add a section about - common problems porting to a new architecture, including changes you - might have to make to the gcc/gcc/config/name-of-cpu - directory. For example (expand these):

    +

    Porting to a new architecture: If you are porting the new front-end + to a new architecture, or compiling in a different configuration that we have + previously, there are probably several changes you will have to make to the GCC + target to get it to work correctly. These include:

      -
    • Munge linker flags so they are compatible with gccld.
    • -
    • Change the target so it doesn't have long double; just use double - instead.
    • -
    • No inline assembly for position independent code.
    • -
    • We handle init and fini differently.
    • -
    • Do not include inline assembly map things for SPARC, or profile - things.
    • +
    • Often targets include special or assembler linker flags which + gccas/gccld does not understand. In general, these can + just be removed.
    • +
    • LLVM currently does not support any floating point values other than + 32-bit and 64-bit IEEE floating point. The primary effect of this is + that you may have to map "long double" onto "double".
    • +
    • The profiling hooks in GCC do not apply at all to the LLVM front-end. + These may need to be disabled.
    • +
    • No inline assembly for position independent code. At the LLVM level, + everything is position independent.
    • +
    • We handle .init and .fini differently.
    • +
    • Did we mention that we don't support inline assembly? You'll probably + have to add some fixinclude hacks to disable it in the system + headers.
    @@ -129,8 +136,8 @@
  • Test the newly-installed C frontend by one or more of the following means:

      -
    • compiling and running a "hello, world" program in C or C++.
    • -
    • running the tests under test/Programs using gmake -C +
    • compiling and running a "hello, LLVM" program in C and C++.
    • +
    • running the tests under test/Programs using gmake -C test/Programs

    @@ -142,7 +149,7 @@
    Brian Gaeke
    -Last modified: $Date: 2003/10/23 01:48:33 $ +Last modified: $Date: 2003/10/23 03:55:23 $
    From gaeke at cs.uiuc.edu Wed Oct 22 23:02:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Wed Oct 22 23:02:01 2003 Subject: [llvm-commits] CVS: llvm/include/llvm/SymbolTable.h Message-ID: <200310230401.XAA00811@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: SymbolTable.h updated: 1.26 -> 1.27 --- Log message: Fix apparent typo in head-of-file comment. --- Diffs of the changes: (+1 -1) Index: llvm/include/llvm/SymbolTable.h diff -u llvm/include/llvm/SymbolTable.h:1.26 llvm/include/llvm/SymbolTable.h:1.27 --- llvm/include/llvm/SymbolTable.h:1.26 Mon Oct 20 15:19:14 2003 +++ llvm/include/llvm/SymbolTable.h Wed Oct 22 23:01:49 2003 @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// // -// This file implements a symbol table that has planed broken up by type. +// This file implements a symbol table that has planes broken up by type. // Identical types may have overlapping symbol names as long as they are // distinct. // From lattner at cs.uiuc.edu Wed Oct 22 23:16:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Oct 22 23:16:01 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/External/SPEC/CINT2000/252.eon/Makefile Message-ID: <200310230415.XAA01075@zion.cs.uiuc.edu> Changes in directory llvm/test/Programs/External/SPEC/CINT2000/252.eon: Makefile updated: 1.3 -> 1.4 --- Log message: Link in the standard C++ library --- Diffs of the changes: (+3 -3) Index: llvm/test/Programs/External/SPEC/CINT2000/252.eon/Makefile diff -u llvm/test/Programs/External/SPEC/CINT2000/252.eon/Makefile:1.3 llvm/test/Programs/External/SPEC/CINT2000/252.eon/Makefile:1.4 --- llvm/test/Programs/External/SPEC/CINT2000/252.eon/Makefile:1.3 Thu Oct 2 14:45:24 2003 +++ llvm/test/Programs/External/SPEC/CINT2000/252.eon/Makefile Wed Oct 22 23:15:23 2003 @@ -5,9 +5,6 @@ # Yes, we know this is an old crufty C++ benchmark. Don't tell us about it GCC! CPPFLAGS = -Wno-deprecated -Wno-non-template-friend -DHAS_ERRLIST -DSPEC_STDCPP -DNDEBUG -LDFLAGS = -lstdc++ -LIBS = -lsupc++ - Source = $(addprefix $(SPEC_BENCH_DIR)/src/, \ ggCoverageSolidTexture.cc ggPathDielectricMaterial.cc ggBox2.cc \ @@ -53,3 +50,6 @@ mrSolidTexture.cc mrSphere.cc mrSurface.cc mrSurfaceTexture.cc \ mrXYRectangle.cc mrXZRectangle.cc mrYZRectangle.cc myrand.cc) include ../../Makefile.spec +LDFLAGS = -lstdc++ +LIBS = -lstdc++ + From lattner at cs.uiuc.edu Thu Oct 23 00:12:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Oct 23 00:12:02 2003 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/InstCombine/2003-10-23-InstcombineNullFail.ll Message-ID: <200310230511.AAA08896@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/InstCombine: 2003-10-23-InstcombineNullFail.ll added (r1.1) --- Log message: A new testcase for an instcombine miscompilation! --- Diffs of the changes: (+10 -0) Index: llvm/test/Regression/Transforms/InstCombine/2003-10-23-InstcombineNullFail.ll diff -c /dev/null llvm/test/Regression/Transforms/InstCombine/2003-10-23-InstcombineNullFail.ll:1.1 *** /dev/null Thu Oct 23 00:11:04 2003 --- llvm/test/Regression/Transforms/InstCombine/2003-10-23-InstcombineNullFail.ll Thu Oct 23 00:10:53 2003 *************** *** 0 **** --- 1,10 ---- + ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep false + %X = type { [10 x int], float } + + implementation + + bool %test() { + %A = getelementptr %X* null, long 0, ubyte 0, long 0 + %B = setne int* %A, null + ret bool %B + } From lattner at cs.uiuc.edu Thu Oct 23 00:22:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Oct 23 00:22:01 2003 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Constants.cpp Message-ID: <200310230521.AAA11110@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Constants.cpp updated: 1.59 -> 1.60 --- Log message: Fix bug: instcombine/2003-10-23-InstcombineNullFail.ll --- Diffs of the changes: (+11 -0) Index: llvm/lib/VMCore/Constants.cpp diff -u llvm/lib/VMCore/Constants.cpp:1.59 llvm/lib/VMCore/Constants.cpp:1.60 --- llvm/lib/VMCore/Constants.cpp:1.59 Tue Oct 21 12:39:59 2003 +++ llvm/lib/VMCore/Constants.cpp Thu Oct 23 00:21:48 2003 @@ -975,6 +975,17 @@ const Type *Ty = GetElementPtrInst::getIndexedType(C->getType(), VIdxList, true); assert(Ty && "GEP indices invalid!"); + + if (C->isNullValue()) { + bool isNull = true; + for (unsigned i = 0, e = IdxList.size(); i != e; ++i) + if (!IdxList[i]->isNullValue()) { + isNull = false; + break; + } + if (isNull) return ConstantPointerNull::get(PointerType::get(Ty)); + } + return getGetElementPtrTy(PointerType::get(Ty), C, IdxList); } From criswell at cs.uiuc.edu Thu Oct 23 09:13:12 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Thu Oct 23 09:13:12 2003 Subject: [llvm-commits] CVS: llvm/test/Makefile Message-ID: <200310231412.JAA08690@choi.cs.uiuc.edu> Changes in directory llvm/test: Makefile updated: 1.46 -> 1.47 --- Log message: Do not report errors if QMTest returns a non-zero value. --- Diffs of the changes: (+2 -2) Index: llvm/test/Makefile diff -u llvm/test/Makefile:1.46 llvm/test/Makefile:1.47 --- llvm/test/Makefile:1.46 Fri Oct 10 19:10:05 2003 +++ llvm/test/Makefile Thu Oct 23 09:11:53 2003 @@ -42,10 +42,10 @@ # Execute the tests # qmtest:: $(LLVM_OBJ_ROOT)/test/tmp register - $(QMTEST) run -O $(LLVM_SRC_ROOT)/test/QMTest/expectations.qmr $(CONTEXT) + -$(QMTEST) run -O $(LLVM_SRC_ROOT)/test/QMTest/expectations.qmr $(CONTEXT) %.t:: $(LLVM_OBJ_ROOT)/test/tmp register - $(QMTEST) run -O $(LLVM_SRC_ROOT)/test/QMTest/expectations.qmr $(CONTEXT) $* + -$(QMTEST) run -O $(LLVM_SRC_ROOT)/test/QMTest/expectations.qmr $(CONTEXT) $* # # Create the temporary directory used by the test suite. From criswell at cs.uiuc.edu Thu Oct 23 10:13:01 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Thu Oct 23 10:13:01 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/SingleSource/CustomChecked/Makefile Message-ID: <200310231512.KAA13270@choi.cs.uiuc.edu> Changes in directory llvm/test/Programs/SingleSource/CustomChecked: Makefile updated: 1.8 -> 1.9 --- Log message: Added full pathname to programs run with the TestRunner script. --- Diffs of the changes: (+4 -4) Index: llvm/test/Programs/SingleSource/CustomChecked/Makefile diff -u llvm/test/Programs/SingleSource/CustomChecked/Makefile:1.8 llvm/test/Programs/SingleSource/CustomChecked/Makefile:1.9 --- llvm/test/Programs/SingleSource/CustomChecked/Makefile:1.8 Sat Oct 18 01:35:46 2003 +++ llvm/test/Programs/SingleSource/CustomChecked/Makefile Thu Oct 23 10:12:18 2003 @@ -35,19 +35,19 @@ $(PROGRAMS_TO_TEST:%=Output/%.run-lli): \ Output/%.run-lli: Output/%.llvm.bc $(LLI) - -$(TESTRUNR) $(filter $*.%, $(Source)) "$(LLI) $(LLI_OPTS) $<" $@ + -$(TESTRUNR) $(SourceDir)/$(filter $*.%, $(Source)) "$(LLI) $(LLI_OPTS) $<" $@ $(PROGRAMS_TO_TEST:%=Output/%.run-jit): \ Output/%.run-jit: Output/%.llvm.bc $(LLI) - -$(TESTRUNR) $(filter $*.%, $(Source)) "$(LLI) $(JIT_OPTS) $<" $@ + -$(TESTRUNR) $(SourceDir)/$(filter $*.%, $(Source)) "$(LLI) $(JIT_OPTS) $<" $@ $(PROGRAMS_TO_TEST:%=Output/%.run-llc): \ Output/%.run-llc: Output/%.llc - -$(TESTRUNR) $(filter $*.%, $(Source)) "$< $(RUN_OPTIONS)" $@ + -$(TESTRUNR) $(SourceDir)/$(filter $*.%, $(Source)) "$< $(RUN_OPTIONS)" $@ $(PROGRAMS_TO_TEST:%=Output/%.run-cbe): \ Output/%.run-cbe: Output/%.cbe - -$(TESTRUNR) $(filter $*.%, $(Source)) "$< $(RUN_OPTIONS)" $@ + -$(TESTRUNR) $(SourceDir)/$(filter $*.%, $(Source)) "$< $(RUN_OPTIONS)" $@ $(PROGRAMS_TO_TEST:%=Output/%.exe-lli): \ From lattner at cs.uiuc.edu Thu Oct 23 10:44:03 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Oct 23 10:44:03 2003 Subject: [llvm-commits] CVS: llvm/tools/bugpoint/ExtractFunction.cpp Message-ID: <200310231543.KAA28134@zion.cs.uiuc.edu> Changes in directory llvm/tools/bugpoint: ExtractFunction.cpp updated: 1.16 -> 1.17 --- Log message: Fix an assertion failure in Bugpoint --- Diffs of the changes: (+6 -0) Index: llvm/tools/bugpoint/ExtractFunction.cpp diff -u llvm/tools/bugpoint/ExtractFunction.cpp:1.16 llvm/tools/bugpoint/ExtractFunction.cpp:1.17 --- llvm/tools/bugpoint/ExtractFunction.cpp:1.16 Mon Oct 20 12:57:13 2003 +++ llvm/tools/bugpoint/ExtractFunction.cpp Thu Oct 23 10:42:55 2003 @@ -22,6 +22,7 @@ #include "llvm/Transforms/IPO.h" #include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Utils/Cloning.h" +#include "llvm/Target/TargetData.h" #include "Support/CommandLine.h" bool DisableSimplifyCFG = false; @@ -72,6 +73,9 @@ // Spiff up the output a little bit. PassManager Passes; + // Make sure that the appropriate target data is always used... + Passes.add(new TargetData("bugpoint", Result)); + if (Simplification > 2 && !NoADCE) Passes.add(createAggressiveDCEPass()); // Remove dead code... //Passes.add(createInstructionCombiningPass()); @@ -104,6 +108,8 @@ I->setLinkage(GlobalValue::ExternalLinkage); PassManager CleanupPasses; + // Make sure that the appropriate target data is always used... + CleanupPasses.add(new TargetData("bugpoint", M)); CleanupPasses.add(createFunctionResolvingPass()); CleanupPasses.add(createGlobalDCEPass()); CleanupPasses.add(createDeadTypeEliminationPass()); From lattner at cs.uiuc.edu Thu Oct 23 10:47:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Oct 23 10:47:01 2003 Subject: [llvm-commits] CVS: llvm/test/Regression/Analysis/LoopInfo/2003-05-15-NestingProblem.ll Message-ID: <200310231546.KAA28184@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Analysis/LoopInfo: 2003-05-15-NestingProblem.ll updated: 1.1 -> 1.2 --- Log message: Fix buggy test --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Analysis/LoopInfo/2003-05-15-NestingProblem.ll diff -u llvm/test/Regression/Analysis/LoopInfo/2003-05-15-NestingProblem.ll:1.1 llvm/test/Regression/Analysis/LoopInfo/2003-05-15-NestingProblem.ll:1.2 --- llvm/test/Regression/Analysis/LoopInfo/2003-05-15-NestingProblem.ll:1.1 Thu May 15 13:03:03 2003 +++ llvm/test/Regression/Analysis/LoopInfo/2003-05-15-NestingProblem.ll Thu Oct 23 10:46:42 2003 @@ -1,7 +1,7 @@ ; This testcase was incorrectly computing that the loopentry.7 loop was ; not a child of the loopentry.6 loop. ; -; RUN: analyze %s -loops | grep "^ Loop Containing: %loopentry.7" +; RUN: analyze %s -loops | grep "^ Loop Containing: %loopentry.7" void %getAndMoveToFrontDecode() { ; No predecessors! br label %endif.2 From lattner at cs.uiuc.edu Thu Oct 23 10:48:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Oct 23 10:48:01 2003 Subject: [llvm-commits] CVS: llvm/test/Regression/Assembler/2003-04-15-ConstantInitAssertion.llx Message-ID: <200310231547.KAA28222@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Assembler: 2003-04-15-ConstantInitAssertion.llx updated: 1.1 -> 1.2 --- Log message: Fix test --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Assembler/2003-04-15-ConstantInitAssertion.llx diff -u llvm/test/Regression/Assembler/2003-04-15-ConstantInitAssertion.llx:1.1 llvm/test/Regression/Assembler/2003-04-15-ConstantInitAssertion.llx:1.2 --- llvm/test/Regression/Assembler/2003-04-15-ConstantInitAssertion.llx:1.1 Tue Apr 15 11:07:05 2003 +++ llvm/test/Regression/Assembler/2003-04-15-ConstantInitAssertion.llx Thu Oct 23 10:47:23 2003 @@ -1,4 +1,4 @@ -; RUN: (as < %s 2>&1) | grep Expected +; RUN: (llvm-as < %s 2>&1) | grep Expected ; Test the case of a misformed constant initializer ; This should cause an assembler error, not an assertion failure! %X = constant {int} { float 1.0 } From lattner at cs.uiuc.edu Thu Oct 23 10:53:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Oct 23 10:53:01 2003 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/ADCE/2002-07-29-Segfault.ll Message-ID: <200310231552.KAA28318@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/ADCE: 2002-07-29-Segfault.ll updated: 1.1 -> 1.2 --- Log message: Fix test --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Transforms/ADCE/2002-07-29-Segfault.ll diff -u llvm/test/Regression/Transforms/ADCE/2002-07-29-Segfault.ll:1.1 llvm/test/Regression/Transforms/ADCE/2002-07-29-Segfault.ll:1.2 --- llvm/test/Regression/Transforms/ADCE/2002-07-29-Segfault.ll:1.1 Mon Jul 29 14:02:49 2002 +++ llvm/test/Regression/Transforms/ADCE/2002-07-29-Segfault.ll Thu Oct 23 10:51:55 2003 @@ -1,4 +1,4 @@ -; RUN: as < %s | opt -adce +; RUN: llvm-as < %s | opt -adce void "test"() begin From criswell at cs.uiuc.edu Thu Oct 23 10:55:01 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Thu Oct 23 10:55:01 2003 Subject: [llvm-commits] CVS: llvm/test/QMTest/expectations.qmr Message-ID: <200310231553.KAA14571@choi.cs.uiuc.edu> Changes in directory llvm/test/QMTest: expectations.qmr updated: 1.3 -> 1.4 --- Log message: Bugpoint tests now pass and are now expected to do so. --- Diffs of the changes: (+1 -1) Index: llvm/test/QMTest/expectations.qmr diff -u llvm/test/QMTest/expectations.qmr:1.3 llvm/test/QMTest/expectations.qmr:1.4 --- llvm/test/QMTest/expectations.qmr:1.3 Wed Oct 22 16:52:03 2003 +++ llvm/test/QMTest/expectations.qmr Thu Oct 23 10:53:48 2003 @@ -3,13 +3,13 @@ qoq}q(U _Result__kindqUtestqU_Result__outcomeqUPASSqU_Result__annotationsq}U _Result__idq U0Regression.Assembler.2002-08-16-ConstExprInlinedq U_Result__contextq (cqm.test.context Context -q o}q (U_Context__propertiesq}U_Context__temporariesq}ubub.(hoq}q(hhhhh}h U(Regression.Transforms.PruneEH.simpletestqh (h o}q(h}h}ubub.(hoq}q(hhhhh}h U/Regression.CBackend.2002-08-19-HardConstantExprqh (h o}q(h}h}ubub.(hoq}q(hhhhh}h URegression.Jello.test-shiftqh (h o}q(h}h}ubub.(hoq}q(hhhhh}h U9Regression.Transforms.Mem2Reg.2003-10-05-DeadPHIInsertionqh (h o}q(h}h}ubub.(hoq }q!(hhhUFAILq"h}h U.Regression.Transforms.CorrelatedExprs.looptestq#h (h o}q$(h}h}ubub.(hoq%}q&(hhhhh}h U-Regression.Linker.2003-08-23-GlobalVarLinkingq'h (h o}q((h}h}ubub.(hoq)}q*(hhhhh}h U?Regression.Transforms.Inline.2003-09-22-PHINodesInExceptionDestq+h (h o}q,(h}h}ubub.(hoq-}q.(hhhh"h}h U,Regression.CFrontend.2003-02-12-NonlocalGotoq/h (h o}q0(h}h}ubub.(hoq1}q2(hhhhh}h U2Regression.Transforms.FunctionResolve.retmismatch1q3h (h o}q4(h}h}ubub.(hoq5}q6(hhhhh}h U,Regression.Transforms.DSAnalysis.indcalltes! tq7h (h o}q8(h}h}ubub.(hoq9}q:(hhhhh}h U8Regression.Transforms.ADCE.2003-01-22-PredecessorProblemq;h (h o}q<(h}h}ubub.(hoq=}q>(hhhhh}h U=Regression.Transforms.LevelRaise.2002-10-08-VarArgCallInfLoopq?h (h o}q@(h}h}ubub.(hoqA}qB(hhhhh}h U Regression.Reoptimizer.ticm.ticmqCh (h o}qD(h}h}ubub.(hoqE}qF(hhhhh}h U8Regression.C++Frontend.2003-09-29-ArgumentNumberMismatchqGh (h o}qH(h}h}ubub.(hoqI}qJ(hhhhh}h U+Regression.CFrontend.2002-09-19-StarInLabelqKh (h o}qL(h}h}ubub.(hoqM}qN(hhhhh}h U.Regression.CFrontend.2003-08-23-LocalUnionTestqOh (h o}qP(h}h}ubub.(hoqQ}qR(hhhhh}h U/Regression.Linker.2003-04-26-NullPtrLinkProblemqSh (h o}qT(h}h}ubub.(hoqU}qV(hhhhh}h U)Regression.Transforms.Reassociate.subtestqWh (h o}qX(h}h}ubub.(hoqY}qZ(hhhhh}h U)Regression.Linker.2002-08-20-ConstantExprq[h (h o}q\(h}h}ubub.(hoq]}q^(hhhhh}h U=Regression.Transforms.Reassociate.2002-05-15-AgressiveSubMoveq_h (h o}q`(h}h}ubub.! (hoqa}qb(hhhhh}h UARegression.Transforms.CorrelatedExprs.2002-10 -07-DominatorProblemqch (h o}qd(h}h}ubub.(hoqe}qf(hhhhh}h U3Regression.Transforms.PiNodeInserter.substitutetestqgh (h o}qh(h}h}ubub.(hoqi}qj(hhhhh}h U4Regression.Transforms.SCCP.2003-08-26-InvokeHandlingqkh (h o}ql(h}h}ubub.(hoqm}qn(hhhhh}h U-Regression.CFrontend.2002-02-18-64bitConstantqoh (h o}qp(h}h}ubub.(hoqq}qr(hhhhh}h U1Regression.Assembler.2002-04-04-PureVirtMethCall2qsh (h o}qt(h}h}ubub.(hoqu}qv(hhhhh}h U(Regression.Reoptimizer.BinInterface.testqwh (h o}qx(h}h}ubub.(hoqy}qz(hhhhh}h U(hhhhh}h U8Regression.C++Frontend.2003-09-29-ArgumentNumberMismatchq?h (h o}q@(h}h}ubub.(hoqA}qB(hhhhh}h U+Regression.CFrontend.2002-09-19-StarInLabelqCh (h o}qD(h}h}ubub.(hoqE}qF(hhhhh}h U.Regression.CFrontend.2003-08-23-LocalUnionTestqGh (h o}qH(h}h}ubub.(hoqI}qJ(hhhhh}h U-Regression.C++Frontend.2003-08-28-SaveExprBugqKh (h o}qL(h}h}ubub.(hoqM}qN(hhhhh}h U"Regression.Jello.2003-06-05-PHIBugqOh (h o}qP(h}h}ubub.(hoqQ}qR(hhhhh}h U/Regression.Linker.2003-04-26-NullPtrLinkProblemqSh (h o}qT(h}h}ubub.(hoqU}qV(hhhhh}h U)Regression.Transforms.Reassociate.subtestqWh (h o}qX(h}h}ubub.(hoqY}qZ(hhhhh}h U)Regression.Linker.2002-08-20-ConstantExprq[h (h o}q\(h}h}ubub.(hoq]}q^(hhhhh}h U=Regression.Transforms.Reassociate.2002-05-15-AgressiveSubMoveq_h (h o}q`(h}h}ubub.(! hoqa}qb(hhhhh}h UARegression.Transforms.CorrelatedExprs.2002-10- 07-DominatorProblemqch (h o}qd(h}h}ubub.(hoqe}qf(hhhhh}h U3Regression.Transforms.PiNodeInserter.substitutetestqgh (h o}qh(h}h}ubub.(hoqi}qj(hhhhh}h U4Regression.Transforms.SCCP.2003-08-26-InvokeHandlingqkh (h o}ql(h}h}ubub.(hoqm}qn(hhhhh}h U$Regression.Jello.2003-01-04-LoopTestqoh (h o}qp(h}h}ubub.(hoqq}qr(hhhhh}h U1Regression.Assembler.2002-04-04-PureVirtMethCall2qsh (h o}qt(h}h}ubub.(hoqu}qv(hhhhh}h U)Regression.CFrontend.2002-07-14-MiscTestsqwh (h o}qx(h}h}ubub.(hoqy}qz(hhhhh}h U Changes in directory llvm/test/Regression/Transforms/LowerSetJmp: simpletest.ll updated: 1.2 -> 1.3 --- Log message: fix test --- Diffs of the changes: (+3 -0) Index: llvm/test/Regression/Transforms/LowerSetJmp/simpletest.ll diff -u llvm/test/Regression/Transforms/LowerSetJmp/simpletest.ll:1.2 llvm/test/Regression/Transforms/LowerSetJmp/simpletest.ll:1.3 --- llvm/test/Regression/Transforms/LowerSetJmp/simpletest.ll:1.2 Tue Sep 16 10:29:39 2003 +++ llvm/test/Regression/Transforms/LowerSetJmp/simpletest.ll Thu Oct 23 10:57:45 2003 @@ -8,12 +8,15 @@ declare void %llvm.longjmp(%JmpBuf *%B, int %Val) declare int %llvm.setjmp(%JmpBuf *%B) +declare void %foo() + int %simpletest() { %B = alloca %JmpBuf %Val = call int %llvm.setjmp(%JmpBuf* %B) %V = cast int %Val to bool br bool %V, label %LongJumped, label %Normal Normal: + call void %foo() call void %llvm.longjmp(%JmpBuf* %B, int 42) ret int 0 ;; not reached LongJumped: From criswell at cs.uiuc.edu Thu Oct 23 10:59:03 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Thu Oct 23 10:59:03 2003 Subject: [llvm-commits] CVS: llvm/LICENSE.TXT Message-ID: <200310231558.KAA14598@choi.cs.uiuc.edu> Changes in directory llvm: LICENSE.TXT updated: 1.1 -> 1.2 --- Log message: Added new license information in preparation for LLVM 1.0. --- Diffs of the changes: (+65 -1) Index: llvm/LICENSE.TXT diff -u llvm/LICENSE.TXT:1.1 llvm/LICENSE.TXT:1.2 --- llvm/LICENSE.TXT:1.1 Wed Jun 4 14:46:36 2003 +++ llvm/LICENSE.TXT Thu Oct 23 10:57:59 2003 @@ -1,4 +1,17 @@ -LLVM pre-release license: +NOTICE: +======= +All distributions of LLVM prior to the 1.0 Release will be licensed to you +under the LLVM pre-release license. The 1.0 Release will be announced on the +LLVM Announcements Mailing List. + +After the 1.0 Release of LLVM, the LLVM code will be licensed to you under the +LLVM Release License (aka the Illinois Open Source License). + +The main point is that you cannot re-distribute LLVM until the 1.0 Release. + +============================================================================== +LLVM pre-release license +============================================================================== This is a pre-release distribution of the LLVM software and is provided for evaluation only. This version of the LLVM software or modifications thereof @@ -17,3 +30,54 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE. + +============================================================================== +LLVM Release License +============================================================================== +University of Illinois/NCSA +Open Source License + +Copyright ? 2003, University of Illinois at Urbana-Champaign. All rights reserved. + +Developed by: + + LLVM Team + + University of Illinois at Urbana-Champaign + + http://llvm.cs.uiuc.edu + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal with +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimers. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimers in the + documentation and/or other materials provided with the distribution. + + * Neither the names of the LLVM Team, University of Illinois at + Urbana-Champaign, nor the names of its contributors may be used to + endorse or promote products derived from this Software without specific + prior written permission. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE +SOFTWARE. + +============================================================================== +Copyrights and Licenses for Third Party Software Distributed with LLVM: +============================================================================== +The LLVM software contains code written by third parties. Such software will +have its own individual LICENSE.TXT file in the directory in which it appears. +This file will describe the copyrights, license, and restrictions which apply +to that code. From lattner at cs.uiuc.edu Thu Oct 23 11:01:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Oct 23 11:01:02 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/SingleSource/Regression/C/2003-10-13-PointerIncrementTest.c Message-ID: <200310231600.LAA28468@zion.cs.uiuc.edu> Changes in directory llvm/test/Programs/SingleSource/Regression/C: 2003-10-13-PointerIncrementTest.c updated: 1.2 -> 1.3 --- Log message: return zero on success --- Diffs of the changes: (+1 -0) Index: llvm/test/Programs/SingleSource/Regression/C/2003-10-13-PointerIncrementTest.c diff -u llvm/test/Programs/SingleSource/Regression/C/2003-10-13-PointerIncrementTest.c:1.2 llvm/test/Programs/SingleSource/Regression/C/2003-10-13-PointerIncrementTest.c:1.3 --- llvm/test/Programs/SingleSource/Regression/C/2003-10-13-PointerIncrementTest.c:1.2 Mon Oct 13 23:20:04 2003 +++ llvm/test/Programs/SingleSource/Regression/C/2003-10-13-PointerIncrementTest.c Thu Oct 23 11:00:28 2003 @@ -9,4 +9,5 @@ *((int*)Pointer)++; printf("0x%d\n", (int)Pointer-(int)&Array[0]); } + return 0; } From lattner at cs.uiuc.edu Thu Oct 23 11:01:23 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Oct 23 11:01:23 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/SingleSource/Gizmos/sumarray.c Message-ID: <200310231600.LAA28454@zion.cs.uiuc.edu> Changes in directory llvm/test/Programs/SingleSource/Gizmos: sumarray.c updated: 1.1 -> 1.2 --- Log message: Fix test to return 0 on success --- Diffs of the changes: (+3 -1) Index: llvm/test/Programs/SingleSource/Gizmos/sumarray.c diff -u llvm/test/Programs/SingleSource/Gizmos/sumarray.c:1.1 llvm/test/Programs/SingleSource/Gizmos/sumarray.c:1.2 --- llvm/test/Programs/SingleSource/Gizmos/sumarray.c:1.1 Fri Dec 14 10:13:38 2001 +++ llvm/test/Programs/SingleSource/Gizmos/sumarray.c Thu Oct 23 10:59:59 2003 @@ -1,4 +1,5 @@ #include +#include int SumArray(int Array[], int Num) { unsigned i, Result = 0; @@ -19,5 +20,6 @@ for (i = 1; i < 100; i += 2) Array[i] = i*2; - return SumArray(Array, 100); + printf("Produced: %d\n", SumArray(Array, 100)); + return 0; } From lattner at cs.uiuc.edu Thu Oct 23 11:02:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Oct 23 11:02:01 2003 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/FunctionResolve/2003-05-31-InternalDecl.ll Message-ID: <200310231601.LAA28506@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/FunctionResolve: 2003-05-31-InternalDecl.ll updated: 1.3 -> 1.4 --- Log message: Update test --- Diffs of the changes: (+1 -1) Index: llvm/test/Regression/Transforms/FunctionResolve/2003-05-31-InternalDecl.ll diff -u llvm/test/Regression/Transforms/FunctionResolve/2003-05-31-InternalDecl.ll:1.3 llvm/test/Regression/Transforms/FunctionResolve/2003-05-31-InternalDecl.ll:1.4 --- llvm/test/Regression/Transforms/FunctionResolve/2003-05-31-InternalDecl.ll:1.3 Tue Sep 16 10:29:26 2003 +++ llvm/test/Regression/Transforms/FunctionResolve/2003-05-31-InternalDecl.ll Thu Oct 23 11:01:03 2003 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -funcresolve | llvm-dis | not grep declare +; RUN: llvm-as < %s | opt -funcresolve | llvm-dis | grep declare declare void %test(...) From lattner at cs.uiuc.edu Thu Oct 23 11:02:13 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Oct 23 11:02:13 2003 Subject: [llvm-commits] CVS: llvm/test/Regression/CBackend/2002-08-26-IndirectCallTest.ll Message-ID: <200310231601.LAA28499@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CBackend: 2002-08-26-IndirectCallTest.ll updated: 1.1 -> 1.2 --- Log message: Update test --- Diffs of the changes: (+2 -2) Index: llvm/test/Regression/CBackend/2002-08-26-IndirectCallTest.ll diff -u llvm/test/Regression/CBackend/2002-08-26-IndirectCallTest.ll:1.1 llvm/test/Regression/CBackend/2002-08-26-IndirectCallTest.ll:1.2 --- llvm/test/Regression/CBackend/2002-08-26-IndirectCallTest.ll:1.1 Mon Aug 26 15:49:42 2002 +++ llvm/test/Regression/CBackend/2002-08-26-IndirectCallTest.ll Thu Oct 23 11:01:02 2003 @@ -5,8 +5,8 @@ void %test(int %X) { %Y = add int %X, -1 ; :1 [#uses=3] - %cast100 = cast int %Y to uint ; [#uses=1] - %gep100 = getelementptr int** %taskArray, uint %cast100 ; [#uses=1] + %cast100 = cast int %Y to long ; [#uses=1] + %gep100 = getelementptr int** %taskArray, long %cast100 ; [#uses=1] %fooPtr = load int** %gep100 ; [#uses=1] %cast101 = cast int* %fooPtr to void (int)* ; [#uses=1] call void %cast101( int 1000 ) From lattner at cs.uiuc.edu Thu Oct 23 11:02:24 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Oct 23 11:02:24 2003 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/InstCombine/2003-10-23-InstcombineNullFail.ll Message-ID: <200310231601.LAA28490@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/InstCombine: 2003-10-23-InstcombineNullFail.ll updated: 1.1 -> 1.2 --- Log message: document real source of bug --- Diffs of the changes: (+3 -0) Index: llvm/test/Regression/Transforms/InstCombine/2003-10-23-InstcombineNullFail.ll diff -u llvm/test/Regression/Transforms/InstCombine/2003-10-23-InstcombineNullFail.ll:1.1 llvm/test/Regression/Transforms/InstCombine/2003-10-23-InstcombineNullFail.ll:1.2 --- llvm/test/Regression/Transforms/InstCombine/2003-10-23-InstcombineNullFail.ll:1.1 Thu Oct 23 00:10:53 2003 +++ llvm/test/Regression/Transforms/InstCombine/2003-10-23-InstcombineNullFail.ll Thu Oct 23 11:00:59 2003 @@ -1,4 +1,7 @@ ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep false +; +; This actually looks like a constant propagation bug + %X = type { [10 x int], float } implementation From brukman at cs.uiuc.edu Thu Oct 23 11:20:01 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Thu Oct 23 11:20:01 2003 Subject: [llvm-commits] CVS: llvm/LICENSE.TXT Message-ID: <200310231619.LAA29368@zion.cs.uiuc.edu> Changes in directory llvm: LICENSE.TXT updated: 1.2 -> 1.3 --- Log message: * Stop referring to llvmbugs mailing list, point them to Bugzilla * Use ASCII (c) instead of the special character, which may not display correctly for everyone * Wrap at 80 columns --- Diffs of the changes: (+7 -5) Index: llvm/LICENSE.TXT diff -u llvm/LICENSE.TXT:1.2 llvm/LICENSE.TXT:1.3 --- llvm/LICENSE.TXT:1.2 Thu Oct 23 10:57:59 2003 +++ llvm/LICENSE.TXT Thu Oct 23 11:18:51 2003 @@ -18,10 +18,11 @@ should not be distributed to third parties for any purpose. Any third parties interested in it can request a copy directly by sending e-mail to llvmdev at cs.uiuc.edu. As this is an evaluation release, we would appreciate any -and all feedback, ideas, and reports of bugs that you encounter. These can be -submitted through the llvmbugs at cs.uiuc.edu or llvmdev at cs.uiuc.edu mailing lists -as appropriate. We thank you for your interest in LLVM and look forward to any -comments or feedback you may have. +and all feedback, ideas, and reports of bugs that you encounter. You may +discuss development of LLVM on llvmdev at cs.uiuc.edu, and bugs can be submitted +through the LLVM Bug Tracker at http://llvm.cs.uiuc.edu/bugzilla/ . We thank +you for your interest in LLVM and look forward to any comments or feedback you +may have. THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS @@ -37,7 +38,8 @@ University of Illinois/NCSA Open Source License -Copyright ? 2003, University of Illinois at Urbana-Champaign. All rights reserved. +Copyright (c) 2003, University of Illinois at Urbana-Champaign. All rights +reserved. Developed by: From brukman at cs.uiuc.edu Thu Oct 23 11:23:02 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Thu Oct 23 11:23:02 2003 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/InstSelectSimple.cpp Message-ID: <200310231622.LAA30015@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: InstSelectSimple.cpp updated: 1.136 -> 1.137 --- Log message: * Order includes according to style guide * Convert tabs to spaces * Make code fit within 80 columns --- Diffs of the changes: (+106 -105) Index: llvm/lib/Target/X86/InstSelectSimple.cpp diff -u llvm/lib/Target/X86/InstSelectSimple.cpp:1.136 llvm/lib/Target/X86/InstSelectSimple.cpp:1.137 --- llvm/lib/Target/X86/InstSelectSimple.cpp:1.136 Mon Oct 20 14:43:18 2003 +++ llvm/lib/Target/X86/InstSelectSimple.cpp Thu Oct 23 11:22:08 2003 @@ -12,21 +12,21 @@ //===----------------------------------------------------------------------===// #include "X86.h" -#include "X86InstrInfo.h" #include "X86InstrBuilder.h" +#include "X86InstrInfo.h" +#include "llvm/Constants.h" +#include "llvm/DerivedTypes.h" #include "llvm/Function.h" #include "llvm/Instructions.h" -#include "llvm/DerivedTypes.h" -#include "llvm/Constants.h" -#include "llvm/Pass.h" #include "llvm/Intrinsics.h" +#include "llvm/Pass.h" +#include "llvm/CodeGen/MachineConstantPool.h" +#include "llvm/CodeGen/MachineFrameInfo.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineInstrBuilder.h" #include "llvm/CodeGen/SSARegMap.h" -#include "llvm/CodeGen/MachineFrameInfo.h" -#include "llvm/CodeGen/MachineConstantPool.h" -#include "llvm/Target/TargetMachine.h" #include "llvm/Target/MRegisterInfo.h" +#include "llvm/Target/TargetMachine.h" #include "llvm/Support/InstVisitor.h" /// BMI - A special BuildMI variant that takes an iterator to insert the @@ -136,7 +136,7 @@ ValueRecord(Value *V) : Val(V), Reg(0), Ty(V->getType()) {} }; void doCall(const ValueRecord &Ret, MachineInstr *CallMI, - const std::vector &Args); + const std::vector &Args); void visitCallInst(CallInst &I); void visitIntrinsicCall(LLVMIntrinsic::ID ID, CallInst &I); @@ -146,7 +146,7 @@ void visitSub(BinaryOperator &B) { visitSimpleBinary(B, 1); } void doMultiply(MachineBasicBlock *MBB, MachineBasicBlock::iterator &MBBI, unsigned DestReg, const Type *DestTy, - unsigned Op0Reg, unsigned Op1Reg); + unsigned Op0Reg, unsigned Op1Reg); void doMultiplyConst(MachineBasicBlock *MBB, MachineBasicBlock::iterator &MBBI, unsigned DestReg, const Type *DestTy, @@ -244,11 +244,11 @@ const X86RegisterInfo *MRI = static_cast(TM.getRegisterInfo()); if (Ty == Type::LongTy || Ty == Type::ULongTy) { - const TargetRegisterClass *RC = MRI->getRegClassForType(Type::IntTy); - // Create the lower part - F->getSSARegMap()->createVirtualRegister(RC); - // Create the upper part. - return F->getSSARegMap()->createVirtualRegister(RC)-1; + const TargetRegisterClass *RC = MRI->getRegClassForType(Type::IntTy); + // Create the lower part + F->getSSARegMap()->createVirtualRegister(RC); + // Create the upper part. + return F->getSSARegMap()->createVirtualRegister(RC)-1; } // Add the mapping of regnumber => reg class to MachineFunction @@ -464,12 +464,12 @@ case cFP: unsigned Opcode; if (I->getType() == Type::FloatTy) { - Opcode = X86::FLDr32; - FI = MFI->CreateFixedObject(4, ArgOffset); + Opcode = X86::FLDr32; + FI = MFI->CreateFixedObject(4, ArgOffset); } else { - Opcode = X86::FLDr64; - FI = MFI->CreateFixedObject(8, ArgOffset); - ArgOffset += 4; // doubles require 4 additional bytes + Opcode = X86::FLDr64; + FI = MFI->CreateFixedObject(8, ArgOffset); + ArgOffset += 4; // doubles require 4 additional bytes } addFrameReference(BuildMI(BB, Opcode, 4, Reg), FI); break; @@ -510,8 +510,8 @@ MachineInstr *LongPhiMI = 0; if (PN->getType() == Type::LongTy || PN->getType() == Type::ULongTy) { - LongPhiMI = BuildMI(X86::PHI, PN->getNumOperands(), PHIReg+1); - MBB->insert(MBB->begin()+NumPHIs++, LongPhiMI); + LongPhiMI = BuildMI(X86::PHI, PN->getNumOperands(), PHIReg+1); + MBB->insert(MBB->begin()+NumPHIs++, LongPhiMI); } // PHIValues - Map of blocks to incoming virtual registers. We use this @@ -558,12 +558,12 @@ PHIValues.insert(EntryIt, std::make_pair(PredMBB, ValReg)); } - PhiMI->addRegOperand(ValReg); + PhiMI->addRegOperand(ValReg); PhiMI->addMachineBasicBlockOperand(PredMBB); - if (LongPhiMI) { - LongPhiMI->addRegOperand(ValReg+1); - LongPhiMI->addMachineBasicBlockOperand(PredMBB); - } + if (LongPhiMI) { + LongPhiMI->addRegOperand(ValReg+1); + LongPhiMI->addMachineBasicBlockOperand(PredMBB); + } } } } @@ -826,7 +826,8 @@ BuildMI(BB, X86::MOVrr32, 1, X86::EAX).addReg(RetReg); BuildMI(BB, X86::MOVrr32, 1, X86::EDX).addReg(RetReg+1); // Declare that EAX & EDX are live on exit - BuildMI(BB, X86::IMPLICIT_USE, 3).addReg(X86::EAX).addReg(X86::EDX).addReg(X86::ESP); + BuildMI(BB, X86::IMPLICIT_USE, 3).addReg(X86::EAX).addReg(X86::EDX) + .addReg(X86::ESP); break; default: visitInstruction(I); @@ -877,7 +878,7 @@ unsigned OpNum = getSetCCNumber(SCI->getOpcode()); MachineBasicBlock::iterator MII = BB->end(); - OpNum = EmitComparison(OpNum, SCI->getOperand(0), SCI->getOperand(1), BB, MII); + OpNum = EmitComparison(OpNum, SCI->getOperand(0), SCI->getOperand(1), BB,MII); const Type *CompTy = SCI->getOperand(0)->getType(); bool isSigned = CompTy->isSigned() && getClassB(CompTy) != cFP; @@ -920,7 +921,7 @@ /// it inserts the specified CallMI instruction into the stream. /// void ISel::doCall(const ValueRecord &Ret, MachineInstr *CallMI, - const std::vector &Args) { + const std::vector &Args) { // Count how many bytes are to be pushed on the stack... unsigned NumBytes = 0; @@ -929,12 +930,12 @@ for (unsigned i = 0, e = Args.size(); i != e; ++i) switch (getClassB(Args[i].Ty)) { case cByte: case cShort: case cInt: - NumBytes += 4; break; + NumBytes += 4; break; case cLong: - NumBytes += 8; break; + NumBytes += 8; break; case cFP: - NumBytes += Args[i].Ty == Type::FloatTy ? 4 : 8; - break; + NumBytes += Args[i].Ty == Type::FloatTy ? 4 : 8; + break; default: assert(0 && "Unknown class!"); } @@ -948,36 +949,36 @@ switch (getClassB(Args[i].Ty)) { case cByte: case cShort: { - // Promote arg to 32 bits wide into a temporary register... - unsigned R = makeAnotherReg(Type::UIntTy); - promote32(R, Args[i]); - addRegOffset(BuildMI(BB, X86::MOVrm32, 5), - X86::ESP, ArgOffset).addReg(R); - break; + // Promote arg to 32 bits wide into a temporary register... + unsigned R = makeAnotherReg(Type::UIntTy); + promote32(R, Args[i]); + addRegOffset(BuildMI(BB, X86::MOVrm32, 5), + X86::ESP, ArgOffset).addReg(R); + break; } case cInt: - addRegOffset(BuildMI(BB, X86::MOVrm32, 5), - X86::ESP, ArgOffset).addReg(ArgReg); - break; + addRegOffset(BuildMI(BB, X86::MOVrm32, 5), + X86::ESP, ArgOffset).addReg(ArgReg); + break; case cLong: - addRegOffset(BuildMI(BB, X86::MOVrm32, 5), - X86::ESP, ArgOffset).addReg(ArgReg); - addRegOffset(BuildMI(BB, X86::MOVrm32, 5), - X86::ESP, ArgOffset+4).addReg(ArgReg+1); - ArgOffset += 4; // 8 byte entry, not 4. - break; - + addRegOffset(BuildMI(BB, X86::MOVrm32, 5), + X86::ESP, ArgOffset).addReg(ArgReg); + addRegOffset(BuildMI(BB, X86::MOVrm32, 5), + X86::ESP, ArgOffset+4).addReg(ArgReg+1); + ArgOffset += 4; // 8 byte entry, not 4. + break; + case cFP: - if (Args[i].Ty == Type::FloatTy) { - addRegOffset(BuildMI(BB, X86::FSTr32, 5), - X86::ESP, ArgOffset).addReg(ArgReg); - } else { - assert(Args[i].Ty == Type::DoubleTy && "Unknown FP type!"); - addRegOffset(BuildMI(BB, X86::FSTr64, 5), - X86::ESP, ArgOffset).addReg(ArgReg); - ArgOffset += 4; // 8 byte entry, not 4. - } - break; + if (Args[i].Ty == Type::FloatTy) { + addRegOffset(BuildMI(BB, X86::FSTr32, 5), + X86::ESP, ArgOffset).addReg(ArgReg); + } else { + assert(Args[i].Ty == Type::DoubleTy && "Unknown FP type!"); + addRegOffset(BuildMI(BB, X86::FSTr64, 5), + X86::ESP, ArgOffset).addReg(ArgReg); + ArgOffset += 4; // 8 byte entry, not 4. + } + break; default: assert(0 && "Unknown class!"); } @@ -1003,7 +1004,7 @@ // Integral results are in %eax, or the appropriate portion // thereof. static const unsigned regRegMove[] = { - X86::MOVrr8, X86::MOVrr16, X86::MOVrr32 + X86::MOVrr8, X86::MOVrr16, X86::MOVrr32 }; static const unsigned AReg[] = { X86::AL, X86::AX, X86::EAX }; BuildMI(BB, regRegMove[DestClass], 1, Ret.Reg).addReg(AReg[DestClass]); @@ -1045,7 +1046,7 @@ unsigned DestReg = CI.getType() != Type::VoidTy ? getReg(CI) : 0; doCall(ValueRecord(DestReg, CI.getType()), TheCall, Args); -} +} void ISel::visitIntrinsicCall(LLVMIntrinsic::ID ID, CallInst &CI) { @@ -1320,14 +1321,14 @@ unsigned AHBLplusOverflowReg = makeAnotherReg(Type::UIntTy); BuildMI(BB, X86::ADDrr32, 2, // AH*BL+(AL*BL >> 32) - AHBLplusOverflowReg).addReg(AHBLReg).addReg(OverflowReg); + AHBLplusOverflowReg).addReg(AHBLReg).addReg(OverflowReg); MBBI = BB->end(); unsigned ALBHReg = makeAnotherReg(Type::UIntTy); // AL*BH BMI(BB, MBBI, X86::IMULrr32, 2, ALBHReg).addReg(Op0Reg).addReg(Op1Reg+1); BuildMI(BB, X86::ADDrr32, 2, // AL*BH + AH*BL + (AL*BL >> 32) - DestReg+1).addReg(AHBLplusOverflowReg).addReg(ALBHReg); + DestReg+1).addReg(AHBLplusOverflowReg).addReg(ALBHReg); } } @@ -1349,7 +1350,7 @@ BuildMI(BB, X86::FpDIV, 2, ResultReg).addReg(Op0Reg).addReg(Op1Reg); } else { // Floating point remainder... MachineInstr *TheCall = - BuildMI(X86::CALLpcrel32, 1).addExternalSymbol("fmod", true); + BuildMI(X86::CALLpcrel32, 1).addExternalSymbol("fmod", true); std::vector Args; Args.push_back(ValueRecord(I.getOperand(0))); Args.push_back(ValueRecord(I.getOperand(1))); @@ -1451,26 +1452,26 @@ if (ConstantUInt *CUI = dyn_cast(I.getOperand(1))) { unsigned Amount = CUI->getValue(); if (Amount < 32) { - const unsigned *Opc = ConstantOperand[isLeftShift*2+isSigned]; - if (isLeftShift) { - BuildMI(BB, Opc[3], 3, - DestReg+1).addReg(SrcReg+1).addReg(SrcReg).addZImm(Amount); - BuildMI(BB, Opc[2], 2, DestReg).addReg(SrcReg).addZImm(Amount); - } else { - BuildMI(BB, Opc[3], 3, - DestReg).addReg(SrcReg ).addReg(SrcReg+1).addZImm(Amount); - BuildMI(BB, Opc[2], 2, DestReg+1).addReg(SrcReg+1).addZImm(Amount); - } + const unsigned *Opc = ConstantOperand[isLeftShift*2+isSigned]; + if (isLeftShift) { + BuildMI(BB, Opc[3], 3, + DestReg+1).addReg(SrcReg+1).addReg(SrcReg).addZImm(Amount); + BuildMI(BB, Opc[2], 2, DestReg).addReg(SrcReg).addZImm(Amount); + } else { + BuildMI(BB, Opc[3], 3, + DestReg).addReg(SrcReg ).addReg(SrcReg+1).addZImm(Amount); + BuildMI(BB, Opc[2], 2, DestReg+1).addReg(SrcReg+1).addZImm(Amount); + } } else { // Shifting more than 32 bits - Amount -= 32; - if (isLeftShift) { - BuildMI(BB, X86::SHLir32, 2,DestReg+1).addReg(SrcReg).addZImm(Amount); - BuildMI(BB, X86::MOVir32, 1,DestReg ).addZImm(0); - } else { - unsigned Opcode = isSigned ? X86::SARir32 : X86::SHRir32; - BuildMI(BB, Opcode, 2, DestReg).addReg(SrcReg+1).addZImm(Amount); - BuildMI(BB, X86::MOVir32, 1, DestReg+1).addZImm(0); - } + Amount -= 32; + if (isLeftShift) { + BuildMI(BB, X86::SHLir32, 2,DestReg+1).addReg(SrcReg).addZImm(Amount); + BuildMI(BB, X86::MOVir32, 1,DestReg ).addZImm(0); + } else { + unsigned Opcode = isSigned ? X86::SARir32 : X86::SHRir32; + BuildMI(BB, Opcode, 2, DestReg).addReg(SrcReg+1).addZImm(Amount); + BuildMI(BB, X86::MOVir32, 1, DestReg+1).addZImm(0); + } } } else { unsigned TmpReg = makeAnotherReg(Type::IntTy); @@ -1697,17 +1698,17 @@ BMI(BB, IP, RegRegMove[SrcClass], 1, DestReg).addReg(SrcReg); } else if (SrcClass == cFP) { if (SrcTy == Type::FloatTy) { // double -> float - assert(DestTy == Type::DoubleTy && "Unknown cFP member!"); - BMI(BB, IP, X86::FpMOV, 1, DestReg).addReg(SrcReg); + assert(DestTy == Type::DoubleTy && "Unknown cFP member!"); + BMI(BB, IP, X86::FpMOV, 1, DestReg).addReg(SrcReg); } else { // float -> double - assert(SrcTy == Type::DoubleTy && DestTy == Type::FloatTy && - "Unknown cFP member!"); - // Truncate from double to float by storing to memory as short, then - // reading it back. - unsigned FltAlign = TM.getTargetData().getFloatAlignment(); + assert(SrcTy == Type::DoubleTy && DestTy == Type::FloatTy && + "Unknown cFP member!"); + // Truncate from double to float by storing to memory as short, then + // reading it back. + unsigned FltAlign = TM.getTargetData().getFloatAlignment(); int FrameIdx = F->getFrameInfo()->CreateStackObject(4, FltAlign); - addFrameReference(BMI(BB, IP, X86::FSTr32, 5), FrameIdx).addReg(SrcReg); - addFrameReference(BMI(BB, IP, X86::FLDr32, 5, DestReg), FrameIdx); + addFrameReference(BMI(BB, IP, X86::FSTr32, 5), FrameIdx).addReg(SrcReg); + addFrameReference(BMI(BB, IP, X86::FLDr32, 5, DestReg), FrameIdx); } } else if (SrcClass == cLong) { BMI(BB, IP, X86::MOVrr32, 1, DestReg).addReg(SrcReg); @@ -1737,9 +1738,9 @@ if (isLong) { // Handle upper 32 bits as appropriate... if (isUnsigned) // Zero out top bits... - BMI(BB, IP, X86::MOVir32, 1, DestReg+1).addZImm(0); + BMI(BB, IP, X86::MOVir32, 1, DestReg+1).addZImm(0); else // Sign extend bottom half... - BMI(BB, IP, X86::SARir32, 2, DestReg+1).addReg(DestReg).addZImm(31); + BMI(BB, IP, X86::SARir32, 2, DestReg+1).addReg(DestReg).addZImm(31); } return; } @@ -1816,7 +1817,7 @@ if (SrcClass == cLong) { addFrameReference(BMI(BB, IP, X86::MOVrm32, 5), FrameIdx).addReg(SrcReg); addFrameReference(BMI(BB, IP, X86::MOVrm32, 5), - FrameIdx, 4).addReg(SrcReg+1); + FrameIdx, 4).addReg(SrcReg+1); } else { static const unsigned Op1[] = { X86::MOVrm8, X86::MOVrm16, X86::MOVrm32 }; addFrameReference(BMI(BB, IP, Op1[SrcClass], 5), FrameIdx).addReg(SrcReg); @@ -1848,7 +1849,7 @@ // Restore the memory image of control word to original value addFrameReference(BMI(BB, IP, X86::MOVrm8, 5), - CWFrameIdx, 1).addReg(HighPartOfCW); + CWFrameIdx, 1).addReg(HighPartOfCW); // We don't have the facilities for directly storing byte sized data to // memory. Promote it to 16 bits. We also must promote unsigned values to @@ -1973,7 +1974,7 @@ // which names the field. This index must have ubyte type. const ConstantUInt *CUI = cast(idx); assert(CUI->getType() == Type::UByteTy - && "Funny-looking structure index in GEP"); + && "Funny-looking structure index in GEP"); // Use the TargetData structure to pick out what the layout of // the structure is in memory. Since the structure index must // be constant, we can get its value and use it to find the @@ -1982,9 +1983,9 @@ unsigned idxValue = CUI->getValue(); unsigned FieldOff = TD.getStructLayout(StTy)->MemberOffsets[idxValue]; if (FieldOff) { - NextReg = makeAnotherReg(Type::UIntTy); - // Emit an ADD to add FieldOff to the basePtr. - BMI(MBB, IP, X86::ADDri32, 2,NextReg).addReg(BaseReg).addZImm(FieldOff); + NextReg = makeAnotherReg(Type::UIntTy); + // Emit an ADD to add FieldOff to the basePtr. + BMI(MBB, IP, X86::ADDri32, 2,NextReg).addReg(BaseReg).addZImm(FieldOff); } // The next type is the member of the structure selected by the // index. @@ -2014,13 +2015,13 @@ if (ConstantSInt *CSI = dyn_cast(idx)) { if (!CSI->isNullValue()) { unsigned Offset = elementSize*CSI->getValue(); - NextReg = makeAnotherReg(Type::UIntTy); + NextReg = makeAnotherReg(Type::UIntTy); BMI(MBB, IP, X86::ADDri32, 2,NextReg).addReg(BaseReg).addZImm(Offset); } } else if (elementSize == 1) { // If the element size is 1, we don't have to multiply, just add unsigned idxReg = getReg(idx, MBB, IP); - NextReg = makeAnotherReg(Type::UIntTy); + NextReg = makeAnotherReg(Type::UIntTy); BMI(MBB, IP, X86::ADDrr32, 2, NextReg).addReg(BaseReg).addReg(idxReg); } else { unsigned idxReg = getReg(idx, MBB, IP); @@ -2029,7 +2030,7 @@ doMultiplyConst(MBB, IP, OffsetReg, Type::IntTy, idxReg, elementSize); // Emit an ADD to add OffsetReg to the basePtr. - NextReg = makeAnotherReg(Type::UIntTy); + NextReg = makeAnotherReg(Type::UIntTy); BMI(MBB, IP, X86::ADDrr32, 2,NextReg).addReg(BaseReg).addReg(OffsetReg); } } @@ -2116,7 +2117,7 @@ std::vector Args; Args.push_back(ValueRecord(Arg, Type::UIntTy)); MachineInstr *TheCall = BuildMI(X86::CALLpcrel32, - 1).addExternalSymbol("malloc", true); + 1).addExternalSymbol("malloc", true); doCall(ValueRecord(getReg(I), I.getType()), TheCall, Args); } @@ -2128,7 +2129,7 @@ std::vector Args; Args.push_back(ValueRecord(I.getOperand(0))); MachineInstr *TheCall = BuildMI(X86::CALLpcrel32, - 1).addExternalSymbol("free", true); + 1).addExternalSymbol("free", true); doCall(ValueRecord(0, Type::VoidTy), TheCall, Args); } From lattner at cs.uiuc.edu Thu Oct 23 11:30:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Oct 23 11:30:01 2003 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineConstantPool.h Message-ID: <200310231629.LAA31376@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineConstantPool.h updated: 1.2 -> 1.3 --- Log message: Actually share constants local to a function! --- Diffs of the changes: (+7 -2) Index: llvm/include/llvm/CodeGen/MachineConstantPool.h diff -u llvm/include/llvm/CodeGen/MachineConstantPool.h:1.2 llvm/include/llvm/CodeGen/MachineConstantPool.h:1.3 --- llvm/include/llvm/CodeGen/MachineConstantPool.h:1.2 Mon Oct 20 15:19:23 2003 +++ llvm/include/llvm/CodeGen/MachineConstantPool.h Thu Oct 23 11:29:12 2003 @@ -30,10 +30,15 @@ public: /// getConstantPoolIndex - Create a new entry in the constant pool or return - /// an existing one. This should eventually allow sharing of duplicate - /// objects in the constant pool, but this is adequate for now. + /// an existing one. /// unsigned getConstantPoolIndex(Constant *C) { + // Check to see if we already have this constant. + // + // FIXME, this could be made much more efficient for large constant pools. + for (unsigned i = 0, e = Constants.size(); i != e; ++i) + if (Constants[i] == C) + return i; Constants.push_back(C); return Constants.size()-1; } From lattner at cs.uiuc.edu Thu Oct 23 11:49:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Oct 23 11:49:01 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/MultiSource/Benchmarks/McCat/08-main/main.c Message-ID: <200310231648.LAA32539@zion.cs.uiuc.edu> Changes in directory llvm/test/Programs/MultiSource/Benchmarks/McCat/08-main: main.c updated: 1.1 -> 1.2 --- Log message: Fix floating point precision problem --- Diffs of the changes: (+2 -2) Index: llvm/test/Programs/MultiSource/Benchmarks/McCat/08-main/main.c diff -u llvm/test/Programs/MultiSource/Benchmarks/McCat/08-main/main.c:1.1 llvm/test/Programs/MultiSource/Benchmarks/McCat/08-main/main.c:1.2 --- llvm/test/Programs/MultiSource/Benchmarks/McCat/08-main/main.c:1.1 Mon May 12 13:26:43 2003 +++ llvm/test/Programs/MultiSource/Benchmarks/McCat/08-main/main.c Thu Oct 23 11:48:47 2003 @@ -80,8 +80,8 @@ /*printf("MakeSphere");*/ dfi = 2*PI/sli; /* The step in the slices */ dtheta = 2*PI/pol; /* The step in the amount of polys in a slice */ - for(fi=-PI;fi Changes in directory llvm/lib/Target/Sparc: SparcInstrSelection.cpp updated: 1.125 -> 1.126 --- Log message: Make code layout more consistent. --- Diffs of the changes: (+54 -58) Index: llvm/lib/Target/Sparc/SparcInstrSelection.cpp diff -u llvm/lib/Target/Sparc/SparcInstrSelection.cpp:1.125 llvm/lib/Target/Sparc/SparcInstrSelection.cpp:1.126 --- llvm/lib/Target/Sparc/SparcInstrSelection.cpp:1.125 Wed Oct 22 00:09:56 2003 +++ llvm/lib/Target/Sparc/SparcInstrSelection.cpp Thu Oct 23 11:48:30 2003 @@ -1541,22 +1541,19 @@ // Let's check for chain rules outside the switch so that we don't have // to duplicate the list of chain rule production numbers here again // - if (ThisIsAChainRule(ruleForNode)) - { - // Chain rules have a single nonterminal on the RHS. - // Get the rule that matches the RHS non-terminal and use that instead. - // - assert(nts[0] && ! nts[1] - && "A chain rule should have only one RHS non-terminal!"); - nextRule = burm_rule(subtreeRoot->state, nts[0]); - nts = burm_nts[nextRule]; - GetInstructionsByRule(subtreeRoot, nextRule, nts, target, mvec); - } - else - { - switch(ruleForNode) { - case 1: // stmt: Ret - case 2: // stmt: RetValue(reg) + if (ThisIsAChainRule(ruleForNode)) { + // Chain rules have a single nonterminal on the RHS. + // Get the rule that matches the RHS non-terminal and use that instead. + // + assert(nts[0] && ! nts[1] + && "A chain rule should have only one RHS non-terminal!"); + nextRule = burm_rule(subtreeRoot->state, nts[0]); + nts = burm_nts[nextRule]; + GetInstructionsByRule(subtreeRoot, nextRule, nts, target, mvec); + } else { + switch(ruleForNode) { + case 1: // stmt: Ret + case 2: // stmt: RetValue(reg) { // NOTE: Prepass of register allocation is responsible // for moving return value to appropriate register. // Copy the return value to the required return register. @@ -2192,11 +2189,11 @@ mvec.push_back(BuildMI(V9::ANDNr, 3).addReg(lhs).addReg(notArg) .addReg(dest, MOTy::Def)); - if (notArg->getType() == Type::BoolTy) - { // set 1 in result register if result of above is non-zero - mvec.push_back(BuildMI(V9::MOVRNZi, 3).addReg(dest).addZImm(1) - .addReg(dest, MOTy::UseAndDef)); - } + if (notArg->getType() == Type::BoolTy) { + // set 1 in result register if result of above is non-zero + mvec.push_back(BuildMI(V9::MOVRNZi, 3).addReg(dest).addZImm(1) + .addReg(dest, MOTy::UseAndDef)); + } break; } @@ -2223,11 +2220,11 @@ mvec.push_back(BuildMI(V9::ORNr, 3).addReg(lhs).addReg(notArg) .addReg(dest, MOTy::Def)); - if (notArg->getType() == Type::BoolTy) - { // set 1 in result register if result of above is non-zero - mvec.push_back(BuildMI(V9::MOVRNZi, 3).addReg(dest).addZImm(1) - .addReg(dest, MOTy::UseAndDef)); - } + if (notArg->getType() == Type::BoolTy) { + // set 1 in result register if result of above is non-zero + mvec.push_back(BuildMI(V9::MOVRNZi, 3).addReg(dest).addZImm(1) + .addReg(dest, MOTy::UseAndDef)); + } break; } @@ -2253,11 +2250,11 @@ mvec.push_back(BuildMI(V9::XNORr, 3).addReg(lhs).addReg(notArg) .addReg(dest, MOTy::Def)); - if (notArg->getType() == Type::BoolTy) - { // set 1 in result register if result of above is non-zero - mvec.push_back(BuildMI(V9::MOVRNZi, 3).addReg(dest).addZImm(1) - .addReg(dest, MOTy::UseAndDef)); - } + if (notArg->getType() == Type::BoolTy) { + // set 1 in result register if result of above is non-zero + mvec.push_back(BuildMI(V9::MOVRNZi, 3).addReg(dest).addZImm(1) + .addReg(dest, MOTy::UseAndDef)); + } break; } @@ -2278,37 +2275,36 @@ bool computeBoolVal = (subtreeRoot->parent() == NULL || ! AllUsesAreBranches(setCCInstr)); - if (computeBoolVal) - { - InstrTreeNode* constNode = subtreeRoot->rightChild(); - assert(constNode && - constNode->getNodeType() ==InstrTreeNode::NTConstNode); - Constant *constVal = cast(constNode->getValue()); - bool isValidConst; - - if ((constVal->getType()->isInteger() - || isa(constVal->getType())) - && target.getInstrInfo().ConvertConstantToIntType(target, + if (computeBoolVal) { + InstrTreeNode* constNode = subtreeRoot->rightChild(); + assert(constNode && + constNode->getNodeType() ==InstrTreeNode::NTConstNode); + Constant *constVal = cast(constNode->getValue()); + bool isValidConst; + + if ((constVal->getType()->isInteger() + || isa(constVal->getType())) + && target.getInstrInfo().ConvertConstantToIntType(target, constVal, constVal->getType(), isValidConst) == 0 - && isValidConst) - { - // That constant is an integer zero after all... - // Use a MOVR[op] to compute the boolean result - // Unconditionally set register to 0 - mvec.push_back(BuildMI(V9::SETHI, 2).addZImm(0) - .addRegDef(setCCInstr)); + && isValidConst) + { + // That constant is an integer zero after all... + // Use a MOVR[op] to compute the boolean result + // Unconditionally set register to 0 + mvec.push_back(BuildMI(V9::SETHI, 2).addZImm(0) + .addRegDef(setCCInstr)); - // Now conditionally move 1 into the register. - // Mark the register as a use (as well as a def) because the old - // value will be retained if the condition is false. - MachineOpCode movOpCode = ChooseMovpregiForSetCC(subtreeRoot); - mvec.push_back(BuildMI(movOpCode, 3) - .addReg(subtreeRoot->leftChild()->getValue()) - .addZImm(1).addReg(setCCInstr, MOTy::UseAndDef)); + // Now conditionally move 1 into the register. + // Mark the register as a use (as well as a def) because the old + // value will be retained if the condition is false. + MachineOpCode movOpCode = ChooseMovpregiForSetCC(subtreeRoot); + mvec.push_back(BuildMI(movOpCode, 3) + .addReg(subtreeRoot->leftChild()->getValue()) + .addZImm(1).addReg(setCCInstr, MOTy::UseAndDef)); - break; - } + break; } + } // ELSE FALL THROUGH } From lattner at cs.uiuc.edu Thu Oct 23 11:52:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Oct 23 11:52:02 2003 Subject: [llvm-commits] CVS: llvm/include/llvm/Transforms/IPO.h Message-ID: <200310231652.LAA02490@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Transforms: IPO.h updated: 1.22 -> 1.23 --- Log message: Include new prototype --- Diffs of the changes: (+6 -0) Index: llvm/include/llvm/Transforms/IPO.h diff -u llvm/include/llvm/Transforms/IPO.h:1.22 llvm/include/llvm/Transforms/IPO.h:1.23 --- llvm/include/llvm/Transforms/IPO.h:1.22 Mon Oct 20 15:19:47 2003 +++ llvm/include/llvm/Transforms/IPO.h Thu Oct 23 11:51:49 2003 @@ -104,6 +104,12 @@ // Pass *createDeadArgEliminationPass(bool DeleteFromExternalFunctions=false); +//===----------------------------------------------------------------------===// +// createIPConstantPropagationPass - This pass propagates constants from call +// sites into the bodies of functions. +// +Pass *createIPConstantPropagationPass(); + //===----------------------------------------------------------------------===// // These passes are wrappers that can do a few simple structure mutation From lattner at cs.uiuc.edu Thu Oct 23 11:53:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Oct 23 11:53:02 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/IPConstantPropagation.cpp Message-ID: <200310231652.LAA02589@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: IPConstantPropagation.cpp added (r1.1) --- Log message: Check in initial version of ipcp --- Diffs of the changes: (+110 -0) Index: llvm/lib/Transforms/IPO/IPConstantPropagation.cpp diff -c /dev/null llvm/lib/Transforms/IPO/IPConstantPropagation.cpp:1.1 *** /dev/null Thu Oct 23 11:52:37 2003 --- llvm/lib/Transforms/IPO/IPConstantPropagation.cpp Thu Oct 23 11:52:27 2003 *************** *** 0 **** --- 1,110 ---- + //===-- IPConstantPropagation.cpp - Propagate constants through calls -----===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by the LLVM research group an