From isanbard at gmail.com Mon Feb 23 00:04:32 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 23 Feb 2009 06:04:32 -0000 Subject: [llvm-commits] [llvm] r65307 - in /llvm/branches/Apple/Dib: include/llvm/CodeGen/DebugLoc.h lib/Transforms/Scalar/InstructionCombining.cpp lib/Transforms/Utils/SimplifyCFG.cpp test/Transforms/InstCombine/2009-02-21-LoadCST.ll Message-ID: <200902230604.n1N64Woh000848@zion.cs.uiuc.edu> Author: void Date: Mon Feb 23 00:04:32 2009 New Revision: 65307 URL: http://llvm.org/viewvc/llvm-project?rev=65307&view=rev Log: Pull r65246 into Dib: Don't sign extend the char when expanding char -> int during load(bitcast(char[4] to i32*)) evaluation. Added: llvm/branches/Apple/Dib/test/Transforms/InstCombine/2009-02-21-LoadCST.ll - copied unchanged from r65246, llvm/trunk/test/Transforms/InstCombine/2009-02-21-LoadCST.ll Modified: llvm/branches/Apple/Dib/include/llvm/CodeGen/DebugLoc.h llvm/branches/Apple/Dib/lib/Transforms/Scalar/InstructionCombining.cpp llvm/branches/Apple/Dib/lib/Transforms/Utils/SimplifyCFG.cpp Modified: llvm/branches/Apple/Dib/include/llvm/CodeGen/DebugLoc.h URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/include/llvm/CodeGen/DebugLoc.h?rev=65307&r1=65306&r2=65307&view=diff ============================================================================== --- llvm/branches/Apple/Dib/include/llvm/CodeGen/DebugLoc.h (original) +++ llvm/branches/Apple/Dib/include/llvm/CodeGen/DebugLoc.h Mon Feb 23 00:04:32 2009 @@ -22,11 +22,25 @@ /// DebugLocTuple - Debug location tuple of filename id, line and column. /// - struct DebugLocTuple { - unsigned Src, Line, Col; + class DebugLocTuple { + enum { Mask = 0xFFFFFFFFUL }; + uint64_t Src, Line, ScopeCol; + public: + DebugLocTuple(uint64_t s, uint64_t l, uint64_t p, uint64_t c) + : Src(s), Line(l), Col((p << 32) | (c & Mask)) {}; - DebugLocTuple(unsigned s, unsigned l, unsigned c) - : Src(s), Line(l), Col(c) {}; + uint64_t getSource() const { + return Src; + } + uint64_t getLine() const { + return Line; + } + uint32_t getScope() const { + return (ScopeCol >> 32) & Mask; + } + uint32_t getCol() const { + return ScopeCol & Mask; + } bool operator==(const DebugLocTuple &DLT) const { return Src == DLT.Src && Line == DLT.Line && Col == DLT.Col; Modified: llvm/branches/Apple/Dib/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Transforms/Scalar/InstructionCombining.cpp?rev=65307&r1=65306&r2=65307&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/branches/Apple/Dib/lib/Transforms/Scalar/InstructionCombining.cpp Mon Feb 23 00:04:32 2009 @@ -11028,12 +11028,12 @@ APInt SingleChar(numBits, 0); if (TD->isLittleEndian()) { for (signed i = len-1; i >= 0; i--) { - SingleChar = (uint64_t) Str[i]; + SingleChar = (uint64_t) Str[i] & UCHAR_MAX; StrVal = (StrVal << 8) | SingleChar; } } else { for (unsigned i = 0; i < len; i++) { - SingleChar = (uint64_t) Str[i]; + SingleChar = (uint64_t) Str[i] & UCHAR_MAX; StrVal = (StrVal << 8) | SingleChar; } // Append NULL at the end. Modified: llvm/branches/Apple/Dib/lib/Transforms/Utils/SimplifyCFG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Transforms/Utils/SimplifyCFG.cpp?rev=65307&r1=65306&r2=65307&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Transforms/Utils/SimplifyCFG.cpp (original) +++ llvm/branches/Apple/Dib/lib/Transforms/Utils/SimplifyCFG.cpp Mon Feb 23 00:04:32 2009 @@ -33,6 +33,11 @@ STATISTIC(NumSpeculations, "Number of speculative executed instructions"); +#include "llvm/Support/CommandLine.h" + +static cl::opt +DisableOpt("disable-opt", cl::Hidden, cl::init(false)); + /// SafeToMergeTerminators - Return true if it is safe to merge these two /// terminator instructions together. /// @@ -1778,7 +1783,7 @@ } // If we found some, do the transformation! - if (!UncondBranchPreds.empty()) { + if (!UncondBranchPreds.empty() && !DisableOpt) { while (!UncondBranchPreds.empty()) { BasicBlock *Pred = UncondBranchPreds.back(); DOUT << "FOLDING: " << *BB From isanbard at gmail.com Mon Feb 23 00:58:23 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 23 Feb 2009 06:58:23 -0000 Subject: [llvm-commits] [llvm] r65308 - in /llvm/branches/Apple/Dib: include/llvm/CodeGen/DebugLoc.h lib/Transforms/Utils/SimplifyCFG.cpp Message-ID: <200902230658.n1N6wNen003073@zion.cs.uiuc.edu> Author: void Date: Mon Feb 23 00:58:20 2009 New Revision: 65308 URL: http://llvm.org/viewvc/llvm-project?rev=65308&view=rev Log: Revert patches applied by mistake. Modified: llvm/branches/Apple/Dib/include/llvm/CodeGen/DebugLoc.h llvm/branches/Apple/Dib/lib/Transforms/Utils/SimplifyCFG.cpp Modified: llvm/branches/Apple/Dib/include/llvm/CodeGen/DebugLoc.h URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/include/llvm/CodeGen/DebugLoc.h?rev=65308&r1=65307&r2=65308&view=diff ============================================================================== --- llvm/branches/Apple/Dib/include/llvm/CodeGen/DebugLoc.h (original) +++ llvm/branches/Apple/Dib/include/llvm/CodeGen/DebugLoc.h Mon Feb 23 00:58:20 2009 @@ -22,25 +22,11 @@ /// DebugLocTuple - Debug location tuple of filename id, line and column. /// - class DebugLocTuple { - enum { Mask = 0xFFFFFFFFUL }; - uint64_t Src, Line, ScopeCol; - public: - DebugLocTuple(uint64_t s, uint64_t l, uint64_t p, uint64_t c) - : Src(s), Line(l), Col((p << 32) | (c & Mask)) {}; + struct DebugLocTuple { + unsigned Src, Line, Col; - uint64_t getSource() const { - return Src; - } - uint64_t getLine() const { - return Line; - } - uint32_t getScope() const { - return (ScopeCol >> 32) & Mask; - } - uint32_t getCol() const { - return ScopeCol & Mask; - } + DebugLocTuple(unsigned s, unsigned l, unsigned c) + : Src(s), Line(l), Col(c) {}; bool operator==(const DebugLocTuple &DLT) const { return Src == DLT.Src && Line == DLT.Line && Col == DLT.Col; Modified: llvm/branches/Apple/Dib/lib/Transforms/Utils/SimplifyCFG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Transforms/Utils/SimplifyCFG.cpp?rev=65308&r1=65307&r2=65308&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Transforms/Utils/SimplifyCFG.cpp (original) +++ llvm/branches/Apple/Dib/lib/Transforms/Utils/SimplifyCFG.cpp Mon Feb 23 00:58:20 2009 @@ -33,11 +33,6 @@ STATISTIC(NumSpeculations, "Number of speculative executed instructions"); -#include "llvm/Support/CommandLine.h" - -static cl::opt -DisableOpt("disable-opt", cl::Hidden, cl::init(false)); - /// SafeToMergeTerminators - Return true if it is safe to merge these two /// terminator instructions together. /// @@ -1783,7 +1778,7 @@ } // If we found some, do the transformation! - if (!UncondBranchPreds.empty() && !DisableOpt) { + if (!UncondBranchPreds.empty()) { while (!UncondBranchPreds.empty()) { BasicBlock *Pred = UncondBranchPreds.back(); DOUT << "FOLDING: " << *BB From wangmp at apple.com Mon Feb 23 01:07:56 2009 From: wangmp at apple.com (Mon P Wang) Date: Mon, 23 Feb 2009 07:07:56 -0000 Subject: [llvm-commits] [llvm] r65309 - /llvm/trunk/lib/Transforms/Utils/BasicInliner.cpp Message-ID: <200902230707.n1N77u0l003456@zion.cs.uiuc.edu> Author: wangmp Date: Mon Feb 23 01:07:56 2009 New Revision: 65309 URL: http://llvm.org/viewvc/llvm-project?rev=65309&view=rev Log: Changed option name from inline-threshold to basic-inline-threshold because inline-threshold option is used by the inliner. Modified: llvm/trunk/lib/Transforms/Utils/BasicInliner.cpp Modified: llvm/trunk/lib/Transforms/Utils/BasicInliner.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/BasicInliner.cpp?rev=65309&r1=65308&r2=65309&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/BasicInliner.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/BasicInliner.cpp Mon Feb 23 01:07:56 2009 @@ -27,7 +27,7 @@ using namespace llvm; static cl::opt -BasicInlineThreshold("inline-threshold", cl::Hidden, cl::init(200), +BasicInlineThreshold("basic-inline-threshold", cl::Hidden, cl::init(200), cl::desc("Control the amount of basic inlining to perform (default = 200)")); namespace llvm { From nicholas at mxc.ca Mon Feb 23 01:41:56 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Mon, 23 Feb 2009 07:41:56 -0000 Subject: [llvm-commits] [llvm] r65310 - /llvm/trunk/tools/lto/LTOCodeGenerator.cpp Message-ID: <200902230741.n1N7fvch004662@zion.cs.uiuc.edu> Author: nicholas Date: Mon Feb 23 01:41:55 2009 New Revision: 65310 URL: http://llvm.org/viewvc/llvm-project?rev=65310&view=rev Log: If nobody minds, I'm using LTO to produce faster binaries. Switch fast codegen off in libLTO. Modified: llvm/trunk/tools/lto/LTOCodeGenerator.cpp Modified: llvm/trunk/tools/lto/LTOCodeGenerator.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOCodeGenerator.cpp?rev=65310&r1=65309&r2=65310&view=diff ============================================================================== --- llvm/trunk/tools/lto/LTOCodeGenerator.cpp (original) +++ llvm/trunk/tools/lto/LTOCodeGenerator.cpp Mon Feb 23 01:41:55 2009 @@ -420,7 +420,7 @@ MachineCodeEmitter* mce = NULL; switch (_target->addPassesToEmitFile(*codeGenPasses, out, - TargetMachine::AssemblyFile, true)) { + TargetMachine::AssemblyFile, false)) { case FileModel::MachOFile: mce = AddMachOWriter(*codeGenPasses, out, *_target); break; @@ -435,7 +435,7 @@ return true; } - if (_target->addPassesToEmitFileFinish(*codeGenPasses, mce, true)) { + if (_target->addPassesToEmitFileFinish(*codeGenPasses, mce, false)) { errMsg = "target does not support generation of this file type"; return true; } From evan.cheng at apple.com Mon Feb 23 01:56:07 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Sun, 22 Feb 2009 23:56:07 -0800 Subject: [llvm-commits] [llvm] r65310 - /llvm/trunk/tools/lto/LTOCodeGenerator.cpp In-Reply-To: <200902230741.n1N7fvch004662@zion.cs.uiuc.edu> References: <200902230741.n1N7fvch004662@zion.cs.uiuc.edu> Message-ID: <697C5B7A-65F0-4812-AC82-8A8470C19B89@apple.com> Wow. How did that happen? That would explain why LTO has been pessimizing code! "Fast" codegen means fast isel and disabling a lot of codegen optimizations. Thanks for catching this. Evan On Feb 22, 2009, at 11:41 PM, Nick Lewycky wrote: > Author: nicholas > Date: Mon Feb 23 01:41:55 2009 > New Revision: 65310 > > URL: http://llvm.org/viewvc/llvm-project?rev=65310&view=rev > Log: > If nobody minds, I'm using LTO to produce faster binaries. Switch > fast codegen > off in libLTO. > > Modified: > llvm/trunk/tools/lto/LTOCodeGenerator.cpp > > Modified: llvm/trunk/tools/lto/LTOCodeGenerator.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOCodeGenerator.cpp?rev=65310&r1=65309&r2=65310&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/tools/lto/LTOCodeGenerator.cpp (original) > +++ llvm/trunk/tools/lto/LTOCodeGenerator.cpp Mon Feb 23 01:41:55 2009 > @@ -420,7 +420,7 @@ > MachineCodeEmitter* mce = NULL; > > switch (_target->addPassesToEmitFile(*codeGenPasses, out, > - TargetMachine::AssemblyFile, > true)) { > + TargetMachine::AssemblyFile, > false)) { > case FileModel::MachOFile: > mce = AddMachOWriter(*codeGenPasses, out, *_target); > break; > @@ -435,7 +435,7 @@ > return true; > } > > - if (_target->addPassesToEmitFileFinish(*codeGenPasses, mce, > true)) { > + if (_target->addPassesToEmitFileFinish(*codeGenPasses, mce, > false)) { > errMsg = "target does not support generation of this file > type"; > return true; > } > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From nicholas at mxc.ca Mon Feb 23 01:59:26 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Sun, 22 Feb 2009 23:59:26 -0800 Subject: [llvm-commits] [llvm] r65310 - /llvm/trunk/tools/lto/LTOCodeGenerator.cpp In-Reply-To: <697C5B7A-65F0-4812-AC82-8A8470C19B89@apple.com> References: <200902230741.n1N7fvch004662@zion.cs.uiuc.edu> <697C5B7A-65F0-4812-AC82-8A8470C19B89@apple.com> Message-ID: <49A2575E.2090302@mxc.ca> Evan Cheng wrote: > Wow. How did that happen? That would explain why LTO has been > pessimizing code! "Fast" codegen means fast isel and disabling a lot > of codegen optimizations. Thanks for catching this. My guess is that somebody looked at the flag named "Fast" and said "of course I want fast!" It really should have been named "DisableOpt" or something more sinister. And yes, I expect this to put an end to the mysterious "my code is slower with LTO" problem. :) Nick > Evan > > On Feb 22, 2009, at 11:41 PM, Nick Lewycky wrote: > >> Author: nicholas >> Date: Mon Feb 23 01:41:55 2009 >> New Revision: 65310 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=65310&view=rev >> Log: >> If nobody minds, I'm using LTO to produce faster binaries. Switch >> fast codegen >> off in libLTO. >> >> Modified: >> llvm/trunk/tools/lto/LTOCodeGenerator.cpp >> >> Modified: llvm/trunk/tools/lto/LTOCodeGenerator.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOCodeGenerator.cpp?rev=65310&r1=65309&r2=65310&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/tools/lto/LTOCodeGenerator.cpp (original) >> +++ llvm/trunk/tools/lto/LTOCodeGenerator.cpp Mon Feb 23 01:41:55 2009 >> @@ -420,7 +420,7 @@ >> MachineCodeEmitter* mce = NULL; >> >> switch (_target->addPassesToEmitFile(*codeGenPasses, out, >> - TargetMachine::AssemblyFile, >> true)) { >> + TargetMachine::AssemblyFile, >> false)) { >> case FileModel::MachOFile: >> mce = AddMachOWriter(*codeGenPasses, out, *_target); >> break; >> @@ -435,7 +435,7 @@ >> return true; >> } >> >> - if (_target->addPassesToEmitFileFinish(*codeGenPasses, mce, >> true)) { >> + if (_target->addPassesToEmitFileFinish(*codeGenPasses, mce, >> false)) { >> errMsg = "target does not support generation of this file >> type"; >> return true; >> } >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From baldrick at free.fr Mon Feb 23 02:07:43 2009 From: baldrick at free.fr (Duncan Sands) Date: Mon, 23 Feb 2009 09:07:43 +0100 Subject: [llvm-commits] [llvm] r65296 - in /llvm/trunk: include/llvm/CodeGen/ lib/CodeGen/SelectionDAG/ lib/Target/CellSPU/ lib/Target/PowerPC/ lib/Target/X86/ test/CodeGen/X86/ In-Reply-To: <200902222336.n1MNaCHX020497@zion.cs.uiuc.edu> References: <200902222336.n1MNaCHX020497@zion.cs.uiuc.edu> Message-ID: <200902230907.43411.baldrick@free.fr> Hi Scott, > Introduce the BuildVectorSDNode class that encapsulates the ISD::BUILD_VECTOR > instruction. The class also consolidates the code for detecting constant > splats that's shared across PowerPC and the CellSPU backends (and might be > useful for other backends.) Also introduces SelectionDAG::getBUID_VECTOR() for > generating new BUILD_VECTOR nodes. if I update the BUILD_VECTOR's operands, it doesn't look like the cached information is invalidated. This is bad. Ciao, Duncan. From baldrick at free.fr Mon Feb 23 02:17:57 2009 From: baldrick at free.fr (Duncan Sands) Date: Mon, 23 Feb 2009 09:17:57 +0100 Subject: [llvm-commits] [llvm] r65310 - /llvm/trunk/tools/lto/LTOCodeGenerator.cpp In-Reply-To: <697C5B7A-65F0-4812-AC82-8A8470C19B89@apple.com> References: <200902230741.n1N7fvch004662@zion.cs.uiuc.edu> <697C5B7A-65F0-4812-AC82-8A8470C19B89@apple.com> Message-ID: <200902230917.57685.baldrick@free.fr> On Monday 23 February 2009 08:56:07 Evan Cheng wrote: > Wow. How did that happen? That would explain why LTO has been > pessimizing code! "Fast" codegen means fast isel and disabling a lot > of codegen optimizations. Thanks for catching this. Maybe this should go in the release? Ciao, D. From natebegeman at mac.com Mon Feb 23 02:49:41 2009 From: natebegeman at mac.com (Nate Begeman) Date: Mon, 23 Feb 2009 08:49:41 -0000 Subject: [llvm-commits] [llvm] r65311 - in /llvm/trunk: lib/Target/X86/ test/CodeGen/X86/ Message-ID: <200902230849.n1N8ngGk011116@zion.cs.uiuc.edu> Author: sampo Date: Mon Feb 23 02:49:38 2009 New Revision: 65311 URL: http://llvm.org/viewvc/llvm-project?rev=65311&view=rev Log: Generate better code for v8i16 shuffles on SSE2 Generate better code for v16i8 shuffles on SSE2 (avoids stack) Generate pshufb for v8i16 and v16i8 shuffles on SSSE3 where it is fewer uops. Document the shuffle matching logic and add some FIXMEs for later further cleanups. New tests that test the above. Examples: New: _shuf2: pextrw $7, %xmm0, %eax punpcklqdq %xmm1, %xmm0 pshuflw $128, %xmm0, %xmm0 pinsrw $2, %eax, %xmm0 Old: _shuf2: pextrw $2, %xmm0, %eax pextrw $7, %xmm0, %ecx pinsrw $2, %ecx, %xmm0 pinsrw $3, %eax, %xmm0 movd %xmm1, %eax pinsrw $4, %eax, %xmm0 ret ========= New: _shuf4: punpcklqdq %xmm1, %xmm0 pshufb LCPI1_0, %xmm0 Old: _shuf4: pextrw $3, %xmm0, %eax movsd %xmm1, %xmm0 pextrw $3, %xmm1, %ecx pinsrw $4, %ecx, %xmm0 pinsrw $5, %eax, %xmm0 ======== New: _shuf1: pushl %ebx pushl %edi pushl %esi pextrw $1, %xmm0, %eax rolw $8, %ax movd %xmm0, %ecx rolw $8, %cx pextrw $5, %xmm0, %edx pextrw $4, %xmm0, %esi pextrw $3, %xmm0, %edi pextrw $2, %xmm0, %ebx movaps %xmm0, %xmm1 pinsrw $0, %ecx, %xmm1 pinsrw $1, %eax, %xmm1 rolw $8, %bx pinsrw $2, %ebx, %xmm1 rolw $8, %di pinsrw $3, %edi, %xmm1 rolw $8, %si pinsrw $4, %esi, %xmm1 rolw $8, %dx pinsrw $5, %edx, %xmm1 pextrw $7, %xmm0, %eax rolw $8, %ax movaps %xmm1, %xmm0 pinsrw $7, %eax, %xmm0 popl %esi popl %edi popl %ebx ret Old: _shuf1: subl $252, %esp movaps %xmm0, (%esp) movaps %xmm0, 16(%esp) movaps %xmm0, 32(%esp) movaps %xmm0, 48(%esp) movaps %xmm0, 64(%esp) movaps %xmm0, 80(%esp) movaps %xmm0, 96(%esp) movaps %xmm0, 224(%esp) movaps %xmm0, 208(%esp) movaps %xmm0, 192(%esp) movaps %xmm0, 176(%esp) movaps %xmm0, 160(%esp) movaps %xmm0, 144(%esp) movaps %xmm0, 128(%esp) movaps %xmm0, 112(%esp) movzbl 14(%esp), %eax movd %eax, %xmm1 movzbl 22(%esp), %eax movd %eax, %xmm2 punpcklbw %xmm1, %xmm2 movzbl 42(%esp), %eax movd %eax, %xmm1 movzbl 50(%esp), %eax movd %eax, %xmm3 punpcklbw %xmm1, %xmm3 punpcklbw %xmm2, %xmm3 movzbl 77(%esp), %eax movd %eax, %xmm1 movzbl 84(%esp), %eax movd %eax, %xmm2 punpcklbw %xmm1, %xmm2 movzbl 104(%esp), %eax movd %eax, %xmm1 punpcklbw %xmm1, %xmm0 punpcklbw %xmm2, %xmm0 movaps %xmm0, %xmm1 punpcklbw %xmm3, %xmm1 movzbl 127(%esp), %eax movd %eax, %xmm0 movzbl 135(%esp), %eax movd %eax, %xmm2 punpcklbw %xmm0, %xmm2 movzbl 155(%esp), %eax movd %eax, %xmm0 movzbl 163(%esp), %eax movd %eax, %xmm3 punpcklbw %xmm0, %xmm3 punpcklbw %xmm2, %xmm3 movzbl 188(%esp), %eax movd %eax, %xmm0 movzbl 197(%esp), %eax movd %eax, %xmm2 punpcklbw %xmm0, %xmm2 movzbl 217(%esp), %eax movd %eax, %xmm4 movzbl 225(%esp), %eax movd %eax, %xmm0 punpcklbw %xmm4, %xmm0 punpcklbw %xmm2, %xmm0 punpcklbw %xmm3, %xmm0 punpcklbw %xmm1, %xmm0 addl $252, %esp ret Added: llvm/trunk/test/CodeGen/X86/vec_shuffle-31.ll llvm/trunk/test/CodeGen/X86/vec_shuffle-32.ll llvm/trunk/test/CodeGen/X86/vec_shuffle-33.ll llvm/trunk/test/CodeGen/X86/vec_shuffle-34.ll llvm/trunk/test/CodeGen/X86/vec_shuffle-35.ll Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.h llvm/trunk/lib/Target/X86/X86InstrSSE.td llvm/trunk/test/CodeGen/X86/vec_shuffle-12.ll llvm/trunk/test/CodeGen/X86/vec_shuffle-13.ll llvm/trunk/test/CodeGen/X86/vec_shuffle-2.ll llvm/trunk/test/CodeGen/X86/vec_shuffle-21.ll llvm/trunk/test/CodeGen/X86/vec_shuffle-28.ll llvm/trunk/test/CodeGen/X86/vec_shuffle-29.ll Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=65311&r1=65310&r2=65311&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Feb 23 02:49:38 2009 @@ -2710,38 +2710,6 @@ return Mask; } -/// isPSHUFHW_PSHUFLWMask - true if the specified VECTOR_SHUFFLE operand -/// specifies a 8 element shuffle that can be broken into a pair of -/// PSHUFHW and PSHUFLW. -static bool isPSHUFHW_PSHUFLWMask(SDNode *N) { - assert(N->getOpcode() == ISD::BUILD_VECTOR); - - if (N->getNumOperands() != 8) - return false; - - // Lower quadword shuffled. - for (unsigned i = 0; i != 4; ++i) { - SDValue Arg = N->getOperand(i); - if (Arg.getOpcode() == ISD::UNDEF) continue; - assert(isa(Arg) && "Invalid VECTOR_SHUFFLE mask!"); - unsigned Val = cast(Arg)->getZExtValue(); - if (Val >= 4) - return false; - } - - // Upper quadword shuffled. - for (unsigned i = 4; i != 8; ++i) { - SDValue Arg = N->getOperand(i); - if (Arg.getOpcode() == ISD::UNDEF) continue; - assert(isa(Arg) && "Invalid VECTOR_SHUFFLE mask!"); - unsigned Val = cast(Arg)->getZExtValue(); - if (Val < 4 || Val > 7) - return false; - } - - return true; -} - /// CommuteVectorShuffle - Swap vector_shuffle operands as well as /// values in ther permute mask. static SDValue CommuteVectorShuffle(SDValue Op, SDValue &V1, @@ -3556,262 +3524,382 @@ return SDValue(); } +// v8i16 shuffles - Prefer shuffles in the following order: +// 1. [all] pshuflw, pshufhw, optional move +// 2. [ssse3] 1 x pshufb +// 3. [ssse3] 2 x pshufb + 1 x por +// 4. [all] mov + pshuflw + pshufhw + N x (pextrw + pinsrw) static SDValue LowerVECTOR_SHUFFLEv8i16(SDValue V1, SDValue V2, SDValue PermMask, SelectionDAG &DAG, - TargetLowering &TLI, DebugLoc dl) { - SDValue NewV; - MVT MaskVT = MVT::getIntVectorWithNumElements(8); - MVT MaskEVT = MaskVT.getVectorElementType(); - MVT PtrVT = TLI.getPointerTy(); + X86TargetLowering &TLI, DebugLoc dl) { SmallVector MaskElts(PermMask.getNode()->op_begin(), PermMask.getNode()->op_end()); + SmallVector MaskVals; - // First record which half of which vector the low elements come from. - SmallVector LowQuad(4); - for (unsigned i = 0; i < 4; ++i) { + // Determine if more than 1 of the words in each of the low and high quadwords + // of the result come from the same quadword of one of the two inputs. Undef + // mask values count as coming from any quadword, for better codegen. + SmallVector LoQuad(4); + SmallVector HiQuad(4); + BitVector InputQuads(4); + for (unsigned i = 0; i < 8; ++i) { + SmallVectorImpl &Quad = i < 4 ? LoQuad : HiQuad; SDValue Elt = MaskElts[i]; - if (Elt.getOpcode() == ISD::UNDEF) + int EltIdx = Elt.getOpcode() == ISD::UNDEF ? -1 : + cast(Elt)->getZExtValue(); + MaskVals.push_back(EltIdx); + if (EltIdx < 0) { + ++Quad[0]; + ++Quad[1]; + ++Quad[2]; + ++Quad[3]; continue; - unsigned EltIdx = cast(Elt)->getZExtValue(); - int QuadIdx = EltIdx / 4; - ++LowQuad[QuadIdx]; + } + ++Quad[EltIdx / 4]; + InputQuads.set(EltIdx / 4); } - int BestLowQuad = -1; + int BestLoQuad = -1; unsigned MaxQuad = 1; for (unsigned i = 0; i < 4; ++i) { - if (LowQuad[i] > MaxQuad) { - BestLowQuad = i; - MaxQuad = LowQuad[i]; + if (LoQuad[i] > MaxQuad) { + BestLoQuad = i; + MaxQuad = LoQuad[i]; } } - // Record which half of which vector the high elements come from. - SmallVector HighQuad(4); - for (unsigned i = 4; i < 8; ++i) { - SDValue Elt = MaskElts[i]; - if (Elt.getOpcode() == ISD::UNDEF) - continue; - unsigned EltIdx = cast(Elt)->getZExtValue(); - int QuadIdx = EltIdx / 4; - ++HighQuad[QuadIdx]; - } - - int BestHighQuad = -1; + int BestHiQuad = -1; MaxQuad = 1; for (unsigned i = 0; i < 4; ++i) { - if (HighQuad[i] > MaxQuad) { - BestHighQuad = i; - MaxQuad = HighQuad[i]; + if (HiQuad[i] > MaxQuad) { + BestHiQuad = i; + MaxQuad = HiQuad[i]; } } - // If it's possible to sort parts of either half with PSHUF{H|L}W, then do it. - if (BestLowQuad != -1 || BestHighQuad != -1) { - // First sort the 4 chunks in order using shufpd. - SmallVector MaskVec; - - if (BestLowQuad != -1) - MaskVec.push_back(DAG.getConstant(BestLowQuad, MVT::i32)); - else - MaskVec.push_back(DAG.getConstant(0, MVT::i32)); - - if (BestHighQuad != -1) - MaskVec.push_back(DAG.getConstant(BestHighQuad, MVT::i32)); - else - MaskVec.push_back(DAG.getConstant(1, MVT::i32)); + // For SSSE3, If all 8 words of the result come from only 1 quadword of each + // of the two input vectors, shuffle them into one input vector so only a + // single pshufb instruction is necessary. If There are more than 2 input + // quads, disable the next transformation since it does not help SSSE3. + bool V1Used = InputQuads[0] || InputQuads[1]; + bool V2Used = InputQuads[2] || InputQuads[3]; + if (TLI.getSubtarget()->hasSSSE3()) { + if (InputQuads.count() == 2 && V1Used && V2Used) { + BestLoQuad = InputQuads.find_first(); + BestHiQuad = InputQuads.find_next(BestLoQuad); + } + if (InputQuads.count() > 2) { + BestLoQuad = -1; + BestHiQuad = -1; + } + } - SDValue Mask= DAG.getBUILD_VECTOR(MVT::v2i32, dl, &MaskVec[0],2); + // If BestLoQuad or BestHiQuad are set, shuffle the quads together and update + // the shuffle mask. If a quad is scored as -1, that means that it contains + // words from all 4 input quadwords. + SDValue NewV; + if (BestLoQuad >= 0 || BestHiQuad >= 0) { + SmallVector MaskV; + MaskV.push_back(DAG.getConstant(BestLoQuad < 0 ? 0 : BestLoQuad, MVT::i64)); + MaskV.push_back(DAG.getConstant(BestHiQuad < 0 ? 1 : BestHiQuad, MVT::i64)); + SDValue Mask = DAG.getBUILD_VECTOR(MVT::v2i64, dl, &MaskV[0], 2); + NewV = DAG.getNode(ISD::VECTOR_SHUFFLE, dl, MVT::v2i64, - DAG.getNode(ISD::BIT_CONVERT, dl, MVT::v2i64, V1), - DAG.getNode(ISD::BIT_CONVERT, dl, MVT::v2i64, V2), Mask); + DAG.getNode(ISD::BIT_CONVERT, dl, MVT::v2i64, V1), + DAG.getNode(ISD::BIT_CONVERT, dl, MVT::v2i64, V2), Mask); NewV = DAG.getNode(ISD::BIT_CONVERT, dl, MVT::v8i16, NewV); - // Now sort high and low parts separately. - BitVector InOrder(8); - if (BestLowQuad != -1) { - // Sort lower half in order using PSHUFLW. - MaskVec.clear(); - bool AnyOutOrder = false; - - for (unsigned i = 0; i != 4; ++i) { - SDValue Elt = MaskElts[i]; - if (Elt.getOpcode() == ISD::UNDEF) { - MaskVec.push_back(Elt); - InOrder.set(i); - } else { - unsigned EltIdx = cast(Elt)->getZExtValue(); - if (EltIdx != i) - AnyOutOrder = true; - - MaskVec.push_back(DAG.getConstant(EltIdx % 4, MaskEVT)); - - // If this element is in the right place after this shuffle, then - // remember it. - if ((int)(EltIdx / 4) == BestLowQuad) - InOrder.set(i); - } - } - if (AnyOutOrder) { - for (unsigned i = 4; i != 8; ++i) - MaskVec.push_back(DAG.getConstant(i, MaskEVT)); - SDValue Mask = DAG.getBUILD_VECTOR(MaskVT, dl, &MaskVec[0], 8); - NewV = DAG.getNode(ISD::VECTOR_SHUFFLE, dl, MVT::v8i16, - NewV, NewV, Mask); - } + // Rewrite the MaskVals and assign NewV to V1 if NewV now contains all the + // source words for the shuffle, to aid later transformations. + bool AllWordsInNewV = true; + for (unsigned i = 0; i != 8; ++i) { + int idx = MaskVals[i]; + if (idx < 0 || (idx/4) == BestLoQuad || (idx/4) == BestHiQuad) + continue; + AllWordsInNewV = false; + break; } - if (BestHighQuad != -1) { - // Sort high half in order using PSHUFHW if possible. - MaskVec.clear(); - - for (unsigned i = 0; i != 4; ++i) - MaskVec.push_back(DAG.getConstant(i, MaskEVT)); - - bool AnyOutOrder = false; - for (unsigned i = 4; i != 8; ++i) { - SDValue Elt = MaskElts[i]; - if (Elt.getOpcode() == ISD::UNDEF) { - MaskVec.push_back(Elt); - InOrder.set(i); - } else { - unsigned EltIdx = cast(Elt)->getZExtValue(); - if (EltIdx != i) - AnyOutOrder = true; - - MaskVec.push_back(DAG.getConstant((EltIdx % 4) + 4, MaskEVT)); - - // If this element is in the right place after this shuffle, then - // remember it. - if ((int)(EltIdx / 4) == BestHighQuad) - InOrder.set(i); - } - } - - if (AnyOutOrder) { - SDValue Mask = DAG.getBUILD_VECTOR(MaskVT, dl, &MaskVec[0], 8); - NewV = DAG.getNode(ISD::VECTOR_SHUFFLE, dl, MVT::v8i16, - NewV, NewV, Mask); + bool pshuflw = AllWordsInNewV, pshufhw = AllWordsInNewV; + if (AllWordsInNewV) { + for (int i = 0; i != 8; ++i) { + int idx = MaskVals[i]; + if (idx < 0) + continue; + idx = MaskVals[i] = (idx / 4) == BestLoQuad ? (idx & 3) : (idx & 3) + 4; + if ((idx != i) && idx < 4) + pshufhw = false; + if ((idx != i) && idx > 3) + pshuflw = false; + } + V1 = NewV; + V2Used = false; + BestLoQuad = 0; + BestHiQuad = 1; + } + + // If we've eliminated the use of V2, and the new mask is a pshuflw or + // pshufhw, that's as cheap as it gets. Return the new shuffle. + if (pshufhw || pshuflw) { + MaskV.clear(); + for (unsigned i = 0; i != 8; ++i) + MaskV.push_back((MaskVals[i] < 0) ? DAG.getUNDEF(MVT::i16) + : DAG.getConstant(MaskVals[i], + MVT::i16)); + return DAG.getNode(ISD::VECTOR_SHUFFLE, dl, MVT::v8i16, NewV, + DAG.getUNDEF(MVT::v8i16), + DAG.getBUILD_VECTOR(MVT::v8i16, dl, &MaskV[0], 8)); + } + } + + // If we have SSSE3, and all words of the result are from 1 input vector, + // case 2 is generated, otherwise case 3 is generated. If no SSSE3 + // is present, fall back to case 4. + if (TLI.getSubtarget()->hasSSSE3()) { + SmallVector pshufbMask; + + // If we have elements from both input vectors, set the high bit of the + // shuffle mask element to zero out elements that come from V2 in the V1 + // mask, and elements that come from V1 in the V2 mask, so that the two + // results can be OR'd together. + bool TwoInputs = V1Used && V2Used; + for (unsigned i = 0; i != 8; ++i) { + int EltIdx = MaskVals[i] * 2; + if (TwoInputs && (EltIdx >= 16)) { + pshufbMask.push_back(DAG.getConstant(0x80, MVT::i8)); + pshufbMask.push_back(DAG.getConstant(0x80, MVT::i8)); + continue; } + pshufbMask.push_back(DAG.getConstant(EltIdx, MVT::i8)); + pshufbMask.push_back(DAG.getConstant(EltIdx+1, MVT::i8)); } - - // The other elements are put in the right place using pextrw and pinsrw. + V1 = DAG.getNode(ISD::BIT_CONVERT, dl, MVT::v16i8, V1); + V1 = DAG.getNode(X86ISD::PSHUFB, dl, MVT::v16i8, V1, + DAG.getBUILD_VECTOR(MVT::v16i8, dl, &pshufbMask[0], 16)); + if (!TwoInputs) + return DAG.getNode(ISD::BIT_CONVERT, dl, MVT::v8i16, V1); + + // Calculate the shuffle mask for the second input, shuffle it, and + // OR it with the first shuffled input. + pshufbMask.clear(); for (unsigned i = 0; i != 8; ++i) { - if (InOrder[i]) - continue; - SDValue Elt = MaskElts[i]; - if (Elt.getOpcode() == ISD::UNDEF) + int EltIdx = MaskVals[i] * 2; + if (EltIdx < 16) { + pshufbMask.push_back(DAG.getConstant(0x80, MVT::i8)); + pshufbMask.push_back(DAG.getConstant(0x80, MVT::i8)); continue; - unsigned EltIdx = cast(Elt)->getZExtValue(); - SDValue ExtOp = (EltIdx < 8) - ? DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, MVT::i16, V1, - DAG.getConstant(EltIdx, PtrVT)) - : DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, MVT::i16, V2, - DAG.getConstant(EltIdx - 8, PtrVT)); - NewV = DAG.getNode(ISD::INSERT_VECTOR_ELT, dl, MVT::v8i16, NewV, ExtOp, - DAG.getConstant(i, PtrVT)); - } - - return NewV; - } - - // PSHUF{H|L}W are not used. Lower into extracts and inserts but try to use as - // few as possible. First, let's find out how many elements are already in the - // right order. - unsigned V1InOrder = 0; - unsigned V1FromV1 = 0; - unsigned V2InOrder = 0; - unsigned V2FromV2 = 0; - SmallVector V1Elts; - SmallVector V2Elts; - for (unsigned i = 0; i < 8; ++i) { - SDValue Elt = MaskElts[i]; - if (Elt.getOpcode() == ISD::UNDEF) { - V1Elts.push_back(Elt); - V2Elts.push_back(Elt); - ++V1InOrder; - ++V2InOrder; - continue; + } + pshufbMask.push_back(DAG.getConstant(EltIdx - 16, MVT::i8)); + pshufbMask.push_back(DAG.getConstant(EltIdx - 15, MVT::i8)); } - unsigned EltIdx = cast(Elt)->getZExtValue(); - if (EltIdx == i) { - V1Elts.push_back(Elt); - V2Elts.push_back(DAG.getConstant(i+8, MaskEVT)); - ++V1InOrder; - } else if (EltIdx == i+8) { - V1Elts.push_back(Elt); - V2Elts.push_back(DAG.getConstant(i, MaskEVT)); - ++V2InOrder; - } else if (EltIdx < 8) { - V1Elts.push_back(Elt); - V2Elts.push_back(DAG.getConstant(EltIdx+8, MaskEVT)); - ++V1FromV1; - } else { - V1Elts.push_back(Elt); - V2Elts.push_back(DAG.getConstant(EltIdx-8, MaskEVT)); - ++V2FromV2; + V2 = DAG.getNode(ISD::BIT_CONVERT, dl, MVT::v16i8, V2); + V2 = DAG.getNode(X86ISD::PSHUFB, dl, MVT::v16i8, V2, + DAG.getBUILD_VECTOR(MVT::v16i8, dl, &pshufbMask[0], 16)); + V1 = DAG.getNode(ISD::OR, dl, MVT::v16i8, V1, V2); + return DAG.getNode(ISD::BIT_CONVERT, dl, MVT::v8i16, V1); + } + + // If BestLoQuad >= 0, generate a pshuflw to put the low elements in order, + // and update MaskVals with new element order. + BitVector InOrder(8); + if (BestLoQuad >= 0) { + SmallVector MaskV; + for (int i = 0; i != 4; ++i) { + int idx = MaskVals[i]; + if (idx < 0) { + MaskV.push_back(DAG.getUNDEF(MVT::i16)); + InOrder.set(i); + } else if ((idx / 4) == BestLoQuad) { + MaskV.push_back(DAG.getConstant(idx & 3, MVT::i16)); + InOrder.set(i); + } else { + MaskV.push_back(DAG.getUNDEF(MVT::i16)); + } } - } - - if (V2InOrder > V1InOrder) { - PermMask = CommuteVectorShuffleMask(PermMask, DAG, dl); - std::swap(V1, V2); - std::swap(V1Elts, V2Elts); - std::swap(V1FromV1, V2FromV2); - } - - if ((V1FromV1 + V1InOrder) != 8) { - // Some elements are from V2. - if (V1FromV1) { - // If there are elements that are from V1 but out of place, - // then first sort them in place - SmallVector MaskVec; - for (unsigned i = 0; i < 8; ++i) { - SDValue Elt = V1Elts[i]; - if (Elt.getOpcode() == ISD::UNDEF) { - MaskVec.push_back(DAG.getUNDEF(MaskEVT)); - continue; - } - unsigned EltIdx = cast(Elt)->getZExtValue(); - if (EltIdx >= 8) - MaskVec.push_back(DAG.getUNDEF(MaskEVT)); - else - MaskVec.push_back(DAG.getConstant(EltIdx, MaskEVT)); + for (unsigned i = 4; i != 8; ++i) + MaskV.push_back(DAG.getConstant(i, MVT::i16)); + NewV = DAG.getNode(ISD::VECTOR_SHUFFLE, dl, MVT::v8i16, NewV, + DAG.getUNDEF(MVT::v8i16), + DAG.getBUILD_VECTOR(MVT::v8i16, dl, &MaskV[0], 8)); + } + + // If BestHi >= 0, generate a pshufhw to put the high elements in order, + // and update MaskVals with the new element order. + if (BestHiQuad >= 0) { + SmallVector MaskV; + for (unsigned i = 0; i != 4; ++i) + MaskV.push_back(DAG.getConstant(i, MVT::i16)); + for (unsigned i = 4; i != 8; ++i) { + int idx = MaskVals[i]; + if (idx < 0) { + MaskV.push_back(DAG.getUNDEF(MVT::i16)); + InOrder.set(i); + } else if ((idx / 4) == BestHiQuad) { + MaskV.push_back(DAG.getConstant((idx & 3) + 4, MVT::i16)); + InOrder.set(i); + } else { + MaskV.push_back(DAG.getUNDEF(MVT::i16)); } - SDValue Mask = DAG.getBUILD_VECTOR(MaskVT, dl, &MaskVec[0], 8); - V1 = DAG.getNode(ISD::VECTOR_SHUFFLE, dl, MVT::v8i16, V1, V1, Mask); } - + NewV = DAG.getNode(ISD::VECTOR_SHUFFLE, dl, MVT::v8i16, NewV, + DAG.getUNDEF(MVT::v8i16), + DAG.getBUILD_VECTOR(MVT::v8i16, dl, &MaskV[0], 8)); + } + + // In case BestHi & BestLo were both -1, which means each quadword has a word + // from each of the four input quadwords, calculate the InOrder bitvector now + // before falling through to the insert/extract cleanup. + if (BestLoQuad == -1 && BestHiQuad == -1) { NewV = V1; - for (unsigned i = 0; i < 8; ++i) { - SDValue Elt = V1Elts[i]; - if (Elt.getOpcode() == ISD::UNDEF) - continue; - unsigned EltIdx = cast(Elt)->getZExtValue(); - if (EltIdx < 8) + for (int i = 0; i != 8; ++i) + if (MaskVals[i] < 0 || MaskVals[i] == i) + InOrder.set(i); + } + + // The other elements are put in the right place using pextrw and pinsrw. + for (unsigned i = 0; i != 8; ++i) { + if (InOrder[i]) + continue; + int EltIdx = MaskVals[i]; + if (EltIdx < 0) + continue; + SDValue ExtOp = (EltIdx < 8) + ? DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, MVT::i16, V1, + DAG.getIntPtrConstant(EltIdx)) + : DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, MVT::i16, V2, + DAG.getIntPtrConstant(EltIdx - 8)); + NewV = DAG.getNode(ISD::INSERT_VECTOR_ELT, dl, MVT::v8i16, NewV, ExtOp, + DAG.getIntPtrConstant(i)); + } + return NewV; +} + +// v16i8 shuffles - Prefer shuffles in the following order: +// 1. [ssse3] 1 x pshufb +// 2. [ssse3] 2 x pshufb + 1 x por +// 3. [all] v8i16 shuffle + N x pextrw + rotate + pinsrw +static +SDValue LowerVECTOR_SHUFFLEv16i8(SDValue V1, SDValue V2, + SDValue PermMask, SelectionDAG &DAG, + X86TargetLowering &TLI, DebugLoc dl) { + SmallVector MaskElts(PermMask.getNode()->op_begin(), + PermMask.getNode()->op_end()); + SmallVector MaskVals; + + // If we have SSSE3, case 1 is generated when all result bytes come from + // one of the inputs. Otherwise, case 2 is generated. If no SSSE3 is + // present, fall back to case 3. + // FIXME: kill V2Only once shuffles are canonizalized by getNode. + bool V1Only = true; + bool V2Only = true; + for (unsigned i = 0; i < 16; ++i) { + SDValue Elt = MaskElts[i]; + int EltIdx = Elt.getOpcode() == ISD::UNDEF ? -1 : + cast(Elt)->getZExtValue(); + MaskVals.push_back(EltIdx); + if (EltIdx < 0) + continue; + if (EltIdx < 16) + V2Only = false; + else + V1Only = false; + } + + // If SSSE3, use 1 pshufb instruction per vector with elements in the result. + if (TLI.getSubtarget()->hasSSSE3()) { + SmallVector pshufbMask; + + // If all result elements are from one input vector, then only translate + // undef mask values to 0x80 (zero out result) in the pshufb mask. + // + // Otherwise, we have elements from both input vectors, and must zero out + // elements that come from V2 in the first mask, and V1 in the second mask + // so that we can OR them together. + bool TwoInputs = !(V1Only || V2Only); + for (unsigned i = 0; i != 16; ++i) { + int EltIdx = MaskVals[i]; + if (EltIdx < 0 || (TwoInputs && EltIdx >= 16)) { + pshufbMask.push_back(DAG.getConstant(0x80, MVT::i8)); continue; - SDValue ExtOp = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, MVT::i16, V2, - DAG.getConstant(EltIdx - 8, PtrVT)); - NewV = DAG.getNode(ISD::INSERT_VECTOR_ELT, dl, MVT::v8i16, NewV, ExtOp, - DAG.getConstant(i, PtrVT)); + } + pshufbMask.push_back(DAG.getConstant(EltIdx, MVT::i8)); } - return NewV; - } else { - // All elements are from V1. - NewV = V1; - for (unsigned i = 0; i < 8; ++i) { - SDValue Elt = V1Elts[i]; - if (Elt.getOpcode() == ISD::UNDEF) + // If all the elements are from V2, assign it to V1 and return after + // building the first pshufb. + if (V2Only) + V1 = V2; + V1 = DAG.getNode(X86ISD::PSHUFB, dl, MVT::v16i8, V1, + DAG.getBUILD_VECTOR(MVT::v16i8, dl, &pshufbMask[0], 16)); + if (!TwoInputs) + return V1; + + // Calculate the shuffle mask for the second input, shuffle it, and + // OR it with the first shuffled input. + pshufbMask.clear(); + for (unsigned i = 0; i != 16; ++i) { + int EltIdx = MaskVals[i]; + if (EltIdx < 16) { + pshufbMask.push_back(DAG.getConstant(0x80, MVT::i8)); continue; - unsigned EltIdx = cast(Elt)->getZExtValue(); - SDValue ExtOp = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, MVT::i16, V1, - DAG.getConstant(EltIdx, PtrVT)); - NewV = DAG.getNode(ISD::INSERT_VECTOR_ELT, dl, MVT::v8i16, NewV, ExtOp, - DAG.getConstant(i, PtrVT)); + } + pshufbMask.push_back(DAG.getConstant(EltIdx - 16, MVT::i8)); + } + V2 = DAG.getNode(X86ISD::PSHUFB, dl, MVT::v16i8, V2, + DAG.getBUILD_VECTOR(MVT::v16i8, dl, &pshufbMask[0], 16)); + return DAG.getNode(ISD::OR, dl, MVT::v16i8, V1, V2); + } + + // No SSSE3 - Calculate in place words and then fix all out of place words + // With 0-16 extracts & inserts. Worst case is 16 bytes out of order from + // the 16 different words that comprise the two doublequadword input vectors. + V1 = DAG.getNode(ISD::BIT_CONVERT, dl, MVT::v8i16, V1); + V2 = DAG.getNode(ISD::BIT_CONVERT, dl, MVT::v8i16, V2); + SDValue NewV = V2Only ? V2 : V1; + for (int i = 0; i != 8; ++i) { + int Elt0 = MaskVals[i*2]; + int Elt1 = MaskVals[i*2+1]; + + // This word of the result is all undef, skip it. + if (Elt0 < 0 && Elt1 < 0) + continue; + + // This word of the result is already in the correct place, skip it. + if (V1Only && (Elt0 == i*2) && (Elt1 == i*2+1)) + continue; + if (V2Only && (Elt0 == i*2+16) && (Elt1 == i*2+17)) + continue; + + SDValue Elt0Src = Elt0 < 16 ? V1 : V2; + SDValue Elt1Src = Elt1 < 16 ? V1 : V2; + SDValue InsElt; + + // If Elt1 is defined, extract it from the appropriate source. If the + // source byte is not also odd, shift the extracted word left 8 bits. + if (Elt1 >= 0) { + InsElt = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, MVT::i16, Elt1Src, + DAG.getIntPtrConstant(Elt1 / 2)); + if ((Elt1 & 1) == 0) + InsElt = DAG.getNode(ISD::SHL, dl, MVT::i16, InsElt, + DAG.getConstant(8, TLI.getShiftAmountTy())); + } + // If Elt0 is defined, extract it from the appropriate source. If the + // source byte is not also even, shift the extracted word right 8 bits. If + // Elt1 was also defined, OR the extracted values together before + // inserting them in the result. + if (Elt0 >= 0) { + SDValue InsElt0 = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, MVT::i16, + Elt0Src, DAG.getIntPtrConstant(Elt0 / 2)); + if ((Elt0 & 1) != 0) + InsElt0 = DAG.getNode(ISD::SRL, dl, MVT::i16, InsElt0, + DAG.getConstant(8, TLI.getShiftAmountTy())); + InsElt = Elt1 >= 0 ? DAG.getNode(ISD::OR, dl, MVT::i16, InsElt, InsElt0) + : InsElt0; } - return NewV; + NewV = DAG.getNode(ISD::INSERT_VECTOR_ELT, dl, MVT::v8i16, NewV, InsElt, + DAG.getIntPtrConstant(i)); } + return DAG.getNode(ISD::BIT_CONVERT, dl, MVT::v16i8, NewV); } /// RewriteAsNarrowerShuffle - Try rewriting v8i16 and v16i8 shuffles as 4 wide @@ -4078,6 +4166,8 @@ bool V1IsSplat = false; bool V2IsSplat = false; + // FIXME: Check for legal shuffle and return? + if (isUndefShuffle(Op.getNode())) return DAG.getUNDEF(VT); @@ -4239,6 +4329,7 @@ return Op; } + // FIXME: for mmx, bitcast v2i32 to v4i16 for shuffle. // Try PSHUF* first, then SHUFP*. // MMX doesn't have PSHUFD but it does have PSHUFW. While it's theoretically // possible to shuffle a v2i32 using PSHUFW, that's not yet implemented. @@ -4281,6 +4372,12 @@ return NewOp; } + if (VT == MVT::v16i8) { + SDValue NewOp = LowerVECTOR_SHUFFLEv16i8(V1, V2, PermMask, DAG, *this, dl); + if (NewOp.getNode()) + return NewOp; + } + // Handle all 4 wide cases with a number of shuffles except for MMX. if (NumElems == 4 && !isMMX) return LowerVECTOR_SHUFFLE_4wide(V1, V2, PermMask, VT, DAG, dl); @@ -4435,7 +4532,7 @@ if ((EVT.getSizeInBits() == 8 || EVT.getSizeInBits() == 16) && isa(N2)) { unsigned Opc = (EVT.getSizeInBits() == 8) ? X86ISD::PINSRB - : X86ISD::PINSRW; + : X86ISD::PINSRW; // Transform it so it match pinsr{b,w} which expects a GR32 as its second // argument. if (N1.getValueType() != MVT::i32) @@ -6830,6 +6927,7 @@ case X86ISD::INSERTPS: return "X86ISD::INSERTPS"; case X86ISD::PINSRB: return "X86ISD::PINSRB"; case X86ISD::PINSRW: return "X86ISD::PINSRW"; + case X86ISD::PSHUFB: return "X86ISD::PSHUFB"; case X86ISD::FMAX: return "X86ISD::FMAX"; case X86ISD::FMIN: return "X86ISD::FMIN"; case X86ISD::FRSQRT: return "X86ISD::FRSQRT"; @@ -6948,12 +7046,14 @@ bool X86TargetLowering::isShuffleMaskLegal(SDValue Mask, MVT VT) const { // Only do shuffles on 128-bit vector types for now. + // FIXME: pshufb, blends if (VT.getSizeInBits() == 64) return false; return (Mask.getNode()->getNumOperands() <= 4 || isIdentityMask(Mask.getNode()) || isIdentityMask(Mask.getNode(), true) || isSplatMask(Mask.getNode()) || - isPSHUFHW_PSHUFLWMask(Mask.getNode()) || + X86::isPSHUFHWMask(Mask.getNode()) || + X86::isPSHUFLWMask(Mask.getNode()) || X86::isUNPCKLMask(Mask.getNode()) || X86::isUNPCKHMask(Mask.getNode()) || X86::isUNPCKL_v_undef_Mask(Mask.getNode()) || Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.h?rev=65311&r1=65310&r2=65311&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.h (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.h Mon Feb 23 02:49:38 2009 @@ -176,6 +176,9 @@ /// corresponds to X86::PINSRW. PINSRW, + /// PSHUFB - Shuffle 16 8-bit values within a vector. + PSHUFB, + /// FMAX, FMIN - Floating point max and min. /// FMAX, FMIN, Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrSSE.td?rev=65311&r1=65310&r2=65311&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrSSE.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrSSE.td Mon Feb 23 02:49:38 2009 @@ -36,6 +36,9 @@ def X86fsrl : SDNode<"X86ISD::FSRL", SDTX86FPShiftOp>; def X86comi : SDNode<"X86ISD::COMI", SDTX86CmpTest>; def X86ucomi : SDNode<"X86ISD::UCOMI", SDTX86CmpTest>; +def X86pshufb : SDNode<"X86ISD::PSHUFB", + SDTypeProfile<1, 2, [SDTCisVT<0, v16i8>, SDTCisSameAs<0,1>, + SDTCisSameAs<0,2>]>>; def X86pextrb : SDNode<"X86ISD::PEXTRB", SDTypeProfile<1, 2, [SDTCisVT<0, i32>, SDTCisPtrTy<2>]>>; def X86pextrw : SDNode<"X86ISD::PEXTRW", @@ -2845,6 +2848,11 @@ imm:$src3))]>, OpSize; } +def : Pat<(X86pshufb VR128:$src, VR128:$mask), + (PSHUFBrr128 VR128:$src, VR128:$mask)>, Requires<[HasSSSE3]>; +def : Pat<(X86pshufb VR128:$src, (bc_v16i8 (memopv2i64 addr:$mask))), + (PSHUFBrm128 VR128:$src, addr:$mask)>, Requires<[HasSSSE3]>; + //===----------------------------------------------------------------------===// // Non-Instruction Patterns //===----------------------------------------------------------------------===// Modified: llvm/trunk/test/CodeGen/X86/vec_shuffle-12.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vec_shuffle-12.ll?rev=65311&r1=65310&r2=65311&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/vec_shuffle-12.ll (original) +++ llvm/trunk/test/CodeGen/X86/vec_shuffle-12.ll Mon Feb 23 02:49:38 2009 @@ -1,8 +1,8 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 > %t +; RUN: llvm-as < %s | llc -march=x86 -mcpu=yonah > %t ; RUN: not grep punpck %t ; RUN: grep pextrw %t | count 4 ; RUN: grep pinsrw %t | count 6 -; RUN: grep pshuflw %t | count 3 +; RUN: grep pshuflw %t | count 1 ; RUN: grep pshufhw %t | count 2 define <8 x i16> @t1(<8 x i16>* %A, <8 x i16>* %B) nounwind { Modified: llvm/trunk/test/CodeGen/X86/vec_shuffle-13.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vec_shuffle-13.ll?rev=65311&r1=65310&r2=65311&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/vec_shuffle-13.ll (original) +++ llvm/trunk/test/CodeGen/X86/vec_shuffle-13.ll Mon Feb 23 02:49:38 2009 @@ -1,7 +1,7 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 > %t +; RUN: llvm-as < %s | llc -march=x86 -mcpu=yonah > %t ; RUN: grep movlhps %t | count 1 -; RUN: grep movss %t | count 1 ; RUN: grep pshufd %t | count 1 +; RUN: grep movss %t | count 1 ; RUN: grep pshuflw %t | count 1 ; RUN: grep pshufhw %t | count 1 Modified: llvm/trunk/test/CodeGen/X86/vec_shuffle-2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vec_shuffle-2.ll?rev=65311&r1=65310&r2=65311&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/vec_shuffle-2.ll (original) +++ llvm/trunk/test/CodeGen/X86/vec_shuffle-2.ll Mon Feb 23 02:49:38 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mcpu=yonah -o %t -f ; RUN: grep pshufhw %t | count 1 ; RUN: grep pshuflw %t | count 1 ; RUN: grep movhps %t | count 1 Modified: llvm/trunk/test/CodeGen/X86/vec_shuffle-21.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vec_shuffle-21.ll?rev=65311&r1=65310&r2=65311&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/vec_shuffle-21.ll (original) +++ llvm/trunk/test/CodeGen/X86/vec_shuffle-21.ll Mon Feb 23 02:49:38 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mcpu=yonah -o %t -f ; RUN: grep pshuflw %t | count 1 ; RUN: grep pextrw %t | count 2 ; RUN: grep pinsrw %t | count 2 Modified: llvm/trunk/test/CodeGen/X86/vec_shuffle-28.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vec_shuffle-28.ll?rev=65311&r1=65310&r2=65311&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/vec_shuffle-28.ll (original) +++ llvm/trunk/test/CodeGen/X86/vec_shuffle-28.ll Mon Feb 23 02:49:38 2009 @@ -1,8 +1,12 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=sse41 -o %t -f -; RUN: grep punpcklwd %t | count 1 -; RUN: grep pextrw %t | count 6 -; RUN: grep pinsrw %t | count 8 +; RUN: llvm-as < %s | llc -march=x86 -mcpu=yonah -o %t -f +; RUN: grep movd %t | count 1 +; RUN: grep pshuflw %t | count 1 +; RUN: grep pinsrw %t | count 1 +; RUN: llvm-as < %s | llc -march=x86 -mcpu=core2 -o %t -f +; RUN: grep pshufb %t | count 1 +; FIXME: this test has a superfluous punpcklqdq pre-pshufb currently. +; Don't XFAIL it because it's still better than the previous code. ; Pack various elements via shuffles. define <8 x i16> @shuf1(<8 x i16> %T0, <8 x i16> %T1) nounwind readnone { @@ -10,24 +14,3 @@ %tmp7 = shufflevector <8 x i16> %T0, <8 x i16> %T1, <8 x i32> < i32 1, i32 8, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef , i32 undef > ret <8 x i16> %tmp7 } - - -define <8 x i16> @shuf2(<8 x i16> %T0, <8 x i16> %T1) nounwind readnone { -entry: - %tmp8 = shufflevector <8 x i16> %T0, <8 x i16> %T1, <8 x i32> < i32 undef, i32 undef, i32 7, i32 2, i32 8, i32 undef, i32 undef , i32 undef > - ret <8 x i16> %tmp8 -} - - -define <8 x i16> @shuf3(<8 x i16> %T0, <8 x i16> %T1) nounwind readnone { -entry: - %tmp9 = shufflevector <8 x i16> %T0, <8 x i16> %T1, <8 x i32> < i32 0, i32 1, i32 undef, i32 undef, i32 3, i32 11, i32 undef , i32 undef > - ret <8 x i16> %tmp9 -} - - -define <8 x i16> @shuf4(<8 x i16> %T0, <8 x i16> %T1) nounwind readnone { -entry: - %tmp9 = shufflevector <8 x i16> %T0, <8 x i16> %T1, <8 x i32> < i32 8, i32 9, i32 undef, i32 undef, i32 11, i32 3, i32 undef , i32 undef > - ret <8 x i16> %tmp9 -} Modified: llvm/trunk/test/CodeGen/X86/vec_shuffle-29.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vec_shuffle-29.ll?rev=65311&r1=65310&r2=65311&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/vec_shuffle-29.ll (original) +++ llvm/trunk/test/CodeGen/X86/vec_shuffle-29.ll Mon Feb 23 02:49:38 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=sse41 -disable-mmx -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mattr=sse41,-ssse3 -disable-mmx -o %t -f ; RUN: not grep pextrw %t ; RUN: grep pinsrw %t Added: llvm/trunk/test/CodeGen/X86/vec_shuffle-31.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vec_shuffle-31.ll?rev=65311&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/vec_shuffle-31.ll (added) +++ llvm/trunk/test/CodeGen/X86/vec_shuffle-31.ll Mon Feb 23 02:49:38 2009 @@ -0,0 +1,13 @@ +; RUN: llvm-as < %s | llc -march=x86 -mcpu=yonah -o %t -f +; RUN: grep pextrw %t | count 1 +; RUN: grep punpcklqdq %t | count 1 +; RUN: grep pshufhw %t | count 1 +; RUN: grep pinsrw %t | count 1 +; RUN: llvm-as < %s | llc -march=x86 -mcpu=core2 -o %t -f +; RUN: grep pshufb %t | count 1 + +define <8 x i16> @shuf3(<8 x i16> %T0, <8 x i16> %T1) nounwind readnone { +entry: + %tmp9 = shufflevector <8 x i16> %T0, <8 x i16> %T1, <8 x i32> < i32 0, i32 1, i32 undef, i32 undef, i32 3, i32 11, i32 undef , i32 undef > + ret <8 x i16> %tmp9 +} Added: llvm/trunk/test/CodeGen/X86/vec_shuffle-32.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vec_shuffle-32.ll?rev=65311&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/vec_shuffle-32.ll (added) +++ llvm/trunk/test/CodeGen/X86/vec_shuffle-32.ll Mon Feb 23 02:49:38 2009 @@ -0,0 +1,13 @@ +; RUN: llvm-as < %s | llc -march=x86 -mcpu=yonah -o %t -f +; RUN: grep punpcklqdq %t | count 1 +; RUN: grep pextrw %t | count 1 +; RUN: grep pshufd %t | count 1 +; RUN: grep pinsrw %t | count 1 +; RUN: llvm-as < %s | llc -march=x86 -mcpu=core2 -o %t -f +; RUN: grep pshufb %t | count 1 + +define <8 x i16> @shuf4(<8 x i16> %T0, <8 x i16> %T1) nounwind readnone { +entry: + %tmp9 = shufflevector <8 x i16> %T0, <8 x i16> %T1, <8 x i32> < i32 8, i32 9, i32 undef, i32 undef, i32 11, i32 3, i32 undef , i32 undef > + ret <8 x i16> %tmp9 +} Added: llvm/trunk/test/CodeGen/X86/vec_shuffle-33.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vec_shuffle-33.ll?rev=65311&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/vec_shuffle-33.ll (added) +++ llvm/trunk/test/CodeGen/X86/vec_shuffle-33.ll Mon Feb 23 02:49:38 2009 @@ -0,0 +1,11 @@ +; RUN: llvm-as < %s | llc -march=x86 -mcpu=yonah -o %t -f +; RUN: grep punpcklqdq %t | count 1 +; RUN: grep pshufhw %t | count 1 +; RUN: not grep pextrw %t +; RUN: not grep pinsrw %t + +define <8 x i16> @shuf5(<8 x i16> %T0, <8 x i16> %T1) nounwind readnone { +entry: + %tmp9 = shufflevector <8 x i16> %T0, <8 x i16> %T1, <8 x i32> < i32 8, i32 9, i32 undef, i32 undef, i32 undef, i32 2, i32 undef , i32 undef > + ret <8 x i16> %tmp9 +} Added: llvm/trunk/test/CodeGen/X86/vec_shuffle-34.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vec_shuffle-34.ll?rev=65311&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/vec_shuffle-34.ll (added) +++ llvm/trunk/test/CodeGen/X86/vec_shuffle-34.ll Mon Feb 23 02:49:38 2009 @@ -0,0 +1,13 @@ +; RUN: llvm-as < %s | llc -march=x86 -mcpu=yonah -o %t -f +; RUN: grep pextrw %t | count 1 +; RUN: grep punpcklqdq %t | count 1 +; RUN: grep pshuflw %t | count 1 +; RUN: grep pinsrw %t | count 1 +; RUN: llvm-as < %s | llc -march=x86 -mcpu=core2 -o %t -f +; RUN: grep pshufb %t | count 2 + +define <8 x i16> @shuf2(<8 x i16> %T0, <8 x i16> %T1) nounwind readnone { +entry: + %tmp8 = shufflevector <8 x i16> %T0, <8 x i16> %T1, <8 x i32> < i32 undef, i32 undef, i32 7, i32 2, i32 8, i32 undef, i32 undef , i32 undef > + ret <8 x i16> %tmp8 +} Added: llvm/trunk/test/CodeGen/X86/vec_shuffle-35.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vec_shuffle-35.ll?rev=65311&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/vec_shuffle-35.ll (added) +++ llvm/trunk/test/CodeGen/X86/vec_shuffle-35.ll Mon Feb 23 02:49:38 2009 @@ -0,0 +1,20 @@ +; RUN: llvm-as < %s | llc -march=x86 -mcpu=yonah -o %t -f +; RUN: grep pextrw %t | count 13 +; RUN: grep pinsrw %t | count 14 +; RUN: grep rolw %t | count 13 +; RUN: not grep esp %t +; RUN: not grep ebp %t +; RUN: llvm-as < %s | llc -march=x86 -mcpu=core2 -o %t -f +; RUN: grep pshufb %t | count 3 + +define <16 x i8> @shuf1(<16 x i8> %T0) nounwind readnone { +entry: + %tmp8 = shufflevector <16 x i8> %T0, <16 x i8> undef, <16 x i32> < i32 1, i32 0, i32 3, i32 2, i32 5, i32 4, i32 7, i32 6, i32 9, i32 8, i32 11, i32 10, i32 12, i32 13, i32 15 , i32 14 > + ret <16 x i8> %tmp8 +} + +define <16 x i8> @shuf2(<16 x i8> %T0, <16 x i8> %T1) nounwind readnone { +entry: + %tmp8 = shufflevector <16 x i8> %T0, <16 x i8> %T1, <16 x i32> < i32 undef, i32 undef, i32 3, i32 2, i32 17, i32 16, i32 7, i32 6, i32 9, i32 8, i32 11, i32 10, i32 12, i32 13, i32 15 , i32 14 > + ret <16 x i8> %tmp8 +} From natebegeman at mac.com Mon Feb 23 03:03:12 2009 From: natebegeman at mac.com (Nate Begeman) Date: Mon, 23 Feb 2009 09:03:12 -0000 Subject: [llvm-commits] [llvm] r65312 - /llvm/trunk/test/CodeGen/X86/vec_shuffle-35.ll Message-ID: <200902230903.n1N93DQi014136@zion.cs.uiuc.edu> Author: sampo Date: Mon Feb 23 03:03:06 2009 New Revision: 65312 URL: http://llvm.org/viewvc/llvm-project?rev=65312&view=rev Log: Make this test use darwin targe triple, to avoid stack traffic on linux. Modified: llvm/trunk/test/CodeGen/X86/vec_shuffle-35.ll Modified: llvm/trunk/test/CodeGen/X86/vec_shuffle-35.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vec_shuffle-35.ll?rev=65312&r1=65311&r2=65312&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/vec_shuffle-35.ll (original) +++ llvm/trunk/test/CodeGen/X86/vec_shuffle-35.ll Mon Feb 23 03:03:06 2009 @@ -7,6 +7,8 @@ ; RUN: llvm-as < %s | llc -march=x86 -mcpu=core2 -o %t -f ; RUN: grep pshufb %t | count 3 +target triple = "i386-apple-darwin9" + define <16 x i8> @shuf1(<16 x i8> %T0) nounwind readnone { entry: %tmp8 = shufflevector <16 x i8> %T0, <16 x i8> undef, <16 x i32> < i32 1, i32 0, i32 3, i32 2, i32 5, i32 4, i32 7, i32 6, i32 9, i32 8, i32 11, i32 10, i32 12, i32 13, i32 15 , i32 14 > From evan.cheng at apple.com Mon Feb 23 03:03:23 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 23 Feb 2009 09:03:23 -0000 Subject: [llvm-commits] [llvm] r65313 - in /llvm/trunk: lib/Target/X86/X86CallingConv.td lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86InstrMMX.td test/CodeGen/X86/ret-mmx.ll Message-ID: <200902230903.n1N93NvH014156@zion.cs.uiuc.edu> Author: evancheng Date: Mon Feb 23 03:03:22 2009 New Revision: 65313 URL: http://llvm.org/viewvc/llvm-project?rev=65313&view=rev Log: Only v1i16 (i.e. _m64) is returned via RAX / RDX. Modified: llvm/trunk/lib/Target/X86/X86CallingConv.td llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/Target/X86/X86InstrMMX.td llvm/trunk/test/CodeGen/X86/ret-mmx.ll Modified: llvm/trunk/lib/Target/X86/X86CallingConv.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CallingConv.td?rev=65313&r1=65312&r2=65313&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86CallingConv.td (original) +++ llvm/trunk/lib/Target/X86/X86CallingConv.td Mon Feb 23 03:03:22 2009 @@ -72,9 +72,11 @@ CCIfType<[f32], CCAssignToReg<[XMM0, XMM1]>>, CCIfType<[f64], CCAssignToReg<[XMM0, XMM1]>>, - // MMX vector types are always returned in RAX. This seems to disagree with - // ABI documentation but is bug compatible with gcc. - CCIfType<[v8i8, v4i16, v2i32, v1i64, v2f32], CCAssignToReg<[RAX]>>, + // MMX vector types are always returned in XMM0 except for v1i64 which is + // returned in RAX. This disagrees with ABI documentation but is bug + // compatible with gcc. + CCIfType<[v1i64], CCAssignToReg<[RAX]>>, + CCIfType<[v8i8, v4i16, v2i32, v2f32], CCAssignToReg<[XMM0, XMM1]>>, CCDelegateTo ]>; Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=65313&r1=65312&r2=65313&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Feb 23 03:03:22 2009 @@ -589,8 +589,6 @@ addRegisterClass(MVT::v2f32, X86::VR64RegisterClass); addRegisterClass(MVT::v1i64, X86::VR64RegisterClass); - // FIXME: add MMX packed arithmetics - setOperationAction(ISD::ADD, MVT::v8i8, Legal); setOperationAction(ISD::ADD, MVT::v4i16, Legal); setOperationAction(ISD::ADD, MVT::v2i32, Legal); @@ -997,12 +995,15 @@ continue; } - // 64-bit vector (MMX) values are returned in RAX. + // 64-bit vector (MMX) values are returned in XMM0 / XMM1 except for v1i64 + // which is returned in RAX / RDX. if (Subtarget->is64Bit()) { MVT ValVT = ValToCopy.getValueType(); - if (VA.getLocReg() == X86::RAX && - ValVT.isVector() && ValVT.getSizeInBits() == 64) + if (ValVT.isVector() && ValVT.getSizeInBits() == 64) { ValToCopy = DAG.getNode(ISD::BIT_CONVERT, dl, MVT::i64, ValToCopy); + if (VA.getLocReg() == X86::XMM0 || VA.getLocReg() == X86::XMM1) + ValToCopy = DAG.getNode(ISD::SCALAR_TO_VECTOR, dl, MVT::v2i64, ValToCopy); + } } Chain = DAG.getCopyToReg(Chain, dl, VA.getLocReg(), ValToCopy, Flag); @@ -1081,10 +1082,18 @@ SDValue Val; if (Is64Bit && CopyVT.isVector() && CopyVT.getSizeInBits() == 64) { - // For x86-64, MMX values are returned in RAX. - Chain = DAG.getCopyFromReg(Chain, dl, VA.getLocReg(), - MVT::i64, InFlag).getValue(1); - Val = Chain.getValue(0); + // For x86-64, MMX values are returned in XMM0 / XMM1 except for v1i64. + if (VA.getLocReg() == X86::XMM0 || VA.getLocReg() == X86::XMM1) { + Chain = DAG.getCopyFromReg(Chain, dl, VA.getLocReg(), + MVT::v2i64, InFlag).getValue(1); + Val = Chain.getValue(0); + Val = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, MVT::i64, + Val, DAG.getConstant(0, MVT::i64)); + } else { + Chain = DAG.getCopyFromReg(Chain, dl, VA.getLocReg(), + MVT::i64, InFlag).getValue(1); + Val = Chain.getValue(0); + } Val = DAG.getNode(ISD::BIT_CONVERT, dl, CopyVT, Val); } else { Chain = DAG.getCopyFromReg(Chain, dl, VA.getLocReg(), @@ -6706,7 +6715,7 @@ DebugLoc dl = Node->getDebugLoc(); MVT T = Node->getValueType(0); SDValue negOp = DAG.getNode(ISD::SUB, dl, T, - DAG.getConstant(0, T), Node->getOperand(2)); + DAG.getConstant(0, T), Node->getOperand(2)); return DAG.getAtomic(ISD::ATOMIC_LOAD_ADD, dl, cast(Node)->getMemoryVT(), Node->getOperand(0), Modified: llvm/trunk/lib/Target/X86/X86InstrMMX.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrMMX.td?rev=65313&r1=65312&r2=65313&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrMMX.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrMMX.td Mon Feb 23 03:03:22 2009 @@ -156,10 +156,12 @@ let neverHasSideEffects = 1 in def MMX_MOVD64to64rr : MMXRI<0x6E, MRMSrcReg, (outs VR64:$dst), (ins GR64:$src), - "movd\t{$src, $dst|$dst, $src}", []>; + "movd\t{$src, $dst|$dst, $src}", + []>; let neverHasSideEffects = 1 in -def MMX_MOVD64from64rr : MMXRI<0x7E, MRMSrcReg, (outs GR64:$dst), (ins VR64:$src), +def MMX_MOVD64from64rr : MMXRI<0x7E, MRMSrcReg, + (outs GR64:$dst), (ins VR64:$src), "movd\t{$src, $dst|$dst, $src}", []>; let neverHasSideEffects = 1 in @@ -187,6 +189,10 @@ (v2i64 (scalar_to_vector (i64 (bitconvert VR64:$src)))), MOVL_shuffle_mask)))]>; +let neverHasSideEffects = 1 in +def MMX_MOVQ2FR64rr: SSDIi8<0xD6, MRMDestMem, (outs FR64:$dst), (ins VR64:$src), + "movq2dq\t{$src, $dst|$dst, $src}", []>; + def MMX_MOVNTQmr : MMXI<0xE7, MRMDestMem, (outs), (ins i64mem:$dst, VR64:$src), "movntq\t{$src, $dst|$dst, $src}", [(int_x86_mmx_movnt_dq addr:$dst, VR64:$src)]>; @@ -575,9 +581,17 @@ (MMX_MOVD64from64rr VR64:$src)>; def : Pat<(i64 (bitconvert (v8i8 VR64:$src))), (MMX_MOVD64from64rr VR64:$src)>; +def : Pat<(f64 (bitconvert (v1i64 VR64:$src))), + (MMX_MOVQ2FR64rr VR64:$src)>; +def : Pat<(f64 (bitconvert (v2i32 VR64:$src))), + (MMX_MOVQ2FR64rr VR64:$src)>; +def : Pat<(f64 (bitconvert (v4i16 VR64:$src))), + (MMX_MOVQ2FR64rr VR64:$src)>; +def : Pat<(f64 (bitconvert (v8i8 VR64:$src))), + (MMX_MOVQ2FR64rr VR64:$src)>; -// Move scalar to XMM zero-extended -// movd to XMM register zero-extends +// Move scalar to MMX zero-extended +// movd to MMX register zero-extends let AddedComplexity = 15 in { def : Pat<(v8i8 (X86vzmovl (bc_v8i8 (v2i32 (scalar_to_vector GR32:$src))))), (MMX_MOVZDI2PDIrr GR32:$src)>; @@ -667,7 +681,13 @@ (MMX_PANDNrm VR64:$src1, addr:$src2)>; // Move MMX to lower 64-bit of XMM -def : Pat<(v2i64 (scalar_to_vector (i64 (bitconvert VR64:$src)))), +def : Pat<(v2i64 (scalar_to_vector (i64 (bitconvert (v8i8 VR64:$src))))), + (v2i64 (MMX_MOVQ2DQrr VR64:$src))>; +def : Pat<(v2i64 (scalar_to_vector (i64 (bitconvert (v4i16 VR64:$src))))), + (v2i64 (MMX_MOVQ2DQrr VR64:$src))>; +def : Pat<(v2i64 (scalar_to_vector (i64 (bitconvert (v2i32 VR64:$src))))), + (v2i64 (MMX_MOVQ2DQrr VR64:$src))>; +def : Pat<(v2i64 (scalar_to_vector (i64 (bitconvert (v1i64 VR64:$src))))), (v2i64 (MMX_MOVQ2DQrr VR64:$src))>; // Move lower 64-bit of XMM to MMX. Modified: llvm/trunk/test/CodeGen/X86/ret-mmx.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/ret-mmx.ll?rev=65313&r1=65312&r2=65313&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/ret-mmx.ll (original) +++ llvm/trunk/test/CodeGen/X86/ret-mmx.ll Mon Feb 23 03:03:22 2009 @@ -10,8 +10,17 @@ ret void } +declare <1 x i64> @return_v1di() + define <1 x i64> @t2() nounwind { ret <1 x i64> } -declare <1 x i64> @return_v1di() +define <2 x i32> @t3() nounwind { + ret <2 x i32> +} + +define double @t4() nounwind { + ret double bitcast (<2 x i32> to double) +} + From zhousheng00 at gmail.com Mon Feb 23 04:14:26 2009 From: zhousheng00 at gmail.com (Zhou Sheng) Date: Mon, 23 Feb 2009 10:14:26 -0000 Subject: [llvm-commits] [llvm] r65314 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200902231014.n1NAERCI020336@zion.cs.uiuc.edu> Author: sheng Date: Mon Feb 23 04:14:11 2009 New Revision: 65314 URL: http://llvm.org/viewvc/llvm-project?rev=65314&view=rev Log: Should reset DBI_Prev if DBI_Next == 0. Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=65314&r1=65313&r2=65314&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Mon Feb 23 04:14:11 2009 @@ -12419,6 +12419,8 @@ DBI_Prev->eraseFromParent(); } DBI_Prev = DBI_Next; + } else { + DBI_Prev = 0; } IC.AddToWorkList(Inst); From zhousheng00 at gmail.com Mon Feb 23 04:15:05 2009 From: zhousheng00 at gmail.com (Zhou Sheng) Date: Mon, 23 Feb 2009 10:15:05 -0000 Subject: [llvm-commits] [llvm] r65315 - /llvm/trunk/test/DebugInfo/2009-02-23-InstCombine.ll Message-ID: <200902231015.n1NAF5aj020359@zion.cs.uiuc.edu> Author: sheng Date: Mon Feb 23 04:15:04 2009 New Revision: 65315 URL: http://llvm.org/viewvc/llvm-project?rev=65315&view=rev Log: Add test case for checkin @r65314. Added: llvm/trunk/test/DebugInfo/2009-02-23-InstCombine.ll Added: llvm/trunk/test/DebugInfo/2009-02-23-InstCombine.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/2009-02-23-InstCombine.ll?rev=65315&view=auto ============================================================================== --- llvm/trunk/test/DebugInfo/2009-02-23-InstCombine.ll (added) +++ llvm/trunk/test/DebugInfo/2009-02-23-InstCombine.ll Mon Feb 23 04:15:04 2009 @@ -0,0 +1,41 @@ +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep stoppoint | count 3 +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32" +target triple = "i386-pc-linux-gnu" + %llvm.dbg.anchor.type = type { i32, i32 } + %llvm.dbg.basictype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, i32 } + %llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8*, i1, i1, i8*, i32 } + %llvm.dbg.composite.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, { }*, { }*, i32 } + %llvm.dbg.subprogram.type = type { i32, { }*, { }*, i8*, i8*, i8*, { }*, i32, { }*, i1, i1 } + %llvm.dbg.variable.type = type { i32, { }*, i8*, { }*, i32, { }* } + at llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 17 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1] + at .str = internal constant [8 x i8] c"brach.c\00", section "llvm.metadata" ; <[8 x i8]*> [#uses=1] + at .str1 = internal constant [38 x i8] c"/developer/home2/zsth/test/debug/tmp/\00", section "llvm.metadata" ; <[38 x i8]*> [#uses=1] + at .str2 = internal constant [52 x i8] c"4.2.1 (Based on Apple Inc. build 5641) (LLVM build)\00", section "llvm.metadata" ; <[52 x i8]*> [#uses=1] + at llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type { i32 458769, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to { }*), i32 1, i8* getelementptr ([8 x i8]* @.str, i32 0, i32 0), i8* getelementptr ([38 x i8]* @.str1, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str2, i32 0, i32 0), i1 true, i1 false, i8* null, i32 -1 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1] + at .str3 = internal constant [4 x i8] c"int\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1] + at llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type { i32 458788, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str3, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 32, i64 32, i64 0, i32 0, i32 5 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1] + at llvm.dbg.array = internal constant [2 x { }*] [{ }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*), { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*)], section "llvm.metadata" ; <[2 x { }*]*> [#uses=1] + at llvm.dbg.composite = internal constant %llvm.dbg.composite.type { i32 458773, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 0, i64 0, i64 0, i32 0, { }* null, { }* bitcast ([2 x { }*]* @llvm.dbg.array to { }*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1] + at llvm.dbg.subprograms = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 46 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1] + at .str4 = internal constant [4 x i8] c"foo\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1] + at llvm.dbg.subprogram = internal constant %llvm.dbg.subprogram.type { i32 458798, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str4, i32 0, i32 0), i8* getelementptr ([4 x i8]* @.str4, i32 0, i32 0), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 1, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite to { }*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] + at .str5 = internal constant [2 x i8] c"x\00", section "llvm.metadata" ; <[2 x i8]*> [#uses=1] + at llvm.dbg.variable = internal constant %llvm.dbg.variable.type { i32 459009, { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*), i8* getelementptr ([2 x i8]* @.str5, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 1, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=0] + +define i32 @foo(i32 %x) nounwind { +entry: + %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] + call void @llvm.dbg.stoppoint(i32 2, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) + %0 = icmp sgt i32 %x, 5 ; [#uses=1] + %.0 = select i1 %0, i32 %x, i32 0 ; [#uses=1] + call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) + ret i32 %.0 +} + +declare void @llvm.dbg.func.start({ }*) nounwind + +declare void @llvm.dbg.declare({ }*, { }*) nounwind + +declare void @llvm.dbg.stoppoint(i32, i32, { }*) nounwind + +declare void @llvm.dbg.region.end({ }*) nounwind From gohman at apple.com Mon Feb 23 10:29:41 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 23 Feb 2009 16:29:41 -0000 Subject: [llvm-commits] [llvm] r65318 - /llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp Message-ID: <200902231629.n1NGTgT1000645@zion.cs.uiuc.edu> Author: djg Date: Mon Feb 23 10:29:41 2009 New Revision: 65318 URL: http://llvm.org/viewvc/llvm-project?rev=65318&view=rev Log: IndVarSimplify preserves ScalarEvolution. In the -std-compile-opts sequence, this avoids the need for ScalarEvolution to be rerun before LoopDeletion. Modified: llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp Modified: llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp?rev=65318&r1=65317&r2=65318&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp Mon Feb 23 10:29:41 2009 @@ -81,6 +81,7 @@ AU.addRequiredID(LCSSAID); AU.addRequiredID(LoopSimplifyID); AU.addRequired(); + AU.addPreserved(); AU.addPreservedID(LoopSimplifyID); AU.addPreservedID(LCSSAID); AU.setPreservesCFG(); From gohman at apple.com Mon Feb 23 10:34:46 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 23 Feb 2009 16:34:46 -0000 Subject: [llvm-commits] [llvm] r65319 - /llvm/trunk/test/CodeGen/X86/vec_shuffle-35.ll Message-ID: <200902231634.n1NGYkgw000846@zion.cs.uiuc.edu> Author: djg Date: Mon Feb 23 10:34:46 2009 New Revision: 65319 URL: http://llvm.org/viewvc/llvm-project?rev=65319&view=rev Log: Use the -stack-alignment option instead of using a target triple for avoiding dynamic stack realignment. Modified: llvm/trunk/test/CodeGen/X86/vec_shuffle-35.ll Modified: llvm/trunk/test/CodeGen/X86/vec_shuffle-35.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vec_shuffle-35.ll?rev=65319&r1=65318&r2=65319&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/vec_shuffle-35.ll (original) +++ llvm/trunk/test/CodeGen/X86/vec_shuffle-35.ll Mon Feb 23 10:34:46 2009 @@ -1,14 +1,12 @@ -; RUN: llvm-as < %s | llc -march=x86 -mcpu=yonah -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mcpu=yonah -stack-alignment=16 -o %t -f ; RUN: grep pextrw %t | count 13 ; RUN: grep pinsrw %t | count 14 ; RUN: grep rolw %t | count 13 ; RUN: not grep esp %t ; RUN: not grep ebp %t -; RUN: llvm-as < %s | llc -march=x86 -mcpu=core2 -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mcpu=core2 -stack-alignment=16 -o %t -f ; RUN: grep pshufb %t | count 3 -target triple = "i386-apple-darwin9" - define <16 x i8> @shuf1(<16 x i8> %T0) nounwind readnone { entry: %tmp8 = shufflevector <16 x i8> %T0, <16 x i8> undef, <16 x i32> < i32 1, i32 0, i32 3, i32 2, i32 5, i32 4, i32 7, i32 6, i32 9, i32 8, i32 11, i32 10, i32 12, i32 13, i32 15 , i32 14 > From tonic at nondot.org Mon Feb 23 11:22:41 2009 From: tonic at nondot.org (Tanya M. Lattner) Date: Mon, 23 Feb 2009 09:22:41 -0800 (PST) Subject: [llvm-commits] [llvm] r65310 - /llvm/trunk/tools/lto/LTOCodeGenerator.cpp In-Reply-To: <200902230917.57685.baldrick@free.fr> References: <200902230741.n1N7fvch004662@zion.cs.uiuc.edu> <697C5B7A-65F0-4812-AC82-8A8470C19B89@apple.com> <200902230917.57685.baldrick@free.fr> Message-ID: No. At this stage it has to be a regression in llvm-test or dejagnu tests (failure, not performance). -Tanya On Mon, 23 Feb 2009, Duncan Sands wrote: > On Monday 23 February 2009 08:56:07 Evan Cheng wrote: >> Wow. How did that happen? That would explain why LTO has been >> pessimizing code! "Fast" codegen means fast isel and disabling a lot >> of codegen optimizations. Thanks for catching this. > > Maybe this should go in the release? > > Ciao, > > D. > From gohman at apple.com Mon Feb 23 11:10:29 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 23 Feb 2009 17:10:29 -0000 Subject: [llvm-commits] [llvm] r65323 - /llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp Message-ID: <200902231710.n1NHAT7C002146@zion.cs.uiuc.edu> Author: djg Date: Mon Feb 23 11:10:29 2009 New Revision: 65323 URL: http://llvm.org/viewvc/llvm-project?rev=65323&view=rev Log: LoopDeletion needs to inform ScalarEvolution when a loop is deleted, so that ScalarEvolution doesn't hang onto a dangling Loop*, which could be a problem if another Loop happens to get allocated at the same address. Modified: llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp Modified: llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp?rev=65323&r1=65322&r2=65323&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp Mon Feb 23 11:10:29 2009 @@ -260,7 +260,10 @@ for (Loop::block_iterator LI = L->block_begin(), LE = L->block_end(); LI != LE; ++LI) (*LI)->eraseFromParent(); - + + // Tell ScalarEvolution that the loop is deleted. + SE.forgetLoopIterationCount(L); + // Finally, the blocks from loopinfo. This has to happen late because // otherwise our loop iterators won't work. LoopInfo& loopInfo = getAnalysis(); From kremenek at apple.com Mon Feb 23 11:27:18 2009 From: kremenek at apple.com (Ted Kremenek) Date: Mon, 23 Feb 2009 17:27:18 -0000 Subject: [llvm-commits] [llvm] r65326 - in /llvm/trunk/include/llvm/ADT: ImmutableMap.h ImmutableSet.h Message-ID: <200902231727.n1NHRIsr002763@zion.cs.uiuc.edu> Author: kremenek Date: Mon Feb 23 11:27:18 2009 New Revision: 65326 URL: http://llvm.org/viewvc/llvm-project?rev=65326&view=rev Log: Add ImmutableMap::getMaxElement(), a method that returns the pair in a ImmutableMap that has the highest ranked key. Modified: llvm/trunk/include/llvm/ADT/ImmutableMap.h llvm/trunk/include/llvm/ADT/ImmutableSet.h Modified: llvm/trunk/include/llvm/ADT/ImmutableMap.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ImmutableMap.h?rev=65326&r1=65325&r2=65326&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/ImmutableMap.h (original) +++ llvm/trunk/include/llvm/ADT/ImmutableMap.h Mon Feb 23 11:27:18 2009 @@ -202,6 +202,13 @@ return 0; } + + /// getMaxElement - Returns the pair in the ImmutableMap for + /// which key is the highest in the ordering of keys in the map. This + /// method returns NULL if the map is empty. + value_type* getMaxElement() const { + return Root ? &(Root->getMaxElement()) : 0; + } //===--------------------------------------------------===// // Utility methods. Modified: llvm/trunk/include/llvm/ADT/ImmutableSet.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ImmutableSet.h?rev=65326&r1=65325&r2=65326&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/ImmutableSet.h (original) +++ llvm/trunk/include/llvm/ADT/ImmutableSet.h Mon Feb 23 11:27:18 2009 @@ -86,6 +86,15 @@ return NULL; } + + /// getMaxElement - Find the subtree associated with the highest ranged + /// key value. + ImutAVLTree* getMaxElement() { + ImutAVLTree *T = this; + ImutAVLTree *Right = T->getRight(); + while (Right) { T = Right; Right = T->getRight(); } + return T; + } /// size - Returns the number of nodes in the tree, which includes /// both leaves and non-leaf nodes. From kremenek at apple.com Mon Feb 23 11:28:16 2009 From: kremenek at apple.com (Ted Kremenek) Date: Mon, 23 Feb 2009 17:28:16 -0000 Subject: [llvm-commits] [llvm] r65327 - /llvm/trunk/include/llvm/ADT/ImmutableMap.h Message-ID: <200902231728.n1NHSGRR002806@zion.cs.uiuc.edu> Author: kremenek Date: Mon Feb 23 11:28:16 2009 New Revision: 65327 URL: http://llvm.org/viewvc/llvm-project?rev=65327&view=rev Log: Correctly implement ImmutableMap::getMaxElement() by getting the actual pair. Modified: llvm/trunk/include/llvm/ADT/ImmutableMap.h Modified: llvm/trunk/include/llvm/ADT/ImmutableMap.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ImmutableMap.h?rev=65327&r1=65326&r2=65327&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/ImmutableMap.h (original) +++ llvm/trunk/include/llvm/ADT/ImmutableMap.h Mon Feb 23 11:28:16 2009 @@ -207,7 +207,7 @@ /// which key is the highest in the ordering of keys in the map. This /// method returns NULL if the map is empty. value_type* getMaxElement() const { - return Root ? &(Root->getMaxElement()) : 0; + return Root ? &(Root->getMaxElement()->getValue()) : 0; } //===--------------------------------------------------===// From dalej at apple.com Mon Feb 23 11:50:33 2009 From: dalej at apple.com (Dale Johannesen) Date: Mon, 23 Feb 2009 09:50:33 -0800 Subject: [llvm-commits] [llvm] r65310 - /llvm/trunk/tools/lto/LTOCodeGenerator.cpp In-Reply-To: <49A2575E.2090302@mxc.ca> References: <200902230741.n1N7fvch004662@zion.cs.uiuc.edu> <697C5B7A-65F0-4812-AC82-8A8470C19B89@apple.com> <49A2575E.2090302@mxc.ca> Message-ID: <6711D1FD-AE97-4095-8E0C-06E7C3418FD4@apple.com> On Feb 22, 2009, at 11:59 PMPST, Nick Lewycky wrote: > Evan Cheng wrote: >> Wow. How did that happen? That would explain why LTO has been >> pessimizing code! "Fast" codegen means fast isel and disabling a lot >> of codegen optimizations. Thanks for catching this. > > My guess is that somebody looked at the flag named "Fast" and said "of > course I want fast!" It really should have been named "DisableOpt" or > something more sinister. That's probably true; there's a certain amount of precedent for -fast meaning "generate code that runs fast". E.g. Sun's compilers and Apple's versions of gcc have this. > And yes, I expect this to put an end to the mysterious "my code is > slower with LTO" problem. :) > > Nick > >> Evan >> >> On Feb 22, 2009, at 11:41 PM, Nick Lewycky wrote: >> >>> Author: nicholas >>> Date: Mon Feb 23 01:41:55 2009 >>> New Revision: 65310 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=65310&view=rev >>> Log: >>> If nobody minds, I'm using LTO to produce faster binaries. Switch >>> fast codegen >>> off in libLTO. >>> >>> Modified: >>> llvm/trunk/tools/lto/LTOCodeGenerator.cpp >>> >>> Modified: llvm/trunk/tools/lto/LTOCodeGenerator.cpp >>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOCodeGenerator.cpp?rev=65310&r1=65309&r2=65310&view=diff >>> >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> ==================================================================== >>> --- llvm/trunk/tools/lto/LTOCodeGenerator.cpp (original) >>> +++ llvm/trunk/tools/lto/LTOCodeGenerator.cpp Mon Feb 23 01:41:55 >>> 2009 >>> @@ -420,7 +420,7 @@ >>> MachineCodeEmitter* mce = NULL; >>> >>> switch (_target->addPassesToEmitFile(*codeGenPasses, out, >>> - TargetMachine::AssemblyFile, >>> true)) { >>> + TargetMachine::AssemblyFile, >>> false)) { >>> case FileModel::MachOFile: >>> mce = AddMachOWriter(*codeGenPasses, out, *_target); >>> break; >>> @@ -435,7 +435,7 @@ >>> return true; >>> } >>> >>> - if (_target->addPassesToEmitFileFinish(*codeGenPasses, mce, >>> true)) { >>> + if (_target->addPassesToEmitFileFinish(*codeGenPasses, mce, >>> false)) { >>> errMsg = "target does not support generation of this file >>> type"; >>> return true; >>> } >>> >>> >>> _______________________________________________ >>> llvm-commits mailing list >>> llvm-commits at cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From isanbard at gmail.com Mon Feb 23 13:41:54 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 23 Feb 2009 19:41:54 -0000 Subject: [llvm-commits] [llvm] r65336 - /llvm/branches/Apple/Dib/tools/lto/LTOCodeGenerator.cpp Message-ID: <200902231941.n1NJfsvg007509@zion.cs.uiuc.edu> Author: void Date: Mon Feb 23 13:41:52 2009 New Revision: 65336 URL: http://llvm.org/viewvc/llvm-project?rev=65336&view=rev Log: Pull r65310 into Dib: If nobody minds, I'm using LTO to produce faster binaries. Switch fast codegen off in libLTO. Modified: llvm/branches/Apple/Dib/tools/lto/LTOCodeGenerator.cpp Modified: llvm/branches/Apple/Dib/tools/lto/LTOCodeGenerator.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/tools/lto/LTOCodeGenerator.cpp?rev=65336&r1=65335&r2=65336&view=diff ============================================================================== --- llvm/branches/Apple/Dib/tools/lto/LTOCodeGenerator.cpp (original) +++ llvm/branches/Apple/Dib/tools/lto/LTOCodeGenerator.cpp Mon Feb 23 13:41:52 2009 @@ -420,7 +420,7 @@ MachineCodeEmitter* mce = NULL; switch (_target->addPassesToEmitFile(*codeGenPasses, out, - TargetMachine::AssemblyFile, true)) { + TargetMachine::AssemblyFile, false)) { case FileModel::MachOFile: mce = AddMachOWriter(*codeGenPasses, out, *_target); break; @@ -435,7 +435,7 @@ return true; } - if (_target->addPassesToEmitFileFinish(*codeGenPasses, mce, true)) { + if (_target->addPassesToEmitFileFinish(*codeGenPasses, mce, false)) { errMsg = "target does not support generation of this file type"; return true; } From clattner at apple.com Mon Feb 23 14:48:33 2009 From: clattner at apple.com (Chris Lattner) Date: Mon, 23 Feb 2009 12:48:33 -0800 Subject: [llvm-commits] [llvm] r65296 - in /llvm/trunk: include/llvm/CodeGen/ lib/CodeGen/SelectionDAG/ lib/Target/CellSPU/ lib/Target/PowerPC/ lib/Target/X86/ test/CodeGen/X86/ In-Reply-To: <200902222336.n1MNaCHX020497@zion.cs.uiuc.edu> References: <200902222336.n1MNaCHX020497@zion.cs.uiuc.edu> Message-ID: On Feb 22, 2009, at 3:36 PM, Scott Michel wrote: > Author: pingbak > Date: Sun Feb 22 17:36:09 2009 > New Revision: 65296 > > URL: http://llvm.org/viewvc/llvm-project?rev=65296&view=rev > Log: > Introduce the BuildVectorSDNode class that encapsulates the > ISD::BUILD_VECTOR > instruction. The class also consolidates the code for detecting > constant > splats that's shared across PowerPC and the CellSPU backends (and > might be > useful for other backends.) Also introduces > SelectionDAG::getBUID_VECTOR() for > generating new BUILD_VECTOR nodes. Hi Scott, Before making a major change like this it really is best to float the idea by the list. I don't see any reason to make this sort of change. Sharing code between targets is definitely goodness, but the way you are doing this seems very strange. Instead of creating a new SDNode class, why not move the various functionality to helper functions on SDNode or SelectionDAG? -Chris From isanbard at gmail.com Mon Feb 23 15:15:55 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 23 Feb 2009 21:15:55 -0000 Subject: [llvm-commits] [llvm] r65337 - /llvm/branches/Apple/Dib/lib/Transforms/Utils/BasicInliner.cpp Message-ID: <200902232115.n1NLFtm5011933@zion.cs.uiuc.edu> Author: void Date: Mon Feb 23 15:15:54 2009 New Revision: 65337 URL: http://llvm.org/viewvc/llvm-project?rev=65337&view=rev Log: --- Merging (from foreign repository) r65309 into '.': U lib/Transforms/Utils/BasicInliner.cpp Changed option name from inline-threshold to basic-inline-threshold because inline-threshold option is used by the inliner. Modified: llvm/branches/Apple/Dib/lib/Transforms/Utils/BasicInliner.cpp Modified: llvm/branches/Apple/Dib/lib/Transforms/Utils/BasicInliner.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Transforms/Utils/BasicInliner.cpp?rev=65337&r1=65336&r2=65337&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Transforms/Utils/BasicInliner.cpp (original) +++ llvm/branches/Apple/Dib/lib/Transforms/Utils/BasicInliner.cpp Mon Feb 23 15:15:54 2009 @@ -27,7 +27,7 @@ using namespace llvm; static cl::opt -BasicInlineThreshold("inline-threshold", cl::Hidden, cl::init(200), +BasicInlineThreshold("basic-inline-threshold", cl::Hidden, cl::init(200), cl::desc("Control the amount of basic inlining to perform (default = 200)")); namespace llvm { From gohman at apple.com Mon Feb 23 16:03:09 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 23 Feb 2009 22:03:09 -0000 Subject: [llvm-commits] [llvm] r65341 - in /llvm/trunk: lib/Target/X86/X86FastISel.cpp test/CodeGen/X86/fast-isel-tls.ll Message-ID: <200902232203.n1NM39Xf013577@zion.cs.uiuc.edu> Author: djg Date: Mon Feb 23 16:03:08 2009 New Revision: 65341 URL: http://llvm.org/viewvc/llvm-project?rev=65341&view=rev Log: Fast-isel can't do TLS yet, so it should fall back to SDISel if it sees TLS addresses. Added: llvm/trunk/test/CodeGen/X86/fast-isel-tls.ll Modified: llvm/trunk/lib/Target/X86/X86FastISel.cpp Modified: llvm/trunk/lib/Target/X86/X86FastISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FastISel.cpp?rev=65341&r1=65340&r2=65341&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86FastISel.cpp (original) +++ llvm/trunk/lib/Target/X86/X86FastISel.cpp Mon Feb 23 16:03:08 2009 @@ -21,6 +21,7 @@ #include "X86TargetMachine.h" #include "llvm/CallingConv.h" #include "llvm/DerivedTypes.h" +#include "llvm/GlobalVariable.h" #include "llvm/Instructions.h" #include "llvm/Intrinsics.h" #include "llvm/CodeGen/FastISel.h" @@ -433,6 +434,11 @@ (AM.Base.Reg != 0 || AM.IndexReg != 0)) return false; + // Can't handle TLS yet. + if (GlobalVariable *GVar = dyn_cast(GV)) + if (GVar->isThreadLocal()) + return false; + // Set up the basic address. AM.GV = GV; if (!isCall && Added: llvm/trunk/test/CodeGen/X86/fast-isel-tls.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/fast-isel-tls.ll?rev=65341&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/fast-isel-tls.ll (added) +++ llvm/trunk/test/CodeGen/X86/fast-isel-tls.ll Mon Feb 23 16:03:08 2009 @@ -0,0 +1,10 @@ +; RUN: llvm-as < %s | llc -march=x86 -relocation-model=pic -mtriple=i686-unknown-linux-gnu -fast-isel | grep __tls_get_addr +; PR3654 + + at v = thread_local global i32 0 +define i32 @f() nounwind { +entry: + %t = load i32* @v + %s = add i32 %t, 1 + ret i32 %s +} From clattner at apple.com Mon Feb 23 16:30:32 2009 From: clattner at apple.com (Chris Lattner) Date: Mon, 23 Feb 2009 14:30:32 -0800 Subject: [llvm-commits] [llvm] r65289 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp In-Reply-To: <200902221806.n1MI6Xj2009464@zion.cs.uiuc.edu> References: <200902221806.n1MI6Xj2009464@zion.cs.uiuc.edu> Message-ID: <1C61B8A9-1B56-462A-B4BE-6F97B2A89E41@apple.com> On Feb 22, 2009, at 10:06 AM, Dan Gohman wrote: > Author: djg > Date: Sun Feb 22 12:06:32 2009 > New Revision: 65289 > > URL: http://llvm.org/viewvc/llvm-project?rev=65289&view=rev > Log: > Revert the part of 64623 that attempted to align the source in a > memcpy to match the alignment of the destination. It isn't necessary > for making loads and stores handled like the SSE loadu/storeu > intrinsics, and it was causing a performance regression in > MultiSource/Applications/JM/lencod. > > The problem appears to have been a memcpy that copies from some > highly aligned array into an alloca; the alloca was then being > assigned a large alignment, which required codegen to perform > dynamic stack-pointer re-alignment, which forced the enclosing > function to have a frame pointer, which led to increased spilling. testcase? -Chris > > > Modified: > llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp > > Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=65289&r1=65288&r2=65289&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp > (original) > +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Sun > Feb 22 12:06:32 2009 > @@ -9286,7 +9286,7 @@ > > Instruction *InstCombiner::SimplifyMemTransfer(MemIntrinsic *MI) { > unsigned DstAlign = GetOrEnforceKnownAlignment(MI->getOperand(1)); > - unsigned SrcAlign = GetOrEnforceKnownAlignment(MI->getOperand(2), > DstAlign); > + unsigned SrcAlign = GetOrEnforceKnownAlignment(MI->getOperand(2)); > unsigned MinAlign = std::min(DstAlign, SrcAlign); > unsigned CopyAlign = MI->getAlignment()->getZExtValue(); > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Mon Feb 23 16:30:49 2009 From: clattner at apple.com (Chris Lattner) Date: Mon, 23 Feb 2009 14:30:49 -0800 Subject: [llvm-commits] [llvm] r64918 - in /llvm/trunk: include/llvm/Analysis/ScalarEvolution.h lib/Analysis/ScalarEvolution.cpp lib/Transforms/Scalar/IndVarSimplify.cpp test/Transforms/IndVarSimplify/preserve-signed-wrap.ll test/Transforms/IndVarSimplify/promote-iv-to-eliminate-casts.ll test/Transforms/IndVarSimplify/signed-trip-count.ll In-Reply-To: References: <200902181722.n1IHMiaX020433@zion.cs.uiuc.edu> Message-ID: On Feb 19, 2009, at 11:35 AM, Dan Gohman wrote: > > On Feb 18, 2009, at 10:07 AM, Chris Lattner wrote: > >> >> On Feb 18, 2009, at 9:22 AM, Dan Gohman wrote: >> >>> Author: djg >>> Date: Wed Feb 18 11:22:41 2009 >>> New Revision: 64918 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=64918&view=rev >>> Log: >>> Use a sign-extend instead of a zero-extend when promoting a >>> trip count value when the original loop iteration condition is >>> signed and the canonical induction variable won't undergo signed >>> overflow. This isn't required for correctness; it just preserves >>> more information about original loop iteration values. >> >> Dan, I'm concerned about this. Sign extensions are generally more >> expensive than zero extensions, and much of the optimizer >> canonicalizes sign extends to zero extends. > > > You're right. I'm reconsidering this; It may not actually > be needed. Should the patch be reverted? -Chris From kremenek at apple.com Mon Feb 23 17:01:26 2009 From: kremenek at apple.com (Ted Kremenek) Date: Mon, 23 Feb 2009 23:01:26 -0000 Subject: [llvm-commits] [llvm] r65344 - /llvm/tags/checker/checker-0.163/ Message-ID: <200902232301.n1NN1QkP015803@zion.cs.uiuc.edu> Author: kremenek Date: Mon Feb 23 17:01:26 2009 New Revision: 65344 URL: http://llvm.org/viewvc/llvm-project?rev=65344&view=rev Log: Tagging checker-0.163. Added: llvm/tags/checker/checker-0.163/ - copied from r65343, llvm/trunk/ From isanbard at gmail.com Mon Feb 23 17:16:35 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 23 Feb 2009 15:16:35 -0800 Subject: [llvm-commits] [llvm] r65315 - /llvm/trunk/test/DebugInfo/2009-02-23-InstCombine.ll In-Reply-To: <200902231015.n1NAF5aj020359@zion.cs.uiuc.edu> References: <200902231015.n1NAF5aj020359@zion.cs.uiuc.edu> Message-ID: <16e5fdf90902231516p2da1edddg9c2d972727c874bd@mail.gmail.com> Hi Zhou, Please try to check the testcase in with the original revision. :-) -bw On Mon, Feb 23, 2009 at 2:15 AM, Zhou Sheng wrote: > Author: sheng > Date: Mon Feb 23 04:15:04 2009 > New Revision: 65315 > > URL: http://llvm.org/viewvc/llvm-project?rev=65315&view=rev > Log: > Add test case for checkin @r65314. > > Added: > llvm/trunk/test/DebugInfo/2009-02-23-InstCombine.ll > > Added: llvm/trunk/test/DebugInfo/2009-02-23-InstCombine.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/2009-02-23-InstCombine.ll?rev=65315&view=auto > > ============================================================================== > --- llvm/trunk/test/DebugInfo/2009-02-23-InstCombine.ll (added) > +++ llvm/trunk/test/DebugInfo/2009-02-23-InstCombine.ll Mon Feb 23 04:15:04 2009 > @@ -0,0 +1,41 @@ > +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep stoppoint | count 3 > +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32" > +target triple = "i386-pc-linux-gnu" > + %llvm.dbg.anchor.type = type { i32, i32 } > + %llvm.dbg.basictype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, i32 } > + %llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8*, i1, i1, i8*, i32 } > + %llvm.dbg.composite.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, { }*, { }*, i32 } > + %llvm.dbg.subprogram.type = type { i32, { }*, { }*, i8*, i8*, i8*, { }*, i32, { }*, i1, i1 } > + %llvm.dbg.variable.type = type { i32, { }*, i8*, { }*, i32, { }* } > + at llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 17 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1] > + at .str = internal constant [8 x i8] c"brach.c\00", section "llvm.metadata" ; <[8 x i8]*> [#uses=1] > + at .str1 = internal constant [38 x i8] c"/developer/home2/zsth/test/debug/tmp/\00", section "llvm.metadata" ; <[38 x i8]*> [#uses=1] > + at .str2 = internal constant [52 x i8] c"4.2.1 (Based on Apple Inc. build 5641) (LLVM build)\00", section "llvm.metadata" ; <[52 x i8]*> [#uses=1] > + at llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type { i32 458769, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to { }*), i32 1, i8* getelementptr ([8 x i8]* @.str, i32 0, i32 0), i8* getelementptr ([38 x i8]* @.str1, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str2, i32 0, i32 0), i1 true, i1 false, i8* null, i32 -1 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1] > + at .str3 = internal constant [4 x i8] c"int\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1] > + at llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type { i32 458788, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str3, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 32, i64 32, i64 0, i32 0, i32 5 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1] > + at llvm.dbg.array = internal constant [2 x { }*] [{ }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*), { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*)], section "llvm.metadata" ; <[2 x { }*]*> [#uses=1] > + at llvm.dbg.composite = internal constant %llvm.dbg.composite.type { i32 458773, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 0, i64 0, i64 0, i32 0, { }* null, { }* bitcast ([2 x { }*]* @llvm.dbg.array to { }*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1] > + at llvm.dbg.subprograms = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 46 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1] > + at .str4 = internal constant [4 x i8] c"foo\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1] > + at llvm.dbg.subprogram = internal constant %llvm.dbg.subprogram.type { i32 458798, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str4, i32 0, i32 0), i8* getelementptr ([4 x i8]* @.str4, i32 0, i32 0), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 1, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite to { }*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] > + at .str5 = internal constant [2 x i8] c"x\00", section "llvm.metadata" ; <[2 x i8]*> [#uses=1] > + at llvm.dbg.variable = internal constant %llvm.dbg.variable.type { i32 459009, { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*), i8* getelementptr ([2 x i8]* @.str5, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 1, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=0] > + > +define i32 @foo(i32 %x) nounwind { > +entry: > + %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] > + call void @llvm.dbg.stoppoint(i32 2, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) > + %0 = icmp sgt i32 %x, 5 ; [#uses=1] > + %.0 = select i1 %0, i32 %x, i32 0 ; [#uses=1] > + call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) > + ret i32 %.0 > +} > + > +declare void @llvm.dbg.func.start({ }*) nounwind > + > +declare void @llvm.dbg.declare({ }*, { }*) nounwind > + > +declare void @llvm.dbg.stoppoint(i32, i32, { }*) nounwind > + > +declare void @llvm.dbg.region.end({ }*) nounwind > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From gohman at apple.com Mon Feb 23 17:20:36 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 23 Feb 2009 23:20:36 -0000 Subject: [llvm-commits] [llvm] r65347 - in /llvm/trunk: lib/Transforms/Scalar/IndVarSimplify.cpp test/Transforms/IndVarSimplify/preserve-signed-wrap.ll test/Transforms/IndVarSimplify/promote-iv-to-eliminate-casts.ll test/Transforms/IndVarSimplify/signed-trip-count.ll Message-ID: <200902232320.n1NNKaYk016464@zion.cs.uiuc.edu> Author: djg Date: Mon Feb 23 17:20:35 2009 New Revision: 65347 URL: http://llvm.org/viewvc/llvm-project?rev=65347&view=rev Log: Back out the change in 64918 that used sign-extensions when promoting trip counts that use signed comparisons. It's not obviously the best approach for preserving trip count information, and at any rate there isn't anything in the tree right now that makes use of that, so for now always using zero-extensions is preferable. Modified: llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp llvm/trunk/test/Transforms/IndVarSimplify/preserve-signed-wrap.ll llvm/trunk/test/Transforms/IndVarSimplify/promote-iv-to-eliminate-casts.ll llvm/trunk/test/Transforms/IndVarSimplify/signed-trip-count.ll Modified: llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp?rev=65347&r1=65346&r2=65347&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp Mon Feb 23 17:20:35 2009 @@ -97,8 +97,7 @@ Value *IndVar, BasicBlock *ExitingBlock, BranchInst *BI, - SCEVExpander &Rewriter, - bool SignExtendTripCount); + SCEVExpander &Rewriter); void RewriteLoopExitValues(Loop *L, SCEV *IterationCount); void DeleteTriviallyDeadInstructions(SmallPtrSet &Insts); @@ -237,8 +236,7 @@ Value *IndVar, BasicBlock *ExitingBlock, BranchInst *BI, - SCEVExpander &Rewriter, - bool SignExtendTripCount) { + SCEVExpander &Rewriter) { // If the exiting block is not the same as the backedge block, we must compare // against the preincremented value, otherwise we prefer to compare against // the post-incremented value. @@ -256,18 +254,11 @@ if ((isa(N) && !N->isZero()) || SE->isLoopGuardedByCond(L, ICmpInst::ICMP_NE, N, Zero)) { // No overflow. Cast the sum. - if (SignExtendTripCount) - IterationCount = SE->getTruncateOrSignExtend(N, IndVar->getType()); - else - IterationCount = SE->getTruncateOrZeroExtend(N, IndVar->getType()); + IterationCount = SE->getTruncateOrZeroExtend(N, IndVar->getType()); } else { // Potential overflow. Cast before doing the add. - if (SignExtendTripCount) - IterationCount = SE->getTruncateOrSignExtend(IterationCount, - IndVar->getType()); - else - IterationCount = SE->getTruncateOrZeroExtend(IterationCount, - IndVar->getType()); + IterationCount = SE->getTruncateOrZeroExtend(IterationCount, + IndVar->getType()); IterationCount = SE->getAddExpr(IterationCount, SE->getIntegerSCEV(1, IndVar->getType())); @@ -279,12 +270,8 @@ CmpIndVar = L->getCanonicalInductionVariableIncrement(); } else { // We have to use the preincremented value... - if (SignExtendTripCount) - IterationCount = SE->getTruncateOrSignExtend(IterationCount, - IndVar->getType()); - else - IterationCount = SE->getTruncateOrZeroExtend(IterationCount, - IndVar->getType()); + IterationCount = SE->getTruncateOrZeroExtend(IterationCount, + IndVar->getType()); CmpIndVar = IndVar; } @@ -482,9 +469,8 @@ /// whether an induction variable in the same type that starts /// at 0 would undergo signed overflow. /// -/// In addition to setting the NoSignedWrap, NoUnsignedWrap, and -/// SignExtendTripCount variables, return the PHI for this induction -/// variable. +/// In addition to setting the NoSignedWrap, and NoUnsignedWrap, +/// variables, return the PHI for this induction variable. /// /// TODO: This duplicates a fair amount of ScalarEvolution logic. /// Perhaps this can be merged with ScalarEvolution::getIterationCount @@ -494,8 +480,7 @@ const BranchInst *BI, const Instruction *OrigCond, bool &NoSignedWrap, - bool &NoUnsignedWrap, - bool &SignExtendTripCount) { + bool &NoUnsignedWrap) { // Verify that the loop is sane and find the exit condition. const ICmpInst *Cmp = dyn_cast(OrigCond); if (!Cmp) return 0; @@ -610,10 +595,6 @@ // less than some value in the same type. As such, it will never wrap. if (isSigned && !InitialVal->getValue().isMaxSignedValue()) { NoSignedWrap = true; - // If the original induction variable starts at zero or greater, - // the trip count can be considered signed. - if (InitialVal->getValue().isNonNegative()) - SignExtendTripCount = true; } else if (!isSigned && !InitialVal->getValue().isMaxValue()) NoUnsignedWrap = true; return PN; @@ -700,7 +681,6 @@ // using it. We can currently only handle loops with a single exit. bool NoSignedWrap = false; bool NoUnsignedWrap = false; - bool SignExtendTripCount = false; const PHINode *OrigControllingPHI = 0; if (!isa(IterationCount) && ExitingBlock) // Can't rewrite non-branch yet. @@ -709,16 +689,14 @@ // Determine if the OrigIV will ever undergo overflow. OrigControllingPHI = TestOrigIVForWrap(L, BI, OrigCond, - NoSignedWrap, NoUnsignedWrap, - SignExtendTripCount); + NoSignedWrap, NoUnsignedWrap); // We'll be replacing the original condition, so it'll be dead. DeadInsts.insert(OrigCond); } LinearFunctionTestReplace(L, IterationCount, IndVar, - ExitingBlock, BI, Rewriter, - SignExtendTripCount); + ExitingBlock, BI, Rewriter); } // Now that we have a canonical induction variable, we can rewrite any Modified: llvm/trunk/test/Transforms/IndVarSimplify/preserve-signed-wrap.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/IndVarSimplify/preserve-signed-wrap.ll?rev=65347&r1=65346&r2=65347&view=diff ============================================================================== --- llvm/trunk/test/Transforms/IndVarSimplify/preserve-signed-wrap.ll (original) +++ llvm/trunk/test/Transforms/IndVarSimplify/preserve-signed-wrap.ll Mon Feb 23 17:20:35 2009 @@ -1,6 +1,5 @@ ; RUN: llvm-as < %s | opt -indvars | llvm-dis > %t -; RUN: grep sext %t | count 2 -; RUN: grep { = sext i32 %n to i64} %t +; RUN: grep sext %t | count 1 ; RUN: grep phi %t | count 1 ; RUN: grep {phi i64} %t Modified: llvm/trunk/test/Transforms/IndVarSimplify/promote-iv-to-eliminate-casts.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/IndVarSimplify/promote-iv-to-eliminate-casts.ll?rev=65347&r1=65346&r2=65347&view=diff ============================================================================== --- llvm/trunk/test/Transforms/IndVarSimplify/promote-iv-to-eliminate-casts.ll (original) +++ llvm/trunk/test/Transforms/IndVarSimplify/promote-iv-to-eliminate-casts.ll Mon Feb 23 17:20:35 2009 @@ -1,7 +1,5 @@ ; RUN: llvm-as < %s | opt -indvars | llvm-dis > %t -; RUN: grep sext %t | count 2 -; RUN: grep { = sext i16 %N to i64} %t -; RUN: grep { = sext i32 %count to i64} %t +; RUN: not grep sext %t define i64 @test(i64* nocapture %first, i32 %count) nounwind readonly { entry: Modified: llvm/trunk/test/Transforms/IndVarSimplify/signed-trip-count.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/IndVarSimplify/signed-trip-count.ll?rev=65347&r1=65346&r2=65347&view=diff ============================================================================== --- llvm/trunk/test/Transforms/IndVarSimplify/signed-trip-count.ll (original) +++ llvm/trunk/test/Transforms/IndVarSimplify/signed-trip-count.ll Mon Feb 23 17:20:35 2009 @@ -1,7 +1,6 @@ ; RUN: llvm-as < %s | opt -indvars | llvm-dis > %t -; RUN: grep { = sext i32 %n} %t +; RUN: not grep sext %t ; RUN: grep phi %t | count 1 -; RUN: not grep zext %t define void @foo(i64* nocapture %x, i32 %n) nounwind { entry: From gohman at apple.com Mon Feb 23 17:21:15 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 23 Feb 2009 15:21:15 -0800 Subject: [llvm-commits] [llvm] r64918 - in /llvm/trunk: include/llvm/Analysis/ScalarEvolution.h lib/Analysis/ScalarEvolution.cpp lib/Transforms/Scalar/IndVarSimplify.cpp test/Transforms/IndVarSimplify/preserve-signed-wrap.ll test/Transforms/IndVarSimplify/promote-iv-to-eliminate-casts.ll test/Transforms/IndVarSimplify/signed-trip-count.ll In-Reply-To: References: <200902181722.n1IHMiaX020433@zion.cs.uiuc.edu> Message-ID: <21B6A76B-7B70-40D1-9B7E-757B86DAF15A@apple.com> On Feb 23, 2009, at 2:30 PM, Chris Lattner wrote: > > On Feb 19, 2009, at 11:35 AM, Dan Gohman wrote: > >> >> On Feb 18, 2009, at 10:07 AM, Chris Lattner wrote: >> >>> >>> On Feb 18, 2009, at 9:22 AM, Dan Gohman wrote: >>> >>>> Author: djg >>>> Date: Wed Feb 18 11:22:41 2009 >>>> New Revision: 64918 >>>> >>>> URL: http://llvm.org/viewvc/llvm-project?rev=64918&view=rev >>>> Log: >>>> Use a sign-extend instead of a zero-extend when promoting a >>>> trip count value when the original loop iteration condition is >>>> signed and the canonical induction variable won't undergo signed >>>> overflow. This isn't required for correctness; it just preserves >>>> more information about original loop iteration values. >>> >>> Dan, I'm concerned about this. Sign extensions are generally more >>> expensive than zero extensions, and much of the optimizer >>> canonicalizes sign extends to zero extends. >> >> >> You're right. I'm reconsidering this; It may not actually >> be needed. > > Should the patch be reverted? Yes. I've now done so. Dan From clattner at apple.com Mon Feb 23 17:39:11 2009 From: clattner at apple.com (Chris Lattner) Date: Mon, 23 Feb 2009 15:39:11 -0800 Subject: [llvm-commits] [llvm] r64918 - in /llvm/trunk: include/llvm/Analysis/ScalarEvolution.h lib/Analysis/ScalarEvolution.cpp lib/Transforms/Scalar/IndVarSimplify.cpp test/Transforms/IndVarSimplify/preserve-signed-wrap.ll test/Transforms/IndVarSimplify/promote-iv-to-eliminate-casts.ll test/Transforms/IndVarSimplify/signed-trip-count.ll In-Reply-To: <21B6A76B-7B70-40D1-9B7E-757B86DAF15A@apple.com> References: <200902181722.n1IHMiaX020433@zion.cs.uiuc.edu> <21B6A76B-7B70-40D1-9B7E-757B86DAF15A@apple.com> Message-ID: On Feb 23, 2009, at 3:21 PM, Dan Gohman wrote: >>> >>> You're right. I'm reconsidering this; It may not actually >>> be needed. >> >> Should the patch be reverted? > > Yes. I've now done so. Thanks Dan! From isanbard at gmail.com Mon Feb 23 17:58:39 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 23 Feb 2009 23:58:39 -0000 Subject: [llvm-commits] [llvm] r65351 - in /llvm/branches/Apple/Dib: lib/Target/X86/X86CallingConv.td lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86InstrMMX.td test/CodeGen/X86/ret-mmx.ll Message-ID: <200902232358.n1NNwdmn017966@zion.cs.uiuc.edu> Author: void Date: Mon Feb 23 17:58:39 2009 New Revision: 65351 URL: http://llvm.org/viewvc/llvm-project?rev=65351&view=rev Log: --- Merging (from foreign repository) r65313 into '.': U test/CodeGen/X86/ret-mmx.ll U lib/Target/X86/X86ISelLowering.cpp U lib/Target/X86/X86CallingConv.td U lib/Target/X86/X86InstrMMX.td Only v1i16 (i.e. _m64) is returned via RAX / RDX. Modified: llvm/branches/Apple/Dib/lib/Target/X86/X86CallingConv.td llvm/branches/Apple/Dib/lib/Target/X86/X86ISelLowering.cpp llvm/branches/Apple/Dib/lib/Target/X86/X86InstrMMX.td llvm/branches/Apple/Dib/test/CodeGen/X86/ret-mmx.ll Modified: llvm/branches/Apple/Dib/lib/Target/X86/X86CallingConv.td URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/X86/X86CallingConv.td?rev=65351&r1=65350&r2=65351&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/X86/X86CallingConv.td (original) +++ llvm/branches/Apple/Dib/lib/Target/X86/X86CallingConv.td Mon Feb 23 17:58:39 2009 @@ -72,9 +72,11 @@ CCIfType<[f32], CCAssignToReg<[XMM0, XMM1]>>, CCIfType<[f64], CCAssignToReg<[XMM0, XMM1]>>, - // MMX vector types are always returned in RAX. This seems to disagree with - // ABI documentation but is bug compatible with gcc. - CCIfType<[v8i8, v4i16, v2i32, v1i64, v2f32], CCAssignToReg<[RAX]>>, + // MMX vector types are always returned in XMM0 except for v1i64 which is + // returned in RAX. This disagrees with ABI documentation but is bug + // compatible with gcc. + CCIfType<[v1i64], CCAssignToReg<[RAX]>>, + CCIfType<[v8i8, v4i16, v2i32, v2f32], CCAssignToReg<[XMM0, XMM1]>>, CCDelegateTo ]>; Modified: llvm/branches/Apple/Dib/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/X86/X86ISelLowering.cpp?rev=65351&r1=65350&r2=65351&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/branches/Apple/Dib/lib/Target/X86/X86ISelLowering.cpp Mon Feb 23 17:58:39 2009 @@ -589,8 +589,6 @@ addRegisterClass(MVT::v2f32, X86::VR64RegisterClass); addRegisterClass(MVT::v1i64, X86::VR64RegisterClass); - // FIXME: add MMX packed arithmetics - setOperationAction(ISD::ADD, MVT::v8i8, Legal); setOperationAction(ISD::ADD, MVT::v4i16, Legal); setOperationAction(ISD::ADD, MVT::v2i32, Legal); @@ -997,12 +995,15 @@ continue; } - // 64-bit vector (MMX) values are returned in RAX. + // 64-bit vector (MMX) values are returned in XMM0 / XMM1 except for v1i64 + // which is returned in RAX / RDX. if (Subtarget->is64Bit()) { MVT ValVT = ValToCopy.getValueType(); - if (VA.getLocReg() == X86::RAX && - ValVT.isVector() && ValVT.getSizeInBits() == 64) + if (ValVT.isVector() && ValVT.getSizeInBits() == 64) { ValToCopy = DAG.getNode(ISD::BIT_CONVERT, dl, MVT::i64, ValToCopy); + if (VA.getLocReg() == X86::XMM0 || VA.getLocReg() == X86::XMM1) + ValToCopy = DAG.getNode(ISD::SCALAR_TO_VECTOR, dl, MVT::v2i64, ValToCopy); + } } Chain = DAG.getCopyToReg(Chain, dl, VA.getLocReg(), ValToCopy, Flag); @@ -1081,10 +1082,18 @@ SDValue Val; if (Is64Bit && CopyVT.isVector() && CopyVT.getSizeInBits() == 64) { - // For x86-64, MMX values are returned in RAX. - Chain = DAG.getCopyFromReg(Chain, dl, VA.getLocReg(), - MVT::i64, InFlag).getValue(1); - Val = Chain.getValue(0); + // For x86-64, MMX values are returned in XMM0 / XMM1 except for v1i64. + if (VA.getLocReg() == X86::XMM0 || VA.getLocReg() == X86::XMM1) { + Chain = DAG.getCopyFromReg(Chain, dl, VA.getLocReg(), + MVT::v2i64, InFlag).getValue(1); + Val = Chain.getValue(0); + Val = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, MVT::i64, + Val, DAG.getConstant(0, MVT::i64)); + } else { + Chain = DAG.getCopyFromReg(Chain, dl, VA.getLocReg(), + MVT::i64, InFlag).getValue(1); + Val = Chain.getValue(0); + } Val = DAG.getNode(ISD::BIT_CONVERT, dl, CopyVT, Val); } else { Chain = DAG.getCopyFromReg(Chain, dl, VA.getLocReg(), @@ -6627,7 +6636,7 @@ DebugLoc dl = Node->getDebugLoc(); MVT T = Node->getValueType(0); SDValue negOp = DAG.getNode(ISD::SUB, dl, T, - DAG.getConstant(0, T), Node->getOperand(2)); + DAG.getConstant(0, T), Node->getOperand(2)); return DAG.getAtomic(ISD::ATOMIC_LOAD_ADD, dl, cast(Node)->getMemoryVT(), Node->getOperand(0), Modified: llvm/branches/Apple/Dib/lib/Target/X86/X86InstrMMX.td URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/X86/X86InstrMMX.td?rev=65351&r1=65350&r2=65351&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/X86/X86InstrMMX.td (original) +++ llvm/branches/Apple/Dib/lib/Target/X86/X86InstrMMX.td Mon Feb 23 17:58:39 2009 @@ -156,10 +156,12 @@ let neverHasSideEffects = 1 in def MMX_MOVD64to64rr : MMXRI<0x6E, MRMSrcReg, (outs VR64:$dst), (ins GR64:$src), - "movd\t{$src, $dst|$dst, $src}", []>; + "movd\t{$src, $dst|$dst, $src}", + []>; let neverHasSideEffects = 1 in -def MMX_MOVD64from64rr : MMXRI<0x7E, MRMSrcReg, (outs GR64:$dst), (ins VR64:$src), +def MMX_MOVD64from64rr : MMXRI<0x7E, MRMSrcReg, + (outs GR64:$dst), (ins VR64:$src), "movd\t{$src, $dst|$dst, $src}", []>; let neverHasSideEffects = 1 in @@ -187,6 +189,10 @@ (v2i64 (scalar_to_vector (i64 (bitconvert VR64:$src)))), MOVL_shuffle_mask)))]>; +let neverHasSideEffects = 1 in +def MMX_MOVQ2FR64rr: SSDIi8<0xD6, MRMDestMem, (outs FR64:$dst), (ins VR64:$src), + "movq2dq\t{$src, $dst|$dst, $src}", []>; + def MMX_MOVNTQmr : MMXI<0xE7, MRMDestMem, (outs), (ins i64mem:$dst, VR64:$src), "movntq\t{$src, $dst|$dst, $src}", [(int_x86_mmx_movnt_dq addr:$dst, VR64:$src)]>; @@ -575,9 +581,17 @@ (MMX_MOVD64from64rr VR64:$src)>; def : Pat<(i64 (bitconvert (v8i8 VR64:$src))), (MMX_MOVD64from64rr VR64:$src)>; +def : Pat<(f64 (bitconvert (v1i64 VR64:$src))), + (MMX_MOVQ2FR64rr VR64:$src)>; +def : Pat<(f64 (bitconvert (v2i32 VR64:$src))), + (MMX_MOVQ2FR64rr VR64:$src)>; +def : Pat<(f64 (bitconvert (v4i16 VR64:$src))), + (MMX_MOVQ2FR64rr VR64:$src)>; +def : Pat<(f64 (bitconvert (v8i8 VR64:$src))), + (MMX_MOVQ2FR64rr VR64:$src)>; -// Move scalar to XMM zero-extended -// movd to XMM register zero-extends +// Move scalar to MMX zero-extended +// movd to MMX register zero-extends let AddedComplexity = 15 in { def : Pat<(v8i8 (X86vzmovl (bc_v8i8 (v2i32 (scalar_to_vector GR32:$src))))), (MMX_MOVZDI2PDIrr GR32:$src)>; @@ -667,7 +681,13 @@ (MMX_PANDNrm VR64:$src1, addr:$src2)>; // Move MMX to lower 64-bit of XMM -def : Pat<(v2i64 (scalar_to_vector (i64 (bitconvert VR64:$src)))), +def : Pat<(v2i64 (scalar_to_vector (i64 (bitconvert (v8i8 VR64:$src))))), + (v2i64 (MMX_MOVQ2DQrr VR64:$src))>; +def : Pat<(v2i64 (scalar_to_vector (i64 (bitconvert (v4i16 VR64:$src))))), + (v2i64 (MMX_MOVQ2DQrr VR64:$src))>; +def : Pat<(v2i64 (scalar_to_vector (i64 (bitconvert (v2i32 VR64:$src))))), + (v2i64 (MMX_MOVQ2DQrr VR64:$src))>; +def : Pat<(v2i64 (scalar_to_vector (i64 (bitconvert (v1i64 VR64:$src))))), (v2i64 (MMX_MOVQ2DQrr VR64:$src))>; // Move lower 64-bit of XMM to MMX. Modified: llvm/branches/Apple/Dib/test/CodeGen/X86/ret-mmx.ll URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/test/CodeGen/X86/ret-mmx.ll?rev=65351&r1=65350&r2=65351&view=diff ============================================================================== --- llvm/branches/Apple/Dib/test/CodeGen/X86/ret-mmx.ll (original) +++ llvm/branches/Apple/Dib/test/CodeGen/X86/ret-mmx.ll Mon Feb 23 17:58:39 2009 @@ -10,8 +10,17 @@ ret void } +declare <1 x i64> @return_v1di() + define <1 x i64> @t2() nounwind { ret <1 x i64> } -declare <1 x i64> @return_v1di() +define <2 x i32> @t3() nounwind { + ret <2 x i32> +} + +define double @t4() nounwind { + ret double bitcast (<2 x i32> to double) +} + From dpatel at apple.com Mon Feb 23 18:02:15 2009 From: dpatel at apple.com (Devang Patel) Date: Tue, 24 Feb 2009 00:02:15 -0000 Subject: [llvm-commits] [llvm] r65352 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp Message-ID: <200902240002.n1O02F0r018178@zion.cs.uiuc.edu> Author: dpatel Date: Mon Feb 23 18:02:15 2009 New Revision: 65352 URL: http://llvm.org/viewvc/llvm-project?rev=65352&view=rev Log: If there is not any debug info available for any global variables and any subprograms then there is not any debug info to emit. Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp?rev=65352&r1=65351&r2=65352&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp Mon Feb 23 18:02:15 2009 @@ -2826,11 +2826,13 @@ } /// ConstructGlobalVariableDIEs - Create DIEs for each of the externally - /// visible global variables. - void ConstructGlobalVariableDIEs() { + /// visible global variables. Return true if at least one global DIE is + /// created. + bool ConstructGlobalVariableDIEs() { std::string GVName = "llvm.dbg.global_variables"; std::vector Result; getGlobalVariablesUsing(*M, GVName, Result); + bool result = false; for (std::vector::iterator GVI = Result.begin(), GVE = Result.end(); GVI != GVE; ++GVI) { DIGlobalVariable DI_GV(*GVI); @@ -2853,22 +2855,24 @@ //Add to map. Slot = VariableDie; - //Add to context owner. DW_Unit->getDie()->AddChild(VariableDie); - //Expose as global. FIXME - need to check external flag. DW_Unit->AddGlobal(DI_GV.getName(), VariableDie); + + if (!result) + result = true; } + return result; } /// ConstructSubprograms - Create DIEs for each of the externally visible - /// subprograms. - void ConstructSubprograms() { - + /// subprograms. Return true if at least one subprogram DIE is created. + bool ConstructSubprograms() { std::string SPName = "llvm.dbg.subprograms"; std::vector Result; getGlobalVariablesUsing(*M, SPName, Result); + bool result = false; for (std::vector::iterator RI = Result.begin(), RE = Result.end(); RI != RE; ++RI) { @@ -2894,7 +2898,11 @@ Unit->getDie()->AddChild(SubprogramDie); //Expose as global. Unit->AddGlobal(SP.getName(), SubprogramDie); + + if (!result) + result = true; } + return result; } public: @@ -2930,15 +2938,20 @@ if (DW_CUs.empty()) return; - MMI = mmi; - shouldEmit = true; - MMI->setDebugInfoAvailability(true); - // Create DIEs for each of the externally visible global variables. - ConstructGlobalVariableDIEs(); + bool globalDIEs = ConstructGlobalVariableDIEs(); // Create DIEs for each of the externally visible subprograms. - ConstructSubprograms(); + bool subprogramDIEs = ConstructSubprograms(); + + // If there is not any debug info available for any global variables + // and any subprograms then there is not any debug info to emit. + if (!globalDIEs && !subprogramDIEs) + return; + + MMI = mmi; + shouldEmit = true; + MMI->setDebugInfoAvailability(true); // Prime section data. SectionMap.insert(TAI->getTextSection()); From dpatel at apple.com Mon Feb 23 18:05:16 2009 From: dpatel at apple.com (Devang Patel) Date: Tue, 24 Feb 2009 00:05:16 -0000 Subject: [llvm-commits] [llvm] r65353 - in /llvm/trunk: lib/Transforms/Utils/BasicBlockUtils.cpp lib/Transforms/Utils/SimplifyCFG.cpp test/Transforms/SimplifyCFG/dbginfo.ll Message-ID: <200902240005.n1O05Gsf018334@zion.cs.uiuc.edu> Author: dpatel Date: Mon Feb 23 18:05:16 2009 New Revision: 65353 URL: http://llvm.org/viewvc/llvm-project?rev=65353&view=rev Log: While folding unconditional return move DbgRegionEndInst into the predecessor, instead of removing it. This fixes following tests from llvmgcc42 testsuite. gcc.c-torture/execute/20000605-3.c gcc.c-torture/execute/20020619-1.c gcc.c-torture/execute/20030920-1.c gcc.c-torture/execute/loop-ivopts-1.c Modified: llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp llvm/trunk/test/Transforms/SimplifyCFG/dbginfo.ll Modified: llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp?rev=65353&r1=65352&r2=65353&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp Mon Feb 23 18:05:16 2009 @@ -15,7 +15,6 @@ #include "llvm/Transforms/Utils/BasicBlockUtils.h" #include "llvm/Function.h" #include "llvm/Instructions.h" -#include "llvm/IntrinsicInst.h" #include "llvm/Constant.h" #include "llvm/Type.h" #include "llvm/Analysis/AliasAnalysis.h" @@ -32,7 +31,7 @@ // Can delete self loop. BB->getSinglePredecessor() == BB) && "Block is not dead!"); TerminatorInst *BBTerm = BB->getTerminator(); - Value *DbgRegionEndContext = NULL; + // Loop through all of our successors and make sure they know that one // of their predecessors is going away. for (unsigned i = 0, e = BBTerm->getNumSuccessors(); i != e; ++i) @@ -41,10 +40,6 @@ // Zap all the instructions in the block. while (!BB->empty()) { Instruction &I = BB->back(); - // It is possible to have multiple llvm.dbg.region.end in a block. - if (DbgRegionEndInst *DREI = dyn_cast(&I)) - DbgRegionEndContext = DREI->getContext(); - // If this instruction is used, replace uses with an arbitrary value. // Because control flow can't get here, we don't care what we replace the // value with. Note that since this block is unreachable, and all values @@ -54,22 +49,7 @@ I.replaceAllUsesWith(UndefValue::get(I.getType())); BB->getInstList().pop_back(); } - - if (DbgRegionEndContext) { - // Delete corresponding llvm.dbg.func.start from entry block. - BasicBlock &Entry = BB->getParent()->getEntryBlock(); - DbgFuncStartInst *DbgFuncStart = NULL; - for (BasicBlock::iterator BI = Entry.begin(), BE = Entry.end(); - BI != BE; ++BI) { - if (DbgFuncStartInst *DFSI = dyn_cast(BI)) { - DbgFuncStart = DFSI; - break; - } - } - if (DbgFuncStart && DbgFuncStart->getSubprogram() == DbgRegionEndContext) - DbgFuncStart->eraseFromParent(); - } - + // Zap the block! BB->eraseFromParent(); } Modified: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp?rev=65353&r1=65352&r2=65353&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Mon Feb 23 18:05:16 2009 @@ -1789,6 +1789,13 @@ Instruction *NewRet = RI->clone(); Pred->getInstList().push_back(NewRet); + BasicBlock::iterator BBI = RI; + if (BBI != BB->begin()) { + // Move region end info into the predecessor. + if (DbgRegionEndInst *DREI = dyn_cast(--BBI)) + DREI->moveBefore(NewRet); + } + // If the return instruction returns a value, and if the value was a // PHI node in "BB", propagate the right value into the return. for (User::op_iterator i = NewRet->op_begin(), e = NewRet->op_end(); @@ -1806,7 +1813,7 @@ // If we eliminated all predecessors of the block, delete the block now. if (pred_begin(BB) == pred_end(BB)) // We know there are no successors, so just nuke the block. - DeleteDeadBlock(BB); + M->getBasicBlockList().erase(BB); return true; } Modified: llvm/trunk/test/Transforms/SimplifyCFG/dbginfo.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SimplifyCFG/dbginfo.ll?rev=65353&r1=65352&r2=65353&view=diff ============================================================================== --- llvm/trunk/test/Transforms/SimplifyCFG/dbginfo.ll (original) +++ llvm/trunk/test/Transforms/SimplifyCFG/dbginfo.ll Mon Feb 23 18:05:16 2009 @@ -1,5 +1,7 @@ -; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | grep region | count 1 -; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | grep func.start | count 1 +; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | grep region | count 2 +; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | grep func.start | count 2 +; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | not grep "br label" + %llvm.dbg.anchor.type = type { i32, i32 } %llvm.dbg.basictype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, i32 } %llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8*, i1, i1, i8* } From dpatel at apple.com Mon Feb 23 18:09:53 2009 From: dpatel at apple.com (Devang Patel) Date: Mon, 23 Feb 2009 16:09:53 -0800 Subject: [llvm-commits] [llvm] r64278 - in /llvm/trunk: lib/Transforms/Utils/BasicBlockUtils.cpp lib/Transforms/Utils/SimplifyCFG.cpp test/Transforms/SimplifyCFG/dbginfo.ll In-Reply-To: <78BD012B-6299-4590-9DE9-BF14047EFA6B@apple.com> References: <200902110129.n1B1T7hl031164@zion.cs.uiuc.edu> <78BD012B-6299-4590-9DE9-BF14047EFA6B@apple.com> Message-ID: <5CEB1602-4FD1-4D95-8AD5-5A866E3253D8@apple.com> On Feb 10, 2009, at 9:11 PM, Chris Lattner wrote: > > On Feb 10, 2009, at 5:29 PM, Devang Patel wrote: > >> Author: dpatel >> Date: Tue Feb 10 19:29:06 2009 >> New Revision: 64278 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=64278&view=rev >> Log: >> If llvm.dbg.region.end is disappearing then remove corresponding >> llvm.dbg.func.start also. > > Why? The dbg.region.end may be removed in cases where the end of > function is unreachable, e.g.: > > void foo() { > while (1) > whatever(); > } > > I still would like to step through foo. OK. Right thing to do is move region.end into the pred while folding unconditional branch. Fixed in rev. 65353. - Devang From gohman at apple.com Mon Feb 23 18:29:00 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 23 Feb 2009 16:29:00 -0800 Subject: [llvm-commits] [llvm] r65289 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp In-Reply-To: <1C61B8A9-1B56-462A-B4BE-6F97B2A89E41@apple.com> References: <200902221806.n1MI6Xj2009464@zion.cs.uiuc.edu> <1C61B8A9-1B56-462A-B4BE-6F97B2A89E41@apple.com> Message-ID: <269EA706-F349-4121-920A-99CB7BB41478@apple.com> On Feb 23, 2009, at 2:30 PM, Chris Lattner wrote: > > On Feb 22, 2009, at 10:06 AM, Dan Gohman wrote: > >> Author: djg >> Date: Sun Feb 22 12:06:32 2009 >> New Revision: 65289 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=65289&view=rev >> Log: >> Revert the part of 64623 that attempted to align the source in a >> memcpy to match the alignment of the destination. It isn't necessary >> for making loads and stores handled like the SSE loadu/storeu >> intrinsics, and it was causing a performance regression in >> MultiSource/Applications/JM/lencod. >> >> The problem appears to have been a memcpy that copies from some >> highly aligned array into an alloca; the alloca was then being >> assigned a large alignment, which required codegen to perform >> dynamic stack-pointer re-alignment, which forced the enclosing >> function to have a frame pointer, which led to increased spilling. > > testcase? I can probably construct an artificial testcase if you think it'd be useful, but I don't have anything handy smaller than lencod itself. Dan From isanbard at gmail.com Mon Feb 23 18:37:28 2009 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 24 Feb 2009 00:37:28 -0000 Subject: [llvm-commits] [llvm] r65355 - /llvm/trunk/test/FrontendC++/2006-11-06-StackTrace.cpp Message-ID: <200902240037.n1O0bSEB019669@zion.cs.uiuc.edu> Author: void Date: Mon Feb 23 18:37:28 2009 New Revision: 65355 URL: http://llvm.org/viewvc/llvm-project?rev=65355&view=rev Log: Un-XFAIL this test. Modified: llvm/trunk/test/FrontendC++/2006-11-06-StackTrace.cpp Modified: llvm/trunk/test/FrontendC++/2006-11-06-StackTrace.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC%2B%2B/2006-11-06-StackTrace.cpp?rev=65355&r1=65354&r2=65355&view=diff ============================================================================== --- llvm/trunk/test/FrontendC++/2006-11-06-StackTrace.cpp (original) +++ llvm/trunk/test/FrontendC++/2006-11-06-StackTrace.cpp Mon Feb 23 18:37:28 2009 @@ -11,7 +11,6 @@ // Only works on ppc, x86 and x86_64. Should generalize? // XFAIL: alpha|ia64|arm -// XFAIL: * #include From isanbard at gmail.com Mon Feb 23 18:47:20 2009 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 24 Feb 2009 00:47:20 -0000 Subject: [llvm-commits] [llvm] r65356 - in /llvm/branches/Apple/Dib: lib/CodeGen/AsmPrinter/DwarfWriter.cpp lib/Transforms/Utils/BasicBlockUtils.cpp lib/Transforms/Utils/SimplifyCFG.cpp test/Transforms/SimplifyCFG/dbginfo.ll Message-ID: <200902240047.n1O0lKSY019979@zion.cs.uiuc.edu> Author: void Date: Mon Feb 23 18:47:19 2009 New Revision: 65356 URL: http://llvm.org/viewvc/llvm-project?rev=65356&view=rev Log: --- Merging (from foreign repository) r65352 into '.': U lib/CodeGen/AsmPrinter/DwarfWriter.cpp If there is not any debug info available for any global variables and any subprograms then there is not any debug info to emit. --- Merging (from foreign repository) r65353 into '.': U test/Transforms/SimplifyCFG/dbginfo.ll U lib/Transforms/Utils/SimplifyCFG.cpp U lib/Transforms/Utils/BasicBlockUtils.cpp While folding unconditional return move DbgRegionEndInst into the predecessor, instead of removing it. This fixes following tests from llvmgcc42 testsuite. gcc.c-torture/execute/20000605-3.c gcc.c-torture/execute/20020619-1.c gcc.c-torture/execute/20030920-1.c gcc.c-torture/execute/loop-ivopts-1.c Modified: llvm/branches/Apple/Dib/lib/CodeGen/AsmPrinter/DwarfWriter.cpp llvm/branches/Apple/Dib/lib/Transforms/Utils/BasicBlockUtils.cpp llvm/branches/Apple/Dib/lib/Transforms/Utils/SimplifyCFG.cpp llvm/branches/Apple/Dib/test/Transforms/SimplifyCFG/dbginfo.ll Modified: llvm/branches/Apple/Dib/lib/CodeGen/AsmPrinter/DwarfWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/AsmPrinter/DwarfWriter.cpp?rev=65356&r1=65355&r2=65356&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/CodeGen/AsmPrinter/DwarfWriter.cpp (original) +++ llvm/branches/Apple/Dib/lib/CodeGen/AsmPrinter/DwarfWriter.cpp Mon Feb 23 18:47:19 2009 @@ -2823,11 +2823,13 @@ } /// ConstructGlobalVariableDIEs - Create DIEs for each of the externally - /// visible global variables. - void ConstructGlobalVariableDIEs() { + /// visible global variables. Return true if at least one global DIE is + /// created. + bool ConstructGlobalVariableDIEs() { std::string GVName = "llvm.dbg.global_variables"; std::vector Result; getGlobalVariablesUsing(*M, GVName, Result); + bool result = false; for (std::vector::iterator GVI = Result.begin(), GVE = Result.end(); GVI != GVE; ++GVI) { DIGlobalVariable DI_GV(*GVI); @@ -2850,22 +2852,24 @@ //Add to map. Slot = VariableDie; - //Add to context owner. DW_Unit->getDie()->AddChild(VariableDie); - //Expose as global. FIXME - need to check external flag. DW_Unit->AddGlobal(DI_GV.getName(), VariableDie); + + if (!result) + result = true; } + return result; } /// ConstructSubprograms - Create DIEs for each of the externally visible - /// subprograms. - void ConstructSubprograms() { - + /// subprograms. Return true if at least one subprogram DIE is created. + bool ConstructSubprograms() { std::string SPName = "llvm.dbg.subprograms"; std::vector Result; getGlobalVariablesUsing(*M, SPName, Result); + bool result = false; for (std::vector::iterator RI = Result.begin(), RE = Result.end(); RI != RE; ++RI) { @@ -2891,7 +2895,11 @@ Unit->getDie()->AddChild(SubprogramDie); //Expose as global. Unit->AddGlobal(SP.getName(), SubprogramDie); + + if (!result) + result = true; } + return result; } public: @@ -2927,15 +2935,20 @@ if (DW_CUs.empty()) return; - MMI = mmi; - shouldEmit = true; - MMI->setDebugInfoAvailability(true); - // Create DIEs for each of the externally visible global variables. - ConstructGlobalVariableDIEs(); + bool globalDIEs = ConstructGlobalVariableDIEs(); // Create DIEs for each of the externally visible subprograms. - ConstructSubprograms(); + bool subprogramDIEs = ConstructSubprograms(); + + // If there is not any debug info available for any global variables + // and any subprograms then there is not any debug info to emit. + if (!globalDIEs && !subprogramDIEs) + return; + + MMI = mmi; + shouldEmit = true; + MMI->setDebugInfoAvailability(true); // Prime section data. SectionMap.insert(TAI->getTextSection()); Modified: llvm/branches/Apple/Dib/lib/Transforms/Utils/BasicBlockUtils.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Transforms/Utils/BasicBlockUtils.cpp?rev=65356&r1=65355&r2=65356&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Transforms/Utils/BasicBlockUtils.cpp (original) +++ llvm/branches/Apple/Dib/lib/Transforms/Utils/BasicBlockUtils.cpp Mon Feb 23 18:47:19 2009 @@ -15,7 +15,6 @@ #include "llvm/Transforms/Utils/BasicBlockUtils.h" #include "llvm/Function.h" #include "llvm/Instructions.h" -#include "llvm/IntrinsicInst.h" #include "llvm/Constant.h" #include "llvm/Type.h" #include "llvm/Analysis/AliasAnalysis.h" @@ -32,7 +31,7 @@ // Can delete self loop. BB->getSinglePredecessor() == BB) && "Block is not dead!"); TerminatorInst *BBTerm = BB->getTerminator(); - Value *DbgRegionEndContext = NULL; + // Loop through all of our successors and make sure they know that one // of their predecessors is going away. for (unsigned i = 0, e = BBTerm->getNumSuccessors(); i != e; ++i) @@ -41,10 +40,6 @@ // Zap all the instructions in the block. while (!BB->empty()) { Instruction &I = BB->back(); - // It is possible to have multiple llvm.dbg.region.end in a block. - if (DbgRegionEndInst *DREI = dyn_cast(&I)) - DbgRegionEndContext = DREI->getContext(); - // If this instruction is used, replace uses with an arbitrary value. // Because control flow can't get here, we don't care what we replace the // value with. Note that since this block is unreachable, and all values @@ -54,22 +49,7 @@ I.replaceAllUsesWith(UndefValue::get(I.getType())); BB->getInstList().pop_back(); } - - if (DbgRegionEndContext) { - // Delete corresponding llvm.dbg.func.start from entry block. - BasicBlock &Entry = BB->getParent()->getEntryBlock(); - DbgFuncStartInst *DbgFuncStart = NULL; - for (BasicBlock::iterator BI = Entry.begin(), BE = Entry.end(); - BI != BE; ++BI) { - if (DbgFuncStartInst *DFSI = dyn_cast(BI)) { - DbgFuncStart = DFSI; - break; - } - } - if (DbgFuncStart && DbgFuncStart->getSubprogram() == DbgRegionEndContext) - DbgFuncStart->eraseFromParent(); - } - + // Zap the block! BB->eraseFromParent(); } Modified: llvm/branches/Apple/Dib/lib/Transforms/Utils/SimplifyCFG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Transforms/Utils/SimplifyCFG.cpp?rev=65356&r1=65355&r2=65356&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Transforms/Utils/SimplifyCFG.cpp (original) +++ llvm/branches/Apple/Dib/lib/Transforms/Utils/SimplifyCFG.cpp Mon Feb 23 18:47:19 2009 @@ -1789,6 +1789,13 @@ Instruction *NewRet = RI->clone(); Pred->getInstList().push_back(NewRet); + BasicBlock::iterator BBI = RI; + if (BBI != BB->begin()) { + // Move region end info into the predecessor. + if (DbgRegionEndInst *DREI = dyn_cast(--BBI)) + DREI->moveBefore(NewRet); + } + // If the return instruction returns a value, and if the value was a // PHI node in "BB", propagate the right value into the return. for (User::op_iterator i = NewRet->op_begin(), e = NewRet->op_end(); @@ -1806,7 +1813,7 @@ // If we eliminated all predecessors of the block, delete the block now. if (pred_begin(BB) == pred_end(BB)) // We know there are no successors, so just nuke the block. - DeleteDeadBlock(BB); + M->getBasicBlockList().erase(BB); return true; } Modified: llvm/branches/Apple/Dib/test/Transforms/SimplifyCFG/dbginfo.ll URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/test/Transforms/SimplifyCFG/dbginfo.ll?rev=65356&r1=65355&r2=65356&view=diff ============================================================================== --- llvm/branches/Apple/Dib/test/Transforms/SimplifyCFG/dbginfo.ll (original) +++ llvm/branches/Apple/Dib/test/Transforms/SimplifyCFG/dbginfo.ll Mon Feb 23 18:47:19 2009 @@ -1,5 +1,7 @@ -; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | grep region | count 1 -; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | grep func.start | count 1 +; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | grep region | count 2 +; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | grep func.start | count 2 +; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | not grep "br label" + %llvm.dbg.anchor.type = type { i32, i32 } %llvm.dbg.basictype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, i32 } %llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8*, i1, i1, i8* } From dpatel at apple.com Mon Feb 23 18:52:19 2009 From: dpatel at apple.com (Devang Patel) Date: Tue, 24 Feb 2009 00:52:19 -0000 Subject: [llvm-commits] [llvm] r65357 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp Message-ID: <200902240052.n1O0qKEm020138@zion.cs.uiuc.edu> Author: dpatel Date: Mon Feb 23 18:52:19 2009 New Revision: 65357 URL: http://llvm.org/viewvc/llvm-project?rev=65357&view=rev Log: gdb uses DW_AT_prototyped to identify K&R style in C based languages. This fixes objc.dg/dwarf-prototypes.m scan-assembler DW_AT_prototyped from llvmgcc42 test suite. Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp?rev=65357&r1=65356&r2=65357&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp Mon Feb 23 18:52:19 2009 @@ -1942,6 +1942,11 @@ } } + unsigned Lang = SP.getCompileUnit().getLanguage(); + if (Lang == DW_LANG_C99 || Lang == DW_LANG_C89 + || Lang == DW_LANG_ObjC) + AddUInt(SPDie, DW_AT_prototyped, DW_FORM_flag, 1); + if (!SP.isLocalToUnit()) AddUInt(SPDie, DW_AT_external, DW_FORM_flag, 1); return SPDie; From isanbard at gmail.com Mon Feb 23 19:14:23 2009 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 24 Feb 2009 01:14:23 -0000 Subject: [llvm-commits] [llvm] r65358 - /llvm/branches/Apple/Dib/lib/CodeGen/AsmPrinter/DwarfWriter.cpp Message-ID: <200902240114.n1O1ENiC020890@zion.cs.uiuc.edu> Author: void Date: Mon Feb 23 19:14:23 2009 New Revision: 65358 URL: http://llvm.org/viewvc/llvm-project?rev=65358&view=rev Log: --- Merging (from foreign repository) r65357 into '.': U lib/CodeGen/AsmPrinter/DwarfWriter.cpp gdb uses DW_AT_prototyped to identify K&R style in C based languages. This fixes objc.dg/dwarf-prototypes.m scan-assembler DW_AT_prototyped from llvmgcc42 test suite. Modified: llvm/branches/Apple/Dib/lib/CodeGen/AsmPrinter/DwarfWriter.cpp Modified: llvm/branches/Apple/Dib/lib/CodeGen/AsmPrinter/DwarfWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/AsmPrinter/DwarfWriter.cpp?rev=65358&r1=65357&r2=65358&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/CodeGen/AsmPrinter/DwarfWriter.cpp (original) +++ llvm/branches/Apple/Dib/lib/CodeGen/AsmPrinter/DwarfWriter.cpp Mon Feb 23 19:14:23 2009 @@ -1939,6 +1939,11 @@ } } + unsigned Lang = SP.getCompileUnit().getLanguage(); + if (Lang == DW_LANG_C99 || Lang == DW_LANG_C89 + || Lang == DW_LANG_ObjC) + AddUInt(SPDie, DW_AT_prototyped, DW_FORM_flag, 1); + if (!SP.isLocalToUnit()) AddUInt(SPDie, DW_AT_external, DW_FORM_flag, 1); return SPDie; From gohman at apple.com Mon Feb 23 19:21:53 2009 From: gohman at apple.com (Dan Gohman) Date: Tue, 24 Feb 2009 01:21:53 -0000 Subject: [llvm-commits] [llvm] r65359 - /llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp Message-ID: <200902240121.n1O1Lr3N021144@zion.cs.uiuc.edu> Author: djg Date: Mon Feb 23 19:21:53 2009 New Revision: 65359 URL: http://llvm.org/viewvc/llvm-project?rev=65359&view=rev Log: Preserve the DominanceFrontier analysis in the LoopDeletion pass. Modified: llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp Modified: llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp?rev=65359&r1=65358&r2=65359&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp Mon Feb 23 19:21:53 2009 @@ -53,6 +53,7 @@ AU.addPreserved(); AU.addPreservedID(LoopSimplifyID); AU.addPreservedID(LCSSAID); + AU.addPreserved(); } }; } @@ -228,6 +229,7 @@ // Update the dominator tree and remove the instructions and blocks that will // be deleted from the reference counting scheme. DominatorTree& DT = getAnalysis(); + DominanceFrontier* DF = getAnalysisIfAvailable(); SmallPtrSet ChildNodes; for (Loop::block_iterator LI = L->block_begin(), LE = L->block_end(); LI != LE; ++LI) { @@ -235,12 +237,15 @@ // allows us to remove the domtree entry for the block. ChildNodes.insert(DT[*LI]->begin(), DT[*LI]->end()); for (SmallPtrSet::iterator DI = ChildNodes.begin(), - DE = ChildNodes.end(); DI != DE; ++DI) + DE = ChildNodes.end(); DI != DE; ++DI) { DT.changeImmediateDominator(*DI, DT[preheader]); + if (DF) DF->changeImmediateDominator((*DI)->getBlock(), preheader, &DT); + } ChildNodes.clear(); DT.eraseNode(*LI); - + if (DF) DF->removeBlock(*LI); + // Remove instructions that we're deleting from ScalarEvolution. for (BasicBlock::iterator BI = (*LI)->begin(), BE = (*LI)->end(); BI != BE; ++BI) From clattner at apple.com Mon Feb 23 19:57:08 2009 From: clattner at apple.com (Chris Lattner) Date: Mon, 23 Feb 2009 17:57:08 -0800 Subject: [llvm-commits] [llvm] r65289 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp In-Reply-To: <269EA706-F349-4121-920A-99CB7BB41478@apple.com> References: <200902221806.n1MI6Xj2009464@zion.cs.uiuc.edu> <1C61B8A9-1B56-462A-B4BE-6F97B2A89E41@apple.com> <269EA706-F349-4121-920A-99CB7BB41478@apple.com> Message-ID: <1BADC0C0-18E2-431A-BCF9-EFE1D2A9C58B@apple.com> On Feb 23, 2009, at 4:29 PM, Dan Gohman wrote: >>> assigned a large alignment, which required codegen to perform >>> dynamic stack-pointer re-alignment, which forced the enclosing >>> function to have a frame pointer, which led to increased spilling. >> >> testcase? > > > I can probably construct an artificial testcase if you think it'd be > useful, > but I don't have anything handy smaller than lencod itself. I'm not interested in an executable testcase, an artificial one is good. This is the sort of thing that is non-obvious and could break in the future, which is why I thought a testcase would be useful. Do you agree? -Chris From gohman at apple.com Mon Feb 23 19:58:01 2009 From: gohman at apple.com (Dan Gohman) Date: Tue, 24 Feb 2009 01:58:01 -0000 Subject: [llvm-commits] [llvm] r65363 - /llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Message-ID: <200902240158.n1O1w1KV022391@zion.cs.uiuc.edu> Author: djg Date: Mon Feb 23 19:58:00 2009 New Revision: 65363 URL: http://llvm.org/viewvc/llvm-project?rev=65363&view=rev Log: Generalize the ChangeCompareStride code, in preparation for handling non-constant strides. No functionality change. Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=65363&r1=65362&r2=65363&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Mon Feb 23 19:58:00 2009 @@ -2133,15 +2133,12 @@ return Cond; const SCEVConstant *SC = dyn_cast(*CondStride); if (!SC) return Cond; - ConstantInt *C = dyn_cast(Cond->getOperand(1)); - if (!C) return Cond; ICmpInst::Predicate Predicate = Cond->getPredicate(); int64_t CmpSSInt = SC->getValue()->getSExtValue(); - int64_t CmpVal = C->getValue().getSExtValue(); - unsigned BitWidth = C->getValue().getBitWidth(); + unsigned BitWidth = (*CondStride)->getBitWidth(); uint64_t SignBit = 1ULL << (BitWidth-1); - const Type *CmpTy = C->getType(); + const Type *CmpTy = Cond->getOperand(0)->getType(); const Type *NewCmpTy = NULL; unsigned TyBits = CmpTy->getPrimitiveSizeInBits(); unsigned NewTyBits = 0; @@ -2149,102 +2146,112 @@ Value *NewCmpLHS = NULL; Value *NewCmpRHS = NULL; int64_t Scale = 1; + SCEVHandle NewOffset = SE->getIntegerSCEV(0, UIntPtrTy); + std::stable_sort(StrideOrder.begin(), StrideOrder.end(), StrideCompare()); - // Check stride constant and the comparision constant signs to detect - // overflow. - if ((CmpVal & SignBit) != (CmpSSInt & SignBit)) - return Cond; + if (ConstantInt *C = dyn_cast(Cond->getOperand(1))) { + int64_t CmpVal = C->getValue().getSExtValue(); - // Look for a suitable stride / iv as replacement. - std::stable_sort(StrideOrder.begin(), StrideOrder.end(), StrideCompare()); - for (unsigned i = 0, e = StrideOrder.size(); i != e; ++i) { - std::map::iterator SI = - IVUsesByStride.find(StrideOrder[i]); - if (!isa(SI->first)) - continue; - int64_t SSInt = cast(SI->first)->getValue()->getSExtValue(); - if (abs(SSInt) <= abs(CmpSSInt) || (SSInt % CmpSSInt) != 0) - continue; + // Check stride constant and the comparision constant signs to detect + // overflow. + if ((CmpVal & SignBit) != (CmpSSInt & SignBit)) + return Cond; - Scale = SSInt / CmpSSInt; - int64_t NewCmpVal = CmpVal * Scale; - APInt Mul = APInt(BitWidth, NewCmpVal); - // Check for overflow. - if (Mul.getSExtValue() != NewCmpVal) - continue; + // Look for a suitable stride / iv as replacement. + for (unsigned i = 0, e = StrideOrder.size(); i != e; ++i) { + std::map::iterator SI = + IVUsesByStride.find(StrideOrder[i]); + if (!isa(SI->first)) + continue; + int64_t SSInt = cast(SI->first)->getValue()->getSExtValue(); + if (abs(SSInt) <= abs(CmpSSInt) || (SSInt % CmpSSInt) != 0) + continue; - // Watch out for overflow. - if (ICmpInst::isSignedPredicate(Predicate) && - (CmpVal & SignBit) != (NewCmpVal & SignBit)) - continue; + Scale = SSInt / CmpSSInt; + int64_t NewCmpVal = CmpVal * Scale; + APInt Mul = APInt(BitWidth, NewCmpVal); + // Check for overflow. + if (Mul.getSExtValue() != NewCmpVal) + continue; - if (NewCmpVal == CmpVal) - continue; - // Pick the best iv to use trying to avoid a cast. - NewCmpLHS = NULL; - for (std::vector::iterator UI = SI->second.Users.begin(), - E = SI->second.Users.end(); UI != E; ++UI) { - NewCmpLHS = UI->OperandValToReplace; - if (NewCmpLHS->getType() == CmpTy) - break; - } - if (!NewCmpLHS) - continue; + // Watch out for overflow. + if (ICmpInst::isSignedPredicate(Predicate) && + (CmpVal & SignBit) != (NewCmpVal & SignBit)) + continue; - NewCmpTy = NewCmpLHS->getType(); - NewTyBits = isa(NewCmpTy) - ? UIntPtrTy->getPrimitiveSizeInBits() - : NewCmpTy->getPrimitiveSizeInBits(); - if (RequiresTypeConversion(NewCmpTy, CmpTy)) { - // Check if it is possible to rewrite it using - // an iv / stride of a smaller integer type. - bool TruncOk = false; - if (NewCmpTy->isInteger()) { - unsigned Bits = NewTyBits; - if (ICmpInst::isSignedPredicate(Predicate)) - --Bits; - uint64_t Mask = (1ULL << Bits) - 1; - if (((uint64_t)NewCmpVal & Mask) == (uint64_t)NewCmpVal) - TruncOk = true; + if (NewCmpVal == CmpVal) + continue; + // Pick the best iv to use trying to avoid a cast. + NewCmpLHS = NULL; + for (std::vector::iterator UI = SI->second.Users.begin(), + E = SI->second.Users.end(); UI != E; ++UI) { + NewCmpLHS = UI->OperandValToReplace; + if (NewCmpLHS->getType() == CmpTy) + break; } - if (!TruncOk) + if (!NewCmpLHS) continue; - } - // Don't rewrite if use offset is non-constant and the new type is - // of a different type. - // FIXME: too conservative? - if (NewTyBits != TyBits && !isa(CondUse->Offset)) - continue; + NewCmpTy = NewCmpLHS->getType(); + NewTyBits = isa(NewCmpTy) + ? UIntPtrTy->getPrimitiveSizeInBits() + : NewCmpTy->getPrimitiveSizeInBits(); + if (RequiresTypeConversion(NewCmpTy, CmpTy)) { + // Check if it is possible to rewrite it using + // an iv / stride of a smaller integer type. + bool TruncOk = false; + if (NewCmpTy->isInteger()) { + unsigned Bits = NewTyBits; + if (ICmpInst::isSignedPredicate(Predicate)) + --Bits; + uint64_t Mask = (1ULL << Bits) - 1; + if (((uint64_t)NewCmpVal & Mask) == (uint64_t)NewCmpVal) + TruncOk = true; + } + if (!TruncOk) + continue; + } - bool AllUsesAreAddresses = true; - bool AllUsesAreOutsideLoop = true; - std::vector UsersToProcess; - SCEVHandle CommonExprs = CollectIVUsers(SI->first, SI->second, L, - AllUsesAreAddresses, - AllUsesAreOutsideLoop, - UsersToProcess); - // Avoid rewriting the compare instruction with an iv of new stride - // if it's likely the new stride uses will be rewritten using the - // stride of the compare instruction. - if (AllUsesAreAddresses && - ValidStride(!CommonExprs->isZero(), Scale, UsersToProcess)) - continue; + // Don't rewrite if use offset is non-constant and the new type is + // of a different type. + // FIXME: too conservative? + if (NewTyBits != TyBits && !isa(CondUse->Offset)) + continue; - // If scale is negative, use swapped predicate unless it's testing - // for equality. - if (Scale < 0 && !Cond->isEquality()) - Predicate = ICmpInst::getSwappedPredicate(Predicate); - - NewStride = &StrideOrder[i]; - if (!isa(NewCmpTy)) - NewCmpRHS = ConstantInt::get(NewCmpTy, NewCmpVal); - else { - NewCmpRHS = ConstantInt::get(UIntPtrTy, NewCmpVal); - NewCmpRHS = SCEVExpander::InsertCastOfTo(Instruction::IntToPtr, - NewCmpRHS, NewCmpTy); + bool AllUsesAreAddresses = true; + bool AllUsesAreOutsideLoop = true; + std::vector UsersToProcess; + SCEVHandle CommonExprs = CollectIVUsers(SI->first, SI->second, L, + AllUsesAreAddresses, + AllUsesAreOutsideLoop, + UsersToProcess); + // Avoid rewriting the compare instruction with an iv of new stride + // if it's likely the new stride uses will be rewritten using the + // stride of the compare instruction. + if (AllUsesAreAddresses && + ValidStride(!CommonExprs->isZero(), Scale, UsersToProcess)) + continue; + + // If scale is negative, use swapped predicate unless it's testing + // for equality. + if (Scale < 0 && !Cond->isEquality()) + Predicate = ICmpInst::getSwappedPredicate(Predicate); + + NewStride = &StrideOrder[i]; + if (!isa(NewCmpTy)) + NewCmpRHS = ConstantInt::get(NewCmpTy, NewCmpVal); + else { + NewCmpRHS = ConstantInt::get(UIntPtrTy, NewCmpVal); + NewCmpRHS = SCEVExpander::InsertCastOfTo(Instruction::IntToPtr, + NewCmpRHS, NewCmpTy); + } + NewOffset = TyBits == NewTyBits + ? SE->getMulExpr(CondUse->Offset, + SE->getConstant(ConstantInt::get(CmpTy, Scale))) + : SE->getConstant(ConstantInt::get(NewCmpTy, + cast(CondUse->Offset)->getValue()->getSExtValue()*Scale)); + break; } - break; } // Forgo this transformation if it the increment happens to be @@ -2275,11 +2282,6 @@ OldCond->eraseFromParent(); IVUsesByStride[*CondStride].Users.pop_back(); - SCEVHandle NewOffset = TyBits == NewTyBits - ? SE->getMulExpr(CondUse->Offset, - SE->getConstant(ConstantInt::get(CmpTy, Scale))) - : SE->getConstant(ConstantInt::get(NewCmpTy, - cast(CondUse->Offset)->getValue()->getSExtValue()*Scale)); IVUsesByStride[*NewStride].addUser(NewOffset, Cond, NewCmpLHS); CondUse = &IVUsesByStride[*NewStride].Users.back(); CondStride = NewStride; From gohman at apple.com Mon Feb 23 20:00:40 2009 From: gohman at apple.com (Dan Gohman) Date: Tue, 24 Feb 2009 02:00:40 -0000 Subject: [llvm-commits] [llvm] r65364 - in /llvm/trunk: lib/Analysis/ValueTracking.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/ashr-nop.ll Message-ID: <200902240200.n1O20eqQ022492@zion.cs.uiuc.edu> Author: djg Date: Mon Feb 23 20:00:40 2009 New Revision: 65364 URL: http://llvm.org/viewvc/llvm-project?rev=65364&view=rev Log: Fix a ValueTracking rule: RHS means operand 1, not 0. Add a simple ashr instcombine to help expose this code. And apply the fix to SelectionDAG's copy of this code too. Added: llvm/trunk/test/Transforms/InstCombine/ashr-nop.ll Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ValueTracking.cpp?rev=65364&r1=65363&r2=65364&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ValueTracking.cpp (original) +++ llvm/trunk/lib/Analysis/ValueTracking.cpp Mon Feb 23 20:00:40 2009 @@ -625,7 +625,7 @@ if (Tmp == 1) return 1; // Early out. // Special case decrementing a value (ADD X, -1): - if (ConstantInt *CRHS = dyn_cast(U->getOperand(0))) + if (ConstantInt *CRHS = dyn_cast(U->getOperand(1))) if (CRHS->isAllOnesValue()) { APInt KnownZero(TyBits, 0), KnownOne(TyBits, 0); APInt Mask = APInt::getAllOnesValue(TyBits); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=65364&r1=65363&r2=65364&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Feb 23 20:00:40 2009 @@ -2008,7 +2008,7 @@ if (Tmp == 1) return 1; // Early out. // Special case decrementing a value (ADD X, -1): - if (ConstantSDNode *CRHS = dyn_cast(Op.getOperand(0))) + if (ConstantSDNode *CRHS = dyn_cast(Op.getOperand(1))) if (CRHS->isAllOnesValue()) { APInt KnownZero, KnownOne; APInt Mask = APInt::getAllOnesValue(VTBits); Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=65364&r1=65363&r2=65364&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Mon Feb 23 20:00:40 2009 @@ -7031,7 +7031,12 @@ MaskedValueIsZero(Op0, APInt::getSignBit(I.getType()->getPrimitiveSizeInBits()))) return BinaryOperator::CreateLShr(Op0, I.getOperand(1)); - + + // Arithmetic shifting an all-sign-bit value is a no-op. + unsigned NumSignBits = ComputeNumSignBits(Op0); + if (NumSignBits == Op0->getType()->getPrimitiveSizeInBits()) + return ReplaceInstUsesWith(I, Op0); + return 0; } Added: llvm/trunk/test/Transforms/InstCombine/ashr-nop.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/ashr-nop.ll?rev=65364&view=auto ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/ashr-nop.ll (added) +++ llvm/trunk/test/Transforms/InstCombine/ashr-nop.ll Mon Feb 23 20:00:40 2009 @@ -0,0 +1,8 @@ +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep ashr + +define i32 @foo(i32 %x) { + %o = and i32 %x, 1 + %n = add i32 %o, -1 + %t = ashr i32 %n, 17 + ret i32 %t +} From gohman at apple.com Mon Feb 23 20:17:42 2009 From: gohman at apple.com (Dan Gohman) Date: Tue, 24 Feb 2009 02:17:42 -0000 Subject: [llvm-commits] [llvm] r65365 - /llvm/trunk/test/Transforms/InstCombine/stack-overalign.ll Message-ID: <200902240217.n1O2HgKs023041@zion.cs.uiuc.edu> Author: djg Date: Mon Feb 23 20:17:42 2009 New Revision: 65365 URL: http://llvm.org/viewvc/llvm-project?rev=65365&view=rev Log: Add a testcase for the problem fixed in r65289. Added: llvm/trunk/test/Transforms/InstCombine/stack-overalign.ll Added: llvm/trunk/test/Transforms/InstCombine/stack-overalign.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/stack-overalign.ll?rev=65365&view=auto ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/stack-overalign.ll (added) +++ llvm/trunk/test/Transforms/InstCombine/stack-overalign.ll Mon Feb 23 20:17:42 2009 @@ -0,0 +1,29 @@ +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {align 32} | count 1 + +; It's tempting to have an instcombine in which the src pointer of a +; memcpy is aligned up to the alignment of the destination, however +; there are pitfalls. If the src is an alloca, aligning it beyond what +; the target's stack pointer is aligned at will require dynamic +; stack realignment, which can require functions that don't otherwise +; need a frame pointer to need one. +; +; Abstaining from this transform is not the only way to approach this +; issue. Some late phase could be smart enough to reduce alloca +; alignments when they are greater than they need to be. Or, codegen +; could do dynamic alignment for just the one alloca, and leave the +; main stack pointer at its standard alignment. + + at dst = global [1024 x i8] zeroinitializer, align 32 + +define void @foo() nounwind { +entry: + %src = alloca [1024 x i8], align 1 + %src1 = getelementptr [1024 x i8]* %src, i32 0, i32 0 + call void @llvm.memcpy.i32(i8* getelementptr ([1024 x i8]* @dst, i32 0, i32 0), i8* %src1, i32 1024, i32 1) + call void @frob(i8* %src1) nounwind + ret void +} + +declare void @llvm.memcpy.i32(i8* nocapture, i8* nocapture, i32, i32) nounwind + +declare void @frob(i8*) From gohman at apple.com Mon Feb 23 20:18:38 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 23 Feb 2009 18:18:38 -0800 Subject: [llvm-commits] [llvm] r65289 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp In-Reply-To: <1BADC0C0-18E2-431A-BCF9-EFE1D2A9C58B@apple.com> References: <200902221806.n1MI6Xj2009464@zion.cs.uiuc.edu> <1C61B8A9-1B56-462A-B4BE-6F97B2A89E41@apple.com> <269EA706-F349-4121-920A-99CB7BB41478@apple.com> <1BADC0C0-18E2-431A-BCF9-EFE1D2A9C58B@apple.com> Message-ID: <9011107A-3C45-4F39-9099-C111575A0309@apple.com> On Feb 23, 2009, at 5:57 PM, Chris Lattner wrote: > > On Feb 23, 2009, at 4:29 PM, Dan Gohman wrote: > >>>> assigned a large alignment, which required codegen to perform >>>> dynamic stack-pointer re-alignment, which forced the enclosing >>>> function to have a frame pointer, which led to increased spilling. >>> >>> testcase? >> >> >> I can probably construct an artificial testcase if you think it'd >> be useful, >> but I don't have anything handy smaller than lencod itself. > > I'm not interested in an executable testcase, an artificial one is > good. This is the sort of thing that is non-obvious and could break > in the future, which is why I thought a testcase would be useful. > Do you agree? I added a testcase. Dan From isanbard at gmail.com Mon Feb 23 20:35:31 2009 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 24 Feb 2009 02:35:31 -0000 Subject: [llvm-commits] [llvm] r65367 - in /llvm/trunk: include/llvm/CodeGen/DwarfWriter.h include/llvm/CodeGen/SelectionDAG.h lib/CodeGen/SelectionDAG/FastISel.cpp lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp test/DebugInfo/2009-01-30-Method.ll test/DebugInfo/deaddebuglabel.ll test/DebugInfo/forwardDecl.ll test/FrontendC++/2006-11-06-StackTrace.cpp test/FrontendC++/2006-11-30-Pubnames.cpp utils/TableGen/AsmWriterEmitter.cpp Message-ID: <200902240235.n1O2ZV0f023730@zion.cs.uiuc.edu> Author: void Date: Mon Feb 23 20:35:30 2009 New Revision: 65367 URL: http://llvm.org/viewvc/llvm-project?rev=65367&view=rev Log: - Use the "Fast" flag instead of "OptimizeForSize" to determine whether to emit a DBG_LABEL or not. We want to fall back to the original way of emitting debug info when we're in -O0/-fast mode. - Add plumbing in to pass the "Fast" flag to places that need it. - XFAIL DebugInfo/deaddebuglabel.ll. This is finding 11 labels instead of 8. I need to investigate still. Modified: llvm/trunk/include/llvm/CodeGen/DwarfWriter.h llvm/trunk/include/llvm/CodeGen/SelectionDAG.h llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp llvm/trunk/test/DebugInfo/2009-01-30-Method.ll llvm/trunk/test/DebugInfo/deaddebuglabel.ll llvm/trunk/test/DebugInfo/forwardDecl.ll llvm/trunk/test/FrontendC++/2006-11-06-StackTrace.cpp llvm/trunk/test/FrontendC++/2006-11-30-Pubnames.cpp llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp Modified: llvm/trunk/include/llvm/CodeGen/DwarfWriter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/DwarfWriter.h?rev=65367&r1=65366&r2=65367&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/DwarfWriter.h (original) +++ llvm/trunk/include/llvm/CodeGen/DwarfWriter.h Mon Feb 23 20:35:30 2009 @@ -48,7 +48,10 @@ /// DE - Provides the DwarfWriter exception implementation. /// DwarfException *DE; - + + /// FastCodeGen - True if generating code via the "fast" isel. + /// + bool FastCodeGen; public: static char ID; // Pass identification, replacement for typeid @@ -104,6 +107,9 @@ /// ShouldEmitDwarfDebug - Returns true if Dwarf debugging declarations should /// be emitted. bool ShouldEmitDwarfDebug() const; + + bool getFastCodeGen() const { return FastCodeGen; } + void setFastCodeGen(bool Fast) { FastCodeGen = Fast; } }; Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=65367&r1=65366&r2=65367&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Mon Feb 23 20:35:30 2009 @@ -216,7 +216,7 @@ /// /// Note that this is an involved process that may invalidate pointers into /// the graph. - void Legalize(bool TypesNeedLegalizing); + void Legalize(bool TypesNeedLegalizing, bool Fast); /// RemoveDeadNodes - This method deletes all unreachable nodes in the /// SelectionDAG. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp?rev=65367&r1=65366&r2=65367&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp Mon Feb 23 20:35:30 2009 @@ -370,6 +370,7 @@ unsigned Line = Subprogram.getLineNumber(); unsigned LabelID = DW->RecordSourceLine(Line, 0, SrcFile); setCurDebugLoc(DebugLoc::get(MF.getOrCreateDebugLocID(SrcFile, Line, 0))); + DW->setFastCodeGen(true); if (DW->getRecordSourceLineCount() != 1) { const TargetInstrDesc &II = TII.get(TargetInstrInfo::DBG_LABEL); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=65367&r1=65366&r2=65367&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Mon Feb 23 20:35:30 2009 @@ -56,6 +56,7 @@ TargetLowering &TLI; SelectionDAG &DAG; bool TypesNeedLegalizing; + bool Fast; // Libcall insertion helpers. @@ -137,7 +138,8 @@ } public: - explicit SelectionDAGLegalize(SelectionDAG &DAG, bool TypesNeedLegalizing); + explicit SelectionDAGLegalize(SelectionDAG &DAG, bool TypesNeedLegalizing, + bool fast); /// getTypeAction - Return how we should legalize values of this type, either /// it is already legal or we need to expand it into multiple registers of @@ -362,9 +364,10 @@ return TLI.isShuffleMaskLegal(Mask, VT) ? Mask.getNode() : 0; } -SelectionDAGLegalize::SelectionDAGLegalize(SelectionDAG &dag, bool types) +SelectionDAGLegalize::SelectionDAGLegalize(SelectionDAG &dag, + bool types, bool fast) : TLI(dag.getTargetLoweringInfo()), DAG(dag), TypesNeedLegalizing(types), - ValueTypeActions(TLI.getValueTypeActions()) { + Fast(fast), ValueTypeActions(TLI.getValueTypeActions()) { assert(MVT::LAST_VALUETYPE <= 32 && "Too many value types for ValueTypeActions to hold!"); } @@ -1289,9 +1292,8 @@ unsigned Line = DSP->getLine(); unsigned Col = DSP->getColumn(); - const Function *F = DAG.getMachineFunction().getFunction(); - if (!F->hasFnAttr(Attribute::OptimizeForSize)) { + if (Fast) { // A bit self-referential to have DebugLoc on Debug_Loc nodes, but it // won't hurt anything. if (useDEBUG_LOC) { @@ -8640,9 +8642,9 @@ // SelectionDAG::Legalize - This is the entry point for the file. // -void SelectionDAG::Legalize(bool TypesNeedLegalizing) { +void SelectionDAG::Legalize(bool TypesNeedLegalizing, bool Fast) { /// run - This is the main entry point to this class. /// - SelectionDAGLegalize(*this, TypesNeedLegalizing).LegalizeDAG(); + SelectionDAGLegalize(*this, TypesNeedLegalizing, Fast).LegalizeDAG(); } Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=65367&r1=65366&r2=65367&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Mon Feb 23 20:35:30 2009 @@ -3915,6 +3915,7 @@ if (Fast) DAG.setRoot(DAG.getLabel(ISD::DBG_LABEL, getCurDebugLoc(), getRoot(), LabelID)); + DW->setFastCodeGen(Fast); } return 0; @@ -3950,9 +3951,7 @@ // create a label if this is a beginning of inlined function. unsigned Line = Subprogram.getLineNumber(); - // FIXME: Support more than just -Os. - const Function *F = I.getParent()->getParent(); - if (!F->hasFnAttr(Attribute::OptimizeForSize)) { + if (Fast) { unsigned LabelID = DW->RecordSourceLine(Line, 0, SrcFile); if (DW->getRecordSourceLineCount() != 1) DAG.setRoot(DAG.getLabel(ISD::DBG_LABEL, getCurDebugLoc(), @@ -3966,8 +3965,7 @@ return 0; } case Intrinsic::dbg_declare: { - const Function *F = I.getParent()->getParent(); - if (!F->hasFnAttr(Attribute::OptimizeForSize)) { + if (Fast) { DwarfWriter *DW = DAG.getDwarfWriter(); DbgDeclareInst &DI = cast(I); Value *Variable = DI.getVariable(); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=65367&r1=65366&r2=65367&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Mon Feb 23 20:35:30 2009 @@ -621,9 +621,9 @@ if (TimePassesIsEnabled) { NamedRegionTimer T("DAG Legalization", GroupName); - CurDAG->Legalize(DisableLegalizeTypes); + CurDAG->Legalize(DisableLegalizeTypes, Fast); } else { - CurDAG->Legalize(DisableLegalizeTypes); + CurDAG->Legalize(DisableLegalizeTypes, Fast); } DOUT << "Legalized selection DAG:\n"; Modified: llvm/trunk/test/DebugInfo/2009-01-30-Method.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/2009-01-30-Method.ll?rev=65367&r1=65366&r2=65367&view=diff ============================================================================== --- llvm/trunk/test/DebugInfo/2009-01-30-Method.ll (original) +++ llvm/trunk/test/DebugInfo/2009-01-30-Method.ll Mon Feb 23 20:35:30 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc | grep "\\"foo" | count 3 +; RUN: llvm-as < %s | llc -fast | grep "\\"foo" | count 3 ; 1 declaration, 1 definition and 1 pubnames entry. target triple = "i386-apple-darwin*" %llvm.dbg.anchor.type = type { i32, i32 } Modified: llvm/trunk/test/DebugInfo/deaddebuglabel.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/deaddebuglabel.ll?rev=65367&r1=65366&r2=65367&view=diff ============================================================================== --- llvm/trunk/test/DebugInfo/deaddebuglabel.ll (original) +++ llvm/trunk/test/DebugInfo/deaddebuglabel.ll Mon Feb 23 20:35:30 2009 @@ -1,5 +1,6 @@ +; RUN: llvm-as < %s | llc -fast | grep "label" | count 8 ; PR2614 -; RUN: llvm-as < %s | llc | grep "label" | count 8 +; XFAIL: * target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-f80:32:32-v64:64:64-v128:128:128-a0:0:64" target triple = "i686-pc-linux-gnu" Modified: llvm/trunk/test/DebugInfo/forwardDecl.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/forwardDecl.ll?rev=65367&r1=65366&r2=65367&view=diff ============================================================================== --- llvm/trunk/test/DebugInfo/forwardDecl.ll (original) +++ llvm/trunk/test/DebugInfo/forwardDecl.ll Mon Feb 23 20:35:30 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc | %prcontext ST 1 | grep 0x1 | count 1 +; RUN: llvm-as < %s | llc -fast | %prcontext ST 1 | grep 0x1 | count 1 target triple = "i386-apple-darwin9.6" %llvm.dbg.anchor.type = type { i32, i32 } Modified: llvm/trunk/test/FrontendC++/2006-11-06-StackTrace.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC%2B%2B/2006-11-06-StackTrace.cpp?rev=65367&r1=65366&r2=65367&view=diff ============================================================================== --- llvm/trunk/test/FrontendC++/2006-11-06-StackTrace.cpp (original) +++ llvm/trunk/test/FrontendC++/2006-11-06-StackTrace.cpp Mon Feb 23 20:35:30 2009 @@ -1,6 +1,7 @@ // This is a regression test on debug info to make sure that we can get a // meaningful stack trace from a C++ program. -// RUN: %llvmgcc -S -O0 -g %s -o - | llvm-as | llc --disable-fp-elim -o %t.s -f +// RUN: %llvmgcc -S -O0 -g %s -o - | llvm-as | \ +// RUN: llc --disable-fp-elim -o %t.s -f -fast -relocation-model=pic // RUN: %compile_c %t.s -o %t.o // RUN: %link %t.o -o %t.exe // RUN: echo {break DeepStack::deepest\nrun 17\nwhere\n} > %t.in Modified: llvm/trunk/test/FrontendC++/2006-11-30-Pubnames.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC%2B%2B/2006-11-30-Pubnames.cpp?rev=65367&r1=65366&r2=65367&view=diff ============================================================================== --- llvm/trunk/test/FrontendC++/2006-11-30-Pubnames.cpp (original) +++ llvm/trunk/test/FrontendC++/2006-11-30-Pubnames.cpp Mon Feb 23 20:35:30 2009 @@ -1,7 +1,7 @@ // This is a regression test on debug info to make sure that we can access // qualified global names. // RUN: %llvmgcc -S -O0 -g %s -o - | llvm-as | \ -// RUN: llc --disable-fp-elim -o %t.s -f +// RUN: llc --disable-fp-elim -o %t.s -f -fast // RUN: %compile_c %t.s -o %t.o // RUN: %link %t.o -o %t.exe // RUN: %llvmdsymutil %t.exe Modified: llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp?rev=65367&r1=65366&r2=65367&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp Mon Feb 23 20:35:30 2009 @@ -641,7 +641,8 @@ O << "\";\n\n"; O << " if (TAI->doesSupportDebugInformation() &&\n" - << " DW->ShouldEmitDwarfDebug()) {\n" + << " DW->ShouldEmitDwarfDebug() &&\n" + << " !DW->getFastCodeGen()) {\n" << " const MachineFunction *MF = MI->getParent()->getParent();\n" << " DebugLoc CurDL = MI->getDebugLoc();\n\n" << " if (!CurDL.isUnknown()) {\n" From isanbard at gmail.com Mon Feb 23 20:40:53 2009 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 24 Feb 2009 02:40:53 -0000 Subject: [llvm-commits] [llvm] r65369 - in /llvm/branches/Apple/Dib: include/llvm/CodeGen/DwarfWriter.h include/llvm/CodeGen/SelectionDAG.h lib/CodeGen/SelectionDAG/FastISel.cpp lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp test/DebugInfo/2009-01-30-Method.ll test/DebugInfo/deaddebuglabel.ll test/DebugInfo/forwardDecl.ll test/FrontendC++/2006-11-06-StackTrace.cpp test/FrontendC++/2006-11-30-Pubnames.cpp utils/TableGen/AsmWriterEmitter.cpp Message-ID: <200902240240.n1O2esbY023965@zion.cs.uiuc.edu> Author: void Date: Mon Feb 23 20:40:53 2009 New Revision: 65369 URL: http://llvm.org/viewvc/llvm-project?rev=65369&view=rev Log: --- Merging (from foreign repository) r65367 into '.': U test/DebugInfo/forwardDecl.ll U test/DebugInfo/deaddebuglabel.ll U test/DebugInfo/2009-01-30-Method.ll U test/FrontendC++/2006-11-06-StackTrace.cpp U test/FrontendC++/2006-11-30-Pubnames.cpp U include/llvm/CodeGen/DwarfWriter.h U include/llvm/CodeGen/SelectionDAG.h U utils/TableGen/AsmWriterEmitter.cpp Conflict discovered in 'lib/CodeGen/SelectionDAG/LegalizeDAG.cpp'. Select: (p) postpone, (df) diff-full, (e) edit, (h) help for more options: e Select: (p) postpone, (df) diff-full, (e) edit, (r) resolved, (h) help for more options: r U lib/CodeGen/SelectionDAG/LegalizeDAG.cpp U lib/CodeGen/SelectionDAG/FastISel.cpp U lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp U lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp - Use the "Fast" flag instead of "OptimizeForSize" to determine whether to emit a DBG_LABEL or not. We want to fall back to the original way of emitting debug info when we're in -O0/-fast mode. - Add plumbing in to pass the "Fast" flag to places that need it. - XFAIL DebugInfo/deaddebuglabel.ll. This is finding 11 labels instead of 8. I need to investigate still. Modified: llvm/branches/Apple/Dib/include/llvm/CodeGen/DwarfWriter.h llvm/branches/Apple/Dib/include/llvm/CodeGen/SelectionDAG.h llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/FastISel.cpp llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp llvm/branches/Apple/Dib/test/DebugInfo/2009-01-30-Method.ll llvm/branches/Apple/Dib/test/DebugInfo/deaddebuglabel.ll llvm/branches/Apple/Dib/test/DebugInfo/forwardDecl.ll llvm/branches/Apple/Dib/test/FrontendC++/2006-11-06-StackTrace.cpp llvm/branches/Apple/Dib/test/FrontendC++/2006-11-30-Pubnames.cpp llvm/branches/Apple/Dib/utils/TableGen/AsmWriterEmitter.cpp Modified: llvm/branches/Apple/Dib/include/llvm/CodeGen/DwarfWriter.h URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/include/llvm/CodeGen/DwarfWriter.h?rev=65369&r1=65368&r2=65369&view=diff ============================================================================== --- llvm/branches/Apple/Dib/include/llvm/CodeGen/DwarfWriter.h (original) +++ llvm/branches/Apple/Dib/include/llvm/CodeGen/DwarfWriter.h Mon Feb 23 20:40:53 2009 @@ -48,7 +48,10 @@ /// DE - Provides the DwarfWriter exception implementation. /// DwarfException *DE; - + + /// FastCodeGen - True if generating code via the "fast" isel. + /// + bool FastCodeGen; public: static char ID; // Pass identification, replacement for typeid @@ -104,6 +107,9 @@ /// ShouldEmitDwarfDebug - Returns true if Dwarf debugging declarations should /// be emitted. bool ShouldEmitDwarfDebug() const; + + bool getFastCodeGen() const { return FastCodeGen; } + void setFastCodeGen(bool Fast) { FastCodeGen = Fast; } }; Modified: llvm/branches/Apple/Dib/include/llvm/CodeGen/SelectionDAG.h URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/include/llvm/CodeGen/SelectionDAG.h?rev=65369&r1=65368&r2=65369&view=diff ============================================================================== --- llvm/branches/Apple/Dib/include/llvm/CodeGen/SelectionDAG.h (original) +++ llvm/branches/Apple/Dib/include/llvm/CodeGen/SelectionDAG.h Mon Feb 23 20:40:53 2009 @@ -216,7 +216,7 @@ /// /// Note that this is an involved process that may invalidate pointers into /// the graph. - void Legalize(bool TypesNeedLegalizing); + void Legalize(bool TypesNeedLegalizing, bool Fast); /// RemoveDeadNodes - This method deletes all unreachable nodes in the /// SelectionDAG. Modified: llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/FastISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/FastISel.cpp?rev=65369&r1=65368&r2=65369&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/FastISel.cpp (original) +++ llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/FastISel.cpp Mon Feb 23 20:40:53 2009 @@ -370,6 +370,7 @@ unsigned Line = Subprogram.getLineNumber(); unsigned LabelID = DW->RecordSourceLine(Line, 0, SrcFile); setCurDebugLoc(DebugLoc::get(MF.getOrCreateDebugLocID(SrcFile, Line, 0))); + DW->setFastCodeGen(true); if (DW->getRecordSourceLineCount() != 1) { const TargetInstrDesc &II = TII.get(TargetInstrInfo::DBG_LABEL); Modified: llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=65369&r1=65368&r2=65369&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Mon Feb 23 20:40:53 2009 @@ -56,6 +56,7 @@ TargetLowering &TLI; SelectionDAG &DAG; bool TypesNeedLegalizing; + bool Fast; // Libcall insertion helpers. @@ -137,7 +138,8 @@ } public: - explicit SelectionDAGLegalize(SelectionDAG &DAG, bool TypesNeedLegalizing); + explicit SelectionDAGLegalize(SelectionDAG &DAG, bool TypesNeedLegalizing, + bool fast); /// getTypeAction - Return how we should legalize values of this type, either /// it is already legal or we need to expand it into multiple registers of @@ -363,9 +365,10 @@ return TLI.isShuffleMaskLegal(Mask, VT) ? Mask.getNode() : 0; } -SelectionDAGLegalize::SelectionDAGLegalize(SelectionDAG &dag, bool types) +SelectionDAGLegalize::SelectionDAGLegalize(SelectionDAG &dag, + bool types, bool fast) : TLI(dag.getTargetLoweringInfo()), DAG(dag), TypesNeedLegalizing(types), - ValueTypeActions(TLI.getValueTypeActions()) { + Fast(fast), ValueTypeActions(TLI.getValueTypeActions()) { assert(MVT::LAST_VALUETYPE <= 32 && "Too many value types for ValueTypeActions to hold!"); } @@ -1291,9 +1294,7 @@ unsigned Line = DSP->getLine(); unsigned Col = DSP->getColumn(); - const Function *F = DAG.getMachineFunction().getFunction(); - - if (!F->hasFnAttr(Attribute::OptimizeForSize)) { + if (Fast) { // A bit self-referential to have DebugLoc on Debug_Loc nodes, but it // won't hurt anything. if (useDEBUG_LOC) { @@ -8644,9 +8645,9 @@ // SelectionDAG::Legalize - This is the entry point for the file. // -void SelectionDAG::Legalize(bool TypesNeedLegalizing) { +void SelectionDAG::Legalize(bool TypesNeedLegalizing, bool Fast) { /// run - This is the main entry point to this class. /// - SelectionDAGLegalize(*this, TypesNeedLegalizing).LegalizeDAG(); + SelectionDAGLegalize(*this, TypesNeedLegalizing, Fast).LegalizeDAG(); } Modified: llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=65369&r1=65368&r2=65369&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original) +++ llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Mon Feb 23 20:40:53 2009 @@ -3918,6 +3918,7 @@ if (Fast) DAG.setRoot(DAG.getLabel(ISD::DBG_LABEL, getCurDebugLoc(), getRoot(), LabelID)); + DW->setFastCodeGen(Fast); } return 0; @@ -3953,9 +3954,7 @@ // create a label if this is a beginning of inlined function. unsigned Line = Subprogram.getLineNumber(); - // FIXME: Support more than just -Os. - const Function *F = I.getParent()->getParent(); - if (!F->hasFnAttr(Attribute::OptimizeForSize)) { + if (Fast) { unsigned LabelID = DW->RecordSourceLine(Line, 0, SrcFile); if (DW->getRecordSourceLineCount() != 1) DAG.setRoot(DAG.getLabel(ISD::DBG_LABEL, getCurDebugLoc(), @@ -3969,8 +3968,7 @@ return 0; } case Intrinsic::dbg_declare: { - const Function *F = I.getParent()->getParent(); - if (!F->hasFnAttr(Attribute::OptimizeForSize)) { + if (Fast) { DwarfWriter *DW = DAG.getDwarfWriter(); DbgDeclareInst &DI = cast(I); Value *Variable = DI.getVariable(); Modified: llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=65369&r1=65368&r2=65369&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Mon Feb 23 20:40:53 2009 @@ -621,9 +621,9 @@ if (TimePassesIsEnabled) { NamedRegionTimer T("DAG Legalization", GroupName); - CurDAG->Legalize(DisableLegalizeTypes); + CurDAG->Legalize(DisableLegalizeTypes, Fast); } else { - CurDAG->Legalize(DisableLegalizeTypes); + CurDAG->Legalize(DisableLegalizeTypes, Fast); } DOUT << "Legalized selection DAG:\n"; Modified: llvm/branches/Apple/Dib/test/DebugInfo/2009-01-30-Method.ll URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/test/DebugInfo/2009-01-30-Method.ll?rev=65369&r1=65368&r2=65369&view=diff ============================================================================== --- llvm/branches/Apple/Dib/test/DebugInfo/2009-01-30-Method.ll (original) +++ llvm/branches/Apple/Dib/test/DebugInfo/2009-01-30-Method.ll Mon Feb 23 20:40:53 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc | grep "\\"foo" | count 3 +; RUN: llvm-as < %s | llc -fast | grep "\\"foo" | count 3 ; 1 declaration, 1 definition and 1 pubnames entry. target triple = "i386-apple-darwin*" %llvm.dbg.anchor.type = type { i32, i32 } Modified: llvm/branches/Apple/Dib/test/DebugInfo/deaddebuglabel.ll URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/test/DebugInfo/deaddebuglabel.ll?rev=65369&r1=65368&r2=65369&view=diff ============================================================================== --- llvm/branches/Apple/Dib/test/DebugInfo/deaddebuglabel.ll (original) +++ llvm/branches/Apple/Dib/test/DebugInfo/deaddebuglabel.ll Mon Feb 23 20:40:53 2009 @@ -1,5 +1,6 @@ +; RUN: llvm-as < %s | llc -fast | grep "label" | count 8 ; PR2614 -; RUN: llvm-as < %s | llc | grep "label" | count 8 +; XFAIL: * target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-f80:32:32-v64:64:64-v128:128:128-a0:0:64" target triple = "i686-pc-linux-gnu" Modified: llvm/branches/Apple/Dib/test/DebugInfo/forwardDecl.ll URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/test/DebugInfo/forwardDecl.ll?rev=65369&r1=65368&r2=65369&view=diff ============================================================================== --- llvm/branches/Apple/Dib/test/DebugInfo/forwardDecl.ll (original) +++ llvm/branches/Apple/Dib/test/DebugInfo/forwardDecl.ll Mon Feb 23 20:40:53 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc | %prcontext ST 1 | grep 0x1 | count 1 +; RUN: llvm-as < %s | llc -fast | %prcontext ST 1 | grep 0x1 | count 1 target triple = "i386-apple-darwin9.6" %llvm.dbg.anchor.type = type { i32, i32 } Modified: llvm/branches/Apple/Dib/test/FrontendC++/2006-11-06-StackTrace.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/test/FrontendC%2B%2B/2006-11-06-StackTrace.cpp?rev=65369&r1=65368&r2=65369&view=diff ============================================================================== --- llvm/branches/Apple/Dib/test/FrontendC++/2006-11-06-StackTrace.cpp (original) +++ llvm/branches/Apple/Dib/test/FrontendC++/2006-11-06-StackTrace.cpp Mon Feb 23 20:40:53 2009 @@ -1,6 +1,7 @@ // This is a regression test on debug info to make sure that we can get a // meaningful stack trace from a C++ program. -// RUN: %llvmgcc -S -O0 -g %s -o - | llvm-as | llc --disable-fp-elim -o %t.s -f +// RUN: %llvmgcc -S -O0 -g %s -o - | llvm-as | \ +// RUN: llc --disable-fp-elim -o %t.s -f -fast -relocation-model=pic // RUN: %compile_c %t.s -o %t.o // RUN: %link %t.o -o %t.exe // RUN: echo {break DeepStack::deepest\nrun 17\nwhere\n} > %t.in Modified: llvm/branches/Apple/Dib/test/FrontendC++/2006-11-30-Pubnames.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/test/FrontendC%2B%2B/2006-11-30-Pubnames.cpp?rev=65369&r1=65368&r2=65369&view=diff ============================================================================== --- llvm/branches/Apple/Dib/test/FrontendC++/2006-11-30-Pubnames.cpp (original) +++ llvm/branches/Apple/Dib/test/FrontendC++/2006-11-30-Pubnames.cpp Mon Feb 23 20:40:53 2009 @@ -1,7 +1,7 @@ // This is a regression test on debug info to make sure that we can access // qualified global names. // RUN: %llvmgcc -S -O0 -g %s -o - | llvm-as | \ -// RUN: llc --disable-fp-elim -o %t.s -f +// RUN: llc --disable-fp-elim -o %t.s -f -fast // RUN: %compile_c %t.s -o %t.o // RUN: %link %t.o -o %t.exe // RUN: %llvmdsymutil %t.exe Modified: llvm/branches/Apple/Dib/utils/TableGen/AsmWriterEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/utils/TableGen/AsmWriterEmitter.cpp?rev=65369&r1=65368&r2=65369&view=diff ============================================================================== --- llvm/branches/Apple/Dib/utils/TableGen/AsmWriterEmitter.cpp (original) +++ llvm/branches/Apple/Dib/utils/TableGen/AsmWriterEmitter.cpp Mon Feb 23 20:40:53 2009 @@ -641,7 +641,8 @@ O << "\";\n\n"; O << " if (TAI->doesSupportDebugInformation() &&\n" - << " DW->ShouldEmitDwarfDebug()) {\n" + << " DW->ShouldEmitDwarfDebug() &&\n" + << " !DW->getFastCodeGen()) {\n" << " const MachineFunction *MF = MI->getParent()->getParent();\n" << " DebugLoc CurDL = MI->getDebugLoc();\n\n" << " if (!CurDL.isUnknown()) {\n" From clattner at apple.com Mon Feb 23 22:09:30 2009 From: clattner at apple.com (Chris Lattner) Date: Mon, 23 Feb 2009 20:09:30 -0800 Subject: [llvm-commits] [llvm] r65289 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp In-Reply-To: <9011107A-3C45-4F39-9099-C111575A0309@apple.com> References: <200902221806.n1MI6Xj2009464@zion.cs.uiuc.edu> <1C61B8A9-1B56-462A-B4BE-6F97B2A89E41@apple.com> <269EA706-F349-4121-920A-99CB7BB41478@apple.com> <1BADC0C0-18E2-431A-BCF9-EFE1D2A9C58B@apple.com> <9011107A-3C45-4F39-9099-C111575A0309@apple.com> Message-ID: <4A64C7EE-AF21-4F43-910F-F09329991A3B@apple.com> On Feb 23, 2009, at 6:18 PM, Dan Gohman wrote: > > On Feb 23, 2009, at 5:57 PM, Chris Lattner wrote: > >> >> On Feb 23, 2009, at 4:29 PM, Dan Gohman wrote: >> >>>>> assigned a large alignment, which required codegen to perform >>>>> dynamic stack-pointer re-alignment, which forced the enclosing >>>>> function to have a frame pointer, which led to increased spilling. >>>> >>>> testcase? >>> >>> >>> I can probably construct an artificial testcase if you think it'd >>> be useful, >>> but I don't have anything handy smaller than lencod itself. >> >> I'm not interested in an executable testcase, an artificial one is >> good. This is the sort of thing that is non-obvious and could >> break in the future, which is why I thought a testcase would be >> useful. Do you agree? > > I added a testcase. Thanks Dan! To be clear (and not specifically directed at you), most regression tests are really best if they are "artificial" ones, that exercise only the thing in question. IMO, checking in huge .ll files that were bugpoint reduced is far less useful than a minimal hand crafted testcase that exercises the behavior in question. -Chris From resistor at mac.com Mon Feb 23 23:44:19 2009 From: resistor at mac.com (Owen Anderson) Date: Tue, 24 Feb 2009 05:44:19 -0000 Subject: [llvm-commits] [llvm] r65375 - /llvm/trunk/lib/CodeGen/StackSlotColoring.cpp Message-ID: <200902240544.n1O5iJCC029625@zion.cs.uiuc.edu> Author: resistor Date: Mon Feb 23 23:44:18 2009 New Revision: 65375 URL: http://llvm.org/viewvc/llvm-project?rev=65375&view=rev Log: Add a debugging option for SSC DCE. Modified: llvm/trunk/lib/CodeGen/StackSlotColoring.cpp Modified: llvm/trunk/lib/CodeGen/StackSlotColoring.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StackSlotColoring.cpp?rev=65375&r1=65374&r2=65375&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/StackSlotColoring.cpp (original) +++ llvm/trunk/lib/CodeGen/StackSlotColoring.cpp Mon Feb 23 23:44:18 2009 @@ -37,6 +37,8 @@ cl::init(false), cl::Hidden, cl::desc("Enable slot coloring DCE")); +static cl::opt DCELimit("ssc-dce-limit", cl::init(-1), cl::Hidden); + STATISTIC(NumEliminated, "Number of stack slots eliminated due to coloring"); STATISTIC(NumDeadAccesses, "Number of trivially dead stack accesses eliminated"); @@ -286,6 +288,9 @@ for (MachineBasicBlock::iterator I = MBB->begin(), E = MBB->end(); I != E; ++I) { + if (DCELimit != -1 && (int)NumDeadAccesses >= DCELimit) + break; + MachineBasicBlock::iterator NextMI = next(I); if (NextMI == MBB->end()) continue; From echeng at apple.com Tue Feb 24 00:20:18 2009 From: echeng at apple.com (Evan Cheng) Date: Mon, 23 Feb 2009 22:20:18 -0800 Subject: [llvm-commits] [llvm] r65367 - in /llvm/trunk: include/llvm/CodeGen/DwarfWriter.h include/llvm/CodeGen/SelectionDAG.h lib/CodeGen/SelectionDAG/FastISel.cpp lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp test/DebugInfo/2009-01-30-Method.ll test/DebugInfo/deaddebuglabel.ll test/DebugInfo/forwardDecl.ll test/FrontendC++/2006-11-06-StackTrace.cpp test/FrontendC++/2006-11-30-Pubnames.cpp utils/TableGen/AsmWriterEmitter.cpp In-Reply-To: <200902240235.n1O2ZV0f023730@zion.cs.uiuc.edu> References: <200902240235.n1O2ZV0f023730@zion.cs.uiuc.edu> Message-ID: <6973CA87-3B39-4D37-9B64-7C743E0C953D@apple.com> On Feb 23, 2009, at 6:35 PM, Bill Wendling wrote: > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/include/llvm/CodeGen/DwarfWriter.h (original) > +++ llvm/trunk/include/llvm/CodeGen/DwarfWriter.h Mon Feb 23 > 20:35:30 2009 > @@ -48,7 +48,10 @@ > /// DE - Provides the DwarfWriter exception implementation. > /// > DwarfException *DE; > - > + > + /// FastCodeGen - True if generating code via the "fast" isel. > + /// > + bool FastCodeGen; > public: > static char ID; // Pass identification, replacement for typeid > > @@ -104,6 +107,9 @@ > /// ShouldEmitDwarfDebug - Returns true if Dwarf debugging > declarations should > /// be emitted. > bool ShouldEmitDwarfDebug() const; > + > + bool getFastCodeGen() const { return FastCodeGen; } > + void setFastCodeGen(bool Fast) { FastCodeGen = Fast; } > }; Bill, is this necessary? See LLVMTargetMachine.cpp: case TargetMachine::AssemblyFile: if (addAssemblyEmitter(PM, Fast, Out)) return FileModel::Error; It's passing in "Fast". > > > > > Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=65367&r1=65366&r2=65367&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original) > +++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Mon Feb 23 > 20:35:30 2009 > @@ -216,7 +216,7 @@ > /// > /// Note that this is an involved process that may invalidate > pointers into > /// the graph. > - void Legalize(bool TypesNeedLegalizing); > + void Legalize(bool TypesNeedLegalizing, bool Fast); > > /// RemoveDeadNodes - This method deletes all unreachable nodes in > the > /// SelectionDAG. > > Modified: llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp?rev=65367&r1=65366&r2=65367&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp (original) > +++ llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp Mon Feb 23 > 20:35:30 2009 > @@ -370,6 +370,7 @@ > unsigned Line = Subprogram.getLineNumber(); > unsigned LabelID = DW->RecordSourceLine(Line, 0, SrcFile); > setCurDebugLoc(DebugLoc::get(MF.getOrCreateDebugLocID(SrcFile, > Line, 0))); > + DW->setFastCodeGen(true); This shouldn't be necessary. > > > if (DW->getRecordSourceLineCount() != 1) { > const TargetInstrDesc &II = > TII.get(TargetInstrInfo::DBG_LABEL); > > Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=65367&r1=65366&r2=65367&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) > +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Mon Feb 23 > 20:35:30 2009 > @@ -56,6 +56,7 @@ > TargetLowering &TLI; > SelectionDAG &DAG; > bool TypesNeedLegalizing; > + bool Fast; > > // Libcall insertion helpers. > > @@ -137,7 +138,8 @@ > } > > public: > - explicit SelectionDAGLegalize(SelectionDAG &DAG, bool > TypesNeedLegalizing); > + explicit SelectionDAGLegalize(SelectionDAG &DAG, bool > TypesNeedLegalizing, > + bool fast); > > /// getTypeAction - Return how we should legalize values of this > type, either > /// it is already legal or we need to expand it into multiple > registers of > @@ -362,9 +364,10 @@ > return TLI.isShuffleMaskLegal(Mask, VT) ? Mask.getNode() : 0; > } > > -SelectionDAGLegalize::SelectionDAGLegalize(SelectionDAG &dag, bool > types) > +SelectionDAGLegalize::SelectionDAGLegalize(SelectionDAG &dag, > + bool types, bool fast) > : TLI(dag.getTargetLoweringInfo()), DAG(dag), > TypesNeedLegalizing(types), > - ValueTypeActions(TLI.getValueTypeActions()) { > + Fast(fast), ValueTypeActions(TLI.getValueTypeActions()) { > assert(MVT::LAST_VALUETYPE <= 32 && > "Too many value types for ValueTypeActions to hold!"); > } > @@ -1289,9 +1292,8 @@ > > unsigned Line = DSP->getLine(); > unsigned Col = DSP->getColumn(); > - const Function *F = DAG.getMachineFunction().getFunction(); > > - if (!F->hasFnAttr(Attribute::OptimizeForSize)) { > + if (Fast) { > // A bit self-referential to have DebugLoc on Debug_Loc > nodes, but it > // won't hurt anything. > if (useDEBUG_LOC) { Ewww. Legalizer shouldn't have to do this. Is this code even exercised? I don't see ISD::DBG_STOPPOINT ever being generated. If not, we should just make the default expansion to its chain. Thanks, Evan > > @@ -8640,9 +8642,9 @@ > > // SelectionDAG::Legalize - This is the entry point for the file. > // > -void SelectionDAG::Legalize(bool TypesNeedLegalizing) { > +void SelectionDAG::Legalize(bool TypesNeedLegalizing, bool Fast) { > /// run - This is the main entry point to this class. > /// > - SelectionDAGLegalize(*this, TypesNeedLegalizing).LegalizeDAG(); > + SelectionDAGLegalize(*this, TypesNeedLegalizing, > Fast).LegalizeDAG(); > } > > > Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=65367&r1=65366&r2=65367&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp > (original) > +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Mon > Feb 23 20:35:30 2009 > @@ -3915,6 +3915,7 @@ > if (Fast) > DAG.setRoot(DAG.getLabel(ISD::DBG_LABEL, getCurDebugLoc(), > getRoot(), LabelID)); > + DW->setFastCodeGen(Fast); > } > > return 0; > @@ -3950,9 +3951,7 @@ > // create a label if this is a beginning of inlined function. > unsigned Line = Subprogram.getLineNumber(); > > - // FIXME: Support more than just -Os. > - const Function *F = I.getParent()->getParent(); > - if (!F->hasFnAttr(Attribute::OptimizeForSize)) { > + if (Fast) { > unsigned LabelID = DW->RecordSourceLine(Line, 0, SrcFile); > if (DW->getRecordSourceLineCount() != 1) > DAG.setRoot(DAG.getLabel(ISD::DBG_LABEL, getCurDebugLoc(), > @@ -3966,8 +3965,7 @@ > return 0; > } > case Intrinsic::dbg_declare: { > - const Function *F = I.getParent()->getParent(); > - if (!F->hasFnAttr(Attribute::OptimizeForSize)) { > + if (Fast) { > DwarfWriter *DW = DAG.getDwarfWriter(); > DbgDeclareInst &DI = cast(I); > Value *Variable = DI.getVariable(); > > Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=65367&r1=65366&r2=65367&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp > (original) > +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Mon Feb > 23 20:35:30 2009 > @@ -621,9 +621,9 @@ > > if (TimePassesIsEnabled) { > NamedRegionTimer T("DAG Legalization", GroupName); > - CurDAG->Legalize(DisableLegalizeTypes); > + CurDAG->Legalize(DisableLegalizeTypes, Fast); > } else { > - CurDAG->Legalize(DisableLegalizeTypes); > + CurDAG->Legalize(DisableLegalizeTypes, Fast); > } > > DOUT << "Legalized selection DAG:\n"; > > Modified: llvm/trunk/test/DebugInfo/2009-01-30-Method.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/2009-01-30-Method.ll?rev=65367&r1=65366&r2=65367&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/DebugInfo/2009-01-30-Method.ll (original) > +++ llvm/trunk/test/DebugInfo/2009-01-30-Method.ll Mon Feb 23 > 20:35:30 2009 > @@ -1,4 +1,4 @@ > -; RUN: llvm-as < %s | llc | grep "\\"foo" | count 3 > +; RUN: llvm-as < %s | llc -fast | grep "\\"foo" | count 3 > ; 1 declaration, 1 definition and 1 pubnames entry. > target triple = "i386-apple-darwin*" > %llvm.dbg.anchor.type = type { i32, i32 } > > Modified: llvm/trunk/test/DebugInfo/deaddebuglabel.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/deaddebuglabel.ll?rev=65367&r1=65366&r2=65367&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/DebugInfo/deaddebuglabel.ll (original) > +++ llvm/trunk/test/DebugInfo/deaddebuglabel.ll Mon Feb 23 20:35:30 > 2009 > @@ -1,5 +1,6 @@ > +; RUN: llvm-as < %s | llc -fast | grep "label" | count 8 > ; PR2614 > -; RUN: llvm-as < %s | llc | grep "label" | count 8 > +; XFAIL: * > > target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32- > i64:32:64-f32:32:32-f64:32:64-f80:32:32-v64:64:64-v128:128:128- > a0:0:64" > target triple = "i686-pc-linux-gnu" > > Modified: llvm/trunk/test/DebugInfo/forwardDecl.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/forwardDecl.ll?rev=65367&r1=65366&r2=65367&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/DebugInfo/forwardDecl.ll (original) > +++ llvm/trunk/test/DebugInfo/forwardDecl.ll Mon Feb 23 20:35:30 2009 > @@ -1,4 +1,4 @@ > -; RUN: llvm-as < %s | llc | %prcontext ST 1 | grep 0x1 | count 1 > +; RUN: llvm-as < %s | llc -fast | %prcontext ST 1 | grep 0x1 | > count 1 > > target triple = "i386-apple-darwin9.6" > %llvm.dbg.anchor.type = type { i32, i32 } > > Modified: llvm/trunk/test/FrontendC++/2006-11-06-StackTrace.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC%2B%2B/2006-11-06-StackTrace.cpp?rev=65367&r1=65366&r2=65367&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/FrontendC++/2006-11-06-StackTrace.cpp (original) > +++ llvm/trunk/test/FrontendC++/2006-11-06-StackTrace.cpp Mon Feb 23 > 20:35:30 2009 > @@ -1,6 +1,7 @@ > // This is a regression test on debug info to make sure that we can > get a > // meaningful stack trace from a C++ program. > -// RUN: %llvmgcc -S -O0 -g %s -o - | llvm-as | llc --disable-fp- > elim -o %t.s -f > +// RUN: %llvmgcc -S -O0 -g %s -o - | llvm-as | \ > +// RUN: llc --disable-fp-elim -o %t.s -f -fast -relocation- > model=pic > // RUN: %compile_c %t.s -o %t.o > // RUN: %link %t.o -o %t.exe > // RUN: echo {break DeepStack::deepest\nrun 17\nwhere\n} > %t.in > > Modified: llvm/trunk/test/FrontendC++/2006-11-30-Pubnames.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC%2B%2B/2006-11-30-Pubnames.cpp?rev=65367&r1=65366&r2=65367&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/FrontendC++/2006-11-30-Pubnames.cpp (original) > +++ llvm/trunk/test/FrontendC++/2006-11-30-Pubnames.cpp Mon Feb 23 > 20:35:30 2009 > @@ -1,7 +1,7 @@ > // This is a regression test on debug info to make sure that we can > access > // qualified global names. > // RUN: %llvmgcc -S -O0 -g %s -o - | llvm-as | \ > -// RUN: llc --disable-fp-elim -o %t.s -f > +// RUN: llc --disable-fp-elim -o %t.s -f -fast > // RUN: %compile_c %t.s -o %t.o > // RUN: %link %t.o -o %t.exe > // RUN: %llvmdsymutil %t.exe > > Modified: llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp?rev=65367&r1=65366&r2=65367&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp (original) > +++ llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp Mon Feb 23 > 20:35:30 2009 > @@ -641,7 +641,8 @@ > O << "\";\n\n"; > > O << " if (TAI->doesSupportDebugInformation() &&\n" > - << " DW->ShouldEmitDwarfDebug()) {\n" > + << " DW->ShouldEmitDwarfDebug() &&\n" > + << " !DW->getFastCodeGen()) {\n" > << " const MachineFunction *MF = MI->getParent()->getParent(); > \n" > << " DebugLoc CurDL = MI->getDebugLoc();\n\n" > << " if (!CurDL.isUnknown()) {\n" > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From isanbard at gmail.com Tue Feb 24 01:11:51 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 23 Feb 2009 23:11:51 -0800 Subject: [llvm-commits] [llvm] r65367 - in /llvm/trunk: include/llvm/CodeGen/DwarfWriter.h include/llvm/CodeGen/SelectionDAG.h lib/CodeGen/SelectionDAG/FastISel.cpp lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp test/DebugInfo/2009-01-30-Method.ll test/DebugInfo/deaddebuglabel.ll test/DebugInfo/forwardDecl.ll test/FrontendC++/2006-11-06-StackTrace.cpp test/FrontendC++/2006-11-30-Pubnames.cpp utils/TableGen/AsmWriterEmitter.cpp In-Reply-To: <6973CA87-3B39-4D37-9B64-7C743E0C953D@apple.com> References: <200902240235.n1O2ZV0f023730@zion.cs.uiuc.edu> <6973CA87-3B39-4D37-9B64-7C743E0C953D@apple.com> Message-ID: <999DEB7D-3590-4EFF-947D-FA301329C19A@gmail.com> On Feb 23, 2009, at 10:20 PM, Evan Cheng wrote: > On Feb 23, 2009, at 6:35 PM, Bill Wendling wrote: > >> - >> + >> + /// FastCodeGen - True if generating code via the "fast" isel. >> + /// >> + bool FastCodeGen; >> public: >> static char ID; // Pass identification, replacement for typeid >> >> @@ -104,6 +107,9 @@ >> /// ShouldEmitDwarfDebug - Returns true if Dwarf debugging >> declarations should >> /// be emitted. >> bool ShouldEmitDwarfDebug() const; >> + >> + bool getFastCodeGen() const { return FastCodeGen; } >> + void setFastCodeGen(bool Fast) { FastCodeGen = Fast; } >> }; > > Bill, is this necessary? See LLVMTargetMachine.cpp: > > case TargetMachine::AssemblyFile: > if (addAssemblyEmitter(PM, Fast, Out)) > return FileModel::Error; > > It's passing in "Fast". > Possibly? Though the code is weird. Here's the X86 version: bool X86TargetMachine::addAssemblyEmitter(PassManagerBase &PM, bool Fast, raw_ostream &Out) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) PM.add(AsmPrinterCtor(Out, *this)); return false; } Note that the "if" conditional is redundant because of the assert. Also, it doesn't use the "Fast" boolean. But I'll look into it. >> @@ -1289,9 +1292,8 @@ >> >> unsigned Line = DSP->getLine(); >> unsigned Col = DSP->getColumn(); >> - const Function *F = DAG.getMachineFunction().getFunction(); >> >> - if (!F->hasFnAttr(Attribute::OptimizeForSize)) { >> + if (Fast) { >> // A bit self-referential to have DebugLoc on Debug_Loc >> nodes, but it >> // won't hurt anything. >> if (useDEBUG_LOC) { > > Ewww. Legalizer shouldn't have to do this. Yeah. The whole debugging thing is gross and does things it shouldn't. > Is this code even > exercised? I don't see ISD::DBG_STOPPOINT ever being generated. If > not, we should just make the default expansion to its chain. > I'm pretty sure I had to do something like this. It's easy to check, I suppose. -bw From echeng at apple.com Tue Feb 24 01:19:32 2009 From: echeng at apple.com (Evan Cheng) Date: Mon, 23 Feb 2009 23:19:32 -0800 Subject: [llvm-commits] [llvm] r65367 - in /llvm/trunk: include/llvm/CodeGen/DwarfWriter.h include/llvm/CodeGen/SelectionDAG.h lib/CodeGen/SelectionDAG/FastISel.cpp lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp test/DebugInfo/2009-01-30-Method.ll test/DebugInfo/deaddebuglabel.ll test/DebugInfo/forwardDecl.ll test/FrontendC++/2006-11-06-StackTrace.cpp test/FrontendC++/2006-11-30-Pubnames.cpp utils/TableGen/AsmWriterEmitter.cpp In-Reply-To: <999DEB7D-3590-4EFF-947D-FA301329C19A@gmail.com> References: <200902240235.n1O2ZV0f023730@zion.cs.uiuc.edu> <6973CA87-3B39-4D37-9B64-7C743E0C953D@apple.com> <999DEB7D-3590-4EFF-947D-FA301329C19A@gmail.com> Message-ID: <5C0D3B60-D5E9-4D11-B3D0-AAB91C0244D8@apple.com> On Feb 23, 2009, at 11:11 PM, Bill Wendling wrote: > On Feb 23, 2009, at 10:20 PM, Evan Cheng wrote: > >> On Feb 23, 2009, at 6:35 PM, Bill Wendling wrote: >> >>> - >>> + >>> + /// FastCodeGen - True if generating code via the "fast" isel. >>> + /// >>> + bool FastCodeGen; >>> public: >>> static char ID; // Pass identification, replacement for typeid >>> >>> @@ -104,6 +107,9 @@ >>> /// ShouldEmitDwarfDebug - Returns true if Dwarf debugging >>> declarations should >>> /// be emitted. >>> bool ShouldEmitDwarfDebug() const; >>> + >>> + bool getFastCodeGen() const { return FastCodeGen; } >>> + void setFastCodeGen(bool Fast) { FastCodeGen = Fast; } >>> }; >> >> Bill, is this necessary? See LLVMTargetMachine.cpp: >> >> case TargetMachine::AssemblyFile: >> if (addAssemblyEmitter(PM, Fast, Out)) >> return FileModel::Error; >> >> It's passing in "Fast". >> > Possibly? Though the code is weird. Here's the X86 version: > > bool X86TargetMachine::addAssemblyEmitter(PassManagerBase &PM, bool > Fast, > raw_ostream &Out) { > assert(AsmPrinterCtor && "AsmPrinter was not linked in"); > if (AsmPrinterCtor) > PM.add(AsmPrinterCtor(Out, *this)); > return false; > } > > Note that the "if" conditional is redundant because of the assert. > Also, it doesn't use the "Fast" boolean. But I'll look into it. Please do. I'd rather "fast" be set at pass initialization time (it's ugly enough as it is). > > >>> @@ -1289,9 +1292,8 @@ >>> >>> unsigned Line = DSP->getLine(); >>> unsigned Col = DSP->getColumn(); >>> - const Function *F = DAG.getMachineFunction().getFunction(); >>> >>> - if (!F->hasFnAttr(Attribute::OptimizeForSize)) { >>> + if (Fast) { >>> // A bit self-referential to have DebugLoc on Debug_Loc >>> nodes, but it >>> // won't hurt anything. >>> if (useDEBUG_LOC) { >> >> Ewww. Legalizer shouldn't have to do this. > > Yeah. The whole debugging thing is gross and does things it shouldn't. > >> Is this code even >> exercised? I don't see ISD::DBG_STOPPOINT ever being generated. If >> not, we should just make the default expansion to its chain. >> > I'm pretty sure I had to do something like this. It's easy to check, I > suppose. If for some reason legalizer still has to do this, this is as good a time as any to fix it. Thanks, Evan > > > -bw > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From echeng at apple.com Tue Feb 24 01:49:20 2009 From: echeng at apple.com (Evan Cheng) Date: Mon, 23 Feb 2009 23:49:20 -0800 Subject: [llvm-commits] [llvm] r65367 - in /llvm/trunk: include/llvm/CodeGen/DwarfWriter.h include/llvm/CodeGen/SelectionDAG.h lib/CodeGen/SelectionDAG/FastISel.cpp lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp test/DebugInfo/2009-01-30-Method.ll test/DebugInfo/deaddebuglabel.ll test/DebugInfo/forwardDecl.ll test/FrontendC++/2006-11-06-StackTrace.cpp test/FrontendC++/2006-11-30-Pubnames.cpp utils/TableGen/AsmWriterEmitter.cpp In-Reply-To: <5C0D3B60-D5E9-4D11-B3D0-AAB91C0244D8@apple.com> References: <200902240235.n1O2ZV0f023730@zion.cs.uiuc.edu> <6973CA87-3B39-4D37-9B64-7C743E0C953D@apple.com> <999DEB7D-3590-4EFF-947D-FA301329C19A@gmail.com> <5C0D3B60-D5E9-4D11-B3D0-AAB91C0244D8@apple.com> Message-ID: Also what about tblgen changes? The code is still in X86GenAsmWriter.inc: if (TAI->doesSupportDebugInformation() && DW->ShouldEmitDwarfDebug()) { const MachineFunction *MF = MI->getParent()->getParent(); DebugLoc CurDL = MI->getDebugLoc(); if (!CurDL.isUnknown()) { static DebugLocTuple PrevDLT(~0U, ~0U, ~0U); DebugLocTuple CurDLT = MF->getDebugLocTuple(CurDL); if (PrevDLT.Src != ~0U && PrevDLT != CurDLT) printLabel(DW->RecordSourceLine(CurDLT.Line, CurDLT.Col, CurDLT.Src)); PrevDLT = CurDLT; } } This should not be run when "fast", right? While we are at it, it looks like this code should be simplified. If TAI->doesSupportDebugInformation() is false, DW- >ShouldEmitDwarfDebug() should not return true. That means only the later check is needed? Also, please make MF AsmPrinter class ivar so we can eliminate this: const MachineFunction *MF = MI->getParent()->getParent(); Evan On Feb 23, 2009, at 11:19 PM, Evan Cheng wrote: > > On Feb 23, 2009, at 11:11 PM, Bill Wendling wrote: > >> On Feb 23, 2009, at 10:20 PM, Evan Cheng wrote: >> >>> On Feb 23, 2009, at 6:35 PM, Bill Wendling wrote: >>> >>>> - >>>> + >>>> + /// FastCodeGen - True if generating code via the "fast" isel. >>>> + /// >>>> + bool FastCodeGen; >>>> public: >>>> static char ID; // Pass identification, replacement for typeid >>>> >>>> @@ -104,6 +107,9 @@ >>>> /// ShouldEmitDwarfDebug - Returns true if Dwarf debugging >>>> declarations should >>>> /// be emitted. >>>> bool ShouldEmitDwarfDebug() const; >>>> + >>>> + bool getFastCodeGen() const { return FastCodeGen; } >>>> + void setFastCodeGen(bool Fast) { FastCodeGen = Fast; } >>>> }; >>> >>> Bill, is this necessary? See LLVMTargetMachine.cpp: >>> >>> case TargetMachine::AssemblyFile: >>> if (addAssemblyEmitter(PM, Fast, Out)) >>> return FileModel::Error; >>> >>> It's passing in "Fast". >>> >> Possibly? Though the code is weird. Here's the X86 version: >> >> bool X86TargetMachine::addAssemblyEmitter(PassManagerBase &PM, bool >> Fast, >> raw_ostream &Out) { >> assert(AsmPrinterCtor && "AsmPrinter was not linked in"); >> if (AsmPrinterCtor) >> PM.add(AsmPrinterCtor(Out, *this)); >> return false; >> } >> >> Note that the "if" conditional is redundant because of the assert. >> Also, it doesn't use the "Fast" boolean. But I'll look into it. > > Please do. I'd rather "fast" be set at pass initialization time (it's > ugly enough as it is). > >> >> >>>> @@ -1289,9 +1292,8 @@ >>>> >>>> unsigned Line = DSP->getLine(); >>>> unsigned Col = DSP->getColumn(); >>>> - const Function *F = >>>> DAG.getMachineFunction().getFunction(); >>>> >>>> - if (!F->hasFnAttr(Attribute::OptimizeForSize)) { >>>> + if (Fast) { >>>> // A bit self-referential to have DebugLoc on Debug_Loc >>>> nodes, but it >>>> // won't hurt anything. >>>> if (useDEBUG_LOC) { >>> >>> Ewww. Legalizer shouldn't have to do this. >> >> Yeah. The whole debugging thing is gross and does things it >> shouldn't. >> >>> Is this code even >>> exercised? I don't see ISD::DBG_STOPPOINT ever being generated. If >>> not, we should just make the default expansion to its chain. >>> >> I'm pretty sure I had to do something like this. It's easy to >> check, I >> suppose. > > If for some reason legalizer still has to do this, this is as good a > time as any to fix it. > > Thanks, > > Evan > >> >> >> -bw >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From isanbard at gmail.com Tue Feb 24 02:18:23 2009 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 24 Feb 2009 00:18:23 -0800 Subject: [llvm-commits] [llvm] r65367 - in /llvm/trunk: include/llvm/CodeGen/DwarfWriter.h include/llvm/CodeGen/SelectionDAG.h lib/CodeGen/SelectionDAG/FastISel.cpp lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp test/DebugInfo/2009-01-30-Method.ll test/DebugInfo/deaddebuglabel.ll test/DebugInfo/forwardDecl.ll test/FrontendC++/2006-11-06-StackTrace.cpp test/FrontendC++/2006-11-30-Pubnames.cpp utils/TableGen/AsmWriterEmitter.cpp In-Reply-To: References: <200902240235.n1O2ZV0f023730@zion.cs.uiuc.edu> <6973CA87-3B39-4D37-9B64-7C743E0C953D@apple.com> <999DEB7D-3590-4EFF-947D-FA301329C19A@gmail.com> <5C0D3B60-D5E9-4D11-B3D0-AAB91C0244D8@apple.com> Message-ID: On Feb 23, 2009, at 11:49 PM, Evan Cheng wrote: > Also what about tblgen changes? > > The code is still in X86GenAsmWriter.inc: > > if (TAI->doesSupportDebugInformation() && > DW->ShouldEmitDwarfDebug()) { > const MachineFunction *MF = MI->getParent()->getParent(); > DebugLoc CurDL = MI->getDebugLoc(); > > if (!CurDL.isUnknown()) { > static DebugLocTuple PrevDLT(~0U, ~0U, ~0U); > DebugLocTuple CurDLT = MF->getDebugLocTuple(CurDL); > > if (PrevDLT.Src != ~0U && PrevDLT != CurDLT) > printLabel(DW->RecordSourceLine(CurDLT.Line, CurDLT.Col, > CurDLT.Src)); > > PrevDLT = CurDLT; > } > } > > This should not be run when "fast", right? > There should have been a check in there for "fast" already. > While we are at it, it looks like this code should be simplified. If > TAI->doesSupportDebugInformation() is false, DW- >> ShouldEmitDwarfDebug() should not return true. That means only the > later check is needed? > Okay. > Also, please make MF AsmPrinter class ivar so we can eliminate this: > const MachineFunction *MF = MI->getParent()->getParent(); > Okay. -bw From isanbard at gmail.com Tue Feb 24 02:24:54 2009 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 24 Feb 2009 00:24:54 -0800 Subject: [llvm-commits] [llvm] r65367 - in /llvm/trunk: include/llvm/CodeGen/DwarfWriter.h include/llvm/CodeGen/SelectionDAG.h lib/CodeGen/SelectionDAG/FastISel.cpp lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp test/DebugInfo/2009-01-30-Method.ll test/DebugInfo/deaddebuglabel.ll test/DebugInfo/forwardDecl.ll test/FrontendC++/2006-11-06-StackTrace.cpp test/FrontendC++/2006-11-30-Pubnames.cpp utils/TableGen/AsmWriterEmitter.cpp In-Reply-To: References: <200902240235.n1O2ZV0f023730@zion.cs.uiuc.edu> <6973CA87-3B39-4D37-9B64-7C743E0C953D@apple.com> <999DEB7D-3590-4EFF-947D-FA301329C19A@gmail.com> <5C0D3B60-D5E9-4D11-B3D0-AAB91C0244D8@apple.com> Message-ID: On Feb 23, 2009, at 11:49 PM, Evan Cheng wrote: > Also what about tblgen changes? > > The code is still in X86GenAsmWriter.inc: > > if (TAI->doesSupportDebugInformation() && > DW->ShouldEmitDwarfDebug()) { > const MachineFunction *MF = MI->getParent()->getParent(); > DebugLoc CurDL = MI->getDebugLoc(); > > if (!CurDL.isUnknown()) { > static DebugLocTuple PrevDLT(~0U, ~0U, ~0U); > DebugLocTuple CurDLT = MF->getDebugLocTuple(CurDL); > > if (PrevDLT.Src != ~0U && PrevDLT != CurDLT) > printLabel(DW->RecordSourceLine(CurDLT.Line, CurDLT.Col, > CurDLT.Src)); > > PrevDLT = CurDLT; > } > } > > This should not be run when "fast", right? > > While we are at it, it looks like this code should be simplified. If > TAI->doesSupportDebugInformation() is false, DW- >> ShouldEmitDwarfDebug() should not return true. That means only the > later check is needed? > It turns out that both checks are necessary. I get an assert in Alpha if they're not both checked. -bw From isanbard at gmail.com Tue Feb 24 02:30:27 2009 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 24 Feb 2009 08:30:27 -0000 Subject: [llvm-commits] [llvm] r65379 - in /llvm/trunk: include/llvm/CodeGen/ lib/CodeGen/AsmPrinter/ lib/CodeGen/SelectionDAG/ lib/Target/ARM/ lib/Target/ARM/AsmPrinter/ lib/Target/Alpha/ lib/Target/Alpha/AsmPrinter/ lib/Target/CellSPU/ lib/Target/CellSPU/AsmPrinter/ lib/Target/IA64/ lib/Target/Mips/ lib/Target/PIC16/ lib/Target/PowerPC/ lib/Target/PowerPC/AsmPrinter/ lib/Target/Sparc/ lib/Target/Sparc/AsmPrinter/ lib/Target/X86/ lib/Target/X86/AsmPrinter/ lib/Target/XCore/ utils/TableGen/ Message-ID: <200902240830.n1O8UX5d001919@zion.cs.uiuc.edu> Author: void Date: Tue Feb 24 02:30:20 2009 New Revision: 65379 URL: http://llvm.org/viewvc/llvm-project?rev=65379&view=rev Log: Overhaul my earlier submission due to feedback. It's a large patch, but most of them are generic changes. - Use the "fast" flag that's already being passed into the asm printers instead of shoving it into the DwarfWriter. - Instead of calling "MI->getParent()->getParent()" for every MI, set the machine function when calling "runOnMachineFunction" in the asm printers. Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h llvm/trunk/include/llvm/CodeGen/DwarfWriter.h llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp llvm/trunk/lib/Target/ARM/ARM.h llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp llvm/trunk/lib/Target/ARM/ARMTargetMachine.h llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp llvm/trunk/lib/Target/Alpha/Alpha.h llvm/trunk/lib/Target/Alpha/AlphaTargetMachine.cpp llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp llvm/trunk/lib/Target/CellSPU/SPU.h llvm/trunk/lib/Target/CellSPU/SPUTargetMachine.cpp llvm/trunk/lib/Target/IA64/IA64.h llvm/trunk/lib/Target/IA64/IA64AsmPrinter.cpp llvm/trunk/lib/Target/IA64/IA64TargetMachine.cpp llvm/trunk/lib/Target/Mips/Mips.h llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp llvm/trunk/lib/Target/PIC16/PIC16.h llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.h llvm/trunk/lib/Target/PIC16/PIC16TargetMachine.cpp llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp llvm/trunk/lib/Target/PowerPC/PPC.h llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.cpp llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.h llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp llvm/trunk/lib/Target/Sparc/Sparc.h llvm/trunk/lib/Target/Sparc/SparcTargetMachine.cpp llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.h llvm/trunk/lib/Target/X86/X86.h llvm/trunk/lib/Target/X86/X86TargetMachine.cpp llvm/trunk/lib/Target/X86/X86TargetMachine.h llvm/trunk/lib/Target/XCore/XCore.h llvm/trunk/lib/Target/XCore/XCoreAsmPrinter.cpp llvm/trunk/lib/Target/XCore/XCoreTargetMachine.cpp llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=65379&r1=65378&r2=65379&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original) +++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Tue Feb 24 02:30:20 2009 @@ -65,6 +65,8 @@ // Necessary for external weak linkage support std::set ExtWeakSymbols; + /// Fast - Generating code via fast instruction selection. + bool Fast; public: /// Output stream on which we're printing assembly code. /// @@ -82,6 +84,9 @@ /// const TargetRegisterInfo *TRI; + /// The current machine function. + const MachineFunction *MF; + /// Name-mangler for global names. /// Mangler *Mang; @@ -101,7 +106,8 @@ bool IsInTextSection; protected: - AsmPrinter(raw_ostream &o, TargetMachine &TM, const TargetAsmInfo *T); + AsmPrinter(raw_ostream &o, TargetMachine &TM, + const TargetAsmInfo *T, bool F); public: virtual ~AsmPrinter(); Modified: llvm/trunk/include/llvm/CodeGen/DwarfWriter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/DwarfWriter.h?rev=65379&r1=65378&r2=65379&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/DwarfWriter.h (original) +++ llvm/trunk/include/llvm/CodeGen/DwarfWriter.h Tue Feb 24 02:30:20 2009 @@ -49,9 +49,6 @@ /// DwarfException *DE; - /// FastCodeGen - True if generating code via the "fast" isel. - /// - bool FastCodeGen; public: static char ID; // Pass identification, replacement for typeid @@ -107,9 +104,6 @@ /// ShouldEmitDwarfDebug - Returns true if Dwarf debugging declarations should /// be emitted. bool ShouldEmitDwarfDebug() const; - - bool getFastCodeGen() const { return FastCodeGen; } - void setFastCodeGen(bool Fast) { FastCodeGen = Fast; } }; Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=65379&r1=65378&r2=65379&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Tue Feb 24 02:30:20 2009 @@ -37,8 +37,8 @@ char AsmPrinter::ID = 0; AsmPrinter::AsmPrinter(raw_ostream &o, TargetMachine &tm, - const TargetAsmInfo *T) - : MachineFunctionPass(&ID), FunctionNumber(0), O(o), + const TargetAsmInfo *T, bool F) + : MachineFunctionPass(&ID), FunctionNumber(0), Fast(F), O(o), TM(tm), TAI(T), TRI(tm.getRegisterInfo()), IsInTextSection(false) {} Modified: llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp?rev=65379&r1=65378&r2=65379&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp Tue Feb 24 02:30:20 2009 @@ -370,7 +370,6 @@ unsigned Line = Subprogram.getLineNumber(); unsigned LabelID = DW->RecordSourceLine(Line, 0, SrcFile); setCurDebugLoc(DebugLoc::get(MF.getOrCreateDebugLocID(SrcFile, Line, 0))); - DW->setFastCodeGen(true); if (DW->getRecordSourceLineCount() != 1) { const TargetInstrDesc &II = TII.get(TargetInstrInfo::DBG_LABEL); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=65379&r1=65378&r2=65379&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Tue Feb 24 02:30:20 2009 @@ -3915,7 +3915,6 @@ if (Fast) DAG.setRoot(DAG.getLabel(ISD::DBG_LABEL, getCurDebugLoc(), getRoot(), LabelID)); - DW->setFastCodeGen(Fast); } return 0; Modified: llvm/trunk/lib/Target/ARM/ARM.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARM.h?rev=65379&r1=65378&r2=65379&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARM.h (original) +++ llvm/trunk/lib/Target/ARM/ARM.h Tue Feb 24 02:30:20 2009 @@ -89,7 +89,9 @@ } FunctionPass *createARMISelDag(ARMTargetMachine &TM); -FunctionPass *createARMCodePrinterPass(raw_ostream &O, ARMTargetMachine &TM); +FunctionPass *createARMCodePrinterPass(raw_ostream &O, + ARMTargetMachine &TM, + bool Fast); FunctionPass *createARMCodeEmitterPass(ARMTargetMachine &TM, MachineCodeEmitter &MCE); FunctionPass *createARMLoadStoreOptimizationPass(); Modified: llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp?rev=65379&r1=65378&r2=65379&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp Tue Feb 24 02:30:20 2009 @@ -157,7 +157,7 @@ // Output assembly language. assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(Out, *this)); + PM.add(AsmPrinterCtor(Out, *this, Fast)); return false; } @@ -174,7 +174,7 @@ if (DumpAsm) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(errs(), *this)); + PM.add(AsmPrinterCtor(errs(), *this, Fast)); } return false; @@ -187,7 +187,7 @@ if (DumpAsm) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(errs(), *this)); + PM.add(AsmPrinterCtor(errs(), *this, Fast)); } return false; Modified: llvm/trunk/lib/Target/ARM/ARMTargetMachine.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMTargetMachine.h?rev=65379&r1=65378&r2=65379&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMTargetMachine.h (original) +++ llvm/trunk/lib/Target/ARM/ARMTargetMachine.h Tue Feb 24 02:30:20 2009 @@ -40,7 +40,8 @@ // To avoid having target depend on the asmprinter stuff libraries, asmprinter // set this functions to ctor pointer at startup time if they are linked in. typedef FunctionPass *(*AsmPrinterCtorFn)(raw_ostream &o, - ARMTargetMachine &tm); + ARMTargetMachine &tm, + bool fast); static AsmPrinterCtorFn AsmPrinterCtor; public: Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp?rev=65379&r1=65378&r2=65379&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Tue Feb 24 02:30:20 2009 @@ -42,13 +42,7 @@ STATISTIC(EmittedInsts, "Number of machine instrs printed"); namespace { - struct VISIBILITY_HIDDEN ARMAsmPrinter : public AsmPrinter { - ARMAsmPrinter(raw_ostream &O, TargetMachine &TM, const TargetAsmInfo *T) - : AsmPrinter(O, TM, T), DW(0), MMI(NULL), AFI(NULL), MCP(NULL), - InCPMode(false) { - Subtarget = &TM.getSubtarget(); - } - + class VISIBILITY_HIDDEN ARMAsmPrinter : public AsmPrinter { DwarfWriter *DW; MachineModuleInfo *MMI; @@ -85,7 +79,14 @@ /// True if asm printer is printing a series of CONSTPOOL_ENTRY. bool InCPMode; - + public: + ARMAsmPrinter(raw_ostream &O, TargetMachine &TM, + const TargetAsmInfo *T, bool F) + : AsmPrinter(O, TM, T, F), DW(0), MMI(NULL), AFI(NULL), MCP(NULL), + InCPMode(false) { + Subtarget = &TM.getSubtarget(); + } + virtual const char *getPassName() const { return "ARM Assembly Printer"; } @@ -183,6 +184,8 @@ /// method to print assembly for each instruction. /// bool ARMAsmPrinter::runOnMachineFunction(MachineFunction &MF) { + this->MF = &MF; + AFI = MF.getInfo(); MCP = MF.getConstantPool(); @@ -1039,8 +1042,9 @@ /// regardless of whether the function is in SSA form. /// FunctionPass *llvm::createARMCodePrinterPass(raw_ostream &o, - ARMTargetMachine &tm) { - return new ARMAsmPrinter(o, tm, tm.getTargetAsmInfo()); + ARMTargetMachine &tm, + bool fast) { + return new ARMAsmPrinter(o, tm, tm.getTargetAsmInfo(), fast); } namespace { Modified: llvm/trunk/lib/Target/Alpha/Alpha.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/Alpha.h?rev=65379&r1=65378&r2=65379&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/Alpha.h (original) +++ llvm/trunk/lib/Target/Alpha/Alpha.h Tue Feb 24 02:30:20 2009 @@ -25,7 +25,8 @@ FunctionPass *createAlphaISelDag(AlphaTargetMachine &TM); FunctionPass *createAlphaCodePrinterPass(raw_ostream &OS, - TargetMachine &TM); + TargetMachine &TM, + bool Fast); FunctionPass *createAlphaPatternInstructionSelector(TargetMachine &TM); FunctionPass *createAlphaCodeEmitterPass(AlphaTargetMachine &TM, MachineCodeEmitter &MCE); Modified: llvm/trunk/lib/Target/Alpha/AlphaTargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaTargetMachine.cpp?rev=65379&r1=65378&r2=65379&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AlphaTargetMachine.cpp (original) +++ llvm/trunk/lib/Target/Alpha/AlphaTargetMachine.cpp Tue Feb 24 02:30:20 2009 @@ -88,14 +88,14 @@ bool AlphaTargetMachine::addAssemblyEmitter(PassManagerBase &PM, bool Fast, raw_ostream &Out) { PM.add(createAlphaLLRPPass(*this)); - PM.add(createAlphaCodePrinterPass(Out, *this)); + PM.add(createAlphaCodePrinterPass(Out, *this, Fast)); return false; } bool AlphaTargetMachine::addCodeEmitter(PassManagerBase &PM, bool Fast, bool DumpAsm, MachineCodeEmitter &MCE) { PM.add(createAlphaCodeEmitterPass(*this, MCE)); if (DumpAsm) - PM.add(createAlphaCodePrinterPass(errs(), *this)); + PM.add(createAlphaCodePrinterPass(errs(), *this, Fast)); return false; } bool AlphaTargetMachine::addSimpleCodeEmitter(PassManagerBase &PM, Modified: llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp?rev=65379&r1=65378&r2=65379&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp Tue Feb 24 02:30:20 2009 @@ -33,13 +33,12 @@ namespace { struct VISIBILITY_HIDDEN AlphaAsmPrinter : public AsmPrinter { - /// Unique incrementer for label values for referencing Global values. /// - AlphaAsmPrinter(raw_ostream &o, TargetMachine &tm, const TargetAsmInfo *T) - : AsmPrinter(o, tm, T) { - } + AlphaAsmPrinter(raw_ostream &o, TargetMachine &tm, + const TargetAsmInfo *T, bool F) + : AsmPrinter(o, tm, T, F) {} virtual const char *getPassName() const { return "Alpha Assembly Printer"; @@ -68,8 +67,9 @@ /// regardless of whether the function is in SSA form. /// FunctionPass *llvm::createAlphaCodePrinterPass(raw_ostream &o, - TargetMachine &tm) { - return new AlphaAsmPrinter(o, tm, tm.getTargetAsmInfo()); + TargetMachine &tm, + bool fast) { + return new AlphaAsmPrinter(o, tm, tm.getTargetAsmInfo(), fast); } #include "AlphaGenAsmWriter.inc" @@ -139,6 +139,8 @@ /// method to print assembly for each instruction. /// bool AlphaAsmPrinter::runOnMachineFunction(MachineFunction &MF) { + this->MF = &MF; + SetupMachineFunction(MF); O << "\n\n"; Modified: llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp?rev=65379&r1=65378&r2=65379&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp Tue Feb 24 02:30:20 2009 @@ -45,13 +45,12 @@ const std::string bss_section(".bss"); - struct VISIBILITY_HIDDEN SPUAsmPrinter : public AsmPrinter { + class VISIBILITY_HIDDEN SPUAsmPrinter : public AsmPrinter { std::set FnStubs, GVStubs; - - SPUAsmPrinter(raw_ostream &O, TargetMachine &TM, const TargetAsmInfo *T) : - AsmPrinter(O, TM, T) - { - } + public: + SPUAsmPrinter(raw_ostream &O, TargetMachine &TM, + const TargetAsmInfo *T, bool F) : + AsmPrinter(O, TM, T, F) {} virtual const char *getPassName() const { return "STI CBEA SPU Assembly Printer"; @@ -285,17 +284,13 @@ }; /// LinuxAsmPrinter - SPU assembly printer, customized for Linux - struct VISIBILITY_HIDDEN LinuxAsmPrinter : public SPUAsmPrinter { - + class VISIBILITY_HIDDEN LinuxAsmPrinter : public SPUAsmPrinter { DwarfWriter *DW; MachineModuleInfo *MMI; - + public: LinuxAsmPrinter(raw_ostream &O, SPUTargetMachine &TM, - const TargetAsmInfo *T) : - SPUAsmPrinter(O, TM, T), - DW(0), - MMI(0) - { } + const TargetAsmInfo *T, bool F) + : SPUAsmPrinter(O, TM, T, F), DW(0), MMI(0) {} virtual const char *getPassName() const { return "STI CBEA SPU Assembly Printer"; @@ -427,6 +422,8 @@ bool LinuxAsmPrinter::runOnMachineFunction(MachineFunction &MF) { + this->MF = &MF; + SetupMachineFunction(MF); O << "\n\n"; @@ -613,6 +610,7 @@ /// that the Linux SPU assembler can deal with. /// FunctionPass *llvm::createSPUAsmPrinterPass(raw_ostream &o, - SPUTargetMachine &tm) { - return new LinuxAsmPrinter(o, tm, tm.getTargetAsmInfo()); + SPUTargetMachine &tm, + bool fast) { + return new LinuxAsmPrinter(o, tm, tm.getTargetAsmInfo(), fast); } Modified: llvm/trunk/lib/Target/CellSPU/SPU.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPU.h?rev=65379&r1=65378&r2=65379&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/SPU.h (original) +++ llvm/trunk/lib/Target/CellSPU/SPU.h Tue Feb 24 02:30:20 2009 @@ -23,7 +23,9 @@ class raw_ostream; FunctionPass *createSPUISelDag(SPUTargetMachine &TM); - FunctionPass *createSPUAsmPrinterPass(raw_ostream &o, SPUTargetMachine &tm); + FunctionPass *createSPUAsmPrinterPass(raw_ostream &o, + SPUTargetMachine &tm, + bool fast); /*--== Utility functions/predicates/etc used all over the place: --==*/ //! Predicate test for a signed 10-bit value Modified: llvm/trunk/lib/Target/CellSPU/SPUTargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUTargetMachine.cpp?rev=65379&r1=65378&r2=65379&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/SPUTargetMachine.cpp (original) +++ llvm/trunk/lib/Target/CellSPU/SPUTargetMachine.cpp Tue Feb 24 02:30:20 2009 @@ -90,6 +90,6 @@ bool SPUTargetMachine::addAssemblyEmitter(PassManagerBase &PM, bool Fast, raw_ostream &Out) { - PM.add(createSPUAsmPrinterPass(Out, *this)); + PM.add(createSPUAsmPrinterPass(Out, *this, Fast)); return false; } Modified: llvm/trunk/lib/Target/IA64/IA64.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64.h?rev=65379&r1=65378&r2=65379&view=diff ============================================================================== --- llvm/trunk/lib/Target/IA64/IA64.h (original) +++ llvm/trunk/lib/Target/IA64/IA64.h Tue Feb 24 02:30:20 2009 @@ -35,7 +35,9 @@ /// using the given target machine description. This should work /// regardless of whether the function is in SSA form. /// -FunctionPass *createIA64CodePrinterPass(raw_ostream &o, IA64TargetMachine &tm); +FunctionPass *createIA64CodePrinterPass(raw_ostream &o, + IA64TargetMachine &tm, + bool fast); } // End llvm namespace Modified: llvm/trunk/lib/Target/IA64/IA64AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64AsmPrinter.cpp?rev=65379&r1=65378&r2=65379&view=diff ============================================================================== --- llvm/trunk/lib/Target/IA64/IA64AsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/IA64/IA64AsmPrinter.cpp Tue Feb 24 02:30:20 2009 @@ -34,12 +34,12 @@ STATISTIC(EmittedInsts, "Number of machine instrs printed"); namespace { - struct IA64AsmPrinter : public AsmPrinter { + class IA64AsmPrinter : public AsmPrinter { std::set ExternalFunctionNames, ExternalObjectNames; - - IA64AsmPrinter(raw_ostream &O, TargetMachine &TM, const TargetAsmInfo *T) - : AsmPrinter(O, TM, T) { - } + public: + IA64AsmPrinter(raw_ostream &O, TargetMachine &TM, + const TargetAsmInfo *T, bool F) + : AsmPrinter(O, TM, T, F) {} virtual const char *getPassName() const { return "IA64 Assembly Printer"; @@ -124,6 +124,8 @@ /// method to print assembly for each instruction. /// bool IA64AsmPrinter::runOnMachineFunction(MachineFunction &MF) { + this->MF = &MF; + SetupMachineFunction(MF); O << "\n\n"; @@ -365,6 +367,7 @@ /// the given target machine description. /// FunctionPass *llvm::createIA64CodePrinterPass(raw_ostream &o, - IA64TargetMachine &tm) { - return new IA64AsmPrinter(o, tm, tm.getTargetAsmInfo()); + IA64TargetMachine &tm, + bool fast) { + return new IA64AsmPrinter(o, tm, tm.getTargetAsmInfo(), fast); } Modified: llvm/trunk/lib/Target/IA64/IA64TargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64TargetMachine.cpp?rev=65379&r1=65378&r2=65379&view=diff ============================================================================== --- llvm/trunk/lib/Target/IA64/IA64TargetMachine.cpp (original) +++ llvm/trunk/lib/Target/IA64/IA64TargetMachine.cpp Tue Feb 24 02:30:20 2009 @@ -84,7 +84,7 @@ } bool IA64TargetMachine::addAssemblyEmitter(PassManagerBase &PM, bool Fast, raw_ostream &Out) { - PM.add(createIA64CodePrinterPass(Out, *this)); + PM.add(createIA64CodePrinterPass(Out, *this, Fast)); return false; } Modified: llvm/trunk/lib/Target/Mips/Mips.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/Mips.h?rev=65379&r1=65378&r2=65379&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/Mips.h (original) +++ llvm/trunk/lib/Target/Mips/Mips.h Tue Feb 24 02:30:20 2009 @@ -24,7 +24,8 @@ FunctionPass *createMipsISelDag(MipsTargetMachine &TM); FunctionPass *createMipsDelaySlotFillerPass(MipsTargetMachine &TM); FunctionPass *createMipsCodePrinterPass(raw_ostream &OS, - MipsTargetMachine &TM); + MipsTargetMachine &TM, + bool Fast); } // end namespace llvm; // Defines symbolic names for Mips registers. This defines a mapping from Modified: llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp?rev=65379&r1=65378&r2=65379&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp Tue Feb 24 02:30:20 2009 @@ -46,13 +46,12 @@ STATISTIC(EmittedInsts, "Number of machine instrs printed"); namespace { - struct VISIBILITY_HIDDEN MipsAsmPrinter : public AsmPrinter { - + class VISIBILITY_HIDDEN MipsAsmPrinter : public AsmPrinter { const MipsSubtarget *Subtarget; - + public: MipsAsmPrinter(raw_ostream &O, MipsTargetMachine &TM, - const TargetAsmInfo *T): - AsmPrinter(O, TM, T) { + const TargetAsmInfo *T, bool F) + : AsmPrinter(O, TM, T, F) { Subtarget = &TM.getSubtarget(); } @@ -91,9 +90,9 @@ /// using the given target machine description. This should work /// regardless of whether the function is in SSA form. FunctionPass *llvm::createMipsCodePrinterPass(raw_ostream &o, - MipsTargetMachine &tm) -{ - return new MipsAsmPrinter(o, tm, tm.getTargetAsmInfo()); + MipsTargetMachine &tm, + bool fast) { + return new MipsAsmPrinter(o, tm, tm.getTargetAsmInfo(), fast); } //===----------------------------------------------------------------------===// @@ -266,6 +265,8 @@ bool MipsAsmPrinter:: runOnMachineFunction(MachineFunction &MF) { + this->MF = &MF; + SetupMachineFunction(MF); // Print out constants referenced by the function Modified: llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp?rev=65379&r1=65378&r2=65379&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp Tue Feb 24 02:30:20 2009 @@ -128,6 +128,6 @@ raw_ostream &Out) { // Output assembly language. - PM.add(createMipsCodePrinterPass(Out, *this)); + PM.add(createMipsCodePrinterPass(Out, *this, Fast)); return false; } Modified: llvm/trunk/lib/Target/PIC16/PIC16.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16.h?rev=65379&r1=65378&r2=65379&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16.h (original) +++ llvm/trunk/lib/Target/PIC16/PIC16.h Tue Feb 24 02:30:20 2009 @@ -74,7 +74,8 @@ FunctionPass *createPIC16ISelDag(PIC16TargetMachine &TM); FunctionPass *createPIC16CodePrinterPass(raw_ostream &OS, - PIC16TargetMachine &TM); + PIC16TargetMachine &TM, + bool Fast); } // end namespace llvm; // Defines symbolic names for PIC16 registers. This defines a mapping from Modified: llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp?rev=65379&r1=65378&r2=65379&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp Tue Feb 24 02:30:20 2009 @@ -90,6 +90,8 @@ /// method to print assembly for each instruction. /// bool PIC16AsmPrinter::runOnMachineFunction(MachineFunction &MF) { + this->MF = &MF; + // This calls the base class function required to be called at beginning // of runOnMachineFunction. SetupMachineFunction(MF); @@ -133,8 +135,9 @@ /// regardless of whether the function is in SSA form. /// FunctionPass *llvm::createPIC16CodePrinterPass(raw_ostream &o, - PIC16TargetMachine &tm) { - return new PIC16AsmPrinter(o, tm, tm.getTargetAsmInfo()); + PIC16TargetMachine &tm, + bool fast) { + return new PIC16AsmPrinter(o, tm, tm.getTargetAsmInfo(), fast); } void PIC16AsmPrinter::printOperand(const MachineInstr *MI, int opNum) { Modified: llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.h?rev=65379&r1=65378&r2=65379&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.h (original) +++ llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.h Tue Feb 24 02:30:20 2009 @@ -24,8 +24,9 @@ namespace llvm { struct VISIBILITY_HIDDEN PIC16AsmPrinter : public AsmPrinter { - PIC16AsmPrinter(raw_ostream &O, TargetMachine &TM, const TargetAsmInfo *T) - : AsmPrinter(O, TM, T) { + PIC16AsmPrinter(raw_ostream &O, TargetMachine &TM, + const TargetAsmInfo *T, bool F) + : AsmPrinter(O, TM, T, F) { CurrentBankselLabelInBasicBlock = ""; IsRomData = false; } Modified: llvm/trunk/lib/Target/PIC16/PIC16TargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16TargetMachine.cpp?rev=65379&r1=65378&r2=65379&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16TargetMachine.cpp (original) +++ llvm/trunk/lib/Target/PIC16/PIC16TargetMachine.cpp Tue Feb 24 02:30:20 2009 @@ -64,7 +64,7 @@ bool PIC16TargetMachine:: addAssemblyEmitter(PassManagerBase &PM, bool Fast, raw_ostream &Out) { // Output assembly language. - PM.add(createPIC16CodePrinterPass(Out, *this)); + PM.add(createPIC16CodePrinterPass(Out, *this, Fast)); return false; } Modified: llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp?rev=65379&r1=65378&r2=65379&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp Tue Feb 24 02:30:20 2009 @@ -49,13 +49,15 @@ STATISTIC(EmittedInsts, "Number of machine instrs printed"); namespace { - struct VISIBILITY_HIDDEN PPCAsmPrinter : public AsmPrinter { + class VISIBILITY_HIDDEN PPCAsmPrinter : public AsmPrinter { + protected: StringSet<> FnStubs, GVStubs, HiddenGVStubs; const PPCSubtarget &Subtarget; - - PPCAsmPrinter(raw_ostream &O, TargetMachine &TM, const TargetAsmInfo *T) - : AsmPrinter(O, TM, T), Subtarget(TM.getSubtarget()) { - } + public: + PPCAsmPrinter(raw_ostream &O, TargetMachine &TM, + const TargetAsmInfo *T, bool F) + : AsmPrinter(O, TM, T, F), + Subtarget(TM.getSubtarget()) {} virtual const char *getPassName() const { return "PowerPC Assembly Printer"; @@ -291,14 +293,13 @@ }; /// PPCLinuxAsmPrinter - PowerPC assembly printer, customized for Linux - struct VISIBILITY_HIDDEN PPCLinuxAsmPrinter : public PPCAsmPrinter { + class VISIBILITY_HIDDEN PPCLinuxAsmPrinter : public PPCAsmPrinter { DwarfWriter *DW; MachineModuleInfo *MMI; - + public: PPCLinuxAsmPrinter(raw_ostream &O, PPCTargetMachine &TM, - const TargetAsmInfo *T) - : PPCAsmPrinter(O, TM, T), DW(0), MMI(0) { - } + const TargetAsmInfo *T, bool F) + : PPCAsmPrinter(O, TM, T, F), DW(0), MMI(0) {} virtual const char *getPassName() const { return "Linux PPC Assembly Printer"; @@ -320,15 +321,14 @@ /// PPCDarwinAsmPrinter - PowerPC assembly printer, customized for Darwin/Mac /// OS X - struct VISIBILITY_HIDDEN PPCDarwinAsmPrinter : public PPCAsmPrinter { - + class VISIBILITY_HIDDEN PPCDarwinAsmPrinter : public PPCAsmPrinter { DwarfWriter *DW; MachineModuleInfo *MMI; raw_ostream &OS; + public: PPCDarwinAsmPrinter(raw_ostream &O, PPCTargetMachine &TM, - const TargetAsmInfo *T) - : PPCAsmPrinter(O, TM, T), DW(0), MMI(0), OS(O) { - } + const TargetAsmInfo *T, bool F) + : PPCAsmPrinter(O, TM, T, F), DW(0), MMI(0), OS(O) {} virtual const char *getPassName() const { return "Darwin PPC Assembly Printer"; @@ -571,6 +571,7 @@ /// method to print assembly for each instruction. /// bool PPCLinuxAsmPrinter::runOnMachineFunction(MachineFunction &MF) { + this->MF = &MF; SetupMachineFunction(MF); O << "\n\n"; @@ -764,6 +765,8 @@ /// method to print assembly for each instruction. /// bool PPCDarwinAsmPrinter::runOnMachineFunction(MachineFunction &MF) { + this->MF = &MF; + SetupMachineFunction(MF); O << "\n\n"; @@ -1146,13 +1149,14 @@ /// Darwin assembler can deal with. /// FunctionPass *llvm::createPPCAsmPrinterPass(raw_ostream &o, - PPCTargetMachine &tm) { + PPCTargetMachine &tm, + bool fast) { const PPCSubtarget *Subtarget = &tm.getSubtarget(); if (Subtarget->isDarwin()) { - return new PPCDarwinAsmPrinter(o, tm, tm.getTargetAsmInfo()); + return new PPCDarwinAsmPrinter(o, tm, tm.getTargetAsmInfo(), fast); } else { - return new PPCLinuxAsmPrinter(o, tm, tm.getTargetAsmInfo()); + return new PPCLinuxAsmPrinter(o, tm, tm.getTargetAsmInfo(), fast); } } Modified: llvm/trunk/lib/Target/PowerPC/PPC.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPC.h?rev=65379&r1=65378&r2=65379&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPC.h (original) +++ llvm/trunk/lib/Target/PowerPC/PPC.h Tue Feb 24 02:30:20 2009 @@ -27,7 +27,8 @@ FunctionPass *createPPCBranchSelectionPass(); FunctionPass *createPPCISelDag(PPCTargetMachine &TM); FunctionPass *createPPCAsmPrinterPass(raw_ostream &OS, - PPCTargetMachine &TM); + PPCTargetMachine &TM, + bool Fast); FunctionPass *createPPCCodeEmitterPass(PPCTargetMachine &TM, MachineCodeEmitter &MCE); } // end namespace llvm; Modified: llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.cpp?rev=65379&r1=65378&r2=65379&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.cpp Tue Feb 24 02:30:20 2009 @@ -146,7 +146,7 @@ raw_ostream &Out) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(Out, *this)); + PM.add(AsmPrinterCtor(Out, *this, Fast)); return false; } @@ -176,7 +176,7 @@ if (DumpAsm) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(errs(), *this)); + PM.add(AsmPrinterCtor(errs(), *this, Fast)); } return false; @@ -189,7 +189,7 @@ if (DumpAsm) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(errs(), *this)); + PM.add(AsmPrinterCtor(errs(), *this, Fast)); } return false; Modified: llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.h?rev=65379&r1=65378&r2=65379&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.h (original) +++ llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.h Tue Feb 24 02:30:20 2009 @@ -45,7 +45,8 @@ // To avoid having target depend on the asmprinter stuff libraries, asmprinter // set this functions to ctor pointer at startup time if they are linked in. typedef FunctionPass *(*AsmPrinterCtorFn)(raw_ostream &o, - PPCTargetMachine &tm); + PPCTargetMachine &tm, + bool fast); static AsmPrinterCtorFn AsmPrinterCtor; public: Modified: llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp?rev=65379&r1=65378&r2=65379&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp Tue Feb 24 02:30:20 2009 @@ -40,17 +40,17 @@ STATISTIC(EmittedInsts, "Number of machine instrs printed"); namespace { - struct VISIBILITY_HIDDEN SparcAsmPrinter : public AsmPrinter { - SparcAsmPrinter(raw_ostream &O, TargetMachine &TM, const TargetAsmInfo *T) - : AsmPrinter(O, TM, T) { - } - + class VISIBILITY_HIDDEN SparcAsmPrinter : public AsmPrinter { /// We name each basic block in a Function with a unique number, so /// that we can consistently refer to them later. This is cleared /// at the beginning of each call to runOnMachineFunction(). /// typedef std::map ValueMapTy; ValueMapTy NumberForBB; + public: + SparcAsmPrinter(raw_ostream &O, TargetMachine &TM, + const TargetAsmInfo *T, bool F) + : AsmPrinter(O, TM, T, F) {} virtual const char *getPassName() const { return "Sparc Assembly Printer"; @@ -81,14 +81,17 @@ /// regardless of whether the function is in SSA form. /// FunctionPass *llvm::createSparcCodePrinterPass(raw_ostream &o, - TargetMachine &tm) { - return new SparcAsmPrinter(o, tm, tm.getTargetAsmInfo()); + TargetMachine &tm, + bool fast) { + return new SparcAsmPrinter(o, tm, tm.getTargetAsmInfo(), fast); } /// runOnMachineFunction - This uses the printInstruction() /// method to print assembly for each instruction. /// bool SparcAsmPrinter::runOnMachineFunction(MachineFunction &MF) { + this->MF = &MF; + SetupMachineFunction(MF); // Print out constants referenced by the function Modified: llvm/trunk/lib/Target/Sparc/Sparc.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/Sparc.h?rev=65379&r1=65378&r2=65379&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/Sparc.h (original) +++ llvm/trunk/lib/Target/Sparc/Sparc.h Tue Feb 24 02:30:20 2009 @@ -24,7 +24,8 @@ class raw_ostream; FunctionPass *createSparcISelDag(SparcTargetMachine &TM); - FunctionPass *createSparcCodePrinterPass(raw_ostream &OS, TargetMachine &TM); + FunctionPass *createSparcCodePrinterPass(raw_ostream &OS, + TargetMachine &TM, bool Fast); FunctionPass *createSparcDelaySlotFillerPass(TargetMachine &TM); FunctionPass *createSparcFPMoverPass(TargetMachine &TM); } // end namespace llvm; Modified: llvm/trunk/lib/Target/Sparc/SparcTargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcTargetMachine.cpp?rev=65379&r1=65378&r2=65379&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcTargetMachine.cpp (original) +++ llvm/trunk/lib/Target/Sparc/SparcTargetMachine.cpp Tue Feb 24 02:30:20 2009 @@ -85,6 +85,6 @@ bool SparcTargetMachine::addAssemblyEmitter(PassManagerBase &PM, bool Fast, raw_ostream &Out) { // Output assembly language. - PM.add(createSparcCodePrinterPass(Out, *this)); + PM.add(createSparcCodePrinterPass(Out, *this, Fast)); return false; } Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h?rev=65379&r1=65378&r2=65379&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h Tue Feb 24 02:30:20 2009 @@ -28,15 +28,14 @@ struct MachineJumpTableInfo; -struct VISIBILITY_HIDDEN X86ATTAsmPrinter : public AsmPrinter { - MachineFunction *MF; +class VISIBILITY_HIDDEN X86ATTAsmPrinter : public AsmPrinter { DwarfWriter *DW; MachineModuleInfo *MMI; const X86Subtarget *Subtarget; - + public: X86ATTAsmPrinter(raw_ostream &O, X86TargetMachine &TM, - const TargetAsmInfo *T) - : AsmPrinter(O, TM, T), DW(0), MMI(0) { + const TargetAsmInfo *T, bool F) + : AsmPrinter(O, TM, T, F), DW(0), MMI(0) { Subtarget = &TM.getSubtarget(); } Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp?rev=65379&r1=65378&r2=65379&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp Tue Feb 24 02:30:20 2009 @@ -24,13 +24,14 @@ /// machine description. /// FunctionPass *llvm::createX86CodePrinterPass(raw_ostream &o, - X86TargetMachine &tm) { + X86TargetMachine &tm, + bool fast) { const X86Subtarget *Subtarget = &tm.getSubtarget(); if (Subtarget->isFlavorIntel()) { - return new X86IntelAsmPrinter(o, tm, tm.getTargetAsmInfo()); + return new X86IntelAsmPrinter(o, tm, tm.getTargetAsmInfo(), fast); } else { - return new X86ATTAsmPrinter(o, tm, tm.getTargetAsmInfo()); + return new X86ATTAsmPrinter(o, tm, tm.getTargetAsmInfo(), fast); } } Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp?rev=65379&r1=65378&r2=65379&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp Tue Feb 24 02:30:20 2009 @@ -122,6 +122,7 @@ /// method to print assembly for each instruction. /// bool X86IntelAsmPrinter::runOnMachineFunction(MachineFunction &MF) { + this->MF = &MF; SetupMachineFunction(MF); O << "\n\n"; Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.h?rev=65379&r1=65378&r2=65379&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.h (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.h Tue Feb 24 02:30:20 2009 @@ -26,9 +26,8 @@ struct VISIBILITY_HIDDEN X86IntelAsmPrinter : public AsmPrinter { X86IntelAsmPrinter(raw_ostream &O, X86TargetMachine &TM, - const TargetAsmInfo *T) - : AsmPrinter(O, TM, T) { - } + const TargetAsmInfo *T, bool F) + : AsmPrinter(O, TM, T, F) {} virtual const char *getPassName() const { return "X86 Intel-Style Assembly Printer"; Modified: llvm/trunk/lib/Target/X86/X86.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86.h?rev=65379&r1=65378&r2=65379&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86.h (original) +++ llvm/trunk/lib/Target/X86/X86.h Tue Feb 24 02:30:20 2009 @@ -42,7 +42,9 @@ /// assembly code for a MachineFunction to the given output stream, /// using the given target machine description. /// -FunctionPass *createX86CodePrinterPass(raw_ostream &o, X86TargetMachine &tm); +FunctionPass *createX86CodePrinterPass(raw_ostream &o, + X86TargetMachine &tm, + bool fast); /// createX86CodeEmitterPass - Return a pass that emits the collected X86 code /// to the specified MCE object. Modified: llvm/trunk/lib/Target/X86/X86TargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetMachine.cpp?rev=65379&r1=65378&r2=65379&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86TargetMachine.cpp (original) +++ llvm/trunk/lib/Target/X86/X86TargetMachine.cpp Tue Feb 24 02:30:20 2009 @@ -210,7 +210,7 @@ raw_ostream &Out) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(Out, *this)); + PM.add(AsmPrinterCtor(Out, *this, Fast)); return false; } @@ -236,7 +236,7 @@ if (DumpAsm) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(errs(), *this)); + PM.add(AsmPrinterCtor(errs(), *this, Fast)); } return false; @@ -248,7 +248,7 @@ if (DumpAsm) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(errs(), *this)); + PM.add(AsmPrinterCtor(errs(), *this, Fast)); } return false; Modified: llvm/trunk/lib/Target/X86/X86TargetMachine.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetMachine.h?rev=65379&r1=65378&r2=65379&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86TargetMachine.h (original) +++ llvm/trunk/lib/Target/X86/X86TargetMachine.h Tue Feb 24 02:30:20 2009 @@ -44,7 +44,8 @@ // To avoid having target depend on the asmprinter stuff libraries, asmprinter // set this functions to ctor pointer at startup time if they are linked in. typedef FunctionPass *(*AsmPrinterCtorFn)(raw_ostream &o, - X86TargetMachine &tm); + X86TargetMachine &tm, + bool fast); static AsmPrinterCtorFn AsmPrinterCtor; public: Modified: llvm/trunk/lib/Target/XCore/XCore.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCore.h?rev=65379&r1=65378&r2=65379&view=diff ============================================================================== --- llvm/trunk/lib/Target/XCore/XCore.h (original) +++ llvm/trunk/lib/Target/XCore/XCore.h Tue Feb 24 02:30:20 2009 @@ -23,7 +23,8 @@ FunctionPass *createXCoreISelDag(XCoreTargetMachine &TM); FunctionPass *createXCoreCodePrinterPass(raw_ostream &OS, - XCoreTargetMachine &TM); + XCoreTargetMachine &TM, + bool Fast); } // end namespace llvm; // Defines symbolic names for XCore registers. This defines a mapping from Modified: llvm/trunk/lib/Target/XCore/XCoreAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreAsmPrinter.cpp?rev=65379&r1=65378&r2=65379&view=diff ============================================================================== --- llvm/trunk/lib/Target/XCore/XCoreAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/XCore/XCoreAsmPrinter.cpp Tue Feb 24 02:30:20 2009 @@ -53,14 +53,14 @@ cl::init(8)); namespace { - struct VISIBILITY_HIDDEN XCoreAsmPrinter : public AsmPrinter { - XCoreAsmPrinter(raw_ostream &O, XCoreTargetMachine &TM, - const TargetAsmInfo *T) - : AsmPrinter(O, TM, T), DW(0), - Subtarget(*TM.getSubtargetImpl()) { } - + class VISIBILITY_HIDDEN XCoreAsmPrinter : public AsmPrinter { DwarfWriter *DW; const XCoreSubtarget &Subtarget; + public: + XCoreAsmPrinter(raw_ostream &O, XCoreTargetMachine &TM, + const TargetAsmInfo *T, bool F) + : AsmPrinter(O, TM, T, F), DW(0), + Subtarget(*TM.getSubtargetImpl()) {} virtual const char *getPassName() const { return "XCore Assembly Printer"; @@ -104,8 +104,9 @@ /// regardless of whether the function is in SSA form. /// FunctionPass *llvm::createXCoreCodePrinterPass(raw_ostream &o, - XCoreTargetMachine &tm) { - return new XCoreAsmPrinter(o, tm, tm.getTargetAsmInfo()); + XCoreTargetMachine &tm, + bool fast) { + return new XCoreAsmPrinter(o, tm, tm.getTargetAsmInfo(), fast); } // PrintEscapedString - Print each character of the specified string, escaping @@ -293,6 +294,8 @@ /// bool XCoreAsmPrinter::runOnMachineFunction(MachineFunction &MF) { + this->MF = &MF; + SetupMachineFunction(MF); // Print out constants referenced by the function Modified: llvm/trunk/lib/Target/XCore/XCoreTargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreTargetMachine.cpp?rev=65379&r1=65378&r2=65379&view=diff ============================================================================== --- llvm/trunk/lib/Target/XCore/XCoreTargetMachine.cpp (original) +++ llvm/trunk/lib/Target/XCore/XCoreTargetMachine.cpp Tue Feb 24 02:30:20 2009 @@ -63,6 +63,6 @@ bool XCoreTargetMachine::addAssemblyEmitter(PassManagerBase &PM, bool Fast, raw_ostream &Out) { // Output assembly language. - PM.add(createXCoreCodePrinterPass(Out, *this)); + PM.add(createXCoreCodePrinterPass(Out, *this, Fast)); return false; } Modified: llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp?rev=65379&r1=65378&r2=65379&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp Tue Feb 24 02:30:20 2009 @@ -641,9 +641,7 @@ O << "\";\n\n"; O << " if (TAI->doesSupportDebugInformation() &&\n" - << " DW->ShouldEmitDwarfDebug() &&\n" - << " !DW->getFastCodeGen()) {\n" - << " const MachineFunction *MF = MI->getParent()->getParent();\n" + << " DW->ShouldEmitDwarfDebug() && !Fast) {\n" << " DebugLoc CurDL = MI->getDebugLoc();\n\n" << " if (!CurDL.isUnknown()) {\n" << " static DebugLocTuple PrevDLT(~0U, ~0U, ~0U);\n" From isanbard at gmail.com Tue Feb 24 02:33:48 2009 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 24 Feb 2009 08:33:48 -0000 Subject: [llvm-commits] [llvm] r65380 - in /llvm/branches/Apple/Dib: include/llvm/CodeGen/ lib/CodeGen/AsmPrinter/ lib/CodeGen/SelectionDAG/ lib/Target/ARM/ lib/Target/ARM/AsmPrinter/ lib/Target/Alpha/ lib/Target/Alpha/AsmPrinter/ lib/Target/CellSPU/ lib/Target/CellSPU/AsmPrinter/ lib/Target/IA64/ lib/Target/Mips/ lib/Target/PIC16/ lib/Target/PowerPC/ lib/Target/PowerPC/AsmPrinter/ lib/Target/Sparc/ lib/Target/Sparc/AsmPrinter/ lib/Target/X86/ lib/Target/X86/AsmPrinter/ lib/Target/XCore/ utils/TableGen/ Message-ID: <200902240833.n1O8Xnhk002192@zion.cs.uiuc.edu> Author: void Date: Tue Feb 24 02:33:47 2009 New Revision: 65380 URL: http://llvm.org/viewvc/llvm-project?rev=65380&view=rev Log: Pull r65379 into Dib: Overhaul my earlier submission due to feedback. It's a large patch, but most of them are generic changes. - Use the "fast" flag that's already being passed into the asm printers instead of shoving it into the DwarfWriter. - Instead of calling "MI->getParent()->getParent()" for every MI, set the machine function when calling "runOnMachineFunction" in the asm printers. Modified: llvm/branches/Apple/Dib/include/llvm/CodeGen/AsmPrinter.h llvm/branches/Apple/Dib/include/llvm/CodeGen/DwarfWriter.h llvm/branches/Apple/Dib/lib/CodeGen/AsmPrinter/AsmPrinter.cpp llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/FastISel.cpp llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp llvm/branches/Apple/Dib/lib/Target/ARM/ARM.h llvm/branches/Apple/Dib/lib/Target/ARM/ARMTargetMachine.cpp llvm/branches/Apple/Dib/lib/Target/ARM/ARMTargetMachine.h llvm/branches/Apple/Dib/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp llvm/branches/Apple/Dib/lib/Target/Alpha/Alpha.h llvm/branches/Apple/Dib/lib/Target/Alpha/AlphaTargetMachine.cpp llvm/branches/Apple/Dib/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp llvm/branches/Apple/Dib/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp llvm/branches/Apple/Dib/lib/Target/CellSPU/SPU.h llvm/branches/Apple/Dib/lib/Target/CellSPU/SPUTargetMachine.cpp llvm/branches/Apple/Dib/lib/Target/IA64/IA64.h llvm/branches/Apple/Dib/lib/Target/IA64/IA64AsmPrinter.cpp llvm/branches/Apple/Dib/lib/Target/IA64/IA64TargetMachine.cpp llvm/branches/Apple/Dib/lib/Target/Mips/Mips.h llvm/branches/Apple/Dib/lib/Target/Mips/MipsAsmPrinter.cpp llvm/branches/Apple/Dib/lib/Target/Mips/MipsTargetMachine.cpp llvm/branches/Apple/Dib/lib/Target/PIC16/PIC16.h llvm/branches/Apple/Dib/lib/Target/PIC16/PIC16AsmPrinter.cpp llvm/branches/Apple/Dib/lib/Target/PIC16/PIC16AsmPrinter.h llvm/branches/Apple/Dib/lib/Target/PIC16/PIC16TargetMachine.cpp llvm/branches/Apple/Dib/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp llvm/branches/Apple/Dib/lib/Target/PowerPC/PPC.h llvm/branches/Apple/Dib/lib/Target/PowerPC/PPCTargetMachine.cpp llvm/branches/Apple/Dib/lib/Target/PowerPC/PPCTargetMachine.h llvm/branches/Apple/Dib/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp llvm/branches/Apple/Dib/lib/Target/Sparc/Sparc.h llvm/branches/Apple/Dib/lib/Target/Sparc/SparcTargetMachine.cpp llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.h llvm/branches/Apple/Dib/lib/Target/X86/X86.h llvm/branches/Apple/Dib/lib/Target/X86/X86TargetMachine.cpp llvm/branches/Apple/Dib/lib/Target/X86/X86TargetMachine.h llvm/branches/Apple/Dib/lib/Target/XCore/XCore.h llvm/branches/Apple/Dib/lib/Target/XCore/XCoreAsmPrinter.cpp llvm/branches/Apple/Dib/lib/Target/XCore/XCoreTargetMachine.cpp llvm/branches/Apple/Dib/utils/TableGen/AsmWriterEmitter.cpp Modified: llvm/branches/Apple/Dib/include/llvm/CodeGen/AsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/include/llvm/CodeGen/AsmPrinter.h?rev=65380&r1=65379&r2=65380&view=diff ============================================================================== --- llvm/branches/Apple/Dib/include/llvm/CodeGen/AsmPrinter.h (original) +++ llvm/branches/Apple/Dib/include/llvm/CodeGen/AsmPrinter.h Tue Feb 24 02:33:47 2009 @@ -65,6 +65,8 @@ // Necessary for external weak linkage support std::set ExtWeakSymbols; + /// Fast - Generating code via fast instruction selection. + bool Fast; public: /// Output stream on which we're printing assembly code. /// @@ -82,6 +84,9 @@ /// const TargetRegisterInfo *TRI; + /// The current machine function. + const MachineFunction *MF; + /// Name-mangler for global names. /// Mangler *Mang; @@ -101,7 +106,8 @@ bool IsInTextSection; protected: - AsmPrinter(raw_ostream &o, TargetMachine &TM, const TargetAsmInfo *T); + AsmPrinter(raw_ostream &o, TargetMachine &TM, + const TargetAsmInfo *T, bool F); public: virtual ~AsmPrinter(); Modified: llvm/branches/Apple/Dib/include/llvm/CodeGen/DwarfWriter.h URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/include/llvm/CodeGen/DwarfWriter.h?rev=65380&r1=65379&r2=65380&view=diff ============================================================================== --- llvm/branches/Apple/Dib/include/llvm/CodeGen/DwarfWriter.h (original) +++ llvm/branches/Apple/Dib/include/llvm/CodeGen/DwarfWriter.h Tue Feb 24 02:33:47 2009 @@ -49,9 +49,6 @@ /// DwarfException *DE; - /// FastCodeGen - True if generating code via the "fast" isel. - /// - bool FastCodeGen; public: static char ID; // Pass identification, replacement for typeid @@ -107,9 +104,6 @@ /// ShouldEmitDwarfDebug - Returns true if Dwarf debugging declarations should /// be emitted. bool ShouldEmitDwarfDebug() const; - - bool getFastCodeGen() const { return FastCodeGen; } - void setFastCodeGen(bool Fast) { FastCodeGen = Fast; } }; Modified: llvm/branches/Apple/Dib/lib/CodeGen/AsmPrinter/AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=65380&r1=65379&r2=65380&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original) +++ llvm/branches/Apple/Dib/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Tue Feb 24 02:33:47 2009 @@ -37,8 +37,8 @@ char AsmPrinter::ID = 0; AsmPrinter::AsmPrinter(raw_ostream &o, TargetMachine &tm, - const TargetAsmInfo *T) - : MachineFunctionPass(&ID), FunctionNumber(0), O(o), + const TargetAsmInfo *T, bool F) + : MachineFunctionPass(&ID), FunctionNumber(0), Fast(F), O(o), TM(tm), TAI(T), TRI(tm.getRegisterInfo()), IsInTextSection(false) {} Modified: llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/FastISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/FastISel.cpp?rev=65380&r1=65379&r2=65380&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/FastISel.cpp (original) +++ llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/FastISel.cpp Tue Feb 24 02:33:47 2009 @@ -370,7 +370,6 @@ unsigned Line = Subprogram.getLineNumber(); unsigned LabelID = DW->RecordSourceLine(Line, 0, SrcFile); setCurDebugLoc(DebugLoc::get(MF.getOrCreateDebugLocID(SrcFile, Line, 0))); - DW->setFastCodeGen(true); if (DW->getRecordSourceLineCount() != 1) { const TargetInstrDesc &II = TII.get(TargetInstrInfo::DBG_LABEL); Modified: llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=65380&r1=65379&r2=65380&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original) +++ llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Tue Feb 24 02:33:47 2009 @@ -3918,7 +3918,6 @@ if (Fast) DAG.setRoot(DAG.getLabel(ISD::DBG_LABEL, getCurDebugLoc(), getRoot(), LabelID)); - DW->setFastCodeGen(Fast); } return 0; Modified: llvm/branches/Apple/Dib/lib/Target/ARM/ARM.h URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/ARM/ARM.h?rev=65380&r1=65379&r2=65380&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/ARM/ARM.h (original) +++ llvm/branches/Apple/Dib/lib/Target/ARM/ARM.h Tue Feb 24 02:33:47 2009 @@ -89,7 +89,9 @@ } FunctionPass *createARMISelDag(ARMTargetMachine &TM); -FunctionPass *createARMCodePrinterPass(raw_ostream &O, ARMTargetMachine &TM); +FunctionPass *createARMCodePrinterPass(raw_ostream &O, + ARMTargetMachine &TM, + bool Fast); FunctionPass *createARMCodeEmitterPass(ARMTargetMachine &TM, MachineCodeEmitter &MCE); FunctionPass *createARMLoadStoreOptimizationPass(); Modified: llvm/branches/Apple/Dib/lib/Target/ARM/ARMTargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/ARM/ARMTargetMachine.cpp?rev=65380&r1=65379&r2=65380&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/ARM/ARMTargetMachine.cpp (original) +++ llvm/branches/Apple/Dib/lib/Target/ARM/ARMTargetMachine.cpp Tue Feb 24 02:33:47 2009 @@ -157,7 +157,7 @@ // Output assembly language. assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(Out, *this)); + PM.add(AsmPrinterCtor(Out, *this, Fast)); return false; } @@ -174,7 +174,7 @@ if (DumpAsm) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(errs(), *this)); + PM.add(AsmPrinterCtor(errs(), *this, Fast)); } return false; @@ -187,7 +187,7 @@ if (DumpAsm) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(errs(), *this)); + PM.add(AsmPrinterCtor(errs(), *this, Fast)); } return false; Modified: llvm/branches/Apple/Dib/lib/Target/ARM/ARMTargetMachine.h URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/ARM/ARMTargetMachine.h?rev=65380&r1=65379&r2=65380&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/ARM/ARMTargetMachine.h (original) +++ llvm/branches/Apple/Dib/lib/Target/ARM/ARMTargetMachine.h Tue Feb 24 02:33:47 2009 @@ -40,7 +40,8 @@ // To avoid having target depend on the asmprinter stuff libraries, asmprinter // set this functions to ctor pointer at startup time if they are linked in. typedef FunctionPass *(*AsmPrinterCtorFn)(raw_ostream &o, - ARMTargetMachine &tm); + ARMTargetMachine &tm, + bool fast); static AsmPrinterCtorFn AsmPrinterCtor; public: Modified: llvm/branches/Apple/Dib/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp?rev=65380&r1=65379&r2=65380&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp (original) +++ llvm/branches/Apple/Dib/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Tue Feb 24 02:33:47 2009 @@ -42,13 +42,7 @@ STATISTIC(EmittedInsts, "Number of machine instrs printed"); namespace { - struct VISIBILITY_HIDDEN ARMAsmPrinter : public AsmPrinter { - ARMAsmPrinter(raw_ostream &O, TargetMachine &TM, const TargetAsmInfo *T) - : AsmPrinter(O, TM, T), DW(0), MMI(NULL), AFI(NULL), MCP(NULL), - InCPMode(false) { - Subtarget = &TM.getSubtarget(); - } - + class VISIBILITY_HIDDEN ARMAsmPrinter : public AsmPrinter { DwarfWriter *DW; MachineModuleInfo *MMI; @@ -85,7 +79,14 @@ /// True if asm printer is printing a series of CONSTPOOL_ENTRY. bool InCPMode; - + public: + ARMAsmPrinter(raw_ostream &O, TargetMachine &TM, + const TargetAsmInfo *T, bool F) + : AsmPrinter(O, TM, T, F), DW(0), MMI(NULL), AFI(NULL), MCP(NULL), + InCPMode(false) { + Subtarget = &TM.getSubtarget(); + } + virtual const char *getPassName() const { return "ARM Assembly Printer"; } @@ -183,6 +184,8 @@ /// method to print assembly for each instruction. /// bool ARMAsmPrinter::runOnMachineFunction(MachineFunction &MF) { + this->MF = &MF; + AFI = MF.getInfo(); MCP = MF.getConstantPool(); @@ -1039,8 +1042,9 @@ /// regardless of whether the function is in SSA form. /// FunctionPass *llvm::createARMCodePrinterPass(raw_ostream &o, - ARMTargetMachine &tm) { - return new ARMAsmPrinter(o, tm, tm.getTargetAsmInfo()); + ARMTargetMachine &tm, + bool fast) { + return new ARMAsmPrinter(o, tm, tm.getTargetAsmInfo(), fast); } namespace { Modified: llvm/branches/Apple/Dib/lib/Target/Alpha/Alpha.h URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/Alpha/Alpha.h?rev=65380&r1=65379&r2=65380&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/Alpha/Alpha.h (original) +++ llvm/branches/Apple/Dib/lib/Target/Alpha/Alpha.h Tue Feb 24 02:33:47 2009 @@ -25,7 +25,8 @@ FunctionPass *createAlphaISelDag(AlphaTargetMachine &TM); FunctionPass *createAlphaCodePrinterPass(raw_ostream &OS, - TargetMachine &TM); + TargetMachine &TM, + bool Fast); FunctionPass *createAlphaPatternInstructionSelector(TargetMachine &TM); FunctionPass *createAlphaCodeEmitterPass(AlphaTargetMachine &TM, MachineCodeEmitter &MCE); Modified: llvm/branches/Apple/Dib/lib/Target/Alpha/AlphaTargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/Alpha/AlphaTargetMachine.cpp?rev=65380&r1=65379&r2=65380&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/Alpha/AlphaTargetMachine.cpp (original) +++ llvm/branches/Apple/Dib/lib/Target/Alpha/AlphaTargetMachine.cpp Tue Feb 24 02:33:47 2009 @@ -88,14 +88,14 @@ bool AlphaTargetMachine::addAssemblyEmitter(PassManagerBase &PM, bool Fast, raw_ostream &Out) { PM.add(createAlphaLLRPPass(*this)); - PM.add(createAlphaCodePrinterPass(Out, *this)); + PM.add(createAlphaCodePrinterPass(Out, *this, Fast)); return false; } bool AlphaTargetMachine::addCodeEmitter(PassManagerBase &PM, bool Fast, bool DumpAsm, MachineCodeEmitter &MCE) { PM.add(createAlphaCodeEmitterPass(*this, MCE)); if (DumpAsm) - PM.add(createAlphaCodePrinterPass(errs(), *this)); + PM.add(createAlphaCodePrinterPass(errs(), *this, Fast)); return false; } bool AlphaTargetMachine::addSimpleCodeEmitter(PassManagerBase &PM, Modified: llvm/branches/Apple/Dib/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp?rev=65380&r1=65379&r2=65380&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp (original) +++ llvm/branches/Apple/Dib/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp Tue Feb 24 02:33:47 2009 @@ -33,13 +33,12 @@ namespace { struct VISIBILITY_HIDDEN AlphaAsmPrinter : public AsmPrinter { - /// Unique incrementer for label values for referencing Global values. /// - AlphaAsmPrinter(raw_ostream &o, TargetMachine &tm, const TargetAsmInfo *T) - : AsmPrinter(o, tm, T) { - } + AlphaAsmPrinter(raw_ostream &o, TargetMachine &tm, + const TargetAsmInfo *T, bool F) + : AsmPrinter(o, tm, T, F) {} virtual const char *getPassName() const { return "Alpha Assembly Printer"; @@ -68,8 +67,9 @@ /// regardless of whether the function is in SSA form. /// FunctionPass *llvm::createAlphaCodePrinterPass(raw_ostream &o, - TargetMachine &tm) { - return new AlphaAsmPrinter(o, tm, tm.getTargetAsmInfo()); + TargetMachine &tm, + bool fast) { + return new AlphaAsmPrinter(o, tm, tm.getTargetAsmInfo(), fast); } #include "AlphaGenAsmWriter.inc" @@ -139,6 +139,8 @@ /// method to print assembly for each instruction. /// bool AlphaAsmPrinter::runOnMachineFunction(MachineFunction &MF) { + this->MF = &MF; + SetupMachineFunction(MF); O << "\n\n"; Modified: llvm/branches/Apple/Dib/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp?rev=65380&r1=65379&r2=65380&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp (original) +++ llvm/branches/Apple/Dib/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp Tue Feb 24 02:33:47 2009 @@ -45,13 +45,12 @@ const std::string bss_section(".bss"); - struct VISIBILITY_HIDDEN SPUAsmPrinter : public AsmPrinter { + class VISIBILITY_HIDDEN SPUAsmPrinter : public AsmPrinter { std::set FnStubs, GVStubs; - - SPUAsmPrinter(raw_ostream &O, TargetMachine &TM, const TargetAsmInfo *T) : - AsmPrinter(O, TM, T) - { - } + public: + SPUAsmPrinter(raw_ostream &O, TargetMachine &TM, + const TargetAsmInfo *T, bool F) : + AsmPrinter(O, TM, T, F) {} virtual const char *getPassName() const { return "STI CBEA SPU Assembly Printer"; @@ -285,17 +284,13 @@ }; /// LinuxAsmPrinter - SPU assembly printer, customized for Linux - struct VISIBILITY_HIDDEN LinuxAsmPrinter : public SPUAsmPrinter { - + class VISIBILITY_HIDDEN LinuxAsmPrinter : public SPUAsmPrinter { DwarfWriter *DW; MachineModuleInfo *MMI; - + public: LinuxAsmPrinter(raw_ostream &O, SPUTargetMachine &TM, - const TargetAsmInfo *T) : - SPUAsmPrinter(O, TM, T), - DW(0), - MMI(0) - { } + const TargetAsmInfo *T, bool F) + : SPUAsmPrinter(O, TM, T, F), DW(0), MMI(0) {} virtual const char *getPassName() const { return "STI CBEA SPU Assembly Printer"; @@ -427,6 +422,8 @@ bool LinuxAsmPrinter::runOnMachineFunction(MachineFunction &MF) { + this->MF = &MF; + SetupMachineFunction(MF); O << "\n\n"; @@ -613,6 +610,7 @@ /// that the Linux SPU assembler can deal with. /// FunctionPass *llvm::createSPUAsmPrinterPass(raw_ostream &o, - SPUTargetMachine &tm) { - return new LinuxAsmPrinter(o, tm, tm.getTargetAsmInfo()); + SPUTargetMachine &tm, + bool fast) { + return new LinuxAsmPrinter(o, tm, tm.getTargetAsmInfo(), fast); } Modified: llvm/branches/Apple/Dib/lib/Target/CellSPU/SPU.h URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/CellSPU/SPU.h?rev=65380&r1=65379&r2=65380&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/CellSPU/SPU.h (original) +++ llvm/branches/Apple/Dib/lib/Target/CellSPU/SPU.h Tue Feb 24 02:33:47 2009 @@ -23,7 +23,9 @@ class raw_ostream; FunctionPass *createSPUISelDag(SPUTargetMachine &TM); - FunctionPass *createSPUAsmPrinterPass(raw_ostream &o, SPUTargetMachine &tm); + FunctionPass *createSPUAsmPrinterPass(raw_ostream &o, + SPUTargetMachine &tm, + bool fast); /*--== Utility functions/predicates/etc used all over the place: --==*/ //! Predicate test for a signed 10-bit value Modified: llvm/branches/Apple/Dib/lib/Target/CellSPU/SPUTargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/CellSPU/SPUTargetMachine.cpp?rev=65380&r1=65379&r2=65380&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/CellSPU/SPUTargetMachine.cpp (original) +++ llvm/branches/Apple/Dib/lib/Target/CellSPU/SPUTargetMachine.cpp Tue Feb 24 02:33:47 2009 @@ -90,6 +90,6 @@ bool SPUTargetMachine::addAssemblyEmitter(PassManagerBase &PM, bool Fast, raw_ostream &Out) { - PM.add(createSPUAsmPrinterPass(Out, *this)); + PM.add(createSPUAsmPrinterPass(Out, *this, Fast)); return false; } Modified: llvm/branches/Apple/Dib/lib/Target/IA64/IA64.h URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/IA64/IA64.h?rev=65380&r1=65379&r2=65380&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/IA64/IA64.h (original) +++ llvm/branches/Apple/Dib/lib/Target/IA64/IA64.h Tue Feb 24 02:33:47 2009 @@ -35,7 +35,9 @@ /// using the given target machine description. This should work /// regardless of whether the function is in SSA form. /// -FunctionPass *createIA64CodePrinterPass(raw_ostream &o, IA64TargetMachine &tm); +FunctionPass *createIA64CodePrinterPass(raw_ostream &o, + IA64TargetMachine &tm, + bool fast); } // End llvm namespace Modified: llvm/branches/Apple/Dib/lib/Target/IA64/IA64AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/IA64/IA64AsmPrinter.cpp?rev=65380&r1=65379&r2=65380&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/IA64/IA64AsmPrinter.cpp (original) +++ llvm/branches/Apple/Dib/lib/Target/IA64/IA64AsmPrinter.cpp Tue Feb 24 02:33:47 2009 @@ -34,12 +34,12 @@ STATISTIC(EmittedInsts, "Number of machine instrs printed"); namespace { - struct IA64AsmPrinter : public AsmPrinter { + class IA64AsmPrinter : public AsmPrinter { std::set ExternalFunctionNames, ExternalObjectNames; - - IA64AsmPrinter(raw_ostream &O, TargetMachine &TM, const TargetAsmInfo *T) - : AsmPrinter(O, TM, T) { - } + public: + IA64AsmPrinter(raw_ostream &O, TargetMachine &TM, + const TargetAsmInfo *T, bool F) + : AsmPrinter(O, TM, T, F) {} virtual const char *getPassName() const { return "IA64 Assembly Printer"; @@ -124,6 +124,8 @@ /// method to print assembly for each instruction. /// bool IA64AsmPrinter::runOnMachineFunction(MachineFunction &MF) { + this->MF = &MF; + SetupMachineFunction(MF); O << "\n\n"; @@ -365,6 +367,7 @@ /// the given target machine description. /// FunctionPass *llvm::createIA64CodePrinterPass(raw_ostream &o, - IA64TargetMachine &tm) { - return new IA64AsmPrinter(o, tm, tm.getTargetAsmInfo()); + IA64TargetMachine &tm, + bool fast) { + return new IA64AsmPrinter(o, tm, tm.getTargetAsmInfo(), fast); } Modified: llvm/branches/Apple/Dib/lib/Target/IA64/IA64TargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/IA64/IA64TargetMachine.cpp?rev=65380&r1=65379&r2=65380&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/IA64/IA64TargetMachine.cpp (original) +++ llvm/branches/Apple/Dib/lib/Target/IA64/IA64TargetMachine.cpp Tue Feb 24 02:33:47 2009 @@ -84,7 +84,7 @@ } bool IA64TargetMachine::addAssemblyEmitter(PassManagerBase &PM, bool Fast, raw_ostream &Out) { - PM.add(createIA64CodePrinterPass(Out, *this)); + PM.add(createIA64CodePrinterPass(Out, *this, Fast)); return false; } Modified: llvm/branches/Apple/Dib/lib/Target/Mips/Mips.h URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/Mips/Mips.h?rev=65380&r1=65379&r2=65380&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/Mips/Mips.h (original) +++ llvm/branches/Apple/Dib/lib/Target/Mips/Mips.h Tue Feb 24 02:33:47 2009 @@ -24,7 +24,8 @@ FunctionPass *createMipsISelDag(MipsTargetMachine &TM); FunctionPass *createMipsDelaySlotFillerPass(MipsTargetMachine &TM); FunctionPass *createMipsCodePrinterPass(raw_ostream &OS, - MipsTargetMachine &TM); + MipsTargetMachine &TM, + bool Fast); } // end namespace llvm; // Defines symbolic names for Mips registers. This defines a mapping from Modified: llvm/branches/Apple/Dib/lib/Target/Mips/MipsAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/Mips/MipsAsmPrinter.cpp?rev=65380&r1=65379&r2=65380&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/Mips/MipsAsmPrinter.cpp (original) +++ llvm/branches/Apple/Dib/lib/Target/Mips/MipsAsmPrinter.cpp Tue Feb 24 02:33:47 2009 @@ -46,13 +46,12 @@ STATISTIC(EmittedInsts, "Number of machine instrs printed"); namespace { - struct VISIBILITY_HIDDEN MipsAsmPrinter : public AsmPrinter { - + class VISIBILITY_HIDDEN MipsAsmPrinter : public AsmPrinter { const MipsSubtarget *Subtarget; - + public: MipsAsmPrinter(raw_ostream &O, MipsTargetMachine &TM, - const TargetAsmInfo *T): - AsmPrinter(O, TM, T) { + const TargetAsmInfo *T, bool F) + : AsmPrinter(O, TM, T, F) { Subtarget = &TM.getSubtarget(); } @@ -91,9 +90,9 @@ /// using the given target machine description. This should work /// regardless of whether the function is in SSA form. FunctionPass *llvm::createMipsCodePrinterPass(raw_ostream &o, - MipsTargetMachine &tm) -{ - return new MipsAsmPrinter(o, tm, tm.getTargetAsmInfo()); + MipsTargetMachine &tm, + bool fast) { + return new MipsAsmPrinter(o, tm, tm.getTargetAsmInfo(), fast); } //===----------------------------------------------------------------------===// @@ -266,6 +265,8 @@ bool MipsAsmPrinter:: runOnMachineFunction(MachineFunction &MF) { + this->MF = &MF; + SetupMachineFunction(MF); // Print out constants referenced by the function Modified: llvm/branches/Apple/Dib/lib/Target/Mips/MipsTargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/Mips/MipsTargetMachine.cpp?rev=65380&r1=65379&r2=65380&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/Mips/MipsTargetMachine.cpp (original) +++ llvm/branches/Apple/Dib/lib/Target/Mips/MipsTargetMachine.cpp Tue Feb 24 02:33:47 2009 @@ -128,6 +128,6 @@ raw_ostream &Out) { // Output assembly language. - PM.add(createMipsCodePrinterPass(Out, *this)); + PM.add(createMipsCodePrinterPass(Out, *this, Fast)); return false; } Modified: llvm/branches/Apple/Dib/lib/Target/PIC16/PIC16.h URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/PIC16/PIC16.h?rev=65380&r1=65379&r2=65380&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/PIC16/PIC16.h (original) +++ llvm/branches/Apple/Dib/lib/Target/PIC16/PIC16.h Tue Feb 24 02:33:47 2009 @@ -74,7 +74,8 @@ FunctionPass *createPIC16ISelDag(PIC16TargetMachine &TM); FunctionPass *createPIC16CodePrinterPass(raw_ostream &OS, - PIC16TargetMachine &TM); + PIC16TargetMachine &TM, + bool Fast); } // end namespace llvm; // Defines symbolic names for PIC16 registers. This defines a mapping from Modified: llvm/branches/Apple/Dib/lib/Target/PIC16/PIC16AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/PIC16/PIC16AsmPrinter.cpp?rev=65380&r1=65379&r2=65380&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/PIC16/PIC16AsmPrinter.cpp (original) +++ llvm/branches/Apple/Dib/lib/Target/PIC16/PIC16AsmPrinter.cpp Tue Feb 24 02:33:47 2009 @@ -90,6 +90,8 @@ /// method to print assembly for each instruction. /// bool PIC16AsmPrinter::runOnMachineFunction(MachineFunction &MF) { + this->MF = &MF; + // This calls the base class function required to be called at beginning // of runOnMachineFunction. SetupMachineFunction(MF); @@ -133,8 +135,9 @@ /// regardless of whether the function is in SSA form. /// FunctionPass *llvm::createPIC16CodePrinterPass(raw_ostream &o, - PIC16TargetMachine &tm) { - return new PIC16AsmPrinter(o, tm, tm.getTargetAsmInfo()); + PIC16TargetMachine &tm, + bool fast) { + return new PIC16AsmPrinter(o, tm, tm.getTargetAsmInfo(), fast); } void PIC16AsmPrinter::printOperand(const MachineInstr *MI, int opNum) { Modified: llvm/branches/Apple/Dib/lib/Target/PIC16/PIC16AsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/PIC16/PIC16AsmPrinter.h?rev=65380&r1=65379&r2=65380&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/PIC16/PIC16AsmPrinter.h (original) +++ llvm/branches/Apple/Dib/lib/Target/PIC16/PIC16AsmPrinter.h Tue Feb 24 02:33:47 2009 @@ -24,8 +24,9 @@ namespace llvm { struct VISIBILITY_HIDDEN PIC16AsmPrinter : public AsmPrinter { - PIC16AsmPrinter(raw_ostream &O, TargetMachine &TM, const TargetAsmInfo *T) - : AsmPrinter(O, TM, T) { + PIC16AsmPrinter(raw_ostream &O, TargetMachine &TM, + const TargetAsmInfo *T, bool F) + : AsmPrinter(O, TM, T, F) { CurrentBankselLabelInBasicBlock = ""; IsRomData = false; } Modified: llvm/branches/Apple/Dib/lib/Target/PIC16/PIC16TargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/PIC16/PIC16TargetMachine.cpp?rev=65380&r1=65379&r2=65380&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/PIC16/PIC16TargetMachine.cpp (original) +++ llvm/branches/Apple/Dib/lib/Target/PIC16/PIC16TargetMachine.cpp Tue Feb 24 02:33:47 2009 @@ -64,7 +64,7 @@ bool PIC16TargetMachine:: addAssemblyEmitter(PassManagerBase &PM, bool Fast, raw_ostream &Out) { // Output assembly language. - PM.add(createPIC16CodePrinterPass(Out, *this)); + PM.add(createPIC16CodePrinterPass(Out, *this, Fast)); return false; } Modified: llvm/branches/Apple/Dib/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp?rev=65380&r1=65379&r2=65380&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp (original) +++ llvm/branches/Apple/Dib/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp Tue Feb 24 02:33:47 2009 @@ -49,13 +49,15 @@ STATISTIC(EmittedInsts, "Number of machine instrs printed"); namespace { - struct VISIBILITY_HIDDEN PPCAsmPrinter : public AsmPrinter { + class VISIBILITY_HIDDEN PPCAsmPrinter : public AsmPrinter { + protected: StringSet<> FnStubs, GVStubs, HiddenGVStubs; const PPCSubtarget &Subtarget; - - PPCAsmPrinter(raw_ostream &O, TargetMachine &TM, const TargetAsmInfo *T) - : AsmPrinter(O, TM, T), Subtarget(TM.getSubtarget()) { - } + public: + PPCAsmPrinter(raw_ostream &O, TargetMachine &TM, + const TargetAsmInfo *T, bool F) + : AsmPrinter(O, TM, T, F), + Subtarget(TM.getSubtarget()) {} virtual const char *getPassName() const { return "PowerPC Assembly Printer"; @@ -291,14 +293,13 @@ }; /// PPCLinuxAsmPrinter - PowerPC assembly printer, customized for Linux - struct VISIBILITY_HIDDEN PPCLinuxAsmPrinter : public PPCAsmPrinter { + class VISIBILITY_HIDDEN PPCLinuxAsmPrinter : public PPCAsmPrinter { DwarfWriter *DW; MachineModuleInfo *MMI; - + public: PPCLinuxAsmPrinter(raw_ostream &O, PPCTargetMachine &TM, - const TargetAsmInfo *T) - : PPCAsmPrinter(O, TM, T), DW(0), MMI(0) { - } + const TargetAsmInfo *T, bool F) + : PPCAsmPrinter(O, TM, T, F), DW(0), MMI(0) {} virtual const char *getPassName() const { return "Linux PPC Assembly Printer"; @@ -320,15 +321,14 @@ /// PPCDarwinAsmPrinter - PowerPC assembly printer, customized for Darwin/Mac /// OS X - struct VISIBILITY_HIDDEN PPCDarwinAsmPrinter : public PPCAsmPrinter { - + class VISIBILITY_HIDDEN PPCDarwinAsmPrinter : public PPCAsmPrinter { DwarfWriter *DW; MachineModuleInfo *MMI; raw_ostream &OS; + public: PPCDarwinAsmPrinter(raw_ostream &O, PPCTargetMachine &TM, - const TargetAsmInfo *T) - : PPCAsmPrinter(O, TM, T), DW(0), MMI(0), OS(O) { - } + const TargetAsmInfo *T, bool F) + : PPCAsmPrinter(O, TM, T, F), DW(0), MMI(0), OS(O) {} virtual const char *getPassName() const { return "Darwin PPC Assembly Printer"; @@ -571,6 +571,7 @@ /// method to print assembly for each instruction. /// bool PPCLinuxAsmPrinter::runOnMachineFunction(MachineFunction &MF) { + this->MF = &MF; SetupMachineFunction(MF); O << "\n\n"; @@ -764,6 +765,8 @@ /// method to print assembly for each instruction. /// bool PPCDarwinAsmPrinter::runOnMachineFunction(MachineFunction &MF) { + this->MF = &MF; + SetupMachineFunction(MF); O << "\n\n"; @@ -1146,13 +1149,14 @@ /// Darwin assembler can deal with. /// FunctionPass *llvm::createPPCAsmPrinterPass(raw_ostream &o, - PPCTargetMachine &tm) { + PPCTargetMachine &tm, + bool fast) { const PPCSubtarget *Subtarget = &tm.getSubtarget(); if (Subtarget->isDarwin()) { - return new PPCDarwinAsmPrinter(o, tm, tm.getTargetAsmInfo()); + return new PPCDarwinAsmPrinter(o, tm, tm.getTargetAsmInfo(), fast); } else { - return new PPCLinuxAsmPrinter(o, tm, tm.getTargetAsmInfo()); + return new PPCLinuxAsmPrinter(o, tm, tm.getTargetAsmInfo(), fast); } } Modified: llvm/branches/Apple/Dib/lib/Target/PowerPC/PPC.h URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/PowerPC/PPC.h?rev=65380&r1=65379&r2=65380&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/PowerPC/PPC.h (original) +++ llvm/branches/Apple/Dib/lib/Target/PowerPC/PPC.h Tue Feb 24 02:33:47 2009 @@ -27,7 +27,8 @@ FunctionPass *createPPCBranchSelectionPass(); FunctionPass *createPPCISelDag(PPCTargetMachine &TM); FunctionPass *createPPCAsmPrinterPass(raw_ostream &OS, - PPCTargetMachine &TM); + PPCTargetMachine &TM, + bool Fast); FunctionPass *createPPCCodeEmitterPass(PPCTargetMachine &TM, MachineCodeEmitter &MCE); } // end namespace llvm; Modified: llvm/branches/Apple/Dib/lib/Target/PowerPC/PPCTargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/PowerPC/PPCTargetMachine.cpp?rev=65380&r1=65379&r2=65380&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/PowerPC/PPCTargetMachine.cpp (original) +++ llvm/branches/Apple/Dib/lib/Target/PowerPC/PPCTargetMachine.cpp Tue Feb 24 02:33:47 2009 @@ -146,7 +146,7 @@ raw_ostream &Out) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(Out, *this)); + PM.add(AsmPrinterCtor(Out, *this, Fast)); return false; } @@ -176,7 +176,7 @@ if (DumpAsm) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(errs(), *this)); + PM.add(AsmPrinterCtor(errs(), *this, Fast)); } return false; @@ -189,7 +189,7 @@ if (DumpAsm) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(errs(), *this)); + PM.add(AsmPrinterCtor(errs(), *this, Fast)); } return false; Modified: llvm/branches/Apple/Dib/lib/Target/PowerPC/PPCTargetMachine.h URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/PowerPC/PPCTargetMachine.h?rev=65380&r1=65379&r2=65380&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/PowerPC/PPCTargetMachine.h (original) +++ llvm/branches/Apple/Dib/lib/Target/PowerPC/PPCTargetMachine.h Tue Feb 24 02:33:47 2009 @@ -45,7 +45,8 @@ // To avoid having target depend on the asmprinter stuff libraries, asmprinter // set this functions to ctor pointer at startup time if they are linked in. typedef FunctionPass *(*AsmPrinterCtorFn)(raw_ostream &o, - PPCTargetMachine &tm); + PPCTargetMachine &tm, + bool fast); static AsmPrinterCtorFn AsmPrinterCtor; public: Modified: llvm/branches/Apple/Dib/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp?rev=65380&r1=65379&r2=65380&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp (original) +++ llvm/branches/Apple/Dib/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp Tue Feb 24 02:33:47 2009 @@ -40,17 +40,17 @@ STATISTIC(EmittedInsts, "Number of machine instrs printed"); namespace { - struct VISIBILITY_HIDDEN SparcAsmPrinter : public AsmPrinter { - SparcAsmPrinter(raw_ostream &O, TargetMachine &TM, const TargetAsmInfo *T) - : AsmPrinter(O, TM, T) { - } - + class VISIBILITY_HIDDEN SparcAsmPrinter : public AsmPrinter { /// We name each basic block in a Function with a unique number, so /// that we can consistently refer to them later. This is cleared /// at the beginning of each call to runOnMachineFunction(). /// typedef std::map ValueMapTy; ValueMapTy NumberForBB; + public: + SparcAsmPrinter(raw_ostream &O, TargetMachine &TM, + const TargetAsmInfo *T, bool F) + : AsmPrinter(O, TM, T, F) {} virtual const char *getPassName() const { return "Sparc Assembly Printer"; @@ -81,14 +81,17 @@ /// regardless of whether the function is in SSA form. /// FunctionPass *llvm::createSparcCodePrinterPass(raw_ostream &o, - TargetMachine &tm) { - return new SparcAsmPrinter(o, tm, tm.getTargetAsmInfo()); + TargetMachine &tm, + bool fast) { + return new SparcAsmPrinter(o, tm, tm.getTargetAsmInfo(), fast); } /// runOnMachineFunction - This uses the printInstruction() /// method to print assembly for each instruction. /// bool SparcAsmPrinter::runOnMachineFunction(MachineFunction &MF) { + this->MF = &MF; + SetupMachineFunction(MF); // Print out constants referenced by the function Modified: llvm/branches/Apple/Dib/lib/Target/Sparc/Sparc.h URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/Sparc/Sparc.h?rev=65380&r1=65379&r2=65380&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/Sparc/Sparc.h (original) +++ llvm/branches/Apple/Dib/lib/Target/Sparc/Sparc.h Tue Feb 24 02:33:47 2009 @@ -24,7 +24,8 @@ class raw_ostream; FunctionPass *createSparcISelDag(SparcTargetMachine &TM); - FunctionPass *createSparcCodePrinterPass(raw_ostream &OS, TargetMachine &TM); + FunctionPass *createSparcCodePrinterPass(raw_ostream &OS, + TargetMachine &TM, bool Fast); FunctionPass *createSparcDelaySlotFillerPass(TargetMachine &TM); FunctionPass *createSparcFPMoverPass(TargetMachine &TM); } // end namespace llvm; Modified: llvm/branches/Apple/Dib/lib/Target/Sparc/SparcTargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/Sparc/SparcTargetMachine.cpp?rev=65380&r1=65379&r2=65380&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/Sparc/SparcTargetMachine.cpp (original) +++ llvm/branches/Apple/Dib/lib/Target/Sparc/SparcTargetMachine.cpp Tue Feb 24 02:33:47 2009 @@ -85,6 +85,6 @@ bool SparcTargetMachine::addAssemblyEmitter(PassManagerBase &PM, bool Fast, raw_ostream &Out) { // Output assembly language. - PM.add(createSparcCodePrinterPass(Out, *this)); + PM.add(createSparcCodePrinterPass(Out, *this, Fast)); return false; } Modified: llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h?rev=65380&r1=65379&r2=65380&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h (original) +++ llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h Tue Feb 24 02:33:47 2009 @@ -28,15 +28,14 @@ struct MachineJumpTableInfo; -struct VISIBILITY_HIDDEN X86ATTAsmPrinter : public AsmPrinter { - MachineFunction *MF; +class VISIBILITY_HIDDEN X86ATTAsmPrinter : public AsmPrinter { DwarfWriter *DW; MachineModuleInfo *MMI; const X86Subtarget *Subtarget; - + public: X86ATTAsmPrinter(raw_ostream &O, X86TargetMachine &TM, - const TargetAsmInfo *T) - : AsmPrinter(O, TM, T), DW(0), MMI(0) { + const TargetAsmInfo *T, bool F) + : AsmPrinter(O, TM, T, F), DW(0), MMI(0) { Subtarget = &TM.getSubtarget(); } Modified: llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp?rev=65380&r1=65379&r2=65380&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp (original) +++ llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp Tue Feb 24 02:33:47 2009 @@ -24,13 +24,14 @@ /// machine description. /// FunctionPass *llvm::createX86CodePrinterPass(raw_ostream &o, - X86TargetMachine &tm) { + X86TargetMachine &tm, + bool fast) { const X86Subtarget *Subtarget = &tm.getSubtarget(); if (Subtarget->isFlavorIntel()) { - return new X86IntelAsmPrinter(o, tm, tm.getTargetAsmInfo()); + return new X86IntelAsmPrinter(o, tm, tm.getTargetAsmInfo(), fast); } else { - return new X86ATTAsmPrinter(o, tm, tm.getTargetAsmInfo()); + return new X86ATTAsmPrinter(o, tm, tm.getTargetAsmInfo(), fast); } } Modified: llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp?rev=65380&r1=65379&r2=65380&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp (original) +++ llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp Tue Feb 24 02:33:47 2009 @@ -122,6 +122,7 @@ /// method to print assembly for each instruction. /// bool X86IntelAsmPrinter::runOnMachineFunction(MachineFunction &MF) { + this->MF = &MF; SetupMachineFunction(MF); O << "\n\n"; Modified: llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.h?rev=65380&r1=65379&r2=65380&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.h (original) +++ llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.h Tue Feb 24 02:33:47 2009 @@ -26,9 +26,8 @@ struct VISIBILITY_HIDDEN X86IntelAsmPrinter : public AsmPrinter { X86IntelAsmPrinter(raw_ostream &O, X86TargetMachine &TM, - const TargetAsmInfo *T) - : AsmPrinter(O, TM, T) { - } + const TargetAsmInfo *T, bool F) + : AsmPrinter(O, TM, T, F) {} virtual const char *getPassName() const { return "X86 Intel-Style Assembly Printer"; Modified: llvm/branches/Apple/Dib/lib/Target/X86/X86.h URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/X86/X86.h?rev=65380&r1=65379&r2=65380&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/X86/X86.h (original) +++ llvm/branches/Apple/Dib/lib/Target/X86/X86.h Tue Feb 24 02:33:47 2009 @@ -42,7 +42,9 @@ /// assembly code for a MachineFunction to the given output stream, /// using the given target machine description. /// -FunctionPass *createX86CodePrinterPass(raw_ostream &o, X86TargetMachine &tm); +FunctionPass *createX86CodePrinterPass(raw_ostream &o, + X86TargetMachine &tm, + bool fast); /// createX86CodeEmitterPass - Return a pass that emits the collected X86 code /// to the specified MCE object. Modified: llvm/branches/Apple/Dib/lib/Target/X86/X86TargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/X86/X86TargetMachine.cpp?rev=65380&r1=65379&r2=65380&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/X86/X86TargetMachine.cpp (original) +++ llvm/branches/Apple/Dib/lib/Target/X86/X86TargetMachine.cpp Tue Feb 24 02:33:47 2009 @@ -210,7 +210,7 @@ raw_ostream &Out) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(Out, *this)); + PM.add(AsmPrinterCtor(Out, *this, Fast)); return false; } @@ -236,7 +236,7 @@ if (DumpAsm) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(errs(), *this)); + PM.add(AsmPrinterCtor(errs(), *this, Fast)); } return false; @@ -248,7 +248,7 @@ if (DumpAsm) { assert(AsmPrinterCtor && "AsmPrinter was not linked in"); if (AsmPrinterCtor) - PM.add(AsmPrinterCtor(errs(), *this)); + PM.add(AsmPrinterCtor(errs(), *this, Fast)); } return false; Modified: llvm/branches/Apple/Dib/lib/Target/X86/X86TargetMachine.h URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/X86/X86TargetMachine.h?rev=65380&r1=65379&r2=65380&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/X86/X86TargetMachine.h (original) +++ llvm/branches/Apple/Dib/lib/Target/X86/X86TargetMachine.h Tue Feb 24 02:33:47 2009 @@ -44,7 +44,8 @@ // To avoid having target depend on the asmprinter stuff libraries, asmprinter // set this functions to ctor pointer at startup time if they are linked in. typedef FunctionPass *(*AsmPrinterCtorFn)(raw_ostream &o, - X86TargetMachine &tm); + X86TargetMachine &tm, + bool fast); static AsmPrinterCtorFn AsmPrinterCtor; public: Modified: llvm/branches/Apple/Dib/lib/Target/XCore/XCore.h URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/XCore/XCore.h?rev=65380&r1=65379&r2=65380&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/XCore/XCore.h (original) +++ llvm/branches/Apple/Dib/lib/Target/XCore/XCore.h Tue Feb 24 02:33:47 2009 @@ -23,7 +23,8 @@ FunctionPass *createXCoreISelDag(XCoreTargetMachine &TM); FunctionPass *createXCoreCodePrinterPass(raw_ostream &OS, - XCoreTargetMachine &TM); + XCoreTargetMachine &TM, + bool Fast); } // end namespace llvm; // Defines symbolic names for XCore registers. This defines a mapping from Modified: llvm/branches/Apple/Dib/lib/Target/XCore/XCoreAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/XCore/XCoreAsmPrinter.cpp?rev=65380&r1=65379&r2=65380&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/XCore/XCoreAsmPrinter.cpp (original) +++ llvm/branches/Apple/Dib/lib/Target/XCore/XCoreAsmPrinter.cpp Tue Feb 24 02:33:47 2009 @@ -53,14 +53,14 @@ cl::init(8)); namespace { - struct VISIBILITY_HIDDEN XCoreAsmPrinter : public AsmPrinter { - XCoreAsmPrinter(raw_ostream &O, XCoreTargetMachine &TM, - const TargetAsmInfo *T) - : AsmPrinter(O, TM, T), DW(0), - Subtarget(*TM.getSubtargetImpl()) { } - + class VISIBILITY_HIDDEN XCoreAsmPrinter : public AsmPrinter { DwarfWriter *DW; const XCoreSubtarget &Subtarget; + public: + XCoreAsmPrinter(raw_ostream &O, XCoreTargetMachine &TM, + const TargetAsmInfo *T, bool F) + : AsmPrinter(O, TM, T, F), DW(0), + Subtarget(*TM.getSubtargetImpl()) {} virtual const char *getPassName() const { return "XCore Assembly Printer"; @@ -104,8 +104,9 @@ /// regardless of whether the function is in SSA form. /// FunctionPass *llvm::createXCoreCodePrinterPass(raw_ostream &o, - XCoreTargetMachine &tm) { - return new XCoreAsmPrinter(o, tm, tm.getTargetAsmInfo()); + XCoreTargetMachine &tm, + bool fast) { + return new XCoreAsmPrinter(o, tm, tm.getTargetAsmInfo(), fast); } // PrintEscapedString - Print each character of the specified string, escaping @@ -293,6 +294,8 @@ /// bool XCoreAsmPrinter::runOnMachineFunction(MachineFunction &MF) { + this->MF = &MF; + SetupMachineFunction(MF); // Print out constants referenced by the function Modified: llvm/branches/Apple/Dib/lib/Target/XCore/XCoreTargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/XCore/XCoreTargetMachine.cpp?rev=65380&r1=65379&r2=65380&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/XCore/XCoreTargetMachine.cpp (original) +++ llvm/branches/Apple/Dib/lib/Target/XCore/XCoreTargetMachine.cpp Tue Feb 24 02:33:47 2009 @@ -63,6 +63,6 @@ bool XCoreTargetMachine::addAssemblyEmitter(PassManagerBase &PM, bool Fast, raw_ostream &Out) { // Output assembly language. - PM.add(createXCoreCodePrinterPass(Out, *this)); + PM.add(createXCoreCodePrinterPass(Out, *this, Fast)); return false; } Modified: llvm/branches/Apple/Dib/utils/TableGen/AsmWriterEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/utils/TableGen/AsmWriterEmitter.cpp?rev=65380&r1=65379&r2=65380&view=diff ============================================================================== --- llvm/branches/Apple/Dib/utils/TableGen/AsmWriterEmitter.cpp (original) +++ llvm/branches/Apple/Dib/utils/TableGen/AsmWriterEmitter.cpp Tue Feb 24 02:33:47 2009 @@ -641,9 +641,7 @@ O << "\";\n\n"; O << " if (TAI->doesSupportDebugInformation() &&\n" - << " DW->ShouldEmitDwarfDebug() &&\n" - << " !DW->getFastCodeGen()) {\n" - << " const MachineFunction *MF = MI->getParent()->getParent();\n" + << " DW->ShouldEmitDwarfDebug() && !Fast) {\n" << " DebugLoc CurDL = MI->getDebugLoc();\n\n" << " if (!CurDL.isUnknown()) {\n" << " static DebugLocTuple PrevDLT(~0U, ~0U, ~0U);\n" From echeng at apple.com Tue Feb 24 02:40:28 2009 From: echeng at apple.com (Evan Cheng) Date: Tue, 24 Feb 2009 00:40:28 -0800 Subject: [llvm-commits] [llvm] r65367 - in /llvm/trunk: include/llvm/CodeGen/DwarfWriter.h include/llvm/CodeGen/SelectionDAG.h lib/CodeGen/SelectionDAG/FastISel.cpp lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp test/DebugInfo/2009-01-30-Method.ll test/DebugInfo/deaddebuglabel.ll test/DebugInfo/forwardDecl.ll test/FrontendC++/2006-11-06-StackTrace.cpp test/FrontendC++/2006-11-30-Pubnames.cpp utils/TableGen/AsmWriterEmitter.cpp In-Reply-To: References: <200902240235.n1O2ZV0f023730@zion.cs.uiuc.edu> <6973CA87-3B39-4D37-9B64-7C743E0C953D@apple.com> <999DEB7D-3590-4EFF-947D-FA301329C19A@gmail.com> <5C0D3B60-D5E9-4D11-B3D0-AAB91C0244D8@apple.com> Message-ID: <6F26D31D-749A-4743-86A1-3AAD4584A835@apple.com> On Feb 24, 2009, at 12:24 AM, Bill Wendling wrote: > On Feb 23, 2009, at 11:49 PM, Evan Cheng wrote: > >> Also what about tblgen changes? >> >> The code is still in X86GenAsmWriter.inc: >> >> if (TAI->doesSupportDebugInformation() && >> DW->ShouldEmitDwarfDebug()) { >> const MachineFunction *MF = MI->getParent()->getParent(); >> DebugLoc CurDL = MI->getDebugLoc(); >> >> if (!CurDL.isUnknown()) { >> static DebugLocTuple PrevDLT(~0U, ~0U, ~0U); >> DebugLocTuple CurDLT = MF->getDebugLocTuple(CurDL); >> >> if (PrevDLT.Src != ~0U && PrevDLT != CurDLT) >> printLabel(DW->RecordSourceLine(CurDLT.Line, CurDLT.Col, >> CurDLT.Src)); >> >> PrevDLT = CurDLT; >> } >> } >> >> This should not be run when "fast", right? >> >> While we are at it, it looks like this code should be simplified. If >> TAI->doesSupportDebugInformation() is false, DW- >>> ShouldEmitDwarfDebug() should not return true. That means only the >> later check is needed? >> > It turns out that both checks are necessary. I get an assert in Alpha > if they're not both checked. That sounds like a bug in the Alpha backend. :-) Evan > > > -bw > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From espindola at google.com Tue Feb 24 03:22:06 2009 From: espindola at google.com (Rafael Espindola) Date: Tue, 24 Feb 2009 09:22:06 +0000 Subject: [llvm-commits] [llvm] r65341 - in /llvm/trunk: lib/Target/X86/X86FastISel.cpp test/CodeGen/X86/fast-isel-tls.ll In-Reply-To: <200902232203.n1NM39Xf013577@zion.cs.uiuc.edu> References: <200902232203.n1NM39Xf013577@zion.cs.uiuc.edu> Message-ID: <38a0d8450902240122u4eb332awe98a416bee909e68@mail.gmail.com> Maybe this should be in the release. 2009/2/23 Dan Gohman : > Author: djg > Date: Mon Feb 23 16:03:08 2009 > New Revision: 65341 > > URL: http://llvm.org/viewvc/llvm-project?rev=65341&view=rev > Log: > Fast-isel can't do TLS yet, so it should fall back to SDISel > if it sees TLS addresses. > > Added: > ? ?llvm/trunk/test/CodeGen/X86/fast-isel-tls.ll > Modified: > ? ?llvm/trunk/lib/Target/X86/X86FastISel.cpp > > Modified: llvm/trunk/lib/Target/X86/X86FastISel.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FastISel.cpp?rev=65341&r1=65340&r2=65341&view=diff > > ============================================================================== > --- llvm/trunk/lib/Target/X86/X86FastISel.cpp (original) > +++ llvm/trunk/lib/Target/X86/X86FastISel.cpp Mon Feb 23 16:03:08 2009 > @@ -21,6 +21,7 @@ > ?#include "X86TargetMachine.h" > ?#include "llvm/CallingConv.h" > ?#include "llvm/DerivedTypes.h" > +#include "llvm/GlobalVariable.h" > ?#include "llvm/Instructions.h" > ?#include "llvm/Intrinsics.h" > ?#include "llvm/CodeGen/FastISel.h" > @@ -433,6 +434,11 @@ > ? ? ? ? (AM.Base.Reg != 0 || AM.IndexReg != 0)) > ? ? ? return false; > > + ? ?// Can't handle TLS yet. > + ? ?if (GlobalVariable *GVar = dyn_cast(GV)) > + ? ? ?if (GVar->isThreadLocal()) > + ? ? ? ?return false; > + > ? ? // Set up the basic address. > ? ? AM.GV = GV; > ? ? if (!isCall && > > Added: llvm/trunk/test/CodeGen/X86/fast-isel-tls.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/fast-isel-tls.ll?rev=65341&view=auto > > ============================================================================== > --- llvm/trunk/test/CodeGen/X86/fast-isel-tls.ll (added) > +++ llvm/trunk/test/CodeGen/X86/fast-isel-tls.ll Mon Feb 23 16:03:08 2009 > @@ -0,0 +1,10 @@ > +; RUN: llvm-as < %s | llc -march=x86 -relocation-model=pic -mtriple=i686-unknown-linux-gnu -fast-isel | grep __tls_get_addr > +; PR3654 > + > + at v = thread_local global i32 0 > +define i32 @f() nounwind { > +entry: > + ? ? ? ? ?%t = load i32* @v > + ? ? ? ? ?%s = add i32 %t, 1 > + ? ? ? ? ?ret i32 %s > +} > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > -- Rafael Avila de Espindola Google | Gordon House | Barrow Street | Dublin 4 | Ireland Registered in Dublin, Ireland | Registration Number: 368047 From tonic at nondot.org Tue Feb 24 12:07:13 2009 From: tonic at nondot.org (Tanya M. Lattner) Date: Tue, 24 Feb 2009 10:07:13 -0800 (PST) Subject: [llvm-commits] [llvm] r65341 - in /llvm/trunk: lib/Target/X86/X86FastISel.cpp test/CodeGen/X86/fast-isel-tls.ll In-Reply-To: <38a0d8450902240122u4eb332awe98a416bee909e68@mail.gmail.com> References: <200902232203.n1NM39Xf013577@zion.cs.uiuc.edu> <38a0d8450902240122u4eb332awe98a416bee909e68@mail.gmail.com> Message-ID: Please see my mail about patches for the release: http://lists.cs.uiuc.edu/pipermail/llvmdev/2009-February/020043.html This must fix a regression (correctness) in llvm-test or dejagnu to be merged in. -Tanya On Tue, 24 Feb 2009, Rafael Espindola wrote: > Maybe this should be in the release. > > 2009/2/23 Dan Gohman : >> Author: djg >> Date: Mon Feb 23 16:03:08 2009 >> New Revision: 65341 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=65341&view=rev >> Log: >> Fast-isel can't do TLS yet, so it should fall back to SDISel >> if it sees TLS addresses. >> >> Added: >> ? ?llvm/trunk/test/CodeGen/X86/fast-isel-tls.ll >> Modified: >> ? ?llvm/trunk/lib/Target/X86/X86FastISel.cpp >> >> Modified: llvm/trunk/lib/Target/X86/X86FastISel.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FastISel.cpp?rev=65341&r1=65340&r2=65341&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/Target/X86/X86FastISel.cpp (original) >> +++ llvm/trunk/lib/Target/X86/X86FastISel.cpp Mon Feb 23 16:03:08 2009 >> @@ -21,6 +21,7 @@ >> ?#include "X86TargetMachine.h" >> ?#include "llvm/CallingConv.h" >> ?#include "llvm/DerivedTypes.h" >> +#include "llvm/GlobalVariable.h" >> ?#include "llvm/Instructions.h" >> ?#include "llvm/Intrinsics.h" >> ?#include "llvm/CodeGen/FastISel.h" >> @@ -433,6 +434,11 @@ >> ? ? ? ? (AM.Base.Reg != 0 || AM.IndexReg != 0)) >> ? ? ? return false; >> >> + ? ?// Can't handle TLS yet. >> + ? ?if (GlobalVariable *GVar = dyn_cast(GV)) >> + ? ? ?if (GVar->isThreadLocal()) >> + ? ? ? ?return false; >> + >> ? ? // Set up the basic address. >> ? ? AM.GV = GV; >> ? ? if (!isCall && >> >> Added: llvm/trunk/test/CodeGen/X86/fast-isel-tls.ll >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/fast-isel-tls.ll?rev=65341&view=auto >> >> ============================================================================== >> --- llvm/trunk/test/CodeGen/X86/fast-isel-tls.ll (added) >> +++ llvm/trunk/test/CodeGen/X86/fast-isel-tls.ll Mon Feb 23 16:03:08 2009 >> @@ -0,0 +1,10 @@ >> +; RUN: llvm-as < %s | llc -march=x86 -relocation-model=pic -mtriple=i686-unknown-linux-gnu -fast-isel | grep __tls_get_addr >> +; PR3654 >> + >> + at v = thread_local global i32 0 >> +define i32 @f() nounwind { >> +entry: >> + ? ? ? ? ?%t = load i32* @v >> + ? ? ? ? ?%s = add i32 %t, 1 >> + ? ? ? ? ?ret i32 %s >> +} >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> > > > > From espindola at google.com Tue Feb 24 11:51:40 2009 From: espindola at google.com (Rafael Espindola) Date: Tue, 24 Feb 2009 17:51:40 +0000 Subject: [llvm-commits] [llvm] r65341 - in /llvm/trunk: lib/Target/X86/X86FastISel.cpp test/CodeGen/X86/fast-isel-tls.ll In-Reply-To: References: <200902232203.n1NM39Xf013577@zion.cs.uiuc.edu> <38a0d8450902240122u4eb332awe98a416bee909e68@mail.gmail.com> Message-ID: <38a0d8450902240951k1a4fdb57pbf020a4cde83969e@mail.gmail.com> 2009/2/24 Tanya M. Lattner : > > Please see my mail about patches for the release: > http://lists.cs.uiuc.edu/pipermail/llvmdev/2009-February/020043.html > > This must fix a regression (correctness) in llvm-test or dejagnu to be > merged in. It fixes a correctness regression in dejagnu: the test included in the patch. > -Tanya Cheers, -- Rafael Avila de Espindola Google | Gordon House | Barrow Street | Dublin 4 | Ireland Registered in Dublin, Ireland | Registration Number: 368047 From tonic at nondot.org Tue Feb 24 12:23:46 2009 From: tonic at nondot.org (Tanya M. Lattner) Date: Tue, 24 Feb 2009 10:23:46 -0800 (PST) Subject: [llvm-commits] [llvm] r65341 - in /llvm/trunk: lib/Target/X86/X86FastISel.cpp test/CodeGen/X86/fast-isel-tls.ll In-Reply-To: <38a0d8450902240951k1a4fdb57pbf020a4cde83969e@mail.gmail.com> References: <200902232203.n1NM39Xf013577@zion.cs.uiuc.edu> <38a0d8450902240122u4eb332awe98a416bee909e68@mail.gmail.com> <38a0d8450902240951k1a4fdb57pbf020a4cde83969e@mail.gmail.com> Message-ID: >> Please see my mail about patches for the release: >> http://lists.cs.uiuc.edu/pipermail/llvmdev/2009-February/020043.html >> >> This must fix a regression (correctness) in llvm-test or dejagnu to be >> merged in. > > It fixes a correctness regression in dejagnu: the test included in the patch. Nope, sorry. -Tanya > >> -Tanya > > Cheers, > From clattner at apple.com Tue Feb 24 12:42:07 2009 From: clattner at apple.com (Chris Lattner) Date: Tue, 24 Feb 2009 10:42:07 -0800 Subject: [llvm-commits] [llvm] r65341 - in /llvm/trunk: lib/Target/X86/X86FastISel.cpp test/CodeGen/X86/fast-isel-tls.ll In-Reply-To: References: <200902232203.n1NM39Xf013577@zion.cs.uiuc.edu> <38a0d8450902240122u4eb332awe98a416bee909e68@mail.gmail.com> <38a0d8450902240951k1a4fdb57pbf020a4cde83969e@mail.gmail.com> Message-ID: On Feb 24, 2009, at 10:23 AM, Tanya M. Lattner wrote: > >>> Please see my mail about patches for the release: >>> http://lists.cs.uiuc.edu/pipermail/llvmdev/2009-February/020043.html >>> >>> This must fix a regression (correctness) in llvm-test or dejagnu >>> to be >>> merged in. >> >> It fixes a correctness regression in dejagnu: the test included in >> the patch. > > Nope, sorry. "regression" in this context means a test in the LLVM 2.5 release that fails with LLVM 2.6. -Chris From gohman at apple.com Tue Feb 24 12:55:53 2009 From: gohman at apple.com (Dan Gohman) Date: Tue, 24 Feb 2009 18:55:53 -0000 Subject: [llvm-commits] [llvm] r65382 - in /llvm/trunk: include/llvm/Analysis/ lib/Analysis/ lib/Transforms/Scalar/ test/Analysis/ScalarEvolution/ Message-ID: <200902241855.n1OItsau002947@zion.cs.uiuc.edu> Author: djg Date: Tue Feb 24 12:55:53 2009 New Revision: 65382 URL: http://llvm.org/viewvc/llvm-project?rev=65382&view=rev Log: Rename ScalarEvolution's getIterationCount to getBackedgeTakenCount, to more accurately describe what it does. Expand its doxygen comment to describe what the backedge-taken count is and how it differs from the actual iteration count of the loop. Adjust names and comments in associated code accordingly. Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolution.h llvm/trunk/lib/Analysis/LoopVR.cpp llvm/trunk/lib/Analysis/ScalarEvolution.cpp llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp llvm/trunk/test/Analysis/ScalarEvolution/2007-07-15-NegativeStride.ll llvm/trunk/test/Analysis/ScalarEvolution/2007-08-06-Unsigned.ll llvm/trunk/test/Analysis/ScalarEvolution/2007-09-27-LargeStepping.ll llvm/trunk/test/Analysis/ScalarEvolution/2008-02-11-ReversedCondition.ll llvm/trunk/test/Analysis/ScalarEvolution/2008-02-12-SMAXTripCount.ll llvm/trunk/test/Analysis/ScalarEvolution/2008-05-25-NegativeStepToZero.ll llvm/trunk/test/Analysis/ScalarEvolution/2008-07-19-WrappingIV.ll llvm/trunk/test/Analysis/ScalarEvolution/2008-07-29-SGTTripCount.ll llvm/trunk/test/Analysis/ScalarEvolution/2008-07-29-SMinExpr.ll llvm/trunk/test/Analysis/ScalarEvolution/2008-11-18-LessThanOrEqual.ll llvm/trunk/test/Analysis/ScalarEvolution/2008-12-08-FiniteSGE.ll llvm/trunk/test/Analysis/ScalarEvolution/SolveQuadraticEquation.ll llvm/trunk/test/Analysis/ScalarEvolution/avoid-smax-0.ll llvm/trunk/test/Analysis/ScalarEvolution/trip-count.ll llvm/trunk/test/Analysis/ScalarEvolution/trip-count2.ll Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolution.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ScalarEvolution.h?rev=65382&r1=65381&r2=65382&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/ScalarEvolution.h (original) +++ llvm/trunk/include/llvm/Analysis/ScalarEvolution.h Tue Feb 24 12:55:53 2009 @@ -298,18 +298,28 @@ bool isLoopGuardedByCond(const Loop *L, ICmpInst::Predicate Pred, SCEV *LHS, SCEV *RHS); - /// getIterationCount - If the specified loop has a predictable iteration - /// count, return it, otherwise return a SCEVCouldNotCompute object. - SCEVHandle getIterationCount(const Loop *L) const; - - /// hasLoopInvariantIterationCount - Return true if the specified loop has - /// an analyzable loop-invariant iteration count. - bool hasLoopInvariantIterationCount(const Loop *L) const; + /// getBackedgeTakenCount - If the specified loop has a predictable + /// backedge-taken count, return it, otherwise return a SCEVCouldNotCompute + /// object. The backedge-taken count is the number of times the loop header + /// will be branched to from within the loop. This is one less than the + /// trip count of the loop, since it doesn't count the first iteration, + /// when the header is branched to from outside the loop. + /// + /// Note that it is not valid to call this method on a loop without a + /// loop-invariant backedge-taken count (see + /// hasLoopInvariantBackedgeTakenCount). + /// + SCEVHandle getBackedgeTakenCount(const Loop *L) const; + + /// hasLoopInvariantBackedgeTakenCount - Return true if the specified loop + /// has an analyzable loop-invariant backedge-taken count. + bool hasLoopInvariantBackedgeTakenCount(const Loop *L) const; - /// forgetLoopIterationCount - This method should be called by the + /// forgetLoopBackedgeTakenCount - This method should be called by the /// client when it has changed a loop in a way that may effect - /// ScalarEvolution's ability to compute a trip count. - void forgetLoopIterationCount(const Loop *L); + /// ScalarEvolution's ability to compute a trip count, or if the loop + /// is deleted. + void forgetLoopBackedgeTakenCount(const Loop *L); /// deleteValueFromRecords - This method should be called by the /// client before it removes a Value from the program, to make sure Modified: llvm/trunk/lib/Analysis/LoopVR.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LoopVR.cpp?rev=65382&r1=65381&r2=65382&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/LoopVR.cpp (original) +++ llvm/trunk/lib/Analysis/LoopVR.cpp Tue Feb 24 12:55:53 2009 @@ -27,7 +27,7 @@ /// getRange - determine the range for a particular SCEV within a given Loop ConstantRange LoopVR::getRange(SCEVHandle S, Loop *L, ScalarEvolution &SE) { - SCEVHandle T = SE.getIterationCount(L); + SCEVHandle T = SE.getBackedgeTakenCount(L); if (isa(T)) return ConstantRange(cast(S->getType())->getBitWidth(), true); Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=65382&r1=65381&r2=65382&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original) +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Tue Feb 24 12:55:53 2009 @@ -1419,9 +1419,9 @@ /// std::map Scalars; - /// IterationCounts - Cache the iteration count of the loops for this - /// function as they are computed. - std::map IterationCounts; + /// BackedgeTakenCounts - Cache the backedge-taken count of the loops for + /// this function as they are computed. + std::map BackedgeTakenCounts; /// ConstantEvolutionLoopExitValue - This map contains entries for all of /// the PHI instructions that we attempt to compute constant evolutions for. @@ -1464,19 +1464,28 @@ bool isLoopGuardedByCond(const Loop *L, ICmpInst::Predicate Pred, SCEV *LHS, SCEV *RHS); - /// hasLoopInvariantIterationCount - Return true if the specified loop has - /// an analyzable loop-invariant iteration count. - bool hasLoopInvariantIterationCount(const Loop *L); + /// hasLoopInvariantBackedgeTakenCount - Return true if the specified loop + /// has an analyzable loop-invariant backedge-taken count. + bool hasLoopInvariantBackedgeTakenCount(const Loop *L); - /// forgetLoopIterationCount - This method should be called by the + /// forgetLoopBackedgeTakenCount - This method should be called by the /// client when it has changed a loop in a way that may effect - /// ScalarEvolution's ability to compute a trip count. - void forgetLoopIterationCount(const Loop *L); - - /// getIterationCount - If the specified loop has a predictable iteration - /// count, return it. Note that it is not valid to call this method on a - /// loop without a loop-invariant iteration count. - SCEVHandle getIterationCount(const Loop *L); + /// ScalarEvolution's ability to compute a trip count, or if the loop + /// is deleted. + void forgetLoopBackedgeTakenCount(const Loop *L); + + /// getBackedgeTakenCount - If the specified loop has a predictable + /// backedge-taken count, return it, otherwise return a SCEVCouldNotCompute + /// object. The backedge-taken count is the number of times the loop header + /// will be branched to from within the loop. This is one less than the + /// trip count of the loop, since it doesn't count the first iteration, + /// when the header is branched to from outside the loop. + /// + /// Note that it is not valid to call this method on a loop without a + /// loop-invariant backedge-taken count (see + /// hasLoopInvariantBackedgeTakenCount). + /// + SCEVHandle getBackedgeTakenCount(const Loop *L); /// deleteValueFromRecords - This method should be called by the /// client before it removes a value from the program, to make sure @@ -1500,24 +1509,25 @@ const SCEVHandle &SymName, const SCEVHandle &NewVal); - /// ComputeIterationCount - Compute the number of times the specified loop - /// will iterate. - SCEVHandle ComputeIterationCount(const Loop *L); - - /// ComputeLoadConstantCompareIterationCount - Given an exit condition of - /// 'icmp op load X, cst', try to see if we can compute the trip count. - SCEVHandle ComputeLoadConstantCompareIterationCount(LoadInst *LI, - Constant *RHS, - const Loop *L, - ICmpInst::Predicate p); + /// ComputeBackedgeTakenCount - Compute the number of times the specified + /// loop will iterate. + SCEVHandle ComputeBackedgeTakenCount(const Loop *L); + + /// ComputeLoadConstantCompareBackedgeTakenCount - Given an exit condition + /// of 'icmp op load X, cst', try to see if we can compute the trip count. + SCEVHandle + ComputeLoadConstantCompareBackedgeTakenCount(LoadInst *LI, + Constant *RHS, + const Loop *L, + ICmpInst::Predicate p); - /// ComputeIterationCountExhaustively - If the trip is known to execute a - /// constant number of times (the condition evolves only from constants), + /// ComputeBackedgeTakenCountExhaustively - If the trip is known to execute + /// a constant number of times (the condition evolves only from constants), /// try to evaluate a few iterations of the loop until we get the exit /// condition gets a value of ExitWhen (true or false). If we cannot /// evaluate the trip count of the loop, return UnknownValue. - SCEVHandle ComputeIterationCountExhaustively(const Loop *L, Value *Cond, - bool ExitWhen); + SCEVHandle ComputeBackedgeTakenCountExhaustively(const Loop *L, Value *Cond, + bool ExitWhen); /// HowFarToZero - Return the number of times a backedge comparing the /// specified value to zero will execute. If not computable, return @@ -1545,7 +1555,7 @@ /// in the header of its containing loop, we know the loop executes a /// constant number of times, and the PHI node is just a recurrence /// involving constants, fold it. - Constant *getConstantEvolutionLoopExitValue(PHINode *PN, const APInt& Its, + Constant *getConstantEvolutionLoopExitValue(PHINode *PN, const APInt& BEs, const Loop *L); }; } @@ -1931,14 +1941,22 @@ // Iteration Count Computation Code // -/// getIterationCount - If the specified loop has a predictable iteration -/// count, return it. Note that it is not valid to call this method on a -/// loop without a loop-invariant iteration count. -SCEVHandle ScalarEvolutionsImpl::getIterationCount(const Loop *L) { - std::map::iterator I = IterationCounts.find(L); - if (I == IterationCounts.end()) { - SCEVHandle ItCount = ComputeIterationCount(L); - I = IterationCounts.insert(std::make_pair(L, ItCount)).first; +/// getBackedgeTakenCount - If the specified loop has a predictable +/// backedge-taken count, return it, otherwise return a SCEVCouldNotCompute +/// object. The backedge-taken count is the number of times the loop header +/// will be branched to from within the loop. This is one less than the +/// trip count of the loop, since it doesn't count the first iteration, +/// when the header is branched to from outside the loop. +/// +/// Note that it is not valid to call this method on a loop without a +/// loop-invariant backedge-taken count (see +/// hasLoopInvariantBackedgeTakenCount). +/// +SCEVHandle ScalarEvolutionsImpl::getBackedgeTakenCount(const Loop *L) { + std::map::iterator I = BackedgeTakenCounts.find(L); + if (I == BackedgeTakenCounts.end()) { + SCEVHandle ItCount = ComputeBackedgeTakenCount(L); + I = BackedgeTakenCounts.insert(std::make_pair(L, ItCount)).first; if (ItCount != UnknownValue) { assert(ItCount->isLoopInvariant(L) && "Computed trip count isn't loop invariant for loop!"); @@ -1951,16 +1969,17 @@ return I->second; } -/// forgetLoopIterationCount - This method should be called by the +/// forgetLoopBackedgeTakenCount - This method should be called by the /// client when it has changed a loop in a way that may effect -/// ScalarEvolution's ability to compute a trip count. -void ScalarEvolutionsImpl::forgetLoopIterationCount(const Loop *L) { - IterationCounts.erase(L); +/// ScalarEvolution's ability to compute a trip count, or if the loop +/// is deleted. +void ScalarEvolutionsImpl::forgetLoopBackedgeTakenCount(const Loop *L) { + BackedgeTakenCounts.erase(L); } -/// ComputeIterationCount - Compute the number of times the specified loop -/// will iterate. -SCEVHandle ScalarEvolutionsImpl::ComputeIterationCount(const Loop *L) { +/// ComputeBackedgeTakenCount - Compute the number of times the backedge +/// of the specified loop will execute. +SCEVHandle ScalarEvolutionsImpl::ComputeBackedgeTakenCount(const Loop *L) { // If the loop has a non-one exit block count, we can't analyze it. SmallVector ExitBlocks; L->getExitBlocks(ExitBlocks); @@ -2010,7 +2029,7 @@ // Note that ICmpInst deals with pointer comparisons too so we must check // the type of the operand. if (ExitCond == 0 || isa(ExitCond->getOperand(0)->getType())) - return ComputeIterationCountExhaustively(L, ExitBr->getCondition(), + return ComputeBackedgeTakenCountExhaustively(L, ExitBr->getCondition(), ExitBr->getSuccessor(0) == ExitBlock); // If the condition was exit on true, convert the condition to exit on false @@ -2024,7 +2043,7 @@ if (LoadInst *LI = dyn_cast(ExitCond->getOperand(0))) if (Constant *RHS = dyn_cast(ExitCond->getOperand(1))) { SCEVHandle ItCnt = - ComputeLoadConstantCompareIterationCount(LI, RHS, L, Cond); + ComputeLoadConstantCompareBackedgeTakenCount(LI, RHS, L, Cond); if (!isa(ItCnt)) return ItCnt; } @@ -2107,7 +2126,7 @@ } default: #if 0 - cerr << "ComputeIterationCount "; + cerr << "ComputeBackedgeTakenCount "; if (ExitCond->getOperand(0)->getType()->isUnsigned()) cerr << "[unsigned] "; cerr << *LHS << " " @@ -2116,8 +2135,9 @@ #endif break; } - return ComputeIterationCountExhaustively(L, ExitCond, - ExitBr->getSuccessor(0) == ExitBlock); + return + ComputeBackedgeTakenCountExhaustively(L, ExitCond, + ExitBr->getSuccessor(0) == ExitBlock); } static ConstantInt * @@ -2164,12 +2184,13 @@ return Init; } -/// ComputeLoadConstantCompareIterationCount - Given an exit condition of -/// 'icmp op load X, cst', try to see if we can compute the trip count. +/// ComputeLoadConstantCompareBackedgeTakenCount - Given an exit condition of +/// 'icmp op load X, cst', try to see if we can compute the backedge +/// execution count. SCEVHandle ScalarEvolutionsImpl:: -ComputeLoadConstantCompareIterationCount(LoadInst *LI, Constant *RHS, - const Loop *L, - ICmpInst::Predicate predicate) { +ComputeLoadConstantCompareBackedgeTakenCount(LoadInst *LI, Constant *RHS, + const Loop *L, + ICmpInst::Predicate predicate) { if (LI->isVolatile()) return UnknownValue; // Check to see if the loaded pointer is a getelementptr of a global. @@ -2326,13 +2347,13 @@ /// constant number of times, and the PHI node is just a recurrence /// involving constants, fold it. Constant *ScalarEvolutionsImpl:: -getConstantEvolutionLoopExitValue(PHINode *PN, const APInt& Its, const Loop *L){ +getConstantEvolutionLoopExitValue(PHINode *PN, const APInt& BEs, const Loop *L){ std::map::iterator I = ConstantEvolutionLoopExitValue.find(PN); if (I != ConstantEvolutionLoopExitValue.end()) return I->second; - if (Its.ugt(APInt(Its.getBitWidth(),MaxBruteForceIterations))) + if (BEs.ugt(APInt(BEs.getBitWidth(),MaxBruteForceIterations))) return ConstantEvolutionLoopExitValue[PN] = 0; // Not going to evaluate it. Constant *&RetVal = ConstantEvolutionLoopExitValue[PN]; @@ -2352,10 +2373,10 @@ return RetVal = 0; // Not derived from same PHI. // Execute the loop symbolically to determine the exit value. - if (Its.getActiveBits() >= 32) + if (BEs.getActiveBits() >= 32) return RetVal = 0; // More than 2^32-1 iterations?? Not doing it! - unsigned NumIterations = Its.getZExtValue(); // must be in range + unsigned NumIterations = BEs.getZExtValue(); // must be in range unsigned IterationNum = 0; for (Constant *PHIVal = StartCST; ; ++IterationNum) { if (IterationNum == NumIterations) @@ -2371,13 +2392,13 @@ } } -/// ComputeIterationCountExhaustively - If the trip is known to execute a +/// ComputeBackedgeTakenCountExhaustively - If the trip is known to execute a /// constant number of times (the condition evolves only from constants), /// try to evaluate a few iterations of the loop until we get the exit /// condition gets a value of ExitWhen (true or false). If we cannot /// evaluate the trip count of the loop, return UnknownValue. SCEVHandle ScalarEvolutionsImpl:: -ComputeIterationCountExhaustively(const Loop *L, Value *Cond, bool ExitWhen) { +ComputeBackedgeTakenCountExhaustively(const Loop *L, Value *Cond, bool ExitWhen) { PHINode *PN = getConstantEvolvingPHI(Cond, L); if (PN == 0) return UnknownValue; @@ -2440,15 +2461,17 @@ if (PHINode *PN = dyn_cast(I)) if (PN->getParent() == LI->getHeader()) { // Okay, there is no closed form solution for the PHI node. Check - // to see if the loop that contains it has a known iteration count. - // If so, we may be able to force computation of the exit value. - SCEVHandle IterationCount = getIterationCount(LI); - if (SCEVConstant *ICC = dyn_cast(IterationCount)) { + // to see if the loop that contains it has a known backedge-taken + // count. If so, we may be able to force computation of the exit + // value. + SCEVHandle BackedgeTakenCount = getBackedgeTakenCount(LI); + if (SCEVConstant *BTCC = + dyn_cast(BackedgeTakenCount)) { // Okay, we know how many times the containing loop executes. If // this is a constant evolving PHI node, get the final value at // the specified iteration number. Constant *RV = getConstantEvolutionLoopExitValue(PN, - ICC->getValue()->getValue(), + BTCC->getValue()->getValue(), LI); if (RV) return SE.getUnknown(RV); } @@ -2552,11 +2575,11 @@ if (!L || !AddRec->getLoop()->contains(L->getHeader())) { // To evaluate this recurrence, we need to know how many times the AddRec // loop iterates. Compute this now. - SCEVHandle IterationCount = getIterationCount(AddRec->getLoop()); - if (IterationCount == UnknownValue) return UnknownValue; + SCEVHandle BackedgeTakenCount = getBackedgeTakenCount(AddRec->getLoop()); + if (BackedgeTakenCount == UnknownValue) return UnknownValue; // Then, evaluate the AddRec. - return AddRec->evaluateAtIteration(IterationCount, SE); + return AddRec->evaluateAtIteration(BackedgeTakenCount, SE); } return UnknownValue; } @@ -3110,16 +3133,16 @@ LHS, RHS); } -SCEVHandle ScalarEvolution::getIterationCount(const Loop *L) const { - return ((ScalarEvolutionsImpl*)Impl)->getIterationCount(L); +SCEVHandle ScalarEvolution::getBackedgeTakenCount(const Loop *L) const { + return ((ScalarEvolutionsImpl*)Impl)->getBackedgeTakenCount(L); } -bool ScalarEvolution::hasLoopInvariantIterationCount(const Loop *L) const { - return !isa(getIterationCount(L)); +bool ScalarEvolution::hasLoopInvariantBackedgeTakenCount(const Loop *L) const { + return !isa(getBackedgeTakenCount(L)); } -void ScalarEvolution::forgetLoopIterationCount(const Loop *L) { - return ((ScalarEvolutionsImpl*)Impl)->forgetLoopIterationCount(L); +void ScalarEvolution::forgetLoopBackedgeTakenCount(const Loop *L) { + return ((ScalarEvolutionsImpl*)Impl)->forgetLoopBackedgeTakenCount(L); } SCEVHandle ScalarEvolution::getSCEVAtScope(Value *V, const Loop *L) const { @@ -3143,10 +3166,10 @@ if (ExitBlocks.size() != 1) OS << " "; - if (SE->hasLoopInvariantIterationCount(L)) { - OS << *SE->getIterationCount(L) << " iterations! "; + if (SE->hasLoopInvariantBackedgeTakenCount(L)) { + OS << "backedge-taken count is " << *SE->getBackedgeTakenCount(L); } else { - OS << "Unpredictable iteration count. "; + OS << "Unpredictable backedge-taken count. "; } OS << "\n"; Modified: llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp?rev=65382&r1=65381&r2=65382&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp Tue Feb 24 12:55:53 2009 @@ -93,12 +93,12 @@ void EliminatePointerRecurrence(PHINode *PN, BasicBlock *Preheader, SmallPtrSet &DeadInsts); - void LinearFunctionTestReplace(Loop *L, SCEVHandle IterationCount, + void LinearFunctionTestReplace(Loop *L, SCEVHandle BackedgeTakenCount, Value *IndVar, BasicBlock *ExitingBlock, BranchInst *BI, SCEVExpander &Rewriter); - void RewriteLoopExitValues(Loop *L, SCEV *IterationCount); + void RewriteLoopExitValues(Loop *L, SCEV *BackedgeTakenCount); void DeleteTriviallyDeadInstructions(SmallPtrSet &Insts); @@ -232,7 +232,7 @@ /// SCEV analysis can determine a loop-invariant trip count of the loop, which /// is actually a much broader range than just linear tests. void IndVarSimplify::LinearFunctionTestReplace(Loop *L, - SCEVHandle IterationCount, + SCEVHandle BackedgeTakenCount, Value *IndVar, BasicBlock *ExitingBlock, BranchInst *BI, @@ -241,43 +241,41 @@ // against the preincremented value, otherwise we prefer to compare against // the post-incremented value. Value *CmpIndVar; + SCEVHandle RHS = BackedgeTakenCount; if (ExitingBlock == L->getLoopLatch()) { - // What ScalarEvolution calls the "iteration count" is actually the - // number of times the branch is taken. Add one to get the number - // of times the branch is executed. If this addition may overflow, - // we have to be more pessimistic and cast the induction variable - // before doing the add. - SCEVHandle Zero = SE->getIntegerSCEV(0, IterationCount->getType()); + // Add one to the "backedge-taken" count to get the trip count. + // If this addition may overflow, we have to be more pessimistic and + // cast the induction variable before doing the add. + SCEVHandle Zero = SE->getIntegerSCEV(0, BackedgeTakenCount->getType()); SCEVHandle N = - SE->getAddExpr(IterationCount, - SE->getIntegerSCEV(1, IterationCount->getType())); + SE->getAddExpr(BackedgeTakenCount, + SE->getIntegerSCEV(1, BackedgeTakenCount->getType())); if ((isa(N) && !N->isZero()) || SE->isLoopGuardedByCond(L, ICmpInst::ICMP_NE, N, Zero)) { // No overflow. Cast the sum. - IterationCount = SE->getTruncateOrZeroExtend(N, IndVar->getType()); + RHS = SE->getTruncateOrZeroExtend(N, IndVar->getType()); } else { // Potential overflow. Cast before doing the add. - IterationCount = SE->getTruncateOrZeroExtend(IterationCount, - IndVar->getType()); - IterationCount = - SE->getAddExpr(IterationCount, - SE->getIntegerSCEV(1, IndVar->getType())); + RHS = SE->getTruncateOrZeroExtend(BackedgeTakenCount, + IndVar->getType()); + RHS = SE->getAddExpr(RHS, + SE->getIntegerSCEV(1, IndVar->getType())); } - // The IterationCount expression contains the number of times that the - // backedge actually branches to the loop header. This is one less than the - // number of times the loop executes, so add one to it. + // The BackedgeTaken expression contains the number of times that the + // backedge branches to the loop header. This is one less than the + // number of times the loop executes, so use the incremented indvar. CmpIndVar = L->getCanonicalInductionVariableIncrement(); } else { // We have to use the preincremented value... - IterationCount = SE->getTruncateOrZeroExtend(IterationCount, - IndVar->getType()); + RHS = SE->getTruncateOrZeroExtend(BackedgeTakenCount, + IndVar->getType()); CmpIndVar = IndVar; } // Expand the code for the iteration count into the preheader of the loop. BasicBlock *Preheader = L->getLoopPreheader(); - Value *ExitCnt = Rewriter.expandCodeFor(IterationCount, + Value *ExitCnt = Rewriter.expandCodeFor(RHS, Preheader->getTerminator()); // Insert a new icmp_ne or icmp_eq instruction before the branch. @@ -291,7 +289,7 @@ << " LHS:" << *CmpIndVar // includes a newline << " op:\t" << (Opcode == ICmpInst::ICMP_NE ? "!=" : "==") << "\n" - << " RHS:\t" << *IterationCount << "\n"; + << " RHS:\t" << *RHS << "\n"; Value *Cond = new ICmpInst(Opcode, CmpIndVar, ExitCnt, "exitcond", BI); BI->setCondition(Cond); @@ -304,7 +302,7 @@ /// final value of any expressions that are recurrent in the loop, and /// substitute the exit values from the loop into any instructions outside of /// the loop that use the final values of the current expressions. -void IndVarSimplify::RewriteLoopExitValues(Loop *L, SCEV *IterationCount) { +void IndVarSimplify::RewriteLoopExitValues(Loop *L, SCEV *BackedgeTakenCount) { BasicBlock *Preheader = L->getLoopPreheader(); // Scan all of the instructions in the loop, looking at those that have @@ -322,7 +320,7 @@ BlockToInsertInto = Preheader; BasicBlock::iterator InsertPt = BlockToInsertInto->getFirstNonPHI(); - bool HasConstantItCount = isa(IterationCount); + bool HasConstantItCount = isa(BackedgeTakenCount); SmallPtrSet InstructionsToDelete; std::map ExitValues; @@ -435,7 +433,7 @@ // may not have been able to compute a trip count. Now that we've done some // re-writing, the trip count may be computable. if (Changed) - SE->forgetLoopIterationCount(L); + SE->forgetLoopBackedgeTakenCount(L); if (!DeadInsts.empty()) DeleteTriviallyDeadInstructions(DeadInsts); @@ -473,7 +471,8 @@ /// variables, return the PHI for this induction variable. /// /// TODO: This duplicates a fair amount of ScalarEvolution logic. -/// Perhaps this can be merged with ScalarEvolution::getIterationCount +/// Perhaps this can be merged with +/// ScalarEvolution::getBackedgeTakenCount /// and/or ScalarEvolution::get{Sign,Zero}ExtendExpr. /// static const PHINode *TestOrigIVForWrap(const Loop *L, @@ -622,9 +621,9 @@ // loop into any instructions outside of the loop that use the final values of // the current expressions. // - SCEVHandle IterationCount = SE->getIterationCount(L); - if (!isa(IterationCount)) - RewriteLoopExitValues(L, IterationCount); + SCEVHandle BackedgeTakenCount = SE->getBackedgeTakenCount(L); + if (!isa(BackedgeTakenCount)) + RewriteLoopExitValues(L, BackedgeTakenCount); // Next, analyze all of the induction variables in the loop, canonicalizing // auxillary induction variables. @@ -649,9 +648,9 @@ // the set of the types of the other recurrence expressions. const Type *LargestType = 0; SmallSetVector SizesToInsert; - if (!isa(IterationCount)) { - LargestType = IterationCount->getType(); - SizesToInsert.insert(IterationCount->getType()); + if (!isa(BackedgeTakenCount)) { + LargestType = BackedgeTakenCount->getType(); + SizesToInsert.insert(BackedgeTakenCount->getType()); } for (unsigned i = 0, e = IndVars.size(); i != e; ++i) { const PHINode *PN = IndVars[i].first; @@ -682,7 +681,7 @@ bool NoSignedWrap = false; bool NoUnsignedWrap = false; const PHINode *OrigControllingPHI = 0; - if (!isa(IterationCount) && ExitingBlock) + if (!isa(BackedgeTakenCount) && ExitingBlock) // Can't rewrite non-branch yet. if (BranchInst *BI = dyn_cast(ExitingBlock->getTerminator())) { if (Instruction *OrigCond = dyn_cast(BI->getCondition())) { @@ -695,7 +694,7 @@ DeadInsts.insert(OrigCond); } - LinearFunctionTestReplace(L, IterationCount, IndVar, + LinearFunctionTestReplace(L, BackedgeTakenCount, IndVar, ExitingBlock, BI, Rewriter); } Modified: llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp?rev=65382&r1=65381&r2=65382&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp Tue Feb 24 12:55:53 2009 @@ -190,7 +190,7 @@ // Don't remove loops for which we can't solve the trip count. // They could be infinite, in which case we'd be changing program behavior. ScalarEvolution& SE = getAnalysis(); - SCEVHandle S = SE.getIterationCount(L); + SCEVHandle S = SE.getBackedgeTakenCount(L); if (isa(S)) return false; @@ -267,7 +267,7 @@ (*LI)->eraseFromParent(); // Tell ScalarEvolution that the loop is deleted. - SE.forgetLoopIterationCount(L); + SE.forgetLoopBackedgeTakenCount(L); // Finally, the blocks from loopinfo. This has to happen late because // otherwise our loop iterators won't work. Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=65382&r1=65381&r2=65382&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Tue Feb 24 12:55:53 2009 @@ -2351,13 +2351,13 @@ SelectInst *Sel = dyn_cast(Cond->getOperand(1)); if (!Sel || !Sel->hasOneUse()) return Cond; - SCEVHandle IterationCount = SE->getIterationCount(L); - if (isa(IterationCount)) + SCEVHandle BackedgeTakenCount = SE->getBackedgeTakenCount(L); + if (isa(BackedgeTakenCount)) return Cond; - SCEVHandle One = SE->getIntegerSCEV(1, IterationCount->getType()); + SCEVHandle One = SE->getIntegerSCEV(1, BackedgeTakenCount->getType()); - // Adjust for an annoying getIterationCount quirk. - IterationCount = SE->getAddExpr(IterationCount, One); + // Add one to the backedge-taken count to get the trip count. + SCEVHandle IterationCount = SE->getAddExpr(BackedgeTakenCount, One); // Check for a max calculation that matches the pattern. SCEVSMaxExpr *SMax = dyn_cast(IterationCount); @@ -2412,8 +2412,8 @@ /// inside the loop then try to eliminate the cast opeation. void LoopStrengthReduce::OptimizeShadowIV(Loop *L) { - SCEVHandle IterationCount = SE->getIterationCount(L); - if (isa(IterationCount)) + SCEVHandle BackedgeTakenCount = SE->getBackedgeTakenCount(L); + if (isa(BackedgeTakenCount)) return; for (unsigned Stride = 0, e = StrideOrder.size(); Stride != e; Modified: llvm/trunk/test/Analysis/ScalarEvolution/2007-07-15-NegativeStride.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/2007-07-15-NegativeStride.ll?rev=65382&r1=65381&r2=65382&view=diff ============================================================================== --- llvm/trunk/test/Analysis/ScalarEvolution/2007-07-15-NegativeStride.ll (original) +++ llvm/trunk/test/Analysis/ScalarEvolution/2007-07-15-NegativeStride.ll Tue Feb 24 12:55:53 2009 @@ -1,5 +1,5 @@ ; RUN: llvm-as < %s | opt -analyze -scalar-evolution \ -; RUN: -scalar-evolution-max-iterations=0 | grep {Loop bb: 100 iterations} +; RUN: -scalar-evolution-max-iterations=0 | grep {Loop bb: backedge-taken count is 100} ; PR1533 @array = weak global [101 x i32] zeroinitializer, align 32 ; <[100 x i32]*> [#uses=1] Modified: llvm/trunk/test/Analysis/ScalarEvolution/2007-08-06-Unsigned.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/2007-08-06-Unsigned.ll?rev=65382&r1=65381&r2=65382&view=diff ============================================================================== --- llvm/trunk/test/Analysis/ScalarEvolution/2007-08-06-Unsigned.ll (original) +++ llvm/trunk/test/Analysis/ScalarEvolution/2007-08-06-Unsigned.ll Tue Feb 24 12:55:53 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -scalar-evolution -analyze | grep {Loop bb: (-1 + (-1 \\* %x) + %y) iterations!} +; RUN: llvm-as < %s | opt -scalar-evolution -analyze | grep {Loop bb: backedge-taken count is (-1 + (-1 \\* %x) + %y)} ; PR1597 define i32 @f(i32 %x, i32 %y) { Modified: llvm/trunk/test/Analysis/ScalarEvolution/2007-09-27-LargeStepping.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/2007-09-27-LargeStepping.ll?rev=65382&r1=65381&r2=65382&view=diff ============================================================================== --- llvm/trunk/test/Analysis/ScalarEvolution/2007-09-27-LargeStepping.ll (original) +++ llvm/trunk/test/Analysis/ScalarEvolution/2007-09-27-LargeStepping.ll Tue Feb 24 12:55:53 2009 @@ -1,5 +1,5 @@ ; RUN: llvm-as < %s | opt -analyze -scalar-evolution \ -; RUN: -scalar-evolution-max-iterations=0 | grep {13 iterations} +; RUN: -scalar-evolution-max-iterations=0 | grep {backedge-taken count is 13} ; PR1706 define i32 @f() { Modified: llvm/trunk/test/Analysis/ScalarEvolution/2008-02-11-ReversedCondition.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/2008-02-11-ReversedCondition.ll?rev=65382&r1=65381&r2=65382&view=diff ============================================================================== --- llvm/trunk/test/Analysis/ScalarEvolution/2008-02-11-ReversedCondition.ll (original) +++ llvm/trunk/test/Analysis/ScalarEvolution/2008-02-11-ReversedCondition.ll Tue Feb 24 12:55:53 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -scalar-evolution -analyze | grep {Loop header: (0 smax %n) iterations!} +; RUN: llvm-as < %s | opt -scalar-evolution -analyze | grep {Loop header: backedge-taken count is (0 smax %n)} define void @foo(i32 %n) { entry: Modified: llvm/trunk/test/Analysis/ScalarEvolution/2008-02-12-SMAXTripCount.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/2008-02-12-SMAXTripCount.ll?rev=65382&r1=65381&r2=65382&view=diff ============================================================================== --- llvm/trunk/test/Analysis/ScalarEvolution/2008-02-12-SMAXTripCount.ll (original) +++ llvm/trunk/test/Analysis/ScalarEvolution/2008-02-12-SMAXTripCount.ll Tue Feb 24 12:55:53 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -scalar-evolution -analyze | grep {Loop loop: (100 + (-100 smax %n)) iterations!} +; RUN: llvm-as < %s | opt -scalar-evolution -analyze | grep {Loop loop: backedge-taken count is (100 + (-100 smax %n))} ; PR2002 define void @foo(i8 %n) { Modified: llvm/trunk/test/Analysis/ScalarEvolution/2008-05-25-NegativeStepToZero.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/2008-05-25-NegativeStepToZero.ll?rev=65382&r1=65381&r2=65382&view=diff ============================================================================== --- llvm/trunk/test/Analysis/ScalarEvolution/2008-05-25-NegativeStepToZero.ll (original) +++ llvm/trunk/test/Analysis/ScalarEvolution/2008-05-25-NegativeStepToZero.ll Tue Feb 24 12:55:53 2009 @@ -1,5 +1,5 @@ ; RUN: llvm-as < %s | opt -analyze -scalar-evolution \ -; RUN: -scalar-evolution-max-iterations=0 | grep {61 iterations} +; RUN: -scalar-evolution-max-iterations=0 | grep {backedge-taken count is 61} ; PR2364 define i32 @func_6() nounwind { Modified: llvm/trunk/test/Analysis/ScalarEvolution/2008-07-19-WrappingIV.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/2008-07-19-WrappingIV.ll?rev=65382&r1=65381&r2=65382&view=diff ============================================================================== --- llvm/trunk/test/Analysis/ScalarEvolution/2008-07-19-WrappingIV.ll (original) +++ llvm/trunk/test/Analysis/ScalarEvolution/2008-07-19-WrappingIV.ll Tue Feb 24 12:55:53 2009 @@ -1,5 +1,5 @@ ; RUN: llvm-as < %s | opt -analyze -scalar-evolution \ -; RUN: -scalar-evolution-max-iterations=0 | grep {113 iterations} +; RUN: -scalar-evolution-max-iterations=0 | grep {backedge-taken count is 113} ; PR2088 define void @fun() { Modified: llvm/trunk/test/Analysis/ScalarEvolution/2008-07-29-SGTTripCount.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/2008-07-29-SGTTripCount.ll?rev=65382&r1=65381&r2=65382&view=diff ============================================================================== --- llvm/trunk/test/Analysis/ScalarEvolution/2008-07-29-SGTTripCount.ll (original) +++ llvm/trunk/test/Analysis/ScalarEvolution/2008-07-29-SGTTripCount.ll Tue Feb 24 12:55:53 2009 @@ -1,6 +1,6 @@ ; RUN: llvm-as < %s | opt -analyze -scalar-evolution -disable-output \ ; RUN: -scalar-evolution-max-iterations=0 | \ -; RUN: grep -F "(-1 + (-1 * %j)) iterations" +; RUN: grep -F "backedge-taken count is (-1 + (-1 * %j))" ; PR2607 define i32 @_Z1aj(i32 %j) nounwind { Modified: llvm/trunk/test/Analysis/ScalarEvolution/2008-07-29-SMinExpr.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/2008-07-29-SMinExpr.ll?rev=65382&r1=65381&r2=65382&view=diff ============================================================================== --- llvm/trunk/test/Analysis/ScalarEvolution/2008-07-29-SMinExpr.ll (original) +++ llvm/trunk/test/Analysis/ScalarEvolution/2008-07-29-SMinExpr.ll Tue Feb 24 12:55:53 2009 @@ -1,6 +1,6 @@ ; RUN: llvm-as < %s | opt -analyze -scalar-evolution -disable-output \ ; RUN: -scalar-evolution-max-iterations=0 | \ -; RUN: grep -F "(-2147483632 + (2147483632 smax (-1 + (-1 * %x)) smax (-1 + (-1 * %y)))) iterations" +; RUN: grep -F "backedge-taken count is (-2147483632 + (2147483632 smax (-1 + (-1 * %x)) smax (-1 + (-1 * %y))))" ; PR2607 define i32 @b(i32 %x, i32 %y) { Modified: llvm/trunk/test/Analysis/ScalarEvolution/2008-11-18-LessThanOrEqual.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/2008-11-18-LessThanOrEqual.ll?rev=65382&r1=65381&r2=65382&view=diff ============================================================================== --- llvm/trunk/test/Analysis/ScalarEvolution/2008-11-18-LessThanOrEqual.ll (original) +++ llvm/trunk/test/Analysis/ScalarEvolution/2008-11-18-LessThanOrEqual.ll Tue Feb 24 12:55:53 2009 @@ -1,5 +1,5 @@ ; RUN: llvm-as < %s | opt -analyze -scalar-evolution |& \ -; RUN: grep {Loop bb: (7 + (-1 \\* %argc)) iterations!} +; RUN: grep {Loop bb: backedge-taken count is (7 + (-1 \\* %argc))} ; XFAIL: * define i32 @main(i32 %argc, i8** %argv) nounwind { Modified: llvm/trunk/test/Analysis/ScalarEvolution/2008-12-08-FiniteSGE.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/2008-12-08-FiniteSGE.ll?rev=65382&r1=65381&r2=65382&view=diff ============================================================================== --- llvm/trunk/test/Analysis/ScalarEvolution/2008-12-08-FiniteSGE.ll (original) +++ llvm/trunk/test/Analysis/ScalarEvolution/2008-12-08-FiniteSGE.ll Tue Feb 24 12:55:53 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -analyze -scalar-evolution | grep {255 iterations} +; RUN: llvm-as < %s | opt -analyze -scalar-evolution | grep {backedge-taken count is 255} ; XFAIL: * define i32 @foo(i32 %x, i32 %y, i32* %lam, i32* %alp) nounwind { Modified: llvm/trunk/test/Analysis/ScalarEvolution/SolveQuadraticEquation.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/SolveQuadraticEquation.ll?rev=65382&r1=65381&r2=65382&view=diff ============================================================================== --- llvm/trunk/test/Analysis/ScalarEvolution/SolveQuadraticEquation.ll (original) +++ llvm/trunk/test/Analysis/ScalarEvolution/SolveQuadraticEquation.ll Tue Feb 24 12:55:53 2009 @@ -1,5 +1,5 @@ ; RUN: llvm-as < %s | opt -analyze -scalar-evolution \ -; RUN: -scalar-evolution-max-iterations=0 | grep {100 iterations} +; RUN: -scalar-evolution-max-iterations=0 | grep {backedge-taken count is 100} ; PR1101 @A = weak global [1000 x i32] zeroinitializer, align 32 Modified: llvm/trunk/test/Analysis/ScalarEvolution/avoid-smax-0.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/avoid-smax-0.ll?rev=65382&r1=65381&r2=65382&view=diff ============================================================================== --- llvm/trunk/test/Analysis/ScalarEvolution/avoid-smax-0.ll (original) +++ llvm/trunk/test/Analysis/ScalarEvolution/avoid-smax-0.ll Tue Feb 24 12:55:53 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -scalar-evolution -analyze | grep {Loop bb3: (-1 + %n) iterations!} +; RUN: llvm-as < %s | opt -scalar-evolution -analyze | grep {Loop bb3: backedge-taken count is (-1 + %n)} ; We don't want to use a max in the trip count expression in ; this testcase. Modified: llvm/trunk/test/Analysis/ScalarEvolution/trip-count.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/trip-count.ll?rev=65382&r1=65381&r2=65382&view=diff ============================================================================== --- llvm/trunk/test/Analysis/ScalarEvolution/trip-count.ll (original) +++ llvm/trunk/test/Analysis/ScalarEvolution/trip-count.ll Tue Feb 24 12:55:53 2009 @@ -1,5 +1,5 @@ ; RUN: llvm-as < %s | opt -analyze -scalar-evolution \ -; RUN: -scalar-evolution-max-iterations=0 | grep {10000 iterations} +; RUN: -scalar-evolution-max-iterations=0 | grep {backedge-taken count is 10000} ; PR1101 @A = weak global [1000 x i32] zeroinitializer, align 32 Modified: llvm/trunk/test/Analysis/ScalarEvolution/trip-count2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/trip-count2.ll?rev=65382&r1=65381&r2=65382&view=diff ============================================================================== --- llvm/trunk/test/Analysis/ScalarEvolution/trip-count2.ll (original) +++ llvm/trunk/test/Analysis/ScalarEvolution/trip-count2.ll Tue Feb 24 12:55:53 2009 @@ -1,5 +1,5 @@ ; RUN: llvm-as < %s | opt -analyze -scalar-evolution | \ -; RUN: grep {4 iterations} +; RUN: grep {backedge-taken count is 4} ; PR1101 @A = weak global [1000 x i32] zeroinitializer, align 32 From daniel at zuster.org Tue Feb 24 13:10:46 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 24 Feb 2009 19:10:46 -0000 Subject: [llvm-commits] [llvm] r65383 - /llvm/trunk/lib/VMCore/ConstantFold.cpp Message-ID: <200902241910.n1OJAkCt003465@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Feb 24 13:10:46 2009 New Revision: 65383 URL: http://llvm.org/viewvc/llvm-project?rev=65383&view=rev Log: Extension of GEP in constant folder was broken (apparently this code has never been run!). - Sorry, don't know how to make an LLVM test case for this. Modified: llvm/trunk/lib/VMCore/ConstantFold.cpp Modified: llvm/trunk/lib/VMCore/ConstantFold.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ConstantFold.cpp?rev=65383&r1=65382&r2=65383&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/ConstantFold.cpp (original) +++ llvm/trunk/lib/VMCore/ConstantFold.cpp Tue Feb 24 13:10:46 2009 @@ -1664,7 +1664,7 @@ Offset = ConstantExpr::getSExt(Offset, Base->getType()); else if (Base->getType()->getPrimitiveSizeInBits() < Offset->getType()->getPrimitiveSizeInBits()) - Base = ConstantExpr::getZExt(Base, Base->getType()); + Base = ConstantExpr::getZExt(Base, Offset->getType()); Base = ConstantExpr::getAdd(Base, Offset); return ConstantExpr::getIntToPtr(Base, CE->getType()); From zhousheng at autoesl.com Tue Feb 24 02:28:11 2009 From: zhousheng at autoesl.com (Sheng Zhou) Date: Tue, 24 Feb 2009 16:28:11 +0800 Subject: [llvm-commits] [llvm] r65356 - in /llvm/branches/Apple/Dib:, lib/CodeGen/AsmPrinter/DwarfWriter.cpp, lib/Transforms/Utils/BasicBlockUtils.cpp, lib/Transforms/Utils/SimplifyCFG.cpp, test/Transforms/SimplifyCFG/dbginfo.ll Message-ID: <49A3AF9B.2010200@autoesl.com> Hi Patel, > Author: dpatel > Date: Mon Feb 23 18:05:16 2009 > New Revision: 65353 > > URL: http://llvm.org/viewvc/llvm-project?rev=65353&view=rev > Log: > While folding unconditional return move DbgRegionEndInst into the predecessor, instead of removing it. This fixes following tests from llvmgcc42 testsuite. > > gcc.c-torture/execute/20000605-3.c > gcc.c-torture/execute/20020619-1.c > gcc.c-torture/execute/20030920-1.c > gcc.c-torture/execute/loop-ivopts-1.c > > > Modified: > llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp > llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp > llvm/trunk/test/Transforms/SimplifyCFG/dbginfo.ll > Attached is a .ll case (before.ll). And with your change, I got "after.ll" after pass -simplifycfg which folded unconditional return and moved DbgRegionEndInst into pred. The question is in after.ll now there are two "ret" instructions in two basic blocks: ... bb3.bb5.loopexit_crit_edge: ; preds = %bb2 %tmp = add i32 %x, -1 ; [#uses=2] %tmp4 = add i32 %x, %y ; [#uses=1] %tmp5 = mul i32 %tmp, %tmp4 ; [#uses=1] %tmp6 = add i32 %tmp5, %x ; [#uses=1] %tmp7 = add i32 %x, -2 ; [#uses=1] %tmp. = zext i32 %tmp7 to i33 ; [#uses=1] %tmp.8 = zext i32 %tmp to i33 ; [#uses=1] %tmp9 = mul i33 %tmp., %tmp.8 ; [#uses=1] %tmp10 = lshr i33 %tmp9, 1 ; [#uses=1] %tmp.11 = trunc i33 %tmp10 to i32 ; [#uses=1] %tmp12 = mul i32 %tmp.11, %y ; [#uses=1] %tmp13 = add i32 %tmp6, %tmp12 ; [#uses=1] tail call void @llvm.dbg.region.end({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*)) ret i32 %tmp13 bb5: ; preds = %entry tail call void @llvm.dbg.stoppoint(i32 10, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) ret i32 0 You move the DbgRegionEndInst from bb5 into its pred. bb3.bb5.loopexit_crit_edge. Is this OK? I think for this case, the DbgRegionEndInst should be kept in bb5. Sheng. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: after.ll Url: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090224/e1e9b8dd/attachment.pl -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: before.ll Url: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090224/e1e9b8dd/attachment-0001.pl From dpatel at apple.com Tue Feb 24 14:58:47 2009 From: dpatel at apple.com (Devang Patel) Date: Tue, 24 Feb 2009 12:58:47 -0800 Subject: [llvm-commits] [llvm] r65356 - in /llvm/branches/Apple/Dib:, lib/CodeGen/AsmPrinter/DwarfWriter.cpp, lib/Transforms/Utils/BasicBlockUtils.cpp, lib/Transforms/Utils/SimplifyCFG.cpp, test/Transforms/SimplifyCFG/dbginfo.ll In-Reply-To: <49A3AF9B.2010200@autoesl.com> References: <49A3AF9B.2010200@autoesl.com> Message-ID: <755AB232-2660-4EAB-BC39-29511FF724D0@apple.com> On Feb 24, 2009, at 12:28 AM, Sheng Zhou wrote: > Hi Patel, > >> Author: dpatel >> Date: Mon Feb 23 18:05:16 2009 >> New Revision: 65353 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=65353&view=rev >> Log: >> While folding unconditional return move DbgRegionEndInst into the >> predecessor, instead of removing it. This fixes following tests >> from llvmgcc42 testsuite. >> >> gcc.c-torture/execute/20000605-3.c >> gcc.c-torture/execute/20020619-1.c >> gcc.c-torture/execute/20030920-1.c >> gcc.c-torture/execute/loop-ivopts-1.c >> >> >> Modified: >> llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp >> llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp >> llvm/trunk/test/Transforms/SimplifyCFG/dbginfo.ll >> > Attached is a .ll case (before.ll). And with your change, I got > "after.ll" after pass -simplifycfg which folded unconditional return > and > moved DbgRegionEndInst into pred. The question is in after.ll now > there > are two "ret" instructions in two basic blocks: I do not understand. As far as I can tell, this patch has no impact on your test case. - Devang From kremenek at apple.com Tue Feb 24 16:24:51 2009 From: kremenek at apple.com (Ted Kremenek) Date: Tue, 24 Feb 2009 22:24:51 -0000 Subject: [llvm-commits] [llvm] r65392 - /llvm/tags/checker/checker-0.164/ Message-ID: <200902242224.n1OMOpEQ010081@zion.cs.uiuc.edu> Author: kremenek Date: Tue Feb 24 16:24:51 2009 New Revision: 65392 URL: http://llvm.org/viewvc/llvm-project?rev=65392&view=rev Log: Tagging checker-0.164. Added: llvm/tags/checker/checker-0.164/ - copied from r65391, llvm/trunk/ From dpatel at apple.com Tue Feb 24 17:15:09 2009 From: dpatel at apple.com (Devang Patel) Date: Tue, 24 Feb 2009 23:15:09 -0000 Subject: [llvm-commits] [llvm] r65402 - /llvm/trunk/lib/Analysis/DebugInfo.cpp Message-ID: <200902242315.n1ONF9IM012025@zion.cs.uiuc.edu> Author: dpatel Date: Tue Feb 24 17:15:09 2009 New Revision: 65402 URL: http://llvm.org/viewvc/llvm-project?rev=65402&view=rev Log: If compile unit's language is not set then don't crash while dump'ing compile unit. Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DebugInfo.cpp?rev=65402&r1=65401&r2=65402&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/DebugInfo.cpp (original) +++ llvm/trunk/lib/Analysis/DebugInfo.cpp Tue Feb 24 17:15:09 2009 @@ -862,7 +862,8 @@ /// dump - print compile unit. void DICompileUnit::dump() const { - cerr << " [" << dwarf::LanguageString(getLanguage()) << "] "; + if (getLanguage()) + cerr << " [" << dwarf::LanguageString(getLanguage()) << "] "; cerr << " [" << getDirectory() << "/" << getFilename() << " ]"; } From wangmp at apple.com Tue Feb 24 17:17:49 2009 From: wangmp at apple.com (Mon P Wang) Date: Tue, 24 Feb 2009 23:17:49 -0000 Subject: [llvm-commits] [llvm] r65404 - in /llvm/trunk: include/llvm/Intrinsics.h include/llvm/Target/TargetIntrinsicInfo.h lib/VMCore/Function.cpp utils/TableGen/IntrinsicEmitter.cpp utils/TableGen/IntrinsicEmitter.h Message-ID: <200902242317.n1ONHobD012140@zion.cs.uiuc.edu> Author: wangmp Date: Tue Feb 24 17:17:49 2009 New Revision: 65404 URL: http://llvm.org/viewvc/llvm-project?rev=65404&view=rev Log: Added support to have TableGen provide information if an intrinsic (core or target) can be overloaded or not. Modified: llvm/trunk/include/llvm/Intrinsics.h llvm/trunk/include/llvm/Target/TargetIntrinsicInfo.h llvm/trunk/lib/VMCore/Function.cpp llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp llvm/trunk/utils/TableGen/IntrinsicEmitter.h Modified: llvm/trunk/include/llvm/Intrinsics.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Intrinsics.h?rev=65404&r1=65403&r2=65404&view=diff ============================================================================== --- llvm/trunk/include/llvm/Intrinsics.h (original) +++ llvm/trunk/include/llvm/Intrinsics.h Tue Feb 24 17:17:49 2009 @@ -49,6 +49,10 @@ /// const FunctionType *getType(ID id, const Type **Tys = 0, unsigned numTys = 0); + /// Intrinsic::isOverloaded(ID) - Returns true if the intrinsic can be + /// overloaded. + bool isOverloaded(ID id); + /// Intrinsic::getAttributes(ID) - Return the attributes for an intrinsic. /// AttrListPtr getAttributes(ID id); Modified: llvm/trunk/include/llvm/Target/TargetIntrinsicInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetIntrinsicInfo.h?rev=65404&r1=65403&r2=65404&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetIntrinsicInfo.h (original) +++ llvm/trunk/include/llvm/Target/TargetIntrinsicInfo.h Tue Feb 24 17:17:49 2009 @@ -18,6 +18,7 @@ class Function; class Module; +class Type; //--------------------------------------------------------------------------- /// @@ -39,7 +40,19 @@ virtual Function *getDeclaration(Module *M, const char *BuiltinName) const { return 0; } - + + // Returns the Function declaration for intrinsic BuiltinName. If the + // intrinsic can be overloaded, uses Tys to return the correct function. + virtual Function *getDeclaration(Module *M, const char *BuiltinName, + const Type **Tys, unsigned numTys) const { + return 0; + } + + // Returns true if the Builtin can be overloaded. + virtual bool isOverloaded(Module *M, const char *BuiltinName) const { + return false; + } + virtual unsigned getIntrinsicID(Function *F) const { return 0; } }; Modified: llvm/trunk/lib/VMCore/Function.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Function.cpp?rev=65404&r1=65403&r2=65404&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Function.cpp (original) +++ llvm/trunk/lib/VMCore/Function.cpp Tue Feb 24 17:17:49 2009 @@ -356,6 +356,16 @@ return FunctionType::get(ResultTy, ArgTys, IsVarArg); } +bool Intrinsic::isOverloaded(ID id) { + const bool OTable[] = { + false, +#define GET_INTRINSIC_OVERLOAD_TABLE +#include "llvm/Intrinsics.gen" +#undef GET_INTRINSIC_OVERLOAD_TABLE + }; + return OTable[id]; +} + /// This defines the "Intrinsic::getAttributes(ID id)" method. #define GET_INTRINSIC_ATTRIBUTES #include "llvm/Intrinsics.gen" Modified: llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp?rev=65404&r1=65403&r2=65404&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp Tue Feb 24 17:17:49 2009 @@ -35,7 +35,10 @@ // Emit the intrinsic ID -> name table. EmitIntrinsicToNameTable(Ints, OS); - + + // Emit the intrinsic ID -> overload table. + EmitIntrinsicToOverloadTable(Ints, OS); + // Emit the function name recognizer. EmitFnNameRecognizer(Ints, OS); @@ -120,6 +123,23 @@ OS << "#endif\n\n"; } +void IntrinsicEmitter:: +EmitIntrinsicToOverloadTable(const std::vector &Ints, + std::ostream &OS) { + OS << "// Intrinsic ID to overload table\n"; + OS << "#ifdef GET_INTRINSIC_OVERLOAD_TABLE\n"; + OS << " // Note that entry #0 is the invalid intrinsic!\n"; + for (unsigned i = 0, e = Ints.size(); i != e; ++i) { + OS << " "; + if (Ints[i].isOverloaded) + OS << "true"; + else + OS << "false"; + OS << ",\n"; + } + OS << "#endif\n\n"; +} + static void EmitTypeForValueType(std::ostream &OS, MVT::SimpleValueType VT) { if (MVT(VT).isInteger()) { unsigned BitWidth = MVT(VT).getSizeInBits(); Modified: llvm/trunk/utils/TableGen/IntrinsicEmitter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/IntrinsicEmitter.h?rev=65404&r1=65403&r2=65404&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/IntrinsicEmitter.h (original) +++ llvm/trunk/utils/TableGen/IntrinsicEmitter.h Tue Feb 24 17:17:49 2009 @@ -36,6 +36,8 @@ std::ostream &OS); void EmitIntrinsicToNameTable(const std::vector &Ints, std::ostream &OS); + void EmitIntrinsicToOverloadTable(const std::vector &Ints, + std::ostream &OS); void EmitVerifier(const std::vector &Ints, std::ostream &OS); void EmitGenerator(const std::vector &Ints, From isanbard at gmail.com Tue Feb 24 17:19:45 2009 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 24 Feb 2009 23:19:45 -0000 Subject: [llvm-commits] [llvm] r65405 - /llvm/branches/Apple/Dib/lib/Analysis/DebugInfo.cpp Message-ID: <200902242319.n1ONJkBd012228@zion.cs.uiuc.edu> Author: void Date: Tue Feb 24 17:19:45 2009 New Revision: 65405 URL: http://llvm.org/viewvc/llvm-project?rev=65405&view=rev Log: --- Merging (from foreign repository) r65402 into '.': U lib/Analysis/DebugInfo.cpp If compile unit's language is not set then don't crash while dump'ing compile unit. Modified: llvm/branches/Apple/Dib/lib/Analysis/DebugInfo.cpp Modified: llvm/branches/Apple/Dib/lib/Analysis/DebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Analysis/DebugInfo.cpp?rev=65405&r1=65404&r2=65405&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Analysis/DebugInfo.cpp (original) +++ llvm/branches/Apple/Dib/lib/Analysis/DebugInfo.cpp Tue Feb 24 17:19:45 2009 @@ -862,7 +862,8 @@ /// dump - print compile unit. void DICompileUnit::dump() const { - cerr << " [" << dwarf::LanguageString(getLanguage()) << "] "; + if (getLanguage()) + cerr << " [" << dwarf::LanguageString(getLanguage()) << "] "; cerr << " [" << getDirectory() << "/" << getFilename() << " ]"; } From isanbard at gmail.com Tue Feb 24 17:22:36 2009 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 24 Feb 2009 23:22:36 -0000 Subject: [llvm-commits] [llvm] r65406 - in /llvm/branches/Apple/Dib: include/llvm/Intrinsics.h include/llvm/Target/TargetIntrinsicInfo.h lib/VMCore/Function.cpp utils/TableGen/IntrinsicEmitter.cpp utils/TableGen/IntrinsicEmitter.h Message-ID: <200902242322.n1ONMa9Y012406@zion.cs.uiuc.edu> Author: void Date: Tue Feb 24 17:22:35 2009 New Revision: 65406 URL: http://llvm.org/viewvc/llvm-project?rev=65406&view=rev Log: --- Merging (from foreign repository) r65404 into '.': U include/llvm/Target/TargetIntrinsicInfo.h U include/llvm/Intrinsics.h U utils/TableGen/IntrinsicEmitter.h U utils/TableGen/IntrinsicEmitter.cpp U lib/VMCore/Function.cpp Added support to have TableGen provide information if an intrinsic (core or target) can be overloaded or not. Modified: llvm/branches/Apple/Dib/include/llvm/Intrinsics.h llvm/branches/Apple/Dib/include/llvm/Target/TargetIntrinsicInfo.h llvm/branches/Apple/Dib/lib/VMCore/Function.cpp llvm/branches/Apple/Dib/utils/TableGen/IntrinsicEmitter.cpp llvm/branches/Apple/Dib/utils/TableGen/IntrinsicEmitter.h Modified: llvm/branches/Apple/Dib/include/llvm/Intrinsics.h URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/include/llvm/Intrinsics.h?rev=65406&r1=65405&r2=65406&view=diff ============================================================================== --- llvm/branches/Apple/Dib/include/llvm/Intrinsics.h (original) +++ llvm/branches/Apple/Dib/include/llvm/Intrinsics.h Tue Feb 24 17:22:35 2009 @@ -49,6 +49,10 @@ /// const FunctionType *getType(ID id, const Type **Tys = 0, unsigned numTys = 0); + /// Intrinsic::isOverloaded(ID) - Returns true if the intrinsic can be + /// overloaded. + bool isOverloaded(ID id); + /// Intrinsic::getAttributes(ID) - Return the attributes for an intrinsic. /// AttrListPtr getAttributes(ID id); Modified: llvm/branches/Apple/Dib/include/llvm/Target/TargetIntrinsicInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/include/llvm/Target/TargetIntrinsicInfo.h?rev=65406&r1=65405&r2=65406&view=diff ============================================================================== --- llvm/branches/Apple/Dib/include/llvm/Target/TargetIntrinsicInfo.h (original) +++ llvm/branches/Apple/Dib/include/llvm/Target/TargetIntrinsicInfo.h Tue Feb 24 17:22:35 2009 @@ -18,6 +18,7 @@ class Function; class Module; +class Type; //--------------------------------------------------------------------------- /// @@ -39,7 +40,19 @@ virtual Function *getDeclaration(Module *M, const char *BuiltinName) const { return 0; } - + + // Returns the Function declaration for intrinsic BuiltinName. If the + // intrinsic can be overloaded, uses Tys to return the correct function. + virtual Function *getDeclaration(Module *M, const char *BuiltinName, + const Type **Tys, unsigned numTys) const { + return 0; + } + + // Returns true if the Builtin can be overloaded. + virtual bool isOverloaded(Module *M, const char *BuiltinName) const { + return false; + } + virtual unsigned getIntrinsicID(Function *F) const { return 0; } }; Modified: llvm/branches/Apple/Dib/lib/VMCore/Function.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/VMCore/Function.cpp?rev=65406&r1=65405&r2=65406&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/VMCore/Function.cpp (original) +++ llvm/branches/Apple/Dib/lib/VMCore/Function.cpp Tue Feb 24 17:22:35 2009 @@ -356,6 +356,16 @@ return FunctionType::get(ResultTy, ArgTys, IsVarArg); } +bool Intrinsic::isOverloaded(ID id) { + const bool OTable[] = { + false, +#define GET_INTRINSIC_OVERLOAD_TABLE +#include "llvm/Intrinsics.gen" +#undef GET_INTRINSIC_OVERLOAD_TABLE + }; + return OTable[id]; +} + /// This defines the "Intrinsic::getAttributes(ID id)" method. #define GET_INTRINSIC_ATTRIBUTES #include "llvm/Intrinsics.gen" Modified: llvm/branches/Apple/Dib/utils/TableGen/IntrinsicEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/utils/TableGen/IntrinsicEmitter.cpp?rev=65406&r1=65405&r2=65406&view=diff ============================================================================== --- llvm/branches/Apple/Dib/utils/TableGen/IntrinsicEmitter.cpp (original) +++ llvm/branches/Apple/Dib/utils/TableGen/IntrinsicEmitter.cpp Tue Feb 24 17:22:35 2009 @@ -35,7 +35,10 @@ // Emit the intrinsic ID -> name table. EmitIntrinsicToNameTable(Ints, OS); - + + // Emit the intrinsic ID -> overload table. + EmitIntrinsicToOverloadTable(Ints, OS); + // Emit the function name recognizer. EmitFnNameRecognizer(Ints, OS); @@ -117,6 +120,23 @@ OS << "#endif\n\n"; } +void IntrinsicEmitter:: +EmitIntrinsicToOverloadTable(const std::vector &Ints, + std::ostream &OS) { + OS << "// Intrinsic ID to overload table\n"; + OS << "#ifdef GET_INTRINSIC_OVERLOAD_TABLE\n"; + OS << " // Note that entry #0 is the invalid intrinsic!\n"; + for (unsigned i = 0, e = Ints.size(); i != e; ++i) { + OS << " "; + if (Ints[i].isOverloaded) + OS << "true"; + else + OS << "false"; + OS << ",\n"; + } + OS << "#endif\n\n"; +} + static void EmitTypeForValueType(std::ostream &OS, MVT::SimpleValueType VT) { if (MVT(VT).isInteger()) { unsigned BitWidth = MVT(VT).getSizeInBits(); Modified: llvm/branches/Apple/Dib/utils/TableGen/IntrinsicEmitter.h URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/utils/TableGen/IntrinsicEmitter.h?rev=65406&r1=65405&r2=65406&view=diff ============================================================================== --- llvm/branches/Apple/Dib/utils/TableGen/IntrinsicEmitter.h (original) +++ llvm/branches/Apple/Dib/utils/TableGen/IntrinsicEmitter.h Tue Feb 24 17:22:35 2009 @@ -36,6 +36,8 @@ std::ostream &OS); void EmitIntrinsicToNameTable(const std::vector &Ints, std::ostream &OS); + void EmitIntrinsicToOverloadTable(const std::vector &Ints, + std::ostream &OS); void EmitVerifier(const std::vector &Ints, std::ostream &OS); void EmitGenerator(const std::vector &Ints, From kremenek at apple.com Tue Feb 24 17:31:07 2009 From: kremenek at apple.com (Ted Kremenek) Date: Tue, 24 Feb 2009 23:31:07 -0000 Subject: [llvm-commits] [llvm] r65408 - /llvm/tags/checker/checker-0.164/ Message-ID: <200902242331.n1ONV7N5012704@zion.cs.uiuc.edu> Author: kremenek Date: Tue Feb 24 17:31:07 2009 New Revision: 65408 URL: http://llvm.org/viewvc/llvm-project?rev=65408&view=rev Log: Removing checker-0.164. Removed: llvm/tags/checker/checker-0.164/ From kremenek at apple.com Tue Feb 24 17:34:28 2009 From: kremenek at apple.com (Ted Kremenek) Date: Tue, 24 Feb 2009 23:34:28 -0000 Subject: [llvm-commits] [llvm] r65411 - /llvm/tags/checker/checker-0.164/ Message-ID: <200902242334.n1ONYS2X012932@zion.cs.uiuc.edu> Author: kremenek Date: Tue Feb 24 17:34:28 2009 New Revision: 65411 URL: http://llvm.org/viewvc/llvm-project?rev=65411&view=rev Log: Tagging checker-0.164. Added: llvm/tags/checker/checker-0.164/ - copied from r65410, llvm/trunk/ From kremenek at apple.com Tue Feb 24 18:10:12 2009 From: kremenek at apple.com (Ted Kremenek) Date: Wed, 25 Feb 2009 00:10:12 -0000 Subject: [llvm-commits] [llvm] r65415 - /llvm/tags/checker/checker-0.164/ Message-ID: <200902250010.n1P0ACHn014205@zion.cs.uiuc.edu> Author: kremenek Date: Tue Feb 24 18:10:11 2009 New Revision: 65415 URL: http://llvm.org/viewvc/llvm-project?rev=65415&view=rev Log: Removing checker-0.164. Removed: llvm/tags/checker/checker-0.164/ From kremenek at apple.com Tue Feb 24 18:11:09 2009 From: kremenek at apple.com (Ted Kremenek) Date: Wed, 25 Feb 2009 00:11:09 -0000 Subject: [llvm-commits] [llvm] r65418 - /llvm/tags/checker/checker-0.164/ Message-ID: <200902250011.n1P0B9Tl014269@zion.cs.uiuc.edu> Author: kremenek Date: Tue Feb 24 18:11:09 2009 New Revision: 65418 URL: http://llvm.org/viewvc/llvm-project?rev=65418&view=rev Log: Tagging checker-0.164. Added: llvm/tags/checker/checker-0.164/ - copied from r65417, llvm/trunk/ From anon at cs.uiuc.edu Tue Feb 24 20:14:12 2009 From: anon at cs.uiuc.edu (anon at cs.uiuc.edu) Date: Tue, 24 Feb 2009 20:14:12 -0600 Subject: [llvm-commits] CVS: llvm-test/MultiSource/Benchmarks/Olden/tsp/args.c build.c main.c tsp.c tsp.h Message-ID: <200902250214.n1P2EC5A018257@zion.cs.uiuc.edu> Changes in directory llvm-test/MultiSource/Benchmarks/Olden/tsp: args.c updated: 1.3 -> 1.4 build.c updated: 1.1 -> 1.2 main.c updated: 1.2 -> 1.3 tsp.c updated: 1.2 -> 1.3 tsp.h updated: 1.2 -> 1.3 --- Log message: --- Diffs of the changes: (+64 -2) args.c | 1 + build.c | 2 ++ main.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ tsp.c | 2 +- tsp.h | 2 +- 5 files changed, 64 insertions(+), 2 deletions(-) Index: llvm-test/MultiSource/Benchmarks/Olden/tsp/args.c diff -u llvm-test/MultiSource/Benchmarks/Olden/tsp/args.c:1.3 llvm-test/MultiSource/Benchmarks/Olden/tsp/args.c:1.4 --- llvm-test/MultiSource/Benchmarks/Olden/tsp/args.c:1.3 Mon May 20 16:53:09 2002 +++ llvm-test/MultiSource/Benchmarks/Olden/tsp/args.c Tue Feb 24 20:13:42 2009 @@ -1,6 +1,7 @@ /* For copyright information, see olden_v1.0/COPYRIGHT */ #include +#include #include "tsp.h" int NumNodes, NDim; int flag; Index: llvm-test/MultiSource/Benchmarks/Olden/tsp/build.c diff -u llvm-test/MultiSource/Benchmarks/Olden/tsp/build.c:1.1 llvm-test/MultiSource/Benchmarks/Olden/tsp/build.c:1.2 --- llvm-test/MultiSource/Benchmarks/Olden/tsp/build.c:1.1 Tue Nov 6 16:51:46 2001 +++ llvm-test/MultiSource/Benchmarks/Olden/tsp/build.c Tue Feb 24 20:13:42 2009 @@ -29,7 +29,9 @@ #define M_E3 20.08553692318766774179 #define M_E6 403.42879349273512264299 #define M_E12 162754.79141900392083592475 +#ifndef NULL #define NULL 0 +#endif #include "tsp.h" #ifdef FUTURES Index: llvm-test/MultiSource/Benchmarks/Olden/tsp/main.c diff -u llvm-test/MultiSource/Benchmarks/Olden/tsp/main.c:1.2 llvm-test/MultiSource/Benchmarks/Olden/tsp/main.c:1.3 --- llvm-test/MultiSource/Benchmarks/Olden/tsp/main.c:1.2 Thu Feb 14 14:08:44 2002 +++ llvm-test/MultiSource/Benchmarks/Olden/tsp/main.c Tue Feb 24 20:13:42 2009 @@ -55,3 +55,62 @@ return 0; } + + + + +/* borrowed from libc/misc/drand48.c in Linux libc-5.4.46 this quick + * hack by Martin Hamilton to make Squid build on + * Win32 with GNU-Win32 - sorry, folks! */ + +#ifndef HAVE_DRAND48 + +#define N 16 +#define MASK ((unsigned)(1 << (N - 1)) + (1 << (N - 1)) - 1) +#define LOW(x) ((unsigned)(x) & MASK) +#define HIGH(x) LOW((x) >> N) +#define MUL(x, y, z) { long l = (long)(x) * (long)(y); \ + (z)[0] = LOW(l); (z)[1] = HIGH(l); } +#define CARRY(x, y) ((long)(x) + (long)(y) > MASK) +#define ADDEQU(x, y, z) (z = CARRY(x, (y)), x = LOW(x + (y))) +#define X0 0x330E +#define X1 0xABCD +#define X2 0x1234 +#define A0 0xE66D +#define A1 0xDEEC +#define A2 0x5 +#define C 0xB + +static void next(void); +static unsigned x[3] = +{X0, X1, X2}, a[3] = +{A0, A1, A2}, c = C; + +double drand48(void); + +double +drand48(void) +{ + static double two16m = 1.0 / (1L << N); + next(); + return (two16m * (two16m * (two16m * x[0] + x[1]) + x[2])); +} + +static void +next(void) +{ + unsigned p[2], q[2], r[2], carry0, carry1; + + MUL(a[0], x[0], p); + ADDEQU(p[0], c, carry0); + ADDEQU(p[1], carry0, carry1); + MUL(a[0], x[1], q); + ADDEQU(p[1], q[0], carry0); + MUL(a[1], x[0], r); + x[2] = LOW(carry0 + carry1 + CARRY(p[1], r[0]) + q[1] + r[1] + + a[0] * x[2] + a[1] * x[1] + a[2] * x[0]); + x[1] = LOW(p[1] + r[0]); + x[0] = LOW(p[0]); +} + +#endif /* HAVE_DRAND48 */ \ No newline at end of file Index: llvm-test/MultiSource/Benchmarks/Olden/tsp/tsp.c diff -u llvm-test/MultiSource/Benchmarks/Olden/tsp/tsp.c:1.2 llvm-test/MultiSource/Benchmarks/Olden/tsp/tsp.c:1.3 --- llvm-test/MultiSource/Benchmarks/Olden/tsp/tsp.c:1.2 Thu Feb 14 14:08:44 2002 +++ llvm-test/MultiSource/Benchmarks/Olden/tsp/tsp.c Tue Feb 24 20:13:42 2009 @@ -44,8 +44,8 @@ /* reverse orientation of list */ static void reverse(Tree t) { Tree prev,back,next,tmp; - if (!t) return; + /*chatting("REVERSE\n");*/ /*print_list(t);*/ prev = t->prev; Index: llvm-test/MultiSource/Benchmarks/Olden/tsp/tsp.h diff -u llvm-test/MultiSource/Benchmarks/Olden/tsp/tsp.h:1.2 llvm-test/MultiSource/Benchmarks/Olden/tsp/tsp.h:1.3 --- llvm-test/MultiSource/Benchmarks/Olden/tsp/tsp.h:1.2 Sun Mar 24 14:32:57 2002 +++ llvm-test/MultiSource/Benchmarks/Olden/tsp/tsp.h Tue Feb 24 20:13:42 2009 @@ -8,7 +8,7 @@ extern int flag; double drand48(void); -int atoi(const char *); +/* int atoi(const char *);*/ int dealwithargs(int argc, char *argv[]); From anon at cs.uiuc.edu Tue Feb 24 20:14:12 2009 From: anon at cs.uiuc.edu (anon at cs.uiuc.edu) Date: Tue, 24 Feb 2009 20:14:12 -0600 Subject: [llvm-commits] CVS: llvm-test/MultiSource/Benchmarks/Olden/bisort/bitonic.c Message-ID: <200902250214.n1P2ECBc018252@zion.cs.uiuc.edu> Changes in directory llvm-test/MultiSource/Benchmarks/Olden/bisort: bitonic.c updated: 1.5 -> 1.6 --- Log message: --- Diffs of the changes: (+1 -1) bitonic.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-test/MultiSource/Benchmarks/Olden/bisort/bitonic.c diff -u llvm-test/MultiSource/Benchmarks/Olden/bisort/bitonic.c:1.5 llvm-test/MultiSource/Benchmarks/Olden/bisort/bitonic.c:1.6 --- llvm-test/MultiSource/Benchmarks/Olden/bisort/bitonic.c:1.5 Mon Oct 25 15:26:46 2004 +++ llvm-test/MultiSource/Benchmarks/Olden/bisort/bitonic.c Tue Feb 24 20:13:42 2009 @@ -27,12 +27,12 @@ #define NewNode(h,v,procid) LocalNewNode(h,v) void InOrder(HANDLE *h) { + static unsigned char counter = 0; HANDLE *l, *r; if ((h != NIL)) { l = h->left; r = h->right; InOrder(l); - static unsigned char counter = 0; if (counter++ == 0) /* reduce IO */ printf("%d @ 0x%x\n",h->value, 0); InOrder(r); From zhousheng at autoesl.com Tue Feb 24 20:17:45 2009 From: zhousheng at autoesl.com (Sheng Zhou) Date: Wed, 25 Feb 2009 10:17:45 +0800 Subject: [llvm-commits] [llvm] r65356 - in /llvm/branches/Apple/Dib:, lib/CodeGen/AsmPrinter/DwarfWriter.cpp, lib/Transforms/Utils/BasicBlockUtils.cpp, lib/Transforms/Utils/SimplifyCFG.cpp, test/Transforms/SimplifyCFG/dbginfo.ll In-Reply-To: <755AB232-2660-4EAB-BC39-29511FF724D0@apple.com> References: <49A3AF9B.2010200@autoesl.com> <755AB232-2660-4EAB-BC39-29511FF724D0@apple.com> Message-ID: <49A4AA49.5060304@gmail.com> Devang Patel ??: > > On Feb 24, 2009, at 12:28 AM, Sheng Zhou wrote: > >> Hi Patel, >> >>> Author: dpatel >>> Date: Mon Feb 23 18:05:16 2009 >>> New Revision: 65353 >>> >> Attached is a .ll case (before.ll). And with your change, I got >> "after.ll" after pass -simplifycfg which folded unconditional return and >> moved DbgRegionEndInst into pred. The question is in after.ll now there >> are two "ret" instructions in two basic blocks: > > I do not understand. As far as I can tell, this patch has no impact on > your test case. I updated and rebuilt my llvm. And run the following command: llvm-as < before.ll | opt -simplifycfg -debug | llvm-dis > after.ll For my case, the pass simplifycfg will fold unconditional return and move the DbgRegionEndInst into predecessor basic block, right? But in this case the original "return" Basic Block doesnt been removed, it still return a constant zero: ... *bb3.bb5.loopexit_crit_edge: ; preds = %bb2* %tmp = add i32 %x, -1 ; [#uses=2] %tmp4 = add i32 %x, %y ; [#uses=1] %tmp5 = mul i32 %tmp, %tmp4 ; [#uses=1] %tmp6 = add i32 %tmp5, %x ; [#uses=1] %tmp7 = add i32 %x, -2 ; [#uses=1] %tmp. = zext i32 %tmp7 to i33 ; [#uses=1] %tmp.8 = zext i32 %tmp to i33 ; [#uses=1] %tmp9 = mul i33 %tmp., %tmp.8 ; [#uses=1] %tmp10 = lshr i33 %tmp9, 1 ; [#uses=1] %tmp.11 = trunc i33 %tmp10 to i32 ; [#uses=1] %tmp12 = mul i32 %tmp.11, %y ; [#uses=1] %tmp13 = add i32 %tmp6, %tmp12 ; [#uses=1] *tail call void @llvm.dbg.region.end({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*))* *ret i32 %tmp13* *bb5: ; preds = %entry* tail call void @llvm.dbg.stoppoint(i32 10, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) *ret i32 0* My question is as the "**llvm.dbg.region.end**" here is to pair off with "llvm.dbg.function.start", and indicating the end of the function, is it correct to move it to the previous basic block for this case? As we have two "return" basic block, may be each basic block should have one "**llvm.dbg.region.end**", but there is just one "llvm.dbg.function.start" for paring. I don't know. Sheng. > - > Devang -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090225/26466730/attachment.html From dpatel at apple.com Tue Feb 24 20:24:38 2009 From: dpatel at apple.com (Devang Patel) Date: Tue, 24 Feb 2009 18:24:38 -0800 Subject: [llvm-commits] [llvm] r65356 - in /llvm/branches/Apple/Dib:, lib/CodeGen/AsmPrinter/DwarfWriter.cpp, lib/Transforms/Utils/BasicBlockUtils.cpp, lib/Transforms/Utils/SimplifyCFG.cpp, test/Transforms/SimplifyCFG/dbginfo.ll In-Reply-To: <49A4AA49.5060304@gmail.com> References: <49A3AF9B.2010200@autoesl.com> <755AB232-2660-4EAB-BC39-29511FF724D0@apple.com> <49A4AA49.5060304@gmail.com> Message-ID: <4702A3CF-D71E-443F-8FEE-71B367927485@apple.com> On Feb 24, 2009, at 6:17 PM, Sheng Zhou wrote: > y question is as the "llvm.dbg.region.end" here is to pair off with > "llvm.dbg.function.start", and indicating the end of the function, > is it correct to move it to the previous basic block for this case? Yes. > As we have two "return" basic block, may be each basic block should > have one "llvm.dbg.region.end", but there is just one > "llvm.dbg.function.start" for paring. llvm.dbg.func.start and llvm.dbg.region.end marks declarative scopes of function begin and function end. If a function has 10 return statements then also there will only one llvm.dbg.region.end corresponding to llvm.dbg.func.start - Devang -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090224/40a9cdb1/attachment.html From eli.friedman at gmail.com Tue Feb 24 21:08:13 2009 From: eli.friedman at gmail.com (Eli Friedman) Date: Tue, 24 Feb 2009 19:08:13 -0800 Subject: [llvm-commits] [llvm] r65356 - in /llvm/branches/Apple/Dib:, lib/CodeGen/AsmPrinter/DwarfWriter.cpp, lib/Transforms/Utils/BasicBlockUtils.cpp, lib/Transforms/Utils/SimplifyCFG.cpp, test/Transforms/SimplifyCFG/dbginfo.ll In-Reply-To: <4702A3CF-D71E-443F-8FEE-71B367927485@apple.com> References: <49A3AF9B.2010200@autoesl.com> <755AB232-2660-4EAB-BC39-29511FF724D0@apple.com> <49A4AA49.5060304@gmail.com> <4702A3CF-D71E-443F-8FEE-71B367927485@apple.com> Message-ID: On Tue, Feb 24, 2009 at 6:24 PM, Devang Patel wrote: > As we have two "return" basic block, may be each basic block should have one > "llvm.dbg.region.end", but there is just one "llvm.dbg.function.start" for > paring. > > llvm.dbg.func.start and llvm.dbg.region.end marks declarative scopes of > function begin and function end. If a function has 10 return statements then > also there will only one llvm.dbg.region.end corresponding to > llvm.dbg.func.start This confused me a lot the last time I was looking at debug info... what exactly is the "region" in question? Do llvm.debug.func.start/llvm.dbg.region.end care about the order of the blocks in a function? Or is there some other way to tell? -Eli From scottm at aero.org Tue Feb 24 21:12:50 2009 From: scottm at aero.org (Scott Michel) Date: Wed, 25 Feb 2009 03:12:50 -0000 Subject: [llvm-commits] [llvm] r65426 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAGNodes.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Target/PowerPC/PPCISelLowering.cpp Message-ID: <200902250312.n1P3Comp020256@zion.cs.uiuc.edu> Author: pingbak Date: Tue Feb 24 21:12:50 2009 New Revision: 65426 URL: http://llvm.org/viewvc/llvm-project?rev=65426&view=rev Log: Remove all "cached" data from BuildVectorSDNode, preferring to retrieve results via reference parameters. This patch also appears to fix Evan's reported problem supplied as a reduced bugpoint test case. Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h?rev=65426&r1=65425&r2=65426&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h Tue Feb 24 21:12:50 2009 @@ -1933,13 +1933,6 @@ /// encapsulate common BUILD_VECTOR code and operations such as constant splat /// testing. class BuildVectorSDNode : public SDNode { - //-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ - // Constant splat state: - //-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ - //! We've computed the splat already? - bool computedSplat; - //! It is a splat? - bool isSplatVector; //! Splat has undefined bits in it bool hasUndefSplatBitsFlag; //! The splat value @@ -1959,36 +1952,25 @@ public: //! Constant splat predicate. /*! - Determine if this ISD::BUILD_VECTOR is a constant splat. The results are - cached to prevent recomputation. - - @param MinSplatBits: minimum number of bits in the constant splat, defaults + Determine if this ISD::BUILD_VECTOR is a constant splat. This method + returns information about the splat in \a hasUndefSplatBitsFlag, + \a SplatBits, \a SplatUndef and \a SplatSize if the return value is + true. + + \param[out] hasUndefSplatBitsFlag: true if the constant splat contains + any undefined bits in the splat. + \param[out] SplatBits: The constant splat value + \param[out] SplatUndef: The undefined bits in the splat value + \param[out] SplatSize: The size of the constant splat in bytes + \param MinSplatBits: minimum number of bits in the constant splat, defaults to 0 for 'don't care', but normally one of [8, 16, 32, 64]. - @return true if the splat has the required minimum number of bits and the + + \return true if the splat has the required minimum number of bits and the splat really is a constant splat (accounting for undef bits). */ - bool isConstantSplat(int MinSplatBits = 0); - - //! Get the splatbits - uint64_t getSplatBits() const { - assert(computedSplat && "BuildVectorSDNode: compute splat bits first!"); - return SplatBits; - } - - uint64_t getSplatUndef() const { - assert(computedSplat && "BuildVectorSDNode: compute splat bits first!"); - return SplatUndef; - } - - unsigned getSplatSize() const { - assert(computedSplat && "BuildVectorSDNode: compute splat bits first!"); - return SplatSize; - } - - bool hasAnyUndefBits() const { - assert(computedSplat && "BuildVectorSDNode: compute splat bits first!"); - return hasUndefSplatBitsFlag; - } + bool isConstantSplat(bool &hasUndefSplatBitsFlag, uint64_t &SplatBits, + uint64_t &SplatUndef, unsigned &SplatSize, + int MinSplatBits = 0); static bool classof(const BuildVectorSDNode *) { return true; } static bool classof(const SDNode *N) { Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=65426&r1=65425&r2=65426&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Feb 24 21:12:50 2009 @@ -4856,27 +4856,25 @@ BuildVectorSDNode::BuildVectorSDNode(MVT vecVT, DebugLoc dl, const SDValue *Elts, unsigned NumElts) - : SDNode(ISD::BUILD_VECTOR, dl, getSDVTList(vecVT), Elts, NumElts), - computedSplat(false), isSplatVector(false), hasUndefSplatBitsFlag(false), - SplatBits(0LL), SplatUndef(0LL), SplatSize(0) + : SDNode(ISD::BUILD_VECTOR, dl, getSDVTList(vecVT), Elts, NumElts) { } -bool BuildVectorSDNode::isConstantSplat(int MinSplatBits) { +bool BuildVectorSDNode::isConstantSplat(bool &hasUndefSplatBitsFlag, + uint64_t &SplatBits, + uint64_t &SplatUndef, + unsigned &SplatSize, + int MinSplatBits) { unsigned int nOps = getNumOperands(); assert(nOps > 0 && "isConstantSplat has 0-size build vector"); - // Return early if we already know the answer: - if (computedSplat) - return isSplatVector; + // Assume that this isn't a constant splat. + bool isSplatVector = false; // The vector's used (non-undef) bits uint64_t VectorBits[2] = { 0, 0 }; // The vector's undefined bits uint64_t UndefBits[2] = { 0, 0 }; - // Assume that this isn't a constant splat. - isSplatVector = false; - // Gather the constant and undefined bits unsigned EltBitSize = getOperand(0).getValueType().getSizeInBits(); for (unsigned i = 0; i < nOps; ++i) { @@ -4901,7 +4899,6 @@ EltBits = DoubleToBits(apf.convertToDouble()); } else { // Nonconstant element -> not a splat. - computedSplat = true; return isSplatVector; } @@ -4910,7 +4907,6 @@ if ((VectorBits[0] & ~UndefBits[1]) != (VectorBits[1] & ~UndefBits[0])) { // Can't be a splat if two pieces don't match. - computedSplat = true; return isSplatVector; } @@ -4954,7 +4950,6 @@ isSplatVector = true; } - computedSplat = true; return isSplatVector; } Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=65426&r1=65425&r2=65426&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Tue Feb 24 21:12:50 2009 @@ -3171,16 +3171,16 @@ BuildVectorSDNode *BVN = dyn_cast(Op.getNode()); assert(BVN != 0 && "Expected a BuildVectorSDNode in LowerBUILD_VECTOR"); + uint64_t SplatBits; + uint64_t SplatUndef; + unsigned SplatSize; + bool HasAnyUndefs; + // If this is a splat (repetition) of a value across the whole vector, return // the smallest size that splats it. For example, "0x01010101010101..." is a // splat of 0x01, 0x0101, and 0x01010101. We return SplatBits = 0x01 and // SplatSize = 1 byte. - if (BVN->isConstantSplat()) { - uint64_t SplatBits = BVN->getSplatBits(); - uint64_t SplatUndef = BVN->getSplatUndef(); - unsigned SplatSize = BVN->getSplatSize(); - bool HasAnyUndefs = BVN->hasAnyUndefBits(); - + if (BVN->isConstantSplat(HasAnyUndefs, SplatBits, SplatUndef, SplatSize)) { // First, handle single instruction cases. // All zeros? From scottm at aero.org Tue Feb 24 21:57:49 2009 From: scottm at aero.org (Scott Michel) Date: Wed, 25 Feb 2009 03:57:49 -0000 Subject: [llvm-commits] [llvm] r65427 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAGNodes.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200902250357.n1P3vn8M021635@zion.cs.uiuc.edu> Author: pingbak Date: Tue Feb 24 21:57:49 2009 New Revision: 65427 URL: http://llvm.org/viewvc/llvm-project?rev=65427&view=rev Log: Expand tabs to spaces (overlooked in previous commit) Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h?rev=65427&r1=65426&r2=65427&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h Tue Feb 24 21:57:49 2009 @@ -1970,7 +1970,7 @@ */ bool isConstantSplat(bool &hasUndefSplatBitsFlag, uint64_t &SplatBits, uint64_t &SplatUndef, unsigned &SplatSize, - int MinSplatBits = 0); + int MinSplatBits = 0); static bool classof(const BuildVectorSDNode *) { return true; } static bool classof(const SDNode *N) { Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=65427&r1=65426&r2=65427&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Feb 24 21:57:49 2009 @@ -894,7 +894,7 @@ SmallVector Ops; Ops.assign(VT.getVectorNumElements(), Result); Result = getBUILD_VECTOR(VT, DebugLoc::getUnknownLoc(), - &Ops[0], Ops.size()); + &Ops[0], Ops.size()); } return Result; } @@ -938,7 +938,7 @@ SmallVector Ops; Ops.assign(VT.getVectorNumElements(), Result); Result = getBUILD_VECTOR(VT, DebugLoc::getUnknownLoc(), - &Ops[0], Ops.size()); + &Ops[0], Ops.size()); } return Result; } @@ -4855,15 +4855,15 @@ } BuildVectorSDNode::BuildVectorSDNode(MVT vecVT, DebugLoc dl, - const SDValue *Elts, unsigned NumElts) + const SDValue *Elts, unsigned NumElts) : SDNode(ISD::BUILD_VECTOR, dl, getSDVTList(vecVT), Elts, NumElts) { } bool BuildVectorSDNode::isConstantSplat(bool &hasUndefSplatBitsFlag, uint64_t &SplatBits, uint64_t &SplatUndef, - unsigned &SplatSize, - int MinSplatBits) { + unsigned &SplatSize, + int MinSplatBits) { unsigned int nOps = getNumOperands(); assert(nOps > 0 && "isConstantSplat has 0-size build vector"); @@ -4890,13 +4890,13 @@ } else if (ConstantSDNode *CN = dyn_cast(OpVal)) { EltBits = CN->getZExtValue(); if (EltBitSize <= 32) - EltBits &= (~0U >> (32-EltBitSize)); + EltBits &= (~0U >> (32-EltBitSize)); } else if (ConstantFPSDNode *CN = dyn_cast(OpVal)) { const APFloat &apf = CN->getValueAPF(); if (OpVal.getValueType() == MVT::f32) - EltBits = FloatToBits(apf.convertToFloat()); + EltBits = FloatToBits(apf.convertToFloat()); else - EltBits = DoubleToBits(apf.convertToDouble()); + EltBits = DoubleToBits(apf.convertToDouble()); } else { // Nonconstant element -> not a splat. return isSplatVector; @@ -5646,8 +5646,8 @@ typedef SmallPtrSet VisitedSDNodeSet; static void DumpNodesr(raw_ostream &OS, const SDNode *N, unsigned indent, - const SelectionDAG *G, VisitedSDNodeSet &once) { - if (!once.insert(N)) // If we've been here before, return now. + const SelectionDAG *G, VisitedSDNodeSet &once) { + if (!once.insert(N)) // If we've been here before, return now. return; // Dump the current SDNode, but don't end the line yet. OS << std::string(indent, ' '); @@ -5661,10 +5661,10 @@ // This child has no grandchildren; print it inline right here. child->printr(OS, G); once.insert(child); - } else { // Just the address. FIXME: also print the child's opcode + } else { // Just the address. FIXME: also print the child's opcode OS << (void*)child; if (unsigned RN = N->getOperand(i).getResNo()) - OS << ":" << RN; + OS << ":" << RN; } } OS << "\n"; From sabre at nondot.org Tue Feb 24 22:41:31 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 25 Feb 2009 04:41:31 -0000 Subject: [llvm-commits] [llvm] r65429 - /llvm/trunk/docs/ReleaseNotes.html Message-ID: <200902250441.n1P4fVbN023112@zion.cs.uiuc.edu> Author: lattner Date: Tue Feb 24 22:41:31 2009 New Revision: 65429 URL: http://llvm.org/viewvc/llvm-project?rev=65429&view=rev Log: rip out llvm 2.4 details to make room for 2.5 Modified: llvm/trunk/docs/ReleaseNotes.html Modified: llvm/trunk/docs/ReleaseNotes.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ReleaseNotes.html?rev=65429&r1=65428&r2=65429&view=diff ============================================================================== --- llvm/trunk/docs/ReleaseNotes.html (original) +++ llvm/trunk/docs/ReleaseNotes.html Tue Feb 24 22:41:31 2009 @@ -4,11 +4,11 @@ - LLVM 2.4 Release Notes + LLVM 2.5 Release Notes -
LLVM 2.4 Release Notes
+
LLVM 2.5 Release Notes
  1. Introduction
  2. @@ -33,7 +33,7 @@

    This document contains the release notes for the LLVM Compiler -Infrastructure, release 2.4. Here we describe the status of LLVM, including +Infrastructure, release 2.5. Here we describe the status of LLVM, including major improvements from the previous release and significant known problems. All LLVM releases may be downloaded from the LLVM releases web site.

    @@ -51,7 +51,7 @@
    - From clattner at apple.com Tue Feb 24 23:12:57 2009 From: clattner at apple.com (Chris Lattner) Date: Tue, 24 Feb 2009 21:12:57 -0800 Subject: [llvm-commits] CVS: llvm-test/MultiSource/Benchmarks/Olden/bisort/bitonic.c In-Reply-To: <5F065E67-F982-4A87-9064-B7909D951AE0@gmail.com> References: <200902250214.n1P2ECBc018252@zion.cs.uiuc.edu> <5F065E67-F982-4A87-9064-B7909D951AE0@gmail.com> Message-ID: <6122FB79-DFE0-4B32-8BC6-67E9D1BA0D97@apple.com> On Feb 24, 2009, at 8:59 PM, Bill Wendling wrote: > Anon? Who is this? Maybe anton forgot a t? -Chris From nicholas at mxc.ca Tue Feb 24 23:26:00 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Tue, 24 Feb 2009 21:26:00 -0800 Subject: [llvm-commits] CVS: llvm-test/MultiSource/Benchmarks/Olden/bisort/bitonic.c In-Reply-To: <6122FB79-DFE0-4B32-8BC6-67E9D1BA0D97@apple.com> References: <200902250214.n1P2ECBc018252@zion.cs.uiuc.edu> <5F065E67-F982-4A87-9064-B7909D951AE0@gmail.com> <6122FB79-DFE0-4B32-8BC6-67E9D1BA0D97@apple.com> Message-ID: <49A4D668.3040206@mxc.ca> Chris Lattner wrote: > On Feb 24, 2009, at 8:59 PM, Bill Wendling wrote: > >> Anon? Who is this? > > Maybe anton forgot a t? And a log message? From sabre at nondot.org Tue Feb 24 23:45:05 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 25 Feb 2009 05:45:05 -0000 Subject: [llvm-commits] [llvm] r65434 - /llvm/trunk/docs/ReleaseNotes.html Message-ID: <200902250545.n1P5j5mG025517@zion.cs.uiuc.edu> Author: lattner Date: Tue Feb 24 23:45:05 2009 New Revision: 65434 URL: http://llvm.org/viewvc/llvm-project?rev=65434&view=rev Log: don't know if there is a vmkit release to match 2.5 Modified: llvm/trunk/docs/ReleaseNotes.html Modified: llvm/trunk/docs/ReleaseNotes.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ReleaseNotes.html?rev=65434&r1=65433&r2=65434&view=diff ============================================================================== --- llvm/trunk/docs/ReleaseNotes.html (original) +++ llvm/trunk/docs/ReleaseNotes.html Tue Feb 24 23:45:05 2009 @@ -163,7 +163,7 @@ a JVM and a CLI Virtual Machines (Microsoft .NET is an implementation of the CLI) using the Just-In-Time compiler of LLVM.

    -

    Following LLVM 2.5, VMKit has its first release 0.24 that you can find on its +

    Following LLVM 2.5, VMKit has its first release ? that you can find on its webpage. The release includes bug fixes, cleanup and new features. The major changes are:

    From nicholas at mxc.ca Wed Feb 25 00:29:47 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Wed, 25 Feb 2009 06:29:47 -0000 Subject: [llvm-commits] [llvm] r65435 - /llvm/trunk/docs/GettingStarted.html Message-ID: <200902250629.n1P6Tl1E027008@zion.cs.uiuc.edu> Author: nicholas Date: Wed Feb 25 00:29:47 2009 New Revision: 65435 URL: http://llvm.org/viewvc/llvm-project?rev=65435&view=rev Log: Recommend against using Gold to build LLVM. Modified: llvm/trunk/docs/GettingStarted.html Modified: llvm/trunk/docs/GettingStarted.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/GettingStarted.html?rev=65435&r1=65434&r2=65435&view=diff ============================================================================== --- llvm/trunk/docs/GettingStarted.html (original) +++ llvm/trunk/docs/GettingStarted.html Wed Feb 25 00:29:47 2009 @@ -556,6 +556,12 @@ causes huge link times (minutes instead of seconds) when building LLVM. We recommend upgrading to a newer version (2.17.50.0.4 or later).

    +

    GNU Binutils 2.19.1 Gold: Gold contains +a bug +which causes intermittent failures when building LLVM with position independent +code. The symptom is an error about cyclic dependencies. We recommend not +using Gold to build LLVM until this bug is resolved.

    + From sabre at nondot.org Wed Feb 25 00:34:50 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 25 Feb 2009 06:34:50 -0000 Subject: [llvm-commits] [llvm] r65436 - /llvm/trunk/docs/ReleaseNotes.html Message-ID: <200902250634.n1P6Yp3q027158@zion.cs.uiuc.edu> Author: lattner Date: Wed Feb 25 00:34:50 2009 New Revision: 65436 URL: http://llvm.org/viewvc/llvm-project?rev=65436&view=rev Log: random notes Modified: llvm/trunk/docs/ReleaseNotes.html Modified: llvm/trunk/docs/ReleaseNotes.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ReleaseNotes.html?rev=65436&r1=65435&r2=65436&view=diff ============================================================================== --- llvm/trunk/docs/ReleaseNotes.html (original) +++ llvm/trunk/docs/ReleaseNotes.html Wed Feb 25 00:34:50 2009 @@ -54,15 +54,16 @@ + -->
    @@ -103,7 +104,7 @@

    While Clang is not yet production quality, it is progressing very nicely and is quite usable for building many C and Objective-C applications. If you are interested in fast compiles and good diagnostics, we encourage you to try it out -by building from mainlnie +by building from mainline and reporting any issues you hit to the Clang front-end mailing list.

    @@ -199,7 +200,21 @@

    LLVM 2.5 includes several major new capabilities:

      -
    • ?

    • +
    • Legalize Types

    • + +
    From nicholas at mxc.ca Wed Feb 25 00:52:48 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Wed, 25 Feb 2009 06:52:48 -0000 Subject: [llvm-commits] [llvm] r65437 - /llvm/trunk/lib/Target/README.txt Message-ID: <200902250652.n1P6qm1J027697@zion.cs.uiuc.edu> Author: nicholas Date: Wed Feb 25 00:52:48 2009 New Revision: 65437 URL: http://llvm.org/viewvc/llvm-project?rev=65437&view=rev Log: Add a totally synthetic situation I came up with while looking at a bug in related code. Modified: llvm/trunk/lib/Target/README.txt Modified: llvm/trunk/lib/Target/README.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/README.txt?rev=65437&r1=65436&r2=65437&view=diff ============================================================================== --- llvm/trunk/lib/Target/README.txt (original) +++ llvm/trunk/lib/Target/README.txt Wed Feb 25 00:52:48 2009 @@ -1690,6 +1690,7 @@ the float directly. //===---------------------------------------------------------------------===// + #include double foo(double a) { return sin(a); } @@ -1704,3 +1705,19 @@ foo: jmp sin +//===---------------------------------------------------------------------===// + +Instcombine should replace the load with a constant in: + + static const char x[4] = {'a', 'b', 'c', 'd'}; + + unsigned int y(void) { + return *(unsigned int *)x; + } + +It currently only does this transformation when the size of the constant +is the same as the size of the integer (so, try x[5]) and the last byte +is a null (making it a C string). There's no need for these restrictions. + +//===---------------------------------------------------------------------===// + From evan.cheng at apple.com Wed Feb 25 01:04:34 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 25 Feb 2009 07:04:34 -0000 Subject: [llvm-commits] [llvm] r65438 - in /llvm/trunk: include/llvm/CodeGen/DwarfWriter.h lib/CodeGen/AsmPrinter/DwarfWriter.cpp lib/CodeGen/SelectionDAG/FastISel.cpp lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Message-ID: <200902250704.n1P74Yxj028050@zion.cs.uiuc.edu> Author: evancheng Date: Wed Feb 25 01:04:34 2009 New Revision: 65438 URL: http://llvm.org/viewvc/llvm-project?rev=65438&view=rev Log: Clean up dwarf writer, part 1. This eliminated the horrible recursive getGlobalVariablesUsing and replaced it something readable. It eliminated use of slow UniqueVector and replaced it with StringMap, SmallVector, and DenseMap, etc. It also fixed some non-deterministic behavior. This is a very minor compile time win. Modified: llvm/trunk/include/llvm/CodeGen/DwarfWriter.h llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Modified: llvm/trunk/include/llvm/CodeGen/DwarfWriter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/DwarfWriter.h?rev=65438&r1=65437&r2=65438&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/DwarfWriter.h (original) +++ llvm/trunk/include/llvm/CodeGen/DwarfWriter.h Wed Feb 25 01:04:34 2009 @@ -84,9 +84,12 @@ /// the source line list. unsigned RecordSourceLine(unsigned Line, unsigned Col, unsigned Src); - /// RecordSource - Register a source file with debug info. Returns an source - /// ID. - unsigned RecordSource(const std::string &Dir, const std::string &File); + /// getOrCreateSourceID - Look up the source id with the given directory and + /// source file names. If none currently exists, create a new id and insert it + /// in the SourceIds map. This can update DirectoryIds and SourceFileIds maps + /// as well. + unsigned getOrCreateSourceID(const std::string &DirName, + const std::string &FileName); /// RecordRegionStart - Indicate the start of a region. unsigned RecordRegionStart(GlobalVariable *V); Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp?rev=65438&r1=65437&r2=65438&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp Wed Feb 25 01:04:34 2009 @@ -12,11 +12,6 @@ //===----------------------------------------------------------------------===// #include "llvm/CodeGen/DwarfWriter.h" - -#include "llvm/ADT/DenseMap.h" -#include "llvm/ADT/FoldingSet.h" -#include "llvm/ADT/StringExtras.h" -#include "llvm/ADT/UniqueVector.h" #include "llvm/Module.h" #include "llvm/DerivedTypes.h" #include "llvm/Constants.h" @@ -39,6 +34,10 @@ #include "llvm/Target/TargetInstrInfo.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetOptions.h" +#include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/FoldingSet.h" +#include "llvm/ADT/StringExtras.h" +#include "llvm/ADT/StringMap.h" #include #include using namespace llvm; @@ -67,40 +66,6 @@ //===----------------------------------------------------------------------===// /// Utility routines. /// -/// getGlobalVariablesUsing - Return all of the GlobalVariables which have the -/// specified value in their initializer somewhere. -static void -getGlobalVariablesUsing(Value *V, std::vector &Result) { - // Scan though value users. - for (Value::use_iterator I = V->use_begin(), E = V->use_end(); I != E; ++I) { - if (GlobalVariable *GV = dyn_cast(*I)) { - // If the user is a GlobalVariable then add to result. - Result.push_back(GV); - } else if (Constant *C = dyn_cast(*I)) { - // If the user is a constant variable then scan its users. - getGlobalVariablesUsing(C, Result); - } - } -} - -/// getGlobalVariablesUsing - Return all of the GlobalVariables that use the -/// named GlobalVariable. -static void -getGlobalVariablesUsing(Module &M, const std::string &RootName, - std::vector &Result) { - std::vector FieldTypes; - FieldTypes.push_back(Type::Int32Ty); - FieldTypes.push_back(Type::Int32Ty); - - // Get the GlobalVariable root. - GlobalVariable *UseRoot = M.getGlobalVariable(RootName, - StructType::get(FieldTypes)); - - // If present and linkonce then scan for users. - if (UseRoot && UseRoot->hasLinkOnceLinkage()) - getGlobalVariablesUsing(UseRoot, Result); -} - /// getGlobalVariable - Return either a direct or cast Global value. /// static GlobalVariable *getGlobalVariable(Value *V) { @@ -138,7 +103,7 @@ DWLabel(const char *T, unsigned N) : Tag(T), Number(N) {} void Profile(FoldingSetNodeID &ID) const { - ID.AddString(std::string(Tag)); + ID.AddString(Tag); ID.AddInteger(Number); } @@ -559,7 +524,7 @@ ID.AddInteger(isAsIsLabel); ID.AddString(Label); } - virtual void Profile(FoldingSetNodeID &ID) { Profile(ID, Label); } + virtual void Profile(FoldingSetNodeID &ID) { Profile(ID, Label.c_str()); } #ifndef NDEBUG virtual void print(std::ostream &O) { @@ -1173,33 +1138,6 @@ }; //===----------------------------------------------------------------------===// -/// SrcFileInfo - This class is used to track source information. -/// -class SrcFileInfo { - unsigned DirectoryID; // Directory ID number. - std::string Name; // File name (not including directory.) -public: - SrcFileInfo(unsigned D, const std::string &N) : DirectoryID(D), Name(N) {} - - // Accessors - unsigned getDirectoryID() const { return DirectoryID; } - const std::string &getName() const { return Name; } - - /// operator== - Used by UniqueVector to locate entry. - /// - bool operator==(const SrcFileInfo &SI) const { - return getDirectoryID() == SI.getDirectoryID() && getName() == SI.getName(); - } - - /// operator< - Used by UniqueVector to locate entry. - /// - bool operator<(const SrcFileInfo &SI) const { - return getDirectoryID() < SI.getDirectoryID() || - (getDirectoryID() == SI.getDirectoryID() && getName() < SI.getName()); - } -}; - -//===----------------------------------------------------------------------===// /// DbgVariable - This class is used to track local variable information. /// class DbgVariable { @@ -1260,9 +1198,13 @@ // Attributes used to construct specific Dwarf sections. // - /// DW_CUs - All the compile units involved in this build. The index - /// of each entry in this vector corresponds to the sources in MMI. - DenseMap DW_CUs; + /// CompileUnitMap - A map of global variables representing compile units to + /// compile units. + DenseMap CompileUnitMap; + + /// CompileUnits - All the compile units in this module. + /// + SmallVector CompileUnits; /// MainCU - Some platform prefers one compile unit per .o file. In such /// cases, all dies are inserted in MainCU. @@ -1276,11 +1218,27 @@ /// std::vector Abbreviations; - /// Directories - Uniquing vector for directories. - UniqueVector Directories; + /// DirectoryIdMap - Directory name to directory id map. + /// + StringMap DirectoryIdMap; + + /// DirectoryNames - A list of directory names. + SmallVector DirectoryNames; + + /// SourceFileIdMap - Source file name to source file id map. + /// + StringMap SourceFileIdMap; - /// SrcFiles - Uniquing vector for source files. - UniqueVector SrcFiles; + /// SourceFileNames - A list of source file names. + SmallVector SourceFileNames; + + /// SourceIdMap - Source id map, i.e. pair of directory id and source file + /// id mapped to a unique id. + DenseMap, unsigned> SourceIdMap; + + /// SourceIds - Reverse map from source id to directory id + file id pair. + /// + SmallVector, 8> SourceIds; /// Lines - List of of source line correspondence. std::vector Lines; @@ -1434,7 +1392,7 @@ Die->AddValue(Attribute, Form, Value); } - /// AddString - Add a std::string attribute data and value. + /// AddString - Add a string attribute data and value. /// void AddString(DIE *Die, unsigned Attribute, unsigned Form, const std::string &String) { @@ -1691,7 +1649,8 @@ AddType(DW_Unit, &Buffer, FromTy); // Add name if not anonymous or intermediate type. - if (!Name.empty()) AddString(&Buffer, DW_AT_name, DW_FORM_string, Name); + if (!Name.empty()) + AddString(&Buffer, DW_AT_name, DW_FORM_string, Name); // Add size if non-zero (derived types might be zero-sized.) if (Size) @@ -1782,7 +1741,8 @@ } // Add name if not anonymous or intermediate type. - if (!Name.empty()) AddString(&Buffer, DW_AT_name, DW_FORM_string, Name); + if (!Name.empty()) + AddString(&Buffer, DW_AT_name, DW_FORM_string, Name); if (Tag == DW_TAG_enumeration_type || Tag == DW_TAG_structure_type || Tag == DW_TAG_union_type) { @@ -1846,7 +1806,8 @@ DIE *ConstructEnumTypeDIE(CompileUnit *DW_Unit, DIEnumerator *ETy) { DIE *Enumerator = new DIE(DW_TAG_enumerator); - AddString(Enumerator, DW_AT_name, DW_FORM_string, ETy->getName()); + const std::string &Name = ETy->getName(); + AddString(Enumerator, DW_AT_name, DW_FORM_string, Name); int64_t Value = ETy->getEnumValue(); AddSInt(Enumerator, DW_AT_const_value, DW_FORM_sdata, Value); return Enumerator; @@ -1856,7 +1817,8 @@ DIE *CreateGlobalVariableDIE(CompileUnit *DW_Unit, const DIGlobalVariable &GV) { DIE *GVDie = new DIE(DW_TAG_variable); - AddString(GVDie, DW_AT_name, DW_FORM_string, GV.getName()); + const std::string &Name = GV.getName(); + AddString(GVDie, DW_AT_name, DW_FORM_string, Name); const std::string &LinkageName = GV.getLinkageName(); if (!LinkageName.empty()) AddString(GVDie, DW_AT_MIPS_linkage_name, DW_FORM_string, LinkageName); @@ -1870,7 +1832,7 @@ /// CreateMemberDIE - Create new member DIE. DIE *CreateMemberDIE(CompileUnit *DW_Unit, const DIDerivedType &DT) { DIE *MemberDie = new DIE(DT.getTag()); - std::string Name = DT.getName(); + const std::string &Name = DT.getName(); if (!Name.empty()) AddString(MemberDie, DW_AT_name, DW_FORM_string, Name); @@ -1914,7 +1876,8 @@ const DISubprogram &SP, bool IsConstructor = false) { DIE *SPDie = new DIE(DW_TAG_subprogram); - AddString(SPDie, DW_AT_name, DW_FORM_string, SP.getName()); + const std::string &Name = SP.getName(); + AddString(SPDie, DW_AT_name, DW_FORM_string, Name); const std::string &LinkageName = SP.getLinkageName(); if (!LinkageName.empty()) AddString(SPDie, DW_AT_MIPS_linkage_name, DW_FORM_string, @@ -1955,7 +1918,7 @@ /// FindCompileUnit - Get the compile unit for the given descriptor. /// CompileUnit *FindCompileUnit(DICompileUnit Unit) { - CompileUnit *DW_Unit = DW_CUs[Unit.getGV()]; + CompileUnit *DW_Unit = CompileUnitMap[Unit.getGV()]; assert(DW_Unit && "Missing compile unit."); return DW_Unit; } @@ -1978,7 +1941,8 @@ // Define variable debug information entry. DIE *VariableDie = new DIE(Tag); - AddString(VariableDie, DW_AT_name, DW_FORM_string, VD.getName()); + const std::string &Name = VD.getName(); + AddString(VariableDie, DW_AT_name, DW_FORM_string, Name); // Add source line info if available. AddSourceLine(VariableDie, &VD); @@ -2119,27 +2083,12 @@ /// ConstructDefaultDbgScope - Construct a default scope for the subprogram. /// void ConstructDefaultDbgScope(MachineFunction *MF) { - // Find the correct subprogram descriptor. - std::string SPName = "llvm.dbg.subprograms"; - std::vector Result; - getGlobalVariablesUsing(*M, SPName, Result); - - for (std::vector::iterator I = Result.begin(), - E = Result.end(); I != E; ++I) { - DISubprogram SPD(*I); - - if (SPD.getName() == MF->getFunction()->getName()) { - // Get the compile unit context. - CompileUnit *Unit = MainCU; - if (!Unit) - Unit = FindCompileUnit(SPD.getCompileUnit()); - - // Get the subprogram die. - DIE *SPDie = Unit->getDieMapSlotFor(SPD.getGV()); - if (!SPDie) - /* A subprogram die may not exist if the corresponding function - does not have any debug info. */ - continue; + const char *FnName = MF->getFunction()->getNameStart(); + if (MainCU) { + std::map &Globals = MainCU->getGlobals(); + std::map::iterator GI = Globals.find(FnName); + if (GI != Globals.end()) { + DIE *SPDie = GI->second; // Add the function bounds. AddLabel(SPDie, DW_AT_low_pc, DW_FORM_addr, @@ -2151,12 +2100,33 @@ AddAddress(SPDie, DW_AT_frame_base, Location); return; } + } else { + for (unsigned i = 0, e = CompileUnits.size(); i != e; ++i) { + CompileUnit *Unit = CompileUnits[i]; + std::map &Globals = Unit->getGlobals(); + std::map::iterator GI = Globals.find(FnName); + if (GI != Globals.end()) { + DIE *SPDie = GI->second; + + // Add the function bounds. + AddLabel(SPDie, DW_AT_low_pc, DW_FORM_addr, + DWLabel("func_begin", SubprogramCount)); + AddLabel(SPDie, DW_AT_high_pc, DW_FORM_addr, + DWLabel("func_end", SubprogramCount)); + + MachineLocation Location(RI->getFrameRegister(*MF)); + AddAddress(SPDie, DW_AT_frame_base, Location); + return; + } + } } + #if 0 // FIXME: This is causing an abort because C++ mangled names are compared // with their unmangled counterparts. See PR2885. Don't do this assert. assert(0 && "Couldn't find DIE for machine function!"); #endif + return; } /// EmitInitial - Emit initial Dwarf declarations. This is necessary for cc @@ -2316,9 +2286,8 @@ SizeAndOffsetDie(MainCU->getDie(), Offset, true); return; } - for (DenseMap::iterator CI = DW_CUs.begin(), - CE = DW_CUs.end(); CI != CE; ++CI) { - CompileUnit *Unit = CI->second; + for (unsigned i = 0, e = CompileUnits.size(); i != e; ++i) { + CompileUnit *Unit = CompileUnits[i]; // Compute size of compile unit header unsigned Offset = sizeof(int32_t) + // Length of Compilation Unit Info sizeof(int16_t) + // DWARF version number @@ -2328,45 +2297,47 @@ } } - /// EmitDebugInfo - Emit the debug info section. + /// EmitDebugInfo / EmitDebugInfoPerCU - Emit the debug info section. /// + void EmitDebugInfoPerCU(CompileUnit *Unit) { + DIE *Die = Unit->getDie(); + // Emit the compile units header. + EmitLabel("info_begin", Unit->getID()); + // Emit size of content not including length itself + unsigned ContentSize = Die->getSize() + + sizeof(int16_t) + // DWARF version number + sizeof(int32_t) + // Offset Into Abbrev. Section + sizeof(int8_t) + // Pointer Size (in bytes) + sizeof(int32_t); // FIXME - extra pad for gdb bug. + + Asm->EmitInt32(ContentSize); Asm->EOL("Length of Compilation Unit Info"); + Asm->EmitInt16(DWARF_VERSION); Asm->EOL("DWARF version number"); + EmitSectionOffset("abbrev_begin", "section_abbrev", 0, 0, true, false); + Asm->EOL("Offset Into Abbrev. Section"); + Asm->EmitInt8(TD->getPointerSize()); Asm->EOL("Address Size (in bytes)"); + + EmitDIE(Die); + // FIXME - extra padding for gdb bug. + Asm->EmitInt8(0); Asm->EOL("Extra Pad For GDB"); + Asm->EmitInt8(0); Asm->EOL("Extra Pad For GDB"); + Asm->EmitInt8(0); Asm->EOL("Extra Pad For GDB"); + Asm->EmitInt8(0); Asm->EOL("Extra Pad For GDB"); + EmitLabel("info_end", Unit->getID()); + + Asm->EOL(); + } + void EmitDebugInfo() { // Start debug info section. Asm->SwitchToDataSection(TAI->getDwarfInfoSection()); - for (DenseMap::iterator CI = DW_CUs.begin(), - CE = DW_CUs.end(); CI != CE; ++CI) { - CompileUnit *Unit = CI->second; - if (MainCU) - Unit = MainCU; - DIE *Die = Unit->getDie(); - // Emit the compile units header. - EmitLabel("info_begin", Unit->getID()); - // Emit size of content not including length itself - unsigned ContentSize = Die->getSize() + - sizeof(int16_t) + // DWARF version number - sizeof(int32_t) + // Offset Into Abbrev. Section - sizeof(int8_t) + // Pointer Size (in bytes) - sizeof(int32_t); // FIXME - extra pad for gdb bug. - - Asm->EmitInt32(ContentSize); Asm->EOL("Length of Compilation Unit Info"); - Asm->EmitInt16(DWARF_VERSION); Asm->EOL("DWARF version number"); - EmitSectionOffset("abbrev_begin", "section_abbrev", 0, 0, true, false); - Asm->EOL("Offset Into Abbrev. Section"); - Asm->EmitInt8(TD->getPointerSize()); Asm->EOL("Address Size (in bytes)"); - - EmitDIE(Die); - // FIXME - extra padding for gdb bug. - Asm->EmitInt8(0); Asm->EOL("Extra Pad For GDB"); - Asm->EmitInt8(0); Asm->EOL("Extra Pad For GDB"); - Asm->EmitInt8(0); Asm->EOL("Extra Pad For GDB"); - Asm->EmitInt8(0); Asm->EOL("Extra Pad For GDB"); - EmitLabel("info_end", Unit->getID()); - - Asm->EOL(); - if (MainCU) - return; + if (MainCU) { + EmitDebugInfoPerCU(MainCU); + return; } + + for (unsigned i = 0, e = CompileUnits.size(); i != e; ++i) + EmitDebugInfoPerCU(CompileUnits[i]); } /// EmitAbbreviations - Emit the abbreviation section. @@ -2469,19 +2440,19 @@ Asm->EmitInt8(1); Asm->EOL("DW_LNS_fixed_advance_pc arg count"); // Emit directories. - for (unsigned DirectoryID = 1, NDID = Directories.size(); - DirectoryID <= NDID; ++DirectoryID) { - Asm->EmitString(Directories[DirectoryID]); Asm->EOL("Directory"); + for (unsigned DI = 1, DE = getNumSourceDirectories()+1; DI != DE; ++DI) { + Asm->EmitString(getSourceDirectoryName(DI)); + Asm->EOL("Directory"); } Asm->EmitInt8(0); Asm->EOL("End of directories"); // Emit files. - for (unsigned SourceID = 1, NSID = SrcFiles.size(); - SourceID <= NSID; ++SourceID) { - const SrcFileInfo &SourceFile = SrcFiles[SourceID]; - Asm->EmitString(SourceFile.getName()); + for (unsigned SI = 1, SE = getNumSourceIds()+1; SI != SE; ++SI) { + // Remember source id starts at 1. + std::pair Id = getSourceDirsectoryAndFileIds(SI); + Asm->EmitString(getSourceFileName(Id.second)); Asm->EOL("Source"); - Asm->EmitULEB128Bytes(SourceFile.getDirectoryID()); + Asm->EmitULEB128Bytes(Id.first); Asm->EOL("Directory #"); Asm->EmitULEB128Bytes(0); Asm->EOL("Mod date"); @@ -2501,7 +2472,8 @@ if (VerboseAsm) { const Section* S = SectionMap[j + 1]; - Asm->EOL(std::string("Section ") + S->getName()); + O << '\t' << TAI->getCommentString() << " Section" + << S->getName() << '\n'; } else Asm->EOL(); @@ -2515,16 +2487,16 @@ unsigned LabelID = MMI->MappedLabel(LineInfo.getLabelID()); if (!LabelID) continue; - unsigned SourceID = LineInfo.getSourceID(); - const SrcFileInfo &SourceFile = SrcFiles[SourceID]; - unsigned DirectoryID = SourceFile.getDirectoryID(); - if (VerboseAsm) - Asm->EOL(Directories[DirectoryID] - + SourceFile.getName() - + ":" - + utostr_32(LineInfo.getLine())); - else + if (!VerboseAsm) Asm->EOL(); + else { + std::pair SourceID = + getSourceDirsectoryAndFileIds(LineInfo.getSourceID()); + O << '\t' << TAI->getCommentString() << ' ' + << getSourceDirectoryName(SourceID.first) << ' ' + << getSourceFileName(SourceID.second) + <<" :" << utostr_32(LineInfo.getLine()) << '\n'; + } // Define the line address. Asm->EmitInt8(0); Asm->EOL("Extended Op"); @@ -2656,53 +2628,52 @@ Asm->EOL(); } - /// EmitDebugPubNames - Emit visible names into a debug pubnames section. - /// - void EmitDebugPubNames() { - // Start the dwarf pubnames section. - Asm->SwitchToDataSection(TAI->getDwarfPubNamesSection()); - - for (DenseMap::iterator CI = DW_CUs.begin(), - CE = DW_CUs.end(); CI != CE; ++CI) { - CompileUnit *Unit = CI->second; - if (MainCU) - Unit = MainCU; - - EmitDifference("pubnames_end", Unit->getID(), - "pubnames_begin", Unit->getID(), true); - Asm->EOL("Length of Public Names Info"); + void EmitDebugPubNamesPerCU(CompileUnit *Unit) { + EmitDifference("pubnames_end", Unit->getID(), + "pubnames_begin", Unit->getID(), true); + Asm->EOL("Length of Public Names Info"); - EmitLabel("pubnames_begin", Unit->getID()); + EmitLabel("pubnames_begin", Unit->getID()); - Asm->EmitInt16(DWARF_VERSION); Asm->EOL("DWARF Version"); + Asm->EmitInt16(DWARF_VERSION); Asm->EOL("DWARF Version"); - EmitSectionOffset("info_begin", "section_info", - Unit->getID(), 0, true, false); - Asm->EOL("Offset of Compilation Unit Info"); - - EmitDifference("info_end", Unit->getID(), "info_begin", Unit->getID(), - true); - Asm->EOL("Compilation Unit Length"); + EmitSectionOffset("info_begin", "section_info", + Unit->getID(), 0, true, false); + Asm->EOL("Offset of Compilation Unit Info"); - std::map &Globals = Unit->getGlobals(); + EmitDifference("info_end", Unit->getID(), "info_begin", Unit->getID(), + true); + Asm->EOL("Compilation Unit Length"); - for (std::map::iterator GI = Globals.begin(), - GE = Globals.end(); - GI != GE; ++GI) { - const std::string &Name = GI->first; - DIE * Entity = GI->second; + std::map &Globals = Unit->getGlobals(); + for (std::map::iterator GI = Globals.begin(), + GE = Globals.end(); GI != GE; ++GI) { + const std::string &Name = GI->first; + DIE * Entity = GI->second; - Asm->EmitInt32(Entity->getOffset()); Asm->EOL("DIE offset"); - Asm->EmitString(Name); Asm->EOL("External Name"); - } + Asm->EmitInt32(Entity->getOffset()); Asm->EOL("DIE offset"); + Asm->EmitString(Name); Asm->EOL("External Name"); + } - Asm->EmitInt32(0); Asm->EOL("End Mark"); - EmitLabel("pubnames_end", Unit->getID()); + Asm->EmitInt32(0); Asm->EOL("End Mark"); + EmitLabel("pubnames_end", Unit->getID()); - Asm->EOL(); - if (MainCU) - return; + Asm->EOL(); + } + + /// EmitDebugPubNames - Emit visible names into a debug pubnames section. + /// + void EmitDebugPubNames() { + // Start the dwarf pubnames section. + Asm->SwitchToDataSection(TAI->getDwarfPubNamesSection()); + + if (MainCU) { + EmitDebugPubNamesPerCU(MainCU); + return; } + + for (unsigned i = 0, e = CompileUnits.size(); i != e; ++i) + EmitDebugPubNamesPerCU(CompileUnits[i]); } /// EmitDebugStr - Emit visible names into a debug str section. @@ -2792,122 +2763,160 @@ } } + void ConstructCompileUnit(GlobalVariable *GV) { + DICompileUnit DIUnit(GV); + unsigned ID = getOrCreateSourceID(DIUnit.getDirectory(), + DIUnit.getFilename()); + + DIE *Die = new DIE(DW_TAG_compile_unit); + AddSectionOffset(Die, DW_AT_stmt_list, DW_FORM_data4, + DWLabel("section_line", 0), DWLabel("section_line", 0), + false); + AddString(Die, DW_AT_producer, DW_FORM_string, DIUnit.getProducer()); + AddUInt(Die, DW_AT_language, DW_FORM_data1, DIUnit.getLanguage()); + AddString(Die, DW_AT_name, DW_FORM_string, DIUnit.getFilename()); + if (!DIUnit.getDirectory().empty()) + AddString(Die, DW_AT_comp_dir, DW_FORM_string, DIUnit.getDirectory()); + if (DIUnit.isOptimized()) + AddUInt(Die, DW_AT_APPLE_optimized, DW_FORM_flag, 1); + const std::string &Flags = DIUnit.getFlags(); + if (!Flags.empty()) + AddString(Die, DW_AT_APPLE_flags, DW_FORM_string, Flags); + unsigned RVer = DIUnit.getRunTimeVersion(); + if (RVer) + AddUInt(Die, DW_AT_APPLE_major_runtime_vers, DW_FORM_data1, RVer); + + CompileUnit *Unit = new CompileUnit(ID, Die); + if (DIUnit.isMain()) { + assert(!MainCU && "Multiple main compile units are found!"); + MainCU = Unit; + } + CompileUnitMap[DIUnit.getGV()] = Unit; + CompileUnits.push_back(Unit); + } + /// ConstructCompileUnits - Create a compile unit DIEs. void ConstructCompileUnits() { - std::string CUName = "llvm.dbg.compile_units"; - std::vector Result; - getGlobalVariablesUsing(*M, CUName, Result); - for (std::vector::iterator RI = Result.begin(), - RE = Result.end(); RI != RE; ++RI) { - DICompileUnit DIUnit(*RI); - unsigned ID = RecordSource(DIUnit.getDirectory(), - DIUnit.getFilename()); - - DIE *Die = new DIE(DW_TAG_compile_unit); - AddSectionOffset(Die, DW_AT_stmt_list, DW_FORM_data4, - DWLabel("section_line", 0), DWLabel("section_line", 0), - false); - AddString(Die, DW_AT_producer, DW_FORM_string, DIUnit.getProducer()); - AddUInt(Die, DW_AT_language, DW_FORM_data1, DIUnit.getLanguage()); - AddString(Die, DW_AT_name, DW_FORM_string, DIUnit.getFilename()); - if (!DIUnit.getDirectory().empty()) - AddString(Die, DW_AT_comp_dir, DW_FORM_string, DIUnit.getDirectory()); - if (DIUnit.isOptimized()) - AddUInt(Die, DW_AT_APPLE_optimized, DW_FORM_flag, 1); - const std::string &Flags = DIUnit.getFlags(); - if (!Flags.empty()) - AddString(Die, DW_AT_APPLE_flags, DW_FORM_string, Flags); - unsigned RVer = DIUnit.getRunTimeVersion(); - if (RVer) - AddUInt(Die, DW_AT_APPLE_major_runtime_vers, DW_FORM_data1, RVer); - - CompileUnit *Unit = new CompileUnit(ID, Die); - if (DIUnit.isMain()) { - assert(!MainCU && "Multiple main compile units are found!"); - MainCU = Unit; + GlobalVariable *Root = M->getGlobalVariable("llvm.dbg.compile_units"); + if (!Root) + return; + assert(Root->hasLinkOnceLinkage() && Root->hasOneUse() && + "Malformed compile unit descriptor anchor type"); + Constant *RootC = cast(*Root->use_begin()); + assert(RootC->hasNUsesOrMore(1) && + "Malformed compile unit descriptor anchor type"); + for (Value::use_iterator UI = RootC->use_begin(), UE = Root->use_end(); + UI != UE; ++UI) + for (Value::use_iterator UUI = UI->use_begin(), UUE = UI->use_end(); + UUI != UUE; ++UUI) { + GlobalVariable *GV = cast(*UUI); + ConstructCompileUnit(GV); } - DW_CUs[DIUnit.getGV()] = Unit; - } + } + + bool ConstructGlobalVariableDIE(GlobalVariable *GV) { + DIGlobalVariable DI_GV(GV); + CompileUnit *DW_Unit = MainCU; + if (!DW_Unit) + DW_Unit = FindCompileUnit(DI_GV.getCompileUnit()); + + // Check for pre-existence. + DIE *&Slot = DW_Unit->getDieMapSlotFor(DI_GV.getGV()); + if (Slot) + return false; + + DIE *VariableDie = CreateGlobalVariableDIE(DW_Unit, DI_GV); + + // Add address. + DIEBlock *Block = new DIEBlock(); + AddUInt(Block, 0, DW_FORM_data1, DW_OP_addr); + AddObjectLabel(Block, 0, DW_FORM_udata, + Asm->getGlobalLinkName(DI_GV.getGlobal())); + AddBlock(VariableDie, DW_AT_location, 0, Block); + + // Add to map. + Slot = VariableDie; + // Add to context owner. + DW_Unit->getDie()->AddChild(VariableDie); + // Expose as global. FIXME - need to check external flag. + DW_Unit->AddGlobal(DI_GV.getName(), VariableDie); + return true; } /// ConstructGlobalVariableDIEs - Create DIEs for each of the externally /// visible global variables. Return true if at least one global DIE is /// created. bool ConstructGlobalVariableDIEs() { - std::string GVName = "llvm.dbg.global_variables"; - std::vector Result; - getGlobalVariablesUsing(*M, GVName, Result); - bool result = false; - for (std::vector::iterator GVI = Result.begin(), - GVE = Result.end(); GVI != GVE; ++GVI) { - DIGlobalVariable DI_GV(*GVI); - CompileUnit *DW_Unit = MainCU; - if (!DW_Unit) - DW_Unit = FindCompileUnit(DI_GV.getCompileUnit()); - - // Check for pre-existence. - DIE *&Slot = DW_Unit->getDieMapSlotFor(DI_GV.getGV()); - if (Slot) continue; - - DIE *VariableDie = CreateGlobalVariableDIE(DW_Unit, DI_GV); - - // Add address. - DIEBlock *Block = new DIEBlock(); - AddUInt(Block, 0, DW_FORM_data1, DW_OP_addr); - AddObjectLabel(Block, 0, DW_FORM_udata, - Asm->getGlobalLinkName(DI_GV.getGlobal())); - AddBlock(VariableDie, DW_AT_location, 0, Block); - - //Add to map. - Slot = VariableDie; - //Add to context owner. - DW_Unit->getDie()->AddChild(VariableDie); - //Expose as global. FIXME - need to check external flag. - DW_Unit->AddGlobal(DI_GV.getName(), VariableDie); - - if (!result) - result = true; - } - return result; + GlobalVariable *Root = M->getGlobalVariable("llvm.dbg.global_variables"); + if (!Root) + return false; + + assert(Root->hasLinkOnceLinkage() && Root->hasOneUse() && + "Malformed global variable descriptor anchor type"); + Constant *RootC = cast(*Root->use_begin()); + assert(RootC->hasNUsesOrMore(1) && + "Malformed global variable descriptor anchor type"); + + bool Result = false; + for (Value::use_iterator UI = RootC->use_begin(), UE = Root->use_end(); + UI != UE; ++UI) + for (Value::use_iterator UUI = UI->use_begin(), UUE = UI->use_end(); + UUI != UUE; ++UUI) { + GlobalVariable *GV = cast(*UUI); + Result |= ConstructGlobalVariableDIE(GV); + } + return Result; + } + + bool ConstructSubprogram(GlobalVariable *GV) { + DISubprogram SP(GV); + CompileUnit *Unit = MainCU; + if (!Unit) + Unit = FindCompileUnit(SP.getCompileUnit()); + + // Check for pre-existence. + DIE *&Slot = Unit->getDieMapSlotFor(GV); + if (Slot) + return false; + + if (!SP.isDefinition()) + // This is a method declaration which will be handled while + // constructing class type. + return false; + + DIE *SubprogramDie = CreateSubprogramDIE(Unit, SP); + + // Add to map. + Slot = SubprogramDie; + // Add to context owner. + Unit->getDie()->AddChild(SubprogramDie); + // Expose as global. + Unit->AddGlobal(SP.getName(), SubprogramDie); + return true; } /// ConstructSubprograms - Create DIEs for each of the externally visible /// subprograms. Return true if at least one subprogram DIE is created. bool ConstructSubprograms() { - std::string SPName = "llvm.dbg.subprograms"; - std::vector Result; - getGlobalVariablesUsing(*M, SPName, Result); - bool result = false; - for (std::vector::iterator RI = Result.begin(), - RE = Result.end(); RI != RE; ++RI) { - - DISubprogram SP(*RI); - CompileUnit *Unit = MainCU; - if (!Unit) - Unit = FindCompileUnit(SP.getCompileUnit()); - - // Check for pre-existence. - DIE *&Slot = Unit->getDieMapSlotFor(SP.getGV()); - if (Slot) continue; - - if (!SP.isDefinition()) - // This is a method declaration which will be handled while - // constructing class type. - continue; - - DIE *SubprogramDie = CreateSubprogramDIE(Unit, SP); - - //Add to map. - Slot = SubprogramDie; - //Add to context owner. - Unit->getDie()->AddChild(SubprogramDie); - //Expose as global. - Unit->AddGlobal(SP.getName(), SubprogramDie); - - if (!result) - result = true; - } - return result; + GlobalVariable *Root = M->getGlobalVariable("llvm.dbg.subprograms"); + if (!Root) + return false; + + assert(Root->hasLinkOnceLinkage() && Root->hasOneUse() && + "Malformed subprogram descriptor anchor type"); + Constant *RootC = cast(*Root->use_begin()); + assert(RootC->hasNUsesOrMore(1) && + "Malformed subprogram descriptor anchor type"); + + bool Result = false; + for (Value::use_iterator UI = RootC->use_begin(), UE = Root->use_end(); + UI != UE; ++UI) + for (Value::use_iterator UUI = UI->use_begin(), UUE = UI->use_end(); + UUI != UUE; ++UUI) { + GlobalVariable *GV = cast(*UUI); + Result |= ConstructSubprogram(GV); + } + return Result; } public: @@ -2940,7 +2949,7 @@ // Create all the compile unit DIEs. ConstructCompileUnits(); - if (DW_CUs.empty()) + if (CompileUnits.empty()) return; // Create DIEs for each of the externally visible global variables. @@ -2964,9 +2973,12 @@ // Print out .file directives to specify files for .loc directives. These // are printed out early so that they precede any .loc directives. if (TAI->hasDotLocAndDotFile()) { - for (unsigned i = 1, e = SrcFiles.size(); i <= e; ++i) { - sys::Path FullPath(Directories[SrcFiles[i].getDirectoryID()]); - bool AppendOk = FullPath.appendComponent(SrcFiles[i].getName()); + for (unsigned i = 1, e = getNumSourceIds()+1; i != e; ++i) { + // Remember source id starts at 1. + std::pair Id = getSourceDirsectoryAndFileIds(i); + sys::Path FullPath(getSourceDirectoryName(Id.first)); + bool AppendOk = + FullPath.appendComponent(getSourceFileName(Id.second)); assert(AppendOk && "Could not append filename to directory!"); AppendOk = false; Asm->EmitFile(i, FullPath.toString()); @@ -3152,7 +3164,7 @@ /// label. Returns a unique label ID used to generate a label and provide /// correspondence to the source line list. unsigned RecordSourceLine(Value *V, unsigned Line, unsigned Col) { - CompileUnit *Unit = DW_CUs[V]; + CompileUnit *Unit = CompileUnitMap[V]; assert(Unit && "Unable to find CompileUnit"); unsigned ID = MMI->NextLabelID(); Lines.push_back(SrcLineInfo(Line, Col, Unit->getID(), ID)); @@ -3172,12 +3184,77 @@ return Lines.size(); } - /// RecordSource - Register a source file with debug info. Returns an source - /// ID. - unsigned RecordSource(const std::string &Directory, - const std::string &File) { - unsigned DID = Directories.insert(Directory); - return SrcFiles.insert(SrcFileInfo(DID,File)); + /// getNumSourceDirectories - Return the number of source directories in the + /// debug info. + unsigned getNumSourceDirectories() const { + return DirectoryNames.size(); + } + + /// getSourceDirectoryName - Return the name of the directory corresponding + /// to the id. + const std::string &getSourceDirectoryName(unsigned Id) const { + return DirectoryNames[Id - 1]; + } + + /// getNumSourceFiles - Return the number of source files in the debug info. + /// + unsigned getNumSourceFiles() const { + return SourceFileNames.size(); + } + + /// getSourceFileName - Return the name of the source file corresponding + /// to the id. + const std::string &getSourceFileName(unsigned Id) const { + return SourceFileNames[Id - 1]; + } + + /// getNumSourceIds - Return the number of unique source ids. + /// + unsigned getNumSourceIds() const { + return SourceIds.size(); + } + + /// getSourceDirsectoryAndFileIds - Return the directory and file ids that + /// maps to the source id. Source id starts at 1. + std::pair + getSourceDirsectoryAndFileIds(unsigned SId) const { + return SourceIds[SId-1]; + } + + /// getOrCreateSourceID - Look up the source id with the given directory and + /// source file names. If none currently exists, create a new id and insert it + /// in the SourceIds map. This can update DirectoryNames and SourceFileNames maps + /// as well. + unsigned getOrCreateSourceID(const std::string &DirName, + const std::string &FileName) { + unsigned DId; + StringMap::iterator DI = DirectoryIdMap.find(DirName); + if (DI != DirectoryIdMap.end()) + DId = DI->getValue(); + else { + DId = DirectoryNames.size() + 1; + DirectoryIdMap[DirName] = DId; + DirectoryNames.push_back(DirName); + } + + unsigned FId; + StringMap::iterator FI = SourceFileIdMap.find(FileName); + if (FI != SourceFileIdMap.end()) + FId = FI->getValue(); + else { + FId = SourceFileNames.size() + 1; + SourceFileIdMap[FileName] = FId; + SourceFileNames.push_back(FileName); + } + + DenseMap, unsigned>::iterator SI = + SourceIdMap.find(std::make_pair(DId, FId)); + if (SI != SourceIdMap.end()) + return SI->second; + unsigned SrcId = SourceIds.size() + 1; // DW_AT_decl_file cannot be 0. + SourceIdMap[std::make_pair(DId, FId)] = SrcId; + SourceIds.push_back(std::make_pair(DId, FId)); + return SrcId; } /// RecordRegionStart - Indicate the start of a region. @@ -3891,7 +3968,7 @@ void EndModule() { if (shouldEmitMovesModule || shouldEmitTableModule) { const std::vector Personalities = MMI->getPersonalities(); - for (unsigned i =0; i < Personalities.size(); ++i) + for (unsigned i = 0; i < Personalities.size(); ++i) EmitCommonEHFrame(Personalities[i], i); for (std::vector::iterator I = EHFrames.begin(), @@ -4324,11 +4401,13 @@ return DD->RecordSourceLine(Line, Col, Src); } -/// RecordSource - Register a source file with debug info. Returns an source -/// ID. -unsigned DwarfWriter::RecordSource(const std::string &Dir, - const std::string &File) { - return DD->RecordSource(Dir, File); +/// getOrCreateSourceID - Look up the source id with the given directory and +/// source file names. If none currently exists, create a new id and insert it +/// in the SourceIds map. This can update DirectoryNames and SourceFileNames maps +/// as well. +unsigned DwarfWriter::getOrCreateSourceID(const std::string &DirName, + const std::string &FileName) { + return DD->getOrCreateSourceID(DirName, FileName); } /// RecordRegionStart - Indicate the start of a region. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp?rev=65438&r1=65437&r2=65438&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp Wed Feb 25 01:04:34 2009 @@ -319,8 +319,8 @@ DbgStopPointInst *SPI = cast(I); if (DW && DW->ValidDebugInfo(SPI->getContext())) { DICompileUnit CU(cast(SPI->getContext())); - unsigned SrcFile = DW->RecordSource(CU.getDirectory(), - CU.getFilename()); + unsigned SrcFile = DW->getOrCreateSourceID(CU.getDirectory(), + CU.getFilename()); unsigned Line = SPI->getLine(); unsigned Col = SPI->getColumn(); unsigned ID = DW->RecordSourceLine(Line, Col, SrcFile); @@ -361,8 +361,8 @@ // (most?) gdb expects. DISubprogram Subprogram(cast(SP)); DICompileUnit CompileUnit = Subprogram.getCompileUnit(); - unsigned SrcFile = DW->RecordSource(CompileUnit.getDirectory(), - CompileUnit.getFilename()); + unsigned SrcFile = DW->getOrCreateSourceID(CompileUnit.getDirectory(), + CompileUnit.getFilename()); // Record the source line but does not create a label for the normal // function start. It will be emitted at asm emission time. However, Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=65438&r1=65437&r2=65438&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Wed Feb 25 01:04:34 2009 @@ -1287,8 +1287,8 @@ GlobalVariable *CU_GV = cast(DSP->getCompileUnit()); if (DW && (useDEBUG_LOC || useLABEL) && !CU_GV->isDeclaration()) { DICompileUnit CU(cast(DSP->getCompileUnit())); - unsigned SrcFile = DW->RecordSource(CU.getDirectory(), - CU.getFilename()); + unsigned SrcFile = DW->getOrCreateSourceID(CU.getDirectory(), + CU.getFilename()); unsigned Line = DSP->getLine(); unsigned Col = DSP->getColumn(); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=65438&r1=65437&r2=65438&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Wed Feb 25 01:04:34 2009 @@ -335,8 +335,8 @@ if (DW && DW->ValidDebugInfo(SPI->getContext())) { DICompileUnit CU(cast(SPI->getContext())); - unsigned SrcFile = DW->RecordSource(CU.getDirectory(), - CU.getFilename()); + unsigned SrcFile = DW->getOrCreateSourceID(CU.getDirectory(), + CU.getFilename()); unsigned idx = MF->getOrCreateDebugLocID(SrcFile, SPI->getLine(), SPI->getColumn()); @@ -354,8 +354,8 @@ if (DW->ValidDebugInfo(SP)) { DISubprogram Subprogram(cast(SP)); DICompileUnit CU(Subprogram.getCompileUnit()); - unsigned SrcFile = DW->RecordSource(CU.getDirectory(), - CU.getFilename()); + unsigned SrcFile = DW->getOrCreateSourceID(CU.getDirectory(), + CU.getFilename()); unsigned Line = Subprogram.getLineNumber(); DL = DebugLoc::get(MF->getOrCreateDebugLocID(SrcFile, Line, 0)); } @@ -3892,16 +3892,16 @@ DwarfWriter *DW = DAG.getDwarfWriter(); DbgStopPointInst &SPI = cast(I); if (DW && DW->ValidDebugInfo(SPI.getContext())) { + MachineFunction &MF = DAG.getMachineFunction(); DAG.setRoot(DAG.getDbgStopPoint(getRoot(), SPI.getLine(), SPI.getColumn(), SPI.getContext())); DICompileUnit CU(cast(SPI.getContext())); - unsigned SrcFile = DW->RecordSource(CU.getDirectory(), CU.getFilename()); - unsigned idx = DAG.getMachineFunction(). - getOrCreateDebugLocID(SrcFile, - SPI.getLine(), - SPI.getColumn()); + unsigned SrcFile = DW->getOrCreateSourceID(CU.getDirectory(), + CU.getFilename()); + unsigned idx = MF.getOrCreateDebugLocID(SrcFile, + SPI.getLine(), SPI.getColumn()); setCurDebugLoc(DebugLoc::get(idx)); } return 0; @@ -3940,10 +3940,11 @@ if (SP && DW->ValidDebugInfo(SP)) { // llvm.dbg.func.start implicitly defines a dbg_stoppoint which is // what (most?) gdb expects. + MachineFunction &MF = DAG.getMachineFunction(); DISubprogram Subprogram(cast(SP)); DICompileUnit CompileUnit = Subprogram.getCompileUnit(); - unsigned SrcFile = DW->RecordSource(CompileUnit.getDirectory(), - CompileUnit.getFilename()); + unsigned SrcFile = DW->getOrCreateSourceID(CompileUnit.getDirectory(), + CompileUnit.getFilename()); // Record the source line but does not create a label for the normal // function start. It will be emitted at asm emission time. However, @@ -3957,8 +3958,7 @@ getRoot(), LabelID)); } - setCurDebugLoc(DebugLoc::get(DAG.getMachineFunction(). - getOrCreateDebugLocID(SrcFile, Line, 0))); + setCurDebugLoc(DebugLoc::get(MF.getOrCreateDebugLocID(SrcFile, Line, 0))); } return 0; From anton at korobeynikov.info Wed Feb 25 01:16:14 2009 From: anton at korobeynikov.info (Anton Korobeynikov) Date: Wed, 25 Feb 2009 10:16:14 +0300 Subject: [llvm-commits] CVS: llvm-test/MultiSource/Benchmarks/Olden/bisort/bitonic.c In-Reply-To: <6122FB79-DFE0-4B32-8BC6-67E9D1BA0D97@apple.com> References: <200902250214.n1P2ECBc018252@zion.cs.uiuc.edu> <5F065E67-F982-4A87-9064-B7909D951AE0@gmail.com> <6122FB79-DFE0-4B32-8BC6-67E9D1BA0D97@apple.com> Message-ID: <0AC2792E-3128-4E0F-8C03-4B83BD4984C1@korobeynikov.info> >> Anon? Who is this? > > Maybe anton forgot a t? I don't think I have an account @ cs.uiuc.edu :) Also, note, this is *CVS* commit --- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University From sabre at nondot.org Wed Feb 25 01:32:53 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 25 Feb 2009 07:32:53 -0000 Subject: [llvm-commits] [llvm] r65439 - /llvm/trunk/docs/ReleaseNotes.html Message-ID: <200902250732.n1P7WsNh029079@zion.cs.uiuc.edu> Author: lattner Date: Wed Feb 25 01:32:53 2009 New Revision: 65439 URL: http://llvm.org/viewvc/llvm-project?rev=65439&view=rev Log: more notes. Modified: llvm/trunk/docs/ReleaseNotes.html Modified: llvm/trunk/docs/ReleaseNotes.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ReleaseNotes.html?rev=65439&r1=65438&r2=65439&view=diff ============================================================================== --- llvm/trunk/docs/ReleaseNotes.html (original) +++ llvm/trunk/docs/ReleaseNotes.html Wed Feb 25 01:32:53 2009 @@ -56,10 +56,11 @@ Machine Sinking target-specific intrinsics gold lto plugin - pre-alloc splitter + pre-alloc splitter, strong phi elim llc -enable-value-prop, propagation of value info (sign/zero ext info) from one MBB to another debug info for optimized code + --> From clattner at apple.com Wed Feb 25 01:34:31 2009 From: clattner at apple.com (Chris Lattner) Date: Tue, 24 Feb 2009 23:34:31 -0800 Subject: [llvm-commits] CVS: llvm-test/MultiSource/Benchmarks/Olden/bisort/bitonic.c In-Reply-To: <0AC2792E-3128-4E0F-8C03-4B83BD4984C1@korobeynikov.info> References: <200902250214.n1P2ECBc018252@zion.cs.uiuc.edu> <5F065E67-F982-4A87-9064-B7909D951AE0@gmail.com> <6122FB79-DFE0-4B32-8BC6-67E9D1BA0D97@apple.com> <0AC2792E-3128-4E0F-8C03-4B83BD4984C1@korobeynikov.info> Message-ID: <66115DAD-7F6D-4D27-80D0-D0560C83BE08@apple.com> On Feb 24, 2009, at 11:16 PM, Anton Korobeynikov wrote: > >>> Anon? Who is this? >> >> Maybe anton forgot a t? > I don't think I have an account @ cs.uiuc.edu :) Also, note, this is > *CVS* commit Maybe someone at UIUC Is committing to the *really really old* CVS tree? Anyone want to fess up? :) -Chris From evan.cheng at apple.com Wed Feb 25 02:30:33 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 25 Feb 2009 00:30:33 -0800 Subject: [llvm-commits] [llvm] r65426 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAGNodes.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Target/PowerPC/PPCISelLowering.cpp In-Reply-To: <200902250312.n1P3Comp020256@zion.cs.uiuc.edu> References: <200902250312.n1P3Comp020256@zion.cs.uiuc.edu> Message-ID: <3C43B8A2-AB29-4025-83EE-2DB73EEA6B54@apple.com> Thanks. But there are more failures. Are you still working on reverting the BuildVectorSDNode patch? Evan On Feb 24, 2009, at 7:12 PM, Scott Michel wrote: > Author: pingbak > Date: Tue Feb 24 21:12:50 2009 > New Revision: 65426 > > URL: http://llvm.org/viewvc/llvm-project?rev=65426&view=rev > Log: > Remove all "cached" data from BuildVectorSDNode, preferring to > retrieve > results via reference parameters. > > This patch also appears to fix Evan's reported problem supplied as a > reduced bugpoint test case. > > Modified: > llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h > llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp > llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp > > Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h?rev=65426&r1=65425&r2=65426&view=diff > > === > === > === > ===================================================================== > --- llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h (original) > +++ llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h Tue Feb 24 > 21:12:50 2009 > @@ -1933,13 +1933,6 @@ > /// encapsulate common BUILD_VECTOR code and operations such as > constant splat > /// testing. > class BuildVectorSDNode : public SDNode { > - //-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ > - // Constant splat state: > - //-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ > - //! We've computed the splat already? > - bool computedSplat; > - //! It is a splat? > - bool isSplatVector; > //! Splat has undefined bits in it > bool hasUndefSplatBitsFlag; > //! The splat value > @@ -1959,36 +1952,25 @@ > public: > //! Constant splat predicate. > /*! > - Determine if this ISD::BUILD_VECTOR is a constant splat. The > results are > - cached to prevent recomputation. > - > - @param MinSplatBits: minimum number of bits in the constant > splat, defaults > + Determine if this ISD::BUILD_VECTOR is a constant splat. This > method > + returns information about the splat in \a hasUndefSplatBitsFlag, > + \a SplatBits, \a SplatUndef and \a SplatSize if the return value > is > + true. > + > + \param[out] hasUndefSplatBitsFlag: true if the constant splat > contains > + any undefined bits in the splat. > + \param[out] SplatBits: The constant splat value > + \param[out] SplatUndef: The undefined bits in the splat value > + \param[out] SplatSize: The size of the constant splat in bytes > + \param MinSplatBits: minimum number of bits in the constant > splat, defaults > to 0 for 'don't care', but normally one of [8, 16, 32, 64]. > - @return true if the splat has the required minimum number of > bits and the > + > + \return true if the splat has the required minimum number of > bits and the > splat really is a constant splat (accounting for undef > bits). > */ > - bool isConstantSplat(int MinSplatBits = 0); > - > - //! Get the splatbits > - uint64_t getSplatBits() const { > - assert(computedSplat && "BuildVectorSDNode: compute splat bits > first!"); > - return SplatBits; > - } > - > - uint64_t getSplatUndef() const { > - assert(computedSplat && "BuildVectorSDNode: compute splat bits > first!"); > - return SplatUndef; > - } > - > - unsigned getSplatSize() const { > - assert(computedSplat && "BuildVectorSDNode: compute splat bits > first!"); > - return SplatSize; > - } > - > - bool hasAnyUndefBits() const { > - assert(computedSplat && "BuildVectorSDNode: compute splat bits > first!"); > - return hasUndefSplatBitsFlag; > - } > + bool isConstantSplat(bool &hasUndefSplatBitsFlag, uint64_t > &SplatBits, > + uint64_t &SplatUndef, unsigned &SplatSize, > + int MinSplatBits = 0); > > static bool classof(const BuildVectorSDNode *) { return true; } > static bool classof(const SDNode *N) { > > Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=65426&r1=65425&r2=65426&view=diff > > === > === > === > ===================================================================== > --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) > +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Feb 24 > 21:12:50 2009 > @@ -4856,27 +4856,25 @@ > > BuildVectorSDNode::BuildVectorSDNode(MVT vecVT, DebugLoc dl, > const SDValue *Elts, unsigned NumElts) > - : SDNode(ISD::BUILD_VECTOR, dl, getSDVTList(vecVT), Elts, NumElts), > - computedSplat(false), isSplatVector(false), > hasUndefSplatBitsFlag(false), > - SplatBits(0LL), SplatUndef(0LL), SplatSize(0) > + : SDNode(ISD::BUILD_VECTOR, dl, getSDVTList(vecVT), Elts, NumElts) > { } > > -bool BuildVectorSDNode::isConstantSplat(int MinSplatBits) { > +bool BuildVectorSDNode::isConstantSplat(bool &hasUndefSplatBitsFlag, > + uint64_t &SplatBits, > + uint64_t &SplatUndef, > + unsigned &SplatSize, > + int MinSplatBits) { > unsigned int nOps = getNumOperands(); > assert(nOps > 0 && "isConstantSplat has 0-size build vector"); > > - // Return early if we already know the answer: > - if (computedSplat) > - return isSplatVector; > + // Assume that this isn't a constant splat. > + bool isSplatVector = false; > > // The vector's used (non-undef) bits > uint64_t VectorBits[2] = { 0, 0 }; > // The vector's undefined bits > uint64_t UndefBits[2] = { 0, 0 }; > > - // Assume that this isn't a constant splat. > - isSplatVector = false; > - > // Gather the constant and undefined bits > unsigned EltBitSize = getOperand(0).getValueType().getSizeInBits(); > for (unsigned i = 0; i < nOps; ++i) { > @@ -4901,7 +4899,6 @@ > EltBits = DoubleToBits(apf.convertToDouble()); > } else { > // Nonconstant element -> not a splat. > - computedSplat = true; > return isSplatVector; > } > > @@ -4910,7 +4907,6 @@ > > if ((VectorBits[0] & ~UndefBits[1]) != (VectorBits[1] & > ~UndefBits[0])) { > // Can't be a splat if two pieces don't match. > - computedSplat = true; > return isSplatVector; > } > > @@ -4954,7 +4950,6 @@ > isSplatVector = true; > } > > - computedSplat = true; > return isSplatVector; > } > > > Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=65426&r1=65425&r2=65426&view=diff > > === > === > === > ===================================================================== > --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original) > +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Tue Feb 24 > 21:12:50 2009 > @@ -3171,16 +3171,16 @@ > BuildVectorSDNode *BVN = dyn_cast(Op.getNode()); > assert(BVN != 0 && "Expected a BuildVectorSDNode in > LowerBUILD_VECTOR"); > > + uint64_t SplatBits; > + uint64_t SplatUndef; > + unsigned SplatSize; > + bool HasAnyUndefs; > + > // If this is a splat (repetition) of a value across the whole > vector, return > // the smallest size that splats it. For example, > "0x01010101010101..." is a > // splat of 0x01, 0x0101, and 0x01010101. We return SplatBits = > 0x01 and > // SplatSize = 1 byte. > - if (BVN->isConstantSplat()) { > - uint64_t SplatBits = BVN->getSplatBits(); > - uint64_t SplatUndef = BVN->getSplatUndef(); > - unsigned SplatSize = BVN->getSplatSize(); > - bool HasAnyUndefs = BVN->hasAnyUndefBits(); > - > + if (BVN->isConstantSplat(HasAnyUndefs, SplatBits, SplatUndef, > SplatSize)) { > // First, handle single instruction cases. > > // All zeros? > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From isanbard at gmail.com Wed Feb 25 04:12:23 2009 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 25 Feb 2009 02:12:23 -0800 Subject: [llvm-commits] CVS: llvm-test/MultiSource/Benchmarks/Olden/bisort/bitonic.c In-Reply-To: <66115DAD-7F6D-4D27-80D0-D0560C83BE08@apple.com> References: <200902250214.n1P2ECBc018252@zion.cs.uiuc.edu> <5F065E67-F982-4A87-9064-B7909D951AE0@gmail.com> <6122FB79-DFE0-4B32-8BC6-67E9D1BA0D97@apple.com> <0AC2792E-3128-4E0F-8C03-4B83BD4984C1@korobeynikov.info> <66115DAD-7F6D-4D27-80D0-D0560C83BE08@apple.com> Message-ID: <8EA73521-8AB7-4283-929E-48E13662FAEC@gmail.com> On Feb 24, 2009, at 11:34 PM, Chris Lattner wrote: > > On Feb 24, 2009, at 11:16 PM, Anton Korobeynikov wrote: > >> >>>> Anon? Who is this? >>> >>> Maybe anton forgot a t? >> I don't think I have an account @ cs.uiuc.edu :) Also, note, this is >> *CVS* commit > > Maybe someone at UIUC Is committing to the *really really old* CVS > tree? > > Anyone want to fess up? :) A ghost! I for one will never go back to CVS. :-) -bw From baldrick at free.fr Wed Feb 25 05:37:47 2009 From: baldrick at free.fr (Duncan Sands) Date: Wed, 25 Feb 2009 11:37:47 -0000 Subject: [llvm-commits] [llvm] r65445 - /llvm/trunk/docs/ReleaseNotes.html Message-ID: <200902251137.n1PBbn4M015384@zion.cs.uiuc.edu> Author: baldrick Date: Wed Feb 25 05:37:39 2009 New Revision: 65445 URL: http://llvm.org/viewvc/llvm-project?rev=65445&view=rev Log: Add note on support for arbitrary precision integers. Modified: llvm/trunk/docs/ReleaseNotes.html Modified: llvm/trunk/docs/ReleaseNotes.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ReleaseNotes.html?rev=65445&r1=65444&r2=65445&view=diff ============================================================================== --- llvm/trunk/docs/ReleaseNotes.html (original) +++ llvm/trunk/docs/ReleaseNotes.html Wed Feb 25 05:37:39 2009 @@ -201,7 +201,15 @@

    LLVM 2.5 includes several major new capabilities:

      -
    • Legalize Types

    • +
    • The code generator now supports arbitrary precision integers. +Types like i33 have long been valid in the LLVM IR, but previously +could only be used with the interpreter. +Now IR using such types can be compiled to native code on all targets. +All operations are supported if the integer is not bigger than twice the +target machine word size. +Simple operations like loads, stores and shifts by a constant amount are +supported for integers of any size. +

    From echeng at apple.com Wed Feb 25 23:57:27 2009 From: echeng at apple.com (Evan Cheng) Date: Wed, 25 Feb 2009 21:57:27 -0800 Subject: [llvm-commits] [llvm] r65481 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp In-Reply-To: <200902252239.n1PMdDFB006878@zion.cs.uiuc.edu> References: <200902252239.n1PMdDFB006878@zion.cs.uiuc.edu> Message-ID: Dale, thanks a lot for tracking this down! Evan On Feb 25, 2009, at 2:39 PM, Dale Johannesen wrote: > Author: johannes > Date: Wed Feb 25 16:39:13 2009 > New Revision: 65481 > > URL: http://llvm.org/viewvc/llvm-project?rev=65481&view=rev > Log: > Fix big-endian codegen bug. We're splitting up > overly long ints, e.g. i96, into pieces at PHIs > and the nodes that feed into them; however big-endian > reverses the order of the pieces (for some reason), and > wasn't doing it the same way on both sides, so > the pieces didn't match and runtime failures ensued. > Fixes 188.ammp and sqlite3 on ppc32. > > > Modified: > llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp > > Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=65481&r1=65480&r2=65481&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp > (original) > +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Wed > Feb 25 16:39:13 2009 > @@ -576,6 +576,7 @@ > MVT PtrVT = TLI.getPointerTy(); > MVT ValueVT = Val.getValueType(); > unsigned PartBits = PartVT.getSizeInBits(); > + unsigned OrigNumParts = NumParts; > assert(TLI.isTypeLegal(PartVT) && "Copying to an illegal type!"); > > if (!NumParts) > @@ -673,7 +674,7 @@ > } > > if (TLI.isBigEndian()) > - std::reverse(Parts, Parts + NumParts); > + std::reverse(Parts, Parts + OrigNumParts); > > return; > } > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From echeng at apple.com Thu Feb 26 00:35:07 2009 From: echeng at apple.com (Evan Cheng) Date: Wed, 25 Feb 2009 22:35:07 -0800 Subject: [llvm-commits] [llvm] r65501 - /llvm/trunk/lib/CodeGen/StackSlotColoring.cpp In-Reply-To: <200902260447.n1Q4lxnp018692@zion.cs.uiuc.edu> References: <200902260447.n1Q4lxnp018692@zion.cs.uiuc.edu> Message-ID: <567F1D34-B316-44C5-9C7F-59928E42CFD3@apple.com> Sorry to nag. Although stack coloring create more opportunities for DCE, I really don't think this belongs in stack coloring. Can you move this to DeadMachineInstructionElim instead? Right now, only x86 runs it when it's doing fast-isel. We can add this pass to all targets just before post-ra and have it check for loads / stores only. Evan On Feb 25, 2009, at 8:47 PM, Owen Anderson wrote: > Author: resistor > Date: Wed Feb 25 22:47:57 2009 > New Revision: 65501 > > URL: http://llvm.org/viewvc/llvm-project?rev=65501&view=rev > Log: > Enable stack slot coloring DCE. Evan's spiller fixes were needed > before this could happen. > > Modified: > llvm/trunk/lib/CodeGen/StackSlotColoring.cpp > > Modified: llvm/trunk/lib/CodeGen/StackSlotColoring.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StackSlotColoring.cpp?rev=65501&r1=65500&r2=65501&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/StackSlotColoring.cpp (original) > +++ llvm/trunk/lib/CodeGen/StackSlotColoring.cpp Wed Feb 25 22:47:57 > 2009 > @@ -30,12 +30,7 @@ > static cl::opt > DisableSharing("no-stack-slot-sharing", > cl::init(false), cl::Hidden, > - cl::desc("Surpress slot sharing during stack > coloring")); > - > -static cl::opt > -EnableDCE("enable-ssc-dce", > - cl::init(false), cl::Hidden, > - cl::desc("Enable slot coloring DCE")); > + cl::desc("Suppress slot sharing during stack > coloring")); > > static cl::opt DCELimit("ssc-dce-limit", cl::init(-1), > cl::Hidden); > > @@ -342,7 +337,7 @@ > Assignments[i].clear(); > Assignments.clear(); > > - if (EnableDCE) { > + if (Changed) { > for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I ! > = E; ++I) > Changed |= removeDeadStores(I); > } > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From kremenek at apple.com Thu Feb 26 00:46:12 2009 From: kremenek at apple.com (Ted Kremenek) Date: Thu, 26 Feb 2009 06:46:12 -0000 Subject: [llvm-commits] [llvm] r65505 - /llvm/tags/checker/checker-0.165/ Message-ID: <200902260646.n1Q6kCGc023018@zion.cs.uiuc.edu> Author: kremenek Date: Thu Feb 26 00:46:12 2009 New Revision: 65505 URL: http://llvm.org/viewvc/llvm-project?rev=65505&view=rev Log: Tagging checker-0.165. Added: llvm/tags/checker/checker-0.165/ - copied from r65504, llvm/trunk/ From sabre at nondot.org Thu Feb 26 00:47:10 2009 From: sabre at nondot.org (Chris Lattner) Date: Thu, 26 Feb 2009 06:47:10 -0000 Subject: [llvm-commits] [llvm] r65507 - /llvm/trunk/docs/ReleaseNotes.html Message-ID: <200902260647.n1Q6lAiB023148@zion.cs.uiuc.edu> Author: lattner Date: Thu Feb 26 00:47:09 2009 New Revision: 65507 URL: http://llvm.org/viewvc/llvm-project?rev=65507&view=rev Log: more notes. Modified: llvm/trunk/docs/ReleaseNotes.html Modified: llvm/trunk/docs/ReleaseNotes.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ReleaseNotes.html?rev=65507&r1=65506&r2=65507&view=diff ============================================================================== --- llvm/trunk/docs/ReleaseNotes.html (original) +++ llvm/trunk/docs/ReleaseNotes.html Thu Feb 26 00:47:09 2009 @@ -230,11 +230,11 @@ fortran on darwin! .ll parser rewrite. -GCC inliner off. +GCC inliner off, llvm handles always-inline. cmake mature? x86 backend FS/GS segment address spaces? nocapture -memdep is faster / more aggressive. +memdep (used by GVN and memcpyopt) is faster / more aggressive. how to write a backend doc docs/WritingAnLLVMBackend.html fastisel + exception handling vector widening <3 x float> -> <4 x float> @@ -249,6 +249,21 @@ llvm/Analysis/DebugInfo.h classes, llvm-gcc and clang and codegen use them. asmprinters seperate from targets for jits PBQP register allocator now supports register coalescing. +JIT supports exceptions on linux/x86-64. +integer overflow intrinsics for [us](add/sub/mul). Supported on all targets, + but only generates efficient code on x86. +X86 backend now supports -disable-mmx. +noalias attribute on return value indicates that function returns new memory + (e.g. malloc). +postalloc scheduler: anti dependence breaking? +llvmc2 renamed to llvmc +Jump threading more powerful: it is iterative, handles threading based on values + with fully redundant and partially redundant loads. +LSR improvements? +ARM debug info support? +unit test framework based on Google Test. + +vector shift support + X86 backend. --> From nicholas at mxc.ca Thu Feb 26 00:56:16 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Thu, 26 Feb 2009 06:56:16 -0000 Subject: [llvm-commits] [llvm] r65508 - in /llvm/trunk/tools: llvm-ld/Optimize.cpp lto/LTOCodeGenerator.cpp Message-ID: <200902260656.n1Q6uGSh026114@zion.cs.uiuc.edu> Author: nicholas Date: Thu Feb 26 00:56:16 2009 New Revision: 65508 URL: http://llvm.org/viewvc/llvm-project?rev=65508&view=rev Log: Add the function attributes pass during LTO time. Modified: llvm/trunk/tools/llvm-ld/Optimize.cpp llvm/trunk/tools/lto/LTOCodeGenerator.cpp Modified: llvm/trunk/tools/llvm-ld/Optimize.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-ld/Optimize.cpp?rev=65508&r1=65507&r2=65508&view=diff ============================================================================== --- llvm/trunk/tools/llvm-ld/Optimize.cpp (original) +++ llvm/trunk/tools/llvm-ld/Optimize.cpp Thu Feb 26 00:56:16 2009 @@ -136,10 +136,11 @@ addPass(Passes, createScalarReplAggregatesPass()); // Break up allocas // Run a few AA driven optimizations here and now, to cleanup the code. + addPass(Passes, createFunctionAttrsPass()); // Add nocapture addPass(Passes, createGlobalsModRefPass()); // IP alias analysis addPass(Passes, createLICMPass()); // Hoist loop invariants - addPass(Passes, createGVNPass()); // Remove redundancies + addPass(Passes, createGVNPass()); // Remove redundancies addPass(Passes, createMemCpyOptPass()); // Remove dead memcpy's addPass(Passes, createDeadStoreEliminationPass()); // Nuke dead stores Modified: llvm/trunk/tools/lto/LTOCodeGenerator.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOCodeGenerator.cpp?rev=65508&r1=65507&r2=65508&view=diff ============================================================================== --- llvm/trunk/tools/lto/LTOCodeGenerator.cpp (original) +++ llvm/trunk/tools/lto/LTOCodeGenerator.cpp Thu Feb 26 00:56:16 2009 @@ -391,6 +391,7 @@ passes.add(createScalarReplAggregatesPass()); // Break up allocas // Run a few AA driven optimizations here and now, to cleanup the code. + passes.add(createFunctionAttrsPass()); // Add nocapture passes.add(createGlobalsModRefPass()); // IP alias analysis passes.add(createLICMPass()); // Hoist loop invariants passes.add(createGVNPass()); // Remove common subexprs From zhousheng00 at gmail.com Thu Feb 26 00:56:37 2009 From: zhousheng00 at gmail.com (Zhou Sheng) Date: Thu, 26 Feb 2009 06:56:37 -0000 Subject: [llvm-commits] [llvm] r65509 - in /llvm/trunk: lib/Transforms/Utils/SimplifyCFG.cpp test/Transforms/SimplifyCFG/branch-branch-dbginfo.ll Message-ID: <200902260656.n1Q6ubtU026143@zion.cs.uiuc.edu> Author: sheng Date: Thu Feb 26 00:56:37 2009 New Revision: 65509 URL: http://llvm.org/viewvc/llvm-project?rev=65509&view=rev Log: Ignore dbg info intrinsics when folding conditional branch to conditional branch predecessors. Added: llvm/trunk/test/Transforms/SimplifyCFG/branch-branch-dbginfo.ll Modified: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Modified: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp?rev=65509&r1=65508&r2=65509&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Thu Feb 26 00:56:37 2009 @@ -1592,7 +1592,11 @@ // If this is a conditional branch in an empty block, and if any // predecessors is a conditional branch to one of our destinations, // fold the conditions into logical ops and one cond br. - if (&BB->front() != BI) + BasicBlock::iterator BBI = BB->begin(); + // Ignore dbg intrinsics. + while (isa(BBI)) + ++BBI; + if (&*BBI != BI) return false; Added: llvm/trunk/test/Transforms/SimplifyCFG/branch-branch-dbginfo.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SimplifyCFG/branch-branch-dbginfo.ll?rev=65509&view=auto ============================================================================== --- llvm/trunk/test/Transforms/SimplifyCFG/branch-branch-dbginfo.ll (added) +++ llvm/trunk/test/Transforms/SimplifyCFG/branch-branch-dbginfo.ll Thu Feb 26 00:56:37 2009 @@ -0,0 +1,70 @@ +; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | grep {br i1} | count 1 + +; ModuleID = '' +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32" +target triple = "i386-pc-linux-gnu" + %llvm.dbg.anchor.type = type { i32, i32 } + %llvm.dbg.basictype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, i32 } + %llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8* } + %llvm.dbg.derivedtype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, { }* } + %llvm.dbg.subprogram.type = type { i32, { }*, { }*, i8*, i8*, i8*, { }*, i32, { }*, i1, i1 } + %llvm.dbg.variable.type = type { i32, { }*, i8*, { }*, i32, { }* } + at llvm.dbg.subprogram = internal constant %llvm.dbg.subprogram.type { i32 393262, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str3, i32 0, i32 0), i8* getelementptr ([4 x i8]* @.str3, i32 0, i32 0), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 4, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] + at llvm.dbg.subprograms = linkonce constant %llvm.dbg.anchor.type { i32 393216, i32 46 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1] + at llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type { i32 393233, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to { }*), i32 1, i8* getelementptr ([7 x i8]* @.str, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str1, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str2, i32 0, i32 0) }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1] + at llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { i32 393216, i32 17 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1] + at .str = internal constant [7 x i8] c"cond.c\00", section "llvm.metadata" ; <[7 x i8]*> [#uses=1] + at .str1 = internal constant [5 x i8] c"/tmp\00", section "llvm.metadata" ; <[5 x i8]*> [#uses=1] + at .str2 = internal constant [52 x i8] c"4.2.1 (Based on Apple Inc. build 5555) (LLVM build)\00", section "llvm.metadata" ; <[52 x i8]*> [#uses=1] + at .str3 = internal constant [4 x i8] c"foo\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1] + at llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type { i32 393252, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str4, i32 0, i32 0), { }* null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1] + at .str4 = internal constant [4 x i8] c"int\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1] + at llvm.dbg.variable = internal constant %llvm.dbg.variable.type { i32 393473, { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*), i8* getelementptr ([2 x i8]* @.str5, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 4, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=0] + at .str5 = internal constant [2 x i8] c"x\00", section "llvm.metadata" ; <[2 x i8]*> [#uses=1] + at llvm.dbg.variable6 = internal constant %llvm.dbg.variable.type { i32 393473, { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*), i8* getelementptr ([2 x i8]* @.str7, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 4, { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype to { }*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=0] + at .str7 = internal constant [2 x i8] c"y\00", section "llvm.metadata" ; <[2 x i8]*> [#uses=1] + at llvm.dbg.derivedtype = internal constant %llvm.dbg.derivedtype.type { i32 393238, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([6 x i8]* @.str8, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 1, i64 0, i64 0, i64 0, i32 0, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype9 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] + at .str8 = internal constant [6 x i8] c"uint1\00", section "llvm.metadata" ; <[6 x i8]*> [#uses=1] + at llvm.dbg.basictype9 = internal constant %llvm.dbg.basictype.type { i32 393252, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* null, i32 0, i64 8, i64 8, i64 0, i32 0, i32 7 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1] + +define i32 @foo(i32 %x1, i1 zeroext %y2) nounwind { +entry: + %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] + call void @llvm.dbg.func.start({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*)) + call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) + %tmp4 = icmp eq i32 %x1, 0 ; [#uses=1] + br i1 %tmp4, label %bb, label %bb14 + +bb: ; preds = %entry + call void @llvm.dbg.stoppoint(i32 6, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) + br i1 %y2, label %bb14, label %bb10 + +bb7: ; preds = %bb + call void @llvm.dbg.stoppoint(i32 7, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) + %tmp9 = call i32 @g1(i32 %x1) nounwind ; [#uses=1] + ret i32 %tmp9 + +bb10: ; preds = %bb + call void @llvm.dbg.stoppoint(i32 8, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) + %tmp12 = add i32 %x1, 1 ; [#uses=1] + %tmp13 = call i32 @g2(i32 %tmp12) nounwind ; [#uses=1] + ret i32 %tmp13 + +bb14: ; preds = %entry + call void @llvm.dbg.stoppoint(i32 10, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) + %tmp16 = call i32 @g1(i32 %x1) nounwind ; [#uses=1] + call void @llvm.dbg.region.end({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*)) + ret i32 %tmp16 +} + +declare void @llvm.dbg.func.start({ }*) nounwind + +declare void @llvm.dbg.declare({ }*, { }*) nounwind + +declare void @llvm.dbg.stoppoint(i32, i32, { }*) nounwind + +declare i32 @g1(i32) + +declare i32 @g2(i32) + +declare void @llvm.dbg.region.end({ }*) nounwind From sabre at nondot.org Thu Feb 26 01:29:17 2009 From: sabre at nondot.org (Chris Lattner) Date: Thu, 26 Feb 2009 07:29:17 -0000 Subject: [llvm-commits] [llvm] r65511 - /llvm/trunk/docs/ReleaseNotes.html Message-ID: <200902260729.n1Q7THjs027357@zion.cs.uiuc.edu> Author: lattner Date: Thu Feb 26 01:29:17 2009 New Revision: 65511 URL: http://llvm.org/viewvc/llvm-project?rev=65511&view=rev Log: final random and incoherent notes after making it through all the commits. Next step: making them more coherent. Modified: llvm/trunk/docs/ReleaseNotes.html Modified: llvm/trunk/docs/ReleaseNotes.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ReleaseNotes.html?rev=65511&r1=65510&r2=65511&view=diff ============================================================================== --- llvm/trunk/docs/ReleaseNotes.html (original) +++ llvm/trunk/docs/ReleaseNotes.html Thu Feb 26 01:29:17 2009 @@ -60,7 +60,7 @@ llc -enable-value-prop, propagation of value info (sign/zero ext info) from one MBB to another debug info for optimized code - + interpreter + libffi --> From sabre at nondot.org Thu Feb 26 01:32:11 2009 From: sabre at nondot.org (Chris Lattner) Date: Thu, 26 Feb 2009 07:32:11 -0000 Subject: [llvm-commits] [llvm] r65512 - /llvm/trunk/docs/ReleaseNotes.html Message-ID: <200902260732.n1Q7WBmu027455@zion.cs.uiuc.edu> Author: lattner Date: Thu Feb 26 01:32:11 2009 New Revision: 65512 URL: http://llvm.org/viewvc/llvm-project?rev=65512&view=rev Log: pic16 notes from Sanjiv. Just dumped in for now, will rearrange later. Modified: llvm/trunk/docs/ReleaseNotes.html Modified: llvm/trunk/docs/ReleaseNotes.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ReleaseNotes.html?rev=65512&r1=65511&r2=65512&view=diff ============================================================================== --- llvm/trunk/docs/ReleaseNotes.html (original) +++ llvm/trunk/docs/ReleaseNotes.html Thu Feb 26 01:32:11 2009 @@ -367,7 +367,42 @@ + +
    +

    New features of the PIC16 target include: +

    + +
      +
    • Both direct and indirect load/stores work now.
    • +
    • Logical, bitwise and conditional operations now work for integer data +types.
    • +
    • Function calls involving basic types work now.
    • +
    • Support for integer arrays.
    • +
    • Compiler can now emit libcalls for operations not support by m/c insns.
    • +
    • Support for both data and rom address spaces.
    • + +
    + +

    Things not yet supported:

    + +
      +
    • Floating point.
    • +
    • Passing/returning aggregate types to/from functions.
    • +
    • Variable arguments.
    • +
    • Indirect function calls.
    • +
    • Interrupts/prgrams.
    • +
    • Debug info.
    • + +
    + +
    + + + +
    From isanbard at gmail.com Thu Feb 26 01:32:46 2009 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 26 Feb 2009 07:32:46 -0000 Subject: [llvm-commits] [llvm] r65513 - /llvm/branches/Apple/Dib/lib/CodeGen/StackSlotColoring.cpp Message-ID: <200902260732.n1Q7WkwG027480@zion.cs.uiuc.edu> Author: void Date: Thu Feb 26 01:32:46 2009 New Revision: 65513 URL: http://llvm.org/viewvc/llvm-project?rev=65513&view=rev Log: Merge 65120 65375 65501 into Dib: Add a quick pass to the stack slot colorer to eliminate some trivially redundant spills after coloring. Ideally these would never get created in the first place, but until we enhance the spiller to have a more global picture of what's happening, this is necessary for code quality in some circumstances. Add a debugging option for SSC DCE. Enable stack slot coloring DCE. Evan's spiller fixes were needed before this could happen. Modified: llvm/branches/Apple/Dib/lib/CodeGen/StackSlotColoring.cpp Modified: llvm/branches/Apple/Dib/lib/CodeGen/StackSlotColoring.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/StackSlotColoring.cpp?rev=65513&r1=65512&r2=65513&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/CodeGen/StackSlotColoring.cpp (original) +++ llvm/branches/Apple/Dib/lib/CodeGen/StackSlotColoring.cpp Thu Feb 26 01:32:46 2009 @@ -19,6 +19,8 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/Debug.h" +#include "llvm/Target/TargetInstrInfo.h" +#include "llvm/Target/TargetMachine.h" #include "llvm/ADT/BitVector.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/Statistic.h" @@ -28,14 +30,19 @@ static cl::opt DisableSharing("no-stack-slot-sharing", cl::init(false), cl::Hidden, - cl::desc("Surpress slot sharing during stack coloring")); + cl::desc("Suppress slot sharing during stack coloring")); + +static cl::opt DCELimit("ssc-dce-limit", cl::init(-1), cl::Hidden); STATISTIC(NumEliminated, "Number of stack slots eliminated due to coloring"); +STATISTIC(NumDeadAccesses, + "Number of trivially dead stack accesses eliminated"); namespace { class VISIBILITY_HIDDEN StackSlotColoring : public MachineFunctionPass { LiveStacks* LS; MachineFrameInfo *MFI; + const TargetInstrInfo *TII; // SSIntervals - Spill slot intervals. std::vector SSIntervals; @@ -67,6 +74,7 @@ virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired(); + AU.addPreservedID(MachineLoopInfoID); AU.addPreservedID(MachineDominatorsID); MachineFunctionPass::getAnalysisUsage(AU); @@ -82,6 +90,7 @@ bool OverlapWithAssignments(LiveInterval *li, int Color) const; int ColorSlot(LiveInterval *li); bool ColorSlots(MachineFunction &MF); + bool removeDeadStores(MachineBasicBlock* MBB); }; } // end anonymous namespace @@ -260,10 +269,58 @@ return true; } +/// removeDeadStores - Scan through a basic block and look for loads followed +/// by stores. If they're both using the same stack slot, then the store is +/// definitely dead. This could obviously be much more aggressive (consider +/// pairs with instructions between them), but such extensions might have a +/// considerable compile time impact. +bool StackSlotColoring::removeDeadStores(MachineBasicBlock* MBB) { + // FIXME: This could be much more aggressive, but we need to investigate + // the compile time impact of doing so. + bool changed = false; + + SmallVector toErase; + + for (MachineBasicBlock::iterator I = MBB->begin(), E = MBB->end(); + I != E; ++I) { + if (DCELimit != -1 && (int)NumDeadAccesses >= DCELimit) + break; + + MachineBasicBlock::iterator NextMI = next(I); + if (NextMI == MBB->end()) continue; + + int FirstSS, SecondSS; + unsigned LoadReg = 0; + unsigned StoreReg = 0; + if (!(LoadReg = TII->isLoadFromStackSlot(I, FirstSS))) continue; + if (!(StoreReg = TII->isStoreToStackSlot(NextMI, SecondSS))) continue; + if (FirstSS != SecondSS || LoadReg != StoreReg || FirstSS == -1) continue; + + ++NumDeadAccesses; + changed = true; + + if (NextMI->findRegisterUseOperandIdx(LoadReg, true, 0) != -1) { + ++NumDeadAccesses; + toErase.push_back(I); + } + + toErase.push_back(NextMI); + ++I; + } + + for (SmallVector::iterator I = toErase.begin(), + E = toErase.end(); I != E; ++I) + (*I)->eraseFromParent(); + + return changed; +} + + bool StackSlotColoring::runOnMachineFunction(MachineFunction &MF) { DOUT << "********** Stack Slot Coloring **********\n"; MFI = MF.getFrameInfo(); + TII = MF.getTarget().getInstrInfo(); LS = &getAnalysis(); bool Changed = false; @@ -280,5 +337,10 @@ Assignments[i].clear(); Assignments.clear(); + if (Changed) { + for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ++I) + Changed |= removeDeadStores(I); + } + return Changed; } From isanbard at gmail.com Thu Feb 26 01:34:22 2009 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 26 Feb 2009 07:34:22 -0000 Subject: [llvm-commits] [llvm] r65514 - /llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Message-ID: <200902260734.n1Q7YMwC027528@zion.cs.uiuc.edu> Author: void Date: Thu Feb 26 01:34:22 2009 New Revision: 65514 URL: http://llvm.org/viewvc/llvm-project?rev=65514&view=rev Log: Pull r65481 into Dib: Fix big-endian codegen bug. We're splitting up overly long ints, e.g. i96, into pieces at PHIs and the nodes that feed into them; however big-endian reverses the order of the pieces (for some reason), and wasn't doing it the same way on both sides, so the pieces didn't match and runtime failures ensued. Fixes 188.ammp and sqlite3 on ppc32. Modified: llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Modified: llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=65514&r1=65513&r2=65514&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original) +++ llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Thu Feb 26 01:34:22 2009 @@ -576,6 +576,7 @@ MVT PtrVT = TLI.getPointerTy(); MVT ValueVT = Val.getValueType(); unsigned PartBits = PartVT.getSizeInBits(); + unsigned OrigNumParts = NumParts; assert(TLI.isTypeLegal(PartVT) && "Copying to an illegal type!"); if (!NumParts) @@ -673,7 +674,7 @@ } if (TLI.isBigEndian()) - std::reverse(Parts, Parts + NumParts); + std::reverse(Parts, Parts + OrigNumParts); return; } From isanbard at gmail.com Thu Feb 26 01:36:37 2009 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 26 Feb 2009 07:36:37 -0000 Subject: [llvm-commits] [llvm] r65515 - in /llvm/branches/Apple/Dib: lib/CodeGen/VirtRegMap.cpp test/CodeGen/ARM/2008-11-19-ScavengerAssert.ll Message-ID: <200902260736.n1Q7acju027595@zion.cs.uiuc.edu> Author: void Date: Thu Feb 26 01:36:37 2009 New Revision: 65515 URL: http://llvm.org/viewvc/llvm-project?rev=65515&view=rev Log: Pull 65497 and 65498 into Dib: If an available register falls through to a succ block, unset the last kill. Sorry, it's impossible to reduce a sensible test case. It basically requires the moon and stars to align in order to cause a failure. The last commit was overly conservative. It's ok to reuse value that's already marked livein. Modified: llvm/branches/Apple/Dib/lib/CodeGen/VirtRegMap.cpp llvm/branches/Apple/Dib/test/CodeGen/ARM/2008-11-19-ScavengerAssert.ll Modified: llvm/branches/Apple/Dib/lib/CodeGen/VirtRegMap.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/VirtRegMap.cpp?rev=65515&r1=65514&r2=65515&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/CodeGen/VirtRegMap.cpp (original) +++ llvm/branches/Apple/Dib/lib/CodeGen/VirtRegMap.cpp Thu Feb 26 01:36:37 2009 @@ -408,7 +408,12 @@ /// value for this slot lives in (as the previous value is dead now). void ModifyStackSlotOrReMat(int SlotOrReMat); - void AddAvailableRegsToLiveIn(MachineBasicBlock &MBB); + /// AddAvailableRegsToLiveIn - Availability information is being kept coming + /// into the specified MBB. Add available physical registers as potential + /// live-in's. If they are reused in the MBB, they will be added to the + /// live-in set to make register scavenger and post-allocation scheduler. + void AddAvailableRegsToLiveIn(MachineBasicBlock &MBB, BitVector &RegKills, + std::vector &KillOps); }; } @@ -488,22 +493,55 @@ PhysRegsAvailable.erase(I); } +/// InvalidateKill - A MI that defines the specified register is being deleted, +/// invalidate the register kill information. +static void InvalidateKill(unsigned Reg, BitVector &RegKills, + std::vector &KillOps) { + if (RegKills[Reg]) { + KillOps[Reg]->setIsKill(false); + KillOps[Reg] = NULL; + RegKills.reset(Reg); + } +} + /// AddAvailableRegsToLiveIn - Availability information is being kept coming -/// into the specified MBB. Add available physical registers as live-in's -/// so register scavenger and post-allocation scheduler are happy. -void AvailableSpills::AddAvailableRegsToLiveIn(MachineBasicBlock &MBB) { +/// into the specified MBB. Add available physical registers as potential +/// live-in's. If they are reused in the MBB, they will be added to the +/// live-in set to make register scavenger and post-allocation scheduler. +void AvailableSpills::AddAvailableRegsToLiveIn(MachineBasicBlock &MBB, + BitVector &RegKills, + std::vector &KillOps) { + std::set NotAvailable; for (std::multimap::iterator I = PhysRegsAvailable.begin(), E = PhysRegsAvailable.end(); I != E; ++I) { - unsigned Reg = (*I).first; + unsigned Reg = I->first; const TargetRegisterClass* RC = TRI->getPhysicalRegisterRegClass(Reg); // FIXME: A temporary workaround. We can't reuse available value if it's // not safe to move the def of the virtual register's class. e.g. // X86::RFP* register classes. Do not add it as a live-in. if (!TII->isSafeToMoveRegClassDefs(RC)) - continue; - if (!MBB.isLiveIn(Reg)) + // This is no longer available. + NotAvailable.insert(Reg); + else { MBB.addLiveIn(Reg); + InvalidateKill(Reg, RegKills, KillOps); + } + + // Skip over the same register. + std::multimap::iterator NI = next(I); + while (NI != E && NI->first == Reg) { + ++I; + ++NI; + } + } + + for (std::set::iterator I = NotAvailable.begin(), + E = NotAvailable.end(); I != E; ++I) { + ClobberPhysReg(*I); + for (const unsigned *SubRegs = TRI->getSubRegisters(*I); + *SubRegs; ++SubRegs) + ClobberPhysReg(*SubRegs); } } @@ -546,6 +584,11 @@ // reloads. This is usually refreshed per basic block. AvailableSpills Spills(TRI, TII); + // Keep track of kill information. + BitVector RegKills(TRI->getNumRegs()); + std::vector KillOps; + KillOps.resize(TRI->getNumRegs(), NULL); + // SingleEntrySuccs - Successor blocks which have a single predecessor. SmallVector SinglePredSuccs; SmallPtrSet EarlyVisited; @@ -559,7 +602,7 @@ DFI != E; ++DFI) { MachineBasicBlock *MBB = *DFI; if (!EarlyVisited.count(MBB)) - RewriteMBB(*MBB, VRM, Spills); + RewriteMBB(*MBB, VRM, Spills, RegKills, KillOps); // If this MBB is the only predecessor of a successor. Keep the // availability information and visit it next. @@ -574,8 +617,8 @@ // the only predecessor. MBB = SinglePredSuccs[0]; if (!Visited.count(MBB) && EarlyVisited.insert(MBB)) { - Spills.AddAvailableRegsToLiveIn(*MBB); - RewriteMBB(*MBB, VRM, Spills); + Spills.AddAvailableRegsToLiveIn(*MBB, RegKills, KillOps); + RewriteMBB(*MBB, VRM, Spills, RegKills, KillOps); } } } while (MBB); @@ -612,6 +655,7 @@ bool CommuteToFoldReload(MachineBasicBlock &MBB, MachineBasicBlock::iterator &MII, unsigned VirtReg, unsigned SrcReg, int SS, + AvailableSpills &Spills, BitVector &RegKills, std::vector &KillOps, const TargetRegisterInfo *TRI, @@ -627,7 +671,8 @@ std::vector &KillOps, VirtRegMap &VRM); void RewriteMBB(MachineBasicBlock &MBB, VirtRegMap &VRM, - AvailableSpills &Spills); + AvailableSpills &Spills, + BitVector &RegKills, std::vector &KillOps); }; } @@ -653,17 +698,6 @@ } } -/// InvalidateKill - A MI that defines the specified register is being deleted, -/// invalidate the register kill information. -static void InvalidateKill(unsigned Reg, BitVector &RegKills, - std::vector &KillOps) { - if (RegKills[Reg]) { - KillOps[Reg]->setIsKill(false); - KillOps[Reg] = NULL; - RegKills.reset(Reg); - } -} - /// InvalidateRegDef - If the def operand of the specified def MI is now dead /// (since it's spill instruction is removed), mark it isDead. Also checks if /// the def MI has other definition operands that are not dead. Returns it by @@ -1086,6 +1120,7 @@ bool LocalSpiller::CommuteToFoldReload(MachineBasicBlock &MBB, MachineBasicBlock::iterator &MII, unsigned VirtReg, unsigned SrcReg, int SS, + AvailableSpills &Spills, BitVector &RegKills, std::vector &KillOps, const TargetRegisterInfo *TRI, @@ -1154,6 +1189,11 @@ VRM.RemoveMachineInstrFromMaps(&MI); MBB.erase(&MI); + // If NewReg was previously holding value of some SS, it's now clobbered. + // This has to be done now because it's a physical register. When this + // instruction is re-visited, it's ignored. + Spills.ClobberPhysReg(NewReg); + ++NumCommutes; return true; } @@ -1280,7 +1320,8 @@ /// rewriteMBB - Keep track of which spills are available even after the /// register allocator is done with them. If possible, avoid reloading vregs. void LocalSpiller::RewriteMBB(MachineBasicBlock &MBB, VirtRegMap &VRM, - AvailableSpills &Spills) { + AvailableSpills &Spills, BitVector &RegKills, + std::vector &KillOps) { DOUT << "\n**** Local spiller rewriting MBB '" << MBB.getBasicBlock()->getName() << ":\n"; @@ -1298,9 +1339,9 @@ // ReMatDefs - These are rematerializable def MIs which are not deleted. SmallSet ReMatDefs; - // Keep track of kill information. - BitVector RegKills(TRI->getNumRegs()); - std::vector KillOps; + // Clear kill info. + RegKills.reset(); + KillOps.clear(); KillOps.resize(TRI->getNumRegs(), NULL); unsigned Dist = 0; @@ -1368,11 +1409,7 @@ int SSorRMId = DoReMat ? VRM.getReMatId(VirtReg) : VRM.getStackSlot(VirtReg); const TargetRegisterClass* RC = RegInfo->getRegClass(VirtReg); - // FIXME: A temporary workaround. Don't reuse available value if it's - // not safe to move the def of the virtual register's class. e.g. - // X86::RFP* register classes. - unsigned InReg = TII->isSafeToMoveRegClassDefs(RC) ? - Spills.getSpillSlotOrReMatPhysReg(SSorRMId) : 0; + unsigned InReg = Spills.getSpillSlotOrReMatPhysReg(SSorRMId); if (InReg == Phys) { // If the value is already available in the expected register, save // a reload / remat. @@ -1600,11 +1637,6 @@ PotentialDeadStoreSlots.push_back(ReuseSlot); } - // Assumes this is the last use. IsKill will be unset if reg is reused - // unless it's a two-address operand. - if (ti == -1) - MI.getOperand(i).setIsKill(); - continue; } // CanReuse @@ -1877,7 +1909,7 @@ "Src hasn't been allocated yet?"); if (CommuteToFoldReload(MBB, MII, VirtReg, SrcReg, StackSlot, - RegKills, KillOps, TRI, VRM)) { + Spills, RegKills, KillOps, TRI, VRM)) { NextMII = next(MII); BackTracked = true; goto ProcessNextInst; Modified: llvm/branches/Apple/Dib/test/CodeGen/ARM/2008-11-19-ScavengerAssert.ll URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/test/CodeGen/ARM/2008-11-19-ScavengerAssert.ll?rev=65515&r1=65514&r2=65515&view=diff ============================================================================== --- llvm/branches/Apple/Dib/test/CodeGen/ARM/2008-11-19-ScavengerAssert.ll (original) +++ llvm/branches/Apple/Dib/test/CodeGen/ARM/2008-11-19-ScavengerAssert.ll Thu Feb 26 01:36:37 2009 @@ -1,5 +1,5 @@ ; RUN: llvm-as < %s | llc -mtriple=arm-apple-darwin9 -; RUN: llvm-as < %s | llc -mtriple=arm-apple-darwin9 -stats |& grep asm-printer | grep 185 +; RUN: llvm-as < %s | llc -mtriple=arm-apple-darwin9 -stats |& grep asm-printer | grep 186 %"struct.Adv5::Ekin<3>" = type <{ i8 }> %"struct.Adv5::X::Energyflux<3>" = type { double } From isanbard at gmail.com Thu Feb 26 01:38:09 2009 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 26 Feb 2009 07:38:09 -0000 Subject: [llvm-commits] [llvm] r65516 - in /llvm/branches/Apple/Dib: include/llvm/IntrinsicsX86.td lib/Target/X86/X86InstrSSE.td test/CodeGen/X86/2009-02-25-CommuteBug.ll Message-ID: <200902260738.n1Q7c92I027652@zion.cs.uiuc.edu> Author: void Date: Thu Feb 26 01:38:09 2009 New Revision: 65516 URL: http://llvm.org/viewvc/llvm-project?rev=65516&view=rev Log: Pull r65499 into Dib: ADDS{D|S}rr_Int and MULS{D|S}rr_Int are not commutable. The users of these intrinsics expect the high bits will not be modified. Added: llvm/branches/Apple/Dib/test/CodeGen/X86/2009-02-25-CommuteBug.ll - copied unchanged from r65499, llvm/trunk/test/CodeGen/X86/2009-02-25-CommuteBug.ll Modified: llvm/branches/Apple/Dib/include/llvm/IntrinsicsX86.td llvm/branches/Apple/Dib/lib/Target/X86/X86InstrSSE.td Modified: llvm/branches/Apple/Dib/include/llvm/IntrinsicsX86.td URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/include/llvm/IntrinsicsX86.td?rev=65516&r1=65515&r2=65516&view=diff ============================================================================== --- llvm/branches/Apple/Dib/include/llvm/IntrinsicsX86.td (original) +++ llvm/branches/Apple/Dib/include/llvm/IntrinsicsX86.td Thu Feb 26 01:38:09 2009 @@ -19,13 +19,13 @@ let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.". def int_x86_sse_add_ss : GCCBuiltin<"__builtin_ia32_addss">, Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty, - llvm_v4f32_ty], [IntrNoMem, Commutative]>; + llvm_v4f32_ty], [IntrNoMem]>; def int_x86_sse_sub_ss : GCCBuiltin<"__builtin_ia32_subss">, Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty, llvm_v4f32_ty], [IntrNoMem]>; def int_x86_sse_mul_ss : GCCBuiltin<"__builtin_ia32_mulss">, Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty, - llvm_v4f32_ty], [IntrNoMem, Commutative]>; + llvm_v4f32_ty], [IntrNoMem]>; def int_x86_sse_div_ss : GCCBuiltin<"__builtin_ia32_divss">, Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty, llvm_v4f32_ty], [IntrNoMem]>; @@ -176,13 +176,13 @@ let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.". def int_x86_sse2_add_sd : GCCBuiltin<"__builtin_ia32_addsd">, Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty, - llvm_v2f64_ty], [IntrNoMem, Commutative]>; + llvm_v2f64_ty], [IntrNoMem]>; def int_x86_sse2_sub_sd : GCCBuiltin<"__builtin_ia32_subsd">, Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty, llvm_v2f64_ty], [IntrNoMem]>; def int_x86_sse2_mul_sd : GCCBuiltin<"__builtin_ia32_mulsd">, Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty, - llvm_v2f64_ty], [IntrNoMem, Commutative]>; + llvm_v2f64_ty], [IntrNoMem]>; def int_x86_sse2_div_sd : GCCBuiltin<"__builtin_ia32_divsd">, Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty, llvm_v2f64_ty], [IntrNoMem]>; Modified: llvm/branches/Apple/Dib/lib/Target/X86/X86InstrSSE.td URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/X86/X86InstrSSE.td?rev=65516&r1=65515&r2=65516&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/X86/X86InstrSSE.td (original) +++ llvm/branches/Apple/Dib/lib/Target/X86/X86InstrSSE.td Thu Feb 26 01:38:09 2009 @@ -523,7 +523,7 @@ /// In addition, we also have a special variant of the scalar form here to /// represent the associated intrinsic operation. This form is unlike the /// plain scalar form, in that it takes an entire vector (instead of a scalar) -/// and leaves the top elements undefined. +/// and leaves the top elements unmodified (therefore these cannot be commuted). /// /// These three forms can each be reg+reg or reg+mem, so there are a total of /// six "instructions". @@ -563,9 +563,7 @@ def SSrr_Int : SSI { - let isCommutable = Commutable; - } + [(set VR128:$dst, (F32Int VR128:$src1, VR128:$src2))]>; // Intrinsic operation, reg+mem. def SSrm_Int : SSI { - let isCommutable = Commutable; - } + [(set VR128:$dst, (F64Int VR128:$src1, VR128:$src2))]>; // Intrinsic operation, reg+mem. def SDrm_Int : SDI Author: nicholas Date: Thu Feb 26 01:44:16 2009 New Revision: 65517 URL: http://llvm.org/viewvc/llvm-project?rev=65517&view=rev Log: Remove libtool. Modified: llvm/trunk/Makefile.rules llvm/trunk/bindings/ocaml/Makefile.ocaml llvm/trunk/docs/MakefileGuide.html llvm/trunk/unittests/Makefile.unittest Modified: llvm/trunk/Makefile.rules URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/Makefile.rules?rev=65517&r1=65516&r2=65517&view=diff ============================================================================== --- llvm/trunk/Makefile.rules (original) +++ llvm/trunk/Makefile.rules Thu Feb 26 01:44:16 2009 @@ -41,7 +41,7 @@ # Reset the list of suffixes we know how to build. #-------------------------------------------------------------------- .SUFFIXES: -.SUFFIXES: .c .cpp .cc .h .hpp .lo .o .a .bc .td .ps .dot .ll +.SUFFIXES: .c .cpp .cc .h .hpp .o .a .bc .td .ps .dot .ll .SUFFIXES: $(SHLIBEXT) $(SUFFIXES) #-------------------------------------------------------------------- @@ -277,12 +277,25 @@ CPP.Defines += -D_GLIBCXX_DEBUG -DXDEBUG endif +# LOADABLE_MODULE implies several other things so we force them to be +# defined/on. +ifdef LOADABLE_MODULE + SHARED_LIBRARY := 1 + DONT_BUILD_RELINKED := 1 + LINK_LIBS_IN_SHARED := 1 +endif + +ifdef SHARED_LIBRARY + ENABLE_PIC := 1 + PIC_FLAG = "(PIC)" +endif + ifeq ($(ENABLE_PIC),1) ifeq ($(LLVM_ON_WIN32),1) # Nothing. Win32 defaults to PIC and warns when given -fPIC else ifeq ($(OS),Darwin) - # common is forbidden in dylib files + # Common symbols not allowed in dylib files CXX.Flags += -fno-common C.Flags += -fno-common else @@ -299,7 +312,6 @@ CPP.BaseFlags += $(CPP.Defines) LD.Flags += $(LDFLAGS) AR.Flags := cru -LibTool.Flags := --tag=CXX # Make Floating point IEEE compliant on Alpha. ifeq ($(ARCH),Alpha) @@ -338,9 +350,6 @@ #-------------------------------------------------------------------- EchoCmd = $(ECHO) llvm[$(MAKELEVEL)]: Echo = @$(EchoCmd) -ifndef LIBTOOL -LIBTOOL := $(LLVM_OBJ_ROOT)/mklib -endif ifndef LLVMAS LLVMAS := $(LLVMToolDir)/llvm-as$(EXEEXT) endif @@ -389,21 +398,15 @@ # Adjust to user's request #-------------------------------------------------------------------- -# Adjust LD.Flags and Libtool.Flags depending on the kind of library that is -# to be built. Note that if LOADABLE_MODULE is specified then the resulting -# shared library can be opened with dlopen. Also, LOADABLE_MODULE implies -# several other things so we force them to be defined/on. +# Adjust LD.Flags depending on the kind of library that is to be built. Note +# that if LOADABLE_MODULE is specified then the resulting shared library can +# be opened with dlopen. ifdef LOADABLE_MODULE - SHARED_LIBRARY := 1 - DONT_BUILD_RELINKED := 1 - LINK_LIBS_IN_SHARED := 1 LD.Flags += -module endif ifdef SHARED_LIBRARY - LD.Flags += -rpath $(LibDir) -else - LibTool.Flags += --tag=disable-shared + LD.Flags += -Wl,-rpath -Wl,$(LibDir) endif ifdef TOOL_VERBOSE @@ -416,7 +419,6 @@ # Adjust settings for verbose mode ifndef VERBOSE Verb := @ - LibTool.Flags += --silent AR.Flags += >/dev/null 2>/dev/null ConfigureScriptFLAGS += >$(PROJ_OBJ_DIR)/configure.out 2>&1 else @@ -431,14 +433,22 @@ endif # Adjust linker flags for building an executable +ifndef ($(OS),Darwin) ifdef TOOLNAME ifdef EXAMPLE_TOOL - LD.Flags += -rpath $(ExmplDir) -export-dynamic + LD.Flags += -Wl,-rpath -Wl,$(ExmplDir) -export-dynamic else - LD.Flags += -rpath $(ToolDir) -export-dynamic + LD.Flags += -Wl,-rpath -Wl,$(ToolDir) -export-dynamic +endif endif endif +ifeq ($(OS),Darwin) + SharedLinkOptions=-Wl,-flat_namespace -Wl,-undefined -Wl,suppress -bundle +else + SharedLinkOptions=-shared +endif + #---------------------------------------------------------- # Options To Invoke Tools #---------------------------------------------------------- @@ -508,18 +518,12 @@ $(Relink.Flags) endif -LTCompile.C = $(LIBTOOL) $(LibTool.Flags) --mode=compile $(Compile.C) BCCompile.C = $(LLVMGCCWITHPATH) $(CPP.Flags) $(C.Flags) $(CompileCommonOpts) Preprocess.C = $(CC) $(CPP.Flags) $(C.Flags) $(CompileCommonOpts) -E -LTCompile.CXX = $(LIBTOOL) $(LibTool.Flags) --mode=compile $(Compile.CXX) BCCompile.CXX = $(LLVMGXXWITHPATH) $(CPP.Flags) $(CXX.Flags) \ $(CompileCommonOpts) -LTLink = $(LIBTOOL) $(LibTool.Flags) --mode=link $(Link) -LTRelink = $(LIBTOOL) $(LibTool.Flags) --mode=link $(Relink) -LTInstall = $(LIBTOOL) $(LibTool.Flags) --mode=install $(INSTALL) \ - $(Install.Flags) ProgInstall = $(INSTALL) $(Install.StripFlag) -m 0755 ScriptInstall = $(INSTALL) -m 0755 DataInstall = $(INSTALL) -m 0644 @@ -559,7 +563,6 @@ BaseNameSources := $(sort $(basename $(Sources))) ObjectsO := $(BaseNameSources:%=$(ObjDir)/%.o) -ObjectsLO := $(BaseNameSources:%=$(ObjDir)/%.lo) ObjectsBC := $(BaseNameSources:%=$(ObjDir)/%.bc) ############################################################################### @@ -827,11 +830,12 @@ # Make sure there isn't any extranous whitespace on the LIBRARYNAME option LIBRARYNAME := $(strip $(LIBRARYNAME)) ifdef LOADABLE_MODULE -LibName.LA := $(LibDir)/$(LIBRARYNAME).la +LibName.A := $(LibDir)/$(LIBRARYNAME).a +LibName.SO := $(LibDir)/$(LIBRARYNAME)$(SHLIBEXT) else -LibName.LA := $(LibDir)/lib$(LIBRARYNAME).la -endif LibName.A := $(LibDir)/lib$(LIBRARYNAME).a +LibName.SO := $(LibDir)/lib$(LIBRARYNAME)$(SHLIBEXT) +endif LibName.O := $(LibDir)/$(LIBRARYNAME).o LibName.BCA:= $(LibDir)/lib$(LIBRARYNAME).bca @@ -843,7 +847,7 @@ #--------------------------------------------------------- ifdef SHARED_LIBRARY -all-local:: $(LibName.LA) +all-local:: $(LibName.SO) ifdef LINK_LIBS_IN_SHARED ifdef LOADABLE_MODULE @@ -851,22 +855,20 @@ else SharedLibKindMessage := "Shared Library" endif -$(LibName.LA): $(ObjectsLO) $(ProjLibsPaths) $(LLVMLibsPaths) $(LibDir)/.dir +$(LibName.SO): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths) $(LibDir)/.dir $(Echo) Linking $(BuildMode) $(SharedLibKindMessage) \ $(LIBRARYNAME)$(SHLIBEXT) - $(Verb) $(LTLink) -o $@ $(ObjectsLO) $(ProjLibsOptions) \ - $(LLVMLibsOptions) - $(Verb) $(LTInstall) $@ $(LibDir) + $(Verb) $(Link) $(SharedLinkOptions) -o $@ $(ObjectsO) \ + $(ProjLibsOptions) $(LLVMLibsOptions) else -$(LibName.LA): $(ObjectsLO) $(LibDir)/.dir +$(LibName.SO): $(ObjectsO) $(LibDir)/.dir $(Echo) Linking $(BuildMode) Shared Library $(LIBRARYNAME)$(SHLIBEXT) - $(Verb) $(LTLink) -o $@ $(ObjectsLO) - $(Verb) $(LTInstall) $@ $(LibDir) + $(Verb) $(Link) $(SharedLinkOptions) -o $@ $(ObjectsO) endif clean-local:: -ifneq ($(strip $(LibName.LA)),) - -$(Verb) $(RM) -f $(LibName.LA) +ifneq ($(strip $(LibName.SO)),) + -$(Verb) $(RM) -f $(LibName.SO) endif ifdef NO_INSTALL @@ -879,10 +881,9 @@ install-local:: $(DestSharedLib) -$(DestSharedLib): $(LibName.LA) $(PROJ_libdir) +$(DestSharedLib): $(LibName.SO) $(PROJ_libdir) $(Echo) Installing $(BuildMode) Shared Library $(DestSharedLib) - $(Verb) $(LTInstall) $(LibName.LA) $(DestSharedLib) - $(Verb) $(LIBTOOL) --finish $(PROJ_libdir) + $(Verb) $(INSTALL) $(LibName.SO) $(DestSharedLib) uninstall-local:: $(Echo) Uninstalling $(BuildMode) Shared Library $(DestSharedLib) @@ -976,7 +977,7 @@ $(LibName.O): $(ObjectsO) $(LibDir)/.dir $(Echo) Linking $(BuildMode) Object Library $(notdir $@) - $(Verb) $(LTRelink) -o $@ $(ObjectsO) + $(Verb) $(Relink) -Wl,-r -nodefaultlibs -nostdlibs -nostartfiles -o $@ $(ObjectsO) clean-local:: ifneq ($(strip $(LibName.O)),) @@ -995,7 +996,7 @@ $(DestRelinkedLib): $(LibName.O) $(PROJ_libdir) $(Echo) Installing $(BuildMode) Object Library $(DestRelinkedLib) - $(Verb) $(LTInstall) $(LibName.O) $(DestRelinkedLib) + $(Verb) $(INSTALL) $(LibName.O) $(DestRelinkedLib) uninstall-local:: $(Echo) Uninstalling $(BuildMode) Object Library $(DestRelinkedLib) @@ -1036,7 +1037,7 @@ $(DestArchiveLib): $(LibName.A) $(PROJ_libdir) $(Echo) Installing $(BuildMode) Archive Library $(DestArchiveLib) $(Verb) $(MKDIR) $(PROJ_libdir) - $(Verb) $(LTInstall) $(LibName.A) $(DestArchiveLib) + $(Verb) $(INSTALL) $(LibName.A) $(DestArchiveLib) uninstall-local:: $(Echo) Uninstalling $(BuildMode) Archive Library $(DestArchiveLib) @@ -1080,7 +1081,7 @@ $(ToolBuildPath): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths) $(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg) - $(Verb) $(LTLink) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \ + $(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \ $(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB) $(LIBS) $(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) \ $(StripWarnMsg) @@ -1114,43 +1115,34 @@ DISABLE_AUTO_DEPENDENCIES=1 endif -ifdef SHARED_LIBRARY -PIC_FLAG = "(PIC)" -MAYBE_PIC_Compile.CXX = $(LTCompile.CXX) -MAYBE_PIC_Compile.C = $(LTCompile.C) -else -MAYBE_PIC_Compile.CXX = $(Compile.CXX) -MAYBE_PIC_Compile.C = $(Compile.C) -endif - # Provide rule sets for when dependency generation is enabled ifndef DISABLE_AUTO_DEPENDENCIES #--------------------------------------------------------- -# Create .lo files in the ObjDir directory from the .cpp and .c files... +# Create .o files in the ObjDir directory from the .cpp and .c files... #--------------------------------------------------------- DEPEND_OPTIONS = -MMD -MP -MF "$(ObjDir)/$*.d.tmp" \ - -MT "$(ObjDir)/$*.lo" -MT "$(ObjDir)/$*.o" -MT "$(ObjDir)/$*.d" + -MT "$(ObjDir)/$*.o" -MT "$(ObjDir)/$*.d" # If the build succeeded, move the dependency file over. If it failed, put an # empty file there. DEPEND_MOVEFILE = then $(MV) -f "$(ObjDir)/$*.d.tmp" "$(ObjDir)/$*.d"; \ else $(RM) "$(ObjDir)/$*.d.tmp"; exit 1; fi -$(ObjDir)/%.lo $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) +$(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(Echo) "Compiling $*.cpp for $(BuildMode) build " $(PIC_FLAG) - $(Verb) if $(MAYBE_PIC_Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \ + $(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \ $(DEPEND_MOVEFILE) -$(ObjDir)/%.lo $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) +$(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(Echo) "Compiling $*.cc for $(BuildMode) build" $(PIC_FLAG) - $(Verb) if $(MAYBE_PIC_Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \ + $(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \ $(DEPEND_MOVEFILE) -$(ObjDir)/%.lo $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES) +$(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(Echo) "Compiling $*.c for $(BuildMode) build" $(PIC_FLAG) - $(Verb) if $(MAYBE_PIC_Compile.C) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \ + $(Verb) if $(Compile.C) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \ $(DEPEND_MOVEFILE) #--------------------------------------------------------- @@ -1187,17 +1179,17 @@ # Provide alternate rule sets if dependencies are disabled else -$(ObjDir)/%.lo $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) +$(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(Echo) "Compiling $*.cpp for $(BuildMode) build" $(PIC_FLAG) - $(MAYBE_PIC_Compile.CXX) $< -o $@ + $(Compile.CXX) $< -o $@ -$(ObjDir)/%.lo $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) +$(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(Echo) "Compiling $*.cc for $(BuildMode) build" $(PIC_FLAG) - $(MAYBE_PIC_Compile.CXX) $< -o $@ + $(Compile.CXX) $< -o $@ -$(ObjDir)/%.lo $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES) +$(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(Echo) "Compiling $*.c for $(BuildMode) build" $(PIC_FLAG) - $(MAYBE_PIC_Compile.C) $< -o $@ + $(Compile.C) $< -o $@ $(ObjDir)/%.ll: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMGXX) $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)" @@ -1236,15 +1228,15 @@ $(ObjDir)/%.s: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(Echo) "Compiling $*.cpp to asm for $(BuildMode) build" $(PIC_FLAG) - $(MAYBE_PIC_Compile.CXX) $< -o $@ -S + $(Compile.CXX) $< -o $@ -S $(ObjDir)/%.s: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(Echo) "Compiling $*.cc to asm for $(BuildMode) build" $(PIC_FLAG) - $(MAYBE_PIC_Compile.CXX) $< -o $@ -S + $(Compile.CXX) $< -o $@ -S $(ObjDir)/%.s: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(Echo) "Compiling $*.c to asm for $(BuildMode) build" $(PIC_FLAG) - $(MAYBE_PIC_Compile.C) $< -o $@ -S + $(Compile.C) $< -o $@ -S # make the C and C++ compilers strip debug info out of bytecode libraries. Modified: llvm/trunk/bindings/ocaml/Makefile.ocaml URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/Makefile.ocaml?rev=65517&r1=65516&r2=65517&view=diff ============================================================================== --- llvm/trunk/bindings/ocaml/Makefile.ocaml (original) +++ llvm/trunk/bindings/ocaml/Makefile.ocaml Thu Feb 26 01:44:16 2009 @@ -131,7 +131,7 @@ install-a:: $(LibraryA) $(Echo) "Installing $(BuildMode) $(DestA)" $(Verb) $(MKDIR) $(PROJ_libocamldir) - $(Verb) $(LTInstall) $(LibraryA) $(DestA) + $(Verb) $(INSTALL) $(LibraryA) $(DestA) $(Verb) uninstall-a:: Modified: llvm/trunk/docs/MakefileGuide.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/MakefileGuide.html?rev=65517&r1=65516&r2=65517&view=diff ============================================================================== --- llvm/trunk/docs/MakefileGuide.html (original) +++ llvm/trunk/docs/MakefileGuide.html Thu Feb 26 01:44:16 2009 @@ -990,9 +990,6 @@ LLVMToolDir LLVMUsedLibs LocalTargets - LTCompile.C - LTCompile.CXX - LTInstall Module ObjectsBC ObjectsLO Modified: llvm/trunk/unittests/Makefile.unittest URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Makefile.unittest?rev=65517&r1=65516&r2=65517&view=diff ============================================================================== --- llvm/trunk/unittests/Makefile.unittest (original) +++ llvm/trunk/unittests/Makefile.unittest Thu Feb 26 01:44:16 2009 @@ -21,11 +21,11 @@ CPP.Flags += -I$(LLVM_SRC_ROOT)/utils/unittest/googletest/include/ CPP.Flags += -Wno-variadic-macros -LD.Flags += -lGoogleTest -lUnitTestMain +LIBS += -lGoogleTest -lUnitTestMain $(LLVMUnitTestExe): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths) $(Echo) Linking $(BuildMode) unit test $(TESTNAME) $(StripWarnMsg) - $(Verb) $(LTLink) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \ + $(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \ $(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB) $(LIBS) $(Echo) ======= Finished Linking $(BuildMode) Unit test $(TESTNAME) \ $(StripWarnMsg) From nicholas at mxc.ca Thu Feb 26 01:56:49 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Thu, 26 Feb 2009 07:56:49 -0000 Subject: [llvm-commits] [llvm] r65518 - in /llvm/trunk/tools: Makefile gold/Makefile lto/Makefile Message-ID: <200902260756.n1Q7unIh028324@zion.cs.uiuc.edu> Author: nicholas Date: Thu Feb 26 01:56:49 2009 New Revision: 65518 URL: http://llvm.org/viewvc/llvm-project?rev=65518&view=rev Log: Force 'llvm-config' to go first, optionally followed by lto and gold mixed in with the rest of the parallel directories. Build lto when possible on all platforms. Make gold to explicitly depend on libLTO. Modified: llvm/trunk/tools/Makefile llvm/trunk/tools/gold/Makefile llvm/trunk/tools/lto/Makefile Modified: llvm/trunk/tools/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/Makefile?rev=65518&r1=65517&r2=65518&view=diff ============================================================================== --- llvm/trunk/tools/Makefile (original) +++ llvm/trunk/tools/Makefile Thu Feb 26 01:56:49 2009 @@ -15,23 +15,20 @@ # NOTE: The tools are organized into five groups of four consisting of one # large and three small executables. This is done to minimize memory load # in parallel builds. Please retain this ordering. -PARALLEL_DIRS := llvm-config \ - opt llvm-as llvm-dis \ +DIRS := llvm-config +PARALLEL_DIRS := opt llvm-as llvm-dis \ llc llvm-ranlib llvm-ar llvm-nm \ llvm-ld llvm-prof llvm-link \ lli gccas gccld llvm-extract llvm-db \ bugpoint llvm-bcanalyzer llvm-stub llvmc - include $(LEVEL)/Makefile.config -# only build new lto project on Darwin for now -ifeq ($(OS),Darwin) -PARALLEL_DIRS += lto - -ifdef BINUTILS_INCDIR -PARALLEL_DIRS += gold -endif +ifdef ENABLE_PIC + DIRS += lto + ifdef BINUTILS_INCDIR + DIRS += gold + endif endif include $(LEVEL)/Makefile.common Modified: llvm/trunk/tools/gold/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/gold/Makefile?rev=65518&r1=65517&r2=65518&view=diff ============================================================================== --- llvm/trunk/tools/gold/Makefile (original) +++ llvm/trunk/tools/gold/Makefile Thu Feb 26 01:56:49 2009 @@ -21,6 +21,7 @@ DONT_BUILD_RELINKED = 1 LINK_COMPONENTS := +LIBS += -llto include $(LEVEL)/Makefile.common Modified: llvm/trunk/tools/lto/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/Makefile?rev=65518&r1=65517&r2=65518&view=diff ============================================================================== --- llvm/trunk/tools/lto/Makefile (original) +++ llvm/trunk/tools/lto/Makefile Thu Feb 26 01:56:49 2009 @@ -16,12 +16,8 @@ include $(LEVEL)/Makefile.config LINK_LIBS_IN_SHARED = 1 -ifeq ($(OS),Darwin) - SHARED_LIBRARY = 1 - DONT_BUILD_RELINKED = 1 -else - BUILD_ARCHIVE = 1 -endif +SHARED_LIBRARY = 1 +DONT_BUILD_RELINKED = 1 LINK_COMPONENTS := $(TARGETS_TO_BUILD) ipo scalaropts linker bitreader bitwriter From nicholas at mxc.ca Thu Feb 26 02:03:37 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Thu, 26 Feb 2009 08:03:37 -0000 Subject: [llvm-commits] [llvm] r65520 - /llvm/trunk/Makefile.rules Message-ID: <200902260803.n1Q83bUi028602@zion.cs.uiuc.edu> Author: nicholas Date: Thu Feb 26 02:03:36 2009 New Revision: 65520 URL: http://llvm.org/viewvc/llvm-project?rev=65520&view=rev Log: Fix typo! Modified: llvm/trunk/Makefile.rules Modified: llvm/trunk/Makefile.rules URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/Makefile.rules?rev=65520&r1=65519&r2=65520&view=diff ============================================================================== --- llvm/trunk/Makefile.rules (original) +++ llvm/trunk/Makefile.rules Thu Feb 26 02:03:36 2009 @@ -433,7 +433,7 @@ endif # Adjust linker flags for building an executable -ifndef ($(OS),Darwin) +ifneq ($(OS),Darwin) ifdef TOOLNAME ifdef EXAMPLE_TOOL LD.Flags += -Wl,-rpath -Wl,$(ExmplDir) -export-dynamic From anton at korobeynikov.info Thu Feb 26 02:20:06 2009 From: anton at korobeynikov.info (Anton Korobeynikov) Date: Thu, 26 Feb 2009 11:20:06 +0300 Subject: [llvm-commits] [llvm-gcc-4.2] r65490 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: <200902260005.n1Q05SkB009561@zion.cs.uiuc.edu> References: <200902260005.n1Q05SkB009561@zion.cs.uiuc.edu> Message-ID: <11CE5AD2-9E56-41C6-99E2-58E2EF1EDB06@korobeynikov.info> > Put all normal (no embedded NUL characters), constant STRING_CSTs in > the .cstring section. Please don't do that. The backend should decide, whether to put such stuff, *especially* in such easy situations. If it doesnt - please file a PR with attached bitcode. Also, the commit is in typical "apple local style", when darwin- specific hacks are propagated for all targets. --- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University From baldrick at free.fr Thu Feb 26 02:43:07 2009 From: baldrick at free.fr (Duncan Sands) Date: Thu, 26 Feb 2009 09:43:07 +0100 Subject: [llvm-commits] [llvm] r65481 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp In-Reply-To: <200902252239.n1PMdDFB006878@zion.cs.uiuc.edu> References: <200902252239.n1PMdDFB006878@zion.cs.uiuc.edu> Message-ID: <200902260943.07906.baldrick@free.fr> Hi Dale, > Fix big-endian codegen bug. We're splitting up > overly long ints, e.g. i96, into pieces at PHIs > and the nodes that feed into them; however big-endian > reverses the order of the pieces (for some reason), I vaguely recall that the reversing is needed to have the recursion work correctly on big-endian machines. Ciao, Duncan. From nicholas at mxc.ca Thu Feb 26 02:48:15 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Thu, 26 Feb 2009 08:48:15 -0000 Subject: [llvm-commits] [llvm] r65521 - /llvm/trunk/Makefile.rules Message-ID: <200902260848.n1Q8mGhi001741@zion.cs.uiuc.edu> Author: nicholas Date: Thu Feb 26 02:48:14 2009 New Revision: 65521 URL: http://llvm.org/viewvc/llvm-project?rev=65521&view=rev Log: Fix typo. Modified: llvm/trunk/Makefile.rules Modified: llvm/trunk/Makefile.rules URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/Makefile.rules?rev=65521&r1=65520&r2=65521&view=diff ============================================================================== --- llvm/trunk/Makefile.rules (original) +++ llvm/trunk/Makefile.rules Thu Feb 26 02:48:14 2009 @@ -977,7 +977,7 @@ $(LibName.O): $(ObjectsO) $(LibDir)/.dir $(Echo) Linking $(BuildMode) Object Library $(notdir $@) - $(Verb) $(Relink) -Wl,-r -nodefaultlibs -nostdlibs -nostartfiles -o $@ $(ObjectsO) + $(Verb) $(Relink) -Wl,-r -nodefaultlibs -nostdlib -nostartfiles -o $@ $(ObjectsO) clean-local:: ifneq ($(strip $(LibName.O)),) From baldrick at free.fr Thu Feb 26 02:59:40 2009 From: baldrick at free.fr (Duncan Sands) Date: Thu, 26 Feb 2009 09:59:40 +0100 Subject: [llvm-commits] [llvm] r65518 - in /llvm/trunk/tools: Makefile gold/Makefile lto/Makefile In-Reply-To: <200902260756.n1Q7unIh028324@zion.cs.uiuc.edu> References: <200902260756.n1Q7unIh028324@zion.cs.uiuc.edu> Message-ID: <200902260959.40847.baldrick@free.fr> Hi Nick, > +PARALLEL_DIRS := opt llvm-as llvm-dis \ > llc llvm-ranlib llvm-ar llvm-nm \ > llvm-ld llvm-prof llvm-link \ > lli gccas gccld llvm-extract llvm-db \ > bugpoint llvm-bcanalyzer llvm-stub llvmc these lines have tabs in them. Thanks for working on this stuff! Ciao, Duncan. From nicholas at mxc.ca Thu Feb 26 03:08:48 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Thu, 26 Feb 2009 09:08:48 -0000 Subject: [llvm-commits] [llvm] r65523 - /llvm/trunk/tools/Makefile Message-ID: <200902260908.n1Q98mCA005747@zion.cs.uiuc.edu> Author: nicholas Date: Thu Feb 26 03:08:43 2009 New Revision: 65523 URL: http://llvm.org/viewvc/llvm-project?rev=65523&view=rev Log: Tabs to spaces presto chango! Pointed out by Duncan Sands. Modified: llvm/trunk/tools/Makefile Modified: llvm/trunk/tools/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/Makefile?rev=65523&r1=65522&r2=65523&view=diff ============================================================================== --- llvm/trunk/tools/Makefile (original) +++ llvm/trunk/tools/Makefile Thu Feb 26 03:08:43 2009 @@ -19,8 +19,8 @@ PARALLEL_DIRS := opt llvm-as llvm-dis \ llc llvm-ranlib llvm-ar llvm-nm \ llvm-ld llvm-prof llvm-link \ - lli gccas gccld llvm-extract llvm-db \ - bugpoint llvm-bcanalyzer llvm-stub llvmc + lli gccas gccld llvm-extract llvm-db \ + bugpoint llvm-bcanalyzer llvm-stub llvmc include $(LEVEL)/Makefile.config From baldrick at free.fr Thu Feb 26 05:43:59 2009 From: baldrick at free.fr (Duncan Sands) Date: Thu, 26 Feb 2009 11:43:59 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r65527 - /llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Message-ID: <200902261144.n1QBi0xc013889@zion.cs.uiuc.edu> Author: baldrick Date: Thu Feb 26 05:43:58 2009 New Revision: 65527 URL: http://llvm.org/viewvc/llvm-project?rev=65527&view=rev Log: CopyAggregate copies LLVM structs field by field. However it doesn't bother copying fields that were marked isPaddingElement when the type was converted. Before CopyAggregate is used, a check is made that no gcc field is living inside structure padding. But this check only tests for alignment padding and doesn't consider fields marked isPaddingElement as being padding! This can result in some parts of a gcc field not being copied if they lie inside a field marked isPaddingElement. I noticed this with an Ada testcase, see test/FrontendAda/element_copy.adb, but presumably it can happen in obscure cases for C too. The fix is to teach FindLLVMTypePadding about fields marked isPaddingElement. Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp?rev=65527&r1=65526&r2=65527&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Thu Feb 26 05:43:58 2009 @@ -518,44 +518,42 @@ /// FindLLVMTypePadding - If the specified struct has any inter-element padding, /// add it to the Padding array. -static void FindLLVMTypePadding(const Type *Ty, uint64_t BitOffset, +static void FindLLVMTypePadding(const Type *Ty, tree type, uint64_t BitOffset, SmallVector, 16> &Padding) { if (const StructType *STy = dyn_cast(Ty)) { const TargetData &TD = getTargetData(); const StructLayout *SL = TD.getStructLayout(STy); - uint64_t PrevFieldBitOffset = 0; + uint64_t PrevFieldEnd = 0; for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) { + // If this field is marked as being padding, then pretend it is not there. + // This results in it (or something bigger) being added to Padding. This + // matches the logic in CopyAggregate. + if (type && isPaddingElement(type, i)) + continue; + uint64_t FieldBitOffset = SL->getElementOffset(i)*8; // Get padding of sub-elements. - FindLLVMTypePadding(STy->getElementType(i), + FindLLVMTypePadding(STy->getElementType(i), 0, BitOffset+FieldBitOffset, Padding); // Check to see if there is any padding between this element and the // previous one. - if (i) { - uint64_t PrevFieldEnd = - PrevFieldBitOffset+TD.getTypeSizeInBits(STy->getElementType(i-1)); - if (PrevFieldEnd < FieldBitOffset) - Padding.push_back(std::make_pair(PrevFieldEnd+BitOffset, - FieldBitOffset-PrevFieldEnd)); - } - - PrevFieldBitOffset = FieldBitOffset; + if (PrevFieldEnd < FieldBitOffset) + Padding.push_back(std::make_pair(PrevFieldEnd+BitOffset, + FieldBitOffset-PrevFieldEnd)); + PrevFieldEnd = + FieldBitOffset + TD.getTypeSizeInBits(STy->getElementType(i)); } - + // Check for tail padding. - if (unsigned EltCount = STy->getNumElements()) { - uint64_t PrevFieldEnd = PrevFieldBitOffset + - TD.getTypeSizeInBits(STy->getElementType(EltCount-1)); - if (PrevFieldEnd < SL->getSizeInBytes()*8) - Padding.push_back(std::make_pair(PrevFieldEnd, - SL->getSizeInBytes()*8-PrevFieldEnd)); - } - + if (PrevFieldEnd < SL->getSizeInBits()) + Padding.push_back(std::make_pair(PrevFieldEnd, + SL->getSizeInBits()-PrevFieldEnd)); } else if (const ArrayType *ATy = dyn_cast(Ty)) { uint64_t EltSize = getTargetData().getTypeSizeInBits(ATy->getElementType()); for (unsigned i = 0, e = ATy->getNumElements(); i != e; ++i) - FindLLVMTypePadding(ATy->getElementType(), BitOffset+i*EltSize, Padding); + FindLLVMTypePadding(ATy->getElementType(), 0, BitOffset+i*EltSize, + Padding); } // primitive and vector types have no padding. @@ -696,7 +694,7 @@ // Start by finding all of the padding in the LLVM Type. SmallVector, 16> StructPadding; - FindLLVMTypePadding(Ty, 0, StructPadding); + FindLLVMTypePadding(Ty, type, 0, StructPadding); for (unsigned i = 0, e = StructPadding.size(); i != e; ++i) if (GCCTypeOverlapsWithPadding(type, StructPadding[i].first, From criswell at uiuc.edu Thu Feb 26 09:17:14 2009 From: criswell at uiuc.edu (John Criswell) Date: Thu, 26 Feb 2009 15:17:14 -0000 Subject: [llvm-commits] [llvm] r65530 - /llvm/trunk/LICENSE.TXT Message-ID: <200902261517.n1QFHEUU020584@zion.cs.uiuc.edu> Author: criswell Date: Thu Feb 26 09:17:13 2009 New Revision: 65530 URL: http://llvm.org/viewvc/llvm-project?rev=65530&view=rev Log: Another great year for LLVM! Modified: llvm/trunk/LICENSE.TXT Modified: llvm/trunk/LICENSE.TXT URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/LICENSE.TXT?rev=65530&r1=65529&r2=65530&view=diff ============================================================================== --- llvm/trunk/LICENSE.TXT (original) +++ llvm/trunk/LICENSE.TXT Thu Feb 26 09:17:13 2009 @@ -4,7 +4,7 @@ University of Illinois/NCSA Open Source License -Copyright (c) 2003-2008 University of Illinois at Urbana-Champaign. +Copyright (c) 2003-2009 University of Illinois at Urbana-Champaign. All rights reserved. Developed by: From criswell at uiuc.edu Thu Feb 26 09:17:44 2009 From: criswell at uiuc.edu (John Criswell) Date: Thu, 26 Feb 2009 15:17:44 -0000 Subject: [llvm-commits] [poolalloc] r65531 - /poolalloc/trunk/LICENSE.TXT Message-ID: <200902261517.n1QFHip3020638@zion.cs.uiuc.edu> Author: criswell Date: Thu Feb 26 09:17:44 2009 New Revision: 65531 URL: http://llvm.org/viewvc/llvm-project?rev=65531&view=rev Log: Another great year for the Pool Allocation project! Modified: poolalloc/trunk/LICENSE.TXT Modified: poolalloc/trunk/LICENSE.TXT URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/LICENSE.TXT?rev=65531&r1=65530&r2=65531&view=diff ============================================================================== --- poolalloc/trunk/LICENSE.TXT (original) +++ poolalloc/trunk/LICENSE.TXT Thu Feb 26 09:17:44 2009 @@ -4,7 +4,7 @@ University of Illinois/NCSA Open Source License -Copyright (c) 2003-2008 University of Illinois at Urbana-Champaign. +Copyright (c) 2003-2009 University of Illinois at Urbana-Champaign. All rights reserved. Developed by: From echeng at apple.com Thu Feb 26 10:55:43 2009 From: echeng at apple.com (Evan Cheng) Date: Thu, 26 Feb 2009 08:55:43 -0800 Subject: [llvm-commits] [llvm] r65517 - in /llvm/trunk: Makefile.rules bindings/ocaml/Makefile.ocaml docs/MakefileGuide.html unittests/Makefile.unittest In-Reply-To: <200902260744.n1Q7iHAD027878@zion.cs.uiuc.edu> References: <200902260744.n1Q7iHAD027878@zion.cs.uiuc.edu> Message-ID: This breaks Apple style build: ld: unknown option: -export-dynamic collect2: ld returned 1 exit status Evan On Feb 25, 2009, at 11:44 PM, Nick Lewycky wrote: > # Adjust linker flags for building an executable > +ifndef ($(OS),Darwin) > ifdef TOOLNAME > ifdef EXAMPLE_TOOL > - LD.Flags += -rpath $(ExmplDir) -export-dynamic > + LD.Flags += -Wl,-rpath -Wl,$(ExmplDir) -export-dynamic > else > - LD.Flags += -rpath $(ToolDir) -export-dynamic > + LD.Flags += -Wl,-rpath -Wl,$(ToolDir) -export-dynamic > +endif > endif > endif From clattner at apple.com Thu Feb 26 11:28:31 2009 From: clattner at apple.com (Chris Lattner) Date: Thu, 26 Feb 2009 09:28:31 -0800 Subject: [llvm-commits] [llvm-gcc-4.2] r65490 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: <11CE5AD2-9E56-41C6-99E2-58E2EF1EDB06@korobeynikov.info> References: <200902260005.n1Q05SkB009561@zion.cs.uiuc.edu> <11CE5AD2-9E56-41C6-99E2-58E2EF1EDB06@korobeynikov.info> Message-ID: <13785CCB-78C2-4557-AB16-5840AD49A653@apple.com> On Feb 26, 2009, at 12:20 AM, Anton Korobeynikov wrote: > >> Put all normal (no embedded NUL characters), constant STRING_CSTs in >> the .cstring section. > Please don't do that. The backend should decide, whether to put such > stuff, *especially* in such easy situations. Anton, I generally agree, but not in this case. Here the linker *requires* certain strings to be in the cstring section. When it is a question of a missed optimization, I think the backend should be trusted to do the right thing. If it is a semantic requirement, then I think the IR should capture this requirement. Does this approach make sense to you? FWIW, they already fixed the backend to "do the right thing", so this is fixing a "theoretical" or "purity" issue. -Chris From kremenek at apple.com Thu Feb 26 11:37:07 2009 From: kremenek at apple.com (Ted Kremenek) Date: Thu, 26 Feb 2009 17:37:07 -0000 Subject: [llvm-commits] [llvm] r65536 - /llvm/tags/checker/checker-0.165/ Message-ID: <200902261737.n1QHb7td026531@zion.cs.uiuc.edu> Author: kremenek Date: Thu Feb 26 11:37:07 2009 New Revision: 65536 URL: http://llvm.org/viewvc/llvm-project?rev=65536&view=rev Log: Removing checker-0.165. Removed: llvm/tags/checker/checker-0.165/ From kremenek at apple.com Thu Feb 26 11:37:40 2009 From: kremenek at apple.com (Ted Kremenek) Date: Thu, 26 Feb 2009 17:37:40 -0000 Subject: [llvm-commits] [llvm] r65538 - /llvm/tags/checker/checker-0.165/ Message-ID: <200902261737.n1QHbeZt026567@zion.cs.uiuc.edu> Author: kremenek Date: Thu Feb 26 11:37:40 2009 New Revision: 65538 URL: http://llvm.org/viewvc/llvm-project?rev=65538&view=rev Log: Tagging checker-0.165. Added: llvm/tags/checker/checker-0.165/ - copied from r65537, llvm/trunk/ From baldrick at free.fr Thu Feb 26 11:39:42 2009 From: baldrick at free.fr (Duncan Sands) Date: Thu, 26 Feb 2009 17:39:42 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r65541 - /llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Message-ID: <200902261739.n1QHdgXW026679@zion.cs.uiuc.edu> Author: baldrick Date: Thu Feb 26 11:39:42 2009 New Revision: 65541 URL: http://llvm.org/viewvc/llvm-project?rev=65541&view=rev Log: Do not use an array of i32 to pad structs to the same size as the gcc type if the struct has alignment less than 4. Otherwise the very act of adding the padding will increase the alignment of the struct, which can result in the size increasing beyond the size of the gcc type. Testcase is test/FrontendAda/element_copy.adb (but only triggers if Ada strings are mapped to [0 x i8] rather than i8, as is done in a later patch). Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp?rev=65541&r1=65540&r2=65541&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Thu Feb 26 11:39:42 2009 @@ -1355,16 +1355,22 @@ Packed || (!Elements.empty() && AllBitFields)); } + /// getAlignmentAsLLVMStruct - Return the alignment of this struct if it were + /// converted to an LLVM type. + uint64_t getAlignmentAsLLVMStruct() const { + if (Packed || AllBitFields) return 1; + unsigned MaxAlign = 1; + for (unsigned i = 0, e = Elements.size(); i != e; ++i) + MaxAlign = std::max(MaxAlign, getTypeAlignment(Elements[i])); + return MaxAlign; + } + /// getSizeAsLLVMStruct - Return the size of this struct if it were converted /// to an LLVM type. This is the end of last element push an alignment pad at /// the end. uint64_t getSizeAsLLVMStruct() const { if (Elements.empty()) return 0; - unsigned MaxAlign = 1; - if (!Packed && !AllBitFields) - for (unsigned i = 0, e = Elements.size(); i != e; ++i) - MaxAlign = std::max(MaxAlign, getTypeAlignment(Elements[i])); - + unsigned MaxAlign = getAlignmentAsLLVMStruct(); uint64_t Size = ElementOffsetInBytes.back()+ElementSizeInBytes.back(); return (Size+MaxAlign-1) & ~(MaxAlign-1); } @@ -2083,7 +2089,9 @@ if (GCCTypeSize-LLVMLastElementEnd == 1) Info->addElement(Type::Int8Ty, 1, 1); else { - if ( ((GCCTypeSize-LLVMStructSize) % 4) == 0) { + if (((GCCTypeSize-LLVMStructSize) % 4) == 0 && + (Info->getAlignmentAsLLVMStruct() % + Info->getTypeAlignment(Type::Int32Ty)) == 0) { // insert array of i32 unsigned Int32ArraySize = (GCCTypeSize-LLVMStructSize)/4; const Type *PadTy = ArrayType::get(Type::Int32Ty, Int32ArraySize); From echeng at apple.com Thu Feb 26 11:40:30 2009 From: echeng at apple.com (Evan Cheng) Date: Thu, 26 Feb 2009 09:40:30 -0800 Subject: [llvm-commits] [llvm] r65517 - in /llvm/trunk: Makefile.rules bindings/ocaml/Makefile.ocaml docs/MakefileGuide.html unittests/Makefile.unittest In-Reply-To: References: <200902260744.n1Q7iHAD027878@zion.cs.uiuc.edu> Message-ID: Other issues: g++ -I/private/tmp/llvmCore.roots/llvmCore~obj/obj-llvm/include -I/ private/tmp/llvmCore.roots/llvmCore~obj/obj-llvm/lib/Target/CBackend - I/tmp/llvmCore.root\ s/llvmCore~obj/obj-llvm/include -I/tmp/llvmCore.roots/llvmCore~obj/src/ include -I/tmp/llvmCore.roots/llvmCore~obj/src/lib/Target/CBackend - DNDEBUG -D_GNU_\ SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -O3 -fno- exceptions -fno-common -DLLVM_VERSION_INFO='" Apple Build #9999"' - Woverloaded-virtual -peda\ ntic -Wall -W -Wwrite-strings -Wno-long-long -Wunused -Wno-unused- parameter -fstrict-aliasing -Wstrict-aliasing -arch i386 -Wno-format - XCClinker -arch -XC\ Clinker i386 -Wl,-r -nodefaultlibs -nostdlib -nostartfiles -o /private/ tmp/llvmCore.roots/llvmCore~obj/obj-llvm/Release-Asserts/lib/ LLVMCBackend.o /private/\ tmp/llvmCore.roots/llvmCore~obj/obj-llvm/lib/Target/CBackend/Release- Asserts/CBackend.o g++-4.0: Invalid arch name : -XCClinker Evan On Feb 26, 2009, at 8:55 AM, Evan Cheng wrote: > This breaks Apple style build: > > ld: unknown option: -export-dynamic > collect2: ld returned 1 exit status > > Evan > > On Feb 25, 2009, at 11:44 PM, Nick Lewycky wrote: > >> # Adjust linker flags for building an executable >> +ifndef ($(OS),Darwin) >> ifdef TOOLNAME >> ifdef EXAMPLE_TOOL >> - LD.Flags += -rpath $(ExmplDir) -export-dynamic >> + LD.Flags += -Wl,-rpath -Wl,$(ExmplDir) -export-dynamic >> else >> - LD.Flags += -rpath $(ToolDir) -export-dynamic >> + LD.Flags += -Wl,-rpath -Wl,$(ToolDir) -export-dynamic >> +endif >> endif >> endif > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From sabre at nondot.org Thu Feb 26 11:44:38 2009 From: sabre at nondot.org (Chris Lattner) Date: Thu, 26 Feb 2009 17:44:38 -0000 Subject: [llvm-commits] [llvm] r65542 - /llvm/trunk/Makefile.rules Message-ID: <200902261744.n1QHicvt026864@zion.cs.uiuc.edu> Author: lattner Date: Thu Feb 26 11:44:38 2009 New Revision: 65542 URL: http://llvm.org/viewvc/llvm-project?rev=65542&view=rev Log: pass -mmacosx-version-min to the compiler and linker, which makes the build substantially happier on some versions of Mac OS/X. Modified: llvm/trunk/Makefile.rules Modified: llvm/trunk/Makefile.rules URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/Makefile.rules?rev=65542&r1=65541&r2=65542&view=diff ============================================================================== --- llvm/trunk/Makefile.rules (original) +++ llvm/trunk/Makefile.rules Thu Feb 26 11:44:38 2009 @@ -444,7 +444,10 @@ endif ifeq ($(OS),Darwin) - SharedLinkOptions=-Wl,-flat_namespace -Wl,-undefined -Wl,suppress -bundle + DARWIN_VERSION := `sw_vers -productVersion` + SharedLinkOptions=-Wl,-flat_namespace -Wl,-undefined -Wl,suppress -bundle \ + -mmacosx-version-min=$(DARWIN_VERSION) + CompileCommonOpts += -mmacosx-version-min=$(DARWIN_VERSION) else SharedLinkOptions=-shared endif @@ -453,7 +456,7 @@ # Options To Invoke Tools #---------------------------------------------------------- -CompileCommonOpts := -pedantic -Wall -W -Wwrite-strings -Wno-long-long \ +CompileCommonOpts += -pedantic -Wall -W -Wwrite-strings -Wno-long-long \ -Wunused -Wno-unused-parameter $(EXTRA_OPTIONS) ifeq ($(OS),HP-UX) From clattner at apple.com Thu Feb 26 11:43:48 2009 From: clattner at apple.com (Chris Lattner) Date: Thu, 26 Feb 2009 09:43:48 -0800 Subject: [llvm-commits] [llvm] r65517 - in /llvm/trunk: Makefile.rules bindings/ocaml/Makefile.ocaml docs/MakefileGuide.html unittests/Makefile.unittest In-Reply-To: References: <200902260744.n1Q7iHAD027878@zion.cs.uiuc.edu> Message-ID: On Feb 26, 2009, at 9:40 AM, Evan Cheng wrote: > Other issues: > > g++ -I/private/tmp/llvmCore.roots/llvmCore~obj/obj-llvm/include -I/ > private/tmp/llvmCore.roots/llvmCore~obj/obj-llvm/lib/Target/CBackend - > I/tmp/llvmCore.root\ Evan, what OS are you seeing in Makefile.config? That makefile goop is protected by ifneq ($(OS),Darwin) -Chris > s/llvmCore~obj/obj-llvm/include -I/tmp/llvmCore.roots/llvmCore~obj/ > src/ > include -I/tmp/llvmCore.roots/llvmCore~obj/src/lib/Target/CBackend - > DNDEBUG -D_GNU_\ > SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -O3 -fno- > exceptions -fno-common -DLLVM_VERSION_INFO='" Apple Build #9999"' - > Woverloaded-virtual -peda\ > ntic -Wall -W -Wwrite-strings -Wno-long-long -Wunused -Wno-unused- > parameter -fstrict-aliasing -Wstrict-aliasing -arch i386 -Wno- > format - > XCClinker -arch -XC\ > Clinker i386 -Wl,-r -nodefaultlibs -nostdlib -nostartfiles -o / > private/ > tmp/llvmCore.roots/llvmCore~obj/obj-llvm/Release-Asserts/lib/ > LLVMCBackend.o /private/\ > tmp/llvmCore.roots/llvmCore~obj/obj-llvm/lib/Target/CBackend/Release- > Asserts/CBackend.o > g++-4.0: Invalid arch name : -XCClinker > > Evan > On Feb 26, 2009, at 8:55 AM, Evan Cheng wrote: > >> This breaks Apple style build: >> >> ld: unknown option: -export-dynamic >> collect2: ld returned 1 exit status >> >> Evan >> >> On Feb 25, 2009, at 11:44 PM, Nick Lewycky wrote: >> >>> # Adjust linker flags for building an executable >>> +ifndef ($(OS),Darwin) >>> ifdef TOOLNAME >>> ifdef EXAMPLE_TOOL >>> - LD.Flags += -rpath $(ExmplDir) -export-dynamic >>> + LD.Flags += -Wl,-rpath -Wl,$(ExmplDir) -export-dynamic >>> else >>> - LD.Flags += -rpath $(ToolDir) -export-dynamic >>> + LD.Flags += -Wl,-rpath -Wl,$(ToolDir) -export-dynamic >>> +endif >>> endif >>> endif >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From sabre at nondot.org Thu Feb 26 11:47:49 2009 From: sabre at nondot.org (Chris Lattner) Date: Thu, 26 Feb 2009 17:47:49 -0000 Subject: [llvm-commits] [llvm] r65543 - /llvm/trunk/Makefile.rules Message-ID: <200902261747.n1QHlnu0027012@zion.cs.uiuc.edu> Author: lattner Date: Thu Feb 26 11:47:49 2009 New Revision: 65543 URL: http://llvm.org/viewvc/llvm-project?rev=65543&view=rev Log: strip exported symbols from tools that build with TOOL_NO_EXPORTS=1. Modified: llvm/trunk/Makefile.rules Modified: llvm/trunk/Makefile.rules URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/Makefile.rules?rev=65543&r1=65542&r2=65543&view=diff ============================================================================== --- llvm/trunk/Makefile.rules (original) +++ llvm/trunk/Makefile.rules Thu Feb 26 11:47:49 2009 @@ -1067,6 +1067,24 @@ endif #--------------------------------------------------------- +# Prune Exports +#--------------------------------------------------------- + +# If the tool opts in with TOOL_NO_EXPORTS, optimize startup time of the app by +# not exporting all of the weak symbols from the binary. This reduces dyld +# startup time by 4x on darwin in some cases. +ifdef TOOL_NO_EXPORTS +ifeq ($(OS),Darwin) +LD.Flags += -Wl,-exported_symbol -Wl,_main +endif + +ifeq ($(OS), $(filter $(OS), Linux NetBSD FreeBSD)) +LD.Flags += -Wl,--version-script=Driver.map +endif +endif + + +#--------------------------------------------------------- # Provide targets for building the tools #--------------------------------------------------------- all-local:: $(ToolBuildPath) From echeng at apple.com Thu Feb 26 11:49:31 2009 From: echeng at apple.com (Evan Cheng) Date: Thu, 26 Feb 2009 09:49:31 -0800 Subject: [llvm-commits] [llvm] r65517 - in /llvm/trunk: Makefile.rules bindings/ocaml/Makefile.ocaml docs/MakefileGuide.html unittests/Makefile.unittest In-Reply-To: References: <200902260744.n1Q7iHAD027878@zion.cs.uiuc.edu> Message-ID: <0B3D6B0B-E7BB-4BF4-9746-8FAAD38091A2@apple.com> On Feb 26, 2009, at 9:43 AM, Chris Lattner wrote: > > On Feb 26, 2009, at 9:40 AM, Evan Cheng wrote: > >> Other issues: >> >> g++ -I/private/tmp/llvmCore.roots/llvmCore~obj/obj-llvm/include -I/ >> private/tmp/llvmCore.roots/llvmCore~obj/obj-llvm/lib/Target/ >> CBackend - >> I/tmp/llvmCore.root\ > > Evan, what OS are you seeing in Makefile.config? It is Darwin. Evan > > That makefile goop is protected by > > ifneq ($(OS),Darwin) > > -Chris > > >> s/llvmCore~obj/obj-llvm/include -I/tmp/llvmCore.roots/llvmCore~obj/ >> src/ >> include -I/tmp/llvmCore.roots/llvmCore~obj/src/lib/Target/CBackend - >> DNDEBUG -D_GNU_\ >> SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -O3 -fno- >> exceptions -fno-common -DLLVM_VERSION_INFO='" Apple Build #9999"' - >> Woverloaded-virtual -peda\ >> ntic -Wall -W -Wwrite-strings -Wno-long-long -Wunused -Wno-unused- >> parameter -fstrict-aliasing -Wstrict-aliasing -arch i386 -Wno- >> format - >> XCClinker -arch -XC\ >> Clinker i386 -Wl,-r -nodefaultlibs -nostdlib -nostartfiles -o / >> private/ >> tmp/llvmCore.roots/llvmCore~obj/obj-llvm/Release-Asserts/lib/ >> LLVMCBackend.o /private/\ >> tmp/llvmCore.roots/llvmCore~obj/obj-llvm/lib/Target/CBackend/Release- >> Asserts/CBackend.o >> g++-4.0: Invalid arch name : -XCClinker >> >> Evan >> On Feb 26, 2009, at 8:55 AM, Evan Cheng wrote: >> >>> This breaks Apple style build: >>> >>> ld: unknown option: -export-dynamic >>> collect2: ld returned 1 exit status >>> >>> Evan >>> >>> On Feb 25, 2009, at 11:44 PM, Nick Lewycky wrote: >>> >>>> # Adjust linker flags for building an executable >>>> +ifndef ($(OS),Darwin) >>>> ifdef TOOLNAME >>>> ifdef EXAMPLE_TOOL >>>> - LD.Flags += -rpath $(ExmplDir) -export-dynamic >>>> + LD.Flags += -Wl,-rpath -Wl,$(ExmplDir) -export-dynamic >>>> else >>>> - LD.Flags += -rpath $(ToolDir) -export-dynamic >>>> + LD.Flags += -Wl,-rpath -Wl,$(ToolDir) -export-dynamic >>>> +endif >>>> endif >>>> endif >>> >>> _______________________________________________ >>> llvm-commits mailing list >>> llvm-commits at cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Thu Feb 26 11:51:30 2009 From: clattner at apple.com (Chris Lattner) Date: Thu, 26 Feb 2009 09:51:30 -0800 Subject: [llvm-commits] [llvm] r65517 - in /llvm/trunk: Makefile.rules bindings/ocaml/Makefile.ocaml docs/MakefileGuide.html unittests/Makefile.unittest In-Reply-To: <0B3D6B0B-E7BB-4BF4-9746-8FAAD38091A2@apple.com> References: <200902260744.n1Q7iHAD027878@zion.cs.uiuc.edu> <0B3D6B0B-E7BB-4BF4-9746-8FAAD38091A2@apple.com> Message-ID: <913FFD62-246B-4D84-992D-CCF0C4736562@apple.com> On Feb 26, 2009, at 9:49 AM, Evan Cheng wrote: > > On Feb 26, 2009, at 9:43 AM, Chris Lattner wrote: > >> >> On Feb 26, 2009, at 9:40 AM, Evan Cheng wrote: >> >>> Other issues: >>> >>> g++ -I/private/tmp/llvmCore.roots/llvmCore~obj/obj-llvm/include -I/ >>> private/tmp/llvmCore.roots/llvmCore~obj/obj-llvm/lib/Target/ >>> CBackend - >>> I/tmp/llvmCore.root\ >> >> Evan, what OS are you seeing in Makefile.config? > > It is Darwin. Does it fail for a normal build or just fail for apple-style build? -Chris From baldrick at free.fr Thu Feb 26 12:00:47 2009 From: baldrick at free.fr (Duncan Sands) Date: Thu, 26 Feb 2009 19:00:47 +0100 Subject: [llvm-commits] [llvm] r65517 - in /llvm/trunk: Makefile.rules bindings/ocaml/Makefile.ocaml docs/MakefileGuide.html unittests/Makefile.unittest In-Reply-To: References: <200902260744.n1Q7iHAD027878@zion.cs.uiuc.edu> Message-ID: <200902261900.48355.baldrick@free.fr> > Evan, what OS are you seeing in Makefile.config? > > That makefile goop is protected by > > ifneq ($(OS),Darwin) This morning it was "ifndef" momentarily, before being corrected to "ifneq". Maybe Evan is not at TOT? Ciao, Duncan. From kremenek at apple.com Thu Feb 26 12:06:59 2009 From: kremenek at apple.com (Ted Kremenek) Date: Thu, 26 Feb 2009 18:06:59 -0000 Subject: [llvm-commits] [llvm] r65545 - /llvm/tags/checker/checker-0.165/ Message-ID: <200902261806.n1QI6xcX027907@zion.cs.uiuc.edu> Author: kremenek Date: Thu Feb 26 12:06:58 2009 New Revision: 65545 URL: http://llvm.org/viewvc/llvm-project?rev=65545&view=rev Log: Removing checker-0.165. Removed: llvm/tags/checker/checker-0.165/ From echeng at apple.com Thu Feb 26 12:16:38 2009 From: echeng at apple.com (Evan Cheng) Date: Thu, 26 Feb 2009 10:16:38 -0800 Subject: [llvm-commits] [llvm] r65517 - in /llvm/trunk: Makefile.rules bindings/ocaml/Makefile.ocaml docs/MakefileGuide.html unittests/Makefile.unittest In-Reply-To: <200902261900.48355.baldrick@free.fr> References: <200902260744.n1Q7iHAD027878@zion.cs.uiuc.edu> <200902261900.48355.baldrick@free.fr> Message-ID: No. It's TOT. Evan On Feb 26, 2009, at 10:00 AM, Duncan Sands wrote: >> Evan, what OS are you seeing in Makefile.config? >> >> That makefile goop is protected by >> >> ifneq ($(OS),Darwin) > > This morning it was "ifndef" momentarily, before > being corrected to "ifneq". Maybe Evan is not at > TOT? > > Ciao, > > Duncan. > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From dalej at apple.com Thu Feb 26 12:28:33 2009 From: dalej at apple.com (Dale Johannesen) Date: Thu, 26 Feb 2009 18:28:33 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r65549 - /llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/AppDelegate.m Message-ID: <200902261828.n1QISXkb028705@zion.cs.uiuc.edu> Author: johannes Date: Thu Feb 26 12:28:33 2009 New Revision: 65549 URL: http://llvm.org/viewvc/llvm-project?rev=65549&view=rev Log: Allow for slightly different llvm-gcc syntax. Modified: llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/AppDelegate.m Modified: llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/AppDelegate.m URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/AppDelegate.m?rev=65549&r1=65548&r2=65549&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/AppDelegate.m (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/AppDelegate.m Thu Feb 26 12:28:33 2009 @@ -3,7 +3,7 @@ /* AppDelegate.m, AppDelegate.h */ /* { dg-do compile } */ /* { dg-options " -O0 -gdwarf-2 -c -dA -mmacosx-version-min=10.5" { target powerpc*-*-darwin* i?86*-*-darwin* } } */ -/* { dg-final { scan-assembler "AppDelegate.m:12" } } */ +/* { dg-final { scan-assembler "AppDelegate.m ?:12" } } */ #import "AppDelegate.h" From echeng at apple.com Thu Feb 26 12:28:39 2009 From: echeng at apple.com (Evan Cheng) Date: Thu, 26 Feb 2009 10:28:39 -0800 Subject: [llvm-commits] [llvm] r65517 - in /llvm/trunk: Makefile.rules bindings/ocaml/Makefile.ocaml docs/MakefileGuide.html unittests/Makefile.unittest In-Reply-To: <913FFD62-246B-4D84-992D-CCF0C4736562@apple.com> References: <200902260744.n1Q7iHAD027878@zion.cs.uiuc.edu> <0B3D6B0B-E7BB-4BF4-9746-8FAAD38091A2@apple.com> <913FFD62-246B-4D84-992D-CCF0C4736562@apple.com> Message-ID: Just Apple style build. Evan On Feb 26, 2009, at 9:51 AM, Chris Lattner wrote: > > On Feb 26, 2009, at 9:49 AM, Evan Cheng wrote: > >> >> On Feb 26, 2009, at 9:43 AM, Chris Lattner wrote: >> >>> >>> On Feb 26, 2009, at 9:40 AM, Evan Cheng wrote: >>> >>>> Other issues: >>>> >>>> g++ -I/private/tmp/llvmCore.roots/llvmCore~obj/obj-llvm/include -I/ >>>> private/tmp/llvmCore.roots/llvmCore~obj/obj-llvm/lib/Target/ >>>> CBackend - >>>> I/tmp/llvmCore.root\ >>> >>> Evan, what OS are you seeing in Makefile.config? >> >> It is Darwin. > > Does it fail for a normal build or just fail for apple-style build? > > -Chris > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From dalej at apple.com Thu Feb 26 12:29:12 2009 From: dalej at apple.com (Dale Johannesen) Date: Thu, 26 Feb 2009 18:29:12 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r65550 - /llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/AppDelegate.m Message-ID: <200902261829.n1QITCdp028741@zion.cs.uiuc.edu> Author: johannes Date: Thu Feb 26 12:29:12 2009 New Revision: 65550 URL: http://llvm.org/viewvc/llvm-project?rev=65550&view=rev Log: Fix local marker Modified: llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/AppDelegate.m Modified: llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/AppDelegate.m URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/AppDelegate.m?rev=65550&r1=65549&r2=65550&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/AppDelegate.m (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/AppDelegate.m Thu Feb 26 12:29:12 2009 @@ -3,6 +3,7 @@ /* AppDelegate.m, AppDelegate.h */ /* { dg-do compile } */ /* { dg-options " -O0 -gdwarf-2 -c -dA -mmacosx-version-min=10.5" { target powerpc*-*-darwin* i?86*-*-darwin* } } */ +/* LLVM LOCAL allow for extra space */ /* { dg-final { scan-assembler "AppDelegate.m ?:12" } } */ #import "AppDelegate.h" From sabre at nondot.org Thu Feb 26 12:29:42 2009 From: sabre at nondot.org (Chris Lattner) Date: Thu, 26 Feb 2009 18:29:42 -0000 Subject: [llvm-commits] [llvm] r65551 - /llvm/trunk/tools/llvm-as/Makefile Message-ID: <200902261829.n1QITgtA028765@zion.cs.uiuc.edu> Author: lattner Date: Thu Feb 26 12:29:42 2009 New Revision: 65551 URL: http://llvm.org/viewvc/llvm-project?rev=65551&view=rev Log: use TOOL_NO_EXPORTS, this shrinks the llvm-as binary from 1825296 to 1662184 bytes (~10%) Modified: llvm/trunk/tools/llvm-as/Makefile Modified: llvm/trunk/tools/llvm-as/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-as/Makefile?rev=65551&r1=65550&r2=65551&view=diff ============================================================================== --- llvm/trunk/tools/llvm-as/Makefile (original) +++ llvm/trunk/tools/llvm-as/Makefile Thu Feb 26 12:29:42 2009 @@ -12,4 +12,7 @@ LINK_COMPONENTS := asmparser bitwriter REQUIRES_EH := 1 +# This tool has no plugins, optimize startup time. +TOOL_NO_EXPORTS = 1 + include $(LEVEL)/Makefile.common From sabre at nondot.org Thu Feb 26 12:37:59 2009 From: sabre at nondot.org (Chris Lattner) Date: Thu, 26 Feb 2009 18:37:59 -0000 Subject: [llvm-commits] [llvm] r65552 - in /llvm/trunk: Makefile.rules autoconf/ExportMap.map Message-ID: <200902261837.n1QIbxdP029045@zion.cs.uiuc.edu> Author: lattner Date: Thu Feb 26 12:37:59 2009 New Revision: 65552 URL: http://llvm.org/viewvc/llvm-project?rev=65552&view=rev Log: Search for the export map in a place that it can be found. Added: llvm/trunk/autoconf/ExportMap.map Modified: llvm/trunk/Makefile.rules Modified: llvm/trunk/Makefile.rules URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/Makefile.rules?rev=65552&r1=65551&r2=65552&view=diff ============================================================================== --- llvm/trunk/Makefile.rules (original) +++ llvm/trunk/Makefile.rules Thu Feb 26 12:37:59 2009 @@ -1079,7 +1079,7 @@ endif ifeq ($(OS), $(filter $(OS), Linux NetBSD FreeBSD)) -LD.Flags += -Wl,--version-script=Driver.map +LD.Flags += -Wl,--version-script=$(LLVM_SRC_ROOT)/ExportMap.map endif endif Added: llvm/trunk/autoconf/ExportMap.map URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/ExportMap.map?rev=65552&view=auto ============================================================================== --- llvm/trunk/autoconf/ExportMap.map (added) +++ llvm/trunk/autoconf/ExportMap.map Thu Feb 26 12:37:59 2009 @@ -0,0 +1,4 @@ +{ + global: main; + local: *; +}; From anton at korobeynikov.info Thu Feb 26 12:38:01 2009 From: anton at korobeynikov.info (Anton Korobeynikov) Date: Thu, 26 Feb 2009 21:38:01 +0300 Subject: [llvm-commits] [llvm-gcc-4.2] r65490 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: <13785CCB-78C2-4557-AB16-5840AD49A653@apple.com> References: <200902260005.n1Q05SkB009561@zion.cs.uiuc.edu> <11CE5AD2-9E56-41C6-99E2-58E2EF1EDB06@korobeynikov.info> <13785CCB-78C2-4557-AB16-5840AD49A653@apple.com> Message-ID: Hi, Chris > If it is a semantic requirement, then I think the IR should capture > this requirement. Ok, this makes sense. > Does this approach make sense to you? FWIW, they already fixed the > backend to "do the right thing", I know :) I did this someday. > so this is fixing a "theoretical" or "purity" issue. From this point of view the patch is not complete, as you already mentioned, it does not "capture" zero-sized strings. Stuart, the "full" check can be see seen in lib/Target/ TargetAsmInfo.cpp:isConstantString() --- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University From sabre at nondot.org Thu Feb 26 12:38:41 2009 From: sabre at nondot.org (Chris Lattner) Date: Thu, 26 Feb 2009 18:38:41 -0000 Subject: [llvm-commits] [llvm] r65554 - /llvm/trunk/Makefile.rules Message-ID: <200902261838.n1QIcfT6029088@zion.cs.uiuc.edu> Author: lattner Date: Thu Feb 26 12:38:40 2009 New Revision: 65554 URL: http://llvm.org/viewvc/llvm-project?rev=65554&view=rev Log: no really, use the right path. Modified: llvm/trunk/Makefile.rules Modified: llvm/trunk/Makefile.rules URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/Makefile.rules?rev=65554&r1=65553&r2=65554&view=diff ============================================================================== --- llvm/trunk/Makefile.rules (original) +++ llvm/trunk/Makefile.rules Thu Feb 26 12:38:40 2009 @@ -1079,7 +1079,7 @@ endif ifeq ($(OS), $(filter $(OS), Linux NetBSD FreeBSD)) -LD.Flags += -Wl,--version-script=$(LLVM_SRC_ROOT)/ExportMap.map +LD.Flags += -Wl,--version-script=$(LLVM_SRC_ROOT)/autoconf/ExportMap.map endif endif From isanbard at gmail.com Thu Feb 26 12:57:01 2009 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 26 Feb 2009 10:57:01 -0800 Subject: [llvm-commits] [llvm] r65542 - /llvm/trunk/Makefile.rules In-Reply-To: <200902261744.n1QHicvt026864@zion.cs.uiuc.edu> References: <200902261744.n1QHicvt026864@zion.cs.uiuc.edu> Message-ID: <16e5fdf90902261057p5b8a008dyd877b50f382cfec2@mail.gmail.com> Chris, This change is causing these errors on the buildbots. Please investigate. Running /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.src/test/FrontendC/dg.exp ... FAIL: /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.src/test/FrontendC/2009-02-17-BitField-dbg.c Failed with exit(1) at line 2 while running: gcc -I/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.obj/include -I/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.obj/test -I/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.src/include -I/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.src/test -D_DEBUG -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -mmacosx-version-min=`sw_vers -productVersion` -pedantic -Wall -W -Wwrite-strings -Wno-long-long -Wunused -Wno-unused-parameter -fstrict-aliasing -Wstrict-aliasing -I/usr/include/c++/4.0.0/i686-apple-darwin9 -I/usr/include/c++/4.0.0 -c 2009-02-17-BitField-dbg.s -o 2009-02-17-BitField-dbg.o :0: error: Unknown value '`sw_vers' of -mmacosx-version-min Running /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.src/test/FrontendC++/dg.exp ... FAIL: /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.src/test/FrontendC++/2006-11-06-StackTrace.cpp Failed with exit(1) at line 2 while running: gcc -I/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.obj/include -I/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.obj/test -I/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.src/include -I/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.src/test -D_DEBUG -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -mmacosx-version-min=`sw_vers -productVersion` -pedantic -Wall -W -Wwrite-strings -Wno-long-long -Wunused -Wno-unused-parameter -fstrict-aliasing -Wstrict-aliasing -I/usr/include/c++/4.0.0/i686-apple-darwin9 -I/usr/include/c++/4.0.0 -c 2006-11-06-StackTrace.cpp.tmp.s -o 2006-11-06-StackTrace.cpp.tmp.o :0: error: Unknown value '`sw_vers' of -mmacosx-version-min FAIL: /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.src/test/FrontendC++/2006-11-30-Pubnames.cpp Failed with exit(1) at line 2 while running: gcc -I/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.obj/include -I/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.obj/test -I/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.src/include -I/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.src/test -D_DEBUG -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -mmacosx-version-min=`sw_vers -productVersion` -pedantic -Wall -W -Wwrite-strings -Wno-long-long -Wunused -Wno-unused-parameter -fstrict-aliasing -Wstrict-aliasing -I/usr/include/c++/4.0.0/i686-apple-darwin9 -I/usr/include/c++/4.0.0 -c 2006-11-30-Pubnames.cpp.tmp.s -o 2006-11-30-Pubnames.cpp.tmp.o :0: error: Unknown value '`sw_vers' of -mmacosx-version-min -bw On Thu, Feb 26, 2009 at 9:44 AM, Chris Lattner wrote: > Author: lattner > Date: Thu Feb 26 11:44:38 2009 > New Revision: 65542 > > URL: http://llvm.org/viewvc/llvm-project?rev=65542&view=rev > Log: > pass -mmacosx-version-min to the compiler and linker, which makes the build > substantially happier on some versions of Mac OS/X. > > > Modified: > ? ?llvm/trunk/Makefile.rules > > Modified: llvm/trunk/Makefile.rules > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/Makefile.rules?rev=65542&r1=65541&r2=65542&view=diff > > ============================================================================== > --- llvm/trunk/Makefile.rules (original) > +++ llvm/trunk/Makefile.rules Thu Feb 26 11:44:38 2009 > @@ -444,7 +444,10 @@ > ?endif > > ?ifeq ($(OS),Darwin) > - ?SharedLinkOptions=-Wl,-flat_namespace -Wl,-undefined -Wl,suppress -bundle > + ?DARWIN_VERSION := `sw_vers -productVersion` > + ?SharedLinkOptions=-Wl,-flat_namespace -Wl,-undefined -Wl,suppress -bundle \ > + ? ? ? ? ? ? ? ? ? ?-mmacosx-version-min=$(DARWIN_VERSION) > + ?CompileCommonOpts += -mmacosx-version-min=$(DARWIN_VERSION) > ?else > ? SharedLinkOptions=-shared > ?endif > @@ -453,7 +456,7 @@ > ?# Options To Invoke Tools > ?#---------------------------------------------------------- > > -CompileCommonOpts := -pedantic -Wall -W -Wwrite-strings -Wno-long-long \ > +CompileCommonOpts += -pedantic -Wall -W -Wwrite-strings -Wno-long-long \ > ? ? ? ? ? ? ? ? ? ? ?-Wunused -Wno-unused-parameter $(EXTRA_OPTIONS) > > ?ifeq ($(OS),HP-UX) > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From sabre at nondot.org Thu Feb 26 13:01:11 2009 From: sabre at nondot.org (Chris Lattner) Date: Thu, 26 Feb 2009 19:01:11 -0000 Subject: [llvm-commits] [llvm] r65558 - in /llvm/trunk/tools: llvm-ar/Makefile llvm-bcanalyzer/Makefile llvm-dis/Makefile llvm-extract/Makefile llvm-link/Makefile llvm-nm/Makefile llvm-prof/Makefile llvm-ranlib/Makefile Message-ID: <200902261901.n1QJ1CCM029931@zion.cs.uiuc.edu> Author: lattner Date: Thu Feb 26 13:01:11 2009 New Revision: 65558 URL: http://llvm.org/viewvc/llvm-project?rev=65558&view=rev Log: disable exports from a bunch more tools, those without plugins. Modified: llvm/trunk/tools/llvm-ar/Makefile llvm/trunk/tools/llvm-bcanalyzer/Makefile llvm/trunk/tools/llvm-dis/Makefile llvm/trunk/tools/llvm-extract/Makefile llvm/trunk/tools/llvm-link/Makefile llvm/trunk/tools/llvm-nm/Makefile llvm/trunk/tools/llvm-prof/Makefile llvm/trunk/tools/llvm-ranlib/Makefile Modified: llvm/trunk/tools/llvm-ar/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-ar/Makefile?rev=65558&r1=65557&r2=65558&view=diff ============================================================================== --- llvm/trunk/tools/llvm-ar/Makefile (original) +++ llvm/trunk/tools/llvm-ar/Makefile Thu Feb 26 13:01:11 2009 @@ -12,6 +12,9 @@ LINK_COMPONENTS = archive REQUIRES_EH := 1 +# This tool has no plugins, optimize startup time. +TOOL_NO_EXPORTS = 1 + include $(LEVEL)/Makefile.common check-local:: Modified: llvm/trunk/tools/llvm-bcanalyzer/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-bcanalyzer/Makefile?rev=65558&r1=65557&r2=65558&view=diff ============================================================================== --- llvm/trunk/tools/llvm-bcanalyzer/Makefile (original) +++ llvm/trunk/tools/llvm-bcanalyzer/Makefile Thu Feb 26 13:01:11 2009 @@ -12,4 +12,7 @@ LINK_COMPONENTS := bitreader REQUIRES_EH := 1 +# This tool has no plugins, optimize startup time. +TOOL_NO_EXPORTS = 1 + include $(LEVEL)/Makefile.common Modified: llvm/trunk/tools/llvm-dis/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-dis/Makefile?rev=65558&r1=65557&r2=65558&view=diff ============================================================================== --- llvm/trunk/tools/llvm-dis/Makefile (original) +++ llvm/trunk/tools/llvm-dis/Makefile Thu Feb 26 13:01:11 2009 @@ -12,4 +12,7 @@ LINK_COMPONENTS := bitreader REQUIRES_EH := 1 +# This tool has no plugins, optimize startup time. +TOOL_NO_EXPORTS = 1 + include $(LEVEL)/Makefile.common Modified: llvm/trunk/tools/llvm-extract/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-extract/Makefile?rev=65558&r1=65557&r2=65558&view=diff ============================================================================== --- llvm/trunk/tools/llvm-extract/Makefile (original) +++ llvm/trunk/tools/llvm-extract/Makefile Thu Feb 26 13:01:11 2009 @@ -12,4 +12,7 @@ TOOLNAME = llvm-extract LINK_COMPONENTS := ipo bitreader bitwriter +# This tool has no plugins, optimize startup time. +TOOL_NO_EXPORTS = 1 + include $(LEVEL)/Makefile.common Modified: llvm/trunk/tools/llvm-link/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-link/Makefile?rev=65558&r1=65557&r2=65558&view=diff ============================================================================== --- llvm/trunk/tools/llvm-link/Makefile (original) +++ llvm/trunk/tools/llvm-link/Makefile Thu Feb 26 13:01:11 2009 @@ -11,4 +11,7 @@ TOOLNAME = llvm-link LINK_COMPONENTS = linker bitreader bitwriter +# This tool has no plugins, optimize startup time. +TOOL_NO_EXPORTS = 1 + include $(LEVEL)/Makefile.common Modified: llvm/trunk/tools/llvm-nm/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-nm/Makefile?rev=65558&r1=65557&r2=65558&view=diff ============================================================================== --- llvm/trunk/tools/llvm-nm/Makefile (original) +++ llvm/trunk/tools/llvm-nm/Makefile Thu Feb 26 13:01:11 2009 @@ -11,4 +11,7 @@ TOOLNAME = llvm-nm LINK_COMPONENTS = archive bitreader +# This tool has no plugins, optimize startup time. +TOOL_NO_EXPORTS = 1 + include $(LEVEL)/Makefile.common Modified: llvm/trunk/tools/llvm-prof/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-prof/Makefile?rev=65558&r1=65557&r2=65558&view=diff ============================================================================== --- llvm/trunk/tools/llvm-prof/Makefile (original) +++ llvm/trunk/tools/llvm-prof/Makefile Thu Feb 26 13:01:11 2009 @@ -12,4 +12,7 @@ LINK_COMPONENTS = bitreader analysis REQUIRES_EH := 1 +# This tool has no plugins, optimize startup time. +TOOL_NO_EXPORTS = 1 + include $(LEVEL)/Makefile.common Modified: llvm/trunk/tools/llvm-ranlib/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-ranlib/Makefile?rev=65558&r1=65557&r2=65558&view=diff ============================================================================== --- llvm/trunk/tools/llvm-ranlib/Makefile (original) +++ llvm/trunk/tools/llvm-ranlib/Makefile Thu Feb 26 13:01:11 2009 @@ -12,4 +12,7 @@ LINK_COMPONENTS = archive REQUIRES_EH := 1 +# This tool has no plugins, optimize startup time. +TOOL_NO_EXPORTS = 1 + include $(LEVEL)/Makefile.common From sabre at nondot.org Thu Feb 26 13:02:24 2009 From: sabre at nondot.org (Chris Lattner) Date: Thu, 26 Feb 2009 19:02:24 -0000 Subject: [llvm-commits] [llvm] r65559 - in /llvm/trunk/utils: PerfectShuffle/Makefile TableGen/Makefile Message-ID: <200902261902.n1QJ2O3B029980@zion.cs.uiuc.edu> Author: lattner Date: Thu Feb 26 13:02:23 2009 New Revision: 65559 URL: http://llvm.org/viewvc/llvm-project?rev=65559&view=rev Log: these utils don't need exports. Modified: llvm/trunk/utils/PerfectShuffle/Makefile llvm/trunk/utils/TableGen/Makefile Modified: llvm/trunk/utils/PerfectShuffle/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/PerfectShuffle/Makefile?rev=65559&r1=65558&r2=65559&view=diff ============================================================================== --- llvm/trunk/utils/PerfectShuffle/Makefile (original) +++ llvm/trunk/utils/PerfectShuffle/Makefile Thu Feb 26 13:02:23 2009 @@ -10,5 +10,9 @@ LEVEL = ../.. TOOLNAME = llvm-PerfectShuffle NO_INSTALL = 1 + +# This tool has no plugins, optimize startup time. +TOOL_NO_EXPORTS = 1 + include $(LEVEL)/Makefile.common Modified: llvm/trunk/utils/TableGen/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/Makefile?rev=65559&r1=65558&r2=65559&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/Makefile (original) +++ llvm/trunk/utils/TableGen/Makefile Thu Feb 26 13:02:23 2009 @@ -14,5 +14,8 @@ REQUIRES_EH := 1 REQUIRES_RTTI := 1 +# This tool has no plugins, optimize startup time. +TOOL_NO_EXPORTS = 1 + include $(LEVEL)/Makefile.common From sabre at nondot.org Thu Feb 26 13:08:30 2009 From: sabre at nondot.org (Chris Lattner) Date: Thu, 26 Feb 2009 19:08:30 -0000 Subject: [llvm-commits] [llvm] r65561 - /llvm/trunk/Makefile.rules Message-ID: <200902261908.n1QJ8Ucn030184@zion.cs.uiuc.edu> Author: lattner Date: Thu Feb 26 13:08:30 2009 New Revision: 65561 URL: http://llvm.org/viewvc/llvm-project?rev=65561&view=rev Log: Fix universal builds to not use -XCClinker (a libtool thing) now that libtool doesn't exist. Modified: llvm/trunk/Makefile.rules Modified: llvm/trunk/Makefile.rules URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/Makefile.rules?rev=65561&r1=65560&r2=65561&view=diff ============================================================================== --- llvm/trunk/Makefile.rules (original) +++ llvm/trunk/Makefile.rules Thu Feb 26 13:08:30 2009 @@ -480,10 +480,10 @@ endif UNIVERSAL_ARCH_OPTIONS := $(UNIVERSAL_ARCH:%=-arch %) CompileCommonOpts += $(UNIVERSAL_ARCH_OPTIONS) - Relink.Flags := $(UNIVERSAL_ARCH_OPTIONS:%=-XCClinker %) + Relink.Flags := $(UNIVERSAL_ARCH_OPTIONS) ifdef UNIVERSAL_SDK_PATH CompileCommonOpts += -isysroot $(UNIVERSAL_SDK_PATH) - Relink.Flags += -XCClinker -isysroot -XCClinker $(UNIVERSAL_SDK_PATH) + Relink.Flags += -isysroot $(UNIVERSAL_SDK_PATH) endif # Building universal cannot compute dependencies automatically. From clattner at apple.com Thu Feb 26 13:10:59 2009 From: clattner at apple.com (Chris Lattner) Date: Thu, 26 Feb 2009 11:10:59 -0800 Subject: [llvm-commits] [llvm] r65517 - in /llvm/trunk: Makefile.rules bindings/ocaml/Makefile.ocaml docs/MakefileGuide.html unittests/Makefile.unittest In-Reply-To: References: <200902260744.n1Q7iHAD027878@zion.cs.uiuc.edu> <0B3D6B0B-E7BB-4BF4-9746-8FAAD38091A2@apple.com> <913FFD62-246B-4D84-992D-CCF0C4736562@apple.com> Message-ID: On Feb 26, 2009, at 10:28 AM, Evan Cheng wrote: > Just Apple style build. plz try r65561 -Chris > > Evan > > On Feb 26, 2009, at 9:51 AM, Chris Lattner wrote: > >> >> On Feb 26, 2009, at 9:49 AM, Evan Cheng wrote: >> >>> >>> On Feb 26, 2009, at 9:43 AM, Chris Lattner wrote: >>> >>>> >>>> On Feb 26, 2009, at 9:40 AM, Evan Cheng wrote: >>>> >>>>> Other issues: >>>>> >>>>> g++ -I/private/tmp/llvmCore.roots/llvmCore~obj/obj-llvm/include - >>>>> I/ >>>>> private/tmp/llvmCore.roots/llvmCore~obj/obj-llvm/lib/Target/ >>>>> CBackend - >>>>> I/tmp/llvmCore.root\ >>>> >>>> Evan, what OS are you seeing in Makefile.config? >>> >>> It is Darwin. >> >> Does it fail for a normal build or just fail for apple-style build? >> >> -Chris >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From sabre at nondot.org Thu Feb 26 13:19:26 2009 From: sabre at nondot.org (Chris Lattner) Date: Thu, 26 Feb 2009 19:19:26 -0000 Subject: [llvm-commits] [llvm] r65564 - /llvm/trunk/test/Makefile Message-ID: <200902261919.n1QJJQHU030638@zion.cs.uiuc.edu> Author: lattner Date: Thu Feb 26 13:19:26 2009 New Revision: 65564 URL: http://llvm.org/viewvc/llvm-project?rev=65564&view=rev Log: make sure that make fully evaluates variables when determining how compile_c and friends should work. This fixes 2006-11-30-Pubnames.cpp and friends on darwin with the new -mmacosx-version-min change. Modified: llvm/trunk/test/Makefile Modified: llvm/trunk/test/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Makefile?rev=65564&r1=65563&r2=65564&view=diff ============================================================================== --- llvm/trunk/test/Makefile (original) +++ llvm/trunk/test/Makefile Thu Feb 26 13:19:26 2009 @@ -108,9 +108,9 @@ @echo 'set objdir "$(LLVM_OBJ_ROOT)/test"' >>site.tmp @echo 'set gccpath "$(CC)"' >>site.tmp @echo 'set gxxpath "$(CXX)"' >>site.tmp - @echo 'set compile_c "$(CC) $(CPP.Flags) $(CompileCommonOpts) -c "' >>site.tmp - @echo 'set compile_cxx "$(CXX) $(CPP.Flags) $(CXX.Flags) $(CompileCommonOpts) -c"' >> site.tmp - @echo 'set link "$(CXX) $(CPP.Flags) $(CXX.Flags) $(CompileCommonOpts) $(LD.Flags)"' >>site.tmp + @echo 'set compile_c "' $(CC) $(CPP.Flags) $(CompileCommonOpts) -c '"' >>site.tmp + @echo 'set compile_cxx "' $(CXX) $(CPP.Flags) $(CXX.Flags) $(CompileCommonOpts) -c '"' >> site.tmp + @echo 'set link "' $(CXX) $(CPP.Flags) $(CXX.Flags) $(CompileCommonOpts) $(LD.Flags) '"' >>site.tmp @echo 'set llvmgcc "$(LLVMGCC) $(EXTRA_OPTIONS)"' >> site.tmp @echo 'set llvmgxx "$(LLVMGCC) $(EXTRA_OPTIONS)"' >> site.tmp @echo 'set llvmgccmajvers "$(LLVMGCC_MAJVERS)"' >> site.tmp From clattner at apple.com Thu Feb 26 13:19:44 2009 From: clattner at apple.com (Chris Lattner) Date: Thu, 26 Feb 2009 11:19:44 -0800 Subject: [llvm-commits] [llvm] r65542 - /llvm/trunk/Makefile.rules In-Reply-To: <16e5fdf90902261057p5b8a008dyd877b50f382cfec2@mail.gmail.com> References: <200902261744.n1QHicvt026864@zion.cs.uiuc.edu> <16e5fdf90902261057p5b8a008dyd877b50f382cfec2@mail.gmail.com> Message-ID: <498C8FA5-41A8-4471-A708-178FD6435A8A@apple.com> On Feb 26, 2009, at 10:57 AM, Bill Wendling wrote: > Chris, > > This change is causing these errors on the buildbots. Please > investigate. Thanks, does r65564 fix the problems you are seeing? -Chris From isanbard at gmail.com Thu Feb 26 13:34:41 2009 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 26 Feb 2009 11:34:41 -0800 Subject: [llvm-commits] [llvm] r65542 - /llvm/trunk/Makefile.rules In-Reply-To: <498C8FA5-41A8-4471-A708-178FD6435A8A@apple.com> References: <200902261744.n1QHicvt026864@zion.cs.uiuc.edu> <16e5fdf90902261057p5b8a008dyd877b50f382cfec2@mail.gmail.com> <498C8FA5-41A8-4471-A708-178FD6435A8A@apple.com> Message-ID: <16e5fdf90902261134p42bff7d1s4b462960324b0b7f@mail.gmail.com> On Thu, Feb 26, 2009 at 11:19 AM, Chris Lattner wrote: > > On Feb 26, 2009, at 10:57 AM, Bill Wendling wrote: > >> Chris, >> >> This change is causing these errors on the buildbots. Please >> investigate. > > Thanks, does r65564 fix the problems you are seeing? > It does. Thanks! :-) -bw From ggreif at gmail.com Thu Feb 26 13:37:55 2009 From: ggreif at gmail.com (Gabor Greif) Date: Thu, 26 Feb 2009 19:37:55 -0000 Subject: [llvm-commits] [llvm] r65565 - /llvm/trunk/include/llvm/SymbolTableListTraits.h Message-ID: <200902261937.n1QJbt5Q031372@zion.cs.uiuc.edu> Author: ggreif Date: Thu Feb 26 13:37:54 2009 New Revision: 65565 URL: http://llvm.org/viewvc/llvm-project?rev=65565&view=rev Log: remove deleteNode definition, it is inherited in an identical fashion Modified: llvm/trunk/include/llvm/SymbolTableListTraits.h Modified: llvm/trunk/include/llvm/SymbolTableListTraits.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/SymbolTableListTraits.h?rev=65565&r1=65564&r2=65565&view=diff ============================================================================== --- llvm/trunk/include/llvm/SymbolTableListTraits.h (original) +++ llvm/trunk/include/llvm/SymbolTableListTraits.h Thu Feb 26 13:37:54 2009 @@ -51,10 +51,6 @@ TraitsClass::getListOffset()); } - void deleteNode(ValueSubClass *V) { - delete V; - } - void addNodeToList(ValueSubClass *V); void removeNodeFromList(ValueSubClass *V); void transferNodesFromList(ilist_traits &L2, From aaronngray.lists at googlemail.com Thu Feb 26 14:43:29 2009 From: aaronngray.lists at googlemail.com (Aaron Gray) Date: Thu, 26 Feb 2009 20:43:29 +0000 Subject: [llvm-commits] SVN Trunk broken on LLVMHello.dll on Cygwin platform Message-ID: <9719867c0902261243i7e8ca9c7ueeec33627bff080b@mail.gmail.com> Hi, SVN appears to be broken since yesterday... Getting the following on a '--enable-pic=no' release build :- ~~~~ llvm[3]: Linking Release Loadable Module LLVMHello.dll /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x16): und efined reference to `vtable for llvm::FunctionPass' /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x14b): un defined reference to `llvm::PassInfo::registerPass()' /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x1b2): un defined reference to `llvm::PassInfo::registerPass()' /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x1ea): un defined reference to `vtable for llvm::FunctionPass' /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x1f2): un defined reference to `llvm::Pass::~Pass()' /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x216): un defined reference to `vtable for llvm::FunctionPass' /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x22a): un defined reference to `vtable for llvm::FunctionPass' /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x232): un defined reference to `llvm::Pass::~Pass()' /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x291): un defined reference to `llvm::Value::getNameStr() const' /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x29c): un defined reference to `llvm::EscapeString(std::basic_string, std::allocator >&)' /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x2a1): un defined reference to `llvm::cerr' /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x2c3): un defined reference to `llvm::cerr' /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x2e3): un defined reference to `llvm::cerr' /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x328): un defined reference to `llvm::Statistic::RegisterStatistic()' /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x391): un defined reference to `llvm::Value::getNameStr() const' /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x39c): un defined reference to `llvm::EscapeString(std::basic_string, std::allocator >&)' /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x3a1): un defined reference to `llvm::cerr' /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x3c3): un defined reference to `llvm::cerr' /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x3e3): un defined reference to `llvm::cerr' /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x428): un defined reference to `llvm::Statistic::RegisterStatistic()' /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x1b): und efined reference to `llvm::Pass::~Pass()' /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x21b): un defined reference to `llvm::Pass::~Pass()' /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.rdata+0x70): un defined reference to `llvm::Pass::getPassName() const' /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.rdata+0x74): un defined reference to `llvm::Pass::print(std::basic_ostream >&, llvm::Module const*) const' /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.rdata+0x78): un defined reference to `llvm::FunctionPass::assignPassManager(llvm::PMStack&, llvm ::PassManagerType)' /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.rdata+0x90): un defined reference to `llvm::Pass::dumpPassStructure(unsigned int)' /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.rdata+0xa0): un defined reference to `llvm::FunctionPass::runOnModule(llvm::Module&)' /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.rdata+0xf0): un defined reference to `llvm::Pass::getPassName() const' /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.rdata+0xf4): un defined reference to `llvm::Pass::print(std::basic_ostream >&, llvm::Module const*) const' ... ~~~~ And the following on a straight debug build :- ~~~~ llvm[3]: Compiling Hello.cpp for Debug build (PIC) /usr/src/llvm-backup/lib/Transforms/Hello/Hello.cpp:1: warning: -fPIC ignored fo r target (all code is position independent) llvm[3]: Linking Debug Loadable Module LLVMHello.dll /usr/build/llvm-tst/lib/Transforms/Hello/Debug/Hello.o: In function `_ZN80_GLOBA L__N__usr_src_llvm_backup_lib_Transforms_Hello_Hello.cpp_00000000_F77F77826Hello 213runOnFunctionERN4llvm8FunctionE': /usr/src/llvm-backup/lib/Transforms/Hello/Hello.cpp:53: undefined reference to ` llvm::EscapeString(std::basic_string, std::allocato r >&)' /usr/src/llvm-backup/lib/Transforms/Hello/Hello.cpp:54: undefined reference to ` llvm::cerr' /usr/build/llvm-tst/lib/Transforms/Hello/Debug/Hello.o: In function `_ZN80_GLOBA L__N__usr_src_llvm_backup_lib_Transforms_Hello_Hello.cpp_00000000_F77F77825Hello 13runOnFunctionERN4llvm8FunctionE': /usr/src/llvm-backup/lib/Transforms/Hello/Hello.cpp:34: undefined reference to ` llvm::EscapeString(std::basic_string, std::allocato r >&)' /usr/src/llvm-backup/lib/Transforms/Hello/Hello.cpp:35: undefined reference to ` llvm::cerr' /usr/build/llvm-tst/lib/Transforms/Hello/Debug/Hello.o: In function `_ZSt17__ver ify_groupingPKcjRKSs': /usr/gcc-4.2.2/lib/gcc/i686-pc-cygwin/4.2.2/../../../../include/c++/4.2.2/bits/l ocale_facets.tcc:2569: undefined reference to `llvm::PassInfo::registerPass()' /usr/gcc-4.2.2/lib/gcc/i686-pc-cygwin/4.2.2/../../../../include/c++/4.2.2/bits/l ocale_facets.tcc:2570: undefined reference to `llvm::Pass::getPassName() const' /usr/gcc-4.2.2/lib/gcc/i686-pc-cygwin/4.2.2/../../../../include/c++/4.2.2/bits/l ocale_facets.tcc:2575: undefined reference to `llvm::Pass::print(std::basic_ostr eam >&, llvm::Module const*) const' /usr/gcc-4.2.2/lib/gcc/i686-pc-cygwin/4.2.2/../../../../include/c++/4.2.2/bits/l ocale_facets.tcc:2575: undefined reference to `llvm::FunctionPass::assignPassMan ager(llvm::PMStack&, llvm::PassManagerType)' /usr/gcc-4.2.2/lib/gcc/i686-pc-cygwin/4.2.2/../../../../include/c++/4.2.2/bits/l ocale_facets.tcc:2576: undefined reference to `llvm::Pass::dumpPassStructure(uns igned int)' /usr/gcc-4.2.2/lib/gcc/i686-pc-cygwin/4.2.2/../../../../include/c++/4.2.2/bits/l ocale_facets.tcc:2576: undefined reference to `llvm::FunctionPass::runOnModule(l lvm::Module&)' egisterPassIN80_GLOBAL__N__usr_src_llvm_backup_lib_Transforms_Hello_Hello.cpp_00 000000_F77F77825HelloEEC1EPKcS5_bb': /usr/src/llvm-backup/include/llvm/PassSupport.h:175: undefined reference to `llv m::Pass::getPassName() const' /usr/src/llvm-backup/include/llvm/PassSupport.h:175: undefined reference to `llv m::Pass::print(std::basic_ostream >&, llvm::Module const*) const' ... ~~~~ Aaron -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090226/7339154a/attachment.html From dalej at apple.com Thu Feb 26 15:40:31 2009 From: dalej at apple.com (Dale Johannesen) Date: Thu, 26 Feb 2009 21:40:31 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r65575 - /llvm-gcc-4.2/trunk/gcc/testsuite/g++.old-deja/g++.pt/const2.C Message-ID: <200902262140.n1QLeVUk003310@zion.cs.uiuc.edu> Author: johannes Date: Thu Feb 26 15:40:31 2009 New Revision: 65575 URL: http://llvm.org/viewvc/llvm-project?rev=65575&view=rev Log: Revert 50419. This test wasn't needed with some earlier versions of Darwin linkers, but now it is again. Modified: llvm-gcc-4.2/trunk/gcc/testsuite/g++.old-deja/g++.pt/const2.C Modified: llvm-gcc-4.2/trunk/gcc/testsuite/g++.old-deja/g++.pt/const2.C URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/g%2B%2B.old-deja/g%2B%2B.pt/const2.C?rev=65575&r1=65574&r2=65575&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/g++.old-deja/g++.pt/const2.C (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/g++.old-deja/g++.pt/const2.C Thu Feb 26 15:40:31 2009 @@ -1,7 +1,8 @@ // { dg-do link } // This test should get a linker error for the reference to A::i. // { dg-error "i" "" { target *-*-* } 0 } -// LLVM LOCAL remove extra check +// APPLE LOCAL 5317196 +// { dg-error ".*" "" { target *-*-darwin* } 0 } template struct B { static const int i = 3; }; template struct A { static const int i = B::i; }; From sabre at nondot.org Thu Feb 26 16:33:38 2009 From: sabre at nondot.org (Chris Lattner) Date: Thu, 26 Feb 2009 22:33:38 -0000 Subject: [llvm-commits] [llvm] r65579 - /llvm/trunk/docs/ReleaseNotes.html Message-ID: <200902262233.n1QMXctg005286@zion.cs.uiuc.edu> Author: lattner Date: Thu Feb 26 16:33:38 2009 New Revision: 65579 URL: http://llvm.org/viewvc/llvm-project?rev=65579&view=rev Log: drop some un-edited text for pure and ldc in here. Modified: llvm/trunk/docs/ReleaseNotes.html Modified: llvm/trunk/docs/ReleaseNotes.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ReleaseNotes.html?rev=65579&r1=65578&r2=65579&view=diff ============================================================================== --- llvm/trunk/docs/ReleaseNotes.html (original) +++ llvm/trunk/docs/ReleaseNotes.html Thu Feb 26 16:33:38 2009 @@ -13,6 +13,7 @@
    1. Introduction
    2. Sub-project Status Update
    3. +
    4. External Projects Using LLVM 2.5
    5. What's New in LLVM?
    6. Installation Instructions
    7. Portability and Supported Platforms
    8. @@ -61,6 +62,8 @@ one MBB to another debug info for optimized code interpreter + libffi + postalloc scheduler: anti dependence breaking, hazard recognizer? + --> + + + + +
      +Pure +
      + +
      +

      +http://pure-lang.googlecode.com/ +

      + +

      +Pure is an algebraic/functional programming language based on term rewriting. +Programs are collections of equations which are used to evaluate expressions in +a symbolic fashion. Pure offers dynamic typing, eager and lazy evaluation, +lexical closures, a hygienic macro system (also based on term rewriting), +built-in list and matrix support (including list and matrix comprehensions) and +an easy-to-use C interface. The interpreter uses LLVM as a backend to + JIT-compile Pure programs to fast native code.

      + +

      In addition to the usual algebraic data structures, Pure also has +MATLAB-style matrices in order to support numeric computations and signal +processing in an efficient way. Pure is mainly aimed at mathematical +applications right now, but it has been designed as a general purpose language. +The dynamic interpreter environment and the C interface make it possible to use +it as a kind of functional scripting language for many application areas. +

      +
      + + + + + +
      +

      +http://www.dsource.org/projects/ldc +

      + +

      +I'd like to inform that the LDC project (LLVM D +Compiler) is working with release 2.5 of LLVM. In fact we've required +2.5 in our trunk since the release was branched. +The improvements in 2.5 have fixed a lot of problems with LDC, more +specifically the new inline asm constraints, better debug info +support, general bugfixes :) and better x86-64 support have allowed +some major improvements in LDC, getting us much closer to being as +fully featured as the original DMD compiler from DigitalMars. +

      +
      + +
      @@ -243,7 +305,7 @@ fastisel + exception handling vector widening <3 x float> -> <4 x float> arm port improvements? arm jit encoding stuff, constant island support? -JIT TLS support on x86-32. +JIT TLS support on x86-32 but not x86-64. mem2reg now faster on code with huge basic blocks stack protectors/stack canaries, -fstack-protector, controllable on a per-function basis with attributes. @@ -254,13 +316,12 @@ DebugInfoBuilder gone. asmprinters seperate from targets for jits PBQP register allocator now supports register coalescing. -JIT supports exceptions on linux/x86-64. +JIT supports exceptions on linux/x86-64 and linux/x86-64. integer overflow intrinsics for [us](add/sub/mul). Supported on all targets, but only generates efficient code on x86. X86 backend now supports -disable-mmx. noalias attribute on return value indicates that function returns new memory (e.g. malloc). -postalloc scheduler: anti dependence breaking, hazard recognizer? llvmc2 renamed to llvmc Jump threading more powerful: it is iterative, handles threading based on values with fully redundant and partially redundant loads. From isanbard at gmail.com Thu Feb 26 16:59:30 2009 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 26 Feb 2009 22:59:30 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r65581 - /llvm-gcc-4.2/branches/Apple/Dib/gcc/testsuite/g++.old-deja/g++.pt/const2.C Message-ID: <200902262259.n1QMxUJO006118@zion.cs.uiuc.edu> Author: void Date: Thu Feb 26 16:59:30 2009 New Revision: 65581 URL: http://llvm.org/viewvc/llvm-project?rev=65581&view=rev Log: Merge r65575 into Dib: Revert 50419. This test wasn't needed with some earlier versions of Darwin linkers, but now it is again. Modified: llvm-gcc-4.2/branches/Apple/Dib/gcc/testsuite/g++.old-deja/g++.pt/const2.C Modified: llvm-gcc-4.2/branches/Apple/Dib/gcc/testsuite/g++.old-deja/g++.pt/const2.C URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Dib/gcc/testsuite/g%2B%2B.old-deja/g%2B%2B.pt/const2.C?rev=65581&r1=65580&r2=65581&view=diff ============================================================================== --- llvm-gcc-4.2/branches/Apple/Dib/gcc/testsuite/g++.old-deja/g++.pt/const2.C (original) +++ llvm-gcc-4.2/branches/Apple/Dib/gcc/testsuite/g++.old-deja/g++.pt/const2.C Thu Feb 26 16:59:30 2009 @@ -1,7 +1,8 @@ // { dg-do link } // This test should get a linker error for the reference to A::i. // { dg-error "i" "" { target *-*-* } 0 } -// LLVM LOCAL remove extra check +// APPLE LOCAL 5317196 +// { dg-error ".*" "" { target *-*-darwin* } 0 } template struct B { static const int i = 3; }; template struct A { static const int i = B::i; }; From isanbard at gmail.com Thu Feb 26 17:39:22 2009 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 26 Feb 2009 23:39:22 -0000 Subject: [llvm-commits] [llvm] r65588 - in /llvm/branches/Apple/Dib: lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86InstrSSE.td test/CodeGen/X86/vec_shuffle-12.ll test/CodeGen/X86/vec_shuffle-13.ll test/CodeGen/X86/vec_shuffle-2.ll test/CodeGen/X86/vec_shuffle-21.ll test/CodeGen/X86/vec_shuffle-28.ll test/CodeGen/X86/vec_shuffle-29.ll Message-ID: <200902262339.n1QNdNqW007810@zion.cs.uiuc.edu> Author: void Date: Thu Feb 26 17:39:22 2009 New Revision: 65588 URL: http://llvm.org/viewvc/llvm-project?rev=65588&view=rev Log: Merge r65311 into Dib: Generate better code for v8i16 shuffles on SSE2 Generate better code for v16i8 shuffles on SSE2 (avoids stack) Generate pshufb for v8i16 and v16i8 shuffles on SSSE3 where it is fewer uops. Document the shuffle matching logic and add some FIXMEs for later further cleanups. New tests that test the above. Examples: New: _shuf2: pextrw $7, %xmm0, %eax punpcklqdq %xmm1, %xmm0 pshuflw $128, %xmm0, %xmm0 pinsrw $2, %eax, %xmm0 Old: _shuf2: pextrw $2, %xmm0, %eax pextrw $7, %xmm0, %ecx pinsrw $2, %ecx, %xmm0 pinsrw $3, %eax, %xmm0 movd %xmm1, %eax pinsrw $4, %eax, %xmm0 ret ========= New: _shuf4: punpcklqdq %xmm1, %xmm0 pshufb LCPI1_0, %xmm0 Old: _shuf4: pextrw $3, %xmm0, %eax movsd %xmm1, %xmm0 pextrw $3, %xmm1, %ecx pinsrw $4, %ecx, %xmm0 pinsrw $5, %eax, %xmm0 ======== New: _shuf1: pushl %ebx pushl %edi pushl %esi pextrw $1, %xmm0, %eax rolw $8, %ax movd %xmm0, %ecx rolw $8, %cx pextrw $5, %xmm0, %edx pextrw $4, %xmm0, %esi pextrw $3, %xmm0, %edi pextrw $2, %xmm0, %ebx movaps %xmm0, %xmm1 pinsrw $0, %ecx, %xmm1 pinsrw $1, %eax, %xmm1 rolw $8, %bx pinsrw $2, %ebx, %xmm1 rolw $8, %di pinsrw $3, %edi, %xmm1 rolw $8, %si pinsrw $4, %esi, %xmm1 rolw $8, %dx pinsrw $5, %edx, %xmm1 pextrw $7, %xmm0, %eax rolw $8, %ax movaps %xmm1, %xmm0 pinsrw $7, %eax, %xmm0 popl %esi popl %edi popl %ebx ret Old: _shuf1: subl $252, %esp movaps %xmm0, (%esp) movaps %xmm0, 16(%esp) movaps %xmm0, 32(%esp) movaps %xmm0, 48(%esp) movaps %xmm0, 64(%esp) movaps %xmm0, 80(%esp) movaps %xmm0, 96(%esp) movaps %xmm0, 224(%esp) movaps %xmm0, 208(%esp) movaps %xmm0, 192(%esp) movaps %xmm0, 176(%esp) movaps %xmm0, 160(%esp) movaps %xmm0, 144(%esp) movaps %xmm0, 128(%esp) movaps %xmm0, 112(%esp) movzbl 14(%esp), %eax movd %eax, %xmm1 movzbl 22(%esp), %eax movd %eax, %xmm2 punpcklbw %xmm1, %xmm2 movzbl 42(%esp), %eax movd %eax, %xmm1 movzbl 50(%esp), %eax movd %eax, %xmm3 punpcklbw %xmm1, %xmm3 punpcklbw %xmm2, %xmm3 movzbl 77(%esp), %eax movd %eax, %xmm1 movzbl 84(%esp), %eax movd %eax, %xmm2 punpcklbw %xmm1, %xmm2 movzbl 104(%esp), %eax movd %eax, %xmm1 punpcklbw %xmm1, %xmm0 punpcklbw %xmm2, %xmm0 movaps %xmm0, %xmm1 punpcklbw %xmm3, %xmm1 movzbl 127(%esp), %eax movd %eax, %xmm0 movzbl 135(%esp), %eax movd %eax, %xmm2 punpcklbw %xmm0, %xmm2 movzbl 155(%esp), %eax movd %eax, %xmm0 movzbl 163(%esp), %eax movd %eax, %xmm3 punpcklbw %xmm0, %xmm3 punpcklbw %xmm2, %xmm3 movzbl 188(%esp), %eax movd %eax, %xmm0 movzbl 197(%esp), %eax movd %eax, %xmm2 punpcklbw %xmm0, %xmm2 movzbl 217(%esp), %eax movd %eax, %xmm4 movzbl 225(%esp), %eax movd %eax, %xmm0 punpcklbw %xmm4, %xmm0 punpcklbw %xmm2, %xmm0 punpcklbw %xmm3, %xmm0 punpcklbw %xmm1, %xmm0 addl $252, %esp ret Modified: llvm/branches/Apple/Dib/lib/Target/X86/X86ISelLowering.cpp llvm/branches/Apple/Dib/lib/Target/X86/X86ISelLowering.h llvm/branches/Apple/Dib/lib/Target/X86/X86InstrSSE.td llvm/branches/Apple/Dib/test/CodeGen/X86/vec_shuffle-12.ll llvm/branches/Apple/Dib/test/CodeGen/X86/vec_shuffle-13.ll llvm/branches/Apple/Dib/test/CodeGen/X86/vec_shuffle-2.ll llvm/branches/Apple/Dib/test/CodeGen/X86/vec_shuffle-21.ll llvm/branches/Apple/Dib/test/CodeGen/X86/vec_shuffle-28.ll llvm/branches/Apple/Dib/test/CodeGen/X86/vec_shuffle-29.ll Modified: llvm/branches/Apple/Dib/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/X86/X86ISelLowering.cpp?rev=65588&r1=65587&r2=65588&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/branches/Apple/Dib/lib/Target/X86/X86ISelLowering.cpp Thu Feb 26 17:39:22 2009 @@ -2719,38 +2719,6 @@ return Mask; } -/// isPSHUFHW_PSHUFLWMask - true if the specified VECTOR_SHUFFLE operand -/// specifies a 8 element shuffle that can be broken into a pair of -/// PSHUFHW and PSHUFLW. -static bool isPSHUFHW_PSHUFLWMask(SDNode *N) { - assert(N->getOpcode() == ISD::BUILD_VECTOR); - - if (N->getNumOperands() != 8) - return false; - - // Lower quadword shuffled. - for (unsigned i = 0; i != 4; ++i) { - SDValue Arg = N->getOperand(i); - if (Arg.getOpcode() == ISD::UNDEF) continue; - assert(isa(Arg) && "Invalid VECTOR_SHUFFLE mask!"); - unsigned Val = cast(Arg)->getZExtValue(); - if (Val >= 4) - return false; - } - - // Upper quadword shuffled. - for (unsigned i = 4; i != 8; ++i) { - SDValue Arg = N->getOperand(i); - if (Arg.getOpcode() == ISD::UNDEF) continue; - assert(isa(Arg) && "Invalid VECTOR_SHUFFLE mask!"); - unsigned Val = cast(Arg)->getZExtValue(); - if (Val < 4 || Val > 7) - return false; - } - - return true; -} - /// CommuteVectorShuffle - Swap vector_shuffle operands as well as /// values in ther permute mask. static SDValue CommuteVectorShuffle(SDValue Op, SDValue &V1, @@ -3573,264 +3541,389 @@ return SDValue(); } +// v8i16 shuffles - Prefer shuffles in the following order: +// 1. [all] pshuflw, pshufhw, optional move +// 2. [ssse3] 1 x pshufb +// 3. [ssse3] 2 x pshufb + 1 x por +// 4. [all] mov + pshuflw + pshufhw + N x (pextrw + pinsrw) static SDValue LowerVECTOR_SHUFFLEv8i16(SDValue V1, SDValue V2, SDValue PermMask, SelectionDAG &DAG, - TargetLowering &TLI, DebugLoc dl) { - SDValue NewV; - MVT MaskVT = MVT::getIntVectorWithNumElements(8); - MVT MaskEVT = MaskVT.getVectorElementType(); - MVT PtrVT = TLI.getPointerTy(); + X86TargetLowering &TLI, DebugLoc dl) { SmallVector MaskElts(PermMask.getNode()->op_begin(), PermMask.getNode()->op_end()); + SmallVector MaskVals; - // First record which half of which vector the low elements come from. - SmallVector LowQuad(4); - for (unsigned i = 0; i < 4; ++i) { + // Determine if more than 1 of the words in each of the low and high quadwords + // of the result come from the same quadword of one of the two inputs. Undef + // mask values count as coming from any quadword, for better codegen. + SmallVector LoQuad(4); + SmallVector HiQuad(4); + BitVector InputQuads(4); + for (unsigned i = 0; i < 8; ++i) { + SmallVectorImpl &Quad = i < 4 ? LoQuad : HiQuad; SDValue Elt = MaskElts[i]; - if (Elt.getOpcode() == ISD::UNDEF) + int EltIdx = Elt.getOpcode() == ISD::UNDEF ? -1 : + cast(Elt)->getZExtValue(); + MaskVals.push_back(EltIdx); + if (EltIdx < 0) { + ++Quad[0]; + ++Quad[1]; + ++Quad[2]; + ++Quad[3]; continue; - unsigned EltIdx = cast(Elt)->getZExtValue(); - int QuadIdx = EltIdx / 4; - ++LowQuad[QuadIdx]; + } + ++Quad[EltIdx / 4]; + InputQuads.set(EltIdx / 4); } - int BestLowQuad = -1; + int BestLoQuad = -1; unsigned MaxQuad = 1; for (unsigned i = 0; i < 4; ++i) { - if (LowQuad[i] > MaxQuad) { - BestLowQuad = i; - MaxQuad = LowQuad[i]; + if (LoQuad[i] > MaxQuad) { + BestLoQuad = i; + MaxQuad = LoQuad[i]; } } - // Record which half of which vector the high elements come from. - SmallVector HighQuad(4); - for (unsigned i = 4; i < 8; ++i) { - SDValue Elt = MaskElts[i]; - if (Elt.getOpcode() == ISD::UNDEF) - continue; - unsigned EltIdx = cast(Elt)->getZExtValue(); - int QuadIdx = EltIdx / 4; - ++HighQuad[QuadIdx]; - } - - int BestHighQuad = -1; + int BestHiQuad = -1; MaxQuad = 1; for (unsigned i = 0; i < 4; ++i) { - if (HighQuad[i] > MaxQuad) { - BestHighQuad = i; - MaxQuad = HighQuad[i]; + if (HiQuad[i] > MaxQuad) { + BestHiQuad = i; + MaxQuad = HiQuad[i]; } } - // If it's possible to sort parts of either half with PSHUF{H|L}W, then do it. - if (BestLowQuad != -1 || BestHighQuad != -1) { - // First sort the 4 chunks in order using shufpd. - SmallVector MaskVec; - - if (BestLowQuad != -1) - MaskVec.push_back(DAG.getConstant(BestLowQuad, MVT::i32)); - else - MaskVec.push_back(DAG.getConstant(0, MVT::i32)); - - if (BestHighQuad != -1) - MaskVec.push_back(DAG.getConstant(BestHighQuad, MVT::i32)); - else - MaskVec.push_back(DAG.getConstant(1, MVT::i32)); + // For SSSE3, If all 8 words of the result come from only 1 quadword of each + // of the two input vectors, shuffle them into one input vector so only a + // single pshufb instruction is necessary. If There are more than 2 input + // quads, disable the next transformation since it does not help SSSE3. + bool V1Used = InputQuads[0] || InputQuads[1]; + bool V2Used = InputQuads[2] || InputQuads[3]; + if (TLI.getSubtarget()->hasSSSE3()) { + if (InputQuads.count() == 2 && V1Used && V2Used) { + BestLoQuad = InputQuads.find_first(); + BestHiQuad = InputQuads.find_next(BestLoQuad); + } + if (InputQuads.count() > 2) { + BestLoQuad = -1; + BestHiQuad = -1; + } + } - SDValue Mask= DAG.getNode(ISD::BUILD_VECTOR, dl, MVT::v2i32, &MaskVec[0],2); + // If BestLoQuad or BestHiQuad are set, shuffle the quads together and update + // the shuffle mask. If a quad is scored as -1, that means that it contains + // words from all 4 input quadwords. + SDValue NewV; + if (BestLoQuad >= 0 || BestHiQuad >= 0) { + SmallVector MaskV; + MaskV.push_back(DAG.getConstant(BestLoQuad < 0 ? 0 : BestLoQuad, MVT::i64)); + MaskV.push_back(DAG.getConstant(BestHiQuad < 0 ? 1 : BestHiQuad, MVT::i64)); + SDValue Mask = DAG.getNode(ISD::BUILD_VECTOR, dl, MVT::v2i64, &MaskV[0], 2); + NewV = DAG.getNode(ISD::VECTOR_SHUFFLE, dl, MVT::v2i64, - DAG.getNode(ISD::BIT_CONVERT, dl, MVT::v2i64, V1), - DAG.getNode(ISD::BIT_CONVERT, dl, MVT::v2i64, V2), Mask); + DAG.getNode(ISD::BIT_CONVERT, dl, MVT::v2i64, V1), + DAG.getNode(ISD::BIT_CONVERT, dl, MVT::v2i64, V2), Mask); NewV = DAG.getNode(ISD::BIT_CONVERT, dl, MVT::v8i16, NewV); - // Now sort high and low parts separately. - BitVector InOrder(8); - if (BestLowQuad != -1) { - // Sort lower half in order using PSHUFLW. - MaskVec.clear(); - bool AnyOutOrder = false; - - for (unsigned i = 0; i != 4; ++i) { - SDValue Elt = MaskElts[i]; - if (Elt.getOpcode() == ISD::UNDEF) { - MaskVec.push_back(Elt); - InOrder.set(i); - } else { - unsigned EltIdx = cast(Elt)->getZExtValue(); - if (EltIdx != i) - AnyOutOrder = true; - - MaskVec.push_back(DAG.getConstant(EltIdx % 4, MaskEVT)); - - // If this element is in the right place after this shuffle, then - // remember it. - if ((int)(EltIdx / 4) == BestLowQuad) - InOrder.set(i); - } - } - if (AnyOutOrder) { - for (unsigned i = 4; i != 8; ++i) - MaskVec.push_back(DAG.getConstant(i, MaskEVT)); - SDValue Mask = DAG.getNode(ISD::BUILD_VECTOR, dl, MaskVT, - &MaskVec[0], 8); - NewV = DAG.getNode(ISD::VECTOR_SHUFFLE, dl, MVT::v8i16, - NewV, NewV, Mask); - } + // Rewrite the MaskVals and assign NewV to V1 if NewV now contains all the + // source words for the shuffle, to aid later transformations. + bool AllWordsInNewV = true; + for (unsigned i = 0; i != 8; ++i) { + int idx = MaskVals[i]; + if (idx < 0 || (idx/4) == BestLoQuad || (idx/4) == BestHiQuad) + continue; + AllWordsInNewV = false; + break; } - if (BestHighQuad != -1) { - // Sort high half in order using PSHUFHW if possible. - MaskVec.clear(); - - for (unsigned i = 0; i != 4; ++i) - MaskVec.push_back(DAG.getConstant(i, MaskEVT)); - - bool AnyOutOrder = false; - for (unsigned i = 4; i != 8; ++i) { - SDValue Elt = MaskElts[i]; - if (Elt.getOpcode() == ISD::UNDEF) { - MaskVec.push_back(Elt); - InOrder.set(i); - } else { - unsigned EltIdx = cast(Elt)->getZExtValue(); - if (EltIdx != i) - AnyOutOrder = true; - - MaskVec.push_back(DAG.getConstant((EltIdx % 4) + 4, MaskEVT)); - - // If this element is in the right place after this shuffle, then - // remember it. - if ((int)(EltIdx / 4) == BestHighQuad) - InOrder.set(i); - } - } - - if (AnyOutOrder) { - SDValue Mask = DAG.getNode(ISD::BUILD_VECTOR, dl, - MaskVT, &MaskVec[0], 8); - NewV = DAG.getNode(ISD::VECTOR_SHUFFLE, dl, MVT::v8i16, - NewV, NewV, Mask); - } + bool pshuflw = AllWordsInNewV, pshufhw = AllWordsInNewV; + if (AllWordsInNewV) { + for (int i = 0; i != 8; ++i) { + int idx = MaskVals[i]; + if (idx < 0) + continue; + idx = MaskVals[i] = (idx / 4) == BestLoQuad ? (idx & 3) : (idx & 3) + 4; + if ((idx != i) && idx < 4) + pshufhw = false; + if ((idx != i) && idx > 3) + pshuflw = false; + } + V1 = NewV; + V2Used = false; + BestLoQuad = 0; + BestHiQuad = 1; + } + + // If we've eliminated the use of V2, and the new mask is a pshuflw or + // pshufhw, that's as cheap as it gets. Return the new shuffle. + if (pshufhw || pshuflw) { + MaskV.clear(); + for (unsigned i = 0; i != 8; ++i) + MaskV.push_back((MaskVals[i] < 0) ? DAG.getUNDEF(MVT::i16) + : DAG.getConstant(MaskVals[i], + MVT::i16)); + return DAG.getNode(ISD::VECTOR_SHUFFLE, dl, MVT::v8i16, NewV, + DAG.getUNDEF(MVT::v8i16), + DAG.getNode(ISD::BUILD_VECTOR, dl, MVT::v8i16, + &MaskV[0], 8)); } - - // The other elements are put in the right place using pextrw and pinsrw. + } + + // If we have SSSE3, and all words of the result are from 1 input vector, + // case 2 is generated, otherwise case 3 is generated. If no SSSE3 + // is present, fall back to case 4. + if (TLI.getSubtarget()->hasSSSE3()) { + SmallVector pshufbMask; + + // If we have elements from both input vectors, set the high bit of the + // shuffle mask element to zero out elements that come from V2 in the V1 + // mask, and elements that come from V1 in the V2 mask, so that the two + // results can be OR'd together. + bool TwoInputs = V1Used && V2Used; for (unsigned i = 0; i != 8; ++i) { - if (InOrder[i]) + int EltIdx = MaskVals[i] * 2; + if (TwoInputs && (EltIdx >= 16)) { + pshufbMask.push_back(DAG.getConstant(0x80, MVT::i8)); + pshufbMask.push_back(DAG.getConstant(0x80, MVT::i8)); continue; - SDValue Elt = MaskElts[i]; - if (Elt.getOpcode() == ISD::UNDEF) + } + pshufbMask.push_back(DAG.getConstant(EltIdx, MVT::i8)); + pshufbMask.push_back(DAG.getConstant(EltIdx+1, MVT::i8)); + } + V1 = DAG.getNode(ISD::BIT_CONVERT, dl, MVT::v16i8, V1); + V1 = DAG.getNode(X86ISD::PSHUFB, dl, MVT::v16i8, V1, + DAG.getNode(ISD::BUILD_VECTOR, dl, + MVT::v16i8, &pshufbMask[0], 16)); + if (!TwoInputs) + return DAG.getNode(ISD::BIT_CONVERT, dl, MVT::v8i16, V1); + + // Calculate the shuffle mask for the second input, shuffle it, and + // OR it with the first shuffled input. + pshufbMask.clear(); + for (unsigned i = 0; i != 8; ++i) { + int EltIdx = MaskVals[i] * 2; + if (EltIdx < 16) { + pshufbMask.push_back(DAG.getConstant(0x80, MVT::i8)); + pshufbMask.push_back(DAG.getConstant(0x80, MVT::i8)); continue; - unsigned EltIdx = cast(Elt)->getZExtValue(); - SDValue ExtOp = (EltIdx < 8) - ? DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, MVT::i16, V1, - DAG.getConstant(EltIdx, PtrVT)) - : DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, MVT::i16, V2, - DAG.getConstant(EltIdx - 8, PtrVT)); - NewV = DAG.getNode(ISD::INSERT_VECTOR_ELT, dl, MVT::v8i16, NewV, ExtOp, - DAG.getConstant(i, PtrVT)); - } - - return NewV; - } - - // PSHUF{H|L}W are not used. Lower into extracts and inserts but try to use as - // few as possible. First, let's find out how many elements are already in the - // right order. - unsigned V1InOrder = 0; - unsigned V1FromV1 = 0; - unsigned V2InOrder = 0; - unsigned V2FromV2 = 0; - SmallVector V1Elts; - SmallVector V2Elts; - for (unsigned i = 0; i < 8; ++i) { - SDValue Elt = MaskElts[i]; - if (Elt.getOpcode() == ISD::UNDEF) { - V1Elts.push_back(Elt); - V2Elts.push_back(Elt); - ++V1InOrder; - ++V2InOrder; - continue; + } + pshufbMask.push_back(DAG.getConstant(EltIdx - 16, MVT::i8)); + pshufbMask.push_back(DAG.getConstant(EltIdx - 15, MVT::i8)); } - unsigned EltIdx = cast(Elt)->getZExtValue(); - if (EltIdx == i) { - V1Elts.push_back(Elt); - V2Elts.push_back(DAG.getConstant(i+8, MaskEVT)); - ++V1InOrder; - } else if (EltIdx == i+8) { - V1Elts.push_back(Elt); - V2Elts.push_back(DAG.getConstant(i, MaskEVT)); - ++V2InOrder; - } else if (EltIdx < 8) { - V1Elts.push_back(Elt); - V2Elts.push_back(DAG.getConstant(EltIdx+8, MaskEVT)); - ++V1FromV1; - } else { - V1Elts.push_back(Elt); - V2Elts.push_back(DAG.getConstant(EltIdx-8, MaskEVT)); - ++V2FromV2; + V2 = DAG.getNode(ISD::BIT_CONVERT, dl, MVT::v16i8, V2); + V2 = DAG.getNode(X86ISD::PSHUFB, dl, MVT::v16i8, V2, + DAG.getNode(ISD::BUILD_VECTOR, dl, + MVT::v16i8, &pshufbMask[0], 16)); + V1 = DAG.getNode(ISD::OR, dl, MVT::v16i8, V1, V2); + return DAG.getNode(ISD::BIT_CONVERT, dl, MVT::v8i16, V1); + } + + // If BestLoQuad >= 0, generate a pshuflw to put the low elements in order, + // and update MaskVals with new element order. + BitVector InOrder(8); + if (BestLoQuad >= 0) { + SmallVector MaskV; + for (int i = 0; i != 4; ++i) { + int idx = MaskVals[i]; + if (idx < 0) { + MaskV.push_back(DAG.getUNDEF(MVT::i16)); + InOrder.set(i); + } else if ((idx / 4) == BestLoQuad) { + MaskV.push_back(DAG.getConstant(idx & 3, MVT::i16)); + InOrder.set(i); + } else { + MaskV.push_back(DAG.getUNDEF(MVT::i16)); + } + } + for (unsigned i = 4; i != 8; ++i) + MaskV.push_back(DAG.getConstant(i, MVT::i16)); + NewV = DAG.getNode(ISD::VECTOR_SHUFFLE, dl, MVT::v8i16, NewV, + DAG.getUNDEF(MVT::v8i16), + DAG.getNode(ISD::BUILD_VECTOR, dl, + MVT::v8i16, &MaskV[0], 8)); + } + + // If BestHi >= 0, generate a pshufhw to put the high elements in order, + // and update MaskVals with the new element order. + if (BestHiQuad >= 0) { + SmallVector MaskV; + for (unsigned i = 0; i != 4; ++i) + MaskV.push_back(DAG.getConstant(i, MVT::i16)); + for (unsigned i = 4; i != 8; ++i) { + int idx = MaskVals[i]; + if (idx < 0) { + MaskV.push_back(DAG.getUNDEF(MVT::i16)); + InOrder.set(i); + } else if ((idx / 4) == BestHiQuad) { + MaskV.push_back(DAG.getConstant((idx & 3) + 4, MVT::i16)); + InOrder.set(i); + } else { + MaskV.push_back(DAG.getUNDEF(MVT::i16)); + } } + NewV = DAG.getNode(ISD::VECTOR_SHUFFLE, dl, MVT::v8i16, NewV, + DAG.getUNDEF(MVT::v8i16), + DAG.getNode(ISD::BUILD_VECTOR, dl, + MVT::v8i16, &MaskV[0], 8)); } - - if (V2InOrder > V1InOrder) { - PermMask = CommuteVectorShuffleMask(PermMask, DAG, dl); - std::swap(V1, V2); - std::swap(V1Elts, V2Elts); - std::swap(V1FromV1, V2FromV2); + + // In case BestHi & BestLo were both -1, which means each quadword has a word + // from each of the four input quadwords, calculate the InOrder bitvector now + // before falling through to the insert/extract cleanup. + if (BestLoQuad == -1 && BestHiQuad == -1) { + NewV = V1; + for (int i = 0; i != 8; ++i) + if (MaskVals[i] < 0 || MaskVals[i] == i) + InOrder.set(i); } + + // The other elements are put in the right place using pextrw and pinsrw. + for (unsigned i = 0; i != 8; ++i) { + if (InOrder[i]) + continue; + int EltIdx = MaskVals[i]; + if (EltIdx < 0) + continue; + SDValue ExtOp = (EltIdx < 8) + ? DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, MVT::i16, V1, + DAG.getIntPtrConstant(EltIdx)) + : DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, MVT::i16, V2, + DAG.getIntPtrConstant(EltIdx - 8)); + NewV = DAG.getNode(ISD::INSERT_VECTOR_ELT, dl, MVT::v8i16, NewV, ExtOp, + DAG.getIntPtrConstant(i)); + } + return NewV; +} - if ((V1FromV1 + V1InOrder) != 8) { - // Some elements are from V2. - if (V1FromV1) { - // If there are elements that are from V1 but out of place, - // then first sort them in place - SmallVector MaskVec; - for (unsigned i = 0; i < 8; ++i) { - SDValue Elt = V1Elts[i]; - if (Elt.getOpcode() == ISD::UNDEF) { - MaskVec.push_back(DAG.getUNDEF(MaskEVT)); - continue; - } - unsigned EltIdx = cast(Elt)->getZExtValue(); - if (EltIdx >= 8) - MaskVec.push_back(DAG.getUNDEF(MaskEVT)); - else - MaskVec.push_back(DAG.getConstant(EltIdx, MaskEVT)); +// v16i8 shuffles - Prefer shuffles in the following order: +// 1. [ssse3] 1 x pshufb +// 2. [ssse3] 2 x pshufb + 1 x por +// 3. [all] v8i16 shuffle + N x pextrw + rotate + pinsrw +static +SDValue LowerVECTOR_SHUFFLEv16i8(SDValue V1, SDValue V2, + SDValue PermMask, SelectionDAG &DAG, + X86TargetLowering &TLI, DebugLoc dl) { + SmallVector MaskElts(PermMask.getNode()->op_begin(), + PermMask.getNode()->op_end()); + SmallVector MaskVals; + + // If we have SSSE3, case 1 is generated when all result bytes come from + // one of the inputs. Otherwise, case 2 is generated. If no SSSE3 is + // present, fall back to case 3. + // FIXME: kill V2Only once shuffles are canonizalized by getNode. + bool V1Only = true; + bool V2Only = true; + for (unsigned i = 0; i < 16; ++i) { + SDValue Elt = MaskElts[i]; + int EltIdx = Elt.getOpcode() == ISD::UNDEF ? -1 : + cast(Elt)->getZExtValue(); + MaskVals.push_back(EltIdx); + if (EltIdx < 0) + continue; + if (EltIdx < 16) + V2Only = false; + else + V1Only = false; + } + + // If SSSE3, use 1 pshufb instruction per vector with elements in the result. + if (TLI.getSubtarget()->hasSSSE3()) { + SmallVector pshufbMask; + + // If all result elements are from one input vector, then only translate + // undef mask values to 0x80 (zero out result) in the pshufb mask. + // + // Otherwise, we have elements from both input vectors, and must zero out + // elements that come from V2 in the first mask, and V1 in the second mask + // so that we can OR them together. + bool TwoInputs = !(V1Only || V2Only); + for (unsigned i = 0; i != 16; ++i) { + int EltIdx = MaskVals[i]; + if (EltIdx < 0 || (TwoInputs && EltIdx >= 16)) { + pshufbMask.push_back(DAG.getConstant(0x80, MVT::i8)); + continue; } - SDValue Mask = DAG.getNode(ISD::BUILD_VECTOR, dl, MaskVT, &MaskVec[0], 8); - V1 = DAG.getNode(ISD::VECTOR_SHUFFLE, dl, MVT::v8i16, V1, V1, Mask); + pshufbMask.push_back(DAG.getConstant(EltIdx, MVT::i8)); } - - NewV = V1; - for (unsigned i = 0; i < 8; ++i) { - SDValue Elt = V1Elts[i]; - if (Elt.getOpcode() == ISD::UNDEF) - continue; - unsigned EltIdx = cast(Elt)->getZExtValue(); - if (EltIdx < 8) + // If all the elements are from V2, assign it to V1 and return after + // building the first pshufb. + if (V2Only) + V1 = V2; + V1 = DAG.getNode(X86ISD::PSHUFB, dl, MVT::v16i8, V1, + DAG.getNode(ISD::BUILD_VECTOR, dl, + MVT::v16i8, &pshufbMask[0], 16)); + if (!TwoInputs) + return V1; + + // Calculate the shuffle mask for the second input, shuffle it, and + // OR it with the first shuffled input. + pshufbMask.clear(); + for (unsigned i = 0; i != 16; ++i) { + int EltIdx = MaskVals[i]; + if (EltIdx < 16) { + pshufbMask.push_back(DAG.getConstant(0x80, MVT::i8)); continue; - SDValue ExtOp = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, MVT::i16, V2, - DAG.getConstant(EltIdx - 8, PtrVT)); - NewV = DAG.getNode(ISD::INSERT_VECTOR_ELT, dl, MVT::v8i16, NewV, ExtOp, - DAG.getConstant(i, PtrVT)); + } + pshufbMask.push_back(DAG.getConstant(EltIdx - 16, MVT::i8)); } - return NewV; - } else { - // All elements are from V1. - NewV = V1; - for (unsigned i = 0; i < 8; ++i) { - SDValue Elt = V1Elts[i]; - if (Elt.getOpcode() == ISD::UNDEF) - continue; - unsigned EltIdx = cast(Elt)->getZExtValue(); - SDValue ExtOp = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, MVT::i16, V1, - DAG.getConstant(EltIdx, PtrVT)); - NewV = DAG.getNode(ISD::INSERT_VECTOR_ELT, dl, MVT::v8i16, NewV, ExtOp, - DAG.getConstant(i, PtrVT)); + V2 = DAG.getNode(X86ISD::PSHUFB, dl, MVT::v16i8, V2, + DAG.getNode(ISD::BUILD_VECTOR, dl, + MVT::v16i8, &pshufbMask[0], 16)); + return DAG.getNode(ISD::OR, dl, MVT::v16i8, V1, V2); + } + + // No SSSE3 - Calculate in place words and then fix all out of place words + // With 0-16 extracts & inserts. Worst case is 16 bytes out of order from + // the 16 different words that comprise the two doublequadword input vectors. + V1 = DAG.getNode(ISD::BIT_CONVERT, dl, MVT::v8i16, V1); + V2 = DAG.getNode(ISD::BIT_CONVERT, dl, MVT::v8i16, V2); + SDValue NewV = V2Only ? V2 : V1; + for (int i = 0; i != 8; ++i) { + int Elt0 = MaskVals[i*2]; + int Elt1 = MaskVals[i*2+1]; + + // This word of the result is all undef, skip it. + if (Elt0 < 0 && Elt1 < 0) + continue; + + // This word of the result is already in the correct place, skip it. + if (V1Only && (Elt0 == i*2) && (Elt1 == i*2+1)) + continue; + if (V2Only && (Elt0 == i*2+16) && (Elt1 == i*2+17)) + continue; + + SDValue Elt0Src = Elt0 < 16 ? V1 : V2; + SDValue Elt1Src = Elt1 < 16 ? V1 : V2; + SDValue InsElt; + + // If Elt1 is defined, extract it from the appropriate source. If the + // source byte is not also odd, shift the extracted word left 8 bits. + if (Elt1 >= 0) { + InsElt = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, MVT::i16, Elt1Src, + DAG.getIntPtrConstant(Elt1 / 2)); + if ((Elt1 & 1) == 0) + InsElt = DAG.getNode(ISD::SHL, dl, MVT::i16, InsElt, + DAG.getConstant(8, TLI.getShiftAmountTy())); + } + // If Elt0 is defined, extract it from the appropriate source. If the + // source byte is not also even, shift the extracted word right 8 bits. If + // Elt1 was also defined, OR the extracted values together before + // inserting them in the result. + if (Elt0 >= 0) { + SDValue InsElt0 = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, MVT::i16, + Elt0Src, DAG.getIntPtrConstant(Elt0 / 2)); + if ((Elt0 & 1) != 0) + InsElt0 = DAG.getNode(ISD::SRL, dl, MVT::i16, InsElt0, + DAG.getConstant(8, TLI.getShiftAmountTy())); + InsElt = Elt1 >= 0 ? DAG.getNode(ISD::OR, dl, MVT::i16, InsElt, InsElt0) + : InsElt0; } - return NewV; + NewV = DAG.getNode(ISD::INSERT_VECTOR_ELT, dl, MVT::v8i16, NewV, InsElt, + DAG.getIntPtrConstant(i)); } + return DAG.getNode(ISD::BIT_CONVERT, dl, MVT::v16i8, NewV); } /// RewriteAsNarrowerShuffle - Try rewriting v8i16 and v16i8 shuffles as 4 wide @@ -4102,6 +4195,8 @@ bool V1IsSplat = false; bool V2IsSplat = false; + // FIXME: Check for legal shuffle and return? + if (isUndefShuffle(Op.getNode())) return DAG.getUNDEF(VT); @@ -4263,6 +4358,7 @@ return Op; } + // FIXME: for mmx, bitcast v2i32 to v4i16 for shuffle. // Try PSHUF* first, then SHUFP*. // MMX doesn't have PSHUFD but it does have PSHUFW. While it's theoretically // possible to shuffle a v2i32 using PSHUFW, that's not yet implemented. @@ -4305,6 +4401,12 @@ return NewOp; } + if (VT == MVT::v16i8) { + SDValue NewOp = LowerVECTOR_SHUFFLEv16i8(V1, V2, PermMask, DAG, *this, dl); + if (NewOp.getNode()) + return NewOp; + } + // Handle all 4 wide cases with a number of shuffles except for MMX. if (NumElems == 4 && !isMMX) return LowerVECTOR_SHUFFLE_4wide(V1, V2, PermMask, VT, DAG, dl); @@ -6857,6 +6959,7 @@ case X86ISD::INSERTPS: return "X86ISD::INSERTPS"; case X86ISD::PINSRB: return "X86ISD::PINSRB"; case X86ISD::PINSRW: return "X86ISD::PINSRW"; + case X86ISD::PSHUFB: return "X86ISD::PSHUFB"; case X86ISD::FMAX: return "X86ISD::FMAX"; case X86ISD::FMIN: return "X86ISD::FMIN"; case X86ISD::FRSQRT: return "X86ISD::FRSQRT"; @@ -6975,12 +7078,14 @@ bool X86TargetLowering::isShuffleMaskLegal(SDValue Mask, MVT VT) const { // Only do shuffles on 128-bit vector types for now. + // FIXME: pshufb, blends if (VT.getSizeInBits() == 64) return false; return (Mask.getNode()->getNumOperands() <= 4 || isIdentityMask(Mask.getNode()) || isIdentityMask(Mask.getNode(), true) || isSplatMask(Mask.getNode()) || - isPSHUFHW_PSHUFLWMask(Mask.getNode()) || + X86::isPSHUFHWMask(Mask.getNode()) || + X86::isPSHUFLWMask(Mask.getNode()) || X86::isUNPCKLMask(Mask.getNode()) || X86::isUNPCKHMask(Mask.getNode()) || X86::isUNPCKL_v_undef_Mask(Mask.getNode()) || Modified: llvm/branches/Apple/Dib/lib/Target/X86/X86ISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/X86/X86ISelLowering.h?rev=65588&r1=65587&r2=65588&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/X86/X86ISelLowering.h (original) +++ llvm/branches/Apple/Dib/lib/Target/X86/X86ISelLowering.h Thu Feb 26 17:39:22 2009 @@ -176,6 +176,9 @@ /// corresponds to X86::PINSRW. PINSRW, + /// PSHUFB - Shuffle 16 8-bit values within a vector. + PSHUFB, + /// FMAX, FMIN - Floating point max and min. /// FMAX, FMIN, Modified: llvm/branches/Apple/Dib/lib/Target/X86/X86InstrSSE.td URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/X86/X86InstrSSE.td?rev=65588&r1=65587&r2=65588&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/X86/X86InstrSSE.td (original) +++ llvm/branches/Apple/Dib/lib/Target/X86/X86InstrSSE.td Thu Feb 26 17:39:22 2009 @@ -36,6 +36,9 @@ def X86fsrl : SDNode<"X86ISD::FSRL", SDTX86FPShiftOp>; def X86comi : SDNode<"X86ISD::COMI", SDTX86CmpTest>; def X86ucomi : SDNode<"X86ISD::UCOMI", SDTX86CmpTest>; +def X86pshufb : SDNode<"X86ISD::PSHUFB", + SDTypeProfile<1, 2, [SDTCisVT<0, v16i8>, SDTCisSameAs<0,1>, + SDTCisSameAs<0,2>]>>; def X86pextrb : SDNode<"X86ISD::PEXTRB", SDTypeProfile<1, 2, [SDTCisVT<0, i32>, SDTCisPtrTy<2>]>>; def X86pextrw : SDNode<"X86ISD::PEXTRW", @@ -2841,6 +2844,11 @@ imm:$src3))]>, OpSize; } +def : Pat<(X86pshufb VR128:$src, VR128:$mask), + (PSHUFBrr128 VR128:$src, VR128:$mask)>, Requires<[HasSSSE3]>; +def : Pat<(X86pshufb VR128:$src, (bc_v16i8 (memopv2i64 addr:$mask))), + (PSHUFBrm128 VR128:$src, addr:$mask)>, Requires<[HasSSSE3]>; + //===----------------------------------------------------------------------===// // Non-Instruction Patterns //===----------------------------------------------------------------------===// Modified: llvm/branches/Apple/Dib/test/CodeGen/X86/vec_shuffle-12.ll URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/test/CodeGen/X86/vec_shuffle-12.ll?rev=65588&r1=65587&r2=65588&view=diff ============================================================================== --- llvm/branches/Apple/Dib/test/CodeGen/X86/vec_shuffle-12.ll (original) +++ llvm/branches/Apple/Dib/test/CodeGen/X86/vec_shuffle-12.ll Thu Feb 26 17:39:22 2009 @@ -1,8 +1,8 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 > %t +; RUN: llvm-as < %s | llc -march=x86 -mcpu=yonah > %t ; RUN: not grep punpck %t ; RUN: grep pextrw %t | count 4 ; RUN: grep pinsrw %t | count 6 -; RUN: grep pshuflw %t | count 3 +; RUN: grep pshuflw %t | count 1 ; RUN: grep pshufhw %t | count 2 define <8 x i16> @t1(<8 x i16>* %A, <8 x i16>* %B) nounwind { Modified: llvm/branches/Apple/Dib/test/CodeGen/X86/vec_shuffle-13.ll URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/test/CodeGen/X86/vec_shuffle-13.ll?rev=65588&r1=65587&r2=65588&view=diff ============================================================================== --- llvm/branches/Apple/Dib/test/CodeGen/X86/vec_shuffle-13.ll (original) +++ llvm/branches/Apple/Dib/test/CodeGen/X86/vec_shuffle-13.ll Thu Feb 26 17:39:22 2009 @@ -1,7 +1,7 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 > %t +; RUN: llvm-as < %s | llc -march=x86 -mcpu=yonah > %t ; RUN: grep movlhps %t | count 1 -; RUN: grep movss %t | count 1 ; RUN: grep pshufd %t | count 1 +; RUN: grep movss %t | count 1 ; RUN: grep pshuflw %t | count 1 ; RUN: grep pshufhw %t | count 1 Modified: llvm/branches/Apple/Dib/test/CodeGen/X86/vec_shuffle-2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/test/CodeGen/X86/vec_shuffle-2.ll?rev=65588&r1=65587&r2=65588&view=diff ============================================================================== --- llvm/branches/Apple/Dib/test/CodeGen/X86/vec_shuffle-2.ll (original) +++ llvm/branches/Apple/Dib/test/CodeGen/X86/vec_shuffle-2.ll Thu Feb 26 17:39:22 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mcpu=yonah -o %t -f ; RUN: grep pshufhw %t | count 1 ; RUN: grep pshuflw %t | count 1 ; RUN: grep movhps %t | count 1 Modified: llvm/branches/Apple/Dib/test/CodeGen/X86/vec_shuffle-21.ll URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/test/CodeGen/X86/vec_shuffle-21.ll?rev=65588&r1=65587&r2=65588&view=diff ============================================================================== --- llvm/branches/Apple/Dib/test/CodeGen/X86/vec_shuffle-21.ll (original) +++ llvm/branches/Apple/Dib/test/CodeGen/X86/vec_shuffle-21.ll Thu Feb 26 17:39:22 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mcpu=yonah -o %t -f ; RUN: grep pshuflw %t | count 1 ; RUN: grep pextrw %t | count 2 ; RUN: grep pinsrw %t | count 2 Modified: llvm/branches/Apple/Dib/test/CodeGen/X86/vec_shuffle-28.ll URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/test/CodeGen/X86/vec_shuffle-28.ll?rev=65588&r1=65587&r2=65588&view=diff ============================================================================== --- llvm/branches/Apple/Dib/test/CodeGen/X86/vec_shuffle-28.ll (original) +++ llvm/branches/Apple/Dib/test/CodeGen/X86/vec_shuffle-28.ll Thu Feb 26 17:39:22 2009 @@ -1,8 +1,12 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=sse41 -o %t -f -; RUN: grep punpcklwd %t | count 1 -; RUN: grep pextrw %t | count 6 -; RUN: grep pinsrw %t | count 8 +; RUN: llvm-as < %s | llc -march=x86 -mcpu=yonah -o %t -f +; RUN: grep movd %t | count 1 +; RUN: grep pshuflw %t | count 1 +; RUN: grep pinsrw %t | count 1 +; RUN: llvm-as < %s | llc -march=x86 -mcpu=core2 -o %t -f +; RUN: grep pshufb %t | count 1 +; FIXME: this test has a superfluous punpcklqdq pre-pshufb currently. +; Don't XFAIL it because it's still better than the previous code. ; Pack various elements via shuffles. define <8 x i16> @shuf1(<8 x i16> %T0, <8 x i16> %T1) nounwind readnone { @@ -10,24 +14,3 @@ %tmp7 = shufflevector <8 x i16> %T0, <8 x i16> %T1, <8 x i32> < i32 1, i32 8, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef , i32 undef > ret <8 x i16> %tmp7 } - - -define <8 x i16> @shuf2(<8 x i16> %T0, <8 x i16> %T1) nounwind readnone { -entry: - %tmp8 = shufflevector <8 x i16> %T0, <8 x i16> %T1, <8 x i32> < i32 undef, i32 undef, i32 7, i32 2, i32 8, i32 undef, i32 undef , i32 undef > - ret <8 x i16> %tmp8 -} - - -define <8 x i16> @shuf3(<8 x i16> %T0, <8 x i16> %T1) nounwind readnone { -entry: - %tmp9 = shufflevector <8 x i16> %T0, <8 x i16> %T1, <8 x i32> < i32 0, i32 1, i32 undef, i32 undef, i32 3, i32 11, i32 undef , i32 undef > - ret <8 x i16> %tmp9 -} - - -define <8 x i16> @shuf4(<8 x i16> %T0, <8 x i16> %T1) nounwind readnone { -entry: - %tmp9 = shufflevector <8 x i16> %T0, <8 x i16> %T1, <8 x i32> < i32 8, i32 9, i32 undef, i32 undef, i32 11, i32 3, i32 undef , i32 undef > - ret <8 x i16> %tmp9 -} Modified: llvm/branches/Apple/Dib/test/CodeGen/X86/vec_shuffle-29.ll URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/test/CodeGen/X86/vec_shuffle-29.ll?rev=65588&r1=65587&r2=65588&view=diff ============================================================================== --- llvm/branches/Apple/Dib/test/CodeGen/X86/vec_shuffle-29.ll (original) +++ llvm/branches/Apple/Dib/test/CodeGen/X86/vec_shuffle-29.ll Thu Feb 26 17:39:22 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=sse41 -disable-mmx -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mattr=sse41,-ssse3 -disable-mmx -o %t -f ; RUN: not grep pextrw %t ; RUN: grep pinsrw %t From evan.cheng at apple.com Thu Feb 26 18:02:23 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 27 Feb 2009 00:02:23 -0000 Subject: [llvm-commits] [llvm] r65592 - in /llvm/trunk: lib/CodeGen/MachineLICM.cpp test/CodeGen/X86/2009-02-26-MachineLICMBug.ll Message-ID: <200902270002.n1R02NhH008836@zion.cs.uiuc.edu> Author: evancheng Date: Thu Feb 26 18:02:22 2009 New Revision: 65592 URL: http://llvm.org/viewvc/llvm-project?rev=65592&view=rev Log: MachineLICM CSE should match destination register classes; avoid hoisting implicit_def's. Added: llvm/trunk/test/CodeGen/X86/2009-02-26-MachineLICMBug.ll Modified: llvm/trunk/lib/CodeGen/MachineLICM.cpp Modified: llvm/trunk/lib/CodeGen/MachineLICM.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineLICM.cpp?rev=65592&r1=65591&r2=65592&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineLICM.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineLICM.cpp Thu Feb 26 18:02:22 2009 @@ -288,6 +288,9 @@ /// IsProfitableToHoist - Return true if it is potentially profitable to hoist /// the given loop invariant. bool MachineLICM::IsProfitableToHoist(MachineInstr &MI) { + if (MI.getOpcode() == TargetInstrInfo::IMPLICIT_DEF) + return false; + const TargetInstrDesc &TID = MI.getDesc(); // FIXME: For now, only hoist re-materilizable instructions. LICM will @@ -312,7 +315,8 @@ } static const MachineInstr *LookForDuplicate(const MachineInstr *MI, - std::vector &PrevMIs) { + std::vector &PrevMIs, + MachineRegisterInfo *RegInfo) { unsigned NumOps = MI->getNumOperands(); for (unsigned i = 0, e = PrevMIs.size(); i != e; ++i) { const MachineInstr *PrevMI = PrevMIs[i]; @@ -322,8 +326,14 @@ bool IsSame = true; for (unsigned j = 0; j != NumOps; ++j) { const MachineOperand &MO = MI->getOperand(j); - if (MO.isReg() && MO.isDef()) + if (MO.isReg() && MO.isDef()) { + if (RegInfo->getRegClass(MO.getReg()) != + RegInfo->getRegClass(PrevMI->getOperand(j).getReg())) { + IsSame = false; + break; + } continue; + } if (!MO.isIdenticalTo(PrevMI->getOperand(j))) { IsSame = false; break; @@ -362,7 +372,7 @@ std::vector >::iterator CI = CSEMap.find(BBOpcPair); bool DoneCSE = false; if (CI != CSEMap.end()) { - const MachineInstr *Dup = LookForDuplicate(&MI, CI->second); + const MachineInstr *Dup = LookForDuplicate(&MI, CI->second, RegInfo); if (Dup) { DOUT << "CSEing " << MI; DOUT << " with " << *Dup; Added: llvm/trunk/test/CodeGen/X86/2009-02-26-MachineLICMBug.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2009-02-26-MachineLICMBug.ll?rev=65592&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/2009-02-26-MachineLICMBug.ll (added) +++ llvm/trunk/test/CodeGen/X86/2009-02-26-MachineLICMBug.ll Thu Feb 26 18:02:22 2009 @@ -0,0 +1,47 @@ +; RUN: llvm-as < %s | llc -march=x86-64 -mattr=+sse3 -stats |& not grep {machine-licm} +; rdar://6627786 + +target triple = "x86_64-apple-darwin10.0" + %struct.Key = type { i64 } + %struct.__Rec = type opaque + %struct.__vv = type { } + +define %struct.__vv* @t(%struct.Key* %desc) nounwind ssp { +entry: + br label %bb4 + +bb4: ; preds = %bb.i, %bb26, %bb4, %entry + %0 = call i32 (...)* @xxGetOffsetForCode(i32 undef) nounwind ; [#uses=0] + %ins = or i64 0, 0 ; [#uses=1] + %1 = call i32 (...)* @xxCalculateMidType(%struct.Key* %desc, i32 0) nounwind ; [#uses=1] + %cond = icmp eq i32 %1, 1 ; [#uses=1] + br i1 %cond, label %bb26, label %bb4 + +bb26: ; preds = %bb4 + %2 = and i64 %ins, 15728640 ; [#uses=1] + %cond.i = icmp eq i64 %2, 1048576 ; [#uses=1] + br i1 %cond.i, label %bb.i, label %bb4 + +bb.i: ; preds = %bb26 + %3 = load i32* null, align 4 ; [#uses=1] + %4 = uitofp i32 %3 to float ; [#uses=1] + %.sum13.i = add i64 0, 4 ; [#uses=1] + %5 = getelementptr i8* null, i64 %.sum13.i ; [#uses=1] + %6 = bitcast i8* %5 to i32* ; [#uses=1] + %7 = load i32* %6, align 4 ; [#uses=1] + %8 = uitofp i32 %7 to float ; [#uses=1] + %.sum.i = add i64 0, 8 ; [#uses=1] + %9 = getelementptr i8* null, i64 %.sum.i ; [#uses=1] + %10 = bitcast i8* %9 to i32* ; [#uses=1] + %11 = load i32* %10, align 4 ; [#uses=1] + %12 = uitofp i32 %11 to float ; [#uses=1] + %13 = insertelement <4 x float> undef, float %4, i32 0 ; <<4 x float>> [#uses=1] + %14 = insertelement <4 x float> %13, float %8, i32 1 ; <<4 x float>> [#uses=1] + %15 = insertelement <4 x float> %14, float %12, i32 2 ; <<4 x float>> [#uses=1] + store <4 x float> %15, <4 x float>* null, align 16 + br label %bb4 +} + +declare i32 @xxGetOffsetForCode(...) + +declare i32 @xxCalculateMidType(...) From gohman at apple.com Thu Feb 26 18:05:54 2009 From: gohman at apple.com (Dan Gohman) Date: Fri, 27 Feb 2009 00:05:54 -0000 Subject: [llvm-commits] [llvm] r65593 - /llvm/trunk/include/llvm/Analysis/LoopInfo.h Message-ID: <200902270005.n1R05sJ5009016@zion.cs.uiuc.edu> Author: djg Date: Thu Feb 26 18:05:54 2009 New Revision: 65593 URL: http://llvm.org/viewvc/llvm-project?rev=65593&view=rev Log: Make LoopInfo::print() identify header, exit, and latch blocks, and print the loop depth. Modified: llvm/trunk/include/llvm/Analysis/LoopInfo.h Modified: llvm/trunk/include/llvm/Analysis/LoopInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/LoopInfo.h?rev=65593&r1=65592&r2=65593&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/LoopInfo.h (original) +++ llvm/trunk/include/llvm/Analysis/LoopInfo.h Thu Feb 26 18:05:54 2009 @@ -592,11 +592,16 @@ } void print(std::ostream &OS, unsigned Depth = 0) const { - OS << std::string(Depth*2, ' ') << "Loop Containing: "; + OS << std::string(Depth*2, ' ') << "Loop at depth " << getLoopDepth() + << " containing: "; for (unsigned i = 0; i < getBlocks().size(); ++i) { if (i) OS << ","; - WriteAsOperand(OS, getBlocks()[i], false); + BlockT *BB = getBlocks()[i]; + WriteAsOperand(OS, BB, false); + if (BB == getHeader()) OS << "
      "; + if (BB == getLoopLatch()) OS << ""; + if (isLoopExit(BB)) OS << ""; } OS << "\n"; From isanbard at gmail.com Thu Feb 26 18:10:33 2009 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 27 Feb 2009 00:10:33 -0000 Subject: [llvm-commits] [llvm] r65594 - in /llvm/branches/Apple/Dib: lib/CodeGen/MachineLICM.cpp test/CodeGen/X86/2009-02-26-MachineLICMBug.ll Message-ID: <200902270010.n1R0AYhh009210@zion.cs.uiuc.edu> Author: void Date: Thu Feb 26 18:10:33 2009 New Revision: 65594 URL: http://llvm.org/viewvc/llvm-project?rev=65594&view=rev Log: --- Merging (from foreign repository) r65592 into '.': A test/CodeGen/X86/2009-02-26-MachineLICMBug.ll U lib/CodeGen/MachineLICM.cpp MachineLICM CSE should match destination register classes; avoid hoisting implicit_def's. Added: llvm/branches/Apple/Dib/test/CodeGen/X86/2009-02-26-MachineLICMBug.ll Modified: llvm/branches/Apple/Dib/lib/CodeGen/MachineLICM.cpp Modified: llvm/branches/Apple/Dib/lib/CodeGen/MachineLICM.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/MachineLICM.cpp?rev=65594&r1=65593&r2=65594&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/CodeGen/MachineLICM.cpp (original) +++ llvm/branches/Apple/Dib/lib/CodeGen/MachineLICM.cpp Thu Feb 26 18:10:33 2009 @@ -288,6 +288,9 @@ /// IsProfitableToHoist - Return true if it is potentially profitable to hoist /// the given loop invariant. bool MachineLICM::IsProfitableToHoist(MachineInstr &MI) { + if (MI.getOpcode() == TargetInstrInfo::IMPLICIT_DEF) + return false; + const TargetInstrDesc &TID = MI.getDesc(); // FIXME: For now, only hoist re-materilizable instructions. LICM will @@ -312,7 +315,8 @@ } static const MachineInstr *LookForDuplicate(const MachineInstr *MI, - std::vector &PrevMIs) { + std::vector &PrevMIs, + MachineRegisterInfo *RegInfo) { unsigned NumOps = MI->getNumOperands(); for (unsigned i = 0, e = PrevMIs.size(); i != e; ++i) { const MachineInstr *PrevMI = PrevMIs[i]; @@ -322,8 +326,14 @@ bool IsSame = true; for (unsigned j = 0; j != NumOps; ++j) { const MachineOperand &MO = MI->getOperand(j); - if (MO.isReg() && MO.isDef()) + if (MO.isReg() && MO.isDef()) { + if (RegInfo->getRegClass(MO.getReg()) != + RegInfo->getRegClass(PrevMI->getOperand(j).getReg())) { + IsSame = false; + break; + } continue; + } if (!MO.isIdenticalTo(PrevMI->getOperand(j))) { IsSame = false; break; @@ -362,7 +372,7 @@ std::vector >::iterator CI = CSEMap.find(BBOpcPair); bool DoneCSE = false; if (CI != CSEMap.end()) { - const MachineInstr *Dup = LookForDuplicate(&MI, CI->second); + const MachineInstr *Dup = LookForDuplicate(&MI, CI->second, RegInfo); if (Dup) { DOUT << "CSEing " << MI; DOUT << " with " << *Dup; Added: llvm/branches/Apple/Dib/test/CodeGen/X86/2009-02-26-MachineLICMBug.ll URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/test/CodeGen/X86/2009-02-26-MachineLICMBug.ll?rev=65594&view=auto ============================================================================== --- llvm/branches/Apple/Dib/test/CodeGen/X86/2009-02-26-MachineLICMBug.ll (added) +++ llvm/branches/Apple/Dib/test/CodeGen/X86/2009-02-26-MachineLICMBug.ll Thu Feb 26 18:10:33 2009 @@ -0,0 +1,47 @@ +; RUN: llvm-as < %s | llc -march=x86-64 -mattr=+sse3 -stats |& not grep {machine-licm} +; rdar://6627786 + +target triple = "x86_64-apple-darwin10.0" + %struct.Key = type { i64 } + %struct.__Rec = type opaque + %struct.__vv = type { } + +define %struct.__vv* @t(%struct.Key* %desc) nounwind ssp { +entry: + br label %bb4 + +bb4: ; preds = %bb.i, %bb26, %bb4, %entry + %0 = call i32 (...)* @xxGetOffsetForCode(i32 undef) nounwind ; [#uses=0] + %ins = or i64 0, 0 ; [#uses=1] + %1 = call i32 (...)* @xxCalculateMidType(%struct.Key* %desc, i32 0) nounwind ; [#uses=1] + %cond = icmp eq i32 %1, 1 ; [#uses=1] + br i1 %cond, label %bb26, label %bb4 + +bb26: ; preds = %bb4 + %2 = and i64 %ins, 15728640 ; [#uses=1] + %cond.i = icmp eq i64 %2, 1048576 ; [#uses=1] + br i1 %cond.i, label %bb.i, label %bb4 + +bb.i: ; preds = %bb26 + %3 = load i32* null, align 4 ; [#uses=1] + %4 = uitofp i32 %3 to float ; [#uses=1] + %.sum13.i = add i64 0, 4 ; [#uses=1] + %5 = getelementptr i8* null, i64 %.sum13.i ; [#uses=1] + %6 = bitcast i8* %5 to i32* ; [#uses=1] + %7 = load i32* %6, align 4 ; [#uses=1] + %8 = uitofp i32 %7 to float ; [#uses=1] + %.sum.i = add i64 0, 8 ; [#uses=1] + %9 = getelementptr i8* null, i64 %.sum.i ; [#uses=1] + %10 = bitcast i8* %9 to i32* ; [#uses=1] + %11 = load i32* %10, align 4 ; [#uses=1] + %12 = uitofp i32 %11 to float ; [#uses=1] + %13 = insertelement <4 x float> undef, float %4, i32 0 ; <<4 x float>> [#uses=1] + %14 = insertelement <4 x float> %13, float %8, i32 1 ; <<4 x float>> [#uses=1] + %15 = insertelement <4 x float> %14, float %12, i32 2 ; <<4 x float>> [#uses=1] + store <4 x float> %15, <4 x float>* null, align 16 + br label %bb4 +} + +declare i32 @xxGetOffsetForCode(...) + +declare i32 @xxCalculateMidType(...) From isanbard at gmail.com Thu Feb 26 18:11:10 2009 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 27 Feb 2009 00:11:10 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r65595 - /llvm-gcc-4.2/tags/Apple/llvmgcc42-2100/ Message-ID: <200902270011.n1R0BAt6009245@zion.cs.uiuc.edu> Author: void Date: Thu Feb 26 18:11:09 2009 New Revision: 65595 URL: http://llvm.org/viewvc/llvm-project?rev=65595&view=rev Log: Creating llvmgcc42-2100 from Dib. Added: llvm-gcc-4.2/tags/Apple/llvmgcc42-2100/ - copied from r65594, llvm-gcc-4.2/branches/Apple/Dib/ From isanbard at gmail.com Thu Feb 26 18:11:47 2009 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 27 Feb 2009 00:11:47 -0000 Subject: [llvm-commits] [llvm] r65596 - /llvm/tags/Apple/llvmCore-2100/ Message-ID: <200902270011.n1R0Blhs009274@zion.cs.uiuc.edu> Author: void Date: Thu Feb 26 18:11:47 2009 New Revision: 65596 URL: http://llvm.org/viewvc/llvm-project?rev=65596&view=rev Log: Creating llvmCore-2100 from Dib. Added: llvm/tags/Apple/llvmCore-2100/ - copied from r65595, llvm/branches/Apple/Dib/ From gohman at apple.com Thu Feb 26 18:17:50 2009 From: gohman at apple.com (Dan Gohman) Date: Fri, 27 Feb 2009 00:17:50 -0000 Subject: [llvm-commits] [llvm] r65597 - /llvm/trunk/test/Analysis/LoopInfo/2003-05-15-NestingProblem.ll Message-ID: <200902270017.n1R0HoTH009443@zion.cs.uiuc.edu> Author: djg Date: Thu Feb 26 18:17:49 2009 New Revision: 65597 URL: http://llvm.org/viewvc/llvm-project?rev=65597&view=rev Log: Update this test for the LoopInfo::print changes. Modified: llvm/trunk/test/Analysis/LoopInfo/2003-05-15-NestingProblem.ll Modified: llvm/trunk/test/Analysis/LoopInfo/2003-05-15-NestingProblem.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/LoopInfo/2003-05-15-NestingProblem.ll?rev=65597&r1=65596&r2=65597&view=diff ============================================================================== --- llvm/trunk/test/Analysis/LoopInfo/2003-05-15-NestingProblem.ll (original) +++ llvm/trunk/test/Analysis/LoopInfo/2003-05-15-NestingProblem.ll Thu Feb 26 18:17:49 2009 @@ -2,7 +2,7 @@ ; not a child of the loopentry.6 loop. ; ; RUN: llvm-as < %s | opt -analyze -loops | \ -; RUN: grep {^ Loop Containing: %loopentry.7} +; RUN: grep {^ Loop at depth 4 containing: %loopentry.7
      } define void @getAndMoveToFrontDecode() { br label %endif.2 From gohman at apple.com Thu Feb 26 18:20:19 2009 From: gohman at apple.com (Dan Gohman) Date: Fri, 27 Feb 2009 00:20:19 -0000 Subject: [llvm-commits] [llvm] r65598 - /llvm/trunk/test/Other/2003-02-19-LoopInfoNestingBug.ll Message-ID: <200902270020.n1R0KJrJ009533@zion.cs.uiuc.edu> Author: djg Date: Thu Feb 26 18:20:19 2009 New Revision: 65598 URL: http://llvm.org/viewvc/llvm-project?rev=65598&view=rev Log: Update another test for the LoopInfo::print changes. Modified: llvm/trunk/test/Other/2003-02-19-LoopInfoNestingBug.ll Modified: llvm/trunk/test/Other/2003-02-19-LoopInfoNestingBug.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Other/2003-02-19-LoopInfoNestingBug.ll?rev=65598&r1=65597&r2=65598&view=diff ============================================================================== --- llvm/trunk/test/Other/2003-02-19-LoopInfoNestingBug.ll (original) +++ llvm/trunk/test/Other/2003-02-19-LoopInfoNestingBug.ll Thu Feb 26 18:20:19 2009 @@ -3,7 +3,7 @@ ; and instead nests it just inside loop "Top" ; ; RUN: llvm-as < %s | opt -analyze -loops | \ -; RUN: grep { Loop Containing:\[ \]*%Inner} +; RUN: grep { Loop at depth 3 containing: %Inner
      } ; define void @test() { br label %Top From stuart at apple.com Thu Feb 26 18:50:45 2009 From: stuart at apple.com (Stuart Hastings) Date: Fri, 27 Feb 2009 00:50:45 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r65599 - in /llvm-gcc-4.2/trunk/gcc: config/darwin.h llvm-convert.cpp Message-ID: <200902270050.n1R0okSv010572@zion.cs.uiuc.edu> Author: stuart Date: Thu Feb 26 18:50:45 2009 New Revision: 65599 URL: http://llvm.org/viewvc/llvm-project?rev=65599&view=rev Log: Try, again, to send STRING_CSTs to the cstring section. This is a followup to r65490. Darwin-specific. Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.h llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/darwin.h?rev=65599&r1=65598&r2=65599&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/darwin.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/darwin.h Thu Feb 26 18:50:45 2009 @@ -689,6 +689,8 @@ } while (0) /* LLVM LOCAL - end radar 6389998 */ +/* Assign STRING_CSTs to the .cstring section. */ +#define LLVM_DARWIN_CSTRING_SECTION "__TEXT,__cstring,cstring_literals" #endif /* LLVM LOCAL end */ Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=65599&r1=65598&r2=65599&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Thu Feb 26 18:50:45 2009 @@ -7181,6 +7181,11 @@ TAI->getStringConstantPrefix() : ".str", TheModule); if (SlotP) *SlotP = GV; +#ifdef LLVM_DARWIN_CSTRING_SECTION + // For Darwin, try to put it into the .cstring section. + if (TAI && TAI->SectionKindForGlobal(GV) == SectionKind::RODataMergeStr) + GV->setSection(LLVM_DARWIN_CSTRING_SECTION); +#endif return GV; } From evan.cheng at apple.com Thu Feb 26 18:51:50 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 27 Feb 2009 00:51:50 -0000 Subject: [llvm-commits] [llvm] r65600 - /llvm/trunk/test/CodeGen/X86/ret-mmx.ll Message-ID: <200902270051.n1R0poqH010613@zion.cs.uiuc.edu> Author: evancheng Date: Thu Feb 26 18:51:50 2009 New Revision: 65600 URL: http://llvm.org/viewvc/llvm-project?rev=65600&view=rev Log: Make sure this test passes on linux-ppc. Modified: llvm/trunk/test/CodeGen/X86/ret-mmx.ll Modified: llvm/trunk/test/CodeGen/X86/ret-mmx.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/ret-mmx.ll?rev=65600&r1=65599&r2=65600&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/ret-mmx.ll (original) +++ llvm/trunk/test/CodeGen/X86/ret-mmx.ll Thu Feb 26 18:51:50 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86-64 -mattr=+mmx +; RUN: llvm-as < %s | llc -march=x86-64 -mattr=+mmx,+sse2 ; rdar://6602459 @g_v1di = external global <1 x i64> From dalej at apple.com Thu Feb 26 18:56:35 2009 From: dalej at apple.com (Dale Johannesen) Date: Fri, 27 Feb 2009 00:56:35 -0000 Subject: [llvm-commits] [llvm] r65601 - /llvm/trunk/lib/Target/PowerPC/PPCSubtarget.h Message-ID: <200902270056.n1R0uZPD010750@zion.cs.uiuc.edu> Author: johannes Date: Thu Feb 26 18:56:35 2009 New Revision: 65601 URL: http://llvm.org/viewvc/llvm-project?rev=65601&view=rev Log: Alignment values for i64 and f64 on ppc64 were wrong, possibly for the reason suggested by the comment. No wonder it didn't work very well. This unblocks bootstrap with assertions on ppc. Modified: llvm/trunk/lib/Target/PowerPC/PPCSubtarget.h Modified: llvm/trunk/lib/Target/PowerPC/PPCSubtarget.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCSubtarget.h?rev=65601&r1=65600&r2=65601&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCSubtarget.h (original) +++ llvm/trunk/lib/Target/PowerPC/PPCSubtarget.h Thu Feb 26 18:56:35 2009 @@ -108,7 +108,9 @@ /// getTargetDataString - Return the pointer size and type alignment /// properties of this subtarget. const char *getTargetDataString() const { - return isPPC64() ? "E-p:64:64-f64:32:64-i64:32:64-f128:64:128" + // Note, the alignment values for f64 and i64 on ppc64 in Darwin + // documentation are wrong; these are correct (i.e. "what gcc does"). + return isPPC64() ? "E-p:64:64-f64:64:64-i64:64:64-f128:64:128" : "E-p:32:32-f64:32:64-i64:32:64-f128:64:128"; } From isanbard at gmail.com Thu Feb 26 19:07:57 2009 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 27 Feb 2009 01:07:57 -0000 Subject: [llvm-commits] [llvm] r65602 - /llvm/branches/Apple/Dib/include/llvm/Support/MathExtras.h Message-ID: <200902270107.n1R17vnF011112@zion.cs.uiuc.edu> Author: void Date: Thu Feb 26 19:07:56 2009 New Revision: 65602 URL: http://llvm.org/viewvc/llvm-project?rev=65602&view=rev Log: --- Merging (from foreign repository) r64691 into '.': U include/llvm/Support/MathExtras.h Add llvm::RoundUpToAlignment. - No functionality change. Modified: llvm/branches/Apple/Dib/include/llvm/Support/MathExtras.h Modified: llvm/branches/Apple/Dib/include/llvm/Support/MathExtras.h URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/include/llvm/Support/MathExtras.h?rev=65602&r1=65601&r2=65602&view=diff ============================================================================== --- llvm/branches/Apple/Dib/include/llvm/Support/MathExtras.h (original) +++ llvm/branches/Apple/Dib/include/llvm/Support/MathExtras.h Thu Feb 26 19:07:56 2009 @@ -412,6 +412,18 @@ A |= (A >> 32); return A + 1; } + +/// RoundUpToAlignment - Returns the next integer (mod 2**64) that is +/// greater than or equal to \arg Value and is a multiple of \arg +/// Align. Align must be non-zero. +/// +/// Examples: +/// RoundUpToAlignment(5, 8) = 8 +/// RoundUpToAlignment(17, 8) = 24 +/// RoundUpToAlignment(~0LL, 8) = 0 +inline uint64_t RoundUpToAlignment(uint64_t Value, uint64_t Align) { + return ((Value + Align - 1) / Align) * Align; +} } // End llvm namespace From isanbard at gmail.com Thu Feb 26 19:14:43 2009 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 27 Feb 2009 01:14:43 -0000 Subject: [llvm-commits] [llvm] r65603 - /llvm/tags/Apple/llvmCore-2100/ Message-ID: <200902270114.n1R1EhbL011315@zion.cs.uiuc.edu> Author: void Date: Thu Feb 26 19:14:43 2009 New Revision: 65603 URL: http://llvm.org/viewvc/llvm-project?rev=65603&view=rev Log: Redo llvmCore-2100 tag. Removed: llvm/tags/Apple/llvmCore-2100/ From isanbard at gmail.com Thu Feb 26 19:15:08 2009 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 27 Feb 2009 01:15:08 -0000 Subject: [llvm-commits] [llvm] r65604 - /llvm/tags/Apple/llvmCore-2100/ Message-ID: <200902270115.n1R1F8hs011334@zion.cs.uiuc.edu> Author: void Date: Thu Feb 26 19:15:08 2009 New Revision: 65604 URL: http://llvm.org/viewvc/llvm-project?rev=65604&view=rev Log: Creating llvmCore-2100 from Dib. Added: llvm/tags/Apple/llvmCore-2100/ - copied from r65603, llvm/branches/Apple/Dib/ From isanbard at gmail.com Thu Feb 26 19:37:00 2009 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 27 Feb 2009 01:37:00 -0000 Subject: [llvm-commits] [llvm] r65605 - /llvm/tags/Apple/llvmCore-2100/ Message-ID: <200902270137.n1R1b03c011992@zion.cs.uiuc.edu> Author: void Date: Thu Feb 26 19:36:59 2009 New Revision: 65605 URL: http://llvm.org/viewvc/llvm-project?rev=65605&view=rev Log: Remove llvmCore-2100 tag. It's no good. Removed: llvm/tags/Apple/llvmCore-2100/ From isanbard at gmail.com Thu Feb 26 19:37:33 2009 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 27 Feb 2009 01:37:33 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r65606 - /llvm-gcc-4.2/tags/Apple/llvmgcc42-2100/ Message-ID: <200902270137.n1R1bX25012020@zion.cs.uiuc.edu> Author: void Date: Thu Feb 26 19:37:33 2009 New Revision: 65606 URL: http://llvm.org/viewvc/llvm-project?rev=65606&view=rev Log: Remove llvmgcc42-2100 tag. It's no good. Removed: llvm-gcc-4.2/tags/Apple/llvmgcc42-2100/ From kremenek at apple.com Thu Feb 26 19:59:29 2009 From: kremenek at apple.com (Ted Kremenek) Date: Fri, 27 Feb 2009 01:59:29 -0000 Subject: [llvm-commits] [llvm] r65607 - /llvm/tags/checker/checker-0.165/ Message-ID: <200902270159.n1R1xTrW012675@zion.cs.uiuc.edu> Author: kremenek Date: Thu Feb 26 19:59:29 2009 New Revision: 65607 URL: http://llvm.org/viewvc/llvm-project?rev=65607&view=rev Log: Tagging checker-0.165. Added: llvm/tags/checker/checker-0.165/ - copied from r65606, llvm/trunk/ From nicholas at mxc.ca Thu Feb 26 22:22:42 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Thu, 26 Feb 2009 20:22:42 -0800 Subject: [llvm-commits] [llvm] r65600 - /llvm/trunk/test/CodeGen/X86/ret-mmx.ll In-Reply-To: <200902270051.n1R0poqH010613@zion.cs.uiuc.edu> References: <200902270051.n1R0poqH010613@zion.cs.uiuc.edu> Message-ID: <49A76A92.3070103@mxc.ca> That works. Thanks Evan! Evan Cheng wrote: > Author: evancheng > Date: Thu Feb 26 18:51:50 2009 > New Revision: 65600 > > URL: http://llvm.org/viewvc/llvm-project?rev=65600&view=rev > Log: > Make sure this test passes on linux-ppc. > > Modified: > llvm/trunk/test/CodeGen/X86/ret-mmx.ll > > Modified: llvm/trunk/test/CodeGen/X86/ret-mmx.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/ret-mmx.ll?rev=65600&r1=65599&r2=65600&view=diff > > ============================================================================== > --- llvm/trunk/test/CodeGen/X86/ret-mmx.ll (original) > +++ llvm/trunk/test/CodeGen/X86/ret-mmx.ll Thu Feb 26 18:51:50 2009 > @@ -1,4 +1,4 @@ > -; RUN: llvm-as < %s | llc -march=x86-64 -mattr=+mmx > +; RUN: llvm-as < %s | llc -march=x86-64 -mattr=+mmx,+sse2 > ; rdar://6602459 > > @g_v1di = external global <1 x i64> > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From clattner at apple.com Thu Feb 26 23:19:20 2009 From: clattner at apple.com (Chris Lattner) Date: Thu, 26 Feb 2009 21:19:20 -0800 Subject: [llvm-commits] [llvm-gcc-4.2] r65599 - in /llvm-gcc-4.2/trunk/gcc: config/darwin.h llvm-convert.cpp In-Reply-To: <200902270050.n1R0okSv010572@zion.cs.uiuc.edu> References: <200902270050.n1R0okSv010572@zion.cs.uiuc.edu> Message-ID: On Feb 26, 2009, at 4:50 PM, Stuart Hastings wrote: > Author: stuart > Date: Thu Feb 26 18:50:45 2009 > New Revision: 65599 > > URL: http://llvm.org/viewvc/llvm-project?rev=65599&view=rev > Log: > Try, again, to send STRING_CSTs to the cstring section. This is a > followup to r65490. Darwin-specific. Looks great Stuart, thanks. One minor nit-pick: theoretically this hook could be used for targets other than darwin. Would it make sense to remove "DARWIN_" from the macro name? Also, please apply a testcase to llvm/test/FrontendC that checks that the -emit-llvm output of llvm-gcc specifies the right section. Thanks, -Chris > > > Modified: > llvm-gcc-4.2/trunk/gcc/config/darwin.h > llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp > > Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.h > URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/darwin.h?rev=65599&r1=65598&r2=65599&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm-gcc-4.2/trunk/gcc/config/darwin.h (original) > +++ llvm-gcc-4.2/trunk/gcc/config/darwin.h Thu Feb 26 18:50:45 2009 > @@ -689,6 +689,8 @@ > } while (0) > /* LLVM LOCAL - end radar 6389998 */ > > +/* Assign STRING_CSTs to the .cstring section. */ > +#define LLVM_DARWIN_CSTRING_SECTION > "__TEXT,__cstring,cstring_literals" > #endif > /* LLVM LOCAL end */ > > > Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=65599&r1=65598&r2=65599&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) > +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Thu Feb 26 18:50:45 2009 > @@ -7181,6 +7181,11 @@ > TAI- > >getStringConstantPrefix() : > ".str", TheModule); > if (SlotP) *SlotP = GV; > +#ifdef LLVM_DARWIN_CSTRING_SECTION > + // For Darwin, try to put it into the .cstring section. > + if (TAI && TAI->SectionKindForGlobal(GV) == > SectionKind::RODataMergeStr) > + GV->setSection(LLVM_DARWIN_CSTRING_SECTION); > +#endif > return GV; > } > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From isanbard at gmail.com Fri Feb 27 00:09:23 2009 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 27 Feb 2009 06:09:23 -0000 Subject: [llvm-commits] [llvm] r65616 - /llvm/branches/Apple/Dib/include/llvm/Support/Timer.h Message-ID: <200902270609.n1R69Nvx020639@zion.cs.uiuc.edu> Author: void Date: Fri Feb 27 00:09:22 2009 New Revision: 65616 URL: http://llvm.org/viewvc/llvm-project?rev=65616&view=rev Log: Merge r64874 into Dib. Modified: llvm/branches/Apple/Dib/include/llvm/Support/Timer.h Modified: llvm/branches/Apple/Dib/include/llvm/Support/Timer.h URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/include/llvm/Support/Timer.h?rev=65616&r1=65615&r2=65616&view=diff ============================================================================== --- llvm/branches/Apple/Dib/include/llvm/Support/Timer.h (original) +++ llvm/branches/Apple/Dib/include/llvm/Support/Timer.h Fri Feb 27 00:09:22 2009 @@ -113,14 +113,19 @@ /// the relevant timer. This makes it easy to time a region of code. /// class TimeRegion { - Timer &T; + Timer *T; TimeRegion(const TimeRegion &); // DO NOT IMPLEMENT public: - explicit TimeRegion(Timer &t) : T(t) { - T.startTimer(); + explicit TimeRegion(Timer &t) : T(&t) { + T->startTimer(); + } + explicit TimeRegion(Timer *t) : T(t) { + if (T) + T->startTimer(); } ~TimeRegion() { - T.stopTimer(); + if (T) + T->stopTimer(); } }; From isanbard at gmail.com Fri Feb 27 00:13:31 2009 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 27 Feb 2009 06:13:31 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r65617 - in /llvm-gcc-4.2/branches/Apple/Dib/gcc: config/darwin.h llvm-convert.cpp Message-ID: <200902270613.n1R6DWhm020779@zion.cs.uiuc.edu> Author: void Date: Fri Feb 27 00:13:31 2009 New Revision: 65617 URL: http://llvm.org/viewvc/llvm-project?rev=65617&view=rev Log: Merge r65599 into Dib: Try, again, to send STRING_CSTs to the cstring section. This is a followup to r65490. Darwin-specific. Modified: llvm-gcc-4.2/branches/Apple/Dib/gcc/config/darwin.h llvm-gcc-4.2/branches/Apple/Dib/gcc/llvm-convert.cpp Modified: llvm-gcc-4.2/branches/Apple/Dib/gcc/config/darwin.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Dib/gcc/config/darwin.h?rev=65617&r1=65616&r2=65617&view=diff ============================================================================== --- llvm-gcc-4.2/branches/Apple/Dib/gcc/config/darwin.h (original) +++ llvm-gcc-4.2/branches/Apple/Dib/gcc/config/darwin.h Fri Feb 27 00:13:31 2009 @@ -679,6 +679,8 @@ } while (0) /* LLVM LOCAL - end radar 6389998 */ +/* Assign STRING_CSTs to the .cstring section. */ +#define LLVM_DARWIN_CSTRING_SECTION "__TEXT,__cstring,cstring_literals" #endif /* LLVM LOCAL end */ Modified: llvm-gcc-4.2/branches/Apple/Dib/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Dib/gcc/llvm-convert.cpp?rev=65617&r1=65616&r2=65617&view=diff ============================================================================== --- llvm-gcc-4.2/branches/Apple/Dib/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/branches/Apple/Dib/gcc/llvm-convert.cpp Fri Feb 27 00:13:31 2009 @@ -7346,6 +7346,11 @@ TAI->getStringConstantPrefix() : ".str", TheModule); if (SlotP) *SlotP = GV; +#ifdef LLVM_DARWIN_CSTRING_SECTION + // For Darwin, try to put it into the .cstring section. + if (TAI && TAI->SectionKindForGlobal(GV) == SectionKind::RODataMergeStr) + GV->setSection(LLVM_DARWIN_CSTRING_SECTION); +#endif return GV; } From nicholas at mxc.ca Fri Feb 27 00:29:32 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Fri, 27 Feb 2009 06:29:32 -0000 Subject: [llvm-commits] [llvm] r65620 - /llvm/trunk/lib/Transforms/Utils/AddrModeMatcher.cpp Message-ID: <200902270629.n1R6TW1P021330@zion.cs.uiuc.edu> Author: nicholas Date: Fri Feb 27 00:29:31 2009 New Revision: 65620 URL: http://llvm.org/viewvc/llvm-project?rev=65620&view=rev Log: Fix compiler warning about uninitialized variables. No functional change. Modified: llvm/trunk/lib/Transforms/Utils/AddrModeMatcher.cpp Modified: llvm/trunk/lib/Transforms/Utils/AddrModeMatcher.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/AddrModeMatcher.cpp?rev=65620&r1=65619&r2=65620&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/AddrModeMatcher.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/AddrModeMatcher.cpp Fri Feb 27 00:29:31 2009 @@ -94,7 +94,7 @@ // Okay, we decided that we can add ScaleReg+Scale to AddrMode. Check now // to see if ScaleReg is actually X+C. If so, we can turn this into adding // X*Scale + C*Scale to addr mode. - ConstantInt *CI; Value *AddLHS; + ConstantInt *CI = 0; Value *AddLHS = 0; if (isa(ScaleReg) && // not a constant expr. match(ScaleReg, m_Add(m_Value(AddLHS), m_ConstantInt(CI)))) { TestAddrMode.ScaledReg = AddLHS; From nicholas at mxc.ca Fri Feb 27 00:37:39 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Fri, 27 Feb 2009 06:37:39 -0000 Subject: [llvm-commits] [llvm] r65621 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200902270637.n1R6beiN021567@zion.cs.uiuc.edu> Author: nicholas Date: Fri Feb 27 00:37:39 2009 New Revision: 65621 URL: http://llvm.org/viewvc/llvm-project?rev=65621&view=rev Log: Silence compiler warning about use of uninitialized variables (in reality these are always set by reference on the path that uses them.) No functional change. Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=65621&r1=65620&r2=65621&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Fri Feb 27 00:37:39 2009 @@ -5822,7 +5822,7 @@ // See if we are doing a comparison with a constant. if (ConstantInt *CI = dyn_cast(Op1)) { - Value *A, *B; + Value *A = 0, *B = 0; // (icmp ne/eq (sub A B) 0) -> (icmp ne/eq A, B) if (I.isEquality() && CI->isNullValue() && From foldr at codedgers.com Fri Feb 27 00:46:55 2009 From: foldr at codedgers.com (Mikhail Glushenkov) Date: Fri, 27 Feb 2009 06:46:55 -0000 Subject: [llvm-commits] [llvm] r65623 - /llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp Message-ID: <200902270646.n1R6ktNs021878@zion.cs.uiuc.edu> Author: foldr Date: Fri Feb 27 00:46:55 2009 New Revision: 65623 URL: http://llvm.org/viewvc/llvm-project?rev=65623&view=rev Log: 'append_cmd' should split its argument. Makes '(append_cmd "-foo a b c")' work. Modified: llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp Modified: llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp?rev=65623&r1=65622&r2=65623&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp Fri Feb 27 00:46:55 2009 @@ -1422,7 +1422,12 @@ if (ActionName == "append_cmd") { checkNumberOfArguments(&Dag, 1); const std::string& Cmd = InitPtrToString(Dag.getArg(0)); - O << IndentLevel << "vec.push_back(\"" << Cmd << "\");\n"; + StrVector Out; + llvm::SplitString(Cmd, Out); + + for (StrVector::const_iterator B = Out.begin(), E = Out.end(); + B != E; ++B) + O << IndentLevel << "vec.push_back(\"" << *B << "\");\n"; } else if (ActionName == "error") { O << IndentLevel << "throw std::runtime_error(\"" << From kremenek at apple.com Fri Feb 27 01:01:33 2009 From: kremenek at apple.com (Ted Kremenek) Date: Fri, 27 Feb 2009 07:01:33 -0000 Subject: [llvm-commits] [llvm] r65624 - /llvm/trunk/docs/ReleaseNotes.html Message-ID: <200902270701.n1R71XU3022279@zion.cs.uiuc.edu> Author: kremenek Date: Fri Feb 27 01:01:32 2009 New Revision: 65624 URL: http://llvm.org/viewvc/llvm-project?rev=65624&view=rev Log: Update release notes for static analyzer. Modified: llvm/trunk/docs/ReleaseNotes.html Modified: llvm/trunk/docs/ReleaseNotes.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ReleaseNotes.html?rev=65624&r1=65623&r2=65624&view=diff ============================================================================== --- llvm/trunk/docs/ReleaseNotes.html (original) +++ llvm/trunk/docs/ReleaseNotes.html Fri Feb 27 01:01:32 2009 @@ -133,28 +133,25 @@
      -

      The Clang project also includes an early stage static source code analysis -tool for automatically -finding bugs in C and Objective-C programs. The tool performs a growing set -of checks to find bugs that occur on a specific path within a program. Examples -of bugs the tool finds include logic errors such as null dereferences, -violations of various API rules, dead code, and potential memory leaks in -Objective-C programs. Since its inception, public feedback on the tool has been -extremely positive, and conservative estimates put the number of real bugs it -has found in industrial-quality software on the order of thousands.

      - -

      The tool also provides a simple web GUI to inspect potential bugs found by -the tool. While still early in development, the GUI illustrates some of the key -features of Clang: accurate source location information, which is used by the -GUI to highlight specific code expressions that relate to a bug (including those -that span multiple lines); and built-in knowledge of macros, which is used to -perform inline expansion of macros within the GUI itself.

      - -

      The set of checks performed by the static analyzer is gradually expanding, -and future plans for the tool include full source-level inter-procedural -analysis and deeper checks such as buffer overrun detection. There are many -opportunities to extend and enhance the static analyzer, and anyone interested -in working on this project is encouraged to get involved!

      +

      Previously announced in the last LLVM release, the Clang project also +includes an early stage static source code analysis tool for automatically finding bugs +in C and Objective-C programs. The tool performs a growing set of checks to find +bugs that occur on a specific path within a program.

      + +

      In the LLVM 2.5 time-frame there have been many significant improvements to +the analyzer's core path simulation engine and machinery for generating +path-based bug reports to end-users. Particularly noteworthy improvements +include experimental support for full field-sensitivity and reasoning about heap +objects as well as an improved value-constraints subengine that does a much +better job of reasoning about inequality relationships (e.g., x > 2) +between variables and constants. + +

      The set of checks performed by the static analyzer continue to expand, and +future plans for the tool include full source-level inter-procedural analysis +and deeper checks such as buffer overrun detection. There are many opportunities +to extend and enhance the static analyzer, and anyone interested in working on +this project is encouraged to get involved!

      From baldrick at free.fr Fri Feb 27 01:49:20 2009 From: baldrick at free.fr (Duncan Sands) Date: Fri, 27 Feb 2009 08:49:20 +0100 Subject: [llvm-commits] SVN Trunk broken on LLVMHello.dll on Cygwin platform In-Reply-To: <9719867c0902261243i7e8ca9c7ueeec33627bff080b@mail.gmail.com> References: <9719867c0902261243i7e8ca9c7ueeec33627bff080b@mail.gmail.com> Message-ID: <200902270849.20609.baldrick@free.fr> Hi Aaron, > SVN appears to be broken since yesterday... which platform is this on? Thanks, Duncan. > Getting the following on a '--enable-pic=no' release build :- > ~~~~ > llvm[3]: Linking Release Loadable Module LLVMHello.dll > /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x16): > und > efined reference to `vtable for llvm::FunctionPass' > /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x14b): > un > defined reference to `llvm::PassInfo::registerPass()' > /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x1b2): > un > defined reference to `llvm::PassInfo::registerPass()' > /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x1ea): > un > defined reference to `vtable for llvm::FunctionPass' > /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x1f2): > un > defined reference to `llvm::Pass::~Pass()' > /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x216): > un > defined reference to `vtable for llvm::FunctionPass' > /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x22a): > un > defined reference to `vtable for llvm::FunctionPass' > /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x232): > un > defined reference to `llvm::Pass::~Pass()' > /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x291): > un > defined reference to `llvm::Value::getNameStr() const' > /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x29c): > un > defined reference to `llvm::EscapeString(std::basic_string std::char_trait > s, std::allocator >&)' > /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x2a1): > un > defined reference to `llvm::cerr' > /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x2c3): > un > defined reference to `llvm::cerr' > /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x2e3): > un > defined reference to `llvm::cerr' > /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x328): > un > defined reference to `llvm::Statistic::RegisterStatistic()' > /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x391): > un > defined reference to `llvm::Value::getNameStr() const' > /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x39c): > un > defined reference to `llvm::EscapeString(std::basic_string std::char_trait > s, std::allocator >&)' > /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x3a1): > un > defined reference to `llvm::cerr' > /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x3c3): > un > defined reference to `llvm::cerr' > /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x3e3): > un > defined reference to `llvm::cerr' > /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x428): > un > defined reference to `llvm::Statistic::RegisterStatistic()' > /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x1b): > und > efined reference to `llvm::Pass::~Pass()' > /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x21b): > un > defined reference to `llvm::Pass::~Pass()' > /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.rdata+0x70): > un > defined reference to `llvm::Pass::getPassName() const' > /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.rdata+0x74): > un > defined reference to `llvm::Pass::print(std::basic_ostream std::char_trait > s >&, llvm::Module const*) const' > /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.rdata+0x78): > un > defined reference to `llvm::FunctionPass::assignPassManager(llvm::PMStack&, > llvm > ::PassManagerType)' > /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.rdata+0x90): > un > defined reference to `llvm::Pass::dumpPassStructure(unsigned int)' > /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.rdata+0xa0): > un > defined reference to `llvm::FunctionPass::runOnModule(llvm::Module&)' > /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.rdata+0xf0): > un > defined reference to `llvm::Pass::getPassName() const' > /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.rdata+0xf4): > un > defined reference to `llvm::Pass::print(std::basic_ostream std::char_trait > s >&, llvm::Module const*) const' > ... > ~~~~ > > And the following on a straight debug build :- > ~~~~ > llvm[3]: Compiling Hello.cpp for Debug build (PIC) > /usr/src/llvm-backup/lib/Transforms/Hello/Hello.cpp:1: warning: -fPIC > ignored fo > r target (all code is position independent) > llvm[3]: Linking Debug Loadable Module LLVMHello.dll > /usr/build/llvm-tst/lib/Transforms/Hello/Debug/Hello.o: In function > `_ZN80_GLOBA > L__N__usr_src_llvm_backup_lib_Transforms_Hello_Hello.cpp_00000000_F77F77826Hello > 213runOnFunctionERN4llvm8FunctionE': > /usr/src/llvm-backup/lib/Transforms/Hello/Hello.cpp:53: undefined reference > to ` > llvm::EscapeString(std::basic_string, > std::allocato > r >&)' > /usr/src/llvm-backup/lib/Transforms/Hello/Hello.cpp:54: undefined reference > to ` > llvm::cerr' > /usr/build/llvm-tst/lib/Transforms/Hello/Debug/Hello.o: In function > `_ZN80_GLOBA > L__N__usr_src_llvm_backup_lib_Transforms_Hello_Hello.cpp_00000000_F77F77825Hello > 13runOnFunctionERN4llvm8FunctionE': > /usr/src/llvm-backup/lib/Transforms/Hello/Hello.cpp:34: undefined reference > to ` > llvm::EscapeString(std::basic_string, > std::allocato > r >&)' > /usr/src/llvm-backup/lib/Transforms/Hello/Hello.cpp:35: undefined reference > to ` > llvm::cerr' > /usr/build/llvm-tst/lib/Transforms/Hello/Debug/Hello.o: In function > `_ZSt17__ver > ify_groupingPKcjRKSs': > /usr/gcc-4.2.2/lib/gcc/i686-pc-cygwin/4.2.2/../../../../include/c++/4.2.2/bits/l > ocale_facets.tcc:2569: undefined reference to > `llvm::PassInfo::registerPass()' > /usr/gcc-4.2.2/lib/gcc/i686-pc-cygwin/4.2.2/../../../../include/c++/4.2.2/bits/l > ocale_facets.tcc:2570: undefined reference to `llvm::Pass::getPassName() > const' > /usr/gcc-4.2.2/lib/gcc/i686-pc-cygwin/4.2.2/../../../../include/c++/4.2.2/bits/l > ocale_facets.tcc:2575: undefined reference to > `llvm::Pass::print(std::basic_ostr > eam >&, llvm::Module const*) const' > /usr/gcc-4.2.2/lib/gcc/i686-pc-cygwin/4.2.2/../../../../include/c++/4.2.2/bits/l > ocale_facets.tcc:2575: undefined reference to > `llvm::FunctionPass::assignPassMan > ager(llvm::PMStack&, llvm::PassManagerType)' > /usr/gcc-4.2.2/lib/gcc/i686-pc-cygwin/4.2.2/../../../../include/c++/4.2.2/bits/l > ocale_facets.tcc:2576: undefined reference to > `llvm::Pass::dumpPassStructure(uns > igned int)' > /usr/gcc-4.2.2/lib/gcc/i686-pc-cygwin/4.2.2/../../../../include/c++/4.2.2/bits/l > ocale_facets.tcc:2576: undefined reference to > `llvm::FunctionPass::runOnModule(l > lvm::Module&)' > egisterPassIN80_GLOBAL__N__usr_src_llvm_backup_lib_Transforms_Hello_Hello.cpp_00 > 000000_F77F77825HelloEEC1EPKcS5_bb': > /usr/src/llvm-backup/include/llvm/PassSupport.h:175: undefined reference to > `llv > m::Pass::getPassName() const' > /usr/src/llvm-backup/include/llvm/PassSupport.h:175: undefined reference to > `llv > m::Pass::print(std::basic_ostream >&, > llvm::Module > const*) const' > ... > ~~~~ > > Aaron > From nicholas at mxc.ca Fri Feb 27 01:59:15 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Thu, 26 Feb 2009 23:59:15 -0800 Subject: [llvm-commits] SVN Trunk broken on LLVMHello.dll on Cygwin platform In-Reply-To: <200902270849.20609.baldrick@free.fr> References: <9719867c0902261243i7e8ca9c7ueeec33627bff080b@mail.gmail.com> <200902270849.20609.baldrick@free.fr> Message-ID: <49A79D53.7020200@mxc.ca> Duncan Sands wrote: > Hi Aaron, > >> SVN appears to be broken since yesterday... > > which platform is this on? The subject line claims it's Cygwin. :) I don't doubt that this is fallout from my recent build system changes, but I still don't know exactly how. Nick > > Thanks, > > Duncan. > >> Getting the following on a '--enable-pic=no' release build :- >> ~~~~ >> llvm[3]: Linking Release Loadable Module LLVMHello.dll >> /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x16): >> und >> efined reference to `vtable for llvm::FunctionPass' >> /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x14b): >> un >> defined reference to `llvm::PassInfo::registerPass()' >> /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x1b2): >> un >> defined reference to `llvm::PassInfo::registerPass()' >> /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x1ea): >> un >> defined reference to `vtable for llvm::FunctionPass' >> /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x1f2): >> un >> defined reference to `llvm::Pass::~Pass()' >> /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x216): >> un >> defined reference to `vtable for llvm::FunctionPass' >> /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x22a): >> un >> defined reference to `vtable for llvm::FunctionPass' >> /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x232): >> un >> defined reference to `llvm::Pass::~Pass()' >> /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x291): >> un >> defined reference to `llvm::Value::getNameStr() const' >> /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x29c): >> un >> defined reference to `llvm::EscapeString(std::basic_string> std::char_trait >> s, std::allocator >&)' >> /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x2a1): >> un >> defined reference to `llvm::cerr' >> /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x2c3): >> un >> defined reference to `llvm::cerr' >> /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x2e3): >> un >> defined reference to `llvm::cerr' >> /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x328): >> un >> defined reference to `llvm::Statistic::RegisterStatistic()' >> /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x391): >> un >> defined reference to `llvm::Value::getNameStr() const' >> /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x39c): >> un >> defined reference to `llvm::EscapeString(std::basic_string> std::char_trait >> s, std::allocator >&)' >> /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x3a1): >> un >> defined reference to `llvm::cerr' >> /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x3c3): >> un >> defined reference to `llvm::cerr' >> /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x3e3): >> un >> defined reference to `llvm::cerr' >> /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x428): >> un >> defined reference to `llvm::Statistic::RegisterStatistic()' >> /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x1b): >> und >> efined reference to `llvm::Pass::~Pass()' >> /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.text+0x21b): >> un >> defined reference to `llvm::Pass::~Pass()' >> /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.rdata+0x70): >> un >> defined reference to `llvm::Pass::getPassName() const' >> /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.rdata+0x74): >> un >> defined reference to `llvm::Pass::print(std::basic_ostream> std::char_trait >> s >&, llvm::Module const*) const' >> /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.rdata+0x78): >> un >> defined reference to `llvm::FunctionPass::assignPassManager(llvm::PMStack&, >> llvm >> ::PassManagerType)' >> /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.rdata+0x90): >> un >> defined reference to `llvm::Pass::dumpPassStructure(unsigned int)' >> /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.rdata+0xa0): >> un >> defined reference to `llvm::FunctionPass::runOnModule(llvm::Module&)' >> /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.rdata+0xf0): >> un >> defined reference to `llvm::Pass::getPassName() const' >> /usr/build/llvm/lib/Transforms/Hello/Release/Hello.o:Hello.cpp:(.rdata+0xf4): >> un >> defined reference to `llvm::Pass::print(std::basic_ostream> std::char_trait >> s >&, llvm::Module const*) const' >> ... >> ~~~~ >> >> And the following on a straight debug build :- >> ~~~~ >> llvm[3]: Compiling Hello.cpp for Debug build (PIC) >> /usr/src/llvm-backup/lib/Transforms/Hello/Hello.cpp:1: warning: -fPIC >> ignored fo >> r target (all code is position independent) >> llvm[3]: Linking Debug Loadable Module LLVMHello.dll >> /usr/build/llvm-tst/lib/Transforms/Hello/Debug/Hello.o: In function >> `_ZN80_GLOBA >> L__N__usr_src_llvm_backup_lib_Transforms_Hello_Hello.cpp_00000000_F77F77826Hello >> 213runOnFunctionERN4llvm8FunctionE': >> /usr/src/llvm-backup/lib/Transforms/Hello/Hello.cpp:53: undefined reference >> to ` >> llvm::EscapeString(std::basic_string, >> std::allocato >> r >&)' >> /usr/src/llvm-backup/lib/Transforms/Hello/Hello.cpp:54: undefined reference >> to ` >> llvm::cerr' >> /usr/build/llvm-tst/lib/Transforms/Hello/Debug/Hello.o: In function >> `_ZN80_GLOBA >> L__N__usr_src_llvm_backup_lib_Transforms_Hello_Hello.cpp_00000000_F77F77825Hello >> 13runOnFunctionERN4llvm8FunctionE': >> /usr/src/llvm-backup/lib/Transforms/Hello/Hello.cpp:34: undefined reference >> to ` >> llvm::EscapeString(std::basic_string, >> std::allocato >> r >&)' >> /usr/src/llvm-backup/lib/Transforms/Hello/Hello.cpp:35: undefined reference >> to ` >> llvm::cerr' >> /usr/build/llvm-tst/lib/Transforms/Hello/Debug/Hello.o: In function >> `_ZSt17__ver >> ify_groupingPKcjRKSs': >> /usr/gcc-4.2.2/lib/gcc/i686-pc-cygwin/4.2.2/../../../../include/c++/4.2.2/bits/l >> ocale_facets.tcc:2569: undefined reference to >> `llvm::PassInfo::registerPass()' >> /usr/gcc-4.2.2/lib/gcc/i686-pc-cygwin/4.2.2/../../../../include/c++/4.2.2/bits/l >> ocale_facets.tcc:2570: undefined reference to `llvm::Pass::getPassName() >> const' >> /usr/gcc-4.2.2/lib/gcc/i686-pc-cygwin/4.2.2/../../../../include/c++/4.2.2/bits/l >> ocale_facets.tcc:2575: undefined reference to >> `llvm::Pass::print(std::basic_ostr >> eam >&, llvm::Module const*) const' >> /usr/gcc-4.2.2/lib/gcc/i686-pc-cygwin/4.2.2/../../../../include/c++/4.2.2/bits/l >> ocale_facets.tcc:2575: undefined reference to >> `llvm::FunctionPass::assignPassMan >> ager(llvm::PMStack&, llvm::PassManagerType)' >> /usr/gcc-4.2.2/lib/gcc/i686-pc-cygwin/4.2.2/../../../../include/c++/4.2.2/bits/l >> ocale_facets.tcc:2576: undefined reference to >> `llvm::Pass::dumpPassStructure(uns >> igned int)' >> /usr/gcc-4.2.2/lib/gcc/i686-pc-cygwin/4.2.2/../../../../include/c++/4.2.2/bits/l >> ocale_facets.tcc:2576: undefined reference to >> `llvm::FunctionPass::runOnModule(l >> lvm::Module&)' >> egisterPassIN80_GLOBAL__N__usr_src_llvm_backup_lib_Transforms_Hello_Hello.cpp_00 >> 000000_F77F77825HelloEEC1EPKcS5_bb': >> /usr/src/llvm-backup/include/llvm/PassSupport.h:175: undefined reference to >> `llv >> m::Pass::getPassName() const' >> /usr/src/llvm-backup/include/llvm/PassSupport.h:175: undefined reference to >> `llv >> m::Pass::print(std::basic_ostream >&, >> llvm::Module >> const*) const' >> ... >> ~~~~ >> >> Aaron >> > > From ggreif at gmail.com Fri Feb 27 02:41:39 2009 From: ggreif at gmail.com (Gabor Greif) Date: Fri, 27 Feb 2009 08:41:39 -0000 Subject: [llvm-commits] [llvm] r65626 - in /llvm/trunk: include/llvm/ADT/ilist_node.h include/llvm/BasicBlock.h lib/VMCore/BasicBlock.cpp Message-ID: <200902270841.n1R8feFI027176@zion.cs.uiuc.edu> Author: ggreif Date: Fri Feb 27 02:41:37 2009 New Revision: 65626 URL: http://llvm.org/viewvc/llvm-project?rev=65626&view=rev Log: Introduce a new technique for merging BasicBlock with Instruction sentinel by superposition. This looks dangerous, but isn't because the sentinel is accessed in special way only, namely the Next and Prev fields of it, and these are guaranteed to exist. Modified: llvm/trunk/include/llvm/ADT/ilist_node.h llvm/trunk/include/llvm/BasicBlock.h llvm/trunk/lib/VMCore/BasicBlock.cpp Modified: llvm/trunk/include/llvm/ADT/ilist_node.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ilist_node.h?rev=65626&r1=65625&r2=65626&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/ilist_node.h (original) +++ llvm/trunk/include/llvm/ADT/ilist_node.h Fri Feb 27 02:41:37 2009 @@ -20,6 +20,9 @@ template struct ilist_nextprev_traits; +template +struct ilist_traits; + /// ilist_node - Base class that provides next/prev services for nodes /// that use ilist_nextprev_traits or ilist_default_traits. /// @@ -36,6 +39,7 @@ void setNext(NodeTy *N) { Next = N; } protected: ilist_node() : Prev(0), Next(0) {} + friend struct ilist_traits; }; } // End llvm namespace Modified: llvm/trunk/include/llvm/BasicBlock.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BasicBlock.h?rev=65626&r1=65625&r2=65626&view=diff ============================================================================== --- llvm/trunk/include/llvm/BasicBlock.h (original) +++ llvm/trunk/include/llvm/BasicBlock.h Fri Feb 27 02:41:37 2009 @@ -26,11 +26,15 @@ template<> struct ilist_traits : public SymbolTableListTraits { // createSentinel is used to create a node that marks the end of the list... - static Instruction *createSentinel(); - static void destroySentinel(Instruction *I) { delete I; } + Instruction *createSentinel() const { + return const_cast(static_cast(&Sentinel)); + } + static void destroySentinel(Instruction *I) { } static iplist &getList(BasicBlock *BB); static ValueSymbolTable *getSymTab(BasicBlock *ItemParent); static int getListOffset(); +private: + ilist_node Sentinel; }; /// This represents a single basic block in LLVM. A basic block is simply a @@ -49,9 +53,10 @@ /// @brief LLVM Basic Block Representation class BasicBlock : public Value, // Basic blocks are data objects also public ilist_node { + public: typedef iplist InstListType; -private : +private: InstListType InstList; Function *Parent; Modified: llvm/trunk/lib/VMCore/BasicBlock.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/BasicBlock.cpp?rev=65626&r1=65625&r2=65626&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/BasicBlock.cpp (original) +++ llvm/trunk/lib/VMCore/BasicBlock.cpp Fri Feb 27 02:41:37 2009 @@ -31,40 +31,6 @@ return 0; } - -namespace { - /// DummyInst - An instance of this class is used to mark the end of the - /// instruction list. This is not a real instruction. - struct VISIBILITY_HIDDEN DummyInst : public Instruction { - // allocate space for exactly zero operands - void *operator new(size_t s) { - return User::operator new(s, 0); - } - DummyInst() : Instruction(Type::VoidTy, OtherOpsEnd, 0, 0) { - // This should not be garbage monitored. - LeakDetector::removeGarbageObject(this); - } - - Instruction *clone() const { - assert(0 && "Cannot clone EOL");abort(); - return 0; - } - const char *getOpcodeName() const { return "*end-of-list-inst*"; } - - // Methods for support type inquiry through isa, cast, and dyn_cast... - static inline bool classof(const DummyInst *) { return true; } - static inline bool classof(const Instruction *I) { - return I->getOpcode() == OtherOpsEnd; - } - static inline bool classof(const Value *V) { - return isa(V) && classof(cast(V)); - } - }; -} - -Instruction *ilist_traits::createSentinel() { - return new DummyInst(); -} iplist &ilist_traits::getList(BasicBlock *BB) { return BB->getInstList(); } From ggreif at gmail.com Fri Feb 27 03:33:39 2009 From: ggreif at gmail.com (Gabor Greif) Date: Fri, 27 Feb 2009 09:33:39 -0000 Subject: [llvm-commits] [llvm] r65627 - /llvm/trunk/include/llvm/SymbolTableListTraits.h Message-ID: <200902270933.n1R9XdPX004907@zion.cs.uiuc.edu> Author: ggreif Date: Fri Feb 27 03:33:37 2009 New Revision: 65627 URL: http://llvm.org/viewvc/llvm-project?rev=65627&view=rev Log: fix comments Modified: llvm/trunk/include/llvm/SymbolTableListTraits.h Modified: llvm/trunk/include/llvm/SymbolTableListTraits.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/SymbolTableListTraits.h?rev=65627&r1=65626&r2=65627&view=diff ============================================================================== --- llvm/trunk/include/llvm/SymbolTableListTraits.h (original) +++ llvm/trunk/include/llvm/SymbolTableListTraits.h Fri Feb 27 03:33:37 2009 @@ -33,10 +33,8 @@ template class iplist; template struct ilist_traits; -// ValueSubClass - The type of objects that I hold, e.g. Instruction. -// ItemParentType - The type of object that owns the list, e.g. BasicBlock. -// TraitBaseClass - The class this trait should inherit from, it should -// inherit from ilist_traits +// ValueSubClass - The type of objects that I hold, e.g. Instruction. +// ItemParentClass - The type of object that owns the list, e.g. BasicBlock. // template class SymbolTableListTraits : public ilist_default_traits { From ggreif at gmail.com Fri Feb 27 05:37:49 2009 From: ggreif at gmail.com (Gabor Greif) Date: Fri, 27 Feb 2009 11:37:49 -0000 Subject: [llvm-commits] [llvm] r65629 - /llvm/trunk/docs/ProgrammersManual.html Message-ID: <200902271137.n1RBboXw009317@zion.cs.uiuc.edu> Author: ggreif Date: Fri Feb 27 05:37:41 2009 New Revision: 65629 URL: http://llvm.org/viewvc/llvm-project?rev=65629&view=rev Log: update ilist documentation and add some blurb on ilist_node Modified: llvm/trunk/docs/ProgrammersManual.html Modified: llvm/trunk/docs/ProgrammersManual.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ProgrammersManual.html?rev=65629&r1=65628&r2=65629&view=diff ============================================================================== --- llvm/trunk/docs/ProgrammersManual.html (original) +++ llvm/trunk/docs/ProgrammersManual.html Fri Feb 27 05:37:41 2009 @@ -54,7 +54,7 @@
    9. <vector>
    10. <deque>
    11. <list>
    12. -
    13. llvm/ADT/ilist
    14. +
    15. llvm/ADT/ilist.h
    16. Other Sequential Container Options
    17. Set-Like Containers (std::set, SmallSet, SetVector, etc) @@ -878,7 +878,7 @@
      @@ -895,6 +895,25 @@

      These properties are exactly what we want for things like Instructions and basic blocks, which is why these are implemented with ilists.

      + +Related classes of interest are explained in the following subsections: + +
      + + + + +
      +

      ilist_node<T> implements a the forward and backward links +that are expected by the ilist<T> (and analogous containers) +in the default manner.

      + +

      ilist_node<T>s are meant to be embedded in the node type +T.

      From ggreif at gmail.com Fri Feb 27 06:02:26 2009 From: ggreif at gmail.com (Gabor Greif) Date: Fri, 27 Feb 2009 12:02:26 -0000 Subject: [llvm-commits] [llvm] r65630 - /llvm/trunk/docs/ProgrammersManual.html Message-ID: <200902271202.n1RC2Q9G010193@zion.cs.uiuc.edu> Author: ggreif Date: Fri Feb 27 06:02:19 2009 New Revision: 65630 URL: http://llvm.org/viewvc/llvm-project?rev=65630&view=rev Log: Expand a bit on iplist. If you are more expert on this class, please review! Modified: llvm/trunk/docs/ProgrammersManual.html Modified: llvm/trunk/docs/ProgrammersManual.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ProgrammersManual.html?rev=65630&r1=65629&r2=65630&view=diff ============================================================================== --- llvm/trunk/docs/ProgrammersManual.html (original) +++ llvm/trunk/docs/ProgrammersManual.html Fri Feb 27 06:02:19 2009 @@ -886,24 +886,36 @@ intrusive, because it requires the element to store and provide access to the prev/next pointers for the list.

      -

      ilist has the same drawbacks as std::list, and additionally requires an -ilist_traits implementation for the element type, but it provides some novel -characteristics. In particular, it can efficiently store polymorphic objects, -the traits class is informed when an element is inserted or removed from the -list, and ilists are guaranteed to support a constant-time splice operation. -

      +

      ilist has the same drawbacks as std::list, and additionally +requires an ilist_traits implementation for the element type, but it +provides some novel characteristics. In particular, it can efficiently store +polymorphic objects, the traits class is informed when an element is inserted or +removed from the list, and ilists are guaranteed to support a constant-time splice +operation.

      -

      These properties are exactly what we want for things like Instructions and -basic blocks, which is why these are implemented with ilists.

      +

      These properties are exactly what we want for things like Instructions +and basic blocks, which is why these are implemented with ilists.

      Related classes of interest are explained in the following subsections:
    18. + iplist +
      + +
      +

      iplist<T> is ilist<T>'s base and as such +supports a slightly narrower interface. Notably, inserters from T& +are absent.

      +
      + + + From ggreif at gmail.com Fri Feb 27 07:28:14 2009 From: ggreif at gmail.com (Gabor Greif) Date: Fri, 27 Feb 2009 13:28:14 -0000 Subject: [llvm-commits] [llvm] r65631 - /llvm/trunk/docs/ProgrammersManual.html Message-ID: <200902271328.n1RDSFUK013144@zion.cs.uiuc.edu> Author: ggreif Date: Fri Feb 27 07:28:07 2009 New Revision: 65631 URL: http://llvm.org/viewvc/llvm-project?rev=65631&view=rev Log: document ilist_traits Modified: llvm/trunk/docs/ProgrammersManual.html Modified: llvm/trunk/docs/ProgrammersManual.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ProgrammersManual.html?rev=65631&r1=65630&r2=65631&view=diff ============================================================================== --- llvm/trunk/docs/ProgrammersManual.html (original) +++ llvm/trunk/docs/ProgrammersManual.html Fri Feb 27 07:28:07 2009 @@ -898,6 +898,7 @@ Related classes of interest are explained in the following subsections: @@ -905,6 +906,17 @@ + +
      +

      ilist_traits<T> is ilist<T>'s customization +mechanism. iplist<T> (and consequently ilist<T>) +publicly derive from this traits class.

      +
      + + + @@ -912,6 +924,9 @@

      iplist<T> is ilist<T>'s base and as such supports a slightly narrower interface. Notably, inserters from T& are absent.

      + +

      ilist_traits<T> is a public base of this class and can be +used for a wide variety of customizations.

    From rafael.espindola at gmail.com Fri Feb 27 07:37:26 2009 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Fri, 27 Feb 2009 13:37:26 -0000 Subject: [llvm-commits] [llvm] r65632 - in /llvm/trunk: include/llvm/Target/ lib/CodeGen/SelectionDAG/ lib/Target/X86/ lib/Target/X86/AsmPrinter/ test/CodeGen/X86/ Message-ID: <200902271337.n1RDbRLY013538@zion.cs.uiuc.edu> Author: rafael Date: Fri Feb 27 07:37:18 2009 New Revision: 65632 URL: http://llvm.org/viewvc/llvm-project?rev=65632&view=rev Log: Refactor TLS code and add some tests. The tests and expected results are: pic | declaration | linkage | visibility | !pic | declaration | external | default | tls1.ll tls2.ll | local exec pic | declaration | external | default | tls1-pic.ll tls2-pic.ll | general dynamic !pic | !declaration | external | default | tls3.ll tls4.ll | initial exec pic | !declaration | external | default | tls3-pic.ll tls4-pic.ll | general dynamic !pic | declaration | external | hidden | tls7.ll tls8.ll | local exec pic | declaration | external | hidden | X | local dynamic !pic | !declaration | external | hidden | tls9.ll tls10.ll | local exec pic | !declaration | external | hidden | X | local dynamic !pic | declaration | internal | default | tls5.ll tls6.ll | local exec pic | declaration | internal | default | X | local dynamic The ones marked with an X have not been implemented since local dynamic is not implemented. Added: llvm/trunk/test/CodeGen/X86/tls1-pic.ll llvm/trunk/test/CodeGen/X86/tls10.ll llvm/trunk/test/CodeGen/X86/tls2-pic.ll llvm/trunk/test/CodeGen/X86/tls3-pic.ll llvm/trunk/test/CodeGen/X86/tls3.ll llvm/trunk/test/CodeGen/X86/tls4-pic.ll llvm/trunk/test/CodeGen/X86/tls4.ll llvm/trunk/test/CodeGen/X86/tls5.ll llvm/trunk/test/CodeGen/X86/tls6.ll llvm/trunk/test/CodeGen/X86/tls7.ll llvm/trunk/test/CodeGen/X86/tls8.ll llvm/trunk/test/CodeGen/X86/tls9.ll Modified: llvm/trunk/include/llvm/Target/TargetLowering.h llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/test/CodeGen/X86/tls1.ll llvm/trunk/test/CodeGen/X86/tls2.ll Modified: llvm/trunk/include/llvm/Target/TargetLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=65632&r1=65631&r2=65632&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetLowering.h (original) +++ llvm/trunk/include/llvm/Target/TargetLowering.h Fri Feb 27 07:37:18 2009 @@ -30,6 +30,7 @@ #include "llvm/ADT/SmallSet.h" #include "llvm/ADT/STLExtras.h" #include "llvm/CodeGen/DebugLoc.h" +#include "llvm/Target/TargetMachine.h" #include #include #include @@ -54,6 +55,18 @@ class TargetSubtarget; class Value; + // FIXME: should this be here? + namespace TLSModel { + enum Model { + GeneralDynamic, + LocalDynamic, + InitialExec, + LocalExec + }; + } + TLSModel::Model getTLSModel(const GlobalValue *GV, Reloc::Model reloc); + + //===----------------------------------------------------------------------===// /// TargetLowering - This class defines information used to lower LLVM code to /// legal SelectionDAG operators that the target instruction selector can accept Modified: llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp?rev=65632&r1=65631&r2=65632&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp Fri Feb 27 07:37:18 2009 @@ -26,6 +26,28 @@ #include "llvm/Support/MathExtras.h" using namespace llvm; +namespace llvm { +TLSModel::Model getTLSModel(const GlobalValue *GV, Reloc::Model reloc) { + bool isLocal = GV->hasLocalLinkage(); + bool isDeclaration = GV->isDeclaration(); + // FIXME: what should we do for protected and internal visibility? + // For variables, is internal different from hidden? + bool isHidden = GV->hasHiddenVisibility(); + + if (reloc == Reloc::PIC_) { + if (isLocal || isHidden) + return TLSModel::LocalDynamic; + else + return TLSModel::GeneralDynamic; + } else { + if (!isDeclaration || isHidden) + return TLSModel::LocalExec; + else + return TLSModel::InitialExec; + } +} +} + /// InitLibcallNames - Set default libcall names. /// static void InitLibcallNames(const char **Names) { Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp?rev=65632&r1=65631&r2=65632&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Fri Feb 27 07:37:18 2009 @@ -439,13 +439,30 @@ printOffset(MO.getOffset()); if (isThreadLocal) { - if (TM.getRelocationModel() == Reloc::PIC_ || Subtarget->is64Bit()) - O << "@TLSGD"; // general dynamic TLS model - else - if (GV->isDeclaration()) - O << "@INDNTPOFF"; // initial exec TLS model + TLSModel::Model model = getTLSModel(GVar, TM.getRelocationModel()); + switch (model) { + case TLSModel::GeneralDynamic: + O << "@TLSGD"; + break; + case TLSModel::LocalDynamic: + // O << "@TLSLD"; // local dynamic not implemented + O << "@TLSGD"; + break; + case TLSModel::InitialExec: + if (Subtarget->is64Bit()) + O << "@TLSGD"; // 64 bit intial exec not implemented else - O << "@NTPOFF"; // local exec TLS model + O << "@INDNTPOFF"; + break; + case TLSModel::LocalExec: + if (Subtarget->is64Bit()) + O << "@TLSGD"; // 64 bit local exec not implemented + else + O << "@NTPOFF"; + break; + default: + assert (0 && "Unknown TLS model"); + } } else if (isMemOp) { if (shouldPrintGOT(TM, Subtarget)) { if (Subtarget->GVRequiresExtraLoad(GV, TM, false)) Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=65632&r1=65631&r2=65632&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Fri Feb 27 07:37:18 2009 @@ -4795,7 +4795,7 @@ // Lower ISD::GlobalTLSAddress using the "initial exec" (for no-pic) or // "local exec" model. static SDValue LowerToTLSExecModel(GlobalAddressSDNode *GA, SelectionDAG &DAG, - const MVT PtrVT) { + const MVT PtrVT, TLSModel::Model model) { DebugLoc dl = GA->getDebugLoc(); // Get the Thread Pointer SDValue ThreadPointer = DAG.getNode(X86ISD::THREAD_POINTER, @@ -4807,7 +4807,7 @@ GA->getOffset()); SDValue Offset = DAG.getNode(X86ISD::Wrapper, dl, PtrVT, TGA); - if (GA->getGlobal()->isDeclaration()) // initial exec TLS model + if (model == TLSModel::InitialExec) Offset = DAG.getLoad(PtrVT, dl, DAG.getEntryNode(), Offset, PseudoSourceValue::getGOT(), 0); @@ -4823,15 +4823,31 @@ assert(Subtarget->isTargetELF() && "TLS not implemented for non-ELF targets"); GlobalAddressSDNode *GA = cast(Op); - // If the relocation model is PIC, use the "General Dynamic" TLS Model, - // otherwise use the "Local Exec"TLS Model + GlobalValue *GV = GA->getGlobal(); + TLSModel::Model model = + getTLSModel (GV, getTargetMachine().getRelocationModel()); if (Subtarget->is64Bit()) { - return LowerToTLSGeneralDynamicModel64(GA, DAG, getPointerTy()); + switch (model) { + case TLSModel::GeneralDynamic: + case TLSModel::LocalDynamic: // not implemented + case TLSModel::InitialExec: // not implemented + case TLSModel::LocalExec: // not implemented + return LowerToTLSGeneralDynamicModel64(GA, DAG, getPointerTy()); + default: + assert (0 && "Unknown TLS model"); + } } else { - if (getTargetMachine().getRelocationModel() == Reloc::PIC_) + switch (model) { + case TLSModel::GeneralDynamic: + case TLSModel::LocalDynamic: // not implemented return LowerToTLSGeneralDynamicModel32(GA, DAG, getPointerTy()); - else - return LowerToTLSExecModel(GA, DAG, getPointerTy()); + + case TLSModel::InitialExec: + case TLSModel::LocalExec: + return LowerToTLSExecModel(GA, DAG, getPointerTy(), model); + default: + assert (0 && "Unknown TLS model"); + } } } Added: llvm/trunk/test/CodeGen/X86/tls1-pic.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/tls1-pic.ll?rev=65632&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/tls1-pic.ll (added) +++ llvm/trunk/test/CodeGen/X86/tls1-pic.ll Fri Feb 27 07:37:18 2009 @@ -0,0 +1,11 @@ +; RUN: llvm-as < %s | llc -march=x86 -mtriple=i386-linux-gnu -relocation-model=pic > %t +; RUN: grep {leal i at TLSGD(,%ebx,1), %eax} %t +; RUN: grep {call ___tls_get_addr at PLT} %t + + at i = thread_local global i32 15 + +define i32 @f() { +entry: + %tmp1 = load i32* @i + ret i32 %tmp1 +} Modified: llvm/trunk/test/CodeGen/X86/tls1.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/tls1.ll?rev=65632&r1=65631&r2=65632&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/tls1.ll (original) +++ llvm/trunk/test/CodeGen/X86/tls1.ll Fri Feb 27 07:37:18 2009 @@ -1,19 +1,10 @@ -; RUN: llvm-as < %s | llc -march=x86 -mtriple=i386-linux-gnu | \ -; RUN: grep {movl %gs:i at NTPOFF, %eax} -; RUN: llvm-as < %s | llc -march=x86 -mtriple=i386-linux-gnu | \ -; RUN: grep {leal i at NTPOFF(%eax), %eax} -; RUN: llvm-as < %s | llc -march=x86 -mtriple=i386-linux-gnu -relocation-model=pic | \ -; RUN: grep {leal i at TLSGD(,%ebx,1), %eax} +; RUN: llvm-as < %s | llc -march=x86 -mtriple=i386-linux-gnu > %t +; RUN: grep {movl %gs:i at NTPOFF, %eax} %t - at i = thread_local global i32 15 ; [#uses=2] + at i = thread_local global i32 15 define i32 @f() { entry: - %tmp1 = load i32* @i ; [#uses=1] + %tmp1 = load i32* @i ret i32 %tmp1 } - -define i32* @g() { -entry: - ret i32* @i -} Added: llvm/trunk/test/CodeGen/X86/tls10.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/tls10.ll?rev=65632&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/tls10.ll (added) +++ llvm/trunk/test/CodeGen/X86/tls10.ll Fri Feb 27 07:37:18 2009 @@ -0,0 +1,10 @@ +; RUN: llvm-as < %s | llc -march=x86 -mtriple=i386-linux-gnu > %t +; RUN: grep {movl %gs:0, %eax} %t +; RUN: grep {leal i at NTPOFF(%eax), %eax} %t + + at i = external hidden thread_local global i32 + +define i32* @f() { +entry: + ret i32* @i +} Added: llvm/trunk/test/CodeGen/X86/tls2-pic.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/tls2-pic.ll?rev=65632&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/tls2-pic.ll (added) +++ llvm/trunk/test/CodeGen/X86/tls2-pic.ll Fri Feb 27 07:37:18 2009 @@ -0,0 +1,10 @@ +; RUN: llvm-as < %s | llc -march=x86 -mtriple=i386-linux-gnu -relocation-model=pic > %t +; RUN: grep {leal i at TLSGD(,%ebx,1), %eax} %t +; RUN: grep {call ___tls_get_addr at PLT} %t + + at i = thread_local global i32 15 + +define i32* @f() { +entry: + ret i32* @i +} Modified: llvm/trunk/test/CodeGen/X86/tls2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/tls2.ll?rev=65632&r1=65631&r2=65632&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/tls2.ll (original) +++ llvm/trunk/test/CodeGen/X86/tls2.ll Fri Feb 27 07:37:18 2009 @@ -1,19 +1,10 @@ -; RUN: llvm-as < %s | llc -march=x86 -mtriple=i386-linux-gnu | \ -; RUN: grep {movl %gs:(%eax), %eax} -; RUN: llvm-as < %s | llc -march=x86 -mtriple=i386-linux-gnu | \ -; RUN: grep {addl i at INDNTPOFF, %eax} -; RUN: llvm-as < %s | llc -march=x86 -mtriple=i386-linux-gnu -relocation-model=pic | \ -; RUN: grep {leal i at TLSGD(,%ebx,1), %eax} +; RUN: llvm-as < %s | llc -march=x86 -mtriple=i386-linux-gnu > %t +; RUN: grep {movl %gs:0, %eax} %t +; RUN: grep {leal i at NTPOFF(%eax), %eax} %t - at i = external thread_local global i32 ; [#uses=2] + at i = thread_local global i32 15 -define i32 @f() { -entry: - %tmp1 = load i32* @i ; [#uses=1] - ret i32 %tmp1 -} - -define i32* @g() { +define i32* @f() { entry: ret i32* @i } Added: llvm/trunk/test/CodeGen/X86/tls3-pic.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/tls3-pic.ll?rev=65632&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/tls3-pic.ll (added) +++ llvm/trunk/test/CodeGen/X86/tls3-pic.ll Fri Feb 27 07:37:18 2009 @@ -0,0 +1,11 @@ +; RUN: llvm-as < %s | llc -march=x86 -mtriple=i386-linux-gnu -relocation-model=pic > %t +; RUN: grep {leal i at TLSGD(,%ebx,1), %eax} %t +; RUN: grep {call ___tls_get_addr at PLT} %t + + at i = external thread_local global i32 ; [#uses=2] + +define i32 @f() { +entry: + %tmp1 = load i32* @i ; [#uses=1] + ret i32 %tmp1 +} Added: llvm/trunk/test/CodeGen/X86/tls3.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/tls3.ll?rev=65632&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/tls3.ll (added) +++ llvm/trunk/test/CodeGen/X86/tls3.ll Fri Feb 27 07:37:18 2009 @@ -0,0 +1,11 @@ +; RUN: llvm-as < %s | llc -march=x86 -mtriple=i386-linux-gnu > %t +; RUN: grep {movl i at INDNTPOFF, %eax} %t +; RUN: grep {movl %gs:(%eax), %eax} %t + + at i = external thread_local global i32 ; [#uses=2] + +define i32 @f() { +entry: + %tmp1 = load i32* @i ; [#uses=1] + ret i32 %tmp1 +} Added: llvm/trunk/test/CodeGen/X86/tls4-pic.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/tls4-pic.ll?rev=65632&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/tls4-pic.ll (added) +++ llvm/trunk/test/CodeGen/X86/tls4-pic.ll Fri Feb 27 07:37:18 2009 @@ -0,0 +1,10 @@ +; RUN: llvm-as < %s | llc -march=x86 -mtriple=i386-linux-gnu -relocation-model=pic > %t +; RUN: grep {leal i at TLSGD(,%ebx,1), %eax} %t +; RUN: grep {call ___tls_get_addr at PLT} %t + + at i = external thread_local global i32 ; [#uses=2] + +define i32* @f() { +entry: + ret i32* @i +} Added: llvm/trunk/test/CodeGen/X86/tls4.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/tls4.ll?rev=65632&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/tls4.ll (added) +++ llvm/trunk/test/CodeGen/X86/tls4.ll Fri Feb 27 07:37:18 2009 @@ -0,0 +1,10 @@ +; RUN: llvm-as < %s | llc -march=x86 -mtriple=i386-linux-gnu > %t +; RUN: grep {movl %gs:0, %eax} %t +; RUN: grep {addl i at INDNTPOFF, %eax} %t + + at i = external thread_local global i32 ; [#uses=2] + +define i32* @f() { +entry: + ret i32* @i +} Added: llvm/trunk/test/CodeGen/X86/tls5.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/tls5.ll?rev=65632&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/tls5.ll (added) +++ llvm/trunk/test/CodeGen/X86/tls5.ll Fri Feb 27 07:37:18 2009 @@ -0,0 +1,10 @@ +; RUN: llvm-as < %s | llc -march=x86 -mtriple=i386-linux-gnu > %t +; RUN: grep {movl %gs:i at NTPOFF, %eax} %t + + at i = internal thread_local global i32 15 + +define i32 @f() { +entry: + %tmp1 = load i32* @i + ret i32 %tmp1 +} Added: llvm/trunk/test/CodeGen/X86/tls6.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/tls6.ll?rev=65632&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/tls6.ll (added) +++ llvm/trunk/test/CodeGen/X86/tls6.ll Fri Feb 27 07:37:18 2009 @@ -0,0 +1,10 @@ +; RUN: llvm-as < %s | llc -march=x86 -mtriple=i386-linux-gnu > %t +; RUN: grep {movl %gs:0, %eax} %t +; RUN: grep {leal i at NTPOFF(%eax), %eax} %t + + at i = internal thread_local global i32 15 + +define i32* @f() { +entry: + ret i32* @i +} Added: llvm/trunk/test/CodeGen/X86/tls7.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/tls7.ll?rev=65632&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/tls7.ll (added) +++ llvm/trunk/test/CodeGen/X86/tls7.ll Fri Feb 27 07:37:18 2009 @@ -0,0 +1,10 @@ +; RUN: llvm-as < %s | llc -march=x86 -mtriple=i386-linux-gnu > %t +; RUN: grep {movl %gs:i at NTPOFF, %eax} %t + + at i = hidden thread_local global i32 15 + +define i32 @f() { +entry: + %tmp1 = load i32* @i + ret i32 %tmp1 +} Added: llvm/trunk/test/CodeGen/X86/tls8.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/tls8.ll?rev=65632&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/tls8.ll (added) +++ llvm/trunk/test/CodeGen/X86/tls8.ll Fri Feb 27 07:37:18 2009 @@ -0,0 +1,10 @@ +; RUN: llvm-as < %s | llc -march=x86 -mtriple=i386-linux-gnu > %t +; RUN: grep {movl %gs:0, %eax} %t +; RUN: grep {leal i at NTPOFF(%eax), %eax} %t + + at i = hidden thread_local global i32 15 + +define i32* @f() { +entry: + ret i32* @i +} Added: llvm/trunk/test/CodeGen/X86/tls9.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/tls9.ll?rev=65632&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/tls9.ll (added) +++ llvm/trunk/test/CodeGen/X86/tls9.ll Fri Feb 27 07:37:18 2009 @@ -0,0 +1,10 @@ +; RUN: llvm-as < %s | llc -march=x86 -mtriple=i386-linux-gnu > %t +; RUN: grep {movl %gs:i at NTPOFF, %eax} %t + + at i = external hidden thread_local global i32 + +define i32 @f() { +entry: + %tmp1 = load i32* @i + ret i32 %tmp1 +} From ggreif at gmail.com Fri Feb 27 09:46:31 2009 From: ggreif at gmail.com (Gabor Greif) Date: Fri, 27 Feb 2009 15:46:31 -0000 Subject: [llvm-commits] [llvm] r65633 - /llvm/trunk/include/llvm/ADT/ilist_node.h Message-ID: <200902271546.n1RFkWwe017870@zion.cs.uiuc.edu> Author: ggreif Date: Fri Feb 27 09:46:23 2009 New Revision: 65633 URL: http://llvm.org/viewvc/llvm-project?rev=65633&view=rev Log: group friendship Modified: llvm/trunk/include/llvm/ADT/ilist_node.h Modified: llvm/trunk/include/llvm/ADT/ilist_node.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ilist_node.h?rev=65633&r1=65632&r2=65633&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/ilist_node.h (original) +++ llvm/trunk/include/llvm/ADT/ilist_node.h Fri Feb 27 09:46:23 2009 @@ -30,6 +30,7 @@ class ilist_node { private: friend struct ilist_nextprev_traits; + friend struct ilist_traits; NodeTy *Prev, *Next; NodeTy *getPrev() { return Prev; } NodeTy *getNext() { return Next; } @@ -39,7 +40,6 @@ void setNext(NodeTy *N) { Next = N; } protected: ilist_node() : Prev(0), Next(0) {} - friend struct ilist_traits; }; } // End llvm namespace From baldrick at free.fr Fri Feb 27 10:45:54 2009 From: baldrick at free.fr (Duncan Sands) Date: Fri, 27 Feb 2009 16:45:54 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r65634 - /llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Message-ID: <200902271645.n1RGjsdY019951@zion.cs.uiuc.edu> Author: baldrick Date: Fri Feb 27 10:45:52 2009 New Revision: 65634 URL: http://llvm.org/viewvc/llvm-project?rev=65634&view=rev Log: Turn variable length arrays such as "char A[n]" into [0 x i8] rather than i8. Not only does this seem more logical, but it also means that, in the case of variable sized Ada types, the LLVM type will never be larger than the smallest possible version of the LLVM type, which has some theoretical importance (though doesn't seem to matter much in practice). Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp?rev=65634&r1=65633&r2=65634&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Fri Feb 27 10:45:52 2009 @@ -906,9 +906,9 @@ } // This handles cases like "int A[n]" which have a runtime constant - // number of elements, but is a compile-time variable. Since these are - // variable sized, we just represent them as the element themself. - return TypeDB.setType(type, ConvertType(TREE_TYPE(type))); + // number of elements, but is a compile-time variable. Since these + // are variable sized, we represent them as A[0]. + return TypeDB.setType(type, ArrayType::get(ConvertType(TREE_TYPE(type)),0)); } case OFFSET_TYPE: // Handle OFFSET_TYPE specially. This is used for pointers to members, @@ -2120,6 +2120,7 @@ TREE_CODE(DECL_FIELD_OFFSET(Field)) == INTEGER_CST) { uint64_t FieldOffsetInBits = getFieldOffsetInBits(Field); tree FieldType = getDeclaredType(Field); + const Type *FieldTy = ConvertType(FieldType); // If this is a bitfield, we may want to adjust the FieldOffsetInBits to // produce safe code. In particular, bitfields will be loaded/stored as @@ -2127,7 +2128,6 @@ // them. As such, we need to respect the alignment of the declared type. if (isBitfield(Field)) { // If this is a bitfield, the declared type must be an integral type. - const Type *FieldTy = ConvertType(FieldType); unsigned BitAlignment = Info->getTypeAlignment(FieldTy)*8; FieldOffsetInBits &= ~(BitAlignment-1ULL); @@ -2141,10 +2141,9 @@ continue; } - // Figure out if this field is zero bits wide, e.g. {} or [0 x int]. Do - // not include variable sized fields here. - bool isZeroSizeField = !TYPE_SIZE(FieldType) || - integer_zerop(TYPE_SIZE(FieldType)); + // Figure out if this field is zero bits wide, e.g. {} or [0 x int]. + bool isZeroSizeField = FieldTy->isSized() && + getTargetData().getTypeSizeInBits(FieldTy) == 0; unsigned FieldNo = Info->getLLVMFieldFor(FieldOffsetInBits, CurFieldNo, isZeroSizeField); From sabre at nondot.org Fri Feb 27 11:00:25 2009 From: sabre at nondot.org (Chris Lattner) Date: Fri, 27 Feb 2009 17:00:25 -0000 Subject: [llvm-commits] [test-suite] r65636 - /test-suite/trunk/SingleSource/Benchmarks/Misc/mandel-2.c Message-ID: <200902271700.n1RH0Pxv020472@zion.cs.uiuc.edu> Author: lattner Date: Fri Feb 27 11:00:25 2009 New Revision: 65636 URL: http://llvm.org/viewvc/llvm-project?rev=65636&view=rev Log: add Jon Harrop's text-mandelbrot. Added: test-suite/trunk/SingleSource/Benchmarks/Misc/mandel-2.c Added: test-suite/trunk/SingleSource/Benchmarks/Misc/mandel-2.c URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Benchmarks/Misc/mandel-2.c?rev=65636&view=auto ============================================================================== --- test-suite/trunk/SingleSource/Benchmarks/Misc/mandel-2.c (added) +++ test-suite/trunk/SingleSource/Benchmarks/Misc/mandel-2.c Fri Feb 27 11:00:25 2009 @@ -0,0 +1,28 @@ +#include +#include +#include + +int max_i = 65536; + +double sqr(double x) { return x*x; } + +double cnorm2(complex z) { return sqr(creal(z)) + sqr(cimag(z)); } + +int loop(complex c) { + complex z=c; + int i=1; + while (cnorm2(z) <= 4.0 && i++ < max_i) + z = z*z + c; + return i; +} + +int main() { + int i, j; + for (j = -39; j < 39; ++j) { + for (i = -39; i < 39; ++i) + printf(loop(j/40.0-0.5 + i/40.0*I) > max_i ? "*" : " "); + printf("\n"); + } + return 0; +} + From criswell at uiuc.edu Fri Feb 27 11:28:26 2009 From: criswell at uiuc.edu (John Criswell) Date: Fri, 27 Feb 2009 17:28:26 -0000 Subject: [llvm-commits] [poolalloc] r65640 - /poolalloc/trunk/lib/PoolAllocate/Makefile Message-ID: <200902271728.n1RHSQMa021487@zion.cs.uiuc.edu> Author: criswell Date: Fri Feb 27 11:28:26 2009 New Revision: 65640 URL: http://llvm.org/viewvc/llvm-project?rev=65640&view=rev Log: Remove unneeded -r option which now causes the link to fail. Modified: poolalloc/trunk/lib/PoolAllocate/Makefile Modified: poolalloc/trunk/lib/PoolAllocate/Makefile URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/Makefile?rev=65640&r1=65639&r2=65640&view=diff ============================================================================== --- poolalloc/trunk/lib/PoolAllocate/Makefile (original) +++ poolalloc/trunk/lib/PoolAllocate/Makefile Fri Feb 27 11:28:26 2009 @@ -15,6 +15,6 @@ # include $(LEVEL)/Makefile.common -LDFLAGS += -lLLVMDataStructure -r $(LibDir) +LDFLAGS += -lLLVMDataStructure CFLAGS += -fPIC From dpatel at apple.com Fri Feb 27 12:05:21 2009 From: dpatel at apple.com (Devang Patel) Date: Fri, 27 Feb 2009 18:05:21 -0000 Subject: [llvm-commits] [llvm] r65643 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp Message-ID: <200902271805.n1RI5LvW022942@zion.cs.uiuc.edu> Author: dpatel Date: Fri Feb 27 12:05:21 2009 New Revision: 65643 URL: http://llvm.org/viewvc/llvm-project?rev=65643&view=rev Log: It is possible that subprgoram definition is only encoding return value directly, instsad of an DIArray of all argument types. Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp?rev=65643&r1=65642&r2=65643&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp Fri Feb 27 12:05:21 2009 @@ -1888,8 +1888,12 @@ DIArray Args = SPTy.getTypeArray(); // Add Return Type. - if (!IsConstructor) - AddType(DW_Unit, SPDie, DIType(Args.getElement(0).getGV())); + if (!IsConstructor) { + if (Args.isNull()) + AddType(DW_Unit, SPDie, SPTy); + else + AddType(DW_Unit, SPDie, DIType(Args.getElement(0).getGV())); + } if (!SP.isDefinition()) { AddUInt(SPDie, DW_AT_declaration, DW_FORM_flag, 1); From stuart at apple.com Fri Feb 27 16:32:38 2009 From: stuart at apple.com (Stuart Hastings) Date: Fri, 27 Feb 2009 22:32:38 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r65654 - in /llvm-gcc-4.2/trunk/gcc: config/darwin.h llvm-convert.cpp Message-ID: <200902272232.n1RMWmEt032184@zion.cs.uiuc.edu> Author: stuart Date: Fri Feb 27 16:32:05 2009 New Revision: 65654 URL: http://llvm.org/viewvc/llvm-project?rev=65654&view=rev Log: Per Chris, shorten LLVM_DARWIN_CSTRING_SECTION to LLVM_CSTRING_SECTION for portability. Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.h llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/darwin.h?rev=65654&r1=65653&r2=65654&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/darwin.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/darwin.h Fri Feb 27 16:32:05 2009 @@ -690,7 +690,7 @@ /* LLVM LOCAL - end radar 6389998 */ /* Assign STRING_CSTs to the .cstring section. */ -#define LLVM_DARWIN_CSTRING_SECTION "__TEXT,__cstring,cstring_literals" +#define LLVM_CSTRING_SECTION "__TEXT,__cstring,cstring_literals" #endif /* LLVM LOCAL end */ Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=65654&r1=65653&r2=65654&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Fri Feb 27 16:32:05 2009 @@ -7181,10 +7181,10 @@ TAI->getStringConstantPrefix() : ".str", TheModule); if (SlotP) *SlotP = GV; -#ifdef LLVM_DARWIN_CSTRING_SECTION +#ifdef LLVM_CSTRING_SECTION // For Darwin, try to put it into the .cstring section. if (TAI && TAI->SectionKindForGlobal(GV) == SectionKind::RODataMergeStr) - GV->setSection(LLVM_DARWIN_CSTRING_SECTION); + GV->setSection(LLVM_CSTRING_SECTION); #endif return GV; } From stuart at apple.com Fri Feb 27 16:35:27 2009 From: stuart at apple.com (Stuart Hastings) Date: Fri, 27 Feb 2009 22:35:27 -0000 Subject: [llvm-commits] [llvm] r65655 - /llvm/trunk/test/FrontendC/2009-02-27-CString.c Message-ID: <200902272235.n1RMZT31032350@zion.cs.uiuc.edu> Author: stuart Date: Fri Feb 27 16:35:12 2009 New Revision: 65655 URL: http://llvm.org/viewvc/llvm-project?rev=65655&view=rev Log: Testcase to insure C strings go to the cstring section. Darwin-specific. Added: llvm/trunk/test/FrontendC/2009-02-27-CString.c Added: llvm/trunk/test/FrontendC/2009-02-27-CString.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC/2009-02-27-CString.c?rev=65655&view=auto ============================================================================== --- llvm/trunk/test/FrontendC/2009-02-27-CString.c (added) +++ llvm/trunk/test/FrontendC/2009-02-27-CString.c Fri Feb 27 16:35:12 2009 @@ -0,0 +1,11 @@ +/* RUN: %llvmgcc %s -S -o - -emit-llvm | \ + RUN: egrep {CSTRING SECTION.\*section.\*__TEXT,.\*__cstring} + XFAIL: * + TARGET: *-*-darwin* + END. + Insure that stings go to the cstring section. This test is + intended solely for Darwin targets. + */ +char *foo() { + return "this string should go to the CSTRING SECTION"; +} From jlerouge at apple.com Fri Feb 27 17:18:48 2009 From: jlerouge at apple.com (Julien Lerouge) Date: Fri, 27 Feb 2009 15:18:48 -0800 Subject: [llvm-commits] SVN Trunk broken on LLVMHello.dll on Cygwin platform In-Reply-To: <49A79D53.7020200@mxc.ca> References: <9719867c0902261243i7e8ca9c7ueeec33627bff080b@mail.gmail.com> <200902270849.20609.baldrick@free.fr> <49A79D53.7020200@mxc.ca> Message-ID: <20090227231847.GD26886@pom.apple.com> On Thu, Feb 26, 2009 at 11:59:15PM -0800, Nick Lewycky wrote: > Duncan Sands wrote: > > Hi Aaron, > > > >> SVN appears to be broken since yesterday... > > > > which platform is this on? > > The subject line claims it's Cygwin. :) > > I don't doubt that this is fallout from my recent build system changes, > but I still don't know exactly how. > > Nick Same error on MingW as well. It started between 65440 and 65525. Julien -- Julien Lerouge PGP Key Id: 0xB1964A62 PGP Fingerprint: 392D 4BAD DB8B CE7F 4E5F FA3C 62DB 4AA7 B196 4A62 PGP Public Key from: keyserver.pgp.com From anton at korobeynikov.info Fri Feb 27 17:26:52 2009 From: anton at korobeynikov.info (Anton Korobeynikov) Date: Sat, 28 Feb 2009 02:26:52 +0300 Subject: [llvm-commits] SVN Trunk broken on LLVMHello.dll on Cygwin platform In-Reply-To: <20090227231847.GD26886@pom.apple.com> References: <9719867c0902261243i7e8ca9c7ueeec33627bff080b@mail.gmail.com> <200902270849.20609.baldrick@free.fr> <49A79D53.7020200@mxc.ca> <20090227231847.GD26886@pom.apple.com> Message-ID: <53FA7913-690A-4FA8-B7BC-1385F59584BE@korobeynikov.info> > > Same error on MingW as well. It started between 65440 and 65525. That's correct. This is not possible to have undefined symbols in shared libraries on windows (aka .dll's). libtool just "silenced" this error based on target information. The proper solution is not to build hello at all on windows targets. Nick is aware about the problem and solution, stay tuned! :) --- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090228/7478193a/attachment.html From isanbard at gmail.com Fri Feb 27 17:31:20 2009 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 27 Feb 2009 23:31:20 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r65660 - in /llvm-gcc-4.2/branches/Apple/Dib/gcc: config/darwin.h llvm-convert.cpp Message-ID: <200902272331.n1RNVO69002005@zion.cs.uiuc.edu> Author: void Date: Fri Feb 27 17:31:00 2009 New Revision: 65660 URL: http://llvm.org/viewvc/llvm-project?rev=65660&view=rev Log: Merge r65654 into Dib: Per Chris, shorten LLVM_DARWIN_CSTRING_SECTION to LLVM_CSTRING_SECTION for portability. Modified: llvm-gcc-4.2/branches/Apple/Dib/gcc/config/darwin.h llvm-gcc-4.2/branches/Apple/Dib/gcc/llvm-convert.cpp Modified: llvm-gcc-4.2/branches/Apple/Dib/gcc/config/darwin.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Dib/gcc/config/darwin.h?rev=65660&r1=65659&r2=65660&view=diff ============================================================================== --- llvm-gcc-4.2/branches/Apple/Dib/gcc/config/darwin.h (original) +++ llvm-gcc-4.2/branches/Apple/Dib/gcc/config/darwin.h Fri Feb 27 17:31:00 2009 @@ -680,7 +680,7 @@ /* LLVM LOCAL - end radar 6389998 */ /* Assign STRING_CSTs to the .cstring section. */ -#define LLVM_DARWIN_CSTRING_SECTION "__TEXT,__cstring,cstring_literals" +#define LLVM_CSTRING_SECTION "__TEXT,__cstring,cstring_literals" #endif /* LLVM LOCAL end */ Modified: llvm-gcc-4.2/branches/Apple/Dib/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Dib/gcc/llvm-convert.cpp?rev=65660&r1=65659&r2=65660&view=diff ============================================================================== --- llvm-gcc-4.2/branches/Apple/Dib/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/branches/Apple/Dib/gcc/llvm-convert.cpp Fri Feb 27 17:31:00 2009 @@ -7346,10 +7346,10 @@ TAI->getStringConstantPrefix() : ".str", TheModule); if (SlotP) *SlotP = GV; -#ifdef LLVM_DARWIN_CSTRING_SECTION +#ifdef LLVM_CSTRING_SECTION // For Darwin, try to put it into the .cstring section. if (TAI && TAI->SectionKindForGlobal(GV) == SectionKind::RODataMergeStr) - GV->setSection(LLVM_DARWIN_CSTRING_SECTION); + GV->setSection(LLVM_CSTRING_SECTION); #endif return GV; } From isanbard at gmail.com Fri Feb 27 17:54:29 2009 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 27 Feb 2009 23:54:29 -0000 Subject: [llvm-commits] [llvm] r65661 - /llvm/branches/Apple/Dib/lib/Target/PowerPC/PPCSubtarget.h Message-ID: <200902272354.n1RNsUrS002748@zion.cs.uiuc.edu> Author: void Date: Fri Feb 27 17:54:28 2009 New Revision: 65661 URL: http://llvm.org/viewvc/llvm-project?rev=65661&view=rev Log: --- Merging (from foreign repository) r65601 into '.': U lib/Target/PowerPC/PPCSubtarget.h Alignment values for i64 and f64 on ppc64 were wrong, possibly for the reason suggested by the comment. No wonder it didn't work very well. This unblocks bootstrap with assertions on ppc. Modified: llvm/branches/Apple/Dib/lib/Target/PowerPC/PPCSubtarget.h Modified: llvm/branches/Apple/Dib/lib/Target/PowerPC/PPCSubtarget.h URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/PowerPC/PPCSubtarget.h?rev=65661&r1=65660&r2=65661&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/PowerPC/PPCSubtarget.h (original) +++ llvm/branches/Apple/Dib/lib/Target/PowerPC/PPCSubtarget.h Fri Feb 27 17:54:28 2009 @@ -108,7 +108,9 @@ /// getTargetDataString - Return the pointer size and type alignment /// properties of this subtarget. const char *getTargetDataString() const { - return isPPC64() ? "E-p:64:64-f64:32:64-i64:32:64-f128:64:128" + // Note, the alignment values for f64 and i64 on ppc64 in Darwin + // documentation are wrong; these are correct (i.e. "what gcc does"). + return isPPC64() ? "E-p:64:64-f64:64:64-i64:64:64-f128:64:128" : "E-p:32:32-f64:32:64-i64:32:64-f128:64:128"; } From wangmp at apple.com Fri Feb 27 18:25:30 2009 From: wangmp at apple.com (Mon P Wang) Date: Sat, 28 Feb 2009 00:25:30 -0000 Subject: [llvm-commits] [llvm] r65662 - /llvm/trunk/lib/Target/X86/X86Subtarget.cpp Message-ID: <200902280025.n1S0PUnK003818@zion.cs.uiuc.edu> Author: wangmp Date: Fri Feb 27 18:25:30 2009 New Revision: 65662 URL: http://llvm.org/viewvc/llvm-project?rev=65662&view=rev Log: Added another darwin subtarget Modified: llvm/trunk/lib/Target/X86/X86Subtarget.cpp Modified: llvm/trunk/lib/Target/X86/X86Subtarget.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.cpp?rev=65662&r1=65661&r2=65662&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86Subtarget.cpp (original) +++ llvm/trunk/lib/Target/X86/X86Subtarget.cpp Fri Feb 27 18:25:30 2009 @@ -369,6 +369,10 @@ } else if (TT.find("windows") != std::string::npos) { TargetType = isWindows; } + else if (TT.find("-cl") != std::string::npos) { + TargetType = isDarwin; + DarwinVers = 9; + } } else if (TT.empty()) { #if defined(__CYGWIN__) TargetType = isCygwin; From kremenek at apple.com Fri Feb 27 18:44:32 2009 From: kremenek at apple.com (Ted Kremenek) Date: Sat, 28 Feb 2009 00:44:32 -0000 Subject: [llvm-commits] [llvm] r65664 - /llvm/tags/checker/checker-0.166/ Message-ID: <200902280044.n1S0iWF4004417@zion.cs.uiuc.edu> Author: kremenek Date: Fri Feb 27 18:44:32 2009 New Revision: 65664 URL: http://llvm.org/viewvc/llvm-project?rev=65664&view=rev Log: Tagging checker-0.166. Added: llvm/tags/checker/checker-0.166/ - copied from r65663, llvm/trunk/ From stuart at apple.com Fri Feb 27 18:56:37 2009 From: stuart at apple.com (Stuart Hastings) Date: Sat, 28 Feb 2009 00:56:37 -0000 Subject: [llvm-commits] [llvm] r65667 - /llvm/trunk/test/FrontendC/2009-02-27-CString.c Message-ID: <200902280056.n1S0ubrO004764@zion.cs.uiuc.edu> Author: stuart Date: Fri Feb 27 18:56:37 2009 New Revision: 65667 URL: http://llvm.org/viewvc/llvm-project?rev=65667&view=rev Log: Unable to say "TARGET: *-*-darwin*"; falling back to "XFAIL: linux,ia64,alpha,sparc". Modified: llvm/trunk/test/FrontendC/2009-02-27-CString.c Modified: llvm/trunk/test/FrontendC/2009-02-27-CString.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC/2009-02-27-CString.c?rev=65667&r1=65666&r2=65667&view=diff ============================================================================== --- llvm/trunk/test/FrontendC/2009-02-27-CString.c (original) +++ llvm/trunk/test/FrontendC/2009-02-27-CString.c Fri Feb 27 18:56:37 2009 @@ -1,6 +1,6 @@ /* RUN: %llvmgcc %s -S -o - -emit-llvm | \ RUN: egrep {CSTRING SECTION.\*section.\*__TEXT,.\*__cstring} - XFAIL: * + XFAIL: linux,ia64,alpha,sparc TARGET: *-*-darwin* END. Insure that stings go to the cstring section. This test is From evan.cheng at apple.com Fri Feb 27 19:10:24 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Sat, 28 Feb 2009 01:10:24 -0000 Subject: [llvm-commits] [llvm] r65670 - /llvm/trunk/include/llvm/BasicBlock.h Message-ID: <200902280110.n1S1AOG6005200@zion.cs.uiuc.edu> Author: evancheng Date: Fri Feb 27 19:10:24 2009 New Revision: 65670 URL: http://llvm.org/viewvc/llvm-project?rev=65670&view=rev Log: Avoid unused parameter warning. Modified: llvm/trunk/include/llvm/BasicBlock.h Modified: llvm/trunk/include/llvm/BasicBlock.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BasicBlock.h?rev=65670&r1=65669&r2=65670&view=diff ============================================================================== --- llvm/trunk/include/llvm/BasicBlock.h (original) +++ llvm/trunk/include/llvm/BasicBlock.h Fri Feb 27 19:10:24 2009 @@ -29,7 +29,7 @@ Instruction *createSentinel() const { return const_cast(static_cast(&Sentinel)); } - static void destroySentinel(Instruction *I) { } + static void destroySentinel(Instruction *I) { I = I; } static iplist &getList(BasicBlock *BB); static ValueSymbolTable *getSymTab(BasicBlock *ItemParent); static int getListOffset(); From isanbard at gmail.com Fri Feb 27 19:18:05 2009 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 27 Feb 2009 17:18:05 -0800 Subject: [llvm-commits] [llvm] r65670 - /llvm/trunk/include/llvm/BasicBlock.h In-Reply-To: <200902280110.n1S1AOG6005200@zion.cs.uiuc.edu> References: <200902280110.n1S1AOG6005200@zion.cs.uiuc.edu> Message-ID: <16e5fdf90902271718m37eb4a52nb8782b34929e7351@mail.gmail.com> Why not just remove the "I" from the declaration? -bw On Fri, Feb 27, 2009 at 5:10 PM, Evan Cheng wrote: > Author: evancheng > Date: Fri Feb 27 19:10:24 2009 > New Revision: 65670 > > URL: http://llvm.org/viewvc/llvm-project?rev=65670&view=rev > Log: > Avoid unused parameter warning. > > Modified: > ? ?llvm/trunk/include/llvm/BasicBlock.h > > Modified: llvm/trunk/include/llvm/BasicBlock.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BasicBlock.h?rev=65670&r1=65669&r2=65670&view=diff > > ============================================================================== > --- llvm/trunk/include/llvm/BasicBlock.h (original) > +++ llvm/trunk/include/llvm/BasicBlock.h Fri Feb 27 19:10:24 2009 > @@ -29,7 +29,7 @@ > ? Instruction *createSentinel() const { > ? ? return const_cast(static_cast(&Sentinel)); > ? } > - ?static void destroySentinel(Instruction *I) { } > + ?static void destroySentinel(Instruction *I) { I = I; } > ? static iplist &getList(BasicBlock *BB); > ? static ValueSymbolTable *getSymTab(BasicBlock *ItemParent); > ? static int getListOffset(); > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From evan.cheng at apple.com Fri Feb 27 19:33:05 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Sat, 28 Feb 2009 01:33:05 -0000 Subject: [llvm-commits] [llvm] r65672 - /llvm/branches/Apple/Dib/lib/Transforms/Scalar/ScalarReplAggregates.cpp Message-ID: <200902280133.n1S1X57d005859@zion.cs.uiuc.edu> Author: evancheng Date: Fri Feb 27 19:33:05 2009 New Revision: 65672 URL: http://llvm.org/viewvc/llvm-project?rev=65672&view=rev Log: Do not turn aggregate whose size exceeeds threshold into arbitrary large scalar. Modified: llvm/branches/Apple/Dib/lib/Transforms/Scalar/ScalarReplAggregates.cpp Modified: llvm/branches/Apple/Dib/lib/Transforms/Scalar/ScalarReplAggregates.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Transforms/Scalar/ScalarReplAggregates.cpp?rev=65672&r1=65671&r2=65672&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Transforms/Scalar/ScalarReplAggregates.cpp (original) +++ llvm/branches/Apple/Dib/lib/Transforms/Scalar/ScalarReplAggregates.cpp Fri Feb 27 19:33:05 2009 @@ -286,7 +286,8 @@ const Type *VectorTy = 0; bool HadAVector = false; if (CanConvertToScalar(AI, IsNotTrivial, VectorTy, HadAVector, - 0, unsigned(AllocaSize)) && IsNotTrivial) { + 0, unsigned(AllocaSize)) && IsNotTrivial && + AllocaSize <= SRThreshold) { AllocaInst *NewAI; // If we were able to find a vector type that can handle this with // insert/extract elements, and if there was at least one use that had From evan.cheng at apple.com Fri Feb 27 19:34:26 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 27 Feb 2009 17:34:26 -0800 Subject: [llvm-commits] [llvm] r65670 - /llvm/trunk/include/llvm/BasicBlock.h In-Reply-To: <16e5fdf90902271718m37eb4a52nb8782b34929e7351@mail.gmail.com> References: <200902280110.n1S1AOG6005200@zion.cs.uiuc.edu> <16e5fdf90902271718m37eb4a52nb8782b34929e7351@mail.gmail.com> Message-ID: Dunno. Is the parameter there for a reason? Evan On Feb 27, 2009, at 5:18 PM, Bill Wendling wrote: > Why not just remove the "I" from the declaration? > > -bw > > On Fri, Feb 27, 2009 at 5:10 PM, Evan Cheng > wrote: >> Author: evancheng >> Date: Fri Feb 27 19:10:24 2009 >> New Revision: 65670 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=65670&view=rev >> Log: >> Avoid unused parameter warning. >> >> Modified: >> llvm/trunk/include/llvm/BasicBlock.h >> >> Modified: llvm/trunk/include/llvm/BasicBlock.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BasicBlock.h?rev=65670&r1=65669&r2=65670&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/include/llvm/BasicBlock.h (original) >> +++ llvm/trunk/include/llvm/BasicBlock.h Fri Feb 27 19:10:24 2009 >> @@ -29,7 +29,7 @@ >> Instruction *createSentinel() const { >> return const_cast(static_cast> Instruction*>(&Sentinel)); >> } >> - static void destroySentinel(Instruction *I) { } >> + static void destroySentinel(Instruction *I) { I = I; } >> static iplist &getList(BasicBlock *BB); >> static ValueSymbolTable *getSymTab(BasicBlock *ItemParent); >> static int getListOffset(); >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From isanbard at gmail.com Fri Feb 27 19:42:32 2009 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 27 Feb 2009 17:42:32 -0800 Subject: [llvm-commits] [llvm] r65670 - /llvm/trunk/include/llvm/BasicBlock.h In-Reply-To: References: <200902280110.n1S1AOG6005200@zion.cs.uiuc.edu> <16e5fdf90902271718m37eb4a52nb8782b34929e7351@mail.gmail.com> Message-ID: <16e5fdf90902271742ldb07293m4f7fb9bdfb36cebc@mail.gmail.com> Normally the parameter is there to give information about what kind of argument should be passed in. For instance "virtual void foo(unsigned Flag) {}". Here "I" has no information, but the type does. So the parameter isn't needed. -bw On Fri, Feb 27, 2009 at 5:34 PM, Evan Cheng wrote: > Dunno. Is the parameter there for a reason? > > Evan > > On Feb 27, 2009, at 5:18 PM, Bill Wendling wrote: > >> Why not just remove the "I" from the declaration? >> >> -bw >> >> On Fri, Feb 27, 2009 at 5:10 PM, Evan Cheng >> wrote: >>> Author: evancheng >>> Date: Fri Feb 27 19:10:24 2009 >>> New Revision: 65670 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=65670&view=rev >>> Log: >>> Avoid unused parameter warning. >>> >>> Modified: >>> ? ?llvm/trunk/include/llvm/BasicBlock.h >>> >>> Modified: llvm/trunk/include/llvm/BasicBlock.h >>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BasicBlock.h?rev=65670&r1=65669&r2=65670&view=diff >>> >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> ===================================================================== >>> --- llvm/trunk/include/llvm/BasicBlock.h (original) >>> +++ llvm/trunk/include/llvm/BasicBlock.h Fri Feb 27 19:10:24 2009 >>> @@ -29,7 +29,7 @@ >>> ? Instruction *createSentinel() const { >>> ? ? return const_cast(static_cast>> Instruction*>(&Sentinel)); >>> ? } >>> - ?static void destroySentinel(Instruction *I) { } >>> + ?static void destroySentinel(Instruction *I) { I = I; } >>> ? static iplist &getList(BasicBlock *BB); >>> ? static ValueSymbolTable *getSymTab(BasicBlock *ItemParent); >>> ? static int getListOffset(); >>> >>> >>> _______________________________________________ >>> llvm-commits mailing list >>> llvm-commits at cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >>> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From isanbard at gmail.com Fri Feb 27 19:57:49 2009 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 28 Feb 2009 01:57:49 -0000 Subject: [llvm-commits] [llvm] r65673 - /llvm/branches/Apple/Dib/lib/Target/X86/X86Subtarget.cpp Message-ID: <200902280157.n1S1vncj006589@zion.cs.uiuc.edu> Author: void Date: Fri Feb 27 19:57:49 2009 New Revision: 65673 URL: http://llvm.org/viewvc/llvm-project?rev=65673&view=rev Log: Merge r65662 into Dib: Added another darwin subtarget Modified: llvm/branches/Apple/Dib/lib/Target/X86/X86Subtarget.cpp Modified: llvm/branches/Apple/Dib/lib/Target/X86/X86Subtarget.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/X86/X86Subtarget.cpp?rev=65673&r1=65672&r2=65673&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/Target/X86/X86Subtarget.cpp (original) +++ llvm/branches/Apple/Dib/lib/Target/X86/X86Subtarget.cpp Fri Feb 27 19:57:49 2009 @@ -369,6 +369,10 @@ } else if (TT.find("windows") != std::string::npos) { TargetType = isWindows; } + else if (TT.find("-cl") != std::string::npos) { + TargetType = isDarwin; + DarwinVers = 9; + } } else if (TT.empty()) { #if defined(__CYGWIN__) TargetType = isCygwin; From isanbard at gmail.com Fri Feb 27 19:59:55 2009 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 28 Feb 2009 01:59:55 -0000 Subject: [llvm-commits] [llvm] r65674 - /llvm/tags/Apple/llvmCore-2100/ Message-ID: <200902280159.n1S1xtaO006655@zion.cs.uiuc.edu> Author: void Date: Fri Feb 27 19:59:54 2009 New Revision: 65674 URL: http://llvm.org/viewvc/llvm-project?rev=65674&view=rev Log: Creating llvmCore-2100 from Dib. Added: llvm/tags/Apple/llvmCore-2100/ - copied from r65673, llvm/branches/Apple/Dib/ From isanbard at gmail.com Fri Feb 27 20:00:14 2009 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 28 Feb 2009 02:00:14 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r65675 - /llvm-gcc-4.2/tags/Apple/llvmgcc42-2100/ Message-ID: <200902280200.n1S20E25006676@zion.cs.uiuc.edu> Author: void Date: Fri Feb 27 20:00:14 2009 New Revision: 65675 URL: http://llvm.org/viewvc/llvm-project?rev=65675&view=rev Log: Creating llvmgcc42-2100 from Dib. Added: llvm-gcc-4.2/tags/Apple/llvmgcc42-2100/ - copied from r65674, llvm-gcc-4.2/branches/Apple/Dib/ From isanbard at gmail.com Fri Feb 27 20:14:08 2009 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 27 Feb 2009 18:14:08 -0800 Subject: [llvm-commits] [llvm] r65643 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp In-Reply-To: <200902271805.n1RI5LvW022942@zion.cs.uiuc.edu> References: <200902271805.n1RI5LvW022942@zion.cs.uiuc.edu> Message-ID: <71D10A62-8273-4061-BDB5-2057BE0244CA@gmail.com> Should this go into Dib? -bw On Feb 27, 2009, at 10:05 AM, Devang Patel wrote: > Author: dpatel > Date: Fri Feb 27 12:05:21 2009 > New Revision: 65643 > > URL: http://llvm.org/viewvc/llvm-project?rev=65643&view=rev > Log: > It is possible that subprgoram definition is only encoding return > value directly, instsad of an DIArray of all argument types. > > > Modified: > llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp > > Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp?rev=65643&r1=65642&r2=65643&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp (original) > +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp Fri Feb 27 > 12:05:21 2009 > @@ -1888,8 +1888,12 @@ > DIArray Args = SPTy.getTypeArray(); > > // Add Return Type. > - if (!IsConstructor) > - AddType(DW_Unit, SPDie, DIType(Args.getElement(0).getGV())); > + if (!IsConstructor) { > + if (Args.isNull()) > + AddType(DW_Unit, SPDie, SPTy); > + else > + AddType(DW_Unit, SPDie, DIType(Args.getElement(0).getGV())); > + } > > if (!SP.isDefinition()) { > AddUInt(SPDie, DW_AT_declaration, DW_FORM_flag, 1); > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From evan.cheng at apple.com Sat Feb 28 00:02:15 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Sat, 28 Feb 2009 06:02:15 -0000 Subject: [llvm-commits] [llvm] r65679 - in /llvm/trunk: lib/CodeGen/VirtRegMap.cpp test/CodeGen/ARM/2009-02-27-SpillerBug.ll Message-ID: <200902280602.n1S62Fmu013605@zion.cs.uiuc.edu> Author: evancheng Date: Sat Feb 28 00:02:14 2009 New Revision: 65679 URL: http://llvm.org/viewvc/llvm-project?rev=65679&view=rev Log: Last commit accidentially deleted this code. Added: llvm/trunk/test/CodeGen/ARM/2009-02-27-SpillerBug.ll Modified: llvm/trunk/lib/CodeGen/VirtRegMap.cpp Modified: llvm/trunk/lib/CodeGen/VirtRegMap.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/VirtRegMap.cpp?rev=65679&r1=65678&r2=65679&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/VirtRegMap.cpp (original) +++ llvm/trunk/lib/CodeGen/VirtRegMap.cpp Sat Feb 28 00:02:14 2009 @@ -1637,6 +1637,10 @@ PotentialDeadStoreSlots.push_back(ReuseSlot); } + // Assumes this is the last use. IsKill will be unset if reg is reused + // unless it's a two-address operand. + if (ti == -1) + MI.getOperand(i).setIsKill(); continue; } // CanReuse Added: llvm/trunk/test/CodeGen/ARM/2009-02-27-SpillerBug.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2009-02-27-SpillerBug.ll?rev=65679&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/ARM/2009-02-27-SpillerBug.ll (added) +++ llvm/trunk/test/CodeGen/ARM/2009-02-27-SpillerBug.ll Sat Feb 28 00:02:14 2009 @@ -0,0 +1,229 @@ +; RUN: llvm-as < %s | llc -march=arm -mattr=+v6,+vfp2 + +target triple = "arm-apple-darwin9" + at a = external global double ; [#uses=1] + at N = external global double ; [#uses=1] + +declare double @llvm.exp.f64(double) nounwind readonly + +define fastcc void @findratio(double* nocapture %res1, double* nocapture %res2) nounwind { +bb.thread: + br label %bb52 + +bb32: ; preds = %bb52 + %0 = add double 0.000000e+00, 0.000000e+00 ; [#uses=1] + %1 = add i32 %j.1, 1 ; [#uses=1] + br label %bb52 + +bb52: ; preds = %bb53, %bb32, %bb.thread + %i.3494 = phi i32 [ 0, %bb.thread ], [ %3, %bb53 ], [ %i.3494, %bb32 ] ; [#uses=2] + %k.4 = phi double [ %0, %bb32 ], [ 0.000000e+00, %bb53 ], [ 0.000000e+00, %bb.thread ] ; [#uses=2] + %j.1 = phi i32 [ %1, %bb32 ], [ 0, %bb53 ], [ 0, %bb.thread ] ; [#uses=2] + %2 = icmp sgt i32 %j.1, 99 ; [#uses=1] + br i1 %2, label %bb53, label %bb32 + +bb53: ; preds = %bb52 + %3 = add i32 %i.3494, 1 ; [#uses=2] + %phitmp = icmp sgt i32 %3, 999999 ; [#uses=1] + br i1 %phitmp, label %bb55, label %bb52 + +bb55: ; preds = %bb53 + %4 = load double* @a, align 4 ; [#uses=10] + %5 = add double %4, 0.000000e+00 ; [#uses=16] + %6 = fcmp ogt double %k.4, 0.000000e+00 ; [#uses=1] + %.pn404 = mul double %4, %4 ; [#uses=4] + %.pn402 = mul double %5, %5 ; [#uses=5] + %.pn165.in = load double* @N ; [#uses=5] + %.pn198 = mul double 0.000000e+00, %5 ; [#uses=1] + %.pn185 = sub double -0.000000e+00, 0.000000e+00 ; [#uses=1] + %.pn147 = sub double -0.000000e+00, 0.000000e+00 ; [#uses=1] + %.pn141 = fdiv double 0.000000e+00, %4 ; [#uses=1] + %.pn142 = fdiv double 0.000000e+00, %5 ; [#uses=1] + %.pn136 = fdiv double 0.000000e+00, 0.000000e+00 ; [#uses=1] + %.pn132 = fdiv double 0.000000e+00, %5 ; [#uses=1] + %.pn123 = fdiv double 0.000000e+00, 0.000000e+00 ; [#uses=1] + %.pn124 = fdiv double 0.000000e+00, %.pn198 ; [#uses=1] + %.pn120 = fdiv double 0.000000e+00, 0.000000e+00 ; [#uses=1] + %.pn117 = fdiv double 0.000000e+00, %4 ; [#uses=1] + %.pn118 = fdiv double %.pn185, %5 ; [#uses=1] + %.pn88 = fdiv double %.pn147, %5 ; [#uses=1] + %.pn81 = sub double %.pn141, %.pn142 ; [#uses=1] + %.pn77 = sub double 0.000000e+00, %.pn136 ; [#uses=1] + %.pn75 = sub double 0.000000e+00, %.pn132 ; [#uses=1] + %.pn69 = sub double %.pn123, %.pn124 ; [#uses=1] + %.pn67 = sub double 0.000000e+00, %.pn120 ; [#uses=1] + %.pn56 = sub double %.pn117, %.pn118 ; [#uses=1] + %.pn42 = sub double 0.000000e+00, %.pn88 ; [#uses=1] + %.pn60 = mul double %.pn81, 0.000000e+00 ; [#uses=1] + %.pn57 = add double %.pn77, 0.000000e+00 ; [#uses=1] + %.pn58 = mul double %.pn75, %.pn165.in ; [#uses=1] + %.pn32 = add double %.pn69, 0.000000e+00 ; [#uses=1] + %.pn33 = mul double %.pn67, %.pn165.in ; [#uses=1] + %.pn17 = sub double 0.000000e+00, %.pn60 ; [#uses=1] + %.pn9 = add double %.pn57, %.pn58 ; [#uses=1] + %.pn30 = mul double 0.000000e+00, %.pn56 ; [#uses=1] + %.pn24 = mul double 0.000000e+00, %.pn42 ; [#uses=1] + %.pn1 = add double %.pn32, %.pn33 ; [#uses=1] + %.pn28 = sub double %.pn30, 0.000000e+00 ; [#uses=1] + %.pn26 = add double %.pn28, 0.000000e+00 ; [#uses=1] + %.pn22 = sub double %.pn26, 0.000000e+00 ; [#uses=1] + %.pn20 = sub double %.pn24, 0.000000e+00 ; [#uses=1] + %.pn18 = add double %.pn22, 0.000000e+00 ; [#uses=1] + %.pn16 = add double %.pn20, 0.000000e+00 ; [#uses=1] + %.pn14 = sub double %.pn18, 0.000000e+00 ; [#uses=1] + %.pn12 = sub double %.pn16, %.pn17 ; [#uses=1] + %.pn10 = add double %.pn14, 0.000000e+00 ; [#uses=1] + %.pn8 = add double %.pn12, 0.000000e+00 ; [#uses=1] + %.pn6 = sub double %.pn10, 0.000000e+00 ; [#uses=1] + %.pn4 = sub double %.pn8, %.pn9 ; [#uses=1] + %.pn2 = add double %.pn6, 0.000000e+00 ; [#uses=1] + %.pn = add double %.pn4, 0.000000e+00 ; [#uses=1] + %N1.0 = sub double %.pn2, 0.000000e+00 ; [#uses=2] + %D1.0 = sub double %.pn, %.pn1 ; [#uses=2] + br i1 %6, label %bb62, label %bb64 + +bb62: ; preds = %bb55 + %7 = mul double 0.000000e+00, %4 ; [#uses=1] + %8 = sub double -0.000000e+00, %7 ; [#uses=3] + %9 = mul double 0.000000e+00, %5 ; [#uses=1] + %10 = sub double -0.000000e+00, %9 ; [#uses=3] + %11 = mul double %.pn404, %4 ; [#uses=5] + %12 = mul double %.pn402, %5 ; [#uses=5] + %13 = mul double 0.000000e+00, -2.000000e+00 ; [#uses=1] + %14 = fdiv double 0.000000e+00, %.pn402 ; [#uses=1] + %15 = sub double 0.000000e+00, %14 ; [#uses=1] + %16 = mul double 0.000000e+00, %15 ; [#uses=1] + %17 = add double %13, %16 ; [#uses=1] + %18 = mul double %.pn165.in, -2.000000e+00 ; [#uses=5] + %19 = mul double %18, 0.000000e+00 ; [#uses=1] + %20 = add double %17, %19 ; [#uses=1] + %21 = mul double 0.000000e+00, %20 ; [#uses=1] + %22 = add double 0.000000e+00, %21 ; [#uses=1] + %23 = fdiv double 0.000000e+00, %12 ; [#uses=1] + %24 = sub double 0.000000e+00, %23 ; [#uses=0] + %25 = mul double %18, 0.000000e+00 ; [#uses=1] + %26 = add double 0.000000e+00, %25 ; [#uses=1] + %27 = mul double 0.000000e+00, %26 ; [#uses=1] + %28 = sub double %22, %27 ; [#uses=1] + %29 = mul double %11, %4 ; [#uses=1] + %30 = mul double %12, %5 ; [#uses=3] + %31 = mul double %.pn165.in, -4.000000e+00 ; [#uses=1] + %32 = mul double %.pn165.in, 0x3FF5555555555555 ; [#uses=1] + %33 = mul double %32, 0.000000e+00 ; [#uses=2] + %34 = add double %28, 0.000000e+00 ; [#uses=1] + %35 = sub double -0.000000e+00, 0.000000e+00 ; [#uses=1] + %36 = fdiv double %35, %11 ; [#uses=1] + %37 = fdiv double 0.000000e+00, %12 ; [#uses=1] + %38 = sub double %36, %37 ; [#uses=1] + %39 = mul double 0.000000e+00, %38 ; [#uses=1] + %40 = add double 0.000000e+00, %39 ; [#uses=1] + %41 = add double %40, 0.000000e+00 ; [#uses=1] + %42 = add double %41, 0.000000e+00 ; [#uses=1] + %43 = mul double %42, 0.000000e+00 ; [#uses=1] + %44 = sub double %34, %43 ; [#uses=1] + %45 = tail call double @llvm.exp.f64(double %8) nounwind ; [#uses=1] + %46 = sub double -0.000000e+00, %45 ; [#uses=2] + %47 = fdiv double %46, 0.000000e+00 ; [#uses=1] + %48 = mul double %30, %5 ; [#uses=1] + %49 = fdiv double 0.000000e+00, %48 ; [#uses=1] + %50 = sub double %47, %49 ; [#uses=1] + %51 = mul double %50, -4.000000e+00 ; [#uses=1] + %52 = add double %51, 0.000000e+00 ; [#uses=1] + %53 = fdiv double %46, %11 ; [#uses=1] + %54 = sub double %53, 0.000000e+00 ; [#uses=1] + %55 = mul double %31, %54 ; [#uses=1] + %56 = add double %52, %55 ; [#uses=1] + %57 = add double %56, 0.000000e+00 ; [#uses=1] + %58 = add double %44, %57 ; [#uses=1] + %59 = sub double %58, 0.000000e+00 ; [#uses=1] + %60 = tail call double @llvm.exp.f64(double 0.000000e+00) nounwind ; [#uses=1] + %61 = sub double -0.000000e+00, %60 ; [#uses=1] + %62 = fdiv double 0.000000e+00, -6.000000e+00 ; [#uses=1] + %63 = fdiv double %61, %5 ; [#uses=1] + %64 = sub double 0.000000e+00, %63 ; [#uses=1] + %65 = mul double %62, %64 ; [#uses=1] + %66 = sub double 0.000000e+00, %65 ; [#uses=1] + %67 = sub double -0.000000e+00, 0.000000e+00 ; [#uses=2] + %68 = tail call double @llvm.exp.f64(double %10) nounwind ; [#uses=1] + %69 = sub double -0.000000e+00, %68 ; [#uses=2] + %70 = fdiv double %67, %.pn404 ; [#uses=1] + %71 = fdiv double %69, %.pn402 ; [#uses=1] + %72 = sub double %70, %71 ; [#uses=1] + %73 = mul double %72, -5.000000e-01 ; [#uses=1] + %74 = fdiv double %67, %4 ; [#uses=1] + %75 = fdiv double %69, %5 ; [#uses=1] + %76 = sub double %74, %75 ; [#uses=1] + %77 = mul double %76, 0.000000e+00 ; [#uses=1] + %78 = add double %73, %77 ; [#uses=1] + %79 = mul double 0.000000e+00, %78 ; [#uses=1] + %80 = add double %66, %79 ; [#uses=1] + %81 = fdiv double 0.000000e+00, %.pn404 ; [#uses=1] + %82 = fdiv double 0.000000e+00, %.pn402 ; [#uses=1] + %83 = sub double %81, %82 ; [#uses=1] + %84 = mul double %83, -5.000000e-01 ; [#uses=1] + %85 = fdiv double 0.000000e+00, %4 ; [#uses=1] + %86 = fdiv double 0.000000e+00, %5 ; [#uses=1] + %87 = sub double %85, %86 ; [#uses=1] + %88 = mul double %87, 0.000000e+00 ; [#uses=1] + %89 = add double %84, %88 ; [#uses=1] + %90 = mul double 0.000000e+00, %89 ; [#uses=1] + %91 = sub double %80, %90 ; [#uses=1] + %92 = tail call double @llvm.exp.f64(double %8) nounwind ; [#uses=1] + %93 = sub double -0.000000e+00, %92 ; [#uses=1] + %94 = tail call double @llvm.exp.f64(double %10) nounwind ; [#uses=1] + %95 = sub double -0.000000e+00, %94 ; [#uses=3] + %96 = fdiv double %95, %.pn402 ; [#uses=1] + %97 = sub double 0.000000e+00, %96 ; [#uses=1] + %98 = mul double 0.000000e+00, %97 ; [#uses=1] + %99 = fdiv double %93, %11 ; [#uses=1] + %100 = fdiv double %95, %12 ; [#uses=1] + %101 = sub double %99, %100 ; [#uses=1] + %102 = sub double %98, %101 ; [#uses=1] + %103 = fdiv double %95, %5 ; [#uses=1] + %104 = sub double 0.000000e+00, %103 ; [#uses=1] + %105 = mul double %18, %104 ; [#uses=1] + %106 = add double %102, %105 ; [#uses=1] + %107 = mul double %106, %k.4 ; [#uses=1] + %108 = add double %91, %107 ; [#uses=1] + %109 = sub double %108, 0.000000e+00 ; [#uses=1] + %110 = tail call double @llvm.exp.f64(double %8) nounwind ; [#uses=1] + %111 = sub double -0.000000e+00, %110 ; [#uses=2] + %112 = tail call double @llvm.exp.f64(double %10) nounwind ; [#uses=1] + %113 = sub double -0.000000e+00, %112 ; [#uses=2] + %114 = fdiv double %111, %11 ; [#uses=1] + %115 = fdiv double %113, %12 ; [#uses=1] + %116 = sub double %114, %115 ; [#uses=1] + %117 = mul double 0.000000e+00, %116 ; [#uses=1] + %118 = fdiv double %111, %29 ; [#uses=1] + %119 = fdiv double %113, %30 ; [#uses=1] + %120 = sub double %118, %119 ; [#uses=1] + %121 = sub double %117, %120 ; [#uses=1] + %122 = mul double %18, 0.000000e+00 ; [#uses=1] + %123 = add double %121, %122 ; [#uses=1] + %124 = mul double %33, 0.000000e+00 ; [#uses=1] + %125 = add double %123, %124 ; [#uses=1] + %126 = add double %109, %125 ; [#uses=1] + %127 = tail call double @llvm.exp.f64(double 0.000000e+00) nounwind ; [#uses=1] + %128 = sub double -0.000000e+00, %127 ; [#uses=2] + %129 = fdiv double %128, %30 ; [#uses=1] + %130 = sub double 0.000000e+00, %129 ; [#uses=1] + %131 = sub double 0.000000e+00, %130 ; [#uses=1] + %132 = fdiv double 0.000000e+00, %.pn404 ; [#uses=1] + %133 = sub double %132, 0.000000e+00 ; [#uses=1] + %134 = mul double %18, %133 ; [#uses=1] + %135 = add double %131, %134 ; [#uses=1] + %136 = fdiv double %128, %5 ; [#uses=1] + %137 = sub double 0.000000e+00, %136 ; [#uses=1] + %138 = mul double %33, %137 ; [#uses=1] + %139 = add double %135, %138 ; [#uses=1] + %140 = sub double %126, %139 ; [#uses=1] + %141 = add double %N1.0, %59 ; [#uses=1] + %142 = add double %D1.0, %140 ; [#uses=1] + br label %bb64 + +bb64: ; preds = %bb62, %bb55 + %N1.0.pn = phi double [ %141, %bb62 ], [ %N1.0, %bb55 ] ; [#uses=1] + %D1.0.pn = phi double [ %142, %bb62 ], [ %D1.0, %bb55 ] ; [#uses=1] + %x.1 = fdiv double %N1.0.pn, %D1.0.pn ; [#uses=0] + ret void +} From isanbard at gmail.com Sat Feb 28 01:32:59 2009 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 28 Feb 2009 07:32:59 -0000 Subject: [llvm-commits] [llvm] r65681 - in /llvm/branches/Apple/Dib: lib/CodeGen/VirtRegMap.cpp test/CodeGen/ARM/2009-02-27-SpillerBug.ll Message-ID: <200902280732.n1S7WxEo016357@zion.cs.uiuc.edu> Author: void Date: Sat Feb 28 01:32:59 2009 New Revision: 65681 URL: http://llvm.org/viewvc/llvm-project?rev=65681&view=rev Log: Merge r65679 into Dib: Last commit accidentially deleted this code. Added: llvm/branches/Apple/Dib/test/CodeGen/ARM/2009-02-27-SpillerBug.ll - copied unchanged from r65679, llvm/trunk/test/CodeGen/ARM/2009-02-27-SpillerBug.ll Modified: llvm/branches/Apple/Dib/lib/CodeGen/VirtRegMap.cpp Modified: llvm/branches/Apple/Dib/lib/CodeGen/VirtRegMap.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/VirtRegMap.cpp?rev=65681&r1=65680&r2=65681&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/CodeGen/VirtRegMap.cpp (original) +++ llvm/branches/Apple/Dib/lib/CodeGen/VirtRegMap.cpp Sat Feb 28 01:32:59 2009 @@ -1637,6 +1637,10 @@ PotentialDeadStoreSlots.push_back(ReuseSlot); } + // Assumes this is the last use. IsKill will be unset if reg is reused + // unless it's a two-address operand. + if (ti == -1) + MI.getOperand(i).setIsKill(); continue; } // CanReuse From isanbard at gmail.com Sat Feb 28 01:34:38 2009 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 28 Feb 2009 07:34:38 -0000 Subject: [llvm-commits] [llvm] r65682 - /llvm/tags/Apple/llvmCore-2100/ Message-ID: <200902280734.n1S7Yc4H016411@zion.cs.uiuc.edu> Author: void Date: Sat Feb 28 01:34:38 2009 New Revision: 65682 URL: http://llvm.org/viewvc/llvm-project?rev=65682&view=rev Log: Need additional patch. Remove 2100 tag. Removed: llvm/tags/Apple/llvmCore-2100/ From isanbard at gmail.com Sat Feb 28 01:34:55 2009 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 28 Feb 2009 07:34:55 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r65683 - /llvm-gcc-4.2/tags/Apple/llvmgcc42-2100/ Message-ID: <200902280734.n1S7YtTK016432@zion.cs.uiuc.edu> Author: void Date: Sat Feb 28 01:34:54 2009 New Revision: 65683 URL: http://llvm.org/viewvc/llvm-project?rev=65683&view=rev Log: Need additional patch. Remove 2100 tag. Removed: llvm-gcc-4.2/tags/Apple/llvmgcc42-2100/ From isanbard at gmail.com Sat Feb 28 01:35:51 2009 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 28 Feb 2009 07:35:51 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r65684 - /llvm-gcc-4.2/tags/Apple/llvmgcc42-2100/ Message-ID: <200902280735.n1S7Zp14016465@zion.cs.uiuc.edu> Author: void Date: Sat Feb 28 01:35:50 2009 New Revision: 65684 URL: http://llvm.org/viewvc/llvm-project?rev=65684&view=rev Log: Creating llvmgcc42-2100 tag from Dib branch. Added: llvm-gcc-4.2/tags/Apple/llvmgcc42-2100/ - copied from r65683, llvm-gcc-4.2/branches/Apple/Dib/ From isanbard at gmail.com Sat Feb 28 01:36:26 2009 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 28 Feb 2009 07:36:26 -0000 Subject: [llvm-commits] [llvm] r65685 - /llvm/tags/Apple/llvmCore-2100/ Message-ID: <200902280736.n1S7aQci016496@zion.cs.uiuc.edu> Author: void Date: Sat Feb 28 01:36:25 2009 New Revision: 65685 URL: http://llvm.org/viewvc/llvm-project?rev=65685&view=rev Log: Creating llvmCore-2100 tag from Dib branch. Added: llvm/tags/Apple/llvmCore-2100/ - copied from r65684, llvm/branches/Apple/Dib/ From isanbard at gmail.com Sat Feb 28 01:36:51 2009 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 28 Feb 2009 07:36:51 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r65686 - /llvm-gcc-4.2/tags/Apple/llvmgcc42-2100/trunk/ Message-ID: <200902280736.n1S7apLY016513@zion.cs.uiuc.edu> Author: void Date: Sat Feb 28 01:36:51 2009 New Revision: 65686 URL: http://llvm.org/viewvc/llvm-project?rev=65686&view=rev Log: Creating llvmgcc42-2100 branch Added: llvm-gcc-4.2/tags/Apple/llvmgcc42-2100/trunk/ - copied from r65685, llvm-gcc-4.2/trunk/ From isanbard at gmail.com Sat Feb 28 01:39:20 2009 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 28 Feb 2009 07:39:20 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r65687 - /llvm-gcc-4.2/tags/Apple/llvmgcc42-2100/trunk/ Message-ID: <200902280739.n1S7dKdA016604@zion.cs.uiuc.edu> Author: void Date: Sat Feb 28 01:39:20 2009 New Revision: 65687 URL: http://llvm.org/viewvc/llvm-project?rev=65687&view=rev Log: Doh! Shouldn't have copied trunk into here. Removed: llvm-gcc-4.2/tags/Apple/llvmgcc42-2100/trunk/ From ggreif at gmail.com Sat Feb 28 02:26:52 2009 From: ggreif at gmail.com (Gabor Greif) Date: Sat, 28 Feb 2009 00:26:52 -0800 (PST) Subject: [llvm-commits] [llvm] r65670 - /llvm/trunk/include/llvm/BasicBlock.h In-Reply-To: <16e5fdf90902271742ldb07293m4f7fb9bdfb36cebc@mail.gmail.com> References: <200902280110.n1S1AOG6005200@zion.cs.uiuc.edu> <16e5fdf90902271718m37eb4a52nb8782b34929e7351@mail.gmail.com> <16e5fdf90902271742ldb07293m4f7fb9bdfb36cebc@mail.gmail.com> Message-ID: <134a930e-540f-4815-a2d6-56dbea31336b@p11g2000yqe.googlegroups.com> On 28 Feb., 02:42, Bill Wendling wrote: > Normally the parameter is there to give information about what kind of > argument should be passed in. For instance "virtual void foo(unsigned > Flag) {}". Here "I" has no information, but the type does. So the > parameter isn't needed. Bill is right. I'll take care of this as further changes (and savings) are in the pipeline... Cheers, Gabor > > -bw > > > > On Fri, Feb 27, 2009 at 5:34 PM, Evan Cheng wrote: > > Dunno. Is the parameter there for a reason? > > > Evan > > > On Feb 27, 2009, at 5:18 PM, Bill Wendling wrote: > > >> Why not just remove the "I" from the declaration? > > >> -bw > > >> On Fri, Feb 27, 2009 at 5:10 PM, Evan Cheng > >> wrote: > >>> Author: evancheng > >>> Date: Fri Feb 27 19:10:24 2009 > >>> New Revision: 65670 > > >>> URL:http://llvm.org/viewvc/llvm-project?rev=65670&view=rev > >>> Log: > >>> Avoid unused parameter warning. > > >>> Modified: > >>> ? ?llvm/trunk/include/llvm/BasicBlock.h > > >>> Modified: llvm/trunk/include/llvm/BasicBlock.h > >>> URL:http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BasicBloc... > > >>> = > >>> = > >>> = > >>> = > >>> = > >>> = > >>> = > >>> = > >>> = > >>> ===================================================================== > >>> --- llvm/trunk/include/llvm/BasicBlock.h (original) > >>> +++ llvm/trunk/include/llvm/BasicBlock.h Fri Feb 27 19:10:24 2009 > >>> @@ -29,7 +29,7 @@ > >>> ? Instruction *createSentinel() const { > >>> ? ? return const_cast(static_cast >>> Instruction*>(&Sentinel)); > >>> ? } > >>> - ?static void destroySentinel(Instruction *I) { } > >>> + ?static void destroySentinel(Instruction *I) { I = I; } > >>> ? static iplist &getList(BasicBlock *BB); > >>> ? static ValueSymbolTable *getSymTab(BasicBlock *ItemParent); > >>> ? static int getListOffset(); > > >>> _______________________________________________ > >>> llvm-commits mailing list > >>> llvm-comm... at cs.uiuc.edu > >>>http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > >> _______________________________________________ > >> llvm-commits mailing list > >> llvm-comm... at cs.uiuc.edu > >>http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > > _______________________________________________ > > llvm-commits mailing list > > llvm-comm... at cs.uiuc.edu > >http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > _______________________________________________ > llvm-commits mailing list > llvm-comm... at cs.uiuc.eduhttp://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From ggreif at gmail.com Sat Feb 28 04:17:44 2009 From: ggreif at gmail.com (Gabor Greif) Date: Sat, 28 Feb 2009 10:17:44 -0000 Subject: [llvm-commits] [llvm] r65690 - /llvm/trunk/include/llvm/ADT/ilist.h Message-ID: <200902281017.n1SAHjWQ032499@zion.cs.uiuc.edu> Author: ggreif Date: Sat Feb 28 04:17:32 2009 New Revision: 65690 URL: http://llvm.org/viewvc/llvm-project?rev=65690&view=rev Log: make traits more flexible by splitting out node-related fragment Modified: llvm/trunk/include/llvm/ADT/ilist.h Modified: llvm/trunk/include/llvm/ADT/ilist.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ilist.h?rev=65690&r1=65689&r2=65690&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/ilist.h (original) +++ llvm/trunk/include/llvm/ADT/ilist.h Sat Feb 28 04:17:32 2009 @@ -69,23 +69,31 @@ static void destroySentinel(NodeTy *N) { delete N; } }; -/// ilist_default_traits - Default template traits for intrusive list. -/// By inheriting from this, you can easily use default implementations -/// for all common operations. +/// ilist_node_traits - A fragment for template traits for intrusive list +/// that provides default node related operations. /// template -struct ilist_default_traits : ilist_nextprev_traits, - ilist_sentinel_traits { +struct ilist_node_traits { static NodeTy *createNode(const NodeTy &V) { return new NodeTy(V); } static void deleteNode(NodeTy *V) { delete V; } void addNodeToList(NodeTy *) {} void removeNodeFromList(NodeTy *) {} - void transferNodesFromList(ilist_default_traits & /*SrcTraits*/, + void transferNodesFromList(ilist_node_traits & /*SrcTraits*/, ilist_iterator /*first*/, ilist_iterator /*last*/) {} }; +/// ilist_default_traits - Default template traits for intrusive list. +/// By inheriting from this, you can easily use default implementations +/// for all common operations. +/// +template +struct ilist_default_traits : ilist_nextprev_traits, + ilist_sentinel_traits, + ilist_node_traits { +}; + // Template traits for intrusive list. By specializing this template class, you // can change what next/prev fields are used to store the links... template From isanbard at gmail.com Sat Feb 28 06:11:11 2009 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 28 Feb 2009 12:11:11 -0000 Subject: [llvm-commits] [llvm] r65692 - /llvm/trunk/test/FrontendC/2009-02-27-CString.c Message-ID: <200902281211.n1SCBCg8003364@zion.cs.uiuc.edu> Author: void Date: Sat Feb 28 06:11:01 2009 New Revision: 65692 URL: http://llvm.org/viewvc/llvm-project?rev=65692&view=rev Log: There is a way to specify targets that should succeed. It's the "XTARGET" keyword. Modified: llvm/trunk/test/FrontendC/2009-02-27-CString.c Modified: llvm/trunk/test/FrontendC/2009-02-27-CString.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC/2009-02-27-CString.c?rev=65692&r1=65691&r2=65692&view=diff ============================================================================== --- llvm/trunk/test/FrontendC/2009-02-27-CString.c (original) +++ llvm/trunk/test/FrontendC/2009-02-27-CString.c Sat Feb 28 06:11:01 2009 @@ -1,7 +1,7 @@ /* RUN: %llvmgcc %s -S -o - -emit-llvm | \ RUN: egrep {CSTRING SECTION.\*section.\*__TEXT,.\*__cstring} - XFAIL: linux,ia64,alpha,sparc - TARGET: *-*-darwin* + XFAIL: * + XTARGET: darwin END. Insure that stings go to the cstring section. This test is intended solely for Darwin targets. From isanbard at gmail.com Sat Feb 28 06:26:42 2009 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 28 Feb 2009 12:26:42 -0000 Subject: [llvm-commits] [llvm] r65693 - /llvm/trunk/docs/CommandGuide/llvm-bcanalyzer.pod Message-ID: <200902281226.n1SCQhUb003908@zion.cs.uiuc.edu> Author: void Date: Sat Feb 28 06:26:34 2009 New Revision: 65693 URL: http://llvm.org/viewvc/llvm-project?rev=65693&view=rev Log: Fix typo. Found by William Moss. Modified: llvm/trunk/docs/CommandGuide/llvm-bcanalyzer.pod Modified: llvm/trunk/docs/CommandGuide/llvm-bcanalyzer.pod URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CommandGuide/llvm-bcanalyzer.pod?rev=65693&r1=65692&r2=65693&view=diff ============================================================================== --- llvm/trunk/docs/CommandGuide/llvm-bcanalyzer.pod (original) +++ llvm/trunk/docs/CommandGuide/llvm-bcanalyzer.pod Sat Feb 28 06:26:34 2009 @@ -306,7 +306,7 @@ =head1 SEE ALSO -L, L +L, L =head1 AUTHORS From nicholas at mxc.ca Sat Feb 28 11:30:12 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Sat, 28 Feb 2009 17:30:12 -0000 Subject: [llvm-commits] [llvm] r65697 - /llvm/trunk/docs/LangRef.html Message-ID: <200902281730.n1SHUEIv013376@zion.cs.uiuc.edu> Author: nicholas Date: Sat Feb 28 11:30:06 2009 New Revision: 65697 URL: http://llvm.org/viewvc/llvm-project?rev=65697&view=rev Log: Update this text for first-class aggregates. Modified: llvm/trunk/docs/LangRef.html Modified: llvm/trunk/docs/LangRef.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=65697&r1=65696&r2=65697&view=diff ============================================================================== --- llvm/trunk/docs/LangRef.html (original) +++ llvm/trunk/docs/LangRef.html Sat Feb 28 11:30:06 2009 @@ -1951,9 +1951,10 @@ identical (same number of bits). The conversion is done as if the CST value was stored to memory and read back as TYPE. In other words, no bits change with this operator, just the type. This can be used for conversion of - vector types to any other type, as long as they have the same bit width. For - pointers it is only valid to cast to another pointer type. It is not valid - to bitcast to or from an aggregate type. + aggregate types to any aggregate type, as long as they have the same bit + width. Vector types may also be casted to and from any other type as long as + they have the same bit width. For pointers it is only valid to cast to + another pointer type.
    getelementptr ( CSTPTR, IDX0, IDX1, ... )
    From aaronngray.lists at googlemail.com Sat Feb 28 11:58:27 2009 From: aaronngray.lists at googlemail.com (Aaron Gray) Date: Sat, 28 Feb 2009 17:58:27 +0000 Subject: [llvm-commits] SVN Trunk broken on LLVMHello.dll on Cygwin platform In-Reply-To: <53FA7913-690A-4FA8-B7BC-1385F59584BE@korobeynikov.info> References: <9719867c0902261243i7e8ca9c7ueeec33627bff080b@mail.gmail.com> <200902270849.20609.baldrick@free.fr> <49A79D53.7020200@mxc.ca> <20090227231847.GD26886@pom.apple.com> <53FA7913-690A-4FA8-B7BC-1385F59584BE@korobeynikov.info> Message-ID: <9719867c0902280958q1376f8bbo6fbe922f24a375b8@mail.gmail.com> On Fri, Feb 27, 2009 at 11:26 PM, Anton Korobeynikov < anton at korobeynikov.info> wrote: > > Same error on MingW as well. It started between 65440 and 65525. > > That's correct. This is not possible to have undefined symbols in shared > libraries on windows (aka .dll's). libtool just "silenced" this error based > on target information. The proper solution is not to build hello at all on > windows targets. Nick is aware about the problem and solution, stay tuned! > :) > Thanks, good to know I am not alone. I am moving over to putty, rsync and Linux for main development now, Cygwin is just too sloooow :) Aaron BTW. I still will do Cygwin test builds on request. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090228/dfa9333d/attachment.html From sabre at nondot.org Sat Feb 28 12:12:42 2009 From: sabre at nondot.org (Chris Lattner) Date: Sat, 28 Feb 2009 18:12:42 -0000 Subject: [llvm-commits] [llvm] r65698 - /llvm/trunk/lib/AsmParser/LLParser.cpp Message-ID: <200902281812.n1SICgqX014867@zion.cs.uiuc.edu> Author: lattner Date: Sat Feb 28 12:12:41 2009 New Revision: 65698 URL: http://llvm.org/viewvc/llvm-project?rev=65698&view=rev Log: reject 0 element vectors with: @a = internal constant void bitcast(<0 x i8> <> to void) ^ Fixes PR3685 Modified: llvm/trunk/lib/AsmParser/LLParser.cpp Modified: llvm/trunk/lib/AsmParser/LLParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=65698&r1=65697&r2=65698&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLParser.cpp (original) +++ llvm/trunk/lib/AsmParser/LLParser.cpp Sat Feb 28 12:12:41 2009 @@ -1262,6 +1262,8 @@ return true; if (isVector) { + if (Size == 0) + return Error(SizeLoc, "zero element vector is illegal"); if ((unsigned)Size != Size) return Error(SizeLoc, "size too large for vector"); if (!EltTy->isFloatingPoint() && !EltTy->isInteger()) From sabre at nondot.org Sat Feb 28 12:27:04 2009 From: sabre at nondot.org (Chris Lattner) Date: Sat, 28 Feb 2009 18:27:04 -0000 Subject: [llvm-commits] [llvm] r65700 - /llvm/trunk/docs/LangRef.html Message-ID: <200902281827.n1SIR4cS015335@zion.cs.uiuc.edu> Author: lattner Date: Sat Feb 28 12:27:03 2009 New Revision: 65700 URL: http://llvm.org/viewvc/llvm-project?rev=65700&view=rev Log: don't redescribe bitcast constraints in two places. It is not valid to bitcast from one aggregate to another. Modified: llvm/trunk/docs/LangRef.html Modified: llvm/trunk/docs/LangRef.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=65700&r1=65699&r2=65700&view=diff ============================================================================== --- llvm/trunk/docs/LangRef.html (original) +++ llvm/trunk/docs/LangRef.html Sat Feb 28 12:27:03 2009 @@ -1947,15 +1947,9 @@ really dangerous!
    bitcast ( CST to TYPE )
    -
    Convert a constant, CST, to another TYPE. The size of CST and TYPE must be - identical (same number of bits). The conversion is done as if the CST value - was stored to memory and read back as TYPE. In other words, no bits change - with this operator, just the type. This can be used for conversion of - aggregate types to any aggregate type, as long as they have the same bit - width. Vector types may also be casted to and from any other type as long as - they have the same bit width. For pointers it is only valid to cast to - another pointer type. -
    +
    Convert a constant, CST, to another TYPE. The constraints of the operands + are the same as those for the bitcast + instruction.
    getelementptr ( CSTPTR, IDX0, IDX1, ... )
    From sabre at nondot.org Sat Feb 28 12:32:25 2009 From: sabre at nondot.org (Chris Lattner) Date: Sat, 28 Feb 2009 18:32:25 -0000 Subject: [llvm-commits] [llvm] r65702 - /llvm/trunk/docs/LangRef.html Message-ID: <200902281832.n1SIWPKW015491@zion.cs.uiuc.edu> Author: lattner Date: Sat Feb 28 12:32:25 2009 New Revision: 65702 URL: http://llvm.org/viewvc/llvm-project?rev=65702&view=rev Log: don't use the word 'aggregate' with constants, it is confusing. Modified: llvm/trunk/docs/LangRef.html Modified: llvm/trunk/docs/LangRef.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=65702&r1=65701&r2=65702&view=diff ============================================================================== --- llvm/trunk/docs/LangRef.html (original) +++ llvm/trunk/docs/LangRef.html Sat Feb 28 12:32:25 2009 @@ -61,7 +61,7 @@
  3. Constants
    1. Simple Constants
    2. -
    3. Aggregate Constants
    4. +
    5. Complex Constants
    6. Global Variable and Function Addresses
    7. Undefined Values
    8. Constant Expressions
    9. @@ -1788,12 +1788,14 @@
  4. -
    Aggregate Constants +
    -

    Aggregate constants arise from aggregation of simple constants -and smaller aggregate constants.

    +

    Complex constants are a (potentially recursive) combination of simple +constants and smaller complex constants.

    Structure constants
    @@ -2140,7 +2142,7 @@
       ret i32 5                       ; Return an integer value of 5
       ret void                        ; Return from a void function
    -  ret { i32, i8 } { i32 4, i8 2 } ; Return an aggregate of values 4 and 2
    +  ret { i32, i8 } { i32 4, i8 2 } ; Return an struct of values 4 and 2
     

    Note that the code generator does not yet fully support large From sabre at nondot.org Sat Feb 28 12:58:01 2009 From: sabre at nondot.org (Chris Lattner) Date: Sat, 28 Feb 2009 18:58:01 -0000 Subject: [llvm-commits] [llvm] r65705 - /llvm/trunk/docs/ReleaseNotes.html Message-ID: <200902281858.n1SIw10F016262@zion.cs.uiuc.edu> Author: lattner Date: Sat Feb 28 12:58:01 2009 New Revision: 65705 URL: http://llvm.org/viewvc/llvm-project?rev=65705&view=rev Log: add a stub for Roadsend PHP Modified: llvm/trunk/docs/ReleaseNotes.html Modified: llvm/trunk/docs/ReleaseNotes.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ReleaseNotes.html?rev=65705&r1=65704&r2=65705&view=diff ============================================================================== --- llvm/trunk/docs/ReleaseNotes.html (original) +++ llvm/trunk/docs/ReleaseNotes.html Sat Feb 28 12:58:01 2009 @@ -246,6 +246,18 @@

    + + + +
    +

    http://code.roadsend.com/rphp

    + +

    Roadsend PHP is using LLVM for code generation. This is an open source +project. +

    +
    From sabre at nondot.org Sat Feb 28 14:25:14 2009 From: sabre at nondot.org (Chris Lattner) Date: Sat, 28 Feb 2009 20:25:14 -0000 Subject: [llvm-commits] [llvm] r65710 - /llvm/trunk/lib/VMCore/AsmWriter.cpp Message-ID: <200902282025.n1SKPEEZ018996@zion.cs.uiuc.edu> Author: lattner Date: Sat Feb 28 14:25:14 2009 New Revision: 65710 URL: http://llvm.org/viewvc/llvm-project?rev=65710&view=rev Log: start refactoring the .ll printer: introduce a new TypePrinting class and move all related stuff to it. Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=65710&r1=65709&r2=65710&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original) +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Sat Feb 28 14:25:14 2009 @@ -143,6 +143,274 @@ isa(V) ? GlobalPrefix : LocalPrefix); } +//===----------------------------------------------------------------------===// +// TypePrinting Class: Type printing machinery +//===----------------------------------------------------------------------===// + +namespace { + /// TypePrinting - Type printing machinery. + class TypePrinting { + std::map TypeNames; + raw_ostream &OS; + public: + TypePrinting(const Module *M, raw_ostream &os); + + void print(const Type *Ty); + void printAtLeastOneLevel(const Type *Ty); + }; +} // end anonymous namespace. + +TypePrinting::TypePrinting(const Module *M, raw_ostream &os) : OS(os) { + if (M == 0) return; + + // If the module has a symbol table, take all global types and stuff their + // names into the TypeNames map. + const TypeSymbolTable &ST = M->getTypeSymbolTable(); + for (TypeSymbolTable::const_iterator TI = ST.begin(), E = ST.end(); + TI != E; ++TI) { + // As a heuristic, don't insert pointer to primitive types, because + // they are used too often to have a single useful name. + // + const Type *Ty = cast(TI->second); + if (!isa(Ty) || + !cast(Ty)->getElementType()->isPrimitiveType() || + !cast(Ty)->getElementType()->isInteger() || + isa(cast(Ty)->getElementType())) + TypeNames.insert(std::make_pair(Ty, '%' + getLLVMName(TI->first))); + } +} + +static void calcTypeName(const Type *Ty, + std::vector &TypeStack, + std::map &TypeNames, + std::string &Result) { + if (Ty->isInteger() || (Ty->isPrimitiveType() && !isa(Ty))) { + Result += Ty->getDescription(); // Base case + return; + } + + // Check to see if the type is named. + std::map::iterator I = TypeNames.find(Ty); + if (I != TypeNames.end()) { + Result += I->second; + return; + } + + if (isa(Ty)) { + Result += "opaque"; + return; + } + + // Check to see if the Type is already on the stack... + unsigned Slot = 0, CurSize = TypeStack.size(); + while (Slot < CurSize && TypeStack[Slot] != Ty) ++Slot; // Scan for type + + // This is another base case for the recursion. In this case, we know + // that we have looped back to a type that we have previously visited. + // Generate the appropriate upreference to handle this. + if (Slot < CurSize) { + Result += "\\" + utostr(CurSize-Slot); // Here's the upreference + return; + } + + TypeStack.push_back(Ty); // Recursive case: Add us to the stack.. + + switch (Ty->getTypeID()) { + case Type::IntegerTyID: { + unsigned BitWidth = cast(Ty)->getBitWidth(); + Result += "i" + utostr(BitWidth); + break; + } + case Type::FunctionTyID: { + const FunctionType *FTy = cast(Ty); + calcTypeName(FTy->getReturnType(), TypeStack, TypeNames, Result); + Result += " ("; + for (FunctionType::param_iterator I = FTy->param_begin(), + E = FTy->param_end(); I != E; ++I) { + if (I != FTy->param_begin()) + Result += ", "; + calcTypeName(*I, TypeStack, TypeNames, Result); + } + if (FTy->isVarArg()) { + if (FTy->getNumParams()) Result += ", "; + Result += "..."; + } + Result += ")"; + break; + } + case Type::StructTyID: { + const StructType *STy = cast(Ty); + if (STy->isPacked()) + Result += '<'; + Result += "{ "; + for (StructType::element_iterator I = STy->element_begin(), + E = STy->element_end(); I != E; ++I) { + calcTypeName(*I, TypeStack, TypeNames, Result); + if (next(I) != STy->element_end()) + Result += ','; + Result += ' '; + } + Result += '}'; + if (STy->isPacked()) + Result += '>'; + break; + } + case Type::PointerTyID: { + const PointerType *PTy = cast(Ty); + calcTypeName(PTy->getElementType(), TypeStack, TypeNames, Result); + if (unsigned AddressSpace = PTy->getAddressSpace()) + Result += " addrspace(" + utostr(AddressSpace) + ")"; + Result += "*"; + break; + } + case Type::ArrayTyID: { + const ArrayType *ATy = cast(Ty); + Result += "[" + utostr(ATy->getNumElements()) + " x "; + calcTypeName(ATy->getElementType(), TypeStack, TypeNames, Result); + Result += "]"; + break; + } + case Type::VectorTyID: { + const VectorType *PTy = cast(Ty); + Result += "<" + utostr(PTy->getNumElements()) + " x "; + calcTypeName(PTy->getElementType(), TypeStack, TypeNames, Result); + Result += ">"; + break; + } + case Type::OpaqueTyID: + Result += "opaque"; + break; + default: + Result += ""; + break; + } + + TypeStack.pop_back(); // Remove self from stack... +} + +/// printTypeInt - The internal guts of printing out a type that has a +/// potentially named portion. +/// +void TypePrinting::print(const Type *Ty) { + // Primitive types always print out their description, regardless of whether + // they have been named or not. + if (Ty->isInteger() || (Ty->isPrimitiveType() && !isa(Ty))) { + OS << Ty->getDescription(); + return; + } + + // Check to see if the type is named. + std::map::iterator I = TypeNames.find(Ty); + if (I != TypeNames.end()) { + OS << I->second; + return; + } + + // Otherwise we have a type that has not been named but is a derived type. + // Carefully recurse the type hierarchy to print out any contained symbolic + // names. + std::vector TypeStack; + std::string TypeName; + calcTypeName(Ty, TypeStack, TypeNames, TypeName); + TypeNames.insert(std::make_pair(Ty, TypeName));//Cache type name for later use + OS << TypeName; +} + +/// printAtLeastOneLevel - Print out one level of the possibly complex type +/// without considering any symbolic types that we may have equal to it. +void TypePrinting::printAtLeastOneLevel(const Type *Ty) { + // FIXME: Just call calcTypeName! + if (const FunctionType *FTy = dyn_cast(Ty)) { + print(FTy->getReturnType()); + OS << " ("; + for (FunctionType::param_iterator I = FTy->param_begin(), + E = FTy->param_end(); I != E; ++I) { + if (I != FTy->param_begin()) + OS << ", "; + print(*I); + } + if (FTy->isVarArg()) { + if (FTy->getNumParams()) OS << ", "; + OS << "..."; + } + OS << ')'; + return; + } + + if (const StructType *STy = dyn_cast(Ty)) { + if (STy->isPacked()) + OS << '<'; + OS << "{ "; + for (StructType::element_iterator I = STy->element_begin(), + E = STy->element_end(); I != E; ++I) { + if (I != STy->element_begin()) + OS << ", "; + print(*I); + } + OS << " }"; + if (STy->isPacked()) + OS << '>'; + return; + } + + if (const PointerType *PTy = dyn_cast(Ty)) { + print(PTy->getElementType()); + if (unsigned AddressSpace = PTy->getAddressSpace()) + OS << " addrspace(" << AddressSpace << ")"; + OS << '*'; + return; + } + + if (const ArrayType *ATy = dyn_cast(Ty)) { + OS << '[' << ATy->getNumElements() << " x "; + print(ATy->getElementType()); + OS << ']'; + return; + } + + if (const VectorType *PTy = dyn_cast(Ty)) { + OS << '<' << PTy->getNumElements() << " x "; + print(PTy->getElementType()); + OS << '>'; + return; + } + + if (isa(Ty)) { + OS << "opaque"; + return; + } + + if (!Ty->isPrimitiveType() && !isa(Ty)) + OS << ""; + print(Ty); +} + + + + +/// WriteTypeSymbolic - This attempts to write the specified type as a symbolic +/// type, iff there is an entry in the modules symbol table for the specified +/// type or one of it's component types. This is slower than a simple x << Type +/// +void llvm::WriteTypeSymbolic(raw_ostream &Out, const Type *Ty, const Module *M){ + // FIXME: Remove this space. + Out << ' '; + + // If they want us to print out a type, but there is no context, we can't + // print it symbolically. + if (!M) { + Out << Ty->getDescription(); + } else { + TypePrinting(M, Out).print(Ty); + } +} + +// std::ostream adaptor. +void llvm::WriteTypeSymbolic(std::ostream &Out, const Type *Ty, + const Module *M) { + raw_os_ostream RO(Out); + WriteTypeSymbolic(RO, Ty, M); +} //===----------------------------------------------------------------------===// @@ -394,199 +662,11 @@ //===----------------------------------------------------------------------===// static void WriteAsOperandInternal(raw_ostream &Out, const Value *V, - std::map &TypeTable, + TypePrinting &TypePrinter, SlotTracker *Machine); -/// fillTypeNameTable - If the module has a symbol table, take all global types -/// and stuff their names into the TypeNames map. -/// -static void fillTypeNameTable(const Module *M, - std::map &TypeNames) { - if (!M) return; - const TypeSymbolTable &ST = M->getTypeSymbolTable(); - TypeSymbolTable::const_iterator TI = ST.begin(); - for (; TI != ST.end(); ++TI) { - // As a heuristic, don't insert pointer to primitive types, because - // they are used too often to have a single useful name. - // - const Type *Ty = cast(TI->second); - if (!isa(Ty) || - !cast(Ty)->getElementType()->isPrimitiveType() || - !cast(Ty)->getElementType()->isInteger() || - isa(cast(Ty)->getElementType())) - TypeNames.insert(std::make_pair(Ty, '%' + getLLVMName(TI->first))); - } -} - - - -static void calcTypeName(const Type *Ty, - std::vector &TypeStack, - std::map &TypeNames, - std::string &Result) { - if (Ty->isInteger() || (Ty->isPrimitiveType() && !isa(Ty))) { - Result += Ty->getDescription(); // Base case - return; - } - - // Check to see if the type is named. - std::map::iterator I = TypeNames.find(Ty); - if (I != TypeNames.end()) { - Result += I->second; - return; - } - - if (isa(Ty)) { - Result += "opaque"; - return; - } - - // Check to see if the Type is already on the stack... - unsigned Slot = 0, CurSize = TypeStack.size(); - while (Slot < CurSize && TypeStack[Slot] != Ty) ++Slot; // Scan for type - - // This is another base case for the recursion. In this case, we know - // that we have looped back to a type that we have previously visited. - // Generate the appropriate upreference to handle this. - if (Slot < CurSize) { - Result += "\\" + utostr(CurSize-Slot); // Here's the upreference - return; - } - - TypeStack.push_back(Ty); // Recursive case: Add us to the stack.. - - switch (Ty->getTypeID()) { - case Type::IntegerTyID: { - unsigned BitWidth = cast(Ty)->getBitWidth(); - Result += "i" + utostr(BitWidth); - break; - } - case Type::FunctionTyID: { - const FunctionType *FTy = cast(Ty); - calcTypeName(FTy->getReturnType(), TypeStack, TypeNames, Result); - Result += " ("; - for (FunctionType::param_iterator I = FTy->param_begin(), - E = FTy->param_end(); I != E; ++I) { - if (I != FTy->param_begin()) - Result += ", "; - calcTypeName(*I, TypeStack, TypeNames, Result); - } - if (FTy->isVarArg()) { - if (FTy->getNumParams()) Result += ", "; - Result += "..."; - } - Result += ")"; - break; - } - case Type::StructTyID: { - const StructType *STy = cast(Ty); - if (STy->isPacked()) - Result += '<'; - Result += "{ "; - for (StructType::element_iterator I = STy->element_begin(), - E = STy->element_end(); I != E; ++I) { - calcTypeName(*I, TypeStack, TypeNames, Result); - if (next(I) != STy->element_end()) - Result += ','; - Result += ' '; - } - Result += '}'; - if (STy->isPacked()) - Result += '>'; - break; - } - case Type::PointerTyID: { - const PointerType *PTy = cast(Ty); - calcTypeName(PTy->getElementType(), TypeStack, TypeNames, Result); - if (unsigned AddressSpace = PTy->getAddressSpace()) - Result += " addrspace(" + utostr(AddressSpace) + ")"; - Result += "*"; - break; - } - case Type::ArrayTyID: { - const ArrayType *ATy = cast(Ty); - Result += "[" + utostr(ATy->getNumElements()) + " x "; - calcTypeName(ATy->getElementType(), TypeStack, TypeNames, Result); - Result += "]"; - break; - } - case Type::VectorTyID: { - const VectorType *PTy = cast(Ty); - Result += "<" + utostr(PTy->getNumElements()) + " x "; - calcTypeName(PTy->getElementType(), TypeStack, TypeNames, Result); - Result += ">"; - break; - } - case Type::OpaqueTyID: - Result += "opaque"; - break; - default: - Result += ""; - break; - } - - TypeStack.pop_back(); // Remove self from stack... -} - - -/// printTypeInt - The internal guts of printing out a type that has a -/// potentially named portion. -/// -static void printTypeInt(raw_ostream &Out, const Type *Ty, - std::map &TypeNames) { - // Primitive types always print out their description, regardless of whether - // they have been named or not. - // - if (Ty->isInteger() || (Ty->isPrimitiveType() && !isa(Ty))) { - Out << Ty->getDescription(); - return; - } - - // Check to see if the type is named. - std::map::iterator I = TypeNames.find(Ty); - if (I != TypeNames.end()) { - Out << I->second; - return; - } - - // Otherwise we have a type that has not been named but is a derived type. - // Carefully recurse the type hierarchy to print out any contained symbolic - // names. - // - std::vector TypeStack; - std::string TypeName; - calcTypeName(Ty, TypeStack, TypeNames, TypeName); - TypeNames.insert(std::make_pair(Ty, TypeName));//Cache type name for later use - Out << TypeName; -} - - -/// WriteTypeSymbolic - This attempts to write the specified type as a symbolic -/// type, iff there is an entry in the modules symbol table for the specified -/// type or one of it's component types. This is slower than a simple x << Type -/// -void llvm::WriteTypeSymbolic(std::ostream &Out, const Type *Ty, - const Module *M) { - raw_os_ostream RO(Out); - WriteTypeSymbolic(RO, Ty, M); -} - -void llvm::WriteTypeSymbolic(raw_ostream &Out, const Type *Ty, const Module *M){ - Out << ' '; - - // If they want us to print out a type, but there is no context, we can't - // print it symbolically. - if (!M) { - Out << Ty->getDescription(); - } else { - std::map TypeNames; - fillTypeNameTable(M, TypeNames); - printTypeInt(Out, Ty, TypeNames); - } -} - static const char *getPredicateText(unsigned predicate) { const char * pred = "unknown"; switch (predicate) { @@ -621,8 +701,7 @@ } static void WriteConstantInt(raw_ostream &Out, const Constant *CV, - std::map &TypeTable, - SlotTracker *Machine) { + TypePrinting &TypePrinter, SlotTracker *Machine) { if (const ConstantInt *CI = dyn_cast(CV)) { if (CI->getType() == Type::Int1Ty) { Out << (CI->getZExtValue() ? "true" : "false"); @@ -727,15 +806,15 @@ } else { // Cannot output in string format... Out << '['; if (CA->getNumOperands()) { - printTypeInt(Out, ETy, TypeTable); + TypePrinter.print(ETy); Out << ' '; WriteAsOperandInternal(Out, CA->getOperand(0), - TypeTable, Machine); + TypePrinter, Machine); for (unsigned i = 1, e = CA->getNumOperands(); i != e; ++i) { Out << ", "; - printTypeInt(Out, ETy, TypeTable); + TypePrinter.print(ETy); Out << ' '; - WriteAsOperandInternal(Out, CA->getOperand(i), TypeTable, Machine); + WriteAsOperandInternal(Out, CA->getOperand(i), TypePrinter, Machine); } } Out << ']'; @@ -750,17 +829,17 @@ unsigned N = CS->getNumOperands(); if (N) { Out << ' '; - printTypeInt(Out, CS->getOperand(0)->getType(), TypeTable); + TypePrinter.print(CS->getOperand(0)->getType()); Out << ' '; - WriteAsOperandInternal(Out, CS->getOperand(0), TypeTable, Machine); + WriteAsOperandInternal(Out, CS->getOperand(0), TypePrinter, Machine); for (unsigned i = 1; i < N; i++) { Out << ", "; - printTypeInt(Out, CS->getOperand(i)->getType(), TypeTable); + TypePrinter.print(CS->getOperand(i)->getType()); Out << ' '; - WriteAsOperandInternal(Out, CS->getOperand(i), TypeTable, Machine); + WriteAsOperandInternal(Out, CS->getOperand(i), TypePrinter, Machine); } Out << ' '; } @@ -776,14 +855,14 @@ assert(CP->getNumOperands() > 0 && "Number of operands for a PackedConst must be > 0"); Out << '<'; - printTypeInt(Out, ETy, TypeTable); + TypePrinter.print(ETy); Out << ' '; - WriteAsOperandInternal(Out, CP->getOperand(0), TypeTable, Machine); + WriteAsOperandInternal(Out, CP->getOperand(0), TypePrinter, Machine); for (unsigned i = 1, e = CP->getNumOperands(); i != e; ++i) { Out << ", "; - printTypeInt(Out, ETy, TypeTable); + TypePrinter.print(ETy); Out << ' '; - WriteAsOperandInternal(Out, CP->getOperand(i), TypeTable, Machine); + WriteAsOperandInternal(Out, CP->getOperand(i), TypePrinter, Machine); } Out << '>'; return; @@ -806,9 +885,9 @@ Out << " ("; for (User::const_op_iterator OI=CE->op_begin(); OI != CE->op_end(); ++OI) { - printTypeInt(Out, (*OI)->getType(), TypeTable); + TypePrinter.print((*OI)->getType()); Out << ' '; - WriteAsOperandInternal(Out, *OI, TypeTable, Machine); + WriteAsOperandInternal(Out, *OI, TypePrinter, Machine); if (OI+1 != CE->op_end()) Out << ", "; } @@ -821,7 +900,7 @@ if (CE->isCast()) { Out << " to "; - printTypeInt(Out, CE->getType(), TypeTable); + TypePrinter.print(CE->getType()); } Out << ')'; @@ -837,7 +916,7 @@ /// the whole instruction that generated it. /// static void WriteAsOperandInternal(raw_ostream &Out, const Value *V, - std::map &TypeTable, + TypePrinting &TypePrinter, SlotTracker *Machine) { if (V->hasName()) { PrintLLVMName(Out, V); @@ -846,7 +925,7 @@ const Constant *CV = dyn_cast(V); if (CV && !isa(CV)) { - WriteConstantInt(Out, CV, TypeTable, Machine); + WriteConstantInt(Out, CV, TypePrinter, Machine); return; } @@ -904,18 +983,15 @@ void llvm::WriteAsOperand(raw_ostream &Out, const Value *V, bool PrintType, const Module *Context) { - std::map TypeNames; if (Context == 0) Context = getModuleFromVal(V); - if (Context) - fillTypeNameTable(Context, TypeNames); - + TypePrinting TypePrinter(Context, Out); if (PrintType) { - printTypeInt(Out, V->getType(), TypeNames); + TypePrinter.print(V->getType()); Out << ' '; } - WriteAsOperandInternal(Out, V, TypeNames, 0); + WriteAsOperandInternal(Out, V, TypePrinter, 0); } @@ -925,17 +1001,13 @@ raw_ostream &Out; SlotTracker &Machine; const Module *TheModule; - std::map TypeNames; + TypePrinting TypePrinter; AssemblyAnnotationWriter *AnnotationWriter; public: inline AssemblyWriter(raw_ostream &o, SlotTracker &Mac, const Module *M, AssemblyAnnotationWriter *AAW) - : Out(o), Machine(Mac), TheModule(M), AnnotationWriter(AAW) { - - // If the module has a symbol table, take all global types and stuff their - // names into the TypeNames map. - // - fillTypeNameTable(M, TypeNames); + : Out(o), Machine(Mac), TheModule(M), TypePrinter(M, Out), + AnnotationWriter(AAW) { } void write(const Module *M) { printModule(M); } @@ -953,7 +1025,7 @@ void write(const BasicBlock *BB) { printBasicBlock(BB); } void write(const Instruction *I) { printInstruction(*I); } - void write(const Type *Ty) { printType(Ty); } +// void write(const Type *Ty) { printType(Ty); } void writeOperand(const Value *Op, bool PrintType); void writeParamOperand(const Value *Operand, Attributes Attrs); @@ -974,94 +1046,15 @@ // symbolic version of a type name. // void printType(const Type *Ty) { - printTypeInt(Out, Ty, TypeNames); + TypePrinter.print(Ty); } - // printTypeAtLeastOneLevel - Print out one level of the possibly complex type - // without considering any symbolic types that we may have equal to it. - // - void printTypeAtLeastOneLevel(const Type *Ty); - // printInfoComment - Print a little comment after the instruction indicating // which slot it occupies. void printInfoComment(const Value &V); }; } // end of llvm namespace -/// printTypeAtLeastOneLevel - Print out one level of the possibly complex type -/// without considering any symbolic types that we may have equal to it. -/// -void AssemblyWriter::printTypeAtLeastOneLevel(const Type *Ty) { - if (const IntegerType *ITy = dyn_cast(Ty)) { - Out << "i" << utostr(ITy->getBitWidth()); - return; - } - - if (const FunctionType *FTy = dyn_cast(Ty)) { - printType(FTy->getReturnType()); - Out << " ("; - for (FunctionType::param_iterator I = FTy->param_begin(), - E = FTy->param_end(); I != E; ++I) { - if (I != FTy->param_begin()) - Out << ", "; - printType(*I); - } - if (FTy->isVarArg()) { - if (FTy->getNumParams()) Out << ", "; - Out << "..."; - } - Out << ')'; - return; - } - - if (const StructType *STy = dyn_cast(Ty)) { - if (STy->isPacked()) - Out << '<'; - Out << "{ "; - for (StructType::element_iterator I = STy->element_begin(), - E = STy->element_end(); I != E; ++I) { - if (I != STy->element_begin()) - Out << ", "; - printType(*I); - } - Out << " }"; - if (STy->isPacked()) - Out << '>'; - return; - } - - if (const PointerType *PTy = dyn_cast(Ty)) { - printType(PTy->getElementType()); - if (unsigned AddressSpace = PTy->getAddressSpace()) - Out << " addrspace(" << AddressSpace << ")"; - Out << '*'; - return; - } - - if (const ArrayType *ATy = dyn_cast(Ty)) { - Out << '[' << ATy->getNumElements() << " x "; - printType(ATy->getElementType()); - Out << ']'; - return; - } - - if (const VectorType *PTy = dyn_cast(Ty)) { - Out << '<' << PTy->getNumElements() << " x "; - printType(PTy->getElementType()); - Out << '>'; - return; - } - - if (isa(Ty)) { - Out << "opaque"; - return; - } - - if (!Ty->isPrimitiveType()) - Out << ""; - printType(Ty); -} - void AssemblyWriter::writeOperand(const Value *Operand, bool PrintType) { if (Operand == 0) { @@ -1071,7 +1064,7 @@ printType(Operand->getType()); Out << ' '; } - WriteAsOperandInternal(Out, Operand, TypeNames, &Machine); + WriteAsOperandInternal(Out, Operand, TypePrinter, &Machine); } } @@ -1087,7 +1080,7 @@ Out << ' ' << Attribute::getAsString(Attrs); Out << ' '; // Print the operand - WriteAsOperandInternal(Out, Operand, TypeNames, &Machine); + WriteAsOperandInternal(Out, Operand, TypePrinter, &Machine); } } @@ -1240,7 +1233,7 @@ printType(F->getFunctionType()); Out << "* "; - WriteAsOperandInternal(Out, F, TypeNames, &Machine); + WriteAsOperandInternal(Out, F, TypePrinter, &Machine); } else if (const GlobalAlias *GA = dyn_cast(Aliasee)) { printType(GA->getType()); Out << " "; @@ -1268,8 +1261,7 @@ // Make sure we print out at least one level of the type structure, so // that we do not get %FILE = type %FILE - // - printTypeAtLeastOneLevel(TI->second); + TypePrinter.printAtLeastOneLevel(TI->second); Out << '\n'; } } @@ -1307,7 +1299,7 @@ Out << Attribute::getAsString(Attrs.getRetAttributes()) << ' '; printType(F->getReturnType()); Out << ' '; - WriteAsOperandInternal(Out, F, TypeNames, &Machine); + WriteAsOperandInternal(Out, F, TypePrinter, &Machine); Out << '('; Machine.incorporateFunction(F); @@ -1756,8 +1748,8 @@ W.write(GV); } else if (const Constant *C = dyn_cast(this)) { OS << C->getType()->getDescription() << ' '; - std::map TypeTable; - WriteConstantInt(OS, C, TypeTable, 0); + TypePrinting TypePrinter(0, OS); + WriteConstantInt(OS, C, TypePrinter, 0); } else if (const Argument *A = dyn_cast(this)) { WriteAsOperand(OS, this, true, A->getParent() ? A->getParent()->getParent() : 0); From sabre at nondot.org Sat Feb 28 14:28:50 2009 From: sabre at nondot.org (Chris Lattner) Date: Sat, 28 Feb 2009 20:28:50 -0000 Subject: [llvm-commits] [llvm] r65711 - /llvm/trunk/lib/VMCore/AsmWriter.cpp Message-ID: <200902282028.n1SKSpB7019121@zion.cs.uiuc.edu> Author: lattner Date: Sat Feb 28 14:28:50 2009 New Revision: 65711 URL: http://llvm.org/viewvc/llvm-project?rev=65711&view=rev Log: simplify condition Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=65711&r1=65710&r2=65711&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original) +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Sat Feb 28 14:28:50 2009 @@ -168,15 +168,18 @@ const TypeSymbolTable &ST = M->getTypeSymbolTable(); for (TypeSymbolTable::const_iterator TI = ST.begin(), E = ST.end(); TI != E; ++TI) { + const Type *Ty = cast(TI->second); + // As a heuristic, don't insert pointer to primitive types, because // they are used too often to have a single useful name. - // - const Type *Ty = cast(TI->second); - if (!isa(Ty) || - !cast(Ty)->getElementType()->isPrimitiveType() || - !cast(Ty)->getElementType()->isInteger() || - isa(cast(Ty)->getElementType())) - TypeNames.insert(std::make_pair(Ty, '%' + getLLVMName(TI->first))); + if (const PointerType *PTy = dyn_cast(Ty)) { + const Type *PETy = PTy->getElementType(); + if ((PETy->isPrimitiveType() || PETy->isInteger()) && + !isa(PETy)) + continue; + } + + TypeNames.insert(std::make_pair(Ty, '%' + getLLVMName(TI->first))); } } From sabre at nondot.org Sat Feb 28 14:31:14 2009 From: sabre at nondot.org (Chris Lattner) Date: Sat, 28 Feb 2009 20:31:14 -0000 Subject: [llvm-commits] [llvm] r65712 - /llvm/trunk/lib/VMCore/AsmWriter.cpp Message-ID: <200902282031.n1SKVEHr019219@zion.cs.uiuc.edu> Author: lattner Date: Sat Feb 28 14:31:14 2009 New Revision: 65712 URL: http://llvm.org/viewvc/llvm-project?rev=65712&view=rev Log: inline method into its only use and simplify the result. Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=65712&r1=65711&r2=65712&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original) +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Sat Feb 28 14:31:14 2009 @@ -125,16 +125,6 @@ OS << '"'; } -/// getLLVMName - Turn the specified string into an 'LLVM name', which is -/// surrounded with ""'s and escaped if it has special chars in it. -static std::string getLLVMName(const std::string &Name) { - assert(!Name.empty() && "Cannot get empty name!"); - std::string result; - raw_string_ostream OS(result); - PrintLLVMName(OS, Name.c_str(), Name.length(), NoPrefix); - return OS.str(); -} - /// PrintLLVMName - Turn the specified name into an 'LLVM name', which is either /// prefixed with % (if the string only contains simple characters) or is /// surrounded with ""'s (if it has special chars in it). Print it out. @@ -179,7 +169,10 @@ continue; } - TypeNames.insert(std::make_pair(Ty, '%' + getLLVMName(TI->first))); + std::string NameStr; + raw_string_ostream NameOS(NameStr); + PrintLLVMName(NameOS, TI->first.c_str(), TI->first.length(), LocalPrefix); + TypeNames.insert(std::make_pair(Ty, NameOS.str())); } } From sabre at nondot.org Sat Feb 28 14:34:19 2009 From: sabre at nondot.org (Chris Lattner) Date: Sat, 28 Feb 2009 20:34:19 -0000 Subject: [llvm-commits] [llvm] r65713 - /llvm/trunk/lib/VMCore/AsmWriter.cpp Message-ID: <200902282034.n1SKYJp1019402@zion.cs.uiuc.edu> Author: lattner Date: Sat Feb 28 14:34:19 2009 New Revision: 65713 URL: http://llvm.org/viewvc/llvm-project?rev=65713&view=rev Log: pull calcTypeName into TypePrinting class, make its type stack be a smallvector instead of vector. Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=65713&r1=65712&r2=65713&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original) +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Sat Feb 28 14:34:19 2009 @@ -147,6 +147,10 @@ void print(const Type *Ty); void printAtLeastOneLevel(const Type *Ty); + + private: + void calcTypeName(const Type *Ty, SmallVectorImpl &TypeStack, + std::string &Result); }; } // end anonymous namespace. @@ -169,6 +173,7 @@ continue; } + // Get the name as a string and insert it into TypeNames. std::string NameStr; raw_string_ostream NameOS(NameStr); PrintLLVMName(NameOS, TI->first.c_str(), TI->first.length(), LocalPrefix); @@ -176,10 +181,9 @@ } } -static void calcTypeName(const Type *Ty, - std::vector &TypeStack, - std::map &TypeNames, - std::string &Result) { +void TypePrinting::calcTypeName(const Type *Ty, + SmallVectorImpl &TypeStack, + std::string &Result) { if (Ty->isInteger() || (Ty->isPrimitiveType() && !isa(Ty))) { Result += Ty->getDescription(); // Base case return; @@ -219,13 +223,13 @@ } case Type::FunctionTyID: { const FunctionType *FTy = cast(Ty); - calcTypeName(FTy->getReturnType(), TypeStack, TypeNames, Result); + calcTypeName(FTy->getReturnType(), TypeStack, Result); Result += " ("; for (FunctionType::param_iterator I = FTy->param_begin(), E = FTy->param_end(); I != E; ++I) { if (I != FTy->param_begin()) Result += ", "; - calcTypeName(*I, TypeStack, TypeNames, Result); + calcTypeName(*I, TypeStack, Result); } if (FTy->isVarArg()) { if (FTy->getNumParams()) Result += ", "; @@ -241,7 +245,7 @@ Result += "{ "; for (StructType::element_iterator I = STy->element_begin(), E = STy->element_end(); I != E; ++I) { - calcTypeName(*I, TypeStack, TypeNames, Result); + calcTypeName(*I, TypeStack, Result); if (next(I) != STy->element_end()) Result += ','; Result += ' '; @@ -253,7 +257,7 @@ } case Type::PointerTyID: { const PointerType *PTy = cast(Ty); - calcTypeName(PTy->getElementType(), TypeStack, TypeNames, Result); + calcTypeName(PTy->getElementType(), TypeStack, Result); if (unsigned AddressSpace = PTy->getAddressSpace()) Result += " addrspace(" + utostr(AddressSpace) + ")"; Result += "*"; @@ -262,14 +266,14 @@ case Type::ArrayTyID: { const ArrayType *ATy = cast(Ty); Result += "[" + utostr(ATy->getNumElements()) + " x "; - calcTypeName(ATy->getElementType(), TypeStack, TypeNames, Result); + calcTypeName(ATy->getElementType(), TypeStack, Result); Result += "]"; break; } case Type::VectorTyID: { const VectorType *PTy = cast(Ty); Result += "<" + utostr(PTy->getNumElements()) + " x "; - calcTypeName(PTy->getElementType(), TypeStack, TypeNames, Result); + calcTypeName(PTy->getElementType(), TypeStack, Result); Result += ">"; break; } @@ -305,9 +309,9 @@ // Otherwise we have a type that has not been named but is a derived type. // Carefully recurse the type hierarchy to print out any contained symbolic // names. - std::vector TypeStack; + SmallVector TypeStack; std::string TypeName; - calcTypeName(Ty, TypeStack, TypeNames, TypeName); + calcTypeName(Ty, TypeStack, TypeName); TypeNames.insert(std::make_pair(Ty, TypeName));//Cache type name for later use OS << TypeName; } From sabre at nondot.org Sat Feb 28 14:35:42 2009 From: sabre at nondot.org (Chris Lattner) Date: Sat, 28 Feb 2009 20:35:42 -0000 Subject: [llvm-commits] [llvm] r65714 - /llvm/trunk/lib/VMCore/AsmWriter.cpp Message-ID: <200902282035.n1SKZgUP019458@zion.cs.uiuc.edu> Author: lattner Date: Sat Feb 28 14:35:42 2009 New Revision: 65714 URL: http://llvm.org/viewvc/llvm-project?rev=65714&view=rev Log: fix indentation, remove dead integer case. Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=65714&r1=65713&r2=65714&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original) +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Sat Feb 28 14:35:42 2009 @@ -216,73 +216,68 @@ TypeStack.push_back(Ty); // Recursive case: Add us to the stack.. switch (Ty->getTypeID()) { - case Type::IntegerTyID: { - unsigned BitWidth = cast(Ty)->getBitWidth(); - Result += "i" + utostr(BitWidth); - break; - } - case Type::FunctionTyID: { - const FunctionType *FTy = cast(Ty); - calcTypeName(FTy->getReturnType(), TypeStack, Result); - Result += " ("; - for (FunctionType::param_iterator I = FTy->param_begin(), - E = FTy->param_end(); I != E; ++I) { - if (I != FTy->param_begin()) - Result += ", "; - calcTypeName(*I, TypeStack, Result); - } - if (FTy->isVarArg()) { - if (FTy->getNumParams()) Result += ", "; - Result += "..."; - } - Result += ")"; - break; + case Type::FunctionTyID: { + const FunctionType *FTy = cast(Ty); + calcTypeName(FTy->getReturnType(), TypeStack, Result); + Result += " ("; + for (FunctionType::param_iterator I = FTy->param_begin(), + E = FTy->param_end(); I != E; ++I) { + if (I != FTy->param_begin()) + Result += ", "; + calcTypeName(*I, TypeStack, Result); } - case Type::StructTyID: { - const StructType *STy = cast(Ty); - if (STy->isPacked()) - Result += '<'; - Result += "{ "; - for (StructType::element_iterator I = STy->element_begin(), - E = STy->element_end(); I != E; ++I) { - calcTypeName(*I, TypeStack, Result); - if (next(I) != STy->element_end()) - Result += ','; - Result += ' '; - } - Result += '}'; - if (STy->isPacked()) - Result += '>'; - break; - } - case Type::PointerTyID: { - const PointerType *PTy = cast(Ty); - calcTypeName(PTy->getElementType(), TypeStack, Result); - if (unsigned AddressSpace = PTy->getAddressSpace()) - Result += " addrspace(" + utostr(AddressSpace) + ")"; - Result += "*"; - break; - } - case Type::ArrayTyID: { - const ArrayType *ATy = cast(Ty); - Result += "[" + utostr(ATy->getNumElements()) + " x "; - calcTypeName(ATy->getElementType(), TypeStack, Result); - Result += "]"; - break; - } - case Type::VectorTyID: { - const VectorType *PTy = cast(Ty); - Result += "<" + utostr(PTy->getNumElements()) + " x "; - calcTypeName(PTy->getElementType(), TypeStack, Result); - Result += ">"; - break; - } - case Type::OpaqueTyID: - Result += "opaque"; - break; - default: - Result += ""; - break; + if (FTy->isVarArg()) { + if (FTy->getNumParams()) Result += ", "; + Result += "..."; + } + Result += ")"; + break; + } + case Type::StructTyID: { + const StructType *STy = cast(Ty); + if (STy->isPacked()) + Result += '<'; + Result += "{ "; + for (StructType::element_iterator I = STy->element_begin(), + E = STy->element_end(); I != E; ++I) { + calcTypeName(*I, TypeStack, Result); + if (next(I) != STy->element_end()) + Result += ','; + Result += ' '; + } + Result += '}'; + if (STy->isPacked()) + Result += '>'; + break; + } + case Type::PointerTyID: { + const PointerType *PTy = cast(Ty); + calcTypeName(PTy->getElementType(), TypeStack, Result); + if (unsigned AddressSpace = PTy->getAddressSpace()) + Result += " addrspace(" + utostr(AddressSpace) + ")"; + Result += "*"; + break; + } + case Type::ArrayTyID: { + const ArrayType *ATy = cast(Ty); + Result += "[" + utostr(ATy->getNumElements()) + " x "; + calcTypeName(ATy->getElementType(), TypeStack, Result); + Result += "]"; + break; + } + case Type::VectorTyID: { + const VectorType *PTy = cast(Ty); + Result += "<" + utostr(PTy->getNumElements()) + " x "; + calcTypeName(PTy->getElementType(), TypeStack, Result); + Result += ">"; + break; + } + case Type::OpaqueTyID: + Result += "opaque"; + break; + default: + Result += ""; + break; } TypeStack.pop_back(); // Remove self from stack... From sabre at nondot.org Sat Feb 28 14:40:35 2009 From: sabre at nondot.org (Chris Lattner) Date: Sat, 28 Feb 2009 20:40:35 -0000 Subject: [llvm-commits] [llvm] r65715 - /llvm/trunk/lib/VMCore/AsmWriter.cpp Message-ID: <200902282040.n1SKeapP019714@zion.cs.uiuc.edu> Author: lattner Date: Sat Feb 28 14:40:29 2009 New Revision: 65715 URL: http://llvm.org/viewvc/llvm-project?rev=65715&view=rev Log: remove a bunch of nearly-duplicated code. Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=65715&r1=65714&r2=65715&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original) +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Sat Feb 28 14:40:29 2009 @@ -191,7 +191,9 @@ // Check to see if the type is named. std::map::iterator I = TypeNames.find(Ty); - if (I != TypeNames.end()) { + if (I != TypeNames.end() && + // If the name wasn't temporarily removed use it. + !I->second.empty()) { Result += I->second; return; } @@ -314,70 +316,23 @@ /// printAtLeastOneLevel - Print out one level of the possibly complex type /// without considering any symbolic types that we may have equal to it. void TypePrinting::printAtLeastOneLevel(const Type *Ty) { - // FIXME: Just call calcTypeName! - if (const FunctionType *FTy = dyn_cast(Ty)) { - print(FTy->getReturnType()); - OS << " ("; - for (FunctionType::param_iterator I = FTy->param_begin(), - E = FTy->param_end(); I != E; ++I) { - if (I != FTy->param_begin()) - OS << ", "; - print(*I); - } - if (FTy->isVarArg()) { - if (FTy->getNumParams()) OS << ", "; - OS << "..."; - } - OS << ')'; - return; - } - - if (const StructType *STy = dyn_cast(Ty)) { - if (STy->isPacked()) - OS << '<'; - OS << "{ "; - for (StructType::element_iterator I = STy->element_begin(), - E = STy->element_end(); I != E; ++I) { - if (I != STy->element_begin()) - OS << ", "; - print(*I); - } - OS << " }"; - if (STy->isPacked()) - OS << '>'; - return; - } - - if (const PointerType *PTy = dyn_cast(Ty)) { - print(PTy->getElementType()); - if (unsigned AddressSpace = PTy->getAddressSpace()) - OS << " addrspace(" << AddressSpace << ")"; - OS << '*'; - return; - } - - if (const ArrayType *ATy = dyn_cast(Ty)) { - OS << '[' << ATy->getNumElements() << " x "; - print(ATy->getElementType()); - OS << ']'; - return; - } + // If the type does not have a name, then it is already guaranteed to print at + // least one level. + std::map::iterator I = TypeNames.find(Ty); + if (I == TypeNames.end()) + return print(Ty); - if (const VectorType *PTy = dyn_cast(Ty)) { - OS << '<' << PTy->getNumElements() << " x "; - print(PTy->getElementType()); - OS << '>'; - return; - } + // Otherwise, temporarily remove the name and print it. + std::string OldName; + std::swap(OldName, I->second); - if (isa(Ty)) { - OS << "opaque"; - return; - } - - if (!Ty->isPrimitiveType() && !isa(Ty)) - OS << ""; - print(Ty); + SmallVector TypeStack; + std::string TypeName; + calcTypeName(Ty, TypeStack, TypeName); + OS << TypeName; + + // Restore the name. + std::swap(OldName, I->second); } From sabre at nondot.org Sat Feb 28 14:49:40 2009 From: sabre at nondot.org (Chris Lattner) Date: Sat, 28 Feb 2009 20:49:40 -0000 Subject: [llvm-commits] [llvm] r65716 - /llvm/trunk/lib/VMCore/AsmWriter.cpp Message-ID: <200902282049.n1SKnfVc020041@zion.cs.uiuc.edu> Author: lattner Date: Sat Feb 28 14:49:40 2009 New Revision: 65716 URL: http://llvm.org/viewvc/llvm-project?rev=65716&view=rev Log: make CalcTypeName take a stream instead of a string to concat onto, eliminate redundant opaque handling code. Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=65716&r1=65715&r2=65716&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original) +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Sat Feb 28 14:49:40 2009 @@ -149,8 +149,8 @@ void printAtLeastOneLevel(const Type *Ty); private: - void calcTypeName(const Type *Ty, SmallVectorImpl &TypeStack, - std::string &Result); + void CalcTypeName(const Type *Ty, SmallVectorImpl &TypeStack, + raw_ostream &Result); }; } // end anonymous namespace. @@ -181,11 +181,13 @@ } } -void TypePrinting::calcTypeName(const Type *Ty, +/// CalcTypeName - Write the specified type to the specified raw_ostream, making +/// use of type names or up references to shorten the type name where possible. +void TypePrinting::CalcTypeName(const Type *Ty, SmallVectorImpl &TypeStack, - std::string &Result) { + raw_ostream &Result) { if (Ty->isInteger() || (Ty->isPrimitiveType() && !isa(Ty))) { - Result += Ty->getDescription(); // Base case + Result << Ty->getDescription(); // Base case return; } @@ -194,12 +196,7 @@ if (I != TypeNames.end() && // If the name wasn't temporarily removed use it. !I->second.empty()) { - Result += I->second; - return; - } - - if (isa(Ty)) { - Result += "opaque"; + Result << I->second; return; } @@ -211,7 +208,7 @@ // that we have looped back to a type that we have previously visited. // Generate the appropriate upreference to handle this. if (Slot < CurSize) { - Result += "\\" + utostr(CurSize-Slot); // Here's the upreference + Result << '\\' << unsigned(CurSize-Slot); // Here's the upreference return; } @@ -220,69 +217,69 @@ switch (Ty->getTypeID()) { case Type::FunctionTyID: { const FunctionType *FTy = cast(Ty); - calcTypeName(FTy->getReturnType(), TypeStack, Result); - Result += " ("; + CalcTypeName(FTy->getReturnType(), TypeStack, Result); + Result << " ("; for (FunctionType::param_iterator I = FTy->param_begin(), E = FTy->param_end(); I != E; ++I) { if (I != FTy->param_begin()) - Result += ", "; - calcTypeName(*I, TypeStack, Result); + Result << ", "; + CalcTypeName(*I, TypeStack, Result); } if (FTy->isVarArg()) { - if (FTy->getNumParams()) Result += ", "; - Result += "..."; + if (FTy->getNumParams()) Result << ", "; + Result << "..."; } - Result += ")"; + Result << ')'; break; } case Type::StructTyID: { const StructType *STy = cast(Ty); if (STy->isPacked()) - Result += '<'; - Result += "{ "; + Result << '<'; + Result << "{ "; for (StructType::element_iterator I = STy->element_begin(), E = STy->element_end(); I != E; ++I) { - calcTypeName(*I, TypeStack, Result); + CalcTypeName(*I, TypeStack, Result); if (next(I) != STy->element_end()) - Result += ','; - Result += ' '; + Result << ','; + Result << ' '; } - Result += '}'; + Result << '}'; if (STy->isPacked()) - Result += '>'; + Result << '>'; break; } case Type::PointerTyID: { const PointerType *PTy = cast(Ty); - calcTypeName(PTy->getElementType(), TypeStack, Result); + CalcTypeName(PTy->getElementType(), TypeStack, Result); if (unsigned AddressSpace = PTy->getAddressSpace()) - Result += " addrspace(" + utostr(AddressSpace) + ")"; - Result += "*"; + Result << " addrspace(" << AddressSpace << ')'; + Result << '*'; break; } case Type::ArrayTyID: { const ArrayType *ATy = cast(Ty); - Result += "[" + utostr(ATy->getNumElements()) + " x "; - calcTypeName(ATy->getElementType(), TypeStack, Result); - Result += "]"; + Result << "[" << ATy->getNumElements() << " x "; + CalcTypeName(ATy->getElementType(), TypeStack, Result); + Result << ']'; break; } case Type::VectorTyID: { const VectorType *PTy = cast(Ty); - Result += "<" + utostr(PTy->getNumElements()) + " x "; - calcTypeName(PTy->getElementType(), TypeStack, Result); - Result += ">"; + Result << "<" << PTy->getNumElements() << " x "; + CalcTypeName(PTy->getElementType(), TypeStack, Result); + Result << '>'; break; } case Type::OpaqueTyID: - Result += "opaque"; + Result << "opaque"; break; default: - Result += ""; + Result << ""; break; } - TypeStack.pop_back(); // Remove self from stack... + TypeStack.pop_back(); // Remove self from stack. } /// printTypeInt - The internal guts of printing out a type that has a @@ -308,9 +305,15 @@ // names. SmallVector TypeStack; std::string TypeName; - calcTypeName(Ty, TypeStack, TypeName); - TypeNames.insert(std::make_pair(Ty, TypeName));//Cache type name for later use - OS << TypeName; + + raw_string_ostream TypeOS(TypeName); + + + CalcTypeName(Ty, TypeStack, TypeOS); + OS << TypeOS.str(); + + // Cache type name for later use. + TypeNames.insert(std::make_pair(Ty, TypeOS.str())); } /// printAtLeastOneLevel - Print out one level of the possibly complex type @@ -318,26 +321,23 @@ void TypePrinting::printAtLeastOneLevel(const Type *Ty) { // If the type does not have a name, then it is already guaranteed to print at // least one level. - std::map::iterator I = TypeNames.find(Ty); + std::map::iterator I = TypeNames.find(Ty); if (I == TypeNames.end()) return print(Ty); // Otherwise, temporarily remove the name and print it. std::string OldName; std::swap(OldName, I->second); - + + // Print the type without the name. SmallVector TypeStack; - std::string TypeName; - calcTypeName(Ty, TypeStack, TypeName); - OS << TypeName; + CalcTypeName(Ty, TypeStack, OS); // Restore the name. std::swap(OldName, I->second); } - - /// WriteTypeSymbolic - This attempts to write the specified type as a symbolic /// type, iff there is an entry in the modules symbol table for the specified /// type or one of it's component types. This is slower than a simple x << Type @@ -346,13 +346,7 @@ // FIXME: Remove this space. Out << ' '; - // If they want us to print out a type, but there is no context, we can't - // print it symbolically. - if (!M) { - Out << Ty->getDescription(); - } else { - TypePrinting(M, Out).print(Ty); - } + TypePrinting(M, Out).print(Ty); } // std::ostream adaptor. From sabre at nondot.org Sat Feb 28 15:04:54 2009 From: sabre at nondot.org (Chris Lattner) Date: Sat, 28 Feb 2009 21:04:54 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r65719 - in /llvm-gcc-4.2/trunk/gcc: llvm-backend.cpp llvm-types.cpp Message-ID: <200902282104.n1SL4s1p020613@zion.cs.uiuc.edu> Author: lattner Date: Sat Feb 28 15:04:53 2009 New Revision: 65719 URL: http://llvm.org/viewvc/llvm-project?rev=65719&view=rev Log: switch some stuff from std::ostream to raw_ostream. Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=65719&r1=65718&r2=65719&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Sat Feb 28 15:04:53 2009 @@ -1700,7 +1700,12 @@ void print_llvm_type(FILE *file, void *LLVM) { oFILEstream FS(file); FS << "LLVM: "; - WriteTypeSymbolic(FS, (const Type*)LLVM, TheModule); + + // FIXME: oFILEstream can probably be removed in favor of a new raw_ostream + // adaptor which would be simpler and more efficient. In the meantime, just + // adapt the adaptor. + raw_os_ostream RO(FS); + WriteTypeSymbolic(RO, (const Type*)LLVM, TheModule); } // Get a register name given its decl. In 4.2 unlike 4.0 these names Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp?rev=65719&r1=65718&r2=65719&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Sat Feb 28 15:04:53 2009 @@ -35,7 +35,7 @@ #include "llvm/Assembly/Writer.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/StringExtras.h" -#include +#include "llvm/Support/raw_ostream.h" #include extern "C" { @@ -498,7 +498,8 @@ AbsTy->removeAbstractTypeUser(this); } void TypeRefinementDatabase::dump() const { - std::cerr << "TypeRefinementDatabase\n"; + outs() << "TypeRefinementDatabase\n"; + outs().flush(); } //===----------------------------------------------------------------------===// @@ -1622,14 +1623,16 @@ } void StructTypeConversionInfo::dump() const { - std::cerr << "Info has " << Elements.size() << " fields:\n"; + raw_ostream &OS = outs(); + OS << "Info has " << Elements.size() << " fields:\n"; for (unsigned i = 0, e = Elements.size(); i != e; ++i) { - std::cerr << " Offset = " << ElementOffsetInBytes[i] - << " Size = " << ElementSizeInBytes[i] - << " Type = "; - WriteTypeSymbolic(std::cerr, Elements[i], TheModule); - std::cerr << "\n"; + OS << " Offset = " << ElementOffsetInBytes[i] + << " Size = " << ElementSizeInBytes[i] + << " Type = "; + WriteTypeSymbolic(OS, Elements[i], TheModule); + OS << "\n"; } + OS.flush(); } std::map StructTypeInfoMap; From sabre at nondot.org Sat Feb 28 15:05:52 2009 From: sabre at nondot.org (Chris Lattner) Date: Sat, 28 Feb 2009 21:05:52 -0000 Subject: [llvm-commits] [llvm] r65720 - in /llvm/trunk: include/llvm/Assembly/Writer.h lib/Analysis/IPA/FindUsedTypes.cpp lib/VMCore/AsmWriter.cpp lib/VMCore/Verifier.cpp Message-ID: <200902282105.n1SL5qYZ020675@zion.cs.uiuc.edu> Author: lattner Date: Sat Feb 28 15:05:51 2009 New Revision: 65720 URL: http://llvm.org/viewvc/llvm-project?rev=65720&view=rev Log: Change WriteTypeSymbolic to not put a space out before types, also, remove the old std::ostream version. Modified: llvm/trunk/include/llvm/Assembly/Writer.h llvm/trunk/lib/Analysis/IPA/FindUsedTypes.cpp llvm/trunk/lib/VMCore/AsmWriter.cpp llvm/trunk/lib/VMCore/Verifier.cpp Modified: llvm/trunk/include/llvm/Assembly/Writer.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Assembly/Writer.h?rev=65720&r1=65719&r2=65720&view=diff ============================================================================== --- llvm/trunk/include/llvm/Assembly/Writer.h (original) +++ llvm/trunk/include/llvm/Assembly/Writer.h Sat Feb 28 15:05:51 2009 @@ -27,10 +27,9 @@ class raw_ostream; // WriteTypeSymbolic - This attempts to write the specified type as a symbolic -// type, iff there is an entry in the Module's symbol table for the specified -// type or one of its component types. This is slower than a simple x << Type; +// type, if there is an entry in the Module's symbol table for the specified +// type or one of its component types. // -void WriteTypeSymbolic(std::ostream &, const Type *, const Module *M); void WriteTypeSymbolic(raw_ostream &, const Type *, const Module *M); // WriteAsOperand - Write the name of the specified value out to the specified Modified: llvm/trunk/lib/Analysis/IPA/FindUsedTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/FindUsedTypes.cpp?rev=65720&r1=65719&r2=65720&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/IPA/FindUsedTypes.cpp (original) +++ llvm/trunk/lib/Analysis/IPA/FindUsedTypes.cpp Sat Feb 28 15:05:51 2009 @@ -19,6 +19,7 @@ #include "llvm/Module.h" #include "llvm/Assembly/Writer.h" #include "llvm/Support/InstIterator.h" +#include "llvm/Support/raw_ostream.h" using namespace llvm; char FindUsedTypes::ID = 0; @@ -91,11 +92,13 @@ // passed in, then the types are printed symbolically if possible, using the // symbol table from the module. // -void FindUsedTypes::print(std::ostream &o, const Module *M) const { - o << "Types in use by this module:\n"; +void FindUsedTypes::print(std::ostream &OS, const Module *M) const { + raw_os_ostream RO(OS); + RO << "Types in use by this module:\n"; for (std::set::const_iterator I = UsedTypes.begin(), E = UsedTypes.end(); I != E; ++I) { - WriteTypeSymbolic(o << " ", *I, M); - o << "\n"; + RO << " "; + WriteTypeSymbolic(RO, *I, M); + RO << '\n'; } } Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=65720&r1=65719&r2=65720&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original) +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Sat Feb 28 15:05:51 2009 @@ -259,7 +259,7 @@ } case Type::ArrayTyID: { const ArrayType *ATy = cast(Ty); - Result << "[" << ATy->getNumElements() << " x "; + Result << '[' << ATy->getNumElements() << " x "; CalcTypeName(ATy->getElementType(), TypeStack, Result); Result << ']'; break; @@ -307,8 +307,6 @@ std::string TypeName; raw_string_ostream TypeOS(TypeName); - - CalcTypeName(Ty, TypeStack, TypeOS); OS << TypeOS.str(); @@ -340,23 +338,12 @@ /// WriteTypeSymbolic - This attempts to write the specified type as a symbolic /// type, iff there is an entry in the modules symbol table for the specified -/// type or one of it's component types. This is slower than a simple x << Type +/// type or one of it's component types. /// void llvm::WriteTypeSymbolic(raw_ostream &Out, const Type *Ty, const Module *M){ - // FIXME: Remove this space. - Out << ' '; - TypePrinting(M, Out).print(Ty); } -// std::ostream adaptor. -void llvm::WriteTypeSymbolic(std::ostream &Out, const Type *Ty, - const Module *M) { - raw_os_ostream RO(Out); - WriteTypeSymbolic(RO, Ty, M); -} - - //===----------------------------------------------------------------------===// // SlotTracker Class: Enumerate slot numbers for unnamed values //===----------------------------------------------------------------------===// @@ -1713,9 +1700,6 @@ void Value::dump() const { print(errs()); errs() << '\n'; errs().flush(); } // Type::dump - allow easy printing of Types from the debugger. -void Type::dump() const { print(errs()); errs() << '\n'; errs().flush(); } - -// Type::dump - allow easy printing of Types from the debugger. // This one uses type names from the given context module void Type::dump(const Module *Context) const { WriteTypeSymbolic(errs(), this, Context); @@ -1723,6 +1707,10 @@ errs().flush(); } +// Type::dump - allow easy printing of Types from the debugger. +void Type::dump() const { dump(0); } + + // Module::dump() - Allow printing of Modules from the debugger. void Module::dump() const { print(errs(), 0); errs().flush(); } Modified: llvm/trunk/lib/VMCore/Verifier.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=65720&r1=65719&r2=65720&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Verifier.cpp (original) +++ llvm/trunk/lib/VMCore/Verifier.cpp Sat Feb 28 15:05:51 2009 @@ -61,6 +61,7 @@ #include "llvm/ADT/StringExtras.h" #include "llvm/ADT/STLExtras.h" #include "llvm/Support/Compiler.h" +#include "llvm/Support/raw_ostream.h" #include #include #include @@ -290,8 +291,10 @@ } void WriteType(const Type *T) { - if ( !T ) return; - WriteTypeSymbolic(msgs, T, Mod ); + if (!T) return; + raw_os_ostream RO(msgs); + RO << ' '; + WriteTypeSymbolic(RO, T, Mod); } From sabre at nondot.org Sat Feb 28 15:11:05 2009 From: sabre at nondot.org (Chris Lattner) Date: Sat, 28 Feb 2009 21:11:05 -0000 Subject: [llvm-commits] [llvm] r65721 - /llvm/trunk/lib/VMCore/AsmWriter.cpp Message-ID: <200902282111.n1SLB54W020896@zion.cs.uiuc.edu> Author: lattner Date: Sat Feb 28 15:11:05 2009 New Revision: 65721 URL: http://llvm.org/viewvc/llvm-project?rev=65721&view=rev Log: simplifications Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=65721&r1=65720&r2=65721&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original) +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Sat Feb 28 15:11:05 2009 @@ -1650,11 +1650,12 @@ print(OS); } -void Type::print(raw_ostream &o) const { - if (this == 0) - o << ""; - else - o << getDescription(); +void Type::print(raw_ostream &OS) const { + if (this == 0) { + OS << ""; + return; + } + TypePrinting(0, OS).print(this); } void Value::print(raw_ostream &OS, AssemblyAnnotationWriter *AAW) const { @@ -1678,8 +1679,9 @@ AssemblyWriter W(OS, SlotTable, GV->getParent(), 0); W.write(GV); } else if (const Constant *C = dyn_cast(this)) { - OS << C->getType()->getDescription() << ' '; TypePrinting TypePrinter(0, OS); + TypePrinter.print(C->getType()); + OS << ' '; WriteConstantInt(OS, C, TypePrinter, 0); } else if (const Argument *A = dyn_cast(this)) { WriteAsOperand(OS, this, true, From sabre at nondot.org Sat Feb 28 15:18:43 2009 From: sabre at nondot.org (Chris Lattner) Date: Sat, 28 Feb 2009 21:18:43 -0000 Subject: [llvm-commits] [llvm] r65722 - /llvm/trunk/lib/VMCore/AsmWriter.cpp Message-ID: <200902282118.n1SLIh7F021167@zion.cs.uiuc.edu> Author: lattner Date: Sat Feb 28 15:18:43 2009 New Revision: 65722 URL: http://llvm.org/viewvc/llvm-project?rev=65722&view=rev Log: stop calling Type::getDescription(). Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=65722&r1=65721&r2=65722&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original) +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Sat Feb 28 15:18:43 2009 @@ -173,6 +173,10 @@ continue; } + // Likewise don't insert primitives either. + if (Ty->isInteger() || Ty->isPrimitiveType()) + continue; + // Get the name as a string and insert it into TypeNames. std::string NameStr; raw_string_ostream NameOS(NameStr); @@ -186,11 +190,6 @@ void TypePrinting::CalcTypeName(const Type *Ty, SmallVectorImpl &TypeStack, raw_ostream &Result) { - if (Ty->isInteger() || (Ty->isPrimitiveType() && !isa(Ty))) { - Result << Ty->getDescription(); // Base case - return; - } - // Check to see if the type is named. std::map::iterator I = TypeNames.find(Ty); if (I != TypeNames.end() && @@ -215,6 +214,17 @@ TypeStack.push_back(Ty); // Recursive case: Add us to the stack.. switch (Ty->getTypeID()) { + case Type::VoidTyID: Result << "void"; break; + case Type::FloatTyID: Result << "float"; break; + case Type::DoubleTyID: Result << "double"; break; + case Type::X86_FP80TyID: Result << "x86_fp80"; break; + case Type::FP128TyID: Result << "fp128"; break; + case Type::PPC_FP128TyID: Result << "ppc_fp128"; break; + case Type::LabelTyID: Result << "label"; break; + case Type::IntegerTyID: + Result << 'i' << cast(Ty)->getBitWidth(); + break; + case Type::FunctionTyID: { const FunctionType *FTy = cast(Ty); CalcTypeName(FTy->getReturnType(), TypeStack, Result); @@ -286,13 +296,6 @@ /// potentially named portion. /// void TypePrinting::print(const Type *Ty) { - // Primitive types always print out their description, regardless of whether - // they have been named or not. - if (Ty->isInteger() || (Ty->isPrimitiveType() && !isa(Ty))) { - OS << Ty->getDescription(); - return; - } - // Check to see if the type is named. std::map::iterator I = TypeNames.find(Ty); if (I != TypeNames.end()) { From sabre at nondot.org Sat Feb 28 15:26:53 2009 From: sabre at nondot.org (Chris Lattner) Date: Sat, 28 Feb 2009 21:26:53 -0000 Subject: [llvm-commits] [llvm] r65723 - /llvm/trunk/lib/VMCore/AsmWriter.cpp Message-ID: <200902282126.n1SLQsOC021487@zion.cs.uiuc.edu> Author: lattner Date: Sat Feb 28 15:26:53 2009 New Revision: 65723 URL: http://llvm.org/viewvc/llvm-project?rev=65723&view=rev Log: do not embed the raw_ostream into TypePrinting, pass it as an argument to print etc. Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=65723&r1=65722&r2=65723&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original) +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Sat Feb 28 15:26:53 2009 @@ -141,12 +141,11 @@ /// TypePrinting - Type printing machinery. class TypePrinting { std::map TypeNames; - raw_ostream &OS; public: - TypePrinting(const Module *M, raw_ostream &os); + TypePrinting(const Module *M); - void print(const Type *Ty); - void printAtLeastOneLevel(const Type *Ty); + void print(const Type *Ty, raw_ostream &OS); + void printAtLeastOneLevel(const Type *Ty, raw_ostream &OS); private: void CalcTypeName(const Type *Ty, SmallVectorImpl &TypeStack, @@ -154,7 +153,7 @@ }; } // end anonymous namespace. -TypePrinting::TypePrinting(const Module *M, raw_ostream &os) : OS(os) { +TypePrinting::TypePrinting(const Module *M) { if (M == 0) return; // If the module has a symbol table, take all global types and stuff their @@ -295,7 +294,7 @@ /// printTypeInt - The internal guts of printing out a type that has a /// potentially named portion. /// -void TypePrinting::print(const Type *Ty) { +void TypePrinting::print(const Type *Ty, raw_ostream &OS) { // Check to see if the type is named. std::map::iterator I = TypeNames.find(Ty); if (I != TypeNames.end()) { @@ -319,12 +318,12 @@ /// printAtLeastOneLevel - Print out one level of the possibly complex type /// without considering any symbolic types that we may have equal to it. -void TypePrinting::printAtLeastOneLevel(const Type *Ty) { +void TypePrinting::printAtLeastOneLevel(const Type *Ty, raw_ostream &OS) { // If the type does not have a name, then it is already guaranteed to print at // least one level. std::map::iterator I = TypeNames.find(Ty); if (I == TypeNames.end()) - return print(Ty); + return print(Ty, OS); // Otherwise, temporarily remove the name and print it. std::string OldName; @@ -343,8 +342,8 @@ /// type, iff there is an entry in the modules symbol table for the specified /// type or one of it's component types. /// -void llvm::WriteTypeSymbolic(raw_ostream &Out, const Type *Ty, const Module *M){ - TypePrinting(M, Out).print(Ty); +void llvm::WriteTypeSymbolic(raw_ostream &OS, const Type *Ty, const Module *M){ + TypePrinting(M).print(Ty, OS); } //===----------------------------------------------------------------------===// @@ -740,13 +739,13 @@ } else { // Cannot output in string format... Out << '['; if (CA->getNumOperands()) { - TypePrinter.print(ETy); + TypePrinter.print(ETy, Out); Out << ' '; WriteAsOperandInternal(Out, CA->getOperand(0), TypePrinter, Machine); for (unsigned i = 1, e = CA->getNumOperands(); i != e; ++i) { Out << ", "; - TypePrinter.print(ETy); + TypePrinter.print(ETy, Out); Out << ' '; WriteAsOperandInternal(Out, CA->getOperand(i), TypePrinter, Machine); } @@ -763,14 +762,14 @@ unsigned N = CS->getNumOperands(); if (N) { Out << ' '; - TypePrinter.print(CS->getOperand(0)->getType()); + TypePrinter.print(CS->getOperand(0)->getType(), Out); Out << ' '; WriteAsOperandInternal(Out, CS->getOperand(0), TypePrinter, Machine); for (unsigned i = 1; i < N; i++) { Out << ", "; - TypePrinter.print(CS->getOperand(i)->getType()); + TypePrinter.print(CS->getOperand(i)->getType(), Out); Out << ' '; WriteAsOperandInternal(Out, CS->getOperand(i), TypePrinter, Machine); @@ -789,12 +788,12 @@ assert(CP->getNumOperands() > 0 && "Number of operands for a PackedConst must be > 0"); Out << '<'; - TypePrinter.print(ETy); + TypePrinter.print(ETy, Out); Out << ' '; WriteAsOperandInternal(Out, CP->getOperand(0), TypePrinter, Machine); for (unsigned i = 1, e = CP->getNumOperands(); i != e; ++i) { Out << ", "; - TypePrinter.print(ETy); + TypePrinter.print(ETy, Out); Out << ' '; WriteAsOperandInternal(Out, CP->getOperand(i), TypePrinter, Machine); } @@ -819,7 +818,7 @@ Out << " ("; for (User::const_op_iterator OI=CE->op_begin(); OI != CE->op_end(); ++OI) { - TypePrinter.print((*OI)->getType()); + TypePrinter.print((*OI)->getType(), Out); Out << ' '; WriteAsOperandInternal(Out, *OI, TypePrinter, Machine); if (OI+1 != CE->op_end()) @@ -834,7 +833,7 @@ if (CE->isCast()) { Out << " to "; - TypePrinter.print(CE->getType()); + TypePrinter.print(CE->getType(), Out); } Out << ')'; @@ -919,9 +918,9 @@ const Module *Context) { if (Context == 0) Context = getModuleFromVal(V); - TypePrinting TypePrinter(Context, Out); + TypePrinting TypePrinter(Context); if (PrintType) { - TypePrinter.print(V->getType()); + TypePrinter.print(V->getType(), Out); Out << ' '; } @@ -940,7 +939,7 @@ public: inline AssemblyWriter(raw_ostream &o, SlotTracker &Mac, const Module *M, AssemblyAnnotationWriter *AAW) - : Out(o), Machine(Mac), TheModule(M), TypePrinter(M, Out), + : Out(o), Machine(Mac), TheModule(M), TypePrinter(M), AnnotationWriter(AAW) { } @@ -959,7 +958,6 @@ void write(const BasicBlock *BB) { printBasicBlock(BB); } void write(const Instruction *I) { printInstruction(*I); } -// void write(const Type *Ty) { printType(Ty); } void writeOperand(const Value *Op, bool PrintType); void writeParamOperand(const Value *Operand, Attributes Attrs); @@ -976,13 +974,6 @@ void printBasicBlock(const BasicBlock *BB); void printInstruction(const Instruction &I); - // printType - Go to extreme measures to attempt to print out a short, - // symbolic version of a type name. - // - void printType(const Type *Ty) { - TypePrinter.print(Ty); - } - // printInfoComment - Print a little comment after the instruction indicating // which slot it occupies. void printInfoComment(const Value &V); @@ -995,7 +986,7 @@ Out << ""; } else { if (PrintType) { - printType(Operand->getType()); + TypePrinter.print(Operand->getType(), Out); Out << ' '; } WriteAsOperandInternal(Out, Operand, TypePrinter, &Machine); @@ -1008,7 +999,7 @@ Out << ""; } else { // Print the type - printType(Operand->getType()); + TypePrinter.print(Operand->getType(), Out); // Print parameter attributes list if (Attrs != Attribute::None) Out << ' ' << Attribute::getAsString(Attrs); @@ -1127,7 +1118,7 @@ if (unsigned AddressSpace = GV->getType()->getAddressSpace()) Out << "addrspace(" << AddressSpace << ") "; Out << (GV->isConstant() ? "constant " : "global "); - printType(GV->getType()->getElementType()); + TypePrinter.print(GV->getType()->getElementType(), Out); if (GV->hasInitializer()) { Out << ' '; @@ -1160,17 +1151,17 @@ const Constant *Aliasee = GA->getAliasee(); if (const GlobalVariable *GV = dyn_cast(Aliasee)) { - printType(GV->getType()); + TypePrinter.print(GV->getType(), Out); Out << ' '; PrintLLVMName(Out, GV); } else if (const Function *F = dyn_cast(Aliasee)) { - printType(F->getFunctionType()); + TypePrinter.print(F->getFunctionType(), Out); Out << "* "; WriteAsOperandInternal(Out, F, TypePrinter, &Machine); } else if (const GlobalAlias *GA = dyn_cast(Aliasee)) { - printType(GA->getType()); - Out << " "; + TypePrinter.print(GA->getType(), Out); + Out << ' '; PrintLLVMName(Out, GA); } else { const ConstantExpr *CE = 0; @@ -1195,7 +1186,7 @@ // Make sure we print out at least one level of the type structure, so // that we do not get %FILE = type %FILE - TypePrinter.printAtLeastOneLevel(TI->second); + TypePrinter.printAtLeastOneLevel(TI->second, Out); Out << '\n'; } } @@ -1231,7 +1222,7 @@ Attributes RetAttrs = Attrs.getRetAttributes(); if (RetAttrs != Attribute::None) Out << Attribute::getAsString(Attrs.getRetAttributes()) << ' '; - printType(F->getReturnType()); + TypePrinter.print(F->getReturnType(), Out); Out << ' '; WriteAsOperandInternal(Out, F, TypePrinter, &Machine); Out << '('; @@ -1256,7 +1247,7 @@ if (i) Out << ", "; // Output type... - printType(FT->getParamType(i)); + TypePrinter.print(FT->getParamType(i), Out); Attributes ArgAttrs = Attrs.getParamAttributes(i+1); if (ArgAttrs != Attribute::None) @@ -1300,7 +1291,7 @@ void AssemblyWriter::printArgument(const Argument *Arg, Attributes Attrs) { // Output type... - printType(Arg->getType()); + TypePrinter.print(Arg->getType(), Out); // Output parameter attributes list if (Attrs != Attribute::None) @@ -1366,7 +1357,7 @@ void AssemblyWriter::printInfoComment(const Value &V) { if (V.getType() != Type::VoidTy) { Out << "\t\t; <"; - printType(V.getType()); + TypePrinter.print(V.getType(), Out); Out << '>'; if (!V.hasName() && !isa(V)) { @@ -1449,7 +1440,7 @@ Out << "\n\t]"; } else if (isa(I)) { Out << ' '; - printType(I.getType()); + TypePrinter.print(I.getType(), Out); Out << ' '; for (unsigned op = 0, Eop = I.getNumOperands(); op < Eop; op += 2) { @@ -1498,7 +1489,7 @@ if (!FTy->isVarArg() && (!isa(RetTy) || !isa(cast(RetTy)->getElementType()))) { - printType(RetTy); + TypePrinter.print(RetTy, Out); Out << ' '; writeOperand(Operand, false); } else { @@ -1540,7 +1531,7 @@ if (!FTy->isVarArg() && (!isa(RetTy) || !isa(cast(RetTy)->getElementType()))) { - printType(RetTy); + TypePrinter.print(RetTy, Out); Out << ' '; writeOperand(Operand, false); } else { @@ -1564,7 +1555,7 @@ } else if (const AllocationInst *AI = dyn_cast(&I)) { Out << ' '; - printType(AI->getType()->getElementType()); + TypePrinter.print(AI->getType()->getElementType(), Out); if (AI->isArrayAllocation()) { Out << ", "; writeOperand(AI->getArraySize(), true); @@ -1578,15 +1569,15 @@ writeOperand(Operand, true); // Work with broken code } Out << " to "; - printType(I.getType()); + TypePrinter.print(I.getType(), Out); } else if (isa(I)) { if (Operand) { Out << ' '; writeOperand(Operand, true); // Work with broken code } Out << ", "; - printType(I.getType()); - } else if (Operand) { // Print the normal way... + TypePrinter.print(I.getType(), Out); + } else if (Operand) { // Print the normal way. // PrintAllTypes - Instructions who have operands of all the same type // omit the type from all but the first operand. If the instruction has @@ -1612,7 +1603,7 @@ if (!PrintAllTypes) { Out << ' '; - printType(TheType); + TypePrinter.print(TheType, Out); } Out << ' '; @@ -1658,7 +1649,7 @@ OS << ""; return; } - TypePrinting(0, OS).print(this); + TypePrinting(0).print(this, OS); } void Value::print(raw_ostream &OS, AssemblyAnnotationWriter *AAW) const { @@ -1682,8 +1673,8 @@ AssemblyWriter W(OS, SlotTable, GV->getParent(), 0); W.write(GV); } else if (const Constant *C = dyn_cast(this)) { - TypePrinting TypePrinter(0, OS); - TypePrinter.print(C->getType()); + TypePrinting TypePrinter(0); + TypePrinter.print(C->getType(), OS); OS << ' '; WriteConstantInt(OS, C, TypePrinter, 0); } else if (const Argument *A = dyn_cast(this)) { From sabre at nondot.org Sat Feb 28 15:27:31 2009 From: sabre at nondot.org (Chris Lattner) Date: Sat, 28 Feb 2009 21:27:31 -0000 Subject: [llvm-commits] [llvm] r65724 - /llvm/trunk/lib/VMCore/AsmWriter.cpp Message-ID: <200902282127.n1SLRWGO021516@zion.cs.uiuc.edu> Author: lattner Date: Sat Feb 28 15:27:31 2009 New Revision: 65724 URL: http://llvm.org/viewvc/llvm-project?rev=65724&view=rev Log: rename 'Result' to 'OS' in CalcTypeName for consistency Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=65724&r1=65723&r2=65724&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original) +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Sat Feb 28 15:27:31 2009 @@ -149,7 +149,7 @@ private: void CalcTypeName(const Type *Ty, SmallVectorImpl &TypeStack, - raw_ostream &Result); + raw_ostream &OS); }; } // end anonymous namespace. @@ -188,13 +188,13 @@ /// use of type names or up references to shorten the type name where possible. void TypePrinting::CalcTypeName(const Type *Ty, SmallVectorImpl &TypeStack, - raw_ostream &Result) { + raw_ostream &OS) { // Check to see if the type is named. std::map::iterator I = TypeNames.find(Ty); if (I != TypeNames.end() && // If the name wasn't temporarily removed use it. !I->second.empty()) { - Result << I->second; + OS << I->second; return; } @@ -206,85 +206,85 @@ // that we have looped back to a type that we have previously visited. // Generate the appropriate upreference to handle this. if (Slot < CurSize) { - Result << '\\' << unsigned(CurSize-Slot); // Here's the upreference + OS << '\\' << unsigned(CurSize-Slot); // Here's the upreference return; } TypeStack.push_back(Ty); // Recursive case: Add us to the stack.. switch (Ty->getTypeID()) { - case Type::VoidTyID: Result << "void"; break; - case Type::FloatTyID: Result << "float"; break; - case Type::DoubleTyID: Result << "double"; break; - case Type::X86_FP80TyID: Result << "x86_fp80"; break; - case Type::FP128TyID: Result << "fp128"; break; - case Type::PPC_FP128TyID: Result << "ppc_fp128"; break; - case Type::LabelTyID: Result << "label"; break; + case Type::VoidTyID: OS << "void"; break; + case Type::FloatTyID: OS << "float"; break; + case Type::DoubleTyID: OS << "double"; break; + case Type::X86_FP80TyID: OS << "x86_fp80"; break; + case Type::FP128TyID: OS << "fp128"; break; + case Type::PPC_FP128TyID: OS << "ppc_fp128"; break; + case Type::LabelTyID: OS << "label"; break; case Type::IntegerTyID: - Result << 'i' << cast(Ty)->getBitWidth(); + OS << 'i' << cast(Ty)->getBitWidth(); break; case Type::FunctionTyID: { const FunctionType *FTy = cast(Ty); - CalcTypeName(FTy->getReturnType(), TypeStack, Result); - Result << " ("; + CalcTypeName(FTy->getReturnType(), TypeStack, OS); + OS << " ("; for (FunctionType::param_iterator I = FTy->param_begin(), E = FTy->param_end(); I != E; ++I) { if (I != FTy->param_begin()) - Result << ", "; - CalcTypeName(*I, TypeStack, Result); + OS << ", "; + CalcTypeName(*I, TypeStack, OS); } if (FTy->isVarArg()) { - if (FTy->getNumParams()) Result << ", "; - Result << "..."; + if (FTy->getNumParams()) OS << ", "; + OS << "..."; } - Result << ')'; + OS << ')'; break; } case Type::StructTyID: { const StructType *STy = cast(Ty); if (STy->isPacked()) - Result << '<'; - Result << "{ "; + OS << '<'; + OS << "{ "; for (StructType::element_iterator I = STy->element_begin(), E = STy->element_end(); I != E; ++I) { - CalcTypeName(*I, TypeStack, Result); + CalcTypeName(*I, TypeStack, OS); if (next(I) != STy->element_end()) - Result << ','; - Result << ' '; + OS << ','; + OS << ' '; } - Result << '}'; + OS << '}'; if (STy->isPacked()) - Result << '>'; + OS << '>'; break; } case Type::PointerTyID: { const PointerType *PTy = cast(Ty); - CalcTypeName(PTy->getElementType(), TypeStack, Result); + CalcTypeName(PTy->getElementType(), TypeStack, OS); if (unsigned AddressSpace = PTy->getAddressSpace()) - Result << " addrspace(" << AddressSpace << ')'; - Result << '*'; + OS << " addrspace(" << AddressSpace << ')'; + OS << '*'; break; } case Type::ArrayTyID: { const ArrayType *ATy = cast(Ty); - Result << '[' << ATy->getNumElements() << " x "; - CalcTypeName(ATy->getElementType(), TypeStack, Result); - Result << ']'; + OS << '[' << ATy->getNumElements() << " x "; + CalcTypeName(ATy->getElementType(), TypeStack, OS); + OS << ']'; break; } case Type::VectorTyID: { const VectorType *PTy = cast(Ty); - Result << "<" << PTy->getNumElements() << " x "; - CalcTypeName(PTy->getElementType(), TypeStack, Result); - Result << '>'; + OS << "<" << PTy->getNumElements() << " x "; + CalcTypeName(PTy->getElementType(), TypeStack, OS); + OS << '>'; break; } case Type::OpaqueTyID: - Result << "opaque"; + OS << "opaque"; break; default: - Result << ""; + OS << ""; break; } From isanbard at gmail.com Sat Feb 28 16:08:19 2009 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 28 Feb 2009 22:08:19 -0000 Subject: [llvm-commits] [llvm] r65726 - /llvm/branches/Apple/Dib/include/llvm/Support/Allocator.h Message-ID: <200902282208.n1SM8J1k022892@zion.cs.uiuc.edu> Author: void Date: Sat Feb 28 16:08:19 2009 New Revision: 65726 URL: http://llvm.org/viewvc/llvm-project?rev=65726&view=rev Log: Merge r63629 into Dib: add a method to BumpPtrAllocator that allows allocating elements with a specified alignment. Modified: llvm/branches/Apple/Dib/include/llvm/Support/Allocator.h Modified: llvm/branches/Apple/Dib/include/llvm/Support/Allocator.h URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/include/llvm/Support/Allocator.h?rev=65726&r1=65725&r2=65726&view=diff ============================================================================== --- llvm/branches/Apple/Dib/include/llvm/Support/Allocator.h (original) +++ llvm/branches/Apple/Dib/include/llvm/Support/Allocator.h Sat Feb 28 16:08:19 2009 @@ -58,16 +58,30 @@ void *Allocate(size_t Size, size_t Alignment); + /// Allocate space, but do not construct, one object. + /// template T *Allocate() { return static_cast(Allocate(sizeof(T),AlignOf::Alignment)); } + /// Allocate space for an array of objects. This does not construct the + /// objects though. template T *Allocate(size_t Num) { return static_cast(Allocate(Num * sizeof(T), AlignOf::Alignment)); } + /// Allocate space for a specific count of elements and with a specified + /// alignment. + template + T *Allocate(size_t Num, unsigned Alignment) { + // Round EltSize up to the specified alignment. + unsigned EltSize = (sizeof(T)+Alignment-1)&~Alignment; + return static_cast(Allocate(Num * EltSize, Alignment)); + } + + void Deallocate(void * /*Ptr*/) {} void PrintStats() const; From isanbard at gmail.com Sat Feb 28 16:12:54 2009 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 28 Feb 2009 22:12:54 -0000 Subject: [llvm-commits] [llvm] r65727 - /llvm/trunk/docs/LangRef.html Message-ID: <200902282212.n1SMCsSU023027@zion.cs.uiuc.edu> Author: void Date: Sat Feb 28 16:12:54 2009 New Revision: 65727 URL: http://llvm.org/viewvc/llvm-project?rev=65727&view=rev Log: Fix grammaro. Modified: llvm/trunk/docs/LangRef.html Modified: llvm/trunk/docs/LangRef.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=65727&r1=65726&r2=65727&view=diff ============================================================================== --- llvm/trunk/docs/LangRef.html (original) +++ llvm/trunk/docs/LangRef.html Sat Feb 28 16:12:54 2009 @@ -2142,7 +2142,7 @@
       ret i32 5                       ; Return an integer value of 5
       ret void                        ; Return from a void function
    -  ret { i32, i8 } { i32 4, i8 2 } ; Return an struct of values 4 and 2
    +  ret { i32, i8 } { i32 4, i8 2 } ; Return a struct of values 4 and 2
     

    Note that the code generator does not yet fully support large From sabre at nondot.org Sat Feb 28 16:20:03 2009 From: sabre at nondot.org (Chris Lattner) Date: Sat, 28 Feb 2009 22:20:03 -0000 Subject: [llvm-commits] [llvm] r65728 - /llvm/trunk/test/FrontendC/2007-05-16-EmptyStruct.c Message-ID: <200902282220.n1SMK3bx023279@zion.cs.uiuc.edu> Author: lattner Date: Sat Feb 28 16:20:02 2009 New Revision: 65728 URL: http://llvm.org/viewvc/llvm-project?rev=65728&view=rev Log: one less space, fixes failure with rebuilt llvm-gcc. Modified: llvm/trunk/test/FrontendC/2007-05-16-EmptyStruct.c Modified: llvm/trunk/test/FrontendC/2007-05-16-EmptyStruct.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC/2007-05-16-EmptyStruct.c?rev=65728&r1=65727&r2=65728&view=diff ============================================================================== --- llvm/trunk/test/FrontendC/2007-05-16-EmptyStruct.c (original) +++ llvm/trunk/test/FrontendC/2007-05-16-EmptyStruct.c Sat Feb 28 16:20:02 2009 @@ -1,5 +1,5 @@ // PR 1417 -// RUN: %llvmgcc -xc %s -c -o - | llvm-dis | grep "struct.anon = type \{ \}" +// RUN: %llvmgcc -xc %s -c -o - | llvm-dis | grep "struct.anon = type \{ \}" struct { } *X; From sabre at nondot.org Sat Feb 28 16:34:46 2009 From: sabre at nondot.org (Chris Lattner) Date: Sat, 28 Feb 2009 22:34:46 -0000 Subject: [llvm-commits] [llvm] r65729 - in /llvm/trunk: include/llvm/Assembly/Writer.h lib/VMCore/AsmWriter.cpp Message-ID: <200902282234.n1SMYk1w023755@zion.cs.uiuc.edu> Author: lattner Date: Sat Feb 28 16:34:45 2009 New Revision: 65729 URL: http://llvm.org/viewvc/llvm-project?rev=65729&view=rev Log: expose TypePrinting as a public API. Modified: llvm/trunk/include/llvm/Assembly/Writer.h llvm/trunk/lib/VMCore/AsmWriter.cpp Modified: llvm/trunk/include/llvm/Assembly/Writer.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Assembly/Writer.h?rev=65729&r1=65728&r2=65729&view=diff ============================================================================== --- llvm/trunk/include/llvm/Assembly/Writer.h (original) +++ llvm/trunk/include/llvm/Assembly/Writer.h Sat Feb 28 16:34:45 2009 @@ -25,6 +25,24 @@ class Module; class Value; class raw_ostream; +template class SmallVectorImpl; + +/// TypePrinting - Type printing machinery. +class TypePrinting { + void *TypeNames; +public: + TypePrinting(const Module *M); + ~TypePrinting(); + + void clear(); + + void print(const Type *Ty, raw_ostream &OS); + void printAtLeastOneLevel(const Type *Ty, raw_ostream &OS); + +private: + void CalcTypeName(const Type *Ty, SmallVectorImpl &TypeStack, + raw_ostream &OS); +}; // WriteTypeSymbolic - This attempts to write the specified type as a symbolic // type, if there is an entry in the Module's symbol table for the specified Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=65729&r1=65728&r2=65729&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original) +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Sat Feb 28 16:34:45 2009 @@ -137,25 +137,19 @@ // TypePrinting Class: Type printing machinery //===----------------------------------------------------------------------===// -namespace { - /// TypePrinting - Type printing machinery. - class TypePrinting { - std::map TypeNames; - public: - TypePrinting(const Module *M); - - void print(const Type *Ty, raw_ostream &OS); - void printAtLeastOneLevel(const Type *Ty, raw_ostream &OS); - - private: - void CalcTypeName(const Type *Ty, SmallVectorImpl &TypeStack, - raw_ostream &OS); - }; -} // end anonymous namespace. +static std::map &getTypeNamesMap(void *M) { + return *static_cast*>(M); +} + +void TypePrinting::clear() { + getTypeNamesMap(TypeNames).clear(); +} TypePrinting::TypePrinting(const Module *M) { if (M == 0) return; + TypeNames = new std::map(); + // If the module has a symbol table, take all global types and stuff their // names into the TypeNames map. const TypeSymbolTable &ST = M->getTypeSymbolTable(); @@ -180,18 +174,23 @@ std::string NameStr; raw_string_ostream NameOS(NameStr); PrintLLVMName(NameOS, TI->first.c_str(), TI->first.length(), LocalPrefix); - TypeNames.insert(std::make_pair(Ty, NameOS.str())); + getTypeNamesMap(TypeNames).insert(std::make_pair(Ty, NameOS.str())); } } +TypePrinting::~TypePrinting() { + delete &getTypeNamesMap(TypeNames); +} + /// CalcTypeName - Write the specified type to the specified raw_ostream, making /// use of type names or up references to shorten the type name where possible. void TypePrinting::CalcTypeName(const Type *Ty, SmallVectorImpl &TypeStack, raw_ostream &OS) { // Check to see if the type is named. - std::map::iterator I = TypeNames.find(Ty); - if (I != TypeNames.end() && + std::map &TM = getTypeNamesMap(TypeNames); + std::map::iterator I = TM.find(Ty); + if (I != TM.end() && // If the name wasn't temporarily removed use it. !I->second.empty()) { OS << I->second; @@ -296,8 +295,9 @@ /// void TypePrinting::print(const Type *Ty, raw_ostream &OS) { // Check to see if the type is named. - std::map::iterator I = TypeNames.find(Ty); - if (I != TypeNames.end()) { + std::map &TM = getTypeNamesMap(TypeNames); + std::map::iterator I = TM.find(Ty); + if (I != TM.end()) { OS << I->second; return; } @@ -313,7 +313,7 @@ OS << TypeOS.str(); // Cache type name for later use. - TypeNames.insert(std::make_pair(Ty, TypeOS.str())); + TM.insert(std::make_pair(Ty, TypeOS.str())); } /// printAtLeastOneLevel - Print out one level of the possibly complex type @@ -321,8 +321,9 @@ void TypePrinting::printAtLeastOneLevel(const Type *Ty, raw_ostream &OS) { // If the type does not have a name, then it is already guaranteed to print at // least one level. - std::map::iterator I = TypeNames.find(Ty); - if (I == TypeNames.end()) + std::map &TM = getTypeNamesMap(TypeNames); + std::map::iterator I = TM.find(Ty); + if (I == TM.end()) return print(Ty, OS); // Otherwise, temporarily remove the name and print it. From sabre at nondot.org Sat Feb 28 16:35:24 2009 From: sabre at nondot.org (Chris Lattner) Date: Sat, 28 Feb 2009 22:35:24 -0000 Subject: [llvm-commits] [llvm] r65730 - /llvm/trunk/include/llvm/Assembly/Writer.h Message-ID: <200902282235.n1SMZOde023778@zion.cs.uiuc.edu> Author: lattner Date: Sat Feb 28 16:35:24 2009 New Revision: 65730 URL: http://llvm.org/viewvc/llvm-project?rev=65730&view=rev Log: disable copying and assignment. Modified: llvm/trunk/include/llvm/Assembly/Writer.h Modified: llvm/trunk/include/llvm/Assembly/Writer.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Assembly/Writer.h?rev=65730&r1=65729&r2=65730&view=diff ============================================================================== --- llvm/trunk/include/llvm/Assembly/Writer.h (original) +++ llvm/trunk/include/llvm/Assembly/Writer.h Sat Feb 28 16:35:24 2009 @@ -30,6 +30,8 @@ /// TypePrinting - Type printing machinery. class TypePrinting { void *TypeNames; + TypePrinting(const TypePrinting &); // DO NOT IMPLEMENT + void operator=(const TypePrinting&); // DO NOT IMPLEMENT public: TypePrinting(const Module *M); ~TypePrinting(); From sabre at nondot.org Sat Feb 28 16:41:33 2009 From: sabre at nondot.org (Chris Lattner) Date: Sat, 28 Feb 2009 22:41:33 -0000 Subject: [llvm-commits] [llvm] r65731 - /llvm/trunk/include/llvm/Assembly/Writer.h Message-ID: <200902282241.n1SMfXbO023977@zion.cs.uiuc.edu> Author: lattner Date: Sat Feb 28 16:41:33 2009 New Revision: 65731 URL: http://llvm.org/viewvc/llvm-project?rev=65731&view=rev Log: the module is not required to exist, allow it to default, giving this class a nice default ctor. Modified: llvm/trunk/include/llvm/Assembly/Writer.h Modified: llvm/trunk/include/llvm/Assembly/Writer.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Assembly/Writer.h?rev=65731&r1=65730&r2=65731&view=diff ============================================================================== --- llvm/trunk/include/llvm/Assembly/Writer.h (original) +++ llvm/trunk/include/llvm/Assembly/Writer.h Sat Feb 28 16:41:33 2009 @@ -33,7 +33,7 @@ TypePrinting(const TypePrinting &); // DO NOT IMPLEMENT void operator=(const TypePrinting&); // DO NOT IMPLEMENT public: - TypePrinting(const Module *M); + TypePrinting(const Module *M = 0); ~TypePrinting(); void clear(); From ggreif at gmail.com Sat Feb 28 16:46:37 2009 From: ggreif at gmail.com (Gabor Greif) Date: Sat, 28 Feb 2009 22:46:37 -0000 Subject: [llvm-commits] [llvm] r65732 - /llvm/trunk/include/llvm/BasicBlock.h Message-ID: <200902282246.n1SMkbtM024209@zion.cs.uiuc.edu> Author: ggreif Date: Sat Feb 28 16:46:37 2009 New Revision: 65732 URL: http://llvm.org/viewvc/llvm-project?rev=65732&view=rev Log: add description how the ilist_traits works Modified: llvm/trunk/include/llvm/BasicBlock.h Modified: llvm/trunk/include/llvm/BasicBlock.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BasicBlock.h?rev=65732&r1=65731&r2=65732&view=diff ============================================================================== --- llvm/trunk/include/llvm/BasicBlock.h (original) +++ llvm/trunk/include/llvm/BasicBlock.h Sat Feb 28 16:46:37 2009 @@ -25,11 +25,22 @@ template<> struct ilist_traits : public SymbolTableListTraits { - // createSentinel is used to create a node that marks the end of the list... + // createSentinel is used to get hold of a node that marks the end of + // the list... + // The sentinel is relative to this instance, so we use a non-static + // method. Instruction *createSentinel() const { + // since i(p)lists always publicly derive from the corresponding + // traits, placing a data member in this class will augment i(p)list. + // But since the NodeTy is expected to publicly derive from + // ilist_node, there is a legal viable downcast from it + // to NodeTy. We use this trick to superpose i(p)list with a "ghostly" + // NodeTy, which becomes the sentinel. Dereferencing the sentinel is + // forbidden (save the ilist_node) so noone will ever notice + // the superposition. return const_cast(static_cast(&Sentinel)); } - static void destroySentinel(Instruction *I) { I = I; } + static void destroySentinel(Instruction*) {} static iplist &getList(BasicBlock *BB); static ValueSymbolTable *getSymTab(BasicBlock *ItemParent); static int getListOffset(); From sabre at nondot.org Sat Feb 28 17:01:31 2009 From: sabre at nondot.org (Chris Lattner) Date: Sat, 28 Feb 2009 23:01:31 -0000 Subject: [llvm-commits] [llvm] r65733 - /llvm/trunk/lib/VMCore/AsmWriter.cpp Message-ID: <200902282301.n1SN1Vj1024604@zion.cs.uiuc.edu> Author: lattner Date: Sat Feb 28 17:01:30 2009 New Revision: 65733 URL: http://llvm.org/viewvc/llvm-project?rev=65733&view=rev Log: make this work when constructed with a null module* Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=65733&r1=65732&r2=65733&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original) +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Sat Feb 28 17:01:30 2009 @@ -146,9 +146,8 @@ } TypePrinting::TypePrinting(const Module *M) { - if (M == 0) return; - TypeNames = new std::map(); + if (M == 0) return; // If the module has a symbol table, take all global types and stuff their // names into the TypeNames map. From sabre at nondot.org Sat Feb 28 17:01:57 2009 From: sabre at nondot.org (Chris Lattner) Date: Sat, 28 Feb 2009 23:01:57 -0000 Subject: [llvm-commits] [llvm] r65734 - in /llvm/trunk: include/llvm/Type.h lib/VMCore/Type.cpp Message-ID: <200902282301.n1SN1wQT024627@zion.cs.uiuc.edu> Author: lattner Date: Sat Feb 28 17:01:57 2009 New Revision: 65734 URL: http://llvm.org/viewvc/llvm-project?rev=65734&view=rev Log: delete a bunch of duplicated type printing logic, using the type printing stuff in AsmWriter.cpp for Type::getDescription(). Modified: llvm/trunk/include/llvm/Type.h llvm/trunk/lib/VMCore/Type.cpp Modified: llvm/trunk/include/llvm/Type.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Type.h?rev=65734&r1=65733&r2=65734&view=diff ============================================================================== --- llvm/trunk/include/llvm/Type.h (original) +++ llvm/trunk/include/llvm/Type.h Sat Feb 28 17:01:57 2009 @@ -177,8 +177,8 @@ /// inline TypeID getTypeID() const { return ID; } - /// getDescription - Return the string representation of the type... - const std::string &getDescription() const; + /// getDescription - Return the string representation of the type. + std::string getDescription() const; /// isInteger - True if this is an instance of IntegerType. /// Modified: llvm/trunk/lib/VMCore/Type.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Type.cpp?rev=65734&r1=65733&r2=65734&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Type.cpp (original) +++ llvm/trunk/lib/VMCore/Type.cpp Sat Feb 28 17:01:57 2009 @@ -13,14 +13,16 @@ #include "llvm/DerivedTypes.h" #include "llvm/Constants.h" +#include "llvm/Assembly/Writer.h" #include "llvm/ADT/DepthFirstIterator.h" #include "llvm/ADT/StringExtras.h" #include "llvm/ADT/SCCIterator.h" #include "llvm/ADT/STLExtras.h" -#include "llvm/Support/MathExtras.h" #include "llvm/Support/Compiler.h" -#include "llvm/Support/ManagedStatic.h" #include "llvm/Support/Debug.h" +#include "llvm/Support/ManagedStatic.h" +#include "llvm/Support/MathExtras.h" +#include "llvm/Support/raw_ostream.h" #include #include using namespace llvm; @@ -42,10 +44,8 @@ // for types as they are needed. Because resolution of types must invalidate // all of the abstract type descriptions, we keep them in a seperate map to make // this easy. -static ManagedStatic > ConcreteTypeDescriptions; -static ManagedStatic > AbstractTypeDescriptions; +static ManagedStatic ConcreteTypeDescriptions; +static ManagedStatic AbstractTypeDescriptions; /// Because of the way Type subclasses are allocated, this function is necessary /// to use the correct kind of "delete" operator to deallocate the Type object. @@ -229,151 +229,14 @@ } -// getTypeDescription - This is a recursive function that walks a type hierarchy -// calculating the description for a type. -// -static std::string getTypeDescription(const Type *Ty, - std::vector &TypeStack) { - if (isa(Ty)) { // Base case for the recursion - std::map::iterator I = - AbstractTypeDescriptions->find(Ty); - if (I != AbstractTypeDescriptions->end()) - return I->second; - std::string Desc = "opaque"; - AbstractTypeDescriptions->insert(std::make_pair(Ty, Desc)); - return Desc; - } - - if (!Ty->isAbstract()) { // Base case for the recursion - std::map::iterator I = - ConcreteTypeDescriptions->find(Ty); - if (I != ConcreteTypeDescriptions->end()) - return I->second; - - if (Ty->isPrimitiveType()) { - switch (Ty->getTypeID()) { - default: assert(0 && "Unknown prim type!"); - case Type::VoidTyID: return (*ConcreteTypeDescriptions)[Ty] = "void"; - case Type::FloatTyID: return (*ConcreteTypeDescriptions)[Ty] = "float"; - case Type::DoubleTyID: return (*ConcreteTypeDescriptions)[Ty] = "double"; - case Type::X86_FP80TyID: - return (*ConcreteTypeDescriptions)[Ty] = "x86_fp80"; - case Type::FP128TyID: return (*ConcreteTypeDescriptions)[Ty] = "fp128"; - case Type::PPC_FP128TyID: - return (*ConcreteTypeDescriptions)[Ty] = "ppc_fp128"; - case Type::LabelTyID: return (*ConcreteTypeDescriptions)[Ty] = "label"; - } - } - } - - // Check to see if the Type is already on the stack... - unsigned Slot = 0, CurSize = TypeStack.size(); - while (Slot < CurSize && TypeStack[Slot] != Ty) ++Slot; // Scan for type - - // This is another base case for the recursion. In this case, we know - // that we have looped back to a type that we have previously visited. - // Generate the appropriate upreference to handle this. - // - if (Slot < CurSize) - return "\\" + utostr(CurSize-Slot); // Here's the upreference - - // Recursive case: derived types... - std::string Result; - TypeStack.push_back(Ty); // Add us to the stack.. - - switch (Ty->getTypeID()) { - case Type::IntegerTyID: { - const IntegerType *ITy = cast(Ty); - Result = "i" + utostr(ITy->getBitWidth()); - break; - } - case Type::FunctionTyID: { - const FunctionType *FTy = cast(Ty); - if (!Result.empty()) - Result += " "; - Result += getTypeDescription(FTy->getReturnType(), TypeStack) + " ("; - for (FunctionType::param_iterator I = FTy->param_begin(), - E = FTy->param_end(); I != E; ++I) { - if (I != FTy->param_begin()) - Result += ", "; - Result += getTypeDescription(*I, TypeStack); - } - if (FTy->isVarArg()) { - if (FTy->getNumParams()) Result += ", "; - Result += "..."; - } - Result += ")"; - break; - } - case Type::StructTyID: { - const StructType *STy = cast(Ty); - if (STy->isPacked()) - Result = "<{ "; - else - Result = "{ "; - for (StructType::element_iterator I = STy->element_begin(), - E = STy->element_end(); I != E; ++I) { - if (I != STy->element_begin()) - Result += ", "; - Result += getTypeDescription(*I, TypeStack); - } - Result += " }"; - if (STy->isPacked()) - Result += ">"; - break; - } - case Type::PointerTyID: { - const PointerType *PTy = cast(Ty); - Result = getTypeDescription(PTy->getElementType(), TypeStack); - if (unsigned AddressSpace = PTy->getAddressSpace()) - Result += " addrspace(" + utostr(AddressSpace) + ")"; - Result += " *"; - break; - } - case Type::ArrayTyID: { - const ArrayType *ATy = cast(Ty); - unsigned NumElements = ATy->getNumElements(); - Result = "["; - Result += utostr(NumElements) + " x "; - Result += getTypeDescription(ATy->getElementType(), TypeStack) + "]"; - break; - } - case Type::VectorTyID: { - const VectorType *PTy = cast(Ty); - unsigned NumElements = PTy->getNumElements(); - Result = "<"; - Result += utostr(NumElements) + " x "; - Result += getTypeDescription(PTy->getElementType(), TypeStack) + ">"; - break; - } - default: - Result = ""; - assert(0 && "Unhandled type in getTypeDescription!"); - } - - TypeStack.pop_back(); // Remove self from stack... - - return Result; -} - - - -static const std::string &getOrCreateDesc(std::map&Map, - const Type *Ty) { - std::map::iterator I = Map.find(Ty); - if (I != Map.end()) return I->second; - - std::vector TypeStack; - std::string Result = getTypeDescription(Ty, TypeStack); - return Map[Ty] = Result; -} - - -const std::string &Type::getDescription() const { - if (isAbstract()) - return getOrCreateDesc(*AbstractTypeDescriptions, this); - else - return getOrCreateDesc(*ConcreteTypeDescriptions, this); +std::string Type::getDescription() const { + TypePrinting &Map = + isAbstract() ? *AbstractTypeDescriptions : *ConcreteTypeDescriptions; + + std::string DescStr; + raw_string_ostream DescOS(DescStr); + Map.print(this, DescOS); + return DescOS.str(); } @@ -1372,7 +1235,8 @@ assert(ForwardType == 0 && "This type has already been refined!"); // The descriptions may be out of date. Conservatively clear them all! - AbstractTypeDescriptions->clear(); + if (AbstractTypeDescriptions.isConstructed()) + AbstractTypeDescriptions->clear(); #ifdef DEBUG_MERGE_TYPES DOUT << "REFINING abstract type [" << (void*)this << " " From sabre at nondot.org Sat Feb 28 17:03:56 2009 From: sabre at nondot.org (Chris Lattner) Date: Sat, 28 Feb 2009 23:03:56 -0000 Subject: [llvm-commits] [llvm] r65735 - /llvm/trunk/lib/VMCore/AsmWriter.cpp Message-ID: <200902282303.n1SN3utJ024688@zion.cs.uiuc.edu> Author: lattner Date: Sat Feb 28 17:03:55 2009 New Revision: 65735 URL: http://llvm.org/viewvc/llvm-project?rev=65735&view=rev Log: switch to densemap for pointer->word map. Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=65735&r1=65734&r2=65735&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original) +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Sat Feb 28 17:03:55 2009 @@ -137,8 +137,8 @@ // TypePrinting Class: Type printing machinery //===----------------------------------------------------------------------===// -static std::map &getTypeNamesMap(void *M) { - return *static_cast*>(M); +static DenseMap &getTypeNamesMap(void *M) { + return *static_cast*>(M); } void TypePrinting::clear() { @@ -146,7 +146,7 @@ } TypePrinting::TypePrinting(const Module *M) { - TypeNames = new std::map(); + TypeNames = new DenseMap(); if (M == 0) return; // If the module has a symbol table, take all global types and stuff their @@ -187,8 +187,8 @@ SmallVectorImpl &TypeStack, raw_ostream &OS) { // Check to see if the type is named. - std::map &TM = getTypeNamesMap(TypeNames); - std::map::iterator I = TM.find(Ty); + DenseMap &TM = getTypeNamesMap(TypeNames); + DenseMap::iterator I = TM.find(Ty); if (I != TM.end() && // If the name wasn't temporarily removed use it. !I->second.empty()) { @@ -294,8 +294,8 @@ /// void TypePrinting::print(const Type *Ty, raw_ostream &OS) { // Check to see if the type is named. - std::map &TM = getTypeNamesMap(TypeNames); - std::map::iterator I = TM.find(Ty); + DenseMap &TM = getTypeNamesMap(TypeNames); + DenseMap::iterator I = TM.find(Ty); if (I != TM.end()) { OS << I->second; return; @@ -320,8 +320,8 @@ void TypePrinting::printAtLeastOneLevel(const Type *Ty, raw_ostream &OS) { // If the type does not have a name, then it is already guaranteed to print at // least one level. - std::map &TM = getTypeNamesMap(TypeNames); - std::map::iterator I = TM.find(Ty); + DenseMap &TM = getTypeNamesMap(TypeNames); + DenseMap::iterator I = TM.find(Ty); if (I == TM.end()) return print(Ty, OS); From sabre at nondot.org Sat Feb 28 17:20:19 2009 From: sabre at nondot.org (Chris Lattner) Date: Sat, 28 Feb 2009 23:20:19 -0000 Subject: [llvm-commits] [llvm] r65736 - in /llvm/trunk: include/llvm/Assembly/Writer.h lib/VMCore/AsmWriter.cpp Message-ID: <200902282320.n1SNKJuF025271@zion.cs.uiuc.edu> Author: lattner Date: Sat Feb 28 17:20:19 2009 New Revision: 65736 URL: http://llvm.org/viewvc/llvm-project?rev=65736&view=rev Log: move type name population out of TypePrinting class into a static AsmWriter.cpp method. Modified: llvm/trunk/include/llvm/Assembly/Writer.h llvm/trunk/lib/VMCore/AsmWriter.cpp Modified: llvm/trunk/include/llvm/Assembly/Writer.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Assembly/Writer.h?rev=65736&r1=65735&r2=65736&view=diff ============================================================================== --- llvm/trunk/include/llvm/Assembly/Writer.h (original) +++ llvm/trunk/include/llvm/Assembly/Writer.h Sat Feb 28 17:20:19 2009 @@ -29,11 +29,11 @@ /// TypePrinting - Type printing machinery. class TypePrinting { - void *TypeNames; + void *TypeNames; // A map to remember type names. TypePrinting(const TypePrinting &); // DO NOT IMPLEMENT void operator=(const TypePrinting&); // DO NOT IMPLEMENT public: - TypePrinting(const Module *M = 0); + TypePrinting(); ~TypePrinting(); void clear(); @@ -41,6 +41,15 @@ void print(const Type *Ty, raw_ostream &OS); void printAtLeastOneLevel(const Type *Ty, raw_ostream &OS); + /// hasTypeName - Return true if the type has a name in TypeNames, false + /// otherwise. + bool hasTypeName(const Type *Ty) const; + + /// addTypeName - Add a name for the specified type if it doesn't already have + /// one. This name will be printed instead of the structural version of the + /// type in order to make the output more concise. + void addTypeName(const Type *Ty, const std::string &N); + private: void CalcTypeName(const Type *Ty, SmallVectorImpl &TypeStack, raw_ostream &OS); Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=65736&r1=65735&r2=65736&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original) +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Sat Feb 28 17:20:19 2009 @@ -145,36 +145,17 @@ getTypeNamesMap(TypeNames).clear(); } -TypePrinting::TypePrinting(const Module *M) { +bool TypePrinting::hasTypeName(const Type *Ty) const { + return getTypeNamesMap(TypeNames).count(Ty); +} + +void TypePrinting::addTypeName(const Type *Ty, const std::string &N) { + getTypeNamesMap(TypeNames).insert(std::make_pair(Ty, N)); +} + + +TypePrinting::TypePrinting() { TypeNames = new DenseMap(); - if (M == 0) return; - - // If the module has a symbol table, take all global types and stuff their - // names into the TypeNames map. - const TypeSymbolTable &ST = M->getTypeSymbolTable(); - for (TypeSymbolTable::const_iterator TI = ST.begin(), E = ST.end(); - TI != E; ++TI) { - const Type *Ty = cast(TI->second); - - // As a heuristic, don't insert pointer to primitive types, because - // they are used too often to have a single useful name. - if (const PointerType *PTy = dyn_cast(Ty)) { - const Type *PETy = PTy->getElementType(); - if ((PETy->isPrimitiveType() || PETy->isInteger()) && - !isa(PETy)) - continue; - } - - // Likewise don't insert primitives either. - if (Ty->isInteger() || Ty->isPrimitiveType()) - continue; - - // Get the name as a string and insert it into TypeNames. - std::string NameStr; - raw_string_ostream NameOS(NameStr); - PrintLLVMName(NameOS, TI->first.c_str(), TI->first.length(), LocalPrefix); - getTypeNamesMap(TypeNames).insert(std::make_pair(Ty, NameOS.str())); - } } TypePrinting::~TypePrinting() { @@ -337,13 +318,46 @@ std::swap(OldName, I->second); } +static void AddModuleTypesToPrinter(TypePrinting &TP, const Module *M) { + if (M == 0) return; + + // If the module has a symbol table, take all global types and stuff their + // names into the TypeNames map. + const TypeSymbolTable &ST = M->getTypeSymbolTable(); + for (TypeSymbolTable::const_iterator TI = ST.begin(), E = ST.end(); + TI != E; ++TI) { + const Type *Ty = cast(TI->second); + + // As a heuristic, don't insert pointer to primitive types, because + // they are used too often to have a single useful name. + if (const PointerType *PTy = dyn_cast(Ty)) { + const Type *PETy = PTy->getElementType(); + if ((PETy->isPrimitiveType() || PETy->isInteger()) && + !isa(PETy)) + continue; + } + + // Likewise don't insert primitives either. + if (Ty->isInteger() || Ty->isPrimitiveType()) + continue; + + // Get the name as a string and insert it into TypeNames. + std::string NameStr; + raw_string_ostream NameOS(NameStr); + PrintLLVMName(NameOS, TI->first.c_str(), TI->first.length(), LocalPrefix); + TP.addTypeName(Ty, NameOS.str()); + } +} + /// WriteTypeSymbolic - This attempts to write the specified type as a symbolic /// type, iff there is an entry in the modules symbol table for the specified /// type or one of it's component types. /// -void llvm::WriteTypeSymbolic(raw_ostream &OS, const Type *Ty, const Module *M){ - TypePrinting(M).print(Ty, OS); +void llvm::WriteTypeSymbolic(raw_ostream &OS, const Type *Ty, const Module *M) { + TypePrinting Printer; + AddModuleTypesToPrinter(Printer, M); + Printer.print(Ty, OS); } //===----------------------------------------------------------------------===// @@ -918,7 +932,8 @@ const Module *Context) { if (Context == 0) Context = getModuleFromVal(V); - TypePrinting TypePrinter(Context); + TypePrinting TypePrinter; + AddModuleTypesToPrinter(TypePrinter, Context); if (PrintType) { TypePrinter.print(V->getType(), Out); Out << ' '; @@ -939,8 +954,8 @@ public: inline AssemblyWriter(raw_ostream &o, SlotTracker &Mac, const Module *M, AssemblyAnnotationWriter *AAW) - : Out(o), Machine(Mac), TheModule(M), TypePrinter(M), - AnnotationWriter(AAW) { + : Out(o), Machine(Mac), TheModule(M), AnnotationWriter(AAW) { + AddModuleTypesToPrinter(TypePrinter, M); } void write(const Module *M) { printModule(M); } @@ -1649,7 +1664,7 @@ OS << ""; return; } - TypePrinting(0).print(this, OS); + TypePrinting().print(this, OS); } void Value::print(raw_ostream &OS, AssemblyAnnotationWriter *AAW) const { @@ -1673,7 +1688,7 @@ AssemblyWriter W(OS, SlotTable, GV->getParent(), 0); W.write(GV); } else if (const Constant *C = dyn_cast(this)) { - TypePrinting TypePrinter(0); + TypePrinting TypePrinter; TypePrinter.print(C->getType(), OS); OS << ' '; WriteConstantInt(OS, C, TypePrinter, 0); From sabre at nondot.org Sat Feb 28 18:03:38 2009 From: sabre at nondot.org (Chris Lattner) Date: Sun, 01 Mar 2009 00:03:38 -0000 Subject: [llvm-commits] [llvm] r65738 - in /llvm/trunk: lib/VMCore/AsmWriter.cpp test/Assembler/2009-02-28-StripOpaqueName.ll Message-ID: <200903010003.n2103cS4026516@zion.cs.uiuc.edu> Author: lattner Date: Sat Feb 28 18:03:38 2009 New Revision: 65738 URL: http://llvm.org/viewvc/llvm-project?rev=65738&view=rev Log: Fix a long-standing bug and misfeature of the disassembler: when dealing with a stripped .bc file, it didn't make any attempt to try to reuse anonymous types. This causes an amazing type explosion due to types getting duplicated everywhere they are referenced and other problems. This also caused correctness issues, because opaque types are unique for each time they are uttered in the file. This means that stripping a .bc file could produce a .ll file that could not be assembled (e.g. 2009-02-28-StripOpaqueName.ll). This patch fixes both of these issues. Added: llvm/trunk/test/Assembler/2009-02-28-StripOpaqueName.ll Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=65738&r1=65737&r2=65738&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original) +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Sat Feb 28 18:03:38 2009 @@ -26,7 +26,7 @@ #include "llvm/Module.h" #include "llvm/ValueSymbolTable.h" #include "llvm/TypeSymbolTable.h" -#include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/DenseSet.h" #include "llvm/ADT/StringExtras.h" #include "llvm/ADT/STLExtras.h" #include "llvm/Support/CFG.h" @@ -318,7 +318,101 @@ std::swap(OldName, I->second); } -static void AddModuleTypesToPrinter(TypePrinting &TP, const Module *M) { +namespace { + class TypeFinder { + // To avoid walking constant expressions multiple times and other IR + // objects, we keep several helper maps. + DenseSet VisitedConstants; + DenseSet VisitedTypes; + + TypePrinting &TP; + std::vector &NumberedTypes; + public: + TypeFinder(TypePrinting &tp, std::vector &numberedTypes) + : TP(tp), NumberedTypes(numberedTypes) {} + + void Run(const Module &M) { + // Get types from global variables. + for (Module::const_global_iterator I = M.global_begin(), + E = M.global_end(); I != E; ++I) { + IncorporateType(I->getType()); + if (I->hasInitializer()) + IncorporateValue(I->getInitializer()); + } + + // Get types from aliases. + for (Module::const_alias_iterator I = M.alias_begin(), + E = M.alias_end(); I != E; ++I) { + IncorporateType(I->getType()); + IncorporateValue(I->getAliasee()); + } + + // Get types from functions. + for (Module::const_iterator FI = M.begin(), E = M.end(); FI != E; ++FI) { + IncorporateType(FI->getType()); + + for (Function::const_iterator BB = FI->begin(), E = FI->end(); + BB != E;++BB) + for (BasicBlock::const_iterator II = BB->begin(), + E = BB->end(); II != E; ++II) { + const Instruction &I = *II; + // Incorporate the type of the instruction and all its operands. + IncorporateType(I.getType()); + for (User::const_op_iterator OI = I.op_begin(), OE = I.op_end(); + OI != OE; ++OI) + IncorporateValue(*OI); + } + } + } + + private: + void IncorporateType(const Type *Ty) { + // Check to see if we're already visited this type. + if (!VisitedTypes.insert(Ty).second || TP.hasTypeName(Ty)) + return; + + // If this is a structure or opaque type, add a name for the type. + if (isa(Ty) || isa(Ty)) { + TP.addTypeName(Ty, "%"+utostr(unsigned(NumberedTypes.size()))); + NumberedTypes.push_back(Ty); + } + + // Recursively walk all contained types. + for (Type::subtype_iterator I = Ty->subtype_begin(), + E = Ty->subtype_end(); I != E; ++I) + IncorporateType(*I); + } + + /// IncorporateValue - This method is used to walk operand lists finding + /// types hiding in constant expressions and other operands that won't be + /// walked in other ways. GlobalValues, basic blocks, instructions, and + /// inst operands are all explicitly enumerated. + void IncorporateValue(const Value *V) { + if (V == 0 || !isa(V) || isa(V)) return; + + // Already visited? + if (!VisitedConstants.insert(V).second) + return; + + // Check this type. + IncorporateType(V->getType()); + + // Look in operands for types. + const Constant *C = cast(V); + for (Constant::const_op_iterator I = C->op_begin(), + E = C->op_end(); I != E;++I) + IncorporateValue(*I); + } + }; +} // end anonymous namespace + + +/// AddModuleTypesToPrinter - Add all of the symbolic type names for types in +/// the specified module to the TypePrinter and all numbered types to it and the +/// NumberedTypes table. +static void AddModuleTypesToPrinter(TypePrinting &TP, + std::vector &NumberedTypes, + const Module *M) { if (M == 0) return; // If the module has a symbol table, take all global types and stuff their @@ -347,6 +441,12 @@ PrintLLVMName(NameOS, TI->first.c_str(), TI->first.length(), LocalPrefix); TP.addTypeName(Ty, NameOS.str()); } + + // Walk the entire module to find references to unnamed structure and opaque + // types. This is required for correctness by opaque types (because multiple + // uses of an unnamed opaque type needs to be referred to by the same ID) and + // it shrinks complex recursive structure types substantially in some cases. + TypeFinder(TP, NumberedTypes).Run(*M); } @@ -356,7 +456,8 @@ /// void llvm::WriteTypeSymbolic(raw_ostream &OS, const Type *Ty, const Module *M) { TypePrinting Printer; - AddModuleTypesToPrinter(Printer, M); + std::vector NumberedTypes; + AddModuleTypesToPrinter(Printer, NumberedTypes, M); Printer.print(Ty, OS); } @@ -933,7 +1034,8 @@ if (Context == 0) Context = getModuleFromVal(V); TypePrinting TypePrinter; - AddModuleTypesToPrinter(TypePrinter, Context); + std::vector NumberedTypes; + AddModuleTypesToPrinter(TypePrinter, NumberedTypes, Context); if (PrintType) { TypePrinter.print(V->getType(), Out); Out << ' '; @@ -951,14 +1053,15 @@ const Module *TheModule; TypePrinting TypePrinter; AssemblyAnnotationWriter *AnnotationWriter; + std::vector NumberedTypes; public: inline AssemblyWriter(raw_ostream &o, SlotTracker &Mac, const Module *M, AssemblyAnnotationWriter *AAW) : Out(o), Machine(Mac), TheModule(M), AnnotationWriter(AAW) { - AddModuleTypesToPrinter(TypePrinter, M); + AddModuleTypesToPrinter(TypePrinter, NumberedTypes, M); } - void write(const Module *M) { printModule(M); } + void write(const Module *M) { printModule(M); } void write(const GlobalValue *G) { if (const GlobalVariable *GV = dyn_cast(G)) @@ -993,7 +1096,7 @@ // which slot it occupies. void printInfoComment(const Value &V); }; -} // end of llvm namespace +} // end of anonymous namespace void AssemblyWriter::writeOperand(const Value *Operand, bool PrintType) { @@ -1070,7 +1173,7 @@ Out << " ]\n"; } - // Loop over the symbol table, emitting all named constants. + // Loop over the symbol table, emitting all id'd types. printTypeSymbolTable(M->getTypeSymbolTable()); for (Module::const_global_iterator I = M->global_begin(), E = M->global_end(); @@ -1192,7 +1295,17 @@ } void AssemblyWriter::printTypeSymbolTable(const TypeSymbolTable &ST) { - // Print the types. + // Emit all numbered types. + for (unsigned i = 0, e = NumberedTypes.size(); i != e; ++i) { + Out << "\ttype "; + + // Make sure we print out at least one level of the type structure, so + // that we do not get %2 = type %2 + TypePrinter.printAtLeastOneLevel(NumberedTypes[i], Out); + Out << "\t\t; type %" << i << '\n'; + } + + // Print the named types. for (TypeSymbolTable::const_iterator TI = ST.begin(), TE = ST.end(); TI != TE; ++TI) { Out << '\t'; @@ -1721,8 +1834,5 @@ // Type::dump - allow easy printing of Types from the debugger. void Type::dump() const { dump(0); } - // Module::dump() - Allow printing of Modules from the debugger. void Module::dump() const { print(errs(), 0); errs().flush(); } - - Added: llvm/trunk/test/Assembler/2009-02-28-StripOpaqueName.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/2009-02-28-StripOpaqueName.ll?rev=65738&view=auto ============================================================================== --- llvm/trunk/test/Assembler/2009-02-28-StripOpaqueName.ll (added) +++ llvm/trunk/test/Assembler/2009-02-28-StripOpaqueName.ll Sat Feb 28 18:03:38 2009 @@ -0,0 +1,6 @@ +; RUN: llvm-as < %s | opt -strip | llvm-dis | llvm-as | llvm-dis + +; Stripping the name from A should not break references to it. +%A = type opaque + at g1 = external global %A + at g2 = global %A* @g1 From sabre at nondot.org Sat Feb 28 18:24:40 2009 From: sabre at nondot.org (Chris Lattner) Date: Sun, 01 Mar 2009 00:24:40 -0000 Subject: [llvm-commits] [llvm] r65739 - /llvm/trunk/test/Transforms/DeadArgElim/keepalive.ll Message-ID: <200903010024.n210Oeua027235@zion.cs.uiuc.edu> Author: lattner Date: Sat Feb 28 18:24:40 2009 New Revision: 65739 URL: http://llvm.org/viewvc/llvm-project?rev=65739&view=rev Log: adjust test to make it more robust Modified: llvm/trunk/test/Transforms/DeadArgElim/keepalive.ll Modified: llvm/trunk/test/Transforms/DeadArgElim/keepalive.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/DeadArgElim/keepalive.ll?rev=65739&r1=65738&r2=65739&view=diff ============================================================================== --- llvm/trunk/test/Transforms/DeadArgElim/keepalive.ll (original) +++ llvm/trunk/test/Transforms/DeadArgElim/keepalive.ll Sat Feb 28 18:24:40 2009 @@ -1,6 +1,8 @@ ; RUN: llvm-as < %s | opt -deadargelim | llvm-dis > %t -; RUN: cat %t | grep {define internal zeroext i32 @test1() nounwind} -; RUN: cat %t | grep {define internal \<\{ i32, i32 \}\> @test} +; RUN: grep {define internal zeroext i32 @test1() nounwind} %t +; RUN: grep {define internal %Ty @test2} %t + +%Ty = type <{ i32, i32 }> ; Check if the pass doesn't modify anything that doesn't need changing. We feed ; an unused argument to each function to lure it into changing _something_ about From sabre at nondot.org Sat Feb 28 18:25:47 2009 From: sabre at nondot.org (Chris Lattner) Date: Sun, 01 Mar 2009 00:25:47 -0000 Subject: [llvm-commits] [llvm] r65740 - /llvm/trunk/test/Transforms/SCCP/2008-03-10-sret.ll Message-ID: <200903010025.n210PloI027281@zion.cs.uiuc.edu> Author: lattner Date: Sat Feb 28 18:25:46 2009 New Revision: 65740 URL: http://llvm.org/viewvc/llvm-project?rev=65740&view=rev Log: adjust for asmprinter change. Modified: llvm/trunk/test/Transforms/SCCP/2008-03-10-sret.ll Modified: llvm/trunk/test/Transforms/SCCP/2008-03-10-sret.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SCCP/2008-03-10-sret.ll?rev=65740&r1=65739&r2=65740&view=diff ============================================================================== --- llvm/trunk/test/Transforms/SCCP/2008-03-10-sret.ll (original) +++ llvm/trunk/test/Transforms/SCCP/2008-03-10-sret.ll Sat Feb 28 18:25:46 2009 @@ -1,8 +1,10 @@ ; RUN: llvm-as < %s | opt -ipsccp | llvm-dis > %t ; RUN: grep {ret i32 36} %t -; RUN: grep {%mrv = insertvalue \{ i32, i32 \} undef, i32 18, 0} %t -; RUN: grep {%mrv1 = insertvalue \{ i32, i32 \} %mrv, i32 17, 1} %t -; RUN: grep {ret \{ i32, i32 \} %mrv1} %t +; RUN: grep {%mrv = insertvalue %T undef, i32 18, 0} %t +; RUN: grep {%mrv1 = insertvalue %T %mrv, i32 17, 1} %t +; RUN: grep {ret %T %mrv1} %t + +%T = type {i32,i32} define internal {i32, i32} @bar(i32 %A) { %X = add i32 1, %A From sabre at nondot.org Sat Feb 28 18:26:51 2009 From: sabre at nondot.org (Chris Lattner) Date: Sun, 01 Mar 2009 00:26:51 -0000 Subject: [llvm-commits] [llvm] r65741 - /llvm/trunk/test/Transforms/ScalarRepl/2003-10-29-ArrayProblem.ll Message-ID: <200903010026.n210QpED027321@zion.cs.uiuc.edu> Author: lattner Date: Sat Feb 28 18:26:51 2009 New Revision: 65741 URL: http://llvm.org/viewvc/llvm-project?rev=65741&view=rev Log: adjust for asmprinter change. Modified: llvm/trunk/test/Transforms/ScalarRepl/2003-10-29-ArrayProblem.ll Modified: llvm/trunk/test/Transforms/ScalarRepl/2003-10-29-ArrayProblem.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/ScalarRepl/2003-10-29-ArrayProblem.ll?rev=65741&r1=65740&r2=65741&view=diff ============================================================================== --- llvm/trunk/test/Transforms/ScalarRepl/2003-10-29-ArrayProblem.ll (original) +++ llvm/trunk/test/Transforms/ScalarRepl/2003-10-29-ArrayProblem.ll Sat Feb 28 18:26:51 2009 @@ -1,6 +1,6 @@ -; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | \ -; RUN: grep alloca | grep \\{ +; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | grep {alloca %T} +%T = type { [80 x i8], i32, i32 } declare i32 @.callback_1(i8*) declare void @.iter_2(i32 (i8*)*, i8*) From sabre at nondot.org Sat Feb 28 18:32:33 2009 From: sabre at nondot.org (Chris Lattner) Date: Sun, 01 Mar 2009 00:32:33 -0000 Subject: [llvm-commits] [llvm] r65742 - /llvm/trunk/lib/VMCore/AsmWriter.cpp Message-ID: <200903010032.n210WXgE027488@zion.cs.uiuc.edu> Author: lattner Date: Sat Feb 28 18:32:33 2009 New Revision: 65742 URL: http://llvm.org/viewvc/llvm-project?rev=65742&view=rev Log: walk type symbol table also, so we get: type opaque ; type %0 %C = type { %0, %0 } instead of: %C = type { opaque, opaque } when appropriate. Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=65742&r1=65741&r2=65742&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original) +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Sat Feb 28 18:32:33 2009 @@ -332,6 +332,13 @@ : TP(tp), NumberedTypes(numberedTypes) {} void Run(const Module &M) { + // Get types from the type symbol table. This gets opaque types referened + // only through derived named types. + const TypeSymbolTable &ST = M.getTypeSymbolTable(); + for (TypeSymbolTable::const_iterator TI = ST.begin(), E = ST.end(); + TI != E; ++TI) + IncorporateType(TI->second); + // Get types from global variables. for (Module::const_global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) { @@ -368,11 +375,12 @@ private: void IncorporateType(const Type *Ty) { // Check to see if we're already visited this type. - if (!VisitedTypes.insert(Ty).second || TP.hasTypeName(Ty)) + if (!VisitedTypes.insert(Ty).second) return; // If this is a structure or opaque type, add a name for the type. - if (isa(Ty) || isa(Ty)) { + if ((isa(Ty) || isa(Ty)) + && !TP.hasTypeName(Ty)) { TP.addTypeName(Ty, "%"+utostr(unsigned(NumberedTypes.size()))); NumberedTypes.push_back(Ty); } From sabre at nondot.org Sat Feb 28 18:53:13 2009 From: sabre at nondot.org (Chris Lattner) Date: Sun, 01 Mar 2009 00:53:13 -0000 Subject: [llvm-commits] [llvm] r65743 - in /llvm/trunk: lib/AsmParser/LLParser.cpp test/Assembler/2009-02-28-CastOpc.ll Message-ID: <200903010053.n210rDnP028103@zion.cs.uiuc.edu> Author: lattner Date: Sat Feb 28 18:53:13 2009 New Revision: 65743 URL: http://llvm.org/viewvc/llvm-project?rev=65743&view=rev Log: Fix a pretty awesome bug that only happened in a strange case with anonymous types. This was reading the uint for the keyword after the token was advanced. Added: llvm/trunk/test/Assembler/2009-02-28-CastOpc.ll Modified: llvm/trunk/lib/AsmParser/LLParser.cpp Modified: llvm/trunk/lib/AsmParser/LLParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=65743&r1=65742&r2=65743&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLParser.cpp (original) +++ llvm/trunk/lib/AsmParser/LLParser.cpp Sat Feb 28 18:53:13 2009 @@ -2325,6 +2325,7 @@ if (Token == lltok::Eof) return TokError("found end of file when expecting more instructions"); LocTy Loc = Lex.getLoc(); + unsigned KeywordVal = Lex.getUIntVal(); Lex.Lex(); // Eat the keyword. switch (Token) { @@ -2339,24 +2340,24 @@ // Binary Operators. case lltok::kw_add: case lltok::kw_sub: - case lltok::kw_mul: return ParseArithmetic(Inst, PFS, Lex.getUIntVal(), 0); + case lltok::kw_mul: return ParseArithmetic(Inst, PFS, KeywordVal, 0); case lltok::kw_udiv: case lltok::kw_sdiv: case lltok::kw_urem: - case lltok::kw_srem: return ParseArithmetic(Inst, PFS, Lex.getUIntVal(), 1); + case lltok::kw_srem: return ParseArithmetic(Inst, PFS, KeywordVal, 1); case lltok::kw_fdiv: - case lltok::kw_frem: return ParseArithmetic(Inst, PFS, Lex.getUIntVal(), 2); + case lltok::kw_frem: return ParseArithmetic(Inst, PFS, KeywordVal, 2); case lltok::kw_shl: case lltok::kw_lshr: case lltok::kw_ashr: case lltok::kw_and: case lltok::kw_or: - case lltok::kw_xor: return ParseLogical(Inst, PFS, Lex.getUIntVal()); + case lltok::kw_xor: return ParseLogical(Inst, PFS, KeywordVal); case lltok::kw_icmp: case lltok::kw_fcmp: case lltok::kw_vicmp: - case lltok::kw_vfcmp: return ParseCompare(Inst, PFS, Lex.getUIntVal()); + case lltok::kw_vfcmp: return ParseCompare(Inst, PFS, KeywordVal); // Casts. case lltok::kw_trunc: case lltok::kw_zext: @@ -2369,7 +2370,7 @@ case lltok::kw_fptoui: case lltok::kw_fptosi: case lltok::kw_inttoptr: - case lltok::kw_ptrtoint: return ParseCast(Inst, PFS, Lex.getUIntVal()); + case lltok::kw_ptrtoint: return ParseCast(Inst, PFS, KeywordVal); // Other. case lltok::kw_select: return ParseSelect(Inst, PFS); case lltok::kw_va_arg: return ParseVA_Arg(Inst, PFS); @@ -2381,7 +2382,7 @@ case lltok::kw_tail: return ParseCall(Inst, PFS, true); // Memory. case lltok::kw_alloca: - case lltok::kw_malloc: return ParseAlloc(Inst, PFS, Lex.getUIntVal()); + case lltok::kw_malloc: return ParseAlloc(Inst, PFS, KeywordVal); case lltok::kw_free: return ParseFree(Inst, PFS); case lltok::kw_load: return ParseLoad(Inst, PFS, false); case lltok::kw_store: return ParseStore(Inst, PFS, false); @@ -2782,10 +2783,12 @@ ParseType(DestTy)) return true; - if (!CastInst::castIsValid((Instruction::CastOps)Opc, Op, DestTy)) + if (!CastInst::castIsValid((Instruction::CastOps)Opc, Op, DestTy)) { + CastInst::castIsValid((Instruction::CastOps)Opc, Op, DestTy); return Error(Loc, "invalid cast opcode for cast from '" + Op->getType()->getDescription() + "' to '" + DestTy->getDescription() + "'"); + } Inst = CastInst::Create((Instruction::CastOps)Opc, Op, DestTy); return false; } Added: llvm/trunk/test/Assembler/2009-02-28-CastOpc.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/2009-02-28-CastOpc.ll?rev=65743&view=auto ============================================================================== --- llvm/trunk/test/Assembler/2009-02-28-CastOpc.ll (added) +++ llvm/trunk/test/Assembler/2009-02-28-CastOpc.ll Sat Feb 28 18:53:13 2009 @@ -0,0 +1,8 @@ +; RUN: llvm-as < %s | llvm-dis + +type i32 + +define void @foo() { + bitcast %0* null to i32* + ret void +} From bob.wilson at apple.com Sat Feb 28 19:13:55 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Sun, 01 Mar 2009 01:13:55 -0000 Subject: [llvm-commits] [llvm] r65747 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAGNodes.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Target/PowerPC/PPCISelLowering.cpp Message-ID: <200903010113.n211DtAt028784@zion.cs.uiuc.edu> Author: bwilson Date: Sat Feb 28 19:13:55 2009 New Revision: 65747 URL: http://llvm.org/viewvc/llvm-project?rev=65747&view=rev Log: Combine PPC's GetConstantBuildVectorBits and isConstantSplat functions to a new method in a BuildVectorSDNode "pseudo-class". Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h?rev=65747&r1=65746&r2=65747&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h Sat Feb 28 19:13:55 2009 @@ -1929,6 +1929,24 @@ } }; +/// BuildVectorSDNode - A "pseudo-class" with methods for operating on +/// BUILD_VECTORs. +class BuildVectorSDNode : public SDNode { +public: + /// isConstantSplat - check if this is a constant splat, and if so, return + /// the splat element value in SplatBits. Any undefined bits in that value + /// are set to zero, and the corresponding bits in the SplatUndef mask are + /// set. The SplatSize value is set to the splat element size in bytes. + /// HasAnyUndefs is set to true if any bits in the vector are undefined. + bool isConstantSplat(unsigned &SplatBits, unsigned &SplatUndef, + unsigned &SplatSize, bool &HasAnyUndefs); + + static inline bool classof(const BuildVectorSDNode *) { return true; } + static inline bool classof(const SDNode *N) { + return N->getOpcode() == ISD::BUILD_VECTOR; + } +}; + /// SrcValueSDNode - An SDNode that holds an arbitrary LLVM IR Value. This is /// used when the SelectionDAG needs to make a simple reference to something /// in the LLVM IR representation. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=65747&r1=65746&r2=65747&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sat Feb 28 19:13:55 2009 @@ -5554,3 +5554,94 @@ return Val.MachineCPVal->getType(); return Val.ConstVal->getType(); } + +// If this is a splat (repetition) of a value across the whole vector, return +// the smallest size that splats it. For example, "0x01010101010101..." is a +// splat of 0x01, 0x0101, and 0x01010101. We return SplatBits = 0x01 and +// SplatSize = 1 byte. +bool BuildVectorSDNode::isConstantSplat(unsigned &SplatBits, + unsigned &SplatUndef, + unsigned &SplatSize, + bool &HasAnyUndefs) { + uint64_t Bits128[2]; + uint64_t Undef128[2]; + + // If this is a vector of constants or undefs, get the bits. A bit in + // UndefBits is set if the corresponding element of the vector is an + // ISD::UNDEF value. For undefs, the corresponding VectorBits values are + // zero. + + // Start with zero'd results. + Bits128[0] = Bits128[1] = Undef128[0] = Undef128[1] = 0; + + unsigned EltBitSize = getOperand(0).getValueType().getSizeInBits(); + for (unsigned i = 0, e = getNumOperands(); i != e; ++i) { + SDValue OpVal = getOperand(i); + + unsigned PartNo = i >= e/2; // In the upper 128 bits? + unsigned SlotNo = e/2 - (i & (e/2-1))-1; // Which subpiece of the uint64_t. + + uint64_t EltBits = 0; + if (OpVal.getOpcode() == ISD::UNDEF) { + uint64_t EltUndefBits = ~0U >> (32-EltBitSize); + Undef128[PartNo] |= EltUndefBits << (SlotNo*EltBitSize); + continue; + } else if (ConstantSDNode *CN = dyn_cast(OpVal)) { + EltBits = CN->getZExtValue() & (~0U >> (32-EltBitSize)); + } else if (ConstantFPSDNode *CN = dyn_cast(OpVal)) { + assert(CN->getValueType(0) == MVT::f32 && + "Only one legal FP vector type!"); + EltBits = FloatToBits(CN->getValueAPF().convertToFloat()); + } else { + // Nonconstant element. + return false; + } + + Bits128[PartNo] |= EltBits << (SlotNo*EltBitSize); + } + + // Don't let undefs prevent splats from matching. See if the top 64-bits are + // the same as the lower 64-bits, ignoring undefs. + if ((Bits128[0] & ~Undef128[1]) != (Bits128[1] & ~Undef128[0])) + return false; // Can't be a splat if two pieces don't match. + + uint64_t Bits64 = Bits128[0] | Bits128[1]; + uint64_t Undef64 = Undef128[0] & Undef128[1]; + + // Check that the top 32-bits are the same as the lower 32-bits, ignoring + // undefs. + if ((Bits64 & (~Undef64 >> 32)) != ((Bits64 >> 32) & ~Undef64)) + return false; // Can't be a splat if two pieces don't match. + + HasAnyUndefs = (Undef128[0] | Undef128[1]) != 0; + + uint32_t Bits32 = uint32_t(Bits64) | uint32_t(Bits64 >> 32); + uint32_t Undef32 = uint32_t(Undef64) & uint32_t(Undef64 >> 32); + + // If the top 16-bits are different than the lower 16-bits, ignoring + // undefs, we have an i32 splat. + if ((Bits32 & (~Undef32 >> 16)) != ((Bits32 >> 16) & ~Undef32)) { + SplatBits = Bits32; + SplatUndef = Undef32; + SplatSize = 4; + return true; + } + + uint16_t Bits16 = uint16_t(Bits32) | uint16_t(Bits32 >> 16); + uint16_t Undef16 = uint16_t(Undef32) & uint16_t(Undef32 >> 16); + + // If the top 8-bits are different than the lower 8-bits, ignoring + // undefs, we have an i16 splat. + if ((Bits16 & (uint16_t(~Undef16) >> 8)) != ((Bits16 >> 8) & ~Undef16)) { + SplatBits = Bits16; + SplatUndef = Undef16; + SplatSize = 2; + return true; + } + + // Otherwise, we have an 8-bit splat. + SplatBits = uint8_t(Bits16) | uint8_t(Bits16 >> 8); + SplatUndef = uint8_t(Undef16) & uint8_t(Undef16 >> 8); + SplatSize = 1; + return true; +} Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=65747&r1=65746&r2=65747&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Sat Feb 28 19:13:55 2009 @@ -3093,100 +3093,6 @@ // Vector related lowering. // -// If this is a vector of constants or undefs, get the bits. A bit in -// UndefBits is set if the corresponding element of the vector is an -// ISD::UNDEF value. For undefs, the corresponding VectorBits values are -// zero. Return true if this is not an array of constants, false if it is. -// -static bool GetConstantBuildVectorBits(SDNode *BV, uint64_t VectorBits[2], - uint64_t UndefBits[2]) { - // Start with zero'd results. - VectorBits[0] = VectorBits[1] = UndefBits[0] = UndefBits[1] = 0; - - unsigned EltBitSize = BV->getOperand(0).getValueType().getSizeInBits(); - for (unsigned i = 0, e = BV->getNumOperands(); i != e; ++i) { - SDValue OpVal = BV->getOperand(i); - - unsigned PartNo = i >= e/2; // In the upper 128 bits? - unsigned SlotNo = e/2 - (i & (e/2-1))-1; // Which subpiece of the uint64_t. - - uint64_t EltBits = 0; - if (OpVal.getOpcode() == ISD::UNDEF) { - uint64_t EltUndefBits = ~0U >> (32-EltBitSize); - UndefBits[PartNo] |= EltUndefBits << (SlotNo*EltBitSize); - continue; - } else if (ConstantSDNode *CN = dyn_cast(OpVal)) { - EltBits = CN->getZExtValue() & (~0U >> (32-EltBitSize)); - } else if (ConstantFPSDNode *CN = dyn_cast(OpVal)) { - assert(CN->getValueType(0) == MVT::f32 && - "Only one legal FP vector type!"); - EltBits = FloatToBits(CN->getValueAPF().convertToFloat()); - } else { - // Nonconstant element. - return true; - } - - VectorBits[PartNo] |= EltBits << (SlotNo*EltBitSize); - } - - //printf("%llx %llx %llx %llx\n", - // VectorBits[0], VectorBits[1], UndefBits[0], UndefBits[1]); - return false; -} - -// If this is a splat (repetition) of a value across the whole vector, return -// the smallest size that splats it. For example, "0x01010101010101..." is a -// splat of 0x01, 0x0101, and 0x01010101. We return SplatBits = 0x01 and -// SplatSize = 1 byte. -static bool isConstantSplat(const uint64_t Bits128[2], - const uint64_t Undef128[2], - unsigned &SplatBits, unsigned &SplatUndef, - unsigned &SplatSize) { - - // Don't let undefs prevent splats from matching. See if the top 64-bits are - // the same as the lower 64-bits, ignoring undefs. - if ((Bits128[0] & ~Undef128[1]) != (Bits128[1] & ~Undef128[0])) - return false; // Can't be a splat if two pieces don't match. - - uint64_t Bits64 = Bits128[0] | Bits128[1]; - uint64_t Undef64 = Undef128[0] & Undef128[1]; - - // Check that the top 32-bits are the same as the lower 32-bits, ignoring - // undefs. - if ((Bits64 & (~Undef64 >> 32)) != ((Bits64 >> 32) & ~Undef64)) - return false; // Can't be a splat if two pieces don't match. - - uint32_t Bits32 = uint32_t(Bits64) | uint32_t(Bits64 >> 32); - uint32_t Undef32 = uint32_t(Undef64) & uint32_t(Undef64 >> 32); - - // If the top 16-bits are different than the lower 16-bits, ignoring - // undefs, we have an i32 splat. - if ((Bits32 & (~Undef32 >> 16)) != ((Bits32 >> 16) & ~Undef32)) { - SplatBits = Bits32; - SplatUndef = Undef32; - SplatSize = 4; - return true; - } - - uint16_t Bits16 = uint16_t(Bits32) | uint16_t(Bits32 >> 16); - uint16_t Undef16 = uint16_t(Undef32) & uint16_t(Undef32 >> 16); - - // If the top 8-bits are different than the lower 8-bits, ignoring - // undefs, we have an i16 splat. - if ((Bits16 & (uint16_t(~Undef16) >> 8)) != ((Bits16 >> 8) & ~Undef16)) { - SplatBits = Bits16; - SplatUndef = Undef16; - SplatSize = 2; - return true; - } - - // Otherwise, we have an 8-bit splat. - SplatBits = uint8_t(Bits16) | uint8_t(Bits16 >> 8); - SplatUndef = uint8_t(Undef16) & uint8_t(Undef16 >> 8); - SplatSize = 1; - return true; -} - /// BuildSplatI - Build a canonical splati of Val with an element size of /// SplatSize. Cast the result to VT. static SDValue BuildSplatI(int Val, unsigned SplatSize, MVT VT, @@ -3256,25 +3162,18 @@ // selects to a single instruction, return Op. Otherwise, if we can codegen // this case more efficiently than a constant pool load, lower it to the // sequence of ops that should be used. -SDValue PPCTargetLowering::LowerBUILD_VECTOR(SDValue Op, - SelectionDAG &DAG) { - // If this is a vector of constants or undefs, get the bits. A bit in - // UndefBits is set if the corresponding element of the vector is an - // ISD::UNDEF value. For undefs, the corresponding VectorBits values are - // zero. - uint64_t VectorBits[2]; - uint64_t UndefBits[2]; +SDValue PPCTargetLowering::LowerBUILD_VECTOR(SDValue Op, SelectionDAG &DAG) { DebugLoc dl = Op.getDebugLoc(); - if (GetConstantBuildVectorBits(Op.getNode(), VectorBits, UndefBits)) - return SDValue(); // Not a constant vector. + BuildVectorSDNode *BVN = dyn_cast(Op.getNode()); + assert(BVN != 0 && "Expected a BuildVectorSDNode in LowerBUILD_VECTOR"); // If this is a splat (repetition) of a value across the whole vector, return // the smallest size that splats it. For example, "0x01010101010101..." is a // splat of 0x01, 0x0101, and 0x01010101. We return SplatBits = 0x01 and // SplatSize = 1 byte. unsigned SplatBits, SplatUndef, SplatSize; - if (isConstantSplat(VectorBits, UndefBits, SplatBits, SplatUndef, SplatSize)){ - bool HasAnyUndefs = (UndefBits[0] | UndefBits[1]) != 0; + bool HasAnyUndefs; + if (BVN->isConstantSplat(SplatBits, SplatUndef, SplatSize, HasAnyUndefs)) { // First, handle single instruction cases. From sabre at nondot.org Sat Feb 28 19:16:21 2009 From: sabre at nondot.org (Chris Lattner) Date: Sun, 01 Mar 2009 01:16:21 -0000 Subject: [llvm-commits] [llvm] r65748 - in /llvm/trunk: include/llvm/Assembly/Writer.h lib/VMCore/AsmWriter.cpp Message-ID: <200903010116.n211GLoK028863@zion.cs.uiuc.edu> Author: lattner Date: Sat Feb 28 19:16:21 2009 New Revision: 65748 URL: http://llvm.org/viewvc/llvm-project?rev=65748&view=rev Log: simplify handling "don't print top level name" processing, so that we get stuff like %A = type { %A*} instead of an upref. Modified: llvm/trunk/include/llvm/Assembly/Writer.h llvm/trunk/lib/VMCore/AsmWriter.cpp Modified: llvm/trunk/include/llvm/Assembly/Writer.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Assembly/Writer.h?rev=65748&r1=65747&r2=65748&view=diff ============================================================================== --- llvm/trunk/include/llvm/Assembly/Writer.h (original) +++ llvm/trunk/include/llvm/Assembly/Writer.h Sat Feb 28 19:16:21 2009 @@ -38,8 +38,11 @@ void clear(); - void print(const Type *Ty, raw_ostream &OS); - void printAtLeastOneLevel(const Type *Ty, raw_ostream &OS); + void print(const Type *Ty, raw_ostream &OS, bool IgnoreTopLevelName = false); + + void printAtLeastOneLevel(const Type *Ty, raw_ostream &OS) { + print(Ty, OS, true); + } /// hasTypeName - Return true if the type has a name in TypeNames, false /// otherwise. @@ -52,7 +55,7 @@ private: void CalcTypeName(const Type *Ty, SmallVectorImpl &TypeStack, - raw_ostream &OS); + raw_ostream &OS, bool IgnoreTopLevelName = false); }; // WriteTypeSymbolic - This attempts to write the specified type as a symbolic Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=65748&r1=65747&r2=65748&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original) +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Sat Feb 28 19:16:21 2009 @@ -166,15 +166,15 @@ /// use of type names or up references to shorten the type name where possible. void TypePrinting::CalcTypeName(const Type *Ty, SmallVectorImpl &TypeStack, - raw_ostream &OS) { + raw_ostream &OS, bool IgnoreTopLevelName) { // Check to see if the type is named. - DenseMap &TM = getTypeNamesMap(TypeNames); - DenseMap::iterator I = TM.find(Ty); - if (I != TM.end() && - // If the name wasn't temporarily removed use it. - !I->second.empty()) { - OS << I->second; - return; + if (!IgnoreTopLevelName) { + DenseMap &TM = getTypeNamesMap(TypeNames); + DenseMap::iterator I = TM.find(Ty); + if (I != TM.end()) { + OS << I->second; + return; + } } // Check to see if the Type is already on the stack... @@ -273,13 +273,16 @@ /// printTypeInt - The internal guts of printing out a type that has a /// potentially named portion. /// -void TypePrinting::print(const Type *Ty, raw_ostream &OS) { +void TypePrinting::print(const Type *Ty, raw_ostream &OS, + bool IgnoreTopLevelName) { // Check to see if the type is named. DenseMap &TM = getTypeNamesMap(TypeNames); - DenseMap::iterator I = TM.find(Ty); - if (I != TM.end()) { - OS << I->second; - return; + if (!IgnoreTopLevelName) { + DenseMap::iterator I = TM.find(Ty); + if (I != TM.end()) { + OS << I->second; + return; + } } // Otherwise we have a type that has not been named but is a derived type. @@ -289,33 +292,12 @@ std::string TypeName; raw_string_ostream TypeOS(TypeName); - CalcTypeName(Ty, TypeStack, TypeOS); + CalcTypeName(Ty, TypeStack, TypeOS, IgnoreTopLevelName); OS << TypeOS.str(); // Cache type name for later use. - TM.insert(std::make_pair(Ty, TypeOS.str())); -} - -/// printAtLeastOneLevel - Print out one level of the possibly complex type -/// without considering any symbolic types that we may have equal to it. -void TypePrinting::printAtLeastOneLevel(const Type *Ty, raw_ostream &OS) { - // If the type does not have a name, then it is already guaranteed to print at - // least one level. - DenseMap &TM = getTypeNamesMap(TypeNames); - DenseMap::iterator I = TM.find(Ty); - if (I == TM.end()) - return print(Ty, OS); - - // Otherwise, temporarily remove the name and print it. - std::string OldName; - std::swap(OldName, I->second); - - // Print the type without the name. - SmallVector TypeStack; - CalcTypeName(Ty, TypeStack, OS); - - // Restore the name. - std::swap(OldName, I->second); + if (!IgnoreTopLevelName) + TM.insert(std::make_pair(Ty, TypeOS.str())); } namespace { From sabre at nondot.org Sat Feb 28 19:28:40 2009 From: sabre at nondot.org (Chris Lattner) Date: Sun, 01 Mar 2009 01:28:40 -0000 Subject: [llvm-commits] [llvm] r65750 - /llvm/trunk/test/Bindings/Ocaml/vmcore.ml Message-ID: <200903010128.n211Se9i029273@zion.cs.uiuc.edu> Author: lattner Date: Sat Feb 28 19:28:40 2009 New Revision: 65750 URL: http://llvm.org/viewvc/llvm-project?rev=65750&view=rev Log: tweak this to accept asmprinter changes. I have no way to verify this, hopefully the buildbot will work. Modified: llvm/trunk/test/Bindings/Ocaml/vmcore.ml Modified: llvm/trunk/test/Bindings/Ocaml/vmcore.ml URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bindings/Ocaml/vmcore.ml?rev=65750&r1=65749&r2=65750&view=diff ============================================================================== --- llvm/trunk/test/Bindings/Ocaml/vmcore.ml (original) +++ llvm/trunk/test/Bindings/Ocaml/vmcore.ml Sat Feb 28 19:28:40 2009 @@ -259,7 +259,7 @@ ignore (define_global "Const08" c m); insist ((vector_type i16_type 8) = (type_of c)); - (* RUN: grep {Const09.*. i16, i16, i32, i32 . .} < %t.ll + (* RUN: grep {Const09.*.i16 1, i16 2, i32 3, i32 4} < %t.ll *) group "structure"; let c = const_struct [| one; two; three; four |] in From evan.cheng at apple.com Sat Feb 28 20:03:43 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Sun, 01 Mar 2009 02:03:43 -0000 Subject: [llvm-commits] [llvm] r65752 - in /llvm/trunk: lib/CodeGen/TwoAddressInstructionPass.cpp test/CodeGen/X86/twoaddr-coalesce-2.ll test/CodeGen/X86/twoaddr-coalesce.ll Message-ID: <200903010203.n2123hgf030355@zion.cs.uiuc.edu> Author: evancheng Date: Sat Feb 28 20:03:43 2009 New Revision: 65752 URL: http://llvm.org/viewvc/llvm-project?rev=65752&view=rev Log: Minor optimization: Look for situations like this: %reg1024 = MOV r1 %reg1025 = MOV r0 %reg1026 = ADD %reg1024, %reg1025 r0 = MOV %reg1026 Commute the ADD to hopefully eliminate an otherwise unavoidable copy. Added: llvm/trunk/test/CodeGen/X86/twoaddr-coalesce-2.ll Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp llvm/trunk/test/CodeGen/X86/twoaddr-coalesce.ll Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp?rev=65752&r1=65751&r2=65752&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp (original) +++ llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Sat Feb 28 20:03:43 2009 @@ -63,28 +63,41 @@ MachineRegisterInfo *MRI; LiveVariables *LV; + // DistanceMap - Keep track the distance of a MI from the start of the + // current basic block. + DenseMap DistanceMap; + + // SrcRegMap - A map from virtual registers to physical registers which + // are likely targets to be coalesced to due to copies from physical + // registers to virtual registers. e.g. v1024 = move r0. + DenseMap SrcRegMap; + + // DstRegMap - A map from virtual registers to physical registers which + // are likely targets to be coalesced to due to copies to physical + // registers from virtual registers. e.g. r1 = move v1024. + DenseMap DstRegMap; + bool Sink3AddrInstruction(MachineBasicBlock *MBB, MachineInstr *MI, unsigned Reg, MachineBasicBlock::iterator OldPos); bool isProfitableToReMat(unsigned Reg, const TargetRegisterClass *RC, MachineInstr *MI, MachineInstr *DefMI, - MachineBasicBlock *MBB, unsigned Loc, - DenseMap &DistanceMap); + MachineBasicBlock *MBB, unsigned Loc); bool NoUseAfterLastDef(unsigned Reg, MachineBasicBlock *MBB, unsigned Dist, - DenseMap &DistanceMap, unsigned &LastDef); bool isProfitableToCommute(unsigned regB, unsigned regC, MachineInstr *MI, MachineBasicBlock *MBB, - unsigned Dist, - DenseMap &DistanceMap); + unsigned Dist); bool CommuteInstruction(MachineBasicBlock::iterator &mi, MachineFunction::iterator &mbbi, - unsigned RegC, unsigned Dist, - DenseMap &DistanceMap); + unsigned RegB, unsigned RegC, unsigned Dist); + + void ProcessCopy(MachineInstr *MI, MachineBasicBlock *MBB, + SmallPtrSet &Processed); public: static char ID; // Pass identification, replacement for typeid TwoAddressInstructionPass() : MachineFunctionPass(&ID) {} @@ -233,10 +246,9 @@ /// the register. bool TwoAddressInstructionPass::isProfitableToReMat(unsigned Reg, - const TargetRegisterClass *RC, - MachineInstr *MI, MachineInstr *DefMI, - MachineBasicBlock *MBB, unsigned Loc, - DenseMap &DistanceMap){ + const TargetRegisterClass *RC, + MachineInstr *MI, MachineInstr *DefMI, + MachineBasicBlock *MBB, unsigned Loc) { bool OtherUse = false; for (MachineRegisterInfo::use_iterator UI = MRI->use_begin(Reg), UE = MRI->use_end(); UI != UE; ++UI) { @@ -269,9 +281,8 @@ /// two-address instruction which is being processed. It also returns the last /// def location by reference bool TwoAddressInstructionPass::NoUseAfterLastDef(unsigned Reg, - MachineBasicBlock *MBB, unsigned Dist, - DenseMap &DistanceMap, - unsigned &LastDef) { + MachineBasicBlock *MBB, unsigned Dist, + unsigned &LastDef) { LastDef = 0; unsigned LastUse = Dist; for (MachineRegisterInfo::reg_iterator I = MRI->reg_begin(Reg), @@ -292,12 +303,110 @@ return !(LastUse > LastDef && LastUse < Dist); } +/// isCopyToReg - Return true if the specified MI is a copy instruction or +/// a extract_subreg instruction. It also returns the source and destination +/// registers and whether they are physical registers by reference. +static bool isCopyToReg(MachineInstr &MI, const TargetInstrInfo *TII, + unsigned &SrcReg, unsigned &DstReg, + bool &IsSrcPhys, bool &IsDstPhys) { + SrcReg = 0; + DstReg = 0; + unsigned SrcSubIdx, DstSubIdx; + if (!TII->isMoveInstr(MI, SrcReg, DstReg, SrcSubIdx, DstSubIdx)) { + if (MI.getOpcode() == TargetInstrInfo::EXTRACT_SUBREG) { + DstReg = MI.getOperand(0).getReg(); + SrcReg = MI.getOperand(1).getReg(); + } else if (MI.getOpcode() == TargetInstrInfo::INSERT_SUBREG) { + DstReg = MI.getOperand(0).getReg(); + SrcReg = MI.getOperand(2).getReg(); + } + } + + if (DstReg) { + IsSrcPhys = TargetRegisterInfo::isPhysicalRegister(SrcReg); + IsDstPhys = TargetRegisterInfo::isPhysicalRegister(DstReg); + return true; + } + return false; +} + +/// isTwoAddrUse - Return true if the specified MI uses the specified register +/// as a two-address use. If so, return the destination register by reference. +static bool isTwoAddrUse(MachineInstr &MI, unsigned Reg, unsigned &DstReg) { + const TargetInstrDesc &TID = MI.getDesc(); + for (unsigned i = 0, e = TID.getNumOperands(); i != e; ++i) { + const MachineOperand &MO = MI.getOperand(i); + if (!MO.isReg() || !MO.isUse() || MO.getReg() != Reg) + continue; + int ti = TID.getOperandConstraint(i, TOI::TIED_TO); + if (ti != -1) { + DstReg = MI.getOperand(ti).getReg(); + return true; + } + } + return false; +} + +/// findOnlyInterestingUse - Given a register, if has a single in-basic block +/// use, return the use instruction if it's a copy or a two-address use. +static +MachineInstr *findOnlyInterestingUse(unsigned Reg, MachineBasicBlock *MBB, + MachineRegisterInfo *MRI, + const TargetInstrInfo *TII, + bool &isCopy, + unsigned &DstReg, bool &IsDstPhys) { + MachineRegisterInfo::use_iterator UI = MRI->use_begin(Reg); + if (UI == MRI->use_end()) + return 0; + MachineInstr &UseMI = *UI; + if (++UI != MRI->use_end()) + // More than one use. + return 0; + if (UseMI.getParent() != MBB) + return 0; + unsigned SrcReg; + bool IsSrcPhys; + if (isCopyToReg(UseMI, TII, SrcReg, DstReg, IsSrcPhys, IsDstPhys)) + return &UseMI; + IsDstPhys = false; + if (isTwoAddrUse(UseMI, Reg, DstReg)) + return &UseMI; + return 0; +} + +/// getMappedReg - Return the physical register the specified virtual register +/// might be mapped to. +static unsigned +getMappedReg(unsigned Reg, DenseMap &RegMap) { + while (TargetRegisterInfo::isVirtualRegister(Reg)) { + DenseMap::iterator SI = RegMap.find(Reg); + if (SI == RegMap.end()) + return 0; + Reg = SI->second; + } + if (TargetRegisterInfo::isPhysicalRegister(Reg)) + return Reg; + return 0; +} + +/// regsAreCompatible - Return true if the two registers are equal or aliased. +/// +static bool +regsAreCompatible(unsigned RegA, unsigned RegB, const TargetRegisterInfo *TRI) { + if (RegA == RegB) + return true; + if (!RegA || !RegB) + return false; + return TRI->regsOverlap(RegA, RegB); +} + + /// isProfitableToReMat - Return true if it's potentially profitable to commute /// the two-address instruction that's being processed. bool TwoAddressInstructionPass::isProfitableToCommute(unsigned regB, unsigned regC, - MachineInstr *MI, MachineBasicBlock *MBB, - unsigned Dist, DenseMap &DistanceMap) { + MachineInstr *MI, MachineBasicBlock *MBB, + unsigned Dist) { // Determine if it's profitable to commute this two address instruction. In // general, we want no uses between this instruction and the definition of // the two-address register. @@ -323,16 +432,31 @@ // %reg1030 = ADD8rr %reg1028, %reg1029, %EFLAGS // let's see if it's worth commuting it. + // Look for situations like this: + // %reg1024 = MOV r1 + // %reg1025 = MOV r0 + // %reg1026 = ADD %reg1024, %reg1025 + // r0 = MOV %reg1026 + // Commute the ADD to hopefully eliminate an otherwise unavoidable copy. + unsigned FromRegB = getMappedReg(regB, SrcRegMap); + unsigned FromRegC = getMappedReg(regC, SrcRegMap); + unsigned ToRegB = getMappedReg(regB, DstRegMap); + unsigned ToRegC = getMappedReg(regC, DstRegMap); + if (!regsAreCompatible(FromRegB, ToRegB, TRI) && + (regsAreCompatible(FromRegB, ToRegC, TRI) || + regsAreCompatible(FromRegC, ToRegB, TRI))) + return true; + // If there is a use of regC between its last def (could be livein) and this // instruction, then bail. unsigned LastDefC = 0; - if (!NoUseAfterLastDef(regC, MBB, Dist, DistanceMap, LastDefC)) + if (!NoUseAfterLastDef(regC, MBB, Dist, LastDefC)) return false; // If there is a use of regB between its last def (could be livein) and this // instruction, then go ahead and make this transformation. unsigned LastDefB = 0; - if (!NoUseAfterLastDef(regB, MBB, Dist, DistanceMap, LastDefB)) + if (!NoUseAfterLastDef(regB, MBB, Dist, LastDefB)) return true; // Since there are no intervening uses for both registers, then commute @@ -345,9 +469,8 @@ /// successful. bool TwoAddressInstructionPass::CommuteInstruction(MachineBasicBlock::iterator &mi, - MachineFunction::iterator &mbbi, - unsigned RegC, unsigned Dist, - DenseMap &DistanceMap) { + MachineFunction::iterator &mbbi, + unsigned RegB, unsigned RegC, unsigned Dist) { MachineInstr *MI = mi; DOUT << "2addr: COMMUTING : " << *MI; MachineInstr *NewMI = TII->commuteInstruction(MI); @@ -369,9 +492,91 @@ mi = NewMI; DistanceMap.insert(std::make_pair(NewMI, Dist)); } + + // Update source register map. + unsigned FromRegC = getMappedReg(RegC, SrcRegMap); + if (FromRegC) { + unsigned RegA = MI->getOperand(0).getReg(); + SrcRegMap[RegA] = FromRegC; + } + return true; } +/// ProcessCopy - If the specified instruction is not yet processed, process it +/// if it's a copy. For a copy instruction, we find the physical registers the +/// source and destination registers might be mapped to. These are kept in +/// point-to maps used to determine future optimizations. e.g. +/// v1024 = mov r0 +/// v1025 = mov r1 +/// v1026 = add v1024, v1025 +/// r1 = mov r1026 +/// If 'add' is a two-address instruction, v1024, v1026 are both potentially +/// coalesced to r0 (from the input side). v1025 is mapped to r1. v1026 is +/// potentially joined with r1 on the output side. It's worthwhile to commute +/// 'add' to eliminate a copy. +void TwoAddressInstructionPass::ProcessCopy(MachineInstr *MI, + MachineBasicBlock *MBB, + SmallPtrSet &Processed) { + if (Processed.count(MI)) + return; + + bool IsSrcPhys, IsDstPhys; + unsigned SrcReg, DstReg; + if (!isCopyToReg(*MI, TII, SrcReg, DstReg, IsSrcPhys, IsDstPhys)) + return; + + if (IsDstPhys && !IsSrcPhys) + DstRegMap.insert(std::make_pair(SrcReg, DstReg)); + else if (!IsDstPhys && IsSrcPhys) { + bool isNew = + SrcRegMap.insert(std::make_pair(DstReg, SrcReg)).second; + isNew = isNew; // Silence compiler warning. + assert(isNew && "Can't map to two src physical registers!"); + + SmallVector VirtRegPairs; + bool isCopy = false; + unsigned NewReg = 0; + while (MachineInstr *UseMI = findOnlyInterestingUse(DstReg, MBB, MRI,TII, + isCopy, NewReg, IsDstPhys)) { + if (isCopy) { + if (Processed.insert(UseMI)) + break; + } + + DenseMap::iterator DI = DistanceMap.find(UseMI); + if (DI != DistanceMap.end()) + // Earlier in the same MBB.Reached via a back edge. + break; + + if (IsDstPhys) { + VirtRegPairs.push_back(NewReg); + break; + } + bool isNew = SrcRegMap.insert(std::make_pair(NewReg, DstReg)).second; + isNew = isNew; // Silence compiler warning. + assert(isNew && "Can't map to two src physical registers!"); + VirtRegPairs.push_back(NewReg); + DstReg = NewReg; + } + + if (!VirtRegPairs.empty()) { + unsigned ToReg = VirtRegPairs.back(); + VirtRegPairs.pop_back(); + while (!VirtRegPairs.empty()) { + unsigned FromReg = VirtRegPairs.back(); + VirtRegPairs.pop_back(); + bool isNew = DstRegMap.insert(std::make_pair(FromReg, ToReg)).second; + isNew = isNew; // Silence compiler warning. + assert(isNew && "Can't map to two dst physical registers!"); + ToReg = FromReg; + } + } + } + + Processed.insert(MI); +} + /// isSafeToDelete - If the specified instruction does not produce any side /// effects and all of its defs are dead, then it's safe to delete. static bool isSafeToDelete(MachineInstr *MI, const TargetInstrInfo *TII) { @@ -411,14 +616,14 @@ BitVector ReMatRegs; ReMatRegs.resize(MRI->getLastVirtReg()+1); - // DistanceMap - Keep track the distance of a MI from the start of the - // current basic block. - DenseMap DistanceMap; - + SmallPtrSet Processed; for (MachineFunction::iterator mbbi = MF.begin(), mbbe = MF.end(); mbbi != mbbe; ++mbbi) { unsigned Dist = 0; DistanceMap.clear(); + SrcRegMap.clear(); + DstRegMap.clear(); + Processed.clear(); for (MachineBasicBlock::iterator mi = mbbi->begin(), me = mbbi->end(); mi != me; ) { MachineBasicBlock::iterator nmi = next(mi); @@ -426,6 +631,9 @@ bool FirstTied = true; DistanceMap.insert(std::make_pair(mi, ++Dist)); + + ProcessCopy(&*mi, &*mbbi, Processed); + for (unsigned si = 1, e = TID.getNumOperands(); si < e; ++si) { int ti = TID.getOperandConstraint(si, TOI::TIED_TO); if (ti == -1) @@ -489,7 +697,7 @@ "Not a proper commutative instruction!"); unsigned regC = mi->getOperand(3-si).getReg(); if (mi->killsRegister(regC)) { - if (CommuteInstruction(mi, mbbi, regC, Dist, DistanceMap)) { + if (CommuteInstruction(mi, mbbi, regB, regC, Dist)) { ++NumCommuted; regB = regC; goto InstructionRearranged; @@ -536,8 +744,8 @@ // If it's profitable to commute the instruction, do so. if (TID.isCommutable() && mi->getNumOperands() >= 3) { unsigned regC = mi->getOperand(3-si).getReg(); - if (isProfitableToCommute(regB, regC, mi, mbbi, Dist, DistanceMap)) - if (CommuteInstruction(mi, mbbi, regC, Dist, DistanceMap)) { + if (isProfitableToCommute(regB, regC, mi, mbbi, Dist)) + if (CommuteInstruction(mi, mbbi, regB, regC, Dist)) { ++NumAggrCommuted; ++NumCommuted; regB = regC; @@ -552,7 +760,7 @@ if (DefMI && DefMI->getDesc().isAsCheapAsAMove() && DefMI->isSafeToReMat(TII, regB) && - isProfitableToReMat(regB, rc, mi, DefMI, mbbi, Dist,DistanceMap)){ + isProfitableToReMat(regB, rc, mi, DefMI, mbbi, Dist)){ DEBUG(cerr << "2addr: REMATTING : " << *DefMI << "\n"); TII->reMaterialize(*mbbi, mi, regA, DefMI); ReMatRegs.set(regB); Added: llvm/trunk/test/CodeGen/X86/twoaddr-coalesce-2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/twoaddr-coalesce-2.ll?rev=65752&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/twoaddr-coalesce-2.ll (added) +++ llvm/trunk/test/CodeGen/X86/twoaddr-coalesce-2.ll Sat Feb 28 20:03:43 2009 @@ -0,0 +1,15 @@ +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -stats |& \ +; RUN: grep {twoaddrinstr} | grep {Number of instructions aggressively commuted} +; rdar://6480363 + +target triple = "i386-apple-darwin9.6" + +define <2 x double> @t(<2 x double> %A, <2 x double> %B, <2 x double> %C) nounwind readnone { +entry: + %tmp.i3 = bitcast <2 x double> %B to <2 x i64> ; <<2 x i64>> [#uses=1] + %tmp2.i = or <2 x i64> %tmp.i3, ; <<2 x i64>> [#uses=1] + %tmp3.i = bitcast <2 x i64> %tmp2.i to <2 x double> ; <<2 x double>> [#uses=1] + %tmp.i2 = add <2 x double> %tmp3.i, %A ; <<2 x double>> [#uses=1] + %tmp.i = add <2 x double> %tmp.i2, %C ; <<2 x double>> [#uses=1] + ret <2 x double> %tmp.i +} Modified: llvm/trunk/test/CodeGen/X86/twoaddr-coalesce.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/twoaddr-coalesce.ll?rev=65752&r1=65751&r2=65752&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/twoaddr-coalesce.ll (original) +++ llvm/trunk/test/CodeGen/X86/twoaddr-coalesce.ll Sat Feb 28 20:03:43 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -join-cross-class-copies -stats |& \ +; RUN: llvm-as < %s | llc -march=x86 -stats |& \ ; RUN: grep {twoaddrinstr} | grep {Number of instructions aggressively commuted} ; rdar://6523745 From sabre at nondot.org Sat Feb 28 20:26:47 2009 From: sabre at nondot.org (Chris Lattner) Date: Sun, 01 Mar 2009 02:26:47 -0000 Subject: [llvm-commits] [llvm] r65755 - /llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Message-ID: <200903010226.n212Ql2N031239@zion.cs.uiuc.edu> Author: lattner Date: Sat Feb 28 20:26:47 2009 New Revision: 65755 URL: http://llvm.org/viewvc/llvm-project?rev=65755&view=rev Log: hoist the check for alloca size up so that it controls CanConvertToScalar as well as isSafeAllocaToScalarRepl. Modified: llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Modified: llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp?rev=65755&r1=65754&r2=65755&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Sat Feb 28 20:26:47 2009 @@ -253,11 +253,13 @@ // (allocations OF arrays are ok though), and an allocation of a scalar // value cannot be decomposed at all. uint64_t AllocaSize = TD->getTypePaddedSize(AI->getAllocatedType()); - + + // Do not promote any struct whose size is too big. + if (AllocaSize < SRThreshold) + continue; + if ((isa(AI->getAllocatedType()) || isa(AI->getAllocatedType())) && - // Do not promote any struct whose size is too big. - AllocaSize < SRThreshold && // Do not promote any struct into more than "32" separate vars. getNumSAElements(AI->getAllocatedType()) < SRThreshold/4) { // Check that all of the users of the allocation are capable of being From sabre at nondot.org Sat Feb 28 20:30:21 2009 From: sabre at nondot.org (Chris Lattner) Date: Sun, 01 Mar 2009 02:30:21 -0000 Subject: [llvm-commits] [llvm] r65756 - /llvm/trunk/docs/ReleaseNotes.html Message-ID: <200903010230.n212ULpG031348@zion.cs.uiuc.edu> Author: lattner Date: Sat Feb 28 20:30:21 2009 New Revision: 65756 URL: http://llvm.org/viewvc/llvm-project?rev=65756&view=rev Log: add some llvmc notes from Mikhail Modified: llvm/trunk/docs/ReleaseNotes.html Modified: llvm/trunk/docs/ReleaseNotes.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ReleaseNotes.html?rev=65756&r1=65755&r2=65756&view=diff ============================================================================== --- llvm/trunk/docs/ReleaseNotes.html (original) +++ llvm/trunk/docs/ReleaseNotes.html Sat Feb 28 20:30:21 2009 @@ -485,6 +485,53 @@

    + + + +
    +

    New features include:

    + +
      +
    • Beginning with LLVM 2.5, llvmc2 is known as just 'llvmc'. The + old llvmc driver was removed.
    • + +
    • The Clang plugin was substantially improved and is now enabled + by default. The command 'llvmc --clang' can be now used as a + synonym to 'ccc'.
    • + +
    • There is now a '--check-graph' option which is supposed to + catch common errors like multiple default edges, mismatched + output/input language names and cycles. In general, these + checks can't be done at compile-time because of the need to + support plugins.
    • + +
    • Plugins are now more flexible and can refer to compilation + graph nodes and options defined in other plugins. To manage + dependencies, a priority-sorting mechanism was introduced. This + change affects the '.td' file syntax; see the documentation for + details.
    • + +
    • Hooks can now be provided with arguments. The syntax + is "$CALL(MyHook, 'Arg1', 'Arg2', 'Arg #3')".
    • + +
    • A new option type: multi-valued option, for options that take + more than one argument (for example, "-foo a b c").
    • + +
    • New option properties: 'one_or_more', 'zero_or_more', 'hidden' + and 'really_hidden'.
    • + +
    • The 'case' expression gained an 'error' action and an 'empty' + test (equivalent to '(not (not_empty ...))').
    • + +
    • Documentation now looks more consistent to the rest of the LLVM + docs. There is also a man page now.
    • + +
    + +
    +
    From clattner at apple.com Sat Feb 28 20:33:55 2009 From: clattner at apple.com (Chris Lattner) Date: Sat, 28 Feb 2009 18:33:55 -0800 Subject: [llvm-commits] [llvm] r65747 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAGNodes.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Target/PowerPC/PPCISelLowering.cpp In-Reply-To: <200903010113.n211DtAt028784@zion.cs.uiuc.edu> References: <200903010113.n211DtAt028784@zion.cs.uiuc.edu> Message-ID: On Feb 28, 2009, at 5:13 PM, Bob Wilson wrote: > URL: http://llvm.org/viewvc/llvm-project?rev=65747&view=rev > Log: > Combine PPC's GetConstantBuildVectorBits and isConstantSplat > functions to a new > method in a BuildVectorSDNode "pseudo-class". Very nice Bob! > +/// BuildVectorSDNode - A "pseudo-class" with methods for operating > on > +/// BUILD_VECTORs. > +class BuildVectorSDNode : public SDNode { > +public: > + /// isConstantSplat - check if this is a constant splat, and if > so, return > + /// the splat element value in SplatBits. Any undefined bits in > that value > + /// are set to zero, and the corresponding bits in the SplatUndef > mask are > + /// set. The SplatSize value is set to the splat element size in > bytes. > + /// HasAnyUndefs is set to true if any bits in the vector are > undefined. > + bool isConstantSplat(unsigned &SplatBits, unsigned &SplatUndef, > + unsigned &SplatSize, bool &HasAnyUndefs); This should indicate what happens with vectors that have more than 32 elements (which is #bits in SplatUndef etc). Should this always return false? What happens when the element is greater than 32-bits, e.g. <2 x i64> ? Perhaps it would be best to change the interface to take APInts by ref. > +// If this is a splat (repetition) of a value across the whole > vector, return > +// the smallest size that splats it. For example, > "0x01010101010101..." is a > +// splat of 0x01, 0x0101, and 0x01010101. We return SplatBits = > 0x01 and > +// SplatSize = 1 byte. > +bool BuildVectorSDNode::isConstantSplat(unsigned &SplatBits, > + unsigned &SplatUndef, > + unsigned &SplatSize, > + bool &HasAnyUndefs) { > + uint64_t Bits128[2]; > + uint64_t Undef128[2]; Ok, this is really specific to 128-bit vectors. Do you plan to generalize this? -Chris From isanbard at gmail.com Sat Feb 28 21:55:13 2009 From: isanbard at gmail.com (Bill Wendling) Date: Sun, 01 Mar 2009 03:55:13 -0000 Subject: [llvm-commits] [llvm] r65758 - /llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Message-ID: <200903010355.n213tDof001291@zion.cs.uiuc.edu> Author: void Date: Sat Feb 28 21:55:12 2009 New Revision: 65758 URL: http://llvm.org/viewvc/llvm-project?rev=65758&view=rev Log: Temporarily revert r65755. It was causing failures in the self-hosting testsuite: Running /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/CodeGen/X86/dg.exp ... FAIL: /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/CodeGen/X86/nancvt.ll Failed with exit(1) at line 2 while running: grep 2147027116 nancvt.ll.tmp | count 3 count: expected 3 lines and got 0. child process exited abnormally FAIL: /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/CodeGen/X86/vec_ins_extract.ll Failed with exit(1) at line 1 while running: llvm-as < /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/CodeGen/X86/vec_ins_extract.ll | opt -scalarrepl -instcombine | llc -march=x86 -mcpu=yonah | not /usr/bin/grep sub.*esp subl $28, %esp subl $28, %esp child process exited abnormally And more. Modified: llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Modified: llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp?rev=65758&r1=65757&r2=65758&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Sat Feb 28 21:55:12 2009 @@ -253,13 +253,11 @@ // (allocations OF arrays are ok though), and an allocation of a scalar // value cannot be decomposed at all. uint64_t AllocaSize = TD->getTypePaddedSize(AI->getAllocatedType()); - - // Do not promote any struct whose size is too big. - if (AllocaSize < SRThreshold) - continue; - + if ((isa(AI->getAllocatedType()) || isa(AI->getAllocatedType())) && + // Do not promote any struct whose size is too big. + AllocaSize < SRThreshold && // Do not promote any struct into more than "32" separate vars. getNumSAElements(AI->getAllocatedType()) < SRThreshold/4) { // Check that all of the users of the allocation are capable of being From bob.wilson at apple.com Sat Feb 28 22:21:57 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Sat, 28 Feb 2009 20:21:57 -0800 Subject: [llvm-commits] [llvm] r65747 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAGNodes.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Target/PowerPC/PPCISelLowering.cpp In-Reply-To: References: <200903010113.n211DtAt028784@zion.cs.uiuc.edu> Message-ID: <69FACCE2-7DF7-438F-B08F-233878BDDC11@apple.com> On Feb 28, 2009, at 6:33 PM, Chris Lattner wrote: > This should indicate what happens with vectors that have more than 32 > elements (which is #bits in SplatUndef etc). Should this always > return false? What happens when the element is greater than 32-bits, > e.g. <2 x i64> ? > > Perhaps it would be best to change the interface to take APInts by > ref. > >> +// If this is a splat (repetition) of a value across the whole >> vector, return >> +// the smallest size that splats it. For example, >> "0x01010101010101..." is a >> +// splat of 0x01, 0x0101, and 0x01010101. We return SplatBits = >> 0x01 and >> +// SplatSize = 1 byte. >> +bool BuildVectorSDNode::isConstantSplat(unsigned &SplatBits, >> + unsigned &SplatUndef, >> + unsigned &SplatSize, >> + bool &HasAnyUndefs) { >> + uint64_t Bits128[2]; >> + uint64_t Undef128[2]; > > Ok, this is really specific to 128-bit vectors. Do you plan to > generalize this? Yes. Scott had generalized it in some ways, and I had patched my local copy of his code to handle vectors of any size. I'm planning to get back to that point. But, in light on the PPC regression that Evan reported, I thought it best to proceed in stages so it will be easier to figure out what is breaking. This patch just moved the existing PPC code. I'll continue with further changes soon. Thanks for your suggestions! From baldrick at free.fr Sun Mar 1 02:26:22 2009 From: baldrick at free.fr (Duncan Sands) Date: Sun, 01 Mar 2009 08:26:22 -0000 Subject: [llvm-commits] [llvm] r65765 - /llvm/trunk/docs/ReleaseNotes.html Message-ID: <200903010826.n218QNoP009492@zion.cs.uiuc.edu> Author: baldrick Date: Sun Mar 1 02:26:19 2009 New Revision: 65765 URL: http://llvm.org/viewvc/llvm-project?rev=65765&view=rev Log: Another point to mention. Modified: llvm/trunk/docs/ReleaseNotes.html Modified: llvm/trunk/docs/ReleaseNotes.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ReleaseNotes.html?rev=65765&r1=65764&r2=65765&view=diff ============================================================================== --- llvm/trunk/docs/ReleaseNotes.html (original) +++ llvm/trunk/docs/ReleaseNotes.html Sun Mar 1 02:26:19 2009 @@ -309,6 +309,7 @@ cmake mature? x86 backend GS segment -> addr space 256 (r62980) nocapture +addreadattrs pass renamed to functionattrs; now calculates nocapture memdep (used by GVN and memcpyopt) is faster / more aggressive. how to write a backend doc docs/WritingAnLLVMBackend.html fastisel + exception handling From baldrick at free.fr Sun Mar 1 02:37:16 2009 From: baldrick at free.fr (Duncan Sands) Date: Sun, 1 Mar 2009 09:37:16 +0100 Subject: [llvm-commits] [llvm] r65732 - /llvm/trunk/include/llvm/BasicBlock.h In-Reply-To: <200902282246.n1SMkbtM024209@zion.cs.uiuc.edu> References: <200902282246.n1SMkbtM024209@zion.cs.uiuc.edu> Message-ID: <200903010937.16891.baldrick@free.fr> Hi Gabor, > + // forbidden (save the ilist_node) so noone will ever notice noone -> no one Ciao, Duncan. From nicholas at mxc.ca Sun Mar 1 03:38:30 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Sun, 01 Mar 2009 09:38:30 -0000 Subject: [llvm-commits] [llvm] r65766 - /llvm/trunk/docs/GoldPlugin.html Message-ID: <200903010938.n219cU7l022049@zion.cs.uiuc.edu> Author: nicholas Date: Sun Mar 1 03:38:29 2009 New Revision: 65766 URL: http://llvm.org/viewvc/llvm-project?rev=65766&view=rev Log: First pass at a document describing how to achieve LTO on Linux with gold. Added: llvm/trunk/docs/GoldPlugin.html Added: llvm/trunk/docs/GoldPlugin.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/GoldPlugin.html?rev=65766&view=auto ============================================================================== --- llvm/trunk/docs/GoldPlugin.html (added) +++ llvm/trunk/docs/GoldPlugin.html Sun Mar 1 03:38:29 2009 @@ -0,0 +1,105 @@ + + + + LLVM gold plugin + + + + +
    LLVM gold plugin
    +
      +
    1. Introduction
    2. +
    3. How to build it
    4. +
    5. Usage
    6. +
    7. Licensing
    8. +
    +
    Written by Nick Lewycky
    + + + + +
    +

    Building with link time optimization requires cooperation with the +system linker. To support LTO on Linux systems, we requires that you use +gold which has support for +LTO via plugins. This is the same system used by the upcoming +GCC LTO +support.

    +

    The LLVMgold plugin implements the gold +plugin interface on +top of +libLTO. +The same plugin can also be used by other tools such as ar and +nm. +

    + + + +
    +

    You need to build gold with plugin support and build the LLVMgold +plugin.

    +
      +
    • Build gold with plugin support: +
      +mkdir binutils
      +cd binutils
      +cvs -z 9 -d :pserver:anoncvs at sourceware.org:/cvs/src login
      +{enter "anoncvs" as the password}
      +cvs -z 9 -d :pserver:anoncvs at sourceware.org:/cvs/src co src
      +mkdir build
      +cd build
      +../src/configure --enable-gold --enable-plugins
      +make all-gold
      +
      + That should leave you with binutils/build/gold/ld-new which supports the +-plugin option. + +
    • Build LLVMgold. Configure LLVM with + --with-binutils-include=/path/to/binutils/src/include and run + make. +
    +
    + + + +
    +

    The linker takes a -plugin option that points to the path of + the plugin .so file. To find out what link command gcc + would run in a given situation, run gcc -v [...] and look + for the line where it runs collect2. Replace that with + ld-new -plugin /path/to/LLVMgold.so to test it out. Once you're + ready to switch to using gold, backup your existing /usr/bin/ld + then replace it with ld-new.

    +

    You can produce bitcode files from llvm-gcc using + -emit-llvm or -flto or -O4 which is equivalent + to -O3 -flto.

    +

    llvm-gcc has a -use-gold-plugin option which looks + for the gold plugin in the same directories as it looks for cc1. + It will not look for an alternate linker, which is why you need gold to be + the installed system linker in your path.

    +
    + + + +
    +Gold is licensed under the GPLv3. LLVMgold uses the interface file +plugin-api.h from gold which means that the resulting LLVMgold.so +binary is also GPLv3. This can still be used to link non-GPLv3 programs just +as much as gold could without the plugin. +
    + + +
    +
    + Valid CSS + Valid HTML 4.01 + Written by the + Nick Lewycky
    + The LLVM Compiler Infrastructure
    + Last modified: $Date: 2009-01-01 23:10:51 -0800 (Thu, 01 Jan 2009) $ +
    + + From ggreif at gmail.com Sun Mar 1 03:43:41 2009 From: ggreif at gmail.com (Gabor Greif) Date: Sun, 01 Mar 2009 09:43:41 -0000 Subject: [llvm-commits] [llvm] r65767 - /llvm/trunk/include/llvm/BasicBlock.h Message-ID: <200903010943.n219hfkc022237@zion.cs.uiuc.edu> Author: ggreif Date: Sun Mar 1 03:43:41 2009 New Revision: 65767 URL: http://llvm.org/viewvc/llvm-project?rev=65767&view=rev Log: Fix a typo. Thanks baldrick! Modified: llvm/trunk/include/llvm/BasicBlock.h Modified: llvm/trunk/include/llvm/BasicBlock.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BasicBlock.h?rev=65767&r1=65766&r2=65767&view=diff ============================================================================== --- llvm/trunk/include/llvm/BasicBlock.h (original) +++ llvm/trunk/include/llvm/BasicBlock.h Sun Mar 1 03:43:41 2009 @@ -36,7 +36,7 @@ // ilist_node, there is a legal viable downcast from it // to NodeTy. We use this trick to superpose i(p)list with a "ghostly" // NodeTy, which becomes the sentinel. Dereferencing the sentinel is - // forbidden (save the ilist_node) so noone will ever notice + // forbidden (save the ilist_node) so no one will ever notice // the superposition. return const_cast(static_cast(&Sentinel)); } From ggreif at gmail.com Sun Mar 1 03:45:52 2009 From: ggreif at gmail.com (Gabor Greif) Date: Sun, 01 Mar 2009 09:45:52 -0000 Subject: [llvm-commits] [llvm] r65768 - /llvm/trunk/include/llvm/Function.h Message-ID: <200903010945.n219jqi9022315@zion.cs.uiuc.edu> Author: ggreif Date: Sun Mar 1 03:45:52 2009 New Revision: 65768 URL: http://llvm.org/viewvc/llvm-project?rev=65768&view=rev Log: fix a comment Modified: llvm/trunk/include/llvm/Function.h Modified: llvm/trunk/include/llvm/Function.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Function.h?rev=65768&r1=65767&r2=65768&view=diff ============================================================================== --- llvm/trunk/include/llvm/Function.h (original) +++ llvm/trunk/include/llvm/Function.h Sun Mar 1 03:45:52 2009 @@ -28,7 +28,7 @@ class FunctionType; -// Traits for intrusive list of instructions... +// Traits for intrusive list of basic blocks... template<> struct ilist_traits : public SymbolTableListTraits { From nicholas at mxc.ca Sun Mar 1 03:51:07 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Sun, 01 Mar 2009 09:51:07 -0000 Subject: [llvm-commits] [llvm] r65769 - /llvm/trunk/docs/GoldPlugin.html Message-ID: <200903010951.n219p8Tx022516@zion.cs.uiuc.edu> Author: nicholas Date: Sun Mar 1 03:51:07 2009 New Revision: 65769 URL: http://llvm.org/viewvc/llvm-project?rev=65769&view=rev Log: Fix grammar. Modified: llvm/trunk/docs/GoldPlugin.html Modified: llvm/trunk/docs/GoldPlugin.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/GoldPlugin.html?rev=65769&r1=65768&r2=65769&view=diff ============================================================================== --- llvm/trunk/docs/GoldPlugin.html (original) +++ llvm/trunk/docs/GoldPlugin.html Sun Mar 1 03:51:07 2009 @@ -21,8 +21,8 @@

    Building with link time optimization requires cooperation with the -system linker. To support LTO on Linux systems, we requires that you use -gold which has support for +system linker. LTO support on Linux systems requires that you use +gold which supports for LTO via plugins. This is the same system used by the upcoming GCC LTO support.

    From baldrick at free.fr Sun Mar 1 09:01:22 2009 From: baldrick at free.fr (Duncan Sands) Date: Sun, 01 Mar 2009 15:01:22 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r65770 - in /llvm-gcc-4.2/trunk/gcc: llvm-convert.cpp llvm-internal.h llvm-types.cpp Message-ID: <200903011501.n21F1NS2024760@zion.cs.uiuc.edu> Author: baldrick Date: Sun Mar 1 09:01:21 2009 New Revision: 65770 URL: http://llvm.org/viewvc/llvm-project?rev=65770&view=rev Log: Now that gcc array types are always converted to an LLVM array, there is no longer any need for isArrayCompatible. The new equivalent is that the TREE_CODE is ARRAY_TYPE and that the type passes isSequentialCompatible. Simplify some code using this. Also, handle the case when an array type has an element type with variable size, but the array itself has constant size. This is in theory possible, but I couldn't construct an Ada example. Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp llvm-gcc-4.2/trunk/gcc/llvm-internal.h llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=65770&r1=65769&r2=65770&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Sun Mar 1 09:01:21 2009 @@ -5834,24 +5834,15 @@ // SExt it to retain its value in the larger type IndexVal = CastToSIntType(IndexVal, IntPtrTy); - // If this is an index into an LLVM array, codegen as a GEP. - if (isArrayCompatible(ArrayTreeType)) { - Value *Idxs[2] = { ConstantInt::get(Type::Int32Ty, 0), IndexVal }; - Value *Ptr = Builder.CreateGEP(ArrayAddr, Idxs, Idxs + 2); - const Type *ATy = cast(ArrayAddr->getType())->getElementType(); - const Type *ElementTy = cast(ATy)->getElementType(); - unsigned Alignment = MinAlign(ArrayAlign, TD.getTypePaddedSize(ElementTy)); - return LValue(BitCastToType(Ptr, - PointerType::getUnqual(ConvertType(TREE_TYPE(exp)))), - Alignment); - } - // If we are indexing over a fixed-size type, just use a GEP. if (isSequentialCompatible(ArrayTreeType)) { + SmallVector Idx; + if (TREE_CODE(ArrayTreeType) == ARRAY_TYPE) + Idx.push_back(ConstantInt::get(IntPtrTy, 0)); + Idx.push_back(IndexVal); + Value *Ptr = Builder.CreateGEP(ArrayAddr, Idx.begin(), Idx.end()); + const Type *ElementTy = ConvertType(ElementType); - const Type *PtrElementTy = PointerType::getUnqual(ElementTy); - ArrayAddr = BitCastToType(ArrayAddr, PtrElementTy); - Value *Ptr = Builder.CreateGEP(ArrayAddr, IndexVal); unsigned Alignment = MinAlign(ArrayAlign, TD.getABITypeAlignment(ElementTy)); return LValue(BitCastToType(Ptr, PointerType::getUnqual(ConvertType(TREE_TYPE(exp)))), @@ -7202,8 +7193,7 @@ // Check for variable sized reference. // FIXME: add support for array types where the size doesn't fit into 64 bits - assert((isArrayCompatible(ArrayType) || isSequentialCompatible(ArrayType)) - && "Cannot have globals with variable size!"); + assert(isSequentialCompatible(ArrayType) && "Global with variable size?"); // As an LLVM extension, we allow ARRAY_REF with a pointer as the first // operand. This construct maps directly to a getelementptr instruction. @@ -7226,8 +7216,8 @@ !TYPE_UNSIGNED(IndexType)); std::vector Idx; - if (isArrayCompatible(ArrayType)) - Idx.push_back(ConstantInt::get(Type::Int32Ty, 0)); + if (TREE_CODE (ArrayType) == ARRAY_TYPE) + Idx.push_back(ConstantInt::get(IntPtrTy, 0)); Idx.push_back(IndexVal); return TheFolder->CreateGetElementPtr(ArrayAddr, &Idx[0], Idx.size()); Modified: llvm-gcc-4.2/trunk/gcc/llvm-internal.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-internal.h?rev=65770&r1=65769&r2=65770&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-internal.h (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-internal.h Sun Mar 1 09:01:21 2009 @@ -213,13 +213,10 @@ /// isSequentialCompatible - Return true if the specified gcc array or pointer /// type and the corresponding LLVM SequentialType lay out their components -/// identically in memory. +/// identically in memory, so doing a GEP accesses the right memory location. +/// We assume that objects without a known size do not. bool isSequentialCompatible(tree_node *type); -/// isArrayCompatible - Return true if the specified gcc array or pointer type -/// corresponds to an LLVM array type. -bool isArrayCompatible(tree_node *type); - /// isBitfield - Returns whether to treat the specified field as a bitfield. bool isBitfield(tree_node *field_decl); Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp?rev=65770&r1=65769&r2=65770&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Sun Mar 1 09:01:21 2009 @@ -298,7 +298,8 @@ /// isSequentialCompatible - Return true if the specified gcc array or pointer /// type and the corresponding LLVM SequentialType lay out their components -/// identically in memory. We assume that objects without a known size do not. +/// identically in memory, so doing a GEP accesses the right memory location. +/// We assume that objects without a known size do not. bool isSequentialCompatible(tree_node *type) { assert((TREE_CODE(type) == ARRAY_TYPE || TREE_CODE(type) == POINTER_TYPE || @@ -311,28 +312,6 @@ isInt64(TYPE_SIZE(TREE_TYPE(type)), true); } -/// isArrayCompatible - Return true if the specified gcc array or pointer type -/// corresponds to an LLVM array type. -bool isArrayCompatible(tree_node *type) { - assert((TREE_CODE(type) == ARRAY_TYPE || - TREE_CODE(type) == POINTER_TYPE || - TREE_CODE(type) == REFERENCE_TYPE || - TREE_CODE(type) == BLOCK_POINTER_TYPE) && "not a sequential type!"); - return - (TREE_CODE(type) == ARRAY_TYPE) && ( - // Arrays with no size are fine as long as their components are layed out - // the same way in memory by LLVM. For example 'int X[]' -> '[0 x i32]'. - (!TYPE_SIZE(type) && isSequentialCompatible(type)) || - - // Arrays with constant size map to LLVM arrays. If the array has zero - // size then there can be two exotic cases: (1) the array might have zero - // length and a component type of variable size; or (2) the array could - // have variable length and a component type with zero size. In both - // cases we convert to a zero length LLVM array. - (TYPE_SIZE(type) && isInt64(TYPE_SIZE(type), true)) - ); -} - /// isBitfield - Returns whether to treat the specified field as a bitfield. bool isBitfield(tree_node *field_decl) { tree type = DECL_BIT_FIELD_TYPE(field_decl); @@ -872,44 +851,51 @@ if (const Type *Ty = GET_TYPE_LLVM(type)) return Ty; - if (isArrayCompatible(type)) { - uint64_t NumElements; - - if (!TYPE_SIZE(type)) { - // We get here if we have something that is declared to be an array with - // no dimension. This just becomes a zero length array of the element - // type, so 'int X[]' becomes '%X = external global [0 x i32]'. - // - // Note that this also affects new expressions, which return a pointer - // to an unsized array of elements. - NumElements = 0; - } else if (integer_zerop(TYPE_SIZE(type))) { - // An array of zero length, or with an element type of zero size. - // Turn it into a zero length array of the element type. - NumElements = 0; - } else { - // Normal constant-size array. - NumElements = getInt64(TYPE_SIZE(type), true); - - assert(isInt64(TYPE_SIZE(TREE_TYPE(type)), true) - && "Array of constant size with elements of variable size!"); - uint64_t ElementSize = getInt64(TYPE_SIZE(TREE_TYPE(type)), true); - assert(ElementSize - && "Array of positive size with elements of zero size!"); - assert(!(NumElements % ElementSize) - && "Array size is not a multiple of the element size!"); - - NumElements /= ElementSize; - } - - return TypeDB.setType(type, ArrayType::get(ConvertType(TREE_TYPE(type)), - NumElements)); + uint64_t ElementSize; + const Type *ElementTy; + if (isSequentialCompatible(type)) { + // The gcc element type maps to an LLVM type of the same size. + // Convert to an LLVM array of the converted element type. + ElementSize = getInt64(TYPE_SIZE(TREE_TYPE(type)), true); + ElementTy = ConvertType(TREE_TYPE(type)); + } else { + // The gcc element type has no size, or has variable size. Convert to an + // LLVM array of bytes. In the unlikely but theoretically possible case + // that the gcc array type has constant size, using an i8 for the element + // type ensures we can produce an LLVM array of the right size. + ElementSize = 8; + ElementTy = Type::Int8Ty; + } + + uint64_t NumElements; + if (!TYPE_SIZE(type)) { + // We get here if we have something that is declared to be an array with + // no dimension. This just becomes a zero length array of the element + // type, so 'int X[]' becomes '%X = external global [0 x i32]'. + // + // Note that this also affects new expressions, which return a pointer + // to an unsized array of elements. + NumElements = 0; + } else if (!isInt64(TYPE_SIZE(type), true)) { + // This handles cases like "int A[n]" which have a runtime constant + // number of elements, but is a compile-time variable. Since these + // are variable sized, we represent them as [0 x type]. + NumElements = 0; + } else if (integer_zerop(TYPE_SIZE(type))) { + // An array of zero length, or with an element type of zero size. + // Turn it into a zero length array of the element type. + NumElements = 0; + } else { + // Normal constant-size array. + assert(ElementSize + && "Array of positive size with elements of zero size!"); + NumElements = getInt64(TYPE_SIZE(type), true); + assert(!(NumElements % ElementSize) + && "Array size is not a multiple of the element size!"); + NumElements /= ElementSize; } - // This handles cases like "int A[n]" which have a runtime constant - // number of elements, but is a compile-time variable. Since these - // are variable sized, we represent them as A[0]. - return TypeDB.setType(type, ArrayType::get(ConvertType(TREE_TYPE(type)),0)); + return TypeDB.setType(type, ArrayType::get(ElementTy, NumElements)); } case OFFSET_TYPE: // Handle OFFSET_TYPE specially. This is used for pointers to members, From baldrick at free.fr Sun Mar 1 09:01:52 2009 From: baldrick at free.fr (Duncan Sands) Date: Sun, 01 Mar 2009 15:01:52 -0000 Subject: [llvm-commits] [llvm] r65771 - /llvm/trunk/test/FrontendC/2007-03-27-VarLengthArray.c Message-ID: <200903011501.n21F1qa8024789@zion.cs.uiuc.edu> Author: baldrick Date: Sun Mar 1 09:01:51 2009 New Revision: 65771 URL: http://llvm.org/viewvc/llvm-project?rev=65771&view=rev Log: Adjust this test for recent llvm-gcc changes. Modified: llvm/trunk/test/FrontendC/2007-03-27-VarLengthArray.c Modified: llvm/trunk/test/FrontendC/2007-03-27-VarLengthArray.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC/2007-03-27-VarLengthArray.c?rev=65771&r1=65770&r2=65771&view=diff ============================================================================== --- llvm/trunk/test/FrontendC/2007-03-27-VarLengthArray.c (original) +++ llvm/trunk/test/FrontendC/2007-03-27-VarLengthArray.c Sun Mar 1 09:01:51 2009 @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | grep {getelementptr i32} +// RUN: %llvmgcc -S %s -o - | grep {getelementptr \\\[0 x i32\\\]} extern void f(int *); int e(int m, int n) { int x[n]; From baldrick at free.fr Sun Mar 1 09:19:07 2009 From: baldrick at free.fr (Duncan Sands) Date: Sun, 01 Mar 2009 15:19:07 -0000 Subject: [llvm-commits] [llvm] r65772 - /llvm/trunk/docs/GoldPlugin.html Message-ID: <200903011519.n21FJ7bS025347@zion.cs.uiuc.edu> Author: baldrick Date: Sun Mar 1 09:19:03 2009 New Revision: 65772 URL: http://llvm.org/viewvc/llvm-project?rev=65772&view=rev Log: Tweak this a bit. Modified: llvm/trunk/docs/GoldPlugin.html Modified: llvm/trunk/docs/GoldPlugin.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/GoldPlugin.html?rev=65772&r1=65771&r2=65772&view=diff ============================================================================== --- llvm/trunk/docs/GoldPlugin.html (original) +++ llvm/trunk/docs/GoldPlugin.html Sun Mar 1 09:19:03 2009 @@ -20,15 +20,15 @@
    -

    Building with link time optimization requires cooperation with the +

    Building with link time optimization requires cooperation from the system linker. LTO support on Linux systems requires that you use -gold which supports for +the gold linker which supports LTO via plugins. This is the same system used by the upcoming GCC LTO -support.

    -

    The LLVMgold plugin implements the gold -plugin interface on -top of +project.

    +

    The LLVM gold plugin implements the +gold plugin interface +on top of libLTO. The same plugin can also be used by other tools such as ar and nm. @@ -55,7 +55,7 @@ That should leave you with binutils/build/gold/ld-new which supports the -plugin option. -

  5. Build LLVMgold. Configure LLVM with +
  6. Build the LLVMgold plugin: Configure LLVM with --with-binutils-include=/path/to/binutils/src/include and run make. From baldrick at free.fr Sun Mar 1 10:18:50 2009 From: baldrick at free.fr (Duncan Sands) Date: Sun, 01 Mar 2009 16:18:50 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r65774 - /llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Message-ID: <200903011618.n21GIoKb027257@zion.cs.uiuc.edu> Author: baldrick Date: Sun Mar 1 10:18:50 2009 New Revision: 65774 URL: http://llvm.org/viewvc/llvm-project?rev=65774&view=rev Log: The return value of a function marked with the malloc attribute does not alias anything - make it noalias. Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp?rev=65774&r1=65773&r2=65774&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Sun Mar 1 10:18:50 2009 @@ -1167,6 +1167,10 @@ TARGET_ADJUST_LLVM_RETATTR(RAttributes, type); #endif + // The value returned by a 'malloc' function does not alias anything. + if (flags & ECF_MALLOC) + RAttributes |= Attribute::NoAlias; + if (RAttributes != Attribute::None) Attrs.push_back(AttributeWithIndex::get(0, RAttributes)); From baldrick at free.fr Sun Mar 1 10:19:31 2009 From: baldrick at free.fr (Duncan Sands) Date: Sun, 01 Mar 2009 16:19:31 -0000 Subject: [llvm-commits] [llvm] r65775 - /llvm/trunk/test/FrontendC/2009-03-01-MallocNoAlias.c Message-ID: <200903011619.n21GJVcX027286@zion.cs.uiuc.edu> Author: baldrick Date: Sun Mar 1 10:19:31 2009 New Revision: 65775 URL: http://llvm.org/viewvc/llvm-project?rev=65775&view=rev Log: Functions marked malloc are noalias return. Added: llvm/trunk/test/FrontendC/2009-03-01-MallocNoAlias.c Added: llvm/trunk/test/FrontendC/2009-03-01-MallocNoAlias.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC/2009-03-01-MallocNoAlias.c?rev=65775&view=auto ============================================================================== --- llvm/trunk/test/FrontendC/2009-03-01-MallocNoAlias.c (added) +++ llvm/trunk/test/FrontendC/2009-03-01-MallocNoAlias.c Sun Mar 1 10:19:31 2009 @@ -0,0 +1,3 @@ +// RUN: %llvmgcc %s -S -o - | grep noalias + +void * __attribute__ ((malloc)) foo (void) { return 0; } From ggreif at gmail.com Sun Mar 1 10:38:10 2009 From: ggreif at gmail.com (Gabor Greif) Date: Sun, 01 Mar 2009 16:38:10 -0000 Subject: [llvm-commits] [llvm] r65776 - in /llvm/trunk: include/llvm/Function.h lib/VMCore/Function.cpp Message-ID: <200903011638.n21GcA79027917@zion.cs.uiuc.edu> Author: ggreif Date: Sun Mar 1 10:38:10 2009 New Revision: 65776 URL: http://llvm.org/viewvc/llvm-project?rev=65776&view=rev Log: Reuse a technique (pioneered for BasicBlocks) of superposing ilist with its sentinel. This is quite a win when a function really has a basic block. When the function is just a declaration (and stays so) the old way did not allocate a sentinel. So this change is most beneficial when the ratio of function definition to declaration is high. I.e. linkers etc. Incidentally these are the most resource demanding applications, so I expect that the reduced malloc traffic, locality and space savings outweigh the cost of addition of two pointers to Function. Modified: llvm/trunk/include/llvm/Function.h llvm/trunk/lib/VMCore/Function.cpp Modified: llvm/trunk/include/llvm/Function.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Function.h?rev=65776&r1=65775&r2=65776&view=diff ============================================================================== --- llvm/trunk/include/llvm/Function.h (original) +++ llvm/trunk/include/llvm/Function.h Sun Mar 1 10:38:10 2009 @@ -32,12 +32,17 @@ template<> struct ilist_traits : public SymbolTableListTraits { - // createSentinel is used to create a node that marks the end of the list... - static BasicBlock *createSentinel(); - static void destroySentinel(BasicBlock *BB) { delete BB; } + // createSentinel is used to get hold of the node that marks the end of the + // list... (same trick used here as in ilist_traits) + BasicBlock *createSentinel() const { + return const_cast(static_cast(&Sentinel)); + } + static void destroySentinel(BasicBlock*) {} static iplist &getList(Function *F); static ValueSymbolTable *getSymTab(Function *ItemParent); static int getListOffset(); +private: + ilist_node Sentinel; }; template<> struct ilist_traits Modified: llvm/trunk/lib/VMCore/Function.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Function.cpp?rev=65776&r1=65775&r2=65776&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Function.cpp (original) +++ llvm/trunk/lib/VMCore/Function.cpp Sun Mar 1 10:38:10 2009 @@ -22,13 +22,6 @@ #include "llvm/ADT/StringExtras.h" using namespace llvm; -BasicBlock *ilist_traits::createSentinel() { - BasicBlock *Ret = BasicBlock::Create(); - // This should not be garbage monitored. - LeakDetector::removeGarbageObject(Ret); - return Ret; -} - iplist &ilist_traits::getList(Function *F) { return F->getBasicBlockList(); } From ggreif at gmail.com Sun Mar 1 11:13:15 2009 From: ggreif at gmail.com (Gabor Greif) Date: Sun, 01 Mar 2009 17:13:15 -0000 Subject: [llvm-commits] [llvm] r65778 - in /llvm/trunk: include/llvm/Function.h lib/VMCore/Function.cpp Message-ID: <200903011713.n21HDFSA029113@zion.cs.uiuc.edu> Author: ggreif Date: Sun Mar 1 11:13:15 2009 New Revision: 65778 URL: http://llvm.org/viewvc/llvm-project?rev=65778&view=rev Log: Another sentinel optimization. This one should always be a win, since almost every interesting function has at least one Argument. Modified: llvm/trunk/include/llvm/Function.h llvm/trunk/lib/VMCore/Function.cpp Modified: llvm/trunk/include/llvm/Function.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Function.h?rev=65778&r1=65777&r2=65778&view=diff ============================================================================== --- llvm/trunk/include/llvm/Function.h (original) +++ llvm/trunk/include/llvm/Function.h Sun Mar 1 11:13:15 2009 @@ -48,12 +48,15 @@ template<> struct ilist_traits : public SymbolTableListTraits { - // createSentinel is used to create a node that marks the end of the list... - static Argument *createSentinel(); - static void destroySentinel(Argument *A) { delete A; } + Argument *createSentinel() const { + return const_cast(static_cast(&Sentinel)); + } + static void destroySentinel(Argument*) {} static iplist &getList(Function *F); static ValueSymbolTable *getSymTab(Function *ItemParent); static int getListOffset(); +private: + ilist_node Sentinel; }; class Function : public GlobalValue, public Annotable, Modified: llvm/trunk/lib/VMCore/Function.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Function.cpp?rev=65778&r1=65777&r2=65778&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Function.cpp (original) +++ llvm/trunk/lib/VMCore/Function.cpp Sun Mar 1 11:13:15 2009 @@ -26,13 +26,6 @@ return F->getBasicBlockList(); } -Argument *ilist_traits::createSentinel() { - Argument *Ret = new Argument(Type::Int32Ty); - // This should not be garbage monitored. - LeakDetector::removeGarbageObject(Ret); - return Ret; -} - iplist &ilist_traits::getList(Function *F) { return F->getArgumentList(); } From foldr at codedgers.com Sun Mar 1 12:09:47 2009 From: foldr at codedgers.com (Mikhail Glushenkov) Date: Sun, 01 Mar 2009 18:09:47 -0000 Subject: [llvm-commits] [llvm] r65781 - /llvm/trunk/docs/ReleaseNotes.html Message-ID: <200903011809.n21I9lko030809@zion.cs.uiuc.edu> Author: foldr Date: Sun Mar 1 12:09:47 2009 New Revision: 65781 URL: http://llvm.org/viewvc/llvm-project?rev=65781&view=rev Log: Sprinkle llvmc notes with . Also removes some trailing whitespace. Modified: llvm/trunk/docs/ReleaseNotes.html Modified: llvm/trunk/docs/ReleaseNotes.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ReleaseNotes.html?rev=65781&r1=65780&r2=65781&view=diff ============================================================================== --- llvm/trunk/docs/ReleaseNotes.html (original) +++ llvm/trunk/docs/ReleaseNotes.html Sun Mar 1 12:09:47 2009 @@ -36,7 +36,7 @@

    This document contains the release notes for the LLVM Compiler Infrastructure, release 2.5. Here we describe the status of LLVM, including major improvements from the previous release and significant known problems. -All LLVM releases may be downloaded from the LLVM releases web site.

    For more information about LLVM, including information about the latest @@ -97,7 +97,7 @@

    The Clang project is an effort to build a set of new 'LLVM native' front-end technologies for the LLVM optimizer -and code generator. While Clang is not included in the LLVM 2.5 release, it +and code generator. While Clang is not included in the LLVM 2.5 release, it is continuing to make major strides forward in all areas. Its C and Objective-C parsing and code generation support is now very solid. For example, it is capable of successfully building many real applications for X86-32 and X86-64, @@ -110,7 +110,7 @@ is quite usable for building many C and Objective-C applications. If you are interested in fast compiles and good diagnostics, we encourage you to try it out by building from mainline -and reporting any issues you hit to the Clang front-end mailing list.

    @@ -118,9 +118,9 @@
    • Clang now has a new driver, which is focused on providing a GCC-compatible - interface.
    • -
    • The X86-64 ABI is now supported.
    • -
    • Precompiled header support is now implemented.
    • + interface. +
    • The X86-64 ABI is now supported.
    • +
    • Precompiled header support is now implemented.
    • Objective-C support is significantly improved beyond LLVM 2.4, supporting many features, such as Objective-C Garbage Collection.
    • Many many bugs are fixed.
    • @@ -209,7 +209,7 @@ Pure is an algebraic/functional programming language based on term rewriting. Programs are collections of equations which are used to evaluate expressions in a symbolic fashion. Pure offers dynamic typing, eager and lazy evaluation, -lexical closures, a hygienic macro system (also based on term rewriting), +lexical closures, a hygienic macro system (also based on term rewriting), built-in list and matrix support (including list and matrix comprehensions) and an easy-to-use C interface. The interpreter uses LLVM as a backend to JIT-compile Pure programs to fast native code.

      @@ -317,7 +317,7 @@ arm port improvements? arm jit encoding stuff, constant island support? JIT TLS support on x86-32 but not x86-64. mem2reg now faster on code with huge basic blocks -stack protectors/stack canaries, -fstack-protector, controllable on a +stack protectors/stack canaries, -fstack-protector, controllable on a per-function basis with attributes. shufflevector is generalized to allow different shuffle mask width than its input vectors. @@ -332,7 +332,6 @@ X86 backend now supports -disable-mmx. noalias attribute on return value indicates that function returns new memory (e.g. malloc). -llvmc2 renamed to llvmc Jump threading more powerful: it is iterative, handles threading based on values with fully redundant and partially redundant loads. LSR improvements? @@ -385,7 +384,7 @@
      • ?
      • - +
  7. @@ -415,9 +414,9 @@
    -

    We have put a significant amount of work into the code generator infrastructure, -which allows us to implement more aggressive algorithms and make it run -faster:

    +

    We have put a significant amount of work into the code generator +infrastructure, which allows us to implement more aggressive algorithms and make +it run faster:

    • The type legalization logic has been completely rewritten, and is now @@ -495,40 +494,38 @@

      New features include:

        -
      • Beginning with LLVM 2.5, llvmc2 is known as just 'llvmc'. The - old llvmc driver was removed.
      • +
      • Beginning with LLVM 2.5, llvmc2 is known as + just llvmc. The old llvmc driver was removed.
      • The Clang plugin was substantially improved and is now enabled - by default. The command 'llvmc --clang' can be now used as a - synonym to 'ccc'.
      • + by default. The command llvmc --clang can be now used as a + synonym to ccc. -
      • There is now a '--check-graph' option which is supposed to - catch common errors like multiple default edges, mismatched - output/input language names and cycles. In general, these - checks can't be done at compile-time because of the need to - support plugins.
      • - -
      • Plugins are now more flexible and can refer to compilation - graph nodes and options defined in other plugins. To manage - dependencies, a priority-sorting mechanism was introduced. This - change affects the '.td' file syntax; see the documentation for - details.
      • - -
      • Hooks can now be provided with arguments. The syntax - is "$CALL(MyHook, 'Arg1', 'Arg2', 'Arg #3')".
      • +
      • There is now a --check-graph option which is supposed to catch + common errors like multiple default edges, mismatched output/input language + names and cycles. In general, these checks can't be done at compile-time + because of the need to support plugins.
      • + +
      • Plugins are now more flexible and can refer to compilation graph nodes and + options defined in other plugins. To manage dependencies, a priority-sorting + mechanism was introduced. This change affects the TableGen file syntax; see the + documentation for details.
      • + +
      • Hooks can now be provided with arguments. The syntax is "$CALL(MyHook, + 'Arg1', 'Arg2', 'Arg #3')".
      • -
      • A new option type: multi-valued option, for options that take - more than one argument (for example, "-foo a b c").
      • +
      • A new option type: multi-valued option, for options that take more than one + argument (for example, "-foo a b c").
      • -
      • New option properties: 'one_or_more', 'zero_or_more', 'hidden' - and 'really_hidden'.
      • +
      • New option properties: 'one_or_more', 'zero_or_more', +'hidden' and 'really_hidden'.
      • -
      • The 'case' expression gained an 'error' action and an 'empty' - test (equivalent to '(not (not_empty ...))').
      • +
      • The 'case' expression gained an 'error' action and + an 'empty' test (equivalent to "(not (not_empty ...))").
      • Documentation now looks more consistent to the rest of the LLVM docs. There is also a man page now.
      • - +
    @@ -592,9 +589,9 @@

    LLVM is known to work on the following platforms:

      -
    • Intel and AMD machines (IA32, X86-64, AMD64, EMT-64) running Red Hat +
    • Intel and AMD machines (IA32, X86-64, AMD64, EMT-64) running Red Hat Linux, Fedora Core and FreeBSD (and probably other unix-like systems).
    • -
    • PowerPC and X86-based Mac OS X systems, running 10.3 and above in 32-bit +
    • PowerPC and X86-based Mac OS X systems, running 10.3 and above in 32-bit and 64-bit modes.
    • Intel and AMD machines running on Win32 using MinGW libraries (native).
    • Intel and AMD machines running on Win32 with the Cygwin libraries (limited @@ -619,7 +616,7 @@
      -

      This section contains significant known problems with the LLVM system, +

      This section contains significant known problems with the LLVM system, listed by component. If you run into a problem, please check the LLVM bug database and submit a bug if there isn't already one.

      @@ -836,7 +833,7 @@
      • Fortran support generally works, but there are still several unresolved bugs in Bugzilla. Please see the tools/gfortran component for details.
      • - +
      • The Fortran front-end currently does not build on Darwin (without tweaks) due to unresolved dependencies on the C front-end.
      From nicholas at mxc.ca Sun Mar 1 12:48:54 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Sun, 01 Mar 2009 18:48:54 -0000 Subject: [llvm-commits] [llvm] r65783 - /llvm/trunk/docs/GoldPlugin.html Message-ID: <200903011848.n21ImsQY032428@zion.cs.uiuc.edu> Author: nicholas Date: Sun Mar 1 12:48:53 2009 New Revision: 65783 URL: http://llvm.org/viewvc/llvm-project?rev=65783&view=rev Log: Don't forget the important part. llvm-gcc -use-gold-plugin passes the right options to gold. Modified: llvm/trunk/docs/GoldPlugin.html Modified: llvm/trunk/docs/GoldPlugin.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/GoldPlugin.html?rev=65783&r1=65782&r2=65783&view=diff ============================================================================== --- llvm/trunk/docs/GoldPlugin.html (original) +++ llvm/trunk/docs/GoldPlugin.html Sun Mar 1 12:48:53 2009 @@ -75,9 +75,10 @@ -emit-llvm or -flto or -O4 which is equivalent to -O3 -flto.

      llvm-gcc has a -use-gold-plugin option which looks - for the gold plugin in the same directories as it looks for cc1. - It will not look for an alternate linker, which is why you need gold to be - the installed system linker in your path.

      + for the gold plugin in the same directories as it looks for cc1 and + passes the -plugin option to ld. It will not look for an alternate + linker, which is why you need gold to be the installed system linker in your + path.

      From clattner at apple.com Sun Mar 1 12:50:07 2009 From: clattner at apple.com (Chris Lattner) Date: Sun, 1 Mar 2009 10:50:07 -0800 Subject: [llvm-commits] [llvm] r65747 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAGNodes.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Target/PowerPC/PPCISelLowering.cpp In-Reply-To: <69FACCE2-7DF7-438F-B08F-233878BDDC11@apple.com> References: <200903010113.n211DtAt028784@zion.cs.uiuc.edu> <69FACCE2-7DF7-438F-B08F-233878BDDC11@apple.com> Message-ID: > > This patch just moved the existing PPC code. I'll continue with > further changes soon. Thanks for your suggestions! Sounds great, incremental is good! -Chris From nicholas at mxc.ca Sun Mar 1 14:58:07 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Sun, 01 Mar 2009 20:58:07 -0000 Subject: [llvm-commits] [llvm] r65785 - /llvm/trunk/docs/GoldPlugin.html Message-ID: <200903012058.n21Kw7IV004285@zion.cs.uiuc.edu> Author: nicholas Date: Sun Mar 1 14:58:07 2009 New Revision: 65785 URL: http://llvm.org/viewvc/llvm-project?rev=65785&view=rev Log: Cleanup the description of flags to llvm-gcc. Also remove stray text in the attribution. Modified: llvm/trunk/docs/GoldPlugin.html Modified: llvm/trunk/docs/GoldPlugin.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/GoldPlugin.html?rev=65785&r1=65784&r2=65785&view=diff ============================================================================== --- llvm/trunk/docs/GoldPlugin.html (original) +++ llvm/trunk/docs/GoldPlugin.html Sun Mar 1 14:58:07 2009 @@ -72,8 +72,8 @@ ready to switch to using gold, backup your existing /usr/bin/ld then replace it with ld-new.

      You can produce bitcode files from llvm-gcc using - -emit-llvm or -flto or -O4 which is equivalent - to -O3 -flto.

      + -emit-llvm or -flto, or the -O4 flag which is + synonymous with -O3 -flto.

      llvm-gcc has a -use-gold-plugin option which looks for the gold plugin in the same directories as it looks for cc1 and passes the -plugin option to ld. It will not look for an alternate @@ -97,7 +97,6 @@ src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"> Valid HTML 4.01 - Written by the Nick Lewycky
      The LLVM Compiler Infrastructure
      Last modified: $Date: 2009-01-01 23:10:51 -0800 (Thu, 01 Jan 2009) $ From nicholas at mxc.ca Sun Mar 1 15:06:42 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Sun, 01 Mar 2009 21:06:42 -0000 Subject: [llvm-commits] [llvm] r65786 - in /llvm/trunk/docs: GoldPlugin.html index.html Message-ID: <200903012106.n21L6gCN004550@zion.cs.uiuc.edu> Author: nicholas Date: Sun Mar 1 15:06:42 2009 New Revision: 65786 URL: http://llvm.org/viewvc/llvm-project?rev=65786&view=rev Log: Add the gold plugin page to the documentation index! Modified: llvm/trunk/docs/GoldPlugin.html llvm/trunk/docs/index.html Modified: llvm/trunk/docs/GoldPlugin.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/GoldPlugin.html?rev=65786&r1=65785&r2=65786&view=diff ============================================================================== --- llvm/trunk/docs/GoldPlugin.html (original) +++ llvm/trunk/docs/GoldPlugin.html Sun Mar 1 15:06:42 2009 @@ -53,7 +53,7 @@ make all-gold That should leave you with binutils/build/gold/ld-new which supports the --plugin option. +-plugin option.

    • Build the LLVMgold plugin: Configure LLVM with --with-binutils-include=/path/to/binutils/src/include and run Modified: llvm/trunk/docs/index.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/index.html?rev=65786&r1=65785&r2=65786&view=diff ============================================================================== --- llvm/trunk/docs/index.html (original) +++ llvm/trunk/docs/index.html Sun Mar 1 15:06:42 2009 @@ -121,6 +121,9 @@ using the mozilla browser, and have chatzilla installed, you can join #llvm on irc.oftc.net directly.
    • +
    • The LLVM gold plugin - How to build your +programs with link-time optimization on Linux. +
    From nicholas at mxc.ca Sun Mar 1 15:07:44 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Sun, 01 Mar 2009 21:07:44 -0000 Subject: [llvm-commits] [llvm] r65787 - /llvm/trunk/docs/index.html Message-ID: <200903012107.n21L7ids004608@zion.cs.uiuc.edu> Author: nicholas Date: Sun Mar 1 15:07:44 2009 New Revision: 65787 URL: http://llvm.org/viewvc/llvm-project?rev=65787&view=rev Log: Close list item tag, to conform with the style in this file. It's optional anyways. Modified: llvm/trunk/docs/index.html Modified: llvm/trunk/docs/index.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/index.html?rev=65787&r1=65786&r2=65787&view=diff ============================================================================== --- llvm/trunk/docs/index.html (original) +++ llvm/trunk/docs/index.html Sun Mar 1 15:07:44 2009 @@ -122,7 +122,7 @@ href="irc://irc.oftc.net/llvm">join #llvm on irc.oftc.net directly.
  8. The LLVM gold plugin - How to build your -programs with link-time optimization on Linux. +programs with link-time optimization on Linux.
  9. From nicholas at mxc.ca Sun Mar 1 15:55:10 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Sun, 01 Mar 2009 21:55:10 -0000 Subject: [llvm-commits] [llvm] r65789 - /llvm/trunk/docs/GoldPlugin.html Message-ID: <200903012155.n21LtAHm006125@zion.cs.uiuc.edu> Author: nicholas Date: Sun Mar 1 15:55:10 2009 New Revision: 65789 URL: http://llvm.org/viewvc/llvm-project?rev=65789&view=rev Log: Add a quickstart example. Modified: llvm/trunk/docs/GoldPlugin.html Modified: llvm/trunk/docs/GoldPlugin.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/GoldPlugin.html?rev=65789&r1=65788&r2=65789&view=diff ============================================================================== --- llvm/trunk/docs/GoldPlugin.html (original) +++ llvm/trunk/docs/GoldPlugin.html Sun Mar 1 15:55:10 2009 @@ -11,7 +11,10 @@
    1. Introduction
    2. How to build it
    3. -
    4. Usage
    5. +
    6. Usage +
    7. Licensing
    Written by Nick Lewycky
    @@ -80,6 +83,58 @@ linker, which is why you need gold to be the installed system linker in your path.

    + + + + +
    +

    The following example shows a worked example of the gold plugin mixing + LLVM bitcode and native code. +

    +--- a.c ---
    +#include <stdio.h>
    +
    +extern void foo1(void);
    +extern void foo4(void);
    +
    +void foo2(void) {
    +  printf("Foo2\n");
    +}
    +
    +void foo3(void) {
    +  foo4();
    +}
    +
    +int main(void) {
    +  foo1();
    +}
    +
    +--- b.c ---
    +#include <stdio.h>
    +
    +extern void foo2(void);
    +
    +void foo1(void) {
    +  foo2();
    +}
    +
    +void foo4(void) {
    +  printf("Foo4");
    +}
    +
    +--- command lines ---
    +$ llvm-gcc -flto a.c -c -o a.o              # <-- a.o is LLVM bitcode file
    +$ llvm-gcc b.c -c -o b.o                    # <-- b.o is native object file
    +$ llvm-gcc -use-gold-plugin a.o b.o -o main # <-- link with LLVMgold plugin
    +
    +

    Gold informs the plugin that foo3 is never referenced outside the IR, + leading LLVM to delete that function. However, unlike in the + libLTO + example gold does not currently eliminate foo4.

    +
    + From sabre at nondot.org Sun Mar 1 17:42:51 2009 From: sabre at nondot.org (Chris Lattner) Date: Sun, 01 Mar 2009 23:42:51 -0000 Subject: [llvm-commits] [llvm] r65790 - /llvm/trunk/docs/index.html Message-ID: <200903012342.n21Ngpw3009532@zion.cs.uiuc.edu> Author: lattner Date: Sun Mar 1 17:42:51 2009 New Revision: 65790 URL: http://llvm.org/viewvc/llvm-project?rev=65790&view=rev Log: move gold plugin next to LTO doc in the subsystem section Modified: llvm/trunk/docs/index.html Modified: llvm/trunk/docs/index.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/index.html?rev=65790&r1=65789&r2=65790&view=diff ============================================================================== --- llvm/trunk/docs/index.html (original) +++ llvm/trunk/docs/index.html Sun Mar 1 17:42:51 2009 @@ -121,9 +121,6 @@ using the mozilla browser, and have chatzilla installed, you can join #llvm on irc.oftc.net directly. -
  10. The LLVM gold plugin - How to build your -programs with link-time optimization on Linux.
  11. - @@ -234,6 +231,8 @@ document describes the interface between LLVM intermodular optimizer and the linker and its design +
  12. The LLVM gold plugin - How to build your +programs with link-time optimization on Linux.
  13. From natebegeman at mac.com Sun Mar 1 17:44:07 2009 From: natebegeman at mac.com (Nate Begeman) Date: Sun, 01 Mar 2009 23:44:07 -0000 Subject: [llvm-commits] [llvm] r65791 - in /llvm/trunk: lib/CodeGen/SelectionDAG/DAGCombiner.cpp test/CodeGen/X86/extract-combine.ll Message-ID: <200903012344.n21Ni7BU009579@zion.cs.uiuc.edu> Author: sampo Date: Sun Mar 1 17:44:07 2009 New Revision: 65791 URL: http://llvm.org/viewvc/llvm-project?rev=65791&view=rev Log: Fix a problem with DAGCombine on 64b targets where folding extracts + build_vector into a shuffle would fail, because the type of the new build_vector would not be legal. Try harder to create a legal build_vector type. Note: this will be totally irrelevant once vector_shuffle no longer takes a build_vector for shuffle mask. New: _foo: xorps %xmm0, %xmm0 xorps %xmm1, %xmm1 subps %xmm1, %xmm1 mulps %xmm0, %xmm1 addps %xmm0, %xmm1 movaps %xmm1, 0 Old: _foo: xorps %xmm0, %xmm0 movss %xmm0, %xmm1 xorps %xmm2, %xmm2 unpcklps %xmm1, %xmm2 pshufd $80, %xmm1, %xmm1 unpcklps %xmm1, %xmm2 pslldq $16, %xmm2 pshufd $57, %xmm2, %xmm1 subps %xmm0, %xmm1 mulps %xmm0, %xmm1 addps %xmm0, %xmm1 movaps %xmm1, 0 Added: llvm/trunk/test/CodeGen/X86/extract-combine.ll Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=65791&r1=65790&r2=65791&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Sun Mar 1 17:44:07 2009 @@ -5257,7 +5257,8 @@ } // Add count and size info. - MVT BuildVecVT = MVT::getVectorVT(TLI.getPointerTy(), NumElts); + MVT IndexVT = MVT::getIntegerVT(EltType.getSizeInBits()); + MVT BuildVecVT = MVT::getVectorVT(IndexVT, NumElts); if (!TLI.isTypeLegal(BuildVecVT) && LegalTypes) return SDValue(); Added: llvm/trunk/test/CodeGen/X86/extract-combine.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/extract-combine.ll?rev=65791&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/extract-combine.ll (added) +++ llvm/trunk/test/CodeGen/X86/extract-combine.ll Sun Mar 1 17:44:07 2009 @@ -0,0 +1,15 @@ +; RUN: llvm-as < %s | llc -march=x86-64 -mcpu=core2 -o %t -f +; RUN: not grep unpcklps %t + +define i32 @foo() nounwind { +entry: + %tmp74.i25762 = shufflevector <16 x float> zeroinitializer, <16 x float> zeroinitializer, <16 x i32> ; <<16 x float>> [#uses=1] + %tmp518 = shufflevector <16 x float> %tmp74.i25762, <16 x float> undef, <4 x i32> ; <<4 x float>> [#uses=1] + %movss.i25611 = shufflevector <4 x float> zeroinitializer, <4 x float> %tmp518, <4 x i32> ; <<4 x float>> [#uses=1] + %conv3.i25615 = shufflevector <4 x float> %movss.i25611, <4 x float> undef, <4 x i32> ; <<4 x float>> [#uses=1] + %sub.i25620 = sub <4 x float> %conv3.i25615, zeroinitializer ; <<4 x float>> [#uses=1] + %mul.i25621 = mul <4 x float> zeroinitializer, %sub.i25620 ; <<4 x float>> [#uses=1] + %add.i25622 = add <4 x float> zeroinitializer, %mul.i25621 ; <<4 x float>> [#uses=1] + store <4 x float> %add.i25622, <4 x float>* null + unreachable +} From evan.cheng at apple.com Sun Mar 1 19:02:47 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Sun, 1 Mar 2009 17:02:47 -0800 Subject: [llvm-commits] [llvm] r65758 - /llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp In-Reply-To: <200903010355.n213tDof001291@zion.cs.uiuc.edu> References: <200903010355.n213tDof001291@zion.cs.uiuc.edu> Message-ID: Even though I like to blame Chris for everything even I doubt this patch is at fault. It's probably exposing a bug elsewhere. Evan On Feb 28, 2009, at 7:55 PM, Bill Wendling wrote: > Author: void > Date: Sat Feb 28 21:55:12 2009 > New Revision: 65758 > > URL: http://llvm.org/viewvc/llvm-project?rev=65758&view=rev > Log: > Temporarily revert r65755. It was causing failures in the self-hosting > testsuite: > > Running /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/ > CodeGen/X86/dg.exp ... > FAIL: /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/ > CodeGen/X86/nancvt.ll > Failed with exit(1) at line 2 > while running: grep 2147027116 nancvt.ll.tmp | count 3 > count: expected 3 lines and got 0. > child process exited abnormally > FAIL: /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/ > CodeGen/X86/vec_ins_extract.ll > Failed with exit(1) at line 1 > while running: llvm-as < /Volumes/Sandbox/Buildbot/llvm/full-llvm/ > build/llvmCore/test/CodeGen/X86/vec_ins_extract.ll | opt - > scalarrepl -instcombine | llc -march=x86 -mcpu=yonah | not /usr/ > bin/grep sub.*esp > subl $28, %esp > subl $28, %esp > child process exited abnormally > > And more. > > Modified: > llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp > > Modified: llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp?rev=65758&r1=65757&r2=65758&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp > (original) > +++ llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Sat > Feb 28 21:55:12 2009 > @@ -253,13 +253,11 @@ > // (allocations OF arrays are ok though), and an allocation of a > scalar > // value cannot be decomposed at all. > uint64_t AllocaSize = TD->getTypePaddedSize(AI- > >getAllocatedType()); > - > - // Do not promote any struct whose size is too big. > - if (AllocaSize < SRThreshold) > - continue; > - > + > if ((isa(AI->getAllocatedType()) || > isa(AI->getAllocatedType())) && > + // Do not promote any struct whose size is too big. > + AllocaSize < SRThreshold && > // Do not promote any struct into more than "32" separate > vars. > getNumSAElements(AI->getAllocatedType()) < SRThreshold/4) { > // Check that all of the users of the allocation are capable > of being > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From evan.cheng at apple.com Sun Mar 1 19:05:02 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 02 Mar 2009 01:05:02 -0000 Subject: [llvm-commits] [llvm] r65793 - /llvm/branches/Apple/Dib/lib/CodeGen/TwoAddressInstructionPass.cpp Message-ID: <200903020105.n221526q012268@zion.cs.uiuc.edu> Author: evancheng Date: Sun Mar 1 19:05:02 2009 New Revision: 65793 URL: http://llvm.org/viewvc/llvm-project?rev=65793&view=rev Log: Pull r65752 into Dib. Modified: llvm/branches/Apple/Dib/lib/CodeGen/TwoAddressInstructionPass.cpp Modified: llvm/branches/Apple/Dib/lib/CodeGen/TwoAddressInstructionPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/TwoAddressInstructionPass.cpp?rev=65793&r1=65792&r2=65793&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/CodeGen/TwoAddressInstructionPass.cpp (original) +++ llvm/branches/Apple/Dib/lib/CodeGen/TwoAddressInstructionPass.cpp Sun Mar 1 19:05:02 2009 @@ -53,6 +53,7 @@ STATISTIC(NumConvertedTo3Addr, "Number of instructions promoted to 3-address"); STATISTIC(Num3AddrSunk, "Number of 3-address instructions sunk"); STATISTIC(NumReMats, "Number of instructions re-materialized"); +STATISTIC(NumDeletes, "Number of dead instructions deleted"); namespace { class VISIBILITY_HIDDEN TwoAddressInstructionPass @@ -62,28 +63,41 @@ MachineRegisterInfo *MRI; LiveVariables *LV; + // DistanceMap - Keep track the distance of a MI from the start of the + // current basic block. + DenseMap DistanceMap; + + // SrcRegMap - A map from virtual registers to physical registers which + // are likely targets to be coalesced to due to copies from physical + // registers to virtual registers. e.g. v1024 = move r0. + DenseMap SrcRegMap; + + // DstRegMap - A map from virtual registers to physical registers which + // are likely targets to be coalesced to due to copies to physical + // registers from virtual registers. e.g. r1 = move v1024. + DenseMap DstRegMap; + bool Sink3AddrInstruction(MachineBasicBlock *MBB, MachineInstr *MI, unsigned Reg, MachineBasicBlock::iterator OldPos); bool isProfitableToReMat(unsigned Reg, const TargetRegisterClass *RC, MachineInstr *MI, MachineInstr *DefMI, - MachineBasicBlock *MBB, unsigned Loc, - DenseMap &DistanceMap); + MachineBasicBlock *MBB, unsigned Loc); bool NoUseAfterLastDef(unsigned Reg, MachineBasicBlock *MBB, unsigned Dist, - DenseMap &DistanceMap, unsigned &LastDef); bool isProfitableToCommute(unsigned regB, unsigned regC, MachineInstr *MI, MachineBasicBlock *MBB, - unsigned Dist, - DenseMap &DistanceMap); + unsigned Dist); bool CommuteInstruction(MachineBasicBlock::iterator &mi, MachineFunction::iterator &mbbi, - unsigned RegC, unsigned Dist, - DenseMap &DistanceMap); + unsigned RegB, unsigned RegC, unsigned Dist); + + void ProcessCopy(MachineInstr *MI, MachineBasicBlock *MBB, + SmallPtrSet &Processed); public: static char ID; // Pass identification, replacement for typeid TwoAddressInstructionPass() : MachineFunctionPass(&ID) {} @@ -232,10 +246,9 @@ /// the register. bool TwoAddressInstructionPass::isProfitableToReMat(unsigned Reg, - const TargetRegisterClass *RC, - MachineInstr *MI, MachineInstr *DefMI, - MachineBasicBlock *MBB, unsigned Loc, - DenseMap &DistanceMap){ + const TargetRegisterClass *RC, + MachineInstr *MI, MachineInstr *DefMI, + MachineBasicBlock *MBB, unsigned Loc) { bool OtherUse = false; for (MachineRegisterInfo::use_iterator UI = MRI->use_begin(Reg), UE = MRI->use_end(); UI != UE; ++UI) { @@ -268,9 +281,8 @@ /// two-address instruction which is being processed. It also returns the last /// def location by reference bool TwoAddressInstructionPass::NoUseAfterLastDef(unsigned Reg, - MachineBasicBlock *MBB, unsigned Dist, - DenseMap &DistanceMap, - unsigned &LastDef) { + MachineBasicBlock *MBB, unsigned Dist, + unsigned &LastDef) { LastDef = 0; unsigned LastUse = Dist; for (MachineRegisterInfo::reg_iterator I = MRI->reg_begin(Reg), @@ -291,12 +303,110 @@ return !(LastUse > LastDef && LastUse < Dist); } +/// isCopyToReg - Return true if the specified MI is a copy instruction or +/// a extract_subreg instruction. It also returns the source and destination +/// registers and whether they are physical registers by reference. +static bool isCopyToReg(MachineInstr &MI, const TargetInstrInfo *TII, + unsigned &SrcReg, unsigned &DstReg, + bool &IsSrcPhys, bool &IsDstPhys) { + SrcReg = 0; + DstReg = 0; + unsigned SrcSubIdx, DstSubIdx; + if (!TII->isMoveInstr(MI, SrcReg, DstReg, SrcSubIdx, DstSubIdx)) { + if (MI.getOpcode() == TargetInstrInfo::EXTRACT_SUBREG) { + DstReg = MI.getOperand(0).getReg(); + SrcReg = MI.getOperand(1).getReg(); + } else if (MI.getOpcode() == TargetInstrInfo::INSERT_SUBREG) { + DstReg = MI.getOperand(0).getReg(); + SrcReg = MI.getOperand(2).getReg(); + } + } + + if (DstReg) { + IsSrcPhys = TargetRegisterInfo::isPhysicalRegister(SrcReg); + IsDstPhys = TargetRegisterInfo::isPhysicalRegister(DstReg); + return true; + } + return false; +} + +/// isTwoAddrUse - Return true if the specified MI uses the specified register +/// as a two-address use. If so, return the destination register by reference. +static bool isTwoAddrUse(MachineInstr &MI, unsigned Reg, unsigned &DstReg) { + const TargetInstrDesc &TID = MI.getDesc(); + for (unsigned i = 0, e = TID.getNumOperands(); i != e; ++i) { + const MachineOperand &MO = MI.getOperand(i); + if (!MO.isReg() || !MO.isUse() || MO.getReg() != Reg) + continue; + int ti = TID.getOperandConstraint(i, TOI::TIED_TO); + if (ti != -1) { + DstReg = MI.getOperand(ti).getReg(); + return true; + } + } + return false; +} + +/// findOnlyInterestingUse - Given a register, if has a single in-basic block +/// use, return the use instruction if it's a copy or a two-address use. +static +MachineInstr *findOnlyInterestingUse(unsigned Reg, MachineBasicBlock *MBB, + MachineRegisterInfo *MRI, + const TargetInstrInfo *TII, + bool &isCopy, + unsigned &DstReg, bool &IsDstPhys) { + MachineRegisterInfo::use_iterator UI = MRI->use_begin(Reg); + if (UI == MRI->use_end()) + return 0; + MachineInstr &UseMI = *UI; + if (++UI != MRI->use_end()) + // More than one use. + return 0; + if (UseMI.getParent() != MBB) + return 0; + unsigned SrcReg; + bool IsSrcPhys; + if (isCopyToReg(UseMI, TII, SrcReg, DstReg, IsSrcPhys, IsDstPhys)) + return &UseMI; + IsDstPhys = false; + if (isTwoAddrUse(UseMI, Reg, DstReg)) + return &UseMI; + return 0; +} + +/// getMappedReg - Return the physical register the specified virtual register +/// might be mapped to. +static unsigned +getMappedReg(unsigned Reg, DenseMap &RegMap) { + while (TargetRegisterInfo::isVirtualRegister(Reg)) { + DenseMap::iterator SI = RegMap.find(Reg); + if (SI == RegMap.end()) + return 0; + Reg = SI->second; + } + if (TargetRegisterInfo::isPhysicalRegister(Reg)) + return Reg; + return 0; +} + +/// regsAreCompatible - Return true if the two registers are equal or aliased. +/// +static bool +regsAreCompatible(unsigned RegA, unsigned RegB, const TargetRegisterInfo *TRI) { + if (RegA == RegB) + return true; + if (!RegA || !RegB) + return false; + return TRI->regsOverlap(RegA, RegB); +} + + /// isProfitableToReMat - Return true if it's potentially profitable to commute /// the two-address instruction that's being processed. bool TwoAddressInstructionPass::isProfitableToCommute(unsigned regB, unsigned regC, - MachineInstr *MI, MachineBasicBlock *MBB, - unsigned Dist, DenseMap &DistanceMap) { + MachineInstr *MI, MachineBasicBlock *MBB, + unsigned Dist) { // Determine if it's profitable to commute this two address instruction. In // general, we want no uses between this instruction and the definition of // the two-address register. @@ -322,16 +432,31 @@ // %reg1030 = ADD8rr %reg1028, %reg1029, %EFLAGS // let's see if it's worth commuting it. + // Look for situations like this: + // %reg1024 = MOV r1 + // %reg1025 = MOV r0 + // %reg1026 = ADD %reg1024, %reg1025 + // r0 = MOV %reg1026 + // Commute the ADD to hopefully eliminate an otherwise unavoidable copy. + unsigned FromRegB = getMappedReg(regB, SrcRegMap); + unsigned FromRegC = getMappedReg(regC, SrcRegMap); + unsigned ToRegB = getMappedReg(regB, DstRegMap); + unsigned ToRegC = getMappedReg(regC, DstRegMap); + if (!regsAreCompatible(FromRegB, ToRegB, TRI) && + (regsAreCompatible(FromRegB, ToRegC, TRI) || + regsAreCompatible(FromRegC, ToRegB, TRI))) + return true; + // If there is a use of regC between its last def (could be livein) and this // instruction, then bail. unsigned LastDefC = 0; - if (!NoUseAfterLastDef(regC, MBB, Dist, DistanceMap, LastDefC)) + if (!NoUseAfterLastDef(regC, MBB, Dist, LastDefC)) return false; // If there is a use of regB between its last def (could be livein) and this // instruction, then go ahead and make this transformation. unsigned LastDefB = 0; - if (!NoUseAfterLastDef(regB, MBB, Dist, DistanceMap, LastDefB)) + if (!NoUseAfterLastDef(regB, MBB, Dist, LastDefB)) return true; // Since there are no intervening uses for both registers, then commute @@ -344,9 +469,8 @@ /// successful. bool TwoAddressInstructionPass::CommuteInstruction(MachineBasicBlock::iterator &mi, - MachineFunction::iterator &mbbi, - unsigned RegC, unsigned Dist, - DenseMap &DistanceMap) { + MachineFunction::iterator &mbbi, + unsigned RegB, unsigned RegC, unsigned Dist) { MachineInstr *MI = mi; DOUT << "2addr: COMMUTING : " << *MI; MachineInstr *NewMI = TII->commuteInstruction(MI); @@ -368,6 +492,108 @@ mi = NewMI; DistanceMap.insert(std::make_pair(NewMI, Dist)); } + + // Update source register map. + unsigned FromRegC = getMappedReg(RegC, SrcRegMap); + if (FromRegC) { + unsigned RegA = MI->getOperand(0).getReg(); + SrcRegMap[RegA] = FromRegC; + } + + return true; +} + +/// ProcessCopy - If the specified instruction is not yet processed, process it +/// if it's a copy. For a copy instruction, we find the physical registers the +/// source and destination registers might be mapped to. These are kept in +/// point-to maps used to determine future optimizations. e.g. +/// v1024 = mov r0 +/// v1025 = mov r1 +/// v1026 = add v1024, v1025 +/// r1 = mov r1026 +/// If 'add' is a two-address instruction, v1024, v1026 are both potentially +/// coalesced to r0 (from the input side). v1025 is mapped to r1. v1026 is +/// potentially joined with r1 on the output side. It's worthwhile to commute +/// 'add' to eliminate a copy. +void TwoAddressInstructionPass::ProcessCopy(MachineInstr *MI, + MachineBasicBlock *MBB, + SmallPtrSet &Processed) { + if (Processed.count(MI)) + return; + + bool IsSrcPhys, IsDstPhys; + unsigned SrcReg, DstReg; + if (!isCopyToReg(*MI, TII, SrcReg, DstReg, IsSrcPhys, IsDstPhys)) + return; + + if (IsDstPhys && !IsSrcPhys) + DstRegMap.insert(std::make_pair(SrcReg, DstReg)); + else if (!IsDstPhys && IsSrcPhys) { + bool isNew = + SrcRegMap.insert(std::make_pair(DstReg, SrcReg)).second; + isNew = isNew; // Silence compiler warning. + assert(isNew && "Can't map to two src physical registers!"); + + SmallVector VirtRegPairs; + bool isCopy = false; + unsigned NewReg = 0; + while (MachineInstr *UseMI = findOnlyInterestingUse(DstReg, MBB, MRI,TII, + isCopy, NewReg, IsDstPhys)) { + if (isCopy) { + if (Processed.insert(UseMI)) + break; + } + + DenseMap::iterator DI = DistanceMap.find(UseMI); + if (DI != DistanceMap.end()) + // Earlier in the same MBB.Reached via a back edge. + break; + + if (IsDstPhys) { + VirtRegPairs.push_back(NewReg); + break; + } + bool isNew = SrcRegMap.insert(std::make_pair(NewReg, DstReg)).second; + isNew = isNew; // Silence compiler warning. + assert(isNew && "Can't map to two src physical registers!"); + VirtRegPairs.push_back(NewReg); + DstReg = NewReg; + } + + if (!VirtRegPairs.empty()) { + unsigned ToReg = VirtRegPairs.back(); + VirtRegPairs.pop_back(); + while (!VirtRegPairs.empty()) { + unsigned FromReg = VirtRegPairs.back(); + VirtRegPairs.pop_back(); + bool isNew = DstRegMap.insert(std::make_pair(FromReg, ToReg)).second; + isNew = isNew; // Silence compiler warning. + assert(isNew && "Can't map to two dst physical registers!"); + ToReg = FromReg; + } + } + } + + Processed.insert(MI); +} + +/// isSafeToDelete - If the specified instruction does not produce any side +/// effects and all of its defs are dead, then it's safe to delete. +static bool isSafeToDelete(MachineInstr *MI, const TargetInstrInfo *TII) { + const TargetInstrDesc &TID = MI->getDesc(); + if (TID.mayStore() || TID.isCall()) + return false; + if (TID.isTerminator() || TID.hasUnmodeledSideEffects()) + return false; + + for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { + MachineOperand &MO = MI->getOperand(i); + if (!MO.isReg() || !MO.isDef()) + continue; + if (!MO.isDead()) + return false; + } + return true; } @@ -390,14 +616,14 @@ BitVector ReMatRegs; ReMatRegs.resize(MRI->getLastVirtReg()+1); - // DistanceMap - Keep track the distance of a MI from the start of the - // current basic block. - DenseMap DistanceMap; - + SmallPtrSet Processed; for (MachineFunction::iterator mbbi = MF.begin(), mbbe = MF.end(); mbbi != mbbe; ++mbbi) { unsigned Dist = 0; DistanceMap.clear(); + SrcRegMap.clear(); + DstRegMap.clear(); + Processed.clear(); for (MachineBasicBlock::iterator mi = mbbi->begin(), me = mbbi->end(); mi != me; ) { MachineBasicBlock::iterator nmi = next(mi); @@ -405,6 +631,9 @@ bool FirstTied = true; DistanceMap.insert(std::make_pair(mi, ++Dist)); + + ProcessCopy(&*mi, &*mbbi, Processed); + for (unsigned si = 1, e = TID.getNumOperands(); si < e; ++si) { int ti = TID.getOperandConstraint(si, TOI::TIED_TO); if (ti == -1) @@ -450,6 +679,15 @@ // allow us to coalesce A and B together, eliminating the copy we are // about to insert. if (!mi->killsRegister(regB)) { + // If regA is dead and the instruction can be deleted, just delete + // it so it doesn't clobber regB. + if (mi->getOperand(ti).isDead() && isSafeToDelete(mi, TII)) { + mbbi->erase(mi); // Nuke the old inst. + mi = nmi; + ++NumDeletes; + break; // Done with this instruction. + } + // If this instruction is commutative, check to see if C dies. If // so, swap the B and C operands. This makes the live ranges of A // and C joinable. @@ -459,7 +697,7 @@ "Not a proper commutative instruction!"); unsigned regC = mi->getOperand(3-si).getReg(); if (mi->killsRegister(regC)) { - if (CommuteInstruction(mi, mbbi, regC, Dist, DistanceMap)) { + if (CommuteInstruction(mi, mbbi, regB, regC, Dist)) { ++NumCommuted; regB = regC; goto InstructionRearranged; @@ -506,8 +744,8 @@ // If it's profitable to commute the instruction, do so. if (TID.isCommutable() && mi->getNumOperands() >= 3) { unsigned regC = mi->getOperand(3-si).getReg(); - if (isProfitableToCommute(regB, regC, mi, mbbi, Dist, DistanceMap)) - if (CommuteInstruction(mi, mbbi, regC, Dist, DistanceMap)) { + if (isProfitableToCommute(regB, regC, mi, mbbi, Dist)) + if (CommuteInstruction(mi, mbbi, regB, regC, Dist)) { ++NumAggrCommuted; ++NumCommuted; regB = regC; @@ -522,7 +760,7 @@ if (DefMI && DefMI->getDesc().isAsCheapAsAMove() && DefMI->isSafeToReMat(TII, regB) && - isProfitableToReMat(regB, rc, mi, DefMI, mbbi, Dist,DistanceMap)){ + isProfitableToReMat(regB, rc, mi, DefMI, mbbi, Dist)){ DEBUG(cerr << "2addr: REMATTING : " << *DefMI << "\n"); TII->reMaterialize(*mbbi, mi, regA, DefMI); ReMatRegs.set(regB); From isanbard at gmail.com Sun Mar 1 20:22:14 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 02 Mar 2009 02:22:14 -0000 Subject: [llvm-commits] [llvm] r65794 - in /llvm/branches/Apple/Dib: lib/CodeGen/SelectionDAG/DAGCombiner.cpp test/CodeGen/X86/extract-combine.ll Message-ID: <200903020222.n222MEa8014921@zion.cs.uiuc.edu> Author: void Date: Sun Mar 1 20:22:12 2009 New Revision: 65794 URL: http://llvm.org/viewvc/llvm-project?rev=65794&view=rev Log: Merge r65791 into Dib: Fix a problem with DAGCombine on 64b targets where folding extracts + build_vector into a shuffle would fail, because the type of the new build_vector would not be legal. Try harder to create a legal build_vector type. Note: this will be totally irrelevant once vector_shuffle no longer takes a build_vector for shuffle mask. New: _foo: xorps %xmm0, %xmm0 xorps %xmm1, %xmm1 subps %xmm1, %xmm1 mulps %xmm0, %xmm1 addps %xmm0, %xmm1 movaps %xmm1, 0 Old: _foo: xorps %xmm0, %xmm0 movss %xmm0, %xmm1 xorps %xmm2, %xmm2 unpcklps %xmm1, %xmm2 pshufd $80, %xmm1, %xmm1 unpcklps %xmm1, %xmm2 pslldq $16, %xmm2 pshufd $57, %xmm2, %xmm1 subps %xmm0, %xmm1 mulps %xmm0, %xmm1 addps %xmm0, %xmm1 movaps %xmm1, 0 Added: llvm/branches/Apple/Dib/test/CodeGen/X86/extract-combine.ll - copied unchanged from r65791, llvm/trunk/test/CodeGen/X86/extract-combine.ll Modified: llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Modified: llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/DAGCombiner.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=65794&r1=65793&r2=65794&view=diff ============================================================================== --- llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original) +++ llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Sun Mar 1 20:22:12 2009 @@ -5257,7 +5257,8 @@ } // Add count and size info. - MVT BuildVecVT = MVT::getVectorVT(TLI.getPointerTy(), NumElts); + MVT IndexVT = MVT::getIntegerVT(EltType.getSizeInBits()); + MVT BuildVecVT = MVT::getVectorVT(IndexVT, NumElts); if (!TLI.isTypeLegal(BuildVecVT) && LegalTypes) return SDValue(); From isanbard at gmail.com Sun Mar 1 20:27:16 2009 From: isanbard at gmail.com (Bill Wendling) Date: Sun, 1 Mar 2009 18:27:16 -0800 Subject: [llvm-commits] [llvm] r65758 - /llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp In-Reply-To: References: <200903010355.n213tDof001291@zion.cs.uiuc.edu> Message-ID: <393702CC-DD39-4353-9B7E-177B1890B2FB@gmail.com> Very possible. But there were a lot of failures. It needs investigation. :-) -bw On Mar 1, 2009, at 5:02 PM, Evan Cheng wrote: > Even though I like to blame Chris for everything even I doubt this > patch is at fault. It's probably exposing a bug elsewhere. > > Evan > > On Feb 28, 2009, at 7:55 PM, Bill Wendling wrote: > >> Author: void >> Date: Sat Feb 28 21:55:12 2009 >> New Revision: 65758 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=65758&view=rev >> Log: >> Temporarily revert r65755. It was causing failures in the self- >> hosting >> testsuite: >> >> Running /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/ >> CodeGen/X86/dg.exp ... >> FAIL: /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/ >> CodeGen/X86/nancvt.ll >> Failed with exit(1) at line 2 >> while running: grep 2147027116 nancvt.ll.tmp | count 3 >> count: expected 3 lines and got 0. >> child process exited abnormally >> FAIL: /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/ >> CodeGen/X86/vec_ins_extract.ll >> Failed with exit(1) at line 1 >> while running: llvm-as < /Volumes/Sandbox/Buildbot/llvm/full-llvm/ >> build/llvmCore/test/CodeGen/X86/vec_ins_extract.ll | opt - >> scalarrepl -instcombine | llc -march=x86 -mcpu=yonah | not /usr/ >> bin/grep sub.*esp >> subl $28, %esp >> subl $28, %esp >> child process exited abnormally >> >> And more. >> >> Modified: >> llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp >> >> Modified: llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp?rev=65758&r1=65757&r2=65758&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp >> (original) >> +++ llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Sat >> Feb 28 21:55:12 2009 >> @@ -253,13 +253,11 @@ >> // (allocations OF arrays are ok though), and an allocation of a >> scalar >> // value cannot be decomposed at all. >> uint64_t AllocaSize = TD->getTypePaddedSize(AI- >>> getAllocatedType()); >> - >> - // Do not promote any struct whose size is too big. >> - if (AllocaSize < SRThreshold) >> - continue; >> - >> + >> if ((isa(AI->getAllocatedType()) || >> isa(AI->getAllocatedType())) && >> + // Do not promote any struct whose size is too big. >> + AllocaSize < SRThreshold && >> // Do not promote any struct into more than "32" separate >> vars. >> getNumSAElements(AI->getAllocatedType()) < SRThreshold/4) { >> // Check that all of the users of the allocation are capable >> of being >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From isanbard at gmail.com Sun Mar 1 20:29:29 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 02 Mar 2009 02:29:29 -0000 Subject: [llvm-commits] [llvm] r65795 - /llvm/tags/Apple/llvmCore-2100.1/ Message-ID: <200903020229.n222TTSW015207@zion.cs.uiuc.edu> Author: void Date: Sun Mar 1 20:29:29 2009 New Revision: 65795 URL: http://llvm.org/viewvc/llvm-project?rev=65795&view=rev Log: Copy llvmCore-2100 to llvmCore-2100.1. Added: llvm/tags/Apple/llvmCore-2100.1/ - copied from r65794, llvm/tags/Apple/llvmCore-2100/ From isanbard at gmail.com Sun Mar 1 20:30:08 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 02 Mar 2009 02:30:08 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r65796 - /llvm-gcc-4.2/tags/Apple/llvmgcc42-2100.1/ Message-ID: <200903020230.n222U8U3015235@zion.cs.uiuc.edu> Author: void Date: Sun Mar 1 20:30:08 2009 New Revision: 65796 URL: http://llvm.org/viewvc/llvm-project?rev=65796&view=rev Log: Copy llvmgcc42-2100 to llvmgcc42-2100.1. Added: llvm-gcc-4.2/tags/Apple/llvmgcc42-2100.1/ - copied from r65795, llvm-gcc-4.2/tags/Apple/llvmgcc42-2100/ From sabre at nondot.org Sun Mar 1 20:37:32 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 02 Mar 2009 02:37:32 -0000 Subject: [llvm-commits] [llvm] r65797 - /llvm/trunk/docs/ReleaseNotes.html Message-ID: <200903020237.n222bW79015458@zion.cs.uiuc.edu> Author: lattner Date: Sun Mar 1 20:37:32 2009 New Revision: 65797 URL: http://llvm.org/viewvc/llvm-project?rev=65797&view=rev Log: start translating this into Engrish and organizing it. Modified: llvm/trunk/docs/ReleaseNotes.html Modified: llvm/trunk/docs/ReleaseNotes.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ReleaseNotes.html?rev=65797&r1=65796&r2=65797&view=diff ============================================================================== --- llvm/trunk/docs/ReleaseNotes.html (original) +++ llvm/trunk/docs/ReleaseNotes.html Sun Mar 1 20:37:32 2009 @@ -14,7 +14,7 @@
  14. Introduction
  15. Sub-project Status Update
  16. External Projects Using LLVM 2.5
  17. -
  18. What's New in LLVM?
  19. +
  20. What's New in LLVM 2.5?
  21. Installation Instructions
  22. Portability and Supported Platforms
  23. Known Problems
  24. @@ -64,6 +64,9 @@ interpreter + libffi postalloc scheduler: anti dependence breaking, hazard recognizer? +initial support for debug line numbers when optimization enabled, not useful in + 2.5 but will be for 2.6. + --> @@ -166,7 +169,7 @@ a JVM and a CLI Virtual Machines (Microsoft .NET is an implementation of the CLI) using the Just-In-Time compiler of LLVM.

    -

    Following LLVM 2.5, VMKit has its first release ? that you can find on its +

    Following LLVM 2.5, VMKit has its first release that you can find on its webpage. The release includes bug fixes, cleanup and new features. The major changes are:

    @@ -202,11 +205,8 @@

    -http://pure-lang.googlecode.com/ -

    - -

    -Pure is an algebraic/functional programming language based on term rewriting. +Pure +is an algebraic/functional programming language based on term rewriting. Programs are collections of equations which are used to evaluate expressions in a symbolic fashion. Pure offers dynamic typing, eager and lazy evaluation, lexical closures, a hygienic macro system (also based on term rewriting), @@ -231,16 +231,11 @@

    -http://www.dsource.org/projects/ldc -

    - -

    -I'd like to inform that the LDC project (LLVM D -Compiler) is working with release 2.5 of LLVM. In fact we've required -2.5 in our trunk since the release was branched. -The improvements in 2.5 have fixed a lot of problems with LDC, more -specifically the new inline asm constraints, better debug info -support, general bugfixes :) and better x86-64 support have allowed +LDC is an implementation of +the D Programming Language using the LLVM optimizer and code generator. +LDC project works great with the LLVM 2.5 release. General improvmenets in this +cycle have included new inline asm constraint handling, better debug info +support, general bugfixes, and better x86-64 support. This has allowed some major improvements in LDC, getting us much closer to being as fully featured as the original DMD compiler from DigitalMars.

    @@ -252,17 +247,16 @@
    -

    http://code.roadsend.com/rphp

    - -

    Roadsend PHP is using LLVM for code generation. This is an open source -project. -

    +

    Roadsend PHP (rphp) is an open +source compiler for the PHP programming language that uses LLVM for its +optimizer, JIT, and static compiler. This is a reimplementation of an earlier +project that is now based on the LLVM.

    @@ -284,73 +278,25 @@

    LLVM 2.5 includes several major new capabilities:

      -
    • The code generator now supports arbitrary precision integers. -Types like i33 have long been valid in the LLVM IR, but previously -could only be used with the interpreter. -Now IR using such types can be compiled to native code on all targets. -All operations are supported if the integer is not bigger than twice the -target machine word size. -Simple operations like loads, stores and shifts by a constant amount are -supported for integers of any size. -

    • - - +
    • LLVM 2.5 now uses (and includes) Google Test for unit testing.
    • + +
    • The LLVM native code generator now supports arbitrary precision integers. +Types like i33 have long been valid in the LLVM IR, but were previously +only supported by the interpreter. Note that the C backend still does not +support these.
    • +
    • LLVM 2.5 no longer uses 'bison', so it is easier to build on Windows.
    @@ -368,7 +314,18 @@ includes support for the C, C++, Objective-C, Ada, and Fortran front-ends.

      -
    • ?
    • +
    • In this release, the GCC inliner is completely disabled. Previously the GCC +inliner was used to handle always-inline functions and other cases. This caused +problems with code size growth, and it is completely disabled in this +release.
    • + +
    • llvm-gcc (and LLVM in general) now support code generation for stack +canaries, which is an effective form of buffer overflow +protection. llvm-gcc supports this with the -fstack-protector +command line option (just like GCC). In LLVM IR, you can request code +generation for stack canaries with function attributes. +
    @@ -376,14 +333,52 @@
    -

    New features include:

    +

    LLVM IR has several new features that are used by our existing front-ends and +can be useful if you are writing a front-end for LLVM:

      -
    • ?
    • +
    • The shufflevector instruction +has been generalized to allow different shuffle mask width than its input +vectors. This allows you to use shufflevector to combine two +"<4 x float>" vectors into a "<8 x float>" for example.
    • + +
    • LLVM IR now supports new intrinsics for computing and acting on overflow of integer operations. This allows +efficient code generation for languages that must trap or throw an exception on +overflow. While these intrinsics work on all targets, they only generate +efficient code on X86 so far.
    • + +
    • LLVM IR now supports a new private +linkage type to produce labels that are stripped by the assembler before it +produces a .o file (thus they are invisible to the linker).
    • + +
    • LLVM IR supports two new attributes for better alias analysis. The noalias attribute can now be used on the +return value of a function to indicate that it returns new memory (e.g. +'malloc', 'calloc', etc).
    • + +
    • The new nocapture attribute can be +used on pointer arguments to functions that access through but do not return the +pointer in a data structure that out lives the call (e.g. 'strlen', 'memcpy', +and many others). The simplifylibcalls pass applies these attributes to +standard libc functions.
    • + +
    • The parser for ".ll" files in lib/AsmParser is now completely rewritten as a +recursive descent parser. This parser produces better error messages (including +caret diagnostics) is less fragile (less likely to crash on strange things) does +not leak memory, is more efficient, and eliminates LLVM's last use of the +'bison' tool.
    • + +
    • Debug information representation and manipulation internals have been + consolidated to use a new set of classes in + llvm/Analysis/DebugInfo.h classes. These routines are more + efficient, robust, and extensible and replace the older mechanisms. + llvm-gcc, clang, and the code generator now use them to create and process + debug information.
    @@ -401,7 +396,22 @@
      -
    • ?
    • +
    • The loop optimizer now improves floating point induction variables in +several ways, including adding shadow induction variables to avoid +"integer <-> floating point" conversions in loops when safe.
    • + +
    • The "-mem2reg" pass is now much faster on code with huge basic blocks.
    • + +
    • The "-jump-threading" pass is more powerful: it is iterative + and handles threading based on values with fully and partially redundant + loads.
    • + +
    • The "-memdep" memory dependence analysis pass (used by GVN and memcpyopt) is + both faster and more aggressive.
    • + +
    • The "-scalarrepl" scalar replacement of aggregates pass is more aggressive + about promoting unions to registers.
    • +
    @@ -430,10 +440,40 @@
  25. ?
  26. + +how to write a backend doc docs/WritingAnLLVMBackend.html +asmprinters seperate from targets for jits +fastisel + exception handling +vector widening <3 x float> -> <4 x float> +PBQP register allocator now supports register coalescing. + +
    + + + +
    +

    New features of the X86 target include: +

    + +
      +non-zero __builtin_return_address values on X86. +vector shift support + X86 backend. +x86 JIT now detects core i7 and atom, autoconfiguring itself appropriately. +x86-64 now uses red zone (unless -mno-red-zone option is specified). +x86 backend GS segment -> addr space 256 (r62980) +X86 backend now supports -disable-mmx. +JIT supports exceptions on linux/x86-64 and linux/x86-64. +JIT TLS support on x86-32 but not x86-64. +
    + + +
    @@ -560,7 +600,7 @@
      -
    • ?
    • +
    • llvm-gcc defaults to -fno-math-errno on all x86 targets.
    @@ -666,7 +706,7 @@ bugs due to lack of support for the 'u' inline assembly constraint and X87 floating point inline assembly.
  27. The X86-64 backend does not yet support the LLVM IR instruction - va_arg. Currently, the llvm-gcc front-end supports variadic + va_arg. Currently, the llvm-gcc and front-ends support variadic argument constructs on X86-64 by lowering them manually.
  28. From sabre at nondot.org Sun Mar 1 21:24:13 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 02 Mar 2009 03:24:13 -0000 Subject: [llvm-commits] [llvm] r65799 - /llvm/trunk/docs/ReleaseNotes.html Message-ID: <200903020324.n223ODQG017014@zion.cs.uiuc.edu> Author: lattner Date: Sun Mar 1 21:24:11 2009 New Revision: 65799 URL: http://llvm.org/viewvc/llvm-project?rev=65799&view=rev Log: more englishification Modified: llvm/trunk/docs/ReleaseNotes.html Modified: llvm/trunk/docs/ReleaseNotes.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ReleaseNotes.html?rev=65799&r1=65798&r2=65799&view=diff ============================================================================== --- llvm/trunk/docs/ReleaseNotes.html (original) +++ llvm/trunk/docs/ReleaseNotes.html Sun Mar 1 21:24:11 2009 @@ -419,7 +419,7 @@
    @@ -429,27 +429,34 @@ it run faster:

      -
    • The type legalization logic has been completely rewritten, and is now -more powerful (it supports arbitrary precision integer types for example) -and hopefully more correct. -The type legalizer converts operations on types that are not natively -supported by the target machine into equivalent code sequences that only use -natively supported types. -The old type legalizer is still available and will be used if --disable-legalize-types is passed to llc. +
    • The Writing an LLVM Compiler +Backend document has been greatly expanded and is substantially more +complete.
    • + +
    • The SelectionDAG type legalization logic has been completely rewritten, is +now more powerful (it supports arbitrary precision integer types for example), +and more correct in several corner cases. The type legalizer converts +operations on types that are not natively supported by the target machine into +equivalent code sequences that only use natively supported types. The old type +legalizer is still available (for now) and will be used if +-disable-legalize-types is passed to the code generator.
    • -
    • ?
    • - - -how to write a backend doc docs/WritingAnLLVMBackend.html -asmprinters seperate from targets for jits -fastisel + exception handling -vector widening <3 x float> -> <4 x float> -PBQP register allocator now supports register coalescing. - +
    • The code generator now supports widening illegal vectors to larger legal +ones (for example, converting operations on <3 x float> to work on +<4 x float>) which is very important for common graphics +applications.
    • + +
    • The assembly printers for each target are now split out into their own +libraries that are separate from the main code generation logic. This reduces +code size of JIT compilers by not requiring them to be linked in.
    • + +
    • The 'fast' instruction selection path (used at -O0 and for fast JIT + compilers) now supports accelerating codegen for code that uses exception + handling constructs.
    • + +
    • The optional PBQP register allocator now supports register coalescing.
    -
    @@ -462,14 +469,34 @@

      -non-zero __builtin_return_address values on X86. -vector shift support + X86 backend. -x86 JIT now detects core i7 and atom, autoconfiguring itself appropriately. -x86-64 now uses red zone (unless -mno-red-zone option is specified). -x86 backend GS segment -> addr space 256 (r62980) -X86 backend now supports -disable-mmx. -JIT supports exceptions on linux/x86-64 and linux/x86-64. -JIT TLS support on x86-32 but not x86-64. +
    • The "llvm.returnaddress" +intrinsic (which is used to implement "__builtin_return_address") now supports +non-zero stack depths on X86.
    • + +
    • The X86 backend now supports code generation of vector shift operations +using SSE instructions.
    • + +
    • X86-64 code generation now takes advantage of red zone (unless +-mno-red-zone option is specified).
    • + +
    • The X86 backend now supports using address space #256 in LLVM IR as a way of +performing memory references off the GS segment register. This allows a +front-end to take advantage of very low-level programming techniques when +targetting X86 CPUs. See test/CodeGen/X86/movgs.ll for a simple example.
    • + +
    • The X86 backend now supports a -disable-mmx command line option to + prevent use of MMX even on chips that support it. This is important for cases + where code does not contain the proper "llvm.x86.mmx.emms" intrinsics.
    • + +
    • The X86 JIT now detects the new Intel "Core i7" and Atom" chips, + auto-configuring itself appropriately for the features of these chips.
    • + +
    • The JIT now supports exception handling constructs on Linux/X86-64 and + Darwin/x86-64.
    • +
    • The JIT supports Thread Local Storage (TLS) on Linux/X86-32 but not yet on + X86-64.
    @@ -502,7 +529,7 @@
  29. Passing/returning aggregate types to/from functions.
  30. Variable arguments.
  31. Indirect function calls.
  32. -
  33. Interrupts/prgrams.
  34. +
  35. Interrupts/programs.
  36. Debug info.
  37. @@ -512,21 +539,6 @@ - -
    -

    New target-specific features include: -

    - -
      -
    • ?
    • -
    - -
    - - - @@ -600,7 +612,7 @@
      -
    • llvm-gcc defaults to -fno-math-errno on all x86 targets.
    • +
    • llvm-gcc defaults to -fno-math-errno on all X86 targets.
    From sabre at nondot.org Sun Mar 1 21:24:41 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 02 Mar 2009 03:24:41 -0000 Subject: [llvm-commits] [llvm] r65800 - /llvm/trunk/docs/ReleaseNotes.html Message-ID: <200903020324.n223Ofv4017041@zion.cs.uiuc.edu> Author: lattner Date: Sun Mar 1 21:24:41 2009 New Revision: 65800 URL: http://llvm.org/viewvc/llvm-project?rev=65800&view=rev Log: remove empty section Modified: llvm/trunk/docs/ReleaseNotes.html Modified: llvm/trunk/docs/ReleaseNotes.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ReleaseNotes.html?rev=65800&r1=65799&r2=65800&view=diff ============================================================================== --- llvm/trunk/docs/ReleaseNotes.html (original) +++ llvm/trunk/docs/ReleaseNotes.html Sun Mar 1 21:24:41 2009 @@ -585,22 +585,6 @@ - -
    -

    New features include: -

    - -
      -
    • ?
    • - -
    - -
    - - - From gordonhenriksen at mac.com Sun Mar 1 21:46:48 2009 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Mon, 02 Mar 2009 03:46:48 -0000 Subject: [llvm-commits] [llvm] r65801 - in /llvm/trunk/runtime: GC/ Makefile Message-ID: <200903020346.n223kmT6018412@zion.cs.uiuc.edu> Author: gordon Date: Sun Mar 1 21:46:48 2009 New Revision: 65801 URL: http://llvm.org/viewvc/llvm-project?rev=65801&view=rev Log: Drop toy GC runtime. Removed: llvm/trunk/runtime/GC/ Modified: llvm/trunk/runtime/Makefile Modified: llvm/trunk/runtime/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/runtime/Makefile?rev=65801&r1=65800&r2=65801&view=diff ============================================================================== --- llvm/trunk/runtime/Makefile (original) +++ llvm/trunk/runtime/Makefile Sun Mar 1 21:46:48 2009 @@ -11,7 +11,7 @@ include $(LEVEL)/Makefile.config ifneq ($(wildcard $(LLVMGCC)),) -PARALLEL_DIRS := libprofile GC +PARALLEL_DIRS := libprofile else PARALLEL_DIRS := install all :: From gordonhenriksen at mac.com Sun Mar 1 21:47:20 2009 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Mon, 02 Mar 2009 03:47:20 -0000 Subject: [llvm-commits] [llvm] r65802 - /llvm/trunk/docs/GarbageCollection.html Message-ID: <200903020347.n223lKKr018441@zion.cs.uiuc.edu> Author: gordon Date: Sun Mar 1 21:47:20 2009 New Revision: 65802 URL: http://llvm.org/viewvc/llvm-project?rev=65802&view=rev Log: Make some improvements to the GC docs. Also, drop reference to the half-baked runtime interface. Modified: llvm/trunk/docs/GarbageCollection.html Modified: llvm/trunk/docs/GarbageCollection.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/GarbageCollection.html?rev=65802&r1=65801&r2=65802&view=diff ============================================================================== --- llvm/trunk/docs/GarbageCollection.html (original) +++ llvm/trunk/docs/GarbageCollection.html Sun Mar 1 21:47:20 2009 @@ -20,19 +20,15 @@
    1. Introduction
    2. -
    3. Using the collectors +
    4. Getting started
    5. @@ -51,20 +47,7 @@ -
    6. Recommended runtime interface - -
    7. - -
    8. Implementing a collector plugin +
    9. Compiler plugin interface
      • Overview of available features
      • Computing stack maps
      • @@ -145,7 +128,7 @@
        @@ -168,174 +151,234 @@ support a broad class of garbage collected languages including Scheme, ML, Java, C#, Perl, Python, Lua, Ruby, other scripting languages, and more.

        -

        However, LLVM does not itself implement a garbage collector. This is because -collectors are tightly coupled to object models, and LLVM is agnostic to object -models. Since LLVM is agnostic to object models, it would be inappropriate for -LLVM to dictate any particular collector. Instead, LLVM provides a framework for -garbage collector implementations in two manners:

        +

        However, LLVM does not itself provide a garbage collector—this should +be part of your language's runtime library. LLVM provides a framework for +compile time code generation plugins. The role of these +plugins is to generate code and data structures which conforms to the binary +interface specified by the runtime library. This is similar to the +relationship between LLVM and DWARF debugging info, for example. The +difference primarily lies in the lack of an established standard in the domain +of garbage collection—thus the plugins.

        + +

        The aspects of the binary interface with which LLVM's GC support is +concerned are:

        + +
          +
        • Creation of GC-safe points within code where collection is allowed to + execute safely.
        • +
        • Definition of a stack frame descriptor. For each safe point in the code, + a frame descriptor maps where object references are located within the + frame so that the GC may traverse and perhaps update them.
        • +
        • Write barriers when storing object references within the heap. These + are commonly used to optimize incremental scans.
        • +
        • Emission of read barriers when loading object references. These are + useful for interoperating with concurrent collectors.
        • +
        + +

        There are additional areas that LLVM does not directly address:

          -
        • At compile time with collector plugins for - the compiler. Collector plugins have ready access to important garbage - collector algorithms. Leveraging these tools, it is straightforward to - emit type-accurate stack maps for your runtime in as little as ~100 lines of - C++ code.
        • - -
        • At runtime with suggested runtime - interfaces, which allow front-end compilers to support a range of - collection runtimes.
        • +
        • Registration of global roots.
        • +
        • Discovery or registration of stack frame descriptors.
        • +
        • The functions used by the program to allocate memory, trigger a + collection, etc.
        +

        In general, LLVM's support for GC does not include features which can be +adequately addressed with other features of the IR and does not specify a +particular binary interface. On the plus side, this means that you should be +able to integrate LLVM with an existing runtime. On the other hand, it leaves +a lot of work for the developer of a novel language. However, it's easy to get +started quickly and scale up to a more sophisticated implementation as your +compiler matures.

        +
        -

        In general, using a collector implies:

        +

        Using a GC with LLVM implies many things, for example:

          -
        • Emitting compatible code, including initialization in the main - program if necessary.
        • -
        • Loading a compiler plugin if the collector is not statically linked with - your compiler. For llc, use the -load option.
        • -
        • Selecting the collection algorithm by applying the gc "..." - attribute to your garbage collected functions, or equivalently with - the setGC method.
        • -
        • Linking your final executable with the garbage collector runtime.
        • +
        • Write a runtime library or find an existing one which implements a GC + heap.
            +
          1. Implement a memory allocator.
          2. +
          3. Design a binary interface for frame descriptors, used to identify + references within a stack frame.*
          4. +
          5. Implement a stack crawler to discover functions on the call stack.*
          6. +
          7. Implement a registry for global roots.
          8. +
          9. Design a binary interface for type descriptors, used to map references + within heap objects.
          10. +
          11. Implement a collection routine bringing together all of the above.
          12. +
        • +
        • Emit compatible code from your compiler.
            +
          • Initialization in the main function.
          • +
          • Use the gc "..." attribute to enable GC code generation + (or F.setGC("...")).
          • +
          • Use @llvm.gcroot to mark stack roots.
          • +
          • Use @llvm.gcread and/or @llvm.gcwrite to + manipulate GC references, if necessary.
          • +
          • Allocate memory using the GC allocation routine provided by the + runtime library.
          • +
          • Generate type descriptors according to your runtime's binary interface.
          • +
        • +
        • Write a compiler plugin to interface LLVM with the runtime library.*
            +
          • Lower @llvm.gcread and @llvm.gcwrite to appropriate + code sequences.*
          • +
          • Generate stack maps according to the runtime's binary interface.*
          • +
        • +
        • Load the plugin into the compiler. Use llc -load or link the + plugin statically with your language's compiler.*
        • +
        • Link program executables with the runtime.
        -

        This table summarizes the available runtimes.

        - - - - - - - - - - - - - - - - - - - - - - - - - - -
        Collectorgc attributeLinkagegcrootgcreadgcwrite
        SemiSpacegc "shadow-stack"TODO FIXMErequiredoptionaloptional
        Ocamlgc "ocaml"provided by ocamloptrequiredoptionaloptional
        - -

        The sections for Collection intrinsics and -Recommended runtime interface detail the interfaces that -collectors may require user programs to utilize.

        +

        To help with several of these tasks (those indicated with a *), LLVM +includes a highly portable, built-in ShadowStack code generator. It is compiled +into llc and works even with the interpreter and C backends.

        -
        - Collector *llvm::createShadowStackCollector(); -
        -
        -

        The ShadowStack backend is invoked with the gc "shadow-stack" -function attribute. -Unlike many collectors which rely on a cooperative code generator to generate -stack maps, this algorithm carefully maintains a linked list of stack root -descriptors [Henderson2002]. This so-called "shadow -stack" mirrors the machine stack. Maintaining this data structure is slower -than using stack maps, but has a significant portability advantage because it -requires no special support from the target code generator.

        - -

        The ShadowStack collector does not use read or write barriers, so the user -program may use load and store instead of llvm.gcread -and llvm.gcwrite.

        +

        To turn the shadow stack on for your functions, first call:

        + +
        F.setGC("shadow-stack");
        + +

        for each function your compiler emits. Since the shadow stack is built into +LLVM, you do not need to load a plugin.

        -

        ShadowStack is a code generator plugin only. It must be paired with a -compatible runtime.

        +

        Your compiler must also use @llvm.gcroot as documented. +Don't forget to create a root for each intermediate value that is generated +when evaluating an expression. In h(f(), g()), the result of +f() could easily be collected if evaluating g() triggers a +collection.

        + +

        There's no need to use @llvm.gcread and @llvm.gcwrite over +plain load and store for now. You will need them when +switching to a more advanced GC.

        -

        The SemiSpace runtime implements the suggested -runtime interface and is compatible with the ShadowStack backend.

        - -

        SemiSpace is a very simple copying collector. When it starts up, it -allocates two blocks of memory for the heap. It uses a simple bump-pointer -allocator to allocate memory from the first block until it runs out of space. -When it runs out of space, it traces through all of the roots of the program, -copying blocks to the other half of the memory space.

        - -

        This runtime is highly experimental and has not been used in a real project. -Enhancements would be welcomed.

        +

        The shadow stack doesn't imply a memory allocation algorithm. A semispace +collector or building atop malloc are great places to start, and can +be implemented with very little code.

        + +

        When it comes time to collect, however, your runtime needs to traverse the +stack roots, and for this it needs to integrate with the shadow stack. Luckily, +doing so is very simple. (This code is heavily commented to help you +understand the data structure, but there are only 20 lines of meaningful +code.)

        +
        /// @brief A constant shadow stack frame descriptor. The compiler emits one of
        +///        these for each function.
        +/// 
        +/// Storage of metadata values is elided if the %meta parameter to @llvm.gcroot
        +/// is null.
        +struct FrameMap {
        +  int32_t NumRoots;    //< Number of roots in stack frame.
        +  int32_t NumMeta;     //< Number of metadata descriptors. May be < NumRoots.
        +  const void *Meta[0]; //< Metadata for each root.
        +};
        +
        +/// @brief A link in the dynamic shadow stack. One of these is embedded in the
        +///        stack frame of each function on the call stack.
        +struct StackEntry {
        +  StackEntry *Next;    //< Link to next stack entry (the caller's).
        +  const FrameMap *Map; //< Pointer to constant FrameMap.
        +  void *Roots[0];      //< Stack roots (in-place array).
        +};
        +
        +/// @brief The head of the singly-linked list of StackEntries. Functions push
        +///        and pop onto this in their prologue and epilogue.
        +/// 
        +/// Since there is only a global list, this technique is not threadsafe.
        +StackEntry *llvm_gc_root_chain;
        +
        +/// @brief Calls Visitor(root, meta) for each GC root on the stack.
        +///        root and meta are exactly the values passed to
        +///        @llvm.gcroot.
        +/// 
        +/// Visitor could be a function to recursively mark live objects. Or it
        +/// might copy them to another heap or generation.
        +/// 
        +/// @param Visitor A function to invoke for every GC root on the stack.
        +void visitGCRoots(void (*Visitor)(void **Root, const void *Meta)) {
        +  for (StackEntry *R = llvm_gc_root_chain; R; R = R->Next) {
        +    unsigned i = 0;
        +    
        +    // For roots [0, NumMeta), the metadata pointer is in the FrameMap.
        +    for (unsigned e = R->Map->NumMeta; i != e; ++i)
        +      Visitor(&R->Roots[i], R->Map->Meta[i]);
        +    
        +    // For roots [NumMeta, NumRoots), the metadata pointer is null.
        +    for (unsigned e = R->Map->NumRoots; i != e; ++i)
        +      Visitor(&R->Roots[i], NULL);
        +  }
        +}
        + -
        - Collector *llvm::createOcamlCollector(); -
        -
        -

        The ocaml backend is invoked with the gc "ocaml" function attribute. -It supports the -Objective Caml language runtime by emitting -a type-accurate stack map in the form of an ocaml 3.10.0-compatible frametable. -The linkage requirements are satisfied automatically by the ocamlopt -compiler when linking an executable.

        - -

        The ocaml collector does not use read or write barriers, so the user program -may use load and store instead of llvm.gcread and -llvm.gcwrite.

        +

        Unlike many GC algorithms which rely on a cooperative code generator to +generate stack maps, this algorithm carefully maintains a linked list of stack +root descriptors [Henderson2002]. This so-called +"shadow stack" mirrors the machine stack. Maintaining this data structure is +slower than using stack maps, but has a significant portability advantage +because it requires no special support from the target code generator.

        -
        +

        The tradeoff for this simplicity and portability is:

        +
          +
        • High overhead per function call.
        • +
        • Not thread-safe.
        • +
        + +

        Still, it's an easy way to get started.

        + +

    This section describes the garbage collection facilities provided by the -LLVM intermediate representation.

    - -

    These facilities are limited to those strictly necessary for compilation. -They are not intended to be a complete interface to any garbage collector. -Notably, heap allocation is not among the supplied primitives. A user program -will also need to interface with the runtime, using either the -suggested runtime interface or another interface -specified by the runtime.

    +LLVM intermediate representation. The exact behavior +of these IR features is specified by the binary interface implemented by a +code generation plugin, not by this document.

    + +

    These facilities are limited to those strictly necessary; they are not +intended to be a complete interface to any garbage collector. A program will +need to interface with the GC library using the facilities provided by that +program.

    @@ -345,17 +388,22 @@
    - define ty @name(...) gc "collector" { ... + define ty @name(...) gc "name" { ...
    -

    The gc function attribute is used to specify the desired collector -algorithm to the compiler. It is equivalent to specifying the collector name -programmatically using the setGC method of Function.

    +

    The gc function attribute is used to specify the desired GC style +to the compiler. Its programmatic equivalent is the setGC method of +Function.

    + +

    Setting gc "name" on a function triggers a search for a +matching code generation plugin "name"; it is that plugin which defines +the exact nature of the code generated to support GC. If none is found, the +compiler will raise an error.

    -

    Specifying the collector on a per-function basis allows LLVM to link together -programs that use different garbage collection algorithms.

    +

    Specifying the GC style on a per-function basis allows LLVM to link together +programs that use different garbage collection algorithms (or none at all).

    @@ -370,13 +418,31 @@
    -

    The llvm.gcroot intrinsic is used to inform LLVM of a pointer -variable on the stack. The first argument must be a value referring to an alloca instruction +

    The llvm.gcroot intrinsic is used to inform LLVM that a stack +variable references an object on the heap and is to be tracked for garbage +collection. The exact impact on generated code is specified by a compiler plugin.

    + +

    A compiler which uses mem2reg to raise imperative code using alloca +into SSA form need only add a call to @llvm.gcroot for those variables +which a pointers into the GC heap.

    + +

    It is also important to mark intermediate values with llvm.gcroot. +For example, consider h(f(), g()). Beware leaking the result of +f() in the case that g() triggers a collection.

    + +

    The first argument must be a value referring to an alloca instruction or a bitcast of an alloca. The second contains a pointer to metadata that should be associated with the pointer, and must be a constant or global value address. If your target collector uses tags, use a null pointer for metadata.

    +

    The %metadata argument can be used to avoid requiring heap objects +to have 'isa' pointers or tag bits. [Appel89, Goldberg91, Tolmach94] If +specified, its value will be tracked along with the location of the pointer in +the stack frame.

    +

    Consider the following fragment of Java code:

    @@ -449,6 +515,11 @@
         ;; Compute the derived pointer.
         %derived = getelementptr %object, i32 0, i32 2, i32 %n
    +

    The use of these intrinsics is naturally optional if the target GC does +require the corresponding barrier. If so, the GC plugin will replace the +intrinsic calls with the corresponding load or store +instruction if they are used.

    +
    @@ -464,16 +535,13 @@

    For write barriers, LLVM provides the llvm.gcwrite intrinsic function. It has exactly the same semantics as a non-volatile store to -the derived pointer (the third argument).

    +the derived pointer (the third argument). The exact code generated is specified +by a compiler plugin.

    Many important algorithms require write barriers, including generational and concurrent collectors. Additionally, write barriers could be used to implement reference counting.

    -

    The use of this intrinsic is optional if the target collector does use -write barriers. If so, the collector will replace it with the corresponding -store.

    - @@ -489,124 +557,15 @@

    For read barriers, LLVM provides the llvm.gcread intrinsic function. It has exactly the same semantics as a non-volatile load from the -derived pointer (the second argument).

    +derived pointer (the second argument). The exact code generated is specified by +a compiler plugin.

    Read barriers are needed by fewer algorithms than write barriers, and may have a greater performance impact since pointer reads are more frequent than writes.

    -

    As with llvm.gcwrite, a target collector might not require the use -of this intrinsic.

    - - - - - - - -
    - -

    LLVM specifies the following recommended runtime interface to the garbage -collection at runtime. A program should use these interfaces to accomplish the -tasks not supported by the intrinsics.

    - -

    Unlike the intrinsics, which are integral to LLVM's code generator, there is -nothing unique about these interfaces; a front-end compiler and runtime are free -to agree to a different specification.

    - -

    Note: This interface is a work in progress.

    - -
    - - - - -
    - -
    - void llvm_gc_initialize(unsigned InitialHeapSize); -
    - -

    -The llvm_gc_initialize function should be called once before any other -garbage collection functions are called. This gives the garbage collector the -chance to initialize itself and allocate the heap. The initial heap size to -allocate should be specified as an argument. -

    -
    - - - -
    - -
    - void *llvm_gc_allocate(unsigned Size); -
    - -

    The llvm_gc_allocate function is a global function defined by the -garbage collector implementation to allocate memory. It returns a -zeroed-out block of memory of the specified size, sufficiently aligned to store -any object.

    - -
    - - - - -
    - -
    - void llvm_gc_collect(); -
    - -

    -The llvm_gc_collect function is exported by the garbage collector -implementations to provide a full collection, even when the heap is not -exhausted. This can be used by end-user code as a hint, and may be ignored by -the garbage collector. -

    - -
    - - - - -
    -
    - void llvm_cg_walk_gcroots(void (*FP)(void **Root, void *Meta)); -
    - -

    -The llvm_cg_walk_gcroots function is a function provided by the code -generator that iterates through all of the GC roots on the stack, calling the -specified function pointer with each record. For each GC root, the address of -the pointer and the meta-data (from the llvm.gcroot intrinsic) are provided. -

    -
    - - - - -
    -TODO -
    - -
    Implementing a collector plugin @@ -628,8 +587,9 @@

    This is not the appropriate place to implement a garbage collected heap or a garbage collector itself. That code should exist in the language's runtime -library. The compiler plugin is responsible for generating code which is -compatible with that runtime library.

    +library. The compiler plugin is responsible for generating code which +conforms to the binary interface defined by library, most essentially the +stack map.

    To subclass llvm::GCStrategy and register it with the compiler:

    @@ -1203,7 +1163,7 @@

    Since AsmWriter and CodeGen are separate components of LLVM, a separate abstract base class and registry is provided for printing assembly code, the -GCMetadaPrinter and GCMetadaPrinterRegistry. The AsmWriter +GCMetadaPrinter and GCMetadataPrinterRegistry. The AsmWriter will look for such a subclass if the GCStrategy sets UsesMetadata:

    @@ -1339,70 +1299,6 @@ - - -
    - -

    Implementing a garbage collector for LLVM is fairly straightforward. The -LLVM garbage collectors are provided in a form that makes them easy to link into -the language-specific runtime that a language front-end would use. They require -functionality from the language-specific runtime to get information about where pointers are located in heap objects.

    - -

    The implementation must include the -llvm_gc_allocate and -llvm_gc_collect functions. To do this, it will -probably have to trace through the roots -from the stack and understand the GC descriptors -for heap objects. Luckily, there are some example -implementations available. -

    -
    - - - - - -
    -

    -The three most common ways to keep track of where pointers live in heap objects -are (listed in order of space overhead required):

    - -
      -
    1. In languages with polymorphic objects, pointers from an object header are -usually used to identify the GC pointers in the heap object. This is common for -object-oriented languages like Self, Smalltalk, Java, or C#.
    2. - -
    3. If heap objects are not polymorphic, often the "shape" of the heap can be -determined from the roots of the heap or from some other meta-data [Appel89, Goldberg91, Tolmach94]. In this case, the garbage collector can -propagate the information around from meta data stored with the roots. This -often eliminates the need to have a header on objects in the heap. This is -common in the ML family.
    4. - -
    5. If all heap objects have pointers in the same locations, or pointers can be -distinguished just by looking at them (e.g., the low order bit is clear), no -book-keeping is needed at all. This is common for Lisp-like languages.
    6. -
    - -

    The LLVM garbage collectors are capable of supporting all of these styles of -language, including ones that mix various implementations. To do this, it -allows the source-language to associate meta-data with the stack roots, and the heap tracing routines can propagate the -information. In addition, LLVM allows the front-end to extract GC information -in any form from a specific object pointer (this supports situations #1 and #3). -

    - -
    - - - - From isanbard at gmail.com Sun Mar 1 22:28:20 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 02 Mar 2009 04:28:20 -0000 Subject: [llvm-commits] [llvm] r65803 - /llvm/trunk/docs/ReleaseNotes.html Message-ID: <200903020428.n224SMaC019778@zion.cs.uiuc.edu> Author: void Date: Sun Mar 1 22:28:18 2009 New Revision: 65803 URL: http://llvm.org/viewvc/llvm-project?rev=65803&view=rev Log: - Use "real-world applications" instead of just "real applications". - Verification Fixes. Modified: llvm/trunk/docs/ReleaseNotes.html Modified: llvm/trunk/docs/ReleaseNotes.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ReleaseNotes.html?rev=65803&r1=65802&r2=65803&view=diff ============================================================================== --- llvm/trunk/docs/ReleaseNotes.html (original) +++ llvm/trunk/docs/ReleaseNotes.html Sun Mar 1 22:28:18 2009 @@ -81,12 +81,12 @@

    The LLVM 2.5 distribution currently consists of code from the core LLVM -repository (which roughly includes the LLVM optimizers, code generators and -supporting tools) and the llvm-gcc repository. In addition to this code, the -LLVM Project includes other sub-projects that are in development. The two which -are the most actively developed are the Clang Project and -the VMKit Project. -

    +repository —which roughly includes the LLVM optimizers, code generators +and supporting tools — and the llvm-gcc repository. In addition to this +code, the LLVM Project includes other sub-projects that are in development. The +two which are the most actively developed are the Clang +Project and the VMKit Project. +
    @@ -99,15 +99,16 @@

    The Clang project is an effort to build -a set of new 'LLVM native' front-end technologies for the LLVM optimizer -and code generator. While Clang is not included in the LLVM 2.5 release, it -is continuing to make major strides forward in all areas. Its C and Objective-C +a set of new 'LLVM native' front-end technologies for the LLVM optimizer and +code generator. While Clang is not included in the LLVM 2.5 release, it is +continuing to make major strides forward in all areas. Its C and Objective-C parsing and code generation support is now very solid. For example, it is -capable of successfully building many real applications for X86-32 and X86-64, +capable of successfully building many real-world applications for X86-32 +andX86-64, including the FreeBSD -kernel. C++ is also making incredible progress, and work -on templates has recently started.

    +kernel. C++ is also +making incredible progress, +and work on templates has recently started.

    While Clang is not yet production quality, it is progressing very nicely and is quite usable for building many C and Objective-C applications. If you are @@ -127,6 +128,7 @@

  38. Objective-C support is significantly improved beyond LLVM 2.4, supporting many features, such as Objective-C Garbage Collection.
  39. Many many bugs are fixed and many features have been added.
  40. +
    @@ -411,7 +413,6 @@
  41. The "-scalarrepl" scalar replacement of aggregates pass is more aggressive about promoting unions to registers.
  42. - @@ -519,7 +520,6 @@
  43. Support for integer arrays.
  44. Compiler can now emit libcalls for operations not support by m/c insns.
  45. Support for both data and rom address spaces.
  46. -

    Things not yet supported:

    @@ -531,7 +531,6 @@
  47. Indirect function calls.
  48. Interrupts/programs.
  49. Debug info.
  50. -
    @@ -607,6 +606,7 @@
  51. ?
  52. +
    • ?
    From isanbard at gmail.com Sun Mar 1 22:28:58 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 02 Mar 2009 04:28:58 -0000 Subject: [llvm-commits] [llvm] r65804 - /llvm/trunk/docs/ReleaseNotes.html Message-ID: <200903020428.n224Swv0019807@zion.cs.uiuc.edu> Author: void Date: Sun Mar 1 22:28:57 2009 New Revision: 65804 URL: http://llvm.org/viewvc/llvm-project?rev=65804&view=rev Log: Change to

    . Modified: llvm/trunk/docs/ReleaseNotes.html Modified: llvm/trunk/docs/ReleaseNotes.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ReleaseNotes.html?rev=65804&r1=65803&r2=65804&view=diff ============================================================================== --- llvm/trunk/docs/ReleaseNotes.html (original) +++ llvm/trunk/docs/ReleaseNotes.html Sun Mar 1 22:28:57 2009 @@ -86,7 +86,7 @@ code, the LLVM Project includes other sub-projects that are in development. The two which are the most actively developed are the Clang Project and the VMKit Project. - +