From evan.cheng at apple.com Mon Sep 29 00:35:57 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 29 Sep 2008 05:35:57 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r56777 - /llvm-gcc-4.2/trunk/gcc/config/i386/i386.c Message-ID: <200809290535.m8T5Zvjd002720@zion.cs.uiuc.edu> Author: evancheng Date: Mon Sep 29 00:35:55 2008 New Revision: 56777 URL: http://llvm.org/viewvc/llvm-project?rev=56777&view=rev Log: Revert part of 56738 which changes the semantics of __builtin_ia32_psrldqi128 and __builtin_ia32_pslldqi128. Modified: llvm-gcc-4.2/trunk/gcc/config/i386/i386.c Modified: llvm-gcc-4.2/trunk/gcc/config/i386/i386.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/i386.c?rev=56777&r1=56776&r2=56777&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/i386/i386.c (original) +++ llvm-gcc-4.2/trunk/gcc/config/i386/i386.c Mon Sep 29 00:35:55 2008 @@ -18178,17 +18178,6 @@ mode1 = insn_data[icode].operand[1].mode; mode2 = insn_data[icode].operand[2].mode; - /* APPLE LOCAL begin 591583 */ - if (! CONST_INT_P (op1)) - { - error ("shift must be an immediate"); - return const0_rtx; - } - /* The _mm_srli_si128/_mm_slli_si128 primitives are defined with - a byte-shift count; inside of GCC, we prefer to specify the - width of a shift in bits. */ - op1 = gen_rtx_CONST_INT (SImode, INTVAL (op1) * 8); - /* APPLE LOCAL end 591583 */ if (! (*insn_data[icode].operand[1].predicate) (op0, mode1)) { op0 = copy_to_reg (op0); From isanbard at gmail.com Mon Sep 29 02:12:24 2008 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 29 Sep 2008 07:12:24 -0000 Subject: [llvm-commits] [llvm] r56778 - /llvm/tags/Apple/llvmCore-2072/ Message-ID: <200809290712.m8T7COCd005436@zion.cs.uiuc.edu> Author: void Date: Mon Sep 29 02:12:23 2008 New Revision: 56778 URL: http://llvm.org/viewvc/llvm-project?rev=56778&view=rev Log: Creating llvmCore-2072 branch Added: llvm/tags/Apple/llvmCore-2072/ - copied from r56777, llvm/trunk/ From isanbard at gmail.com Mon Sep 29 02:12:31 2008 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 29 Sep 2008 07:12:31 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r56779 - /llvm-gcc-4.2/tags/Apple/llvmgcc42-2072/ Message-ID: <200809290712.m8T7CVtp005449@zion.cs.uiuc.edu> Author: void Date: Mon Sep 29 02:12:31 2008 New Revision: 56779 URL: http://llvm.org/viewvc/llvm-project?rev=56779&view=rev Log: Creating llvmgcc42-2072 branch Added: llvm-gcc-4.2/tags/Apple/llvmgcc42-2072/ - copied from r56778, llvm-gcc-4.2/trunk/ From baldrick at free.fr Mon Sep 29 02:25:32 2008 From: baldrick at free.fr (Duncan Sands) Date: Mon, 29 Sep 2008 09:25:32 +0200 Subject: [llvm-commits] [llvm] r56704 - in /llvm/trunk: include/llvm/ lib/AsmParser/ lib/Bitcode/Reader/ lib/Transforms/IPO/ lib/Transforms/Scalar/ lib/VMCore/ In-Reply-To: <200809262253.m8QMr8A4018093@zion.cs.uiuc.edu> References: <200809262253.m8QMr8A4018093@zion.cs.uiuc.edu> Message-ID: <200809290925.32325.baldrick@free.fr> Hi Devang, > Return attributes use 0 as the index. > Function attributes use ~0U as the index. attributes are stored in order of the (unsigned) index. Lookup traverses the list looking for the index. So using ~0U means looking up function attributes may be particularly slow. Since these are the attributes that are probably looked up most often, I suggest either making Index signed, so ~0U=-1 will come first, or special casing ~0U lookup. Ciao, Duncan. > + //FIXME : In 3.0, stop accepting zext, sext and inreg as optional function > + //attributes. Does this mean that return value attributes are now placed next to the return type and not at the end of the function declaration, but you're accepting them in both positions for the moment? > - std::vector().swap(Attributes); > + std::vector().swap(MAttributes); What does the M stand for in MAttributes? > + if (FnAttribute == Attribute::None && RetAttribute != Attribute::None) { > + if (RetAttribute & Attribute::NoUnwind) { > + FnAttribute = FnAttribute | Attribute::NoUnwind; > + RetAttribute = RetAttribute ^ Attribute::NoUnwind; > + useUpdatedAttrs = true; > + } > + if (RetAttribute & Attribute::NoReturn) { > + FnAttribute = FnAttribute | Attribute::NoReturn; > + RetAttribute = RetAttribute ^ Attribute::NoReturn; > + useUpdatedAttrs = true; > + } > + if (RetAttribute & Attribute::ReadOnly) { > + FnAttribute = FnAttribute | Attribute::ReadOnly; > + RetAttribute = RetAttribute ^ Attribute::ReadOnly; > + useUpdatedAttrs = true; > + } > + if (RetAttribute & Attribute::ReadNone) { > + FnAttribute = FnAttribute | Attribute::ReadNone; > + RetAttribute = RetAttribute ^ Attribute::ReadNone; > + useUpdatedAttrs = true; > + } > + } Rather than hard-coding this list of attributes and repeating the code, how about renaming const Attributes ReturnOnly = NoReturn | NoUnwind | ReadNone | ReadOnly; (in Attributes.h) to FunctionAttributes, and implement the above by doing RetAttribute & FunctionAttributes to find the list of attributes to move, or-ing that into FnAttribute etc. > + // Add any function attributes. > + if (Attributes attrs = PAL.getFnAttributes()) > + AttributesVec.push_back(AttributeWithIndex::get(~0, attrs)); If Index becomes signed then this will need to be pushed at the front. Ciao, Duncan. From baldrick at free.fr Mon Sep 29 02:38:08 2008 From: baldrick at free.fr (Duncan Sands) Date: Mon, 29 Sep 2008 09:38:08 +0200 Subject: [llvm-commits] [llvm] r56716 - in /llvm/trunk: docs/ include/llvm/ lib/AsmParser/ lib/Target/X86/AsmPrinter/ lib/Transforms/IPO/ lib/Transforms/Scalar/ lib/Transforms/Utils/ lib/VMCore/ test/CodeGen/ARM/ test/Transforms/Inline/ In-Reply-To: <200809262351.m8QNpKwo021728@zion.cs.uiuc.edu> References: <200809262351.m8QNpKwo021728@zion.cs.uiuc.edu> Message-ID: <200809290938.08800.baldrick@free.fr> Hi Devang, > +
alwaysinline
> +
This attribute requests inliner to inline this function irrespective of > +inlining size threshold for this function.
probably best not to talk about thresholds here. How about: "This attribute instructs the inliner to always inline this function if it can". > +
This attribute suggests optimization passes and code generator passes to > +make choices that help reduce code size.
How about: "This attribute tells the optimizers and code generators that reducing code size is more important than making the function fast". > +
noreturn
> +
This function attribute indicates that the function never returns. This > + indicates to LLVM that every call to this function should be treated as if > + an unreachable instruction immediately followed the call.
function attribute -> attribute This indicates to LLVM -> This tells LLVM > +
nounwind
> +
This function attribute indicates that no exceptions unwind out of the > + function. Usually this is because the function makes no use of exceptions, function attribute -> attribute > +
readonly
> +
This function attribute indicates that the function has no side-effects > + except for producing a return value or throwing an exception. The value function attribute -> attribute > + /// hasFnAttr - Return true if this function has given attribute. given attribute -> the given attribute Ciao, Duncan. From baldrick at free.fr Mon Sep 29 02:45:15 2008 From: baldrick at free.fr (Duncan Sands) Date: Mon, 29 Sep 2008 09:45:15 +0200 Subject: [llvm-commits] [llvm-gcc-4.2] r56729 - in /llvm-gcc-4.2/trunk/gcc/objc: ChangeLog.apple objc-act.c In-Reply-To: <200809270024.m8R0OCIG022789@zion.cs.uiuc.edu> References: <200809270024.m8R0OCIG022789@zion.cs.uiuc.edu> Message-ID: <200809290945.15607.baldrick@free.fr> > Don't generate trampolines for blocks. /me waves goodbye to the bug that got us PPC trampoline support :) From baldrick at free.fr Mon Sep 29 02:46:18 2008 From: baldrick at free.fr (Duncan Sands) Date: Mon, 29 Sep 2008 09:46:18 +0200 Subject: [llvm-commits] [llvm] r56730 - in /llvm/trunk/test/Assembler: 2008-09-02-FunctionNotes.ll 2008-09-02-FunctionNotes2.ll In-Reply-To: <200809270025.m8R0PTno022834@zion.cs.uiuc.edu> References: <200809270025.m8R0PTno022834@zion.cs.uiuc.edu> Message-ID: <200809290946.18620.baldrick@free.fr> > +; XFAIL: * > +define void @fn1() alwaysinline, noinline { Should there really be a comma between these attributes? Ciao, Duncan. From baldrick at free.fr Mon Sep 29 02:52:59 2008 From: baldrick at free.fr (Duncan Sands) Date: Mon, 29 Sep 2008 09:52:59 +0200 Subject: [llvm-commits] [llvm] r56757 - /llvm/trunk/include/llvm/Support/IRBuilder.h In-Reply-To: <200809272322.m8RNMwHr006195@zion.cs.uiuc.edu> References: <200809272322.m8RNMwHr006195@zion.cs.uiuc.edu> Message-ID: <200809290952.59934.baldrick@free.fr> Hi Daniel, > Add IRBuilder::{CreateIsNull, CreateIsNonNull} helper methods. > - I'm open to the idea that these could have better names. I think > these read better than CreateEQNull and CreateNENull. I'd prefer CreateIsNotNull to CreateIsNonNull. Ciao, Duncan. From baldrick at free.fr Mon Sep 29 02:55:36 2008 From: baldrick at free.fr (Duncan Sands) Date: Mon, 29 Sep 2008 09:55:36 +0200 Subject: [llvm-commits] Struct-handling patches In-Reply-To: <20080928190454.GG15228@katherina.student.utwente.nl> References: <20080928190454.GG15228@katherina.student.utwente.nl> Message-ID: <200809290955.36772.baldrick@free.fr> Hi, > The last patch, firstclass.diff, concerns instcombine. Instcombine can replace > memcpy calls for small values with a load and a store. This defaults to using > an integer type of appropriate size to load and store, unless a single value > type is copied (ie, a double, or a struct containing just a double, etc.). The > patch changes this to any first class type, since all first class types can be > loaded and stored directly. In particular, a memcpy of a small struct is now > replaced by a load and a store of the right struct type, instead of casting it > to integer first (confusing scalarrepl more). I didn't look at the patch, but this is only correct if the struct has no holes in it. Ciao, Duncan. From isanbard at gmail.com Mon Sep 29 03:11:02 2008 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 29 Sep 2008 01:11:02 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r56729 - in /llvm-gcc-4.2/trunk/gcc/objc: ChangeLog.apple objc-act.c In-Reply-To: <200809290945.15607.baldrick@free.fr> References: <200809270024.m8R0OCIG022789@zion.cs.uiuc.edu> <200809290945.15607.baldrick@free.fr> Message-ID: On Sep 29, 2008, at 12:45 AM, Duncan Sands wrote: >> Don't generate trampolines for blocks. > > /me waves goodbye to the bug that got us PPC > trampoline support :) /me rejoices. :-) -bw From baldrick at free.fr Mon Sep 29 05:10:31 2008 From: baldrick at free.fr (Duncan Sands) Date: Mon, 29 Sep 2008 10:10:31 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r56780 - /llvm-gcc-4.2/trunk/gcc/ada/stub-ada.c Message-ID: <200809291010.m8TAAWRW020712@zion.cs.uiuc.edu> Author: baldrick Date: Mon Sep 29 05:10:30 2008 New Revision: 56780 URL: http://llvm.org/viewvc/llvm-project?rev=56780&view=rev Log: The GPL 2007 binder adds a reference to this symbol on x86-64. Modified: llvm-gcc-4.2/trunk/gcc/ada/stub-ada.c Modified: llvm-gcc-4.2/trunk/gcc/ada/stub-ada.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/ada/stub-ada.c?rev=56780&r1=56779&r2=56780&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/ada/stub-ada.c (original) +++ llvm-gcc-4.2/trunk/gcc/ada/stub-ada.c Mon Sep 29 05:10:30 2008 @@ -22,3 +22,6 @@ /* Needed when building with GNAT GPL 2006. */ char system__restrictions__run_time_restrictions[1024] __attribute__ ((weak)); + +/* Needed when building with GNAT GPL 2007 on x86-64. */ +int __gl_leap_seconds_support __attribute__ ((weak)); From matthijs at stdin.nl Mon Sep 29 05:42:14 2008 From: matthijs at stdin.nl (Matthijs Kooijman) Date: Mon, 29 Sep 2008 10:42:14 -0000 Subject: [llvm-commits] [llvm] r56781 - /llvm/trunk/test/Transforms/ScalarRepl/load-store-aggregate.ll Message-ID: <200809291042.m8TAgErv021668@zion.cs.uiuc.edu> Author: matthijs Date: Mon Sep 29 05:42:13 2008 New Revision: 56781 URL: http://llvm.org/viewvc/llvm-project?rev=56781&view=rev Log: Add a testcase showing that scalarrepl supports first class structs. I originally made this script to show that scalarrepl didn't support them, but it turned out it does. Better to still add the testcase then. Added: llvm/trunk/test/Transforms/ScalarRepl/load-store-aggregate.ll Added: llvm/trunk/test/Transforms/ScalarRepl/load-store-aggregate.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/ScalarRepl/load-store-aggregate.ll?rev=56781&view=auto ============================================================================== --- llvm/trunk/test/Transforms/ScalarRepl/load-store-aggregate.ll (added) +++ llvm/trunk/test/Transforms/ScalarRepl/load-store-aggregate.ll Mon Sep 29 05:42:13 2008 @@ -0,0 +1,30 @@ +; This testcase shows that scalarrepl is able to replace struct alloca's which +; are directly loaded from or stored to (using the first class aggregates +; feature). + +; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis > %t +; RUN: cat %t | not grep alloca + +%struct.foo = type { i32, i32 } + +define i32 @test(%struct.foo* %P) { +entry: + %L = alloca %struct.foo, align 8 ; <%struct.foo*> [#uses=2] + %V = load %struct.foo* %P + store %struct.foo %V, %struct.foo* %L + + %tmp4 = getelementptr %struct.foo* %L, i32 0, i32 0 ; [#uses=1] + %tmp5 = load i32* %tmp4 ; [#uses=1] + ret i32 %tmp5 +} + +define %struct.foo @test2(i32 %A, i32 %B) { +entry: + %L = alloca %struct.foo, align 8 ; <%struct.foo*> [#uses=2] + %L.0 = getelementptr %struct.foo* %L, i32 0, i32 0 + store i32 %A, i32* %L.0 + %L.1 = getelementptr %struct.foo* %L, i32 0, i32 1 + store i32 %B, i32* %L.1 + %V = load %struct.foo* %L + ret %struct.foo %V +} From baldrick at free.fr Mon Sep 29 06:25:43 2008 From: baldrick at free.fr (Duncan Sands) Date: Mon, 29 Sep 2008 11:25:43 -0000 Subject: [llvm-commits] [llvm] r56782 - in /llvm/trunk: include/llvm/ lib/Linker/ lib/Target/ lib/Target/ARM/AsmPrinter/ lib/Target/IA64/ lib/Target/Mips/ lib/Target/PowerPC/AsmPrinter/ lib/Target/Sparc/ lib/Target/X86/AsmPrinter/ lib/Transforms/IPO/ lib/Transforms/Utils/ Message-ID: <200809291125.m8TBPi7S023133@zion.cs.uiuc.edu> Author: baldrick Date: Mon Sep 29 06:25:42 2008 New Revision: 56782 URL: http://llvm.org/viewvc/llvm-project?rev=56782&view=rev Log: Rename isWeakForLinker to mayBeOverridden. Use it instead of hasWeakLinkage in a bunch of optimization passes. Modified: llvm/trunk/include/llvm/GlobalValue.h llvm/trunk/lib/Linker/LinkModules.cpp llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp llvm/trunk/lib/Target/IA64/IA64AsmPrinter.cpp llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp llvm/trunk/lib/Target/Sparc/SparcAsmPrinter.cpp llvm/trunk/lib/Target/TargetAsmInfo.cpp llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp llvm/trunk/lib/Transforms/IPO/IPConstantPropagation.cpp llvm/trunk/lib/Transforms/IPO/PruneEH.cpp llvm/trunk/lib/Transforms/Utils/InlineCost.cpp Modified: llvm/trunk/include/llvm/GlobalValue.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/GlobalValue.h?rev=56782&r1=56781&r2=56782&view=diff ============================================================================== --- llvm/trunk/include/llvm/GlobalValue.h (original) +++ llvm/trunk/include/llvm/GlobalValue.h Mon Sep 29 06:25:42 2008 @@ -111,9 +111,10 @@ void setLinkage(LinkageTypes LT) { Linkage = LT; } LinkageTypes getLinkage() const { return Linkage; } - /// isWeakForLinker - Determines if symbol is weak for linker having weak or - /// linkonce or common or extweak LLVM linkage. - bool isWeakForLinker() const { + /// mayBeOverridden - Whether the definition of this global may be replaced + /// at link time. For example, if a function has weak linkage then the code + /// defining it may be replaced by different code. + bool mayBeOverridden() const { return (Linkage == WeakLinkage || Linkage == LinkOnceLinkage || Linkage == CommonLinkage || Modified: llvm/trunk/lib/Linker/LinkModules.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/LinkModules.cpp?rev=56782&r1=56781&r2=56782&view=diff ============================================================================== --- llvm/trunk/lib/Linker/LinkModules.cpp (original) +++ llvm/trunk/lib/Linker/LinkModules.cpp Mon Sep 29 06:25:42 2008 @@ -477,7 +477,7 @@ "': can only link appending global with another appending global!"); LinkFromSrc = true; // Special cased. LT = Src->getLinkage(); - } else if (Src->isWeakForLinker()) { + } else if (Src->mayBeOverridden()) { // At this point we know that Dest has LinkOnce, External*, Weak, Common, // or DLL* linkage. if ((Dest->hasLinkOnceLinkage() && @@ -489,7 +489,7 @@ LinkFromSrc = false; LT = Dest->getLinkage(); } - } else if (Dest->isWeakForLinker()) { + } else if (Dest->mayBeOverridden()) { // At this point we know that Src has External* or DLL* linkage. if (Src->hasExternalWeakLinkage()) { LinkFromSrc = false; @@ -757,7 +757,7 @@ } else if (GlobalVariable *DGVar = dyn_cast_or_null(DGV)) { // The only allowed way is to link alias with external declaration or weak // symbol.. - if (DGVar->isDeclaration() || DGVar->isWeakForLinker()) { + if (DGVar->isDeclaration() || DGVar->mayBeOverridden()) { // But only if aliasee is global too... if (!isa(DAliasee)) return Error(Err, "Global-Alias Collision on '" + SGA->getName() + @@ -786,7 +786,7 @@ } else if (Function *DF = dyn_cast_or_null(DGV)) { // The only allowed way is to link alias with external declaration or weak // symbol... - if (DF->isDeclaration() || DF->isWeakForLinker()) { + if (DF->isDeclaration() || DF->mayBeOverridden()) { // But only if aliasee is function too... if (!isa(DAliasee)) return Error(Err, "Function-Alias Collision on '" + SGA->getName() + @@ -862,10 +862,10 @@ if (DGV->getInitializer() != SInit) return Error(Err, "Global Variable Collision on '" + SGV->getName() + "': global variables have different initializers"); - } else if (DGV->isWeakForLinker()) { + } else if (DGV->mayBeOverridden()) { // Nothing is required, mapped values will take the new global // automatically. - } else if (SGV->isWeakForLinker()) { + } else if (SGV->mayBeOverridden()) { // Nothing is required, mapped values will take the new global // automatically. } else if (DGV->hasAppendingLinkage()) { 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=56782&r1=56781&r2=56782&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Mon Sep 29 06:25:42 2008 @@ -871,7 +871,7 @@ } } - if (GVar->hasInternalLinkage() || GVar->isWeakForLinker()) { + if (GVar->hasInternalLinkage() || GVar->mayBeOverridden()) { if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it. if (TAI->getLCOMMDirective() != NULL) { Modified: llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp?rev=56782&r1=56781&r2=56782&view=diff ============================================================================== --- llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp Mon Sep 29 06:25:42 2008 @@ -73,7 +73,7 @@ const Section* DarwinTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV) const { SectionKind::Kind Kind = SectionKindForGlobal(GV); - bool isWeak = GV->isWeakForLinker(); + bool isWeak = GV->mayBeOverridden(); bool isNonStatic = (DTM->getRelocationModel() != Reloc::Static); switch (Kind) { Modified: llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp?rev=56782&r1=56781&r2=56782&view=diff ============================================================================== --- llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp Mon Sep 29 06:25:42 2008 @@ -55,7 +55,7 @@ return getNamedSection(Name.c_str(), Flags); } } else if (const GlobalVariable *GVar = dyn_cast(GV)) { - if (GVar->isWeakForLinker()) { + if (GVar->mayBeOverridden()) { std::string Name = UniqueSectionForGlobal(GVar, Kind); unsigned Flags = SectionFlagsForGlobal(GVar, Name.c_str()); return getNamedSection(Name.c_str(), Flags); Modified: llvm/trunk/lib/Target/IA64/IA64AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64AsmPrinter.cpp?rev=56782&r1=56781&r2=56782&view=diff ============================================================================== --- llvm/trunk/lib/Target/IA64/IA64AsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/IA64/IA64AsmPrinter.cpp Mon Sep 29 06:25:42 2008 @@ -275,7 +275,7 @@ if (C->isNullValue() && !GVar->hasSection()) { if (!GVar->isThreadLocal() && - (GVar->hasInternalLinkage() || GVar->isWeakForLinker())) { + (GVar->hasInternalLinkage() || GVar->mayBeOverridden())) { if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it. if (GVar->hasInternalLinkage()) { Modified: llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp?rev=56782&r1=56781&r2=56782&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp Mon Sep 29 06:25:42 2008 @@ -504,7 +504,7 @@ if (C->isNullValue() && !GVar->hasSection()) { if (!GVar->isThreadLocal() && - (GVar->hasInternalLinkage() || GVar->isWeakForLinker())) { + (GVar->hasInternalLinkage() || GVar->mayBeOverridden())) { if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it. if (GVar->hasInternalLinkage()) Modified: llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp?rev=56782&r1=56781&r2=56782&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp Mon Sep 29 06:25:42 2008 @@ -85,7 +85,7 @@ SectionKind::Kind K = SectionKindForGlobal(GV); const GlobalVariable *GVA = dyn_cast(GV); - if (GVA && (!GVA->isWeakForLinker())) + if (GVA && (!GVA->mayBeOverridden())) switch (K) { case SectionKind::SmallData: return getSmallDataSection(); 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=56782&r1=56781&r2=56782&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp Mon Sep 29 06:25:42 2008 @@ -675,7 +675,7 @@ if (C->isNullValue() && /* FIXME: Verify correct */ !GVar->hasSection() && (GVar->hasInternalLinkage() || GVar->hasExternalLinkage() || - GVar->isWeakForLinker())) { + GVar->mayBeOverridden())) { if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it. if (GVar->hasExternalLinkage()) { @@ -900,7 +900,7 @@ if (C->isNullValue() && /* FIXME: Verify correct */ !GVar->hasSection() && (GVar->hasInternalLinkage() || GVar->hasExternalLinkage() || - GVar->isWeakForLinker())) { + GVar->mayBeOverridden())) { if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it. if (GVar->hasExternalLinkage()) { Modified: llvm/trunk/lib/Target/Sparc/SparcAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcAsmPrinter.cpp?rev=56782&r1=56781&r2=56782&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/Sparc/SparcAsmPrinter.cpp Mon Sep 29 06:25:42 2008 @@ -253,7 +253,7 @@ if (C->isNullValue() && !GVar->hasSection()) { if (!GVar->isThreadLocal() && - (GVar->hasInternalLinkage() || GVar->isWeakForLinker())) { + (GVar->hasInternalLinkage() || GVar->mayBeOverridden())) { if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it. if (GVar->hasInternalLinkage()) Modified: llvm/trunk/lib/Target/TargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetAsmInfo.cpp?rev=56782&r1=56781&r2=56782&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/TargetAsmInfo.cpp Mon Sep 29 06:25:42 2008 @@ -240,7 +240,7 @@ assert(0 && "Unexpected section kind!"); } - if (GV->isWeakForLinker()) + if (GV->mayBeOverridden()) Flags |= SectionFlags::Linkonce; } @@ -291,7 +291,7 @@ TargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV) const { SectionKind::Kind Kind = SectionKindForGlobal(GV); - if (GV->isWeakForLinker()) { + if (GV->mayBeOverridden()) { std::string Name = UniqueSectionForGlobal(GV, Kind); unsigned Flags = SectionFlagsForGlobal(GV, Name.c_str()); return getNamedSection(Name.c_str(), Flags); 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=56782&r1=56781&r2=56782&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Mon Sep 29 06:25:42 2008 @@ -383,7 +383,7 @@ if (shouldPrintStub(TM, Subtarget)) { // Link-once, declaration, or Weakly-linked global variables need // non-lazily-resolved stubs - if (GV->isDeclaration() || GV->isWeakForLinker()) { + if (GV->isDeclaration() || GV->mayBeOverridden()) { // Dynamically-resolved functions need a stub for the function. if (isCallOp && isa(GV)) { // Function stubs are no longer needed for Mac OS X 10.5 and up. @@ -790,7 +790,7 @@ } if (!GVar->isThreadLocal() && - (GVar->hasInternalLinkage() || GVar->isWeakForLinker())) { + (GVar->hasInternalLinkage() || GVar->mayBeOverridden())) { if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it. if (TAI->getLCOMMDirective() != NULL) { Modified: llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp?rev=56782&r1=56781&r2=56782&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp Mon Sep 29 06:25:42 2008 @@ -63,7 +63,7 @@ // Definitions with weak linkage may be overridden at linktime with // something that writes memory, so treat them like declarations. - if (F->isDeclaration() || F->hasWeakLinkage()) { + if (F->isDeclaration() || F->mayBeOverridden()) { if (!F->onlyReadsMemory()) // May write memory. return false; Modified: llvm/trunk/lib/Transforms/IPO/IPConstantPropagation.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/IPConstantPropagation.cpp?rev=56782&r1=56781&r2=56782&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/IPConstantPropagation.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/IPConstantPropagation.cpp Mon Sep 29 06:25:42 2008 @@ -155,7 +155,7 @@ // If this function could be overridden later in the link stage, we can't // propagate information about its results into callers. - if (F.hasLinkOnceLinkage() || F.hasWeakLinkage()) + if (F.hasLinkOnceLinkage() || F.mayBeOverridden()) return false; // Check to see if this function returns a constant. Modified: llvm/trunk/lib/Transforms/IPO/PruneEH.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/PruneEH.cpp?rev=56782&r1=56781&r2=56782&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/PruneEH.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/PruneEH.cpp Mon Sep 29 06:25:42 2008 @@ -76,7 +76,7 @@ if (F == 0) { SCCMightUnwind = true; SCCMightReturn = true; - } else if (F->isDeclaration() || F->hasWeakLinkage()) { + } else if (F->isDeclaration() || F->mayBeOverridden()) { SCCMightUnwind |= !F->doesNotThrow(); SCCMightReturn |= !F->doesNotReturn(); } else { Modified: llvm/trunk/lib/Transforms/Utils/InlineCost.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/InlineCost.cpp?rev=56782&r1=56781&r2=56782&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/InlineCost.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/InlineCost.cpp Mon Sep 29 06:25:42 2008 @@ -174,17 +174,21 @@ Instruction *TheCall = CS.getInstruction(); Function *Callee = CS.getCalledFunction(); const Function *Caller = TheCall->getParent()->getParent(); - + // Don't inline a directly recursive call. if (Caller == Callee || // Don't inline functions which can be redefined at link-time to mean - // something else. link-once linkage is ok though. - Callee->hasWeakLinkage() || - + // something else. + // FIXME: We allow link-once linkage since in practice all versions of + // the function have the same body (C++ ODR) - but the LLVM definition + // of LinkOnceLinkage doesn't require this. + (Callee->mayBeOverridden() && !Callee->hasLinkOnceLinkage() + ) || + // Don't inline functions marked noinline. NeverInline.count(Callee)) return 2000000000; - + // InlineCost - This value measures how good of an inline candidate this call // site is to inline. A lower inline cost make is more likely for the call to // be inlined. This value may go negative. From matthijs at stdin.nl Mon Sep 29 06:52:23 2008 From: matthijs at stdin.nl (Matthijs Kooijman) Date: Mon, 29 Sep 2008 11:52:23 -0000 Subject: [llvm-commits] [llvm] r56783 - /llvm/trunk/docs/WritingAnLLVMBackend.html Message-ID: <200809291152.m8TBqNGK024072@zion.cs.uiuc.edu> Author: matthijs Date: Mon Sep 29 06:52:22 2008 New Revision: 56783 URL: http://llvm.org/viewvc/llvm-project?rev=56783&view=rev Log: Add some hands-on documentation about which files to create and edit when adding a backend. Modified: llvm/trunk/docs/WritingAnLLVMBackend.html Modified: llvm/trunk/docs/WritingAnLLVMBackend.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/WritingAnLLVMBackend.html?rev=56783&r1=56782&r2=56783&view=diff ============================================================================== --- llvm/trunk/docs/WritingAnLLVMBackend.html (original) +++ llvm/trunk/docs/WritingAnLLVMBackend.html Mon Sep 29 06:52:22 2008 @@ -218,6 +218,56 @@ how the C backend is written.

+ + + +
+ +

To actually create your backend, you need to create and modify a few files. +Here, the absolute minimum will be discussed. To actually use LLVM's target +independent codegenerator, you must implement extra +things.

+ +

First of all, you should create a subdirectory under lib/Target, +which will hold all the files related to your target. Let's assume that our +target is called, "Dummy", we would create the directory +lib/Target/Dummy.

+ +

In this new directory, you should put a Makefile. You can probably +copy one from another target and modify it. It should at least contain the +LEVEL, LIBRARYNAME and TARGET variables, and then +include $(LEVEL)/Makefile.common. Be careful to give the library the +correct name, it must be named LLVMDummy (see the MIPS target, for +example). Alternatively, you can split the library into +LLVMDummyCodeGen and LLVMDummyAsmPrinter, the latter of which +should be implemented in a subdirectory below lib/Target/Dummy (see the +PowerPC target, for example).

+ +

Note that these two naming schemes are hardcoded into llvm-config. Using any +other naming scheme will confuse llvm-config and produce lots of (seemingly +unrelated) linker errors when linking llc.

+ +

To make your target actually do something, you need to implement a subclass +of TargetMachine. This implementation should typically be in the file +lib/Target/DummyTargetMachine.cpp, but any file in the +lib/Target directory will be built and should work. To use LLVM's target independent code generator, you should +create a subclass of LLVMTargetMachine. This is what all current +machine backends do. To create a target from scratch, create a subclass of +TargetMachine. This is what the current language backends do.

+ +

To get LLVM to actually build and link your target, you also need to add it +to the TARGETS_TO_BUILD variable. To do this, you need to modify the +configure script to know about your target when parsing the +--enable-targets option. Search the configure script for +TARGETS_TO_BUILD, add your target to the lists there (some creativity +required) and then reconfigure. Alternatively, you can change +autotools/configure.ac and regenerate configure by running +./autoconf/AutoRegen.sh. + +

From baldrick at free.fr Mon Sep 29 08:18:29 2008 From: baldrick at free.fr (Duncan Sands) Date: Mon, 29 Sep 2008 15:18:29 +0200 Subject: [llvm-commits] [llvm] r56342 - in /llvm/trunk: include/llvm/LinkAllPasses.h include/llvm/Transforms/Scalar.h lib/Transforms/Scalar/MarkModRef.cpp test/Analysis/GlobalsModRef/2008-09-03-WrongRecords.ll win32/Transforms/Transforms.vcproj In-Reply-To: References: <200809190823.m8J8Nic6010477@zion.cs.uiuc.edu> Message-ID: <200809291518.29246.baldrick@free.fr> Hi Chris, > > Remove the MarkModRef pass (use AddReadAttrs instead). > > Unfortunately this means removing one regression test > > of GlobalsModRef because I couldn't work out how to > > perform it without MarkModRef. > > What is the issue? the result of the GlobalsModRef alias analysis used to be wrong sometimes. But how to get at the analysis result in order to write a testcase? MarkModRef was convenient for this, because it stored alias analysis results in the bitcode, so you could pass to llvm-dis and grep for badness. > Also, why doesn't your AddReadAttrs pass use AliasAnalysis? It doesn't need AA to do a decent job, but indeed if AA is available it might as well use it (currently no AA exists that would actually help, but such an AA may be written someday). It could call getAnalysisToUpdate, and use the resulting AA if present. In which case I suppose it would be best if getAnalysisToUpdate was renamed to getAnalysisIfAvailable. Ciao, Duncan. From baldrick at free.fr Mon Sep 29 08:35:32 2008 From: baldrick at free.fr (Duncan Sands) Date: Mon, 29 Sep 2008 13:35:32 -0000 Subject: [llvm-commits] [llvm] r56784 - /llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp Message-ID: <200809291335.m8TDZXNW031258@zion.cs.uiuc.edu> Author: baldrick Date: Mon Sep 29 08:35:31 2008 New Revision: 56784 URL: http://llvm.org/viewvc/llvm-project?rev=56784&view=rev Log: Tweak some comments. Modified: llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp Modified: llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp?rev=56784&r1=56783&r2=56784&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp Mon Sep 29 08:35:31 2008 @@ -47,14 +47,14 @@ bool AddReadAttrs::runOnSCC(const std::vector &SCC) { CallGraph &CG = getAnalysis(); - // Check if any of the functions in the SCC read or write memory. - // If they write memory then just give up. + // Check if any of the functions in the SCC read or write memory. If they + // write memory then they can't be marked readnone or readonly. bool ReadsMemory = false; for (unsigned i = 0, e = SCC.size(); i != e; ++i) { Function *F = SCC[i]->getFunction(); if (F == 0) - // External node - may write memory. + // External node - may write memory. Just give up. return false; if (F->doesNotAccessMemory()) @@ -65,7 +65,7 @@ // something that writes memory, so treat them like declarations. if (F->isDeclaration() || F->mayBeOverridden()) { if (!F->onlyReadsMemory()) - // May write memory. + // May write memory. Just give up. return false; ReadsMemory = true; @@ -83,7 +83,9 @@ continue; if (II->mayWriteToMemory()) + // Writes memory. Just give up. return false; + ReadsMemory |= II->mayReadFromMemory(); } } From baldrick at free.fr Mon Sep 29 09:59:05 2008 From: baldrick at free.fr (Duncan Sands) Date: Mon, 29 Sep 2008 14:59:05 -0000 Subject: [llvm-commits] [llvm] r56787 - in /llvm/trunk/lib/Transforms/IPO: AddReadAttrs.cpp PruneEH.cpp Message-ID: <200809291459.m8TEx5vO007531@zion.cs.uiuc.edu> Author: baldrick Date: Mon Sep 29 09:59:04 2008 New Revision: 56787 URL: http://llvm.org/viewvc/llvm-project?rev=56787&view=rev Log: Speed up these passes when the callgraph has huge simply connected components. Suggested by Chris. Modified: llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp llvm/trunk/lib/Transforms/IPO/PruneEH.cpp Modified: llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp?rev=56787&r1=56786&r2=56787&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp Mon Sep 29 09:59:04 2008 @@ -19,6 +19,7 @@ #include "llvm/CallGraphSCCPass.h" #include "llvm/Instructions.h" #include "llvm/Analysis/CallGraph.h" +#include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/Statistic.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/InstIterator.h" @@ -45,8 +46,14 @@ bool AddReadAttrs::runOnSCC(const std::vector &SCC) { + SmallPtrSet SCCNodes; CallGraph &CG = getAnalysis(); + // Fill SCCNodes with the elements of the SCC. Used for quickly + // looking up whether a given CallGraphNode is in this SCC. + for (unsigned i = 0, e = SCC.size(); i != e; ++i) + SCCNodes.insert(SCC[i]); + // Check if any of the functions in the SCC read or write memory. If they // write memory then they can't be marked readnone or readonly. bool ReadsMemory = false; @@ -77,9 +84,7 @@ CallSite CS = CallSite::get(&*II); // Ignore calls to functions in the same SCC. - if (CS.getInstruction() && - std::find(SCC.begin(), SCC.end(), CG[CS.getCalledFunction()]) != - SCC.end()) + if (CS.getInstruction() && SCCNodes.count(CG[CS.getCalledFunction()])) continue; if (II->mayWriteToMemory()) Modified: llvm/trunk/lib/Transforms/IPO/PruneEH.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/PruneEH.cpp?rev=56787&r1=56786&r2=56787&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/PruneEH.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/PruneEH.cpp Mon Sep 29 09:59:04 2008 @@ -21,6 +21,7 @@ #include "llvm/Function.h" #include "llvm/Instructions.h" #include "llvm/Analysis/CallGraph.h" +#include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/Statistic.h" #include "llvm/Support/CFG.h" @@ -53,9 +54,15 @@ bool PruneEH::runOnSCC(const std::vector &SCC) { + SmallPtrSet SCCNodes; CallGraph &CG = getAnalysis(); bool MadeChange = false; + // Fill SCCNodes with the elements of the SCC. Used for quickly + // looking up whether a given CallGraphNode is in this SCC. + for (unsigned i = 0, e = SCC.size(); i != e; ++i) + SCCNodes.insert(SCC[i]); + // First pass, scan all of the functions in the SCC, simplifying them // according to what we know. for (unsigned i = 0, e = SCC.size(); i != e; ++i) @@ -107,7 +114,7 @@ CallGraphNode *CalleeNode = CG[Callee]; // If the callee is outside our current SCC then we may // throw because it might. - if (std::find(SCC.begin(), SCC.end(), CalleeNode) == SCC.end()){ + if (!SCCNodes.count(CalleeNode)) { SCCMightUnwind = true; break; } From baldrick at free.fr Mon Sep 29 10:16:10 2008 From: baldrick at free.fr (Duncan Sands) Date: Mon, 29 Sep 2008 17:16:10 +0200 Subject: [llvm-commits] [llvm] r56341 - in /llvm/trunk: include/llvm/ include/llvm/Transforms/ lib/Transforms/IPO/ test/Analysis/GlobalsModRef/ test/Transforms/AddReadAttrs/ In-Reply-To: References: <200809190817.m8J8H6I8010267@zion.cs.uiuc.edu> Message-ID: <200809291716.10897.baldrick@free.fr> Hi Chris, > This pass can only do something if the SCC is not already readnone. > Does it make sense to do an initial check to see if the function is > already readnone? Since it doesn't have to be a perfect check, how > about something like: > > if (SCC.size() == 1 && SCC[0]->getFunction() && > SCC[0]->getFunction()->doesNotAccessMemory()) > return false; // already readnone > > Alternatively, maybe this should be handled by the 'already perfect' > case you already have. I don't think this makes much sense, since in this case you just whiz through without doing much. All that happens is: A call to getAnalysis. Creation of a SmallPtrSet and placing one element in it. Getting the function from the CallGraphNode. A call to doesNotAccessMemory. Another getting of the function from CallGraphNode. Another call to doesNotAccessMemory. Some of these are wrapped in loops of length 1, adds some overhead. I don't know how much a call to getAnalysis costs, but the other costs should be tiny. > // Definitions with weak linkage may be overridden at linktime with > // something that writes memory, so treat them like declarations. > if (F->isDeclaration() || F->hasWeakLinkage()) { > > This should also handle linkonce linkage. It does now: it checks F->mayBeOverridden. > // Ignore calls to functions in the same SCC. > if (CS.getInstruction() && > std::find(SCC.begin(), SCC.end(), > CG[CS.getCalledFunction()]) != > SCC.end()) > continue; > > This will be really slow for large SCCs. I think that some apps (like > 176.gcc) have scc's with hundreds of nodes in them. Instead of using > std::find, please dump the contents of the SCC into a SmallPtrSet at > the start of the function, and query that instead. Done. > if (II->mayWriteToMemory()) > return false; > > Please add a comment: "If this may write to memory, then we can't set > either readnone or readonly, just give up." or something like that. Done. Thanks for the review! Ciao, Duncan. From ggreif at gmail.com Mon Sep 29 10:51:09 2008 From: ggreif at gmail.com (Gabor Greif) Date: Mon, 29 Sep 2008 15:51:09 -0000 Subject: [llvm-commits] [llvm] r56788 - /llvm/branches/ggreif/use-diet/lib/VMCore/Use.cpp Message-ID: <200809291551.m8TFp9Lv013710@zion.cs.uiuc.edu> Author: ggreif Date: Mon Sep 29 10:51:07 2008 New Revision: 56788 URL: http://llvm.org/viewvc/llvm-project?rev=56788&view=rev Log: update the correct fields this makes InstCombine/2006-02-07-SextZextCrash to pass again Modified: llvm/branches/ggreif/use-diet/lib/VMCore/Use.cpp Modified: llvm/branches/ggreif/use-diet/lib/VMCore/Use.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/VMCore/Use.cpp?rev=56788&r1=56787&r2=56788&view=diff ============================================================================== --- llvm/branches/ggreif/use-diet/lib/VMCore/Use.cpp (original) +++ llvm/branches/ggreif/use-diet/lib/VMCore/Use.cpp Mon Sep 29 10:51:07 2008 @@ -31,10 +31,9 @@ (char*&)*stripTag(Prev) += dist; (char*&)*stripTag(RHS.Prev) -= dist; if (real1) - (char*&)valid1->Next += dist; + (char*&)valid1->Prev += dist; if (real2) - (char*&)valid2->Next -= dist; - + (char*&)valid2->Prev -= dist; } // swap the members @@ -43,29 +42,6 @@ RHS.Prev = transferTag(RHS.Prev, stripTag(Prev)); Prev = Prev1; } - /* Value *V1(Val1); - Value *V2(RHS.Val1); - if (V1 != V2) { - if (V1) { - removeFromList(); - } - - if (V2) { - RHS.removeFromList(); - Val1 = V2; - V2->addUse(*this); - } else { - Val1 = 0; - } - - if (V1) { - RHS.Val1 = V1; - V1->addUse(RHS); - } else { - RHS.Val1 = 0; - } - } - */ } //===----------------------------------------------------------------------===// From dpatel at apple.com Mon Sep 29 11:19:35 2008 From: dpatel at apple.com (Devang Patel) Date: Mon, 29 Sep 2008 09:19:35 -0700 Subject: [llvm-commits] r55638 - /llvm/trunk/include/llvm/Function.h In-Reply-To: <200809270436.32049.baldrick@free.fr> References: <200809231027.53858.baldrick@free.fr> <200809261137.43799.baldrick@free.fr> <3C535D1A-80B7-45D5-8BB7-50B0C4AD9E6F@apple.com> <200809270436.32049.baldrick@free.fr> Message-ID: <5CE835F4-F18C-477B-AF12-A7659EED0242@apple.com> [ merging two email replies to make it easier to follow this thread.] On Sep 26, 2008, at 7:36 PM, Duncan Sands wrote: > Hi Devang, > >>>> If XYZ calls S and NS then once again, XYZ's notes win. >>> >>> And could result in a huge performance loss. And it is a loss: >>> it was ok to run S using sse instructions (that's why the >>> function was marked "sse"!), but now sse isn't being used due >>> to inlining... >> >> ... this happens only if because XYZ is marked as x86.no-sse. In >> which >> case, it is not a performance loss at all. > > I don't understand what you are saying here. Suppose XYZ is no-sse. > It calls S which is marked sse and does a lot of floating point > computation (but doesn't use sse intrinsics). If I understand you > right, the inliner can inline S into XYZ. I think you misunderstood ... "So, inline S into ... only if code generator will not be forced to use SSE instructions for the code copied from S." Here "only if" is important :) Later I mentioned, "The inliner needs to know the LLVM IR for function S does not use SSE intrinsics in this case. The inliner needs to detect SSE uses at IR level." If the inliner can not detect this or decides to not detect this then it should not inline S into XYZ in this case. It is obvious. On Sep 26, 2008, at 7:48 PM, Duncan Sands wrote: > I'm talking about this case: > gcc -c -O4 -no-sse x.c <= sse explicitly turned off > gcc -c -O4 -sse y.c > gcc -o x x.o y.o > Here you would still happily inline B into A, while my > scheme would not. No, you misunderstood my schema. See above. We have extensively supported scenario, where people use runtime checks to run special optimized routines for certain processors. (G3 vs. Altivec code). It is ok if the inliner inlines non-altivec code into a specilized altvec routine. However, inlining function that uses altivec instructions into a function that is expected to run on G3 is a bad idea. Follow uses_vector in llvm-gcc's gcc inliner code. We have regularly received requests for specialized routines for processors, where appropriate one is selected at runtime, in x86 world. I'm told that ICC supports this. The function attributes (notes are now implemented as attributes) must be handled case by case. We should not put vanilla check in inliner that says, if attributes do not match then skip. If we support optspeed, optimize for speed, then optspeed vs optsize makes this obvious. - Devang > This results in all these > floating point computations being done as "no-sse", i.e. using the > good 'ol x86 floating point stack rather than the much more efficient > sse registers... > > Ciao, > > Duncan. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080929/0964803e/attachment.html From dpatel at apple.com Mon Sep 29 11:20:58 2008 From: dpatel at apple.com (Devang Patel) Date: Mon, 29 Sep 2008 09:20:58 -0700 Subject: [llvm-commits] [llvm] r56511 - in /llvm/trunk: include/llvm/ lib/AsmParser/ lib/Bitcode/Reader/ lib/Bitcode/Writer/ lib/Target/X86/AsmPrinter/ lib/Transforms/IPO/ lib/Transforms/Scalar/ lib/Transforms/Utils/ lib/VMCore/ In-Reply-To: <181FE521-E40E-44CB-9474-07AADD3B5D05@apple.com> References: <200809232235.m8NMZJGn030760@zion.cs.uiuc.edu> <65B5B7F8-8A6B-4ED0-8A7B-3DD3FB9731EF@apple.com> <38E503F0-1979-4D7A-A10E-217D0EEEFC3C@apple.com> <181FE521-E40E-44CB-9474-07AADD3B5D05@apple.com> Message-ID: Chris, On Sep 23, 2008, at 5:04 PM, Chris Lattner wrote: > I think we really want: > > declare ...result attrs... i32 @foo( ... param attrs ...) > nounwind ...fnattrs... { > Do we want result attrs on call/invoke instructions also ? - Devang From baldrick at free.fr Mon Sep 29 11:23:28 2008 From: baldrick at free.fr (Duncan Sands) Date: Mon, 29 Sep 2008 18:23:28 +0200 Subject: [llvm-commits] r55638 - /llvm/trunk/include/llvm/Function.h In-Reply-To: <5CE835F4-F18C-477B-AF12-A7659EED0242@apple.com> References: <200809231027.53858.baldrick@free.fr> <200809270436.32049.baldrick@free.fr> <5CE835F4-F18C-477B-AF12-A7659EED0242@apple.com> Message-ID: <200809291823.29191.baldrick@free.fr> Hi, > > I don't understand what you are saying here. Suppose XYZ is no-sse. > > It calls S which is marked sse and does a lot of floating point > > computation (but doesn't use sse intrinsics). If I understand you > > right, the inliner can inline S into XYZ. > > I think you misunderstood ... > > "So, inline S into ... only if code generator will not be forced to > use SSE instructions for the code copied from S." Here "only if" is > important :) > > Later I mentioned, "The inliner needs to know the LLVM IR for function > S does not use SSE intrinsics in this case. The inliner needs to > detect SSE uses at IR level." > > If the inliner can not detect this or decides to not detect this then > it should not inline S into XYZ in this case. It is obvious. so any use of floating point (eg: fp multiplication) should be understood as using SSE, and would stop the inliner from inlining? Ciao, Duncan. From baldrick at free.fr Mon Sep 29 11:24:52 2008 From: baldrick at free.fr (Duncan Sands) Date: Mon, 29 Sep 2008 18:24:52 +0200 Subject: [llvm-commits] =?iso-8859-1?q?=5Bllvm=5D_r56511_-_in_/llvm/trunk?= =?iso-8859-1?q?=3A_include/llvm/_lib/AsmParser/_lib/Bitcode/Reader/_lib/B?= =?iso-8859-1?q?itcode/Writer/_lib/Target/X86/AsmPrinter/=09lib/Transforms?= =?iso-8859-1?q?/IPO/=09lib/Transforms/Scalar/_lib/Transforms/Utils/_lib/V?= =?iso-8859-1?q?MCore/?= In-Reply-To: References: <200809232235.m8NMZJGn030760@zion.cs.uiuc.edu> <181FE521-E40E-44CB-9474-07AADD3B5D05@apple.com> Message-ID: <200809291824.53018.baldrick@free.fr> > Do we want result attrs on call/invoke instructions also ? No choice really: if it's an indirect call you still need to know about inreg, sext etc but can't get them from the callee. Ciao, Duncan. From evan.cheng at apple.com Mon Sep 29 12:26:22 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 29 Sep 2008 17:26:22 -0000 Subject: [llvm-commits] [llvm] r56792 - in /llvm/trunk: lib/Target/X86/X86InstrInfo.td test/CodeGen/X86/2008-09-29-VolatileBug.ll Message-ID: <200809291726.m8THQMAl025604@zion.cs.uiuc.edu> Author: evancheng Date: Mon Sep 29 12:26:18 2008 New Revision: 56792 URL: http://llvm.org/viewvc/llvm-project?rev=56792&view=rev Log: Fix PR2835. Do not change the width of a volatile load. Added: llvm/trunk/test/CodeGen/X86/2008-09-29-VolatileBug.ll Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=56792&r1=56791&r2=56792&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Mon Sep 29 12:26:18 2008 @@ -266,6 +266,20 @@ return false; }]>; +def nvloadi32 : PatFrag<(ops node:$ptr), (i32 (ld node:$ptr)), [{ + LoadSDNode *LD = cast(N); + if (LD->isVolatile()) + return false; + if (LD->getAddressingMode() != ISD::UNINDEXED) + return false; + ISD::LoadExtType ExtType = LD->getExtensionType(); + if (ExtType == ISD::NON_EXTLOAD) + return true; + if (ExtType == ISD::EXTLOAD) + return LD->getAlignment() >= 4; + return false; +}]>; + def loadi8 : PatFrag<(ops node:$ptr), (i8 (load node:$ptr))>; def loadi64 : PatFrag<(ops node:$ptr), (i64 (load node:$ptr))>; @@ -2812,8 +2826,10 @@ (INSERT_SUBREG (i32 (IMPLICIT_DEF)), GR16:$src, x86_subreg_16bit)>; // (and (i32 load), 255) -> (zextload i8) -def : Pat<(i32 (and (loadi32 addr:$src), (i32 255))), (MOVZX32rm8 addr:$src)>; -def : Pat<(i32 (and (loadi32 addr:$src), (i32 65535))),(MOVZX32rm16 addr:$src)>; +def : Pat<(i32 (and (nvloadi32 addr:$src), (i32 255))), + (MOVZX32rm8 addr:$src)>; +def : Pat<(i32 (and (nvloadi32 addr:$src), (i32 65535))), + (MOVZX32rm16 addr:$src)>; //===----------------------------------------------------------------------===// // Some peepholes Added: llvm/trunk/test/CodeGen/X86/2008-09-29-VolatileBug.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2008-09-29-VolatileBug.ll?rev=56792&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/2008-09-29-VolatileBug.ll (added) +++ llvm/trunk/test/CodeGen/X86/2008-09-29-VolatileBug.ll Mon Sep 29 12:26:18 2008 @@ -0,0 +1,15 @@ +; RUN: llvm-as < %s | llc -march=x86 | not grep movz +; PR2835 + + at g_407 = internal global i32 0 ; [#uses=1] + at llvm.used = appending global [1 x i8*] [ i8* bitcast (i32 ()* @main to i8*) ], section "llvm.metadata" ; <[1 x i8*]*> [#uses=0] + +define i32 @main() nounwind { +entry: + %0 = volatile load i32* @g_407, align 4 ; [#uses=1] + %1 = trunc i32 %0 to i8 ; [#uses=1] + %2 = tail call i32 @func_45(i8 zeroext %1) nounwind ; [#uses=0] + ret i32 0 +} + +declare i32 @func_45(i8 zeroext) nounwind From csdavec at swansea.ac.uk Mon Sep 29 12:54:31 2008 From: csdavec at swansea.ac.uk (David Chisnall) Date: Mon, 29 Sep 2008 18:54:31 +0100 Subject: [llvm-commits] Per-module ctors for execution engine Message-ID: <0D3BE015-0954-48D8-97A4-F711A05B1C60@swan.ac.uk> Hi, This patch adds a version of runStaticConstructorsDestructors which takes a module as an argument, allowing ctors in modules created after the ExecutionEngine to be run. It refactors the original code so that the per-module body is now in the new method and the for loop in the original now just calls the new one. David -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: llvm_ctors.diff.txt Url: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080929/61734318/attachment.txt From dpatel at apple.com Mon Sep 29 13:13:02 2008 From: dpatel at apple.com (Devang Patel) Date: Mon, 29 Sep 2008 11:13:02 -0700 Subject: [llvm-commits] [llvm] r56704 - in /llvm/trunk: include/llvm/ lib/AsmParser/ lib/Bitcode/Reader/ lib/Transforms/IPO/ lib/Transforms/Scalar/ lib/VMCore/ In-Reply-To: <200809290925.32325.baldrick@free.fr> References: <200809262253.m8QMr8A4018093@zion.cs.uiuc.edu> <200809290925.32325.baldrick@free.fr> Message-ID: <42DB07A3-81AA-4D6B-AF5F-040D0673D431@apple.com> On Sep 29, 2008, at 12:25 AM, Duncan Sands wrote: > Hi Devang, > >> Return attributes use 0 as the index. >> Function attributes use ~0U as the index. > > attributes are stored in order of the (unsigned) index. > Lookup traverses the list looking for the index. So > using ~0U means looking up function attributes may be > particularly slow. Since these are the attributes that > are probably looked up most often, I suggest either > making Index signed, so ~0U=-1 will come first, or > special casing ~0U lookup. This tuning, if required, can be done as a separate work. > > > Ciao, > > Duncan. > >> + //FIXME : In 3.0, stop accepting zext, sext and inreg as >> optional function >> + //attributes. > > Does this mean that return value attributes are now placed next > to the return type My next patch will do add this... > and not at the end of the function declaration, > but you're accepting them in both positions for the moment? Yes, for backward compatibility. > > >> - std::vector().swap(Attributes); >> + std::vector().swap(MAttributes); > > What does the M stand for in MAttributes? Not Attributes !:) Teasing aside, M for Module. Attributes collected in this module. This is in bitcode library. > > >> + if (FnAttribute == Attribute::None && RetAttribute != >> Attribute::None) { >> + if (RetAttribute & Attribute::NoUnwind) { >> + FnAttribute = FnAttribute | Attribute::NoUnwind; >> + RetAttribute = RetAttribute ^ Attribute::NoUnwind; >> + useUpdatedAttrs = true; >> + } >> + if (RetAttribute & Attribute::NoReturn) { >> + FnAttribute = FnAttribute | Attribute::NoReturn; >> + RetAttribute = RetAttribute ^ Attribute::NoReturn; >> + useUpdatedAttrs = true; >> + } >> + if (RetAttribute & Attribute::ReadOnly) { >> + FnAttribute = FnAttribute | Attribute::ReadOnly; >> + RetAttribute = RetAttribute ^ Attribute::ReadOnly; >> + useUpdatedAttrs = true; >> + } >> + if (RetAttribute & Attribute::ReadNone) { >> + FnAttribute = FnAttribute | Attribute::ReadNone; >> + RetAttribute = RetAttribute ^ Attribute::ReadNone; >> + useUpdatedAttrs = true; >> + } >> + } > > Rather than hard-coding this list of attributes and repeating the > code, how about renaming > > const Attributes ReturnOnly = NoReturn | NoUnwind | ReadNone | > ReadOnly; > > (in Attributes.h) to FunctionAttributes, and implement the above by > doing > RetAttribute & FunctionAttributes to find the list of attributes to > move, > or-ing that into FnAttribute etc. ReturnOnly will eventually support all future return attributes also, so it isn not suitable here. We only want to accept existing these three attributes here, for backward compatibility. We could create BackWordCompatibleReturnOnly but I think this is overkill. Note, eventually we will remove this code. However, if you feel strongly, go ahead. > > >> + // Add any function attributes. >> + if (Attributes attrs = PAL.getFnAttributes()) >> + AttributesVec.push_back(AttributeWithIndex::get(~0, attrs)); > > If Index becomes signed then this will need to be pushed at the front. > > Ciao, > > Duncan. - Devang From dpatel at apple.com Mon Sep 29 13:16:10 2008 From: dpatel at apple.com (Devang Patel) Date: Mon, 29 Sep 2008 18:16:10 -0000 Subject: [llvm-commits] [llvm] r56794 - /llvm/trunk/docs/LangRef.html Message-ID: <200809291816.m8TIGA7t031511@zion.cs.uiuc.edu> Author: dpatel Date: Mon Sep 29 13:16:09 2008 New Revision: 56794 URL: http://llvm.org/viewvc/llvm-project?rev=56794&view=rev Log: Fix sentence. 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=56794&r1=56793&r2=56794&view=diff ============================================================================== --- llvm/trunk/docs/LangRef.html (original) +++ llvm/trunk/docs/LangRef.html Mon Sep 29 13:16:09 2008 @@ -935,7 +935,7 @@
noreturn
This function attribute indicates that the function never returns. This - indicates to LLVM that every call to this function should be treated as if + tells LLVM that every call to this function should be treated as if an unreachable instruction immediately followed the call.
nounwind
From dpatel at apple.com Mon Sep 29 13:16:38 2008 From: dpatel at apple.com (Devang Patel) Date: Mon, 29 Sep 2008 18:16:38 -0000 Subject: [llvm-commits] [llvm] r56795 - /llvm/trunk/include/llvm/Function.h Message-ID: <200809291816.m8TIGc2p031579@zion.cs.uiuc.edu> Author: dpatel Date: Mon Sep 29 13:16:38 2008 New Revision: 56795 URL: http://llvm.org/viewvc/llvm-project?rev=56795&view=rev Log: Fix grammer. 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=56795&r1=56794&r2=56795&view=diff ============================================================================== --- llvm/trunk/include/llvm/Function.h (original) +++ llvm/trunk/include/llvm/Function.h Mon Sep 29 13:16:38 2008 @@ -149,7 +149,7 @@ void setAttributes(const AttrListPtr &attrs) { AttributeList = attrs; } - /// hasFnAttr - Return true if this function has given attribute. + /// hasFnAttr - Return true if this function has the given attribute. bool hasFnAttr(Attributes N) const { // Function Attributes are stored at ~0 index return AttributeList.paramHasAttr(~0U, N); From dpatel at apple.com Mon Sep 29 13:16:54 2008 From: dpatel at apple.com (Devang Patel) Date: Mon, 29 Sep 2008 11:16:54 -0700 Subject: [llvm-commits] [llvm] r56716 - in /llvm/trunk: docs/ include/llvm/ lib/AsmParser/ lib/Target/X86/AsmPrinter/ lib/Transforms/IPO/ lib/Transforms/Scalar/ lib/Transforms/Utils/ lib/VMCore/ test/CodeGen/ARM/ test/Transforms/Inline/ In-Reply-To: <200809290938.08800.baldrick@free.fr> References: <200809262351.m8QNpKwo021728@zion.cs.uiuc.edu> <200809290938.08800.baldrick@free.fr> Message-ID: On Sep 29, 2008, at 12:38 AM, Duncan Sands wrote: > Hi Devang, > >> +
alwaysinline
>> +
This attribute requests inliner to inline this function >> irrespective of >> +inlining size threshold for this function.
> > probably best not to talk about thresholds here. How about: > "This attribute instructs the inliner to always inline this function > if it can". I think, it is a good idea to give them an idea of what is influenced here. >> +
This attribute suggests optimization passes and code generator >> passes to >> +make choices that help reduce code size.
> > How about: > "This attribute tells the optimizers and code generators that > reducing code > size is more important than making the function fast". What is the difference ? >> +
noreturn
>> +
This function attribute indicates that the function never >> returns. This >> + indicates to LLVM that every call to this function should be >> treated as if >> + an unreachable instruction immediately followed the >> call.
> > function attribute -> attribute This is not a parameter attribute. This is not a return attribute. This is a function attribute. > > This indicates to LLVM -> This tells LLVM ok > > >> +
nounwind
>> +
This function attribute indicates that no exceptions unwind >> out of the >> + function. Usually this is because the function makes no use of >> exceptions, > > function attribute -> attribute > >> +
readonly
>> +
This function attribute indicates that the function has no >> side-effects >> + except for producing a return value or throwing an exception. >> The value > > function attribute -> attribute > >> + /// hasFnAttr - Return true if this function has given attribute. > > given attribute -> the given attribute ok > > > Ciao, > > Duncan. - Devang From baldrick at free.fr Mon Sep 29 13:27:24 2008 From: baldrick at free.fr (Duncan Sands) Date: Mon, 29 Sep 2008 20:27:24 +0200 Subject: [llvm-commits] [llvm] r56716 - in /llvm/trunk: docs/ include/llvm/ lib/AsmParser/ lib/Target/X86/AsmPrinter/ lib/Transforms/IPO/ lib/Transforms/Scalar/ lib/Transforms/Utils/ lib/VMCore/ test/CodeGen/ARM/ test/Transforms/Inline/ In-Reply-To: References: <200809262351.m8QNpKwo021728@zion.cs.uiuc.edu> <200809290938.08800.baldrick@free.fr> Message-ID: <200809292027.24344.baldrick@free.fr> > >> +
This attribute suggests optimization passes and code generator > >> passes to > >> +make choices that help reduce code size.
> > > > How about: > > "This attribute tells the optimizers and code generators that > > reducing code > > size is more important than making the function fast". > > What is the difference ? I don't think "suggests X to do Y" is correct English, but I could be wrong. Ciao, Duncan. From dpatel at apple.com Mon Sep 29 13:34:50 2008 From: dpatel at apple.com (Devang Patel) Date: Mon, 29 Sep 2008 18:34:50 -0000 Subject: [llvm-commits] [llvm] r56796 - /llvm/trunk/docs/LangRef.html Message-ID: <200809291834.m8TIYoZ5001089@zion.cs.uiuc.edu> Author: dpatel Date: Mon Sep 29 13:34:44 2008 New Revision: 56796 URL: http://llvm.org/viewvc/llvm-project?rev=56796&view=rev Log: Fix grammar. 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=56796&r1=56795&r2=56796&view=diff ============================================================================== --- llvm/trunk/docs/LangRef.html (original) +++ llvm/trunk/docs/LangRef.html Mon Sep 29 13:34:44 2008 @@ -930,7 +930,7 @@ attribute.
optsize
-
This attribute suggests optimization passes and code generator passes to +
This attribute suggests that optimization passes and code generator passes make choices that help reduce code size.
noreturn
From kremenek at apple.com Mon Sep 29 14:17:48 2008 From: kremenek at apple.com (Ted Kremenek) Date: Mon, 29 Sep 2008 19:17:48 -0000 Subject: [llvm-commits] [llvm] r56798 - /llvm/tags/checker/checker-102/ Message-ID: <200809291917.m8TJHm8R006535@zion.cs.uiuc.edu> Author: kremenek Date: Mon Sep 29 14:17:48 2008 New Revision: 56798 URL: http://llvm.org/viewvc/llvm-project?rev=56798&view=rev Log: Tagging checker-102. Added: llvm/tags/checker/checker-102/ - copied from r56797, llvm/trunk/ From dpatel at apple.com Mon Sep 29 15:49:51 2008 From: dpatel at apple.com (Devang Patel) Date: Mon, 29 Sep 2008 20:49:51 -0000 Subject: [llvm-commits] [llvm] r56801 - in /llvm/trunk: lib/AsmParser/llvmAsmParser.cpp.cvs lib/AsmParser/llvmAsmParser.y lib/AsmParser/llvmAsmParser.y.cvs lib/VMCore/AsmWriter.cpp test/Assembler/2008-09-02-FunctionNotes.ll test/Assembler/2008-09-02-FunctionNotes2.ll test/Assembler/2008-09-29-RetAttr.ll test/Transforms/DeadArgElim/keepalive.ll Message-ID: <200809292049.m8TKnqbf017763@zion.cs.uiuc.edu> Author: dpatel Date: Mon Sep 29 15:49:50 2008 New Revision: 56801 URL: http://llvm.org/viewvc/llvm-project?rev=56801&view=rev Log: Support inreg, zext and sext as return value attributes. Added: llvm/trunk/test/Assembler/2008-09-29-RetAttr.ll Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs llvm/trunk/lib/AsmParser/llvmAsmParser.y llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs llvm/trunk/lib/VMCore/AsmWriter.cpp llvm/trunk/test/Assembler/2008-09-02-FunctionNotes.ll llvm/trunk/test/Assembler/2008-09-02-FunctionNotes2.ll llvm/trunk/test/Transforms/DeadArgElim/keepalive.ll Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs?rev=56801&r1=56800&r2=56801&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs (original) +++ llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs Mon Sep 29 15:49:50 2008 @@ -224,14 +224,12 @@ READNONE = 405, READONLY = 406, GC = 407, - FNNOTE = 408, - INLINE = 409, - ALWAYS = 410, - NEVER = 411, - OPTIMIZEFORSIZE = 412, - DEFAULT = 413, - HIDDEN = 414, - PROTECTED = 415 + OPTSIZE = 408, + NOINLINE = 409, + ALWAYSINLINE = 410, + DEFAULT = 411, + HIDDEN = 412, + PROTECTED = 413 }; #endif /* Tokens. */ @@ -385,20 +383,18 @@ #define READNONE 405 #define READONLY 406 #define GC 407 -#define FNNOTE 408 -#define INLINE 409 -#define ALWAYS 410 -#define NEVER 411 -#define OPTIMIZEFORSIZE 412 -#define DEFAULT 413 -#define HIDDEN 414 -#define PROTECTED 415 +#define OPTSIZE 408 +#define NOINLINE 409 +#define ALWAYSINLINE 410 +#define DEFAULT 411 +#define HIDDEN 412 +#define PROTECTED 413 /* Copy the first part of user declarations. */ -#line 14 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 14 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" #include "ParserInternals.h" #include "llvm/CallingConv.h" @@ -1375,7 +1371,7 @@ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 970 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 970 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { llvm::Module *ModuleVal; llvm::Function *FunctionVal; @@ -1424,7 +1420,7 @@ llvm::FCmpInst::Predicate FPredicate; } /* Line 193 of yacc.c. */ -#line 1428 "llvmAsmParser.tab.c" +#line 1424 "llvmAsmParser.tab.c" YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 @@ -1437,7 +1433,7 @@ /* Line 216 of yacc.c. */ -#line 1441 "llvmAsmParser.tab.c" +#line 1437 "llvmAsmParser.tab.c" #ifdef short # undef short @@ -1652,20 +1648,20 @@ /* YYFINAL -- State number of the termination state. */ #define YYFINAL 44 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 2344 +#define YYLAST 2439 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 175 +#define YYNTOKENS 173 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 90 +#define YYNNTS 89 /* YYNRULES -- Number of rules. */ -#define YYNRULES 353 +#define YYNRULES 354 /* YYNRULES -- Number of states. */ -#define YYNSTATES 720 +#define YYNSTATES 717 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 415 +#define YYMAXUTOK 413 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -1677,15 +1673,15 @@ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 161, 162, 165, 2, 164, 2, 2, 2, 2, 2, + 159, 160, 163, 2, 162, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 170, 163, 171, 2, 2, 2, 2, 2, 2, 2, + 168, 161, 169, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 167, 166, 169, 2, 2, 2, 2, 2, 174, + 2, 165, 164, 167, 2, 2, 2, 2, 2, 172, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 168, 2, 2, 172, 2, 173, 2, 2, 2, 2, + 166, 2, 2, 170, 2, 171, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -1714,7 +1710,7 @@ 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159, 160 + 155, 156, 157, 158 }; #if YYDEBUG @@ -1734,36 +1730,36 @@ 179, 181, 183, 184, 186, 188, 190, 192, 193, 195, 197, 198, 200, 202, 204, 206, 208, 211, 213, 215, 217, 219, 221, 223, 225, 227, 229, 232, 233, 236, - 238, 240, 242, 244, 246, 248, 250, 251, 254, 256, - 260, 264, 268, 270, 271, 276, 277, 280, 281, 284, - 285, 289, 292, 293, 295, 296, 300, 302, 305, 307, - 309, 311, 313, 315, 317, 319, 321, 323, 327, 329, - 332, 338, 344, 350, 356, 360, 363, 369, 374, 377, - 379, 381, 383, 387, 389, 393, 395, 396, 398, 402, - 407, 411, 415, 420, 425, 429, 436, 442, 445, 448, - 451, 454, 457, 460, 463, 466, 469, 472, 475, 478, - 485, 491, 500, 507, 514, 522, 530, 538, 546, 553, - 562, 571, 577, 585, 589, 591, 593, 595, 597, 598, - 601, 608, 610, 611, 613, 616, 617, 621, 622, 626, - 630, 634, 638, 639, 648, 649, 659, 660, 670, 676, - 679, 683, 685, 689, 693, 697, 701, 703, 704, 710, - 714, 716, 720, 722, 723, 735, 737, 739, 744, 746, - 748, 751, 755, 756, 758, 760, 762, 764, 766, 768, - 770, 772, 774, 776, 778, 782, 786, 789, 792, 796, - 799, 805, 810, 812, 818, 820, 822, 824, 826, 828, - 830, 833, 835, 839, 842, 845, 849, 853, 856, 857, - 859, 862, 865, 869, 879, 889, 898, 913, 915, 917, - 924, 930, 933, 936, 943, 951, 956, 961, 968, 975, - 976, 977, 981, 984, 988, 991, 993, 999, 1005, 1012, - 1019, 1026, 1033, 1038, 1045, 1050, 1055, 1062, 1069, 1072, - 1081, 1083, 1085, 1086, 1090, 1097, 1101, 1108, 1111, 1117, - 1125, 1131, 1136, 1141 + 238, 240, 242, 243, 246, 248, 250, 252, 254, 256, + 258, 260, 262, 264, 266, 267, 270, 271, 274, 275, + 278, 279, 283, 286, 287, 289, 290, 294, 296, 299, + 301, 303, 305, 307, 309, 311, 313, 315, 317, 321, + 323, 326, 332, 338, 344, 350, 354, 357, 363, 368, + 371, 373, 375, 377, 381, 383, 387, 389, 390, 392, + 396, 401, 405, 409, 414, 419, 423, 430, 436, 439, + 442, 445, 448, 451, 454, 457, 460, 463, 466, 469, + 472, 479, 485, 494, 501, 508, 516, 524, 532, 540, + 547, 556, 565, 571, 579, 583, 585, 587, 589, 591, + 592, 595, 602, 604, 605, 607, 610, 611, 615, 616, + 620, 624, 628, 632, 633, 642, 643, 653, 654, 664, + 670, 673, 677, 679, 683, 687, 691, 695, 697, 698, + 704, 708, 710, 714, 716, 717, 729, 731, 733, 738, + 740, 742, 745, 749, 750, 752, 754, 756, 758, 760, + 762, 764, 766, 768, 770, 772, 776, 780, 783, 786, + 790, 793, 799, 804, 806, 812, 814, 816, 818, 820, + 822, 824, 827, 829, 833, 836, 839, 843, 847, 850, + 851, 853, 856, 859, 863, 873, 883, 892, 908, 910, + 912, 919, 925, 928, 931, 938, 946, 951, 956, 963, + 970, 971, 972, 976, 979, 983, 986, 988, 994, 1000, + 1007, 1014, 1021, 1028, 1033, 1040, 1045, 1050, 1057, 1064, + 1067, 1077, 1079, 1081, 1082, 1086, 1093, 1097, 1104, 1107, + 1113, 1121, 1127, 1132, 1137 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int16 yyrhs[] = { - 225, 0, -1, 75, -1, 76, -1, 77, -1, 78, + 222, 0, -1, 75, -1, 76, -1, 77, -1, 78, -1, 79, -1, 80, -1, 81, -1, 82, -1, 83, -1, 87, -1, 88, -1, 89, -1, 84, -1, 85, -1, 86, -1, 120, -1, 121, -1, 122, -1, 123, @@ -1775,150 +1771,150 @@ -1, 111, -1, 112, -1, 113, -1, 100, -1, 101, -1, 102, -1, 103, -1, 26, -1, 27, -1, 11, -1, 12, -1, 13, -1, 16, -1, 15, -1, 14, - -1, 19, -1, 22, -1, 24, -1, 183, -1, -1, - 55, 161, 4, 162, -1, -1, 183, 163, -1, -1, - 7, 163, -1, 20, -1, 23, -1, 190, -1, -1, - 188, 163, -1, 42, -1, 44, -1, 43, -1, 45, + -1, 19, -1, 22, -1, 24, -1, 181, -1, -1, + 55, 159, 4, 160, -1, -1, 181, 161, -1, -1, + 7, 161, -1, 20, -1, 23, -1, 188, -1, -1, + 186, 161, -1, 42, -1, 44, -1, 43, -1, 45, -1, 47, -1, 49, -1, 46, -1, 48, -1, 51, - -1, -1, 158, -1, 159, -1, 160, -1, -1, 46, + -1, -1, 156, -1, 157, -1, 158, -1, -1, 46, -1, 48, -1, -1, 42, -1, 43, -1, 44, -1, 47, -1, -1, 44, -1, 42, -1, -1, 63, -1, 64, -1, 65, -1, 66, -1, 67, -1, 62, 4, -1, 142, -1, 121, -1, 141, -1, 122, -1, 144, -1, 145, -1, 147, -1, 148, -1, 149, -1, 54, - 4, -1, -1, 199, 198, -1, 143, -1, 146, -1, + 4, -1, -1, 197, 196, -1, 144, -1, 142, -1, + 141, -1, -1, 199, 198, -1, 143, -1, 146, -1, 144, -1, 142, -1, 141, -1, 150, -1, 151, -1, - -1, 201, 200, -1, 203, -1, 202, 164, 203, -1, - 154, 163, 156, -1, 154, 163, 155, -1, 157, -1, - -1, 153, 161, 202, 162, -1, -1, 152, 22, -1, - -1, 54, 4, -1, -1, 164, 54, 4, -1, 34, - 22, -1, -1, 208, -1, -1, 164, 211, 210, -1, - 208, -1, 54, 4, -1, 11, -1, 12, -1, 13, - -1, 16, -1, 15, -1, 14, -1, 17, -1, 50, - -1, 212, -1, 213, 185, 165, -1, 247, -1, 166, - 4, -1, 213, 161, 217, 162, 201, -1, 10, 161, - 217, 162, 201, -1, 167, 4, 168, 213, 169, -1, - 170, 4, 168, 213, 171, -1, 172, 218, 173, -1, - 172, 173, -1, 170, 172, 218, 173, 171, -1, 170, - 172, 173, 171, -1, 213, 199, -1, 213, -1, 10, - -1, 214, -1, 216, 164, 214, -1, 216, -1, 216, - 164, 39, -1, 39, -1, -1, 213, -1, 218, 164, - 213, -1, 213, 167, 221, 169, -1, 213, 167, 169, - -1, 213, 174, 22, -1, 213, 170, 221, 171, -1, - 213, 172, 221, 173, -1, 213, 172, 173, -1, 213, - 170, 172, 221, 173, 171, -1, 213, 170, 172, 173, - 171, -1, 213, 40, -1, 213, 41, -1, 213, 247, - -1, 213, 220, -1, 213, 25, -1, 181, 3, -1, - 181, 5, -1, 181, 4, -1, 181, 6, -1, 11, - 26, -1, 11, 27, -1, 182, 9, -1, 178, 161, - 219, 38, 213, 162, -1, 119, 161, 219, 259, 162, - -1, 133, 161, 219, 164, 219, 164, 219, 162, -1, - 176, 161, 219, 164, 219, 162, -1, 177, 161, 219, - 164, 219, 162, -1, 90, 179, 161, 219, 164, 219, - 162, -1, 91, 180, 161, 219, 164, 219, 162, -1, - 92, 179, 161, 219, 164, 219, 162, -1, 93, 180, - 161, 219, 164, 219, 162, -1, 135, 161, 219, 164, - 219, 162, -1, 136, 161, 219, 164, 219, 164, 219, - 162, -1, 137, 161, 219, 164, 219, 164, 219, 162, - -1, 139, 161, 219, 260, 162, -1, 140, 161, 219, - 164, 219, 260, 162, -1, 221, 164, 219, -1, 219, - -1, 32, -1, 33, -1, 37, -1, -1, 215, 247, - -1, 125, 161, 224, 38, 213, 162, -1, 226, -1, - -1, 227, -1, 226, 227, -1, -1, 31, 228, 243, - -1, -1, 30, 229, 244, -1, 60, 59, 233, -1, - 186, 18, 213, -1, 186, 18, 10, -1, -1, 189, - 193, 223, 222, 219, 185, 230, 210, -1, -1, 189, - 191, 193, 223, 222, 219, 185, 231, 210, -1, -1, - 189, 192, 193, 223, 222, 213, 185, 232, 210, -1, - 189, 193, 35, 196, 224, -1, 52, 234, -1, 56, - 163, 235, -1, 22, -1, 53, 163, 22, -1, 68, - 163, 22, -1, 167, 236, 169, -1, 236, 164, 22, - -1, 22, -1, -1, 237, 164, 213, 199, 184, -1, - 213, 199, 184, -1, 237, -1, 237, 164, 39, -1, - 39, -1, -1, 197, 215, 188, 161, 238, 162, 201, - 209, 206, 205, 204, -1, 28, -1, 172, -1, 195, - 193, 239, 240, -1, 29, -1, 173, -1, 251, 242, - -1, 194, 193, 239, -1, -1, 61, -1, 3, -1, - 4, -1, 5, -1, 6, -1, 9, -1, 26, -1, - 27, -1, 40, -1, 41, -1, 25, -1, 170, 221, - 171, -1, 167, 221, 169, -1, 167, 169, -1, 174, - 22, -1, 172, 221, 173, -1, 172, 173, -1, 170, - 172, 221, 173, 171, -1, 170, 172, 173, 171, -1, - 220, -1, 59, 245, 22, 164, 22, -1, 7, -1, - 8, -1, 183, -1, 188, -1, 247, -1, 246, -1, - 213, 248, -1, 249, -1, 250, 164, 249, -1, 251, - 252, -1, 241, 252, -1, 253, 186, 254, -1, 253, - 187, 254, -1, 253, 256, -1, -1, 21, -1, 69, - 250, -1, 69, 10, -1, 70, 17, 248, -1, 70, - 11, 248, 164, 17, 248, 164, 17, 248, -1, 71, - 181, 248, 164, 17, 248, 167, 255, 169, -1, 71, - 181, 248, 164, 17, 248, 167, 169, -1, 72, 197, - 215, 248, 161, 258, 162, 201, 38, 17, 248, 73, - 17, 248, -1, 73, -1, 74, -1, 255, 181, 246, - 164, 17, 248, -1, 181, 246, 164, 17, 248, -1, - 186, 262, -1, 187, 262, -1, 213, 167, 248, 164, - 248, 169, -1, 257, 164, 167, 248, 164, 248, 169, - -1, 213, 199, 248, 199, -1, 17, 199, 248, 199, - -1, 258, 164, 213, 199, 248, 199, -1, 258, 164, - 17, 199, 248, 199, -1, -1, -1, 259, 164, 249, - -1, 164, 4, -1, 260, 164, 4, -1, 58, 57, - -1, 57, -1, 176, 213, 248, 164, 248, -1, 177, - 213, 248, 164, 248, -1, 90, 179, 213, 248, 164, - 248, -1, 91, 180, 213, 248, 164, 248, -1, 92, - 179, 213, 248, 164, 248, -1, 93, 180, 213, 248, - 164, 248, -1, 178, 249, 38, 213, -1, 133, 249, - 164, 249, 164, 249, -1, 134, 249, 164, 213, -1, - 135, 249, 164, 249, -1, 136, 249, 164, 249, 164, - 249, -1, 137, 249, 164, 249, 164, 249, -1, 132, - 257, -1, 261, 197, 215, 248, 161, 258, 162, 201, - -1, 264, -1, 36, -1, -1, 114, 213, 207, -1, - 114, 213, 164, 11, 248, 207, -1, 115, 213, 207, - -1, 115, 213, 164, 11, 248, 207, -1, 116, 249, - -1, 263, 117, 213, 248, 207, -1, 263, 118, 249, - 164, 213, 248, 207, -1, 138, 213, 248, 164, 4, - -1, 119, 213, 248, 259, -1, 139, 213, 248, 260, - -1, 140, 213, 248, 164, 213, 248, 260, -1 + 154, -1, 155, -1, 153, -1, -1, 201, 200, -1, + -1, 152, 22, -1, -1, 54, 4, -1, -1, 162, + 54, 4, -1, 34, 22, -1, -1, 205, -1, -1, + 162, 208, 207, -1, 205, -1, 54, 4, -1, 11, + -1, 12, -1, 13, -1, 16, -1, 15, -1, 14, + -1, 17, -1, 50, -1, 209, -1, 210, 183, 163, + -1, 244, -1, 164, 4, -1, 210, 159, 214, 160, + 201, -1, 10, 159, 214, 160, 201, -1, 165, 4, + 166, 210, 167, -1, 168, 4, 166, 210, 169, -1, + 170, 215, 171, -1, 170, 171, -1, 168, 170, 215, + 171, 169, -1, 168, 170, 171, 169, -1, 210, 197, + -1, 210, -1, 10, -1, 211, -1, 213, 162, 211, + -1, 213, -1, 213, 162, 39, -1, 39, -1, -1, + 210, -1, 215, 162, 210, -1, 210, 165, 218, 167, + -1, 210, 165, 167, -1, 210, 172, 22, -1, 210, + 168, 218, 169, -1, 210, 170, 218, 171, -1, 210, + 170, 171, -1, 210, 168, 170, 218, 171, 169, -1, + 210, 168, 170, 171, 169, -1, 210, 40, -1, 210, + 41, -1, 210, 244, -1, 210, 217, -1, 210, 25, + -1, 179, 3, -1, 179, 5, -1, 179, 4, -1, + 179, 6, -1, 11, 26, -1, 11, 27, -1, 180, + 9, -1, 176, 159, 216, 38, 210, 160, -1, 119, + 159, 216, 256, 160, -1, 133, 159, 216, 162, 216, + 162, 216, 160, -1, 174, 159, 216, 162, 216, 160, + -1, 175, 159, 216, 162, 216, 160, -1, 90, 177, + 159, 216, 162, 216, 160, -1, 91, 178, 159, 216, + 162, 216, 160, -1, 92, 177, 159, 216, 162, 216, + 160, -1, 93, 178, 159, 216, 162, 216, 160, -1, + 135, 159, 216, 162, 216, 160, -1, 136, 159, 216, + 162, 216, 162, 216, 160, -1, 137, 159, 216, 162, + 216, 162, 216, 160, -1, 139, 159, 216, 257, 160, + -1, 140, 159, 216, 162, 216, 257, 160, -1, 218, + 162, 216, -1, 216, -1, 32, -1, 33, -1, 37, + -1, -1, 212, 244, -1, 125, 159, 221, 38, 210, + 160, -1, 223, -1, -1, 224, -1, 223, 224, -1, + -1, 31, 225, 240, -1, -1, 30, 226, 241, -1, + 60, 59, 230, -1, 184, 18, 210, -1, 184, 18, + 10, -1, -1, 187, 191, 220, 219, 216, 183, 227, + 207, -1, -1, 187, 189, 191, 220, 219, 216, 183, + 228, 207, -1, -1, 187, 190, 191, 220, 219, 210, + 183, 229, 207, -1, 187, 191, 35, 194, 221, -1, + 52, 231, -1, 56, 161, 232, -1, 22, -1, 53, + 161, 22, -1, 68, 161, 22, -1, 165, 233, 167, + -1, 233, 162, 22, -1, 22, -1, -1, 234, 162, + 210, 197, 182, -1, 210, 197, 182, -1, 234, -1, + 234, 162, 39, -1, 39, -1, -1, 195, 199, 212, + 186, 159, 235, 160, 201, 206, 203, 202, -1, 28, + -1, 170, -1, 193, 191, 236, 237, -1, 29, -1, + 171, -1, 248, 239, -1, 192, 191, 236, -1, -1, + 61, -1, 3, -1, 4, -1, 5, -1, 6, -1, + 9, -1, 26, -1, 27, -1, 40, -1, 41, -1, + 25, -1, 168, 218, 169, -1, 165, 218, 167, -1, + 165, 167, -1, 172, 22, -1, 170, 218, 171, -1, + 170, 171, -1, 168, 170, 218, 171, 169, -1, 168, + 170, 171, 169, -1, 217, -1, 59, 242, 22, 162, + 22, -1, 7, -1, 8, -1, 181, -1, 186, -1, + 244, -1, 243, -1, 210, 245, -1, 246, -1, 247, + 162, 246, -1, 248, 249, -1, 238, 249, -1, 250, + 184, 251, -1, 250, 185, 251, -1, 250, 253, -1, + -1, 21, -1, 69, 247, -1, 69, 10, -1, 70, + 17, 245, -1, 70, 11, 245, 162, 17, 245, 162, + 17, 245, -1, 71, 179, 245, 162, 17, 245, 165, + 252, 167, -1, 71, 179, 245, 162, 17, 245, 165, + 167, -1, 72, 195, 199, 212, 245, 159, 255, 160, + 201, 38, 17, 245, 73, 17, 245, -1, 73, -1, + 74, -1, 252, 179, 243, 162, 17, 245, -1, 179, + 243, 162, 17, 245, -1, 184, 259, -1, 185, 259, + -1, 210, 165, 245, 162, 245, 167, -1, 254, 162, + 165, 245, 162, 245, 167, -1, 210, 197, 245, 197, + -1, 17, 197, 245, 197, -1, 255, 162, 210, 197, + 245, 197, -1, 255, 162, 17, 197, 245, 197, -1, + -1, -1, 256, 162, 246, -1, 162, 4, -1, 257, + 162, 4, -1, 58, 57, -1, 57, -1, 174, 210, + 245, 162, 245, -1, 175, 210, 245, 162, 245, -1, + 90, 177, 210, 245, 162, 245, -1, 91, 178, 210, + 245, 162, 245, -1, 92, 177, 210, 245, 162, 245, + -1, 93, 178, 210, 245, 162, 245, -1, 176, 246, + 38, 210, -1, 133, 246, 162, 246, 162, 246, -1, + 134, 246, 162, 210, -1, 135, 246, 162, 246, -1, + 136, 246, 162, 246, 162, 246, -1, 137, 246, 162, + 246, 162, 246, -1, 132, 254, -1, 258, 195, 199, + 212, 245, 159, 255, 160, 201, -1, 261, -1, 36, + -1, -1, 114, 210, 204, -1, 114, 210, 162, 11, + 245, 204, -1, 115, 210, 204, -1, 115, 210, 162, + 11, 245, 204, -1, 116, 246, -1, 260, 117, 210, + 245, 204, -1, 260, 118, 246, 162, 210, 245, 204, + -1, 138, 210, 245, 162, 4, -1, 119, 210, 245, + 256, -1, 139, 210, 245, 257, -1, 140, 210, 245, + 162, 210, 245, 257, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 1140, 1140, 1140, 1140, 1140, 1140, 1140, 1140, 1140, - 1140, 1141, 1141, 1141, 1141, 1141, 1141, 1142, 1142, 1142, - 1142, 1142, 1142, 1143, 1143, 1143, 1143, 1143, 1143, 1146, - 1146, 1147, 1147, 1148, 1148, 1149, 1149, 1150, 1150, 1154, - 1154, 1155, 1155, 1156, 1156, 1157, 1157, 1158, 1158, 1159, - 1159, 1160, 1160, 1161, 1162, 1167, 1168, 1168, 1168, 1168, - 1168, 1170, 1170, 1170, 1171, 1171, 1173, 1174, 1178, 1182, - 1187, 1193, 1193, 1195, 1196, 1201, 1207, 1208, 1209, 1210, - 1211, 1212, 1216, 1217, 1218, 1222, 1223, 1224, 1225, 1229, - 1230, 1231, 1235, 1236, 1237, 1238, 1239, 1243, 1244, 1245, - 1248, 1249, 1250, 1251, 1252, 1253, 1254, 1261, 1262, 1263, - 1264, 1265, 1266, 1267, 1268, 1269, 1270, 1274, 1275, 1280, - 1281, 1282, 1283, 1284, 1285, 1286, 1289, 1290, 1295, 1296, - 1309, 1310, 1311, 1314, 1315, 1320, 1321, 1328, 1329, 1335, - 1336, 1345, 1353, 1354, 1359, 1360, 1361, 1366, 1379, 1379, - 1379, 1379, 1379, 1379, 1379, 1382, 1386, 1390, 1397, 1402, - 1410, 1439, 1464, 1469, 1479, 1489, 1493, 1503, 1510, 1519, - 1526, 1531, 1536, 1543, 1544, 1551, 1558, 1566, 1572, 1584, - 1612, 1628, 1655, 1683, 1709, 1729, 1755, 1775, 1787, 1794, - 1860, 1870, 1880, 1886, 1896, 1902, 1912, 1918, 1924, 1937, - 1949, 1970, 1978, 1984, 1995, 2000, 2005, 2010, 2015, 2021, - 2027, 2033, 2041, 2052, 2056, 2064, 2064, 2067, 2067, 2070, - 2082, 2103, 2108, 2116, 2117, 2121, 2121, 2125, 2125, 2128, - 2131, 2155, 2167, 2166, 2178, 2177, 2187, 2186, 2197, 2237, - 2240, 2246, 2256, 2260, 2265, 2267, 2272, 2277, 2286, 2296, - 2307, 2311, 2320, 2329, 2334, 2485, 2485, 2487, 2496, 2496, - 2498, 2503, 2515, 2519, 2524, 2528, 2532, 2537, 2542, 2546, - 2550, 2554, 2558, 2562, 2566, 2588, 2610, 2616, 2629, 2641, - 2646, 2658, 2664, 2668, 2678, 2682, 2686, 2691, 2698, 2698, - 2704, 2713, 2718, 2723, 2727, 2736, 2745, 2758, 2767, 2771, - 2779, 2799, 2803, 2808, 2819, 2838, 2847, 2951, 2955, 2962, - 2973, 2986, 2995, 3008, 3019, 3029, 3040, 3048, 3058, 3065, - 3068, 3069, 3077, 3083, 3092, 3096, 3101, 3117, 3134, 3146, - 3158, 3172, 3186, 3198, 3219, 3226, 3232, 3238, 3244, 3259, - 3369, 3374, 3378, 3385, 3392, 3402, 3409, 3419, 3427, 3441, - 3458, 3472, 3487, 3502 + 0, 1136, 1136, 1136, 1136, 1136, 1136, 1136, 1136, 1136, + 1136, 1137, 1137, 1137, 1137, 1137, 1137, 1138, 1138, 1138, + 1138, 1138, 1138, 1139, 1139, 1139, 1139, 1139, 1139, 1142, + 1142, 1143, 1143, 1144, 1144, 1145, 1145, 1146, 1146, 1150, + 1150, 1151, 1151, 1152, 1152, 1153, 1153, 1154, 1154, 1155, + 1155, 1156, 1156, 1157, 1158, 1163, 1164, 1164, 1164, 1164, + 1164, 1166, 1166, 1166, 1167, 1167, 1169, 1170, 1174, 1178, + 1183, 1189, 1189, 1191, 1192, 1197, 1203, 1204, 1205, 1206, + 1207, 1208, 1212, 1213, 1214, 1218, 1219, 1220, 1221, 1225, + 1226, 1227, 1231, 1232, 1233, 1234, 1235, 1239, 1240, 1241, + 1244, 1245, 1246, 1247, 1248, 1249, 1250, 1257, 1258, 1259, + 1260, 1261, 1262, 1263, 1264, 1265, 1266, 1270, 1271, 1276, + 1277, 1278, 1281, 1282, 1288, 1289, 1290, 1291, 1292, 1293, + 1294, 1295, 1296, 1297, 1300, 1301, 1307, 1308, 1315, 1316, + 1322, 1323, 1332, 1340, 1341, 1346, 1347, 1348, 1353, 1366, + 1366, 1366, 1366, 1366, 1366, 1366, 1369, 1373, 1377, 1384, + 1389, 1397, 1426, 1451, 1456, 1466, 1476, 1480, 1490, 1497, + 1506, 1513, 1518, 1523, 1530, 1531, 1538, 1545, 1553, 1559, + 1571, 1599, 1615, 1642, 1670, 1696, 1716, 1742, 1762, 1774, + 1781, 1847, 1857, 1867, 1873, 1883, 1889, 1899, 1905, 1911, + 1924, 1936, 1957, 1965, 1971, 1982, 1987, 1992, 1997, 2002, + 2008, 2014, 2020, 2028, 2039, 2043, 2051, 2051, 2054, 2054, + 2057, 2069, 2090, 2095, 2103, 2104, 2108, 2108, 2112, 2112, + 2115, 2118, 2142, 2154, 2153, 2165, 2164, 2174, 2173, 2184, + 2224, 2227, 2233, 2243, 2247, 2252, 2254, 2259, 2264, 2273, + 2283, 2294, 2298, 2307, 2316, 2321, 2469, 2469, 2471, 2480, + 2480, 2482, 2487, 2499, 2503, 2508, 2512, 2516, 2521, 2526, + 2530, 2534, 2538, 2542, 2546, 2550, 2572, 2594, 2600, 2613, + 2625, 2630, 2642, 2648, 2652, 2662, 2666, 2670, 2675, 2682, + 2682, 2688, 2697, 2702, 2707, 2711, 2720, 2729, 2742, 2751, + 2755, 2763, 2783, 2787, 2792, 2803, 2822, 2831, 2935, 2939, + 2946, 2957, 2970, 2979, 2992, 3003, 3013, 3024, 3032, 3042, + 3049, 3052, 3053, 3061, 3067, 3076, 3080, 3085, 3101, 3118, + 3130, 3142, 3156, 3170, 3182, 3203, 3210, 3216, 3222, 3228, + 3243, 3353, 3358, 3362, 3369, 3376, 3386, 3393, 3403, 3411, + 3425, 3442, 3456, 3471, 3486 }; #endif @@ -1950,28 +1946,28 @@ "SELECT", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR", "GETRESULT", "EXTRACTVALUE", "INSERTVALUE", "SIGNEXT", "ZEROEXT", "NORETURN", "INREG", "SRET", "NOUNWIND", "NOALIAS", "BYVAL", "NEST", - "READNONE", "READONLY", "GC", "FNNOTE", "INLINE", "ALWAYS", "NEVER", - "OPTIMIZEFORSIZE", "DEFAULT", "HIDDEN", "PROTECTED", "'('", "')'", "'='", - "','", "'*'", "'\\\\'", "'['", "'x'", "']'", "'<'", "'>'", "'{'", "'}'", - "'c'", "$accept", "ArithmeticOps", "LogicalOps", "CastOps", - "IPredicates", "FPredicates", "IntType", "FPType", "LocalName", - "OptLocalName", "OptAddrSpace", "OptLocalAssign", "LocalNumber", - "GlobalName", "OptGlobalAssign", "GlobalAssign", "GVInternalLinkage", + "READNONE", "READONLY", "GC", "OPTSIZE", "NOINLINE", "ALWAYSINLINE", + "DEFAULT", "HIDDEN", "PROTECTED", "'('", "')'", "'='", "','", "'*'", + "'\\\\'", "'['", "'x'", "']'", "'<'", "'>'", "'{'", "'}'", "'c'", + "$accept", "ArithmeticOps", "LogicalOps", "CastOps", "IPredicates", + "FPredicates", "IntType", "FPType", "LocalName", "OptLocalName", + "OptAddrSpace", "OptLocalAssign", "LocalNumber", "GlobalName", + "OptGlobalAssign", "GlobalAssign", "GVInternalLinkage", "GVExternalLinkage", "GVVisibilityStyle", "FunctionDeclareLinkage", "FunctionDefineLinkage", "AliasLinkage", "OptCallingConv", "Attribute", - "OptAttributes", "FuncAttr", "OptFuncAttrs", "FuncNoteList", "FuncNote", - "OptFuncNotes", "OptGC", "OptAlign", "OptCAlign", "SectionString", - "OptSection", "GlobalVarAttributes", "GlobalVarAttribute", "PrimType", - "Types", "ArgType", "ResultTypes", "ArgTypeList", "ArgTypeListI", - "TypeListI", "ConstVal", "ConstExpr", "ConstVector", "GlobalType", - "ThreadLocal", "AliaseeRef", "Module", "DefinitionList", "Definition", - "@1", "@2", "@3", "@4", "@5", "AsmBlock", "TargetDefinition", - "LibrariesDefinition", "LibList", "ArgListH", "ArgList", - "FunctionHeaderH", "BEGIN", "FunctionHeader", "END", "Function", - "FunctionProto", "OptSideEffect", "ConstValueRef", "SymbolicValueRef", - "ValueRef", "ResolvedVal", "ReturnedVal", "BasicBlockList", "BasicBlock", - "InstructionList", "BBTerminatorInst", "JumpTable", "Inst", "PHIList", - "ParamList", "IndexList", "ConstantIndexList", "OptTailCall", "InstVal", + "OptAttributes", "RetAttr", "OptRetAttrs", "FuncAttr", "OptFuncAttrs", + "OptGC", "OptAlign", "OptCAlign", "SectionString", "OptSection", + "GlobalVarAttributes", "GlobalVarAttribute", "PrimType", "Types", + "ArgType", "ResultTypes", "ArgTypeList", "ArgTypeListI", "TypeListI", + "ConstVal", "ConstExpr", "ConstVector", "GlobalType", "ThreadLocal", + "AliaseeRef", "Module", "DefinitionList", "Definition", "@1", "@2", "@3", + "@4", "@5", "AsmBlock", "TargetDefinition", "LibrariesDefinition", + "LibList", "ArgListH", "ArgList", "FunctionHeaderH", "BEGIN", + "FunctionHeader", "END", "Function", "FunctionProto", "OptSideEffect", + "ConstValueRef", "SymbolicValueRef", "ValueRef", "ResolvedVal", + "ReturnedVal", "BasicBlockList", "BasicBlock", "InstructionList", + "BBTerminatorInst", "JumpTable", "Inst", "PHIList", "ParamList", + "IndexList", "ConstantIndexList", "OptTailCall", "InstVal", "OptVolatile", "MemoryInst", 0 }; #endif @@ -1996,51 +1992,51 @@ 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, - 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, - 415, 40, 41, 61, 44, 42, 92, 91, 120, 93, - 60, 62, 123, 125, 99 + 405, 406, 407, 408, 409, 410, 411, 412, 413, 40, + 41, 61, 44, 42, 92, 91, 120, 93, 60, 62, + 123, 125, 99 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint16 yyr1[] = { - 0, 175, 176, 176, 176, 176, 176, 176, 176, 176, - 176, 177, 177, 177, 177, 177, 177, 178, 178, 178, - 178, 178, 178, 178, 178, 178, 178, 178, 178, 179, - 179, 179, 179, 179, 179, 179, 179, 179, 179, 180, - 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, - 180, 180, 180, 180, 180, 181, 182, 182, 182, 182, - 182, 183, 183, 183, 184, 184, 185, 185, 186, 186, - 187, 188, 188, 189, 189, 190, 191, 191, 191, 191, - 191, 191, 192, 192, 192, 193, 193, 193, 193, 194, - 194, 194, 195, 195, 195, 195, 195, 196, 196, 196, - 197, 197, 197, 197, 197, 197, 197, 198, 198, 198, - 198, 198, 198, 198, 198, 198, 198, 199, 199, 200, - 200, 200, 200, 200, 200, 200, 201, 201, 202, 202, - 203, 203, 203, 204, 204, 205, 205, 206, 206, 207, - 207, 208, 209, 209, 210, 210, 211, 211, 212, 212, - 212, 212, 212, 212, 212, 213, 213, 213, 213, 213, - 213, 213, 213, 213, 213, 213, 213, 213, 214, 215, - 215, 216, 216, 217, 217, 217, 217, 218, 218, 219, - 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, - 219, 219, 219, 219, 219, 219, 219, 219, 219, 220, - 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, - 220, 220, 220, 221, 221, 222, 222, 223, 223, 224, - 224, 225, 225, 226, 226, 228, 227, 229, 227, 227, - 227, 227, 230, 227, 231, 227, 232, 227, 227, 227, - 227, 233, 234, 234, 235, 236, 236, 236, 237, 237, - 238, 238, 238, 238, 239, 240, 240, 241, 242, 242, - 243, 244, 245, 245, 246, 246, 246, 246, 246, 246, - 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, - 246, 246, 246, 246, 247, 247, 247, 247, 248, 248, - 249, 250, 250, 251, 251, 252, 252, 253, 253, 253, - 254, 254, 254, 254, 254, 254, 254, 254, 254, 255, - 255, 256, 256, 257, 257, 258, 258, 258, 258, 258, - 259, 259, 260, 260, 261, 261, 262, 262, 262, 262, - 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, - 262, 263, 263, 264, 264, 264, 264, 264, 264, 264, - 264, 264, 264, 264 + 0, 173, 174, 174, 174, 174, 174, 174, 174, 174, + 174, 175, 175, 175, 175, 175, 175, 176, 176, 176, + 176, 176, 176, 176, 176, 176, 176, 176, 176, 177, + 177, 177, 177, 177, 177, 177, 177, 177, 177, 178, + 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, + 178, 178, 178, 178, 178, 179, 180, 180, 180, 180, + 180, 181, 181, 181, 182, 182, 183, 183, 184, 184, + 185, 186, 186, 187, 187, 188, 189, 189, 189, 189, + 189, 189, 190, 190, 190, 191, 191, 191, 191, 192, + 192, 192, 193, 193, 193, 193, 193, 194, 194, 194, + 195, 195, 195, 195, 195, 195, 195, 196, 196, 196, + 196, 196, 196, 196, 196, 196, 196, 197, 197, 198, + 198, 198, 199, 199, 200, 200, 200, 200, 200, 200, + 200, 200, 200, 200, 201, 201, 202, 202, 203, 203, + 204, 204, 205, 206, 206, 207, 207, 208, 208, 209, + 209, 209, 209, 209, 209, 209, 210, 210, 210, 210, + 210, 210, 210, 210, 210, 210, 210, 210, 210, 211, + 212, 212, 213, 213, 214, 214, 214, 214, 215, 215, + 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, + 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, + 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, + 217, 217, 217, 217, 218, 218, 219, 219, 220, 220, + 221, 221, 222, 222, 223, 223, 225, 224, 226, 224, + 224, 224, 224, 227, 224, 228, 224, 229, 224, 224, + 224, 224, 230, 231, 231, 232, 233, 233, 233, 234, + 234, 235, 235, 235, 235, 236, 237, 237, 238, 239, + 239, 240, 241, 242, 242, 243, 243, 243, 243, 243, + 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, + 243, 243, 243, 243, 243, 244, 244, 244, 244, 245, + 245, 246, 247, 247, 248, 248, 249, 249, 250, 250, + 250, 251, 251, 251, 251, 251, 251, 251, 251, 251, + 252, 252, 253, 253, 254, 254, 255, 255, 255, 255, + 255, 256, 256, 257, 257, 258, 258, 259, 259, 259, + 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, + 259, 259, 260, 260, 261, 261, 261, 261, 261, 261, + 261, 261, 261, 261, 261 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -2058,30 +2054,30 @@ 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 2, 1, - 1, 1, 1, 1, 1, 1, 0, 2, 1, 3, - 3, 3, 1, 0, 4, 0, 2, 0, 2, 0, - 3, 2, 0, 1, 0, 3, 1, 2, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 3, 1, 2, - 5, 5, 5, 5, 3, 2, 5, 4, 2, 1, - 1, 1, 3, 1, 3, 1, 0, 1, 3, 4, - 3, 3, 4, 4, 3, 6, 5, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 6, - 5, 8, 6, 6, 7, 7, 7, 7, 6, 8, - 8, 5, 7, 3, 1, 1, 1, 1, 0, 2, - 6, 1, 0, 1, 2, 0, 3, 0, 3, 3, - 3, 3, 0, 8, 0, 9, 0, 9, 5, 2, - 3, 1, 3, 3, 3, 3, 1, 0, 5, 3, - 1, 3, 1, 0, 11, 1, 1, 4, 1, 1, - 2, 3, 0, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 3, 3, 2, 2, 3, 2, - 5, 4, 1, 5, 1, 1, 1, 1, 1, 1, - 2, 1, 3, 2, 2, 3, 3, 2, 0, 1, - 2, 2, 3, 9, 9, 8, 14, 1, 1, 6, - 5, 2, 2, 6, 7, 4, 4, 6, 6, 0, - 0, 3, 2, 3, 2, 1, 5, 5, 6, 6, - 6, 6, 4, 6, 4, 4, 6, 6, 2, 8, - 1, 1, 0, 3, 6, 3, 6, 2, 5, 7, - 5, 4, 4, 7 + 1, 1, 0, 2, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 0, 2, 0, 2, 0, 2, + 0, 3, 2, 0, 1, 0, 3, 1, 2, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, + 2, 5, 5, 5, 5, 3, 2, 5, 4, 2, + 1, 1, 1, 3, 1, 3, 1, 0, 1, 3, + 4, 3, 3, 4, 4, 3, 6, 5, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 6, 5, 8, 6, 6, 7, 7, 7, 7, 6, + 8, 8, 5, 7, 3, 1, 1, 1, 1, 0, + 2, 6, 1, 0, 1, 2, 0, 3, 0, 3, + 3, 3, 3, 0, 8, 0, 9, 0, 9, 5, + 2, 3, 1, 3, 3, 3, 3, 1, 0, 5, + 3, 1, 3, 1, 0, 11, 1, 1, 4, 1, + 1, 2, 3, 0, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 3, 3, 2, 2, 3, + 2, 5, 4, 1, 5, 1, 1, 1, 1, 1, + 1, 2, 1, 3, 2, 2, 3, 3, 2, 0, + 1, 2, 2, 3, 9, 9, 8, 15, 1, 1, + 6, 5, 2, 2, 6, 7, 4, 4, 6, 6, + 0, 0, 3, 2, 3, 2, 1, 5, 5, 6, + 6, 6, 6, 4, 6, 4, 4, 6, 6, 2, + 9, 1, 1, 0, 3, 6, 3, 6, 2, 5, + 7, 5, 4, 4, 7 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state @@ -2089,668 +2085,686 @@ means the default is an error. */ static const yytype_uint16 yydefact[] = { - 74, 61, 71, 62, 72, 63, 227, 225, 0, 0, - 0, 0, 0, 0, 85, 73, 0, 74, 223, 89, - 92, 0, 0, 239, 0, 0, 68, 0, 75, 76, + 74, 61, 71, 62, 72, 63, 228, 226, 0, 0, + 0, 0, 0, 0, 85, 73, 0, 74, 224, 89, + 92, 0, 0, 240, 0, 0, 68, 0, 75, 76, 78, 77, 79, 82, 80, 83, 81, 84, 86, 87, - 88, 85, 85, 218, 1, 224, 90, 91, 85, 228, - 93, 94, 95, 96, 85, 298, 226, 298, 0, 0, - 247, 240, 241, 229, 284, 285, 231, 148, 149, 150, - 153, 152, 151, 154, 155, 0, 0, 0, 0, 286, - 287, 156, 230, 158, 218, 218, 97, 217, 0, 100, - 100, 299, 294, 69, 258, 259, 260, 293, 242, 243, - 246, 0, 176, 159, 0, 0, 0, 0, 165, 177, - 0, 0, 176, 0, 0, 0, 99, 98, 0, 215, - 216, 0, 0, 101, 102, 103, 104, 105, 0, 261, - 0, 0, 342, 342, 297, 0, 244, 175, 117, 171, - 173, 0, 0, 0, 0, 0, 0, 164, 0, 0, - 157, 0, 0, 170, 0, 169, 0, 238, 148, 149, - 150, 153, 152, 151, 0, 0, 67, 67, 106, 0, - 255, 256, 257, 70, 341, 325, 0, 0, 0, 0, - 100, 307, 308, 2, 3, 4, 5, 6, 7, 8, + 88, 85, 85, 219, 1, 225, 90, 91, 85, 229, + 93, 94, 95, 96, 85, 299, 227, 299, 0, 0, + 248, 241, 242, 230, 285, 286, 232, 149, 150, 151, + 154, 153, 152, 155, 156, 0, 0, 0, 0, 287, + 288, 157, 231, 159, 219, 219, 97, 218, 0, 100, + 100, 300, 295, 69, 259, 260, 261, 294, 243, 244, + 247, 0, 177, 160, 0, 0, 0, 0, 166, 178, + 0, 0, 177, 0, 0, 0, 99, 98, 0, 216, + 217, 0, 0, 101, 102, 103, 104, 105, 122, 262, + 0, 0, 343, 343, 298, 0, 245, 176, 117, 172, + 174, 0, 0, 0, 0, 0, 0, 165, 0, 0, + 158, 0, 0, 171, 0, 170, 0, 239, 149, 150, + 151, 154, 153, 152, 0, 0, 67, 67, 106, 0, + 256, 257, 258, 70, 342, 326, 0, 0, 0, 0, + 100, 308, 309, 2, 3, 4, 5, 6, 7, 8, 9, 10, 14, 15, 16, 11, 12, 13, 0, 0, 0, 0, 0, 0, 0, 0, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 295, 100, 311, 0, 340, 296, 312, 245, 168, 0, - 126, 67, 67, 167, 0, 178, 0, 126, 67, 67, - 0, 219, 196, 197, 192, 194, 193, 195, 198, 191, - 187, 188, 0, 0, 0, 0, 0, 0, 0, 0, + 296, 100, 312, 0, 341, 297, 313, 246, 169, 0, + 134, 67, 67, 168, 0, 179, 0, 134, 67, 67, + 0, 220, 197, 198, 193, 195, 194, 196, 199, 192, + 188, 189, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 190, 189, 232, 0, 324, 301, 67, 291, 300, 0, - 0, 55, 0, 0, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 0, 53, 54, 49, 50, 51, - 52, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 0, 0, 0, 139, 139, 347, 67, 67, 338, - 0, 0, 0, 0, 0, 67, 67, 67, 67, 67, - 0, 0, 0, 0, 0, 108, 110, 109, 107, 111, - 112, 113, 114, 115, 118, 174, 172, 161, 162, 163, - 166, 66, 160, 234, 236, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 180, 214, 0, - 0, 0, 184, 0, 181, 0, 0, 0, 144, 253, - 264, 265, 266, 267, 268, 273, 269, 270, 271, 272, - 262, 0, 0, 0, 0, 282, 289, 288, 290, 0, - 0, 302, 0, 0, 67, 67, 67, 67, 0, 343, - 0, 345, 320, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 67, 0, 116, - 123, 122, 119, 121, 120, 124, 125, 127, 144, 144, - 0, 0, 0, 0, 0, 320, 0, 0, 0, 0, - 0, 0, 0, 179, 165, 177, 0, 182, 183, 0, - 0, 0, 0, 233, 252, 117, 250, 0, 263, 0, - 276, 0, 0, 0, 279, 0, 277, 292, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 351, 0, - 0, 0, 334, 335, 0, 0, 0, 0, 352, 0, - 0, 0, 332, 0, 139, 0, 235, 237, 67, 0, + 191, 190, 233, 121, 120, 119, 123, 0, 325, 302, + 67, 292, 301, 0, 0, 55, 0, 122, 29, 30, + 31, 32, 33, 34, 35, 36, 37, 38, 0, 53, + 54, 49, 50, 51, 52, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 0, 0, 0, 140, 140, + 348, 67, 67, 339, 0, 0, 0, 0, 0, 67, + 67, 67, 67, 67, 0, 122, 0, 0, 0, 108, + 110, 109, 107, 111, 112, 113, 114, 115, 118, 175, + 173, 162, 163, 164, 167, 66, 161, 235, 237, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 213, 186, 0, 0, 0, 0, 0, 0, 146, 144, - 65, 0, 126, 0, 275, 165, 0, 274, 278, 0, - 0, 319, 0, 0, 0, 0, 139, 140, 139, 0, - 0, 0, 0, 0, 0, 350, 322, 0, 67, 326, - 327, 319, 0, 348, 67, 220, 0, 0, 0, 0, - 200, 0, 0, 0, 0, 211, 0, 185, 0, 0, - 67, 141, 147, 145, 64, 249, 251, 117, 142, 0, - 281, 0, 0, 0, 117, 117, 0, 328, 329, 330, - 331, 344, 346, 321, 0, 0, 333, 336, 337, 323, - 0, 0, 139, 0, 0, 0, 0, 0, 208, 0, - 0, 0, 202, 203, 199, 65, 143, 137, 283, 280, - 0, 0, 0, 0, 126, 0, 313, 0, 353, 126, - 349, 204, 205, 206, 207, 0, 0, 0, 212, 248, - 0, 135, 0, 305, 0, 0, 108, 110, 117, 117, - 0, 117, 117, 314, 339, 201, 209, 210, 138, 0, - 133, 303, 0, 304, 0, 316, 315, 0, 0, 0, - 136, 0, 254, 0, 0, 0, 117, 117, 0, 0, - 0, 0, 318, 317, 0, 132, 0, 128, 310, 0, - 0, 0, 134, 0, 309, 0, 131, 130, 129, 306 + 0, 181, 215, 0, 0, 0, 185, 0, 182, 0, + 0, 0, 145, 0, 265, 266, 267, 268, 269, 274, + 270, 271, 272, 273, 263, 0, 0, 0, 0, 283, + 290, 289, 291, 0, 0, 303, 0, 0, 67, 67, + 67, 67, 0, 344, 0, 346, 321, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 67, 0, 116, 128, 127, 124, 126, 125, 129, + 130, 133, 131, 132, 135, 145, 145, 0, 0, 0, + 0, 0, 321, 0, 0, 0, 0, 0, 0, 0, + 180, 166, 178, 0, 183, 184, 0, 0, 0, 0, + 234, 254, 264, 0, 277, 0, 0, 0, 280, 0, + 278, 293, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 352, 0, 0, 0, 335, 336, 0, 0, + 0, 0, 353, 0, 0, 0, 333, 0, 140, 0, + 236, 238, 67, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 214, 187, 0, 0, 0, 0, + 0, 0, 147, 145, 253, 117, 251, 0, 0, 276, + 166, 0, 275, 279, 0, 0, 0, 0, 0, 0, + 0, 140, 141, 140, 0, 0, 0, 0, 0, 0, + 351, 323, 0, 67, 327, 328, 0, 0, 349, 67, + 221, 0, 0, 0, 0, 201, 0, 0, 0, 0, + 212, 0, 186, 0, 0, 67, 142, 148, 146, 65, + 0, 134, 0, 282, 0, 0, 0, 320, 329, 330, + 331, 332, 345, 347, 322, 0, 0, 334, 337, 338, + 324, 0, 320, 140, 0, 0, 0, 0, 0, 209, + 0, 0, 0, 203, 204, 200, 64, 250, 252, 117, + 143, 284, 281, 0, 0, 117, 117, 0, 314, 0, + 354, 0, 350, 205, 206, 207, 208, 0, 0, 0, + 213, 65, 144, 138, 0, 306, 0, 0, 0, 0, + 134, 0, 315, 134, 202, 210, 211, 249, 0, 136, + 304, 0, 305, 0, 108, 110, 117, 117, 0, 117, + 117, 340, 139, 0, 255, 0, 0, 317, 316, 0, + 0, 0, 137, 0, 0, 0, 117, 117, 311, 0, + 0, 319, 318, 310, 0, 0, 307 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { - -1, 277, 278, 279, 304, 321, 164, 165, 79, 595, + -1, 277, 278, 279, 308, 325, 164, 165, 79, 637, 113, 12, 133, 80, 14, 15, 41, 42, 43, 48, - 54, 118, 128, 354, 238, 447, 357, 706, 707, 692, - 680, 661, 419, 538, 637, 473, 539, 81, 166, 139, - 156, 140, 141, 110, 378, 405, 379, 121, 88, 157, - 16, 17, 18, 20, 19, 388, 448, 449, 63, 23, - 61, 101, 476, 477, 129, 172, 55, 96, 56, 49, - 479, 406, 83, 408, 287, 288, 57, 92, 93, 230, - 665, 134, 329, 606, 498, 508, 231, 232, 233, 234 + 54, 118, 128, 358, 238, 286, 169, 454, 361, 694, + 679, 423, 542, 663, 480, 543, 81, 166, 139, 156, + 140, 141, 110, 382, 409, 383, 121, 88, 157, 16, + 17, 18, 20, 19, 392, 455, 456, 63, 23, 61, + 101, 546, 547, 129, 172, 55, 96, 56, 49, 483, + 410, 83, 412, 291, 292, 57, 92, 93, 230, 667, + 134, 333, 647, 502, 512, 231, 232, 233, 234 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -628 +#define YYPACT_NINF -620 static const yytype_int16 yypact[] = { - 655, -628, -628, -628, -628, -628, -628, -628, 5, -121, - 42, -97, 97, 28, 2, -628, 124, 982, -628, 94, - 237, 69, 82, -628, 68, 231, -628, 1809, -628, -628, - -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, - -628, 110, 110, 188, -628, -628, -628, -628, 110, -628, - -628, -628, -628, -628, 110, 240, -628, -10, 243, 278, - 283, -628, -628, -628, -628, -628, 152, -628, -628, -628, - -628, -628, -628, -628, -628, 318, 327, 3, 536, -628, - -628, -628, 23, -628, 288, 288, 185, -628, 182, 210, - 210, -628, -628, 72, -628, -628, -628, -628, -628, -628, - -628, -46, 1554, -628, 169, 189, 730, 152, -628, 23, - -130, 192, 1554, 195, 182, 182, -628, -628, 1598, -628, - -628, 1850, 366, -628, -628, -628, -628, -628, 1905, -628, - -14, 211, 2204, 2204, -628, 356, -628, -628, 23, -628, - 222, 232, 1934, 1934, 225, -109, 1934, -628, 393, 242, - -628, 1850, 1934, 152, 245, 23, 321, -628, 236, 389, - 398, 399, 402, 403, 305, 404, 1378, 360, -628, 134, - -628, -628, -628, -628, -628, -628, 361, 1975, 92, 409, - 210, -628, -628, -628, -628, -628, -628, -628, -628, -628, - -628, -628, -628, -628, -628, -628, -628, -628, 400, 464, - 400, 464, 1934, 1934, 1934, 1934, -628, -628, -628, -628, - -628, -628, -628, -628, -628, -628, -628, -628, 1934, 1934, - 1934, 1934, 1934, 1934, 1934, 1934, 1934, 1934, 1934, 1934, - -628, 210, -628, 131, -628, -628, -628, -628, 217, 1639, - -628, -40, -16, -628, 252, 23, 263, -628, 360, -34, - 1598, -628, -628, -628, -628, -628, -628, -628, -628, -628, - -628, -628, 400, 464, 400, 464, 265, 266, 270, 272, - 273, 282, 284, 1680, 2016, 848, 422, 285, 286, 292, - -628, -628, -628, 293, -628, 152, 798, -628, 291, 970, - 970, -628, 970, 1905, -628, -628, -628, -628, -628, -628, - -628, -628, -628, -628, 1934, -628, -628, -628, -628, -628, - -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, - -628, 1934, 1934, 1934, 56, 86, -628, 798, -39, 294, - 295, 296, 297, 298, 299, 798, 798, 798, 798, 798, - 411, 1905, 1934, 1934, 453, -628, -628, -628, -628, -628, - -628, -628, -628, -628, -628, -628, -628, 148, -628, -628, - -628, -628, 148, -628, 195, 427, 306, 309, 314, 315, - 1850, 1850, 1850, 1850, 1850, 1850, 1850, -628, -628, -5, - 1424, -90, -628, -108, -628, 1850, 1850, 1850, 302, 1721, - -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, - 416, 1739, 2034, 1469, 456, -628, -628, -628, -628, 1934, - 316, -628, 317, 970, 798, 798, 798, 798, 29, -628, - 43, -628, -628, 970, 319, 1934, 1934, 1934, 1934, 1934, - 328, 342, 349, 350, 357, 1934, 970, 798, 358, -628, - -628, -628, -628, -628, -628, -628, -628, -628, 302, 302, - 1934, 1850, 1850, 1850, 1850, -628, 359, 362, 364, 365, - 342, 367, 1850, -628, 311, 1243, -75, -628, -628, 368, - 371, 482, 7, -628, -628, 23, 375, 379, -628, 502, - -628, 62, 1513, -57, -628, -69, -628, -628, 513, 525, - 396, 390, 414, 415, 418, 970, 559, 970, 419, 420, - 970, 421, 23, -628, 423, 424, 576, 589, 431, 1934, - 970, 970, 23, 435, 433, 1934, -628, -628, 4, 436, - 437, 438, 439, 142, 1850, 1850, 1850, 1850, 150, 1850, - -628, -628, 434, 1850, 1850, 1934, 582, 602, -628, 302, - 363, 1768, -628, 445, -628, 440, -65, -628, -628, 970, - 970, 2075, 970, 970, 970, 970, 433, -628, 433, 1934, - 970, 446, 1934, 1934, 1934, -628, -628, 608, 798, -628, - -628, 2075, 561, -628, 798, -628, 1850, 1850, 1850, 1850, - -628, 449, 454, 457, 458, -628, 342, -628, 455, 461, - 12, -628, -628, -628, -628, -628, -628, 23, -7, 598, - -628, 459, 460, 462, 45, 23, 156, -628, -628, -628, - -628, -628, -628, -628, 463, 970, -628, -628, -628, -628, - 342, 157, 433, 465, 469, 471, 474, 1850, -628, 1850, - 1850, 205, -628, -628, -628, 363, -628, 571, -628, -628, - 609, -2, 642, 642, -628, 2100, -628, 468, 431, -628, - -628, -628, -628, -628, -628, 476, 477, 478, -628, -628, - 648, 501, 970, -628, 1108, -1, 493, 495, -628, -628, - 39, 45, 23, -628, 148, -628, -628, -628, -628, 635, - 505, -628, 496, -628, 1108, 217, 217, 646, 642, 642, - -628, 498, -628, 653, 507, 970, -628, -628, 50, 970, - 659, 599, 217, 217, 517, -628, 215, -628, -628, 970, - 664, 191, -628, 50, -628, 970, -628, -628, -628, -628 + 484, -620, -620, -620, -620, -620, -620, -620, -14, -116, + -6, -83, 104, -31, 24, -620, 161, 528, -620, 238, + 204, 43, 49, -620, 5, 196, -620, 1912, -620, -620, + -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, + -620, 173, 173, 227, -620, -620, -620, -620, 173, -620, + -620, -620, -620, -620, 173, 202, -620, -9, 234, 243, + 246, -620, -620, -620, -620, -620, 67, -620, -620, -620, + -620, -620, -620, -620, -620, 273, 285, 3, 624, -620, + -620, -620, 4, -620, 201, 201, 253, -620, 81, 240, + 240, -620, -620, 39, -620, -620, -620, -620, -620, -620, + -620, -59, 1564, -620, 128, 132, 643, 67, -620, 4, + -114, 165, 1564, 145, 81, 81, -620, -620, 1605, -620, + -620, 2014, 324, -620, -620, -620, -620, -620, -620, -620, + -13, 188, 2299, 2299, -620, 328, -620, -620, 4, -620, + 189, 194, 2076, 2076, 186, -111, 2076, -620, 352, 205, + -620, 2014, 2076, 67, 208, 4, 247, -620, 216, 351, + 355, 359, 365, 368, 269, 372, 1625, 306, -620, 1517, + -620, -620, -620, -620, -620, -620, 325, 2094, 38, 373, + 240, -620, -620, -620, -620, -620, -620, -620, -620, -620, + -620, -620, -620, -620, -620, -620, -620, -620, 298, 336, + 298, 336, 2076, 2076, 2076, 2076, -620, -620, -620, -620, + -620, -620, -620, -620, -620, -620, -620, -620, 2076, 2076, + 2076, 2076, 2076, 2076, 2076, 2076, 2076, 2076, 2076, 2076, + -620, 240, -620, 66, -620, -620, -620, -620, 231, 1791, + -620, -17, -21, -620, 214, 4, 225, -620, 306, -5, + 1605, -620, -620, -620, -620, -620, -620, -620, -620, -620, + -620, -620, 298, 336, 298, 336, 229, 230, 249, 250, + 251, 252, 256, 1809, 2117, 690, 364, 257, 259, 261, + -620, -620, -620, -620, -620, -620, -620, 114, -620, 67, + 1019, -620, 262, 1189, 1189, -620, 1189, -620, -620, -620, + -620, -620, -620, -620, -620, -620, -620, -620, 2076, -620, + -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, + -620, -620, -620, -620, -620, 2076, 2076, 2076, -23, 28, + -620, 1019, -18, 265, 266, 268, 272, 288, 289, 1019, + 1019, 1019, 1019, 1019, 383, -620, 2076, 2076, 398, -620, + -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, + -620, 137, -620, -620, -620, -620, 137, -620, 145, 385, + 293, 294, 295, 297, 2014, 2014, 2014, 2014, 2014, 2014, + 2014, -620, -620, -56, 1069, -74, -620, -80, -620, 2014, + 2014, 2014, 296, 300, -620, -620, -620, -620, -620, -620, + -620, -620, -620, -620, 396, 1832, 2135, 1239, 403, -620, + -620, -620, -620, 2076, 299, -620, 301, 1517, 1019, 1019, + 1019, 1019, 8, -620, 33, -620, -620, 1189, 303, 2076, + 2076, 2076, 2076, 2076, 302, 304, 307, 308, 309, 2076, + 1517, 1019, 312, -620, -620, -620, -620, -620, -620, -620, + -620, -620, -620, -620, -620, 296, 296, 2076, 2014, 2014, + 2014, 2014, -620, 317, 318, 319, 320, 304, 323, 2014, + -620, 326, 1471, -77, -620, -620, 327, 330, 424, 2, + -620, 1850, -620, 443, -620, -52, 1280, -73, -620, -72, + -620, -620, 469, 471, 1189, 332, 334, 337, 338, 1189, + 494, 1189, 339, 343, 1189, 347, 4, -620, 348, 349, + 508, 519, 362, 2076, 1189, 1189, 4, 1189, 363, 2076, + -620, -620, 26, 367, 375, 377, 387, 149, 2014, 2014, + 2014, 2014, 157, 2014, -620, -620, 357, 2014, 2014, 2076, + 505, 526, -620, 296, -620, 4, 391, 394, 393, -620, + 366, -62, -620, -620, 1189, 1189, 386, 1189, 1189, 1189, + 1189, 363, -620, 363, 2076, 1189, 395, 2076, 2076, 2076, + -620, -620, 552, 1019, -620, -620, 405, 511, -620, 1019, + -620, 2014, 2014, 2014, 2014, -620, 400, 406, 407, 408, + -620, 304, -620, 411, 412, 57, -620, -620, -620, 11, + 1891, -620, 545, -620, 399, 413, 414, 2179, -620, -620, + -620, -620, -620, -620, -620, 409, 1189, -620, -620, -620, + -620, 304, 2179, 363, 417, 418, 423, 425, 2014, -620, + 2014, 2014, 180, -620, -620, -620, -620, -620, -620, 4, + 172, -620, -620, 556, -3, 46, 4, 181, -620, 422, + 362, 184, -620, -620, -620, -620, -620, 430, 431, 432, + -620, 11, -620, 539, 1189, -620, 1337, -1, 865, 865, + -620, 2197, -620, -620, -620, -620, -620, -620, 590, 445, + -620, 433, -620, 1337, 446, 453, -620, -620, 86, 46, + 4, 137, -620, 582, -620, 596, 452, 231, 231, 598, + 865, 865, -620, 1189, 599, 1189, -620, -620, -620, 1189, + 544, 231, 231, -620, 603, 1189, -620 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -628, 248, 256, 258, -180, -175, -177, -628, 0, 49, - -143, 594, -628, 18, -628, -628, -628, -628, 71, -628, - -628, -628, -144, -628, -345, -628, -239, -628, -25, -628, - -628, -628, -292, 91, -628, -386, -628, -628, -26, 451, - -122, -628, 579, 587, 65, -163, -270, 235, 308, 447, - -628, -628, 681, -628, -628, -628, -628, -628, -628, -628, - -628, -628, -628, -628, 610, -628, -628, -628, -628, -628, - -628, -627, -81, -267, -191, -628, -628, 647, -628, 566, - -628, -628, -628, 139, 250, -448, -628, 580, -628, -628 + -620, 42, 112, 200, -160, -158, -177, -620, 0, -39, + -151, 531, -620, 9, -620, -620, -620, -620, 77, -620, + -620, -620, -152, -620, -518, -620, -268, -620, -244, -620, + -620, -311, -15, -620, -414, -620, -620, -26, 389, -164, + -620, 514, 523, 142, -162, -261, 220, 263, 380, -620, + -620, 625, -620, -620, -620, -620, -620, -620, -620, -620, + -620, -620, -620, 559, -620, -620, -620, -620, -620, -620, + -619, -82, 267, -198, -620, -620, 595, -620, 535, -620, + -620, -620, 47, 215, -456, -620, 543, -620, -620 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -223 +#define YYTABLE_NINF -224 static const yytype_int16 yytable[] = { - 11, 82, 292, 280, 381, 383, 169, 105, 362, 291, - 291, 91, 528, 326, 170, 111, 111, 11, 13, 94, - 322, 111, 410, 411, 282, 412, 323, 536, 330, 331, - 332, 333, 334, 421, 146, 13, 293, 682, 340, 111, - 495, 536, 24, 147, 29, 30, 31, 32, 33, 34, - 35, 36, 109, 37, 497, 146, 462, 694, 21, 111, - 422, 537, 516, 517, 244, 468, 26, 111, 430, 431, - 432, 433, 434, 22, 462, 251, 138, 687, 111, 131, - 109, 467, 366, 496, 368, 281, 138, 341, 367, 462, - 369, 1, 155, 11, 3, 462, 5, 496, 532, 462, - -154, 25, 155, 289, 548, 363, 364, 462, 601, 290, - 466, 111, 84, 85, 547, 27, 241, 242, 135, 89, - 245, 112, 112, 136, 44, 90, 249, 112, 423, 358, - 540, 481, 483, 485, 440, 441, 442, 443, 631, 444, - 46, 111, 47, 445, 446, 112, 490, 491, 492, 493, - 494, 286, 438, 593, 2, 359, 499, 4, 171, 462, - 38, 39, 40, 95, 463, 112, 575, 663, 683, 513, - 514, 413, 648, 112, 634, 106, 324, 325, 286, 327, - 440, 441, 442, 443, 112, 444, 167, 283, -67, 445, - 446, 28, 328, 286, 286, 286, 286, 286, 335, 336, - 337, 338, 339, 286, 704, 407, -154, 705, 407, 407, - -154, 407, 546, 138, 119, 120, 248, 112, 487, 436, - 418, -67, 573, 86, 155, 87, 462, 116, 556, 117, - 558, 544, 58, 561, 501, 60, 503, 504, 505, -55, - -55, -55, -55, 569, 570, 59, 407, 112, 342, 343, - 420, -67, 635, 62, 407, 407, 407, 407, 407, 642, - 643, 91, 252, 253, 611, 98, 612, 155, 38, 39, - 40, 344, 122, 123, 124, 125, 126, 127, 414, 50, - 51, 52, 602, 603, 53, 607, 608, 609, 610, 440, - 441, 442, 443, 614, 444, 415, 416, 417, 445, 446, - 99, 620, 280, 598, 580, 100, 559, 622, 254, 255, - 256, 257, 585, 102, 567, 155, 437, 286, 644, 649, - 645, 645, 103, 685, 686, 87, 688, 689, 64, 65, - 650, 104, 407, 407, 407, 407, 407, 142, 345, 346, - 1, 2, 407, 3, 4, 5, 716, 717, 647, 151, - 152, 702, 703, 148, 465, 407, 407, 143, 347, 348, - 150, 349, 350, 475, 351, 352, 353, 658, 613, 567, - 168, 616, 617, 618, 173, 668, 669, 712, 237, 713, - 227, 227, 1, 286, 281, 3, 239, 5, 228, 228, - 229, 229, 114, 115, 240, 681, 243, 246, -56, 286, - 502, 286, 286, 286, 247, 670, 250, -57, -60, 512, - 674, -59, -58, 258, 407, 111, 407, 344, 284, 407, - 291, 696, 697, 360, 518, 361, 370, 371, 701, 407, - 407, 372, 708, 373, 374, 455, 456, 457, 458, 459, - 460, 461, 714, 375, 384, 376, 385, 386, 719, 435, - 469, 470, 471, 387, 389, 409, 465, 439, 424, 425, - 426, 427, 428, 429, 664, 450, 472, 451, 407, 407, - 452, 407, 407, 407, 407, 453, 454, 478, 486, 407, - 488, 489, 531, 568, 345, 346, 500, 407, 684, 574, - 305, 306, 506, 407, 294, 295, 296, 297, 298, 299, - 300, 301, 302, 303, 347, 348, 507, 349, 350, 590, - 351, 352, 353, 509, 510, 597, 519, 520, 521, 522, - 535, 511, 515, 524, 543, 605, 525, 530, 526, 527, - 549, 529, 533, 286, 407, 534, 286, 286, 286, 541, - 594, 542, 550, 64, 65, 605, 107, 67, 68, 69, - 70, 71, 72, 73, 552, 1, 2, 551, 3, 4, - 5, 407, 407, 557, 307, 308, 309, 310, 311, 312, - 313, 314, 315, 316, 317, 318, 319, 320, 553, 554, - 565, 407, 555, 559, 560, 562, 74, 563, 564, 581, - 582, 583, 584, 566, 586, 567, 571, 572, 588, 589, - 576, 577, 578, 579, 591, 587, 592, 407, 407, 599, - 615, 600, 619, 627, 407, 496, 628, 632, 407, 672, - 638, 629, 630, 633, 640, 660, 662, 651, 407, 641, - 639, 652, 646, 653, 407, 594, 654, 673, 675, 676, - 677, 623, 624, 625, 626, 390, 391, 392, 393, 64, - 65, 394, 678, 679, -18, -222, -19, 690, 691, 698, - 693, 1, 2, 695, 3, 4, 5, 395, 396, 397, - 699, 700, 710, -69, 1, 2, 709, 3, 4, 5, - 711, 715, 398, 399, 659, 6, 7, 132, 718, 636, - 356, 149, 655, 145, 656, 657, 344, 365, 45, 235, - 130, 400, 75, 76, 97, 523, 77, 8, 78, 108, - 621, 9, 0, 236, 0, 10, 0, 183, 184, 185, - 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, - 196, 197, 262, 263, 264, 265, 0, 64, 65, 0, - 107, 67, 68, 69, 70, 71, 72, 73, 0, 1, + 11, 82, 296, 366, 280, 287, 330, 105, 295, 13, + 295, 532, 91, 385, 387, 170, 282, 11, 425, 499, + 94, 334, 335, 336, 337, 338, 13, 599, 297, 417, + 1, 344, 111, 3, 111, 5, 540, 111, 111, 21, + 326, 520, 521, 327, 501, 24, 131, 681, 146, 293, + 111, 146, 109, 25, 22, 294, 541, 147, 1, 111, + 244, 3, 500, 5, 696, 348, 29, 30, 31, 32, + 33, 34, 35, 36, 251, 37, 138, 440, 26, 345, + 109, 111, 469, 111, 281, 469, 138, 500, 469, 469, + 469, 475, 155, 11, 536, 474, 552, 367, 368, 553, + 469, -155, 370, 135, 372, 371, 469, 373, 136, 604, + 469, 470, 111, 119, 120, 549, 241, 242, 84, 85, + 245, 661, 27, 473, 699, 89, 249, 668, 669, 598, + 28, 90, 349, 350, 2, 632, 112, 4, 112, 422, + -67, 112, 112, 155, 485, 487, 489, 427, 363, 442, + 362, 290, 351, 352, 112, 353, 354, 171, 355, 356, + 357, 44, 95, 112, 665, 650, 682, -67, 697, 698, + 60, 700, 701, 106, 227, 227, 328, 329, 290, 331, + 38, 39, 40, 346, 347, 112, 580, 112, 711, 712, + 424, -67, 332, 290, 290, 290, 290, 290, 339, 340, + 341, 342, 343, 290, 58, -155, 540, 578, 411, -155, + 59, 411, 411, 138, 411, 491, 112, 635, 62, -55, + -55, -55, -55, 91, 155, 551, 102, 444, 445, 446, + 447, 505, 448, 507, 508, 509, 449, 450, 87, 451, + 452, 453, 252, 253, 228, 228, 50, 51, 52, 411, + 612, 53, 613, 494, 64, 65, 98, 411, 411, 411, + 411, 411, 86, 167, 87, 99, 1, 2, 100, 3, + 4, 5, 254, 255, 256, 257, 517, 103, 444, 445, + 446, 447, 418, 448, 46, 348, 47, 449, 450, 104, + 451, 452, 453, 248, 142, 116, 393, 117, 143, 419, + 420, 421, 122, 123, 124, 125, 126, 127, 150, 585, + 280, 564, 652, 444, 445, 446, 447, 590, 448, 572, + 441, 290, 449, 450, 148, 451, 452, 453, 168, 38, + 39, 40, 229, 229, 151, 152, 411, 411, 411, 411, + 660, 670, 572, 671, 673, 411, 671, 114, 115, 173, + 237, 239, 349, 350, 240, 243, 246, 640, 472, 411, + -56, 111, 309, 310, -57, 247, 614, 250, -60, 617, + 618, 619, 351, 352, -59, 353, 354, -58, 355, 356, + 357, 258, 288, 364, 295, 365, 388, 290, 374, 375, + 281, 155, 298, 299, 300, 301, 302, 303, 304, 305, + 306, 307, 443, 290, 506, 290, 290, 290, 376, 377, + 378, 379, 411, 516, 155, 380, 389, 411, 390, 411, + 391, 439, 411, 457, 413, 490, 688, 428, 429, 691, + 430, 522, 411, 411, 431, 411, 311, 312, 313, 314, + 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, + 432, 433, 458, 459, 460, 545, 461, 482, 479, 481, + 472, 492, 539, 493, 510, 548, 511, 666, 504, 513, + 514, 515, 411, 411, 519, 411, 411, 411, 411, 528, + 529, 530, 531, 411, -223, 533, 554, 573, 555, 537, + 683, 411, 538, 579, 557, 535, 558, 411, 562, 559, + 560, 564, -69, 1, 2, 565, 3, 4, 5, 567, + 568, 569, 570, 595, 6, 7, 462, 463, 464, 465, + 466, 467, 468, 571, 572, 577, 592, 596, -222, 581, + 597, 476, 477, 478, 411, 603, 8, 582, 290, 583, + 9, 290, 290, 290, 10, 607, -69, 1, 2, 584, + 3, 4, 5, 600, 601, 602, 620, 616, 6, 7, + 414, 415, 628, 416, 622, 500, 629, 641, 642, 630, + 631, 633, 634, 664, 639, 643, 648, 653, 654, 644, + 8, 646, 411, 655, 9, 656, 411, 411, 10, 672, + 674, 675, 676, 678, 692, 695, 646, 693, 426, 636, + 523, 524, 525, 526, 702, -18, 434, 435, 436, 437, + 438, 534, -19, 703, 704, 705, 709, 714, 411, 411, + 715, 411, 677, 411, 132, 662, 149, 411, 360, 145, + 369, 64, 65, 411, 107, 67, 68, 69, 70, 71, + 72, 73, 45, 1, 2, 690, 3, 4, 5, 130, + 64, 65, 97, 107, 67, 68, 69, 70, 71, 72, + 73, 636, 1, 2, 0, 3, 4, 5, 235, 651, + 586, 587, 588, 589, 74, 591, 236, 527, 0, 593, + 594, 0, 0, 0, 0, 495, 496, 497, 498, 0, + 0, 0, 0, 74, 503, 0, 0, 64, 65, 0, + 107, 158, 159, 160, 161, 162, 163, 73, 518, 1, 2, 0, 3, 4, 5, 0, 0, 0, 0, 0, - 0, 266, 206, 666, 667, 209, 210, 211, 212, 213, - 214, 215, 216, 217, 0, 267, 0, 268, 269, 270, - 74, 271, 272, 347, 348, 0, 349, 350, 0, 351, - 352, 353, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 390, 391, 392, 393, 64, 65, 394, 0, 401, - 0, 0, 402, 0, 403, 0, 404, 1, 2, 0, - 3, 4, 5, 395, 396, 397, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 398, 399, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 111, 0, 64, 65, 400, 107, 158, - 159, 160, 161, 162, 163, 73, 0, 1, 2, 0, - 3, 4, 5, 183, 184, 185, 186, 187, 188, 189, - 190, 191, 192, 193, 194, 195, 196, 197, 262, 263, - 264, 265, 0, 0, 0, 0, 75, 76, 74, 0, - 77, 0, 78, 144, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 266, 206, 207, - 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, - 0, 267, 0, 268, 269, 270, 0, 271, 272, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 112, - 0, 0, 0, 0, 0, 401, 0, 0, 402, 0, - 403, 0, 404, 390, 391, 392, 393, 64, 65, 394, - 0, 0, -221, 0, 0, 0, 0, 0, 0, 1, - 2, 0, 3, 4, 5, 395, 396, 397, 0, 0, - -69, 1, 2, 0, 3, 4, 5, 0, 0, 0, - 398, 399, 6, 7, 75, 76, 0, 0, 77, 0, - 78, 382, 0, 0, 0, 0, 0, 0, 0, 400, - 0, 0, 0, 0, 8, 0, 0, 0, 9, 0, - 0, 0, 10, 0, 0, 183, 184, 185, 186, 187, - 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, - 262, 263, 264, 265, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 266, - 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, - 216, 217, 0, 267, 0, 268, 269, 270, 0, 271, - 272, 390, 391, 392, 393, 0, 0, 394, 0, 0, + 0, 0, 0, 624, 625, 626, 627, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 395, 396, 397, 0, 401, 0, 0, - 402, 0, 403, 0, 404, 0, 0, 0, 398, 399, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 400, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 183, 184, 185, 186, 187, 188, 189, - 190, 191, 192, 193, 194, 195, 196, 197, 262, 263, - 264, 265, 0, 0, 0, 0, 0, 0, 0, 0, + 74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 266, 206, 207, - 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, - 0, 267, 0, 268, 269, 270, 0, 271, 272, 0, - 64, 65, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 2, 0, 3, 4, 5, 259, 0, - 0, 0, 0, 0, 0, 401, 0, 0, 402, 0, - 403, 0, 404, 260, 261, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 111, 0, + 0, 556, 0, 0, 0, 0, 561, 0, 563, 0, + 657, 566, 658, 659, 0, 0, 0, 0, 0, 0, + 0, 574, 575, 0, 576, 0, 0, 0, 75, 76, + 0, 0, 77, 0, 78, 108, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 75, 76, 0, + 0, 77, 0, 78, 144, 0, 0, 0, 0, 0, + 0, 605, 606, 0, 608, 609, 610, 611, 0, 0, + 0, 0, 615, 0, 0, 0, 0, 0, 0, 0, + 621, 0, 0, 0, 0, 0, 623, 0, 0, 0, + 0, 0, 0, 0, 75, 76, 0, 0, 77, 0, + 78, 386, 0, 0, 0, 0, 0, 0, 394, 395, + 396, 397, 64, 65, 398, 0, 0, 0, 0, 0, + 0, 0, 0, 649, 1, 2, 0, 3, 4, 5, + 399, 400, 401, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 402, 403, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 348, + 0, 0, 0, 0, 404, 0, 0, 0, 0, 0, + 0, 680, 0, 0, 0, 686, 687, 0, 0, 0, + 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, + 193, 194, 195, 196, 197, 262, 263, 264, 265, 0, + 0, 0, 0, 0, 0, 0, 0, 706, 707, 0, + 708, 0, 710, 0, 0, 0, 713, 0, 0, 0, + 0, 0, 716, 0, 266, 206, 684, 685, 209, 210, + 211, 212, 213, 214, 215, 216, 217, 0, 267, 0, + 268, 269, 270, 0, 271, 272, 351, 352, 0, 353, + 354, 0, 355, 356, 357, 0, 0, 0, 0, 0, + 0, 0, 394, 395, 396, 397, 64, 65, 398, 0, + 405, 0, 0, 406, 0, 407, 0, 408, 1, 2, + 0, 3, 4, 5, 399, 400, 401, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 402, + 403, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 111, 0, 64, 65, 404, 107, + 158, 159, 160, 161, 162, 163, 73, 0, 1, 2, + 0, 3, 4, 5, 183, 184, 185, 186, 187, 188, + 189, 190, 191, 192, 193, 194, 195, 196, 197, 262, + 263, 264, 265, 0, 0, 0, 0, 0, 0, 74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 262, 263, 264, 265, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 266, 206, + 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, + 217, 0, 267, 0, 268, 269, 270, 0, 271, 272, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 112, 0, + 0, 0, 0, 0, 405, 0, 0, 406, 0, 407, + 0, 408, 394, 395, 396, 397, 64, 65, 398, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, + 0, 3, 4, 5, 399, 400, 401, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 402, + 403, 0, 0, 75, 76, 0, 0, 77, 0, 78, + 471, 0, 0, 0, 0, 0, 64, 65, 404, 107, + 158, 159, 160, 161, 162, 163, 73, 0, 1, 2, + 0, 3, 4, 5, 183, 184, 185, 186, 187, 188, + 189, 190, 191, 192, 193, 194, 195, 196, 197, 262, + 263, 264, 265, 0, 0, 0, 0, 64, 65, 74, + 107, 158, 159, 160, 161, 162, 163, 73, 0, 1, + 2, 0, 3, 4, 5, 0, 0, 0, 266, 206, + 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, + 217, 0, 267, 0, 268, 269, 270, 0, 271, 272, + 74, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 394, 395, 396, 397, 0, 0, 398, 0, 0, 0, + 0, 0, 0, 0, 405, 0, 0, 406, 0, 407, + 0, 408, 399, 400, 401, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 402, 403, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 266, 206, 207, 208, 209, 210, 211, 212, - 213, 214, 215, 216, 217, 0, 267, 0, 268, 269, - 270, 0, 271, 272, 0, 64, 65, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, - 3, 4, 5, 259, 112, 0, 0, 0, -67, 0, - 273, 0, 0, 274, 0, 275, 0, 276, 260, 261, + 0, 0, 0, 0, 0, 0, 404, 0, 0, 0, + 0, 0, 0, 75, 76, 0, 0, 77, 0, 78, + 488, 0, 183, 184, 185, 186, 187, 188, 189, 190, + 191, 192, 193, 194, 195, 196, 197, 262, 263, 264, + 265, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 75, 76, 0, 0, 77, 0, + 78, 550, 0, 0, 0, 0, 266, 206, 207, 208, + 209, 210, 211, 212, 213, 214, 215, 216, 217, 0, + 267, 0, 268, 269, 270, 0, 271, 272, 64, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 64, 65, 111, 107, 158, 159, 160, 161, 162, - 163, 73, 0, 1, 2, 0, 3, 4, 5, 0, - 0, 0, 0, 183, 184, 185, 186, 187, 188, 189, - 190, 191, 192, 193, 194, 195, 196, 197, 262, 263, - 264, 265, 0, 0, 74, 0, 64, 65, 0, 107, - 158, 159, 160, 161, 162, 163, 73, 0, 1, 2, - 0, 3, 4, 5, 0, 0, 0, 266, 206, 207, - 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, - 0, 267, 0, 268, 269, 270, 0, 271, 272, 74, - 64, 65, 0, 107, 158, 159, 160, 161, 162, 163, - 73, 0, 1, 2, 0, 3, 4, 5, 0, 112, - 0, 0, 0, 0, 0, 273, 0, 0, 274, 0, - 275, 0, 276, 0, 0, 0, 0, 0, 0, 0, - 0, 64, 65, 74, 107, 67, 68, 69, 70, 71, + 1, 2, 0, 3, 4, 5, 259, 0, 0, 0, + 0, 0, 405, 0, 0, 406, 0, 407, 0, 408, + 0, 260, 261, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 64, 65, 111, 153, 67, 68, + 69, 70, 71, 72, 73, 0, 1, 2, 0, 3, + 4, 5, 0, 0, 0, 0, 183, 184, 185, 186, + 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, + 197, 262, 263, 264, 265, 0, 0, 74, 0, 0, + 0, 64, 65, 0, 107, 67, 68, 69, 70, 71, 72, 73, 0, 1, 2, 0, 3, 4, 5, 0, + 266, 206, 207, 208, 209, 210, 211, 212, 213, 214, + 215, 216, 217, 137, 267, 0, 268, 269, 270, 0, + 271, 272, 64, 65, 74, 153, 67, 68, 69, 70, + 71, 72, 73, 0, 1, 2, 0, 3, 4, 5, + 112, 0, 64, 65, -67, 0, 273, 0, 0, 274, + 0, 275, 0, 276, 1, 2, 0, 3, 4, 5, + 259, 0, 0, 0, 0, 74, 0, 0, 283, 284, + 0, 285, 0, 0, 0, 260, 261, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 75, 76, 0, 137, 77, 0, 78, 464, 0, 0, - 0, 0, 0, 0, 74, 64, 65, 0, 153, 67, - 68, 69, 70, 71, 72, 73, 0, 1, 2, 0, - 3, 4, 5, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 75, 76, 0, 0, 77, - 0, 78, 484, 0, 0, 0, 64, 65, 74, 107, - 67, 68, 69, 70, 71, 72, 73, 0, 1, 2, - 0, 3, 4, 5, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 355, 75, - 76, 0, 0, 77, 0, 78, 545, 64, 65, 74, - 107, 158, 159, 160, 161, 162, 163, 73, 0, 1, - 2, 0, 3, 4, 5, 0, 0, 0, 0, 0, + 111, 75, 76, 0, 0, 77, 0, 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 75, 76, 0, 154, 77, 0, 78, 0, 64, 65, - 74, 107, 67, 68, 69, 70, 71, 72, 73, 0, + 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, + 193, 194, 195, 196, 197, 262, 263, 264, 265, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 75, 76, + 154, 0, 77, 0, 78, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 266, 206, 207, 208, 209, 210, + 211, 212, 213, 214, 215, 216, 217, 0, 267, 0, + 268, 269, 270, 0, 271, 272, 0, 0, 0, 75, + 76, 0, 0, 77, 0, 78, 0, 0, 0, 0, + 0, 0, 0, 0, 112, 0, 0, 0, 0, 0, + 273, 0, 0, 274, 0, 275, 0, 276, 64, 65, + 0, 107, 67, 68, 69, 70, 71, 72, 73, 0, 1, 2, 0, 3, 4, 5, 64, 65, 0, 107, 158, 159, 160, 161, 162, 163, 73, 0, 1, 2, - 474, 3, 4, 5, 75, 76, 0, 0, 77, 0, - 78, 74, 0, 0, 0, 64, 65, 0, 107, 67, - 68, 69, 70, 71, 72, 73, 0, 1, 2, 74, - 3, 4, 5, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 75, 76, 596, 0, 77, - 0, 78, 0, 0, 0, 0, 64, 65, 74, 66, - 67, 68, 69, 70, 71, 72, 73, 0, 1, 2, - 0, 3, 4, 5, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 75, 76, 0, 377, - 77, 0, 78, 0, 0, 0, 0, 64, 65, 74, - 107, 158, 159, 160, 161, 162, 163, 73, 0, 1, + 359, 3, 4, 5, 0, 0, 0, 0, 0, 64, + 65, 74, 107, 158, 159, 160, 161, 162, 163, 73, + 0, 1, 2, 0, 3, 4, 5, 64, 65, 74, + 107, 67, 68, 69, 70, 71, 72, 73, 0, 1, 2, 0, 3, 4, 5, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 75, 76, 0, - 0, 77, 0, 78, 0, 0, 0, 0, 0, 0, - 74, 0, 0, 0, 0, 75, 76, 0, 480, 77, - 0, 78, 64, 65, 0, 153, 67, 68, 69, 70, - 71, 72, 73, 0, 1, 2, 0, 3, 4, 5, - 0, 0, 0, 0, 75, 76, 0, 0, 77, 0, - 78, 64, 65, 0, 107, 67, 68, 69, 70, 71, - 72, 73, 0, 1, 2, 74, 3, 4, 5, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 74, 0, 0, 0, 0, 0, 0, 544, + 0, 0, 0, 0, 0, 0, 0, 0, 64, 65, + 74, 107, 67, 68, 69, 70, 71, 72, 73, 0, + 1, 2, 0, 3, 4, 5, 0, 0, 0, 64, + 65, 0, 66, 67, 68, 69, 70, 71, 72, 73, + 638, 1, 2, 0, 3, 4, 5, 0, 0, 0, + 0, 74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 75, 76, 0, 0, 77, - 0, 78, 64, 65, 74, 285, 67, 68, 69, 70, - 71, 72, 73, 0, 1, 2, 0, 3, 4, 5, + 0, 78, 74, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 75, 76, 0, 381, 77, 0, 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 75, 76, 0, 0, - 77, 0, 78, 64, 65, 74, 107, 158, 159, 160, - 161, 162, 163, 73, 0, 1, 2, 0, 3, 4, - 5, 64, 65, 0, 107, 158, 159, 160, 161, 162, + 0, 0, 0, 0, 0, 0, 75, 76, 0, 484, + 77, 0, 78, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 75, 76, 0, 0, 77, 0, + 78, 64, 65, 0, 107, 158, 159, 160, 161, 162, 163, 73, 0, 1, 2, 0, 3, 4, 5, 0, - 0, 0, 0, 0, 0, 0, 74, 0, 0, 0, - 0, 75, 76, 0, 0, 77, 0, 78, 0, 0, - 0, 0, 64, 65, 74, 107, 67, 68, 69, 70, - 71, 72, 604, 0, 1, 2, 0, 3, 4, 5, - 75, 76, 0, 0, 77, 0, 78, 64, 65, 0, - 107, 67, 68, 69, 70, 71, 72, 671, 0, 1, - 2, 0, 3, 4, 5, 74, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 75, 76, 0, 0, 77, 0, 78, 0, 0, - 74, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 75, 76, 0, 0, 77, 0, 380, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 75, 76, 0, 0, 77, 0, 482, 0, 0, 0, + 0, 0, 0, 0, 0, 75, 76, 0, 0, 77, + 0, 78, 0, 0, 74, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 75, 76, 0, 0, + 77, 0, 78, 64, 65, 0, 107, 67, 68, 69, + 70, 71, 72, 73, 0, 1, 2, 0, 3, 4, + 5, 64, 65, 0, 289, 67, 68, 69, 70, 71, + 72, 73, 0, 1, 2, 0, 3, 4, 5, 0, + 0, 0, 0, 0, 64, 65, 74, 107, 158, 159, + 160, 161, 162, 163, 73, 0, 1, 2, 0, 3, + 4, 5, 64, 65, 74, 107, 158, 159, 160, 161, + 162, 163, 73, 0, 1, 2, 0, 3, 4, 5, + 0, 0, 0, 0, 0, 0, 0, 74, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 75, 76, + 0, 0, 77, 0, 78, 74, 64, 65, 0, 107, + 67, 68, 69, 70, 71, 72, 645, 0, 1, 2, + 0, 3, 4, 5, 64, 65, 0, 107, 67, 68, + 69, 70, 71, 72, 689, 0, 1, 2, 0, 3, + 4, 5, 0, 0, 0, 0, 0, 0, 0, 74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 75, 76, 0, 0, 77, 0, 78, 74, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 75, 76, + 0, 0, 77, 0, 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 75, 76, 0, 0, 77, 0, 384, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 75, + 76, 0, 0, 77, 0, 486, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 174, 75, 76, 0, 0, 77, 0, 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 175, 176, 0, 0, 0, 75, 76, 0, 0, - 77, 0, 78, 177, 178, 179, 180, 181, 182, 183, - 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, - 194, 195, 196, 197, 198, 199, 200, 201, 0, 0, + 0, 0, 0, 0, 0, 174, 0, 0, 0, 0, + 0, 0, 0, 75, 76, 0, 0, 77, 0, 78, + 0, 0, 0, 0, 0, 0, 175, 176, 0, 0, + 0, 75, 76, 0, 0, 77, 0, 78, 177, 178, + 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, + 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, + 199, 200, 201, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 202, 203, - 204, 0, 0, 205, 206, 207, 208, 209, 210, 211, - 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, - 222, 223, 224, 225, 226 + 0, 0, 0, 202, 203, 204, 0, 0, 205, 206, + 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, + 217, 218, 219, 220, 221, 222, 223, 224, 225, 226 }; static const yytype_int16 yycheck[] = { - 0, 27, 179, 166, 274, 275, 128, 4, 247, 11, - 11, 21, 460, 204, 28, 55, 55, 17, 0, 29, - 200, 55, 289, 290, 167, 292, 201, 34, 219, 220, - 221, 222, 223, 325, 164, 17, 180, 664, 229, 55, - 11, 34, 163, 173, 42, 43, 44, 45, 46, 47, - 48, 49, 78, 51, 11, 164, 164, 684, 53, 55, - 327, 54, 448, 449, 173, 173, 163, 55, 335, 336, - 337, 338, 339, 68, 164, 156, 102, 38, 55, 7, - 106, 171, 262, 54, 264, 166, 112, 231, 263, 164, - 265, 19, 118, 93, 22, 164, 24, 54, 173, 164, - 55, 59, 128, 11, 173, 248, 249, 164, 173, 17, - 380, 55, 41, 42, 171, 18, 142, 143, 164, 48, - 146, 161, 161, 169, 0, 54, 152, 161, 167, 169, - 475, 401, 402, 403, 141, 142, 143, 144, 586, 146, - 46, 55, 48, 150, 151, 161, 413, 414, 415, 416, - 417, 177, 343, 539, 20, 171, 423, 23, 172, 164, - 158, 159, 160, 173, 169, 161, 162, 169, 169, 436, - 437, 293, 620, 161, 162, 172, 202, 203, 204, 205, - 141, 142, 143, 144, 161, 146, 121, 169, 165, 150, - 151, 163, 218, 219, 220, 221, 222, 223, 224, 225, - 226, 227, 228, 229, 154, 286, 161, 157, 289, 290, - 165, 292, 482, 239, 32, 33, 151, 161, 409, 341, - 164, 165, 514, 35, 250, 37, 164, 42, 495, 44, - 497, 169, 163, 500, 425, 167, 427, 428, 429, 3, - 4, 5, 6, 510, 511, 163, 327, 161, 117, 118, - 164, 165, 597, 22, 335, 336, 337, 338, 339, 604, - 605, 21, 26, 27, 556, 22, 558, 293, 158, 159, - 160, 54, 62, 63, 64, 65, 66, 67, 304, 42, - 43, 44, 549, 550, 47, 552, 553, 554, 555, 141, - 142, 143, 144, 560, 146, 321, 322, 323, 150, 151, - 22, 568, 465, 542, 162, 22, 164, 574, 3, 4, - 5, 6, 162, 161, 164, 341, 342, 343, 162, 162, - 164, 164, 4, 668, 669, 37, 671, 672, 7, 8, - 622, 4, 413, 414, 415, 416, 417, 168, 121, 122, - 19, 20, 423, 22, 23, 24, 155, 156, 615, 114, - 115, 696, 697, 161, 380, 436, 437, 168, 141, 142, - 165, 144, 145, 389, 147, 148, 149, 162, 559, 164, - 4, 562, 563, 564, 163, 642, 643, 162, 22, 164, - 132, 133, 19, 409, 465, 22, 164, 24, 132, 133, - 132, 133, 84, 85, 162, 662, 171, 4, 9, 425, - 426, 427, 428, 429, 162, 644, 161, 9, 9, 435, - 649, 9, 9, 9, 495, 55, 497, 54, 57, 500, - 11, 688, 689, 171, 450, 162, 161, 161, 695, 510, - 511, 161, 699, 161, 161, 370, 371, 372, 373, 374, - 375, 376, 709, 161, 22, 161, 161, 161, 715, 38, - 385, 386, 387, 161, 161, 164, 482, 4, 164, 164, - 164, 164, 164, 164, 641, 38, 164, 161, 549, 550, - 161, 552, 553, 554, 555, 161, 161, 61, 22, 560, - 164, 164, 171, 509, 121, 122, 167, 568, 665, 515, - 26, 27, 164, 574, 94, 95, 96, 97, 98, 99, - 100, 101, 102, 103, 141, 142, 164, 144, 145, 535, - 147, 148, 149, 164, 164, 541, 451, 452, 453, 454, - 38, 164, 164, 164, 22, 551, 164, 462, 164, 164, - 17, 164, 164, 559, 615, 164, 562, 563, 564, 164, - 540, 162, 17, 7, 8, 571, 10, 11, 12, 13, - 14, 15, 16, 17, 164, 19, 20, 161, 22, 23, - 24, 642, 643, 4, 100, 101, 102, 103, 104, 105, - 106, 107, 108, 109, 110, 111, 112, 113, 164, 164, - 4, 662, 164, 164, 164, 164, 50, 164, 164, 524, - 525, 526, 527, 4, 529, 164, 161, 164, 533, 534, - 164, 164, 164, 164, 22, 171, 4, 688, 689, 164, - 164, 171, 4, 164, 695, 54, 162, 162, 699, 645, - 22, 164, 164, 162, 164, 54, 17, 162, 709, 167, - 171, 162, 169, 162, 715, 635, 162, 169, 162, 162, - 162, 576, 577, 578, 579, 3, 4, 5, 6, 7, - 8, 9, 4, 152, 161, 0, 161, 22, 153, 161, - 164, 19, 20, 17, 22, 23, 24, 25, 26, 27, - 17, 164, 73, 18, 19, 20, 17, 22, 23, 24, - 163, 17, 40, 41, 635, 30, 31, 93, 713, 598, - 239, 112, 627, 106, 629, 630, 54, 250, 17, 133, - 90, 59, 166, 167, 57, 455, 170, 52, 172, 173, - 571, 56, -1, 133, -1, 60, -1, 75, 76, 77, - 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, - 88, 89, 90, 91, 92, 93, -1, 7, 8, -1, - 10, 11, 12, 13, 14, 15, 16, 17, -1, 19, + 0, 27, 179, 247, 166, 169, 204, 4, 11, 0, + 11, 467, 21, 274, 275, 28, 167, 17, 329, 11, + 29, 219, 220, 221, 222, 223, 17, 545, 180, 297, + 19, 229, 55, 22, 55, 24, 34, 55, 55, 53, + 200, 455, 456, 201, 11, 161, 7, 666, 162, 11, + 55, 162, 78, 59, 68, 17, 54, 171, 19, 55, + 171, 22, 54, 24, 683, 54, 42, 43, 44, 45, + 46, 47, 48, 49, 156, 51, 102, 345, 161, 231, + 106, 55, 162, 55, 166, 162, 112, 54, 162, 162, + 162, 171, 118, 93, 171, 169, 169, 248, 249, 171, + 162, 55, 262, 162, 264, 263, 162, 265, 167, 171, + 162, 167, 55, 32, 33, 167, 142, 143, 41, 42, + 146, 639, 18, 384, 38, 48, 152, 645, 646, 543, + 161, 54, 121, 122, 20, 591, 159, 23, 159, 162, + 163, 159, 159, 169, 405, 406, 407, 165, 169, 347, + 167, 177, 141, 142, 159, 144, 145, 170, 147, 148, + 149, 0, 171, 159, 167, 621, 167, 163, 686, 687, + 165, 689, 690, 170, 132, 133, 202, 203, 204, 205, + 156, 157, 158, 117, 118, 159, 160, 159, 706, 707, + 162, 163, 218, 219, 220, 221, 222, 223, 224, 225, + 226, 227, 228, 229, 161, 159, 34, 518, 290, 163, + 161, 293, 294, 239, 296, 413, 159, 160, 22, 3, + 4, 5, 6, 21, 250, 486, 159, 141, 142, 143, + 144, 429, 146, 431, 432, 433, 150, 151, 37, 153, + 154, 155, 26, 27, 132, 133, 42, 43, 44, 331, + 561, 47, 563, 417, 7, 8, 22, 339, 340, 341, + 342, 343, 35, 121, 37, 22, 19, 20, 22, 22, + 23, 24, 3, 4, 5, 6, 440, 4, 141, 142, + 143, 144, 308, 146, 46, 54, 48, 150, 151, 4, + 153, 154, 155, 151, 166, 42, 287, 44, 166, 325, + 326, 327, 62, 63, 64, 65, 66, 67, 163, 160, + 472, 162, 623, 141, 142, 143, 144, 160, 146, 162, + 346, 347, 150, 151, 159, 153, 154, 155, 4, 156, + 157, 158, 132, 133, 114, 115, 418, 419, 420, 421, + 160, 160, 162, 162, 160, 427, 162, 84, 85, 161, + 22, 162, 121, 122, 160, 169, 4, 601, 384, 441, + 9, 55, 26, 27, 9, 160, 564, 159, 9, 567, + 568, 569, 141, 142, 9, 144, 145, 9, 147, 148, + 149, 9, 57, 169, 11, 160, 22, 413, 159, 159, + 472, 417, 94, 95, 96, 97, 98, 99, 100, 101, + 102, 103, 4, 429, 430, 431, 432, 433, 159, 159, + 159, 159, 494, 439, 440, 159, 159, 499, 159, 501, + 159, 38, 504, 38, 162, 22, 670, 162, 162, 673, + 162, 457, 514, 515, 162, 517, 100, 101, 102, 103, + 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, + 162, 162, 159, 159, 159, 481, 159, 61, 162, 159, + 486, 162, 38, 162, 162, 22, 162, 644, 165, 162, + 162, 162, 554, 555, 162, 557, 558, 559, 560, 162, + 162, 162, 162, 565, 0, 162, 17, 513, 17, 162, + 667, 573, 162, 519, 162, 169, 162, 579, 4, 162, + 162, 162, 18, 19, 20, 162, 22, 23, 24, 162, + 162, 162, 4, 539, 30, 31, 374, 375, 376, 377, + 378, 379, 380, 4, 162, 162, 169, 22, 0, 162, + 4, 389, 390, 391, 616, 169, 52, 162, 564, 162, + 56, 567, 568, 569, 60, 159, 18, 19, 20, 162, + 22, 23, 24, 162, 160, 162, 4, 162, 30, 31, + 293, 294, 162, 296, 159, 54, 160, 22, 169, 162, + 162, 160, 160, 17, 600, 162, 167, 160, 160, 165, + 52, 607, 664, 160, 56, 160, 668, 669, 60, 167, + 160, 160, 160, 54, 4, 162, 622, 152, 331, 599, + 458, 459, 460, 461, 22, 159, 339, 340, 341, 342, + 343, 469, 159, 17, 162, 17, 17, 73, 700, 701, + 17, 703, 661, 705, 93, 640, 112, 709, 239, 106, + 250, 7, 8, 715, 10, 11, 12, 13, 14, 15, + 16, 17, 17, 19, 20, 671, 22, 23, 24, 90, + 7, 8, 57, 10, 11, 12, 13, 14, 15, 16, + 17, 661, 19, 20, -1, 22, 23, 24, 133, 622, + 528, 529, 530, 531, 50, 533, 133, 462, -1, 537, + 538, -1, -1, -1, -1, 418, 419, 420, 421, -1, + -1, -1, -1, 50, 427, -1, -1, 7, 8, -1, + 10, 11, 12, 13, 14, 15, 16, 17, 441, 19, 20, -1, 22, 23, 24, -1, -1, -1, -1, -1, - -1, 119, 120, 121, 122, 123, 124, 125, 126, 127, - 128, 129, 130, 131, -1, 133, -1, 135, 136, 137, - 50, 139, 140, 141, 142, -1, 144, 145, -1, 147, - 148, 149, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 3, 4, 5, 6, 7, 8, 9, -1, 167, - -1, -1, 170, -1, 172, -1, 174, 19, 20, -1, - 22, 23, 24, 25, 26, 27, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 40, 41, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 55, -1, 7, 8, 59, 10, 11, - 12, 13, 14, 15, 16, 17, -1, 19, 20, -1, - 22, 23, 24, 75, 76, 77, 78, 79, 80, 81, - 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, - 92, 93, -1, -1, -1, -1, 166, 167, 50, -1, - 170, -1, 172, 173, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 119, 120, 121, - 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, - -1, 133, -1, 135, 136, 137, -1, 139, 140, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 161, - -1, -1, -1, -1, -1, 167, -1, -1, 170, -1, - 172, -1, 174, 3, 4, 5, 6, 7, 8, 9, - -1, -1, 0, -1, -1, -1, -1, -1, -1, 19, - 20, -1, 22, 23, 24, 25, 26, 27, -1, -1, - 18, 19, 20, -1, 22, 23, 24, -1, -1, -1, - 40, 41, 30, 31, 166, 167, -1, -1, 170, -1, - 172, 173, -1, -1, -1, -1, -1, -1, -1, 59, - -1, -1, -1, -1, 52, -1, -1, -1, 56, -1, - -1, -1, 60, -1, -1, 75, 76, 77, 78, 79, - 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, - 90, 91, 92, 93, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 119, - 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, - 130, 131, -1, 133, -1, 135, 136, 137, -1, 139, - 140, 3, 4, 5, 6, -1, -1, 9, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 25, 26, 27, -1, 167, -1, -1, - 170, -1, 172, -1, 174, -1, -1, -1, 40, 41, + -1, -1, -1, 581, 582, 583, 584, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 59, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 75, 76, 77, 78, 79, 80, 81, - 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, - 92, 93, -1, -1, -1, -1, -1, -1, -1, -1, + 50, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 119, 120, 121, - 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, - -1, 133, -1, 135, 136, 137, -1, 139, 140, -1, - 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 19, 20, -1, 22, 23, 24, 25, -1, - -1, -1, -1, -1, -1, 167, -1, -1, 170, -1, - 172, -1, 174, 40, 41, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 55, -1, + -1, 494, -1, -1, -1, -1, 499, -1, 501, -1, + 628, 504, 630, 631, -1, -1, -1, -1, -1, -1, + -1, 514, 515, -1, 517, -1, -1, -1, 164, 165, + -1, -1, 168, -1, 170, 171, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 164, 165, -1, + -1, 168, -1, 170, 171, -1, -1, -1, -1, -1, + -1, 554, 555, -1, 557, 558, 559, 560, -1, -1, + -1, -1, 565, -1, -1, -1, -1, -1, -1, -1, + 573, -1, -1, -1, -1, -1, 579, -1, -1, -1, + -1, -1, -1, -1, 164, 165, -1, -1, 168, -1, + 170, 171, -1, -1, -1, -1, -1, -1, 3, 4, + 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, + -1, -1, -1, 616, 19, 20, -1, 22, 23, 24, + 25, 26, 27, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 40, 41, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 54, + -1, -1, -1, -1, 59, -1, -1, -1, -1, -1, + -1, 664, -1, -1, -1, 668, 669, -1, -1, -1, + 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, + 85, 86, 87, 88, 89, 90, 91, 92, 93, -1, + -1, -1, -1, -1, -1, -1, -1, 700, 701, -1, + 703, -1, 705, -1, -1, -1, 709, -1, -1, -1, + -1, -1, 715, -1, 119, 120, 121, 122, 123, 124, + 125, 126, 127, 128, 129, 130, 131, -1, 133, -1, + 135, 136, 137, -1, 139, 140, 141, 142, -1, 144, + 145, -1, 147, 148, 149, -1, -1, -1, -1, -1, + -1, -1, 3, 4, 5, 6, 7, 8, 9, -1, + 165, -1, -1, 168, -1, 170, -1, 172, 19, 20, + -1, 22, 23, 24, 25, 26, 27, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, + 41, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 55, -1, 7, 8, 59, 10, + 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, + -1, 22, 23, 24, 75, 76, 77, 78, 79, 80, + 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, + 91, 92, 93, -1, -1, -1, -1, -1, -1, 50, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 75, 76, - 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, - 87, 88, 89, 90, 91, 92, 93, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 119, 120, + 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, + 131, -1, 133, -1, 135, 136, 137, -1, 139, 140, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 159, -1, + -1, -1, -1, -1, 165, -1, -1, 168, -1, 170, + -1, 172, 3, 4, 5, 6, 7, 8, 9, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 19, 20, + -1, 22, 23, 24, 25, 26, 27, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, + 41, -1, -1, 164, 165, -1, -1, 168, -1, 170, + 171, -1, -1, -1, -1, -1, 7, 8, 59, 10, + 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, + -1, 22, 23, 24, 75, 76, 77, 78, 79, 80, + 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, + 91, 92, 93, -1, -1, -1, -1, 7, 8, 50, + 10, 11, 12, 13, 14, 15, 16, 17, -1, 19, + 20, -1, 22, 23, 24, -1, -1, -1, 119, 120, + 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, + 131, -1, 133, -1, 135, 136, 137, -1, 139, 140, + 50, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 3, 4, 5, 6, -1, -1, 9, -1, -1, -1, + -1, -1, -1, -1, 165, -1, -1, 168, -1, 170, + -1, 172, 25, 26, 27, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 40, 41, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 119, 120, 121, 122, 123, 124, 125, 126, - 127, 128, 129, 130, 131, -1, 133, -1, 135, 136, - 137, -1, 139, 140, -1, 7, 8, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 19, 20, -1, - 22, 23, 24, 25, 161, -1, -1, -1, 165, -1, - 167, -1, -1, 170, -1, 172, -1, 174, 40, 41, + -1, -1, -1, -1, -1, -1, 59, -1, -1, -1, + -1, -1, -1, 164, 165, -1, -1, 168, -1, 170, + 171, -1, 75, 76, 77, 78, 79, 80, 81, 82, + 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, + 93, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 164, 165, -1, -1, 168, -1, + 170, 171, -1, -1, -1, -1, 119, 120, 121, 122, + 123, 124, 125, 126, 127, 128, 129, 130, 131, -1, + 133, -1, 135, 136, 137, -1, 139, 140, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 7, 8, 55, 10, 11, 12, 13, 14, 15, - 16, 17, -1, 19, 20, -1, 22, 23, 24, -1, - -1, -1, -1, 75, 76, 77, 78, 79, 80, 81, - 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, - 92, 93, -1, -1, 50, -1, 7, 8, -1, 10, - 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, - -1, 22, 23, 24, -1, -1, -1, 119, 120, 121, - 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, - -1, 133, -1, 135, 136, 137, -1, 139, 140, 50, - 7, 8, -1, 10, 11, 12, 13, 14, 15, 16, - 17, -1, 19, 20, -1, 22, 23, 24, -1, 161, - -1, -1, -1, -1, -1, 167, -1, -1, 170, -1, - 172, -1, 174, -1, -1, -1, -1, -1, -1, -1, - -1, 7, 8, 50, 10, 11, 12, 13, 14, 15, + 19, 20, -1, 22, 23, 24, 25, -1, -1, -1, + -1, -1, 165, -1, -1, 168, -1, 170, -1, 172, + -1, 40, 41, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 7, 8, 55, 10, 11, 12, + 13, 14, 15, 16, 17, -1, 19, 20, -1, 22, + 23, 24, -1, -1, -1, -1, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, + 89, 90, 91, 92, 93, -1, -1, 50, -1, -1, + -1, 7, 8, -1, 10, 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, -1, 22, 23, 24, -1, + 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, + 129, 130, 131, 39, 133, -1, 135, 136, 137, -1, + 139, 140, 7, 8, 50, 10, 11, 12, 13, 14, + 15, 16, 17, -1, 19, 20, -1, 22, 23, 24, + 159, -1, 7, 8, 163, -1, 165, -1, -1, 168, + -1, 170, -1, 172, 19, 20, -1, 22, 23, 24, + 25, -1, -1, -1, -1, 50, -1, -1, 141, 142, + -1, 144, -1, -1, -1, 40, 41, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 166, 167, -1, 39, 170, -1, 172, 173, -1, -1, - -1, -1, -1, -1, 50, 7, 8, -1, 10, 11, - 12, 13, 14, 15, 16, 17, -1, 19, 20, -1, - 22, 23, 24, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 166, 167, -1, -1, 170, - -1, 172, 173, -1, -1, -1, 7, 8, 50, 10, - 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, - -1, 22, 23, 24, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 39, 166, - 167, -1, -1, 170, -1, 172, 173, 7, 8, 50, - 10, 11, 12, 13, 14, 15, 16, 17, -1, 19, - 20, -1, 22, 23, 24, -1, -1, -1, -1, -1, + 55, 164, 165, -1, -1, 168, -1, 170, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 166, 167, -1, 125, 170, -1, 172, -1, 7, 8, - 50, 10, 11, 12, 13, 14, 15, 16, 17, -1, + 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, + 85, 86, 87, 88, 89, 90, 91, 92, 93, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 164, 165, + 125, -1, 168, -1, 170, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 119, 120, 121, 122, 123, 124, + 125, 126, 127, 128, 129, 130, 131, -1, 133, -1, + 135, 136, 137, -1, 139, 140, -1, -1, -1, 164, + 165, -1, -1, 168, -1, 170, -1, -1, -1, -1, + -1, -1, -1, -1, 159, -1, -1, -1, -1, -1, + 165, -1, -1, 168, -1, 170, -1, 172, 7, 8, + -1, 10, 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, -1, 22, 23, 24, 7, 8, -1, 10, 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, - 39, 22, 23, 24, 166, 167, -1, -1, 170, -1, - 172, 50, -1, -1, -1, 7, 8, -1, 10, 11, - 12, 13, 14, 15, 16, 17, -1, 19, 20, 50, - 22, 23, 24, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 166, 167, 39, -1, 170, - -1, 172, -1, -1, -1, -1, 7, 8, 50, 10, - 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, - -1, 22, 23, 24, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 166, 167, -1, 169, - 170, -1, 172, -1, -1, -1, -1, 7, 8, 50, + 39, 22, 23, 24, -1, -1, -1, -1, -1, 7, + 8, 50, 10, 11, 12, 13, 14, 15, 16, 17, + -1, 19, 20, -1, 22, 23, 24, 7, 8, 50, 10, 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, -1, 22, 23, 24, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 166, 167, -1, - -1, 170, -1, 172, -1, -1, -1, -1, -1, -1, - 50, -1, -1, -1, -1, 166, 167, -1, 169, 170, - -1, 172, 7, 8, -1, 10, 11, 12, 13, 14, - 15, 16, 17, -1, 19, 20, -1, 22, 23, 24, - -1, -1, -1, -1, 166, 167, -1, -1, 170, -1, - 172, 7, 8, -1, 10, 11, 12, 13, 14, 15, - 16, 17, -1, 19, 20, 50, 22, 23, 24, -1, + -1, -1, 50, -1, -1, -1, -1, -1, -1, 39, + -1, -1, -1, -1, -1, -1, -1, -1, 7, 8, + 50, 10, 11, 12, 13, 14, 15, 16, 17, -1, + 19, 20, -1, 22, 23, 24, -1, -1, -1, 7, + 8, -1, 10, 11, 12, 13, 14, 15, 16, 17, + 39, 19, 20, -1, 22, 23, 24, -1, -1, -1, + -1, 50, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 164, 165, -1, -1, 168, + -1, 170, 50, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 164, 165, -1, 167, 168, -1, 170, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 166, 167, -1, -1, 170, - -1, 172, 7, 8, 50, 10, 11, 12, 13, 14, - 15, 16, 17, -1, 19, 20, -1, 22, 23, 24, + -1, -1, -1, -1, -1, -1, 164, 165, -1, 167, + 168, -1, 170, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 164, 165, -1, -1, 168, -1, + 170, 7, 8, -1, 10, 11, 12, 13, 14, 15, + 16, 17, -1, 19, 20, -1, 22, 23, 24, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 166, 167, -1, -1, - 170, -1, 172, 7, 8, 50, 10, 11, 12, 13, + -1, -1, -1, -1, -1, 164, 165, -1, -1, 168, + -1, 170, -1, -1, 50, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 164, 165, -1, -1, + 168, -1, 170, 7, 8, -1, 10, 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, -1, 22, 23, 24, 7, 8, -1, 10, 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, -1, 22, 23, 24, -1, - -1, -1, -1, -1, -1, -1, 50, -1, -1, -1, - -1, 166, 167, -1, -1, 170, -1, 172, -1, -1, - -1, -1, 7, 8, 50, 10, 11, 12, 13, 14, + -1, -1, -1, -1, 7, 8, 50, 10, 11, 12, + 13, 14, 15, 16, 17, -1, 19, 20, -1, 22, + 23, 24, 7, 8, 50, 10, 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, -1, 22, 23, 24, - 166, 167, -1, -1, 170, -1, 172, 7, 8, -1, - 10, 11, 12, 13, 14, 15, 16, 17, -1, 19, - 20, -1, 22, 23, 24, 50, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 166, 167, -1, -1, 170, -1, 172, -1, -1, - 50, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 166, 167, -1, -1, 170, -1, 172, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 166, 167, -1, -1, 170, -1, 172, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 50, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 164, 165, + -1, -1, 168, -1, 170, 50, 7, 8, -1, 10, + 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, + -1, 22, 23, 24, 7, 8, -1, 10, 11, 12, + 13, 14, 15, 16, 17, -1, 19, 20, -1, 22, + 23, 24, -1, -1, -1, -1, -1, -1, -1, 50, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 164, 165, -1, -1, 168, -1, 170, 50, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 164, 165, + -1, -1, 168, -1, 170, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 164, 165, -1, -1, 168, -1, 170, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 164, + 165, -1, -1, 168, -1, 170, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 36, 166, 167, -1, -1, 170, -1, 172, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 57, 58, -1, -1, -1, 166, 167, -1, -1, - 170, -1, 172, 69, 70, 71, 72, 73, 74, 75, - 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, - 86, 87, 88, 89, 90, 91, 92, 93, -1, -1, + -1, -1, -1, -1, -1, 36, -1, -1, -1, -1, + -1, -1, -1, 164, 165, -1, -1, 168, -1, 170, + -1, -1, -1, -1, -1, -1, 57, 58, -1, -1, + -1, 164, 165, -1, -1, 168, -1, 170, 69, 70, + 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, + 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, + 91, 92, 93, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 114, 115, - 116, -1, -1, 119, 120, 121, 122, 123, 124, 125, - 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, - 136, 137, 138, 139, 140 + -1, -1, -1, 114, 115, 116, -1, -1, 119, 120, + 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, + 131, 132, 133, 134, 135, 136, 137, 138, 139, 140 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing @@ -2758,77 +2772,77 @@ static const yytype_uint16 yystos[] = { 0, 19, 20, 22, 23, 24, 30, 31, 52, 56, - 60, 183, 186, 188, 189, 190, 225, 226, 227, 229, - 228, 53, 68, 234, 163, 59, 163, 18, 163, 42, - 43, 44, 45, 46, 47, 48, 49, 51, 158, 159, - 160, 191, 192, 193, 0, 227, 46, 48, 194, 244, - 42, 43, 44, 47, 195, 241, 243, 251, 163, 163, - 167, 235, 22, 233, 7, 8, 10, 11, 12, 13, - 14, 15, 16, 17, 50, 166, 167, 170, 172, 183, - 188, 212, 213, 247, 193, 193, 35, 37, 223, 193, - 193, 21, 252, 253, 29, 173, 242, 252, 22, 22, - 22, 236, 161, 4, 4, 4, 172, 10, 173, 213, - 218, 55, 161, 185, 223, 223, 42, 44, 196, 32, - 33, 222, 62, 63, 64, 65, 66, 67, 197, 239, - 239, 7, 186, 187, 256, 164, 169, 39, 213, 214, - 216, 217, 168, 168, 173, 218, 164, 173, 161, 217, - 165, 222, 222, 10, 125, 213, 215, 224, 11, 12, - 13, 14, 15, 16, 181, 182, 213, 219, 4, 215, - 28, 172, 240, 163, 36, 57, 58, 69, 70, 71, + 60, 181, 184, 186, 187, 188, 222, 223, 224, 226, + 225, 53, 68, 231, 161, 59, 161, 18, 161, 42, + 43, 44, 45, 46, 47, 48, 49, 51, 156, 157, + 158, 189, 190, 191, 0, 224, 46, 48, 192, 241, + 42, 43, 44, 47, 193, 238, 240, 248, 161, 161, + 165, 232, 22, 230, 7, 8, 10, 11, 12, 13, + 14, 15, 16, 17, 50, 164, 165, 168, 170, 181, + 186, 209, 210, 244, 191, 191, 35, 37, 220, 191, + 191, 21, 249, 250, 29, 171, 239, 249, 22, 22, + 22, 233, 159, 4, 4, 4, 170, 10, 171, 210, + 215, 55, 159, 183, 220, 220, 42, 44, 194, 32, + 33, 219, 62, 63, 64, 65, 66, 67, 195, 236, + 236, 7, 184, 185, 253, 162, 167, 39, 210, 211, + 213, 214, 166, 166, 171, 215, 162, 171, 159, 214, + 163, 219, 219, 10, 125, 210, 212, 221, 11, 12, + 13, 14, 15, 16, 179, 180, 210, 216, 4, 199, + 28, 170, 237, 161, 36, 57, 58, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 114, 115, 116, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, - 134, 135, 136, 137, 138, 139, 140, 176, 177, 178, - 254, 261, 262, 263, 264, 254, 262, 22, 199, 164, - 162, 213, 213, 171, 173, 213, 4, 162, 219, 213, - 161, 247, 26, 27, 3, 4, 5, 6, 9, 25, + 134, 135, 136, 137, 138, 139, 140, 174, 175, 176, + 251, 258, 259, 260, 261, 251, 259, 22, 197, 162, + 160, 210, 210, 169, 171, 210, 4, 160, 216, 210, + 159, 244, 26, 27, 3, 4, 5, 6, 9, 25, 40, 41, 90, 91, 92, 93, 119, 133, 135, 136, - 137, 139, 140, 167, 170, 172, 174, 176, 177, 178, - 220, 247, 185, 188, 57, 10, 213, 249, 250, 11, - 17, 11, 181, 197, 94, 95, 96, 97, 98, 99, - 100, 101, 102, 103, 179, 26, 27, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 180, 179, 180, 213, 213, 249, 213, 213, 257, - 249, 249, 249, 249, 249, 213, 213, 213, 213, 213, - 249, 197, 117, 118, 54, 121, 122, 141, 142, 144, - 145, 147, 148, 149, 198, 39, 214, 201, 169, 171, - 171, 162, 201, 185, 185, 224, 179, 180, 179, 180, - 161, 161, 161, 161, 161, 161, 161, 169, 219, 221, - 172, 221, 173, 221, 22, 161, 161, 161, 230, 161, - 3, 4, 5, 6, 9, 25, 26, 27, 40, 41, - 59, 167, 170, 172, 174, 220, 246, 247, 248, 164, - 248, 248, 248, 215, 213, 213, 213, 213, 164, 207, - 164, 207, 248, 167, 164, 164, 164, 164, 164, 164, - 248, 248, 248, 248, 248, 38, 215, 213, 249, 4, - 141, 142, 143, 144, 146, 150, 151, 200, 231, 232, - 38, 161, 161, 161, 161, 219, 219, 219, 219, 219, - 219, 219, 164, 169, 173, 213, 221, 171, 173, 219, - 219, 219, 164, 210, 39, 213, 237, 238, 61, 245, - 169, 221, 172, 221, 173, 221, 22, 249, 164, 164, - 248, 248, 248, 248, 248, 11, 54, 11, 259, 248, - 167, 249, 213, 249, 249, 249, 164, 164, 260, 164, - 164, 164, 213, 248, 248, 164, 210, 210, 213, 219, - 219, 219, 219, 259, 164, 164, 164, 164, 260, 164, - 219, 171, 173, 164, 164, 38, 34, 54, 208, 211, - 199, 164, 162, 22, 169, 173, 221, 171, 173, 17, - 17, 161, 164, 164, 164, 164, 248, 4, 248, 164, - 164, 248, 164, 164, 164, 4, 4, 164, 213, 248, - 248, 161, 164, 207, 213, 162, 164, 164, 164, 164, - 162, 219, 219, 219, 219, 162, 219, 171, 219, 219, - 213, 22, 4, 210, 183, 184, 39, 213, 201, 164, - 171, 173, 248, 248, 17, 213, 258, 248, 248, 248, - 248, 207, 207, 249, 248, 164, 249, 249, 249, 4, - 248, 258, 248, 219, 219, 219, 219, 164, 162, 164, - 164, 260, 162, 162, 162, 199, 208, 209, 22, 171, - 164, 167, 199, 199, 162, 164, 169, 248, 260, 162, - 207, 162, 162, 162, 162, 219, 219, 219, 162, 184, - 54, 206, 17, 169, 181, 255, 121, 122, 248, 248, - 201, 17, 213, 169, 201, 162, 162, 162, 4, 152, - 205, 248, 246, 169, 181, 199, 199, 38, 199, 199, - 22, 153, 204, 164, 246, 17, 248, 248, 161, 17, - 164, 248, 199, 199, 154, 157, 202, 203, 248, 17, - 73, 163, 162, 164, 248, 17, 155, 156, 203, 248 + 137, 139, 140, 165, 168, 170, 172, 174, 175, 176, + 217, 244, 183, 141, 142, 144, 198, 212, 57, 10, + 210, 246, 247, 11, 17, 11, 179, 195, 94, 95, + 96, 97, 98, 99, 100, 101, 102, 103, 177, 26, + 27, 100, 101, 102, 103, 104, 105, 106, 107, 108, + 109, 110, 111, 112, 113, 178, 177, 178, 210, 210, + 246, 210, 210, 254, 246, 246, 246, 246, 246, 210, + 210, 210, 210, 210, 246, 195, 117, 118, 54, 121, + 122, 141, 142, 144, 145, 147, 148, 149, 196, 39, + 211, 201, 167, 169, 169, 160, 201, 183, 183, 221, + 177, 178, 177, 178, 159, 159, 159, 159, 159, 159, + 159, 167, 216, 218, 170, 218, 171, 218, 22, 159, + 159, 159, 227, 186, 3, 4, 5, 6, 9, 25, + 26, 27, 40, 41, 59, 165, 168, 170, 172, 217, + 243, 244, 245, 162, 245, 245, 245, 199, 210, 210, + 210, 210, 162, 204, 162, 204, 245, 165, 162, 162, + 162, 162, 162, 162, 245, 245, 245, 245, 245, 38, + 199, 210, 246, 4, 141, 142, 143, 144, 146, 150, + 151, 153, 154, 155, 200, 228, 229, 38, 159, 159, + 159, 159, 216, 216, 216, 216, 216, 216, 216, 162, + 167, 171, 210, 218, 169, 171, 216, 216, 216, 162, + 207, 159, 61, 242, 167, 218, 170, 218, 171, 218, + 22, 246, 162, 162, 212, 245, 245, 245, 245, 11, + 54, 11, 256, 245, 165, 246, 210, 246, 246, 246, + 162, 162, 257, 162, 162, 162, 210, 212, 245, 162, + 207, 207, 210, 216, 216, 216, 216, 256, 162, 162, + 162, 162, 257, 162, 216, 169, 171, 162, 162, 38, + 34, 54, 205, 208, 39, 210, 234, 235, 22, 167, + 171, 218, 169, 171, 17, 17, 245, 162, 162, 162, + 162, 245, 4, 245, 162, 162, 245, 162, 162, 162, + 4, 4, 162, 210, 245, 245, 245, 162, 204, 210, + 160, 162, 162, 162, 162, 160, 216, 216, 216, 216, + 160, 216, 169, 216, 216, 210, 22, 4, 207, 197, + 162, 160, 162, 169, 171, 245, 245, 159, 245, 245, + 245, 245, 204, 204, 246, 245, 162, 246, 246, 246, + 4, 245, 159, 245, 216, 216, 216, 216, 162, 160, + 162, 162, 257, 160, 160, 160, 181, 182, 39, 210, + 201, 22, 169, 162, 165, 17, 210, 255, 167, 245, + 257, 255, 204, 160, 160, 160, 160, 216, 216, 216, + 160, 197, 205, 206, 17, 167, 179, 252, 197, 197, + 160, 162, 167, 160, 160, 160, 160, 182, 54, 203, + 245, 243, 167, 179, 121, 122, 245, 245, 201, 17, + 210, 201, 4, 152, 202, 162, 243, 197, 197, 38, + 197, 197, 22, 17, 162, 17, 245, 245, 245, 17, + 245, 197, 197, 245, 73, 17, 245 }; #define yyerrok (yyerrstatus = 0) @@ -3643,152 +3657,152 @@ switch (yyn) { case 29: -#line 1146 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1142 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;} break; case 30: -#line 1146 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1142 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;} break; case 31: -#line 1147 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1143 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;} break; case 32: -#line 1147 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1143 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;} break; case 33: -#line 1148 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1144 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;} break; case 34: -#line 1148 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1144 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;} break; case 35: -#line 1149 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1145 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;} break; case 36: -#line 1149 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1145 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;} break; case 37: -#line 1150 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1146 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;} break; case 38: -#line 1150 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1146 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;} break; case 39: -#line 1154 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1150 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;} break; case 40: -#line 1154 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1150 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;} break; case 41: -#line 1155 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1151 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;} break; case 42: -#line 1155 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1151 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;} break; case 43: -#line 1156 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1152 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;} break; case 44: -#line 1156 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1152 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;} break; case 45: -#line 1157 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1153 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;} break; case 46: -#line 1157 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1153 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;} break; case 47: -#line 1158 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1154 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;} break; case 48: -#line 1158 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1154 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;} break; case 49: -#line 1159 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1155 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;} break; case 50: -#line 1159 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1155 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;} break; case 51: -#line 1160 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1156 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;} break; case 52: -#line 1160 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1156 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;} break; case 53: -#line 1161 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1157 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;} break; case 54: -#line 1162 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1158 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;} break; case 65: -#line 1171 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1167 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; ;} break; case 66: -#line 1173 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1169 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal)=(yyvsp[(3) - (4)].UInt64Val); ;} break; case 67: -#line 1174 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1170 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal)=0; ;} break; case 68: -#line 1178 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1174 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal); CHECK_FOR_ERROR @@ -3796,7 +3810,7 @@ break; case 69: -#line 1182 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1178 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; CHECK_FOR_ERROR @@ -3804,7 +3818,7 @@ break; case 70: -#line 1187 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1183 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = (yyvsp[(1) - (2)].UIntVal); CHECK_FOR_ERROR @@ -3812,7 +3826,7 @@ break; case 74: -#line 1196 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1192 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; CHECK_FOR_ERROR @@ -3820,7 +3834,7 @@ break; case 75: -#line 1201 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1197 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal); CHECK_FOR_ERROR @@ -3828,157 +3842,157 @@ break; case 76: -#line 1207 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1203 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} break; case 77: -#line 1208 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1204 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} break; case 78: -#line 1209 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1205 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} break; case 79: -#line 1210 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1206 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;} break; case 80: -#line 1211 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1207 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} break; case 81: -#line 1212 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1208 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::CommonLinkage; ;} break; case 82: -#line 1216 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1212 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} break; case 83: -#line 1217 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1213 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} break; case 84: -#line 1218 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1214 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} break; case 85: -#line 1222 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1218 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;} break; case 86: -#line 1223 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1219 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;} break; case 87: -#line 1224 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1220 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;} break; case 88: -#line 1225 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1221 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;} break; case 89: -#line 1229 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1225 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} break; case 90: -#line 1230 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1226 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} break; case 91: -#line 1231 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1227 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} break; case 92: -#line 1235 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1231 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} break; case 93: -#line 1236 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1232 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} break; case 94: -#line 1237 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1233 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} break; case 95: -#line 1238 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1234 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} break; case 96: -#line 1239 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1235 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} break; case 97: -#line 1243 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1239 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} break; case 98: -#line 1244 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1240 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} break; case 99: -#line 1245 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1241 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} break; case 100: -#line 1248 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1244 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::C; ;} break; case 101: -#line 1249 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1245 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::C; ;} break; case 102: -#line 1250 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1246 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::Fast; ;} break; case 103: -#line 1251 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1247 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::Cold; ;} break; case 104: -#line 1252 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1248 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::X86_StdCall; ;} break; case 105: -#line 1253 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1249 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::X86_FastCall; ;} break; case 106: -#line 1254 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1250 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val)) GEN_ERROR("Calling conv too large"); @@ -3988,181 +4002,176 @@ break; case 107: -#line 1261 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1257 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::ZExt; ;} break; case 108: -#line 1262 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1258 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::ZExt; ;} break; case 109: -#line 1263 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1259 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::SExt; ;} break; case 110: -#line 1264 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1260 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::SExt; ;} break; case 111: -#line 1265 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1261 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::InReg; ;} break; case 112: -#line 1266 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1262 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::StructRet; ;} break; case 113: -#line 1267 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1263 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::NoAlias; ;} break; case 114: -#line 1268 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1264 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::ByVal; ;} break; case 115: -#line 1269 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1265 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::Nest; ;} break; case 116: -#line 1270 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1266 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::constructAlignmentFromInt((yyvsp[(2) - (2)].UInt64Val)); ;} break; case 117: -#line 1274 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1270 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::None; ;} break; case 118: -#line 1275 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1271 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = (yyvsp[(1) - (2)].Attributes) | (yyvsp[(2) - (2)].Attributes); ;} break; case 119: -#line 1280 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" - { (yyval.Attributes) = Attribute::NoReturn; ;} +#line 1276 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.Attributes) = Attribute::InReg; ;} break; case 120: -#line 1281 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" - { (yyval.Attributes) = Attribute::NoUnwind; ;} +#line 1277 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.Attributes) = Attribute::ZExt; ;} break; case 121: -#line 1282 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" - { (yyval.Attributes) = Attribute::InReg; ;} +#line 1278 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.Attributes) = Attribute::SExt; ;} break; case 122: -#line 1283 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" - { (yyval.Attributes) = Attribute::ZExt; ;} +#line 1281 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.Attributes) = Attribute::None; ;} break; case 123: -#line 1284 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" - { (yyval.Attributes) = Attribute::SExt; ;} +#line 1282 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.Attributes) = (yyvsp[(1) - (2)].Attributes) | (yyvsp[(2) - (2)].Attributes); + ;} break; case 124: -#line 1285 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" - { (yyval.Attributes) = Attribute::ReadNone; ;} +#line 1288 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.Attributes) = Attribute::NoReturn; ;} break; case 125: -#line 1286 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" - { (yyval.Attributes) = Attribute::ReadOnly; ;} +#line 1289 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.Attributes) = Attribute::NoUnwind; ;} break; case 126: -#line 1289 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" - { (yyval.Attributes) = Attribute::None; ;} +#line 1290 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.Attributes) = Attribute::InReg; ;} break; case 127: -#line 1290 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyval.Attributes) = (yyvsp[(1) - (2)].Attributes) | (yyvsp[(2) - (2)].Attributes); - ;} +#line 1291 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.Attributes) = Attribute::ZExt; ;} break; case 128: -#line 1295 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" - { (yyval.Attributes) = (yyvsp[(1) - (1)].Attributes); ;} +#line 1292 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.Attributes) = Attribute::SExt; ;} break; case 129: -#line 1296 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" - { - unsigned tmp = (yyvsp[(1) - (3)].Attributes) | (yyvsp[(3) - (3)].Attributes); - if ((yyvsp[(3) - (3)].Attributes) == Attribute::NoInline - && ((yyvsp[(1) - (3)].Attributes) & Attribute::AlwaysInline)) - GEN_ERROR("Function Notes may include only one inline notes!") - if ((yyvsp[(3) - (3)].Attributes) == Attribute::AlwaysInline - && ((yyvsp[(1) - (3)].Attributes) & Attribute::NoInline)) - GEN_ERROR("Function Notes may include only one inline notes!") - (yyval.Attributes) = tmp; - CHECK_FOR_ERROR - ;} +#line 1293 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.Attributes) = Attribute::ReadNone; ;} break; case 130: -#line 1309 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" - { (yyval.Attributes) = Attribute::NoInline; ;} +#line 1294 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.Attributes) = Attribute::ReadOnly; ;} break; case 131: -#line 1310 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" - { (yyval.Attributes) = Attribute::AlwaysInline; ;} +#line 1295 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.Attributes) = Attribute::NoInline ;} break; case 132: -#line 1311 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" - { (yyval.Attributes) = Attribute::OptimizeForSize; ;} +#line 1296 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.Attributes) = Attribute::AlwaysInline ;} break; case 133: -#line 1314 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" - { (yyval.Attributes) = Attribute::None; ;} +#line 1297 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.Attributes) = Attribute::OptimizeForSize ;} break; case 134: -#line 1315 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1300 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.Attributes) = Attribute::None; ;} + break; + + case 135: +#line 1301 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { - (yyval.Attributes) = (yyvsp[(3) - (4)].Attributes); + (yyval.Attributes) = (yyvsp[(1) - (2)].Attributes) | (yyvsp[(2) - (2)].Attributes); ;} break; - case 135: -#line 1320 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 136: +#line 1307 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; ;} break; - case 136: -#line 1321 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 137: +#line 1308 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal); ;} break; - case 137: -#line 1328 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 138: +#line 1315 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = 0; ;} break; - case 138: -#line 1329 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 139: +#line 1316 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val); if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) @@ -4171,13 +4180,13 @@ ;} break; - case 139: -#line 1335 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 140: +#line 1322 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = 0; ;} break; - case 140: -#line 1336 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 141: +#line 1323 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val); if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) @@ -4186,8 +4195,8 @@ ;} break; - case 141: -#line 1345 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 142: +#line 1332 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { for (unsigned i = 0, e = (yyvsp[(2) - (2)].StrVal)->length(); i != e; ++i) if ((*(yyvsp[(2) - (2)].StrVal))[i] == '"' || (*(yyvsp[(2) - (2)].StrVal))[i] == '\\') @@ -4197,28 +4206,28 @@ ;} break; - case 142: -#line 1353 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 143: +#line 1340 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; ;} break; - case 143: -#line 1354 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 144: +#line 1341 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;} break; - case 144: -#line 1359 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 145: +#line 1346 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" {;} break; - case 145: -#line 1360 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 146: +#line 1347 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" {;} break; - case 146: -#line 1361 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 147: +#line 1348 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV->setSection(*(yyvsp[(1) - (1)].StrVal)); delete (yyvsp[(1) - (1)].StrVal); @@ -4226,8 +4235,8 @@ ;} break; - case 147: -#line 1366 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 148: +#line 1353 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val))) GEN_ERROR("Alignment must be a power of two"); @@ -4236,24 +4245,24 @@ ;} break; - case 155: -#line 1382 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 156: +#line 1369 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeVal) = new PATypeHolder(OpaqueType::get()); CHECK_FOR_ERROR ;} break; - case 156: -#line 1386 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 157: +#line 1373 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType)); CHECK_FOR_ERROR ;} break; - case 157: -#line 1390 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 158: +#line 1377 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { // Pointer type? if (*(yyvsp[(1) - (3)].TypeVal) == Type::LabelTy) GEN_ERROR("Cannot form a pointer to a basic block"); @@ -4263,8 +4272,8 @@ ;} break; - case 158: -#line 1397 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 159: +#line 1384 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { // Named types are also simple types... const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal)); CHECK_FOR_ERROR @@ -4272,8 +4281,8 @@ ;} break; - case 159: -#line 1402 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 160: +#line 1389 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { // Type UpReference if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range"); OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder @@ -4284,8 +4293,8 @@ ;} break; - case 160: -#line 1410 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 161: +#line 1397 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { // Allow but ignore attributes on function types; this permits auto-upgrade. // FIXME: remove in LLVM 3.0. @@ -4317,8 +4326,8 @@ ;} break; - case 161: -#line 1439 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 162: +#line 1426 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { // Allow but ignore attributes on function types; this permits auto-upgrade. // FIXME: remove in LLVM 3.0. @@ -4345,8 +4354,8 @@ ;} break; - case 162: -#line 1464 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 163: +#line 1451 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { // Sized array type? (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (yyvsp[(2) - (5)].UInt64Val)))); delete (yyvsp[(4) - (5)].TypeVal); @@ -4354,8 +4363,8 @@ ;} break; - case 163: -#line 1469 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 164: +#line 1456 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { // Vector type? const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get(); if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val)) @@ -4368,8 +4377,8 @@ ;} break; - case 164: -#line 1479 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 165: +#line 1466 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { // Structure type? std::vector Elements; for (std::list::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(), @@ -4382,16 +4391,16 @@ ;} break; - case 165: -#line 1489 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 166: +#line 1476 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { // Empty structure type? (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector())); CHECK_FOR_ERROR ;} break; - case 166: -#line 1493 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 167: +#line 1480 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { std::vector Elements; for (std::list::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(), @@ -4404,16 +4413,16 @@ ;} break; - case 167: -#line 1503 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 168: +#line 1490 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { // Empty structure type? (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector(), true)); CHECK_FOR_ERROR ;} break; - case 168: -#line 1510 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 169: +#line 1497 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { // Allow but ignore attributes on function types; this permits auto-upgrade. // FIXME: remove in LLVM 3.0. @@ -4422,8 +4431,8 @@ ;} break; - case 169: -#line 1519 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 170: +#line 1506 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription()); @@ -4433,15 +4442,15 @@ ;} break; - case 170: -#line 1526 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 171: +#line 1513 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeVal) = new PATypeHolder(Type::VoidTy); ;} break; - case 171: -#line 1531 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 172: +#line 1518 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeWithAttrsList) = new TypeWithAttrsList(); (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs)); @@ -4449,16 +4458,16 @@ ;} break; - case 172: -#line 1536 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 173: +#line 1523 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs)); CHECK_FOR_ERROR ;} break; - case 174: -#line 1544 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 175: +#line 1531 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList); TypeWithAttrs TWA; TWA.Attrs = Attribute::None; @@ -4468,8 +4477,8 @@ ;} break; - case 175: -#line 1551 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 176: +#line 1538 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeWithAttrsList) = new TypeWithAttrsList; TypeWithAttrs TWA; TWA.Attrs = Attribute::None; @@ -4479,16 +4488,16 @@ ;} break; - case 176: -#line 1558 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 177: +#line 1545 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeWithAttrsList) = new TypeWithAttrsList(); CHECK_FOR_ERROR ;} break; - case 177: -#line 1566 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 178: +#line 1553 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeList) = new std::list(); (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal)); @@ -4497,8 +4506,8 @@ ;} break; - case 178: -#line 1572 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 179: +#line 1559 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal)); delete (yyvsp[(3) - (3)].TypeVal); @@ -4506,8 +4515,8 @@ ;} break; - case 179: -#line 1584 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 180: +#line 1571 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized arr if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription()); @@ -4538,8 +4547,8 @@ ;} break; - case 180: -#line 1612 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 181: +#line 1599 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); @@ -4558,8 +4567,8 @@ ;} break; - case 181: -#line 1628 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 182: +#line 1615 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); @@ -4589,8 +4598,8 @@ ;} break; - case 182: -#line 1655 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 183: +#line 1642 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized arr if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription()); @@ -4621,8 +4630,8 @@ ;} break; - case 183: -#line 1683 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 184: +#line 1670 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { const StructType *STy = dyn_cast((yyvsp[(1) - (4)].TypeVal)->get()); if (STy == 0) @@ -4651,8 +4660,8 @@ ;} break; - case 184: -#line 1709 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 185: +#line 1696 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); @@ -4675,8 +4684,8 @@ ;} break; - case 185: -#line 1729 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 186: +#line 1716 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { const StructType *STy = dyn_cast((yyvsp[(1) - (6)].TypeVal)->get()); if (STy == 0) @@ -4705,8 +4714,8 @@ ;} break; - case 186: -#line 1755 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 187: +#line 1742 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription()); @@ -4729,8 +4738,8 @@ ;} break; - case 187: -#line 1775 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 188: +#line 1762 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); @@ -4745,8 +4754,8 @@ ;} break; - case 188: -#line 1787 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 189: +#line 1774 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); @@ -4756,8 +4765,8 @@ ;} break; - case 189: -#line 1794 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 190: +#line 1781 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); @@ -4826,8 +4835,8 @@ ;} break; - case 190: -#line 1860 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 191: +#line 1847 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); @@ -4840,8 +4849,8 @@ ;} break; - case 191: -#line 1870 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 192: +#line 1857 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); @@ -4854,8 +4863,8 @@ ;} break; - case 192: -#line 1880 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 193: +#line 1867 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { // integral constants if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val))) GEN_ERROR("Constant value doesn't fit in type"); @@ -4864,8 +4873,8 @@ ;} break; - case 193: -#line 1886 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 194: +#line 1873 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { // arbitrary precision integer constants uint32_t BitWidth = cast((yyvsp[(1) - (2)].PrimType))->getBitWidth(); if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) { @@ -4878,8 +4887,8 @@ ;} break; - case 194: -#line 1896 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 195: +#line 1883 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { // integral constants if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val))) GEN_ERROR("Constant value doesn't fit in type"); @@ -4888,8 +4897,8 @@ ;} break; - case 195: -#line 1902 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 196: +#line 1889 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { // arbitrary precision integer constants uint32_t BitWidth = cast((yyvsp[(1) - (2)].PrimType))->getBitWidth(); if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) { @@ -4902,8 +4911,8 @@ ;} break; - case 196: -#line 1912 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 197: +#line 1899 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { // Boolean constants if (cast((yyvsp[(1) - (2)].PrimType))->getBitWidth() != 1) GEN_ERROR("Constant true must have type i1"); @@ -4912,8 +4921,8 @@ ;} break; - case 197: -#line 1918 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 198: +#line 1905 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { // Boolean constants if (cast((yyvsp[(1) - (2)].PrimType))->getBitWidth() != 1) GEN_ERROR("Constant false must have type i1"); @@ -4922,8 +4931,8 @@ ;} break; - case 198: -#line 1924 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 199: +#line 1911 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { // Floating point constants if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal))) GEN_ERROR("Floating point constant invalid for type"); @@ -4937,8 +4946,8 @@ ;} break; - case 199: -#line 1937 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 200: +#line 1924 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription()); @@ -4953,8 +4962,8 @@ ;} break; - case 200: -#line 1949 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 201: +#line 1936 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if (!isa((yyvsp[(3) - (5)].ConstVal)->getType())) GEN_ERROR("GetElementPtr requires a pointer operand"); @@ -4978,8 +4987,8 @@ ;} break; - case 201: -#line 1970 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 202: +#line 1957 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty) GEN_ERROR("Select condition must be of boolean type"); @@ -4990,8 +4999,8 @@ ;} break; - case 202: -#line 1978 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 203: +#line 1965 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType()) GEN_ERROR("Binary operator types must match"); @@ -5000,8 +5009,8 @@ ;} break; - case 203: -#line 1984 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 204: +#line 1971 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType()) GEN_ERROR("Logical operator types must match"); @@ -5015,8 +5024,8 @@ ;} break; - case 204: -#line 1995 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 205: +#line 1982 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) GEN_ERROR("icmp operand types must match"); @@ -5024,8 +5033,8 @@ ;} break; - case 205: -#line 2000 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 206: +#line 1987 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) GEN_ERROR("fcmp operand types must match"); @@ -5033,8 +5042,8 @@ ;} break; - case 206: -#line 2005 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 207: +#line 1992 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) GEN_ERROR("vicmp operand types must match"); @@ -5042,8 +5051,8 @@ ;} break; - case 207: -#line 2010 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 208: +#line 1997 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) GEN_ERROR("vfcmp operand types must match"); @@ -5051,8 +5060,8 @@ ;} break; - case 208: -#line 2015 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 209: +#line 2002 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal))) GEN_ERROR("Invalid extractelement operands"); @@ -5061,8 +5070,8 @@ ;} break; - case 209: -#line 2021 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 210: +#line 2008 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal))) GEN_ERROR("Invalid insertelement operands"); @@ -5071,8 +5080,8 @@ ;} break; - case 210: -#line 2027 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 211: +#line 2014 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal))) GEN_ERROR("Invalid shufflevector operands"); @@ -5081,8 +5090,8 @@ ;} break; - case 211: -#line 2033 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 212: +#line 2020 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if (!isa((yyvsp[(3) - (5)].ConstVal)->getType()) && !isa((yyvsp[(3) - (5)].ConstVal)->getType())) GEN_ERROR("ExtractValue requires an aggregate operand"); @@ -5093,8 +5102,8 @@ ;} break; - case 212: -#line 2041 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 213: +#line 2028 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if (!isa((yyvsp[(3) - (7)].ConstVal)->getType()) && !isa((yyvsp[(3) - (7)].ConstVal)->getType())) GEN_ERROR("InsertValue requires an aggregate operand"); @@ -5105,16 +5114,16 @@ ;} break; - case 213: -#line 2052 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 214: +#line 2039 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal)); CHECK_FOR_ERROR ;} break; - case 214: -#line 2056 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 215: +#line 2043 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ConstVector) = new std::vector(); (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal)); @@ -5122,28 +5131,28 @@ ;} break; - case 215: -#line 2064 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 216: +#line 2051 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; ;} break; - case 216: -#line 2064 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 217: +#line 2051 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; ;} break; - case 217: -#line 2067 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 218: +#line 2054 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; ;} break; - case 218: -#line 2067 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 219: +#line 2054 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; ;} break; - case 219: -#line 2070 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 220: +#line 2057 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get(); Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal)); @@ -5158,8 +5167,8 @@ ;} break; - case 220: -#line 2082 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 221: +#line 2069 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { Constant *Val = (yyvsp[(3) - (6)].ConstVal); const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get(); @@ -5174,8 +5183,8 @@ ;} break; - case 221: -#line 2103 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 222: +#line 2090 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule; CurModule.ModuleDone(); @@ -5183,8 +5192,8 @@ ;} break; - case 222: -#line 2108 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 223: +#line 2095 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule; CurModule.ModuleDone(); @@ -5192,40 +5201,40 @@ ;} break; - case 225: -#line 2121 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 226: +#line 2108 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.isDeclare = false; ;} break; - case 226: -#line 2121 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 227: +#line 2108 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.FunctionDone(); CHECK_FOR_ERROR ;} break; - case 227: -#line 2125 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 228: +#line 2112 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.isDeclare = true; ;} break; - case 228: -#line 2125 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 229: +#line 2112 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; - case 229: -#line 2128 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 230: +#line 2115 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; - case 230: -#line 2131 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 231: +#line 2118 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription()); @@ -5252,8 +5261,8 @@ ;} break; - case 231: -#line 2155 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 232: +#line 2142 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType)); @@ -5267,8 +5276,8 @@ ;} break; - case 232: -#line 2167 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 233: +#line 2154 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { /* "Externally Visible" Linkage */ if ((yyvsp[(5) - (6)].ConstVal) == 0) @@ -5279,15 +5288,15 @@ ;} break; - case 233: -#line 2174 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 234: +#line 2161 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; ;} break; - case 234: -#line 2178 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 235: +#line 2165 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(6) - (7)].ConstVal) == 0) GEN_ERROR("Global value initializer is not a constant"); @@ -5296,15 +5305,15 @@ ;} break; - case 235: -#line 2183 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 236: +#line 2170 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; ;} break; - case 236: -#line 2187 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 237: +#line 2174 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (7)].TypeVal))->getDescription()); @@ -5314,16 +5323,16 @@ ;} break; - case 237: -#line 2193 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 238: +#line 2180 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; CHECK_FOR_ERROR ;} break; - case 238: -#line 2197 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 239: +#line 2184 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { std::string Name; if ((yyvsp[(1) - (5)].StrVal)) { @@ -5366,22 +5375,22 @@ ;} break; - case 239: -#line 2237 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 240: +#line 2224 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; - case 240: -#line 2240 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 241: +#line 2227 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; - case 241: -#line 2246 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 242: +#line 2233 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm(); if (AsmSoFar.empty()) @@ -5393,24 +5402,24 @@ ;} break; - case 242: -#line 2256 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 243: +#line 2243 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal)); delete (yyvsp[(3) - (3)].StrVal); ;} break; - case 243: -#line 2260 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 244: +#line 2247 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal)); delete (yyvsp[(3) - (3)].StrVal); ;} break; - case 245: -#line 2267 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 246: +#line 2254 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal)); delete (yyvsp[(3) - (3)].StrVal); @@ -5418,8 +5427,8 @@ ;} break; - case 246: -#line 2272 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 247: +#line 2259 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal)); delete (yyvsp[(1) - (1)].StrVal); @@ -5427,15 +5436,15 @@ ;} break; - case 247: -#line 2277 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 248: +#line 2264 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; - case 248: -#line 2286 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 249: +#line 2273 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription()); @@ -5448,8 +5457,8 @@ ;} break; - case 249: -#line 2296 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 250: +#line 2283 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); @@ -5462,16 +5471,16 @@ ;} break; - case 250: -#line 2307 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 251: +#line 2294 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList); CHECK_FOR_ERROR ;} break; - case 251: -#line 2311 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 252: +#line 2298 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList); struct ArgListEntry E; @@ -5483,8 +5492,8 @@ ;} break; - case 252: -#line 2320 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 253: +#line 2307 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = new ArgListType; struct ArgListEntry E; @@ -5496,52 +5505,52 @@ ;} break; - case 253: -#line 2329 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 254: +#line 2316 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = 0; CHECK_FOR_ERROR ;} break; - case 254: -#line 2335 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 255: +#line 2322 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { - std::string FunctionName(*(yyvsp[(3) - (11)].StrVal)); - delete (yyvsp[(3) - (11)].StrVal); // Free strdup'd memory! + std::string FunctionName(*(yyvsp[(4) - (11)].StrVal)); + delete (yyvsp[(4) - (11)].StrVal); // Free strdup'd memory! // Check the function result for abstractness if this is a define. We should // have no abstract types at this point - if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(2) - (11)].TypeVal))) - GEN_ERROR("Reference to abstract result: "+ (yyvsp[(2) - (11)].TypeVal)->get()->getDescription()); + if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(3) - (11)].TypeVal))) + GEN_ERROR("Reference to abstract result: "+ (yyvsp[(3) - (11)].TypeVal)->get()->getDescription()); - if (!FunctionType::isValidReturnType(*(yyvsp[(2) - (11)].TypeVal))) + if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (11)].TypeVal))) GEN_ERROR("Invalid result type for LLVM function"); std::vector ParamTypeList; SmallVector Attrs; //FIXME : In 3.0, stop accepting zext, sext and inreg as optional function //attributes. - Attributes RetAttrs = 0; - if ((yyvsp[(7) - (11)].Attributes) != Attribute::None) { - if ((yyvsp[(7) - (11)].Attributes) & Attribute::ZExt) { + Attributes RetAttrs = (yyvsp[(2) - (11)].Attributes); + if ((yyvsp[(8) - (11)].Attributes) != Attribute::None) { + if ((yyvsp[(8) - (11)].Attributes) & Attribute::ZExt) { RetAttrs = RetAttrs | Attribute::ZExt; - (yyvsp[(7) - (11)].Attributes) = (yyvsp[(7) - (11)].Attributes) ^ Attribute::ZExt; + (yyvsp[(8) - (11)].Attributes) = (yyvsp[(8) - (11)].Attributes) ^ Attribute::ZExt; } - if ((yyvsp[(7) - (11)].Attributes) & Attribute::SExt) { + if ((yyvsp[(8) - (11)].Attributes) & Attribute::SExt) { RetAttrs = RetAttrs | Attribute::SExt; - (yyvsp[(7) - (11)].Attributes) = (yyvsp[(7) - (11)].Attributes) ^ Attribute::SExt; + (yyvsp[(8) - (11)].Attributes) = (yyvsp[(8) - (11)].Attributes) ^ Attribute::SExt; } - if ((yyvsp[(7) - (11)].Attributes) & Attribute::InReg) { + if ((yyvsp[(8) - (11)].Attributes) & Attribute::InReg) { RetAttrs = RetAttrs | Attribute::InReg; - (yyvsp[(7) - (11)].Attributes) = (yyvsp[(7) - (11)].Attributes) ^ Attribute::InReg; + (yyvsp[(8) - (11)].Attributes) = (yyvsp[(8) - (11)].Attributes) ^ Attribute::InReg; } - if (RetAttrs != Attribute::None) - Attrs.push_back(AttributeWithIndex::get(0, RetAttrs)); } - if ((yyvsp[(5) - (11)].ArgList)) { // If there are arguments... + if (RetAttrs != Attribute::None) + Attrs.push_back(AttributeWithIndex::get(0, RetAttrs)); + if ((yyvsp[(6) - (11)].ArgList)) { // If there are arguments... unsigned index = 1; - for (ArgListType::iterator I = (yyvsp[(5) - (11)].ArgList)->begin(); I != (yyvsp[(5) - (11)].ArgList)->end(); ++I, ++index) { + for (ArgListType::iterator I = (yyvsp[(6) - (11)].ArgList)->begin(); I != (yyvsp[(6) - (11)].ArgList)->end(); ++I, ++index) { const Type* Ty = I->Ty->get(); if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty)) GEN_ERROR("Reference to abstract argument: " + Ty->getDescription()); @@ -5550,8 +5559,8 @@ Attrs.push_back(AttributeWithIndex::get(index, I->Attrs)); } } - if ((yyvsp[(7) - (11)].Attributes) != Attribute::None) - Attrs.push_back(AttributeWithIndex::get(~0, (yyvsp[(7) - (11)].Attributes))); + if ((yyvsp[(8) - (11)].Attributes) != Attribute::None) + Attrs.push_back(AttributeWithIndex::get(~0, (yyvsp[(8) - (11)].Attributes))); bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy; if (isVarArg) ParamTypeList.pop_back(); @@ -5560,9 +5569,9 @@ if (!Attrs.empty()) PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); - FunctionType *FT = FunctionType::get(*(yyvsp[(2) - (11)].TypeVal), ParamTypeList, isVarArg); + FunctionType *FT = FunctionType::get(*(yyvsp[(3) - (11)].TypeVal), ParamTypeList, isVarArg); const PointerType *PFT = PointerType::getUnqual(FT); - delete (yyvsp[(2) - (11)].TypeVal); + delete (yyvsp[(3) - (11)].TypeVal); ValID ID; if (!FunctionName.empty()) { @@ -5618,32 +5627,29 @@ } Fn->setCallingConv((yyvsp[(1) - (11)].UIntVal)); Fn->setAttributes(PAL); - Fn->setAlignment((yyvsp[(9) - (11)].UIntVal)); - if ((yyvsp[(8) - (11)].StrVal)) { - Fn->setSection(*(yyvsp[(8) - (11)].StrVal)); - delete (yyvsp[(8) - (11)].StrVal); - } - if ((yyvsp[(10) - (11)].StrVal)) { - Fn->setGC((yyvsp[(10) - (11)].StrVal)->c_str()); - delete (yyvsp[(10) - (11)].StrVal); - } - if ((yyvsp[(11) - (11)].Attributes)) { - Fn->setNotes((yyvsp[(11) - (11)].Attributes)); + Fn->setAlignment((yyvsp[(10) - (11)].UIntVal)); + if ((yyvsp[(9) - (11)].StrVal)) { + Fn->setSection(*(yyvsp[(9) - (11)].StrVal)); + delete (yyvsp[(9) - (11)].StrVal); + } + if ((yyvsp[(11) - (11)].StrVal)) { + Fn->setGC((yyvsp[(11) - (11)].StrVal)->c_str()); + delete (yyvsp[(11) - (11)].StrVal); } // Add all of the arguments we parsed to the function... - if ((yyvsp[(5) - (11)].ArgList)) { // Is null if empty... + if ((yyvsp[(6) - (11)].ArgList)) { // Is null if empty... if (isVarArg) { // Nuke the last entry - assert((yyvsp[(5) - (11)].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[(5) - (11)].ArgList)->back().Name == 0 && + assert((yyvsp[(6) - (11)].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[(6) - (11)].ArgList)->back().Name == 0 && "Not a varargs marker!"); - delete (yyvsp[(5) - (11)].ArgList)->back().Ty; - (yyvsp[(5) - (11)].ArgList)->pop_back(); // Delete the last entry + delete (yyvsp[(6) - (11)].ArgList)->back().Ty; + (yyvsp[(6) - (11)].ArgList)->pop_back(); // Delete the last entry } Function::arg_iterator ArgIt = Fn->arg_begin(); Function::arg_iterator ArgEnd = Fn->arg_end(); unsigned Idx = 1; - for (ArgListType::iterator I = (yyvsp[(5) - (11)].ArgList)->begin(); - I != (yyvsp[(5) - (11)].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) { + for (ArgListType::iterator I = (yyvsp[(6) - (11)].ArgList)->begin(); + I != (yyvsp[(6) - (11)].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) { delete I->Ty; // Delete the typeholder... setValueName(ArgIt, I->Name); // Insert arg into symtab... CHECK_FOR_ERROR @@ -5651,14 +5657,14 @@ Idx++; } - delete (yyvsp[(5) - (11)].ArgList); // We're now done with the argument list + delete (yyvsp[(6) - (11)].ArgList); // We're now done with the argument list } CHECK_FOR_ERROR ;} break; - case 257: -#line 2487 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 258: +#line 2471 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FunctionVal) = CurFun.CurrentFunction; @@ -5669,16 +5675,16 @@ ;} break; - case 260: -#line 2498 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 261: +#line 2482 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); CHECK_FOR_ERROR ;} break; - case 261: -#line 2503 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 262: +#line 2487 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage)); CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility)); @@ -5688,40 +5694,40 @@ ;} break; - case 262: -#line 2515 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 263: +#line 2499 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; CHECK_FOR_ERROR ;} break; - case 263: -#line 2519 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 264: +#line 2503 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; CHECK_FOR_ERROR ;} break; - case 264: -#line 2524 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 265: +#line 2508 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { // A reference to a direct constant (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val)); CHECK_FOR_ERROR ;} break; - case 265: -#line 2528 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 266: +#line 2512 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val)); CHECK_FOR_ERROR ;} break; - case 266: -#line 2532 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 267: +#line 2516 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { // arbitrary precision integer constants (yyval.ValIDVal) = ValID::create(*(yyvsp[(1) - (1)].APIntVal), true); delete (yyvsp[(1) - (1)].APIntVal); @@ -5729,8 +5735,8 @@ ;} break; - case 267: -#line 2537 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 268: +#line 2521 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { // arbitrary precision integer constants (yyval.ValIDVal) = ValID::create(*(yyvsp[(1) - (1)].APIntVal), false); delete (yyvsp[(1) - (1)].APIntVal); @@ -5738,56 +5744,56 @@ ;} break; - case 268: -#line 2542 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 269: +#line 2526 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { // Perhaps it's an FP constant? (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal)); CHECK_FOR_ERROR ;} break; - case 269: -#line 2546 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 270: +#line 2530 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue()); CHECK_FOR_ERROR ;} break; - case 270: -#line 2550 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 271: +#line 2534 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse()); CHECK_FOR_ERROR ;} break; - case 271: -#line 2554 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 272: +#line 2538 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::createNull(); CHECK_FOR_ERROR ;} break; - case 272: -#line 2558 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 273: +#line 2542 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::createUndef(); CHECK_FOR_ERROR ;} break; - case 273: -#line 2562 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 274: +#line 2546 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { // A vector zero constant. (yyval.ValIDVal) = ValID::createZeroInit(); CHECK_FOR_ERROR ;} break; - case 274: -#line 2566 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 275: +#line 2550 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized packed vector const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType(); unsigned NumElements = (yyvsp[(2) - (3)].ConstVector)->size(); @@ -5812,8 +5818,8 @@ ;} break; - case 275: -#line 2588 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 276: +#line 2572 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized arr const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType(); uint64_t NumElements = (yyvsp[(2) - (3)].ConstVector)->size(); @@ -5838,8 +5844,8 @@ ;} break; - case 276: -#line 2610 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 277: +#line 2594 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { // Use undef instead of an array because it's inconvenient to determine // the element type at this point, there being no elements to examine. @@ -5848,8 +5854,8 @@ ;} break; - case 277: -#line 2616 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 278: +#line 2600 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { uint64_t NumElements = (yyvsp[(2) - (2)].StrVal)->length(); const Type *ETy = Type::Int8Ty; @@ -5865,8 +5871,8 @@ ;} break; - case 278: -#line 2629 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 279: +#line 2613 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { std::vector Elements((yyvsp[(2) - (3)].ConstVector)->size()); for (unsigned i = 0, e = (yyvsp[(2) - (3)].ConstVector)->size(); i != e; ++i) @@ -5881,8 +5887,8 @@ ;} break; - case 279: -#line 2641 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 280: +#line 2625 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { const StructType *STy = StructType::get(std::vector()); (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, std::vector())); @@ -5890,8 +5896,8 @@ ;} break; - case 280: -#line 2646 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 281: +#line 2630 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { std::vector Elements((yyvsp[(3) - (5)].ConstVector)->size()); for (unsigned i = 0, e = (yyvsp[(3) - (5)].ConstVector)->size(); i != e; ++i) @@ -5906,8 +5912,8 @@ ;} break; - case 281: -#line 2658 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 282: +#line 2642 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { const StructType *STy = StructType::get(std::vector(), /*isPacked=*/true); @@ -5916,16 +5922,16 @@ ;} break; - case 282: -#line 2664 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 283: +#line 2648 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal)); CHECK_FOR_ERROR ;} break; - case 283: -#line 2668 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 284: +#line 2652 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal)); delete (yyvsp[(3) - (5)].StrVal); @@ -5934,24 +5940,24 @@ ;} break; - case 284: -#line 2678 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 285: +#line 2662 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { // Is it an integer reference...? (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal)); CHECK_FOR_ERROR ;} break; - case 285: -#line 2682 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 286: +#line 2666 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal)); CHECK_FOR_ERROR ;} break; - case 286: -#line 2686 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 287: +#line 2670 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { // Is it a named reference...? (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)); delete (yyvsp[(1) - (1)].StrVal); @@ -5959,8 +5965,8 @@ ;} break; - case 287: -#line 2691 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 288: +#line 2675 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { // Is it a named reference...? (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal)); delete (yyvsp[(1) - (1)].StrVal); @@ -5968,8 +5974,8 @@ ;} break; - case 290: -#line 2704 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 291: +#line 2688 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); @@ -5979,8 +5985,8 @@ ;} break; - case 291: -#line 2713 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 292: +#line 2697 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueList) = new std::vector(); (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal)); @@ -5988,32 +5994,32 @@ ;} break; - case 292: -#line 2718 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 293: +#line 2702 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { ((yyval.ValueList)=(yyvsp[(1) - (3)].ValueList))->push_back((yyvsp[(3) - (3)].ValueVal)); CHECK_FOR_ERROR ;} break; - case 293: -#line 2723 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 294: +#line 2707 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); CHECK_FOR_ERROR ;} break; - case 294: -#line 2727 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 295: +#line 2711 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { // Do not allow functions with 0 basic blocks (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); CHECK_FOR_ERROR ;} break; - case 295: -#line 2736 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 296: +#line 2720 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal)); CHECK_FOR_ERROR @@ -6024,8 +6030,8 @@ ;} break; - case 296: -#line 2745 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 297: +#line 2729 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR int ValNum = InsertValue((yyvsp[(3) - (3)].TermInstVal)); @@ -6039,8 +6045,8 @@ ;} break; - case 297: -#line 2758 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 298: +#line 2742 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if (CastInst *CI1 = dyn_cast((yyvsp[(2) - (2)].InstVal))) if (CastInst *CI2 = dyn_cast(CI1->getOperand(0))) @@ -6052,16 +6058,16 @@ ;} break; - case 298: -#line 2767 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 299: +#line 2751 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { // Empty space between instruction lists (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum)); CHECK_FOR_ERROR ;} break; - case 299: -#line 2771 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 300: +#line 2755 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { // Labelled (named) basic block (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal))); delete (yyvsp[(1) - (1)].StrVal); @@ -6070,8 +6076,8 @@ ;} break; - case 300: -#line 2779 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 301: +#line 2763 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { // Return with a result... ValueList &VL = *(yyvsp[(2) - (2)].ValueList); assert(!VL.empty() && "Invalid ret operands!"); @@ -6094,16 +6100,16 @@ ;} break; - case 301: -#line 2799 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 302: +#line 2783 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { // Return with no result... (yyval.TermInstVal) = ReturnInst::Create(); CHECK_FOR_ERROR ;} break; - case 302: -#line 2803 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 303: +#line 2787 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { // Unconditional Branch... BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal)); CHECK_FOR_ERROR @@ -6111,8 +6117,8 @@ ;} break; - case 303: -#line 2808 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 304: +#line 2792 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if (cast((yyvsp[(2) - (9)].PrimType))->getBitWidth() != 1) GEN_ERROR("Branch condition must have type i1"); @@ -6126,8 +6132,8 @@ ;} break; - case 304: -#line 2819 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 305: +#line 2803 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal)); CHECK_FOR_ERROR @@ -6149,8 +6155,8 @@ ;} break; - case 305: -#line 2838 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 306: +#line 2822 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal)); CHECK_FOR_ERROR @@ -6162,18 +6168,18 @@ ;} break; - case 306: -#line 2848 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 307: +#line 2832 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { // Handle the short syntax const PointerType *PFTy = 0; const FunctionType *Ty = 0; - if (!(PFTy = dyn_cast((yyvsp[(3) - (14)].TypeVal)->get())) || + if (!(PFTy = dyn_cast((yyvsp[(4) - (15)].TypeVal)->get())) || !(Ty = dyn_cast(PFTy->getElementType()))) { // Pull out the types of all of the arguments... std::vector ParamTypes; - ParamList::iterator I = (yyvsp[(6) - (14)].ParamList)->begin(), E = (yyvsp[(6) - (14)].ParamList)->end(); + ParamList::iterator I = (yyvsp[(7) - (15)].ParamList)->begin(), E = (yyvsp[(7) - (15)].ParamList)->end(); for (; I != E; ++I) { const Type *Ty = I->Val->getType(); if (Ty == Type::VoidTy) @@ -6181,46 +6187,46 @@ ParamTypes.push_back(Ty); } - if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (14)].TypeVal))) + if (!FunctionType::isValidReturnType(*(yyvsp[(4) - (15)].TypeVal))) GEN_ERROR("Invalid result type for LLVM function"); - Ty = FunctionType::get((yyvsp[(3) - (14)].TypeVal)->get(), ParamTypes, false); + Ty = FunctionType::get((yyvsp[(4) - (15)].TypeVal)->get(), ParamTypes, false); PFTy = PointerType::getUnqual(Ty); } - delete (yyvsp[(3) - (14)].TypeVal); + delete (yyvsp[(4) - (15)].TypeVal); - Value *V = getVal(PFTy, (yyvsp[(4) - (14)].ValIDVal)); // Get the function we're calling... + Value *V = getVal(PFTy, (yyvsp[(5) - (15)].ValIDVal)); // Get the function we're calling... CHECK_FOR_ERROR - BasicBlock *Normal = getBBVal((yyvsp[(11) - (14)].ValIDVal)); + BasicBlock *Normal = getBBVal((yyvsp[(12) - (15)].ValIDVal)); CHECK_FOR_ERROR - BasicBlock *Except = getBBVal((yyvsp[(14) - (14)].ValIDVal)); + BasicBlock *Except = getBBVal((yyvsp[(15) - (15)].ValIDVal)); CHECK_FOR_ERROR SmallVector Attrs; //FIXME : In 3.0, stop accepting zext, sext and inreg as optional function //attributes. - Attributes RetAttrs = 0; - if ((yyvsp[(8) - (14)].Attributes) != Attribute::None) { - if ((yyvsp[(8) - (14)].Attributes) & Attribute::ZExt) { + Attributes RetAttrs = (yyvsp[(3) - (15)].Attributes); + if ((yyvsp[(9) - (15)].Attributes) != Attribute::None) { + if ((yyvsp[(9) - (15)].Attributes) & Attribute::ZExt) { RetAttrs = RetAttrs | Attribute::ZExt; - (yyvsp[(8) - (14)].Attributes) = (yyvsp[(8) - (14)].Attributes) ^ Attribute::ZExt; + (yyvsp[(9) - (15)].Attributes) = (yyvsp[(9) - (15)].Attributes) ^ Attribute::ZExt; } - if ((yyvsp[(8) - (14)].Attributes) & Attribute::SExt) { + if ((yyvsp[(9) - (15)].Attributes) & Attribute::SExt) { RetAttrs = RetAttrs | Attribute::SExt; - (yyvsp[(8) - (14)].Attributes) = (yyvsp[(8) - (14)].Attributes) ^ Attribute::SExt; + (yyvsp[(9) - (15)].Attributes) = (yyvsp[(9) - (15)].Attributes) ^ Attribute::SExt; } - if ((yyvsp[(8) - (14)].Attributes) & Attribute::InReg) { + if ((yyvsp[(9) - (15)].Attributes) & Attribute::InReg) { RetAttrs = RetAttrs | Attribute::InReg; - (yyvsp[(8) - (14)].Attributes) = (yyvsp[(8) - (14)].Attributes) ^ Attribute::InReg; + (yyvsp[(9) - (15)].Attributes) = (yyvsp[(9) - (15)].Attributes) ^ Attribute::InReg; } - if (RetAttrs != Attribute::None) - Attrs.push_back(AttributeWithIndex::get(0, RetAttrs)); } + if (RetAttrs != Attribute::None) + Attrs.push_back(AttributeWithIndex::get(0, RetAttrs)); // Check the arguments ValueList Args; - if ((yyvsp[(6) - (14)].ParamList)->empty()) { // Has no arguments? + if ((yyvsp[(7) - (15)].ParamList)->empty()) { // Has no arguments? // Make sure no arguments is a good thing! if (Ty->getNumParams() != 0) GEN_ERROR("No arguments passed to a function that " @@ -6230,7 +6236,7 @@ // correctly! FunctionType::param_iterator I = Ty->param_begin(); FunctionType::param_iterator E = Ty->param_end(); - ParamList::iterator ArgI = (yyvsp[(6) - (14)].ParamList)->begin(), ArgE = (yyvsp[(6) - (14)].ParamList)->end(); + ParamList::iterator ArgI = (yyvsp[(7) - (15)].ParamList)->begin(), ArgE = (yyvsp[(7) - (15)].ParamList)->end(); unsigned index = 1; for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) { @@ -6252,8 +6258,8 @@ } else if (I != E || ArgI != ArgE) GEN_ERROR("Invalid number of parameters detected"); } - if ((yyvsp[(8) - (14)].Attributes) != Attribute::None) - Attrs.push_back(AttributeWithIndex::get(~0, (yyvsp[(8) - (14)].Attributes))); + if ((yyvsp[(9) - (15)].Attributes) != Attribute::None) + Attrs.push_back(AttributeWithIndex::get(~0, (yyvsp[(9) - (15)].Attributes))); AttrListPtr PAL; if (!Attrs.empty()) PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); @@ -6261,32 +6267,32 @@ // Create the InvokeInst InvokeInst *II = InvokeInst::Create(V, Normal, Except, Args.begin(), Args.end()); - II->setCallingConv((yyvsp[(2) - (14)].UIntVal)); + II->setCallingConv((yyvsp[(2) - (15)].UIntVal)); II->setAttributes(PAL); (yyval.TermInstVal) = II; - delete (yyvsp[(6) - (14)].ParamList); + delete (yyvsp[(7) - (15)].ParamList); CHECK_FOR_ERROR ;} break; - case 307: -#line 2951 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 308: +#line 2935 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TermInstVal) = new UnwindInst(); CHECK_FOR_ERROR ;} break; - case 308: -#line 2955 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 309: +#line 2939 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TermInstVal) = new UnreachableInst(); CHECK_FOR_ERROR ;} break; - case 309: -#line 2962 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 310: +#line 2946 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable); Constant *V = cast(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal))); @@ -6300,8 +6306,8 @@ ;} break; - case 310: -#line 2973 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 311: +#line 2957 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.JumpTable) = new std::vector >(); Constant *V = cast(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal))); @@ -6316,8 +6322,8 @@ ;} break; - case 311: -#line 2986 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 312: +#line 2970 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { // Is this definition named?? if so, assign the name... setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal)); @@ -6328,8 +6334,8 @@ ;} break; - case 312: -#line 2995 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 313: +#line 2979 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR int ValNum = InsertValue((yyvsp[(2) - (2)].InstVal)); @@ -6343,8 +6349,8 @@ ;} break; - case 313: -#line 3008 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 314: +#line 2992 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { // Used for PHI nodes if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription()); @@ -6358,8 +6364,8 @@ ;} break; - case 314: -#line 3019 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 315: +#line 3003 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList); Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal)); @@ -6370,8 +6376,8 @@ ;} break; - case 315: -#line 3029 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 316: +#line 3013 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { // FIXME: Remove trailing OptAttributes in LLVM 3.0, it was a mistake in 2.0 if (!UpRefs.empty()) @@ -6385,8 +6391,8 @@ ;} break; - case 316: -#line 3040 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 317: +#line 3024 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { // FIXME: Remove trailing OptAttributes in LLVM 3.0, it was a mistake in 2.0 // Labels are only valid in ASMs @@ -6397,8 +6403,8 @@ ;} break; - case 317: -#line 3048 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 318: +#line 3032 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { // FIXME: Remove trailing OptAttributes in LLVM 3.0, it was a mistake in 2.0 if (!UpRefs.empty()) @@ -6411,8 +6417,8 @@ ;} break; - case 318: -#line 3058 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 319: +#line 3042 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { // FIXME: Remove trailing OptAttributes in LLVM 3.0, it was a mistake in 2.0 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList); @@ -6422,18 +6428,18 @@ ;} break; - case 319: -#line 3065 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 320: +#line 3049 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamList) = new ParamList(); ;} break; - case 320: -#line 3068 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 321: +#line 3052 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueList) = new std::vector(); ;} break; - case 321: -#line 3069 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 322: +#line 3053 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList); (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal)); @@ -6441,8 +6447,8 @@ ;} break; - case 322: -#line 3077 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 323: +#line 3061 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ConstantList) = new std::vector(); if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val)) @@ -6451,8 +6457,8 @@ ;} break; - case 323: -#line 3083 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 324: +#line 3067 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ConstantList) = (yyvsp[(1) - (3)].ConstantList); if ((unsigned)(yyvsp[(3) - (3)].UInt64Val) != (yyvsp[(3) - (3)].UInt64Val)) @@ -6462,24 +6468,24 @@ ;} break; - case 324: -#line 3092 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 325: +#line 3076 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; CHECK_FOR_ERROR ;} break; - case 325: -#line 3096 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 326: +#line 3080 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; CHECK_FOR_ERROR ;} break; - case 326: -#line 3101 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 327: +#line 3085 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription()); @@ -6498,8 +6504,8 @@ ;} break; - case 327: -#line 3117 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 328: +#line 3101 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription()); @@ -6519,8 +6525,8 @@ ;} break; - case 328: -#line 3134 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 329: +#line 3118 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); @@ -6535,8 +6541,8 @@ ;} break; - case 329: -#line 3146 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 330: +#line 3130 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); @@ -6551,8 +6557,8 @@ ;} break; - case 330: -#line 3158 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 331: +#line 3142 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); @@ -6569,8 +6575,8 @@ ;} break; - case 331: -#line 3172 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 332: +#line 3156 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); @@ -6587,8 +6593,8 @@ ;} break; - case 332: -#line 3186 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 333: +#line 3170 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription()); @@ -6603,8 +6609,8 @@ ;} break; - case 333: -#line 3198 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 334: +#line 3182 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if (isa((yyvsp[(2) - (6)].ValueVal)->getType())) { // vector select @@ -6628,8 +6634,8 @@ ;} break; - case 334: -#line 3219 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 335: +#line 3203 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription()); @@ -6639,8 +6645,8 @@ ;} break; - case 335: -#line 3226 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 336: +#line 3210 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal))) GEN_ERROR("Invalid extractelement operands"); @@ -6649,8 +6655,8 @@ ;} break; - case 336: -#line 3232 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 337: +#line 3216 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal))) GEN_ERROR("Invalid insertelement operands"); @@ -6659,8 +6665,8 @@ ;} break; - case 337: -#line 3238 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 338: +#line 3222 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal))) GEN_ERROR("Invalid shufflevector operands"); @@ -6669,8 +6675,8 @@ ;} break; - case 338: -#line 3244 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 339: +#line 3228 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType(); if (!Ty->isFirstClassType()) @@ -6688,18 +6694,18 @@ ;} break; - case 339: -#line 3260 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 340: +#line 3244 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { // Handle the short syntax const PointerType *PFTy = 0; const FunctionType *Ty = 0; - if (!(PFTy = dyn_cast((yyvsp[(3) - (8)].TypeVal)->get())) || + if (!(PFTy = dyn_cast((yyvsp[(4) - (9)].TypeVal)->get())) || !(Ty = dyn_cast(PFTy->getElementType()))) { // Pull out the types of all of the arguments... std::vector ParamTypes; - ParamList::iterator I = (yyvsp[(6) - (8)].ParamList)->begin(), E = (yyvsp[(6) - (8)].ParamList)->end(); + ParamList::iterator I = (yyvsp[(7) - (9)].ParamList)->begin(), E = (yyvsp[(7) - (9)].ParamList)->end(); for (; I != E; ++I) { const Type *Ty = I->Val->getType(); if (Ty == Type::VoidTy) @@ -6707,14 +6713,14 @@ ParamTypes.push_back(Ty); } - if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (8)].TypeVal))) + if (!FunctionType::isValidReturnType(*(yyvsp[(4) - (9)].TypeVal))) GEN_ERROR("Invalid result type for LLVM function"); - Ty = FunctionType::get((yyvsp[(3) - (8)].TypeVal)->get(), ParamTypes, false); + Ty = FunctionType::get((yyvsp[(4) - (9)].TypeVal)->get(), ParamTypes, false); PFTy = PointerType::getUnqual(Ty); } - Value *V = getVal(PFTy, (yyvsp[(4) - (8)].ValIDVal)); // Get the function we're calling... + Value *V = getVal(PFTy, (yyvsp[(5) - (9)].ValIDVal)); // Get the function we're calling... CHECK_FOR_ERROR // Check for call to invalid intrinsic to avoid crashing later. @@ -6730,27 +6736,27 @@ SmallVector Attrs; //FIXME : In 3.0, stop accepting zext, sext and inreg as optional function //attributes. - Attributes RetAttrs = 0; - if ((yyvsp[(8) - (8)].Attributes) != Attribute::None) { - if ((yyvsp[(8) - (8)].Attributes) & Attribute::ZExt) { + Attributes RetAttrs = (yyvsp[(3) - (9)].Attributes); + if ((yyvsp[(9) - (9)].Attributes) != Attribute::None) { + if ((yyvsp[(9) - (9)].Attributes) & Attribute::ZExt) { RetAttrs = RetAttrs | Attribute::ZExt; - (yyvsp[(8) - (8)].Attributes) = (yyvsp[(8) - (8)].Attributes) ^ Attribute::ZExt; + (yyvsp[(9) - (9)].Attributes) = (yyvsp[(9) - (9)].Attributes) ^ Attribute::ZExt; } - if ((yyvsp[(8) - (8)].Attributes) & Attribute::SExt) { + if ((yyvsp[(9) - (9)].Attributes) & Attribute::SExt) { RetAttrs = RetAttrs | Attribute::SExt; - (yyvsp[(8) - (8)].Attributes) = (yyvsp[(8) - (8)].Attributes) ^ Attribute::SExt; + (yyvsp[(9) - (9)].Attributes) = (yyvsp[(9) - (9)].Attributes) ^ Attribute::SExt; } - if ((yyvsp[(8) - (8)].Attributes) & Attribute::InReg) { + if ((yyvsp[(9) - (9)].Attributes) & Attribute::InReg) { RetAttrs = RetAttrs | Attribute::InReg; - (yyvsp[(8) - (8)].Attributes) = (yyvsp[(8) - (8)].Attributes) ^ Attribute::InReg; + (yyvsp[(9) - (9)].Attributes) = (yyvsp[(9) - (9)].Attributes) ^ Attribute::InReg; } - if (RetAttrs != Attribute::None) - Attrs.push_back(AttributeWithIndex::get(0, RetAttrs)); } + if (RetAttrs != Attribute::None) + Attrs.push_back(AttributeWithIndex::get(0, RetAttrs)); // Check the arguments ValueList Args; - if ((yyvsp[(6) - (8)].ParamList)->empty()) { // Has no arguments? + if ((yyvsp[(7) - (9)].ParamList)->empty()) { // Has no arguments? // Make sure no arguments is a good thing! if (Ty->getNumParams() != 0) GEN_ERROR("No arguments passed to a function that " @@ -6760,7 +6766,7 @@ // correctly. Also, gather any parameter attributes. FunctionType::param_iterator I = Ty->param_begin(); FunctionType::param_iterator E = Ty->param_end(); - ParamList::iterator ArgI = (yyvsp[(6) - (8)].ParamList)->begin(), ArgE = (yyvsp[(6) - (8)].ParamList)->end(); + ParamList::iterator ArgI = (yyvsp[(7) - (9)].ParamList)->begin(), ArgE = (yyvsp[(7) - (9)].ParamList)->end(); unsigned index = 1; for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) { @@ -6781,8 +6787,8 @@ } else if (I != E || ArgI != ArgE) GEN_ERROR("Invalid number of parameters detected"); } - if ((yyvsp[(8) - (8)].Attributes) != Attribute::None) - Attrs.push_back(AttributeWithIndex::get(~0, (yyvsp[(8) - (8)].Attributes))); + if ((yyvsp[(9) - (9)].Attributes) != Attribute::None) + Attrs.push_back(AttributeWithIndex::get(~0, (yyvsp[(9) - (9)].Attributes))); // Finish off the Attributes and check them AttrListPtr PAL; @@ -6791,42 +6797,42 @@ // Create the call node CallInst *CI = CallInst::Create(V, Args.begin(), Args.end()); - CI->setTailCall((yyvsp[(1) - (8)].BoolVal)); - CI->setCallingConv((yyvsp[(2) - (8)].UIntVal)); + CI->setTailCall((yyvsp[(1) - (9)].BoolVal)); + CI->setCallingConv((yyvsp[(2) - (9)].UIntVal)); CI->setAttributes(PAL); (yyval.InstVal) = CI; - delete (yyvsp[(6) - (8)].ParamList); - delete (yyvsp[(3) - (8)].TypeVal); + delete (yyvsp[(7) - (9)].ParamList); + delete (yyvsp[(4) - (9)].TypeVal); CHECK_FOR_ERROR ;} break; - case 340: -#line 3369 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 341: +#line 3353 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal); CHECK_FOR_ERROR ;} break; - case 341: -#line 3374 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 342: +#line 3358 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; CHECK_FOR_ERROR ;} break; - case 342: -#line 3378 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 343: +#line 3362 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; CHECK_FOR_ERROR ;} break; - case 343: -#line 3385 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 344: +#line 3369 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription()); @@ -6836,8 +6842,8 @@ ;} break; - case 344: -#line 3392 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 345: +#line 3376 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription()); @@ -6850,8 +6856,8 @@ ;} break; - case 345: -#line 3402 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 346: +#line 3386 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription()); @@ -6861,8 +6867,8 @@ ;} break; - case 346: -#line 3409 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 347: +#line 3393 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription()); @@ -6875,8 +6881,8 @@ ;} break; - case 347: -#line 3419 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 348: +#line 3403 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if (!isa((yyvsp[(2) - (2)].ValueVal)->getType())) GEN_ERROR("Trying to free nonpointer type " + @@ -6886,8 +6892,8 @@ ;} break; - case 348: -#line 3427 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 349: +#line 3411 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription()); @@ -6904,8 +6910,8 @@ ;} break; - case 349: -#line 3441 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 350: +#line 3425 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription()); @@ -6925,8 +6931,8 @@ ;} break; - case 350: -#line 3458 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 351: +#line 3442 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription()); @@ -6943,8 +6949,8 @@ ;} break; - case 351: -#line 3472 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 352: +#line 3456 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription()); @@ -6962,8 +6968,8 @@ ;} break; - case 352: -#line 3487 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 353: +#line 3471 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription()); @@ -6981,8 +6987,8 @@ ;} break; - case 353: -#line 3502 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + case 354: +#line 3486 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (7)].TypeVal))->getDescription()); @@ -7004,7 +7010,7 @@ /* Line 1267 of yacc.c. */ -#line 7008 "llvmAsmParser.tab.c" +#line 7014 "llvmAsmParser.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -7218,7 +7224,7 @@ } -#line 3521 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3505 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" // common code from the two 'RunVMAsmParser' functions Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.y URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.y?rev=56801&r1=56800&r2=56801&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/llvmAsmParser.y (original) +++ llvm/trunk/lib/AsmParser/llvmAsmParser.y Mon Sep 29 15:49:50 2008 @@ -1089,6 +1089,7 @@ %type OptCallingConv LocalNumber %type OptAttributes Attribute %type OptFuncAttrs FuncAttr +%type OptRetAttrs RetAttr // Basic Block Terminating Operators %token RET BR SWITCH INVOKE UNWIND UNREACHABLE @@ -1272,6 +1273,18 @@ } ; +RetAttr : INREG { $$ = Attribute::InReg; } + | ZEROEXT { $$ = Attribute::ZExt; } + | SIGNEXT { $$ = Attribute::SExt; } + ; + +OptRetAttrs : /* empty */ { $$ = Attribute::None; } + | OptRetAttrs RetAttr { + $$ = $1 | $2; + } + ; + + FuncAttr : NORETURN { $$ = Attribute::NoReturn; } | NOUNWIND { $$ = Attribute::NoUnwind; } | INREG { $$ = Attribute::InReg; } @@ -1290,6 +1303,7 @@ } ; + OptGC : /* empty */ { $$ = 0; } | GC STRINGCONSTANT { $$ = $2; @@ -2304,43 +2318,43 @@ CHECK_FOR_ERROR }; -FunctionHeaderH : OptCallingConv ResultTypes GlobalName '(' ArgList ')' +FunctionHeaderH : OptCallingConv OptRetAttrs ResultTypes GlobalName '(' ArgList ')' OptFuncAttrs OptSection OptAlign OptGC { - std::string FunctionName(*$3); - delete $3; // Free strdup'd memory! + std::string FunctionName(*$4); + delete $4; // Free strdup'd memory! // Check the function result for abstractness if this is a define. We should // have no abstract types at this point - if (!CurFun.isDeclare && CurModule.TypeIsUnresolved($2)) - GEN_ERROR("Reference to abstract result: "+ $2->get()->getDescription()); + if (!CurFun.isDeclare && CurModule.TypeIsUnresolved($3)) + GEN_ERROR("Reference to abstract result: "+ $3->get()->getDescription()); - if (!FunctionType::isValidReturnType(*$2)) + if (!FunctionType::isValidReturnType(*$3)) GEN_ERROR("Invalid result type for LLVM function"); std::vector ParamTypeList; SmallVector Attrs; //FIXME : In 3.0, stop accepting zext, sext and inreg as optional function //attributes. - Attributes RetAttrs = 0; - if ($7 != Attribute::None) { - if ($7 & Attribute::ZExt) { + Attributes RetAttrs = $2; + if ($8 != Attribute::None) { + if ($8 & Attribute::ZExt) { RetAttrs = RetAttrs | Attribute::ZExt; - $7 = $7 ^ Attribute::ZExt; + $8 = $8 ^ Attribute::ZExt; } - if ($7 & Attribute::SExt) { + if ($8 & Attribute::SExt) { RetAttrs = RetAttrs | Attribute::SExt; - $7 = $7 ^ Attribute::SExt; + $8 = $8 ^ Attribute::SExt; } - if ($7 & Attribute::InReg) { + if ($8 & Attribute::InReg) { RetAttrs = RetAttrs | Attribute::InReg; - $7 = $7 ^ Attribute::InReg; + $8 = $8 ^ Attribute::InReg; } - if (RetAttrs != Attribute::None) - Attrs.push_back(AttributeWithIndex::get(0, RetAttrs)); } - if ($5) { // If there are arguments... + if (RetAttrs != Attribute::None) + Attrs.push_back(AttributeWithIndex::get(0, RetAttrs)); + if ($6) { // If there are arguments... unsigned index = 1; - for (ArgListType::iterator I = $5->begin(); I != $5->end(); ++I, ++index) { + for (ArgListType::iterator I = $6->begin(); I != $6->end(); ++I, ++index) { const Type* Ty = I->Ty->get(); if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty)) GEN_ERROR("Reference to abstract argument: " + Ty->getDescription()); @@ -2349,8 +2363,8 @@ Attrs.push_back(AttributeWithIndex::get(index, I->Attrs)); } } - if ($7 != Attribute::None) - Attrs.push_back(AttributeWithIndex::get(~0, $7)); + if ($8 != Attribute::None) + Attrs.push_back(AttributeWithIndex::get(~0, $8)); bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy; if (isVarArg) ParamTypeList.pop_back(); @@ -2359,9 +2373,9 @@ if (!Attrs.empty()) PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); - FunctionType *FT = FunctionType::get(*$2, ParamTypeList, isVarArg); + FunctionType *FT = FunctionType::get(*$3, ParamTypeList, isVarArg); const PointerType *PFT = PointerType::getUnqual(FT); - delete $2; + delete $3; ValID ID; if (!FunctionName.empty()) { @@ -2417,29 +2431,29 @@ } Fn->setCallingConv($1); Fn->setAttributes(PAL); - Fn->setAlignment($9); - if ($8) { - Fn->setSection(*$8); - delete $8; - } - if ($10) { - Fn->setGC($10->c_str()); - delete $10; + Fn->setAlignment($10); + if ($9) { + Fn->setSection(*$9); + delete $9; + } + if ($11) { + Fn->setGC($11->c_str()); + delete $11; } // Add all of the arguments we parsed to the function... - if ($5) { // Is null if empty... + if ($6) { // Is null if empty... if (isVarArg) { // Nuke the last entry - assert($5->back().Ty->get() == Type::VoidTy && $5->back().Name == 0 && + assert($6->back().Ty->get() == Type::VoidTy && $6->back().Name == 0 && "Not a varargs marker!"); - delete $5->back().Ty; - $5->pop_back(); // Delete the last entry + delete $6->back().Ty; + $6->pop_back(); // Delete the last entry } Function::arg_iterator ArgIt = Fn->arg_begin(); Function::arg_iterator ArgEnd = Fn->arg_end(); unsigned Idx = 1; - for (ArgListType::iterator I = $5->begin(); - I != $5->end() && ArgIt != ArgEnd; ++I, ++ArgIt) { + for (ArgListType::iterator I = $6->begin(); + I != $6->end() && ArgIt != ArgEnd; ++I, ++ArgIt) { delete I->Ty; // Delete the typeholder... setValueName(ArgIt, I->Name); // Insert arg into symtab... CHECK_FOR_ERROR @@ -2447,7 +2461,7 @@ Idx++; } - delete $5; // We're now done with the argument list + delete $6; // We're now done with the argument list } CHECK_FOR_ERROR }; @@ -2814,17 +2828,17 @@ $$ = S; CHECK_FOR_ERROR } - | INVOKE OptCallingConv ResultTypes ValueRef '(' ParamList ')' OptFuncAttrs - TO LABEL ValueRef UNWIND LABEL ValueRef { + | INVOKE OptCallingConv OptRetAttrs ResultTypes ValueRef '(' ParamList ')' + OptFuncAttrs TO LABEL ValueRef UNWIND LABEL ValueRef { // Handle the short syntax const PointerType *PFTy = 0; const FunctionType *Ty = 0; - if (!(PFTy = dyn_cast($3->get())) || + if (!(PFTy = dyn_cast($4->get())) || !(Ty = dyn_cast(PFTy->getElementType()))) { // Pull out the types of all of the arguments... std::vector ParamTypes; - ParamList::iterator I = $6->begin(), E = $6->end(); + ParamList::iterator I = $7->begin(), E = $7->end(); for (; I != E; ++I) { const Type *Ty = I->Val->getType(); if (Ty == Type::VoidTy) @@ -2832,46 +2846,46 @@ ParamTypes.push_back(Ty); } - if (!FunctionType::isValidReturnType(*$3)) + if (!FunctionType::isValidReturnType(*$4)) GEN_ERROR("Invalid result type for LLVM function"); - Ty = FunctionType::get($3->get(), ParamTypes, false); + Ty = FunctionType::get($4->get(), ParamTypes, false); PFTy = PointerType::getUnqual(Ty); } - delete $3; + delete $4; - Value *V = getVal(PFTy, $4); // Get the function we're calling... + Value *V = getVal(PFTy, $5); // Get the function we're calling... CHECK_FOR_ERROR - BasicBlock *Normal = getBBVal($11); + BasicBlock *Normal = getBBVal($12); CHECK_FOR_ERROR - BasicBlock *Except = getBBVal($14); + BasicBlock *Except = getBBVal($15); CHECK_FOR_ERROR SmallVector Attrs; //FIXME : In 3.0, stop accepting zext, sext and inreg as optional function //attributes. - Attributes RetAttrs = 0; - if ($8 != Attribute::None) { - if ($8 & Attribute::ZExt) { + Attributes RetAttrs = $3; + if ($9 != Attribute::None) { + if ($9 & Attribute::ZExt) { RetAttrs = RetAttrs | Attribute::ZExt; - $8 = $8 ^ Attribute::ZExt; + $9 = $9 ^ Attribute::ZExt; } - if ($8 & Attribute::SExt) { + if ($9 & Attribute::SExt) { RetAttrs = RetAttrs | Attribute::SExt; - $8 = $8 ^ Attribute::SExt; + $9 = $9 ^ Attribute::SExt; } - if ($8 & Attribute::InReg) { + if ($9 & Attribute::InReg) { RetAttrs = RetAttrs | Attribute::InReg; - $8 = $8 ^ Attribute::InReg; + $9 = $9 ^ Attribute::InReg; } - if (RetAttrs != Attribute::None) - Attrs.push_back(AttributeWithIndex::get(0, RetAttrs)); } + if (RetAttrs != Attribute::None) + Attrs.push_back(AttributeWithIndex::get(0, RetAttrs)); // Check the arguments ValueList Args; - if ($6->empty()) { // Has no arguments? + if ($7->empty()) { // Has no arguments? // Make sure no arguments is a good thing! if (Ty->getNumParams() != 0) GEN_ERROR("No arguments passed to a function that " @@ -2881,7 +2895,7 @@ // correctly! FunctionType::param_iterator I = Ty->param_begin(); FunctionType::param_iterator E = Ty->param_end(); - ParamList::iterator ArgI = $6->begin(), ArgE = $6->end(); + ParamList::iterator ArgI = $7->begin(), ArgE = $7->end(); unsigned index = 1; for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) { @@ -2903,8 +2917,8 @@ } else if (I != E || ArgI != ArgE) GEN_ERROR("Invalid number of parameters detected"); } - if ($8 != Attribute::None) - Attrs.push_back(AttributeWithIndex::get(~0, $8)); + if ($9 != Attribute::None) + Attrs.push_back(AttributeWithIndex::get(~0, $9)); AttrListPtr PAL; if (!Attrs.empty()) PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); @@ -2915,7 +2929,7 @@ II->setCallingConv($2); II->setAttributes(PAL); $$ = II; - delete $6; + delete $7; CHECK_FOR_ERROR } | UNWIND { @@ -3226,17 +3240,17 @@ delete $2; // Free the list... CHECK_FOR_ERROR } - | OptTailCall OptCallingConv ResultTypes ValueRef '(' ParamList ')' + | OptTailCall OptCallingConv OptRetAttrs ResultTypes ValueRef '(' ParamList ')' OptFuncAttrs { // Handle the short syntax const PointerType *PFTy = 0; const FunctionType *Ty = 0; - if (!(PFTy = dyn_cast($3->get())) || + if (!(PFTy = dyn_cast($4->get())) || !(Ty = dyn_cast(PFTy->getElementType()))) { // Pull out the types of all of the arguments... std::vector ParamTypes; - ParamList::iterator I = $6->begin(), E = $6->end(); + ParamList::iterator I = $7->begin(), E = $7->end(); for (; I != E; ++I) { const Type *Ty = I->Val->getType(); if (Ty == Type::VoidTy) @@ -3244,14 +3258,14 @@ ParamTypes.push_back(Ty); } - if (!FunctionType::isValidReturnType(*$3)) + if (!FunctionType::isValidReturnType(*$4)) GEN_ERROR("Invalid result type for LLVM function"); - Ty = FunctionType::get($3->get(), ParamTypes, false); + Ty = FunctionType::get($4->get(), ParamTypes, false); PFTy = PointerType::getUnqual(Ty); } - Value *V = getVal(PFTy, $4); // Get the function we're calling... + Value *V = getVal(PFTy, $5); // Get the function we're calling... CHECK_FOR_ERROR // Check for call to invalid intrinsic to avoid crashing later. @@ -3267,27 +3281,27 @@ SmallVector Attrs; //FIXME : In 3.0, stop accepting zext, sext and inreg as optional function //attributes. - Attributes RetAttrs = 0; - if ($8 != Attribute::None) { - if ($8 & Attribute::ZExt) { + Attributes RetAttrs = $3; + if ($9 != Attribute::None) { + if ($9 & Attribute::ZExt) { RetAttrs = RetAttrs | Attribute::ZExt; - $8 = $8 ^ Attribute::ZExt; + $9 = $9 ^ Attribute::ZExt; } - if ($8 & Attribute::SExt) { + if ($9 & Attribute::SExt) { RetAttrs = RetAttrs | Attribute::SExt; - $8 = $8 ^ Attribute::SExt; + $9 = $9 ^ Attribute::SExt; } - if ($8 & Attribute::InReg) { + if ($9 & Attribute::InReg) { RetAttrs = RetAttrs | Attribute::InReg; - $8 = $8 ^ Attribute::InReg; + $9 = $9 ^ Attribute::InReg; } - if (RetAttrs != Attribute::None) - Attrs.push_back(AttributeWithIndex::get(0, RetAttrs)); } + if (RetAttrs != Attribute::None) + Attrs.push_back(AttributeWithIndex::get(0, RetAttrs)); // Check the arguments ValueList Args; - if ($6->empty()) { // Has no arguments? + if ($7->empty()) { // Has no arguments? // Make sure no arguments is a good thing! if (Ty->getNumParams() != 0) GEN_ERROR("No arguments passed to a function that " @@ -3297,7 +3311,7 @@ // correctly. Also, gather any parameter attributes. FunctionType::param_iterator I = Ty->param_begin(); FunctionType::param_iterator E = Ty->param_end(); - ParamList::iterator ArgI = $6->begin(), ArgE = $6->end(); + ParamList::iterator ArgI = $7->begin(), ArgE = $7->end(); unsigned index = 1; for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) { @@ -3318,8 +3332,8 @@ } else if (I != E || ArgI != ArgE) GEN_ERROR("Invalid number of parameters detected"); } - if ($8 != Attribute::None) - Attrs.push_back(AttributeWithIndex::get(~0, $8)); + if ($9 != Attribute::None) + Attrs.push_back(AttributeWithIndex::get(~0, $9)); // Finish off the Attributes and check them AttrListPtr PAL; @@ -3332,8 +3346,8 @@ CI->setCallingConv($2); CI->setAttributes(PAL); $$ = CI; - delete $6; - delete $3; + delete $7; + delete $4; CHECK_FOR_ERROR } | MemoryInst { Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs?rev=56801&r1=56800&r2=56801&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs (original) +++ llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs Mon Sep 29 15:49:50 2008 @@ -1089,6 +1089,7 @@ %type OptCallingConv LocalNumber %type OptAttributes Attribute %type OptFuncAttrs FuncAttr +%type OptRetAttrs RetAttr // Basic Block Terminating Operators %token RET BR SWITCH INVOKE UNWIND UNREACHABLE @@ -1272,6 +1273,18 @@ } ; +RetAttr : INREG { $$ = Attribute::InReg; } + | ZEROEXT { $$ = Attribute::ZExt; } + | SIGNEXT { $$ = Attribute::SExt; } + ; + +OptRetAttrs : /* empty */ { $$ = Attribute::None; } + | OptRetAttrs RetAttr { + $$ = $1 | $2; + } + ; + + FuncAttr : NORETURN { $$ = Attribute::NoReturn; } | NOUNWIND { $$ = Attribute::NoUnwind; } | INREG { $$ = Attribute::InReg; } @@ -1290,6 +1303,7 @@ } ; + OptGC : /* empty */ { $$ = 0; } | GC STRINGCONSTANT { $$ = $2; @@ -2304,43 +2318,43 @@ CHECK_FOR_ERROR }; -FunctionHeaderH : OptCallingConv ResultTypes GlobalName '(' ArgList ')' +FunctionHeaderH : OptCallingConv OptRetAttrs ResultTypes GlobalName '(' ArgList ')' OptFuncAttrs OptSection OptAlign OptGC { - std::string FunctionName(*$3); - delete $3; // Free strdup'd memory! + std::string FunctionName(*$4); + delete $4; // Free strdup'd memory! // Check the function result for abstractness if this is a define. We should // have no abstract types at this point - if (!CurFun.isDeclare && CurModule.TypeIsUnresolved($2)) - GEN_ERROR("Reference to abstract result: "+ $2->get()->getDescription()); + if (!CurFun.isDeclare && CurModule.TypeIsUnresolved($3)) + GEN_ERROR("Reference to abstract result: "+ $3->get()->getDescription()); - if (!FunctionType::isValidReturnType(*$2)) + if (!FunctionType::isValidReturnType(*$3)) GEN_ERROR("Invalid result type for LLVM function"); std::vector ParamTypeList; SmallVector Attrs; //FIXME : In 3.0, stop accepting zext, sext and inreg as optional function //attributes. - Attributes RetAttrs = 0; - if ($7 != Attribute::None) { - if ($7 & Attribute::ZExt) { + Attributes RetAttrs = $2; + if ($8 != Attribute::None) { + if ($8 & Attribute::ZExt) { RetAttrs = RetAttrs | Attribute::ZExt; - $7 = $7 ^ Attribute::ZExt; + $8 = $8 ^ Attribute::ZExt; } - if ($7 & Attribute::SExt) { + if ($8 & Attribute::SExt) { RetAttrs = RetAttrs | Attribute::SExt; - $7 = $7 ^ Attribute::SExt; + $8 = $8 ^ Attribute::SExt; } - if ($7 & Attribute::InReg) { + if ($8 & Attribute::InReg) { RetAttrs = RetAttrs | Attribute::InReg; - $7 = $7 ^ Attribute::InReg; + $8 = $8 ^ Attribute::InReg; } - if (RetAttrs != Attribute::None) - Attrs.push_back(AttributeWithIndex::get(0, RetAttrs)); } - if ($5) { // If there are arguments... + if (RetAttrs != Attribute::None) + Attrs.push_back(AttributeWithIndex::get(0, RetAttrs)); + if ($6) { // If there are arguments... unsigned index = 1; - for (ArgListType::iterator I = $5->begin(); I != $5->end(); ++I, ++index) { + for (ArgListType::iterator I = $6->begin(); I != $6->end(); ++I, ++index) { const Type* Ty = I->Ty->get(); if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty)) GEN_ERROR("Reference to abstract argument: " + Ty->getDescription()); @@ -2349,8 +2363,8 @@ Attrs.push_back(AttributeWithIndex::get(index, I->Attrs)); } } - if ($7 != Attribute::None) - Attrs.push_back(AttributeWithIndex::get(~0, $7)); + if ($8 != Attribute::None) + Attrs.push_back(AttributeWithIndex::get(~0, $8)); bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy; if (isVarArg) ParamTypeList.pop_back(); @@ -2359,9 +2373,9 @@ if (!Attrs.empty()) PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); - FunctionType *FT = FunctionType::get(*$2, ParamTypeList, isVarArg); + FunctionType *FT = FunctionType::get(*$3, ParamTypeList, isVarArg); const PointerType *PFT = PointerType::getUnqual(FT); - delete $2; + delete $3; ValID ID; if (!FunctionName.empty()) { @@ -2417,29 +2431,29 @@ } Fn->setCallingConv($1); Fn->setAttributes(PAL); - Fn->setAlignment($9); - if ($8) { - Fn->setSection(*$8); - delete $8; - } - if ($10) { - Fn->setGC($10->c_str()); - delete $10; + Fn->setAlignment($10); + if ($9) { + Fn->setSection(*$9); + delete $9; + } + if ($11) { + Fn->setGC($11->c_str()); + delete $11; } // Add all of the arguments we parsed to the function... - if ($5) { // Is null if empty... + if ($6) { // Is null if empty... if (isVarArg) { // Nuke the last entry - assert($5->back().Ty->get() == Type::VoidTy && $5->back().Name == 0 && + assert($6->back().Ty->get() == Type::VoidTy && $6->back().Name == 0 && "Not a varargs marker!"); - delete $5->back().Ty; - $5->pop_back(); // Delete the last entry + delete $6->back().Ty; + $6->pop_back(); // Delete the last entry } Function::arg_iterator ArgIt = Fn->arg_begin(); Function::arg_iterator ArgEnd = Fn->arg_end(); unsigned Idx = 1; - for (ArgListType::iterator I = $5->begin(); - I != $5->end() && ArgIt != ArgEnd; ++I, ++ArgIt) { + for (ArgListType::iterator I = $6->begin(); + I != $6->end() && ArgIt != ArgEnd; ++I, ++ArgIt) { delete I->Ty; // Delete the typeholder... setValueName(ArgIt, I->Name); // Insert arg into symtab... CHECK_FOR_ERROR @@ -2447,7 +2461,7 @@ Idx++; } - delete $5; // We're now done with the argument list + delete $6; // We're now done with the argument list } CHECK_FOR_ERROR }; @@ -2814,17 +2828,17 @@ $$ = S; CHECK_FOR_ERROR } - | INVOKE OptCallingConv ResultTypes ValueRef '(' ParamList ')' OptFuncAttrs - TO LABEL ValueRef UNWIND LABEL ValueRef { + | INVOKE OptCallingConv OptRetAttrs ResultTypes ValueRef '(' ParamList ')' + OptFuncAttrs TO LABEL ValueRef UNWIND LABEL ValueRef { // Handle the short syntax const PointerType *PFTy = 0; const FunctionType *Ty = 0; - if (!(PFTy = dyn_cast($3->get())) || + if (!(PFTy = dyn_cast($4->get())) || !(Ty = dyn_cast(PFTy->getElementType()))) { // Pull out the types of all of the arguments... std::vector ParamTypes; - ParamList::iterator I = $6->begin(), E = $6->end(); + ParamList::iterator I = $7->begin(), E = $7->end(); for (; I != E; ++I) { const Type *Ty = I->Val->getType(); if (Ty == Type::VoidTy) @@ -2832,46 +2846,46 @@ ParamTypes.push_back(Ty); } - if (!FunctionType::isValidReturnType(*$3)) + if (!FunctionType::isValidReturnType(*$4)) GEN_ERROR("Invalid result type for LLVM function"); - Ty = FunctionType::get($3->get(), ParamTypes, false); + Ty = FunctionType::get($4->get(), ParamTypes, false); PFTy = PointerType::getUnqual(Ty); } - delete $3; + delete $4; - Value *V = getVal(PFTy, $4); // Get the function we're calling... + Value *V = getVal(PFTy, $5); // Get the function we're calling... CHECK_FOR_ERROR - BasicBlock *Normal = getBBVal($11); + BasicBlock *Normal = getBBVal($12); CHECK_FOR_ERROR - BasicBlock *Except = getBBVal($14); + BasicBlock *Except = getBBVal($15); CHECK_FOR_ERROR SmallVector Attrs; //FIXME : In 3.0, stop accepting zext, sext and inreg as optional function //attributes. - Attributes RetAttrs = 0; - if ($8 != Attribute::None) { - if ($8 & Attribute::ZExt) { + Attributes RetAttrs = $3; + if ($9 != Attribute::None) { + if ($9 & Attribute::ZExt) { RetAttrs = RetAttrs | Attribute::ZExt; - $8 = $8 ^ Attribute::ZExt; + $9 = $9 ^ Attribute::ZExt; } - if ($8 & Attribute::SExt) { + if ($9 & Attribute::SExt) { RetAttrs = RetAttrs | Attribute::SExt; - $8 = $8 ^ Attribute::SExt; + $9 = $9 ^ Attribute::SExt; } - if ($8 & Attribute::InReg) { + if ($9 & Attribute::InReg) { RetAttrs = RetAttrs | Attribute::InReg; - $8 = $8 ^ Attribute::InReg; + $9 = $9 ^ Attribute::InReg; } - if (RetAttrs != Attribute::None) - Attrs.push_back(AttributeWithIndex::get(0, RetAttrs)); } + if (RetAttrs != Attribute::None) + Attrs.push_back(AttributeWithIndex::get(0, RetAttrs)); // Check the arguments ValueList Args; - if ($6->empty()) { // Has no arguments? + if ($7->empty()) { // Has no arguments? // Make sure no arguments is a good thing! if (Ty->getNumParams() != 0) GEN_ERROR("No arguments passed to a function that " @@ -2881,7 +2895,7 @@ // correctly! FunctionType::param_iterator I = Ty->param_begin(); FunctionType::param_iterator E = Ty->param_end(); - ParamList::iterator ArgI = $6->begin(), ArgE = $6->end(); + ParamList::iterator ArgI = $7->begin(), ArgE = $7->end(); unsigned index = 1; for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) { @@ -2903,8 +2917,8 @@ } else if (I != E || ArgI != ArgE) GEN_ERROR("Invalid number of parameters detected"); } - if ($8 != Attribute::None) - Attrs.push_back(AttributeWithIndex::get(~0, $8)); + if ($9 != Attribute::None) + Attrs.push_back(AttributeWithIndex::get(~0, $9)); AttrListPtr PAL; if (!Attrs.empty()) PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); @@ -2915,7 +2929,7 @@ II->setCallingConv($2); II->setAttributes(PAL); $$ = II; - delete $6; + delete $7; CHECK_FOR_ERROR } | UNWIND { @@ -3226,17 +3240,17 @@ delete $2; // Free the list... CHECK_FOR_ERROR } - | OptTailCall OptCallingConv ResultTypes ValueRef '(' ParamList ')' + | OptTailCall OptCallingConv OptRetAttrs ResultTypes ValueRef '(' ParamList ')' OptFuncAttrs { // Handle the short syntax const PointerType *PFTy = 0; const FunctionType *Ty = 0; - if (!(PFTy = dyn_cast($3->get())) || + if (!(PFTy = dyn_cast($4->get())) || !(Ty = dyn_cast(PFTy->getElementType()))) { // Pull out the types of all of the arguments... std::vector ParamTypes; - ParamList::iterator I = $6->begin(), E = $6->end(); + ParamList::iterator I = $7->begin(), E = $7->end(); for (; I != E; ++I) { const Type *Ty = I->Val->getType(); if (Ty == Type::VoidTy) @@ -3244,14 +3258,14 @@ ParamTypes.push_back(Ty); } - if (!FunctionType::isValidReturnType(*$3)) + if (!FunctionType::isValidReturnType(*$4)) GEN_ERROR("Invalid result type for LLVM function"); - Ty = FunctionType::get($3->get(), ParamTypes, false); + Ty = FunctionType::get($4->get(), ParamTypes, false); PFTy = PointerType::getUnqual(Ty); } - Value *V = getVal(PFTy, $4); // Get the function we're calling... + Value *V = getVal(PFTy, $5); // Get the function we're calling... CHECK_FOR_ERROR // Check for call to invalid intrinsic to avoid crashing later. @@ -3267,27 +3281,27 @@ SmallVector Attrs; //FIXME : In 3.0, stop accepting zext, sext and inreg as optional function //attributes. - Attributes RetAttrs = 0; - if ($8 != Attribute::None) { - if ($8 & Attribute::ZExt) { + Attributes RetAttrs = $3; + if ($9 != Attribute::None) { + if ($9 & Attribute::ZExt) { RetAttrs = RetAttrs | Attribute::ZExt; - $8 = $8 ^ Attribute::ZExt; + $9 = $9 ^ Attribute::ZExt; } - if ($8 & Attribute::SExt) { + if ($9 & Attribute::SExt) { RetAttrs = RetAttrs | Attribute::SExt; - $8 = $8 ^ Attribute::SExt; + $9 = $9 ^ Attribute::SExt; } - if ($8 & Attribute::InReg) { + if ($9 & Attribute::InReg) { RetAttrs = RetAttrs | Attribute::InReg; - $8 = $8 ^ Attribute::InReg; + $9 = $9 ^ Attribute::InReg; } - if (RetAttrs != Attribute::None) - Attrs.push_back(AttributeWithIndex::get(0, RetAttrs)); } + if (RetAttrs != Attribute::None) + Attrs.push_back(AttributeWithIndex::get(0, RetAttrs)); // Check the arguments ValueList Args; - if ($6->empty()) { // Has no arguments? + if ($7->empty()) { // Has no arguments? // Make sure no arguments is a good thing! if (Ty->getNumParams() != 0) GEN_ERROR("No arguments passed to a function that " @@ -3297,7 +3311,7 @@ // correctly. Also, gather any parameter attributes. FunctionType::param_iterator I = Ty->param_begin(); FunctionType::param_iterator E = Ty->param_end(); - ParamList::iterator ArgI = $6->begin(), ArgE = $6->end(); + ParamList::iterator ArgI = $7->begin(), ArgE = $7->end(); unsigned index = 1; for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) { @@ -3318,8 +3332,8 @@ } else if (I != E || ArgI != ArgE) GEN_ERROR("Invalid number of parameters detected"); } - if ($8 != Attribute::None) - Attrs.push_back(AttributeWithIndex::get(~0, $8)); + if ($9 != Attribute::None) + Attrs.push_back(AttributeWithIndex::get(~0, $9)); // Finish off the Attributes and check them AttrListPtr PAL; @@ -3332,8 +3346,8 @@ CI->setCallingConv($2); CI->setAttributes(PAL); $$ = CI; - delete $6; - delete $3; + delete $7; + delete $4; CHECK_FOR_ERROR } | MemoryInst { Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=56801&r1=56800&r2=56801&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original) +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Mon Sep 29 15:49:50 2008 @@ -1356,6 +1356,9 @@ const FunctionType *FT = F->getFunctionType(); const AttrListPtr &Attrs = F->getAttributes(); + Attributes RetAttrs = Attrs.getRetAttributes(); + if (RetAttrs != Attribute::None) + Out << Attribute::getAsString(Attrs.getRetAttributes()) << ' '; printType(F->getReturnType()); Out << ' '; if (F->hasName()) @@ -1398,9 +1401,6 @@ Out << "..."; // Output varargs portion of signature! } Out << ')'; - Attributes RetAttrs = Attrs.getRetAttributes(); - if (RetAttrs != Attribute::None) - Out << ' ' << Attribute::getAsString(Attrs.getRetAttributes()); Attributes FnAttrs = Attrs.getFnAttributes(); if (FnAttrs != Attribute::None) Out << ' ' << Attribute::getAsString(Attrs.getFnAttributes()); @@ -1617,6 +1617,9 @@ const Type *RetTy = FTy->getReturnType(); const AttrListPtr &PAL = CI->getAttributes(); + if (PAL.getRetAttributes() != Attribute::None) + Out << ' ' << Attribute::getAsString(PAL.getRetAttributes()); + // If possible, print out the short form of the call instruction. We can // only do this if the first argument is a pointer to a nonvararg function, // and if the return type is not a pointer to a function. @@ -1638,8 +1641,6 @@ writeParamOperand(I.getOperand(op), PAL.getParamAttributes(op)); } Out << ')'; - if (PAL.getRetAttributes() != Attribute::None) - Out << ' ' << Attribute::getAsString(PAL.getRetAttributes()); if (PAL.getFnAttributes() != Attribute::None) Out << ' ' << Attribute::getAsString(PAL.getFnAttributes()); } else if (const InvokeInst *II = dyn_cast(&I)) { @@ -1658,6 +1659,9 @@ default: Out << " cc" << II->getCallingConv(); break; } + if (PAL.getRetAttributes() != Attribute::None) + Out << ' ' << Attribute::getAsString(PAL.getRetAttributes()); + // If possible, print out the short form of the invoke instruction. We can // only do this if the first argument is a pointer to a nonvararg function, // and if the return type is not a pointer to a function. @@ -1680,8 +1684,6 @@ } Out << ')'; - if (PAL.getRetAttributes() != Attribute::None) - Out << ' ' << Attribute::getAsString(PAL.getRetAttributes()); if (PAL.getFnAttributes() != Attribute::None) Out << ' ' << Attribute::getAsString(PAL.getFnAttributes()); Modified: llvm/trunk/test/Assembler/2008-09-02-FunctionNotes.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/2008-09-02-FunctionNotes.ll?rev=56801&r1=56800&r2=56801&view=diff ============================================================================== --- llvm/trunk/test/Assembler/2008-09-02-FunctionNotes.ll (original) +++ llvm/trunk/test/Assembler/2008-09-02-FunctionNotes.ll Mon Sep 29 15:49:50 2008 @@ -1,4 +1,4 @@ -; Test function notes +; Test function attributes ; RUN: llvm-as < %s | llvm-dis | grep inline | count 2 define void @fn1() alwaysinline { Modified: llvm/trunk/test/Assembler/2008-09-02-FunctionNotes2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/2008-09-02-FunctionNotes2.ll?rev=56801&r1=56800&r2=56801&view=diff ============================================================================== --- llvm/trunk/test/Assembler/2008-09-02-FunctionNotes2.ll (original) +++ llvm/trunk/test/Assembler/2008-09-02-FunctionNotes2.ll Mon Sep 29 15:49:50 2008 @@ -1,7 +1,7 @@ ; Test function notes ; RUN: not llvm-as %s |& grep "only one inline note" ; XFAIL: * -define void @fn1() alwaysinline, noinline { +define void @fn1() alwaysinline noinline { ret void } Added: llvm/trunk/test/Assembler/2008-09-29-RetAttr.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/2008-09-29-RetAttr.ll?rev=56801&view=auto ============================================================================== --- llvm/trunk/test/Assembler/2008-09-29-RetAttr.ll (added) +++ llvm/trunk/test/Assembler/2008-09-29-RetAttr.ll Mon Sep 29 15:49:50 2008 @@ -0,0 +1,13 @@ +; Test return attributes +; RUN: llvm-as < %s | llvm-dis | grep "define inreg i32" +; RUN: llvm-as < %s | llvm-dis | grep "call inreg i32" + +define inreg i32 @fn1() { + ret i32 0 +} + +define void @fn2() { + %t = call inreg i32 @fn1() + ret void +} + Modified: llvm/trunk/test/Transforms/DeadArgElim/keepalive.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/DeadArgElim/keepalive.ll?rev=56801&r1=56800&r2=56801&view=diff ============================================================================== --- llvm/trunk/test/Transforms/DeadArgElim/keepalive.ll (original) +++ llvm/trunk/test/Transforms/DeadArgElim/keepalive.ll Mon Sep 29 15:49:50 2008 @@ -1,5 +1,5 @@ ; RUN: llvm-as < %s | opt -deadargelim | llvm-dis > %t -; RUN: cat %t | grep {define internal i32 @test1() zeroext nounwind} +; RUN: cat %t | grep {define internal zeroext i32 @test1() nounwind} ; RUN: cat %t | grep {define internal \<\{ i32, i32 \}\> @test} ; Check if the pass doesn't modify anything that doesn't need changing. We feed @@ -7,7 +7,7 @@ ; the function and then changing too much. ; This checks if the return value attributes are not removed -define internal i32 @test1(i32 %DEADARG1) nounwind zeroext{ +define internal zeroext i32 @test1(i32 %DEADARG1) nounwind { ret i32 1 } From dpatel at apple.com Mon Sep 29 15:56:13 2008 From: dpatel at apple.com (Devang Patel) Date: Mon, 29 Sep 2008 13:56:13 -0700 Subject: [llvm-commits] r55638 - /llvm/trunk/include/llvm/Function.h In-Reply-To: <200809291823.29191.baldrick@free.fr> References: <200809231027.53858.baldrick@free.fr> <200809270436.32049.baldrick@free.fr> <5CE835F4-F18C-477B-AF12-A7659EED0242@apple.com> <200809291823.29191.baldrick@free.fr> Message-ID: <9AF39A0A-0CF3-4B3A-B253-89E98909B57C@apple.com> On Sep 29, 2008, at 9:23 AM, Duncan Sands wrote: > so any use of floating point (eg: fp multiplication) should be > understood > as using SSE, and would stop the inliner from inlining? Ignore inliner for a while, and decide what code generator should do for following ? define float @foo(float %a, float %b) x86_no_sse { %t = mul float %a, %b ret float %t } - Devang From gohman at apple.com Mon Sep 29 16:13:16 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 29 Sep 2008 21:13:16 -0000 Subject: [llvm-commits] [llvm] r56802 - /llvm/trunk/lib/Target/X86/X86FastISel.cpp Message-ID: <200809292113.m8TLDG9e020667@zion.cs.uiuc.edu> Author: djg Date: Mon Sep 29 16:13:15 2008 New Revision: 56802 URL: http://llvm.org/viewvc/llvm-project?rev=56802&view=rev Log: Fix an over-pessimization about GlobalVariable addresses in X86FastISel. 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=56802&r1=56801&r2=56802&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86FastISel.cpp (original) +++ llvm/trunk/lib/Target/X86/X86FastISel.cpp Mon Sep 29 16:13:15 2008 @@ -462,7 +462,7 @@ } // If all else fails, try to materialize the value in a register. - if (!AM.GV && getTargetMachine()->symbolicAddressesAreRIPRel()) { + if (!AM.GV || !getTargetMachine()->symbolicAddressesAreRIPRel()) { if (AM.Base.Reg == 0) { AM.Base.Reg = getRegForValue(V); return AM.Base.Reg != 0; From criswell at uiuc.edu Mon Sep 29 16:16:49 2008 From: criswell at uiuc.edu (John Criswell) Date: Mon, 29 Sep 2008 21:16:49 -0000 Subject: [llvm-commits] [poolalloc] r56803 - in /poolalloc/trunk: include/poolalloc/PoolAllocate.h lib/PoolAllocate/PASimple.cpp Message-ID: <200809292116.m8TLGnn7021100@zion.cs.uiuc.edu> Author: criswell Date: Mon Sep 29 16:16:48 2008 New Revision: 56803 URL: http://llvm.org/viewvc/llvm-project?rev=56803&view=rev Log: Back out changes to use Top-Down DSA when using SAFECode. SAFECode and automatic pool allocation require both Top-Down DSA and EquivClassGraphs. Modified: poolalloc/trunk/include/poolalloc/PoolAllocate.h poolalloc/trunk/lib/PoolAllocate/PASimple.cpp Modified: poolalloc/trunk/include/poolalloc/PoolAllocate.h URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/poolalloc/PoolAllocate.h?rev=56803&r1=56802&r2=56803&view=diff ============================================================================== --- poolalloc/trunk/include/poolalloc/PoolAllocate.h (original) +++ poolalloc/trunk/include/poolalloc/PoolAllocate.h Mon Sep 29 16:16:48 2008 @@ -120,24 +120,15 @@ virtual const Type * getPoolType() {return 0;} virtual bool hasDSGraph (const Function & F) const { - if (SAFECodeEnabled) - return TDGraphs->hasGraph (F); - else - return ECGraphs->hasGraph (F); + return ECGraphs->hasGraph (F); } virtual DSGraph & getDSGraph (const Function & F) const { - if (SAFECodeEnabled) - return TDGraphs->getDSGraph (F); - else - return ECGraphs->getDSGraph (F); + return ECGraphs->getDSGraph (F); } virtual DSGraph & getGlobalsGraph () const { - if (SAFECodeEnabled) - return TDGraphs->getGlobalsGraph (); - else - return ECGraphs->getGlobalsGraph (); + return ECGraphs->getGlobalsGraph (); } virtual Value * getPool (const DSNode * N, Function & F) {return 0;} @@ -249,17 +240,11 @@ } virtual DSGraph & getDSGraph (const Function & F) const { - if (SAFECodeEnabled) - return TDGraphs->getDSGraph (F); - else - return ECGraphs->getDSGraph (F); + return ECGraphs->getDSGraph (F); } virtual DSGraph & getGlobalsGraph () const { - if (SAFECodeEnabled) - return TDGraphs->getGlobalsGraph (); - else - return ECGraphs->getGlobalsGraph (); + return ECGraphs->getGlobalsGraph (); } virtual Value * getPool (const DSNode * N, Function & F) { Modified: poolalloc/trunk/lib/PoolAllocate/PASimple.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PASimple.cpp?rev=56803&r1=56802&r2=56803&view=diff ============================================================================== --- poolalloc/trunk/lib/PoolAllocate/PASimple.cpp (original) +++ poolalloc/trunk/lib/PoolAllocate/PASimple.cpp Mon Sep 29 16:16:48 2008 @@ -74,9 +74,9 @@ void PoolAllocateSimple::getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired(); AU.addRequiredTransitive(); - AU.addRequiredTransitive(); + AU.addPreserved(); - AU.addPreserved(); + AU.setPreservesAll(); } @@ -103,10 +103,6 @@ // Get the Target Data information and the ECGraphs ECGraphs = &getAnalysis(); // folded inlined CBU graphs assert (ECGraphs && "No ECGraphs pass available!\n"); - if (SAFECodeEnabled) { - TDGraphs = &getAnalysis(); // folded inlined CBU graphs - assert (TDGraphs && "No TDGraphs pass available!\n"); - } TargetData & TD = getAnalysis(); // Add the pool* prototypes to the module @@ -124,17 +120,14 @@ // // Merge all of the DSNodes in the DSGraphs. // - if (SAFECodeEnabled) - GlobalECs = &(TDGraphs->getGlobalECs()); - else - GlobalECs = &(ECGraphs->getGlobalECs()); - CombinedDSGraph = new DSGraph (*GlobalECs, TD, &(getGlobalsGraph())); + GlobalECs = &(TDGraphs->getGlobalECs()); + CombinedDSGraph = new DSGraph (*GlobalECs, TD, &(ECGraphs->getGlobalsGraph())); //CombinedDSGraph.cloneInto (getGlobalsGraph()); for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) { - if (hasDSGraph (*I)) - CombinedDSGraph->cloneInto (getDSGraph(*I)); + if (ECGraphs->hasGraph (*I)) + CombinedDSGraph->cloneInto (ECGraphs->getDSGraph(*I)); } - CombinedDSGraph->cloneInto (getGlobalsGraph()); + CombinedDSGraph->cloneInto (ECGraphs->getGlobalsGraph()); MergeNodesInDSGraph (*CombinedDSGraph); // @@ -168,7 +161,7 @@ // // Get the DSGraph for this function. // - DSGraph &ECG = getDSGraph(F); + DSGraph &ECG = ECGraphs->getDSGraph(F); for (Function::iterator i = F.begin(), e = F.end(); i != e; ++i) for (BasicBlock::iterator ii = i->begin(), ee = i->end(); ii != ee; ++ii) { From gohman at apple.com Mon Sep 29 16:55:50 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 29 Sep 2008 21:55:50 -0000 Subject: [llvm-commits] [llvm] r56807 - in /llvm/trunk: include/llvm/CodeGen/FastISel.h lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200809292155.m8TLtoEb025026@zion.cs.uiuc.edu> Author: djg Date: Mon Sep 29 16:55:50 2008 New Revision: 56807 URL: http://llvm.org/viewvc/llvm-project?rev=56807&view=rev Log: Fix FastISel to not initialize the PIC-base register multiple times in functions with PIC references from more than one basic block. Modified: llvm/trunk/include/llvm/CodeGen/FastISel.h llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Modified: llvm/trunk/include/llvm/CodeGen/FastISel.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/FastISel.h?rev=56807&r1=56806&r2=56807&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/FastISel.h (original) +++ llvm/trunk/include/llvm/CodeGen/FastISel.h Mon Sep 29 16:55:50 2008 @@ -60,6 +60,7 @@ /// void setCurrentBlock(MachineBasicBlock *mbb) { MBB = mbb; + LocalValueMap.clear(); } /// SelectInstruction - Do "fast" instruction selection for the given Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=56807&r1=56806&r2=56807&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Mon Sep 29 16:55:50 2008 @@ -709,6 +709,15 @@ void SelectionDAGISel::SelectAllBasicBlocks(Function &Fn, MachineFunction &MF, MachineModuleInfo *MMI) { + // Initialize the Fast-ISel state, if needed. + FastISel *FastIS = 0; + if (EnableFastISel) + FastIS = TLI.createFastISel(*FuncInfo->MF, MMI, + FuncInfo->ValueMap, + FuncInfo->MBBMap, + FuncInfo->StaticAllocaMap); + + // Iterate over all basic blocks in the function. for (Function::iterator I = Fn.begin(), E = Fn.end(); I != E; ++I) { BasicBlock *LLVMBB = &*I; BB = FuncInfo->MBBMap[LLVMBB]; @@ -724,7 +733,7 @@ // If any of the arguments has the byval attribute, forgo // fast-isel in the entry block. - if (EnableFastISel) { + if (FastIS) { unsigned j = 1; for (Function::arg_iterator I = Fn.arg_begin(), E = Fn.arg_end(); I != E; ++I, ++j) @@ -739,74 +748,68 @@ // Before doing SelectionDAG ISel, see if FastISel has been requested. // FastISel doesn't support EH landing pads, which require special handling. - if (EnableFastISel && !SuppressFastISel && !BB->isLandingPad()) { - if (FastISel *F = TLI.createFastISel(*FuncInfo->MF, MMI, - FuncInfo->ValueMap, - FuncInfo->MBBMap, - FuncInfo->StaticAllocaMap)) { - // Emit code for any incoming arguments. This must happen before - // beginning FastISel on the entry block. - if (LLVMBB == &Fn.getEntryBlock()) { - CurDAG->setRoot(SDL->getControlRoot()); - CodeGenAndEmitDAG(); - SDL->clear(); - } - F->setCurrentBlock(BB); - // Do FastISel on as many instructions as possible. - for (; BI != End; ++BI) { - // Just before the terminator instruction, insert instructions to - // feed PHI nodes in successor blocks. - if (isa(BI)) - if (!HandlePHINodesInSuccessorBlocksFast(LLVMBB, F)) { - if (EnableFastISelVerbose || EnableFastISelAbort) { - cerr << "FastISel miss: "; - BI->dump(); - } - if (EnableFastISelAbort) - assert(0 && "FastISel didn't handle a PHI in a successor"); - break; - } - - // First try normal tablegen-generated "fast" selection. - if (F->SelectInstruction(BI)) - continue; - - // Next, try calling the target to attempt to handle the instruction. - if (F->TargetSelectInstruction(BI)) - continue; - - // Then handle certain instructions as single-LLVM-Instruction blocks. - if (isa(BI)) { + if (FastIS && !SuppressFastISel && !BB->isLandingPad()) { + // Emit code for any incoming arguments. This must happen before + // beginning FastISel on the entry block. + if (LLVMBB == &Fn.getEntryBlock()) { + CurDAG->setRoot(SDL->getControlRoot()); + CodeGenAndEmitDAG(); + SDL->clear(); + } + FastIS->setCurrentBlock(BB); + // Do FastISel on as many instructions as possible. + for (; BI != End; ++BI) { + // Just before the terminator instruction, insert instructions to + // feed PHI nodes in successor blocks. + if (isa(BI)) + if (!HandlePHINodesInSuccessorBlocksFast(LLVMBB, FastIS)) { if (EnableFastISelVerbose || EnableFastISelAbort) { - cerr << "FastISel missed call: "; + cerr << "FastISel miss: "; BI->dump(); } + if (EnableFastISelAbort) + assert(0 && "FastISel didn't handle a PHI in a successor"); + break; + } - if (BI->getType() != Type::VoidTy) { - unsigned &R = FuncInfo->ValueMap[BI]; - if (!R) - R = FuncInfo->CreateRegForValue(BI); - } + // First try normal tablegen-generated "fast" selection. + if (FastIS->SelectInstruction(BI)) + continue; + + // Next, try calling the target to attempt to handle the instruction. + if (FastIS->TargetSelectInstruction(BI)) + continue; + + // Then handle certain instructions as single-LLVM-Instruction blocks. + if (isa(BI)) { + if (EnableFastISelVerbose || EnableFastISelAbort) { + cerr << "FastISel missed call: "; + BI->dump(); + } - SelectBasicBlock(LLVMBB, BI, next(BI)); - continue; + if (BI->getType() != Type::VoidTy) { + unsigned &R = FuncInfo->ValueMap[BI]; + if (!R) + R = FuncInfo->CreateRegForValue(BI); } - // Otherwise, give up on FastISel for the rest of the block. - // For now, be a little lenient about non-branch terminators. - if (!isa(BI) || isa(BI)) { - if (EnableFastISelVerbose || EnableFastISelAbort) { - cerr << "FastISel miss: "; - BI->dump(); - } - if (EnableFastISelAbort) - // The "fast" selector couldn't handle something and bailed. - // For the purpose of debugging, just abort. - assert(0 && "FastISel didn't select the entire block"); + SelectBasicBlock(LLVMBB, BI, next(BI)); + continue; + } + + // Otherwise, give up on FastISel for the rest of the block. + // For now, be a little lenient about non-branch terminators. + if (!isa(BI) || isa(BI)) { + if (EnableFastISelVerbose || EnableFastISelAbort) { + cerr << "FastISel miss: "; + BI->dump(); } - break; + if (EnableFastISelAbort) + // The "fast" selector couldn't handle something and bailed. + // For the purpose of debugging, just abort. + assert(0 && "FastISel didn't select the entire block"); } - delete F; + break; } } @@ -818,6 +821,8 @@ FinishBasicBlock(); } + + delete FastIS; } void From dalej at apple.com Mon Sep 29 17:25:27 2008 From: dalej at apple.com (Dale Johannesen) Date: Mon, 29 Sep 2008 22:25:27 -0000 Subject: [llvm-commits] [llvm] r56808 - in /llvm/trunk/lib: CodeGen/SelectionDAG/LegalizeDAG.cpp Target/X86/X86ISelLowering.cpp Target/X86/X86ISelLowering.h Message-ID: <200809292225.m8TMPRG5027740@zion.cs.uiuc.edu> Author: johannes Date: Mon Sep 29 17:25:26 2008 New Revision: 56808 URL: http://llvm.org/viewvc/llvm-project?rev=56808&view=rev Log: Remove misuse of ReplaceNodeResults for atomics with valid types. No functional change. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.h Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=56808&r1=56807&r2=56808&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Mon Sep 29 17:25:26 2008 @@ -1261,9 +1261,6 @@ case TargetLowering::Custom: Result = TLI.LowerOperation(Result, DAG); break; - case TargetLowering::Expand: - Result = SDValue(TLI.ReplaceNodeResults(Op.getNode(), DAG),0); - break; case TargetLowering::Legal: break; } Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=56808&r1=56807&r2=56808&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Sep 29 17:25:26 2008 @@ -297,10 +297,10 @@ setOperationAction(ISD::ATOMIC_CMP_SWAP_32, MVT::i32, Custom); setOperationAction(ISD::ATOMIC_CMP_SWAP_64, MVT::i64, Custom); - setOperationAction(ISD::ATOMIC_LOAD_SUB_8, MVT::i8, Expand); - setOperationAction(ISD::ATOMIC_LOAD_SUB_16, MVT::i16, Expand); - setOperationAction(ISD::ATOMIC_LOAD_SUB_32, MVT::i32, Expand); - setOperationAction(ISD::ATOMIC_LOAD_SUB_64, MVT::i64, Expand); + setOperationAction(ISD::ATOMIC_LOAD_SUB_8 , MVT::i8, Custom); + setOperationAction(ISD::ATOMIC_LOAD_SUB_16, MVT::i16, Custom); + setOperationAction(ISD::ATOMIC_LOAD_SUB_32, MVT::i32, Custom); + setOperationAction(ISD::ATOMIC_LOAD_SUB_64, MVT::i64, Custom); // Use the default ISD::DBG_STOPPOINT, ISD::DECLARE expansion. setOperationAction(ISD::DBG_STOPPOINT, MVT::Other, Expand); @@ -6002,18 +6002,22 @@ return DAG.getMergeValues(Vals, 2).getNode(); } -SDNode* X86TargetLowering::ExpandATOMIC_LOAD_SUB(SDNode* Op, - SelectionDAG &DAG) { - MVT T = Op->getValueType(0); +SDValue X86TargetLowering::LowerLOAD_SUB(SDValue Op, SelectionDAG &DAG) { + SDNode *Node = Op.getNode(); + MVT T = Node->getValueType(0); SDValue negOp = DAG.getNode(ISD::SUB, T, - DAG.getConstant(0, T), Op->getOperand(2)); - return DAG.getAtomic((T==MVT::i8 ? ISD::ATOMIC_LOAD_ADD_8: - T==MVT::i16 ? ISD::ATOMIC_LOAD_ADD_16: - T==MVT::i32 ? ISD::ATOMIC_LOAD_ADD_32: - T==MVT::i64 ? ISD::ATOMIC_LOAD_ADD_64: 0), - Op->getOperand(0), Op->getOperand(1), negOp, - cast(Op)->getSrcValue(), - cast(Op)->getAlignment()).getNode(); + DAG.getConstant(0, T), Node->getOperand(2)); + return DAG.getAtomic((Op.getOpcode()==ISD::ATOMIC_LOAD_SUB_8 ? + ISD::ATOMIC_LOAD_ADD_8 : + Op.getOpcode()==ISD::ATOMIC_LOAD_SUB_16 ? + ISD::ATOMIC_LOAD_ADD_16 : + Op.getOpcode()==ISD::ATOMIC_LOAD_SUB_32 ? + ISD::ATOMIC_LOAD_ADD_32 : + ISD::ATOMIC_LOAD_ADD_64), + Node->getOperand(0), + Node->getOperand(1), negOp, + cast(Node)->getSrcValue(), + cast(Node)->getAlignment()); } /// LowerOperation - Provide custom lowering hooks for some operations. @@ -6025,6 +6029,10 @@ case ISD::ATOMIC_CMP_SWAP_16: return LowerCMP_SWAP(Op,DAG); case ISD::ATOMIC_CMP_SWAP_32: return LowerCMP_SWAP(Op,DAG); case ISD::ATOMIC_CMP_SWAP_64: return LowerCMP_SWAP(Op,DAG); + case ISD::ATOMIC_LOAD_SUB_8: return LowerLOAD_SUB(Op,DAG); + case ISD::ATOMIC_LOAD_SUB_16: return LowerLOAD_SUB(Op,DAG); + case ISD::ATOMIC_LOAD_SUB_32: return LowerLOAD_SUB(Op,DAG); + case ISD::ATOMIC_LOAD_SUB_64: return LowerLOAD_SUB(Op,DAG); case ISD::BUILD_VECTOR: return LowerBUILD_VECTOR(Op, DAG); case ISD::VECTOR_SHUFFLE: return LowerVECTOR_SHUFFLE(Op, DAG); case ISD::EXTRACT_VECTOR_ELT: return LowerEXTRACT_VECTOR_ELT(Op, DAG); @@ -6079,10 +6087,6 @@ case ISD::FP_TO_SINT: return ExpandFP_TO_SINT(N, DAG); case ISD::READCYCLECOUNTER: return ExpandREADCYCLECOUNTER(N, DAG); case ISD::ATOMIC_CMP_SWAP_64: return ExpandATOMIC_CMP_SWAP(N, DAG); - case ISD::ATOMIC_LOAD_SUB_8: return ExpandATOMIC_LOAD_SUB(N,DAG); - case ISD::ATOMIC_LOAD_SUB_16: return ExpandATOMIC_LOAD_SUB(N,DAG); - case ISD::ATOMIC_LOAD_SUB_32: return ExpandATOMIC_LOAD_SUB(N,DAG); - case ISD::ATOMIC_LOAD_SUB_64: return ExpandATOMIC_LOAD_SUB(N,DAG); } } Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.h?rev=56808&r1=56807&r2=56808&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.h (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.h Mon Sep 29 17:25:26 2008 @@ -569,10 +569,10 @@ SDValue LowerCTLZ(SDValue Op, SelectionDAG &DAG); SDValue LowerCTTZ(SDValue Op, SelectionDAG &DAG); SDValue LowerCMP_SWAP(SDValue Op, SelectionDAG &DAG); + SDValue LowerLOAD_SUB(SDValue Op, SelectionDAG &DAG); SDNode *ExpandFP_TO_SINT(SDNode *N, SelectionDAG &DAG); SDNode *ExpandREADCYCLECOUNTER(SDNode *N, SelectionDAG &DAG); SDNode *ExpandATOMIC_CMP_SWAP(SDNode *N, SelectionDAG &DAG); - SDNode *ExpandATOMIC_LOAD_SUB(SDNode *N, SelectionDAG &DAG); SDValue EmitTargetCodeForMemset(SelectionDAG &DAG, SDValue Chain, From kremenek at apple.com Mon Sep 29 18:00:10 2008 From: kremenek at apple.com (Ted Kremenek) Date: Mon, 29 Sep 2008 23:00:10 -0000 Subject: [llvm-commits] [llvm] r56811 - /llvm/tags/checker/checker-103/ Message-ID: <200809292300.m8TN0Ams031430@zion.cs.uiuc.edu> Author: kremenek Date: Mon Sep 29 18:00:10 2008 New Revision: 56811 URL: http://llvm.org/viewvc/llvm-project?rev=56811&view=rev Log: Tagging checker-103. Added: llvm/tags/checker/checker-103/ - copied from r56810, llvm/trunk/ From kremenek at apple.com Mon Sep 29 18:05:55 2008 From: kremenek at apple.com (Ted Kremenek) Date: Mon, 29 Sep 2008 23:05:55 -0000 Subject: [llvm-commits] [llvm] r56813 - /llvm/tags/checker/checker-103/ Message-ID: <200809292305.m8TN5tuZ032002@zion.cs.uiuc.edu> Author: kremenek Date: Mon Sep 29 18:05:54 2008 New Revision: 56813 URL: http://llvm.org/viewvc/llvm-project?rev=56813&view=rev Log: Removing checker-103. Removed: llvm/tags/checker/checker-103/ From kremenek at apple.com Mon Sep 29 18:06:25 2008 From: kremenek at apple.com (Ted Kremenek) Date: Mon, 29 Sep 2008 23:06:25 -0000 Subject: [llvm-commits] [llvm] r56816 - /llvm/tags/checker/checker-103/ Message-ID: <200809292306.m8TN6PeB032084@zion.cs.uiuc.edu> Author: kremenek Date: Mon Sep 29 18:06:25 2008 New Revision: 56816 URL: http://llvm.org/viewvc/llvm-project?rev=56816&view=rev Log: Tagging checker-103. Added: llvm/tags/checker/checker-103/ - copied from r56815, llvm/trunk/ From dpatel at apple.com Mon Sep 29 19:22:26 2008 From: dpatel at apple.com (Devang Patel) Date: Tue, 30 Sep 2008 00:22:26 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r56820 - in /llvm-gcc-4.2/trunk/gcc: llvm-convert.cpp llvm-types.cpp Message-ID: <200809300022.m8U0MQ1P007118@zion.cs.uiuc.edu> Author: dpatel Date: Mon Sep 29 19:22:25 2008 New Revision: 56820 URL: http://llvm.org/viewvc/llvm-project?rev=56820&view=rev Log: Distinguish between function attributes and return value attributes. Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp 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=56820&r1=56819&r2=56820&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Mon Sep 29 19:22:25 2008 @@ -2623,9 +2623,9 @@ // Work out whether to use an invoke or an ordinary call. if (!tree_could_throw_p(exp)) // This call does not throw - mark it 'nounwind'. - PAL = PAL.addAttr(0, Attribute::NoUnwind); + PAL = PAL.addAttr(~0, Attribute::NoUnwind); - if (!PAL.paramHasAttr(0, Attribute::NoUnwind)) { + if (!PAL.paramHasAttr(~0, Attribute::NoUnwind)) { // This call may throw. Determine if we need to generate // an invoke rather than a simple call. int RegionNo = lookup_stmt_eh_region(exp); 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=56820&r1=56819&r2=56820&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Mon Sep 29 19:22:25 2008 @@ -1129,17 +1129,17 @@ // Compute attributes for return type (and function attributes). SmallVector Attrs; - Attributes RAttributes = Attribute::None; + Attributes FnAttributes = Attribute::None; int flags = flags_from_decl_or_type(decl ? decl : type); // Check for 'noreturn' function attribute. if (flags & ECF_NORETURN) - RAttributes |= Attribute::NoReturn; + FnAttributes |= Attribute::NoReturn; // Check for 'nounwind' function attribute. if (flags & ECF_NOTHROW) - RAttributes |= Attribute::NoUnwind; + FnAttributes |= Attribute::NoUnwind; // Check for 'readnone' function attribute. // Both PURE and CONST will be set if the user applied @@ -1150,25 +1150,26 @@ // accepts it). But llvm IR does not allow both, so // set only ReadNone. if (flags & ECF_CONST) - RAttributes |= Attribute::ReadNone; + FnAttributes |= Attribute::ReadNone; // Check for 'readonly' function attribute. if (flags & ECF_PURE && !(flags & ECF_CONST)) - RAttributes |= Attribute::ReadOnly; + FnAttributes |= Attribute::ReadOnly; // Since they write the return value through a pointer, // 'sret' functions cannot be 'readnone' or 'readonly'. if (ABIConverter.isShadowReturn()) - RAttributes &= ~(Attribute::ReadNone|Attribute::ReadOnly); + FnAttributes &= ~(Attribute::ReadNone|Attribute::ReadOnly); // Demote 'readnone' nested functions to 'readonly' since // they may need to read through the static chain. - if (static_chain && (RAttributes & Attribute::ReadNone)) { - RAttributes &= ~Attribute::ReadNone; - RAttributes |= Attribute::ReadOnly; + if (static_chain && (FnAttributes & Attribute::ReadNone)) { + FnAttributes &= ~Attribute::ReadNone; + FnAttributes |= Attribute::ReadOnly; } // Compute whether the result needs to be zext or sext'd. + Attributes RAttributes = Attribute::None; RAttributes |= HandleArgumentExtension(TREE_TYPE(type)); // Allow the target to change the attributes. @@ -1278,6 +1279,9 @@ isVarArg = (Args == 0); assert(RetTy && "Return type not specified!"); + if (FnAttributes != Attribute::None) + Attrs.push_back(AttributeWithIndex::get(~0, FnAttributes)); + // Finally, make the function type and result attributes. PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); return GetFunctionType(RetTy, ArgTypes, isVarArg); From gohman at apple.com Mon Sep 29 19:48:40 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 30 Sep 2008 00:48:40 -0000 Subject: [llvm-commits] [llvm] r56823 - /llvm/trunk/lib/Target/X86/X86FastISel.cpp Message-ID: <200809300048.m8U0merx009980@zion.cs.uiuc.edu> Author: djg Date: Mon Sep 29 19:48:39 2008 New Revision: 56823 URL: http://llvm.org/viewvc/llvm-project?rev=56823&view=rev Log: Disable all x87 usage, including f32 and f64 when the subtarget doesn't have SSE(2), with X86FastISel. 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=56823&r1=56822&r2=56823&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86FastISel.cpp (original) +++ llvm/trunk/lib/Target/X86/X86FastISel.cpp Mon Sep 29 19:48:39 2008 @@ -123,10 +123,12 @@ (VT == MVT::f32 && X86ScalarSSEf32); // f32 is when SSE1 } + bool isTypeLegal(const Type *Ty, const TargetLowering &TLI, MVT &VT, + bool AllowI1 = false); }; -static bool isTypeLegal(const Type *Ty, const TargetLowering &TLI, MVT &VT, - bool AllowI1 = false) { +bool X86FastISel::isTypeLegal(const Type *Ty, const TargetLowering &TLI, + MVT &VT, bool AllowI1) { VT = MVT::getMVT(Ty, /*HandleUnknown=*/true); if (VT == MVT::Other || !VT.isSimple()) // Unhandled type. Halt "fast" selection and bail. @@ -134,6 +136,15 @@ if (VT == MVT::iPTR) // Use pointer type. VT = TLI.getPointerTy(); + // For now, require SSE/SSE2 for performing floating-point operations, + // since x87 requires additional work. + if (VT == MVT::f64 && !X86ScalarSSEf64) + return false; + if (VT == MVT::f32 && !X86ScalarSSEf32) + return false; + // Similarly, no f80 support yet. + if (VT == MVT::f80) + return false; // We only handle legal types. For example, on x86-32 the instruction // selector contains all of the 64-bit instructions from x86-64, // under the assumption that i64 won't be used if the target doesn't @@ -516,8 +527,8 @@ bool X86FastISel::X86SelectCmp(Instruction *I) { CmpInst *CI = cast(I); - MVT VT = TLI.getValueType(I->getOperand(0)->getType()); - if (!TLI.isTypeLegal(VT)) + MVT VT; + if (!isTypeLegal(I->getOperand(0)->getType(), TLI, VT)) return false; unsigned Op0Reg = getRegForValue(CI->getOperand(0)); @@ -728,7 +739,7 @@ } MVT VT = MVT::getMVT(I->getType(), /*HandleUnknown=*/true); - if (VT == MVT::Other || !TLI.isTypeLegal(VT)) + if (VT == MVT::Other || !isTypeLegal(I->getType(), TLI, VT)) return false; unsigned Op0Reg = getRegForValue(I->getOperand(0)); @@ -773,7 +784,7 @@ } MVT VT = MVT::getMVT(Ty, /*HandleUnknown=*/true); - if (VT == MVT::Other || !TLI.isTypeLegal(VT)) + if (VT == MVT::Other || !isTypeLegal(Ty, TLI, VT)) return false; unsigned Op0Reg = getRegForValue(I->getOperand(0)); From gohman at apple.com Mon Sep 29 19:58:23 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 30 Sep 2008 00:58:23 -0000 Subject: [llvm-commits] [llvm] r56825 - in /llvm/trunk/lib/Target/X86: X86FastISel.cpp X86ISelDAGToDAG.cpp X86InstrInfo.cpp X86InstrInfo.h X86MachineFunctionInfo.h Message-ID: <200809300058.m8U0wNFv010953@zion.cs.uiuc.edu> Author: djg Date: Mon Sep 29 19:58:23 2008 New Revision: 56825 URL: http://llvm.org/viewvc/llvm-project?rev=56825&view=rev Log: Move the GlobalBaseReg field out of X86ISelDAGToDAG.cpp and X86FastISel.cpp into X86MachineFunction.h, so that it can be shared, instead of having each selector keep track of its own. Modified: llvm/trunk/lib/Target/X86/X86FastISel.cpp llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp llvm/trunk/lib/Target/X86/X86InstrInfo.cpp llvm/trunk/lib/Target/X86/X86InstrInfo.h llvm/trunk/lib/Target/X86/X86MachineFunctionInfo.h Modified: llvm/trunk/lib/Target/X86/X86FastISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FastISel.cpp?rev=56825&r1=56824&r2=56825&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86FastISel.cpp (original) +++ llvm/trunk/lib/Target/X86/X86FastISel.cpp Mon Sep 29 19:58:23 2008 @@ -40,10 +40,6 @@ /// unsigned StackPtr; - /// GlobalBaseReg - keeps track of the virtual register mapped onto global - /// base register. - unsigned GlobalBaseReg; - /// X86ScalarSSEf32, X86ScalarSSEf64 - Select between SSE or x87 /// floating point ops. /// When SSE is available, use it for f32 operations. @@ -60,7 +56,6 @@ : FastISel(mf, mmi, vm, bm, am) { Subtarget = &TM.getSubtarget(); StackPtr = Subtarget->is64Bit() ? X86::RSP : X86::ESP; - GlobalBaseReg = 0; X86ScalarSSEf64 = Subtarget->hasSSE2(); X86ScalarSSEf32 = Subtarget->hasSSE1(); } @@ -103,8 +98,6 @@ CCAssignFn *CCAssignFnForCall(unsigned CC, bool isTailCall = false); - unsigned getGlobalBaseReg(); - const X86InstrInfo *getInstrInfo() const { return getTargetMachine()->getInstrInfo(); } @@ -152,16 +145,6 @@ return (AllowI1 && VT == MVT::i1) || TLI.isTypeLegal(VT); } -/// getGlobalBaseReg - Return the the global base register. Output -/// instructions required to initialize the global base register, if necessary. -/// -unsigned X86FastISel::getGlobalBaseReg() { - assert(!Subtarget->is64Bit() && "X86-64 PIC uses RIP relative addressing"); - if (!GlobalBaseReg) - GlobalBaseReg = getInstrInfo()->initializeGlobalBaseReg(MBB->getParent()); - return GlobalBaseReg; -} - #include "X86GenCallingConv.inc" /// CCAssignFnForCall - Selects the correct CCAssignFn for a given calling @@ -433,7 +416,7 @@ if (!isCall && TM.getRelocationModel() == Reloc::PIC_ && !Subtarget->is64Bit()) - AM.Base.Reg = getGlobalBaseReg(); + AM.Base.Reg = getInstrInfo()->getGlobalBaseReg(&MF); // Emit an extra load if the ABI requires it. if (Subtarget->GVRequiresExtraLoad(GV, TM, isCall)) { @@ -1042,7 +1025,7 @@ TM.getRelocationModel() == Reloc::PIC_ && Subtarget->isPICStyleGOT()) { TargetRegisterClass *RC = X86::GR32RegisterClass; - unsigned Base = getGlobalBaseReg(); + unsigned Base = getInstrInfo()->getGlobalBaseReg(&MF); bool Emitted = TII.copyRegToReg(*MBB, MBB->end(), X86::EBX, Base, RC, RC); assert(Emitted && "Failed to emit a copy instruction!"); } Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=56825&r1=56824&r2=56825&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Mon Sep 29 19:58:23 2008 @@ -123,10 +123,6 @@ /// make the right decision when generating code for different targets. const X86Subtarget *Subtarget; - /// GlobalBaseReg - keeps track of the virtual register mapped onto global - /// base register. - unsigned GlobalBaseReg; - /// CurBB - Current BB being isel'd. /// MachineBasicBlock *CurBB; @@ -143,12 +139,6 @@ Subtarget(&TM.getSubtarget()), OptForSize(OptimizeForSize) {} - virtual bool runOnFunction(Function &Fn) { - // Make sure we re-emit a set of the global base reg if necessary - GlobalBaseReg = 0; - return SelectionDAGISel::runOnFunction(Fn); - } - virtual const char *getPassName() const { return "X86 DAG->DAG Instruction Selection"; } @@ -1174,9 +1164,8 @@ /// initialize the global base register, if necessary. /// SDNode *X86DAGToDAGISel::getGlobalBaseReg() { - assert(!Subtarget->is64Bit() && "X86-64 PIC uses RIP relative addressing"); - if (!GlobalBaseReg) - GlobalBaseReg = TM.getInstrInfo()->initializeGlobalBaseReg(BB->getParent()); + MachineFunction *MF = CurBB->getParent(); + unsigned GlobalBaseReg = TM.getInstrInfo()->getGlobalBaseReg(MF); return CurDAG->getRegister(GlobalBaseReg, TLI.getPointerTy()).getNode(); } Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=56825&r1=56824&r2=56825&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Mon Sep 29 19:58:23 2008 @@ -2947,10 +2947,19 @@ return Size; } -/// initializeGlobalBaseReg - Output the instructions required to put the -/// base address to use for accessing globals into a register. +/// getGlobalBaseReg - Return a virtual register initialized with the +/// the global base register value. Output instructions required to +/// initialize the register in the function entry block, if necessary. /// -unsigned X86InstrInfo::initializeGlobalBaseReg(MachineFunction *MF) const { +unsigned X86InstrInfo::getGlobalBaseReg(MachineFunction *MF) const { + assert(!TM.getSubtarget().is64Bit() && + "X86-64 PIC uses RIP relative addressing"); + + X86MachineFunctionInfo *X86FI = MF->getInfo(); + unsigned GlobalBaseReg = X86FI->getGlobalBaseReg(); + if (GlobalBaseReg != 0) + return GlobalBaseReg; + // Insert the set of GlobalBaseReg into the first MBB of the function MachineBasicBlock &FirstMBB = MF->front(); MachineBasicBlock::iterator MBBI = FirstMBB.begin(); @@ -2966,12 +2975,14 @@ // not to pc, but to _GLOBAL_ADDRESS_TABLE_ external if (TM.getRelocationModel() == Reloc::PIC_ && TM.getSubtarget().isPICStyleGOT()) { - unsigned GlobalBaseReg = + GlobalBaseReg = RegInfo.createVirtualRegister(X86::GR32RegisterClass); BuildMI(FirstMBB, MBBI, TII->get(X86::ADD32ri), GlobalBaseReg) .addReg(PC).addExternalSymbol("_GLOBAL_OFFSET_TABLE_"); - return GlobalBaseReg; + } else { + GlobalBaseReg = PC; } - return PC; + X86FI->setGlobalBaseReg(GlobalBaseReg); + return GlobalBaseReg; } Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.h?rev=56825&r1=56824&r2=56825&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.h (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.h Mon Sep 29 19:58:23 2008 @@ -414,10 +414,11 @@ /// virtual unsigned GetInstSizeInBytes(const MachineInstr *MI) const; - /// initializeGlobalBaseReg - Output the instructions required to put the - /// base address to use for accessing globals into a register. + /// getGlobalBaseReg - Return a virtual register initialized with the + /// the global base register value. Output instructions required to + /// initialize the register in the function entry block, if necessary. /// - unsigned initializeGlobalBaseReg(MachineFunction *MF) const; + unsigned getGlobalBaseReg(MachineFunction *MF) const; private: MachineInstr* foldMemoryOperand(MachineFunction &MF, Modified: llvm/trunk/lib/Target/X86/X86MachineFunctionInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MachineFunctionInfo.h?rev=56825&r1=56824&r2=56825&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86MachineFunctionInfo.h (original) +++ llvm/trunk/lib/Target/X86/X86MachineFunctionInfo.h Mon Sep 29 19:58:23 2008 @@ -58,6 +58,10 @@ /// holds the virtual register into which the sret argument is passed. unsigned SRetReturnReg; + /// GlobalBaseReg - keeps track of the virtual register mapped onto global + /// base register. + unsigned GlobalBaseReg; + public: X86MachineFunctionInfo() : ForceFramePointer(false), CalleeSavedFrameSize(0), @@ -65,7 +69,8 @@ DecorationStyle(None), ReturnAddrIndex(0), TailCallReturnAddrDelta(0), - SRetReturnReg(0) {} + SRetReturnReg(0), + GlobalBaseReg(0) {} X86MachineFunctionInfo(MachineFunction &MF) : ForceFramePointer(false), CalleeSavedFrameSize(0), @@ -73,7 +78,8 @@ DecorationStyle(None), ReturnAddrIndex(0), TailCallReturnAddrDelta(0), - SRetReturnReg(0) {} + SRetReturnReg(0), + GlobalBaseReg(0) {} bool getForceFramePointer() const { return ForceFramePointer;} void setForceFramePointer(bool forceFP) { ForceFramePointer = forceFP; } @@ -95,6 +101,9 @@ unsigned getSRetReturnReg() const { return SRetReturnReg; } void setSRetReturnReg(unsigned Reg) { SRetReturnReg = Reg; } + + unsigned getGlobalBaseReg() const { return GlobalBaseReg; } + void setGlobalBaseReg(unsigned Reg) { GlobalBaseReg = Reg; } }; } // End llvm namespace From gohman at apple.com Mon Sep 29 20:21:32 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 30 Sep 2008 01:21:32 -0000 Subject: [llvm-commits] [llvm] r56829 - in /llvm/trunk/lib/Target/X86: X86FastISel.cpp X86InstrBuilder.h Message-ID: <200809300121.m8U1LWLM013275@zion.cs.uiuc.edu> Author: djg Date: Mon Sep 29 20:21:32 2008 New Revision: 56829 URL: http://llvm.org/viewvc/llvm-project?rev=56829&view=rev Log: Fix X86FastISel's output for x86-32 PIC constant pool addresses. Modified: llvm/trunk/lib/Target/X86/X86FastISel.cpp llvm/trunk/lib/Target/X86/X86InstrBuilder.h Modified: llvm/trunk/lib/Target/X86/X86FastISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FastISel.cpp?rev=56829&r1=56828&r2=56829&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86FastISel.cpp (original) +++ llvm/trunk/lib/Target/X86/X86FastISel.cpp Mon Sep 29 20:21:32 2008 @@ -1217,9 +1217,18 @@ Align = Log2_64(Align); } + // x86-32 PIC requires a PIC base register for constant pools. + unsigned PICBase = 0; + if (TM.getRelocationModel() == Reloc::PIC_ && + !Subtarget->is64Bit()) + PICBase = getInstrInfo()->getGlobalBaseReg(&MF); + + // Create the load from the constant pool. unsigned MCPOffset = MCP.getConstantPoolIndex(C, Align); unsigned ResultReg = createResultReg(RC); - addConstantPoolReference(BuildMI(MBB, TII.get(Opc), ResultReg), MCPOffset); + addConstantPoolReference(BuildMI(MBB, TII.get(Opc), ResultReg), MCPOffset, + PICBase); + return ResultReg; } Modified: llvm/trunk/lib/Target/X86/X86InstrBuilder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrBuilder.h?rev=56829&r1=56828&r2=56829&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrBuilder.h (original) +++ llvm/trunk/lib/Target/X86/X86InstrBuilder.h Mon Sep 29 20:21:32 2008 @@ -114,13 +114,15 @@ /// addConstantPoolReference - This function is used to add a reference to the /// base of a constant value spilled to the per-function constant pool. The -/// reference has base register ConstantPoolIndex offset which is retained until -/// either machine code emission or assembly output. This allows an optional -/// offset to be added as well. +/// reference uses the abstract ConstantPoolIndex which is retained until +/// either machine code emission or assembly output. In PIC mode on x86-32, +/// the GlobalBaseReg parameter can be used to make this a +/// GlobalBaseReg-relative reference. /// inline const MachineInstrBuilder & -addConstantPoolReference(const MachineInstrBuilder &MIB, unsigned CPI) { - return MIB.addReg(0).addImm(1).addReg(0).addConstantPoolIndex(CPI); +addConstantPoolReference(const MachineInstrBuilder &MIB, unsigned CPI, + unsigned GlobalBaseReg = 0) { + return MIB.addReg(GlobalBaseReg).addImm(1).addReg(0).addConstantPoolIndex(CPI); } } // End llvm namespace From nicholas at mxc.ca Tue Sep 30 01:08:34 2008 From: nicholas at mxc.ca (Nick Lewycky) Date: Tue, 30 Sep 2008 06:08:34 -0000 Subject: [llvm-commits] [llvm] r56834 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/2008-09-29-FoldingOr.ll Message-ID: <200809300608.m8U68ZJs000573@zion.cs.uiuc.edu> Author: nicholas Date: Tue Sep 30 01:08:34 2008 New Revision: 56834 URL: http://llvm.org/viewvc/llvm-project?rev=56834&view=rev Log: Fix misoptimization of: xor i1 (icmp eq (X, C1), icmp s[lg]t (X, C2)) Added: llvm/trunk/test/Transforms/InstCombine/2008-09-29-FoldingOr.ll 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=56834&r1=56833&r2=56834&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Tue Sep 30 01:08:34 2008 @@ -3023,7 +3023,7 @@ I.setOperand(1, RHSNeg); return &I; } - + // If the sign bits of both operands are zero (i.e. we can prove they are // unsigned inputs), turn this into a urem. if (I.getType()->isInteger()) { @@ -4205,7 +4205,8 @@ // Ensure that the larger constant is on the RHS. ICmpInst *LHS = cast(Op0); bool NeedsSwap; - if (ICmpInst::isSignedPredicate(LHSCC)) + if (ICmpInst::isEquality(LHSCC) ? ICmpInst::isSignedPredicate(RHSCC) + : ICmpInst::isSignedPredicate(LHSCC)) NeedsSwap = LHSCst->getValue().sgt(RHSCst->getValue()); else NeedsSwap = LHSCst->getValue().ugt(RHSCst->getValue()); Added: llvm/trunk/test/Transforms/InstCombine/2008-09-29-FoldingOr.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/2008-09-29-FoldingOr.ll?rev=56834&view=auto ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/2008-09-29-FoldingOr.ll (added) +++ llvm/trunk/test/Transforms/InstCombine/2008-09-29-FoldingOr.ll Tue Sep 30 01:08:34 2008 @@ -0,0 +1,10 @@ +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {or i1} +; PR2844 + +define i32 @test(i32 %p_74) { + %A = icmp eq i32 %p_74, 0 ; [#uses=1] + %B = icmp slt i32 %p_74, -638208501 ; [#uses=1] + %or.cond = or i1 %A, %B ; [#uses=1] + %iftmp.10.0 = select i1 %or.cond, i32 0, i32 1 ; [#uses=1] + ret i32 %iftmp.10.0 +} From evan.cheng at apple.com Tue Sep 30 01:36:59 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 30 Sep 2008 06:36:59 -0000 Subject: [llvm-commits] [llvm] r56835 - in /llvm/trunk: lib/CodeGen/LiveIntervalAnalysis.cpp lib/CodeGen/RegAllocLinearScan.cpp lib/CodeGen/SimpleRegisterCoalescing.cpp test/CodeGen/X86/2008-09-29-ReMatBug.ll Message-ID: <200809300636.m8U6axrA002702@zion.cs.uiuc.edu> Author: evancheng Date: Tue Sep 30 01:36:58 2008 New Revision: 56835 URL: http://llvm.org/viewvc/llvm-project?rev=56835&view=rev Log: If a re-materializable instruction has a register operand, the spiller will change the register operand's spill weight to HUGE_VAL to avoid it being spilled. However, if the operand is already in the queue ready to be spilled, avoid re-materializing it. Added: llvm/trunk/test/CodeGen/X86/2008-09-29-ReMatBug.ll Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=56835&r1=56834&r2=56835&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Tue Sep 30 01:36:58 2008 @@ -819,6 +819,7 @@ /// val# of the specified interval is re-materializable. bool LiveIntervals::isReMaterializable(const LiveInterval &li, const VNInfo *ValNo, MachineInstr *MI, + SmallVectorImpl &SpillIs, bool &isLoad) { if (DisableReMat) return false; @@ -855,8 +856,8 @@ // If the instruction accesses memory and the memory could be non-constant, // assume the instruction is not rematerializable. - for (std::list::const_iterator I = MI->memoperands_begin(), - E = MI->memoperands_end(); I != E; ++I) { + for (std::list::const_iterator + I = MI->memoperands_begin(), E = MI->memoperands_end(); I != E; ++I){ const MachineMemOperand &MMO = *I; if (MMO.isVolatile() || MMO.isStore()) return false; @@ -924,13 +925,21 @@ if (!isValNoAvailableAt(ImpLi, MI, UseIdx)) return false; } + + // If a register operand of the re-materialized instruction is going to + // be spilled next, then it's not legal to re-materialize this instruction. + for (unsigned i = 0, e = SpillIs.size(); i != e; ++i) + if (ImpUse == SpillIs[i]->reg) + return false; } return true; } /// isReMaterializable - Returns true if every definition of MI of every /// val# of the specified interval is re-materializable. -bool LiveIntervals::isReMaterializable(const LiveInterval &li, bool &isLoad) { +bool LiveIntervals::isReMaterializable(const LiveInterval &li, + SmallVectorImpl &SpillIs, + bool &isLoad) { isLoad = false; for (LiveInterval::const_vni_iterator i = li.vni_begin(), e = li.vni_end(); i != e; ++i) { @@ -944,7 +953,7 @@ MachineInstr *ReMatDefMI = getInstructionFromIndex(DefIdx); bool DefIsLoad = false; if (!ReMatDefMI || - !isReMaterializable(li, VNI, ReMatDefMI, DefIsLoad)) + !isReMaterializable(li, VNI, ReMatDefMI, SpillIs, DefIsLoad)) return false; isLoad |= DefIsLoad; } @@ -1728,6 +1737,7 @@ std::vector LiveIntervals:: addIntervalsForSpills(const LiveInterval &li, + SmallVectorImpl &SpillIs, const MachineLoopInfo *loopInfo, VirtRegMap &vrm, float &SSWeight) { @@ -1831,7 +1841,7 @@ MachineInstr *ReMatDefMI = (DefIdx == ~0u) ? 0 : getInstructionFromIndex(DefIdx); bool dummy; - if (ReMatDefMI && isReMaterializable(li, VNI, ReMatDefMI, dummy)) { + if (ReMatDefMI && isReMaterializable(li, VNI, ReMatDefMI, SpillIs, dummy)) { // Remember how to remat the def of this val#. ReMatOrigDefs[VN] = ReMatDefMI; // Original def may be modified so we have to make a copy here. Modified: llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp?rev=56835&r1=56834&r2=56835&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp Tue Sep 30 01:36:58 2008 @@ -879,8 +879,9 @@ if (cur->weight != HUGE_VALF && cur->weight <= minWeight) { DOUT << "\t\t\tspilling(c): " << *cur << '\n'; float SSWeight; + SmallVector spillIs; std::vector added = - li_->addIntervalsForSpills(*cur, loopInfo, *vrm_, SSWeight); + li_->addIntervalsForSpills(*cur, spillIs, loopInfo, *vrm_, SSWeight); addStackInterval(cur, ls_, li_, SSWeight, *vrm_); if (added.empty()) return; // Early exit if all spills were folded. @@ -931,7 +932,7 @@ earliestStart = std::min(earliestStart, sli->beginNumber()); float SSWeight; std::vector newIs = - li_->addIntervalsForSpills(*sli, loopInfo, *vrm_, SSWeight); + li_->addIntervalsForSpills(*sli, spillIs, loopInfo, *vrm_, SSWeight); addStackInterval(sli, ls_, li_, SSWeight, *vrm_); std::copy(newIs.begin(), newIs.end(), std::back_inserter(added)); spilled.insert(sli->reg); Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=56835&r1=56834&r2=56835&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original) +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Tue Sep 30 01:36:58 2008 @@ -2361,7 +2361,8 @@ LI.weight = HUGE_VALF; else { bool isLoad = false; - if (li_->isReMaterializable(LI, isLoad)) { + SmallVector SpillIs; + if (li_->isReMaterializable(LI, SpillIs, isLoad)) { // If all of the definitions of the interval are re-materializable, // it is a preferred candidate for spilling. If non of the defs are // loads, then it's potentially very cheap to re-materialize. Added: llvm/trunk/test/CodeGen/X86/2008-09-29-ReMatBug.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2008-09-29-ReMatBug.ll?rev=56835&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/2008-09-29-ReMatBug.ll (added) +++ llvm/trunk/test/CodeGen/X86/2008-09-29-ReMatBug.ll Tue Sep 30 01:36:58 2008 @@ -0,0 +1,85 @@ +; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin -relocation-model=pic -disable-fp-elim + + %struct..0objc_selector = type opaque + %struct.NSString = type opaque + %struct.XCStringList = type { i32, %struct._XCStringListNode* } + %struct._XCStringListNode = type { [3 x i8], [0 x i8], i8 } + %struct.__builtin_CFString = type { i32*, i32, i8*, i32 } +internal constant %struct.__builtin_CFString { i32* getelementptr ([0 x i32]* @__CFConstantStringClassReference, i32 0, i32 0), i32 1992, i8* getelementptr ([3 x i8]* @"\01LC", i32 0, i32 0), i32 2 } ; <%struct.__builtin_CFString*>:0 [#uses=1] + at __CFConstantStringClassReference = external global [0 x i32] ; <[0 x i32]*> [#uses=1] +@"\01LC" = internal constant [3 x i8] c"NO\00" ; <[3 x i8]*> [#uses=1] +@"\01LC1" = internal constant [1 x i8] zeroinitializer ; <[1 x i8]*> [#uses=1] + at llvm.used1 = appending global [1 x i8*] [ i8* bitcast (%struct.NSString* (%struct.XCStringList*, %struct..0objc_selector*)* @"-[XCStringList stringRepresentation]" to i8*) ], section "llvm.metadata" ; <[1 x i8*]*> [#uses=0] + +define %struct.NSString* @"-[XCStringList stringRepresentation]"(%struct.XCStringList* %self, %struct..0objc_selector* %_cmd) nounwind { +entry: + %0 = load i32* null, align 4 ; [#uses=1] + %1 = and i32 %0, 16777215 ; [#uses=1] + %2 = icmp eq i32 %1, 0 ; [#uses=1] + br i1 %2, label %bb44, label %bb4 + +bb4: ; preds = %entry + %3 = load %struct._XCStringListNode** null, align 4 ; <%struct._XCStringListNode*> [#uses=2] + %4 = icmp eq %struct._XCStringListNode* %3, null ; [#uses=1] + %5 = bitcast %struct._XCStringListNode* %3 to i32* ; [#uses=1] + br label %bb37.outer + +bb6: ; preds = %bb37 + br label %bb19 + +bb19: ; preds = %bb37, %bb6 + %.rle = phi i32 [ 0, %bb6 ], [ %10, %bb37 ] ; [#uses=1] + %bufptr.0.lcssa = phi i8* [ null, %bb6 ], [ null, %bb37 ] ; [#uses=2] + %6 = and i32 %.rle, 16777215 ; [#uses=1] + %7 = icmp eq i32 %6, 0 ; [#uses=1] + br i1 %7, label %bb25.split, label %bb37 + +bb25.split: ; preds = %bb19 + call void @foo(i8* getelementptr ([1 x i8]* @"\01LC1", i32 0, i32 0)) nounwind nounwind + br label %bb35.outer + +bb34: ; preds = %bb35, %bb35, %bb35, %bb35 + %8 = getelementptr i8* %bufptr.0.lcssa, i32 %totalLength.0.ph ; [#uses=1] + store i8 92, i8* %8, align 1 + br label %bb35.outer + +bb35.outer: ; preds = %bb34, %bb25.split + %totalLength.0.ph = add i32 0, %totalLength.1.ph ; [#uses=2] + br label %bb35 + +bb35: ; preds = %bb35, %bb35.outer + %9 = load i8* null, align 1 ; [#uses=1] + switch i8 %9, label %bb35 [ + i8 0, label %bb37.outer + i8 32, label %bb34 + i8 92, label %bb34 + i8 34, label %bb34 + i8 39, label %bb34 + ] + +bb37.outer: ; preds = %bb35, %bb4 + %totalLength.1.ph = phi i32 [ 0, %bb4 ], [ %totalLength.0.ph, %bb35 ] ; [#uses=1] + %bufptr.1.ph = phi i8* [ null, %bb4 ], [ %bufptr.0.lcssa, %bb35 ] ; [#uses=2] + br i1 %4, label %bb39.split, label %bb37 + +bb37: ; preds = %bb37.outer, %bb19 + %10 = load i32* %5, align 4 ; [#uses=1] + br i1 false, label %bb6, label %bb19 + +bb39.split: ; preds = %bb37.outer + %11 = bitcast i8* null to %struct.NSString* ; <%struct.NSString*> [#uses=2] + %12 = icmp eq i8* null, %bufptr.1.ph ; [#uses=1] + br i1 %12, label %bb44, label %bb42 + +bb42: ; preds = %bb39.split + call void @quux(i8* %bufptr.1.ph) nounwind nounwind + ret %struct.NSString* %11 + +bb44: ; preds = %bb39.split, %entry + %.0 = phi %struct.NSString* [ bitcast (%struct.__builtin_CFString* @0 to %struct.NSString*), %entry ], [ %11, %bb39.split ] ; <%struct.NSString*> [#uses=1] + ret %struct.NSString* %.0 +} + +declare void @foo(i8*) + +declare void @quux(i8*) From baldrick at free.fr Tue Sep 30 02:39:38 2008 From: baldrick at free.fr (Duncan Sands) Date: Tue, 30 Sep 2008 09:39:38 +0200 Subject: [llvm-commits] r55638 - /llvm/trunk/include/llvm/Function.h In-Reply-To: <9AF39A0A-0CF3-4B3A-B253-89E98909B57C@apple.com> References: <200809231027.53858.baldrick@free.fr> <200809291823.29191.baldrick@free.fr> <9AF39A0A-0CF3-4B3A-B253-89E98909B57C@apple.com> Message-ID: <200809300939.38971.baldrick@free.fr> > Ignore inliner for a while, and decide what code generator should do > for following ? > > define float @foo(float %a, float %b) x86_no_sse { > %t = mul float %a, %b > ret float %t > } It would use the x86 floating point stack, like it does now if you compile with -mattr=-sse. This is less efficient than using sse. Ciao, Duncan. From baldrick at free.fr Tue Sep 30 02:57:45 2008 From: baldrick at free.fr (Duncan Sands) Date: Tue, 30 Sep 2008 09:57:45 +0200 Subject: [llvm-commits] r55638 - /llvm/trunk/include/llvm/Function.h In-Reply-To: <9AF39A0A-0CF3-4B3A-B253-89E98909B57C@apple.com> References: <200809231027.53858.baldrick@free.fr> <200809291823.29191.baldrick@free.fr> <9AF39A0A-0CF3-4B3A-B253-89E98909B57C@apple.com> Message-ID: <200809300957.45801.baldrick@free.fr> > > so any use of floating point (eg: fp multiplication) should be > > understood > > as using SSE, and would stop the inliner from inlining? > > Ignore inliner for a while, and decide what code generator should do > for following ? > > define float @foo(float %a, float %b) x86_no_sse { > %t = mul float %a, %b > ret float %t > } PS: In this topic I've been talking about performance. Perhaps that wasn't clear. Some relevant snippets from before: > > ... this happens only if because XYZ is marked as x86.no-sse. In which > > case, it is not a performance loss at all. > > I don't understand what you are saying here. Suppose XYZ is no-sse. > It calls S which is marked sse and does a lot of floating point > computation (but doesn't use sse intrinsics). If I understand you > right, the inliner can inline S into XYZ. This results in all these > floating point computations being done as "no-sse", i.e. using the > good 'ol x86 floating point stack rather than the much more efficient > sse registers... ... > I think it's important to distinguish between cases where the note is > required for correct behaviour, and where it simply indicates a preference. > > If it denotes a preference then it doesn't matter much if the inliner > discards the note when inlining the function. This is probably the > case for most codegen options - they are about performance/code size, > rather than about correctness. > > That said, suppose I compile A without any particular sse flags (eg: > because it itself doesn't use any sse instructions). Suppose B is > compiled with sse because it does vector operations. If LTO results > in B being inlined into A, and that means that the vector operations > are codegened without sse support - well, someone will be upset. From baldrick at free.fr Tue Sep 30 03:17:36 2008 From: baldrick at free.fr (Duncan Sands) Date: Tue, 30 Sep 2008 10:17:36 +0200 Subject: [llvm-commits] [llvm] r56801 - in /llvm/trunk: lib/AsmParser/llvmAsmParser.cpp.cvs lib/AsmParser/llvmAsmParser.y lib/AsmParser/llvmAsmParser.y.cvs lib/VMCore/AsmWriter.cpp test/Assembler/2008-09-02-FunctionNotes.ll test/Assembler/2008-09-02-FunctionNotes2.ll test/Assembler/2008-09-29-RetAttr.ll test/Transforms/DeadArgElim/keepalive.ll In-Reply-To: <200809292049.m8TKnqbf017763@zion.cs.uiuc.edu> References: <200809292049.m8TKnqbf017763@zion.cs.uiuc.edu> Message-ID: <200809301017.36485.baldrick@free.fr> Hi Devang, > --- llvm/trunk/test/Assembler/2008-09-02-FunctionNotes2.ll (original) > +++ llvm/trunk/test/Assembler/2008-09-02-FunctionNotes2.ll Mon Sep 29 15:49:50 2008 > @@ -1,7 +1,7 @@ > ; Test function notes > ; RUN: not llvm-as %s |& grep "only one inline note" > ; XFAIL: * > -define void @fn1() alwaysinline, noinline { > +define void @fn1() alwaysinline noinline { > ret void > } should this test still be xfail'ed? Also, the runline might be better as: not llvm-as < %s ... Ciao, Duncan. From baldrick at free.fr Tue Sep 30 05:00:30 2008 From: baldrick at free.fr (Duncan Sands) Date: Tue, 30 Sep 2008 10:00:30 -0000 Subject: [llvm-commits] [llvm] r56837 - in /llvm/trunk: lib/CodeGen/LiveIntervalAnalysis.cpp lib/CodeGen/RegAllocLinearScan.cpp lib/CodeGen/SimpleRegisterCoalescing.cpp test/CodeGen/X86/2008-09-29-ReMatBug.ll Message-ID: <200809301000.m8UA0Vmo031561@zion.cs.uiuc.edu> Author: baldrick Date: Tue Sep 30 05:00:30 2008 New Revision: 56837 URL: http://llvm.org/viewvc/llvm-project?rev=56837&view=rev Log: Revert commit 56835 since it breaks the build. "If a re-materializable instruction has a register operand, the spiller will change the register operand's spill weight to HUGE_VAL to avoid it being spilled. However, if the operand is already in the queue ready to be spilled, avoid re-materializing it". Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp llvm/trunk/test/CodeGen/X86/2008-09-29-ReMatBug.ll Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=56837&r1=56836&r2=56837&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Tue Sep 30 05:00:30 2008 @@ -819,7 +819,6 @@ /// val# of the specified interval is re-materializable. bool LiveIntervals::isReMaterializable(const LiveInterval &li, const VNInfo *ValNo, MachineInstr *MI, - SmallVectorImpl &SpillIs, bool &isLoad) { if (DisableReMat) return false; @@ -856,8 +855,8 @@ // If the instruction accesses memory and the memory could be non-constant, // assume the instruction is not rematerializable. - for (std::list::const_iterator - I = MI->memoperands_begin(), E = MI->memoperands_end(); I != E; ++I){ + for (std::list::const_iterator I = MI->memoperands_begin(), + E = MI->memoperands_end(); I != E; ++I) { const MachineMemOperand &MMO = *I; if (MMO.isVolatile() || MMO.isStore()) return false; @@ -925,21 +924,13 @@ if (!isValNoAvailableAt(ImpLi, MI, UseIdx)) return false; } - - // If a register operand of the re-materialized instruction is going to - // be spilled next, then it's not legal to re-materialize this instruction. - for (unsigned i = 0, e = SpillIs.size(); i != e; ++i) - if (ImpUse == SpillIs[i]->reg) - return false; } return true; } /// isReMaterializable - Returns true if every definition of MI of every /// val# of the specified interval is re-materializable. -bool LiveIntervals::isReMaterializable(const LiveInterval &li, - SmallVectorImpl &SpillIs, - bool &isLoad) { +bool LiveIntervals::isReMaterializable(const LiveInterval &li, bool &isLoad) { isLoad = false; for (LiveInterval::const_vni_iterator i = li.vni_begin(), e = li.vni_end(); i != e; ++i) { @@ -953,7 +944,7 @@ MachineInstr *ReMatDefMI = getInstructionFromIndex(DefIdx); bool DefIsLoad = false; if (!ReMatDefMI || - !isReMaterializable(li, VNI, ReMatDefMI, SpillIs, DefIsLoad)) + !isReMaterializable(li, VNI, ReMatDefMI, DefIsLoad)) return false; isLoad |= DefIsLoad; } @@ -1737,7 +1728,6 @@ std::vector LiveIntervals:: addIntervalsForSpills(const LiveInterval &li, - SmallVectorImpl &SpillIs, const MachineLoopInfo *loopInfo, VirtRegMap &vrm, float &SSWeight) { @@ -1841,7 +1831,7 @@ MachineInstr *ReMatDefMI = (DefIdx == ~0u) ? 0 : getInstructionFromIndex(DefIdx); bool dummy; - if (ReMatDefMI && isReMaterializable(li, VNI, ReMatDefMI, SpillIs, dummy)) { + if (ReMatDefMI && isReMaterializable(li, VNI, ReMatDefMI, dummy)) { // Remember how to remat the def of this val#. ReMatOrigDefs[VN] = ReMatDefMI; // Original def may be modified so we have to make a copy here. Modified: llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp?rev=56837&r1=56836&r2=56837&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp Tue Sep 30 05:00:30 2008 @@ -879,9 +879,8 @@ if (cur->weight != HUGE_VALF && cur->weight <= minWeight) { DOUT << "\t\t\tspilling(c): " << *cur << '\n'; float SSWeight; - SmallVector spillIs; std::vector added = - li_->addIntervalsForSpills(*cur, spillIs, loopInfo, *vrm_, SSWeight); + li_->addIntervalsForSpills(*cur, loopInfo, *vrm_, SSWeight); addStackInterval(cur, ls_, li_, SSWeight, *vrm_); if (added.empty()) return; // Early exit if all spills were folded. @@ -932,7 +931,7 @@ earliestStart = std::min(earliestStart, sli->beginNumber()); float SSWeight; std::vector newIs = - li_->addIntervalsForSpills(*sli, spillIs, loopInfo, *vrm_, SSWeight); + li_->addIntervalsForSpills(*sli, loopInfo, *vrm_, SSWeight); addStackInterval(sli, ls_, li_, SSWeight, *vrm_); std::copy(newIs.begin(), newIs.end(), std::back_inserter(added)); spilled.insert(sli->reg); Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=56837&r1=56836&r2=56837&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original) +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Tue Sep 30 05:00:30 2008 @@ -2361,8 +2361,7 @@ LI.weight = HUGE_VALF; else { bool isLoad = false; - SmallVector SpillIs; - if (li_->isReMaterializable(LI, SpillIs, isLoad)) { + if (li_->isReMaterializable(LI, isLoad)) { // If all of the definitions of the interval are re-materializable, // it is a preferred candidate for spilling. If non of the defs are // loads, then it's potentially very cheap to re-materialize. Modified: llvm/trunk/test/CodeGen/X86/2008-09-29-ReMatBug.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2008-09-29-ReMatBug.ll?rev=56837&r1=56836&r2=56837&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/2008-09-29-ReMatBug.ll (original) +++ llvm/trunk/test/CodeGen/X86/2008-09-29-ReMatBug.ll Tue Sep 30 05:00:30 2008 @@ -1,85 +0,0 @@ -; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin -relocation-model=pic -disable-fp-elim - - %struct..0objc_selector = type opaque - %struct.NSString = type opaque - %struct.XCStringList = type { i32, %struct._XCStringListNode* } - %struct._XCStringListNode = type { [3 x i8], [0 x i8], i8 } - %struct.__builtin_CFString = type { i32*, i32, i8*, i32 } -internal constant %struct.__builtin_CFString { i32* getelementptr ([0 x i32]* @__CFConstantStringClassReference, i32 0, i32 0), i32 1992, i8* getelementptr ([3 x i8]* @"\01LC", i32 0, i32 0), i32 2 } ; <%struct.__builtin_CFString*>:0 [#uses=1] - at __CFConstantStringClassReference = external global [0 x i32] ; <[0 x i32]*> [#uses=1] -@"\01LC" = internal constant [3 x i8] c"NO\00" ; <[3 x i8]*> [#uses=1] -@"\01LC1" = internal constant [1 x i8] zeroinitializer ; <[1 x i8]*> [#uses=1] - at llvm.used1 = appending global [1 x i8*] [ i8* bitcast (%struct.NSString* (%struct.XCStringList*, %struct..0objc_selector*)* @"-[XCStringList stringRepresentation]" to i8*) ], section "llvm.metadata" ; <[1 x i8*]*> [#uses=0] - -define %struct.NSString* @"-[XCStringList stringRepresentation]"(%struct.XCStringList* %self, %struct..0objc_selector* %_cmd) nounwind { -entry: - %0 = load i32* null, align 4 ; [#uses=1] - %1 = and i32 %0, 16777215 ; [#uses=1] - %2 = icmp eq i32 %1, 0 ; [#uses=1] - br i1 %2, label %bb44, label %bb4 - -bb4: ; preds = %entry - %3 = load %struct._XCStringListNode** null, align 4 ; <%struct._XCStringListNode*> [#uses=2] - %4 = icmp eq %struct._XCStringListNode* %3, null ; [#uses=1] - %5 = bitcast %struct._XCStringListNode* %3 to i32* ; [#uses=1] - br label %bb37.outer - -bb6: ; preds = %bb37 - br label %bb19 - -bb19: ; preds = %bb37, %bb6 - %.rle = phi i32 [ 0, %bb6 ], [ %10, %bb37 ] ; [#uses=1] - %bufptr.0.lcssa = phi i8* [ null, %bb6 ], [ null, %bb37 ] ; [#uses=2] - %6 = and i32 %.rle, 16777215 ; [#uses=1] - %7 = icmp eq i32 %6, 0 ; [#uses=1] - br i1 %7, label %bb25.split, label %bb37 - -bb25.split: ; preds = %bb19 - call void @foo(i8* getelementptr ([1 x i8]* @"\01LC1", i32 0, i32 0)) nounwind nounwind - br label %bb35.outer - -bb34: ; preds = %bb35, %bb35, %bb35, %bb35 - %8 = getelementptr i8* %bufptr.0.lcssa, i32 %totalLength.0.ph ; [#uses=1] - store i8 92, i8* %8, align 1 - br label %bb35.outer - -bb35.outer: ; preds = %bb34, %bb25.split - %totalLength.0.ph = add i32 0, %totalLength.1.ph ; [#uses=2] - br label %bb35 - -bb35: ; preds = %bb35, %bb35.outer - %9 = load i8* null, align 1 ; [#uses=1] - switch i8 %9, label %bb35 [ - i8 0, label %bb37.outer - i8 32, label %bb34 - i8 92, label %bb34 - i8 34, label %bb34 - i8 39, label %bb34 - ] - -bb37.outer: ; preds = %bb35, %bb4 - %totalLength.1.ph = phi i32 [ 0, %bb4 ], [ %totalLength.0.ph, %bb35 ] ; [#uses=1] - %bufptr.1.ph = phi i8* [ null, %bb4 ], [ %bufptr.0.lcssa, %bb35 ] ; [#uses=2] - br i1 %4, label %bb39.split, label %bb37 - -bb37: ; preds = %bb37.outer, %bb19 - %10 = load i32* %5, align 4 ; [#uses=1] - br i1 false, label %bb6, label %bb19 - -bb39.split: ; preds = %bb37.outer - %11 = bitcast i8* null to %struct.NSString* ; <%struct.NSString*> [#uses=2] - %12 = icmp eq i8* null, %bufptr.1.ph ; [#uses=1] - br i1 %12, label %bb44, label %bb42 - -bb42: ; preds = %bb39.split - call void @quux(i8* %bufptr.1.ph) nounwind nounwind - ret %struct.NSString* %11 - -bb44: ; preds = %bb39.split, %entry - %.0 = phi %struct.NSString* [ bitcast (%struct.__builtin_CFString* @0 to %struct.NSString*), %entry ], [ %11, %bb39.split ] ; <%struct.NSString*> [#uses=1] - ret %struct.NSString* %.0 -} - -declare void @foo(i8*) - -declare void @quux(i8*) From evan.cheng at apple.com Tue Sep 30 09:40:45 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 30 Sep 2008 07:40:45 -0700 Subject: [llvm-commits] [llvm] r56837 - in /llvm/trunk: lib/CodeGen/LiveIntervalAnalysis.cpp lib/CodeGen/RegAllocLinearScan.cpp lib/CodeGen/SimpleRegisterCoalescing.cpp test/CodeGen/X86/2008-09-29-ReMatBug.ll In-Reply-To: <200809301000.m8UA0Vmo031561@zion.cs.uiuc.edu> References: <200809301000.m8UA0Vmo031561@zion.cs.uiuc.edu> Message-ID: <7347AC32-90D0-4D75-B73B-840E7CFB46BB@apple.com> My mistake. I forgot the header file. I'll fix. Evan On Sep 30, 2008, at 3:00 AM, Duncan Sands wrote: > Author: baldrick > Date: Tue Sep 30 05:00:30 2008 > New Revision: 56837 > > URL: http://llvm.org/viewvc/llvm-project?rev=56837&view=rev > Log: > Revert commit 56835 since it breaks the build. > "If a re-materializable instruction has a register > operand, the spiller will change the register operand's > spill weight to HUGE_VAL to avoid it being spilled. > However, if the operand is already in the queue ready > to be spilled, avoid re-materializing it". > > Modified: > llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp > llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp > llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp > llvm/trunk/test/CodeGen/X86/2008-09-29-ReMatBug.ll > > Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=56837&r1=56836&r2=56837&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original) > +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Tue Sep 30 > 05:00:30 2008 > @@ -819,7 +819,6 @@ > /// val# of the specified interval is re-materializable. > bool LiveIntervals::isReMaterializable(const LiveInterval &li, > const VNInfo *ValNo, > MachineInstr *MI, > - > SmallVectorImpl &SpillIs, > bool &isLoad) { > if (DisableReMat) > return false; > @@ -856,8 +855,8 @@ > > // If the instruction accesses memory and the memory could be > non-constant, > // assume the instruction is not rematerializable. > - for (std::list::const_iterator > - I = MI->memoperands_begin(), E = MI->memoperands_end(); > I != E; ++I){ > + for (std::list::const_iterator I = MI- > >memoperands_begin(), > + E = MI->memoperands_end(); I != E; ++I) { > const MachineMemOperand &MMO = *I; > if (MMO.isVolatile() || MMO.isStore()) > return false; > @@ -925,21 +924,13 @@ > if (!isValNoAvailableAt(ImpLi, MI, UseIdx)) > return false; > } > - > - // If a register operand of the re-materialized instruction is > going to > - // be spilled next, then it's not legal to re-materialize this > instruction. > - for (unsigned i = 0, e = SpillIs.size(); i != e; ++i) > - if (ImpUse == SpillIs[i]->reg) > - return false; > } > return true; > } > > /// isReMaterializable - Returns true if every definition of MI of > every > /// val# of the specified interval is re-materializable. > -bool LiveIntervals::isReMaterializable(const LiveInterval &li, > - > SmallVectorImpl &SpillIs, > - bool &isLoad) { > +bool LiveIntervals::isReMaterializable(const LiveInterval &li, bool > &isLoad) { > isLoad = false; > for (LiveInterval::const_vni_iterator i = li.vni_begin(), e = > li.vni_end(); > i != e; ++i) { > @@ -953,7 +944,7 @@ > MachineInstr *ReMatDefMI = getInstructionFromIndex(DefIdx); > bool DefIsLoad = false; > if (!ReMatDefMI || > - !isReMaterializable(li, VNI, ReMatDefMI, SpillIs, DefIsLoad)) > + !isReMaterializable(li, VNI, ReMatDefMI, DefIsLoad)) > return false; > isLoad |= DefIsLoad; > } > @@ -1737,7 +1728,6 @@ > > std::vector LiveIntervals:: > addIntervalsForSpills(const LiveInterval &li, > - SmallVectorImpl &SpillIs, > const MachineLoopInfo *loopInfo, VirtRegMap > &vrm, > float &SSWeight) { > > @@ -1841,7 +1831,7 @@ > MachineInstr *ReMatDefMI = (DefIdx == ~0u) > ? 0 : getInstructionFromIndex(DefIdx); > bool dummy; > - if (ReMatDefMI && isReMaterializable(li, VNI, ReMatDefMI, > SpillIs, dummy)) { > + if (ReMatDefMI && isReMaterializable(li, VNI, ReMatDefMI, > dummy)) { > // Remember how to remat the def of this val#. > ReMatOrigDefs[VN] = ReMatDefMI; > // Original def may be modified so we have to make a copy here. > > Modified: llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp?rev=56837&r1=56836&r2=56837&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp (original) > +++ llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp Tue Sep 30 > 05:00:30 2008 > @@ -879,9 +879,8 @@ > if (cur->weight != HUGE_VALF && cur->weight <= minWeight) { > DOUT << "\t\t\tspilling(c): " << *cur << '\n'; > float SSWeight; > - SmallVector spillIs; > std::vector added = > - li_->addIntervalsForSpills(*cur, spillIs, loopInfo, *vrm_, > SSWeight); > + li_->addIntervalsForSpills(*cur, loopInfo, *vrm_, SSWeight); > addStackInterval(cur, ls_, li_, SSWeight, *vrm_); > if (added.empty()) > return; // Early exit if all spills were folded. > @@ -932,7 +931,7 @@ > earliestStart = std::min(earliestStart, sli->beginNumber()); > float SSWeight; > std::vector newIs = > - li_->addIntervalsForSpills(*sli, spillIs, loopInfo, *vrm_, > SSWeight); > + li_->addIntervalsForSpills(*sli, loopInfo, *vrm_, SSWeight); > addStackInterval(sli, ls_, li_, SSWeight, *vrm_); > std::copy(newIs.begin(), newIs.end(), std::back_inserter(added)); > spilled.insert(sli->reg); > > Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=56837&r1=56836&r2=56837&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original) > +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Tue Sep 30 > 05:00:30 2008 > @@ -2361,8 +2361,7 @@ > LI.weight = HUGE_VALF; > else { > bool isLoad = false; > - SmallVector SpillIs; > - if (li_->isReMaterializable(LI, SpillIs, isLoad)) { > + if (li_->isReMaterializable(LI, isLoad)) { > // If all of the definitions of the interval are re- > materializable, > // it is a preferred candidate for spilling. If non of the > defs are > // loads, then it's potentially very cheap to re- > materialize. > > Modified: llvm/trunk/test/CodeGen/X86/2008-09-29-ReMatBug.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2008-09-29-ReMatBug.ll?rev=56837&r1=56836&r2=56837&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/CodeGen/X86/2008-09-29-ReMatBug.ll (original) > +++ llvm/trunk/test/CodeGen/X86/2008-09-29-ReMatBug.ll Tue Sep 30 > 05:00:30 2008 > @@ -1,85 +0,0 @@ > -; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin -relocation- > model=pic -disable-fp-elim > - > - %struct..0objc_selector = type opaque > - %struct.NSString = type opaque > - %struct.XCStringList = type { i32, %struct._XCStringListNode* } > - %struct._XCStringListNode = type { [3 x i8], [0 x i8], i8 } > - %struct.__builtin_CFString = type { i32*, i32, i8*, i32 } > -internal constant %struct.__builtin_CFString { i32* getelementptr > ([0 x i32]* @__CFConstantStringClassReference, i32 0, i32 0), i32 > 1992, i8* getelementptr ([3 x i8]* @"\01LC", i32 0, i32 0), i32 > 2 } ; <%struct.__builtin_CFString*>:0 [#uses=1] > - at __CFConstantStringClassReference = external global [0 x i32] ; > <[0 x i32]*> [#uses=1] > -@"\01LC" = internal constant [3 x i8] c"NO\00" ; <[3 x i8]*> > [#uses=1] > -@"\01LC1" = internal constant [1 x i8] zeroinitializer ; <[1 x > i8]*> [#uses=1] > - at llvm.used1 = appending global [1 x i8*] [ i8* bitcast > (%struct.NSString* (%struct.XCStringList*, %struct.. > 0objc_selector*)* @"-[XCStringList stringRepresentation]" to i8*) ], > section "llvm.metadata" ; <[1 x i8*]*> [#uses=0] > - > -define %struct.NSString* @"-[XCStringList > stringRepresentation]"(%struct.XCStringList* %self, %struct.. > 0objc_selector* %_cmd) nounwind { > -entry: > - %0 = load i32* null, align 4 ; [#uses=1] > - %1 = and i32 %0, 16777215 ; [#uses=1] > - %2 = icmp eq i32 %1, 0 ; [#uses=1] > - br i1 %2, label %bb44, label %bb4 > - > -bb4: ; preds = %entry > - %3 = load %struct._XCStringListNode** null, align 4 ; < > %struct._XCStringListNode*> [#uses=2] > - %4 = icmp eq %struct._XCStringListNode* %3, null ; [#uses=1] > - %5 = bitcast %struct._XCStringListNode* %3 to i32* ; > [#uses=1] > - br label %bb37.outer > - > -bb6: ; preds = %bb37 > - br label %bb19 > - > -bb19: ; preds = %bb37, %bb6 > - %.rle = phi i32 [ 0, %bb6 ], [ %10, %bb37 ] ; [#uses=1] > - %bufptr.0.lcssa = phi i8* [ null, %bb6 ], [ null, %bb37 ] ; > [#uses=2] > - %6 = and i32 %.rle, 16777215 ; [#uses=1] > - %7 = icmp eq i32 %6, 0 ; [#uses=1] > - br i1 %7, label %bb25.split, label %bb37 > - > -bb25.split: ; preds = %bb19 > - call void @foo(i8* getelementptr ([1 x i8]* @"\01LC1", i32 0, i32 > 0)) nounwind nounwind > - br label %bb35.outer > - > -bb34: ; preds = %bb35, %bb35, %bb35, %bb35 > - %8 = getelementptr i8* %bufptr.0.lcssa, i32 %totalLength.0.ph ; > [#uses=1] > - store i8 92, i8* %8, align 1 > - br label %bb35.outer > - > -bb35.outer: ; preds = %bb34, %bb25.split > - %totalLength.0.ph = add i32 0, %totalLength.1.ph ; [#uses=2] > - br label %bb35 > - > -bb35: ; preds = %bb35, %bb35.outer > - %9 = load i8* null, align 1 ; [#uses=1] > - switch i8 %9, label %bb35 [ > - i8 0, label %bb37.outer > - i8 32, label %bb34 > - i8 92, label %bb34 > - i8 34, label %bb34 > - i8 39, label %bb34 > - ] > - > -bb37.outer: ; preds = %bb35, %bb4 > - %totalLength.1.ph = phi i32 [ 0, %bb4 ], [ %totalLength.0.ph, > %bb35 ] ; [#uses=1] > - %bufptr.1.ph = phi i8* [ null, %bb4 ], [ %bufptr.0.lcssa, > %bb35 ] ; [#uses=2] > - br i1 %4, label %bb39.split, label %bb37 > - > -bb37: ; preds = %bb37.outer, %bb19 > - %10 = load i32* %5, align 4 ; [#uses=1] > - br i1 false, label %bb6, label %bb19 > - > -bb39.split: ; preds = %bb37.outer > - %11 = bitcast i8* null to %struct.NSString* ; <%struct.NSString*> > [#uses=2] > - %12 = icmp eq i8* null, %bufptr.1.ph ; [#uses=1] > - br i1 %12, label %bb44, label %bb42 > - > -bb42: ; preds = %bb39.split > - call void @quux(i8* %bufptr.1.ph) nounwind nounwind > - ret %struct.NSString* %11 > - > -bb44: ; preds = %bb39.split, %entry > - %.0 = phi %struct.NSString* [ bitcast (%struct.__builtin_CFString* > @0 to %struct.NSString*), %entry ], [ %11, %bb39.split ] ; < > %struct.NSString*> [#uses=1] > - ret %struct.NSString* %.0 > -} > - > -declare void @foo(i8*) > - > -declare void @quux(i8*) > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From baldrick at free.fr Tue Sep 30 10:18:32 2008 From: baldrick at free.fr (Duncan Sands) Date: Tue, 30 Sep 2008 15:18:32 -0000 Subject: [llvm-commits] [llvm] r56844 - /llvm/trunk/docs/FAQ.html Message-ID: <200809301518.m8UFIWaR025033@zion.cs.uiuc.edu> Author: baldrick Date: Tue Sep 30 10:18:29 2008 New Revision: 56844 URL: http://llvm.org/viewvc/llvm-project?rev=56844&view=rev Log: Stacker is dead. Modified: llvm/trunk/docs/FAQ.html Modified: llvm/trunk/docs/FAQ.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/FAQ.html?rev=56844&r1=56843&r2=56844&view=diff ============================================================================== --- llvm/trunk/docs/FAQ.html (original) +++ llvm/trunk/docs/FAQ.html Tue Sep 30 10:18:29 2008 @@ -411,8 +411,6 @@

There is an incomplete version of a Java front end available in the java module. There is no documentation on this yet so you'll need to download the code, compile it, and try it.

-

In the stacker module is a compiler and runtime - library for the Stacker language, a "toy" language loosely based on Forth.

The PyPy developers are working on integrating LLVM into the PyPy backend so that PyPy language can translate to LLVM.

From ggreif at gmail.com Tue Sep 30 10:25:38 2008 From: ggreif at gmail.com (Gabor Greif) Date: Tue, 30 Sep 2008 15:25:38 -0000 Subject: [llvm-commits] [llvm] r56845 - /llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp Message-ID: <200809301525.m8UFPcWF025585@zion.cs.uiuc.edu> Author: ggreif Date: Tue Sep 30 10:25:35 2008 New Revision: 56845 URL: http://llvm.org/viewvc/llvm-project?rev=56845&view=rev Log: fix a scenario where waymarks could be placed, but haven't been Modified: llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp Modified: llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp?rev=56845&r1=56844&r2=56845&view=diff ============================================================================== --- llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp (original) +++ llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp Tue Sep 30 10:25:35 2008 @@ -122,11 +122,16 @@ // try to pick up exactly requiredSteps digits int digits = requiredSteps; Acc = 0; + Use* Tagspace = 0; + Use* OrigTagspace(Next); while (1) { - if (!digits) + if (!digits) { + if (Tagspace && Cushion <= -requiredSteps) { + repaintByCopying(Tagspace, OrigTagspace); + } return reinterpret_cast(Acc << spareBits); - + } Next = Next->Next; __builtin_prefetch(Next); --Cushion; @@ -146,6 +151,10 @@ goto efficiency; } default: + if (digits == requiredSteps /*!Tagspace*/) { + Tagspace = OrigTagspace; + OrigTagspace = (Use*)stripTag(U->Prev); + } --digits; Acc = (Acc << 1) | (Tag & 1); if (Cushion <= 0) { From alenhar2 at cs.uiuc.edu Tue Sep 30 10:26:46 2008 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Tue, 30 Sep 2008 15:26:46 -0000 Subject: [llvm-commits] [poolalloc] r56846 - /poolalloc/trunk/Regressions/2008-09-29.calls.c Message-ID: <200809301526.m8UFQkEF025633@zion.cs.uiuc.edu> Author: alenhar2 Date: Tue Sep 30 10:26:46 2008 New Revision: 56846 URL: http://llvm.org/viewvc/llvm-project?rev=56846&view=rev Log: add a test case Added: poolalloc/trunk/Regressions/2008-09-29.calls.c Added: poolalloc/trunk/Regressions/2008-09-29.calls.c URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/Regressions/2008-09-29.calls.c?rev=56846&view=auto ============================================================================== --- poolalloc/trunk/Regressions/2008-09-29.calls.c (added) +++ poolalloc/trunk/Regressions/2008-09-29.calls.c Tue Sep 30 10:26:46 2008 @@ -0,0 +1,28 @@ +#include + +struct OP { + void (*func)(struct OP*); +}; + +void bar(struct OP *op); + +void foo(struct OP *op) { + printf("Foo\n"); + op->func = bar; +} + +void bar(struct OP *op) { + printf("Bar\n"); + op->func = foo; +} + +int main(int argc, char **argv) { + int i; + struct OP op; + op.func = foo; + for(i = 0; i < 10; ++i) { + op.func(&op); + } + return 0; +} + From alenhar2 at cs.uiuc.edu Tue Sep 30 10:28:27 2008 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Tue, 30 Sep 2008 15:28:27 -0000 Subject: [llvm-commits] [poolalloc] r56847 - in /poolalloc/trunk: include/dsa/DSGraph.h include/dsa/DSNode.h include/dsa/DataStructure.h lib/DSA/BottomUpClosure.cpp lib/DSA/DataStructure.cpp lib/DSA/Local.cpp lib/DSA/StdLibPass.cpp lib/DSA/TopDownClosure.cpp Message-ID: <200809301528.m8UFSSCQ025693@zion.cs.uiuc.edu> Author: alenhar2 Date: Tue Sep 30 10:28:27 2008 New Revision: 56847 URL: http://llvm.org/viewvc/llvm-project?rev=56847&view=rev Log: fix recent bug on mailing list Modified: poolalloc/trunk/include/dsa/DSGraph.h poolalloc/trunk/include/dsa/DSNode.h poolalloc/trunk/include/dsa/DataStructure.h poolalloc/trunk/lib/DSA/BottomUpClosure.cpp poolalloc/trunk/lib/DSA/DataStructure.cpp poolalloc/trunk/lib/DSA/Local.cpp poolalloc/trunk/lib/DSA/StdLibPass.cpp poolalloc/trunk/lib/DSA/TopDownClosure.cpp Modified: poolalloc/trunk/include/dsa/DSGraph.h URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/dsa/DSGraph.h?rev=56847&r1=56846&r2=56847&view=diff ============================================================================== --- poolalloc/trunk/include/dsa/DSGraph.h (original) +++ poolalloc/trunk/include/dsa/DSGraph.h Tue Sep 30 10:28:27 2008 @@ -305,6 +305,10 @@ return AuxFunctionCalls; } + /// removeFunction - Specify that all call sites to the function have been + /// fully specified by a pass such as StdLibPass. + void removeFunctionCalls(Function& F); + // Function Call iteration typedef std::list::const_iterator fc_iterator; fc_iterator fc_begin() const { return FunctionCalls.begin(); } Modified: poolalloc/trunk/include/dsa/DSNode.h URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/dsa/DSNode.h?rev=56847&r1=56846&r2=56847&view=diff ============================================================================== --- poolalloc/trunk/include/dsa/DSNode.h (original) +++ poolalloc/trunk/include/dsa/DSNode.h Tue Sep 30 10:28:27 2008 @@ -462,7 +462,7 @@ } inline void DSNodeHandle::setTo(DSNode *n, unsigned NewOffset) const { - assert(!n || !n->isForwarding() && "Cannot set node to a forwarded node!"); + assert((!n || !n->isForwarding()) && "Cannot set node to a forwarded node!"); if (N) getNode()->NumReferrers--; N = n; Offset = NewOffset; Modified: poolalloc/trunk/include/dsa/DataStructure.h URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/dsa/DataStructure.h?rev=56847&r1=56846&r2=56847&view=diff ============================================================================== --- poolalloc/trunk/include/dsa/DataStructure.h (original) +++ poolalloc/trunk/include/dsa/DataStructure.h Tue Sep 30 10:28:27 2008 @@ -189,8 +189,6 @@ virtual bool runOnModule(Module &M); - DSGraph &CreateGraphForExternalFunction(const Function &F); - /// deleteValue/copyValue - Interfaces to update the DSGraphs in the program. /// These correspond to the interfaces defined in the AliasAnalysis class. void deleteValue(Value *V); Modified: poolalloc/trunk/lib/DSA/BottomUpClosure.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/BottomUpClosure.cpp?rev=56847&r1=56846&r2=56847&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/BottomUpClosure.cpp (original) +++ poolalloc/trunk/lib/DSA/BottomUpClosure.cpp Tue Sep 30 10:28:27 2008 @@ -121,10 +121,19 @@ static void GetAllCallees(const DSCallSite &CS, std::vector &Callees) { if (CS.isDirectCall()) { - Callees.push_back(CS.getCalleeFunc()); + if (!CS.getCalleeFunc()->isDeclaration()) + Callees.push_back(CS.getCalleeFunc()); } else if (!CS.getCalleeNode()->isIncompleteNode()) { // Get all callees. + unsigned OldSize = Callees.size(); CS.getCalleeNode()->addFullFunctionList(Callees); + + // If any of the callees are unresolvable, remove the whole batch! + for (unsigned i = OldSize, e = Callees.size(); i != e; ++i) + if (Callees[i]->isDeclaration()) { + Callees.erase(Callees.begin()+OldSize, Callees.end()); + return; + } } } @@ -145,6 +154,16 @@ ValMap[F] = Min; Stack.push_back(F); + // FIXME! This test should be generalized to be any function that we have + // already processed, in the case when there isn't a main or there are + // unreachable functions! + if (F->isDeclaration()) { // sprintf, fprintf, sscanf, etc... + // No callees! + Stack.pop_back(); + ValMap[F] = ~0; + return Min; + } + DSGraph &Graph = getOrCreateGraph(F); // Find all callee functions. @@ -269,31 +288,6 @@ GlobalsGraph = 0; } -DSGraph &BUDataStructures::CreateGraphForExternalFunction(const Function &Fn) { - Function *F = const_cast(&Fn); - DSGraph *DSG = new DSGraph(GlobalECs, GlobalsGraph->getTargetData()); - DSInfo[F] = DSG; - DSG->setGlobalsGraph(GlobalsGraph); - DSG->setPrintAuxCalls(); - - // Add function to the graph. - DSG->getReturnNodes().insert(std::make_pair(F, DSNodeHandle())); - - if (F->getName() == "free") { // Taking the address of free. - - // Free should take a single pointer argument, mark it as heap memory. - DSNodeHandle N(new DSNode(0, DSG)); - N.getNode()->setHeapMarker(); - DSG->getNodeForValue(F->arg_begin()).mergeWith(N); - - } else { - cerr << "Unrecognized external function: " << F->getName() << "\n"; - abort(); - } - - return *DSG; -} - void BUDataStructures::calculateGraph(DSGraph &Graph) { // If this graph contains the main function, clone the globals graph into this // graph before we inline callees and other fun stuff. Modified: poolalloc/trunk/lib/DSA/DataStructure.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/DataStructure.cpp?rev=56847&r1=56846&r2=56847&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/DataStructure.cpp (original) +++ poolalloc/trunk/lib/DSA/DataStructure.cpp Tue Sep 30 10:28:27 2008 @@ -186,8 +186,8 @@ void DSNode::assertOK() const { assert((Ty != Type::VoidTy || - Ty == Type::VoidTy && (Size == 0 || - (NodeType & DSNode::ArrayNode))) && + (Ty == Type::VoidTy && (Size == 0 || + (NodeType & DSNode::ArrayNode)))) && "Node not OK!"); assert(ParentGraph && "Node has no parent?"); @@ -756,8 +756,8 @@ // Check to see if we have a pointer & integer mismatch going on here, // loading a pointer as a long, for example. // - if (SubType->isInteger() && isa(NewTy) || - NewTy->isInteger() && isa(SubType)) + if ((SubType->isInteger() && isa(NewTy)) || + (NewTy->isInteger() && isa(SubType))) return false; } else if (NewTySize > SubTypeSize && NewTySize <= PadSize) { // We are accessing the field, plus some structure padding. Ignore the @@ -1490,6 +1490,22 @@ } } +void DSGraph::removeFunctionCalls(Function& F) { + for (std::list::iterator I = FunctionCalls.begin(), + E = FunctionCalls.end(); I != E; ++I) + if (I->isDirectCall() && &I->getCaller() == &F) { + FunctionCalls.erase(I); + break; + } + + for (std::list::iterator I = AuxFunctionCalls.begin(), + E = AuxFunctionCalls.end(); I != E; ++I) + if (I->isDirectCall() && &I->getCaller() == &F) { + AuxFunctionCalls.erase(I); + break; + } +} + /// addObjectToGraph - This method can be used to add global, stack, and heap /// objects to the graph. This can be used when updating DSGraphs due to the /// introduction of new temporary objects. The new object is not pointed to @@ -1891,11 +1907,12 @@ // Calculate the arguments vector... for (CallSite::arg_iterator I = CS.arg_begin(), E = CS.arg_end(); I != E; ++I) - if (isa((*I)->getType())) + if (isa((*I)->getType())) { if (isa(*I)) Args.push_back(DSNodeHandle()); else Args.push_back(getNodeForValue(*I)); + } // Add a new function call entry... if (Function *F = CS.getCalledFunction()) @@ -2730,7 +2747,7 @@ //Clone or Steal the Source Graph DSGraph &BaseGraph = GraphSource->getDSGraph(*F); if (Clone) { - G = new DSGraph(BaseGraph, GlobalECs, DSGraph::DontCloneAuxCallNodes); + G = new DSGraph(BaseGraph, GlobalECs); } else { G = new DSGraph(GlobalECs, GraphSource->getTargetData()); G->spliceFrom(BaseGraph); Modified: poolalloc/trunk/lib/DSA/Local.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/Local.cpp?rev=56847&r1=56846&r2=56847&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/Local.cpp (original) +++ poolalloc/trunk/lib/DSA/Local.cpp Tue Sep 30 10:28:27 2008 @@ -137,37 +137,27 @@ if (isa(I->getType())) { DSNode * Node = getValueDest(*I).getNode(); - if (!f.hasInternalLinkage() || f.isDeclaration()) { + if (!f.hasInternalLinkage()) Node->setExternalMarker(); - //pecimistic assumptions on externals - if (f.isDeclaration()) - Node->setReadMarker()->setModifiedMarker(); - } + } } // Create an entry for the return, which tracks which functions are in the graph g.getOrCreateReturnNodeFor(f); - if (!f.isDeclaration()) { - visit(f); // Single pass over the function + visit(f); // Single pass over the function - // If there are any constant globals referenced in this function, merge their - // initializers into the local graph from the globals graph. - if (g.getScalarMap().global_begin() != g.getScalarMap().global_end()) { - ReachabilityCloner RC(g, *g.getGlobalsGraph(), 0); - - for (DSScalarMap::global_iterator I = g.getScalarMap().global_begin(); - I != g.getScalarMap().global_end(); ++I) - if (GlobalVariable *GV = dyn_cast(*I)) - if (!GV->isDeclaration() && GV->isConstant()) - RC.merge(g.getNodeForValue(GV), g.getGlobalsGraph()->getNodeForValue(GV)); - } - } else { - DSNodeHandle& RNH = g.getOrCreateReturnNodeFor(f); - //Make sure return values from externals are marked as such - if (isa(f.getReturnType())) - RNH.mergeWith(createNode()->setReadMarker()->setModifiedMarker()->setExternalMarker()); + // If there are any constant globals referenced in this function, merge their + // initializers into the local graph from the globals graph. + if (g.getScalarMap().global_begin() != g.getScalarMap().global_end()) { + ReachabilityCloner RC(g, *g.getGlobalsGraph(), 0); + + for (DSScalarMap::global_iterator I = g.getScalarMap().global_begin(); + I != g.getScalarMap().global_end(); ++I) + if (GlobalVariable *GV = dyn_cast(*I)) + if (!GV->isDeclaration() && GV->isConstant()) + RC.merge(g.getNodeForValue(GV), g.getGlobalsGraph()->getNodeForValue(GV)); } g.markIncompleteNodes(DSGraph::MarkFormalArgs); @@ -762,11 +752,12 @@ formGlobalECs(); // Calculate all of the graphs... - for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) { - DSGraph* G = new DSGraph(GlobalECs, getTargetData(), GlobalsGraph); - GraphBuilder GGB(*I, *G); - DSInfo.insert(std::make_pair(I, G)); - } + for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) + if (!I->isDeclaration()) { + DSGraph* G = new DSGraph(GlobalECs, getTargetData(), GlobalsGraph); + GraphBuilder GGB(*I, *G); + DSInfo.insert(std::make_pair(I, G)); + } GlobalsGraph->removeTriviallyDeadNodes(); GlobalsGraph->markIncompleteNodes(DSGraph::MarkFormalArgs); Modified: poolalloc/trunk/lib/DSA/StdLibPass.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/StdLibPass.cpp?rev=56847&r1=56846&r2=56847&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/StdLibPass.cpp (original) +++ poolalloc/trunk/lib/DSA/StdLibPass.cpp Tue Sep 30 10:28:27 2008 @@ -31,6 +31,69 @@ char StdLibDataStructures::ID; +struct libAction { + bool ret_read, ret_write, ret_heap; + bool args_read, args_write, args_heap; + bool mergeAllArgs; + bool mergeWithRet; + bool collapse; +}; + +const struct { + const char* name; + libAction action; +} recFuncs[] = { + {"calloc", {false, true, true, false, false, false, false, false, false}}, + {"malloc", {false, true, true, false, false, false, false, false, false}}, + {"valloc", {false, true, true, false, false, false, false, false, false}}, + {"memalign", {false, true, true, false, false, false, false, false, false}}, + {"strdup", {false, true, true, false, false, false, false, false, true}}, + {"wcsdup", {false, true, true, false, false, false, false, false, true}}, + {"free", {false, false, false, false, true, true, false, false, false}}, + {"realloc", {false, true, true, false, true, true, false, true, true}}, + {"atoi", {false, false, false, true, false, false, false, false, false}}, + {"atof", {false, false, false, true, false, false, false, false, false}}, + {"atol", {false, false, false, true, false, false, false, false, false}}, + {"atoll", {false, false, false, true, false, false, false, false, false}}, + {"remove", {false, false, false, true, false, false, false, false, false}}, + {"unlink", {false, false, false, true, false, false, false, false, false}}, + {"rename", {false, false, false, true, false, false, false, false, false}}, + {"memcmp", {false, false, false, true, false, false, false, false, false}}, + {"strcmp", {false, false, false, true, false, false, false, false, false}}, + {"strncmp", {false, false, false, true, false, false, false, false, false}}, + {"execl", {false, false, false, true, false, false, false, false, false}}, + {"execlp", {false, false, false, true, false, false, false, false, false}}, + {"execle", {false, false, false, true, false, false, false, false, false}}, + {"execv", {false, false, false, true, false, false, false, false, false}}, + {"execvp", {false, false, false, true, false, false, false, false, false}}, + {"chmod", {false, false, false, true, false, false, false, false, false}}, + {"puts", {false, false, false, true, false, false, false, false, false}}, + {"write", {false, false, false, true, false, false, false, false, false}}, + {"open", {false, false, false, true, false, false, false, false, false}}, + {"create", {false, false, false, true, false, false, false, false, false}}, + {"truncate", {false, false, false, true, false, false, false, false, false}}, + {"chdir", {false, false, false, true, false, false, false, false, false}}, + {"mkdir", {false, false, false, true, false, false, false, false, false}}, + {"rmdir", {false, false, false, true, false, false, false, false, false}}, + {"strlen", {false, false, false, true, false, false, false, false, false}}, + {"read", {false, false, false, false, true, false, false, false, false}}, + {"pipe", {false, false, false, false, true, false, false, false, false}}, + {"wait", {false, false, false, false, true, false, false, false, false}}, + {"time", {false, false, false, false, true, false, false, false, false}}, + {"getrusage",{false, false, false, false, true, false, false, false, false}}, + {"memchr", { true, false, false, true, false, false, false, true, true}}, + {"memrchr", { true, false, false, true, false, false, false, true, true}}, + {"rawmemchr",{ true, false, false, true, false, false, false, true, true}}, + {"memmove", {false, true, false, true, true, false, true, true, true}}, + {"bcopy", {false, false, false, true, true, false, true, false, true}}, + {"strcpy", {false, true, false, true, true, false, true, true, true}}, + {"strncpy", {false, true, false, true, true, false, true, true, true}}, + {"memccpy", {false, true, false, true, true, false, true, true, true}}, + {"wcscpy", {false, true, false, true, true, false, true, true, true}}, + {"wcsncpy", {false, true, false, true, true, false, true, true, true}}, + {"wmemccpy", {false, true, false, true, true, false, true, true, true}}, +}; + bool StdLibDataStructures::runOnModule(Module &M) { LocalDataStructures &LocalDSA = getAnalysis(); setGraphSource(&LocalDSA); @@ -41,108 +104,61 @@ GlobalsGraph = new DSGraph(LocalDSA.getGlobalsGraph(), GlobalECs); GlobalsGraph->setPrintAuxCalls(); - // Calculate all of the graphs... - for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) { - DSGraph &Graph = getOrCreateGraph(&*I); - //If this is an true external, check it out - if (I->isDeclaration() && !I->isIntrinsic() && !(I->isVarArg())) { - const std::string& Name = I->getName(); - if (Name == "calloc" || - Name == "malloc" || - Name == "valloc" || - Name == "memalign") { - Graph.getReturnNodeFor(*I).getNode()->clearNodeFlags() - ->setHeapMarker()->setModifiedMarker(); - } else if (Name == "realloc") { - if (isa(I->getReturnType())) { - Graph.getReturnNodeFor(*I).getNode()->clearNodeFlags() - ->setHeapMarker()->setModifiedMarker(); - Graph.getNodeForValue(I->arg_begin()).getNode()->clearNodeFlags() - ->mergeWith(Graph.getReturnNodeFor(*I), 0); - } - } else if (Name == "strdup") { - Graph.getReturnNodeFor(*I).getNode()->clearNodeFlags() - ->setHeapMarker()->setModifiedMarker(); - } else if (Name == "free") { - Graph.getNodeForValue(&*I->arg_begin()).getNode()->clearNodeFlags() - ->setHeapMarker()->setModifiedMarker(); - } else if (Name == "atoi" || Name == "atof" || - Name == "atol" || Name == "atoll" || - Name == "remove" || Name == "unlink" || - Name == "rename" || Name == "memcmp" || - Name == "strcmp" || Name == "strncmp" || - Name == "execl" || Name == "execlp" || - Name == "execle" || Name == "execv" || - Name == "execvp" || Name == "chmod" || - Name == "puts" || Name == "write" || - Name == "open" || Name == "create" || - Name == "truncate" || Name == "chdir" || - Name == "mkdir" || Name == "rmdir" || - Name == "strlen") { - for (Function::arg_iterator AI = I->arg_begin(), E = I->arg_end(); - AI != E; ++AI) { - if (isa(AI->getType())) - Graph.getNodeForValue(&*AI).getNode()->clearNodeFlags() - ->setReadMarker(); - } - } else if (Name == "read" || Name == "pipe" || - Name == "wait" || Name == "time" || - Name == "getrusage") { - for (Function::arg_iterator AI = I->arg_begin(), E = I->arg_end(); - AI != E; ++AI) { - if (isa(AI->getType())) - Graph.getNodeForValue(&*AI).getNode()->clearNodeFlags() - ->setModifiedMarker(); - } - } else if (Name == "memchr" || Name == "memrchr") { - DSNodeHandle RetNH = Graph.getReturnNodeFor(*I); - DSNodeHandle Result = Graph.getNodeForValue(&*I->arg_begin()); - RetNH.mergeWith(Result); - RetNH.getNode()->clearNodeFlags()->setReadMarker(); - } else if (Name == "memmove") { - // Merge the first & second arguments, and mark the memory read and - // modified. - DSNodeHandle& RetNH = Graph.getNodeForValue(&*I->arg_begin()); - RetNH.mergeWith(Graph.getNodeForValue(&*(++(I->arg_begin())))); - RetNH.getNode()->clearNodeFlags()->setModifiedMarker()->setReadMarker(); - } else if (Name == "stat" || Name == "fstat" || Name == "lstat") { - // These functions read their first operand if its a pointer. - Function::arg_iterator AI = I->arg_begin(); - if (isa(AI->getType())) - Graph.getNodeForValue(&*AI).getNode() - ->clearNodeFlags()->setReadMarker(); - // Then they write into the stat buffer. - DSNodeHandle StatBuf = Graph.getNodeForValue(&*++AI); - DSNode *N = StatBuf.getNode(); - N->setModifiedMarker(); - const Type *StatTy = I->getFunctionType()->getParamType(1); - if (const PointerType *PTy = dyn_cast(StatTy)) - N->mergeTypeInfo(PTy->getElementType(), StatBuf.getOffset()); - } else if (Name == "strtod" || Name == "strtof" || Name == "strtold") { - // These functions read the first pointer - DSNodeHandle& Str = Graph.getNodeForValue(&*I->arg_begin()); - Str.getNode()->clearNodeFlags()->setReadMarker(); - // If the second parameter is passed, it will point to the first - // argument node. - DSNodeHandle& EndNH = Graph.getNodeForValue(&*(++(I->arg_begin()))); - EndNH.getNode()->clearNodeFlags()->setModifiedMarker(); - EndNH.getNode()->mergeTypeInfo(PointerType::getUnqual(Type::Int8Ty), - EndNH.getOffset(), false); - DSNodeHandle &Link = EndNH.getLink(0); - Link.mergeWith(Str); - } else { - //ignore pointer free functions - bool hasPtr = isa(I->getReturnType()); - for (Function::const_arg_iterator AI = I->arg_begin(), AE = I->arg_end(); - AI != AE && !hasPtr; ++AI) - if (isa(AI->getType())) - hasPtr = true; - if (hasPtr) - std::cerr << "Unhandled External: " << Name << "\n"; - } - } - } - + //Clone Module + for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) + if (!I->isDeclaration()) + getOrCreateGraph(&*I); + + for (int x = 0; recFuncs[x].name; ++x) + if (Function* F = M.getFunction(recFuncs[x].name)) + if (F->isDeclaration()) + for (Value::use_iterator ii = F->use_begin(), ee = F->use_end(); + ii != ee; ++ii) + if (CallInst* CI = dyn_cast(ii)) + if (CI->getOperand(0) == F) { + DSGraph& Graph = getDSGraph(*CI->getParent()->getParent()); + if (recFuncs[x].action.ret_read) + Graph.getNodeForValue(CI).getNode()->setReadMarker(); + if (recFuncs[x].action.ret_write) + Graph.getNodeForValue(CI).getNode()->setModifiedMarker(); + if (recFuncs[x].action.ret_heap) + Graph.getNodeForValue(CI).getNode()->setHeapMarker(); + + if (recFuncs[x].action.args_read) + for (unsigned y = 1; y < CI->getNumOperands(); ++y) + if (isa(CI->getOperand(y)->getType())) + Graph.getNodeForValue(CI->getOperand(y)).getNode()->setReadMarker(); + if (recFuncs[x].action.args_write) + for (unsigned y = 1; y < CI->getNumOperands(); ++y) + if (isa(CI->getOperand(y)->getType())) + Graph.getNodeForValue(CI->getOperand(y)).getNode()->setModifiedMarker(); + if (recFuncs[x].action.args_heap) + for (unsigned y = 1; y < CI->getNumOperands(); ++y) + if (isa(CI->getOperand(y)->getType())) + Graph.getNodeForValue(CI->getOperand(y)).getNode()->setHeapMarker(); + + std::vector toMerge; + if (recFuncs[x].action.mergeWithRet) + toMerge.push_back(Graph.getNodeForValue(CI)); + if (recFuncs[x].action.mergeAllArgs || recFuncs[x].action.mergeWithRet) + for (unsigned y = 1; y < CI->getNumOperands(); ++y) + if (isa(CI->getOperand(y)->getType())) + toMerge.push_back(Graph.getNodeForValue(CI->getOperand(y))); + for (unsigned y = 1; y < toMerge.size(); ++y) + toMerge[0].mergeWith(toMerge[y]); + + if (recFuncs[x].action.collapse) { + Graph.getNodeForValue(CI).getNode()->foldNodeCompletely(); + for (unsigned y = 1; y < CI->getNumOperands(); ++y) + if (isa(CI->getOperand(y)->getType())) + Graph.getNodeForValue(CI->getOperand(y)).getNode()->foldNodeCompletely(); + } + + //delete the call + DOUT << "Removing " << F->getName() << " from " << CI->getParent()->getParent()->getName() << "\n"; + Graph.removeFunctionCalls(*F); + } + return false; } Modified: poolalloc/trunk/lib/DSA/TopDownClosure.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/TopDownClosure.cpp?rev=56847&r1=56846&r2=56847&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/TopDownClosure.cpp (original) +++ poolalloc/trunk/lib/DSA/TopDownClosure.cpp Tue Sep 30 10:28:27 2008 @@ -95,7 +95,7 @@ // Functions without internal linkage also have unknown incoming arguments! for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) - if (!I->hasInternalLinkage()) + if (!I->isDeclaration() && !I->hasInternalLinkage()) ArgsRemainIncomplete.insert(I); // We want to traverse the call graph in reverse post-order. To do this, we @@ -108,7 +108,8 @@ // Visit each of the graphs in reverse post-order now! for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) - getOrCreateGraph(*I); + if (!I->isDeclaration(*I) + getOrCreateGraph(*I); return false; } #endif @@ -153,6 +154,7 @@ void TDDataStructures::ComputePostOrder(Function &F,hash_set &Visited, std::vector &PostOrder) { + if (F.isDeclaration()) return; DSGraph &G = getOrCreateGraph(&F); if (Visited.count(&G)) return; Visited.insert(&G); @@ -297,7 +299,8 @@ // Handle direct calls efficiently. if (CI->isDirectCall()) { - if (!DSG.getReturnNodes().count(CI->getCalleeFunc())) + if (!CI->getCalleeFunc()->isDeclaration() && + !DSG.getReturnNodes().count(CI->getCalleeFunc())) CallerEdges[&getOrCreateGraph(CI->getCalleeFunc())] .push_back(CallerCallEdge(&DSG, &*CI, CI->getCalleeFunc())); continue; @@ -309,7 +312,7 @@ BUInfo->callee_begin(CallI), IPE = BUInfo->callee_end(CallI); // Skip over all calls to this graph (SCC calls). - while (IPI != IPE && &getOrCreateGraph(IPI->second) == &DSG) + while (IPI != IPE && &getDSGraph(*IPI->second) == &DSG) ++IPI; // All SCC calls? @@ -319,14 +322,15 @@ ++IPI; // Skip over more SCC calls. - while (IPI != IPE && &getOrCreateGraph(IPI->second) == &DSG) + while (IPI != IPE && &getDSGraph(*IPI->second) == &DSG) ++IPI; // If there is exactly one callee from this call site, remember the edge in // CallerEdges. if (IPI == IPE) { - CallerEdges[&getOrCreateGraph(FirstCallee)] - .push_back(CallerCallEdge(&DSG, &*CI, FirstCallee)); + if (!FirstCallee->isDeclaration()) + CallerEdges[&getOrCreateGraph(FirstCallee)] + .push_back(CallerCallEdge(&DSG, &*CI, FirstCallee)); continue; } @@ -339,7 +343,8 @@ for (BUDataStructures::ActualCalleesTy::const_iterator I = BUInfo->callee_begin(CallI), E = BUInfo->callee_end(CallI); I != E; ++I) - Callees.push_back(I->second); + if (!I->second->isDeclaration()) + Callees.push_back(I->second); std::sort(Callees.begin(), Callees.end()); std::map, DSGraph*>::iterator IndCallRecI = @@ -370,7 +375,7 @@ // exactly once. DSCallSite *NCS = &IndCallGraph->getFunctionCalls().front(); for (unsigned i = 0, e = Callees.size(); i != e; ++i) { - DSGraph& CalleeGraph = getOrCreateGraph(Callees[i]); + DSGraph& CalleeGraph = getDSGraph(*Callees[i]); if (&CalleeGraph != &DSG) CallerEdges[&CalleeGraph].push_back(CallerCallEdge(IndCallGraph, NCS, Callees[i])); From evan.cheng at apple.com Tue Sep 30 10:44:17 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 30 Sep 2008 15:44:17 -0000 Subject: [llvm-commits] [llvm] r56848 - in /llvm/trunk: include/llvm/CodeGen/LiveIntervalAnalysis.h lib/CodeGen/LiveIntervalAnalysis.cpp lib/CodeGen/RegAllocLinearScan.cpp lib/CodeGen/SimpleRegisterCoalescing.cpp test/CodeGen/X86/2008-09-29-ReMatBug.ll Message-ID: <200809301544.m8UFiH78026283@zion.cs.uiuc.edu> Author: evancheng Date: Tue Sep 30 10:44:16 2008 New Revision: 56848 URL: http://llvm.org/viewvc/llvm-project?rev=56848&view=rev Log: Re-apply 56835 along with header file changes. Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp llvm/trunk/test/CodeGen/X86/2008-09-29-ReMatBug.ll Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h?rev=56848&r1=56847&r2=56848&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h (original) +++ llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h Tue Sep 30 10:44:16 2008 @@ -308,6 +308,7 @@ /// (if any is created) by reference. This is temporary. std::vector addIntervalsForSpills(const LiveInterval& i, + SmallVectorImpl &SpillIs, const MachineLoopInfo *loopInfo, VirtRegMap& vrm, float &SSWeight); @@ -326,7 +327,9 @@ /// isReMaterializable - Returns true if every definition of MI of every /// val# of the specified interval is re-materializable. Also returns true /// by reference if all of the defs are load instructions. - bool isReMaterializable(const LiveInterval &li, bool &isLoad); + bool isReMaterializable(const LiveInterval &li, + SmallVectorImpl &SpillIs, + bool &isLoad); /// getRepresentativeReg - Find the largest super register of the specified /// physical register. @@ -387,7 +390,9 @@ /// val# of the specified interval is re-materializable. Also returns true /// by reference if the def is a load. bool isReMaterializable(const LiveInterval &li, const VNInfo *ValNo, - MachineInstr *MI, bool &isLoad); + MachineInstr *MI, + SmallVectorImpl &SpillIs, + bool &isLoad); /// tryFoldMemoryOperand - Attempts to fold either a spill / restore from /// slot / to reg or any rematerialized load into ith operand of specified Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=56848&r1=56847&r2=56848&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Tue Sep 30 10:44:16 2008 @@ -819,6 +819,7 @@ /// val# of the specified interval is re-materializable. bool LiveIntervals::isReMaterializable(const LiveInterval &li, const VNInfo *ValNo, MachineInstr *MI, + SmallVectorImpl &SpillIs, bool &isLoad) { if (DisableReMat) return false; @@ -855,8 +856,8 @@ // If the instruction accesses memory and the memory could be non-constant, // assume the instruction is not rematerializable. - for (std::list::const_iterator I = MI->memoperands_begin(), - E = MI->memoperands_end(); I != E; ++I) { + for (std::list::const_iterator + I = MI->memoperands_begin(), E = MI->memoperands_end(); I != E; ++I){ const MachineMemOperand &MMO = *I; if (MMO.isVolatile() || MMO.isStore()) return false; @@ -924,13 +925,21 @@ if (!isValNoAvailableAt(ImpLi, MI, UseIdx)) return false; } + + // If a register operand of the re-materialized instruction is going to + // be spilled next, then it's not legal to re-materialize this instruction. + for (unsigned i = 0, e = SpillIs.size(); i != e; ++i) + if (ImpUse == SpillIs[i]->reg) + return false; } return true; } /// isReMaterializable - Returns true if every definition of MI of every /// val# of the specified interval is re-materializable. -bool LiveIntervals::isReMaterializable(const LiveInterval &li, bool &isLoad) { +bool LiveIntervals::isReMaterializable(const LiveInterval &li, + SmallVectorImpl &SpillIs, + bool &isLoad) { isLoad = false; for (LiveInterval::const_vni_iterator i = li.vni_begin(), e = li.vni_end(); i != e; ++i) { @@ -944,7 +953,7 @@ MachineInstr *ReMatDefMI = getInstructionFromIndex(DefIdx); bool DefIsLoad = false; if (!ReMatDefMI || - !isReMaterializable(li, VNI, ReMatDefMI, DefIsLoad)) + !isReMaterializable(li, VNI, ReMatDefMI, SpillIs, DefIsLoad)) return false; isLoad |= DefIsLoad; } @@ -1728,6 +1737,7 @@ std::vector LiveIntervals:: addIntervalsForSpills(const LiveInterval &li, + SmallVectorImpl &SpillIs, const MachineLoopInfo *loopInfo, VirtRegMap &vrm, float &SSWeight) { @@ -1831,7 +1841,7 @@ MachineInstr *ReMatDefMI = (DefIdx == ~0u) ? 0 : getInstructionFromIndex(DefIdx); bool dummy; - if (ReMatDefMI && isReMaterializable(li, VNI, ReMatDefMI, dummy)) { + if (ReMatDefMI && isReMaterializable(li, VNI, ReMatDefMI, SpillIs, dummy)) { // Remember how to remat the def of this val#. ReMatOrigDefs[VN] = ReMatDefMI; // Original def may be modified so we have to make a copy here. Modified: llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp?rev=56848&r1=56847&r2=56848&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp Tue Sep 30 10:44:16 2008 @@ -879,8 +879,9 @@ if (cur->weight != HUGE_VALF && cur->weight <= minWeight) { DOUT << "\t\t\tspilling(c): " << *cur << '\n'; float SSWeight; + SmallVector spillIs; std::vector added = - li_->addIntervalsForSpills(*cur, loopInfo, *vrm_, SSWeight); + li_->addIntervalsForSpills(*cur, spillIs, loopInfo, *vrm_, SSWeight); addStackInterval(cur, ls_, li_, SSWeight, *vrm_); if (added.empty()) return; // Early exit if all spills were folded. @@ -931,7 +932,7 @@ earliestStart = std::min(earliestStart, sli->beginNumber()); float SSWeight; std::vector newIs = - li_->addIntervalsForSpills(*sli, loopInfo, *vrm_, SSWeight); + li_->addIntervalsForSpills(*sli, spillIs, loopInfo, *vrm_, SSWeight); addStackInterval(sli, ls_, li_, SSWeight, *vrm_); std::copy(newIs.begin(), newIs.end(), std::back_inserter(added)); spilled.insert(sli->reg); Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=56848&r1=56847&r2=56848&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original) +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Tue Sep 30 10:44:16 2008 @@ -2361,7 +2361,8 @@ LI.weight = HUGE_VALF; else { bool isLoad = false; - if (li_->isReMaterializable(LI, isLoad)) { + SmallVector SpillIs; + if (li_->isReMaterializable(LI, SpillIs, isLoad)) { // If all of the definitions of the interval are re-materializable, // it is a preferred candidate for spilling. If non of the defs are // loads, then it's potentially very cheap to re-materialize. Modified: llvm/trunk/test/CodeGen/X86/2008-09-29-ReMatBug.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2008-09-29-ReMatBug.ll?rev=56848&r1=56847&r2=56848&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/2008-09-29-ReMatBug.ll (original) +++ llvm/trunk/test/CodeGen/X86/2008-09-29-ReMatBug.ll Tue Sep 30 10:44:16 2008 @@ -0,0 +1,85 @@ +; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin -relocation-model=pic -disable-fp-elim + + %struct..0objc_selector = type opaque + %struct.NSString = type opaque + %struct.XCStringList = type { i32, %struct._XCStringListNode* } + %struct._XCStringListNode = type { [3 x i8], [0 x i8], i8 } + %struct.__builtin_CFString = type { i32*, i32, i8*, i32 } +internal constant %struct.__builtin_CFString { i32* getelementptr ([0 x i32]* @__CFConstantStringClassReference, i32 0, i32 0), i32 1992, i8* getelementptr ([3 x i8]* @"\01LC", i32 0, i32 0), i32 2 } ; <%struct.__builtin_CFString*>:0 [#uses=1] + at __CFConstantStringClassReference = external global [0 x i32] ; <[0 x i32]*> [#uses=1] +@"\01LC" = internal constant [3 x i8] c"NO\00" ; <[3 x i8]*> [#uses=1] +@"\01LC1" = internal constant [1 x i8] zeroinitializer ; <[1 x i8]*> [#uses=1] + at llvm.used1 = appending global [1 x i8*] [ i8* bitcast (%struct.NSString* (%struct.XCStringList*, %struct..0objc_selector*)* @"-[XCStringList stringRepresentation]" to i8*) ], section "llvm.metadata" ; <[1 x i8*]*> [#uses=0] + +define %struct.NSString* @"-[XCStringList stringRepresentation]"(%struct.XCStringList* %self, %struct..0objc_selector* %_cmd) nounwind { +entry: + %0 = load i32* null, align 4 ; [#uses=1] + %1 = and i32 %0, 16777215 ; [#uses=1] + %2 = icmp eq i32 %1, 0 ; [#uses=1] + br i1 %2, label %bb44, label %bb4 + +bb4: ; preds = %entry + %3 = load %struct._XCStringListNode** null, align 4 ; <%struct._XCStringListNode*> [#uses=2] + %4 = icmp eq %struct._XCStringListNode* %3, null ; [#uses=1] + %5 = bitcast %struct._XCStringListNode* %3 to i32* ; [#uses=1] + br label %bb37.outer + +bb6: ; preds = %bb37 + br label %bb19 + +bb19: ; preds = %bb37, %bb6 + %.rle = phi i32 [ 0, %bb6 ], [ %10, %bb37 ] ; [#uses=1] + %bufptr.0.lcssa = phi i8* [ null, %bb6 ], [ null, %bb37 ] ; [#uses=2] + %6 = and i32 %.rle, 16777215 ; [#uses=1] + %7 = icmp eq i32 %6, 0 ; [#uses=1] + br i1 %7, label %bb25.split, label %bb37 + +bb25.split: ; preds = %bb19 + call void @foo(i8* getelementptr ([1 x i8]* @"\01LC1", i32 0, i32 0)) nounwind nounwind + br label %bb35.outer + +bb34: ; preds = %bb35, %bb35, %bb35, %bb35 + %8 = getelementptr i8* %bufptr.0.lcssa, i32 %totalLength.0.ph ; [#uses=1] + store i8 92, i8* %8, align 1 + br label %bb35.outer + +bb35.outer: ; preds = %bb34, %bb25.split + %totalLength.0.ph = add i32 0, %totalLength.1.ph ; [#uses=2] + br label %bb35 + +bb35: ; preds = %bb35, %bb35.outer + %9 = load i8* null, align 1 ; [#uses=1] + switch i8 %9, label %bb35 [ + i8 0, label %bb37.outer + i8 32, label %bb34 + i8 92, label %bb34 + i8 34, label %bb34 + i8 39, label %bb34 + ] + +bb37.outer: ; preds = %bb35, %bb4 + %totalLength.1.ph = phi i32 [ 0, %bb4 ], [ %totalLength.0.ph, %bb35 ] ; [#uses=1] + %bufptr.1.ph = phi i8* [ null, %bb4 ], [ %bufptr.0.lcssa, %bb35 ] ; [#uses=2] + br i1 %4, label %bb39.split, label %bb37 + +bb37: ; preds = %bb37.outer, %bb19 + %10 = load i32* %5, align 4 ; [#uses=1] + br i1 false, label %bb6, label %bb19 + +bb39.split: ; preds = %bb37.outer + %11 = bitcast i8* null to %struct.NSString* ; <%struct.NSString*> [#uses=2] + %12 = icmp eq i8* null, %bufptr.1.ph ; [#uses=1] + br i1 %12, label %bb44, label %bb42 + +bb42: ; preds = %bb39.split + call void @quux(i8* %bufptr.1.ph) nounwind nounwind + ret %struct.NSString* %11 + +bb44: ; preds = %bb39.split, %entry + %.0 = phi %struct.NSString* [ bitcast (%struct.__builtin_CFString* @0 to %struct.NSString*), %entry ], [ %11, %bb39.split ] ; <%struct.NSString*> [#uses=1] + ret %struct.NSString* %.0 +} + +declare void @foo(i8*) + +declare void @quux(i8*) From evan.cheng at apple.com Tue Sep 30 10:51:21 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 30 Sep 2008 15:51:21 -0000 Subject: [llvm-commits] [llvm] r56849 - in /llvm/trunk: include/llvm/ExecutionEngine/ExecutionEngine.h lib/ExecutionEngine/ExecutionEngine.cpp Message-ID: <200809301551.m8UFpL0i026585@zion.cs.uiuc.edu> Author: evancheng Date: Tue Sep 30 10:51:21 2008 New Revision: 56849 URL: http://llvm.org/viewvc/llvm-project?rev=56849&view=rev Log: Add runStaticConstructorsDestructors which runs ctors / dtors of a single module. Patch by David Chisnall. Modified: llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp Modified: llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h?rev=56849&r1=56848&r2=56849&view=diff ============================================================================== --- llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h (original) +++ llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h Tue Sep 30 10:51:21 2008 @@ -157,9 +157,13 @@ const std::vector &ArgValues) = 0; /// runStaticConstructorsDestructors - This method is used to execute all of - /// the static constructors or destructors for a module, depending on the + /// the static constructors or destructors for a program, depending on the /// value of isDtors. void runStaticConstructorsDestructors(bool isDtors); + /// runStaticConstructorsDestructors - This method is used to execute all of + /// the static constructors or destructors for a module, depending on the + /// value of isDtors. + void runStaticConstructorsDestructors(Module *module, bool isDtors); /// runFunctionAsMain - This is a helper function which wraps runFunction to Modified: llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp?rev=56849&r1=56848&r2=56849&view=diff ============================================================================== --- llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp (original) +++ llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp Tue Sep 30 10:51:21 2008 @@ -230,43 +230,51 @@ /// runStaticConstructorsDestructors - This method is used to execute all of -/// the static constructors or destructors for a program, depending on the +/// the static constructors or destructors for a module, depending on the /// value of isDtors. -void ExecutionEngine::runStaticConstructorsDestructors(bool isDtors) { +void ExecutionEngine::runStaticConstructorsDestructors(Module *module, bool isDtors) { const char *Name = isDtors ? "llvm.global_dtors" : "llvm.global_ctors"; // Execute global ctors/dtors for each module in the program. - for (unsigned m = 0, e = Modules.size(); m != e; ++m) { - GlobalVariable *GV = Modules[m]->getModule()->getNamedGlobal(Name); - - // If this global has internal linkage, or if it has a use, then it must be - // an old-style (llvmgcc3) static ctor with __main linked in and in use. If - // this is the case, don't execute any of the global ctors, __main will do - // it. - if (!GV || GV->isDeclaration() || GV->hasInternalLinkage()) continue; - // Should be an array of '{ int, void ()* }' structs. The first value is - // the init priority, which we ignore. - ConstantArray *InitList = dyn_cast(GV->getInitializer()); - if (!InitList) continue; - for (unsigned i = 0, e = InitList->getNumOperands(); i != e; ++i) - if (ConstantStruct *CS = - dyn_cast(InitList->getOperand(i))) { - if (CS->getNumOperands() != 2) break; // Not array of 2-element structs. - - Constant *FP = CS->getOperand(1); - if (FP->isNullValue()) - break; // Found a null terminator, exit. - - if (ConstantExpr *CE = dyn_cast(FP)) - if (CE->isCast()) - FP = CE->getOperand(0); - if (Function *F = dyn_cast(FP)) { - // Execute the ctor/dtor function! - runFunction(F, std::vector()); - } - } - } + GlobalVariable *GV = module->getNamedGlobal(Name); + + // If this global has internal linkage, or if it has a use, then it must be + // an old-style (llvmgcc3) static ctor with __main linked in and in use. If + // this is the case, don't execute any of the global ctors, __main will do + // it. + if (!GV || GV->isDeclaration() || GV->hasInternalLinkage()) return; + + // Should be an array of '{ int, void ()* }' structs. The first value is + // the init priority, which we ignore. + ConstantArray *InitList = dyn_cast(GV->getInitializer()); + if (!InitList) return; + for (unsigned i = 0, e = InitList->getNumOperands(); i != e; ++i) + if (ConstantStruct *CS = + dyn_cast(InitList->getOperand(i))) { + if (CS->getNumOperands() != 2) return; // Not array of 2-element structs. + + Constant *FP = CS->getOperand(1); + if (FP->isNullValue()) + break; // Found a null terminator, exit. + + if (ConstantExpr *CE = dyn_cast(FP)) + if (CE->isCast()) + FP = CE->getOperand(0); + if (Function *F = dyn_cast(FP)) { + // Execute the ctor/dtor function! + runFunction(F, std::vector()); + } + } +} + +/// runStaticConstructorsDestructors - This method is used to execute all of +/// the static constructors or destructors for a program, depending on the +/// value of isDtors. +void ExecutionEngine::runStaticConstructorsDestructors(bool isDtors) { + // Execute global ctors/dtors for each module in the program. + for (unsigned m = 0, e = Modules.size(); m != e; ++m) + runStaticConstructorsDestructors(Modules[m]->getModule(), isDtors); } #ifndef NDEBUG From evan.cheng at apple.com Tue Sep 30 10:52:13 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 30 Sep 2008 08:52:13 -0700 Subject: [llvm-commits] Per-module ctors for execution engine In-Reply-To: <0D3BE015-0954-48D8-97A4-F711A05B1C60@swan.ac.uk> References: <0D3BE015-0954-48D8-97A4-F711A05B1C60@swan.ac.uk> Message-ID: Looks good. I've committed it for you. Thanks, Evan On Sep 29, 2008, at 10:54 AM, David Chisnall wrote: > Hi, > > This patch adds a version of runStaticConstructorsDestructors which > takes a module as an argument, allowing ctors in modules created > after the ExecutionEngine to be run. It refactors the original code > so that the per-module body is now in the new method and the for > loop in the original now just calls the new one. > > David > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From dpatel at apple.com Tue Sep 30 11:21:13 2008 From: dpatel at apple.com (Devang Patel) Date: Tue, 30 Sep 2008 09:21:13 -0700 Subject: [llvm-commits] [llvm] r56801 - in /llvm/trunk: lib/AsmParser/llvmAsmParser.cpp.cvs lib/AsmParser/llvmAsmParser.y lib/AsmParser/llvmAsmParser.y.cvs lib/VMCore/AsmWriter.cpp test/Assembler/2008-09-02-FunctionNotes.ll test/Assembler/2008-09-02-FunctionNotes2.ll test/Assembler/2008-09-29-RetAttr.ll test/Transforms/DeadArgElim/keepalive.ll In-Reply-To: <200809301017.36485.baldrick@free.fr> References: <200809292049.m8TKnqbf017763@zion.cs.uiuc.edu> <200809301017.36485.baldrick@free.fr> Message-ID: <0A34F040-2FD2-48D5-98AA-331978DE8B8E@apple.com> On Sep 30, 2008, at 1:17 AM, Duncan Sands wrote: > Hi Devang, > >> --- llvm/trunk/test/Assembler/2008-09-02-FunctionNotes2.ll (original) >> +++ llvm/trunk/test/Assembler/2008-09-02-FunctionNotes2.ll Mon Sep >> 29 15:49:50 2008 >> @@ -1,7 +1,7 @@ >> ; Test function notes >> ; RUN: not llvm-as %s |& grep "only one inline note" >> ; XFAIL: * >> -define void @fn1() alwaysinline, noinline { >> +define void @fn1() alwaysinline noinline { >> ret void >> } > > should this test still be xfail'ed? I did not XFAIL this test by accident. The verifier needs to catch this. Note, the error message is also outdated. - Devang From dpatel at apple.com Tue Sep 30 11:28:58 2008 From: dpatel at apple.com (Devang Patel) Date: Tue, 30 Sep 2008 09:28:58 -0700 Subject: [llvm-commits] r55638 - /llvm/trunk/include/llvm/Function.h In-Reply-To: <200809300939.38971.baldrick@free.fr> References: <200809231027.53858.baldrick@free.fr> <200809291823.29191.baldrick@free.fr> <9AF39A0A-0CF3-4B3A-B253-89E98909B57C@apple.com> <200809300939.38971.baldrick@free.fr> Message-ID: On Sep 30, 2008, at 12:39 AM, Duncan Sands wrote: >> Ignore inliner for a while, and decide what code generator should do >> for following ? >> >> define float @foo(float %a, float %b) x86_no_sse { >> %t = mul float %a, %b >> ret float %t >> } > > It would use the x86 floating point stack, like it does now > if you compile with -mattr=-sse. This is less efficient than > using sse. So, I guess you answered your question. - Devang From ggreif at gmail.com Tue Sep 30 11:58:45 2008 From: ggreif at gmail.com (Gabor Greif) Date: Tue, 30 Sep 2008 16:58:45 -0000 Subject: [llvm-commits] [llvm] r56855 - /llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp Message-ID: <200809301658.m8UGwkY7028826@zion.cs.uiuc.edu> Author: ggreif Date: Tue Sep 30 11:58:44 2008 New Revision: 56855 URL: http://llvm.org/viewvc/llvm-project?rev=56855&view=rev Log: be sure to punchAwayDigits before repainting also comment on the mild assumption I am relying on Modified: llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp Modified: llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp?rev=56855&r1=56854&r2=56855&view=diff ============================================================================== --- llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp (original) +++ llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp Tue Sep 30 11:58:44 2008 @@ -123,12 +123,13 @@ int digits = requiredSteps; Acc = 0; Use* Tagspace = 0; - Use* OrigTagspace(Next); + Use* Orig(Next); while (1) { if (!digits) { if (Tagspace && Cushion <= -requiredSteps) { - repaintByCopying(Tagspace, OrigTagspace); + punchAwayDigits(Orig->Prev); + repaintByCopying(Tagspace, Orig); } return reinterpret_cast(Acc << spareBits); } @@ -151,9 +152,15 @@ goto efficiency; } default: - if (digits == requiredSteps /*!Tagspace*/) { - Tagspace = OrigTagspace; - OrigTagspace = (Use*)stripTag(U->Prev); + if (!Tagspace) { + Tagspace = Orig; + // Exploit the fact that a pointer to Use::Next + // is identical to the pointer to the previous Use. + // This is a mild hack assuming Use::Next being the + // first member. At this point we can be certain + // that U->Prev points into a Use, because we have + // already seen a stop tag (precondition). + Orig = (Use*)stripTag(U->Prev); } --digits; Acc = (Acc << 1) | (Tag & 1); From alenhar2 at cs.uiuc.edu Tue Sep 30 12:11:51 2008 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Tue, 30 Sep 2008 17:11:51 -0000 Subject: [llvm-commits] [poolalloc] r56857 - in /poolalloc/trunk/lib/DSA: BottomUpClosure.cpp CallTargets.cpp DataStructure.cpp Message-ID: <200809301711.m8UHBp71029225@zion.cs.uiuc.edu> Author: alenhar2 Date: Tue Sep 30 12:11:50 2008 New Revision: 56857 URL: http://llvm.org/viewvc/llvm-project?rev=56857&view=rev Log: inline graph whenever possible, but don't propagate unresolved call nodes if not inlining complete nodes. Greatly improves precision. Modified: poolalloc/trunk/lib/DSA/BottomUpClosure.cpp poolalloc/trunk/lib/DSA/CallTargets.cpp poolalloc/trunk/lib/DSA/DataStructure.cpp Modified: poolalloc/trunk/lib/DSA/BottomUpClosure.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/BottomUpClosure.cpp?rev=56857&r1=56856&r2=56857&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/BottomUpClosure.cpp (original) +++ poolalloc/trunk/lib/DSA/BottomUpClosure.cpp Tue Sep 30 12:11:50 2008 @@ -129,6 +129,25 @@ CS.getCalleeNode()->addFullFunctionList(Callees); // If any of the callees are unresolvable, remove the whole batch! + for (unsigned i = OldSize; i != Callees.size(); ) + if (Callees[i]->isDeclaration()) { + Callees.erase(Callees.begin()+i); + } else + ++i; + } +} + +static void GetAnyCallees(const DSCallSite &CS, + std::vector &Callees) { + if (CS.isDirectCall()) { + if (!CS.getCalleeFunc()->isDeclaration()) + Callees.push_back(CS.getCalleeFunc()); + } else { + // Get all callees. + unsigned OldSize = Callees.size(); + CS.getCalleeNode()->addFullFunctionList(Callees); + + // If any of the callees are unresolvable, remove the whole batch! for (unsigned i = OldSize, e = Callees.size(); i != e; ++i) if (Callees[i]->isDeclaration()) { Callees.erase(Callees.begin()+OldSize, Callees.end()); @@ -145,6 +164,14 @@ GetAllCallees(*I, Callees); } +/// GetAnyAuxCallees - Return a list containing all of the callees in +/// the aux list for the specified graph in the Callees vector. +static void GetAnyAuxCallees(DSGraph &G, std::vector &Callees) { + Callees.clear(); + for (DSGraph::afc_iterator I = G.afc_begin(), E = G.afc_end(); I != E; ++I) + GetAnyCallees(*I, Callees); +} + unsigned BUDataStructures::calculateGraphs(Function *F, std::vector &Stack, unsigned &NextID, @@ -168,7 +195,7 @@ // Find all callee functions. std::vector CalleeFunctions; - GetAllAuxCallees(Graph, CalleeFunctions); + GetAnyAuxCallees(Graph, CalleeFunctions); // The edges out of the current node are the call site targets... for (unsigned i = 0, e = CalleeFunctions.size(); i != e; ++i) { @@ -202,8 +229,9 @@ // Should we revisit the graph? Only do it if there are now new resolvable // callees. - GetAllAuxCallees(Graph, CalleeFunctions); - if (!CalleeFunctions.empty()) { + std::vector CalleeFunctionsNew; + GetAnyAuxCallees(Graph, CalleeFunctionsNew); + if (CalleeFunctionsNew.size() > CalleeFunctions.size()) { DOUT << "Recalculating " << F->getName() << " due to new knowledge\n"; ValMap.erase(F); return calculateGraphs(F, Stack, NextID, ValMap); @@ -340,107 +368,115 @@ } GetAllCallees(CS, CalledFuncs); + bool isComplete = true; if (CalledFuncs.empty()) { // Remember that we could not resolve this yet! AuxCallsList.splice(AuxCallsList.end(), TempFCs, TempFCs.begin()); + isComplete = false; + GetAnyCallees(CS, CalledFuncs); + } + + if (CalledFuncs.empty()) continue; - } else { - DSGraph *GI; - Instruction *TheCall = CS.getCallSite().getInstruction(); - - if (CalledFuncs.size() == 1) { - Function *Callee = CalledFuncs[0]; - ActualCallees.insert(std::make_pair(TheCall, Callee)); - - // Get the data structure graph for the called function. - GI = &getDSGraph(*Callee); // Graph to inline - DOUT << " Inlining graph for " << Callee->getName() - << "[" << GI->getGraphSize() << "+" - << GI->getAuxFunctionCalls().size() << "] into '" - << Graph.getFunctionNames() << "' [" << Graph.getGraphSize() <<"+" - << Graph.getAuxFunctionCalls().size() << "]\n"; - Graph.mergeInGraph(CS, *Callee, *GI, - DSGraph::StripAllocaBit|DSGraph::DontCloneCallNodes); - ++NumBUInlines; - } else { - if (!Printed) - DEBUG(std::cerr << "In Fns: " << Graph.getFunctionNames() << "\n"); - DEBUG(std::cerr << " calls " << CalledFuncs.size() - << " fns from site: " << CS.getCallSite().getInstruction() - << " " << *CS.getCallSite().getInstruction()); - DEBUG(std::cerr << " Fns ="); - unsigned NumPrinted = 0; - - for (std::vector::iterator I = CalledFuncs.begin(), - E = CalledFuncs.end(); I != E; ++I) { - if (NumPrinted++ < 8) cerr << " " << (*I)->getName(); - // Add the call edges to the call graph. - ActualCallees.insert(std::make_pair(TheCall, *I)); - } - cerr << "\n"; - - // See if we already computed a graph for this set of callees. - std::sort(CalledFuncs.begin(), CalledFuncs.end()); - std::pair > &IndCallGraph = - (*IndCallGraphMap)[CalledFuncs]; - - if (IndCallGraph.first == 0) { - std::vector::iterator I = CalledFuncs.begin(), - E = CalledFuncs.end(); - - // Start with a copy of the first graph. - GI = IndCallGraph.first = new DSGraph(getDSGraph(**I), GlobalECs); - GI->setGlobalsGraph(Graph.getGlobalsGraph()); - std::vector &Args = IndCallGraph.second; - - // Get the argument nodes for the first callee. The return value is - // the 0th index in the vector. - GI->getFunctionArgumentsForCall(*I, Args); - - // Merge all of the other callees into this graph. - for (++I; I != E; ++I) { - // If the graph already contains the nodes for the function, don't - // bother merging it in again. - if (!GI->containsFunction(*I)) { - GI->cloneInto(getDSGraph(**I)); - ++NumBUInlines; - } - - std::vector NextArgs; - GI->getFunctionArgumentsForCall(*I, NextArgs); - unsigned i = 0, e = Args.size(); - for (; i != e; ++i) { - if (i == NextArgs.size()) break; - Args[i].mergeWith(NextArgs[i]); - } - for (e = NextArgs.size(); i != e; ++i) - Args.push_back(NextArgs[i]); + DSGraph *GI; + Instruction *TheCall = CS.getCallSite().getInstruction(); + + if (CalledFuncs.size() == 1) { + Function *Callee = CalledFuncs[0]; + ActualCallees.insert(std::make_pair(TheCall, Callee)); + + // Get the data structure graph for the called function. + GI = &getDSGraph(*Callee); // Graph to inline + DOUT << " Inlining graph for " << Callee->getName() + << "[" << GI->getGraphSize() << "+" + << GI->getAuxFunctionCalls().size() << "] into '" + << Graph.getFunctionNames() << "' [" << Graph.getGraphSize() <<"+" + << Graph.getAuxFunctionCalls().size() << "]\n"; + Graph.mergeInGraph(CS, *Callee, *GI, + DSGraph::StripAllocaBit|DSGraph::DontCloneCallNodes| + (isComplete?0:DSGraph::DontCloneAuxCallNodes)); + ++NumBUInlines; + } else { + if (!Printed) + DEBUG(std::cerr << "In Fns: " << Graph.getFunctionNames() << "\n"); + DEBUG(std::cerr << " calls " << CalledFuncs.size() + << " fns from site: " << CS.getCallSite().getInstruction() + << " " << *CS.getCallSite().getInstruction()); + DEBUG(std::cerr << " Fns ="); + unsigned NumPrinted = 0; + + for (std::vector::iterator I = CalledFuncs.begin(), + E = CalledFuncs.end(); I != E; ++I) { + if (NumPrinted++ < 8) DOUT << " " << (*I)->getName(); + + // Add the call edges to the call graph. + ActualCallees.insert(std::make_pair(TheCall, *I)); + } + DOUT << "\n"; + + // See if we already computed a graph for this set of callees. + std::sort(CalledFuncs.begin(), CalledFuncs.end()); + std::pair > &IndCallGraph = + (*IndCallGraphMap)[CalledFuncs]; + + if (IndCallGraph.first == 0) { + std::vector::iterator I = CalledFuncs.begin(), + E = CalledFuncs.end(); + + // Start with a copy of the first graph. + GI = IndCallGraph.first = new DSGraph(getDSGraph(**I), GlobalECs); + GI->setGlobalsGraph(Graph.getGlobalsGraph()); + std::vector &Args = IndCallGraph.second; + + // Get the argument nodes for the first callee. The return value is + // the 0th index in the vector. + GI->getFunctionArgumentsForCall(*I, Args); + + // Merge all of the other callees into this graph. + for (++I; I != E; ++I) { + // If the graph already contains the nodes for the function, don't + // bother merging it in again. + if (!GI->containsFunction(*I)) { + GI->cloneInto(getDSGraph(**I)); + ++NumBUInlines; } - - // Clean up the final graph! - GI->removeDeadNodes(DSGraph::KeepUnreachableGlobals); - } else { - cerr << "***\n*** RECYCLED GRAPH ***\n***\n"; + + std::vector NextArgs; + GI->getFunctionArgumentsForCall(*I, NextArgs); + unsigned i = 0, e = Args.size(); + for (; i != e; ++i) { + if (i == NextArgs.size()) break; + Args[i].mergeWith(NextArgs[i]); + } + for (e = NextArgs.size(); i != e; ++i) + Args.push_back(NextArgs[i]); } - - GI = IndCallGraph.first; - - // Merge the unified graph into this graph now. - DOUT << " Inlining multi callee graph " - << "[" << GI->getGraphSize() << "+" - << GI->getAuxFunctionCalls().size() << "] into '" - << Graph.getFunctionNames() << "' [" << Graph.getGraphSize() <<"+" - << Graph.getAuxFunctionCalls().size() << "]\n"; - - Graph.mergeInGraph(CS, IndCallGraph.second, *GI, - DSGraph::StripAllocaBit | - DSGraph::DontCloneCallNodes); - ++NumBUInlines; + + // Clean up the final graph! + GI->removeDeadNodes(DSGraph::KeepUnreachableGlobals); + } else { + DOUT << "***\n*** RECYCLED GRAPH ***\n***\n"; } + + GI = IndCallGraph.first; + + // Merge the unified graph into this graph now. + DOUT << " Inlining multi callee graph " + << "[" << GI->getGraphSize() << "+" + << GI->getAuxFunctionCalls().size() << "] into '" + << Graph.getFunctionNames() << "' [" << Graph.getGraphSize() <<"+" + << Graph.getAuxFunctionCalls().size() << "]\n"; + + Graph.mergeInGraph(CS, IndCallGraph.second, *GI, + DSGraph::StripAllocaBit | + DSGraph::DontCloneCallNodes| + (isComplete?0:DSGraph::DontCloneAuxCallNodes)); + ++NumBUInlines; } - TempFCs.erase(TempFCs.begin()); + if (isComplete) + TempFCs.erase(TempFCs.begin()); } // Recompute the Incomplete markers Modified: poolalloc/trunk/lib/DSA/CallTargets.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/CallTargets.cpp?rev=56857&r1=56856&r2=56857&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/CallTargets.cpp (original) +++ poolalloc/trunk/lib/DSA/CallTargets.cpp Tue Sep 30 12:11:50 2008 @@ -77,7 +77,6 @@ void CallTargetFinder::print(std::ostream &O, const Module *M) const { - return; O << "[* = incomplete] CS: func list\n"; for (std::map >::const_iterator ii = IndMap.begin(), Modified: poolalloc/trunk/lib/DSA/DataStructure.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/DataStructure.cpp?rev=56857&r1=56856&r2=56857&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/DataStructure.cpp (original) +++ poolalloc/trunk/lib/DSA/DataStructure.cpp Tue Sep 30 12:11:50 2008 @@ -1368,7 +1368,6 @@ DestCS.addPtrArg(getClonedNH(SrcCS.getPtrArg(a))); } - //===----------------------------------------------------------------------===// // DSCallSite Implementation //===----------------------------------------------------------------------===// @@ -1493,14 +1492,14 @@ void DSGraph::removeFunctionCalls(Function& F) { for (std::list::iterator I = FunctionCalls.begin(), E = FunctionCalls.end(); I != E; ++I) - if (I->isDirectCall() && &I->getCaller() == &F) { + if (I->isDirectCall() && I->getCalleeFunc() == &F) { FunctionCalls.erase(I); break; } for (std::list::iterator I = AuxFunctionCalls.begin(), E = AuxFunctionCalls.end(); I != E; ++I) - if (I->isDirectCall() && &I->getCaller() == &F) { + if (I->isDirectCall() && I->getCalleeFunc() == &F) { AuxFunctionCalls.erase(I); break; } @@ -2747,7 +2746,7 @@ //Clone or Steal the Source Graph DSGraph &BaseGraph = GraphSource->getDSGraph(*F); if (Clone) { - G = new DSGraph(BaseGraph, GlobalECs); + G = new DSGraph(BaseGraph, GlobalECs, DSGraph::DontCloneAuxCallNodes); } else { G = new DSGraph(GlobalECs, GraphSource->getTargetData()); G->spliceFrom(BaseGraph); From kremenek at apple.com Tue Sep 30 12:32:33 2008 From: kremenek at apple.com (Ted Kremenek) Date: Tue, 30 Sep 2008 17:32:33 -0000 Subject: [llvm-commits] [llvm] r56861 - /llvm/tags/checker/checker-104/ Message-ID: <200809301732.m8UHWXTX029862@zion.cs.uiuc.edu> Author: kremenek Date: Tue Sep 30 12:32:33 2008 New Revision: 56861 URL: http://llvm.org/viewvc/llvm-project?rev=56861&view=rev Log: Tagging checker-104. Added: llvm/tags/checker/checker-104/ - copied from r56860, llvm/trunk/ From evan.cheng at apple.com Tue Sep 30 12:57:49 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 30 Sep 2008 17:57:49 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r56865 - /llvm-gcc-4.2/trunk/gcc/config/darwin.c Message-ID: <200809301757.m8UHvnFq030579@zion.cs.uiuc.edu> Author: evancheng Date: Tue Sep 30 12:57:49 2008 New Revision: 56865 URL: http://llvm.org/viewvc/llvm-project?rev=56865&view=rev Log: Fix r56370 and subsequent changes: determine correct target triple when -mmacosx-version-min is specified. Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.c Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/darwin.c?rev=56865&r1=56864&r2=56865&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/darwin.c (original) +++ llvm-gcc-4.2/trunk/gcc/config/darwin.c Tue Sep 30 12:57:49 2008 @@ -2674,19 +2674,17 @@ /* LLVM LOCAL begin radar 6230142 */ unsigned darwin_llvm_override_target_version(const char *triple, char **new_triple) { - int len = 0, version = 0; + int len = 0, pad = 0, version = 0; if (!darwin_macosx_version_min) return 0; - /* Triple string is expected to look something like 'i386-apple-darwin?' or - 'i386-apple-darwin9.5.0' */ - len = strlen (triple); - if (len < 7) - return 0; - if (strncmp (&triple[len - 7], "darwin", 6) != 0 || - (len > 11 && strncmp (&triple[len - 11], "darwin", 6) != 0)) + /* Triple string is expected to look something like 'i386-*-darwin?' or + 'i386-*-darwin9.5.0' */ + char *substr = strstr(triple, "darwin"); + if (!substr) return 0; + len = substr + 6 - triple; /* llvm-gcc doesn't support pre-10.0 systems. */ version = strverscmp (darwin_macosx_version_min, "10.0"); @@ -2698,16 +2696,17 @@ /* Darwin version number will be 2 digits for 10.6 and up. */ if (version >= 10) - ++len; - *new_triple = ggc_alloc (len+1); - strcpy (*new_triple, triple); + pad = 1; + *new_triple = ggc_alloc (len+pad+1); + strncpy (*new_triple, triple, len); if (version >= 10) { - (*new_triple)[len-2] = '1'; + (*new_triple)[len] = '1'; version -= 10; + ++len; } - (*new_triple)[len-1] = '0' + version; - (*new_triple)[len] = '\0'; + (*new_triple)[len] = '0' + version; + (*new_triple)[len+1] = '\0'; return 1; } From evan.cheng at apple.com Tue Sep 30 13:20:36 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 30 Sep 2008 11:20:36 -0700 Subject: [llvm-commits] [llvm] r56704 - in /llvm/trunk: include/llvm/ lib/AsmParser/ lib/Bitcode/Reader/ lib/Transforms/IPO/ lib/Transforms/Scalar/ lib/VMCore/ In-Reply-To: <200809262253.m8QMr8A4018093@zion.cs.uiuc.edu> References: <200809262253.m8QMr8A4018093@zion.cs.uiuc.edu> Message-ID: <47701548-D636-4DAB-8C58-2B8084B772DD@apple.com> I am seeing duplicated nounwind on calls: call void @BlockMoveData(i8* %4, i8* %209, i32 16) nounwind nounwind This appears to be introduced between 56697 and 56711. Can someone take a look? Thanks, Evan On Sep 26, 2008, at 3:53 PM, Devang Patel wrote: > Author: dpatel > Date: Fri Sep 26 17:53:05 2008 > New Revision: 56704 > > URL: http://llvm.org/viewvc/llvm-project?rev=56704&view=rev > Log: > Now Attributes are divided in three groups > - return attributes - inreg, zext and sext > - parameter attributes > - function attributes - nounwind, readonly, readnone, noreturn > > Return attributes use 0 as the index. > Function attributes use ~0U as the index. > > This patch requires corresponding changes in llvm-gcc and clang. > > Modified: > llvm/trunk/include/llvm/Attributes.h > llvm/trunk/include/llvm/Function.h > llvm/trunk/include/llvm/Instructions.h > llvm/trunk/lib/AsmParser/llvmAsmParser.y > llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs > llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp > llvm/trunk/lib/Bitcode/Reader/BitcodeReader.h > llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp > llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp > llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp > llvm/trunk/lib/Transforms/IPO/PruneEH.cpp > llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp > llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp > llvm/trunk/lib/VMCore/AsmWriter.cpp > llvm/trunk/lib/VMCore/Attributes.cpp > llvm/trunk/lib/VMCore/Function.cpp > llvm/trunk/lib/VMCore/Verifier.cpp > > Modified: llvm/trunk/include/llvm/Attributes.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Attributes.h?rev=56704&r1=56703&r2=56704&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/include/llvm/Attributes.h (original) > +++ llvm/trunk/include/llvm/Attributes.h Fri Sep 26 17:53:05 2008 > @@ -146,10 +146,23 @@ > // > = > = > =-------------------------------------------------------------------- > ===// > // Attribute List Accessors > // > = > = > =-------------------------------------------------------------------- > ===// > - > - /// getAttributes - The attributes for the specified index are > - /// returned. Attributes for the result are denoted with Idx = 0. > - Attributes getAttributes(unsigned Idx) const; > + /// getParamAttributes - The attributes for the specified index are > + /// returned. > + Attributes getParamAttributes(unsigned Idx) const { > + assert (Idx && Idx != ~0U && "Invalid parameter index!"); > + return getAttributes(Idx); > + } > + > + /// getRetAttributes - The attributes for the ret value are > + /// returned. > + Attributes getRetAttributes() const { > + return getAttributes(0); > + } > + > + /// getFnAttributes - The function attributes are returned. > + Attributes getFnAttributes() const { > + return getAttributes(~0); > + } > > /// paramHasAttr - Return true if the specified parameter index > has the > /// specified attribute set. > @@ -204,6 +217,11 @@ > > private: > explicit AttrListPtr(AttributeListImpl *L); > + > + /// getAttributes - The attributes for the specified index are > + /// returned. Attributes for the result are denoted with Idx = 0. > + Attributes getAttributes(unsigned Idx) const; > + > }; > > } // End llvm namespace > > Modified: llvm/trunk/include/llvm/Function.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Function.h?rev=56704&r1=56703&r2=56704&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/include/llvm/Function.h (original) > +++ llvm/trunk/include/llvm/Function.h Fri Sep 26 17:53:05 2008 > @@ -187,38 +187,38 @@ > > /// @brief Determine if the function does not access memory. > bool doesNotAccessMemory() const { > - return paramHasAttr(0, Attribute::ReadNone); > + return paramHasAttr(~0, Attribute::ReadNone); > } > void setDoesNotAccessMemory(bool DoesNotAccessMemory = true) { > - if (DoesNotAccessMemory) addAttribute(0, Attribute::ReadNone); > - else removeAttribute(0, Attribute::ReadNone); > + if (DoesNotAccessMemory) addAttribute(~0, Attribute::ReadNone); > + else removeAttribute(~0, Attribute::ReadNone); > } > > /// @brief Determine if the function does not access or only reads > memory. > bool onlyReadsMemory() const { > - return doesNotAccessMemory() || paramHasAttr(0, > Attribute::ReadOnly); > + return doesNotAccessMemory() || paramHasAttr(~0, > Attribute::ReadOnly); > } > void setOnlyReadsMemory(bool OnlyReadsMemory = true) { > - if (OnlyReadsMemory) addAttribute(0, Attribute::ReadOnly); > - else removeAttribute(0, Attribute::ReadOnly | > Attribute::ReadNone); > + if (OnlyReadsMemory) addAttribute(~0, Attribute::ReadOnly); > + else removeAttribute(~0, Attribute::ReadOnly | > Attribute::ReadNone); > } > > /// @brief Determine if the function cannot return. > bool doesNotReturn() const { > - return paramHasAttr(0, Attribute::NoReturn); > + return paramHasAttr(~0, Attribute::NoReturn); > } > void setDoesNotReturn(bool DoesNotReturn = true) { > - if (DoesNotReturn) addAttribute(0, Attribute::NoReturn); > - else removeAttribute(0, Attribute::NoReturn); > + if (DoesNotReturn) addAttribute(~0, Attribute::NoReturn); > + else removeAttribute(~0, Attribute::NoReturn); > } > > /// @brief Determine if the function cannot unwind. > bool doesNotThrow() const { > - return paramHasAttr(0, Attribute::NoUnwind); > + return paramHasAttr(~0, Attribute::NoUnwind); > } > void setDoesNotThrow(bool DoesNotThrow = true) { > - if (DoesNotThrow) addAttribute(0, Attribute::NoUnwind); > - else removeAttribute(0, Attribute::NoUnwind); > + if (DoesNotThrow) addAttribute(~0, Attribute::NoUnwind); > + else removeAttribute(~0, Attribute::NoUnwind); > } > > /// @brief Determine if the function returns a structure through > first > > Modified: llvm/trunk/include/llvm/Instructions.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instructions.h?rev=56704&r1=56703&r2=56704&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/include/llvm/Instructions.h (original) > +++ llvm/trunk/include/llvm/Instructions.h Fri Sep 26 17:53:05 2008 > @@ -1097,38 +1097,38 @@ > > /// @brief Determine if the call does not access memory. > bool doesNotAccessMemory() const { > - return paramHasAttr(0, Attribute::ReadNone); > + return paramHasAttr(~0, Attribute::ReadNone); > } > void setDoesNotAccessMemory(bool NotAccessMemory = true) { > - if (NotAccessMemory) addAttribute(0, Attribute::ReadNone); > - else removeAttribute(0, Attribute::ReadNone); > + if (NotAccessMemory) addAttribute(~0, Attribute::ReadNone); > + else removeAttribute(~0, Attribute::ReadNone); > } > > /// @brief Determine if the call does not access or only reads > memory. > bool onlyReadsMemory() const { > - return doesNotAccessMemory() || paramHasAttr(0, > Attribute::ReadOnly); > + return doesNotAccessMemory() || paramHasAttr(~0, > Attribute::ReadOnly); > } > void setOnlyReadsMemory(bool OnlyReadsMemory = true) { > - if (OnlyReadsMemory) addAttribute(0, Attribute::ReadOnly); > - else removeAttribute(0, Attribute::ReadOnly | > Attribute::ReadNone); > + if (OnlyReadsMemory) addAttribute(~0, Attribute::ReadOnly); > + else removeAttribute(~0, Attribute::ReadOnly | > Attribute::ReadNone); > } > > /// @brief Determine if the call cannot return. > bool doesNotReturn() const { > - return paramHasAttr(0, Attribute::NoReturn); > + return paramHasAttr(~0, Attribute::NoReturn); > } > void setDoesNotReturn(bool DoesNotReturn = true) { > - if (DoesNotReturn) addAttribute(0, Attribute::NoReturn); > - else removeAttribute(0, Attribute::NoReturn); > + if (DoesNotReturn) addAttribute(~0, Attribute::NoReturn); > + else removeAttribute(~0, Attribute::NoReturn); > } > > /// @brief Determine if the call cannot unwind. > bool doesNotThrow() const { > - return paramHasAttr(0, Attribute::NoUnwind); > + return paramHasAttr(~0, Attribute::NoUnwind); > } > void setDoesNotThrow(bool DoesNotThrow = true) { > - if (DoesNotThrow) addAttribute(0, Attribute::NoUnwind); > - else removeAttribute(0, Attribute::NoUnwind); > + if (DoesNotThrow) addAttribute(~0, Attribute::NoUnwind); > + else removeAttribute(~0, Attribute::NoUnwind); > } > > /// @brief Determine if the call returns a structure through first > @@ -2459,35 +2459,35 @@ > return paramHasAttr(0, Attribute::ReadNone); > } > void setDoesNotAccessMemory(bool NotAccessMemory = true) { > - if (NotAccessMemory) addAttribute(0, Attribute::ReadNone); > - else removeAttribute(0, Attribute::ReadNone); > + if (NotAccessMemory) addAttribute(~0, Attribute::ReadNone); > + else removeAttribute(~0, Attribute::ReadNone); > } > > /// @brief Determine if the call does not access or only reads > memory. > bool onlyReadsMemory() const { > - return doesNotAccessMemory() || paramHasAttr(0, > Attribute::ReadOnly); > + return doesNotAccessMemory() || paramHasAttr(~0, > Attribute::ReadOnly); > } > void setOnlyReadsMemory(bool OnlyReadsMemory = true) { > - if (OnlyReadsMemory) addAttribute(0, Attribute::ReadOnly); > - else removeAttribute(0, Attribute::ReadOnly | > Attribute::ReadNone); > + if (OnlyReadsMemory) addAttribute(~0, Attribute::ReadOnly); > + else removeAttribute(~0, Attribute::ReadOnly | > Attribute::ReadNone); > } > > /// @brief Determine if the call cannot return. > bool doesNotReturn() const { > - return paramHasAttr(0, Attribute::NoReturn); > + return paramHasAttr(~0, Attribute::NoReturn); > } > void setDoesNotReturn(bool DoesNotReturn = true) { > - if (DoesNotReturn) addAttribute(0, Attribute::NoReturn); > - else removeAttribute(0, Attribute::NoReturn); > + if (DoesNotReturn) addAttribute(~0, Attribute::NoReturn); > + else removeAttribute(~0, Attribute::NoReturn); > } > > /// @brief Determine if the call cannot unwind. > bool doesNotThrow() const { > - return paramHasAttr(0, Attribute::NoUnwind); > + return paramHasAttr(~0, Attribute::NoUnwind); > } > void setDoesNotThrow(bool DoesNotThrow = true) { > - if (DoesNotThrow) addAttribute(0, Attribute::NoUnwind); > - else removeAttribute(0, Attribute::NoUnwind); > + if (DoesNotThrow) addAttribute(~0, Attribute::NoUnwind); > + else removeAttribute(~0, Attribute::NoUnwind); > } > > /// @brief Determine if the call returns a structure through first > > Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.y > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.y?rev=56704&r1=56703&r2=56704&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/AsmParser/llvmAsmParser.y (original) > +++ llvm/trunk/lib/AsmParser/llvmAsmParser.y Fri Sep 26 17:53:05 2008 > @@ -2346,8 +2346,25 @@ > > std::vector ParamTypeList; > SmallVector Attrs; > - if ($7 != Attribute::None) > - Attrs.push_back(AttributeWithIndex::get(0, $7)); > + //FIXME : In 3.0, stop accepting zext, sext and inreg as optional > function > + //attributes. > + Attributes RetAttrs = 0; > + if ($7 != Attribute::None) { > + if ($7 & Attribute::ZExt) { > + RetAttrs = RetAttrs | Attribute::ZExt; > + $7 = $7 ^ Attribute::ZExt; > + } > + if ($7 & Attribute::SExt) { > + RetAttrs = RetAttrs | Attribute::SExt; > + $7 = $7 ^ Attribute::SExt; > + } > + if ($7 & Attribute::InReg) { > + RetAttrs = RetAttrs | Attribute::InReg; > + $7 = $7 ^ Attribute::InReg; > + } > + if (RetAttrs != Attribute::None) > + Attrs.push_back(AttributeWithIndex::get(0, RetAttrs)); > + } > if ($5) { // If there are arguments... > unsigned index = 1; > for (ArgListType::iterator I = $5->begin(); I != $5->end(); ++I, > ++index) { > @@ -2359,6 +2376,8 @@ > Attrs.push_back(AttributeWithIndex::get(index, I->Attrs)); > } > } > + if ($7 != Attribute::None) > + Attrs.push_back(AttributeWithIndex::get(~0, $7)); > > bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == > Type::VoidTy; > if (isVarArg) ParamTypeList.pop_back(); > @@ -2860,9 +2879,26 @@ > CHECK_FOR_ERROR > > SmallVector Attrs; > - if ($8 != Attribute::None) > - Attrs.push_back(AttributeWithIndex::get(0, $8)); > - > + //FIXME : In 3.0, stop accepting zext, sext and inreg as > optional function > + //attributes. > + Attributes RetAttrs = 0; > + if ($8 != Attribute::None) { > + if ($8 & Attribute::ZExt) { > + RetAttrs = RetAttrs | Attribute::ZExt; > + $8 = $8 ^ Attribute::ZExt; > + } > + if ($8 & Attribute::SExt) { > + RetAttrs = RetAttrs | Attribute::SExt; > + $8 = $8 ^ Attribute::SExt; > + } > + if ($8 & Attribute::InReg) { > + RetAttrs = RetAttrs | Attribute::InReg; > + $8 = $8 ^ Attribute::InReg; > + } > + if (RetAttrs != Attribute::None) > + Attrs.push_back(AttributeWithIndex::get(0, RetAttrs)); > + } > + > // Check the arguments > ValueList Args; > if ($6->empty()) { // Has no > arguments? > @@ -2897,7 +2933,8 @@ > } else if (I != E || ArgI != ArgE) > GEN_ERROR("Invalid number of parameters detected"); > } > - > + if ($8 != Attribute::None) > + Attrs.push_back(AttributeWithIndex::get(~0, $8)); > AttrListPtr PAL; > if (!Attrs.empty()) > PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); > @@ -3258,8 +3295,27 @@ > > // Set up the Attributes for the function > SmallVector Attrs; > - if ($8 != Attribute::None) > - Attrs.push_back(AttributeWithIndex::get(0, $8)); > + //FIXME : In 3.0, stop accepting zext, sext and inreg as > optional function > + //attributes. > + Attributes RetAttrs = 0; > + Attributes TmpAttr = $8; > + if ($8 != Attribute::None) { > + if ($8 & Attribute::ZExt) { > + RetAttrs = RetAttrs | Attribute::ZExt; > + $8 = $8 ^ Attribute::ZExt; > + } > + if ($8 & Attribute::SExt) { > + RetAttrs = RetAttrs | Attribute::SExt; > + $8 = $8 ^ Attribute::SExt; > + } > + if ($8 & Attribute::InReg) { > + RetAttrs = RetAttrs | Attribute::InReg; > + $8 = $8 ^ Attribute::InReg; > + } > + if (RetAttrs != Attribute::None) > + Attrs.push_back(AttributeWithIndex::get(0, RetAttrs)); > + } > + > // Check the arguments > ValueList Args; > if ($6->empty()) { // Has no > arguments? > @@ -3293,6 +3349,8 @@ > } else if (I != E || ArgI != ArgE) > GEN_ERROR("Invalid number of parameters detected"); > } > + if ($8 != Attribute::None) > + Attrs.push_back(AttributeWithIndex::get(~0, $8)); > > // Finish off the Attributes and check them > AttrListPtr PAL; > > Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs?rev=56704&r1=56703&r2=56704&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs (original) > +++ llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs Fri Sep 26 17:53:05 > 2008 > @@ -2346,8 +2346,25 @@ > > std::vector ParamTypeList; > SmallVector Attrs; > - if ($7 != Attribute::None) > - Attrs.push_back(AttributeWithIndex::get(0, $7)); > + //FIXME : In 3.0, stop accepting zext, sext and inreg as optional > function > + //attributes. > + Attributes RetAttrs = 0; > + if ($7 != Attribute::None) { > + if ($7 & Attribute::ZExt) { > + RetAttrs = RetAttrs | Attribute::ZExt; > + $7 = $7 ^ Attribute::ZExt; > + } > + if ($7 & Attribute::SExt) { > + RetAttrs = RetAttrs | Attribute::SExt; > + $7 = $7 ^ Attribute::SExt; > + } > + if ($7 & Attribute::InReg) { > + RetAttrs = RetAttrs | Attribute::InReg; > + $7 = $7 ^ Attribute::InReg; > + } > + if (RetAttrs != Attribute::None) > + Attrs.push_back(AttributeWithIndex::get(0, RetAttrs)); > + } > if ($5) { // If there are arguments... > unsigned index = 1; > for (ArgListType::iterator I = $5->begin(); I != $5->end(); ++I, > ++index) { > @@ -2359,6 +2376,8 @@ > Attrs.push_back(AttributeWithIndex::get(index, I->Attrs)); > } > } > + if ($7 != Attribute::None) > + Attrs.push_back(AttributeWithIndex::get(~0, $7)); > > bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == > Type::VoidTy; > if (isVarArg) ParamTypeList.pop_back(); > @@ -2860,9 +2879,26 @@ > CHECK_FOR_ERROR > > SmallVector Attrs; > - if ($8 != Attribute::None) > - Attrs.push_back(AttributeWithIndex::get(0, $8)); > - > + //FIXME : In 3.0, stop accepting zext, sext and inreg as > optional function > + //attributes. > + Attributes RetAttrs = 0; > + if ($8 != Attribute::None) { > + if ($8 & Attribute::ZExt) { > + RetAttrs = RetAttrs | Attribute::ZExt; > + $8 = $8 ^ Attribute::ZExt; > + } > + if ($8 & Attribute::SExt) { > + RetAttrs = RetAttrs | Attribute::SExt; > + $8 = $8 ^ Attribute::SExt; > + } > + if ($8 & Attribute::InReg) { > + RetAttrs = RetAttrs | Attribute::InReg; > + $8 = $8 ^ Attribute::InReg; > + } > + if (RetAttrs != Attribute::None) > + Attrs.push_back(AttributeWithIndex::get(0, RetAttrs)); > + } > + > // Check the arguments > ValueList Args; > if ($6->empty()) { // Has no > arguments? > @@ -2897,7 +2933,8 @@ > } else if (I != E || ArgI != ArgE) > GEN_ERROR("Invalid number of parameters detected"); > } > - > + if ($8 != Attribute::None) > + Attrs.push_back(AttributeWithIndex::get(~0, $8)); > AttrListPtr PAL; > if (!Attrs.empty()) > PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); > @@ -3258,8 +3295,27 @@ > > // Set up the Attributes for the function > SmallVector Attrs; > - if ($8 != Attribute::None) > - Attrs.push_back(AttributeWithIndex::get(0, $8)); > + //FIXME : In 3.0, stop accepting zext, sext and inreg as > optional function > + //attributes. > + Attributes RetAttrs = 0; > + Attributes TmpAttr = $8; > + if ($8 != Attribute::None) { > + if ($8 & Attribute::ZExt) { > + RetAttrs = RetAttrs | Attribute::ZExt; > + $8 = $8 ^ Attribute::ZExt; > + } > + if ($8 & Attribute::SExt) { > + RetAttrs = RetAttrs | Attribute::SExt; > + $8 = $8 ^ Attribute::SExt; > + } > + if ($8 & Attribute::InReg) { > + RetAttrs = RetAttrs | Attribute::InReg; > + $8 = $8 ^ Attribute::InReg; > + } > + if (RetAttrs != Attribute::None) > + Attrs.push_back(AttributeWithIndex::get(0, RetAttrs)); > + } > + > // Check the arguments > ValueList Args; > if ($6->empty()) { // Has no > arguments? > @@ -3293,6 +3349,8 @@ > } else if (I != E || ArgI != ArgE) > GEN_ERROR("Invalid number of parameters detected"); > } > + if ($8 != Attribute::None) > + Attrs.push_back(AttributeWithIndex::get(~0, $8)); > > // Finish off the Attributes and check them > AttrListPtr PAL; > > Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=56704&r1=56703&r2=56704&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original) > +++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Fri Sep 26 > 17:53:05 2008 > @@ -32,7 +32,7 @@ > std::vector().swap(TypeList); > ValueList.clear(); > > - std::vector().swap(Attributes); > + std::vector().swap(MAttributes); > std::vector().swap(FunctionBBs); > std::vector().swap(FunctionsWithBodies); > DeferredFunctionInfo.clear(); > @@ -317,7 +317,7 @@ > if (Stream.EnterSubBlock(bitc::PARAMATTR_BLOCK_ID)) > return Error("Malformed block record"); > > - if (!Attributes.empty()) > + if (!MAttributes.empty()) > return Error("Multiple PARAMATTR blocks found!"); > > SmallVector Record; > @@ -355,12 +355,53 @@ > if (Record.size() & 1) > return Error("Invalid ENTRY record"); > > + // FIXME : Remove this backword compatibility one day. > + // If Function attributes are using index 0 then transfer them > + // to index ~0. Index 0 is strictly used for return value > + // attributes. > + Attributes RetAttribute = Attribute::None; > + Attributes FnAttribute = Attribute::None; > for (unsigned i = 0, e = Record.size(); i != e; i += 2) { > - if (Record[i+1] != Attribute::None) > + if (Record[i] == 0) > + RetAttribute = Record[i+1]; > + else if (Record[i] == ~0U) > + FnAttribute = Record[i+1]; > + } > + bool useUpdatedAttrs = false; > + if (FnAttribute == Attribute::None && RetAttribute != > Attribute::None) { > + if (RetAttribute & Attribute::NoUnwind) { > + FnAttribute = FnAttribute | Attribute::NoUnwind; > + RetAttribute = RetAttribute ^ Attribute::NoUnwind; > + useUpdatedAttrs = true; > + } > + if (RetAttribute & Attribute::NoReturn) { > + FnAttribute = FnAttribute | Attribute::NoReturn; > + RetAttribute = RetAttribute ^ Attribute::NoReturn; > + useUpdatedAttrs = true; > + } > + if (RetAttribute & Attribute::ReadOnly) { > + FnAttribute = FnAttribute | Attribute::ReadOnly; > + RetAttribute = RetAttribute ^ Attribute::ReadOnly; > + useUpdatedAttrs = true; > + } > + if (RetAttribute & Attribute::ReadNone) { > + FnAttribute = FnAttribute | Attribute::ReadNone; > + RetAttribute = RetAttribute ^ Attribute::ReadNone; > + useUpdatedAttrs = true; > + } > + } > + > + for (unsigned i = 0, e = Record.size(); i != e; i += 2) { > + if (useUpdatedAttrs && Record[i] == 0 > + && RetAttribute != Attribute::None) > + Attrs.push_back(AttributeWithIndex::get(0, RetAttribute)); > + else if (Record[i+1] != Attribute::None) > Attrs.push_back(AttributeWithIndex::get(Record[i], Record[i > +1])); > } > + if (useUpdatedAttrs && FnAttribute != Attribute::None) > + Attrs.push_back(AttributeWithIndex::get(~0, FnAttribute)); > > - Attributes.push_back(AttrListPtr::get(Attrs.begin(), > Attrs.end())); > + MAttributes.push_back(AttrListPtr::get(Attrs.begin(), > Attrs.end())); > Attrs.clear(); > break; > } > > Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.h?rev=56704&r1=56703&r2=56704&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.h (original) > +++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.h Fri Sep 26 > 17:53:05 2008 > @@ -136,10 +136,10 @@ > std::vector > GlobalInits; > std::vector > AliasInits; > > - /// Attributes - The set of parameter attributes by index. Index > zero in the > + /// MAttributes - The set of attributes by index. Index zero in > the > /// file is for null, and is thus not represented here. As such > all indices > /// are off by one. > - std::vector Attributes; > + std::vector MAttributes; > > /// FunctionBBs - While parsing a function body, this is a list of > the basic > /// blocks for the function. > @@ -204,8 +204,8 @@ > return FunctionBBs[ID]; > } > AttrListPtr getAttributes(unsigned i) const { > - if (i-1 < Attributes.size()) > - return Attributes[i-1]; > + if (i-1 < MAttributes.size()) > + return MAttributes[i-1]; > return AttrListPtr(); > } > > > Modified: llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp?rev=56704&r1=56703&r2=56704&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp (original) > +++ llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp Fri Sep 26 > 17:53:05 2008 > @@ -105,10 +105,10 @@ > MadeChange = true; > > // Clear out any existing attributes. > - F->removeAttribute(0, Attribute::ReadOnly | Attribute::ReadNone); > + F->removeAttribute(~0, Attribute::ReadOnly | > Attribute::ReadNone); > > // Add in the new attribute. > - F->addAttribute(0, ReadsMemory ? Attribute::ReadOnly : > Attribute::ReadNone); > + F->addAttribute(~0, ReadsMemory ? Attribute::ReadOnly : > Attribute::ReadNone); > > if (ReadsMemory) > NumReadOnly++; > > Modified: llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp?rev=56704&r1=56703&r2=56704&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp (original) > +++ llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp Fri Sep 26 > 17:53:05 2008 > @@ -508,7 +508,7 @@ > const AttrListPtr &PAL = F->getAttributes(); > > // Add any return attributes. > - if (Attributes attrs = PAL.getAttributes(0)) > + if (Attributes attrs = PAL.getRetAttributes()) > AttributesVec.push_back(AttributeWithIndex::get(0, attrs)); > > // First, determine the new argument list > @@ -525,7 +525,7 @@ > } else if (!ArgsToPromote.count(I)) { > // Unchanged argument > Params.push_back(I->getType()); > - if (Attributes attrs = PAL.getAttributes(ArgIndex)) > + if (Attributes attrs = PAL.getParamAttributes(ArgIndex)) > > AttributesVec.push_back(AttributeWithIndex::get(Params.size(), > attrs)); > } else if (I->use_empty()) { > // Dead argument (which are always marked as promotable) > @@ -578,6 +578,10 @@ > } > } > > + // Add any function attributes. > + if (Attributes attrs = PAL.getFnAttributes()) > + AttributesVec.push_back(AttributeWithIndex::get(~0, attrs)); > + > const Type *RetTy = FTy->getReturnType(); > > // Work around LLVM bug PR56: the CWriter cannot emit varargs > functions which > @@ -621,7 +625,7 @@ > const AttrListPtr &CallPAL = CS.getAttributes(); > > // Add any return attributes. > - if (Attributes attrs = CallPAL.getAttributes(0)) > + if (Attributes attrs = CallPAL.getRetAttributes()) > AttributesVec.push_back(AttributeWithIndex::get(0, attrs)); > > // Loop over the operands, inserting GEP and loads in the caller > as > @@ -633,7 +637,7 @@ > if (!ArgsToPromote.count(I) && !ByValArgsToTransform.count(I)) { > Args.push_back(*AI); // Unmodified argument > > - if (Attributes Attrs = CallPAL.getAttributes(ArgIndex)) > + if (Attributes Attrs = CallPAL.getParamAttributes(ArgIndex)) > > AttributesVec.push_back(AttributeWithIndex::get(Args.size(), Attrs)); > > } else if (ByValArgsToTransform.count(I)) { > @@ -688,10 +692,14 @@ > // Push any varargs arguments on the list > for (; AI != CS.arg_end(); ++AI, ++ArgIndex) { > Args.push_back(*AI); > - if (Attributes Attrs = CallPAL.getAttributes(ArgIndex)) > + if (Attributes Attrs = CallPAL.getParamAttributes(ArgIndex)) > AttributesVec.push_back(AttributeWithIndex::get(Args.size(), > Attrs)); > } > > + // Add any function attributes. > + if (Attributes attrs = CallPAL.getFnAttributes()) > + AttributesVec.push_back(AttributeWithIndex::get(~0, attrs)); > + > Instruction *New; > if (InvokeInst *II = dyn_cast(Call)) { > New = InvokeInst::Create(NF, II->getNormalDest(), II- > >getUnwindDest(), > > Modified: llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp?rev=56704&r1=56703&r2=56704&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp > (original) > +++ llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp Fri > Sep 26 17:53:05 2008 > @@ -229,6 +229,8 @@ > SmallVector AttributesVec; > for (unsigned i = 0; PAL.getSlot(i).Index <= NumArgs; ++i) > AttributesVec.push_back(PAL.getSlot(i)); > + if (Attributes FnAttrs = PAL.getFnAttributes()) > + AttributesVec.push_back(AttributeWithIndex::get(~0, > FnAttrs)); > PAL = AttrListPtr::get(AttributesVec.begin(), > AttributesVec.end()); > } > > @@ -593,8 +595,8 @@ > const AttrListPtr &PAL = F->getAttributes(); > > // The existing function return attributes. > - Attributes RAttrs = PAL.getAttributes(0); > - > + Attributes RAttrs = PAL.getRetAttributes(); > + Attributes FnAttrs = PAL.getFnAttributes(); > > // Find out the new return value. > > @@ -678,7 +680,7 @@ > > // Get the original parameter attributes (skipping the first > one, that is > // for the return value. > - if (Attributes Attrs = PAL.getAttributes(i + 1)) > + if (Attributes Attrs = PAL.getParamAttributes(i + 1)) > > AttributesVec.push_back(AttributeWithIndex::get(Params.size(), > Attrs)); > } else { > ++NumArgumentsEliminated; > @@ -687,6 +689,9 @@ > } > } > > + if (FnAttrs != Attribute::None) > + AttributesVec.push_back(AttributeWithIndex::get(~0, FnAttrs)); > + > // Reconstruct the AttributesList based on the vector we > constructed. > AttrListPtr NewPAL = AttrListPtr::get(AttributesVec.begin(), > AttributesVec.end()); > > @@ -730,7 +735,8 @@ > const AttrListPtr &CallPAL = CS.getAttributes(); > > // The call return attributes. > - Attributes RAttrs = CallPAL.getAttributes(0); > + Attributes RAttrs = CallPAL.getRetAttributes(); > + Attributes FnAttrs = CallPAL.getFnAttributes(); > // Adjust in case the function was changed to return void. > RAttrs &= ~Attribute::typeIncompatible(NF->getReturnType()); > if (RAttrs) > @@ -746,7 +752,7 @@ > if (ArgAlive[i]) { > Args.push_back(*I); > // Get original parameter attributes, but skip return > attributes. > - if (Attributes Attrs = CallPAL.getAttributes(i + 1)) > + if (Attributes Attrs = CallPAL.getParamAttributes(i + 1)) > > AttributesVec.push_back(AttributeWithIndex::get(Args.size(), Attrs)); > } > > @@ -756,13 +762,16 @@ > // Push any varargs arguments on the list. Don't forget their > attributes. > for (CallSite::arg_iterator E = CS.arg_end(); I != E; ++I, ++i) { > Args.push_back(*I); > - if (Attributes Attrs = CallPAL.getAttributes(i + 1)) > + if (Attributes Attrs = CallPAL.getParamAttributes(i + 1)) > AttributesVec.push_back(AttributeWithIndex::get(Args.size(), > Attrs)); > } > > + if (FnAttrs != Attribute::None) > + AttributesVec.push_back(AttributeWithIndex::get(~0, FnAttrs)); > + > // Reconstruct the AttributesList based on the vector we > constructed. > AttrListPtr NewCallPAL = AttrListPtr::get(AttributesVec.begin(), > - AttributesVec.end()); > + AttributesVec.end()); > > Instruction *New; > if (InvokeInst *II = dyn_cast(Call)) { > > Modified: llvm/trunk/lib/Transforms/IPO/PruneEH.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/PruneEH.cpp?rev=56704&r1=56703&r2=56704&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Transforms/IPO/PruneEH.cpp (original) > +++ llvm/trunk/lib/Transforms/IPO/PruneEH.cpp Fri Sep 26 17:53:05 2008 > @@ -133,7 +133,7 @@ > NewAttributes |= Attribute::NoReturn; > > const AttrListPtr &PAL = SCC[i]->getFunction()->getAttributes(); > - const AttrListPtr &NPAL = PAL.addAttr(0, NewAttributes); > + const AttrListPtr &NPAL = PAL.addAttr(~0, NewAttributes); > if (PAL != NPAL) { > MadeChange = true; > SCC[i]->getFunction()->setAttributes(NPAL); > > Modified: llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp?rev=56704&r1=56703&r2=56704&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp (original) > +++ llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp Fri Sep 26 > 17:53:05 2008 > @@ -210,7 +210,7 @@ > const AttrListPtr &PAL = F->getAttributes(); > > // Add any return attributes. > - if (Attributes attrs = PAL.getAttributes(0)) > + if (Attributes attrs = PAL.getRetAttributes()) > AttributesVec.push_back(AttributeWithIndex::get(0, attrs)); > > // Skip first argument. > @@ -221,12 +221,17 @@ > unsigned ParamIndex = 2; > while (I != E) { > Params.push_back(I->getType()); > - if (Attributes Attrs = PAL.getAttributes(ParamIndex)) > + if (Attributes Attrs = PAL.getParamAttributes(ParamIndex)) > AttributesVec.push_back(AttributeWithIndex::get(ParamIndex - > 1, Attrs)); > ++I; > ++ParamIndex; > } > > + // Add any fn attributes. > + if (Attributes attrs = PAL.getFnAttributes()) > + AttributesVec.push_back(AttributeWithIndex::get(~0, attrs)); > + > + > FunctionType *NFTy = FunctionType::get(STy, Params, FTy- > >isVarArg()); > Function *NF = Function::Create(NFTy, F->getLinkage()); > NF->takeName(F); > @@ -264,7 +269,7 @@ > > const AttrListPtr &PAL = F->getAttributes(); > // Add any return attributes. > - if (Attributes attrs = PAL.getAttributes(0)) > + if (Attributes attrs = PAL.getRetAttributes()) > ArgAttrsVec.push_back(AttributeWithIndex::get(0, attrs)); > > // Copy arguments, however skip first one. > @@ -276,12 +281,15 @@ > unsigned ParamIndex = 2; > while (AI != AE) { > Args.push_back(*AI); > - if (Attributes Attrs = PAL.getAttributes(ParamIndex)) > + if (Attributes Attrs = PAL.getParamAttributes(ParamIndex)) > ArgAttrsVec.push_back(AttributeWithIndex::get(ParamIndex - > 1, Attrs)); > ++ParamIndex; > ++AI; > } > > + // Add any function attributes. > + if (Attributes attrs = PAL.getFnAttributes()) > + ArgAttrsVec.push_back(AttributeWithIndex::get(~0, attrs)); > > AttrListPtr NewPAL = AttrListPtr::get(ArgAttrsVec.begin(), > ArgAttrsVec.end()); > > > Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=56704&r1=56703&r2=56704&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp > (original) > +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Fri > Sep 26 17:53:05 2008 > @@ -9127,7 +9127,7 @@ > return false; // Cannot transform this return value. > > if (!CallerPAL.isEmpty() && !Caller->use_empty()) { > - Attributes RAttrs = CallerPAL.getAttributes(0); > + Attributes RAttrs = CallerPAL.getRetAttributes(); > if (RAttrs & Attribute::typeIncompatible(NewRetTy)) > return false; // Attribute not compatible with transformed > value. > } > @@ -9157,7 +9157,8 @@ > if (!CastInst::isCastable(ActTy, ParamTy)) > return false; // Cannot transform this parameter value. > > - if (CallerPAL.getAttributes(i + 1) & > Attribute::typeIncompatible(ParamTy)) > + if (CallerPAL.getParamAttributes(i + 1) > + & Attribute::typeIncompatible(ParamTy)) > return false; // Attribute not compatible with transformed > value. > > // Converting from one pointer type to another or between a > pointer and an > @@ -9193,7 +9194,7 @@ > attrVec.reserve(NumCommonArgs); > > // Get any return attributes. > - Attributes RAttrs = CallerPAL.getAttributes(0); > + Attributes RAttrs = CallerPAL.getRetAttributes(); > > // If the return value is not being used, the type may not be > compatible > // with the existing attributes. Wipe out any problematic > attributes. > @@ -9216,7 +9217,7 @@ > } > > // Add any parameter attributes. > - if (Attributes PAttrs = CallerPAL.getAttributes(i + 1)) > + if (Attributes PAttrs = CallerPAL.getParamAttributes(i + 1)) > attrVec.push_back(AttributeWithIndex::get(i + 1, PAttrs)); > } > > @@ -9246,12 +9247,15 @@ > } > > // Add any parameter attributes. > - if (Attributes PAttrs = CallerPAL.getAttributes(i + 1)) > + if (Attributes PAttrs = CallerPAL.getParamAttributes(i + 1)) > attrVec.push_back(AttributeWithIndex::get(i + 1, PAttrs)); > } > } > } > > + if (Attributes FnAttrs = CallerPAL.getFnAttributes()) > + attrVec.push_back(AttributeWithIndex::get(~0, FnAttrs)); > + > if (NewRetTy == Type::VoidTy) > Caller->setName(""); // Void type should not have a name. > > @@ -9337,7 +9341,7 @@ > if (NestAttrs.paramHasAttr(NestIdx, Attribute::Nest)) { > // Record the parameter type and any other attributes. > NestTy = *I; > - NestAttr = NestAttrs.getAttributes(NestIdx); > + NestAttr = NestAttrs.getParamAttributes(NestIdx); > break; > } > > @@ -9352,8 +9356,8 @@ > // Insert the nest argument into the call argument list, which > may > // mean appending it. Likewise for attributes. > > - // Add any function result attributes. > - if (Attributes Attr = Attrs.getAttributes(0)) > + // Add any result attributes. > + if (Attributes Attr = Attrs.getRetAttributes()) > NewAttrs.push_back(AttributeWithIndex::get(0, Attr)); > > { > @@ -9374,7 +9378,7 @@ > > // Add the original argument and attributes. > NewArgs.push_back(*I); > - if (Attributes Attr = Attrs.getAttributes(Idx)) > + if (Attributes Attr = Attrs.getParamAttributes(Idx)) > NewAttrs.push_back > (AttributeWithIndex::get(Idx + (Idx >= NestIdx), Attr)); > > @@ -9382,6 +9386,10 @@ > } while (1); > } > > + // Add any function attributes. > + if (Attributes Attr = Attrs.getFnAttributes()) > + NewAttrs.push_back(AttributeWithIndex::get(~0, Attr)); > + > // The trampoline may have been bitcast to a bogus type (FTy). > // Handle this by synthesizing a new function type, equal to FTy > // with the chain parameter inserted. > > Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=56704&r1=56703&r2=56704&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original) > +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Fri Sep 26 17:53:05 2008 > @@ -1374,7 +1374,7 @@ > I != E; ++I) { > // Insert commas as we go... the first arg doesn't get a comma > if (I != F->arg_begin()) Out << ", "; > - printArgument(I, Attrs.getAttributes(Idx)); > + printArgument(I, Attrs.getParamAttributes(Idx)); > Idx++; > } > } else { > @@ -1386,7 +1386,7 @@ > // Output type... > printType(FT->getParamType(i)); > > - Attributes ArgAttrs = Attrs.getAttributes(i+1); > + Attributes ArgAttrs = Attrs.getParamAttributes(i+1); > if (ArgAttrs != Attribute::None) > Out << ' ' << Attribute::getAsString(ArgAttrs); > } > @@ -1398,9 +1398,12 @@ > Out << "..."; // Output varargs portion of signature! > } > Out << ')'; > - Attributes RetAttrs = Attrs.getAttributes(0); > + Attributes RetAttrs = Attrs.getRetAttributes(); > if (RetAttrs != Attribute::None) > - Out << ' ' << Attribute::getAsString(Attrs.getAttributes(0)); > + Out << ' ' << Attribute::getAsString(Attrs.getRetAttributes()); > + Attributes FnAttrs = Attrs.getFnAttributes(); > + if (FnAttrs != Attribute::None) > + Out << ' ' << Attribute::getAsString(Attrs.getFnAttributes()); > if (F->hasSection()) > Out << " section \"" << F->getSection() << '"'; > if (F->getAlignment()) > @@ -1660,11 +1663,13 @@ > for (unsigned op = 1, Eop = I.getNumOperands(); op < Eop; ++op) { > if (op > 1) > Out << ", "; > - writeParamOperand(I.getOperand(op), PAL.getAttributes(op)); > + writeParamOperand(I.getOperand(op), > PAL.getParamAttributes(op)); > } > Out << ')'; > - if (PAL.getAttributes(0) != Attribute::None) > - Out << ' ' << Attribute::getAsString(PAL.getAttributes(0)); > + if (PAL.getRetAttributes() != Attribute::None) > + Out << ' ' << Attribute::getAsString(PAL.getRetAttributes()); > + if (PAL.getFnAttributes() != Attribute::None) > + Out << ' ' << Attribute::getAsString(PAL.getFnAttributes()); > } else if (const InvokeInst *II = dyn_cast(&I)) { > const PointerType *PTy = cast(Operand->getType()); > const FunctionType *FTy = cast(PTy- > >getElementType()); > @@ -1699,12 +1704,15 @@ > for (unsigned op = 3, Eop = I.getNumOperands(); op < Eop; ++op) { > if (op > 3) > Out << ", "; > - writeParamOperand(I.getOperand(op), PAL.getAttributes(op-2)); > + writeParamOperand(I.getOperand(op), > PAL.getParamAttributes(op-2)); > } > > Out << ')'; > - if (PAL.getAttributes(0) != Attribute::None) > - Out << ' ' << Attribute::getAsString(PAL.getAttributes(0)); > + if (PAL.getRetAttributes() != Attribute::None) > + Out << ' ' << Attribute::getAsString(PAL.getRetAttributes()); > + if (PAL.getFnAttributes() != Attribute::None) > + Out << ' ' << Attribute::getAsString(PAL.getFnAttributes()); > + > Out << "\n\t\t\tto "; > writeOperand(II->getNormalDest(), true); > Out << " unwind "; > > Modified: llvm/trunk/lib/VMCore/Attributes.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Attributes.cpp?rev=56704&r1=56703&r2=56704&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/VMCore/Attributes.cpp (original) > +++ llvm/trunk/lib/VMCore/Attributes.cpp Fri Sep 26 17:53:05 2008 > @@ -47,6 +47,12 @@ > Result += "readnone "; > if (Attrs & Attribute::ReadOnly) > Result += "readonly "; > + if (Attrs & Attribute::OptimizeForSize) > + Result += "optsize "; > + if (Attrs & Attribute::NoInline) > + Result += "noinline "; > + if (Attrs & Attribute::AlwaysInline) > + Result += "alwaysinline "; > if (Attrs & Attribute::Alignment) { > Result += "align "; > Result += utostr((Attrs & Attribute::Alignment) >> 16); > > Modified: llvm/trunk/lib/VMCore/Function.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Function.cpp?rev=56704&r1=56703&r2=56704&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/VMCore/Function.cpp (original) > +++ llvm/trunk/lib/VMCore/Function.cpp Fri Sep 26 17:53:05 2008 > @@ -365,7 +365,7 @@ > // Intrinsics cannot throw exceptions. > Attr |= Attribute::NoUnwind; > > - AttributeWithIndex PAWI = AttributeWithIndex::get(0, Attr); > + AttributeWithIndex PAWI = AttributeWithIndex::get(~0, Attr); > return AttrListPtr::get(&PAWI, 1); > } > > > Modified: llvm/trunk/lib/VMCore/Verifier.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=56704&r1=56703&r2=56704&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/VMCore/Verifier.cpp (original) > +++ llvm/trunk/lib/VMCore/Verifier.cpp Fri Sep 26 17:53:05 2008 > @@ -975,7 +975,7 @@ > if (FTy->isVarArg()) > // Check attributes on the varargs part. > for (unsigned Idx = 1 + FTy->getNumParams(); Idx <= > CS.arg_size(); ++Idx) { > - Attributes Attr = Attrs.getAttributes(Idx); > + Attributes Attr = Attrs.getParamAttributes(Idx); > > VerifyAttrs(Attr, CS.getArgument(Idx-1)->getType(), false, I); > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From gohman at apple.com Tue Sep 30 13:30:37 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 30 Sep 2008 18:30:37 -0000 Subject: [llvm-commits] [llvm] r56867 - in /llvm/trunk: include/llvm/CodeGen/DAGISelHeader.h include/llvm/CodeGen/SelectionDAG.h include/llvm/CodeGen/SelectionDAGISel.h lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Target/X86/X86ISelDAGToDAG.cpp Message-ID: <200809301830.m8UIUcNM031465@zion.cs.uiuc.edu> Author: djg Date: Tue Sep 30 13:30:35 2008 New Revision: 56867 URL: http://llvm.org/viewvc/llvm-project?rev=56867&view=rev Log: Optimize SelectionDAG's AssignTopologicalOrder even further. Completely eliminate the TopOrder std::vector. Instead, sort the AllNodes list in place. This also eliminates the need to call AllNodes.size(), a linear-time operation, before performing the sort. Also, eliminate the Sources temporary std::vector, since it essentially duplicates the sorted result as it is being built. This also changes the direction of the topological sort from bottom-up to top-down. The AllNodes list starts out in roughly top-down order, so this reduces the amount of reordering needed. Top-down is also more convenient for Legalize, and ISel needed only minor adjustments. Modified: llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h llvm/trunk/include/llvm/CodeGen/SelectionDAG.h llvm/trunk/include/llvm/CodeGen/SelectionDAGISel.h llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Modified: llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h?rev=56867&r1=56866&r2=56867&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h (original) +++ llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h Tue Sep 30 13:30:35 2008 @@ -18,7 +18,7 @@ #define LLVM_CODEGEN_DAGISEL_HEADER_H /// ISelQueue - Instruction selector priority queue sorted -/// in the order of increasing NodeId() values. +/// in the order of decreasing NodeId() values. std::vector ISelQueue; /// Keep track of nodes which have already been added to queue. @@ -43,10 +43,10 @@ } /// isel_sort - Sorting functions for the selection queue in the -/// increasing NodeId order. +/// decreasing NodeId order. struct isel_sort : public std::binary_function { bool operator()(const SDNode* left, const SDNode* right) const { - return (left->getNodeId() > right->getNodeId()); + return left->getNodeId() < right->getNodeId(); } }; @@ -108,7 +108,7 @@ }; /// UpdateQueue - update the instruction selction queue to maintain -/// the increasing NodeId() ordering property. +/// the decreasing NodeId() ordering property. inline void UpdateQueue(const ISelQueueUpdater &ISQU) { if (ISQU.hadDelete()) std::make_heap(ISelQueue.begin(), ISelQueue.end(),isel_sort()); Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=56867&r1=56866&r2=56867&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Tue Sep 30 13:30:35 2008 @@ -663,10 +663,10 @@ unsigned Num, DAGUpdateListener *UpdateListener = 0); - /// AssignTopologicalOrder - Assign a unique node id for each node in the DAG - /// based on their topological order. It returns the maximum id and a vector - /// of the SDNodes* in assigned order by reference. - unsigned AssignTopologicalOrder(std::vector &TopOrder); + /// AssignTopologicalOrder - Topological-sort the AllNodes list and a + /// assign a unique node id for each node in the DAG based on their + /// topological order. Returns the number of nodes. + unsigned AssignTopologicalOrder(); /// isCommutativeBinOp - Returns true if the opcode is a commutative binary /// operation. Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGISel.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGISel.h?rev=56867&r1=56866&r2=56867&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAGISel.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAGISel.h Tue Sep 30 13:30:35 2008 @@ -48,7 +48,6 @@ AliasAnalysis *AA; GCFunctionInfo *GFI; bool Fast; - std::vector TopOrder; static char ID; explicit SelectionDAGISel(TargetLowering &tli, bool fast = false); @@ -67,7 +66,7 @@ virtual void InstructionSelectPostProcessing() {} void SelectRootInit() { - DAGSize = CurDAG->AssignTopologicalOrder(TopOrder); + DAGSize = CurDAG->AssignTopologicalOrder(); } /// SelectInlineAsmMemoryOperand - Select the specified address as a target Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=56867&r1=56866&r2=56867&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Tue Sep 30 13:30:35 2008 @@ -280,11 +280,10 @@ // practice however, this causes us to run out of stack space on large basic // blocks. To avoid this problem, compute an ordering of the nodes where each // node is only legalized after all of its operands are legalized. - std::vector TopOrder; - unsigned N = DAG.AssignTopologicalOrder(TopOrder); - for (unsigned i = N; i != 0; --i) - HandleOp(SDValue(TopOrder[i-1], 0)); - TopOrder.clear(); + DAG.AssignTopologicalOrder(); + for (SelectionDAG::allnodes_iterator I = DAG.allnodes_begin(), + E = prior(DAG.allnodes_end()); I != next(E); ++I) + HandleOp(SDValue(I, 0)); // Finally, it's possible the root changed. Get the new root. SDValue OldRoot = DAG.getRoot(); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=56867&r1=56866&r2=56867&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Sep 30 13:30:35 2008 @@ -587,7 +587,7 @@ void SelectionDAG::DeleteNodeNotInCSEMaps(SDNode *N) { - // Drop all of the operands and decrement used nodes use counts. + // Drop all of the operands and decrement used node's use counts. for (SDNode::op_iterator I = N->op_begin(), E = N->op_end(); I != E; ++I) I->getVal()->removeUser(std::distance(N->op_begin(), I), N); if (N->OperandsNeedDelete) @@ -4569,38 +4569,74 @@ /// AssignTopologicalOrder - Assign a unique node id for each node in the DAG /// based on their topological order. It returns the maximum id and a vector /// of the SDNodes* in assigned order by reference. -unsigned SelectionDAG::AssignTopologicalOrder(std::vector &TopOrder) { - unsigned DAGSize = AllNodes.size(); - std::vector Sources; +unsigned SelectionDAG::AssignTopologicalOrder() { - for (allnodes_iterator I = allnodes_begin(),E = allnodes_end(); I != E; ++I){ + unsigned DAGSize = 0; + + // SortedPos tracks the progress of the algorithm. Nodes before it are + // sorted, nodes after it are unsorted. When the algorithm completes + // it is at the end of the list. + allnodes_iterator SortedPos = allnodes_begin(); + + // Visit all the nodes. Add nodes with no operands to the TopOrder result + // array immediately. Annotate nodes that do have operands with their + // operand count. Before we do this, the Node Id fields of the nodes + // may contain arbitrary values. After, the Node Id fields for nodes + // before SortedPos will contain the topological sort index, and the + // Node Id fields for nodes At SortedPos and after will contain the + // count of outstanding operands. + for (allnodes_iterator I = allnodes_begin(),E = allnodes_end(); I != E; ) { + SDNode *N = I++; + unsigned Degree = N->getNumOperands(); + if (Degree == 0) { + // A node with no uses, add it to the result array immediately. + N->setNodeId(DAGSize++); + allnodes_iterator Q = N; + if (Q != SortedPos) + SortedPos = AllNodes.insert(SortedPos, AllNodes.remove(Q)); + ++SortedPos; + } else { + // Temporarily use the Node Id as scratch space for the degree count. + N->setNodeId(Degree); + } + } + + // Visit all the nodes. As we iterate, moves nodes into sorted order, + // such that by the time the end is reached all nodes will be sorted. + for (allnodes_iterator I = allnodes_begin(),E = allnodes_end(); I != E; ++I) { SDNode *N = I; - unsigned Degree = N->use_size(); - // Temporarily use the Node Id as scratch space for the degree count. - N->setNodeId(Degree); - if (Degree == 0) - Sources.push_back(N); - } - - TopOrder.clear(); - TopOrder.reserve(DAGSize); - int Id = 0; - while (!Sources.empty()) { - SDNode *N = Sources.back(); - Sources.pop_back(); - TopOrder.push_back(N); - N->setNodeId(Id++); - for (SDNode::op_iterator I = N->op_begin(), E = N->op_end(); I != E; ++I) { - SDNode *P = I->getVal(); + for (SDNode::use_iterator UI = N->use_begin(), UE = N->use_end(); + UI != UE; ++UI) { + SDNode *P = *UI; unsigned Degree = P->getNodeId(); --Degree; - P->setNodeId(Degree); - if (Degree == 0) - Sources.push_back(P); + if (Degree == 0) { + // All of P's operands are sorted, so P may sorted now. + P->setNodeId(DAGSize++); + if (P != SortedPos) + SortedPos = AllNodes.insert(SortedPos, AllNodes.remove(P)); + ++SortedPos; + } else { + // Update P's outstanding operand count. + P->setNodeId(Degree); + } } } - return Id; + assert(SortedPos == AllNodes.end() && + "Topological sort incomplete!"); + assert(AllNodes.front().getOpcode() == ISD::EntryToken && + "First node in topological sort is not the entry token!"); + assert(AllNodes.front().getNodeId() == 0 && + "First node in topological sort has non-zero id!"); + assert(AllNodes.front().getNumOperands() == 0 && + "First node in topological sort has operands!"); + assert(AllNodes.back().getNodeId() == (int)DAGSize-1 && + "Last node in topologic sort has unexpected id!"); + assert(AllNodes.back().use_empty() && + "Last node in topologic sort has users!"); + assert(DAGSize == allnodes_size() && "TopOrder result count mismatch!"); + return DAGSize; } Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=56867&r1=56866&r2=56867&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Tue Sep 30 13:30:35 2008 @@ -269,7 +269,7 @@ SDNode *Root, bool &found, SmallPtrSet &Visited) { if (found || - Use->getNodeId() > Def->getNodeId() || + Use->getNodeId() < Def->getNodeId() || !Visited.insert(Use)) return; From nunoplopes at sapo.pt Mon Sep 29 09:40:33 2008 From: nunoplopes at sapo.pt (Nuno Lopes) Date: Mon, 29 Sep 2008 14:40:33 -0000 Subject: [llvm-commits] [llvm] r56786 - /llvm/trunk/lib/Transforms/IPO/IPConstantPropagation.cpp Message-ID: <200809291440.m8TEeXwn005762@zion.cs.uiuc.edu> Author: nlopes Date: Mon Sep 29 09:40:32 2008 New Revision: 56786 URL: http://llvm.org/viewvc/llvm-project?rev=56786&view=rev Log: remove redundant test (mayBeOverriden() includes hasLinkOnceLinkage) Modified: llvm/trunk/lib/Transforms/IPO/IPConstantPropagation.cpp Modified: llvm/trunk/lib/Transforms/IPO/IPConstantPropagation.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/IPConstantPropagation.cpp?rev=56786&r1=56785&r2=56786&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/IPConstantPropagation.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/IPConstantPropagation.cpp Mon Sep 29 09:40:32 2008 @@ -155,7 +155,7 @@ // If this function could be overridden later in the link stage, we can't // propagate information about its results into callers. - if (F.hasLinkOnceLinkage() || F.mayBeOverridden()) + if (F.mayBeOverridden()) return false; // Check to see if this function returns a constant. From anon at cs.uiuc.edu Tue Sep 30 10:25:15 2008 From: anon at cs.uiuc.edu (anon at cs.uiuc.edu) Date: Tue, 30 Sep 2008 10:25:15 -0500 Subject: [llvm-commits] CVS: llvm-www/Features.html Message-ID: <200809301525.m8UFPF3u025566@zion.cs.uiuc.edu> Changes in directory llvm-www: Features.html updated: 1.20 -> 1.21 --- Log message: Remove dead stacker links. --- Diffs of the changes: (+6 -9) Features.html | 15 ++++++--------- 1 files changed, 6 insertions(+), 9 deletions(-) Index: llvm-www/Features.html diff -u llvm-www/Features.html:1.20 llvm-www/Features.html:1.21 --- llvm-www/Features.html:1.20 Thu Mar 1 14:46:19 2007 +++ llvm-www/Features.html Tue Sep 30 10:23:58 2008 @@ -8,8 +8,6 @@
  • Front-ends for C and C++ based on the GCC 3.4 and 4.0.1 parsers. They support the ANSI-standard C and C++ languages to the same degree that GCC supports them. Additionally, many GCC extensions are supported. - LLVM also includes a front-end for "Stacker", - a Forth-like language.
  • A stable implementation of the LLVM instruction set, which serves as both the online and offline code representation, together with assembly @@ -54,9 +52,8 @@ strictly defined semantics.
  • It includes front-ends for C, - C++, and Stacker (a forth-like language). Front-ends for + href="docs/CommandGuide/html/llvmgcc.html">C and + C++. Front-ends for Java, Scheme, and other languages are in development.
  • It includes an aggressive optimizer, including scalar, interprocedural, @@ -77,10 +74,10 @@ hosted many projects of various sorts.
  • Many third-party users have claimed that LLVM is easy to work with and - develop for. For example, the Stacker front-end was written in 4 days by someone who started - knowing nothing about LLVM. Additionally, LLVM has tools to make development easier.
  • + develop for. For example, the (now removed) Stacker front-end was written + in 4 days by someone who started knowing nothing about LLVM. Additionally, + LLVM has tools to make + development easier.
  • LLVM is under active development and is constantly being extended, enhanced and improved. See the status updates on the left bar to see the rate From nunoplopes at sapo.pt Tue Sep 30 13:15:08 2008 From: nunoplopes at sapo.pt (Nuno Lopes) Date: Tue, 30 Sep 2008 18:15:08 -0000 Subject: [llvm-commits] [llvm] r56866 - /llvm/trunk/test/Transforms/AddReadAttrs/ Message-ID: <200809301815.m8UIF8lT031051@zion.cs.uiuc.edu> Author: nlopes Date: Tue Sep 30 13:15:04 2008 New Revision: 56866 URL: http://llvm.org/viewvc/llvm-project?rev=56866&view=rev Log: ignore generated files Modified: llvm/trunk/test/Transforms/AddReadAttrs/ (props changed) Propchange: llvm/trunk/test/Transforms/AddReadAttrs/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Tue Sep 30 13:15:04 2008 @@ -0,0 +1,3 @@ +Output +*.log +*.sum From nunoplopes at sapo.pt Tue Sep 30 13:34:38 2008 From: nunoplopes at sapo.pt (Nuno Lopes) Date: Tue, 30 Sep 2008 18:34:38 -0000 Subject: [llvm-commits] [llvm] r56868 - /llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp Message-ID: <200809301834.m8UIYcXO031597@zion.cs.uiuc.edu> Author: nlopes Date: Tue Sep 30 13:34:38 2008 New Revision: 56868 URL: http://llvm.org/viewvc/llvm-project?rev=56868&view=rev Log: add AU.setPreservesCFG() since this pass only adds and removes function attributes Modified: llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp Modified: llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp?rev=56868&r1=56867&r2=56868&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp Tue Sep 30 13:34:38 2008 @@ -35,6 +35,11 @@ // runOnSCC - Analyze the SCC, performing the transformation if possible. bool runOnSCC(const std::vector &SCC); + + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.setPreservesCFG(); + CallGraphSCCPass::getAnalysisUsage(AU); + } }; } From echristo at apple.com Tue Sep 30 13:48:08 2008 From: echristo at apple.com (Eric Christopher) Date: Tue, 30 Sep 2008 11:48:08 -0700 Subject: [llvm-commits] [llvm] r56704 - in /llvm/trunk: include/llvm/ lib/AsmParser/ lib/Bitcode/Reader/ lib/Transforms/IPO/ lib/Transforms/Scalar/ lib/VMCore/ In-Reply-To: <47701548-D636-4DAB-8C58-2B8084B772DD@apple.com> References: <200809262253.m8QMr8A4018093@zion.cs.uiuc.edu> <47701548-D636-4DAB-8C58-2B8084B772DD@apple.com> Message-ID: Me too. It's driving llvm-as nuts. Sent from my iPhone On Sep 30, 2008, at 11:20 AM, Evan Cheng wrote: > I am seeing duplicated nounwind on calls: > call void @BlockMoveData(i8* %4, i8* %209, i32 16) nounwind > nounwind > > This appears to be introduced between 56697 and 56711. Can someone > take a look? > > Thanks, > > Evan > > On Sep 26, 2008, at 3:53 PM, Devang Patel wrote: > >> Author: dpatel >> Date: Fri Sep 26 17:53:05 2008 >> New Revision: 56704 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=56704&view=rev >> Log: >> Now Attributes are divided in three groups >> - return attributes - inreg, zext and sext >> - parameter attributes >> - function attributes - nounwind, readonly, readnone, noreturn >> >> Return attributes use 0 as the index. >> Function attributes use ~0U as the index. >> >> This patch requires corresponding changes in llvm-gcc and clang. >> >> Modified: >> llvm/trunk/include/llvm/Attributes.h >> llvm/trunk/include/llvm/Function.h >> llvm/trunk/include/llvm/Instructions.h >> llvm/trunk/lib/AsmParser/llvmAsmParser.y >> llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs >> llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp >> llvm/trunk/lib/Bitcode/Reader/BitcodeReader.h >> llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp >> llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp >> llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp >> llvm/trunk/lib/Transforms/IPO/PruneEH.cpp >> llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp >> llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp >> llvm/trunk/lib/VMCore/AsmWriter.cpp >> llvm/trunk/lib/VMCore/Attributes.cpp >> llvm/trunk/lib/VMCore/Function.cpp >> llvm/trunk/lib/VMCore/Verifier.cpp >> >> Modified: llvm/trunk/include/llvm/Attributes.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Attributes.h?rev=56704&r1=56703&r2=56704&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> === >> =================================================================== >> --- llvm/trunk/include/llvm/Attributes.h (original) >> +++ llvm/trunk/include/llvm/Attributes.h Fri Sep 26 17:53:05 2008 >> @@ -146,10 +146,23 @@ >> // >> = >> = >> =-------------------------------------------------------------------- >> ===// >> // Attribute List Accessors >> // >> = >> = >> =-------------------------------------------------------------------- >> ===// >> - >> - /// getAttributes - The attributes for the specified index are >> - /// returned. Attributes for the result are denoted with Idx = 0. >> - Attributes getAttributes(unsigned Idx) const; >> + /// getParamAttributes - The attributes for the specified index >> are >> + /// returned. >> + Attributes getParamAttributes(unsigned Idx) const { >> + assert (Idx && Idx != ~0U && "Invalid parameter index!"); >> + return getAttributes(Idx); >> + } >> + >> + /// getRetAttributes - The attributes for the ret value are >> + /// returned. >> + Attributes getRetAttributes() const { >> + return getAttributes(0); >> + } >> + >> + /// getFnAttributes - The function attributes are returned. >> + Attributes getFnAttributes() const { >> + return getAttributes(~0); >> + } >> >> /// paramHasAttr - Return true if the specified parameter index >> has the >> /// specified attribute set. >> @@ -204,6 +217,11 @@ >> >> private: >> explicit AttrListPtr(AttributeListImpl *L); >> + >> + /// getAttributes - The attributes for the specified index are >> + /// returned. Attributes for the result are denoted with Idx = 0. >> + Attributes getAttributes(unsigned Idx) const; >> + >> }; >> >> } // End llvm namespace >> >> Modified: llvm/trunk/include/llvm/Function.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Function.h?rev=56704&r1=56703&r2=56704&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> === >> =================================================================== >> --- llvm/trunk/include/llvm/Function.h (original) >> +++ llvm/trunk/include/llvm/Function.h Fri Sep 26 17:53:05 2008 >> @@ -187,38 +187,38 @@ >> >> /// @brief Determine if the function does not access memory. >> bool doesNotAccessMemory() const { >> - return paramHasAttr(0, Attribute::ReadNone); >> + return paramHasAttr(~0, Attribute::ReadNone); >> } >> void setDoesNotAccessMemory(bool DoesNotAccessMemory = true) { >> - if (DoesNotAccessMemory) addAttribute(0, Attribute::ReadNone); >> - else removeAttribute(0, Attribute::ReadNone); >> + if (DoesNotAccessMemory) addAttribute(~0, Attribute::ReadNone); >> + else removeAttribute(~0, Attribute::ReadNone); >> } >> >> /// @brief Determine if the function does not access or only reads >> memory. >> bool onlyReadsMemory() const { >> - return doesNotAccessMemory() || paramHasAttr(0, >> Attribute::ReadOnly); >> + return doesNotAccessMemory() || paramHasAttr(~0, >> Attribute::ReadOnly); >> } >> void setOnlyReadsMemory(bool OnlyReadsMemory = true) { >> - if (OnlyReadsMemory) addAttribute(0, Attribute::ReadOnly); >> - else removeAttribute(0, Attribute::ReadOnly | >> Attribute::ReadNone); >> + if (OnlyReadsMemory) addAttribute(~0, Attribute::ReadOnly); >> + else removeAttribute(~0, Attribute::ReadOnly | >> Attribute::ReadNone); >> } >> >> /// @brief Determine if the function cannot return. >> bool doesNotReturn() const { >> - return paramHasAttr(0, Attribute::NoReturn); >> + return paramHasAttr(~0, Attribute::NoReturn); >> } >> void setDoesNotReturn(bool DoesNotReturn = true) { >> - if (DoesNotReturn) addAttribute(0, Attribute::NoReturn); >> - else removeAttribute(0, Attribute::NoReturn); >> + if (DoesNotReturn) addAttribute(~0, Attribute::NoReturn); >> + else removeAttribute(~0, Attribute::NoReturn); >> } >> >> /// @brief Determine if the function cannot unwind. >> bool doesNotThrow() const { >> - return paramHasAttr(0, Attribute::NoUnwind); >> + return paramHasAttr(~0, Attribute::NoUnwind); >> } >> void setDoesNotThrow(bool DoesNotThrow = true) { >> - if (DoesNotThrow) addAttribute(0, Attribute::NoUnwind); >> - else removeAttribute(0, Attribute::NoUnwind); >> + if (DoesNotThrow) addAttribute(~0, Attribute::NoUnwind); >> + else removeAttribute(~0, Attribute::NoUnwind); >> } >> >> /// @brief Determine if the function returns a structure through >> first >> >> Modified: llvm/trunk/include/llvm/Instructions.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instructions.h?rev=56704&r1=56703&r2=56704&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> === >> =================================================================== >> --- llvm/trunk/include/llvm/Instructions.h (original) >> +++ llvm/trunk/include/llvm/Instructions.h Fri Sep 26 17:53:05 2008 >> @@ -1097,38 +1097,38 @@ >> >> /// @brief Determine if the call does not access memory. >> bool doesNotAccessMemory() const { >> - return paramHasAttr(0, Attribute::ReadNone); >> + return paramHasAttr(~0, Attribute::ReadNone); >> } >> void setDoesNotAccessMemory(bool NotAccessMemory = true) { >> - if (NotAccessMemory) addAttribute(0, Attribute::ReadNone); >> - else removeAttribute(0, Attribute::ReadNone); >> + if (NotAccessMemory) addAttribute(~0, Attribute::ReadNone); >> + else removeAttribute(~0, Attribute::ReadNone); >> } >> >> /// @brief Determine if the call does not access or only reads >> memory. >> bool onlyReadsMemory() const { >> - return doesNotAccessMemory() || paramHasAttr(0, >> Attribute::ReadOnly); >> + return doesNotAccessMemory() || paramHasAttr(~0, >> Attribute::ReadOnly); >> } >> void setOnlyReadsMemory(bool OnlyReadsMemory = true) { >> - if (OnlyReadsMemory) addAttribute(0, Attribute::ReadOnly); >> - else removeAttribute(0, Attribute::ReadOnly | >> Attribute::ReadNone); >> + if (OnlyReadsMemory) addAttribute(~0, Attribute::ReadOnly); >> + else removeAttribute(~0, Attribute::ReadOnly | >> Attribute::ReadNone); >> } >> >> /// @brief Determine if the call cannot return. >> bool doesNotReturn() const { >> - return paramHasAttr(0, Attribute::NoReturn); >> + return paramHasAttr(~0, Attribute::NoReturn); >> } >> void setDoesNotReturn(bool DoesNotReturn = true) { >> - if (DoesNotReturn) addAttribute(0, Attribute::NoReturn); >> - else removeAttribute(0, Attribute::NoReturn); >> + if (DoesNotReturn) addAttribute(~0, Attribute::NoReturn); >> + else removeAttribute(~0, Attribute::NoReturn); >> } >> >> /// @brief Determine if the call cannot unwind. >> bool doesNotThrow() const { >> - return paramHasAttr(0, Attribute::NoUnwind); >> + return paramHasAttr(~0, Attribute::NoUnwind); >> } >> void setDoesNotThrow(bool DoesNotThrow = true) { >> - if (DoesNotThrow) addAttribute(0, Attribute::NoUnwind); >> - else removeAttribute(0, Attribute::NoUnwind); >> + if (DoesNotThrow) addAttribute(~0, Attribute::NoUnwind); >> + else removeAttribute(~0, Attribute::NoUnwind); >> } >> >> /// @brief Determine if the call returns a structure through first >> @@ -2459,35 +2459,35 @@ >> return paramHasAttr(0, Attribute::ReadNone); >> } >> void setDoesNotAccessMemory(bool NotAccessMemory = true) { >> - if (NotAccessMemory) addAttribute(0, Attribute::ReadNone); >> - else removeAttribute(0, Attribute::ReadNone); >> + if (NotAccessMemory) addAttribute(~0, Attribute::ReadNone); >> + else removeAttribute(~0, Attribute::ReadNone); >> } >> >> /// @brief Determine if the call does not access or only reads >> memory. >> bool onlyReadsMemory() const { >> - return doesNotAccessMemory() || paramHasAttr(0, >> Attribute::ReadOnly); >> + return doesNotAccessMemory() || paramHasAttr(~0, >> Attribute::ReadOnly); >> } >> void setOnlyReadsMemory(bool OnlyReadsMemory = true) { >> - if (OnlyReadsMemory) addAttribute(0, Attribute::ReadOnly); >> - else removeAttribute(0, Attribute::ReadOnly | >> Attribute::ReadNone); >> + if (OnlyReadsMemory) addAttribute(~0, Attribute::ReadOnly); >> + else removeAttribute(~0, Attribute::ReadOnly | >> Attribute::ReadNone); >> } >> >> /// @brief Determine if the call cannot return. >> bool doesNotReturn() const { >> - return paramHasAttr(0, Attribute::NoReturn); >> + return paramHasAttr(~0, Attribute::NoReturn); >> } >> void setDoesNotReturn(bool DoesNotReturn = true) { >> - if (DoesNotReturn) addAttribute(0, Attribute::NoReturn); >> - else removeAttribute(0, Attribute::NoReturn); >> + if (DoesNotReturn) addAttribute(~0, Attribute::NoReturn); >> + else removeAttribute(~0, Attribute::NoReturn); >> } >> >> /// @brief Determine if the call cannot unwind. >> bool doesNotThrow() const { >> - return paramHasAttr(0, Attribute::NoUnwind); >> + return paramHasAttr(~0, Attribute::NoUnwind); >> } >> void setDoesNotThrow(bool DoesNotThrow = true) { >> - if (DoesNotThrow) addAttribute(0, Attribute::NoUnwind); >> - else removeAttribute(0, Attribute::NoUnwind); >> + if (DoesNotThrow) addAttribute(~0, Attribute::NoUnwind); >> + else removeAttribute(~0, Attribute::NoUnwind); >> } >> >> /// @brief Determine if the call returns a structure through first >> >> Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.y >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.y?rev=56704&r1=56703&r2=56704&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> === >> =================================================================== >> --- llvm/trunk/lib/AsmParser/llvmAsmParser.y (original) >> +++ llvm/trunk/lib/AsmParser/llvmAsmParser.y Fri Sep 26 17:53:05 2008 >> @@ -2346,8 +2346,25 @@ >> >> std::vector ParamTypeList; >> SmallVector Attrs; >> - if ($7 != Attribute::None) >> - Attrs.push_back(AttributeWithIndex::get(0, $7)); >> + //FIXME : In 3.0, stop accepting zext, sext and inreg as optional >> function >> + //attributes. >> + Attributes RetAttrs = 0; >> + if ($7 != Attribute::None) { >> + if ($7 & Attribute::ZExt) { >> + RetAttrs = RetAttrs | Attribute::ZExt; >> + $7 = $7 ^ Attribute::ZExt; >> + } >> + if ($7 & Attribute::SExt) { >> + RetAttrs = RetAttrs | Attribute::SExt; >> + $7 = $7 ^ Attribute::SExt; >> + } >> + if ($7 & Attribute::InReg) { >> + RetAttrs = RetAttrs | Attribute::InReg; >> + $7 = $7 ^ Attribute::InReg; >> + } >> + if (RetAttrs != Attribute::None) >> + Attrs.push_back(AttributeWithIndex::get(0, RetAttrs)); >> + } >> if ($5) { // If there are arguments... >> unsigned index = 1; >> for (ArgListType::iterator I = $5->begin(); I != $5->end(); ++I, >> ++index) { >> @@ -2359,6 +2376,8 @@ >> Attrs.push_back(AttributeWithIndex::get(index, I->Attrs)); >> } >> } >> + if ($7 != Attribute::None) >> + Attrs.push_back(AttributeWithIndex::get(~0, $7)); >> >> bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == >> Type::VoidTy; >> if (isVarArg) ParamTypeList.pop_back(); >> @@ -2860,9 +2879,26 @@ >> CHECK_FOR_ERROR >> >> SmallVector Attrs; >> - if ($8 != Attribute::None) >> - Attrs.push_back(AttributeWithIndex::get(0, $8)); >> - >> + //FIXME : In 3.0, stop accepting zext, sext and inreg as >> optional function >> + //attributes. >> + Attributes RetAttrs = 0; >> + if ($8 != Attribute::None) { >> + if ($8 & Attribute::ZExt) { >> + RetAttrs = RetAttrs | Attribute::ZExt; >> + $8 = $8 ^ Attribute::ZExt; >> + } >> + if ($8 & Attribute::SExt) { >> + RetAttrs = RetAttrs | Attribute::SExt; >> + $8 = $8 ^ Attribute::SExt; >> + } >> + if ($8 & Attribute::InReg) { >> + RetAttrs = RetAttrs | Attribute::InReg; >> + $8 = $8 ^ Attribute::InReg; >> + } >> + if (RetAttrs != Attribute::None) >> + Attrs.push_back(AttributeWithIndex::get(0, RetAttrs)); >> + } >> + >> // Check the arguments >> ValueList Args; >> if ($6->empty()) { // Has no >> arguments? >> @@ -2897,7 +2933,8 @@ >> } else if (I != E || ArgI != ArgE) >> GEN_ERROR("Invalid number of parameters detected"); >> } >> - >> + if ($8 != Attribute::None) >> + Attrs.push_back(AttributeWithIndex::get(~0, $8)); >> AttrListPtr PAL; >> if (!Attrs.empty()) >> PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); >> @@ -3258,8 +3295,27 @@ >> >> // Set up the Attributes for the function >> SmallVector Attrs; >> - if ($8 != Attribute::None) >> - Attrs.push_back(AttributeWithIndex::get(0, $8)); >> + //FIXME : In 3.0, stop accepting zext, sext and inreg as >> optional function >> + //attributes. >> + Attributes RetAttrs = 0; >> + Attributes TmpAttr = $8; >> + if ($8 != Attribute::None) { >> + if ($8 & Attribute::ZExt) { >> + RetAttrs = RetAttrs | Attribute::ZExt; >> + $8 = $8 ^ Attribute::ZExt; >> + } >> + if ($8 & Attribute::SExt) { >> + RetAttrs = RetAttrs | Attribute::SExt; >> + $8 = $8 ^ Attribute::SExt; >> + } >> + if ($8 & Attribute::InReg) { >> + RetAttrs = RetAttrs | Attribute::InReg; >> + $8 = $8 ^ Attribute::InReg; >> + } >> + if (RetAttrs != Attribute::None) >> + Attrs.push_back(AttributeWithIndex::get(0, RetAttrs)); >> + } >> + >> // Check the arguments >> ValueList Args; >> if ($6->empty()) { // Has no >> arguments? >> @@ -3293,6 +3349,8 @@ >> } else if (I != E || ArgI != ArgE) >> GEN_ERROR("Invalid number of parameters detected"); >> } >> + if ($8 != Attribute::None) >> + Attrs.push_back(AttributeWithIndex::get(~0, $8)); >> >> // Finish off the Attributes and check them >> AttrListPtr PAL; >> >> Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs?rev=56704&r1=56703&r2=56704&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> === >> =================================================================== >> --- llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs (original) >> +++ llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs Fri Sep 26 17:53:05 >> 2008 >> @@ -2346,8 +2346,25 @@ >> >> std::vector From criswell at uiuc.edu Tue Sep 30 14:04:06 2008 From: criswell at uiuc.edu (John Criswell) Date: Tue, 30 Sep 2008 19:04:06 -0000 Subject: [llvm-commits] [poolalloc] r56869 - in /poolalloc/trunk: include/poolalloc/PoolAllocate.h lib/PoolAllocate/PASimple.cpp Message-ID: <200809301904.m8UJ46sL000944@zion.cs.uiuc.edu> Author: criswell Date: Tue Sep 30 14:04:05 2008 New Revision: 56869 URL: http://llvm.org/viewvc/llvm-project?rev=56869&view=rev Log: Fixed problem where we grabbed the equivalence classes from the wrong pass. Made GlobalECs an object local variable so that the values should exit even if the DSA results are invalidated. Modified: poolalloc/trunk/include/poolalloc/PoolAllocate.h poolalloc/trunk/lib/PoolAllocate/PASimple.cpp Modified: poolalloc/trunk/include/poolalloc/PoolAllocate.h URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/poolalloc/PoolAllocate.h?rev=56869&r1=56868&r2=56869&view=diff ============================================================================== --- poolalloc/trunk/include/poolalloc/PoolAllocate.h (original) +++ poolalloc/trunk/include/poolalloc/PoolAllocate.h Tue Sep 30 14:04:05 2008 @@ -366,7 +366,7 @@ class PoolAllocateSimple : public PoolAllocate { Value * TheGlobalPool; DSGraph * CombinedDSGraph; - EquivalenceClasses * GlobalECs; + EquivalenceClasses GlobalECs; TargetData * TD; public: static char ID; Modified: poolalloc/trunk/lib/PoolAllocate/PASimple.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PASimple.cpp?rev=56869&r1=56868&r2=56869&view=diff ============================================================================== --- poolalloc/trunk/lib/PoolAllocate/PASimple.cpp (original) +++ poolalloc/trunk/lib/PoolAllocate/PASimple.cpp Tue Sep 30 14:04:05 2008 @@ -120,8 +120,8 @@ // // Merge all of the DSNodes in the DSGraphs. // - GlobalECs = &(TDGraphs->getGlobalECs()); - CombinedDSGraph = new DSGraph (*GlobalECs, TD, &(ECGraphs->getGlobalsGraph())); + GlobalECs = ECGraphs->getGlobalECs(); + CombinedDSGraph = new DSGraph (GlobalECs, TD, &(ECGraphs->getGlobalsGraph())); //CombinedDSGraph.cloneInto (getGlobalsGraph()); for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) { if (ECGraphs->hasGraph (*I)) From alenhar2 at cs.uiuc.edu Tue Sep 30 14:12:36 2008 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Tue, 30 Sep 2008 19:12:36 -0000 Subject: [llvm-commits] [poolalloc] r56870 - in /poolalloc/trunk/lib/DSA: BottomUpClosure.cpp DataStructure.cpp Makefile Message-ID: <200809301912.m8UJCai8001466@zion.cs.uiuc.edu> Author: alenhar2 Date: Tue Sep 30 14:12:35 2008 New Revision: 56870 URL: http://llvm.org/viewvc/llvm-project?rev=56870&view=rev Log: TD expects all unresolved function calls to be in the GlobalsGraph Modified: poolalloc/trunk/lib/DSA/BottomUpClosure.cpp poolalloc/trunk/lib/DSA/DataStructure.cpp poolalloc/trunk/lib/DSA/Makefile Modified: poolalloc/trunk/lib/DSA/BottomUpClosure.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/BottomUpClosure.cpp?rev=56870&r1=56869&r2=56870&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/BottomUpClosure.cpp (original) +++ poolalloc/trunk/lib/DSA/BottomUpClosure.cpp Tue Sep 30 14:12:35 2008 @@ -57,8 +57,10 @@ unsigned NextID = 1; Function *MainFunc = M.getFunction("main"); - if (MainFunc) + if (MainFunc) { calculateGraphs(MainFunc, Stack, NextID, ValMap); + CloneAuxIntoGlobal(getDSGraph(*MainFunc)); + } // Calculate the graphs for any functions that are unreachable from main... for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) @@ -67,6 +69,7 @@ DOUT << "*** BU: Function unreachable from main: " << I->getName() << "\n"; calculateGraphs(I, Stack, NextID, ValMap); // Calculate all graphs. + CloneAuxIntoGlobal(getDSGraph(*I)); } // If we computed any temporary indcallgraphs, free them now. @@ -297,6 +300,14 @@ return MyID; // == Min } +void BUDataStructures::CloneAuxIntoGlobal(DSGraph& G) { + DSGraph& GG = *G.getGlobalsGraph(); + ReachabilityCloner RC(GG, G, 0); + + for(DSGraph::afc_iterator ii = G.afc_begin(), ee = G.afc_end(); + ii != ee; ++ii) + GG.getAuxFunctionCalls().push_front(RC.cloneCallSite(*ii)); +} // releaseMemory - If the pass pipeline is done with this pass, we can release // our memory... here... Modified: poolalloc/trunk/lib/DSA/DataStructure.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/DataStructure.cpp?rev=56870&r1=56869&r2=56870&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/DataStructure.cpp (original) +++ poolalloc/trunk/lib/DSA/DataStructure.cpp Tue Sep 30 14:12:35 2008 @@ -1368,6 +1368,22 @@ DestCS.addPtrArg(getClonedNH(SrcCS.getPtrArg(a))); } +DSCallSite ReachabilityCloner::cloneCallSite(const DSCallSite& SrcCS) { + std::vector Args; + for(unsigned x = 0; x < SrcCS.getNumPtrArgs(); ++x) + Args.push_back(getClonedNH(SrcCS.getPtrArg(x))); + if (SrcCS.isDirectCall()) + return DSCallSite(SrcCS.getCallSite(), + getClonedNH(SrcCS.getRetVal()), + SrcCS.getCalleeFunc(), + Args); + else + return DSCallSite(SrcCS.getCallSite(), + getClonedNH(SrcCS.getRetVal()), + getClonedNH(SrcCS.getCalleeNode()).getNode(), + Args); +} + //===----------------------------------------------------------------------===// // DSCallSite Implementation //===----------------------------------------------------------------------===// Modified: poolalloc/trunk/lib/DSA/Makefile URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/Makefile?rev=56870&r1=56869&r2=56870&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/Makefile (original) +++ poolalloc/trunk/lib/DSA/Makefile Tue Sep 30 14:12:35 2008 @@ -12,7 +12,7 @@ SHARED_LIBRARY=1 LIBRARYNAME = LLVMDataStructure -CFlags += -fPIC +CFlags += -fPIC -Wno-deprecated include $(LEVEL)/Makefile.common From dpatel at apple.com Tue Sep 30 14:17:29 2008 From: dpatel at apple.com (Devang Patel) Date: Tue, 30 Sep 2008 12:17:29 -0700 Subject: [llvm-commits] [llvm] r56704 - in /llvm/trunk: include/llvm/ lib/AsmParser/ lib/Bitcode/Reader/ lib/Transforms/IPO/ lib/Transforms/Scalar/ lib/VMCore/ In-Reply-To: <47701548-D636-4DAB-8C58-2B8084B772DD@apple.com> References: <200809262253.m8QMr8A4018093@zion.cs.uiuc.edu> <47701548-D636-4DAB-8C58-2B8084B772DD@apple.com> Message-ID: On Sep 30, 2008, at 11:20 AM, Evan Cheng wrote: > I am seeing duplicated nounwind on calls: > call void @BlockMoveData(i8* %4, i8* %209, i32 16) nounwind > nounwind > > This appears to be introduced between 56697 and 56711. Can someone > take a look? sure. 56820 (llvm-gcc patch) addressed these. If not, please send me a test case. Thanks, - Devang > > > Thanks, > > Evan > > On Sep 26, 2008, at 3:53 PM, Devang Patel wrote: > >> Author: dpatel >> Date: Fri Sep 26 17:53:05 2008 >> New Revision: 56704 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=56704&view=rev >> Log: >> Now Attributes are divided in three groups >> - return attributes - inreg, zext and sext >> - parameter attributes >> - function attributes - nounwind, readonly, readnone, noreturn >> >> Return attributes use 0 as the index. >> Function attributes use ~0U as the index. >> >> This patch requires corresponding changes in llvm-gcc and clang. >> >> Modified: >> llvm/trunk/include/llvm/Attributes.h >> llvm/trunk/include/llvm/Function.h >> llvm/trunk/include/llvm/Instructions.h >> llvm/trunk/lib/AsmParser/llvmAsmParser.y >> llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs >> llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp >> llvm/trunk/lib/Bitcode/Reader/BitcodeReader.h >> llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp >> llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp >> llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp >> llvm/trunk/lib/Transforms/IPO/PruneEH.cpp >> llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp >> llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp >> llvm/trunk/lib/VMCore/AsmWriter.cpp >> llvm/trunk/lib/VMCore/Attributes.cpp >> llvm/trunk/lib/VMCore/Function.cpp >> llvm/trunk/lib/VMCore/Verifier.cpp >> >> Modified: llvm/trunk/include/llvm/Attributes.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Attributes.h?rev=56704&r1=56703&r2=56704&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/include/llvm/Attributes.h (original) >> +++ llvm/trunk/include/llvm/Attributes.h Fri Sep 26 17:53:05 2008 >> @@ -146,10 +146,23 @@ >> // >> = >> = >> =-------------------------------------------------------------------- >> ===// >> // Attribute List Accessors >> // >> = >> = >> =-------------------------------------------------------------------- >> ===// >> - >> - /// getAttributes - The attributes for the specified index are >> - /// returned. Attributes for the result are denoted with Idx = 0. >> - Attributes getAttributes(unsigned Idx) const; >> + /// getParamAttributes - The attributes for the specified index >> are >> + /// returned. >> + Attributes getParamAttributes(unsigned Idx) const { >> + assert (Idx && Idx != ~0U && "Invalid parameter index!"); >> + return getAttributes(Idx); >> + } >> + >> + /// getRetAttributes - The attributes for the ret value are >> + /// returned. >> + Attributes getRetAttributes() const { >> + return getAttributes(0); >> + } >> + >> + /// getFnAttributes - The function attributes are returned. >> + Attributes getFnAttributes() const { >> + return getAttributes(~0); >> + } >> >> /// paramHasAttr - Return true if the specified parameter index >> has the >> /// specified attribute set. >> @@ -204,6 +217,11 @@ >> >> private: >> explicit AttrListPtr(AttributeListImpl *L); >> + >> + /// getAttributes - The attributes for the specified index are >> + /// returned. Attributes for the result are denoted with Idx = 0. >> + Attributes getAttributes(unsigned Idx) const; >> + >> }; >> >> } // End llvm namespace >> >> Modified: llvm/trunk/include/llvm/Function.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Function.h?rev=56704&r1=56703&r2=56704&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/include/llvm/Function.h (original) >> +++ llvm/trunk/include/llvm/Function.h Fri Sep 26 17:53:05 2008 >> @@ -187,38 +187,38 @@ >> >> /// @brief Determine if the function does not access memory. >> bool doesNotAccessMemory() const { >> - return paramHasAttr(0, Attribute::ReadNone); >> + return paramHasAttr(~0, Attribute::ReadNone); >> } >> void setDoesNotAccessMemory(bool DoesNotAccessMemory = true) { >> - if (DoesNotAccessMemory) addAttribute(0, Attribute::ReadNone); >> - else removeAttribute(0, Attribute::ReadNone); >> + if (DoesNotAccessMemory) addAttribute(~0, Attribute::ReadNone); >> + else removeAttribute(~0, Attribute::ReadNone); >> } >> >> /// @brief Determine if the function does not access or only reads >> memory. >> bool onlyReadsMemory() const { >> - return doesNotAccessMemory() || paramHasAttr(0, >> Attribute::ReadOnly); >> + return doesNotAccessMemory() || paramHasAttr(~0, >> Attribute::ReadOnly); >> } >> void setOnlyReadsMemory(bool OnlyReadsMemory = true) { >> - if (OnlyReadsMemory) addAttribute(0, Attribute::ReadOnly); >> - else removeAttribute(0, Attribute::ReadOnly | >> Attribute::ReadNone); >> + if (OnlyReadsMemory) addAttribute(~0, Attribute::ReadOnly); >> + else removeAttribute(~0, Attribute::ReadOnly | >> Attribute::ReadNone); >> } >> >> /// @brief Determine if the function cannot return. >> bool doesNotReturn() const { >> - return paramHasAttr(0, Attribute::NoReturn); >> + return paramHasAttr(~0, Attribute::NoReturn); >> } >> void setDoesNotReturn(bool DoesNotReturn = true) { >> - if (DoesNotReturn) addAttribute(0, Attribute::NoReturn); >> - else removeAttribute(0, Attribute::NoReturn); >> + if (DoesNotReturn) addAttribute(~0, Attribute::NoReturn); >> + else removeAttribute(~0, Attribute::NoReturn); >> } >> >> /// @brief Determine if the function cannot unwind. >> bool doesNotThrow() const { >> - return paramHasAttr(0, Attribute::NoUnwind); >> + return paramHasAttr(~0, Attribute::NoUnwind); >> } >> void setDoesNotThrow(bool DoesNotThrow = true) { >> - if (DoesNotThrow) addAttribute(0, Attribute::NoUnwind); >> - else removeAttribute(0, Attribute::NoUnwind); >> + if (DoesNotThrow) addAttribute(~0, Attribute::NoUnwind); >> + else removeAttribute(~0, Attribute::NoUnwind); >> } >> >> /// @brief Determine if the function returns a structure through >> first >> >> Modified: llvm/trunk/include/llvm/Instructions.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instructions.h?rev=56704&r1=56703&r2=56704&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/include/llvm/Instructions.h (original) >> +++ llvm/trunk/include/llvm/Instructions.h Fri Sep 26 17:53:05 2008 >> @@ -1097,38 +1097,38 @@ >> >> /// @brief Determine if the call does not access memory. >> bool doesNotAccessMemory() const { >> - return paramHasAttr(0, Attribute::ReadNone); >> + return paramHasAttr(~0, Attribute::ReadNone); >> } >> void setDoesNotAccessMemory(bool NotAccessMemory = true) { >> - if (NotAccessMemory) addAttribute(0, Attribute::ReadNone); >> - else removeAttribute(0, Attribute::ReadNone); >> + if (NotAccessMemory) addAttribute(~0, Attribute::ReadNone); >> + else removeAttribute(~0, Attribute::ReadNone); >> } >> >> /// @brief Determine if the call does not access or only reads >> memory. >> bool onlyReadsMemory() const { >> - return doesNotAccessMemory() || paramHasAttr(0, >> Attribute::ReadOnly); >> + return doesNotAccessMemory() || paramHasAttr(~0, >> Attribute::ReadOnly); >> } >> void setOnlyReadsMemory(bool OnlyReadsMemory = true) { >> - if (OnlyReadsMemory) addAttribute(0, Attribute::ReadOnly); >> - else removeAttribute(0, Attribute::ReadOnly | >> Attribute::ReadNone); >> + if (OnlyReadsMemory) addAttribute(~0, Attribute::ReadOnly); >> + else removeAttribute(~0, Attribute::ReadOnly | >> Attribute::ReadNone); >> } >> >> /// @brief Determine if the call cannot return. >> bool doesNotReturn() const { >> - return paramHasAttr(0, Attribute::NoReturn); >> + return paramHasAttr(~0, Attribute::NoReturn); >> } >> void setDoesNotReturn(bool DoesNotReturn = true) { >> - if (DoesNotReturn) addAttribute(0, Attribute::NoReturn); >> - else removeAttribute(0, Attribute::NoReturn); >> + if (DoesNotReturn) addAttribute(~0, Attribute::NoReturn); >> + else removeAttribute(~0, Attribute::NoReturn); >> } >> >> /// @brief Determine if the call cannot unwind. >> bool doesNotThrow() const { >> - return paramHasAttr(0, Attribute::NoUnwind); >> + return paramHasAttr(~0, Attribute::NoUnwind); >> } >> void setDoesNotThrow(bool DoesNotThrow = true) { >> - if (DoesNotThrow) addAttribute(0, Attribute::NoUnwind); >> - else removeAttribute(0, Attribute::NoUnwind); >> + if (DoesNotThrow) addAttribute(~0, Attribute::NoUnwind); >> + else removeAttribute(~0, Attribute::NoUnwind); >> } >> >> /// @brief Determine if the call returns a structure through first >> @@ -2459,35 +2459,35 @@ >> return paramHasAttr(0, Attribute::ReadNone); >> } >> void setDoesNotAccessMemory(bool NotAccessMemory = true) { >> - if (NotAccessMemory) addAttribute(0, Attribute::ReadNone); >> - else removeAttribute(0, Attribute::ReadNone); >> + if (NotAccessMemory) addAttribute(~0, Attribute::ReadNone); >> + else removeAttribute(~0, Attribute::ReadNone); >> } >> >> /// @brief Determine if the call does not access or only reads >> memory. >> bool onlyReadsMemory() const { >> - return doesNotAccessMemory() || paramHasAttr(0, >> Attribute::ReadOnly); >> + return doesNotAccessMemory() || paramHasAttr(~0, >> Attribute::ReadOnly); >> } >> void setOnlyReadsMemory(bool OnlyReadsMemory = true) { >> - if (OnlyReadsMemory) addAttribute(0, Attribute::ReadOnly); >> - else removeAttribute(0, Attribute::ReadOnly | >> Attribute::ReadNone); >> + if (OnlyReadsMemory) addAttribute(~0, Attribute::ReadOnly); >> + else removeAttribute(~0, Attribute::ReadOnly | >> Attribute::ReadNone); >> } >> >> /// @brief Determine if the call cannot return. >> bool doesNotReturn() const { >> - return paramHasAttr(0, Attribute::NoReturn); >> + return paramHasAttr(~0, Attribute::NoReturn); >> } >> void setDoesNotReturn(bool DoesNotReturn = true) { >> - if (DoesNotReturn) addAttribute(0, Attribute::NoReturn); >> - else removeAttribute(0, Attribute::NoReturn); >> + if (DoesNotReturn) addAttribute(~0, Attribute::NoReturn); >> + else removeAttribute(~0, Attribute::NoReturn); >> } >> >> /// @brief Determine if the call cannot unwind. >> bool doesNotThrow() const { >> - return paramHasAttr(0, Attribute::NoUnwind); >> + return paramHasAttr(~0, Attribute::NoUnwind); >> } >> void setDoesNotThrow(bool DoesNotThrow = true) { >> - if (DoesNotThrow) addAttribute(0, Attribute::NoUnwind); >> - else removeAttribute(0, Attribute::NoUnwind); >> + if (DoesNotThrow) addAttribute(~0, Attribute::NoUnwind); >> + else removeAttribute(~0, Attribute::NoUnwind); >> } >> >> /// @brief Determine if the call returns a structure through first >> >> Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.y >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.y?rev=56704&r1=56703&r2=56704&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/AsmParser/llvmAsmParser.y (original) >> +++ llvm/trunk/lib/AsmParser/llvmAsmParser.y Fri Sep 26 17:53:05 2008 >> @@ -2346,8 +2346,25 @@ >> >> std::vector ParamTypeList; >> SmallVector Attrs; >> - if ($7 != Attribute::None) >> - Attrs.push_back(AttributeWithIndex::get(0, $7)); >> + //FIXME : In 3.0, stop accepting zext, sext and inreg as optional >> function >> + //attributes. >> + Attributes RetAttrs = 0; >> + if ($7 != Attribute::None) { >> + if ($7 & Attribute::ZExt) { >> + RetAttrs = RetAttrs | Attribute::ZExt; >> + $7 = $7 ^ Attribute::ZExt; >> + } >> + if ($7 & Attribute::SExt) { >> + RetAttrs = RetAttrs | Attribute::SExt; >> + $7 = $7 ^ Attribute::SExt; >> + } >> + if ($7 & Attribute::InReg) { >> + RetAttrs = RetAttrs | Attribute::InReg; >> + $7 = $7 ^ Attribute::InReg; >> + } >> + if (RetAttrs != Attribute::None) >> + Attrs.push_back(AttributeWithIndex::get(0, RetAttrs)); >> + } >> if ($5) { // If there are arguments... >> unsigned index = 1; >> for (ArgListType::iterator I = $5->begin(); I != $5->end(); ++I, >> ++index) { >> @@ -2359,6 +2376,8 @@ >> Attrs.push_back(AttributeWithIndex::get(index, I->Attrs)); >> } >> } >> + if ($7 != Attribute::None) >> + Attrs.push_back(AttributeWithIndex::get(~0, $7)); >> >> bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == >> Type::VoidTy; >> if (isVarArg) ParamTypeList.pop_back(); >> @@ -2860,9 +2879,26 @@ >> CHECK_FOR_ERROR >> >> SmallVector Attrs; >> - if ($8 != Attribute::None) >> - Attrs.push_back(AttributeWithIndex::get(0, $8)); >> - >> + //FIXME : In 3.0, stop accepting zext, sext and inreg as >> optional function >> + //attributes. >> + Attributes RetAttrs = 0; >> + if ($8 != Attribute::None) { >> + if ($8 & Attribute::ZExt) { >> + RetAttrs = RetAttrs | Attribute::ZExt; >> + $8 = $8 ^ Attribute::ZExt; >> + } >> + if ($8 & Attribute::SExt) { >> + RetAttrs = RetAttrs | Attribute::SExt; >> + $8 = $8 ^ Attribute::SExt; >> + } >> + if ($8 & Attribute::InReg) { >> + RetAttrs = RetAttrs | Attribute::InReg; >> + $8 = $8 ^ Attribute::InReg; >> + } >> + if (RetAttrs != Attribute::None) >> + Attrs.push_back(AttributeWithIndex::get(0, RetAttrs)); >> + } >> + >> // Check the arguments >> ValueList Args; >> if ($6->empty()) { // Has no >> arguments? >> @@ -2897,7 +2933,8 @@ >> } else if (I != E || ArgI != ArgE) >> GEN_ERROR("Invalid number of parameters detected"); >> } >> - >> + if ($8 != Attribute::None) >> + Attrs.push_back(AttributeWithIndex::get(~0, $8)); >> AttrListPtr PAL; >> if (!Attrs.empty()) >> PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); >> @@ -3258,8 +3295,27 @@ >> >> // Set up the Attributes for the function >> SmallVector Attrs; >> - if ($8 != Attribute::None) >> - Attrs.push_back(AttributeWithIndex::get(0, $8)); >> + //FIXME : In 3.0, stop accepting zext, sext and inreg as >> optional function >> + //attributes. >> + Attributes RetAttrs = 0; >> + Attributes TmpAttr = $8; >> + if ($8 != Attribute::None) { >> + if ($8 & Attribute::ZExt) { >> + RetAttrs = RetAttrs | Attribute::ZExt; >> + $8 = $8 ^ Attribute::ZExt; >> + } >> + if ($8 & Attribute::SExt) { >> + RetAttrs = RetAttrs | Attribute::SExt; >> + $8 = $8 ^ Attribute::SExt; >> + } >> + if ($8 & Attribute::InReg) { >> + RetAttrs = RetAttrs | Attribute::InReg; >> + $8 = $8 ^ Attribute::InReg; >> + } >> + if (RetAttrs != Attribute::None) >> + Attrs.push_back(AttributeWithIndex::get(0, RetAttrs)); >> + } >> + >> // Check the arguments >> ValueList Args; >> if ($6->empty()) { // Has no >> arguments? >> @@ -3293,6 +3349,8 @@ >> } else if (I != E || ArgI != ArgE) >> GEN_ERROR("Invalid number of parameters detected"); >> } >> + if ($8 != Attribute::None) >> + Attrs.push_back(AttributeWithIndex::get(~0, $8)); >> >> // Finish off the Attributes and check them >> AttrListPtr PAL; >> >> Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs?rev=56704&r1=56703&r2=56704&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs (original) >> +++ llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs Fri Sep 26 17:53:05 >> 2008 >> @@ -2346,8 +2346,25 @@ >> >> std::vector ParamTypeList; >> SmallVector Attrs; >> - if ($7 != Attribute::None) >> - Attrs.push_back(AttributeWithIndex::get(0, $7)); >> + //FIXME : In 3.0, stop accepting zext, sext and inreg as optional >> function >> + //attributes. >> + Attributes RetAttrs = 0; >> + if ($7 != Attribute::None) { >> + if ($7 & Attribute::ZExt) { >> + RetAttrs = RetAttrs | Attribute::ZExt; >> + $7 = $7 ^ Attribute::ZExt; >> + } >> + if ($7 & Attribute::SExt) { >> + RetAttrs = RetAttrs | Attribute::SExt; >> + $7 = $7 ^ Attribute::SExt; >> + } >> + if ($7 & Attribute::InReg) { >> + RetAttrs = RetAttrs | Attribute::InReg; >> + $7 = $7 ^ Attribute::InReg; >> + } >> + if (RetAttrs != Attribute::None) >> + Attrs.push_back(AttributeWithIndex::get(0, RetAttrs)); >> + } >> if ($5) { // If there are arguments... >> unsigned index = 1; >> for (ArgListType::iterator I = $5->begin(); I != $5->end(); ++I, >> ++index) { >> @@ -2359,6 +2376,8 @@ >> Attrs.push_back(AttributeWithIndex::get(index, I->Attrs)); >> } >> } >> + if ($7 != Attribute::None) >> + Attrs.push_back(AttributeWithIndex::get(~0, $7)); >> >> bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == >> Type::VoidTy; >> if (isVarArg) ParamTypeList.pop_back(); >> @@ -2860,9 +2879,26 @@ >> CHECK_FOR_ERROR >> >> SmallVector Attrs; >> - if ($8 != Attribute::None) >> - Attrs.push_back(AttributeWithIndex::get(0, $8)); >> - >> + //FIXME : In 3.0, stop accepting zext, sext and inreg as >> optional function >> + //attributes. >> + Attributes RetAttrs = 0; >> + if ($8 != Attribute::None) { >> + if ($8 & Attribute::ZExt) { >> + RetAttrs = RetAttrs | Attribute::ZExt; >> + $8 = $8 ^ Attribute::ZExt; >> + } >> + if ($8 & Attribute::SExt) { >> + RetAttrs = RetAttrs | Attribute::SExt; >> + $8 = $8 ^ Attribute::SExt; >> + } >> + if ($8 & Attribute::InReg) { >> + RetAttrs = RetAttrs | Attribute::InReg; >> + $8 = $8 ^ Attribute::InReg; >> + } >> + if (RetAttrs != Attribute::None) >> + Attrs.push_back(AttributeWithIndex::get(0, RetAttrs)); >> + } >> + >> // Check the arguments >> ValueList Args; >> if ($6->empty()) { // Has no >> arguments? >> @@ -2897,7 +2933,8 @@ >> } else if (I != E || ArgI != ArgE) >> GEN_ERROR("Invalid number of parameters detected"); >> } >> - >> + if ($8 != Attribute::None) >> + Attrs.push_back(AttributeWithIndex::get(~0, $8)); >> AttrListPtr PAL; >> if (!Attrs.empty()) >> PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); >> @@ -3258,8 +3295,27 @@ >> >> // Set up the Attributes for the function >> SmallVector Attrs; >> - if ($8 != Attribute::None) >> - Attrs.push_back(AttributeWithIndex::get(0, $8)); >> + //FIXME : In 3.0, stop accepting zext, sext and inreg as >> optional function >> + //attributes. >> + Attributes RetAttrs = 0; >> + Attributes TmpAttr = $8; >> + if ($8 != Attribute::None) { >> + if ($8 & Attribute::ZExt) { >> + RetAttrs = RetAttrs | Attribute::ZExt; >> + $8 = $8 ^ Attribute::ZExt; >> + } >> + if ($8 & Attribute::SExt) { >> + RetAttrs = RetAttrs | Attribute::SExt; >> + $8 = $8 ^ Attribute::SExt; >> + } >> + if ($8 & Attribute::InReg) { >> + RetAttrs = RetAttrs | Attribute::InReg; >> + $8 = $8 ^ Attribute::InReg; >> + } >> + if (RetAttrs != Attribute::None) >> + Attrs.push_back(AttributeWithIndex::get(0, RetAttrs)); >> + } >> + >> // Check the arguments >> ValueList Args; >> if ($6->empty()) { // Has no >> arguments? >> @@ -3293,6 +3349,8 @@ >> } else if (I != E || ArgI != ArgE) >> GEN_ERROR("Invalid number of parameters detected"); >> } >> + if ($8 != Attribute::None) >> + Attrs.push_back(AttributeWithIndex::get(~0, $8)); >> >> // Finish off the Attributes and check them >> AttrListPtr PAL; >> >> Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=56704&r1=56703&r2=56704&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original) >> +++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Fri Sep 26 >> 17:53:05 2008 >> @@ -32,7 +32,7 @@ >> std::vector().swap(TypeList); >> ValueList.clear(); >> >> - std::vector().swap(Attributes); >> + std::vector().swap(MAttributes); >> std::vector().swap(FunctionBBs); >> std::vector().swap(FunctionsWithBodies); >> DeferredFunctionInfo.clear(); >> @@ -317,7 +317,7 @@ >> if (Stream.EnterSubBlock(bitc::PARAMATTR_BLOCK_ID)) >> return Error("Malformed block record"); >> >> - if (!Attributes.empty()) >> + if (!MAttributes.empty()) >> return Error("Multiple PARAMATTR blocks found!"); >> >> SmallVector Record; >> @@ -355,12 +355,53 @@ >> if (Record.size() & 1) >> return Error("Invalid ENTRY record"); >> >> + // FIXME : Remove this backword compatibility one day. >> + // If Function attributes are using index 0 then transfer them >> + // to index ~0. Index 0 is strictly used for return value >> + // attributes. >> + Attributes RetAttribute = Attribute::None; >> + Attributes FnAttribute = Attribute::None; >> for (unsigned i = 0, e = Record.size(); i != e; i += 2) { >> - if (Record[i+1] != Attribute::None) >> + if (Record[i] == 0) >> + RetAttribute = Record[i+1]; >> + else if (Record[i] == ~0U) >> + FnAttribute = Record[i+1]; >> + } >> + bool useUpdatedAttrs = false; >> + if (FnAttribute == Attribute::None && RetAttribute != >> Attribute::None) { >> + if (RetAttribute & Attribute::NoUnwind) { >> + FnAttribute = FnAttribute | Attribute::NoUnwind; >> + RetAttribute = RetAttribute ^ Attribute::NoUnwind; >> + useUpdatedAttrs = true; >> + } >> + if (RetAttribute & Attribute::NoReturn) { >> + FnAttribute = FnAttribute | Attribute::NoReturn; >> + RetAttribute = RetAttribute ^ Attribute::NoReturn; >> + useUpdatedAttrs = true; >> + } >> + if (RetAttribute & Attribute::ReadOnly) { >> + FnAttribute = FnAttribute | Attribute::ReadOnly; >> + RetAttribute = RetAttribute ^ Attribute::ReadOnly; >> + useUpdatedAttrs = true; >> + } >> + if (RetAttribute & Attribute::ReadNone) { >> + FnAttribute = FnAttribute | Attribute::ReadNone; >> + RetAttribute = RetAttribute ^ Attribute::ReadNone; >> + useUpdatedAttrs = true; >> + } >> + } >> + >> + for (unsigned i = 0, e = Record.size(); i != e; i += 2) { >> + if (useUpdatedAttrs && Record[i] == 0 >> + && RetAttribute != Attribute::None) >> + Attrs.push_back(AttributeWithIndex::get(0, RetAttribute)); >> + else if (Record[i+1] != Attribute::None) >> Attrs.push_back(AttributeWithIndex::get(Record[i], Record[i >> +1])); >> } >> + if (useUpdatedAttrs && FnAttribute != Attribute::None) >> + Attrs.push_back(AttributeWithIndex::get(~0, FnAttribute)); >> >> - Attributes.push_back(AttrListPtr::get(Attrs.begin(), >> Attrs.end())); >> + MAttributes.push_back(AttrListPtr::get(Attrs.begin(), >> Attrs.end())); >> Attrs.clear(); >> break; >> } >> >> Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.h?rev=56704&r1=56703&r2=56704&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.h (original) >> +++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.h Fri Sep 26 >> 17:53:05 2008 >> @@ -136,10 +136,10 @@ >> std::vector > GlobalInits; >> std::vector > AliasInits; >> >> - /// Attributes - The set of parameter attributes by index. Index >> zero in the >> + /// MAttributes - The set of attributes by index. Index zero in >> the >> /// file is for null, and is thus not represented here. As such >> all indices >> /// are off by one. >> - std::vector Attributes; >> + std::vector MAttributes; >> >> /// FunctionBBs - While parsing a function body, this is a list of >> the basic >> /// blocks for the function. >> @@ -204,8 +204,8 @@ >> return FunctionBBs[ID]; >> } >> AttrListPtr getAttributes(unsigned i) const { >> - if (i-1 < Attributes.size()) >> - return Attributes[i-1]; >> + if (i-1 < MAttributes.size()) >> + return MAttributes[i-1]; >> return AttrListPtr(); >> } >> >> >> Modified: llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp?rev=56704&r1=56703&r2=56704&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp (original) >> +++ llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp Fri Sep 26 >> 17:53:05 2008 >> @@ -105,10 +105,10 @@ >> MadeChange = true; >> >> // Clear out any existing attributes. >> - F->removeAttribute(0, Attribute::ReadOnly | >> Attribute::ReadNone); >> + F->removeAttribute(~0, Attribute::ReadOnly | >> Attribute::ReadNone); >> >> // Add in the new attribute. >> - F->addAttribute(0, ReadsMemory ? Attribute::ReadOnly : >> Attribute::ReadNone); >> + F->addAttribute(~0, ReadsMemory ? Attribute::ReadOnly : >> Attribute::ReadNone); >> >> if (ReadsMemory) >> NumReadOnly++; >> >> Modified: llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp?rev=56704&r1=56703&r2=56704&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp (original) >> +++ llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp Fri Sep 26 >> 17:53:05 2008 >> @@ -508,7 +508,7 @@ >> const AttrListPtr &PAL = F->getAttributes(); >> >> // Add any return attributes. >> - if (Attributes attrs = PAL.getAttributes(0)) >> + if (Attributes attrs = PAL.getRetAttributes()) >> AttributesVec.push_back(AttributeWithIndex::get(0, attrs)); >> >> // First, determine the new argument list >> @@ -525,7 +525,7 @@ >> } else if (!ArgsToPromote.count(I)) { >> // Unchanged argument >> Params.push_back(I->getType()); >> - if (Attributes attrs = PAL.getAttributes(ArgIndex)) >> + if (Attributes attrs = PAL.getParamAttributes(ArgIndex)) >> >> AttributesVec.push_back(AttributeWithIndex::get(Params.size(), >> attrs)); >> } else if (I->use_empty()) { >> // Dead argument (which are always marked as promotable) >> @@ -578,6 +578,10 @@ >> } >> } >> >> + // Add any function attributes. >> + if (Attributes attrs = PAL.getFnAttributes()) >> + AttributesVec.push_back(AttributeWithIndex::get(~0, attrs)); >> + >> const Type *RetTy = FTy->getReturnType(); >> >> // Work around LLVM bug PR56: the CWriter cannot emit varargs >> functions which >> @@ -621,7 +625,7 @@ >> const AttrListPtr &CallPAL = CS.getAttributes(); >> >> // Add any return attributes. >> - if (Attributes attrs = CallPAL.getAttributes(0)) >> + if (Attributes attrs = CallPAL.getRetAttributes()) >> AttributesVec.push_back(AttributeWithIndex::get(0, attrs)); >> >> // Loop over the operands, inserting GEP and loads in the caller >> as >> @@ -633,7 +637,7 @@ >> if (!ArgsToPromote.count(I) && !ByValArgsToTransform.count(I)) { >> Args.push_back(*AI); // Unmodified argument >> >> - if (Attributes Attrs = CallPAL.getAttributes(ArgIndex)) >> + if (Attributes Attrs = CallPAL.getParamAttributes(ArgIndex)) >> >> AttributesVec.push_back(AttributeWithIndex::get(Args.size(), Attrs)); >> >> } else if (ByValArgsToTransform.count(I)) { >> @@ -688,10 +692,14 @@ >> // Push any varargs arguments on the list >> for (; AI != CS.arg_end(); ++AI, ++ArgIndex) { >> Args.push_back(*AI); >> - if (Attributes Attrs = CallPAL.getAttributes(ArgIndex)) >> + if (Attributes Attrs = CallPAL.getParamAttributes(ArgIndex)) >> AttributesVec.push_back(AttributeWithIndex::get(Args.size(), >> Attrs)); >> } >> >> + // Add any function attributes. >> + if (Attributes attrs = CallPAL.getFnAttributes()) >> + AttributesVec.push_back(AttributeWithIndex::get(~0, attrs)); >> + >> Instruction *New; >> if (InvokeInst *II = dyn_cast(Call)) { >> New = InvokeInst::Create(NF, II->getNormalDest(), II- >>> getUnwindDest(), >> >> Modified: llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp?rev=56704&r1=56703&r2=56704&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp >> (original) >> +++ llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp Fri >> Sep 26 17:53:05 2008 >> @@ -229,6 +229,8 @@ >> SmallVector AttributesVec; >> for (unsigned i = 0; PAL.getSlot(i).Index <= NumArgs; ++i) >> AttributesVec.push_back(PAL.getSlot(i)); >> + if (Attributes FnAttrs = PAL.getFnAttributes()) >> + AttributesVec.push_back(AttributeWithIndex::get(~0, >> FnAttrs)); >> PAL = AttrListPtr::get(AttributesVec.begin(), >> AttributesVec.end()); >> } >> >> @@ -593,8 +595,8 @@ >> const AttrListPtr &PAL = F->getAttributes(); >> >> // The existing function return attributes. >> - Attributes RAttrs = PAL.getAttributes(0); >> - >> + Attributes RAttrs = PAL.getRetAttributes(); >> + Attributes FnAttrs = PAL.getFnAttributes(); >> >> // Find out the new return value. >> >> @@ -678,7 +680,7 @@ >> >> // Get the original parameter attributes (skipping the first >> one, that is >> // for the return value. >> - if (Attributes Attrs = PAL.getAttributes(i + 1)) >> + if (Attributes Attrs = PAL.getParamAttributes(i + 1)) >> >> AttributesVec.push_back(AttributeWithIndex::get(Params.size(), >> Attrs)); >> } else { >> ++NumArgumentsEliminated; >> @@ -687,6 +689,9 @@ >> } >> } >> >> + if (FnAttrs != Attribute::None) >> + AttributesVec.push_back(AttributeWithIndex::get(~0, FnAttrs)); >> + >> // Reconstruct the AttributesList based on the vector we >> constructed. >> AttrListPtr NewPAL = AttrListPtr::get(AttributesVec.begin(), >> AttributesVec.end()); >> >> @@ -730,7 +735,8 @@ >> const AttrListPtr &CallPAL = CS.getAttributes(); >> >> // The call return attributes. >> - Attributes RAttrs = CallPAL.getAttributes(0); >> + Attributes RAttrs = CallPAL.getRetAttributes(); >> + Attributes FnAttrs = CallPAL.getFnAttributes(); >> // Adjust in case the function was changed to return void. >> RAttrs &= ~Attribute::typeIncompatible(NF->getReturnType()); >> if (RAttrs) >> @@ -746,7 +752,7 @@ >> if (ArgAlive[i]) { >> Args.push_back(*I); >> // Get original parameter attributes, but skip return >> attributes. >> - if (Attributes Attrs = CallPAL.getAttributes(i + 1)) >> + if (Attributes Attrs = CallPAL.getParamAttributes(i + 1)) >> >> AttributesVec.push_back(AttributeWithIndex::get(Args.size(), Attrs)); >> } >> >> @@ -756,13 +762,16 @@ >> // Push any varargs arguments on the list. Don't forget their >> attributes. >> for (CallSite::arg_iterator E = CS.arg_end(); I != E; ++I, ++i) { >> Args.push_back(*I); >> - if (Attributes Attrs = CallPAL.getAttributes(i + 1)) >> + if (Attributes Attrs = CallPAL.getParamAttributes(i + 1)) >> AttributesVec.push_back(AttributeWithIndex::get(Args.size(), >> Attrs)); >> } >> >> + if (FnAttrs != Attribute::None) >> + AttributesVec.push_back(AttributeWithIndex::get(~0, FnAttrs)); >> + >> // Reconstruct the AttributesList based on the vector we >> constructed. >> AttrListPtr NewCallPAL = AttrListPtr::get(AttributesVec.begin(), >> - AttributesVec.end()); >> + AttributesVec.end()); >> >> Instruction *New; >> if (InvokeInst *II = dyn_cast(Call)) { >> >> Modified: llvm/trunk/lib/Transforms/IPO/PruneEH.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/PruneEH.cpp?rev=56704&r1=56703&r2=56704&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/Transforms/IPO/PruneEH.cpp (original) >> +++ llvm/trunk/lib/Transforms/IPO/PruneEH.cpp Fri Sep 26 17:53:05 >> 2008 >> @@ -133,7 +133,7 @@ >> NewAttributes |= Attribute::NoReturn; >> >> const AttrListPtr &PAL = SCC[i]->getFunction()->getAttributes(); >> - const AttrListPtr &NPAL = PAL.addAttr(0, NewAttributes); >> + const AttrListPtr &NPAL = PAL.addAttr(~0, NewAttributes); >> if (PAL != NPAL) { >> MadeChange = true; >> SCC[i]->getFunction()->setAttributes(NPAL); >> >> Modified: llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp?rev=56704&r1=56703&r2=56704&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp (original) >> +++ llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp Fri Sep 26 >> 17:53:05 2008 >> @@ -210,7 +210,7 @@ >> const AttrListPtr &PAL = F->getAttributes(); >> >> // Add any return attributes. >> - if (Attributes attrs = PAL.getAttributes(0)) >> + if (Attributes attrs = PAL.getRetAttributes()) >> AttributesVec.push_back(AttributeWithIndex::get(0, attrs)); >> >> // Skip first argument. >> @@ -221,12 +221,17 @@ >> unsigned ParamIndex = 2; >> while (I != E) { >> Params.push_back(I->getType()); >> - if (Attributes Attrs = PAL.getAttributes(ParamIndex)) >> + if (Attributes Attrs = PAL.getParamAttributes(ParamIndex)) >> AttributesVec.push_back(AttributeWithIndex::get(ParamIndex - >> 1, Attrs)); >> ++I; >> ++ParamIndex; >> } >> >> + // Add any fn attributes. >> + if (Attributes attrs = PAL.getFnAttributes()) >> + AttributesVec.push_back(AttributeWithIndex::get(~0, attrs)); >> + >> + >> FunctionType *NFTy = FunctionType::get(STy, Params, FTy- >>> isVarArg()); >> Function *NF = Function::Create(NFTy, F->getLinkage()); >> NF->takeName(F); >> @@ -264,7 +269,7 @@ >> >> const AttrListPtr &PAL = F->getAttributes(); >> // Add any return attributes. >> - if (Attributes attrs = PAL.getAttributes(0)) >> + if (Attributes attrs = PAL.getRetAttributes()) >> ArgAttrsVec.push_back(AttributeWithIndex::get(0, attrs)); >> >> // Copy arguments, however skip first one. >> @@ -276,12 +281,15 @@ >> unsigned ParamIndex = 2; >> while (AI != AE) { >> Args.push_back(*AI); >> - if (Attributes Attrs = PAL.getAttributes(ParamIndex)) >> + if (Attributes Attrs = PAL.getParamAttributes(ParamIndex)) >> ArgAttrsVec.push_back(AttributeWithIndex::get(ParamIndex - >> 1, Attrs)); >> ++ParamIndex; >> ++AI; >> } >> >> + // Add any function attributes. >> + if (Attributes attrs = PAL.getFnAttributes()) >> + ArgAttrsVec.push_back(AttributeWithIndex::get(~0, attrs)); >> >> AttrListPtr NewPAL = AttrListPtr::get(ArgAttrsVec.begin(), >> ArgAttrsVec.end()); >> >> >> Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=56704&r1=56703&r2=56704&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp >> (original) >> +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Fri >> Sep 26 17:53:05 2008 >> @@ -9127,7 +9127,7 @@ >> return false; // Cannot transform this return value. >> >> if (!CallerPAL.isEmpty() && !Caller->use_empty()) { >> - Attributes RAttrs = CallerPAL.getAttributes(0); >> + Attributes RAttrs = CallerPAL.getRetAttributes(); >> if (RAttrs & Attribute::typeIncompatible(NewRetTy)) >> return false; // Attribute not compatible with transformed >> value. >> } >> @@ -9157,7 +9157,8 @@ >> if (!CastInst::isCastable(ActTy, ParamTy)) >> return false; // Cannot transform this parameter value. >> >> - if (CallerPAL.getAttributes(i + 1) & >> Attribute::typeIncompatible(ParamTy)) >> + if (CallerPAL.getParamAttributes(i + 1) >> + & Attribute::typeIncompatible(ParamTy)) >> return false; // Attribute not compatible with transformed >> value. >> >> // Converting from one pointer type to another or between a >> pointer and an >> @@ -9193,7 +9194,7 @@ >> attrVec.reserve(NumCommonArgs); >> >> // Get any return attributes. >> - Attributes RAttrs = CallerPAL.getAttributes(0); >> + Attributes RAttrs = CallerPAL.getRetAttributes(); >> >> // If the return value is not being used, the type may not be >> compatible >> // with the existing attributes. Wipe out any problematic >> attributes. >> @@ -9216,7 +9217,7 @@ >> } >> >> // Add any parameter attributes. >> - if (Attributes PAttrs = CallerPAL.getAttributes(i + 1)) >> + if (Attributes PAttrs = CallerPAL.getParamAttributes(i + 1)) >> attrVec.push_back(AttributeWithIndex::get(i + 1, PAttrs)); >> } >> >> @@ -9246,12 +9247,15 @@ >> } >> >> // Add any parameter attributes. >> - if (Attributes PAttrs = CallerPAL.getAttributes(i + 1)) >> + if (Attributes PAttrs = CallerPAL.getParamAttributes(i + 1)) >> attrVec.push_back(AttributeWithIndex::get(i + 1, PAttrs)); >> } >> } >> } >> >> + if (Attributes FnAttrs = CallerPAL.getFnAttributes()) >> + attrVec.push_back(AttributeWithIndex::get(~0, FnAttrs)); >> + >> if (NewRetTy == Type::VoidTy) >> Caller->setName(""); // Void type should not have a name. >> >> @@ -9337,7 +9341,7 @@ >> if (NestAttrs.paramHasAttr(NestIdx, Attribute::Nest)) { >> // Record the parameter type and any other attributes. >> NestTy = *I; >> - NestAttr = NestAttrs.getAttributes(NestIdx); >> + NestAttr = NestAttrs.getParamAttributes(NestIdx); >> break; >> } >> >> @@ -9352,8 +9356,8 @@ >> // Insert the nest argument into the call argument list, which >> may >> // mean appending it. Likewise for attributes. >> >> - // Add any function result attributes. >> - if (Attributes Attr = Attrs.getAttributes(0)) >> + // Add any result attributes. >> + if (Attributes Attr = Attrs.getRetAttributes()) >> NewAttrs.push_back(AttributeWithIndex::get(0, Attr)); >> >> { >> @@ -9374,7 +9378,7 @@ >> >> // Add the original argument and attributes. >> NewArgs.push_back(*I); >> - if (Attributes Attr = Attrs.getAttributes(Idx)) >> + if (Attributes Attr = Attrs.getParamAttributes(Idx)) >> NewAttrs.push_back >> (AttributeWithIndex::get(Idx + (Idx >= NestIdx), Attr)); >> >> @@ -9382,6 +9386,10 @@ >> } while (1); >> } >> >> + // Add any function attributes. >> + if (Attributes Attr = Attrs.getFnAttributes()) >> + NewAttrs.push_back(AttributeWithIndex::get(~0, Attr)); >> + >> // The trampoline may have been bitcast to a bogus type (FTy). >> // Handle this by synthesizing a new function type, equal to FTy >> // with the chain parameter inserted. >> >> Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=56704&r1=56703&r2=56704&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original) >> +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Fri Sep 26 17:53:05 2008 >> @@ -1374,7 +1374,7 @@ >> I != E; ++I) { >> // Insert commas as we go... the first arg doesn't get a comma >> if (I != F->arg_begin()) Out << ", "; >> - printArgument(I, Attrs.getAttributes(Idx)); >> + printArgument(I, Attrs.getParamAttributes(Idx)); >> Idx++; >> } >> } else { >> @@ -1386,7 +1386,7 @@ >> // Output type... >> printType(FT->getParamType(i)); >> >> - Attributes ArgAttrs = Attrs.getAttributes(i+1); >> + Attributes ArgAttrs = Attrs.getParamAttributes(i+1); >> if (ArgAttrs != Attribute::None) >> Out << ' ' << Attribute::getAsString(ArgAttrs); >> } >> @@ -1398,9 +1398,12 @@ >> Out << "..."; // Output varargs portion of signature! >> } >> Out << ')'; >> - Attributes RetAttrs = Attrs.getAttributes(0); >> + Attributes RetAttrs = Attrs.getRetAttributes(); >> if (RetAttrs != Attribute::None) >> - Out << ' ' << Attribute::getAsString(Attrs.getAttributes(0)); >> + Out << ' ' << Attribute::getAsString(Attrs.getRetAttributes()); >> + Attributes FnAttrs = Attrs.getFnAttributes(); >> + if (FnAttrs != Attribute::None) >> + Out << ' ' << Attribute::getAsString(Attrs.getFnAttributes()); >> if (F->hasSection()) >> Out << " section \"" << F->getSection() << '"'; >> if (F->getAlignment()) >> @@ -1660,11 +1663,13 @@ >> for (unsigned op = 1, Eop = I.getNumOperands(); op < Eop; ++op) { >> if (op > 1) >> Out << ", "; >> - writeParamOperand(I.getOperand(op), PAL.getAttributes(op)); >> + writeParamOperand(I.getOperand(op), >> PAL.getParamAttributes(op)); >> } >> Out << ')'; >> - if (PAL.getAttributes(0) != Attribute::None) >> - Out << ' ' << Attribute::getAsString(PAL.getAttributes(0)); >> + if (PAL.getRetAttributes() != Attribute::None) >> + Out << ' ' << Attribute::getAsString(PAL.getRetAttributes()); >> + if (PAL.getFnAttributes() != Attribute::None) >> + Out << ' ' << Attribute::getAsString(PAL.getFnAttributes()); >> } else if (const InvokeInst *II = dyn_cast(&I)) { >> const PointerType *PTy = cast(Operand->getType()); >> const FunctionType *FTy = cast(PTy- >>> getElementType()); >> @@ -1699,12 +1704,15 @@ >> for (unsigned op = 3, Eop = I.getNumOperands(); op < Eop; ++op) { >> if (op > 3) >> Out << ", "; >> - writeParamOperand(I.getOperand(op), PAL.getAttributes(op-2)); >> + writeParamOperand(I.getOperand(op), >> PAL.getParamAttributes(op-2)); >> } >> >> Out << ')'; >> - if (PAL.getAttributes(0) != Attribute::None) >> - Out << ' ' << Attribute::getAsString(PAL.getAttributes(0)); >> + if (PAL.getRetAttributes() != Attribute::None) >> + Out << ' ' << Attribute::getAsString(PAL.getRetAttributes()); >> + if (PAL.getFnAttributes() != Attribute::None) >> + Out << ' ' << Attribute::getAsString(PAL.getFnAttributes()); >> + >> Out << "\n\t\t\tto "; >> writeOperand(II->getNormalDest(), true); >> Out << " unwind "; >> >> Modified: llvm/trunk/lib/VMCore/Attributes.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Attributes.cpp?rev=56704&r1=56703&r2=56704&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/VMCore/Attributes.cpp (original) >> +++ llvm/trunk/lib/VMCore/Attributes.cpp Fri Sep 26 17:53:05 2008 >> @@ -47,6 +47,12 @@ >> Result += "readnone "; >> if (Attrs & Attribute::ReadOnly) >> Result += "readonly "; >> + if (Attrs & Attribute::OptimizeForSize) >> + Result += "optsize "; >> + if (Attrs & Attribute::NoInline) >> + Result += "noinline "; >> + if (Attrs & Attribute::AlwaysInline) >> + Result += "alwaysinline "; >> if (Attrs & Attribute::Alignment) { >> Result += "align "; >> Result += utostr((Attrs & Attribute::Alignment) >> 16); >> >> Modified: llvm/trunk/lib/VMCore/Function.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Function.cpp?rev=56704&r1=56703&r2=56704&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/VMCore/Function.cpp (original) >> +++ llvm/trunk/lib/VMCore/Function.cpp Fri Sep 26 17:53:05 2008 >> @@ -365,7 +365,7 @@ >> // Intrinsics cannot throw exceptions. >> Attr |= Attribute::NoUnwind; >> >> - AttributeWithIndex PAWI = AttributeWithIndex::get(0, Attr); >> + AttributeWithIndex PAWI = AttributeWithIndex::get(~0, Attr); >> return AttrListPtr::get(&PAWI, 1); >> } >> >> >> Modified: llvm/trunk/lib/VMCore/Verifier.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=56704&r1=56703&r2=56704&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/VMCore/Verifier.cpp (original) >> +++ llvm/trunk/lib/VMCore/Verifier.cpp Fri Sep 26 17:53:05 2008 >> @@ -975,7 +975,7 @@ >> if (FTy->isVarArg()) >> // Check attributes on the varargs part. >> for (unsigned Idx = 1 + FTy->getNumParams(); Idx <= >> CS.arg_size(); ++Idx) { >> - Attributes Attr = Attrs.getAttributes(Idx); >> + Attributes Attr = Attrs.getParamAttributes(Idx); >> >> VerifyAttrs(Attr, CS.getArgument(Idx-1)->getType(), false, I); >> >> >> >> _______________________________________________ >> 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 Tue Sep 30 14:39:24 2008 From: sabre at nondot.org (Chris Lattner) Date: Tue, 30 Sep 2008 14:39:24 -0500 Subject: [llvm-commits] CVS: llvm-www/Users.html Message-ID: <200809301939.m8UJdOux002524@zion.cs.uiuc.edu> Changes in directory llvm-www: Users.html updated: 1.36 -> 1.37 --- Log message: Add XMOS --- Diffs of the changes: (+15 -1) Users.html | 16 +++++++++++++++- 1 files changed, 15 insertions(+), 1 deletion(-) Index: llvm-www/Users.html diff -u llvm-www/Users.html:1.36 llvm-www/Users.html:1.37 --- llvm-www/Users.html:1.36 Tue Sep 9 10:15:18 2008 +++ llvm-www/Users.html Tue Sep 30 14:38:15 2008 @@ -102,6 +102,20 @@ Parfait: Bug checker of C code + + + + XMOS Technology + + Backend port for their + architecture, also working on multicore codegen support. + +
    @@ -356,6 +370,6 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!">
    LLVM Development List
    - Last modified: $Date: 2008/09/09 15:15:18 $ + Last modified: $Date: 2008/09/30 19:38:15 $ From alenhar2 at cs.uiuc.edu Tue Sep 30 15:19:58 2008 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Tue, 30 Sep 2008 20:19:58 -0000 Subject: [llvm-commits] [poolalloc] r56872 - in /poolalloc/trunk/lib/DSA: BottomUpClosure.cpp Makefile Printer.cpp Message-ID: <200809302019.m8UKJwkk004067@zion.cs.uiuc.edu> Author: alenhar2 Date: Tue Sep 30 15:19:58 2008 New Revision: 56872 URL: http://llvm.org/viewvc/llvm-project?rev=56872&view=rev Log: Fixup on partial inline stuff Modified: poolalloc/trunk/lib/DSA/BottomUpClosure.cpp poolalloc/trunk/lib/DSA/Makefile poolalloc/trunk/lib/DSA/Printer.cpp Modified: poolalloc/trunk/lib/DSA/BottomUpClosure.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/BottomUpClosure.cpp?rev=56872&r1=56871&r2=56872&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/BottomUpClosure.cpp (original) +++ poolalloc/trunk/lib/DSA/BottomUpClosure.cpp Tue Sep 30 15:19:58 2008 @@ -72,6 +72,12 @@ CloneAuxIntoGlobal(getDSGraph(*I)); } + //Be sure to get the all unresolved call sites + for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) + if (!I->isDeclaration() && InlinedSomewhere.find(I) == InlinedSomewhere.end()) + CloneAuxIntoGlobal(getDSGraph(*I)); + InlinedSomewhere.clear(); + // If we computed any temporary indcallgraphs, free them now. for (std::map, std::pair > >::iterator I = @@ -397,7 +403,8 @@ if (CalledFuncs.size() == 1) { Function *Callee = CalledFuncs[0]; ActualCallees.insert(std::make_pair(TheCall, Callee)); - + if (isComplete) InlinedSomewhere.insert(Callee); + // Get the data structure graph for the called function. GI = &getDSGraph(*Callee); // Graph to inline DOUT << " Inlining graph for " << Callee->getName() @@ -446,24 +453,26 @@ GI->getFunctionArgumentsForCall(*I, Args); // Merge all of the other callees into this graph. - for (++I; I != E; ++I) { - // If the graph already contains the nodes for the function, don't - // bother merging it in again. - if (!GI->containsFunction(*I)) { - GI->cloneInto(getDSGraph(**I)); - ++NumBUInlines; - } - - std::vector NextArgs; - GI->getFunctionArgumentsForCall(*I, NextArgs); - unsigned i = 0, e = Args.size(); - for (; i != e; ++i) { - if (i == NextArgs.size()) break; - Args[i].mergeWith(NextArgs[i]); + for (++I; I != E; ++I) + if (isComplete || hasDSGraph(**I)) { + if (isComplete) InlinedSomewhere.insert(*I); + // If the graph already contains the nodes for the function, don't + // bother merging it in again. + if (!GI->containsFunction(*I)) { + GI->cloneInto(getDSGraph(**I)); + ++NumBUInlines; + } + + std::vector NextArgs; + GI->getFunctionArgumentsForCall(*I, NextArgs); + unsigned i = 0, e = Args.size(); + for (; i != e; ++i) { + if (i == NextArgs.size()) break; + Args[i].mergeWith(NextArgs[i]); + } + for (e = NextArgs.size(); i != e; ++i) + Args.push_back(NextArgs[i]); } - for (e = NextArgs.size(); i != e; ++i) - Args.push_back(NextArgs[i]); - } // Clean up the final graph! GI->removeDeadNodes(DSGraph::KeepUnreachableGlobals); Modified: poolalloc/trunk/lib/DSA/Makefile URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/Makefile?rev=56872&r1=56871&r2=56872&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/Makefile (original) +++ poolalloc/trunk/lib/DSA/Makefile Tue Sep 30 15:19:58 2008 @@ -12,7 +12,6 @@ SHARED_LIBRARY=1 LIBRARYNAME = LLVMDataStructure -CFlags += -fPIC -Wno-deprecated - include $(LEVEL)/Makefile.common +CFlags += -Wno-deprecated Modified: poolalloc/trunk/lib/DSA/Printer.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/Printer.cpp?rev=56872&r1=56871&r2=56872&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/Printer.cpp (original) +++ poolalloc/trunk/lib/DSA/Printer.cpp Tue Sep 30 15:19:58 2008 @@ -279,7 +279,7 @@ unsigned TotalNumNodes = 0, TotalCallNodes = 0; for (Module::const_iterator I = M->begin(), E = M->end(); I != E; ++I) - if (C.hasGraph(*I)) { + if (C.hasDSGraph(*I)) { DSGraph &Gr = C.getDSGraph((Function&)*I); unsigned NumCalls = Gr.shouldPrintAuxCalls() ? Gr.getAuxFunctionCalls().size() : Gr.getFunctionCalls().size(); From alenhar2 at cs.uiuc.edu Tue Sep 30 15:35:08 2008 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Tue, 30 Sep 2008 20:35:08 -0000 Subject: [llvm-commits] [poolalloc] r56874 - in /poolalloc/trunk: Regressions/2008-09-30.john.ll include/dsa/DSGraph.h include/dsa/DataStructure.h lib/DSA/BottomUpClosure.cpp Message-ID: <200809302035.m8UKZ9bw004631@zion.cs.uiuc.edu> Author: alenhar2 Date: Tue Sep 30 15:35:08 2008 New Revision: 56874 URL: http://llvm.org/viewvc/llvm-project?rev=56874&view=rev Log: We could empty out the partial Callee list Added: poolalloc/trunk/Regressions/2008-09-30.john.ll Modified: poolalloc/trunk/include/dsa/DSGraph.h poolalloc/trunk/include/dsa/DataStructure.h poolalloc/trunk/lib/DSA/BottomUpClosure.cpp Added: poolalloc/trunk/Regressions/2008-09-30.john.ll URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/Regressions/2008-09-30.john.ll?rev=56874&view=auto ============================================================================== --- poolalloc/trunk/Regressions/2008-09-30.john.ll (added) +++ poolalloc/trunk/Regressions/2008-09-30.john.ll Tue Sep 30 15:35:08 2008 @@ -0,0 +1,154 @@ +; ModuleID = 'bugpoint-reduced-simplified.bc' +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:128:128" +target triple = "i386-apple-darwin9" + %struct.ap_conf_vector_t = type opaque + %struct.ap_configfile_t = type { i32 (i8*)*, i8* (i8*, i32, i8*)*, i32 (i8*)*, i8*, i8*, +i32 } + %struct.ap_directive_t = type { i8*, i8*, %struct.ap_directive_t*, +%struct.ap_directive_t*, %struct.ap_directive_t*, i8*, i8*, i32 } + %struct.ap_filter_func = type { i32 (%struct.ap_filter_t*, %struct.apr_bucket_brigade*)* +} + %struct.ap_filter_provider_t = type { i32, i32, %struct.ap_list_provider_names_t, +%struct.ap_filter_rec_t*, %struct.ap_filter_provider_t*, i32, i8* } + %struct.ap_filter_rec_t = type { i8*, %struct.ap_filter_func, i32 +(%struct.ap_filter_t*)*, i32, %struct.ap_filter_rec_t*, %struct.ap_filter_provider_t*, i32, i32 +} + %struct.ap_filter_t = type { %struct.ap_filter_rec_t*, i8*, %struct.ap_filter_t*, +%struct.request_rec*, %struct.conn_rec* } + %struct.ap_list_provider_names_t = type { i8* } + %struct.ap_method_list_t = type { i64, %struct.apr_array_header_t* } + %struct.apr_array_header_t = type { %struct.apr_pool_t*, i32, i32, i32, i8* } + %struct.apr_bucket = type { %struct.apr_bucket_list, %struct.apr_bucket_type_t*, i32, +i64, i8*, void (i8*)*, %struct.apr_bucket_alloc_t* } + %struct.apr_bucket_alloc_t = type opaque + %struct.apr_bucket_brigade = type { %struct.apr_pool_t*, %struct.apr_bucket_list, +%struct.apr_bucket_alloc_t* } + %struct.apr_bucket_list = type { %struct.apr_bucket*, %struct.apr_bucket* } + %struct.apr_bucket_type_t = type { i8*, i32, i32, void (i8*)*, i32 (%struct.apr_bucket*, +i8**, i32*, i32)*, i32 (%struct.apr_bucket*, %struct.apr_pool_t*)*, i32 (%struct.apr_bucket*, +i32)*, i32 (%struct.apr_bucket*, %struct.apr_bucket**)* } + %struct.apr_descriptor = type { %struct.apr_file_t* } + %struct.apr_file_t = type opaque + %struct.apr_finfo_t = type { %struct.apr_pool_t*, i32, i32, i32, i32, i32, i32, i32, i32, +i64, i64, i64, i64, i64, i8*, i8*, %struct.apr_file_t* } + %struct.apr_pollfd_t = type { %struct.apr_pool_t*, i32, i16, i16, %struct.apr_descriptor, +i8* } + %struct.apr_pool_t = type opaque + %struct.apr_sockaddr_t = type { %struct.apr_pool_t*, i8*, i8*, i16, i32, i32, i32, i32, +i8*, %struct.apr_sockaddr_t*, { %struct.sockaddr_storage } } + %struct.apr_table_t = type opaque + %struct.apr_uri_t = type { i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, %struct.hostent*, +i16, i8 } + %struct.cmd_func = type { i8* (%struct.cmd_parms*, i8*)* } + %struct.cmd_parms = type { i8*, i32, i64, %struct.apr_array_header_t*, +%struct.ap_method_list_t*, %struct.ap_configfile_t*, %struct.ap_directive_t*, +%struct.apr_pool_t*, %struct.apr_pool_t*, %struct.server_rec*, i8*, %struct.command_rec*, +%struct.ap_conf_vector_t*, %struct.ap_directive_t*, i32 } + %struct.command_rec = type { i8*, %struct.cmd_func, i8*, i32, i32, i8* } + %struct.conn_rec = type { %struct.apr_pool_t*, %struct.server_rec*, i8*, +%struct.apr_sockaddr_t*, %struct.apr_sockaddr_t*, i8*, i8*, i8*, i8, i32, i8, i32, i8*, i8*, +i32, %struct.ap_conf_vector_t*, %struct.apr_table_t*, %struct.ap_filter_t*, +%struct.ap_filter_t*, i8*, %struct.apr_bucket_alloc_t*, %struct.conn_state_t*, i32, i32 } + %struct.conn_state_t = type { { %struct.conn_state_t*, %struct.conn_state_t* }, i64, i32, +%struct.conn_rec*, %struct.apr_pool_t*, %struct.apr_bucket_alloc_t*, %struct.apr_pollfd_t } + %struct.hostent = type { i8*, i8**, i32, i32, i8** } + %struct.htaccess_result = type { i8*, i32, i32, %struct.ap_conf_vector_t*, +%struct.htaccess_result* } + %struct.module = type { i32, i32, i32, i8*, i8*, %struct.module*, i32, void +(%struct.process_rec*)*, i8* (%struct.apr_pool_t*, i8*)*, i8* (%struct.apr_pool_t*, i8*, i8*)*, +i8* (%struct.apr_pool_t*, %struct.server_rec*)*, i8* (%struct.apr_pool_t*, i8*, i8*)*, +%struct.command_rec*, void (%struct.apr_pool_t*)* } + %struct.process_rec = type { %struct.apr_pool_t*, %struct.apr_pool_t*, i32, i8**, i8* } + %struct.request_rec = type { %struct.apr_pool_t*, %struct.conn_rec*, %struct.server_rec*, +%struct.request_rec*, %struct.request_rec*, %struct.request_rec*, i8*, i32, i32, i32, i8*, i32, +i8*, i64, i8*, i32, i8*, i32, i64, %struct.apr_array_header_t*, %struct.ap_method_list_t*, i64, +i64, i64, i32, i8*, i64, i64, i64, i32, i32, i32, %struct.apr_table_t*, %struct.apr_table_t*, +%struct.apr_table_t*, %struct.apr_table_t*, %struct.apr_table_t*, i8*, i8*, i8*, +%struct.apr_array_header_t*, i8*, i8*, i8*, i32, i32, i8*, i8*, i8*, i8*, i8*, i8*, +%struct.apr_finfo_t, %struct.apr_uri_t, i32, %struct.ap_conf_vector_t*, +%struct.ap_conf_vector_t*, %struct.htaccess_result*, %struct.ap_filter_t*, %struct.ap_filter_t*, +%struct.ap_filter_t*, %struct.ap_filter_t*, i32 } + %struct.server_addr_rec = type { %struct.server_addr_rec*, %struct.apr_sockaddr_t*, i16, +i8* } + %struct.server_rec = type { %struct.process_rec*, %struct.server_rec*, i8*, i32, i8*, +i8*, i16, i8*, %struct.apr_file_t*, i32, i32, %struct.ap_conf_vector_t*, +%struct.ap_conf_vector_t*, %struct.server_addr_rec*, i64, i64, i32, i32, i8*, i32, +%struct.apr_array_header_t*, %struct.apr_array_header_t*, i32, i32, i32, i8* } + %struct.sockaddr_storage = type { i8, i8, [6 x i8], i64, [112 x i8] } + +define i32 @ap_parse_htaccess(%struct.ap_conf_vector_t** %result, %struct.request_rec* %r, i32 %override, i32 %override_opts, i8* %d, i8* %access_name) nounwind { +entry: + %f = alloca %struct.ap_configfile_t* ; <%struct.ap_configfile_t**> [#uses=2] + br label %bb23 + +bb11: ; preds = %bb23 + %0 = load %struct.ap_configfile_t** %f, align 4 ; <%struct.ap_configfile_t*> [#uses=1] + %1 = getelementptr %struct.ap_configfile_t* %0, i32 0, i32 2 ; [#uses=1] + %2 = load i32 (i8*)** %1, align 4 ; [#uses=1] + %3 = call i32 %2(i8* null) nounwind ; [#uses=0] + unreachable + +bb22: ; preds = %bb23 + ret i32 403 + +bb23: ; preds = %bb23, %bb23, %entry + %4 = call i32 @ap_pcfg_openfile(%struct.ap_configfile_t** %f, +%struct.apr_pool_t* null, i8* null) nounwind ; [#uses=1] + switch i32 %4, label %bb22 [ + i32 0, label %bb11 + i32 2, label %bb23 + i32 20, label %bb23 + ] +} + +define void @ap_single_module_configure(%struct.apr_pool_t* %p, %struct.server_rec* %s, +%struct.module* %m) nounwind { +entry: + unreachable +} + +define i32 @ap_open_logs(%struct.apr_pool_t* %pconf, %struct.apr_pool_t* %p, +%struct.apr_pool_t* %ptemp, %struct.server_rec* %s_main) nounwind { +entry: + unreachable +} + +define void @ap_log_error(i8* %file, i32 %line, i32 %level, i32 %status, +%struct.server_rec* %s, i8* %fmt, ...) nounwind { +entry: + ret void +} + +define void @ap_log_rerror(i8* %file, i32 %line, i32 %level, i32 %status, +%struct.request_rec* %r, i8* %fmt, ...) nounwind { +entry: + unreachable +} + +define i32 @cfg_close(i8* %param) nounwind { +entry: + ret i32 0 +} + +define i32 @ap_pcfg_openfile(%struct.ap_configfile_t** %ret_cfg, %struct.apr_pool_t* +%p, i8* %name) nounwind { +entry: + br i1 false, label %bb12, label %bb13 + +bb12: ; preds = %entry + %0 = bitcast i8* null to %struct.ap_configfile_t* ; <%struct.ap_configfile_t*> [#uses=2] + %1 = getelementptr %struct.ap_configfile_t* %0, i32 0, i32 2 ; [#uses=1] + store i32 (i8*)* @cfg_close, i32 (i8*)** %1, align 4 + store %struct.ap_configfile_t* %0, %struct.ap_configfile_t** %ret_cfg, align 4 + ret i32 0 + +bb13: ; preds = %entry + ret i32 0 +} + +define i8* @ap_escape_shell_cmd(%struct.apr_pool_t* %p, i8* %str) nounwind { +entry: + unreachable +} + Modified: poolalloc/trunk/include/dsa/DSGraph.h URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/dsa/DSGraph.h?rev=56874&r1=56873&r2=56874&view=diff ============================================================================== --- poolalloc/trunk/include/dsa/DSGraph.h (original) +++ poolalloc/trunk/include/dsa/DSGraph.h Tue Sep 30 15:35:08 2008 @@ -586,6 +586,8 @@ /// void mergeCallSite(DSCallSite &DestCS, const DSCallSite &SrcCS); + DSCallSite cloneCallSite(const DSCallSite& SrcCS); + bool clonedAnyNodes() const { return !NodeMap.empty(); } /// hasClonedNode - Return true if the specified node has been cloned from Modified: poolalloc/trunk/include/dsa/DataStructure.h URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/dsa/DataStructure.h?rev=56874&r1=56873&r2=56874&view=diff ============================================================================== --- poolalloc/trunk/include/dsa/DataStructure.h (original) +++ poolalloc/trunk/include/dsa/DataStructure.h Tue Sep 30 15:35:08 2008 @@ -83,7 +83,7 @@ public: - bool hasGraph(const Function &F) const { + bool hasDSGraph(const Function &F) const { return DSInfo.find(const_cast(&F)) != DSInfo.end(); } @@ -181,6 +181,8 @@ std::map, std::pair > > *IndCallGraphMap; + std::set InlinedSomewhere; + BUDataStructures(intptr_t id) : DataStructures(id) {} public: static char ID; @@ -228,6 +230,9 @@ unsigned calculateGraphs(Function *F, std::vector &Stack, unsigned &NextID, hash_map &ValMap); + + + void CloneAuxIntoGlobal(DSGraph& G); }; @@ -389,13 +394,7 @@ return *I->second; } - bool hasGraph(const Function &F) const { - return DSInfo.find(&F) != DSInfo.end(); - } - - /// ContainsDSGraphFor - Return true if we have a graph for the specified - /// function. - bool ContainsDSGraphFor(const Function &F) const { + bool hasDSGraph(const Function &F) const { return DSInfo.find(&F) != DSInfo.end(); } Modified: poolalloc/trunk/lib/DSA/BottomUpClosure.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/BottomUpClosure.cpp?rev=56874&r1=56873&r2=56874&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/BottomUpClosure.cpp (original) +++ poolalloc/trunk/lib/DSA/BottomUpClosure.cpp Tue Sep 30 15:35:08 2008 @@ -400,7 +400,7 @@ DSGraph *GI; Instruction *TheCall = CS.getCallSite().getInstruction(); - if (CalledFuncs.size() == 1) { + if (CalledFuncs.size() == 1 && (isComplete || hasDSGraph(*CalledFuncs[0]))) { Function *Callee = CalledFuncs[0]; ActualCallees.insert(std::make_pair(TheCall, Callee)); if (isComplete) InlinedSomewhere.insert(Callee); @@ -434,6 +434,16 @@ } DOUT << "\n"; + if (!isComplete) { + for (unsigned x = 0; x < CalledFuncs.size(); ) + if (!hasDSGraph(*CalledFuncs[x])) + CalledFuncs.erase(CalledFuncs.begin() + x); + else + ++x; + if (!CalledFuncs.size()) + continue; + } + // See if we already computed a graph for this set of callees. std::sort(CalledFuncs.begin(), CalledFuncs.end()); std::pair > &IndCallGraph = @@ -453,26 +463,25 @@ GI->getFunctionArgumentsForCall(*I, Args); // Merge all of the other callees into this graph. - for (++I; I != E; ++I) - if (isComplete || hasDSGraph(**I)) { - if (isComplete) InlinedSomewhere.insert(*I); - // If the graph already contains the nodes for the function, don't - // bother merging it in again. - if (!GI->containsFunction(*I)) { - GI->cloneInto(getDSGraph(**I)); - ++NumBUInlines; - } - - std::vector NextArgs; - GI->getFunctionArgumentsForCall(*I, NextArgs); - unsigned i = 0, e = Args.size(); - for (; i != e; ++i) { - if (i == NextArgs.size()) break; - Args[i].mergeWith(NextArgs[i]); - } - for (e = NextArgs.size(); i != e; ++i) - Args.push_back(NextArgs[i]); + for (++I; I != E; ++I) { + if (isComplete) InlinedSomewhere.insert(*I); + // If the graph already contains the nodes for the function, don't + // bother merging it in again. + if (!GI->containsFunction(*I)) { + GI->cloneInto(getDSGraph(**I)); + ++NumBUInlines; + } + + std::vector NextArgs; + GI->getFunctionArgumentsForCall(*I, NextArgs); + unsigned i = 0, e = Args.size(); + for (; i != e; ++i) { + if (i == NextArgs.size()) break; + Args[i].mergeWith(NextArgs[i]); } + for (e = NextArgs.size(); i != e; ++i) + Args.push_back(NextArgs[i]); + } // Clean up the final graph! GI->removeDeadNodes(DSGraph::KeepUnreachableGlobals); From evan.cheng at apple.com Tue Sep 30 15:40:48 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 30 Sep 2008 20:40:48 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r56875 - /llvm-gcc-4.2/trunk/gcc/config/darwin.c Message-ID: <200809302040.m8UKenBJ004842@zion.cs.uiuc.edu> Author: evancheng Date: Tue Sep 30 15:40:47 2008 New Revision: 56875 URL: http://llvm.org/viewvc/llvm-project?rev=56875&view=rev Log: Unbreak Apple style build. Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.c Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/darwin.c?rev=56875&r1=56874&r2=56875&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/darwin.c (original) +++ llvm-gcc-4.2/trunk/gcc/config/darwin.c Tue Sep 30 15:40:47 2008 @@ -2675,13 +2675,14 @@ /* LLVM LOCAL begin radar 6230142 */ unsigned darwin_llvm_override_target_version(const char *triple, char **new_triple) { int len = 0, pad = 0, version = 0; + char *substr; if (!darwin_macosx_version_min) return 0; /* Triple string is expected to look something like 'i386-*-darwin?' or 'i386-*-darwin9.5.0' */ - char *substr = strstr(triple, "darwin"); + substr = strstr(triple, "darwin"); if (!substr) return 0; len = substr + 6 - triple; From gohman at apple.com Tue Sep 30 15:48:30 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 30 Sep 2008 20:48:30 -0000 Subject: [llvm-commits] [llvm] r56877 - in /llvm/trunk: lib/CodeGen/SelectionDAG/FastISel.cpp utils/TableGen/FastISelEmitter.cpp Message-ID: <200809302048.m8UKmUJW005100@zion.cs.uiuc.edu> Author: djg Date: Tue Sep 30 15:48:29 2008 New Revision: 56877 URL: http://llvm.org/viewvc/llvm-project?rev=56877&view=rev Log: Move the primary fast-isel top-level comments to FastISel.cpp, where they'll be a little more visible. Also, update and reword them a bit. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp llvm/trunk/utils/TableGen/FastISelEmitter.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp?rev=56877&r1=56876&r2=56877&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp Tue Sep 30 15:48:29 2008 @@ -9,6 +9,34 @@ // // This file contains the implementation of the FastISel class. // +// "Fast" instruction selection is designed to emit very poor code quickly. +// Also, it is not designed to be able to do much lowering, so most illegal +// types (e.g. i64 on 32-bit targets) and operations (e.g. calls) are not +// supported. It is also not intended to be able to do much optimization, +// except in a few cases where doing optimizations reduces overall compile +// time (e.g. folding constants into immediate fields, because it's cheap +// and it reduces the number of instructions later phases have to examine). +// +// "Fast" instruction selection is able to fail gracefully and transfer +// control to the SelectionDAG selector for operations that it doesn't +// support. In many cases, this allows us to avoid duplicating a lot of +// the complicated lowering logic that SelectionDAG currently has. +// +// The intended use for "fast" instruction selection is "-O0" mode +// compilation, where the quality of the generated code is irrelevant when +// weighed against the speed at which the code can be generated. Also, +// at -O0, the LLVM optimizers are not running, and this makes the +// compile time of codegen a much higher portion of the overall compile +// time. Despite its limitations, "fast" instruction selection is able to +// handle enough code on its own to provide noticeable overall speedups +// in -O0 compiles. +// +// Basic operations are supported in a target-independent way, by reading +// the same instruction descriptions that the SelectionDAG selector reads, +// and identifying simple arithmetic operations that can be directly selected +// from simple operators. More complicated operations currently require +// target-specific code. +// //===----------------------------------------------------------------------===// #include "llvm/Function.h" Modified: llvm/trunk/utils/TableGen/FastISelEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/FastISelEmitter.cpp?rev=56877&r1=56876&r2=56877&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/FastISelEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/FastISelEmitter.cpp Tue Sep 30 15:48:29 2008 @@ -7,32 +7,14 @@ // //===----------------------------------------------------------------------===// // -// This tablegen backend emits a "fast" instruction selector. +// This tablegen backend emits code for use by the "fast" instruction +// selection algorithm. See the comments at the top of +// lib/CodeGen/SelectionDAG/FastISel.cpp for background. // -// This instruction selection method is designed to emit very poor code -// quickly. Also, it is not designed to do much lowering, so most illegal -// types (e.g. i64 on 32-bit targets) and operations (e.g. calls) are not -// supported and cannot easily be added. Blocks containing operations -// that are not supported need to be handled by a more capable selector, -// such as the SelectionDAG selector. +// This file scans through the target's tablegen instruction-info files +// and extracts instructions with obvious-looking patterns, and it emits +// code to look up these instructions by type and operator. // -// The intended use for "fast" instruction selection is "-O0" mode -// compilation, where the quality of the generated code is irrelevant when -// weighed against the speed at which the code can be generated. -// -// If compile time is so important, you might wonder why we don't just -// skip codegen all-together, emit LLVM bytecode files, and execute them -// with an interpreter. The answer is that it would complicate linking and -// debugging, and also because that isn't how a compiler is expected to -// work in some circles. -// -// If you need better generated code or more lowering than what this -// instruction selector provides, use the SelectionDAG (DAGISel) instruction -// selector instead. If you're looking here because SelectionDAG isn't fast -// enough, consider looking into improving the SelectionDAG infastructure -// instead. At the time of this writing there remain several major -// opportunities for improvement. -// //===----------------------------------------------------------------------===// #include "FastISelEmitter.h" From criswell at uiuc.edu Tue Sep 30 16:00:41 2008 From: criswell at uiuc.edu (John Criswell) Date: Tue, 30 Sep 2008 21:00:41 -0000 Subject: [llvm-commits] [poolalloc] r56881 - in /poolalloc/trunk: include/poolalloc/PoolAllocate.h lib/PoolAllocate/PASimple.cpp lib/PoolAllocate/PoolAllocate.cpp lib/PoolAllocate/TransformFunctionBody.cpp Message-ID: <200809302100.m8UL0g43005470@zion.cs.uiuc.edu> Author: criswell Date: Tue Sep 30 16:00:41 2008 New Revision: 56881 URL: http://llvm.org/viewvc/llvm-project?rev=56881&view=rev Log: Updated to new EquivClassGraph API; use hasDSGraph() instead of hasGraph() or ContainsDSGraphFor(). Modified: poolalloc/trunk/include/poolalloc/PoolAllocate.h poolalloc/trunk/lib/PoolAllocate/PASimple.cpp poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp Modified: poolalloc/trunk/include/poolalloc/PoolAllocate.h URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/poolalloc/PoolAllocate.h?rev=56881&r1=56880&r2=56881&view=diff ============================================================================== --- poolalloc/trunk/include/poolalloc/PoolAllocate.h (original) +++ poolalloc/trunk/include/poolalloc/PoolAllocate.h Tue Sep 30 16:00:41 2008 @@ -120,7 +120,7 @@ virtual const Type * getPoolType() {return 0;} virtual bool hasDSGraph (const Function & F) const { - return ECGraphs->hasGraph (F); + return ECGraphs->hasDSGraph (F); } virtual DSGraph & getDSGraph (const Function & F) const { Modified: poolalloc/trunk/lib/PoolAllocate/PASimple.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PASimple.cpp?rev=56881&r1=56880&r2=56881&view=diff ============================================================================== --- poolalloc/trunk/lib/PoolAllocate/PASimple.cpp (original) +++ poolalloc/trunk/lib/PoolAllocate/PASimple.cpp Tue Sep 30 16:00:41 2008 @@ -124,7 +124,7 @@ CombinedDSGraph = new DSGraph (GlobalECs, TD, &(ECGraphs->getGlobalsGraph())); //CombinedDSGraph.cloneInto (getGlobalsGraph()); for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) { - if (ECGraphs->hasGraph (*I)) + if (ECGraphs->hasDSGraph (*I)) CombinedDSGraph->cloneInto (ECGraphs->getDSGraph(*I)); } CombinedDSGraph->cloneInto (ECGraphs->getGlobalsGraph()); Modified: poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp?rev=56881&r1=56880&r2=56881&view=diff ============================================================================== --- poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp (original) +++ poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp Tue Sep 30 16:00:41 2008 @@ -125,7 +125,7 @@ // Loop over the functions in the original program finding the pool desc. // arguments necessary for each function that is indirectly callable. for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) - if (!I->isDeclaration() && ECGraphs->ContainsDSGraphFor(*I)) + if (!I->isDeclaration() && ECGraphs->hasDSGraph(*I)) FindFunctionPoolArgs(*I); std::map FuncMap; @@ -138,7 +138,7 @@ {TIME_REGION(X, "MakeFunctionClone"); for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) if (!I->isDeclaration() && !ClonedFunctions.count(I) && - ECGraphs->ContainsDSGraphFor(*I)) + ECGraphs->hasDSGraph(*I)) if (Function *Clone = MakeFunctionClone(*I)) { FuncMap[I] = Clone; ClonedFunctions.insert(Clone); @@ -150,7 +150,7 @@ {TIME_REGION(X, "ProcessFunctionBody"); for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) if (!I->isDeclaration() && !ClonedFunctions.count(I) && - ECGraphs->ContainsDSGraphFor(*I)) { + ECGraphs->hasDSGraph(*I)) { std::map::iterator FI = FuncMap.find(I); ProcessFunctionBody(*I, FI != FuncMap.end() ? *FI->second : *I); } Modified: poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp?rev=56881&r1=56880&r2=56881&view=diff ============================================================================== --- poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp (original) +++ poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp Tue Sep 30 16:00:41 2008 @@ -596,7 +596,7 @@ NewCallee = CFI->Clone; ArgNodes = CFI->ArgNodes; - assert ((ECGraphs.hasGraph (*CF)) && "Function has no ECGraph!\n"); + assert ((ECGraphs.hasDSGraph (*CF)) && "Function has no ECGraph!\n"); CalleeGraph = &ECGraphs.getDSGraph(*CF); } else { DEBUG(std::cerr << " Handling indirect call: " << *TheCall); From alenhar2 at cs.uiuc.edu Tue Sep 30 16:02:18 2008 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Tue, 30 Sep 2008 21:02:18 -0000 Subject: [llvm-commits] [poolalloc] r56882 - in /poolalloc/trunk: include/poolalloc/PoolAllocate.h lib/PoolAllocate/PoolAllocate.cpp Message-ID: <200809302102.m8UL2JrN005544@zion.cs.uiuc.edu> Author: alenhar2 Date: Tue Sep 30 16:02:18 2008 New Revision: 56882 URL: http://llvm.org/viewvc/llvm-project?rev=56882&view=rev Log: minor func name change Modified: poolalloc/trunk/include/poolalloc/PoolAllocate.h poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp Modified: poolalloc/trunk/include/poolalloc/PoolAllocate.h URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/poolalloc/PoolAllocate.h?rev=56882&r1=56881&r2=56882&view=diff ============================================================================== --- poolalloc/trunk/include/poolalloc/PoolAllocate.h (original) +++ poolalloc/trunk/include/poolalloc/PoolAllocate.h Tue Sep 30 16:02:18 2008 @@ -356,7 +356,7 @@ /// load or store to that pool is performed. struct PoolAllocatePassAllPools : public PoolAllocate { static char ID; - PoolAllocatePassAllPools() : PoolAllocate(true, (intptr_t) &ID) {} + PoolAllocatePassAllPools() : PoolAllocate(true, false, (intptr_t) &ID) {} }; /// PoolAllocateSimple - This class modifies the heap allocations so that they Modified: poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp?rev=56882&r1=56881&r2=56882&view=diff ============================================================================== --- poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp (original) +++ poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp Tue Sep 30 16:02:18 2008 @@ -231,11 +231,12 @@ // Get the Function out of the constant Function * F; ConstantExpr * CE; - if (!(F=dyn_cast(C))) + if (!(F=dyn_cast(C))) { if ((CE = dyn_cast(C)) && (CE->isCast())) F = dyn_cast(CE->getOperand(0)); else assert (0 && "Constant is not a Function of ConstantExpr!"); + } Calls.clear(); for (Value::use_iterator UI = F->use_begin(), E = F->use_end(); UI != E; ++UI) Calls.push_back(cast(*UI)); From isanbard at gmail.com Tue Sep 30 16:09:21 2008 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 30 Sep 2008 21:09:21 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r56883 - /llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Message-ID: <200809302109.m8UL9LRJ005852@zion.cs.uiuc.edu> Author: void Date: Tue Sep 30 16:09:21 2008 New Revision: 56883 URL: http://llvm.org/viewvc/llvm-project?rev=56883&view=rev Log: Add support for sending the "-fno-builtin" flag to the LLVM back-end. Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.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=56883&r1=56882&r2=56883&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Tue Sep 30 16:09:21 2008 @@ -70,6 +70,7 @@ #include "tree-inline.h" #include "langhooks.h" #include "cgraph.h" +#include "c-common.h" } // Non-zero if bytecode from PCH is successfully read. @@ -165,6 +166,9 @@ ArgStrings.push_back(Arg); } + if (flag_no_builtin) + ArgStrings.push_back(std::string("--no-builtin")); + if (llvm_optns) { std::string Opts = llvm_optns; for (std::string Opt = getToken(Opts); !Opt.empty(); Opt = getToken(Opts)) From isanbard at gmail.com Tue Sep 30 16:22:07 2008 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 30 Sep 2008 21:22:07 -0000 Subject: [llvm-commits] [llvm] r56885 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86Subtarget.cpp lib/Target/X86/X86Subtarget.h Message-ID: <200809302122.m8ULM79C006409@zion.cs.uiuc.edu> Author: void Date: Tue Sep 30 16:22:07 2008 New Revision: 56885 URL: http://llvm.org/viewvc/llvm-project?rev=56885&view=rev Log: Add the new `-no-builtin' flag. This flag is meant to mimic the GCC `-fno-builtin' flag. Currently, it's used to replace "memset" with "_bzero" instead of "__bzero" on Darwin10+. This arguably violates the meaning of this flag, but is currently sufficient. The meaning of this flag should become more specific over time. Modified: llvm/trunk/include/llvm/Target/TargetLowering.h llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.h llvm/trunk/lib/Target/X86/X86Subtarget.cpp llvm/trunk/lib/Target/X86/X86Subtarget.h Modified: llvm/trunk/include/llvm/Target/TargetLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=56885&r1=56884&r2=56885&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetLowering.h (original) +++ llvm/trunk/include/llvm/Target/TargetLowering.h Tue Sep 30 16:22:07 2008 @@ -1049,7 +1049,8 @@ SDValue Chain, SDValue Op1, SDValue Op2, SDValue Op3, unsigned Align, - const Value *DstSV, uint64_t DstOff) { + const Value *DstSV, uint64_t DstOff, + bool NoBuiltin = false) { return SDValue(); } Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=56885&r1=56884&r2=56885&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Sep 30 16:22:07 2008 @@ -29,6 +29,7 @@ #include "llvm/Target/TargetLowering.h" #include "llvm/Target/TargetInstrInfo.h" #include "llvm/Target/TargetMachine.h" +#include "llvm/Support/CommandLine.h" #include "llvm/Support/MathExtras.h" #include "llvm/Support/raw_ostream.h" #include "llvm/ADT/SetVector.h" @@ -40,6 +41,11 @@ #include using namespace llvm; +static cl::opt +NoBuiltin("no-builtin", + cl::desc("Don't recognize built-in functions that do not begin " + "with `__builtin_' as prefix")); + /// makeVTList - Return an instance of the SDVTList struct initialized with the /// specified members. static SDVTList makeVTList(const MVT *VTs, unsigned NumVTs) { @@ -3189,7 +3195,7 @@ // code. If the target chooses to do this, this is the next best. SDValue Result = TLI.EmitTargetCodeForMemset(*this, Chain, Dst, Src, Size, Align, - DstSV, DstSVOff); + DstSV, DstSVOff, NoBuiltin); if (Result.getNode()) return Result; Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=56885&r1=56884&r2=56885&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Tue Sep 30 16:22:07 2008 @@ -5128,15 +5128,17 @@ SDValue X86TargetLowering::EmitTargetCodeForMemset(SelectionDAG &DAG, - SDValue Chain, - SDValue Dst, SDValue Src, - SDValue Size, unsigned Align, - const Value *DstSV, uint64_t DstSVOff) { + SDValue Chain, + SDValue Dst, SDValue Src, + SDValue Size, unsigned Align, + const Value *DstSV, + uint64_t DstSVOff, + bool NoBuiltin) { ConstantSDNode *ConstantSize = dyn_cast(Size); - /// If not DWORD aligned or size is more than the threshold, call the library. - /// The libc version is likely to be faster for these cases. It can use the - /// address value and run time information about the CPU. + // If not DWORD aligned or size is more than the threshold, call the library. + // The libc version is likely to be faster for these cases. It can use the + // address value and run time information about the CPU. if ((Align & 3) != 0 || !ConstantSize || ConstantSize->getZExtValue() > @@ -5145,8 +5147,9 @@ // Check to see if there is a specialized entry-point for memory zeroing. ConstantSDNode *V = dyn_cast(Src); - if (const char *bzeroEntry = - V && V->isNullValue() ? Subtarget->getBZeroEntry() : 0) { + + if (const char *bzeroEntry = V && + V->isNullValue() ? Subtarget->getBZeroEntry(NoBuiltin) : 0) { MVT IntPtr = getPointerTy(); const Type *IntPtrTy = TD->getIntPtrType(); TargetLowering::ArgListTy Args; Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.h?rev=56885&r1=56884&r2=56885&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.h (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.h Tue Sep 30 16:22:07 2008 @@ -575,17 +575,18 @@ SDNode *ExpandATOMIC_CMP_SWAP(SDNode *N, SelectionDAG &DAG); SDValue EmitTargetCodeForMemset(SelectionDAG &DAG, - SDValue Chain, - SDValue Dst, SDValue Src, - SDValue Size, unsigned Align, - const Value *DstSV, uint64_t DstSVOff); + SDValue Chain, + SDValue Dst, SDValue Src, + SDValue Size, unsigned Align, + const Value *DstSV, uint64_t DstSVOff, + bool NoBuiltin); SDValue EmitTargetCodeForMemcpy(SelectionDAG &DAG, - SDValue Chain, - SDValue Dst, SDValue Src, - SDValue Size, unsigned Align, - bool AlwaysInline, - const Value *DstSV, uint64_t DstSVOff, - const Value *SrcSV, uint64_t SrcSVOff); + SDValue Chain, + SDValue Dst, SDValue Src, + SDValue Size, unsigned Align, + bool AlwaysInline, + const Value *DstSV, uint64_t DstSVOff, + const Value *SrcSV, uint64_t SrcSVOff); /// Utility function to emit atomic bitwise operations (and, or, xor). // It takes the bitwise instruction to expand, the associated machine basic Modified: llvm/trunk/lib/Target/X86/X86Subtarget.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.cpp?rev=56885&r1=56884&r2=56885&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86Subtarget.cpp (original) +++ llvm/trunk/lib/Target/X86/X86Subtarget.cpp Tue Sep 30 16:22:07 2008 @@ -59,16 +59,14 @@ return false; } -/// This function returns the name of a function which has an interface -/// like the non-standard bzero function, if such a function exists on -/// the current subtarget and it is considered prefereable over -/// memset with zero passed as the second argument. Otherwise it -/// returns null. -const char *X86Subtarget::getBZeroEntry() const { - +/// getBZeroEntry - This function returns the name of a function which has an +/// interface like the non-standard bzero function, if such a function exists on +/// the current subtarget and it is considered prefereable over memset with zero +/// passed as the second argument. Otherwise it returns null. +const char *X86Subtarget::getBZeroEntry(bool NoBuiltin) const { // Darwin 10 has a __bzero entry point for this purpose. if (getDarwinVers() >= 10) - return "__bzero"; + return NoBuiltin ? "_bzero" : "__bzero"; return 0; } Modified: llvm/trunk/lib/Target/X86/X86Subtarget.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.h?rev=56885&r1=56884&r2=56885&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86Subtarget.h (original) +++ llvm/trunk/lib/Target/X86/X86Subtarget.h Tue Sep 30 16:22:07 2008 @@ -184,7 +184,7 @@ /// the current subtarget and it is considered prefereable over /// memset with zero passed as the second argument. Otherwise it /// returns null. - const char *getBZeroEntry() const; + const char *getBZeroEntry(bool NoBuiltin) const; }; namespace X86 { From isanbard at gmail.com Tue Sep 30 16:40:31 2008 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 30 Sep 2008 21:40:31 -0000 Subject: [llvm-commits] [llvm] r56886 - in /llvm/trunk: lib/CodeGen/SelectionDAG/SelectionDAG.cpp test/CodeGen/X86/darwin-bzero.ll Message-ID: <200809302140.m8ULeWAf007187@zion.cs.uiuc.edu> Author: void Date: Tue Sep 30 16:40:30 2008 New Revision: 56886 URL: http://llvm.org/viewvc/llvm-project?rev=56886&view=rev Log: - Initialize "--no-builtin" to "false". - Testcase for r56885. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/trunk/test/CodeGen/X86/darwin-bzero.ll Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=56886&r1=56885&r2=56886&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Sep 30 16:40:30 2008 @@ -42,7 +42,7 @@ using namespace llvm; static cl::opt -NoBuiltin("no-builtin", +NoBuiltin("no-builtin", cl::init(false), cl::desc("Don't recognize built-in functions that do not begin " "with `__builtin_' as prefix")); Modified: llvm/trunk/test/CodeGen/X86/darwin-bzero.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/darwin-bzero.ll?rev=56886&r1=56885&r2=56886&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/darwin-bzero.ll (original) +++ llvm/trunk/test/CodeGen/X86/darwin-bzero.ll Tue Sep 30 16:40:30 2008 @@ -1,4 +1,5 @@ ; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin10 | grep __bzero +; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin10 -no-builtin | grep _bzero declare void @llvm.memset.i32(i8*, i8, i32, i32) From gohman at apple.com Tue Sep 30 16:47:41 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 30 Sep 2008 14:47:41 -0700 Subject: [llvm-commits] [llvm] r56885 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86Subtarget.cpp lib/Target/X86/X86Subtarget.h In-Reply-To: <200809302122.m8ULM79C006409@zion.cs.uiuc.edu> References: <200809302122.m8ULM79C006409@zion.cs.uiuc.edu> Message-ID: <6FEA093E-FCC1-46E9-AE7E-9E6D6ABF6454@apple.com> On Sep 30, 2008, at 2:22 PM, Bill Wendling wrote: > Author: void > Date: Tue Sep 30 16:22:07 2008 > New Revision: 56885 > > URL: http://llvm.org/viewvc/llvm-project?rev=56885&view=rev > Log: > Add the new `-no-builtin' flag. This flag is meant to mimic the GCC > `-fno-builtin' flag. Currently, it's used to replace "memset" with > "_bzero" > instead of "__bzero" on Darwin10+. This arguably violates the > meaning of this > flag, but is currently sufficient. The meaning of this flag should > become more > specific over time. First, -fno-builtin is only intended to apply to user calls. It is not intended to apply to libcalls that the compiler generates. For example, specifying -fno-builtin-memcpy does not tell the compiler not to generate calls to memcpy. Second, it looks like there is confusion about the leading underscores. The previous code used "__bzero" on Darwin 10, which is actually printed as "___bzero" because of Darwin ABI rules. By introducing new code that uses "_bzero", it will be printed as "__bzero" on Darwin, which doesn't seem to be what was intended here. And furthermore, if "bzero" was intended, meaning printing in the output as "_bzero" on Darwin, that's an even more flagrant abuse of the -fno-builtin flag. -fno-builtin doesn't mean that the compiler can call functions with names in the user namespace not reserved by the C standard. Dan From dpatel at apple.com Tue Sep 30 16:49:15 2008 From: dpatel at apple.com (Devang Patel) Date: Tue, 30 Sep 2008 14:49:15 -0700 Subject: [llvm-commits] [llvm] r56885 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86Subtarget.cpp lib/Target/X86/X86Subtarget.h In-Reply-To: <200809302122.m8ULM79C006409@zion.cs.uiuc.edu> References: <200809302122.m8ULM79C006409@zion.cs.uiuc.edu> Message-ID: <8CF6F58B-133F-4470-B02A-B00B1C3D399C@apple.com> On Sep 30, 2008, at 2:22 PM, Bill Wendling wrote: > Author: void > Date: Tue Sep 30 16:22:07 2008 > New Revision: 56885 > > URL: http://llvm.org/viewvc/llvm-project?rev=56885&view=rev > Log: > Add the new `-no-builtin' flag. This flag is meant to mimic the GCC > `-fno-builtin' flag. Currently, it's used to replace "memset" with > "_bzero" > instead of "__bzero" on Darwin10+. This arguably violates the > meaning of this > flag, but is currently sufficient. The meaning of this flag should > become more > specific over time. Is it possible encode this in IR as an attribute ? Right now this info. is lost during 1) llvm-gcc -c --emit-llvm -fno-builtin foo.c -o foo.bc && llc foo.bc - o foo.s 2) and LTO. - Devang > > > Modified: > llvm/trunk/include/llvm/Target/TargetLowering.h > llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp > llvm/trunk/lib/Target/X86/X86ISelLowering.cpp > llvm/trunk/lib/Target/X86/X86ISelLowering.h > llvm/trunk/lib/Target/X86/X86Subtarget.cpp > llvm/trunk/lib/Target/X86/X86Subtarget.h > > Modified: llvm/trunk/include/llvm/Target/TargetLowering.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=56885&r1=56884&r2=56885&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/include/llvm/Target/TargetLowering.h (original) > +++ llvm/trunk/include/llvm/Target/TargetLowering.h Tue Sep 30 > 16:22:07 2008 > @@ -1049,7 +1049,8 @@ > SDValue Chain, > SDValue Op1, SDValue Op2, > SDValue Op3, unsigned Align, > - const Value *DstSV, uint64_t DstOff) { > + const Value *DstSV, uint64_t DstOff, > + bool NoBuiltin = false) { > return SDValue(); > } > > > Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=56885&r1=56884&r2=56885&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) > +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Sep 30 > 16:22:07 2008 > @@ -29,6 +29,7 @@ > #include "llvm/Target/TargetLowering.h" > #include "llvm/Target/TargetInstrInfo.h" > #include "llvm/Target/TargetMachine.h" > +#include "llvm/Support/CommandLine.h" > #include "llvm/Support/MathExtras.h" > #include "llvm/Support/raw_ostream.h" > #include "llvm/ADT/SetVector.h" > @@ -40,6 +41,11 @@ > #include > using namespace llvm; > > +static cl::opt > +NoBuiltin("no-builtin", > + cl::desc("Don't recognize built-in functions that do not > begin " > + "with `__builtin_' as prefix")); > + > /// makeVTList - Return an instance of the SDVTList struct > initialized with the > /// specified members. > static SDVTList makeVTList(const MVT *VTs, unsigned NumVTs) { > @@ -3189,7 +3195,7 @@ > // code. If the target chooses to do this, this is the next best. > SDValue Result = > TLI.EmitTargetCodeForMemset(*this, Chain, Dst, Src, Size, Align, > - DstSV, DstSVOff); > + DstSV, DstSVOff, NoBuiltin); > if (Result.getNode()) > return Result; > > > Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=56885&r1=56884&r2=56885&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) > +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Tue Sep 30 > 16:22:07 2008 > @@ -5128,15 +5128,17 @@ > > SDValue > X86TargetLowering::EmitTargetCodeForMemset(SelectionDAG &DAG, > - SDValue Chain, > - SDValue Dst, SDValue Src, > - SDValue Size, unsigned Align, > - const Value *DstSV, > uint64_t DstSVOff) { > + SDValue Chain, > + SDValue Dst, SDValue Src, > + SDValue Size, unsigned > Align, > + const Value *DstSV, > + uint64_t DstSVOff, > + bool NoBuiltin) { > ConstantSDNode *ConstantSize = dyn_cast(Size); > > - /// If not DWORD aligned or size is more than the threshold, call > the library. > - /// The libc version is likely to be faster for these cases. It > can use the > - /// address value and run time information about the CPU. > + // If not DWORD aligned or size is more than the threshold, call > the library. > + // The libc version is likely to be faster for these cases. It > can use the > + // address value and run time information about the CPU. > if ((Align & 3) != 0 || > !ConstantSize || > ConstantSize->getZExtValue() > > @@ -5145,8 +5147,9 @@ > > // Check to see if there is a specialized entry-point for memory > zeroing. > ConstantSDNode *V = dyn_cast(Src); > - if (const char *bzeroEntry = > - V && V->isNullValue() ? Subtarget->getBZeroEntry() : 0) { > + > + if (const char *bzeroEntry = V && > + V->isNullValue() ? Subtarget->getBZeroEntry(NoBuiltin) : 0) { > MVT IntPtr = getPointerTy(); > const Type *IntPtrTy = TD->getIntPtrType(); > TargetLowering::ArgListTy Args; > > Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.h?rev=56885&r1=56884&r2=56885&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/X86/X86ISelLowering.h (original) > +++ llvm/trunk/lib/Target/X86/X86ISelLowering.h Tue Sep 30 16:22:07 > 2008 > @@ -575,17 +575,18 @@ > SDNode *ExpandATOMIC_CMP_SWAP(SDNode *N, SelectionDAG &DAG); > > SDValue EmitTargetCodeForMemset(SelectionDAG &DAG, > - SDValue Chain, > - SDValue Dst, SDValue Src, > - SDValue Size, unsigned Align, > - const Value *DstSV, uint64_t > DstSVOff); > + SDValue Chain, > + SDValue Dst, SDValue Src, > + SDValue Size, unsigned Align, > + const Value *DstSV, uint64_t > DstSVOff, > + bool NoBuiltin); > SDValue EmitTargetCodeForMemcpy(SelectionDAG &DAG, > - SDValue Chain, > - SDValue Dst, SDValue Src, > - SDValue Size, unsigned Align, > - bool AlwaysInline, > - const Value *DstSV, uint64_t > DstSVOff, > - const Value *SrcSV, uint64_t > SrcSVOff); > + SDValue Chain, > + SDValue Dst, SDValue Src, > + SDValue Size, unsigned Align, > + bool AlwaysInline, > + const Value *DstSV, uint64_t > DstSVOff, > + const Value *SrcSV, uint64_t > SrcSVOff); > > /// Utility function to emit atomic bitwise operations (and, or, > xor). > // It takes the bitwise instruction to expand, the associated > machine basic > > Modified: llvm/trunk/lib/Target/X86/X86Subtarget.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.cpp?rev=56885&r1=56884&r2=56885&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/X86/X86Subtarget.cpp (original) > +++ llvm/trunk/lib/Target/X86/X86Subtarget.cpp Tue Sep 30 16:22:07 > 2008 > @@ -59,16 +59,14 @@ > return false; > } > > -/// This function returns the name of a function which has an > interface > -/// like the non-standard bzero function, if such a function exists > on > -/// the current subtarget and it is considered prefereable over > -/// memset with zero passed as the second argument. Otherwise it > -/// returns null. > -const char *X86Subtarget::getBZeroEntry() const { > - > +/// getBZeroEntry - This function returns the name of a function > which has an > +/// interface like the non-standard bzero function, if such a > function exists on > +/// the current subtarget and it is considered prefereable over > memset with zero > +/// passed as the second argument. Otherwise it returns null. > +const char *X86Subtarget::getBZeroEntry(bool NoBuiltin) const { > // Darwin 10 has a __bzero entry point for this purpose. > if (getDarwinVers() >= 10) > - return "__bzero"; > + return NoBuiltin ? "_bzero" : "__bzero"; > > return 0; > } > > Modified: llvm/trunk/lib/Target/X86/X86Subtarget.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.h?rev=56885&r1=56884&r2=56885&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/X86/X86Subtarget.h (original) > +++ llvm/trunk/lib/Target/X86/X86Subtarget.h Tue Sep 30 16:22:07 2008 > @@ -184,7 +184,7 @@ > /// the current subtarget and it is considered prefereable over > /// memset with zero passed as the second argument. Otherwise it > /// returns null. > - const char *getBZeroEntry() const; > + const char *getBZeroEntry(bool NoBuiltin) const; > }; > > namespace X86 { > > > _______________________________________________ > 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 Sep 30 16:52:28 2008 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 30 Sep 2008 14:52:28 -0700 Subject: [llvm-commits] [llvm] r56885 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86Subtarget.cpp lib/Target/X86/X86Su Message-ID: <16e5fdf90809301452r1039ca1ch27b4145ce79c5f7b@mail.gmail.com> On Tue, Sep 30, 2008 at 2:47 PM, Dan Gohman wrote: > > On Sep 30, 2008, at 2:22 PM, Bill Wendling wrote: > >> Author: void >> Date: Tue Sep 30 16:22:07 2008 >> New Revision: 56885 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=56885&view=rev >> Log: >> Add the new `-no-builtin' flag. This flag is meant to mimic the GCC >> `-fno-builtin' flag. Currently, it's used to replace "memset" with >> "_bzero" >> instead of "__bzero" on Darwin10+. This arguably violates the >> meaning of this >> flag, but is currently sufficient. The meaning of this flag should >> become more >> specific over time. > > First, -fno-builtin is only intended to apply to user calls. It is not > intended to apply to libcalls that the compiler generates. For example, > specifying -fno-builtin-memcpy does not tell the compiler not to > generate calls to memcpy. > > Second, it looks like there is confusion about the leading underscores. > The previous code used "__bzero" on Darwin 10, which is actually > printed as "___bzero" because of Darwin ABI rules. By introducing new > code that uses "_bzero", it will be printed as "__bzero" on Darwin, > which doesn't seem to be what was intended here. > That's what was intended. > And furthermore, if "bzero" was intended, meaning printing in the > output as "_bzero" on Darwin, that's an even more flagrant abuse of > the -fno-builtin flag. -fno-builtin doesn't mean that the compiler can > call functions with names in the user namespace not reserved by the C > standard. > I would have loved to do that, but people had problems with it. -bw From isanbard at gmail.com Tue Sep 30 16:52:55 2008 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 30 Sep 2008 14:52:55 -0700 Subject: [llvm-commits] [llvm] r56885 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86Subtarget.cpp lib/Target/X86/X86Su Message-ID: <16e5fdf90809301452u3b46615emac25715897a36bb9@mail.gmail.com> On Tue, Sep 30, 2008 at 2:49 PM, Devang Patel wrote: > > On Sep 30, 2008, at 2:22 PM, Bill Wendling wrote: > >> Author: void >> Date: Tue Sep 30 16:22:07 2008 >> New Revision: 56885 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=56885&view=rev >> Log: >> Add the new `-no-builtin' flag. This flag is meant to mimic the GCC >> `-fno-builtin' flag. Currently, it's used to replace "memset" with >> "_bzero" >> instead of "__bzero" on Darwin10+. This arguably violates the >> meaning of this >> flag, but is currently sufficient. The meaning of this flag should >> become more >> specific over time. > > Is it possible encode this in IR as an attribute ? > > Right now this info. is lost during > 1) llvm-gcc -c --emit-llvm -fno-builtin foo.c -o foo.bc && llc foo.bc - > o foo.s > 2) and LTO. > Sure! How do you do that? :-) -bw From gohman at apple.com Tue Sep 30 16:59:12 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 30 Sep 2008 14:59:12 -0700 Subject: [llvm-commits] Struct-handling patches In-Reply-To: <20080928190454.GG15228@katherina.student.utwente.nl> References: <20080928190454.GG15228@katherina.student.utwente.nl> Message-ID: On Sep 28, 2008, at 12:04 PM, Matthijs Kooijman wrote: > Hi all, > > please find three patches attached. These patches fix some behaviour > related > to struct transformations. > > I was observing issues with struct alloca's not always being > properly split up > by scalarrepl. Some other passes sometimes make changes that confuse > scalarrepl, preventing it from doing its work. > > I don't have a clear-cut testcase for this, since the issues occured > when > running our own ordering of LLVM passes. Using -std-compile-opts or > llvm-gcc > mostly managed to mask thes bugs by doing transformations in a > particular > order. I have include small testcases with each patch, though. > > The first patch, preserve-struct.diff changes instcombine not to > replace a > struct alloca by some other type in some cases. This is currently > done if the > alloca is bitcasted to any type with a higher alignment (such as i32 > and i64), > which greatly confuses scalarrepl. This patch is not without > problems, since > it makes the llvm-gcc bug in PR2823 happen a bit more often. For > more details > about this patch, see the thread at > http://lists.cs.uiuc.edu/pipermail/llvmdev/2008-September/016870.html I think this is fine. It's a tricky area, and I expect it'll be something we'll re-evaluate over time, but I think it's reasonable for now. > > > The second patch, vector-gep.diff, allows scalarrepl to treat all GEP > instructions with all zero indices as bitcasts. Sometimes, all-zero > bitcasts > are emitted where bitcasts would be conceptually more appropriate. > Currently, > scalarrepl handles all-zero geps only when there are no vector types > involved. > This patch removes this limitation. + if (isa(*I)) { + // Otherwise, we must have an index into an array type. Verify that this is + // an in-range constant integer. Specifically, consider A[0] [i]. We + // cannot know that the user isn't doing invalid things like allowing i to + // index an out-of-range subscript that accesses A[1]. Because of this, we + // have to reject SROA of any accesses into structs where any of the + // components are variables. + if (IdxVal->getZExtValue() >= cast(*I)- >getNumElements()) + return MarkUnsafe(Info); + } Instead of isa + cast you can use if (const ArrayType *ATy = dyn_cast(*I)) { Also, the word "Otherwise" in the comment no longer makes sense, given the new structure of the code. Otherwise :-), this patch looks good. > > > The last patch, firstclass.diff, concerns instcombine. Instcombine > can replace > memcpy calls for small values with a load and a store. This defaults > to using > an integer type of appropriate size to load and store, unless a > single value > type is copied (ie, a double, or a struct containing just a double, > etc.). The > patch changes this to any first class type, since all first class > types can be > loaded and stored directly. In particular, a memcpy of a small > struct is now > replaced by a load and a store of the right struct type, instead of > casting it > to integer first (confusing scalarrepl more). I agree with Duncan that this doesn't sound safe in the case of structs with holes. > > This last patch is not completely useful by itself yet, since > scalarrepl > doesn't know how to handle struct loads and stores yet :-) I'll have > a look at > that tomorrow. Would it make sense to teach scalarrepl how to handle llvm.memcpy? The code above in instcombine only looks at objects that are 8 bytes or smaller, which is somewhat arbitrary when it comes to structs. We don't want to translate large struct copies to single loads and stores, but it seems there will be a lot of interesting cases with structs slightly larger than 8 bytes. Actually, it may some day make sense to use single loads and stores instead of memcpy for all structs, but before we can do that we'd need at least need to teach codegen how to effectively turn them back into memcpy in most cases. Offhand I don't know what other changes would be needed to avoid major pessimizations. Dan From nunoplopes at sapo.pt Tue Sep 30 17:04:30 2008 From: nunoplopes at sapo.pt (Nuno Lopes) Date: Tue, 30 Sep 2008 22:04:30 -0000 Subject: [llvm-commits] [llvm] r56887 - /llvm/trunk/lib/Transforms/IPO/Internalize.cpp Message-ID: <200809302204.m8UM4V8b007868@zion.cs.uiuc.edu> Author: nlopes Date: Tue Sep 30 17:04:30 2008 New Revision: 56887 URL: http://llvm.org/viewvc/llvm-project?rev=56887&view=rev Log: add preserversCFG() + preservers(CallGraph) Modified: llvm/trunk/lib/Transforms/IPO/Internalize.cpp Modified: llvm/trunk/lib/Transforms/IPO/Internalize.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/Internalize.cpp?rev=56887&r1=56886&r2=56887&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/Internalize.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/Internalize.cpp Tue Sep 30 17:04:30 2008 @@ -14,6 +14,7 @@ //===----------------------------------------------------------------------===// #define DEBUG_TYPE "internalize" +#include "llvm/Analysis/CallGraph.h" #include "llvm/Transforms/IPO.h" #include "llvm/Pass.h" #include "llvm/Module.h" @@ -52,6 +53,11 @@ explicit InternalizePass(const std::vector & exportList); void LoadFile(const char *Filename); virtual bool runOnModule(Module &M); + + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.setPreservesCFG(); + AU.addPreserved(); + } }; } // end anonymous namespace From isanbard at gmail.com Tue Sep 30 17:05:33 2008 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 30 Sep 2008 22:05:33 -0000 Subject: [llvm-commits] [llvm] r56888 - in /llvm/trunk: lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86Subtarget.cpp lib/Target/X86/X86Subtarget.h test/CodeGen/X86/darwin-bzero.ll Message-ID: <200809302205.m8UM5YLH007909@zion.cs.uiuc.edu> Author: void Date: Tue Sep 30 17:05:33 2008 New Revision: 56888 URL: http://llvm.org/viewvc/llvm-project?rev=56888&view=rev Log: Just don't transform this memset into "bzero" if no-builtin is specified. Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/Target/X86/X86Subtarget.cpp llvm/trunk/lib/Target/X86/X86Subtarget.h llvm/trunk/test/CodeGen/X86/darwin-bzero.ll Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=56888&r1=56887&r2=56888&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Tue Sep 30 17:05:33 2008 @@ -5148,22 +5148,24 @@ // Check to see if there is a specialized entry-point for memory zeroing. ConstantSDNode *V = dyn_cast(Src); - if (const char *bzeroEntry = V && - V->isNullValue() ? Subtarget->getBZeroEntry(NoBuiltin) : 0) { - MVT IntPtr = getPointerTy(); - const Type *IntPtrTy = TD->getIntPtrType(); - TargetLowering::ArgListTy Args; - TargetLowering::ArgListEntry Entry; - Entry.Node = Dst; - Entry.Ty = IntPtrTy; - Args.push_back(Entry); - Entry.Node = Size; - Args.push_back(Entry); - std::pair CallResult = - LowerCallTo(Chain, Type::VoidTy, false, false, false, false, - CallingConv::C, false, - DAG.getExternalSymbol(bzeroEntry, IntPtr), Args, DAG); - return CallResult.second; + if (!NoBuiltin) { + if (const char *bzeroEntry = V && + V->isNullValue() ? Subtarget->getBZeroEntry() : 0) { + MVT IntPtr = getPointerTy(); + const Type *IntPtrTy = TD->getIntPtrType(); + TargetLowering::ArgListTy Args; + TargetLowering::ArgListEntry Entry; + Entry.Node = Dst; + Entry.Ty = IntPtrTy; + Args.push_back(Entry); + Entry.Node = Size; + Args.push_back(Entry); + std::pair CallResult = + LowerCallTo(Chain, Type::VoidTy, false, false, false, false, + CallingConv::C, false, + DAG.getExternalSymbol(bzeroEntry, IntPtr), Args, DAG); + return CallResult.second; + } } // Otherwise have the target-independent code call memset. Modified: llvm/trunk/lib/Target/X86/X86Subtarget.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.cpp?rev=56888&r1=56887&r2=56888&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86Subtarget.cpp (original) +++ llvm/trunk/lib/Target/X86/X86Subtarget.cpp Tue Sep 30 17:05:33 2008 @@ -63,10 +63,10 @@ /// interface like the non-standard bzero function, if such a function exists on /// the current subtarget and it is considered prefereable over memset with zero /// passed as the second argument. Otherwise it returns null. -const char *X86Subtarget::getBZeroEntry(bool NoBuiltin) const { +const char *X86Subtarget::getBZeroEntry() const { // Darwin 10 has a __bzero entry point for this purpose. if (getDarwinVers() >= 10) - return NoBuiltin ? "_bzero" : "__bzero"; + return "__bzero"; return 0; } Modified: llvm/trunk/lib/Target/X86/X86Subtarget.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.h?rev=56888&r1=56887&r2=56888&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86Subtarget.h (original) +++ llvm/trunk/lib/Target/X86/X86Subtarget.h Tue Sep 30 17:05:33 2008 @@ -184,7 +184,7 @@ /// the current subtarget and it is considered prefereable over /// memset with zero passed as the second argument. Otherwise it /// returns null. - const char *getBZeroEntry(bool NoBuiltin) const; + const char *getBZeroEntry() const; }; namespace X86 { Modified: llvm/trunk/test/CodeGen/X86/darwin-bzero.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/darwin-bzero.ll?rev=56888&r1=56887&r2=56888&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/darwin-bzero.ll (original) +++ llvm/trunk/test/CodeGen/X86/darwin-bzero.ll Tue Sep 30 17:05:33 2008 @@ -1,5 +1,5 @@ ; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin10 | grep __bzero -; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin10 -no-builtin | grep _bzero +; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin10 -no-builtin | grep _memset declare void @llvm.memset.i32(i8*, i8, i32, i32) From dpatel at apple.com Tue Sep 30 17:10:10 2008 From: dpatel at apple.com (Devang Patel) Date: Tue, 30 Sep 2008 15:10:10 -0700 Subject: [llvm-commits] [llvm] r56885 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86Subtarget.cpp lib/Target/X86/X86Su In-Reply-To: <16e5fdf90809301452u3b46615emac25715897a36bb9@mail.gmail.com> References: <16e5fdf90809301452u3b46615emac25715897a36bb9@mail.gmail.com> Message-ID: <55F15A17-22EB-4E7A-8FC6-6795CBBF303F@apple.com> On Sep 30, 2008, at 2:52 PM, Bill Wendling wrote: > On Tue, Sep 30, 2008 at 2:49 PM, Devang Patel > wrote: >> >> On Sep 30, 2008, at 2:22 PM, Bill Wendling wrote: >> >>> Author: void >>> Date: Tue Sep 30 16:22:07 2008 >>> New Revision: 56885 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=56885&view=rev >>> Log: >>> Add the new `-no-builtin' flag. This flag is meant to mimic the GCC >>> `-fno-builtin' flag. Currently, it's used to replace "memset" with >>> "_bzero" >>> instead of "__bzero" on Darwin10+. This arguably violates the >>> meaning of this >>> flag, but is currently sufficient. The meaning of this flag should >>> become more >>> specific over time. >> >> Is it possible encode this in IR as an attribute ? >> >> Right now this info. is lost during >> 1) llvm-gcc -c --emit-llvm -fno-builtin foo.c -o foo.bc && llc >> foo.bc - >> o foo.s >> 2) and LTO. >> > Sure! How do you do that? :-) Here is completely untested patch to begin with... Index: include/llvm/Attributes.h =================================================================== --- include/llvm/Attributes.h (revision 56886) +++ include/llvm/Attributes.h (working copy) @@ -47,6 +47,7 @@ const Attributes NoInline = 1<<11; // inline=never const Attributes AlwaysInline = 1<<12; // inline=always const Attributes OptimizeForSize = 1<<13; // opt_size +const Attributes NoBuiltin = 1<<14; // Do not use builtins const Attributes Alignment = 0xffff<<16; ///< Alignment of parameter (16 bits) // 0 = unknown, else in clear (not log) Index: lib/VMCore/Attributes.cpp =================================================================== --- lib/VMCore/Attributes.cpp (revision 56886) +++ lib/VMCore/Attributes.cpp (working copy) @@ -53,6 +53,8 @@ Result += "noinline "; if (Attrs & Attribute::AlwaysInline) Result += "alwaysinline "; + if (Attrs & Attribute::NoBuiltIn) + Result += "nobuiltin "; if (Attrs & Attribute::Alignment) { Result += "align "; Result += utostr((Attrs & Attribute::Alignment) >> 16); Index: lib/AsmParser/llvmAsmParser.y =================================================================== --- lib/AsmParser/llvmAsmParser.y (revision 56886) +++ lib/AsmParser/llvmAsmParser.y (working copy) @@ -1121,7 +1121,7 @@ // Function Attributes %token SIGNEXT ZEROEXT NORETURN INREG SRET NOUNWIND NOALIAS BYVAL NEST -%token READNONE READONLY GC OPTSIZE NOINLINE ALWAYSINLINE +%token READNONE READONLY GC OPTSIZE NOINLINE ALWAYSINLINE NOBUILTIN // Visibility Styles %token DEFAULT HIDDEN PROTECTED @@ -1293,8 +1293,9 @@ | READNONE { $$ = Attribute::ReadNone; } | READONLY { $$ = Attribute::ReadOnly; } | NOINLINE { $$ = Attribute::NoInline } - | ALWAYSINLINE { $$ = Attribute::AlwaysInline } - | OPTSIZE { $$ = Attribute::OptimizeForSize } + | ALWAYSINLINE { $$ = Attribute::AlwaysInline; } + | OPTSIZE { $$ = Attribute::OptimizeForSize; } + | NOBUILTIN { $$ = Attribute::NoBuiltin; } ; OptFuncAttrs : /* empty */ { $$ = Attribute::None; } Index: lib/AsmParser/LLLexer.cpp =================================================================== --- lib/AsmParser/LLLexer.cpp (revision 56886) +++ lib/AsmParser/LLLexer.cpp (working copy) @@ -499,6 +499,7 @@ KEYWORD("noinline", NOINLINE); KEYWORD("alwaysinline", ALWAYSINLINE); KEYWORD("optsize", OPTSIZE); + KEYWORD("nobuiltin", NOBUILTIN); KEYWORD("type", TYPE); KEYWORD("opaque", OPAQUE); From evan.cheng at apple.com Tue Sep 30 17:17:32 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 30 Sep 2008 15:17:32 -0700 Subject: [llvm-commits] [llvm] r56885 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86Subtarget.cpp lib/Target/X86/X86Su In-Reply-To: <16e5fdf90809301452r1039ca1ch27b4145ce79c5f7b@mail.gmail.com> References: <16e5fdf90809301452r1039ca1ch27b4145ce79c5f7b@mail.gmail.com> Message-ID: On Sep 30, 2008, at 2:52 PM, Bill Wendling wrote: > On Tue, Sep 30, 2008 at 2:47 PM, Dan Gohman wrote: >> >> On Sep 30, 2008, at 2:22 PM, Bill Wendling wrote: >> >>> Author: void >>> Date: Tue Sep 30 16:22:07 2008 >>> New Revision: 56885 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=56885&view=rev >>> Log: >>> Add the new `-no-builtin' flag. This flag is meant to mimic the GCC >>> `-fno-builtin' flag. Currently, it's used to replace "memset" with >>> "_bzero" >>> instead of "__bzero" on Darwin10+. This arguably violates the >>> meaning of this >>> flag, but is currently sufficient. The meaning of this flag should >>> become more >>> specific over time. >> >> First, -fno-builtin is only intended to apply to user calls. It is >> not >> intended to apply to libcalls that the compiler generates. For >> example, >> specifying -fno-builtin-memcpy does not tell the compiler not to >> generate calls to memcpy. >> >> Second, it looks like there is confusion about the leading >> underscores. >> The previous code used "__bzero" on Darwin 10, which is actually >> printed as "___bzero" because of Darwin ABI rules. By introducing new >> code that uses "_bzero", it will be printed as "__bzero" on Darwin, >> which doesn't seem to be what was intended here. >> > That's what was intended. > >> And furthermore, if "bzero" was intended, meaning printing in the >> output as "_bzero" on Darwin, that's an even more flagrant abuse of >> the -fno-builtin flag. -fno-builtin doesn't mean that the compiler >> can >> call functions with names in the user namespace not reserved by the C >> standard. >> > I would have loved to do that, but people had problems with it. I am confused by the meaning of -fno-builtin: -fno-builtin -fno-builtin-function Don't recognize built-in functions that do not begin with __builtin_ as prefix. Does this actually disable the optimization of memset to bzero? Evan > > > -bw > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From gohman at apple.com Tue Sep 30 17:19:18 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 30 Sep 2008 15:19:18 -0700 Subject: [llvm-commits] [llvm] r56885 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86Subtarget.cpp lib/Target/X86/X86Su In-Reply-To: <55F15A17-22EB-4E7A-8FC6-6795CBBF303F@apple.com> References: <16e5fdf90809301452u3b46615emac25715897a36bb9@mail.gmail.com> <55F15A17-22EB-4E7A-8FC6-6795CBBF303F@apple.com> Message-ID: On Sep 30, 2008, at 3:10 PM, Devang Patel wrote: > > On Sep 30, 2008, at 2:52 PM, Bill Wendling wrote: > >> On Tue, Sep 30, 2008 at 2:49 PM, Devang Patel >> wrote: >>> >>> On Sep 30, 2008, at 2:22 PM, Bill Wendling wrote: >>> >>>> Author: void >>>> Date: Tue Sep 30 16:22:07 2008 >>>> New Revision: 56885 >>>> >>>> URL: http://llvm.org/viewvc/llvm-project?rev=56885&view=rev >>>> Log: >>>> Add the new `-no-builtin' flag. This flag is meant to mimic the GCC >>>> `-fno-builtin' flag. Currently, it's used to replace "memset" with >>>> "_bzero" >>>> instead of "__bzero" on Darwin10+. This arguably violates the >>>> meaning of this >>>> flag, but is currently sufficient. The meaning of this flag should >>>> become more >>>> specific over time. >>> >>> Is it possible encode this in IR as an attribute ? >>> >>> Right now this info. is lost during >>> 1) llvm-gcc -c --emit-llvm -fno-builtin foo.c -o foo.bc && llc >>> foo.bc - >>> o foo.s >>> 2) and LTO. >>> >> Sure! How do you do that? :-) > > Here is completely untested patch to begin with... Before we charge ahead with this, can we take a moment and consider whether it's desireable? This is giving -fno-builtin a significantly different meaning from what it has in GCC. Thanks, Dan From isanbard at gmail.com Tue Sep 30 17:22:04 2008 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 30 Sep 2008 15:22:04 -0700 Subject: [llvm-commits] [llvm] r56885 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86Subtarget.cpp lib/Target/X86/X86Su In-Reply-To: References: <16e5fdf90809301452r1039ca1ch27b4145ce79c5f7b@mail.gmail.com> Message-ID: <16e5fdf90809301522n1042a1b0kd63775af58bd658c@mail.gmail.com> On Tue, Sep 30, 2008 at 3:17 PM, Evan Cheng wrote: > > On Sep 30, 2008, at 2:52 PM, Bill Wendling wrote: > >> On Tue, Sep 30, 2008 at 2:47 PM, Dan Gohman wrote: >>> >>> On Sep 30, 2008, at 2:22 PM, Bill Wendling wrote: >>> >>>> Author: void >>>> Date: Tue Sep 30 16:22:07 2008 >>>> New Revision: 56885 >>>> >>>> URL: http://llvm.org/viewvc/llvm-project?rev=56885&view=rev >>>> Log: >>>> Add the new `-no-builtin' flag. This flag is meant to mimic the GCC >>>> `-fno-builtin' flag. Currently, it's used to replace "memset" with >>>> "_bzero" >>>> instead of "__bzero" on Darwin10+. This arguably violates the >>>> meaning of this >>>> flag, but is currently sufficient. The meaning of this flag should >>>> become more >>>> specific over time. >>> >>> First, -fno-builtin is only intended to apply to user calls. It is >>> not >>> intended to apply to libcalls that the compiler generates. For >>> example, >>> specifying -fno-builtin-memcpy does not tell the compiler not to >>> generate calls to memcpy. >>> >>> Second, it looks like there is confusion about the leading >>> underscores. >>> The previous code used "__bzero" on Darwin 10, which is actually >>> printed as "___bzero" because of Darwin ABI rules. By introducing new >>> code that uses "_bzero", it will be printed as "__bzero" on Darwin, >>> which doesn't seem to be what was intended here. >>> >> That's what was intended. >> >>> And furthermore, if "bzero" was intended, meaning printing in the >>> output as "_bzero" on Darwin, that's an even more flagrant abuse of >>> the -fno-builtin flag. -fno-builtin doesn't mean that the compiler >>> can >>> call functions with names in the user namespace not reserved by the C >>> standard. >>> >> I would have loved to do that, but people had problems with it. > > I am confused by the meaning of -fno-builtin: > -fno-builtin > -fno-builtin-function > Don't recognize built-in functions that do not begin with > __builtin_ as prefix. > > Does this actually disable the optimization of memset to bzero? > That's my reading of it, yes. -bw From isanbard at gmail.com Tue Sep 30 17:25:28 2008 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 30 Sep 2008 15:25:28 -0700 Subject: [llvm-commits] [llvm] r56885 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86Subtarget.cpp lib/Target/X86/X86Su In-Reply-To: References: <16e5fdf90809301452u3b46615emac25715897a36bb9@mail.gmail.com> <55F15A17-22EB-4E7A-8FC6-6795CBBF303F@apple.com> Message-ID: <16e5fdf90809301525r3c12375bod900f0ea82e3c074@mail.gmail.com> On Tue, Sep 30, 2008 at 3:19 PM, Dan Gohman wrote: > > On Sep 30, 2008, at 3:10 PM, Devang Patel wrote: > >> >> On Sep 30, 2008, at 2:52 PM, Bill Wendling wrote: >> >>> On Tue, Sep 30, 2008 at 2:49 PM, Devang Patel >>> wrote: >>>> >>>> On Sep 30, 2008, at 2:22 PM, Bill Wendling wrote: >>>> >>>>> Author: void >>>>> Date: Tue Sep 30 16:22:07 2008 >>>>> New Revision: 56885 >>>>> >>>>> URL: http://llvm.org/viewvc/llvm-project?rev=56885&view=rev >>>>> Log: >>>>> Add the new `-no-builtin' flag. This flag is meant to mimic the GCC >>>>> `-fno-builtin' flag. Currently, it's used to replace "memset" with >>>>> "_bzero" >>>>> instead of "__bzero" on Darwin10+. This arguably violates the >>>>> meaning of this >>>>> flag, but is currently sufficient. The meaning of this flag should >>>>> become more >>>>> specific over time. >>>> >>>> Is it possible encode this in IR as an attribute ? >>>> >>>> Right now this info. is lost during >>>> 1) llvm-gcc -c --emit-llvm -fno-builtin foo.c -o foo.bc && llc >>>> foo.bc - >>>> o foo.s >>>> 2) and LTO. >>>> >>> Sure! How do you do that? :-) >> >> Here is completely untested patch to begin with... > > > Before we charge ahead with this, can we take a moment and consider > whether it's desireable? This is giving -fno-builtin a significantly > different meaning from what it has in GCC. > I changed it so that it won't convert a memset to a bzero. This should be in line with how GCC treats this flag: Don't recognize built-in functions that do not begin with __builtin_ as prefix. -bw From isanbard at gmail.com Tue Sep 30 17:28:24 2008 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 30 Sep 2008 15:28:24 -0700 Subject: [llvm-commits] [llvm] r56885 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86Subtarget.cpp lib/Target/X86/X86Su In-Reply-To: <16e5fdf90809301522n1042a1b0kd63775af58bd658c@mail.gmail.com> References: <16e5fdf90809301452r1039ca1ch27b4145ce79c5f7b@mail.gmail.com> <16e5fdf90809301522n1042a1b0kd63775af58bd658c@mail.gmail.com> Message-ID: <16e5fdf90809301528w49c08b9bg9cb922cde5ea1c9@mail.gmail.com> On Tue, Sep 30, 2008 at 3:22 PM, Bill Wendling wrote: > On Tue, Sep 30, 2008 at 3:17 PM, Evan Cheng wrote: >> >> On Sep 30, 2008, at 2:52 PM, Bill Wendling wrote: >> >>> On Tue, Sep 30, 2008 at 2:47 PM, Dan Gohman wrote: >>>> >>>> On Sep 30, 2008, at 2:22 PM, Bill Wendling wrote: >>>> >>>>> Author: void >>>>> Date: Tue Sep 30 16:22:07 2008 >>>>> New Revision: 56885 >>>>> >>>>> URL: http://llvm.org/viewvc/llvm-project?rev=56885&view=rev >>>>> Log: >>>>> Add the new `-no-builtin' flag. This flag is meant to mimic the GCC >>>>> `-fno-builtin' flag. Currently, it's used to replace "memset" with >>>>> "_bzero" >>>>> instead of "__bzero" on Darwin10+. This arguably violates the >>>>> meaning of this >>>>> flag, but is currently sufficient. The meaning of this flag should >>>>> become more >>>>> specific over time. >>>> >>>> First, -fno-builtin is only intended to apply to user calls. It is >>>> not >>>> intended to apply to libcalls that the compiler generates. For >>>> example, >>>> specifying -fno-builtin-memcpy does not tell the compiler not to >>>> generate calls to memcpy. >>>> >>>> Second, it looks like there is confusion about the leading >>>> underscores. >>>> The previous code used "__bzero" on Darwin 10, which is actually >>>> printed as "___bzero" because of Darwin ABI rules. By introducing new >>>> code that uses "_bzero", it will be printed as "__bzero" on Darwin, >>>> which doesn't seem to be what was intended here. >>>> >>> That's what was intended. >>> >>>> And furthermore, if "bzero" was intended, meaning printing in the >>>> output as "_bzero" on Darwin, that's an even more flagrant abuse of >>>> the -fno-builtin flag. -fno-builtin doesn't mean that the compiler >>>> can >>>> call functions with names in the user namespace not reserved by the C >>>> standard. >>>> >>> I would have loved to do that, but people had problems with it. >> >> I am confused by the meaning of -fno-builtin: >> -fno-builtin >> -fno-builtin-function >> Don't recognize built-in functions that do not begin with >> __builtin_ as prefix. >> >> Does this actually disable the optimization of memset to bzero? >> > That's my reading of it, yes. >In particular: -fno-builtin -fno-builtin-function ... GCC normally generates special code to handle certain built-in functions more efficiently; for instance, calls to alloca may become single instructions that adjust the stack directly, and calls to memcpy may become inline copy loops. The resulting code is often both smaller and faster, but since the function calls no longer appear as such, you cannot set a breakpoint on those calls, nor can you change the behavior of the functions by linking with a different library. -bw -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080930/69bb194c/attachment.html From dalej at apple.com Tue Sep 30 17:28:31 2008 From: dalej at apple.com (Dale Johannesen) Date: Tue, 30 Sep 2008 15:28:31 -0700 Subject: [llvm-commits] [llvm] r56885 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86Subtarget.cpp lib/Target/X86/X86Su In-Reply-To: References: <16e5fdf90809301452r1039ca1ch27b4145ce79c5f7b@mail.gmail.com> Message-ID: On Sep 30, 2008, at 3:17 PMPDT, Evan Cheng wrote: > > I am confused by the meaning of -fno-builtin: > -fno-builtin > -fno-builtin-function > Don't recognize built-in functions that do not begin with > __builtin_ as prefix. > > Does this actually disable the optimization of memset to bzero? The wording is not ideal, but it is supposed to disable assuming that functions named in the standard have the special semantics defined in the standard, yes. (Several groups in this company use it and expect it to do that.) I'm not sure about Dan's point, that this is not supposed to apply to compiler-generated calls. This is a reasonable reading, but not explicit. More to the point, I don't think it's what users would usually want. If they use -fno-builtin-memset that is because the compiler's usual expansion of memset doesn't work for them for some reason. I don't see why user calls to memset would be different from compiler-generated ones in this regard. From dpatel at apple.com Tue Sep 30 17:30:53 2008 From: dpatel at apple.com (Devang Patel) Date: Tue, 30 Sep 2008 15:30:53 -0700 Subject: [llvm-commits] [llvm] r56885 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86Subtarget.cpp lib/Target/X86/X86Su In-Reply-To: References: <16e5fdf90809301452u3b46615emac25715897a36bb9@mail.gmail.com> <55F15A17-22EB-4E7A-8FC6-6795CBBF303F@apple.com> Message-ID: On Sep 30, 2008, at 3:19 PM, Dan Gohman wrote: > > On Sep 30, 2008, at 3:10 PM, Devang Patel wrote: > >> >> On Sep 30, 2008, at 2:52 PM, Bill Wendling wrote: >> >>> On Tue, Sep 30, 2008 at 2:49 PM, Devang Patel >>> wrote: >>>> >>>> On Sep 30, 2008, at 2:22 PM, Bill Wendling wrote: >>>> >>>>> Author: void >>>>> Date: Tue Sep 30 16:22:07 2008 >>>>> New Revision: 56885 >>>>> >>>>> URL: http://llvm.org/viewvc/llvm-project?rev=56885&view=rev >>>>> Log: >>>>> Add the new `-no-builtin' flag. This flag is meant to mimic the >>>>> GCC >>>>> `-fno-builtin' flag. Currently, it's used to replace "memset" with >>>>> "_bzero" >>>>> instead of "__bzero" on Darwin10+. This arguably violates the >>>>> meaning of this >>>>> flag, but is currently sufficient. The meaning of this flag should >>>>> become more >>>>> specific over time. >>>> >>>> Is it possible encode this in IR as an attribute ? >>>> >>>> Right now this info. is lost during >>>> 1) llvm-gcc -c --emit-llvm -fno-builtin foo.c -o foo.bc && llc >>>> foo.bc - >>>> o foo.s >>>> 2) and LTO. >>>> >>> Sure! How do you do that? :-) >> >> Here is completely untested patch to begin with... > > > Before we charge ahead with this, can we take a moment and consider > whether it's desireable? ok :) - Devang > This is giving -fno-builtin a significantly > different meaning from what it has in GCC. > > Thanks, > > Dan > > _______________________________________________ > 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 Tue Sep 30 17:35:34 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 30 Sep 2008 15:35:34 -0700 Subject: [llvm-commits] [llvm] r56885 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86Subtarget.cpp lib/Target/X86/X86Su In-Reply-To: <16e5fdf90809301525r3c12375bod900f0ea82e3c074@mail.gmail.com> References: <16e5fdf90809301452u3b46615emac25715897a36bb9@mail.gmail.com> <55F15A17-22EB-4E7A-8FC6-6795CBBF303F@apple.com> <16e5fdf90809301525r3c12375bod900f0ea82e3c074@mail.gmail.com> Message-ID: So your take is -fno-builtin stops gcc from recognizing memcpy, memset as special functions and optimizing them into something else (e.g. bzero). After re-reading the man page entry a few times, I kinda see it. I wish I can find the code in gcc that does this to have higher confidence. However, this means we should 1) rename -no-builtin to something like - no-builtin-optimization, 2) it should disable all of the optimizations for memcpy and memset (and probably) others. Evan On Sep 30, 2008, at 3:25 PM, Bill Wendling wrote: >> >> Before we charge ahead with this, can we take a moment and consider >> whether it's desireable? This is giving -fno-builtin a significantly >> different meaning from what it has in GCC. >> > I changed it so that it won't convert a memset to a bzero. This should > be in line with how GCC treats this flag: > > Don't recognize built-in functions that do not begin with > __builtin_ as prefix. > > -bw > _______________________________________________ > 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 Sep 30 17:36:23 2008 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 30 Sep 2008 15:36:23 -0700 Subject: [llvm-commits] [llvm] r56885 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86Subtarget.cpp lib/Target/X86/X86Su In-Reply-To: References: <16e5fdf90809301452r1039ca1ch27b4145ce79c5f7b@mail.gmail.com> Message-ID: <16e5fdf90809301536x1a707f3fm3a1e7b5e1f3ecbd0@mail.gmail.com> On Tue, Sep 30, 2008 at 3:28 PM, Dale Johannesen wrote: > > On Sep 30, 2008, at 3:17 PMPDT, Evan Cheng wrote: > > > > I am confused by the meaning of -fno-builtin: > > -fno-builtin > > -fno-builtin-function > > Don't recognize built-in functions that do not begin with > > __builtin_ as prefix. > > > > Does this actually disable the optimization of memset to bzero? > > The wording is not ideal, but it is supposed to disable assuming that > functions named in the standard have the special semantics defined in > the standard, yes. (Several groups in this company use it and expect > it to do that.) > > I'm not sure about Dan's point, that this is not supposed to apply to > compiler-generated calls. This is a reasonable reading, but not > explicit. More to the point, I don't think it's what users would > usually want. If they use -fno-builtin-memset that is because the > compiler's usual expansion of memset doesn't work for them for some > reason. I don't see why user calls to memset would be different from > compiler-generated ones in this regard. > To make it even more confusing, the user could be using their own version of memset which does something entirely different than what normal memset does. It would be unwise for the compiler to assume that these functions behave as normal under this flag. -bw From isanbard at gmail.com Tue Sep 30 17:41:15 2008 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 30 Sep 2008 15:41:15 -0700 Subject: [llvm-commits] [llvm] r56885 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86Subtarget.cpp lib/Target/X86/X86Su In-Reply-To: References: <16e5fdf90809301452u3b46615emac25715897a36bb9@mail.gmail.com> <55F15A17-22EB-4E7A-8FC6-6795CBBF303F@apple.com> <16e5fdf90809301525r3c12375bod900f0ea82e3c074@mail.gmail.com> Message-ID: <16e5fdf90809301541y36836125q7e22d90a3241bdf@mail.gmail.com> On Tue, Sep 30, 2008 at 3:35 PM, Evan Cheng wrote: > So your take is -fno-builtin stops gcc from recognizing memcpy, memset > as special functions and optimizing them into something else (e.g. > bzero). After re-reading the man page entry a few times, I kinda see > it. I wish I can find the code in gcc that does this to have higher > confidence. > As Dale mentioned, the GCC text is not ideal. :-) I couldn't find anything in the GCC compiler that transformed a memset into a bzero. But I could have simply missed something. I'm less sure about memcpy and memset (and a few specific others). In freestanding mode (which, among other things, implies -fno-builtin), GCC still reserves these functions. But bzero should not be assumed to exist here. > However, this means we should 1) rename -no-builtin to something like - > no-builtin-optimization, 2) it should disable all of the optimizations > for memcpy and memset (and probably) others. > I'm not so keen on renaming the option. It could cause confusion. Actually, making it a function note (like Devang suggests) should alleviate this. I agree with (2). As I mentioned in my check-in message, this should be done in steps to make sure that we get it correct. -bw From isanbard at gmail.com Tue Sep 30 17:51:10 2008 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 30 Sep 2008 15:51:10 -0700 Subject: [llvm-commits] [llvm] r56885 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86Subtarget.cpp lib/Target/X86/X86Su In-Reply-To: References: <16e5fdf90809301452u3b46615emac25715897a36bb9@mail.gmail.com> <55F15A17-22EB-4E7A-8FC6-6795CBBF303F@apple.com> Message-ID: <16e5fdf90809301551r7fcb7a24j7541c25adce04b89@mail.gmail.com> On Tue, Sep 30, 2008 at 3:19 PM, Dan Gohman wrote: > > Before we charge ahead with this, can we take a moment and consider > whether it's desireable? This is giving -fno-builtin a significantly > different meaning from what it has in GCC. > To address the idea of compiler-generated calls, how about this scheme: - If the user calls `memset', the F.E. generates a call to `@memset' when -no-builtin is set, and - If the compiler calls `memset', it would generate a call to `@llvm.memset' ? Then when transforming memset, we can tell the difference (under the NoBuiltin flag) between a compiler-generated and user-generated memset call. (This would apply analogously to other functions.) We would have to be careful about transforming `@llvm.foo' into `@foo' though, as `foo' might actually change if the user supplies their own version of `foo'. -bw From resistor at mac.com Tue Sep 30 17:51:57 2008 From: resistor at mac.com (Owen Anderson) Date: Tue, 30 Sep 2008 22:51:57 -0000 Subject: [llvm-commits] [llvm] r56889 - /llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Message-ID: <200809302251.m8UMpvUp009442@zion.cs.uiuc.edu> Author: resistor Date: Tue Sep 30 17:51:54 2008 New Revision: 56889 URL: http://llvm.org/viewvc/llvm-project?rev=56889&view=rev Log: Fix a simple error in renumbering kill markaers, that took an inordinant amount of time to track down. Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=56889&r1=56888&r2=56889&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Tue Sep 30 17:51:54 2008 @@ -213,7 +213,7 @@ unsigned index = (vni->kills[i]-1) / InstrSlots::NUM; unsigned offset = vni->kills[i] % InstrSlots::NUM; - if (offset == InstrSlots::STORE) { + if (offset == InstrSlots::LOAD) { std::vector::const_iterator I = std::lower_bound(OldI2MBB.begin(), OldI2MBB.end(), vni->kills[i]); --I; From evan.cheng at apple.com Tue Sep 30 17:55:33 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 30 Sep 2008 15:55:33 -0700 Subject: [llvm-commits] [llvm] r56885 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86Subtarget.cpp lib/Target/X86/X86Su In-Reply-To: <16e5fdf90809301541y36836125q7e22d90a3241bdf@mail.gmail.com> References: <16e5fdf90809301452u3b46615emac25715897a36bb9@mail.gmail.com> <55F15A17-22EB-4E7A-8FC6-6795CBBF303F@apple.com> <16e5fdf90809301525r3c12375bod900f0ea82e3c074@mail.gmail.com> <16e5fdf90809301541y36836125q7e22d90a3241bdf@mail.gmail.com> Message-ID: <1D4BC47E-C9C5-4282-AC62-FBF9D0B15DF3@apple.com> On Sep 30, 2008, at 3:41 PM, Bill Wendling wrote: > On Tue, Sep 30, 2008 at 3:35 PM, Evan Cheng > wrote: >> So your take is -fno-builtin stops gcc from recognizing memcpy, >> memset >> as special functions and optimizing them into something else (e.g. >> bzero). After re-reading the man page entry a few times, I kinda see >> it. I wish I can find the code in gcc that does this to have higher >> confidence. >> > As Dale mentioned, the GCC text is not ideal. :-) I couldn't find > anything in the GCC compiler that transformed a memset into a bzero. > But I could have simply missed something. > > I'm less sure about memcpy and memset (and a few specific others). In > freestanding mode (which, among other things, implies -fno-builtin), > GCC still reserves these functions. But bzero should not be assumed to > exist here. > >> However, this means we should 1) rename -no-builtin to something >> like - >> no-builtin-optimization, 2) it should disable all of the >> optimizations >> for memcpy and memset (and probably) others. >> > I'm not so keen on renaming the option. It could cause confusion. > Actually, making it a function note (like Devang suggests) should > alleviate this. > > I agree with (2). As I mentioned in my check-in message, this should > be done in steps to make sure that we get it correct. Actually, I think it'd be better to do this the right way. The correct way to handle this option is to convert all memcpy / memset (and other) intrinsic calls to normal calls. Perhaps in SelectionDAGBuild.cpp? e.g. case Intrinsic::memcpy_i32: case Intrinsic::memcpy_i64: { SDValue Op1 = getValue(I.getOperand(1)); SDValue Op2 = getValue(I.getOperand(2)); SDValue Op3 = getValue(I.getOperand(3)); unsigned Align = cast(I.getOperand(4))- >getZExtValue(); DAG.setRoot(DAG.getMemcpy(getRoot(), Op1, Op2, Op3, Align, false, I.getOperand(1), 0, I.getOperand(2), 0)); return 0; } We can lower it to a call to memcpy with -fno-builtin. Evan > > > -bw > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From dalej at apple.com Tue Sep 30 18:03:05 2008 From: dalej at apple.com (Dale Johannesen) Date: Tue, 30 Sep 2008 16:03:05 -0700 Subject: [llvm-commits] [llvm] r56885 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86Subtarget.cpp lib/Target/X86/X86Su In-Reply-To: <16e5fdf90809301541y36836125q7e22d90a3241bdf@mail.gmail.com> References: <16e5fdf90809301452u3b46615emac25715897a36bb9@mail.gmail.com> <55F15A17-22EB-4E7A-8FC6-6795CBBF303F@apple.com> <16e5fdf90809301525r3c12375bod900f0ea82e3c074@mail.gmail.com> <16e5fdf90809301541y36836125q7e22d90a3241bdf@mail.gmail.com> Message-ID: On Sep 30, 2008, at 3:41 PMPDT, Bill Wendling wrote: > On Tue, Sep 30, 2008 at 3:35 PM, Evan Cheng > wrote: >> So your take is -fno-builtin stops gcc from recognizing memcpy, >> memset >> as special functions and optimizing them into something else (e.g. >> bzero). After re-reading the man page entry a few times, I kinda see >> it. I wish I can find the code in gcc that does this to have higher >> confidence. >> > As Dale mentioned, the GCC text is not ideal. :-) I couldn't find > anything in the GCC compiler that transformed a memset into a bzero. > But I could have simply missed something. I figured it out once a while back; it's convoluted. IIRC the target- independent code in builtins.c changes bzero to memset, then the target-dependent x86 code changes memset back to bzero. Something like that. I wrote it down in a radar the last time somebody thought it should be doing something different, but now of course I can't find the radar. > The correct > way to handle this option is to convert all memcpy / memset (and > other) intrinsic calls to normal calls. That's basically the way gcc distinguishes; it generates different nodes (early in the FE IIRC, although I haven't been able to find it) depending on whether memset (etc) is to be treated as a builtin or not. I think it's hidden away as a bit in one of those &*!& tables. From isanbard at gmail.com Tue Sep 30 18:08:25 2008 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 30 Sep 2008 16:08:25 -0700 Subject: [llvm-commits] [llvm] r56885 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86Subtarget.cpp lib/Target/X86/X86Su In-Reply-To: <1D4BC47E-C9C5-4282-AC62-FBF9D0B15DF3@apple.com> References: <16e5fdf90809301452u3b46615emac25715897a36bb9@mail.gmail.com> <55F15A17-22EB-4E7A-8FC6-6795CBBF303F@apple.com> <16e5fdf90809301525r3c12375bod900f0ea82e3c074@mail.gmail.com> <16e5fdf90809301541y36836125q7e22d90a3241bdf@mail.gmail.com> <1D4BC47E-C9C5-4282-AC62-FBF9D0B15DF3@apple.com> Message-ID: <16e5fdf90809301608y42352492lf7e80efb70238d2d@mail.gmail.com> On Tue, Sep 30, 2008 at 3:55 PM, Evan Cheng wrote: > > Actually, I think it'd be better to do this the right way. Bah! :-) > The correct > way to handle this option is to convert all memcpy / memset (and > other) intrinsic calls to normal calls. Perhaps in > SelectionDAGBuild.cpp? e.g. > > case Intrinsic::memcpy_i32: > case Intrinsic::memcpy_i64: { > SDValue Op1 = getValue(I.getOperand(1)); > SDValue Op2 = getValue(I.getOperand(2)); > SDValue Op3 = getValue(I.getOperand(3)); > unsigned Align = cast(I.getOperand(4))- > >getZExtValue(); > DAG.setRoot(DAG.getMemcpy(getRoot(), Op1, Op2, Op3, Align, false, > I.getOperand(1), 0, I.getOperand(2), 0)); > return 0; > } > > We can lower it to a call to memcpy with -fno-builtin. > That's basically what I suggested in another email. So I think it's a brilliant idea. ;-) -bw From evan.cheng at apple.com Tue Sep 30 18:13:58 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 30 Sep 2008 16:13:58 -0700 Subject: [llvm-commits] [llvm] r56885 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86Subtarget.cpp lib/Target/X86/X86Su In-Reply-To: <16e5fdf90809301608y42352492lf7e80efb70238d2d@mail.gmail.com> References: <16e5fdf90809301452u3b46615emac25715897a36bb9@mail.gmail.com> <55F15A17-22EB-4E7A-8FC6-6795CBBF303F@apple.com> <16e5fdf90809301525r3c12375bod900f0ea82e3c074@mail.gmail.com> <16e5fdf90809301541y36836125q7e22d90a3241bdf@mail.gmail.com> <1D4BC47E-C9C5-4282-AC62-FBF9D0B15DF3@apple.com> <16e5fdf90809301608y42352492lf7e80efb70238d2d@mail.gmail.com> Message-ID: Actually no. It's a terrible idea. :-) This logic should not be in codegen at all. Users can still right __builtin_memcpy and those can be optimized with -fno-builtin. So correct solution, take two. :-) FE should not generate calls to @llvm.memset.i32 etc. when -fno-builtin is specified. Instead, it should generate a simple call to memset. So the only changes required are in the FE, LLVM should not know anything about -fno-builtin at all. That is, unless simplifylibcall decides to turn memset into @llvm.memset*. Evan On Sep 30, 2008, at 4:08 PM, Bill Wendling wrote: > On Tue, Sep 30, 2008 at 3:55 PM, Evan Cheng > wrote: >> >> Actually, I think it'd be better to do this the right way. > > Bah! :-) > >> The correct >> way to handle this option is to convert all memcpy / memset (and >> other) intrinsic calls to normal calls. Perhaps in >> SelectionDAGBuild.cpp? e.g. >> >> case Intrinsic::memcpy_i32: >> case Intrinsic::memcpy_i64: { >> SDValue Op1 = getValue(I.getOperand(1)); >> SDValue Op2 = getValue(I.getOperand(2)); >> SDValue Op3 = getValue(I.getOperand(3)); >> unsigned Align = cast(I.getOperand(4))- >>> getZExtValue(); >> DAG.setRoot(DAG.getMemcpy(getRoot(), Op1, Op2, Op3, Align, false, >> I.getOperand(1), 0, I.getOperand(2), >> 0)); >> return 0; >> } >> >> We can lower it to a call to memcpy with -fno-builtin. >> > That's basically what I suggested in another email. So I think it's a > brilliant idea. ;-) > > -bw > _______________________________________________ > 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 Sep 30 18:21:15 2008 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 30 Sep 2008 16:21:15 -0700 Subject: [llvm-commits] [llvm] r56885 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86Subtarget.cpp lib/Target/X86/X86Su In-Reply-To: References: <16e5fdf90809301452u3b46615emac25715897a36bb9@mail.gmail.com> <55F15A17-22EB-4E7A-8FC6-6795CBBF303F@apple.com> <16e5fdf90809301525r3c12375bod900f0ea82e3c074@mail.gmail.com> <16e5fdf90809301541y36836125q7e22d90a3241bdf@mail.gmail.com> <1D4BC47E-C9C5-4282-AC62-FBF9D0B15DF3@apple.com> <16e5fdf90809301608y42352492lf7e80efb70238d2d@mail.gmail.com> Message-ID: <16e5fdf90809301621n200876cey8c581f49aebe9f3c@mail.gmail.com> On Tue, Sep 30, 2008 at 4:13 PM, Evan Cheng wrote: > Actually no. It's a terrible idea. :-) > Aw! My sycophantic message didn't work. :-) > This logic should not be in codegen at all. Users can still right > __builtin_memcpy and those can be optimized with -fno-builtin. > > So correct solution, take two. :-) FE should not generate calls to > @llvm.memset.i32 etc. when -fno-builtin is specified. Instead, it > should generate a simple call to memset. So the only changes required > are in the FE, LLVM should not know anything about -fno-builtin at > all. That is, unless simplifylibcall decides to turn memset into > @llvm.memset*. > Yes. This sounds much more sane. I'll check on the SimplifyLibCall dealy. -bw From dalej at apple.com Tue Sep 30 18:21:21 2008 From: dalej at apple.com (Dale Johannesen) Date: Tue, 30 Sep 2008 16:21:21 -0700 Subject: [llvm-commits] [llvm] r56885 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86Subtarget.cpp lib/Target/X86/X86Su In-Reply-To: References: <16e5fdf90809301452u3b46615emac25715897a36bb9@mail.gmail.com> <55F15A17-22EB-4E7A-8FC6-6795CBBF303F@apple.com> <16e5fdf90809301525r3c12375bod900f0ea82e3c074@mail.gmail.com> <16e5fdf90809301541y36836125q7e22d90a3241bdf@mail.gmail.com> <1D4BC47E-C9C5-4282-AC62-FBF9D0B15DF3@apple.com> <16e5fdf90809301608y42352492lf7e80efb70238d2d@mail.gmail.com> Message-ID: <813345E7-3020-4AF2-9C0E-56F0708C710B@apple.com> On Sep 30, 2008, at 4:13 PMPDT, Evan Cheng wrote: > Actually no. It's a terrible idea. :-) > > This logic should not be in codegen at all. Users can still right > __builtin_memcpy and those can be optimized with -fno-builtin. > > So correct solution, take two. :-) FE should not generate calls to > @llvm.memset.i32 etc. when -fno-builtin is specified. Instead, it > should generate a simple call to memset. So the only changes required > are in the FE, LLVM should not know anything about -fno-builtin at > all. Right. > That is, unless simplifylibcall decides to turn memset into > @llvm.memset*. This is why simplifylibcall shouldn't be keying off names. I don't think I got through before, maybe now.... > Evan > > On Sep 30, 2008, at 4:08 PM, Bill Wendling wrote: > >> On Tue, Sep 30, 2008 at 3:55 PM, Evan Cheng >> wrote: >>> >>> Actually, I think it'd be better to do this the right way. >> >> Bah! :-) >> >>> The correct >>> way to handle this option is to convert all memcpy / memset (and >>> other) intrinsic calls to normal calls. Perhaps in >>> SelectionDAGBuild.cpp? e.g. >>> >>> case Intrinsic::memcpy_i32: >>> case Intrinsic::memcpy_i64: { >>> SDValue Op1 = getValue(I.getOperand(1)); >>> SDValue Op2 = getValue(I.getOperand(2)); >>> SDValue Op3 = getValue(I.getOperand(3)); >>> unsigned Align = cast(I.getOperand(4))- >>>> getZExtValue(); >>> DAG.setRoot(DAG.getMemcpy(getRoot(), Op1, Op2, Op3, Align, false, >>> I.getOperand(1), 0, I.getOperand(2), >>> 0)); >>> return 0; >>> } >>> >>> We can lower it to a call to memcpy with -fno-builtin. >>> >> That's basically what I suggested in another email. So I think it's a >> brilliant idea. ;-) >> >> -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 evan.cheng at apple.com Tue Sep 30 18:25:15 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 30 Sep 2008 16:25:15 -0700 Subject: [llvm-commits] [llvm] r56885 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86Subtarget.cpp lib/Target/X86/X86Su In-Reply-To: <813345E7-3020-4AF2-9C0E-56F0708C710B@apple.com> References: <16e5fdf90809301452u3b46615emac25715897a36bb9@mail.gmail.com> <55F15A17-22EB-4E7A-8FC6-6795CBBF303F@apple.com> <16e5fdf90809301525r3c12375bod900f0ea82e3c074@mail.gmail.com> <16e5fdf90809301541y36836125q7e22d90a3241bdf@mail.gmail.com> <1D4BC47E-C9C5-4282-AC62-FBF9D0B15DF3@apple.com> <16e5fdf90809301608y42352492lf7e80efb70238d2d@mail.gmail.com> <813345E7-3020-4AF2-9C0E-56F0708C710B@apple.com> Message-ID: On Sep 30, 2008, at 4:21 PM, Dale Johannesen wrote: > > On Sep 30, 2008, at 4:13 PMPDT, Evan Cheng wrote: > >> Actually no. It's a terrible idea. :-) >> >> This logic should not be in codegen at all. Users can still right >> __builtin_memcpy and those can be optimized with -fno-builtin. >> >> So correct solution, take two. :-) FE should not generate calls to >> @llvm.memset.i32 etc. when -fno-builtin is specified. Instead, it >> should generate a simple call to memset. So the only changes required >> are in the FE, LLVM should not know anything about -fno-builtin at >> all. > > Right. > >> That is, unless simplifylibcall decides to turn memset into >> @llvm.memset*. > > This is why simplifylibcall shouldn't be keying off names. I don't > think I got through before, maybe now.... This is not a simplifylibcall issue though. Even at -O0, llvm-gcc will emit these intrinsics. See llvm-convert.cpp: void TreeToLLVM::EmitMemSet(Value *DestPtr, Value *SrcVal, Value *Size, unsigned Align) { const Type *SBP = PointerType::getUnqual(Type::Int8Ty); const Type *IntPtr = TD.getIntPtrType(); Value *Ops[4] = { BitCastToType(DestPtr, SBP), CastToSIntType(SrcVal, Type::Int8Ty), CastToSIntType(Size, IntPtr), ConstantInt::get(Type::Int32Ty, Align) }; Intrinsic::ID IID = (IntPtr == Type::Int32Ty) ? Intrinsic::memset_i32 : Intrinsic::memset_i64; Builder.CreateCall(Intrinsic::getDeclaration(TheModule, IID), Ops, Ops+4); } Evan > > >> Evan >> >> On Sep 30, 2008, at 4:08 PM, Bill Wendling wrote: >> >>> On Tue, Sep 30, 2008 at 3:55 PM, Evan Cheng >>> wrote: >>>> >>>> Actually, I think it'd be better to do this the right way. >>> >>> Bah! :-) >>> >>>> The correct >>>> way to handle this option is to convert all memcpy / memset (and >>>> other) intrinsic calls to normal calls. Perhaps in >>>> SelectionDAGBuild.cpp? e.g. >>>> >>>> case Intrinsic::memcpy_i32: >>>> case Intrinsic::memcpy_i64: { >>>> SDValue Op1 = getValue(I.getOperand(1)); >>>> SDValue Op2 = getValue(I.getOperand(2)); >>>> SDValue Op3 = getValue(I.getOperand(3)); >>>> unsigned Align = cast(I.getOperand(4))- >>>>> getZExtValue(); >>>> DAG.setRoot(DAG.getMemcpy(getRoot(), Op1, Op2, Op3, Align, false, >>>> I.getOperand(1), 0, I.getOperand(2), >>>> 0)); >>>> return 0; >>>> } >>>> >>>> We can lower it to a call to memcpy with -fno-builtin. >>>> >>> That's basically what I suggested in another email. So I think >>> it's a >>> brilliant idea. ;-) >>> >>> -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 > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From dalej at apple.com Tue Sep 30 18:29:51 2008 From: dalej at apple.com (Dale Johannesen) Date: Tue, 30 Sep 2008 16:29:51 -0700 Subject: [llvm-commits] [llvm] r56885 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86Subtarget.cpp lib/Target/X86/X86Su In-Reply-To: References: <16e5fdf90809301452u3b46615emac25715897a36bb9@mail.gmail.com> <55F15A17-22EB-4E7A-8FC6-6795CBBF303F@apple.com> <16e5fdf90809301525r3c12375bod900f0ea82e3c074@mail.gmail.com> <16e5fdf90809301541y36836125q7e22d90a3241bdf@mail.gmail.com> <1D4BC47E-C9C5-4282-AC62-FBF9D0B15DF3@apple.com> <16e5fdf90809301608y42352492lf7e80efb70238d2d@mail.gmail.com> <813345E7-3020-4AF2-9C0E-56F0708C710B@apple.com> Message-ID: <0A68E87A-4262-45E6-A894-50E9199200E4@apple.com> On Sep 30, 2008, at 4:25 PMPDT, Evan Cheng wrote: > > On Sep 30, 2008, at 4:21 PM, Dale Johannesen wrote: > >> >> On Sep 30, 2008, at 4:13 PMPDT, Evan Cheng wrote: >> >>> Actually no. It's a terrible idea. :-) >>> >>> This logic should not be in codegen at all. Users can still right >>> __builtin_memcpy and those can be optimized with -fno-builtin. >>> >>> So correct solution, take two. :-) FE should not generate calls to >>> @llvm.memset.i32 etc. when -fno-builtin is specified. Instead, it >>> should generate a simple call to memset. So the only changes >>> required >>> are in the FE, LLVM should not know anything about -fno-builtin at >>> all. >> >> Right. >> >>> That is, unless simplifylibcall decides to turn memset into >>> @llvm.memset*. >> >> This is why simplifylibcall shouldn't be keying off names. I don't >> think I got through before, maybe now.... > > This is not a simplifylibcall issue though. Even at -O0, llvm-gcc will > emit these intrinsics. See llvm-convert.cpp: Yep, that needs to check where -fno-builtin-memset is on. > void TreeToLLVM::EmitMemSet(Value *DestPtr, Value *SrcVal, Value > *Size, > unsigned Align) { > const Type *SBP = PointerType::getUnqual(Type::Int8Ty); > const Type *IntPtr = TD.getIntPtrType(); > Value *Ops[4] = { > BitCastToType(DestPtr, SBP), > CastToSIntType(SrcVal, Type::Int8Ty), > CastToSIntType(Size, IntPtr), > ConstantInt::get(Type::Int32Ty, Align) > }; > > Intrinsic::ID IID = > (IntPtr == Type::Int32Ty) ? Intrinsic::memset_i32 : > Intrinsic::memset_i64; > > Builder.CreateCall(Intrinsic::getDeclaration(TheModule, IID), Ops, > Ops+4); > } > > Evan >> >> >>> Evan >>> >>> On Sep 30, 2008, at 4:08 PM, Bill Wendling wrote: >>> >>>> On Tue, Sep 30, 2008 at 3:55 PM, Evan Cheng >>>> wrote: >>>>> >>>>> Actually, I think it'd be better to do this the right way. >>>> >>>> Bah! :-) >>>> >>>>> The correct >>>>> way to handle this option is to convert all memcpy / memset (and >>>>> other) intrinsic calls to normal calls. Perhaps in >>>>> SelectionDAGBuild.cpp? e.g. >>>>> >>>>> case Intrinsic::memcpy_i32: >>>>> case Intrinsic::memcpy_i64: { >>>>> SDValue Op1 = getValue(I.getOperand(1)); >>>>> SDValue Op2 = getValue(I.getOperand(2)); >>>>> SDValue Op3 = getValue(I.getOperand(3)); >>>>> unsigned Align = cast(I.getOperand(4))- >>>>>> getZExtValue(); >>>>> DAG.setRoot(DAG.getMemcpy(getRoot(), Op1, Op2, Op3, Align, false, >>>>> I.getOperand(1), 0, I.getOperand(2), >>>>> 0)); >>>>> return 0; >>>>> } >>>>> >>>>> We can lower it to a call to memcpy with -fno-builtin. >>>>> >>>> That's basically what I suggested in another email. So I think >>>> it's a >>>> brilliant idea. ;-) >>>> >>>> -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 >> >> _______________________________________________ >> 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 resistor at mac.com Tue Sep 30 18:58:50 2008 From: resistor at mac.com (Owen Anderson) Date: Tue, 30 Sep 2008 23:58:50 -0000 Subject: [llvm-commits] [llvm] r56893 - /llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Message-ID: <200809302358.m8UNwoPo011506@zion.cs.uiuc.edu> Author: resistor Date: Tue Sep 30 18:58:47 2008 New Revision: 56893 URL: http://llvm.org/viewvc/llvm-project?rev=56893&view=rev Log: Mark merged-in VNInfo's as being PHIKilled. Modified: llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Modified: llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp?rev=56893&r1=56892&r2=56893&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp (original) +++ llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Tue Sep 30 18:58:47 2008 @@ -977,6 +977,11 @@ } } + LiveInterval& Int = LI.getOrCreateInterval(I->first); + const LiveRange* LR = + Int.getLiveRangeContaining(LI.getMBBEndIdx(SI->second)); + LR->valno->hasPHIKill = true; + I->second.erase(SI->first); } From kremenek at apple.com Tue Sep 30 19:25:24 2008 From: kremenek at apple.com (Ted Kremenek) Date: Wed, 01 Oct 2008 00:25:24 -0000 Subject: [llvm-commits] [llvm] r56895 - /llvm/tags/checker/checker-105/ Message-ID: <200810010025.m910POGV012296@zion.cs.uiuc.edu> Author: kremenek Date: Tue Sep 30 19:25:23 2008 New Revision: 56895 URL: http://llvm.org/viewvc/llvm-project?rev=56895&view=rev Log: Tagging checker-105. Added: llvm/tags/checker/checker-105/ - copied from r56894, llvm/trunk/ From gohman at apple.com Tue Sep 30 19:25:39 2008 From: gohman at apple.com (Dan Gohman) Date: Wed, 01 Oct 2008 00:25:39 -0000 Subject: [llvm-commits] [llvm] r56896 - /llvm/trunk/test/CodeGen/X86/sse41-pmovx.ll Message-ID: <200810010025.m910PdPH012313@zion.cs.uiuc.edu> Author: djg Date: Tue Sep 30 19:25:38 2008 New Revision: 56896 URL: http://llvm.org/viewvc/llvm-project?rev=56896&view=rev Log: Use explicit target-triples to unbreak this test on non-darwin systems. Modified: llvm/trunk/test/CodeGen/X86/sse41-pmovx.ll Modified: llvm/trunk/test/CodeGen/X86/sse41-pmovx.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/sse41-pmovx.ll?rev=56896&r1=56895&r2=56896&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/sse41-pmovx.ll (original) +++ llvm/trunk/test/CodeGen/X86/sse41-pmovx.ll Tue Sep 30 19:25:38 2008 @@ -3,7 +3,8 @@ ; RUN: llvm-as < %s | llc -march=x86 -mattr=sse41 | grep pmovsxbd ; RUN: llvm-as < %s | llc -march=x86 -mattr=sse41 | grep pmovsxwd ; RUN: llvm-as < %s | llc -march=x86 -mattr=sse41 | grep pmovsxbq -; RUN: llvm-as < %s | llc -march=x86-64 -mattr=sse41 | grep movq | count 1 +; RUN: llvm-as < %s | llc -march=x86-64 -mattr=sse41 -mtriple=x86_64-apple-darwin | grep movq | count 1 +; RUN: llvm-as < %s | llc -march=x86-64 -mattr=sse41 -mtriple=x86_64-unknown-linux-gnu | not grep movq define <2 x i64> @t1(i32* %p) nounwind { entry: From evan.cheng at apple.com Tue Sep 30 19:39:46 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 01 Oct 2008 00:39:46 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r56898 - /llvm-gcc-4.2/trunk/gcc/config/darwin.c Message-ID: <200810010039.m910dkrT012857@zion.cs.uiuc.edu> Author: evancheng Date: Tue Sep 30 19:39:46 2008 New Revision: 56898 URL: http://llvm.org/viewvc/llvm-project?rev=56898&view=rev Log: Copy the second minor version number to target triple. e.g. -mmacosx-version-min=10.4.9 -> i386-apple-darwin8.9. Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.c Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/darwin.c?rev=56898&r1=56897&r2=56898&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/darwin.c (original) +++ llvm-gcc-4.2/trunk/gcc/config/darwin.c Tue Sep 30 19:39:46 2008 @@ -2674,7 +2674,7 @@ /* LLVM LOCAL begin radar 6230142 */ unsigned darwin_llvm_override_target_version(const char *triple, char **new_triple) { - int len = 0, pad = 0, version = 0; + int len = 0, pad1 = 0, pad2 = 0, version = 0; char *substr; if (!darwin_macosx_version_min) @@ -2694,11 +2694,21 @@ /* 10.0 is darwin4. */ version += 4; - + /* Darwin version number will be 2 digits for 10.6 and up. */ if (version >= 10) - pad = 1; - *new_triple = ggc_alloc (len+pad+1); + pad1 = 1; + + /* If darwin_macosx_version_min is something like 10.4.9, we need to append + the .9 to the new triple. */ + substr = strchr(darwin_macosx_version_min, '.'); + if (!substr) + return 0; + substr = strchr(substr+1, '.'); + if (substr) + pad2 = strlen(substr); + + *new_triple = ggc_alloc (len+pad1+pad2+1); strncpy (*new_triple, triple, len); if (version >= 10) { @@ -2707,6 +2717,13 @@ ++len; } (*new_triple)[len] = '0' + version; + if (substr) + { + int i; + for (i = 0; i < pad2; ++i) + (*new_triple)[len+1+i] = substr[i]; + len += pad2; + } (*new_triple)[len+1] = '\0'; return 1; From isanbard at gmail.com Tue Sep 30 19:59:58 2008 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 01 Oct 2008 00:59:58 -0000 Subject: [llvm-commits] [llvm] r56900 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h Message-ID: <200810010059.m910xwxO013517@zion.cs.uiuc.edu> Author: void Date: Tue Sep 30 19:59:58 2008 New Revision: 56900 URL: http://llvm.org/viewvc/llvm-project?rev=56900&view=rev Log: Implement the -fno-builtin option in the front-end, not in the back-end. Modified: llvm/trunk/include/llvm/Target/TargetLowering.h llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.h Modified: llvm/trunk/include/llvm/Target/TargetLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=56900&r1=56899&r2=56900&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetLowering.h (original) +++ llvm/trunk/include/llvm/Target/TargetLowering.h Tue Sep 30 19:59:58 2008 @@ -1049,8 +1049,7 @@ SDValue Chain, SDValue Op1, SDValue Op2, SDValue Op3, unsigned Align, - const Value *DstSV, uint64_t DstOff, - bool NoBuiltin = false) { + const Value *DstSV, uint64_t DstOff) { return SDValue(); } Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=56900&r1=56899&r2=56900&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Sep 30 19:59:58 2008 @@ -41,11 +41,6 @@ #include using namespace llvm; -static cl::opt -NoBuiltin("no-builtin", cl::init(false), - cl::desc("Don't recognize built-in functions that do not begin " - "with `__builtin_' as prefix")); - /// makeVTList - Return an instance of the SDVTList struct initialized with the /// specified members. static SDVTList makeVTList(const MVT *VTs, unsigned NumVTs) { @@ -3195,7 +3190,7 @@ // code. If the target chooses to do this, this is the next best. SDValue Result = TLI.EmitTargetCodeForMemset(*this, Chain, Dst, Src, Size, Align, - DstSV, DstSVOff, NoBuiltin); + DstSV, DstSVOff); if (Result.getNode()) return Result; Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=56900&r1=56899&r2=56900&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Tue Sep 30 19:59:58 2008 @@ -5132,8 +5132,7 @@ SDValue Dst, SDValue Src, SDValue Size, unsigned Align, const Value *DstSV, - uint64_t DstSVOff, - bool NoBuiltin) { + uint64_t DstSVOff) { ConstantSDNode *ConstantSize = dyn_cast(Size); // If not DWORD aligned or size is more than the threshold, call the library. @@ -5148,24 +5147,22 @@ // Check to see if there is a specialized entry-point for memory zeroing. ConstantSDNode *V = dyn_cast(Src); - if (!NoBuiltin) { - if (const char *bzeroEntry = V && - V->isNullValue() ? Subtarget->getBZeroEntry() : 0) { - MVT IntPtr = getPointerTy(); - const Type *IntPtrTy = TD->getIntPtrType(); - TargetLowering::ArgListTy Args; - TargetLowering::ArgListEntry Entry; - Entry.Node = Dst; - Entry.Ty = IntPtrTy; - Args.push_back(Entry); - Entry.Node = Size; - Args.push_back(Entry); - std::pair CallResult = - LowerCallTo(Chain, Type::VoidTy, false, false, false, false, - CallingConv::C, false, - DAG.getExternalSymbol(bzeroEntry, IntPtr), Args, DAG); - return CallResult.second; - } + if (const char *bzeroEntry = V && + V->isNullValue() ? Subtarget->getBZeroEntry() : 0) { + MVT IntPtr = getPointerTy(); + const Type *IntPtrTy = TD->getIntPtrType(); + TargetLowering::ArgListTy Args; + TargetLowering::ArgListEntry Entry; + Entry.Node = Dst; + Entry.Ty = IntPtrTy; + Args.push_back(Entry); + Entry.Node = Size; + Args.push_back(Entry); + std::pair CallResult = + LowerCallTo(Chain, Type::VoidTy, false, false, false, false, + CallingConv::C, false, + DAG.getExternalSymbol(bzeroEntry, IntPtr), Args, DAG); + return CallResult.second; } // Otherwise have the target-independent code call memset. Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.h?rev=56900&r1=56899&r2=56900&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.h (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.h Tue Sep 30 19:59:58 2008 @@ -578,8 +578,7 @@ SDValue Chain, SDValue Dst, SDValue Src, SDValue Size, unsigned Align, - const Value *DstSV, uint64_t DstSVOff, - bool NoBuiltin); + const Value *DstSV, uint64_t DstSVOff); SDValue EmitTargetCodeForMemcpy(SelectionDAG &DAG, SDValue Chain, SDValue Dst, SDValue Src, From isanbard at gmail.com Tue Sep 30 20:02:19 2008 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 01 Oct 2008 01:02:19 -0000 Subject: [llvm-commits] [llvm] r56901 - /llvm/trunk/test/CodeGen/X86/darwin-bzero.ll Message-ID: <200810010102.m9112JMR013628@zion.cs.uiuc.edu> Author: void Date: Tue Sep 30 20:02:18 2008 New Revision: 56901 URL: http://llvm.org/viewvc/llvm-project?rev=56901&view=rev Log: Moved this option to the front-end. Modified: llvm/trunk/test/CodeGen/X86/darwin-bzero.ll Modified: llvm/trunk/test/CodeGen/X86/darwin-bzero.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/darwin-bzero.ll?rev=56901&r1=56900&r2=56901&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/darwin-bzero.ll (original) +++ llvm/trunk/test/CodeGen/X86/darwin-bzero.ll Tue Sep 30 20:02:18 2008 @@ -1,5 +1,4 @@ ; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin10 | grep __bzero -; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin10 -no-builtin | grep _memset declare void @llvm.memset.i32(i8*, i8, i32, i32) From isanbard at gmail.com Tue Sep 30 20:07:42 2008 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 01 Oct 2008 01:07:42 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r56903 - in /llvm-gcc-4.2/trunk/gcc: llvm-backend.cpp llvm-convert.cpp Message-ID: <200810010107.m9117g3R013816@zion.cs.uiuc.edu> Author: void Date: Tue Sep 30 20:07:42 2008 New Revision: 56903 URL: http://llvm.org/viewvc/llvm-project?rev=56903&view=rev Log: Don't generate calls to intrinsics if the user specified that all built-ins (or a particular built-in) are to be disabled. Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp llvm-gcc-4.2/trunk/gcc/llvm-convert.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=56903&r1=56902&r2=56903&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Tue Sep 30 20:07:42 2008 @@ -70,7 +70,6 @@ #include "tree-inline.h" #include "langhooks.h" #include "cgraph.h" -#include "c-common.h" } // Non-zero if bytecode from PCH is successfully read. @@ -166,16 +165,15 @@ ArgStrings.push_back(Arg); } - if (flag_no_builtin) - ArgStrings.push_back(std::string("--no-builtin")); - if (llvm_optns) { std::string Opts = llvm_optns; for (std::string Opt = getToken(Opts); !Opt.empty(); Opt = getToken(Opts)) ArgStrings.push_back(Opt); } + for (unsigned i = 0, e = ArgStrings.size(); i != e; ++i) Args.push_back(ArgStrings[i].c_str()); + Args.push_back(0); // Null terminator. int pseudo_argc = Args.size()-1; 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=56903&r1=56902&r2=56903&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Tue Sep 30 20:07:42 2008 @@ -67,6 +67,7 @@ #include "libfuncs.h" #include "tree-flow.h" #include "tree-gimple.h" +#include "c-common.h" extern int get_pointer_alignment (tree exp, unsigned int max_align); extern enum machine_mode reg_raw_mode[FIRST_PSEUDO_REGISTER]; } @@ -1470,9 +1471,15 @@ ConstantInt::get(Type::Int32Ty, Align) }; - Intrinsic::ID IID = - (IntPtr == Type::Int32Ty) ? Intrinsic::memcpy_i32 : Intrinsic::memcpy_i64; - Builder.CreateCall(Intrinsic::getDeclaration(TheModule, IID), Ops, Ops+4); + if (!flag_no_builtin && !builtin_function_disabled_p("memcpy")) { + Intrinsic::ID IID = + (IntPtr == Type::Int32Ty) ? Intrinsic::memcpy_i32 : Intrinsic::memcpy_i64; + Builder.CreateCall(Intrinsic::getDeclaration(TheModule, IID), Ops, Ops + 4); + } else { + Builder.CreateCall(TheModule->getOrInsertFunction("memcpy", SBP, SBP, SBP, + IntPtr, (Type*)0), + Ops, Ops + 3); + } } void TreeToLLVM::EmitMemMove(Value *DestPtr, Value *SrcPtr, Value *Size, @@ -1486,9 +1493,16 @@ ConstantInt::get(Type::Int32Ty, Align) }; - Intrinsic::ID IID = - (IntPtr == Type::Int32Ty) ? Intrinsic::memmove_i32 : Intrinsic::memmove_i64; - Builder.CreateCall(Intrinsic::getDeclaration(TheModule, IID), Ops, Ops+4); + if (!flag_no_builtin && !builtin_function_disabled_p("memmove")) { + Intrinsic::ID IID = + (IntPtr == Type::Int32Ty) ? + Intrinsic::memmove_i32 : Intrinsic::memmove_i64; + Builder.CreateCall(Intrinsic::getDeclaration(TheModule, IID), Ops, Ops + 4); + } else { + Builder.CreateCall(TheModule->getOrInsertFunction("memmove", SBP, SBP, SBP, + IntPtr, (Type*)0), + Ops, Ops + 3); + } } void TreeToLLVM::EmitMemSet(Value *DestPtr, Value *SrcVal, Value *Size, @@ -1502,13 +1516,18 @@ ConstantInt::get(Type::Int32Ty, Align) }; - Intrinsic::ID IID = - (IntPtr == Type::Int32Ty) ? Intrinsic::memset_i32 : Intrinsic::memset_i64; - - Builder.CreateCall(Intrinsic::getDeclaration(TheModule, IID), Ops, Ops+4); + if (!flag_no_builtin && !builtin_function_disabled_p("memset")) { + Intrinsic::ID IID = + (IntPtr == Type::Int32Ty) ? Intrinsic::memset_i32 : Intrinsic::memset_i64; + Builder.CreateCall(Intrinsic::getDeclaration(TheModule, IID), Ops, Ops + 4); + } else { + Builder.CreateCall(TheModule->getOrInsertFunction("memset", SBP, SBP, + Type::Int8Ty, IntPtr, + (Type*)0), + Ops, Ops + 3); + } } - // Emits code to do something for a type attribute void TreeToLLVM::EmitTypeGcroot(Value *V, tree decl) { // GC intrinsics can only be used in functions which specify a collector. @@ -5039,24 +5058,88 @@ } bool TreeToLLVM::EmitBuiltinUnaryOp(Value *InVal, Value *&Result, - Intrinsic::ID Id) { + Intrinsic::ID Id) { // The intrinsic might be overloaded in which case the argument is of // varying type. Make sure that we specify the actual type for "iAny" // by passing it as the 3rd and 4th parameters. This isn't needed for // most intrinsics, but is needed for ctpop, cttz, ctlz. const Type *Ty = InVal->getType(); - Result = Builder.CreateCall(Intrinsic::getDeclaration(TheModule, Id, &Ty, 1), - InVal); + const char *Name = 0; + +#define CASE(ID, NAME) \ + case Intrinsic::ID: \ + if (flag_no_builtin || builtin_function_disabled_p(NAME)) \ + Name = NAME; \ + break + + if (Ty == Type::DoubleTy) { + switch (Id) { + default: break; + CASE(log, "log"); + CASE(log2, "log2"); + CASE(log10, "log10"); + CASE(exp, "exp"); + CASE(exp2, "exp2"); + } + } else if (Ty == Type::FloatTy) { + switch (Id) { + default: break; + CASE(log, "logf"); + CASE(log2, "log2f"); + CASE(log10, "log10f"); + CASE(exp, "expf"); + CASE(exp2, "exp2f"); + } + } else { + switch (Id) { + default: break; + CASE(log, "logl"); + CASE(log2, "log2l"); + CASE(log10, "log10l"); + CASE(exp, "expl"); + CASE(exp2, "exp2l"); + } + } + +#undef CASE + + if (!Name) + Result = Builder.CreateCall(Intrinsic::getDeclaration(TheModule, Id, + &Ty, 1), + InVal); + else + Result = Builder.CreateCall(TheModule->getOrInsertFunction(Name, Ty, Ty, + NULL), + InVal); + return true; } Value *TreeToLLVM::EmitBuiltinSQRT(tree exp) { Value *Amt = Emit(TREE_VALUE(TREE_OPERAND(exp, 1)), 0); const Type* Ty = Amt->getType(); - - return Builder.CreateCall(Intrinsic::getDeclaration(TheModule, - Intrinsic::sqrt, &Ty, 1), - Amt); + const char *Name = 0; + + if (Ty == Type::DoubleTy) { + if (flag_no_builtin || builtin_function_disabled_p("sqrt")) + Name = "sqrt"; + } else if (Ty == Type::FloatTy) { + if (flag_no_builtin || builtin_function_disabled_p("sqrtf")) + Name = "sqrtf"; + } else { + if (flag_no_builtin || builtin_function_disabled_p("sqrtl")) + Name = "sqrtl"; + } + + if (!Name) + return Builder.CreateCall(Intrinsic::getDeclaration(TheModule, + Intrinsic::sqrt, + &Ty, 1), + Amt); + else + return Builder.CreateCall(TheModule->getOrInsertFunction(Name, Ty, Ty, + NULL), + Amt); } Value *TreeToLLVM::EmitBuiltinPOWI(tree exp) { @@ -5072,9 +5155,30 @@ SmallVector Args; Args.push_back(Val); Args.push_back(Pow); - return Builder.CreateCall(Intrinsic::getDeclaration(TheModule, - Intrinsic::powi, &Ty, 1), - Args.begin(), Args.end()); + + const char *Name = 0; + + if (Ty == Type::DoubleTy) { + if (flag_no_builtin || builtin_function_disabled_p("powi")) + Name = "powi"; + } else if (Ty == Type::FloatTy) { + if (flag_no_builtin || builtin_function_disabled_p("powif")) + Name = "powif"; + } else { + if (flag_no_builtin || builtin_function_disabled_p("powil")) + Name = "powil"; + } + + if (!Name) + return Builder.CreateCall(Intrinsic::getDeclaration(TheModule, + Intrinsic::powi, + &Ty, 1), + Args.begin(), Args.end()); + else + return Builder.CreateCall(TheModule->getOrInsertFunction(Name, Ty, Ty, + Type::Int32Ty, + NULL), + Args.begin(), Args.end()); } Value *TreeToLLVM::EmitBuiltinPOW(tree exp) { @@ -5089,9 +5193,29 @@ SmallVector Args; Args.push_back(Val); Args.push_back(Pow); - return Builder.CreateCall(Intrinsic::getDeclaration(TheModule, - Intrinsic::pow, &Ty, 1), - Args.begin(), Args.end()); + + const char *Name = 0; + + if (Ty == Type::DoubleTy) { + if (flag_no_builtin || builtin_function_disabled_p("pow")) + Name = "pow"; + } else if (Ty == Type::FloatTy) { + if (flag_no_builtin || builtin_function_disabled_p("powf")) + Name = "powf"; + } else { + if (flag_no_builtin || builtin_function_disabled_p("powl")) + Name = "powl"; + } + + if (!Name) + return Builder.CreateCall(Intrinsic::getDeclaration(TheModule, + Intrinsic::pow, &Ty, 1), + Args.begin(), Args.end()); + else + return Builder.CreateCall(TheModule->getOrInsertFunction(Name, Ty, Ty, + Type::Int32Ty, + NULL), + Args.begin(), Args.end()); } bool TreeToLLVM::EmitBuiltinConstantP(tree exp, Value *&Result) { From dpatel at apple.com Tue Sep 30 20:26:22 2008 From: dpatel at apple.com (Devang Patel) Date: Wed, 01 Oct 2008 01:26:22 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r56905 - in /llvm-gcc-4.2/trunk/gcc: c-common.c config/i386/darwin.h config/rs6000/darwin.h Message-ID: <200810010126.m911QN9V014467@zion.cs.uiuc.edu> Author: dpatel Date: Tue Sep 30 20:26:22 2008 New Revision: 56905 URL: http://llvm.org/viewvc/llvm-project?rev=56905&view=rev Log: Fix newbie hack that attempted to enable format security warnings by default on darwin platform. Modified: llvm-gcc-4.2/trunk/gcc/c-common.c llvm-gcc-4.2/trunk/gcc/config/i386/darwin.h llvm-gcc-4.2/trunk/gcc/config/rs6000/darwin.h Modified: llvm-gcc-4.2/trunk/gcc/c-common.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-common.c?rev=56905&r1=56904&r2=56905&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/c-common.c (original) +++ llvm-gcc-4.2/trunk/gcc/c-common.c Tue Sep 30 20:26:22 2008 @@ -302,8 +302,7 @@ /* Warn about format/argument anomalies in calls to formatted I/O functions (*printf, *scanf, strftime, strfmon, etc.). */ -/* APPLE LOCAL default to Wformat-security 5764921 */ -int warn_format = 1; +int warn_format; /* Warn about using __null (as NULL in C++) as sentinel. For code compiled with GCC this doesn't matter as __null is guaranteed to have the right Modified: llvm-gcc-4.2/trunk/gcc/config/i386/darwin.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/darwin.h?rev=56905&r1=56904&r2=56905&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/i386/darwin.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/i386/darwin.h Tue Sep 30 20:26:22 2008 @@ -101,6 +101,8 @@ %{!mmacosx-version-min=*: %{!miphoneos-version-min=*: %(darwin_cc1_minversion)}} \ "/* APPLE LOCAL ignore -mcpu=G4 -mcpu=G5 */"\ % Author: void Date: Tue Sep 30 20:27:41 2008 New Revision: 56906 URL: http://llvm.org/viewvc/llvm-project?rev=56906&view=rev Log: Creating llvmCore-2073 branch Added: llvm/tags/Apple/llvmCore-2073/ - copied from r56905, llvm/trunk/ From isanbard at gmail.com Tue Sep 30 20:27:47 2008 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 01 Oct 2008 01:27:47 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r56907 - /llvm-gcc-4.2/tags/Apple/llvmgcc42-2073/ Message-ID: <200810010127.m911Rl9s014554@zion.cs.uiuc.edu> Author: void Date: Tue Sep 30 20:27:47 2008 New Revision: 56907 URL: http://llvm.org/viewvc/llvm-project?rev=56907&view=rev Log: Creating llvmgcc42-2073 branch Added: llvm-gcc-4.2/tags/Apple/llvmgcc42-2073/ - copied from r56906, llvm-gcc-4.2/trunk/ From gohman at apple.com Tue Sep 30 21:02:03 2008 From: gohman at apple.com (Dan Gohman) Date: Wed, 01 Oct 2008 02:02:03 -0000 Subject: [llvm-commits] [llvm] r56908 - /llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Message-ID: <200810010202.m9122377015786@zion.cs.uiuc.edu> Author: djg Date: Tue Sep 30 21:02:03 2008 New Revision: 56908 URL: http://llvm.org/viewvc/llvm-project?rev=56908&view=rev Log: Call ScalarEvolution's deleteValueFromRecords before deleting an instruction, not after. This fixes some uses of free'd memory. 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=56908&r1=56907&r2=56908&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Tue Sep 30 21:02:03 2008 @@ -1803,15 +1803,15 @@ Cond->getOperand(0), NewRHS, "scmp", Cond); // Delete the max calculation instructions. + SE->deleteValueFromRecords(Cond); Cond->replaceAllUsesWith(NewCond); Cond->eraseFromParent(); - SE->deleteValueFromRecords(Cond); Instruction *Cmp = cast(Sel->getOperand(0)); - Sel->eraseFromParent(); SE->deleteValueFromRecords(Sel); + Sel->eraseFromParent(); if (Cmp->use_empty()) { - Cmp->eraseFromParent(); SE->deleteValueFromRecords(Cmp); + Cmp->eraseFromParent(); } CondUse->User = NewCond; return NewCond; From gohman at apple.com Tue Sep 30 23:13:24 2008 From: gohman at apple.com (Dan Gohman) Date: Wed, 01 Oct 2008 04:13:24 -0000 Subject: [llvm-commits] [llvm] r56910 - /llvm/trunk/test/Assembler/2008-09-02-FunctionNotes2.ll Message-ID: <200810010413.m914DOEw019513@zion.cs.uiuc.edu> Author: djg Date: Tue Sep 30 23:13:23 2008 New Revision: 56910 URL: http://llvm.org/viewvc/llvm-project?rev=56910&view=rev Log: Don't leave an output file in the test directory. Modified: llvm/trunk/test/Assembler/2008-09-02-FunctionNotes2.ll Modified: llvm/trunk/test/Assembler/2008-09-02-FunctionNotes2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/2008-09-02-FunctionNotes2.ll?rev=56910&r1=56909&r2=56910&view=diff ============================================================================== --- llvm/trunk/test/Assembler/2008-09-02-FunctionNotes2.ll (original) +++ llvm/trunk/test/Assembler/2008-09-02-FunctionNotes2.ll Tue Sep 30 23:13:23 2008 @@ -1,5 +1,5 @@ ; Test function notes -; RUN: not llvm-as %s |& grep "only one inline note" +; RUN: not llvm-as %s -o /dev/null -f |& grep "only one inline note" ; XFAIL: * define void @fn1() alwaysinline noinline { ret void From gohman at apple.com Tue Sep 30 23:14:30 2008 From: gohman at apple.com (Dan Gohman) Date: Wed, 01 Oct 2008 04:14:30 -0000 Subject: [llvm-commits] [llvm] r56911 - in /llvm/trunk/lib/Target/X86: X86Instr64bit.td X86InstrInfo.td Message-ID: <200810010414.m914EUap019549@zion.cs.uiuc.edu> Author: djg Date: Tue Sep 30 23:14:30 2008 New Revision: 56911 URL: http://llvm.org/viewvc/llvm-project?rev=56911&view=rev Log: Mark CALL instructions as having a Use of ESP/RSP. Modified: llvm/trunk/lib/Target/X86/X86Instr64bit.td llvm/trunk/lib/Target/X86/X86InstrInfo.td Modified: llvm/trunk/lib/Target/X86/X86Instr64bit.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Instr64bit.td?rev=56911&r1=56910&r2=56911&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86Instr64bit.td (original) +++ llvm/trunk/lib/Target/X86/X86Instr64bit.td Tue Sep 30 23:14:30 2008 @@ -95,7 +95,8 @@ FP0, FP1, FP2, FP3, FP4, FP5, FP6, ST0, ST1, MM0, MM1, MM2, MM3, MM4, MM5, MM6, MM7, XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, - XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15, EFLAGS] in { + XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15, EFLAGS], + Uses = [RSP] in { def CALL64pcrel32 : I<0xE8, RawFrm, (outs), (ins i64imm:$dst, variable_ops), "call\t${dst:call}", []>; def CALL64r : I<0xFF, MRM2r, (outs), (ins GR64:$dst, variable_ops), Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=56911&r1=56910&r2=56911&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Tue Sep 30 23:14:30 2008 @@ -334,7 +334,7 @@ def NOOP : I<0x90, RawFrm, (outs), (ins), "nop", []>; // PIC base -let neverHasSideEffects = 1, isNotDuplicable = 1 in +let neverHasSideEffects = 1, isNotDuplicable = 1, Uses = [ESP] in def MOVPC32r : Ii32<0xE8, Pseudo, (outs GR32:$reg), (ins piclabel:$label), "call\t$label\n\tpop{l}\t$reg", []>; @@ -414,7 +414,8 @@ // All calls clobber the non-callee saved registers... let Defs = [EAX, ECX, EDX, FP0, FP1, FP2, FP3, FP4, FP5, FP6, ST0, MM0, MM1, MM2, MM3, MM4, MM5, MM6, MM7, - XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, EFLAGS] in { + XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, EFLAGS], + Uses = [ESP] in { def CALLpcrel32 : Ii32<0xE8, RawFrm, (outs), (ins i32imm:$dst,variable_ops), "call\t${dst:call}", []>; def CALL32r : I<0xFF, MRM2r, (outs), (ins GR32:$dst, variable_ops), From evan.cheng at apple.com Tue Sep 30 23:35:06 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 30 Sep 2008 21:35:06 -0700 Subject: [llvm-commits] [llvm] r56911 - in /llvm/trunk/lib/Target/X86: X86Instr64bit.td X86InstrInfo.td In-Reply-To: <200810010414.m914EUap019549@zion.cs.uiuc.edu> References: <200810010414.m914EUap019549@zion.cs.uiuc.edu> Message-ID: <7B9BECB8-CD62-40B6-841A-78BF78F4700C@apple.com> Is this fixing a fast-isel bug? Evan On Sep 30, 2008, at 9:14 PM, Dan Gohman wrote: > Author: djg > Date: Tue Sep 30 23:14:30 2008 > New Revision: 56911 > > URL: http://llvm.org/viewvc/llvm-project?rev=56911&view=rev > Log: > Mark CALL instructions as having a Use of ESP/RSP. > > Modified: > llvm/trunk/lib/Target/X86/X86Instr64bit.td > llvm/trunk/lib/Target/X86/X86InstrInfo.td > > Modified: llvm/trunk/lib/Target/X86/X86Instr64bit.td > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Instr64bit.td?rev=56911&r1=56910&r2=56911&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/X86/X86Instr64bit.td (original) > +++ llvm/trunk/lib/Target/X86/X86Instr64bit.td Tue Sep 30 23:14:30 > 2008 > @@ -95,7 +95,8 @@ > FP0, FP1, FP2, FP3, FP4, FP5, FP6, ST0, ST1, > MM0, MM1, MM2, MM3, MM4, MM5, MM6, MM7, > XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, > - XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15, > EFLAGS] in { > + XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15, > EFLAGS], > + Uses = [RSP] in { > def CALL64pcrel32 : I<0xE8, RawFrm, (outs), (ins i64imm:$dst, > variable_ops), > "call\t${dst:call}", []>; > def CALL64r : I<0xFF, MRM2r, (outs), (ins GR64:$dst, > variable_ops), > > Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=56911&r1=56910&r2=56911&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original) > +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Tue Sep 30 23:14:30 2008 > @@ -334,7 +334,7 @@ > def NOOP : I<0x90, RawFrm, (outs), (ins), "nop", []>; > > // PIC base > -let neverHasSideEffects = 1, isNotDuplicable = 1 in > +let neverHasSideEffects = 1, isNotDuplicable = 1, Uses = [ESP] in > def MOVPC32r : Ii32<0xE8, Pseudo, (outs GR32:$reg), (ins piclabel: > $label), > "call\t$label\n\tpop{l}\t$reg", []>; > > @@ -414,7 +414,8 @@ > // All calls clobber the non-callee saved registers... > let Defs = [EAX, ECX, EDX, FP0, FP1, FP2, FP3, FP4, FP5, FP6, ST0, > MM0, MM1, MM2, MM3, MM4, MM5, MM6, MM7, > - XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, > EFLAGS] in { > + XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, > EFLAGS], > + Uses = [ESP] in { > def CALLpcrel32 : Ii32<0xE8, RawFrm, (outs), (ins i32imm: > $dst,variable_ops), > "call\t${dst:call}", []>; > def CALL32r : I<0xFF, MRM2r, (outs), (ins GR32:$dst, > variable_ops), > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From kremenek at apple.com Wed Oct 1 00:03:53 2008 From: kremenek at apple.com (Ted Kremenek) Date: Wed, 01 Oct 2008 05:03:53 -0000 Subject: [llvm-commits] [llvm] r56913 - /llvm/tags/checker/checker-106/ Message-ID: <200810010503.m9153roX020990@zion.cs.uiuc.edu> Author: kremenek Date: Wed Oct 1 00:03:52 2008 New Revision: 56913 URL: http://llvm.org/viewvc/llvm-project?rev=56913&view=rev Log: Tagging checker-106. Added: llvm/tags/checker/checker-106/ - copied from r56912, llvm/trunk/ From m.kooijman at student.utwente.nl Wed Oct 1 02:41:05 2008 From: m.kooijman at student.utwente.nl (Matthijs Kooijman) Date: Wed, 1 Oct 2008 09:41:05 +0200 Subject: [llvm-commits] Struct-handling patches In-Reply-To: References: <20080928190454.GG15228@katherina.student.utwente.nl> Message-ID: <20081001074105.GA25255@katherina.student.utwente.nl> > I think this is fine. It's a tricky area, and I expect it'll be something > we'll re-evaluate over time, but I think it's reasonable for now. Good. > Instead of isa + cast you can use > if (const ArrayType *ATy = dyn_cast(*I)) { > > Also, the word "Otherwise" in the comment no longer makes sense, > given the new structure of the code. I initially had this code structured differently, and apparently haven't taken the time to remove this issues after restructuring. Will do. > I agree with Duncan that this doesn't sound safe in the case of > structs with holes. Yeah, I hadn't thought of that. However, doesn't this problem arise in case of a memcpy of a {double}. I'm completely unsure of how this works, but if double is the same as fp80, ie a 10 byte value, and the struct, and thus a memcpy of it, gets a size of 16 bytes (due to alignment?), then replacing sucy a memcpy with load + store will skip the 6-byte hole at the end of the struct, right? It might very well be that any or all of the assumptions in the above are wrong, though. > > This last patch is not completely useful by itself yet, since scalarrepl > > doesn't know how to handle struct loads and stores yet :-) I'll have a > > look at that tomorrow. In fact, it turns out that scalarrepl does handle struct loads and stores already (at least in the testcase I was devising to show it didn't). > Would it make sense to teach scalarrepl how to handle llvm.memcpy? The code > above in instcombine only looks at objects that are 8 bytes or smaller, > which is somewhat arbitrary when it comes to structs. We don't want to > translate large struct copies to single loads and stores, but it seems there > will be a lot of interesting cases with structs slightly larger than 8 > bytes. scalarrepl already knows how to handle memcpy. However, my problems arose because before scalarrepl looks at the code, instcombine had already replaced the memcpy with a load+store of i32 or i64, which scalarrepl didn't like. As an example, when we start out with the following. I didn't actually test this code, I'm just writing down what I remember happening. %A = alloca { i16, i16 } %B = alloca { i16, i16 } ... %Ap = bitcast {i16, i16}* %A to i8* %Bp = bitcast {i16, i16}* %B to i8* call @llvm.memcpy(i8* %Ap, i8* %Bp, i32 4, i32 1) Instcombine changes this to: %A = alloca { i16, i16 } %B = alloca { i16, i16 } ... %Ap = bitcast {i16, i16}* %A to i32* %Bp = bitcast {i16, i16}* %B to i32* %V = load i32* %Bp store i32 %V, i32* %Ap Scalarrepl no longer knows how to handle this, and leaves the alloca's intact. Scalarrepl might be able to change this, perhaps like this: %A = alloca { i16, i16 } ... %Ap = bitcast {i16, i16}* %A to i32* %V = load i32* %Bp %Vs = bitcast i32 %V to {i16, i16} %B0 = extractvalue {i16, i16} %Vs, i32 0 %B1 = extractvalue {i16, i16} %Vs, i32 1 Here, the %B alloca is replaced, but scalarrepl still keeps the i32 intact by bitcasting from it (or to it in the reverse case). If %A is also replaced in the above, the resulting bitcasts, insertvalue and extractvalue instructions should vanish and the code should become pretty. Alternatively, scalarrepl could look two steps further and also include the load and bitcast in the replace, resulting in: %A = alloca { i16, i16 } ... %A0 = getelementptr {i16, i16} %A, i32 0, i32 0 %A1 = getelementptr {i16, i16} %A, i32 0, i32 1 %B0 = load i16* %A0 %B1 = load i16* %A1 The latter approach has the advantage of removing the i32 stuff straight away, but might be less flexible in situations that are slightly different from the above example. In both of the above options, the holes in a struct might not be relevant anymore. Once scalarrepl replaces a struct, the holes disappear, and only the elements remain. Then there appears to be no need to preserve the hole-copying. However, the exception to this seems to be when a struct is both loaded from and stored to (using a type like i32, which also reads or writes holes. This also goes for doing both a memcpy in and out of a struct, so I suspect that scalarrepl has some way of handling this properly (or might it be bugged now?) > Actually, it may some day make sense to use single loads and stores > instead of memcpy for all structs, but before we can do that we'd need > at least need to teach codegen how to effectively turn them back into > memcpy in most cases. Offhand I don't know what other changes would > be needed to avoid major pessimizations. I think the main problem that exists is that the frontend now emits memcpy's and thus requires holes in structs to be copied, even when this isn't even required. Having the frontend emit something with completely correct semantics probably makes things a lot easier in the backend (however, as I suggested here [1] it could be even better to have some way to express "copy this struct, and you may or may not copy holes"). Also, this discussion is become more and more alike to the struct-copy thread in cfe-dev [1]. Gr. Matthijs [1]: http://lists.cs.uiuc.edu/pipermail/cfe-dev/2008-September/002920.html From baldrick at free.fr Wed Oct 1 02:54:26 2008 From: baldrick at free.fr (Duncan Sands) Date: Wed, 1 Oct 2008 09:54:26 +0200 Subject: [llvm-commits] r55638 - /llvm/trunk/include/llvm/Function.h In-Reply-To: References: <200809231027.53858.baldrick@free.fr> <200809300939.38971.baldrick@free.fr> Message-ID: <200810010954.26247.baldrick@free.fr> On Tuesday 30 September 2008 18:28:58 Devang Patel wrote: > > On Sep 30, 2008, at 12:39 AM, Duncan Sands wrote: > > >> Ignore inliner for a while, and decide what code generator should do > >> for following ? > >> > >> define float @foo(float %a, float %b) x86_no_sse { > >> %t = mul float %a, %b > >> ret float %t > >> } > > > > It would use the x86 floating point stack, like it does now > > if you compile with -mattr=-sse. This is less efficient than > > using sse. > > So, I guess you answered your question. So what you are saying is: if function A is marked no-sse, and it calls function B which is marked sse, than B will not be inlined into A if B contains any floating point operations (for example, a fp multiplication)? Ciao, Duncan. From baldrick at free.fr Wed Oct 1 03:21:52 2008 From: baldrick at free.fr (Duncan Sands) Date: Wed, 1 Oct 2008 10:21:52 +0200 Subject: [llvm-commits] Struct-handling patches In-Reply-To: <20081001074105.GA25255@katherina.student.utwente.nl> References: <20080928190454.GG15228@katherina.student.utwente.nl> <20081001074105.GA25255@katherina.student.utwente.nl> Message-ID: <200810011021.52861.baldrick@free.fr> Hi, > > I agree with Duncan that this doesn't sound safe in the case of > > structs with holes. > Yeah, I hadn't thought of that. However, doesn't this problem arise in case of > a memcpy of a {double}. I'm completely unsure of how this works, but if double > is the same as fp80, ie a 10 byte value, and the struct, and thus a memcpy of > it, gets a size of 16 bytes (due to alignment?), then replacing sucy a memcpy > with load + store will skip the 6-byte hole at the end of the struct, right? > It might very well be that any or all of the assumptions in the above are > wrong, though. the HasPadding method takes care of this. For x86 long double it's taken care of by this line: return TD.getTypeSizeInBits(Ty) != TD.getABITypeSizeInBits(Ty); The LHS is 80, the RHS is 96 or 128 depending on the platform. Ciao, Duncan. From baldrick at free.fr Wed Oct 1 03:24:17 2008 From: baldrick at free.fr (Duncan Sands) Date: Wed, 1 Oct 2008 10:24:17 +0200 Subject: [llvm-commits] [llvm] r56887 - /llvm/trunk/lib/Transforms/IPO/Internalize.cpp In-Reply-To: <200809302204.m8UM4V8b007868@zion.cs.uiuc.edu> References: <200809302204.m8UM4V8b007868@zion.cs.uiuc.edu> Message-ID: <200810011024.18078.baldrick@free.fr> Hi Nuno, > add preserversCFG() + preservers(CallGraph) it does not preserve the callgraph, because for a function F that is made internal, before there was an edge to it from the external node, while after there should not be (but there still is - i.e. the callgraph was not updated properly). Ciao, Duncan. From baldrick at free.fr Wed Oct 1 03:27:29 2008 From: baldrick at free.fr (Duncan Sands) Date: Wed, 1 Oct 2008 10:27:29 +0200 Subject: [llvm-commits] [llvm] r56910 - /llvm/trunk/test/Assembler/2008-09-02-FunctionNotes2.ll In-Reply-To: <200810010413.m914DOEw019513@zion.cs.uiuc.edu> References: <200810010413.m914DOEw019513@zion.cs.uiuc.edu> Message-ID: <200810011027.29322.baldrick@free.fr> How about > -; RUN: not llvm-as %s |& grep "only one inline note" > +; RUN: not llvm-as %s -o /dev/null -f |& grep "only one inline note" not llvm-as < %s |& grep "only one inline note" (untested)? Ciao, Duncan. From baldrick at free.fr Wed Oct 1 03:31:42 2008 From: baldrick at free.fr (Duncan Sands) Date: Wed, 1 Oct 2008 10:31:42 +0200 Subject: [llvm-commits] Struct-handling patches In-Reply-To: <20081001074105.GA25255@katherina.student.utwente.nl> References: <20080928190454.GG15228@katherina.student.utwente.nl> <20081001074105.GA25255@katherina.student.utwente.nl> Message-ID: <200810011031.42253.baldrick@free.fr> Hi, > I think the main problem that exists is that the frontend now emits memcpy's > and thus requires holes in structs to be copied, even when this isn't even > required. for small structs llvm-gcc should only use a memcpy if the struct has holes. Otherwise it generates a field-by-field copy. Ciao, Duncan. From baldrick at free.fr Wed Oct 1 04:05:53 2008 From: baldrick at free.fr (Duncan Sands) Date: Wed, 1 Oct 2008 11:05:53 +0200 Subject: [llvm-commits] [llvm-gcc-4.2] r56903 - in /llvm-gcc-4.2/trunk/gcc: llvm-backend.cpp llvm-convert.cpp In-Reply-To: <200810010107.m9117g3R013816@zion.cs.uiuc.edu> References: <200810010107.m9117g3R013816@zion.cs.uiuc.edu> Message-ID: <200810011105.54134.baldrick@free.fr> Hi Bill, > -#include "c-common.h" yay! Removal of a C-specific file from the language independent llvm-backend.cpp! > +#include "c-common.h" Argh! Addition of a C-specific file to the language independent llvm-convert.cpp! > + if (!flag_no_builtin && !builtin_function_disabled_p("memcpy")) { Woah, this call means total death for Fortran and Ada! > + (IntPtr == Type::Int32Ty) ? Intrinsic::memcpy_i32 : Intrinsic::memcpy_i64; ... > + Intrinsic::memmove_i32 : Intrinsic::memmove_i64; ... > + (IntPtr == Type::Int32Ty) ? Intrinsic::memset_i32 : Intrinsic::memset_i64; If I understand right, here you are outputting a call to "memcpy" rather than "llvm.memcpy" if no-builtins is turned on. Why? Does this win you anything? I thought no-builtins meant: 'if in my program I call "memcpy" leave it alone and don't turn it into something else'. But that's not the case here. Here a struct copy is being turned into a call to llvm.memcpy. That will be turned by the code generators into either an inline code sequence or a call to "memcpy". Is there anything wrong with that? No user call to memcpy is being turned into an inline code sequence. For what it's worth gcc itself happily synthesizes calls to builtin_memcpy (eg: in gimplify_modify_expr_to_memcpy, a similar situation). As for the remaining changes, I don't see why they are needed either. The code you changed only turns things marked as builtins by gcc into llvm intrinsics. If builtins are turned off in gcc then presumably user calls to these functions will not be marked as gcc builtin calls in the first place, so already won't be turned into llvm builtins. I didn't test this though. In short, while I understand that you are trying to fix something, I'm not sure what it is and how your changes fix it! Instead you seemed to have fixed things that weren't broken, and broken non-C languages... Ciao, Duncan. From nunoplopes at sapo.pt Wed Oct 1 04:13:41 2008 From: nunoplopes at sapo.pt (Nuno Lopes) Date: Wed, 01 Oct 2008 09:13:41 -0000 Subject: [llvm-commits] [llvm] r56917 - /llvm/trunk/lib/Transforms/IPO/Internalize.cpp Message-ID: <200810010913.m919DfOj005507@zion.cs.uiuc.edu> Author: nlopes Date: Wed Oct 1 04:13:40 2008 New Revision: 56917 URL: http://llvm.org/viewvc/llvm-project?rev=56917&view=rev Log: revert the addition of Preverves(CallGraph), per Duncan's comments Modified: llvm/trunk/lib/Transforms/IPO/Internalize.cpp Modified: llvm/trunk/lib/Transforms/IPO/Internalize.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/Internalize.cpp?rev=56917&r1=56916&r2=56917&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/Internalize.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/Internalize.cpp Wed Oct 1 04:13:40 2008 @@ -14,7 +14,6 @@ //===----------------------------------------------------------------------===// #define DEBUG_TYPE "internalize" -#include "llvm/Analysis/CallGraph.h" #include "llvm/Transforms/IPO.h" #include "llvm/Pass.h" #include "llvm/Module.h" @@ -56,7 +55,6 @@ virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesCFG(); - AU.addPreserved(); } }; } // end anonymous namespace From nunoplopes at sapo.pt Wed Oct 1 04:16:20 2008 From: nunoplopes at sapo.pt (Nuno Lopes) Date: Wed, 1 Oct 2008 10:16:20 +0100 Subject: [llvm-commits] [llvm] r56887 - /llvm/trunk/lib/Transforms/IPO/Internalize.cpp In-Reply-To: <200810011024.18078.baldrick@free.fr> References: <200809302204.m8UM4V8b007868@zion.cs.uiuc.edu> <200810011024.18078.baldrick@free.fr> Message-ID: > Hi Nuno, > >> add preserversCFG() + preservers(CallGraph) > > it does not preserve the callgraph, because > for a function F that is made internal, before > there was an edge to it from the external node, > while after there should not be (but there still > is - i.e. the callgraph was not updated properly). Ah, right, makes sense :) Thanks for reviewing the patch, Nuno From baldrick at free.fr Wed Oct 1 04:19:05 2008 From: baldrick at free.fr (Duncan Sands) Date: Wed, 1 Oct 2008 11:19:05 +0200 Subject: [llvm-commits] [llvm] r56887 - /llvm/trunk/lib/Transforms/IPO/Internalize.cpp In-Reply-To: References: <200809302204.m8UM4V8b007868@zion.cs.uiuc.edu> <200810011024.18078.baldrick@free.fr> Message-ID: <200810011119.06165.baldrick@free.fr> > >> add preserversCFG() + preservers(CallGraph) > > > > it does not preserve the callgraph, because > > for a function F that is made internal, before > > there was an edge to it from the external node, > > while after there should not be (but there still > > is - i.e. the callgraph was not updated properly). > > Ah, right, makes sense :) That said, it would be easy to update the callgraph. > Thanks for reviewing the patch, Thanks for fixing up the "preserves" stuff! Duncan. From nunoplopes at sapo.pt Wed Oct 1 05:04:22 2008 From: nunoplopes at sapo.pt (Nuno Lopes) Date: Wed, 1 Oct 2008 11:04:22 +0100 Subject: [llvm-commits] [llvm] r56887 - /llvm/trunk/lib/Transforms/IPO/Internalize.cpp In-Reply-To: <200810011119.06165.baldrick@free.fr> References: <200809302204.m8UM4V8b007868@zion.cs.uiuc.edu> <200810011024.18078.baldrick@free.fr> <200810011119.06165.baldrick@free.fr> Message-ID: <30424DD75D784EEBBC3F2AC796215709@pc07654> >> >> add preserversCFG() + preservers(CallGraph) >> > >> > it does not preserve the callgraph, because >> > for a function F that is made internal, before >> > there was an edge to it from the external node, >> > while after there should not be (but there still >> > is - i.e. the callgraph was not updated properly). >> >> Ah, right, makes sense :) > > That said, it would be easy to update the callgraph. I guess that would go beyond my current knowledge of llvm :P Nuno From baldrick at free.fr Wed Oct 1 06:38:29 2008 From: baldrick at free.fr (Duncan Sands) Date: Wed, 1 Oct 2008 13:38:29 +0200 Subject: [llvm-commits] [llvm-gcc-4.2] r56903 - in /llvm-gcc-4.2/trunk/gcc: llvm-backend.cpp llvm-convert.cpp In-Reply-To: <200810011105.54134.baldrick@free.fr> References: <200810010107.m9117g3R013816@zion.cs.uiuc.edu> <200810011105.54134.baldrick@free.fr> Message-ID: <200810011338.30763.baldrick@free.fr> > > + if (!flag_no_builtin && !builtin_function_disabled_p("memcpy")) { > > Woah, this call means total death for Fortran and Ada! I decided to test whether the call to builtin_function_disabled_p would really crash Fortran/Ada, but didn't get that far because they don't build: libbackend.a(llvm-convert.o): In function `TreeToLLVM::EmitMemSet(llvm::Value*, llvm::Value*, llvm::Value*, unsigned int)': llvm-convert.cpp:1519: undefined reference to `flag_no_builtin' llvm-convert.cpp:1519: undefined reference to `builtin_function_disabled_p' etc Ciao, Duncan From m.kooijman at student.utwente.nl Wed Oct 1 07:18:32 2008 From: m.kooijman at student.utwente.nl (Matthijs Kooijman) Date: Wed, 1 Oct 2008 14:18:32 +0200 Subject: [llvm-commits] Struct-handling patches In-Reply-To: <200810011031.42253.baldrick@free.fr> References: <20080928190454.GG15228@katherina.student.utwente.nl> <20081001074105.GA25255@katherina.student.utwente.nl> <200810011031.42253.baldrick@free.fr> Message-ID: <20081001121832.GC25255@katherina.student.utwente.nl> Hi Duncan, > for small structs llvm-gcc should only use a memcpy if the struct has holes. > Otherwise it generates a field-by-field copy. I'm working with clang, so not sure how that one handles this. Also, the case I'm mostly working with, is a struct returning function getting inlined (resulting in up to two memcpy's in the final function). I don't think that field-by field copies are used in this case. Gr. Matthijs From m.kooijman at student.utwente.nl Wed Oct 1 07:36:40 2008 From: m.kooijman at student.utwente.nl (Matthijs Kooijman) Date: Wed, 1 Oct 2008 14:36:40 +0200 Subject: [llvm-commits] Struct-handling patches In-Reply-To: <200810011021.52861.baldrick@free.fr> References: <20080928190454.GG15228@katherina.student.utwente.nl> <20081001074105.GA25255@katherina.student.utwente.nl> <200810011021.52861.baldrick@free.fr> Message-ID: <20081001123640.GD25255@katherina.student.utwente.nl> Hi Dan, > > Yeah, I hadn't thought of that. However, doesn't this problem arise in case of > > a memcpy of a {double}. I'm completely unsure of how this works, but if double > > is the same as fp80, ie a 10 byte value, and the struct, and thus a memcpy of > > it, gets a size of 16 bytes (due to alignment?), then replacing sucy a memcpy > > with load + store will skip the 6-byte hole at the end of the struct, right? > > It might very well be that any or all of the assumptions in the above are > > wrong, though. > the HasPadding method takes care of this. For x86 long double it's taken > care of by this line: > > return TD.getTypeSizeInBits(Ty) != TD.getABITypeSizeInBits(Ty); > > The LHS is 80, the RHS is 96 or 128 depending on the platform. But where exactly is HasPadding used? Or do you mean "should/could take care of this" ? In particular, I looked a bit closer at the SimplifyMemTransfer. The only thing they do there regarding sizes of the types juggled, is comparing if the store size of the struct type that's memcpy'd is equal to the memcpy size. Since the store size includes padding, this is probably the case. However, for the {double} case ( a double is 10 bytes, right?), this will probably mean that a store of type double will not include this padding, while the original memcpy didn't. Ie, I have this feeling that there is a bug in SimplifyMemTransfer regarding this, but I don't have the time to find a testcase right now. Gr. Matthijs From baldrick at free.fr Wed Oct 1 08:04:56 2008 From: baldrick at free.fr (Duncan Sands) Date: Wed, 1 Oct 2008 15:04:56 +0200 Subject: [llvm-commits] Struct-handling patches In-Reply-To: <20081001123640.GD25255@katherina.student.utwente.nl> References: <20080928190454.GG15228@katherina.student.utwente.nl> <200810011021.52861.baldrick@free.fr> <20081001123640.GD25255@katherina.student.utwente.nl> Message-ID: <200810011504.56455.baldrick@free.fr> Hi, > But where exactly is HasPadding used? Or do you mean "should/could take care > of this" ? if HasPadding is not being used, but should, that's a bug. > In particular, I looked a bit closer at the SimplifyMemTransfer. The only > thing they do there regarding sizes of the types juggled, is comparing if the > store size of the struct type that's memcpy'd is equal to the memcpy size. I suspect the problem is that structs as first class types didn't exist when SROA was written, and it's basically an accident that it seems to work for structs. I doubt anyone carefully audited it to check that the logic is fine for structs and arrays. Using the store size was fine as long as it was only dealing with good 'ol integers and floats. > Since the store size includes padding, this is probably the case. However, for > the {double} case ( a double is 10 bytes, right?), this will probably mean > that a store of type double will not include this padding, while the original > memcpy didn't. Exactly. > Ie, I have this feeling that there is a bug in SimplifyMemTransfer regarding > this, but I don't have the time to find a testcase right now. It's surely a bug. If you have time, can you please review SROA for correctness in the presence of structs and arrays as first class types. Thanks, Duncan. From gohman at apple.com Wed Oct 1 10:07:16 2008 From: gohman at apple.com (Dan Gohman) Date: Wed, 01 Oct 2008 15:07:16 -0000 Subject: [llvm-commits] [llvm] r56918 - /llvm/trunk/test/CodeGen/X86/all-ones-vector.ll Message-ID: <200810011507.m91F7GYY016813@zion.cs.uiuc.edu> Author: djg Date: Wed Oct 1 10:07:14 2008 New Revision: 56918 URL: http://llvm.org/viewvc/llvm-project?rev=56918&view=rev Log: nounwind-ify this test. Modified: llvm/trunk/test/CodeGen/X86/all-ones-vector.ll Modified: llvm/trunk/test/CodeGen/X86/all-ones-vector.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/all-ones-vector.ll?rev=56918&r1=56917&r2=56918&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/all-ones-vector.ll (original) +++ llvm/trunk/test/CodeGen/X86/all-ones-vector.ll Wed Oct 1 10:07:14 2008 @@ -1,14 +1,14 @@ ; RUN: llvm-as < %s | llc -march=x86 -mattr=sse2 | grep pcmpeqd | count 4 -define <4 x i32> @ioo() { +define <4 x i32> @ioo() nounwind { ret <4 x i32> } -define <2 x i64> @loo() { +define <2 x i64> @loo() nounwind { ret <2 x i64> } -define <2 x double> @doo() { +define <2 x double> @doo() nounwind { ret <2 x double> } -define <4 x float> @foo() { +define <4 x float> @foo() nounwind { ret <4 x float> } From gohman at apple.com Wed Oct 1 10:07:49 2008 From: gohman at apple.com (Dan Gohman) Date: Wed, 01 Oct 2008 15:07:49 -0000 Subject: [llvm-commits] [llvm] r56919 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200810011507.m91F7nSm016841@zion.cs.uiuc.edu> Author: djg Date: Wed Oct 1 10:07:49 2008 New Revision: 56919 URL: http://llvm.org/viewvc/llvm-project?rev=56919&view=rev Log: Fix typos in comments. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=56919&r1=56918&r2=56919&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Wed Oct 1 10:07:49 2008 @@ -163,7 +163,7 @@ /// ExpandOp - Expand the specified SDValue into its two component pieces /// Lo&Hi. Note that the Op MUST be an expanded type. As a result of this, - /// the LegalizeNodes map is filled in for any results that are not expanded, + /// the LegalizedNodes map is filled in for any results that are not expanded, /// the ExpandedNodes map is filled in for any results that are expanded, and /// the Lo/Hi values are returned. This applies to integer types and Vector /// types. @@ -5836,7 +5836,7 @@ /// ExpandOp - Expand the specified SDValue into its two component pieces /// Lo&Hi. Note that the Op MUST be an expanded type. As a result of this, the -/// LegalizeNodes map is filled in for any results that are not expanded, the +/// LegalizedNodes map is filled in for any results that are not expanded, the /// ExpandedNodes map is filled in for any results that are expanded, and the /// Lo/Hi values are returned. void SelectionDAGLegalize::ExpandOp(SDValue Op, SDValue &Lo, SDValue &Hi){ From gohman at apple.com Wed Oct 1 10:09:37 2008 From: gohman at apple.com (Dan Gohman) Date: Wed, 01 Oct 2008 15:09:37 -0000 Subject: [llvm-commits] [llvm] r56920 - /llvm/trunk/lib/VMCore/AsmWriter.cpp Message-ID: <200810011509.m91F9bnh016902@zion.cs.uiuc.edu> Author: djg Date: Wed Oct 1 10:09:37 2008 New Revision: 56920 URL: http://llvm.org/viewvc/llvm-project?rev=56920&view=rev Log: Don't prepend a space character for constants in Value::print. 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=56920&r1=56919&r2=56920&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original) +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Wed Oct 1 10:09:37 2008 @@ -1809,7 +1809,7 @@ AssemblyWriter W(OS, SlotTable, GV->getParent(), 0); W.write(GV); } else if (const Constant *C = dyn_cast(this)) { - OS << ' ' << C->getType()->getDescription() << ' '; + OS << C->getType()->getDescription() << ' '; std::map TypeTable; WriteConstantInt(OS, C, TypeTable, 0); } else if (const Argument *A = dyn_cast(this)) { From gohman at apple.com Wed Oct 1 10:11:19 2008 From: gohman at apple.com (Dan Gohman) Date: Wed, 01 Oct 2008 15:11:19 -0000 Subject: [llvm-commits] [llvm] r56921 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200810011511.m91FBKRR016966@zion.cs.uiuc.edu> Author: djg Date: Wed Oct 1 10:11:19 2008 New Revision: 56921 URL: http://llvm.org/viewvc/llvm-project?rev=56921&view=rev Log: Fold trivial two-operand tokenfactors where the operands are equal immediately. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=56921&r1=56920&r2=56921&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Wed Oct 1 10:11:19 2008 @@ -2320,6 +2320,7 @@ // Fold trivial token factors. if (N1.getOpcode() == ISD::EntryToken) return N2; if (N2.getOpcode() == ISD::EntryToken) return N1; + if (N1 == N2) return N1; break; case ISD::CONCAT_VECTORS: // A CONCAT_VECTOR with all operands BUILD_VECTOR can be simplified to From baldrick at free.fr Wed Oct 1 10:25:41 2008 From: baldrick at free.fr (Duncan Sands) Date: Wed, 01 Oct 2008 15:25:41 -0000 Subject: [llvm-commits] [llvm] r56922 - in /llvm/trunk: include/llvm/Value.h lib/Analysis/BasicAliasAnalysis.cpp lib/Analysis/IPA/GlobalsModRef.cpp lib/Transforms/Scalar/DeadStoreElimination.cpp lib/Transforms/Scalar/GVN.cpp lib/Transforms/Scalar/InstructionCombining.cpp lib/VMCore/Value.cpp Message-ID: <200810011525.m91FPgNQ017400@zion.cs.uiuc.edu> Author: baldrick Date: Wed Oct 1 10:25:41 2008 New Revision: 56922 URL: http://llvm.org/viewvc/llvm-project?rev=56922&view=rev Log: Factorize code: remove variants of "strip off pointer bitcasts and GEP's", and centralize the logic in Value::getUnderlyingObject. The difference with stripPointerCasts is that stripPointerCasts only strips GEPs if all indices are zero, while getUnderlyingObject strips GEPs no matter what the indices are. Modified: llvm/trunk/include/llvm/Value.h llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp llvm/trunk/lib/Analysis/IPA/GlobalsModRef.cpp llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp llvm/trunk/lib/Transforms/Scalar/GVN.cpp llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp llvm/trunk/lib/VMCore/Value.cpp Modified: llvm/trunk/include/llvm/Value.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Value.h?rev=56922&r1=56921&r2=56922&view=diff ============================================================================== --- llvm/trunk/include/llvm/Value.h (original) +++ llvm/trunk/include/llvm/Value.h Wed Oct 1 10:25:41 2008 @@ -228,11 +228,20 @@ /// stripPointerCasts - This method strips off any unneeded pointer /// casts from the specified value, returning the original uncasted value. - /// Note that the returned value is guaranteed to have pointer type. + /// Note that the returned value has pointer type if the specified value does. Value *stripPointerCasts(); const Value *stripPointerCasts() const { return const_cast(this)->stripPointerCasts(); } + + /// getUnderlyingObject - This method strips off any GEP address adjustments + /// and pointer casts from the specified value, returning the original object + /// being addressed. Note that the returned value has pointer type if the + /// specified value does. + Value *getUnderlyingObject(); + const Value *getUnderlyingObject() const { + return const_cast(this)->getUnderlyingObject(); + } }; inline std::ostream &operator<<(std::ostream &OS, const Value &V) { Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp?rev=56922&r1=56921&r2=56922&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp (original) +++ llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Wed Oct 1 10:25:41 2008 @@ -76,30 +76,6 @@ return false; } -/// getUnderlyingObject - This traverses the use chain to figure out what object -/// the specified value points to. If the value points to, or is derived from, -/// a unique object or an argument, return it. This returns: -/// Arguments, GlobalVariables, Functions, Allocas, Mallocs. -static const Value *getUnderlyingObject(const Value *V) { - if (!isa(V->getType())) return V; - - // If we are at some type of object, return it. GlobalValues and Allocations - // have unique addresses. - if (isa(V) || isa(V) || isa(V)) - return V; - - // Traverse through different addressing mechanisms... - if (const Instruction *I = dyn_cast(V)) { - if (isa(I) || isa(I)) - return getUnderlyingObject(I->getOperand(0)); - } else if (const ConstantExpr *CE = dyn_cast(V)) { - if (CE->getOpcode() == Instruction::BitCast || - CE->getOpcode() == Instruction::GetElementPtr) - return getUnderlyingObject(CE->getOperand(0)); - } - return V; -} - static const User *isGEP(const Value *V) { if (isa(V) || (isa(V) && @@ -314,7 +290,7 @@ /// global) or not. bool BasicAliasAnalysis::pointsToConstantMemory(const Value *P) { if (const GlobalVariable *GV = - dyn_cast(getUnderlyingObject(P))) + dyn_cast(P->getUnderlyingObject())) return GV->isConstant(); return false; } @@ -327,7 +303,7 @@ AliasAnalysis::ModRefResult BasicAliasAnalysis::getModRefInfo(CallSite CS, Value *P, unsigned Size) { if (!isa(P)) { - const Value *Object = getUnderlyingObject(P); + const Value *Object = P->getUnderlyingObject(); // If this is a tail call and P points to a stack location, we know that // the tail call cannot access or modify the local stack. @@ -390,8 +366,8 @@ return alias(V1, V1Size, I->getOperand(0), V2Size); // Figure out what objects these things are pointing to if we can... - const Value *O1 = getUnderlyingObject(V1); - const Value *O2 = getUnderlyingObject(V2); + const Value *O1 = V1->getUnderlyingObject(); + const Value *O2 = V2->getUnderlyingObject(); if (O1 != O2) { // If V1/V2 point to two different objects we know that we have no alias. Modified: llvm/trunk/lib/Analysis/IPA/GlobalsModRef.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/GlobalsModRef.cpp?rev=56922&r1=56921&r2=56922&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/IPA/GlobalsModRef.cpp (original) +++ llvm/trunk/lib/Analysis/IPA/GlobalsModRef.cpp Wed Oct 1 10:25:41 2008 @@ -157,29 +157,6 @@ Pass *llvm::createGlobalsModRefPass() { return new GlobalsModRef(); } -/// getUnderlyingObject - This traverses the use chain to figure out what object -/// the specified value points to. If the value points to, or is derived from, -/// a global object, return it. -static Value *getUnderlyingObject(Value *V) { - if (!isa(V->getType())) return V; - - // If we are at some type of object... return it. - if (GlobalValue *GV = dyn_cast(V)) return GV; - - // Traverse through different addressing mechanisms. - if (Instruction *I = dyn_cast(V)) { - if (isa(I) || isa(I)) - return getUnderlyingObject(I->getOperand(0)); - } else if (ConstantExpr *CE = dyn_cast(V)) { - if (CE->getOpcode() == Instruction::BitCast || - CE->getOpcode() == Instruction::GetElementPtr) - return getUnderlyingObject(CE->getOperand(0)); - } - - // Otherwise, we don't know what this is, return it as the base pointer. - return V; -} - /// AnalyzeGlobals - Scan through the users of all of the internal /// GlobalValue's in the program. If none of them have their "address taken" /// (really, their address passed to something nontrivial), record this fact, @@ -304,7 +281,7 @@ continue; // Check the value being stored. - Value *Ptr = getUnderlyingObject(SI->getOperand(0)); + Value *Ptr = SI->getOperand(0)->getUnderlyingObject(); if (isa(Ptr)) { // Okay, easy case. @@ -468,8 +445,8 @@ GlobalsModRef::alias(const Value *V1, unsigned V1Size, const Value *V2, unsigned V2Size) { // Get the base object these pointers point to. - Value *UV1 = getUnderlyingObject(const_cast(V1)); - Value *UV2 = getUnderlyingObject(const_cast(V2)); + Value *UV1 = const_cast(V1->getUnderlyingObject()); + Value *UV2 = const_cast(V2->getUnderlyingObject()); // If either of the underlying values is a global, they may be non-addr-taken // globals, which we can answer queries about. @@ -526,7 +503,7 @@ // If we are asking for mod/ref info of a direct call with a pointer to a // global we are tracking, return information if we have it. - if (GlobalValue *GV = dyn_cast(getUnderlyingObject(P))) + if (GlobalValue *GV = dyn_cast(P->getUnderlyingObject())) if (GV->hasInternalLinkage()) if (Function *F = CS.getCalledFunction()) if (NonAddressTakenGlobals.count(GV)) Modified: llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp?rev=56922&r1=56921&r2=56922&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp Wed Oct 1 10:25:41 2008 @@ -59,28 +59,7 @@ SetVector& possiblyDead); void DeleteDeadInstructionChains(Instruction *I, SetVector &DeadInsts); - - /// Find the base pointer that a pointer came from - /// Because this is used to find pointers that originate - /// from allocas, it is safe to ignore GEP indices, since - /// either the store will be in the alloca, and thus dead, - /// or beyond the end of the alloca, and thus undefined. - void TranslatePointerBitCasts(Value*& v, bool zeroGepsOnly = false) { - assert(isa(v->getType()) && - "Translating a non-pointer type?"); - while (true) { - if (BitCastInst* C = dyn_cast(v)) - v = C->getOperand(0); - else if (GetElementPtrInst* G = dyn_cast(v)) - if (!zeroGepsOnly || G->hasAllZeroIndices()) { - v = G->getOperand(0); - } else { - break; - } - else - break; - } - } + // getAnalysisUsage - We require post dominance frontiers (aka Control // Dependence Graph) @@ -119,20 +98,20 @@ // If we find a store or a free... if (!isa(BBI) && !isa(BBI)) continue; - + Value* pointer = 0; if (StoreInst* S = dyn_cast(BBI)) { - if (!S->isVolatile()) - pointer = S->getPointerOperand(); - else + if (S->isVolatile()) continue; - } else + pointer = S->getPointerOperand(); + } else { pointer = cast(BBI)->getPointerOperand(); - - TranslatePointerBitCasts(pointer, true); + } + + pointer = pointer->stripPointerCasts(); StoreInst*& last = lastStore[pointer]; bool deletedStore = false; - + // ... to a pointer that has been stored to before... if (last) { Instruction* dep = MD.getDependency(BBI); @@ -302,10 +281,9 @@ // If we find a store whose pointer is dead... if (StoreInst* S = dyn_cast(BBI)) { if (!S->isVolatile()) { - Value* pointerOperand = S->getPointerOperand(); // See through pointer-to-pointer bitcasts - TranslatePointerBitCasts(pointerOperand); - + Value* pointerOperand = S->getPointerOperand()->getUnderlyingObject(); + // Alloca'd pointers or byval arguments (which are functionally like // alloca's) are valid candidates for removal. if (deadPointers.count(pointerOperand)) { @@ -330,9 +308,8 @@ // We can also remove memcpy's to local variables at the end of a function } else if (MemCpyInst* M = dyn_cast(BBI)) { - Value* dest = M->getDest(); - TranslatePointerBitCasts(dest); - + Value* dest = M->getDest()->getUnderlyingObject(); + if (deadPointers.count(dest)) { MD.removeInstruction(M); @@ -480,9 +457,9 @@ if (!killPointer) continue; - - TranslatePointerBitCasts(killPointer); - + + killPointer = killPointer->getUnderlyingObject(); + // Deal with undead pointers MadeChange |= RemoveUndeadPointers(killPointer, killPointerSize, BBI, deadPointers, possiblyDead); Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVN.cpp?rev=56922&r1=56921&r2=56922&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/GVN.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/GVN.cpp Wed Oct 1 10:25:41 2008 @@ -992,16 +992,7 @@ isa(dep)) { // Check that this load is actually from the // allocation we found - Value* v = L->getOperand(0); - while (true) { - if (BitCastInst *BC = dyn_cast(v)) - v = BC->getOperand(0); - else if (GetElementPtrInst *GEP = dyn_cast(v)) - v = GEP->getOperand(0); - else - break; - } - if (v == dep) { + if (L->getOperand(0)->getUnderlyingObject() == dep) { // If this load depends directly on an allocation, there isn't // anything stored there; therefore, we can optimize this load // to undef. Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=56922&r1=56921&r2=56922&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Wed Oct 1 10:25:41 2008 @@ -10367,28 +10367,6 @@ return false; } -/// GetUnderlyingObject - Trace through a series of getelementptrs and bitcasts -/// until we find the underlying object a pointer is referring to or something -/// we don't understand. Note that the returned pointer may be offset from the -/// input, because we ignore GEP indices. -static Value *GetUnderlyingObject(Value *Ptr) { - while (1) { - if (ConstantExpr *CE = dyn_cast(Ptr)) { - if (CE->getOpcode() == Instruction::BitCast || - CE->getOpcode() == Instruction::GetElementPtr) - Ptr = CE->getOperand(0); - else - return Ptr; - } else if (BitCastInst *BCI = dyn_cast(Ptr)) { - Ptr = BCI->getOperand(0); - } else if (GetElementPtrInst *GEP = dyn_cast(Ptr)) { - Ptr = GEP->getOperand(0); - } else { - return Ptr; - } - } -} - Instruction *InstCombiner::visitLoadInst(LoadInst &LI) { Value *Op = LI.getOperand(0); @@ -10479,7 +10457,7 @@ // If this load comes from anywhere in a constant global, and if the global // is all undef or zero, we know what it loads. - if (GlobalVariable *GV = dyn_cast(GetUnderlyingObject(Op))) { + if (GlobalVariable *GV = dyn_cast(Op->getUnderlyingObject())){ if (GV->isConstant() && GV->hasInitializer()) { if (GV->getInitializer()->isNullValue()) return ReplaceInstUsesWith(LI, Constant::getNullValue(LI.getType())); Modified: llvm/trunk/lib/VMCore/Value.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Value.cpp?rev=56922&r1=56921&r2=56922&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Value.cpp (original) +++ llvm/trunk/lib/VMCore/Value.cpp Wed Oct 1 10:25:41 2008 @@ -322,22 +322,20 @@ } Value *Value::stripPointerCasts() { + if (!isa(getType())) + return this; + if (ConstantExpr *CE = dyn_cast(this)) { if (CE->getOpcode() == Instruction::BitCast) { - if (isa(CE->getOperand(0)->getType())) - return CE->getOperand(0)->stripPointerCasts(); + return CE->getOperand(0)->stripPointerCasts(); } else if (CE->getOpcode() == Instruction::GetElementPtr) { for (unsigned i = 1, e = CE->getNumOperands(); i != e; ++i) if (!CE->getOperand(i)->isNullValue()) return this; return CE->getOperand(0)->stripPointerCasts(); } - return this; - } - - if (BitCastInst *CI = dyn_cast(this)) { - if (isa(CI->getOperand(0)->getType())) - return CI->getOperand(0)->stripPointerCasts(); + } else if (BitCastInst *CI = dyn_cast(this)) { + return CI->getOperand(0)->stripPointerCasts(); } else if (GetElementPtrInst *GEP = dyn_cast(this)) { if (GEP->hasAllZeroIndices()) return GEP->getOperand(0)->stripPointerCasts(); @@ -345,6 +343,21 @@ return this; } +Value *Value::getUnderlyingObject() { + if (!isa(getType())) + return this; + + if (Instruction *I = dyn_cast(this)) { + if (isa(I) || isa(I)) + return I->getOperand(0)->getUnderlyingObject(); + } else if (ConstantExpr *CE = dyn_cast(this)) { + if (CE->getOpcode() == Instruction::BitCast || + CE->getOpcode() == Instruction::GetElementPtr) + return CE->getOperand(0)->getUnderlyingObject(); + } + return this; +} + //===----------------------------------------------------------------------===// // User Class //===----------------------------------------------------------------------===// From gohman at apple.com Wed Oct 1 10:51:04 2008 From: gohman at apple.com (Dan Gohman) Date: Wed, 1 Oct 2008 08:51:04 -0700 (PDT) Subject: [llvm-commits] [llvm] r56910 - /llvm/trunk/test/Assembler/2008-09-02-FunctionNotes2.ll In-Reply-To: <200810011027.29322.baldrick@free.fr> References: <200810010413.m914DOEw019513@zion.cs.uiuc.edu> <200810011027.29322.baldrick@free.fr> Message-ID: <47518.76.220.41.203.1222876264.squirrel@webmail.apple.com> On Wed, October 1, 2008 1:27 am, Duncan Sands wrote: > How about > >> -; RUN: not llvm-as %s |& grep "only one inline note" >> +; RUN: not llvm-as %s -o /dev/null -f |& grep "only one inline note" > > not llvm-as < %s |& grep "only one inline note" > > (untested)? *shrug*, then the grep potentially examines regular llvm-as output, though it's quite unlikely to matter. Dan From gohman at apple.com Wed Oct 1 11:08:59 2008 From: gohman at apple.com (Dan Gohman) Date: Wed, 1 Oct 2008 09:08:59 -0700 (PDT) Subject: [llvm-commits] [llvm] r56911 - in /llvm/trunk/lib/Target/X86: X86Instr64bit.td X86InstrInfo.td In-Reply-To: <7B9BECB8-CD62-40B6-841A-78BF78F4700C@apple.com> References: <200810010414.m914EUap019549@zion.cs.uiuc.edu> <7B9BECB8-CD62-40B6-841A-78BF78F4700C@apple.com> Message-ID: <37357.76.220.41.203.1222877339.squirrel@webmail.apple.com> Yes. Sorry for the terse commit message. It fixes a DeadMachineInstructionElim bug, where it was deleting stack-pointer assignments because they appeared to be dead. Neither bugpoint or I were able to reduce the testcase, but the problem is visible in 403.gcc on x86-64. Dan On Tue, September 30, 2008 9:35 pm, Evan Cheng wrote: > Is this fixing a fast-isel bug? > > Evan > > On Sep 30, 2008, at 9:14 PM, Dan Gohman wrote: > >> Author: djg >> Date: Tue Sep 30 23:14:30 2008 >> New Revision: 56911 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=56911&view=rev >> Log: >> Mark CALL instructions as having a Use of ESP/RSP. >> >> Modified: >> llvm/trunk/lib/Target/X86/X86Instr64bit.td >> llvm/trunk/lib/Target/X86/X86InstrInfo.td >> >> Modified: llvm/trunk/lib/Target/X86/X86Instr64bit.td >> URL: >> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Instr64bit.td?rev=56911&r1=56910&r2=56911&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/X86/X86Instr64bit.td (original) >> +++ llvm/trunk/lib/Target/X86/X86Instr64bit.td Tue Sep 30 23:14:30 >> 2008 >> @@ -95,7 +95,8 @@ >> FP0, FP1, FP2, FP3, FP4, FP5, FP6, ST0, ST1, >> MM0, MM1, MM2, MM3, MM4, MM5, MM6, MM7, >> XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, >> - XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15, >> EFLAGS] in { >> + XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15, >> EFLAGS], >> + Uses = [RSP] in { >> def CALL64pcrel32 : I<0xE8, RawFrm, (outs), (ins i64imm:$dst, >> variable_ops), >> "call\t${dst:call}", []>; >> def CALL64r : I<0xFF, MRM2r, (outs), (ins GR64:$dst, >> variable_ops), >> >> Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td >> URL: >> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=56911&r1=56910&r2=56911&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original) >> +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Tue Sep 30 23:14:30 2008 >> @@ -334,7 +334,7 @@ >> def NOOP : I<0x90, RawFrm, (outs), (ins), "nop", []>; >> >> // PIC base >> -let neverHasSideEffects = 1, isNotDuplicable = 1 in >> +let neverHasSideEffects = 1, isNotDuplicable = 1, Uses = [ESP] in >> def MOVPC32r : Ii32<0xE8, Pseudo, (outs GR32:$reg), (ins piclabel: >> $label), >> "call\t$label\n\tpop{l}\t$reg", []>; >> >> @@ -414,7 +414,8 @@ >> // All calls clobber the non-callee saved registers... >> let Defs = [EAX, ECX, EDX, FP0, FP1, FP2, FP3, FP4, FP5, FP6, ST0, >> MM0, MM1, MM2, MM3, MM4, MM5, MM6, MM7, >> - XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, >> EFLAGS] in { >> + XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, >> EFLAGS], >> + Uses = [ESP] in { >> def CALLpcrel32 : Ii32<0xE8, RawFrm, (outs), (ins i32imm: >> $dst,variable_ops), >> "call\t${dst:call}", []>; >> def CALL32r : I<0xFF, MRM2r, (outs), (ins GR32:$dst, >> variable_ops), >> >> >> _______________________________________________ >> 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 dpatel at apple.com Wed Oct 1 11:17:12 2008 From: dpatel at apple.com (Devang Patel) Date: Wed, 1 Oct 2008 09:17:12 -0700 Subject: [llvm-commits] r55638 - /llvm/trunk/include/llvm/Function.h In-Reply-To: <200810010954.26247.baldrick@free.fr> References: <200809231027.53858.baldrick@free.fr> <200809300939.38971.baldrick@free.fr> <200810010954.26247.baldrick@free.fr> Message-ID: On Oct 1, 2008, at 12:54 AM, Duncan Sands wrote: > On Tuesday 30 September 2008 18:28:58 Devang Patel wrote: >> >> On Sep 30, 2008, at 12:39 AM, Duncan Sands wrote: >> >>>> Ignore inliner for a while, and decide what code generator should >>>> do >>>> for following ? >>>> >>>> define float @foo(float %a, float %b) x86_no_sse { >>>> %t = mul float %a, %b >>>> ret float %t >>>> } >>> >>> It would use the x86 floating point stack, like it does now >>> if you compile with -mattr=-sse. This is less efficient than >>> using sse. >> >> So, I guess you answered your question. > > So what you are saying is: if function A is marked no-sse, > and it calls function B which is marked sse, than B will > not be inlined into A if B contains any floating point > operations (for example, a fp multiplication)? Yes, if performance is important, otherwise let it use less efficient floating point stack. So this is a policy decision. I understand that you want inliner to not inline B into A in this case. - Devang From evan.cheng at apple.com Wed Oct 1 11:46:41 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 1 Oct 2008 09:46:41 -0700 Subject: [llvm-commits] [llvm] r56911 - in /llvm/trunk/lib/Target/X86: X86Instr64bit.td X86InstrInfo.td In-Reply-To: <37357.76.220.41.203.1222877339.squirrel@webmail.apple.com> References: <200810010414.m914EUap019549@zion.cs.uiuc.edu> <7B9BECB8-CD62-40B6-841A-78BF78F4700C@apple.com> <37357.76.220.41.203.1222877339.squirrel@webmail.apple.com> Message-ID: <1FE96F18-A96E-44F4-8EC9-8C82C38BA65A@apple.com> Hmmm. There could be more bugs of the kind. Any instruction that touches a non-allocatable register should not be deleted. If your DCE is not checking that, then we need to make sure all instructions that touch esp, etc. should mark these uses. Evan On Oct 1, 2008, at 9:08 AM, Dan Gohman wrote: > Yes. Sorry for the terse commit message. It fixes > a DeadMachineInstructionElim bug, where it was deleting > stack-pointer assignments because they appeared to be dead. > Neither bugpoint or I were able to reduce the testcase, > but the problem is visible in 403.gcc on x86-64. > > Dan > > On Tue, September 30, 2008 9:35 pm, Evan Cheng wrote: >> Is this fixing a fast-isel bug? >> >> Evan >> >> On Sep 30, 2008, at 9:14 PM, Dan Gohman wrote: >> >>> Author: djg >>> Date: Tue Sep 30 23:14:30 2008 >>> New Revision: 56911 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=56911&view=rev >>> Log: >>> Mark CALL instructions as having a Use of ESP/RSP. >>> >>> Modified: >>> llvm/trunk/lib/Target/X86/X86Instr64bit.td >>> llvm/trunk/lib/Target/X86/X86InstrInfo.td >>> >>> Modified: llvm/trunk/lib/Target/X86/X86Instr64bit.td >>> URL: >>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Instr64bit.td?rev=56911&r1=56910&r2=56911&view=diff >>> >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> ==================================================================== >>> --- llvm/trunk/lib/Target/X86/X86Instr64bit.td (original) >>> +++ llvm/trunk/lib/Target/X86/X86Instr64bit.td Tue Sep 30 23:14:30 >>> 2008 >>> @@ -95,7 +95,8 @@ >>> FP0, FP1, FP2, FP3, FP4, FP5, FP6, ST0, ST1, >>> MM0, MM1, MM2, MM3, MM4, MM5, MM6, MM7, >>> XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, >>> - XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15, >>> EFLAGS] in { >>> + XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15, >>> EFLAGS], >>> + Uses = [RSP] in { >>> def CALL64pcrel32 : I<0xE8, RawFrm, (outs), (ins i64imm:$dst, >>> variable_ops), >>> "call\t${dst:call}", []>; >>> def CALL64r : I<0xFF, MRM2r, (outs), (ins GR64:$dst, >>> variable_ops), >>> >>> Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td >>> URL: >>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=56911&r1=56910&r2=56911&view=diff >>> >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> ==================================================================== >>> --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original) >>> +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Tue Sep 30 23:14:30 >>> 2008 >>> @@ -334,7 +334,7 @@ >>> def NOOP : I<0x90, RawFrm, (outs), (ins), "nop", []>; >>> >>> // PIC base >>> -let neverHasSideEffects = 1, isNotDuplicable = 1 in >>> +let neverHasSideEffects = 1, isNotDuplicable = 1, Uses = [ESP] in >>> def MOVPC32r : Ii32<0xE8, Pseudo, (outs GR32:$reg), (ins piclabel: >>> $label), >>> "call\t$label\n\tpop{l}\t$reg", []>; >>> >>> @@ -414,7 +414,8 @@ >>> // All calls clobber the non-callee saved registers... >>> let Defs = [EAX, ECX, EDX, FP0, FP1, FP2, FP3, FP4, FP5, FP6, ST0, >>> MM0, MM1, MM2, MM3, MM4, MM5, MM6, MM7, >>> - XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, >>> EFLAGS] in { >>> + XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, >>> EFLAGS], >>> + Uses = [ESP] in { >>> def CALLpcrel32 : Ii32<0xE8, RawFrm, (outs), (ins i32imm: >>> $dst,variable_ops), >>> "call\t${dst:call}", []>; >>> def CALL32r : I<0xFF, MRM2r, (outs), (ins GR32:$dst, >>> variable_ops), >>> >>> >>> _______________________________________________ >>> 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 anton at korobeynikov.info Wed Oct 1 11:49:18 2008 From: anton at korobeynikov.info (Anton Korobeynikov) Date: Wed, 1 Oct 2008 20:49:18 +0400 Subject: [llvm-commits] [llvm-gcc-4.2] r56905 - in /llvm-gcc-4.2/trunk/gcc: c-common.c config/i386/darwin.h config/rs6000/darwin.h In-Reply-To: <200810010126.m911QN9V014467@zion.cs.uiuc.edu> References: <200810010126.m911QN9V014467@zion.cs.uiuc.edu> Message-ID: Hi, Devang > Fix newbie hack that attempted to enable format security warnings by default on darwin platform. These patches causes breakage of llvm-gcc compilation on non-Darwin platform. The problem is seen during libiberty compilation: configure does not find stdlib.h and also other .h files. The corresponding lines in config.log: configure:3691: checking for stdlib.h configure:3704: /home/asl/proj/llvm/llvm-gcc-4.2/build/./prev-gcc/xgcc -B/home/asl/proj/llvm/llvm-gcc-4.2/build/./prev-gcc/ -B/home/asl/proj/llvm/llvm-gcc-4.2/install/x86_64-unknown-linux-gnu/bin/ -E conftest.c cc1: warning: -Wformat-security ignored without -Wformat configure:3710: $? = 0 configure: failed program was: | /* confdefs.h. */ | | #define PACKAGE_NAME "" | #define PACKAGE_TARNAME "" | #define PACKAGE_VERSION "" | #define PACKAGE_STRING "" | #define PACKAGE_BUGREPORT "" | /* end confdefs.h. */ | #include Please investigate -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University From gohman at apple.com Wed Oct 1 12:34:42 2008 From: gohman at apple.com (Dan Gohman) Date: Wed, 1 Oct 2008 10:34:42 -0700 Subject: [llvm-commits] [llvm] r56911 - in /llvm/trunk/lib/Target/X86: X86Instr64bit.td X86InstrInfo.td In-Reply-To: <1FE96F18-A96E-44F4-8EC9-8C82C38BA65A@apple.com> References: <200810010414.m914EUap019549@zion.cs.uiuc.edu> <7B9BECB8-CD62-40B6-841A-78BF78F4700C@apple.com> <37357.76.220.41.203.1222877339.squirrel@webmail.apple.com> <1FE96F18-A96E-44F4-8EC9-8C82C38BA65A@apple.com> Message-ID: <2F4C5B46-0191-4EFB-AB4F-3203329AB19F@apple.com> On Oct 1, 2008, at 9:46 AM, Evan Cheng wrote: > Hmmm. There could be more bugs of the kind. Any instruction that > touches a non-allocatable register should not be deleted. The problem with this approach is EFLAGS. It's non-allocatable, but treating it as always live means that DCE doesn't end up eliminating almost anything. > If your DCE > is not checking that, then we need to make sure all instructions that > touch esp, etc. should mark these uses. All the PUSHes and POPs are already marked, as are ADJCALLSTACKDOWN, and ADJCALLSTACKUP. Not all the terminator instructions are marked, but I guess it's implicitly assumed that ESP/RSP are always live-out. DeadMachineInstructionElim currently assumes that all non-allocatable registers are live-out, so it currently doesn't care. Are there others? Dan From asl at math.spbu.ru Wed Oct 1 12:38:42 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Wed, 01 Oct 2008 17:38:42 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r56923 - in /llvm-gcc-4.2/trunk/gcc: c-common.c config/i386/darwin.h config/rs6000/darwin.h llvm-backend.cpp llvm-convert.cpp Message-ID: <200810011738.m91Hcg98021726@zion.cs.uiuc.edu> Author: asl Date: Wed Oct 1 12:38:40 2008 New Revision: 56923 URL: http://llvm.org/viewvc/llvm-project?rev=56923&view=rev Log: Temporary back out r56905, r56903 and r 56883. This restores llvm-gcc build on non-darwin platforms as well as Fortran and ADA frontends. Modified: llvm-gcc-4.2/trunk/gcc/c-common.c llvm-gcc-4.2/trunk/gcc/config/i386/darwin.h llvm-gcc-4.2/trunk/gcc/config/rs6000/darwin.h llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Modified: llvm-gcc-4.2/trunk/gcc/c-common.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-common.c?rev=56923&r1=56922&r2=56923&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/c-common.c (original) +++ llvm-gcc-4.2/trunk/gcc/c-common.c Wed Oct 1 12:38:40 2008 @@ -302,7 +302,8 @@ /* Warn about format/argument anomalies in calls to formatted I/O functions (*printf, *scanf, strftime, strfmon, etc.). */ -int warn_format; +/* APPLE LOCAL default to Wformat-security 5764921 */ +int warn_format = 1; /* Warn about using __null (as NULL in C++) as sentinel. For code compiled with GCC this doesn't matter as __null is guaranteed to have the right Modified: llvm-gcc-4.2/trunk/gcc/config/i386/darwin.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/darwin.h?rev=56923&r1=56922&r2=56923&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/i386/darwin.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/i386/darwin.h Wed Oct 1 12:38:40 2008 @@ -101,8 +101,6 @@ %{!mmacosx-version-min=*: %{!miphoneos-version-min=*: %(darwin_cc1_minversion)}} \ "/* APPLE LOCAL ignore -mcpu=G4 -mcpu=G5 */"\ %getOrInsertFunction("memcpy", SBP, SBP, SBP, - IntPtr, (Type*)0), - Ops, Ops + 3); - } + Intrinsic::ID IID = + (IntPtr == Type::Int32Ty) ? Intrinsic::memcpy_i32 : Intrinsic::memcpy_i64; + Builder.CreateCall(Intrinsic::getDeclaration(TheModule, IID), Ops, Ops+4); } void TreeToLLVM::EmitMemMove(Value *DestPtr, Value *SrcPtr, Value *Size, @@ -1493,16 +1486,9 @@ ConstantInt::get(Type::Int32Ty, Align) }; - if (!flag_no_builtin && !builtin_function_disabled_p("memmove")) { - Intrinsic::ID IID = - (IntPtr == Type::Int32Ty) ? - Intrinsic::memmove_i32 : Intrinsic::memmove_i64; - Builder.CreateCall(Intrinsic::getDeclaration(TheModule, IID), Ops, Ops + 4); - } else { - Builder.CreateCall(TheModule->getOrInsertFunction("memmove", SBP, SBP, SBP, - IntPtr, (Type*)0), - Ops, Ops + 3); - } + Intrinsic::ID IID = + (IntPtr == Type::Int32Ty) ? Intrinsic::memmove_i32 : Intrinsic::memmove_i64; + Builder.CreateCall(Intrinsic::getDeclaration(TheModule, IID), Ops, Ops+4); } void TreeToLLVM::EmitMemSet(Value *DestPtr, Value *SrcVal, Value *Size, @@ -1516,18 +1502,13 @@ ConstantInt::get(Type::Int32Ty, Align) }; - if (!flag_no_builtin && !builtin_function_disabled_p("memset")) { - Intrinsic::ID IID = - (IntPtr == Type::Int32Ty) ? Intrinsic::memset_i32 : Intrinsic::memset_i64; - Builder.CreateCall(Intrinsic::getDeclaration(TheModule, IID), Ops, Ops + 4); - } else { - Builder.CreateCall(TheModule->getOrInsertFunction("memset", SBP, SBP, - Type::Int8Ty, IntPtr, - (Type*)0), - Ops, Ops + 3); - } + Intrinsic::ID IID = + (IntPtr == Type::Int32Ty) ? Intrinsic::memset_i32 : Intrinsic::memset_i64; + + Builder.CreateCall(Intrinsic::getDeclaration(TheModule, IID), Ops, Ops+4); } + // Emits code to do something for a type attribute void TreeToLLVM::EmitTypeGcroot(Value *V, tree decl) { // GC intrinsics can only be used in functions which specify a collector. @@ -5058,88 +5039,24 @@ } bool TreeToLLVM::EmitBuiltinUnaryOp(Value *InVal, Value *&Result, - Intrinsic::ID Id) { + Intrinsic::ID Id) { // The intrinsic might be overloaded in which case the argument is of // varying type. Make sure that we specify the actual type for "iAny" // by passing it as the 3rd and 4th parameters. This isn't needed for // most intrinsics, but is needed for ctpop, cttz, ctlz. const Type *Ty = InVal->getType(); - const char *Name = 0; - -#define CASE(ID, NAME) \ - case Intrinsic::ID: \ - if (flag_no_builtin || builtin_function_disabled_p(NAME)) \ - Name = NAME; \ - break - - if (Ty == Type::DoubleTy) { - switch (Id) { - default: break; - CASE(log, "log"); - CASE(log2, "log2"); - CASE(log10, "log10"); - CASE(exp, "exp"); - CASE(exp2, "exp2"); - } - } else if (Ty == Type::FloatTy) { - switch (Id) { - default: break; - CASE(log, "logf"); - CASE(log2, "log2f"); - CASE(log10, "log10f"); - CASE(exp, "expf"); - CASE(exp2, "exp2f"); - } - } else { - switch (Id) { - default: break; - CASE(log, "logl"); - CASE(log2, "log2l"); - CASE(log10, "log10l"); - CASE(exp, "expl"); - CASE(exp2, "exp2l"); - } - } - -#undef CASE - - if (!Name) - Result = Builder.CreateCall(Intrinsic::getDeclaration(TheModule, Id, - &Ty, 1), - InVal); - else - Result = Builder.CreateCall(TheModule->getOrInsertFunction(Name, Ty, Ty, - NULL), - InVal); - + Result = Builder.CreateCall(Intrinsic::getDeclaration(TheModule, Id, &Ty, 1), + InVal); return true; } Value *TreeToLLVM::EmitBuiltinSQRT(tree exp) { Value *Amt = Emit(TREE_VALUE(TREE_OPERAND(exp, 1)), 0); const Type* Ty = Amt->getType(); - const char *Name = 0; - - if (Ty == Type::DoubleTy) { - if (flag_no_builtin || builtin_function_disabled_p("sqrt")) - Name = "sqrt"; - } else if (Ty == Type::FloatTy) { - if (flag_no_builtin || builtin_function_disabled_p("sqrtf")) - Name = "sqrtf"; - } else { - if (flag_no_builtin || builtin_function_disabled_p("sqrtl")) - Name = "sqrtl"; - } - - if (!Name) - return Builder.CreateCall(Intrinsic::getDeclaration(TheModule, - Intrinsic::sqrt, - &Ty, 1), - Amt); - else - return Builder.CreateCall(TheModule->getOrInsertFunction(Name, Ty, Ty, - NULL), - Amt); + + return Builder.CreateCall(Intrinsic::getDeclaration(TheModule, + Intrinsic::sqrt, &Ty, 1), + Amt); } Value *TreeToLLVM::EmitBuiltinPOWI(tree exp) { @@ -5155,30 +5072,9 @@ SmallVector Args; Args.push_back(Val); Args.push_back(Pow); - - const char *Name = 0; - - if (Ty == Type::DoubleTy) { - if (flag_no_builtin || builtin_function_disabled_p("powi")) - Name = "powi"; - } else if (Ty == Type::FloatTy) { - if (flag_no_builtin || builtin_function_disabled_p("powif")) - Name = "powif"; - } else { - if (flag_no_builtin || builtin_function_disabled_p("powil")) - Name = "powil"; - } - - if (!Name) - return Builder.CreateCall(Intrinsic::getDeclaration(TheModule, - Intrinsic::powi, - &Ty, 1), - Args.begin(), Args.end()); - else - return Builder.CreateCall(TheModule->getOrInsertFunction(Name, Ty, Ty, - Type::Int32Ty, - NULL), - Args.begin(), Args.end()); + return Builder.CreateCall(Intrinsic::getDeclaration(TheModule, + Intrinsic::powi, &Ty, 1), + Args.begin(), Args.end()); } Value *TreeToLLVM::EmitBuiltinPOW(tree exp) { @@ -5193,29 +5089,9 @@ SmallVector Args; Args.push_back(Val); Args.push_back(Pow); - - const char *Name = 0; - - if (Ty == Type::DoubleTy) { - if (flag_no_builtin || builtin_function_disabled_p("pow")) - Name = "pow"; - } else if (Ty == Type::FloatTy) { - if (flag_no_builtin || builtin_function_disabled_p("powf")) - Name = "powf"; - } else { - if (flag_no_builtin || builtin_function_disabled_p("powl")) - Name = "powl"; - } - - if (!Name) - return Builder.CreateCall(Intrinsic::getDeclaration(TheModule, - Intrinsic::pow, &Ty, 1), - Args.begin(), Args.end()); - else - return Builder.CreateCall(TheModule->getOrInsertFunction(Name, Ty, Ty, - Type::Int32Ty, - NULL), - Args.begin(), Args.end()); + return Builder.CreateCall(Intrinsic::getDeclaration(TheModule, + Intrinsic::pow, &Ty, 1), + Args.begin(), Args.end()); } bool TreeToLLVM::EmitBuiltinConstantP(tree exp, Value *&Result) { From evan.cheng at apple.com Wed Oct 1 13:08:14 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 1 Oct 2008 11:08:14 -0700 Subject: [llvm-commits] [llvm] r56911 - in /llvm/trunk/lib/Target/X86: X86Instr64bit.td X86InstrInfo.td In-Reply-To: <2F4C5B46-0191-4EFB-AB4F-3203329AB19F@apple.com> References: <200810010414.m914EUap019549@zion.cs.uiuc.edu> <7B9BECB8-CD62-40B6-841A-78BF78F4700C@apple.com> <37357.76.220.41.203.1222877339.squirrel@webmail.apple.com> <1FE96F18-A96E-44F4-8EC9-8C82C38BA65A@apple.com> <2F4C5B46-0191-4EFB-AB4F-3203329AB19F@apple.com> Message-ID: <999F8683-BF0A-4D5F-9750-D25EAA79B1B8@apple.com> On Oct 1, 2008, at 10:34 AM, Dan Gohman wrote: > On Oct 1, 2008, at 9:46 AM, Evan Cheng wrote: > >> Hmmm. There could be more bugs of the kind. Any instruction that >> touches a non-allocatable register should not be deleted. > > The problem with this approach is EFLAGS. It's non-allocatable, > but treating it as always live means that DCE doesn't end up > eliminating almost anything. Ok. > > >> If your DCE >> is not checking that, then we need to make sure all instructions that >> touch esp, etc. should mark these uses. > > All the PUSHes and POPs are already marked, as are > ADJCALLSTACKDOWN, and ADJCALLSTACKUP. > > Not all the terminator instructions are marked, but I guess it's > implicitly assumed that ESP/RSP are always live-out. > DeadMachineInstructionElim currently assumes that all non-allocatable > registers are live-out, so it currently doesn't care. Might as well mark RET etc. as ESP users for consistency sake? > > > Are there others? Not on x86 as far as I can tell. Evan > > > Dan > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From tomas.l.olsen at gmail.com Wed Oct 1 13:06:48 2008 From: tomas.l.olsen at gmail.com (Tomas Lindquist Olsen) Date: Wed, 1 Oct 2008 20:06:48 +0200 Subject: [llvm-commits] patch for Type::dump taking Module context for symbolic typename resolution (or whatever) Message-ID: <7aa9f8a40810011106p78cbdcfclce5f31df03bfc446@mail.gmail.com> Hi folks I had some issues with Type::dump taking more than 15 minutes (in fact I didn't have patience to wait longer than that) during debugging. This patch adds support for Type::dump taking a Module context so type names can be resolved and used, taking the time down to less than a second. Hope this can get in 2.4 as it's really, really, useful for us, some of the types we generate are huge when fully unfolded. but usually not more than a single name if not ... -Tomas -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20081001/34caca53/attachment.html -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: typedump.diff Url: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20081001/34caca53/attachment.pl From anton at korobeynikov.info Wed Oct 1 13:14:42 2008 From: anton at korobeynikov.info (Anton Korobeynikov) Date: Wed, 1 Oct 2008 22:14:42 +0400 Subject: [llvm-commits] [llvm] r56911 - in /llvm/trunk/lib/Target/X86: X86Instr64bit.td X86InstrInfo.td In-Reply-To: <999F8683-BF0A-4D5F-9750-D25EAA79B1B8@apple.com> References: <200810010414.m914EUap019549@zion.cs.uiuc.edu> <7B9BECB8-CD62-40B6-841A-78BF78F4700C@apple.com> <37357.76.220.41.203.1222877339.squirrel@webmail.apple.com> <1FE96F18-A96E-44F4-8EC9-8C82C38BA65A@apple.com> <2F4C5B46-0191-4EFB-AB4F-3203329AB19F@apple.com> <999F8683-BF0A-4D5F-9750-D25EAA79B1B8@apple.com> Message-ID: > Not on x86 as far as I can tell. Don't forget such beasts like eh_return, which modifies esp explicitly. :) -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University From grosbach at apple.com Wed Oct 1 13:16:49 2008 From: grosbach at apple.com (Jim Grosbach) Date: Wed, 01 Oct 2008 18:16:49 -0000 Subject: [llvm-commits] [llvm] r56924 - /llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp Message-ID: <200810011816.m91IGnjd023047@zion.cs.uiuc.edu> Author: grosbach Date: Wed Oct 1 13:16:49 2008 New Revision: 56924 URL: http://llvm.org/viewvc/llvm-project?rev=56924&view=rev Log: Fix typo s/ther/there/ Modified: llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp Modified: llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp?rev=56924&r1=56923&r2=56924&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp Wed Oct 1 13:16:49 2008 @@ -390,7 +390,7 @@ ++OpIdx; } - // Encode first non-shifter register operand if ther is one. + // Encode first non-shifter register operand if there is one. unsigned Format = TID.TSFlags & ARMII::FormMask; bool isUnary = (Format == ARMII::DPRdMisc || Format == ARMII::DPRdIm || From gohman at apple.com Wed Oct 1 13:28:07 2008 From: gohman at apple.com (Dan Gohman) Date: Wed, 01 Oct 2008 18:28:07 -0000 Subject: [llvm-commits] [llvm] r56925 - in /llvm/trunk/lib/Target/X86: X86FastISel.cpp X86Instr64bit.td X86InstrInfo.td X86RegisterInfo.cpp Message-ID: <200810011828.m91IS7XE023451@zion.cs.uiuc.edu> Author: djg Date: Wed Oct 1 13:28:06 2008 New Revision: 56925 URL: http://llvm.org/viewvc/llvm-project?rev=56925&view=rev Log: Split x86's ADJCALLSTACK instructions into 32-bit and 64-bit forms. This allows the 64-bit forms to use+def RSP instead of ESP. This doesn't fix any real bugs today, but it is more precise and it makes the debug dumps on x86-64 look more consistent. Also, add some comments describing the CALL instructions' physreg operand uses and defs. Modified: llvm/trunk/lib/Target/X86/X86FastISel.cpp llvm/trunk/lib/Target/X86/X86Instr64bit.td llvm/trunk/lib/Target/X86/X86InstrInfo.td llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Modified: llvm/trunk/lib/Target/X86/X86FastISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FastISel.cpp?rev=56925&r1=56924&r2=56925&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86FastISel.cpp (original) +++ llvm/trunk/lib/Target/X86/X86FastISel.cpp Wed Oct 1 13:28:06 2008 @@ -960,7 +960,8 @@ unsigned NumBytes = CCInfo.getNextStackOffset(); // Issue CALLSEQ_START - BuildMI(MBB, TII.get(X86::ADJCALLSTACKDOWN)).addImm(NumBytes); + unsigned AdjStackDown = TM.getRegisterInfo()->getCallFrameSetupOpcode(); + BuildMI(MBB, TII.get(AdjStackDown)).addImm(NumBytes); // Process argumenet: walk the register/memloc assignments, inserting // copies / loads. @@ -1051,7 +1052,8 @@ } // Issue CALLSEQ_END - BuildMI(MBB, TII.get(X86::ADJCALLSTACKUP)).addImm(NumBytes).addImm(0); + unsigned AdjStackUp = TM.getRegisterInfo()->getCallFrameDestroyOpcode(); + BuildMI(MBB, TII.get(AdjStackUp)).addImm(NumBytes).addImm(0); // Now handle call return value (if any). if (RetVT.getSimpleVT() != MVT::isVoid) { Modified: llvm/trunk/lib/Target/X86/X86Instr64bit.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Instr64bit.td?rev=56925&r1=56924&r2=56925&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86Instr64bit.td (original) +++ llvm/trunk/lib/Target/X86/X86Instr64bit.td Wed Oct 1 13:28:06 2008 @@ -86,11 +86,30 @@ // Instruction list... // +// ADJCALLSTACKDOWN/UP implicitly use/def RSP because they may be expanded into +// a stack adjustment and the codegen must know that they may modify the stack +// pointer before prolog-epilog rewriting occurs. +// Pessimistically assume ADJCALLSTACKDOWN / ADJCALLSTACKUP will become +// sub / add which can clobber EFLAGS. +let Defs = [RSP, EFLAGS], Uses = [RSP] in { +def ADJCALLSTACKDOWN64 : I<0, Pseudo, (outs), (ins i32imm:$amt), + "#ADJCALLSTACKDOWN", + [(X86callseq_start imm:$amt)]>, + Requires<[In64BitMode]>; +def ADJCALLSTACKUP64 : I<0, Pseudo, (outs), (ins i32imm:$amt1, i32imm:$amt2), + "#ADJCALLSTACKUP", + [(X86callseq_end imm:$amt1, imm:$amt2)]>, + Requires<[In64BitMode]>; +} + //===----------------------------------------------------------------------===// // Call Instructions... // let isCall = 1 in - // All calls clobber the non-callee saved registers... + // All calls clobber the non-callee saved registers. RSP is marked as + // a use to prevent stack-pointer assignments that appear immediately + // before calls from potentially appearing dead. Uses for argument + // registers are added manually. let Defs = [RAX, RCX, RDX, RSI, RDI, R8, R9, R10, R11, FP0, FP1, FP2, FP3, FP4, FP5, FP6, ST0, ST1, MM0, MM1, MM2, MM3, MM4, MM5, MM6, MM7, Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=56925&r1=56924&r2=56925&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Wed Oct 1 13:28:06 2008 @@ -321,12 +321,14 @@ // Pessimistically assume ADJCALLSTACKDOWN / ADJCALLSTACKUP will become // sub / add which can clobber EFLAGS. let Defs = [ESP, EFLAGS], Uses = [ESP] in { -def ADJCALLSTACKDOWN : I<0, Pseudo, (outs), (ins i32imm:$amt), - "#ADJCALLSTACKDOWN", - [(X86callseq_start imm:$amt)]>; -def ADJCALLSTACKUP : I<0, Pseudo, (outs), (ins i32imm:$amt1, i32imm:$amt2), - "#ADJCALLSTACKUP", - [(X86callseq_end imm:$amt1, imm:$amt2)]>; +def ADJCALLSTACKDOWN32 : I<0, Pseudo, (outs), (ins i32imm:$amt), + "#ADJCALLSTACKDOWN", + [(X86callseq_start imm:$amt)]>, + Requires<[In32BitMode]>; +def ADJCALLSTACKUP32 : I<0, Pseudo, (outs), (ins i32imm:$amt1, i32imm:$amt2), + "#ADJCALLSTACKUP", + [(X86callseq_end imm:$amt1, imm:$amt2)]>, + Requires<[In32BitMode]>; } // Nop @@ -411,7 +413,10 @@ // Call Instructions... // let isCall = 1 in - // All calls clobber the non-callee saved registers... + // All calls clobber the non-callee saved registers. ESP is marked as + // a use to prevent stack-pointer assignments that appear immediately + // before calls from potentially appearing dead. Uses for argument + // registers are added manually. let Defs = [EAX, ECX, EDX, FP0, FP1, FP2, FP3, FP4, FP5, FP6, ST0, MM0, MM1, MM2, MM3, MM4, MM5, MM6, MM7, XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, EFLAGS], Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=56925&r1=56924&r2=56925&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Wed Oct 1 13:28:06 2008 @@ -42,7 +42,12 @@ X86RegisterInfo::X86RegisterInfo(X86TargetMachine &tm, const TargetInstrInfo &tii) - : X86GenRegisterInfo(X86::ADJCALLSTACKDOWN, X86::ADJCALLSTACKUP), + : X86GenRegisterInfo(tm.getSubtarget().is64Bit() ? + X86::ADJCALLSTACKDOWN64 : + X86::ADJCALLSTACKDOWN32, + tm.getSubtarget().is64Bit() ? + X86::ADJCALLSTACKUP64 : + X86::ADJCALLSTACKUP32), TM(tm), TII(tii) { // Cache some information. const X86Subtarget *Subtarget = &TM.getSubtarget(); @@ -367,11 +372,11 @@ Amount = (Amount+StackAlign-1)/StackAlign*StackAlign; MachineInstr *New = 0; - if (Old->getOpcode() == X86::ADJCALLSTACKDOWN) { + if (Old->getOpcode() == getCallFrameSetupOpcode()) { New = BuildMI(MF, TII.get(Is64Bit ? X86::SUB64ri32 : X86::SUB32ri), StackPtr).addReg(StackPtr).addImm(Amount); } else { - assert(Old->getOpcode() == X86::ADJCALLSTACKUP); + assert(Old->getOpcode() == getCallFrameDestroyOpcode()); // factor out the amount the callee already popped. uint64_t CalleeAmt = Old->getOperand(1).getImm(); Amount -= CalleeAmt; @@ -387,7 +392,7 @@ // Replace the pseudo instruction with a new instruction... if (New) MBB.insert(I, New); } - } else if (I->getOpcode() == X86::ADJCALLSTACKUP) { + } else if (I->getOpcode() == getCallFrameDestroyOpcode()) { // If we are performing frame pointer elimination and if the callee pops // something off the stack pointer, add it back. We do this until we have // more advanced stack pointer tracking ability. From gohman at apple.com Wed Oct 1 14:46:31 2008 From: gohman at apple.com (Dan Gohman) Date: Wed, 01 Oct 2008 19:46:31 -0000 Subject: [llvm-commits] [llvm] r56926 - in /llvm/trunk/test/CodeGen: Generic/i128-and-beyond.ll PowerPC/i128-and-beyond.ll X86/i128-and-beyond.ll Message-ID: <200810011946.m91JkV1f026484@zion.cs.uiuc.edu> Author: djg Date: Wed Oct 1 14:46:30 2008 New Revision: 56926 URL: http://llvm.org/viewvc/llvm-project?rev=56926&view=rev Log: Split this test and move it into target-specific directories. This fixes failures on configurations that don't have one or the other targets enabled. Added: llvm/trunk/test/CodeGen/PowerPC/i128-and-beyond.ll - copied, changed from r56923, llvm/trunk/test/CodeGen/Generic/i128-and-beyond.ll llvm/trunk/test/CodeGen/X86/i128-and-beyond.ll - copied, changed from r56923, llvm/trunk/test/CodeGen/Generic/i128-and-beyond.ll Removed: llvm/trunk/test/CodeGen/Generic/i128-and-beyond.ll Removed: llvm/trunk/test/CodeGen/Generic/i128-and-beyond.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Generic/i128-and-beyond.ll?rev=56925&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/Generic/i128-and-beyond.ll (original) +++ llvm/trunk/test/CodeGen/Generic/i128-and-beyond.ll (removed) @@ -1,9 +0,0 @@ -; RUN: llvm-as < %s | llc -march=x86 -mtriple=i686-pc-linux-gnu | grep 18446744073709551615 | count 14 -; RUN: llvm-as < %s | llc -march=ppc32 | grep 4294967295 | count 28 - -; These static initializers are too big to hand off to assemblers -; as monolithic blobs. - - at x = global i128 -1 - at y = global i256 -1 - at z = global i512 -1 Copied: llvm/trunk/test/CodeGen/PowerPC/i128-and-beyond.ll (from r56923, llvm/trunk/test/CodeGen/Generic/i128-and-beyond.ll) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/i128-and-beyond.ll?p2=llvm/trunk/test/CodeGen/PowerPC/i128-and-beyond.ll&p1=llvm/trunk/test/CodeGen/Generic/i128-and-beyond.ll&r1=56923&r2=56926&rev=56926&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Generic/i128-and-beyond.ll (original) +++ llvm/trunk/test/CodeGen/PowerPC/i128-and-beyond.ll Wed Oct 1 14:46:30 2008 @@ -1,4 +1,3 @@ -; RUN: llvm-as < %s | llc -march=x86 -mtriple=i686-pc-linux-gnu | grep 18446744073709551615 | count 14 ; RUN: llvm-as < %s | llc -march=ppc32 | grep 4294967295 | count 28 ; These static initializers are too big to hand off to assemblers Copied: llvm/trunk/test/CodeGen/X86/i128-and-beyond.ll (from r56923, llvm/trunk/test/CodeGen/Generic/i128-and-beyond.ll) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/i128-and-beyond.ll?p2=llvm/trunk/test/CodeGen/X86/i128-and-beyond.ll&p1=llvm/trunk/test/CodeGen/Generic/i128-and-beyond.ll&r1=56923&r2=56926&rev=56926&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Generic/i128-and-beyond.ll (original) +++ llvm/trunk/test/CodeGen/X86/i128-and-beyond.ll Wed Oct 1 14:46:30 2008 @@ -1,5 +1,4 @@ ; RUN: llvm-as < %s | llc -march=x86 -mtriple=i686-pc-linux-gnu | grep 18446744073709551615 | count 14 -; RUN: llvm-as < %s | llc -march=ppc32 | grep 4294967295 | count 28 ; These static initializers are too big to hand off to assemblers ; as monolithic blobs. From gohman at apple.com Wed Oct 1 14:58:59 2008 From: gohman at apple.com (Dan Gohman) Date: Wed, 01 Oct 2008 19:58:59 -0000 Subject: [llvm-commits] [llvm] r56927 - in /llvm/trunk/lib: CodeGen/SelectionDAG/SelectionDAG.cpp VMCore/AsmWriter.cpp Message-ID: <200810011959.m91Jx09b026972@zion.cs.uiuc.edu> Author: djg Date: Wed Oct 1 14:58:59 2008 New Revision: 56927 URL: http://llvm.org/viewvc/llvm-project?rev=56927&view=rev Log: Make some implicit conversions explicit, to avoid compiler warnings. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/trunk/lib/VMCore/AsmWriter.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=56927&r1=56926&r2=56927&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Wed Oct 1 14:58:59 2008 @@ -2927,7 +2927,7 @@ // Expand memcpy to a series of load and store ops if the size operand falls // below a certain threshold. std::vector MemOps; - uint64_t Limit = -1; + uint64_t Limit = uint64_t(-1); if (!AlwaysInline) Limit = TLI.getMaxStoresPerMemcpy(); unsigned DstAlign = Align; // Destination alignment can change. @@ -2985,7 +2985,7 @@ // Expand memmove to a series of load and store ops if the size operand falls // below a certain threshold. std::vector MemOps; - uint64_t Limit = -1; + uint64_t Limit = uint64_t(-1); if (!AlwaysInline) Limit = TLI.getMaxStoresPerMemmove(); unsigned DstAlign = Align; // Destination alignment can change. Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=56927&r1=56926&r2=56927&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original) +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Wed Oct 1 14:58:59 2008 @@ -385,7 +385,7 @@ // Find the type plane in the module map ValueMap::iterator MI = mMap.find(V); - return MI == mMap.end() ? -1 : MI->second; + return MI == mMap.end() ? -1 : (int)MI->second; } @@ -397,7 +397,7 @@ initialize(); ValueMap::iterator FI = fMap.find(V); - return FI == fMap.end() ? -1 : FI->second; + return FI == fMap.end() ? -1 : (int)FI->second; } From dpatel at apple.com Wed Oct 1 15:00:02 2008 From: dpatel at apple.com (Devang Patel) Date: Wed, 1 Oct 2008 13:00:02 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r56905 - in /llvm-gcc-4.2/trunk/gcc: c-common.c config/i386/darwin.h config/rs6000/darwin.h In-Reply-To: References: <200810010126.m911QN9V014467@zion.cs.uiuc.edu> Message-ID: <62A2C15F-F7D6-4631-9FF6-A888799E856A@apple.com> On Oct 1, 2008, at 9:49 AM, Anton Korobeynikov wrote: > These patches causes breakage of llvm-gcc compilation on non-Darwin > platform. The problem is seen during libiberty compilation: configure > does not find stdlib.h and also other .h files. The corresponding > lines in config.log: > > configure:3691: checking for stdlib.h > configure:3704: > /home/asl/proj/llvm/llvm-gcc-4.2/build/./prev-gcc/xgcc > -B/home/asl/proj/llvm/llvm-gcc-4.2/build/./prev-gcc/ > -B/home/asl/proj/llvm/llvm-gcc-4.2/install/x86_64-unknown-linux-gnu/ > bin/ > -E conftest.c > cc1: warning: -Wformat-security ignored without -Wformat > configure:3710: $? = 0 > configure: failed program was: > | /* confdefs.h. */ > | > | #define PACKAGE_NAME "" > | #define PACKAGE_TARNAME "" > | #define PACKAGE_VERSION "" > | #define PACKAGE_STRING "" > | #define PACKAGE_BUGREPORT "" > | /* end confdefs.h. */ > | #include > > Please investigate Sorry for the breakage. Would it be possible for you to try following patch? If it works, pl. apply. Thanks, - Devang Index: c.opt =================================================================== --- c.opt (revision 56899) +++ c.opt (working copy) @@ -238,7 +238,7 @@ Warn about format strings that are not l ; APPLE LOCAL begin default to Wformat-security 5764921 Wformat-security -C ObjC C++ ObjC++ Var(warn_format_security) Init(1) +C ObjC C++ ObjC++ Var(warn_format_security) Init(0) Warn about possible security problems with format functions ; APPLE LOCAL end default to Wformat-security 5764921 Index: config/i386/darwin.h =================================================================== --- config/i386/darwin.h (revision 56905) +++ config/i386/darwin.h (working copy) @@ -102,7 +102,7 @@ Boston, MA 02110-1301, USA. */ "/* APPLE LOCAL ignore -mcpu=G4 -mcpu=G5 */"\ % Author: evancheng Date: Wed Oct 1 15:01:03 2008 New Revision: 56928 URL: http://llvm.org/viewvc/llvm-project?rev=56928&view=rev Log: Unbreak apple style llvm-gcc build. Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm.c Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/arm.c?rev=56928&r1=56927&r2=56928&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/arm/arm.c (original) +++ llvm-gcc-4.2/trunk/gcc/config/arm/arm.c Wed Oct 1 15:01:03 2008 @@ -84,7 +84,6 @@ static const char *fp_const_from_val (REAL_VALUE_TYPE *); static arm_cc get_arm_condition_code (rtx); static HOST_WIDE_INT int_log2 (HOST_WIDE_INT); -static rtx is_jump_table (rtx); static const char *output_multi_immediate (rtx *, const char *, const char *, int, HOST_WIDE_INT); static const char *shift_op (rtx, HOST_WIDE_INT *); From sabre at nondot.org Wed Oct 1 15:16:19 2008 From: sabre at nondot.org (Chris Lattner) Date: Wed, 01 Oct 2008 20:16:19 -0000 Subject: [llvm-commits] [llvm] r56929 - in /llvm/trunk: include/llvm/Type.h lib/VMCore/AsmWriter.cpp Message-ID: <200810012016.m91KGKL7027544@zion.cs.uiuc.edu> Author: lattner Date: Wed Oct 1 15:16:19 2008 New Revision: 56929 URL: http://llvm.org/viewvc/llvm-project?rev=56929&view=rev Log: add a new form of Type::dump that takes a module for type names, patch provided by Tomas Lindquist Olsen! Modified: llvm/trunk/include/llvm/Type.h llvm/trunk/lib/VMCore/AsmWriter.cpp Modified: llvm/trunk/include/llvm/Type.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Type.h?rev=56929&r1=56928&r2=56929&view=diff ============================================================================== --- llvm/trunk/include/llvm/Type.h (original) +++ llvm/trunk/include/llvm/Type.h Wed Oct 1 15:16:19 2008 @@ -26,6 +26,7 @@ class IntegerType; class TypeMapBase; class raw_ostream; +class Module; /// This file contains the declaration of the Type class. For more "Type" type /// stuff, look in DerivedTypes.h. @@ -162,6 +163,10 @@ /// @brief Debugging support: print to stderr void dump() const; + /// @brief Debugging support: print to stderr (use type names from context + /// module). + void dump(const Module *Context) const; + //===--------------------------------------------------------------------===// // Property accessors for dealing with types... Some of these virtual methods // are defined in private classes defined in Type.cpp for primitive types. Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=56929&r1=56928&r2=56929&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original) +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Wed Oct 1 15:16:19 2008 @@ -1834,6 +1834,14 @@ // 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); + errs() << '\n'; + errs().flush(); +} + // Module::dump() - Allow printing of Modules from the debugger. void Module::dump() const { print(errs(), 0); errs().flush(); } From clattner at apple.com Wed Oct 1 15:16:48 2008 From: clattner at apple.com (Chris Lattner) Date: Wed, 1 Oct 2008 13:16:48 -0700 Subject: [llvm-commits] patch for Type::dump taking Module context for symbolic typename resolution (or whatever) In-Reply-To: <7aa9f8a40810011106p78cbdcfclce5f31df03bfc446@mail.gmail.com> References: <7aa9f8a40810011106p78cbdcfclce5f31df03bfc446@mail.gmail.com> Message-ID: <29AA5431-8FBF-406A-BC2E-A3399AB0D1D8@apple.com> On Oct 1, 2008, at 11:06 AM, Tomas Lindquist Olsen wrote: > Hi folks > > I had some issues with Type::dump taking more than 15 minutes (in > fact I didn't have patience to wait longer than that) during > debugging. > This patch adds support for Type::dump taking a Module context so > type names can be resolved and used, taking the time down to less > than a second. > > Hope this can get in 2.4 as it's really, really, useful for us, some > of the types we generate are huge when fully unfolded. but usually > not more than a single name if not ... Applied, thanks! Make sure to stay in 80 cols though :) http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20080929/067893.html -Chris From anton at korobeynikov.info Wed Oct 1 15:34:47 2008 From: anton at korobeynikov.info (Anton Korobeynikov) Date: Thu, 2 Oct 2008 00:34:47 +0400 Subject: [llvm-commits] [llvm] r56927 - in /llvm/trunk/lib: CodeGen/SelectionDAG/SelectionDAG.cpp VMCore/AsmWriter.cpp In-Reply-To: <200810011959.m91Jx09b026972@zion.cs.uiuc.edu> References: <200810011959.m91Jx09b026972@zion.cs.uiuc.edu> Message-ID: Hi Dan, > - uint64_t Limit = -1; > + uint64_t Limit = uint64_t(-1); Why don't use -1ULL here? It looks a bit nicer :) -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University From gohman at apple.com Wed Oct 1 15:39:20 2008 From: gohman at apple.com (Dan Gohman) Date: Wed, 01 Oct 2008 20:39:20 -0000 Subject: [llvm-commits] [llvm] r56930 - /llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp Message-ID: <200810012039.m91KdKb2028324@zion.cs.uiuc.edu> Author: djg Date: Wed Oct 1 15:39:19 2008 New Revision: 56930 URL: http://llvm.org/viewvc/llvm-project?rev=56930&view=rev Log: Enable FastISel by default (on x86 and x86-64) with the -fast option. Modified: llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp Modified: llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp?rev=56930&r1=56929&r2=56930&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp (original) +++ llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp Wed Oct 1 15:39:19 2008 @@ -53,10 +53,15 @@ cl::desc("Disable scheduling after register allocation"), cl::init(true)); -static cl::opt -FastISelOption("fast-isel", cl::Hidden, - cl::desc("Enable the experimental \"fast\" instruction selector"), - cl::location(EnableFastISel)); +// Enable or disable FastISel. Both options are needed, because +// FastISel is enabled by default with -fast, and we wish to be +// able to enable or disable fast-isel independently from -fast. +static cl::opt +EnableFastISelOption("fast-isel", cl::Hidden, + cl::desc("Enable the experimental \"fast\" instruction selector")); +static cl::opt +DisableFastISelOption("disable-fast-isel", cl::Hidden, + cl::desc("Disable the experimental \"fast\" instruction selector")); FileModel::Model LLVMTargetMachine::addPassesToEmitFile(PassManagerBase &PM, @@ -169,6 +174,13 @@ // Standard Lower-Level Passes. + // Enable FastISel with -fast, but allow that to be overridden. + assert((!EnableFastISelOption || !DisableFastISelOption) && + "Both -fast-isel and -disable-fast-isel given!"); + if (EnableFastISelOption || + (Fast && !DisableFastISelOption)) + EnableFastISel = true; + // Ask the target for an isel. if (addInstSelector(PM, Fast)) return true; From evan.cheng at apple.com Wed Oct 1 15:51:07 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 1 Oct 2008 13:51:07 -0700 Subject: [llvm-commits] [llvm] r56930 - /llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp In-Reply-To: <200810012039.m91KdKb2028324@zion.cs.uiuc.edu> References: <200810012039.m91KdKb2028324@zion.cs.uiuc.edu> Message-ID: Woot! Now if only the Sparc maintainer can add fast-isel hooks to take advantage of it! :-) Evan On Oct 1, 2008, at 1:39 PM, Dan Gohman wrote: > Author: djg > Date: Wed Oct 1 15:39:19 2008 > New Revision: 56930 > > URL: http://llvm.org/viewvc/llvm-project?rev=56930&view=rev > Log: > Enable FastISel by default (on x86 and x86-64) with the -fast option. > > Modified: > llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp > > Modified: llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp?rev=56930&r1=56929&r2=56930&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp (original) > +++ llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp Wed Oct 1 15:39:19 > 2008 > @@ -53,10 +53,15 @@ > cl::desc("Disable scheduling after register > allocation"), > cl::init(true)); > > -static cl::opt > -FastISelOption("fast-isel", cl::Hidden, > - cl::desc("Enable the experimental \"fast\" > instruction selector"), > - cl::location(EnableFastISel)); > +// Enable or disable FastISel. Both options are needed, because > +// FastISel is enabled by default with -fast, and we wish to be > +// able to enable or disable fast-isel independently from -fast. > +static cl::opt > +EnableFastISelOption("fast-isel", cl::Hidden, > + cl::desc("Enable the experimental \"fast\" instruction selector")); > +static cl::opt > +DisableFastISelOption("disable-fast-isel", cl::Hidden, > + cl::desc("Disable the experimental \"fast\" instruction > selector")); > > FileModel::Model > LLVMTargetMachine::addPassesToEmitFile(PassManagerBase &PM, > @@ -169,6 +174,13 @@ > > // Standard Lower-Level Passes. > > + // Enable FastISel with -fast, but allow that to be overridden. > + assert((!EnableFastISelOption || !DisableFastISelOption) && > + "Both -fast-isel and -disable-fast-isel given!"); > + if (EnableFastISelOption || > + (Fast && !DisableFastISelOption)) > + EnableFastISel = true; > + > // Ask the target for an isel. > if (addInstSelector(PM, Fast)) > return true; > > > _______________________________________________ > 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 Oct 1 16:06:10 2008 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 01 Oct 2008 21:06:10 -0000 Subject: [llvm-commits] [llvm] r56931 - /llvm/tags/Apple/llvmCore-2074/ Message-ID: <200810012106.m91L6ANT029075@zion.cs.uiuc.edu> Author: void Date: Wed Oct 1 16:06:09 2008 New Revision: 56931 URL: http://llvm.org/viewvc/llvm-project?rev=56931&view=rev Log: Creating llvmCore-2074 branch Added: llvm/tags/Apple/llvmCore-2074/ - copied from r56930, llvm/trunk/ From isanbard at gmail.com Wed Oct 1 16:06:17 2008 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 01 Oct 2008 21:06:17 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r56932 - /llvm-gcc-4.2/tags/Apple/llvmgcc42-2074/ Message-ID: <200810012106.m91L6Hxu029093@zion.cs.uiuc.edu> Author: void Date: Wed Oct 1 16:06:17 2008 New Revision: 56932 URL: http://llvm.org/viewvc/llvm-project?rev=56932&view=rev Log: Creating llvmgcc42-2074 branch Added: llvm-gcc-4.2/tags/Apple/llvmgcc42-2074/ - copied from r56931, llvm-gcc-4.2/trunk/ From dpatel at apple.com Wed Oct 1 16:09:38 2008 From: dpatel at apple.com (Devang Patel) Date: Wed, 01 Oct 2008 21:09:38 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r56933 - /llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Message-ID: <200810012109.m91L9cY5029187@zion.cs.uiuc.edu> Author: dpatel Date: Wed Oct 1 16:09:38 2008 New Revision: 56933 URL: http://llvm.org/viewvc/llvm-project?rev=56933&view=rev Log: Now, ReadNone and ReadOnly are function attributes. 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=56933&r1=56932&r2=56933&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Wed Oct 1 16:09:38 2008 @@ -1268,12 +1268,8 @@ // write to struct arguments passed by value, but in LLVM this becomes a // write through the byval pointer argument, which LLVM does not allow for // readonly/readnone functions. - if (HasByVal && Attrs[0].Index == 0) { - Attributes &RAttrs = Attrs[0].Attrs; - RAttrs &= ~(Attribute::ReadNone | Attribute::ReadOnly); - if (RAttrs == Attribute::None) - Attrs.erase(Attrs.begin()); - } + if (HasByVal) + FnAttributes &= ~(Attribute::ReadNone | Attribute::ReadOnly); // If the argument list ends with a void type node, it isn't vararg. isVarArg = (Args == 0); From alenhar2 at cs.uiuc.edu Wed Oct 1 17:53:18 2008 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Wed, 01 Oct 2008 22:53:18 -0000 Subject: [llvm-commits] [poolalloc] r56934 - in /poolalloc/trunk: include/dsa/DSGraph.h include/dsa/DataStructure.h lib/DSA/BottomUpClosure.cpp lib/DSA/DataStructure.cpp lib/DSA/TopDownClosure.cpp Message-ID: <200810012253.m91MrJwV000444@zion.cs.uiuc.edu> Author: alenhar2 Date: Wed Oct 1 17:53:17 2008 New Revision: 56934 URL: http://llvm.org/viewvc/llvm-project?rev=56934&view=rev Log: Resolve some calls sometimes and clean up globals graph afterwards Modified: poolalloc/trunk/include/dsa/DSGraph.h poolalloc/trunk/include/dsa/DataStructure.h poolalloc/trunk/lib/DSA/BottomUpClosure.cpp poolalloc/trunk/lib/DSA/DataStructure.cpp poolalloc/trunk/lib/DSA/TopDownClosure.cpp Modified: poolalloc/trunk/include/dsa/DSGraph.h URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/dsa/DSGraph.h?rev=56934&r1=56933&r2=56934&view=diff ============================================================================== --- poolalloc/trunk/include/dsa/DSGraph.h (original) +++ poolalloc/trunk/include/dsa/DSGraph.h Wed Oct 1 17:53:17 2008 @@ -152,6 +152,17 @@ ValueMap.erase(I); } + void clear_scalars() { + for(iterator ii = begin(); ii != end(); ) + if (isa(ii->first)) + ++ii; + else { + iterator next = ii; + ++ii; + erase(next); + } + } + void clear() { ValueMap.clear(); GlobalSet.clear(); @@ -542,7 +553,7 @@ /// merged with other nodes in the graph. This is used as the first step of /// removeDeadNodes. /// - void removeTriviallyDeadNodes(); + void removeTriviallyDeadNodes(bool updateForwarders = false); }; Modified: poolalloc/trunk/include/dsa/DataStructure.h URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/dsa/DataStructure.h?rev=56934&r1=56933&r2=56934&view=diff ============================================================================== --- poolalloc/trunk/include/dsa/DataStructure.h (original) +++ poolalloc/trunk/include/dsa/DataStructure.h Wed Oct 1 17:53:17 2008 @@ -179,7 +179,7 @@ // This map is only maintained during construction of BU Graphs std::map, - std::pair > > *IndCallGraphMap; + std::pair > > IndCallGraphMap; std::set InlinedSomewhere; @@ -233,6 +233,7 @@ void CloneAuxIntoGlobal(DSGraph& G); + void finalizeGlobals(void); }; Modified: poolalloc/trunk/lib/DSA/BottomUpClosure.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/BottomUpClosure.cpp?rev=56934&r1=56933&r2=56934&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/BottomUpClosure.cpp (original) +++ poolalloc/trunk/lib/DSA/BottomUpClosure.cpp Wed Oct 1 17:53:17 2008 @@ -49,9 +49,6 @@ GlobalsGraph = new DSGraph(LocalDSA.getGlobalsGraph(), GlobalECs); GlobalsGraph->setPrintAuxCalls(); - IndCallGraphMap = new std::map, - std::pair > >(); - std::vector Stack; hash_map ValMap; unsigned NextID = 1; @@ -81,11 +78,11 @@ // If we computed any temporary indcallgraphs, free them now. for (std::map, std::pair > >::iterator I = - IndCallGraphMap->begin(), E = IndCallGraphMap->end(); I != E; ++I) { + IndCallGraphMap.begin(), E = IndCallGraphMap.end(); I != E; ++I) { I->second.second.clear(); // Drop arg refs into the graph. delete I->second.first; } - delete IndCallGraphMap; + IndCallGraphMap.clear(); // At the end of the bottom-up pass, the globals graph becomes complete. // FIXME: This is not the right way to do this, but it is sorta better than @@ -93,7 +90,10 @@ // nodes at the end of the BU phase should make things that they point to // incomplete in the globals graph. // - GlobalsGraph->removeTriviallyDeadNodes(); + + finalizeGlobals(); + + GlobalsGraph->removeTriviallyDeadNodes(true); GlobalsGraph->maskIncompleteMarkers(); // Mark external globals incomplete. @@ -127,6 +127,43 @@ return false; } +static inline bool nodeContainsExternalFunction(const DSNode *N) { + std::vector Funcs; + N->addFullFunctionList(Funcs); + for (unsigned i = 0, e = Funcs.size(); i != e; ++i) + if (Funcs[i]->isDeclaration()) return true; + return false; +} + +void BUDataStructures::finalizeGlobals(void) { + // Any unresolved call can be removed (resolved) if it does not contain + // external functions and it is not reachable from any call that does + // contain external functions + std::set GoodCalls, BadCalls; + for (DSGraph::afc_iterator ii = GlobalsGraph->afc_begin(), + ee = GlobalsGraph->afc_end(); ii != ee; ++ii) + if (ii->isDirectCall() || + nodeContainsExternalFunction(ii->getCalleeNode())) + BadCalls.insert(*ii); + else + GoodCalls.insert(*ii); + hash_set reachable; + for (std::set::iterator ii = BadCalls.begin(), + ee = BadCalls.end(); ii != ee; ++ii) { + ii->getRetVal().getNode()->markReachableNodes(reachable); + for (unsigned x = 0; x < ii->getNumPtrArgs(); ++x) + ii->getPtrArg(x).getNode()->markReachableNodes(reachable); + } + for (std::set::iterator ii = GoodCalls.begin(), + ee = GoodCalls.end(); ii != ee; ++ii) + if (reachable.find(ii->getCalleeNode()) == reachable.end()) + GlobalsGraph->getAuxFunctionCalls() + .erase(std::find(GlobalsGraph->getAuxFunctionCalls().begin(), + GlobalsGraph->getAuxFunctionCalls().end(), + *ii)); + GlobalsGraph->getScalarMap().clear_scalars(); +} + static void GetAllCallees(const DSCallSite &CS, std::vector &Callees) { if (CS.isDirectCall()) { @@ -447,7 +484,7 @@ // See if we already computed a graph for this set of callees. std::sort(CalledFuncs.begin(), CalledFuncs.end()); std::pair > &IndCallGraph = - (*IndCallGraphMap)[CalledFuncs]; + IndCallGraphMap[CalledFuncs]; if (IndCallGraph.first == 0) { std::vector::iterator I = CalledFuncs.begin(), Modified: poolalloc/trunk/lib/DSA/DataStructure.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/DataStructure.cpp?rev=56934&r1=56933&r2=56934&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/DataStructure.cpp (original) +++ poolalloc/trunk/lib/DSA/DataStructure.cpp Wed Oct 1 17:53:17 2008 @@ -2000,6 +2000,7 @@ E = AuxFunctionCalls.end(); I != E; ++I) markIncomplete(*I); +#if 0 // Mark stuff passed into external functions as being incomplete. // External functions may not appear in Aux during td, so process // them specially @@ -2007,6 +2008,7 @@ E = FunctionCalls.end(); I != E; ++I) if(I->isDirectCall() && I->getCalleeFunc()->isDeclaration()) markIncomplete(*I); +#endif // Mark all global nodes as incomplete. for (DSScalarMap::global_iterator I = ScalarMap.global_begin(), @@ -2191,38 +2193,39 @@ // other nodes in the graph. These nodes will all be trivially unreachable, so // we don't have to perform any non-trivial analysis here. // -void DSGraph::removeTriviallyDeadNodes() { +void DSGraph::removeTriviallyDeadNodes(bool updateForwarders) { TIME_REGION(X, "removeTriviallyDeadNodes"); -#if 0 - /// NOTE: This code is disabled. This slows down DSA on 177.mesa - /// substantially! - - // Loop over all of the nodes in the graph, calling getNode on each field. - // This will cause all nodes to update their forwarding edges, causing - // forwarded nodes to be delete-able. - { TIME_REGION(X, "removeTriviallyDeadNodes:node_iterate"); - for (node_iterator NI = node_begin(), E = node_end(); NI != E; ++NI) { - DSNode &N = *NI; - for (unsigned l = 0, e = N.getNumLinks(); l != e; ++l) - N.getLink(l*N.getPointerSize()).getNode(); - } + if (updateForwarders) { + /// NOTE: This code is disabled. This slows down DSA on 177.mesa + /// substantially! + + // Loop over all of the nodes in the graph, calling getNode on each field. + // This will cause all nodes to update their forwarding edges, causing + // forwarded nodes to be delete-able. + { TIME_REGION(X, "removeTriviallyDeadNodes:node_iterate"); + for (node_iterator NI = node_begin(), E = node_end(); NI != E; ++NI) { + DSNode &N = *NI; + for (unsigned l = 0, e = N.getNumLinks(); l != e; ++l) + N.getLink(l*N.getPointerSize()).getNode(); + } + } + + // NOTE: This code is disabled. Though it should, in theory, allow us to + // remove more nodes down below, the scan of the scalar map is incredibly + // expensive for certain programs (with large SCCs). In the future, if we can + // make the scalar map scan more efficient, then we can reenable this. + { TIME_REGION(X, "removeTriviallyDeadNodes:scalarmap"); + + // Likewise, forward any edges from the scalar nodes. While we are at it, + // clean house a bit. + for (DSScalarMap::iterator I = ScalarMap.begin(),E = ScalarMap.end();I != E;){ + I->second.getNode(); + ++I; + } + } } - // NOTE: This code is disabled. Though it should, in theory, allow us to - // remove more nodes down below, the scan of the scalar map is incredibly - // expensive for certain programs (with large SCCs). In the future, if we can - // make the scalar map scan more efficient, then we can reenable this. - { TIME_REGION(X, "removeTriviallyDeadNodes:scalarmap"); - - // Likewise, forward any edges from the scalar nodes. While we are at it, - // clean house a bit. - for (DSScalarMap::iterator I = ScalarMap.begin(),E = ScalarMap.end();I != E;){ - I->second.getNode(); - ++I; - } - } -#endif bool isGlobalsGraph = !GlobalsGraph; for (NodeListTy::iterator NI = Nodes.begin(), E = Nodes.end(); NI != E; ) { @@ -2262,7 +2265,8 @@ } } - if (Node.getNodeFlags() == 0 && Node.hasNoReferrers()) { + if ((Node.getNodeFlags() == 0 && Node.hasNoReferrers()) + || (isGlobalsGraph && Node.hasNoReferrers() && !Node.isGlobalNode())){ // This node is dead! NI = Nodes.erase(NI); // Erase & remove from node list. ++NumTrivialDNE; Modified: poolalloc/trunk/lib/DSA/TopDownClosure.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/TopDownClosure.cpp?rev=56934&r1=56933&r2=56934&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/TopDownClosure.cpp (original) +++ poolalloc/trunk/lib/DSA/TopDownClosure.cpp Wed Oct 1 17:53:17 2008 @@ -93,6 +93,10 @@ Visited); Visited.clear(); + // Clear Aux of Globals Graph to be refilled in later by post-TD unresolved + // functions + GlobalsGraph->getAuxFunctionCalls().clear(); + // Functions without internal linkage also have unknown incoming arguments! for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) if (!I->isDeclaration() && !I->hasInternalLinkage()) @@ -103,18 +107,6 @@ hash_set VisitedGraph; std::vector PostOrder; -#if 0 -{TIME_REGION(XXX, "td:Copy graphs"); - - // Visit each of the graphs in reverse post-order now! - for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) - if (!I->isDeclaration(*I) - getOrCreateGraph(*I); - return false; -} -#endif - - {TIME_REGION(XXX, "td:Compute postorder"); // Calculate top-down from main... From dpatel at apple.com Wed Oct 1 18:07:58 2008 From: dpatel at apple.com (Devang Patel) Date: Wed, 01 Oct 2008 23:07:58 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r56935 - /llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Message-ID: <200810012307.m91N7wtj001081@zion.cs.uiuc.edu> Author: dpatel Date: Wed Oct 1 18:07:58 2008 New Revision: 56935 URL: http://llvm.org/viewvc/llvm-project?rev=56935&view=rev Log: Do not use global variable. Now, this info. is encoded as function attribute. Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.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=56935&r1=56934&r2=56935&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Wed Oct 1 18:07:58 2008 @@ -246,7 +246,6 @@ void performLateBackendInitialization(void) { // The Ada front-end sets flag_exceptions only after processing the file. ExceptionHandling = flag_exceptions; - OptimizeForSize = optimize_size; } void llvm_lang_dependent_init(const char *Name) { From dpatel at apple.com Wed Oct 1 18:18:38 2008 From: dpatel at apple.com (Devang Patel) Date: Wed, 01 Oct 2008 23:18:38 -0000 Subject: [llvm-commits] [llvm] r56937 - in /llvm/trunk: include/llvm/Target/TargetOptions.h lib/CodeGen/LLVMTargetMachine.cpp lib/CodeGen/LoopAligner.cpp lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp lib/Target/TargetMachine.cpp lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp lib/Target/X86/X86ISelDAGToDAG.cpp test/CodeGen/X86/vec_shuffle-23.ll test/CodeGen/X86/vec_shuffle-24.ll Message-ID: <200810012318.m91NIdJn001426@zion.cs.uiuc.edu> Author: dpatel Date: Wed Oct 1 18:18:38 2008 New Revision: 56937 URL: http://llvm.org/viewvc/llvm-project?rev=56937&view=rev Log: Remove OptimizeForSize global. Use function attribute optsize. Added: llvm/trunk/test/CodeGen/X86/vec_shuffle-24.ll Modified: llvm/trunk/include/llvm/Target/TargetOptions.h llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp llvm/trunk/lib/CodeGen/LoopAligner.cpp llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp llvm/trunk/lib/Target/TargetMachine.cpp llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp llvm/trunk/test/CodeGen/X86/vec_shuffle-23.ll Modified: llvm/trunk/include/llvm/Target/TargetOptions.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetOptions.h?rev=56937&r1=56936&r2=56937&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetOptions.h (original) +++ llvm/trunk/include/llvm/Target/TargetOptions.h Wed Oct 1 18:18:38 2008 @@ -83,10 +83,6 @@ /// optimization (pop the caller's stack) providing it supports it. extern bool PerformTailCallOpt; - /// OptimizeForSize - When this flag is set, the code generator avoids - /// optimizations that increase size. - extern bool OptimizeForSize; - /// StackAlignment - Override default stack alignment for target. extern unsigned StackAlignment; Modified: llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp?rev=56937&r1=56936&r2=56937&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp (original) +++ llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp Wed Oct 1 18:18:38 2008 @@ -81,7 +81,7 @@ if (addPreEmitPass(PM, Fast) && PrintMachineCode) PM.add(createMachineFunctionPrinterPass(cerr)); - if (!Fast && !OptimizeForSize) + if (!Fast) PM.add(createLoopAlignerPass()); switch (FileType) { Modified: llvm/trunk/lib/CodeGen/LoopAligner.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LoopAligner.cpp?rev=56937&r1=56936&r2=56937&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LoopAligner.cpp (original) +++ llvm/trunk/lib/CodeGen/LoopAligner.cpp Wed Oct 1 18:18:38 2008 @@ -58,6 +58,10 @@ if (!Align) return false; // Don't care about loop alignment. + const Function *F = MF.getFunction(); + if (!F->isDeclaration() && F->hasFnAttr(Attribute::OptimizeForSize)) + return false; + for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ++I) { MachineBasicBlock *MBB = I; if (MLI->isLoopHeader(MBB)) 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=56937&r1=56936&r2=56937&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp Wed Oct 1 18:18:38 2008 @@ -776,7 +776,7 @@ printVisibility(CurrentFnName, F->getVisibility()); - EmitAlignment(OptimizeForSize ? 2 : 4, F); + EmitAlignment(F->hasFnAttr(Attribute::OptimizeForSize) ? 2 : 4, F); O << CurrentFnName << ":\n"; // Emit pre-function debug information. Modified: llvm/trunk/lib/Target/TargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetMachine.cpp?rev=56937&r1=56936&r2=56937&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetMachine.cpp (original) +++ llvm/trunk/lib/Target/TargetMachine.cpp Wed Oct 1 18:18:38 2008 @@ -35,7 +35,6 @@ Reloc::Model RelocationModel; CodeModel::Model CMModel; bool PerformTailCallOpt; - bool OptimizeForSize; unsigned StackAlignment; bool RealignStack; bool VerboseAsm; @@ -134,11 +133,6 @@ cl::desc("Turn on tail call optimization."), cl::location(PerformTailCallOpt), cl::init(false)); -static cl::opt -EnableOptimizeForSize("optimize-size", - cl::desc("Optimize for size."), - cl::location(OptimizeForSize), - cl::init(false)); static cl::opt OverrideStackAlignment("stack-alignment", 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=56937&r1=56936&r2=56937&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Wed Oct 1 18:18:38 2008 @@ -153,7 +153,7 @@ SwitchToSection(TAI->SectionForGlobal(F)); - unsigned FnAlign = OptimizeForSize ? 1 : 4; + unsigned FnAlign = 4; if (!F->isDeclaration() && F->hasFnAttr(Attribute::OptimizeForSize)) FnAlign = 1; switch (F->getLinkage()) { 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=56937&r1=56936&r2=56937&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp Wed Oct 1 18:18:38 2008 @@ -140,7 +140,7 @@ SwitchToTextSection("_text", F); - unsigned FnAlign = OptimizeForSize ? 1 : 4; + unsigned FnAlign = 4; if (!F->isDeclaration() && F->hasFnAttr(Attribute::OptimizeForSize)) FnAlign = 1; switch (F->getLinkage()) { Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=56937&r1=56936&r2=56937&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Wed Oct 1 18:18:38 2008 @@ -137,7 +137,7 @@ ContainsFPCode(false), TM(tm), X86Lowering(*TM.getTargetLowering()), Subtarget(&TM.getSubtarget()), - OptForSize(OptimizeForSize) {} + OptForSize(false) {} virtual const char *getPassName() const { return "X86 DAG->DAG Instruction Selection"; Modified: llvm/trunk/test/CodeGen/X86/vec_shuffle-23.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vec_shuffle-23.ll?rev=56937&r1=56936&r2=56937&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/vec_shuffle-23.ll (original) +++ llvm/trunk/test/CodeGen/X86/vec_shuffle-23.ll Wed Oct 1 18:18:38 2008 @@ -1,6 +1,5 @@ ; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | not grep punpck ; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep pshufd -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -optimize-size | grep punpck define i32 @t() nounwind { entry: Added: llvm/trunk/test/CodeGen/X86/vec_shuffle-24.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vec_shuffle-24.ll?rev=56937&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/vec_shuffle-24.ll (added) +++ llvm/trunk/test/CodeGen/X86/vec_shuffle-24.ll Wed Oct 1 18:18:38 2008 @@ -0,0 +1,17 @@ +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep punpck + +define i32 @t() nounwind optsize { +entry: + %a = alloca <4 x i32> ; <<4 x i32>*> [#uses=2] + %b = alloca <4 x i32> ; <<4 x i32>*> [#uses=5] + volatile store <4 x i32> < i32 0, i32 1, i32 2, i32 3 >, <4 x i32>* %a + %tmp = load <4 x i32>* %a ; <<4 x i32>> [#uses=1] + store <4 x i32> %tmp, <4 x i32>* %b + %tmp1 = load <4 x i32>* %b ; <<4 x i32>> [#uses=1] + %tmp2 = load <4 x i32>* %b ; <<4 x i32>> [#uses=1] + %punpckldq = shufflevector <4 x i32> %tmp1, <4 x i32> %tmp2, <4 x i32> < i32 0, i32 4, i32 1, i32 5 > ; <<4 x i32>> [#uses=1] + store <4 x i32> %punpckldq, <4 x i32>* %b + %tmp3 = load <4 x i32>* %b ; <<4 x i32>> [#uses=1] + %result = extractelement <4 x i32> %tmp3, i32 0 ; [#uses=1] + ret i32 %result +} From dpatel at apple.com Wed Oct 1 18:41:25 2008 From: dpatel at apple.com (Devang Patel) Date: Wed, 01 Oct 2008 23:41:25 -0000 Subject: [llvm-commits] [llvm] r56939 - in /llvm/trunk: include/llvm/Attributes.h lib/VMCore/Verifier.cpp test/Assembler/2008-09-02-FunctionNotes2.ll Message-ID: <200810012341.m91NfPF1002323@zion.cs.uiuc.edu> Author: dpatel Date: Wed Oct 1 18:41:25 2008 New Revision: 56939 URL: http://llvm.org/viewvc/llvm-project?rev=56939&view=rev Log: Attributes noinline alwaysinline are incompatible Modified: llvm/trunk/include/llvm/Attributes.h llvm/trunk/lib/VMCore/Verifier.cpp llvm/trunk/test/Assembler/2008-09-02-FunctionNotes2.ll Modified: llvm/trunk/include/llvm/Attributes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Attributes.h?rev=56939&r1=56938&r2=56939&view=diff ============================================================================== --- llvm/trunk/include/llvm/Attributes.h (original) +++ llvm/trunk/include/llvm/Attributes.h Wed Oct 1 18:41:25 2008 @@ -60,10 +60,11 @@ const Attributes VarArgsIncompatible = StructRet; /// @brief Attributes that are mutually incompatible. -const Attributes MutuallyIncompatible[3] = { +const Attributes MutuallyIncompatible[4] = { ByVal | InReg | Nest | StructRet, ZExt | SExt, - ReadNone | ReadOnly + ReadNone | ReadOnly, + NoInline | AlwaysInline }; /// @brief Which attributes cannot be applied to a type. Modified: llvm/trunk/lib/VMCore/Verifier.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=56939&r1=56938&r2=56939&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Verifier.cpp (original) +++ llvm/trunk/lib/VMCore/Verifier.cpp Wed Oct 1 18:41:25 2008 @@ -475,6 +475,23 @@ if (Attr.Attrs & Attribute::StructRet) Assert1(Attr.Index == 1, "Attribute sret not on first parameter!", V); } + + Attributes FAttrs = Attrs.getFnAttributes(); + for (unsigned i = 0; + i < array_lengthof(Attribute::MutuallyIncompatible); ++i) { + Attributes MutI = FAttrs & Attribute::MutuallyIncompatible[i]; + Assert1(!(MutI & (MutI - 1)), "Attributes " + + Attribute::getAsString(MutI) + " are incompatible!", V); + } + + Attributes RAttrs = Attrs.getRetAttributes(); + for (unsigned i = 0; + i < array_lengthof(Attribute::MutuallyIncompatible); ++i) { + Attributes MutI = RAttrs & Attribute::MutuallyIncompatible[i]; + Assert1(!(MutI & (MutI - 1)), "Attributes " + + Attribute::getAsString(MutI) + " are incompatible!", V); + } + } static bool VerifyAttributeCount(const AttrListPtr &Attrs, unsigned Params) { Modified: llvm/trunk/test/Assembler/2008-09-02-FunctionNotes2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/2008-09-02-FunctionNotes2.ll?rev=56939&r1=56938&r2=56939&view=diff ============================================================================== --- llvm/trunk/test/Assembler/2008-09-02-FunctionNotes2.ll (original) +++ llvm/trunk/test/Assembler/2008-09-02-FunctionNotes2.ll Wed Oct 1 18:41:25 2008 @@ -1,6 +1,5 @@ ; Test function notes -; RUN: not llvm-as %s -o /dev/null -f |& grep "only one inline note" -; XFAIL: * +; RUN: not llvm-as %s -o /dev/null -f |& grep "Attributes noinline alwaysinline are incompatible" define void @fn1() alwaysinline noinline { ret void } From gohman at apple.com Wed Oct 1 18:48:35 2008 From: gohman at apple.com (Dan Gohman) Date: Wed, 01 Oct 2008 23:48:35 -0000 Subject: [llvm-commits] [llvm] r56940 - /llvm/trunk/test/CodeGen/X86/2008-05-21-CoalescerBug.ll Message-ID: <200810012348.m91NmZQQ002587@zion.cs.uiuc.edu> Author: djg Date: Wed Oct 1 18:48:35 2008 New Revision: 56940 URL: http://llvm.org/viewvc/llvm-project?rev=56940&view=rev Log: Disable fast-isel for this test, as it doesn't emit the same number of instructions. Modified: llvm/trunk/test/CodeGen/X86/2008-05-21-CoalescerBug.ll Modified: llvm/trunk/test/CodeGen/X86/2008-05-21-CoalescerBug.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2008-05-21-CoalescerBug.ll?rev=56940&r1=56939&r2=56940&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/2008-05-21-CoalescerBug.ll (original) +++ llvm/trunk/test/CodeGen/X86/2008-05-21-CoalescerBug.ll Wed Oct 1 18:48:35 2008 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -fast | grep mov | count 5 +; RUN: llvm-as < %s | llc -march=x86 -fast -disable-fast-isel | grep mov | count 5 ; PR2343 %llvm.dbg.anchor.type = type { i32, i32 } From daniel at zuster.org Wed Oct 1 20:17:28 2008 From: daniel at zuster.org (Daniel Dunbar) Date: Thu, 02 Oct 2008 01:17:28 -0000 Subject: [llvm-commits] [llvm] r56942 - in /llvm/trunk: include/llvm/System/Host.h lib/System/Host.cpp lib/System/Unix/Host.inc lib/System/Win32/Host.inc Message-ID: <200810020117.m921HSJ8005371@zion.cs.uiuc.edu> Author: ddunbar Date: Wed Oct 1 20:17:28 2008 New Revision: 56942 URL: http://llvm.org/viewvc/llvm-project?rev=56942&view=rev Log: Add llvm::sys::{osName,osVersion} for retrieving operating system name & version as strings. - Win32 code is untested. Added: llvm/trunk/lib/System/Host.cpp llvm/trunk/lib/System/Unix/Host.inc llvm/trunk/lib/System/Win32/Host.inc Modified: llvm/trunk/include/llvm/System/Host.h Modified: llvm/trunk/include/llvm/System/Host.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/System/Host.h?rev=56942&r1=56941&r2=56942&view=diff ============================================================================== --- llvm/trunk/include/llvm/System/Host.h (original) +++ llvm/trunk/include/llvm/System/Host.h Wed Oct 1 20:17:28 2008 @@ -14,6 +14,8 @@ #ifndef LLVM_SYSTEM_HOST_H #define LLVM_SYSTEM_HOST_H +#include + namespace llvm { namespace sys { @@ -30,6 +32,13 @@ return !littleEndianHost(); } + /// osName() - Return the name of the host operating system or "" if + /// unknown. + std::string osName(); + + /// osVersion() - Return the operating system version as a string or + /// "" if unknown. + std::string osVersion(); } } Added: llvm/trunk/lib/System/Host.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Host.cpp?rev=56942&view=auto ============================================================================== --- llvm/trunk/lib/System/Host.cpp (added) +++ llvm/trunk/lib/System/Host.cpp Wed Oct 1 20:17:28 2008 @@ -0,0 +1,24 @@ +//===-- Host.cpp - Implement OS Host Concept --------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This header file implements the operating system Host concept. +// +//===----------------------------------------------------------------------===// + +#include "llvm/System/Host.h" +#include "llvm/Config/config.h" + +// Include the platform-specific parts of this class. +#ifdef LLVM_ON_UNIX +#include "Unix/Host.inc" +#endif +#ifdef LLVM_ON_WIN32 +#include "Win32/Host.inc" +#endif + Added: llvm/trunk/lib/System/Unix/Host.inc URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Unix/Host.inc?rev=56942&view=auto ============================================================================== --- llvm/trunk/lib/System/Unix/Host.inc (added) +++ llvm/trunk/lib/System/Unix/Host.inc Wed Oct 1 20:17:28 2008 @@ -0,0 +1,42 @@ + //===- llvm/System/Unix/Host.inc --------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file implements the UNIX Host support. +// +//===----------------------------------------------------------------------===// + +//===----------------------------------------------------------------------===// +//=== WARNING: Implementation here must contain only generic UNIX code that +//=== is guaranteed to work on *all* UNIX variants. +//===----------------------------------------------------------------------===// + +#include +#include "Unix.h" +#include +#include + +using namespace llvm; + +std::string llvm::sys::osName() { + struct utsname info; + + if (uname(&info)) + return ""; + + return info.sysname; +} + +std::string llvm::sys::osVersion() { + struct utsname info; + + if (uname(&info)) + return ""; + + return info.release; +} Added: llvm/trunk/lib/System/Win32/Host.inc URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Win32/Host.inc?rev=56942&view=auto ============================================================================== --- llvm/trunk/lib/System/Win32/Host.inc (added) +++ llvm/trunk/lib/System/Win32/Host.inc Wed Oct 1 20:17:28 2008 @@ -0,0 +1,35 @@ +//===- llvm/System/Win32/Host.inc -------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file implements the Win32 Host support. +// +//===----------------------------------------------------------------------===// + +#include "Win32.h" +#include +#include + +using namespace llvm; + +std::string sys::osName() { + return "Windows"; +} + +std::string sys::osVersion() { + OSVERSIONINFO osvi = { 0 }; + osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + + if (!GetVersionEx(&osvi)) + return ""; + + char buf[64]; + sprintf(buf, "%d.%d", osvi.dwMajorVersion, osvi.dwMinorVersion); + + return buf; +} From stuart at apple.com Wed Oct 1 18:33:06 2008 From: stuart at apple.com (Stuart Hastings) Date: Wed, 1 Oct 2008 16:33:06 -0700 Subject: [llvm-commits] _mm_srli_si128 and __builtin_ia32_psrldqi128 Message-ID: Right after I committed my fix for this Apple bug into Apple's GCC... macro troubles in sse land ...Apple's GCC got merged into llvm-gcc, and this broke LLVM. (Here is one reversion arising from the debacle: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20080929/067729.html) The original bug was a complaint that _mm_srli_si128 mis-compiled when passed a constant vector ("{0x123, 0x456}" syntax). The fix is to simplify the _mm_srli_si128 macro, and move the "* 8" from the macro into the compiler back-end. I can't change the existing __builtins because so many people are using them :-(. Since I'm adding a new __builtin_XX, LLVM needs to know about this. I think this fix should go into llvm and llvm-gcc before I patch Apple's GCC; this will "inoculate" LLVM when a subsequent GCC merge arrives. As this is my first posting to llvm-commits, I'm not certain of the protocol. I wrote a GCC-style ChangeLog in case somebody finds it useful: 2008-10-01 Stuart Hastings Radar 5919583 * llvm/include/llvm/IntrinsicsX86.td (int_x86_sse2_psll_dq_bs, int_x86_sse2_psrl_dq_bs): New. * llvm/lib/Target/X86/X86InstrSSE.td (int_x86_sse2_psll_dq_bs, int_x86_sse2_psrl_dq_bs): New. * llvm-gcc/gcc/config/i386/i386.h (IX86_BUILTIN_PSLLDQI128_BYTESHIFT, IX86_BUILTIN_PSRLDQI128_BYTESHIFT): New. * llvm-gcc/gcc/config/i386/emmintrin.h (_mm_srli_si128, _mm_slli_si128): Use xx_byteshift builtins. * llvm-gcc/gcc/config/i386.c (__builtin_ia32_pslldq128_byteshift, __builtin_ia32_psrldq128_byteshift): New. (ix86_expand_builtin): Support for IX86_BUILTIN_PSLLDQI128 and IX86_BUILTIN_PSRLDQI128. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: llvm-gcc.test.diffs.txt Url: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20081001/4e43e447/attachment.txt -------------- next part -------------- -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: llvm.test.diffs.txt Url: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20081001/4e43e447/attachment-0001.txt -------------- next part -------------- I have no commit privileges in LLVM. Would some gracious person please review these patches, and if they're O.K., please apply them? Thank you in advance, stuart From isanbard at gmail.com Thu Oct 2 00:56:53 2008 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 02 Oct 2008 05:56:53 -0000 Subject: [llvm-commits] [llvm] r56944 - in /llvm/trunk: include/llvm/IntrinsicsX86.td lib/Target/X86/X86InstrSSE.td Message-ID: <200810020556.m925usT6013139@zion.cs.uiuc.edu> Author: void Date: Thu Oct 2 00:56:52 2008 New Revision: 56944 URL: http://llvm.org/viewvc/llvm-project?rev=56944&view=rev Log: "The original bug was a complaint that _mm_srli_si128 mis-compiled when passed a constant vector ("{0x123, 0x456}" syntax). The fix is to simplify the _mm_srli_si128 macro, and move the "* 8" from the macro into the compiler back-end. I can't change the existing __builtins because so many people are using them :-(." Patch by Stuart Hastings! Modified: llvm/trunk/include/llvm/IntrinsicsX86.td llvm/trunk/lib/Target/X86/X86InstrSSE.td Modified: llvm/trunk/include/llvm/IntrinsicsX86.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IntrinsicsX86.td?rev=56944&r1=56943&r2=56944&view=diff ============================================================================== --- llvm/trunk/include/llvm/IntrinsicsX86.td (original) +++ llvm/trunk/include/llvm/IntrinsicsX86.td Thu Oct 2 00:56:52 2008 @@ -371,6 +371,12 @@ def int_x86_sse2_psrl_dq : GCCBuiltin<"__builtin_ia32_psrldqi128">, Intrinsic<[llvm_v2i64_ty, llvm_v2i64_ty, llvm_i32_ty], [IntrNoMem]>; + def int_x86_sse2_psll_dq_bs : GCCBuiltin<"__builtin_ia32_pslldqi128_byteshift">, + Intrinsic<[llvm_v2i64_ty, llvm_v2i64_ty, + llvm_i32_ty], [IntrNoMem]>; + def int_x86_sse2_psrl_dq_bs : GCCBuiltin<"__builtin_ia32_psrldqi128_byteshift">, + Intrinsic<[llvm_v2i64_ty, llvm_v2i64_ty, + llvm_i32_ty], [IntrNoMem]>; } // Integer comparison ops Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrSSE.td?rev=56944&r1=56943&r2=56944&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrSSE.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrSSE.td Thu Oct 2 00:56:52 2008 @@ -1969,6 +1969,10 @@ (v2i64 (PSLLDQri VR128:$src1, (PSxLDQ_imm imm:$src2)))>; def : Pat<(int_x86_sse2_psrl_dq VR128:$src1, imm:$src2), (v2i64 (PSRLDQri VR128:$src1, (PSxLDQ_imm imm:$src2)))>; + def : Pat<(int_x86_sse2_psll_dq_bs VR128:$src1, imm:$src2), + (v2i64 (PSLLDQri VR128:$src1, imm:$src2))>; + def : Pat<(int_x86_sse2_psrl_dq_bs VR128:$src1, imm:$src2), + (v2i64 (PSRLDQri VR128:$src1, imm:$src2))>; def : Pat<(v2f64 (X86fsrl VR128:$src1, i32immSExt8:$src2)), (v2f64 (PSRLDQri VR128:$src1, (PSxLDQ_imm imm:$src2)))>; From isanbard at gmail.com Thu Oct 2 00:57:36 2008 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 02 Oct 2008 05:57:36 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r56945 - in /llvm-gcc-4.2/trunk/gcc/config/i386: emmintrin.h i386.c i386.h Message-ID: <200810020557.m925vaSM013171@zion.cs.uiuc.edu> Author: void Date: Thu Oct 2 00:57:35 2008 New Revision: 56945 URL: http://llvm.org/viewvc/llvm-project?rev=56945&view=rev Log: "The original bug was a complaint that _mm_srli_si128 mis-compiled when passed a constant vector ("{0x123, 0x456}" syntax). The fix is to simplify the _mm_srli_si128 macro, and move the "* 8" from the macro into the compiler back-end. I can't change the existing __builtins because so many people are using them :-(." Patch by Stuart Hastings! Modified: llvm-gcc-4.2/trunk/gcc/config/i386/emmintrin.h llvm-gcc-4.2/trunk/gcc/config/i386/i386.c llvm-gcc-4.2/trunk/gcc/config/i386/i386.h Modified: llvm-gcc-4.2/trunk/gcc/config/i386/emmintrin.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/emmintrin.h?rev=56945&r1=56944&r2=56945&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/i386/emmintrin.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/i386/emmintrin.h Thu Oct 2 00:57:35 2008 @@ -1476,10 +1476,8 @@ return ((__m128i)__builtin_ia32_pslldqi128 (__A, __B * 8)); } #else -#define _mm_srli_si128(__A, __B) \ - ((__m128i)__builtin_ia32_psrldqi128 (__A, (__B) * 8)) -#define _mm_slli_si128(__A, __B) \ - ((__m128i)__builtin_ia32_pslldqi128 (__A, (__B) * 8)) +#define _mm_srli_si128 (__m128i)__builtin_ia32_psrldqi128_byteshift +#define _mm_slli_si128 (__m128i)__builtin_ia32_pslldqi128_byteshift #endif #if 0 Modified: llvm-gcc-4.2/trunk/gcc/config/i386/i386.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/i386.c?rev=56945&r1=56944&r2=56945&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/i386/i386.c (original) +++ llvm-gcc-4.2/trunk/gcc/config/i386/i386.c Thu Oct 2 00:57:35 2008 @@ -16858,11 +16858,15 @@ def_builtin (MASK_SSE2, "__builtin_ia32_psrad128", v4si_ftype_v4si_v4si, IX86_BUILTIN_PSRAD128); def_builtin (MASK_SSE2, "__builtin_ia32_pslldqi128", v2di_ftype_v2di_int, IX86_BUILTIN_PSLLDQI128); + /* APPLE LOCAL 5919583 */ + def_builtin (MASK_SSE2, "__builtin_ia32_pslldqi128_byteshift", v2di_ftype_v2di_int, IX86_BUILTIN_PSLLDQI128_BYTESHIFT); def_builtin (MASK_SSE2, "__builtin_ia32_psllwi128", v8hi_ftype_v8hi_int, IX86_BUILTIN_PSLLWI128); def_builtin (MASK_SSE2, "__builtin_ia32_pslldi128", v4si_ftype_v4si_int, IX86_BUILTIN_PSLLDI128); def_builtin (MASK_SSE2, "__builtin_ia32_psllqi128", v2di_ftype_v2di_int, IX86_BUILTIN_PSLLQI128); def_builtin (MASK_SSE2, "__builtin_ia32_psrldqi128", v2di_ftype_v2di_int, IX86_BUILTIN_PSRLDQI128); + /* APPLE LOCAL 5919583 */ + def_builtin (MASK_SSE2, "__builtin_ia32_psrldqi128_byteshift", v2di_ftype_v2di_int, IX86_BUILTIN_PSRLDQI128_BYTESHIFT); def_builtin (MASK_SSE2, "__builtin_ia32_psrlwi128", v8hi_ftype_v8hi_int, IX86_BUILTIN_PSRLWI128); def_builtin (MASK_SSE2, "__builtin_ia32_psrldi128", v4si_ftype_v4si_int, IX86_BUILTIN_PSRLDI128); def_builtin (MASK_SSE2, "__builtin_ia32_psrlqi128", v2di_ftype_v2di_int, IX86_BUILTIN_PSRLQI128); @@ -18166,10 +18170,16 @@ emit_insn (pat); return target; + /* APPLE LOCAL begin 5919583 */ case IX86_BUILTIN_PSLLDQI128: case IX86_BUILTIN_PSRLDQI128: - icode = (fcode == IX86_BUILTIN_PSLLDQI128 ? CODE_FOR_sse2_ashlti3 + case IX86_BUILTIN_PSLLDQI128_BYTESHIFT: + case IX86_BUILTIN_PSRLDQI128_BYTESHIFT: + icode = ((fcode == IX86_BUILTIN_PSLLDQI128 + || fcode == IX86_BUILTIN_PSLLDQI128_BYTESHIFT) + ? CODE_FOR_sse2_ashlti3 : CODE_FOR_sse2_lshrti3); + /* APPLE LOCAL end 5919583 */ arg0 = TREE_VALUE (arglist); arg1 = TREE_VALUE (TREE_CHAIN (arglist)); op0 = expand_normal (arg0); @@ -18178,6 +18188,23 @@ mode1 = insn_data[icode].operand[1].mode; mode2 = insn_data[icode].operand[2].mode; + /* APPLE LOCAL begin 591583 */ + if (! CONST_INT_P (op1)) + { + error ("shift must be an immediate"); + return const0_rtx; + } + /* The _mm_srli_si128/_mm_slli_si128 primitives are defined with + a byte-shift count; inside of GCC, we prefer to specify the + width of a shift in bits. The original non-BYTESHIFT + primitives were problematic due to the "*8" in their macro + bodies; we have moved the "*8" here to resolve this. The + original builtins are still supported because many developers + rely upon them. */ + if (fcode == IX86_BUILTIN_PSLLDQI128_BYTESHIFT + || fcode == IX86_BUILTIN_PSRLDQI128_BYTESHIFT) + op1 = gen_rtx_CONST_INT (SImode, INTVAL (op1) * 8); + /* APPLE LOCAL end 591583 */ if (! (*insn_data[icode].operand[1].predicate) (op0, mode1)) { op0 = copy_to_reg (op0); Modified: llvm-gcc-4.2/trunk/gcc/config/i386/i386.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/i386.h?rev=56945&r1=56944&r2=56945&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/i386/i386.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/i386/i386.h Thu Oct 2 00:57:35 2008 @@ -3664,12 +3664,16 @@ IX86_BUILTIN_PSRLD128, IX86_BUILTIN_PSRLQ128, IX86_BUILTIN_PSLLDQI128, + /* APPLE LOCAL 591583 */ + IX86_BUILTIN_PSLLDQI128_BYTESHIFT, IX86_BUILTIN_PSLLWI128, IX86_BUILTIN_PSLLDI128, IX86_BUILTIN_PSLLQI128, IX86_BUILTIN_PSRAWI128, IX86_BUILTIN_PSRADI128, IX86_BUILTIN_PSRLDQI128, + /* APPLE LOCAL 591583 */ + IX86_BUILTIN_PSRLDQI128_BYTESHIFT, IX86_BUILTIN_PSRLWI128, IX86_BUILTIN_PSRLDI128, IX86_BUILTIN_PSRLQI128, From isanbard at gmail.com Thu Oct 2 00:58:16 2008 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 1 Oct 2008 22:58:16 -0700 Subject: [llvm-commits] _mm_srli_si128 and __builtin_ia32_psrldqi128 In-Reply-To: References: Message-ID: <09128FCC-1EEC-4C4B-87C9-B1264489864C@gmail.com> On Oct 1, 2008, at 4:33 PM, Stuart Hastings wrote: > Right after I committed my fix for this Apple bug into Apple's GCC... > > macro troubles in sse land > > ...Apple's GCC got merged into llvm-gcc, and this broke LLVM. > > (Here is one reversion arising from the debacle: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20080929/067729.html) > > The original bug was a complaint that _mm_srli_si128 mis-compiled > when passed a constant vector ("{0x123, 0x456}" syntax). The fix is > to simplify the _mm_srli_si128 macro, and move the "* 8" from the > macro into the compiler back-end. I can't change the existing > __builtins because so many people are using them :-(. Since I'm > adding a new __builtin_XX, LLVM needs to know about this. > > I think this fix should go into llvm and llvm-gcc before I patch > Apple's GCC; this will "inoculate" LLVM when a subsequent GCC merge > arrives. > > As this is my first posting to llvm-commits, I'm not certain of the > protocol. I wrote a GCC-style ChangeLog in case somebody finds it > useful: > > 2008-10-01 Stuart Hastings > > Radar 5919583 > * llvm/include/llvm/IntrinsicsX86.td (int_x86_sse2_psll_dq_bs, > int_x86_sse2_psrl_dq_bs): New. > * llvm/lib/Target/X86/X86InstrSSE.td (int_x86_sse2_psll_dq_bs, > int_x86_sse2_psrl_dq_bs): New. > * llvm-gcc/gcc/config/i386/i386.h > (IX86_BUILTIN_PSLLDQI128_BYTESHIFT, > IX86_BUILTIN_PSRLDQI128_BYTESHIFT): New. > * llvm-gcc/gcc/config/i386/emmintrin.h (_mm_srli_si128, > _mm_slli_si128): Use xx_byteshift builtins. > * llvm-gcc/gcc/config/i386.c (__builtin_ia32_pslldq128_byteshift, > __builtin_ia32_psrldq128_byteshift): New. > (ix86_expand_builtin): Support for IX86_BUILTIN_PSLLDQI128 and > IX86_BUILTIN_PSRLDQI128. > > > > > > > I have no commit privileges in LLVM. Would some gracious person > please review these patches, and if they're O.K., please apply them? > I applied them. > Thank you in advance, > You're welcome. And thank you! :-) -bw From asl at math.spbu.ru Thu Oct 2 01:16:09 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Thu, 02 Oct 2008 06:16:09 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r56946 - in /llvm-gcc-4.2/trunk/gcc: c-common.c c.opt config/i386/darwin.h config/rs6000/darwin.h Message-ID: <200810020616.m926G9eQ013708@zion.cs.uiuc.edu> Author: asl Date: Thu Oct 2 01:16:08 2008 New Revision: 56946 URL: http://llvm.org/viewvc/llvm-project?rev=56946&view=rev Log: Reapply r56905 with proper fix. Modified: llvm-gcc-4.2/trunk/gcc/c-common.c llvm-gcc-4.2/trunk/gcc/c.opt llvm-gcc-4.2/trunk/gcc/config/i386/darwin.h llvm-gcc-4.2/trunk/gcc/config/rs6000/darwin.h Modified: llvm-gcc-4.2/trunk/gcc/c-common.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-common.c?rev=56946&r1=56945&r2=56946&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/c-common.c (original) +++ llvm-gcc-4.2/trunk/gcc/c-common.c Thu Oct 2 01:16:08 2008 @@ -302,8 +302,7 @@ /* Warn about format/argument anomalies in calls to formatted I/O functions (*printf, *scanf, strftime, strfmon, etc.). */ -/* APPLE LOCAL default to Wformat-security 5764921 */ -int warn_format = 1; +int warn_format; /* Warn about using __null (as NULL in C++) as sentinel. For code compiled with GCC this doesn't matter as __null is guaranteed to have the right Modified: llvm-gcc-4.2/trunk/gcc/c.opt URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c.opt?rev=56946&r1=56945&r2=56946&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/c.opt (original) +++ llvm-gcc-4.2/trunk/gcc/c.opt Thu Oct 2 01:16:08 2008 @@ -238,7 +238,7 @@ ; APPLE LOCAL begin default to Wformat-security 5764921 Wformat-security -C ObjC C++ ObjC++ Var(warn_format_security) Init(1) +C ObjC C++ ObjC++ Var(warn_format_security) Init(0) Warn about possible security problems with format functions ; APPLE LOCAL end default to Wformat-security 5764921 Modified: llvm-gcc-4.2/trunk/gcc/config/i386/darwin.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/darwin.h?rev=56946&r1=56945&r2=56946&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/i386/darwin.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/i386/darwin.h Thu Oct 2 01:16:08 2008 @@ -101,6 +101,8 @@ %{!mmacosx-version-min=*: %{!miphoneos-version-min=*: %(darwin_cc1_minversion)}} \ "/* APPLE LOCAL ignore -mcpu=G4 -mcpu=G5 */"\ % References: Message-ID: Nice first patch! Thanks Stuart. Evan On Oct 1, 2008, at 4:33 PM, Stuart Hastings wrote: > Right after I committed my fix for this Apple bug into Apple's GCC... > > macro troubles in sse land > > ...Apple's GCC got merged into llvm-gcc, and this broke LLVM. > > (Here is one reversion arising from the debacle: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20080929/067729.html) > > The original bug was a complaint that _mm_srli_si128 mis-compiled > when passed a constant vector ("{0x123, 0x456}" syntax). The fix is > to simplify the _mm_srli_si128 macro, and move the "* 8" from the > macro into the compiler back-end. I can't change the existing > __builtins because so many people are using them :-(. Since I'm > adding a new __builtin_XX, LLVM needs to know about this. > > I think this fix should go into llvm and llvm-gcc before I patch > Apple's GCC; this will "inoculate" LLVM when a subsequent GCC merge > arrives. > > As this is my first posting to llvm-commits, I'm not certain of the > protocol. I wrote a GCC-style ChangeLog in case somebody finds it > useful: > > 2008-10-01 Stuart Hastings > > Radar 5919583 > * llvm/include/llvm/IntrinsicsX86.td (int_x86_sse2_psll_dq_bs, > int_x86_sse2_psrl_dq_bs): New. > * llvm/lib/Target/X86/X86InstrSSE.td (int_x86_sse2_psll_dq_bs, > int_x86_sse2_psrl_dq_bs): New. > * llvm-gcc/gcc/config/i386/i386.h > (IX86_BUILTIN_PSLLDQI128_BYTESHIFT, > IX86_BUILTIN_PSRLDQI128_BYTESHIFT): New. > * llvm-gcc/gcc/config/i386/emmintrin.h (_mm_srli_si128, > _mm_slli_si128): Use xx_byteshift builtins. > * llvm-gcc/gcc/config/i386.c (__builtin_ia32_pslldq128_byteshift, > __builtin_ia32_psrldq128_byteshift): New. > (ix86_expand_builtin): Support for IX86_BUILTIN_PSLLDQI128 and > IX86_BUILTIN_PSRLDQI128. > > > > > > > I have no commit privileges in LLVM. Would some gracious person > please review these patches, and if they're O.K., please apply them? > > Thank you in advance, > > stuart_______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From baldrick at free.fr Thu Oct 2 03:37:35 2008 From: baldrick at free.fr (Duncan Sands) Date: Thu, 2 Oct 2008 10:37:35 +0200 Subject: [llvm-commits] [llvm] r56937 - in /llvm/trunk: include/llvm/Target/TargetOptions.h lib/CodeGen/LLVMTargetMachine.cpp lib/CodeGen/LoopAligner.cpp lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp lib/Target/TargetMachine.cpp lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp lib/Target/X86/X86ISelDAGToDAG.cpp test/CodeGen/X86/vec_shuffle-23.ll test/CodeGen/X86/vec_shuffle-24.ll In-Reply-To: <200810012318.m91NIdJn001426@zion.cs.uiuc.edu> References: <200810012318.m91NIdJn001426@zion.cs.uiuc.edu> Message-ID: <200810021037.36288.baldrick@free.fr> Hi Devang, > + const Function *F = MF.getFunction(); > + if (!F->isDeclaration() && F->hasFnAttr(Attribute::OptimizeForSize)) > + return false; why the test !F->isDeclaration()? Is this because if you declare a function F in a file which is being optimized for size, then the declaration gets the OptimizeForSize attribute, even though the function definition may not (because in another file compiled differently)? If so, how about not setting the OptimizeForSize attribute on declarations in the first place? After all, there doesn't seem to be much point to it if it's going to be ignored everywhere anyway - indeed it's just a trap to fall into: checking for a declaration is easily forgotten. Another possibility is to have hasFnAttr check itself whether F is a declaration, and not return true in that case. Ciao, Duncan. From baldrick at free.fr Thu Oct 2 03:48:02 2008 From: baldrick at free.fr (Duncan Sands) Date: Thu, 2 Oct 2008 10:48:02 +0200 Subject: [llvm-commits] [llvm] r56939 - in /llvm/trunk: include/llvm/Attributes.h lib/VMCore/Verifier.cpp test/Assembler/2008-09-02-FunctionNotes2.ll In-Reply-To: <200810012341.m91NfPF1002323@zion.cs.uiuc.edu> References: <200810012341.m91NfPF1002323@zion.cs.uiuc.edu> Message-ID: <200810021048.02861.baldrick@free.fr> Hi Devang, > + Attributes RAttrs = Attrs.getRetAttributes(); > + for (unsigned i = 0; > + i < array_lengthof(Attribute::MutuallyIncompatible); ++i) { > + Attributes MutI = RAttrs & Attribute::MutuallyIncompatible[i]; > + Assert1(!(MutI & (MutI - 1)), "Attributes " + > + Attribute::getAsString(MutI) + " are incompatible!", V); > + } isn't this one checked already by the preceding loop for (unsigned i = 0, e = Attrs.getNumSlots(); i != e; ++i) { and this call VerifyAttrs(Attr.Attrs, Ty, Attr.Index == 0, V); This is the case Attr.Index == 0. Also, shouldn't there be a check that the attributes set as FnAttrs are all actually valid as function attributes? Or is it impossible to (for example) set "inreg" as a function attribute? Ciao, Duncan. From baldrick at free.fr Thu Oct 2 03:49:51 2008 From: baldrick at free.fr (Duncan Sands) Date: Thu, 2 Oct 2008 10:49:51 +0200 Subject: [llvm-commits] [llvm] r56942 - in /llvm/trunk: include/llvm/System/Host.h lib/System/Host.cpp lib/System/Unix/Host.inc lib/System/Win32/Host.inc In-Reply-To: <200810020117.m921HSJ8005371@zion.cs.uiuc.edu> References: <200810020117.m921HSJ8005371@zion.cs.uiuc.edu> Message-ID: <200810021049.51723.baldrick@free.fr> Hi Daniel, > Add llvm::sys::{osName,osVersion} for retrieving operating system name > & version as strings. what are you planning to use this for? Ciao, Duncan. From baldrick at free.fr Thu Oct 2 04:15:09 2008 From: baldrick at free.fr (Duncan Sands) Date: Thu, 2 Oct 2008 11:15:09 +0200 Subject: [llvm-commits] r55638 - /llvm/trunk/include/llvm/Function.h In-Reply-To: References: <200809231027.53858.baldrick@free.fr> <200810010954.26247.baldrick@free.fr> Message-ID: <200810021115.09626.baldrick@free.fr> Hi Devang, > > So what you are saying is: if function A is marked no-sse, > > and it calls function B which is marked sse, than B will > > not be inlined into A if B contains any floating point > > operations (for example, a fp multiplication)? > > Yes, if performance is important, otherwise let it use less efficient > floating point stack. So this is a policy decision. I understand that > you want inliner to not inline B into A in this case. personally I don't much care, I'm just being obnoxious! Your approach implies that the inliner needs to know all about SSE, in particular that using SSE is more efficient for certain constructs. I just find that icky. A quick scan of X86ISelLowering.cpp gives: (1) sse intrinsics (fair enough!) (2) all floating point operations (including conversions between integer and floating point) (3) all vector operations (including integer operations) (4) memset, memcpy and memmove (sse is used to codegen these it seems) (5) llvm.prefetch (6) llvm.memory.barrier While of course you can put this kind of list into the inliner, in my opinion it's not a good design (plus it has to be kept up to date). Hopefully other codegen options encoded as attributes won't need their own lists... As you know I have an alternative approach which doesn't require the inliner knowing this kind of stuff. It does however require being able to differentiate between three cases: whether on the llvm-gcc command line - SSE was explicitly requested - no-SSE was explicitly requested - neither of the above was requested ("don't care" case). I don't know if this is really feasible given the way the llvm-gcc command line works - I didn't think about it at all. But if it is feasible then I like it better (surprise surprise)! I'm not going to mention it anymore because I'm tired of this topic - I guess you are too! :) Best wishes, Duncan. From matthijs at stdin.nl Thu Oct 2 04:23:59 2008 From: matthijs at stdin.nl (Matthijs Kooijman) Date: Thu, 2 Oct 2008 11:23:59 +0200 Subject: [llvm-commits] r55638 - /llvm/trunk/include/llvm/Function.h In-Reply-To: <200810021115.09626.baldrick@free.fr> References: <200809231027.53858.baldrick@free.fr> <200810010954.26247.baldrick@free.fr> <200810021115.09626.baldrick@free.fr> Message-ID: <20081002092359.GF25255@katherina.student.utwente.nl> Hi Duncan, Devang, > I'm not going to mention it anymore because I'm tired of > this topic - I guess you are too! :) FWIW, I agree on the points Duncan is making. Not much to add to it though, so I'll leave it at just this :-) Gr. Matthijs -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20081002/df5ab78a/attachment.bin From gohman at apple.com Thu Oct 2 09:56:13 2008 From: gohman at apple.com (Dan Gohman) Date: Thu, 02 Oct 2008 14:56:13 -0000 Subject: [llvm-commits] [llvm] r56947 - /llvm/trunk/lib/Target/X86/X86FastISel.cpp Message-ID: <200810021456.m92EuDqu007768@zion.cs.uiuc.edu> Author: djg Date: Thu Oct 2 09:56:12 2008 New Revision: 56947 URL: http://llvm.org/viewvc/llvm-project?rev=56947&view=rev Log: Work around an interaction between fast-isel and regalloc=local. The local register allocator's physreg liveness doesn't recognize subregs, so it doesn't know that defs of %ecx that are immediately followed by uses of %cl aren't dead. This comes up due to the way fast-isel emits shift instructions. This is a temporary workaround. Arguably, local regalloc should handle subreg references correctly. On the other hand, perhaps fast-isel should use INSERT_SUBREG instead of just assigning to the most convenient super-register of %cl when lowering shifts. This fixes MultiSource/Benchmarks/MallocBench/espresso, MultiSource/Applications/hexxagon, and others, under -fast. 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=56947&r1=56946&r2=56947&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86FastISel.cpp (original) +++ llvm/trunk/lib/Target/X86/X86FastISel.cpp Thu Oct 2 09:56:12 2008 @@ -741,7 +741,11 @@ if (Op1Reg == 0) return false; TII.copyRegToReg(*MBB, MBB->end(), CReg, Op1Reg, RC, RC); unsigned ResultReg = createResultReg(RC); - BuildMI(MBB, TII.get(OpReg), ResultReg).addReg(Op0Reg); + BuildMI(MBB, TII.get(OpReg), ResultReg).addReg(Op0Reg) + // FIXME: The "Local" register allocator's physreg liveness doesn't + // recognize subregs. Adding the superreg of CL that's actually defined + // prevents it from being re-allocated for this instruction. + .addReg(CReg, false, true); UpdateValueMap(I, ResultReg); return true; } From gohman at apple.com Thu Oct 2 10:04:32 2008 From: gohman at apple.com (Dan Gohman) Date: Thu, 02 Oct 2008 15:04:32 -0000 Subject: [llvm-commits] [llvm] r56948 - in /llvm/trunk: lib/CodeGen/MachineInstr.cpp test/CodeGen/X86/volatile.ll Message-ID: <200810021504.m92F4Wse008201@zion.cs.uiuc.edu> Author: djg Date: Thu Oct 2 10:04:30 2008 New Revision: 56948 URL: http://llvm.org/viewvc/llvm-project?rev=56948&view=rev Log: Fix a think-o in isSafeToMove. This fixes it from thinking that volatile memory references are safe to move. Added: llvm/trunk/test/CodeGen/X86/volatile.ll Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstr.cpp?rev=56948&r1=56947&r2=56948&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Thu Oct 2 10:04:30 2008 @@ -707,7 +707,7 @@ if (TID->mayLoad() && !TII->isInvariantLoad(this)) // Otherwise, this is a real load. If there is a store between the load and // end of block, or if the laod is volatile, we can't move it. - return SawStore || hasVolatileMemoryRef(); + return !SawStore && !hasVolatileMemoryRef(); return true; } Added: llvm/trunk/test/CodeGen/X86/volatile.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/volatile.ll?rev=56948&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/volatile.ll (added) +++ llvm/trunk/test/CodeGen/X86/volatile.ll Thu Oct 2 10:04:30 2008 @@ -0,0 +1,17 @@ +; RUN: llvm-as < %s | llc -march=x86 -mattr=sse2 | grep movsd | count 5 +; RUN: llvm-as < %s | llc -march=x86 -mattr=sse2 -fast | grep movsd | count 5 + + at x = external global double + +define void @foo() nounwind { + %a = volatile load double* @x + volatile store double 0.0, double* @x + volatile store double 0.0, double* @x + %b = volatile load double* @x + ret void +} + +define void @bar() nounwind { + %c = volatile load double* @x + ret void +} From ggreif at gmail.com Thu Oct 2 10:17:02 2008 From: ggreif at gmail.com (Gabor Greif) Date: Thu, 02 Oct 2008 15:17:02 -0000 Subject: [llvm-commits] [llvm] r56949 - /llvm/branches/ggreif/use-diet/include/llvm/Use.h Message-ID: <200810021517.m92FH3in008715@zion.cs.uiuc.edu> Author: ggreif Date: Thu Oct 2 10:17:02 2008 New Revision: 56949 URL: http://llvm.org/viewvc/llvm-project?rev=56949&view=rev Log: when prev is and here is a be careful to preserve prev and thus avoid potential joining of clusters Modified: llvm/branches/ggreif/use-diet/include/llvm/Use.h Modified: llvm/branches/ggreif/use-diet/include/llvm/Use.h URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/include/llvm/Use.h?rev=56949&r1=56948&r2=56949&view=diff ============================================================================== --- llvm/branches/ggreif/use-diet/include/llvm/Use.h (original) +++ llvm/branches/ggreif/use-diet/include/llvm/Use.h Thu Oct 2 10:17:02 2008 @@ -112,7 +112,7 @@ , tagMaskN = tagThree }; static bool isStopTag(NextPtrTag T) { - bool P[] = { true, false, false, true }; + bool P[4] = { true, false, false, true }; return P[T]; } public: @@ -157,9 +157,10 @@ __builtin_prefetch(Next); Use **StrippedPrev = stripTag(Prev); Use *StrippedNext(getNext()); - if (isStop(Next)) - assert((isStop(*StrippedPrev) || (StrippedNext ? isStop(StrippedNext->Next) : true)) && "joining digits?"); - *StrippedPrev = Next; + if (!isStop(Next) && isStop(*StrippedPrev)) + *StrippedPrev = stripTag(Next); + else + *StrippedPrev = Next; if (StrippedNext) StrippedNext->setPrev(StrippedPrev); } From criswell at uiuc.edu Thu Oct 2 10:24:27 2008 From: criswell at uiuc.edu (John Criswell) Date: Thu, 02 Oct 2008 15:24:27 -0000 Subject: [llvm-commits] [poolalloc] r56950 - /poolalloc/trunk/lib/DSA/StdLibPass.cpp Message-ID: <200810021524.m92FOR8i008998@zion.cs.uiuc.edu> Author: criswell Date: Thu Oct 2 10:24:26 2008 New Revision: 56950 URL: http://llvm.org/viewvc/llvm-project?rev=56950&view=rev Log: Handle the possibility of a NULL DSNode because the argument is a constant NULL pointer. Modified: poolalloc/trunk/lib/DSA/StdLibPass.cpp Modified: poolalloc/trunk/lib/DSA/StdLibPass.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/StdLibPass.cpp?rev=56950&r1=56949&r2=56950&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/StdLibPass.cpp (original) +++ poolalloc/trunk/lib/DSA/StdLibPass.cpp Thu Oct 2 10:24:26 2008 @@ -131,7 +131,8 @@ if (recFuncs[x].action.args_write) for (unsigned y = 1; y < CI->getNumOperands(); ++y) if (isa(CI->getOperand(y)->getType())) - Graph.getNodeForValue(CI->getOperand(y)).getNode()->setModifiedMarker(); + if (DSNode * Node=Graph.getNodeForValue(CI->getOperand(y)).getNode()) + Node->setModifiedMarker(); if (recFuncs[x].action.args_heap) for (unsigned y = 1; y < CI->getNumOperands(); ++y) if (isa(CI->getOperand(y)->getType())) From ggreif at gmail.com Thu Oct 2 10:24:56 2008 From: ggreif at gmail.com (Gabor Greif) Date: Thu, 02 Oct 2008 15:24:56 -0000 Subject: [llvm-commits] [llvm] r56951 - /llvm/branches/ggreif/use-diet/include/llvm/Use.h Message-ID: <200810021524.m92FOul5009026@zion.cs.uiuc.edu> Author: ggreif Date: Thu Oct 2 10:24:56 2008 New Revision: 56951 URL: http://llvm.org/viewvc/llvm-project?rev=56951&view=rev Log: simplify Modified: llvm/branches/ggreif/use-diet/include/llvm/Use.h Modified: llvm/branches/ggreif/use-diet/include/llvm/Use.h URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/include/llvm/Use.h?rev=56951&r1=56950&r2=56951&view=diff ============================================================================== --- llvm/branches/ggreif/use-diet/include/llvm/Use.h (original) +++ llvm/branches/ggreif/use-diet/include/llvm/Use.h Thu Oct 2 10:24:56 2008 @@ -112,7 +112,7 @@ , tagMaskN = tagThree }; static bool isStopTag(NextPtrTag T) { - bool P[4] = { true, false, false, true }; + const bool P[4] = { true, false, false, true }; return P[T]; } public: @@ -157,10 +157,9 @@ __builtin_prefetch(Next); Use **StrippedPrev = stripTag(Prev); Use *StrippedNext(getNext()); - if (!isStop(Next) && isStop(*StrippedPrev)) - *StrippedPrev = stripTag(Next); - else - *StrippedPrev = Next; + *StrippedPrev = !isStop(Next) && isStop(*StrippedPrev) + ? stripTag(Next) + : Next; if (StrippedNext) StrippedNext->setPrev(StrippedPrev); } From daniel at zuster.org Thu Oct 2 11:21:36 2008 From: daniel at zuster.org (Daniel Dunbar) Date: Thu, 2 Oct 2008 09:21:36 -0700 Subject: [llvm-commits] [llvm] r56942 - in /llvm/trunk: include/llvm/System/Host.h lib/System/Host.cpp lib/System/Unix/Host.inc lib/System/Win32/Host.inc In-Reply-To: <200810021049.51723.baldrick@free.fr> References: <200810020117.m921HSJ8005371@zion.cs.uiuc.edu> <200810021049.51723.baldrick@free.fr> Message-ID: <6a8523d60810020921y27ef8c4eyee02bafb75c22df7@mail.gmail.com> clang had a need to rewrite the OS portion of the target triple to that of the host in some situations, and I didn't want it to embed a uname call. Is your question related to the ambiguity of these queries? If you dislike this approach, perhaps a better one would be to add functionality to get the target-triple of the host machine? - Daniel On Thu, Oct 2, 2008 at 1:49 AM, Duncan Sands wrote: > Hi Daniel, > >> Add llvm::sys::{osName,osVersion} for retrieving operating system name >> & version as strings. > > what are you planning to use this for? > > Ciao, > > Duncan. > From dpatel at apple.com Thu Oct 2 12:03:16 2008 From: dpatel at apple.com (Devang Patel) Date: Thu, 2 Oct 2008 10:03:16 -0700 Subject: [llvm-commits] [llvm] r56937 - in /llvm/trunk: include/llvm/Target/TargetOptions.h lib/CodeGen/LLVMTargetMachine.cpp lib/CodeGen/LoopAligner.cpp lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp lib/Target/TargetMachine.cpp lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp lib/Target/X86/X86ISelDAGToDAG.cpp test/CodeGen/X86/vec_shuffle-23.ll test/CodeGen/X86/vec_shuffle-24.ll In-Reply-To: <200810021037.36288.baldrick@free.fr> References: <200810012318.m91NIdJn001426@zion.cs.uiuc.edu> <200810021037.36288.baldrick@free.fr> Message-ID: <023D4DFA-C77D-4B15-AEF0-9A2BB0FEBBE2@apple.com> On Oct 2, 2008, at 1:37 AM, Duncan Sands wrote: > Hi Devang, > >> + const Function *F = MF.getFunction(); >> + if (!F->isDeclaration() && F- >> >hasFnAttr(Attribute::OptimizeForSize)) >> + return false; > > why the test !F->isDeclaration()? Is this because if you declare > a function F in a file which is being optimized for size, then > the declaration gets the OptimizeForSize attribute, even though > the function definition may not (because in another file compiled > differently)? > > If so, how about not setting the OptimizeForSize attribute on > declarations in the first place? That's what we do. Initially, in notes implementation we had assertion check somewhere to catch this. > After all, there doesn't seem > to be much point to it if it's going to be ignored everywhere > anyway - indeed it's just a trap to fall into: checking for a > declaration is easily forgotten. > Another possibility is to have hasFnAttr check itself whether > F is a declaration, and not return true in that case. That's what I did. But, Chris preferred that clients check F- >isDeclaration(). - Devang From daniel at zuster.org Thu Oct 2 12:05:05 2008 From: daniel at zuster.org (Daniel Dunbar) Date: Thu, 02 Oct 2008 17:05:05 -0000 Subject: [llvm-commits] [llvm] r56953 - /llvm/trunk/include/llvm/Support/IRBuilder.h Message-ID: <200810021705.m92H56Mu012358@zion.cs.uiuc.edu> Author: ddunbar Date: Thu Oct 2 12:05:03 2008 New Revision: 56953 URL: http://llvm.org/viewvc/llvm-project?rev=56953&view=rev Log: Rename IRBuilder::IsNonNull -> IsNotNull in response to feedback. Modified: llvm/trunk/include/llvm/Support/IRBuilder.h Modified: llvm/trunk/include/llvm/Support/IRBuilder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/IRBuilder.h?rev=56953&r1=56952&r2=56953&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/IRBuilder.h (original) +++ llvm/trunk/include/llvm/Support/IRBuilder.h Thu Oct 2 12:05:03 2008 @@ -641,8 +641,8 @@ Name); } - /// CreateIsNonNull - Return an i1 value testing if \arg Arg is not null. - Value *CreateIsNonNull(Value *Arg, const char *Name = "") { + /// CreateIsNotNull - Return an i1 value testing if \arg Arg is not null. + Value *CreateIsNotNull(Value *Arg, const char *Name = "") { return CreateICmpNE(Arg, llvm::Constant::getNullValue(Arg->getType()), Name); } From daniel at zuster.org Thu Oct 2 12:07:57 2008 From: daniel at zuster.org (Daniel Dunbar) Date: Thu, 2 Oct 2008 10:07:57 -0700 Subject: [llvm-commits] [llvm] r56757 - /llvm/trunk/include/llvm/Support/IRBuilder.h In-Reply-To: <200809290952.59934.baldrick@free.fr> References: <200809272322.m8RNMwHr006195@zion.cs.uiuc.edu> <200809290952.59934.baldrick@free.fr> Message-ID: <6a8523d60810021007t4fb46e3ax3d7edbbde45f86d7@mail.gmail.com> Done. On Mon, Sep 29, 2008 at 12:52 AM, Duncan Sands wrote: > Hi Daniel, > >> Add IRBuilder::{CreateIsNull, CreateIsNonNull} helper methods. >> - I'm open to the idea that these could have better names. I think >> these read better than CreateEQNull and CreateNENull. > > I'd prefer CreateIsNotNull to CreateIsNonNull. > > Ciao, > > Duncan. > From dpatel at apple.com Thu Oct 2 12:08:33 2008 From: dpatel at apple.com (Devang Patel) Date: Thu, 2 Oct 2008 10:08:33 -0700 Subject: [llvm-commits] [llvm] r56939 - in /llvm/trunk: include/llvm/Attributes.h lib/VMCore/Verifier.cpp test/Assembler/2008-09-02-FunctionNotes2.ll In-Reply-To: <200810021048.02861.baldrick@free.fr> References: <200810012341.m91NfPF1002323@zion.cs.uiuc.edu> <200810021048.02861.baldrick@free.fr> Message-ID: On Oct 2, 2008, at 1:48 AM, Duncan Sands wrote: > Hi Devang, > >> + Attributes RAttrs = Attrs.getRetAttributes(); >> + for (unsigned i = 0; >> + i < array_lengthof(Attribute::MutuallyIncompatible); ++i) { >> + Attributes MutI = RAttrs & Attribute::MutuallyIncompatible[i]; >> + Assert1(!(MutI & (MutI - 1)), "Attributes " + >> + Attribute::getAsString(MutI) + " are incompatible!", V); >> + } > > isn't this one checked already by the preceding loop > > for (unsigned i = 0, e = Attrs.getNumSlots(); i != e; ++i) { > > and this call > > VerifyAttrs(Attr.Attrs, Ty, Attr.Index == 0, V); > > This is the case Attr.Index == 0. Aha... I missed that. > > > Also, shouldn't there be a check that the attributes set as > FnAttrs are all actually valid as function attributes? Or is > it impossible to (for example) set "inreg" as a function attribute? Yes, it is not possible to set "inreg" as a function attribute. Today for backward compatibility, asm parser and bitcode reader will accept "inreg" as a function attribute but they will immediately make it a return attribute. - Devang From clattner at apple.com Thu Oct 2 12:14:12 2008 From: clattner at apple.com (Chris Lattner) Date: Thu, 2 Oct 2008 10:14:12 -0700 Subject: [llvm-commits] [llvm] r56942 - in /llvm/trunk: include/llvm/System/Host.h lib/System/Host.cpp lib/System/Unix/Host.inc lib/System/Win32/Host.inc In-Reply-To: <6a8523d60810020921y27ef8c4eyee02bafb75c22df7@mail.gmail.com> References: <200810020117.m921HSJ8005371@zion.cs.uiuc.edu> <200810021049.51723.baldrick@free.fr> <6a8523d60810020921y27ef8c4eyee02bafb75c22df7@mail.gmail.com> Message-ID: <671CB2F6-E883-47D4-BA46-01B359B74BEC@apple.com> On Oct 2, 2008, at 9:21 AM, Daniel Dunbar wrote: > clang had a need to rewrite the OS portion of the target triple to > that > of the host in some situations, and I didn't want it to embed a uname > call. > > Is your question related to the ambiguity of these queries? > > If you dislike this approach, perhaps a better one would be to add > functionality to get the target-triple of the host machine? Just from the interface design perspective, I think it would make sense to make this a "give me the host's target triple" interface. It would be a lot easier to explain what it is supposed to do. -Chris From dpatel at apple.com Thu Oct 2 12:18:10 2008 From: dpatel at apple.com (Devang Patel) Date: Thu, 2 Oct 2008 10:18:10 -0700 Subject: [llvm-commits] r55638 - /llvm/trunk/include/llvm/Function.h In-Reply-To: <200810021115.09626.baldrick@free.fr> References: <200809231027.53858.baldrick@free.fr> <200810010954.26247.baldrick@free.fr> <200810021115.09626.baldrick@free.fr> Message-ID: <66946DDE-695D-4140-8A5A-416923C93C29@apple.com> On Oct 2, 2008, at 2:15 AM, Duncan Sands wrote: > Hi Devang, > >>> So what you are saying is: if function A is marked no-sse, >>> and it calls function B which is marked sse, than B will >>> not be inlined into A if B contains any floating point >>> operations (for example, a fp multiplication)? >> >> Yes, if performance is important, otherwise let it use less efficient >> floating point stack. So this is a policy decision. I understand that >> you want inliner to not inline B into A in this case. > > personally I don't much care, I'm just being obnoxious! > Your approach implies that the inliner needs to know all > about SSE, in particular that using SSE is more efficient > for certain constructs. I just find that icky. A quick > scan of X86ISelLowering.cpp gives: > > (1) sse intrinsics (fair enough!) > (2) all floating point operations (including conversions > between integer and floating point) > (3) all vector operations (including integer operations) > (4) memset, memcpy and memmove (sse is used to codegen > these it seems) > (5) llvm.prefetch > (6) llvm.memory.barrier > > While of course you can put this kind of list into the > inliner, in my opinion it's not a good design (plus it > has to be kept up to date). Hopefully other codegen options > encoded as attributes won't need their own lists... I think, a check will require eventually, somwehere. I thought you'll ask this question, but let me ask it anyway - "What if a function marked as no-sse uses SSE builtin or SSE instruction in asm code?" :) > As you know I have an alternative approach which doesn't > require the inliner knowing this kind of stuff. It does > however require being able to differentiate between three > cases: whether on the llvm-gcc command line > - SSE was explicitly requested > - no-SSE was explicitly requested > - neither of the above was requested ("don't care" case). > I don't know if this is really feasible given the way the > llvm-gcc command line works - I didn't think about it at all. > But if it is feasible then I like it better (surprise surprise)! I understand. IMO, inlining sse function into no-sse function is OK if we have mechanism to detect SSE. As I mentioned above, we will need such check anyway, so we might as well use it here. If not then not a big deal. However, I do not see anything wrong with inlining no-sse function into a sse function, which your approach will disallow as I understand. > I'm not going to mention it anymore because I'm tired of > this topic - I guess you are too! :) :) Whenever we implement sse and no-sse attributes, we'll deal with details. - Devang From evan.cheng at apple.com Thu Oct 2 12:24:41 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 2 Oct 2008 10:24:41 -0700 Subject: [llvm-commits] r55638 - /llvm/trunk/include/llvm/Function.h In-Reply-To: References: <200809231027.53858.baldrick@free.fr> <200809300939.38971.baldrick@free.fr> <200810010954.26247.baldrick@free.fr> Message-ID: <654D6FA9-0471-414F-B2E2-E2BD21A37BF9@apple.com> On Oct 1, 2008, at 9:17 AM, Devang Patel wrote: > > On Oct 1, 2008, at 12:54 AM, Duncan Sands wrote: > >> On Tuesday 30 September 2008 18:28:58 Devang Patel wrote: >>> >>> On Sep 30, 2008, at 12:39 AM, Duncan Sands wrote: >>> >>>>> Ignore inliner for a while, and decide what code generator should >>>>> do >>>>> for following ? >>>>> >>>>> define float @foo(float %a, float %b) x86_no_sse { >>>>> %t = mul float %a, %b >>>>> ret float %t >>>>> } >>>> >>>> It would use the x86 floating point stack, like it does now >>>> if you compile with -mattr=-sse. This is less efficient than >>>> using sse. >>> >>> So, I guess you answered your question. >> >> So what you are saying is: if function A is marked no-sse, >> and it calls function B which is marked sse, than B will >> not be inlined into A if B contains any floating point >> operations (for example, a fp multiplication)? > > Yes, if performance is important, otherwise let it use less efficient > floating point stack. So this is a policy decision. I understand that > you want inliner to not inline B into A in this case. I don't think we want the passes that make use function notes to guess why one function is marked no-see and another is marked sse. It could be for performance reason or for correctness reason. And these notes don't really tell whether using sse is more efficient or not. I'd prefer just keeping it simple. If these target function notes don't match, do not try to inline one into another. Evan > > > - > Devang > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From ofv at wanadoo.es Thu Oct 2 12:39:29 2008 From: ofv at wanadoo.es (Oscar Fuentes) Date: Thu, 02 Oct 2008 17:39:29 -0000 Subject: [llvm-commits] [llvm] r56957 - /llvm/trunk/lib/System/CMakeLists.txt Message-ID: <200810021739.m92HdTR5013394@zion.cs.uiuc.edu> Author: ofv Date: Thu Oct 2 12:39:29 2008 New Revision: 56957 URL: http://llvm.org/viewvc/llvm-project?rev=56957&view=rev Log: CMake: Added Host.cpp to lib/System/CMakeLists.txt. Modified: llvm/trunk/lib/System/CMakeLists.txt Modified: llvm/trunk/lib/System/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/CMakeLists.txt?rev=56957&r1=56956&r2=56957&view=diff ============================================================================== --- llvm/trunk/lib/System/CMakeLists.txt (original) +++ llvm/trunk/lib/System/CMakeLists.txt Thu Oct 2 12:39:29 2008 @@ -2,6 +2,7 @@ Alarm.cpp Disassembler.cpp DynamicLibrary.cpp + Host.cpp IncludeFile.cpp Memory.cpp Mutex.cpp From daniel at zuster.org Thu Oct 2 12:43:29 2008 From: daniel at zuster.org (Daniel Dunbar) Date: Thu, 2 Oct 2008 10:43:29 -0700 Subject: [llvm-commits] [llvm] r56942 - in /llvm/trunk: include/llvm/System/Host.h lib/System/Host.cpp lib/System/Unix/Host.inc lib/System/Win32/Host.inc In-Reply-To: <671CB2F6-E883-47D4-BA46-01B359B74BEC@apple.com> References: <200810020117.m921HSJ8005371@zion.cs.uiuc.edu> <200810021049.51723.baldrick@free.fr> <6a8523d60810020921y27ef8c4eyee02bafb75c22df7@mail.gmail.com> <671CB2F6-E883-47D4-BA46-01B359B74BEC@apple.com> Message-ID: <6a8523d60810021043p5dbceadcs349694d2882fd228@mail.gmail.com> Agreed. I'll add this to my TODO list, and drop the Host stuff when it is done. - Daniel On Thu, Oct 2, 2008 at 10:14 AM, Chris Lattner wrote: > > On Oct 2, 2008, at 9:21 AM, Daniel Dunbar wrote: > >> clang had a need to rewrite the OS portion of the target triple to >> that >> of the host in some situations, and I didn't want it to embed a uname >> call. >> >> Is your question related to the ambiguity of these queries? >> >> If you dislike this approach, perhaps a better one would be to add >> functionality to get the target-triple of the host machine? > > Just from the interface design perspective, I think it would make > sense to make this a "give me the host's target triple" interface. It > would be a lot easier to explain what it is supposed to do. > > -Chris > _______________________________________________ > 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 Thu Oct 2 13:29:28 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 02 Oct 2008 18:29:28 -0000 Subject: [llvm-commits] [llvm] r56959 - in /llvm/trunk: include/llvm/CodeGen/LinkAllCodegenComponents.h include/llvm/CodeGen/Passes.h lib/CodeGen/PBQP.cpp lib/CodeGen/PBQP.h lib/CodeGen/RegAllocPBQP.cpp Message-ID: <200810021829.m92ITS8x014885@zion.cs.uiuc.edu> Author: evancheng Date: Thu Oct 2 13:29:27 2008 New Revision: 56959 URL: http://llvm.org/viewvc/llvm-project?rev=56959&view=rev Log: A Partitioned Boolean Quadratic Programming (PBQP) based register allocator. Contributed by Lang Hames. Added: llvm/trunk/lib/CodeGen/PBQP.cpp llvm/trunk/lib/CodeGen/PBQP.h llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp Modified: llvm/trunk/include/llvm/CodeGen/LinkAllCodegenComponents.h llvm/trunk/include/llvm/CodeGen/Passes.h Modified: llvm/trunk/include/llvm/CodeGen/LinkAllCodegenComponents.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LinkAllCodegenComponents.h?rev=56959&r1=56958&r2=56959&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/LinkAllCodegenComponents.h (original) +++ llvm/trunk/include/llvm/CodeGen/LinkAllCodegenComponents.h Thu Oct 2 13:29:27 2008 @@ -35,6 +35,7 @@ (void) llvm::createLocalRegisterAllocator(); (void) llvm::createBigBlockRegisterAllocator(); (void) llvm::createLinearScanRegisterAllocator(); + (void) llvm::createPBQPRegisterAllocator(); (void) llvm::createSimpleRegisterCoalescer(); Modified: llvm/trunk/include/llvm/CodeGen/Passes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/Passes.h?rev=56959&r1=56958&r2=56959&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/Passes.h (original) +++ llvm/trunk/include/llvm/CodeGen/Passes.h Thu Oct 2 13:29:27 2008 @@ -110,6 +110,11 @@ /// FunctionPass *createLinearScanRegisterAllocator(); + /// PBQPRegisterAllocation Pass - This pass implements the Partitioned Boolean + /// Quadratic Prograaming (PBQP) based register allocator. + /// + FunctionPass *createPBQPRegisterAllocator(); + /// SimpleRegisterCoalescing Pass - Coalesce all copies possible. Can run /// independently of the register allocator. /// Added: llvm/trunk/lib/CodeGen/PBQP.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PBQP.cpp?rev=56959&view=auto ============================================================================== --- llvm/trunk/lib/CodeGen/PBQP.cpp (added) +++ llvm/trunk/lib/CodeGen/PBQP.cpp Thu Oct 2 13:29:27 2008 @@ -0,0 +1,1395 @@ +//===---------------- PBQP.cpp --------- PBQP Solver ------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// Developed by: Bernhard Scholz +// The Univesity of Sydney +// http://www.it.usyd.edu.au/~scholz +//===----------------------------------------------------------------------===// + + +#include +#include + +#include "PBQP.h" + +namespace llvm { + +/************************************************************************** + * Data Structures + **************************************************************************/ + +/* edge of PBQP graph */ +typedef struct adjnode { + struct adjnode *prev, /* doubly chained list */ + *succ, + *reverse; /* reverse edge */ + int adj; /* adj. node */ + PBQPMatrix *costs; /* cost matrix of edge */ + + bool tc_valid; /* flag whether following fields are valid */ + int *tc_safe_regs; /* safe registers */ + int tc_impact; /* impact */ +} adjnode; + +/* bucket node */ +typedef struct bucketnode { + struct bucketnode *prev; /* doubly chained list */ + struct bucketnode *succ; + int u; /* node */ +} bucketnode; + +/* data structure of partitioned boolean quadratic problem */ +struct pbqp { + int num_nodes; /* number of nodes */ + int max_deg; /* maximal degree of a node */ + bool solved; /* flag that indicates whether PBQP has been solved yet */ + bool optimal; /* flag that indicates whether PBQP is optimal */ + PBQPNum min; + bool changed; /* flag whether graph has changed in simplification */ + + /* node fields */ + PBQPVector **node_costs; /* cost vectors of nodes */ + int *node_deg; /* node degree of nodes */ + int *solution; /* solution for node */ + adjnode **adj_list; /* adj. list */ + bucketnode **bucket_ptr; /* bucket pointer of a node */ + + /* node stack */ + int *stack; /* stack of nodes */ + int stack_ptr; /* stack pointer */ + + /* bucket fields */ + bucketnode **bucket_list; /* bucket list */ + + int num_r0; /* counters for number statistics */ + int num_ri; + int num_rii; + int num_rn; + int num_rn_special; +}; + +bool isInf(PBQPNum n) { return n == std::numeric_limits::infinity(); } + +/***************************************************************************** + * allocation/de-allocation of pbqp problem + ****************************************************************************/ + +/* allocate new partitioned boolean quadratic program problem */ +pbqp *alloc_pbqp(int num_nodes) +{ + pbqp *this_; + int u; + + assert(num_nodes > 0); + + /* allocate memory for pbqp data structure */ + this_ = (pbqp *)malloc(sizeof(pbqp)); + + /* Initialize pbqp fields */ + this_->num_nodes = num_nodes; + this_->solved = false; + this_->optimal = true; + this_->min = 0.0; + this_->max_deg = 0; + this_->changed = false; + this_->num_r0 = 0; + this_->num_ri = 0; + this_->num_rii = 0; + this_->num_rn = 0; + this_->num_rn_special = 0; + + /* initialize/allocate stack fields of pbqp */ + this_->stack = (int *) malloc(sizeof(int)*num_nodes); + this_->stack_ptr = 0; + + /* initialize/allocate node fields of pbqp */ + this_->adj_list = (adjnode **) malloc(sizeof(adjnode *)*num_nodes); + this_->node_deg = (int *) malloc(sizeof(int)*num_nodes); + this_->solution = (int *) malloc(sizeof(int)*num_nodes); + this_->bucket_ptr = (bucketnode **) malloc(sizeof(bucketnode **)*num_nodes); + this_->node_costs = (PBQPVector**) malloc(sizeof(PBQPVector*) * num_nodes); + for(u=0;usolution[u]=-1; + this_->adj_list[u]=NULL; + this_->node_deg[u]=0; + this_->bucket_ptr[u]=NULL; + this_->node_costs[u]=NULL; + } + + /* initialize bucket list */ + this_->bucket_list = NULL; + + return this_; +} + +/* free pbqp problem */ +void free_pbqp(pbqp *this_) +{ + int u; + int deg; + adjnode *adj_ptr,*adj_next; + bucketnode *bucket,*bucket_next; + + assert(this_ != NULL); + + /* free node cost fields */ + for(u=0;u < this_->num_nodes;u++) { + delete this_->node_costs[u]; + } + free(this_->node_costs); + + /* free bucket list */ + for(deg=0;deg<=this_->max_deg;deg++) { + for(bucket=this_->bucket_list[deg];bucket!=NULL;bucket=bucket_next) { + this_->bucket_ptr[bucket->u] = NULL; + bucket_next = bucket-> succ; + free(bucket); + } + } + free(this_->bucket_list); + + /* free adj. list */ + assert(this_->adj_list != NULL); + for(u=0;u < this_->num_nodes; u++) { + for(adj_ptr = this_->adj_list[u]; adj_ptr != NULL; adj_ptr = adj_next) { + adj_next = adj_ptr -> succ; + if (u < adj_ptr->adj) { + assert(adj_ptr != NULL); + delete adj_ptr->costs; + } + if (adj_ptr -> tc_safe_regs != NULL) { + free(adj_ptr -> tc_safe_regs); + } + free(adj_ptr); + } + } + free(this_->adj_list); + + /* free other node fields */ + free(this_->node_deg); + free(this_->solution); + free(this_->bucket_ptr); + + /* free stack */ + free(this_->stack); + + /* free pbqp data structure itself */ + free(this_); +} + + +/**************************************************************************** + * adj. node routines + ****************************************************************************/ + +/* find data structure of adj. node of a given node */ +static +adjnode *find_adjnode(pbqp *this_,int u,int v) +{ + adjnode *adj_ptr; + + assert (this_ != NULL); + assert (u >= 0 && u < this_->num_nodes); + assert (v >= 0 && v < this_->num_nodes); + assert(this_->adj_list != NULL); + + for(adj_ptr = this_ -> adj_list[u];adj_ptr != NULL; adj_ptr = adj_ptr -> succ) { + if (adj_ptr->adj == v) { + return adj_ptr; + } + } + return NULL; +} + +/* allocate a new data structure for adj. node */ +static +adjnode *alloc_adjnode(pbqp *this_,int u, PBQPMatrix *costs) +{ + adjnode *p; + + assert(this_ != NULL); + assert(costs != NULL); + assert(u >= 0 && u < this_->num_nodes); + + p = (adjnode *)malloc(sizeof(adjnode)); + assert(p != NULL); + + p->adj = u; + p->costs = costs; + + p->tc_valid= false; + p->tc_safe_regs = NULL; + p->tc_impact = 0; + + return p; +} + +/* insert adjacence node to adj. list */ +static +void insert_adjnode(pbqp *this_, int u, adjnode *adj_ptr) +{ + + assert(this_ != NULL); + assert(adj_ptr != NULL); + assert(u >= 0 && u < this_->num_nodes); + + /* if adjacency list of node is not empty -> update + first node of the list */ + if (this_ -> adj_list[u] != NULL) { + assert(this_->adj_list[u]->prev == NULL); + this_->adj_list[u] -> prev = adj_ptr; + } + + /* update doubly chained list pointers of pointers */ + adj_ptr -> succ = this_->adj_list[u]; + adj_ptr -> prev = NULL; + + /* update adjacency list pointer of node u */ + this_->adj_list[u] = adj_ptr; +} + +/* remove entry in an adj. list */ +static +void remove_adjnode(pbqp *this_, int u, adjnode *adj_ptr) +{ + assert(this_!= NULL); + assert(u >= 0 && u <= this_->num_nodes); + assert(this_->adj_list != NULL); + assert(adj_ptr != NULL); + + if (adj_ptr -> prev == NULL) { + this_->adj_list[u] = adj_ptr -> succ; + } else { + adj_ptr -> prev -> succ = adj_ptr -> succ; + } + + if (adj_ptr -> succ != NULL) { + adj_ptr -> succ -> prev = adj_ptr -> prev; + } + + if(adj_ptr->reverse != NULL) { + adjnode *rev = adj_ptr->reverse; + rev->reverse = NULL; + } + + if (adj_ptr -> tc_safe_regs != NULL) { + free(adj_ptr -> tc_safe_regs); + } + + free(adj_ptr); +} + +/***************************************************************************** + * node functions + ****************************************************************************/ + +/* get degree of a node */ +static +int get_deg(pbqp *this_,int u) +{ + adjnode *adj_ptr; + int deg = 0; + + assert(this_ != NULL); + assert(u >= 0 && u < this_->num_nodes); + assert(this_->adj_list != NULL); + + for(adj_ptr = this_ -> adj_list[u];adj_ptr != NULL; adj_ptr = adj_ptr -> succ) { + deg ++; + } + return deg; +} + +/* reinsert node */ +static +void reinsert_node(pbqp *this_,int u) +{ + adjnode *adj_u, + *adj_v; + + assert(this_!= NULL); + assert(u >= 0 && u <= this_->num_nodes); + assert(this_->adj_list != NULL); + + for(adj_u = this_ -> adj_list[u]; adj_u != NULL; adj_u = adj_u -> succ) { + int v = adj_u -> adj; + adj_v = alloc_adjnode(this_,u,adj_u->costs); + insert_adjnode(this_,v,adj_v); + } +} + +/* remove node */ +static +void remove_node(pbqp *this_,int u) +{ + adjnode *adj_ptr; + + assert(this_!= NULL); + assert(u >= 0 && u <= this_->num_nodes); + assert(this_->adj_list != NULL); + + for(adj_ptr = this_ -> adj_list[u]; adj_ptr != NULL; adj_ptr = adj_ptr -> succ) { + remove_adjnode(this_,adj_ptr->adj,adj_ptr -> reverse); + } +} + +/***************************************************************************** + * edge functions + ****************************************************************************/ + +/* insert edge to graph */ +/* (does not check whether edge exists in graph */ +static +void insert_edge(pbqp *this_, int u, int v, PBQPMatrix *costs) +{ + adjnode *adj_u, + *adj_v; + + /* create adjanceny entry for u */ + adj_u = alloc_adjnode(this_,v,costs); + insert_adjnode(this_,u,adj_u); + + + /* create adjanceny entry for v */ + adj_v = alloc_adjnode(this_,u,costs); + insert_adjnode(this_,v,adj_v); + + /* create link for reverse edge */ + adj_u -> reverse = adj_v; + adj_v -> reverse = adj_u; +} + +/* delete edge */ +static +void delete_edge(pbqp *this_,int u,int v) +{ + adjnode *adj_ptr; + adjnode *rev; + + assert(this_ != NULL); + assert( u >= 0 && u < this_->num_nodes); + assert( v >= 0 && v < this_->num_nodes); + + adj_ptr=find_adjnode(this_,u,v); + assert(adj_ptr != NULL); + assert(adj_ptr->reverse != NULL); + + delete adj_ptr -> costs; + + rev = adj_ptr->reverse; + remove_adjnode(this_,u,adj_ptr); + remove_adjnode(this_,v,rev); +} + +/***************************************************************************** + * cost functions + ****************************************************************************/ + +/* Note: Since cost(u,v) = transpose(cost(v,u)), it would be necessary to store + two matrices for both edges (u,v) and (v,u). However, we only store the + matrix for the case u < v. For the other case we transpose the stored matrix + if required. +*/ + +/* add costs to cost vector of a node */ +void add_pbqp_nodecosts(pbqp *this_,int u, PBQPVector *costs) +{ + assert(this_ != NULL); + assert(costs != NULL); + assert(u >= 0 && u <= this_->num_nodes); + + if (!this_->node_costs[u]) { + this_->node_costs[u] = new PBQPVector(*costs); + } else { + *this_->node_costs[u] += *costs; + } +} + +/* get cost matrix ptr */ +static +PBQPMatrix *get_costmatrix_ptr(pbqp *this_, int u, int v) +{ + adjnode *adj_ptr; + PBQPMatrix *m = NULL; + + assert (this_ != NULL); + assert (u >= 0 && u < this_->num_nodes); + assert (v >= 0 && v < this_->num_nodes); + + adj_ptr = find_adjnode(this_,u,v); + + if (adj_ptr != NULL) { + m = adj_ptr -> costs; + } + + return m; +} + +/* get cost matrix ptr */ +/* Note: only the pointer is returned for + cost(u,v), if u < v. +*/ +static +PBQPMatrix *pbqp_get_costmatrix(pbqp *this_, int u, int v) +{ + adjnode *adj_ptr = find_adjnode(this_,u,v); + + if (adj_ptr != NULL) { + if ( u < v) { + return new PBQPMatrix(*adj_ptr->costs); + } else { + return new PBQPMatrix(adj_ptr->costs->transpose()); + } + } else { + return NULL; + } +} + +/* add costs to cost matrix of an edge */ +void add_pbqp_edgecosts(pbqp *this_,int u,int v, PBQPMatrix *costs) +{ + PBQPMatrix *adj_costs; + + assert(this_!= NULL); + assert(costs != NULL); + assert(u >= 0 && u <= this_->num_nodes); + assert(v >= 0 && v <= this_->num_nodes); + + /* does the edge u-v exists ? */ + if (u == v) { + PBQPVector *diag = new PBQPVector(costs->diagonalize()); + add_pbqp_nodecosts(this_,v,diag); + delete diag; + } else if ((adj_costs = get_costmatrix_ptr(this_,u,v))!=NULL) { + if ( u < v) { + *adj_costs += *costs; + } else { + *adj_costs += costs->transpose(); + } + } else { + adj_costs = new PBQPMatrix((u < v) ? *costs : costs->transpose()); + insert_edge(this_,u,v,adj_costs); + } +} + +/* remove bucket from bucket list */ +static +void pbqp_remove_bucket(pbqp *this_, bucketnode *bucket) +{ + int u = bucket->u; + + assert(this_ != NULL); + assert(u >= 0 && u < this_->num_nodes); + assert(this_->bucket_list != NULL); + assert(this_->bucket_ptr[u] != NULL); + + /* update predecessor node in bucket list + (if no preceeding bucket exists, then + the bucket_list pointer needs to be + updated.) + */ + if (bucket->prev != NULL) { + bucket->prev-> succ = bucket->succ; + } else { + this_->bucket_list[this_->node_deg[u]] = bucket -> succ; + } + + /* update successor node in bucket list */ + if (bucket->succ != NULL) { + bucket->succ-> prev = bucket->prev; + } +} + +/********************************************************************************** + * pop functions + **********************************************************************************/ + +/* pop node of given degree */ +static +int pop_node(pbqp *this_,int deg) +{ + bucketnode *bucket; + int u; + + assert(this_ != NULL); + assert(deg >= 0 && deg <= this_->max_deg); + assert(this_->bucket_list != NULL); + + /* get first bucket of bucket list */ + bucket = this_->bucket_list[deg]; + assert(bucket != NULL); + + /* remove bucket */ + pbqp_remove_bucket(this_,bucket); + u = bucket->u; + free(bucket); + return u; +} + +/********************************************************************************** + * reorder functions + **********************************************************************************/ + +/* add bucket to bucketlist */ +static +void add_to_bucketlist(pbqp *this_,bucketnode *bucket, int deg) +{ + bucketnode *old_head; + + assert(bucket != NULL); + assert(this_ != NULL); + assert(deg >= 0 && deg <= this_->max_deg); + assert(this_->bucket_list != NULL); + + /* store node degree (for re-ordering purposes)*/ + this_->node_deg[bucket->u] = deg; + + /* put bucket to front of doubly chained list */ + old_head = this_->bucket_list[deg]; + bucket -> prev = NULL; + bucket -> succ = old_head; + this_ -> bucket_list[deg] = bucket; + if (bucket -> succ != NULL ) { + assert ( old_head -> prev == NULL); + old_head -> prev = bucket; + } +} + + +/* reorder node in bucket list according to + current node degree */ +static +void reorder_node(pbqp *this_, int u) +{ + int deg; + + assert(this_ != NULL); + assert(u>= 0 && u < this_->num_nodes); + assert(this_->bucket_list != NULL); + assert(this_->bucket_ptr[u] != NULL); + + /* get current node degree */ + deg = get_deg(this_,u); + + /* remove bucket from old bucket list only + if degree of node has changed. */ + if (deg != this_->node_deg[u]) { + pbqp_remove_bucket(this_,this_->bucket_ptr[u]); + add_to_bucketlist(this_,this_->bucket_ptr[u],deg); + } +} + +/* reorder adj. nodes of a node */ +static +void reorder_adjnodes(pbqp *this_,int u) +{ + adjnode *adj_ptr; + + assert(this_!= NULL); + assert(u >= 0 && u <= this_->num_nodes); + assert(this_->adj_list != NULL); + + for(adj_ptr = this_ -> adj_list[u]; adj_ptr != NULL; adj_ptr = adj_ptr -> succ) { + reorder_node(this_,adj_ptr->adj); + } +} + +/********************************************************************************** + * creation functions + **********************************************************************************/ + +/* create new bucket entry */ +/* consistency of the bucket list is not checked! */ +static +void create_bucket(pbqp *this_,int u,int deg) +{ + bucketnode *bucket; + + assert(this_ != NULL); + assert(u >= 0 && u < this_->num_nodes); + assert(this_->bucket_list != NULL); + + bucket = (bucketnode *)malloc(sizeof(bucketnode)); + assert(bucket != NULL); + + bucket -> u = u; + this_->bucket_ptr[u] = bucket; + + add_to_bucketlist(this_,bucket,deg); +} + +/* create bucket list */ +static +void create_bucketlist(pbqp *this_) +{ + int u; + int max_deg; + int deg; + + assert(this_ != NULL); + assert(this_->bucket_list == NULL); + + /* determine max. degree of the nodes */ + max_deg = 2; /* at least of degree two! */ + for(u=0;unum_nodes;u++) { + deg = this_->node_deg[u] = get_deg(this_,u); + if (deg > max_deg) { + max_deg = deg; + } + } + this_->max_deg = max_deg; + + /* allocate bucket list */ + this_ -> bucket_list = (bucketnode **)malloc(sizeof(bucketnode *)*(max_deg + 1)); + memset(this_->bucket_list,0,sizeof(bucketnode *)*(max_deg + 1)); + assert(this_->bucket_list != NULL); + + /* insert nodes to the list */ + for(u=0;unum_nodes;u++) { + create_bucket(this_,u,this_->node_deg[u]); + } +} + +/***************************************************************************** + * PBQP simplification for trivial nodes + ****************************************************************************/ + +/* remove trivial node with cost vector length of one */ +static +void disconnect_trivialnode(pbqp *this_,int u) +{ + int v; + adjnode *adj_ptr, + *next; + PBQPMatrix *c_uv; + PBQPVector *c_v; + + assert(this_ != NULL); + assert(this_->node_costs != NULL); + assert(u >= 0 && u < this_ -> num_nodes); + assert(this_->node_costs[u]->getLength() == 1); + + /* add edge costs to node costs of adj. nodes */ + for(adj_ptr = this_->adj_list[u]; adj_ptr != NULL; adj_ptr = next){ + next = adj_ptr -> succ; + v = adj_ptr -> adj; + assert(v >= 0 && v < this_ -> num_nodes); + + /* convert matrix to cost vector offset for adj. node */ + c_uv = pbqp_get_costmatrix(this_,u,v); + c_v = new PBQPVector(c_uv->getRowAsVector(0)); + *this_->node_costs[v] += *c_v; + + /* delete edge & free vec/mat */ + delete c_v; + delete c_uv; + delete_edge(this_,u,v); + } +} + +/* find all trivial nodes and disconnect them */ +static +void eliminate_trivial_nodes(pbqp *this_) +{ + int u; + + assert(this_ != NULL); + assert(this_ -> node_costs != NULL); + + for(u=0;u < this_ -> num_nodes; u++) { + if (this_->node_costs[u]->getLength() == 1) { + disconnect_trivialnode(this_,u); + } + } +} + +/***************************************************************************** + * Normal form for PBQP + ****************************************************************************/ + +/* simplify a cost matrix. If the matrix + is independent, then simplify_matrix + returns true - otherwise false. In + vectors u and v the offset values of + the decomposition are stored. +*/ + +static +bool normalize_matrix(PBQPMatrix *m, PBQPVector *u, PBQPVector *v) +{ + assert( m != NULL); + assert( u != NULL); + assert( v != NULL); + assert( u->getLength() > 0); + assert( v->getLength() > 0); + + assert(m->getRows() == u->getLength()); + assert(m->getCols() == v->getLength()); + + /* determine u vector */ + for(unsigned r = 0; r < m->getRows(); ++r) { + PBQPNum min = m->getRowMin(r); + (*u)[r] += min; + if (!isInf(min)) { + m->subFromRow(r, min); + } else { + m->setRow(r, 0); + } + } + + /* determine v vector */ + for(unsigned c = 0; c < m->getCols(); ++c) { + PBQPNum min = m->getColMin(c); + (*v)[c] += min; + if (!isInf(min)) { + m->subFromCol(c, min); + } else { + m->setCol(c, 0); + } + } + + /* determine whether matrix is + independent or not. + */ + return m->isZero(); +} + +/* simplify single edge */ +static +void simplify_edge(pbqp *this_,int u,int v) +{ + PBQPMatrix *costs; + bool is_zero; + + assert (this_ != NULL); + assert (u >= 0 && u num_nodes); + assert (v >= 0 && v num_nodes); + assert (u != v); + + /* swap u and v if u > v in order to avoid un-necessary + tranpositions of the cost matrix */ + + if (u > v) { + int swap = u; + u = v; + v = swap; + } + + /* get cost matrix and simplify it */ + costs = get_costmatrix_ptr(this_,u,v); + is_zero=normalize_matrix(costs,this_->node_costs[u],this_->node_costs[v]); + + /* delete edge */ + if(is_zero){ + delete_edge(this_,u,v); + this_->changed = true; + } +} + +/* normalize cost matrices and remove + edges in PBQP if they ary independent, + i.e. can be decomposed into two + cost vectors. +*/ +static +void eliminate_independent_edges(pbqp *this_) +{ + int u,v; + adjnode *adj_ptr,*next; + + assert(this_ != NULL); + assert(this_ -> adj_list != NULL); + + this_->changed = false; + for(u=0;u < this_->num_nodes;u++) { + for (adj_ptr = this_ -> adj_list[u]; adj_ptr != NULL; adj_ptr = next) { + next = adj_ptr -> succ; + v = adj_ptr -> adj; + assert(v >= 0 && v < this_->num_nodes); + if (u < v) { + simplify_edge(this_,u,v); + } + } + } +} + + +/***************************************************************************** + * PBQP reduction rules + ****************************************************************************/ + +/* RI reduction + This reduction rule is applied for nodes + of degree one. */ + +static +void apply_RI(pbqp *this_,int x) +{ + int y; + unsigned xlen, + ylen; + PBQPMatrix *c_yx; + PBQPVector *c_x, *delta; + + assert(this_ != NULL); + assert(x >= 0 && x < this_->num_nodes); + assert(this_ -> adj_list[x] != NULL); + assert(this_ -> adj_list[x] -> succ == NULL); + + /* get adjacence matrix */ + y = this_ -> adj_list[x] -> adj; + assert(y >= 0 && y < this_->num_nodes); + + /* determine length of cost vectors for node x and y */ + xlen = this_ -> node_costs[x]->getLength(); + ylen = this_ -> node_costs[y]->getLength(); + + /* get cost vector c_x and matrix c_yx */ + c_x = this_ -> node_costs[x]; + c_yx = pbqp_get_costmatrix(this_,y,x); + assert (c_yx != NULL); + + + /* allocate delta vector */ + delta = new PBQPVector(ylen); + + /* compute delta vector */ + for(unsigned i = 0; i < ylen; ++i) { + PBQPNum min = (*c_yx)[i][0] + (*c_x)[0]; + for(unsigned j = 1; j < xlen; ++j) { + PBQPNum c = (*c_yx)[i][j] + (*c_x)[j]; + if ( c < min ) + min = c; + } + (*delta)[i] = min; + } + + /* add delta vector */ + *this_ -> node_costs[y] += *delta; + + /* delete node x */ + remove_node(this_,x); + + /* reorder adj. nodes of node x */ + reorder_adjnodes(this_,x); + + /* push node x on stack */ + assert(this_ -> stack_ptr < this_ -> num_nodes); + this_->stack[this_ -> stack_ptr++] = x; + + /* free vec/mat */ + delete c_yx; + delete delta; + + /* increment counter for number statistic */ + this_->num_ri++; +} + +/* RII reduction + This reduction rule is applied for nodes + of degree two. */ + +static +void apply_RII(pbqp *this_,int x) +{ + int y,z; + unsigned xlen,ylen,zlen; + adjnode *adj_yz; + + PBQPMatrix *c_yx, *c_zx; + PBQPVector *cx; + PBQPMatrix *delta; + + assert(this_ != NULL); + assert(x >= 0 && x < this_->num_nodes); + assert(this_ -> adj_list[x] != NULL); + assert(this_ -> adj_list[x] -> succ != NULL); + assert(this_ -> adj_list[x] -> succ -> succ == NULL); + + /* get adjacence matrix */ + y = this_ -> adj_list[x] -> adj; + z = this_ -> adj_list[x] -> succ -> adj; + assert(y >= 0 && y < this_->num_nodes); + assert(z >= 0 && z < this_->num_nodes); + + /* determine length of cost vectors for node x and y */ + xlen = this_ -> node_costs[x]->getLength(); + ylen = this_ -> node_costs[y]->getLength(); + zlen = this_ -> node_costs[z]->getLength(); + + /* get cost vector c_x and matrix c_yx */ + cx = this_ -> node_costs[x]; + c_yx = pbqp_get_costmatrix(this_,y,x); + c_zx = pbqp_get_costmatrix(this_,z,x); + assert(c_yx != NULL); + assert(c_zx != NULL); + + /* Colour Heuristic */ + if ( (adj_yz = find_adjnode(this_,y,z)) != NULL) { + adj_yz->tc_valid = false; + adj_yz->reverse->tc_valid = false; + } + + /* allocate delta matrix */ + delta = new PBQPMatrix(ylen, zlen); + + /* compute delta matrix */ + for(unsigned i=0;i stack_ptr < this_ -> num_nodes); + this_->stack[this_ -> stack_ptr++] = x; + + /* free vec/mat */ + delete c_yx; + delete c_zx; + delete delta; + + /* increment counter for number statistic */ + this_->num_rii++; + +} + +/* RN reduction */ +static +void apply_RN(pbqp *this_,int x) +{ + unsigned xlen; + + assert(this_ != NULL); + assert(x >= 0 && x < this_->num_nodes); + assert(this_ -> node_costs[x] != NULL); + + xlen = this_ -> node_costs[x] -> getLength(); + + /* after application of RN rule no optimality + can be guaranteed! */ + this_ -> optimal = false; + + /* push node x on stack */ + assert(this_ -> stack_ptr < this_ -> num_nodes); + this_->stack[this_ -> stack_ptr++] = x; + + /* delete node x */ + remove_node(this_,x); + + /* reorder adj. nodes of node x */ + reorder_adjnodes(this_,x); + + /* increment counter for number statistic */ + this_->num_rn++; +} + + +static +void compute_tc_info(pbqp *this_, adjnode *p) +{ + adjnode *r; + PBQPMatrix *m; + int x,y; + PBQPVector *c_x, *c_y; + int *row_inf_counts; + + assert(p->reverse != NULL); + + /* set flags */ + r = p->reverse; + p->tc_valid = true; + r->tc_valid = true; + + /* get edge */ + x = r->adj; + y = p->adj; + + /* get cost vectors */ + c_x = this_ -> node_costs[x]; + c_y = this_ -> node_costs[y]; + + /* get cost matrix */ + m = pbqp_get_costmatrix(this_, x, y); + + + /* allocate allowed set for edge (x,y) and (y,x) */ + if (p->tc_safe_regs == NULL) { + p->tc_safe_regs = (int *) malloc(sizeof(int) * c_x->getLength()); + } + + if (r->tc_safe_regs == NULL ) { + r->tc_safe_regs = (int *) malloc(sizeof(int) * c_y->getLength()); + } + + p->tc_impact = r->tc_impact = 0; + + row_inf_counts = (int *) alloca(sizeof(int) * c_x->getLength()); + + /* init arrays */ + p->tc_safe_regs[0] = 0; + row_inf_counts[0] = 0; + for(unsigned i = 1; i < c_x->getLength(); ++i){ + p->tc_safe_regs[i] = 1; + row_inf_counts[i] = 0; + } + + r->tc_safe_regs[0] = 0; + for(unsigned j = 1; j < c_y->getLength(); ++j){ + r->tc_safe_regs[j] = 1; + } + + for(unsigned j = 0; j < c_y->getLength(); ++j) { + int col_inf_counts = 0; + for (unsigned i = 0; i < c_x->getLength(); ++i) { + if (isInf((*m)[i][j])) { + ++col_inf_counts; + ++row_inf_counts[i]; + + p->tc_safe_regs[i] = 0; + r->tc_safe_regs[j] = 0; + } + } + if (col_inf_counts > p->tc_impact) { + p->tc_impact = col_inf_counts; + } + } + + for(unsigned i = 0; i < c_x->getLength(); ++i){ + if (row_inf_counts[i] > r->tc_impact) + { + r->tc_impact = row_inf_counts[i]; + } + } + + delete m; +} + +/* + * Checks whether node x can be locally coloured. + */ +static +int is_colorable(pbqp *this_,int x) +{ + adjnode *adj_ptr; + PBQPVector *c_x; + int result = 1; + int *allowed; + int num_allowed = 0; + unsigned total_impact = 0; + + assert(this_ != NULL); + assert(x >= 0 && x < this_->num_nodes); + assert(this_ -> node_costs[x] != NULL); + + c_x = this_ -> node_costs[x]; + + /* allocate allowed set */ + allowed = (int *)malloc(sizeof(int) * c_x->getLength()); + for(unsigned i = 0; i < c_x->getLength(); ++i){ + if (!isInf((*c_x)[i]) && i > 0) { + allowed[i] = 1; + ++num_allowed; + } else { + allowed[i] = 0; + } + } + + /* determine local minimum */ + for(adj_ptr=this_->adj_list[x] ;adj_ptr != NULL; adj_ptr = adj_ptr -> succ) { + if (!adj_ptr -> tc_valid) { + compute_tc_info(this_, adj_ptr); + } + + total_impact += adj_ptr->tc_impact; + + if (num_allowed > 0) { + for (unsigned i = 1; i < c_x->getLength(); ++i){ + if (allowed[i]){ + if (!adj_ptr->tc_safe_regs[i]){ + allowed[i] = 0; + --num_allowed; + if (num_allowed == 0) + break; + } + } + } + } + + if ( total_impact >= c_x->getLength() - 1 && num_allowed == 0 ) { + result = 0; + break; + } + } + free(allowed); + + return result; +} + +/* use briggs heuristic + note: this_ is not a general heuristic. it only is useful for + interference graphs. + */ +int pop_colorablenode(pbqp *this_) +{ + int deg; + bucketnode *min_bucket=NULL; + PBQPNum min = std::numeric_limits::infinity(); + + /* select node where the number of colors is less than the node degree */ + for(deg=this_->max_deg;deg > 2;deg--) { + bucketnode *bucket; + for(bucket=this_->bucket_list[deg];bucket!= NULL;bucket = bucket -> succ) { + int u = bucket->u; + if (is_colorable(this_,u)) { + pbqp_remove_bucket(this_,bucket); + this_->num_rn_special++; + free(bucket); + return u; + } + } + } + + /* select node with minimal ratio between average node costs and degree of node */ + for(deg=this_->max_deg;deg >2; deg--) { + bucketnode *bucket; + for(bucket=this_->bucket_list[deg];bucket!= NULL;bucket = bucket -> succ) { + PBQPNum h; + int u; + + u = bucket->u; + assert(u>=0 && u < this_->num_nodes); + h = (*this_->node_costs[u])[0] / (PBQPNum) deg; + if (h < min) { + min_bucket = bucket; + min = h;