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; + } + } + } + + /* return node and free bucket */ + if (min_bucket != NULL) { + int u; + + pbqp_remove_bucket(this_,min_bucket); + u = min_bucket->u; + free(min_bucket); + return u; + } else { + return -1; + } +} + + +/***************************************************************************** + * PBQP graph parsing + ****************************************************************************/ + +/* reduce pbqp problem (first phase) */ +static +void reduce_pbqp(pbqp *this_) +{ + int u; + + assert(this_ != NULL); + assert(this_->bucket_list != NULL); + + for(;;){ + + if (this_->bucket_list[1] != NULL) { + u = pop_node(this_,1); + apply_RI(this_,u); + } else if (this_->bucket_list[2] != NULL) { + u = pop_node(this_,2); + apply_RII(this_,u); + } else if ((u = pop_colorablenode(this_)) != -1) { + apply_RN(this_,u); + } else { + break; + } + } +} + +/***************************************************************************** + * PBQP back propagation + ****************************************************************************/ + +/* determine solution of a reduced node. Either + RI or RII was applied for this_ node. */ +static +void determine_solution(pbqp *this_,int x) +{ + PBQPVector *v = new PBQPVector(*this_ -> node_costs[x]); + adjnode *adj_ptr; + + assert(this_ != NULL); + assert(x >= 0 && x < this_->num_nodes); + assert(this_ -> adj_list != NULL); + assert(this_ -> solution != NULL); + + for(adj_ptr=this_->adj_list[x] ;adj_ptr != NULL; adj_ptr = adj_ptr -> succ) { + int y = adj_ptr -> adj; + int y_sol = this_ -> solution[y]; + + PBQPMatrix *c_yx = pbqp_get_costmatrix(this_,y,x); + assert(y_sol >= 0 && y_sol < (int)this_->node_costs[y]->getLength()); + (*v) += c_yx->getRowAsVector(y_sol); + delete c_yx; + } + this_ -> solution[x] = v->minIndex(); + + delete v; +} + +/* back popagation phase of PBQP */ +static +void back_propagate(pbqp *this_) +{ + int i; + + assert(this_ != NULL); + assert(this_->stack != NULL); + assert(this_->stack_ptr < this_->num_nodes); + + for(i=this_ -> stack_ptr-1;i>=0;i--) { + int x = this_ -> stack[i]; + assert( x >= 0 && x < this_ -> num_nodes); + reinsert_node(this_,x); + determine_solution(this_,x); + } +} + +/* solve trivial nodes of degree zero */ +static +void determine_trivialsolution(pbqp *this_) +{ + int u; + PBQPNum delta; + + assert( this_ != NULL); + assert( this_ -> bucket_list != NULL); + + /* determine trivial solution */ + while (this_->bucket_list[0] != NULL) { + u = pop_node(this_,0); + + assert( u >= 0 && u < this_ -> num_nodes); + + this_->solution[u] = this_->node_costs[u]->minIndex(); + delta = (*this_->node_costs[u])[this_->solution[u]]; + this_->min = this_->min + delta; + + /* increment counter for number statistic */ + this_->num_r0++; + } +} + +/***************************************************************************** + * debug facilities + ****************************************************************************/ +static +void check_pbqp(pbqp *this_) +{ + int u,v; + PBQPMatrix *costs; + adjnode *adj_ptr; + + assert( this_ != NULL); + + for(u=0;u< this_->num_nodes; u++) { + assert (this_ -> node_costs[u] != NULL); + for(adj_ptr = this_ -> adj_list[u];adj_ptr != NULL; adj_ptr = adj_ptr -> succ) { + v = adj_ptr -> adj; + assert( v>= 0 && v < this_->num_nodes); + if (u < v ) { + costs = adj_ptr -> costs; + assert( costs->getRows() == this_->node_costs[u]->getLength() && + costs->getCols() == this_->node_costs[v]->getLength()); + } + } + } +} + +/***************************************************************************** + * PBQP solve routines + ****************************************************************************/ + +/* solve PBQP problem */ +void solve_pbqp(pbqp *this_) +{ + assert(this_ != NULL); + assert(!this_->solved); + + /* check vector & matrix dimensions */ + check_pbqp(this_); + + /* simplify PBQP problem */ + + /* eliminate trivial nodes, i.e. + nodes with cost vectors of length one. */ + eliminate_trivial_nodes(this_); + + /* eliminate edges with independent + cost matrices and normalize matrices */ + eliminate_independent_edges(this_); + + /* create bucket list for graph parsing */ + create_bucketlist(this_); + + /* reduce phase */ + reduce_pbqp(this_); + + /* solve trivial nodes */ + determine_trivialsolution(this_); + + /* back propagation phase */ + back_propagate(this_); + + this_->solved = true; +} + +/* get solution of a node */ +int get_pbqp_solution(pbqp *this_,int x) +{ + assert(this_ != NULL); + assert(this_->solution != NULL); + assert(this_ -> solved); + + return this_->solution[x]; +} + +/* is solution optimal? */ +bool is_pbqp_optimal(pbqp *this_) +{ + assert(this_ -> solved); + return this_->optimal; +} + +} + +/* end of pbqp.c */ Added: llvm/trunk/lib/CodeGen/PBQP.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PBQP.h?rev=56959&view=auto ============================================================================== --- llvm/trunk/lib/CodeGen/PBQP.h (added) +++ llvm/trunk/lib/CodeGen/PBQP.h Thu Oct 2 13:29:27 2008 @@ -0,0 +1,284 @@ +//===---------------- 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 +//===----------------------------------------------------------------------===// + +// TODO: +// +// * Default to null costs on vector initialisation? +// * C++-ify the rest of the solver. + +#ifndef LLVM_CODEGEN_PBQPSOLVER_H +#define LLVM_CODEGEN_PBQPSOLVER_H + +#include +#include +#include + +namespace llvm { + +//! \brief Floating point type to use in PBQP solver. +typedef double PBQPNum; + +//! \brief PBQP Vector class. +class PBQPVector { +public: + + //! \brief Construct a PBQP vector of the given size. + explicit PBQPVector(unsigned length) : + length(length), data(new PBQPNum[length]) { + std::fill(data, data + length, 0); + } + + //! \brief Copy construct a PBQP vector. + PBQPVector(const PBQPVector &v) : + length(v.length), data(new PBQPNum[length]) { + std::copy(v.data, v.data + length, data); + } + + ~PBQPVector() { delete[] data; } + + //! \brief Assignment operator. + PBQPVector& operator=(const PBQPVector &v) { + delete[] data; + length = v.length; + data = new PBQPNum[length]; + std::copy(v.data, v.data + length, data); + return *this; + } + + //! \brief Return the length of the vector + unsigned getLength() const throw () { + return length; + } + + //! \brief Element access. + PBQPNum& operator[](unsigned index) { + assert(index < length && "PBQPVector element access out of bounds."); + return data[index]; + } + + //! \brief Const element access. + const PBQPNum& operator[](unsigned index) const { + assert(index < length && "PBQPVector element access out of bounds."); + return data[index]; + } + + //! \brief Add another vector to this one. + PBQPVector& operator+=(const PBQPVector &v) { + assert(length == v.length && "PBQPVector length mismatch."); + std::transform(data, data + length, v.data, data, std::plus()); + return *this; + } + + //! \brief Subtract another vector from this one. + PBQPVector& operator-=(const PBQPVector &v) { + assert(length == v.length && "PBQPVector length mismatch."); + std::transform(data, data + length, v.data, data, std::minus()); + return *this; + } + + //! \brief Returns the index of the minimum value in this vector + unsigned minIndex() const { + return std::min_element(data, data + length) - data; + } + +private: + unsigned length; + PBQPNum *data; +}; + + +//! \brief PBQP Matrix class +class PBQPMatrix { +public: + + //! \brief Construct a PBQP Matrix with the given dimensions. + PBQPMatrix(unsigned rows, unsigned cols) : + rows(rows), cols(cols), data(new PBQPNum[rows * cols]) { + std::fill(data, data + (rows * cols), 0); + } + + //! \brief Copy construct a PBQP matrix. + PBQPMatrix(const PBQPMatrix &m) : + rows(m.rows), cols(m.cols), data(new PBQPNum[rows * cols]) { + std::copy(m.data, m.data + (rows * cols), data); + } + + ~PBQPMatrix() { delete[] data; } + + //! \brief Assignment operator. + PBQPMatrix& operator=(const PBQPMatrix &m) { + delete[] data; + rows = m.rows; cols = m.cols; + data = new PBQPNum[rows * cols]; + std::copy(m.data, m.data + (rows * cols), data); + return *this; + } + + //! \brief Return the number of rows in this matrix. + unsigned getRows() const throw () { return rows; } + + //! \brief Return the number of cols in this matrix. + unsigned getCols() const throw () { return cols; } + + //! \brief Matrix element access. + PBQPNum* operator[](unsigned r) { + assert(r < rows && "Row out of bounds."); + return data + (r * cols); + } + + //! \brief Matrix element access. + const PBQPNum* operator[](unsigned r) const { + assert(r < rows && "Row out of bounds."); + return data + (r * cols); + } + + //! \brief Returns the given row as a vector. + PBQPVector getRowAsVector(unsigned r) const { + PBQPVector v(cols); + for (unsigned c = 0; c < cols; ++c) + v[c] = (*this)[r][c]; + return v; + } + + //! \brief Reset the matrix to the given value. + PBQPMatrix& reset(PBQPNum val = 0) { + std::fill(data, data + (rows * cols), val); + return *this; + } + + //! \brief Set a single row of this matrix to the given value. + PBQPMatrix& setRow(unsigned r, PBQPNum val) { + assert(r < rows && "Row out of bounds."); + std::fill(data + (r * cols), data + ((r + 1) * cols), val); + return *this; + } + + //! \brief Set a single column of this matrix to the given value. + PBQPMatrix& setCol(unsigned c, PBQPNum val) { + assert(c < cols && "Column out of bounds."); + for (unsigned r = 0; r < rows; ++r) + (*this)[r][c] = val; + return *this; + } + + //! \brief Matrix transpose. + PBQPMatrix transpose() const { + PBQPMatrix m(cols, rows); + for (unsigned r = 0; r < rows; ++r) + for (unsigned c = 0; c < cols; ++c) + m[c][r] = (*this)[r][c]; + return m; + } + + //! \brief Returns the diagonal of the matrix as a vector. + //! + //! Matrix must be square. + PBQPVector diagonalize() const { + assert(rows == cols && "Attempt to diagonalize non-square matrix."); + + PBQPVector v(rows); + for (unsigned r = 0; r < rows; ++r) + v[r] = (*this)[r][r]; + return v; + } + + //! \brief Add the given matrix to this one. + PBQPMatrix& operator+=(const PBQPMatrix &m) { + assert(rows == m.rows && cols == m.cols && + "Matrix dimensions mismatch."); + std::transform(data, data + (rows * cols), m.data, data, + std::plus()); + return *this; + } + + //! \brief Returns the minimum of the given row + PBQPNum getRowMin(unsigned r) const { + assert(r < rows && "Row out of bounds"); + return *std::min_element(data + (r * cols), data + ((r + 1) * cols)); + } + + //! \brief Returns the minimum of the given column + PBQPNum getColMin(unsigned c) const { + PBQPNum minElem = (*this)[0][c]; + for (unsigned r = 1; r < rows; ++r) + if ((*this)[r][c] < minElem) minElem = (*this)[r][c]; + return minElem; + } + + //! \brief Subtracts the given scalar from the elements of the given row. + PBQPMatrix& subFromRow(unsigned r, PBQPNum val) { + assert(r < rows && "Row out of bounds"); + std::transform(data + (r * cols), data + ((r + 1) * cols), + data + (r * cols), + std::bind2nd(std::minus(), val)); + return *this; + } + + //! \brief Subtracts the given scalar from the elements of the given column. + PBQPMatrix& subFromCol(unsigned c, PBQPNum val) { + for (unsigned r = 0; r < rows; ++r) + (*this)[r][c] -= val; + return *this; + } + + //! \brief Returns true if this is a zero matrix. + bool isZero() const { + return find_if(data, data + (rows * cols), + std::bind2nd(std::not_equal_to(), 0)) == + data + (rows * cols); + } + +private: + unsigned rows, cols; + PBQPNum *data; +}; + +#define EPS (1E-8) + +#ifndef PBQP_TYPE +#define PBQP_TYPE +struct pbqp; +typedef struct pbqp pbqp; +#endif + +/***************** + * PBQP routines * + *****************/ + +/* allocate pbqp problem */ +pbqp *alloc_pbqp(int num); + +/* add node costs */ +void add_pbqp_nodecosts(pbqp *this_,int u, PBQPVector *costs); + +/* add edge mat */ +void add_pbqp_edgecosts(pbqp *this_,int u,int v,PBQPMatrix *costs); + +/* solve PBQP problem */ +void solve_pbqp(pbqp *this_); + +/* get solution of a node */ +int get_pbqp_solution(pbqp *this_,int u); + +/* alloc PBQP */ +pbqp *alloc_pbqp(int num); + +/* free PBQP */ +void free_pbqp(pbqp *this_); + +/* is optimal */ +bool is_pbqp_optimal(pbqp *this_); + +} +#endif Added: llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp?rev=56959&view=auto ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp (added) +++ llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp Thu Oct 2 13:29:27 2008 @@ -0,0 +1,529 @@ +//===------ RegAllocPBQP.cpp ---- PBQP Register Allocator -------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file contains a Partitioned Boolean Quadratic Programming (PBQP) based +// register allocator for LLVM. This allocator works by constructing a PBQP +// problem representing the register allocation problem under consideration, +// solving this using a PBQP solver, and mapping the solution back to a +// register assignment. If any variables are selected for spilling then spill +// code is inserted and the process repeated. +// +// The PBQP solver (pbqp.c) provided for this allocator uses a heuristic tuned +// for register allocation. For more information on PBQP for register +// allocation see the following papers: +// +// (1) Hames, L. and Scholz, B. 2006. Nearly optimal register allocation with +// PBQP. In Proceedings of the 7th Joint Modular Languages Conference +// (JMLC'06). LNCS, vol. 4228. Springer, New York, NY, USA. 346-361. +// +// (2) Scholz, B., Eckstein, E. 2002. Register allocation for irregular +// architectures. In Proceedings of the Joint Conference on Languages, +// Compilers and Tools for Embedded Systems (LCTES'02), ACM Press, New York, +// NY, USA, 139-148. +// +// Author: Lang Hames +// Email: lhames at gmail.com +// +//===----------------------------------------------------------------------===// + +// TODO: +// +// * Use of std::set in constructPBQPProblem destroys allocation order preference. +// Switch to an order preserving container. +// +// * Coalescing support. + +#define DEBUG_TYPE "regalloc" + +#include "PBQP.h" +#include "VirtRegMap.h" +#include "llvm/CodeGen/MachineFunctionPass.h" +#include "llvm/CodeGen/RegAllocRegistry.h" +#include "llvm/CodeGen/LiveIntervalAnalysis.h" +#include "llvm/CodeGen/MachineRegisterInfo.h" +#include "llvm/CodeGen/MachineLoopInfo.h" +#include "llvm/Target/TargetMachine.h" +#include "llvm/Target/TargetInstrInfo.h" +#include "llvm/Support/Debug.h" +#include +#include +#include +#include +#include + +using namespace llvm; + +static RegisterRegAlloc +registerPBQPRepAlloc("pbqp", " PBQP register allocator", + createPBQPRegisterAllocator); + + +namespace { + + //! + //! PBQP based allocators solve the register allocation problem by mapping + //! register allocation problems to Partitioned Boolean Quadratic + //! Programming problems. + class VISIBILITY_HIDDEN PBQPRegAlloc : public MachineFunctionPass { + public: + + static char ID; + + //! Construct a PBQP register allocator. + PBQPRegAlloc() : MachineFunctionPass((intptr_t)&ID) {} + + //! Return the pass name. + virtual const char* getPassName() const throw() { + return "PBQP Register Allocator"; + } + + //! PBQP analysis usage. + virtual void getAnalysisUsage(AnalysisUsage &au) const { + au.addRequired(); + au.addRequired(); + MachineFunctionPass::getAnalysisUsage(au); + } + + //! Perform register allocation + virtual bool runOnMachineFunction(MachineFunction &MF); + + private: + typedef std::map LI2NodeMap; + typedef std::vector Node2LIMap; + typedef std::vector AllowedSet; + typedef std::vector AllowedSetMap; + typedef std::set IgnoreSet; + + MachineFunction *mf; + const TargetMachine *tm; + const TargetRegisterInfo *tri; + const TargetInstrInfo *tii; + const MachineLoopInfo *loopInfo; + MachineRegisterInfo *mri; + + LiveIntervals *li; + VirtRegMap *vrm; + + LI2NodeMap li2Node; + Node2LIMap node2LI; + AllowedSetMap allowedSets; + IgnoreSet ignoreSet; + + //! Builds a PBQP cost vector. + template + PBQPVector* buildCostVector(const Container &allowed, + PBQPNum spillCost) const; + + //! \brief Builds a PBQP interfernce matrix. + //! + //! @return Either a pointer to a non-zero PBQP matrix representing the + //! allocation option costs, or a null pointer for a zero matrix. + //! + //! Expects allowed sets for two interfering LiveIntervals. These allowed + //! sets should contain only allocable registers from the LiveInterval's + //! register class, with any interfering pre-colored registers removed. + template + PBQPMatrix* buildInterferenceMatrix(const Container &allowed1, + const Container &allowed2) const; + + //! + //! Expects allowed sets for two potentially coalescable LiveIntervals, + //! and an estimated benefit due to coalescing. The allowed sets should + //! contain only allocable registers from the LiveInterval's register + //! classes, with any interfering pre-colored registers removed. + template + PBQPMatrix* buildCoalescingMatrix(const Container &allowed1, + const Container &allowed2, + PBQPNum cBenefit) const; + + //! \brief Helper functior for constructInitialPBQPProblem(). + //! + //! This function iterates over the Function we are about to allocate for + //! and computes spill costs. + void calcSpillCosts(); + + //! \brief Scans the MachineFunction being allocated to find coalescing + // opportunities. + void findCoalescingOpportunities(); + + //! \brief Constructs a PBQP problem representation of the register + //! allocation problem for this function. + //! + //! @return a PBQP solver object for the register allocation problem. + pbqp* constructPBQPProblem(); + + //! \brief Given a solved PBQP problem maps this solution back to a register + //! assignment. + bool mapPBQPToRegAlloc(pbqp *problem); + + }; + + char PBQPRegAlloc::ID = 0; +} + + +template +PBQPVector* PBQPRegAlloc::buildCostVector(const Container &allowed, + PBQPNum spillCost) const { + + // Allocate vector. Additional element (0th) used for spill option + PBQPVector *v = new PBQPVector(allowed.size() + 1); + + (*v)[0] = spillCost; + + return v; +} + +template +PBQPMatrix* PBQPRegAlloc::buildInterferenceMatrix( + const Container &allowed1, const Container &allowed2) const { + + typedef typename Container::const_iterator ContainerIterator; + + // Construct a PBQP matrix representing the cost of allocation options. The + // rows and columns correspond to the allocation options for the two live + // intervals. Elements will be infinite where corresponding registers alias, + // since we cannot allocate aliasing registers to interfering live intervals. + // All other elements (non-aliasing combinations) will have zero cost. Note + // that the spill option (element 0,0) has zero cost, since we can allocate + // both intervals to memory safely (the cost for each individual allocation + // to memory is accounted for by the cost vectors for each live interval). + PBQPMatrix *m = new PBQPMatrix(allowed1.size() + 1, allowed2.size() + 1); + + // Assume this is a zero matrix until proven otherwise. Zero matrices occur + // between interfering live ranges with non-overlapping register sets (e.g. + // non-overlapping reg classes, or disjoint sets of allowed regs within the + // same class). The term "overlapping" is used advisedly: sets which do not + // intersect, but contain registers which alias, will have non-zero matrices. + // We optimize zero matrices away to improve solver speed. + bool isZeroMatrix = true; + + + // Row index. Starts at 1, since the 0th row is for the spill option, which + // is always zero. + unsigned ri = 1; + + // Iterate over allowed sets, insert infinities where required. + for (ContainerIterator a1Itr = allowed1.begin(), a1End = allowed1.end(); + a1Itr != a1End; ++a1Itr) { + + // Column index, starts at 1 as for row index. + unsigned ci = 1; + unsigned reg1 = *a1Itr; + + for (ContainerIterator a2Itr = allowed2.begin(), a2End = allowed2.end(); + a2Itr != a2End; ++a2Itr) { + + unsigned reg2 = *a2Itr; + + // If the row/column regs are identical or alias insert an infinity. + if ((reg1 == reg2) || tri->areAliases(reg1, reg2)) { + (*m)[ri][ci] = std::numeric_limits::infinity(); + isZeroMatrix = false; + } + + ++ci; + } + + ++ri; + } + + // If this turns out to be a zero matrix... + if (isZeroMatrix) { + // free it and return null. + delete m; + return 0; + } + + // ...otherwise return the cost matrix. + return m; +} + +void PBQPRegAlloc::calcSpillCosts() { + + // Calculate the spill cost for each live interval by iterating over the + // function counting loads and stores, with loop depth taken into account. + for (MachineFunction::const_iterator bbItr = mf->begin(), bbEnd = mf->end(); + bbItr != bbEnd; ++bbItr) { + + const MachineBasicBlock *mbb = &*bbItr; + float loopDepth = loopInfo->getLoopDepth(mbb); + + for (MachineBasicBlock::const_iterator + iItr = mbb->begin(), iEnd = mbb->end(); iItr != iEnd; ++iItr) { + + const MachineInstr *instr = &*iItr; + + for (unsigned opNo = 0; opNo < instr->getNumOperands(); ++opNo) { + + const MachineOperand &mo = instr->getOperand(opNo); + + // We're not interested in non-registers... + if (!mo.isRegister()) + continue; + + unsigned moReg = mo.getReg(); + + // ...Or invalid registers... + if (moReg == 0) + continue; + + // ...Or physical registers... + if (TargetRegisterInfo::isPhysicalRegister(moReg)) + continue; + + assert ((mo.isUse() || mo.isDef()) && + "Not a use, not a def, what is it?"); + + //... Just the virtual registers. We treat loads and stores as equal. + li->getInterval(moReg).weight += powf(10.0f, loopDepth); + } + + } + + } + +} + +pbqp* PBQPRegAlloc::constructPBQPProblem() { + + typedef std::vector LIVector; + typedef std::set RegSet; + + // These will store the physical & virtual intervals, respectively. + LIVector physIntervals, virtIntervals; + + // Start by clearing the old node <-> live interval mappings & allowed sets + li2Node.clear(); + node2LI.clear(); + allowedSets.clear(); + + // Iterate over intervals classifying them as physical or virtual, and + // constructing live interval <-> node number mappings. + for (LiveIntervals::iterator itr = li->begin(), end = li->end(); + itr != end; ++itr) { + + if (itr->second->getNumValNums() != 0) { + DOUT << "Live range has " << itr->second->getNumValNums() << ": " << itr->second << "\n"; + } + + if (TargetRegisterInfo::isPhysicalRegister(itr->first)) { + physIntervals.push_back(itr->second); + mri->setPhysRegUsed(itr->second->reg); + } + else { + + // If we've allocated this virtual register interval a stack slot on a + // previous round then it's not an allocation candidate + if (ignoreSet.find(itr->first) != ignoreSet.end()) + continue; + + li2Node[itr->second] = node2LI.size(); + node2LI.push_back(itr->second); + virtIntervals.push_back(itr->second); + } + } + + // Early out if there's no regs to allocate for. + if (virtIntervals.empty()) + return 0; + + // Construct a PBQP solver for this problem + pbqp *solver = alloc_pbqp(virtIntervals.size()); + + // Resize allowedSets container appropriately. + allowedSets.resize(virtIntervals.size()); + + // Iterate over virtual register intervals to compute allowed sets... + for (unsigned node = 0; node < node2LI.size(); ++node) { + + // Grab pointers to the interval and its register class. + const LiveInterval *li = node2LI[node]; + const TargetRegisterClass *liRC = mri->getRegClass(li->reg); + + // Start by assuming all allocable registers in the class are allowed... + RegSet liAllowed(liRC->allocation_order_begin(*mf), + liRC->allocation_order_end(*mf)); + + // If this range is non-empty then eliminate the physical registers which + // overlap with this range, along with all their aliases. + if (!li->empty()) { + for (LIVector::iterator pItr = physIntervals.begin(), + pEnd = physIntervals.end(); pItr != pEnd; ++pItr) { + + if (li->overlaps(**pItr)) { + + unsigned pReg = (*pItr)->reg; + + // Remove the overlapping reg... + liAllowed.erase(pReg); + + const unsigned *aliasItr = tri->getAliasSet(pReg); + + if (aliasItr != 0) { + // ...and its aliases. + for (; *aliasItr != 0; ++aliasItr) { + liAllowed.erase(*aliasItr); + } + + } + + } + + } + + } + + // Copy the allowed set into a member vector for use when constructing cost + // vectors & matrices, and mapping PBQP solutions back to assignments. + allowedSets[node] = AllowedSet(liAllowed.begin(), liAllowed.end()); + + // Set the spill cost to the interval weight, or epsilon if the + // interval weight is zero + PBQPNum spillCost = (li->weight != 0.0) ? + li->weight : std::numeric_limits::min(); + + // Build a cost vector for this interval. + add_pbqp_nodecosts(solver, node, + buildCostVector(allowedSets[node], spillCost)); + + } + + // Now add the cost matrices... + for (unsigned node1 = 0; node1 < node2LI.size(); ++node1) { + + const LiveInterval *li = node2LI[node1]; + + if (li->empty()) + continue; + + // Test for live range overlaps and insert interference matrices. + for (unsigned node2 = node1 + 1; node2 < node2LI.size(); ++node2) { + const LiveInterval *li2 = node2LI[node2]; + + if (li2->empty()) + continue; + + if (li->overlaps(*li2)) { + PBQPMatrix *m = + buildInterferenceMatrix(allowedSets[node1], allowedSets[node2]); + + if (m != 0) { + add_pbqp_edgecosts(solver, node1, node2, m); + delete m; + } + } + } + } + + // We're done, PBQP problem constructed - return it. + return solver; +} + +bool PBQPRegAlloc::mapPBQPToRegAlloc(pbqp *problem) { + + // Set to true if we have any spills + bool anotherRoundNeeded = false; + + // Clear the existing allocation. + vrm->clearAllVirt(); + + // Iterate over the nodes mapping the PBQP solution to a register assignment. + for (unsigned node = 0; node < node2LI.size(); ++node) { + unsigned symReg = node2LI[node]->reg, + allocSelection = get_pbqp_solution(problem, node); + + // If the PBQP solution is non-zero it's a physical register... + if (allocSelection != 0) { + // Get the physical reg, subtracting 1 to account for the spill option. + unsigned physReg = allowedSets[node][allocSelection - 1]; + + // Add to the virt reg map and update the used phys regs. + vrm->assignVirt2Phys(symReg, physReg); + mri->setPhysRegUsed(physReg); + } + // ...Otherwise it's a spill. + else { + + // Make sure we ignore this virtual reg on the next round + // of allocation + ignoreSet.insert(node2LI[node]->reg); + + float SSWeight; + + // Insert spill ranges for this live range + SmallVector spillIs; + std::vector newSpills = + li->addIntervalsForSpills(*node2LI[node], spillIs, loopInfo, *vrm, + SSWeight); + + // We need another round if spill intervals were added. + anotherRoundNeeded |= !newSpills.empty(); + } + } + + return !anotherRoundNeeded; +} + +bool PBQPRegAlloc::runOnMachineFunction(MachineFunction &MF) { + + mf = &MF; + tm = &mf->getTarget(); + tri = tm->getRegisterInfo(); + mri = &mf->getRegInfo(); + + li = &getAnalysis(); + loopInfo = &getAnalysis(); + + std::auto_ptr vrmAutoPtr(new VirtRegMap(*mf)); + vrm = vrmAutoPtr.get(); + + // Allocator main loop: + // + // * Map current regalloc problem to a PBQP problem + // * Solve the PBQP problem + // * Map the solution back to a register allocation + // * Spill if necessary + // + // This process is continued till no more spills are generated. + + bool regallocComplete = false; + + // Calculate spill costs for intervals + calcSpillCosts(); + + while (!regallocComplete) { + pbqp *problem = constructPBQPProblem(); + + // Fast out if there's no problem to solve. + if (problem == 0) + return true; + + solve_pbqp(problem); + + regallocComplete = mapPBQPToRegAlloc(problem); + + free_pbqp(problem); + } + + ignoreSet.clear(); + + std::auto_ptr spiller(createSpiller()); + + spiller->runOnMachineFunction(*mf, *vrm); + + return true; +} + +FunctionPass* llvm::createPBQPRegisterAllocator() { + return new PBQPRegAlloc(); +} + + +#undef DEBUG_TYPE From dpatel at apple.com Thu Oct 2 13:38:23 2008 From: dpatel at apple.com (Devang Patel) Date: Thu, 02 Oct 2008 18:38:23 -0000 Subject: [llvm-commits] [llvm] r56960 - /llvm/trunk/lib/VMCore/Verifier.cpp Message-ID: <200810021838.m92IcNcU015157@zion.cs.uiuc.edu> Author: dpatel Date: Thu Oct 2 13:38:23 2008 New Revision: 56960 URL: http://llvm.org/viewvc/llvm-project?rev=56960&view=rev Log: Remove redundant check. Modified: llvm/trunk/lib/VMCore/Verifier.cpp Modified: llvm/trunk/lib/VMCore/Verifier.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=56960&r1=56959&r2=56960&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Verifier.cpp (original) +++ llvm/trunk/lib/VMCore/Verifier.cpp Thu Oct 2 13:38:23 2008 @@ -483,15 +483,6 @@ 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) { From isanbard at gmail.com Thu Oct 2 13:39:11 2008 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 02 Oct 2008 18:39:11 -0000 Subject: [llvm-commits] [llvm] r56961 - /llvm/trunk/tools/llvmc2/CompilationGraph.cpp Message-ID: <200810021839.m92IdBqT015221@zion.cs.uiuc.edu> Author: void Date: Thu Oct 2 13:39:11 2008 New Revision: 56961 URL: http://llvm.org/viewvc/llvm-project?rev=56961&view=rev Log: Avoid name shadowing with E variable defined in for(). This was giving VC++ grief. Modified: llvm/trunk/tools/llvmc2/CompilationGraph.cpp Modified: llvm/trunk/tools/llvmc2/CompilationGraph.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/CompilationGraph.cpp?rev=56961&r1=56960&r2=56961&view=diff ============================================================================== --- llvm/trunk/tools/llvmc2/CompilationGraph.cpp (original) +++ llvm/trunk/tools/llvmc2/CompilationGraph.cpp Thu Oct 2 13:39:11 2008 @@ -55,10 +55,10 @@ for (typename C::const_iterator B = EdgesContainer.begin(), E = EdgesContainer.end(); B != E; ++B) { - const Edge* E = B->getPtr(); - unsigned EW = E->Weight(InLangs); + const Edge* e = B->getPtr(); + unsigned EW = e->Weight(InLangs); if (EW > MaxWeight) { - MaxEdge = E; + MaxEdge = e; MaxWeight = EW; SingleMax = true; } else if (EW == MaxWeight) { From dalej at apple.com Thu Oct 2 13:53:47 2008 From: dalej at apple.com (Dale Johannesen) Date: Thu, 02 Oct 2008 18:53:47 -0000 Subject: [llvm-commits] [llvm] r56963 - in /llvm/trunk: lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/Target/X86/X86ISelDAGToDAG.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86InstrInfo.td test/CodeGen/X86/2008-10-02-Atomics32-2.ll utils/TableGen/CodeGenInstruction.cpp Message-ID: <200810021853.m92Irlwg015711@zion.cs.uiuc.edu> Author: johannes Date: Thu Oct 2 13:53:47 2008 New Revision: 56963 URL: http://llvm.org/viewvc/llvm-project?rev=56963&view=rev Log: Handle some 64-bit atomics on x86-32, some of the time. Added: llvm/trunk/test/CodeGen/X86/2008-10-02-Atomics32-2.ll Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.h llvm/trunk/lib/Target/X86/X86InstrInfo.td llvm/trunk/utils/TableGen/CodeGenInstruction.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=56963&r1=56962&r2=56963&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Thu Oct 2 13:53:47 2008 @@ -6212,21 +6212,26 @@ break; } - // FIXME: should the LOAD_BIN and SWAP atomics get here too? Probably. - case ISD::ATOMIC_CMP_SWAP_8: - case ISD::ATOMIC_CMP_SWAP_16: - case ISD::ATOMIC_CMP_SWAP_32: + case ISD::ATOMIC_LOAD_ADD_64: + case ISD::ATOMIC_LOAD_SUB_64: + case ISD::ATOMIC_LOAD_AND_64: + case ISD::ATOMIC_LOAD_OR_64: + case ISD::ATOMIC_LOAD_XOR_64: + case ISD::ATOMIC_LOAD_NAND_64: + case ISD::ATOMIC_SWAP_64: case ISD::ATOMIC_CMP_SWAP_64: { - SDValue Tmp = TLI.LowerOperation(Op, DAG); - assert(Tmp.getNode() && "Node must be custom expanded!"); - ExpandOp(Tmp.getValue(0), Lo, Hi); - AddLegalizedOperand(SDValue(Node, 1), // Remember we legalized the chain. - LegalizeOp(Tmp.getValue(1))); + SDValue In2Lo, In2Hi, In2; + ExpandOp(Op.getOperand(2), In2Lo, In2Hi); + In2 = DAG.getNode(ISD::BUILD_PAIR, VT, In2Lo, In2Hi); + SDValue Result = TLI.LowerOperation( + DAG.getNode(Op.getOpcode(), VT, Op.getOperand(0), Op.getOperand(1), In2), + DAG); + ExpandOp(Result.getValue(0), Lo, Hi); + // Remember that we legalized the chain. + AddLegalizedOperand(SDValue(Node,1), LegalizeOp(Result.getValue(1))); break; } - - // These operators cannot be expanded directly, emit them as calls to // library functions. case ISD::FP_TO_SINT: { Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=56963&r1=56962&r2=56963&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Thu Oct 2 13:53:47 2008 @@ -160,6 +160,7 @@ private: SDNode *Select(SDValue N); + SDNode *SelectAtomic64(SDNode *Node, unsigned Opc); bool MatchAddress(SDValue N, X86ISelAddressMode &AM, bool isRoot = true, unsigned Depth = 0); @@ -1205,6 +1206,25 @@ MVT::i8, N0, SRIdx, N0.getValue(1)); } +SDNode *X86DAGToDAGISel::SelectAtomic64(SDNode *Node, unsigned Opc) { + SDValue Chain = Node->getOperand(0); + SDValue In1 = Node->getOperand(1); + SDValue In2L = Node->getOperand(2); + SDValue In2H = Node->getOperand(3); + SDValue Tmp0, Tmp1, Tmp2, Tmp3; + if (!SelectAddr(In1, In1, Tmp0, Tmp1, Tmp2, Tmp3)) + return NULL; + AddToISelQueue(Tmp0); + AddToISelQueue(Tmp1); + AddToISelQueue(Tmp2); + AddToISelQueue(Tmp3); + AddToISelQueue(In2L); + AddToISelQueue(In2H); + AddToISelQueue(Chain); + SDValue LSI = CurDAG->getMemOperand(cast(In1)->getMemOperand()); + const SDValue Ops[] = { Tmp0, Tmp1, Tmp2, Tmp3, In2L, In2H, LSI, Chain }; + return CurDAG->getTargetNode(Opc, MVT::i32, MVT::i32, MVT::Other, Ops, 8); +} SDNode *X86DAGToDAGISel::Select(SDValue N) { SDNode *Node = N.getNode(); @@ -1277,6 +1297,19 @@ break; } + case X86ISD::ATOMOR64_DAG: + return SelectAtomic64(Node, X86::ATOMOR6432); + case X86ISD::ATOMXOR64_DAG: + return SelectAtomic64(Node, X86::ATOMXOR6432); + case X86ISD::ATOMADD64_DAG: + return SelectAtomic64(Node, X86::ATOMADD6432); + case X86ISD::ATOMSUB64_DAG: + return SelectAtomic64(Node, X86::ATOMSUB6432); + case X86ISD::ATOMNAND64_DAG: + return SelectAtomic64(Node, X86::ATOMNAND6432); + case X86ISD::ATOMAND64_DAG: + return SelectAtomic64(Node, X86::ATOMAND6432); + case ISD::SMUL_LOHI: case ISD::UMUL_LOHI: { SDValue N0 = Node->getOperand(0); Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=56963&r1=56962&r2=56963&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Thu Oct 2 13:53:47 2008 @@ -302,6 +302,16 @@ setOperationAction(ISD::ATOMIC_LOAD_SUB_32, MVT::i32, Custom); setOperationAction(ISD::ATOMIC_LOAD_SUB_64, MVT::i64, Custom); + if (!Subtarget->is64Bit()) { + setOperationAction(ISD::ATOMIC_LOAD_ADD_64, MVT::i64, Custom); + setOperationAction(ISD::ATOMIC_LOAD_SUB_64, MVT::i64, Custom); + setOperationAction(ISD::ATOMIC_LOAD_AND_64, MVT::i64, Custom); + setOperationAction(ISD::ATOMIC_LOAD_OR_64, MVT::i64, Custom); + setOperationAction(ISD::ATOMIC_LOAD_XOR_64, MVT::i64, Custom); + setOperationAction(ISD::ATOMIC_LOAD_NAND_64, MVT::i64, Custom); + setOperationAction(ISD::ATOMIC_SWAP_64, MVT::i64, Custom); + } + // Use the default ISD::DBG_STOPPOINT, ISD::DECLARE expansion. setOperationAction(ISD::DBG_STOPPOINT, MVT::Other, Expand); // FIXME - use subtarget debug flags @@ -6004,6 +6014,27 @@ return DAG.getMergeValues(Vals, 2).getNode(); } +SDValue X86TargetLowering::LowerATOMIC_BINARY_64(SDValue Op, + SelectionDAG &DAG, + unsigned NewOp) { + SDNode *Node = Op.getNode(); + MVT T = Node->getValueType(0); + assert (T == MVT::i64 && "Only know how to expand i64 atomics"); + + SDValue Chain = Node->getOperand(0); + SDValue In1 = Node->getOperand(1); + assert(Node->getOperand(2).getNode()->getOpcode()==ISD::BUILD_PAIR); + SDValue In2L = Node->getOperand(2).getNode()->getOperand(0); + SDValue In2H = Node->getOperand(2).getNode()->getOperand(1); + SDValue Ops[] = { Chain, In1, In2L, In2H }; + SDVTList Tys = DAG.getVTList(MVT::i32, MVT::i32, MVT::Other); + SDValue Result = DAG.getNode(NewOp, Tys, Ops, 4); + SDValue OpsF[] = { Result.getValue(0), Result.getValue(1)}; + SDValue ResultVal = DAG.getNode(ISD::BUILD_PAIR, MVT::i64, OpsF, 2); + SDValue Vals[2] = { ResultVal, Result.getValue(2) }; + return SDValue(DAG.getMergeValues(Vals, 2).getNode(), 0); +} + SDValue X86TargetLowering::LowerLOAD_SUB(SDValue Op, SelectionDAG &DAG) { SDNode *Node = Op.getNode(); MVT T = Node->getValueType(0); @@ -6027,14 +6058,27 @@ SDValue X86TargetLowering::LowerOperation(SDValue Op, SelectionDAG &DAG) { switch (Op.getOpcode()) { default: assert(0 && "Should not custom lower this!"); - case ISD::ATOMIC_CMP_SWAP_8: return LowerCMP_SWAP(Op,DAG); - 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_8: + case ISD::ATOMIC_CMP_SWAP_16: + case ISD::ATOMIC_CMP_SWAP_32: 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_8: + case ISD::ATOMIC_LOAD_SUB_16: case ISD::ATOMIC_LOAD_SUB_32: return LowerLOAD_SUB(Op,DAG); - case ISD::ATOMIC_LOAD_SUB_64: return LowerLOAD_SUB(Op,DAG); + case ISD::ATOMIC_LOAD_SUB_64: return (Subtarget->is64Bit()) ? + LowerLOAD_SUB(Op,DAG) : + LowerATOMIC_BINARY_64(Op,DAG, + X86ISD::ATOMSUB64_DAG); + case ISD::ATOMIC_LOAD_AND_64: return LowerATOMIC_BINARY_64(Op,DAG, + X86ISD::ATOMAND64_DAG); + case ISD::ATOMIC_LOAD_OR_64: return LowerATOMIC_BINARY_64(Op, DAG, + X86ISD::ATOMOR64_DAG); + case ISD::ATOMIC_LOAD_XOR_64: return LowerATOMIC_BINARY_64(Op,DAG, + X86ISD::ATOMXOR64_DAG); + case ISD::ATOMIC_LOAD_NAND_64: return LowerATOMIC_BINARY_64(Op,DAG, + X86ISD::ATOMNAND64_DAG); + case ISD::ATOMIC_LOAD_ADD_64: return LowerATOMIC_BINARY_64(Op,DAG, + X86ISD::ATOMADD64_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); @@ -6140,6 +6184,12 @@ case X86ISD::FNSTCW16m: return "X86ISD::FNSTCW16m"; case X86ISD::LCMPXCHG_DAG: return "X86ISD::LCMPXCHG_DAG"; case X86ISD::LCMPXCHG8_DAG: return "X86ISD::LCMPXCHG8_DAG"; + case X86ISD::ATOMADD64_DAG: return "X86ISD::ATOMADD64_DAG"; + case X86ISD::ATOMSUB64_DAG: return "X86ISD::ATOMSUB64_DAG"; + case X86ISD::ATOMOR64_DAG: return "X86ISD::ATOMOR64_DAG"; + case X86ISD::ATOMXOR64_DAG: return "X86ISD::ATOMXOR64_DAG"; + case X86ISD::ATOMAND64_DAG: return "X86ISD::ATOMAND64_DAG"; + case X86ISD::ATOMNAND64_DAG: return "X86ISD::ATOMNAND64_DAG"; case X86ISD::VZEXT_MOVL: return "X86ISD::VZEXT_MOVL"; case X86ISD::VZEXT_LOAD: return "X86ISD::VZEXT_LOAD"; case X86ISD::VSHL: return "X86ISD::VSHL"; @@ -6367,6 +6417,146 @@ // private utility function MachineBasicBlock * +X86TargetLowering::EmitAtomicBit6432WithCustomInserter(MachineInstr *bInstr, + MachineBasicBlock *MBB, + unsigned regOpcL, + unsigned regOpcH, + unsigned immOpcL, + unsigned immOpcH, + bool invSrc) { + // For the atomic bitwise operator, we generate + // thisMBB (instructions are in pairs, except cmpxchg8b) + // ld t1,t2 = [bitinstr.addr] + // newMBB: + // out1, out2 = phi (thisMBB, t1/t2) (newMBB, t3/t4) + // op t5, t6 <- out1, out2, [bitinstr.val] + // mov ECX, EBX <- t5, t6 + // mov EAX, EDX <- t1, t2 + // cmpxchg8b [bitinstr.addr] [EAX, EDX, EBX, ECX implicit] + // mov t3, t4 <- EAX, EDX + // bz newMBB + // result in out1, out2 + // fallthrough -->nextMBB + + const TargetRegisterClass *RC = X86::GR32RegisterClass; + const unsigned LoadOpc = X86::MOV32rm; + const unsigned copyOpc = X86::MOV32rr; + const unsigned NotOpc = X86::NOT32r; + const TargetInstrInfo *TII = getTargetMachine().getInstrInfo(); + const BasicBlock *LLVM_BB = MBB->getBasicBlock(); + MachineFunction::iterator MBBIter = MBB; + ++MBBIter; + + /// First build the CFG + MachineFunction *F = MBB->getParent(); + MachineBasicBlock *thisMBB = MBB; + MachineBasicBlock *newMBB = F->CreateMachineBasicBlock(LLVM_BB); + MachineBasicBlock *nextMBB = F->CreateMachineBasicBlock(LLVM_BB); + F->insert(MBBIter, newMBB); + F->insert(MBBIter, nextMBB); + + // Move all successors to thisMBB to nextMBB + nextMBB->transferSuccessors(thisMBB); + + // Update thisMBB to fall through to newMBB + thisMBB->addSuccessor(newMBB); + + // newMBB jumps to itself and fall through to nextMBB + newMBB->addSuccessor(nextMBB); + newMBB->addSuccessor(newMBB); + + // Insert instructions into newMBB based on incoming instruction + // There are 8 "real" operands plus 9 implicit def/uses, ignored here. + assert(bInstr->getNumOperands() < 18 && "unexpected number of operands"); + MachineOperand& dest1Oper = bInstr->getOperand(0); + MachineOperand& dest2Oper = bInstr->getOperand(1); + MachineOperand* argOpers[6]; + for (int i=0; i < 6; ++i) + argOpers[i] = &bInstr->getOperand(i+2); + + // x86 address has 4 operands: base, index, scale, and displacement + int lastAddrIndx = 3; // [0,3] + + unsigned t1 = F->getRegInfo().createVirtualRegister(RC); + MachineInstrBuilder MIB = BuildMI(thisMBB, TII->get(LoadOpc), t1); + for (int i=0; i <= lastAddrIndx; ++i) + (*MIB).addOperand(*argOpers[i]); + unsigned t2 = F->getRegInfo().createVirtualRegister(RC); + MIB = BuildMI(thisMBB, TII->get(LoadOpc), t2); + // add 4 to displacement. getImm verifies it's immediate. + for (int i=0; i <= lastAddrIndx-1; ++i) + (*MIB).addOperand(*argOpers[i]); + MachineOperand newOp3 = MachineOperand::CreateImm(argOpers[3]->getImm()+4); + (*MIB).addOperand(newOp3); + + // t3/4 are defined later, at the bottom of the loop + unsigned t3 = F->getRegInfo().createVirtualRegister(RC); + unsigned t4 = F->getRegInfo().createVirtualRegister(RC); + BuildMI(newMBB, TII->get(X86::PHI), dest1Oper.getReg()) + .addReg(t1).addMBB(thisMBB).addReg(t3).addMBB(newMBB); + BuildMI(newMBB, TII->get(X86::PHI), dest2Oper.getReg()) + .addReg(t2).addMBB(thisMBB).addReg(t4).addMBB(newMBB); + + unsigned tt1 = F->getRegInfo().createVirtualRegister(RC); + unsigned tt2 = F->getRegInfo().createVirtualRegister(RC); + if (invSrc) { + MIB = BuildMI(newMBB, TII->get(NotOpc), tt1).addReg(t1); + MIB = BuildMI(newMBB, TII->get(NotOpc), tt2).addReg(t2); + } else { + tt1 = t1; + tt2 = t2; + } + + assert((argOpers[4]->isRegister() || argOpers[4]->isImmediate()) && + "invalid operand"); + unsigned t5 = F->getRegInfo().createVirtualRegister(RC); + unsigned t6 = F->getRegInfo().createVirtualRegister(RC); + if (argOpers[4]->isRegister()) + MIB = BuildMI(newMBB, TII->get(regOpcL), t5); + else + MIB = BuildMI(newMBB, TII->get(immOpcL), t5); + MIB.addReg(tt1); + (*MIB).addOperand(*argOpers[4]); + assert(argOpers[5]->isRegister() == argOpers[4]->isRegister()); + assert(argOpers[5]->isImmediate() == argOpers[4]->isImmediate()); + if (argOpers[5]->isRegister()) + MIB = BuildMI(newMBB, TII->get(regOpcH), t6); + else + MIB = BuildMI(newMBB, TII->get(immOpcH), t6); + MIB.addReg(tt2); + (*MIB).addOperand(*argOpers[5]); + + MIB = BuildMI(newMBB, TII->get(copyOpc), X86::EAX); + MIB.addReg(t1); + MIB = BuildMI(newMBB, TII->get(copyOpc), X86::EDX); + MIB.addReg(t2); + + MIB = BuildMI(newMBB, TII->get(copyOpc), X86::EBX); + MIB.addReg(t5); + MIB = BuildMI(newMBB, TII->get(copyOpc), X86::ECX); + MIB.addReg(t6); + + MIB = BuildMI(newMBB, TII->get(X86::LCMPXCHG8B)); + for (int i=0; i <= lastAddrIndx; ++i) + (*MIB).addOperand(*argOpers[i]); + + assert(bInstr->hasOneMemOperand() && "Unexpected number of memoperand"); + (*MIB).addMemOperand(*F, *bInstr->memoperands_begin()); + + MIB = BuildMI(newMBB, TII->get(copyOpc), t3); + MIB.addReg(X86::EAX); + MIB = BuildMI(newMBB, TII->get(copyOpc), t4); + MIB.addReg(X86::EDX); + + // insert branch + BuildMI(newMBB, TII->get(X86::JNE)).addMBB(newMBB); + + F->DeleteMachineInstr(bInstr); // The pseudo instruction is gone now. + return nextMBB; +} + +// private utility function +MachineBasicBlock * X86TargetLowering::EmitAtomicMinMaxWithCustomInserter(MachineInstr *mInstr, MachineBasicBlock *MBB, unsigned cmovOpc) { @@ -6695,6 +6885,7 @@ X86::NOT8r, X86::AL, X86::GR8RegisterClass, true); // FIXME: There are no CMOV8 instructions; MIN/MAX need some other way. + // This group is for 64-bit host. case X86::ATOMAND64: return EmitAtomicBitwiseWithCustomInserter(MI, BB, X86::AND64rr, X86::AND64ri32, X86::MOV64rm, @@ -6727,6 +6918,40 @@ return EmitAtomicMinMaxWithCustomInserter(MI, BB, X86::CMOVB64rr); case X86::ATOMUMAX64: return EmitAtomicMinMaxWithCustomInserter(MI, BB, X86::CMOVA64rr); + + // This group does 64-bit operations on a 32-bit host. + case X86::ATOMAND6432: + return EmitAtomicBit6432WithCustomInserter(MI, BB, + X86::AND32rr, X86::AND32rr, + X86::AND32ri, X86::AND32ri, + false); + case X86::ATOMOR6432: + return EmitAtomicBit6432WithCustomInserter(MI, BB, + X86::OR32rr, X86::OR32rr, + X86::OR32ri, X86::OR32ri, + false); + case X86::ATOMXOR6432: + return EmitAtomicBit6432WithCustomInserter(MI, BB, + X86::XOR32rr, X86::XOR32rr, + X86::XOR32ri, X86::XOR32ri, + false); + case X86::ATOMNAND6432: + return EmitAtomicBit6432WithCustomInserter(MI, BB, + X86::AND32rr, X86::AND32rr, + X86::AND32ri, X86::AND32ri, + true); + // FIXME carry + case X86::ATOMADD6432: + return EmitAtomicBit6432WithCustomInserter(MI, BB, + X86::ADD32rr, X86::ADC32rr, + X86::ADD32ri, X86::ADC32ri, + false); + // FIXME carry + case X86::ATOMSUB6432: + return EmitAtomicBit6432WithCustomInserter(MI, BB, + X86::SUB32rr, X86::SBB32rr, + X86::SUB32ri, X86::SBB32ri, + false); } } Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.h?rev=56963&r1=56962&r2=56963&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.h (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.h Thu Oct 2 13:53:47 2008 @@ -199,6 +199,15 @@ LCMPXCHG_DAG, LCMPXCHG8_DAG, + // ATOMADD64_DAG, ATOMSUB64_DAG, ATOMOR64_DAG, ATOMAND64_DAG, + // ATOMXOR64_DAG, ATOMNAND64_DAG - Atomic 64-bit binary operations. + ATOMADD64_DAG, + ATOMSUB64_DAG, + ATOMOR64_DAG, + ATOMXOR64_DAG, + ATOMAND64_DAG, + ATOMNAND64_DAG, + // FNSTCW16m - Store FP control world into i16 memory. FNSTCW16m, @@ -570,6 +579,8 @@ SDValue LowerCTTZ(SDValue Op, SelectionDAG &DAG); SDValue LowerCMP_SWAP(SDValue Op, SelectionDAG &DAG); SDValue LowerLOAD_SUB(SDValue Op, SelectionDAG &DAG); + SDValue LowerATOMIC_BINARY_64(SDValue Op, SelectionDAG &DAG, + unsigned NewOp); SDNode *ExpandFP_TO_SINT(SDNode *N, SelectionDAG &DAG); SDNode *ExpandREADCYCLECOUNTER(SDNode *N, SelectionDAG &DAG); SDNode *ExpandATOMIC_CMP_SWAP(SDNode *N, SelectionDAG &DAG); @@ -602,6 +613,15 @@ unsigned EAXreg, TargetRegisterClass *RC, bool invSrc = false); + + MachineBasicBlock *EmitAtomicBit6432WithCustomInserter( + MachineInstr *BInstr, + MachineBasicBlock *BB, + unsigned regOpcL, + unsigned regOpcH, + unsigned immOpcL, + unsigned immOpcH, + bool invSrc = false); /// Utility function to emit atomic min and max. It takes the min/max // instruction to expand, the associated basic block, and the associated Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=56963&r1=56962&r2=56963&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Thu Oct 2 13:53:47 2008 @@ -39,6 +39,8 @@ SDTCisVT<2, i8>]>; def SDTX86cas8 : SDTypeProfile<0, 1, [SDTCisPtrTy<0>]>; +def SDTX86atomicBinary : SDTypeProfile<2, 3, [SDTCisInt<0>, SDTCisInt<1>, + SDTCisPtrTy<2>, SDTCisInt<3>,SDTCisInt<4>]>; def SDTX86Ret : SDTypeProfile<0, -1, [SDTCisVT<0, i16>]>; def SDT_X86CallSeqStart : SDCallSeqStart<[ SDTCisVT<0, i32> ]>; @@ -79,7 +81,24 @@ def X86cas8 : SDNode<"X86ISD::LCMPXCHG8_DAG", SDTX86cas8, [SDNPHasChain, SDNPInFlag, SDNPOutFlag, SDNPMayStore, SDNPMayLoad]>; - +def X86AtomAdd64 : SDNode<"X86ISD::ATOMADD64_DAG", SDTX86atomicBinary, + [SDNPHasChain, SDNPMayStore, + SDNPMayLoad, SDNPMemOperand]>; +def X86AtomSub64 : SDNode<"X86ISD::ATOMSUB64_DAG", SDTX86atomicBinary, + [SDNPHasChain, SDNPMayStore, + SDNPMayLoad, SDNPMemOperand]>; +def X86AtomOr64 : SDNode<"X86ISD::ATOMOR64_DAG", SDTX86atomicBinary, + [SDNPHasChain, SDNPMayStore, + SDNPMayLoad, SDNPMemOperand]>; +def X86AtomXor64 : SDNode<"X86ISD::ATOMXOR64_DAG", SDTX86atomicBinary, + [SDNPHasChain, SDNPMayStore, + SDNPMayLoad, SDNPMemOperand]>; +def X86AtomAnd64 : SDNode<"X86ISD::ATOMAND64_DAG", SDTX86atomicBinary, + [SDNPHasChain, SDNPMayStore, + SDNPMayLoad, SDNPMemOperand]>; +def X86AtomNand64 : SDNode<"X86ISD::ATOMNAND64_DAG", SDTX86atomicBinary, + [SDNPHasChain, SDNPMayStore, + SDNPMayLoad, SDNPMemOperand]>; def X86retflag : SDNode<"X86ISD::RET_FLAG", SDTX86Ret, [SDNPHasChain, SDNPOptInFlag]>; @@ -2630,7 +2649,7 @@ "lock\n\tcmpxchg{l}\t{$swap, $ptr|$ptr, $swap}", [(X86cas addr:$ptr, GR32:$swap, 4)]>, TB, LOCK; } -let Defs = [EAX, EBX, ECX, EDX, EFLAGS], Uses = [EAX, EBX, ECX, EDX] in { +let Defs = [EAX, EDX, EFLAGS], Uses = [EAX, EBX, ECX, EDX] in { def LCMPXCHG8B : I<0xC7, MRM1m, (outs), (ins i32mem:$ptr), "lock\n\tcmpxchg8b\t$ptr", [(X86cas8 addr:$ptr)]>, TB, LOCK; @@ -2730,6 +2749,30 @@ [(set GR8:$dst, (atomic_load_nand_8 addr:$ptr, GR8:$val))]>; } +let Constraints = "$val1 = $dst1, $val2 = $dst2", + Defs = [EFLAGS, EAX, EBX, ECX, EDX], + Uses = [EAX, EBX, ECX, EDX], + usesCustomDAGSchedInserter = 1 in { +def ATOMAND6432 : I<0, Pseudo, (outs GR32:$dst1, GR32:$dst2), + (ins i64mem:$ptr, GR32:$val1, GR32:$val2), + "#ATOMAND6432 PSUEDO!", []>; +def ATOMOR6432 : I<0, Pseudo, (outs GR32:$dst1, GR32:$dst2), + (ins i64mem:$ptr, GR32:$val1, GR32:$val2), + "#ATOMOR6432 PSUEDO!", []>; +def ATOMXOR6432 : I<0, Pseudo, (outs GR32:$dst1, GR32:$dst2), + (ins i64mem:$ptr, GR32:$val1, GR32:$val2), + "#ATOMXOR6432 PSUEDO!", []>; +def ATOMNAND6432 : I<0, Pseudo, (outs GR32:$dst1, GR32:$dst2), + (ins i64mem:$ptr, GR32:$val1, GR32:$val2), + "#ATOMNAND6432 PSUEDO!", []>; +def ATOMADD6432 : I<0, Pseudo, (outs GR32:$dst1, GR32:$dst2), + (ins i64mem:$ptr, GR32:$val1, GR32:$val2), + "#ATOMADD6432 PSUEDO!", []>; +def ATOMSUB6432 : I<0, Pseudo, (outs GR32:$dst1, GR32:$dst2), + (ins i64mem:$ptr, GR32:$val1, GR32:$val2), + "#ATOMSUB6432 PSUEDO!", []>; +} + //===----------------------------------------------------------------------===// // Non-Instruction Patterns //===----------------------------------------------------------------------===// Added: llvm/trunk/test/CodeGen/X86/2008-10-02-Atomics32-2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2008-10-02-Atomics32-2.ll?rev=56963&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/2008-10-02-Atomics32-2.ll (added) +++ llvm/trunk/test/CodeGen/X86/2008-10-02-Atomics32-2.ll Thu Oct 2 13:53:47 2008 @@ -0,0 +1,969 @@ +; RUN: llvm-as < %s | llc -march=x86 +;; This version includes 64-bit version of binary operators (in 32-bit mode). +;; Swap, cmp-and-swap not supported yet in this mode. +; ModuleID = 'Atomics.c' +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-darwin8" + at sc = common global i8 0 ; [#uses=52] + at uc = common global i8 0 ; [#uses=112] + at ss = common global i16 0 ; [#uses=15] + at us = common global i16 0 ; [#uses=15] + at si = common global i32 0 ; [#uses=15] + at ui = common global i32 0 ; [#uses=23] + at sl = common global i32 0 ; [#uses=15] + at ul = common global i32 0 ; [#uses=15] + at sll = common global i64 0, align 8 ; [#uses=13] + at ull = common global i64 0, align 8 ; [#uses=13] + +define void @test_op_ignore() nounwind { +entry: + %0 = call i8 @llvm.atomic.load.add.i8.p0i8(i8* @sc, i8 1) ; [#uses=0] + %1 = call i8 @llvm.atomic.load.add.i8.p0i8(i8* @uc, i8 1) ; [#uses=0] + %2 = bitcast i8* bitcast (i16* @ss to i8*) to i16* ; [#uses=1] + %3 = call i16 @llvm.atomic.load.add.i16.p0i16(i16* %2, i16 1) ; [#uses=0] + %4 = bitcast i8* bitcast (i16* @us to i8*) to i16* ; [#uses=1] + %5 = call i16 @llvm.atomic.load.add.i16.p0i16(i16* %4, i16 1) ; [#uses=0] + %6 = bitcast i8* bitcast (i32* @si to i8*) to i32* ; [#uses=1] + %7 = call i32 @llvm.atomic.load.add.i32.p0i32(i32* %6, i32 1) ; [#uses=0] + %8 = bitcast i8* bitcast (i32* @ui to i8*) to i32* ; [#uses=1] + %9 = call i32 @llvm.atomic.load.add.i32.p0i32(i32* %8, i32 1) ; [#uses=0] + %10 = bitcast i8* bitcast (i32* @sl to i8*) to i32* ; [#uses=1] + %11 = call i32 @llvm.atomic.load.add.i32.p0i32(i32* %10, i32 1) ; [#uses=0] + %12 = bitcast i8* bitcast (i32* @ul to i8*) to i32* ; [#uses=1] + %13 = call i32 @llvm.atomic.load.add.i32.p0i32(i32* %12, i32 1) ; [#uses=0] + %14 = bitcast i8* bitcast (i64* @sll to i8*) to i64* ; [#uses=1] + %15 = call i64 @llvm.atomic.load.add.i64.p0i64(i64* %14, i64 1) ; [#uses=0] + %16 = bitcast i8* bitcast (i64* @ull to i8*) to i64* ; [#uses=1] + %17 = call i64 @llvm.atomic.load.add.i64.p0i64(i64* %16, i64 1) ; [#uses=0] + %18 = call i8 @llvm.atomic.load.sub.i8.p0i8(i8* @sc, i8 1) ; [#uses=0] + %19 = call i8 @llvm.atomic.load.sub.i8.p0i8(i8* @uc, i8 1) ; [#uses=0] + %20 = bitcast i8* bitcast (i16* @ss to i8*) to i16* ; [#uses=1] + %21 = call i16 @llvm.atomic.load.sub.i16.p0i16(i16* %20, i16 1) ; [#uses=0] + %22 = bitcast i8* bitcast (i16* @us to i8*) to i16* ; [#uses=1] + %23 = call i16 @llvm.atomic.load.sub.i16.p0i16(i16* %22, i16 1) ; [#uses=0] + %24 = bitcast i8* bitcast (i32* @si to i8*) to i32* ; [#uses=1] + %25 = call i32 @llvm.atomic.load.sub.i32.p0i32(i32* %24, i32 1) ; [#uses=0] + %26 = bitcast i8* bitcast (i32* @ui to i8*) to i32* ; [#uses=1] + %27 = call i32 @llvm.atomic.load.sub.i32.p0i32(i32* %26, i32 1) ; [#uses=0] + %28 = bitcast i8* bitcast (i32* @sl to i8*) to i32* ; [#uses=1] + %29 = call i32 @llvm.atomic.load.sub.i32.p0i32(i32* %28, i32 1) ; [#uses=0] + %30 = bitcast i8* bitcast (i32* @ul to i8*) to i32* ; [#uses=1] + %31 = call i32 @llvm.atomic.load.sub.i32.p0i32(i32* %30, i32 1) ; [#uses=0] + %32 = bitcast i8* bitcast (i64* @sll to i8*) to i64* ; [#uses=1] + %33 = call i64 @llvm.atomic.load.sub.i64.p0i64(i64* %32, i64 1) ; [#uses=0] + %34 = bitcast i8* bitcast (i64* @ull to i8*) to i64* ; [#uses=1] + %35 = call i64 @llvm.atomic.load.sub.i64.p0i64(i64* %34, i64 1) ; [#uses=0] + %36 = call i8 @llvm.atomic.load.or.i8.p0i8(i8* @sc, i8 1) ; [#uses=0] + %37 = call i8 @llvm.atomic.load.or.i8.p0i8(i8* @uc, i8 1) ; [#uses=0] + %38 = bitcast i8* bitcast (i16* @ss to i8*) to i16* ; [#uses=1] + %39 = call i16 @llvm.atomic.load.or.i16.p0i16(i16* %38, i16 1) ; [#uses=0] + %40 = bitcast i8* bitcast (i16* @us to i8*) to i16* ; [#uses=1] + %41 = call i16 @llvm.atomic.load.or.i16.p0i16(i16* %40, i16 1) ; [#uses=0] + %42 = bitcast i8* bitcast (i32* @si to i8*) to i32* ; [#uses=1] + %43 = call i32 @llvm.atomic.load.or.i32.p0i32(i32* %42, i32 1) ; [#uses=0] + %44 = bitcast i8* bitcast (i32* @ui to i8*) to i32* ; [#uses=1] + %45 = call i32 @llvm.atomic.load.or.i32.p0i32(i32* %44, i32 1) ; [#uses=0] + %46 = bitcast i8* bitcast (i32* @sl to i8*) to i32* ; [#uses=1] + %47 = call i32 @llvm.atomic.load.or.i32.p0i32(i32* %46, i32 1) ; [#uses=0] + %48 = bitcast i8* bitcast (i32* @ul to i8*) to i32* ; [#uses=1] + %49 = call i32 @llvm.atomic.load.or.i32.p0i32(i32* %48, i32 1) ; [#uses=0] + %50 = bitcast i8* bitcast (i64* @sll to i8*) to i64* ; [#uses=1] + %51 = call i64 @llvm.atomic.load.or.i64.p0i64(i64* %50, i64 1) ; [#uses=0] + %52 = bitcast i8* bitcast (i64* @ull to i8*) to i64* ; [#uses=1] + %53 = call i64 @llvm.atomic.load.or.i64.p0i64(i64* %52, i64 1) ; [#uses=0] + %54 = call i8 @llvm.atomic.load.xor.i8.p0i8(i8* @sc, i8 1) ; [#uses=0] + %55 = call i8 @llvm.atomic.load.xor.i8.p0i8(i8* @uc, i8 1) ; [#uses=0] + %56 = bitcast i8* bitcast (i16* @ss to i8*) to i16* ; [#uses=1] + %57 = call i16 @llvm.atomic.load.xor.i16.p0i16(i16* %56, i16 1) ; [#uses=0] + %58 = bitcast i8* bitcast (i16* @us to i8*) to i16* ; [#uses=1] + %59 = call i16 @llvm.atomic.load.xor.i16.p0i16(i16* %58, i16 1) ; [#uses=0] + %60 = bitcast i8* bitcast (i32* @si to i8*) to i32* ; [#uses=1] + %61 = call i32 @llvm.atomic.load.xor.i32.p0i32(i32* %60, i32 1) ; [#uses=0] + %62 = bitcast i8* bitcast (i32* @ui to i8*) to i32* ; [#uses=1] + %63 = call i32 @llvm.atomic.load.xor.i32.p0i32(i32* %62, i32 1) ; [#uses=0] + %64 = bitcast i8* bitcast (i32* @sl to i8*) to i32* ; [#uses=1] + %65 = call i32 @llvm.atomic.load.xor.i32.p0i32(i32* %64, i32 1) ; [#uses=0] + %66 = bitcast i8* bitcast (i32* @ul to i8*) to i32* ; [#uses=1] + %67 = call i32 @llvm.atomic.load.xor.i32.p0i32(i32* %66, i32 1) ; [#uses=0] + %68 = bitcast i8* bitcast (i64* @sll to i8*) to i64* ; [#uses=1] + %69 = call i64 @llvm.atomic.load.xor.i64.p0i64(i64* %68, i64 1) ; [#uses=0] + %70 = bitcast i8* bitcast (i64* @ull to i8*) to i64* ; [#uses=1] + %71 = call i64 @llvm.atomic.load.xor.i64.p0i64(i64* %70, i64 1) ; [#uses=0] + %72 = call i8 @llvm.atomic.load.and.i8.p0i8(i8* @sc, i8 1) ; [#uses=0] + %73 = call i8 @llvm.atomic.load.and.i8.p0i8(i8* @uc, i8 1) ; [#uses=0] + %74 = bitcast i8* bitcast (i16* @ss to i8*) to i16* ; [#uses=1] + %75 = call i16 @llvm.atomic.load.and.i16.p0i16(i16* %74, i16 1) ; [#uses=0] + %76 = bitcast i8* bitcast (i16* @us to i8*) to i16* ; [#uses=1] + %77 = call i16 @llvm.atomic.load.and.i16.p0i16(i16* %76, i16 1) ; [#uses=0] + %78 = bitcast i8* bitcast (i32* @si to i8*) to i32* ; [#uses=1] + %79 = call i32 @llvm.atomic.load.and.i32.p0i32(i32* %78, i32 1) ; [#uses=0] + %80 = bitcast i8* bitcast (i32* @ui to i8*) to i32* ; [#uses=1] + %81 = call i32 @llvm.atomic.load.and.i32.p0i32(i32* %80, i32 1) ; [#uses=0] + %82 = bitcast i8* bitcast (i32* @sl to i8*) to i32* ; [#uses=1] + %83 = call i32 @llvm.atomic.load.and.i32.p0i32(i32* %82, i32 1) ; [#uses=0] + %84 = bitcast i8* bitcast (i32* @ul to i8*) to i32* ; [#uses=1] + %85 = call i32 @llvm.atomic.load.and.i32.p0i32(i32* %84, i32 1) ; [#uses=0] + %86 = bitcast i8* bitcast (i64* @sll to i8*) to i64* ; [#uses=1] + %87 = call i64 @llvm.atomic.load.and.i64.p0i64(i64* %86, i64 1) ; [#uses=0] + %88 = bitcast i8* bitcast (i64* @ull to i8*) to i64* ; [#uses=1] + %89 = call i64 @llvm.atomic.load.and.i64.p0i64(i64* %88, i64 1) ; [#uses=0] + %90 = call i8 @llvm.atomic.load.nand.i8.p0i8(i8* @sc, i8 1) ; [#uses=0] + %91 = call i8 @llvm.atomic.load.nand.i8.p0i8(i8* @uc, i8 1) ; [#uses=0] + %92 = bitcast i8* bitcast (i16* @ss to i8*) to i16* ; [#uses=1] + %93 = call i16 @llvm.atomic.load.nand.i16.p0i16(i16* %92, i16 1) ; [#uses=0] + %94 = bitcast i8* bitcast (i16* @us to i8*) to i16* ; [#uses=1] + %95 = call i16 @llvm.atomic.load.nand.i16.p0i16(i16* %94, i16 1) ; [#uses=0] + %96 = bitcast i8* bitcast (i32* @si to i8*) to i32* ; [#uses=1] + %97 = call i32 @llvm.atomic.load.nand.i32.p0i32(i32* %96, i32 1) ; [#uses=0] + %98 = bitcast i8* bitcast (i32* @ui to i8*) to i32* ; [#uses=1] + %99 = call i32 @llvm.atomic.load.nand.i32.p0i32(i32* %98, i32 1) ; [#uses=0] + %100 = bitcast i8* bitcast (i32* @sl to i8*) to i32* ; [#uses=1] + %101 = call i32 @llvm.atomic.load.nand.i32.p0i32(i32* %100, i32 1) ; [#uses=0] + %102 = bitcast i8* bitcast (i32* @ul to i8*) to i32* ; [#uses=1] + %103 = call i32 @llvm.atomic.load.nand.i32.p0i32(i32* %102, i32 1) ; [#uses=0] + %104 = bitcast i8* bitcast (i64* @sll to i8*) to i64* ; [#uses=1] + %105 = call i64 @llvm.atomic.load.nand.i64.p0i64(i64* %104, i64 1) ; [#uses=0] + %106 = bitcast i8* bitcast (i64* @ull to i8*) to i64* ; [#uses=1] + %107 = call i64 @llvm.atomic.load.nand.i64.p0i64(i64* %106, i64 1) ; [#uses=0] + br label %return + +return: ; preds = %entry + ret void +} + +declare i8 @llvm.atomic.load.add.i8.p0i8(i8*, i8) nounwind + +declare i16 @llvm.atomic.load.add.i16.p0i16(i16*, i16) nounwind + +declare i32 @llvm.atomic.load.add.i32.p0i32(i32*, i32) nounwind + +declare i64 @llvm.atomic.load.add.i64.p0i64(i64*, i64) nounwind + +declare i8 @llvm.atomic.load.sub.i8.p0i8(i8*, i8) nounwind + +declare i16 @llvm.atomic.load.sub.i16.p0i16(i16*, i16) nounwind + +declare i32 @llvm.atomic.load.sub.i32.p0i32(i32*, i32) nounwind + +declare i64 @llvm.atomic.load.sub.i64.p0i64(i64*, i64) nounwind + +declare i8 @llvm.atomic.load.or.i8.p0i8(i8*, i8) nounwind + +declare i16 @llvm.atomic.load.or.i16.p0i16(i16*, i16) nounwind + +declare i32 @llvm.atomic.load.or.i32.p0i32(i32*, i32) nounwind + +declare i64 @llvm.atomic.load.or.i64.p0i64(i64*, i64) nounwind + +declare i8 @llvm.atomic.load.xor.i8.p0i8(i8*, i8) nounwind + +declare i16 @llvm.atomic.load.xor.i16.p0i16(i16*, i16) nounwind + +declare i32 @llvm.atomic.load.xor.i32.p0i32(i32*, i32) nounwind + +declare i64 @llvm.atomic.load.xor.i64.p0i64(i64*, i64) nounwind + +declare i8 @llvm.atomic.load.and.i8.p0i8(i8*, i8) nounwind + +declare i16 @llvm.atomic.load.and.i16.p0i16(i16*, i16) nounwind + +declare i32 @llvm.atomic.load.and.i32.p0i32(i32*, i32) nounwind + +declare i64 @llvm.atomic.load.and.i64.p0i64(i64*, i64) nounwind + +declare i8 @llvm.atomic.load.nand.i8.p0i8(i8*, i8) nounwind + +declare i16 @llvm.atomic.load.nand.i16.p0i16(i16*, i16) nounwind + +declare i32 @llvm.atomic.load.nand.i32.p0i32(i32*, i32) nounwind + +declare i64 @llvm.atomic.load.nand.i64.p0i64(i64*, i64) nounwind + +define void @test_fetch_and_op() nounwind { +entry: + %0 = call i8 @llvm.atomic.load.add.i8.p0i8(i8* @sc, i8 11) ; [#uses=1] + store i8 %0, i8* @sc, align 1 + %1 = call i8 @llvm.atomic.load.add.i8.p0i8(i8* @uc, i8 11) ; [#uses=1] + store i8 %1, i8* @uc, align 1 + %2 = bitcast i8* bitcast (i16* @ss to i8*) to i16* ; [#uses=1] + %3 = call i16 @llvm.atomic.load.add.i16.p0i16(i16* %2, i16 11) ; [#uses=1] + store i16 %3, i16* @ss, align 2 + %4 = bitcast i8* bitcast (i16* @us to i8*) to i16* ; [#uses=1] + %5 = call i16 @llvm.atomic.load.add.i16.p0i16(i16* %4, i16 11) ; [#uses=1] + store i16 %5, i16* @us, align 2 + %6 = bitcast i8* bitcast (i32* @si to i8*) to i32* ; [#uses=1] + %7 = call i32 @llvm.atomic.load.add.i32.p0i32(i32* %6, i32 11) ; [#uses=1] + store i32 %7, i32* @si, align 4 + %8 = bitcast i8* bitcast (i32* @ui to i8*) to i32* ; [#uses=1] + %9 = call i32 @llvm.atomic.load.add.i32.p0i32(i32* %8, i32 11) ; [#uses=1] + store i32 %9, i32* @ui, align 4 + %10 = bitcast i8* bitcast (i32* @sl to i8*) to i32* ; [#uses=1] + %11 = call i32 @llvm.atomic.load.add.i32.p0i32(i32* %10, i32 11) ; [#uses=1] + store i32 %11, i32* @sl, align 4 + %12 = bitcast i8* bitcast (i32* @ul to i8*) to i32* ; [#uses=1] + %13 = call i32 @llvm.atomic.load.add.i32.p0i32(i32* %12, i32 11) ; [#uses=1] + store i32 %13, i32* @ul, align 4 + %14 = bitcast i8* bitcast (i64* @sll to i8*) to i64* ; [#uses=1] + %15 = call i64 @llvm.atomic.load.add.i64.p0i64(i64* %14, i64 11) ; [#uses=1] + store i64 %15, i64* @sll, align 8 + %16 = bitcast i8* bitcast (i64* @ull to i8*) to i64* ; [#uses=1] + %17 = call i64 @llvm.atomic.load.add.i64.p0i64(i64* %16, i64 11) ; [#uses=1] + store i64 %17, i64* @ull, align 8 + %18 = call i8 @llvm.atomic.load.sub.i8.p0i8(i8* @sc, i8 11) ; [#uses=1] + store i8 %18, i8* @sc, align 1 + %19 = call i8 @llvm.atomic.load.sub.i8.p0i8(i8* @uc, i8 11) ; [#uses=1] + store i8 %19, i8* @uc, align 1 + %20 = bitcast i8* bitcast (i16* @ss to i8*) to i16* ; [#uses=1] + %21 = call i16 @llvm.atomic.load.sub.i16.p0i16(i16* %20, i16 11) ; [#uses=1] + store i16 %21, i16* @ss, align 2 + %22 = bitcast i8* bitcast (i16* @us to i8*) to i16* ; [#uses=1] + %23 = call i16 @llvm.atomic.load.sub.i16.p0i16(i16* %22, i16 11) ; [#uses=1] + store i16 %23, i16* @us, align 2 + %24 = bitcast i8* bitcast (i32* @si to i8*) to i32* ; [#uses=1] + %25 = call i32 @llvm.atomic.load.sub.i32.p0i32(i32* %24, i32 11) ; [#uses=1] + store i32 %25, i32* @si, align 4 + %26 = bitcast i8* bitcast (i32* @ui to i8*) to i32* ; [#uses=1] + %27 = call i32 @llvm.atomic.load.sub.i32.p0i32(i32* %26, i32 11) ; [#uses=1] + store i32 %27, i32* @ui, align 4 + %28 = bitcast i8* bitcast (i32* @sl to i8*) to i32* ; [#uses=1] + %29 = call i32 @llvm.atomic.load.sub.i32.p0i32(i32* %28, i32 11) ; [#uses=1] + store i32 %29, i32* @sl, align 4 + %30 = bitcast i8* bitcast (i32* @ul to i8*) to i32* ; [#uses=1] + %31 = call i32 @llvm.atomic.load.sub.i32.p0i32(i32* %30, i32 11) ; [#uses=1] + store i32 %31, i32* @ul, align 4 + %32 = bitcast i8* bitcast (i64* @sll to i8*) to i64* ; [#uses=1] + %33 = call i64 @llvm.atomic.load.sub.i64.p0i64(i64* %32, i64 11) ; [#uses=1] + store i64 %33, i64* @sll, align 8 + %34 = bitcast i8* bitcast (i64* @ull to i8*) to i64* ; [#uses=1] + %35 = call i64 @llvm.atomic.load.sub.i64.p0i64(i64* %34, i64 11) ; [#uses=1] + store i64 %35, i64* @ull, align 8 + %36 = call i8 @llvm.atomic.load.or.i8.p0i8(i8* @sc, i8 11) ; [#uses=1] + store i8 %36, i8* @sc, align 1 + %37 = call i8 @llvm.atomic.load.or.i8.p0i8(i8* @uc, i8 11) ; [#uses=1] + store i8 %37, i8* @uc, align 1 + %38 = bitcast i8* bitcast (i16* @ss to i8*) to i16* ; [#uses=1] + %39 = call i16 @llvm.atomic.load.or.i16.p0i16(i16* %38, i16 11) ; [#uses=1] + store i16 %39, i16* @ss, align 2 + %40 = bitcast i8* bitcast (i16* @us to i8*) to i16* ; [#uses=1] + %41 = call i16 @llvm.atomic.load.or.i16.p0i16(i16* %40, i16 11) ; [#uses=1] + store i16 %41, i16* @us, align 2 + %42 = bitcast i8* bitcast (i32* @si to i8*) to i32* ; [#uses=1] + %43 = call i32 @llvm.atomic.load.or.i32.p0i32(i32* %42, i32 11) ; [#uses=1] + store i32 %43, i32* @si, align 4 + %44 = bitcast i8* bitcast (i32* @ui to i8*) to i32* ; [#uses=1] + %45 = call i32 @llvm.atomic.load.or.i32.p0i32(i32* %44, i32 11) ; [#uses=1] + store i32 %45, i32* @ui, align 4 + %46 = bitcast i8* bitcast (i32* @sl to i8*) to i32* ; [#uses=1] + %47 = call i32 @llvm.atomic.load.or.i32.p0i32(i32* %46, i32 11) ; [#uses=1] + store i32 %47, i32* @sl, align 4 + %48 = bitcast i8* bitcast (i32* @ul to i8*) to i32* ; [#uses=1] + %49 = call i32 @llvm.atomic.load.or.i32.p0i32(i32* %48, i32 11) ; [#uses=1] + store i32 %49, i32* @ul, align 4 + %50 = bitcast i8* bitcast (i64* @sll to i8*) to i64* ; [#uses=1] + %51 = call i64 @llvm.atomic.load.or.i64.p0i64(i64* %50, i64 11) ; [#uses=1] + store i64 %51, i64* @sll, align 8 + %52 = bitcast i8* bitcast (i64* @ull to i8*) to i64* ; [#uses=1] + %53 = call i64 @llvm.atomic.load.or.i64.p0i64(i64* %52, i64 11) ; [#uses=1] + store i64 %53, i64* @ull, align 8 + %54 = call i8 @llvm.atomic.load.xor.i8.p0i8(i8* @sc, i8 11) ; [#uses=1] + store i8 %54, i8* @sc, align 1 + %55 = call i8 @llvm.atomic.load.xor.i8.p0i8(i8* @uc, i8 11) ; [#uses=1] + store i8 %55, i8* @uc, align 1 + %56 = bitcast i8* bitcast (i16* @ss to i8*) to i16* ; [#uses=1] + %57 = call i16 @llvm.atomic.load.xor.i16.p0i16(i16* %56, i16 11) ; [#uses=1] + store i16 %57, i16* @ss, align 2 + %58 = bitcast i8* bitcast (i16* @us to i8*) to i16* ; [#uses=1] + %59 = call i16 @llvm.atomic.load.xor.i16.p0i16(i16* %58, i16 11) ; [#uses=1] + store i16 %59, i16* @us, align 2 + %60 = bitcast i8* bitcast (i32* @si to i8*) to i32* ; [#uses=1] + %61 = call i32 @llvm.atomic.load.xor.i32.p0i32(i32* %60, i32 11) ; [#uses=1] + store i32 %61, i32* @si, align 4 + %62 = bitcast i8* bitcast (i32* @ui to i8*) to i32* ; [#uses=1] + %63 = call i32 @llvm.atomic.load.xor.i32.p0i32(i32* %62, i32 11) ; [#uses=1] + store i32 %63, i32* @ui, align 4 + %64 = bitcast i8* bitcast (i32* @sl to i8*) to i32* ; [#uses=1] + %65 = call i32 @llvm.atomic.load.xor.i32.p0i32(i32* %64, i32 11) ; [#uses=1] + store i32 %65, i32* @sl, align 4 + %66 = bitcast i8* bitcast (i32* @ul to i8*) to i32* ; [#uses=1] + %67 = call i32 @llvm.atomic.load.xor.i32.p0i32(i32* %66, i32 11) ; [#uses=1] + store i32 %67, i32* @ul, align 4 + %68 = bitcast i8* bitcast (i64* @sll to i8*) to i64* ; [#uses=1] + %69 = call i64 @llvm.atomic.load.xor.i64.p0i64(i64* %68, i64 11) ; [#uses=1] + store i64 %69, i64* @sll, align 8 + %70 = bitcast i8* bitcast (i64* @ull to i8*) to i64* ; [#uses=1] + %71 = call i64 @llvm.atomic.load.xor.i64.p0i64(i64* %70, i64 11) ; [#uses=1] + store i64 %71, i64* @ull, align 8 + %72 = call i8 @llvm.atomic.load.and.i8.p0i8(i8* @sc, i8 11) ; [#uses=1] + store i8 %72, i8* @sc, align 1 + %73 = call i8 @llvm.atomic.load.and.i8.p0i8(i8* @uc, i8 11) ; [#uses=1] + store i8 %73, i8* @uc, align 1 + %74 = bitcast i8* bitcast (i16* @ss to i8*) to i16* ; [#uses=1] + %75 = call i16 @llvm.atomic.load.and.i16.p0i16(i16* %74, i16 11) ; [#uses=1] + store i16 %75, i16* @ss, align 2 + %76 = bitcast i8* bitcast (i16* @us to i8*) to i16* ; [#uses=1] + %77 = call i16 @llvm.atomic.load.and.i16.p0i16(i16* %76, i16 11) ; [#uses=1] + store i16 %77, i16* @us, align 2 + %78 = bitcast i8* bitcast (i32* @si to i8*) to i32* ; [#uses=1] + %79 = call i32 @llvm.atomic.load.and.i32.p0i32(i32* %78, i32 11) ; [#uses=1] + store i32 %79, i32* @si, align 4 + %80 = bitcast i8* bitcast (i32* @ui to i8*) to i32* ; [#uses=1] + %81 = call i32 @llvm.atomic.load.and.i32.p0i32(i32* %80, i32 11) ; [#uses=1] + store i32 %81, i32* @ui, align 4 + %82 = bitcast i8* bitcast (i32* @sl to i8*) to i32* ; [#uses=1] + %83 = call i32 @llvm.atomic.load.and.i32.p0i32(i32* %82, i32 11) ; [#uses=1] + store i32 %83, i32* @sl, align 4 + %84 = bitcast i8* bitcast (i32* @ul to i8*) to i32* ; [#uses=1] + %85 = call i32 @llvm.atomic.load.and.i32.p0i32(i32* %84, i32 11) ; [#uses=1] + store i32 %85, i32* @ul, align 4 + %86 = bitcast i8* bitcast (i64* @sll to i8*) to i64* ; [#uses=1] + %87 = call i64 @llvm.atomic.load.and.i64.p0i64(i64* %86, i64 11) ; [#uses=1] + store i64 %87, i64* @sll, align 8 + %88 = bitcast i8* bitcast (i64* @ull to i8*) to i64* ; [#uses=1] + %89 = call i64 @llvm.atomic.load.and.i64.p0i64(i64* %88, i64 11) ; [#uses=1] + store i64 %89, i64* @ull, align 8 + %90 = call i8 @llvm.atomic.load.nand.i8.p0i8(i8* @sc, i8 11) ; [#uses=1] + store i8 %90, i8* @sc, align 1 + %91 = call i8 @llvm.atomic.load.nand.i8.p0i8(i8* @uc, i8 11) ; [#uses=1] + store i8 %91, i8* @uc, align 1 + %92 = bitcast i8* bitcast (i16* @ss to i8*) to i16* ; [#uses=1] + %93 = call i16 @llvm.atomic.load.nand.i16.p0i16(i16* %92, i16 11) ; [#uses=1] + store i16 %93, i16* @ss, align 2 + %94 = bitcast i8* bitcast (i16* @us to i8*) to i16* ; [#uses=1] + %95 = call i16 @llvm.atomic.load.nand.i16.p0i16(i16* %94, i16 11) ; [#uses=1] + store i16 %95, i16* @us, align 2 + %96 = bitcast i8* bitcast (i32* @si to i8*) to i32* ; [#uses=1] + %97 = call i32 @llvm.atomic.load.nand.i32.p0i32(i32* %96, i32 11) ; [#uses=1] + store i32 %97, i32* @si, align 4 + %98 = bitcast i8* bitcast (i32* @ui to i8*) to i32* ; [#uses=1] + %99 = call i32 @llvm.atomic.load.nand.i32.p0i32(i32* %98, i32 11) ; [#uses=1] + store i32 %99, i32* @ui, align 4 + %100 = bitcast i8* bitcast (i32* @sl to i8*) to i32* ; [#uses=1] + %101 = call i32 @llvm.atomic.load.nand.i32.p0i32(i32* %100, i32 11) ; [#uses=1] + store i32 %101, i32* @sl, align 4 + %102 = bitcast i8* bitcast (i32* @ul to i8*) to i32* ; [#uses=1] + %103 = call i32 @llvm.atomic.load.nand.i32.p0i32(i32* %102, i32 11) ; [#uses=1] + store i32 %103, i32* @ul, align 4 + %104 = bitcast i8* bitcast (i64* @sll to i8*) to i64* ; [#uses=1] + %105 = call i64 @llvm.atomic.load.nand.i64.p0i64(i64* %104, i64 11) ; [#uses=1] + store i64 %105, i64* @sll, align 8 + %106 = bitcast i8* bitcast (i64* @ull to i8*) to i64* ; [#uses=1] + %107 = call i64 @llvm.atomic.load.nand.i64.p0i64(i64* %106, i64 11) ; [#uses=1] + store i64 %107, i64* @ull, align 8 + br label %return + +return: ; preds = %entry + ret void +} + +define void @test_op_and_fetch() nounwind { +entry: + %0 = load i8* @uc, align 1 ; [#uses=1] + %1 = zext i8 %0 to i32 ; [#uses=1] + %2 = trunc i32 %1 to i8 ; [#uses=2] + %3 = call i8 @llvm.atomic.load.add.i8.p0i8(i8* @sc, i8 %2) ; [#uses=1] + %4 = add i8 %3, %2 ; [#uses=1] + store i8 %4, i8* @sc, align 1 + %5 = load i8* @uc, align 1 ; [#uses=1] + %6 = zext i8 %5 to i32 ; [#uses=1] + %7 = trunc i32 %6 to i8 ; [#uses=2] + %8 = call i8 @llvm.atomic.load.add.i8.p0i8(i8* @uc, i8 %7) ; [#uses=1] + %9 = add i8 %8, %7 ; [#uses=1] + store i8 %9, i8* @uc, align 1 + %10 = load i8* @uc, align 1 ; [#uses=1] + %11 = zext i8 %10 to i32 ; [#uses=1] + %12 = bitcast i8* bitcast (i16* @ss to i8*) to i16* ; [#uses=1] + %13 = trunc i32 %11 to i16 ; [#uses=2] + %14 = call i16 @llvm.atomic.load.add.i16.p0i16(i16* %12, i16 %13) ; [#uses=1] + %15 = add i16 %14, %13 ; [#uses=1] + store i16 %15, i16* @ss, align 2 + %16 = load i8* @uc, align 1 ; [#uses=1] + %17 = zext i8 %16 to i32 ; [#uses=1] + %18 = bitcast i8* bitcast (i16* @us to i8*) to i16* ; [#uses=1] + %19 = trunc i32 %17 to i16 ; [#uses=2] + %20 = call i16 @llvm.atomic.load.add.i16.p0i16(i16* %18, i16 %19) ; [#uses=1] + %21 = add i16 %20, %19 ; [#uses=1] + store i16 %21, i16* @us, align 2 + %22 = load i8* @uc, align 1 ; [#uses=1] + %23 = zext i8 %22 to i32 ; [#uses=2] + %24 = bitcast i8* bitcast (i32* @si to i8*) to i32* ; [#uses=1] + %25 = call i32 @llvm.atomic.load.add.i32.p0i32(i32* %24, i32 %23) ; [#uses=1] + %26 = add i32 %25, %23 ; [#uses=1] + store i32 %26, i32* @si, align 4 + %27 = load i8* @uc, align 1 ; [#uses=1] + %28 = zext i8 %27 to i32 ; [#uses=2] + %29 = bitcast i8* bitcast (i32* @ui to i8*) to i32* ; [#uses=1] + %30 = call i32 @llvm.atomic.load.add.i32.p0i32(i32* %29, i32 %28) ; [#uses=1] + %31 = add i32 %30, %28 ; [#uses=1] + store i32 %31, i32* @ui, align 4 + %32 = load i8* @uc, align 1 ; [#uses=1] + %33 = zext i8 %32 to i32 ; [#uses=2] + %34 = bitcast i8* bitcast (i32* @sl to i8*) to i32* ; [#uses=1] + %35 = call i32 @llvm.atomic.load.add.i32.p0i32(i32* %34, i32 %33) ; [#uses=1] + %36 = add i32 %35, %33 ; [#uses=1] + store i32 %36, i32* @sl, align 4 + %37 = load i8* @uc, align 1 ; [#uses=1] + %38 = zext i8 %37 to i32 ; [#uses=2] + %39 = bitcast i8* bitcast (i32* @ul to i8*) to i32* ; [#uses=1] + %40 = call i32 @llvm.atomic.load.add.i32.p0i32(i32* %39, i32 %38) ; [#uses=1] + %41 = add i32 %40, %38 ; [#uses=1] + store i32 %41, i32* @ul, align 4 + %42 = load i8* @uc, align 1 ; [#uses=1] + %43 = zext i8 %42 to i64 ; [#uses=2] + %44 = bitcast i8* bitcast (i64* @sll to i8*) to i64* ; [#uses=1] + %45 = call i64 @llvm.atomic.load.add.i64.p0i64(i64* %44, i64 %43) ; [#uses=1] + %46 = add i64 %45, %43 ; [#uses=1] + store i64 %46, i64* @sll, align 8 + %47 = load i8* @uc, align 1 ; [#uses=1] + %48 = zext i8 %47 to i64 ; [#uses=2] + %49 = bitcast i8* bitcast (i64* @ull to i8*) to i64* ; [#uses=1] + %50 = call i64 @llvm.atomic.load.add.i64.p0i64(i64* %49, i64 %48) ; [#uses=1] + %51 = add i64 %50, %48 ; [#uses=1] + store i64 %51, i64* @ull, align 8 + %52 = load i8* @uc, align 1 ; [#uses=1] + %53 = zext i8 %52 to i32 ; [#uses=1] + %54 = trunc i32 %53 to i8 ; [#uses=2] + %55 = call i8 @llvm.atomic.load.sub.i8.p0i8(i8* @sc, i8 %54) ; [#uses=1] + %56 = sub i8 %55, %54 ; [#uses=1] + store i8 %56, i8* @sc, align 1 + %57 = load i8* @uc, align 1 ; [#uses=1] + %58 = zext i8 %57 to i32 ; [#uses=1] + %59 = trunc i32 %58 to i8 ; [#uses=2] + %60 = call i8 @llvm.atomic.load.sub.i8.p0i8(i8* @uc, i8 %59) ; [#uses=1] + %61 = sub i8 %60, %59 ; [#uses=1] + store i8 %61, i8* @uc, align 1 + %62 = load i8* @uc, align 1 ; [#uses=1] + %63 = zext i8 %62 to i32 ; [#uses=1] + %64 = bitcast i8* bitcast (i16* @ss to i8*) to i16* ; [#uses=1] + %65 = trunc i32 %63 to i16 ; [#uses=2] + %66 = call i16 @llvm.atomic.load.sub.i16.p0i16(i16* %64, i16 %65) ; [#uses=1] + %67 = sub i16 %66, %65 ; [#uses=1] + store i16 %67, i16* @ss, align 2 + %68 = load i8* @uc, align 1 ; [#uses=1] + %69 = zext i8 %68 to i32 ; [#uses=1] + %70 = bitcast i8* bitcast (i16* @us to i8*) to i16* ; [#uses=1] + %71 = trunc i32 %69 to i16 ; [#uses=2] + %72 = call i16 @llvm.atomic.load.sub.i16.p0i16(i16* %70, i16 %71) ; [#uses=1] + %73 = sub i16 %72, %71 ; [#uses=1] + store i16 %73, i16* @us, align 2 + %74 = load i8* @uc, align 1 ; [#uses=1] + %75 = zext i8 %74 to i32 ; [#uses=2] + %76 = bitcast i8* bitcast (i32* @si to i8*) to i32* ; [#uses=1] + %77 = call i32 @llvm.atomic.load.sub.i32.p0i32(i32* %76, i32 %75) ; [#uses=1] + %78 = sub i32 %77, %75 ; [#uses=1] + store i32 %78, i32* @si, align 4 + %79 = load i8* @uc, align 1 ; [#uses=1] + %80 = zext i8 %79 to i32 ; [#uses=2] + %81 = bitcast i8* bitcast (i32* @ui to i8*) to i32* ; [#uses=1] + %82 = call i32 @llvm.atomic.load.sub.i32.p0i32(i32* %81, i32 %80) ; [#uses=1] + %83 = sub i32 %82, %80 ; [#uses=1] + store i32 %83, i32* @ui, align 4 + %84 = load i8* @uc, align 1 ; [#uses=1] + %85 = zext i8 %84 to i32 ; [#uses=2] + %86 = bitcast i8* bitcast (i32* @sl to i8*) to i32* ; [#uses=1] + %87 = call i32 @llvm.atomic.load.sub.i32.p0i32(i32* %86, i32 %85) ; [#uses=1] + %88 = sub i32 %87, %85 ; [#uses=1] + store i32 %88, i32* @sl, align 4 + %89 = load i8* @uc, align 1 ; [#uses=1] + %90 = zext i8 %89 to i32 ; [#uses=2] + %91 = bitcast i8* bitcast (i32* @ul to i8*) to i32* ; [#uses=1] + %92 = call i32 @llvm.atomic.load.sub.i32.p0i32(i32* %91, i32 %90) ; [#uses=1] + %93 = sub i32 %92, %90 ; [#uses=1] + store i32 %93, i32* @ul, align 4 + %94 = load i8* @uc, align 1 ; [#uses=1] + %95 = zext i8 %94 to i64 ; [#uses=2] + %96 = bitcast i8* bitcast (i64* @sll to i8*) to i64* ; [#uses=1] + %97 = call i64 @llvm.atomic.load.sub.i64.p0i64(i64* %96, i64 %95) ; [#uses=1] + %98 = sub i64 %97, %95 ; [#uses=1] + store i64 %98, i64* @sll, align 8 + %99 = load i8* @uc, align 1 ; [#uses=1] + %100 = zext i8 %99 to i64 ; [#uses=2] + %101 = bitcast i8* bitcast (i64* @ull to i8*) to i64* ; [#uses=1] + %102 = call i64 @llvm.atomic.load.sub.i64.p0i64(i64* %101, i64 %100) ; [#uses=1] + %103 = sub i64 %102, %100 ; [#uses=1] + store i64 %103, i64* @ull, align 8 + %104 = load i8* @uc, align 1 ; [#uses=1] + %105 = zext i8 %104 to i32 ; [#uses=1] + %106 = trunc i32 %105 to i8 ; [#uses=2] + %107 = call i8 @llvm.atomic.load.or.i8.p0i8(i8* @sc, i8 %106) ; [#uses=1] + %108 = or i8 %107, %106 ; [#uses=1] + store i8 %108, i8* @sc, align 1 + %109 = load i8* @uc, align 1 ; [#uses=1] + %110 = zext i8 %109 to i32 ; [#uses=1] + %111 = trunc i32 %110 to i8 ; [#uses=2] + %112 = call i8 @llvm.atomic.load.or.i8.p0i8(i8* @uc, i8 %111) ; [#uses=1] + %113 = or i8 %112, %111 ; [#uses=1] + store i8 %113, i8* @uc, align 1 + %114 = load i8* @uc, align 1 ; [#uses=1] + %115 = zext i8 %114 to i32 ; [#uses=1] + %116 = bitcast i8* bitcast (i16* @ss to i8*) to i16* ; [#uses=1] + %117 = trunc i32 %115 to i16 ; [#uses=2] + %118 = call i16 @llvm.atomic.load.or.i16.p0i16(i16* %116, i16 %117) ; [#uses=1] + %119 = or i16 %118, %117 ; [#uses=1] + store i16 %119, i16* @ss, align 2 + %120 = load i8* @uc, align 1 ; [#uses=1] + %121 = zext i8 %120 to i32 ; [#uses=1] + %122 = bitcast i8* bitcast (i16* @us to i8*) to i16* ; [#uses=1] + %123 = trunc i32 %121 to i16 ; [#uses=2] + %124 = call i16 @llvm.atomic.load.or.i16.p0i16(i16* %122, i16 %123) ; [#uses=1] + %125 = or i16 %124, %123 ; [#uses=1] + store i16 %125, i16* @us, align 2 + %126 = load i8* @uc, align 1 ; [#uses=1] + %127 = zext i8 %126 to i32 ; [#uses=2] + %128 = bitcast i8* bitcast (i32* @si to i8*) to i32* ; [#uses=1] + %129 = call i32 @llvm.atomic.load.or.i32.p0i32(i32* %128, i32 %127) ; [#uses=1] + %130 = or i32 %129, %127 ; [#uses=1] + store i32 %130, i32* @si, align 4 + %131 = load i8* @uc, align 1 ; [#uses=1] + %132 = zext i8 %131 to i32 ; [#uses=2] + %133 = bitcast i8* bitcast (i32* @ui to i8*) to i32* ; [#uses=1] + %134 = call i32 @llvm.atomic.load.or.i32.p0i32(i32* %133, i32 %132) ; [#uses=1] + %135 = or i32 %134, %132 ; [#uses=1] + store i32 %135, i32* @ui, align 4 + %136 = load i8* @uc, align 1 ; [#uses=1] + %137 = zext i8 %136 to i32 ; [#uses=2] + %138 = bitcast i8* bitcast (i32* @sl to i8*) to i32* ; [#uses=1] + %139 = call i32 @llvm.atomic.load.or.i32.p0i32(i32* %138, i32 %137) ; [#uses=1] + %140 = or i32 %139, %137 ; [#uses=1] + store i32 %140, i32* @sl, align 4 + %141 = load i8* @uc, align 1 ; [#uses=1] + %142 = zext i8 %141 to i32 ; [#uses=2] + %143 = bitcast i8* bitcast (i32* @ul to i8*) to i32* ; [#uses=1] + %144 = call i32 @llvm.atomic.load.or.i32.p0i32(i32* %143, i32 %142) ; [#uses=1] + %145 = or i32 %144, %142 ; [#uses=1] + store i32 %145, i32* @ul, align 4 + %146 = load i8* @uc, align 1 ; [#uses=1] + %147 = zext i8 %146 to i64 ; [#uses=2] + %148 = bitcast i8* bitcast (i64* @sll to i8*) to i64* ; [#uses=1] + %149 = call i64 @llvm.atomic.load.or.i64.p0i64(i64* %148, i64 %147) ; [#uses=1] + %150 = or i64 %149, %147 ; [#uses=1] + store i64 %150, i64* @sll, align 8 + %151 = load i8* @uc, align 1 ; [#uses=1] + %152 = zext i8 %151 to i64 ; [#uses=2] + %153 = bitcast i8* bitcast (i64* @ull to i8*) to i64* ; [#uses=1] + %154 = call i64 @llvm.atomic.load.or.i64.p0i64(i64* %153, i64 %152) ; [#uses=1] + %155 = or i64 %154, %152 ; [#uses=1] + store i64 %155, i64* @ull, align 8 + %156 = load i8* @uc, align 1 ; [#uses=1] + %157 = zext i8 %156 to i32 ; [#uses=1] + %158 = trunc i32 %157 to i8 ; [#uses=2] + %159 = call i8 @llvm.atomic.load.xor.i8.p0i8(i8* @sc, i8 %158) ; [#uses=1] + %160 = xor i8 %159, %158 ; [#uses=1] + store i8 %160, i8* @sc, align 1 + %161 = load i8* @uc, align 1 ; [#uses=1] + %162 = zext i8 %161 to i32 ; [#uses=1] + %163 = trunc i32 %162 to i8 ; [#uses=2] + %164 = call i8 @llvm.atomic.load.xor.i8.p0i8(i8* @uc, i8 %163) ; [#uses=1] + %165 = xor i8 %164, %163 ; [#uses=1] + store i8 %165, i8* @uc, align 1 + %166 = load i8* @uc, align 1 ; [#uses=1] + %167 = zext i8 %166 to i32 ; [#uses=1] + %168 = bitcast i8* bitcast (i16* @ss to i8*) to i16* ; [#uses=1] + %169 = trunc i32 %167 to i16 ; [#uses=2] + %170 = call i16 @llvm.atomic.load.xor.i16.p0i16(i16* %168, i16 %169) ; [#uses=1] + %171 = xor i16 %170, %169 ; [#uses=1] + store i16 %171, i16* @ss, align 2 + %172 = load i8* @uc, align 1 ; [#uses=1] + %173 = zext i8 %172 to i32 ; [#uses=1] + %174 = bitcast i8* bitcast (i16* @us to i8*) to i16* ; [#uses=1] + %175 = trunc i32 %173 to i16 ; [#uses=2] + %176 = call i16 @llvm.atomic.load.xor.i16.p0i16(i16* %174, i16 %175) ; [#uses=1] + %177 = xor i16 %176, %175 ; [#uses=1] + store i16 %177, i16* @us, align 2 + %178 = load i8* @uc, align 1 ; [#uses=1] + %179 = zext i8 %178 to i32 ; [#uses=2] + %180 = bitcast i8* bitcast (i32* @si to i8*) to i32* ; [#uses=1] + %181 = call i32 @llvm.atomic.load.xor.i32.p0i32(i32* %180, i32 %179) ; [#uses=1] + %182 = xor i32 %181, %179 ; [#uses=1] + store i32 %182, i32* @si, align 4 + %183 = load i8* @uc, align 1 ; [#uses=1] + %184 = zext i8 %183 to i32 ; [#uses=2] + %185 = bitcast i8* bitcast (i32* @ui to i8*) to i32* ; [#uses=1] + %186 = call i32 @llvm.atomic.load.xor.i32.p0i32(i32* %185, i32 %184) ; [#uses=1] + %187 = xor i32 %186, %184 ; [#uses=1] + store i32 %187, i32* @ui, align 4 + %188 = load i8* @uc, align 1 ; [#uses=1] + %189 = zext i8 %188 to i32 ; [#uses=2] + %190 = bitcast i8* bitcast (i32* @sl to i8*) to i32* ; [#uses=1] + %191 = call i32 @llvm.atomic.load.xor.i32.p0i32(i32* %190, i32 %189) ; [#uses=1] + %192 = xor i32 %191, %189 ; [#uses=1] + store i32 %192, i32* @sl, align 4 + %193 = load i8* @uc, align 1 ; [#uses=1] + %194 = zext i8 %193 to i32 ; [#uses=2] + %195 = bitcast i8* bitcast (i32* @ul to i8*) to i32* ; [#uses=1] + %196 = call i32 @llvm.atomic.load.xor.i32.p0i32(i32* %195, i32 %194) ; [#uses=1] + %197 = xor i32 %196, %194 ; [#uses=1] + store i32 %197, i32* @ul, align 4 + %198 = load i8* @uc, align 1 ; [#uses=1] + %199 = zext i8 %198 to i64 ; [#uses=2] + %200 = bitcast i8* bitcast (i64* @sll to i8*) to i64* ; [#uses=1] + %201 = call i64 @llvm.atomic.load.xor.i64.p0i64(i64* %200, i64 %199) ; [#uses=1] + %202 = xor i64 %201, %199 ; [#uses=1] + store i64 %202, i64* @sll, align 8 + %203 = load i8* @uc, align 1 ; [#uses=1] + %204 = zext i8 %203 to i64 ; [#uses=2] + %205 = bitcast i8* bitcast (i64* @ull to i8*) to i64* ; [#uses=1] + %206 = call i64 @llvm.atomic.load.xor.i64.p0i64(i64* %205, i64 %204) ; [#uses=1] + %207 = xor i64 %206, %204 ; [#uses=1] + store i64 %207, i64* @ull, align 8 + %208 = load i8* @uc, align 1 ; [#uses=1] + %209 = zext i8 %208 to i32 ; [#uses=1] + %210 = trunc i32 %209 to i8 ; [#uses=2] + %211 = call i8 @llvm.atomic.load.and.i8.p0i8(i8* @sc, i8 %210) ; [#uses=1] + %212 = and i8 %211, %210 ; [#uses=1] + store i8 %212, i8* @sc, align 1 + %213 = load i8* @uc, align 1 ; [#uses=1] + %214 = zext i8 %213 to i32 ; [#uses=1] + %215 = trunc i32 %214 to i8 ; [#uses=2] + %216 = call i8 @llvm.atomic.load.and.i8.p0i8(i8* @uc, i8 %215) ; [#uses=1] + %217 = and i8 %216, %215 ; [#uses=1] + store i8 %217, i8* @uc, align 1 + %218 = load i8* @uc, align 1 ; [#uses=1] + %219 = zext i8 %218 to i32 ; [#uses=1] + %220 = bitcast i8* bitcast (i16* @ss to i8*) to i16* ; [#uses=1] + %221 = trunc i32 %219 to i16 ; [#uses=2] + %222 = call i16 @llvm.atomic.load.and.i16.p0i16(i16* %220, i16 %221) ; [#uses=1] + %223 = and i16 %222, %221 ; [#uses=1] + store i16 %223, i16* @ss, align 2 + %224 = load i8* @uc, align 1 ; [#uses=1] + %225 = zext i8 %224 to i32 ; [#uses=1] + %226 = bitcast i8* bitcast (i16* @us to i8*) to i16* ; [#uses=1] + %227 = trunc i32 %225 to i16 ; [#uses=2] + %228 = call i16 @llvm.atomic.load.and.i16.p0i16(i16* %226, i16 %227) ; [#uses=1] + %229 = and i16 %228, %227 ; [#uses=1] + store i16 %229, i16* @us, align 2 + %230 = load i8* @uc, align 1 ; [#uses=1] + %231 = zext i8 %230 to i32 ; [#uses=2] + %232 = bitcast i8* bitcast (i32* @si to i8*) to i32* ; [#uses=1] + %233 = call i32 @llvm.atomic.load.and.i32.p0i32(i32* %232, i32 %231) ; [#uses=1] + %234 = and i32 %233, %231 ; [#uses=1] + store i32 %234, i32* @si, align 4 + %235 = load i8* @uc, align 1 ; [#uses=1] + %236 = zext i8 %235 to i32 ; [#uses=2] + %237 = bitcast i8* bitcast (i32* @ui to i8*) to i32* ; [#uses=1] + %238 = call i32 @llvm.atomic.load.and.i32.p0i32(i32* %237, i32 %236) ; [#uses=1] + %239 = and i32 %238, %236 ; [#uses=1] + store i32 %239, i32* @ui, align 4 + %240 = load i8* @uc, align 1 ; [#uses=1] + %241 = zext i8 %240 to i32 ; [#uses=2] + %242 = bitcast i8* bitcast (i32* @sl to i8*) to i32* ; [#uses=1] + %243 = call i32 @llvm.atomic.load.and.i32.p0i32(i32* %242, i32 %241) ; [#uses=1] + %244 = and i32 %243, %241 ; [#uses=1] + store i32 %244, i32* @sl, align 4 + %245 = load i8* @uc, align 1 ; [#uses=1] + %246 = zext i8 %245 to i32 ; [#uses=2] + %247 = bitcast i8* bitcast (i32* @ul to i8*) to i32* ; [#uses=1] + %248 = call i32 @llvm.atomic.load.and.i32.p0i32(i32* %247, i32 %246) ; [#uses=1] + %249 = and i32 %248, %246 ; [#uses=1] + store i32 %249, i32* @ul, align 4 + %250 = load i8* @uc, align 1 ; [#uses=1] + %251 = zext i8 %250 to i64 ; [#uses=2] + %252 = bitcast i8* bitcast (i64* @sll to i8*) to i64* ; [#uses=1] + %253 = call i64 @llvm.atomic.load.and.i64.p0i64(i64* %252, i64 %251) ; [#uses=1] + %254 = and i64 %253, %251 ; [#uses=1] + store i64 %254, i64* @sll, align 8 + %255 = load i8* @uc, align 1 ; [#uses=1] + %256 = zext i8 %255 to i64 ; [#uses=2] + %257 = bitcast i8* bitcast (i64* @ull to i8*) to i64* ; [#uses=1] + %258 = call i64 @llvm.atomic.load.and.i64.p0i64(i64* %257, i64 %256) ; [#uses=1] + %259 = and i64 %258, %256 ; [#uses=1] + store i64 %259, i64* @ull, align 8 + %260 = load i8* @uc, align 1 ; [#uses=1] + %261 = zext i8 %260 to i32 ; [#uses=1] + %262 = trunc i32 %261 to i8 ; [#uses=2] + %263 = call i8 @llvm.atomic.load.nand.i8.p0i8(i8* @sc, i8 %262) ; [#uses=1] + %264 = xor i8 %263, -1 ; [#uses=1] + %265 = and i8 %264, %262 ; [#uses=1] + store i8 %265, i8* @sc, align 1 + %266 = load i8* @uc, align 1 ; [#uses=1] + %267 = zext i8 %266 to i32 ; [#uses=1] + %268 = trunc i32 %267 to i8 ; [#uses=2] + %269 = call i8 @llvm.atomic.load.nand.i8.p0i8(i8* @uc, i8 %268) ; [#uses=1] + %270 = xor i8 %269, -1 ; [#uses=1] + %271 = and i8 %270, %268 ; [#uses=1] + store i8 %271, i8* @uc, align 1 + %272 = load i8* @uc, align 1 ; [#uses=1] + %273 = zext i8 %272 to i32 ; [#uses=1] + %274 = bitcast i8* bitcast (i16* @ss to i8*) to i16* ; [#uses=1] + %275 = trunc i32 %273 to i16 ; [#uses=2] + %276 = call i16 @llvm.atomic.load.nand.i16.p0i16(i16* %274, i16 %275) ; [#uses=1] + %277 = xor i16 %276, -1 ; [#uses=1] + %278 = and i16 %277, %275 ; [#uses=1] + store i16 %278, i16* @ss, align 2 + %279 = load i8* @uc, align 1 ; [#uses=1] + %280 = zext i8 %279 to i32 ; [#uses=1] + %281 = bitcast i8* bitcast (i16* @us to i8*) to i16* ; [#uses=1] + %282 = trunc i32 %280 to i16 ; [#uses=2] + %283 = call i16 @llvm.atomic.load.nand.i16.p0i16(i16* %281, i16 %282) ; [#uses=1] + %284 = xor i16 %283, -1 ; [#uses=1] + %285 = and i16 %284, %282 ; [#uses=1] + store i16 %285, i16* @us, align 2 + %286 = load i8* @uc, align 1 ; [#uses=1] + %287 = zext i8 %286 to i32 ; [#uses=2] + %288 = bitcast i8* bitcast (i32* @si to i8*) to i32* ; [#uses=1] + %289 = call i32 @llvm.atomic.load.nand.i32.p0i32(i32* %288, i32 %287) ; [#uses=1] + %290 = xor i32 %289, -1 ; [#uses=1] + %291 = and i32 %290, %287 ; [#uses=1] + store i32 %291, i32* @si, align 4 + %292 = load i8* @uc, align 1 ; [#uses=1] + %293 = zext i8 %292 to i32 ; [#uses=2] + %294 = bitcast i8* bitcast (i32* @ui to i8*) to i32* ; [#uses=1] + %295 = call i32 @llvm.atomic.load.nand.i32.p0i32(i32* %294, i32 %293) ; [#uses=1] + %296 = xor i32 %295, -1 ; [#uses=1] + %297 = and i32 %296, %293 ; [#uses=1] + store i32 %297, i32* @ui, align 4 + %298 = load i8* @uc, align 1 ; [#uses=1] + %299 = zext i8 %298 to i32 ; [#uses=2] + %300 = bitcast i8* bitcast (i32* @sl to i8*) to i32* ; [#uses=1] + %301 = call i32 @llvm.atomic.load.nand.i32.p0i32(i32* %300, i32 %299) ; [#uses=1] + %302 = xor i32 %301, -1 ; [#uses=1] + %303 = and i32 %302, %299 ; [#uses=1] + store i32 %303, i32* @sl, align 4 + %304 = load i8* @uc, align 1 ; [#uses=1] + %305 = zext i8 %304 to i32 ; [#uses=2] + %306 = bitcast i8* bitcast (i32* @ul to i8*) to i32* ; [#uses=1] + %307 = call i32 @llvm.atomic.load.nand.i32.p0i32(i32* %306, i32 %305) ; [#uses=1] + %308 = xor i32 %307, -1 ; [#uses=1] + %309 = and i32 %308, %305 ; [#uses=1] + store i32 %309, i32* @ul, align 4 + %310 = load i8* @uc, align 1 ; [#uses=1] + %311 = zext i8 %310 to i64 ; [#uses=2] + %312 = bitcast i8* bitcast (i64* @sll to i8*) to i64* ; [#uses=1] + %313 = call i64 @llvm.atomic.load.nand.i64.p0i64(i64* %312, i64 %311) ; [#uses=1] + %314 = xor i64 %313, -1 ; [#uses=1] + %315 = and i64 %314, %311 ; [#uses=1] + store i64 %315, i64* @sll, align 8 + %316 = load i8* @uc, align 1 ; [#uses=1] + %317 = zext i8 %316 to i64 ; [#uses=2] + %318 = bitcast i8* bitcast (i64* @ull to i8*) to i64* ; [#uses=1] + %319 = call i64 @llvm.atomic.load.nand.i64.p0i64(i64* %318, i64 %317) ; [#uses=1] + %320 = xor i64 %319, -1 ; [#uses=1] + %321 = and i64 %320, %317 ; [#uses=1] + store i64 %321, i64* @ull, align 8 + br label %return + +return: ; preds = %entry + ret void +} + +define void @test_compare_and_swap() nounwind { +entry: + %0 = load i8* @sc, align 1 ; [#uses=1] + %1 = zext i8 %0 to i32 ; [#uses=1] + %2 = load i8* @uc, align 1 ; [#uses=1] + %3 = zext i8 %2 to i32 ; [#uses=1] + %4 = trunc i32 %3 to i8 ; [#uses=1] + %5 = trunc i32 %1 to i8 ; [#uses=1] + %6 = call i8 @llvm.atomic.cmp.swap.i8.p0i8(i8* @sc, i8 %4, i8 %5) ; [#uses=1] + store i8 %6, i8* @sc, align 1 + %7 = load i8* @sc, align 1 ; [#uses=1] + %8 = zext i8 %7 to i32 ; [#uses=1] + %9 = load i8* @uc, align 1 ; [#uses=1] + %10 = zext i8 %9 to i32 ; [#uses=1] + %11 = trunc i32 %10 to i8 ; [#uses=1] + %12 = trunc i32 %8 to i8 ; [#uses=1] + %13 = call i8 @llvm.atomic.cmp.swap.i8.p0i8(i8* @uc, i8 %11, i8 %12) ; [#uses=1] + store i8 %13, i8* @uc, align 1 + %14 = load i8* @sc, align 1 ; [#uses=1] + %15 = sext i8 %14 to i16 ; [#uses=1] + %16 = zext i16 %15 to i32 ; [#uses=1] + %17 = load i8* @uc, align 1 ; [#uses=1] + %18 = zext i8 %17 to i32 ; [#uses=1] + %19 = bitcast i8* bitcast (i16* @ss to i8*) to i16* ; [#uses=1] + %20 = trunc i32 %18 to i16 ; [#uses=1] + %21 = trunc i32 %16 to i16 ; [#uses=1] + %22 = call i16 @llvm.atomic.cmp.swap.i16.p0i16(i16* %19, i16 %20, i16 %21) ; [#uses=1] + store i16 %22, i16* @ss, align 2 + %23 = load i8* @sc, align 1 ; [#uses=1] + %24 = sext i8 %23 to i16 ; [#uses=1] + %25 = zext i16 %24 to i32 ; [#uses=1] + %26 = load i8* @uc, align 1 ; [#uses=1] + %27 = zext i8 %26 to i32 ; [#uses=1] + %28 = bitcast i8* bitcast (i16* @us to i8*) to i16* ; [#uses=1] + %29 = trunc i32 %27 to i16 ; [#uses=1] + %30 = trunc i32 %25 to i16 ; [#uses=1] + %31 = call i16 @llvm.atomic.cmp.swap.i16.p0i16(i16* %28, i16 %29, i16 %30) ; [#uses=1] + store i16 %31, i16* @us, align 2 + %32 = load i8* @sc, align 1 ; [#uses=1] + %33 = sext i8 %32 to i32 ; [#uses=1] + %34 = load i8* @uc, align 1 ; [#uses=1] + %35 = zext i8 %34 to i32 ; [#uses=1] + %36 = bitcast i8* bitcast (i32* @si to i8*) to i32* ; [#uses=1] + %37 = call i32 @llvm.atomic.cmp.swap.i32.p0i32(i32* %36, i32 %35, i32 %33) ; [#uses=1] + store i32 %37, i32* @si, align 4 + %38 = load i8* @sc, align 1 ; [#uses=1] + %39 = sext i8 %38 to i32 ; [#uses=1] + %40 = load i8* @uc, align 1 ; [#uses=1] + %41 = zext i8 %40 to i32 ; [#uses=1] + %42 = bitcast i8* bitcast (i32* @ui to i8*) to i32* ; [#uses=1] + %43 = call i32 @llvm.atomic.cmp.swap.i32.p0i32(i32* %42, i32 %41, i32 %39) ; [#uses=1] + store i32 %43, i32* @ui, align 4 + %44 = load i8* @sc, align 1 ; [#uses=1] + %45 = sext i8 %44 to i32 ; [#uses=1] + %46 = load i8* @uc, align 1 ; [#uses=1] + %47 = zext i8 %46 to i32 ; [#uses=1] + %48 = bitcast i8* bitcast (i32* @sl to i8*) to i32* ; [#uses=1] + %49 = call i32 @llvm.atomic.cmp.swap.i32.p0i32(i32* %48, i32 %47, i32 %45) ; [#uses=1] + store i32 %49, i32* @sl, align 4 + %50 = load i8* @sc, align 1 ; [#uses=1] + %51 = sext i8 %50 to i32 ; [#uses=1] + %52 = load i8* @uc, align 1 ; [#uses=1] + %53 = zext i8 %52 to i32 ; [#uses=1] + %54 = bitcast i8* bitcast (i32* @ul to i8*) to i32* ; [#uses=1] + %55 = call i32 @llvm.atomic.cmp.swap.i32.p0i32(i32* %54, i32 %53, i32 %51) ; [#uses=1] + store i32 %55, i32* @ul, align 4 + %56 = load i8* @sc, align 1 ; [#uses=1] + %57 = zext i8 %56 to i32 ; [#uses=1] + %58 = load i8* @uc, align 1 ; [#uses=1] + %59 = zext i8 %58 to i32 ; [#uses=1] + %60 = trunc i32 %59 to i8 ; [#uses=2] + %61 = trunc i32 %57 to i8 ; [#uses=1] + %62 = call i8 @llvm.atomic.cmp.swap.i8.p0i8(i8* @sc, i8 %60, i8 %61) ; [#uses=1] + %63 = icmp eq i8 %62, %60 ; [#uses=1] + %64 = zext i1 %63 to i8 ; [#uses=1] + %65 = zext i8 %64 to i32 ; [#uses=1] + store i32 %65, i32* @ui, align 4 + %66 = load i8* @sc, align 1 ; [#uses=1] + %67 = zext i8 %66 to i32 ; [#uses=1] + %68 = load i8* @uc, align 1 ; [#uses=1] + %69 = zext i8 %68 to i32 ; [#uses=1] + %70 = trunc i32 %69 to i8 ; [#uses=2] + %71 = trunc i32 %67 to i8 ; [#uses=1] + %72 = call i8 @llvm.atomic.cmp.swap.i8.p0i8(i8* @uc, i8 %70, i8 %71) ; [#uses=1] + %73 = icmp eq i8 %72, %70 ; [#uses=1] + %74 = zext i1 %73 to i8 ; [#uses=1] + %75 = zext i8 %74 to i32 ; [#uses=1] + store i32 %75, i32* @ui, align 4 + %76 = load i8* @sc, align 1 ; [#uses=1] + %77 = sext i8 %76 to i16 ; [#uses=1] + %78 = zext i16 %77 to i32 ; [#uses=1] + %79 = load i8* @uc, align 1 ; [#uses=1] + %80 = zext i8 %79 to i32 ; [#uses=1] + %81 = bitcast i8* bitcast (i16* @ss to i8*) to i16* ; [#uses=1] + %82 = trunc i32 %80 to i16 ; [#uses=2] + %83 = trunc i32 %78 to i16 ; [#uses=1] + %84 = call i16 @llvm.atomic.cmp.swap.i16.p0i16(i16* %81, i16 %82, i16 %83) ; [#uses=1] + %85 = icmp eq i16 %84, %82 ; [#uses=1] + %86 = zext i1 %85 to i8 ; [#uses=1] + %87 = zext i8 %86 to i32 ; [#uses=1] + store i32 %87, i32* @ui, align 4 + %88 = load i8* @sc, align 1 ; [#uses=1] + %89 = sext i8 %88 to i16 ; [#uses=1] + %90 = zext i16 %89 to i32 ; [#uses=1] + %91 = load i8* @uc, align 1 ; [#uses=1] + %92 = zext i8 %91 to i32 ; [#uses=1] + %93 = bitcast i8* bitcast (i16* @us to i8*) to i16* ; [#uses=1] + %94 = trunc i32 %92 to i16 ; [#uses=2] + %95 = trunc i32 %90 to i16 ; [#uses=1] + %96 = call i16 @llvm.atomic.cmp.swap.i16.p0i16(i16* %93, i16 %94, i16 %95) ; [#uses=1] + %97 = icmp eq i16 %96, %94 ; [#uses=1] + %98 = zext i1 %97 to i8 ; [#uses=1] + %99 = zext i8 %98 to i32 ; [#uses=1] + store i32 %99, i32* @ui, align 4 + %100 = load i8* @sc, align 1 ; [#uses=1] + %101 = sext i8 %100 to i32 ; [#uses=1] + %102 = load i8* @uc, align 1 ; [#uses=1] + %103 = zext i8 %102 to i32 ; [#uses=2] + %104 = bitcast i8* bitcast (i32* @si to i8*) to i32* ; [#uses=1] + %105 = call i32 @llvm.atomic.cmp.swap.i32.p0i32(i32* %104, i32 %103, i32 %101) ; [#uses=1] + %106 = icmp eq i32 %105, %103 ; [#uses=1] + %107 = zext i1 %106 to i8 ; [#uses=1] + %108 = zext i8 %107 to i32 ; [#uses=1] + store i32 %108, i32* @ui, align 4 + %109 = load i8* @sc, align 1 ; [#uses=1] + %110 = sext i8 %109 to i32 ; [#uses=1] + %111 = load i8* @uc, align 1 ; [#uses=1] + %112 = zext i8 %111 to i32 ; [#uses=2] + %113 = bitcast i8* bitcast (i32* @ui to i8*) to i32* ; [#uses=1] + %114 = call i32 @llvm.atomic.cmp.swap.i32.p0i32(i32* %113, i32 %112, i32 %110) ; [#uses=1] + %115 = icmp eq i32 %114, %112 ; [#uses=1] + %116 = zext i1 %115 to i8 ; [#uses=1] + %117 = zext i8 %116 to i32 ; [#uses=1] + store i32 %117, i32* @ui, align 4 + %118 = load i8* @sc, align 1 ; [#uses=1] + %119 = sext i8 %118 to i32 ; [#uses=1] + %120 = load i8* @uc, align 1 ; [#uses=1] + %121 = zext i8 %120 to i32 ; [#uses=2] + %122 = bitcast i8* bitcast (i32* @sl to i8*) to i32* ; [#uses=1] + %123 = call i32 @llvm.atomic.cmp.swap.i32.p0i32(i32* %122, i32 %121, i32 %119) ; [#uses=1] + %124 = icmp eq i32 %123, %121 ; [#uses=1] + %125 = zext i1 %124 to i8 ; [#uses=1] + %126 = zext i8 %125 to i32 ; [#uses=1] + store i32 %126, i32* @ui, align 4 + %127 = load i8* @sc, align 1 ; [#uses=1] + %128 = sext i8 %127 to i32 ; [#uses=1] + %129 = load i8* @uc, align 1 ; [#uses=1] + %130 = zext i8 %129 to i32 ; [#uses=2] + %131 = bitcast i8* bitcast (i32* @ul to i8*) to i32* ; [#uses=1] + %132 = call i32 @llvm.atomic.cmp.swap.i32.p0i32(i32* %131, i32 %130, i32 %128) ; [#uses=1] + %133 = icmp eq i32 %132, %130 ; [#uses=1] + %134 = zext i1 %133 to i8 ; [#uses=1] + %135 = zext i8 %134 to i32 ; [#uses=1] + store i32 %135, i32* @ui, align 4 + br label %return + +return: ; preds = %entry + ret void +} + +declare i8 @llvm.atomic.cmp.swap.i8.p0i8(i8*, i8, i8) nounwind + +declare i16 @llvm.atomic.cmp.swap.i16.p0i16(i16*, i16, i16) nounwind + +declare i32 @llvm.atomic.cmp.swap.i32.p0i32(i32*, i32, i32) nounwind + +define void @test_lock() nounwind { +entry: + %0 = call i8 @llvm.atomic.swap.i8.p0i8(i8* @sc, i8 1) ; [#uses=1] + store i8 %0, i8* @sc, align 1 + %1 = call i8 @llvm.atomic.swap.i8.p0i8(i8* @uc, i8 1) ; [#uses=1] + store i8 %1, i8* @uc, align 1 + %2 = bitcast i8* bitcast (i16* @ss to i8*) to i16* ; [#uses=1] + %3 = call i16 @llvm.atomic.swap.i16.p0i16(i16* %2, i16 1) ; [#uses=1] + store i16 %3, i16* @ss, align 2 + %4 = bitcast i8* bitcast (i16* @us to i8*) to i16* ; [#uses=1] + %5 = call i16 @llvm.atomic.swap.i16.p0i16(i16* %4, i16 1) ; [#uses=1] + store i16 %5, i16* @us, align 2 + %6 = bitcast i8* bitcast (i32* @si to i8*) to i32* ; [#uses=1] + %7 = call i32 @llvm.atomic.swap.i32.p0i32(i32* %6, i32 1) ; [#uses=1] + store i32 %7, i32* @si, align 4 + %8 = bitcast i8* bitcast (i32* @ui to i8*) to i32* ; [#uses=1] + %9 = call i32 @llvm.atomic.swap.i32.p0i32(i32* %8, i32 1) ; [#uses=1] + store i32 %9, i32* @ui, align 4 + %10 = bitcast i8* bitcast (i32* @sl to i8*) to i32* ; [#uses=1] + %11 = call i32 @llvm.atomic.swap.i32.p0i32(i32* %10, i32 1) ; [#uses=1] + store i32 %11, i32* @sl, align 4 + %12 = bitcast i8* bitcast (i32* @ul to i8*) to i32* ; [#uses=1] + %13 = call i32 @llvm.atomic.swap.i32.p0i32(i32* %12, i32 1) ; [#uses=1] + store i32 %13, i32* @ul, align 4 + call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 false) + volatile store i8 0, i8* @sc, align 1 + volatile store i8 0, i8* @uc, align 1 + %14 = bitcast i8* bitcast (i16* @ss to i8*) to i16* ; [#uses=1] + volatile store i16 0, i16* %14, align 2 + %15 = bitcast i8* bitcast (i16* @us to i8*) to i16* ; [#uses=1] + volatile store i16 0, i16* %15, align 2 + %16 = bitcast i8* bitcast (i32* @si to i8*) to i32* ; [#uses=1] + volatile store i32 0, i32* %16, align 4 + %17 = bitcast i8* bitcast (i32* @ui to i8*) to i32* ; [#uses=1] + volatile store i32 0, i32* %17, align 4 + %18 = bitcast i8* bitcast (i32* @sl to i8*) to i32* ; [#uses=1] + volatile store i32 0, i32* %18, align 4 + %19 = bitcast i8* bitcast (i32* @ul to i8*) to i32* ; [#uses=1] + volatile store i32 0, i32* %19, align 4 + %20 = bitcast i8* bitcast (i64* @sll to i8*) to i64* ; [#uses=1] + volatile store i64 0, i64* %20, align 8 + %21 = bitcast i8* bitcast (i64* @ull to i8*) to i64* ; [#uses=1] + volatile store i64 0, i64* %21, align 8 + br label %return + +return: ; preds = %entry + ret void +} + +declare i8 @llvm.atomic.swap.i8.p0i8(i8*, i8) nounwind + +declare i16 @llvm.atomic.swap.i16.p0i16(i16*, i16) nounwind + +declare i32 @llvm.atomic.swap.i32.p0i32(i32*, i32) nounwind + +declare void @llvm.memory.barrier(i1, i1, i1, i1, i1) nounwind Modified: llvm/trunk/utils/TableGen/CodeGenInstruction.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenInstruction.cpp?rev=56963&r1=56962&r2=56963&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/CodeGenInstruction.cpp (original) +++ llvm/trunk/utils/TableGen/CodeGenInstruction.cpp Thu Oct 2 13:53:47 2008 @@ -21,7 +21,8 @@ // FIXME: Only supports TIED_TO for now. std::string::size_type pos = CStr.find_first_of('='); assert(pos != std::string::npos && "Unrecognized constraint"); - std::string Name = CStr.substr(0, pos); + std::string::size_type start = CStr.find_first_not_of(" \t"); + std::string Name = CStr.substr(start, pos); // TIED_TO: $src1 = $dst std::string::size_type wpos = Name.find_first_of(" \t"); From resistor at mac.com Thu Oct 2 14:40:34 2008 From: resistor at mac.com (Owen Anderson) Date: Thu, 02 Oct 2008 19:40:34 -0000 Subject: [llvm-commits] [llvm] r56964 - /llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Message-ID: <200810021940.m92JeYwT017068@zion.cs.uiuc.edu> Author: resistor Date: Thu Oct 2 14:40:33 2008 New Revision: 56964 URL: http://llvm.org/viewvc/llvm-project?rev=56964&view=rev Log: Use a multimap rather than a map for holding the list of copies to insert, so we don't lose copies when two of them have the same source. I don't know what I was thinking when I wrote this originally. Note: There's probably a more efficient way to do this, but I need to think about it some more, and about what determinism guarantees need to be present. 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=56964&r1=56963&r2=56964&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp (original) +++ llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Thu Oct 2 14:40:33 2008 @@ -44,7 +44,7 @@ // Waiting stores, for each MBB, the set of copies that need to // be inserted into that MBB DenseMap > Waiting; + std::multimap > Waiting; // Stacks holds the renaming stack for each register std::map > Stacks; @@ -647,9 +647,9 @@ void StrongPHIElimination::ScheduleCopies(MachineBasicBlock* MBB, std::set& pushed) { // FIXME: This function needs to update LiveIntervals - std::map& copy_set= Waiting[MBB]; + std::multimap& copy_set= Waiting[MBB]; - std::map worklist; + std::multimap worklist; std::map map; // Setup worklist of initial copies @@ -662,9 +662,9 @@ worklist.insert(*I); // Avoid iterator invalidation - unsigned first = I->first; + std::multimap::iterator OI = I; ++I; - copy_set.erase(first); + copy_set.erase(OI); } else { ++I; } @@ -680,8 +680,9 @@ // Iterate over the worklist, inserting copies while (!worklist.empty() || !copy_set.empty()) { while (!worklist.empty()) { - std::pair curr = *worklist.begin(); - worklist.erase(curr.first); + std::multimap::iterator WI = worklist.begin(); + std::pair curr = *WI; + worklist.erase(WI); const TargetRegisterClass *RC = MF->getRegInfo().getRegClass(curr.first); @@ -695,6 +696,8 @@ TII->copyRegToReg(*PI->getParent(), PI, t, curr.second, RC, RC); + DOUT << "Inserted copy from " << curr.second << " to " << t << "\n"; + // Push temporary on Stacks Stacks[curr.second].push_back(t); @@ -709,6 +712,8 @@ TII->copyRegToReg(*MBB, MBB->getFirstTerminator(), curr.second, map[curr.first], RC, RC); map[curr.first] = curr.second; + DOUT << "Inserted copy from " << curr.first << " to " + << curr.second << "\n"; // Push this copy onto InsertedPHICopies so we can // update LiveIntervals with it. @@ -716,15 +721,16 @@ InsertedPHIDests.push_back(std::make_pair(curr.second, --MI)); // If curr.first is a destination in copy_set... - for (std::map::iterator I = copy_set.begin(), + for (std::multimap::iterator I = copy_set.begin(), E = copy_set.end(); I != E; ) if (curr.first == I->second) { std::pair temp = *I; + worklist.insert(temp); // Avoid iterator invalidation + std::multimap::iterator OI = I; ++I; - copy_set.erase(temp.first); - worklist.insert(temp); + copy_set.erase(OI); break; } else { @@ -733,9 +739,10 @@ } if (!copy_set.empty()) { - std::pair curr = *copy_set.begin(); - copy_set.erase(curr.first); + std::multimap::iterator CI = copy_set.begin(); + std::pair curr = *CI; worklist.insert(curr); + copy_set.erase(CI); LiveInterval& I = LI.getInterval(curr.second); MachineBasicBlock::iterator term = MBB->getFirstTerminator(); From alenhar2 at cs.uiuc.edu Thu Oct 2 15:15:11 2008 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Thu, 02 Oct 2008 20:15:11 -0000 Subject: [llvm-commits] [llvm] r56965 - /llvm/trunk/lib/CodeGen/PBQP.cpp Message-ID: <200810022015.m92KFBhI018151@zion.cs.uiuc.edu> Author: alenhar2 Date: Thu Oct 2 15:15:08 2008 New Revision: 56965 URL: http://llvm.org/viewvc/llvm-project?rev=56965&view=rev Log: fix build gcc 4.3 Modified: llvm/trunk/lib/CodeGen/PBQP.cpp Modified: llvm/trunk/lib/CodeGen/PBQP.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PBQP.cpp?rev=56965&r1=56964&r2=56965&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/PBQP.cpp (original) +++ llvm/trunk/lib/CodeGen/PBQP.cpp Thu Oct 2 15:15:08 2008 @@ -15,6 +15,7 @@ #include #include +#include #include "PBQP.h" From criswell at uiuc.edu Thu Oct 2 15:18:42 2008 From: criswell at uiuc.edu (John Criswell) Date: Thu, 02 Oct 2008 20:18:42 -0000 Subject: [llvm-commits] [poolalloc] r56966 - /poolalloc/trunk/lib/DSA/StdLibPass.cpp Message-ID: <200810022018.m92KIgmw018255@zion.cs.uiuc.edu> Author: criswell Date: Thu Oct 2 15:18:39 2008 New Revision: 56966 URL: http://llvm.org/viewvc/llvm-project?rev=56966&view=rev Log: Added more code to handle cases where the DSNode may be NULL for a function pointer argument. This can happen if 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=56966&r1=56965&r2=56966&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/StdLibPass.cpp (original) +++ poolalloc/trunk/lib/DSA/StdLibPass.cpp Thu Oct 2 15:18:39 2008 @@ -127,7 +127,8 @@ 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 (DSNode * Node=Graph.getNodeForValue(CI->getOperand(y)).getNode()) + Node->setReadMarker(); if (recFuncs[x].action.args_write) for (unsigned y = 1; y < CI->getNumOperands(); ++y) if (isa(CI->getOperand(y)->getType())) @@ -136,7 +137,8 @@ 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(); + if (DSNode * Node=Graph.getNodeForValue(CI->getOperand(y)).getNode()) + Node->setHeapMarker(); std::vector toMerge; if (recFuncs[x].action.mergeWithRet) @@ -152,7 +154,8 @@ 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(); + if (DSNode * Node=Graph.getNodeForValue(CI->getOperand(y)).getNode()) + Node->foldNodeCompletely(); } //delete the call From foldr at codedgers.com Thu Oct 2 16:15:06 2008 From: foldr at codedgers.com (Mikhail Glushenkov) Date: Thu, 02 Oct 2008 21:15:06 -0000 Subject: [llvm-commits] [llvm] r56967 - in /llvm/trunk: include/llvm/CompilerDriver/ tools/llvmc2/ tools/llvmc2/examples/ tools/llvmc2/plugins/Base/ tools/llvmc2/plugins/Clang/ tools/llvmc2/plugins/Hello/ Message-ID: <200810022115.m92LF7Cs020283@zion.cs.uiuc.edu> Author: foldr Date: Thu Oct 2 16:15:05 2008 New Revision: 56967 URL: http://llvm.org/viewvc/llvm-project?rev=56967&view=rev Log: Build system tweaks to make it more convenient for the plugin authors. Plugins can be now compiled in with a slight Makefile change. For example, to compile the new Clang driver, use: cd $LLVMC2_DIR make TOOLNAME=ccc2 BUILTIN_PLUGINS=Clang Added: llvm/trunk/include/llvm/CompilerDriver/Common.td - copied, changed from r56965, llvm/trunk/tools/llvmc2/Common.td llvm/trunk/include/llvm/CompilerDriver/Tools.td - copied, changed from r56965, llvm/trunk/tools/llvmc2/Tools.td llvm/trunk/tools/llvmc2/plugins/Base/ llvm/trunk/tools/llvmc2/plugins/Base/AutoGenerated.cpp llvm/trunk/tools/llvmc2/plugins/Base/Base.td - copied, changed from r56965, llvm/trunk/tools/llvmc2/Graph.td llvm/trunk/tools/llvmc2/plugins/Base/Makefile - copied, changed from r56965, llvm/trunk/tools/llvmc2/plugins/Hello/Makefile llvm/trunk/tools/llvmc2/plugins/Clang/ llvm/trunk/tools/llvmc2/plugins/Clang/AutoGenerated.cpp llvm/trunk/tools/llvmc2/plugins/Clang/Clang.td - copied, changed from r56965, llvm/trunk/tools/llvmc2/examples/Clang.td llvm/trunk/tools/llvmc2/plugins/Clang/Makefile - copied, changed from r56965, llvm/trunk/tools/llvmc2/plugins/Hello/Makefile Removed: llvm/trunk/tools/llvmc2/AutoGenerated.cpp llvm/trunk/tools/llvmc2/Common.td llvm/trunk/tools/llvmc2/Graph.td llvm/trunk/tools/llvmc2/Tools.td llvm/trunk/tools/llvmc2/examples/Clang.td Modified: llvm/trunk/tools/llvmc2/Makefile llvm/trunk/tools/llvmc2/plugins/Hello/Makefile Copied: llvm/trunk/include/llvm/CompilerDriver/Common.td (from r56965, llvm/trunk/tools/llvmc2/Common.td) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CompilerDriver/Common.td?p2=llvm/trunk/include/llvm/CompilerDriver/Common.td&p1=llvm/trunk/tools/llvmc2/Common.td&r1=56965&r2=56967&rev=56967&view=diff ============================================================================== (empty) Copied: llvm/trunk/include/llvm/CompilerDriver/Tools.td (from r56965, llvm/trunk/tools/llvmc2/Tools.td) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CompilerDriver/Tools.td?p2=llvm/trunk/include/llvm/CompilerDriver/Tools.td&p1=llvm/trunk/tools/llvmc2/Tools.td&r1=56965&r2=56967&rev=56967&view=diff ============================================================================== (empty) Removed: llvm/trunk/tools/llvmc2/AutoGenerated.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/AutoGenerated.cpp?rev=56966&view=auto ============================================================================== --- llvm/trunk/tools/llvmc2/AutoGenerated.cpp (original) +++ llvm/trunk/tools/llvmc2/AutoGenerated.cpp (removed) @@ -1,15 +0,0 @@ -//===--- AutoGenerated.cpp - The LLVM Compiler Driver -----------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open -// Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// Auto-generated tool descriptions - implementation. -// -//===----------------------------------------------------------------------===// - -// The auto-generated file -#include "AutoGenerated.inc" Removed: llvm/trunk/tools/llvmc2/Common.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/Common.td?rev=56966&view=auto ============================================================================== --- llvm/trunk/tools/llvmc2/Common.td (original) +++ llvm/trunk/tools/llvmc2/Common.td (removed) @@ -1,106 +0,0 @@ -//===- Common.td - Common definitions for LLVMC2 ----------*- tablegen -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file contains common definitions used in llvmc2 tool description files. -// -//===----------------------------------------------------------------------===// - -class Tool l> { - list properties = l; -} - -// Special Tool instance - the root node of the compilation graph. - -def root : Tool<[]>; - -// Possible Tool properties - -def in_language; -def out_language; -def output_suffix; -def cmd_line; -def join; -def sink; - -// Possible option types - -def alias_option; -def switch_option; -def parameter_option; -def parameter_list_option; -def prefix_option; -def prefix_list_option; - -// Possible option properties - -def append_cmd; -def forward; -def forward_as; -def stop_compilation; -def unpack_values; -def help; -def required; - -// Empty DAG marker. -def empty; - -// The 'case' construct. -def case; - -// Primitive tests. -def switch_on; -def parameter_equals; -def element_in_list; -def input_languages_contain; -def not_empty; -def default; - -// Boolean operators. -def and; -def or; - -// Increase/decrease the edge weight. -def inc_weight; -def dec_weight; - -// Option list - used to specify aliases and sometimes help strings. -class OptionList l> { - list options = l; -} - -// Map from suffixes to language names - -class LangToSuffixes lst> { - string lang = str; - list suffixes = lst; -} - -class LanguageMap lst> { - list map = lst; -} - -// Compilation graph - -class EdgeBase { - Tool a = t1; - Tool b = t2; - dag weight = d; -} - -class Edge : EdgeBase; - -// Edge and SimpleEdge are synonyms. -class SimpleEdge : EdgeBase; - -// Optionally enabled edge. -class OptionalEdge : EdgeBase; - -class CompilationGraph lst> { - list edges = lst; -} Removed: llvm/trunk/tools/llvmc2/Graph.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/Graph.td?rev=56966&view=auto ============================================================================== --- llvm/trunk/tools/llvmc2/Graph.td (original) +++ llvm/trunk/tools/llvmc2/Graph.td (removed) @@ -1,49 +0,0 @@ -//===- Graph.td - LLVMC2 toolchain descriptions ------------*- tablegen -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file contains compilation graph description used by llvmc2. -// -//===----------------------------------------------------------------------===// - -include "Common.td" -include "Tools.td" - -// Toolchains - -def CompilationGraph : CompilationGraph<[ - Edge, - Edge, - Edge, - Edge, - - Edge, - Edge, - Edge, - - OptionalEdge, - OptionalEdge, - OptionalEdge, - Edge, - - Edge, - Edge, - OptionalEdge, - - - Edge, - OptionalEdge - ]>; Modified: llvm/trunk/tools/llvmc2/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/Makefile?rev=56967&r1=56966&r2=56967&view=diff ============================================================================== --- llvm/trunk/tools/llvmc2/Makefile (original) +++ llvm/trunk/tools/llvmc2/Makefile Thu Oct 2 16:15:05 2008 @@ -6,24 +6,39 @@ # Source License. See LICENSE.TXT for details. # ##===----------------------------------------------------------------------===## + +# Compiled-in plugins +BUILTIN_PLUGINS = Base + LEVEL = ../.. TOOLNAME = llvmc2 -BUILT_SOURCES = AutoGenerated.inc LINK_COMPONENTS = support system REQUIRES_EH := 1 +ifneq ($(BUILTIN_PLUGINS),) + +export BUILTIN_LLVMC_PLUGIN=1 +USEDLIBS = $(patsubst %,LLVMC%,$(BUILTIN_PLUGINS)) + +endif + include $(LEVEL)/Makefile.common -GRAPH=Graph.td -$(GRAPH) : Common.td -Graph.td : Tools.td -TOOLS_SOURCE=$(GRAPH) - -# TOFIX: integrate this part into Makefile.rules? -# The degree of horrorshowness in that file is too much for me atm. -$(ObjDir)/AutoGenerated.inc.tmp: $(TOOLS_SOURCE) $(ObjDir)/.dir $(TBLGEN) - $(Echo) "Building LLVMC configuration library with tblgen" - $(Verb) $(TableGen) -gen-llvmc -o $(call SYSPATH, $@) $< +TD_COMMON = $(wildcard $(LLVM_SRC_ROOT)/include/llvm/CompilerDriver/*.td) + +# There is probably a better way to do this: currently we enter the +# subdirectory 2 times - the second time is not needed. +# This probably also needs to be integrated into Makefile.rules. +define PLUGIN_template +PLUGIN_$(1)_SOURCES=$$(wildcard plugins/$(1)/*.cpp) +PLUGIN_$(1)_TD_SOURCES=$$(wildcard plugins/$(1)/*.cpp) + +$$(LibDir)/LLVMC$(1).o: $$(PLUGIN_$(1)_SOURCES) $$(PLUGIN_$(1)_TD_SOURCES) \ + $$(TD_COMMON) + @$$(MAKE) -C plugins/$(1) + +$$(RecursiveTargets) :: + @$$(MAKE) -C plugins/$(1) $$@ +endef -AutoGenerated.inc : $(ObjDir)/AutoGenerated.inc.tmp - $(Verb) $(CMP) -s $@ $< || $(CP) $< $@ +$(foreach plugin,$(BUILTIN_PLUGINS),$(eval $(call PLUGIN_template,$(plugin)))) Removed: llvm/trunk/tools/llvmc2/Tools.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/Tools.td?rev=56966&view=auto ============================================================================== --- llvm/trunk/tools/llvmc2/Tools.td (original) +++ llvm/trunk/tools/llvmc2/Tools.td (removed) @@ -1,117 +0,0 @@ -//===- Tools.td - Tools description for LLVMC2 -------------*- tablegen -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file contains descriptions of the various build tools run by llvmc2. -// -//===----------------------------------------------------------------------===// - -def llvm_gcc_c : Tool< -[(in_language "c"), - (out_language "llvm-bitcode"), - (output_suffix "bc"), - (cmd_line (case - (switch_on "E"), - (case (not_empty "o"), - "llvm-gcc -E -x c++ $INFILE -o $OUTFILE", - (default), - "llvm-gcc -E -x c++ $INFILE"), - (default), - "llvm-gcc -c -x c $INFILE -o $OUTFILE -emit-llvm")), - (switch_option "E", (stop_compilation), - (help "Stop after the preprocessing stage, do not run the compiler")), - (sink) -]>; - -def llvm_gcc_cpp : Tool< -[(in_language "c++"), - (out_language "llvm-bitcode"), - (output_suffix "bc"), - (cmd_line (case - (switch_on "E"), - (case (not_empty "o"), - "llvm-g++ -E -x c++ $INFILE -o $OUTFILE", - (default), - "llvm-g++ -E -x c++ $INFILE"), - (default), - "llvm-g++ -c -x c++ $INFILE -o $OUTFILE -emit-llvm")), - (switch_option "E", (stop_compilation)), - (sink) -]>; - -def opt : Tool< -[(in_language "llvm-bitcode"), - (out_language "llvm-bitcode"), - (switch_option "opt", (help "Enable opt")), - (output_suffix "bc"), - (cmd_line "opt -f $INFILE -o $OUTFILE") -]>; - -def llvm_as : Tool< -[(in_language "llvm-assembler"), - (out_language "llvm-bitcode"), - (output_suffix "bc"), - (cmd_line "llvm-as $INFILE -o $OUTFILE") -]>; - -def llc : Tool< -[(in_language "llvm-bitcode"), - (out_language "assembler"), - (output_suffix "s"), - (switch_option "S", (stop_compilation), - (help "Stop after compilation, do not assemble")), - (cmd_line "llc -f $INFILE -o $OUTFILE") -]>; - -def llvm_gcc_assembler : Tool< -[(in_language "assembler"), - (out_language "object-code"), - (output_suffix "o"), - (cmd_line "llvm-gcc -c -x assembler $INFILE -o $OUTFILE"), - (switch_option "c", (stop_compilation), - (help "Compile and assemble, but do not link")), - (prefix_list_option "Wa,", (unpack_values), (help "Pass options to assembler")) -]>; - -// Default linker -def llvm_gcc_linker : Tool< -[(in_language "object-code"), - (out_language "executable"), - (output_suffix "out"), - (cmd_line "llvm-gcc $INFILE -o $OUTFILE"), - (join), - (prefix_list_option "L", (forward), (help "Add a directory to link path")), - (prefix_list_option "l", (forward), (help "Search a library when linking")), - (prefix_list_option "Wl,", (unpack_values), (help "Pass options to linker")) -]>; - -// Alternative linker for C++ -def llvm_gcc_cpp_linker : Tool< -[(in_language "object-code"), - (out_language "executable"), - (output_suffix "out"), - (cmd_line "llvm-g++ $INFILE -o $OUTFILE"), - (join), - (parameter_option "linker", - (help "Choose linker (possible values: gcc, g++)")), - (prefix_list_option "L", (forward)), - (prefix_list_option "l", (forward)), - (prefix_list_option "Wl,", (unpack_values)) -]>; - -// Language map - -def LanguageMap : LanguageMap< - [LangToSuffixes<"c++", ["cc", "cp", "cxx", "cpp", "CPP", "c++", "C"]>, - LangToSuffixes<"c", ["c"]>, - LangToSuffixes<"assembler", ["s"]>, - LangToSuffixes<"llvm-assembler", ["ll"]>, - LangToSuffixes<"llvm-bitcode", ["bc"]>, - LangToSuffixes<"object-code", ["o"]>, - LangToSuffixes<"executable", ["out"]> - ]>; Removed: llvm/trunk/tools/llvmc2/examples/Clang.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/examples/Clang.td?rev=56966&view=auto ============================================================================== --- llvm/trunk/tools/llvmc2/examples/Clang.td (original) +++ llvm/trunk/tools/llvmc2/examples/Clang.td (removed) @@ -1,86 +0,0 @@ -// A (first stab at a) replacement for the Clang's ccc script. -// To compile, use this command: -// make TOOLNAME=ccc2 GRAPH=examples/Clang.td - -include "Common.td" - - -// TOFIX: Add an explicit option list for aliases and things like this. -def Options : OptionList<[ -(switch_option "E", - (help "Stop after the preprocessing stage, do not run the compiler")) -]>; - -class clang_base : Tool< -[(in_language language), - (out_language "llvm-bitcode"), - (output_suffix "bc"), - (cmd_line cmdline), - (switch_option "E", (stop_compilation), (output_suffix "i")), - (sink) -]>; - -def clang_c : clang_base<"c", -(case -(switch_on "E"), - (case - (not_empty "o"), - "clang -E -x c $INFILE -o $OUTFILE", - (default), - "clang -E -x c $INFILE"), -(default), - "clang -emit-llvm-bc -x c $INFILE -o $OUTFILE")>; - -def clang_cpp : clang_base<"c++", -(case -(switch_on "E"), - (case - (not_empty "o"), - "clang -E -x c++ $INFILE -o $OUTFILE", - (default), - "clang -E -x c++ $INFILE"), -(default), - "clang -emit-llvm-bc -x c++ $INFILE -o $OUTFILE")>; - -def clang_objective_c : clang_base<"objective-c", -(case -(switch_on "E"), - (case - (not_empty "o"), - "clang -E -x objective-c $INFILE -o $OUTFILE", - (default), - "clang -E -x objective-c $INFILE"), -(default), - "clang -emit-llvm-bc -x objective-c $INFILE -o $OUTFILE")>; - -// Default linker -def llvm_ld : Tool< -[(in_language "llvm-bitcode"), - (out_language "executable"), - (output_suffix "out"), - (cmd_line "llvm-ld -native -disable-internalize $INFILE -o $OUTFILE"), - (prefix_list_option "L", (forward), (help "Specify a library search path")), - (join) -]>; - -// Language map - -def LanguageMap : LanguageMap< - [LangToSuffixes<"c++", ["cc", "cp", "cxx", "cpp", "CPP", "c++", "C"]>, - LangToSuffixes<"c", ["c"]>, - LangToSuffixes<"objective-c", ["m"]>, - LangToSuffixes<"c-cpp-output", ["i"]>, - LangToSuffixes<"objective-c-cpp-output", ["mi"]> - ]>; - -// Compilation graph - -def CompilationGraph : CompilationGraph<[ - Edge, - Edge, - Edge, - Edge, - Edge, - Edge - ]>; - Added: llvm/trunk/tools/llvmc2/plugins/Base/AutoGenerated.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/plugins/Base/AutoGenerated.cpp?rev=56967&view=auto ============================================================================== --- llvm/trunk/tools/llvmc2/plugins/Base/AutoGenerated.cpp (added) +++ llvm/trunk/tools/llvmc2/plugins/Base/AutoGenerated.cpp Thu Oct 2 16:15:05 2008 @@ -0,0 +1 @@ +#include "AutoGenerated.inc" Copied: llvm/trunk/tools/llvmc2/plugins/Base/Base.td (from r56965, llvm/trunk/tools/llvmc2/Graph.td) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/plugins/Base/Base.td?p2=llvm/trunk/tools/llvmc2/plugins/Base/Base.td&p1=llvm/trunk/tools/llvmc2/Graph.td&r1=56965&r2=56967&rev=56967&view=diff ============================================================================== --- llvm/trunk/tools/llvmc2/Graph.td (original) +++ llvm/trunk/tools/llvmc2/plugins/Base/Base.td Thu Oct 2 16:15:05 2008 @@ -11,8 +11,8 @@ // //===----------------------------------------------------------------------===// -include "Common.td" -include "Tools.td" +include "llvm/CompilerDriver/Common.td" +include "llvm/CompilerDriver/Tools.td" // Toolchains Copied: llvm/trunk/tools/llvmc2/plugins/Base/Makefile (from r56965, llvm/trunk/tools/llvmc2/plugins/Hello/Makefile) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/plugins/Base/Makefile?p2=llvm/trunk/tools/llvmc2/plugins/Base/Makefile&p1=llvm/trunk/tools/llvmc2/plugins/Hello/Makefile&r1=56965&r2=56967&rev=56967&view=diff ============================================================================== --- llvm/trunk/tools/llvmc2/plugins/Hello/Makefile (original) +++ llvm/trunk/tools/llvmc2/plugins/Base/Makefile Thu Oct 2 16:15:05 2008 @@ -1,4 +1,4 @@ -##===- lib/Transforms/Hello/Makefile -----------------------*- Makefile -*-===## +##===- tools/llvmc2/plugins/Base/Makefile ------------------*- Makefile -*-===## # # The LLVM Compiler Infrastructure # @@ -7,11 +7,6 @@ # ##===----------------------------------------------------------------------===## -LEVEL = ../../../.. -LIBRARYNAME = LLVMCHello -LOADABLE_MODULE = 1 -REQUIRES_EH = 1 -USEDLIBS = - -include $(LEVEL)/Makefile.common +LLVMC_PLUGIN = Base +include ../Makefile.common Added: llvm/trunk/tools/llvmc2/plugins/Clang/AutoGenerated.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/plugins/Clang/AutoGenerated.cpp?rev=56967&view=auto ============================================================================== --- llvm/trunk/tools/llvmc2/plugins/Clang/AutoGenerated.cpp (added) +++ llvm/trunk/tools/llvmc2/plugins/Clang/AutoGenerated.cpp Thu Oct 2 16:15:05 2008 @@ -0,0 +1 @@ +#include "AutoGenerated.inc" Copied: llvm/trunk/tools/llvmc2/plugins/Clang/Clang.td (from r56965, llvm/trunk/tools/llvmc2/examples/Clang.td) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/plugins/Clang/Clang.td?p2=llvm/trunk/tools/llvmc2/plugins/Clang/Clang.td&p1=llvm/trunk/tools/llvmc2/examples/Clang.td&r1=56965&r2=56967&rev=56967&view=diff ============================================================================== --- llvm/trunk/tools/llvmc2/examples/Clang.td (original) +++ llvm/trunk/tools/llvmc2/plugins/Clang/Clang.td Thu Oct 2 16:15:05 2008 @@ -1,11 +1,11 @@ // A (first stab at a) replacement for the Clang's ccc script. // To compile, use this command: -// make TOOLNAME=ccc2 GRAPH=examples/Clang.td +// cd $LLVMC2_DIR +// make TOOLNAME=ccc2 BUILTIN_PLUGINS=Clang -include "Common.td" +include "llvm/CompilerDriver/Common.td" -// TOFIX: Add an explicit option list for aliases and things like this. def Options : OptionList<[ (switch_option "E", (help "Stop after the preprocessing stage, do not run the compiler")) Copied: llvm/trunk/tools/llvmc2/plugins/Clang/Makefile (from r56965, llvm/trunk/tools/llvmc2/plugins/Hello/Makefile) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/plugins/Clang/Makefile?p2=llvm/trunk/tools/llvmc2/plugins/Clang/Makefile&p1=llvm/trunk/tools/llvmc2/plugins/Hello/Makefile&r1=56965&r2=56967&rev=56967&view=diff ============================================================================== --- llvm/trunk/tools/llvmc2/plugins/Hello/Makefile (original) +++ llvm/trunk/tools/llvmc2/plugins/Clang/Makefile Thu Oct 2 16:15:05 2008 @@ -1,4 +1,4 @@ -##===- lib/Transforms/Hello/Makefile -----------------------*- Makefile -*-===## +##===- tools/llvmc2/plugins/Clang/Makefile -----------------*- Makefile -*-===## # # The LLVM Compiler Infrastructure # @@ -7,11 +7,7 @@ # ##===----------------------------------------------------------------------===## -LEVEL = ../../../.. -LIBRARYNAME = LLVMCHello -LOADABLE_MODULE = 1 -REQUIRES_EH = 1 -USEDLIBS = +LLVMC_PLUGIN = Clang -include $(LEVEL)/Makefile.common +include ../Makefile.common Modified: llvm/trunk/tools/llvmc2/plugins/Hello/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/plugins/Hello/Makefile?rev=56967&r1=56966&r2=56967&view=diff ============================================================================== --- llvm/trunk/tools/llvmc2/plugins/Hello/Makefile (original) +++ llvm/trunk/tools/llvmc2/plugins/Hello/Makefile Thu Oct 2 16:15:05 2008 @@ -1,4 +1,4 @@ -##===- lib/Transforms/Hello/Makefile -----------------------*- Makefile -*-===## +##===- tools/llvmc2/plugins/Hello/Makefile -----------------*- Makefile -*-===## # # The LLVM Compiler Infrastructure # @@ -7,11 +7,6 @@ # ##===----------------------------------------------------------------------===## -LEVEL = ../../../.. -LIBRARYNAME = LLVMCHello -LOADABLE_MODULE = 1 -REQUIRES_EH = 1 -USEDLIBS = - -include $(LEVEL)/Makefile.common +LLVMC_PLUGIN = Hello +include ../Makefile.common From clattner at apple.com Thu Oct 2 16:27:49 2008 From: clattner at apple.com (Chris Lattner) Date: Thu, 2 Oct 2008 14:27:49 -0700 Subject: [llvm-commits] [llvm] r56967 - in /llvm/trunk: include/llvm/CompilerDriver/ tools/llvmc2/ tools/llvmc2/examples/ tools/llvmc2/plugins/Base/ tools/llvmc2/plugins/Clang/ tools/llvmc2/plugins/Hello/ In-Reply-To: <200810022115.m92LF7Cs020283@zion.cs.uiuc.edu> References: <200810022115.m92LF7Cs020283@zion.cs.uiuc.edu> Message-ID: On Oct 2, 2008, at 2:15 PM, Mikhail Glushenkov wrote: > Author: foldr > Date: Thu Oct 2 16:15:05 2008 > New Revision: 56967 > > URL: http://llvm.org/viewvc/llvm-project?rev=56967&view=rev > Log: > Build system tweaks to make it more convenient for the plugin authors. > > Plugins can be now compiled in with a slight Makefile change. > For example, to compile the new Clang driver, use: Hi Mikhail, I'm seeing this now: ~/llvm/tools/llvmc2] sabre% make Makefile:12: ../Makefile.common: No such file or directory make[1]: *** No rule to make target `../Makefile.common'. Stop. make: *** [/Users/sabre/llvm/Debug/lib/LLVMCBase.o] Error 2 any ideas? -Chris From anton at korobeynikov.info Thu Oct 2 16:45:25 2008 From: anton at korobeynikov.info (Anton Korobeynikov) Date: Fri, 3 Oct 2008 01:45:25 +0400 Subject: [llvm-commits] [llvm] r56967 - in /llvm/trunk: include/llvm/CompilerDriver/ tools/llvmc2/ tools/llvmc2/examples/ tools/llvmc2/plugins/Base/ tools/llvmc2/plugins/Clang/ tools/llvmc2/plugins/Hello/ In-Reply-To: References: <200810022115.m92LF7Cs020283@zion.cs.uiuc.edu> Message-ID: > ~/llvm/tools/llvmc2] sabre% make > Makefile:12: ../Makefile.common: No such file or directory > make[1]: *** No rule to make target `../Makefile.common'. Stop. > make: *** [/Users/sabre/llvm/Debug/lib/LLVMCBase.o] Error 2 Makefile changes looks a bit bogus for me... Or some file was not yet commited. -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University From gohman at apple.com Thu Oct 2 17:09:11 2008 From: gohman at apple.com (Dan Gohman) Date: Thu, 02 Oct 2008 22:09:11 -0000 Subject: [llvm-commits] [llvm] r56968 - in /llvm/trunk: include/llvm/CodeGen/MachineBasicBlock.h lib/CodeGen/MachineBasicBlock.cpp Message-ID: <200810022209.m92M9Bmi022378@zion.cs.uiuc.edu> Author: djg Date: Thu Oct 2 17:09:09 2008 New Revision: 56968 URL: http://llvm.org/viewvc/llvm-project?rev=56968&view=rev Log: Add a new MachineBasicBlock utility function, isLayoutSuccessor, that can be used when deciding if a block can transfer control to another via a fall-through instead of a branch. Modified: llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp Modified: llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h?rev=56968&r1=56967&r2=56968&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h Thu Oct 2 17:09:09 2008 @@ -234,6 +234,13 @@ /// block. bool isSuccessor(MachineBasicBlock *MBB) const; + /// isLayoutSuccessor - Return true if the specified MBB will be emitted + /// immediately after this block, such that if this block exits by + /// falling through, control will transfer to the specified MBB. Note + /// that MBB need not be a successor at all, for example if this block + /// ends with an unconditional branch to some other block. + bool isLayoutSuccessor(MachineBasicBlock *MBB) const; + /// getFirstTerminator - returns an iterator to the first terminator /// instruction of this basic block. If a terminator does not exist, /// it returns end() Modified: llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp?rev=56968&r1=56967&r2=56968&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp Thu Oct 2 17:09:09 2008 @@ -254,6 +254,11 @@ return I != Successors.end(); } +bool MachineBasicBlock::isLayoutSuccessor(MachineBasicBlock *MBB) const { + MachineFunction::const_iterator I(this); + return next(I) == MachineFunction::const_iterator(MBB); +} + /// removeFromParent - This method unlinks 'this' from the containing function, /// and returns it, but does not delete it. MachineBasicBlock *MachineBasicBlock::removeFromParent() { From foldr at codedgers.com Thu Oct 2 17:41:42 2008 From: foldr at codedgers.com (Mikhail Glushenkov) Date: Thu, 02 Oct 2008 22:41:42 -0000 Subject: [llvm-commits] [llvm] r56970 - in /llvm/trunk/tools/llvmc2/plugins: Base/Makefile Clang/Makefile Hello/Makefile Makefile.plugins Message-ID: <200810022241.m92MfgTq023920@zion.cs.uiuc.edu> Author: foldr Date: Thu Oct 2 17:41:42 2008 New Revision: 56970 URL: http://llvm.org/viewvc/llvm-project?rev=56970&view=rev Log: Fix build breakage. Forgot to include Makefile.plugins. Added: llvm/trunk/tools/llvmc2/plugins/Makefile.plugins Modified: llvm/trunk/tools/llvmc2/plugins/Base/Makefile llvm/trunk/tools/llvmc2/plugins/Clang/Makefile llvm/trunk/tools/llvmc2/plugins/Hello/Makefile Modified: llvm/trunk/tools/llvmc2/plugins/Base/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/plugins/Base/Makefile?rev=56970&r1=56969&r2=56970&view=diff ============================================================================== --- llvm/trunk/tools/llvmc2/plugins/Base/Makefile (original) +++ llvm/trunk/tools/llvmc2/plugins/Base/Makefile Thu Oct 2 17:41:42 2008 @@ -9,4 +9,4 @@ LLVMC_PLUGIN = Base -include ../Makefile.common +include ../Makefile.plugins Modified: llvm/trunk/tools/llvmc2/plugins/Clang/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/plugins/Clang/Makefile?rev=56970&r1=56969&r2=56970&view=diff ============================================================================== --- llvm/trunk/tools/llvmc2/plugins/Clang/Makefile (original) +++ llvm/trunk/tools/llvmc2/plugins/Clang/Makefile Thu Oct 2 17:41:42 2008 @@ -9,5 +9,5 @@ LLVMC_PLUGIN = Clang -include ../Makefile.common +include ../Makefile.plugins Modified: llvm/trunk/tools/llvmc2/plugins/Hello/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/plugins/Hello/Makefile?rev=56970&r1=56969&r2=56970&view=diff ============================================================================== --- llvm/trunk/tools/llvmc2/plugins/Hello/Makefile (original) +++ llvm/trunk/tools/llvmc2/plugins/Hello/Makefile Thu Oct 2 17:41:42 2008 @@ -9,4 +9,4 @@ LLVMC_PLUGIN = Hello -include ../Makefile.common +include ../Makefile.plugins Added: llvm/trunk/tools/llvmc2/plugins/Makefile.plugins URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/plugins/Makefile.plugins?rev=56970&view=auto ============================================================================== --- llvm/trunk/tools/llvmc2/plugins/Makefile.plugins (added) +++ llvm/trunk/tools/llvmc2/plugins/Makefile.plugins Thu Oct 2 17:41:42 2008 @@ -0,0 +1,41 @@ +##===- tools/llvmc2/plugins/Makefile.common ----------------*- Makefile -*-===## +# +# The LLVM Compiler Infrastructure +# +# This file is distributed under the University of Illinois Open +# Source License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## + +LEVEL = ../../../.. + +ifndef LLVMC_PLUGIN +$(error LLVMC_PLUGIN variable is not defined!) +endif + +LIBRARYNAME = $(patsubst %,LLVMC%,$(LLVMC_PLUGIN)) +TOOLS_SOURCE = $(wildcard $(PROJ_SRC_DIR)/*.td) +REQUIRES_EH = 1 + +ifndef BUILTIN_LLVMC_PLUGIN +LOADABLE_MODULE = 1 +endif + +ifneq ($(TOOLS_SOURCE),"") +BUILD_AUTOGENERATED_INC=1 +BUILT_SOURCES = AutoGenerated.inc +endif + +include $(LEVEL)/Makefile.common + +ifdef BUILD_AUTOGENERATED_INC +TD_COMMON = $(wildcard $(LLVM_SRC_ROOT)/include/llvm/CompilerDriver/*.td) + +$(ObjDir)/AutoGenerated.inc.tmp: $(TOOLS_SOURCE) $(ObjDir)/.dir \ + $(TBLGEN) $(TD_COMMON) + $(Echo) "Building LLVMC configuration library with tblgen" + $(Verb) $(TableGen) -gen-llvmc -o $(call SYSPATH, $@) $< + +AutoGenerated.inc : $(ObjDir)/AutoGenerated.inc.tmp + $(Verb) $(CMP) -s $@ $< || $(CP) $< $@ +endif From gohman at apple.com Thu Oct 2 17:15:21 2008 From: gohman at apple.com (Dan Gohman) Date: Thu, 02 Oct 2008 22:15:21 -0000 Subject: [llvm-commits] [llvm] r56969 - in /llvm/trunk: include/llvm/CodeGen/FastISel.h lib/CodeGen/SelectionDAG/FastISel.cpp lib/Target/X86/X86FastISel.cpp Message-ID: <200810022215.m92MFLc4022675@zion.cs.uiuc.edu> Author: djg Date: Thu Oct 2 17:15:21 2008 New Revision: 56969 URL: http://llvm.org/viewvc/llvm-project?rev=56969&view=rev Log: Optimize conditional branches in X86FastISel. This replaces sequences like this: sete %al testb %al, %al jne LBB11_1 with this: je LBB11_1 Modified: llvm/trunk/include/llvm/CodeGen/FastISel.h llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp llvm/trunk/lib/Target/X86/X86FastISel.cpp Modified: llvm/trunk/include/llvm/CodeGen/FastISel.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/FastISel.h?rev=56969&r1=56968&r2=56969&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/FastISel.h (original) +++ llvm/trunk/include/llvm/CodeGen/FastISel.h Thu Oct 2 17:15:21 2008 @@ -238,6 +238,11 @@ /// from a specified index of a superregister. unsigned FastEmitInst_extractsubreg(unsigned Op0, uint32_t Idx); + /// FastEmitBranch - Emit an unconditional branch to the given block, + /// unless it is the immediate (fall-through) successor, and update + /// the CFG. + void FastEmitBranch(MachineBasicBlock *MBB); + void UpdateValueMap(Value* I, unsigned Reg); unsigned createResultReg(const TargetRegisterClass *RC); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp?rev=56969&r1=56968&r2=56969&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp Thu Oct 2 17:15:21 2008 @@ -461,6 +461,23 @@ return SelectOperator(I, I->getOpcode()); } +/// FastEmitBranch - Emit an unconditional branch to the given block, +/// unless it is the immediate (fall-through) successor, and update +/// the CFG. +void +FastISel::FastEmitBranch(MachineBasicBlock *MSucc) { + MachineFunction::iterator NextMBB = + next(MachineFunction::iterator(MBB)); + + if (MBB->isLayoutSuccessor(MSucc)) { + // The unconditional fall-through case, which needs no instructions. + } else { + // The unconditional branch case. + TII.InsertBranch(*MBB, MSucc, NULL, SmallVector()); + } + MBB->addSuccessor(MSucc); +} + bool FastISel::SelectOperator(User *I, unsigned Opcode) { switch (Opcode) { @@ -508,18 +525,9 @@ BranchInst *BI = cast(I); if (BI->isUnconditional()) { - MachineFunction::iterator NextMBB = - next(MachineFunction::iterator(MBB)); BasicBlock *LLVMSucc = BI->getSuccessor(0); MachineBasicBlock *MSucc = MBBMap[LLVMSucc]; - - if (NextMBB != MF.end() && MSucc == NextMBB) { - // The unconditional fall-through case, which needs no instructions. - } else { - // The unconditional branch case. - TII.InsertBranch(*MBB, MSucc, NULL, SmallVector()); - } - MBB->addSuccessor(MSucc); + FastEmitBranch(MSucc); return true; } Modified: llvm/trunk/lib/Target/X86/X86FastISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FastISel.cpp?rev=56969&r1=56968&r2=56969&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86FastISel.cpp (original) +++ llvm/trunk/lib/Target/X86/X86FastISel.cpp Thu Oct 2 17:15:21 2008 @@ -90,6 +90,8 @@ bool X86SelectSelect(Instruction *I); bool X86SelectTrunc(Instruction *I); + + unsigned X86ChooseCmpOpcode(MVT VT); bool X86SelectFPExt(Instruction *I); bool X86SelectFPTrunc(Instruction *I); @@ -507,6 +509,19 @@ return false; } +unsigned X86FastISel::X86ChooseCmpOpcode(MVT VT) { + switch (VT.getSimpleVT()) { + case MVT::i8: return X86::CMP8rr; + case MVT::i16: return X86::CMP16rr; + case MVT::i32: return X86::CMP32rr; + case MVT::i64: return X86::CMP64rr; + case MVT::f32: return X86::UCOMISSrr; + case MVT::f64: return X86::UCOMISDrr; + default: break; + } + return 0; +} + bool X86FastISel::X86SelectCmp(Instruction *I) { CmpInst *CI = cast(I); @@ -519,16 +534,7 @@ unsigned Op1Reg = getRegForValue(CI->getOperand(1)); if (Op1Reg == 0) return false; - unsigned Opc; - switch (VT.getSimpleVT()) { - case MVT::i8: Opc = X86::CMP8rr; break; - case MVT::i16: Opc = X86::CMP16rr; break; - case MVT::i32: Opc = X86::CMP32rr; break; - case MVT::i64: Opc = X86::CMP64rr; break; - case MVT::f32: Opc = X86::UCOMISSrr; break; - case MVT::f64: Opc = X86::UCOMISDrr; break; - default: return false; - } + unsigned Opc = X86ChooseCmpOpcode(VT); unsigned ResultReg = createResultReg(&X86::GR8RegClass); switch (CI->getPredicate()) { @@ -661,19 +667,139 @@ } bool X86FastISel::X86SelectBranch(Instruction *I) { - BranchInst *BI = cast(I); // Unconditional branches are selected by tablegen-generated code. - unsigned OpReg = getRegForValue(BI->getCondition()); - if (OpReg == 0) return false; + // Handle a conditional branch. + BranchInst *BI = cast(I); MachineBasicBlock *TrueMBB = MBBMap[BI->getSuccessor(0)]; MachineBasicBlock *FalseMBB = MBBMap[BI->getSuccessor(1)]; + // Fold the common case of a conditional branch with a comparison. + if (CmpInst *CI = dyn_cast(BI->getCondition())) { + if (CI->hasOneUse()) { + MVT VT = TLI.getValueType(CI->getOperand(0)->getType()); + unsigned Opc = X86ChooseCmpOpcode(VT); + if (Opc == 0) return false; + + // Try to take advantage of fallthrough opportunities. + CmpInst::Predicate Predicate = CI->getPredicate(); + if (MBB->isLayoutSuccessor(TrueMBB)) { + std::swap(TrueMBB, FalseMBB); + Predicate = CmpInst::getInversePredicate(Predicate); + } + + unsigned Op0Reg = getRegForValue(CI->getOperand(0)); + if (Op0Reg == 0) return false; + unsigned Op1Reg = getRegForValue(CI->getOperand(1)); + if (Op1Reg == 0) return false; + + switch (Predicate) { + case CmpInst::FCMP_OGT: + BuildMI(MBB, TII.get(Opc)).addReg(Op0Reg).addReg(Op1Reg); + BuildMI(MBB, TII.get(X86::JA)).addMBB(TrueMBB); + break; + case CmpInst::FCMP_OGE: + BuildMI(MBB, TII.get(Opc)).addReg(Op0Reg).addReg(Op1Reg); + BuildMI(MBB, TII.get(X86::JAE)).addMBB(TrueMBB); + break; + case CmpInst::FCMP_OLT: + BuildMI(MBB, TII.get(Opc)).addReg(Op1Reg).addReg(Op0Reg); + BuildMI(MBB, TII.get(X86::JA)).addMBB(TrueMBB); + break; + case CmpInst::FCMP_OLE: + BuildMI(MBB, TII.get(Opc)).addReg(Op1Reg).addReg(Op0Reg); + BuildMI(MBB, TII.get(X86::JAE)).addMBB(TrueMBB); + break; + case CmpInst::FCMP_ONE: + BuildMI(MBB, TII.get(Opc)).addReg(Op0Reg).addReg(Op1Reg); + BuildMI(MBB, TII.get(X86::JNE)).addMBB(TrueMBB); + break; + case CmpInst::FCMP_ORD: + BuildMI(MBB, TII.get(Opc)).addReg(Op0Reg).addReg(Op1Reg); + BuildMI(MBB, TII.get(X86::JNP)).addMBB(TrueMBB); + break; + case CmpInst::FCMP_UNO: + BuildMI(MBB, TII.get(Opc)).addReg(Op0Reg).addReg(Op1Reg); + BuildMI(MBB, TII.get(X86::JP)).addMBB(TrueMBB); + break; + case CmpInst::FCMP_UEQ: + BuildMI(MBB, TII.get(Opc)).addReg(Op0Reg).addReg(Op1Reg); + BuildMI(MBB, TII.get(X86::JE)).addMBB(TrueMBB); + break; + case CmpInst::FCMP_UGT: + BuildMI(MBB, TII.get(Opc)).addReg(Op1Reg).addReg(Op0Reg); + BuildMI(MBB, TII.get(X86::JB)).addMBB(TrueMBB); + break; + case CmpInst::FCMP_UGE: + BuildMI(MBB, TII.get(Opc)).addReg(Op1Reg).addReg(Op0Reg); + BuildMI(MBB, TII.get(X86::JBE)).addMBB(TrueMBB); + break; + case CmpInst::FCMP_ULT: + BuildMI(MBB, TII.get(Opc)).addReg(Op0Reg).addReg(Op1Reg); + BuildMI(MBB, TII.get(X86::JB)).addMBB(TrueMBB); + break; + case CmpInst::FCMP_ULE: + BuildMI(MBB, TII.get(Opc)).addReg(Op0Reg).addReg(Op1Reg); + BuildMI(MBB, TII.get(X86::JBE)).addMBB(TrueMBB); + break; + case CmpInst::ICMP_EQ: + BuildMI(MBB, TII.get(Opc)).addReg(Op0Reg).addReg(Op1Reg); + BuildMI(MBB, TII.get(X86::JE)).addMBB(TrueMBB); + break; + case CmpInst::ICMP_NE: + BuildMI(MBB, TII.get(Opc)).addReg(Op0Reg).addReg(Op1Reg); + BuildMI(MBB, TII.get(X86::JNE)).addMBB(TrueMBB); + break; + case CmpInst::ICMP_UGT: + BuildMI(MBB, TII.get(Opc)).addReg(Op0Reg).addReg(Op1Reg); + BuildMI(MBB, TII.get(X86::JA)).addMBB(TrueMBB); + break; + case CmpInst::ICMP_UGE: + BuildMI(MBB, TII.get(Opc)).addReg(Op0Reg).addReg(Op1Reg); + BuildMI(MBB, TII.get(X86::JAE)).addMBB(TrueMBB); + break; + case CmpInst::ICMP_ULT: + BuildMI(MBB, TII.get(Opc)).addReg(Op0Reg).addReg(Op1Reg); + BuildMI(MBB, TII.get(X86::JB)).addMBB(TrueMBB); + break; + case CmpInst::ICMP_ULE: + BuildMI(MBB, TII.get(Opc)).addReg(Op0Reg).addReg(Op1Reg); + BuildMI(MBB, TII.get(X86::JBE)).addMBB(TrueMBB); + break; + case CmpInst::ICMP_SGT: + BuildMI(MBB, TII.get(Opc)).addReg(Op0Reg).addReg(Op1Reg); + BuildMI(MBB, TII.get(X86::JG)).addMBB(TrueMBB); + break; + case CmpInst::ICMP_SGE: + BuildMI(MBB, TII.get(Opc)).addReg(Op0Reg).addReg(Op1Reg); + BuildMI(MBB, TII.get(X86::JGE)).addMBB(TrueMBB); + break; + case CmpInst::ICMP_SLT: + BuildMI(MBB, TII.get(Opc)).addReg(Op0Reg).addReg(Op1Reg); + BuildMI(MBB, TII.get(X86::JL)).addMBB(TrueMBB); + break; + case CmpInst::ICMP_SLE: + BuildMI(MBB, TII.get(Opc)).addReg(Op0Reg).addReg(Op1Reg); + BuildMI(MBB, TII.get(X86::JLE)).addMBB(TrueMBB); + break; + default: + return false; + } + MBB->addSuccessor(TrueMBB); + FastEmitBranch(FalseMBB); + return true; + } + } + + // Otherwise do a clumsy setcc and re-test it. + unsigned OpReg = getRegForValue(BI->getCondition()); + if (OpReg == 0) return false; + BuildMI(MBB, TII.get(X86::TEST8rr)).addReg(OpReg).addReg(OpReg); - BuildMI(MBB, TII.get(X86::JNE)).addMBB(TrueMBB); - BuildMI(MBB, TII.get(X86::JMP)).addMBB(FalseMBB); + BuildMI(MBB, TII.get(X86::JNE)).addMBB(TrueMBB); MBB->addSuccessor(TrueMBB); - MBB->addSuccessor(FalseMBB); + + FastEmitBranch(FalseMBB); return true; } From grosbach at apple.com Thu Oct 2 17:56:44 2008 From: grosbach at apple.com (Jim Grosbach) Date: Thu, 02 Oct 2008 22:56:44 -0000 Subject: [llvm-commits] [llvm] r56975 - in /llvm/trunk: Makefile Makefile.config.in Makefile.rules autoconf/configure.ac configure Message-ID: <200810022256.m92MuibQ024412@zion.cs.uiuc.edu> Author: grosbach Date: Thu Oct 2 17:56:44 2008 New Revision: 56975 URL: http://llvm.org/viewvc/llvm-project?rev=56975&view=rev Log: Add support for Canadian Cross builds where the host executables are not runnable on the build machine. There are a few bits that need built for the build environment (TableGen). This patch builds those bits, and the associated libraries, for the build environment as well as the (usual) host environment. Thanks to Eric C. and Devang P. for pre-commit review. Modified: llvm/trunk/Makefile llvm/trunk/Makefile.config.in llvm/trunk/Makefile.rules llvm/trunk/autoconf/configure.ac llvm/trunk/configure Modified: llvm/trunk/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/Makefile?rev=56975&r1=56974&r2=56975&view=diff ============================================================================== --- llvm/trunk/Makefile (original) +++ llvm/trunk/Makefile Thu Oct 2 17:56:44 2008 @@ -25,6 +25,12 @@ include $(LEVEL)/Makefile.config +# When cross-compiling, there are some things (tablegen) that need to +# be build for the build system. +ifeq ($(LLVM_CROSS_COMPILING),1) + BUILD_TARGET_DIRS := lib/System lib/Support utils +endif + # llvm-gcc4 doesn't need runtime libs. llvm-gcc4 is the only supported one. # FIXME: Remove runtime entirely once we have an understanding of where # libprofile etc should go. Modified: llvm/trunk/Makefile.config.in URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/Makefile.config.in?rev=56975&r1=56974&r2=56975&view=diff ============================================================================== --- llvm/trunk/Makefile.config.in (original) +++ llvm/trunk/Makefile.config.in Thu Oct 2 17:56:44 2008 @@ -102,6 +102,11 @@ # tablegen call if we're cross-compiling). BUILD_EXEEXT=@BUILD_EXEEXT@ +# Compilers for the build platflorm (mainly for tablegen +# call if we're cross-compiling). +BUILD_CC=@BUILD_CC@ +BUILD_CXX=@BUILD_CXX@ + # Target triple (cpu-vendor-os) for which we should generate code TARGET_TRIPLE=@target@ Modified: llvm/trunk/Makefile.rules URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/Makefile.rules?rev=56975&r1=56974&r2=56975&view=diff ============================================================================== --- llvm/trunk/Makefile.rules (original) +++ llvm/trunk/Makefile.rules Thu Oct 2 17:56:44 2008 @@ -302,13 +302,24 @@ #-------------------------------------------------------------------- # Directory locations #-------------------------------------------------------------------- -ObjDir := $(PROJ_OBJ_DIR)/$(BuildMode) -LibDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/lib -ToolDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/bin -ExmplDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/examples -LLVMLibDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/lib -LLVMToolDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/bin -LLVMExmplDir:= $(LLVM_OBJ_ROOT)/$(BuildMode)/examples +TargetMode := +ifeq ($(LLVM_CROSS_COMPILING),1) + ifeq ($(BUILD_COMPONENT),1) + TargetMode := Build + else + TargetMode := Host + endif + BuildLLVMToolDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/Build/bin +endif + +ObjRootDir := $(PROJ_OBJ_DIR)/$(BuildMode) +ObjDir := $(ObjRootDir)/$(TargetMode) +LibDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/$(TargetMode)/lib +ToolDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/$(TargetMode)/bin +ExmplDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/$(TargetMode)/examples +LLVMLibDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/$(TargetMode)/lib +LLVMToolDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/$(TargetMode)/bin +LLVMExmplDir:= $(LLVM_OBJ_ROOT)/$(BuildMode)/$(TargetMode)/examples CFERuntimeLibDir := $(LLVMGCCDIR)/lib #-------------------------------------------------------------------- @@ -324,7 +335,7 @@ endif ifndef TBLGEN ifeq ($(LLVM_CROSS_COMPILING),1) - TBLGEN := $(LLVMToolDir)/tblgen$(BUILD_EXEEXT) + TBLGEN := $(BuildLLVMToolDir)/tblgen$(EXEEXT) else TBLGEN := $(LLVMToolDir)/tblgen$(EXEEXT) endif @@ -468,22 +479,33 @@ $(LLVM_OBJ_ROOT) $(LLVM_SRC_ROOT))) \ $(CPP.BaseFlags) -Compile.C = $(CC) $(CPP.Flags) $(C.Flags) $(CompileCommonOpts) -c + ifeq ($(BUILD_COMPONENT), 1) + Compile.C = $(BUILD_CC) $(CPP.Flags) $(C.Flags) $(CompileCommonOpts) -c + Compile.CXX = $(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) $(CompileCommonOpts) -c + Preprocess.CXX= $(BUILD_CXX) $(CPP.Flags) $(CompileCommonOpts) $(CXX.Flags) -E + Link = $(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) $(CompileCommonOpts) \ + $(LD.Flags) $(Strip) + Relink = $(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) $(CompileCommonOpts) \ + $(Relink.Flags) +else + Compile.C = $(CC) $(CPP.Flags) $(C.Flags) $(CompileCommonOpts) -c + Compile.CXX = $(CXX) $(CPP.Flags) $(CXX.Flags) $(CompileCommonOpts) -c + Preprocess.CXX= $(CXX) $(CPP.Flags) $(CompileCommonOpts) $(CXX.Flags) -E + Link = $(CXX) $(CPP.Flags) $(CXX.Flags) $(CompileCommonOpts) \ + $(LD.Flags) $(Strip) + Relink = $(CXX) $(CPP.Flags) $(CXX.Flags) $(CompileCommonOpts) \ + $(Relink.Flags) +endif + LTCompile.C = $(LIBTOOL) $(LibTool.Flags) --mode=compile $(Compile.C) BCCompile.C = $(LLVMGCCWITHPATH) $(CPP.Flags) $(C.Flags) $(CompileCommonOpts) Preprocess.C = $(CC) $(CPP.Flags) $(C.Flags) $(CompileCommonOpts) -E -Compile.CXX = $(CXX) $(CPP.Flags) $(CXX.Flags) $(CompileCommonOpts) -c LTCompile.CXX = $(LIBTOOL) $(LibTool.Flags) --mode=compile $(Compile.CXX) BCCompile.CXX = $(LLVMGXXWITHPATH) $(CPP.Flags) $(CXX.Flags) \ $(CompileCommonOpts) -Preprocess.CXX= $(CXX) $(CPP.Flags) $(CompileCommonOpts) $(CXX.Flags) -E -Link = $(CXX) $(CPP.Flags) $(CXX.Flags) $(CompileCommonOpts) \ - $(LD.Flags) $(Strip) LTLink = $(LIBTOOL) $(LibTool.Flags) --mode=link $(Link) -Relink = $(CXX) $(CPP.Flags) $(CXX.Flags) $(CompileCommonOpts) \ - $(Relink.Flags) LTRelink = $(LIBTOOL) $(LibTool.Flags) --mode=link $(Relink) LTInstall = $(LIBTOOL) $(LibTool.Flags) --mode=install $(INSTALL) \ $(Install.Flags) @@ -560,6 +582,16 @@ SubDirs += $(DIRS) ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT)) +ifdef BUILD_TARGET_DIRS +$(RecursiveTargets):: + $(Verb) for dir in $(BUILD_TARGET_DIRS); do \ + if [ ! -f $$dir/Makefile ]; then \ + $(MKDIR) $$dir; \ + $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \ + fi; \ + ($(MAKE) -C $$dir $@ BUILD_COMPONENT=1 NO_INSTALL=1 ) || exit 1; \ + done +endif $(RecursiveTargets):: $(Verb) for dir in $(DIRS); do \ if [ ! -f $$dir/Makefile ]; then \ @@ -569,6 +601,12 @@ ($(MAKE) -C $$dir $@ ) || exit 1; \ done else +ifdef BUILD_TARGET_DIRS +$(RecursiveTargets):: + $(Verb) for dir in $(BUILD_TARGET_DIRS); do \ + ($(MAKE) -C $$dir $@ BUILD_COMPONENT=1 NO_INSTALL=1 ) || exit 1; \ + done +endif $(RecursiveTargets):: $(Verb) for dir in $(DIRS); do \ ($(MAKE) -C $$dir $@ ) || exit 1; \ @@ -1451,8 +1489,8 @@ # very conservative approach ensuring that empty variables do not cause # errors or disastrous removal. clean-local:: -ifneq ($(strip $(ObjDir)),) - -$(Verb) $(RM) -rf $(ObjDir) +ifneq ($(strip $(ObjRootDir)),) + -$(Verb) $(RM) -rf $(ObjRootDir) endif -$(Verb) $(RM) -f core core.[0-9][0-9]* *.o *.d *~ *.flc ifneq ($(strip $(SHLIBEXT)),) # Extra paranoia - make real sure SHLIBEXT is set Modified: llvm/trunk/autoconf/configure.ac URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/configure.ac?rev=56975&r1=56974&r2=56975&view=diff ============================================================================== --- llvm/trunk/autoconf/configure.ac (original) +++ llvm/trunk/autoconf/configure.ac Thu Oct 2 17:56:44 2008 @@ -242,6 +242,14 @@ if test "$cross_compiling" = yes; then AC_SUBST(LLVM_CROSS_COMPILING, [1]) AC_BUILD_EXEEXT + ac_build_prefix=${build_alias}- + AC_CHECK_PROG(BUILD_CXX, ${ac_build_prefix}g++, ${ac_build_prefix}g++) + if test -z "$BUILD_CXX"; then + AC_CHECK_PROG(BUILD_CXX, g++, g++) + if test -z "$BUILD_CXX"; then + AC_CHECK_PROG(BUILD_CXX, c++, c++, , , /usr/ucb/c++) + fi + fi else AC_SUBST(LLVM_CROSS_COMPILING, [0]) fi Modified: llvm/trunk/configure URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/configure?rev=56975&r1=56974&r2=56975&view=diff ============================================================================== --- llvm/trunk/configure (original) +++ llvm/trunk/configure Thu Oct 2 17:56:44 2008 @@ -827,6 +827,7 @@ LLVM_CROSS_COMPILING BUILD_CC BUILD_EXEEXT +BUILD_CXX CVSBUILD ENABLE_OPTIMIZED DISABLE_ASSERTIONS @@ -4565,6 +4566,139 @@ echo "${ECHO_T}${ac_cv_build_exeext}" >&6; } ac_build_exeext=$BUILD_EXEEXT + ac_build_prefix=${build_alias}- + # Extract the first word of "${ac_build_prefix}g++", so it can be a program name with args. +set dummy ${ac_build_prefix}g++; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_BUILD_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$BUILD_CXX"; then + ac_cv_prog_BUILD_CXX="$BUILD_CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_BUILD_CXX="${ac_build_prefix}g++" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +BUILD_CXX=$ac_cv_prog_BUILD_CXX +if test -n "$BUILD_CXX"; then + { echo "$as_me:$LINENO: result: $BUILD_CXX" >&5 +echo "${ECHO_T}$BUILD_CXX" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + if test -z "$BUILD_CXX"; then + # Extract the first word of "g++", so it can be a program name with args. +set dummy g++; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_BUILD_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$BUILD_CXX"; then + ac_cv_prog_BUILD_CXX="$BUILD_CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_BUILD_CXX="g++" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +BUILD_CXX=$ac_cv_prog_BUILD_CXX +if test -n "$BUILD_CXX"; then + { echo "$as_me:$LINENO: result: $BUILD_CXX" >&5 +echo "${ECHO_T}$BUILD_CXX" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + if test -z "$BUILD_CXX"; then + # Extract the first word of "c++", so it can be a program name with args. +set dummy c++; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_BUILD_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$BUILD_CXX"; then + ac_cv_prog_BUILD_CXX="$BUILD_CXX" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/c++"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_BUILD_CXX="c++" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_BUILD_CXX + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set BUILD_CXX to just the basename; use the full file name. + shift + ac_cv_prog_BUILD_CXX="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +BUILD_CXX=$ac_cv_prog_BUILD_CXX +if test -n "$BUILD_CXX"; then + { echo "$as_me:$LINENO: result: $BUILD_CXX" >&5 +echo "${ECHO_T}$BUILD_CXX" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + fi + fi else LLVM_CROSS_COMPILING=0 @@ -8868,9 +9002,7 @@ fi - - -if test x"${enable_ltdl_install-no}" != xno; then + if test x"${enable_ltdl_install-no}" != xno; then INSTALL_LTDL_TRUE= INSTALL_LTDL_FALSE='#' else @@ -8878,9 +9010,7 @@ INSTALL_LTDL_FALSE= fi - - -if test x"${enable_ltdl_convenience-no}" != xno; then + if test x"${enable_ltdl_convenience-no}" != xno; then CONVENIENCE_LTDL_TRUE= CONVENIENCE_LTDL_FALSE='#' else @@ -10647,7 +10777,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext + echo '#line 12924 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -14509,11 +14639,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14512: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14642: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14516: \$? = $ac_status" >&5 + echo "$as_me:14646: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -14777,11 +14907,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14780: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14910: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14784: \$? = $ac_status" >&5 + echo "$as_me:14914: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -14881,11 +15011,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14884: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15014: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:14888: \$? = $ac_status" >&5 + echo "$as_me:15018: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -17333,7 +17463,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:19934: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:19808: \$? = $ac_status" >&5 + echo "$as_me:19938: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -19905,11 +20035,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:19908: $lt_compile\"" >&5) + (eval echo "\"\$as_me:20038: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:19912: \$? = $ac_status" >&5 + echo "$as_me:20042: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -21475,11 +21605,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:21478: $lt_compile\"" >&5) + (eval echo "\"\$as_me:21608: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:21482: \$? = $ac_status" >&5 + echo "$as_me:21612: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -21579,11 +21709,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:21582: $lt_compile\"" >&5) + (eval echo "\"\$as_me:21712: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:21586: \$? = $ac_status" >&5 + echo "$as_me:21716: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -23814,11 +23944,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:23817: $lt_compile\"" >&5) + (eval echo "\"\$as_me:23947: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:23821: \$? = $ac_status" >&5 + echo "$as_me:23951: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -24082,11 +24212,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:24085: $lt_compile\"" >&5) + (eval echo "\"\$as_me:24215: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:24089: \$? = $ac_status" >&5 + echo "$as_me:24219: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -24186,11 +24316,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:24189: $lt_compile\"" >&5) + (eval echo "\"\$as_me:24319: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:24193: \$? = $ac_status" >&5 + echo "$as_me:24323: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -35138,6 +35268,7 @@ LLVM_CROSS_COMPILING!$LLVM_CROSS_COMPILING$ac_delim BUILD_CC!$BUILD_CC$ac_delim BUILD_EXEEXT!$BUILD_EXEEXT$ac_delim +BUILD_CXX!$BUILD_CXX$ac_delim CVSBUILD!$CVSBUILD$ac_delim ENABLE_OPTIMIZED!$ENABLE_OPTIMIZED$ac_delim DISABLE_ASSERTIONS!$DISABLE_ASSERTIONS$ac_delim @@ -35163,7 +35294,6 @@ YFLAGS!$YFLAGS$ac_delim BISON!$BISON$ac_delim NM!$NM$ac_delim -ifGNUmake!$ifGNUmake$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then @@ -35205,6 +35335,7 @@ ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF +ifGNUmake!$ifGNUmake$ac_delim LN_S!$LN_S$ac_delim CMP!$CMP$ac_delim CP!$CP$ac_delim @@ -35285,7 +35416,7 @@ LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 78; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 79; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 From anton at korobeynikov.info Thu Oct 2 18:10:03 2008 From: anton at korobeynikov.info (Anton Korobeynikov) Date: Fri, 3 Oct 2008 03:10:03 +0400 Subject: [llvm-commits] [llvm] r56975 - in /llvm/trunk: Makefile Makefile.config.in Makefile.rules autoconf/configure.ac configure In-Reply-To: <200810022256.m92MuibQ024412@zion.cs.uiuc.edu> References: <200810022256.m92MuibQ024412@zion.cs.uiuc.edu> Message-ID: Hi, Jim > Add support for Canadian Cross builds where the host executables are not > runnable on the build machine. Really cool! I was thinking about this for ages, but was too lazy to implement it fully. :) > ============================================================================== > --- llvm/trunk/configure (original) > +++ llvm/trunk/configure Thu Oct 2 17:56:44 2008 Please, next time commit auto-generated files as a separate check-in. -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University From gohman at apple.com Thu Oct 2 19:07:11 2008 From: gohman at apple.com (Dan Gohman) Date: Fri, 03 Oct 2008 00:07:11 -0000 Subject: [llvm-commits] [llvm] r56986 - /llvm/trunk/docs/CodeGenerator.html Message-ID: <200810030007.m9307Bi2026868@zion.cs.uiuc.edu> Author: djg Date: Thu Oct 2 19:07:11 2008 New Revision: 56986 URL: http://llvm.org/viewvc/llvm-project?rev=56986&view=rev Log: Fix a typo. Modified: llvm/trunk/docs/CodeGenerator.html Modified: llvm/trunk/docs/CodeGenerator.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CodeGenerator.html?rev=56986&r1=56985&r2=56986&view=diff ============================================================================== --- llvm/trunk/docs/CodeGenerator.html (original) +++ llvm/trunk/docs/CodeGenerator.html Thu Oct 2 19:07:11 2008 @@ -894,7 +894,7 @@ lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp file. The intent of this pass is to expose as much low-level, target-specific details to the SelectionDAG as possible. This pass is mostly hard-coded (e.g. an LLVM add turns -into an SDNode add while a geteelementptr is expanded into the +into an SDNode add while a getelementptr is expanded into the obvious arithmetic). This pass requires target-specific hooks to lower calls, returns, varargs, etc. For these features, the TargetLowering interface is used.

    From isanbard at gmail.com Thu Oct 2 19:26:49 2008 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 03 Oct 2008 00:26:49 -0000 Subject: [llvm-commits] [llvm] r56988 - /llvm/trunk/tools/llvmc2/Makefile Message-ID: <200810030026.m930QnIO027541@zion.cs.uiuc.edu> Author: void Date: Thu Oct 2 19:26:49 2008 New Revision: 56988 URL: http://llvm.org/viewvc/llvm-project?rev=56988&view=rev Log: Unbreak the build. Modified: llvm/trunk/tools/llvmc2/Makefile Modified: llvm/trunk/tools/llvmc2/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/Makefile?rev=56988&r1=56987&r2=56988&view=diff ============================================================================== --- llvm/trunk/tools/llvmc2/Makefile (original) +++ llvm/trunk/tools/llvmc2/Makefile Thu Oct 2 19:26:49 2008 @@ -8,7 +8,8 @@ ##===----------------------------------------------------------------------===## # Compiled-in plugins -BUILTIN_PLUGINS = Base +##### FIXME: This breaks the build. +#####BUILTIN_PLUGINS = Base LEVEL = ../.. TOOLNAME = llvmc2 From gohman at apple.com Thu Oct 2 20:27:51 2008 From: gohman at apple.com (Dan Gohman) Date: Fri, 03 Oct 2008 01:27:51 -0000 Subject: [llvm-commits] [llvm] r56989 - /llvm/trunk/lib/Target/X86/X86FastISel.cpp Message-ID: <200810030127.m931RpT0029463@zion.cs.uiuc.edu> Author: djg Date: Thu Oct 2 20:27:49 2008 New Revision: 56989 URL: http://llvm.org/viewvc/llvm-project?rev=56989&view=rev Log: Fix X86FastISel to handle dynamic allocas that have avoided getting inserted into the ValueMap. This avoids infinite recursion in some rare cases. 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=56989&r1=56988&r2=56989&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86FastISel.cpp (original) +++ llvm/trunk/lib/Target/X86/X86FastISel.cpp Thu Oct 2 20:27:49 2008 @@ -1365,6 +1365,16 @@ } unsigned X86FastISel::TargetMaterializeAlloca(AllocaInst *C) { + // Fail on dynamic allocas. At this point, getRegForValue has already + // checked its CSE maps, so if we're here trying to handle a dynamic + // alloca, we're not going to succeed. X86SelectAddress has a + // check for dynamic allocas, because it's called directly from + // various places, but TargetMaterializeAlloca also needs a check + // in order to avoid recursion between getRegForValue, + // X86SelectAddrss, and TargetMaterializeAlloca. + if (!StaticAllocaMap.count(C)) + return 0; + X86AddressMode AM; if (!X86SelectAddress(C, AM, false)) return 0; From gohman at apple.com Thu Oct 2 20:28:47 2008 From: gohman at apple.com (Dan Gohman) Date: Fri, 03 Oct 2008 01:28:47 -0000 Subject: [llvm-commits] [llvm] r56990 - /llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp Message-ID: <200810030128.m931SlKq029502@zion.cs.uiuc.edu> Author: djg Date: Thu Oct 2 20:28:47 2008 New Revision: 56990 URL: http://llvm.org/viewvc/llvm-project?rev=56990&view=rev Log: Implement fast-isel support for zero-extending from i1. It turns out that this is a fairly common operation, and it's easy enough to handle. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp?rev=56990&r1=56989&r2=56990&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp Thu Oct 2 20:28:47 2008 @@ -386,10 +386,21 @@ if (SrcVT == MVT::Other || !SrcVT.isSimple() || DstVT == MVT::Other || !DstVT.isSimple() || - !TLI.isTypeLegal(SrcVT) || !TLI.isTypeLegal(DstVT)) + !TLI.isTypeLegal(DstVT)) // Unhandled type. Halt "fast" selection and bail. return false; + // Check if the source operand is legal. Or as a special case, + // it may be i1 if we're doing zero-extension because that's + // trivially easy and somewhat common. + if (!TLI.isTypeLegal(SrcVT)) { + if (SrcVT == MVT::i1 && Opcode == ISD::ZERO_EXTEND) + SrcVT = TLI.getTypeToTransformTo(SrcVT); + else + // Unhandled type. Halt "fast" selection and bail. + return false; + } + unsigned InputReg = getRegForValue(I->getOperand(0)); if (!InputReg) // Unhandled operand. Halt "fast" selection and bail. From anton at korobeynikov.info Fri Oct 3 00:36:05 2008 From: anton at korobeynikov.info (Anton Korobeynikov) Date: Fri, 3 Oct 2008 09:36:05 +0400 Subject: [llvm-commits] [llvm] r56988 - /llvm/trunk/tools/llvmc2/Makefile In-Reply-To: <200810030026.m930QnIO027541@zion.cs.uiuc.edu> References: <200810030026.m930QnIO027541@zion.cs.uiuc.edu> Message-ID: Hi, Bill > +##### FIXME: This breaks the build. How? There was missed file and it was commited recently -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University From resistor at mac.com Fri Oct 3 01:55:36 2008 From: resistor at mac.com (Owen Anderson) Date: Fri, 03 Oct 2008 06:55:36 -0000 Subject: [llvm-commits] [llvm] r56994 - /llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp Message-ID: <200810030655.m936tait006891@zion.cs.uiuc.edu> Author: resistor Date: Fri Oct 3 01:55:35 2008 New Revision: 56994 URL: http://llvm.org/viewvc/llvm-project?rev=56994&view=rev Log: SplitBlock should only attempt to update LoopInfo if it is actually being used. Modified: llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp Modified: llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp?rev=56994&r1=56993&r2=56994&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp Fri Oct 3 01:55:35 2008 @@ -240,16 +240,15 @@ /// the loop info is updated. /// BasicBlock *llvm::SplitBlock(BasicBlock *Old, Instruction *SplitPt, Pass *P) { - - LoopInfo &LI = P->getAnalysis(); BasicBlock::iterator SplitIt = SplitPt; while (isa(SplitIt)) ++SplitIt; BasicBlock *New = Old->splitBasicBlock(SplitIt, Old->getName()+".split"); // The new block lives in whichever loop the old one did. - if (Loop *L = LI.getLoopFor(Old)) - L->addBasicBlockToLoop(New, LI.getBase()); + if (LoopInfo* LI = P->getAnalysisToUpdate()) + if (Loop *L = LI->getLoopFor(Old)) + L->addBasicBlockToLoop(New, LI->getBase()); if (DominatorTree *DT = P->getAnalysisToUpdate()) { From baldrick at free.fr Fri Oct 3 02:14:25 2008 From: baldrick at free.fr (Duncan Sands) Date: Fri, 3 Oct 2008 09:14:25 +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: <6a8523d60810020921y27ef8c4eyee02bafb75c22df7@mail.gmail.com> References: <200810020117.m921HSJ8005371@zion.cs.uiuc.edu> <200810021049.51723.baldrick@free.fr> <6a8523d60810020921y27ef8c4eyee02bafb75c22df7@mail.gmail.com> Message-ID: <200810030914.25862.baldrick@free.fr> > 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? Actually, I was just wondering why you would want the target-triple of the host. After all, the target-triple is for the target not the host! I'd forgotten about clang - I suppose clang targets the host by default. Ciao, Duncan. From baldrick at free.fr Fri Oct 3 02:15:36 2008 From: baldrick at free.fr (Duncan Sands) Date: Fri, 3 Oct 2008 09:15:36 +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: <023D4DFA-C77D-4B15-AEF0-9A2BB0FEBBE2@apple.com> References: <200810012318.m91NIdJn001426@zion.cs.uiuc.edu> <200810021037.36288.baldrick@free.fr> <023D4DFA-C77D-4B15-AEF0-9A2BB0FEBBE2@apple.com> Message-ID: <200810030915.36934.baldrick@free.fr> > >> + 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(). Don't listen to that Chris guy, what does he know! :) Ciao, Duncan. From baldrick at free.fr Fri Oct 3 02:19:24 2008 From: baldrick at free.fr (Duncan Sands) Date: Fri, 3 Oct 2008 09:19:24 +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: References: <200810012341.m91NfPF1002323@zion.cs.uiuc.edu> <200810021048.02861.baldrick@free.fr> Message-ID: <200810030919.24364.baldrick@free.fr> > 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. I was thinking more of a front-end that generates IR directly. For example, if in llvm-gcc I accidentally tried to add "inreg" at ~0 rather than 0, would the verifier catch that? Ciao, Duncan. From nicolas.geoffray at lip6.fr Fri Oct 3 02:27:09 2008 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Fri, 03 Oct 2008 07:27:09 -0000 Subject: [llvm-commits] [llvm] r56995 - /llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp Message-ID: <200810030727.m937R9cH007994@zion.cs.uiuc.edu> Author: geoffray Date: Fri Oct 3 02:27:08 2008 New Revision: 56995 URL: http://llvm.org/viewvc/llvm-project?rev=56995&view=rev Log: Acquire the lock only when necessary. More precisely, do not acquire the lock when calling a method which may materialize the llvm::Function. Modified: llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp Modified: llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp?rev=56995&r1=56994&r2=56995&view=diff ============================================================================== --- llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp (original) +++ llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp Fri Oct 3 02:27:08 2008 @@ -233,16 +233,25 @@ /// it if necessary, then returns the resultant function pointer. void *JITResolver::JITCompilerFn(void *Stub) { JITResolver &JR = *TheJITResolver; + + Function* F = 0; + void* ActualPtr = 0; - MutexGuard locked(TheJIT->lock); - - // The address given to us for the stub may not be exactly right, it might be - // a little bit after the stub. As such, use upper_bound to find it. - std::map::iterator I = - JR.state.getStubToFunctionMap(locked).upper_bound(Stub); - assert(I != JR.state.getStubToFunctionMap(locked).begin() && - "This is not a known stub!"); - Function *F = (--I)->second; + { + // Only lock for getting the Function. The call getPointerToFunction made + // in this function might trigger function materializing, which requires + // JIT lock to be unlocked. + MutexGuard locked(TheJIT->lock); + + // The address given to us for the stub may not be exactly right, it might be + // a little bit after the stub. As such, use upper_bound to find it. + std::map::iterator I = + JR.state.getStubToFunctionMap(locked).upper_bound(Stub); + assert(I != JR.state.getStubToFunctionMap(locked).begin() && + "This is not a known stub!"); + F = (--I)->second; + ActualPtr = I->first; + } // If we have already code generated the function, just return the address. void *Result = TheJIT->getPointerToGlobalIfAvailable(F); @@ -266,10 +275,13 @@ DOUT << "JIT: Lazily resolving function '" << F->getName() << "' In stub ptr = " << Stub << " actual ptr = " - << I->first << "\n"; + << ActualPtr << "\n"; Result = TheJIT->getPointerToFunction(F); } + + // Reacquire the lock to erase the stub in the map. + MutexGuard locked(TheJIT->lock); // We don't need to reuse this stub in the future, as F is now compiled. JR.state.getFunctionToStubMap(locked).erase(F); From baldrick at free.fr Fri Oct 3 02:30:42 2008 From: baldrick at free.fr (Duncan Sands) Date: Fri, 3 Oct 2008 09:30:42 +0200 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 In-Reply-To: <200810021829.m92ITS8x014885@zion.cs.uiuc.edu> References: <200810021829.m92ITS8x014885@zion.cs.uiuc.edu> Message-ID: <200810030930.42386.baldrick@free.fr> Hi, > +// The Univesity of Sydney Univesity -> University > + //! \brief Builds a PBQP interfernce matrix. interfernce -> interference What's with the exclamation marks at the start of comments? > + //! \brief Helper functior for constructInitialPBQPProblem(). functior -> function > + //... Just the virtual registers. We treat loads and stores as equal. > + li->getInterval(moReg).weight += powf(10.0f, loopDepth); > + } Funky indentation. Ciao, Duncan. From baldrick at free.fr Fri Oct 3 02:36:09 2008 From: baldrick at free.fr (Duncan Sands) Date: Fri, 03 Oct 2008 07:36:09 -0000 Subject: [llvm-commits] [llvm] r56996 - in /llvm/trunk: include/llvm/Analysis/CallGraph.h lib/Analysis/IPA/CallGraph.cpp lib/Transforms/IPO/Internalize.cpp Message-ID: <200810030736.m937a9mD008980@zion.cs.uiuc.edu> Author: baldrick Date: Fri Oct 3 02:36:09 2008 New Revision: 56996 URL: http://llvm.org/viewvc/llvm-project?rev=56996&view=rev Log: Teach internalize to preserve the callgraph. Why? Because it was there! Modified: llvm/trunk/include/llvm/Analysis/CallGraph.h llvm/trunk/lib/Analysis/IPA/CallGraph.cpp llvm/trunk/lib/Transforms/IPO/Internalize.cpp Modified: llvm/trunk/include/llvm/Analysis/CallGraph.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/CallGraph.h?rev=56996&r1=56995&r2=56996&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/CallGraph.h (original) +++ llvm/trunk/include/llvm/Analysis/CallGraph.h Fri Oct 3 02:36:09 2008 @@ -225,11 +225,15 @@ /// should be used sparingly. void removeCallEdgeFor(CallSite CS); - /// removeAnyCallEdgeTo - This method removes any call edges from this node to - /// the specified callee function. This takes more time to execute than + /// removeAnyCallEdgeTo - This method removes all call edges from this node + /// to the specified callee function. This takes more time to execute than /// removeCallEdgeTo, so it should not be used unless necessary. void removeAnyCallEdgeTo(CallGraphNode *Callee); + /// removeOneAbstractEdgeTo - Remove one edge associated with a null callsite + /// from this node to the specified callee function. + void removeOneAbstractEdgeTo(CallGraphNode *Callee); + /// replaceCallSite - Make the edge in the node for Old CallSite be for /// New CallSite instead. Note that this method takes linear time, so it /// should be used sparingly. Modified: llvm/trunk/lib/Analysis/IPA/CallGraph.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/CallGraph.cpp?rev=56996&r1=56995&r2=56996&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/IPA/CallGraph.cpp (original) +++ llvm/trunk/lib/Analysis/IPA/CallGraph.cpp Fri Oct 3 02:36:09 2008 @@ -282,6 +282,19 @@ } } +/// removeOneAbstractEdgeTo - Remove one edge associated with a null callsite +/// from this node to the specified callee function. +void CallGraphNode::removeOneAbstractEdgeTo(CallGraphNode *Callee) { + for (unsigned i = CalledFunctions.size(); ; --i) { + assert(i && "Cannot find callee to remove!"); + CallRecord &CR = CalledFunctions[i-1]; + if (CR.second == Callee && !CR.first.getInstruction()) { + CalledFunctions.erase(CalledFunctions.begin()+i-1); + return; + } + } +} + /// replaceCallSite - Make the edge in the node for Old CallSite be for /// New CallSite instead. Note that this method takes linear time, so it /// should be used sparingly. Modified: llvm/trunk/lib/Transforms/IPO/Internalize.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/Internalize.cpp?rev=56996&r1=56995&r2=56996&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/Internalize.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/Internalize.cpp Fri Oct 3 02:36:09 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" @@ -55,6 +56,7 @@ virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesCFG(); + AU.addPreserved(); } }; } // end anonymous namespace @@ -96,6 +98,9 @@ } bool InternalizePass::runOnModule(Module &M) { + CallGraph *CG = getAnalysisToUpdate(); + CallGraphNode *ExternalNode = CG ? CG->getExternalCallingNode() : 0; + if (ExternalNames.empty()) { // Return if we're not in 'all but main' mode and have no external api if (!AllButMain) @@ -120,6 +125,8 @@ !I->hasInternalLinkage() && // Can't already have internal linkage !ExternalNames.count(I->getName())) {// Not marked to keep external? I->setLinkage(GlobalValue::InternalLinkage); + // Remove a callgraph edge from the external node to this function. + if (ExternalNode) ExternalNode->removeOneAbstractEdgeTo((*CG)[I]); Changed = true; ++NumFunctions; DOUT << "Internalizing func " << I->getName() << "\n"; From baldrick at free.fr Fri Oct 3 02:36:56 2008 From: baldrick at free.fr (Duncan Sands) Date: Fri, 3 Oct 2008 09:36:56 +0200 Subject: [llvm-commits] [llvm] r56887 - /llvm/trunk/lib/Transforms/IPO/Internalize.cpp In-Reply-To: <30424DD75D784EEBBC3F2AC796215709@pc07654> References: <200809302204.m8UM4V8b007868@zion.cs.uiuc.edu> <200810011119.06165.baldrick@free.fr> <30424DD75D784EEBBC3F2AC796215709@pc07654> Message-ID: <200810030936.56837.baldrick@free.fr> > > That said, it would be easy to update the callgraph. > > I guess that would go beyond my current knowledge of llvm :P I've taught Internalize to update the callgraph, and reapplied your patch. Ciao, Duncan. From baldrick at free.fr Fri Oct 3 02:41:47 2008 From: baldrick at free.fr (Duncan Sands) Date: Fri, 03 Oct 2008 07:41:47 -0000 Subject: [llvm-commits] [llvm] r56997 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp Message-ID: <200810030741.m937flJ1010466@zion.cs.uiuc.edu> Author: baldrick Date: Fri Oct 3 02:41:46 2008 New Revision: 56997 URL: http://llvm.org/viewvc/llvm-project?rev=56997&view=rev Log: The result of getSetCCResultType (eg: i32) may be larger than the type an i1 is promoted to (eg: i8). Account for this. Noticed by Tilmann Scheller on CellSPU; he will hopefully take care of fixing this in LegalizeDAG and adding a testcase! Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp?rev=56997&r1=56996&r2=56997&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp Fri Oct 3 02:41:46 2008 @@ -365,10 +365,14 @@ } SDValue DAGTypeLegalizer::PromoteIntRes_SETCC(SDNode *N) { - assert(isTypeLegal(TLI.getSetCCResultType(N->getOperand(0))) - && "SetCC type is not legal??"); - return DAG.getNode(ISD::SETCC, TLI.getSetCCResultType(N->getOperand(0)), - N->getOperand(0), N->getOperand(1), N->getOperand(2)); + MVT NVT = TLI.getTypeToTransformTo(N->getValueType(0)); + MVT SVT = TLI.getSetCCResultType(N->getOperand(0)); + assert(isTypeLegal(SVT) && "SetCC type not legal??"); + assert(NVT.getSizeInBits() <= SVT.getSizeInBits() && + "Integer type overpromoted?"); + return DAG.getNode(ISD::TRUNCATE, NVT, + DAG.getNode(ISD::SETCC, SVT, N->getOperand(0), + N->getOperand(1), N->getOperand(2))); } SDValue DAGTypeLegalizer::PromoteIntRes_SHL(SDNode *N) { From isanbard at gmail.com Fri Oct 3 03:26:19 2008 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 3 Oct 2008 01:26:19 -0700 Subject: [llvm-commits] [llvm] r56988 - /llvm/trunk/tools/llvmc2/Makefile In-Reply-To: References: <200810030026.m930QnIO027541@zion.cs.uiuc.edu> Message-ID: On Oct 2, 2008, at 10:36 PM, Anton Korobeynikov wrote: > Hi, Bill > >> +##### FIXME: This breaks the build. > How? There was missed file and it was commited recently > It was still failing for me. Go figure. -bw From mikael.lepisto at tut.fi Fri Oct 3 03:37:29 2008 From: mikael.lepisto at tut.fi (=?ISO-8859-1?Q?Mikael_Lepist=F6?=) Date: Fri, 03 Oct 2008 11:37:29 +0300 Subject: [llvm-commits] [patch] Fix LegalizeDAG to convert ISD::MUL to libcall is MUL operation is not found. Message-ID: <48E5D9C9.2080709@tut.fi> Hi, I tried to compile stuff without mul operation in target and LegalizeDAG failed when it tried to expand ISD::MUL. This patch seemed to help. Mikael Lepist? Technical University of Tampere -------------- next part -------------- A non-text attachment was scrubbed... Name: mul_libcall_expanding.patch Type: text/x-diff Size: 670 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20081003/c91bfb01/attachment.bin From foldr at codedgers.com Fri Oct 3 04:09:35 2008 From: foldr at codedgers.com (Mikhail Glushenkov) Date: Fri, 03 Oct 2008 09:09:35 -0000 Subject: [llvm-commits] [llvm] r56998 - in /llvm/trunk/tools/llvmc2: Action.cpp CompilationGraph.cpp Error.h Makefile Plugin.cpp examples/Simple.td llvmc.cpp plugins/Base/Base.td plugins/Clang/Clang.td plugins/Makefile.plugins src/ src/Action.cpp src/CompilationGraph.cpp src/Error.h src/Makefile src/Plugin.cpp src/llvmc.cpp Message-ID: <200810030909.m9399Z1S020711@zion.cs.uiuc.edu> Author: foldr Date: Fri Oct 3 04:09:34 2008 New Revision: 56998 URL: http://llvm.org/viewvc/llvm-project?rev=56998&view=rev Log: Fix build breakage (again) when srcdir != objdir, other small fixes. Added: llvm/trunk/tools/llvmc2/src/ llvm/trunk/tools/llvmc2/src/Action.cpp - copied, changed from r56997, llvm/trunk/tools/llvmc2/Action.cpp llvm/trunk/tools/llvmc2/src/CompilationGraph.cpp - copied, changed from r56997, llvm/trunk/tools/llvmc2/CompilationGraph.cpp llvm/trunk/tools/llvmc2/src/Error.h - copied, changed from r56997, llvm/trunk/tools/llvmc2/Error.h llvm/trunk/tools/llvmc2/src/Makefile llvm/trunk/tools/llvmc2/src/Plugin.cpp - copied, changed from r56997, llvm/trunk/tools/llvmc2/Plugin.cpp llvm/trunk/tools/llvmc2/src/llvmc.cpp - copied, changed from r56997, llvm/trunk/tools/llvmc2/llvmc.cpp Removed: llvm/trunk/tools/llvmc2/Action.cpp llvm/trunk/tools/llvmc2/CompilationGraph.cpp llvm/trunk/tools/llvmc2/Error.h llvm/trunk/tools/llvmc2/Plugin.cpp llvm/trunk/tools/llvmc2/llvmc.cpp Modified: llvm/trunk/tools/llvmc2/Makefile llvm/trunk/tools/llvmc2/examples/Simple.td llvm/trunk/tools/llvmc2/plugins/Base/Base.td llvm/trunk/tools/llvmc2/plugins/Clang/Clang.td llvm/trunk/tools/llvmc2/plugins/Makefile.plugins Removed: llvm/trunk/tools/llvmc2/Action.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/Action.cpp?rev=56997&view=auto ============================================================================== --- llvm/trunk/tools/llvmc2/Action.cpp (original) +++ llvm/trunk/tools/llvmc2/Action.cpp (removed) @@ -1,78 +0,0 @@ -//===--- Action.cpp - The LLVM Compiler Driver ------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open -// Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// Action class - implementation and auxiliary functions. -// -//===----------------------------------------------------------------------===// - -#include "llvm/CompilerDriver/Action.h" - -#include "llvm/Support/CommandLine.h" -#include "llvm/System/Program.h" - -#include -#include - -using namespace llvm; -using namespace llvmc; - -extern cl::opt DryRun; -extern cl::opt VerboseMode; - -namespace { - int ExecuteProgram(const std::string& name, - const StrVector& args) { - sys::Path prog = sys::Program::FindProgramByName(name); - - if (prog.isEmpty()) - throw std::runtime_error("Can't find program '" + name + "'"); - if (!prog.canExecute()) - throw std::runtime_error("Program '" + name + "' is not executable."); - - // Build the command line vector and the redirects array. - const sys::Path* redirects[3] = {0,0,0}; - sys::Path stdout_redirect; - - std::vector argv; - argv.reserve((args.size()+2)); - argv.push_back(name.c_str()); - - for (StrVector::const_iterator B = args.begin(), E = args.end(); - B!=E; ++B) { - if (*B == ">") { - ++B; - stdout_redirect.set(*B); - redirects[1] = &stdout_redirect; - } - else { - argv.push_back((*B).c_str()); - } - } - argv.push_back(0); // null terminate list. - - // Invoke the program. - return sys::Program::ExecuteAndWait(prog, &argv[0], 0, &redirects[0]); - } - - void print_string (const std::string& str) { - std::cerr << str << ' '; - } -} - -int llvmc::Action::Execute() const { - if (DryRun || VerboseMode) { - std::cerr << Command_ << " "; - std::for_each(Args_.begin(), Args_.end(), print_string); - std::cerr << '\n'; - } - if (DryRun) - return 0; - else - return ExecuteProgram(Command_, Args_); -} Removed: llvm/trunk/tools/llvmc2/CompilationGraph.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/CompilationGraph.cpp?rev=56997&view=auto ============================================================================== --- llvm/trunk/tools/llvmc2/CompilationGraph.cpp (original) +++ llvm/trunk/tools/llvmc2/CompilationGraph.cpp (removed) @@ -1,442 +0,0 @@ -//===--- CompilationGraph.cpp - The LLVM Compiler Driver --------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open -// Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// Compilation graph - implementation. -// -//===----------------------------------------------------------------------===// - -#include "Error.h" -#include "llvm/CompilerDriver/CompilationGraph.h" - -#include "llvm/ADT/STLExtras.h" -#include "llvm/Support/CommandLine.h" -#include "llvm/Support/DOTGraphTraits.h" -#include "llvm/Support/GraphWriter.h" - -#include -#include -#include -#include -#include - -using namespace llvm; -using namespace llvmc; - -extern cl::list InputFilenames; -extern cl::opt OutputFilename; -extern cl::list Languages; - -namespace llvmc { - - const std::string& LanguageMap::GetLanguage(const sys::Path& File) const { - LanguageMap::const_iterator Lang = this->find(File.getSuffix()); - if (Lang == this->end()) - throw std::runtime_error("Unknown suffix: " + File.getSuffix()); - return Lang->second; - } -} - -namespace { - - /// ChooseEdge - Return the edge with the maximum weight. - template - const Edge* ChooseEdge(const C& EdgesContainer, - const InputLanguagesSet& InLangs, - const std::string& NodeName = "root") { - const Edge* MaxEdge = 0; - unsigned MaxWeight = 0; - bool SingleMax = true; - - for (typename C::const_iterator B = EdgesContainer.begin(), - E = EdgesContainer.end(); B != E; ++B) { - const Edge* e = B->getPtr(); - unsigned EW = e->Weight(InLangs); - if (EW > MaxWeight) { - MaxEdge = e; - MaxWeight = EW; - SingleMax = true; - } else if (EW == MaxWeight) { - SingleMax = false; - } - } - - if (!SingleMax) - throw std::runtime_error("Node " + NodeName + - ": multiple maximal outward edges found!" - " Most probably a specification error."); - if (!MaxEdge) - throw std::runtime_error("Node " + NodeName + - ": no maximal outward edge found!" - " Most probably a specification error."); - return MaxEdge; - } - -} - -CompilationGraph::CompilationGraph() { - NodesMap["root"] = Node(this); -} - -Node& CompilationGraph::getNode(const std::string& ToolName) { - nodes_map_type::iterator I = NodesMap.find(ToolName); - if (I == NodesMap.end()) - throw std::runtime_error("Node " + ToolName + " is not in the graph"); - return I->second; -} - -const Node& CompilationGraph::getNode(const std::string& ToolName) const { - nodes_map_type::const_iterator I = NodesMap.find(ToolName); - if (I == NodesMap.end()) - throw std::runtime_error("Node " + ToolName + " is not in the graph!"); - return I->second; -} - -// Find the tools list corresponding to the given language name. -const CompilationGraph::tools_vector_type& -CompilationGraph::getToolsVector(const std::string& LangName) const -{ - tools_map_type::const_iterator I = ToolsMap.find(LangName); - if (I == ToolsMap.end()) - throw std::runtime_error("No tool corresponding to the language " - + LangName + " found"); - return I->second; -} - -void CompilationGraph::insertNode(Tool* V) { - if (NodesMap.count(V->Name()) == 0) { - Node N; - N.OwningGraph = this; - N.ToolPtr = V; - NodesMap[V->Name()] = N; - } -} - -void CompilationGraph::insertEdge(const std::string& A, Edge* Edg) { - Node& B = getNode(Edg->ToolName()); - if (A == "root") { - const char** InLangs = B.ToolPtr->InputLanguages(); - for (;*InLangs; ++InLangs) - ToolsMap[*InLangs].push_back(IntrusiveRefCntPtr(Edg)); - NodesMap["root"].AddEdge(Edg); - } - else { - Node& N = getNode(A); - N.AddEdge(Edg); - } - // Increase the inward edge counter. - B.IncrInEdges(); -} - -namespace { - sys::Path MakeTempFile(const sys::Path& TempDir, const std::string& BaseName, - const std::string& Suffix) { - sys::Path Out; - - // Make sure we don't end up with path names like '/file.o' if the - // TempDir is empty. - if (TempDir.empty()) { - Out.set(BaseName); - } - else { - Out = TempDir; - Out.appendComponent(BaseName); - } - Out.appendSuffix(Suffix); - // NOTE: makeUnique always *creates* a unique temporary file, - // which is good, since there will be no races. However, some - // tools do not like it when the output file already exists, so - // they have to be placated with -f or something like that. - Out.makeUnique(true, NULL); - return Out; - } -} - -// Pass input file through the chain until we bump into a Join node or -// a node that says that it is the last. -void CompilationGraph::PassThroughGraph (const sys::Path& InFile, - const Node* StartNode, - const InputLanguagesSet& InLangs, - const sys::Path& TempDir, - const LanguageMap& LangMap) const { - bool Last = false; - sys::Path In = InFile; - const Node* CurNode = StartNode; - - while(!Last) { - sys::Path Out; - Tool* CurTool = CurNode->ToolPtr.getPtr(); - - if (CurTool->IsJoin()) { - JoinTool& JT = dynamic_cast(*CurTool); - JT.AddToJoinList(In); - break; - } - - // Since toolchains do not have to end with a Join node, we should - // check if this Node is the last. - if (!CurNode->HasChildren() || CurTool->IsLast()) { - if (!OutputFilename.empty()) { - Out.set(OutputFilename); - } - else { - Out.set(In.getBasename()); - Out.appendSuffix(CurTool->OutputSuffix()); - } - Last = true; - } - else { - Out = MakeTempFile(TempDir, In.getBasename(), CurTool->OutputSuffix()); - } - - if (int ret = CurTool->GenerateAction(In, Out, InLangs, LangMap).Execute()) - throw error_code(ret); - - if (Last) - return; - - CurNode = &getNode(ChooseEdge(CurNode->OutEdges, - InLangs, - CurNode->Name())->ToolName()); - In = Out; Out.clear(); - } -} - -// Find the head of the toolchain corresponding to the given file. -// Also, insert an input language into InLangs. -const Node* CompilationGraph:: -FindToolChain(const sys::Path& In, const std::string* ForceLanguage, - InputLanguagesSet& InLangs, const LanguageMap& LangMap) const { - - // Determine the input language. - const std::string& InLanguage = - ForceLanguage ? *ForceLanguage : LangMap.GetLanguage(In); - - // Add the current input language to the input language set. - InLangs.insert(InLanguage); - - // Find the toolchain for the input language. - const tools_vector_type& TV = getToolsVector(InLanguage); - if (TV.empty()) - throw std::runtime_error("No toolchain corresponding to language " - + InLanguage + " found"); - return &getNode(ChooseEdge(TV, InLangs)->ToolName()); -} - -// Helper function used by Build(). -// Traverses initial portions of the toolchains (up to the first Join node). -// This function is also responsible for handling the -x option. -void CompilationGraph::BuildInitial (InputLanguagesSet& InLangs, - const sys::Path& TempDir, - const LanguageMap& LangMap) { - // This is related to -x option handling. - cl::list::const_iterator xIter = Languages.begin(), - xBegin = xIter, xEnd = Languages.end(); - bool xEmpty = true; - const std::string* xLanguage = 0; - unsigned xPos = 0, xPosNext = 0, filePos = 0; - - if (xIter != xEnd) { - xEmpty = false; - xPos = Languages.getPosition(xIter - xBegin); - cl::list::const_iterator xNext = llvm::next(xIter); - xPosNext = (xNext == xEnd) ? std::numeric_limits::max() - : Languages.getPosition(xNext - xBegin); - xLanguage = (*xIter == "none") ? 0 : &(*xIter); - } - - // For each input file: - for (cl::list::const_iterator B = InputFilenames.begin(), - CB = B, E = InputFilenames.end(); B != E; ++B) { - sys::Path In = sys::Path(*B); - - // Code for handling the -x option. - // Output: std::string* xLanguage (can be NULL). - if (!xEmpty) { - filePos = InputFilenames.getPosition(B - CB); - - if (xPos < filePos) { - if (filePos < xPosNext) { - xLanguage = (*xIter == "none") ? 0 : &(*xIter); - } - else { // filePos >= xPosNext - // Skip xIters while filePos > xPosNext - while (filePos > xPosNext) { - ++xIter; - xPos = xPosNext; - - cl::list::const_iterator xNext = llvm::next(xIter); - if (xNext == xEnd) - xPosNext = std::numeric_limits::max(); - else - xPosNext = Languages.getPosition(xNext - xBegin); - xLanguage = (*xIter == "none") ? 0 : &(*xIter); - } - } - } - } - - // Find the toolchain corresponding to this file. - const Node* N = FindToolChain(In, xLanguage, InLangs, LangMap); - // Pass file through the chain starting at head. - PassThroughGraph(In, N, InLangs, TempDir, LangMap); - } -} - -// Sort the nodes in topological order. -void CompilationGraph::TopologicalSort(std::vector& Out) { - std::queue Q; - Q.push(&getNode("root")); - - while (!Q.empty()) { - const Node* A = Q.front(); - Q.pop(); - Out.push_back(A); - for (Node::const_iterator EB = A->EdgesBegin(), EE = A->EdgesEnd(); - EB != EE; ++EB) { - Node* B = &getNode((*EB)->ToolName()); - B->DecrInEdges(); - if (B->HasNoInEdges()) - Q.push(B); - } - } -} - -namespace { - bool NotJoinNode(const Node* N) { - return N->ToolPtr ? !N->ToolPtr->IsJoin() : true; - } -} - -// Call TopologicalSort and filter the resulting list to include -// only Join nodes. -void CompilationGraph:: -TopologicalSortFilterJoinNodes(std::vector& Out) { - std::vector TopSorted; - TopologicalSort(TopSorted); - std::remove_copy_if(TopSorted.begin(), TopSorted.end(), - std::back_inserter(Out), NotJoinNode); -} - -int CompilationGraph::Build (const sys::Path& TempDir, - const LanguageMap& LangMap) { - - InputLanguagesSet InLangs; - - // Traverse initial parts of the toolchains and fill in InLangs. - BuildInitial(InLangs, TempDir, LangMap); - - std::vector JTV; - TopologicalSortFilterJoinNodes(JTV); - - // For all join nodes in topological order: - for (std::vector::iterator B = JTV.begin(), E = JTV.end(); - B != E; ++B) { - - sys::Path Out; - const Node* CurNode = *B; - JoinTool* JT = &dynamic_cast(*CurNode->ToolPtr.getPtr()); - bool IsLast = false; - - // Are there any files in the join list? - if (JT->JoinListEmpty()) - continue; - - // Is this the last tool in the toolchain? - // NOTE: we can process several toolchains in parallel. - if (!CurNode->HasChildren() || JT->IsLast()) { - if (OutputFilename.empty()) { - Out.set("a"); - Out.appendSuffix(JT->OutputSuffix()); - } - else - Out.set(OutputFilename); - IsLast = true; - } - else { - Out = MakeTempFile(TempDir, "tmp", JT->OutputSuffix()); - } - - if (int ret = JT->GenerateAction(Out, InLangs, LangMap).Execute()) - throw error_code(ret); - - if (!IsLast) { - const Node* NextNode = - &getNode(ChooseEdge(CurNode->OutEdges, InLangs, - CurNode->Name())->ToolName()); - PassThroughGraph(Out, NextNode, InLangs, TempDir, LangMap); - } - } - - return 0; -} - -// Code related to graph visualization. - -namespace llvm { - template <> - struct DOTGraphTraits - : public DefaultDOTGraphTraits - { - - template - static std::string getNodeLabel(const Node* N, const GraphType&) - { - if (N->ToolPtr) - if (N->ToolPtr->IsJoin()) - return N->Name() + "\n (join" + - (N->HasChildren() ? ")" - : std::string(": ") + N->ToolPtr->OutputLanguage() + ')'); - else - return N->Name(); - else - return "root"; - } - - template - static std::string getEdgeSourceLabel(const Node* N, EdgeIter I) { - if (N->ToolPtr) { - return N->ToolPtr->OutputLanguage(); - } - else { - const char** InLangs = I->ToolPtr->InputLanguages(); - std::string ret; - - for (; *InLangs; ++InLangs) { - if (*(InLangs + 1)) { - ret += *InLangs; - ret += ", "; - } - else { - ret += *InLangs; - } - } - - return ret; - } - } - }; - -} - -void CompilationGraph::writeGraph() { - std::ofstream O("compilation-graph.dot"); - - if (O.good()) { - llvm::WriteGraph(this, "compilation-graph"); - O.close(); - } - else { - throw std::runtime_error("Error opening file 'compilation-graph.dot'" - " for writing!"); - } -} - -void CompilationGraph::viewGraph() { - llvm::ViewGraph(this, "compilation-graph"); -} Removed: llvm/trunk/tools/llvmc2/Error.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/Error.h?rev=56997&view=auto ============================================================================== --- llvm/trunk/tools/llvmc2/Error.h (original) +++ llvm/trunk/tools/llvmc2/Error.h (removed) @@ -1,33 +0,0 @@ -//===--- Error.h - The LLVM Compiler Driver ---------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open -// Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// Exception classes for LLVMC. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_TOOLS_LLVMC2_ERROR_H -#define LLVM_TOOLS_LLVMC2_ERROR_H - -#include - -namespace llvmc { - - class error_code: public std::runtime_error { - int Code_; - public: - error_code (int c) - : std::runtime_error("Tool returned error code"), Code_(c) - {} - - int code() const { return Code_; } - }; - -} - -#endif //LLVM_TOOLS_LLVMC2_ERROR_H Modified: llvm/trunk/tools/llvmc2/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/Makefile?rev=56998&r1=56997&r2=56998&view=diff ============================================================================== --- llvm/trunk/tools/llvmc2/Makefile (original) +++ llvm/trunk/tools/llvmc2/Makefile Fri Oct 3 04:09:34 2008 @@ -7,39 +7,14 @@ # ##===----------------------------------------------------------------------===## -# Compiled-in plugins -##### FIXME: This breaks the build. -#####BUILTIN_PLUGINS = Base - LEVEL = ../.. -TOOLNAME = llvmc2 -LINK_COMPONENTS = support system -REQUIRES_EH := 1 -ifneq ($(BUILTIN_PLUGINS),) +BUILTIN_PLUGINS = Base +DRIVER_NAME = llvmc2 +DIRS = $(patsubst %,plugins/%,$(BUILTIN_PLUGINS)) src +export BUILTIN_PLUGINS +export DRIVER_NAME export BUILTIN_LLVMC_PLUGIN=1 -USEDLIBS = $(patsubst %,LLVMC%,$(BUILTIN_PLUGINS)) - -endif include $(LEVEL)/Makefile.common - -TD_COMMON = $(wildcard $(LLVM_SRC_ROOT)/include/llvm/CompilerDriver/*.td) - -# There is probably a better way to do this: currently we enter the -# subdirectory 2 times - the second time is not needed. -# This probably also needs to be integrated into Makefile.rules. -define PLUGIN_template -PLUGIN_$(1)_SOURCES=$$(wildcard plugins/$(1)/*.cpp) -PLUGIN_$(1)_TD_SOURCES=$$(wildcard plugins/$(1)/*.cpp) - -$$(LibDir)/LLVMC$(1).o: $$(PLUGIN_$(1)_SOURCES) $$(PLUGIN_$(1)_TD_SOURCES) \ - $$(TD_COMMON) - @$$(MAKE) -C plugins/$(1) - -$$(RecursiveTargets) :: - @$$(MAKE) -C plugins/$(1) $$@ -endef - -$(foreach plugin,$(BUILTIN_PLUGINS),$(eval $(call PLUGIN_template,$(plugin)))) Removed: llvm/trunk/tools/llvmc2/Plugin.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/Plugin.cpp?rev=56997&view=auto ============================================================================== --- llvm/trunk/tools/llvmc2/Plugin.cpp (original) +++ llvm/trunk/tools/llvmc2/Plugin.cpp (removed) @@ -1,64 +0,0 @@ -//===--- Plugin.cpp - The LLVM Compiler Driver ------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open -// Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// Plugin support for llvmc2. -// -//===----------------------------------------------------------------------===// - -#include "llvm/CompilerDriver/Plugin.h" - -#include - -namespace { - - // Registry::Add<> does not do lifetime management (probably issues - // with static constructor/destructor ordering), so we have to - // implement it here. - // - // All this static registration/life-before-main model seems - // unnecessary convoluted to me. - - static bool pluginListInitialized = false; - typedef std::vector PluginList; - static PluginList Plugins; -} - -namespace llvmc { - - PluginLoader::PluginLoader() { - if (!pluginListInitialized) { - for (PluginRegistry::iterator B = PluginRegistry::begin(), - E = PluginRegistry::end(); B != E; ++B) - Plugins.push_back(B->instantiate()); - } - pluginListInitialized = true; - } - - PluginLoader::~PluginLoader() { - if (pluginListInitialized) { - for (PluginList::iterator B = Plugins.begin(), E = Plugins.end(); - B != E; ++B) - delete (*B); - } - pluginListInitialized = false; - } - - void PluginLoader::PopulateLanguageMap(LanguageMap& langMap) { - for (PluginList::iterator B = Plugins.begin(), E = Plugins.end(); - B != E; ++B) - (*B)->PopulateLanguageMap(langMap); - } - - void PluginLoader::PopulateCompilationGraph(CompilationGraph& graph) { - for (PluginList::iterator B = Plugins.begin(), E = Plugins.end(); - B != E; ++B) - (*B)->PopulateCompilationGraph(graph); - } - -} Modified: llvm/trunk/tools/llvmc2/examples/Simple.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/examples/Simple.td?rev=56998&r1=56997&r2=56998&view=diff ============================================================================== --- llvm/trunk/tools/llvmc2/examples/Simple.td (original) +++ llvm/trunk/tools/llvmc2/examples/Simple.td Fri Oct 3 04:09:34 2008 @@ -1,6 +1,6 @@ // A simple wrapper for gcc. // To compile, use this command: -// make TOOLNAME=llvmc_simple GRAPH=examples/Simple.td +// TOFIX include "Common.td" Removed: llvm/trunk/tools/llvmc2/llvmc.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/llvmc.cpp?rev=56997&view=auto ============================================================================== --- llvm/trunk/tools/llvmc2/llvmc.cpp (original) +++ llvm/trunk/tools/llvmc2/llvmc.cpp (removed) @@ -1,119 +0,0 @@ -//===--- llvmc.cpp - The LLVM Compiler Driver -------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open -// Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This tool provides a single point of access to the LLVM -// compilation tools. It has many options. To discover the options -// supported please refer to the tools' manual page or run the tool -// with the --help option. -// -//===----------------------------------------------------------------------===// - -#include "Error.h" - -#include "llvm/CompilerDriver/CompilationGraph.h" -#include "llvm/CompilerDriver/Plugin.h" - -#include "llvm/System/Path.h" -#include "llvm/Support/CommandLine.h" -#include "llvm/Support/PluginLoader.h" - -#include -#include -#include - -namespace cl = llvm::cl; -namespace sys = llvm::sys; -using namespace llvmc; - -// Built-in command-line options. -// External linkage here is intentional. - -cl::list InputFilenames(cl::Positional, cl::desc(""), - cl::ZeroOrMore); -cl::opt OutputFilename("o", cl::desc("Output file name"), - cl::value_desc("file")); -cl::list Languages("x", - cl::desc("Specify the language of the following input files"), - cl::ZeroOrMore); -cl::opt DryRun("dry-run", - cl::desc("Only pretend to run commands")); -cl::opt VerboseMode("v", - cl::desc("Enable verbose mode")); -cl::opt WriteGraph("write-graph", - cl::desc("Write compilation-graph.dot file"), - cl::Hidden); -cl::opt ViewGraph("view-graph", - cl::desc("Show compilation graph in GhostView"), - cl::Hidden); -cl::opt SaveTemps("save-temps", - cl::desc("Keep temporary files"), - cl::Hidden); - -namespace { - /// BuildTargets - A small wrapper for CompilationGraph::Build. - int BuildTargets(CompilationGraph& graph, const LanguageMap& langMap) { - int ret; - const sys::Path& tempDir = SaveTemps - ? sys::Path("") - : sys::Path(sys::Path::GetTemporaryDirectory()); - - try { - ret = graph.Build(tempDir, langMap); - } - catch(...) { - tempDir.eraseFromDisk(true); - throw; - } - - if (!SaveTemps) - tempDir.eraseFromDisk(true); - return ret; - } -} - -int main(int argc, char** argv) { - try { - LanguageMap langMap; - CompilationGraph graph; - - cl::ParseCommandLineOptions - (argc, argv, "LLVM Compiler Driver (Work In Progress)", true); - - PluginLoader Plugins; - Plugins.PopulateLanguageMap(langMap); - Plugins.PopulateCompilationGraph(graph); - - if (WriteGraph) { - graph.writeGraph(); - if (!ViewGraph) - return 0; - } - - if (ViewGraph) { - graph.viewGraph(); - return 0; - } - - if (InputFilenames.empty()) { - throw std::runtime_error("no input files"); - } - - return BuildTargets(graph, langMap); - } - catch(llvmc::error_code& ec) { - return ec.code(); - } - catch(const std::exception& ex) { - std::cerr << argv[0] << ": " << ex.what() << '\n'; - } - catch(...) { - std::cerr << argv[0] << ": unknown error!\n"; - } - return 1; -} Modified: llvm/trunk/tools/llvmc2/plugins/Base/Base.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/plugins/Base/Base.td?rev=56998&r1=56997&r2=56998&view=diff ============================================================================== --- llvm/trunk/tools/llvmc2/plugins/Base/Base.td (original) +++ llvm/trunk/tools/llvmc2/plugins/Base/Base.td Fri Oct 3 04:09:34 2008 @@ -1,4 +1,4 @@ -//===- Graph.td - LLVMC2 toolchain descriptions ------------*- tablegen -*-===// +//===- Base.td - LLVMC2 toolchain descriptions -------------*- tablegen -*-===// // // The LLVM Compiler Infrastructure // Modified: llvm/trunk/tools/llvmc2/plugins/Clang/Clang.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/plugins/Clang/Clang.td?rev=56998&r1=56997&r2=56998&view=diff ============================================================================== --- llvm/trunk/tools/llvmc2/plugins/Clang/Clang.td (original) +++ llvm/trunk/tools/llvmc2/plugins/Clang/Clang.td Fri Oct 3 04:09:34 2008 @@ -1,7 +1,7 @@ // A (first stab at a) replacement for the Clang's ccc script. // To compile, use this command: // cd $LLVMC2_DIR -// make TOOLNAME=ccc2 BUILTIN_PLUGINS=Clang +// make DRIVER_NAME=ccc2 BUILTIN_PLUGINS=Clang include "llvm/CompilerDriver/Common.td" Modified: llvm/trunk/tools/llvmc2/plugins/Makefile.plugins URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/plugins/Makefile.plugins?rev=56998&r1=56997&r2=56998&view=diff ============================================================================== --- llvm/trunk/tools/llvmc2/plugins/Makefile.plugins (original) +++ llvm/trunk/tools/llvmc2/plugins/Makefile.plugins Fri Oct 3 04:09:34 2008 @@ -1,4 +1,4 @@ -##===- tools/llvmc2/plugins/Makefile.common ----------------*- Makefile -*-===## +##===- tools/llvmc2/plugins/Makefile.plugins ----------------*- Makefile -*-===## # # The LLVM Compiler Infrastructure # @@ -28,6 +28,8 @@ include $(LEVEL)/Makefile.common +# TOFIX: This should go into Makefile.rules + ifdef BUILD_AUTOGENERATED_INC TD_COMMON = $(wildcard $(LLVM_SRC_ROOT)/include/llvm/CompilerDriver/*.td) Copied: llvm/trunk/tools/llvmc2/src/Action.cpp (from r56997, llvm/trunk/tools/llvmc2/Action.cpp) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/src/Action.cpp?p2=llvm/trunk/tools/llvmc2/src/Action.cpp&p1=llvm/trunk/tools/llvmc2/Action.cpp&r1=56997&r2=56998&rev=56998&view=diff ============================================================================== (empty) Copied: llvm/trunk/tools/llvmc2/src/CompilationGraph.cpp (from r56997, llvm/trunk/tools/llvmc2/CompilationGraph.cpp) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/src/CompilationGraph.cpp?p2=llvm/trunk/tools/llvmc2/src/CompilationGraph.cpp&p1=llvm/trunk/tools/llvmc2/CompilationGraph.cpp&r1=56997&r2=56998&rev=56998&view=diff ============================================================================== (empty) Copied: llvm/trunk/tools/llvmc2/src/Error.h (from r56997, llvm/trunk/tools/llvmc2/Error.h) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/src/Error.h?p2=llvm/trunk/tools/llvmc2/src/Error.h&p1=llvm/trunk/tools/llvmc2/Error.h&r1=56997&r2=56998&rev=56998&view=diff ============================================================================== (empty) Added: llvm/trunk/tools/llvmc2/src/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/src/Makefile?rev=56998&view=auto ============================================================================== --- llvm/trunk/tools/llvmc2/src/Makefile (added) +++ llvm/trunk/tools/llvmc2/src/Makefile Fri Oct 3 04:09:34 2008 @@ -0,0 +1,19 @@ +##===- tools/llvmc2/src/Makefile ---------------------------*- Makefile -*-===## +# +# The LLVM Compiler Infrastructure +# +# This file is distributed under the University of Illinois Open +# Source License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## + +LEVEL = ../../.. +TOOLNAME = $(DRIVER_NAME) +LINK_COMPONENTS = support system +REQUIRES_EH := 1 + +ifneq ($(BUILTIN_PLUGINS),) +USEDLIBS = $(patsubst %,LLVMC%,$(BUILTIN_PLUGINS)) +endif + +include $(LEVEL)/Makefile.common Copied: llvm/trunk/tools/llvmc2/src/Plugin.cpp (from r56997, llvm/trunk/tools/llvmc2/Plugin.cpp) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/src/Plugin.cpp?p2=llvm/trunk/tools/llvmc2/src/Plugin.cpp&p1=llvm/trunk/tools/llvmc2/Plugin.cpp&r1=56997&r2=56998&rev=56998&view=diff ============================================================================== (empty) Copied: llvm/trunk/tools/llvmc2/src/llvmc.cpp (from r56997, llvm/trunk/tools/llvmc2/llvmc.cpp) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/src/llvmc.cpp?p2=llvm/trunk/tools/llvmc2/src/llvmc.cpp&p1=llvm/trunk/tools/llvmc2/llvmc.cpp&r1=56997&r2=56998&rev=56998&view=diff ============================================================================== (empty) From nicolas.geoffray at lip6.fr Fri Oct 3 04:27:10 2008 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Fri, 03 Oct 2008 11:27:10 +0200 Subject: [llvm-commits] [llvm] r56963 - in /llvm/trunk: lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/Target/X86/X86ISelDAGToDAG.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86InstrInfo.td test/CodeGen/X86/2008-10-02-Atomics32-2.ll utils/TableGen/CodeGenInstruction.cpp In-Reply-To: <200810021853.m92Irlwg015711@zion.cs.uiuc.edu> References: <200810021853.m92Irlwg015711@zion.cs.uiuc.edu> Message-ID: <48E5E56E.6060402@lip6.fr> Hi Dale, Dale Johannesen wrote: > Author: johannes > Date: Thu Oct 2 13:53:47 2008 > New Revision: 56963 > > URL: http://llvm.org/viewvc/llvm-project?rev=56963&view=rev > Log: > Handle some 64-bit atomics on x86-32, some of the time. > > This patch makes the compilation of a function such as: define i64 @func(i64* %ptr, i64 %cmp, i64 %swap) nounwind { %A = call i64 @llvm.atomic.cmp.swap.i64.p0i64( i64* %ptr, i64 %cmp, i64 %swap) ret i64 %A } fail with the error message: llc: /home/varth/project/llvm-svn/llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1266: const llvm::SDValue& llvm::SDNode::getOperand(unsigned int) const: Assertion `Num < NumOperands && "Invalid child # of SDNode!"' failed. Was that intended? I'm not sure what was the code that llvm was generating before this patch, but I didn't have an assertion failure. Thanks! Nicolas > Added: > llvm/trunk/test/CodeGen/X86/2008-10-02-Atomics32-2.ll > Modified: > llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp > llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp > llvm/trunk/lib/Target/X86/X86ISelLowering.cpp > llvm/trunk/lib/Target/X86/X86ISelLowering.h > llvm/trunk/lib/Target/X86/X86InstrInfo.td > llvm/trunk/utils/TableGen/CodeGenInstruction.cpp > > Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=56963&r1=56962&r2=56963&view=diff > > ============================================================================== > --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) > +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Thu Oct 2 13:53:47 2008 > @@ -6212,21 +6212,26 @@ > break; > } > > - // FIXME: should the LOAD_BIN and SWAP atomics get here too? Probably. > - case ISD::ATOMIC_CMP_SWAP_8: > - case ISD::ATOMIC_CMP_SWAP_16: > - case ISD::ATOMIC_CMP_SWAP_32: > + case ISD::ATOMIC_LOAD_ADD_64: > + case ISD::ATOMIC_LOAD_SUB_64: > + case ISD::ATOMIC_LOAD_AND_64: > + case ISD::ATOMIC_LOAD_OR_64: > + case ISD::ATOMIC_LOAD_XOR_64: > + case ISD::ATOMIC_LOAD_NAND_64: > + case ISD::ATOMIC_SWAP_64: > case ISD::ATOMIC_CMP_SWAP_64: { > - SDValue Tmp = TLI.LowerOperation(Op, DAG); > - assert(Tmp.getNode() && "Node must be custom expanded!"); > - ExpandOp(Tmp.getValue(0), Lo, Hi); > - AddLegalizedOperand(SDValue(Node, 1), // Remember we legalized the chain. > - LegalizeOp(Tmp.getValue(1))); > + SDValue In2Lo, In2Hi, In2; > + ExpandOp(Op.getOperand(2), In2Lo, In2Hi); > + In2 = DAG.getNode(ISD::BUILD_PAIR, VT, In2Lo, In2Hi); > + SDValue Result = TLI.LowerOperation( > + DAG.getNode(Op.getOpcode(), VT, Op.getOperand(0), Op.getOperand(1), In2), > + DAG); > + ExpandOp(Result.getValue(0), Lo, Hi); > + // Remember that we legalized the chain. > + AddLegalizedOperand(SDValue(Node,1), LegalizeOp(Result.getValue(1))); > break; > } > > - > - > // These operators cannot be expanded directly, emit them as calls to > // library functions. > case ISD::FP_TO_SINT: { > > Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=56963&r1=56962&r2=56963&view=diff > > ============================================================================== > --- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original) > +++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Thu Oct 2 13:53:47 2008 > @@ -160,6 +160,7 @@ > > private: > SDNode *Select(SDValue N); > + SDNode *SelectAtomic64(SDNode *Node, unsigned Opc); > > bool MatchAddress(SDValue N, X86ISelAddressMode &AM, > bool isRoot = true, unsigned Depth = 0); > @@ -1205,6 +1206,25 @@ > MVT::i8, N0, SRIdx, N0.getValue(1)); > } > > +SDNode *X86DAGToDAGISel::SelectAtomic64(SDNode *Node, unsigned Opc) { > + SDValue Chain = Node->getOperand(0); > + SDValue In1 = Node->getOperand(1); > + SDValue In2L = Node->getOperand(2); > + SDValue In2H = Node->getOperand(3); > + SDValue Tmp0, Tmp1, Tmp2, Tmp3; > + if (!SelectAddr(In1, In1, Tmp0, Tmp1, Tmp2, Tmp3)) > + return NULL; > + AddToISelQueue(Tmp0); > + AddToISelQueue(Tmp1); > + AddToISelQueue(Tmp2); > + AddToISelQueue(Tmp3); > + AddToISelQueue(In2L); > + AddToISelQueue(In2H); > + AddToISelQueue(Chain); > + SDValue LSI = CurDAG->getMemOperand(cast(In1)->getMemOperand()); > + const SDValue Ops[] = { Tmp0, Tmp1, Tmp2, Tmp3, In2L, In2H, LSI, Chain }; > + return CurDAG->getTargetNode(Opc, MVT::i32, MVT::i32, MVT::Other, Ops, 8); > +} > > SDNode *X86DAGToDAGISel::Select(SDValue N) { > SDNode *Node = N.getNode(); > @@ -1277,6 +1297,19 @@ > break; > } > > + case X86ISD::ATOMOR64_DAG: > + return SelectAtomic64(Node, X86::ATOMOR6432); > + case X86ISD::ATOMXOR64_DAG: > + return SelectAtomic64(Node, X86::ATOMXOR6432); > + case X86ISD::ATOMADD64_DAG: > + return SelectAtomic64(Node, X86::ATOMADD6432); > + case X86ISD::ATOMSUB64_DAG: > + return SelectAtomic64(Node, X86::ATOMSUB6432); > + case X86ISD::ATOMNAND64_DAG: > + return SelectAtomic64(Node, X86::ATOMNAND6432); > + case X86ISD::ATOMAND64_DAG: > + return SelectAtomic64(Node, X86::ATOMAND6432); > + > case ISD::SMUL_LOHI: > case ISD::UMUL_LOHI: { > SDValue N0 = Node->getOperand(0); > > Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=56963&r1=56962&r2=56963&view=diff > > ============================================================================== > --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) > +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Thu Oct 2 13:53:47 2008 > @@ -302,6 +302,16 @@ > setOperationAction(ISD::ATOMIC_LOAD_SUB_32, MVT::i32, Custom); > setOperationAction(ISD::ATOMIC_LOAD_SUB_64, MVT::i64, Custom); > > + if (!Subtarget->is64Bit()) { > + setOperationAction(ISD::ATOMIC_LOAD_ADD_64, MVT::i64, Custom); > + setOperationAction(ISD::ATOMIC_LOAD_SUB_64, MVT::i64, Custom); > + setOperationAction(ISD::ATOMIC_LOAD_AND_64, MVT::i64, Custom); > + setOperationAction(ISD::ATOMIC_LOAD_OR_64, MVT::i64, Custom); > + setOperationAction(ISD::ATOMIC_LOAD_XOR_64, MVT::i64, Custom); > + setOperationAction(ISD::ATOMIC_LOAD_NAND_64, MVT::i64, Custom); > + setOperationAction(ISD::ATOMIC_SWAP_64, MVT::i64, Custom); > + } > + > // Use the default ISD::DBG_STOPPOINT, ISD::DECLARE expansion. > setOperationAction(ISD::DBG_STOPPOINT, MVT::Other, Expand); > // FIXME - use subtarget debug flags > @@ -6004,6 +6014,27 @@ > return DAG.getMergeValues(Vals, 2).getNode(); > } > > +SDValue X86TargetLowering::LowerATOMIC_BINARY_64(SDValue Op, > + SelectionDAG &DAG, > + unsigned NewOp) { > + SDNode *Node = Op.getNode(); > + MVT T = Node->getValueType(0); > + assert (T == MVT::i64 && "Only know how to expand i64 atomics"); > + > + SDValue Chain = Node->getOperand(0); > + SDValue In1 = Node->getOperand(1); > + assert(Node->getOperand(2).getNode()->getOpcode()==ISD::BUILD_PAIR); > + SDValue In2L = Node->getOperand(2).getNode()->getOperand(0); > + SDValue In2H = Node->getOperand(2).getNode()->getOperand(1); > + SDValue Ops[] = { Chain, In1, In2L, In2H }; > + SDVTList Tys = DAG.getVTList(MVT::i32, MVT::i32, MVT::Other); > + SDValue Result = DAG.getNode(NewOp, Tys, Ops, 4); > + SDValue OpsF[] = { Result.getValue(0), Result.getValue(1)}; > + SDValue ResultVal = DAG.getNode(ISD::BUILD_PAIR, MVT::i64, OpsF, 2); > + SDValue Vals[2] = { ResultVal, Result.getValue(2) }; > + return SDValue(DAG.getMergeValues(Vals, 2).getNode(), 0); > +} > + > SDValue X86TargetLowering::LowerLOAD_SUB(SDValue Op, SelectionDAG &DAG) { > SDNode *Node = Op.getNode(); > MVT T = Node->getValueType(0); > @@ -6027,14 +6058,27 @@ > SDValue X86TargetLowering::LowerOperation(SDValue Op, SelectionDAG &DAG) { > switch (Op.getOpcode()) { > default: assert(0 && "Should not custom lower this!"); > - case ISD::ATOMIC_CMP_SWAP_8: return LowerCMP_SWAP(Op,DAG); > - 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_8: > + case ISD::ATOMIC_CMP_SWAP_16: > + case ISD::ATOMIC_CMP_SWAP_32: > 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_8: > + case ISD::ATOMIC_LOAD_SUB_16: > case ISD::ATOMIC_LOAD_SUB_32: return LowerLOAD_SUB(Op,DAG); > - case ISD::ATOMIC_LOAD_SUB_64: return LowerLOAD_SUB(Op,DAG); > + case ISD::ATOMIC_LOAD_SUB_64: return (Subtarget->is64Bit()) ? > + LowerLOAD_SUB(Op,DAG) : > + LowerATOMIC_BINARY_64(Op,DAG, > + X86ISD::ATOMSUB64_DAG); > + case ISD::ATOMIC_LOAD_AND_64: return LowerATOMIC_BINARY_64(Op,DAG, > + X86ISD::ATOMAND64_DAG); > + case ISD::ATOMIC_LOAD_OR_64: return LowerATOMIC_BINARY_64(Op, DAG, > + X86ISD::ATOMOR64_DAG); > + case ISD::ATOMIC_LOAD_XOR_64: return LowerATOMIC_BINARY_64(Op,DAG, > + X86ISD::ATOMXOR64_DAG); > + case ISD::ATOMIC_LOAD_NAND_64: return LowerATOMIC_BINARY_64(Op,DAG, > + X86ISD::ATOMNAND64_DAG); > + case ISD::ATOMIC_LOAD_ADD_64: return LowerATOMIC_BINARY_64(Op,DAG, > + X86ISD::ATOMADD64_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); > @@ -6140,6 +6184,12 @@ > case X86ISD::FNSTCW16m: return "X86ISD::FNSTCW16m"; > case X86ISD::LCMPXCHG_DAG: return "X86ISD::LCMPXCHG_DAG"; > case X86ISD::LCMPXCHG8_DAG: return "X86ISD::LCMPXCHG8_DAG"; > + case X86ISD::ATOMADD64_DAG: return "X86ISD::ATOMADD64_DAG"; > + case X86ISD::ATOMSUB64_DAG: return "X86ISD::ATOMSUB64_DAG"; > + case X86ISD::ATOMOR64_DAG: return "X86ISD::ATOMOR64_DAG"; > + case X86ISD::ATOMXOR64_DAG: return "X86ISD::ATOMXOR64_DAG"; > + case X86ISD::ATOMAND64_DAG: return "X86ISD::ATOMAND64_DAG"; > + case X86ISD::ATOMNAND64_DAG: return "X86ISD::ATOMNAND64_DAG"; > case X86ISD::VZEXT_MOVL: return "X86ISD::VZEXT_MOVL"; > case X86ISD::VZEXT_LOAD: return "X86ISD::VZEXT_LOAD"; > case X86ISD::VSHL: return "X86ISD::VSHL"; > @@ -6367,6 +6417,146 @@ > > // private utility function > MachineBasicBlock * > +X86TargetLowering::EmitAtomicBit6432WithCustomInserter(MachineInstr *bInstr, > + MachineBasicBlock *MBB, > + unsigned regOpcL, > + unsigned regOpcH, > + unsigned immOpcL, > + unsigned immOpcH, > + bool invSrc) { > + // For the atomic bitwise operator, we generate > + // thisMBB (instructions are in pairs, except cmpxchg8b) > + // ld t1,t2 = [bitinstr.addr] > + // newMBB: > + // out1, out2 = phi (thisMBB, t1/t2) (newMBB, t3/t4) > + // op t5, t6 <- out1, out2, [bitinstr.val] > + // mov ECX, EBX <- t5, t6 > + // mov EAX, EDX <- t1, t2 > + // cmpxchg8b [bitinstr.addr] [EAX, EDX, EBX, ECX implicit] > + // mov t3, t4 <- EAX, EDX > + // bz newMBB > + // result in out1, out2 > + // fallthrough -->nextMBB > + > + const TargetRegisterClass *RC = X86::GR32RegisterClass; > + const unsigned LoadOpc = X86::MOV32rm; > + const unsigned copyOpc = X86::MOV32rr; > + const unsigned NotOpc = X86::NOT32r; > + const TargetInstrInfo *TII = getTargetMachine().getInstrInfo(); > + const BasicBlock *LLVM_BB = MBB->getBasicBlock(); > + MachineFunction::iterator MBBIter = MBB; > + ++MBBIter; > + > + /// First build the CFG > + MachineFunction *F = MBB->getParent(); > + MachineBasicBlock *thisMBB = MBB; > + MachineBasicBlock *newMBB = F->CreateMachineBasicBlock(LLVM_BB); > + MachineBasicBlock *nextMBB = F->CreateMachineBasicBlock(LLVM_BB); > + F->insert(MBBIter, newMBB); > + F->insert(MBBIter, nextMBB); > + > + // Move all successors to thisMBB to nextMBB > + nextMBB->transferSuccessors(thisMBB); > + > + // Update thisMBB to fall through to newMBB > + thisMBB->addSuccessor(newMBB); > + > + // newMBB jumps to itself and fall through to nextMBB > + newMBB->addSuccessor(nextMBB); > + newMBB->addSuccessor(newMBB); > + > + // Insert instructions into newMBB based on incoming instruction > + // There are 8 "real" operands plus 9 implicit def/uses, ignored here. > + assert(bInstr->getNumOperands() < 18 && "unexpected number of operands"); > + MachineOperand& dest1Oper = bInstr->getOperand(0); > + MachineOperand& dest2Oper = bInstr->getOperand(1); > + MachineOperand* argOpers[6]; > + for (int i=0; i < 6; ++i) > + argOpers[i] = &bInstr->getOperand(i+2); > + > + // x86 address has 4 operands: base, index, scale, and displacement > + int lastAddrIndx = 3; // [0,3] > + > + unsigned t1 = F->getRegInfo().createVirtualRegister(RC); > + MachineInstrBuilder MIB = BuildMI(thisMBB, TII->get(LoadOpc), t1); > + for (int i=0; i <= lastAddrIndx; ++i) > + (*MIB).addOperand(*argOpers[i]); > + unsigned t2 = F->getRegInfo().createVirtualRegister(RC); > + MIB = BuildMI(thisMBB, TII->get(LoadOpc), t2); > + // add 4 to displacement. getImm verifies it's immediate. > + for (int i=0; i <= lastAddrIndx-1; ++i) > + (*MIB).addOperand(*argOpers[i]); > + MachineOperand newOp3 = MachineOperand::CreateImm(argOpers[3]->getImm()+4); > + (*MIB).addOperand(newOp3); > + > + // t3/4 are defined later, at the bottom of the loop > + unsigned t3 = F->getRegInfo().createVirtualRegister(RC); > + unsigned t4 = F->getRegInfo().createVirtualRegister(RC); > + BuildMI(newMBB, TII->get(X86::PHI), dest1Oper.getReg()) > + .addReg(t1).addMBB(thisMBB).addReg(t3).addMBB(newMBB); > + BuildMI(newMBB, TII->get(X86::PHI), dest2Oper.getReg()) > + .addReg(t2).addMBB(thisMBB).addReg(t4).addMBB(newMBB); > + > + unsigned tt1 = F->getRegInfo().createVirtualRegister(RC); > + unsigned tt2 = F->getRegInfo().createVirtualRegister(RC); > + if (invSrc) { > + MIB = BuildMI(newMBB, TII->get(NotOpc), tt1).addReg(t1); > + MIB = BuildMI(newMBB, TII->get(NotOpc), tt2).addReg(t2); > + } else { > + tt1 = t1; > + tt2 = t2; > + } > + > + assert((argOpers[4]->isRegister() || argOpers[4]->isImmediate()) && > + "invalid operand"); > + unsigned t5 = F->getRegInfo().createVirtualRegister(RC); > + unsigned t6 = F->getRegInfo().createVirtualRegister(RC); > + if (argOpers[4]->isRegister()) > + MIB = BuildMI(newMBB, TII->get(regOpcL), t5); > + else > + MIB = BuildMI(newMBB, TII->get(immOpcL), t5); > + MIB.addReg(tt1); > + (*MIB).addOperand(*argOpers[4]); > + assert(argOpers[5]->isRegister() == argOpers[4]->isRegister()); > + assert(argOpers[5]->isImmediate() == argOpers[4]->isImmediate()); > + if (argOpers[5]->isRegister()) > + MIB = BuildMI(newMBB, TII->get(regOpcH), t6); > + else > + MIB = BuildMI(newMBB, TII->get(immOpcH), t6); > + MIB.addReg(tt2); > + (*MIB).addOperand(*argOpers[5]); > + > + MIB = BuildMI(newMBB, TII->get(copyOpc), X86::EAX); > + MIB.addReg(t1); > + MIB = BuildMI(newMBB, TII->get(copyOpc), X86::EDX); > + MIB.addReg(t2); > + > + MIB = BuildMI(newMBB, TII->get(copyOpc), X86::EBX); > + MIB.addReg(t5); > + MIB = BuildMI(newMBB, TII->get(copyOpc), X86::ECX); > + MIB.addReg(t6); > + > + MIB = BuildMI(newMBB, TII->get(X86::LCMPXCHG8B)); > + for (int i=0; i <= lastAddrIndx; ++i) > + (*MIB).addOperand(*argOpers[i]); > + > + assert(bInstr->hasOneMemOperand() && "Unexpected number of memoperand"); > + (*MIB).addMemOperand(*F, *bInstr->memoperands_begin()); > + > + MIB = BuildMI(newMBB, TII->get(copyOpc), t3); > + MIB.addReg(X86::EAX); > + MIB = BuildMI(newMBB, TII->get(copyOpc), t4); > + MIB.addReg(X86::EDX); > + > + // insert branch > + BuildMI(newMBB, TII->get(X86::JNE)).addMBB(newMBB); > + > + F->DeleteMachineInstr(bInstr); // The pseudo instruction is gone now. > + return nextMBB; > +} > + > +// private utility function > +MachineBasicBlock * > X86TargetLowering::EmitAtomicMinMaxWithCustomInserter(MachineInstr *mInstr, > MachineBasicBlock *MBB, > unsigned cmovOpc) { > @@ -6695,6 +6885,7 @@ > X86::NOT8r, X86::AL, > X86::GR8RegisterClass, true); > // FIXME: There are no CMOV8 instructions; MIN/MAX need some other way. > + // This group is for 64-bit host. > case X86::ATOMAND64: > return EmitAtomicBitwiseWithCustomInserter(MI, BB, X86::AND64rr, > X86::AND64ri32, X86::MOV64rm, > @@ -6727,6 +6918,40 @@ > return EmitAtomicMinMaxWithCustomInserter(MI, BB, X86::CMOVB64rr); > case X86::ATOMUMAX64: > return EmitAtomicMinMaxWithCustomInserter(MI, BB, X86::CMOVA64rr); > + > + // This group does 64-bit operations on a 32-bit host. > + case X86::ATOMAND6432: > + return EmitAtomicBit6432WithCustomInserter(MI, BB, > + X86::AND32rr, X86::AND32rr, > + X86::AND32ri, X86::AND32ri, > + false); > + case X86::ATOMOR6432: > + return EmitAtomicBit6432WithCustomInserter(MI, BB, > + X86::OR32rr, X86::OR32rr, > + X86::OR32ri, X86::OR32ri, > + false); > + case X86::ATOMXOR6432: > + return EmitAtomicBit6432WithCustomInserter(MI, BB, > + X86::XOR32rr, X86::XOR32rr, > + X86::XOR32ri, X86::XOR32ri, > + false); > + case X86::ATOMNAND6432: > + return EmitAtomicBit6432WithCustomInserter(MI, BB, > + X86::AND32rr, X86::AND32rr, > + X86::AND32ri, X86::AND32ri, > + true); > + // FIXME carry > + case X86::ATOMADD6432: > + return EmitAtomicBit6432WithCustomInserter(MI, BB, > + X86::ADD32rr, X86::ADC32rr, > + X86::ADD32ri, X86::ADC32ri, > + false); > + // FIXME carry > + case X86::ATOMSUB6432: > + return EmitAtomicBit6432WithCustomInserter(MI, BB, > + X86::SUB32rr, X86::SBB32rr, > + X86::SUB32ri, X86::SBB32ri, > + false); > } > } > > > Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.h?rev=56963&r1=56962&r2=56963&view=diff > > ============================================================================== > --- llvm/trunk/lib/Target/X86/X86ISelLowering.h (original) > +++ llvm/trunk/lib/Target/X86/X86ISelLowering.h Thu Oct 2 13:53:47 2008 > @@ -199,6 +199,15 @@ > LCMPXCHG_DAG, > LCMPXCHG8_DAG, > > + // ATOMADD64_DAG, ATOMSUB64_DAG, ATOMOR64_DAG, ATOMAND64_DAG, > + // ATOMXOR64_DAG, ATOMNAND64_DAG - Atomic 64-bit binary operations. > + ATOMADD64_DAG, > + ATOMSUB64_DAG, > + ATOMOR64_DAG, > + ATOMXOR64_DAG, > + ATOMAND64_DAG, > + ATOMNAND64_DAG, > + > // FNSTCW16m - Store FP control world into i16 memory. > FNSTCW16m, > > @@ -570,6 +579,8 @@ > SDValue LowerCTTZ(SDValue Op, SelectionDAG &DAG); > SDValue LowerCMP_SWAP(SDValue Op, SelectionDAG &DAG); > SDValue LowerLOAD_SUB(SDValue Op, SelectionDAG &DAG); > + SDValue LowerATOMIC_BINARY_64(SDValue Op, SelectionDAG &DAG, > + unsigned NewOp); > SDNode *ExpandFP_TO_SINT(SDNode *N, SelectionDAG &DAG); > SDNode *ExpandREADCYCLECOUNTER(SDNode *N, SelectionDAG &DAG); > SDNode *ExpandATOMIC_CMP_SWAP(SDNode *N, SelectionDAG &DAG); > @@ -602,6 +613,15 @@ > unsigned EAXreg, > TargetRegisterClass *RC, > bool invSrc = false); > + > + MachineBasicBlock *EmitAtomicBit6432WithCustomInserter( > + MachineInstr *BInstr, > + MachineBasicBlock *BB, > + unsigned regOpcL, > + unsigned regOpcH, > + unsigned immOpcL, > + unsigned immOpcH, > + bool invSrc = false); > > /// Utility function to emit atomic min and max. It takes the min/max > // instruction to expand, the associated basic block, and the associated > > Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=56963&r1=56962&r2=56963&view=diff > > ============================================================================== > --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original) > +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Thu Oct 2 13:53:47 2008 > @@ -39,6 +39,8 @@ > SDTCisVT<2, i8>]>; > def SDTX86cas8 : SDTypeProfile<0, 1, [SDTCisPtrTy<0>]>; > > +def SDTX86atomicBinary : SDTypeProfile<2, 3, [SDTCisInt<0>, SDTCisInt<1>, > + SDTCisPtrTy<2>, SDTCisInt<3>,SDTCisInt<4>]>; > def SDTX86Ret : SDTypeProfile<0, -1, [SDTCisVT<0, i16>]>; > > def SDT_X86CallSeqStart : SDCallSeqStart<[ SDTCisVT<0, i32> ]>; > @@ -79,7 +81,24 @@ > def X86cas8 : SDNode<"X86ISD::LCMPXCHG8_DAG", SDTX86cas8, > [SDNPHasChain, SDNPInFlag, SDNPOutFlag, SDNPMayStore, > SDNPMayLoad]>; > - > +def X86AtomAdd64 : SDNode<"X86ISD::ATOMADD64_DAG", SDTX86atomicBinary, > + [SDNPHasChain, SDNPMayStore, > + SDNPMayLoad, SDNPMemOperand]>; > +def X86AtomSub64 : SDNode<"X86ISD::ATOMSUB64_DAG", SDTX86atomicBinary, > + [SDNPHasChain, SDNPMayStore, > + SDNPMayLoad, SDNPMemOperand]>; > +def X86AtomOr64 : SDNode<"X86ISD::ATOMOR64_DAG", SDTX86atomicBinary, > + [SDNPHasChain, SDNPMayStore, > + SDNPMayLoad, SDNPMemOperand]>; > +def X86AtomXor64 : SDNode<"X86ISD::ATOMXOR64_DAG", SDTX86atomicBinary, > + [SDNPHasChain, SDNPMayStore, > + SDNPMayLoad, SDNPMemOperand]>; > +def X86AtomAnd64 : SDNode<"X86ISD::ATOMAND64_DAG", SDTX86atomicBinary, > + [SDNPHasChain, SDNPMayStore, > + SDNPMayLoad, SDNPMemOperand]>; > +def X86AtomNand64 : SDNode<"X86ISD::ATOMNAND64_DAG", SDTX86atomicBinary, > + [SDNPHasChain, SDNPMayStore, > + SDNPMayLoad, SDNPMemOperand]>; > def X86retflag : SDNode<"X86ISD::RET_FLAG", SDTX86Ret, > [SDNPHasChain, SDNPOptInFlag]>; > > @@ -2630,7 +2649,7 @@ > "lock\n\tcmpxchg{l}\t{$swap, $ptr|$ptr, $swap}", > [(X86cas addr:$ptr, GR32:$swap, 4)]>, TB, LOCK; > } > -let Defs = [EAX, EBX, ECX, EDX, EFLAGS], Uses = [EAX, EBX, ECX, EDX] in { > +let Defs = [EAX, EDX, EFLAGS], Uses = [EAX, EBX, ECX, EDX] in { > def LCMPXCHG8B : I<0xC7, MRM1m, (outs), (ins i32mem:$ptr), > "lock\n\tcmpxchg8b\t$ptr", > [(X86cas8 addr:$ptr)]>, TB, LOCK; > @@ -2730,6 +2749,30 @@ > [(set GR8:$dst, (atomic_load_nand_8 addr:$ptr, GR8:$val))]>; > } > > +let Constraints = "$val1 = $dst1, $val2 = $dst2", > + Defs = [EFLAGS, EAX, EBX, ECX, EDX], > + Uses = [EAX, EBX, ECX, EDX], > + usesCustomDAGSchedInserter = 1 in { > +def ATOMAND6432 : I<0, Pseudo, (outs GR32:$dst1, GR32:$dst2), > + (ins i64mem:$ptr, GR32:$val1, GR32:$val2), > + "#ATOMAND6432 PSUEDO!", []>; > +def ATOMOR6432 : I<0, Pseudo, (outs GR32:$dst1, GR32:$dst2), > + (ins i64mem:$ptr, GR32:$val1, GR32:$val2), > + "#ATOMOR6432 PSUEDO!", []>; > +def ATOMXOR6432 : I<0, Pseudo, (outs GR32:$dst1, GR32:$dst2), > + (ins i64mem:$ptr, GR32:$val1, GR32:$val2), > + "#ATOMXOR6432 PSUEDO!", []>; > +def ATOMNAND6432 : I<0, Pseudo, (outs GR32:$dst1, GR32:$dst2), > + (ins i64mem:$ptr, GR32:$val1, GR32:$val2), > + "#ATOMNAND6432 PSUEDO!", []>; > +def ATOMADD6432 : I<0, Pseudo, (outs GR32:$dst1, GR32:$dst2), > + (ins i64mem:$ptr, GR32:$val1, GR32:$val2), > + "#ATOMADD6432 PSUEDO!", []>; > +def ATOMSUB6432 : I<0, Pseudo, (outs GR32:$dst1, GR32:$dst2), > + (ins i64mem:$ptr, GR32:$val1, GR32:$val2), > + "#ATOMSUB6432 PSUEDO!", []>; > +} > + > //===----------------------------------------------------------------------===// > // Non-Instruction Patterns > //===----------------------------------------------------------------------===// > > Added: llvm/trunk/test/CodeGen/X86/2008-10-02-Atomics32-2.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2008-10-02-Atomics32-2.ll?rev=56963&view=auto > > ============================================================================== > --- llvm/trunk/test/CodeGen/X86/2008-10-02-Atomics32-2.ll (added) > +++ llvm/trunk/test/CodeGen/X86/2008-10-02-Atomics32-2.ll Thu Oct 2 13:53:47 2008 > @@ -0,0 +1,969 @@ > +; RUN: llvm-as < %s | llc -march=x86 > +;; This version includes 64-bit version of binary operators (in 32-bit mode). > +;; Swap, cmp-and-swap not supported yet in this mode. > +; ModuleID = 'Atomics.c' > +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-darwin8" > + at sc = common global i8 0 ; [#uses=52] > + at uc = common global i8 0 ; [#uses=112] > + at ss = common global i16 0 ; [#uses=15] > + at us = common global i16 0 ; [#uses=15] > + at si = common global i32 0 ; [#uses=15] > + at ui = common global i32 0 ; [#uses=23] > + at sl = common global i32 0 ; [#uses=15] > + at ul = common global i32 0 ; [#uses=15] > + at sll = common global i64 0, align 8 ; [#uses=13] > + at ull = common global i64 0, align 8 ; [#uses=13] > + > +define void @test_op_ignore() nounwind { > +entry: > + %0 = call i8 @llvm.atomic.load.add.i8.p0i8(i8* @sc, i8 1) ; [#uses=0] > + %1 = call i8 @llvm.atomic.load.add.i8.p0i8(i8* @uc, i8 1) ; [#uses=0] > + %2 = bitcast i8* bitcast (i16* @ss to i8*) to i16* ; [#uses=1] > + %3 = call i16 @llvm.atomic.load.add.i16.p0i16(i16* %2, i16 1) ; [#uses=0] > + %4 = bitcast i8* bitcast (i16* @us to i8*) to i16* ; [#uses=1] > + %5 = call i16 @llvm.atomic.load.add.i16.p0i16(i16* %4, i16 1) ; [#uses=0] > + %6 = bitcast i8* bitcast (i32* @si to i8*) to i32* ; [#uses=1] > + %7 = call i32 @llvm.atomic.load.add.i32.p0i32(i32* %6, i32 1) ; [#uses=0] > + %8 = bitcast i8* bitcast (i32* @ui to i8*) to i32* ; [#uses=1] > + %9 = call i32 @llvm.atomic.load.add.i32.p0i32(i32* %8, i32 1) ; [#uses=0] > + %10 = bitcast i8* bitcast (i32* @sl to i8*) to i32* ; [#uses=1] > + %11 = call i32 @llvm.atomic.load.add.i32.p0i32(i32* %10, i32 1) ; [#uses=0] > + %12 = bitcast i8* bitcast (i32* @ul to i8*) to i32* ; [#uses=1] > + %13 = call i32 @llvm.atomic.load.add.i32.p0i32(i32* %12, i32 1) ; [#uses=0] > + %14 = bitcast i8* bitcast (i64* @sll to i8*) to i64* ; [#uses=1] > + %15 = call i64 @llvm.atomic.load.add.i64.p0i64(i64* %14, i64 1) ; [#uses=0] > + %16 = bitcast i8* bitcast (i64* @ull to i8*) to i64* ; [#uses=1] > + %17 = call i64 @llvm.atomic.load.add.i64.p0i64(i64* %16, i64 1) ; [#uses=0] > + %18 = call i8 @llvm.atomic.load.sub.i8.p0i8(i8* @sc, i8 1) ; [#uses=0] > + %19 = call i8 @llvm.atomic.load.sub.i8.p0i8(i8* @uc, i8 1) ; [#uses=0] > + %20 = bitcast i8* bitcast (i16* @ss to i8*) to i16* ; [#uses=1] > + %21 = call i16 @llvm.atomic.load.sub.i16.p0i16(i16* %20, i16 1) ; [#uses=0] > + %22 = bitcast i8* bitcast (i16* @us to i8*) to i16* ; [#uses=1] > + %23 = call i16 @llvm.atomic.load.sub.i16.p0i16(i16* %22, i16 1) ; [#uses=0] > + %24 = bitcast i8* bitcast (i32* @si to i8*) to i32* ; [#uses=1] > + %25 = call i32 @llvm.atomic.load.sub.i32.p0i32(i32* %24, i32 1) ; [#uses=0] > + %26 = bitcast i8* bitcast (i32* @ui to i8*) to i32* ; [#uses=1] > + %27 = call i32 @llvm.atomic.load.sub.i32.p0i32(i32* %26, i32 1) ; [#uses=0] > + %28 = bitcast i8* bitcast (i32* @sl to i8*) to i32* ; [#uses=1] > + %29 = call i32 @llvm.atomic.load.sub.i32.p0i32(i32* %28, i32 1) ; [#uses=0] > + %30 = bitcast i8* bitcast (i32* @ul to i8*) to i32* ; [#uses=1] > + %31 = call i32 @llvm.atomic.load.sub.i32.p0i32(i32* %30, i32 1) ; [#uses=0] > + %32 = bitcast i8* bitcast (i64* @sll to i8*) to i64* ; [#uses=1] > + %33 = call i64 @llvm.atomic.load.sub.i64.p0i64(i64* %32, i64 1) ; [#uses=0] > + %34 = bitcast i8* bitcast (i64* @ull to i8*) to i64* ; [#uses=1] > + %35 = call i64 @llvm.atomic.load.sub.i64.p0i64(i64* %34, i64 1) ; [#uses=0] > + %36 = call i8 @llvm.atomic.load.or.i8.p0i8(i8* @sc, i8 1) ; [#uses=0] > + %37 = call i8 @llvm.atomic.load.or.i8.p0i8(i8* @uc, i8 1) ; [#uses=0] > + %38 = bitcast i8* bitcast (i16* @ss to i8*) to i16* ; [#uses=1] > + %39 = call i16 @llvm.atomic.load.or.i16.p0i16(i16* %38, i16 1) ; [#uses=0] > + %40 = bitcast i8* bitcast (i16* @us to i8*) to i16* ; [#uses=1] > + %41 = call i16 @llvm.atomic.load.or.i16.p0i16(i16* %40, i16 1) ; [#uses=0] > + %42 = bitcast i8* bitcast (i32* @si to i8*) to i32* ; [#uses=1] > + %43 = call i32 @llvm.atomic.load.or.i32.p0i32(i32* %42, i32 1) ; [#uses=0] > + %44 = bitcast i8* bitcast (i32* @ui to i8*) to i32* ; [#uses=1] > + %45 = call i32 @llvm.atomic.load.or.i32.p0i32(i32* %44, i32 1) ; [#uses=0] > + %46 = bitcast i8* bitcast (i32* @sl to i8*) to i32* ; [#uses=1] > + %47 = call i32 @llvm.atomic.load.or.i32.p0i32(i32* %46, i32 1) ; [#uses=0] > + %48 = bitcast i8* bitcast (i32* @ul to i8*) to i32* ; [#uses=1] > + %49 = call i32 @llvm.atomic.load.or.i32.p0i32(i32* %48, i32 1) ; [#uses=0] > + %50 = bitcast i8* bitcast (i64* @sll to i8*) to i64* ; [#uses=1] > + %51 = call i64 @llvm.atomic.load.or.i64.p0i64(i64* %50, i64 1) ; [#uses=0] > + %52 = bitcast i8* bitcast (i64* @ull to i8*) to i64* ; [#uses=1] > + %53 = call i64 @llvm.atomic.load.or.i64.p0i64(i64* %52, i64 1) ; [#uses=0] > + %54 = call i8 @llvm.atomic.load.xor.i8.p0i8(i8* @sc, i8 1) ; [#uses=0] > + %55 = call i8 @llvm.atomic.load.xor.i8.p0i8(i8* @uc, i8 1) ; [#uses=0] > + %56 = bitcast i8* bitcast (i16* @ss to i8*) to i16* ; [#uses=1] > + %57 = call i16 @llvm.atomic.load.xor.i16.p0i16(i16* %56, i16 1) ; [#uses=0] > + %58 = bitcast i8* bitcast (i16* @us to i8*) to i16* ; [#uses=1] > + %59 = call i16 @llvm.atomic.load.xor.i16.p0i16(i16* %58, i16 1) ; [#uses=0] > + %60 = bitcast i8* bitcast (i32* @si to i8*) to i32* ; [#uses=1] > + %61 = call i32 @llvm.atomic.load.xor.i32.p0i32(i32* %60, i32 1) ; [#uses=0] > + %62 = bitcast i8* bitcast (i32* @ui to i8*) to i32* ; [#uses=1] > + %63 = call i32 @llvm.atomic.load.xor.i32.p0i32(i32* %62, i32 1) ; [#uses=0] > + %64 = bitcast i8* bitcast (i32* @sl to i8*) to i32* ; [#uses=1] > + %65 = call i32 @llvm.atomic.load.xor.i32.p0i32(i32* %64, i32 1) ; [#uses=0] > + %66 = bitcast i8* bitcast (i32* @ul to i8*) to i32* ; [#uses=1] > + %67 = call i32 @llvm.atomic.load.xor.i32.p0i32(i32* %66, i32 1) ; [#uses=0] > + %68 = bitcast i8* bitcast (i64* @sll to i8*) to i64* ; [#uses=1] > + %69 = call i64 @llvm.atomic.load.xor.i64.p0i64(i64* %68, i64 1) ; [#uses=0] > + %70 = bitcast i8* bitcast (i64* @ull to i8*) to i64* ; [#uses=1] > + %71 = call i64 @llvm.atomic.load.xor.i64.p0i64(i64* %70, i64 1) ; [#uses=0] > + %72 = call i8 @llvm.atomic.load.and.i8.p0i8(i8* @sc, i8 1) ; [#uses=0] > + %73 = call i8 @llvm.atomic.load.and.i8.p0i8(i8* @uc, i8 1) ; [#uses=0] > + %74 = bitcast i8* bitcast (i16* @ss to i8*) to i16* ; [#uses=1] > + %75 = call i16 @llvm.atomic.load.and.i16.p0i16(i16* %74, i16 1) ; [#uses=0] > + %76 = bitcast i8* bitcast (i16* @us to i8*) to i16* ; [#uses=1] > + %77 = call i16 @llvm.atomic.load.and.i16.p0i16(i16* %76, i16 1) ; [#uses=0] > + %78 = bitcast i8* bitcast (i32* @si to i8*) to i32* ; [#uses=1] > + %79 = call i32 @llvm.atomic.load.and.i32.p0i32(i32* %78, i32 1) ; [#uses=0] > + %80 = bitcast i8* bitcast (i32* @ui to i8*) to i32* ; [#uses=1] > + %81 = call i32 @llvm.atomic.load.and.i32.p0i32(i32* %80, i32 1) ; [#uses=0] > + %82 = bitcast i8* bitcast (i32* @sl to i8*) to i32* ; [#uses=1] > + %83 = call i32 @llvm.atomic.load.and.i32.p0i32(i32* %82, i32 1) ; [#uses=0] > + %84 = bitcast i8* bitcast (i32* @ul to i8*) to i32* ; [#uses=1] > + %85 = call i32 @llvm.atomic.load.and.i32.p0i32(i32* %84, i32 1) ; [#uses=0] > + %86 = bitcast i8* bitcast (i64* @sll to i8*) to i64* ; [#uses=1] > + %87 = call i64 @llvm.atomic.load.and.i64.p0i64(i64* %86, i64 1) ; [#uses=0] > + %88 = bitcast i8* bitcast (i64* @ull to i8*) to i64* ; [#uses=1] > + %89 = call i64 @llvm.atomic.load.and.i64.p0i64(i64* %88, i64 1) ; [#uses=0] > + %90 = call i8 @llvm.atomic.load.nand.i8.p0i8(i8* @sc, i8 1) ; [#uses=0] > + %91 = call i8 @llvm.atomic.load.nand.i8.p0i8(i8* @uc, i8 1) ; [#uses=0] > + %92 = bitcast i8* bitcast (i16* @ss to i8*) to i16* ; [#uses=1] > + %93 = call i16 @llvm.atomic.load.nand.i16.p0i16(i16* %92, i16 1) ; [#uses=0] > + %94 = bitcast i8* bitcast (i16* @us to i8*) to i16* ; [#uses=1] > + %95 = call i16 @llvm.atomic.load.nand.i16.p0i16(i16* %94, i16 1) ; [#uses=0] > + %96 = bitcast i8* bitcast (i32* @si to i8*) to i32* ; [#uses=1] > + %97 = call i32 @llvm.atomic.load.nand.i32.p0i32(i32* %96, i32 1) ; [#uses=0] > + %98 = bitcast i8* bitcast (i32* @ui to i8*) to i32* ; [#uses=1] > + %99 = call i32 @llvm.atomic.load.nand.i32.p0i32(i32* %98, i32 1) ; [#uses=0] > + %100 = bitcast i8* bitcast (i32* @sl to i8*) to i32* ; [#uses=1] > + %101 = call i32 @llvm.atomic.load.nand.i32.p0i32(i32* %100, i32 1) ; [#uses=0] > + %102 = bitcast i8* bitcast (i32* @ul to i8*) to i32* ; [#uses=1] > + %103 = call i32 @llvm.atomic.load.nand.i32.p0i32(i32* %102, i32 1) ; [#uses=0] > + %104 = bitcast i8* bitcast (i64* @sll to i8*) to i64* ; [#uses=1] > + %105 = call i64 @llvm.atomic.load.nand.i64.p0i64(i64* %104, i64 1) ; [#uses=0] > + %106 = bitcast i8* bitcast (i64* @ull to i8*) to i64* ; [#uses=1] > + %107 = call i64 @llvm.atomic.load.nand.i64.p0i64(i64* %106, i64 1) ; [#uses=0] > + br label %return > + > +return: ; preds = %entry > + ret void > +} > + > +declare i8 @llvm.atomic.load.add.i8.p0i8(i8*, i8) nounwind > + > +declare i16 @llvm.atomic.load.add.i16.p0i16(i16*, i16) nounwind > + > +declare i32 @llvm.atomic.load.add.i32.p0i32(i32*, i32) nounwind > + > +declare i64 @llvm.atomic.load.add.i64.p0i64(i64*, i64) nounwind > + > +declare i8 @llvm.atomic.load.sub.i8.p0i8(i8*, i8) nounwind > + > +declare i16 @llvm.atomic.load.sub.i16.p0i16(i16*, i16) nounwind > + > +declare i32 @llvm.atomic.load.sub.i32.p0i32(i32*, i32) nounwind > + > +declare i64 @llvm.atomic.load.sub.i64.p0i64(i64*, i64) nounwind > + > +declare i8 @llvm.atomic.load.or.i8.p0i8(i8*, i8) nounwind > + > +declare i16 @llvm.atomic.load.or.i16.p0i16(i16*, i16) nounwind > + > +declare i32 @llvm.atomic.load.or.i32.p0i32(i32*, i32) nounwind > + > +declare i64 @llvm.atomic.load.or.i64.p0i64(i64*, i64) nounwind > + > +declare i8 @llvm.atomic.load.xor.i8.p0i8(i8*, i8) nounwind > + > +declare i16 @llvm.atomic.load.xor.i16.p0i16(i16*, i16) nounwind > + > +declare i32 @llvm.atomic.load.xor.i32.p0i32(i32*, i32) nounwind > + > +declare i64 @llvm.atomic.load.xor.i64.p0i64(i64*, i64) nounwind > + > +declare i8 @llvm.atomic.load.and.i8.p0i8(i8*, i8) nounwind > + > +declare i16 @llvm.atomic.load.and.i16.p0i16(i16*, i16) nounwind > + > +declare i32 @llvm.atomic.load.and.i32.p0i32(i32*, i32) nounwind > + > +declare i64 @llvm.atomic.load.and.i64.p0i64(i64*, i64) nounwind > + > +declare i8 @llvm.atomic.load.nand.i8.p0i8(i8*, i8) nounwind > + > +declare i16 @llvm.atomic.load.nand.i16.p0i16(i16*, i16) nounwind > + > +declare i32 @llvm.atomic.load.nand.i32.p0i32(i32*, i32) nounwind > + > +declare i64 @llvm.atomic.load.nand.i64.p0i64(i64*, i64) nounwind > + > +define void @test_fetch_and_op() nounwind { > +entry: > + %0 = call i8 @llvm.atomic.load.add.i8.p0i8(i8* @sc, i8 11) ; [#uses=1] > + store i8 %0, i8* @sc, align 1 > + %1 = call i8 @llvm.atomic.load.add.i8.p0i8(i8* @uc, i8 11) ; [#uses=1] > + store i8 %1, i8* @uc, align 1 > + %2 = bitcast i8* bitcast (i16* @ss to i8*) to i16* ; [#uses=1] > + %3 = call i16 @llvm.atomic.load.add.i16.p0i16(i16* %2, i16 11) ; [#uses=1] > + store i16 %3, i16* @ss, align 2 > + %4 = bitcast i8* bitcast (i16* @us to i8*) to i16* ; [#uses=1] > + %5 = call i16 @llvm.atomic.load.add.i16.p0i16(i16* %4, i16 11) ; [#uses=1] > + store i16 %5, i16* @us, align 2 > + %6 = bitcast i8* bitcast (i32* @si to i8*) to i32* ; [#uses=1] > + %7 = call i32 @llvm.atomic.load.add.i32.p0i32(i32* %6, i32 11) ; [#uses=1] > + store i32 %7, i32* @si, align 4 > + %8 = bitcast i8* bitcast (i32* @ui to i8*) to i32* ; [#uses=1] > + %9 = call i32 @llvm.atomic.load.add.i32.p0i32(i32* %8, i32 11) ; [#uses=1] > + store i32 %9, i32* @ui, align 4 > + %10 = bitcast i8* bitcast (i32* @sl to i8*) to i32* ; [#uses=1] > + %11 = call i32 @llvm.atomic.load.add.i32.p0i32(i32* %10, i32 11) ; [#uses=1] > + store i32 %11, i32* @sl, align 4 > + %12 = bitcast i8* bitcast (i32* @ul to i8*) to i32* ; [#uses=1] > + %13 = call i32 @llvm.atomic.load.add.i32.p0i32(i32* %12, i32 11) ; [#uses=1] > + store i32 %13, i32* @ul, align 4 > + %14 = bitcast i8* bitcast (i64* @sll to i8*) to i64* ; [#uses=1] > + %15 = call i64 @llvm.atomic.load.add.i64.p0i64(i64* %14, i64 11) ; [#uses=1] > + store i64 %15, i64* @sll, align 8 > + %16 = bitcast i8* bitcast (i64* @ull to i8*) to i64* ; [#uses=1] > + %17 = call i64 @llvm.atomic.load.add.i64.p0i64(i64* %16, i64 11) ; [#uses=1] > + store i64 %17, i64* @ull, align 8 > + %18 = call i8 @llvm.atomic.load.sub.i8.p0i8(i8* @sc, i8 11) ; [#uses=1] > + store i8 %18, i8* @sc, align 1 > + %19 = call i8 @llvm.atomic.load.sub.i8.p0i8(i8* @uc, i8 11) ; [#uses=1] > + store i8 %19, i8* @uc, align 1 > + %20 = bitcast i8* bitcast (i16* @ss to i8*) to i16* ; [#uses=1] > + %21 = call i16 @llvm.atomic.load.sub.i16.p0i16(i16* %20, i16 11) ; [#uses=1] > + store i16 %21, i16* @ss, align 2 > + %22 = bitcast i8* bitcast (i16* @us to i8*) to i16* ; [#uses=1] > + %23 = call i16 @llvm.atomic.load.sub.i16.p0i16(i16* %22, i16 11) ; [#uses=1] > + store i16 %23, i16* @us, align 2 > + %24 = bitcast i8* bitcast (i32* @si to i8*) to i32* ; [#uses=1] > + %25 = call i32 @llvm.atomic.load.sub.i32.p0i32(i32* %24, i32 11) ; [#uses=1] > + store i32 %25, i32* @si, align 4 > + %26 = bitcast i8* bitcast (i32* @ui to i8*) to i32* ; [#uses=1] > + %27 = call i32 @llvm.atomic.load.sub.i32.p0i32(i32* %26, i32 11) ; [#uses=1] > + store i32 %27, i32* @ui, align 4 > + %28 = bitcast i8* bitcast (i32* @sl to i8*) to i32* ; [#uses=1] > + %29 = call i32 @llvm.atomic.load.sub.i32.p0i32(i32* %28, i32 11) ; [#uses=1] > + store i32 %29, i32* @sl, align 4 > + %30 = bitcast i8* bitcast (i32* @ul to i8*) to i32* ; [#uses=1] > + %31 = call i32 @llvm.atomic.load.sub.i32.p0i32(i32* %30, i32 11) ; [#uses=1] > + store i32 %31, i32* @ul, align 4 > + %32 = bitcast i8* bitcast (i64* @sll to i8*) to i64* ; [#uses=1] > + %33 = call i64 @llvm.atomic.load.sub.i64.p0i64(i64* %32, i64 11) ; [#uses=1] > + store i64 %33, i64* @sll, align 8 > + %34 = bitcast i8* bitcast (i64* @ull to i8*) to i64* ; [#uses=1] > + %35 = call i64 @llvm.atomic.load.sub.i64.p0i64(i64* %34, i64 11) ; [#uses=1] > + store i64 %35, i64* @ull, align 8 > + %36 = call i8 @llvm.atomic.load.or.i8.p0i8(i8* @sc, i8 11) ; [#uses=1] > + store i8 %36, i8* @sc, align 1 > + %37 = call i8 @llvm.atomic.load.or.i8.p0i8(i8* @uc, i8 11) ; [#uses=1] > + store i8 %37, i8* @uc, align 1 > + %38 = bitcast i8* bitcast (i16* @ss to i8*) to i16* ; [#uses=1] > + %39 = call i16 @llvm.atomic.load.or.i16.p0i16(i16* %38, i16 11) ; [#uses=1] > + store i16 %39, i16* @ss, align 2 > + %40 = bitcast i8* bitcast (i16* @us to i8*) to i16* ; [#uses=1] > + %41 = call i16 @llvm.atomic.load.or.i16.p0i16(i16* %40, i16 11) ; [#uses=1] > + store i16 %41, i16* @us, align 2 > + %42 = bitcast i8* bitcast (i32* @si to i8*) to i32* ; [#uses=1] > + %43 = call i32 @llvm.atomic.load.or.i32.p0i32(i32* %42, i32 11) ; [#uses=1] > + store i32 %43, i32* @si, align 4 > + %44 = bitcast i8* bitcast (i32* @ui to i8*) to i32* ; [#uses=1] > + %45 = call i32 @llvm.atomic.load.or.i32.p0i32(i32* %44, i32 11) ; [#uses=1] > + store i32 %45, i32* @ui, align 4 > + %46 = bitcast i8* bitcast (i32* @sl to i8*) to i32* ; [#uses=1] > + %47 = call i32 @llvm.atomic.load.or.i32.p0i32(i32* %46, i32 11) ; [#uses=1] > + store i32 %47, i32* @sl, align 4 > + %48 = bitcast i8* bitcast (i32* @ul to i8*) to i32* ; [#uses=1] > + %49 = call i32 @llvm.atomic.load.or.i32.p0i32(i32* %48, i32 11) ; [#uses=1] > + store i32 %49, i32* @ul, align 4 > + %50 = bitcast i8* bitcast (i64* @sll to i8*) to i64* ; [#uses=1] > + %51 = call i64 @llvm.atomic.load.or.i64.p0i64(i64* %50, i64 11) ; [#uses=1] > + store i64 %51, i64* @sll, align 8 > + %52 = bitcast i8* bitcast (i64* @ull to i8*) to i64* ; [#uses=1] > + %53 = call i64 @llvm.atomic.load.or.i64.p0i64(i64* %52, i64 11) ; [#uses=1] > + store i64 %53, i64* @ull, align 8 > + %54 = call i8 @llvm.atomic.load.xor.i8.p0i8(i8* @sc, i8 11) ; [#uses=1] > + store i8 %54, i8* @sc, align 1 > + %55 = call i8 @llvm.atomic.load.xor.i8.p0i8(i8* @uc, i8 11) ; [#uses=1] > + store i8 %55, i8* @uc, align 1 > + %56 = bitcast i8* bitcast (i16* @ss to i8*) to i16* ; [#uses=1] > + %57 = call i16 @llvm.atomic.load.xor.i16.p0i16(i16* %56, i16 11) ; [#uses=1] > + store i16 %57, i16* @ss, align 2 > + %58 = bitcast i8* bitcast (i16* @us to i8*) to i16* ; [#uses=1] > + %59 = call i16 @llvm.atomic.load.xor.i16.p0i16(i16* %58, i16 11) ; [#uses=1] > + store i16 %59, i16* @us, align 2 > + %60 = bitcast i8* bitcast (i32* @si to i8*) to i32* ; [#uses=1] > + %61 = call i32 @llvm.atomic.load.xor.i32.p0i32(i32* %60, i32 11) ; [#uses=1] > + store i32 %61, i32* @si, align 4 > + %62 = bitcast i8* bitcast (i32* @ui to i8*) to i32* ; [#uses=1] > + %63 = call i32 @llvm.atomic.load.xor.i32.p0i32(i32* %62, i32 11) ; [#uses=1] > + store i32 %63, i32* @ui, align 4 > + %64 = bitcast i8* bitcast (i32* @sl to i8*) to i32* ; [#uses=1] > + %65 = call i32 @llvm.atomic.load.xor.i32.p0i32(i32* %64, i32 11) ; [#uses=1] > + store i32 %65, i32* @sl, align 4 > + %66 = bitcast i8* bitcast (i32* @ul to i8*) to i32* ; [#uses=1] > + %67 = call i32 @llvm.atomic.load.xor.i32.p0i32(i32* %66, i32 11) ; [#uses=1] > + store i32 %67, i32* @ul, align 4 > + %68 = bitcast i8* bitcast (i64* @sll to i8*) to i64* ; [#uses=1] > + %69 = call i64 @llvm.atomic.load.xor.i64.p0i64(i64* %68, i64 11) ; [#uses=1] > + store i64 %69, i64* @sll, align 8 > + %70 = bitcast i8* bitcast (i64* @ull to i8*) to i64* ; [#uses=1] > + %71 = call i64 @llvm.atomic.load.xor.i64.p0i64(i64* %70, i64 11) ; [#uses=1] > + store i64 %71, i64* @ull, align 8 > + %72 = call i8 @llvm.atomic.load.and.i8.p0i8(i8* @sc, i8 11) ; [#uses=1] > + store i8 %72, i8* @sc, align 1 > + %73 = call i8 @llvm.atomic.load.and.i8.p0i8(i8* @uc, i8 11) ; [#uses=1] > + store i8 %73, i8* @uc, align 1 > + %74 = bitcast i8* bitcast (i16* @ss to i8*) to i16* ; [#uses=1] > + %75 = call i16 @llvm.atomic.load.and.i16.p0i16(i16* %74, i16 11) ; [#uses=1] > + store i16 %75, i16* @ss, align 2 > + %76 = bitcast i8* bitcast (i16* @us to i8*) to i16* ; [#uses=1] > + %77 = call i16 @llvm.atomic.load.and.i16.p0i16(i16* %76, i16 11) ; [#uses=1] > + store i16 %77, i16* @us, align 2 > + %78 = bitcast i8* bitcast (i32* @si to i8*) to i32* ; [#uses=1] > + %79 = call i32 @llvm.atomic.load.and.i32.p0i32(i32* %78, i32 11) ; [#uses=1] > + store i32 %79, i32* @si, align 4 > + %80 = bitcast i8* bitcast (i32* @ui to i8*) to i32* ; [#uses=1] > + %81 = call i32 @llvm.atomic.load.and.i32.p0i32(i32* %80, i32 11) ; [#uses=1] > + store i32 %81, i32* @ui, align 4 > + %82 = bitcast i8* bitcast (i32* @sl to i8*) to i32* ; [#uses=1] > + %83 = call i32 @llvm.atomic.load.and.i32.p0i32(i32* %82, i32 11) ; [#uses=1] > + store i32 %83, i32* @sl, align 4 > + %84 = bitcast i8* bitcast (i32* @ul to i8*) to i32* ; [#uses=1] > + %85 = call i32 @llvm.atomic.load.and.i32.p0i32(i32* %84, i32 11) ; [#uses=1] > + store i32 %85, i32* @ul, align 4 > + %86 = bitcast i8* bitcast (i64* @sll to i8*) to i64* ; [#uses=1] > + %87 = call i64 @llvm.atomic.load.and.i64.p0i64(i64* %86, i64 11) ; [#uses=1] > + store i64 %87, i64* @sll, align 8 > + %88 = bitcast i8* bitcast (i64* @ull to i8*) to i64* ; [#uses=1] > + %89 = call i64 @llvm.atomic.load.and.i64.p0i64(i64* %88, i64 11) ; [#uses=1] > + store i64 %89, i64* @ull, align 8 > + %90 = call i8 @llvm.atomic.load.nand.i8.p0i8(i8* @sc, i8 11) ; [#uses=1] > + store i8 %90, i8* @sc, align 1 > + %91 = call i8 @llvm.atomic.load.nand.i8.p0i8(i8* @uc, i8 11) ; [#uses=1] > + store i8 %91, i8* @uc, align 1 > + %92 = bitcast i8* bitcast (i16* @ss to i8*) to i16* ; [#uses=1] > + %93 = call i16 @llvm.atomic.load.nand.i16.p0i16(i16* %92, i16 11) ; [#uses=1] > + store i16 %93, i16* @ss, align 2 > + %94 = bitcast i8* bitcast (i16* @us to i8*) to i16* ; [#uses=1] > + %95 = call i16 @llvm.atomic.load.nand.i16.p0i16(i16* %94, i16 11) ; [#uses=1] > + store i16 %95, i16* @us, align 2 > + %96 = bitcast i8* bitcast (i32* @si to i8*) to i32* ; [#uses=1] > + %97 = call i32 @llvm.atomic.load.nand.i32.p0i32(i32* %96, i32 11) ; [#uses=1] > + store i32 %97, i32* @si, align 4 > + %98 = bitcast i8* bitcast (i32* @ui to i8*) to i32* ; [#uses=1] > + %99 = call i32 @llvm.atomic.load.nand.i32.p0i32(i32* %98, i32 11) ; [#uses=1] > + store i32 %99, i32* @ui, align 4 > + %100 = bitcast i8* bitcast (i32* @sl to i8*) to i32* ; [#uses=1] > + %101 = call i32 @llvm.atomic.load.nand.i32.p0i32(i32* %100, i32 11) ; [#uses=1] > + store i32 %101, i32* @sl, align 4 > + %102 = bitcast i8* bitcast (i32* @ul to i8*) to i32* ; [#uses=1] > + %103 = call i32 @llvm.atomic.load.nand.i32.p0i32(i32* %102, i32 11) ; [#uses=1] > + store i32 %103, i32* @ul, align 4 > + %104 = bitcast i8* bitcast (i64* @sll to i8*) to i64* ; [#uses=1] > + %105 = call i64 @llvm.atomic.load.nand.i64.p0i64(i64* %104, i64 11) ; [#uses=1] > + store i64 %105, i64* @sll, align 8 > + %106 = bitcast i8* bitcast (i64* @ull to i8*) to i64* ; [#uses=1] > + %107 = call i64 @llvm.atomic.load.nand.i64.p0i64(i64* %106, i64 11) ; [#uses=1] > + store i64 %107, i64* @ull, align 8 > + br label %return > + > +return: ; preds = %entry > + ret void > +} > + > +define void @test_op_and_fetch() nounwind { > +entry: > + %0 = load i8* @uc, align 1 ; [#uses=1] > + %1 = zext i8 %0 to i32 ; [#uses=1] > + %2 = trunc i32 %1 to i8 ; [#uses=2] > + %3 = call i8 @llvm.atomic.load.add.i8.p0i8(i8* @sc, i8 %2) ; [#uses=1] > + %4 = add i8 %3, %2 ; [#uses=1] > + store i8 %4, i8* @sc, align 1 > + %5 = load i8* @uc, align 1 ; [#uses=1] > + %6 = zext i8 %5 to i32 ; [#uses=1] > + %7 = trunc i32 %6 to i8 ; [#uses=2] > + %8 = call i8 @llvm.atomic.load.add.i8.p0i8(i8* @uc, i8 %7) ; [#uses=1] > + %9 = add i8 %8, %7 ; [#uses=1] > + store i8 %9, i8* @uc, align 1 > + %10 = load i8* @uc, align 1 ; [#uses=1] > + %11 = zext i8 %10 to i32 ; [#uses=1] > + %12 = bitcast i8* bitcast (i16* @ss to i8*) to i16* ; [#uses=1] > + %13 = trunc i32 %11 to i16 ; [#uses=2] > + %14 = call i16 @llvm.atomic.load.add.i16.p0i16(i16* %12, i16 %13) ; [#uses=1] > + %15 = add i16 %14, %13 ; [#uses=1] > + store i16 %15, i16* @ss, align 2 > + %16 = load i8* @uc, align 1 ; [#uses=1] > + %17 = zext i8 %16 to i32 ; [#uses=1] > + %18 = bitcast i8* bitcast (i16* @us to i8*) to i16* ; [#uses=1] > + %19 = trunc i32 %17 to i16 ; [#uses=2] > + %20 = call i16 @llvm.atomic.load.add.i16.p0i16(i16* %18, i16 %19) ; [#uses=1] > + %21 = add i16 %20, %19 ; [#uses=1] > + store i16 %21, i16* @us, align 2 > + %22 = load i8* @uc, align 1 ; [#uses=1] > + %23 = zext i8 %22 to i32 ; [#uses=2] > + %24 = bitcast i8* bitcast (i32* @si to i8*) to i32* ; [#uses=1] > + %25 = call i32 @llvm.atomic.load.add.i32.p0i32(i32* %24, i32 %23) ; [#uses=1] > + %26 = add i32 %25, %23 ; [#uses=1] > + store i32 %26, i32* @si, align 4 > + %27 = load i8* @uc, align 1 ; [#uses=1] > + %28 = zext i8 %27 to i32 ; [#uses=2] > + %29 = bitcast i8* bitcast (i32* @ui to i8*) to i32* ; [#uses=1] > + %30 = call i32 @llvm.atomic.load.add.i32.p0i32(i32* %29, i32 %28) ; [#uses=1] > + %31 = add i32 %30, %28 ; [#uses=1] > + store i32 %31, i32* @ui, align 4 > + %32 = load i8* @uc, align 1 ; [#uses=1] > + %33 = zext i8 %32 to i32 ; [#uses=2] > + %34 = bitcast i8* bitcast (i32* @sl to i8*) to i32* ; [#uses=1] > + %35 = call i32 @llvm.atomic.load.add.i32.p0i32(i32* %34, i32 %33) ; [#uses=1] > + %36 = add i32 %35, %33 ; [#uses=1] > + store i32 %36, i32* @sl, align 4 > + %37 = load i8* @uc, align 1 ; [#uses=1] > + %38 = zext i8 %37 to i32 ; [#uses=2] > + %39 = bitcast i8* bitcast (i32* @ul to i8*) to i32* ; [#uses=1] > + %40 = call i32 @llvm.atomic.load.add.i32.p0i32(i32* %39, i32 %38) ; [#uses=1] > + %41 = add i32 %40, %38 ; [#uses=1] > + store i32 %41, i32* @ul, align 4 > + %42 = load i8* @uc, align 1 ; [#uses=1] > + %43 = zext i8 %42 to i64 ; [#uses=2] > + %44 = bitcast i8* bitcast (i64* @sll to i8*) to i64* ; [#uses=1] > + %45 = call i64 @llvm.atomic.load.add.i64.p0i64(i64* %44, i64 %43) ; [#uses=1] > + %46 = add i64 %45, %43 ; [#uses=1] > + store i64 %46, i64* @sll, align 8 > + %47 = load i8* @uc, align 1 ; [#uses=1] > + %48 = zext i8 %47 to i64 ; [#uses=2] > + %49 = bitcast i8* bitcast (i64* @ull to i8*) to i64* ; [#uses=1] > + %50 = call i64 @llvm.atomic.load.add.i64.p0i64(i64* %49, i64 %48) ; [#uses=1] > + %51 = add i64 %50, %48 ; [#uses=1] > + store i64 %51, i64* @ull, align 8 > + %52 = load i8* @uc, align 1 ; [#uses=1] > + %53 = zext i8 %52 to i32 ; [#uses=1] > + %54 = trunc i32 %53 to i8 ; [#uses=2] > + %55 = call i8 @llvm.atomic.load.sub.i8.p0i8(i8* @sc, i8 %54) ; [#uses=1] > + %56 = sub i8 %55, %54 ; [#uses=1] > + store i8 %56, i8* @sc, align 1 > + %57 = load i8* @uc, align 1 ; [#uses=1] > + %58 = zext i8 %57 to i32 ; [#uses=1] > + %59 = trunc i32 %58 to i8 ; [#uses=2] > + %60 = call i8 @llvm.atomic.load.sub.i8.p0i8(i8* @uc, i8 %59) ; [#uses=1] > + %61 = sub i8 %60, %59 ; [#uses=1] > + store i8 %61, i8* @uc, align 1 > + %62 = load i8* @uc, align 1 ; [#uses=1] > + %63 = zext i8 %62 to i32 ; [#uses=1] > + %64 = bitcast i8* bitcast (i16* @ss to i8*) to i16* ; [#uses=1] > + %65 = trunc i32 %63 to i16 ; [#uses=2] > + %66 = call i16 @llvm.atomic.load.sub.i16.p0i16(i16* %64, i16 %65) ; [#uses=1] > + %67 = sub i16 %66, %65 ; [#uses=1] > + store i16 %67, i16* @ss, align 2 > + %68 = load i8* @uc, align 1 ; [#uses=1] > + %69 = zext i8 %68 to i32 ; [#uses=1] > + %70 = bitcast i8* bitcast (i16* @us to i8*) to i16* ; [#uses=1] > + %71 = trunc i32 %69 to i16 ; [#uses=2] > + %72 = call i16 @llvm.atomic.load.sub.i16.p0i16(i16* %70, i16 %71) ; [#uses=1] > + %73 = sub i16 %72, %71 ; [#uses=1] > + store i16 %73, i16* @us, align 2 > + %74 = load i8* @uc, align 1 ; [#uses=1] > + %75 = zext i8 %74 to i32 ; [#uses=2] > + %76 = bitcast i8* bitcast (i32* @si to i8*) to i32* ; [#uses=1] > + %77 = call i32 @llvm.atomic.load.sub.i32.p0i32(i32* %76, i32 %75) ; [#uses=1] > + %78 = sub i32 %77, %75 ; [#uses=1] > + store i32 %78, i32* @si, align 4 > + %79 = load i8* @uc, align 1 ; [#uses=1] > + %80 = zext i8 %79 to i32 ; [#uses=2] > + %81 = bitcast i8* bitcast (i32* @ui to i8*) to i32* ; [#uses=1] > + %82 = call i32 @llvm.atomic.load.sub.i32.p0i32(i32* %81, i32 %80) ; [#uses=1] > + %83 = sub i32 %82, %80 ; [#uses=1] > + store i32 %83, i32* @ui, align 4 > + %84 = load i8* @uc, align 1 ; [#uses=1] > + %85 = zext i8 %84 to i32 ; [#uses=2] > + %86 = bitcast i8* bitcast (i32* @sl to i8*) to i32* ; [#uses=1] > + %87 = call i32 @llvm.atomic.load.sub.i32.p0i32(i32* %86, i32 %85) ; [#uses=1] > + %88 = sub i32 %87, %85 ; [#uses=1] > + store i32 %88, i32* @sl, align 4 > + %89 = load i8* @uc, align 1 ; [#uses=1] > + %90 = zext i8 %89 to i32 ; [#uses=2] > + %91 = bitcast i8* bitcast (i32* @ul to i8*) to i32* ; [#uses=1] > + %92 = call i32 @llvm.atomic.load.sub.i32.p0i32(i32* %91, i32 %90) ; [#uses=1] > + %93 = sub i32 %92, %90 ; [#uses=1] > + store i32 %93, i32* @ul, align 4 > + %94 = load i8* @uc, align 1 ; [#uses=1] > + %95 = zext i8 %94 to i64 ; [#uses=2] > + %96 = bitcast i8* bitcast (i64* @sll to i8*) to i64* ; [#uses=1] > + %97 = call i64 @llvm.atomic.load.sub.i64.p0i64(i64* %96, i64 %95) ; [#uses=1] > + %98 = sub i64 %97, %95 ; [#uses=1] > + store i64 %98, i64* @sll, align 8 > + %99 = load i8* @uc, align 1 ; [#uses=1] > + %100 = zext i8 %99 to i64 ; [#uses=2] > + %101 = bitcast i8* bitcast (i64* @ull to i8*) to i64* ; [#uses=1] > + %102 = call i64 @llvm.atomic.load.sub.i64.p0i64(i64* %101, i64 %100) ; [#uses=1] > + %103 = sub i64 %102, %100 ; [#uses=1] > + store i64 %103, i64* @ull, align 8 > + %104 = load i8* @uc, align 1 ; [#uses=1] > + %105 = zext i8 %104 to i32 ; [#uses=1] > + %106 = trunc i32 %105 to i8 ; [#uses=2] > + %107 = call i8 @llvm.atomic.load.or.i8.p0i8(i8* @sc, i8 %106) ; [#uses=1] > + %108 = or i8 %107, %106 ; [#uses=1] > + store i8 %108, i8* @sc, align 1 > + %109 = load i8* @uc, align 1 ; [#uses=1] > + %110 = zext i8 %109 to i32 ; [#uses=1] > + %111 = trunc i32 %110 to i8 ; [#uses=2] > + %112 = call i8 @llvm.atomic.load.or.i8.p0i8(i8* @uc, i8 %111) ; [#uses=1] > + %113 = or i8 %112, %111 ; [#uses=1] > + store i8 %113, i8* @uc, align 1 > + %114 = load i8* @uc, align 1 ; [#uses=1] > + %115 = zext i8 %114 to i32 ; [#uses=1] > + %116 = bitcast i8* bitcast (i16* @ss to i8*) to i16* ; [#uses=1] > + %117 = trunc i32 %115 to i16 ; [#uses=2] > + %118 = call i16 @llvm.atomic.load.or.i16.p0i16(i16* %116, i16 %117) ; [#uses=1] > + %119 = or i16 %118, %117 ; [#uses=1] > + store i16 %119, i16* @ss, align 2 > + %120 = load i8* @uc, align 1 ; [#uses=1] > + %121 = zext i8 %120 to i32 ; [#uses=1] > + %122 = bitcast i8* bitcast (i16* @us to i8*) to i16* ; [#uses=1] > + %123 = trunc i32 %121 to i16 ; [#uses=2] > + %124 = call i16 @llvm.atomic.load.or.i16.p0i16(i16* %122, i16 %123) ; [#uses=1] > + %125 = or i16 %124, %123 ; [#uses=1] > + store i16 %125, i16* @us, align 2 > + %126 = load i8* @uc, align 1 ; [#uses=1] > + %127 = zext i8 %126 to i32 ; [#uses=2] > + %128 = bitcast i8* bitcast (i32* @si to i8*) to i32* ; [#uses=1] > + %129 = call i32 @llvm.atomic.load.or.i32.p0i32(i32* %128, i32 %127) ; [#uses=1] > + %130 = or i32 %129, %127 ; [#uses=1] > + store i32 %130, i32* @si, align 4 > + %131 = load i8* @uc, align 1 ; [#uses=1] > + %132 = zext i8 %131 to i32 ; [#uses=2] > + %133 = bitcast i8* bitcast (i32* @ui to i8*) to i32* ; [#uses=1] > + %134 = call i32 @llvm.atomic.load.or.i32.p0i32(i32* %133, i32 %132) ; [#uses=1] > + %135 = or i32 %134, %132 ; [#uses=1] > + store i32 %135, i32* @ui, align 4 > + %136 = load i8* @uc, align 1 ; [#uses=1] > + %137 = zext i8 %136 to i32 ; [#uses=2] > + %138 = bitcast i8* bitcast (i32* @sl to i8*) to i32* ; [#uses=1] > + %139 = call i32 @llvm.atomic.load.or.i32.p0i32(i32* %138, i32 %137) ; [#uses=1] > + %140 = or i32 %139, %137 ; [#uses=1] > + store i32 %140, i32* @sl, align 4 > + %141 = load i8* @uc, align 1 ; [#uses=1] > + %142 = zext i8 %141 to i32 ; [#uses=2] > + %143 = bitcast i8* bitcast (i32* @ul to i8*) to i32* ; [#uses=1] > + %144 = call i32 @llvm.atomic.load.or.i32.p0i32(i32* %143, i32 %142) ; [#uses=1] > + %145 = or i32 %144, %142 ; [#uses=1] > + store i32 %145, i32* @ul, align 4 > + %146 = load i8* @uc, align 1 ; [#uses=1] > + %147 = zext i8 %146 to i64 ; [#uses=2] > + %148 = bitcast i8* bitcast (i64* @sll to i8*) to i64* ; [#uses=1] > + %149 = call i64 @llvm.atomic.load.or.i64.p0i64(i64* %148, i64 %147) ; [#uses=1] > + %150 = or i64 %149, %147 ; [#uses=1] > + store i64 %150, i64* @sll, align 8 > + %151 = load i8* @uc, align 1 ; [#uses=1] > + %152 = zext i8 %151 to i64 ; [#uses=2] > + %153 = bitcast i8* bitcast (i64* @ull to i8*) to i64* ; [#uses=1] > + %154 = call i64 @llvm.atomic.load.or.i64.p0i64(i64* %153, i64 %152) ; [#uses=1] > + %155 = or i64 %154, %152 ; [#uses=1] > + store i64 %155, i64* @ull, align 8 > + %156 = load i8* @uc, align 1 ; [#uses=1] > + %157 = zext i8 %156 to i32 ; [#uses=1] > + %158 = trunc i32 %157 to i8 ; [#uses=2] > + %159 = call i8 @llvm.atomic.load.xor.i8.p0i8(i8* @sc, i8 %158) ; [#uses=1] > + %160 = xor i8 %159, %158 ; [#uses=1] > + store i8 %160, i8* @sc, align 1 > + %161 = load i8* @uc, align 1 ; [#uses=1] > + %162 = zext i8 %161 to i32 ; [#uses=1] > + %163 = trunc i32 %162 to i8 ; [#uses=2] > + %164 = call i8 @llvm.atomic.load.xor.i8.p0i8(i8* @uc, i8 %163) ; [#uses=1] > + %165 = xor i8 %164, %163 ; [#uses=1] > + store i8 %165, i8* @uc, align 1 > + %166 = load i8* @uc, align 1 ; [#uses=1] > + %167 = zext i8 %166 to i32 ; [#uses=1] > + %168 = bitcast i8* bitcast (i16* @ss to i8*) to i16* ; [#uses=1] > + %169 = trunc i32 %167 to i16 ; [#uses=2] > + %170 = call i16 @llvm.atomic.load.xor.i16.p0i16(i16* %168, i16 %169) ; [#uses=1] > + %171 = xor i16 %170, %169 ; [#uses=1] > + store i16 %171, i16* @ss, align 2 > + %172 = load i8* @uc, align 1 ; [#uses=1] > + %173 = zext i8 %172 to i32 ; [#uses=1] > + %174 = bitcast i8* bitcast (i16* @us to i8*) to i16* ; [#uses=1] > + %175 = trunc i32 %173 to i16 ; [#uses=2] > + %176 = call i16 @llvm.atomic.load.xor.i16.p0i16(i16* %174, i16 %175) ; [#uses=1] > + %177 = xor i16 %176, %175 ; [#uses=1] > + store i16 %177, i16* @us, align 2 > + %178 = load i8* @uc, align 1 ; [#uses=1] > + %179 = zext i8 %178 to i32 ; [#uses=2] > + %180 = bitcast i8* bitcast (i32* @si to i8*) to i32* ; [#uses=1] > + %181 = call i32 @llvm.atomic.load.xor.i32.p0i32(i32* %180, i32 %179) ; [#uses=1] > + %182 = xor i32 %181, %179 ; [#uses=1] > + store i32 %182, i32* @si, align 4 > + %183 = load i8* @uc, align 1 ; [#uses=1] > + %184 = zext i8 %183 to i32 ; [#uses=2] > + %185 = bitcast i8* bitcast (i32* @ui to i8*) to i32* ; [#uses=1] > + %186 = call i32 @llvm.atomic.load.xor.i32.p0i32(i32* %185, i32 %184) ; [#uses=1] > + %187 = xor i32 %186, %184 ; [#uses=1] > + store i32 %187, i32* @ui, align 4 > + %188 = load i8* @uc, align 1 ; [#uses=1] > + %189 = zext i8 %188 to i32 ; [#uses=2] > + %190 = bitcast i8* bitcast (i32* @sl to i8*) to i32* ; [#uses=1] > + %191 = call i32 @llvm.atomic.load.xor.i32.p0i32(i32* %190, i32 %189) ; [#uses=1] > + %192 = xor i32 %191, %189 ; [#uses=1] > + store i32 %192, i32* @sl, align 4 > + %193 = load i8* @uc, align 1 ; [#uses=1] > + %194 = zext i8 %193 to i32 ; [#uses=2] > + %195 = bitcast i8* bitcast (i32* @ul to i8*) to i32* ; [#uses=1] > + %196 = call i32 @llvm.atomic.load.xor.i32.p0i32(i32* %195, i32 %194) ; [#uses=1] > + %197 = xor i32 %196, %194 ; [#uses=1] > + store i32 %197, i32* @ul, align 4 > + %198 = load i8* @uc, align 1 ; [#uses=1] > + %199 = zext i8 %198 to i64 ; [#uses=2] > + %200 = bitcast i8* bitcast (i64* @sll to i8*) to i64* ; [#uses=1] > + %201 = call i64 @llvm.atomic.load.xor.i64.p0i64(i64* %200, i64 %199) ; [#uses=1] > + %202 = xor i64 %201, %199 ; [#uses=1] > + store i64 %202, i64* @sll, align 8 > + %203 = load i8* @uc, align 1 ; [#uses=1] > + %204 = zext i8 %203 to i64 ; [#uses=2] > + %205 = bitcast i8* bitcast (i64* @ull to i8*) to i64* ; [#uses=1] > + %206 = call i64 @llvm.atomic.load.xor.i64.p0i64(i64* %205, i64 %204) ; [#uses=1] > + %207 = xor i64 %206, %204 ; [#uses=1] > + store i64 %207, i64* @ull, align 8 > + %208 = load i8* @uc, align 1 ; [#uses=1] > + %209 = zext i8 %208 to i32 ; [#uses=1] > + %210 = trunc i32 %209 to i8 ; [#uses=2] > + %211 = call i8 @llvm.atomic.load.and.i8.p0i8(i8* @sc, i8 %210) ; [#uses=1] > + %212 = and i8 %211, %210 ; [#uses=1] > + store i8 %212, i8* @sc, align 1 > + %213 = load i8* @uc, align 1 ; [#uses=1] > + %214 = zext i8 %213 to i32 ; [#uses=1] > + %215 = trunc i32 %214 to i8 ; [#uses=2] > + %216 = call i8 @llvm.atomic.load.and.i8.p0i8(i8* @uc, i8 %215) ; [#uses=1] > + %217 = and i8 %216, %215 ; [#uses=1] > + store i8 %217, i8* @uc, align 1 > + %218 = load i8* @uc, align 1 ; [#uses=1] > + %219 = zext i8 %218 to i32 ; [#uses=1] > + %220 = bitcast i8* bitcast (i16* @ss to i8*) to i16* ; [#uses=1] > + %221 = trunc i32 %219 to i16 ; [#uses=2] > + %222 = call i16 @llvm.atomic.load.and.i16.p0i16(i16* %220, i16 %221) ; [#uses=1] > + %223 = and i16 %222, %221 ; [#uses=1] > + store i16 %223, i16* @ss, align 2 > + %224 = load i8* @uc, align 1 ; [#uses=1] > + %225 = zext i8 %224 to i32 ; [#uses=1] > + %226 = bitcast i8* bitcast (i16* @us to i8*) to i16* ; [#uses=1] > + %227 = trunc i32 %225 to i16 ; [#uses=2] > + %228 = call i16 @llvm.atomic.load.and.i16.p0i16(i16* %226, i16 %227) ; [#uses=1] > + %229 = and i16 %228, %227 ; [#uses=1] > + store i16 %229, i16* @us, align 2 > + %230 = load i8* @uc, align 1 ; [#uses=1] > + %231 = zext i8 %230 to i32 ; [#uses=2] > + %232 = bitcast i8* bitcast (i32* @si to i8*) to i32* ; [#uses=1] > + %233 = call i32 @llvm.atomic.load.and.i32.p0i32(i32* %232, i32 %231) ; [#uses=1] > + %234 = and i32 %233, %231 ; [#uses=1] > + store i32 %234, i32* @si, align 4 > + %235 = load i8* @uc, align 1 ; [#uses=1] > + %236 = zext i8 %235 to i32 ; [#uses=2] > + %237 = bitcast i8* bitcast (i32* @ui to i8*) to i32* ; [#uses=1] > + %238 = call i32 @llvm.atomic.load.and.i32.p0i32(i32* %237, i32 %236) ; [#uses=1] > + %239 = and i32 %238, %236 ; [#uses=1] > + store i32 %239, i32* @ui, align 4 > + %240 = load i8* @uc, align 1 ; [#uses=1] > + %241 = zext i8 %240 to i32 ; [#uses=2] > + %242 = bitcast i8* bitcast (i32* @sl to i8*) to i32* ; [#uses=1] > + %243 = call i32 @llvm.atomic.load.and.i32.p0i32(i32* %242, i32 %241) ; [#uses=1] > + %244 = and i32 %243, %241 ; [#uses=1] > + store i32 %244, i32* @sl, align 4 > + %245 = load i8* @uc, align 1 ; [#uses=1] > + %246 = zext i8 %245 to i32 ; [#uses=2] > + %247 = bitcast i8* bitcast (i32* @ul to i8*) to i32* ; [#uses=1] > + %248 = call i32 @llvm.atomic.load.and.i32.p0i32(i32* %247, i32 %246) ; [#uses=1] > + %249 = and i32 %248, %246 ; [#uses=1] > + store i32 %249, i32* @ul, align 4 > + %250 = load i8* @uc, align 1 ; [#uses=1] > + %251 = zext i8 %250 to i64 ; [#uses=2] > + %252 = bitcast i8* bitcast (i64* @sll to i8*) to i64* ; [#uses=1] > + %253 = call i64 @llvm.atomic.load.and.i64.p0i64(i64* %252, i64 %251) ; [#uses=1] > + %254 = and i64 %253, %251 ; [#uses=1] > + store i64 %254, i64* @sll, align 8 > + %255 = load i8* @uc, align 1 ; [#uses=1] > + %256 = zext i8 %255 to i64 ; [#uses=2] > + %257 = bitcast i8* bitcast (i64* @ull to i8*) to i64* ; [#uses=1] > + %258 = call i64 @llvm.atomic.load.and.i64.p0i64(i64* %257, i64 %256) ; [#uses=1] > + %259 = and i64 %258, %256 ; [#uses=1] > + store i64 %259, i64* @ull, align 8 > + %260 = load i8* @uc, align 1 ; [#uses=1] > + %261 = zext i8 %260 to i32 ; [#uses=1] > + %262 = trunc i32 %261 to i8 ; [#uses=2] > + %263 = call i8 @llvm.atomic.load.nand.i8.p0i8(i8* @sc, i8 %262) ; [#uses=1] > + %264 = xor i8 %263, -1 ; [#uses=1] > + %265 = and i8 %264, %262 ; [#uses=1] > + store i8 %265, i8* @sc, align 1 > + %266 = load i8* @uc, align 1 ; [#uses=1] > + %267 = zext i8 %266 to i32 ; [#uses=1] > + %268 = trunc i32 %267 to i8 ; [#uses=2] > + %269 = call i8 @llvm.atomic.load.nand.i8.p0i8(i8* @uc, i8 %268) ; [#uses=1] > + %270 = xor i8 %269, -1 ; [#uses=1] > + %271 = and i8 %270, %268 ; [#uses=1] > + store i8 %271, i8* @uc, align 1 > + %272 = load i8* @uc, align 1 ; [#uses=1] > + %273 = zext i8 %272 to i32 ; [#uses=1] > + %274 = bitcast i8* bitcast (i16* @ss to i8*) to i16* ; [#uses=1] > + %275 = trunc i32 %273 to i16 ; [#uses=2] > + %276 = call i16 @llvm.atomic.load.nand.i16.p0i16(i16* %274, i16 %275) ; [#uses=1] > + %277 = xor i16 %276, -1 ; [#uses=1] > + %278 = and i16 %277, %275 ; [#uses=1] > + store i16 %278, i16* @ss, align 2 > + %279 = load i8* @uc, align 1 ; [#uses=1] > + %280 = zext i8 %279 to i32 ; [#uses=1] > + %281 = bitcast i8* bitcast (i16* @us to i8*) to i16* ; [#uses=1] > + %282 = trunc i32 %280 to i16 ; [#uses=2] > + %283 = call i16 @llvm.atomic.load.nand.i16.p0i16(i16* %281, i16 %282) ; [#uses=1] > + %284 = xor i16 %283, -1 ; [#uses=1] > + %285 = and i16 %284, %282 ; [#uses=1] > + store i16 %285, i16* @us, align 2 > + %286 = load i8* @uc, align 1 ; [#uses=1] > + %287 = zext i8 %286 to i32 ; [#uses=2] > + %288 = bitcast i8* bitcast (i32* @si to i8*) to i32* ; [#uses=1] > + %289 = call i32 @llvm.atomic.load.nand.i32.p0i32(i32* %288, i32 %287) ; [#uses=1] > + %290 = xor i32 %289, -1 ; [#uses=1] > + %291 = and i32 %290, %287 ; [#uses=1] > + store i32 %291, i32* @si, align 4 > + %292 = load i8* @uc, align 1 ; [#uses=1] > + %293 = zext i8 %292 to i32 ; [#uses=2] > + %294 = bitcast i8* bitcast (i32* @ui to i8*) to i32* ; [#uses=1] > + %295 = call i32 @llvm.atomic.load.nand.i32.p0i32(i32* %294, i32 %293) ; [#uses=1] > + %296 = xor i32 %295, -1 ; [#uses=1] > + %297 = and i32 %296, %293 ; [#uses=1] > + store i32 %297, i32* @ui, align 4 > + %298 = load i8* @uc, align 1 ; [#uses=1] > + %299 = zext i8 %298 to i32 ; [#uses=2] > + %300 = bitcast i8* bitcast (i32* @sl to i8*) to i32* ; [#uses=1] > + %301 = call i32 @llvm.atomic.load.nand.i32.p0i32(i32* %300, i32 %299) ; [#uses=1] > + %302 = xor i32 %301, -1 ; [#uses=1] > + %303 = and i32 %302, %299 ; [#uses=1] > + store i32 %303, i32* @sl, align 4 > + %304 = load i8* @uc, align 1 ; [#uses=1] > + %305 = zext i8 %304 to i32 ; [#uses=2] > + %306 = bitcast i8* bitcast (i32* @ul to i8*) to i32* ; [#uses=1] > + %307 = call i32 @llvm.atomic.load.nand.i32.p0i32(i32* %306, i32 %305) ; [#uses=1] > + %308 = xor i32 %307, -1 ; [#uses=1] > + %309 = and i32 %308, %305 ; [#uses=1] > + store i32 %309, i32* @ul, align 4 > + %310 = load i8* @uc, align 1 ; [#uses=1] > + %311 = zext i8 %310 to i64 ; [#uses=2] > + %312 = bitcast i8* bitcast (i64* @sll to i8*) to i64* ; [#uses=1] > + %313 = call i64 @llvm.atomic.load.nand.i64.p0i64(i64* %312, i64 %311) ; [#uses=1] > + %314 = xor i64 %313, -1 ; [#uses=1] > + %315 = and i64 %314, %311 ; [#uses=1] > + store i64 %315, i64* @sll, align 8 > + %316 = load i8* @uc, align 1 ; [#uses=1] > + %317 = zext i8 %316 to i64 ; [#uses=2] > + %318 = bitcast i8* bitcast (i64* @ull to i8*) to i64* ; [#uses=1] > + %319 = call i64 @llvm.atomic.load.nand.i64.p0i64(i64* %318, i64 %317) ; [#uses=1] > + %320 = xor i64 %319, -1 ; [#uses=1] > + %321 = and i64 %320, %317 ; [#uses=1] > + store i64 %321, i64* @ull, align 8 > + br label %return > + > +return: ; preds = %entry > + ret void > +} > + > +define void @test_compare_and_swap() nounwind { > +entry: > + %0 = load i8* @sc, align 1 ; [#uses=1] > + %1 = zext i8 %0 to i32 ; [#uses=1] > + %2 = load i8* @uc, align 1 ; [#uses=1] > + %3 = zext i8 %2 to i32 ; [#uses=1] > + %4 = trunc i32 %3 to i8 ; [#uses=1] > + %5 = trunc i32 %1 to i8 ; [#uses=1] > + %6 = call i8 @llvm.atomic.cmp.swap.i8.p0i8(i8* @sc, i8 %4, i8 %5) ; [#uses=1] > + store i8 %6, i8* @sc, align 1 > + %7 = load i8* @sc, align 1 ; [#uses=1] > + %8 = zext i8 %7 to i32 ; [#uses=1] > + %9 = load i8* @uc, align 1 ; [#uses=1] > + %10 = zext i8 %9 to i32 ; [#uses=1] > + %11 = trunc i32 %10 to i8 ; [#uses=1] > + %12 = trunc i32 %8 to i8 ; [#uses=1] > + %13 = call i8 @llvm.atomic.cmp.swap.i8.p0i8(i8* @uc, i8 %11, i8 %12) ; [#uses=1] > + store i8 %13, i8* @uc, align 1 > + %14 = load i8* @sc, align 1 ; [#uses=1] > + %15 = sext i8 %14 to i16 ; [#uses=1] > + %16 = zext i16 %15 to i32 ; [#uses=1] > + %17 = load i8* @uc, align 1 ; [#uses=1] > + %18 = zext i8 %17 to i32 ; [#uses=1] > + %19 = bitcast i8* bitcast (i16* @ss to i8*) to i16* ; [#uses=1] > + %20 = trunc i32 %18 to i16 ; [#uses=1] > + %21 = trunc i32 %16 to i16 ; [#uses=1] > + %22 = call i16 @llvm.atomic.cmp.swap.i16.p0i16(i16* %19, i16 %20, i16 %21) ; [#uses=1] > + store i16 %22, i16* @ss, align 2 > + %23 = load i8* @sc, align 1 ; [#uses=1] > + %24 = sext i8 %23 to i16 ; [#uses=1] > + %25 = zext i16 %24 to i32 ; [#uses=1] > + %26 = load i8* @uc, align 1 ; [#uses=1] > + %27 = zext i8 %26 to i32 ; [#uses=1] > + %28 = bitcast i8* bitcast (i16* @us to i8*) to i16* ; [#uses=1] > + %29 = trunc i32 %27 to i16 ; [#uses=1] > + %30 = trunc i32 %25 to i16 ; [#uses=1] > + %31 = call i16 @llvm.atomic.cmp.swap.i16.p0i16(i16* %28, i16 %29, i16 %30) ; [#uses=1] > + store i16 %31, i16* @us, align 2 > + %32 = load i8* @sc, align 1 ; [#uses=1] > + %33 = sext i8 %32 to i32 ; [#uses=1] > + %34 = load i8* @uc, align 1 ; [#uses=1] > + %35 = zext i8 %34 to i32 ; [#uses=1] > + %36 = bitcast i8* bitcast (i32* @si to i8*) to i32* ; [#uses=1] > + %37 = call i32 @llvm.atomic.cmp.swap.i32.p0i32(i32* %36, i32 %35, i32 %33) ; [#uses=1] > + store i32 %37, i32* @si, align 4 > + %38 = load i8* @sc, align 1 ; [#uses=1] > + %39 = sext i8 %38 to i32 ; [#uses=1] > + %40 = load i8* @uc, align 1 ; [#uses=1] > + %41 = zext i8 %40 to i32 ; [#uses=1] > + %42 = bitcast i8* bitcast (i32* @ui to i8*) to i32* ; [#uses=1] > + %43 = call i32 @llvm.atomic.cmp.swap.i32.p0i32(i32* %42, i32 %41, i32 %39) ; [#uses=1] > + store i32 %43, i32* @ui, align 4 > + %44 = load i8* @sc, align 1 ; [#uses=1] > + %45 = sext i8 %44 to i32 ; [#uses=1] > + %46 = load i8* @uc, align 1 ; [#uses=1] > + %47 = zext i8 %46 to i32 ; [#uses=1] > + %48 = bitcast i8* bitcast (i32* @sl to i8*) to i32* ; [#uses=1] > + %49 = call i32 @llvm.atomic.cmp.swap.i32.p0i32(i32* %48, i32 %47, i32 %45) ; [#uses=1] > + store i32 %49, i32* @sl, align 4 > + %50 = load i8* @sc, align 1 ; [#uses=1] > + %51 = sext i8 %50 to i32 ; [#uses=1] > + %52 = load i8* @uc, align 1 ; [#uses=1] > + %53 = zext i8 %52 to i32 ; [#uses=1] > + %54 = bitcast i8* bitcast (i32* @ul to i8*) to i32* ; [#uses=1] > + %55 = call i32 @llvm.atomic.cmp.swap.i32.p0i32(i32* %54, i32 %53, i32 %51) ; [#uses=1] > + store i32 %55, i32* @ul, align 4 > + %56 = load i8* @sc, align 1 ; [#uses=1] > + %57 = zext i8 %56 to i32 ; [#uses=1] > + %58 = load i8* @uc, align 1 ; [#uses=1] > + %59 = zext i8 %58 to i32 ; [#uses=1] > + %60 = trunc i32 %59 to i8 ; [#uses=2] > + %61 = trunc i32 %57 to i8 ; [#uses=1] > + %62 = call i8 @llvm.atomic.cmp.swap.i8.p0i8(i8* @sc, i8 %60, i8 %61) ; [#uses=1] > + %63 = icmp eq i8 %62, %60 ; [#uses=1] > + %64 = zext i1 %63 to i8 ; [#uses=1] > + %65 = zext i8 %64 to i32 ; [#uses=1] > + store i32 %65, i32* @ui, align 4 > + %66 = load i8* @sc, align 1 ; [#uses=1] > + %67 = zext i8 %66 to i32 ; [#uses=1] > + %68 = load i8* @uc, align 1 ; [#uses=1] > + %69 = zext i8 %68 to i32 ; [#uses=1] > + %70 = trunc i32 %69 to i8 ; [#uses=2] > + %71 = trunc i32 %67 to i8 ; [#uses=1] > + %72 = call i8 @llvm.atomic.cmp.swap.i8.p0i8(i8* @uc, i8 %70, i8 %71) ; [#uses=1] > + %73 = icmp eq i8 %72, %70 ; [#uses=1] > + %74 = zext i1 %73 to i8 ; [#uses=1] > + %75 = zext i8 %74 to i32 ; [#uses=1] > + store i32 %75, i32* @ui, align 4 > + %76 = load i8* @sc, align 1 ; [#uses=1] > + %77 = sext i8 %76 to i16 ; [#uses=1] > + %78 = zext i16 %77 to i32 ; [#uses=1] > + %79 = load i8* @uc, align 1 ; [#uses=1] > + %80 = zext i8 %79 to i32 ; [#uses=1] > + %81 = bitcast i8* bitcast (i16* @ss to i8*) to i16* ; [#uses=1] > + %82 = trunc i32 %80 to i16 ; [#uses=2] > + %83 = trunc i32 %78 to i16 ; [#uses=1] > + %84 = call i16 @llvm.atomic.cmp.swap.i16.p0i16(i16* %81, i16 %82, i16 %83) ; [#uses=1] > + %85 = icmp eq i16 %84, %82 ; [#uses=1] > + %86 = zext i1 %85 to i8 ; [#uses=1] > + %87 = zext i8 %86 to i32 ; [#uses=1] > + store i32 %87, i32* @ui, align 4 > + %88 = load i8* @sc, align 1 ; [#uses=1] > + %89 = sext i8 %88 to i16 ; [#uses=1] > + %90 = zext i16 %89 to i32 ; [#uses=1] > + %91 = load i8* @uc, align 1 ; [#uses=1] > + %92 = zext i8 %91 to i32 ; [#uses=1] > + %93 = bitcast i8* bitcast (i16* @us to i8*) to i16* ; [#uses=1] > + %94 = trunc i32 %92 to i16 ; [#uses=2] > + %95 = trunc i32 %90 to i16 ; [#uses=1] > + %96 = call i16 @llvm.atomic.cmp.swap.i16.p0i16(i16* %93, i16 %94, i16 %95) ; [#uses=1] > + %97 = icmp eq i16 %96, %94 ; [#uses=1] > + %98 = zext i1 %97 to i8 ; [#uses=1] > + %99 = zext i8 %98 to i32 ; [#uses=1] > + store i32 %99, i32* @ui, align 4 > + %100 = load i8* @sc, align 1 ; [#uses=1] > + %101 = sext i8 %100 to i32 ; [#uses=1] > + %102 = load i8* @uc, align 1 ; [#uses=1] > + %103 = zext i8 %102 to i32 ; [#uses=2] > + %104 = bitcast i8* bitcast (i32* @si to i8*) to i32* ; [#uses=1] > + %105 = call i32 @llvm.atomic.cmp.swap.i32.p0i32(i32* %104, i32 %103, i32 %101) ; [#uses=1] > + %106 = icmp eq i32 %105, %103 ; [#uses=1] > + %107 = zext i1 %106 to i8 ; [#uses=1] > + %108 = zext i8 %107 to i32 ; [#uses=1] > + store i32 %108, i32* @ui, align 4 > + %109 = load i8* @sc, align 1 ; [#uses=1] > + %110 = sext i8 %109 to i32 ; [#uses=1] > + %111 = load i8* @uc, align 1 ; [#uses=1] > + %112 = zext i8 %111 to i32 ; [#uses=2] > + %113 = bitcast i8* bitcast (i32* @ui to i8*) to i32* ; [#uses=1] > + %114 = call i32 @llvm.atomic.cmp.swap.i32.p0i32(i32* %113, i32 %112, i32 %110) ; [#uses=1] > + %115 = icmp eq i32 %114, %112 ; [#uses=1] > + %116 = zext i1 %115 to i8 ; [#uses=1] > + %117 = zext i8 %116 to i32 ; [#uses=1] > + store i32 %117, i32* @ui, align 4 > + %118 = load i8* @sc, align 1 ; [#uses=1] > + %119 = sext i8 %118 to i32 ; [#uses=1] > + %120 = load i8* @uc, align 1 ; [#uses=1] > + %121 = zext i8 %120 to i32 ; [#uses=2] > + %122 = bitcast i8* bitcast (i32* @sl to i8*) to i32* ; [#uses=1] > + %123 = call i32 @llvm.atomic.cmp.swap.i32.p0i32(i32* %122, i32 %121, i32 %119) ; [#uses=1] > + %124 = icmp eq i32 %123, %121 ; [#uses=1] > + %125 = zext i1 %124 to i8 ; [#uses=1] > + %126 = zext i8 %125 to i32 ; [#uses=1] > + store i32 %126, i32* @ui, align 4 > + %127 = load i8* @sc, align 1 ; [#uses=1] > + %128 = sext i8 %127 to i32 ; [#uses=1] > + %129 = load i8* @uc, align 1 ; [#uses=1] > + %130 = zext i8 %129 to i32 ; [#uses=2] > + %131 = bitcast i8* bitcast (i32* @ul to i8*) to i32* ; [#uses=1] > + %132 = call i32 @llvm.atomic.cmp.swap.i32.p0i32(i32* %131, i32 %130, i32 %128) ; [#uses=1] > + %133 = icmp eq i32 %132, %130 ; [#uses=1] > + %134 = zext i1 %133 to i8 ; [#uses=1] > + %135 = zext i8 %134 to i32 ; [#uses=1] > + store i32 %135, i32* @ui, align 4 > + br label %return > + > +return: ; preds = %entry > + ret void > +} > + > +declare i8 @llvm.atomic.cmp.swap.i8.p0i8(i8*, i8, i8) nounwind > + > +declare i16 @llvm.atomic.cmp.swap.i16.p0i16(i16*, i16, i16) nounwind > + > +declare i32 @llvm.atomic.cmp.swap.i32.p0i32(i32*, i32, i32) nounwind > + > +define void @test_lock() nounwind { > +entry: > + %0 = call i8 @llvm.atomic.swap.i8.p0i8(i8* @sc, i8 1) ; [#uses=1] > + store i8 %0, i8* @sc, align 1 > + %1 = call i8 @llvm.atomic.swap.i8.p0i8(i8* @uc, i8 1) ; [#uses=1] > + store i8 %1, i8* @uc, align 1 > + %2 = bitcast i8* bitcast (i16* @ss to i8*) to i16* ; [#uses=1] > + %3 = call i16 @llvm.atomic.swap.i16.p0i16(i16* %2, i16 1) ; [#uses=1] > + store i16 %3, i16* @ss, align 2 > + %4 = bitcast i8* bitcast (i16* @us to i8*) to i16* ; [#uses=1] > + %5 = call i16 @llvm.atomic.swap.i16.p0i16(i16* %4, i16 1) ; [#uses=1] > + store i16 %5, i16* @us, align 2 > + %6 = bitcast i8* bitcast (i32* @si to i8*) to i32* ; [#uses=1] > + %7 = call i32 @llvm.atomic.swap.i32.p0i32(i32* %6, i32 1) ; [#uses=1] > + store i32 %7, i32* @si, align 4 > + %8 = bitcast i8* bitcast (i32* @ui to i8*) to i32* ; [#uses=1] > + %9 = call i32 @llvm.atomic.swap.i32.p0i32(i32* %8, i32 1) ; [#uses=1] > + store i32 %9, i32* @ui, align 4 > + %10 = bitcast i8* bitcast (i32* @sl to i8*) to i32* ; [#uses=1] > + %11 = call i32 @llvm.atomic.swap.i32.p0i32(i32* %10, i32 1) ; [#uses=1] > + store i32 %11, i32* @sl, align 4 > + %12 = bitcast i8* bitcast (i32* @ul to i8*) to i32* ; [#uses=1] > + %13 = call i32 @llvm.atomic.swap.i32.p0i32(i32* %12, i32 1) ; [#uses=1] > + store i32 %13, i32* @ul, align 4 > + call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 false) > + volatile store i8 0, i8* @sc, align 1 > + volatile store i8 0, i8* @uc, align 1 > + %14 = bitcast i8* bitcast (i16* @ss to i8*) to i16* ; [#uses=1] > + volatile store i16 0, i16* %14, align 2 > + %15 = bitcast i8* bitcast (i16* @us to i8*) to i16* ; [#uses=1] > + volatile store i16 0, i16* %15, align 2 > + %16 = bitcast i8* bitcast (i32* @si to i8*) to i32* ; [#uses=1] > + volatile store i32 0, i32* %16, align 4 > + %17 = bitcast i8* bitcast (i32* @ui to i8*) to i32* ; [#uses=1] > + volatile store i32 0, i32* %17, align 4 > + %18 = bitcast i8* bitcast (i32* @sl to i8*) to i32* ; [#uses=1] > + volatile store i32 0, i32* %18, align 4 > + %19 = bitcast i8* bitcast (i32* @ul to i8*) to i32* ; [#uses=1] > + volatile store i32 0, i32* %19, align 4 > + %20 = bitcast i8* bitcast (i64* @sll to i8*) to i64* ; [#uses=1] > + volatile store i64 0, i64* %20, align 8 > + %21 = bitcast i8* bitcast (i64* @ull to i8*) to i64* ; [#uses=1] > + volatile store i64 0, i64* %21, align 8 > + br label %return > + > +return: ; preds = %entry > + ret void > +} > + > +declare i8 @llvm.atomic.swap.i8.p0i8(i8*, i8) nounwind > + > +declare i16 @llvm.atomic.swap.i16.p0i16(i16*, i16) nounwind > + > +declare i32 @llvm.atomic.swap.i32.p0i32(i32*, i32) nounwind > + > +declare void @llvm.memory.barrier(i1, i1, i1, i1, i1) nounwind > > Modified: llvm/trunk/utils/TableGen/CodeGenInstruction.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenInstruction.cpp?rev=56963&r1=56962&r2=56963&view=diff > > ============================================================================== > --- llvm/trunk/utils/TableGen/CodeGenInstruction.cpp (original) > +++ llvm/trunk/utils/TableGen/CodeGenInstruction.cpp Thu Oct 2 13:53:47 2008 > @@ -21,7 +21,8 @@ > // FIXME: Only supports TIED_TO for now. > std::string::size_type pos = CStr.find_first_of('='); > assert(pos != std::string::npos && "Unrecognized constraint"); > - std::string Name = CStr.substr(0, pos); > + std::string::size_type start = CStr.find_first_not_of(" \t"); > + std::string Name = CStr.substr(start, pos); > > // TIED_TO: $src1 = $dst > std::string::size_type wpos = Name.find_first_of(" \t"); > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From anton at korobeynikov.info Fri Oct 3 05:06:05 2008 From: anton at korobeynikov.info (Anton Korobeynikov) Date: Fri, 3 Oct 2008 14:06:05 +0400 Subject: [llvm-commits] [llvm] r56988 - /llvm/trunk/tools/llvmc2/Makefile In-Reply-To: References: <200810030026.m930QnIO027541@zion.cs.uiuc.edu> Message-ID: > It was still failing for me. Go figure. Yeah, srcdir != objdir build was broken. Should be better now. -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University From foldr at codedgers.com Fri Oct 3 05:26:37 2008 From: foldr at codedgers.com (Mikhail Glushenkov) Date: Fri, 03 Oct 2008 10:26:37 -0000 Subject: [llvm-commits] [llvm] r56999 - in /llvm/trunk/tools/llvmc2: Makefile plugins/Base/Makefile plugins/Clang/Makefile plugins/Hello/Makefile plugins/Makefile plugins/Makefile.plugins Message-ID: <200810031026.m93AQbCI023215@zion.cs.uiuc.edu> Author: foldr Date: Fri Oct 3 05:26:37 2008 New Revision: 56999 URL: http://llvm.org/viewvc/llvm-project?rev=56999&view=rev Log: Fix build breakage when objdir!=srcdir (proper fix). Added: llvm/trunk/tools/llvmc2/plugins/Makefile - copied, changed from r56998, llvm/trunk/tools/llvmc2/plugins/Makefile.plugins Removed: llvm/trunk/tools/llvmc2/plugins/Makefile.plugins Modified: llvm/trunk/tools/llvmc2/Makefile llvm/trunk/tools/llvmc2/plugins/Base/Makefile llvm/trunk/tools/llvmc2/plugins/Clang/Makefile llvm/trunk/tools/llvmc2/plugins/Hello/Makefile Modified: llvm/trunk/tools/llvmc2/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/Makefile?rev=56999&r1=56998&r2=56999&view=diff ============================================================================== --- llvm/trunk/tools/llvmc2/Makefile (original) +++ llvm/trunk/tools/llvmc2/Makefile Fri Oct 3 05:26:37 2008 @@ -11,10 +11,9 @@ BUILTIN_PLUGINS = Base DRIVER_NAME = llvmc2 -DIRS = $(patsubst %,plugins/%,$(BUILTIN_PLUGINS)) src +DIRS = plugins src export BUILTIN_PLUGINS export DRIVER_NAME -export BUILTIN_LLVMC_PLUGIN=1 include $(LEVEL)/Makefile.common Modified: llvm/trunk/tools/llvmc2/plugins/Base/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/plugins/Base/Makefile?rev=56999&r1=56998&r2=56999&view=diff ============================================================================== --- llvm/trunk/tools/llvmc2/plugins/Base/Makefile (original) +++ llvm/trunk/tools/llvmc2/plugins/Base/Makefile Fri Oct 3 05:26:37 2008 @@ -9,4 +9,4 @@ LLVMC_PLUGIN = Base -include ../Makefile.plugins +include ../Makefile Modified: llvm/trunk/tools/llvmc2/plugins/Clang/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/plugins/Clang/Makefile?rev=56999&r1=56998&r2=56999&view=diff ============================================================================== --- llvm/trunk/tools/llvmc2/plugins/Clang/Makefile (original) +++ llvm/trunk/tools/llvmc2/plugins/Clang/Makefile Fri Oct 3 05:26:37 2008 @@ -9,5 +9,5 @@ LLVMC_PLUGIN = Clang -include ../Makefile.plugins +include ../Makefile Modified: llvm/trunk/tools/llvmc2/plugins/Hello/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/plugins/Hello/Makefile?rev=56999&r1=56998&r2=56999&view=diff ============================================================================== --- llvm/trunk/tools/llvmc2/plugins/Hello/Makefile (original) +++ llvm/trunk/tools/llvmc2/plugins/Hello/Makefile Fri Oct 3 05:26:37 2008 @@ -9,4 +9,4 @@ LLVMC_PLUGIN = Hello -include ../Makefile.plugins +include ../Makefile Copied: llvm/trunk/tools/llvmc2/plugins/Makefile (from r56998, llvm/trunk/tools/llvmc2/plugins/Makefile.plugins) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/plugins/Makefile?p2=llvm/trunk/tools/llvmc2/plugins/Makefile&p1=llvm/trunk/tools/llvmc2/plugins/Makefile.plugins&r1=56998&r2=56999&rev=56999&view=diff ============================================================================== --- llvm/trunk/tools/llvmc2/plugins/Makefile.plugins (original) +++ llvm/trunk/tools/llvmc2/plugins/Makefile Fri Oct 3 05:26:37 2008 @@ -7,11 +7,20 @@ # ##===----------------------------------------------------------------------===## -LEVEL = ../../../.. - ifndef LLVMC_PLUGIN -$(error LLVMC_PLUGIN variable is not defined!) -endif + +LEVEL = ../../.. +DIRS = $(BUILTIN_PLUGINS) + +# TOFIX: DSO versions of plugins are not built + +export BUILTIN_LLVMC_PLUGIN=1 + +include $(LEVEL)/Makefile.common + +else # LLVMC_PLUGIN + +LEVEL = ../../../.. LIBRARYNAME = $(patsubst %,LLVMC%,$(LLVMC_PLUGIN)) TOOLS_SOURCE = $(wildcard $(PROJ_SRC_DIR)/*.td) @@ -40,4 +49,6 @@ AutoGenerated.inc : $(ObjDir)/AutoGenerated.inc.tmp $(Verb) $(CMP) -s $@ $< || $(CP) $< $@ -endif +endif # BUILD_AUTOGENERATED_INC + +endif # LLVMC_PLUGIN Removed: llvm/trunk/tools/llvmc2/plugins/Makefile.plugins URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/plugins/Makefile.plugins?rev=56998&view=auto ============================================================================== --- llvm/trunk/tools/llvmc2/plugins/Makefile.plugins (original) +++ llvm/trunk/tools/llvmc2/plugins/Makefile.plugins (removed) @@ -1,43 +0,0 @@ -##===- tools/llvmc2/plugins/Makefile.plugins ----------------*- Makefile -*-===## -# -# The LLVM Compiler Infrastructure -# -# This file is distributed under the University of Illinois Open -# Source License. See LICENSE.TXT for details. -# -##===----------------------------------------------------------------------===## - -LEVEL = ../../../.. - -ifndef LLVMC_PLUGIN -$(error LLVMC_PLUGIN variable is not defined!) -endif - -LIBRARYNAME = $(patsubst %,LLVMC%,$(LLVMC_PLUGIN)) -TOOLS_SOURCE = $(wildcard $(PROJ_SRC_DIR)/*.td) -REQUIRES_EH = 1 - -ifndef BUILTIN_LLVMC_PLUGIN -LOADABLE_MODULE = 1 -endif - -ifneq ($(TOOLS_SOURCE),"") -BUILD_AUTOGENERATED_INC=1 -BUILT_SOURCES = AutoGenerated.inc -endif - -include $(LEVEL)/Makefile.common - -# TOFIX: This should go into Makefile.rules - -ifdef BUILD_AUTOGENERATED_INC -TD_COMMON = $(wildcard $(LLVM_SRC_ROOT)/include/llvm/CompilerDriver/*.td) - -$(ObjDir)/AutoGenerated.inc.tmp: $(TOOLS_SOURCE) $(ObjDir)/.dir \ - $(TBLGEN) $(TD_COMMON) - $(Echo) "Building LLVMC configuration library with tblgen" - $(Verb) $(TableGen) -gen-llvmc -o $(call SYSPATH, $@) $< - -AutoGenerated.inc : $(ObjDir)/AutoGenerated.inc.tmp - $(Verb) $(CMP) -s $@ $< || $(CP) $< $@ -endif From foldr at codedgers.com Fri Oct 3 05:27:24 2008 From: foldr at codedgers.com (Mikhail Glushenkov) Date: Fri, 03 Oct 2008 10:27:24 -0000 Subject: [llvm-commits] [llvm] r57000 - in /llvm/trunk/tools/llvmc2: Makefile core/ core/Action.cpp core/CompilationGraph.cpp core/Error.h core/Makefile core/Plugin.cpp core/llvmc.cpp src/Action.cpp src/CompilationGraph.cpp src/Error.h src/Makefile src/Plugin.cpp src/llvmc.cpp Message-ID: <200810031027.m93AROhL023262@zion.cs.uiuc.edu> Author: foldr Date: Fri Oct 3 05:27:23 2008 New Revision: 57000 URL: http://llvm.org/viewvc/llvm-project?rev=57000&view=rev Log: Rename llvmc2/src to llvmc2/core. Added: llvm/trunk/tools/llvmc2/core/ llvm/trunk/tools/llvmc2/core/Action.cpp - copied, changed from r56999, llvm/trunk/tools/llvmc2/src/Action.cpp llvm/trunk/tools/llvmc2/core/CompilationGraph.cpp - copied, changed from r56999, llvm/trunk/tools/llvmc2/src/CompilationGraph.cpp llvm/trunk/tools/llvmc2/core/Error.h - copied, changed from r56999, llvm/trunk/tools/llvmc2/src/Error.h llvm/trunk/tools/llvmc2/core/Makefile - copied, changed from r56999, llvm/trunk/tools/llvmc2/src/Makefile llvm/trunk/tools/llvmc2/core/Plugin.cpp - copied, changed from r56999, llvm/trunk/tools/llvmc2/src/Plugin.cpp llvm/trunk/tools/llvmc2/core/llvmc.cpp - copied, changed from r56999, llvm/trunk/tools/llvmc2/src/llvmc.cpp Removed: llvm/trunk/tools/llvmc2/src/Action.cpp llvm/trunk/tools/llvmc2/src/CompilationGraph.cpp llvm/trunk/tools/llvmc2/src/Error.h llvm/trunk/tools/llvmc2/src/Makefile llvm/trunk/tools/llvmc2/src/Plugin.cpp llvm/trunk/tools/llvmc2/src/llvmc.cpp Modified: llvm/trunk/tools/llvmc2/Makefile Modified: llvm/trunk/tools/llvmc2/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/Makefile?rev=57000&r1=56999&r2=57000&view=diff ============================================================================== --- llvm/trunk/tools/llvmc2/Makefile (original) +++ llvm/trunk/tools/llvmc2/Makefile Fri Oct 3 05:27:23 2008 @@ -11,7 +11,7 @@ BUILTIN_PLUGINS = Base DRIVER_NAME = llvmc2 -DIRS = plugins src +DIRS = plugins core export BUILTIN_PLUGINS export DRIVER_NAME Copied: llvm/trunk/tools/llvmc2/core/Action.cpp (from r56999, llvm/trunk/tools/llvmc2/src/Action.cpp) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/core/Action.cpp?p2=llvm/trunk/tools/llvmc2/core/Action.cpp&p1=llvm/trunk/tools/llvmc2/src/Action.cpp&r1=56999&r2=57000&rev=57000&view=diff ============================================================================== (empty) Copied: llvm/trunk/tools/llvmc2/core/CompilationGraph.cpp (from r56999, llvm/trunk/tools/llvmc2/src/CompilationGraph.cpp) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/core/CompilationGraph.cpp?p2=llvm/trunk/tools/llvmc2/core/CompilationGraph.cpp&p1=llvm/trunk/tools/llvmc2/src/CompilationGraph.cpp&r1=56999&r2=57000&rev=57000&view=diff ============================================================================== (empty) Copied: llvm/trunk/tools/llvmc2/core/Error.h (from r56999, llvm/trunk/tools/llvmc2/src/Error.h) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/core/Error.h?p2=llvm/trunk/tools/llvmc2/core/Error.h&p1=llvm/trunk/tools/llvmc2/src/Error.h&r1=56999&r2=57000&rev=57000&view=diff ============================================================================== (empty) Copied: llvm/trunk/tools/llvmc2/core/Makefile (from r56999, llvm/trunk/tools/llvmc2/src/Makefile) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/core/Makefile?p2=llvm/trunk/tools/llvmc2/core/Makefile&p1=llvm/trunk/tools/llvmc2/src/Makefile&r1=56999&r2=57000&rev=57000&view=diff ============================================================================== (empty) Copied: llvm/trunk/tools/llvmc2/core/Plugin.cpp (from r56999, llvm/trunk/tools/llvmc2/src/Plugin.cpp) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/core/Plugin.cpp?p2=llvm/trunk/tools/llvmc2/core/Plugin.cpp&p1=llvm/trunk/tools/llvmc2/src/Plugin.cpp&r1=56999&r2=57000&rev=57000&view=diff ============================================================================== (empty) Copied: llvm/trunk/tools/llvmc2/core/llvmc.cpp (from r56999, llvm/trunk/tools/llvmc2/src/llvmc.cpp) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/core/llvmc.cpp?p2=llvm/trunk/tools/llvmc2/core/llvmc.cpp&p1=llvm/trunk/tools/llvmc2/src/llvmc.cpp&r1=56999&r2=57000&rev=57000&view=diff ============================================================================== (empty) Removed: llvm/trunk/tools/llvmc2/src/Action.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/src/Action.cpp?rev=56999&view=auto ============================================================================== --- llvm/trunk/tools/llvmc2/src/Action.cpp (original) +++ llvm/trunk/tools/llvmc2/src/Action.cpp (removed) @@ -1,78 +0,0 @@ -//===--- Action.cpp - The LLVM Compiler Driver ------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open -// Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// Action class - implementation and auxiliary functions. -// -//===----------------------------------------------------------------------===// - -#include "llvm/CompilerDriver/Action.h" - -#include "llvm/Support/CommandLine.h" -#include "llvm/System/Program.h" - -#include -#include - -using namespace llvm; -using namespace llvmc; - -extern cl::opt DryRun; -extern cl::opt VerboseMode; - -namespace { - int ExecuteProgram(const std::string& name, - const StrVector& args) { - sys::Path prog = sys::Program::FindProgramByName(name); - - if (prog.isEmpty()) - throw std::runtime_error("Can't find program '" + name + "'"); - if (!prog.canExecute()) - throw std::runtime_error("Program '" + name + "' is not executable."); - - // Build the command line vector and the redirects array. - const sys::Path* redirects[3] = {0,0,0}; - sys::Path stdout_redirect; - - std::vector argv; - argv.reserve((args.size()+2)); - argv.push_back(name.c_str()); - - for (StrVector::const_iterator B = args.begin(), E = args.end(); - B!=E; ++B) { - if (*B == ">") { - ++B; - stdout_redirect.set(*B); - redirects[1] = &stdout_redirect; - } - else { - argv.push_back((*B).c_str()); - } - } - argv.push_back(0); // null terminate list. - - // Invoke the program. - return sys::Program::ExecuteAndWait(prog, &argv[0], 0, &redirects[0]); - } - - void print_string (const std::string& str) { - std::cerr << str << ' '; - } -} - -int llvmc::Action::Execute() const { - if (DryRun || VerboseMode) { - std::cerr << Command_ << " "; - std::for_each(Args_.begin(), Args_.end(), print_string); - std::cerr << '\n'; - } - if (DryRun) - return 0; - else - return ExecuteProgram(Command_, Args_); -} Removed: llvm/trunk/tools/llvmc2/src/CompilationGraph.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/src/CompilationGraph.cpp?rev=56999&view=auto ============================================================================== --- llvm/trunk/tools/llvmc2/src/CompilationGraph.cpp (original) +++ llvm/trunk/tools/llvmc2/src/CompilationGraph.cpp (removed) @@ -1,442 +0,0 @@ -//===--- CompilationGraph.cpp - The LLVM Compiler Driver --------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open -// Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// Compilation graph - implementation. -// -//===----------------------------------------------------------------------===// - -#include "Error.h" -#include "llvm/CompilerDriver/CompilationGraph.h" - -#include "llvm/ADT/STLExtras.h" -#include "llvm/Support/CommandLine.h" -#include "llvm/Support/DOTGraphTraits.h" -#include "llvm/Support/GraphWriter.h" - -#include -#include -#include -#include -#include - -using namespace llvm; -using namespace llvmc; - -extern cl::list InputFilenames; -extern cl::opt OutputFilename; -extern cl::list Languages; - -namespace llvmc { - - const std::string& LanguageMap::GetLanguage(const sys::Path& File) const { - LanguageMap::const_iterator Lang = this->find(File.getSuffix()); - if (Lang == this->end()) - throw std::runtime_error("Unknown suffix: " + File.getSuffix()); - return Lang->second; - } -} - -namespace { - - /// ChooseEdge - Return the edge with the maximum weight. - template - const Edge* ChooseEdge(const C& EdgesContainer, - const InputLanguagesSet& InLangs, - const std::string& NodeName = "root") { - const Edge* MaxEdge = 0; - unsigned MaxWeight = 0; - bool SingleMax = true; - - for (typename C::const_iterator B = EdgesContainer.begin(), - E = EdgesContainer.end(); B != E; ++B) { - const Edge* e = B->getPtr(); - unsigned EW = e->Weight(InLangs); - if (EW > MaxWeight) { - MaxEdge = e; - MaxWeight = EW; - SingleMax = true; - } else if (EW == MaxWeight) { - SingleMax = false; - } - } - - if (!SingleMax) - throw std::runtime_error("Node " + NodeName + - ": multiple maximal outward edges found!" - " Most probably a specification error."); - if (!MaxEdge) - throw std::runtime_error("Node " + NodeName + - ": no maximal outward edge found!" - " Most probably a specification error."); - return MaxEdge; - } - -} - -CompilationGraph::CompilationGraph() { - NodesMap["root"] = Node(this); -} - -Node& CompilationGraph::getNode(const std::string& ToolName) { - nodes_map_type::iterator I = NodesMap.find(ToolName); - if (I == NodesMap.end()) - throw std::runtime_error("Node " + ToolName + " is not in the graph"); - return I->second; -} - -const Node& CompilationGraph::getNode(const std::string& ToolName) const { - nodes_map_type::const_iterator I = NodesMap.find(ToolName); - if (I == NodesMap.end()) - throw std::runtime_error("Node " + ToolName + " is not in the graph!"); - return I->second; -} - -// Find the tools list corresponding to the given language name. -const CompilationGraph::tools_vector_type& -CompilationGraph::getToolsVector(const std::string& LangName) const -{ - tools_map_type::const_iterator I = ToolsMap.find(LangName); - if (I == ToolsMap.end()) - throw std::runtime_error("No tool corresponding to the language " - + LangName + " found"); - return I->second; -} - -void CompilationGraph::insertNode(Tool* V) { - if (NodesMap.count(V->Name()) == 0) { - Node N; - N.OwningGraph = this; - N.ToolPtr = V; - NodesMap[V->Name()] = N; - } -} - -void CompilationGraph::insertEdge(const std::string& A, Edge* Edg) { - Node& B = getNode(Edg->ToolName()); - if (A == "root") { - const char** InLangs = B.ToolPtr->InputLanguages(); - for (;*InLangs; ++InLangs) - ToolsMap[*InLangs].push_back(IntrusiveRefCntPtr(Edg)); - NodesMap["root"].AddEdge(Edg); - } - else { - Node& N = getNode(A); - N.AddEdge(Edg); - } - // Increase the inward edge counter. - B.IncrInEdges(); -} - -namespace { - sys::Path MakeTempFile(const sys::Path& TempDir, const std::string& BaseName, - const std::string& Suffix) { - sys::Path Out; - - // Make sure we don't end up with path names like '/file.o' if the - // TempDir is empty. - if (TempDir.empty()) { - Out.set(BaseName); - } - else { - Out = TempDir; - Out.appendComponent(BaseName); - } - Out.appendSuffix(Suffix); - // NOTE: makeUnique always *creates* a unique temporary file, - // which is good, since there will be no races. However, some - // tools do not like it when the output file already exists, so - // they have to be placated with -f or something like that. - Out.makeUnique(true, NULL); - return Out; - } -} - -// Pass input file through the chain until we bump into a Join node or -// a node that says that it is the last. -void CompilationGraph::PassThroughGraph (const sys::Path& InFile, - const Node* StartNode, - const InputLanguagesSet& InLangs, - const sys::Path& TempDir, - const LanguageMap& LangMap) const { - bool Last = false; - sys::Path In = InFile; - const Node* CurNode = StartNode; - - while(!Last) { - sys::Path Out; - Tool* CurTool = CurNode->ToolPtr.getPtr(); - - if (CurTool->IsJoin()) { - JoinTool& JT = dynamic_cast(*CurTool); - JT.AddToJoinList(In); - break; - } - - // Since toolchains do not have to end with a Join node, we should - // check if this Node is the last. - if (!CurNode->HasChildren() || CurTool->IsLast()) { - if (!OutputFilename.empty()) { - Out.set(OutputFilename); - } - else { - Out.set(In.getBasename()); - Out.appendSuffix(CurTool->OutputSuffix()); - } - Last = true; - } - else { - Out = MakeTempFile(TempDir, In.getBasename(), CurTool->OutputSuffix()); - } - - if (int ret = CurTool->GenerateAction(In, Out, InLangs, LangMap).Execute()) - throw error_code(ret); - - if (Last) - return; - - CurNode = &getNode(ChooseEdge(CurNode->OutEdges, - InLangs, - CurNode->Name())->ToolName()); - In = Out; Out.clear(); - } -} - -// Find the head of the toolchain corresponding to the given file. -// Also, insert an input language into InLangs. -const Node* CompilationGraph:: -FindToolChain(const sys::Path& In, const std::string* ForceLanguage, - InputLanguagesSet& InLangs, const LanguageMap& LangMap) const { - - // Determine the input language. - const std::string& InLanguage = - ForceLanguage ? *ForceLanguage : LangMap.GetLanguage(In); - - // Add the current input language to the input language set. - InLangs.insert(InLanguage); - - // Find the toolchain for the input language. - const tools_vector_type& TV = getToolsVector(InLanguage); - if (TV.empty()) - throw std::runtime_error("No toolchain corresponding to language " - + InLanguage + " found"); - return &getNode(ChooseEdge(TV, InLangs)->ToolName()); -} - -// Helper function used by Build(). -// Traverses initial portions of the toolchains (up to the first Join node). -// This function is also responsible for handling the -x option. -void CompilationGraph::BuildInitial (InputLanguagesSet& InLangs, - const sys::Path& TempDir, - const LanguageMap& LangMap) { - // This is related to -x option handling. - cl::list::const_iterator xIter = Languages.begin(), - xBegin = xIter, xEnd = Languages.end(); - bool xEmpty = true; - const std::string* xLanguage = 0; - unsigned xPos = 0, xPosNext = 0, filePos = 0; - - if (xIter != xEnd) { - xEmpty = false; - xPos = Languages.getPosition(xIter - xBegin); - cl::list::const_iterator xNext = llvm::next(xIter); - xPosNext = (xNext == xEnd) ? std::numeric_limits::max() - : Languages.getPosition(xNext - xBegin); - xLanguage = (*xIter == "none") ? 0 : &(*xIter); - } - - // For each input file: - for (cl::list::const_iterator B = InputFilenames.begin(), - CB = B, E = InputFilenames.end(); B != E; ++B) { - sys::Path In = sys::Path(*B); - - // Code for handling the -x option. - // Output: std::string* xLanguage (can be NULL). - if (!xEmpty) { - filePos = InputFilenames.getPosition(B - CB); - - if (xPos < filePos) { - if (filePos < xPosNext) { - xLanguage = (*xIter == "none") ? 0 : &(*xIter); - } - else { // filePos >= xPosNext - // Skip xIters while filePos > xPosNext - while (filePos > xPosNext) { - ++xIter; - xPos = xPosNext; - - cl::list::const_iterator xNext = llvm::next(xIter); - if (xNext == xEnd) - xPosNext = std::numeric_limits::max(); - else - xPosNext = Languages.getPosition(xNext - xBegin); - xLanguage = (*xIter == "none") ? 0 : &(*xIter); - } - } - } - } - - // Find the toolchain corresponding to this file. - const Node* N = FindToolChain(In, xLanguage, InLangs, LangMap); - // Pass file through the chain starting at head. - PassThroughGraph(In, N, InLangs, TempDir, LangMap); - } -} - -// Sort the nodes in topological order. -void CompilationGraph::TopologicalSort(std::vector& Out) { - std::queue Q; - Q.push(&getNode("root")); - - while (!Q.empty()) { - const Node* A = Q.front(); - Q.pop(); - Out.push_back(A); - for (Node::const_iterator EB = A->EdgesBegin(), EE = A->EdgesEnd(); - EB != EE; ++EB) { - Node* B = &getNode((*EB)->ToolName()); - B->DecrInEdges(); - if (B->HasNoInEdges()) - Q.push(B); - } - } -} - -namespace { - bool NotJoinNode(const Node* N) { - return N->ToolPtr ? !N->ToolPtr->IsJoin() : true; - } -} - -// Call TopologicalSort and filter the resulting list to include -// only Join nodes. -void CompilationGraph:: -TopologicalSortFilterJoinNodes(std::vector& Out) { - std::vector TopSorted; - TopologicalSort(TopSorted); - std::remove_copy_if(TopSorted.begin(), TopSorted.end(), - std::back_inserter(Out), NotJoinNode); -} - -int CompilationGraph::Build (const sys::Path& TempDir, - const LanguageMap& LangMap) { - - InputLanguagesSet InLangs; - - // Traverse initial parts of the toolchains and fill in InLangs. - BuildInitial(InLangs, TempDir, LangMap); - - std::vector JTV; - TopologicalSortFilterJoinNodes(JTV); - - // For all join nodes in topological order: - for (std::vector::iterator B = JTV.begin(), E = JTV.end(); - B != E; ++B) { - - sys::Path Out; - const Node* CurNode = *B; - JoinTool* JT = &dynamic_cast(*CurNode->ToolPtr.getPtr()); - bool IsLast = false; - - // Are there any files in the join list? - if (JT->JoinListEmpty()) - continue; - - // Is this the last tool in the toolchain? - // NOTE: we can process several toolchains in parallel. - if (!CurNode->HasChildren() || JT->IsLast()) { - if (OutputFilename.empty()) { - Out.set("a"); - Out.appendSuffix(JT->OutputSuffix()); - } - else - Out.set(OutputFilename); - IsLast = true; - } - else { - Out = MakeTempFile(TempDir, "tmp", JT->OutputSuffix()); - } - - if (int ret = JT->GenerateAction(Out, InLangs, LangMap).Execute()) - throw error_code(ret); - - if (!IsLast) { - const Node* NextNode = - &getNode(ChooseEdge(CurNode->OutEdges, InLangs, - CurNode->Name())->ToolName()); - PassThroughGraph(Out, NextNode, InLangs, TempDir, LangMap); - } - } - - return 0; -} - -// Code related to graph visualization. - -namespace llvm { - template <> - struct DOTGraphTraits - : public DefaultDOTGraphTraits - { - - template - static std::string getNodeLabel(const Node* N, const GraphType&) - { - if (N->ToolPtr) - if (N->ToolPtr->IsJoin()) - return N->Name() + "\n (join" + - (N->HasChildren() ? ")" - : std::string(": ") + N->ToolPtr->OutputLanguage() + ')'); - else - return N->Name(); - else - return "root"; - } - - template - static std::string getEdgeSourceLabel(const Node* N, EdgeIter I) { - if (N->ToolPtr) { - return N->ToolPtr->OutputLanguage(); - } - else { - const char** InLangs = I->ToolPtr->InputLanguages(); - std::string ret; - - for (; *InLangs; ++InLangs) { - if (*(InLangs + 1)) { - ret += *InLangs; - ret += ", "; - } - else { - ret += *InLangs; - } - } - - return ret; - } - } - }; - -} - -void CompilationGraph::writeGraph() { - std::ofstream O("compilation-graph.dot"); - - if (O.good()) { - llvm::WriteGraph(this, "compilation-graph"); - O.close(); - } - else { - throw std::runtime_error("Error opening file 'compilation-graph.dot'" - " for writing!"); - } -} - -void CompilationGraph::viewGraph() { - llvm::ViewGraph(this, "compilation-graph"); -} Removed: llvm/trunk/tools/llvmc2/src/Error.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/src/Error.h?rev=56999&view=auto ============================================================================== --- llvm/trunk/tools/llvmc2/src/Error.h (original) +++ llvm/trunk/tools/llvmc2/src/Error.h (removed) @@ -1,33 +0,0 @@ -//===--- Error.h - The LLVM Compiler Driver ---------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open -// Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// Exception classes for LLVMC. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_TOOLS_LLVMC2_ERROR_H -#define LLVM_TOOLS_LLVMC2_ERROR_H - -#include - -namespace llvmc { - - class error_code: public std::runtime_error { - int Code_; - public: - error_code (int c) - : std::runtime_error("Tool returned error code"), Code_(c) - {} - - int code() const { return Code_; } - }; - -} - -#endif //LLVM_TOOLS_LLVMC2_ERROR_H Removed: llvm/trunk/tools/llvmc2/src/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/src/Makefile?rev=56999&view=auto ============================================================================== --- llvm/trunk/tools/llvmc2/src/Makefile (original) +++ llvm/trunk/tools/llvmc2/src/Makefile (removed) @@ -1,19 +0,0 @@ -##===- tools/llvmc2/src/Makefile ---------------------------*- Makefile -*-===## -# -# The LLVM Compiler Infrastructure -# -# This file is distributed under the University of Illinois Open -# Source License. See LICENSE.TXT for details. -# -##===----------------------------------------------------------------------===## - -LEVEL = ../../.. -TOOLNAME = $(DRIVER_NAME) -LINK_COMPONENTS = support system -REQUIRES_EH := 1 - -ifneq ($(BUILTIN_PLUGINS),) -USEDLIBS = $(patsubst %,LLVMC%,$(BUILTIN_PLUGINS)) -endif - -include $(LEVEL)/Makefile.common Removed: llvm/trunk/tools/llvmc2/src/Plugin.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/src/Plugin.cpp?rev=56999&view=auto ============================================================================== --- llvm/trunk/tools/llvmc2/src/Plugin.cpp (original) +++ llvm/trunk/tools/llvmc2/src/Plugin.cpp (removed) @@ -1,64 +0,0 @@ -//===--- Plugin.cpp - The LLVM Compiler Driver ------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open -// Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// Plugin support for llvmc2. -// -//===----------------------------------------------------------------------===// - -#include "llvm/CompilerDriver/Plugin.h" - -#include - -namespace { - - // Registry::Add<> does not do lifetime management (probably issues - // with static constructor/destructor ordering), so we have to - // implement it here. - // - // All this static registration/life-before-main model seems - // unnecessary convoluted to me. - - static bool pluginListInitialized = false; - typedef std::vector PluginList; - static PluginList Plugins; -} - -namespace llvmc { - - PluginLoader::PluginLoader() { - if (!pluginListInitialized) { - for (PluginRegistry::iterator B = PluginRegistry::begin(), - E = PluginRegistry::end(); B != E; ++B) - Plugins.push_back(B->instantiate()); - } - pluginListInitialized = true; - } - - PluginLoader::~PluginLoader() { - if (pluginListInitialized) { - for (PluginList::iterator B = Plugins.begin(), E = Plugins.end(); - B != E; ++B) - delete (*B); - } - pluginListInitialized = false; - } - - void PluginLoader::PopulateLanguageMap(LanguageMap& langMap) { - for (PluginList::iterator B = Plugins.begin(), E = Plugins.end(); - B != E; ++B) - (*B)->PopulateLanguageMap(langMap); - } - - void PluginLoader::PopulateCompilationGraph(CompilationGraph& graph) { - for (PluginList::iterator B = Plugins.begin(), E = Plugins.end(); - B != E; ++B) - (*B)->PopulateCompilationGraph(graph); - } - -} Removed: llvm/trunk/tools/llvmc2/src/llvmc.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/src/llvmc.cpp?rev=56999&view=auto ============================================================================== --- llvm/trunk/tools/llvmc2/src/llvmc.cpp (original) +++ llvm/trunk/tools/llvmc2/src/llvmc.cpp (removed) @@ -1,119 +0,0 @@ -//===--- llvmc.cpp - The LLVM Compiler Driver -------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open -// Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This tool provides a single point of access to the LLVM -// compilation tools. It has many options. To discover the options -// supported please refer to the tools' manual page or run the tool -// with the --help option. -// -//===----------------------------------------------------------------------===// - -#include "Error.h" - -#include "llvm/CompilerDriver/CompilationGraph.h" -#include "llvm/CompilerDriver/Plugin.h" - -#include "llvm/System/Path.h" -#include "llvm/Support/CommandLine.h" -#include "llvm/Support/PluginLoader.h" - -#include -#include -#include - -namespace cl = llvm::cl; -namespace sys = llvm::sys; -using namespace llvmc; - -// Built-in command-line options. -// External linkage here is intentional. - -cl::list InputFilenames(cl::Positional, cl::desc(""), - cl::ZeroOrMore); -cl::opt OutputFilename("o", cl::desc("Output file name"), - cl::value_desc("file")); -cl::list Languages("x", - cl::desc("Specify the language of the following input files"), - cl::ZeroOrMore); -cl::opt DryRun("dry-run", - cl::desc("Only pretend to run commands")); -cl::opt VerboseMode("v", - cl::desc("Enable verbose mode")); -cl::opt WriteGraph("write-graph", - cl::desc("Write compilation-graph.dot file"), - cl::Hidden); -cl::opt ViewGraph("view-graph", - cl::desc("Show compilation graph in GhostView"), - cl::Hidden); -cl::opt SaveTemps("save-temps", - cl::desc("Keep temporary files"), - cl::Hidden); - -namespace { - /// BuildTargets - A small wrapper for CompilationGraph::Build. - int BuildTargets(CompilationGraph& graph, const LanguageMap& langMap) { - int ret; - const sys::Path& tempDir = SaveTemps - ? sys::Path("") - : sys::Path(sys::Path::GetTemporaryDirectory()); - - try { - ret = graph.Build(tempDir, langMap); - } - catch(...) { - tempDir.eraseFromDisk(true); - throw; - } - - if (!SaveTemps) - tempDir.eraseFromDisk(true); - return ret; - } -} - -int main(int argc, char** argv) { - try { - LanguageMap langMap; - CompilationGraph graph; - - cl::ParseCommandLineOptions - (argc, argv, "LLVM Compiler Driver (Work In Progress)", true); - - PluginLoader Plugins; - Plugins.PopulateLanguageMap(langMap); - Plugins.PopulateCompilationGraph(graph); - - if (WriteGraph) { - graph.writeGraph(); - if (!ViewGraph) - return 0; - } - - if (ViewGraph) { - graph.viewGraph(); - return 0; - } - - if (InputFilenames.empty()) { - throw std::runtime_error("no input files"); - } - - return BuildTargets(graph, langMap); - } - catch(llvmc::error_code& ec) { - return ec.code(); - } - catch(const std::exception& ex) { - std::cerr << argv[0] << ": " << ex.what() << '\n'; - } - catch(...) { - std::cerr << argv[0] << ": unknown error!\n"; - } - return 1; -} From nicolas.geoffray at lip6.fr Fri Oct 3 07:34:24 2008 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Fri, 03 Oct 2008 14:34:24 +0200 Subject: [llvm-commits] [llvm] r56963 - in /llvm/trunk: lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/Target/X86/X86ISelDAGToDAG.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86InstrInfo.td test/CodeGen/X86/2008-10-02-Atomics32-2.ll utils/TableGen/CodeGenInstruction.cpp In-Reply-To: <48E5E56E.6060402@lip6.fr> References: <200810021853.m92Irlwg015711@zion.cs.uiuc.edu> <48E5E56E.6060402@lip6.fr> Message-ID: <48E61150.7010707@lip6.fr> Forgot to say that I tried compiling @func on on x86-32. Compilation works fine for x86-64. Nicolas From nunoplopes at sapo.pt Fri Oct 3 10:17:20 2008 From: nunoplopes at sapo.pt (Nuno Lopes) Date: Fri, 3 Oct 2008 16:17:20 +0100 Subject: [llvm-commits] [llvm] r56887 - /llvm/trunk/lib/Transforms/IPO/Internalize.cpp In-Reply-To: <200810030936.56837.baldrick@free.fr> References: <200809302204.m8UM4V8b007868@zion.cs.uiuc.edu> <200810011119.06165.baldrick@free.fr> <30424DD75D784EEBBC3F2AC796215709@pc07654> <200810030936.56837.baldrick@free.fr> Message-ID: >> > That said, it would be easy to update the callgraph. >> >> I guess that would go beyond my current knowledge of llvm :P > > I've taught Internalize to update the callgraph, and reapplied > your patch. Thank you! Nuno From nunoplopes at sapo.pt Fri Oct 3 10:44:21 2008 From: nunoplopes at sapo.pt (Nuno Lopes) Date: Fri, 03 Oct 2008 15:44:21 -0000 Subject: [llvm-commits] [llvm] r57005 - /llvm/trunk/lib/AsmParser/llvmAsmParser.y Message-ID: <200810031544.m93FiL04001492@zion.cs.uiuc.edu> Author: nlopes Date: Fri Oct 3 10:44:21 2008 New Revision: 57005 URL: http://llvm.org/viewvc/llvm-project?rev=57005&view=rev Log: fix memleak in FunctionHeaderH Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.y Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.y URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.y?rev=57005&r1=57004&r2=57005&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/llvmAsmParser.y (original) +++ llvm/trunk/lib/AsmParser/llvmAsmParser.y Fri Oct 3 10:44:21 2008 @@ -2420,6 +2420,7 @@ InsertValue(Fn, CurModule.Values); } + ID.destroy(); CurFun.FunctionStart(Fn); if (CurFun.isDeclare) { From gohman at apple.com Fri Oct 3 10:45:37 2008 From: gohman at apple.com (Dan Gohman) Date: Fri, 03 Oct 2008 15:45:37 -0000 Subject: [llvm-commits] [llvm] r57006 - in /llvm/trunk: include/llvm/CodeGen/ lib/CodeGen/ lib/CodeGen/AsmPrinter/ lib/ExecutionEngine/JIT/ lib/Target/ARM/ lib/Target/ARM/AsmPrinter/ lib/Target/Alpha/ lib/Target/CellSPU/ lib/Target/IA64/ lib/Target/Mips/ lib/Target/PIC16/ lib/Target/PowerPC/ lib/Target/PowerPC/AsmPrinter/ lib/Target/Sparc/ lib/Target/X86/ lib/Target/X86/AsmPrinter/ Message-ID: <200810031545.m93Fjdq9001609@zion.cs.uiuc.edu> Author: djg Date: Fri Oct 3 10:45:36 2008 New Revision: 57006 URL: http://llvm.org/viewvc/llvm-project?rev=57006&view=rev Log: Switch the MachineOperand accessors back to the short names like isReg, etc., from isRegister, etc. Modified: llvm/trunk/include/llvm/CodeGen/BreakCriticalMachineEdge.h llvm/trunk/include/llvm/CodeGen/LiveVariables.h llvm/trunk/include/llvm/CodeGen/MachineLocation.h llvm/trunk/include/llvm/CodeGen/MachineOperand.h llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp llvm/trunk/lib/CodeGen/BranchFolding.cpp llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp llvm/trunk/lib/CodeGen/LiveVariables.cpp llvm/trunk/lib/CodeGen/LowerSubregs.cpp llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp llvm/trunk/lib/CodeGen/MachineInstr.cpp llvm/trunk/lib/CodeGen/MachineLICM.cpp llvm/trunk/lib/CodeGen/MachineSink.cpp llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp llvm/trunk/lib/CodeGen/RegAllocBigBlock.cpp llvm/trunk/lib/CodeGen/RegAllocLocal.cpp llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp llvm/trunk/lib/CodeGen/RegAllocSimple.cpp llvm/trunk/lib/CodeGen/RegisterScavenging.cpp llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp llvm/trunk/lib/CodeGen/StackSlotColoring.cpp llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp llvm/trunk/lib/CodeGen/TargetInstrInfoImpl.cpp llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp llvm/trunk/lib/CodeGen/UnreachableBlockElim.cpp llvm/trunk/lib/CodeGen/VirtRegMap.cpp llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp llvm/trunk/lib/Target/ARM/ARMRegisterInfo.cpp llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp llvm/trunk/lib/Target/Alpha/AlphaAsmPrinter.cpp llvm/trunk/lib/Target/Alpha/AlphaCodeEmitter.cpp llvm/trunk/lib/Target/Alpha/AlphaInstrInfo.cpp llvm/trunk/lib/Target/Alpha/AlphaRegisterInfo.cpp llvm/trunk/lib/Target/CellSPU/SPUAsmPrinter.cpp llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.cpp llvm/trunk/lib/Target/CellSPU/SPURegisterInfo.cpp llvm/trunk/lib/Target/IA64/IA64AsmPrinter.cpp llvm/trunk/lib/Target/IA64/IA64Bundling.cpp llvm/trunk/lib/Target/IA64/IA64InstrInfo.cpp llvm/trunk/lib/Target/IA64/IA64RegisterInfo.cpp llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp llvm/trunk/lib/Target/Mips/MipsInstrInfo.cpp llvm/trunk/lib/Target/Mips/MipsRegisterInfo.cpp llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp llvm/trunk/lib/Target/PIC16/PIC16InstrInfo.cpp llvm/trunk/lib/Target/PIC16/PIC16RegisterInfo.cpp llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp llvm/trunk/lib/Target/PowerPC/PPCBranchSelector.cpp llvm/trunk/lib/Target/PowerPC/PPCCodeEmitter.cpp llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.cpp llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp llvm/trunk/lib/Target/Sparc/SparcAsmPrinter.cpp llvm/trunk/lib/Target/Sparc/SparcInstrInfo.cpp llvm/trunk/lib/Target/Sparc/SparcRegisterInfo.cpp llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.h llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/Target/X86/X86InstrInfo.cpp llvm/trunk/lib/Target/X86/X86InstrInfo.h llvm/trunk/lib/Target/X86/X86MachineFunctionInfo.h llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Modified: llvm/trunk/include/llvm/CodeGen/BreakCriticalMachineEdge.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/BreakCriticalMachineEdge.h?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/BreakCriticalMachineEdge.h (original) +++ llvm/trunk/include/llvm/CodeGen/BreakCriticalMachineEdge.h Fri Oct 3 10:45:36 2008 @@ -57,8 +57,7 @@ // crit_mbb. for (unsigned i = 0, e = mii->getNumOperands(); i != e; ++i) { MachineOperand & mo = mii->getOperand(i); - if (mo.isMachineBasicBlock() && - mo.getMBB() == dst) { + if (mo.isMBB() && mo.getMBB() == dst) { found_branch = true; mo.setMBB(crit_mbb); } @@ -84,7 +83,7 @@ std::vector toRemove; unsigned reg = 0; for (unsigned u = 0; u != mii->getNumOperands(); ++u) - if (mii->getOperand(u).isMachineBasicBlock() && + if (mii->getOperand(u).isMBB() && mii->getOperand(u).getMBB() == src) { reg = mii->getOperand(u-1).getReg(); toRemove.push_back(u-1); Modified: llvm/trunk/include/llvm/CodeGen/LiveVariables.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveVariables.h?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/LiveVariables.h (original) +++ llvm/trunk/include/llvm/CodeGen/LiveVariables.h Fri Oct 3 10:45:36 2008 @@ -203,7 +203,7 @@ bool Removed = false; for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { MachineOperand &MO = MI->getOperand(i); - if (MO.isRegister() && MO.isKill() && MO.getReg() == reg) { + if (MO.isReg() && MO.isKill() && MO.getReg() == reg) { MO.setIsKill(false); Removed = true; break; @@ -238,7 +238,7 @@ bool Removed = false; for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { MachineOperand &MO = MI->getOperand(i); - if (MO.isRegister() && MO.isDef() && MO.getReg() == reg) { + if (MO.isReg() && MO.isDef() && MO.getReg() == reg) { MO.setIsDead(false); Removed = true; break; Modified: llvm/trunk/include/llvm/CodeGen/MachineLocation.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineLocation.h?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineLocation.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineLocation.h Fri Oct 3 10:45:36 2008 @@ -52,8 +52,8 @@ {} // Accessors - bool isRegister() const { return IsRegister; } - unsigned getRegister() const { return Register; } + bool isReg() const { return IsRegister; } + unsigned getReg() const { return Register; } int getOffset() const { return Offset; } void setIsRegister(bool Is) { IsRegister = Is; } void setRegister(unsigned R) { Register = R; } Modified: llvm/trunk/include/llvm/CodeGen/MachineOperand.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineOperand.h?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineOperand.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineOperand.h Fri Oct 3 10:45:36 2008 @@ -125,17 +125,28 @@ void print(std::ostream &os, const TargetMachine *TM = 0) const; void print(raw_ostream &os, const TargetMachine *TM = 0) const; - /// Accessors that tell you what kind of MachineOperand you're looking at. - /// - bool isRegister() const { return OpKind == MO_Register; } - bool isImmediate() const { return OpKind == MO_Immediate; } - bool isFPImmediate() const { return OpKind == MO_FPImmediate; } - bool isMachineBasicBlock() const { return OpKind == MO_MachineBasicBlock; } - bool isFrameIndex() const { return OpKind == MO_FrameIndex; } - bool isConstantPoolIndex() const { return OpKind == MO_ConstantPoolIndex; } - bool isJumpTableIndex() const { return OpKind == MO_JumpTableIndex; } - bool isGlobalAddress() const { return OpKind == MO_GlobalAddress; } - bool isExternalSymbol() const { return OpKind == MO_ExternalSymbol; } + //===--------------------------------------------------------------------===// + // Accessors that tell you what kind of MachineOperand you're looking at. + //===--------------------------------------------------------------------===// + + /// isReg - Tests if this is a MO_Register operand. + bool isReg() const { return OpKind == MO_Register; } + /// isImm - Tests if this is a MO_Immediate operand. + bool isImm() const { return OpKind == MO_Immediate; } + /// isFPImm - Tests if this is a MO_FPImmediate operand. + bool isFPImm() const { return OpKind == MO_FPImmediate; } + /// isMBB - Tests if this is a MO_MachineBasicBlock operand. + bool isMBB() const { return OpKind == MO_MachineBasicBlock; } + /// isFI - Tests if this is a MO_FrameIndex operand. + bool isFI() const { return OpKind == MO_FrameIndex; } + /// isCPI - Tests if this is a MO_ConstantPoolIndex operand. + bool isCPI() const { return OpKind == MO_ConstantPoolIndex; } + /// isJTI - Tests if this is a MO_JumpTableIndex operand. + bool isJTI() const { return OpKind == MO_JumpTableIndex; } + /// isGlobal - Tests if this is a MO_GlobalAddress operand. + bool isGlobal() const { return OpKind == MO_GlobalAddress; } + /// isSymbol - Tests if this is a MO_ExternalSymbol operand. + bool isSymbol() const { return OpKind == MO_ExternalSymbol; } //===--------------------------------------------------------------------===// // Accessors for Register Operands @@ -143,49 +154,49 @@ /// getReg - Returns the register number. unsigned getReg() const { - assert(isRegister() && "This is not a register operand!"); + assert(isReg() && "This is not a register operand!"); return Contents.Reg.RegNo; } unsigned getSubReg() const { - assert(isRegister() && "Wrong MachineOperand accessor"); + assert(isReg() && "Wrong MachineOperand accessor"); return (unsigned)SubReg; } bool isUse() const { - assert(isRegister() && "Wrong MachineOperand accessor"); + assert(isReg() && "Wrong MachineOperand accessor"); return !IsDef; } bool isDef() const { - assert(isRegister() && "Wrong MachineOperand accessor"); + assert(isReg() && "Wrong MachineOperand accessor"); return IsDef; } bool isImplicit() const { - assert(isRegister() && "Wrong MachineOperand accessor"); + assert(isReg() && "Wrong MachineOperand accessor"); return IsImp; } bool isDead() const { - assert(isRegister() && "Wrong MachineOperand accessor"); + assert(isReg() && "Wrong MachineOperand accessor"); return IsDead; } bool isKill() const { - assert(isRegister() && "Wrong MachineOperand accessor"); + assert(isReg() && "Wrong MachineOperand accessor"); return IsKill; } bool isEarlyClobber() const { - assert(isRegister() && "Wrong MachineOperand accessor"); + assert(isReg() && "Wrong MachineOperand accessor"); return IsEarlyClobber; } /// getNextOperandForReg - Return the next MachineOperand in the function that /// uses or defines this register. MachineOperand *getNextOperandForReg() const { - assert(isRegister() && "This is not a register operand!"); + assert(isReg() && "This is not a register operand!"); return Contents.Reg.Next; } @@ -198,37 +209,37 @@ void setReg(unsigned Reg); void setSubReg(unsigned subReg) { - assert(isRegister() && "Wrong MachineOperand accessor"); + assert(isReg() && "Wrong MachineOperand accessor"); SubReg = (unsigned char)subReg; } void setIsUse(bool Val = true) { - assert(isRegister() && "Wrong MachineOperand accessor"); + assert(isReg() && "Wrong MachineOperand accessor"); IsDef = !Val; } void setIsDef(bool Val = true) { - assert(isRegister() && "Wrong MachineOperand accessor"); + assert(isReg() && "Wrong MachineOperand accessor"); IsDef = Val; } void setImplicit(bool Val = true) { - assert(isRegister() && "Wrong MachineOperand accessor"); + assert(isReg() && "Wrong MachineOperand accessor"); IsImp = Val; } void setIsKill(bool Val = true) { - assert(isRegister() && !IsDef && "Wrong MachineOperand accessor"); + assert(isReg() && !IsDef && "Wrong MachineOperand accessor"); IsKill = Val; } void setIsDead(bool Val = true) { - assert(isRegister() && IsDef && "Wrong MachineOperand accessor"); + assert(isReg() && IsDef && "Wrong MachineOperand accessor"); IsDead = Val; } void setIsEarlyClobber(bool Val = true) { - assert(isRegister() && IsDef && "Wrong MachineOperand accessor"); + assert(isReg() && IsDef && "Wrong MachineOperand accessor"); IsEarlyClobber = Val; } @@ -237,39 +248,39 @@ //===--------------------------------------------------------------------===// int64_t getImm() const { - assert(isImmediate() && "Wrong MachineOperand accessor"); + assert(isImm() && "Wrong MachineOperand accessor"); return Contents.ImmVal; } const ConstantFP *getFPImm() const { - assert(isFPImmediate() && "Wrong MachineOperand accessor"); + assert(isFPImm() && "Wrong MachineOperand accessor"); return Contents.CFP; } MachineBasicBlock *getMBB() const { - assert(isMachineBasicBlock() && "Wrong MachineOperand accessor"); + assert(isMBB() && "Wrong MachineOperand accessor"); return Contents.MBB; } int getIndex() const { - assert((isFrameIndex() || isConstantPoolIndex() || isJumpTableIndex()) && + assert((isFI() || isCPI() || isJTI()) && "Wrong MachineOperand accessor"); return Contents.OffsetedInfo.Val.Index; } GlobalValue *getGlobal() const { - assert(isGlobalAddress() && "Wrong MachineOperand accessor"); + assert(isGlobal() && "Wrong MachineOperand accessor"); return Contents.OffsetedInfo.Val.GV; } int getOffset() const { - assert((isGlobalAddress() || isExternalSymbol() || isConstantPoolIndex()) && + assert((isGlobal() || isSymbol() || isCPI()) && "Wrong MachineOperand accessor"); return Contents.OffsetedInfo.Offset; } const char *getSymbolName() const { - assert(isExternalSymbol() && "Wrong MachineOperand accessor"); + assert(isSymbol() && "Wrong MachineOperand accessor"); return Contents.OffsetedInfo.Val.SymbolName; } @@ -278,24 +289,24 @@ //===--------------------------------------------------------------------===// void setImm(int64_t immVal) { - assert(isImmediate() && "Wrong MachineOperand mutator"); + assert(isImm() && "Wrong MachineOperand mutator"); Contents.ImmVal = immVal; } void setOffset(int Offset) { - assert((isGlobalAddress() || isExternalSymbol() || isConstantPoolIndex()) && + assert((isGlobal() || isSymbol() || isCPI()) && "Wrong MachineOperand accessor"); Contents.OffsetedInfo.Offset = Offset; } void setIndex(int Idx) { - assert((isFrameIndex() || isConstantPoolIndex() || isJumpTableIndex()) && + assert((isFI() || isCPI() || isJTI()) && "Wrong MachineOperand accessor"); Contents.OffsetedInfo.Val.Index = Idx; } void setMBB(MachineBasicBlock *MBB) { - assert(isMachineBasicBlock() && "Wrong MachineOperand accessor"); + assert(isMBB() && "Wrong MachineOperand accessor"); Contents.MBB = MBB; } @@ -407,7 +418,7 @@ /// or false if not. This can only be called for register operands that are /// part of a machine instruction. bool isOnRegUseList() const { - assert(isRegister() && "Can only add reg operand to use lists"); + assert(isReg() && "Can only add reg operand to use lists"); return Contents.Reg.Prev != 0; } Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Fri Oct 3 10:45:36 2008 @@ -1179,11 +1179,11 @@ // Count the number of register definitions. unsigned NumDefs = 0; - for (; MI->getOperand(NumDefs).isRegister() && MI->getOperand(NumDefs).isDef(); + for (; MI->getOperand(NumDefs).isReg() && MI->getOperand(NumDefs).isDef(); ++NumDefs) assert(NumDefs != NumOperands-1 && "No asm string?"); - assert(MI->getOperand(NumDefs).isExternalSymbol() && "No asm string?"); + assert(MI->getOperand(NumDefs).isSymbol() && "No asm string?"); // Disassemble the AsmStr, printing out the literal pieces, the operands, etc. const char *AsmStr = MI->getOperand(NumDefs).getSymbolName(); Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp Fri Oct 3 10:45:36 2008 @@ -1050,15 +1050,15 @@ } // If advancing cfa. - if (Dst.isRegister() && Dst.getRegister() == MachineLocation::VirtualFP) { - if (!Src.isRegister()) { - if (Src.getRegister() == MachineLocation::VirtualFP) { + if (Dst.isReg() && Dst.getReg() == MachineLocation::VirtualFP) { + if (!Src.isReg()) { + if (Src.getReg() == MachineLocation::VirtualFP) { Asm->EmitInt8(DW_CFA_def_cfa_offset); Asm->EOL("DW_CFA_def_cfa_offset"); } else { Asm->EmitInt8(DW_CFA_def_cfa); Asm->EOL("DW_CFA_def_cfa"); - Asm->EmitULEB128Bytes(RI->getDwarfRegNum(Src.getRegister(), isEH)); + Asm->EmitULEB128Bytes(RI->getDwarfRegNum(Src.getReg(), isEH)); Asm->EOL("Register"); } @@ -1069,18 +1069,18 @@ } else { assert(0 && "Machine move no supported yet."); } - } else if (Src.isRegister() && - Src.getRegister() == MachineLocation::VirtualFP) { - if (Dst.isRegister()) { + } else if (Src.isReg() && + Src.getReg() == MachineLocation::VirtualFP) { + if (Dst.isReg()) { Asm->EmitInt8(DW_CFA_def_cfa_register); Asm->EOL("DW_CFA_def_cfa_register"); - Asm->EmitULEB128Bytes(RI->getDwarfRegNum(Dst.getRegister(), isEH)); + Asm->EmitULEB128Bytes(RI->getDwarfRegNum(Dst.getReg(), isEH)); Asm->EOL("Register"); } else { assert(0 && "Machine move no supported yet."); } } else { - unsigned Reg = RI->getDwarfRegNum(Src.getRegister(), isEH); + unsigned Reg = RI->getDwarfRegNum(Src.getReg(), isEH); int Offset = Dst.getOffset() / stackGrowth; if (Offset < 0) { @@ -1409,10 +1409,10 @@ /// provided. void AddAddress(DIE *Die, unsigned Attribute, const MachineLocation &Location) { - unsigned Reg = RI->getDwarfRegNum(Location.getRegister(), false); + unsigned Reg = RI->getDwarfRegNum(Location.getReg(), false); DIEBlock *Block = new DIEBlock(); - if (Location.isRegister()) { + if (Location.isReg()) { if (Reg < 32) { AddUInt(Block, 0, DW_FORM_data1, DW_OP_reg0 + Reg); } else { Modified: llvm/trunk/lib/CodeGen/BranchFolding.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/BranchFolding.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/BranchFolding.cpp (original) +++ llvm/trunk/lib/CodeGen/BranchFolding.cpp Fri Oct 3 10:45:36 2008 @@ -161,7 +161,7 @@ // See if it uses any of the implicitly defined registers. for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i) { MachineOperand &MO = I->getOperand(i); - if (!MO.isRegister() || !MO.isUse()) + if (!MO.isReg() || !MO.isUse()) continue; unsigned Reg = MO.getReg(); if (ImpDefRegs.count(Reg)) @@ -235,7 +235,7 @@ I != E; ++I) for (unsigned op = 0, e = I->getNumOperands(); op != e; ++op) { MachineOperand &Op = I->getOperand(op); - if (!Op.isJumpTableIndex()) continue; + if (!Op.isJTI()) continue; unsigned NewIdx = JTMapping[Op.getIndex()]; Op.setIndex(NewIdx); Modified: llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp (original) +++ llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp Fri Oct 3 10:45:36 2008 @@ -58,7 +58,7 @@ // Examine each operand. for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { const MachineOperand &MO = MI->getOperand(i); - if (MO.isRegister() && MO.isDef()) { + if (MO.isReg() && MO.isDef()) { unsigned Reg = MO.getReg(); if (TargetRegisterInfo::isPhysicalRegister(Reg) ? LivePhysRegs[Reg] : !MRI->use_empty(Reg)) { @@ -122,7 +122,7 @@ // Record the physreg defs. for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { const MachineOperand &MO = MI->getOperand(i); - if (MO.isRegister() && MO.isDef()) { + if (MO.isReg() && MO.isDef()) { unsigned Reg = MO.getReg(); if (Reg != 0 && TargetRegisterInfo::isPhysicalRegister(Reg)) { LivePhysRegs.reset(Reg); @@ -136,7 +136,7 @@ // both defined and used in the same instruction. for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { const MachineOperand &MO = MI->getOperand(i); - if (MO.isRegister() && MO.isUse()) { + if (MO.isReg() && MO.isUse()) { unsigned Reg = MO.getReg(); if (Reg != 0 && TargetRegisterInfo::isPhysicalRegister(Reg)) { LivePhysRegs.set(Reg); Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Fri Oct 3 10:45:36 2008 @@ -302,7 +302,7 @@ continue; for (unsigned i = 0; i != MI->getNumOperands(); ++i) { MachineOperand& mop = MI->getOperand(i); - if (!mop.isRegister()) + if (!mop.isReg()) continue; unsigned PhysReg = mop.getReg(); if (PhysReg == 0 || PhysReg == li.reg) @@ -723,7 +723,7 @@ for (int i = MI->getNumOperands() - 1; i >= 0; --i) { MachineOperand &MO = MI->getOperand(i); // handle register defs - build intervals - if (MO.isRegister() && MO.getReg() && MO.isDef()) { + if (MO.isReg() && MO.getReg() && MO.isDef()) { handleRegisterDef(MBB, MI, MIIndex, MO, i); } } @@ -789,7 +789,7 @@ unsigned RegOp = 0; for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { MachineOperand &MO = MI->getOperand(i); - if (!MO.isRegister() || !MO.isUse()) + if (!MO.isReg() || !MO.isUse()) continue; unsigned Reg = MO.getReg(); if (Reg == 0 || Reg == li.reg) @@ -876,7 +876,7 @@ unsigned ImpUse = 0; for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { const MachineOperand &MO = MI->getOperand(i); - if (MO.isRegister()) { + if (MO.isReg()) { unsigned Reg = MO.getReg(); if (Reg == 0) continue; @@ -1093,7 +1093,7 @@ // use operand. Make sure we rewrite that as well. for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { MachineOperand &MO = MI->getOperand(i); - if (!MO.isRegister()) + if (!MO.isReg()) continue; unsigned Reg = MO.getReg(); if (Reg == 0 || TargetRegisterInfo::isPhysicalRegister(Reg)) @@ -1128,7 +1128,7 @@ RestartInstruction: for (unsigned i = 0; i != MI->getNumOperands(); ++i) { MachineOperand& mop = MI->getOperand(i); - if (!mop.isRegister()) + if (!mop.isReg()) continue; unsigned Reg = mop.getReg(); unsigned RegI = Reg; @@ -1180,7 +1180,7 @@ Ops.push_back(i); for (unsigned j = i+1, e = MI->getNumOperands(); j != e; ++j) { const MachineOperand &MOj = MI->getOperand(j); - if (!MOj.isRegister()) + if (!MOj.isReg()) continue; unsigned RegJ = MOj.getReg(); if (RegJ == 0 || TargetRegisterInfo::isPhysicalRegister(RegJ)) @@ -1618,7 +1618,7 @@ NewLIs.push_back(&getOrCreateInterval(NewVReg)); for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { MachineOperand &MO = MI->getOperand(i); - if (MO.isRegister() && MO.getReg() == li.reg) + if (MO.isReg() && MO.getReg() == li.reg) MO.setReg(NewVReg); } } @@ -1662,7 +1662,7 @@ for (unsigned i = 0; i != MI->getNumOperands(); ++i) { MachineOperand& mop = MI->getOperand(i); - if (!mop.isRegister() || mop.getReg() != li.reg) continue; + if (!mop.isReg() || mop.getReg() != li.reg) continue; HasUse |= MI->getOperand(i).isUse(); HasDef |= MI->getOperand(i).isDef(); @@ -1916,7 +1916,7 @@ CanFold = true; for (unsigned j = 0, ee = MI->getNumOperands(); j != ee; ++j) { MachineOperand &MO = MI->getOperand(j); - if (!MO.isRegister() || MO.getReg() != VReg) + if (!MO.isReg() || MO.getReg() != VReg) continue; Ops.push_back(j); @@ -1987,7 +1987,7 @@ CanFold = true; for (unsigned j = 0, ee = MI->getNumOperands(); j != ee; ++j) { MachineOperand &MO = MI->getOperand(j); - if (!MO.isRegister() || MO.getReg() != VReg) + if (!MO.isReg() || MO.getReg() != VReg) continue; if (MO.isDef()) { Modified: llvm/trunk/lib/CodeGen/LiveVariables.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveVariables.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveVariables.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveVariables.cpp Fri Oct 3 10:45:36 2008 @@ -558,7 +558,7 @@ SmallVector DefRegs; for (unsigned i = 0; i != NumOperandsToProcess; ++i) { const MachineOperand &MO = MI->getOperand(i); - if (MO.isRegister() && MO.getReg()) { + if (MO.isReg() && MO.getReg()) { unsigned MOReg = MO.getReg(); if (MO.isUse()) UseRegs.push_back(MOReg); @@ -672,7 +672,7 @@ void LiveVariables::removeVirtualRegistersKilled(MachineInstr *MI) { for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { MachineOperand &MO = MI->getOperand(i); - if (MO.isRegister() && MO.isKill()) { + if (MO.isReg() && MO.isKill()) { MO.setIsKill(false); unsigned Reg = MO.getReg(); if (TargetRegisterInfo::isVirtualRegister(Reg)) { Modified: llvm/trunk/lib/CodeGen/LowerSubregs.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LowerSubregs.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LowerSubregs.cpp (original) +++ llvm/trunk/lib/CodeGen/LowerSubregs.cpp Fri Oct 3 10:45:36 2008 @@ -64,9 +64,9 @@ const TargetRegisterInfo &TRI = *MF.getTarget().getRegisterInfo(); const TargetInstrInfo &TII = *MF.getTarget().getInstrInfo(); - assert(MI->getOperand(0).isRegister() && MI->getOperand(0).isDef() && - MI->getOperand(1).isRegister() && MI->getOperand(1).isUse() && - MI->getOperand(2).isImmediate() && "Malformed extract_subreg"); + assert(MI->getOperand(0).isReg() && MI->getOperand(0).isDef() && + MI->getOperand(1).isReg() && MI->getOperand(1).isUse() && + MI->getOperand(2).isImm() && "Malformed extract_subreg"); unsigned DstReg = MI->getOperand(0).getReg(); unsigned SuperReg = MI->getOperand(1).getReg(); @@ -102,10 +102,10 @@ MachineFunction &MF = *MBB->getParent(); const TargetRegisterInfo &TRI = *MF.getTarget().getRegisterInfo(); const TargetInstrInfo &TII = *MF.getTarget().getInstrInfo(); - assert((MI->getOperand(0).isRegister() && MI->getOperand(0).isDef()) && - MI->getOperand(1).isImmediate() && - (MI->getOperand(2).isRegister() && MI->getOperand(2).isUse()) && - MI->getOperand(3).isImmediate() && "Invalid subreg_to_reg"); + assert((MI->getOperand(0).isReg() && MI->getOperand(0).isDef()) && + MI->getOperand(1).isImm() && + (MI->getOperand(2).isReg() && MI->getOperand(2).isUse()) && + MI->getOperand(3).isImm() && "Invalid subreg_to_reg"); unsigned DstReg = MI->getOperand(0).getReg(); unsigned InsReg = MI->getOperand(2).getReg(); @@ -146,10 +146,10 @@ MachineFunction &MF = *MBB->getParent(); const TargetRegisterInfo &TRI = *MF.getTarget().getRegisterInfo(); const TargetInstrInfo &TII = *MF.getTarget().getInstrInfo(); - assert((MI->getOperand(0).isRegister() && MI->getOperand(0).isDef()) && - (MI->getOperand(1).isRegister() && MI->getOperand(1).isUse()) && - (MI->getOperand(2).isRegister() && MI->getOperand(2).isUse()) && - MI->getOperand(3).isImmediate() && "Invalid insert_subreg"); + assert((MI->getOperand(0).isReg() && MI->getOperand(0).isDef()) && + (MI->getOperand(1).isReg() && MI->getOperand(1).isUse()) && + (MI->getOperand(2).isReg() && MI->getOperand(2).isUse()) && + MI->getOperand(3).isImm() && "Invalid insert_subreg"); unsigned DstReg = MI->getOperand(0).getReg(); unsigned SrcReg = MI->getOperand(1).getReg(); Modified: llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp Fri Oct 3 10:45:36 2008 @@ -290,7 +290,7 @@ // Scan the operands of this machine instruction, replacing any uses of Old // with New. for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i) - if (I->getOperand(i).isMachineBasicBlock() && + if (I->getOperand(i).isMBB() && I->getOperand(i).getMBB() == Old) I->getOperand(i).setMBB(New); } Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstr.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Fri Oct 3 10:45:36 2008 @@ -37,7 +37,7 @@ /// MachineRegisterInfo. If it is null, then the next/prev fields should be /// explicitly nulled out. void MachineOperand::AddRegOperandToRegInfo(MachineRegisterInfo *RegInfo) { - assert(isRegister() && "Can only add reg operand to use lists"); + assert(isReg() && "Can only add reg operand to use lists"); // If the reginfo pointer is null, just explicitly null out or next/prev // pointers, to ensure they are not garbage. @@ -92,7 +92,7 @@ void MachineOperand::ChangeToImmediate(int64_t ImmVal) { // If this operand is currently a register operand, and if this is in a // function, deregister the operand from the register's use/def list. - if (isRegister() && getParent() && getParent()->getParent() && + if (isReg() && getParent() && getParent()->getParent() && getParent()->getParent()->getParent()) RemoveRegOperandFromRegInfo(); @@ -107,7 +107,7 @@ bool isKill, bool isDead) { // If this operand is already a register operand, use setReg to update the // register's use/def lists. - if (isRegister()) { + if (isReg()) { assert(!isEarlyClobber()); setReg(Reg); } else { @@ -356,7 +356,7 @@ #ifndef NDEBUG for (unsigned i = 0, e = Operands.size(); i != e; ++i) { assert(Operands[i].ParentMI == this && "ParentMI mismatch!"); - assert((!Operands[i].isRegister() || !Operands[i].isOnRegUseList()) && + assert((!Operands[i].isReg() || !Operands[i].isOnRegUseList()) && "Reg operand def/use list corrupted"); } #endif @@ -376,7 +376,7 @@ /// operands already be on their use lists. void MachineInstr::RemoveRegOperandsFromUseLists() { for (unsigned i = 0, e = Operands.size(); i != e; ++i) { - if (Operands[i].isRegister()) + if (Operands[i].isReg()) Operands[i].RemoveRegOperandFromRegInfo(); } } @@ -386,7 +386,7 @@ /// operands not be on their use lists yet. void MachineInstr::AddRegOperandsToUseLists(MachineRegisterInfo &RegInfo) { for (unsigned i = 0, e = Operands.size(); i != e; ++i) { - if (Operands[i].isRegister()) + if (Operands[i].isReg()) Operands[i].AddRegOperandToRegInfo(&RegInfo); } } @@ -397,7 +397,7 @@ /// an explicit operand it is added at the end of the explicit operand list /// (before the first implicit operand). void MachineInstr::addOperand(const MachineOperand &Op) { - bool isImpReg = Op.isRegister() && Op.isImplicit(); + bool isImpReg = Op.isReg() && Op.isImplicit(); assert((isImpReg || !OperandsComplete()) && "Trying to add an operand to a machine instr that is already done!"); @@ -413,7 +413,7 @@ Operands.back().ParentMI = this; // If the operand is a register, update the operand's use list. - if (Op.isRegister()) + if (Op.isReg()) Operands.back().AddRegOperandToRegInfo(getRegInfo()); return; } @@ -433,7 +433,7 @@ // Do explicitly set the reginfo for this operand though, to ensure the // next/prev fields are properly nulled out. - if (Operands[OpNo].isRegister()) + if (Operands[OpNo].isReg()) Operands[OpNo].AddRegOperandToRegInfo(0); } else if (Operands.size()+1 <= Operands.capacity()) { @@ -446,7 +446,7 @@ // list, just remove the implicit operands, add the operand, then re-add all // the rest of the operands. for (unsigned i = OpNo, e = Operands.size(); i != e; ++i) { - assert(Operands[i].isRegister() && "Should only be an implicit reg!"); + assert(Operands[i].isReg() && "Should only be an implicit reg!"); Operands[i].RemoveRegOperandFromRegInfo(); } @@ -454,12 +454,12 @@ Operands.insert(Operands.begin()+OpNo, Op); Operands[OpNo].ParentMI = this; - if (Operands[OpNo].isRegister()) + if (Operands[OpNo].isReg()) Operands[OpNo].AddRegOperandToRegInfo(RegInfo); // Re-add all the implicit ops. for (unsigned i = OpNo+1, e = Operands.size(); i != e; ++i) { - assert(Operands[i].isRegister() && "Should only be an implicit reg!"); + assert(Operands[i].isReg() && "Should only be an implicit reg!"); Operands[i].AddRegOperandToRegInfo(RegInfo); } } else { @@ -485,7 +485,7 @@ // Special case removing the last one. if (OpNo == Operands.size()-1) { // If needed, remove from the reg def/use list. - if (Operands.back().isRegister() && Operands.back().isOnRegUseList()) + if (Operands.back().isReg() && Operands.back().isOnRegUseList()) Operands.back().RemoveRegOperandFromRegInfo(); Operands.pop_back(); @@ -498,7 +498,7 @@ MachineRegisterInfo *RegInfo = getRegInfo(); if (RegInfo) { for (unsigned i = OpNo, e = Operands.size(); i != e; ++i) { - if (Operands[i].isRegister()) + if (Operands[i].isReg()) Operands[i].RemoveRegOperandFromRegInfo(); } } @@ -507,7 +507,7 @@ if (RegInfo) { for (unsigned i = OpNo, e = Operands.size(); i != e; ++i) { - if (Operands[i].isRegister()) + if (Operands[i].isReg()) Operands[i].AddRegOperandToRegInfo(RegInfo); } } @@ -561,7 +561,7 @@ for (unsigned e = getNumOperands(); NumOperands != e; ++NumOperands) { const MachineOperand &MO = getOperand(NumOperands); - if (!MO.isRegister() || !MO.isImplicit()) + if (!MO.isReg() || !MO.isImplicit()) NumOperands++; } return NumOperands; @@ -589,7 +589,7 @@ const TargetRegisterInfo *TRI) const { for (unsigned i = 0, e = getNumOperands(); i != e; ++i) { const MachineOperand &MO = getOperand(i); - if (!MO.isRegister() || !MO.isUse()) + if (!MO.isReg() || !MO.isUse()) continue; unsigned MOReg = MO.getReg(); if (!MOReg) @@ -613,7 +613,7 @@ const TargetRegisterInfo *TRI) const { for (unsigned i = 0, e = getNumOperands(); i != e; ++i) { const MachineOperand &MO = getOperand(i); - if (!MO.isRegister() || !MO.isDef()) + if (!MO.isReg() || !MO.isDef()) continue; unsigned MOReg = MO.getReg(); if (MOReg == Reg || @@ -647,7 +647,7 @@ const TargetInstrDesc &TID = getDesc(); for (unsigned i = 0, e = TID.getNumOperands(); i != e; ++i) { const MachineOperand &MO = getOperand(i); - if (MO.isRegister() && MO.isUse() && MO.getReg() == Reg && + if (MO.isReg() && MO.isUse() && MO.getReg() == Reg && TID.getOperandConstraint(i, TOI::TIED_TO) == (int)DefIdx) return true; } @@ -659,7 +659,7 @@ void MachineInstr::copyKillDeadInfo(const MachineInstr *MI) { for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { const MachineOperand &MO = MI->getOperand(i); - if (!MO.isRegister() || (!MO.isKill() && !MO.isDead())) + if (!MO.isReg() || (!MO.isKill() && !MO.isDead())) continue; for (unsigned j = 0, ee = getNumOperands(); j != ee; ++j) { MachineOperand &MOp = getOperand(j); @@ -722,7 +722,7 @@ return false; for (unsigned i = 0, e = getNumOperands(); i != e; ++i) { MachineOperand &MO = getOperand(i); - if (!MO.isRegister()) + if (!MO.isReg()) continue; // FIXME: For now, do not remat any instruction with register operands. // Later on, we can loosen the restriction is the register operands have @@ -770,7 +770,7 @@ void MachineInstr::print(std::ostream &OS, const TargetMachine *TM) const { // Specialize printing if op#0 is definition unsigned StartOp = 0; - if (getNumOperands() && getOperand(0).isRegister() && getOperand(0).isDef()) { + if (getNumOperands() && getOperand(0).isReg() && getOperand(0).isDef()) { getOperand(0).print(OS, TM); OS << " = "; ++StartOp; // Don't print this operand again! @@ -831,7 +831,7 @@ SmallVector DeadOps; for (unsigned i = 0, e = getNumOperands(); i != e; ++i) { MachineOperand &MO = getOperand(i); - if (!MO.isRegister() || !MO.isUse()) + if (!MO.isReg() || !MO.isUse()) continue; unsigned Reg = MO.getReg(); if (!Reg) @@ -886,7 +886,7 @@ SmallVector DeadOps; for (unsigned i = 0, e = getNumOperands(); i != e; ++i) { MachineOperand &MO = getOperand(i); - if (!MO.isRegister() || !MO.isDef()) + if (!MO.isReg() || !MO.isDef()) continue; unsigned Reg = MO.getReg(); if (!Reg) Modified: llvm/trunk/lib/CodeGen/MachineLICM.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineLICM.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineLICM.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineLICM.cpp Fri Oct 3 10:45:36 2008 @@ -248,7 +248,7 @@ for (unsigned i = 0, e = I.getNumOperands(); i != e; ++i) { const MachineOperand &MO = I.getOperand(i); - if (!MO.isRegister()) + if (!MO.isReg()) continue; if (MO.isDef() && TargetRegisterInfo::isPhysicalRegister(MO.getReg())) Modified: llvm/trunk/lib/CodeGen/MachineSink.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineSink.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineSink.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineSink.cpp Fri Oct 3 10:45:36 2008 @@ -155,7 +155,7 @@ for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { const MachineOperand &MO = MI->getOperand(i); - if (!MO.isRegister()) continue; // Ignore non-register operands. + if (!MO.isReg()) continue; // Ignore non-register operands. unsigned Reg = MO.getReg(); if (Reg == 0) continue; Modified: llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp (original) +++ llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp Fri Oct 3 10:45:36 2008 @@ -560,7 +560,7 @@ bool DoIncr = true; for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) - if (MI->getOperand(i).isFrameIndex()) { + if (MI->getOperand(i).isFI()) { // Some instructions (e.g. inline asm instructions) can have // multiple frame indices and/or cause eliminateFrameIndex // to insert more than one instruction. We need the register Modified: llvm/trunk/lib/CodeGen/RegAllocBigBlock.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocBigBlock.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocBigBlock.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocBigBlock.cpp Fri Oct 3 10:45:36 2008 @@ -560,7 +560,7 @@ for (unsigned i = 0; i != MI->getNumOperands(); ++i) { MachineOperand& MO = MI->getOperand(i); // look for vreg reads.. - if (MO.isRegister() && !MO.isDef() && MO.getReg() && + if (MO.isReg() && !MO.isDef() && MO.getReg() && TargetRegisterInfo::isVirtualRegister(MO.getReg())) { // ..and add them to the read table. VRegTimes* &Times = VRegReadTable[MO.getReg()]; @@ -589,7 +589,7 @@ static bool isReadModWriteImplicitKill(MachineInstr *MI, unsigned Reg) { for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { MachineOperand& MO = MI->getOperand(i); - if (MO.isRegister() && MO.getReg() == Reg && MO.isImplicit() && + if (MO.isReg() && MO.getReg() == Reg && MO.isImplicit() && MO.isDef() && !MO.isDead()) return true; } @@ -601,7 +601,7 @@ static bool isReadModWriteImplicitDef(MachineInstr *MI, unsigned Reg) { for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { MachineOperand& MO = MI->getOperand(i); - if (MO.isRegister() && MO.getReg() == Reg && MO.isImplicit() && + if (MO.isReg() && MO.getReg() == Reg && MO.isImplicit() && !MO.isDef() && MO.isKill()) return true; } @@ -653,7 +653,7 @@ SmallVector Kills; for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { MachineOperand& MO = MI->getOperand(i); - if (MO.isRegister() && MO.isKill()) { + if (MO.isReg() && MO.isKill()) { if (!MO.isImplicit()) Kills.push_back(MO.getReg()); else if (!isReadModWriteImplicitKill(MI, MO.getReg())) @@ -673,7 +673,7 @@ for (unsigned i = 0; i != MI->getNumOperands(); ++i) { MachineOperand& MO = MI->getOperand(i); // here we are looking for only used operands (never def&use) - if (MO.isRegister() && !MO.isDef() && MO.getReg() && !MO.isImplicit() && + if (MO.isReg() && !MO.isDef() && MO.getReg() && !MO.isImplicit() && TargetRegisterInfo::isVirtualRegister(MO.getReg())) MI = reloadVirtReg(MBB, MI, i); } @@ -719,7 +719,7 @@ // are defined, and marking explicit destinations in the PhysRegsUsed map. for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { MachineOperand& MO = MI->getOperand(i); - if (MO.isRegister() && MO.isDef() && !MO.isImplicit() && MO.getReg() && + if (MO.isReg() && MO.isDef() && !MO.isImplicit() && MO.getReg() && TargetRegisterInfo::isPhysicalRegister(MO.getReg())) { unsigned Reg = MO.getReg(); if (PhysRegsUsed[Reg] == -2) continue; // Something like ESP. @@ -764,7 +764,7 @@ SmallVector DeadDefs; for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { MachineOperand& MO = MI->getOperand(i); - if (MO.isRegister() && MO.isDead()) + if (MO.isReg() && MO.isDead()) DeadDefs.push_back(MO.getReg()); } @@ -775,7 +775,7 @@ // for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { MachineOperand& MO = MI->getOperand(i); - if (MO.isRegister() && MO.isDef() && MO.getReg() && + if (MO.isReg() && MO.isDef() && MO.getReg() && TargetRegisterInfo::isVirtualRegister(MO.getReg())) { unsigned DestVirtReg = MO.getReg(); unsigned DestPhysReg; Modified: llvm/trunk/lib/CodeGen/RegAllocLocal.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocLocal.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocLocal.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocLocal.cpp Fri Oct 3 10:45:36 2008 @@ -521,7 +521,7 @@ static bool isReadModWriteImplicitKill(MachineInstr *MI, unsigned Reg) { for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { MachineOperand& MO = MI->getOperand(i); - if (MO.isRegister() && MO.getReg() == Reg && MO.isImplicit() && + if (MO.isReg() && MO.getReg() == Reg && MO.isImplicit() && MO.isDef() && !MO.isDead()) return true; } @@ -533,7 +533,7 @@ static bool isReadModWriteImplicitDef(MachineInstr *MI, unsigned Reg) { for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { MachineOperand& MO = MI->getOperand(i); - if (MO.isRegister() && MO.getReg() == Reg && MO.isImplicit() && + if (MO.isReg() && MO.getReg() == Reg && MO.isImplicit() && !MO.isDef() && MO.isKill()) return true; } @@ -575,7 +575,7 @@ // them for later. Also, we have to process these // _before_ processing the defs, since an instr // uses regs before it defs them. - if (MO.isRegister() && MO.getReg() && MO.isUse()) + if (MO.isReg() && MO.getReg() && MO.isUse()) LastUseDef[MO.getReg()] = std::make_pair(I, i); } @@ -584,7 +584,7 @@ // Defs others than 2-addr redefs _do_ trigger flag changes: // - A def followed by a def is dead // - A use followed by a def is a kill - if (MO.isRegister() && MO.getReg() && MO.isDef()) { + if (MO.isReg() && MO.getReg() && MO.isDef()) { DenseMap >::iterator last = LastUseDef.find(MO.getReg()); if (last != LastUseDef.end()) { @@ -711,7 +711,7 @@ SmallVector Kills; for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { MachineOperand& MO = MI->getOperand(i); - if (MO.isRegister() && MO.isKill()) { + if (MO.isReg() && MO.isKill()) { if (!MO.isImplicit()) Kills.push_back(MO.getReg()); else if (!isReadModWriteImplicitKill(MI, MO.getReg())) @@ -729,7 +729,7 @@ if (MI->getOpcode()==TargetInstrInfo::INLINEASM) { for (unsigned i = 0; i != MI->getNumOperands(); ++i) { MachineOperand& MO = MI->getOperand(i); - if (MO.isRegister() && MO.isDef() && MO.isEarlyClobber() && + if (MO.isReg() && MO.isDef() && MO.isEarlyClobber() && MO.getReg()) { if (TargetRegisterInfo::isVirtualRegister(MO.getReg())) { unsigned DestVirtReg = MO.getReg(); @@ -780,7 +780,7 @@ for (unsigned i = 0; i != MI->getNumOperands(); ++i) { MachineOperand& MO = MI->getOperand(i); // here we are looking for only used operands (never def&use) - if (MO.isRegister() && !MO.isDef() && MO.getReg() && !MO.isImplicit() && + if (MO.isReg() && !MO.isDef() && MO.getReg() && !MO.isImplicit() && TargetRegisterInfo::isVirtualRegister(MO.getReg())) MI = reloadVirtReg(MBB, MI, i); } @@ -826,7 +826,7 @@ // are defined, and marking explicit destinations in the PhysRegsUsed map. for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { MachineOperand& MO = MI->getOperand(i); - if (MO.isRegister() && MO.isDef() && !MO.isImplicit() && MO.getReg() && + if (MO.isReg() && MO.isDef() && !MO.isImplicit() && MO.getReg() && !MO.isEarlyClobber() && TargetRegisterInfo::isPhysicalRegister(MO.getReg())) { unsigned Reg = MO.getReg(); @@ -877,7 +877,7 @@ SmallVector DeadDefs; for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { MachineOperand& MO = MI->getOperand(i); - if (MO.isRegister() && MO.isDead()) + if (MO.isReg() && MO.isDead()) DeadDefs.push_back(MO.getReg()); } @@ -888,7 +888,7 @@ // for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { MachineOperand& MO = MI->getOperand(i); - if (MO.isRegister() && MO.isDef() && MO.getReg() && + if (MO.isReg() && MO.isDef() && MO.getReg() && !MO.isEarlyClobber() && TargetRegisterInfo::isVirtualRegister(MO.getReg())) { unsigned DestVirtReg = MO.getReg(); Modified: llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp Fri Oct 3 10:45:36 2008 @@ -265,7 +265,7 @@ const MachineOperand &mo = instr->getOperand(opNo); // We're not interested in non-registers... - if (!mo.isRegister()) + if (!mo.isReg()) continue; unsigned moReg = mo.getReg(); Modified: llvm/trunk/lib/CodeGen/RegAllocSimple.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocSimple.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocSimple.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocSimple.cpp Fri Oct 3 10:45:36 2008 @@ -190,7 +190,7 @@ for (int i = MI->getNumOperands() - 1; i >= 0; --i) { MachineOperand &MO = MI->getOperand(i); - if (MO.isRegister() && MO.getReg() && + if (MO.isReg() && MO.getReg() && TargetRegisterInfo::isVirtualRegister(MO.getReg())) { unsigned virtualReg = (unsigned) MO.getReg(); DOUT << "op: " << MO << "\n"; @@ -209,7 +209,7 @@ // must be same register number as the source operand that is // tied to. This maps a = b + c into b = b + c, and saves b into // a's spot. - assert(MI->getOperand(TiedOp).isRegister() && + assert(MI->getOperand(TiedOp).isReg() && MI->getOperand(TiedOp).getReg() && MI->getOperand(TiedOp).isUse() && "Two address instruction invalid!"); Modified: llvm/trunk/lib/CodeGen/RegisterScavenging.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegisterScavenging.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegisterScavenging.cpp (original) +++ llvm/trunk/lib/CodeGen/RegisterScavenging.cpp Fri Oct 3 10:45:36 2008 @@ -35,7 +35,7 @@ bool SeenSuperDef = false; for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { const MachineOperand &MO = MI->getOperand(i); - if (!MO.isRegister()) + if (!MO.isReg()) continue; if (TRI->isSuperRegister(SubReg, MO.getReg())) { if (MO.isUse()) @@ -51,7 +51,7 @@ static bool RedefinesSuperRegPart(const MachineInstr *MI, const MachineOperand &MO, const TargetRegisterInfo *TRI) { - assert(MO.isRegister() && MO.isDef() && "Not a register def!"); + assert(MO.isReg() && MO.isDef() && "Not a register def!"); return RedefinesSuperRegPart(MI, MO.getReg(), TRI); } @@ -194,7 +194,7 @@ BitVector ChangedRegs(NumPhysRegs); for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { const MachineOperand &MO = MI->getOperand(i); - if (!MO.isRegister() || !MO.isUse()) + if (!MO.isReg() || !MO.isUse()) continue; unsigned Reg = MO.getReg(); @@ -228,7 +228,7 @@ for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { const MachineOperand &MO = MI->getOperand(i); - if (!MO.isRegister() || !MO.isDef()) + if (!MO.isReg() || !MO.isDef()) continue; unsigned Reg = MO.getReg(); @@ -270,7 +270,7 @@ const TargetInstrDesc &TID = MI->getDesc(); for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { const MachineOperand &MO = MI->getOperand(i); - if (!MO.isRegister() || !MO.isDef()) + if (!MO.isReg() || !MO.isDef()) continue; // Skip two-address destination operand. if (TID.findTiedToSrcOperand(i) != -1) @@ -285,7 +285,7 @@ BitVector ChangedRegs(NumPhysRegs); for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { const MachineOperand &MO = MI->getOperand(i); - if (!MO.isRegister() || !MO.isUse()) + if (!MO.isReg() || !MO.isUse()) continue; unsigned Reg = MO.getReg(); if (Reg == 0) @@ -378,7 +378,7 @@ // Exclude all the registers being used by the instruction. for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i) { MachineOperand &MO = I->getOperand(i); - if (MO.isRegister()) + if (MO.isReg()) Candidates.reset(MO.getReg()); } Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original) +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Fri Oct 3 10:45:36 2008 @@ -466,7 +466,7 @@ for (unsigned i = CopyMI->getDesc().getNumOperands(), e = CopyMI->getNumOperands(); i != e; ++i) { MachineOperand &MO = CopyMI->getOperand(i); - if (MO.isRegister() && MO.isImplicit()) + if (MO.isReg() && MO.isImplicit()) NewMI->addOperand(MO); if (MO.isDef() && li_->hasInterval(MO.getReg())) { unsigned Reg = MO.getReg(); @@ -875,7 +875,7 @@ // Each use MI may have multiple uses of this register. Change them all. for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { MachineOperand &MO = MI->getOperand(i); - if (MO.isRegister() && MO.getReg() == li.reg) + if (MO.isReg() && MO.getReg() == li.reg) MO.setReg(DstReg); } JoinedCopies.insert(MI); @@ -2160,7 +2160,7 @@ if (!(tii_->isMoveInstr(*MI, SrcReg, DstReg) && SrcReg == DstReg)) for (unsigned i = 0, NumOps = MI->getNumOperands(); i != NumOps; ++i) { MachineOperand &Use = MI->getOperand(i); - if (Use.isRegister() && Use.isUse() && Use.getReg() && + if (Use.isReg() && Use.isUse() && Use.getReg() && tri_->regsOverlap(Use.getReg(), Reg)) { UseIdx = e; return &Use; @@ -2298,7 +2298,7 @@ bool isDead = true; for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { const MachineOperand &MO = MI->getOperand(i); - if (!MO.isRegister() || MO.isDead()) + if (!MO.isReg() || MO.isDead()) continue; unsigned Reg = MO.getReg(); if (TargetRegisterInfo::isPhysicalRegister(Reg) || @@ -2333,7 +2333,7 @@ SmallSet UniqueUses; for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { const MachineOperand &mop = MI->getOperand(i); - if (mop.isRegister() && mop.getReg() && + if (mop.isReg() && mop.getReg() && TargetRegisterInfo::isVirtualRegister(mop.getReg())) { unsigned reg = mop.getReg(); // Multiple uses of reg by the same instruction. It should not Modified: llvm/trunk/lib/CodeGen/StackSlotColoring.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StackSlotColoring.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/StackSlotColoring.cpp (original) +++ llvm/trunk/lib/CodeGen/StackSlotColoring.cpp Fri Oct 3 10:45:36 2008 @@ -220,7 +220,7 @@ MachineInstr &MI = *MII; for (unsigned i = 0, e = MI.getNumOperands(); i != e; ++i) { MachineOperand &MO = MI.getOperand(i); - if (!MO.isFrameIndex()) + if (!MO.isFI()) continue; int FI = MO.getIndex(); if (FI < 0) Modified: llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp (original) +++ llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Fri Oct 3 10:45:36 2008 @@ -812,7 +812,7 @@ continue; for (unsigned i = 0; i < I->getNumOperands(); ++i) - if (I->getOperand(i).isRegister() && + if (I->getOperand(i).isReg() && Stacks[I->getOperand(i).getReg()].size()) { // Remove the live range for the old vreg. LiveInterval& OldInt = LI.getInterval(I->getOperand(i).getReg()); Modified: llvm/trunk/lib/CodeGen/TargetInstrInfoImpl.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetInstrInfoImpl.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/TargetInstrInfoImpl.cpp (original) +++ llvm/trunk/lib/CodeGen/TargetInstrInfoImpl.cpp Fri Oct 3 10:45:36 2008 @@ -22,7 +22,7 @@ // operand 1 and 2. MachineInstr *TargetInstrInfoImpl::commuteInstruction(MachineInstr *MI, bool NewMI) const { - assert(MI->getOperand(1).isRegister() && MI->getOperand(2).isRegister() && + assert(MI->getOperand(1).isReg() && MI->getOperand(2).isReg() && "This only knows how to commute register operands so far"); unsigned Reg1 = MI->getOperand(1).getReg(); unsigned Reg2 = MI->getOperand(2).getReg(); @@ -64,7 +64,7 @@ /// two-address instruction. bool TargetInstrInfoImpl::CommuteChangesDestination(MachineInstr *MI, unsigned &OpIdx) const{ - assert(MI->getOperand(1).isRegister() && MI->getOperand(2).isRegister() && + assert(MI->getOperand(1).isReg() && MI->getOperand(2).isReg() && "This only knows how to commute register operands so far"); if (MI->getOperand(0).getReg() == MI->getOperand(1).getReg()) { // Must be two address instruction! @@ -87,13 +87,13 @@ for (unsigned j = 0, i = 0, e = MI->getNumOperands(); i != e; ++i) { if (TID.OpInfo[i].isPredicate()) { MachineOperand &MO = MI->getOperand(i); - if (MO.isRegister()) { + if (MO.isReg()) { MO.setReg(Pred[j].getReg()); MadeChange = true; - } else if (MO.isImmediate()) { + } else if (MO.isImm()) { MO.setImm(Pred[j].getImm()); MadeChange = true; - } else if (MO.isMachineBasicBlock()) { + } else if (MO.isMBB()) { MO.setMBB(Pred[j].getMBB()); MadeChange = true; } Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp (original) +++ llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Fri Oct 3 10:45:36 2008 @@ -108,7 +108,7 @@ for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { const MachineOperand &MO = MI->getOperand(i); - if (!MO.isRegister()) + if (!MO.isReg()) continue; unsigned MOReg = MO.getReg(); if (!MOReg) @@ -158,7 +158,7 @@ ++NumVisited; for (unsigned i = 0, e = OtherMI->getNumOperands(); i != e; ++i) { MachineOperand &MO = OtherMI->getOperand(i); - if (!MO.isRegister()) + if (!MO.isReg()) continue; unsigned MOReg = MO.getReg(); if (!MOReg) @@ -200,7 +200,7 @@ const TargetInstrDesc &TID = UseMI->getDesc(); for (unsigned i = 0, e = TID.getNumOperands(); i != e; ++i) { MachineOperand &MO = UseMI->getOperand(i); - if (MO.isRegister() && MO.getReg() == Reg && + if (MO.isReg() && MO.getReg() == Reg && (MO.isDef() || TID.getOperandConstraint(i, TOI::TIED_TO) != -1)) // Earlier use is a two-address one. return true; @@ -292,7 +292,7 @@ FirstTied = false; - assert(mi->getOperand(si).isRegister() && mi->getOperand(si).getReg() && + assert(mi->getOperand(si).isReg() && mi->getOperand(si).getReg() && mi->getOperand(si).isUse() && "two address instruction invalid"); // If the two operands are the same we just remove the use @@ -316,7 +316,7 @@ // should never occur because we are in SSA form. for (unsigned i = 0; i != mi->getNumOperands(); ++i) assert((int)i == ti || - !mi->getOperand(i).isRegister() || + !mi->getOperand(i).isReg() || mi->getOperand(i).getReg() != regA); #endif @@ -330,7 +330,7 @@ // and C joinable. // FIXME: This code also works for A := B op C instructions. if (TID.isCommutable() && mi->getNumOperands() >= 3) { - assert(mi->getOperand(3-si).isRegister() && + assert(mi->getOperand(3-si).isReg() && "Not a proper commutative instruction!"); unsigned regC = mi->getOperand(3-si).getReg(); @@ -433,7 +433,7 @@ // Replace all occurences of regB with regA. for (unsigned i = 0, e = mi->getNumOperands(); i != e; ++i) { - if (mi->getOperand(i).isRegister() && + if (mi->getOperand(i).isReg() && mi->getOperand(i).getReg() == regB) mi->getOperand(i).setReg(regA); } Modified: llvm/trunk/lib/CodeGen/UnreachableBlockElim.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/UnreachableBlockElim.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/UnreachableBlockElim.cpp (original) +++ llvm/trunk/lib/CodeGen/UnreachableBlockElim.cpp Fri Oct 3 10:45:36 2008 @@ -127,7 +127,7 @@ while (start != succ->end() && start->getOpcode() == TargetInstrInfo::PHI) { for (unsigned i = start->getNumOperands() - 1; i >= 2; i-=2) - if (start->getOperand(i).isMachineBasicBlock() && + if (start->getOperand(i).isMBB() && start->getOperand(i).getMBB() == BB) { start->RemoveOperand(i); start->RemoveOperand(i-1); Modified: llvm/trunk/lib/CodeGen/VirtRegMap.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/VirtRegMap.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/VirtRegMap.cpp (original) +++ llvm/trunk/lib/CodeGen/VirtRegMap.cpp Fri Oct 3 10:45:36 2008 @@ -182,7 +182,7 @@ void VirtRegMap::RemoveMachineInstrFromMaps(MachineInstr *MI) { for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { MachineOperand &MO = MI->getOperand(i); - if (!MO.isFrameIndex()) + if (!MO.isFI()) continue; int FI = MO.getIndex(); if (MF.getFrameInfo()->isFixedObjectIndex(FI)) @@ -259,7 +259,7 @@ MachineInstr &MI = *MII; for (unsigned i = 0, e = MI.getNumOperands(); i != e; ++i) { MachineOperand &MO = MI.getOperand(i); - if (MO.isRegister() && MO.getReg()) { + if (MO.isReg() && MO.getReg()) { if (TargetRegisterInfo::isVirtualRegister(MO.getReg())) { unsigned VirtReg = MO.getReg(); unsigned SubIdx = MO.getSubReg(); @@ -560,7 +560,7 @@ SmallVector *KillRegs = NULL) { for (unsigned i = 0, e = MI.getNumOperands(); i != e; ++i) { MachineOperand &MO = MI.getOperand(i); - if (!MO.isRegister() || !MO.isUse() || !MO.isKill()) + if (!MO.isReg() || !MO.isUse() || !MO.isKill()) continue; unsigned Reg = MO.getReg(); if (TargetRegisterInfo::isVirtualRegister(Reg)) @@ -599,7 +599,7 @@ MachineOperand *DefOp = NULL; for (unsigned i = 0, e = DefMI->getNumOperands(); i != e; ++i) { MachineOperand &MO = DefMI->getOperand(i); - if (MO.isRegister() && MO.isDef()) { + if (MO.isReg() && MO.isDef()) { if (MO.getReg() == Reg) DefOp = &MO; else if (!MO.isDead()) @@ -616,7 +616,7 @@ MachineInstr *NMI = I; for (unsigned j = 0, ee = NMI->getNumOperands(); j != ee; ++j) { MachineOperand &MO = NMI->getOperand(j); - if (!MO.isRegister() || MO.getReg() != Reg) + if (!MO.isReg() || MO.getReg() != Reg) continue; if (MO.isUse()) FoundUse = true; @@ -639,7 +639,7 @@ const TargetInstrDesc &TID = MI.getDesc(); for (unsigned i = 0, e = MI.getNumOperands(); i != e; ++i) { MachineOperand &MO = MI.getOperand(i); - if (!MO.isRegister() || !MO.isUse()) + if (!MO.isReg() || !MO.isUse()) continue; unsigned Reg = MO.getReg(); if (Reg == 0) @@ -664,7 +664,7 @@ for (unsigned i = 0, e = MI.getNumOperands(); i != e; ++i) { const MachineOperand &MO = MI.getOperand(i); - if (!MO.isRegister() || !MO.isDef()) + if (!MO.isReg() || !MO.isDef()) continue; unsigned Reg = MO.getReg(); RegKills.reset(Reg); @@ -684,7 +684,7 @@ MachineInstr *NewMI = prior(MII); for (unsigned i = 0, e = NewMI->getNumOperands(); i != e; ++i) { MachineOperand &MO = NewMI->getOperand(i); - if (!MO.isRegister() || MO.getReg() == 0) + if (!MO.isReg() || MO.getReg() == 0) continue; unsigned VirtReg = MO.getReg(); if (TargetRegisterInfo::isPhysicalRegister(VirtReg)) @@ -933,7 +933,7 @@ for (unsigned i = 0, e = MI.getNumOperands(); i != e; ++i) { MachineOperand &MO = MI.getOperand(i); - if (!MO.isRegister() || MO.getReg() == 0 || !MO.isUse()) + if (!MO.isReg() || MO.getReg() == 0 || !MO.isUse()) continue; unsigned VirtReg = MO.getReg(); if (TargetRegisterInfo::isPhysicalRegister(VirtReg) || MO.getSubReg()) @@ -1033,7 +1033,7 @@ int DefIdx = TID.getOperandConstraint(UseIdx, TOI::TIED_TO); if (DefIdx == -1) return false; - assert(DefMI->getOperand(DefIdx).isRegister() && + assert(DefMI->getOperand(DefIdx).isReg() && DefMI->getOperand(DefIdx).getReg() == SrcReg); // Now commute def instruction. @@ -1176,7 +1176,7 @@ MachineOperand *LastUD = NULL; for (unsigned i = 0, e = LastUDMI->getNumOperands(); i != e; ++i) { MachineOperand &MO = LastUDMI->getOperand(i); - if (!MO.isRegister() || MO.getReg() != Reg) + if (!MO.isReg() || MO.getReg() != Reg) continue; if (!LastUD || (LastUD->isUse() && MO.isDef())) LastUD = &MO; @@ -1315,7 +1315,7 @@ SmallVector VirtUseOps; for (unsigned i = 0, e = MI.getNumOperands(); i != e; ++i) { MachineOperand &MO = MI.getOperand(i); - if (!MO.isRegister() || MO.getReg() == 0) + if (!MO.isReg() || MO.getReg() == 0) continue; // Ignore non-register operands. unsigned VirtReg = MO.getReg(); @@ -1395,7 +1395,7 @@ bool CanReuse = true; int ti = TID.getOperandConstraint(i, TOI::TIED_TO); if (ti != -1 && - MI.getOperand(ti).isRegister() && + MI.getOperand(ti).isReg() && MI.getOperand(ti).getReg() == VirtReg) { // Okay, we have a two address operand. We can reuse this physreg as // long as we are allowed to clobber the value and there isn't an @@ -1725,7 +1725,7 @@ // Process all of the spilled defs. for (unsigned i = 0, e = MI.getNumOperands(); i != e; ++i) { MachineOperand &MO = MI.getOperand(i); - if (!(MO.isRegister() && MO.getReg() && MO.isDef())) + if (!(MO.isReg() && MO.getReg() && MO.isDef())) continue; unsigned VirtReg = MO.getReg(); Modified: llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp (original) +++ llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp Fri Oct 3 10:45:36 2008 @@ -756,7 +756,7 @@ unsigned NumOps = Desc.getNumOperands(); for (unsigned CurOp = 0; CurOp < NumOps; CurOp++) { const MachineOperand &MO = MI.getOperand(CurOp); - if (MO.isGlobalAddress()) { + if (MO.isGlobal()) { GlobalValue* V = MO.getGlobal(); const GlobalVariable *GV = dyn_cast(V); if (!GV) Modified: llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp Fri Oct 3 10:45:36 2008 @@ -181,19 +181,19 @@ /// operand requires relocation, record the relocation and return zero. unsigned ARMCodeEmitter::getMachineOpValue(const MachineInstr &MI, const MachineOperand &MO) { - if (MO.isRegister()) + if (MO.isReg()) return ARMRegisterInfo::getRegisterNumbering(MO.getReg()); - else if (MO.isImmediate()) + else if (MO.isImm()) return static_cast(MO.getImm()); - else if (MO.isGlobalAddress()) + else if (MO.isGlobal()) emitGlobalAddress(MO.getGlobal(), ARM::reloc_arm_branch, false); - else if (MO.isExternalSymbol()) + else if (MO.isSymbol()) emitExternalSymbolAddress(MO.getSymbolName(), ARM::reloc_arm_relative); - else if (MO.isConstantPoolIndex()) + else if (MO.isCPI()) emitConstPoolAddress(MO.getIndex(), ARM::reloc_arm_relative); - else if (MO.isJumpTableIndex()) + else if (MO.isJTI()) emitJumpTableAddress(MO.getIndex(), ARM::reloc_arm_relative); - else if (MO.isMachineBasicBlock()) + else if (MO.isMBB()) emitMachineBasicBlock(MO.getMBB()); else { cerr << "ERROR: Unknown type of MachineOperand: " << MO << "\n"; @@ -351,7 +351,7 @@ const TargetInstrDesc &TID) const { for (unsigned i = MI.getNumOperands(), e = TID.getNumOperands(); i != e; --i){ const MachineOperand &MO = MI.getOperand(i-1); - if (MO.isRegister() && MO.isDef() && MO.getReg() == ARM::CPSR) + if (MO.isReg() && MO.isDef() && MO.getReg() == ARM::CPSR) return 1 << ARMII::S_BitShift; } return 0; @@ -414,7 +414,7 @@ return Binary | getMachineSoRegOpValue(MI, TID, OpIdx); const MachineOperand &MO = MI.getOperand(OpIdx); - if (MO.isRegister()) + if (MO.isReg()) // Encode register Rm. return Binary | getMachineOpValue(MI, NumDefs + 1); @@ -538,7 +538,7 @@ // Set registers for (unsigned i = 4, e = MI.getNumOperands(); i != e; ++i) { const MachineOperand &MO = MI.getOperand(i); - if (MO.isRegister() && MO.isImplicit()) + if (MO.isReg() && MO.isImplicit()) continue; unsigned RegNum = ARMRegisterInfo::getRegisterNumbering(MO.getReg()); assert(TargetRegisterInfo::isPhysicalRegister(MO.getReg()) && Modified: llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp Fri Oct 3 10:45:36 2008 @@ -416,7 +416,7 @@ // Scan the instructions for constant pool operands. for (unsigned op = 0, e = I->getNumOperands(); op != e; ++op) - if (I->getOperand(op).isConstantPoolIndex()) { + if (I->getOperand(op).isCPI()) { // We found one. The addressing mode tells us the max displacement // from the PC that this instruction permits. @@ -818,7 +818,7 @@ U.CPEMI = CPEs[i].CPEMI; // Change the CPI in the instruction operand to refer to the clone. for (unsigned j = 0, e = UserMI->getNumOperands(); j != e; ++j) - if (UserMI->getOperand(j).isConstantPoolIndex()) { + if (UserMI->getOperand(j).isCPI()) { UserMI->getOperand(j).setIndex(CPEs[i].CPI); break; } @@ -1058,7 +1058,7 @@ // Finally, change the CPI in the instruction operand to be ID. for (unsigned i = 0, e = UserMI->getNumOperands(); i != e; ++i) - if (UserMI->getOperand(i).isConstantPoolIndex()) { + if (UserMI->getOperand(i).isCPI()) { UserMI->getOperand(i).setIndex(ID); break; } Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp Fri Oct 3 10:45:36 2008 @@ -64,8 +64,8 @@ case ARM::MOVr: case ARM::tMOVr: assert(MI.getDesc().getNumOperands() >= 2 && - MI.getOperand(0).isRegister() && - MI.getOperand(1).isRegister() && + MI.getOperand(0).isReg() && + MI.getOperand(1).isReg() && "Invalid ARM MOV instruction"); SrcReg = MI.getOperand(1).getReg(); DstReg = MI.getOperand(0).getReg(); @@ -77,9 +77,9 @@ switch (MI->getOpcode()) { default: break; case ARM::LDR: - if (MI->getOperand(1).isFrameIndex() && - MI->getOperand(2).isRegister() && - MI->getOperand(3).isImmediate() && + if (MI->getOperand(1).isFI() && + MI->getOperand(2).isReg() && + MI->getOperand(3).isImm() && MI->getOperand(2).getReg() == 0 && MI->getOperand(3).getImm() == 0) { FrameIndex = MI->getOperand(1).getIndex(); @@ -88,16 +88,16 @@ break; case ARM::FLDD: case ARM::FLDS: - if (MI->getOperand(1).isFrameIndex() && - MI->getOperand(2).isImmediate() && + if (MI->getOperand(1).isFI() && + MI->getOperand(2).isImm() && MI->getOperand(2).getImm() == 0) { FrameIndex = MI->getOperand(1).getIndex(); return MI->getOperand(0).getReg(); } break; case ARM::tRestore: - if (MI->getOperand(1).isFrameIndex() && - MI->getOperand(2).isImmediate() && + if (MI->getOperand(1).isFI() && + MI->getOperand(2).isImm() && MI->getOperand(2).getImm() == 0) { FrameIndex = MI->getOperand(1).getIndex(); return MI->getOperand(0).getReg(); @@ -111,9 +111,9 @@ switch (MI->getOpcode()) { default: break; case ARM::STR: - if (MI->getOperand(1).isFrameIndex() && - MI->getOperand(2).isRegister() && - MI->getOperand(3).isImmediate() && + if (MI->getOperand(1).isFI() && + MI->getOperand(2).isReg() && + MI->getOperand(3).isImm() && MI->getOperand(2).getReg() == 0 && MI->getOperand(3).getImm() == 0) { FrameIndex = MI->getOperand(1).getIndex(); @@ -122,16 +122,16 @@ break; case ARM::FSTD: case ARM::FSTS: - if (MI->getOperand(1).isFrameIndex() && - MI->getOperand(2).isImmediate() && + if (MI->getOperand(1).isFI() && + MI->getOperand(2).isImm() && MI->getOperand(2).getImm() == 0) { FrameIndex = MI->getOperand(1).getIndex(); return MI->getOperand(0).getReg(); } break; case ARM::tSpill: - if (MI->getOperand(1).isFrameIndex() && - MI->getOperand(2).isImmediate() && + if (MI->getOperand(1).isFI() && + MI->getOperand(2).isImm() && MI->getOperand(2).getImm() == 0) { FrameIndex = MI->getOperand(1).getIndex(); return MI->getOperand(0).getReg(); @@ -298,7 +298,7 @@ // Transfer LiveVariables states, kill / dead info. for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { MachineOperand &MO = MI->getOperand(i); - if (MO.isRegister() && MO.getReg() && + if (MO.isReg() && MO.getReg() && TargetRegisterInfo::isVirtualRegister(MO.getReg())) { unsigned Reg = MO.getReg(); @@ -491,11 +491,11 @@ static const MachineInstrBuilder &ARMInstrAddOperand(MachineInstrBuilder &MIB, MachineOperand &MO) { - if (MO.isRegister()) + if (MO.isReg()) MIB = MIB.addReg(MO.getReg(), MO.isDef(), MO.isImplicit()); - else if (MO.isImmediate()) + else if (MO.isImm()) MIB = MIB.addImm(MO.getImm()); - else if (MO.isFrameIndex()) + else if (MO.isFI()) MIB = MIB.addFrameIndex(MO.getIndex()); else assert(0 && "Unknown operand for ARMInstrAddOperand!"); @@ -538,7 +538,7 @@ if (RC == ARM::GPRRegisterClass) { ARMFunctionInfo *AFI = MF.getInfo(); if (AFI->isThumbFunction()) { - Opc = Addr[0].isFrameIndex() ? ARM::tSpill : ARM::tSTR; + Opc = Addr[0].isFI() ? ARM::tSpill : ARM::tSTR; MachineInstrBuilder MIB = BuildMI(MF, get(Opc)).addReg(SrcReg, false, false, isKill); for (unsigned i = 0, e = Addr.size(); i != e; ++i) @@ -594,7 +594,7 @@ if (RC == ARM::GPRRegisterClass) { ARMFunctionInfo *AFI = MF.getInfo(); if (AFI->isThumbFunction()) { - Opc = Addr[0].isFrameIndex() ? ARM::tRestore : ARM::tLDR; + Opc = Addr[0].isFI() ? ARM::tRestore : ARM::tLDR; MachineInstrBuilder MIB = BuildMI(MF, get(Opc), DestReg); for (unsigned i = 0, e = Addr.size(); i != e; ++i) MIB = ARMInstrAddOperand(MIB, Addr[i]); @@ -868,7 +868,7 @@ bool Found = false; for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { const MachineOperand &MO = MI->getOperand(i); - if (MO.isRegister() && MO.getReg() == ARM::CPSR) { + if (MO.isReg() && MO.getReg() == ARM::CPSR) { Pred.push_back(MO); Found = true; } Modified: llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp Fri Oct 3 10:45:36 2008 @@ -544,13 +544,13 @@ default: break; case ARM::LDR: case ARM::STR: - return MI->getOperand(1).isRegister() && MI->getOperand(2).getReg() == 0; + return MI->getOperand(1).isReg() && MI->getOperand(2).getReg() == 0; case ARM::FLDS: case ARM::FSTS: - return MI->getOperand(1).isRegister(); + return MI->getOperand(1).isReg(); case ARM::FLDD: case ARM::FSTD: - return MI->getOperand(1).isRegister(); + return MI->getOperand(1).isReg(); } return false; } Modified: llvm/trunk/lib/Target/ARM/ARMRegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMRegisterInfo.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMRegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMRegisterInfo.cpp Fri Oct 3 10:45:36 2008 @@ -540,7 +540,7 @@ ARMFunctionInfo *AFI = MF.getInfo(); bool isThumb = AFI->isThumbFunction(); - while (!MI.getOperand(i).isFrameIndex()) { + while (!MI.getOperand(i).isFI()) { ++i; assert(i < MI.getNumOperands() && "Instr doesn't have FrameIndex operand!"); } @@ -1020,7 +1020,7 @@ for (MachineFunction::iterator BB = MF.begin(),E = MF.end();BB != E; ++BB) for (MachineBasicBlock::iterator I= BB->begin(); I != BB->end(); ++I) { for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i) - if (I->getOperand(i).isFrameIndex()) { + if (I->getOperand(i).isFI()) { unsigned Opcode = I->getOpcode(); const TargetInstrDesc &Desc = TII.get(Opcode); unsigned AddrMode = (Desc.TSFlags & ARMII::AddrModeMask); @@ -1086,7 +1086,7 @@ int Opc, unsigned Area, const ARMSubtarget &STI) { while (MBBI != MBB.end() && - MBBI->getOpcode() == Opc && MBBI->getOperand(1).isFrameIndex()) { + MBBI->getOpcode() == Opc && MBBI->getOperand(1).isFI()) { if (Area != 0) { bool Done = false; unsigned Category = 0; @@ -1250,7 +1250,7 @@ return ((MI->getOpcode() == ARM::FLDD || MI->getOpcode() == ARM::LDR || MI->getOpcode() == ARM::tRestore) && - MI->getOperand(1).isFrameIndex() && + MI->getOperand(1).isFI() && isCalleeSavedRegister(MI->getOperand(0).getReg(), CSRegs)); } 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=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Fri Oct 3 10:45:36 2008 @@ -359,7 +359,7 @@ /// immediate in bits 0-7. void ARMAsmPrinter::printSOImmOperand(const MachineInstr *MI, int OpNum) { const MachineOperand &MO = MI->getOperand(OpNum); - assert(MO.isImmediate() && "Not a valid so_imm value!"); + assert(MO.isImm() && "Not a valid so_imm value!"); printSOImm(O, MO.getImm(), TAI); } @@ -367,7 +367,7 @@ /// followed by a or to materialize. void ARMAsmPrinter::printSOImm2PartOperand(const MachineInstr *MI, int OpNum) { const MachineOperand &MO = MI->getOperand(OpNum); - assert(MO.isImmediate() && "Not a valid so_imm value!"); + assert(MO.isImm() && "Not a valid so_imm value!"); unsigned V1 = ARM_AM::getSOImmTwoPartFirst(MO.getImm()); unsigned V2 = ARM_AM::getSOImmTwoPartSecond(MO.getImm()); printSOImm(O, ARM_AM::getSOImmVal(V1), TAI); @@ -413,7 +413,7 @@ const MachineOperand &MO2 = MI->getOperand(Op+1); const MachineOperand &MO3 = MI->getOperand(Op+2); - if (!MO1.isRegister()) { // FIXME: This is for CP entries, but isn't right. + if (!MO1.isReg()) { // FIXME: This is for CP entries, but isn't right. printOperand(MI, Op); return; } @@ -526,7 +526,7 @@ const MachineOperand &MO1 = MI->getOperand(Op); const MachineOperand &MO2 = MI->getOperand(Op+1); - if (!MO1.isRegister()) { // FIXME: This is for CP entries, but isn't right. + if (!MO1.isReg()) { // FIXME: This is for CP entries, but isn't right. printOperand(MI, Op); return; } @@ -587,7 +587,7 @@ const MachineOperand &MO2 = MI->getOperand(Op+1); const MachineOperand &MO3 = MI->getOperand(Op+2); - if (!MO1.isRegister()) { // FIXME: This is for CP entries, but isn't right. + if (!MO1.isReg()) { // FIXME: This is for CP entries, but isn't right. printOperand(MI, Op); return; } @@ -749,9 +749,9 @@ // Fallthrough case 'H': // Write second word of DI / DF reference. // Verify that this operand has two consecutive registers. - if (!MI->getOperand(OpNo).isRegister() || + if (!MI->getOperand(OpNo).isReg() || OpNo+1 == MI->getNumOperands() || - !MI->getOperand(OpNo+1).isRegister()) + !MI->getOperand(OpNo+1).isReg()) return true; ++OpNo; // Return the high-part. } Modified: llvm/trunk/lib/Target/Alpha/AlphaAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaAsmPrinter.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AlphaAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/Alpha/AlphaAsmPrinter.cpp Fri Oct 3 10:45:36 2008 @@ -80,7 +80,7 @@ assert(TargetRegisterInfo::isPhysicalRegister(MO.getReg()) && "Not physreg??"); O << TM.getRegisterInfo()->get(MO.getReg()).AsmName; - } else if (MO.isImmediate()) { + } else if (MO.isImm()) { O << MO.getImm(); assert(MO.getImm() < (1 << 30)); } else { Modified: llvm/trunk/lib/Target/Alpha/AlphaCodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaCodeEmitter.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AlphaCodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/Alpha/AlphaCodeEmitter.cpp Fri Oct 3 10:45:36 2008 @@ -148,12 +148,11 @@ unsigned rv = 0; // Return value; defaults to 0 for unhandled cases // or things that get fixed up later by the JIT. - if (MO.isRegister()) { + if (MO.isReg()) { rv = getAlphaRegNumber(MO.getReg()); - } else if (MO.isImmediate()) { + } else if (MO.isImm()) { rv = MO.getImm(); - } else if (MO.isGlobalAddress() || MO.isExternalSymbol() - || MO.isConstantPoolIndex()) { + } else if (MO.isGlobal() || MO.isSymbol() || MO.isCPI()) { DOUT << MO << " is a relocated op for " << MI << "\n"; unsigned Reloc = 0; int Offset = 0; @@ -193,19 +192,19 @@ assert(0 && "unknown relocatable instruction"); abort(); } - if (MO.isGlobalAddress()) + if (MO.isGlobal()) MCE.addRelocation(MachineRelocation::getGV(MCE.getCurrentPCOffset(), Reloc, MO.getGlobal(), Offset, isa(MO.getGlobal()), useGOT)); - else if (MO.isExternalSymbol()) + else if (MO.isSymbol()) MCE.addRelocation(MachineRelocation::getExtSym(MCE.getCurrentPCOffset(), Reloc, MO.getSymbolName(), Offset, true)); else MCE.addRelocation(MachineRelocation::getConstPool(MCE.getCurrentPCOffset(), Reloc, MO.getIndex(), Offset)); - } else if (MO.isMachineBasicBlock()) { + } else if (MO.isMBB()) { MCE.addRelocation(MachineRelocation::getBB(MCE.getCurrentPCOffset(), Alpha::reloc_bsr, MO.getMBB())); }else { Modified: llvm/trunk/lib/Target/Alpha/AlphaInstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaInstrInfo.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AlphaInstrInfo.cpp (original) +++ llvm/trunk/lib/Target/Alpha/AlphaInstrInfo.cpp Fri Oct 3 10:45:36 2008 @@ -35,9 +35,9 @@ // or r1, r2, r2 // cpys(s|t) r1 r2 r2 assert(MI.getNumOperands() >= 3 && - MI.getOperand(0).isRegister() && - MI.getOperand(1).isRegister() && - MI.getOperand(2).isRegister() && + MI.getOperand(0).isReg() && + MI.getOperand(1).isReg() && + MI.getOperand(2).isReg() && "invalid Alpha BIS instruction!"); if (MI.getOperand(1).getReg() == MI.getOperand(2).getReg()) { sourceReg = MI.getOperand(1).getReg(); @@ -57,7 +57,7 @@ case Alpha::LDWU: case Alpha::LDS: case Alpha::LDT: - if (MI->getOperand(1).isFrameIndex()) { + if (MI->getOperand(1).isFI()) { FrameIndex = MI->getOperand(1).getIndex(); return MI->getOperand(0).getReg(); } @@ -75,7 +75,7 @@ case Alpha::STW: case Alpha::STS: case Alpha::STT: - if (MI->getOperand(1).isFrameIndex()) { + if (MI->getOperand(1).isFI()) { FrameIndex = MI->getOperand(1).getIndex(); return MI->getOperand(0).getReg(); } @@ -200,7 +200,7 @@ BuildMI(MF, get(Opc)).addReg(SrcReg, false, false, isKill); for (unsigned i = 0, e = Addr.size(); i != e; ++i) { MachineOperand &MO = Addr[i]; - if (MO.isRegister()) + if (MO.isReg()) MIB.addReg(MO.getReg(), MO.isDef(), MO.isImplicit()); else MIB.addImm(MO.getImm()); @@ -245,7 +245,7 @@ BuildMI(MF, get(Opc), DestReg); for (unsigned i = 0, e = Addr.size(); i != e; ++i) { MachineOperand &MO = Addr[i]; - if (MO.isRegister()) + if (MO.isReg()) MIB.addReg(MO.getReg(), MO.isDef(), MO.isImplicit()); else MIB.addImm(MO.getImm()); Modified: llvm/trunk/lib/Target/Alpha/AlphaRegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaRegisterInfo.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AlphaRegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/Alpha/AlphaRegisterInfo.cpp Fri Oct 3 10:45:36 2008 @@ -159,7 +159,7 @@ MachineFunction &MF = *MBB.getParent(); bool FP = hasFP(MF); - while (!MI.getOperand(i).isFrameIndex()) { + while (!MI.getOperand(i).isFI()) { ++i; assert(i < MI.getNumOperands() && "Instr doesn't have FrameIndex operand!"); } Modified: llvm/trunk/lib/Target/CellSPU/SPUAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUAsmPrinter.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/SPUAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/CellSPU/SPUAsmPrinter.cpp Fri Oct 3 10:45:36 2008 @@ -81,10 +81,10 @@ void printOperand(const MachineInstr *MI, unsigned OpNo) { const MachineOperand &MO = MI->getOperand(OpNo); - if (MO.isRegister()) { + if (MO.isReg()) { assert(TargetRegisterInfo::isPhysicalRegister(MO.getReg())&&"Not physreg??"); O << TM.getRegisterInfo()->get(MO.getReg()).AsmName; - } else if (MO.isImmediate()) { + } else if (MO.isImm()) { O << MO.getImm(); } else { printOp(MO); @@ -186,8 +186,8 @@ printMemRegImmS10(const MachineInstr *MI, unsigned OpNo) { const MachineOperand &MO = MI->getOperand(OpNo); - assert(MO.isImmediate() - && "printMemRegImmS10 first operand is not immedate"); + assert(MO.isImm() && + "printMemRegImmS10 first operand is not immedate"); printS10ImmOperand(MI, OpNo); O << "("; printOperand(MI, OpNo+1); @@ -198,11 +198,11 @@ printAddr256K(const MachineInstr *MI, unsigned OpNo) { /* Note: operand 1 is an offset or symbol name. */ - if (MI->getOperand(OpNo).isImmediate()) { + if (MI->getOperand(OpNo).isImm()) { printS16ImmOperand(MI, OpNo); } else { printOp(MI->getOperand(OpNo)); - if (MI->getOperand(OpNo+1).isImmediate()) { + if (MI->getOperand(OpNo+1).isImm()) { int displ = int(MI->getOperand(OpNo+1).getImm()); if (displ > 0) O << "+" << displ; @@ -222,7 +222,7 @@ } void printSymbolHi(const MachineInstr *MI, unsigned OpNo) { - if (MI->getOperand(OpNo).isImmediate()) { + if (MI->getOperand(OpNo).isImm()) { printS16ImmOperand(MI, OpNo); } else { printOp(MI->getOperand(OpNo)); @@ -231,7 +231,7 @@ } void printSymbolLo(const MachineInstr *MI, unsigned OpNo) { - if (MI->getOperand(OpNo).isImmediate()) { + if (MI->getOperand(OpNo).isImm()) { printS16ImmOperand(MI, OpNo); } else { printOp(MI->getOperand(OpNo)); @@ -245,7 +245,7 @@ } void printROTHNeg7Imm(const MachineInstr *MI, unsigned OpNo) { - if (MI->getOperand(OpNo).isImmediate()) { + if (MI->getOperand(OpNo).isImm()) { int value = (int) MI->getOperand(OpNo).getImm(); assert((value >= 0 && value < 16) && "Invalid negated immediate rotate 7-bit argument"); @@ -256,7 +256,7 @@ } void printROTNeg7Imm(const MachineInstr *MI, unsigned OpNo) { - if (MI->getOperand(OpNo).isImmediate()) { + if (MI->getOperand(OpNo).isImm()) { int value = (int) MI->getOperand(OpNo).getImm(); assert((value >= 0 && value < 32) && "Invalid negated immediate rotate 7-bit argument"); @@ -372,9 +372,9 @@ default: return true; // Unknown modifier. case 'L': // Write second word of DImode reference. // Verify that this operand has two consecutive registers. - if (!MI->getOperand(OpNo).isRegister() || + if (!MI->getOperand(OpNo).isReg() || OpNo+1 == MI->getNumOperands() || - !MI->getOperand(OpNo+1).isRegister()) + !MI->getOperand(OpNo+1).isReg()) return true; ++OpNo; // Return the high-part. break; Modified: llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.cpp (original) +++ llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.cpp Fri Oct 3 10:45:36 2008 @@ -60,9 +60,9 @@ case SPU::AHIr16: case SPU::AIvec: assert(MI.getNumOperands() == 3 && - MI.getOperand(0).isRegister() && - MI.getOperand(1).isRegister() && - MI.getOperand(2).isImmediate() && + MI.getOperand(0).isReg() && + MI.getOperand(1).isReg() && + MI.getOperand(2).isImm() && "invalid SPU ORI/ORHI/ORBI/AHI/AI/SFI/SFHI instruction!"); if (MI.getOperand(2).getImm() == 0) { sourceReg = MI.getOperand(1).getReg(); @@ -73,10 +73,10 @@ case SPU::AIr32: assert(MI.getNumOperands() == 3 && "wrong number of operands to AIr32"); - if (MI.getOperand(0).isRegister() && - (MI.getOperand(1).isRegister() || - MI.getOperand(1).isFrameIndex()) && - (MI.getOperand(2).isImmediate() && + if (MI.getOperand(0).isReg() && + (MI.getOperand(1).isReg() || + MI.getOperand(1).isFI()) && + (MI.getOperand(2).isImm() && MI.getOperand(2).getImm() == 0)) { sourceReg = MI.getOperand(1).getReg(); destReg = MI.getOperand(0).getReg(); @@ -103,9 +103,9 @@ case SPU::ORf32: case SPU::ORf64: assert(MI.getNumOperands() == 3 && - MI.getOperand(0).isRegister() && - MI.getOperand(1).isRegister() && - MI.getOperand(2).isRegister() && + MI.getOperand(0).isReg() && + MI.getOperand(1).isReg() && + MI.getOperand(2).isReg() && "invalid SPU OR(vec|r32|r64|gprc) instruction!"); if (MI.getOperand(1).getReg() == MI.getOperand(2).getReg()) { sourceReg = MI.getOperand(1).getReg(); @@ -136,8 +136,8 @@ case SPU::LQXr64: case SPU::LQXr32: case SPU::LQXr16: - if (MI->getOperand(1).isImmediate() && !MI->getOperand(1).getImm() && - MI->getOperand(2).isFrameIndex()) { + if (MI->getOperand(1).isImm() && !MI->getOperand(1).getImm() && + MI->getOperand(2).isFI()) { FrameIndex = MI->getOperand(2).getIndex(); return MI->getOperand(0).getReg(); } @@ -170,8 +170,8 @@ case SPU::STQXr32: case SPU::STQXr16: // case SPU::STQXr8: - if (MI->getOperand(1).isImmediate() && !MI->getOperand(1).getImm() && - MI->getOperand(2).isFrameIndex()) { + if (MI->getOperand(1).isImm() && !MI->getOperand(1).getImm() && + MI->getOperand(2).isFI()) { FrameIndex = MI->getOperand(2).getIndex(); return MI->getOperand(0).getReg(); } @@ -273,7 +273,7 @@ cerr << "storeRegToAddr() invoked!\n"; abort(); - if (Addr[0].isFrameIndex()) { + if (Addr[0].isFI()) { /* do what storeRegToStackSlot does here */ } else { unsigned Opc = 0; @@ -297,9 +297,9 @@ .addReg(SrcReg, false, false, isKill); for (unsigned i = 0, e = Addr.size(); i != e; ++i) { MachineOperand &MO = Addr[i]; - if (MO.isRegister()) + if (MO.isReg()) MIB.addReg(MO.getReg()); - else if (MO.isImmediate()) + else if (MO.isImm()) MIB.addImm(MO.getImm()); else MIB.addFrameIndex(MO.getIndex()); @@ -358,7 +358,7 @@ cerr << "loadRegToAddr() invoked!\n"; abort(); - if (Addr[0].isFrameIndex()) { + if (Addr[0].isFI()) { /* do what loadRegFromStackSlot does here... */ } else { unsigned Opc = 0; @@ -383,9 +383,9 @@ MachineInstrBuilder MIB = BuildMI(MF, get(Opc), DestReg); for (unsigned i = 0, e = Addr.size(); i != e; ++i) { MachineOperand &MO = Addr[i]; - if (MO.isRegister()) + if (MO.isReg()) MIB.addReg(MO.getReg()); - else if (MO.isImmediate()) + else if (MO.isImm()) MIB.addImm(MO.getImm()); else MIB.addFrameIndex(MO.getIndex()); Modified: llvm/trunk/lib/Target/CellSPU/SPURegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPURegisterInfo.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/SPURegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/CellSPU/SPURegisterInfo.cpp Fri Oct 3 10:45:36 2008 @@ -328,7 +328,7 @@ MachineFunction &MF = *MBB.getParent(); MachineFrameInfo *MFI = MF.getFrameInfo(); - while (!MI.getOperand(i).isFrameIndex()) { + while (!MI.getOperand(i).isFI()) { ++i; assert(i < MI.getNumOperands() && "Instr doesn't have FrameIndex operand!"); } Modified: llvm/trunk/lib/Target/IA64/IA64AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64AsmPrinter.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/Target/IA64/IA64AsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/IA64/IA64AsmPrinter.cpp Fri Oct 3 10:45:36 2008 @@ -91,7 +91,7 @@ // pool entries aren't immediates at this stage, so we check here. // If it's an immediate, print it the old fashioned way. If it's // not, we print it as a constant pool index. - if(MI->getOperand(OpNo).isImmediate()) { + if (MI->getOperand(OpNo).isImm()) { O << (int64_t)MI->getOperand(OpNo).getImm(); } else { // this is a constant pool reference: FIXME: assert this printOp(MI->getOperand(OpNo)); Modified: llvm/trunk/lib/Target/IA64/IA64Bundling.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64Bundling.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/Target/IA64/IA64Bundling.cpp (original) +++ llvm/trunk/lib/Target/IA64/IA64Bundling.cpp Fri Oct 3 10:45:36 2008 @@ -84,7 +84,7 @@ for(unsigned i=0; i < CurrentInsn->getNumOperands(); i++) { MachineOperand &MO=CurrentInsn->getOperand(i); - if(MO.isRegister()) { + if (MO.isReg()) { if(MO.isUse()) { // TODO: exclude p0 CurrentReads.insert(MO.getReg()); } Modified: llvm/trunk/lib/Target/IA64/IA64InstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64InstrInfo.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/Target/IA64/IA64InstrInfo.cpp (original) +++ llvm/trunk/lib/Target/IA64/IA64InstrInfo.cpp Fri Oct 3 10:45:36 2008 @@ -31,11 +31,11 @@ if (oc == IA64::MOV || oc == IA64::FMOV) { // TODO: this doesn't detect predicate moves assert(MI.getNumOperands() >= 2 && - /* MI.getOperand(0).isRegister() && - MI.getOperand(1).isRegister() && */ + /* MI.getOperand(0).isReg() && + MI.getOperand(1).isReg() && */ "invalid register-register move instruction"); - if( MI.getOperand(0).isRegister() && - MI.getOperand(1).isRegister() ) { + if (MI.getOperand(0).isReg() && + MI.getOperand(1).isReg()) { // if both operands of the MOV/FMOV are registers, then // yes, this is a move instruction sourceReg = MI.getOperand(1).getReg(); @@ -122,9 +122,9 @@ MachineInstrBuilder MIB = BuildMI(MF, get(Opc)); for (unsigned i = 0, e = Addr.size(); i != e; ++i) { MachineOperand &MO = Addr[i]; - if (MO.isRegister()) + if (MO.isReg()) MIB.addReg(MO.getReg()); - else if (MO.isImmediate()) + else if (MO.isImm()) MIB.addImm(MO.getImm()); else MIB.addFrameIndex(MO.getIndex()); @@ -174,9 +174,9 @@ MachineInstrBuilder MIB = BuildMI(MF, get(Opc), DestReg); for (unsigned i = 0, e = Addr.size(); i != e; ++i) { MachineOperand &MO = Addr[i]; - if (MO.isRegister()) + if (MO.isReg()) MIB.addReg(MO.getReg()); - else if (MO.isImmediate()) + else if (MO.isImm()) MIB.addImm(MO.getImm()); else MIB.addFrameIndex(MO.getIndex()); Modified: llvm/trunk/lib/Target/IA64/IA64RegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64RegisterInfo.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/Target/IA64/IA64RegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/IA64/IA64RegisterInfo.cpp Fri Oct 3 10:45:36 2008 @@ -121,7 +121,7 @@ bool FP = hasFP(MF); - while (!MI.getOperand(i).isFrameIndex()) { + while (!MI.getOperand(i).isFI()) { ++i; assert(i < MI.getNumOperands() && "Instr doesn't have FrameIndex operand!"); } Modified: llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp Fri Oct 3 10:45:36 2008 @@ -336,26 +336,24 @@ // using PIC_. %call16 is used to load direct call targets // on PIC_ and small code size. %call_lo and %call_hi load // direct call targets on PIC_ and large code size. - if (MI->getOpcode() == Mips::LUi && !MO.isRegister() - && !MO.isImmediate()) { + if (MI->getOpcode() == Mips::LUi && !MO.isReg() && !MO.isImm()) { if ((isPIC) && (isCodeLarge)) O << "%call_hi("; else O << "%hi("; closeP = true; - } else if ((MI->getOpcode() == Mips::ADDiu) && !MO.isRegister() - && !MO.isImmediate()) { + } else if ((MI->getOpcode() == Mips::ADDiu) && !MO.isReg() && !MO.isImm()) { const MachineOperand &firstMO = MI->getOperand(opNum-1); if (firstMO.getReg() == Mips::GP) O << "%gp_rel("; else O << "%lo("; closeP = true; - } else if ((isPIC) && (MI->getOpcode() == Mips::LW) - && (!MO.isRegister()) && (!MO.isImmediate())) { + } else if ((isPIC) && (MI->getOpcode() == Mips::LW) && + (!MO.isReg()) && (!MO.isImm())) { const MachineOperand &firstMO = MI->getOperand(opNum-1); const MachineOperand &lastMO = MI->getOperand(opNum+1); - if ((firstMO.isRegister()) && (lastMO.isRegister())) { + if ((firstMO.isReg()) && (lastMO.isReg())) { if ((firstMO.getReg() == Mips::T9) && (lastMO.getReg() == Mips::GP) && (!isCodeLarge)) O << "%call16("; Modified: llvm/trunk/lib/Target/Mips/MipsInstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsInstrInfo.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsInstrInfo.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsInstrInfo.cpp Fri Oct 3 10:45:36 2008 @@ -24,7 +24,7 @@ TM(tm), RI(*TM.getSubtargetImpl(), *this) {} static bool isZeroImm(const MachineOperand &op) { - return op.isImmediate() && op.getImm() == 0; + return op.isImm() && op.getImm() == 0; } /// Return true if the instruction is a register to register move and @@ -60,7 +60,7 @@ // addiu $dst, $src, 0 if (MI.getOpcode() == Mips::ADDiu) { - if ((MI.getOperand(1).isRegister()) && (isZeroImm(MI.getOperand(2)))) { + if ((MI.getOperand(1).isReg()) && (isZeroImm(MI.getOperand(2)))) { DstReg = MI.getOperand(0).getReg(); SrcReg = MI.getOperand(1).getReg(); return true; @@ -79,8 +79,8 @@ { if ((MI->getOpcode() == Mips::LW) || (MI->getOpcode() == Mips::LWC1) || (MI->getOpcode() == Mips::LWC1A) || (MI->getOpcode() == Mips::LDC1)) { - if ((MI->getOperand(2).isFrameIndex()) && // is a stack slot - (MI->getOperand(1).isImmediate()) && // the imm is zero + if ((MI->getOperand(2).isFI()) && // is a stack slot + (MI->getOperand(1).isImm()) && // the imm is zero (isZeroImm(MI->getOperand(1)))) { FrameIndex = MI->getOperand(2).getIndex(); return MI->getOperand(0).getReg(); @@ -100,8 +100,8 @@ { if ((MI->getOpcode() == Mips::SW) || (MI->getOpcode() == Mips::SWC1) || (MI->getOpcode() == Mips::SWC1A) || (MI->getOpcode() == Mips::SDC1)) { - if ((MI->getOperand(2).isFrameIndex()) && // is a stack slot - (MI->getOperand(1).isImmediate()) && // the imm is zero + if ((MI->getOperand(2).isFI()) && // is a stack slot + (MI->getOperand(1).isImm()) && // the imm is zero (isZeroImm(MI->getOperand(1)))) { FrameIndex = MI->getOperand(2).getIndex(); return MI->getOperand(0).getReg(); @@ -217,9 +217,9 @@ .addReg(SrcReg, false, false, isKill); for (unsigned i = 0, e = Addr.size(); i != e; ++i) { MachineOperand &MO = Addr[i]; - if (MO.isRegister()) + if (MO.isReg()) MIB.addReg(MO.getReg()); - else if (MO.isImmediate()) + else if (MO.isImm()) MIB.addImm(MO.getImm()); else MIB.addFrameIndex(MO.getIndex()); @@ -267,9 +267,9 @@ MachineInstrBuilder MIB = BuildMI(MF, get(Opc), DestReg); for (unsigned i = 0, e = Addr.size(); i != e; ++i) { MachineOperand &MO = Addr[i]; - if (MO.isRegister()) + if (MO.isReg()) MIB.addReg(MO.getReg()); - else if (MO.isImmediate()) + else if (MO.isImm()) MIB.addImm(MO.getImm()); else MIB.addFrameIndex(MO.getIndex()); @@ -289,10 +289,10 @@ switch (MI->getOpcode()) { case Mips::ADDu: - if ((MI->getOperand(0).isRegister()) && - (MI->getOperand(1).isRegister()) && + if ((MI->getOperand(0).isReg()) && + (MI->getOperand(1).isReg()) && (MI->getOperand(1).getReg() == Mips::ZERO) && - (MI->getOperand(2).isRegister())) { + (MI->getOperand(2).isReg())) { if (Ops[0] == 0) { // COPY -> STORE unsigned SrcReg = MI->getOperand(2).getReg(); bool isKill = MI->getOperand(2).isKill(); @@ -310,8 +310,8 @@ case Mips::FMOV_SO32: case Mips::FMOV_AS32: case Mips::FMOV_D32: - if ((MI->getOperand(0).isRegister()) && - (MI->getOperand(1).isRegister())) { + if ((MI->getOperand(0).isReg()) && + (MI->getOperand(1).isReg())) { const TargetRegisterClass *RC = RI.getRegClass(MI->getOperand(0).getReg()); unsigned StoreOpc, LoadOpc; Modified: llvm/trunk/lib/Target/Mips/MipsRegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsRegisterInfo.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsRegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsRegisterInfo.cpp Fri Oct 3 10:45:36 2008 @@ -348,7 +348,7 @@ MachineFunction &MF = *MI.getParent()->getParent(); unsigned i = 0; - while (!MI.getOperand(i).isFrameIndex()) { + while (!MI.getOperand(i).isFI()) { ++i; assert(i < MI.getNumOperands() && "Instr doesn't have FrameIndex operand!"); Modified: llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp Fri Oct 3 10:45:36 2008 @@ -288,7 +288,7 @@ void PIC16AsmPrinter::printSOImmOperand(const MachineInstr *MI, int OpNum) { const MachineOperand &MO = MI->getOperand(OpNum); - assert(MO.isImmediate() && "Not a valid so_imm value!"); + assert(MO.isImm() && "Not a valid so_imm value!"); printSOImm(O, MO.getImm(), TAI); } @@ -298,19 +298,19 @@ const MachineOperand &MO1 = MI->getOperand(Op); const MachineOperand &MO2 = MI->getOperand(Op+1); - if (MO2.isFrameIndex ()) { + if (MO2.isFI()) { printOperand(MI, Op+1); return; } - if (!MO1.isRegister()) { + if (!MO1.isReg()) { // FIXME: This is for CP entries, but isn't right. printOperand(MI, Op); return; } // If this is Stack Slot - if (MO1.isRegister()) { + if (MO1.isReg()) { if (strcmp(TM.getRegisterInfo()->get(MO1.getReg()).Name, "SP") == 0) { O << CurrentFnName <<"_"<< MO2.getImm(); return; Modified: llvm/trunk/lib/Target/PIC16/PIC16InstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16InstrInfo.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16InstrInfo.cpp (original) +++ llvm/trunk/lib/Target/PIC16/PIC16InstrInfo.cpp Fri Oct 3 10:45:36 2008 @@ -27,7 +27,7 @@ TM(tm), RI(*this) {} static bool isZeroImm(const MachineOperand &op) { - return op.isImmediate() && op.getImm() == 0; + return op.isImm() && op.getImm() == 0; } @@ -40,8 +40,8 @@ isLoadFromStackSlot(MachineInstr *MI, int &FrameIndex) const { if (MI->getOpcode() == PIC16::MOVF) { - if ((MI->getOperand(2).isFrameIndex()) && // is a stack slot - (MI->getOperand(1).isImmediate()) && // the imm is zero + if ((MI->getOperand(2).isFI()) && // is a stack slot + (MI->getOperand(1).isImm()) && // the imm is zero (isZeroImm(MI->getOperand(1)))) { FrameIndex = MI->getOperand(2).getIndex(); return MI->getOperand(0).getReg(); @@ -60,8 +60,8 @@ isStoreToStackSlot(MachineInstr *MI, int &FrameIndex) const { if (MI->getOpcode() == PIC16::MOVWF) { - if ((MI->getOperand(0).isFrameIndex()) && // is a stack slot - (MI->getOperand(1).isImmediate()) && // the imm is zero + if ((MI->getOperand(0).isFI()) && // is a stack slot + (MI->getOperand(1).isImm()) && // the imm is zero (isZeroImm(MI->getOperand(1)))) { FrameIndex = MI->getOperand(0).getIndex(); return MI->getOperand(2).getReg(); Modified: llvm/trunk/lib/Target/PIC16/PIC16RegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16RegisterInfo.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16RegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/PIC16/PIC16RegisterInfo.cpp Fri Oct 3 10:45:36 2008 @@ -141,7 +141,7 @@ MachineFunction &MF = *MI.getParent()->getParent(); unsigned i = 0; - while (!MI.getOperand(i).isFrameIndex()) { + while (!MI.getOperand(i).isFI()) { ++i; assert(i < MI.getNumOperands() && "Instr doesn't have FrameIndex operand!"); 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=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp Fri Oct 3 10:45:36 2008 @@ -123,9 +123,9 @@ void printOperand(const MachineInstr *MI, unsigned OpNo) { const MachineOperand &MO = MI->getOperand(OpNo); - if (MO.isRegister()) { + if (MO.isReg()) { printRegister(MO, false); - } else if (MO.isImmediate()) { + } else if (MO.isImm()) { O << MO.getImm(); } else { printOp(MO); @@ -160,7 +160,7 @@ O << (unsigned short)MI->getOperand(OpNo).getImm(); } void printS16X4ImmOperand(const MachineInstr *MI, unsigned OpNo) { - if (MI->getOperand(OpNo).isImmediate()) { + if (MI->getOperand(OpNo).isImm()) { O << (short)(MI->getOperand(OpNo).getImm()*4); } else { O << "lo16("; @@ -174,7 +174,7 @@ void printBranchOperand(const MachineInstr *MI, unsigned OpNo) { // Branches can take an immediate operand. This is used by the branch // selection pass to print $+8, an eight byte displacement from the PC. - if (MI->getOperand(OpNo).isImmediate()) { + if (MI->getOperand(OpNo).isImm()) { O << "$+" << MI->getOperand(OpNo).getImm()*4; } else { printOp(MI->getOperand(OpNo)); @@ -214,7 +214,7 @@ O << "\"L" << getFunctionNumber() << "$pb\":"; } void printSymbolHi(const MachineInstr *MI, unsigned OpNo) { - if (MI->getOperand(OpNo).isImmediate()) { + if (MI->getOperand(OpNo).isImm()) { printS16ImmOperand(MI, OpNo); } else { if (Subtarget.isDarwin()) O << "ha16("; @@ -228,7 +228,7 @@ } } void printSymbolLo(const MachineInstr *MI, unsigned OpNo) { - if (MI->getOperand(OpNo).isImmediate()) { + if (MI->getOperand(OpNo).isImm()) { printS16ImmOperand(MI, OpNo); } else { if (Subtarget.isDarwin()) O << "lo16("; @@ -250,7 +250,7 @@ void printMemRegImm(const MachineInstr *MI, unsigned OpNo) { printSymbolLo(MI, OpNo); O << '('; - if (MI->getOperand(OpNo+1).isRegister() && + if (MI->getOperand(OpNo+1).isReg() && MI->getOperand(OpNo+1).getReg() == PPC::R0) O << "0"; else @@ -258,12 +258,12 @@ O << ')'; } void printMemRegImmShifted(const MachineInstr *MI, unsigned OpNo) { - if (MI->getOperand(OpNo).isImmediate()) + if (MI->getOperand(OpNo).isImm()) printS16X4ImmOperand(MI, OpNo); else printSymbolLo(MI, OpNo); O << '('; - if (MI->getOperand(OpNo+1).isRegister() && + if (MI->getOperand(OpNo+1).isReg() && MI->getOperand(OpNo+1).getReg() == PPC::R0) O << "0"; else @@ -443,16 +443,16 @@ return false; case 'L': // Write second word of DImode reference. // Verify that this operand has two consecutive registers. - if (!MI->getOperand(OpNo).isRegister() || + if (!MI->getOperand(OpNo).isReg() || OpNo+1 == MI->getNumOperands() || - !MI->getOperand(OpNo+1).isRegister()) + !MI->getOperand(OpNo+1).isReg()) return true; ++OpNo; // Return the high-part. break; case 'I': // Write 'i' if an integer constant, otherwise nothing. Used to print // addi vs add, etc. - if (MI->getOperand(OpNo).isImmediate()) + if (MI->getOperand(OpNo).isImm()) O << "i"; return false; } @@ -467,7 +467,7 @@ const char *ExtraCode) { if (ExtraCode && ExtraCode[0]) return true; // Unknown modifier. - if (MI->getOperand(OpNo).isRegister()) + if (MI->getOperand(OpNo).isReg()) printMemRegReg(MI, OpNo); else printMemRegImm(MI, OpNo); Modified: llvm/trunk/lib/Target/PowerPC/PPCBranchSelector.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCBranchSelector.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCBranchSelector.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCBranchSelector.cpp Fri Oct 3 10:45:36 2008 @@ -103,7 +103,7 @@ unsigned MBBStartOffset = 0; for (MachineBasicBlock::iterator I = MBB.begin(), E = MBB.end(); I != E; ++I) { - if (I->getOpcode() != PPC::BCC || I->getOperand(2).isImmediate()) { + if (I->getOpcode() != PPC::BCC || I->getOperand(2).isImm()) { MBBStartOffset += TII->GetInstSizeInBytes(I); continue; } Modified: llvm/trunk/lib/Target/PowerPC/PPCCodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCCodeEmitter.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCCodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCCodeEmitter.cpp Fri Oct 3 10:45:36 2008 @@ -126,7 +126,7 @@ unsigned rv = 0; // Return value; defaults to 0 for unhandled cases // or things that get fixed up later by the JIT. - if (MO.isRegister()) { + if (MO.isReg()) { rv = PPCRegisterInfo::getRegisterNumbering(MO.getReg()); // Special encoding for MTCRF and MFOCRF, which uses a bit mask for the @@ -135,10 +135,10 @@ (MO.getReg() >= PPC::CR0 && MO.getReg() <= PPC::CR7)) { rv = 0x80 >> rv; } - } else if (MO.isImmediate()) { + } else if (MO.isImm()) { rv = MO.getImm(); - } else if (MO.isGlobalAddress() || MO.isExternalSymbol() || - MO.isConstantPoolIndex() || MO.isJumpTableIndex()) { + } else if (MO.isGlobal() || MO.isSymbol() || + MO.isCPI() || MO.isJTI()) { unsigned Reloc = 0; if (MI.getOpcode() == PPC::BL_Macho || MI.getOpcode() == PPC::BL8_Macho || MI.getOpcode() == PPC::BL_ELF || MI.getOpcode() == PPC::BL8_ELF || @@ -193,18 +193,18 @@ } MachineRelocation R; - if (MO.isGlobalAddress()) { + if (MO.isGlobal()) { R = MachineRelocation::getGV(MCE.getCurrentPCOffset(), Reloc, MO.getGlobal(), 0, isa(MO.getGlobal())); - } else if (MO.isExternalSymbol()) { + } else if (MO.isSymbol()) { R = MachineRelocation::getExtSym(MCE.getCurrentPCOffset(), Reloc, MO.getSymbolName(), 0); - } else if (MO.isConstantPoolIndex()) { + } else if (MO.isCPI()) { R = MachineRelocation::getConstPool(MCE.getCurrentPCOffset(), Reloc, MO.getIndex(), 0); } else { - assert(MO.isJumpTableIndex()); + assert(MO.isJTI()); R = MachineRelocation::getJumpTable(MCE.getCurrentPCOffset(), Reloc, MO.getIndex(), 0); } @@ -220,7 +220,7 @@ } MCE.addRelocation(R); - } else if (MO.isMachineBasicBlock()) { + } else if (MO.isMBB()) { unsigned Reloc = 0; unsigned Opcode = MI.getOpcode(); if (Opcode == PPC::B || Opcode == PPC::BL_Macho || Modified: llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.cpp Fri Oct 3 10:45:36 2008 @@ -47,9 +47,9 @@ if (oc == PPC::OR || oc == PPC::OR8 || oc == PPC::VOR || oc == PPC::OR4To8 || oc == PPC::OR8To4) { // or r1, r2, r2 assert(MI.getNumOperands() >= 3 && - MI.getOperand(0).isRegister() && - MI.getOperand(1).isRegister() && - MI.getOperand(2).isRegister() && + MI.getOperand(0).isReg() && + MI.getOperand(1).isReg() && + MI.getOperand(2).isReg() && "invalid PPC OR instruction!"); if (MI.getOperand(1).getReg() == MI.getOperand(2).getReg()) { sourceReg = MI.getOperand(1).getReg(); @@ -58,19 +58,19 @@ } } else if (oc == PPC::ADDI) { // addi r1, r2, 0 assert(MI.getNumOperands() >= 3 && - MI.getOperand(0).isRegister() && - MI.getOperand(2).isImmediate() && + MI.getOperand(0).isReg() && + MI.getOperand(2).isImm() && "invalid PPC ADDI instruction!"); - if (MI.getOperand(1).isRegister() && MI.getOperand(2).getImm() == 0) { + if (MI.getOperand(1).isReg() && MI.getOperand(2).getImm() == 0) { sourceReg = MI.getOperand(1).getReg(); destReg = MI.getOperand(0).getReg(); return true; } } else if (oc == PPC::ORI) { // ori r1, r2, 0 assert(MI.getNumOperands() >= 3 && - MI.getOperand(0).isRegister() && - MI.getOperand(1).isRegister() && - MI.getOperand(2).isImmediate() && + MI.getOperand(0).isReg() && + MI.getOperand(1).isReg() && + MI.getOperand(2).isImm() && "invalid PPC ORI instruction!"); if (MI.getOperand(2).getImm() == 0) { sourceReg = MI.getOperand(1).getReg(); @@ -80,16 +80,16 @@ } else if (oc == PPC::FMRS || oc == PPC::FMRD || oc == PPC::FMRSD) { // fmr r1, r2 assert(MI.getNumOperands() >= 2 && - MI.getOperand(0).isRegister() && - MI.getOperand(1).isRegister() && + MI.getOperand(0).isReg() && + MI.getOperand(1).isReg() && "invalid PPC FMR instruction"); sourceReg = MI.getOperand(1).getReg(); destReg = MI.getOperand(0).getReg(); return true; } else if (oc == PPC::MCRF) { // mcrf cr1, cr2 assert(MI.getNumOperands() >= 2 && - MI.getOperand(0).isRegister() && - MI.getOperand(1).isRegister() && + MI.getOperand(0).isReg() && + MI.getOperand(1).isReg() && "invalid PPC MCRF instruction"); sourceReg = MI.getOperand(1).getReg(); destReg = MI.getOperand(0).getReg(); @@ -106,8 +106,8 @@ case PPC::LWZ: case PPC::LFS: case PPC::LFD: - if (MI->getOperand(1).isImmediate() && !MI->getOperand(1).getImm() && - MI->getOperand(2).isFrameIndex()) { + if (MI->getOperand(1).isImm() && !MI->getOperand(1).getImm() && + MI->getOperand(2).isFI()) { FrameIndex = MI->getOperand(2).getIndex(); return MI->getOperand(0).getReg(); } @@ -124,8 +124,8 @@ case PPC::STW: case PPC::STFS: case PPC::STFD: - if (MI->getOperand(1).isImmediate() && !MI->getOperand(1).getImm() && - MI->getOperand(2).isFrameIndex()) { + if (MI->getOperand(1).isImm() && !MI->getOperand(1).getImm() && + MI->getOperand(2).isFI()) { FrameIndex = MI->getOperand(2).getIndex(); return MI->getOperand(0).getReg(); } @@ -478,7 +478,7 @@ SmallVectorImpl &Addr, const TargetRegisterClass *RC, SmallVectorImpl &NewMIs) const{ - if (Addr[0].isFrameIndex()) { + if (Addr[0].isFI()) { if (StoreRegToStackSlot(MF, SrcReg, isKill, Addr[0].getIndex(), RC, NewMIs)) { PPCFunctionInfo *FuncInfo = MF.getInfo(); @@ -507,9 +507,9 @@ .addReg(SrcReg, false, false, isKill); for (unsigned i = 0, e = Addr.size(); i != e; ++i) { MachineOperand &MO = Addr[i]; - if (MO.isRegister()) + if (MO.isReg()) MIB.addReg(MO.getReg()); - else if (MO.isImmediate()) + else if (MO.isImm()) MIB.addImm(MO.getImm()); else MIB.addFrameIndex(MO.getIndex()); @@ -617,7 +617,7 @@ SmallVectorImpl &Addr, const TargetRegisterClass *RC, SmallVectorImpl &NewMIs)const{ - if (Addr[0].isFrameIndex()) { + if (Addr[0].isFI()) { LoadRegFromStackSlot(MF, DestReg, Addr[0].getIndex(), RC, NewMIs); return; } @@ -642,9 +642,9 @@ MachineInstrBuilder MIB = BuildMI(MF, get(Opc), DestReg); for (unsigned i = 0, e = Addr.size(); i != e; ++i) { MachineOperand &MO = Addr[i]; - if (MO.isRegister()) + if (MO.isReg()) MIB.addReg(MO.getReg()); - else if (MO.isImmediate()) + else if (MO.isImm()) MIB.addImm(MO.getImm()); else MIB.addFrameIndex(MO.getIndex()); Modified: llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp Fri Oct 3 10:45:36 2008 @@ -629,7 +629,7 @@ // Find out which operand is the frame index. unsigned FIOperandNo = 0; - while (!MI.getOperand(FIOperandNo).isFrameIndex()) { + while (!MI.getOperand(FIOperandNo).isFI()) { ++FIOperandNo; assert(FIOperandNo != MI.getNumOperands() && "Instr doesn't have FrameIndex operand!"); @@ -1242,7 +1242,7 @@ if (UsesTCRet) { int MaxTCRetDelta = FI->getTailCallSPDelta(); MachineOperand &StackAdjust = MBBI->getOperand(1); - assert( StackAdjust.isImmediate() && "Expecting immediate value."); + assert(StackAdjust.isImm() && "Expecting immediate value."); // Adjust stack pointer. int StackAdj = StackAdjust.getImm(); int Delta = StackAdj - MaxTCRetDelta; @@ -1368,7 +1368,7 @@ } else if (RetOpcode == PPC::TCRETURNri) { MBBI = prior(MBB.end()); MachineOperand &JumpTarget = MBBI->getOperand(0); - assert(JumpTarget.isRegister() && "Expecting register operand."); + assert(JumpTarget.isReg() && "Expecting register operand."); BuildMI(MBB, MBBI, TII.get(PPC::TAILBCTR)); } else if (RetOpcode == PPC::TCRETURNai) { MBBI = prior(MBB.end()); @@ -1382,7 +1382,7 @@ } else if (RetOpcode == PPC::TCRETURNri8) { MBBI = prior(MBB.end()); MachineOperand &JumpTarget = MBBI->getOperand(0); - assert(JumpTarget.isRegister() && "Expecting register operand."); + assert(JumpTarget.isReg() && "Expecting register operand."); BuildMI(MBB, MBBI, TII.get(PPC::TAILBCTR8)); } else if (RetOpcode == PPC::TCRETURNai8) { MBBI = prior(MBB.end()); Modified: llvm/trunk/lib/Target/Sparc/SparcAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcAsmPrinter.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/Sparc/SparcAsmPrinter.cpp Fri Oct 3 10:45:36 2008 @@ -141,11 +141,11 @@ const MachineOperand &MO = MI->getOperand (opNum); const TargetRegisterInfo &RI = *TM.getRegisterInfo(); bool CloseParen = false; - if (MI->getOpcode() == SP::SETHIi && !MO.isRegister() && !MO.isImmediate()) { + if (MI->getOpcode() == SP::SETHIi && !MO.isReg() && !MO.isImm()) { O << "%hi("; CloseParen = true; - } else if ((MI->getOpcode() == SP::ORri || MI->getOpcode() == SP::ADDri) - && !MO.isRegister() && !MO.isImmediate()) { + } else if ((MI->getOpcode() == SP::ORri || MI->getOpcode() == SP::ADDri) && + !MO.isReg() && !MO.isImm()) { O << "%lo("; CloseParen = true; } @@ -190,16 +190,16 @@ return; } - if (MI->getOperand(opNum+1).isRegister() && + if (MI->getOperand(opNum+1).isReg() && MI->getOperand(opNum+1).getReg() == SP::G0) return; // don't print "+%g0" - if (MI->getOperand(opNum+1).isImmediate() && + if (MI->getOperand(opNum+1).isImm() && MI->getOperand(opNum+1).getImm() == 0) return; // don't print "+0" O << "+"; - if (MI->getOperand(opNum+1).isGlobalAddress() || - MI->getOperand(opNum+1).isConstantPoolIndex()) { + if (MI->getOperand(opNum+1).isGlobal() || + MI->getOperand(opNum+1).isCPI()) { O << "%lo("; printOperand(MI, opNum+1); O << ")"; Modified: llvm/trunk/lib/Target/Sparc/SparcInstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcInstrInfo.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcInstrInfo.cpp (original) +++ llvm/trunk/lib/Target/Sparc/SparcInstrInfo.cpp Fri Oct 3 10:45:36 2008 @@ -25,7 +25,7 @@ } static bool isZeroImm(const MachineOperand &op) { - return op.isImmediate() && op.getImm() == 0; + return op.isImm() && op.getImm() == 0; } /// Return true if the instruction is a register to register move and @@ -48,7 +48,7 @@ return true; } } else if ((MI.getOpcode() == SP::ORri || MI.getOpcode() == SP::ADDri) && - isZeroImm(MI.getOperand(2)) && MI.getOperand(1).isRegister()) { + isZeroImm(MI.getOperand(2)) && MI.getOperand(1).isReg()) { DstReg = MI.getOperand(0).getReg(); SrcReg = MI.getOperand(1).getReg(); return true; @@ -71,7 +71,7 @@ if (MI->getOpcode() == SP::LDri || MI->getOpcode() == SP::LDFri || MI->getOpcode() == SP::LDDFri) { - if (MI->getOperand(1).isFrameIndex() && MI->getOperand(2).isImmediate() && + if (MI->getOperand(1).isFI() && MI->getOperand(2).isImm() && MI->getOperand(2).getImm() == 0) { FrameIndex = MI->getOperand(1).getIndex(); return MI->getOperand(0).getReg(); @@ -90,7 +90,7 @@ if (MI->getOpcode() == SP::STri || MI->getOpcode() == SP::STFri || MI->getOpcode() == SP::STDFri) { - if (MI->getOperand(0).isFrameIndex() && MI->getOperand(1).isImmediate() && + if (MI->getOperand(0).isFI() && MI->getOperand(1).isImm() && MI->getOperand(1).getImm() == 0) { FrameIndex = MI->getOperand(0).getIndex(); return MI->getOperand(2).getReg(); @@ -168,12 +168,12 @@ MachineInstrBuilder MIB = BuildMI(MF, get(Opc)); for (unsigned i = 0, e = Addr.size(); i != e; ++i) { MachineOperand &MO = Addr[i]; - if (MO.isRegister()) + if (MO.isReg()) MIB.addReg(MO.getReg()); - else if (MO.isImmediate()) + else if (MO.isImm()) MIB.addImm(MO.getImm()); else { - assert(MO.isFrameIndex()); + assert(MO.isFI()); MIB.addFrameIndex(MO.getIndex()); } } @@ -212,12 +212,12 @@ MachineInstrBuilder MIB = BuildMI(MF, get(Opc), DestReg); for (unsigned i = 0, e = Addr.size(); i != e; ++i) { MachineOperand &MO = Addr[i]; - if (MO.isRegister()) + if (MO.isReg()) MIB.addReg(MO.getReg()); - else if (MO.isImmediate()) + else if (MO.isImm()) MIB.addImm(MO.getImm()); else { - assert(MO.isFrameIndex()); + assert(MO.isFI()); MIB.addFrameIndex(MO.getIndex()); } } @@ -236,8 +236,8 @@ MachineInstr *NewMI = NULL; switch (MI->getOpcode()) { case SP::ORrr: - if (MI->getOperand(1).isRegister() && MI->getOperand(1).getReg() == SP::G0&& - MI->getOperand(0).isRegister() && MI->getOperand(2).isRegister()) { + if (MI->getOperand(1).isReg() && MI->getOperand(1).getReg() == SP::G0&& + MI->getOperand(0).isReg() && MI->getOperand(2).isReg()) { if (OpNum == 0) // COPY -> STORE NewMI = BuildMI(MF, get(SP::STri)).addFrameIndex(FI).addImm(0) .addReg(MI->getOperand(2).getReg()); Modified: llvm/trunk/lib/Target/Sparc/SparcRegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcRegisterInfo.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcRegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/Sparc/SparcRegisterInfo.cpp Fri Oct 3 10:45:36 2008 @@ -80,7 +80,7 @@ unsigned i = 0; MachineInstr &MI = *II; - while (!MI.getOperand(i).isFrameIndex()) { + while (!MI.getOperand(i).isFI()) { ++i; assert(i < MI.getNumOperands() && "Instr doesn't have FrameIndex operand!"); } 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=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Fri Oct 3 10:45:36 2008 @@ -546,9 +546,9 @@ const MachineOperand &DispSpec = MI->getOperand(Op+3); bool NotRIPRel = IndexReg.getReg() || BaseReg.getReg(); - if (DispSpec.isGlobalAddress() || - DispSpec.isConstantPoolIndex() || - DispSpec.isJumpTableIndex()) { + if (DispSpec.isGlobal() || + DispSpec.isCPI() || + DispSpec.isJTI()) { printOperand(MI, Op+3, "mem", NotRIPRel); } else { int DispVal = DispSpec.getImm(); @@ -675,7 +675,7 @@ case 'w': // Print HImode register case 'k': // Print SImode register case 'q': // Print DImode register - if (MI->getOperand(OpNo).isRegister()) + if (MI->getOperand(OpNo).isReg()) return printAsmMRegister(MI->getOperand(OpNo), ExtraCode[0]); printOperand(MI, OpNo); return false; 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=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp Fri Oct 3 10:45:36 2008 @@ -298,8 +298,8 @@ NeedPlus = true; } - if (DispSpec.isGlobalAddress() || DispSpec.isConstantPoolIndex() || - DispSpec.isJumpTableIndex()) { + if (DispSpec.isGlobal() || DispSpec.isCPI() || + DispSpec.isJTI()) { if (NeedPlus) O << " + "; printOp(DispSpec, "mem"); Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.h?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.h (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.h Fri Oct 3 10:45:36 2008 @@ -44,7 +44,7 @@ void printOperand(const MachineInstr *MI, unsigned OpNo, const char *Modifier = 0) { const MachineOperand &MO = MI->getOperand(OpNo); - if (MO.isRegister()) { + if (MO.isReg()) { assert(TargetRegisterInfo::isPhysicalRegister(MO.getReg()) && "Not physreg??"); O << TM.getRegisterInfo()->get(MO.getReg()).Name; // Capitalized names Modified: llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp Fri Oct 3 10:45:36 2008 @@ -268,7 +268,7 @@ // Otherwise, this is something that requires a relocation. Emit it as such // now. - if (RelocOp->isGlobalAddress()) { + if (RelocOp->isGlobal()) { // In 64-bit static small code model, we could potentially emit absolute. // But it's probably not beneficial. // 89 05 00 00 00 00 mov %eax,0(%rip) # PC-relative @@ -279,11 +279,11 @@ bool isLazy = gvNeedsLazyPtr(RelocOp->getGlobal()); emitGlobalAddress(RelocOp->getGlobal(), rt, RelocOp->getOffset(), PCAdj, NeedStub, isLazy); - } else if (RelocOp->isConstantPoolIndex()) { + } else if (RelocOp->isCPI()) { unsigned rt = Is64BitMode ? X86::reloc_pcrel_word : X86::reloc_picrel_word; emitConstPoolAddress(RelocOp->getIndex(), rt, RelocOp->getOffset(), PCAdj); - } else if (RelocOp->isJumpTableIndex()) { + } else if (RelocOp->isJTI()) { unsigned rt = Is64BitMode ? X86::reloc_pcrel_word : X86::reloc_picrel_word; emitJumpTableAddress(RelocOp->getIndex(), rt, PCAdj); } else { @@ -299,16 +299,16 @@ const MachineOperand *DispForReloc = 0; // Figure out what sort of displacement we have to handle here. - if (Op3.isGlobalAddress()) { + if (Op3.isGlobal()) { DispForReloc = &Op3; - } else if (Op3.isConstantPoolIndex()) { + } else if (Op3.isCPI()) { if (Is64BitMode || IsPIC) { DispForReloc = &Op3; } else { DispVal += MCE.getConstantPoolEntryAddress(Op3.getIndex()); DispVal += Op3.getOffset(); } - } else if (Op3.isJumpTableIndex()) { + } else if (Op3.isJTI()) { if (Is64BitMode || IsPIC) { DispForReloc = &Op3; } else { @@ -522,14 +522,14 @@ const MachineOperand &MO = MI.getOperand(CurOp++); DOUT << "RawFrm CurOp " << CurOp << "\n"; - DOUT << "isMachineBasicBlock " << MO.isMachineBasicBlock() << "\n"; - DOUT << "isGlobalAddress " << MO.isGlobalAddress() << "\n"; - DOUT << "isExternalSymbol " << MO.isExternalSymbol() << "\n"; - DOUT << "isImmediate " << MO.isImmediate() << "\n"; + DOUT << "isMBB " << MO.isMBB() << "\n"; + DOUT << "isGlobal " << MO.isGlobal() << "\n"; + DOUT << "isSymbol " << MO.isSymbol() << "\n"; + DOUT << "isImm " << MO.isImm() << "\n"; - if (MO.isMachineBasicBlock()) { + if (MO.isMBB()) { emitPCRelativeBlockAddress(MO.getMBB()); - } else if (MO.isGlobalAddress()) { + } else if (MO.isGlobal()) { // Assume undefined functions may be outside the Small codespace. bool NeedStub = (Is64BitMode && @@ -538,9 +538,9 @@ Opcode == X86::TAILJMPd; emitGlobalAddress(MO.getGlobal(), X86::reloc_pcrel_word, 0, 0, NeedStub); - } else if (MO.isExternalSymbol()) { + } else if (MO.isSymbol()) { emitExternalSymbolAddress(MO.getSymbolName(), X86::reloc_pcrel_word); - } else if (MO.isImmediate()) { + } else if (MO.isImm()) { emitConstant(MO.getImm(), X86InstrInfo::sizeOfImm(Desc)); } else { assert(0 && "Unknown RawFrm operand!"); @@ -554,7 +554,7 @@ if (CurOp != NumOps) { const MachineOperand &MO1 = MI.getOperand(CurOp++); unsigned Size = X86InstrInfo::sizeOfImm(Desc); - if (MO1.isImmediate()) + if (MO1.isImm()) emitConstant(MO1.getImm(), Size); else { unsigned rt = Is64BitMode ? X86::reloc_pcrel_word @@ -562,16 +562,16 @@ // This should not occur on Darwin for relocatable objects. if (Opcode == X86::MOV64ri) rt = X86::reloc_absolute_dword; // FIXME: add X86II flag? - if (MO1.isGlobalAddress()) { + if (MO1.isGlobal()) { bool NeedStub = isa(MO1.getGlobal()); bool isLazy = gvNeedsLazyPtr(MO1.getGlobal()); emitGlobalAddress(MO1.getGlobal(), rt, MO1.getOffset(), 0, NeedStub, isLazy); - } else if (MO1.isExternalSymbol()) + } else if (MO1.isSymbol()) emitExternalSymbolAddress(MO1.getSymbolName(), rt); - else if (MO1.isConstantPoolIndex()) + else if (MO1.isCPI()) emitConstPoolAddress(MO1.getIndex(), rt); - else if (MO1.isJumpTableIndex()) + else if (MO1.isJTI()) emitJumpTableAddress(MO1.getIndex(), rt); } } @@ -627,23 +627,23 @@ if (CurOp != NumOps) { const MachineOperand &MO1 = MI.getOperand(CurOp++); unsigned Size = X86InstrInfo::sizeOfImm(Desc); - if (MO1.isImmediate()) + if (MO1.isImm()) emitConstant(MO1.getImm(), Size); else { unsigned rt = Is64BitMode ? X86::reloc_pcrel_word : (IsPIC ? X86::reloc_picrel_word : X86::reloc_absolute_word); if (Opcode == X86::MOV64ri32) rt = X86::reloc_absolute_word; // FIXME: add X86II flag? - if (MO1.isGlobalAddress()) { + if (MO1.isGlobal()) { bool NeedStub = isa(MO1.getGlobal()); bool isLazy = gvNeedsLazyPtr(MO1.getGlobal()); emitGlobalAddress(MO1.getGlobal(), rt, MO1.getOffset(), 0, NeedStub, isLazy); - } else if (MO1.isExternalSymbol()) + } else if (MO1.isSymbol()) emitExternalSymbolAddress(MO1.getSymbolName(), rt); - else if (MO1.isConstantPoolIndex()) + else if (MO1.isCPI()) emitConstPoolAddress(MO1.getIndex(), rt); - else if (MO1.isJumpTableIndex()) + else if (MO1.isJTI()) emitJumpTableAddress(MO1.getIndex(), rt); } } @@ -654,7 +654,7 @@ case X86II::MRM4m: case X86II::MRM5m: case X86II::MRM6m: case X86II::MRM7m: { intptr_t PCAdj = (CurOp+4 != NumOps) ? - (MI.getOperand(CurOp+4).isImmediate() ? X86InstrInfo::sizeOfImm(Desc) : 4) : 0; + (MI.getOperand(CurOp+4).isImm() ? X86InstrInfo::sizeOfImm(Desc) : 4) : 0; MCE.emitByte(BaseOpcode); emitMemModRMByte(MI, CurOp, (Desc->TSFlags & X86II::FormMask)-X86II::MRM0m, @@ -664,23 +664,23 @@ if (CurOp != NumOps) { const MachineOperand &MO = MI.getOperand(CurOp++); unsigned Size = X86InstrInfo::sizeOfImm(Desc); - if (MO.isImmediate()) + if (MO.isImm()) emitConstant(MO.getImm(), Size); else { unsigned rt = Is64BitMode ? X86::reloc_pcrel_word : (IsPIC ? X86::reloc_picrel_word : X86::reloc_absolute_word); if (Opcode == X86::MOV64mi32) rt = X86::reloc_absolute_word; // FIXME: add X86II flag? - if (MO.isGlobalAddress()) { + if (MO.isGlobal()) { bool NeedStub = isa(MO.getGlobal()); bool isLazy = gvNeedsLazyPtr(MO.getGlobal()); emitGlobalAddress(MO.getGlobal(), rt, MO.getOffset(), 0, NeedStub, isLazy); - } else if (MO.isExternalSymbol()) + } else if (MO.isSymbol()) emitExternalSymbolAddress(MO.getSymbolName(), rt); - else if (MO.isConstantPoolIndex()) + else if (MO.isCPI()) emitConstPoolAddress(MO.getIndex(), rt); - else if (MO.isJumpTableIndex()) + else if (MO.isJTI()) emitJumpTableAddress(MO.getIndex(), rt); } } Modified: llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp (original) +++ llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp Fri Oct 3 10:45:36 2008 @@ -168,7 +168,7 @@ /// getFPReg - Return the X86::FPx register number for the specified operand. /// For example, this returns 3 for X86::FP3. static unsigned getFPReg(const MachineOperand &MO) { - assert(MO.isRegister() && "Expected an FP register!"); + assert(MO.isReg() && "Expected an FP register!"); unsigned Reg = MO.getReg(); assert(Reg >= X86::FP0 && Reg <= X86::FP6 && "Expected FP register!"); return Reg - X86::FP0; @@ -240,7 +240,7 @@ SmallVector DeadRegs; for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { const MachineOperand &MO = MI->getOperand(i); - if (MO.isRegister() && MO.isDead()) + if (MO.isReg() && MO.isDead()) DeadRegs.push_back(MO.getReg()); } @@ -1021,7 +1021,7 @@ unsigned NumKills = 0; for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { MachineOperand &Op = MI->getOperand(i); - if (!Op.isRegister() || Op.getReg() < X86::FP0 || Op.getReg() > X86::FP6) + if (!Op.isReg() || Op.getReg() < X86::FP0 || Op.getReg() > X86::FP6) continue; assert(Op.isUse() && "Only handle inline asm uses right now"); @@ -1061,7 +1061,7 @@ for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { MachineOperand &Op = MI->getOperand(i); - if (!Op.isRegister() || Op.getReg() < X86::FP0 || Op.getReg() > X86::FP6) + if (!Op.isReg() || Op.getReg() < X86::FP0 || Op.getReg() > X86::FP6) continue; // FP Register uses must be kills unless there are two uses of the same // register, in which case only one will be a kill. Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Fri Oct 3 10:45:36 2008 @@ -703,10 +703,10 @@ bool ContainsFPCode = false; for (MachineBasicBlock::iterator I = MBB->begin(), E = MBB->end(); !ContainsFPCode && I != E; ++I) { - if (I->getNumOperands() != 0 && I->getOperand(0).isRegister()) { + if (I->getNumOperands() != 0 && I->getOperand(0).isReg()) { const TargetRegisterClass *clas; for (unsigned op = 0, e = I->getNumOperands(); op != e; ++op) { - if (I->getOperand(op).isRegister() && I->getOperand(op).isDef() && + if (I->getOperand(op).isReg() && I->getOperand(op).isDef() && TargetRegisterInfo::isVirtualRegister(I->getOperand(op).getReg()) && ((clas = RegInfo->getRegClass(I->getOperand(0).getReg())) == X86::RFP32RegisterClass || Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Fri Oct 3 10:45:36 2008 @@ -6385,10 +6385,10 @@ tt = t1; unsigned t2 = F->getRegInfo().createVirtualRegister(RC); - assert((argOpers[valArgIndx]->isRegister() || - argOpers[valArgIndx]->isImmediate()) && + assert((argOpers[valArgIndx]->isReg() || + argOpers[valArgIndx]->isImm()) && "invalid operand"); - if (argOpers[valArgIndx]->isRegister()) + if (argOpers[valArgIndx]->isReg()) MIB = BuildMI(newMBB, TII->get(regOpc), t2); else MIB = BuildMI(newMBB, TII->get(immOpc), t2); @@ -6507,19 +6507,19 @@ tt2 = t2; } - assert((argOpers[4]->isRegister() || argOpers[4]->isImmediate()) && + assert((argOpers[4]->isReg() || argOpers[4]->isImm()) && "invalid operand"); unsigned t5 = F->getRegInfo().createVirtualRegister(RC); unsigned t6 = F->getRegInfo().createVirtualRegister(RC); - if (argOpers[4]->isRegister()) + if (argOpers[4]->isReg()) MIB = BuildMI(newMBB, TII->get(regOpcL), t5); else MIB = BuildMI(newMBB, TII->get(immOpcL), t5); MIB.addReg(tt1); (*MIB).addOperand(*argOpers[4]); - assert(argOpers[5]->isRegister() == argOpers[4]->isRegister()); - assert(argOpers[5]->isImmediate() == argOpers[4]->isImmediate()); - if (argOpers[5]->isRegister()) + assert(argOpers[5]->isReg() == argOpers[4]->isReg()); + assert(argOpers[5]->isImm() == argOpers[4]->isImm()); + if (argOpers[5]->isReg()) MIB = BuildMI(newMBB, TII->get(regOpcH), t6); else MIB = BuildMI(newMBB, TII->get(immOpcH), t6); @@ -6613,12 +6613,12 @@ (*MIB).addOperand(*argOpers[i]); // We only support register and immediate values - assert((argOpers[valArgIndx]->isRegister() || - argOpers[valArgIndx]->isImmediate()) && + assert((argOpers[valArgIndx]->isReg() || + argOpers[valArgIndx]->isImm()) && "invalid operand"); unsigned t2 = F->getRegInfo().createVirtualRegister(X86::GR32RegisterClass); - if (argOpers[valArgIndx]->isRegister()) + if (argOpers[valArgIndx]->isReg()) MIB = BuildMI(newMBB, TII->get(X86::MOV32rr), t2); else MIB = BuildMI(newMBB, TII->get(X86::MOV32rr), t2); @@ -6766,7 +6766,7 @@ X86AddressMode AM; MachineOperand &Op = MI->getOperand(0); - if (Op.isRegister()) { + if (Op.isReg()) { AM.BaseType = X86AddressMode::RegBase; AM.Base.Reg = Op.getReg(); } else { @@ -6774,13 +6774,13 @@ AM.Base.FrameIndex = Op.getIndex(); } Op = MI->getOperand(1); - if (Op.isImmediate()) + if (Op.isImm()) AM.Scale = Op.getImm(); Op = MI->getOperand(2); - if (Op.isImmediate()) + if (Op.isImm()) AM.IndexReg = Op.getImm(); Op = MI->getOperand(3); - if (Op.isGlobalAddress()) { + if (Op.isGlobal()) { AM.GV = Op.getGlobal(); } else { AM.Disp = Op.getImm(); Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Fri Oct 3 10:45:36 2008 @@ -679,8 +679,8 @@ case X86::MMX_MOVD64rr: case X86::MMX_MOVQ64rr: assert(MI.getNumOperands() >= 2 && - MI.getOperand(0).isRegister() && - MI.getOperand(1).isRegister() && + MI.getOperand(0).isReg() && + MI.getOperand(1).isReg() && "invalid register-register move instruction"); sourceReg = MI.getOperand(1).getReg(); destReg = MI.getOperand(0).getReg(); @@ -705,8 +705,8 @@ case X86::MOVAPDrm: case X86::MMX_MOVD64rm: case X86::MMX_MOVQ64rm: - if (MI->getOperand(1).isFrameIndex() && MI->getOperand(2).isImmediate() && - MI->getOperand(3).isRegister() && MI->getOperand(4).isImmediate() && + if (MI->getOperand(1).isFI() && MI->getOperand(2).isImm() && + MI->getOperand(3).isReg() && MI->getOperand(4).isImm() && MI->getOperand(2).getImm() == 1 && MI->getOperand(3).getReg() == 0 && MI->getOperand(4).getImm() == 0) { @@ -736,8 +736,8 @@ case X86::MMX_MOVD64mr: case X86::MMX_MOVQ64mr: case X86::MMX_MOVNTQmr: - if (MI->getOperand(0).isFrameIndex() && MI->getOperand(1).isImmediate() && - MI->getOperand(2).isRegister() && MI->getOperand(3).isImmediate() && + if (MI->getOperand(0).isFI() && MI->getOperand(1).isImm() && + MI->getOperand(2).isReg() && MI->getOperand(3).isImm() && MI->getOperand(1).getImm() == 1 && MI->getOperand(2).getReg() == 0 && MI->getOperand(3).getImm() == 0) { @@ -789,17 +789,17 @@ case X86::MMX_MOVD64rm: case X86::MMX_MOVQ64rm: { // Loads from constant pools are trivially rematerializable. - if (MI->getOperand(1).isRegister() && - MI->getOperand(2).isImmediate() && - MI->getOperand(3).isRegister() && MI->getOperand(3).getReg() == 0 && - (MI->getOperand(4).isConstantPoolIndex() || - (MI->getOperand(4).isGlobalAddress() && + if (MI->getOperand(1).isReg() && + MI->getOperand(2).isImm() && + MI->getOperand(3).isReg() && MI->getOperand(3).getReg() == 0 && + (MI->getOperand(4).isCPI() || + (MI->getOperand(4).isGlobal() && isGVStub(MI->getOperand(4).getGlobal(), TM)))) { unsigned BaseReg = MI->getOperand(1).getReg(); if (BaseReg == 0) return true; // Allow re-materialization of PIC load. - if (!ReMatPICStubLoad && MI->getOperand(4).isGlobalAddress()) + if (!ReMatPICStubLoad && MI->getOperand(4).isGlobal()) return false; const MachineFunction &MF = *MI->getParent()->getParent(); const MachineRegisterInfo &MRI = MF.getRegInfo(); @@ -819,11 +819,11 @@ case X86::LEA32r: case X86::LEA64r: { - if (MI->getOperand(2).isImmediate() && - MI->getOperand(3).isRegister() && MI->getOperand(3).getReg() == 0 && - !MI->getOperand(4).isRegister()) { + if (MI->getOperand(2).isImm() && + MI->getOperand(3).isReg() && MI->getOperand(3).getReg() == 0 && + !MI->getOperand(4).isReg()) { // lea fi#, lea GV, etc. are all rematerializable. - if (!MI->getOperand(1).isRegister()) + if (!MI->getOperand(1).isReg()) return true; unsigned BaseReg = MI->getOperand(1).getReg(); if (BaseReg == 0) @@ -857,7 +857,7 @@ bool SeenDef = false; for (unsigned j = 0, e = I->getNumOperands(); j != e; ++j) { MachineOperand &MO = I->getOperand(j); - if (!MO.isRegister()) + if (!MO.isReg()) continue; if (MO.getReg() == X86::EFLAGS) { if (MO.isUse()) @@ -880,7 +880,7 @@ MachineBasicBlock::iterator I, unsigned DestReg, const MachineInstr *Orig) const { - unsigned SubIdx = Orig->getOperand(0).isRegister() + unsigned SubIdx = Orig->getOperand(0).isReg() ? Orig->getOperand(0).getSubReg() : 0; bool ChangeSubIdx = SubIdx != 0; if (SubIdx && TargetRegisterInfo::isPhysicalRegister(DestReg)) { @@ -942,14 +942,14 @@ for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { const MachineOperand &MO = MI->getOperand(i); // Loads from constant pools are trivially invariant. - if (MO.isConstantPoolIndex()) + if (MO.isCPI()) return true; - if (MO.isGlobalAddress()) + if (MO.isGlobal()) return isGVStub(MO.getGlobal(), TM); // If this is a load from an invariant stack slot, the load is a constant. - if (MO.isFrameIndex()) { + if (MO.isFI()) { const MachineFrameInfo &MFI = *MI->getParent()->getParent()->getFrameInfo(); int Idx = MO.getIndex(); @@ -967,7 +967,7 @@ static bool hasLiveCondCodeDef(MachineInstr *MI) { for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { MachineOperand &MO = MI->getOperand(i); - if (MO.isRegister() && MO.isDef() && + if (MO.isReg() && MO.isDef() && MO.getReg() == X86::EFLAGS && !MO.isDead()) { return true; } @@ -1162,7 +1162,7 @@ case X86::ADD64ri32: case X86::ADD64ri8: assert(MI->getNumOperands() >= 3 && "Unknown add instruction!"); - if (MI->getOperand(2).isImmediate()) + if (MI->getOperand(2).isImm()) NewMI = addRegOffset(BuildMI(MF, get(X86::LEA64r)) .addReg(Dest, true, false, false, isDead), Src, isKill, MI->getOperand(2).getImm()); @@ -1170,7 +1170,7 @@ case X86::ADD32ri: case X86::ADD32ri8: assert(MI->getNumOperands() >= 3 && "Unknown add instruction!"); - if (MI->getOperand(2).isImmediate()) { + if (MI->getOperand(2).isImm()) { unsigned Opc = is64Bit ? X86::LEA64_32r : X86::LEA32r; NewMI = addRegOffset(BuildMI(MF, get(Opc)) .addReg(Dest, true, false, false, isDead), @@ -1181,7 +1181,7 @@ case X86::ADD16ri8: if (DisableLEA16) return 0; assert(MI->getNumOperands() >= 3 && "Unknown add instruction!"); - if (MI->getOperand(2).isImmediate()) + if (MI->getOperand(2).isImm()) NewMI = addRegOffset(BuildMI(MF, get(X86::LEA16r)) .addReg(Dest, true, false, false, isDead), Src, isKill, MI->getOperand(2).getImm()); @@ -1190,7 +1190,7 @@ if (DisableLEA16) return 0; case X86::SHL32ri: case X86::SHL64ri: { - assert(MI->getNumOperands() >= 3 && MI->getOperand(2).isImmediate() && + assert(MI->getNumOperands() >= 3 && MI->getOperand(2).isImm() && "Unknown shl instruction!"); unsigned ShAmt = MI->getOperand(2).getImm(); if (ShAmt == 1 || ShAmt == 2 || ShAmt == 3) { @@ -1544,20 +1544,20 @@ static const MachineInstrBuilder &X86InstrAddOperand(MachineInstrBuilder &MIB, MachineOperand &MO) { - if (MO.isRegister()) + if (MO.isReg()) MIB = MIB.addReg(MO.getReg(), MO.isDef(), MO.isImplicit(), MO.isKill(), MO.isDead(), MO.getSubReg()); - else if (MO.isImmediate()) + else if (MO.isImm()) MIB = MIB.addImm(MO.getImm()); - else if (MO.isFrameIndex()) + else if (MO.isFI()) MIB = MIB.addFrameIndex(MO.getIndex()); - else if (MO.isGlobalAddress()) + else if (MO.isGlobal()) MIB = MIB.addGlobalAddress(MO.getGlobal(), MO.getOffset()); - else if (MO.isConstantPoolIndex()) + else if (MO.isCPI()) MIB = MIB.addConstantPoolIndex(MO.getIndex(), MO.getOffset()); - else if (MO.isJumpTableIndex()) + else if (MO.isJTI()) MIB = MIB.addJumpTableIndex(MO.getIndex()); - else if (MO.isExternalSymbol()) + else if (MO.isSymbol()) MIB = MIB.addExternalSymbol(MO.getSymbolName()); else assert(0 && "Unknown operand for X86InstrAddOperand!"); @@ -1916,7 +1916,7 @@ for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { MachineOperand &MO = MI->getOperand(i); if (i == OpNo) { - assert(MO.isRegister() && "Expected to fold into reg operand!"); + assert(MO.isReg() && "Expected to fold into reg operand!"); unsigned NumAddrOps = MOs.size(); for (unsigned i = 0; i != NumAddrOps; ++i) MIB = X86InstrAddOperand(MIB, MOs[i]); @@ -1958,8 +1958,8 @@ // instruction is different than folding it other places. It requires // replacing the *two* registers with the memory location. if (isTwoAddr && NumOps >= 2 && i < 2 && - MI->getOperand(0).isRegister() && - MI->getOperand(1).isRegister() && + MI->getOperand(0).isReg() && + MI->getOperand(1).isReg() && MI->getOperand(0).getReg() == MI->getOperand(1).getReg()) { OpcodeTablePtr = &RegOp2MemOpTable2Addr; isTwoAddrFold = true; @@ -2190,7 +2190,7 @@ MachineOperand &Op = MI->getOperand(i); if (i >= Index && i < Index+4) AddrOps.push_back(Op); - else if (Op.isRegister() && Op.isImplicit()) + else if (Op.isReg() && Op.isImplicit()) ImpOps.push_back(Op); else if (i < Index) BeforeOps.push_back(Op); @@ -2205,7 +2205,7 @@ // Address operands cannot be marked isKill. for (unsigned i = 1; i != 5; ++i) { MachineOperand &MO = NewMIs[0]->getOperand(i); - if (MO.isRegister()) + if (MO.isReg()) MO.setIsKill(false); } } @@ -2411,7 +2411,7 @@ /// isX86_64ExtendedReg - Is the MachineOperand a x86-64 extended register? /// e.g. r8, xmm8, etc. bool X86InstrInfo::isX86_64ExtendedReg(const MachineOperand &MO) { - if (!MO.isRegister()) return false; + if (!MO.isReg()) return false; switch (MO.getReg()) { default: break; case X86::R8: case X86::R9: case X86::R10: case X86::R11: @@ -2452,7 +2452,7 @@ unsigned i = isTwoAddr ? 1 : 0; for (unsigned e = NumOps; i != e; ++i) { const MachineOperand& MO = MI.getOperand(i); - if (MO.isRegister()) { + if (MO.isReg()) { unsigned Reg = MO.getReg(); if (isX86_64NonExtLowByteReg(Reg)) REX |= 0x40; @@ -2482,7 +2482,7 @@ i = isTwoAddr ? 2 : 1; for (; i != NumOps; ++i) { const MachineOperand& MO = MI.getOperand(i); - if (MO.isRegister()) { + if (MO.isReg()) { if (isX86_64ExtendedReg(MO)) REX |= 1 << Bit; Bit++; @@ -2502,7 +2502,7 @@ unsigned Bit = 0; for (; i != e; ++i) { const MachineOperand& MO = MI.getOperand(i); - if (MO.isRegister()) { + if (MO.isReg()) { if (isX86_64ExtendedReg(MO)) REX |= 1 << Bit; Bit++; @@ -2581,11 +2581,11 @@ } // Otherwise, this is something that requires a relocation. - if (RelocOp->isGlobalAddress()) { + if (RelocOp->isGlobal()) { FinalSize += sizeGlobalAddress(false); - } else if (RelocOp->isConstantPoolIndex()) { + } else if (RelocOp->isCPI()) { FinalSize += sizeConstPoolAddress(false); - } else if (RelocOp->isJumpTableIndex()) { + } else if (RelocOp->isJTI()) { FinalSize += sizeJumpTableAddress(false); } else { assert(0 && "Unknown value to relocate!"); @@ -2601,15 +2601,15 @@ unsigned FinalSize = 0; // Figure out what sort of displacement we have to handle here. - if (Op3.isGlobalAddress()) { + if (Op3.isGlobal()) { DispForReloc = &Op3; - } else if (Op3.isConstantPoolIndex()) { + } else if (Op3.isCPI()) { if (Is64BitMode || IsPIC) { DispForReloc = &Op3; } else { DispVal = 1; } - } else if (Op3.isJumpTableIndex()) { + } else if (Op3.isJTI()) { if (Is64BitMode || IsPIC) { DispForReloc = &Op3; } else { @@ -2774,13 +2774,13 @@ if (CurOp != NumOps) { const MachineOperand &MO = MI.getOperand(CurOp++); - if (MO.isMachineBasicBlock()) { + if (MO.isMBB()) { FinalSize += sizePCRelativeBlockAddress(); - } else if (MO.isGlobalAddress()) { + } else if (MO.isGlobal()) { FinalSize += sizeGlobalAddress(false); - } else if (MO.isExternalSymbol()) { + } else if (MO.isSymbol()) { FinalSize += sizeExternalSymbolAddress(false); - } else if (MO.isImmediate()) { + } else if (MO.isImm()) { FinalSize += sizeConstant(X86InstrInfo::sizeOfImm(Desc)); } else { assert(0 && "Unknown RawFrm operand!"); @@ -2795,19 +2795,19 @@ if (CurOp != NumOps) { const MachineOperand &MO1 = MI.getOperand(CurOp++); unsigned Size = X86InstrInfo::sizeOfImm(Desc); - if (MO1.isImmediate()) + if (MO1.isImm()) FinalSize += sizeConstant(Size); else { bool dword = false; if (Opcode == X86::MOV64ri) dword = true; - if (MO1.isGlobalAddress()) { + if (MO1.isGlobal()) { FinalSize += sizeGlobalAddress(dword); - } else if (MO1.isExternalSymbol()) + } else if (MO1.isSymbol()) FinalSize += sizeExternalSymbolAddress(dword); - else if (MO1.isConstantPoolIndex()) + else if (MO1.isCPI()) FinalSize += sizeConstPoolAddress(dword); - else if (MO1.isJumpTableIndex()) + else if (MO1.isJTI()) FinalSize += sizeJumpTableAddress(dword); } } @@ -2867,19 +2867,19 @@ if (CurOp != NumOps) { const MachineOperand &MO1 = MI.getOperand(CurOp++); unsigned Size = X86InstrInfo::sizeOfImm(Desc); - if (MO1.isImmediate()) + if (MO1.isImm()) FinalSize += sizeConstant(Size); else { bool dword = false; if (Opcode == X86::MOV64ri32) dword = true; - if (MO1.isGlobalAddress()) { + if (MO1.isGlobal()) { FinalSize += sizeGlobalAddress(dword); - } else if (MO1.isExternalSymbol()) + } else if (MO1.isSymbol()) FinalSize += sizeExternalSymbolAddress(dword); - else if (MO1.isConstantPoolIndex()) + else if (MO1.isCPI()) FinalSize += sizeConstPoolAddress(dword); - else if (MO1.isJumpTableIndex()) + else if (MO1.isJTI()) FinalSize += sizeJumpTableAddress(dword); } } @@ -2897,19 +2897,19 @@ if (CurOp != NumOps) { const MachineOperand &MO = MI.getOperand(CurOp++); unsigned Size = X86InstrInfo::sizeOfImm(Desc); - if (MO.isImmediate()) + if (MO.isImm()) FinalSize += sizeConstant(Size); else { bool dword = false; if (Opcode == X86::MOV64mi32) dword = true; - if (MO.isGlobalAddress()) { + if (MO.isGlobal()) { FinalSize += sizeGlobalAddress(dword); - } else if (MO.isExternalSymbol()) + } else if (MO.isSymbol()) FinalSize += sizeExternalSymbolAddress(dword); - else if (MO.isConstantPoolIndex()) + else if (MO.isCPI()) FinalSize += sizeConstPoolAddress(dword); - else if (MO.isJumpTableIndex()) + else if (MO.isJTI()) FinalSize += sizeJumpTableAddress(dword); } } Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.h?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.h (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.h Fri Oct 3 10:45:36 2008 @@ -228,20 +228,20 @@ } inline static bool isScale(const MachineOperand &MO) { - return MO.isImmediate() && + return MO.isImm() && (MO.getImm() == 1 || MO.getImm() == 2 || MO.getImm() == 4 || MO.getImm() == 8); } inline static bool isMem(const MachineInstr *MI, unsigned Op) { - if (MI->getOperand(Op).isFrameIndex()) return true; + if (MI->getOperand(Op).isFI()) return true; return Op+4 <= MI->getNumOperands() && - MI->getOperand(Op ).isRegister() && isScale(MI->getOperand(Op+1)) && - MI->getOperand(Op+2).isRegister() && - (MI->getOperand(Op+3).isImmediate() || - MI->getOperand(Op+3).isGlobalAddress() || - MI->getOperand(Op+3).isConstantPoolIndex() || - MI->getOperand(Op+3).isJumpTableIndex()); + MI->getOperand(Op ).isReg() && isScale(MI->getOperand(Op+1)) && + MI->getOperand(Op+2).isReg() && + (MI->getOperand(Op+3).isImm() || + MI->getOperand(Op+3).isGlobal() || + MI->getOperand(Op+3).isCPI() || + MI->getOperand(Op+3).isJTI()); } class X86InstrInfo : public TargetInstrInfoImpl { Modified: llvm/trunk/lib/Target/X86/X86MachineFunctionInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MachineFunctionInfo.h?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86MachineFunctionInfo.h (original) +++ llvm/trunk/lib/Target/X86/X86MachineFunctionInfo.h Fri Oct 3 10:45:36 2008 @@ -58,8 +58,9 @@ /// 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. + /// GlobalBaseReg - keeps track of the virtual register initialized for + /// use as the global base register. This is used for PIC in some PIC + /// relocation models. unsigned GlobalBaseReg; public: Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=57006&r1=57005&r2=57006&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Fri Oct 3 10:45:36 2008 @@ -416,7 +416,7 @@ unsigned i = 0; MachineInstr &MI = *II; MachineFunction &MF = *MI.getParent()->getParent(); - while (!MI.getOperand(i).isFrameIndex()) { + while (!MI.getOperand(i).isFI()) { ++i; assert(i < MI.getNumOperands() && "Instr doesn't have FrameIndex operand!"); } @@ -895,7 +895,7 @@ if (RetOpcode == X86::EH_RETURN || RetOpcode == X86::EH_RETURN64) { MBBI = prior(MBB.end()); MachineOperand &DestAddr = MBBI->getOperand(0); - assert(DestAddr.isRegister() && "Offset should be in register!"); + assert(DestAddr.isReg() && "Offset should be in register!"); BuildMI(MBB, MBBI, TII.get(Is64Bit ? X86::MOV64rr : X86::MOV32rr), StackPtr).addReg(DestAddr.getReg()); @@ -905,7 +905,7 @@ MBBI = prior(MBB.end()); MachineOperand &JumpTarget = MBBI->getOperand(0); MachineOperand &StackAdjust = MBBI->getOperand(1); - assert( StackAdjust.isImmediate() && "Expecting immediate value."); + assert(StackAdjust.isImm() && "Expecting immediate value."); // Adjust stack pointer. int StackAdj = StackAdjust.getImm(); From nunoplopes at sapo.pt Fri Oct 3 10:45:58 2008 From: nunoplopes at sapo.pt (Nuno Lopes) Date: Fri, 03 Oct 2008 15:45:58 -0000 Subject: [llvm-commits] [llvm] r57007 - in /llvm/trunk/lib/AsmParser: llvmAsmParser.cpp.cvs llvmAsmParser.h.cvs llvmAsmParser.y.cvs Message-ID: <200810031545.m93FjxSZ001632@zion.cs.uiuc.edu> Author: nlopes Date: Fri Oct 3 10:45:58 2008 New Revision: 57007 URL: http://llvm.org/viewvc/llvm-project?rev=57007&view=rev Log: regenerate with bison 2.3 Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs llvm/trunk/lib/AsmParser/llvmAsmParser.h.cvs llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs?rev=57007&r1=57006&r2=57007&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs (original) +++ llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs Fri Oct 3 10:45:58 2008 @@ -394,7 +394,7 @@ /* Copy the first part of user declarations. */ -#line 14 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 14 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" #include "ParserInternals.h" #include "llvm/CallingConv.h" @@ -1371,7 +1371,7 @@ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 970 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 970 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { llvm::Module *ModuleVal; llvm::Function *FunctionVal; @@ -1419,7 +1419,7 @@ llvm::ICmpInst::Predicate IPredicate; llvm::FCmpInst::Predicate FPredicate; } -/* Line 193 of yacc.c. */ +/* Line 187 of yacc.c. */ #line 1424 "llvmAsmParser.tab.c" YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ @@ -1483,7 +1483,7 @@ #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ -# if defined YYENABLE_NLS && YYENABLE_NLS +# if YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) @@ -1904,17 +1904,17 @@ 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 + 2283, 2294, 2298, 2307, 2316, 2321, 2470, 2470, 2472, 2481, + 2481, 2483, 2488, 2500, 2504, 2509, 2513, 2517, 2522, 2527, + 2531, 2535, 2539, 2543, 2547, 2551, 2573, 2595, 2601, 2614, + 2626, 2631, 2643, 2649, 2653, 2663, 2667, 2671, 2676, 2683, + 2683, 2689, 2698, 2703, 2708, 2712, 2721, 2730, 2743, 2752, + 2756, 2764, 2784, 2788, 2793, 2804, 2823, 2832, 2936, 2940, + 2947, 2958, 2971, 2980, 2993, 3004, 3014, 3025, 3033, 3043, + 3050, 3053, 3054, 3062, 3068, 3077, 3081, 3086, 3102, 3119, + 3131, 3143, 3157, 3171, 3183, 3204, 3211, 3217, 3223, 3229, + 3244, 3354, 3359, 3363, 3370, 3377, 3387, 3394, 3404, 3412, + 3426, 3443, 3457, 3472, 3487 }; #endif @@ -2916,7 +2916,7 @@ we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT -# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL +# if YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ @@ -3657,152 +3657,152 @@ switch (yyn) { case 29: -#line 1142 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1142 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;} break; case 30: -#line 1142 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1142 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;} break; case 31: -#line 1143 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1143 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;} break; case 32: -#line 1143 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1143 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;} break; case 33: -#line 1144 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1144 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;} break; case 34: -#line 1144 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1144 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;} break; case 35: -#line 1145 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1145 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;} break; case 36: -#line 1145 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1145 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;} break; case 37: -#line 1146 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1146 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;} break; case 38: -#line 1146 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1146 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;} break; case 39: -#line 1150 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1150 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;} break; case 40: -#line 1150 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1150 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;} break; case 41: -#line 1151 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1151 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;} break; case 42: -#line 1151 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1151 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;} break; case 43: -#line 1152 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1152 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;} break; case 44: -#line 1152 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1152 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;} break; case 45: -#line 1153 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1153 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;} break; case 46: -#line 1153 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1153 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;} break; case 47: -#line 1154 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1154 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;} break; case 48: -#line 1154 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1154 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;} break; case 49: -#line 1155 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1155 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;} break; case 50: -#line 1155 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1155 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;} break; case 51: -#line 1156 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1156 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;} break; case 52: -#line 1156 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1156 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;} break; case 53: -#line 1157 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1157 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;} break; case 54: -#line 1158 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1158 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;} break; case 65: -#line 1167 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1167 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; ;} break; case 66: -#line 1169 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1169 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal)=(yyvsp[(3) - (4)].UInt64Val); ;} break; case 67: -#line 1170 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1170 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal)=0; ;} break; case 68: -#line 1174 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1174 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal); CHECK_FOR_ERROR @@ -3810,7 +3810,7 @@ break; case 69: -#line 1178 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1178 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; CHECK_FOR_ERROR @@ -3818,7 +3818,7 @@ break; case 70: -#line 1183 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1183 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = (yyvsp[(1) - (2)].UIntVal); CHECK_FOR_ERROR @@ -3826,7 +3826,7 @@ break; case 74: -#line 1192 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1192 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; CHECK_FOR_ERROR @@ -3834,7 +3834,7 @@ break; case 75: -#line 1197 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1197 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal); CHECK_FOR_ERROR @@ -3842,157 +3842,157 @@ break; case 76: -#line 1203 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1203 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} break; case 77: -#line 1204 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1204 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} break; case 78: -#line 1205 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1205 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} break; case 79: -#line 1206 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1206 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;} break; case 80: -#line 1207 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1207 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} break; case 81: -#line 1208 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1208 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::CommonLinkage; ;} break; case 82: -#line 1212 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1212 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} break; case 83: -#line 1213 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1213 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} break; case 84: -#line 1214 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1214 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} break; case 85: -#line 1218 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1218 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;} break; case 86: -#line 1219 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1219 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;} break; case 87: -#line 1220 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1220 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;} break; case 88: -#line 1221 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1221 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;} break; case 89: -#line 1225 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1225 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} break; case 90: -#line 1226 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1226 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} break; case 91: -#line 1227 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1227 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} break; case 92: -#line 1231 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1231 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} break; case 93: -#line 1232 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1232 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} break; case 94: -#line 1233 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1233 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} break; case 95: -#line 1234 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1234 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} break; case 96: -#line 1235 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1235 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} break; case 97: -#line 1239 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1239 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} break; case 98: -#line 1240 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1240 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} break; case 99: -#line 1241 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1241 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} break; case 100: -#line 1244 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1244 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::C; ;} break; case 101: -#line 1245 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1245 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::C; ;} break; case 102: -#line 1246 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1246 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::Fast; ;} break; case 103: -#line 1247 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1247 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::Cold; ;} break; case 104: -#line 1248 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1248 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::X86_StdCall; ;} break; case 105: -#line 1249 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1249 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::X86_FastCall; ;} break; case 106: -#line 1250 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1250 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val)) GEN_ERROR("Calling conv too large"); @@ -4002,176 +4002,176 @@ break; case 107: -#line 1257 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1257 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::ZExt; ;} break; case 108: -#line 1258 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1258 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::ZExt; ;} break; case 109: -#line 1259 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1259 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::SExt; ;} break; case 110: -#line 1260 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1260 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::SExt; ;} break; case 111: -#line 1261 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1261 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::InReg; ;} break; case 112: -#line 1262 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1262 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::StructRet; ;} break; case 113: -#line 1263 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1263 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::NoAlias; ;} break; case 114: -#line 1264 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1264 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::ByVal; ;} break; case 115: -#line 1265 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1265 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::Nest; ;} break; case 116: -#line 1266 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1266 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::constructAlignmentFromInt((yyvsp[(2) - (2)].UInt64Val)); ;} break; case 117: -#line 1270 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1270 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::None; ;} break; case 118: -#line 1271 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1271 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = (yyvsp[(1) - (2)].Attributes) | (yyvsp[(2) - (2)].Attributes); ;} break; case 119: -#line 1276 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1276 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::InReg; ;} break; case 120: -#line 1277 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1277 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::ZExt; ;} break; case 121: -#line 1278 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1278 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::SExt; ;} break; case 122: -#line 1281 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1281 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::None; ;} break; case 123: -#line 1282 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1282 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = (yyvsp[(1) - (2)].Attributes) | (yyvsp[(2) - (2)].Attributes); ;} break; case 124: -#line 1288 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1288 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::NoReturn; ;} break; case 125: -#line 1289 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1289 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::NoUnwind; ;} break; case 126: -#line 1290 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1290 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::InReg; ;} break; case 127: -#line 1291 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1291 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::ZExt; ;} break; case 128: -#line 1292 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1292 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::SExt; ;} break; case 129: -#line 1293 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1293 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::ReadNone; ;} break; case 130: -#line 1294 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1294 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::ReadOnly; ;} break; case 131: -#line 1295 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1295 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::NoInline ;} break; case 132: -#line 1296 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1296 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::AlwaysInline ;} break; case 133: -#line 1297 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1297 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::OptimizeForSize ;} break; case 134: -#line 1300 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1300 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::None; ;} break; case 135: -#line 1301 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1301 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = (yyvsp[(1) - (2)].Attributes) | (yyvsp[(2) - (2)].Attributes); ;} break; case 136: -#line 1307 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1307 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; ;} break; case 137: -#line 1308 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1308 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal); ;} break; case 138: -#line 1315 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1315 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = 0; ;} break; case 139: -#line 1316 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1316 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val); if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) @@ -4181,12 +4181,12 @@ break; case 140: -#line 1322 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1322 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = 0; ;} break; case 141: -#line 1323 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1323 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val); if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) @@ -4196,7 +4196,7 @@ break; case 142: -#line 1332 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1332 "/cvs/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] == '\\') @@ -4207,27 +4207,27 @@ break; case 143: -#line 1340 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1340 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; ;} break; case 144: -#line 1341 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1341 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;} break; case 145: -#line 1346 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1346 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" {;} break; case 146: -#line 1347 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1347 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" {;} break; case 147: -#line 1348 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1348 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV->setSection(*(yyvsp[(1) - (1)].StrVal)); delete (yyvsp[(1) - (1)].StrVal); @@ -4236,7 +4236,7 @@ break; case 148: -#line 1353 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1353 "/cvs/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"); @@ -4246,7 +4246,7 @@ break; case 156: -#line 1369 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1369 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeVal) = new PATypeHolder(OpaqueType::get()); CHECK_FOR_ERROR @@ -4254,7 +4254,7 @@ break; case 157: -#line 1373 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1373 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType)); CHECK_FOR_ERROR @@ -4262,7 +4262,7 @@ break; case 158: -#line 1377 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1377 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Pointer type? if (*(yyvsp[(1) - (3)].TypeVal) == Type::LabelTy) GEN_ERROR("Cannot form a pointer to a basic block"); @@ -4273,7 +4273,7 @@ break; case 159: -#line 1384 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1384 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Named types are also simple types... const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal)); CHECK_FOR_ERROR @@ -4282,7 +4282,7 @@ break; case 160: -#line 1389 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1389 "/cvs/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 @@ -4294,7 +4294,7 @@ break; case 161: -#line 1397 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1397 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Allow but ignore attributes on function types; this permits auto-upgrade. // FIXME: remove in LLVM 3.0. @@ -4327,7 +4327,7 @@ break; case 162: -#line 1426 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1426 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Allow but ignore attributes on function types; this permits auto-upgrade. // FIXME: remove in LLVM 3.0. @@ -4355,7 +4355,7 @@ break; case 163: -#line 1451 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1451 "/cvs/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); @@ -4364,7 +4364,7 @@ break; case 164: -#line 1456 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1456 "/cvs/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)) @@ -4378,7 +4378,7 @@ break; case 165: -#line 1466 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1466 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Structure type? std::vector Elements; for (std::list::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(), @@ -4392,7 +4392,7 @@ break; case 166: -#line 1476 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1476 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Empty structure type? (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector())); CHECK_FOR_ERROR @@ -4400,7 +4400,7 @@ break; case 167: -#line 1480 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1480 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { std::vector Elements; for (std::list::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(), @@ -4414,7 +4414,7 @@ break; case 168: -#line 1490 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1490 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Empty structure type? (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector(), true)); CHECK_FOR_ERROR @@ -4422,7 +4422,7 @@ break; case 169: -#line 1497 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1497 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Allow but ignore attributes on function types; this permits auto-upgrade. // FIXME: remove in LLVM 3.0. @@ -4432,7 +4432,7 @@ break; case 170: -#line 1506 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1506 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription()); @@ -4443,14 +4443,14 @@ break; case 171: -#line 1513 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1513 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeVal) = new PATypeHolder(Type::VoidTy); ;} break; case 172: -#line 1518 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1518 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeWithAttrsList) = new TypeWithAttrsList(); (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs)); @@ -4459,7 +4459,7 @@ break; case 173: -#line 1523 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1523 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs)); CHECK_FOR_ERROR @@ -4467,7 +4467,7 @@ break; case 175: -#line 1531 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1531 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList); TypeWithAttrs TWA; TWA.Attrs = Attribute::None; @@ -4478,7 +4478,7 @@ break; case 176: -#line 1538 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1538 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeWithAttrsList) = new TypeWithAttrsList; TypeWithAttrs TWA; TWA.Attrs = Attribute::None; @@ -4489,7 +4489,7 @@ break; case 177: -#line 1545 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1545 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeWithAttrsList) = new TypeWithAttrsList(); CHECK_FOR_ERROR @@ -4497,7 +4497,7 @@ break; case 178: -#line 1553 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1553 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeList) = new std::list(); (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal)); @@ -4507,7 +4507,7 @@ break; case 179: -#line 1559 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1559 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal)); delete (yyvsp[(3) - (3)].TypeVal); @@ -4516,7 +4516,7 @@ break; case 180: -#line 1571 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1571 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized arr if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription()); @@ -4548,7 +4548,7 @@ break; case 181: -#line 1599 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1599 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); @@ -4568,7 +4568,7 @@ break; case 182: -#line 1615 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1615 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); @@ -4599,7 +4599,7 @@ break; case 183: -#line 1642 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1642 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized arr if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription()); @@ -4631,7 +4631,7 @@ break; case 184: -#line 1670 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1670 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { const StructType *STy = dyn_cast((yyvsp[(1) - (4)].TypeVal)->get()); if (STy == 0) @@ -4661,7 +4661,7 @@ break; case 185: -#line 1696 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1696 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); @@ -4685,7 +4685,7 @@ break; case 186: -#line 1716 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1716 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { const StructType *STy = dyn_cast((yyvsp[(1) - (6)].TypeVal)->get()); if (STy == 0) @@ -4715,7 +4715,7 @@ break; case 187: -#line 1742 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1742 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription()); @@ -4739,7 +4739,7 @@ break; case 188: -#line 1762 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1762 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); @@ -4755,7 +4755,7 @@ break; case 189: -#line 1774 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1774 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); @@ -4766,7 +4766,7 @@ break; case 190: -#line 1781 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1781 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); @@ -4836,7 +4836,7 @@ break; case 191: -#line 1847 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1847 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); @@ -4850,7 +4850,7 @@ break; case 192: -#line 1857 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1857 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); @@ -4864,7 +4864,7 @@ break; case 193: -#line 1867 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1867 "/cvs/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"); @@ -4874,7 +4874,7 @@ break; case 194: -#line 1873 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1873 "/cvs/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) { @@ -4888,7 +4888,7 @@ break; case 195: -#line 1883 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1883 "/cvs/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"); @@ -4898,7 +4898,7 @@ break; case 196: -#line 1889 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1889 "/cvs/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) { @@ -4912,7 +4912,7 @@ break; case 197: -#line 1899 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1899 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Boolean constants if (cast((yyvsp[(1) - (2)].PrimType))->getBitWidth() != 1) GEN_ERROR("Constant true must have type i1"); @@ -4922,7 +4922,7 @@ break; case 198: -#line 1905 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1905 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Boolean constants if (cast((yyvsp[(1) - (2)].PrimType))->getBitWidth() != 1) GEN_ERROR("Constant false must have type i1"); @@ -4932,7 +4932,7 @@ break; case 199: -#line 1911 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1911 "/cvs/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"); @@ -4947,7 +4947,7 @@ break; case 200: -#line 1924 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1924 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription()); @@ -4963,7 +4963,7 @@ break; case 201: -#line 1936 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1936 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!isa((yyvsp[(3) - (5)].ConstVal)->getType())) GEN_ERROR("GetElementPtr requires a pointer operand"); @@ -4988,7 +4988,7 @@ break; case 202: -#line 1957 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1957 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty) GEN_ERROR("Select condition must be of boolean type"); @@ -5000,7 +5000,7 @@ break; case 203: -#line 1965 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1965 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType()) GEN_ERROR("Binary operator types must match"); @@ -5010,7 +5010,7 @@ break; case 204: -#line 1971 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1971 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType()) GEN_ERROR("Logical operator types must match"); @@ -5025,7 +5025,7 @@ break; case 205: -#line 1982 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1982 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) GEN_ERROR("icmp operand types must match"); @@ -5034,7 +5034,7 @@ break; case 206: -#line 1987 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1987 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) GEN_ERROR("fcmp operand types must match"); @@ -5043,7 +5043,7 @@ break; case 207: -#line 1992 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1992 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) GEN_ERROR("vicmp operand types must match"); @@ -5052,7 +5052,7 @@ break; case 208: -#line 1997 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1997 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) GEN_ERROR("vfcmp operand types must match"); @@ -5061,7 +5061,7 @@ break; case 209: -#line 2002 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2002 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal))) GEN_ERROR("Invalid extractelement operands"); @@ -5071,7 +5071,7 @@ break; case 210: -#line 2008 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2008 "/cvs/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"); @@ -5081,7 +5081,7 @@ break; case 211: -#line 2014 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2014 "/cvs/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"); @@ -5091,7 +5091,7 @@ break; case 212: -#line 2020 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2020 "/cvs/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"); @@ -5103,7 +5103,7 @@ break; case 213: -#line 2028 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2028 "/cvs/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"); @@ -5115,7 +5115,7 @@ break; case 214: -#line 2039 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2039 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal)); CHECK_FOR_ERROR @@ -5123,7 +5123,7 @@ break; case 215: -#line 2043 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2043 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ConstVector) = new std::vector(); (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal)); @@ -5132,27 +5132,27 @@ break; case 216: -#line 2051 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2051 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; ;} break; case 217: -#line 2051 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2051 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; ;} break; case 218: -#line 2054 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2054 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; ;} break; case 219: -#line 2054 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2054 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; ;} break; case 220: -#line 2057 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2057 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get(); Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal)); @@ -5168,7 +5168,7 @@ break; case 221: -#line 2069 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2069 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { Constant *Val = (yyvsp[(3) - (6)].ConstVal); const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get(); @@ -5184,7 +5184,7 @@ break; case 222: -#line 2090 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2090 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule; CurModule.ModuleDone(); @@ -5193,7 +5193,7 @@ break; case 223: -#line 2095 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2095 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule; CurModule.ModuleDone(); @@ -5202,12 +5202,12 @@ break; case 226: -#line 2108 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2108 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.isDeclare = false; ;} break; case 227: -#line 2108 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2108 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.FunctionDone(); CHECK_FOR_ERROR @@ -5215,26 +5215,26 @@ break; case 228: -#line 2112 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2112 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.isDeclare = true; ;} break; case 229: -#line 2112 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2112 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; case 230: -#line 2115 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2115 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; case 231: -#line 2118 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2118 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription()); @@ -5262,7 +5262,7 @@ break; case 232: -#line 2142 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2142 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType)); @@ -5277,7 +5277,7 @@ break; case 233: -#line 2154 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2154 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { /* "Externally Visible" Linkage */ if ((yyvsp[(5) - (6)].ConstVal) == 0) @@ -5289,14 +5289,14 @@ break; case 234: -#line 2161 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2161 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; ;} break; case 235: -#line 2165 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2165 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(6) - (7)].ConstVal) == 0) GEN_ERROR("Global value initializer is not a constant"); @@ -5306,14 +5306,14 @@ break; case 236: -#line 2170 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2170 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; ;} break; case 237: -#line 2174 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2174 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (7)].TypeVal))->getDescription()); @@ -5324,7 +5324,7 @@ break; case 238: -#line 2180 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2180 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; CHECK_FOR_ERROR @@ -5332,7 +5332,7 @@ break; case 239: -#line 2184 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2184 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { std::string Name; if ((yyvsp[(1) - (5)].StrVal)) { @@ -5376,21 +5376,21 @@ break; case 240: -#line 2224 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2224 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; case 241: -#line 2227 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2227 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; case 242: -#line 2233 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2233 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm(); if (AsmSoFar.empty()) @@ -5403,7 +5403,7 @@ break; case 243: -#line 2243 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2243 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal)); delete (yyvsp[(3) - (3)].StrVal); @@ -5411,7 +5411,7 @@ break; case 244: -#line 2247 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2247 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal)); delete (yyvsp[(3) - (3)].StrVal); @@ -5419,7 +5419,7 @@ break; case 246: -#line 2254 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2254 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal)); delete (yyvsp[(3) - (3)].StrVal); @@ -5428,7 +5428,7 @@ break; case 247: -#line 2259 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2259 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal)); delete (yyvsp[(1) - (1)].StrVal); @@ -5437,14 +5437,14 @@ break; case 248: -#line 2264 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2264 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; case 249: -#line 2273 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2273 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription()); @@ -5458,7 +5458,7 @@ break; case 250: -#line 2283 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2283 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); @@ -5472,7 +5472,7 @@ break; case 251: -#line 2294 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2294 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList); CHECK_FOR_ERROR @@ -5480,7 +5480,7 @@ break; case 252: -#line 2298 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2298 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList); struct ArgListEntry E; @@ -5493,7 +5493,7 @@ break; case 253: -#line 2307 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2307 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = new ArgListType; struct ArgListEntry E; @@ -5506,7 +5506,7 @@ break; case 254: -#line 2316 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2316 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = 0; CHECK_FOR_ERROR @@ -5514,7 +5514,7 @@ break; case 255: -#line 2322 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2322 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { std::string FunctionName(*(yyvsp[(4) - (11)].StrVal)); delete (yyvsp[(4) - (11)].StrVal); // Free strdup'd memory! @@ -5616,6 +5616,7 @@ InsertValue(Fn, CurModule.Values); } + ID.destroy(); CurFun.FunctionStart(Fn); if (CurFun.isDeclare) { @@ -5664,7 +5665,7 @@ break; case 258: -#line 2471 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2472 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FunctionVal) = CurFun.CurrentFunction; @@ -5676,7 +5677,7 @@ break; case 261: -#line 2482 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2483 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); CHECK_FOR_ERROR @@ -5684,7 +5685,7 @@ break; case 262: -#line 2487 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2488 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage)); CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility)); @@ -5695,7 +5696,7 @@ break; case 263: -#line 2499 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2500 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; CHECK_FOR_ERROR @@ -5703,7 +5704,7 @@ break; case 264: -#line 2503 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2504 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; CHECK_FOR_ERROR @@ -5711,7 +5712,7 @@ break; case 265: -#line 2508 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2509 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // A reference to a direct constant (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val)); CHECK_FOR_ERROR @@ -5719,7 +5720,7 @@ break; case 266: -#line 2512 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2513 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val)); CHECK_FOR_ERROR @@ -5727,7 +5728,7 @@ break; case 267: -#line 2516 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2517 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // arbitrary precision integer constants (yyval.ValIDVal) = ValID::create(*(yyvsp[(1) - (1)].APIntVal), true); delete (yyvsp[(1) - (1)].APIntVal); @@ -5736,7 +5737,7 @@ break; case 268: -#line 2521 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2522 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // arbitrary precision integer constants (yyval.ValIDVal) = ValID::create(*(yyvsp[(1) - (1)].APIntVal), false); delete (yyvsp[(1) - (1)].APIntVal); @@ -5745,7 +5746,7 @@ break; case 269: -#line 2526 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2527 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Perhaps it's an FP constant? (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal)); CHECK_FOR_ERROR @@ -5753,7 +5754,7 @@ break; case 270: -#line 2530 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2531 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue()); CHECK_FOR_ERROR @@ -5761,7 +5762,7 @@ break; case 271: -#line 2534 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2535 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse()); CHECK_FOR_ERROR @@ -5769,7 +5770,7 @@ break; case 272: -#line 2538 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2539 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::createNull(); CHECK_FOR_ERROR @@ -5777,7 +5778,7 @@ break; case 273: -#line 2542 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2543 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::createUndef(); CHECK_FOR_ERROR @@ -5785,7 +5786,7 @@ break; case 274: -#line 2546 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2547 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // A vector zero constant. (yyval.ValIDVal) = ValID::createZeroInit(); CHECK_FOR_ERROR @@ -5793,7 +5794,7 @@ break; case 275: -#line 2550 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2551 "/cvs/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(); @@ -5819,7 +5820,7 @@ break; case 276: -#line 2572 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2573 "/cvs/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(); @@ -5845,7 +5846,7 @@ break; case 277: -#line 2594 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2595 "/cvs/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. @@ -5855,7 +5856,7 @@ break; case 278: -#line 2600 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2601 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { uint64_t NumElements = (yyvsp[(2) - (2)].StrVal)->length(); const Type *ETy = Type::Int8Ty; @@ -5872,7 +5873,7 @@ break; case 279: -#line 2613 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2614 "/cvs/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) @@ -5888,7 +5889,7 @@ break; case 280: -#line 2625 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2626 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { const StructType *STy = StructType::get(std::vector()); (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, std::vector())); @@ -5897,7 +5898,7 @@ break; case 281: -#line 2630 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2631 "/cvs/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) @@ -5913,7 +5914,7 @@ break; case 282: -#line 2642 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2643 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { const StructType *STy = StructType::get(std::vector(), /*isPacked=*/true); @@ -5923,7 +5924,7 @@ break; case 283: -#line 2648 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2649 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal)); CHECK_FOR_ERROR @@ -5931,7 +5932,7 @@ break; case 284: -#line 2652 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2653 "/cvs/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); @@ -5941,7 +5942,7 @@ break; case 285: -#line 2662 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2663 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Is it an integer reference...? (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal)); CHECK_FOR_ERROR @@ -5949,7 +5950,7 @@ break; case 286: -#line 2666 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2667 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal)); CHECK_FOR_ERROR @@ -5957,7 +5958,7 @@ break; case 287: -#line 2670 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2671 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Is it a named reference...? (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)); delete (yyvsp[(1) - (1)].StrVal); @@ -5966,7 +5967,7 @@ break; case 288: -#line 2675 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2676 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Is it a named reference...? (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal)); delete (yyvsp[(1) - (1)].StrVal); @@ -5975,7 +5976,7 @@ break; case 291: -#line 2688 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2689 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); @@ -5986,7 +5987,7 @@ break; case 292: -#line 2697 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2698 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueList) = new std::vector(); (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal)); @@ -5995,7 +5996,7 @@ break; case 293: -#line 2702 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2703 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { ((yyval.ValueList)=(yyvsp[(1) - (3)].ValueList))->push_back((yyvsp[(3) - (3)].ValueVal)); CHECK_FOR_ERROR @@ -6003,7 +6004,7 @@ break; case 294: -#line 2707 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2708 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); CHECK_FOR_ERROR @@ -6011,7 +6012,7 @@ break; case 295: -#line 2711 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2712 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Do not allow functions with 0 basic blocks (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); CHECK_FOR_ERROR @@ -6019,7 +6020,7 @@ break; case 296: -#line 2720 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2721 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal)); CHECK_FOR_ERROR @@ -6031,7 +6032,7 @@ break; case 297: -#line 2729 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2730 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR int ValNum = InsertValue((yyvsp[(3) - (3)].TermInstVal)); @@ -6046,7 +6047,7 @@ break; case 298: -#line 2742 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2743 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (CastInst *CI1 = dyn_cast((yyvsp[(2) - (2)].InstVal))) if (CastInst *CI2 = dyn_cast(CI1->getOperand(0))) @@ -6059,7 +6060,7 @@ break; case 299: -#line 2751 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2752 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Empty space between instruction lists (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum)); CHECK_FOR_ERROR @@ -6067,7 +6068,7 @@ break; case 300: -#line 2755 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2756 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Labelled (named) basic block (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal))); delete (yyvsp[(1) - (1)].StrVal); @@ -6077,7 +6078,7 @@ break; case 301: -#line 2763 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2764 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Return with a result... ValueList &VL = *(yyvsp[(2) - (2)].ValueList); assert(!VL.empty() && "Invalid ret operands!"); @@ -6101,7 +6102,7 @@ break; case 302: -#line 2783 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2784 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Return with no result... (yyval.TermInstVal) = ReturnInst::Create(); CHECK_FOR_ERROR @@ -6109,7 +6110,7 @@ break; case 303: -#line 2787 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2788 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Unconditional Branch... BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal)); CHECK_FOR_ERROR @@ -6118,7 +6119,7 @@ break; case 304: -#line 2792 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2793 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (cast((yyvsp[(2) - (9)].PrimType))->getBitWidth() != 1) GEN_ERROR("Branch condition must have type i1"); @@ -6133,7 +6134,7 @@ break; case 305: -#line 2803 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2804 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal)); CHECK_FOR_ERROR @@ -6156,7 +6157,7 @@ break; case 306: -#line 2822 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2823 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal)); CHECK_FOR_ERROR @@ -6169,7 +6170,7 @@ break; case 307: -#line 2832 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2833 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Handle the short syntax @@ -6276,7 +6277,7 @@ break; case 308: -#line 2935 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2936 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TermInstVal) = new UnwindInst(); CHECK_FOR_ERROR @@ -6284,7 +6285,7 @@ break; case 309: -#line 2939 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2940 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TermInstVal) = new UnreachableInst(); CHECK_FOR_ERROR @@ -6292,7 +6293,7 @@ break; case 310: -#line 2946 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2947 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable); Constant *V = cast(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal))); @@ -6307,7 +6308,7 @@ break; case 311: -#line 2957 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2958 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.JumpTable) = new std::vector >(); Constant *V = cast(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal))); @@ -6323,7 +6324,7 @@ break; case 312: -#line 2970 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2971 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Is this definition named?? if so, assign the name... setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal)); @@ -6335,7 +6336,7 @@ break; case 313: -#line 2979 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2980 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR int ValNum = InsertValue((yyvsp[(2) - (2)].InstVal)); @@ -6350,7 +6351,7 @@ break; case 314: -#line 2992 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2993 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Used for PHI nodes if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription()); @@ -6365,7 +6366,7 @@ break; case 315: -#line 3003 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3004 "/cvs/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)); @@ -6377,7 +6378,7 @@ break; case 316: -#line 3013 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3014 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // FIXME: Remove trailing OptAttributes in LLVM 3.0, it was a mistake in 2.0 if (!UpRefs.empty()) @@ -6392,7 +6393,7 @@ break; case 317: -#line 3024 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3025 "/cvs/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 @@ -6404,7 +6405,7 @@ break; case 318: -#line 3032 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3033 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // FIXME: Remove trailing OptAttributes in LLVM 3.0, it was a mistake in 2.0 if (!UpRefs.empty()) @@ -6418,7 +6419,7 @@ break; case 319: -#line 3042 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3043 "/cvs/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); @@ -6429,17 +6430,17 @@ break; case 320: -#line 3049 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3050 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamList) = new ParamList(); ;} break; case 321: -#line 3052 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3053 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueList) = new std::vector(); ;} break; case 322: -#line 3053 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3054 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList); (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal)); @@ -6448,7 +6449,7 @@ break; case 323: -#line 3061 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3062 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ConstantList) = new std::vector(); if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val)) @@ -6458,7 +6459,7 @@ break; case 324: -#line 3067 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3068 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ConstantList) = (yyvsp[(1) - (3)].ConstantList); if ((unsigned)(yyvsp[(3) - (3)].UInt64Val) != (yyvsp[(3) - (3)].UInt64Val)) @@ -6469,7 +6470,7 @@ break; case 325: -#line 3076 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3077 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; CHECK_FOR_ERROR @@ -6477,7 +6478,7 @@ break; case 326: -#line 3080 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3081 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; CHECK_FOR_ERROR @@ -6485,7 +6486,7 @@ break; case 327: -#line 3085 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3086 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription()); @@ -6505,7 +6506,7 @@ break; case 328: -#line 3101 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3102 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription()); @@ -6526,7 +6527,7 @@ break; case 329: -#line 3118 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3119 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); @@ -6542,7 +6543,7 @@ break; case 330: -#line 3130 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3131 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); @@ -6558,7 +6559,7 @@ break; case 331: -#line 3142 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3143 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); @@ -6576,7 +6577,7 @@ break; case 332: -#line 3156 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3157 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); @@ -6594,7 +6595,7 @@ break; case 333: -#line 3170 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3171 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription()); @@ -6610,7 +6611,7 @@ break; case 334: -#line 3182 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3183 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (isa((yyvsp[(2) - (6)].ValueVal)->getType())) { // vector select @@ -6635,7 +6636,7 @@ break; case 335: -#line 3203 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3204 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription()); @@ -6646,7 +6647,7 @@ break; case 336: -#line 3210 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3211 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal))) GEN_ERROR("Invalid extractelement operands"); @@ -6656,7 +6657,7 @@ break; case 337: -#line 3216 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3217 "/cvs/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"); @@ -6666,7 +6667,7 @@ break; case 338: -#line 3222 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3223 "/cvs/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"); @@ -6676,7 +6677,7 @@ break; case 339: -#line 3228 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3229 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType(); if (!Ty->isFirstClassType()) @@ -6695,7 +6696,7 @@ break; case 340: -#line 3244 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3245 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Handle the short syntax @@ -6808,7 +6809,7 @@ break; case 341: -#line 3353 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3354 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal); CHECK_FOR_ERROR @@ -6816,7 +6817,7 @@ break; case 342: -#line 3358 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3359 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; CHECK_FOR_ERROR @@ -6824,7 +6825,7 @@ break; case 343: -#line 3362 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3363 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; CHECK_FOR_ERROR @@ -6832,7 +6833,7 @@ break; case 344: -#line 3369 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3370 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription()); @@ -6843,7 +6844,7 @@ break; case 345: -#line 3376 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3377 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription()); @@ -6857,7 +6858,7 @@ break; case 346: -#line 3386 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3387 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription()); @@ -6868,7 +6869,7 @@ break; case 347: -#line 3393 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3394 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription()); @@ -6882,7 +6883,7 @@ break; case 348: -#line 3403 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3404 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!isa((yyvsp[(2) - (2)].ValueVal)->getType())) GEN_ERROR("Trying to free nonpointer type " + @@ -6893,7 +6894,7 @@ break; case 349: -#line 3411 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3412 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription()); @@ -6911,7 +6912,7 @@ break; case 350: -#line 3425 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3426 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription()); @@ -6932,7 +6933,7 @@ break; case 351: -#line 3442 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3443 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription()); @@ -6950,7 +6951,7 @@ break; case 352: -#line 3456 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3457 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription()); @@ -6969,7 +6970,7 @@ break; case 353: -#line 3471 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3472 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription()); @@ -6988,7 +6989,7 @@ break; case 354: -#line 3486 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3487 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (7)].TypeVal))->getDescription()); @@ -7010,7 +7011,7 @@ /* Line 1267 of yacc.c. */ -#line 7014 "llvmAsmParser.tab.c" +#line 7015 "llvmAsmParser.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -7224,7 +7225,7 @@ } -#line 3505 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3506 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" // common code from the two 'RunVMAsmParser' functions Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.h.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.h.cvs?rev=57007&r1=57006&r2=57007&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/llvmAsmParser.h.cvs (original) +++ llvm/trunk/lib/AsmParser/llvmAsmParser.h.cvs Fri Oct 3 10:45:58 2008 @@ -360,7 +360,7 @@ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 970 "/Volumes/Nanpura/mainline/llvm/lib/AsmParser/llvmAsmParser.y" +#line 970 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { llvm::Module *ModuleVal; llvm::Function *FunctionVal; @@ -408,7 +408,7 @@ llvm::ICmpInst::Predicate IPredicate; llvm::FCmpInst::Predicate FPredicate; } -/* Line 1529 of yacc.c. */ +/* Line 1489 of yacc.c. */ #line 413 "llvmAsmParser.tab.h" YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs?rev=57007&r1=57006&r2=57007&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs (original) +++ llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs Fri Oct 3 10:45:58 2008 @@ -2420,6 +2420,7 @@ InsertValue(Fn, CurModule.Values); } + ID.destroy(); CurFun.FunctionStart(Fn); if (CurFun.isDeclare) { From nunoplopes at sapo.pt Fri Oct 3 10:51:47 2008 From: nunoplopes at sapo.pt (Nuno Lopes) Date: Fri, 03 Oct 2008 15:51:47 -0000 Subject: [llvm-commits] [llvm] r57008 - /llvm/trunk/lib/AsmParser/llvmAsmParser.y Message-ID: <200810031551.m93Fpl3H001910@zion.cs.uiuc.edu> Author: nlopes Date: Fri Oct 3 10:51:46 2008 New Revision: 57008 URL: http://llvm.org/viewvc/llvm-project?rev=57008&view=rev Log: fix more memleaks in ResolveTypeTo() and ParseGlobalVariable() Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.y Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.y URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.y?rev=57008&r1=57007&r2=57008&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/llvmAsmParser.y (original) +++ llvm/trunk/lib/AsmParser/llvmAsmParser.y Fri Oct 3 10:51:46 2008 @@ -707,6 +707,7 @@ ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy); CurModule.LateResolveTypes.erase(I); } + D.destroy(); } // setValueName - Set the specified value to the name given. The name may be @@ -782,9 +783,12 @@ GV->setConstant(isConstantGlobal); GV->setThreadLocal(IsThreadLocal); InsertValue(GV, CurModule.Values); + ID.destroy(); return GV; } + ID.destroy(); + // If this global has a name if (!Name.empty()) { // if the global we're parsing has an initializer (is a definition) and From nunoplopes at sapo.pt Fri Oct 3 10:52:39 2008 From: nunoplopes at sapo.pt (Nuno Lopes) Date: Fri, 03 Oct 2008 15:52:39 -0000 Subject: [llvm-commits] [llvm] r57009 - in /llvm/trunk/lib/AsmParser: llvmAsmParser.cpp.cvs llvmAsmParser.h.cvs llvmAsmParser.y.cvs Message-ID: <200810031552.m93Fqe3c001950@zion.cs.uiuc.edu> Author: nlopes Date: Fri Oct 3 10:52:39 2008 New Revision: 57009 URL: http://llvm.org/viewvc/llvm-project?rev=57009&view=rev Log: regenerate Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs llvm/trunk/lib/AsmParser/llvmAsmParser.h.cvs llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs?rev=57009&r1=57008&r2=57009&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs (original) +++ llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs Fri Oct 3 10:52:39 2008 @@ -1091,6 +1091,7 @@ ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy); CurModule.LateResolveTypes.erase(I); } + D.destroy(); } // setValueName - Set the specified value to the name given. The name may be @@ -1166,9 +1167,12 @@ GV->setConstant(isConstantGlobal); GV->setThreadLocal(IsThreadLocal); InsertValue(GV, CurModule.Values); + ID.destroy(); return GV; } + ID.destroy(); + // If this global has a name if (!Name.empty()) { // if the global we're parsing has an initializer (is a definition) and @@ -1371,7 +1375,7 @@ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 970 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 974 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { llvm::Module *ModuleVal; llvm::Function *FunctionVal; @@ -1420,7 +1424,7 @@ llvm::FCmpInst::Predicate FPredicate; } /* Line 187 of yacc.c. */ -#line 1424 "llvmAsmParser.tab.c" +#line 1428 "llvmAsmParser.tab.c" YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 @@ -1433,7 +1437,7 @@ /* Line 216 of yacc.c. */ -#line 1437 "llvmAsmParser.tab.c" +#line 1441 "llvmAsmParser.tab.c" #ifdef short # undef short @@ -1879,42 +1883,42 @@ /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 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, 2470, 2470, 2472, 2481, - 2481, 2483, 2488, 2500, 2504, 2509, 2513, 2517, 2522, 2527, - 2531, 2535, 2539, 2543, 2547, 2551, 2573, 2595, 2601, 2614, - 2626, 2631, 2643, 2649, 2653, 2663, 2667, 2671, 2676, 2683, - 2683, 2689, 2698, 2703, 2708, 2712, 2721, 2730, 2743, 2752, - 2756, 2764, 2784, 2788, 2793, 2804, 2823, 2832, 2936, 2940, - 2947, 2958, 2971, 2980, 2993, 3004, 3014, 3025, 3033, 3043, - 3050, 3053, 3054, 3062, 3068, 3077, 3081, 3086, 3102, 3119, - 3131, 3143, 3157, 3171, 3183, 3204, 3211, 3217, 3223, 3229, - 3244, 3354, 3359, 3363, 3370, 3377, 3387, 3394, 3404, 3412, - 3426, 3443, 3457, 3472, 3487 + 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, 1285, 1286, 1292, 1293, 1294, 1295, 1296, 1297, + 1298, 1299, 1300, 1301, 1304, 1305, 1311, 1312, 1319, 1320, + 1326, 1327, 1336, 1344, 1345, 1350, 1351, 1352, 1357, 1370, + 1370, 1370, 1370, 1370, 1370, 1370, 1373, 1377, 1381, 1388, + 1393, 1401, 1430, 1455, 1460, 1470, 1480, 1484, 1494, 1501, + 1510, 1517, 1522, 1527, 1534, 1535, 1542, 1549, 1557, 1563, + 1575, 1603, 1619, 1646, 1674, 1700, 1720, 1746, 1766, 1778, + 1785, 1851, 1861, 1871, 1877, 1887, 1893, 1903, 1909, 1915, + 1928, 1940, 1961, 1969, 1975, 1986, 1991, 1996, 2001, 2006, + 2012, 2018, 2024, 2032, 2043, 2047, 2055, 2055, 2058, 2058, + 2061, 2073, 2094, 2099, 2107, 2108, 2112, 2112, 2116, 2116, + 2119, 2122, 2146, 2158, 2157, 2169, 2168, 2178, 2177, 2188, + 2228, 2231, 2237, 2247, 2251, 2256, 2258, 2263, 2268, 2277, + 2287, 2298, 2302, 2311, 2320, 2325, 2474, 2474, 2476, 2485, + 2485, 2487, 2492, 2504, 2508, 2513, 2517, 2521, 2526, 2531, + 2535, 2539, 2543, 2547, 2551, 2555, 2577, 2599, 2605, 2618, + 2630, 2635, 2647, 2653, 2657, 2667, 2671, 2675, 2680, 2687, + 2687, 2693, 2702, 2707, 2712, 2716, 2725, 2734, 2747, 2756, + 2760, 2768, 2788, 2792, 2797, 2808, 2827, 2836, 2940, 2944, + 2951, 2962, 2975, 2984, 2997, 3008, 3018, 3029, 3037, 3047, + 3054, 3057, 3058, 3066, 3072, 3081, 3085, 3090, 3106, 3123, + 3135, 3147, 3161, 3175, 3187, 3208, 3215, 3221, 3227, 3233, + 3248, 3358, 3363, 3367, 3374, 3381, 3391, 3398, 3408, 3416, + 3430, 3447, 3461, 3476, 3491 }; #endif @@ -3657,152 +3661,152 @@ switch (yyn) { case 29: -#line 1142 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1146 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;} break; case 30: -#line 1142 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1146 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;} break; case 31: -#line 1143 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1147 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;} break; case 32: -#line 1143 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1147 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;} break; case 33: -#line 1144 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1148 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;} break; case 34: -#line 1144 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1148 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;} break; case 35: -#line 1145 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1149 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;} break; case 36: -#line 1145 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1149 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;} break; case 37: -#line 1146 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1150 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;} break; case 38: -#line 1146 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1150 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;} break; case 39: -#line 1150 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1154 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;} break; case 40: -#line 1150 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1154 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;} break; case 41: -#line 1151 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1155 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;} break; case 42: -#line 1151 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1155 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;} break; case 43: -#line 1152 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1156 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;} break; case 44: -#line 1152 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1156 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;} break; case 45: -#line 1153 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1157 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;} break; case 46: -#line 1153 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1157 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;} break; case 47: -#line 1154 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1158 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;} break; case 48: -#line 1154 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1158 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;} break; case 49: -#line 1155 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1159 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;} break; case 50: -#line 1155 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1159 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;} break; case 51: -#line 1156 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1160 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;} break; case 52: -#line 1156 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1160 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;} break; case 53: -#line 1157 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1161 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;} break; case 54: -#line 1158 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1162 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;} break; case 65: -#line 1167 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1171 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; ;} break; case 66: -#line 1169 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1173 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal)=(yyvsp[(3) - (4)].UInt64Val); ;} break; case 67: -#line 1170 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1174 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal)=0; ;} break; case 68: -#line 1174 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1178 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal); CHECK_FOR_ERROR @@ -3810,7 +3814,7 @@ break; case 69: -#line 1178 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1182 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; CHECK_FOR_ERROR @@ -3818,7 +3822,7 @@ break; case 70: -#line 1183 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1187 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = (yyvsp[(1) - (2)].UIntVal); CHECK_FOR_ERROR @@ -3826,7 +3830,7 @@ break; case 74: -#line 1192 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1196 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; CHECK_FOR_ERROR @@ -3834,7 +3838,7 @@ break; case 75: -#line 1197 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1201 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal); CHECK_FOR_ERROR @@ -3842,157 +3846,157 @@ break; case 76: -#line 1203 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1207 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} break; case 77: -#line 1204 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1208 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} break; case 78: -#line 1205 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1209 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} break; case 79: -#line 1206 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1210 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;} break; case 80: -#line 1207 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1211 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} break; case 81: -#line 1208 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1212 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::CommonLinkage; ;} break; case 82: -#line 1212 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1216 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} break; case 83: -#line 1213 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1217 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} break; case 84: -#line 1214 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1218 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} break; case 85: -#line 1218 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1222 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;} break; case 86: -#line 1219 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1223 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;} break; case 87: -#line 1220 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1224 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;} break; case 88: -#line 1221 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1225 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;} break; case 89: -#line 1225 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1229 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} break; case 90: -#line 1226 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1230 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} break; case 91: -#line 1227 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1231 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} break; case 92: -#line 1231 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1235 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} break; case 93: -#line 1232 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1236 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} break; case 94: -#line 1233 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1237 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} break; case 95: -#line 1234 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1238 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} break; case 96: -#line 1235 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1239 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} break; case 97: -#line 1239 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1243 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} break; case 98: -#line 1240 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1244 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} break; case 99: -#line 1241 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1245 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} break; case 100: -#line 1244 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1248 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::C; ;} break; case 101: -#line 1245 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1249 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::C; ;} break; case 102: -#line 1246 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1250 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::Fast; ;} break; case 103: -#line 1247 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1251 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::Cold; ;} break; case 104: -#line 1248 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1252 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::X86_StdCall; ;} break; case 105: -#line 1249 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1253 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::X86_FastCall; ;} break; case 106: -#line 1250 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1254 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val)) GEN_ERROR("Calling conv too large"); @@ -4002,176 +4006,176 @@ break; case 107: -#line 1257 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1261 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::ZExt; ;} break; case 108: -#line 1258 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1262 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::ZExt; ;} break; case 109: -#line 1259 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1263 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::SExt; ;} break; case 110: -#line 1260 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1264 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::SExt; ;} break; case 111: -#line 1261 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1265 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::InReg; ;} break; case 112: -#line 1262 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1266 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::StructRet; ;} break; case 113: -#line 1263 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1267 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::NoAlias; ;} break; case 114: -#line 1264 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1268 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::ByVal; ;} break; case 115: -#line 1265 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1269 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::Nest; ;} break; case 116: -#line 1266 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1270 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::constructAlignmentFromInt((yyvsp[(2) - (2)].UInt64Val)); ;} break; case 117: -#line 1270 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1274 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::None; ;} break; case 118: -#line 1271 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1275 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = (yyvsp[(1) - (2)].Attributes) | (yyvsp[(2) - (2)].Attributes); ;} break; case 119: -#line 1276 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1280 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::InReg; ;} break; case 120: -#line 1277 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1281 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::ZExt; ;} break; case 121: -#line 1278 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1282 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::SExt; ;} break; case 122: -#line 1281 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1285 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::None; ;} break; case 123: -#line 1282 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1286 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = (yyvsp[(1) - (2)].Attributes) | (yyvsp[(2) - (2)].Attributes); ;} break; case 124: -#line 1288 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1292 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::NoReturn; ;} break; case 125: -#line 1289 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1293 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::NoUnwind; ;} break; case 126: -#line 1290 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1294 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::InReg; ;} break; case 127: -#line 1291 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1295 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::ZExt; ;} break; case 128: -#line 1292 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1296 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::SExt; ;} break; case 129: -#line 1293 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1297 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::ReadNone; ;} break; case 130: -#line 1294 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1298 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::ReadOnly; ;} break; case 131: -#line 1295 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1299 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::NoInline ;} break; case 132: -#line 1296 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1300 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::AlwaysInline ;} break; case 133: -#line 1297 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1301 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::OptimizeForSize ;} break; case 134: -#line 1300 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1304 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = Attribute::None; ;} break; case 135: -#line 1301 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1305 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Attributes) = (yyvsp[(1) - (2)].Attributes) | (yyvsp[(2) - (2)].Attributes); ;} break; case 136: -#line 1307 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1311 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; ;} break; case 137: -#line 1308 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1312 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal); ;} break; case 138: -#line 1315 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1319 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = 0; ;} break; case 139: -#line 1316 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1320 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val); if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) @@ -4181,12 +4185,12 @@ break; case 140: -#line 1322 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1326 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = 0; ;} break; case 141: -#line 1323 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1327 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val); if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) @@ -4196,7 +4200,7 @@ break; case 142: -#line 1332 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1336 "/cvs/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] == '\\') @@ -4207,27 +4211,27 @@ break; case 143: -#line 1340 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1344 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; ;} break; case 144: -#line 1341 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1345 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;} break; case 145: -#line 1346 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1350 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" {;} break; case 146: -#line 1347 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1351 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" {;} break; case 147: -#line 1348 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1352 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV->setSection(*(yyvsp[(1) - (1)].StrVal)); delete (yyvsp[(1) - (1)].StrVal); @@ -4236,7 +4240,7 @@ break; case 148: -#line 1353 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1357 "/cvs/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"); @@ -4246,7 +4250,7 @@ break; case 156: -#line 1369 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1373 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeVal) = new PATypeHolder(OpaqueType::get()); CHECK_FOR_ERROR @@ -4254,7 +4258,7 @@ break; case 157: -#line 1373 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1377 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType)); CHECK_FOR_ERROR @@ -4262,7 +4266,7 @@ break; case 158: -#line 1377 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1381 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Pointer type? if (*(yyvsp[(1) - (3)].TypeVal) == Type::LabelTy) GEN_ERROR("Cannot form a pointer to a basic block"); @@ -4273,7 +4277,7 @@ break; case 159: -#line 1384 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1388 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Named types are also simple types... const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal)); CHECK_FOR_ERROR @@ -4282,7 +4286,7 @@ break; case 160: -#line 1389 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1393 "/cvs/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 @@ -4294,7 +4298,7 @@ break; case 161: -#line 1397 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1401 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Allow but ignore attributes on function types; this permits auto-upgrade. // FIXME: remove in LLVM 3.0. @@ -4327,7 +4331,7 @@ break; case 162: -#line 1426 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1430 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Allow but ignore attributes on function types; this permits auto-upgrade. // FIXME: remove in LLVM 3.0. @@ -4355,7 +4359,7 @@ break; case 163: -#line 1451 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1455 "/cvs/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); @@ -4364,7 +4368,7 @@ break; case 164: -#line 1456 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1460 "/cvs/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)) @@ -4378,7 +4382,7 @@ break; case 165: -#line 1466 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1470 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Structure type? std::vector Elements; for (std::list::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(), @@ -4392,7 +4396,7 @@ break; case 166: -#line 1476 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1480 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Empty structure type? (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector())); CHECK_FOR_ERROR @@ -4400,7 +4404,7 @@ break; case 167: -#line 1480 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1484 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { std::vector Elements; for (std::list::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(), @@ -4414,7 +4418,7 @@ break; case 168: -#line 1490 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1494 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Empty structure type? (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector(), true)); CHECK_FOR_ERROR @@ -4422,7 +4426,7 @@ break; case 169: -#line 1497 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1501 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Allow but ignore attributes on function types; this permits auto-upgrade. // FIXME: remove in LLVM 3.0. @@ -4432,7 +4436,7 @@ break; case 170: -#line 1506 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1510 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription()); @@ -4443,14 +4447,14 @@ break; case 171: -#line 1513 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1517 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeVal) = new PATypeHolder(Type::VoidTy); ;} break; case 172: -#line 1518 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1522 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeWithAttrsList) = new TypeWithAttrsList(); (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs)); @@ -4459,7 +4463,7 @@ break; case 173: -#line 1523 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1527 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs)); CHECK_FOR_ERROR @@ -4467,7 +4471,7 @@ break; case 175: -#line 1531 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1535 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList); TypeWithAttrs TWA; TWA.Attrs = Attribute::None; @@ -4478,7 +4482,7 @@ break; case 176: -#line 1538 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1542 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeWithAttrsList) = new TypeWithAttrsList; TypeWithAttrs TWA; TWA.Attrs = Attribute::None; @@ -4489,7 +4493,7 @@ break; case 177: -#line 1545 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1549 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeWithAttrsList) = new TypeWithAttrsList(); CHECK_FOR_ERROR @@ -4497,7 +4501,7 @@ break; case 178: -#line 1553 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1557 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeList) = new std::list(); (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal)); @@ -4507,7 +4511,7 @@ break; case 179: -#line 1559 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1563 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal)); delete (yyvsp[(3) - (3)].TypeVal); @@ -4516,7 +4520,7 @@ break; case 180: -#line 1571 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1575 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized arr if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription()); @@ -4548,7 +4552,7 @@ break; case 181: -#line 1599 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1603 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); @@ -4568,7 +4572,7 @@ break; case 182: -#line 1615 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1619 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); @@ -4599,7 +4603,7 @@ break; case 183: -#line 1642 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1646 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized arr if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription()); @@ -4631,7 +4635,7 @@ break; case 184: -#line 1670 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1674 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { const StructType *STy = dyn_cast((yyvsp[(1) - (4)].TypeVal)->get()); if (STy == 0) @@ -4661,7 +4665,7 @@ break; case 185: -#line 1696 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1700 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); @@ -4685,7 +4689,7 @@ break; case 186: -#line 1716 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1720 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { const StructType *STy = dyn_cast((yyvsp[(1) - (6)].TypeVal)->get()); if (STy == 0) @@ -4715,7 +4719,7 @@ break; case 187: -#line 1742 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1746 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription()); @@ -4739,7 +4743,7 @@ break; case 188: -#line 1762 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1766 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); @@ -4755,7 +4759,7 @@ break; case 189: -#line 1774 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1778 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); @@ -4766,7 +4770,7 @@ break; case 190: -#line 1781 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1785 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); @@ -4836,7 +4840,7 @@ break; case 191: -#line 1847 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1851 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); @@ -4850,7 +4854,7 @@ break; case 192: -#line 1857 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1861 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); @@ -4864,7 +4868,7 @@ break; case 193: -#line 1867 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1871 "/cvs/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"); @@ -4874,7 +4878,7 @@ break; case 194: -#line 1873 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1877 "/cvs/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) { @@ -4888,7 +4892,7 @@ break; case 195: -#line 1883 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1887 "/cvs/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"); @@ -4898,7 +4902,7 @@ break; case 196: -#line 1889 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1893 "/cvs/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) { @@ -4912,7 +4916,7 @@ break; case 197: -#line 1899 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1903 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Boolean constants if (cast((yyvsp[(1) - (2)].PrimType))->getBitWidth() != 1) GEN_ERROR("Constant true must have type i1"); @@ -4922,7 +4926,7 @@ break; case 198: -#line 1905 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1909 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Boolean constants if (cast((yyvsp[(1) - (2)].PrimType))->getBitWidth() != 1) GEN_ERROR("Constant false must have type i1"); @@ -4932,7 +4936,7 @@ break; case 199: -#line 1911 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1915 "/cvs/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"); @@ -4947,7 +4951,7 @@ break; case 200: -#line 1924 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1928 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription()); @@ -4963,7 +4967,7 @@ break; case 201: -#line 1936 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1940 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!isa((yyvsp[(3) - (5)].ConstVal)->getType())) GEN_ERROR("GetElementPtr requires a pointer operand"); @@ -4988,7 +4992,7 @@ break; case 202: -#line 1957 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1961 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty) GEN_ERROR("Select condition must be of boolean type"); @@ -5000,7 +5004,7 @@ break; case 203: -#line 1965 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1969 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType()) GEN_ERROR("Binary operator types must match"); @@ -5010,7 +5014,7 @@ break; case 204: -#line 1971 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1975 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType()) GEN_ERROR("Logical operator types must match"); @@ -5025,7 +5029,7 @@ break; case 205: -#line 1982 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1986 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) GEN_ERROR("icmp operand types must match"); @@ -5034,7 +5038,7 @@ break; case 206: -#line 1987 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1991 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) GEN_ERROR("fcmp operand types must match"); @@ -5043,7 +5047,7 @@ break; case 207: -#line 1992 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1996 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) GEN_ERROR("vicmp operand types must match"); @@ -5052,7 +5056,7 @@ break; case 208: -#line 1997 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2001 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) GEN_ERROR("vfcmp operand types must match"); @@ -5061,7 +5065,7 @@ break; case 209: -#line 2002 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2006 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal))) GEN_ERROR("Invalid extractelement operands"); @@ -5071,7 +5075,7 @@ break; case 210: -#line 2008 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2012 "/cvs/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"); @@ -5081,7 +5085,7 @@ break; case 211: -#line 2014 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2018 "/cvs/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"); @@ -5091,7 +5095,7 @@ break; case 212: -#line 2020 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2024 "/cvs/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"); @@ -5103,7 +5107,7 @@ break; case 213: -#line 2028 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2032 "/cvs/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"); @@ -5115,7 +5119,7 @@ break; case 214: -#line 2039 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2043 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal)); CHECK_FOR_ERROR @@ -5123,7 +5127,7 @@ break; case 215: -#line 2043 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2047 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ConstVector) = new std::vector(); (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal)); @@ -5132,27 +5136,27 @@ break; case 216: -#line 2051 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2055 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; ;} break; case 217: -#line 2051 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2055 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; ;} break; case 218: -#line 2054 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2058 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; ;} break; case 219: -#line 2054 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2058 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; ;} break; case 220: -#line 2057 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2061 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get(); Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal)); @@ -5168,7 +5172,7 @@ break; case 221: -#line 2069 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2073 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { Constant *Val = (yyvsp[(3) - (6)].ConstVal); const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get(); @@ -5184,7 +5188,7 @@ break; case 222: -#line 2090 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2094 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule; CurModule.ModuleDone(); @@ -5193,7 +5197,7 @@ break; case 223: -#line 2095 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2099 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule; CurModule.ModuleDone(); @@ -5202,12 +5206,12 @@ break; case 226: -#line 2108 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2112 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.isDeclare = false; ;} break; case 227: -#line 2108 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2112 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.FunctionDone(); CHECK_FOR_ERROR @@ -5215,26 +5219,26 @@ break; case 228: -#line 2112 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2116 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.isDeclare = true; ;} break; case 229: -#line 2112 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2116 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; case 230: -#line 2115 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2119 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; case 231: -#line 2118 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2122 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription()); @@ -5262,7 +5266,7 @@ break; case 232: -#line 2142 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2146 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType)); @@ -5277,7 +5281,7 @@ break; case 233: -#line 2154 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2158 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { /* "Externally Visible" Linkage */ if ((yyvsp[(5) - (6)].ConstVal) == 0) @@ -5289,14 +5293,14 @@ break; case 234: -#line 2161 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2165 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; ;} break; case 235: -#line 2165 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2169 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(6) - (7)].ConstVal) == 0) GEN_ERROR("Global value initializer is not a constant"); @@ -5306,14 +5310,14 @@ break; case 236: -#line 2170 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2174 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; ;} break; case 237: -#line 2174 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2178 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (7)].TypeVal))->getDescription()); @@ -5324,7 +5328,7 @@ break; case 238: -#line 2180 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2184 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; CHECK_FOR_ERROR @@ -5332,7 +5336,7 @@ break; case 239: -#line 2184 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2188 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { std::string Name; if ((yyvsp[(1) - (5)].StrVal)) { @@ -5376,21 +5380,21 @@ break; case 240: -#line 2224 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2228 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; case 241: -#line 2227 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2231 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; case 242: -#line 2233 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2237 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm(); if (AsmSoFar.empty()) @@ -5403,7 +5407,7 @@ break; case 243: -#line 2243 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2247 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal)); delete (yyvsp[(3) - (3)].StrVal); @@ -5411,7 +5415,7 @@ break; case 244: -#line 2247 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2251 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal)); delete (yyvsp[(3) - (3)].StrVal); @@ -5419,7 +5423,7 @@ break; case 246: -#line 2254 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2258 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal)); delete (yyvsp[(3) - (3)].StrVal); @@ -5428,7 +5432,7 @@ break; case 247: -#line 2259 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2263 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal)); delete (yyvsp[(1) - (1)].StrVal); @@ -5437,14 +5441,14 @@ break; case 248: -#line 2264 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2268 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; case 249: -#line 2273 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2277 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription()); @@ -5458,7 +5462,7 @@ break; case 250: -#line 2283 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2287 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); @@ -5472,7 +5476,7 @@ break; case 251: -#line 2294 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2298 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList); CHECK_FOR_ERROR @@ -5480,7 +5484,7 @@ break; case 252: -#line 2298 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2302 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList); struct ArgListEntry E; @@ -5493,7 +5497,7 @@ break; case 253: -#line 2307 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2311 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = new ArgListType; struct ArgListEntry E; @@ -5506,7 +5510,7 @@ break; case 254: -#line 2316 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2320 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = 0; CHECK_FOR_ERROR @@ -5514,7 +5518,7 @@ break; case 255: -#line 2322 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2326 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { std::string FunctionName(*(yyvsp[(4) - (11)].StrVal)); delete (yyvsp[(4) - (11)].StrVal); // Free strdup'd memory! @@ -5665,7 +5669,7 @@ break; case 258: -#line 2472 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2476 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FunctionVal) = CurFun.CurrentFunction; @@ -5677,7 +5681,7 @@ break; case 261: -#line 2483 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2487 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); CHECK_FOR_ERROR @@ -5685,7 +5689,7 @@ break; case 262: -#line 2488 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2492 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage)); CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility)); @@ -5696,7 +5700,7 @@ break; case 263: -#line 2500 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2504 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; CHECK_FOR_ERROR @@ -5704,7 +5708,7 @@ break; case 264: -#line 2504 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2508 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; CHECK_FOR_ERROR @@ -5712,7 +5716,7 @@ break; case 265: -#line 2509 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2513 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // A reference to a direct constant (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val)); CHECK_FOR_ERROR @@ -5720,7 +5724,7 @@ break; case 266: -#line 2513 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2517 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val)); CHECK_FOR_ERROR @@ -5728,7 +5732,7 @@ break; case 267: -#line 2517 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2521 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // arbitrary precision integer constants (yyval.ValIDVal) = ValID::create(*(yyvsp[(1) - (1)].APIntVal), true); delete (yyvsp[(1) - (1)].APIntVal); @@ -5737,7 +5741,7 @@ break; case 268: -#line 2522 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2526 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // arbitrary precision integer constants (yyval.ValIDVal) = ValID::create(*(yyvsp[(1) - (1)].APIntVal), false); delete (yyvsp[(1) - (1)].APIntVal); @@ -5746,7 +5750,7 @@ break; case 269: -#line 2527 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2531 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Perhaps it's an FP constant? (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal)); CHECK_FOR_ERROR @@ -5754,7 +5758,7 @@ break; case 270: -#line 2531 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2535 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue()); CHECK_FOR_ERROR @@ -5762,7 +5766,7 @@ break; case 271: -#line 2535 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2539 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse()); CHECK_FOR_ERROR @@ -5770,7 +5774,7 @@ break; case 272: -#line 2539 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2543 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::createNull(); CHECK_FOR_ERROR @@ -5778,7 +5782,7 @@ break; case 273: -#line 2543 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2547 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::createUndef(); CHECK_FOR_ERROR @@ -5786,7 +5790,7 @@ break; case 274: -#line 2547 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2551 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // A vector zero constant. (yyval.ValIDVal) = ValID::createZeroInit(); CHECK_FOR_ERROR @@ -5794,7 +5798,7 @@ break; case 275: -#line 2551 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2555 "/cvs/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(); @@ -5820,7 +5824,7 @@ break; case 276: -#line 2573 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2577 "/cvs/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(); @@ -5846,7 +5850,7 @@ break; case 277: -#line 2595 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2599 "/cvs/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. @@ -5856,7 +5860,7 @@ break; case 278: -#line 2601 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2605 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { uint64_t NumElements = (yyvsp[(2) - (2)].StrVal)->length(); const Type *ETy = Type::Int8Ty; @@ -5873,7 +5877,7 @@ break; case 279: -#line 2614 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2618 "/cvs/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) @@ -5889,7 +5893,7 @@ break; case 280: -#line 2626 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2630 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { const StructType *STy = StructType::get(std::vector()); (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, std::vector())); @@ -5898,7 +5902,7 @@ break; case 281: -#line 2631 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2635 "/cvs/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) @@ -5914,7 +5918,7 @@ break; case 282: -#line 2643 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2647 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { const StructType *STy = StructType::get(std::vector(), /*isPacked=*/true); @@ -5924,7 +5928,7 @@ break; case 283: -#line 2649 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2653 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal)); CHECK_FOR_ERROR @@ -5932,7 +5936,7 @@ break; case 284: -#line 2653 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2657 "/cvs/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); @@ -5942,7 +5946,7 @@ break; case 285: -#line 2663 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2667 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Is it an integer reference...? (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal)); CHECK_FOR_ERROR @@ -5950,7 +5954,7 @@ break; case 286: -#line 2667 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2671 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal)); CHECK_FOR_ERROR @@ -5958,7 +5962,7 @@ break; case 287: -#line 2671 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2675 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Is it a named reference...? (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)); delete (yyvsp[(1) - (1)].StrVal); @@ -5967,7 +5971,7 @@ break; case 288: -#line 2676 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2680 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Is it a named reference...? (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal)); delete (yyvsp[(1) - (1)].StrVal); @@ -5976,7 +5980,7 @@ break; case 291: -#line 2689 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2693 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); @@ -5987,7 +5991,7 @@ break; case 292: -#line 2698 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2702 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueList) = new std::vector(); (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal)); @@ -5996,7 +6000,7 @@ break; case 293: -#line 2703 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2707 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { ((yyval.ValueList)=(yyvsp[(1) - (3)].ValueList))->push_back((yyvsp[(3) - (3)].ValueVal)); CHECK_FOR_ERROR @@ -6004,7 +6008,7 @@ break; case 294: -#line 2708 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2712 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); CHECK_FOR_ERROR @@ -6012,7 +6016,7 @@ break; case 295: -#line 2712 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2716 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Do not allow functions with 0 basic blocks (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); CHECK_FOR_ERROR @@ -6020,7 +6024,7 @@ break; case 296: -#line 2721 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2725 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal)); CHECK_FOR_ERROR @@ -6032,7 +6036,7 @@ break; case 297: -#line 2730 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2734 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR int ValNum = InsertValue((yyvsp[(3) - (3)].TermInstVal)); @@ -6047,7 +6051,7 @@ break; case 298: -#line 2743 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2747 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (CastInst *CI1 = dyn_cast((yyvsp[(2) - (2)].InstVal))) if (CastInst *CI2 = dyn_cast(CI1->getOperand(0))) @@ -6060,7 +6064,7 @@ break; case 299: -#line 2752 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2756 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Empty space between instruction lists (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum)); CHECK_FOR_ERROR @@ -6068,7 +6072,7 @@ break; case 300: -#line 2756 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2760 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Labelled (named) basic block (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal))); delete (yyvsp[(1) - (1)].StrVal); @@ -6078,7 +6082,7 @@ break; case 301: -#line 2764 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2768 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Return with a result... ValueList &VL = *(yyvsp[(2) - (2)].ValueList); assert(!VL.empty() && "Invalid ret operands!"); @@ -6102,7 +6106,7 @@ break; case 302: -#line 2784 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2788 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Return with no result... (yyval.TermInstVal) = ReturnInst::Create(); CHECK_FOR_ERROR @@ -6110,7 +6114,7 @@ break; case 303: -#line 2788 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2792 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Unconditional Branch... BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal)); CHECK_FOR_ERROR @@ -6119,7 +6123,7 @@ break; case 304: -#line 2793 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2797 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (cast((yyvsp[(2) - (9)].PrimType))->getBitWidth() != 1) GEN_ERROR("Branch condition must have type i1"); @@ -6134,7 +6138,7 @@ break; case 305: -#line 2804 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2808 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal)); CHECK_FOR_ERROR @@ -6157,7 +6161,7 @@ break; case 306: -#line 2823 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2827 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal)); CHECK_FOR_ERROR @@ -6170,7 +6174,7 @@ break; case 307: -#line 2833 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2837 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Handle the short syntax @@ -6277,7 +6281,7 @@ break; case 308: -#line 2936 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2940 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TermInstVal) = new UnwindInst(); CHECK_FOR_ERROR @@ -6285,7 +6289,7 @@ break; case 309: -#line 2940 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2944 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TermInstVal) = new UnreachableInst(); CHECK_FOR_ERROR @@ -6293,7 +6297,7 @@ break; case 310: -#line 2947 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2951 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable); Constant *V = cast(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal))); @@ -6308,7 +6312,7 @@ break; case 311: -#line 2958 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2962 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.JumpTable) = new std::vector >(); Constant *V = cast(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal))); @@ -6324,7 +6328,7 @@ break; case 312: -#line 2971 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2975 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Is this definition named?? if so, assign the name... setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal)); @@ -6336,7 +6340,7 @@ break; case 313: -#line 2980 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2984 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR int ValNum = InsertValue((yyvsp[(2) - (2)].InstVal)); @@ -6351,7 +6355,7 @@ break; case 314: -#line 2993 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2997 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Used for PHI nodes if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription()); @@ -6366,7 +6370,7 @@ break; case 315: -#line 3004 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3008 "/cvs/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)); @@ -6378,7 +6382,7 @@ break; case 316: -#line 3014 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3018 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // FIXME: Remove trailing OptAttributes in LLVM 3.0, it was a mistake in 2.0 if (!UpRefs.empty()) @@ -6393,7 +6397,7 @@ break; case 317: -#line 3025 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3029 "/cvs/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 @@ -6405,7 +6409,7 @@ break; case 318: -#line 3033 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3037 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // FIXME: Remove trailing OptAttributes in LLVM 3.0, it was a mistake in 2.0 if (!UpRefs.empty()) @@ -6419,7 +6423,7 @@ break; case 319: -#line 3043 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3047 "/cvs/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); @@ -6430,17 +6434,17 @@ break; case 320: -#line 3050 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3054 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamList) = new ParamList(); ;} break; case 321: -#line 3053 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3057 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueList) = new std::vector(); ;} break; case 322: -#line 3054 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3058 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList); (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal)); @@ -6449,7 +6453,7 @@ break; case 323: -#line 3062 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3066 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ConstantList) = new std::vector(); if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val)) @@ -6459,7 +6463,7 @@ break; case 324: -#line 3068 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3072 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ConstantList) = (yyvsp[(1) - (3)].ConstantList); if ((unsigned)(yyvsp[(3) - (3)].UInt64Val) != (yyvsp[(3) - (3)].UInt64Val)) @@ -6470,7 +6474,7 @@ break; case 325: -#line 3077 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3081 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; CHECK_FOR_ERROR @@ -6478,7 +6482,7 @@ break; case 326: -#line 3081 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3085 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; CHECK_FOR_ERROR @@ -6486,7 +6490,7 @@ break; case 327: -#line 3086 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3090 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription()); @@ -6506,7 +6510,7 @@ break; case 328: -#line 3102 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3106 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription()); @@ -6527,7 +6531,7 @@ break; case 329: -#line 3119 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3123 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); @@ -6543,7 +6547,7 @@ break; case 330: -#line 3131 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3135 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); @@ -6559,7 +6563,7 @@ break; case 331: -#line 3143 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3147 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); @@ -6577,7 +6581,7 @@ break; case 332: -#line 3157 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3161 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); @@ -6595,7 +6599,7 @@ break; case 333: -#line 3171 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3175 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription()); @@ -6611,7 +6615,7 @@ break; case 334: -#line 3183 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3187 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (isa((yyvsp[(2) - (6)].ValueVal)->getType())) { // vector select @@ -6636,7 +6640,7 @@ break; case 335: -#line 3204 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3208 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription()); @@ -6647,7 +6651,7 @@ break; case 336: -#line 3211 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3215 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal))) GEN_ERROR("Invalid extractelement operands"); @@ -6657,7 +6661,7 @@ break; case 337: -#line 3217 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3221 "/cvs/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"); @@ -6667,7 +6671,7 @@ break; case 338: -#line 3223 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3227 "/cvs/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"); @@ -6677,7 +6681,7 @@ break; case 339: -#line 3229 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3233 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType(); if (!Ty->isFirstClassType()) @@ -6696,7 +6700,7 @@ break; case 340: -#line 3245 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3249 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Handle the short syntax @@ -6809,7 +6813,7 @@ break; case 341: -#line 3354 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3358 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal); CHECK_FOR_ERROR @@ -6817,7 +6821,7 @@ break; case 342: -#line 3359 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3363 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; CHECK_FOR_ERROR @@ -6825,7 +6829,7 @@ break; case 343: -#line 3363 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3367 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; CHECK_FOR_ERROR @@ -6833,7 +6837,7 @@ break; case 344: -#line 3370 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3374 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription()); @@ -6844,7 +6848,7 @@ break; case 345: -#line 3377 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3381 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription()); @@ -6858,7 +6862,7 @@ break; case 346: -#line 3387 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3391 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription()); @@ -6869,7 +6873,7 @@ break; case 347: -#line 3394 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3398 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription()); @@ -6883,7 +6887,7 @@ break; case 348: -#line 3404 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3408 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!isa((yyvsp[(2) - (2)].ValueVal)->getType())) GEN_ERROR("Trying to free nonpointer type " + @@ -6894,7 +6898,7 @@ break; case 349: -#line 3412 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3416 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription()); @@ -6912,7 +6916,7 @@ break; case 350: -#line 3426 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3430 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription()); @@ -6933,7 +6937,7 @@ break; case 351: -#line 3443 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3447 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription()); @@ -6951,7 +6955,7 @@ break; case 352: -#line 3457 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3461 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription()); @@ -6970,7 +6974,7 @@ break; case 353: -#line 3472 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3476 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription()); @@ -6989,7 +6993,7 @@ break; case 354: -#line 3487 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3491 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (7)].TypeVal))->getDescription()); @@ -7011,7 +7015,7 @@ /* Line 1267 of yacc.c. */ -#line 7015 "llvmAsmParser.tab.c" +#line 7019 "llvmAsmParser.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -7225,7 +7229,7 @@ } -#line 3506 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3510 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" // common code from the two 'RunVMAsmParser' functions Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.h.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.h.cvs?rev=57009&r1=57008&r2=57009&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/llvmAsmParser.h.cvs (original) +++ llvm/trunk/lib/AsmParser/llvmAsmParser.h.cvs Fri Oct 3 10:52:39 2008 @@ -360,7 +360,7 @@ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 970 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 974 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { llvm::Module *ModuleVal; llvm::Function *FunctionVal; Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs?rev=57009&r1=57008&r2=57009&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs (original) +++ llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs Fri Oct 3 10:52:39 2008 @@ -707,6 +707,7 @@ ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy); CurModule.LateResolveTypes.erase(I); } + D.destroy(); } // setValueName - Set the specified value to the name given. The name may be @@ -782,9 +783,12 @@ GV->setConstant(isConstantGlobal); GV->setThreadLocal(IsThreadLocal); InsertValue(GV, CurModule.Values); + ID.destroy(); return GV; } + ID.destroy(); + // If this global has a name if (!Name.empty()) { // if the global we're parsing has an initializer (is a definition) and From grosbach at apple.com Fri Oct 3 10:52:42 2008 From: grosbach at apple.com (Jim Grosbach) Date: Fri, 03 Oct 2008 15:52:42 -0000 Subject: [llvm-commits] [llvm] r57010 - /llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp Message-ID: <200810031552.m93FqghM001966@zion.cs.uiuc.edu> Author: grosbach Date: Fri Oct 3 10:52:42 2008 New Revision: 57010 URL: http://llvm.org/viewvc/llvm-project?rev=57010&view=rev Log: NeedStub/DoesntNeedStub logic was reversed, leading to not using a stub for global relocations that do need them (libc calls, for example). 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=57010&r1=57009&r2=57010&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp Fri Oct 3 10:52:42 2008 @@ -120,7 +120,7 @@ /// Routines that handle operands which add machine relocations which are /// fixed up by the JIT fixup stage. void emitGlobalAddress(GlobalValue *GV, unsigned Reloc, - bool DoesntNeedStub); + bool NeedStub); void emitExternalSymbolAddress(const char *ES, unsigned Reloc); void emitConstPoolAddress(unsigned CPI, unsigned Reloc, int Disp = 0, unsigned PCAdj = 0 ); @@ -186,7 +186,7 @@ else if (MO.isImm()) return static_cast(MO.getImm()); else if (MO.isGlobal()) - emitGlobalAddress(MO.getGlobal(), ARM::reloc_arm_branch, false); + emitGlobalAddress(MO.getGlobal(), ARM::reloc_arm_branch, true); else if (MO.isSymbol()) emitExternalSymbolAddress(MO.getSymbolName(), ARM::reloc_arm_relative); else if (MO.isCPI()) @@ -205,9 +205,9 @@ /// emitGlobalAddress - Emit the specified address to the code stream. /// void ARMCodeEmitter::emitGlobalAddress(GlobalValue *GV, - unsigned Reloc, bool DoesntNeedStub) { + unsigned Reloc, bool NeedStub) { MCE.addRelocation(MachineRelocation::getGV(MCE.getCurrentPCOffset(), - Reloc, GV, 0, DoesntNeedStub)); + Reloc, GV, 0, NeedStub)); } /// emitExternalSymbolAddress - Arrange for the address of an external symbol to From grosbach at apple.com Fri Oct 3 10:53:56 2008 From: grosbach at apple.com (Jim Grosbach) Date: Fri, 03 Oct 2008 15:53:56 -0000 Subject: [llvm-commits] [llvm] r57011 - /llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp Message-ID: <200810031553.m93Fru78002021@zion.cs.uiuc.edu> Author: grosbach Date: Fri Oct 3 10:53:56 2008 New Revision: 57011 URL: http://llvm.org/viewvc/llvm-project?rev=57011&view=rev Log: Indexing off by one resulted in errant encoding of source register for reg->reg moves. 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=57011&r1=57010&r2=57011&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp Fri Oct 3 10:53:56 2008 @@ -416,7 +416,7 @@ const MachineOperand &MO = MI.getOperand(OpIdx); if (MO.isReg()) // Encode register Rm. - return Binary | getMachineOpValue(MI, NumDefs + 1); + return Binary | getMachineOpValue(MI, NumDefs); // Encode so_imm. // Set bit I(25) to identify this is the immediate form of From dalej at apple.com Fri Oct 3 11:10:16 2008 From: dalej at apple.com (Dale Johannesen) Date: Fri, 3 Oct 2008 09:10:16 -0700 Subject: [llvm-commits] [llvm] r56963 - in /llvm/trunk: lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/Target/X86/X86ISelDAGToDAG.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86InstrInfo.td test/CodeGen/X86/2008-10-02-Atomics32-2.ll utils/TableGen/CodeGenInstruction.cpp In-Reply-To: <48E5E56E.6060402@lip6.fr> References: <200810021853.m92Irlwg015711@zion.cs.uiuc.edu> <48E5E56E.6060402@lip6.fr> Message-ID: <081E2821-758C-4C5E-B92B-6D628BAB84B6@apple.com> On Oct 3, 2008, at 2:27 AM, Nicolas Geoffray wrote: > Hi Dale, > > Dale Johannesen wrote: >> Author: johannes >> Date: Thu Oct 2 13:53:47 2008 >> New Revision: 56963 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=56963&view=rev >> Log: >> Handle some 64-bit atomics on x86-32, some of the time. >> >> > > This patch makes the compilation of a function such as: > > define i64 @func(i64* %ptr, i64 %cmp, i64 %swap) nounwind { > %A = call i64 @llvm.atomic.cmp.swap.i64.p0i64( i64* %ptr, i64 %cmp, > i64 %swap) > ret i64 %A > } > > fail with the error message: > > llc: > /home/varth/project/llvm-svn/llvm/include/llvm/CodeGen/ > SelectionDAGNodes.h:1266: > const llvm::SDValue& llvm::SDNode::getOperand(unsigned int) const: > Assertion `Num < NumOperands && "Invalid child # of SDNode!"' failed. > > > Was that intended? No, sorry. I'll get it fixed later today. From grosbach at apple.com Fri Oct 3 11:17:20 2008 From: grosbach at apple.com (Jim Grosbach) Date: Fri, 03 Oct 2008 16:17:20 -0000 Subject: [llvm-commits] [llvm] r57013 - in /llvm/trunk: include/llvm/ExecutionEngine/JITMemoryManager.h include/llvm/System/Memory.h lib/ExecutionEngine/JIT/JITEmitter.cpp lib/ExecutionEngine/JIT/JITMemoryManager.cpp lib/System/Memory.cpp lib/System/Unix/Memory.inc Message-ID: <200810031617.m93GHLGt003119@zion.cs.uiuc.edu> Author: grosbach Date: Fri Oct 3 11:17:20 2008 New Revision: 57013 URL: http://llvm.org/viewvc/llvm-project?rev=57013&view=rev Log: On Darwin ARM, memory needs special handling to do JIT. This patch expands this handling to work properly for modifying stub functions, relocations back to entry points after JIT compilation, etc.. Modified: llvm/trunk/include/llvm/ExecutionEngine/JITMemoryManager.h llvm/trunk/include/llvm/System/Memory.h llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp llvm/trunk/lib/ExecutionEngine/JIT/JITMemoryManager.cpp llvm/trunk/lib/System/Memory.cpp llvm/trunk/lib/System/Unix/Memory.inc Modified: llvm/trunk/include/llvm/ExecutionEngine/JITMemoryManager.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/JITMemoryManager.h?rev=57013&r1=57012&r2=57013&view=diff ============================================================================== --- llvm/trunk/include/llvm/ExecutionEngine/JITMemoryManager.h (original) +++ llvm/trunk/include/llvm/ExecutionEngine/JITMemoryManager.h Fri Oct 3 11:17:20 2008 @@ -35,6 +35,14 @@ /// JIT Memory Manager if the client does not provide one to the JIT. static JITMemoryManager *CreateDefaultMemManager(); + /// setMemoryWritable - When code generation is in progress, + /// the code pages may need permissions changed. + virtual void setMemoryWritable(void) = 0; + + /// setMemoryExecutable - When code generation is done and we're ready to + /// start execution, the code pages may need permissions changed. + virtual void setMemoryExecutable(void) = 0; + //===--------------------------------------------------------------------===// // Global Offset Table Management //===--------------------------------------------------------------------===// Modified: llvm/trunk/include/llvm/System/Memory.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/System/Memory.h?rev=57013&r1=57012&r2=57013&view=diff ============================================================================== --- llvm/trunk/include/llvm/System/Memory.h (original) +++ llvm/trunk/include/llvm/System/Memory.h Fri Oct 3 11:17:20 2008 @@ -70,10 +70,15 @@ /// platforms. static void InvalidateInstructionCache(const void *Addr, size_t Len); - /// SetRXPrivilege - Before the JIT can run a block of code, it has to be + /// setExecutable - Before the JIT can run a block of code, it has to be /// given read and executable privilege. Return true if it is already r-x /// or the system is able to change its previlege. - static bool SetRXPrivilege(const void *Addr, size_t Size); + static bool setExecutable (MemoryBlock &M, std::string *ErrMsg = 0); + + /// setWritable - When adding to a block of code, the JIT may need + /// to mark a block of code as RW since the protections are on page + /// boundaries, and the JIT internal allocations are not page aligned. + static bool setWritable (MemoryBlock &M, std::string *ErrMsg = 0); }; } } Modified: llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp?rev=57013&r1=57012&r2=57013&view=diff ============================================================================== --- llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp (original) +++ llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp Fri Oct 3 11:17:20 2008 @@ -560,6 +560,10 @@ if (ExceptionHandling) DE->setModuleInfo(Info); } + void setMemoryExecutable(void) { + MemMgr->setMemoryExecutable(); + } + private: void *getPointerToGlobal(GlobalValue *GV, void *Reference, bool NoNeedStub); void *getPointerToGVLazyPtr(GlobalValue *V, void *Reference, @@ -791,6 +795,8 @@ void JITEmitter::startFunction(MachineFunction &F) { uintptr_t ActualSize = 0; + // Set the memory writable, if it's not already + MemMgr->setMemoryWritable(); if (MemMgr->NeedsExactSize()) { DOUT << "ExactSize\n"; const TargetInstrInfo* TII = F.getTarget().getInstrInfo(); @@ -938,7 +944,7 @@ Relocations.clear(); // Mark code region readable and executable if it's not so already. - sys::Memory::SetRXPrivilege(FnStart, FnEnd-FnStart); + MemMgr->setMemoryExecutable(); #ifndef NDEBUG { @@ -1086,6 +1092,10 @@ void *JITEmitter::finishFunctionStub(const GlobalValue* F) { NumBytes += getCurrentPCOffset(); + + // Invalidate the icache if necessary. + sys::Memory::InvalidateInstructionCache(BufferBegin, NumBytes); + std::swap(SavedBufferBegin, BufferBegin); BufferEnd = SavedBufferEnd; CurBufferPtr = SavedCurBufferPtr; Modified: llvm/trunk/lib/ExecutionEngine/JIT/JITMemoryManager.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JITMemoryManager.cpp?rev=57013&r1=57012&r2=57013&view=diff ============================================================================== --- llvm/trunk/lib/ExecutionEngine/JIT/JITMemoryManager.cpp (original) +++ llvm/trunk/lib/ExecutionEngine/JIT/JITMemoryManager.cpp Fri Oct 3 11:17:20 2008 @@ -365,6 +365,21 @@ // Finally, remove this entry from TableBlocks. TableBlocks.erase(I); } + + /// setMemoryWritable - When code generation is in progress, + /// the code pages may need permissions changed. + void setMemoryWritable(void) + { + for (unsigned i = 0, e = Blocks.size(); i != e; ++i) + sys::Memory::setWritable(Blocks[i]); + } + /// setMemoryExecutable - When code generation is done and we're ready to + /// start execution, the code pages may need permissions changed. + void setMemoryExecutable(void) + { + for (unsigned i = 0, e = Blocks.size(); i != e; ++i) + sys::Memory::setExecutable(Blocks[i]); + } }; } Modified: llvm/trunk/lib/System/Memory.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Memory.cpp?rev=57013&r1=57012&r2=57013&view=diff ============================================================================== --- llvm/trunk/lib/System/Memory.cpp (original) +++ llvm/trunk/lib/System/Memory.cpp Fri Oct 3 11:17:20 2008 @@ -58,14 +58,3 @@ #endif // end PPC } - -bool llvm::sys::Memory::SetRXPrivilege(const void *Addr, size_t Size) { -#if defined(__APPLE__) && defined(__arm__) - kern_return_t kr = vm_protect(mach_task_self(), (vm_address_t)Addr, - (vm_size_t)Size, 0, - VM_PROT_READ | VM_PROT_EXECUTE | VM_PROT_COPY); - return KERN_SUCCESS == kr; -#else - return true; -#endif -} Modified: llvm/trunk/lib/System/Unix/Memory.inc URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Unix/Memory.inc?rev=57013&r1=57012&r2=57013&view=diff ============================================================================== --- llvm/trunk/lib/System/Unix/Memory.inc (original) +++ llvm/trunk/lib/System/Unix/Memory.inc Fri Oct 3 11:17:20 2008 @@ -76,7 +76,7 @@ (vm_size_t)(pageSize*NumPages), 0, VM_PROT_READ | VM_PROT_EXECUTE | VM_PROT_COPY); if (KERN_SUCCESS != kr) { - MakeErrMsg(ErrMsg, "vm_protect max RWX failed\n"); + MakeErrMsg(ErrMsg, "vm_protect max RX failed\n"); return sys::MemoryBlock(); } @@ -103,3 +103,27 @@ return false; } +bool llvm::sys::Memory::setWritable (MemoryBlock &M, std::string *ErrMsg) { +#if defined(__APPLE__) && defined(__arm__) + if (M.Address == 0 || M.Size == 0) return false; + sys::Memory::InvalidateInstructionCache(M.Address, M.Size); + kern_return_t kr = vm_protect(mach_task_self(), (vm_address_t)M.Address, + (vm_size_t)M.Size, 0, VM_PROT_READ | VM_PROT_WRITE); + return KERN_SUCCESS == kr; +#else + return true; +#endif +} + +bool llvm::sys::Memory::setExecutable (MemoryBlock &M, std::string *ErrMsg) { +#if defined(__APPLE__) && defined(__arm__) + if (M.Address == 0 || M.Size == 0) return false; + sys::Memory::InvalidateInstructionCache(M.Address, M.Size); + kern_return_t kr = vm_protect(mach_task_self(), (vm_address_t)M.Address, + (vm_size_t)M.Size, 0, VM_PROT_READ | VM_PROT_EXECUTE | VM_PROT_COPY); + return KERN_SUCCESS == kr; +#else + return false; +#endif +} + From gohman at apple.com Fri Oct 3 11:17:33 2008 From: gohman at apple.com (Dan Gohman) Date: Fri, 03 Oct 2008 16:17:33 -0000 Subject: [llvm-commits] [llvm] r57014 - /llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Message-ID: <200810031617.m93GHXWX003138@zion.cs.uiuc.edu> Author: djg Date: Fri Oct 3 11:17:33 2008 New Revision: 57014 URL: http://llvm.org/viewvc/llvm-project?rev=57014&view=rev Log: Remove an unused field. Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=57014&r1=57013&r2=57014&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Fri Oct 3 11:17:33 2008 @@ -107,10 +107,6 @@ /// SelectionDAG operations. /// class VISIBILITY_HIDDEN X86DAGToDAGISel : public SelectionDAGISel { - /// ContainsFPCode - Every instruction we select that uses or defines a FP - /// register should set this to true. - bool ContainsFPCode; - /// TM - Keep a reference to X86TargetMachine. /// X86TargetMachine &TM; @@ -134,8 +130,7 @@ public: X86DAGToDAGISel(X86TargetMachine &tm, bool fast) : SelectionDAGISel(X86Lowering, fast), - ContainsFPCode(false), TM(tm), - X86Lowering(*TM.getTargetLowering()), + TM(tm), X86Lowering(*TM.getTargetLowering()), Subtarget(&TM.getSubtarget()), OptForSize(false) {} From dpatel at apple.com Fri Oct 3 11:43:28 2008 From: dpatel at apple.com (Devang Patel) Date: Fri, 3 Oct 2008 09:43:28 -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: <200810030919.24364.baldrick@free.fr> References: <200810012341.m91NfPF1002323@zion.cs.uiuc.edu> <200810021048.02861.baldrick@free.fr> <200810030919.24364.baldrick@free.fr> Message-ID: On Oct 3, 2008, at 12:19 AM, Duncan Sands wrote: >> 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. > > I was thinking more of a front-end that generates IR directly. > For example, if in llvm-gcc I accidentally tried to add "inreg" > at ~0 rather than 0, would the verifier catch that? Not yet but it is in my list. Ironically, right now ReturnOnly lists only function attributes :) - Devang From gohman at apple.com Fri Oct 3 11:55:19 2008 From: gohman at apple.com (Dan Gohman) Date: Fri, 03 Oct 2008 16:55:19 -0000 Subject: [llvm-commits] [llvm] r57016 - in /llvm/trunk/lib/Target: ARM/ARMISelDAGToDAG.cpp Alpha/AlphaISelDAGToDAG.cpp IA64/IA64ISelDAGToDAG.cpp Mips/MipsISelDAGToDAG.cpp PIC16/PIC16ISelDAGToDAG.cpp PowerPC/PPCISelDAGToDAG.cpp Sparc/Sparc.h Sparc/SparcISelDAGToDAG.cpp Sparc/SparcTargetMachine.cpp Sparc/SparcTargetMachine.h X86/X86ISelDAGToDAG.cpp Message-ID: <200810031655.m93GtKIJ004362@zion.cs.uiuc.edu> Author: djg Date: Fri Oct 3 11:55:19 2008 New Revision: 57016 URL: http://llvm.org/viewvc/llvm-project?rev=57016&view=rev Log: Avoid creating two TargetLowering objects for each target. Instead, just create one, and make sure everything that needs it can access it. Previously most of the SelectionDAGISel subclasses all had their own TargetLowering object, which was redundant with the TargetLowering object in the TargetMachine subclasses, except on Sparc, where SparcTargetMachine didn't have a TargetLowering object. Change Sparc to work more like the other targets here. Modified: llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp llvm/trunk/lib/Target/Alpha/AlphaISelDAGToDAG.cpp llvm/trunk/lib/Target/IA64/IA64ISelDAGToDAG.cpp llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp llvm/trunk/lib/Target/PIC16/PIC16ISelDAGToDAG.cpp llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp llvm/trunk/lib/Target/Sparc/Sparc.h llvm/trunk/lib/Target/Sparc/SparcISelDAGToDAG.cpp llvm/trunk/lib/Target/Sparc/SparcTargetMachine.cpp llvm/trunk/lib/Target/Sparc/SparcTargetMachine.h llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Modified: llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp?rev=57016&r1=57015&r2=57016&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp Fri Oct 3 11:55:19 2008 @@ -39,15 +39,13 @@ class ARMDAGToDAGISel : public SelectionDAGISel { ARMTargetMachine &TM; - ARMTargetLowering ARMLowering; - /// Subtarget - Keep a pointer to the ARMSubtarget around so that we can /// make the right decision when generating code for different targets. const ARMSubtarget *Subtarget; public: explicit ARMDAGToDAGISel(ARMTargetMachine &tm) - : SelectionDAGISel(ARMLowering), TM(tm), ARMLowering(tm), + : SelectionDAGISel(*tm.getTargetLowering()), TM(tm), Subtarget(&TM.getSubtarget()) { } Modified: llvm/trunk/lib/Target/Alpha/AlphaISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaISelDAGToDAG.cpp?rev=57016&r1=57015&r2=57016&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AlphaISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/Alpha/AlphaISelDAGToDAG.cpp Fri Oct 3 11:55:19 2008 @@ -40,8 +40,6 @@ /// AlphaDAGToDAGISel - Alpha specific code to select Alpha machine /// instructions for SelectionDAG operations. class AlphaDAGToDAGISel : public SelectionDAGISel { - AlphaTargetLowering AlphaLowering; - static const int64_t IMM_LOW = -32768; static const int64_t IMM_HIGH = 32767; static const int64_t IMM_MULT = 65536; @@ -147,8 +145,7 @@ public: explicit AlphaDAGToDAGISel(AlphaTargetMachine &TM) - : SelectionDAGISel(AlphaLowering), - AlphaLowering(*TM.getTargetLowering()) + : SelectionDAGISel(*TM.getTargetLowering()) {} /// getI64Imm - Return a target constant with the specified value, of type Modified: llvm/trunk/lib/Target/IA64/IA64ISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64ISelDAGToDAG.cpp?rev=57016&r1=57015&r2=57016&view=diff ============================================================================== --- llvm/trunk/lib/Target/IA64/IA64ISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/IA64/IA64ISelDAGToDAG.cpp Fri Oct 3 11:55:19 2008 @@ -37,11 +37,10 @@ /// instructions for SelectionDAG operations. /// class IA64DAGToDAGISel : public SelectionDAGISel { - IA64TargetLowering IA64Lowering; unsigned GlobalBaseReg; public: explicit IA64DAGToDAGISel(IA64TargetMachine &TM) - : SelectionDAGISel(IA64Lowering), IA64Lowering(*TM.getTargetLowering()) {} + : SelectionDAGISel(*TM.getTargetLowering()) {} virtual bool runOnFunction(Function &Fn) { // Make sure we re-emit a set of the global base reg if necessary Modified: llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp?rev=57016&r1=57015&r2=57016&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp Fri Oct 3 11:55:19 2008 @@ -52,19 +52,14 @@ /// TM - Keep a reference to MipsTargetMachine. MipsTargetMachine &TM; - /// MipsLowering - This object fully describes how to lower LLVM code to an - /// Mips-specific SelectionDAG. - MipsTargetLowering MipsLowering; - /// Subtarget - Keep a pointer to the MipsSubtarget around so that we can /// make the right decision when generating code for different targets. const MipsSubtarget &Subtarget; public: explicit MipsDAGToDAGISel(MipsTargetMachine &tm) : - SelectionDAGISel(MipsLowering), - TM(tm), MipsLowering(*TM.getTargetLowering()), - Subtarget(tm.getSubtarget()) {} + SelectionDAGISel(*tm.getTargetLowering()), + TM(tm), Subtarget(tm.getSubtarget()) {} virtual void InstructionSelect(); Modified: llvm/trunk/lib/Target/PIC16/PIC16ISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16ISelDAGToDAG.cpp?rev=57016&r1=57015&r2=57016&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16ISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/PIC16/PIC16ISelDAGToDAG.cpp Fri Oct 3 11:55:19 2008 @@ -51,14 +51,10 @@ /// TM - Keep a reference to PIC16TargetMachine. PIC16TargetMachine &TM; - /// PIC16Lowering - This object fully describes how to lower LLVM code to an - /// PIC16-specific SelectionDAG. - PIC16TargetLowering PIC16Lowering; - public: explicit PIC16DAGToDAGISel(PIC16TargetMachine &tm) : - SelectionDAGISel(PIC16Lowering), - TM(tm), PIC16Lowering(*TM.getTargetLowering()) {} + SelectionDAGISel(*tm.getTargetLowering()), + TM(tm) {} virtual void InstructionSelect(); Modified: llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp?rev=57016&r1=57015&r2=57016&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp Fri Oct 3 11:55:19 2008 @@ -41,12 +41,12 @@ /// class VISIBILITY_HIDDEN PPCDAGToDAGISel : public SelectionDAGISel { PPCTargetMachine &TM; - PPCTargetLowering PPCLowering; + PPCTargetLowering &PPCLowering; const PPCSubtarget &PPCSubTarget; unsigned GlobalBaseReg; public: explicit PPCDAGToDAGISel(PPCTargetMachine &tm) - : SelectionDAGISel(PPCLowering), TM(tm), + : SelectionDAGISel(*tm.getTargetLowering()), TM(tm), PPCLowering(*TM.getTargetLowering()), PPCSubTarget(*TM.getSubtargetImpl()) {} Modified: llvm/trunk/lib/Target/Sparc/Sparc.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/Sparc.h?rev=57016&r1=57015&r2=57016&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/Sparc.h (original) +++ llvm/trunk/lib/Target/Sparc/Sparc.h Fri Oct 3 11:55:19 2008 @@ -21,9 +21,10 @@ namespace llvm { class FunctionPass; class TargetMachine; + class SparcTargetMachine; class raw_ostream; - FunctionPass *createSparcISelDag(TargetMachine &TM); + FunctionPass *createSparcISelDag(SparcTargetMachine &TM); FunctionPass *createSparcCodePrinterPass(raw_ostream &OS, TargetMachine &TM); FunctionPass *createSparcDelaySlotFillerPass(TargetMachine &TM); FunctionPass *createSparcFPMoverPass(TargetMachine &TM); Modified: llvm/trunk/lib/Target/Sparc/SparcISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcISelDAGToDAG.cpp?rev=57016&r1=57015&r2=57016&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/Sparc/SparcISelDAGToDAG.cpp Fri Oct 3 11:55:19 2008 @@ -29,14 +29,12 @@ /// namespace { class SparcDAGToDAGISel : public SelectionDAGISel { - SparcTargetLowering Lowering; - /// Subtarget - Keep a pointer to the Sparc Subtarget around so that we can /// make the right decision when generating code for different targets. const SparcSubtarget &Subtarget; public: - explicit SparcDAGToDAGISel(TargetMachine &TM) - : SelectionDAGISel(Lowering), Lowering(TM), + explicit SparcDAGToDAGISel(SparcTargetMachine &TM) + : SelectionDAGISel(*TM.getTargetLowering()), Subtarget(TM.getSubtarget()) { } @@ -189,6 +187,6 @@ /// createSparcISelDag - This pass converts a legalized DAG into a /// SPARC-specific DAG, ready for instruction scheduling. /// -FunctionPass *llvm::createSparcISelDag(TargetMachine &TM) { +FunctionPass *llvm::createSparcISelDag(SparcTargetMachine &TM) { return new SparcDAGToDAGISel(TM); } Modified: llvm/trunk/lib/Target/Sparc/SparcTargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcTargetMachine.cpp?rev=57016&r1=57015&r2=57016&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcTargetMachine.cpp (original) +++ llvm/trunk/lib/Target/Sparc/SparcTargetMachine.cpp Fri Oct 3 11:55:19 2008 @@ -30,7 +30,7 @@ /// SparcTargetMachine::SparcTargetMachine(const Module &M, const std::string &FS) : DataLayout("E-p:32:32-f128:128:128"), - Subtarget(M, FS), InstrInfo(Subtarget), + Subtarget(M, FS), TLInfo(*this), InstrInfo(Subtarget), FrameInfo(TargetFrameInfo::StackGrowsDown, 8, 0) { } Modified: llvm/trunk/lib/Target/Sparc/SparcTargetMachine.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcTargetMachine.h?rev=57016&r1=57015&r2=57016&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcTargetMachine.h (original) +++ llvm/trunk/lib/Target/Sparc/SparcTargetMachine.h Fri Oct 3 11:55:19 2008 @@ -19,6 +19,7 @@ #include "llvm/Target/TargetFrameInfo.h" #include "SparcInstrInfo.h" #include "SparcSubtarget.h" +#include "SparcISelLowering.h" namespace llvm { @@ -27,6 +28,7 @@ class SparcTargetMachine : public LLVMTargetMachine { const TargetData DataLayout; // Calculates type size & alignment SparcSubtarget Subtarget; + SparcTargetLowering TLInfo; SparcInstrInfo InstrInfo; TargetFrameInfo FrameInfo; @@ -42,6 +44,9 @@ virtual const SparcRegisterInfo *getRegisterInfo() const { return &InstrInfo.getRegisterInfo(); } + virtual SparcTargetLowering* getTargetLowering() const { + return const_cast(&TLInfo); + } virtual const TargetData *getTargetData() const { return &DataLayout; } static unsigned getModuleMatchQuality(const Module &M); Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=57016&r1=57015&r2=57016&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Fri Oct 3 11:55:19 2008 @@ -113,7 +113,7 @@ /// X86Lowering - This object fully describes how to lower LLVM code to an /// X86-specific SelectionDAG. - X86TargetLowering X86Lowering; + X86TargetLowering &X86Lowering; /// Subtarget - Keep a pointer to the X86Subtarget around so that we can /// make the right decision when generating code for different targets. @@ -129,7 +129,7 @@ public: X86DAGToDAGISel(X86TargetMachine &tm, bool fast) - : SelectionDAGISel(X86Lowering, fast), + : SelectionDAGISel(*tm.getTargetLowering(), fast), TM(tm), X86Lowering(*TM.getTargetLowering()), Subtarget(&TM.getSubtarget()), OptForSize(false) {} From evan.cheng at apple.com Fri Oct 3 12:11:59 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 03 Oct 2008 17:11:59 -0000 Subject: [llvm-commits] [llvm] r57018 - in /llvm/trunk/lib/CodeGen: PBQP.cpp PBQP.h RegAllocPBQP.cpp Message-ID: <200810031711.m93HBxZZ004969@zion.cs.uiuc.edu> Author: evancheng Date: Fri Oct 3 12:11:58 2008 New Revision: 57018 URL: http://llvm.org/viewvc/llvm-project?rev=57018&view=rev Log: Fix typos pointed out by Duncan. Also untabify these files. Modified: llvm/trunk/lib/CodeGen/PBQP.cpp llvm/trunk/lib/CodeGen/PBQP.h llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp Modified: llvm/trunk/lib/CodeGen/PBQP.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PBQP.cpp?rev=57018&r1=57017&r2=57018&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/PBQP.cpp (original) +++ llvm/trunk/lib/CodeGen/PBQP.cpp Fri Oct 3 12:11:58 2008 @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// // // Developed by: Bernhard Scholz -// The Univesity of Sydney +// The University of Sydney // http://www.it.usyd.edu.au/~scholz //===----------------------------------------------------------------------===// @@ -56,13 +56,13 @@ /* node fields */ PBQPVector **node_costs; /* cost vectors of nodes */ - int *node_deg; /* node degree of nodes */ - int *solution; /* solution for node */ + 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; /* stack of nodes */ int stack_ptr; /* stack pointer */ /* bucket fields */ @@ -161,8 +161,8 @@ 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; + assert(adj_ptr != NULL); + delete adj_ptr->costs; } if (adj_ptr -> tc_safe_regs != NULL) { free(adj_ptr -> tc_safe_regs); @@ -814,7 +814,7 @@ v = adj_ptr -> adj; assert(v >= 0 && v < this_->num_nodes); if (u < v) { - simplify_edge(this_,u,v); + simplify_edge(this_,u,v); } } } @@ -1328,9 +1328,9 @@ v = adj_ptr -> adj; assert( v>= 0 && v < this_->num_nodes); if (u < v ) { - costs = adj_ptr -> costs; - assert( costs->getRows() == this_->node_costs[u]->getLength() && - costs->getCols() == this_->node_costs[v]->getLength()); + costs = adj_ptr -> costs; + assert( costs->getRows() == this_->node_costs[u]->getLength() && + costs->getCols() == this_->node_costs[v]->getLength()); } } } Modified: llvm/trunk/lib/CodeGen/PBQP.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PBQP.h?rev=57018&r1=57017&r2=57018&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/PBQP.h (original) +++ llvm/trunk/lib/CodeGen/PBQP.h Fri Oct 3 12:11:58 2008 @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// // // Developed by: Bernhard Scholz -// The Univesity of Sydney +// The University of Sydney // http://www.it.usyd.edu.au/~scholz //===----------------------------------------------------------------------===// Modified: llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp?rev=57018&r1=57017&r2=57018&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp Fri Oct 3 12:11:58 2008 @@ -120,7 +120,7 @@ PBQPVector* buildCostVector(const Container &allowed, PBQPNum spillCost) const; - //! \brief Builds a PBQP interfernce matrix. + //! \brief Builds a PBQP interference matrix. //! //! @return Either a pointer to a non-zero PBQP matrix representing the //! allocation option costs, or a null pointer for a zero matrix. @@ -142,7 +142,7 @@ const Container &allowed2, PBQPNum cBenefit) const; - //! \brief Helper functior for constructInitialPBQPProblem(). + //! \brief Helper function for constructInitialPBQPProblem(). //! //! This function iterates over the Function we are about to allocate for //! and computes spill costs. @@ -281,8 +281,8 @@ assert ((mo.isUse() || mo.isDef()) && "Not a use, not a def, what is it?"); - //... Just the virtual registers. We treat loads and stores as equal. - li->getInterval(moReg).weight += powf(10.0f, loopDepth); + //... Just the virtual registers. We treat loads and stores as equal. + li->getInterval(moReg).weight += powf(10.0f, loopDepth); } } From daniel at zuster.org Fri Oct 3 12:11:59 2008 From: daniel at zuster.org (Daniel Dunbar) Date: Fri, 03 Oct 2008 17:11:59 -0000 Subject: [llvm-commits] [llvm] r57017 - /llvm/trunk/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp Message-ID: <200810031711.m93HBxm9004966@zion.cs.uiuc.edu> Author: ddunbar Date: Fri Oct 3 12:11:57 2008 New Revision: 57017 URL: http://llvm.org/viewvc/llvm-project?rev=57017&view=rev Log: Unbreak build. Modified: llvm/trunk/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp Modified: llvm/trunk/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp?rev=57017&r1=57016&r2=57017&view=diff ============================================================================== --- llvm/trunk/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp (original) +++ llvm/trunk/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp Fri Oct 3 12:11:57 2008 @@ -101,13 +101,13 @@ } // If advancing cfa. - if (Dst.isRegister() && Dst.getRegister() == MachineLocation::VirtualFP) { - if (!Src.isRegister()) { - if (Src.getRegister() == MachineLocation::VirtualFP) { + if (Dst.isReg() && Dst.getReg() == MachineLocation::VirtualFP) { + if (!Src.isReg()) { + if (Src.getReg() == MachineLocation::VirtualFP) { MCE->emitByte(dwarf::DW_CFA_def_cfa_offset); } else { MCE->emitByte(dwarf::DW_CFA_def_cfa); - MCE->emitULEB128Bytes(RI->getDwarfRegNum(Src.getRegister(), true)); + MCE->emitULEB128Bytes(RI->getDwarfRegNum(Src.getReg(), true)); } int Offset = -Src.getOffset(); @@ -116,16 +116,16 @@ } else { assert(0 && "Machine move no supported yet."); } - } else if (Src.isRegister() && - Src.getRegister() == MachineLocation::VirtualFP) { - if (Dst.isRegister()) { + } else if (Src.isReg() && + Src.getReg() == MachineLocation::VirtualFP) { + if (Dst.isReg()) { MCE->emitByte(dwarf::DW_CFA_def_cfa_register); - MCE->emitULEB128Bytes(RI->getDwarfRegNum(Dst.getRegister(), true)); + MCE->emitULEB128Bytes(RI->getDwarfRegNum(Dst.getReg(), true)); } else { assert(0 && "Machine move no supported yet."); } } else { - unsigned Reg = RI->getDwarfRegNum(Src.getRegister(), true); + unsigned Reg = RI->getDwarfRegNum(Src.getReg(), true); int Offset = Dst.getOffset() / stackGrowth; if (Offset < 0) { @@ -775,13 +775,13 @@ } // If advancing cfa. - if (Dst.isRegister() && Dst.getRegister() == MachineLocation::VirtualFP) { - if (!Src.isRegister()) { - if (Src.getRegister() == MachineLocation::VirtualFP) { + if (Dst.isReg() && Dst.getReg() == MachineLocation::VirtualFP) { + if (!Src.isReg()) { + if (Src.getReg() == MachineLocation::VirtualFP) { ++FinalSize; } else { ++FinalSize; - unsigned RegNum = RI->getDwarfRegNum(Src.getRegister(), true); + unsigned RegNum = RI->getDwarfRegNum(Src.getReg(), true); FinalSize += TargetAsmInfo::getULEB128Size(RegNum); } @@ -791,17 +791,17 @@ } else { assert(0 && "Machine move no supported yet."); } - } else if (Src.isRegister() && - Src.getRegister() == MachineLocation::VirtualFP) { - if (Dst.isRegister()) { + } else if (Src.isReg() && + Src.getReg() == MachineLocation::VirtualFP) { + if (Dst.isReg()) { ++FinalSize; - unsigned RegNum = RI->getDwarfRegNum(Dst.getRegister(), true); + unsigned RegNum = RI->getDwarfRegNum(Dst.getReg(), true); FinalSize += TargetAsmInfo::getULEB128Size(RegNum); } else { assert(0 && "Machine move no supported yet."); } } else { - unsigned Reg = RI->getDwarfRegNum(Src.getRegister(), true); + unsigned Reg = RI->getDwarfRegNum(Src.getReg(), true); int Offset = Dst.getOffset() / stackGrowth; if (Offset < 0) { From sabre at nondot.org Fri Oct 3 12:15:31 2008 From: sabre at nondot.org (Chris Lattner) Date: Fri, 3 Oct 2008 12:15:31 -0500 Subject: [llvm-commits] CVS: llvm-www/www-index.html Message-ID: <200810031715.m93HFVkH005178@zion.cs.uiuc.edu> Changes in directory llvm-www: www-index.html updated: 1.162 -> 1.163 --- Log message: remove really old paragraph which contains broken link. --- Diffs of the changes: (+0 -12) www-index.html | 12 ------------ 1 files changed, 12 deletions(-) Index: llvm-www/www-index.html diff -u llvm-www/www-index.html:1.162 llvm-www/www-index.html:1.163 --- llvm-www/www-index.html:1.162 Mon Aug 18 17:04:51 2008 +++ llvm-www/www-index.html Fri Oct 3 12:14:35 2008 @@ -64,18 +64,6 @@ course. We also have a list of ideas for projects in LLVM.

    -

    LLVM was started by the Lifelong Code -Optimization Project, led by Vikram Adve at the University of Illinois, Urbana-Champaign. Since -the first public release, LLVM has grown to include contributions from several -other people! We welcome external contributions, -so please send e-mail to -llvmdev at cs.uiuc.edu if you are -interested in contributing code to the LLVM infrastructure.

    -
    Want to learn more?
    From clattner at apple.com Fri Oct 3 12:35:51 2008 From: clattner at apple.com (Chris Lattner) Date: Fri, 3 Oct 2008 10:35:51 -0700 Subject: [llvm-commits] [llvm] r57006 - in /llvm/trunk: include/llvm/CodeGen/ lib/CodeGen/ lib/CodeGen/AsmPrinter/ lib/ExecutionEngine/JIT/ lib/Target/ARM/ lib/Target/ARM/AsmPrinter/ lib/Target/Alpha/ lib/Target/CellSPU/ lib/Target/IA64/ lib/Target/Mips/ lib/Target/PIC16/ lib/Target/PowerPC/ lib/Target/PowerPC/AsmPrinter/ lib/Target/Sparc/ lib/Target/X86/ lib/Target/X86/AsmPrinter/ In-Reply-To: <200810031545.m93Fjdq9001609@zion.cs.uiuc.edu> References: <200810031545.m93Fjdq9001609@zion.cs.uiuc.edu> Message-ID: On Oct 3, 2008, at 8:45 AM, Dan Gohman wrote: > Author: djg > Date: Fri Oct 3 10:45:36 2008 > New Revision: 57006 > > URL: http://llvm.org/viewvc/llvm-project?rev=57006&view=rev > Log: > Switch the MachineOperand accessors back to the short names like > isReg, etc., from isRegister, etc. Nice, thanks Dan! Right in time for 2.4 :) -Chris From gohman at apple.com Fri Oct 3 12:36:51 2008 From: gohman at apple.com (Dan Gohman) Date: Fri, 3 Oct 2008 10:36:51 -0700 (PDT) Subject: [llvm-commits] [llvm] r57017 - /llvm/trunk/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp In-Reply-To: <200810031711.m93HBxm9004966@zion.cs.uiuc.edu> References: <200810031711.m93HBxm9004966@zion.cs.uiuc.edu> Message-ID: <50784.76.220.41.203.1223055411.squirrel@webmail.apple.com> On Fri, October 3, 2008 10:11 am, Daniel Dunbar wrote: > Author: ddunbar > Date: Fri Oct 3 12:11:57 2008 > New Revision: 57017 > > URL: http://llvm.org/viewvc/llvm-project?rev=57017&view=rev > Log: > Unbreak build. Thanks Daniel. Sorry for the breakage. Dan From dpatel at apple.com Fri Oct 3 12:50:00 2008 From: dpatel at apple.com (Devang Patel) Date: Fri, 03 Oct 2008 17:50:00 -0000 Subject: [llvm-commits] [llvm] r57020 - in /llvm/trunk: include/llvm/Attributes.h lib/VMCore/Verifier.cpp Message-ID: <200810031750.m93Ho0Bt006503@zion.cs.uiuc.edu> Author: dpatel Date: Fri Oct 3 12:50:00 2008 New Revision: 57020 URL: http://llvm.org/viewvc/llvm-project?rev=57020&view=rev Log: Verify function attributes. Modified: llvm/trunk/include/llvm/Attributes.h 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=57020&r1=57019&r2=57020&view=diff ============================================================================== --- llvm/trunk/include/llvm/Attributes.h (original) +++ llvm/trunk/include/llvm/Attributes.h Fri Oct 3 12:50:00 2008 @@ -53,8 +53,8 @@ /// @brief Attributes that only apply to function parameters. const Attributes ParameterOnly = ByVal | Nest | StructRet; -/// @brief Attributes that only apply to function return values. -const Attributes ReturnOnly = NoReturn | NoUnwind | ReadNone | ReadOnly; +/// @brief Attributes that only apply to function. +const Attributes FunctionOnly = NoReturn | NoUnwind | ReadNone | ReadOnly; /// @brief Parameter attributes that do not apply to vararg call arguments. const Attributes VarArgsIncompatible = StructRet; Modified: llvm/trunk/lib/VMCore/Verifier.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=57020&r1=57019&r2=57020&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Verifier.cpp (original) +++ llvm/trunk/lib/VMCore/Verifier.cpp Fri Oct 3 12:50:00 2008 @@ -416,7 +416,7 @@ Assert1(!RetI, "Attribute " + Attribute::getAsString(RetI) + " does not apply to return values!", V); } else { - Attributes ParmI = Attrs & Attribute::ReturnOnly; + Attributes ParmI = Attrs & Attribute::FunctionOnly; Assert1(!ParmI, "Attribute " + Attribute::getAsString(ParmI) + " only applies to return values!", V); } @@ -477,6 +477,10 @@ } Attributes FAttrs = Attrs.getFnAttributes(); + Assert1(!(FAttrs & (!Attribute::FunctionOnly)), + "Attribute " + Attribute::getAsString(FAttrs) + + " does not apply to function!", V); + for (unsigned i = 0; i < array_lengthof(Attribute::MutuallyIncompatible); ++i) { Attributes MutI = FAttrs & Attribute::MutuallyIncompatible[i]; From gohman at apple.com Fri Oct 3 12:56:45 2008 From: gohman at apple.com (Dan Gohman) Date: Fri, 03 Oct 2008 17:56:45 -0000 Subject: [llvm-commits] [llvm] r57021 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200810031756.m93HujcC006759@zion.cs.uiuc.edu> Author: djg Date: Fri Oct 3 12:56:45 2008 New Revision: 57021 URL: http://llvm.org/viewvc/llvm-project?rev=57021&view=rev Log: Use -1ULL instead of uint64_t(-1), at Anton's suggestion. 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=57021&r1=57020&r2=57021&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Fri Oct 3 12:56:45 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 = uint64_t(-1); + uint64_t Limit = -1ULL; 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 = uint64_t(-1); + uint64_t Limit = -1ULL; if (!AlwaysInline) Limit = TLI.getMaxStoresPerMemmove(); unsigned DstAlign = Align; // Destination alignment can change. From evan.cheng at apple.com Fri Oct 3 13:05:41 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 03 Oct 2008 18:05:41 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r57022 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Message-ID: <200810031805.m93I5gFh007073@zion.cs.uiuc.edu> Author: evancheng Date: Fri Oct 3 13:05:41 2008 New Revision: 57022 URL: http://llvm.org/viewvc/llvm-project?rev=57022&view=rev Log: Fix a bug in EmitCallOf which shows up only with assertion turned on. When it's processing a call argument that corresponds to eh_value or eh_select, grab the type of special variables ExceptionValue or ExceptionSelectorValue instead or it won't match the expected type. With assertion turned off, this bug doesn't cause any miscompilation because pointer types are *compatible*. But it's a bug anyway. Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.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=57022&r1=57021&r2=57022&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Fri Oct 3 13:05:41 2008 @@ -2361,7 +2361,7 @@ // parameter for the chain. Callee = BitCastToType(Callee, PointerType::getUnqual(Ty)); - //EmitCall(exp, DestLoc); + // EmitCall(exp, DestLoc); Value *Result = EmitCallOf(Callee, exp, DestLoc, PAL); // If the function has the volatile bit set, then it is a "noreturn" function. @@ -2694,8 +2694,19 @@ } Attributes Attrs = Attribute::None; - ABIConverter.HandleArgument(TREE_TYPE(TREE_VALUE(arg)), ScalarArgs, - &Attrs); + // See EmitEXC_PTR_EXPR and EmitFILTER_EXPR. Rather than handle the + // arguments themselves, process eh_value and eh_select. + if (TREE_CODE(TREE_VALUE(arg)) == EXC_PTR_EXPR) { + const Type *Ty = ExceptionValue->getType(); + Ty = cast(Ty)->getElementType(); + Client.HandleScalarArgument(Ty, 0); + } else if (TREE_CODE(TREE_VALUE(arg)) == FILTER_EXPR) { + const Type *Ty = ExceptionSelectorValue->getType(); + Ty = cast(Ty)->getElementType(); + Client.HandleScalarArgument(Ty, 0); + } else + ABIConverter.HandleArgument(TREE_TYPE(TREE_VALUE(arg)), ScalarArgs, + &Attrs); if (Attrs != Attribute::None) PAL = PAL.addAttr(CallOperands.size(), Attrs); From evan.cheng at apple.com Fri Oct 3 13:12:59 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 03 Oct 2008 18:12:59 -0000 Subject: [llvm-commits] [llvm] r57023 - /llvm/trunk/test/FrontendObjC++/2008-10-3-EhValue.mm Message-ID: <200810031812.m93ICxxF007306@zion.cs.uiuc.edu> Author: evancheng Date: Fri Oct 3 13:12:59 2008 New Revision: 57023 URL: http://llvm.org/viewvc/llvm-project?rev=57023&view=rev Log: New test case. Added: llvm/trunk/test/FrontendObjC++/2008-10-3-EhValue.mm Added: llvm/trunk/test/FrontendObjC++/2008-10-3-EhValue.mm URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendObjC%2B%2B/2008-10-3-EhValue.mm?rev=57023&view=auto ============================================================================== --- llvm/trunk/test/FrontendObjC++/2008-10-3-EhValue.mm (added) +++ llvm/trunk/test/FrontendObjC++/2008-10-3-EhValue.mm Fri Oct 3 13:12:59 2008 @@ -0,0 +1,50 @@ +// RUN: %llvmgcc -w -x objective-c++ -c %s -o /dev/null + + at interface Object { + at public + Class isa; +} ++initialize; ++alloc; ++new; ++free; +-free; ++(Class)class; +-(Class)class; +-init; +-superclass; +-(const char *)name; + at end + + at interface Frob: Object + at end + + at implementation Frob: Object + at end + +static Frob* _connection = ((void *)0); + +extern void abort(void); + +void test (Object* sendPort) +{ + int cleanupPorts = 1; + Frob* receivePort = ((void *)0); + + @try { + receivePort = (Frob *) -1; + _connection = (Frob *) -1; + receivePort = ((void *)0); + sendPort = ((void *)0); + cleanupPorts = 0; + @throw [Object new]; + } + @catch(Frob *obj) { + if(!(0)) abort(); + } + @catch(id exc) { + if(!(!receivePort)) abort(); + if(!(!sendPort)) abort(); + if(!(!cleanupPorts)) abort(); + } +} From nunoplopes at sapo.pt Fri Oct 3 13:13:54 2008 From: nunoplopes at sapo.pt (Nuno Lopes) Date: Fri, 03 Oct 2008 18:13:54 -0000 Subject: [llvm-commits] [llvm] r57024 - in /llvm/trunk/tools/llvmc2: ./ core/ plugins/Base/ Message-ID: <200810031813.m93IDscs007348@zion.cs.uiuc.edu> Author: nlopes Date: Fri Oct 3 13:13:54 2008 New Revision: 57024 URL: http://llvm.org/viewvc/llvm-project?rev=57024&view=rev Log: update svn:ignore Modified: llvm/trunk/tools/llvmc2/ (props changed) llvm/trunk/tools/llvmc2/core/ (props changed) llvm/trunk/tools/llvmc2/plugins/Base/ (props changed) Propchange: llvm/trunk/tools/llvmc2/ ------------------------------------------------------------------------------ --- svn:ignore (original) +++ svn:ignore (removed) @@ -1,5 +0,0 @@ -Tools.inc -AutoGenerated.inc -Debug -Release -Release-Asserts Propchange: llvm/trunk/tools/llvmc2/core/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Fri Oct 3 13:13:54 2008 @@ -0,0 +1,3 @@ +Debug +Release +Release-Asserts Propchange: llvm/trunk/tools/llvmc2/plugins/Base/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Fri Oct 3 13:13:54 2008 @@ -0,0 +1,4 @@ +AutoGenerated.inc +Debug +Release +Release-Asserts From dpatel at apple.com Fri Oct 3 13:57:38 2008 From: dpatel at apple.com (Devang Patel) Date: Fri, 03 Oct 2008 18:57:38 -0000 Subject: [llvm-commits] [llvm] r57025 - in /llvm/trunk: lib/Transforms/Utils/SimplifyCFG.cpp test/Transforms/SimplifyCFG/2008-10-03-SpeculativelyExecuteBeforePHI.ll Message-ID: <200810031857.m93IvcNF009190@zion.cs.uiuc.edu> Author: dpatel Date: Fri Oct 3 13:57:37 2008 New Revision: 57025 URL: http://llvm.org/viewvc/llvm-project?rev=57025&view=rev Log: Nick Lewycky's patch. While hosting instruction check PHI node. Added: llvm/trunk/test/Transforms/SimplifyCFG/2008-10-03-SpeculativelyExecuteBeforePHI.ll Modified: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Modified: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp?rev=57025&r1=57024&r2=57025&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Fri Oct 3 13:57:37 2008 @@ -1051,7 +1051,7 @@ BasicBlock::iterator InsertPos = BI; if (InsertPos != BIParent->begin()) --InsertPos; - if (InsertPos == BrCond) { + if (InsertPos == BrCond && !isa(BrCond)) { SmallPtrSet BB1Insns; for(BasicBlock::iterator BB1I = BB1->begin(), BB1E = BB1->end(); BB1I != BB1E; ++BB1I) Added: llvm/trunk/test/Transforms/SimplifyCFG/2008-10-03-SpeculativelyExecuteBeforePHI.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SimplifyCFG/2008-10-03-SpeculativelyExecuteBeforePHI.ll?rev=57025&view=auto ============================================================================== --- llvm/trunk/test/Transforms/SimplifyCFG/2008-10-03-SpeculativelyExecuteBeforePHI.ll (added) +++ llvm/trunk/test/Transforms/SimplifyCFG/2008-10-03-SpeculativelyExecuteBeforePHI.ll Fri Oct 3 13:57:37 2008 @@ -0,0 +1,36 @@ +; RUN: llvm-as < %s | opt -simplifycfg +; PR2855 + +define i32 @_Z1fPii(i32* %b, i32 %f) nounwind { +entry: + br label %bb + +bb: ; preds = %bb9, %bb7, %bb, %entry + %__c2.2 = phi i32 [ undef, %entry ], [ %__c2.1, %bb7 ], [ %__c2.1, %bb9 ] ; [#uses=2] + %s.0 = phi i32 [ 0, %entry ], [ 0, %bb7 ], [ %2, %bb9 ] ; [#uses=1] + br label %bb1 + +bb1: ; preds = %bb + %0 = icmp slt i32 0, %f ; [#uses=1] + br i1 %0, label %bb3, label %bb6 + +bb3: ; preds = %bb1 + %1 = icmp eq i32 0, 0 ; [#uses=1] + br i1 %1, label %bb6, label %bb5 + +bb5: ; preds = %bb3 + br label %bb7 + +bb6: ; preds = %bb3, %bb1 + %__c2.0 = phi i32 [ 0, %bb3 ], [ %__c2.2, %bb1 ] ; [#uses=1] + br label %bb7 + +bb7: ; preds = %bb6, %bb5 + %__c2.1 = phi i32 [ 0, %bb5 ], [ %__c2.0, %bb6 ] ; [#uses=2] + %iftmp.1.0 = phi i1 [ false, %bb5 ], [ true, %bb6 ] ; [#uses=1] + br i1 %iftmp.1.0, label %bb, label %bb9 + +bb9: ; preds = %bb7 + %2 = add i32 %s.0, 2 ; [#uses=1] + br label %bb +} From resistor at mac.com Fri Oct 3 14:07:16 2008 From: resistor at mac.com (Owen Anderson) Date: Fri, 03 Oct 2008 12:07:16 -0700 Subject: [llvm-commits] [llvm] r57025 - in /llvm/trunk: lib/Transforms/Utils/SimplifyCFG.cpp test/Transforms/SimplifyCFG/2008-10-03-SpeculativelyExecuteBeforePHI.ll In-Reply-To: <200810031857.m93IvcNF009190@zion.cs.uiuc.edu> References: <200810031857.m93IvcNF009190@zion.cs.uiuc.edu> Message-ID: <13A76A7C-A8D3-445D-B55F-83B40365B7A4@mac.com> On Oct 3, 2008, at 11:57 AM, Devang Patel wrote: > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp (original) > +++ llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Fri Oct 3 > 13:57:37 2008 > @@ -1051,7 +1051,7 @@ > BasicBlock::iterator InsertPos = BI; > if (InsertPos != BIParent->begin()) > --InsertPos; > - if (InsertPos == BrCond) { > + if (InsertPos == BrCond && !isa(BrCond)) { > SmallPtrSet BB1Insns; > for(BasicBlock::iterator BB1I = BB1->begin(), BB1E = BB1->end(); > BB1I != BB1E; ++BB1I) I'm not sure this is the right fix. It handles this specific case, but I'm not sure it works in general. I think what you want is something more like: BasicBlock::iterator InsertPos = BI; if (&*InsertPos != BIParent->getFirstNonPHI()) --InsertPos; if (InsertPos == BrCond) ... I think that will be more resilient to other situations. --Owen -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2624 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20081003/0f664cd8/attachment.bin From resistor at mac.com Fri Oct 3 14:08:20 2008 From: resistor at mac.com (Owen Anderson) Date: Fri, 03 Oct 2008 12:08:20 -0700 Subject: [llvm-commits] [llvm] r57025 - in /llvm/trunk: lib/Transforms/Utils/SimplifyCFG.cpp test/Transforms/SimplifyCFG/2008-10-03-SpeculativelyExecuteBeforePHI.ll In-Reply-To: <200810031857.m93IvcNF009190@zion.cs.uiuc.edu> References: <200810031857.m93IvcNF009190@zion.cs.uiuc.edu> Message-ID: <8CEE5ED4-66E0-41BD-B3C1-F287B859DE9B@mac.com> On Oct 3, 2008, at 11:57 AM, Devang Patel wrote: > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp (original) > +++ llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Fri Oct 3 > 13:57:37 2008 > @@ -1051,7 +1051,7 @@ > BasicBlock::iterator InsertPos = BI; > if (InsertPos != BIParent->begin()) > --InsertPos; > - if (InsertPos == BrCond) { > + if (InsertPos == BrCond && !isa(BrCond)) { > SmallPtrSet BB1Insns; > for(BasicBlock::iterator BB1I = BB1->begin(), BB1E = BB1->end(); > BB1I != BB1E; ++BB1I) I'm not sure this is the right fix. It handles this specific case, but I'm not sure it works in general. I think what you want is something more like: BasicBlock::iterator InsertPos = BI; if (&*InsertPos != BIParent->getFirstNonPHI()) --InsertPos; if (InsertPos == BrCond) ... I -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2624 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20081003/c8aa04e9/attachment.bin From daniel at zuster.org Fri Oct 3 14:11:21 2008 From: daniel at zuster.org (Daniel Dunbar) Date: Fri, 03 Oct 2008 19:11:21 -0000 Subject: [llvm-commits] [llvm] r57026 - /llvm/trunk/Makefile.rules Message-ID: <200810031911.m93JBMmw009900@zion.cs.uiuc.edu> Author: ddunbar Date: Fri Oct 3 14:11:19 2008 New Revision: 57026 URL: http://llvm.org/viewvc/llvm-project?rev=57026&view=rev Log: Add IS_CLEANING_TARGET Makefile variable. - Fixes bug in dependency inclusions where make with unspecified target wouldn't include dependency files, eek! Modified: llvm/trunk/Makefile.rules Modified: llvm/trunk/Makefile.rules URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/Makefile.rules?rev=57026&r1=57025&r2=57026&view=diff ============================================================================== --- llvm/trunk/Makefile.rules (original) +++ llvm/trunk/Makefile.rules Fri Oct 3 14:11:19 2008 @@ -195,6 +195,11 @@ # VARIABLES: Set up various variables based on configuration data ############################################################################### +# Variable for if this make is for a "cleaning" target +ifneq ($(strip $(filter clean clean-local dist-clean,$(MAKECMDGOALS))),) + IS_CLEANING_TARGET=1 +endif + #-------------------------------------------------------------------- # Variables derived from configuration we are building #-------------------------------------------------------------------- @@ -739,7 +744,7 @@ LLVMLibsPaths := $(addprefix $(LLVMLibDir)/,$(LLVMUsedLibs)) endif -ifeq ($(strip $(filter clean clean-local dist-clean,$(MAKECMDGOALS))),) +ifndef IS_CLEANING_TARGET ifdef LINK_COMPONENTS # If LLVM_CONFIG doesn't exist, build it. This can happen if you do a make @@ -1507,7 +1512,7 @@ ifndef DISABLE_AUTO_DEPENDENCIES # If its not one of the cleaning targets -ifneq ($(strip $(filter-out clean clean-local dist-clean,$(MAKECMDGOALS))),) +ifndef IS_CLEANING_TARGET # Get the list of dependency files DependFiles := $(basename $(filter %.cpp %.c %.cc, $(Sources))) From dalej at apple.com Fri Oct 3 14:41:08 2008 From: dalej at apple.com (Dale Johannesen) Date: Fri, 03 Oct 2008 19:41:08 -0000 Subject: [llvm-commits] [llvm] r57027 - in /llvm/trunk/lib: CodeGen/SelectionDAG/LegalizeDAG.cpp Target/X86/X86ISelDAGToDAG.cpp Target/X86/X86ISelLowering.cpp Target/X86/X86InstrInfo.td Message-ID: <200810031941.m93Jf9V9011120@zion.cs.uiuc.edu> Author: johannes Date: Fri Oct 3 14:41:08 2008 New Revision: 57027 URL: http://llvm.org/viewvc/llvm-project?rev=57027&view=rev Log: Pass MemOperand through for 64-bit atomics on 32-bit, incidentally making the case where the memop is a pointer deref work. Fix cmp-and-swap regression. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/Target/X86/X86InstrInfo.td Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=57027&r1=57026&r2=57027&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Fri Oct 3 14:41:08 2008 @@ -6212,20 +6212,33 @@ break; } + case ISD::ATOMIC_CMP_SWAP_64: { + // This operation does not need a loop. + SDValue Tmp = TLI.LowerOperation(Op, DAG); + assert(Tmp.getNode() && "Node must be custom expanded!"); + ExpandOp(Tmp.getValue(0), Lo, Hi); + AddLegalizedOperand(SDValue(Node, 1), // Remember we legalized the chain. + LegalizeOp(Tmp.getValue(1))); + break; + } + case ISD::ATOMIC_LOAD_ADD_64: case ISD::ATOMIC_LOAD_SUB_64: case ISD::ATOMIC_LOAD_AND_64: case ISD::ATOMIC_LOAD_OR_64: case ISD::ATOMIC_LOAD_XOR_64: case ISD::ATOMIC_LOAD_NAND_64: - case ISD::ATOMIC_SWAP_64: - case ISD::ATOMIC_CMP_SWAP_64: { + case ISD::ATOMIC_SWAP_64: { + // These operations require a loop to be generated. We can't do that yet, + // so substitute a target-dependent pseudo and expand that later. SDValue In2Lo, In2Hi, In2; ExpandOp(Op.getOperand(2), In2Lo, In2Hi); In2 = DAG.getNode(ISD::BUILD_PAIR, VT, In2Lo, In2Hi); - SDValue Result = TLI.LowerOperation( - DAG.getNode(Op.getOpcode(), VT, Op.getOperand(0), Op.getOperand(1), In2), - DAG); + AtomicSDNode* Anode = cast(Node); + SDValue Replace = + DAG.getAtomic(Op.getOpcode(), Op.getOperand(0), Op.getOperand(1), In2, + Anode->getSrcValue(), Anode->getAlignment()); + SDValue Result = TLI.LowerOperation(Replace, DAG); ExpandOp(Result.getValue(0), Lo, Hi); // Remember that we legalized the chain. AddLegalizedOperand(SDValue(Node,1), LegalizeOp(Result.getValue(1))); Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=57027&r1=57026&r2=57027&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Fri Oct 3 14:41:08 2008 @@ -1209,14 +1209,15 @@ SDValue Tmp0, Tmp1, Tmp2, Tmp3; if (!SelectAddr(In1, In1, Tmp0, Tmp1, Tmp2, Tmp3)) return NULL; + SDValue LSI = Node->getOperand(4); // MemOperand AddToISelQueue(Tmp0); AddToISelQueue(Tmp1); AddToISelQueue(Tmp2); AddToISelQueue(Tmp3); AddToISelQueue(In2L); AddToISelQueue(In2H); + // For now, don't select the MemOperand object, we don't know how. AddToISelQueue(Chain); - SDValue LSI = CurDAG->getMemOperand(cast(In1)->getMemOperand()); const SDValue Ops[] = { Tmp0, Tmp1, Tmp2, Tmp3, In2L, In2H, LSI, Chain }; return CurDAG->getTargetNode(Opc, MVT::i32, MVT::i32, MVT::Other, Ops, 8); } Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=57027&r1=57026&r2=57027&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Fri Oct 3 14:41:08 2008 @@ -6026,9 +6026,12 @@ assert(Node->getOperand(2).getNode()->getOpcode()==ISD::BUILD_PAIR); SDValue In2L = Node->getOperand(2).getNode()->getOperand(0); SDValue In2H = Node->getOperand(2).getNode()->getOperand(1); - SDValue Ops[] = { Chain, In1, In2L, In2H }; + // This is a generalized SDNode, not an AtomicSDNode, so it doesn't + // have a MemOperand. Pass the info through as a normal operand. + SDValue LSI = DAG.getMemOperand(cast(Node)->getMemOperand()); + SDValue Ops[] = { Chain, In1, In2L, In2H, LSI }; SDVTList Tys = DAG.getVTList(MVT::i32, MVT::i32, MVT::Other); - SDValue Result = DAG.getNode(NewOp, Tys, Ops, 4); + SDValue Result = DAG.getNode(NewOp, Tys, Ops, 5); SDValue OpsF[] = { Result.getValue(0), Result.getValue(1)}; SDValue ResultVal = DAG.getNode(ISD::BUILD_PAIR, MVT::i64, OpsF, 2); SDValue Vals[2] = { ResultVal, Result.getValue(2) }; @@ -6415,7 +6418,7 @@ return nextMBB; } -// private utility function +// private utility function: 64 bit atomics on 32 bit host. MachineBasicBlock * X86TargetLowering::EmitAtomicBit6432WithCustomInserter(MachineInstr *bInstr, MachineBasicBlock *MBB, Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=57027&r1=57026&r2=57027&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Fri Oct 3 14:41:08 2008 @@ -2752,6 +2752,7 @@ let Constraints = "$val1 = $dst1, $val2 = $dst2", Defs = [EFLAGS, EAX, EBX, ECX, EDX], Uses = [EAX, EBX, ECX, EDX], + mayLoad = 1, mayStore = 1, usesCustomDAGSchedInserter = 1 in { def ATOMAND6432 : I<0, Pseudo, (outs GR32:$dst1, GR32:$dst2), (ins i64mem:$ptr, GR32:$val1, GR32:$val2), From baldrick at free.fr Fri Oct 3 14:44:16 2008 From: baldrick at free.fr (Duncan Sands) Date: Fri, 3 Oct 2008 21:44:16 +0200 Subject: [llvm-commits] [llvm] r57020 - in /llvm/trunk: include/llvm/Attributes.h lib/VMCore/Verifier.cpp In-Reply-To: <200810031750.m93Ho0Bt006503@zion.cs.uiuc.edu> References: <200810031750.m93Ho0Bt006503@zion.cs.uiuc.edu> Message-ID: <200810032144.16897.baldrick@free.fr> Hi Devang, > } else { > - Attributes ParmI = Attrs & Attribute::ReturnOnly; > + Attributes ParmI = Attrs & Attribute::FunctionOnly; > Assert1(!ParmI, "Attribute " + Attribute::getAsString(ParmI) + > " only applies to return values!", V); this test should always be made, i.e. removed from the else part and always executed. That's because it should now also be applied to return values. > + Assert1(!(FAttrs & (!Attribute::FunctionOnly)), Shouldn't that be !(FAttrs & (~Attribute::FunctionOnly)) ? Ciao, Duncan. From baldrick at free.fr Fri Oct 3 14:51:15 2008 From: baldrick at free.fr (Duncan Sands) Date: Fri, 3 Oct 2008 21:51:15 +0200 Subject: [llvm-commits] [llvm-gcc-4.2] r57022 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: <200810031805.m93I5gFh007073@zion.cs.uiuc.edu> References: <200810031805.m93I5gFh007073@zion.cs.uiuc.edu> Message-ID: <200810032151.16551.baldrick@free.fr> Hi Evan, > Fix a bug in EmitCallOf which shows up only with assertion turned on. > When it's processing a call argument that corresponds to eh_value or > eh_select, grab the type of special variables ExceptionValue or > ExceptionSelectorValue instead or it won't match the expected type. can you please explain. It sounds like TREE_TYPE(TREE_VALUE(arg)) does not contain the correct type for TREE_VALUE(arg). If so, isn't that the bug? Thanks, Duncan. From dpatel at apple.com Fri Oct 3 15:20:57 2008 From: dpatel at apple.com (Devang Patel) Date: Fri, 3 Oct 2008 13:20:57 -0700 Subject: [llvm-commits] [llvm] r57020 - in /llvm/trunk: include/llvm/Attributes.h lib/VMCore/Verifier.cpp In-Reply-To: <200810032144.16897.baldrick@free.fr> References: <200810031750.m93Ho0Bt006503@zion.cs.uiuc.edu> <200810032144.16897.baldrick@free.fr> Message-ID: <39728889-FD56-4F84-A248-FD846CA229B8@apple.com> On Oct 3, 2008, at 12:44 PM, Duncan Sands wrote: >> + Assert1(!(FAttrs & (!Attribute::FunctionOnly)), > > Shouldn't that be !(FAttrs & (~Attribute::FunctionOnly)) ? yes. thx! - Devang From evan.cheng at apple.com Fri Oct 3 15:37:51 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 3 Oct 2008 13:37:51 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r57022 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: <200810032151.16551.baldrick@free.fr> References: <200810031805.m93I5gFh007073@zion.cs.uiuc.edu> <200810032151.16551.baldrick@free.fr> Message-ID: <9CBF9F7C-3E4C-4AE7-8719-861BB046B028@apple.com> /// EmitEXC_PTR_EXPR - Handle EXC_PTR_EXPR. Value *TreeToLLVM::EmitEXC_PTR_EXPR(tree exp) { CreateExceptionValues(); // Load exception address. return Builder.CreateLoad(ExceptionValue, "eh_value"); } So, if the node is a EXEC_PTR_EXPR it's processing this special Value ExceptionValue. Therefore, we should pick up the type of ExceptionValue rather than type of arg. This feels like a hack. But I don't enough to do anything about that. Evan On Oct 3, 2008, at 12:51 PM, Duncan Sands wrote: > Hi Evan, > >> Fix a bug in EmitCallOf which shows up only with assertion turned on. >> When it's processing a call argument that corresponds to eh_value or >> eh_select, grab the type of special variables ExceptionValue or >> ExceptionSelectorValue instead or it won't match the expected type. > > can you please explain. It sounds like TREE_TYPE(TREE_VALUE(arg)) > does > not contain the correct type for TREE_VALUE(arg). If so, isn't that > the > bug? > > Thanks, > > Duncan. From daniel at zuster.org Fri Oct 3 15:41:15 2008 From: daniel at zuster.org (Daniel Dunbar) Date: Fri, 3 Oct 2008 13:41:15 -0700 Subject: [llvm-commits] [llvm] r57000 - in /llvm/trunk/tools/llvmc2: Makefile core/ core/Action.cpp core/CompilationGraph.cpp core/Error.h core/Makefile core/Plugin.cpp core/llvmc.cpp src/Action.cpp src/CompilationGraph.cpp src/Error.h src/Makefile src/Pl Message-ID: <6a8523d60810031341h3bd751c5j4bb0bfe579cca349@mail.gmail.com> "core" probably isn't a very good name, the makefiles try to remove "core" by default -- ddunbar at ddunbar2:llvm$ make clean rm: core: is a directory make[2]: [clean-local] Error 1 (ignored) -- What about just "lib"? - Daniel On Fri, Oct 3, 2008 at 3:27 AM, Mikhail Glushenkov wrote: > Author: foldr > Date: Fri Oct 3 05:27:23 2008 > New Revision: 57000 > > URL: http://llvm.org/viewvc/llvm-project?rev=57000&view=rev > Log: > Rename llvmc2/src to llvmc2/core. > > Added: > llvm/trunk/tools/llvmc2/core/ > llvm/trunk/tools/llvmc2/core/Action.cpp > - copied, changed from r56999, llvm/trunk/tools/llvmc2/src/Action.cpp > llvm/trunk/tools/llvmc2/core/CompilationGraph.cpp > - copied, changed from r56999, llvm/trunk/tools/llvmc2/src/CompilationGraph.cpp > llvm/trunk/tools/llvmc2/core/Error.h > - copied, changed from r56999, llvm/trunk/tools/llvmc2/src/Error.h > llvm/trunk/tools/llvmc2/core/Makefile > - copied, changed from r56999, llvm/trunk/tools/llvmc2/src/Makefile > llvm/trunk/tools/llvmc2/core/Plugin.cpp > - copied, changed from r56999, llvm/trunk/tools/llvmc2/src/Plugin.cpp > llvm/trunk/tools/llvmc2/core/llvmc.cpp > - copied, changed from r56999, llvm/trunk/tools/llvmc2/src/llvmc.cpp > Removed: > llvm/trunk/tools/llvmc2/src/Action.cpp > llvm/trunk/tools/llvmc2/src/CompilationGraph.cpp > llvm/trunk/tools/llvmc2/src/Error.h > llvm/trunk/tools/llvmc2/src/Makefile > llvm/trunk/tools/llvmc2/src/Plugin.cpp > llvm/trunk/tools/llvmc2/src/llvmc.cpp > Modified: > llvm/trunk/tools/llvmc2/Makefile > > Modified: llvm/trunk/tools/llvmc2/Makefile > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/Makefile?rev=57000&r1=56999&r2=57000&view=diff > > ============================================================================== > --- llvm/trunk/tools/llvmc2/Makefile (original) > +++ llvm/trunk/tools/llvmc2/Makefile Fri Oct 3 05:27:23 2008 > @@ -11,7 +11,7 @@ > > BUILTIN_PLUGINS = Base > DRIVER_NAME = llvmc2 > -DIRS = plugins src > +DIRS = plugins core > > export BUILTIN_PLUGINS > export DRIVER_NAME > > Copied: llvm/trunk/tools/llvmc2/core/Action.cpp (from r56999, llvm/trunk/tools/llvmc2/src/Action.cpp) > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/core/Action.cpp?p2=llvm/trunk/tools/llvmc2/core/Action.cpp&p1=llvm/trunk/tools/llvmc2/src/Action.cpp&r1=56999&r2=57000&rev=57000&view=diff > > ============================================================================== > (empty) > > Copied: llvm/trunk/tools/llvmc2/core/CompilationGraph.cpp (from r56999, llvm/trunk/tools/llvmc2/src/CompilationGraph.cpp) > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/core/CompilationGraph.cpp?p2=llvm/trunk/tools/llvmc2/core/CompilationGraph.cpp&p1=llvm/trunk/tools/llvmc2/src/CompilationGraph.cpp&r1=56999&r2=57000&rev=57000&view=diff > > ============================================================================== > (empty) > > Copied: llvm/trunk/tools/llvmc2/core/Error.h (from r56999, llvm/trunk/tools/llvmc2/src/Error.h) > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/core/Error.h?p2=llvm/trunk/tools/llvmc2/core/Error.h&p1=llvm/trunk/tools/llvmc2/src/Error.h&r1=56999&r2=57000&rev=57000&view=diff > > ============================================================================== > (empty) > > Copied: llvm/trunk/tools/llvmc2/core/Makefile (from r56999, llvm/trunk/tools/llvmc2/src/Makefile) > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/core/Makefile?p2=llvm/trunk/tools/llvmc2/core/Makefile&p1=llvm/trunk/tools/llvmc2/src/Makefile&r1=56999&r2=57000&rev=57000&view=diff > > ============================================================================== > (empty) > > Copied: llvm/trunk/tools/llvmc2/core/Plugin.cpp (from r56999, llvm/trunk/tools/llvmc2/src/Plugin.cpp) > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/core/Plugin.cpp?p2=llvm/trunk/tools/llvmc2/core/Plugin.cpp&p1=llvm/trunk/tools/llvmc2/src/Plugin.cpp&r1=56999&r2=57000&rev=57000&view=diff > > ============================================================================== > (empty) > > Copied: llvm/trunk/tools/llvmc2/core/llvmc.cpp (from r56999, llvm/trunk/tools/llvmc2/src/llvmc.cpp) > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/core/llvmc.cpp?p2=llvm/trunk/tools/llvmc2/core/llvmc.cpp&p1=llvm/trunk/tools/llvmc2/src/llvmc.cpp&r1=56999&r2=57000&rev=57000&view=diff > > ============================================================================== > (empty) > > Removed: llvm/trunk/tools/llvmc2/src/Action.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/src/Action.cpp?rev=56999&view=auto > > ============================================================================== > --- llvm/trunk/tools/llvmc2/src/Action.cpp (original) > +++ llvm/trunk/tools/llvmc2/src/Action.cpp (removed) > @@ -1,78 +0,0 @@ > -//===--- Action.cpp - The LLVM Compiler Driver ------------------*- C++ -*-===// > -// > -// The LLVM Compiler Infrastructure > -// > -// This file is distributed under the University of Illinois Open > -// Source License. See LICENSE.TXT for details. > -// > -//===----------------------------------------------------------------------===// > -// > -// Action class - implementation and auxiliary functions. > -// > -//===----------------------------------------------------------------------===// > - > -#include "llvm/CompilerDriver/Action.h" > - > -#include "llvm/Support/CommandLine.h" > -#include "llvm/System/Program.h" > - > -#include > -#include > - > -using namespace llvm; > -using namespace llvmc; > - > -extern cl::opt DryRun; > -extern cl::opt VerboseMode; > - > -namespace { > - int ExecuteProgram(const std::string& name, > - const StrVector& args) { > - sys::Path prog = sys::Program::FindProgramByName(name); > - > - if (prog.isEmpty()) > - throw std::runtime_error("Can't find program '" + name + "'"); > - if (!prog.canExecute()) > - throw std::runtime_error("Program '" + name + "' is not executable."); > - > - // Build the command line vector and the redirects array. > - const sys::Path* redirects[3] = {0,0,0}; > - sys::Path stdout_redirect; > - > - std::vector argv; > - argv.reserve((args.size()+2)); > - argv.push_back(name.c_str()); > - > - for (StrVector::const_iterator B = args.begin(), E = args.end(); > - B!=E; ++B) { > - if (*B == ">") { > - ++B; > - stdout_redirect.set(*B); > - redirects[1] = &stdout_redirect; > - } > - else { > - argv.push_back((*B).c_str()); > - } > - } > - argv.push_back(0); // null terminate list. > - > - // Invoke the program. > - return sys::Program::ExecuteAndWait(prog, &argv[0], 0, &redirects[0]); > - } > - > - void print_string (const std::string& str) { > - std::cerr << str << ' '; > - } > -} > - > -int llvmc::Action::Execute() const { > - if (DryRun || VerboseMode) { > - std::cerr << Command_ << " "; > - std::for_each(Args_.begin(), Args_.end(), print_string); > - std::cerr << '\n'; > - } > - if (DryRun) > - return 0; > - else > - return ExecuteProgram(Command_, Args_); > -} > > Removed: llvm/trunk/tools/llvmc2/src/CompilationGraph.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/src/CompilationGraph.cpp?rev=56999&view=auto > > ============================================================================== > --- llvm/trunk/tools/llvmc2/src/CompilationGraph.cpp (original) > +++ llvm/trunk/tools/llvmc2/src/CompilationGraph.cpp (removed) > @@ -1,442 +0,0 @@ > -//===--- CompilationGraph.cpp - The LLVM Compiler Driver --------*- C++ -*-===// > -// > -// The LLVM Compiler Infrastructure > -// > -// This file is distributed under the University of Illinois Open > -// Source License. See LICENSE.TXT for details. > -// > -//===----------------------------------------------------------------------===// > -// > -// Compilation graph - implementation. > -// > -//===----------------------------------------------------------------------===// > - > -#include "Error.h" > -#include "llvm/CompilerDriver/CompilationGraph.h" > - > -#include "llvm/ADT/STLExtras.h" > -#include "llvm/Support/CommandLine.h" > -#include "llvm/Support/DOTGraphTraits.h" > -#include "llvm/Support/GraphWriter.h" > - > -#include > -#include > -#include > -#include > -#include > - > -using namespace llvm; > -using namespace llvmc; > - > -extern cl::list InputFilenames; > -extern cl::opt OutputFilename; > -extern cl::list Languages; > - > -namespace llvmc { > - > - const std::string& LanguageMap::GetLanguage(const sys::Path& File) const { > - LanguageMap::const_iterator Lang = this->find(File.getSuffix()); > - if (Lang == this->end()) > - throw std::runtime_error("Unknown suffix: " + File.getSuffix()); > - return Lang->second; > - } > -} > - > -namespace { > - > - /// ChooseEdge - Return the edge with the maximum weight. > - template > - const Edge* ChooseEdge(const C& EdgesContainer, > - const InputLanguagesSet& InLangs, > - const std::string& NodeName = "root") { > - const Edge* MaxEdge = 0; > - unsigned MaxWeight = 0; > - bool SingleMax = true; > - > - for (typename C::const_iterator B = EdgesContainer.begin(), > - E = EdgesContainer.end(); B != E; ++B) { > - const Edge* e = B->getPtr(); > - unsigned EW = e->Weight(InLangs); > - if (EW > MaxWeight) { > - MaxEdge = e; > - MaxWeight = EW; > - SingleMax = true; > - } else if (EW == MaxWeight) { > - SingleMax = false; > - } > - } > - > - if (!SingleMax) > - throw std::runtime_error("Node " + NodeName + > - ": multiple maximal outward edges found!" > - " Most probably a specification error."); > - if (!MaxEdge) > - throw std::runtime_error("Node " + NodeName + > - ": no maximal outward edge found!" > - " Most probably a specification error."); > - return MaxEdge; > - } > - > -} > - > -CompilationGraph::CompilationGraph() { > - NodesMap["root"] = Node(this); > -} > - > -Node& CompilationGraph::getNode(const std::string& ToolName) { > - nodes_map_type::iterator I = NodesMap.find(ToolName); > - if (I == NodesMap.end()) > - throw std::runtime_error("Node " + ToolName + " is not in the graph"); > - return I->second; > -} > - > -const Node& CompilationGraph::getNode(const std::string& ToolName) const { > - nodes_map_type::const_iterator I = NodesMap.find(ToolName); > - if (I == NodesMap.end()) > - throw std::runtime_error("Node " + ToolName + " is not in the graph!"); > - return I->second; > -} > - > -// Find the tools list corresponding to the given language name. > -const CompilationGraph::tools_vector_type& > -CompilationGraph::getToolsVector(const std::string& LangName) const > -{ > - tools_map_type::const_iterator I = ToolsMap.find(LangName); > - if (I == ToolsMap.end()) > - throw std::runtime_error("No tool corresponding to the language " > - + LangName + " found"); > - return I->second; > -} > - > -void CompilationGraph::insertNode(Tool* V) { > - if (NodesMap.count(V->Name()) == 0) { > - Node N; > - N.OwningGraph = this; > - N.ToolPtr = V; > - NodesMap[V->Name()] = N; > - } > -} > - > -void CompilationGraph::insertEdge(const std::string& A, Edge* Edg) { > - Node& B = getNode(Edg->ToolName()); > - if (A == "root") { > - const char** InLangs = B.ToolPtr->InputLanguages(); > - for (;*InLangs; ++InLangs) > - ToolsMap[*InLangs].push_back(IntrusiveRefCntPtr(Edg)); > - NodesMap["root"].AddEdge(Edg); > - } > - else { > - Node& N = getNode(A); > - N.AddEdge(Edg); > - } > - // Increase the inward edge counter. > - B.IncrInEdges(); > -} > - > -namespace { > - sys::Path MakeTempFile(const sys::Path& TempDir, const std::string& BaseName, > - const std::string& Suffix) { > - sys::Path Out; > - > - // Make sure we don't end up with path names like '/file.o' if the > - // TempDir is empty. > - if (TempDir.empty()) { > - Out.set(BaseName); > - } > - else { > - Out = TempDir; > - Out.appendComponent(BaseName); > - } > - Out.appendSuffix(Suffix); > - // NOTE: makeUnique always *creates* a unique temporary file, > - // which is good, since there will be no races. However, some > - // tools do not like it when the output file already exists, so > - // they have to be placated with -f or something like that. > - Out.makeUnique(true, NULL); > - return Out; > - } > -} > - > -// Pass input file through the chain until we bump into a Join node or > -// a node that says that it is the last. > -void CompilationGraph::PassThroughGraph (const sys::Path& InFile, > - const Node* StartNode, > - const InputLanguagesSet& InLangs, > - const sys::Path& TempDir, > - const LanguageMap& LangMap) const { > - bool Last = false; > - sys::Path In = InFile; > - const Node* CurNode = StartNode; > - > - while(!Last) { > - sys::Path Out; > - Tool* CurTool = CurNode->ToolPtr.getPtr(); > - > - if (CurTool->IsJoin()) { > - JoinTool& JT = dynamic_cast(*CurTool); > - JT.AddToJoinList(In); > - break; > - } > - > - // Since toolchains do not have to end with a Join node, we should > - // check if this Node is the last. > - if (!CurNode->HasChildren() || CurTool->IsLast()) { > - if (!OutputFilename.empty()) { > - Out.set(OutputFilename); > - } > - else { > - Out.set(In.getBasename()); > - Out.appendSuffix(CurTool->OutputSuffix()); > - } > - Last = true; > - } > - else { > - Out = MakeTempFile(TempDir, In.getBasename(), CurTool->OutputSuffix()); > - } > - > - if (int ret = CurTool->GenerateAction(In, Out, InLangs, LangMap).Execute()) > - throw error_code(ret); > - > - if (Last) > - return; > - > - CurNode = &getNode(ChooseEdge(CurNode->OutEdges, > - InLangs, > - CurNode->Name())->ToolName()); > - In = Out; Out.clear(); > - } > -} > - > -// Find the head of the toolchain corresponding to the given file. > -// Also, insert an input language into InLangs. > -const Node* CompilationGraph:: > -FindToolChain(const sys::Path& In, const std::string* ForceLanguage, > - InputLanguagesSet& InLangs, const LanguageMap& LangMap) const { > - > - // Determine the input language. > - const std::string& InLanguage = > - ForceLanguage ? *ForceLanguage : LangMap.GetLanguage(In); > - > - // Add the current input language to the input language set. > - InLangs.insert(InLanguage); > - > - // Find the toolchain for the input language. > - const tools_vector_type& TV = getToolsVector(InLanguage); > - if (TV.empty()) > - throw std::runtime_error("No toolchain corresponding to language " > - + InLanguage + " found"); > - return &getNode(ChooseEdge(TV, InLangs)->ToolName()); > -} > - > -// Helper function used by Build(). > -// Traverses initial portions of the toolchains (up to the first Join node). > -// This function is also responsible for handling the -x option. > -void CompilationGraph::BuildInitial (InputLanguagesSet& InLangs, > - const sys::Path& TempDir, > - const LanguageMap& LangMap) { > - // This is related to -x option handling. > - cl::list::const_iterator xIter = Languages.begin(), > - xBegin = xIter, xEnd = Languages.end(); > - bool xEmpty = true; > - const std::string* xLanguage = 0; > - unsigned xPos = 0, xPosNext = 0, filePos = 0; > - > - if (xIter != xEnd) { > - xEmpty = false; > - xPos = Languages.getPosition(xIter - xBegin); > - cl::list::const_iterator xNext = llvm::next(xIter); > - xPosNext = (xNext == xEnd) ? std::numeric_limits::max() > - : Languages.getPosition(xNext - xBegin); > - xLanguage = (*xIter == "none") ? 0 : &(*xIter); > - } > - > - // For each input file: > - for (cl::list::const_iterator B = InputFilenames.begin(), > - CB = B, E = InputFilenames.end(); B != E; ++B) { > - sys::Path In = sys::Path(*B); > - > - // Code for handling the -x option. > - // Output: std::string* xLanguage (can be NULL). > - if (!xEmpty) { > - filePos = InputFilenames.getPosition(B - CB); > - > - if (xPos < filePos) { > - if (filePos < xPosNext) { > - xLanguage = (*xIter == "none") ? 0 : &(*xIter); > - } > - else { // filePos >= xPosNext > - // Skip xIters while filePos > xPosNext > - while (filePos > xPosNext) { > - ++xIter; > - xPos = xPosNext; > - > - cl::list::const_iterator xNext = llvm::next(xIter); > - if (xNext == xEnd) > - xPosNext = std::numeric_limits::max(); > - else > - xPosNext = Languages.getPosition(xNext - xBegin); > - xLanguage = (*xIter == "none") ? 0 : &(*xIter); > - } > - } > - } > - } > - > - // Find the toolchain corresponding to this file. > - const Node* N = FindToolChain(In, xLanguage, InLangs, LangMap); > - // Pass file through the chain starting at head. > - PassThroughGraph(In, N, InLangs, TempDir, LangMap); > - } > -} > - > -// Sort the nodes in topological order. > -void CompilationGraph::TopologicalSort(std::vector& Out) { > - std::queue Q; > - Q.push(&getNode("root")); > - > - while (!Q.empty()) { > - const Node* A = Q.front(); > - Q.pop(); > - Out.push_back(A); > - for (Node::const_iterator EB = A->EdgesBegin(), EE = A->EdgesEnd(); > - EB != EE; ++EB) { > - Node* B = &getNode((*EB)->ToolName()); > - B->DecrInEdges(); > - if (B->HasNoInEdges()) > - Q.push(B); > - } > - } > -} > - > -namespace { > - bool NotJoinNode(const Node* N) { > - return N->ToolPtr ? !N->ToolPtr->IsJoin() : true; > - } > -} > - > -// Call TopologicalSort and filter the resulting list to include > -// only Join nodes. > -void CompilationGraph:: > -TopologicalSortFilterJoinNodes(std::vector& Out) { > - std::vector TopSorted; > - TopologicalSort(TopSorted); > - std::remove_copy_if(TopSorted.begin(), TopSorted.end(), > - std::back_inserter(Out), NotJoinNode); > -} > - > -int CompilationGraph::Build (const sys::Path& TempDir, > - const LanguageMap& LangMap) { > - > - InputLanguagesSet InLangs; > - > - // Traverse initial parts of the toolchains and fill in InLangs. > - BuildInitial(InLangs, TempDir, LangMap); > - > - std::vector JTV; > - TopologicalSortFilterJoinNodes(JTV); > - > - // For all join nodes in topological order: > - for (std::vector::iterator B = JTV.begin(), E = JTV.end(); > - B != E; ++B) { > - > - sys::Path Out; > - const Node* CurNode = *B; > - JoinTool* JT = &dynamic_cast(*CurNode->ToolPtr.getPtr()); > - bool IsLast = false; > - > - // Are there any files in the join list? > - if (JT->JoinListEmpty()) > - continue; > - > - // Is this the last tool in the toolchain? > - // NOTE: we can process several toolchains in parallel. > - if (!CurNode->HasChildren() || JT->IsLast()) { > - if (OutputFilename.empty()) { > - Out.set("a"); > - Out.appendSuffix(JT->OutputSuffix()); > - } > - else > - Out.set(OutputFilename); > - IsLast = true; > - } > - else { > - Out = MakeTempFile(TempDir, "tmp", JT->OutputSuffix()); > - } > - > - if (int ret = JT->GenerateAction(Out, InLangs, LangMap).Execute()) > - throw error_code(ret); > - > - if (!IsLast) { > - const Node* NextNode = > - &getNode(ChooseEdge(CurNode->OutEdges, InLangs, > - CurNode->Name())->ToolName()); > - PassThroughGraph(Out, NextNode, InLangs, TempDir, LangMap); > - } > - } > - > - return 0; > -} > - > -// Code related to graph visualization. > - > -namespace llvm { > - template <> > - struct DOTGraphTraits > - : public DefaultDOTGraphTraits > - { > - > - template > - static std::string getNodeLabel(const Node* N, const GraphType&) > - { > - if (N->ToolPtr) > - if (N->ToolPtr->IsJoin()) > - return N->Name() + "\n (join" + > - (N->HasChildren() ? ")" > - : std::string(": ") + N->ToolPtr->OutputLanguage() + ')'); > - else > - return N->Name(); > - else > - return "root"; > - } > - > - template > - static std::string getEdgeSourceLabel(const Node* N, EdgeIter I) { > - if (N->ToolPtr) { > - return N->ToolPtr->OutputLanguage(); > - } > - else { > - const char** InLangs = I->ToolPtr->InputLanguages(); > - std::string ret; > - > - for (; *InLangs; ++InLangs) { > - if (*(InLangs + 1)) { > - ret += *InLangs; > - ret += ", "; > - } > - else { > - ret += *InLangs; > - } > - } > - > - return ret; > - } > - } > - }; > - > -} > - > -void CompilationGraph::writeGraph() { > - std::ofstream O("compilation-graph.dot"); > - > - if (O.good()) { > - llvm::WriteGraph(this, "compilation-graph"); > - O.close(); > - } > - else { > - throw std::runtime_error("Error opening file 'compilation-graph.dot'" > - " for writing!"); > - } > -} > - > -void CompilationGraph::viewGraph() { > - llvm::ViewGraph(this, "compilation-graph"); > -} > > Removed: llvm/trunk/tools/llvmc2/src/Error.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/src/Error.h?rev=56999&view=auto > > ============================================================================== > --- llvm/trunk/tools/llvmc2/src/Error.h (original) > +++ llvm/trunk/tools/llvmc2/src/Error.h (removed) > @@ -1,33 +0,0 @@ > -//===--- Error.h - The LLVM Compiler Driver ---------------------*- C++ -*-===// > -// > -// The LLVM Compiler Infrastructure > -// > -// This file is distributed under the University of Illinois Open > -// Source License. See LICENSE.TXT for details. > -// > -//===----------------------------------------------------------------------===// > -// > -// Exception classes for LLVMC. > -// > -//===----------------------------------------------------------------------===// > - > -#ifndef LLVM_TOOLS_LLVMC2_ERROR_H > -#define LLVM_TOOLS_LLVMC2_ERROR_H > - > -#include > - > -namespace llvmc { > - > - class error_code: public std::runtime_error { > - int Code_; > - public: > - error_code (int c) > - : std::runtime_error("Tool returned error code"), Code_(c) > - {} > - > - int code() const { return Code_; } > - }; > - > -} > - > -#endif //LLVM_TOOLS_LLVMC2_ERROR_H > > Removed: llvm/trunk/tools/llvmc2/src/Makefile > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/src/Makefile?rev=56999&view=auto > > ============================================================================== > --- llvm/trunk/tools/llvmc2/src/Makefile (original) > +++ llvm/trunk/tools/llvmc2/src/Makefile (removed) > @@ -1,19 +0,0 @@ > -##===- tools/llvmc2/src/Makefile ---------------------------*- Makefile -*-===## > -# > -# The LLVM Compiler Infrastructure > -# > -# This file is distributed under the University of Illinois Open > -# Source License. See LICENSE.TXT for details. > -# > -##===----------------------------------------------------------------------===## > - > -LEVEL = ../../.. > -TOOLNAME = $(DRIVER_NAME) > -LINK_COMPONENTS = support system > -REQUIRES_EH := 1 > - > -ifneq ($(BUILTIN_PLUGINS),) > -USEDLIBS = $(patsubst %,LLVMC%,$(BUILTIN_PLUGINS)) > -endif > - > -include $(LEVEL)/Makefile.common > > Removed: llvm/trunk/tools/llvmc2/src/Plugin.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/src/Plugin.cpp?rev=56999&view=auto > > ============================================================================== > --- llvm/trunk/tools/llvmc2/src/Plugin.cpp (original) > +++ llvm/trunk/tools/llvmc2/src/Plugin.cpp (removed) > @@ -1,64 +0,0 @@ > -//===--- Plugin.cpp - The LLVM Compiler Driver ------------------*- C++ -*-===// > -// > -// The LLVM Compiler Infrastructure > -// > -// This file is distributed under the University of Illinois Open > -// Source License. See LICENSE.TXT for details. > -// > -//===----------------------------------------------------------------------===// > -// > -// Plugin support for llvmc2. > -// > -//===----------------------------------------------------------------------===// > - > -#include "llvm/CompilerDriver/Plugin.h" > - > -#include > - > -namespace { > - > - // Registry::Add<> does not do lifetime management (probably issues > - // with static constructor/destructor ordering), so we have to > - // implement it here. > - // > - // All this static registration/life-before-main model seems > - // unnecessary convoluted to me. > - > - static bool pluginListInitialized = false; > - typedef std::vector PluginList; > - static PluginList Plugins; > -} > - > -namespace llvmc { > - > - PluginLoader::PluginLoader() { > - if (!pluginListInitialized) { > - for (PluginRegistry::iterator B = PluginRegistry::begin(), > - E = PluginRegistry::end(); B != E; ++B) > - Plugins.push_back(B->instantiate()); > - } > - pluginListInitialized = true; > - } > - > - PluginLoader::~PluginLoader() { > - if (pluginListInitialized) { > - for (PluginList::iterator B = Plugins.begin(), E = Plugins.end(); > - B != E; ++B) > - delete (*B); > - } > - pluginListInitialized = false; > - } > - > - void PluginLoader::PopulateLanguageMap(LanguageMap& langMap) { > - for (PluginList::iterator B = Plugins.begin(), E = Plugins.end(); > - B != E; ++B) > - (*B)->PopulateLanguageMap(langMap); > - } > - > - void PluginLoader::PopulateCompilationGraph(CompilationGraph& graph) { > - for (PluginList::iterator B = Plugins.begin(), E = Plugins.end(); > - B != E; ++B) > - (*B)->PopulateCompilationGraph(graph); > - } > - > -} > > Removed: llvm/trunk/tools/llvmc2/src/llvmc.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/src/llvmc.cpp?rev=56999&view=auto > > ============================================================================== > --- llvm/trunk/tools/llvmc2/src/llvmc.cpp (original) > +++ llvm/trunk/tools/llvmc2/src/llvmc.cpp (removed) > @@ -1,119 +0,0 @@ > -//===--- llvmc.cpp - The LLVM Compiler Driver -------------------*- C++ -*-===// > -// > -// The LLVM Compiler Infrastructure > -// > -// This file is distributed under the University of Illinois Open > -// Source License. See LICENSE.TXT for details. > -// > -//===----------------------------------------------------------------------===// > -// > -// This tool provides a single point of access to the LLVM > -// compilation tools. It has many options. To discover the options > -// supported please refer to the tools' manual page or run the tool > -// with the --help option. > -// > -//===----------------------------------------------------------------------===// > - > -#include "Error.h" > - > -#include "llvm/CompilerDriver/CompilationGraph.h" > -#include "llvm/CompilerDriver/Plugin.h" > - > -#include "llvm/System/Path.h" > -#include "llvm/Support/CommandLine.h" > -#include "llvm/Support/PluginLoader.h" > - > -#include > -#include > -#include > - > -namespace cl = llvm::cl; > -namespace sys = llvm::sys; > -using namespace llvmc; > - > -// Built-in command-line options. > -// External linkage here is intentional. > - > -cl::list InputFilenames(cl::Positional, cl::desc(""), > - cl::ZeroOrMore); > -cl::opt OutputFilename("o", cl::desc("Output file name"), > - cl::value_desc("file")); > -cl::list Languages("x", > - cl::desc("Specify the language of the following input files"), > - cl::ZeroOrMore); > -cl::opt DryRun("dry-run", > - cl::desc("Only pretend to run commands")); > -cl::opt VerboseMode("v", > - cl::desc("Enable verbose mode")); > -cl::opt WriteGraph("write-graph", > - cl::desc("Write compilation-graph.dot file"), > - cl::Hidden); > -cl::opt ViewGraph("view-graph", > - cl::desc("Show compilation graph in GhostView"), > - cl::Hidden); > -cl::opt SaveTemps("save-temps", > - cl::desc("Keep temporary files"), > - cl::Hidden); > - > -namespace { > - /// BuildTargets - A small wrapper for CompilationGraph::Build. > - int BuildTargets(CompilationGraph& graph, const LanguageMap& langMap) { > - int ret; > - const sys::Path& tempDir = SaveTemps > - ? sys::Path("") > - : sys::Path(sys::Path::GetTemporaryDirectory()); > - > - try { > - ret = graph.Build(tempDir, langMap); > - } > - catch(...) { > - tempDir.eraseFromDisk(true); > - throw; > - } > - > - if (!SaveTemps) > - tempDir.eraseFromDisk(true); > - return ret; > - } > -} > - > -int main(int argc, char** argv) { > - try { > - LanguageMap langMap; > - CompilationGraph graph; > - > - cl::ParseCommandLineOptions > - (argc, argv, "LLVM Compiler Driver (Work In Progress)", true); > - > - PluginLoader Plugins; > - Plugins.PopulateLanguageMap(langMap); > - Plugins.PopulateCompilationGraph(graph); > - > - if (WriteGraph) { > - graph.writeGraph(); > - if (!ViewGraph) > - return 0; > - } > - > - if (ViewGraph) { > - graph.viewGraph(); > - return 0; > - } > - > - if (InputFilenames.empty()) { > - throw std::runtime_error("no input files"); > - } > - > - return BuildTargets(graph, langMap); > - } > - catch(llvmc::error_code& ec) { > - return ec.code(); > - } > - catch(const std::exception& ex) { > - std::cerr << argv[0] << ": " << ex.what() << '\n'; > - } > - catch(...) { > - std::cerr << argv[0] << ": unknown error!\n"; > - } > - return 1; > -} > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From resistor at mac.com Fri Oct 3 15:43:04 2008 From: resistor at mac.com (Owen Anderson) Date: Fri, 03 Oct 2008 13:43:04 -0700 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 In-Reply-To: <200810021829.m92ITS8x014885@zion.cs.uiuc.edu> References: <200810021829.m92ITS8x014885@zion.cs.uiuc.edu> Message-ID: Is there any data available about how this compares to the default regalloc? When is it better/worse? --Owen On Oct 2, 2008, at 11:29 AM, Evan Cheng wrote: > 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;u + this_->solution[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 + for(unsigned j=0;j + PBQPNum min = (*c_yx)[i][0] + (*c_zx)[j][0] + (*cx)[0]; > + for(unsigned k=1;k + PBQPNum c = (*c_yx)[i][k] + (*c_zx)[j][k] + (*cx)[k]; > + if ( c < min ) { > + min = c; > + } > + } > + (*delta)[i][j] = min; > + } > + } > + > + /* add delta matrix */ > + add_pbqp_edgecosts(this_,y,z,delta); > + > + /* delete node x */ > + remove_node(this_,x); > + > + /* simplify cost matrix c_yz */ > + simplify_edge(this_,y,z); > + > + /* reorder adj. nodes */ > + 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 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; > + } > + } > + } > + > + /* return node and free bucket */ > + if (min_bucket != NULL) { > + int u; > + > + pbqp_remove_bucket(this_,min_bucket); > + u = min_bucket->u; > + free(min_bucket); > + return u; > + } else { > + return -1; > + } > +} > + > + > +/ > ***************************************************************************** > + * PBQP graph parsing > + > ****************************************************************************/ > + > +/* reduce pbqp problem (first phase) */ > +static > +void reduce_pbqp(pbqp *this_) > +{ > + int u; > + > + assert(this_ != NULL); > + assert(this_->bucket_list != NULL); > + > + for(;;){ > + > + if (this_->bucket_list[1] != NULL) { > + u = pop_node(this_,1); > + apply_RI(this_,u); > + } else if (this_->bucket_list[2] != NULL) { > + u = pop_node(this_,2); > + apply_RII(this_,u); > + } else if ((u = pop_colorablenode(this_)) != -1) { > + apply_RN(this_,u); > + } else { > + break; > + } > + } > +} > + > +/ > ***************************************************************************** > + * PBQP back propagation > + > ****************************************************************************/ > + > +/* determine solution of a reduced node. Either > + RI or RII was applied for this_ node. */ > +static > +void determine_solution(pbqp *this_,int x) > +{ > + PBQPVector *v = new PBQPVector(*this_ -> node_costs[x]); > + adjnode *adj_ptr; > + > + assert(this_ != NULL); > + assert(x >= 0 && x < this_->num_nodes); > + assert(this_ -> adj_list != NULL); > + assert(this_ -> solution != NULL); > + > + for(adj_ptr=this_->adj_list[x] ;adj_ptr != NULL; adj_ptr = > adj_ptr -> succ) { > + int y = adj_ptr -> adj; > + int y_sol = this_ -> solution[y]; > + > + PBQPMatrix *c_yx = pbqp_get_costmatrix(this_,y,x); > + assert(y_sol >= 0 && y_sol < (int)this_->node_costs[y]- > >getLength()); > + (*v) += c_yx->getRowAsVector(y_sol); > + delete c_yx; > + } > + this_ -> solution[x] = v->minIndex(); > + > + delete v; > +} > + > +/* back popagation phase of PBQP */ > +static > +void back_propagate(pbqp *this_) > +{ > + int i; > + > + assert(this_ != NULL); > + assert(this_->stack != NULL); > + assert(this_->stack_ptr < this_->num_nodes); > + > + for(i=this_ -> stack_ptr-1;i>=0;i--) { > + int x = this_ -> stack[i]; > + assert( x >= 0 && x < this_ -> num_nodes); > + reinsert_node(this_,x); > + determine_solution(this_,x); > + } > +} > + > +/* solve trivial nodes of degree zero */ > +static > +void determine_trivialsolution(pbqp *this_) > +{ > + int u; > + PBQPNum delta; > + > + assert( this_ != NULL); > + assert( this_ -> bucket_list != NULL); > + > + /* determine trivial solution */ > + while (this_->bucket_list[0] != NULL) { > + u = pop_node(this_,0); > + > + assert( u >= 0 && u < this_ -> num_nodes); > + > + this_->solution[u] = this_->node_costs[u]->minIndex(); > + delta = (*this_->node_costs[u])[this_->solution[u]]; > + this_->min = this_->min + delta; > + > + /* increment counter for number statistic */ > + this_->num_r0++; > + } > +} > + > +/ > ***************************************************************************** > + * debug facilities > + > ****************************************************************************/ > +static > +void check_pbqp(pbqp *this_) > +{ > + int u,v; > + PBQPMatrix *costs; > + adjnode *adj_ptr; > + > + assert( this_ != NULL); > + > + for(u=0;u< this_->num_nodes; u++) { > + assert (this_ -> node_costs[u] != NULL); > + for(adj_ptr = this_ -> adj_list[u];adj_ptr != NULL; adj_ptr = > adj_ptr -> succ) { > + v = adj_ptr -> adj; > + assert( v>= 0 && v < this_->num_nodes); > + if (u < v ) { > + costs = adj_ptr -> costs; > + assert( costs->getRows() == this_->node_costs[u]->getLength() && > + costs->getCols() == this_->node_costs[v]->getLength()); > + } > + } > + } > +} > + > +/ > ***************************************************************************** > + * PBQP solve routines > + > ****************************************************************************/ > + > +/* solve PBQP problem */ > +void solve_pbqp(pbqp *this_) > +{ > + assert(this_ != NULL); > + assert(!this_->solved); > + > + /* check vector & matrix dimensions */ > + check_pbqp(this_); > + > + /* simplify PBQP problem */ > + > + /* eliminate trivial nodes, i.e. > + nodes with cost vectors of length one. */ > + eliminate_trivial_nodes(this_); > + > + /* eliminate edges with independent > + cost matrices and normalize matrices */ > + eliminate_independent_edges(this_); > + > + /* create bucket list for graph parsing */ > + create_bucketlist(this_); > + > + /* reduce phase */ > + reduce_pbqp(this_); > + > + /* solve trivial nodes */ > + determine_trivialsolution(this_); > + > + /* back propagation phase */ > + back_propagate(this_); > + > + this_->solved = true; > +} > + > +/* get solution of a node */ > +int get_pbqp_solution(pbqp *this_,int x) > +{ > + assert(this_ != NULL); > + assert(this_->solution != NULL); > + assert(this_ -> solved); > + > + return this_->solution[x]; > +} > + > +/* is solution optimal? */ > +bool is_pbqp_optimal(pbqp *this_) > +{ > + assert(this_ -> solved); > + return this_->optimal; > +} > + > +} > + > +/* end of pbqp.c */ > > Added: llvm/trunk/lib/CodeGen/PBQP.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PBQP.h?rev=56959&view=auto > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/PBQP.h (added) > +++ llvm/trunk/lib/CodeGen/PBQP.h Thu Oct 2 13:29:27 2008 > @@ -0,0 +1,284 @@ > +//===---------------- 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 > +// > = > = > = > ----------------------------------------------------------------------= > ==// > + > +// TODO: > +// > +// * Default to null costs on vector initialisation? > +// * C++-ify the rest of the solver. > + > +#ifndef LLVM_CODEGEN_PBQPSOLVER_H > +#define LLVM_CODEGEN_PBQPSOLVER_H > + > +#include > +#include > +#include > + > +namespace llvm { > + > +//! \brief Floating point type to use in PBQP solver. > +typedef double PBQPNum; > + > +//! \brief PBQP Vector class. > +class PBQPVector { > +public: > + > + //! \brief Construct a PBQP vector of the given size. > + explicit PBQPVector(unsigned length) : > + length(length), data(new PBQPNum[length]) { > + std::fill(data, data + length, 0); > + } > + > + //! \brief Copy construct a PBQP vector. > + PBQPVector(const PBQPVector &v) : > + length(v.length), data(new PBQPNum[length]) { > + std::copy(v.data, v.data + length, data); > + } > + > + ~PBQPVector() { delete[] data; } > + > + //! \brief Assignment operator. > + PBQPVector& operator=(const PBQPVector &v) { > + delete[] data; > + length = v.length; > + data = new PBQPNum[length]; > + std::copy(v.data, v.data + length, data); > + return *this; > + } > + > + //! \brief Return the length of the vector > + unsigned getLength() const throw () { > + return length; > + } > + > + //! \brief Element access. > + PBQPNum& operator[](unsigned index) { > + assert(index < length && "PBQPVector element access out of > bounds."); > + return data[index]; > + } > + > + //! \brief Const element access. > + const PBQPNum& operator[](unsigned index) const { > + assert(index < length && "PBQPVector element access out of > bounds."); > + return data[index]; > + } > + > + //! \brief Add another vector to this one. > + PBQPVector& operator+=(const PBQPVector &v) { > + assert(length == v.length && "PBQPVector length mismatch."); > + std::transform(data, data + length, v.data, data, > std::plus()); > + return *this; > + } > + > + //! \brief Subtract another vector from this one. > + PBQPVector& operator-=(const PBQPVector &v) { > + assert(length == v.length && "PBQPVector length mismatch."); > + std::transform(data, data + length, v.data, data, > std::minus()); > + return *this; > + } > + > + //! \brief Returns the index of the minimum value in this vector > + unsigned minIndex() const { > + return std::min_element(data, data + length) - data; > + } > + > +private: > + unsigned length; > + PBQPNum *data; > +}; > + > + > +//! \brief PBQP Matrix class > +class PBQPMatrix { > +public: > + > + //! \brief Construct a PBQP Matrix with the given dimensions. > + PBQPMatrix(unsigned rows, unsigned cols) : > + rows(rows), cols(cols), data(new PBQPNum[rows * cols]) { > + std::fill(data, data + (rows * cols), 0); > + } > + > + //! \brief Copy construct a PBQP matrix. > + PBQPMatrix(const PBQPMatrix &m) : > + rows(m.rows), cols(m.cols), data(new PBQPNum[rows * cols]) { > + std::copy(m.data, m.data + (rows * cols), data); > + } > + > + ~PBQPMatrix() { delete[] data; } > + > + //! \brief Assignment operator. > + PBQPMatrix& operator=(const PBQPMatrix &m) { > + delete[] data; > + rows = m.rows; cols = m.cols; > + data = new PBQPNum[rows * cols]; > + std::copy(m.data, m.data + (rows * cols), data); > + return *this; > + } > + > + //! \brief Return the number of rows in this matrix. > + unsigned getRows() const throw () { return rows; } > + > + //! \brief Return the number of cols in this matrix. > + unsigned getCols() const throw () { return cols; } > + > + //! \brief Matrix element access. > + PBQPNum* operator[](unsigned r) { > + assert(r < rows && "Row out of bounds."); > + return data + (r * cols); > + } > + > + //! \brief Matrix element access. > + const PBQPNum* operator[](unsigned r) const { > + assert(r < rows && "Row out of bounds."); > + return data + (r * cols); > + } > + > + //! \brief Returns the given row as a vector. > + PBQPVector getRowAsVector(unsigned r) const { > + PBQPVector v(cols); > + for (unsigned c = 0; c < cols; ++c) > + v[c] = (*this)[r][c]; > + return v; > + } > + > + //! \brief Reset the matrix to the given value. > + PBQPMatrix& reset(PBQPNum val = 0) { > + std::fill(data, data + (rows * cols), val); > + return *this; > + } > + > + //! \brief Set a single row of this matrix to the given value. > + PBQPMatrix& setRow(unsigned r, PBQPNum val) { > + assert(r < rows && "Row out of bounds."); > + std::fill(data + (r * cols), data + ((r + 1) * cols), val); > + return *this; > + } > + > + //! \brief Set a single column of this matrix to the given value. > + PBQPMatrix& setCol(unsigned c, PBQPNum val) { > + assert(c < cols && "Column out of bounds."); > + for (unsigned r = 0; r < rows; ++r) > + (*this)[r][c] = val; > + return *this; > + } > + > + //! \brief Matrix transpose. > + PBQPMatrix transpose() const { > + PBQPMatrix m(cols, rows); > + for (unsigned r = 0; r < rows; ++r) > + for (unsigned c = 0; c < cols; ++c) > + m[c][r] = (*this)[r][c]; > + return m; > + } > + > + //! \brief Returns the diagonal of the matrix as a vector. > + //! > + //! Matrix must be square. > + PBQPVector diagonalize() const { > + assert(rows == cols && "Attempt to diagonalize non-square > matrix."); > + > + PBQPVector v(rows); > + for (unsigned r = 0; r < rows; ++r) > + v[r] = (*this)[r][r]; > + return v; > + } > + > + //! \brief Add the given matrix to this one. > + PBQPMatrix& operator+=(const PBQPMatrix &m) { > + assert(rows == m.rows && cols == m.cols && > + "Matrix dimensions mismatch."); > + std::transform(data, data + (rows * cols), m.data, data, > + std::plus()); > + return *this; > + } > + > + //! \brief Returns the minimum of the given row > + PBQPNum getRowMin(unsigned r) const { > + assert(r < rows && "Row out of bounds"); > + return *std::min_element(data + (r * cols), data + ((r + 1) * > cols)); > + } > + > + //! \brief Returns the minimum of the given column > + PBQPNum getColMin(unsigned c) const { > + PBQPNum minElem = (*this)[0][c]; > + for (unsigned r = 1; r < rows; ++r) > + if ((*this)[r][c] < minElem) minElem = (*this)[r][c]; > + return minElem; > + } > + > + //! \brief Subtracts the given scalar from the elements of the > given row. > + PBQPMatrix& subFromRow(unsigned r, PBQPNum val) { > + assert(r < rows && "Row out of bounds"); > + std::transform(data + (r * cols), data + ((r + 1) * cols), > + data + (r * cols), > + std::bind2nd(std::minus(), val)); > + return *this; > + } > + > + //! \brief Subtracts the given scalar from the elements of the > given column. > + PBQPMatrix& subFromCol(unsigned c, PBQPNum val) { > + for (unsigned r = 0; r < rows; ++r) > + (*this)[r][c] -= val; > + return *this; > + } > + > + //! \brief Returns true if this is a zero matrix. > + bool isZero() const { > + return find_if(data, data + (rows * cols), > + std::bind2nd(std::not_equal_to(), 0)) == > + data + (rows * cols); > + } > + > +private: > + unsigned rows, cols; > + PBQPNum *data; > +}; > + > +#define EPS (1E-8) > + > +#ifndef PBQP_TYPE > +#define PBQP_TYPE > +struct pbqp; > +typedef struct pbqp pbqp; > +#endif > + > +/***************** > + * PBQP routines * > + *****************/ > + > +/* allocate pbqp problem */ > +pbqp *alloc_pbqp(int num); > + > +/* add node costs */ > +void add_pbqp_nodecosts(pbqp *this_,int u, PBQPVector *costs); > + > +/* add edge mat */ > +void add_pbqp_edgecosts(pbqp *this_,int u,int v,PBQPMatrix *costs); > + > +/* solve PBQP problem */ > +void solve_pbqp(pbqp *this_); > + > +/* get solution of a node */ > +int get_pbqp_solution(pbqp *this_,int u); > + > +/* alloc PBQP */ > +pbqp *alloc_pbqp(int num); > + > +/* free PBQP */ > +void free_pbqp(pbqp *this_); > + > +/* is optimal */ > +bool is_pbqp_optimal(pbqp *this_); > + > +} > +#endif > > Added: llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp?rev=56959&view=auto > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp (added) > +++ llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp Thu Oct 2 13:29:27 2008 > @@ -0,0 +1,529 @@ > +//===------ RegAllocPBQP.cpp ---- PBQP Register Allocator -------*- > C++ -*-===// > +// > +// The LLVM Compiler Infrastructure > +// > +// This file is distributed under the University of Illinois Open > Source > +// License. See LICENSE.TXT for details. > +// > +// > = > = > = > ----------------------------------------------------------------------= > ==// > +// > +// This file contains a Partitioned Boolean Quadratic Programming > (PBQP) based > +// register allocator for LLVM. This allocator works by > constructing a PBQP > +// problem representing the register allocation problem under > consideration, > +// solving this using a PBQP solver, and mapping the solution back > to a > +// register assignment. If any variables are selected for spilling > then spill > +// code is inserted and the process repeated. > +// > +// The PBQP solver (pbqp.c) provided for this allocator uses a > heuristic tuned > +// for register allocation. For more information on PBQP for register > +// allocation see the following papers: > +// > +// (1) Hames, L. and Scholz, B. 2006. Nearly optimal register > allocation with > +// PBQP. In Proceedings of the 7th Joint Modular Languages > Conference > +// (JMLC'06). LNCS, vol. 4228. Springer, New York, NY, USA. > 346-361. > +// > +// (2) Scholz, B., Eckstein, E. 2002. Register allocation for > irregular > +// architectures. In Proceedings of the Joint Conference on > Languages, > +// Compilers and Tools for Embedded Systems (LCTES'02), ACM > Press, New York, > +// NY, USA, 139-148. > +// > +// Author: Lang Hames > +// Email: lhames at gmail.com > +// > +// > = > = > = > ----------------------------------------------------------------------= > ==// > + > +// TODO: > +// > +// * Use of std::set in constructPBQPProblem destroys allocation > order preference. > +// Switch to an order preserving container. > +// > +// * Coalescing support. > + > +#define DEBUG_TYPE "regalloc" > + > +#include "PBQP.h" > +#include "VirtRegMap.h" > +#include "llvm/CodeGen/MachineFunctionPass.h" > +#include "llvm/CodeGen/RegAllocRegistry.h" > +#include "llvm/CodeGen/LiveIntervalAnalysis.h" > +#include "llvm/CodeGen/MachineRegisterInfo.h" > +#include "llvm/CodeGen/MachineLoopInfo.h" > +#include "llvm/Target/TargetMachine.h" > +#include "llvm/Target/TargetInstrInfo.h" > +#include "llvm/Support/Debug.h" > +#include > +#include > +#include > +#include > +#include > + > +using namespace llvm; > + > +static RegisterRegAlloc > +registerPBQPRepAlloc("pbqp", " PBQP register allocator", > + createPBQPRegisterAllocator); > + > + > +namespace { > + > + //! > + //! PBQP based allocators solve the register allocation problem > by mapping > + //! register allocation problems to Partitioned Boolean Quadratic > + //! Programming problems. > + class VISIBILITY_HIDDEN PBQPRegAlloc : public MachineFunctionPass { > + public: > + > + static char ID; > + > + //! Construct a PBQP register allocator. > + PBQPRegAlloc() : MachineFunctionPass((intptr_t)&ID) {} > + > + //! Return the pass name. > + virtual const char* getPassName() const throw() { > + return "PBQP Register Allocator"; > + } > + > + //! PBQP analysis usage. > + virtual void getAnalysisUsage(AnalysisUsage &au) const { > + au.addRequired(); > + au.addRequired(); > + MachineFunctionPass::getAnalysisUsage(au); > + } > + > + //! Perform register allocation > + virtual bool runOnMachineFunction(MachineFunction &MF); > + > + private: > + typedef std::map LI2NodeMap; > + typedef std::vector Node2LIMap; > + typedef std::vector AllowedSet; > + typedef std::vector AllowedSetMap; > + typedef std::set IgnoreSet; > + > + MachineFunction *mf; > + const TargetMachine *tm; > + const TargetRegisterInfo *tri; > + const TargetInstrInfo *tii; > + const MachineLoopInfo *loopInfo; > + MachineRegisterInfo *mri; > + > + LiveIntervals *li; > + VirtRegMap *vrm; > + > + LI2NodeMap li2Node; > + Node2LIMap node2LI; > + AllowedSetMap allowedSets; > + IgnoreSet ignoreSet; > + > + //! Builds a PBQP cost vector. > + template > + PBQPVector* buildCostVector(const Container &allowed, > + PBQPNum spillCost) const; > + > + //! \brief Builds a PBQP interfernce matrix. > + //! > + //! @return Either a pointer to a non-zero PBQP matrix > representing the > + //! allocation option costs, or a null pointer for a > zero matrix. > + //! > + //! Expects allowed sets for two interfering LiveIntervals. > These allowed > + //! sets should contain only allocable registers from the > LiveInterval's > + //! register class, with any interfering pre-colored registers > removed. > + template > + PBQPMatrix* buildInterferenceMatrix(const Container &allowed1, > + const Container &allowed2) > const; > + > + //! > + //! Expects allowed sets for two potentially coalescable > LiveIntervals, > + //! and an estimated benefit due to coalescing. The allowed > sets should > + //! contain only allocable registers from the LiveInterval's > register > + //! classes, with any interfering pre-colored registers removed. > + template > + PBQPMatrix* buildCoalescingMatrix(const Container &allowed1, > + const Container &allowed2, > + PBQPNum cBenefit) const; > + > + //! \brief Helper functior for constructInitialPBQPProblem(). > + //! > + //! This function iterates over the Function we are about to > allocate for > + //! and computes spill costs. > + void calcSpillCosts(); > + > + //! \brief Scans the MachineFunction being allocated to find > coalescing > + // opportunities. > + void findCoalescingOpportunities(); > + > + //! \brief Constructs a PBQP problem representation of the > register > + //! allocation problem for this function. > + //! > + //! @return a PBQP solver object for the register allocation > problem. > + pbqp* constructPBQPProblem(); > + > + //! \brief Given a solved PBQP problem maps this solution back > to a register > + //! assignment. > + bool mapPBQPToRegAlloc(pbqp *problem); > + > + }; > + > + char PBQPRegAlloc::ID = 0; > +} > + > + > +template > +PBQPVector* PBQPRegAlloc::buildCostVector(const Container &allowed, > + PBQPNum spillCost) const { > + > + // Allocate vector. Additional element (0th) used for spill option > + PBQPVector *v = new PBQPVector(allowed.size() + 1); > + > + (*v)[0] = spillCost; > + > + return v; > +} > + > +template > +PBQPMatrix* PBQPRegAlloc::buildInterferenceMatrix( > + const Container &allowed1, const Container &allowed2) const { > + > + typedef typename Container::const_iterator ContainerIterator; > + > + // Construct a PBQP matrix representing the cost of allocation > options. The > + // rows and columns correspond to the allocation options for the > two live > + // intervals. Elements will be infinite where corresponding > registers alias, > + // since we cannot allocate aliasing registers to interfering > live intervals. > + // All other elements (non-aliasing combinations) will have zero > cost. Note > + // that the spill option (element 0,0) has zero cost, since we > can allocate > + // both intervals to memory safely (the cost for each individual > allocation > + // to memory is accounted for by the cost vectors for each live > interval). > + PBQPMatrix *m = new PBQPMatrix(allowed1.size() + 1, > allowed2.size() + 1); > + > + // Assume this is a zero matrix until proven otherwise. Zero > matrices occur > + // between interfering live ranges with non-overlapping register > sets (e.g. > + // non-overlapping reg classes, or disjoint sets of allowed regs > within the > + // same class). The term "overlapping" is used advisedly: sets > which do not > + // intersect, but contain registers which alias, will have non- > zero matrices. > + // We optimize zero matrices away to improve solver speed. > + bool isZeroMatrix = true; > + > + > + // Row index. Starts at 1, since the 0th row is for the spill > option, which > + // is always zero. > + unsigned ri = 1; > + > + // Iterate over allowed sets, insert infinities where required. > + for (ContainerIterator a1Itr = allowed1.begin(), a1End = > allowed1.end(); > + a1Itr != a1End; ++a1Itr) { > + > + // Column index, starts at 1 as for row index. > + unsigned ci = 1; > + unsigned reg1 = *a1Itr; > + > + for (ContainerIterator a2Itr = allowed2.begin(), a2End = > allowed2.end(); > + a2Itr != a2End; ++a2Itr) { > + > + unsigned reg2 = *a2Itr; > + > + // If the row/column regs are identical or alias insert an > infinity. > + if ((reg1 == reg2) || tri->areAliases(reg1, reg2)) { > + (*m)[ri][ci] = std::numeric_limits::infinity(); > + isZeroMatrix = false; > + } > + > + ++ci; > + } > + > + ++ri; > + } > + > + // If this turns out to be a zero matrix... > + if (isZeroMatrix) { > + // free it and return null. > + delete m; > + return 0; > + } > + > + // ...otherwise return the cost matrix. > + return m; > +} > + > +void PBQPRegAlloc::calcSpillCosts() { > + > + // Calculate the spill cost for each live interval by iterating > over the > + // function counting loads and stores, with loop depth taken into > account. > + for (MachineFunction::const_iterator bbItr = mf->begin(), bbEnd = > mf->end(); > + bbItr != bbEnd; ++bbItr) { > + > + const MachineBasicBlock *mbb = &*bbItr; > + float loopDepth = loopInfo->getLoopDepth(mbb); > + > + for (MachineBasicBlock::const_iterator > + iItr = mbb->begin(), iEnd = mbb->end(); iItr != iEnd; + > +iItr) { > + > + const MachineInstr *instr = &*iItr; > + > + for (unsigned opNo = 0; opNo < instr->getNumOperands(); + > +opNo) { > + > + const MachineOperand &mo = instr->getOperand(opNo); > + > + // We're not interested in non-registers... > + if (!mo.isRegister()) > + continue; > + > + unsigned moReg = mo.getReg(); > + > + // ...Or invalid registers... > + if (moReg == 0) > + continue; > + > + // ...Or physical registers... > + if (TargetRegisterInfo::isPhysicalRegister(moReg)) > + continue; > + > + assert ((mo.isUse() || mo.isDef()) && > + "Not a use, not a def, what is it?"); > + > + //... Just the virtual registers. We treat loads and stores as > equal. > + li->getInterval(moReg).weight += powf(10.0f, loopDepth); > + } > + > + } > + > + } > + > +} > + > +pbqp* PBQPRegAlloc::constructPBQPProblem() { > + > + typedef std::vector LIVector; > + typedef std::set RegSet; > + > + // These will store the physical & virtual intervals, respectively. > + LIVector physIntervals, virtIntervals; > + > + // Start by clearing the old node <-> live interval mappings & > allowed sets > + li2Node.clear(); > + node2LI.clear(); > + allowedSets.clear(); > + > + // Iterate over intervals classifying them as physical or > virtual, and > + // constructing live interval <-> node number mappings. > + for (LiveIntervals::iterator itr = li->begin(), end = li->end(); > + itr != end; ++itr) { > + > + if (itr->second->getNumValNums() != 0) { > + DOUT << "Live range has " << itr->second->getNumValNums() << > ": " << itr->second << "\n"; > + } > + > + if (TargetRegisterInfo::isPhysicalRegister(itr->first)) { > + physIntervals.push_back(itr->second); > + mri->setPhysRegUsed(itr->second->reg); > + } > + else { > + > + // If we've allocated this virtual register interval a stack > slot on a > + // previous round then it's not an allocation candidate > + if (ignoreSet.find(itr->first) != ignoreSet.end()) > + continue; > + > + li2Node[itr->second] = node2LI.size(); > + node2LI.push_back(itr->second); > + virtIntervals.push_back(itr->second); > + } > + } > + > + // Early out if there's no regs to allocate for. > + if (virtIntervals.empty()) > + return 0; > + > + // Construct a PBQP solver for this problem > + pbqp *solver = alloc_pbqp(virtIntervals.size()); > + > + // Resize allowedSets container appropriately. > + allowedSets.resize(virtIntervals.size()); > + > + // Iterate over virtual register intervals to compute allowed > sets... > + for (unsigned node = 0; node < node2LI.size(); ++node) { > + > + // Grab pointers to the interval and its register class. > + const LiveInterval *li = node2LI[node]; > + const TargetRegisterClass *liRC = mri->getRegClass(li->reg); > + > + // Start by assuming all allocable registers in the class are > allowed... > + RegSet liAllowed(liRC->allocation_order_begin(*mf), > + liRC->allocation_order_end(*mf)); > + > + // If this range is non-empty then eliminate the physical > registers which > + // overlap with this range, along with all their aliases. > + if (!li->empty()) { > + for (LIVector::iterator pItr = physIntervals.begin(), > + pEnd = physIntervals.end(); pItr != pEnd; ++pItr) { > + > + if (li->overlaps(**pItr)) { > + > + unsigned pReg = (*pItr)->reg; > + > + // Remove the overlapping reg... > + liAllowed.erase(pReg); > + > + const unsigned *aliasItr = tri->getAliasSet(pReg); > + > + if (aliasItr != 0) { > + // ...and its aliases. > + for (; *aliasItr != 0; ++aliasItr) { > + liAllowed.erase(*aliasItr); > + } > + > + } > + > + } > + > + } > + > + } > + > + // Copy the allowed set into a member vector for use when > constructing cost > + // vectors & matrices, and mapping PBQP solutions back to > assignments. > + allowedSets[node] = AllowedSet(liAllowed.begin(), > liAllowed.end()); > + > + // Set the spill cost to the interval weight, or epsilon if the > + // interval weight is zero > + PBQPNum spillCost = (li->weight != 0.0) ? > + li->weight : std::numeric_limits::min(); > + > + // Build a cost vector for this interval. > + add_pbqp_nodecosts(solver, node, > + buildCostVector(allowedSets[node], > spillCost)); > + > + } > + > + // Now add the cost matrices... > + for (unsigned node1 = 0; node1 < node2LI.size(); ++node1) { > + > + const LiveInterval *li = node2LI[node1]; > + > + if (li->empty()) > + continue; > + > + // Test for live range overlaps and insert interference matrices. > + for (unsigned node2 = node1 + 1; node2 < node2LI.size(); + > +node2) { > + const LiveInterval *li2 = node2LI[node2]; > + > + if (li2->empty()) > + continue; > + > + if (li->overlaps(*li2)) { > + PBQPMatrix *m = > + buildInterferenceMatrix(allowedSets[node1], > allowedSets[node2]); > + > + if (m != 0) { > + add_pbqp_edgecosts(solver, node1, node2, m); > + delete m; > + } > + } > + } > + } > + > + // We're done, PBQP problem constructed - return it. > + return solver; > +} > + > +bool PBQPRegAlloc::mapPBQPToRegAlloc(pbqp *problem) { > + > + // Set to true if we have any spills > + bool anotherRoundNeeded = false; > + > + // Clear the existing allocation. > + vrm->clearAllVirt(); > + > + // Iterate over the nodes mapping the PBQP solution to a register > assignment. > + for (unsigned node = 0; node < node2LI.size(); ++node) { > + unsigned symReg = node2LI[node]->reg, > + allocSelection = get_pbqp_solution(problem, node); > + > + // If the PBQP solution is non-zero it's a physical register... > + if (allocSelection != 0) { > + // Get the physical reg, subtracting 1 to account for the > spill option. > + unsigned physReg = allowedSets[node][allocSelection - 1]; > + > + // Add to the virt reg map and update the used phys regs. > + vrm->assignVirt2Phys(symReg, physReg); > + mri->setPhysRegUsed(physReg); > + } > + // ...Otherwise it's a spill. > + else { > + > + // Make sure we ignore this virtual reg on the next round > + // of allocation > + ignoreSet.insert(node2LI[node]->reg); > + > + float SSWeight; > + > + // Insert spill ranges for this live range > + SmallVector spillIs; > + std::vector newSpills = > + li->addIntervalsForSpills(*node2LI[node], spillIs, > loopInfo, *vrm, > + SSWeight); > + > + // We need another round if spill intervals were added. > + anotherRoundNeeded |= !newSpills.empty(); > + } > + } > + > + return !anotherRoundNeeded; > +} > + > +bool PBQPRegAlloc::runOnMachineFunction(MachineFunction &MF) { > + > + mf = &MF; > + tm = &mf->getTarget(); > + tri = tm->getRegisterInfo(); > + mri = &mf->getRegInfo(); > + > + li = &getAnalysis(); > + loopInfo = &getAnalysis(); > + > + std::auto_ptr vrmAutoPtr(new VirtRegMap(*mf)); > + vrm = vrmAutoPtr.get(); > + > + // Allocator main loop: > + // > + // * Map current regalloc problem to a PBQP problem > + // * Solve the PBQP problem > + // * Map the solution back to a register allocation > + // * Spill if necessary > + // > + // This process is continued till no more spills are generated. > + > + bool regallocComplete = false; > + > + // Calculate spill costs for intervals > + calcSpillCosts(); > + > + while (!regallocComplete) { > + pbqp *problem = constructPBQPProblem(); > + > + // Fast out if there's no problem to solve. > + if (problem == 0) > + return true; > + > + solve_pbqp(problem); > + > + regallocComplete = mapPBQPToRegAlloc(problem); > + > + free_pbqp(problem); > + } > + > + ignoreSet.clear(); > + > + std::auto_ptr spiller(createSpiller()); > + > + spiller->runOnMachineFunction(*mf, *vrm); > + > + return true; > +} > + > +FunctionPass* llvm::createPBQPRegisterAllocator() { > + return new PBQPRegAlloc(); > +} > + > + > +#undef DEBUG_TYPE > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2624 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20081003/405e75f6/attachment.bin From foldr at codedgers.com Fri Oct 3 04:22:09 2008 From: foldr at codedgers.com (Mikhail Glushenkov) Date: Fri, 3 Oct 2008 09:22:09 +0000 (UTC) Subject: [llvm-commits] [llvm] r56988 - /llvm/trunk/tools/llvmc2/Makefile References: <200810030026.m930QnIO027541@zion.cs.uiuc.edu> Message-ID: Bill Wendling writes: > > Author: void > Date: Thu Oct 2 19:26:49 2008 > New Revision: 56988 > > URL: http://llvm.org/viewvc/llvm-project?rev=56988&view=rev > Log: > Unbreak the build. Unfortunately, this also had a side-effect of breaking the testsuite. Fixed in r56998. From dpatel at apple.com Fri Oct 3 16:11:04 2008 From: dpatel at apple.com (Devang Patel) Date: Fri, 03 Oct 2008 21:11:04 -0000 Subject: [llvm-commits] [llvm] r57029 - in /llvm/trunk: include/llvm/Attributes.h lib/VMCore/Verifier.cpp Message-ID: <200810032111.m93LB4pX014403@zion.cs.uiuc.edu> Author: dpatel Date: Fri Oct 3 16:11:02 2008 New Revision: 57029 URL: http://llvm.org/viewvc/llvm-project?rev=57029&view=rev Log: Fix function attribute verification check. Thanks Duncan! Modified: llvm/trunk/include/llvm/Attributes.h 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=57029&r1=57028&r2=57029&view=diff ============================================================================== --- llvm/trunk/include/llvm/Attributes.h (original) +++ llvm/trunk/include/llvm/Attributes.h Fri Oct 3 16:11:02 2008 @@ -54,7 +54,8 @@ const Attributes ParameterOnly = ByVal | Nest | StructRet; /// @brief Attributes that only apply to function. -const Attributes FunctionOnly = NoReturn | NoUnwind | ReadNone | ReadOnly; +const Attributes FunctionOnly = NoReturn | NoUnwind | ReadNone | ReadOnly | + NoInline | AlwaysInline | OptimizeForSize; /// @brief Parameter attributes that do not apply to vararg call arguments. const Attributes VarArgsIncompatible = StructRet; Modified: llvm/trunk/lib/VMCore/Verifier.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=57029&r1=57028&r2=57029&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Verifier.cpp (original) +++ llvm/trunk/lib/VMCore/Verifier.cpp Fri Oct 3 16:11:02 2008 @@ -415,12 +415,11 @@ Attributes RetI = Attrs & Attribute::ParameterOnly; Assert1(!RetI, "Attribute " + Attribute::getAsString(RetI) + " does not apply to return values!", V); - } else { - Attributes ParmI = Attrs & Attribute::FunctionOnly; - Assert1(!ParmI, "Attribute " + Attribute::getAsString(ParmI) + - " only applies to return values!", V); } - + Attributes FnCheckAttr = Attrs & Attribute::FunctionOnly; + Assert1(!FnCheckAttr, "Attribute " + Attribute::getAsString(FnCheckAttr) + + " only applies to return values!", V); + for (unsigned i = 0; i < array_lengthof(Attribute::MutuallyIncompatible); ++i) { Attributes MutI = Attrs & Attribute::MutuallyIncompatible[i]; @@ -477,7 +476,7 @@ } Attributes FAttrs = Attrs.getFnAttributes(); - Assert1(!(FAttrs & (!Attribute::FunctionOnly)), + Assert1(!(FAttrs & (~Attribute::FunctionOnly)), "Attribute " + Attribute::getAsString(FAttrs) + " does not apply to function!", V); From daniel at zuster.org Fri Oct 3 16:24:52 2008 From: daniel at zuster.org (Daniel Dunbar) Date: Fri, 03 Oct 2008 21:24:52 -0000 Subject: [llvm-commits] [llvm] r57030 - /llvm/trunk/Makefile.rules Message-ID: <200810032124.m93LOqfj014876@zion.cs.uiuc.edu> Author: ddunbar Date: Fri Oct 3 16:24:52 2008 New Revision: 57030 URL: http://llvm.org/viewvc/llvm-project?rev=57030&view=rev Log: Another dependency fix, prevent ObjDir from having trailing slash. - It turns out this is enough to completely break dependency file (.d) usage (at least for my gmake). Modified: llvm/trunk/Makefile.rules Modified: llvm/trunk/Makefile.rules URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/Makefile.rules?rev=57030&r1=57029&r2=57030&view=diff ============================================================================== --- llvm/trunk/Makefile.rules (original) +++ llvm/trunk/Makefile.rules Fri Oct 3 16:24:52 2008 @@ -318,7 +318,14 @@ endif ObjRootDir := $(PROJ_OBJ_DIR)/$(BuildMode) -ObjDir := $(ObjRootDir)/$(TargetMode) +# It is very important that ObjDir not have an extra trailing +# slash. This ends up changing the rules so that dependency file (.d) +# information is not used at all! +ifeq ($(TargetMode),) + ObjDir := $(ObjRootDir) +else + ObjDir := $(ObjRootDir)/$(TargetMode) +endif LibDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/$(TargetMode)/lib ToolDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/$(TargetMode)/bin ExmplDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/$(TargetMode)/examples From foldr at codedgers.com Fri Oct 3 16:24:44 2008 From: foldr at codedgers.com (Mikhail Glushenkov) Date: Fri, 3 Oct 2008 21:24:44 +0000 (UTC) Subject: [llvm-commits] =?utf-8?q?=5Bllvm=5D_r57000_-_in_/llvm/trunk/tools?= =?utf-8?q?/llvmc2=3A=09Makefile_core/_core/Action=2Ecpp_core/Compi?= =?utf-8?q?lationGraph=2Ecpp=09core/Error=2Eh_core/Makefile_core/Pl?= =?utf-8?q?ugin=2Ecpp_core/llvmc=2Ecpp=09src/Action=2Ecpp_src/Compi?= =?utf-8?q?lationGraph=2Ecpp_src/Error=2Eh=09src/Makefile_src/Pl?= References: <6a8523d60810031341h3bd751c5j4bb0bfe579cca349@mail.gmail.com> Message-ID: Daniel Dunbar writes: > > "core" probably isn't a very good name, the makefiles try > to remove "core" by default > [...] > > What about just "lib"? Well, technically it's not a library, but an executable. I renamed it to "driver". From foldr at codedgers.com Fri Oct 3 16:26:27 2008 From: foldr at codedgers.com (Mikhail Glushenkov) Date: Fri, 03 Oct 2008 21:26:27 -0000 Subject: [llvm-commits] [llvm] r57031 - in /llvm/trunk/tools/llvmc2: Makefile core/Action.cpp core/CompilationGraph.cpp core/Error.h core/Makefile core/Plugin.cpp core/llvmc.cpp driver/ driver/Action.cpp driver/CompilationGraph.cpp driver/Error.h driver/Makefile driver/Plugin.cpp driver/llvmc.cpp Message-ID: <200810032126.m93LQR9H014955@zion.cs.uiuc.edu> Author: foldr Date: Fri Oct 3 16:26:27 2008 New Revision: 57031 URL: http://llvm.org/viewvc/llvm-project?rev=57031&view=rev Log: Rename llvmc2/core to llvmc2/driver. Makefiles try to remove 'core' by default, so it wasn't a very good name. Added: llvm/trunk/tools/llvmc2/driver/ llvm/trunk/tools/llvmc2/driver/Action.cpp - copied, changed from r57029, llvm/trunk/tools/llvmc2/core/Action.cpp llvm/trunk/tools/llvmc2/driver/CompilationGraph.cpp - copied, changed from r57029, llvm/trunk/tools/llvmc2/core/CompilationGraph.cpp llvm/trunk/tools/llvmc2/driver/Error.h - copied, changed from r57029, llvm/trunk/tools/llvmc2/core/Error.h llvm/trunk/tools/llvmc2/driver/Makefile - copied, changed from r57029, llvm/trunk/tools/llvmc2/core/Makefile llvm/trunk/tools/llvmc2/driver/Plugin.cpp - copied, changed from r57029, llvm/trunk/tools/llvmc2/core/Plugin.cpp llvm/trunk/tools/llvmc2/driver/llvmc.cpp - copied, changed from r57029, llvm/trunk/tools/llvmc2/core/llvmc.cpp Removed: llvm/trunk/tools/llvmc2/core/Action.cpp llvm/trunk/tools/llvmc2/core/CompilationGraph.cpp llvm/trunk/tools/llvmc2/core/Error.h llvm/trunk/tools/llvmc2/core/Makefile llvm/trunk/tools/llvmc2/core/Plugin.cpp llvm/trunk/tools/llvmc2/core/llvmc.cpp Modified: llvm/trunk/tools/llvmc2/Makefile Modified: llvm/trunk/tools/llvmc2/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/Makefile?rev=57031&r1=57030&r2=57031&view=diff ============================================================================== --- llvm/trunk/tools/llvmc2/Makefile (original) +++ llvm/trunk/tools/llvmc2/Makefile Fri Oct 3 16:26:27 2008 @@ -11,7 +11,7 @@ BUILTIN_PLUGINS = Base DRIVER_NAME = llvmc2 -DIRS = plugins core +DIRS = plugins driver export BUILTIN_PLUGINS export DRIVER_NAME Removed: llvm/trunk/tools/llvmc2/core/Action.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/core/Action.cpp?rev=57030&view=auto ============================================================================== --- llvm/trunk/tools/llvmc2/core/Action.cpp (original) +++ llvm/trunk/tools/llvmc2/core/Action.cpp (removed) @@ -1,78 +0,0 @@ -//===--- Action.cpp - The LLVM Compiler Driver ------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open -// Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// Action class - implementation and auxiliary functions. -// -//===----------------------------------------------------------------------===// - -#include "llvm/CompilerDriver/Action.h" - -#include "llvm/Support/CommandLine.h" -#include "llvm/System/Program.h" - -#include -#include - -using namespace llvm; -using namespace llvmc; - -extern cl::opt DryRun; -extern cl::opt VerboseMode; - -namespace { - int ExecuteProgram(const std::string& name, - const StrVector& args) { - sys::Path prog = sys::Program::FindProgramByName(name); - - if (prog.isEmpty()) - throw std::runtime_error("Can't find program '" + name + "'"); - if (!prog.canExecute()) - throw std::runtime_error("Program '" + name + "' is not executable."); - - // Build the command line vector and the redirects array. - const sys::Path* redirects[3] = {0,0,0}; - sys::Path stdout_redirect; - - std::vector argv; - argv.reserve((args.size()+2)); - argv.push_back(name.c_str()); - - for (StrVector::const_iterator B = args.begin(), E = args.end(); - B!=E; ++B) { - if (*B == ">") { - ++B; - stdout_redirect.set(*B); - redirects[1] = &stdout_redirect; - } - else { - argv.push_back((*B).c_str()); - } - } - argv.push_back(0); // null terminate list. - - // Invoke the program. - return sys::Program::ExecuteAndWait(prog, &argv[0], 0, &redirects[0]); - } - - void print_string (const std::string& str) { - std::cerr << str << ' '; - } -} - -int llvmc::Action::Execute() const { - if (DryRun || VerboseMode) { - std::cerr << Command_ << " "; - std::for_each(Args_.begin(), Args_.end(), print_string); - std::cerr << '\n'; - } - if (DryRun) - return 0; - else - return ExecuteProgram(Command_, Args_); -} Removed: llvm/trunk/tools/llvmc2/core/CompilationGraph.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/core/CompilationGraph.cpp?rev=57030&view=auto ============================================================================== --- llvm/trunk/tools/llvmc2/core/CompilationGraph.cpp (original) +++ llvm/trunk/tools/llvmc2/core/CompilationGraph.cpp (removed) @@ -1,442 +0,0 @@ -//===--- CompilationGraph.cpp - The LLVM Compiler Driver --------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open -// Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// Compilation graph - implementation. -// -//===----------------------------------------------------------------------===// - -#include "Error.h" -#include "llvm/CompilerDriver/CompilationGraph.h" - -#include "llvm/ADT/STLExtras.h" -#include "llvm/Support/CommandLine.h" -#include "llvm/Support/DOTGraphTraits.h" -#include "llvm/Support/GraphWriter.h" - -#include -#include -#include -#include -#include - -using namespace llvm; -using namespace llvmc; - -extern cl::list InputFilenames; -extern cl::opt OutputFilename; -extern cl::list Languages; - -namespace llvmc { - - const std::string& LanguageMap::GetLanguage(const sys::Path& File) const { - LanguageMap::const_iterator Lang = this->find(File.getSuffix()); - if (Lang == this->end()) - throw std::runtime_error("Unknown suffix: " + File.getSuffix()); - return Lang->second; - } -} - -namespace { - - /// ChooseEdge - Return the edge with the maximum weight. - template - const Edge* ChooseEdge(const C& EdgesContainer, - const InputLanguagesSet& InLangs, - const std::string& NodeName = "root") { - const Edge* MaxEdge = 0; - unsigned MaxWeight = 0; - bool SingleMax = true; - - for (typename C::const_iterator B = EdgesContainer.begin(), - E = EdgesContainer.end(); B != E; ++B) { - const Edge* e = B->getPtr(); - unsigned EW = e->Weight(InLangs); - if (EW > MaxWeight) { - MaxEdge = e; - MaxWeight = EW; - SingleMax = true; - } else if (EW == MaxWeight) { - SingleMax = false; - } - } - - if (!SingleMax) - throw std::runtime_error("Node " + NodeName + - ": multiple maximal outward edges found!" - " Most probably a specification error."); - if (!MaxEdge) - throw std::runtime_error("Node " + NodeName + - ": no maximal outward edge found!" - " Most probably a specification error."); - return MaxEdge; - } - -} - -CompilationGraph::CompilationGraph() { - NodesMap["root"] = Node(this); -} - -Node& CompilationGraph::getNode(const std::string& ToolName) { - nodes_map_type::iterator I = NodesMap.find(ToolName); - if (I == NodesMap.end()) - throw std::runtime_error("Node " + ToolName + " is not in the graph"); - return I->second; -} - -const Node& CompilationGraph::getNode(const std::string& ToolName) const { - nodes_map_type::const_iterator I = NodesMap.find(ToolName); - if (I == NodesMap.end()) - throw std::runtime_error("Node " + ToolName + " is not in the graph!"); - return I->second; -} - -// Find the tools list corresponding to the given language name. -const CompilationGraph::tools_vector_type& -CompilationGraph::getToolsVector(const std::string& LangName) const -{ - tools_map_type::const_iterator I = ToolsMap.find(LangName); - if (I == ToolsMap.end()) - throw std::runtime_error("No tool corresponding to the language " - + LangName + " found"); - return I->second; -} - -void CompilationGraph::insertNode(Tool* V) { - if (NodesMap.count(V->Name()) == 0) { - Node N; - N.OwningGraph = this; - N.ToolPtr = V; - NodesMap[V->Name()] = N; - } -} - -void CompilationGraph::insertEdge(const std::string& A, Edge* Edg) { - Node& B = getNode(Edg->ToolName()); - if (A == "root") { - const char** InLangs = B.ToolPtr->InputLanguages(); - for (;*InLangs; ++InLangs) - ToolsMap[*InLangs].push_back(IntrusiveRefCntPtr(Edg)); - NodesMap["root"].AddEdge(Edg); - } - else { - Node& N = getNode(A); - N.AddEdge(Edg); - } - // Increase the inward edge counter. - B.IncrInEdges(); -} - -namespace { - sys::Path MakeTempFile(const sys::Path& TempDir, const std::string& BaseName, - const std::string& Suffix) { - sys::Path Out; - - // Make sure we don't end up with path names like '/file.o' if the - // TempDir is empty. - if (TempDir.empty()) { - Out.set(BaseName); - } - else { - Out = TempDir; - Out.appendComponent(BaseName); - } - Out.appendSuffix(Suffix); - // NOTE: makeUnique always *creates* a unique temporary file, - // which is good, since there will be no races. However, some - // tools do not like it when the output file already exists, so - // they have to be placated with -f or something like that. - Out.makeUnique(true, NULL); - return Out; - } -} - -// Pass input file through the chain until we bump into a Join node or -// a node that says that it is the last. -void CompilationGraph::PassThroughGraph (const sys::Path& InFile, - const Node* StartNode, - const InputLanguagesSet& InLangs, - const sys::Path& TempDir, - const LanguageMap& LangMap) const { - bool Last = false; - sys::Path In = InFile; - const Node* CurNode = StartNode; - - while(!Last) { - sys::Path Out; - Tool* CurTool = CurNode->ToolPtr.getPtr(); - - if (CurTool->IsJoin()) { - JoinTool& JT = dynamic_cast(*CurTool); - JT.AddToJoinList(In); - break; - } - - // Since toolchains do not have to end with a Join node, we should - // check if this Node is the last. - if (!CurNode->HasChildren() || CurTool->IsLast()) { - if (!OutputFilename.empty()) { - Out.set(OutputFilename); - } - else { - Out.set(In.getBasename()); - Out.appendSuffix(CurTool->OutputSuffix()); - } - Last = true; - } - else { - Out = MakeTempFile(TempDir, In.getBasename(), CurTool->OutputSuffix()); - } - - if (int ret = CurTool->GenerateAction(In, Out, InLangs, LangMap).Execute()) - throw error_code(ret); - - if (Last) - return; - - CurNode = &getNode(ChooseEdge(CurNode->OutEdges, - InLangs, - CurNode->Name())->ToolName()); - In = Out; Out.clear(); - } -} - -// Find the head of the toolchain corresponding to the given file. -// Also, insert an input language into InLangs. -const Node* CompilationGraph:: -FindToolChain(const sys::Path& In, const std::string* ForceLanguage, - InputLanguagesSet& InLangs, const LanguageMap& LangMap) const { - - // Determine the input language. - const std::string& InLanguage = - ForceLanguage ? *ForceLanguage : LangMap.GetLanguage(In); - - // Add the current input language to the input language set. - InLangs.insert(InLanguage); - - // Find the toolchain for the input language. - const tools_vector_type& TV = getToolsVector(InLanguage); - if (TV.empty()) - throw std::runtime_error("No toolchain corresponding to language " - + InLanguage + " found"); - return &getNode(ChooseEdge(TV, InLangs)->ToolName()); -} - -// Helper function used by Build(). -// Traverses initial portions of the toolchains (up to the first Join node). -// This function is also responsible for handling the -x option. -void CompilationGraph::BuildInitial (InputLanguagesSet& InLangs, - const sys::Path& TempDir, - const LanguageMap& LangMap) { - // This is related to -x option handling. - cl::list::const_iterator xIter = Languages.begin(), - xBegin = xIter, xEnd = Languages.end(); - bool xEmpty = true; - const std::string* xLanguage = 0; - unsigned xPos = 0, xPosNext = 0, filePos = 0; - - if (xIter != xEnd) { - xEmpty = false; - xPos = Languages.getPosition(xIter - xBegin); - cl::list::const_iterator xNext = llvm::next(xIter); - xPosNext = (xNext == xEnd) ? std::numeric_limits::max() - : Languages.getPosition(xNext - xBegin); - xLanguage = (*xIter == "none") ? 0 : &(*xIter); - } - - // For each input file: - for (cl::list::const_iterator B = InputFilenames.begin(), - CB = B, E = InputFilenames.end(); B != E; ++B) { - sys::Path In = sys::Path(*B); - - // Code for handling the -x option. - // Output: std::string* xLanguage (can be NULL). - if (!xEmpty) { - filePos = InputFilenames.getPosition(B - CB); - - if (xPos < filePos) { - if (filePos < xPosNext) { - xLanguage = (*xIter == "none") ? 0 : &(*xIter); - } - else { // filePos >= xPosNext - // Skip xIters while filePos > xPosNext - while (filePos > xPosNext) { - ++xIter; - xPos = xPosNext; - - cl::list::const_iterator xNext = llvm::next(xIter); - if (xNext == xEnd) - xPosNext = std::numeric_limits::max(); - else - xPosNext = Languages.getPosition(xNext - xBegin); - xLanguage = (*xIter == "none") ? 0 : &(*xIter); - } - } - } - } - - // Find the toolchain corresponding to this file. - const Node* N = FindToolChain(In, xLanguage, InLangs, LangMap); - // Pass file through the chain starting at head. - PassThroughGraph(In, N, InLangs, TempDir, LangMap); - } -} - -// Sort the nodes in topological order. -void CompilationGraph::TopologicalSort(std::vector& Out) { - std::queue Q; - Q.push(&getNode("root")); - - while (!Q.empty()) { - const Node* A = Q.front(); - Q.pop(); - Out.push_back(A); - for (Node::const_iterator EB = A->EdgesBegin(), EE = A->EdgesEnd(); - EB != EE; ++EB) { - Node* B = &getNode((*EB)->ToolName()); - B->DecrInEdges(); - if (B->HasNoInEdges()) - Q.push(B); - } - } -} - -namespace { - bool NotJoinNode(const Node* N) { - return N->ToolPtr ? !N->ToolPtr->IsJoin() : true; - } -} - -// Call TopologicalSort and filter the resulting list to include -// only Join nodes. -void CompilationGraph:: -TopologicalSortFilterJoinNodes(std::vector& Out) { - std::vector TopSorted; - TopologicalSort(TopSorted); - std::remove_copy_if(TopSorted.begin(), TopSorted.end(), - std::back_inserter(Out), NotJoinNode); -} - -int CompilationGraph::Build (const sys::Path& TempDir, - const LanguageMap& LangMap) { - - InputLanguagesSet InLangs; - - // Traverse initial parts of the toolchains and fill in InLangs. - BuildInitial(InLangs, TempDir, LangMap); - - std::vector JTV; - TopologicalSortFilterJoinNodes(JTV); - - // For all join nodes in topological order: - for (std::vector::iterator B = JTV.begin(), E = JTV.end(); - B != E; ++B) { - - sys::Path Out; - const Node* CurNode = *B; - JoinTool* JT = &dynamic_cast(*CurNode->ToolPtr.getPtr()); - bool IsLast = false; - - // Are there any files in the join list? - if (JT->JoinListEmpty()) - continue; - - // Is this the last tool in the toolchain? - // NOTE: we can process several toolchains in parallel. - if (!CurNode->HasChildren() || JT->IsLast()) { - if (OutputFilename.empty()) { - Out.set("a"); - Out.appendSuffix(JT->OutputSuffix()); - } - else - Out.set(OutputFilename); - IsLast = true; - } - else { - Out = MakeTempFile(TempDir, "tmp", JT->OutputSuffix()); - } - - if (int ret = JT->GenerateAction(Out, InLangs, LangMap).Execute()) - throw error_code(ret); - - if (!IsLast) { - const Node* NextNode = - &getNode(ChooseEdge(CurNode->OutEdges, InLangs, - CurNode->Name())->ToolName()); - PassThroughGraph(Out, NextNode, InLangs, TempDir, LangMap); - } - } - - return 0; -} - -// Code related to graph visualization. - -namespace llvm { - template <> - struct DOTGraphTraits - : public DefaultDOTGraphTraits - { - - template - static std::string getNodeLabel(const Node* N, const GraphType&) - { - if (N->ToolPtr) - if (N->ToolPtr->IsJoin()) - return N->Name() + "\n (join" + - (N->HasChildren() ? ")" - : std::string(": ") + N->ToolPtr->OutputLanguage() + ')'); - else - return N->Name(); - else - return "root"; - } - - template - static std::string getEdgeSourceLabel(const Node* N, EdgeIter I) { - if (N->ToolPtr) { - return N->ToolPtr->OutputLanguage(); - } - else { - const char** InLangs = I->ToolPtr->InputLanguages(); - std::string ret; - - for (; *InLangs; ++InLangs) { - if (*(InLangs + 1)) { - ret += *InLangs; - ret += ", "; - } - else { - ret += *InLangs; - } - } - - return ret; - } - } - }; - -} - -void CompilationGraph::writeGraph() { - std::ofstream O("compilation-graph.dot"); - - if (O.good()) { - llvm::WriteGraph(this, "compilation-graph"); - O.close(); - } - else { - throw std::runtime_error("Error opening file 'compilation-graph.dot'" - " for writing!"); - } -} - -void CompilationGraph::viewGraph() { - llvm::ViewGraph(this, "compilation-graph"); -} Removed: llvm/trunk/tools/llvmc2/core/Error.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/core/Error.h?rev=57030&view=auto ============================================================================== --- llvm/trunk/tools/llvmc2/core/Error.h (original) +++ llvm/trunk/tools/llvmc2/core/Error.h (removed) @@ -1,33 +0,0 @@ -//===--- Error.h - The LLVM Compiler Driver ---------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open -// Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// Exception classes for LLVMC. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_TOOLS_LLVMC2_ERROR_H -#define LLVM_TOOLS_LLVMC2_ERROR_H - -#include - -namespace llvmc { - - class error_code: public std::runtime_error { - int Code_; - public: - error_code (int c) - : std::runtime_error("Tool returned error code"), Code_(c) - {} - - int code() const { return Code_; } - }; - -} - -#endif //LLVM_TOOLS_LLVMC2_ERROR_H Removed: llvm/trunk/tools/llvmc2/core/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/core/Makefile?rev=57030&view=auto ============================================================================== --- llvm/trunk/tools/llvmc2/core/Makefile (original) +++ llvm/trunk/tools/llvmc2/core/Makefile (removed) @@ -1,19 +0,0 @@ -##===- tools/llvmc2/src/Makefile ---------------------------*- Makefile -*-===## -# -# The LLVM Compiler Infrastructure -# -# This file is distributed under the University of Illinois Open -# Source License. See LICENSE.TXT for details. -# -##===----------------------------------------------------------------------===## - -LEVEL = ../../.. -TOOLNAME = $(DRIVER_NAME) -LINK_COMPONENTS = support system -REQUIRES_EH := 1 - -ifneq ($(BUILTIN_PLUGINS),) -USEDLIBS = $(patsubst %,LLVMC%,$(BUILTIN_PLUGINS)) -endif - -include $(LEVEL)/Makefile.common Removed: llvm/trunk/tools/llvmc2/core/Plugin.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/core/Plugin.cpp?rev=57030&view=auto ============================================================================== --- llvm/trunk/tools/llvmc2/core/Plugin.cpp (original) +++ llvm/trunk/tools/llvmc2/core/Plugin.cpp (removed) @@ -1,64 +0,0 @@ -//===--- Plugin.cpp - The LLVM Compiler Driver ------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open -// Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// Plugin support for llvmc2. -// -//===----------------------------------------------------------------------===// - -#include "llvm/CompilerDriver/Plugin.h" - -#include - -namespace { - - // Registry::Add<> does not do lifetime management (probably issues - // with static constructor/destructor ordering), so we have to - // implement it here. - // - // All this static registration/life-before-main model seems - // unnecessary convoluted to me. - - static bool pluginListInitialized = false; - typedef std::vector PluginList; - static PluginList Plugins; -} - -namespace llvmc { - - PluginLoader::PluginLoader() { - if (!pluginListInitialized) { - for (PluginRegistry::iterator B = PluginRegistry::begin(), - E = PluginRegistry::end(); B != E; ++B) - Plugins.push_back(B->instantiate()); - } - pluginListInitialized = true; - } - - PluginLoader::~PluginLoader() { - if (pluginListInitialized) { - for (PluginList::iterator B = Plugins.begin(), E = Plugins.end(); - B != E; ++B) - delete (*B); - } - pluginListInitialized = false; - } - - void PluginLoader::PopulateLanguageMap(LanguageMap& langMap) { - for (PluginList::iterator B = Plugins.begin(), E = Plugins.end(); - B != E; ++B) - (*B)->PopulateLanguageMap(langMap); - } - - void PluginLoader::PopulateCompilationGraph(CompilationGraph& graph) { - for (PluginList::iterator B = Plugins.begin(), E = Plugins.end(); - B != E; ++B) - (*B)->PopulateCompilationGraph(graph); - } - -} Removed: llvm/trunk/tools/llvmc2/core/llvmc.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/core/llvmc.cpp?rev=57030&view=auto ============================================================================== --- llvm/trunk/tools/llvmc2/core/llvmc.cpp (original) +++ llvm/trunk/tools/llvmc2/core/llvmc.cpp (removed) @@ -1,119 +0,0 @@ -//===--- llvmc.cpp - The LLVM Compiler Driver -------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open -// Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This tool provides a single point of access to the LLVM -// compilation tools. It has many options. To discover the options -// supported please refer to the tools' manual page or run the tool -// with the --help option. -// -//===----------------------------------------------------------------------===// - -#include "Error.h" - -#include "llvm/CompilerDriver/CompilationGraph.h" -#include "llvm/CompilerDriver/Plugin.h" - -#include "llvm/System/Path.h" -#include "llvm/Support/CommandLine.h" -#include "llvm/Support/PluginLoader.h" - -#include -#include -#include - -namespace cl = llvm::cl; -namespace sys = llvm::sys; -using namespace llvmc; - -// Built-in command-line options. -// External linkage here is intentional. - -cl::list InputFilenames(cl::Positional, cl::desc(""), - cl::ZeroOrMore); -cl::opt OutputFilename("o", cl::desc("Output file name"), - cl::value_desc("file")); -cl::list Languages("x", - cl::desc("Specify the language of the following input files"), - cl::ZeroOrMore); -cl::opt DryRun("dry-run", - cl::desc("Only pretend to run commands")); -cl::opt VerboseMode("v", - cl::desc("Enable verbose mode")); -cl::opt WriteGraph("write-graph", - cl::desc("Write compilation-graph.dot file"), - cl::Hidden); -cl::opt ViewGraph("view-graph", - cl::desc("Show compilation graph in GhostView"), - cl::Hidden); -cl::opt SaveTemps("save-temps", - cl::desc("Keep temporary files"), - cl::Hidden); - -namespace { - /// BuildTargets - A small wrapper for CompilationGraph::Build. - int BuildTargets(CompilationGraph& graph, const LanguageMap& langMap) { - int ret; - const sys::Path& tempDir = SaveTemps - ? sys::Path("") - : sys::Path(sys::Path::GetTemporaryDirectory()); - - try { - ret = graph.Build(tempDir, langMap); - } - catch(...) { - tempDir.eraseFromDisk(true); - throw; - } - - if (!SaveTemps) - tempDir.eraseFromDisk(true); - return ret; - } -} - -int main(int argc, char** argv) { - try { - LanguageMap langMap; - CompilationGraph graph; - - cl::ParseCommandLineOptions - (argc, argv, "LLVM Compiler Driver (Work In Progress)", true); - - PluginLoader Plugins; - Plugins.PopulateLanguageMap(langMap); - Plugins.PopulateCompilationGraph(graph); - - if (WriteGraph) { - graph.writeGraph(); - if (!ViewGraph) - return 0; - } - - if (ViewGraph) { - graph.viewGraph(); - return 0; - } - - if (InputFilenames.empty()) { - throw std::runtime_error("no input files"); - } - - return BuildTargets(graph, langMap); - } - catch(llvmc::error_code& ec) { - return ec.code(); - } - catch(const std::exception& ex) { - std::cerr << argv[0] << ": " << ex.what() << '\n'; - } - catch(...) { - std::cerr << argv[0] << ": unknown error!\n"; - } - return 1; -} Copied: llvm/trunk/tools/llvmc2/driver/Action.cpp (from r57029, llvm/trunk/tools/llvmc2/core/Action.cpp) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/driver/Action.cpp?p2=llvm/trunk/tools/llvmc2/driver/Action.cpp&p1=llvm/trunk/tools/llvmc2/core/Action.cpp&r1=57029&r2=57031&rev=57031&view=diff ============================================================================== (empty) Copied: llvm/trunk/tools/llvmc2/driver/CompilationGraph.cpp (from r57029, llvm/trunk/tools/llvmc2/core/CompilationGraph.cpp) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/driver/CompilationGraph.cpp?p2=llvm/trunk/tools/llvmc2/driver/CompilationGraph.cpp&p1=llvm/trunk/tools/llvmc2/core/CompilationGraph.cpp&r1=57029&r2=57031&rev=57031&view=diff ============================================================================== (empty) Copied: llvm/trunk/tools/llvmc2/driver/Error.h (from r57029, llvm/trunk/tools/llvmc2/core/Error.h) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/driver/Error.h?p2=llvm/trunk/tools/llvmc2/driver/Error.h&p1=llvm/trunk/tools/llvmc2/core/Error.h&r1=57029&r2=57031&rev=57031&view=diff ============================================================================== (empty) Copied: llvm/trunk/tools/llvmc2/driver/Makefile (from r57029, llvm/trunk/tools/llvmc2/core/Makefile) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/driver/Makefile?p2=llvm/trunk/tools/llvmc2/driver/Makefile&p1=llvm/trunk/tools/llvmc2/core/Makefile&r1=57029&r2=57031&rev=57031&view=diff ============================================================================== (empty) Copied: llvm/trunk/tools/llvmc2/driver/Plugin.cpp (from r57029, llvm/trunk/tools/llvmc2/core/Plugin.cpp) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/driver/Plugin.cpp?p2=llvm/trunk/tools/llvmc2/driver/Plugin.cpp&p1=llvm/trunk/tools/llvmc2/core/Plugin.cpp&r1=57029&r2=57031&rev=57031&view=diff ============================================================================== (empty) Copied: llvm/trunk/tools/llvmc2/driver/llvmc.cpp (from r57029, llvm/trunk/tools/llvmc2/core/llvmc.cpp) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/driver/llvmc.cpp?p2=llvm/trunk/tools/llvmc2/driver/llvmc.cpp&p1=llvm/trunk/tools/llvmc2/core/llvmc.cpp&r1=57029&r2=57031&rev=57031&view=diff ============================================================================== (empty) From evan.cheng at apple.com Fri Oct 3 16:35:35 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 3 Oct 2008 14:35:35 -0700 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 In-Reply-To: References: <200810021829.m92ITS8x014885@zion.cs.uiuc.edu> Message-ID: <4943E7F3-248C-48A4-A269-211A08DB80D9@apple.com> I don't think it's quite meant for production yet. I saw some failures when running on MultiSource. Lang? Evan On Oct 3, 2008, at 1:43 PM, Owen Anderson wrote: > Is there any data available about how this compares to the default > regalloc? When is it better/worse? > > --Owen > > On Oct 2, 2008, at 11:29 AM, Evan Cheng wrote: > >> 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;u> + this_->solution[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> + for(unsigned j=0;j> + PBQPNum min = (*c_yx)[i][0] + (*c_zx)[j][0] + (*cx)[0]; >> + for(unsigned k=1;k> + PBQPNum c = (*c_yx)[i][k] + (*c_zx)[j][k] + (*cx)[k]; >> + if ( c < min ) { >> + min = c; >> + } >> + } >> + (*delta)[i][j] = min; >> + } >> + } >> + >> + /* add delta matrix */ >> + add_pbqp_edgecosts(this_,y,z,delta); >> + >> + /* delete node x */ >> + remove_node(this_,x); >> + >> + /* simplify cost matrix c_yz */ >> + simplify_edge(this_,y,z); >> + >> + /* reorder adj. nodes */ >> + 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 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; >> + } >> + } >> + } >> + >> + /* return node and free bucket */ >> + if (min_bucket != NULL) { >> + int u; >> + >> + pbqp_remove_bucket(this_,min_bucket); >> + u = min_bucket->u; >> + free(min_bucket); >> + return u; >> + } else { >> + return -1; >> + } >> +} >> + >> + >> +/ >> ***************************************************************************** >> + * PBQP graph parsing >> + >> ****************************************************************************/ >> + >> +/* reduce pbqp problem (first phase) */ >> +static >> +void reduce_pbqp(pbqp *this_) >> +{ >> + int u; >> + >> + assert(this_ != NULL); >> + assert(this_->bucket_list != NULL); >> + >> + for(;;){ >> + >> + if (this_->bucket_list[1] != NULL) { >> + u = pop_node(this_,1); >> + apply_RI(this_,u); >> + } else if (this_->bucket_list[2] != NULL) { >> + u = pop_node(this_,2); >> + apply_RII(this_,u); >> + } else if ((u = pop_colorablenode(this_)) != -1) { >> + apply_RN(this_,u); >> + } else { >> + break; >> + } >> + } >> +} >> + >> +/ >> ***************************************************************************** >> + * PBQP back propagation >> + >> ****************************************************************************/ >> + >> +/* determine solution of a reduced node. Either >> + RI or RII was applied for this_ node. */ >> +static >> +void determine_solution(pbqp *this_,int x) >> +{ >> + PBQPVector *v = new PBQPVector(*this_ -> node_costs[x]); >> + adjnode *adj_ptr; >> + >> + assert(this_ != NULL); >> + assert(x >= 0 && x < this_->num_nodes); >> + assert(this_ -> adj_list != NULL); >> + assert(this_ -> solution != NULL); >> + >> + for(adj_ptr=this_->adj_list[x] ;adj_ptr != NULL; adj_ptr = >> adj_ptr -> succ) { >> + int y = adj_ptr -> adj; >> + int y_sol = this_ -> solution[y]; >> + >> + PBQPMatrix *c_yx = pbqp_get_costmatrix(this_,y,x); >> + assert(y_sol >= 0 && y_sol < (int)this_->node_costs[y]- >> >getLength()); >> + (*v) += c_yx->getRowAsVector(y_sol); >> + delete c_yx; >> + } >> + this_ -> solution[x] = v->minIndex(); >> + >> + delete v; >> +} >> + >> +/* back popagation phase of PBQP */ >> +static >> +void back_propagate(pbqp *this_) >> +{ >> + int i; >> + >> + assert(this_ != NULL); >> + assert(this_->stack != NULL); >> + assert(this_->stack_ptr < this_->num_nodes); >> + >> + for(i=this_ -> stack_ptr-1;i>=0;i--) { >> + int x = this_ -> stack[i]; >> + assert( x >= 0 && x < this_ -> num_nodes); >> + reinsert_node(this_,x); >> + determine_solution(this_,x); >> + } >> +} >> + >> +/* solve trivial nodes of degree zero */ >> +static >> +void determine_trivialsolution(pbqp *this_) >> +{ >> + int u; >> + PBQPNum delta; >> + >> + assert( this_ != NULL); >> + assert( this_ -> bucket_list != NULL); >> + >> + /* determine trivial solution */ >> + while (this_->bucket_list[0] != NULL) { >> + u = pop_node(this_,0); >> + >> + assert( u >= 0 && u < this_ -> num_nodes); >> + >> + this_->solution[u] = this_->node_costs[u]->minIndex(); >> + delta = (*this_->node_costs[u])[this_->solution[u]]; >> + this_->min = this_->min + delta; >> + >> + /* increment counter for number statistic */ >> + this_->num_r0++; >> + } >> +} >> + >> +/ >> ***************************************************************************** >> + * debug facilities >> + >> ****************************************************************************/ >> +static >> +void check_pbqp(pbqp *this_) >> +{ >> + int u,v; >> + PBQPMatrix *costs; >> + adjnode *adj_ptr; >> + >> + assert( this_ != NULL); >> + >> + for(u=0;u< this_->num_nodes; u++) { >> + assert (this_ -> node_costs[u] != NULL); >> + for(adj_ptr = this_ -> adj_list[u];adj_ptr != NULL; adj_ptr = >> adj_ptr -> succ) { >> + v = adj_ptr -> adj; >> + assert( v>= 0 && v < this_->num_nodes); >> + if (u < v ) { >> + costs = adj_ptr -> costs; >> + assert( costs->getRows() == this_->node_costs[u]->getLength() && >> + costs->getCols() == this_->node_costs[v]->getLength()); >> + } >> + } >> + } >> +} >> + >> +/ >> ***************************************************************************** >> + * PBQP solve routines >> + >> ****************************************************************************/ >> + >> +/* solve PBQP problem */ >> +void solve_pbqp(pbqp *this_) >> +{ >> + assert(this_ != NULL); >> + assert(!this_->solved); >> + >> + /* check vector & matrix dimensions */ >> + check_pbqp(this_); >> + >> + /* simplify PBQP problem */ >> + >> + /* eliminate trivial nodes, i.e. >> + nodes with cost vectors of length one. */ >> + eliminate_trivial_nodes(this_); >> + >> + /* eliminate edges with independent >> + cost matrices and normalize matrices */ >> + eliminate_independent_edges(this_); >> + >> + /* create bucket list for graph parsing */ >> + create_bucketlist(this_); >> + >> + /* reduce phase */ >> + reduce_pbqp(this_); >> + >> + /* solve trivial nodes */ >> + determine_trivialsolution(this_); >> + >> + /* back propagation phase */ >> + back_propagate(this_); >> + >> + this_->solved = true; >> +} >> + >> +/* get solution of a node */ >> +int get_pbqp_solution(pbqp *this_,int x) >> +{ >> + assert(this_ != NULL); >> + assert(this_->solution != NULL); >> + assert(this_ -> solved); >> + >> + return this_->solution[x]; >> +} >> + >> +/* is solution optimal? */ >> +bool is_pbqp_optimal(pbqp *this_) >> +{ >> + assert(this_ -> solved); >> + return this_->optimal; >> +} >> + >> +} >> + >> +/* end of pbqp.c */ >> >> Added: llvm/trunk/lib/CodeGen/PBQP.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PBQP.h?rev=56959&view=auto >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/CodeGen/PBQP.h (added) >> +++ llvm/trunk/lib/CodeGen/PBQP.h Thu Oct 2 13:29:27 2008 >> @@ -0,0 +1,284 @@ >> +//===---------------- 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 >> +// >> = >> = >> = >> ----------------------------------------------------------------------= >> ==// >> + >> +// TODO: >> +// >> +// * Default to null costs on vector initialisation? >> +// * C++-ify the rest of the solver. >> + >> +#ifndef LLVM_CODEGEN_PBQPSOLVER_H >> +#define LLVM_CODEGEN_PBQPSOLVER_H >> + >> +#include >> +#include >> +#include >> + >> +namespace llvm { >> + >> +//! \brief Floating point type to use in PBQP solver. >> +typedef double PBQPNum; >> + >> +//! \brief PBQP Vector class. >> +class PBQPVector { >> +public: >> + >> + //! \brief Construct a PBQP vector of the given size. >> + explicit PBQPVector(unsigned length) : >> + length(length), data(new PBQPNum[length]) { >> + std::fill(data, data + length, 0); >> + } >> + >> + //! \brief Copy construct a PBQP vector. >> + PBQPVector(const PBQPVector &v) : >> + length(v.length), data(new PBQPNum[length]) { >> + std::copy(v.data, v.data + length, data); >> + } >> + >> + ~PBQPVector() { delete[] data; } >> + >> + //! \brief Assignment operator. >> + PBQPVector& operator=(const PBQPVector &v) { >> + delete[] data; >> + length = v.length; >> + data = new PBQPNum[length]; >> + std::copy(v.data, v.data + length, data); >> + return *this; >> + } >> + >> + //! \brief Return the length of the vector >> + unsigned getLength() const throw () { >> + return length; >> + } >> + >> + //! \brief Element access. >> + PBQPNum& operator[](unsigned index) { >> + assert(index < length && "PBQPVector element access out of >> bounds."); >> + return data[index]; >> + } >> + >> + //! \brief Const element access. >> + const PBQPNum& operator[](unsigned index) const { >> + assert(index < length && "PBQPVector element access out of >> bounds."); >> + return data[index]; >> + } >> + >> + //! \brief Add another vector to this one. >> + PBQPVector& operator+=(const PBQPVector &v) { >> + assert(length == v.length && "PBQPVector length mismatch."); >> + std::transform(data, data + length, v.data, data, >> std::plus()); >> + return *this; >> + } >> + >> + //! \brief Subtract another vector from this one. >> + PBQPVector& operator-=(const PBQPVector &v) { >> + assert(length == v.length && "PBQPVector length mismatch."); >> + std::transform(data, data + length, v.data, data, >> std::minus()); >> + return *this; >> + } >> + >> + //! \brief Returns the index of the minimum value in this vector >> + unsigned minIndex() const { >> + return std::min_element(data, data + length) - data; >> + } >> + >> +private: >> + unsigned length; >> + PBQPNum *data; >> +}; >> + >> + >> +//! \brief PBQP Matrix class >> +class PBQPMatrix { >> +public: >> + >> + //! \brief Construct a PBQP Matrix with the given dimensions. >> + PBQPMatrix(unsigned rows, unsigned cols) : >> + rows(rows), cols(cols), data(new PBQPNum[rows * cols]) { >> + std::fill(data, data + (rows * cols), 0); >> + } >> + >> + //! \brief Copy construct a PBQP matrix. >> + PBQPMatrix(const PBQPMatrix &m) : >> + rows(m.rows), cols(m.cols), data(new PBQPNum[rows * cols]) { >> + std::copy(m.data, m.data + (rows * cols), data); >> + } >> + >> + ~PBQPMatrix() { delete[] data; } >> + >> + //! \brief Assignment operator. >> + PBQPMatrix& operator=(const PBQPMatrix &m) { >> + delete[] data; >> + rows = m.rows; cols = m.cols; >> + data = new PBQPNum[rows * cols]; >> + std::copy(m.data, m.data + (rows * cols), data); >> + return *this; >> + } >> + >> + //! \brief Return the number of rows in this matrix. >> + unsigned getRows() const throw () { return rows; } >> + >> + //! \brief Return the number of cols in this matrix. >> + unsigned getCols() const throw () { return cols; } >> + >> + //! \brief Matrix element access. >> + PBQPNum* operator[](unsigned r) { >> + assert(r < rows && "Row out of bounds."); >> + return data + (r * cols); >> + } >> + >> + //! \brief Matrix element access. >> + const PBQPNum* operator[](unsigned r) const { >> + assert(r < rows && "Row out of bounds."); >> + return data + (r * cols); >> + } >> + >> + //! \brief Returns the given row as a vector. >> + PBQPVector getRowAsVector(unsigned r) const { >> + PBQPVector v(cols); >> + for (unsigned c = 0; c < cols; ++c) >> + v[c] = (*this)[r][c]; >> + return v; >> + } >> + >> + //! \brief Reset the matrix to the given value. >> + PBQPMatrix& reset(PBQPNum val = 0) { >> + std::fill(data, data + (rows * cols), val); >> + return *this; >> + } >> + >> + //! \brief Set a single row of this matrix to the given value. >> + PBQPMatrix& setRow(unsigned r, PBQPNum val) { >> + assert(r < rows && "Row out of bounds."); >> + std::fill(data + (r * cols), data + ((r + 1) * cols), val); >> + return *this; >> + } >> + >> + //! \brief Set a single column of this matrix to the given value. >> + PBQPMatrix& setCol(unsigned c, PBQPNum val) { >> + assert(c < cols && "Column out of bounds."); >> + for (unsigned r = 0; r < rows; ++r) >> + (*this)[r][c] = val; >> + return *this; >> + } >> + >> + //! \brief Matrix transpose. >> + PBQPMatrix transpose() const { >> + PBQPMatrix m(cols, rows); >> + for (unsigned r = 0; r < rows; ++r) >> + for (unsigned c = 0; c < cols; ++c) >> + m[c][r] = (*this)[r][c]; >> + return m; >> + } >> + >> + //! \brief Returns the diagonal of the matrix as a vector. >> + //! >> + //! Matrix must be square. >> + PBQPVector diagonalize() const { >> + assert(rows == cols && "Attempt to diagonalize non-square >> matrix."); >> + >> + PBQPVector v(rows); >> + for (unsigned r = 0; r < rows; ++r) >> + v[r] = (*this)[r][r]; >> + return v; >> + } >> + >> + //! \brief Add the given matrix to this one. >> + PBQPMatrix& operator+=(const PBQPMatrix &m) { >> + assert(rows == m.rows && cols == m.cols && >> + "Matrix dimensions mismatch."); >> + std::transform(data, data + (rows * cols), m.data, data, >> + std::plus()); >> + return *this; >> + } >> + >> + //! \brief Returns the minimum of the given row >> + PBQPNum getRowMin(unsigned r) const { >> + assert(r < rows && "Row out of bounds"); >> + return *std::min_element(data + (r * cols), data + ((r + 1) * >> cols)); >> + } >> + >> + //! \brief Returns the minimum of the given column >> + PBQPNum getColMin(unsigned c) const { >> + PBQPNum minElem = (*this)[0][c]; >> + for (unsigned r = 1; r < rows; ++r) >> + if ((*this)[r][c] < minElem) minElem = (*this)[r][c]; >> + return minElem; >> + } >> + >> + //! \brief Subtracts the given scalar from the elements of the >> given row. >> + PBQPMatrix& subFromRow(unsigned r, PBQPNum val) { >> + assert(r < rows && "Row out of bounds"); >> + std::transform(data + (r * cols), data + ((r + 1) * cols), >> + data + (r * cols), >> + std::bind2nd(std::minus(), val)); >> + return *this; >> + } >> + >> + //! \brief Subtracts the given scalar from the elements of the >> given column. >> + PBQPMatrix& subFromCol(unsigned c, PBQPNum val) { >> + for (unsigned r = 0; r < rows; ++r) >> + (*this)[r][c] -= val; >> + return *this; >> + } >> + >> + //! \brief Returns true if this is a zero matrix. >> + bool isZero() const { >> + return find_if(data, data + (rows * cols), >> + std::bind2nd(std::not_equal_to(), 0)) == >> + data + (rows * cols); >> + } >> + >> +private: >> + unsigned rows, cols; >> + PBQPNum *data; >> +}; >> + >> +#define EPS (1E-8) >> + >> +#ifndef PBQP_TYPE >> +#define PBQP_TYPE >> +struct pbqp; >> +typedef struct pbqp pbqp; >> +#endif >> + >> +/***************** >> + * PBQP routines * >> + *****************/ >> + >> +/* allocate pbqp problem */ >> +pbqp *alloc_pbqp(int num); >> + >> +/* add node costs */ >> +void add_pbqp_nodecosts(pbqp *this_,int u, PBQPVector *costs); >> + >> +/* add edge mat */ >> +void add_pbqp_edgecosts(pbqp *this_,int u,int v,PBQPMatrix *costs); >> + >> +/* solve PBQP problem */ >> +void solve_pbqp(pbqp *this_); >> + >> +/* get solution of a node */ >> +int get_pbqp_solution(pbqp *this_,int u); >> + >> +/* alloc PBQP */ >> +pbqp *alloc_pbqp(int num); >> + >> +/* free PBQP */ >> +void free_pbqp(pbqp *this_); >> + >> +/* is optimal */ >> +bool is_pbqp_optimal(pbqp *this_); >> + >> +} >> +#endif >> >> Added: llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp?rev=56959&view=auto >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp (added) >> +++ llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp Thu Oct 2 13:29:27 2008 >> @@ -0,0 +1,529 @@ >> +//===------ RegAllocPBQP.cpp ---- PBQP Register Allocator ------- >> *- C++ -*-===// >> +// >> +// The LLVM Compiler Infrastructure >> +// >> +// This file is distributed under the University of Illinois Open >> Source >> +// License. See LICENSE.TXT for details. >> +// >> +// >> = >> = >> = >> ----------------------------------------------------------------------= >> ==// >> +// >> +// This file contains a Partitioned Boolean Quadratic Programming >> (PBQP) based >> +// register allocator for LLVM. This allocator works by >> constructing a PBQP >> +// problem representing the register allocation problem under >> consideration, >> +// solving this using a PBQP solver, and mapping the solution back >> to a >> +// register assignment. If any variables are selected for spilling >> then spill >> +// code is inserted and the process repeated. >> +// >> +// The PBQP solver (pbqp.c) provided for this allocator uses a >> heuristic tuned >> +// for register allocation. For more information on PBQP for >> register >> +// allocation see the following papers: >> +// >> +// (1) Hames, L. and Scholz, B. 2006. Nearly optimal register >> allocation with >> +// PBQP. In Proceedings of the 7th Joint Modular Languages >> Conference >> +// (JMLC'06). LNCS, vol. 4228. Springer, New York, NY, USA. >> 346-361. >> +// >> +// (2) Scholz, B., Eckstein, E. 2002. Register allocation for >> irregular >> +// architectures. In Proceedings of the Joint Conference on >> Languages, >> +// Compilers and Tools for Embedded Systems (LCTES'02), ACM >> Press, New York, >> +// NY, USA, 139-148. >> +// >> +// Author: Lang Hames >> +// Email: lhames at gmail.com >> +// >> +// >> = >> = >> = >> ----------------------------------------------------------------------= >> ==// >> + >> +// TODO: >> +// >> +// * Use of std::set in constructPBQPProblem destroys allocation >> order preference. >> +// Switch to an order preserving container. >> +// >> +// * Coalescing support. >> + >> +#define DEBUG_TYPE "regalloc" >> + >> +#include "PBQP.h" >> +#include "VirtRegMap.h" >> +#include "llvm/CodeGen/MachineFunctionPass.h" >> +#include "llvm/CodeGen/RegAllocRegistry.h" >> +#include "llvm/CodeGen/LiveIntervalAnalysis.h" >> +#include "llvm/CodeGen/MachineRegisterInfo.h" >> +#include "llvm/CodeGen/MachineLoopInfo.h" >> +#include "llvm/Target/TargetMachine.h" >> +#include "llvm/Target/TargetInstrInfo.h" >> +#include "llvm/Support/Debug.h" >> +#include >> +#include >> +#include >> +#include >> +#include >> + >> +using namespace llvm; >> + >> +static RegisterRegAlloc >> +registerPBQPRepAlloc("pbqp", " PBQP register allocator", >> + createPBQPRegisterAllocator); >> + >> + >> +namespace { >> + >> + //! >> + //! PBQP based allocators solve the register allocation problem >> by mapping >> + //! register allocation problems to Partitioned Boolean Quadratic >> + //! Programming problems. >> + class VISIBILITY_HIDDEN PBQPRegAlloc : public >> MachineFunctionPass { >> + public: >> + >> + static char ID; >> + >> + //! Construct a PBQP register allocator. >> + PBQPRegAlloc() : MachineFunctionPass((intptr_t)&ID) {} >> + >> + //! Return the pass name. >> + virtual const char* getPassName() const throw() { >> + return "PBQP Register Allocator"; >> + } >> + >> + //! PBQP analysis usage. >> + virtual void getAnalysisUsage(AnalysisUsage &au) const { >> + au.addRequired(); >> + au.addRequired(); >> + MachineFunctionPass::getAnalysisUsage(au); >> + } >> + >> + //! Perform register allocation >> + virtual bool runOnMachineFunction(MachineFunction &MF); >> + >> + private: >> + typedef std::map LI2NodeMap; >> + typedef std::vector Node2LIMap; >> + typedef std::vector AllowedSet; >> + typedef std::vector AllowedSetMap; >> + typedef std::set IgnoreSet; >> + >> + MachineFunction *mf; >> + const TargetMachine *tm; >> + const TargetRegisterInfo *tri; >> + const TargetInstrInfo *tii; >> + const MachineLoopInfo *loopInfo; >> + MachineRegisterInfo *mri; >> + >> + LiveIntervals *li; >> + VirtRegMap *vrm; >> + >> + LI2NodeMap li2Node; >> + Node2LIMap node2LI; >> + AllowedSetMap allowedSets; >> + IgnoreSet ignoreSet; >> + >> + //! Builds a PBQP cost vector. >> + template >> + PBQPVector* buildCostVector(const Container &allowed, >> + PBQPNum spillCost) const; >> + >> + //! \brief Builds a PBQP interfernce matrix. >> + //! >> + //! @return Either a pointer to a non-zero PBQP matrix >> representing the >> + //! allocation option costs, or a null pointer for a >> zero matrix. >> + //! >> + //! Expects allowed sets for two interfering LiveIntervals. >> These allowed >> + //! sets should contain only allocable registers from the >> LiveInterval's >> + //! register class, with any interfering pre-colored registers >> removed. >> + template >> + PBQPMatrix* buildInterferenceMatrix(const Container &allowed1, >> + const Container &allowed2) >> const; >> + >> + //! >> + //! Expects allowed sets for two potentially coalescable >> LiveIntervals, >> + //! and an estimated benefit due to coalescing. The allowed >> sets should >> + //! contain only allocable registers from the LiveInterval's >> register >> + //! classes, with any interfering pre-colored registers removed. >> + template >> + PBQPMatrix* buildCoalescingMatrix(const Container &allowed1, >> + const Container &allowed2, >> + PBQPNum cBenefit) const; >> + >> + //! \brief Helper functior for constructInitialPBQPProblem(). >> + //! >> + //! This function iterates over the Function we are about to >> allocate for >> + //! and computes spill costs. >> + void calcSpillCosts(); >> + >> + //! \brief Scans the MachineFunction being allocated to find >> coalescing >> + // opportunities. >> + void findCoalescingOpportunities(); >> + >> + //! \brief Constructs a PBQP problem representation of the >> register >> + //! allocation problem for this function. >> + //! >> + //! @return a PBQP solver object for the register allocation >> problem. >> + pbqp* constructPBQPProblem(); >> + >> + //! \brief Given a solved PBQP problem maps this solution back >> to a register >> + //! assignment. >> + bool mapPBQPToRegAlloc(pbqp *problem); >> + >> + }; >> + >> + char PBQPRegAlloc::ID = 0; >> +} >> + >> + >> +template >> +PBQPVector* PBQPRegAlloc::buildCostVector(const Container &allowed, >> + PBQPNum spillCost) const { >> + >> + // Allocate vector. Additional element (0th) used for spill option >> + PBQPVector *v = new PBQPVector(allowed.size() + 1); >> + >> + (*v)[0] = spillCost; >> + >> + return v; >> +} >> + >> +template >> +PBQPMatrix* PBQPRegAlloc::buildInterferenceMatrix( >> + const Container &allowed1, const Container &allowed2) const { >> + >> + typedef typename Container::const_iterator ContainerIterator; >> + >> + // Construct a PBQP matrix representing the cost of allocation >> options. The >> + // rows and columns correspond to the allocation options for the >> two live >> + // intervals. Elements will be infinite where corresponding >> registers alias, >> + // since we cannot allocate aliasing registers to interfering >> live intervals. >> + // All other elements (non-aliasing combinations) will have zero >> cost. Note >> + // that the spill option (element 0,0) has zero cost, since we >> can allocate >> + // both intervals to memory safely (the cost for each individual >> allocation >> + // to memory is accounted for by the cost vectors for each live >> interval). >> + PBQPMatrix *m = new PBQPMatrix(allowed1.size() + 1, >> allowed2.size() + 1); >> + >> + // Assume this is a zero matrix until proven otherwise. Zero >> matrices occur >> + // between interfering live ranges with non-overlapping register >> sets (e.g. >> + // non-overlapping reg classes, or disjoint sets of allowed regs >> within the >> + // same class). The term "overlapping" is used advisedly: sets >> which do not >> + // intersect, but contain registers which alias, will have non- >> zero matrices. >> + // We optimize zero matrices away to improve solver speed. >> + bool isZeroMatrix = true; >> + >> + >> + // Row index. Starts at 1, since the 0th row is for the spill >> option, which >> + // is always zero. >> + unsigned ri = 1; >> + >> + // Iterate over allowed sets, insert infinities where required. >> + for (ContainerIterator a1Itr = allowed1.begin(), a1End = >> allowed1.end(); >> + a1Itr != a1End; ++a1Itr) { >> + >> + // Column index, starts at 1 as for row index. >> + unsigned ci = 1; >> + unsigned reg1 = *a1Itr; >> + >> + for (ContainerIterator a2Itr = allowed2.begin(), a2End = >> allowed2.end(); >> + a2Itr != a2End; ++a2Itr) { >> + >> + unsigned reg2 = *a2Itr; >> + >> + // If the row/column regs are identical or alias insert an >> infinity. >> + if ((reg1 == reg2) || tri->areAliases(reg1, reg2)) { >> + (*m)[ri][ci] = std::numeric_limits::infinity(); >> + isZeroMatrix = false; >> + } >> + >> + ++ci; >> + } >> + >> + ++ri; >> + } >> + >> + // If this turns out to be a zero matrix... >> + if (isZeroMatrix) { >> + // free it and return null. >> + delete m; >> + return 0; >> + } >> + >> + // ...otherwise return the cost matrix. >> + return m; >> +} >> + >> +void PBQPRegAlloc::calcSpillCosts() { >> + >> + // Calculate the spill cost for each live interval by iterating >> over the >> + // function counting loads and stores, with loop depth taken >> into account. >> + for (MachineFunction::const_iterator bbItr = mf->begin(), bbEnd >> = mf->end(); >> + bbItr != bbEnd; ++bbItr) { >> + >> + const MachineBasicBlock *mbb = &*bbItr; >> + float loopDepth = loopInfo->getLoopDepth(mbb); >> + >> + for (MachineBasicBlock::const_iterator >> + iItr = mbb->begin(), iEnd = mbb->end(); iItr != iEnd; + >> +iItr) { >> + >> + const MachineInstr *instr = &*iItr; >> + >> + for (unsigned opNo = 0; opNo < instr->getNumOperands(); + >> +opNo) { >> + >> + const MachineOperand &mo = instr->getOperand(opNo); >> + >> + // We're not interested in non-registers... >> + if (!mo.isRegister()) >> + continue; >> + >> + unsigned moReg = mo.getReg(); >> + >> + // ...Or invalid registers... >> + if (moReg == 0) >> + continue; >> + >> + // ...Or physical registers... >> + if (TargetRegisterInfo::isPhysicalRegister(moReg)) >> + continue; >> + >> + assert ((mo.isUse() || mo.isDef()) && >> + "Not a use, not a def, what is it?"); >> + >> + //... Just the virtual registers. We treat loads and stores as >> equal. >> + li->getInterval(moReg).weight += powf(10.0f, loopDepth); >> + } >> + >> + } >> + >> + } >> + >> +} >> + >> +pbqp* PBQPRegAlloc::constructPBQPProblem() { >> + >> + typedef std::vector LIVector; >> + typedef std::set RegSet; >> + >> + // These will store the physical & virtual intervals, >> respectively. >> + LIVector physIntervals, virtIntervals; >> + >> + // Start by clearing the old node <-> live interval mappings & >> allowed sets >> + li2Node.clear(); >> + node2LI.clear(); >> + allowedSets.clear(); >> + >> + // Iterate over intervals classifying them as physical or >> virtual, and >> + // constructing live interval <-> node number mappings. >> + for (LiveIntervals::iterator itr = li->begin(), end = li->end(); >> + itr != end; ++itr) { >> + >> + if (itr->second->getNumValNums() != 0) { >> + DOUT << "Live range has " << itr->second->getNumValNums() << >> ": " << itr->second << "\n"; >> + } >> + >> + if (TargetRegisterInfo::isPhysicalRegister(itr->first)) { >> + physIntervals.push_back(itr->second); >> + mri->setPhysRegUsed(itr->second->reg); >> + } >> + else { >> + >> + // If we've allocated this virtual register interval a stack >> slot on a >> + // previous round then it's not an allocation candidate >> + if (ignoreSet.find(itr->first) != ignoreSet.end()) >> + continue; >> + >> + li2Node[itr->second] = node2LI.size(); >> + node2LI.push_back(itr->second); >> + virtIntervals.push_back(itr->second); >> + } >> + } >> + >> + // Early out if there's no regs to allocate for. >> + if (virtIntervals.empty()) >> + return 0; >> + >> + // Construct a PBQP solver for this problem >> + pbqp *solver = alloc_pbqp(virtIntervals.size()); >> + >> + // Resize allowedSets container appropriately. >> + allowedSets.resize(virtIntervals.size()); >> + >> + // Iterate over virtual register intervals to compute allowed >> sets... >> + for (unsigned node = 0; node < node2LI.size(); ++node) { >> + >> + // Grab pointers to the interval and its register class. >> + const LiveInterval *li = node2LI[node]; >> + const TargetRegisterClass *liRC = mri->getRegClass(li->reg); >> + >> + // Start by assuming all allocable registers in the class are >> allowed... >> + RegSet liAllowed(liRC->allocation_order_begin(*mf), >> + liRC->allocation_order_end(*mf)); >> + >> + // If this range is non-empty then eliminate the physical >> registers which >> + // overlap with this range, along with all their aliases. >> + if (!li->empty()) { >> + for (LIVector::iterator pItr = physIntervals.begin(), >> + pEnd = physIntervals.end(); pItr != pEnd; ++pItr) { >> + >> + if (li->overlaps(**pItr)) { >> + >> + unsigned pReg = (*pItr)->reg; >> + >> + // Remove the overlapping reg... >> + liAllowed.erase(pReg); >> + >> + const unsigned *aliasItr = tri->getAliasSet(pReg); >> + >> + if (aliasItr != 0) { >> + // ...and its aliases. >> + for (; *aliasItr != 0; ++aliasItr) { >> + liAllowed.erase(*aliasItr); >> + } >> + >> + } >> + >> + } >> + >> + } >> + >> + } >> + >> + // Copy the allowed set into a member vector for use when >> constructing cost >> + // vectors & matrices, and mapping PBQP solutions back to >> assignments. >> + allowedSets[node] = AllowedSet(liAllowed.begin(), >> liAllowed.end()); >> + >> + // Set the spill cost to the interval weight, or epsilon if the >> + // interval weight is zero >> + PBQPNum spillCost = (li->weight != 0.0) ? >> + li->weight : std::numeric_limits::min(); >> + >> + // Build a cost vector for this interval. >> + add_pbqp_nodecosts(solver, node, >> + buildCostVector(allowedSets[node], >> spillCost)); >> + >> + } >> + >> + // Now add the cost matrices... >> + for (unsigned node1 = 0; node1 < node2LI.size(); ++node1) { >> + >> + const LiveInterval *li = node2LI[node1]; >> + >> + if (li->empty()) >> + continue; >> + >> + // Test for live range overlaps and insert interference >> matrices. >> + for (unsigned node2 = node1 + 1; node2 < node2LI.size(); + >> +node2) { >> + const LiveInterval *li2 = node2LI[node2]; >> + >> + if (li2->empty()) >> + continue; >> + >> + if (li->overlaps(*li2)) { >> + PBQPMatrix *m = >> + buildInterferenceMatrix(allowedSets[node1], >> allowedSets[node2]); >> + >> + if (m != 0) { >> + add_pbqp_edgecosts(solver, node1, node2, m); >> + delete m; >> + } >> + } >> + } >> + } >> + >> + // We're done, PBQP problem constructed - return it. >> + return solver; >> +} >> + >> +bool PBQPRegAlloc::mapPBQPToRegAlloc(pbqp *problem) { >> + >> + // Set to true if we have any spills >> + bool anotherRoundNeeded = false; >> + >> + // Clear the existing allocation. >> + vrm->clearAllVirt(); >> + >> + // Iterate over the nodes mapping the PBQP solution to a >> register assignment. >> + for (unsigned node = 0; node < node2LI.size(); ++node) { >> + unsigned symReg = node2LI[node]->reg, >> + allocSelection = get_pbqp_solution(problem, node); >> + >> + // If the PBQP solution is non-zero it's a physical register... >> + if (allocSelection != 0) { >> + // Get the physical reg, subtracting 1 to account for the >> spill option. >> + unsigned physReg = allowedSets[node][allocSelection - 1]; >> + >> + // Add to the virt reg map and update the used phys regs. >> + vrm->assignVirt2Phys(symReg, physReg); >> + mri->setPhysRegUsed(physReg); >> + } >> + // ...Otherwise it's a spill. >> + else { >> + >> + // Make sure we ignore this virtual reg on the next round >> + // of allocation >> + ignoreSet.insert(node2LI[node]->reg); >> + >> + float SSWeight; >> + >> + // Insert spill ranges for this live range >> + SmallVector spillIs; >> + std::vector newSpills = >> + li->addIntervalsForSpills(*node2LI[node], spillIs, >> loopInfo, *vrm, >> + SSWeight); >> + >> + // We need another round if spill intervals were added. >> + anotherRoundNeeded |= !newSpills.empty(); >> + } >> + } >> + >> + return !anotherRoundNeeded; >> +} >> + >> +bool PBQPRegAlloc::runOnMachineFunction(MachineFunction &MF) { >> + >> + mf = &MF; >> + tm = &mf->getTarget(); >> + tri = tm->getRegisterInfo(); >> + mri = &mf->getRegInfo(); >> + >> + li = &getAnalysis(); >> + loopInfo = &getAnalysis(); >> + >> + std::auto_ptr vrmAutoPtr(new VirtRegMap(*mf)); >> + vrm = vrmAutoPtr.get(); >> + >> + // Allocator main loop: >> + // >> + // * Map current regalloc problem to a PBQP problem >> + // * Solve the PBQP problem >> + // * Map the solution back to a register allocation >> + // * Spill if necessary >> + // >> + // This process is continued till no more spills are generated. >> + >> + bool regallocComplete = false; >> + >> + // Calculate spill costs for intervals >> + calcSpillCosts(); >> + >> + while (!regallocComplete) { >> + pbqp *problem = constructPBQPProblem(); >> + >> + // Fast out if there's no problem to solve. >> + if (problem == 0) >> + return true; >> + >> + solve_pbqp(problem); >> + >> + regallocComplete = mapPBQPToRegAlloc(problem); >> + >> + free_pbqp(problem); >> + } >> + >> + ignoreSet.clear(); >> + >> + std::auto_ptr spiller(createSpiller()); >> + >> + spiller->runOnMachineFunction(*mf, *vrm); >> + >> + return true; >> +} >> + >> +FunctionPass* llvm::createPBQPRegisterAllocator() { >> + return new PBQPRegAlloc(); >> +} >> + >> + >> +#undef DEBUG_TYPE >> >> >> _______________________________________________ >> 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 daniel at zuster.org Fri Oct 3 17:17:29 2008 From: daniel at zuster.org (Daniel Dunbar) Date: Fri, 03 Oct 2008 22:17:29 -0000 Subject: [llvm-commits] [llvm] r57032 - /llvm/trunk/docs/ProgrammersManual.html Message-ID: <200810032217.m93MHTta017122@zion.cs.uiuc.edu> Author: ddunbar Date: Fri Oct 3 17:17:25 2008 New Revision: 57032 URL: http://llvm.org/viewvc/llvm-project?rev=57032&view=rev Log: Change PointerType::get -> getUnqual Modified: llvm/trunk/docs/ProgrammersManual.html Modified: llvm/trunk/docs/ProgrammersManual.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ProgrammersManual.html?rev=57032&r1=57031&r2=57032&view=diff ============================================================================== --- llvm/trunk/docs/ProgrammersManual.html (original) +++ llvm/trunk/docs/ProgrammersManual.html Fri Oct 3 17:17:25 2008 @@ -1956,7 +1956,7 @@ BasicBlock::iterator ii(instToReplace); ReplaceInstWithValue(instToReplace->getParent()->getInstList(), ii, - Constant::getNullValue(PointerType::get(Type::Int32Ty))); + Constant::getNullValue(PointerType::getUnqual(Type::Int32Ty)));
  • ReplaceInstWithInst @@ -2091,7 +2091,7 @@ // Create the initial outer struct PATypeHolder StructTy = OpaqueType::get(); std::vector<const Type*> Elts; -Elts.push_back(PointerType::get(StructTy)); +Elts.push_back(PointerType::getUnqual(StructTy)); Elts.push_back(Type::Int32Ty); StructType *NewSTy = StructType::get(Elts); From gohman at apple.com Fri Oct 3 17:21:24 2008 From: gohman at apple.com (Dan Gohman) Date: Fri, 03 Oct 2008 22:21:24 -0000 Subject: [llvm-commits] [llvm] r57033 - /llvm/trunk/lib/Transforms/IPO/IPConstantPropagation.cpp Message-ID: <200810032221.m93MLOoP017270@zion.cs.uiuc.edu> Author: djg Date: Fri Oct 3 17:21:24 2008 New Revision: 57033 URL: http://llvm.org/viewvc/llvm-project?rev=57033&view=rev Log: Clean up some multiple-return-value code that is no longer applicable. 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=57033&r1=57032&r2=57033&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/IPConstantPropagation.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/IPConstantPropagation.cpp Fri Oct 3 17:21:24 2008 @@ -170,10 +170,6 @@ unsigned NumNonConstant = 0; for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) if (ReturnInst *RI = dyn_cast(BB->getTerminator())) { - // Return type does not match operand type, this is an old style multiple - // return - bool OldReturn = (F.getReturnType() != RI->getOperand(0)->getType()); - for (unsigned i = 0, e = RetVals.size(); i != e; ++i) { // Already found conflicting return values? Value *RV = RetVals[i]; @@ -182,7 +178,7 @@ // Find the returned value Value *V; - if (!STy || OldReturn) + if (!STy) V = RI->getOperand(i); else V = FindInsertedValue(RI->getOperand(0), i); From dalej at apple.com Fri Oct 3 17:25:52 2008 From: dalej at apple.com (Dale Johannesen) Date: Fri, 03 Oct 2008 22:25:52 -0000 Subject: [llvm-commits] [llvm] r57034 - in /llvm/trunk/lib/Target/X86: X86ISelDAGToDAG.cpp X86ISelLowering.cpp X86ISelLowering.h X86InstrInfo.td Message-ID: <200810032225.m93MPr8x017458@zion.cs.uiuc.edu> Author: johannes Date: Fri Oct 3 17:25:52 2008 New Revision: 57034 URL: http://llvm.org/viewvc/llvm-project?rev=57034&view=rev Log: Make atomic Swap work, 64-bit on x86-32. Make it all work in non-pic mode. Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.h llvm/trunk/lib/Target/X86/X86InstrInfo.td Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=57034&r1=57033&r2=57034&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Fri Oct 3 17:25:52 2008 @@ -1305,6 +1305,8 @@ return SelectAtomic64(Node, X86::ATOMNAND6432); case X86ISD::ATOMAND64_DAG: return SelectAtomic64(Node, X86::ATOMAND6432); + case X86ISD::ATOMSWAP64_DAG: + return SelectAtomic64(Node, X86::ATOMSWAP6432); case ISD::SMUL_LOHI: case ISD::UMUL_LOHI: { Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=57034&r1=57033&r2=57034&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Fri Oct 3 17:25:52 2008 @@ -6069,19 +6069,21 @@ case ISD::ATOMIC_LOAD_SUB_16: case ISD::ATOMIC_LOAD_SUB_32: return LowerLOAD_SUB(Op,DAG); case ISD::ATOMIC_LOAD_SUB_64: return (Subtarget->is64Bit()) ? - LowerLOAD_SUB(Op,DAG) : - LowerATOMIC_BINARY_64(Op,DAG, + LowerLOAD_SUB(Op,DAG) : + LowerATOMIC_BINARY_64(Op,DAG, X86ISD::ATOMSUB64_DAG); case ISD::ATOMIC_LOAD_AND_64: return LowerATOMIC_BINARY_64(Op,DAG, X86ISD::ATOMAND64_DAG); - case ISD::ATOMIC_LOAD_OR_64: return LowerATOMIC_BINARY_64(Op, DAG, + case ISD::ATOMIC_LOAD_OR_64: return LowerATOMIC_BINARY_64(Op, DAG, X86ISD::ATOMOR64_DAG); case ISD::ATOMIC_LOAD_XOR_64: return LowerATOMIC_BINARY_64(Op,DAG, X86ISD::ATOMXOR64_DAG); - case ISD::ATOMIC_LOAD_NAND_64: return LowerATOMIC_BINARY_64(Op,DAG, + case ISD::ATOMIC_LOAD_NAND_64:return LowerATOMIC_BINARY_64(Op,DAG, X86ISD::ATOMNAND64_DAG); case ISD::ATOMIC_LOAD_ADD_64: return LowerATOMIC_BINARY_64(Op,DAG, X86ISD::ATOMADD64_DAG); + case ISD::ATOMIC_SWAP_64: return LowerATOMIC_BINARY_64(Op,DAG, + X86ISD::ATOMSWAP64_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); @@ -6433,6 +6435,7 @@ // newMBB: // out1, out2 = phi (thisMBB, t1/t2) (newMBB, t3/t4) // op t5, t6 <- out1, out2, [bitinstr.val] + // (for SWAP, substitute: mov t5, t6 <- [bitinstr.val]) // mov ECX, EBX <- t5, t6 // mov EAX, EDX <- t1, t2 // cmpxchg8b [bitinstr.addr] [EAX, EDX, EBX, ECX implicit] @@ -6486,10 +6489,14 @@ (*MIB).addOperand(*argOpers[i]); unsigned t2 = F->getRegInfo().createVirtualRegister(RC); MIB = BuildMI(thisMBB, TII->get(LoadOpc), t2); - // add 4 to displacement. getImm verifies it's immediate. + // add 4 to displacement. for (int i=0; i <= lastAddrIndx-1; ++i) (*MIB).addOperand(*argOpers[i]); - MachineOperand newOp3 = MachineOperand::CreateImm(argOpers[3]->getImm()+4); + MachineOperand newOp3 = *(argOpers[3]); + if (newOp3.isImm()) + newOp3.setImm(newOp3.getImm()+4); + else + newOp3.setOffset(newOp3.getOffset()+4); (*MIB).addOperand(newOp3); // t3/4 are defined later, at the bottom of the loop @@ -6518,7 +6525,8 @@ MIB = BuildMI(newMBB, TII->get(regOpcL), t5); else MIB = BuildMI(newMBB, TII->get(immOpcL), t5); - MIB.addReg(tt1); + if (regOpcL != X86::MOV32rr) + MIB.addReg(tt1); (*MIB).addOperand(*argOpers[4]); assert(argOpers[5]->isReg() == argOpers[4]->isReg()); assert(argOpers[5]->isImm() == argOpers[4]->isImm()); @@ -6526,7 +6534,8 @@ MIB = BuildMI(newMBB, TII->get(regOpcH), t6); else MIB = BuildMI(newMBB, TII->get(immOpcH), t6); - MIB.addReg(tt2); + if (regOpcH != X86::MOV32rr) + MIB.addReg(tt2); (*MIB).addOperand(*argOpers[5]); MIB = BuildMI(newMBB, TII->get(copyOpc), X86::EAX); @@ -6943,18 +6952,21 @@ X86::AND32rr, X86::AND32rr, X86::AND32ri, X86::AND32ri, true); - // FIXME carry case X86::ATOMADD6432: return EmitAtomicBit6432WithCustomInserter(MI, BB, X86::ADD32rr, X86::ADC32rr, X86::ADD32ri, X86::ADC32ri, false); - // FIXME carry case X86::ATOMSUB6432: return EmitAtomicBit6432WithCustomInserter(MI, BB, X86::SUB32rr, X86::SBB32rr, X86::SUB32ri, X86::SBB32ri, false); + case X86::ATOMSWAP6432: + return EmitAtomicBit6432WithCustomInserter(MI, BB, + X86::MOV32rr, X86::MOV32rr, + X86::MOV32ri, X86::MOV32ri, + false); } } Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.h?rev=57034&r1=57033&r2=57034&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.h (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.h Fri Oct 3 17:25:52 2008 @@ -200,13 +200,15 @@ LCMPXCHG8_DAG, // ATOMADD64_DAG, ATOMSUB64_DAG, ATOMOR64_DAG, ATOMAND64_DAG, - // ATOMXOR64_DAG, ATOMNAND64_DAG - Atomic 64-bit binary operations. + // ATOMXOR64_DAG, ATOMNAND64_DAG, ATOMSWAP64_DAG - + // Atomic 64-bit binary operations. ATOMADD64_DAG, ATOMSUB64_DAG, ATOMOR64_DAG, ATOMXOR64_DAG, ATOMAND64_DAG, ATOMNAND64_DAG, + ATOMSWAP64_DAG, // FNSTCW16m - Store FP control world into i16 memory. FNSTCW16m, Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=57034&r1=57033&r2=57034&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Fri Oct 3 17:25:52 2008 @@ -99,6 +99,9 @@ def X86AtomNand64 : SDNode<"X86ISD::ATOMNAND64_DAG", SDTX86atomicBinary, [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>; +def X86AtomSwap64 : SDNode<"X86ISD::ATOMSWAP64_DAG", SDTX86atomicBinary, + [SDNPHasChain, SDNPMayStore, + SDNPMayLoad, SDNPMemOperand]>; def X86retflag : SDNode<"X86ISD::RET_FLAG", SDTX86Ret, [SDNPHasChain, SDNPOptInFlag]>; @@ -2772,6 +2775,9 @@ def ATOMSUB6432 : I<0, Pseudo, (outs GR32:$dst1, GR32:$dst2), (ins i64mem:$ptr, GR32:$val1, GR32:$val2), "#ATOMSUB6432 PSUEDO!", []>; +def ATOMSWAP6432 : I<0, Pseudo, (outs GR32:$dst1, GR32:$dst2), + (ins i64mem:$ptr, GR32:$val1, GR32:$val2), + "#ATOMSWAP6432 PSUEDO!", []>; } //===----------------------------------------------------------------------===// From gohman at apple.com Fri Oct 3 17:38:10 2008 From: gohman at apple.com (Dan Gohman) Date: Fri, 03 Oct 2008 22:38:10 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r57035 - /llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Message-ID: <200810032238.m93McAto017859@zion.cs.uiuc.edu> Author: djg Date: Fri Oct 3 17:38:10 2008 New Revision: 57035 URL: http://llvm.org/viewvc/llvm-project?rev=57035&view=rev Log: Recognize the way that classify_argument handles empty structs, and don't add padding return values in that case. This prevents the multiple-return-value code from emitting out-of-bounds loads in this case. This fixes SingleSource/UnitTests/2006-01-23-UnionInit.c on x86-64. Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp?rev=57035&r1=57034&r2=57035&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Fri Oct 3 17:38:10 2008 @@ -1094,6 +1094,11 @@ if (NumClasses == 1 && Class[0] == X86_64_INTEGER_CLASS) assert(0 && "This type does not need multiple return registers!"); + // classify_argument uses a single X86_64_NO_CLASS as a special case for + // empty structs. Recognize it and don't add any return values in that + // case. + if (NumClasses == 1 && Class[0] == X86_64_NO_CLASS) + return; for (int i = 0; i < NumClasses; ++i) { switch (Class[i]) { From gohman at apple.com Fri Oct 3 19:31:16 2008 From: gohman at apple.com (Dan Gohman) Date: Sat, 04 Oct 2008 00:31:16 -0000 Subject: [llvm-commits] [llvm] r57039 - in /llvm/trunk: lib/CodeGen/RegAllocLocal.cpp test/CodeGen/X86/local-liveness.ll Message-ID: <200810040031.m940VGP9021600@zion.cs.uiuc.edu> Author: djg Date: Fri Oct 3 19:31:14 2008 New Revision: 57039 URL: http://llvm.org/viewvc/llvm-project?rev=57039&view=rev Log: Fix a bug in the local allocator's liveness computation where it was setting kill flags on tied uses in two-address instructions. The kill flags were causing the allocator to think it could allocate the use and its tied def in different registers. Added: llvm/trunk/test/CodeGen/X86/local-liveness.ll Modified: llvm/trunk/lib/CodeGen/RegAllocLocal.cpp Modified: llvm/trunk/lib/CodeGen/RegAllocLocal.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocLocal.cpp?rev=57039&r1=57038&r2=57039&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocLocal.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocLocal.cpp Fri Oct 3 19:31:14 2008 @@ -651,9 +651,11 @@ // Physical registers and those that are not live-out of the block // are killed/dead at their last use/def within this block. if (isPhysReg || !usedOutsideBlock) { - if (MO.isUse()) - MO.setIsKill(true); - else + if (MO.isUse()) { + // Don't mark uses that are tied to defs as kills. + if (MI->getDesc().getOperandConstraint(idx, TOI::TIED_TO) == -1) + MO.setIsKill(true); + } else MO.setIsDead(true); } } Added: llvm/trunk/test/CodeGen/X86/local-liveness.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/local-liveness.ll?rev=57039&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/local-liveness.ll (added) +++ llvm/trunk/test/CodeGen/X86/local-liveness.ll Fri Oct 3 19:31:14 2008 @@ -0,0 +1,31 @@ +; RUN: llvm-as < %s | llc -march=x86 -regalloc=local | grep {subl %eax, %esi} + +; Local regalloc shouldn't assume that both the uses of the +; sub instruction are kills, because one of them is tied +; to an output. Previously, it was allocating both inputs +; in the same register. + +define i32 @func_3() nounwind { +entry: + %retval = alloca i32 ; [#uses=2] + %g_323 = alloca i8 ; [#uses=2] + %p_5 = alloca i64, align 8 ; [#uses=2] + %0 = alloca i32 ; [#uses=2] + %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] + store i64 0, i64* %p_5, align 8 + store i8 1, i8* %g_323, align 1 + %1 = load i8* %g_323, align 1 ; [#uses=1] + %2 = sext i8 %1 to i64 ; [#uses=1] + %3 = load i64* %p_5, align 8 ; [#uses=1] + %4 = sub i64 %3, %2 ; [#uses=1] + %5 = icmp sge i64 %4, 0 ; [#uses=1] + %6 = zext i1 %5 to i32 ; [#uses=1] + store i32 %6, i32* %0, align 4 + %7 = load i32* %0, align 4 ; [#uses=1] + store i32 %7, i32* %retval, align 4 + br label %return + +return: ; preds = %entry + %retval1 = load i32* %retval ; [#uses=1] + ret i32 %retval1 +} From gohman at apple.com Fri Oct 3 19:56:36 2008 From: gohman at apple.com (Dan Gohman) Date: Sat, 04 Oct 2008 00:56:36 -0000 Subject: [llvm-commits] [llvm] r57040 - in /llvm/trunk: include/llvm/CodeGen/FastISel.h lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200810040056.m940uacL022374@zion.cs.uiuc.edu> Author: djg Date: Fri Oct 3 19:56:36 2008 New Revision: 57040 URL: http://llvm.org/viewvc/llvm-project?rev=57040&view=rev Log: Fix fast-isel's handling of atomic instructions. They may expand to multiple basic blocks, in which case fast-isel needs to informed of which block to use as it resumes inserting instructions. 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=57040&r1=57039&r2=57040&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/FastISel.h (original) +++ llvm/trunk/include/llvm/CodeGen/FastISel.h Fri Oct 3 19:56:36 2008 @@ -55,12 +55,20 @@ const TargetLowering &TLI; public: + /// startNewBlock - Set the current block, to which generated + /// machine instructions will be appended, and clear the local + /// CSE map. + /// + void startNewBlock(MachineBasicBlock *mbb) { + setCurrentBlock(mbb); + LocalValueMap.clear(); + } + /// setCurrentBlock - Set the current block, to which generated /// machine instructions will be appended. /// 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=57040&r1=57039&r2=57040&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Fri Oct 3 19:56:36 2008 @@ -756,7 +756,7 @@ CodeGenAndEmitDAG(); SDL->clear(); } - FastIS->setCurrentBlock(BB); + FastIS->startNewBlock(BB); // Do FastISel on as many instructions as possible. for (; BI != End; ++BI) { // Just before the terminator instruction, insert instructions to @@ -794,6 +794,9 @@ } SelectBasicBlock(LLVMBB, BI, next(BI)); + // If the instruction was codegen'd with multiple blocks, + // inform the FastISel object where to resume inserting. + FastIS->setCurrentBlock(BB); continue; } From kremenek at apple.com Sat Oct 4 01:22:53 2008 From: kremenek at apple.com (Ted Kremenek) Date: Sat, 04 Oct 2008 06:22:53 -0000 Subject: [llvm-commits] [llvm] r57043 - /llvm/tags/checker/checker-107/ Message-ID: <200810040622.m946MrAX032690@zion.cs.uiuc.edu> Author: kremenek Date: Sat Oct 4 01:22:52 2008 New Revision: 57043 URL: http://llvm.org/viewvc/llvm-project?rev=57043&view=rev Log: Tagging checker-107. Added: llvm/tags/checker/checker-107/ - copied from r57042, llvm/trunk/ From akyrtzi at gmail.com Sat Oct 4 03:11:51 2008 From: akyrtzi at gmail.com (Argiris Kirtzidis) Date: Sat, 04 Oct 2008 08:11:51 -0000 Subject: [llvm-commits] [llvm] r57046 - /llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Message-ID: <200810040811.m948Bpmn013010@zion.cs.uiuc.edu> Author: akirtzidis Date: Sat Oct 4 03:11:49 2008 New Revision: 57046 URL: http://llvm.org/viewvc/llvm-project?rev=57046&view=rev Log: Fix compilation error on MSVC. 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=57046&r1=57045&r2=57046&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp (original) +++ llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Sat Oct 4 03:11:49 2008 @@ -653,7 +653,7 @@ std::map map; // Setup worklist of initial copies - for (std::map::iterator I = copy_set.begin(), + for (std::multimap::iterator I = copy_set.begin(), E = copy_set.end(); I != E; ) { map.insert(std::make_pair(I->first, I->first)); map.insert(std::make_pair(I->second, I->second)); From akyrtzi at gmail.com Sat Oct 4 03:15:32 2008 From: akyrtzi at gmail.com (Argiris Kirtzidis) Date: Sat, 04 Oct 2008 08:15:32 -0000 Subject: [llvm-commits] [llvm] r57047 - /llvm/trunk/lib/System/Win32/Memory.inc Message-ID: <200810040815.m948FWSf013136@zion.cs.uiuc.edu> Author: akirtzidis Date: Sat Oct 4 03:15:32 2008 New Revision: 57047 URL: http://llvm.org/viewvc/llvm-project?rev=57047&view=rev Log: Add implementations for sys::Memory::setWritable and sys::Memory::setExecutable on Win32 platform. Modified: llvm/trunk/lib/System/Win32/Memory.inc Modified: llvm/trunk/lib/System/Win32/Memory.inc URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Win32/Memory.inc?rev=57047&r1=57046&r2=57047&view=diff ============================================================================== --- llvm/trunk/lib/System/Win32/Memory.inc (original) +++ llvm/trunk/lib/System/Win32/Memory.inc Sat Oct 4 03:15:32 2008 @@ -53,5 +53,13 @@ return false; } +bool Memory::setWritable (MemoryBlock &M, std::string *ErrMsg) { + return true; +} + +bool Memory::setExecutable (MemoryBlock &M, std::string *ErrMsg) { + return false; +} + } From baldrick at free.fr Sat Oct 4 03:45:34 2008 From: baldrick at free.fr (Duncan Sands) Date: Sat, 4 Oct 2008 10:45:34 +0200 Subject: [llvm-commits] [llvm] r57029 - in /llvm/trunk: include/llvm/Attributes.h lib/VMCore/Verifier.cpp In-Reply-To: <200810032111.m93LB4pX014403@zion.cs.uiuc.edu> References: <200810032111.m93LB4pX014403@zion.cs.uiuc.edu> Message-ID: <200810041045.34934.baldrick@free.fr> Hi Devang, thanks for doing this. > + Attributes FnCheckAttr = Attrs & Attribute::FunctionOnly; > + Assert1(!FnCheckAttr, "Attribute " + Attribute::getAsString(FnCheckAttr) + > + " only applies to return values!", V); The message "only applies to return values" is no longer right though. Ciao, Duncan. From edwintorok at gmail.com Sat Oct 4 04:54:54 2008 From: edwintorok at gmail.com (=?UTF-8?B?VMO2csO2ayBFZHdpbg==?=) Date: Sat, 04 Oct 2008 12:54:54 +0300 Subject: [llvm-commits] Adding Lua-5.1.4 and lua_bench-0.1 to llvm-test Message-ID: <48E73D6E.9080000@gmail.com> Hi, I prepared a patch that adds Lua to llvm-test: http://edwintorok.googlepages.com/lua.patch.gz Lua-5.1.4 has an MIT license, and lua_bench a BSD-like license. See below for output of running 'make TEST=nightly report'. I used the short benchmark, lua_bench also has a medium and full size benchmark (300 and 500 seconds respectively), but I considered that those take too long. Can I commit this to llvm-test? There is a CBE failure, I'll open a bug about it: Output/lua.cbe.c:1261: error: conflicting types for ?_longjmp? /usr/include/setjmp.h:91: error: previous declaration of ?_longjmp? was here --------------------------------------------------------------- >>> ========= '/MultiSource/Applications/lua/lua' Program --------------------------------------------------------------- TEST-PASS: compile /MultiSource/Applications/lua/lua TEST-RESULT-compile: Total Execution Time: 1.1280 seconds (1.1449 wall clock) TEST-RESULT-compile: 559292 Output/lua.llvm.bc TEST-RESULT-nat-time: program 22.910000 TEST-PASS: llc /MultiSource/Applications/lua/lua TEST-RESULT-llc: Total Execution Time: 0.5720 seconds (0.5601 wall clock) Total Execution Time: 1.4440 seconds (1.4373 wall clock) TEST-RESULT-llc-time: program 24.350000 TEST-PASS: jit /MultiSource/Applications/lua/lua TEST-RESULT-jit-time: program 26.180000 TEST-RESULT-jit-comptime: Total Execution Time: 0.4400 seconds (0.4599 wall clock) Total Execution Time: 1.1440 seconds (1.1521 wall clock) TEST-FAIL: cbe /MultiSource/Applications/lua/lua make[1]: Leaving directory `/home/edwin/llvm-svn/llvm/projects/llvm-test/MultiSource/Applications/lua' /home/edwin/llvm-svn/llvm/projects/llvm-test/GenerateReport.pl /home/edwin/llvm-svn/llvm/projects/llvm-test/TEST.nightly. report < report.nightly.raw.out > report.nightly.txt Program | GCCAS Bytecode LLC compile LLC-BETA compile JIT codegen | GCC CBE LLC LLC-BETA JIT | GCC/CBE GCC/L LC GCC/LLC-BETA LLC/LLC-BETA lua | 1.1280 559292 0.5720 * 0.4400 | 22.91 * 24.35 * 26.18 | n/a 0.94 n/a n/a From nicholas at mxc.ca Sat Oct 4 05:32:08 2008 From: nicholas at mxc.ca (Nick Lewycky) Date: Sat, 04 Oct 2008 03:32:08 -0700 Subject: [llvm-commits] [llvm] r57025 - in /llvm/trunk: lib/Transforms/Utils/SimplifyCFG.cpp test/Transforms/SimplifyCFG/2008-10-03-SpeculativelyExecuteBeforePHI.ll In-Reply-To: <200810031857.m93IvcNF009190@zion.cs.uiuc.edu> References: <200810031857.m93IvcNF009190@zion.cs.uiuc.edu> Message-ID: <48E74628.7060808@mxc.ca> Thanks Devang! Devang Patel wrote: > Author: dpatel > Date: Fri Oct 3 13:57:37 2008 > New Revision: 57025 > > URL: http://llvm.org/viewvc/llvm-project?rev=57025&view=rev > Log: > Nick Lewycky's patch. > While hosting instruction check PHI node. > > > Added: > llvm/trunk/test/Transforms/SimplifyCFG/2008-10-03-SpeculativelyExecuteBeforePHI.ll > Modified: > llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp > > Modified: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp?rev=57025&r1=57024&r2=57025&view=diff > > ============================================================================== > --- llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp (original) > +++ llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Fri Oct 3 13:57:37 2008 > @@ -1051,7 +1051,7 @@ > BasicBlock::iterator InsertPos = BI; > if (InsertPos != BIParent->begin()) > --InsertPos; > - if (InsertPos == BrCond) { > + if (InsertPos == BrCond && !isa(BrCond)) { > SmallPtrSet BB1Insns; > for(BasicBlock::iterator BB1I = BB1->begin(), BB1E = BB1->end(); > BB1I != BB1E; ++BB1I) > > Added: llvm/trunk/test/Transforms/SimplifyCFG/2008-10-03-SpeculativelyExecuteBeforePHI.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SimplifyCFG/2008-10-03-SpeculativelyExecuteBeforePHI.ll?rev=57025&view=auto > > ============================================================================== > --- llvm/trunk/test/Transforms/SimplifyCFG/2008-10-03-SpeculativelyExecuteBeforePHI.ll (added) > +++ llvm/trunk/test/Transforms/SimplifyCFG/2008-10-03-SpeculativelyExecuteBeforePHI.ll Fri Oct 3 13:57:37 2008 > @@ -0,0 +1,36 @@ > +; RUN: llvm-as < %s | opt -simplifycfg > +; PR2855 > + > +define i32 @_Z1fPii(i32* %b, i32 %f) nounwind { > +entry: > + br label %bb > + > +bb: ; preds = %bb9, %bb7, %bb, %entry > + %__c2.2 = phi i32 [ undef, %entry ], [ %__c2.1, %bb7 ], [ %__c2.1, %bb9 ] ; [#uses=2] > + %s.0 = phi i32 [ 0, %entry ], [ 0, %bb7 ], [ %2, %bb9 ] ; [#uses=1] > + br label %bb1 > + > +bb1: ; preds = %bb > + %0 = icmp slt i32 0, %f ; [#uses=1] > + br i1 %0, label %bb3, label %bb6 > + > +bb3: ; preds = %bb1 > + %1 = icmp eq i32 0, 0 ; [#uses=1] > + br i1 %1, label %bb6, label %bb5 > + > +bb5: ; preds = %bb3 > + br label %bb7 > + > +bb6: ; preds = %bb3, %bb1 > + %__c2.0 = phi i32 [ 0, %bb3 ], [ %__c2.2, %bb1 ] ; [#uses=1] > + br label %bb7 > + > +bb7: ; preds = %bb6, %bb5 > + %__c2.1 = phi i32 [ 0, %bb5 ], [ %__c2.0, %bb6 ] ; [#uses=2] > + %iftmp.1.0 = phi i1 [ false, %bb5 ], [ true, %bb6 ] ; [#uses=1] > + br i1 %iftmp.1.0, label %bb, label %bb9 > + > +bb9: ; preds = %bb7 > + %2 = add i32 %s.0, 2 ; [#uses=1] > + br label %bb > +} > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From nicholas at mxc.ca Sat Oct 4 05:34:21 2008 From: nicholas at mxc.ca (Nick Lewycky) Date: Sat, 04 Oct 2008 03:34:21 -0700 Subject: [llvm-commits] [llvm] r57025 - in /llvm/trunk: lib/Transforms/Utils/SimplifyCFG.cpp test/Transforms/SimplifyCFG/2008-10-03-SpeculativelyExecuteBeforePHI.ll In-Reply-To: <13A76A7C-A8D3-445D-B55F-83B40365B7A4@mac.com> References: <200810031857.m93IvcNF009190@zion.cs.uiuc.edu> <13A76A7C-A8D3-445D-B55F-83B40365B7A4@mac.com> Message-ID: <48E746AD.906@mxc.ca> Owen Anderson wrote: > > On Oct 3, 2008, at 11:57 AM, Devang Patel wrote: >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp (original) >> +++ llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Fri Oct 3 >> 13:57:37 2008 >> @@ -1051,7 +1051,7 @@ >> BasicBlock::iterator InsertPos = BI; >> if (InsertPos != BIParent->begin()) >> --InsertPos; >> - if (InsertPos == BrCond) { >> + if (InsertPos == BrCond && !isa(BrCond)) { >> SmallPtrSet BB1Insns; >> for(BasicBlock::iterator BB1I = BB1->begin(), BB1E = BB1->end(); >> BB1I != BB1E; ++BB1I) > > I'm not sure this is the right fix. It handles this specific case, but > I'm not sure it works in general. I think what you want is something > more like: > > BasicBlock::iterator InsertPos = BI; > if (&*InsertPos != BIParent->getFirstNonPHI()) > --InsertPos; > if (InsertPos == BrCond) ... > > I think that will be more resilient to other situations. Owen and I met over IRC about this. This code works because all PHINodes are guaranteed to be in a contiguous block at the top of the function anyways. If BrCond is a PHI node, InsertPos would be set to 'right before the branch', and work fine. This fix also saves a call to getFirstNonPHI which is a linear scan over the linked-list of Instructions in a block. (Usually a very short list, but regardless.) Nick From asl at math.spbu.ru Sat Oct 4 06:09:39 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Sat, 04 Oct 2008 11:09:39 -0000 Subject: [llvm-commits] [llvm] r57048 - in /llvm/trunk: lib/Target/X86/X86InstrInfo.cpp test/CodeGen/X86/2008-08-31-EH_RETURN32.ll test/CodeGen/X86/2008-08-31-EH_RETURN64.ll Message-ID: <200810041109.m94B9dL9019148@zion.cs.uiuc.edu> Author: asl Date: Sat Oct 4 06:09:36 2008 New Revision: 57048 URL: http://llvm.org/viewvc/llvm-project?rev=57048&view=rev Log: Revert r56675 - it breaks unwinding runtime everywhere. Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp llvm/trunk/test/CodeGen/X86/2008-08-31-EH_RETURN32.ll llvm/trunk/test/CodeGen/X86/2008-08-31-EH_RETURN64.ll Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=57048&r1=57047&r2=57048&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Sat Oct 4 06:09:36 2008 @@ -1833,49 +1833,39 @@ } bool X86InstrInfo::spillCalleeSavedRegisters(MachineBasicBlock &MBB, - MachineBasicBlock::iterator MI, + MachineBasicBlock::iterator MI, const std::vector &CSI) const { if (CSI.empty()) return false; - MachineFunction &MF = *MBB.getParent(); bool is64Bit = TM.getSubtarget().is64Bit(); - unsigned FrameReg = is64Bit ? X86::RBP : X86::EBP; + unsigned SlotSize = is64Bit ? 8 : 4; + + MachineFunction &MF = *MBB.getParent(); + X86MachineFunctionInfo *X86FI = MF.getInfo(); + X86FI->setCalleeSavedFrameSize(CSI.size() * SlotSize); + unsigned Opc = is64Bit ? X86::PUSH64r : X86::PUSH32r; - unsigned CSSize = 0; for (unsigned i = CSI.size(); i != 0; --i) { unsigned Reg = CSI[i-1].getReg(); - if (Reg == FrameReg && RI.hasFP(MF)) - // It will be saved as part of the prologue. - continue; // Add the callee-saved register as live-in. It's killed at the spill. MBB.addLiveIn(Reg); BuildMI(MBB, MI, get(Opc)).addReg(Reg); - ++CSSize; } - - X86MachineFunctionInfo *X86FI = MF.getInfo(); - unsigned SlotSize = is64Bit ? 8 : 4; - X86FI->setCalleeSavedFrameSize(CSSize * SlotSize); return true; } bool X86InstrInfo::restoreCalleeSavedRegisters(MachineBasicBlock &MBB, - MachineBasicBlock::iterator MI, + MachineBasicBlock::iterator MI, const std::vector &CSI) const { if (CSI.empty()) return false; - MachineFunction &MF = *MBB.getParent(); bool is64Bit = TM.getSubtarget().is64Bit(); - unsigned FrameReg = is64Bit ? X86::RBP : X86::EBP; unsigned Opc = is64Bit ? X86::POP64r : X86::POP32r; for (unsigned i = 0, e = CSI.size(); i != e; ++i) { unsigned Reg = CSI[i].getReg(); - if (Reg == FrameReg && RI.hasFP(MF)) - // It will be restored as part of the epilogue. - continue; BuildMI(MBB, MI, get(Opc), Reg); } return true; Modified: llvm/trunk/test/CodeGen/X86/2008-08-31-EH_RETURN32.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2008-08-31-EH_RETURN32.ll?rev=57048&r1=57047&r2=57048&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/2008-08-31-EH_RETURN32.ll (original) +++ llvm/trunk/test/CodeGen/X86/2008-08-31-EH_RETURN32.ll Sat Oct 4 06:09:36 2008 @@ -1,5 +1,5 @@ ; Check that eh_return & unwind_init were properly lowered -; RUN: llvm-as < %s | llc | grep %ebp | count 7 +; RUN: llvm-as < %s | llc | grep %ebp | count 9 ; RUN: llvm-as < %s | llc | grep %ecx | count 5 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" Modified: llvm/trunk/test/CodeGen/X86/2008-08-31-EH_RETURN64.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2008-08-31-EH_RETURN64.ll?rev=57048&r1=57047&r2=57048&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/2008-08-31-EH_RETURN64.ll (original) +++ llvm/trunk/test/CodeGen/X86/2008-08-31-EH_RETURN64.ll Sat Oct 4 06:09:36 2008 @@ -1,5 +1,5 @@ ; Check that eh_return & unwind_init were properly lowered -; RUN: llvm-as < %s | llc | grep %rbp | count 5 +; RUN: llvm-as < %s | llc | grep %rbp | count 7 ; RUN: llvm-as < %s | llc | grep %rcx | count 3 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128" From nicholas at mxc.ca Sat Oct 4 06:19:07 2008 From: nicholas at mxc.ca (Nick Lewycky) Date: Sat, 04 Oct 2008 11:19:07 -0000 Subject: [llvm-commits] [llvm] r57049 - in /llvm/trunk: lib/Analysis/ScalarEvolution.cpp test/Transforms/IndVarsSimplify/2008-10-03-CouldNotCompute.ll Message-ID: <200810041119.m94BJ7Lo019402@zion.cs.uiuc.edu> Author: nicholas Date: Sat Oct 4 06:19:07 2008 New Revision: 57049 URL: http://llvm.org/viewvc/llvm-project?rev=57049&view=rev Log: Allow the construction of SCEVs with SCEVCouldNotCompute operands, by implementing folding. Fixes PR2857. Added: llvm/trunk/test/Transforms/IndVarsSimplify/2008-10-03-CouldNotCompute.ll Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=57049&r1=57048&r2=57049&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original) +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Sat Oct 4 06:19:07 2008 @@ -676,6 +676,9 @@ return getAddRecExpr(Operands, AddRec->getLoop()); } + if (isa(Op)) + return new SCEVCouldNotCompute(); + SCEVTruncateExpr *&Result = (*SCEVTruncates)[std::make_pair(Op, Ty)]; if (Result == 0) Result = new SCEVTruncateExpr(Op, Ty); return Result; @@ -691,6 +694,9 @@ // operands (often constants). This would allow analysis of something like // this: for (unsigned char X = 0; X < 100; ++X) { int Y = X; } + if (isa(Op)) + return new SCEVCouldNotCompute(); + SCEVZeroExtendExpr *&Result = (*SCEVZeroExtends)[std::make_pair(Op, Ty)]; if (Result == 0) Result = new SCEVZeroExtendExpr(Op, Ty); return Result; @@ -706,6 +712,9 @@ // operands (often constants). This would allow analysis of something like // this: for (signed char X = 0; X < 100; ++X) { int Y = X; } + if (isa(Op)) + return new SCEVCouldNotCompute(); + SCEVSignExtendExpr *&Result = (*SCEVSignExtends)[std::make_pair(Op, Ty)]; if (Result == 0) Result = new SCEVSignExtendExpr(Op, Ty); return Result; @@ -734,6 +743,10 @@ // Sort by complexity, this groups all similar expression types together. GroupByComplexity(Ops); + // Could not compute plus anything equals could not compute. + if (isa(Ops.back())) + return new SCEVCouldNotCompute(); + // If there are any constants, fold them together. unsigned Idx = 0; if (SCEVConstant *LHSC = dyn_cast(Ops[0])) { @@ -959,6 +972,21 @@ // Sort by complexity, this groups all similar expression types together. GroupByComplexity(Ops); + if (isa(Ops.back())) { + // CNC * 0 = 0 + for (unsigned i = 0, e = Ops.size() - 1; i != e; ++i) { + if (Ops[i]->getSCEVType() != scConstant) + break; + + SCEVConstant *SC = cast(Ops[i]); + if (SC->getValue()->isMinValue(false)) + return SC; + } + + // Otherwise, we can't compute it. + return new SCEVCouldNotCompute(); + } + // If there are any constants, fold them together. unsigned Idx = 0; if (SCEVConstant *LHSC = dyn_cast(Ops[0])) { @@ -1124,6 +1152,9 @@ // FIXME: implement folding of (X*4)/4 when we know X*4 doesn't overflow. + if (isa(LHS) || isa(RHS)) + return new SCEVCouldNotCompute(); + SCEVUDivExpr *&Result = (*SCEVUDivs)[std::make_pair(LHS, RHS)]; if (Result == 0) Result = new SCEVUDivExpr(LHS, RHS); return Result; @@ -1171,6 +1202,12 @@ } } + // Refuse to build an AddRec out of SCEVCouldNotCompute. + for (unsigned i = 0, e = Operands.size(); i != e; ++i) { + if (isa(Operands[i])) + return new SCEVCouldNotCompute(); + } + SCEVAddRecExpr *&Result = (*SCEVAddRecExprs)[std::make_pair(L, std::vector(Operands.begin(), Operands.end()))]; @@ -1193,6 +1230,21 @@ // Sort by complexity, this groups all similar expression types together. GroupByComplexity(Ops); + if (isa(Ops.back())) { + // CNC smax +inf = +inf. + for (unsigned i = 0, e = Ops.size() - 1; i != e; ++i) { + if (Ops[i]->getSCEVType() != scConstant) + break; + + SCEVConstant *SC = cast(Ops[i]); + if (SC->getValue()->isMaxValue(true)) + return SC; + } + + // Otherwise, we can't compute it. + return new SCEVCouldNotCompute(); + } + // If there are any constants, fold them together. unsigned Idx = 0; if (SCEVConstant *LHSC = dyn_cast(Ops[0])) { @@ -1273,6 +1325,21 @@ // Sort by complexity, this groups all similar expression types together. GroupByComplexity(Ops); + if (isa(Ops[0])) { + // CNC umax inf = inf. + for (unsigned i = 0, e = Ops.size() - 1; i != e; ++i) { + if (Ops[i]->getSCEVType() != scConstant) + break; + + SCEVConstant *SC = cast(Ops[i]); + if (SC->getValue()->isMaxValue(false)) + return SC; + } + + // Otherwise, we can't compute it. + return new SCEVCouldNotCompute(); + } + // If there are any constants, fold them together. unsigned Idx = 0; if (SCEVConstant *LHSC = dyn_cast(Ops[0])) { Added: llvm/trunk/test/Transforms/IndVarsSimplify/2008-10-03-CouldNotCompute.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/IndVarsSimplify/2008-10-03-CouldNotCompute.ll?rev=57049&view=auto ============================================================================== --- llvm/trunk/test/Transforms/IndVarsSimplify/2008-10-03-CouldNotCompute.ll (added) +++ llvm/trunk/test/Transforms/IndVarsSimplify/2008-10-03-CouldNotCompute.ll Sat Oct 4 06:19:07 2008 @@ -0,0 +1,32 @@ +; RUN: llvm-as < %s | opt -indvars +; PR2857 + + at foo = external global i32 ; [#uses=1] + +define void @test(i32 %n, i32 %arg) { +entry: + br i1 false, label %bb.nph, label %return + +bb.nph: ; preds = %entry + %0 = load i32* @foo, align 4 ; [#uses=1] + %1 = sext i32 %0 to i64 ; [#uses=1] + br label %bb + +bb: ; preds = %bb, %bb.nph + %.in = phi i32 [ %2, %bb ], [ %n, %bb.nph ] ; [#uses=1] + %val.02 = phi i64 [ %5, %bb ], [ 0, %bb.nph ] ; [#uses=2] + %result.01 = phi i64 [ %4, %bb ], [ 0, %bb.nph ] ; [#uses=1] + %2 = add i32 %.in, -1 ; [#uses=2] + %3 = mul i64 %1, %val.02 ; [#uses=1] + %4 = add i64 %3, %result.01 ; [#uses=2] + %5 = add i64 %val.02, 1 ; [#uses=1] + %6 = icmp sgt i32 %2, 0 ; [#uses=1] + br i1 %6, label %bb, label %bb3.bb4_crit_edge + +bb3.bb4_crit_edge: ; preds = %bb + %.lcssa = phi i64 [ %4, %bb ] ; [#uses=0] + ret void + +return: ; preds = %entry + ret void +} From baldrick at free.fr Sat Oct 4 08:24:27 2008 From: baldrick at free.fr (Duncan Sands) Date: Sat, 04 Oct 2008 13:24:27 -0000 Subject: [llvm-commits] [llvm] r57050 - in /llvm/trunk: lib/Transforms/IPO/AddReadAttrs.cpp test/Transforms/AddReadAttrs/2008-10-04-LocalMemory.ll Message-ID: <200810041324.m94DORP3022993@zion.cs.uiuc.edu> Author: baldrick Date: Sat Oct 4 08:24:24 2008 New Revision: 57050 URL: http://llvm.org/viewvc/llvm-project?rev=57050&view=rev Log: Ignore loads from and stores to local memory (i.e. allocas) when deciding whether to mark a function readnone/readonly. Since the pass is currently run before SROA, this may be quite helpful. Requested by Chris on IRC. Added: llvm/trunk/test/Transforms/AddReadAttrs/2008-10-04-LocalMemory.ll 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=57050&r1=57049&r2=57050&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp Sat Oct 4 08:24:24 2008 @@ -86,17 +86,34 @@ // Scan the function body for instructions that may read or write memory. for (inst_iterator II = inst_begin(F), E = inst_end(F); II != E; ++II) { - CallSite CS = CallSite::get(&*II); + Instruction *I = &*II; - // Ignore calls to functions in the same SCC. - if (CS.getInstruction() && SCCNodes.count(CG[CS.getCalledFunction()])) - continue; - - if (II->mayWriteToMemory()) + // Some instructions can be ignored even if they read or write memory. + // Detect these now, skipping to the next instruction if one is found. + CallSite CS = CallSite::get(I); + if (CS.getInstruction()) { + // Ignore calls to functions in the same SCC. + if (SCCNodes.count(CG[CS.getCalledFunction()])) + continue; + } else if (LoadInst *LI = dyn_cast(I)) { + Value *Target = LI->getPointerOperand()->getUnderlyingObject(); + // Ignore loads from local memory. + if (isa(Target)) + continue; + } else if (StoreInst *SI = dyn_cast(I)) { + Value *Target = SI->getPointerOperand()->getUnderlyingObject(); + // Ignore stores to local memory. + if (isa(Target)) + continue; + } + + // Any remaining instructions need to be taken seriously! Check if they + // read or write memory. + if (I->mayWriteToMemory()) // Writes memory. Just give up. return false; - - ReadsMemory |= II->mayReadFromMemory(); + // If this instruction may read memory, remember that. + ReadsMemory |= I->mayReadFromMemory(); } } Added: llvm/trunk/test/Transforms/AddReadAttrs/2008-10-04-LocalMemory.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/AddReadAttrs/2008-10-04-LocalMemory.ll?rev=57050&view=auto ============================================================================== --- llvm/trunk/test/Transforms/AddReadAttrs/2008-10-04-LocalMemory.ll (added) +++ llvm/trunk/test/Transforms/AddReadAttrs/2008-10-04-LocalMemory.ll Sat Oct 4 08:24:24 2008 @@ -0,0 +1,10 @@ +; RUN: llvm-as < %s | opt -addreadattrs | llvm-dis | grep readnone | count 2 + +declare i32 @g(i32*) readnone + +define i32 @f() { + %x = alloca i32 ; [#uses=2] + store i32 0, i32* %x + %y = call i32 @g(i32* %x) ; [#uses=1] + ret i32 %y +} From alenhar2 at cs.uiuc.edu Sat Oct 4 09:17:44 2008 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Sat, 04 Oct 2008 14:17:44 -0000 Subject: [llvm-commits] [poolalloc] r57051 - /poolalloc/trunk/lib/DSA/BottomUpClosure.cpp Message-ID: <200810041417.m94EHj6J024750@zion.cs.uiuc.edu> Author: alenhar2 Date: Sat Oct 4 09:17:43 2008 New Revision: 57051 URL: http://llvm.org/viewvc/llvm-project?rev=57051&view=rev Log: Better graph revisit check Modified: poolalloc/trunk/lib/DSA/BottomUpClosure.cpp Modified: poolalloc/trunk/lib/DSA/BottomUpClosure.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/BottomUpClosure.cpp?rev=57051&r1=57050&r2=57051&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/BottomUpClosure.cpp (original) +++ poolalloc/trunk/lib/DSA/BottomUpClosure.cpp Sat Oct 4 09:17:43 2008 @@ -242,6 +242,9 @@ // Find all callee functions. std::vector CalleeFunctions; GetAnyAuxCallees(Graph, CalleeFunctions); + std::sort(CalleeFunctions.begin(), CalleeFunctions.end()); + std::vector::iterator uid = std::unique(CalleeFunctions.begin(), CalleeFunctions.end()); + CalleeFunctions.resize(uid - CalleeFunctions.begin()); // The edges out of the current node are the call site targets... for (unsigned i = 0, e = CalleeFunctions.size(); i != e; ++i) { @@ -274,10 +277,16 @@ if (MaxSCC < 1) MaxSCC = 1; // Should we revisit the graph? Only do it if there are now new resolvable - // callees. - std::vector CalleeFunctionsNew; - GetAnyAuxCallees(Graph, CalleeFunctionsNew); - if (CalleeFunctionsNew.size() > CalleeFunctions.size()) { + // callees or new callees + unsigned oldsize = CalleeFunctions.size(); + GetAnyAuxCallees(Graph, CalleeFunctions); + std::sort(CalleeFunctions.begin(), CalleeFunctions.end()); + std::vector::iterator uid = std::unique(CalleeFunctions.begin(), CalleeFunctions.end()); + CalleeFunctions.resize(uid - CalleeFunctions.begin()); + + std::vector ResolvedFuncs; + GetAllAuxCallees(Graph, ResolvedFuncs); + if (ResolvedFuncs.size() || CalleeFunctions.size() > oldsize) { DOUT << "Recalculating " << F->getName() << " due to new knowledge\n"; ValMap.erase(F); return calculateGraphs(F, Stack, NextID, ValMap); From lhames at gmail.com Sat Oct 4 03:11:47 2008 From: lhames at gmail.com (Lang Hames) Date: Sat, 4 Oct 2008 18:11:47 +1000 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 In-Reply-To: <4943E7F3-248C-48A4-A269-211A08DB80D9@apple.com> References: <200810021829.m92ITS8x014885@zion.cs.uiuc.edu> <4943E7F3-248C-48A4-A269-211A08DB80D9@apple.com> Message-ID: <728927c70810040111r3a26bb32yc3511cfdf67d9123@mail.gmail.com> I just checked MultiSource on my Ubuntu AMD64 box using make DISABLE_LLI=1 DISABLE_JIT=1 DISABLE_CBE=1 ENABLE_LLC=1 ENABLE_LLCBETA=1 where LLCBETA uses -regalloc=pbqp both LLC & LLCBETA fail oggenc, kc, tramp3d-v4. LLCBETA also fails ldecod. I am currently looking into this, however the long weekend here in Australia may hamper efforts for a day or two. ;) I am aware of a SingleSource failure on the TLS unit test too. This seems to me to be a problem exposed by the PBQP allocator's lack of coalescing support, but I'm not familiar enough with tls to be sure. Certainly the same bug appeared when the simple, local or bigblock allocators were used (again on my Ubuntu AMD64 box). The PBQP allocator is not ready for production yet - it has not been optimised, and the lack of coalescing support leads to poor execution times for compiled programs. It is, however (imho), very easy to understand, and I'm hoping (with your feedback) to see big improvements soon. Cheers, Lang. On Sat, Oct 4, 2008 at 7:35 AM, Evan Cheng wrote: > I don't think it's quite meant for production yet. I saw some failures when > running on MultiSource. Lang? > > Evan > > On Oct 3, 2008, at 1:43 PM, Owen Anderson wrote: > >> Is there any dat